From 5af129480536e93097248aee062ef29390fc8e12 Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Tue, 25 Jun 2024 13:56:46 -0400 Subject: [PATCH] Add NAIP example notebook (#71) * Add NAIP example notebook * add deltalake dep * Notebook download version * broader gitignore * Add lonboard section * remove planetary computer signing --- .gitignore | 4 + docs/examples/naip.ipynb | 669 +++++++++++++++++++++++++++++++++++++++ docs/overrides/main.html | 14 + mkdocs.yml | 6 + pyproject.toml | 1 + 5 files changed, 694 insertions(+) create mode 100644 docs/examples/naip.ipynb create mode 100644 docs/overrides/main.html diff --git a/.gitignore b/.gitignore index 02e651c..d2210c4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,7 @@ dist stac_geoparquet/_version.py .cache site +docs/**/*.jsonl +*table +*.parquet +.ipynb_checkpoints diff --git a/docs/examples/naip.ipynb b/docs/examples/naip.ipynb new file mode 100644 index 0000000..8e3fca6 --- /dev/null +++ b/docs/examples/naip.ipynb @@ -0,0 +1,669 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# NAIP example\n", + "\n", + "We'll use STAC Items from the [NAIP STAC Collection](https://planetarycomputer.microsoft.com/dataset/naip) on Microsoft's Planetary Computer to illustrate how to use the `stac-geoparquet` library.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "There are a few libraries we need to install to run this notebook:\n", + "\n", + "```\n", + "pip install pystac-client stac-geoparquet pyarrow deltalake lonboard\n", + "```\n" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "from pathlib import Path\n", + "\n", + "import deltalake\n", + "import lonboard\n", + "import pyarrow as pa\n", + "import pyarrow.parquet as pq\n", + "import pystac_client\n", + "\n", + "import stac_geoparquet" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can open the Planetary Computer STAC Collection with `pystac_client.Client.open`, ensuring we also sign the returned URLs in each STAC Item.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "catalog = pystac_client.Client.open(\n", + " \"https://planetarycomputer.microsoft.com/api/stac/v1\"\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now we'll access the NAIP collection from the Planetary Computer catalog and download 1000 items from this collection, writing them to a newline-delimited JSON file in the current directory.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "items_iter = catalog.get_collection(\"naip\").get_items()\n", + "\n", + "max_items = 1000\n", + "naip_json_path = Path(\"naip.jsonl\")\n", + "if not naip_json_path.exists():\n", + " with open(naip_json_path, \"w\") as f:\n", + " count = 0\n", + "\n", + " for item in items_iter:\n", + " json.dump(item.to_dict(), f, separators=(\",\", \":\"))\n", + " f.write(\"\\n\")\n", + "\n", + " count += 1\n", + " if count >= max_items:\n", + " break" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can now use `stac-geoparquet` APIs on this data.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Loading to Arrow\n", + "\n", + "We can load to an Arrow `RecordBatchReader` by using the `parse_stac_ndjson_to_arrow` function.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "record_batch_reader = stac_geoparquet.arrow.parse_stac_ndjson_to_arrow(naip_json_path)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The Arrow `RecordBatchReader` represents a _stream_ of Arrow batches, which can be useful when converting a very large STAC collection, which you don't want to materialize in memory at once.\n", + "\n", + "We can convert this to an Arrow table with `read_all`.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "assets: struct>, href: string, roles: list, title: string, type: string>, rendered_preview: struct, title: string, type: string>, thumbnail: struct, title: string, type: string>, tilejson: struct, title: string, type: string>>\n", + " child 0, image: struct>, href: string, roles: list, title: string, type: string>\n", + " child 0, eo:bands: list>\n", + " child 0, item: struct\n", + " child 0, common_name: string\n", + " child 1, description: string\n", + " child 2, name: string\n", + " child 1, href: string\n", + " child 2, roles: list\n", + " child 0, item: string\n", + " child 3, title: string\n", + " child 4, type: string\n", + " child 1, rendered_preview: struct, title: string, type: string>\n", + " child 0, href: string\n", + " child 1, rel: string\n", + " child 2, roles: list\n", + " child 0, item: string\n", + " child 3, title: string\n", + " child 4, type: string\n", + " child 2, thumbnail: struct, title: string, type: string>\n", + " child 0, href: string\n", + " child 1, roles: list\n", + " child 0, item: string\n", + " child 2, title: string\n", + " child 3, type: string\n", + " child 3, tilejson: struct, title: string, type: string>\n", + " child 0, href: string\n", + " child 1, roles: list\n", + " child 0, item: string\n", + " child 2, title: string\n", + " child 3, type: string\n", + "bbox: struct\n", + " child 0, xmin: double\n", + " child 1, ymin: double\n", + " child 2, xmax: double\n", + " child 3, ymax: double\n", + "collection: string\n", + "geometry: binary\n", + " -- field metadata --\n", + " ARROW:extension:name: 'geoarrow.wkb'\n", + " ARROW:extension:metadata: '{\"crs\":{\"$schema\":\"https://proj.org/schemas/' + 1296\n", + "id: string\n", + "links: list>\n", + " child 0, item: struct\n", + " child 0, href: string\n", + " child 1, rel: string\n", + " child 2, title: string\n", + " child 3, type: string\n", + "stac_extensions: list\n", + " child 0, item: string\n", + "stac_version: string\n", + "type: string\n", + "datetime: timestamp[us, tz=UTC]\n", + "gsd: double\n", + "naip:state: string\n", + "naip:year: string\n", + "proj:bbox: list\n", + " child 0, item: double\n", + "proj:centroid: struct\n", + " child 0, lat: double\n", + " child 1, lon: double\n", + "proj:epsg: int64\n", + "proj:shape: list\n", + " child 0, item: int64\n", + "proj:transform: list\n", + " child 0, item: double\n", + "providers: list, url: string>>\n", + " child 0, item: struct, url: string>\n", + " child 0, name: string\n", + " child 1, roles: list\n", + " child 0, item: string\n", + " child 2, url: string" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "table = record_batch_reader.read_all()\n", + "table.schema" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can also pass a small chunk size into `parse_stac_ndjson_to_arrow` to show how the streaming works.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "record_batch_reader = stac_geoparquet.arrow.parse_stac_ndjson_to_arrow(\n", + " naip_json_path, chunk_size=100\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "`record_batch_reader` is an iterator that yields Arrow `RecordBatch` objects. If we load just the first one, we'll see that it contains 100 rows.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "100" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "first_batch = next(record_batch_reader)\n", + "first_batch.num_rows" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Materializing the rest of the batches from the iterator into a table gives us the other 900 rows in the dataset.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "900" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "other_batches = record_batch_reader.read_all()\n", + "other_batches.num_rows" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "All batches from the RecordBatchReader have the same schema, so we can concatenate them back into a single table:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [], + "source": [ + "combined_table = pa.concat_tables([pa.Table.from_batches([first_batch]), other_batches])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Both the original `table` object and this `combined_table` object have the exact same data:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "table == combined_table" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Converting to Parquet\n", + "\n", + "We can use the utility function `parse_stac_ndjson_to_parquet` to convert the items directly to GeoParquet.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [], + "source": [ + "naip_parquet_path = \"naip.parquet\"\n", + "stac_geoparquet.arrow.parse_stac_ndjson_to_parquet(naip_json_path, naip_parquet_path)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Reading that Parquet data back into Arrow with `pyarrow.parquet.read_table` gives us the exact same Arrow data as before.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pq.read_table(naip_parquet_path) == table" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Converting to Delta Lake\n", + "\n", + "We can use the utility function `parse_stac_ndjson_to_delta_lake` to convert items directly to Delta Lake.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [], + "source": [ + "naip_delta_lake_path = \"naip_table\"\n", + "stac_geoparquet.arrow.parse_stac_ndjson_to_delta_lake(\n", + " naip_json_path, naip_delta_lake_path, mode=\"overwrite\"\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Reading the Delta Lake table back into Arrow with `deltalake.DeltaTable` gives us the exact same Arrow data as before.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "deltalake.DeltaTable(naip_delta_lake_path).to_pyarrow_table() == table" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Visualizing with Lonboard\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can also connect this to Lonboard to visua\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "eda08da05f4045979e351373b05df28f", + "version_major": 2, + "version_minor": 1 + }, + "text/plain": [ + "Map(basemap_style=()=>(t||e((t={exports:{}}).exports,t),t.exports),mA=(e,t)=>{for(var r in t)$C(e,r,{get:t[r],enumerable:!0})},kJ=(e,t,r,i)=>{if(t&&typeof t==\"object\"||typeof t==\"function\")for(let s of IJ(t))!LJ.call(e,s)&&s!==r&&$C(e,s,{get:()=>t[s],enumerable:!(i=PJ(t,s))||i.enumerable});return e};var Ri=(e,t,r)=>(r=e!=null?EJ(CJ(e)):{},kJ(t||!e||!e.__esModule?$C(r,\"default\",{value:e,enumerable:!0}):r,e));var _z=Br(Di=>{\"use strict\";var r1=Symbol.for(\"react.element\"),RJ=Symbol.for(\"react.portal\"),DJ=Symbol.for(\"react.fragment\"),OJ=Symbol.for(\"react.strict_mode\"),BJ=Symbol.for(\"react.profiler\"),FJ=Symbol.for(\"react.provider\"),zJ=Symbol.for(\"react.context\"),NJ=Symbol.for(\"react.forward_ref\"),UJ=Symbol.for(\"react.suspense\"),VJ=Symbol.for(\"react.memo\"),jJ=Symbol.for(\"react.lazy\"),az=Symbol.iterator;function GJ(e){return e===null||typeof e!=\"object\"?null:(e=az&&e[az]||e[\"@@iterator\"],typeof e==\"function\"?e:null)}var uz={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},hz=Object.assign,fz={};function R_(e,t,r){this.props=e,this.context=t,this.refs=fz,this.updater=r||uz}R_.prototype.isReactComponent={};R_.prototype.setState=function(e,t){if(typeof e!=\"object\"&&typeof e!=\"function\"&&e!=null)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,e,t,\"setState\")};R_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,\"forceUpdate\")};function dz(){}dz.prototype=R_.prototype;function KC(e,t,r){this.props=e,this.context=t,this.refs=fz,this.updater=r||uz}var JC=KC.prototype=new dz;JC.constructor=KC;hz(JC,R_.prototype);JC.isPureReactComponent=!0;var lz=Array.isArray,pz=Object.prototype.hasOwnProperty,tL={current:null},Az={key:!0,ref:!0,__self:!0,__source:!0};function mz(e,t,r){var i,s={},n=null,o=null;if(t!=null)for(i in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(n=\"\"+t.key),t)pz.call(t,i)&&!Az.hasOwnProperty(i)&&(s[i]=t[i]);var c=arguments.length-2;if(c===1)s.children=r;else if(1{\"use strict\";yz.exports=_z()});var Iz=Br(zn=>{\"use strict\";function sL(e,t){var r=e.length;e.push(t);t:for(;0>>1,s=e[i];if(0<_T(s,t))e[i]=t,e[r]=s,r=i;else break t}}function Sh(e){return e.length===0?null:e[0]}function vT(e){if(e.length===0)return null;var t=e[0],r=e.pop();if(r!==t){e[0]=r;t:for(var i=0,s=e.length,n=s>>>1;i_T(c,r))f_T(_,c)?(e[i]=_,e[f]=r,i=f):(e[i]=c,e[o]=r,i=o);else if(f_T(_,r))e[i]=_,e[f]=r,i=f;else break t}}return t}function _T(e,t){var r=e.sortIndex-t.sortIndex;return r!==0?r:e.id-t.id}typeof performance==\"object\"&&typeof performance.now==\"function\"?(vz=performance,zn.unstable_now=function(){return vz.now()}):(rL=Date,xz=rL.now(),zn.unstable_now=function(){return rL.now()-xz});var vz,rL,xz,If=[],gA=[],YJ=1,wu=null,qa=3,xT=!1,_0=!1,n1=!1,Sz=typeof setTimeout==\"function\"?setTimeout:null,Tz=typeof clearTimeout==\"function\"?clearTimeout:null,bz=typeof setImmediate<\"u\"?setImmediate:null;typeof navigator<\"u\"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function oL(e){for(var t=Sh(gA);t!==null;){if(t.callback===null)vT(gA);else if(t.startTime<=e)vT(gA),t.sortIndex=t.expirationTime,sL(If,t);else break;t=Sh(gA)}}function aL(e){if(n1=!1,oL(e),!_0)if(Sh(If)!==null)_0=!0,cL(lL);else{var t=Sh(gA);t!==null&&uL(aL,t.startTime-e)}}function lL(e,t){_0=!1,n1&&(n1=!1,Tz(s1),s1=-1),xT=!0;var r=qa;try{for(oL(t),wu=Sh(If);wu!==null&&(!(wu.expirationTime>t)||e&&!Pz());){var i=wu.callback;if(typeof i==\"function\"){wu.callback=null,qa=wu.priorityLevel;var s=i(wu.expirationTime<=t);t=zn.unstable_now(),typeof s==\"function\"?wu.callback=s:wu===Sh(If)&&vT(If),oL(t)}else vT(If);wu=Sh(If)}if(wu!==null)var n=!0;else{var o=Sh(gA);o!==null&&uL(aL,o.startTime-t),n=!1}return n}finally{wu=null,qa=r,xT=!1}}var bT=!1,yT=null,s1=-1,Mz=5,Ez=-1;function Pz(){return!(zn.unstable_now()-Eze||125i?(e.sortIndex=r,sL(gA,e),Sh(If)===null&&e===Sh(gA)&&(n1?(Tz(s1),s1=-1):n1=!0,uL(aL,r-i))):(e.sortIndex=s,sL(If,e),_0||xT||(_0=!0,cL(lL))),e};zn.unstable_shouldYield=Pz;zn.unstable_wrapCallback=function(e){var t=qa;return function(){var r=qa;qa=t;try{return e.apply(this,arguments)}finally{qa=r}}}});var Lz=Br((tbt,Cz)=>{\"use strict\";Cz.exports=Iz()});var O8=Br(Zc=>{\"use strict\";var QJ=Yi(),Hc=Lz();function Pe(e){for(var t=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+e,r=1;r\"u\"||typeof window.document>\"u\"||typeof window.document.createElement>\"u\"),RL=Object.prototype.hasOwnProperty,$J=/^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$/,kz={},Rz={};function XJ(e){return RL.call(Rz,e)?!0:RL.call(kz,e)?!1:$J.test(e)?Rz[e]=!0:(kz[e]=!0,!1)}function KJ(e,t,r,i){if(r!==null&&r.type===0)return!1;switch(typeof t){case\"function\":case\"symbol\":return!0;case\"boolean\":return i?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!==\"data-\"&&e!==\"aria-\");default:return!1}}function JJ(e,t,r,i){if(t===null||typeof t>\"u\"||KJ(e,t,r,i))return!0;if(i)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Sl(e,t,r,i,s,n,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=i,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=n,this.removeEmptyString=o}var ga={};\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(e){ga[e]=new Sl(e,0,!1,e,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(e){var t=e[0];ga[t]=new Sl(t,1,!1,e[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(e){ga[e]=new Sl(e,2,!1,e.toLowerCase(),null,!1,!1)});[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(e){ga[e]=new Sl(e,2,!1,e,null,!1,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(e){ga[e]=new Sl(e,3,!1,e.toLowerCase(),null,!1,!1)});[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(e){ga[e]=new Sl(e,3,!0,e,null,!1,!1)});[\"capture\",\"download\"].forEach(function(e){ga[e]=new Sl(e,4,!1,e,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(e){ga[e]=new Sl(e,6,!1,e,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(e){ga[e]=new Sl(e,5,!1,e.toLowerCase(),null,!1,!1)});var Tk=/[\\-:]([a-z])/g;function Mk(e){return e[1].toUpperCase()}\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(e){var t=e.replace(Tk,Mk);ga[t]=new Sl(t,1,!1,e,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(e){var t=e.replace(Tk,Mk);ga[t]=new Sl(t,1,!1,e,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(e){var t=e.replace(Tk,Mk);ga[t]=new Sl(t,1,!1,e,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(e){ga[e]=new Sl(e,1,!1,e.toLowerCase(),null,!1,!1)});ga.xlinkHref=new Sl(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(e){ga[e]=new Sl(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ek(e,t,r,i){var s=ga.hasOwnProperty(t)?ga[t]:null;(s!==null?s.type!==0:i||!(2c||s[o]!==n[c]){var f=`\n`+s[o].replace(\" at new \",\" at \");return e.displayName&&f.includes(\"\")&&(f=f.replace(\"\",e.displayName)),f}while(1<=o&&0<=c);break}}}finally{fL=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:\"\")?p1(e):\"\"}function ttt(e){switch(e.tag){case 5:return p1(e.type);case 16:return p1(\"Lazy\");case 13:return p1(\"Suspense\");case 19:return p1(\"SuspenseList\");case 0:case 2:case 15:return e=dL(e.type,!1),e;case 11:return e=dL(e.type.render,!1),e;case 1:return e=dL(e.type,!0),e;default:return\"\"}}function FL(e){if(e==null)return null;if(typeof e==\"function\")return e.displayName||e.name||null;if(typeof e==\"string\")return e;switch(e){case F_:return\"Fragment\";case B_:return\"Portal\";case DL:return\"Profiler\";case Pk:return\"StrictMode\";case OL:return\"Suspense\";case BL:return\"SuspenseList\"}if(typeof e==\"object\")switch(e.$$typeof){case U5:return(e.displayName||\"Context\")+\".Consumer\";case N5:return(e._context.displayName||\"Context\")+\".Provider\";case Ik:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||\"\",e=e!==\"\"?\"ForwardRef(\"+e+\")\":\"ForwardRef\"),e;case Ck:return t=e.displayName||null,t!==null?t:FL(e.type)||\"Memo\";case yA:t=e._payload,e=e._init;try{return FL(e(t))}catch{}}return null}function ett(e){var t=e.type;switch(e.tag){case 24:return\"Cache\";case 9:return(t.displayName||\"Context\")+\".Consumer\";case 10:return(t._context.displayName||\"Context\")+\".Provider\";case 18:return\"DehydratedFragment\";case 11:return e=t.render,e=e.displayName||e.name||\"\",t.displayName||(e!==\"\"?\"ForwardRef(\"+e+\")\":\"ForwardRef\");case 7:return\"Fragment\";case 5:return t;case 4:return\"Portal\";case 3:return\"Root\";case 6:return\"Text\";case 16:return FL(t);case 8:return t===Pk?\"StrictMode\":\"Mode\";case 22:return\"Offscreen\";case 12:return\"Profiler\";case 21:return\"Scope\";case 13:return\"Suspense\";case 19:return\"SuspenseList\";case 25:return\"TracingMarker\";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==\"function\")return t.displayName||t.name||null;if(typeof t==\"string\")return t}return null}function RA(e){switch(typeof e){case\"boolean\":case\"number\":case\"string\":case\"undefined\":return e;case\"object\":return e;default:return\"\"}}function j5(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===\"input\"&&(t===\"checkbox\"||t===\"radio\")}function rtt(e){var t=j5(e)?\"checked\":\"value\",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),i=\"\"+e[t];if(!e.hasOwnProperty(t)&&typeof r<\"u\"&&typeof r.get==\"function\"&&typeof r.set==\"function\"){var s=r.get,n=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){i=\"\"+o,n.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return i},setValue:function(o){i=\"\"+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ST(e){e._valueTracker||(e._valueTracker=rtt(e))}function G5(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),i=\"\";return e&&(i=j5(e)?e.checked?\"true\":\"false\":e.value),e=i,e!==r?(t.setValue(e),!0):!1}function KT(e){if(e=e||(typeof document<\"u\"?document:void 0),typeof e>\"u\")return null;try{return e.activeElement||e.body}catch{return e.body}}function zL(e,t){var r=t.checked;return ms({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Oz(e,t){var r=t.defaultValue==null?\"\":t.defaultValue,i=t.checked!=null?t.checked:t.defaultChecked;r=RA(t.value!=null?t.value:r),e._wrapperState={initialChecked:i,initialValue:r,controlled:t.type===\"checkbox\"||t.type===\"radio\"?t.checked!=null:t.value!=null}}function W5(e,t){t=t.checked,t!=null&&Ek(e,\"checked\",t,!1)}function NL(e,t){W5(e,t);var r=RA(t.value),i=t.type;if(r!=null)i===\"number\"?(r===0&&e.value===\"\"||e.value!=r)&&(e.value=\"\"+r):e.value!==\"\"+r&&(e.value=\"\"+r);else if(i===\"submit\"||i===\"reset\"){e.removeAttribute(\"value\");return}t.hasOwnProperty(\"value\")?UL(e,t.type,r):t.hasOwnProperty(\"defaultValue\")&&UL(e,t.type,RA(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Bz(e,t,r){if(t.hasOwnProperty(\"value\")||t.hasOwnProperty(\"defaultValue\")){var i=t.type;if(!(i!==\"submit\"&&i!==\"reset\"||t.value!==void 0&&t.value!==null))return;t=\"\"+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==\"\"&&(e.name=\"\"),e.defaultChecked=!!e._wrapperState.initialChecked,r!==\"\"&&(e.name=r)}function UL(e,t,r){(t!==\"number\"||KT(e.ownerDocument)!==e)&&(r==null?e.defaultValue=\"\"+e._wrapperState.initialValue:e.defaultValue!==\"\"+r&&(e.defaultValue=\"\"+r))}var A1=Array.isArray;function Y_(e,t,r,i){if(e=e.options,t){t={};for(var s=0;s\"+t.valueOf().toString()+\"\",t=TT.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function P1(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var _1={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},itt=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(_1).forEach(function(e){itt.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),_1[t]=_1[e]})});function Y5(e,t,r){return t==null||typeof t==\"boolean\"||t===\"\"?\"\":r||typeof t!=\"number\"||t===0||_1.hasOwnProperty(e)&&_1[e]?(\"\"+t).trim():t+\"px\"}function Q5(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var i=r.indexOf(\"--\")===0,s=Y5(r,t[r],i);r===\"float\"&&(r=\"cssFloat\"),i?e.setProperty(r,s):e[r]=s}}var ntt=ms({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function GL(e,t){if(t){if(ntt[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Pe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Pe(60));if(typeof t.dangerouslySetInnerHTML!=\"object\"||!(\"__html\"in t.dangerouslySetInnerHTML))throw Error(Pe(61))}if(t.style!=null&&typeof t.style!=\"object\")throw Error(Pe(62))}}function WL(e,t){if(e.indexOf(\"-\")===-1)return typeof t.is==\"string\";switch(e){case\"annotation-xml\":case\"color-profile\":case\"font-face\":case\"font-face-src\":case\"font-face-uri\":case\"font-face-format\":case\"font-face-name\":case\"missing-glyph\":return!1;default:return!0}}var HL=null;function Lk(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qL=null,Q_=null,$_=null;function Nz(e){if(e=q1(e)){if(typeof qL!=\"function\")throw Error(Pe(280));var t=e.stateNode;t&&(t=MM(t),qL(e.stateNode,e.type,t))}}function $5(e){Q_?$_?$_.push(e):$_=[e]:Q_=e}function X5(){if(Q_){var e=Q_,t=$_;if($_=Q_=null,Nz(e),t)for(e=0;e>>=0,e===0?32:31-(Att(e)/mtt|0)|0}var MT=64,ET=4194304;function m1(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function rM(e,t){var r=e.pendingLanes;if(r===0)return 0;var i=0,s=e.suspendedLanes,n=e.pingedLanes,o=r&268435455;if(o!==0){var c=o&~s;c!==0?i=m1(c):(n&=o,n!==0&&(i=m1(n)))}else o=r&~s,o!==0?i=m1(o):n!==0&&(i=m1(n));if(i===0)return 0;if(t!==0&&t!==i&&!(t&s)&&(s=i&-i,n=t&-t,s>=n||s===16&&(n&4194240)!==0))return t;if(i&4&&(i|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=i;0r;r++)t.push(e);return t}function W1(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ih(t),e[t]=r}function vtt(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var i=e.eventTimes;for(e=e.expirationTimes;0=v1),Yz=\" \",Qz=!1;function gN(e,t){switch(e){case\"keyup\":return Ytt.indexOf(t.keyCode)!==-1;case\"keydown\":return t.keyCode!==229;case\"keypress\":case\"mousedown\":case\"focusout\":return!0;default:return!1}}function _N(e){return e=e.detail,typeof e==\"object\"&&\"data\"in e?e.data:null}var z_=!1;function $tt(e,t){switch(e){case\"compositionend\":return _N(t);case\"keypress\":return t.which!==32?null:(Qz=!0,Yz);case\"textInput\":return e=t.data,e===Yz&&Qz?null:e;default:return null}}function Xtt(e,t){if(z_)return e===\"compositionend\"||!Nk&&gN(e,t)?(e=AN(),GT=Bk=wA=null,z_=!1,e):null;switch(e){case\"paste\":return null;case\"keypress\":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=i}t:{for(;r;){if(r.nextSibling){r=r.nextSibling;break t}r=r.parentNode}r=void 0}r=Kz(r)}}function bN(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?bN(e,t.parentNode):\"contains\"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wN(){for(var e=window,t=KT();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href==\"string\"}catch{r=!1}if(r)e=t.contentWindow;else break;t=KT(e.document)}return t}function Uk(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===\"input\"&&(e.type===\"text\"||e.type===\"search\"||e.type===\"tel\"||e.type===\"url\"||e.type===\"password\")||t===\"textarea\"||e.contentEditable===\"true\")}function oet(e){var t=wN(),r=e.focusedElem,i=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&bN(r.ownerDocument.documentElement,r)){if(i!==null&&Uk(r)){if(t=i.start,e=i.end,e===void 0&&(e=t),\"selectionStart\"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=r.textContent.length,n=Math.min(i.start,s);i=i.end===void 0?n:Math.min(i.end,s),!e.extend&&n>i&&(s=i,i=n,n=s),s=Jz(r,n);var o=Jz(r,i);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),n>i?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus==\"function\"&&r.focus(),r=0;r=document.documentMode,N_=null,KL=null,b1=null,JL=!1;function t5(e,t,r){var i=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;JL||N_==null||N_!==KT(i)||(i=N_,\"selectionStart\"in i&&Uk(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),b1&&D1(b1,i)||(b1=i,i=sM(KL,\"onSelect\"),0j_||(e.current=sk[j_],sk[j_]=null,j_--)}function Nn(e,t){j_++,sk[j_]=e.current,e.current=t}var DA={},$a=BA(DA),Kl=BA(!1),M0=DA;function ey(e,t){var r=e.type.contextTypes;if(!r)return DA;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===t)return i.__reactInternalMemoizedMaskedChildContext;var s={},n;for(n in r)s[n]=t[n];return i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Jl(e){return e=e.childContextTypes,e!=null}function aM(){Zn(Kl),Zn($a)}function c5(e,t,r){if($a.current!==DA)throw Error(Pe(168));Nn($a,t),Nn(Kl,r)}function kN(e,t,r){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=\"function\")return r;i=i.getChildContext();for(var s in i)if(!(s in t))throw Error(Pe(108,ett(e)||\"Unknown\",s));return ms({},r,i)}function lM(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||DA,M0=$a.current,Nn($a,e),Nn(Kl,Kl.current),!0}function u5(e,t,r){var i=e.stateNode;if(!i)throw Error(Pe(169));r?(e=kN(e,t,M0),i.__reactInternalMemoizedMergedChildContext=e,Zn(Kl),Zn($a),Nn($a,e)):Zn(Kl),Nn(Kl,r)}var Wd=null,EM=!1,SL=!1;function RN(e){Wd===null?Wd=[e]:Wd.push(e)}function get(e){EM=!0,RN(e)}function FA(){if(!SL&&Wd!==null){SL=!0;var e=0,t=vn;try{var r=Wd;for(vn=1;e>=o,s-=o,Hd=1<<32-Ih(t)+s|r<qt?(le=Xt,Xt=null):le=Xt.sibling;var ue=R(Y,Xt,J[qt],ut);if(ue===null){Xt===null&&(Xt=le);break}e&&Xt&&ue.alternate===null&&t(Y,Xt),K=n(ue,K,qt),kt===null?Et=ue:kt.sibling=ue,kt=ue,Xt=le}if(qt===J.length)return r(Y,Xt),ns&&y0(Y,qt),Et;if(Xt===null){for(;qtqt?(le=Xt,Xt=null):le=Xt.sibling;var De=R(Y,Xt,ue.value,ut);if(De===null){Xt===null&&(Xt=le);break}e&&Xt&&De.alternate===null&&t(Y,Xt),K=n(De,K,qt),kt===null?Et=De:kt.sibling=De,kt=De,Xt=le}if(ue.done)return r(Y,Xt),ns&&y0(Y,qt),Et;if(Xt===null){for(;!ue.done;qt++,ue=J.next())ue=I(Y,ue.value,ut),ue!==null&&(K=n(ue,K,qt),kt===null?Et=ue:kt.sibling=ue,kt=ue);return ns&&y0(Y,qt),Et}for(Xt=i(Y,Xt);!ue.done;qt++,ue=J.next())ue=N(Xt,Y,qt,ue.value,ut),ue!==null&&(e&&ue.alternate!==null&&Xt.delete(ue.key===null?qt:ue.key),K=n(ue,K,qt),kt===null?Et=ue:kt.sibling=ue,kt=ue);return e&&Xt.forEach(function(Ke){return t(Y,Ke)}),ns&&y0(Y,qt),Et}function et(Y,K,J,ut){if(typeof J==\"object\"&&J!==null&&J.type===F_&&J.key===null&&(J=J.props.children),typeof J==\"object\"&&J!==null){switch(J.$$typeof){case wT:t:{for(var Et=J.key,kt=K;kt!==null;){if(kt.key===Et){if(Et=J.type,Et===F_){if(kt.tag===7){r(Y,kt.sibling),K=s(kt,J.props.children),K.return=Y,Y=K;break t}}else if(kt.elementType===Et||typeof Et==\"object\"&&Et!==null&&Et.$$typeof===yA&&d5(Et)===kt.type){r(Y,kt.sibling),K=s(kt,J.props),K.ref=u1(Y,kt,J),K.return=Y,Y=K;break t}r(Y,kt);break}else t(Y,kt);kt=kt.sibling}J.type===F_?(K=T0(J.props.children,Y.mode,ut,J.key),K.return=Y,Y=K):(ut=XT(J.type,J.key,J.props,null,Y.mode,ut),ut.ref=u1(Y,K,J),ut.return=Y,Y=ut)}return o(Y);case B_:t:{for(kt=J.key;K!==null;){if(K.key===kt)if(K.tag===4&&K.stateNode.containerInfo===J.containerInfo&&K.stateNode.implementation===J.implementation){r(Y,K.sibling),K=s(K,J.children||[]),K.return=Y,Y=K;break t}else{r(Y,K);break}else t(Y,K);K=K.sibling}K=kL(J,Y.mode,ut),K.return=Y,Y=K}return o(Y);case yA:return kt=J._init,et(Y,K,kt(J._payload),ut)}if(A1(J))return j(Y,K,J,ut);if(o1(J))return Q(Y,K,J,ut);zT(Y,J)}return typeof J==\"string\"&&J!==\"\"||typeof J==\"number\"?(J=\"\"+J,K!==null&&K.tag===6?(r(Y,K.sibling),K=s(K,J),K.return=Y,Y=K):(r(Y,K),K=LL(J,Y.mode,ut),K.return=Y,Y=K),o(Y)):r(Y,K)}return et}var iy=FN(!0),zN=FN(!1),hM=BA(null),fM=null,H_=null,Wk=null;function Hk(){Wk=H_=fM=null}function qk(e){var t=hM.current;Zn(hM),e._currentValue=t}function lk(e,t,r){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===r)break;e=e.return}}function K_(e,t){fM=e,Wk=H_=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Xl=!0),e.firstContext=null)}function Pu(e){var t=e._currentValue;if(Wk!==e)if(e={context:e,memoizedValue:t,next:null},H_===null){if(fM===null)throw Error(Pe(308));H_=e,fM.dependencies={lanes:0,firstContext:e}}else H_=H_.next=e;return t}var b0=null;function Zk(e){b0===null?b0=[e]:b0.push(e)}function NN(e,t,r,i){var s=t.interleaved;return s===null?(r.next=r,Zk(t)):(r.next=s.next,s.next=r),t.interleaved=r,$d(e,i)}function $d(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var vA=!1;function Yk(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function UN(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Zd(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function IA(e,t,r){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,Zi&2){var s=i.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),i.pending=t,$d(e,r)}return s=i.interleaved,s===null?(t.next=t,Zk(i)):(t.next=s.next,s.next=t),i.interleaved=t,$d(e,r)}function HT(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,Rk(e,r)}}function p5(e,t){var r=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,r===i)){var s=null,n=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};n===null?s=n=o:n=n.next=o,r=r.next}while(r!==null);n===null?s=n=t:n=n.next=t}else s=n=t;r={baseState:i.baseState,firstBaseUpdate:s,lastBaseUpdate:n,shared:i.shared,effects:i.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function dM(e,t,r,i){var s=e.updateQueue;vA=!1;var n=s.firstBaseUpdate,o=s.lastBaseUpdate,c=s.shared.pending;if(c!==null){s.shared.pending=null;var f=c,_=f.next;f.next=null,o===null?n=_:o.next=_,o=f;var w=e.alternate;w!==null&&(w=w.updateQueue,c=w.lastBaseUpdate,c!==o&&(c===null?w.firstBaseUpdate=_:c.next=_,w.lastBaseUpdate=f))}if(n!==null){var I=s.baseState;o=0,w=_=f=null,c=n;do{var R=c.lane,N=c.eventTime;if((i&R)===R){w!==null&&(w=w.next={eventTime:N,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});t:{var j=e,Q=c;switch(R=t,N=r,Q.tag){case 1:if(j=Q.payload,typeof j==\"function\"){I=j.call(N,I,R);break t}I=j;break t;case 3:j.flags=j.flags&-65537|128;case 0:if(j=Q.payload,R=typeof j==\"function\"?j.call(N,I,R):j,R==null)break t;I=ms({},I,R);break t;case 2:vA=!0}}c.callback!==null&&c.lane!==0&&(e.flags|=64,R=s.effects,R===null?s.effects=[c]:R.push(c))}else N={eventTime:N,lane:R,tag:c.tag,payload:c.payload,callback:c.callback,next:null},w===null?(_=w=N,f=I):w=w.next=N,o|=R;if(c=c.next,c===null){if(c=s.shared.pending,c===null)break;R=c,c=R.next,R.next=null,s.lastBaseUpdate=R,s.shared.pending=null}}while(!0);if(w===null&&(f=I),s.baseState=f,s.firstBaseUpdate=_,s.lastBaseUpdate=w,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else n===null&&(s.shared.lanes=0);I0|=o,e.lanes=o,e.memoizedState=I}}function A5(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var i=ML.transition;ML.transition={};try{e(!1),t()}finally{vn=r,ML.transition=i}}function i8(){return Iu().memoizedState}function xet(e,t,r){var i=LA(e);if(r={lane:i,action:r,hasEagerState:!1,eagerState:null,next:null},n8(e))s8(t,r);else if(r=NN(e,t,r,i),r!==null){var s=wl();Ch(r,e,i,s),o8(r,t,i)}}function bet(e,t,r){var i=LA(e),s={lane:i,action:r,hasEagerState:!1,eagerState:null,next:null};if(n8(e))s8(t,s);else{var n=e.alternate;if(e.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var o=t.lastRenderedState,c=n(o,r);if(s.hasEagerState=!0,s.eagerState=c,Lh(c,o)){var f=t.interleaved;f===null?(s.next=s,Zk(t)):(s.next=f.next,f.next=s),t.interleaved=s;return}}catch{}finally{}r=NN(e,t,s,i),r!==null&&(s=wl(),Ch(r,e,i,s),o8(r,t,i))}}function n8(e){var t=e.alternate;return e===As||t!==null&&t===As}function s8(e,t){w1=AM=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function o8(e,t,r){if(r&4194240){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,Rk(e,r)}}var mM={readContext:Pu,useCallback:Za,useContext:Za,useEffect:Za,useImperativeHandle:Za,useInsertionEffect:Za,useLayoutEffect:Za,useMemo:Za,useReducer:Za,useRef:Za,useState:Za,useDebugValue:Za,useDeferredValue:Za,useTransition:Za,useMutableSource:Za,useSyncExternalStore:Za,useId:Za,unstable_isNewReconciler:!1},wet={readContext:Pu,useCallback:function(e,t){return Lf().memoizedState=[e,t===void 0?null:t],e},useContext:Pu,useEffect:g5,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,ZT(4194308,4,KN.bind(null,t,e),r)},useLayoutEffect:function(e,t){return ZT(4194308,4,e,t)},useInsertionEffect:function(e,t){return ZT(4,2,e,t)},useMemo:function(e,t){var r=Lf();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var i=Lf();return t=r!==void 0?r(t):t,i.memoizedState=i.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},i.queue=e,e=e.dispatch=xet.bind(null,As,e),[i.memoizedState,e]},useRef:function(e){var t=Lf();return e={current:e},t.memoizedState=e},useState:m5,useDebugValue:r4,useDeferredValue:function(e){return Lf().memoizedState=e},useTransition:function(){var e=m5(!1),t=e[0];return e=vet.bind(null,e[1]),Lf().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var i=As,s=Lf();if(ns){if(r===void 0)throw Error(Pe(407));r=r()}else{if(r=t(),Jo===null)throw Error(Pe(349));P0&30||WN(i,t,r)}s.memoizedState=r;var n={value:r,getSnapshot:t};return s.queue=n,g5(qN.bind(null,i,n,e),[e]),i.flags|=2048,j1(9,HN.bind(null,i,n,r,t),void 0,null),r},useId:function(){var e=Lf(),t=Jo.identifierPrefix;if(ns){var r=qd,i=Hd;r=(i&~(1<<32-Ih(i)-1)).toString(32)+r,t=\":\"+t+\"R\"+r,r=U1++,0<\\/script>\",e=e.removeChild(e.firstChild)):typeof i.is==\"string\"?e=o.createElement(r,{is:i.is}):(e=o.createElement(r),r===\"select\"&&(o=e,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):e=o.createElementNS(e,r),e[kf]=t,e[F1]=i,m8(e,t,!1,!1),t.stateNode=e;t:{switch(o=WL(r,i),r){case\"dialog\":qn(\"cancel\",e),qn(\"close\",e),s=i;break;case\"iframe\":case\"object\":case\"embed\":qn(\"load\",e),s=i;break;case\"video\":case\"audio\":for(s=0;soy&&(t.flags|=128,i=!0,h1(n,!1),t.lanes=4194304)}else{if(!i)if(e=pM(o),e!==null){if(t.flags|=128,i=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),h1(n,!0),n.tail===null&&n.tailMode===\"hidden\"&&!o.alternate&&!ns)return Ya(t),null}else 2*Xs()-n.renderingStartTime>oy&&r!==1073741824&&(t.flags|=128,i=!0,h1(n,!1),t.lanes=4194304);n.isBackwards?(o.sibling=t.child,t.child=o):(r=n.last,r!==null?r.sibling=o:t.child=o,n.last=o)}return n.tail!==null?(t=n.tail,n.rendering=t,n.tail=t.sibling,n.renderingStartTime=Xs(),t.sibling=null,r=ps.current,Nn(ps,i?r&1|2:r&1),t):(Ya(t),null);case 22:case 23:return l4(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?jc&1073741824&&(Ya(t),t.subtreeFlags&6&&(t.flags|=8192)):Ya(t),null;case 24:return null;case 25:return null}throw Error(Pe(156,t.tag))}function ket(e,t){switch(jk(t),t.tag){case 1:return Jl(t.type)&&aM(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ny(),Zn(Kl),Zn($a),Xk(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return $k(t),null;case 13:if(Zn(ps),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Pe(340));ry()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Zn(ps),null;case 4:return ny(),null;case 10:return qk(t.type._context),null;case 22:case 23:return l4(),null;case 24:return null;default:return null}}var UT=!1,Qa=!1,Ret=typeof WeakSet==\"function\"?WeakSet:Set,ur=null;function q_(e,t){var r=e.ref;if(r!==null)if(typeof r==\"function\")try{r(null)}catch(i){Cs(e,t,i)}else r.current=null}function gk(e,t,r){try{r()}catch(i){Cs(e,t,i)}}var P5=!1;function Det(e,t){if(tk=iM,e=wN(),Uk(e)){if(\"selectionStart\"in e)var r={start:e.selectionStart,end:e.selectionEnd};else t:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var s=i.anchorOffset,n=i.focusNode;i=i.focusOffset;try{r.nodeType,n.nodeType}catch{r=null;break t}var o=0,c=-1,f=-1,_=0,w=0,I=e,R=null;e:for(;;){for(var N;I!==r||s!==0&&I.nodeType!==3||(c=o+s),I!==n||i!==0&&I.nodeType!==3||(f=o+i),I.nodeType===3&&(o+=I.nodeValue.length),(N=I.firstChild)!==null;)R=I,I=N;for(;;){if(I===e)break e;if(R===r&&++_===s&&(c=o),R===n&&++w===i&&(f=o),(N=I.nextSibling)!==null)break;I=R,R=I.parentNode}I=N}r=c===-1||f===-1?null:{start:c,end:f}}else r=null}r=r||{start:0,end:0}}else r=null;for(ek={focusedElem:e,selectionRange:r},iM=!1,ur=t;ur!==null;)if(t=ur,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ur=e;else for(;ur!==null;){t=ur;try{var j=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(j!==null){var Q=j.memoizedProps,et=j.memoizedState,Y=t.stateNode,K=Y.getSnapshotBeforeUpdate(t.elementType===t.type?Q:Mh(t.type,Q),et);Y.__reactInternalSnapshotBeforeUpdate=K}break;case 3:var J=t.stateNode.containerInfo;J.nodeType===1?J.textContent=\"\":J.nodeType===9&&J.documentElement&&J.removeChild(J.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Pe(163))}}catch(ut){Cs(t,t.return,ut)}if(e=t.sibling,e!==null){e.return=t.return,ur=e;break}ur=t.return}return j=P5,P5=!1,j}function S1(e,t,r){var i=t.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var s=i=i.next;do{if((s.tag&e)===e){var n=s.destroy;s.destroy=void 0,n!==void 0&&gk(t,r,n)}s=s.next}while(s!==i)}}function CM(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var i=r.create;r.destroy=i()}r=r.next}while(r!==t)}}function _k(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t==\"function\"?t(e):t.current=e}}function y8(e){var t=e.alternate;t!==null&&(e.alternate=null,y8(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[kf],delete t[F1],delete t[nk],delete t[Aet],delete t[met])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function v8(e){return e.tag===5||e.tag===3||e.tag===4}function I5(e){t:for(;;){for(;e.sibling===null;){if(e.return===null||v8(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue t;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function yk(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=oM));else if(i!==4&&(e=e.child,e!==null))for(yk(e,t,r),e=e.sibling;e!==null;)yk(e,t,r),e=e.sibling}function vk(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(i!==4&&(e=e.child,e!==null))for(vk(e,t,r),e=e.sibling;e!==null;)vk(e,t,r),e=e.sibling}var Aa=null,Eh=!1;function _A(e,t,r){for(r=r.child;r!==null;)x8(e,t,r),r=r.sibling}function x8(e,t,r){if(Rf&&typeof Rf.onCommitFiberUnmount==\"function\")try{Rf.onCommitFiberUnmount(bM,r)}catch{}switch(r.tag){case 5:Qa||q_(r,t);case 6:var i=Aa,s=Eh;Aa=null,_A(e,t,r),Aa=i,Eh=s,Aa!==null&&(Eh?(e=Aa,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Aa.removeChild(r.stateNode));break;case 18:Aa!==null&&(Eh?(e=Aa,r=r.stateNode,e.nodeType===8?wL(e.parentNode,r):e.nodeType===1&&wL(e,r),k1(e)):wL(Aa,r.stateNode));break;case 4:i=Aa,s=Eh,Aa=r.stateNode.containerInfo,Eh=!0,_A(e,t,r),Aa=i,Eh=s;break;case 0:case 11:case 14:case 15:if(!Qa&&(i=r.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){s=i=i.next;do{var n=s,o=n.destroy;n=n.tag,o!==void 0&&(n&2||n&4)&&gk(r,t,o),s=s.next}while(s!==i)}_A(e,t,r);break;case 1:if(!Qa&&(q_(r,t),i=r.stateNode,typeof i.componentWillUnmount==\"function\"))try{i.props=r.memoizedProps,i.state=r.memoizedState,i.componentWillUnmount()}catch(c){Cs(r,t,c)}_A(e,t,r);break;case 21:_A(e,t,r);break;case 22:r.mode&1?(Qa=(i=Qa)||r.memoizedState!==null,_A(e,t,r),Qa=i):_A(e,t,r);break;default:_A(e,t,r)}}function C5(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Ret),t.forEach(function(i){var s=Get.bind(null,e,i);r.has(i)||(r.add(i),i.then(s,s))})}}function Th(e,t){var r=t.deletions;if(r!==null)for(var i=0;is&&(s=o),i&=~n}if(i=s,i=Xs()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Bet(i/1960))-i,10e?16:e,SA===null)var i=!1;else{if(e=SA,SA=null,yM=0,Zi&6)throw Error(Pe(331));var s=Zi;for(Zi|=4,ur=e.current;ur!==null;){var n=ur,o=n.child;if(ur.flags&16){var c=n.deletions;if(c!==null){for(var f=0;fXs()-o4?S0(e,0):s4|=r),tc(e,t)}function I8(e,t){t===0&&(e.mode&1?(t=ET,ET<<=1,!(ET&130023424)&&(ET=4194304)):t=1);var r=wl();e=$d(e,t),e!==null&&(W1(e,t,r),tc(e,r))}function jet(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),I8(e,r)}function Get(e,t){var r=0;switch(e.tag){case 13:var i=e.stateNode,s=e.memoizedState;s!==null&&(r=s.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(Pe(314))}i!==null&&i.delete(t),I8(e,r)}var C8;C8=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Kl.current)Xl=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Xl=!1,Cet(e,t,r);Xl=!!(e.flags&131072)}else Xl=!1,ns&&t.flags&1048576&&DN(t,uM,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;YT(e,t),e=t.pendingProps;var s=ey(t,$a.current);K_(t,r),s=Jk(null,t,i,e,s,r);var n=t4();return t.flags|=1,typeof s==\"object\"&&s!==null&&typeof s.render==\"function\"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Jl(i)?(n=!0,lM(t)):n=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Yk(t),s.updater=IM,t.stateNode=s,s._reactInternals=t,uk(t,i,e,r),t=dk(null,t,i,!0,n,r)):(t.tag=0,ns&&n&&Vk(t),bl(null,t,s,r),t=t.child),t;case 16:i=t.elementType;t:{switch(YT(e,t),e=t.pendingProps,s=i._init,i=s(i._payload),t.type=i,s=t.tag=Het(i),e=Mh(i,e),s){case 0:t=fk(null,t,i,e,r);break t;case 1:t=T5(null,t,i,e,r);break t;case 11:t=w5(null,t,i,e,r);break t;case 14:t=S5(null,t,i,Mh(i.type,e),r);break t}throw Error(Pe(306,i,\"\"))}return t;case 0:return i=t.type,s=t.pendingProps,s=t.elementType===i?s:Mh(i,s),fk(e,t,i,s,r);case 1:return i=t.type,s=t.pendingProps,s=t.elementType===i?s:Mh(i,s),T5(e,t,i,s,r);case 3:t:{if(d8(t),e===null)throw Error(Pe(387));i=t.pendingProps,n=t.memoizedState,s=n.element,UN(e,t),dM(t,i,null,r);var o=t.memoizedState;if(i=o.element,n.isDehydrated)if(n={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=n,t.memoizedState=n,t.flags&256){s=sy(Error(Pe(423)),t),t=M5(e,t,i,r,s);break t}else if(i!==s){s=sy(Error(Pe(424)),t),t=M5(e,t,i,r,s);break t}else for(Gc=PA(t.stateNode.containerInfo.firstChild),Wc=t,ns=!0,Ph=null,r=zN(t,null,i,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(ry(),i===s){t=Xd(e,t,r);break t}bl(e,t,i,r)}t=t.child}return t;case 5:return VN(t),e===null&&ak(t),i=t.type,s=t.pendingProps,n=e!==null?e.memoizedProps:null,o=s.children,rk(i,s)?o=null:n!==null&&rk(i,n)&&(t.flags|=32),f8(e,t),bl(e,t,o,r),t.child;case 6:return e===null&&ak(t),null;case 13:return p8(e,t,r);case 4:return Qk(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=iy(t,null,i,r):bl(e,t,i,r),t.child;case 11:return i=t.type,s=t.pendingProps,s=t.elementType===i?s:Mh(i,s),w5(e,t,i,s,r);case 7:return bl(e,t,t.pendingProps,r),t.child;case 8:return bl(e,t,t.pendingProps.children,r),t.child;case 12:return bl(e,t,t.pendingProps.children,r),t.child;case 10:t:{if(i=t.type._context,s=t.pendingProps,n=t.memoizedProps,o=s.value,Nn(hM,i._currentValue),i._currentValue=o,n!==null)if(Lh(n.value,o)){if(n.children===s.children&&!Kl.current){t=Xd(e,t,r);break t}}else for(n=t.child,n!==null&&(n.return=t);n!==null;){var c=n.dependencies;if(c!==null){o=n.child;for(var f=c.firstContext;f!==null;){if(f.context===i){if(n.tag===1){f=Zd(-1,r&-r),f.tag=2;var _=n.updateQueue;if(_!==null){_=_.shared;var w=_.pending;w===null?f.next=f:(f.next=w.next,w.next=f),_.pending=f}}n.lanes|=r,f=n.alternate,f!==null&&(f.lanes|=r),lk(n.return,r,t),c.lanes|=r;break}f=f.next}}else if(n.tag===10)o=n.type===t.type?null:n.child;else if(n.tag===18){if(o=n.return,o===null)throw Error(Pe(341));o.lanes|=r,c=o.alternate,c!==null&&(c.lanes|=r),lk(o,r,t),o=n.sibling}else o=n.child;if(o!==null)o.return=n;else for(o=n;o!==null;){if(o===t){o=null;break}if(n=o.sibling,n!==null){n.return=o.return,o=n;break}o=o.return}n=o}bl(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,i=t.pendingProps.children,K_(t,r),s=Pu(s),i=i(s),t.flags|=1,bl(e,t,i,r),t.child;case 14:return i=t.type,s=Mh(i,t.pendingProps),s=Mh(i.type,s),S5(e,t,i,s,r);case 15:return u8(e,t,t.type,t.pendingProps,r);case 17:return i=t.type,s=t.pendingProps,s=t.elementType===i?s:Mh(i,s),YT(e,t),t.tag=1,Jl(i)?(e=!0,lM(t)):e=!1,K_(t,r),a8(t,i,s),uk(t,i,s,r),dk(null,t,i,!0,e,r);case 19:return A8(e,t,r);case 22:return h8(e,t,r)}throw Error(Pe(156,t.tag))};function L8(e,t){return nN(e,t)}function Wet(e,t,r,i){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mu(e,t,r,i){return new Wet(e,t,r,i)}function u4(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Het(e){if(typeof e==\"function\")return u4(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ik)return 11;if(e===Ck)return 14}return 2}function kA(e,t){var r=e.alternate;return r===null?(r=Mu(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function XT(e,t,r,i,s,n){var o=2;if(i=e,typeof e==\"function\")u4(e)&&(o=1);else if(typeof e==\"string\")o=5;else t:switch(e){case F_:return T0(r.children,s,n,t);case Pk:o=8,s|=8;break;case DL:return e=Mu(12,r,t,s|2),e.elementType=DL,e.lanes=n,e;case OL:return e=Mu(13,r,t,s),e.elementType=OL,e.lanes=n,e;case BL:return e=Mu(19,r,t,s),e.elementType=BL,e.lanes=n,e;case V5:return kM(r,s,n,t);default:if(typeof e==\"object\"&&e!==null)switch(e.$$typeof){case N5:o=10;break t;case U5:o=9;break t;case Ik:o=11;break t;case Ck:o=14;break t;case yA:o=16,i=null;break t}throw Error(Pe(130,e==null?e:typeof e,\"\"))}return t=Mu(o,r,t,s),t.elementType=e,t.type=i,t.lanes=n,t}function T0(e,t,r,i){return e=Mu(7,e,i,t),e.lanes=r,e}function kM(e,t,r,i){return e=Mu(22,e,i,t),e.elementType=V5,e.lanes=r,e.stateNode={isHidden:!1},e}function LL(e,t,r){return e=Mu(6,e,null,t),e.lanes=r,e}function kL(e,t,r){return t=Mu(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function qet(e,t,r,i,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=AL(0),this.expirationTimes=AL(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=AL(0),this.identifierPrefix=i,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function h4(e,t,r,i,s,n,o,c,f){return e=new qet(e,t,r,c,f),t===1?(t=1,n===!0&&(t|=8)):t=0,n=Mu(3,null,null,t),e.current=n,n.stateNode=e,n.memoizedState={element:i,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yk(n),e}function Zet(e,t,r){var i=3{\"use strict\";function B8(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>\"u\"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=\"function\"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(B8)}catch(e){console.error(e)}}B8(),F8.exports=O8()});var N8=Br(A4=>{\"use strict\";var z8=FM();A4.createRoot=z8.createRoot,A4.hydrateRoot=z8.hydrateRoot;var ibt});var eU=Br((T4,M4)=>{(function(e,t){typeof T4==\"object\"&&typeof M4<\"u\"?M4.exports=t():(e=typeof globalThis<\"u\"?globalThis:e||self,e.maplibregl=t())})(T4,function(){\"use strict\";var e,t,r;function i(n,o){if(!e)e=o;else if(!t)t=o;else{var c=\"var sharedChunk = {}; (\"+e+\")(sharedChunk); (\"+t+\")(sharedChunk);\",f={};e(f),r=o(f),typeof window<\"u\"&&(r.workerUrl=window.URL.createObjectURL(new Blob([c],{type:\"text/javascript\"})))}}i([\"exports\"],function(n){\"use strict\";function o(u,a,h,A){return new(h||(h=Promise))(function(x,E){function P(V){try{F(A.next(V))}catch(q){E(q)}}function D(V){try{F(A.throw(V))}catch(q){E(q)}}function F(V){var q;V.done?x(V.value):(q=V.value,q instanceof h?q:new h(function(X){X(q)})).then(P,D)}F((A=A.apply(u,a||[])).next())})}function c(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,\"default\")?u.default:u}typeof SuppressedError==\"function\"&&SuppressedError;var f=_;function _(u,a){this.x=u,this.y=a}_.prototype={clone:function(){return new _(this.x,this.y)},add:function(u){return this.clone()._add(u)},sub:function(u){return this.clone()._sub(u)},multByPoint:function(u){return this.clone()._multByPoint(u)},divByPoint:function(u){return this.clone()._divByPoint(u)},mult:function(u){return this.clone()._mult(u)},div:function(u){return this.clone()._div(u)},rotate:function(u){return this.clone()._rotate(u)},rotateAround:function(u,a){return this.clone()._rotateAround(u,a)},matMult:function(u){return this.clone()._matMult(u)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(u){return this.x===u.x&&this.y===u.y},dist:function(u){return Math.sqrt(this.distSqr(u))},distSqr:function(u){var a=u.x-this.x,h=u.y-this.y;return a*a+h*h},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(u){return Math.atan2(this.y-u.y,this.x-u.x)},angleWith:function(u){return this.angleWithSep(u.x,u.y)},angleWithSep:function(u,a){return Math.atan2(this.x*a-this.y*u,this.x*u+this.y*a)},_matMult:function(u){var a=u[2]*this.x+u[3]*this.y;return this.x=u[0]*this.x+u[1]*this.y,this.y=a,this},_add:function(u){return this.x+=u.x,this.y+=u.y,this},_sub:function(u){return this.x-=u.x,this.y-=u.y,this},_mult:function(u){return this.x*=u,this.y*=u,this},_div:function(u){return this.x/=u,this.y/=u,this},_multByPoint:function(u){return this.x*=u.x,this.y*=u.y,this},_divByPoint:function(u){return this.x/=u.x,this.y/=u.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var u=this.y;return this.y=this.x,this.x=-u,this},_rotate:function(u){var a=Math.cos(u),h=Math.sin(u),A=h*this.x+a*this.y;return this.x=a*this.x-h*this.y,this.y=A,this},_rotateAround:function(u,a){var h=Math.cos(u),A=Math.sin(u),x=a.y+A*(this.x-a.x)+h*(this.y-a.y);return this.x=a.x+h*(this.x-a.x)-A*(this.y-a.y),this.y=x,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},_.convert=function(u){return u instanceof _?u:Array.isArray(u)?new _(u[0],u[1]):u};var w=c(f),I=R;function R(u,a,h,A){this.cx=3*u,this.bx=3*(h-u)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*a,this.by=3*(A-a)-this.cy,this.ay=1-this.cy-this.by,this.p1x=u,this.p1y=a,this.p2x=h,this.p2y=A}R.prototype={sampleCurveX:function(u){return((this.ax*u+this.bx)*u+this.cx)*u},sampleCurveY:function(u){return((this.ay*u+this.by)*u+this.cy)*u},sampleCurveDerivativeX:function(u){return(3*this.ax*u+2*this.bx)*u+this.cx},solveCurveX:function(u,a){if(a===void 0&&(a=1e-6),u<0)return 0;if(u>1)return 1;for(var h=u,A=0;A<8;A++){var x=this.sampleCurveX(h)-u;if(Math.abs(x)x?P=h:D=h,h=.5*(D-P)+P;return h},solve:function(u,a){return this.sampleCurveY(this.solveCurveX(u,a))}};var N=c(I);let j,Q;function et(){return j==null&&(j=typeof OffscreenCanvas<\"u\"&&new OffscreenCanvas(1,1).getContext(\"2d\")&&typeof createImageBitmap==\"function\"),j}function Y(){if(Q==null&&(Q=!1,et())){let a=new OffscreenCanvas(5,5).getContext(\"2d\",{willReadFrequently:!0});if(a){for(let A=0;A<5*5;A++){let x=4*A;a.fillStyle=`rgb(${x},${x+1},${x+2})`,a.fillRect(A%5,Math.floor(A/5),1,1)}let h=a.getImageData(0,0,5,5).data;for(let A=0;A<5*5*4;A++)if(A%4!=3&&h[A]!==A){Q=!0;break}}}return Q||!1}function K(u,a,h,A){let x=new N(u,a,h,A);return function(E){return x.solve(E)}}let J=K(.25,.1,.25,1);function ut(u,a,h){return Math.min(h,Math.max(a,u))}function Et(u,a,h){let A=h-a,x=((u-a)%A+A)%A+a;return x===a?h:x}function kt(u,...a){for(let h of a)for(let A in h)u[A]=h[A];return u}let Xt=1;function qt(u,a,h){let A={};for(let x in u)A[x]=a.call(h||this,u[x],x,u);return A}function le(u,a,h){let A={};for(let x in u)a.call(h||this,u[x],x,u)&&(A[x]=u[x]);return A}function ue(u){return Array.isArray(u)?u.map(ue):typeof u==\"object\"&&u?qt(u,ue):u}let De={};function Ke(u){De[u]||(typeof console<\"u\"&&console.warn(u),De[u]=!0)}function rr(u,a,h){return(h.y-u.y)*(a.x-u.x)>(a.y-u.y)*(h.x-u.x)}function Sr(u){let a=0;for(let h,A,x=0,E=u.length,P=E-1;x\"u\")throw new Error(\"VideoFrame not supported\");let E=new VideoFrame(u,{timestamp:0});try{let P=E?.format;if(!P||!P.startsWith(\"BGR\")&&!P.startsWith(\"RGB\"))throw new Error(`Unrecognized format ${P}`);let D=P.startsWith(\"BGR\"),F=new Uint8ClampedArray(A*x*4);if(yield E.copyTo(F,function(V,q,X,rt,at){let ct=4*Math.max(-q,0),mt=(Math.max(0,X)-X)*rt*4+ct,bt=4*rt,Pt=Math.max(0,q),jt=Math.max(0,X);return{rect:{x:Pt,y:jt,width:Math.min(V.width,q+rt)-Pt,height:Math.min(V.height,X+at)-jt},layout:[{offset:mt,stride:bt}]}}(u,a,h,A,x)),D)for(let V=0;VcancelAnimationFrame(a)}},getImageData(u,a=0){return this.getImageCanvasContext(u).getImageData(-a,-a,u.width+2*a,u.height+2*a)},getImageCanvasContext(u){let a=window.document.createElement(\"canvas\"),h=a.getContext(\"2d\",{willReadFrequently:!0});if(!h)throw new Error(\"failed to create canvas 2d context\");return a.width=u.width,a.height=u.height,h.drawImage(u,0,0,u.width,u.height),h},resolveURL:u=>(Ns||(Ns=document.createElement(\"a\")),Ns.href=u,Ns.href),hardwareConcurrency:typeof navigator<\"u\"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(ll==null&&(ll=matchMedia(\"(prefers-reduced-motion: reduce)\")),ll.matches)}},Rc={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:\"\"};class Xi extends Error{constructor(a,h,A,x){super(`AJAXError: ${h} (${a}): ${A}`),this.status=a,this.statusText=h,this.url=A,this.body=x}}let Jn=Li()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol===\"blob:\"?window.parent:window).location.href,ki=u=>Rc.REGISTERED_PROTOCOLS[u.substring(0,u.indexOf(\"://\"))];function ts(u,a){let h=new AbortController,A=new Request(u.url,{method:u.method||\"GET\",body:u.body,credentials:u.credentials,headers:u.headers,cache:u.cache,referrer:Jn(),signal:h.signal}),x=!1,E=!1;return u.type===\"json\"&&A.headers.set(\"Accept\",\"application/json\"),E||fetch(A).then(P=>P.ok?(D=>{(u.type===\"arrayBuffer\"||u.type===\"image\"?D.arrayBuffer():u.type===\"json\"?D.json():D.text()).then(F=>{E||(x=!0,a(null,F,D.headers.get(\"Cache-Control\"),D.headers.get(\"Expires\")))}).catch(F=>{E||a(new Error(F.message))})})(P):P.blob().then(D=>a(new Xi(P.status,P.statusText,u.url,D)))).catch(P=>{P.code!==20&&a(new Error(P.message))}),{cancel:()=>{E=!0,x||h.abort()}}}let Vo=function(u,a){if(/:\\/\\//.test(u.url)&&!/^https?:|^file:/.test(u.url)){if(Li()&&self.worker&&self.worker.actor)return self.worker.actor.send(\"getResource\",u,a);if(!Li())return(ki(u.url)||ts)(u,a)}if(!(/^file:/.test(h=u.url)||/^file:/.test(Jn())&&!/^\\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,\"signal\"))return ts(u,a);if(Li()&&self.worker&&self.worker.actor)return self.worker.actor.send(\"getResource\",u,a,void 0,!0)}var h;return function(A,x){let E=new XMLHttpRequest;E.open(A.method||\"GET\",A.url,!0),A.type!==\"arrayBuffer\"&&A.type!==\"image\"||(E.responseType=\"arraybuffer\");for(let P in A.headers)E.setRequestHeader(P,A.headers[P]);return A.type===\"json\"&&(E.responseType=\"text\",E.setRequestHeader(\"Accept\",\"application/json\")),E.withCredentials=A.credentials===\"include\",E.onerror=()=>{x(new Error(E.statusText))},E.onload=()=>{if((E.status>=200&&E.status<300||E.status===0)&&E.response!==null){let P=E.response;if(A.type===\"json\")try{P=JSON.parse(E.response)}catch(D){return x(D)}x(null,P,E.getResponseHeader(\"Cache-Control\"),E.getResponseHeader(\"Expires\"))}else{let P=new Blob([E.response],{type:E.getResponseHeader(\"Content-Type\")});x(new Xi(E.status,E.statusText,A.url,P))}},E.send(A.body),{cancel:()=>E.abort()}}(u,a)},cl=function(u,a){return Vo(kt(u,{type:\"arrayBuffer\"}),a)};function xo(u){if(!u||u.indexOf(\"://\")<=0||u.indexOf(\"data:image/\")===0||u.indexOf(\"blob:\")===0)return!0;let a=new URL(u),h=window.location;return a.protocol===h.protocol&&a.host===h.host}function Pa(u,a,h){h[u]&&h[u].indexOf(a)!==-1||(h[u]=h[u]||[],h[u].push(a))}function na(u,a,h){if(h&&h[u]){let A=h[u].indexOf(a);A!==-1&&h[u].splice(A,1)}}class as{constructor(a,h={}){kt(this,h),this.type=a}}class ao extends as{constructor(a,h={}){super(\"error\",kt({error:a},h))}}class Nl{on(a,h){return this._listeners=this._listeners||{},Pa(a,h,this._listeners),this}off(a,h){return na(a,h,this._listeners),na(a,h,this._oneTimeListeners),this}once(a,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},Pa(a,h,this._oneTimeListeners),this):new Promise(A=>this.once(a,A))}fire(a,h){typeof a==\"string\"&&(a=new as(a,h||{}));let A=a.type;if(this.listens(A)){a.target=this;let x=this._listeners&&this._listeners[A]?this._listeners[A].slice():[];for(let D of x)D.call(this,a);let E=this._oneTimeListeners&&this._oneTimeListeners[A]?this._oneTimeListeners[A].slice():[];for(let D of E)na(A,D,this._oneTimeListeners),D.call(this,a);let P=this._eventedParent;P&&(kt(a,typeof this._eventedParentData==\"function\"?this._eventedParentData():this._eventedParentData),P.fire(a))}else a instanceof ao&&console.error(a.error);return this}listens(a){return this._listeners&&this._listeners[a]&&this._listeners[a].length>0||this._oneTimeListeners&&this._oneTimeListeners[a]&&this._oneTimeListeners[a].length>0||this._eventedParent&&this._eventedParent.listens(a)}setEventedParent(a,h){return this._eventedParent=a,this._eventedParentData=h,this}}var ee={$version:8,$root:{version:{required:!0,type:\"enum\",values:[8]},name:{type:\"string\"},metadata:{type:\"*\"},center:{type:\"array\",value:\"number\"},zoom:{type:\"number\"},bearing:{type:\"number\",default:0,period:360,units:\"degrees\"},pitch:{type:\"number\",default:0,units:\"degrees\"},light:{type:\"light\"},terrain:{type:\"terrain\"},sources:{required:!0,type:\"sources\"},sprite:{type:\"sprite\"},glyphs:{type:\"string\"},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},\"*\":{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:\"*\"},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:{required:!0,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:{},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_background\"],layout_background:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"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\",\"property-type\":\"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\",\"property-type\":\"constant\"}},layout_heatmap:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},\"layout_fill-extrusion\":{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_line:{\"line-cap\":{type:\"enum\",values:{butt:{},round:{},square:{}},default:\"butt\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"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\"]},\"property-type\":\"data-constant\"},\"line-round-limit\":{type:\"number\",default:1.05,requires:[{\"line-join\":\"round\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"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\"]},\"property-type\":\"data-constant\"},\"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\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_raster:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_hillshade:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},filter:{type:\"array\",value:\"*\"},filter_operator:{type:\"enum\",values:{\"==\":{},\"!=\":{},\">\":{},\">=\":{},\"<\":{},\"<=\":{},in:{},\"!in\":{},all:{},any:{},none:{},has:{},\"!has\":{},within:{}}},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:\"*\",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}},terrain:{source:{type:\"string\",required:!0},exaggeration:{type:\"number\",minimum:0,default:1}},paint:[\"paint_fill\",\"paint_line\",\"paint_circle\",\"paint_heatmap\",\"paint_fill-extrusion\",\"paint_symbol\",\"paint_raster\",\"paint_hillshade\",\"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-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"fill-pattern\"}],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,minimum:0,units:\"meters\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-base\":{type:\"number\",default:0,minimum: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-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\"]},\"property-type\":\"cross-faded\"},\"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\"},\"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:\"number\",default:335,minimum:0,maximum:359,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:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-highlight-color\":{type:\"color\",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\"}},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\"}}};let ls=[\"type\",\"source\",\"source-layer\",\"minzoom\",\"maxzoom\",\"filter\",\"layout\"];function mn(u,a){let h={};for(let A in u)A!==\"ref\"&&(h[A]=u[A]);return ls.forEach(A=>{A in a&&(h[A]=a[A])}),h}function gi(u,a){if(Array.isArray(u)){if(!Array.isArray(a)||u.length!==a.length)return!1;for(let h=0;h`:u.itemType.kind===\"value\"?\"array\":`array<${a}>`}return u.kind}let _t=[Ca,Te,Dr,gr,Us,gt,La,vt(Mr),tt,nt,ht];function Dt(u,a){if(a.kind===\"error\")return null;if(u.kind===\"array\"){if(a.kind===\"array\"&&(a.N===0&&a.itemType.kind===\"value\"||!Dt(u.itemType,a.itemType))&&(typeof u.N!=\"number\"||u.N===a.N))return null}else{if(u.kind===a.kind)return null;if(u.kind===\"value\"){for(let h of _t)if(!Dt(h,a))return null}}return`Expected ${xt(u)} but found ${xt(a)} instead.`}function Mt(u,a){return a.some(h=>h.kind===u.kind)}function Vt(u,a){return a.some(h=>h===\"null\"?u===null:h===\"array\"?Array.isArray(u):h===\"object\"?u&&!Array.isArray(u)&&typeof u==\"object\":h===typeof u)}function ie(u,a){return u.kind===\"array\"&&a.kind===\"array\"?u.itemType.kind===a.itemType.kind&&typeof u.N==\"number\":u.kind===a.kind}let se=.96422,ae=.82521,lr=4/29,vr=6/29,Xe=3*vr*vr,cr=vr*vr*vr,wr=Math.PI/180,xi=180/Math.PI;function zi(u){return(u%=360)<0&&(u+=360),u}function ni([u,a,h,A]){let x,E,P=jn((.2225045*(u=Hr(u))+.7168786*(a=Hr(a))+.0606169*(h=Hr(h)))/1);u===a&&a===h?x=E=P:(x=jn((.4360747*u+.3850649*a+.1430804*h)/se),E=jn((.0139322*u+.0971045*a+.7141733*h)/ae));let D=116*P-16;return[D<0?0:D,500*(x-P),200*(P-E),A]}function Hr(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function jn(u){return u>cr?Math.pow(u,1/3):u/Xe+lr}function Bi([u,a,h,A]){let x=(u+16)/116,E=isNaN(a)?x:x+a/500,P=isNaN(h)?x:x-h/200;return x=1*es(x),E=se*es(E),P=ae*es(P),[xn(3.1338561*E-1.6168667*x-.4906146*P),xn(-.9787684*E+1.9161415*x+.033454*P),xn(.0719453*E-.2289914*x+1.4052427*P),A]}function xn(u){return(u=u<=.00304?12.92*u:1.055*Math.pow(u,1/2.4)-.055)<0?0:u>1?1:u}function es(u){return u>vr?u*u*u:Xe*(u-lr)}function oa(u){return parseInt(u.padEnd(2,u),16)/255}function Um(u,a){return Vl(a?u/100:u,0,1)}function Vl(u,a,h){return Math.min(Math.max(a,u),h)}function Ss(u){return!u.some(Number.isNaN)}let nh={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]};class ai{constructor(a,h,A,x=1,E=!0){this.r=a,this.g=h,this.b=A,this.a=x,E||(this.r*=x,this.g*=x,this.b*=x,x||this.overwriteGetter(\"rgb\",[a,h,A,x]))}static parse(a){if(a instanceof ai)return a;if(typeof a!=\"string\")return;let h=function(A){if((A=A.toLowerCase().trim())===\"transparent\")return[0,0,0,0];let x=nh[A];if(x){let[P,D,F]=x;return[P/255,D/255,F/255,1]}if(A.startsWith(\"#\")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(A)){let P=A.length<6?1:2,D=1;return[oa(A.slice(D,D+=P)),oa(A.slice(D,D+=P)),oa(A.slice(D,D+=P)),oa(A.slice(D,D+P)||\"ff\")]}if(A.startsWith(\"rgb\")){let P=A.match(/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(P){let[D,F,V,q,X,rt,at,ct,mt,bt,Pt,jt]=P,Rt=[q||\" \",at||\" \",bt].join(\"\");if(Rt===\" \"||Rt===\" /\"||Rt===\",,\"||Rt===\",,,\"){let Gt=[V,rt,mt].join(\"\"),Yt=Gt===\"%%%\"?100:Gt===\"\"?255:0;if(Yt){let ce=[Vl(+F/Yt,0,1),Vl(+X/Yt,0,1),Vl(+ct/Yt,0,1),Pt?Um(+Pt,jt):1];if(Ss(ce))return ce}}return}}let E=A.match(/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(E){let[P,D,F,V,q,X,rt,at,ct]=E,mt=[F||\" \",q||\" \",rt].join(\"\");if(mt===\" \"||mt===\" /\"||mt===\",,\"||mt===\",,,\"){let bt=[+D,Vl(+V,0,100),Vl(+X,0,100),at?Um(+at,ct):1];if(Ss(bt))return function([Pt,jt,Rt,Gt]){function Yt(ce){let Ne=(ce+Pt/30)%12,ir=jt*Math.min(Rt,1-Rt);return Rt-ir*Math.max(-1,Math.min(Ne-3,9-Ne,1))}return Pt=zi(Pt),jt/=100,Rt/=100,[Yt(0),Yt(8),Yt(4),Gt]}(bt)}}}(a);return h?new ai(...h,!1):void 0}get rgb(){let{r:a,g:h,b:A,a:x}=this,E=x||1/0;return this.overwriteGetter(\"rgb\",[a/E,h/E,A/E,x])}get hcl(){return this.overwriteGetter(\"hcl\",function(a){let[h,A,x,E]=ni(a),P=Math.sqrt(A*A+x*x);return[Math.round(1e4*P)?zi(Math.atan2(x,A)*xi):NaN,P,h,E]}(this.rgb))}get lab(){return this.overwriteGetter(\"lab\",ni(this.rgb))}overwriteGetter(a,h){return Object.defineProperty(this,a,{value:h}),h}toString(){let[a,h,A,x]=this.rgb;return`rgba(${[a,h,A].map(E=>Math.round(255*E)).join(\",\")},${x})`}}ai.black=new ai(0,0,0,1),ai.white=new ai(1,1,1,1),ai.transparent=new ai(0,0,0,0),ai.red=new ai(1,0,0,1);class ka{constructor(a,h,A){this.sensitivity=a?h?\"variant\":\"case\":h?\"accent\":\"base\",this.locale=A,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:\"search\"})}compare(a,h){return this.collator.compare(a,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Dc{constructor(a,h,A,x,E){this.text=a,this.image=h,this.scale=A,this.fontStack=x,this.textColor=E}}class ln{constructor(a){this.sections=a}static fromString(a){return new ln([new Dc(a,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(a=>a.text.length!==0||a.image&&a.image.name.length!==0)}static factory(a){return a instanceof ln?a:ln.fromString(a)}toString(){return this.sections.length===0?\"\":this.sections.map(a=>a.text).join(\"\")}}class Dn{constructor(a){this.values=a.slice()}static parse(a){if(a instanceof Dn)return a;if(typeof a==\"number\")return new Dn([a,a,a,a]);if(Array.isArray(a)&&!(a.length<1||a.length>4)){for(let h of a)if(typeof h!=\"number\")return;switch(a.length){case 1:a=[a[0],a[0],a[0],a[0]];break;case 2:a=[a[0],a[1],a[0],a[1]];break;case 3:a=[a[0],a[1],a[2],a[1]]}return new Dn(a)}}toString(){return JSON.stringify(this.values)}}let Vm=new Set([\"center\",\"left\",\"right\",\"top\",\"bottom\",\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"]);class Go{constructor(a){this.values=a.slice()}static parse(a){if(a instanceof Go)return a;if(Array.isArray(a)&&!(a.length<1)&&a.length%2==0){for(let h=0;h=0&&u<=255&&typeof a==\"number\"&&a>=0&&a<=255&&typeof h==\"number\"&&h>=0&&h<=255?A===void 0||typeof A==\"number\"&&A>=0&&A<=1?null:`Invalid rgba value [${[u,a,h,A].join(\", \")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof A==\"number\"?[u,a,h,A]:[u,a,h]).join(\", \")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function jl(u){if(u===null||typeof u==\"string\"||typeof u==\"boolean\"||typeof u==\"number\"||u instanceof ai||u instanceof ka||u instanceof ln||u instanceof Dn||u instanceof Go||u instanceof Gn)return!0;if(Array.isArray(u)){for(let a of u)if(!jl(a))return!1;return!0}if(typeof u==\"object\"){for(let a in u)if(!jl(u[a]))return!1;return!0}return!1}function Ki(u){if(u===null)return Ca;if(typeof u==\"string\")return Dr;if(typeof u==\"boolean\")return gr;if(typeof u==\"number\")return Te;if(u instanceof ai)return Us;if(u instanceof ka)return sa;if(u instanceof ln)return gt;if(u instanceof Dn)return tt;if(u instanceof Go)return ht;if(u instanceof Gn)return nt;if(Array.isArray(u)){let a=u.length,h;for(let A of u){let x=Ki(A);if(h){if(h===x)continue;h=Mr;break}h=x}return vt(h||Mr,a)}return La}function _i(u){let a=typeof u;return u===null?\"\":a===\"string\"||a===\"number\"||a===\"boolean\"?String(u):u instanceof ai||u instanceof ln||u instanceof Dn||u instanceof Go||u instanceof Gn?u.toString():JSON.stringify(u)}class Gl{constructor(a,h){this.type=a,this.value=h}static parse(a,h){if(a.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${a.length-1} instead.`);if(!jl(a[1]))return h.error(\"invalid value\");let A=a[1],x=Ki(A),E=h.expectedType;return x.kind!==\"array\"||x.N!==0||!E||E.kind!==\"array\"||typeof E.N==\"number\"&&E.N!==0||(x=E),new Gl(x,A)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class cn{constructor(a){this.name=\"ExpressionEvaluationError\",this.message=a}toJSON(){return this.message}}let pu={string:Dr,number:Te,boolean:gr,object:La};class rs{constructor(a,h){this.type=a,this.args=h}static parse(a,h){if(a.length<2)return h.error(\"Expected at least one argument.\");let A,x=1,E=a[0];if(E===\"array\"){let D,F;if(a.length>2){let V=a[1];if(typeof V!=\"string\"||!(V in pu)||V===\"object\")return h.error('The item type argument of \"array\" must be one of string, number, boolean',1);D=pu[V],x++}else D=Mr;if(a.length>3){if(a[2]!==null&&(typeof a[2]!=\"number\"||a[2]<0||a[2]!==Math.floor(a[2])))return h.error('The length argument to \"array\" must be a positive integer literal',2);F=a[2],x++}A=vt(D,F)}else{if(!pu[E])throw new Error(`Types doesn't contain name = ${E}`);A=pu[E]}let P=[];for(;xa.outputDefined())}}let Gp={\"to-boolean\":gr,\"to-color\":Us,\"to-number\":Te,\"to-string\":Dr};class Wl{constructor(a,h){this.type=a,this.args=h}static parse(a,h){if(a.length<2)return h.error(\"Expected at least one argument.\");let A=a[0];if(!Gp[A])throw new Error(`Can't parse ${A} as it is not part of the known types`);if((A===\"to-boolean\"||A===\"to-string\")&&a.length!==2)return h.error(\"Expected one argument.\");let x=Gp[A],E=[];for(let P=1;P4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:So(h[0],h[1],h[2],h[3]),!A))return new ai(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new cn(A||`Could not parse color from value '${typeof h==\"string\"?h:JSON.stringify(h)}'`)}case\"padding\":{let h;for(let A of this.args){h=A.evaluate(a);let x=Dn.parse(h);if(x)return x}throw new cn(`Could not parse padding from value '${typeof h==\"string\"?h:JSON.stringify(h)}'`)}case\"variableAnchorOffsetCollection\":{let h;for(let A of this.args){h=A.evaluate(a);let x=Go.parse(h);if(x)return x}throw new cn(`Could not parse variableAnchorOffsetCollection from value '${typeof h==\"string\"?h:JSON.stringify(h)}'`)}case\"number\":{let h=null;for(let A of this.args){if(h=A.evaluate(a),h===null)return 0;let x=Number(h);if(!isNaN(x))return x}throw new cn(`Could not convert ${JSON.stringify(h)} to number.`)}case\"formatted\":return ln.fromString(_i(this.args[0].evaluate(a)));case\"resolvedImage\":return Gn.fromString(_i(this.args[0].evaluate(a)));default:return _i(this.args[0].evaluate(a))}}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}}let _d=[\"Unknown\",\"Point\",\"LineString\",\"Polygon\"];class yd{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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\"?_d[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(a){let h=this._parseColorCache[a];return h||(h=this._parseColorCache[a]=ai.parse(a)),h}}class vd{constructor(a,h,A=[],x,E=new Ul,P=[]){this.registry=a,this.path=A,this.key=A.map(D=>`[${D}]`).join(\"\"),this.scope=E,this.errors=P,this.expectedType=x,this._isConstant=h}parse(a,h,A,x,E={}){return h?this.concat(h,A,x)._parse(a,E):this._parse(a,E)}_parse(a,h){function A(x,E,P){return P===\"assert\"?new rs(E,[x]):P===\"coerce\"?new Wl(E,[x]):x}if(a!==null&&typeof a!=\"string\"&&typeof a!=\"boolean\"&&typeof a!=\"number\"||(a=[\"literal\",a]),Array.isArray(a)){if(a.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].');let x=a[0];if(typeof x!=\"string\")return this.error(`Expression name must be a string, but found ${typeof x} instead. If you wanted a literal array, use [\"literal\", [...]].`,0),null;let E=this.registry[x];if(E){let P=E.parse(a,this);if(!P)return null;if(this.expectedType){let D=this.expectedType,F=P.type;if(D.kind!==\"string\"&&D.kind!==\"number\"&&D.kind!==\"boolean\"&&D.kind!==\"object\"&&D.kind!==\"array\"||F.kind!==\"value\")if(D.kind!==\"color\"&&D.kind!==\"formatted\"&&D.kind!==\"resolvedImage\"||F.kind!==\"value\"&&F.kind!==\"string\")if(D.kind!==\"padding\"||F.kind!==\"value\"&&F.kind!==\"number\"&&F.kind!==\"array\")if(D.kind!==\"variableAnchorOffsetCollection\"||F.kind!==\"value\"&&F.kind!==\"array\"){if(this.checkSubtype(D,F))return null}else P=A(P,D,h.typeAnnotation||\"coerce\");else P=A(P,D,h.typeAnnotation||\"coerce\");else P=A(P,D,h.typeAnnotation||\"coerce\");else P=A(P,D,h.typeAnnotation||\"assert\")}if(!(P instanceof Gl)&&P.type.kind!==\"resolvedImage\"&&this._isConstant(P)){let D=new yd;try{P=new Gl(P.type,P.evaluate(D))}catch(F){return this.error(F.message),null}}return P}return this.error(`Unknown expression \"${x}\". If you wanted a literal array, use [\"literal\", [...]].`,0)}return this.error(a===void 0?\"'undefined' value invalid. Use null instead.\":typeof a==\"object\"?'Bare objects invalid. Use [\"literal\", {...}] instead.':`Expected an array, but found ${typeof a} instead.`)}concat(a,h,A){let x=typeof a==\"number\"?this.path.concat(a):this.path,E=A?this.scope.concat(A):this.scope;return new vd(this.registry,this._isConstant,x,h||null,E,this.errors)}error(a,...h){let A=`${this.key}${h.map(x=>`[${x}]`).join(\"\")}`;this.errors.push(new gn(A,a))}checkSubtype(a,h){let A=Dt(a,h);return A&&this.error(A),A}}class xd{constructor(a,h,A){this.type=sa,this.locale=A,this.caseSensitive=a,this.diacriticSensitive=h}static parse(a,h){if(a.length!==2)return h.error(\"Expected one argument.\");let A=a[1];if(typeof A!=\"object\"||Array.isArray(A))return h.error(\"Collator options argument must be an object.\");let x=h.parse(A[\"case-sensitive\"]!==void 0&&A[\"case-sensitive\"],1,gr);if(!x)return null;let E=h.parse(A[\"diacritic-sensitive\"]!==void 0&&A[\"diacritic-sensitive\"],1,gr);if(!E)return null;let P=null;return A.locale&&(P=h.parse(A.locale,1,Dr),!P)?null:new xd(x,E,P)}evaluate(a){return new ka(this.caseSensitive.evaluate(a),this.diacriticSensitive.evaluate(a),this.locale?this.locale.evaluate(a):null)}eachChild(a){a(this.caseSensitive),a(this.diacriticSensitive),this.locale&&a(this.locale)}outputDefined(){return!1}}let lt=8192;function ft(u,a){u[0]=Math.min(u[0],a[0]),u[1]=Math.min(u[1],a[1]),u[2]=Math.max(u[2],a[0]),u[3]=Math.max(u[3],a[1])}function Lt(u,a){return!(u[0]<=a[0]||u[2]>=a[2]||u[1]<=a[1]||u[3]>=a[3])}function Kt(u,a){let h=(180+u[0])/360,A=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u[1]*Math.PI/360)))/360,x=Math.pow(2,a.z);return[Math.round(h*x*lt),Math.round(A*x*lt)]}function ge(u,a,h){let A=u[0]-a[0],x=u[1]-a[1],E=u[0]-h[0],P=u[1]-h[1];return A*P-E*x==0&&A*E<=0&&x*P<=0}function Qe(u,a){let h=!1;for(let P=0,D=a.length;P(A=u)[1]!=(E=F[V+1])[1]>A[1]&&A[0]<(E[0]-x[0])*(A[1]-x[1])/(E[1]-x[1])+x[0]&&(h=!h)}}var A,x,E;return h}function ti(u,a){for(let h=0;h0&&D<0||P<0&&D>0}function Ts(u,a,h){for(let V of h)for(let q=0;qh[2]){let x=.5*A,E=u[0]-h[0]>x?-A:h[0]-u[0]>x?A:0;E===0&&(E=u[0]-h[2]>x?-A:h[2]-u[0]>x?A:0),u[0]+=E}ft(a,u)}function l_(u,a,h,A){let x=Math.pow(2,A.z)*lt,E=[A.x*lt,A.y*lt],P=[];for(let D of u)for(let F of D){let V=[F.x+E[0],F.y+E[1]];Bx(V,a,h,x),P.push(V)}return P}function c_(u,a,h,A){let x=Math.pow(2,A.z)*lt,E=[A.x*lt,A.y*lt],P=[];for(let F of u){let V=[];for(let q of F){let X=[q.x+E[0],q.y+E[1]];ft(a,X),V.push(X)}P.push(V)}if(a[2]-a[0]<=x/2){(D=a)[0]=D[1]=1/0,D[2]=D[3]=-1/0;for(let F of P)for(let V of F)Bx(V,a,h,x)}var D;return P}class gf{constructor(a,h){this.type=gr,this.geojson=a,this.geometries=h}static parse(a,h){if(a.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${a.length-1} instead.`);if(jl(a[1])){let A=a[1];if(A.type===\"FeatureCollection\")for(let x=0;x!Array.isArray(V)||V.length===a.length-1),F=null;for(let[V,q]of D){F=new vd(h.registry,Wm,h.path,null,h.scope);let X=[],rt=!1;for(let at=1;at{return rt=X,Array.isArray(rt)?`(${rt.map(xt).join(\", \")})`:`(${xt(rt.type)}...)`;var rt}).join(\" | \"),q=[];for(let X=1;X{h=a?h&&Wm(A):h&&A instanceof Gl}),!!h&&Hm(u)&&qm(u,[\"zoom\",\"heatmap-density\",\"line-progress\",\"accumulated\",\"is-supported-script\"])}function Hm(u){if(u instanceof fl&&(u.name===\"get\"&&u.args.length===1||u.name===\"feature-state\"||u.name===\"has\"&&u.args.length===1||u.name===\"properties\"||u.name===\"geometry-type\"||u.name===\"id\"||/^filter-/.test(u.name))||u instanceof gf)return!1;let a=!0;return u.eachChild(h=>{a&&!Hm(h)&&(a=!1)}),a}function Wp(u){if(u instanceof fl&&u.name===\"feature-state\")return!1;let a=!0;return u.eachChild(h=>{a&&!Wp(h)&&(a=!1)}),a}function qm(u,a){if(u instanceof fl&&a.indexOf(u.name)>=0)return!1;let h=!0;return u.eachChild(A=>{h&&!qm(A,a)&&(h=!1)}),h}function bd(u,a){let h=u.length-1,A,x,E=0,P=h,D=0;for(;E<=P;)if(D=Math.floor((E+P)/2),A=u[D],x=u[D+1],A<=a){if(D===h||aa))throw new cn(\"Input is not a number.\");P=D-1}return 0}class sh{constructor(a,h,A){this.type=a,this.input=h,this.labels=[],this.outputs=[];for(let[x,E]of A)this.labels.push(x),this.outputs.push(E)}static parse(a,h){if(a.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if((a.length-1)%2!=0)return h.error(\"Expected an even number of arguments.\");let A=h.parse(a[1],1,Te);if(!A)return null;let x=[],E=null;h.expectedType&&h.expectedType.kind!==\"value\"&&(E=h.expectedType);for(let P=1;P=D)return h.error('Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.',V);let X=h.parse(F,q,E);if(!X)return null;E=E||X.type,x.push([D,X])}return new sh(E,A,x)}evaluate(a){let h=this.labels,A=this.outputs;if(h.length===1)return A[0].evaluate(a);let x=this.input.evaluate(a);if(x<=h[0])return A[0].evaluate(a);let E=h.length;return x>=h[E-1]?A[E-1].evaluate(a):A[bd(h,x)].evaluate(a)}eachChild(a){a(this.input);for(let h of this.outputs)a(h)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}}function ui(u,a,h){return u+h*(a-u)}function Zm(u,a,h){return u.map((A,x)=>ui(A,a[x],h))}let Da={number:ui,color:function(u,a,h,A=\"rgb\"){switch(A){case\"rgb\":{let[x,E,P,D]=Zm(u.rgb,a.rgb,h);return new ai(x,E,P,D,!1)}case\"hcl\":{let[x,E,P,D]=u.hcl,[F,V,q,X]=a.hcl,rt,at;if(isNaN(x)||isNaN(F))isNaN(x)?isNaN(F)?rt=NaN:(rt=F,P!==1&&P!==0||(at=V)):(rt=x,q!==1&&q!==0||(at=E));else{let jt=F-x;F>x&&jt>180?jt-=360:F180&&(jt+=360),rt=x+h*jt}let[ct,mt,bt,Pt]=function([jt,Rt,Gt,Yt]){return jt=isNaN(jt)?0:jt*wr,Bi([Gt,Math.cos(jt)*Rt,Math.sin(jt)*Rt,Yt])}([rt,at??ui(E,V,h),ui(P,q,h),ui(D,X,h)]);return new ai(ct,mt,bt,Pt,!1)}case\"lab\":{let[x,E,P,D]=Bi(Zm(u.lab,a.lab,h));return new ai(x,E,P,D,!1)}}},array:Zm,padding:function(u,a,h){return new Dn(Zm(u.values,a.values,h))},variableAnchorOffsetCollection:function(u,a,h){let A=u.values,x=a.values;if(A.length!==x.length)throw new cn(`Cannot interpolate values of different length. from: ${u.toString()}, to: ${a.toString()}`);let E=[];for(let P=0;Ptypeof q!=\"number\"||q<0||q>1))return h.error(\"Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.\",1);x={name:\"cubic-bezier\",controlPoints:V}}}if(a.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if((a.length-1)%2!=0)return h.error(\"Expected an even number of arguments.\");if(E=h.parse(E,2,Te),!E)return null;let D=[],F=null;A===\"interpolate-hcl\"||A===\"interpolate-lab\"?F=Us:h.expectedType&&h.expectedType.kind!==\"value\"&&(F=h.expectedType);for(let V=0;V=q)return h.error('Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.',rt);let ct=h.parse(X,at,F);if(!ct)return null;F=F||ct.type,D.push([q,ct])}return ie(F,Te)||ie(F,Us)||ie(F,tt)||ie(F,ht)||ie(F,vt(Te))?new Oa(F,A,x,E,D):h.error(`Type ${xt(F)} is not interpolatable.`)}evaluate(a){let h=this.labels,A=this.outputs;if(h.length===1)return A[0].evaluate(a);let x=this.input.evaluate(a);if(x<=h[0])return A[0].evaluate(a);let E=h.length;if(x>=h[E-1])return A[E-1].evaluate(a);let P=bd(h,x),D=Oa.interpolationFactor(this.interpolation,x,h[P],h[P+1]),F=A[P].evaluate(a),V=A[P+1].evaluate(a);switch(this.operator){case\"interpolate\":return Da[this.type.kind](F,V,D);case\"interpolate-hcl\":return Da.color(F,V,D,\"hcl\");case\"interpolate-lab\":return Da.color(F,V,D,\"lab\")}}eachChild(a){a(this.input);for(let h of this.outputs)a(h)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}}function u_(u,a,h,A){let x=A-h,E=u-h;return x===0?0:a===1?E/x:(Math.pow(a,E)-1)/(Math.pow(a,x)-1)}class Ym{constructor(a,h){this.type=a,this.args=h}static parse(a,h){if(a.length<2)return h.error(\"Expectected at least one argument.\");let A=null,x=h.expectedType;x&&x.kind!==\"value\"&&(A=x);let E=[];for(let D of a.slice(1)){let F=h.parse(D,1+E.length,A,void 0,{typeAnnotation:\"omit\"});if(!F)return null;A=A||F.type,E.push(F)}if(!A)throw new Error(\"No output type\");let P=x&&E.some(D=>Dt(x,D.type));return new Ym(P?Mr:A,E)}evaluate(a){let h,A=null,x=0;for(let E of this.args)if(x++,A=E.evaluate(a),A&&A instanceof Gn&&!A.available&&(h||(h=A.name),A=null,x===this.args.length&&(A=h)),A!==null)break;return A}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}}class Qm{constructor(a,h){this.type=h.type,this.bindings=[].concat(a),this.result=h}evaluate(a){return this.result.evaluate(a)}eachChild(a){for(let h of this.bindings)a(h[1]);a(this.result)}static parse(a,h){if(a.length<4)return h.error(`Expected at least 3 arguments, but found ${a.length-1} instead.`);let A=[];for(let E=1;E=A.length)throw new cn(`Array index out of bounds: ${h} > ${A.length-1}.`);if(h!==Math.floor(h))throw new cn(`Array index must be an integer, but found ${h} instead.`);return A[h]}eachChild(a){a(this.index),a(this.input)}outputDefined(){return!1}}class $m{constructor(a,h){this.type=gr,this.needle=a,this.haystack=h}static parse(a,h){if(a.length!==3)return h.error(`Expected 2 arguments, but found ${a.length-1} instead.`);let A=h.parse(a[1],1,Mr),x=h.parse(a[2],2,Mr);return A&&x?Mt(A.type,[gr,Dr,Te,Ca,Mr])?new $m(A,x):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${xt(A.type)} instead`):null}evaluate(a){let h=this.needle.evaluate(a),A=this.haystack.evaluate(a);if(!A)return!1;if(!Vt(h,[\"boolean\",\"string\",\"number\",\"null\"]))throw new cn(`Expected first argument to be of type boolean, string, number or null, but found ${xt(Ki(h))} instead.`);if(!Vt(A,[\"string\",\"array\"]))throw new cn(`Expected second argument to be of type array or string, but found ${xt(Ki(A))} instead.`);return A.indexOf(h)>=0}eachChild(a){a(this.needle),a(this.haystack)}outputDefined(){return!0}}class qp{constructor(a,h,A){this.type=Te,this.needle=a,this.haystack=h,this.fromIndex=A}static parse(a,h){if(a.length<=2||a.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${a.length-1} instead.`);let A=h.parse(a[1],1,Mr),x=h.parse(a[2],2,Mr);if(!A||!x)return null;if(!Mt(A.type,[gr,Dr,Te,Ca,Mr]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${xt(A.type)} instead`);if(a.length===4){let E=h.parse(a[3],3,Te);return E?new qp(A,x,E):null}return new qp(A,x)}evaluate(a){let h=this.needle.evaluate(a),A=this.haystack.evaluate(a);if(!Vt(h,[\"boolean\",\"string\",\"number\",\"null\"]))throw new cn(`Expected first argument to be of type boolean, string, number or null, but found ${xt(Ki(h))} instead.`);if(!Vt(A,[\"string\",\"array\"]))throw new cn(`Expected second argument to be of type array or string, but found ${xt(Ki(A))} instead.`);if(this.fromIndex){let x=this.fromIndex.evaluate(a);return A.indexOf(h,x)}return A.indexOf(h)}eachChild(a){a(this.needle),a(this.haystack),this.fromIndex&&a(this.fromIndex)}outputDefined(){return!1}}class wd{constructor(a,h,A,x,E,P){this.inputType=a,this.type=h,this.input=A,this.cases=x,this.outputs=E,this.otherwise=P}static parse(a,h){if(a.length<5)return h.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if(a.length%2!=1)return h.error(\"Expected an even number of arguments.\");let A,x;h.expectedType&&h.expectedType.kind!==\"value\"&&(x=h.expectedType);let E={},P=[];for(let V=2;VNumber.MAX_SAFE_INTEGER)return rt.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ct==\"number\"&&Math.floor(ct)!==ct)return rt.error(\"Numeric branch labels must be integer values.\");if(A){if(rt.checkSubtype(A,Ki(ct)))return null}else A=Ki(ct);if(E[String(ct)]!==void 0)return rt.error(\"Branch labels must be unique.\");E[String(ct)]=P.length}let at=h.parse(X,V,x);if(!at)return null;x=x||at.type,P.push(at)}let D=h.parse(a[1],1,Mr);if(!D)return null;let F=h.parse(a[a.length-1],a.length-1,x);return F?D.type.kind!==\"value\"&&h.concat(1).checkSubtype(A,D.type)?null:new wd(A,x,D,E,P,F):null}evaluate(a){let h=this.input.evaluate(a);return(Ki(h)===this.inputType&&this.outputs[this.cases[h]]||this.otherwise).evaluate(a)}eachChild(a){a(this.input),this.outputs.forEach(a),a(this.otherwise)}outputDefined(){return this.outputs.every(a=>a.outputDefined())&&this.otherwise.outputDefined()}}class Zp{constructor(a,h,A){this.type=a,this.branches=h,this.otherwise=A}static parse(a,h){if(a.length<4)return h.error(`Expected at least 3 arguments, but found only ${a.length-1}.`);if(a.length%2!=0)return h.error(\"Expected an odd number of arguments.\");let A;h.expectedType&&h.expectedType.kind!==\"value\"&&(A=h.expectedType);let x=[];for(let P=1;Ph.outputDefined())&&this.otherwise.outputDefined()}}class Sd{constructor(a,h,A,x){this.type=a,this.input=h,this.beginIndex=A,this.endIndex=x}static parse(a,h){if(a.length<=2||a.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${a.length-1} instead.`);let A=h.parse(a[1],1,Mr),x=h.parse(a[2],2,Te);if(!A||!x)return null;if(!Mt(A.type,[vt(Mr),Dr,Mr]))return h.error(`Expected first argument to be of type array or string, but found ${xt(A.type)} instead`);if(a.length===4){let E=h.parse(a[3],3,Te);return E?new Sd(A.type,A,x,E):null}return new Sd(A.type,A,x)}evaluate(a){let h=this.input.evaluate(a),A=this.beginIndex.evaluate(a);if(!Vt(h,[\"string\",\"array\"]))throw new cn(`Expected first argument to be of type array or string, but found ${xt(Ki(h))} instead.`);if(this.endIndex){let x=this.endIndex.evaluate(a);return h.slice(A,x)}return h.slice(A)}eachChild(a){a(this.input),a(this.beginIndex),this.endIndex&&a(this.endIndex)}outputDefined(){return!1}}function Xm(u,a){return u===\"==\"||u===\"!=\"?a.kind===\"boolean\"||a.kind===\"string\"||a.kind===\"number\"||a.kind===\"null\"||a.kind===\"value\":a.kind===\"string\"||a.kind===\"number\"||a.kind===\"value\"}function Td(u,a,h,A){return A.compare(a,h)===0}function Au(u,a,h){let A=u!==\"==\"&&u!==\"!=\";return class tU{constructor(E,P,D){this.type=gr,this.lhs=E,this.rhs=P,this.collator=D,this.hasUntypedArgument=E.type.kind===\"value\"||P.type.kind===\"value\"}static parse(E,P){if(E.length!==3&&E.length!==4)return P.error(\"Expected two or three arguments.\");let D=E[0],F=P.parse(E[1],1,Mr);if(!F)return null;if(!Xm(D,F.type))return P.concat(1).error(`\"${D}\" comparisons are not supported for type '${xt(F.type)}'.`);let V=P.parse(E[2],2,Mr);if(!V)return null;if(!Xm(D,V.type))return P.concat(2).error(`\"${D}\" comparisons are not supported for type '${xt(V.type)}'.`);if(F.type.kind!==V.type.kind&&F.type.kind!==\"value\"&&V.type.kind!==\"value\")return P.error(`Cannot compare types '${xt(F.type)}' and '${xt(V.type)}'.`);A&&(F.type.kind===\"value\"&&V.type.kind!==\"value\"?F=new rs(V.type,[F]):F.type.kind!==\"value\"&&V.type.kind===\"value\"&&(V=new rs(F.type,[V])));let q=null;if(E.length===4){if(F.type.kind!==\"string\"&&V.type.kind!==\"string\"&&F.type.kind!==\"value\"&&V.type.kind!==\"value\")return P.error(\"Cannot use collator to compare non-string types.\");if(q=P.parse(E[3],3,sa),!q)return null}return new tU(F,V,q)}evaluate(E){let P=this.lhs.evaluate(E),D=this.rhs.evaluate(E);if(A&&this.hasUntypedArgument){let F=Ki(P),V=Ki(D);if(F.kind!==V.kind||F.kind!==\"string\"&&F.kind!==\"number\")throw new cn(`Expected arguments for \"${u}\" to be (string, string) or (number, number), but found (${F.kind}, ${V.kind}) instead.`)}if(this.collator&&!A&&this.hasUntypedArgument){let F=Ki(P),V=Ki(D);if(F.kind!==\"string\"||V.kind!==\"string\")return a(E,P,D)}return this.collator?h(E,P,D,this.collator.evaluate(E)):a(E,P,D)}eachChild(E){E(this.lhs),E(this.rhs),this.collator&&E(this.collator)}outputDefined(){return!0}}}let oh=Au(\"==\",function(u,a,h){return a===h},Td),Zt=Au(\"!=\",function(u,a,h){return a!==h},function(u,a,h,A){return!Td(0,a,h,A)}),fe=Au(\"<\",function(u,a,h){return a\",function(u,a,h){return a>h},function(u,a,h,A){return A.compare(a,h)>0}),br=Au(\"<=\",function(u,a,h){return a<=h},function(u,a,h,A){return A.compare(a,h)<=0}),g=Au(\">=\",function(u,a,h){return a>=h},function(u,a,h,A){return A.compare(a,h)>=0});class Vi{constructor(a,h,A,x,E){this.type=Dr,this.number=a,this.locale=h,this.currency=A,this.minFractionDigits=x,this.maxFractionDigits=E}static parse(a,h){if(a.length!==3)return h.error(\"Expected two arguments.\");let A=h.parse(a[1],1,Te);if(!A)return null;let x=a[2];if(typeof x!=\"object\"||Array.isArray(x))return h.error(\"NumberFormat options argument must be an object.\");let E=null;if(x.locale&&(E=h.parse(x.locale,1,Dr),!E))return null;let P=null;if(x.currency&&(P=h.parse(x.currency,1,Dr),!P))return null;let D=null;if(x[\"min-fraction-digits\"]&&(D=h.parse(x[\"min-fraction-digits\"],1,Te),!D))return null;let F=null;return x[\"max-fraction-digits\"]&&(F=h.parse(x[\"max-fraction-digits\"],1,Te),!F)?null:new Vi(A,E,P,D,F)}evaluate(a){return new Intl.NumberFormat(this.locale?this.locale.evaluate(a):[],{style:this.currency?\"currency\":\"decimal\",currency:this.currency?this.currency.evaluate(a):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(a):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(a):void 0}).format(this.number.evaluate(a))}eachChild(a){a(this.number),this.locale&&a(this.locale),this.currency&&a(this.currency),this.minFractionDigits&&a(this.minFractionDigits),this.maxFractionDigits&&a(this.maxFractionDigits)}outputDefined(){return!1}}class Ti{constructor(a){this.type=gt,this.sections=a}static parse(a,h){if(a.length<2)return h.error(\"Expected at least one argument.\");let A=a[1];if(!Array.isArray(A)&&typeof A==\"object\")return h.error(\"First argument must be an image or text section.\");let x=[],E=!1;for(let P=1;P<=a.length-1;++P){let D=a[P];if(E&&typeof D==\"object\"&&!Array.isArray(D)){E=!1;let F=null;if(D[\"font-scale\"]&&(F=h.parse(D[\"font-scale\"],1,Te),!F))return null;let V=null;if(D[\"text-font\"]&&(V=h.parse(D[\"text-font\"],1,vt(Dr)),!V))return null;let q=null;if(D[\"text-color\"]&&(q=h.parse(D[\"text-color\"],1,Us),!q))return null;let X=x[x.length-1];X.scale=F,X.font=V,X.textColor=q}else{let F=h.parse(a[P],1,Mr);if(!F)return null;let V=F.type.kind;if(V!==\"string\"&&V!==\"value\"&&V!==\"null\"&&V!==\"resolvedImage\")return h.error(\"Formatted text type must be 'string', 'value', 'image' or 'null'.\");E=!0,x.push({content:F,scale:null,font:null,textColor:null})}}return new Ti(x)}evaluate(a){return new ln(this.sections.map(h=>{let A=h.content.evaluate(a);return Ki(A)===nt?new Dc(\"\",A,null,null,null):new Dc(_i(A),null,h.scale?h.scale.evaluate(a):null,h.font?h.font.evaluate(a).join(\",\"):null,h.textColor?h.textColor.evaluate(a):null)}))}eachChild(a){for(let h of this.sections)a(h.content),h.scale&&a(h.scale),h.font&&a(h.font),h.textColor&&a(h.textColor)}outputDefined(){return!1}}class Tt{constructor(a){this.type=nt,this.input=a}static parse(a,h){if(a.length!==2)return h.error(\"Expected two arguments.\");let A=h.parse(a[1],1,Dr);return A?new Tt(A):h.error(\"No image name provided.\")}evaluate(a){let h=this.input.evaluate(a),A=Gn.fromString(h);return A&&a.availableImages&&(A.available=a.availableImages.indexOf(h)>-1),A}eachChild(a){a(this.input)}outputDefined(){return!1}}class Ms{constructor(a){this.type=Te,this.input=a}static parse(a,h){if(a.length!==2)return h.error(`Expected 1 argument, but found ${a.length-1} instead.`);let A=h.parse(a[1],1);return A?A.type.kind!==\"array\"&&A.type.kind!==\"string\"&&A.type.kind!==\"value\"?h.error(`Expected argument of type string or array, but found ${xt(A.type)} instead.`):new Ms(A):null}evaluate(a){let h=this.input.evaluate(a);if(typeof h==\"string\"||Array.isArray(h))return h.length;throw new cn(`Expected value to be of type string or array, but found ${xt(Ki(h))} instead.`)}eachChild(a){a(this.input)}outputDefined(){return!1}}let cs={\"==\":oh,\"!=\":Zt,\">\":Be,\"<\":fe,\">=\":g,\"<=\":br,array:rs,at:Hp,boolean:rs,case:Zp,coalesce:Ym,collator:xd,format:Ti,image:Tt,in:$m,\"index-of\":qp,interpolate:Oa,\"interpolate-hcl\":Oa,\"interpolate-lab\":Oa,length:Ms,let:Qm,literal:Gl,match:wd,number:rs,\"number-format\":Vi,object:rs,slice:Sd,step:sh,string:rs,\"to-boolean\":Wl,\"to-color\":Wl,\"to-number\":Wl,\"to-string\":Wl,var:Gm,within:gf};function li(u,[a,h,A,x]){a=a.evaluate(u),h=h.evaluate(u),A=A.evaluate(u);let E=x?x.evaluate(u):1,P=So(a,h,A,E);if(P)throw new cn(P);return new ai(a/255,h/255,A/255,E,!1)}function bn(u,a){return u in a}function dl(u,a){let h=a[u];return h===void 0?null:h}function Ur(u){return{type:u}}function hi(u){return{result:\"success\",value:u}}function To(u){return{result:\"error\",value:u}}function _f(u){return u[\"property-type\"]===\"data-driven\"||u[\"property-type\"]===\"cross-faded-data-driven\"}function h_(u){return!!u.expression&&u.expression.parameters.indexOf(\"zoom\")>-1}function Md(u){return!!u.expression&&u.expression.interpolated}function qr(u){return u instanceof Number?\"number\":u instanceof String?\"string\":u instanceof Boolean?\"boolean\":Array.isArray(u)?\"array\":u===null?\"null\":typeof u}function Ji(u){return typeof u==\"object\"&&u!==null&&!Array.isArray(u)}function Oc(u){return u}function ci(u,a){let h=a.type===\"color\",A=u.stops&&typeof u.stops[0][0]==\"object\",x=A||!(A||u.property!==void 0),E=u.type||(Md(a)?\"exponential\":\"interval\");if(h||a.type===\"padding\"){let q=h?ai.parse:Dn.parse;(u=jo({},u)).stops&&(u.stops=u.stops.map(X=>[X[0],q(X[1])])),u.default=q(u.default?u.default:a.default)}if(u.colorSpace&&(P=u.colorSpace)!==\"rgb\"&&P!==\"hcl\"&&P!==\"lab\")throw new Error(`Unknown color space: \"${u.colorSpace}\"`);var P;let D,F,V;if(E===\"exponential\")D=Mi;else if(E===\"interval\")D=It;else if(E===\"categorical\"){D=Je,F=Object.create(null);for(let q of u.stops)F[q[0]]=q[1];V=typeof u.stops[0][0]}else{if(E!==\"identity\")throw new Error(`Unknown function type \"${E}\"`);D=Km}if(A){let q={},X=[];for(let ct=0;ctct[0]),evaluate:({zoom:ct},mt)=>Mi({stops:rt,base:u.base},a,ct).evaluate(ct,mt)}}if(x){let q=E===\"exponential\"?{name:\"exponential\",base:u.base!==void 0?u.base:1}:null;return{kind:\"camera\",interpolationType:q,interpolationFactor:Oa.interpolationFactor.bind(void 0,q),zoomStops:u.stops.map(X=>X[0]),evaluate:({zoom:X})=>D(u,a,X,F,V)}}return{kind:\"source\",evaluate(q,X){let rt=X&&X.properties?X.properties[u.property]:void 0;return rt===void 0?aa(u.default,a.default):D(u,a,rt,F,V)}}}function aa(u,a,h){return u!==void 0?u:a!==void 0?a:h!==void 0?h:void 0}function Je(u,a,h,A,x){return aa(typeof h===x?A[h]:void 0,u.default,a.default)}function It(u,a,h){if(qr(h)!==\"number\")return aa(u.default,a.default);let A=u.stops.length;if(A===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[A-1][0])return u.stops[A-1][1];let x=bd(u.stops.map(E=>E[0]),h);return u.stops[x][1]}function Mi(u,a,h){let A=u.base!==void 0?u.base:1;if(qr(h)!==\"number\")return aa(u.default,a.default);let x=u.stops.length;if(x===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[x-1][0])return u.stops[x-1][1];let E=bd(u.stops.map(q=>q[0]),h),P=function(q,X,rt,at){let ct=at-rt,mt=q-rt;return ct===0?0:X===1?mt/ct:(Math.pow(X,mt)-1)/(Math.pow(X,ct)-1)}(h,A,u.stops[E][0],u.stops[E+1][0]),D=u.stops[E][1],F=u.stops[E+1][1],V=Da[a.type]||Oc;return typeof D.evaluate==\"function\"?{evaluate(...q){let X=D.evaluate.apply(void 0,q),rt=F.evaluate.apply(void 0,q);if(X!==void 0&&rt!==void 0)return V(X,rt,P,u.colorSpace)}}:V(D,F,P,u.colorSpace)}function Km(u,a,h){switch(a.type){case\"color\":h=ai.parse(h);break;case\"formatted\":h=ln.fromString(h.toString());break;case\"resolvedImage\":h=Gn.fromString(h.toString());break;case\"padding\":h=Dn.parse(h);break;default:qr(h)===a.type||a.type===\"enum\"&&a.values[h]||(h=void 0)}return aa(h,u.default,a.default)}fl.register(cs,{error:[{kind:\"error\"},[Dr],(u,[a])=>{throw new cn(a.evaluate(u))}],typeof:[Dr,[Mr],(u,[a])=>xt(Ki(a.evaluate(u)))],\"to-rgba\":[vt(Te,4),[Us],(u,[a])=>{let[h,A,x,E]=a.evaluate(u).rgb;return[255*h,255*A,255*x,E]}],rgb:[Us,[Te,Te,Te],li],rgba:[Us,[Te,Te,Te,Te],li],has:{type:gr,overloads:[[[Dr],(u,[a])=>bn(a.evaluate(u),u.properties())],[[Dr,La],(u,[a,h])=>bn(a.evaluate(u),h.evaluate(u))]]},get:{type:Mr,overloads:[[[Dr],(u,[a])=>dl(a.evaluate(u),u.properties())],[[Dr,La],(u,[a,h])=>dl(a.evaluate(u),h.evaluate(u))]]},\"feature-state\":[Mr,[Dr],(u,[a])=>dl(a.evaluate(u),u.featureState||{})],properties:[La,[],u=>u.properties()],\"geometry-type\":[Dr,[],u=>u.geometryType()],id:[Mr,[],u=>u.id()],zoom:[Te,[],u=>u.globals.zoom],\"heatmap-density\":[Te,[],u=>u.globals.heatmapDensity||0],\"line-progress\":[Te,[],u=>u.globals.lineProgress||0],accumulated:[Mr,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],\"+\":[Te,Ur(Te),(u,a)=>{let h=0;for(let A of a)h+=A.evaluate(u);return h}],\"*\":[Te,Ur(Te),(u,a)=>{let h=1;for(let A of a)h*=A.evaluate(u);return h}],\"-\":{type:Te,overloads:[[[Te,Te],(u,[a,h])=>a.evaluate(u)-h.evaluate(u)],[[Te],(u,[a])=>-a.evaluate(u)]]},\"/\":[Te,[Te,Te],(u,[a,h])=>a.evaluate(u)/h.evaluate(u)],\"%\":[Te,[Te,Te],(u,[a,h])=>a.evaluate(u)%h.evaluate(u)],ln2:[Te,[],()=>Math.LN2],pi:[Te,[],()=>Math.PI],e:[Te,[],()=>Math.E],\"^\":[Te,[Te,Te],(u,[a,h])=>Math.pow(a.evaluate(u),h.evaluate(u))],sqrt:[Te,[Te],(u,[a])=>Math.sqrt(a.evaluate(u))],log10:[Te,[Te],(u,[a])=>Math.log(a.evaluate(u))/Math.LN10],ln:[Te,[Te],(u,[a])=>Math.log(a.evaluate(u))],log2:[Te,[Te],(u,[a])=>Math.log(a.evaluate(u))/Math.LN2],sin:[Te,[Te],(u,[a])=>Math.sin(a.evaluate(u))],cos:[Te,[Te],(u,[a])=>Math.cos(a.evaluate(u))],tan:[Te,[Te],(u,[a])=>Math.tan(a.evaluate(u))],asin:[Te,[Te],(u,[a])=>Math.asin(a.evaluate(u))],acos:[Te,[Te],(u,[a])=>Math.acos(a.evaluate(u))],atan:[Te,[Te],(u,[a])=>Math.atan(a.evaluate(u))],min:[Te,Ur(Te),(u,a)=>Math.min(...a.map(h=>h.evaluate(u)))],max:[Te,Ur(Te),(u,a)=>Math.max(...a.map(h=>h.evaluate(u)))],abs:[Te,[Te],(u,[a])=>Math.abs(a.evaluate(u))],round:[Te,[Te],(u,[a])=>{let h=a.evaluate(u);return h<0?-Math.round(-h):Math.round(h)}],floor:[Te,[Te],(u,[a])=>Math.floor(a.evaluate(u))],ceil:[Te,[Te],(u,[a])=>Math.ceil(a.evaluate(u))],\"filter-==\":[gr,[Dr,Mr],(u,[a,h])=>u.properties()[a.value]===h.value],\"filter-id-==\":[gr,[Mr],(u,[a])=>u.id()===a.value],\"filter-type-==\":[gr,[Dr],(u,[a])=>u.geometryType()===a.value],\"filter-<\":[gr,[Dr,Mr],(u,[a,h])=>{let A=u.properties()[a.value],x=h.value;return typeof A==typeof x&&A{let h=u.id(),A=a.value;return typeof h==typeof A&&h\":[gr,[Dr,Mr],(u,[a,h])=>{let A=u.properties()[a.value],x=h.value;return typeof A==typeof x&&A>x}],\"filter-id->\":[gr,[Mr],(u,[a])=>{let h=u.id(),A=a.value;return typeof h==typeof A&&h>A}],\"filter-<=\":[gr,[Dr,Mr],(u,[a,h])=>{let A=u.properties()[a.value],x=h.value;return typeof A==typeof x&&A<=x}],\"filter-id-<=\":[gr,[Mr],(u,[a])=>{let h=u.id(),A=a.value;return typeof h==typeof A&&h<=A}],\"filter->=\":[gr,[Dr,Mr],(u,[a,h])=>{let A=u.properties()[a.value],x=h.value;return typeof A==typeof x&&A>=x}],\"filter-id->=\":[gr,[Mr],(u,[a])=>{let h=u.id(),A=a.value;return typeof h==typeof A&&h>=A}],\"filter-has\":[gr,[Mr],(u,[a])=>a.value in u.properties()],\"filter-has-id\":[gr,[],u=>u.id()!==null&&u.id()!==void 0],\"filter-type-in\":[gr,[vt(Dr)],(u,[a])=>a.value.indexOf(u.geometryType())>=0],\"filter-id-in\":[gr,[vt(Mr)],(u,[a])=>a.value.indexOf(u.id())>=0],\"filter-in-small\":[gr,[Dr,vt(Mr)],(u,[a,h])=>h.value.indexOf(u.properties()[a.value])>=0],\"filter-in-large\":[gr,[Dr,vt(Mr)],(u,[a,h])=>function(A,x,E,P){for(;E<=P;){let D=E+P>>1;if(x[D]===A)return!0;x[D]>A?P=D-1:E=D+1}return!1}(u.properties()[a.value],h.value,0,h.value.length-1)],all:{type:gr,overloads:[[[gr,gr],(u,[a,h])=>a.evaluate(u)&&h.evaluate(u)],[Ur(gr),(u,a)=>{for(let h of a)if(!h.evaluate(u))return!1;return!0}]]},any:{type:gr,overloads:[[[gr,gr],(u,[a,h])=>a.evaluate(u)||h.evaluate(u)],[Ur(gr),(u,a)=>{for(let h of a)if(h.evaluate(u))return!0;return!1}]]},\"!\":[gr,[gr],(u,[a])=>!a.evaluate(u)],\"is-supported-script\":[gr,[Dr],(u,[a])=>{let h=u.globals&&u.globals.isSupportedScript;return!h||h(a.evaluate(u))}],upcase:[Dr,[Dr],(u,[a])=>a.evaluate(u).toUpperCase()],downcase:[Dr,[Dr],(u,[a])=>a.evaluate(u).toLowerCase()],concat:[Dr,Ur(Mr),(u,a)=>a.map(h=>_i(h.evaluate(u))).join(\"\")],\"resolved-locale\":[Dr,[sa],(u,[a])=>a.evaluate(u).resolvedLocale()]});class Jm{constructor(a,h){var A;this.expression=a,this._warningHistory={},this._evaluator=new yd,this._defaultValue=h?(A=h).type===\"color\"&&Ji(A.default)?new ai(0,0,0,0):A.type===\"color\"?ai.parse(A.default)||null:A.type===\"padding\"?Dn.parse(A.default)||null:A.type===\"variableAnchorOffsetCollection\"?Go.parse(A.default)||null:A.default===void 0?null:A.default:null,this._enumValues=h&&h.type===\"enum\"?h.values:null}evaluateWithoutErrorHandling(a,h,A,x,E,P){return this._evaluator.globals=a,this._evaluator.feature=h,this._evaluator.featureState=A,this._evaluator.canonical=x,this._evaluator.availableImages=E||null,this._evaluator.formattedSection=P,this.expression.evaluate(this._evaluator)}evaluate(a,h,A,x,E,P){this._evaluator.globals=a,this._evaluator.feature=h||null,this._evaluator.featureState=A||null,this._evaluator.canonical=x,this._evaluator.availableImages=E||null,this._evaluator.formattedSection=P||null;try{let D=this.expression.evaluate(this._evaluator);if(D==null||typeof D==\"number\"&&D!=D)return this._defaultValue;if(this._enumValues&&!(D in this._enumValues))throw new cn(`Expected value to be one of ${Object.keys(this._enumValues).map(F=>JSON.stringify(F)).join(\", \")}, but found ${JSON.stringify(D)} instead.`);return D}catch(D){return this._warningHistory[D.message]||(this._warningHistory[D.message]=!0,typeof console<\"u\"&&console.warn(D.message)),this._defaultValue}}}function Yp(u){return Array.isArray(u)&&u.length>0&&typeof u[0]==\"string\"&&u[0]in cs}function Qp(u,a){let h=new vd(cs,Wm,[],a?function(x){let E={color:Us,string:Dr,number:Te,enum:Dr,boolean:gr,formatted:gt,padding:tt,resolvedImage:nt,variableAnchorOffsetCollection:ht};return x.type===\"array\"?vt(E[x.value]||Mr,x.length):E[x.type]}(a):void 0),A=h.parse(u,void 0,void 0,void 0,a&&a.type===\"string\"?{typeAnnotation:\"coerce\"}:void 0);return A?hi(new Jm(A,a)):To(h.errors)}class t0{constructor(a,h){this.kind=a,this._styleExpression=h,this.isStateDependent=a!==\"constant\"&&!Wp(h.expression)}evaluateWithoutErrorHandling(a,h,A,x,E,P){return this._styleExpression.evaluateWithoutErrorHandling(a,h,A,x,E,P)}evaluate(a,h,A,x,E,P){return this._styleExpression.evaluate(a,h,A,x,E,P)}}class wt{constructor(a,h,A,x){this.kind=a,this.zoomStops=A,this._styleExpression=h,this.isStateDependent=a!==\"camera\"&&!Wp(h.expression),this.interpolationType=x}evaluateWithoutErrorHandling(a,h,A,x,E,P){return this._styleExpression.evaluateWithoutErrorHandling(a,h,A,x,E,P)}evaluate(a,h,A,x,E,P){return this._styleExpression.evaluate(a,h,A,x,E,P)}interpolationFactor(a,h,A){return this.interpolationType?Oa.interpolationFactor(this.interpolationType,a,h,A):0}}function e0(u,a){let h=Qp(u,a);if(h.result===\"error\")return h;let A=h.value.expression,x=Hm(A);if(!x&&!_f(a))return To([new gn(\"\",\"data expressions not supported\")]);let E=qm(A,[\"zoom\"]);if(!E&&!h_(a))return To([new gn(\"\",\"zoom expressions not supported\")]);let P=Pd(A);return P||E?P instanceof gn?To([P]):P instanceof Oa&&!Md(a)?To([new gn(\"\",'\"interpolate\" expressions cannot be used with this property')]):hi(P?new wt(x?\"camera\":\"composite\",h.value,P.labels,P instanceof Oa?P.interpolation:void 0):new t0(x?\"constant\":\"source\",h.value)):To([new gn(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.')])}class Ed{constructor(a,h){this._parameters=a,this._specification=h,jo(this,ci(this._parameters,this._specification))}static deserialize(a){return new Ed(a._parameters,a._specification)}static serialize(a){return{_parameters:a._parameters,_specification:a._specification}}}function Pd(u){let a=null;if(u instanceof Qm)a=Pd(u.result);else if(u instanceof Ym){for(let h of u.args)if(a=Pd(h),a)break}else(u instanceof sh||u instanceof Oa)&&u.input instanceof fl&&u.input.name===\"zoom\"&&(a=u);return a instanceof gn||u.eachChild(h=>{let A=Pd(h);A instanceof gn?a=A:!a&&A?a=new gn(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.'):a&&A&&a!==A&&(a=new gn(\"\",'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.'))}),a}function Id(u){if(u===!0||u===!1)return!0;if(!Array.isArray(u)||u.length===0)return!1;switch(u[0]){case\"has\":return u.length>=2&&u[1]!==\"$id\"&&u[1]!==\"$type\";case\"in\":return u.length>=3&&(typeof u[1]!=\"string\"||Array.isArray(u[2]));case\"!in\":case\"!has\":case\"none\":return!1;case\"==\":case\"!=\":case\">\":case\">=\":case\"<\":case\"<=\":return u.length!==3||Array.isArray(u[1])||Array.isArray(u[2]);case\"any\":case\"all\":for(let a of u.slice(1))if(!Id(a)&&typeof a!=\"boolean\")return!1;return!0;default:return!0}}let Fx={type:\"boolean\",default:!1,transition:!1,\"property-type\":\"data-driven\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]}};function r0(u){if(u==null)return{filter:()=>!0,needGeometry:!1};Id(u)||(u=yf(u));let a=Qp(u,Fx);if(a.result===\"error\")throw new Error(a.value.map(h=>`${h.key}: ${h.message}`).join(\", \"));return{filter:(h,A,x)=>a.value.evaluate(h,A,{},x),needGeometry:d_(u)}}function f_(u,a){return ua?1:0}function d_(u){if(!Array.isArray(u))return!1;if(u[0]===\"within\")return!0;for(let a=1;a\"||a===\"<=\"||a===\">=\"?Ba(u[1],u[2],a):a===\"any\"?(h=u.slice(1),[\"any\"].concat(h.map(yf))):a===\"all\"?[\"all\"].concat(u.slice(1).map(yf)):a===\"none\"?[\"all\"].concat(u.slice(1).map(yf).map(Cd)):a===\"in\"?Wn(u[1],u.slice(2)):a===\"!in\"?Cd(Wn(u[1],u.slice(2))):a===\"has\"?p_(u[1]):a===\"!has\"?Cd(p_(u[1])):a!==\"within\"||u;var h}function Ba(u,a,h){switch(u){case\"$type\":return[`filter-type-${h}`,a];case\"$id\":return[`filter-id-${h}`,a];default:return[`filter-${h}`,u,a]}}function Wn(u,a){if(a.length===0)return!1;switch(u){case\"$type\":return[\"filter-type-in\",[\"literal\",a]];case\"$id\":return[\"filter-id-in\",[\"literal\",a]];default:return a.length>200&&!a.some(h=>typeof h!=typeof a[0])?[\"filter-in-large\",u,[\"literal\",a.sort(f_)]]:[\"filter-in-small\",u,[\"literal\",a]]}}function p_(u){switch(u){case\"$type\":return!0;case\"$id\":return[\"filter-has-id\"];default:return[\"filter-has\",u]}}function Cd(u){return[\"!\",u]}function $p(u){let a=typeof u;if(a===\"number\"||a===\"boolean\"||a===\"string\"||u==null)return JSON.stringify(u);if(Array.isArray(u)){let x=\"[\";for(let E of u)x+=`${$p(E)},`;return`${x}]`}let h=Object.keys(u).sort(),A=\"{\";for(let x=0;xA.maximum?[new ve(a,h,`${h} is greater than the maximum value ${A.maximum}`)]:[]}function Kp(u){let a=u.valueSpec,h=Cn(u.value.type),A,x,E,P={},D=h!==\"categorical\"&&u.value.property===void 0,F=!D,V=qr(u.value.stops)===\"array\"&&qr(u.value.stops[0])===\"array\"&&qr(u.value.stops[0][0])===\"object\",q=fi({key:u.key,value:u.value,valueSpec:u.styleSpec.function,validateSpec:u.validateSpec,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(at){if(h===\"identity\")return[new ve(at.key,at.value,'identity function may not have a \"stops\" property')];let ct=[],mt=at.value;return ct=ct.concat(mu({key:at.key,value:mt,valueSpec:at.valueSpec,validateSpec:at.validateSpec,style:at.style,styleSpec:at.styleSpec,arrayElementValidator:X})),qr(mt)===\"array\"&&mt.length===0&&ct.push(new ve(at.key,mt,\"array must have at least one stop\")),ct},default:function(at){return at.validateSpec({key:at.key,value:at.value,valueSpec:a,validateSpec:at.validateSpec,style:at.style,styleSpec:at.styleSpec})}}});return h===\"identity\"&&D&&q.push(new ve(u.key,u.value,'missing required property \"property\"')),h===\"identity\"||u.value.stops||q.push(new ve(u.key,u.value,'missing required property \"stops\"')),h===\"exponential\"&&u.valueSpec.expression&&!Md(u.valueSpec)&&q.push(new ve(u.key,u.value,\"exponential functions not supported\")),u.styleSpec.$version>=8&&(F&&!_f(u.valueSpec)?q.push(new ve(u.key,u.value,\"property functions not supported\")):D&&!h_(u.valueSpec)&&q.push(new ve(u.key,u.value,\"zoom functions not supported\"))),h!==\"categorical\"&&!V||u.value.property!==void 0||q.push(new ve(u.key,u.value,'\"property\" property is required')),q;function X(at){let ct=[],mt=at.value,bt=at.key;if(qr(mt)!==\"array\")return[new ve(bt,mt,`array expected, ${qr(mt)} found`)];if(mt.length!==2)return[new ve(bt,mt,`array length 2 expected, length ${mt.length} found`)];if(V){if(qr(mt[0])!==\"object\")return[new ve(bt,mt,`object expected, ${qr(mt[0])} found`)];if(mt[0].zoom===void 0)return[new ve(bt,mt,\"object stop key must have zoom\")];if(mt[0].value===void 0)return[new ve(bt,mt,\"object stop key must have value\")];if(E&&E>Cn(mt[0].zoom))return[new ve(bt,mt[0].zoom,\"stop zoom values must appear in ascending order\")];Cn(mt[0].zoom)!==E&&(E=Cn(mt[0].zoom),x=void 0,P={}),ct=ct.concat(fi({key:`${bt}[0]`,value:mt[0],valueSpec:{zoom:{}},validateSpec:at.validateSpec,style:at.style,styleSpec:at.styleSpec,objectElementValidators:{zoom:vf,value:rt}}))}else ct=ct.concat(rt({key:`${bt}[0]`,value:mt[0],valueSpec:{},validateSpec:at.validateSpec,style:at.style,styleSpec:at.styleSpec},mt));return Yp(ah(mt[1]))?ct.concat([new ve(`${bt}[1]`,mt[1],\"expressions are not allowed in function stops.\")]):ct.concat(at.validateSpec({key:`${bt}[1]`,value:mt[1],valueSpec:a,validateSpec:at.validateSpec,style:at.style,styleSpec:at.styleSpec}))}function rt(at,ct){let mt=qr(at.value),bt=Cn(at.value),Pt=at.value!==null?at.value:ct;if(A){if(mt!==A)return[new ve(at.key,Pt,`${mt} stop domain type must match previous stop domain type ${A}`)]}else A=mt;if(mt!==\"number\"&&mt!==\"string\"&&mt!==\"boolean\")return[new ve(at.key,Pt,\"stop domain value must be a number, string, or boolean\")];if(mt!==\"number\"&&h!==\"categorical\"){let jt=`number expected, ${mt} found`;return _f(a)&&h===void 0&&(jt+='\\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.'),[new ve(at.key,Pt,jt)]}return h!==\"categorical\"||mt!==\"number\"||isFinite(bt)&&Math.floor(bt)===bt?h!==\"categorical\"&&mt===\"number\"&&x!==void 0&&btnew ve(`${u.key}${A.key}`,u.value,A.message));let h=a.value.expression||a.value._styleExpression.expression;if(u.expressionContext===\"property\"&&u.propertyKey===\"text-font\"&&!h.outputDefined())return[new ve(u.key,u.value,`Invalid data expression for \"${u.propertyKey}\". Output values must be contained as literals within the expression.`)];if(u.expressionContext===\"property\"&&u.propertyType===\"layout\"&&!Wp(h))return[new ve(u.key,u.value,'\"feature-state\" data expressions are not supported with layout properties.')];if(u.expressionContext===\"filter\"&&!Wp(h))return[new ve(u.key,u.value,'\"feature-state\" data expressions are not supported with filters.')];if(u.expressionContext&&u.expressionContext.indexOf(\"cluster\")===0){if(!qm(h,[\"zoom\",\"feature-state\"]))return[new ve(u.key,u.value,'\"zoom\" and \"feature-state\" expressions are not supported with cluster properties.')];if(u.expressionContext===\"cluster-initial\"&&!Hm(h))return[new ve(u.key,u.value,\"Feature data expressions are not supported with initial expression part of cluster properties.\")]}return[]}function Ld(u){let a=u.key,h=u.value,A=u.valueSpec,x=[];return Array.isArray(A.values)?A.values.indexOf(Cn(h))===-1&&x.push(new ve(a,h,`expected one of [${A.values.join(\", \")}], ${JSON.stringify(h)} found`)):Object.keys(A.values).indexOf(Cn(h))===-1&&x.push(new ve(a,h,`expected one of [${Object.keys(A.values).join(\", \")}], ${JSON.stringify(h)} found`)),x}function ch(u){return Id(ah(u.value))?lh(jo({},u,{expressionContext:\"filter\",valueSpec:{value:\"boolean\"}})):Jp(u)}function Jp(u){let a=u.value,h=u.key;if(qr(a)!==\"array\")return[new ve(h,a,`array expected, ${qr(a)} found`)];let A=u.styleSpec,x,E=[];if(a.length<1)return[new ve(h,a,\"filter array must have at least 1 element\")];switch(E=E.concat(Ld({key:`${h}[0]`,value:a[0],valueSpec:A.filter_operator,style:u.style,styleSpec:u.styleSpec})),Cn(a[0])){case\"<\":case\"<=\":case\">\":case\">=\":a.length>=2&&Cn(a[1])===\"$type\"&&E.push(new ve(h,a,`\"$type\" cannot be use with operator \"${a[0]}\"`));case\"==\":case\"!=\":a.length!==3&&E.push(new ve(h,a,`filter array for operator \"${a[0]}\" must have 3 elements`));case\"in\":case\"!in\":a.length>=2&&(x=qr(a[1]),x!==\"string\"&&E.push(new ve(`${h}[1]`,a[1],`string expected, ${x} found`)));for(let P=2;P{V in h&&a.push(new ve(A,h[V],`\"${V}\" is prohibited for ref layers`))}),x.layers.forEach(V=>{Cn(V.id)===D&&(F=V)}),F?F.ref?a.push(new ve(A,h.ref,\"ref cannot reference another ref layer\")):P=Cn(F.type):a.push(new ve(A,h.ref,`ref layer \"${D}\" not found`))}else if(P!==\"background\")if(h.source){let F=x.sources&&x.sources[h.source],V=F&&Cn(F.type);F?V===\"vector\"&&P===\"raster\"?a.push(new ve(A,h.source,`layer \"${h.id}\" requires a raster source`)):V!==\"raster-dem\"&&P===\"hillshade\"?a.push(new ve(A,h.source,`layer \"${h.id}\" requires a raster-dem source`)):V===\"raster\"&&P!==\"raster\"?a.push(new ve(A,h.source,`layer \"${h.id}\" requires a vector source`)):V!==\"vector\"||h[\"source-layer\"]?V===\"raster-dem\"&&P!==\"hillshade\"?a.push(new ve(A,h.source,\"raster-dem source can only be used with layer type 'hillshade'.\")):P!==\"line\"||!h.paint||!h.paint[\"line-gradient\"]||V===\"geojson\"&&F.lineMetrics||a.push(new ve(A,h,`layer \"${h.id}\" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):a.push(new ve(A,h,`layer \"${h.id}\" must specify a \"source-layer\"`)):a.push(new ve(A,h.source,`source \"${h.source}\" not found`))}else a.push(new ve(A,h,'missing required property \"source\"'));return a=a.concat(fi({key:A,value:h,valueSpec:E.layer,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{\"*\":()=>[],type:()=>u.validateSpec({key:`${A}.type`,value:h.type,valueSpec:E.layer.type,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,object:h,objectKey:\"type\"}),filter:ch,layout:F=>fi({layer:h,key:F.key,value:F.value,style:F.style,styleSpec:F.styleSpec,validateSpec:F.validateSpec,objectElementValidators:{\"*\":V=>m_(jo({layerType:P},V))}}),paint:F=>fi({layer:h,key:F.key,value:F.value,style:F.style,styleSpec:F.styleSpec,validateSpec:F.validateSpec,objectElementValidators:{\"*\":V=>A_(jo({layerType:P},V))}})}})),a}function pl(u){let a=u.value,h=u.key,A=qr(a);return A!==\"string\"?[new ve(h,a,`string expected, ${A} found`)]:[]}let uh={promoteId:function({key:u,value:a}){if(qr(a)===\"string\")return pl({key:u,value:a});{let h=[];for(let A in a)h.push(...pl({key:`${u}.${A}`,value:a[A]}));return h}}};function la(u){let a=u.value,h=u.key,A=u.styleSpec,x=u.style,E=u.validateSpec;if(!a.type)return[new ve(h,a,'\"type\" is required')];let P=Cn(a.type),D;switch(P){case\"vector\":case\"raster\":return D=fi({key:h,value:a,valueSpec:A[`source_${P.replace(\"-\",\"_\")}`],style:u.style,styleSpec:A,objectElementValidators:uh,validateSpec:E}),D;case\"raster-dem\":return D=function(F){var V;let q=(V=F.sourceName)!==null&&V!==void 0?V:\"\",X=F.value,rt=F.styleSpec,at=rt.source_raster_dem,ct=F.style,mt=[],bt=qr(X);if(X===void 0)return mt;if(bt!==\"object\")return mt.push(new ve(\"source_raster_dem\",X,`object expected, ${bt} found`)),mt;let Pt=Cn(X.encoding)===\"custom\",jt=[\"redFactor\",\"greenFactor\",\"blueFactor\",\"baseShift\"],Rt=F.value.encoding?`\"${F.value.encoding}\"`:\"Default\";for(let Gt in X)!Pt&&jt.includes(Gt)?mt.push(new ve(Gt,X[Gt],`In \"${q}\": \"${Gt}\" is only valid when \"encoding\" is set to \"custom\". ${Rt} encoding found`)):at[Gt]?mt=mt.concat(F.validateSpec({key:Gt,value:X[Gt],valueSpec:at[Gt],validateSpec:F.validateSpec,style:ct,styleSpec:rt})):mt.push(new ve(Gt,X[Gt],`unknown property \"${Gt}\"`));return mt}({sourceName:h,value:a,style:u.style,styleSpec:A,validateSpec:E}),D;case\"geojson\":if(D=fi({key:h,value:a,valueSpec:A.source_geojson,style:x,styleSpec:A,validateSpec:E,objectElementValidators:uh}),a.cluster)for(let F in a.clusterProperties){let[V,q]=a.clusterProperties[F],X=typeof V==\"string\"?[V,[\"accumulated\"],[\"get\",F]]:V;D.push(...lh({key:`${h}.${F}.map`,value:q,validateSpec:E,expressionContext:\"cluster-map\"})),D.push(...lh({key:`${h}.${F}.reduce`,value:X,validateSpec:E,expressionContext:\"cluster-reduce\"}))}return D;case\"video\":return fi({key:h,value:a,valueSpec:A.source_video,style:x,validateSpec:E,styleSpec:A});case\"image\":return fi({key:h,value:a,valueSpec:A.source_image,style:x,validateSpec:E,styleSpec:A});case\"canvas\":return[new ve(h,null,\"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.\",\"source.canvas\")];default:return Ld({key:`${h}.type`,value:a.type,valueSpec:{values:[\"vector\",\"raster\",\"raster-dem\",\"geojson\",\"video\",\"image\"]},style:x,validateSpec:E,styleSpec:A})}}function kd(u){let a=u.value,h=u.styleSpec,A=h.light,x=u.style,E=[],P=qr(a);if(a===void 0)return E;if(P!==\"object\")return E=E.concat([new ve(\"light\",a,`object expected, ${P} found`)]),E;for(let D in a){let F=D.match(/^(.*)-transition$/);E=E.concat(F&&A[F[1]]&&A[F[1]].transition?u.validateSpec({key:D,value:a[D],valueSpec:h.transition,validateSpec:u.validateSpec,style:x,styleSpec:h}):A[D]?u.validateSpec({key:D,value:a[D],valueSpec:A[D],validateSpec:u.validateSpec,style:x,styleSpec:h}):[new ve(D,a[D],`unknown property \"${D}\"`)])}return E}function g_(u){let a=u.value,h=u.styleSpec,A=h.terrain,x=u.style,E=[],P=qr(a);if(a===void 0)return E;if(P!==\"object\")return E=E.concat([new ve(\"terrain\",a,`object expected, ${P} found`)]),E;for(let D in a)E=E.concat(A[D]?u.validateSpec({key:D,value:a[D],valueSpec:A[D],validateSpec:u.validateSpec,style:x,styleSpec:h}):[new ve(D,a[D],`unknown property \"${D}\"`)]);return E}function js(u){let a=[],h=u.value,A=u.key;if(Array.isArray(h)){let x=[],E=[];for(let P in h)h[P].id&&x.includes(h[P].id)&&a.push(new ve(A,h,`all the sprites' ids must be unique, but ${h[P].id} is duplicated`)),x.push(h[P].id),h[P].url&&E.includes(h[P].url)&&a.push(new ve(A,h,`all the sprites' URLs must be unique, but ${h[P].url} is duplicated`)),E.push(h[P].url),a=a.concat(fi({key:`${A}[${P}]`,value:h[P],valueSpec:{id:{type:\"string\",required:!0},url:{type:\"string\",required:!0}},validateSpec:u.validateSpec}));return a}return pl({key:A,value:h})}let gu={\"*\":()=>[],array:mu,boolean:function(u){let a=u.value,h=u.key,A=qr(a);return A!==\"boolean\"?[new ve(h,a,`boolean expected, ${A} found`)]:[]},number:vf,color:function(u){let a=u.key,h=u.value,A=qr(h);return A!==\"string\"?[new ve(a,h,`color expected, ${A} found`)]:ai.parse(String(h))?[]:[new ve(a,h,`color expected, \"${h}\" found`)]},constants:i0,enum:Ld,filter:ch,function:Kp,layer:n0,object:fi,source:la,light:kd,terrain:g_,string:pl,formatted:function(u){return pl(u).length===0?[]:lh(u)},resolvedImage:function(u){return pl(u).length===0?[]:lh(u)},padding:function(u){let a=u.key,h=u.value;if(qr(h)===\"array\"){if(h.length<1||h.length>4)return[new ve(a,h,`padding requires 1 to 4 values; ${h.length} values found`)];let A={type:\"number\"},x=[];for(let E=0;E[]}})),u.constants&&(h=h.concat(i0({key:\"constants\",value:u.constants,style:u,styleSpec:a,validateSpec:Ln}))),Rd(h)}function Fa(u){return function(a){return u({...a,validateSpec:Ln})}}function Rd(u){return[].concat(u).sort((a,h)=>a.line-h.line)}function Al(u){return function(...a){return Rd(u.apply(this,a))}}ca.source=Al(Fa(la)),ca.sprite=Al(Fa(js)),ca.glyphs=Al(Fa(eA)),ca.light=Al(Fa(kd)),ca.terrain=Al(Fa(g_)),ca.layer=Al(Fa(n0)),ca.filter=Al(Fa(ch)),ca.paintProperty=Al(Fa(A_)),ca.layoutProperty=Al(Fa(m_));let za=ca,hh=za.light,rA=za.paintProperty,s0=za.layoutProperty;function fh(u,a){let h=!1;if(a&&a.length)for(let A of a)u.fire(new ao(new Error(A.message))),h=!0;return h}class Na{constructor(a,h,A){let x=this.cells=[];if(a instanceof ArrayBuffer){this.arrayBuffer=a;let P=new Int32Array(this.arrayBuffer);a=P[0],this.d=(h=P[1])+2*(A=P[2]);for(let F=0;F=X[ct+0]&&x>=X[ct+1])?(D[at]=!0,P.push(q[at])):D[at]=!1}}}}_forEachCell(a,h,A,x,E,P,D,F){let V=this._convertToCellCoord(a),q=this._convertToCellCoord(h),X=this._convertToCellCoord(A),rt=this._convertToCellCoord(x);for(let at=V;at<=X;at++)for(let ct=q;ct<=rt;ct++){let mt=this.d*ct+at;if((!F||F(this._convertFromCellCoord(at),this._convertFromCellCoord(ct),this._convertFromCellCoord(at+1),this._convertFromCellCoord(ct+1)))&&E.call(this,a,h,A,x,mt,P,D,F))return}}_convertFromCellCoord(a){return(a-this.padding)/this.scale}_convertToCellCoord(a){return Math.max(0,Math.min(this.d-1,Math.floor(a*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let a=this.cells,h=3+this.cells.length+1+1,A=0;for(let P=0;P=0)continue;let P=u[E];x[E]=co[A].shallow.indexOf(E)>=0?P:Hl(P,a)}u instanceof Error&&(x.message=u.message)}if(x.$name)throw new Error(\"$name property is reserved for worker serialization logic.\");return A!==\"Object\"&&(x.$name=A),x}throw new Error(\"can't serialize object of type \"+typeof u)}function xf(u){if(u==null||typeof u==\"boolean\"||typeof u==\"number\"||typeof u==\"string\"||u instanceof Boolean||u instanceof Number||u instanceof String||u instanceof Date||u instanceof RegExp||u instanceof Blob||Dd(u)||zl(u)||ArrayBuffer.isView(u)||u instanceof ImageData)return u;if(Array.isArray(u))return u.map(xf);if(typeof u==\"object\"){let a=u.$name||\"Object\";if(!co[a])throw new Error(`can't deserialize unregistered class ${a}`);let{klass:h}=co[a];if(!h)throw new Error(`can't deserialize unregistered class ${a}`);if(h.deserialize)return h.deserialize(u);let A=Object.create(h.prototype);for(let x of Object.keys(u)){if(x===\"$name\")continue;let E=u[x];A[x]=co[a].shallow.indexOf(x)>=0?E:xf(E)}return A}throw new Error(\"can't deserialize object of type \"+typeof u)}class __{constructor(){this.first=!0}update(a,h){let A=Math.floor(a);return this.first?(this.first=!1,this.lastIntegerZoom=A,this.lastIntegerZoomTime=0,this.lastZoom=a,this.lastFloorZoom=A,!0):(this.lastFloorZoom>A?(this.lastIntegerZoom=A+1,this.lastIntegerZoomTime=h):this.lastFloorZoomu>=128&&u<=255,Arabic:u=>u>=1536&&u<=1791,\"Arabic Supplement\":u=>u>=1872&&u<=1919,\"Arabic Extended-A\":u=>u>=2208&&u<=2303,\"Hangul Jamo\":u=>u>=4352&&u<=4607,\"Unified Canadian Aboriginal Syllabics\":u=>u>=5120&&u<=5759,Khmer:u=>u>=6016&&u<=6143,\"Unified Canadian Aboriginal Syllabics Extended\":u=>u>=6320&&u<=6399,\"General Punctuation\":u=>u>=8192&&u<=8303,\"Letterlike Symbols\":u=>u>=8448&&u<=8527,\"Number Forms\":u=>u>=8528&&u<=8591,\"Miscellaneous Technical\":u=>u>=8960&&u<=9215,\"Control Pictures\":u=>u>=9216&&u<=9279,\"Optical Character Recognition\":u=>u>=9280&&u<=9311,\"Enclosed Alphanumerics\":u=>u>=9312&&u<=9471,\"Geometric Shapes\":u=>u>=9632&&u<=9727,\"Miscellaneous Symbols\":u=>u>=9728&&u<=9983,\"Miscellaneous Symbols and Arrows\":u=>u>=11008&&u<=11263,\"CJK Radicals Supplement\":u=>u>=11904&&u<=12031,\"Kangxi Radicals\":u=>u>=12032&&u<=12255,\"Ideographic Description Characters\":u=>u>=12272&&u<=12287,\"CJK Symbols and Punctuation\":u=>u>=12288&&u<=12351,Hiragana:u=>u>=12352&&u<=12447,Katakana:u=>u>=12448&&u<=12543,Bopomofo:u=>u>=12544&&u<=12591,\"Hangul Compatibility Jamo\":u=>u>=12592&&u<=12687,Kanbun:u=>u>=12688&&u<=12703,\"Bopomofo Extended\":u=>u>=12704&&u<=12735,\"CJK Strokes\":u=>u>=12736&&u<=12783,\"Katakana Phonetic Extensions\":u=>u>=12784&&u<=12799,\"Enclosed CJK Letters and Months\":u=>u>=12800&&u<=13055,\"CJK Compatibility\":u=>u>=13056&&u<=13311,\"CJK Unified Ideographs Extension A\":u=>u>=13312&&u<=19903,\"Yijing Hexagram Symbols\":u=>u>=19904&&u<=19967,\"CJK Unified Ideographs\":u=>u>=19968&&u<=40959,\"Yi Syllables\":u=>u>=40960&&u<=42127,\"Yi Radicals\":u=>u>=42128&&u<=42191,\"Hangul Jamo Extended-A\":u=>u>=43360&&u<=43391,\"Hangul Syllables\":u=>u>=44032&&u<=55215,\"Hangul Jamo Extended-B\":u=>u>=55216&&u<=55295,\"Private Use Area\":u=>u>=57344&&u<=63743,\"CJK Compatibility Ideographs\":u=>u>=63744&&u<=64255,\"Arabic Presentation Forms-A\":u=>u>=64336&&u<=65023,\"Vertical Forms\":u=>u>=65040&&u<=65055,\"CJK Compatibility Forms\":u=>u>=65072&&u<=65103,\"Small Form Variants\":u=>u>=65104&&u<=65135,\"Arabic Presentation Forms-B\":u=>u>=65136&&u<=65279,\"Halfwidth and Fullwidth Forms\":u=>u>=65280&&u<=65519};function o0(u){for(let a of u)if(dh(a.charCodeAt(0)))return!0;return!1}function a0(u){for(let a of u)if(!zx(a.charCodeAt(0)))return!1;return!0}function zx(u){return!(Oe.Arabic(u)||Oe[\"Arabic Supplement\"](u)||Oe[\"Arabic Extended-A\"](u)||Oe[\"Arabic Presentation Forms-A\"](u)||Oe[\"Arabic Presentation Forms-B\"](u))}function dh(u){return!(u!==746&&u!==747&&(u<4352||!(Oe[\"Bopomofo Extended\"](u)||Oe.Bopomofo(u)||Oe[\"CJK Compatibility Forms\"](u)&&!(u>=65097&&u<=65103)||Oe[\"CJK Compatibility Ideographs\"](u)||Oe[\"CJK Compatibility\"](u)||Oe[\"CJK Radicals Supplement\"](u)||Oe[\"CJK Strokes\"](u)||!(!Oe[\"CJK Symbols and Punctuation\"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||Oe[\"CJK Unified Ideographs Extension A\"](u)||Oe[\"CJK Unified Ideographs\"](u)||Oe[\"Enclosed CJK Letters and Months\"](u)||Oe[\"Hangul Compatibility Jamo\"](u)||Oe[\"Hangul Jamo Extended-A\"](u)||Oe[\"Hangul Jamo Extended-B\"](u)||Oe[\"Hangul Jamo\"](u)||Oe[\"Hangul Syllables\"](u)||Oe.Hiragana(u)||Oe[\"Ideographic Description Characters\"](u)||Oe.Kanbun(u)||Oe[\"Kangxi Radicals\"](u)||Oe[\"Katakana Phonetic Extensions\"](u)||Oe.Katakana(u)&&u!==12540||!(!Oe[\"Halfwidth and Fullwidth Forms\"](u)||u===65288||u===65289||u===65293||u>=65306&&u<=65310||u===65339||u===65341||u===65343||u>=65371&&u<=65503||u===65507||u>=65512&&u<=65519)||!(!Oe[\"Small Form Variants\"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||Oe[\"Unified Canadian Aboriginal Syllabics\"](u)||Oe[\"Unified Canadian Aboriginal Syllabics Extended\"](u)||Oe[\"Vertical Forms\"](u)||Oe[\"Yijing Hexagram Symbols\"](u)||Oe[\"Yi Syllables\"](u)||Oe[\"Yi Radicals\"](u))))}function y_(u){return!(dh(u)||function(a){return!!(Oe[\"Latin-1 Supplement\"](a)&&(a===167||a===169||a===174||a===177||a===188||a===189||a===190||a===215||a===247)||Oe[\"General Punctuation\"](a)&&(a===8214||a===8224||a===8225||a===8240||a===8241||a===8251||a===8252||a===8258||a===8263||a===8264||a===8265||a===8273)||Oe[\"Letterlike Symbols\"](a)||Oe[\"Number Forms\"](a)||Oe[\"Miscellaneous Technical\"](a)&&(a>=8960&&a<=8967||a>=8972&&a<=8991||a>=8996&&a<=9e3||a===9003||a>=9085&&a<=9114||a>=9150&&a<=9165||a===9167||a>=9169&&a<=9179||a>=9186&&a<=9215)||Oe[\"Control Pictures\"](a)&&a!==9251||Oe[\"Optical Character Recognition\"](a)||Oe[\"Enclosed Alphanumerics\"](a)||Oe[\"Geometric Shapes\"](a)||Oe[\"Miscellaneous Symbols\"](a)&&!(a>=9754&&a<=9759)||Oe[\"Miscellaneous Symbols and Arrows\"](a)&&(a>=11026&&a<=11055||a>=11088&&a<=11097||a>=11192&&a<=11243)||Oe[\"CJK Symbols and Punctuation\"](a)||Oe.Katakana(a)||Oe[\"Private Use Area\"](a)||Oe[\"CJK Compatibility Forms\"](a)||Oe[\"Small Form Variants\"](a)||Oe[\"Halfwidth and Fullwidth Forms\"](a)||a===8734||a===8756||a===8757||a>=9984&&a<=10087||a>=10102&&a<=10131||a===65532||a===65533)}(u))}function l0(u){return u>=1424&&u<=2303||Oe[\"Arabic Presentation Forms-A\"](u)||Oe[\"Arabic Presentation Forms-B\"](u)}function c0(u,a){return!(!a&&l0(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||Oe.Khmer(u))}function bf(u){for(let a of u)if(l0(a.charCodeAt(0)))return!0;return!1}let u0=\"deferred\",iA=\"loading\",nA=\"loaded\",ph=null,us=\"unavailable\",_u=null,Bc=function(u){u&&typeof u==\"string\"&&u.indexOf(\"NetworkError\")>-1&&(us=\"error\"),ph&&ph(u)};function h0(){Od.fire(new as(\"pluginStateChange\",{pluginStatus:us,pluginURL:_u}))}let Od=new Nl,f0=function(){return us},v_=function(){if(us!==u0||!_u)throw new Error(\"rtl-text-plugin cannot be downloaded unless a pluginURL is specified\");us=iA,h0(),_u&&cl({url:_u},u=>{u?Bc(u):(us=nA,h0())})},ua={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>us===nA||ua.applyArabicShaping!=null,isLoading:()=>us===iA,setState(u){if(!Li())throw new Error(\"Cannot set the state of the rtl-text-plugin when not in the web-worker context\");us=u.pluginStatus,_u=u.pluginURL},isParsed(){if(!Li())throw new Error(\"rtl-text-plugin is only parsed on the worker-threads\");return ua.applyArabicShaping!=null&&ua.processBidirectionalText!=null&&ua.processStyledBidirectionalText!=null},getPluginURL(){if(!Li())throw new Error(\"rtl-text-plugin url can only be queried from the worker threads\");return _u}};class un{constructor(a,h){this.zoom=a,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.zoomHistory=h.zoomHistory,this.transition=h.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new __,this.transition={})}isSupportedScript(a){return function(h,A){for(let x of h)if(!c0(x.charCodeAt(0),A))return!1;return!0}(a,ua.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let a=this.zoom,h=a-Math.floor(a),A=this.crossFadingFactor();return a>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*A}:{fromScale:.5,toScale:1,t:1-(1-A)*h}}}class sA{constructor(a,h){this.property=a,this.value=h,this.expression=function(A,x){if(Ji(A))return new Ed(A,x);if(Yp(A)){let E=e0(A,x);if(E.result===\"error\")throw new Error(E.value.map(P=>`${P.key}: ${P.message}`).join(\", \"));return E.value}{let E=A;return x.type===\"color\"&&typeof A==\"string\"?E=ai.parse(A):x.type!==\"padding\"||typeof A!=\"number\"&&!Array.isArray(A)?x.type===\"variableAnchorOffsetCollection\"&&Array.isArray(A)&&(E=Go.parse(A)):E=Dn.parse(A),{kind:\"constant\",evaluate:()=>E}}}(h===void 0?a.specification.default:h,a.specification)}isDataDriven(){return this.expression.kind===\"source\"||this.expression.kind===\"composite\"}possiblyEvaluate(a,h,A){return this.property.possiblyEvaluate(this,a,h,A)}}class d0{constructor(a){this.property=a,this.value=new sA(a,void 0)}transitioned(a,h){return new x_(this.property,this.value,h,kt({},a.transition,this.transition),a.now)}untransitioned(){return new x_(this.property,this.value,null,{},0)}}class Ah{constructor(a){this._properties=a,this._values=Object.create(a.defaultTransitionablePropertyValues)}getValue(a){return ue(this._values[a].value.value)}setValue(a,h){Object.prototype.hasOwnProperty.call(this._values,a)||(this._values[a]=new d0(this._values[a].property)),this._values[a].value=new sA(this._values[a].property,h===null?void 0:ue(h))}getTransition(a){return ue(this._values[a].transition)}setTransition(a,h){Object.prototype.hasOwnProperty.call(this._values,a)||(this._values[a]=new d0(this._values[a].property)),this._values[a].transition=ue(h)||void 0}serialize(){let a={};for(let h of Object.keys(this._values)){let A=this.getValue(h);A!==void 0&&(a[h]=A);let x=this.getTransition(h);x!==void 0&&(a[`${h}-transition`]=x)}return a}transitioned(a,h){let A=new b_(this._properties);for(let x of Object.keys(this._values))A._values[x]=this._values[x].transitioned(a,h._values[x]);return A}untransitioned(){let a=new b_(this._properties);for(let h of Object.keys(this._values))a._values[h]=this._values[h].untransitioned();return a}}class x_{constructor(a,h,A,x,E){this.property=a,this.value=h,this.begin=E+x.delay||0,this.end=this.begin+x.duration||0,a.specification.transition&&(x.delay||x.duration)&&(this.prior=A)}possiblyEvaluate(a,h,A){let x=a.now||0,E=this.value.possiblyEvaluate(a,h,A),P=this.prior;if(P){if(x>this.end)return this.prior=null,E;if(this.value.isDataDriven())return this.prior=null,E;if(x=1)return 1;let V=F*F,q=V*F;return 4*(F<.5?q:3*(F-V)+q-.75)}(D))}}return E}}class b_{constructor(a){this._properties=a,this._values=Object.create(a.defaultTransitioningPropertyValues)}possiblyEvaluate(a,h,A){let x=new oA(this._properties);for(let E of Object.keys(this._values))x._values[E]=this._values[E].possiblyEvaluate(a,h,A);return x}hasTransition(){for(let a of Object.keys(this._values))if(this._values[a].prior)return!0;return!1}}class Nx{constructor(a){this._properties=a,this._values=Object.create(a.defaultPropertyValues)}hasValue(a){return this._values[a].value!==void 0}getValue(a){return ue(this._values[a].value)}setValue(a,h){this._values[a]=new sA(this._values[a].property,h===null?void 0:ue(h))}serialize(){let a={};for(let h of Object.keys(this._values)){let A=this.getValue(h);A!==void 0&&(a[h]=A)}return a}possiblyEvaluate(a,h,A){let x=new oA(this._properties);for(let E of Object.keys(this._values))x._values[E]=this._values[E].possiblyEvaluate(a,h,A);return x}}class Mo{constructor(a,h,A){this.property=a,this.value=h,this.parameters=A}isConstant(){return this.value.kind===\"constant\"}constantOr(a){return this.value.kind===\"constant\"?this.value.value:a}evaluate(a,h,A,x){return this.property.evaluate(this.value,this.parameters,a,h,A,x)}}class oA{constructor(a){this._properties=a,this._values=Object.create(a.defaultPossiblyEvaluatedValues)}get(a){return this._values[a]}}class nr{constructor(a){this.specification=a}possiblyEvaluate(a,h){if(a.isDataDriven())throw new Error(\"Value should not be data driven\");return a.expression.evaluate(h)}interpolate(a,h,A){let x=Da[this.specification.type];return x?x(a,h,A):a}}class dr{constructor(a,h){this.specification=a,this.overrides=h}possiblyEvaluate(a,h,A,x){return new Mo(this,a.expression.kind===\"constant\"||a.expression.kind===\"camera\"?{kind:\"constant\",value:a.expression.evaluate(h,null,{},A,x)}:a.expression,h)}interpolate(a,h,A){if(a.value.kind!==\"constant\"||h.value.kind!==\"constant\")return a;if(a.value.value===void 0||h.value.value===void 0)return new Mo(this,{kind:\"constant\",value:void 0},a.parameters);let x=Da[this.specification.type];if(x){let E=x(a.value.value,h.value.value,A);return new Mo(this,{kind:\"constant\",value:E},a.parameters)}return a}evaluate(a,h,A,x,E,P){return a.kind===\"constant\"?a.value:a.evaluate(h,A,x,E,P)}}class wf extends dr{possiblyEvaluate(a,h,A,x){if(a.value===void 0)return new Mo(this,{kind:\"constant\",value:void 0},h);if(a.expression.kind===\"constant\"){let E=a.expression.evaluate(h,null,{},A,x),P=a.property.specification.type===\"resolvedImage\"&&typeof E!=\"string\"?E.name:E,D=this._calculate(P,P,P,h);return new Mo(this,{kind:\"constant\",value:D},h)}if(a.expression.kind===\"camera\"){let E=this._calculate(a.expression.evaluate({zoom:h.zoom-1}),a.expression.evaluate({zoom:h.zoom}),a.expression.evaluate({zoom:h.zoom+1}),h);return new Mo(this,{kind:\"constant\",value:E},h)}return new Mo(this,a.expression,h)}evaluate(a,h,A,x,E,P){if(a.kind===\"source\"){let D=a.evaluate(h,A,x,E,P);return this._calculate(D,D,D,h)}return a.kind===\"composite\"?this._calculate(a.evaluate({zoom:Math.floor(h.zoom)-1},A,x),a.evaluate({zoom:Math.floor(h.zoom)},A,x),a.evaluate({zoom:Math.floor(h.zoom)+1},A,x),h):a.value}_calculate(a,h,A,x){return x.zoom>x.zoomHistory.lastIntegerZoom?{from:a,to:h}:{from:A,to:h}}interpolate(a){return a}}class aA{constructor(a){this.specification=a}possiblyEvaluate(a,h,A,x){if(a.value!==void 0){if(a.expression.kind===\"constant\"){let E=a.expression.evaluate(h,null,{},A,x);return this._calculate(E,E,E,h)}return this._calculate(a.expression.evaluate(new un(Math.floor(h.zoom-1),h)),a.expression.evaluate(new un(Math.floor(h.zoom),h)),a.expression.evaluate(new un(Math.floor(h.zoom+1),h)),h)}}_calculate(a,h,A,x){return x.zoom>x.zoomHistory.lastIntegerZoom?{from:a,to:h}:{from:A,to:h}}interpolate(a){return a}}class Bd{constructor(a){this.specification=a}possiblyEvaluate(a,h,A,x){return!!a.expression.evaluate(h,null,{},A,x)}interpolate(){return!1}}class Hn{constructor(a){this.properties=a,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let h in a){let A=a[h];A.specification.overridable&&this.overridableProperties.push(h);let x=this.defaultPropertyValues[h]=new sA(A,void 0),E=this.defaultTransitionablePropertyValues[h]=new d0(A);this.defaultTransitioningPropertyValues[h]=E.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=x.possiblyEvaluate({})}}}Ge(\"DataDrivenProperty\",dr),Ge(\"DataConstantProperty\",nr),Ge(\"CrossFadedDataDrivenProperty\",wf),Ge(\"CrossFadedProperty\",aA),Ge(\"ColorRampProperty\",Bd);let uo=\"-transition\";class ji extends Nl{constructor(a,h){if(super(),this.id=a.id,this.type=a.type,this._featureFilter={filter:()=>!0,needGeometry:!1},a.type!==\"custom\"&&(this.metadata=a.metadata,this.minzoom=a.minzoom,this.maxzoom=a.maxzoom,a.type!==\"background\"&&(this.source=a.source,this.sourceLayer=a[\"source-layer\"],this.filter=a.filter),h.layout&&(this._unevaluatedLayout=new Nx(h.layout)),h.paint)){this._transitionablePaint=new Ah(h.paint);for(let A in a.paint)this.setPaintProperty(A,a.paint[A],{validate:!1});for(let A in a.layout)this.setLayoutProperty(A,a.layout[A],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new oA(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(a){return a===\"visibility\"?this.visibility:this._unevaluatedLayout.getValue(a)}setLayoutProperty(a,h,A={}){h!=null&&this._validate(s0,`layers.${this.id}.layout.${a}`,a,h,A)||(a!==\"visibility\"?this._unevaluatedLayout.setValue(a,h):this.visibility=h)}getPaintProperty(a){return a.endsWith(uo)?this._transitionablePaint.getTransition(a.slice(0,-11)):this._transitionablePaint.getValue(a)}setPaintProperty(a,h,A={}){if(h!=null&&this._validate(rA,`layers.${this.id}.paint.${a}`,a,h,A))return!1;if(a.endsWith(uo))return this._transitionablePaint.setTransition(a.slice(0,-11),h||void 0),!1;{let x=this._transitionablePaint._values[a],E=x.property.specification[\"property-type\"]===\"cross-faded-data-driven\",P=x.value.isDataDriven(),D=x.value;this._transitionablePaint.setValue(a,h),this._handleSpecialPaintPropertyUpdate(a);let F=this._transitionablePaint._values[a].value;return F.isDataDriven()||P||E||this._handleOverridablePaintPropertyUpdate(a,D,F)}}_handleSpecialPaintPropertyUpdate(a){}_handleOverridablePaintPropertyUpdate(a,h,A){return!1}isHidden(a){return!!(this.minzoom&&a=this.maxzoom)||this.visibility===\"none\"}updateTransitions(a){this._transitioningPaint=this._transitionablePaint.transitioned(a,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(a,h){a.getCrossfadeParameters&&(this._crossfadeParameters=a.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(a,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(a,void 0,h)}serialize(){let a={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:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(a.layout=a.layout||{},a.layout.visibility=this.visibility),le(a,(h,A)=>!(h===void 0||A===\"layout\"&&!Object.keys(h).length||A===\"paint\"&&!Object.keys(h).length))}_validate(a,h,A,x,E={}){return(!E||E.validate!==!1)&&fh(this,a.call(za,{key:h,layerType:this.type,objectKey:A,value:x,styleSpec:ee,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let a in this.paint._values){let h=this.paint.get(a);if(h instanceof Mo&&_f(h.property.specification)&&(h.value.kind===\"source\"||h.value.kind===\"composite\")&&h.value.isStateDependent)return!0}return!1}}let w_={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class mh{constructor(a,h){this._structArray=a,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class kn{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(a,h){return a._trim(),h&&(a.isTransferred=!0,h.push(a.arrayBuffer)),{length:a.length,arrayBuffer:a.arrayBuffer}}static deserialize(a){let h=Object.create(this.prototype);return h.arrayBuffer=a.arrayBuffer,h.length=a.length,h.capacity=a.arrayBuffer.byteLength/h.bytesPerElement,h._refreshViews(),h}_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(a){this.reserve(a),this.length=a}reserve(a){if(a>this.capacity){this.capacity=Math.max(a,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}_refreshViews(){throw new Error(\"_refreshViews() must be implemented by each concrete StructArray layout\")}}function wn(u,a=1){let h=0,A=0;return{members:u.map(x=>{let E=w_[x.type].BYTES_PER_ELEMENT,P=h=Sf(h,Math.max(a,E)),D=x.components||1;return A=Math.max(A,E),h+=E*D,{name:x.name,type:x.type,components:D,offset:P}}),size:Sf(h,Math.max(A,a)),alignment:a}}function Sf(u,a){return Math.ceil(u/a)*a}class Es extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h){let A=this.length;return this.resize(A+1),this.emplace(A,a,h)}emplace(a,h,A){let x=2*a;return this.int16[x+0]=h,this.int16[x+1]=A,a}}Es.prototype.bytesPerElement=4,Ge(\"StructArrayLayout2i4\",Es);class gh extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A){let x=this.length;return this.resize(x+1),this.emplace(x,a,h,A)}emplace(a,h,A,x){let E=3*a;return this.int16[E+0]=h,this.int16[E+1]=A,this.int16[E+2]=x,a}}gh.prototype.bytesPerElement=6,Ge(\"StructArrayLayout3i6\",gh);class Wo extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A,x){let E=this.length;return this.resize(E+1),this.emplace(E,a,h,A,x)}emplace(a,h,A,x,E){let P=4*a;return this.int16[P+0]=h,this.int16[P+1]=A,this.int16[P+2]=x,this.int16[P+3]=E,a}}Wo.prototype.bytesPerElement=8,Ge(\"StructArrayLayout4i8\",Wo);class p0 extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E,P){let D=this.length;return this.resize(D+1),this.emplace(D,a,h,A,x,E,P)}emplace(a,h,A,x,E,P,D){let F=6*a;return this.int16[F+0]=h,this.int16[F+1]=A,this.int16[F+2]=x,this.int16[F+3]=E,this.int16[F+4]=P,this.int16[F+5]=D,a}}p0.prototype.bytesPerElement=12,Ge(\"StructArrayLayout2i4i12\",p0);class Fd extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E,P){let D=this.length;return this.resize(D+1),this.emplace(D,a,h,A,x,E,P)}emplace(a,h,A,x,E,P,D){let F=4*a,V=8*a;return this.int16[F+0]=h,this.int16[F+1]=A,this.uint8[V+4]=x,this.uint8[V+5]=E,this.uint8[V+6]=P,this.uint8[V+7]=D,a}}Fd.prototype.bytesPerElement=8,Ge(\"StructArrayLayout2i4ub8\",Fd);class Tf extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h){let A=this.length;return this.resize(A+1),this.emplace(A,a,h)}emplace(a,h,A){let x=2*a;return this.float32[x+0]=h,this.float32[x+1]=A,a}}Tf.prototype.bytesPerElement=8,Ge(\"StructArrayLayout2f8\",Tf);class Ho extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E,P,D,F,V,q){let X=this.length;return this.resize(X+1),this.emplace(X,a,h,A,x,E,P,D,F,V,q)}emplace(a,h,A,x,E,P,D,F,V,q,X){let rt=10*a;return this.uint16[rt+0]=h,this.uint16[rt+1]=A,this.uint16[rt+2]=x,this.uint16[rt+3]=E,this.uint16[rt+4]=P,this.uint16[rt+5]=D,this.uint16[rt+6]=F,this.uint16[rt+7]=V,this.uint16[rt+8]=q,this.uint16[rt+9]=X,a}}Ho.prototype.bytesPerElement=20,Ge(\"StructArrayLayout10ui20\",Ho);class lA extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E,P,D,F,V,q,X,rt){let at=this.length;return this.resize(at+1),this.emplace(at,a,h,A,x,E,P,D,F,V,q,X,rt)}emplace(a,h,A,x,E,P,D,F,V,q,X,rt,at){let ct=12*a;return this.int16[ct+0]=h,this.int16[ct+1]=A,this.int16[ct+2]=x,this.int16[ct+3]=E,this.uint16[ct+4]=P,this.uint16[ct+5]=D,this.uint16[ct+6]=F,this.uint16[ct+7]=V,this.int16[ct+8]=q,this.int16[ct+9]=X,this.int16[ct+10]=rt,this.int16[ct+11]=at,a}}lA.prototype.bytesPerElement=24,Ge(\"StructArrayLayout4i4ui4i24\",lA);class bi extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,A){let x=this.length;return this.resize(x+1),this.emplace(x,a,h,A)}emplace(a,h,A,x){let E=3*a;return this.float32[E+0]=h,this.float32[E+1]=A,this.float32[E+2]=x,a}}bi.prototype.bytesPerElement=12,Ge(\"StructArrayLayout3f12\",bi);class T extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(a){let h=this.length;return this.resize(h+1),this.emplace(h,a)}emplace(a,h){return this.uint32[1*a+0]=h,a}}T.prototype.bytesPerElement=4,Ge(\"StructArrayLayout1ul4\",T);class l extends kn{_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(a,h,A,x,E,P,D,F,V){let q=this.length;return this.resize(q+1),this.emplace(q,a,h,A,x,E,P,D,F,V)}emplace(a,h,A,x,E,P,D,F,V,q){let X=10*a,rt=5*a;return this.int16[X+0]=h,this.int16[X+1]=A,this.int16[X+2]=x,this.int16[X+3]=E,this.int16[X+4]=P,this.int16[X+5]=D,this.uint32[rt+3]=F,this.uint16[X+8]=V,this.uint16[X+9]=q,a}}l.prototype.bytesPerElement=20,Ge(\"StructArrayLayout6i1ul2ui20\",l);class d extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E,P){let D=this.length;return this.resize(D+1),this.emplace(D,a,h,A,x,E,P)}emplace(a,h,A,x,E,P,D){let F=6*a;return this.int16[F+0]=h,this.int16[F+1]=A,this.int16[F+2]=x,this.int16[F+3]=E,this.int16[F+4]=P,this.int16[F+5]=D,a}}d.prototype.bytesPerElement=12,Ge(\"StructArrayLayout2i2i2i12\",d);class v extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E){let P=this.length;return this.resize(P+1),this.emplace(P,a,h,A,x,E)}emplace(a,h,A,x,E,P){let D=4*a,F=8*a;return this.float32[D+0]=h,this.float32[D+1]=A,this.float32[D+2]=x,this.int16[F+6]=E,this.int16[F+7]=P,a}}v.prototype.bytesPerElement=16,Ge(\"StructArrayLayout2f1f2i16\",v);class b extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,A,x){let E=this.length;return this.resize(E+1),this.emplace(E,a,h,A,x)}emplace(a,h,A,x,E){let P=12*a,D=3*a;return this.uint8[P+0]=h,this.uint8[P+1]=A,this.float32[D+1]=x,this.float32[D+2]=E,a}}b.prototype.bytesPerElement=12,Ge(\"StructArrayLayout2ub2f12\",b);class M extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,A){let x=this.length;return this.resize(x+1),this.emplace(x,a,h,A)}emplace(a,h,A,x){let E=3*a;return this.uint16[E+0]=h,this.uint16[E+1]=A,this.uint16[E+2]=x,a}}M.prototype.bytesPerElement=6,Ge(\"StructArrayLayout3ui6\",M);class O extends kn{_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(a,h,A,x,E,P,D,F,V,q,X,rt,at,ct,mt,bt,Pt){let jt=this.length;return this.resize(jt+1),this.emplace(jt,a,h,A,x,E,P,D,F,V,q,X,rt,at,ct,mt,bt,Pt)}emplace(a,h,A,x,E,P,D,F,V,q,X,rt,at,ct,mt,bt,Pt,jt){let Rt=24*a,Gt=12*a,Yt=48*a;return this.int16[Rt+0]=h,this.int16[Rt+1]=A,this.uint16[Rt+2]=x,this.uint16[Rt+3]=E,this.uint32[Gt+2]=P,this.uint32[Gt+3]=D,this.uint32[Gt+4]=F,this.uint16[Rt+10]=V,this.uint16[Rt+11]=q,this.uint16[Rt+12]=X,this.float32[Gt+7]=rt,this.float32[Gt+8]=at,this.uint8[Yt+36]=ct,this.uint8[Yt+37]=mt,this.uint8[Yt+38]=bt,this.uint32[Gt+10]=Pt,this.int16[Rt+22]=jt,a}}O.prototype.bytesPerElement=48,Ge(\"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48\",O);class B extends kn{_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(a,h,A,x,E,P,D,F,V,q,X,rt,at,ct,mt,bt,Pt,jt,Rt,Gt,Yt,ce,Ne,ir,Fe,Re,Me,Ye){let Ie=this.length;return this.resize(Ie+1),this.emplace(Ie,a,h,A,x,E,P,D,F,V,q,X,rt,at,ct,mt,bt,Pt,jt,Rt,Gt,Yt,ce,Ne,ir,Fe,Re,Me,Ye)}emplace(a,h,A,x,E,P,D,F,V,q,X,rt,at,ct,mt,bt,Pt,jt,Rt,Gt,Yt,ce,Ne,ir,Fe,Re,Me,Ye,Ie){let Ae=32*a,hr=16*a;return this.int16[Ae+0]=h,this.int16[Ae+1]=A,this.int16[Ae+2]=x,this.int16[Ae+3]=E,this.int16[Ae+4]=P,this.int16[Ae+5]=D,this.int16[Ae+6]=F,this.int16[Ae+7]=V,this.uint16[Ae+8]=q,this.uint16[Ae+9]=X,this.uint16[Ae+10]=rt,this.uint16[Ae+11]=at,this.uint16[Ae+12]=ct,this.uint16[Ae+13]=mt,this.uint16[Ae+14]=bt,this.uint16[Ae+15]=Pt,this.uint16[Ae+16]=jt,this.uint16[Ae+17]=Rt,this.uint16[Ae+18]=Gt,this.uint16[Ae+19]=Yt,this.uint16[Ae+20]=ce,this.uint16[Ae+21]=Ne,this.uint16[Ae+22]=ir,this.uint32[hr+12]=Fe,this.float32[hr+13]=Re,this.float32[hr+14]=Me,this.uint16[Ae+30]=Ye,this.uint16[Ae+31]=Ie,a}}B.prototype.bytesPerElement=64,Ge(\"StructArrayLayout8i15ui1ul2f2ui64\",B);class U extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a){let h=this.length;return this.resize(h+1),this.emplace(h,a)}emplace(a,h){return this.float32[1*a+0]=h,a}}U.prototype.bytesPerElement=4,Ge(\"StructArrayLayout1f4\",U);class W extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,A){let x=this.length;return this.resize(x+1),this.emplace(x,a,h,A)}emplace(a,h,A,x){let E=3*a;return this.uint16[6*a+0]=h,this.float32[E+1]=A,this.float32[E+2]=x,a}}W.prototype.bytesPerElement=12,Ge(\"StructArrayLayout1ui2f12\",W);class Z extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,A){let x=this.length;return this.resize(x+1),this.emplace(x,a,h,A)}emplace(a,h,A,x){let E=4*a;return this.uint32[2*a+0]=h,this.uint16[E+2]=A,this.uint16[E+3]=x,a}}Z.prototype.bytesPerElement=8,Ge(\"StructArrayLayout1ul2ui8\",Z);class $ extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h){let A=this.length;return this.resize(A+1),this.emplace(A,a,h)}emplace(a,h,A){let x=2*a;return this.uint16[x+0]=h,this.uint16[x+1]=A,a}}$.prototype.bytesPerElement=4,Ge(\"StructArrayLayout2ui4\",$);class st extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a){let h=this.length;return this.resize(h+1),this.emplace(h,a)}emplace(a,h){return this.uint16[1*a+0]=h,a}}st.prototype.bytesPerElement=2,Ge(\"StructArrayLayout1ui2\",st);class At extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,A,x){let E=this.length;return this.resize(E+1),this.emplace(E,a,h,A,x)}emplace(a,h,A,x,E){let P=4*a;return this.float32[P+0]=h,this.float32[P+1]=A,this.float32[P+2]=x,this.float32[P+3]=E,a}}At.prototype.bytesPerElement=16,Ge(\"StructArrayLayout4f16\",At);class pt extends mh{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 w(this.anchorPointX,this.anchorPointY)}}pt.prototype.size=20;class yt extends l{get(a){return new pt(this,a)}}Ge(\"CollisionBoxArray\",yt);class dt extends mh{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(a){this._structArray.uint8[this._pos1+37]=a}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(a){this._structArray.uint8[this._pos1+38]=a}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(a){this._structArray.uint32[this._pos4+10]=a}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}dt.prototype.size=48;class Ft extends O{get(a){return new dt(this,a)}}Ge(\"PlacedSymbolArray\",Ft);class Ht extends mh{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(a){this._structArray.uint32[this._pos4+12]=a}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]}}Ht.prototype.size=64;class St extends B{get(a){return new Ht(this,a)}}Ge(\"SymbolInstanceArray\",St);class Bt extends U{getoffsetX(a){return this.float32[1*a+0]}}Ge(\"GlyphOffsetArray\",Bt);class Qt extends gh{getx(a){return this.int16[3*a+0]}gety(a){return this.int16[3*a+1]}gettileUnitDistanceFromAnchor(a){return this.int16[3*a+2]}}Ge(\"SymbolLineVertexArray\",Qt);class $t extends mh{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]}}$t.prototype.size=12;class oe extends W{get(a){return new $t(this,a)}}Ge(\"TextAnchorOffsetArray\",oe);class pe extends mh{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]}}pe.prototype.size=8;class he extends Z{get(a){return new pe(this,a)}}Ge(\"FeatureIndexArray\",he);class be extends Es{}class Ze extends Es{}class Kr extends Es{}class Ee extends p0{}class pr extends Fd{}class tr extends Tf{}class Gi extends Ho{}class Jr extends lA{}class Vr extends bi{}class ei extends T{}class On extends d{}class tn extends b{}class Gs extends M{}class hs extends ${}let Bn=wn([{name:\"a_pos\",components:2,type:\"Int16\"}],4),{members:qo}=Bn;class jr{constructor(a=[]){this.segments=a}prepareSegment(a,h,A,x){let E=this.segments[this.segments.length-1];return a>jr.MAX_VERTEX_ARRAY_LENGTH&&Ke(`Max vertices per segment is ${jr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${a}`),(!E||E.vertexLength+a>jr.MAX_VERTEX_ARRAY_LENGTH||E.sortKey!==x)&&(E={vertexOffset:h.length,primitiveOffset:A.length,vertexLength:0,primitiveLength:0},x!==void 0&&(E.sortKey=x),this.segments.push(E)),E}get(){return this.segments}destroy(){for(let a of this.segments)for(let h in a.vaos)a.vaos[h].destroy()}static simpleSegment(a,h,A,x){return new jr([{vertexOffset:a,primitiveOffset:h,vertexLength:A,primitiveLength:x,vaos:{},sortKey:0}])}}function ql(u,a){return 256*(u=ut(Math.floor(u),0,255))+ut(Math.floor(a),0,255)}jr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ge(\"SegmentVector\",jr);let Zl=wn([{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\"}]);var yu={exports:{}},vu={exports:{}};vu.exports=function(u,a){var h,A,x,E,P,D,F,V;for(A=u.length-(h=3&u.length),x=a,P=3432918353,D=461845907,V=0;V>>16)*P&65535)<<16)&4294967295)<<15|F>>>17))*D+(((F>>>16)*D&65535)<<16)&4294967295)<<13|x>>>19))+((5*(x>>>16)&65535)<<16)&4294967295))+((58964+(E>>>16)&65535)<<16);switch(F=0,h){case 3:F^=(255&u.charCodeAt(V+2))<<16;case 2:F^=(255&u.charCodeAt(V+1))<<8;case 1:x^=F=(65535&(F=(F=(65535&(F^=255&u.charCodeAt(V)))*P+(((F>>>16)*P&65535)<<16)&4294967295)<<15|F>>>17))*D+(((F>>>16)*D&65535)<<16)&4294967295}return x^=u.length,x=2246822507*(65535&(x^=x>>>16))+((2246822507*(x>>>16)&65535)<<16)&4294967295,x=3266489909*(65535&(x^=x>>>13))+((3266489909*(x>>>16)&65535)<<16)&4294967295,(x^=x>>>16)>>>0};var _h=vu.exports,Ws={exports:{}};Ws.exports=function(u,a){for(var h,A=u.length,x=a^A,E=0;A>=4;)h=1540483477*(65535&(h=255&u.charCodeAt(E)|(255&u.charCodeAt(++E))<<8|(255&u.charCodeAt(++E))<<16|(255&u.charCodeAt(++E))<<24))+((1540483477*(h>>>16)&65535)<<16),x=1540483477*(65535&x)+((1540483477*(x>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),A-=4,++E;switch(A){case 3:x^=(255&u.charCodeAt(E+2))<<16;case 2:x^=(255&u.charCodeAt(E+1))<<8;case 1:x=1540483477*(65535&(x^=255&u.charCodeAt(E)))+((1540483477*(x>>>16)&65535)<<16)}return x=1540483477*(65535&(x^=x>>>13))+((1540483477*(x>>>16)&65535)<<16),(x^=x>>>15)>>>0};var Ps=_h,Eo=Ws.exports;yu.exports=Ps,yu.exports.murmur3=Ps,yu.exports.murmur2=Eo;var yh=c(yu.exports);class Fn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(a,h,A,x){this.ids.push(fs(a)),this.positions.push(h,A,x)}getPositions(a){if(!this.indexed)throw new Error(\"Trying to get index, but feature positions are not indexed\");let h=fs(a),A=0,x=this.ids.length-1;for(;A>1;this.ids[P]>=h?x=P:A=P+1}let E=[];for(;this.ids[A]===h;)E.push({index:this.positions[3*A],start:this.positions[3*A+1],end:this.positions[3*A+2]}),A++;return E}static serialize(a,h){let A=new Float64Array(a.ids),x=new Uint32Array(a.positions);return Zo(A,x,0,A.length-1),h&&h.push(A.buffer,x.buffer),{ids:A,positions:x}}static deserialize(a){let h=new Fn;return h.ids=a.ids,h.positions=a.positions,h.indexed=!0,h}}function fs(u){let a=+u;return!isNaN(a)&&a<=Number.MAX_SAFE_INTEGER?a:yh(String(u))}function Zo(u,a,h,A){for(;h>1],E=h-1,P=A+1;for(;;){do E++;while(u[E]x);if(E>=P)break;_n(u,E,P),_n(a,3*E,3*P),_n(a,3*E+1,3*P+1),_n(a,3*E+2,3*P+2)}P-h`u_${x}`),this.type=A}setUniform(a,h,A){a.set(A.constantOr(this.value))}getBinding(a,h,A){return this.type===\"color\"?new S_(a,h):new Gr(a,h)}}class Yo{constructor(a,h){this.uniformNames=h.map(A=>`u_${A}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(a,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=a.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=a.tlbr}setUniform(a,h,A,x){let E=x===\"u_pattern_to\"?this.patternTo:x===\"u_pattern_from\"?this.patternFrom:x===\"u_pixel_ratio_to\"?this.pixelRatioTo:x===\"u_pixel_ratio_from\"?this.pixelRatioFrom:null;E&&a.set(E)}getBinding(a,h,A){return A.substr(0,9)===\"u_pattern\"?new Ua(a,h):new Gr(a,h)}}class me{constructor(a,h,A,x){this.expression=a,this.type=A,this.maxValue=0,this.paintVertexAttributes=h.map(E=>({name:`a_${E}`,type:\"Float32\",components:A===\"color\"?2:1,offset:0})),this.paintVertexArray=new x}populatePaintArray(a,h,A,x,E){let P=this.paintVertexArray.length,D=this.expression.evaluate(new un(0),h,{},x,[],E);this.paintVertexArray.resize(a),this._setPaintValue(P,a,D)}updatePaintArray(a,h,A,x){let E=this.expression.evaluate({zoom:0},A,x);this._setPaintValue(a,h,E)}_setPaintValue(a,h,A){if(this.type===\"color\"){let x=cA(A);for(let E=a;E`u_${D}_t`),this.type=A,this.useIntegerZoom=x,this.zoom=E,this.maxValue=0,this.paintVertexAttributes=h.map(D=>({name:`a_${D}`,type:\"Float32\",components:A===\"color\"?4:2,offset:0})),this.paintVertexArray=new P}populatePaintArray(a,h,A,x,E){let P=this.expression.evaluate(new un(this.zoom),h,{},x,[],E),D=this.expression.evaluate(new un(this.zoom+1),h,{},x,[],E),F=this.paintVertexArray.length;this.paintVertexArray.resize(a),this._setPaintValue(F,a,P,D)}updatePaintArray(a,h,A,x){let E=this.expression.evaluate({zoom:this.zoom},A,x),P=this.expression.evaluate({zoom:this.zoom+1},A,x);this._setPaintValue(a,h,E,P)}_setPaintValue(a,h,A,x){if(this.type===\"color\"){let E=cA(A),P=cA(x);for(let D=a;D`#define HAS_UNIFORM_${x}`))}return a}getBinderAttributes(){let a=[];for(let h in this.binders){let A=this.binders[h];if(A instanceof me||A instanceof ke)for(let x=0;x!0){this.programConfigurations={};for(let x of a)this.programConfigurations[x.id]=new Mf(x,h,A);this.needsUpload=!1,this._featureMap=new Fn,this._bufferOffset=0}populatePaintArrays(a,h,A,x,E,P){for(let D in this.programConfigurations)this.programConfigurations[D].populatePaintArrays(a,h,x,E,P);h.id!==void 0&&this._featureMap.add(h.id,A,this._bufferOffset,a),this._bufferOffset=a,this.needsUpload=!0}updatePaintArrays(a,h,A,x){for(let E of A)this.needsUpload=this.programConfigurations[E.id].updatePaintArrays(a,this._featureMap,h,E,x)||this.needsUpload}get(a){return this.programConfigurations[a]}upload(a){if(this.needsUpload){for(let h in this.programConfigurations)this.programConfigurations[h].upload(a);this.needsUpload=!1}}destroy(){for(let a in this.programConfigurations)this.programConfigurations[a].destroy()}}function Fc(u,a){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-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\"]}[u]||[u.replace(`${a}-`,\"\").replace(/-/g,\"_\")]}function Ux(u,a,h){let A={color:{source:Tf,composite:At},number:{source:U,composite:Tf}},x=function(E){return{\"line-pattern\":{source:Gi,composite:Gi},\"fill-pattern\":{source:Gi,composite:Gi},\"fill-extrusion-pattern\":{source:Gi,composite:Gi}}[E]}(u);return x&&x[h]||A[a][h]}Ge(\"ConstantBinder\",Yl),Ge(\"CrossFadedConstantBinder\",Yo),Ge(\"SourceExpressionBinder\",me),Ge(\"CrossFadedCompositeBinder\",ml),Ge(\"CompositeExpressionBinder\",ke),Ge(\"ProgramConfiguration\",Mf,{omit:[\"_buffers\"]}),Ge(\"ProgramConfigurationSet\",Va);let en=8192,p=Math.pow(2,14)-1,m=-p-1;function y(u){let a=en/u.extent,h=u.loadGeometry();for(let A=0;AP.x+1||FP.y+1)&&Ke(\"Geometry exceeds allowed extent, reduce your vector tile buffer size\")}}return h}function S(u,a){return{type:u.type,id:u.id,properties:u.properties,geometry:a?y(u):[]}}function C(u,a,h,A,x){u.emplaceBack(2*a+(A+1)/2,2*h+(x+1)/2)}class k{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(h=>h.id),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new Ze,this.indexArray=new Gs,this.segments=new jr,this.programConfigurations=new Va(a.layers,a.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,A){let x=this.layers[0],E=[],P=null,D=!1;x.type===\"circle\"&&(P=x.layout.get(\"circle-sort-key\"),D=!P.isConstant());for(let{feature:F,id:V,index:q,sourceLayerIndex:X}of a){let rt=this.layers[0]._featureFilter.needGeometry,at=S(F,rt);if(!this.layers[0]._featureFilter.filter(new un(this.zoom),at,A))continue;let ct=D?P.evaluate(at,{},A):void 0,mt={id:V,properties:F.properties,type:F.type,sourceLayerIndex:X,index:q,geometry:rt?at.geometry:y(F),patterns:{},sortKey:ct};E.push(mt)}D&&E.sort((F,V)=>F.sortKey-V.sortKey);for(let F of E){let{geometry:V,index:q,sourceLayerIndex:X}=F,rt=a[q].feature;this.addFeature(F,V,q,A),h.featureIndex.insert(rt,V,q,X,this.index)}}update(a,h,A){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,A)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,qo),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(a,h,A,x){for(let E of h)for(let P of E){let D=P.x,F=P.y;if(D<0||D>=en||F<0||F>=en)continue;let V=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,a.sortKey),q=V.vertexLength;C(this.layoutVertexArray,D,F,-1,-1),C(this.layoutVertexArray,D,F,1,-1),C(this.layoutVertexArray,D,F,1,1),C(this.layoutVertexArray,D,F,-1,1),this.indexArray.emplaceBack(q,q+1,q+2),this.indexArray.emplaceBack(q,q+3,q+2),V.vertexLength+=4,V.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,A,{},x)}}function L(u,a){for(let h=0;h1){if(ot(u,a))return!0;for(let A=0;A1?h:h.sub(a)._mult(x)._add(a))}function re(u,a){let h,A,x,E=!1;for(let P=0;Pa.y!=x.y>a.y&&a.x<(x.x-A.x)*(a.y-A.y)/(x.y-A.y)+A.x&&(E=!E)}return E}function ne(u,a){let h=!1;for(let A=0,x=u.length-1;Aa.y!=P.y>a.y&&a.x<(P.x-E.x)*(a.y-E.y)/(P.y-E.y)+E.x&&(h=!h)}return h}function Le(u,a,h){let A=h[0],x=h[2];if(u.xx.x&&a.x>x.x||u.yx.y&&a.y>x.y)return!1;let E=rr(u,a,h[0]);return E!==rr(u,a,h[1])||E!==rr(u,a,h[2])||E!==rr(u,a,h[3])}function We(u,a,h){let A=a.paint.get(u).value;return A.kind===\"constant\"?A.value:h.programConfigurations.get(a.id).getMaxValue(u)}function te(u){return Math.sqrt(u[0]*u[0]+u[1]*u[1])}function _e(u,a,h,A,x){if(!a[0]&&!a[1])return u;let E=w.convert(a)._mult(x);h===\"viewport\"&&E._rotate(-A);let P=[];for(let D=0;Dyn(bt,mt))}(V,F),at=X?q*D:q;for(let ct of x)for(let mt of ct){let bt=X?mt:yn(mt,F),Pt=at,jt=Pi([],[mt.x,mt.y,0,1],F);if(this.paint.get(\"circle-pitch-scale\")===\"viewport\"&&this.paint.get(\"circle-pitch-alignment\")===\"map\"?Pt*=jt[3]/P.cameraToCenterDistance:this.paint.get(\"circle-pitch-scale\")===\"map\"&&this.paint.get(\"circle-pitch-alignment\")===\"viewport\"&&(Pt*=P.cameraToCenterDistance/jt[3]),z(rt,bt,Pt))return!0}return!1}}function yn(u,a){let h=Pi([],[u.x,u.y,0,1],a);return new w(h[0]/h[3],h[1]/h[3])}class Or extends k{}let zF;Ge(\"HeatmapBucket\",Or,{omit:[\"layers\"]});var VX={get paint(){return zF=zF||new Hn({\"heatmap-radius\":new dr(ee.paint_heatmap[\"heatmap-radius\"]),\"heatmap-weight\":new dr(ee.paint_heatmap[\"heatmap-weight\"]),\"heatmap-intensity\":new nr(ee.paint_heatmap[\"heatmap-intensity\"]),\"heatmap-color\":new Bd(ee.paint_heatmap[\"heatmap-color\"]),\"heatmap-opacity\":new nr(ee.paint_heatmap[\"heatmap-opacity\"])})}};function fC(u,{width:a,height:h},A,x){if(x){if(x instanceof Uint8ClampedArray)x=new Uint8Array(x.buffer);else if(x.length!==a*h*A)throw new RangeError(`mismatched image size. expected: ${x.length} but got: ${a*h*A}`)}else x=new Uint8Array(a*h*A);return u.width=a,u.height=h,u.data=x,u}function NF(u,{width:a,height:h},A){if(a===u.width&&h===u.height)return;let x=fC({},{width:a,height:h},A);dC(u,x,{x:0,y:0},{x:0,y:0},{width:Math.min(u.width,a),height:Math.min(u.height,h)},A),u.width=a,u.height=h,u.data=x.data}function dC(u,a,h,A,x,E){if(x.width===0||x.height===0)return a;if(x.width>u.width||x.height>u.height||h.x>u.width-x.width||h.y>u.height-x.height)throw new RangeError(\"out of range source coordinates for image copy\");if(x.width>a.width||x.height>a.height||A.x>a.width-x.width||A.y>a.height-x.height)throw new RangeError(\"out of range destination coordinates for image copy\");let P=u.data,D=a.data;if(P===D)throw new Error(\"srcData equals dstData, so image is already copied\");for(let F=0;F{a[u.evaluationKey]=F;let V=u.expression.evaluate(a);x.data[P+D+0]=Math.floor(255*V.r/V.a),x.data[P+D+1]=Math.floor(255*V.g/V.a),x.data[P+D+2]=Math.floor(255*V.b/V.a),x.data[P+D+3]=Math.floor(255*V.a)};if(u.clips)for(let P=0,D=0;P80*h){A=E=u[0],x=P=u[1];for(var ct=h;ctE&&(E=D),F>P&&(P=F);V=(V=Math.max(E-A,P-x))!==0?32767/V:0}return jx(rt,at,h,A,x,V,0),at}function jF(u,a,h,A,x){var E,P;if(x===gC(u,a,h,A)>0)for(E=a;E=a;E-=A)P=HF(E,u[E],u[E+1],P);return P&&JS(P,P.next)&&(Wx(P),P=P.next),P}function A0(u,a){if(!u)return u;a||(a=u);var h,A=u;do if(h=!1,A.steiner||!JS(A,A.next)&&ds(A.prev,A,A.next)!==0)A=A.next;else{if(Wx(A),(A=a=A.prev)===A.next)break;h=!0}while(h||A!==a);return a}function jx(u,a,h,A,x,E,P){if(u){!P&&E&&function(q,X,rt,at){var ct=q;do ct.z===0&&(ct.z=AC(ct.x,ct.y,X,rt,at)),ct.prevZ=ct.prev,ct.nextZ=ct.next,ct=ct.next;while(ct!==q);ct.prevZ.nextZ=null,ct.prevZ=null,function(mt){var bt,Pt,jt,Rt,Gt,Yt,ce,Ne,ir=1;do{for(Pt=mt,mt=null,Gt=null,Yt=0;Pt;){for(Yt++,jt=Pt,ce=0,bt=0;bt0||Ne>0&&jt;)ce!==0&&(Ne===0||!jt||Pt.z<=jt.z)?(Rt=Pt,Pt=Pt.nextZ,ce--):(Rt=jt,jt=jt.nextZ,Ne--),Gt?Gt.nextZ=Rt:mt=Rt,Rt.prevZ=Gt,Gt=Rt;Pt=jt}Gt.nextZ=null,ir*=2}while(Yt>1)}(ct)}(u,A,x,E);for(var D,F,V=u;u.prev!==u.next;)if(D=u.prev,F=u.next,E?YX(u,A,x,E):ZX(u))a.push(D.i/h|0),a.push(u.i/h|0),a.push(F.i/h|0),Wx(u),u=F.next,V=F.next;else if((u=F)===V){P?P===1?jx(u=QX(A0(u),a,h),a,h,A,x,E,2):P===2&&$X(u,a,h,A,x,E):jx(A0(u),a,h,A,x,E,1);break}}}function ZX(u){var a=u.prev,h=u,A=u.next;if(ds(a,h,A)>=0)return!1;for(var x=a.x,E=h.x,P=A.x,D=a.y,F=h.y,V=A.y,q=xE?x>P?x:P:E>P?E:P,at=D>F?D>V?D:V:F>V?F:V,ct=A.next;ct!==a;){if(ct.x>=q&&ct.x<=rt&&ct.y>=X&&ct.y<=at&&T_(x,D,E,F,P,V,ct.x,ct.y)&&ds(ct.prev,ct,ct.next)>=0)return!1;ct=ct.next}return!0}function YX(u,a,h,A){var x=u.prev,E=u,P=u.next;if(ds(x,E,P)>=0)return!1;for(var D=x.x,F=E.x,V=P.x,q=x.y,X=E.y,rt=P.y,at=DF?D>V?D:V:F>V?F:V,bt=q>X?q>rt?q:rt:X>rt?X:rt,Pt=AC(at,ct,a,h,A),jt=AC(mt,bt,a,h,A),Rt=u.prevZ,Gt=u.nextZ;Rt&&Rt.z>=Pt&&Gt&&Gt.z<=jt;){if(Rt.x>=at&&Rt.x<=mt&&Rt.y>=ct&&Rt.y<=bt&&Rt!==x&&Rt!==P&&T_(D,q,F,X,V,rt,Rt.x,Rt.y)&&ds(Rt.prev,Rt,Rt.next)>=0||(Rt=Rt.prevZ,Gt.x>=at&&Gt.x<=mt&&Gt.y>=ct&&Gt.y<=bt&&Gt!==x&&Gt!==P&&T_(D,q,F,X,V,rt,Gt.x,Gt.y)&&ds(Gt.prev,Gt,Gt.next)>=0))return!1;Gt=Gt.nextZ}for(;Rt&&Rt.z>=Pt;){if(Rt.x>=at&&Rt.x<=mt&&Rt.y>=ct&&Rt.y<=bt&&Rt!==x&&Rt!==P&&T_(D,q,F,X,V,rt,Rt.x,Rt.y)&&ds(Rt.prev,Rt,Rt.next)>=0)return!1;Rt=Rt.prevZ}for(;Gt&&Gt.z<=jt;){if(Gt.x>=at&&Gt.x<=mt&&Gt.y>=ct&&Gt.y<=bt&&Gt!==x&&Gt!==P&&T_(D,q,F,X,V,rt,Gt.x,Gt.y)&&ds(Gt.prev,Gt,Gt.next)>=0)return!1;Gt=Gt.nextZ}return!0}function QX(u,a,h){var A=u;do{var x=A.prev,E=A.next.next;!JS(x,E)&&GF(x,A,A.next,E)&&Gx(x,E)&&Gx(E,x)&&(a.push(x.i/h|0),a.push(A.i/h|0),a.push(E.i/h|0),Wx(A),Wx(A.next),A=u=E),A=A.next}while(A!==u);return A0(A)}function $X(u,a,h,A,x,E){var P=u;do{for(var D=P.next.next;D!==P.prev;){if(P.i!==D.i&&eK(P,D)){var F=WF(P,D);return P=A0(P,P.next),F=A0(F,F.next),jx(P,a,h,A,x,E,0),void jx(F,a,h,A,x,E,0)}D=D.next}P=P.next}while(P!==u)}function XX(u,a){return u.x-a.x}function KX(u,a){var h=function(x,E){var P,D=E,F=x.x,V=x.y,q=-1/0;do{if(V<=D.y&&V>=D.next.y&&D.next.y!==D.y){var X=D.x+(V-D.y)*(D.next.x-D.x)/(D.next.y-D.y);if(X<=F&&X>q&&(q=X,P=D.x=D.x&&D.x>=ct&&F!==D.x&&T_(VP.x||D.x===P.x&&JX(P,D)))&&(P=D,bt=rt)),D=D.next;while(D!==at);return P}(u,a);if(!h)return a;var A=WF(h,u);return A0(A,A.next),A0(h,h.next)}function JX(u,a){return ds(u.prev,u,a.prev)<0&&ds(a.next,u,u.next)<0}function AC(u,a,h,A,x){return(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=(u-h)*x|0)|u<<8))|u<<4))|u<<2))|u<<1))|(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=(a-A)*x|0)|a<<8))|a<<4))|a<<2))|a<<1))<<1}function tK(u){var a=u,h=u;do(a.x=(u-P)*(E-D)&&(u-P)*(A-D)>=(h-P)*(a-D)&&(h-P)*(E-D)>=(x-P)*(A-D)}function eK(u,a){return u.next.i!==a.i&&u.prev.i!==a.i&&!function(h,A){var x=h;do{if(x.i!==h.i&&x.next.i!==h.i&&x.i!==A.i&&x.next.i!==A.i&&GF(x,x.next,h,A))return!0;x=x.next}while(x!==h);return!1}(u,a)&&(Gx(u,a)&&Gx(a,u)&&function(h,A){var x=h,E=!1,P=(h.x+A.x)/2,D=(h.y+A.y)/2;do x.y>D!=x.next.y>D&&x.next.y!==x.y&&P<(x.next.x-x.x)*(D-x.y)/(x.next.y-x.y)+x.x&&(E=!E),x=x.next;while(x!==h);return E}(u,a)&&(ds(u.prev,u,a.prev)||ds(u,a.prev,a))||JS(u,a)&&ds(u.prev,u,u.next)>0&&ds(a.prev,a,a.next)>0)}function ds(u,a,h){return(a.y-u.y)*(h.x-a.x)-(a.x-u.x)*(h.y-a.y)}function JS(u,a){return u.x===a.x&&u.y===a.y}function GF(u,a,h,A){var x=eT(ds(u,a,h)),E=eT(ds(u,a,A)),P=eT(ds(h,A,u)),D=eT(ds(h,A,a));return x!==E&&P!==D||!(x!==0||!tT(u,h,a))||!(E!==0||!tT(u,A,a))||!(P!==0||!tT(h,u,A))||!(D!==0||!tT(h,a,A))}function tT(u,a,h){return a.x<=Math.max(u.x,h.x)&&a.x>=Math.min(u.x,h.x)&&a.y<=Math.max(u.y,h.y)&&a.y>=Math.min(u.y,h.y)}function eT(u){return u>0?1:u<0?-1:0}function Gx(u,a){return ds(u.prev,u,u.next)<0?ds(u,a,u.next)>=0&&ds(u,u.prev,a)>=0:ds(u,a,u.prev)<0||ds(u,u.next,a)<0}function WF(u,a){var h=new mC(u.i,u.x,u.y),A=new mC(a.i,a.x,a.y),x=u.next,E=a.prev;return u.next=a,a.prev=u,h.next=x,x.prev=h,A.next=h,h.prev=A,E.next=A,A.prev=E,A}function HF(u,a,h,A){var x=new mC(u,a,h);return A?(x.next=A.next,x.prev=A,A.next.prev=x,A.next=x):(x.prev=x,x.next=x),x}function Wx(u){u.next.prev=u.prev,u.prev.next=u.next,u.prevZ&&(u.prevZ.nextZ=u.nextZ),u.nextZ&&(u.nextZ.prevZ=u.prevZ)}function mC(u,a,h){this.i=u,this.x=a,this.y=h,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function gC(u,a,h,A){for(var x=0,E=a,P=h-A;E0&&h.holes.push(A+=u[x-1].length)}return h};var qF=c(pC.exports);function rK(u,a,h,A,x){ZF(u,a,h||0,A||u.length-1,x||iK)}function ZF(u,a,h,A,x){for(;A>h;){if(A-h>600){var E=A-h+1,P=a-h+1,D=Math.log(E),F=.5*Math.exp(2*D/3),V=.5*Math.sqrt(D*F*(E-F)/E)*(P-E/2<0?-1:1);ZF(u,a,Math.max(h,Math.floor(a-P*F/E+V)),Math.min(A,Math.floor(a+(E-P)*F/E+V)),x)}var q=u[a],X=h,rt=A;for(Hx(u,h,a),x(u[A],q)>0&&Hx(u,h,A);X0;)rt--}x(u[h],q)===0?Hx(u,h,rt):Hx(u,++rt,A),rt<=a&&(h=rt+1),a<=rt&&(A=rt-1)}}function Hx(u,a,h){var A=u[a];u[a]=u[h],u[h]=A}function iK(u,a){return ua?1:0}function _C(u,a){let h=u.length;if(h<=1)return[u];let A=[],x,E;for(let P=0;P1)for(let P=0;Ph.id),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Kr,this.indexArray=new Gs,this.indexArray2=new hs,this.programConfigurations=new Va(a.layers,a.zoom),this.segments=new jr,this.segments2=new jr,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,A){this.hasPattern=yC(\"fill\",this.layers,h);let x=this.layers[0].layout.get(\"fill-sort-key\"),E=!x.isConstant(),P=[];for(let{feature:D,id:F,index:V,sourceLayerIndex:q}of a){let X=this.layers[0]._featureFilter.needGeometry,rt=S(D,X);if(!this.layers[0]._featureFilter.filter(new un(this.zoom),rt,A))continue;let at=E?x.evaluate(rt,{},A,h.availableImages):void 0,ct={id:F,properties:D.properties,type:D.type,sourceLayerIndex:q,index:V,geometry:X?rt.geometry:y(D),patterns:{},sortKey:at};P.push(ct)}E&&P.sort((D,F)=>D.sortKey-F.sortKey);for(let D of P){let{geometry:F,index:V,sourceLayerIndex:q}=D;if(this.hasPattern){let X=vC(\"fill\",this.layers,D,this.zoom,h);this.patternFeatures.push(X)}else this.addFeature(D,F,V,A,{});h.featureIndex.insert(a[V].feature,F,V,q,this.index)}}update(a,h,A){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,A)}addFeatures(a,h,A){for(let x of this.patternFeatures)this.addFeature(x,x.geometry,x.index,h,A)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,qX),this.indexBuffer=a.createIndexBuffer(this.indexArray),this.indexBuffer2=a.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(a),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(a,h,A,x,E){for(let P of _C(h,500)){let D=0;for(let at of P)D+=at.length;let F=this.segments.prepareSegment(D,this.layoutVertexArray,this.indexArray),V=F.vertexLength,q=[],X=[];for(let at of P){if(at.length===0)continue;at!==P[0]&&X.push(q.length/2);let ct=this.segments2.prepareSegment(at.length,this.layoutVertexArray,this.indexArray2),mt=ct.vertexLength;this.layoutVertexArray.emplaceBack(at[0].x,at[0].y),this.indexArray2.emplaceBack(mt+at.length-1,mt),q.push(at[0].x),q.push(at[0].y);for(let bt=1;bt>3}if(x--,A===1||A===2)E+=u.readSVarint(),P+=u.readSVarint(),A===1&&(a&&D.push(a),a=[]),a.push(new uK(E,P));else{if(A!==7)throw new Error(\"unknown command \"+A);a&&a.push(a[0].clone())}}return a&&D.push(a),D},M_.prototype.bbox=function(){var u=this._pbf;u.pos=this._geometry;for(var a=u.readVarint()+u.pos,h=1,A=0,x=0,E=0,P=1/0,D=-1/0,F=1/0,V=-1/0;u.pos>3}if(A--,h===1||h===2)(x+=u.readSVarint())D&&(D=x),(E+=u.readSVarint())V&&(V=E);else if(h!==7)throw new Error(\"unknown command \"+h)}return[P,F,D,V]},M_.prototype.toGeoJSON=function(u,a,h){var A,x,E=this.extent*Math.pow(2,h),P=this.extent*u,D=this.extent*a,F=this.loadGeometry(),V=M_.types[this.type];function q(at){for(var ct=0;ct>3;x=P===1?A.readString():P===2?A.readFloat():P===3?A.readDouble():P===4?A.readVarint64():P===5?A.readVarint():P===6?A.readSVarint():P===7?A.readBoolean():null}return x}(h))}KF.prototype.feature=function(u){if(u<0||u>=this._features.length)throw new Error(\"feature index out of bounds\");this._pbf.pos=this._features[u];var a=this._pbf.readVarint()+this._pbf.pos;return new dK(this._pbf,a,this.extent,this._keys,this._values)};var AK=XF;function mK(u,a,h){if(u===3){var A=new AK(h,h.readVarint()+h.pos);A.length&&(a[A.name]=A)}}uA.VectorTile=function(u,a){this.layers=u.readFields(mK,{},a)},uA.VectorTileFeature=$F,uA.VectorTileLayer=XF;let gK=uA.VectorTileFeature.types,bC=Math.pow(2,13);function qx(u,a,h,A,x,E,P,D){u.emplaceBack(a,h,2*Math.floor(A*bC)+P,x*bC*2,E*bC*2,Math.round(D))}class wC{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(h=>h.id),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new Ee,this.centroidVertexArray=new be,this.indexArray=new Gs,this.programConfigurations=new Va(a.layers,a.zoom),this.segments=new jr,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,A){this.features=[],this.hasPattern=yC(\"fill-extrusion\",this.layers,h);for(let{feature:x,id:E,index:P,sourceLayerIndex:D}of a){let F=this.layers[0]._featureFilter.needGeometry,V=S(x,F);if(!this.layers[0]._featureFilter.filter(new un(this.zoom),V,A))continue;let q={id:E,sourceLayerIndex:D,index:P,geometry:F?V.geometry:y(x),properties:x.properties,type:x.type,patterns:{}};this.hasPattern?this.features.push(vC(\"fill-extrusion\",this.layers,q,this.zoom,h)):this.addFeature(q,q.geometry,P,A,{}),h.featureIndex.insert(x,q.geometry,P,D,this.index,!0)}}addFeatures(a,h,A){for(let x of this.features){let{geometry:E}=x;this.addFeature(x,E,x.index,h,A)}}update(a,h,A){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,A)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,cK),this.centroidVertexBuffer=a.createVertexBuffer(this.centroidVertexArray,lK.members,!0),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(a,h,A,x,E){let P={x:0,y:0,vertexCount:0};for(let D of _C(h,500)){let F=0;for(let ct of D)F+=ct.length;let V=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let ct of D){if(ct.length===0||yK(ct))continue;let mt=0;for(let bt=0;bt=1){let jt=ct[bt-1];if(!_K(Pt,jt)){V.vertexLength+4>jr.MAX_VERTEX_ARRAY_LENGTH&&(V=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let Rt=Pt.sub(jt)._perp()._unit(),Gt=jt.dist(Pt);mt+Gt>32768&&(mt=0),qx(this.layoutVertexArray,Pt.x,Pt.y,Rt.x,Rt.y,0,0,mt),qx(this.layoutVertexArray,Pt.x,Pt.y,Rt.x,Rt.y,0,1,mt),P.x+=2*Pt.x,P.y+=2*Pt.y,P.vertexCount+=2,mt+=Gt,qx(this.layoutVertexArray,jt.x,jt.y,Rt.x,Rt.y,0,0,mt),qx(this.layoutVertexArray,jt.x,jt.y,Rt.x,Rt.y,0,1,mt),P.x+=2*jt.x,P.y+=2*jt.y,P.vertexCount+=2;let Yt=V.vertexLength;this.indexArray.emplaceBack(Yt,Yt+2,Yt+1),this.indexArray.emplaceBack(Yt+1,Yt+2,Yt+3),V.vertexLength+=4,V.primitiveLength+=2}}}}if(V.vertexLength+F>jr.MAX_VERTEX_ARRAY_LENGTH&&(V=this.segments.prepareSegment(F,this.layoutVertexArray,this.indexArray)),gK[a.type]!==\"Polygon\")continue;let q=[],X=[],rt=V.vertexLength;for(let ct of D)if(ct.length!==0){ct!==D[0]&&X.push(q.length/2);for(let mt=0;mten)||u.y===a.y&&(u.y<0||u.y>en)}function yK(u){return u.every(a=>a.x<0)||u.every(a=>a.x>en)||u.every(a=>a.y<0)||u.every(a=>a.y>en)}let JF;Ge(\"FillExtrusionBucket\",wC,{omit:[\"layers\",\"features\"]});var vK={get paint(){return JF=JF||new Hn({\"fill-extrusion-opacity\":new nr(ee[\"paint_fill-extrusion\"][\"fill-extrusion-opacity\"]),\"fill-extrusion-color\":new dr(ee[\"paint_fill-extrusion\"][\"fill-extrusion-color\"]),\"fill-extrusion-translate\":new nr(ee[\"paint_fill-extrusion\"][\"fill-extrusion-translate\"]),\"fill-extrusion-translate-anchor\":new nr(ee[\"paint_fill-extrusion\"][\"fill-extrusion-translate-anchor\"]),\"fill-extrusion-pattern\":new wf(ee[\"paint_fill-extrusion\"][\"fill-extrusion-pattern\"]),\"fill-extrusion-height\":new dr(ee[\"paint_fill-extrusion\"][\"fill-extrusion-height\"]),\"fill-extrusion-base\":new dr(ee[\"paint_fill-extrusion\"][\"fill-extrusion-base\"]),\"fill-extrusion-vertical-gradient\":new nr(ee[\"paint_fill-extrusion\"][\"fill-extrusion-vertical-gradient\"])})}};class xK extends ji{constructor(a){super(a,vK)}createBucket(a){return new wC(a)}queryRadius(){return te(this.paint.get(\"fill-extrusion-translate\"))}is3D(){return!0}queryIntersectsFeature(a,h,A,x,E,P,D,F){let V=_e(a,this.paint.get(\"fill-extrusion-translate\"),this.paint.get(\"fill-extrusion-translate-anchor\"),P.angle,D),q=this.paint.get(\"fill-extrusion-height\").evaluate(h,A),X=this.paint.get(\"fill-extrusion-base\").evaluate(h,A),rt=function(ct,mt,bt,Pt){let jt=[];for(let Rt of ct){let Gt=[Rt.x,Rt.y,0,1];Pi(Gt,Gt,mt),jt.push(new w(Gt[0]/Gt[3],Gt[1]/Gt[3]))}return jt}(V,F),at=function(ct,mt,bt,Pt){let jt=[],Rt=[],Gt=Pt[8]*mt,Yt=Pt[9]*mt,ce=Pt[10]*mt,Ne=Pt[11]*mt,ir=Pt[8]*bt,Fe=Pt[9]*bt,Re=Pt[10]*bt,Me=Pt[11]*bt;for(let Ye of ct){let Ie=[],Ae=[];for(let hr of Ye){let sr=hr.x,ri=hr.y,Tn=Pt[0]*sr+Pt[4]*ri+Pt[12],Rn=Pt[1]*sr+Pt[5]*ri+Pt[13],qs=Pt[2]*sr+Pt[6]*ri+Pt[14],Ql=Pt[3]*sr+Pt[7]*ri+Pt[15],ja=qs+ce,Is=Ql+Ne,Po=Tn+ir,$o=Rn+Fe,Ga=qs+Re,Wa=Ql+Me,Zs=new w((Tn+Gt)/Is,(Rn+Yt)/Is);Zs.z=ja/Is,Ie.push(Zs);let Ys=new w(Po/Wa,$o/Wa);Ys.z=Ga/Wa,Ae.push(Ys)}jt.push(Ie),Rt.push(Ae)}return[jt,Rt]}(x,X,q,F);return function(ct,mt,bt){let Pt=1/0;H(bt,mt)&&(Pt=t6(bt,mt[0]));for(let jt=0;jth.id),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new pr,this.layoutVertexArray2=new tr,this.indexArray=new Gs,this.programConfigurations=new Va(a.layers,a.zoom),this.segments=new jr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,A){this.hasPattern=yC(\"line\",this.layers,h);let x=this.layers[0].layout.get(\"line-sort-key\"),E=!x.isConstant(),P=[];for(let{feature:D,id:F,index:V,sourceLayerIndex:q}of a){let X=this.layers[0]._featureFilter.needGeometry,rt=S(D,X);if(!this.layers[0]._featureFilter.filter(new un(this.zoom),rt,A))continue;let at=E?x.evaluate(rt,{},A):void 0,ct={id:F,properties:D.properties,type:D.type,sourceLayerIndex:q,index:V,geometry:X?rt.geometry:y(D),patterns:{},sortKey:at};P.push(ct)}E&&P.sort((D,F)=>D.sortKey-F.sortKey);for(let D of P){let{geometry:F,index:V,sourceLayerIndex:q}=D;if(this.hasPattern){let X=vC(\"line\",this.layers,D,this.zoom,h);this.patternFeatures.push(X)}else this.addFeature(D,F,V,A,{});h.featureIndex.insert(a[V].feature,F,V,q,this.index)}}update(a,h,A){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,A)}addFeatures(a,h,A){for(let x of this.patternFeatures)this.addFeature(x,x.geometry,x.index,h,A)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=a.createVertexBuffer(this.layoutVertexArray2,TK)),this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,wK),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(a){if(a.properties&&Object.prototype.hasOwnProperty.call(a.properties,\"mapbox_clip_start\")&&Object.prototype.hasOwnProperty.call(a.properties,\"mapbox_clip_end\"))return{start:+a.properties.mapbox_clip_start,end:+a.properties.mapbox_clip_end}}addFeature(a,h,A,x,E){let P=this.layers[0].layout,D=P.get(\"line-join\").evaluate(a,{}),F=P.get(\"line-cap\"),V=P.get(\"line-miter-limit\"),q=P.get(\"line-round-limit\");this.lineClips=this.lineFeatureClips(a);for(let X of h)this.addLine(X,a,D,F,V,q);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,A,E,x)}addLine(a,h,A,x,E,P){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Pt=0;Pt=2&&a[F-1].equals(a[F-2]);)F--;let V=0;for(;V0;if(Ne&&Pt>V){let Me=rt.dist(at);if(Me>2*q){let Ye=rt.sub(rt.sub(at)._mult(q/Me)._round());this.updateDistance(at,Ye),this.addCurrentVertex(Ye,mt,0,0,X),at=Ye}}let Fe=at&&ct,Re=Fe?A:D?\"butt\":x;if(Fe&&Re===\"round\"&&(YtE&&(Re=\"bevel\"),Re===\"bevel\"&&(Yt>2&&(Re=\"flipbevel\"),Yt100)jt=bt.mult(-1);else{let Me=Yt*mt.add(bt).mag()/mt.sub(bt).mag();jt._perp()._mult(Me*(ir?-1:1))}this.addCurrentVertex(rt,jt,0,0,X),this.addCurrentVertex(rt,jt.mult(-1),0,0,X)}else if(Re===\"bevel\"||Re===\"fakeround\"){let Me=-Math.sqrt(Yt*Yt-1),Ye=ir?Me:0,Ie=ir?0:Me;if(at&&this.addCurrentVertex(rt,mt,Ye,Ie,X),Re===\"fakeround\"){let Ae=Math.round(180*ce/Math.PI/20);for(let hr=1;hr2*q){let Ye=rt.add(ct.sub(rt)._mult(q/Me)._round());this.updateDistance(rt,Ye),this.addCurrentVertex(Ye,bt,0,0,X),rt=Ye}}}}addCurrentVertex(a,h,A,x,E,P=!1){let D=h.y*x-h.x,F=-h.y-h.x*x;this.addHalfVertex(a,h.x+h.y*A,h.y-h.x*A,P,!1,A,E),this.addHalfVertex(a,D,F,P,!0,-x,E),this.distance>e6/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(a,h,A,x,E,P))}addHalfVertex({x:a,y:h},A,x,E,P,D,F){let V=.5*(this.lineClips?this.scaledDistance*(e6-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((a<<1)+(E?1:0),(h<<1)+(P?1:0),Math.round(63*A)+128,Math.round(63*x)+128,1+(D===0?0:D<0?-1:1)|(63&V)<<2,V>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let q=F.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,q),F.primitiveLength++),P?this.e2=q:this.e1=q}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(a,h){this.distance+=a.dist(h),this.updateScaledDistance()}}let r6,i6;Ge(\"LineBucket\",SC,{omit:[\"layers\",\"patternFeatures\"]});var n6={get paint(){return i6=i6||new Hn({\"line-opacity\":new dr(ee.paint_line[\"line-opacity\"]),\"line-color\":new dr(ee.paint_line[\"line-color\"]),\"line-translate\":new nr(ee.paint_line[\"line-translate\"]),\"line-translate-anchor\":new nr(ee.paint_line[\"line-translate-anchor\"]),\"line-width\":new dr(ee.paint_line[\"line-width\"]),\"line-gap-width\":new dr(ee.paint_line[\"line-gap-width\"]),\"line-offset\":new dr(ee.paint_line[\"line-offset\"]),\"line-blur\":new dr(ee.paint_line[\"line-blur\"]),\"line-dasharray\":new aA(ee.paint_line[\"line-dasharray\"]),\"line-pattern\":new wf(ee.paint_line[\"line-pattern\"]),\"line-gradient\":new Bd(ee.paint_line[\"line-gradient\"])})},get layout(){return r6=r6||new Hn({\"line-cap\":new nr(ee.layout_line[\"line-cap\"]),\"line-join\":new dr(ee.layout_line[\"line-join\"]),\"line-miter-limit\":new nr(ee.layout_line[\"line-miter-limit\"]),\"line-round-limit\":new nr(ee.layout_line[\"line-round-limit\"]),\"line-sort-key\":new dr(ee.layout_line[\"line-sort-key\"])})}};class PK extends dr{possiblyEvaluate(a,h){return h=new un(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(a,h)}evaluate(a,h,A,x){return h=kt({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(a,h,A,x)}}let rT;class IK extends ji{constructor(a){super(a,n6),this.gradientVersion=0,rT||(rT=new PK(n6.paint.properties[\"line-width\"].specification),rT.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(a){if(a===\"line-gradient\"){let h=this.gradientExpression();this.stepInterpolant=!!function(A){return A._styleExpression!==void 0}(h)&&h._styleExpression.expression instanceof sh,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values[\"line-gradient\"].value.expression}recalculate(a,h){super.recalculate(a,h),this.paint._values[\"line-floorwidth\"]=rT.possiblyEvaluate(this._transitioningPaint._values[\"line-width\"].value,a)}createBucket(a){return new SC(a)}queryRadius(a){let h=a,A=s6(We(\"line-width\",this,h),We(\"line-gap-width\",this,h)),x=We(\"line-offset\",this,h);return A/2+Math.abs(x)+te(this.paint.get(\"line-translate\"))}queryIntersectsFeature(a,h,A,x,E,P,D){let F=_e(a,this.paint.get(\"line-translate\"),this.paint.get(\"line-translate-anchor\"),P.angle,D),V=D/2*s6(this.paint.get(\"line-width\").evaluate(h,A),this.paint.get(\"line-gap-width\").evaluate(h,A)),q=this.paint.get(\"line-offset\").evaluate(h,A);return q&&(x=function(X,rt){let at=[];for(let ct=0;ct=3){for(let bt=0;bt0?a+2*u:u}let CK=wn([{name:\"a_pos_offset\",components:4,type:\"Int16\"},{name:\"a_data\",components:4,type:\"Uint16\"},{name:\"a_pixeloffset\",components:4,type:\"Int16\"}],4),LK=wn([{name:\"a_projected_pos\",components:3,type:\"Float32\"}],4);wn([{name:\"a_fade_opacity\",components:1,type:\"Uint32\"}],4);let kK=wn([{name:\"a_placed\",components:2,type:\"Uint8\"},{name:\"a_shift\",components:2,type:\"Float32\"}]);wn([{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\"}]);let o6=wn([{name:\"a_pos\",components:2,type:\"Int16\"},{name:\"a_anchor_pos\",components:2,type:\"Int16\"},{name:\"a_extrude\",components:2,type:\"Int16\"}],4),RK=wn([{name:\"a_pos\",components:2,type:\"Float32\"},{name:\"a_radius\",components:1,type:\"Float32\"},{name:\"a_flags\",components:2,type:\"Int16\"}],4);function DK(u,a,h){return u.sections.forEach(A=>{A.text=function(x,E,P){let D=E.layout.get(\"text-transform\").evaluate(P,{});return D===\"uppercase\"?x=x.toLocaleUpperCase():D===\"lowercase\"&&(x=x.toLocaleLowerCase()),ua.applyArabicShaping&&(x=ua.applyArabicShaping(x)),x}(A.text,a,h)}),u}wn([{name:\"triangle\",components:3,type:\"Uint16\"}]),wn([{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\"}]),wn([{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\"}]),wn([{type:\"Float32\",name:\"offsetX\"}]),wn([{type:\"Int16\",name:\"x\"},{type:\"Int16\",name:\"y\"},{type:\"Int16\",name:\"tileUnitDistanceFromAnchor\"}]),wn([{type:\"Uint16\",name:\"textAnchor\"},{type:\"Float32\",components:2,name:\"textOffset\"}]);let Yx={\"!\":\"\\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\",\"\\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\"};var Hs=24,a6=rn,l6=function(u,a,h,A,x){var E,P,D=8*x-A-1,F=(1<>1,q=-7,X=h?x-1:0,rt=h?-1:1,at=u[a+X];for(X+=rt,E=at&(1<<-q)-1,at>>=-q,q+=D;q>0;E=256*E+u[a+X],X+=rt,q-=8);for(P=E&(1<<-q)-1,E>>=-q,q+=A;q>0;P=256*P+u[a+X],X+=rt,q-=8);if(E===0)E=1-V;else{if(E===F)return P?NaN:1/0*(at?-1:1);P+=Math.pow(2,A),E-=V}return(at?-1:1)*P*Math.pow(2,E-A)},c6=function(u,a,h,A,x,E){var P,D,F,V=8*E-x-1,q=(1<>1,rt=x===23?Math.pow(2,-24)-Math.pow(2,-77):0,at=A?0:E-1,ct=A?1:-1,mt=a<0||a===0&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(D=isNaN(a)?1:0,P=q):(P=Math.floor(Math.log(a)/Math.LN2),a*(F=Math.pow(2,-P))<1&&(P--,F*=2),(a+=P+X>=1?rt/F:rt*Math.pow(2,1-X))*F>=2&&(P++,F/=2),P+X>=q?(D=0,P=q):P+X>=1?(D=(a*F-1)*Math.pow(2,x),P+=X):(D=a*Math.pow(2,X-1)*Math.pow(2,x),P=0));x>=8;u[h+at]=255&D,at+=ct,D/=256,x-=8);for(P=P<0;u[h+at]=255&P,at+=ct,P/=256,V-=8);u[h+at-ct]|=128*mt};function rn(u){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(u)?u:new Uint8Array(u||0),this.pos=0,this.type=0,this.length=this.buf.length}rn.Varint=0,rn.Fixed64=1,rn.Bytes=2,rn.Fixed32=5;var TC=4294967296,u6=1/TC,h6=typeof TextDecoder>\"u\"?null:new TextDecoder(\"utf8\");function Nd(u){return u.type===rn.Bytes?u.readVarint()+u.pos:u.pos+1}function E_(u,a,h){return h?4294967296*a+(u>>>0):4294967296*(a>>>0)+(u>>>0)}function f6(u,a,h){var A=a<=16383?1:a<=2097151?2:a<=268435455?3:Math.floor(Math.log(a)/(7*Math.LN2));h.realloc(A);for(var x=h.pos-1;x>=u;x--)h.buf[x+A]=h.buf[x]}function OK(u,a){for(var h=0;h>>8,u[h+2]=a>>>16,u[h+3]=a>>>24}function d6(u,a){return(u[a]|u[a+1]<<8|u[a+2]<<16)+(u[a+3]<<24)}rn.prototype={destroy:function(){this.buf=null},readFields:function(u,a,h){for(h=h||this.length;this.pos>3,E=this.pos;this.type=7&A,u(x,a,this),this.pos===E&&this.skip(A)}return a},readMessage:function(u,a){return this.readFields(u,a,this.readVarint()+this.pos)},readFixed32:function(){var u=iT(this.buf,this.pos);return this.pos+=4,u},readSFixed32:function(){var u=d6(this.buf,this.pos);return this.pos+=4,u},readFixed64:function(){var u=iT(this.buf,this.pos)+iT(this.buf,this.pos+4)*TC;return this.pos+=8,u},readSFixed64:function(){var u=iT(this.buf,this.pos)+d6(this.buf,this.pos+4)*TC;return this.pos+=8,u},readFloat:function(){var u=l6(this.buf,this.pos,!0,23,4);return this.pos+=4,u},readDouble:function(){var u=l6(this.buf,this.pos,!0,52,8);return this.pos+=8,u},readVarint:function(u){var a,h,A=this.buf;return a=127&(h=A[this.pos++]),h<128?a:(a|=(127&(h=A[this.pos++]))<<7,h<128?a:(a|=(127&(h=A[this.pos++]))<<14,h<128?a:(a|=(127&(h=A[this.pos++]))<<21,h<128?a:function(x,E,P){var D,F,V=P.buf;if(D=(112&(F=V[P.pos++]))>>4,F<128||(D|=(127&(F=V[P.pos++]))<<3,F<128)||(D|=(127&(F=V[P.pos++]))<<10,F<128)||(D|=(127&(F=V[P.pos++]))<<17,F<128)||(D|=(127&(F=V[P.pos++]))<<24,F<128)||(D|=(1&(F=V[P.pos++]))<<31,F<128))return E_(x,D,E);throw new Error(\"Expected varint not more than 10 bytes\")}(a|=(15&(h=A[this.pos]))<<28,u,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var u=this.readVarint();return u%2==1?(u+1)/-2:u/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var u=this.readVarint()+this.pos,a=this.pos;return this.pos=u,u-a>=12&&h6?function(h,A,x){return h6.decode(h.subarray(A,x))}(this.buf,a,u):function(h,A,x){for(var E=\"\",P=A;P239?4:q>223?3:q>191?2:1;if(P+rt>x)break;rt===1?q<128&&(X=q):rt===2?(192&(D=h[P+1]))==128&&(X=(31&q)<<6|63&D)<=127&&(X=null):rt===3?(F=h[P+2],(192&(D=h[P+1]))==128&&(192&F)==128&&((X=(15&q)<<12|(63&D)<<6|63&F)<=2047||X>=55296&&X<=57343)&&(X=null)):rt===4&&(F=h[P+2],V=h[P+3],(192&(D=h[P+1]))==128&&(192&F)==128&&(192&V)==128&&((X=(15&q)<<18|(63&D)<<12|(63&F)<<6|63&V)<=65535||X>=1114112)&&(X=null)),X===null?(X=65533,rt=1):X>65535&&(X-=65536,E+=String.fromCharCode(X>>>10&1023|55296),X=56320|1023&X),E+=String.fromCharCode(X),P+=rt}return E}(this.buf,a,u)},readBytes:function(){var u=this.readVarint()+this.pos,a=this.buf.subarray(this.pos,u);return this.pos=u,a},readPackedVarint:function(u,a){if(this.type!==rn.Bytes)return u.push(this.readVarint(a));var h=Nd(this);for(u=u||[];this.pos127;);else if(a===rn.Bytes)this.pos=this.readVarint()+this.pos;else if(a===rn.Fixed32)this.pos+=4;else{if(a!==rn.Fixed64)throw new Error(\"Unimplemented type: \"+a);this.pos+=8}},writeTag:function(u,a){this.writeVarint(u<<3|a)},realloc:function(u){for(var a=this.length||16;a268435455||u<0?function(a,h){var A,x;if(a>=0?(A=a%4294967296|0,x=a/4294967296|0):(x=~(-a/4294967296),4294967295^(A=~(-a%4294967296))?A=A+1|0:(A=0,x=x+1|0)),a>=18446744073709552e3||a<-18446744073709552e3)throw new Error(\"Given varint doesn't fit into 10 bytes\");h.realloc(10),function(E,P,D){D.buf[D.pos++]=127&E|128,E>>>=7,D.buf[D.pos++]=127&E|128,E>>>=7,D.buf[D.pos++]=127&E|128,E>>>=7,D.buf[D.pos++]=127&E|128,D.buf[D.pos]=127&(E>>>=7)}(A,0,h),function(E,P){var D=(7&E)<<4;P.buf[P.pos++]|=D|((E>>>=3)?128:0),E&&(P.buf[P.pos++]=127&E|((E>>>=7)?128:0),E&&(P.buf[P.pos++]=127&E|((E>>>=7)?128:0),E&&(P.buf[P.pos++]=127&E|((E>>>=7)?128:0),E&&(P.buf[P.pos++]=127&E|((E>>>=7)?128:0),E&&(P.buf[P.pos++]=127&E)))))}(x,h)}(u,this):(this.realloc(4),this.buf[this.pos++]=127&u|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=u>>>7&127))))},writeSVarint:function(u){this.writeVarint(u<0?2*-u-1:2*u)},writeBoolean:function(u){this.writeVarint(!!u)},writeString:function(u){u=String(u),this.realloc(4*u.length),this.pos++;var a=this.pos;this.pos=function(A,x,E){for(var P,D,F=0;F55295&&P<57344){if(!D){P>56319||F+1===x.length?(A[E++]=239,A[E++]=191,A[E++]=189):D=P;continue}if(P<56320){A[E++]=239,A[E++]=191,A[E++]=189,D=P;continue}P=D-55296<<10|P-56320|65536,D=null}else D&&(A[E++]=239,A[E++]=191,A[E++]=189,D=null);P<128?A[E++]=P:(P<2048?A[E++]=P>>6|192:(P<65536?A[E++]=P>>12|224:(A[E++]=P>>18|240,A[E++]=P>>12&63|128),A[E++]=P>>6&63|128),A[E++]=63&P|128)}return E}(this.buf,u,this.pos);var h=this.pos-a;h>=128&&f6(a,h,this),this.pos=a-1,this.writeVarint(h),this.pos+=h},writeFloat:function(u){this.realloc(4),c6(this.buf,u,this.pos,!0,23,4),this.pos+=4},writeDouble:function(u){this.realloc(8),c6(this.buf,u,this.pos,!0,52,8),this.pos+=8},writeBytes:function(u){var a=u.length;this.writeVarint(a),this.realloc(a);for(var h=0;h=128&&f6(h,A,this),this.pos=h-1,this.writeVarint(A),this.pos+=A},writeMessage:function(u,a,h){this.writeTag(u,rn.Bytes),this.writeRawMessage(a,h)},writePackedVarint:function(u,a){a.length&&this.writeMessage(u,OK,a)},writePackedSVarint:function(u,a){a.length&&this.writeMessage(u,BK,a)},writePackedBoolean:function(u,a){a.length&&this.writeMessage(u,NK,a)},writePackedFloat:function(u,a){a.length&&this.writeMessage(u,FK,a)},writePackedDouble:function(u,a){a.length&&this.writeMessage(u,zK,a)},writePackedFixed32:function(u,a){a.length&&this.writeMessage(u,UK,a)},writePackedSFixed32:function(u,a){a.length&&this.writeMessage(u,VK,a)},writePackedFixed64:function(u,a){a.length&&this.writeMessage(u,jK,a)},writePackedSFixed64:function(u,a){a.length&&this.writeMessage(u,GK,a)},writeBytesField:function(u,a){this.writeTag(u,rn.Bytes),this.writeBytes(a)},writeFixed32Field:function(u,a){this.writeTag(u,rn.Fixed32),this.writeFixed32(a)},writeSFixed32Field:function(u,a){this.writeTag(u,rn.Fixed32),this.writeSFixed32(a)},writeFixed64Field:function(u,a){this.writeTag(u,rn.Fixed64),this.writeFixed64(a)},writeSFixed64Field:function(u,a){this.writeTag(u,rn.Fixed64),this.writeSFixed64(a)},writeVarintField:function(u,a){this.writeTag(u,rn.Varint),this.writeVarint(a)},writeSVarintField:function(u,a){this.writeTag(u,rn.Varint),this.writeSVarint(a)},writeStringField:function(u,a){this.writeTag(u,rn.Bytes),this.writeString(a)},writeFloatField:function(u,a){this.writeTag(u,rn.Fixed32),this.writeFloat(a)},writeDoubleField:function(u,a){this.writeTag(u,rn.Fixed64),this.writeDouble(a)},writeBooleanField:function(u,a){this.writeVarintField(u,!!a)}};var MC=c(a6);let EC=3;function WK(u,a,h){u===1&&h.readMessage(HK,a)}function HK(u,a,h){if(u===3){let{id:A,bitmap:x,width:E,height:P,left:D,top:F,advance:V}=h.readMessage(qK,{});a.push({id:A,bitmap:new Vx({width:E+2*EC,height:P+2*EC},x),metrics:{width:E,height:P,left:D,top:F,advance:V}})}}function qK(u,a,h){u===1?a.id=h.readVarint():u===2?a.bitmap=h.readBytes():u===3?a.width=h.readVarint():u===4?a.height=h.readVarint():u===5?a.left=h.readSVarint():u===6?a.top=h.readSVarint():u===7&&(a.advance=h.readVarint())}let p6=EC;function A6(u){let a=0,h=0;for(let P of u)a+=P.w*P.h,h=Math.max(h,P.w);u.sort((P,D)=>D.h-P.h);let A=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(a/.95)),h),h:1/0}],x=0,E=0;for(let P of u)for(let D=A.length-1;D>=0;D--){let F=A[D];if(!(P.w>F.w||P.h>F.h)){if(P.x=F.x,P.y=F.y,E=Math.max(E,P.y+P.h),x=Math.max(x,P.x+P.w),P.w===F.w&&P.h===F.h){let V=A.pop();D=0&&A>=a&&sT[this.text.charCodeAt(A)];A--)h--;this.text=this.text.substring(a,h),this.sectionIndex=this.sectionIndex.slice(a,h)}substring(a,h){let A=new I_;return A.text=this.text.substring(a,h),A.sectionIndex=this.sectionIndex.slice(a,h),A.sections=this.sections,A}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((a,h)=>Math.max(a,this.sections[h].scale),0)}addTextSection(a,h){this.text+=a.text,this.sections.push($x.forText(a.scale,a.fontStack||h));let A=this.sections.length-1;for(let x=0;x=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function nT(u,a,h,A,x,E,P,D,F,V,q,X,rt,at,ct,mt){let bt=I_.fromFeature(u,x),Pt;X===n.ai.vertical&&bt.verticalizePunctuation();let{processBidirectionalText:jt,processStyledBidirectionalText:Rt}=ua;if(jt&&bt.sections.length===1){Pt=[];let ce=jt(bt.toString(),IC(bt,V,E,a,A,at,ct));for(let Ne of ce){let ir=new I_;ir.text=Ne,ir.sections=bt.sections;for(let Fe=0;Fe0&&Vd>_l&&(_l=Vd)}else{let Uc=ir[di.fontStack],vl=Uc&&Uc[Xo];if(vl&&vl.rect)vh=vl.rect,xu=vl.metrics;else{let Vd=Ne[di.fontStack],e1=Vd&&Vd[Xo];if(!e1)continue;xu=e1.metrics}$s=(Ys-di.scale)*Hs}bu?(ce.verticalizable=!0,fa.push({glyph:Xo,imageName:xh,x:Tn,y:Rn+$s,vertical:bu,scale:di.scale,fontStack:di.fontStack,sectionIndex:da,metrics:xu,rect:vh}),Tn+=Ud*di.scale+hr):(fa.push({glyph:Xo,imageName:xh,x:Tn,y:Rn+$s,vertical:bu,scale:di.scale,fontStack:di.fontStack,sectionIndex:da,metrics:xu,rect:vh}),Tn+=xu.advance*di.scale+hr)}fa.length!==0&&(qs=Math.max(Tn-hr,qs),QK(fa,0,fa.length-1,ja,_l)),Tn=0;let yl=Me*Ys+_l;Ha.lineOffset=Math.max(_l,ha),Rn+=yl,Ql=Math.max(yl,Ql),++Is}var Po;let $o=Rn-Qx,{horizontalAlign:Ga,verticalAlign:Wa}=CC(Ye);(function(Zs,Ys,ha,Ha,fa,_l,yl,Qs,di){let da=(Ys-ha)*fa,Xo=0;Xo=_l!==yl?-Qs*Ha-Qx:(-Ha*di+.5)*yl;for(let $s of Zs)for(let xu of $s.positionedGlyphs)xu.x+=da,xu.y+=Xo})(ce.positionedLines,ja,Ga,Wa,qs,Ql,Me,$o,Re.length),ce.top+=-Wa*$o,ce.bottom=ce.top+$o,ce.left+=-Ga*qs,ce.right=ce.left+qs}(Yt,a,h,A,Pt,P,D,F,X,V,rt,mt),!function(ce){for(let Ne of ce)if(Ne.positionedGlyphs.length!==0)return!1;return!0}(Gt)&&Yt}let sT={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ZK={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function g6(u,a,h,A,x,E){if(a.imageName){let P=A[a.imageName];return P?P.displaySize[0]*a.scale*Hs/E+x:0}{let P=h[a.fontStack],D=P&&P[u];return D?D.metrics.advance*a.scale+x:0}}function _6(u,a,h,A){let x=Math.pow(u-a,2);return A?u=0,q=0;for(let rt=0;rtP.id),this.index=a.index,this.pixelRatio=a.pixelRatio,this.sourceLayerIndex=a.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Zr([]),this.placementViewportMatrix=Zr([]);let h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=b6(this.zoom,h[\"text-size\"]),this.iconSizeData=b6(this.zoom,h[\"icon-size\"]);let A=this.layers[0].layout,x=A.get(\"symbol-sort-key\"),E=A.get(\"symbol-z-order\");this.canOverlap=LC(A,\"text-overlap\",\"text-allow-overlap\")!==\"never\"||LC(A,\"icon-overlap\",\"icon-allow-overlap\")!==\"never\"||A.get(\"text-ignore-placement\")||A.get(\"icon-ignore-placement\"),this.sortFeaturesByKey=E!==\"viewport-y\"&&!x.isConstant(),this.sortFeaturesByY=(E===\"viewport-y\"||E===\"auto\"&&!this.sortFeaturesByKey)&&this.canOverlap,A.get(\"symbol-placement\")===\"point\"&&(this.writingModes=A.get(\"text-writing-mode\").map(P=>n.ai[P])),this.stateDependentLayerIds=this.layers.filter(P=>P.isStateDependent()).map(P=>P.id),this.sourceID=a.sourceID}createArrays(){this.text=new RC(new Va(this.layers,this.zoom,a=>/^text/.test(a))),this.icon=new RC(new Va(this.layers,this.zoom,a=>/^icon/.test(a))),this.glyphOffsetArray=new Bt,this.lineVertexArray=new Qt,this.symbolInstances=new St,this.textAnchorOffsets=new oe}calculateGlyphDependencies(a,h,A,x,E){for(let P=0;P0)&&(P.value.kind!==\"constant\"||P.value.value.length>0),q=F.value.kind!==\"constant\"||!!F.value.value||Object.keys(F.parameters).length>0,X=E.get(\"symbol-sort-key\");if(this.features=[],!V&&!q)return;let rt=h.iconDependencies,at=h.glyphDependencies,ct=h.availableImages,mt=new un(this.zoom);for(let{feature:bt,id:Pt,index:jt,sourceLayerIndex:Rt}of a){let Gt=x._featureFilter.needGeometry,Yt=S(bt,Gt);if(!x._featureFilter.filter(mt,Yt,A))continue;let ce,Ne;if(Gt||(Yt.geometry=y(bt)),V){let Fe=x.getValueAndResolveTokens(\"text-field\",Yt,A,ct),Re=ln.factory(Fe);JK(Re)&&(this.hasRTLText=!0),(!this.hasRTLText||f0()===\"unavailable\"||this.hasRTLText&&ua.isParsed())&&(ce=DK(Re,x,Yt))}if(q){let Fe=x.getValueAndResolveTokens(\"icon-image\",Yt,A,ct);Ne=Fe instanceof Gn?Fe:Gn.fromString(Fe)}if(!ce&&!Ne)continue;let ir=this.sortFeaturesByKey?X.evaluate(Yt,{},A):void 0;if(this.features.push({id:Pt,text:ce,icon:Ne,index:jt,sourceLayerIndex:Rt,geometry:Yt.geometry,properties:bt.properties,type:XK[bt.type],sortKey:ir}),Ne&&(rt[Ne.name]=!0),ce){let Fe=P.evaluate(Yt,{},A).join(\",\"),Re=E.get(\"text-rotation-alignment\")!==\"viewport\"&&E.get(\"symbol-placement\")!==\"point\";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(n.ai.vertical)>=0;for(let Me of ce.sections)if(Me.image)rt[Me.image.name]=!0;else{let Ye=o0(ce.toString()),Ie=Me.fontStack||Fe,Ae=at[Ie]=at[Ie]||{};this.calculateGlyphDependencies(Me.text,Ae,Re,this.allowVerticalPlacement,Ye)}}}E.get(\"symbol-placement\")===\"line\"&&(this.features=function(bt){let Pt={},jt={},Rt=[],Gt=0;function Yt(Fe){Rt.push(bt[Fe]),Gt++}function ce(Fe,Re,Me){let Ye=jt[Fe];return delete jt[Fe],jt[Re]=Ye,Rt[Ye].geometry[0].pop(),Rt[Ye].geometry[0]=Rt[Ye].geometry[0].concat(Me[0]),Ye}function Ne(Fe,Re,Me){let Ye=Pt[Re];return delete Pt[Re],Pt[Fe]=Ye,Rt[Ye].geometry[0].shift(),Rt[Ye].geometry[0]=Me[0].concat(Rt[Ye].geometry[0]),Ye}function ir(Fe,Re,Me){let Ye=Me?Re[0][Re[0].length-1]:Re[0][0];return`${Fe}:${Ye.x}:${Ye.y}`}for(let Fe=0;FeFe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((bt,Pt)=>bt.sortKey-Pt.sortKey)}update(a,h,A){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(a,h,this.layers,A),this.icon.programConfigurations.updatePaintArrays(a,h,this.layers,A))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(a){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(a),this.iconCollisionBox.upload(a)),this.text.upload(a,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(a,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(a,h){let A=this.lineVertexArray.length;if(a.segment!==void 0){let x=a.dist(h[a.segment+1]),E=a.dist(h[a.segment]),P={};for(let D=a.segment+1;D=0;D--)P[D]={x:h[D].x,y:h[D].y,tileUnitDistanceFromAnchor:E},D>0&&(E+=h[D-1].dist(h[D]));for(let D=0;D0}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(a,h){let A=a.placedSymbolArray.get(h),x=A.vertexStartIndex+4*A.numGlyphs;for(let E=A.vertexStartIndex;Ex[D]-x[F]||E[F]-E[D]),P}addToSortKeyRanges(a,h){let A=this.sortKeyRanges[this.sortKeyRanges.length-1];A&&A.sortKey===h?A.symbolInstanceEnd=a+1:this.sortKeyRanges.push({sortKey:h,symbolInstanceStart:a,symbolInstanceEnd:a+1})}sortFeatures(a){if(this.sortFeaturesByY&&this.sortedAngle!==a&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(a),this.sortedAngle=a,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let h of this.symbolInstanceIndexes){let A=this.symbolInstances.get(h);this.featureSortOrder.push(A.featureIndex),[A.rightJustifiedTextSymbolIndex,A.centerJustifiedTextSymbolIndex,A.leftJustifiedTextSymbolIndex].forEach((x,E,P)=>{x>=0&&P.indexOf(x)===E&&this.addIndicesForPlacedSymbol(this.text,x)}),A.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,A.verticalPlacedTextSymbolIndex),A.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,A.placedIconSymbolIndex),A.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,A.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let w6,S6;Ge(\"SymbolBucket\",C_,{omit:[\"layers\",\"collisionBoxArray\",\"features\",\"compareText\"]}),C_.MAX_GLYPHS=65535,C_.addDynamicAttributes=kC;var OC={get paint(){return S6=S6||new Hn({\"icon-opacity\":new dr(ee.paint_symbol[\"icon-opacity\"]),\"icon-color\":new dr(ee.paint_symbol[\"icon-color\"]),\"icon-halo-color\":new dr(ee.paint_symbol[\"icon-halo-color\"]),\"icon-halo-width\":new dr(ee.paint_symbol[\"icon-halo-width\"]),\"icon-halo-blur\":new dr(ee.paint_symbol[\"icon-halo-blur\"]),\"icon-translate\":new nr(ee.paint_symbol[\"icon-translate\"]),\"icon-translate-anchor\":new nr(ee.paint_symbol[\"icon-translate-anchor\"]),\"text-opacity\":new dr(ee.paint_symbol[\"text-opacity\"]),\"text-color\":new dr(ee.paint_symbol[\"text-color\"],{runtimeType:Us,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),\"text-halo-color\":new dr(ee.paint_symbol[\"text-halo-color\"]),\"text-halo-width\":new dr(ee.paint_symbol[\"text-halo-width\"]),\"text-halo-blur\":new dr(ee.paint_symbol[\"text-halo-blur\"]),\"text-translate\":new nr(ee.paint_symbol[\"text-translate\"]),\"text-translate-anchor\":new nr(ee.paint_symbol[\"text-translate-anchor\"])})},get layout(){return w6=w6||new Hn({\"symbol-placement\":new nr(ee.layout_symbol[\"symbol-placement\"]),\"symbol-spacing\":new nr(ee.layout_symbol[\"symbol-spacing\"]),\"symbol-avoid-edges\":new nr(ee.layout_symbol[\"symbol-avoid-edges\"]),\"symbol-sort-key\":new dr(ee.layout_symbol[\"symbol-sort-key\"]),\"symbol-z-order\":new nr(ee.layout_symbol[\"symbol-z-order\"]),\"icon-allow-overlap\":new nr(ee.layout_symbol[\"icon-allow-overlap\"]),\"icon-overlap\":new nr(ee.layout_symbol[\"icon-overlap\"]),\"icon-ignore-placement\":new nr(ee.layout_symbol[\"icon-ignore-placement\"]),\"icon-optional\":new nr(ee.layout_symbol[\"icon-optional\"]),\"icon-rotation-alignment\":new nr(ee.layout_symbol[\"icon-rotation-alignment\"]),\"icon-size\":new dr(ee.layout_symbol[\"icon-size\"]),\"icon-text-fit\":new nr(ee.layout_symbol[\"icon-text-fit\"]),\"icon-text-fit-padding\":new nr(ee.layout_symbol[\"icon-text-fit-padding\"]),\"icon-image\":new dr(ee.layout_symbol[\"icon-image\"]),\"icon-rotate\":new dr(ee.layout_symbol[\"icon-rotate\"]),\"icon-padding\":new dr(ee.layout_symbol[\"icon-padding\"]),\"icon-keep-upright\":new nr(ee.layout_symbol[\"icon-keep-upright\"]),\"icon-offset\":new dr(ee.layout_symbol[\"icon-offset\"]),\"icon-anchor\":new dr(ee.layout_symbol[\"icon-anchor\"]),\"icon-pitch-alignment\":new nr(ee.layout_symbol[\"icon-pitch-alignment\"]),\"text-pitch-alignment\":new nr(ee.layout_symbol[\"text-pitch-alignment\"]),\"text-rotation-alignment\":new nr(ee.layout_symbol[\"text-rotation-alignment\"]),\"text-field\":new dr(ee.layout_symbol[\"text-field\"]),\"text-font\":new dr(ee.layout_symbol[\"text-font\"]),\"text-size\":new dr(ee.layout_symbol[\"text-size\"]),\"text-max-width\":new dr(ee.layout_symbol[\"text-max-width\"]),\"text-line-height\":new nr(ee.layout_symbol[\"text-line-height\"]),\"text-letter-spacing\":new dr(ee.layout_symbol[\"text-letter-spacing\"]),\"text-justify\":new dr(ee.layout_symbol[\"text-justify\"]),\"text-radial-offset\":new dr(ee.layout_symbol[\"text-radial-offset\"]),\"text-variable-anchor\":new nr(ee.layout_symbol[\"text-variable-anchor\"]),\"text-variable-anchor-offset\":new dr(ee.layout_symbol[\"text-variable-anchor-offset\"]),\"text-anchor\":new dr(ee.layout_symbol[\"text-anchor\"]),\"text-max-angle\":new nr(ee.layout_symbol[\"text-max-angle\"]),\"text-writing-mode\":new nr(ee.layout_symbol[\"text-writing-mode\"]),\"text-rotate\":new dr(ee.layout_symbol[\"text-rotate\"]),\"text-padding\":new nr(ee.layout_symbol[\"text-padding\"]),\"text-keep-upright\":new nr(ee.layout_symbol[\"text-keep-upright\"]),\"text-transform\":new dr(ee.layout_symbol[\"text-transform\"]),\"text-offset\":new dr(ee.layout_symbol[\"text-offset\"]),\"text-allow-overlap\":new nr(ee.layout_symbol[\"text-allow-overlap\"]),\"text-overlap\":new nr(ee.layout_symbol[\"text-overlap\"]),\"text-ignore-placement\":new nr(ee.layout_symbol[\"text-ignore-placement\"]),\"text-optional\":new nr(ee.layout_symbol[\"text-optional\"])})}};class T6{constructor(a){if(a.property.overrides===void 0)throw new Error(\"overrides must be provided to instantiate FormatSectionOverride class\");this.type=a.property.overrides?a.property.overrides.runtimeType:Ca,this.defaultValue=a}evaluate(a){if(a.formattedSection){let h=this.defaultValue.property.overrides;if(h&&h.hasOverride(a.formattedSection))return h.getOverride(a.formattedSection)}return a.feature&&a.featureState?this.defaultValue.evaluate(a.feature,a.featureState):this.defaultValue.property.specification.default}eachChild(a){this.defaultValue.isConstant()||a(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ge(\"FormatSectionOverride\",T6,{omit:[\"defaultValue\"]});class aT extends ji{constructor(a){super(a,OC)}recalculate(a,h){if(super.recalculate(a,h),this.layout.get(\"icon-rotation-alignment\")===\"auto\"&&(this.layout._values[\"icon-rotation-alignment\"]=this.layout.get(\"symbol-placement\")!==\"point\"?\"map\":\"viewport\"),this.layout.get(\"text-rotation-alignment\")===\"auto\"&&(this.layout._values[\"text-rotation-alignment\"]=this.layout.get(\"symbol-placement\")!==\"point\"?\"map\":\"viewport\"),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\")),this.layout.get(\"symbol-placement\")===\"point\"){let A=this.layout.get(\"text-writing-mode\");if(A){let x=[];for(let E of A)x.indexOf(E)<0&&x.push(E);this.layout._values[\"text-writing-mode\"]=x}else this.layout._values[\"text-writing-mode\"]=[\"horizontal\"]}this._setPaintOverrides()}getValueAndResolveTokens(a,h,A,x){let E=this.layout.get(a).evaluate(h,{},A,x),P=this._unevaluatedLayout._values[a];return P.isDataDriven()||Yp(P.value)||!E?E:function(D,F){return F.replace(/{([^{}]+)}/g,(V,q)=>D&&q in D?String(D[q]):\"\")}(h.properties,E)}createBucket(a){return new C_(a)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error(\"Should take a different path in FeatureIndex\")}_setPaintOverrides(){for(let a of OC.paint.overridableProperties){if(!aT.hasPaintOverride(this.layout,a))continue;let h=this.paint.get(a),A=new T6(h),x=new Jm(A,h.property.specification),E=null;E=h.value.kind===\"constant\"||h.value.kind===\"source\"?new t0(\"source\",x):new wt(\"composite\",x,h.value.zoomStops),this.paint._values[a]=new Mo(h.property,E,h.parameters)}}_handleOverridablePaintPropertyUpdate(a,h,A){return!(!this.layout||h.isDataDriven()||A.isDataDriven())&&aT.hasPaintOverride(this.layout,a)}static hasPaintOverride(a,h){let A=a.get(\"text-field\"),x=OC.paint.properties[h],E=!1,P=D=>{for(let F of D)if(x.overrides&&x.overrides.hasOverride(F))return void(E=!0)};if(A.value.kind===\"constant\"&&A.value.value instanceof ln)P(A.value.value.sections);else if(A.value.kind===\"source\"){let D=V=>{E||(V instanceof Gl&&Ki(V.value)===gt?P(V.value.sections):V instanceof Ti?P(V.sections):V.eachChild(D))},F=A.value;F._styleExpression&&D(F._styleExpression.expression)}return E}}let M6;var tJ={get paint(){return M6=M6||new Hn({\"background-color\":new nr(ee.paint_background[\"background-color\"]),\"background-pattern\":new aA(ee.paint_background[\"background-pattern\"]),\"background-opacity\":new nr(ee.paint_background[\"background-opacity\"])})}};class eJ extends ji{constructor(a){super(a,tJ)}}let E6;var rJ={get paint(){return E6=E6||new Hn({\"raster-opacity\":new nr(ee.paint_raster[\"raster-opacity\"]),\"raster-hue-rotate\":new nr(ee.paint_raster[\"raster-hue-rotate\"]),\"raster-brightness-min\":new nr(ee.paint_raster[\"raster-brightness-min\"]),\"raster-brightness-max\":new nr(ee.paint_raster[\"raster-brightness-max\"]),\"raster-saturation\":new nr(ee.paint_raster[\"raster-saturation\"]),\"raster-contrast\":new nr(ee.paint_raster[\"raster-contrast\"]),\"raster-resampling\":new nr(ee.paint_raster[\"raster-resampling\"]),\"raster-fade-duration\":new nr(ee.paint_raster[\"raster-fade-duration\"])})}};class iJ extends ji{constructor(a){super(a,rJ)}}class nJ extends ji{constructor(a){super(a,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.painter.context.gl)},this.implementation=a}is3D(){return this.implementation.renderingMode===\"3d\"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error(\"Custom layers cannot be serialized\")}}class sJ{constructor(a){this._callback=a,this._triggered=!1,typeof MessageChannel<\"u\"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}let BC=63710088e-1;class dA{constructor(a,h){if(isNaN(a)||isNaN(h))throw new Error(`Invalid LngLat object: (${a}, ${h})`);if(this.lng=+a,this.lat=+h,this.lat>90||this.lat<-90)throw new Error(\"Invalid LngLat latitude value: must be between -90 and 90\")}wrap(){return new dA(Et(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(a){let h=Math.PI/180,A=this.lat*h,x=a.lat*h,E=Math.sin(A)*Math.sin(x)+Math.cos(A)*Math.cos(x)*Math.cos((a.lng-this.lng)*h);return BC*Math.acos(Math.min(E,1))}static convert(a){if(a instanceof dA)return a;if(Array.isArray(a)&&(a.length===2||a.length===3))return new dA(Number(a[0]),Number(a[1]));if(!Array.isArray(a)&&typeof a==\"object\"&&a!==null)return new dA(Number(\"lng\"in a?a.lng:a.lon),Number(a.lat));throw new Error(\"`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]\")}}let P6=2*Math.PI*BC;function I6(u){return P6*Math.cos(u*Math.PI/180)}function C6(u){return(180+u)/360}function L6(u){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u*Math.PI/360)))/360}function k6(u,a){return u/I6(a)}function R6(u){return 360*u-180}function FC(u){return 360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90}class lT{constructor(a,h,A=0){this.x=+a,this.y=+h,this.z=+A}static fromLngLat(a,h=0){let A=dA.convert(a);return new lT(C6(A.lng),L6(A.lat),k6(h,A.lat))}toLngLat(){return new dA(R6(this.x),FC(this.y))}toAltitude(){return this.z*I6(FC(this.y))}meterInMercatorCoordinateUnits(){return 1/P6*(a=FC(this.y),1/Math.cos(a*Math.PI/180));var a}}function D6(u,a,h){var A=2*Math.PI*6378137/256/Math.pow(2,h);return[u*A-2*Math.PI*6378137/2,a*A-2*Math.PI*6378137/2]}class zC{constructor(a,h,A){if(a<0||a>25||A<0||A>=Math.pow(2,a)||h<0||h>=Math.pow(2,a))throw new Error(`x=${h}, y=${A}, z=${a} outside of bounds. 0<=x<${Math.pow(2,a)}, 0<=y<${Math.pow(2,a)} 0<=z<=25 `);this.z=a,this.x=h,this.y=A,this.key=Kx(0,a,a,h,A)}equals(a){return this.z===a.z&&this.x===a.x&&this.y===a.y}url(a,h,A){let x=(P=this.y,D=this.z,F=D6(256*(E=this.x),256*(P=Math.pow(2,D)-P-1),D),V=D6(256*(E+1),256*(P+1),D),F[0]+\",\"+F[1]+\",\"+V[0]+\",\"+V[1]);var E,P,D,F,V;let q=function(X,rt,at){let ct,mt=\"\";for(let bt=X;bt>0;bt--)ct=1<1?\"@2x\":\"\").replace(/{quadkey}/g,q).replace(/{bbox-epsg-3857}/g,x)}isChildOf(a){let h=this.z-a.z;return h>0&&a.x===this.x>>h&&a.y===this.y>>h}getTilePoint(a){let h=Math.pow(2,this.z);return new w((a.x*h-this.x)*en,(a.y*h-this.y)*en)}toString(){return`${this.z}/${this.x}/${this.y}`}}class O6{constructor(a,h){this.wrap=a,this.canonical=h,this.key=Kx(a,h.z,h.z,h.x,h.y)}}class Nc{constructor(a,h,A,x,E){if(a= z; overscaledZ = ${a}; z = ${A}`);this.overscaledZ=a,this.wrap=h,this.canonical=new zC(A,+x,+E),this.key=Kx(h,a,A,x,E)}clone(){return new Nc(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(a){return this.overscaledZ===a.overscaledZ&&this.wrap===a.wrap&&this.canonical.equals(a.canonical)}scaledTo(a){if(a>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${a}; overscaledZ = ${this.overscaledZ}`);let h=this.canonical.z-a;return a>this.canonical.z?new Nc(a,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Nc(a,this.wrap,a,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(a,h){if(a>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${a}; overscaledZ = ${this.overscaledZ}`);let A=this.canonical.z-a;return a>this.canonical.z?Kx(this.wrap*+h,a,this.canonical.z,this.canonical.x,this.canonical.y):Kx(this.wrap*+h,a,a,this.canonical.x>>A,this.canonical.y>>A)}isChildOf(a){if(a.wrap!==this.wrap)return!1;let h=this.canonical.z-a.canonical.z;return a.overscaledZ===0||a.overscaledZ>h&&a.canonical.y===this.canonical.y>>h}children(a){if(this.overscaledZ>=a)return[new Nc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let h=this.canonical.z+1,A=2*this.canonical.x,x=2*this.canonical.y;return[new Nc(h,this.wrap,h,A,x),new Nc(h,this.wrap,h,A+1,x),new Nc(h,this.wrap,h,A,x+1),new Nc(h,this.wrap,h,A+1,x+1)]}isLessThan(a){return this.wrapa.wrap)&&(this.overscaledZa.overscaledZ)&&(this.canonical.xa.canonical.x)&&this.canonical.ythis.max&&(this.max=X),X=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError(\"out of range source coordinates for DEM data\");return(h+1)*this.stride+(a+1)}unpack(a,h,A){return a*this.redFactor+h*this.greenFactor+A*this.blueFactor-this.baseShift}getPixels(){return new zc({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(a,h,A){if(this.dim!==a.dim)throw new Error(\"dem dimension mismatch\");let x=h*this.dim,E=h*this.dim+this.dim,P=A*this.dim,D=A*this.dim+this.dim;switch(h){case-1:x=E-1;break;case 1:E=x+1}switch(A){case-1:P=D-1;break;case 1:D=P+1}let F=-h*this.dim,V=-A*this.dim;for(let q=P;q=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${a} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[a]}}class z6{constructor(a,h,A,x,E){this.type=\"Feature\",this._vectorTileFeature=a,a._z=h,a._x=A,a._y=x,this.properties=a.properties,this.id=E}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(a){this._geometry=a}toJSON(){let a={geometry:this.geometry};for(let h in this)h!==\"_geometry\"&&h!==\"_vectorTileFeature\"&&(a[h]=this[h]);return a}}class N6{constructor(a,h){this.tileID=a,this.x=a.canonical.x,this.y=a.canonical.y,this.z=a.canonical.z,this.grid=new Na(en,16,0),this.grid3D=new Na(en,16,0),this.featureIndexArray=new he,this.promoteId=h}insert(a,h,A,x,E,P){let D=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(A,x,E);let F=P?this.grid3D:this.grid;for(let V=0;V=0&&X[3]>=0&&F.insert(D,X[0],X[1],X[2],X[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new uA.VectorTile(new MC(this.rawTileData)).layers,this.sourceLayerCoder=new F6(this.vtLayers?Object.keys(this.vtLayers).sort():[\"_geojsonTileLayer\"])),this.vtLayers}query(a,h,A,x){this.loadVTLayers();let E=a.params||{},P=en/a.tileSize/a.scale,D=r0(E.filter),F=a.queryGeometry,V=a.queryPadding*P,q=V6(F),X=this.grid.query(q.minX-V,q.minY-V,q.maxX+V,q.maxY+V),rt=V6(a.cameraQueryGeometry),at=this.grid3D.query(rt.minX-V,rt.minY-V,rt.maxX+V,rt.maxY+V,(bt,Pt,jt,Rt)=>function(Gt,Yt,ce,Ne,ir){for(let Re of Gt)if(Yt<=Re.x&&ce<=Re.y&&Ne>=Re.x&&ir>=Re.y)return!0;let Fe=[new w(Yt,ce),new w(Yt,ir),new w(Ne,ir),new w(Ne,ce)];if(Gt.length>2){for(let Re of Fe)if(ne(Gt,Re))return!0}for(let Re=0;Re(Rt||(Rt=y(Gt)),Yt.queryIntersectsFeature(F,Gt,ce,Rt,this.z,a.transform,P,a.pixelPosMatrix)))}return ct}loadMatchingFeature(a,h,A,x,E,P,D,F,V,q,X){let rt=this.bucketLayerIDs[h];if(P&&!function(bt,Pt){for(let jt=0;jt=0)return!0;return!1}(P,rt))return;let at=this.sourceLayerCoder.decode(A),ct=this.vtLayers[at].feature(x);if(E.needGeometry){let bt=S(ct,!0);if(!E.filter(new un(this.tileID.overscaledZ),bt,this.tileID.canonical))return}else if(!E.filter(new un(this.tileID.overscaledZ),ct))return;let mt=this.getId(ct,at);for(let bt=0;bt{let D=a instanceof oA?a.get(P):null;return D&&D.evaluate?D.evaluate(h,A,x):D})}function V6(u){let a=1/0,h=1/0,A=-1/0,x=-1/0;for(let E of u)a=Math.min(a,E.x),h=Math.min(h,E.y),A=Math.max(A,E.x),x=Math.max(x,E.y);return{minX:a,minY:h,maxX:A,maxY:x}}function oJ(u,a){return a-u}function j6(u,a,h,A,x){let E=[];for(let P=0;P=A&&X.x>=A||(q.x>=A?q=new w(A,q.y+(A-q.x)/(X.x-q.x)*(X.y-q.y))._round():X.x>=A&&(X=new w(A,q.y+(A-q.x)/(X.x-q.x)*(X.y-q.y))._round()),q.y>=x&&X.y>=x||(q.y>=x?q=new w(q.x+(x-q.y)/(X.y-q.y)*(X.x-q.x),x)._round():X.y>=x&&(X=new w(q.x+(x-q.y)/(X.y-q.y)*(X.x-q.x),x)._round()),F&&q.equals(F[F.length-1])||(F=[q],E.push(F)),F.push(X)))))}}return E}Ge(\"FeatureIndex\",N6,{omit:[\"rawTileData\",\"sourceLayerCoder\"]});class pA extends w{constructor(a,h,A,x){super(a,h),this.angle=A,x!==void 0&&(this.segment=x)}clone(){return new pA(this.x,this.y,this.angle,this.segment)}}function G6(u,a,h,A,x){if(a.segment===void 0||h===0)return!0;let E=a,P=a.segment+1,D=0;for(;D>-h/2;){if(P--,P<0)return!1;D-=u[P].dist(E),E=u[P]}D+=u[P].dist(u[P+1]),P++;let F=[],V=0;for(;DA;)V-=F.shift().angleDelta;if(V>x)return!1;P++,D+=q.dist(X)}return!0}function W6(u){let a=0;for(let h=0;hV){let ct=(V-F)/at,mt=Da.number(X.x,rt.x,ct),bt=Da.number(X.y,rt.y,ct),Pt=new pA(mt,bt,rt.angleTo(X),q);return Pt._round(),!P||G6(u,Pt,D,P,a)?Pt:void 0}F+=at}}function lJ(u,a,h,A,x,E,P,D,F){let V=H6(A,E,P),q=q6(A,x),X=q*P,rt=u[0].x===0||u[0].x===F||u[0].y===0||u[0].y===F;return a-X=0&&Gt=0&&Yt=0&&rt+V<=q){let ce=new pA(Gt,Yt,jt,ct);ce._round(),A&&!G6(u,ce,E,A,x)||at.push(ce)}}X+=Pt}return D||at.length||P||(at=Z6(u,X/2,h,A,x,E,P,!0,F)),at}Ge(\"Anchor\",pA);let L_=gl;function Y6(u,a,h,A){let x=[],E=u.image,P=E.pixelRatio,D=E.paddedRect.w-2*L_,F=E.paddedRect.h-2*L_,V=u.right-u.left,q=u.bottom-u.top,X=E.stretchX||[[0,D]],rt=E.stretchY||[[0,F]],at=(Me,Ye)=>Me+Ye[1]-Ye[0],ct=X.reduce(at,0),mt=rt.reduce(at,0),bt=D-ct,Pt=F-mt,jt=0,Rt=ct,Gt=0,Yt=mt,ce=0,Ne=bt,ir=0,Fe=Pt;if(E.content&&A){let Me=E.content;jt=cT(X,0,Me[0]),Gt=cT(rt,0,Me[1]),Rt=cT(X,Me[0],Me[2]),Yt=cT(rt,Me[1],Me[3]),ce=Me[0]-jt,ir=Me[1]-Gt,Ne=Me[2]-Me[0]-Rt,Fe=Me[3]-Me[1]-Yt}let Re=(Me,Ye,Ie,Ae)=>{let hr=uT(Me.stretch-jt,Rt,V,u.left),sr=hT(Me.fixed-ce,Ne,Me.stretch,ct),ri=uT(Ye.stretch-Gt,Yt,q,u.top),Tn=hT(Ye.fixed-ir,Fe,Ye.stretch,mt),Rn=uT(Ie.stretch-jt,Rt,V,u.left),qs=hT(Ie.fixed-ce,Ne,Ie.stretch,ct),Ql=uT(Ae.stretch-Gt,Yt,q,u.top),ja=hT(Ae.fixed-ir,Fe,Ae.stretch,mt),Is=new w(hr,ri),Po=new w(Rn,ri),$o=new w(Rn,Ql),Ga=new w(hr,Ql),Wa=new w(sr/P,Tn/P),Zs=new w(qs/P,ja/P),Ys=a*Math.PI/180;if(Ys){let fa=Math.sin(Ys),_l=Math.cos(Ys),yl=[_l,-fa,fa,_l];Is._matMult(yl),Po._matMult(yl),Ga._matMult(yl),$o._matMult(yl)}let ha=Me.stretch+Me.fixed,Ha=Ye.stretch+Ye.fixed;return{tl:Is,tr:Po,bl:Ga,br:$o,tex:{x:E.paddedRect.x+L_+ha,y:E.paddedRect.y+L_+Ha,w:Ie.stretch+Ie.fixed-ha,h:Ae.stretch+Ae.fixed-Ha},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Wa,pixelOffsetBR:Zs,minFontScaleX:Ne/P/V,minFontScaleY:Fe/P/q,isSDF:h}};if(A&&(E.stretchX||E.stretchY)){let Me=Q6(X,bt,ct),Ye=Q6(rt,Pt,mt);for(let Ie=0;Ie0&&(ct=Math.max(10,ct),this.circleDiameter=ct)}else{let X=P.top*D-F[0],rt=P.bottom*D+F[2],at=P.left*D-F[3],ct=P.right*D+F[1],mt=P.collisionPadding;if(mt&&(at-=mt[0]*D,X-=mt[1]*D,ct+=mt[2]*D,rt+=mt[3]*D),q){let bt=new w(at,X),Pt=new w(ct,X),jt=new w(at,rt),Rt=new w(ct,rt),Gt=q*Math.PI/180;bt._rotate(Gt),Pt._rotate(Gt),jt._rotate(Gt),Rt._rotate(Gt),at=Math.min(bt.x,Pt.x,jt.x,Rt.x),ct=Math.max(bt.x,Pt.x,jt.x,Rt.x),X=Math.min(bt.y,Pt.y,jt.y,Rt.y),rt=Math.max(bt.y,Pt.y,jt.y,Rt.y)}a.emplaceBack(h.x,h.y,at,X,ct,rt,A,x,E)}this.boxEndIndex=a.length}}class cJ{constructor(a=[],h=uJ){if(this.data=a,this.length=this.data.length,this.compare=h,this.length>0)for(let A=(this.length>>1)-1;A>=0;A--)this._down(A)}push(a){this.data.push(a),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let a=this.data[0],h=this.data.pop();return this.length--,this.length>0&&(this.data[0]=h,this._down(0)),a}peek(){return this.data[0]}_up(a){let{data:h,compare:A}=this,x=h[a];for(;a>0;){let E=a-1>>1,P=h[E];if(A(x,P)>=0)break;h[a]=P,a=E}h[a]=x}_down(a){let{data:h,compare:A}=this,x=this.length>>1,E=h[a];for(;a=0)break;h[a]=D,a=P}h[a]=E}}function uJ(u,a){return ua?1:0}function hJ(u,a=1,h=!1){let A=1/0,x=1/0,E=-1/0,P=-1/0,D=u[0];for(let at=0;atE)&&(E=ct.x),(!at||ct.y>P)&&(P=ct.y)}let F=Math.min(E-A,P-x),V=F/2,q=new cJ([],fJ);if(F===0)return new w(A,x);for(let at=A;atX.d||!X.d)&&(X=at,h&&console.log(\"found best %d after %d probes\",Math.round(1e4*at.d)/1e4,rt)),at.max-X.d<=a||(V=at.h/2,q.push(new k_(at.p.x-V,at.p.y-V,V,u)),q.push(new k_(at.p.x+V,at.p.y-V,V,u)),q.push(new k_(at.p.x-V,at.p.y+V,V,u)),q.push(new k_(at.p.x+V,at.p.y+V,V,u)),rt+=4)}return h&&(console.log(`num probes: ${rt}`),console.log(`best distance: ${X.d}`)),X.p}function fJ(u,a){return a.max-u.max}function k_(u,a,h,A){this.p=new w(u,a),this.h=h,this.d=function(x,E){let P=!1,D=1/0;for(let F=0;Fx.y!=ct.y>x.y&&x.x<(ct.x-at.x)*(x.y-at.y)/(ct.y-at.y)+at.x&&(P=!P),D=Math.min(D,Wt(x,at,ct))}}return(P?1:-1)*Math.sqrt(D)}(this.p,A),this.max=this.d+this.h*Math.SQRT2}var Qo;n.aq=void 0,(Qo=n.aq||(n.aq={}))[Qo.center=1]=\"center\",Qo[Qo.left=2]=\"left\",Qo[Qo.right=3]=\"right\",Qo[Qo.top=4]=\"top\",Qo[Qo.bottom=5]=\"bottom\",Qo[Qo[\"top-left\"]=6]=\"top-left\",Qo[Qo[\"top-right\"]=7]=\"top-right\",Qo[Qo[\"bottom-left\"]=8]=\"bottom-left\",Qo[Qo[\"bottom-right\"]=9]=\"bottom-right\";let AA=7,NC=Number.POSITIVE_INFINITY;function $6(u,a){return a[1]!==NC?function(h,A,x){let E=0,P=0;switch(A=Math.abs(A),x=Math.abs(x),h){case\"top-right\":case\"top-left\":case\"top\":P=x-AA;break;case\"bottom-right\":case\"bottom-left\":case\"bottom\":P=-x+AA}switch(h){case\"top-right\":case\"bottom-right\":case\"right\":E=-A;break;case\"top-left\":case\"bottom-left\":case\"left\":E=A}return[E,P]}(u,a[0],a[1]):function(h,A){let x=0,E=0;A<0&&(A=0);let P=A/Math.SQRT2;switch(h){case\"top-right\":case\"top-left\":E=P-AA;break;case\"bottom-right\":case\"bottom-left\":E=-P+AA;break;case\"bottom\":E=-A+AA;break;case\"top\":E=A-AA}switch(h){case\"top-right\":case\"bottom-right\":x=-P;break;case\"top-left\":case\"bottom-left\":x=P;break;case\"left\":x=A;break;case\"right\":x=-A}return[x,E]}(u,a[0])}function X6(u,a,h){var A;let x=u.layout,E=(A=x.get(\"text-variable-anchor-offset\"))===null||A===void 0?void 0:A.evaluate(a,{},h);if(E){let D=E.values,F=[];for(let V=0;Vrt*Hs);q.startsWith(\"top\")?X[1]-=AA:q.startsWith(\"bottom\")&&(X[1]+=AA),F[V+1]=X}return new Go(F)}let P=x.get(\"text-variable-anchor\");if(P){let D;D=u._unevaluatedLayout.getValue(\"text-radial-offset\")!==void 0?[x.get(\"text-radial-offset\").evaluate(a,{},h)*Hs,NC]:x.get(\"text-offset\").evaluate(a,{},h).map(V=>V*Hs);let F=[];for(let V of P)F.push(V,$6(V,D));return new Go(F)}return null}function UC(u){switch(u){case\"right\":case\"top-right\":case\"bottom-right\":return\"right\";case\"left\":case\"top-left\":case\"bottom-left\":return\"left\"}return\"center\"}function dJ(u,a,h,A,x,E,P,D,F,V,q){let X=E.textMaxSize.evaluate(a,{});X===void 0&&(X=P);let rt=u.layers[0].layout,at=rt.get(\"icon-offset\").evaluate(a,{},q),ct=J6(h.horizontal),mt=P/24,bt=u.tilePixelRatio*mt,Pt=u.tilePixelRatio*X/24,jt=u.tilePixelRatio*D,Rt=u.tilePixelRatio*rt.get(\"symbol-spacing\"),Gt=rt.get(\"text-padding\")*u.tilePixelRatio,Yt=function(Ae,hr,sr,ri=1){let Tn=Ae.get(\"icon-padding\").evaluate(hr,{},sr),Rn=Tn&&Tn.values;return[Rn[0]*ri,Rn[1]*ri,Rn[2]*ri,Rn[3]*ri]}(rt,a,q,u.tilePixelRatio),ce=rt.get(\"text-max-angle\")/180*Math.PI,Ne=rt.get(\"text-rotation-alignment\")!==\"viewport\"&&rt.get(\"symbol-placement\")!==\"point\",ir=rt.get(\"icon-rotation-alignment\")===\"map\"&&rt.get(\"symbol-placement\")!==\"point\",Fe=rt.get(\"symbol-placement\"),Re=Rt/2,Me=rt.get(\"icon-text-fit\"),Ye;A&&Me!==\"none\"&&(u.allowVerticalPlacement&&h.vertical&&(Ye=x6(A,h.vertical,Me,rt.get(\"icon-text-fit-padding\"),at,mt)),ct&&(A=x6(A,ct,Me,rt.get(\"icon-text-fit-padding\"),at,mt)));let Ie=(Ae,hr)=>{hr.x<0||hr.x>=en||hr.y<0||hr.y>=en||function(sr,ri,Tn,Rn,qs,Ql,ja,Is,Po,$o,Ga,Wa,Zs,Ys,ha,Ha,fa,_l,yl,Qs,di,da,Xo,$s,xu){let vh=sr.addToLineVertexArray(ri,Tn),xh,Ud,bu,Uc,vl=0,Vd=0,e1=0,iz=0,YC=-1,QC=-1,jd={},nz=yh(\"\");if(sr.allowVerticalPlacement&&Rn.vertical){let pa=Is.layout.get(\"text-rotate\").evaluate(di,{},$s)+90;bu=new fT(Po,ri,$o,Ga,Wa,Rn.vertical,Zs,Ys,ha,pa),ja&&(Uc=new fT(Po,ri,$o,Ga,Wa,ja,fa,_l,ha,pa))}if(qs){let pa=Is.layout.get(\"icon-rotate\").evaluate(di,{}),Vc=Is.layout.get(\"icon-text-fit\")!==\"none\",m0=Y6(qs,pa,Xo,Vc),wh=ja?Y6(ja,pa,Xo,Vc):void 0;Ud=new fT(Po,ri,$o,Ga,Wa,qs,fa,_l,!1,pa),vl=4*m0.length;let g0=sr.iconSizeData,Pf=null;g0.kind===\"source\"?(Pf=[Ef*Is.layout.get(\"icon-size\").evaluate(di,{})],Pf[0]>fA&&Ke(`${sr.layerIds[0]}: Value for \"icon-size\" is >= ${Xx}. Reduce your \"icon-size\".`)):g0.kind===\"composite\"&&(Pf=[Ef*da.compositeIconSizes[0].evaluate(di,{},$s),Ef*da.compositeIconSizes[1].evaluate(di,{},$s)],(Pf[0]>fA||Pf[1]>fA)&&Ke(`${sr.layerIds[0]}: Value for \"icon-size\" is >= ${Xx}. Reduce your \"icon-size\".`)),sr.addSymbols(sr.icon,m0,Pf,Qs,yl,di,n.ai.none,ri,vh.lineStartIndex,vh.lineLength,-1,$s),YC=sr.icon.placedSymbolArray.length-1,wh&&(Vd=4*wh.length,sr.addSymbols(sr.icon,wh,Pf,Qs,yl,di,n.ai.vertical,ri,vh.lineStartIndex,vh.lineLength,-1,$s),QC=sr.icon.placedSymbolArray.length-1)}let sz=Object.keys(Rn.horizontal);for(let pa of sz){let Vc=Rn.horizontal[pa];if(!xh){nz=yh(Vc.text);let wh=Is.layout.get(\"text-rotate\").evaluate(di,{},$s);xh=new fT(Po,ri,$o,Ga,Wa,Vc,Zs,Ys,ha,wh)}let m0=Vc.positionedLines.length===1;if(e1+=K6(sr,ri,Vc,Ql,Is,ha,di,Ha,vh,Rn.vertical?n.ai.horizontal:n.ai.horizontalOnly,m0?sz:[pa],jd,YC,da,$s),m0)break}Rn.vertical&&(iz+=K6(sr,ri,Rn.vertical,Ql,Is,ha,di,Ha,vh,n.ai.vertical,[\"vertical\"],jd,QC,da,$s));let mJ=xh?xh.boxStartIndex:sr.collisionBoxArray.length,gJ=xh?xh.boxEndIndex:sr.collisionBoxArray.length,_J=bu?bu.boxStartIndex:sr.collisionBoxArray.length,yJ=bu?bu.boxEndIndex:sr.collisionBoxArray.length,vJ=Ud?Ud.boxStartIndex:sr.collisionBoxArray.length,xJ=Ud?Ud.boxEndIndex:sr.collisionBoxArray.length,bJ=Uc?Uc.boxStartIndex:sr.collisionBoxArray.length,wJ=Uc?Uc.boxEndIndex:sr.collisionBoxArray.length,bh=-1,pT=(pa,Vc)=>pa&&pa.circleDiameter?Math.max(pa.circleDiameter,Vc):Vc;bh=pT(xh,bh),bh=pT(bu,bh),bh=pT(Ud,bh),bh=pT(Uc,bh);let oz=bh>-1?1:0;oz&&(bh*=xu/Hs),sr.glyphOffsetArray.length>=C_.MAX_GLYPHS&&Ke(\"Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907\"),di.sortKey!==void 0&&sr.addToSortKeyRanges(sr.symbolInstances.length,di.sortKey);let SJ=X6(Is,di,$s),[TJ,MJ]=function(pa,Vc){let m0=pa.length,wh=Vc?.values;if(wh?.length>0)for(let g0=0;g0=0?jd.right:-1,jd.center>=0?jd.center:-1,jd.left>=0?jd.left:-1,jd.vertical||-1,YC,QC,nz,mJ,gJ,_J,yJ,vJ,xJ,bJ,wJ,$o,e1,iz,vl,Vd,oz,0,Zs,bh,TJ,MJ)}(u,hr,Ae,h,A,x,Ye,u.layers[0],u.collisionBoxArray,a.index,a.sourceLayerIndex,u.index,bt,[Gt,Gt,Gt,Gt],Ne,F,jt,Yt,ir,at,a,E,V,q,P)};if(Fe===\"line\")for(let Ae of j6(a.geometry,0,0,en,en)){let hr=lJ(Ae,Rt,ce,h.vertical||ct,A,24,Pt,u.overscaling,en);for(let sr of hr)ct&&pJ(u,ct.text,Re,sr)||Ie(Ae,sr)}else if(Fe===\"line-center\"){for(let Ae of a.geometry)if(Ae.length>1){let hr=aJ(Ae,ce,h.vertical||ct,A,24,Pt);hr&&Ie(Ae,hr)}}else if(a.type===\"Polygon\")for(let Ae of _C(a.geometry,0)){let hr=hJ(Ae,16);Ie(Ae[0],new pA(hr.x,hr.y,0))}else if(a.type===\"LineString\")for(let Ae of a.geometry)Ie(Ae,new pA(Ae[0].x,Ae[0].y,0));else if(a.type===\"Point\")for(let Ae of a.geometry)for(let hr of Ae)Ie([hr],new pA(hr.x,hr.y,0))}function K6(u,a,h,A,x,E,P,D,F,V,q,X,rt,at,ct){let mt=function(jt,Rt,Gt,Yt,ce,Ne,ir,Fe){let Re=Yt.layout.get(\"text-rotate\").evaluate(Ne,{})*Math.PI/180,Me=[];for(let Ye of Rt.positionedLines)for(let Ie of Ye.positionedGlyphs){if(!Ie.rect)continue;let Ae=Ie.rect||{},hr=p6+1,sr=!0,ri=1,Tn=0,Rn=(ce||Fe)&&Ie.vertical,qs=Ie.metrics.advance*Ie.scale/2;if(Fe&&Rt.verticalizable&&(Tn=Ye.lineOffset/2-(Ie.imageName?-(Hs-Ie.metrics.width*Ie.scale)/2:(Ie.scale-1)*Hs)),Ie.imageName){let Qs=ir[Ie.imageName];sr=Qs.sdf,ri=Qs.pixelRatio,hr=gl/ri}let Ql=ce?[Ie.x+qs,Ie.y]:[0,0],ja=ce?[0,0]:[Ie.x+qs+Gt[0],Ie.y+Gt[1]-Tn],Is=[0,0];Rn&&(Is=ja,ja=[0,0]);let Po=Ie.metrics.isDoubleResolution?2:1,$o=(Ie.metrics.left-hr)*Ie.scale-qs+ja[0],Ga=(-Ie.metrics.top-hr)*Ie.scale+ja[1],Wa=$o+Ae.w/Po*Ie.scale/ri,Zs=Ga+Ae.h/Po*Ie.scale/ri,Ys=new w($o,Ga),ha=new w(Wa,Ga),Ha=new w($o,Zs),fa=new w(Wa,Zs);if(Rn){let Qs=new w(-qs,qs-Qx),di=-Math.PI/2,da=Hs/2-qs,Xo=new w(5-Qx-da,-(Ie.imageName?da:0)),$s=new w(...Is);Ys._rotateAround(di,Qs)._add(Xo)._add($s),ha._rotateAround(di,Qs)._add(Xo)._add($s),Ha._rotateAround(di,Qs)._add(Xo)._add($s),fa._rotateAround(di,Qs)._add(Xo)._add($s)}if(Re){let Qs=Math.sin(Re),di=Math.cos(Re),da=[di,-Qs,Qs,di];Ys._matMult(da),ha._matMult(da),Ha._matMult(da),fa._matMult(da)}let _l=new w(0,0),yl=new w(0,0);Me.push({tl:Ys,tr:ha,bl:Ha,br:fa,tex:Ae,writingMode:Rt.writingMode,glyphOffset:Ql,sectionIndex:Ie.sectionIndex,isSDF:sr,pixelOffsetTL:_l,pixelOffsetBR:yl,minFontScaleX:0,minFontScaleY:0})}return Me}(0,h,D,x,E,P,A,u.allowVerticalPlacement),bt=u.textSizeData,Pt=null;bt.kind===\"source\"?(Pt=[Ef*x.layout.get(\"text-size\").evaluate(P,{})],Pt[0]>fA&&Ke(`${u.layerIds[0]}: Value for \"text-size\" is >= ${Xx}. Reduce your \"text-size\".`)):bt.kind===\"composite\"&&(Pt=[Ef*at.compositeTextSizes[0].evaluate(P,{},ct),Ef*at.compositeTextSizes[1].evaluate(P,{},ct)],(Pt[0]>fA||Pt[1]>fA)&&Ke(`${u.layerIds[0]}: Value for \"text-size\" is >= ${Xx}. Reduce your \"text-size\".`)),u.addSymbols(u.text,mt,Pt,D,E,P,V,a,F.lineStartIndex,F.lineLength,rt,ct);for(let jt of q)X[jt]=u.text.placedSymbolArray.length-1;return 4*mt.length}function J6(u){for(let a in u)return u[a];return null}function pJ(u,a,h,A){let x=u.compareText;if(a in x){let E=x[a];for(let P=E.length-1;P>=0;P--)if(A.dist(E[P])>4;if(x!==1)throw new Error(`Got v${x} data when expected v1.`);let E=tz[15&A];if(!E)throw new Error(\"Unrecognized array type.\");let[P]=new Uint16Array(a,2,1),[D]=new Uint32Array(a,4,1);return new VC(D,P,E,a)}constructor(a,h=64,A=Float64Array,x){if(isNaN(a)||a<0)throw new Error(`Unpexpected numItems value: ${a}.`);this.numItems=+a,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=A,this.IndexArrayType=a<65536?Uint16Array:Uint32Array;let E=tz.indexOf(this.ArrayType),P=2*a*this.ArrayType.BYTES_PER_ELEMENT,D=a*this.IndexArrayType.BYTES_PER_ELEMENT,F=(8-D%8)%8;if(E<0)throw new Error(`Unexpected typed array class: ${A}.`);x&&x instanceof ArrayBuffer?(this.data=x,this.ids=new this.IndexArrayType(this.data,8,a),this.coords=new this.ArrayType(this.data,8+D+F,2*a),this._pos=2*a,this._finished=!0):(this.data=new ArrayBuffer(8+P+D+F),this.ids=new this.IndexArrayType(this.data,8,a),this.coords=new this.ArrayType(this.data,8+D+F,2*a),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+E]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=a)}add(a,h){let A=this._pos>>1;return this.ids[A]=A,this.coords[this._pos++]=a,this.coords[this._pos++]=h,A}finish(){let a=this._pos>>1;if(a!==this.numItems)throw new Error(`Added ${a} items when expected ${this.numItems}.`);return jC(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(a,h,A,x){if(!this._finished)throw new Error(\"Data not yet indexed - call index.finish().\");let{ids:E,coords:P,nodeSize:D}=this,F=[0,E.length-1,0],V=[];for(;F.length;){let q=F.pop()||0,X=F.pop()||0,rt=F.pop()||0;if(X-rt<=D){for(let bt=rt;bt<=X;bt++){let Pt=P[2*bt],jt=P[2*bt+1];Pt>=a&&Pt<=A&&jt>=h&&jt<=x&&V.push(E[bt])}continue}let at=rt+X>>1,ct=P[2*at],mt=P[2*at+1];ct>=a&&ct<=A&&mt>=h&&mt<=x&&V.push(E[at]),(q===0?a<=ct:h<=mt)&&(F.push(rt),F.push(at-1),F.push(1-q)),(q===0?A>=ct:x>=mt)&&(F.push(at+1),F.push(X),F.push(1-q))}return V}within(a,h,A){if(!this._finished)throw new Error(\"Data not yet indexed - call index.finish().\");let{ids:x,coords:E,nodeSize:P}=this,D=[0,x.length-1,0],F=[],V=A*A;for(;D.length;){let q=D.pop()||0,X=D.pop()||0,rt=D.pop()||0;if(X-rt<=P){for(let bt=rt;bt<=X;bt++)rz(E[2*bt],E[2*bt+1],a,h)<=V&&F.push(x[bt]);continue}let at=rt+X>>1,ct=E[2*at],mt=E[2*at+1];rz(ct,mt,a,h)<=V&&F.push(x[at]),(q===0?a-A<=ct:h-A<=mt)&&(D.push(rt),D.push(at-1),D.push(1-q)),(q===0?a+A>=ct:h+A>=mt)&&(D.push(at+1),D.push(X),D.push(1-q))}return F}}function jC(u,a,h,A,x,E){if(x-A<=h)return;let P=A+x>>1;ez(u,a,P,A,x,E),jC(u,a,h,A,P-1,1-E),jC(u,a,h,P+1,x,1-E)}function ez(u,a,h,A,x,E){for(;x>A;){if(x-A>600){let V=x-A+1,q=h-A+1,X=Math.log(V),rt=.5*Math.exp(2*X/3),at=.5*Math.sqrt(X*rt*(V-rt)/V)*(q-V/2<0?-1:1);ez(u,a,h,Math.max(A,Math.floor(h-q*rt/V+at)),Math.min(x,Math.floor(h+(V-q)*rt/V+at)),E)}let P=a[2*h+E],D=A,F=x;for(Jx(u,a,A,h),a[2*x+E]>P&&Jx(u,a,A,x);DP;)F--}a[2*A+E]===P?Jx(u,a,A,F):(F++,Jx(u,a,F,x)),F<=h&&(A=F+1),h<=F&&(x=F-1)}}function Jx(u,a,h,A){GC(u,h,A),GC(a,2*h,2*A),GC(a,2*h+1,2*A+1)}function GC(u,a,h){let A=u[a];u[a]=u[h],u[h]=A}function rz(u,a,h,A){let x=u-h,E=a-A;return x*x+E*E}var WC;n.bh=void 0,(WC=n.bh||(n.bh={})).create=\"create\",WC.load=\"load\",WC.fullLoad=\"fullLoad\";let dT=null,t1=[],HC=1e3/60,qC=\"loadTime\",ZC=\"fullLoadTime\",AJ={mark(u){performance.mark(u)},frame(u){let a=u;dT!=null&&t1.push(a-dT),dT=a},clearMetrics(){dT=null,t1=[],performance.clearMeasures(qC),performance.clearMeasures(ZC);for(let u in n.bh)performance.clearMarks(n.bh[u])},getPerformanceMetrics(){performance.measure(qC,n.bh.create,n.bh.load),performance.measure(ZC,n.bh.create,n.bh.fullLoad);let u=performance.getEntriesByName(qC)[0].duration,a=performance.getEntriesByName(ZC)[0].duration,h=t1.length,A=1/(t1.reduce((E,P)=>E+P,0)/h/1e3),x=t1.filter(E=>E>HC).reduce((E,P)=>E+(P-HC)/HC,0);return{loadTime:u,fullLoadTime:a,fps:A,percentDroppedFrames:x/(h+x)*100,totalFrames:h}}};n.$=function(u,a,h){var A,x,E,P,D,F,V,q,X,rt,at,ct,mt=h[0],bt=h[1],Pt=h[2];return a===u?(u[12]=a[0]*mt+a[4]*bt+a[8]*Pt+a[12],u[13]=a[1]*mt+a[5]*bt+a[9]*Pt+a[13],u[14]=a[2]*mt+a[6]*bt+a[10]*Pt+a[14],u[15]=a[3]*mt+a[7]*bt+a[11]*Pt+a[15]):(x=a[1],E=a[2],P=a[3],D=a[4],F=a[5],V=a[6],q=a[7],X=a[8],rt=a[9],at=a[10],ct=a[11],u[0]=A=a[0],u[1]=x,u[2]=E,u[3]=P,u[4]=D,u[5]=F,u[6]=V,u[7]=q,u[8]=X,u[9]=rt,u[10]=at,u[11]=ct,u[12]=A*mt+D*bt+X*Pt+a[12],u[13]=x*mt+F*bt+rt*Pt+a[13],u[14]=E*mt+V*bt+at*Pt+a[14],u[15]=P*mt+q*bt+ct*Pt+a[15]),u},n.A=je,n.B=Da,n.C=class{constructor(u,a,h){this.receive=A=>{let x=A.data,E=x.id;if(E&&(!x.targetMapId||this.mapId===x.targetMapId))if(x.type===\"\"){delete this.tasks[E];let P=this.cancelCallbacks[E];delete this.cancelCallbacks[E],P&&P()}else Li()||x.mustQueue?(this.tasks[E]=x,this.taskQueue.push(E),this.invoker.trigger()):this.processTask(E,x)},this.process=()=>{if(!this.taskQueue.length)return;let A=this.taskQueue.shift(),x=this.tasks[A];delete this.tasks[A],this.taskQueue.length&&this.invoker.trigger(),x&&this.processTask(A,x)},this.target=u,this.parent=a,this.mapId=h,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new sJ(this.process),this.target.addEventListener(\"message\",this.receive,!1),this.globalScope=Li()?u:window}send(u,a,h,A,x=!1){let E=Math.round(1e18*Math.random()).toString(36).substring(0,10);h&&(this.callbacks[E]=h);let P=[],D={id:E,type:u,hasCallback:!!h,targetMapId:A,mustQueue:x,sourceMapId:this.mapId,data:Hl(a,P)};return this.target.postMessage(D,{transfer:P}),{cancel:()=>{h&&delete this.callbacks[E],this.target.postMessage({id:E,type:\"\",targetMapId:A,sourceMapId:this.mapId})}}}processTask(u,a){if(a.type===\"\"){let h=this.callbacks[u];delete this.callbacks[u],h&&(a.error?h(xf(a.error)):h(null,xf(a.data)))}else{let h=!1,A=[],x=a.hasCallback?(D,F)=>{h=!0,delete this.cancelCallbacks[u];let V={id:u,type:\"\",sourceMapId:this.mapId,error:D?Hl(D):null,data:Hl(F,A)};this.target.postMessage(V,{transfer:A})}:D=>{h=!0},E=null,P=xf(a.data);if(this.parent[a.type])E=this.parent[a.type](a.sourceMapId,P,x);else if(\"getWorkerSource\"in this.parent){let D=a.type.split(\".\");E=this.parent.getWorkerSource(a.sourceMapId,D[0],P.source)[D[1]](P,x)}else x(new Error(`Could not find function ${a.type}`));!h&&E&&E.cancel&&(this.cancelCallbacks[u]=E.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener(\"message\",this.receive,!1)}},n.D=nr,n.E=Nl,n.F=function(u,a){let h={};for(let A=0;A{}}},n.Y=ve,n.Z=function(){var u=new je(16);return je!=Float32Array&&(u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=0,u[12]=0,u[13]=0,u[14]=0),u[0]=1,u[5]=1,u[10]=1,u[15]=1,u},n._=o,n.a=zl,n.a$=class extends st{},n.a0=function(u,a,h){var A=h[0],x=h[1],E=h[2];return u[0]=a[0]*A,u[1]=a[1]*A,u[2]=a[2]*A,u[3]=a[3]*A,u[4]=a[4]*x,u[5]=a[5]*x,u[6]=a[6]*x,u[7]=a[7]*x,u[8]=a[8]*E,u[9]=a[9]*E,u[10]=a[10]*E,u[11]=a[11]*E,u[12]=a[12],u[13]=a[13],u[14]=a[14],u[15]=a[15],u},n.a1=qi,n.a2=function(){return Xt++},n.a3=yt,n.a4=C_,n.a5=function(){ua.isLoading()||ua.isLoaded()||f0()!==\"deferred\"||v_()},n.a6=r0,n.a7=S,n.a8=un,n.a9=z6,n.aA=Bc,n.aB=function(u){u=u.slice();let a=Object.create(null);for(let h=0;h{A[P.source]?h.push({command:oi.removeLayer,args:[P.id]}):E.push(P)}),h=h.concat(x),function(P,D,F){D=D||[];let V=(P=P||[]).map(Ia),q=D.map(Ia),X=P.reduce(wo,{}),rt=D.reduce(wo,{}),at=V.slice(),ct=Object.create(null),mt,bt,Pt,jt,Rt,Gt,Yt;for(mt=0,bt=0;mt@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)(?:\\=(?:([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)|(?:\\\"((?:[^\"\\\\]|\\\\.)*)\\\")))?/g,(h,A,x,E)=>{let P=x||E;return a[A]=!P||P.toLowerCase(),\"\"}),a[\"max-age\"]){let h=parseInt(a[\"max-age\"],10);isNaN(h)?delete a[\"max-age\"]:a[\"max-age\"]=h}return a},n.ab=function(u,a){let h=[];for(let A in u)A in a||h.push(A);return h},n.ac=function(u){if(oo==null){let a=u.navigator?u.navigator.userAgent:null;oo=!!u.safari||!(!a||!(/\\b(iPad|iPhone|iPod)\\b/.test(a)||a.match(\"Safari\")&&!a.match(\"Chrome\")))}return oo},n.ad=ut,n.ae=function(u,a,h){var A=Math.sin(h),x=Math.cos(h),E=a[0],P=a[1],D=a[2],F=a[3],V=a[4],q=a[5],X=a[6],rt=a[7];return a!==u&&(u[8]=a[8],u[9]=a[9],u[10]=a[10],u[11]=a[11],u[12]=a[12],u[13]=a[13],u[14]=a[14],u[15]=a[15]),u[0]=E*x+V*A,u[1]=P*x+q*A,u[2]=D*x+X*A,u[3]=F*x+rt*A,u[4]=V*x-E*A,u[5]=q*x-P*A,u[6]=X*x-D*A,u[7]=rt*x-F*A,u},n.af=function(u){var a=new je(16);return a[0]=u[0],a[1]=u[1],a[2]=u[2],a[3]=u[3],a[4]=u[4],a[5]=u[5],a[6]=u[6],a[7]=u[7],a[8]=u[8],a[9]=u[9],a[10]=u[10],a[11]=u[11],a[12]=u[12],a[13]=u[13],a[14]=u[14],a[15]=u[15],a},n.ag=Pi,n.ah=function(u,a){let h=0,A=0;if(u.kind===\"constant\")A=u.layoutSize;else if(u.kind!==\"source\"){let{interpolationType:x,minZoom:E,maxZoom:P}=u,D=x?ut(Oa.interpolationFactor(x,a,E,P),0,1):0;u.kind===\"camera\"?A=Da.number(u.minSize,u.maxSize,D):h=D}return{uSizeT:h,uSize:A}},n.aj=function(u,{uSize:a,uSizeT:h},{lowerSize:A,upperSize:x}){return u.kind===\"source\"?A/Ef:u.kind===\"composite\"?Da.number(A/Ef,x/Ef,h):a},n.ak=kC,n.al=function(u,a,h,A){let x=a.y-u.y,E=a.x-u.x,P=A.y-h.y,D=A.x-h.x,F=P*E-D*x;if(F===0)return null;let V=(D*(u.y-h.y)-P*(u.x-h.x))/F;return new w(u.x+V*E,u.y+V*x)},n.am=j6,n.an=L,n.ao=Zr,n.ap=Hs,n.ar=LC,n.as=function(u,a){var h=a[0],A=a[1],x=a[2],E=a[3],P=a[4],D=a[5],F=a[6],V=a[7],q=a[8],X=a[9],rt=a[10],at=a[11],ct=a[12],mt=a[13],bt=a[14],Pt=a[15],jt=h*D-A*P,Rt=h*F-x*P,Gt=h*V-E*P,Yt=A*F-x*D,ce=A*V-E*D,Ne=x*V-E*F,ir=q*mt-X*ct,Fe=q*bt-rt*ct,Re=q*Pt-at*ct,Me=X*bt-rt*mt,Ye=X*Pt-at*mt,Ie=rt*Pt-at*bt,Ae=jt*Ie-Rt*Ye+Gt*Me+Yt*Re-ce*Fe+Ne*ir;return Ae?(u[0]=(D*Ie-F*Ye+V*Me)*(Ae=1/Ae),u[1]=(x*Ye-A*Ie-E*Me)*Ae,u[2]=(mt*Ne-bt*ce+Pt*Yt)*Ae,u[3]=(rt*ce-X*Ne-at*Yt)*Ae,u[4]=(F*Re-P*Ie-V*Fe)*Ae,u[5]=(h*Ie-x*Re+E*Fe)*Ae,u[6]=(bt*Gt-ct*Ne-Pt*Rt)*Ae,u[7]=(q*Ne-rt*Gt+at*Rt)*Ae,u[8]=(P*Ye-D*Re+V*ir)*Ae,u[9]=(A*Re-h*Ye-E*ir)*Ae,u[10]=(ct*ce-mt*Gt+Pt*jt)*Ae,u[11]=(X*Gt-q*ce-at*jt)*Ae,u[12]=(D*Fe-P*Me-F*ir)*Ae,u[13]=(h*Me-A*Fe+x*ir)*Ae,u[14]=(mt*Rt-ct*Yt-bt*jt)*Ae,u[15]=(q*Yt-X*Rt+rt*jt)*Ae,u):null},n.at=UC,n.au=CC,n.av=VC,n.aw=function(){let u={},a=ee.$version;for(let h in ee.$root){let A=ee.$root[h];if(A.required){let x=null;x=h===\"version\"?a:A.type===\"array\"?[]:{},x!=null&&(u[h]=x)}}return u},n.ax=oi,n.ay=__,n.az=Jn,n.b=function(u,a){let h=new Blob([new Uint8Array(u)],{type:\"image/png\"});createImageBitmap(h).then(A=>{a(null,A)}).catch(A=>{a(new Error(`Could not load image because of ${A.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},n.b0=Gs,n.b1=function(u,a){var h=u[0],A=u[1],x=u[2],E=u[3],P=u[4],D=u[5],F=u[6],V=u[7],q=u[8],X=u[9],rt=u[10],at=u[11],ct=u[12],mt=u[13],bt=u[14],Pt=u[15],jt=a[0],Rt=a[1],Gt=a[2],Yt=a[3],ce=a[4],Ne=a[5],ir=a[6],Fe=a[7],Re=a[8],Me=a[9],Ye=a[10],Ie=a[11],Ae=a[12],hr=a[13],sr=a[14],ri=a[15];return Math.abs(h-jt)<=we*Math.max(1,Math.abs(h),Math.abs(jt))&&Math.abs(A-Rt)<=we*Math.max(1,Math.abs(A),Math.abs(Rt))&&Math.abs(x-Gt)<=we*Math.max(1,Math.abs(x),Math.abs(Gt))&&Math.abs(E-Yt)<=we*Math.max(1,Math.abs(E),Math.abs(Yt))&&Math.abs(P-ce)<=we*Math.max(1,Math.abs(P),Math.abs(ce))&&Math.abs(D-Ne)<=we*Math.max(1,Math.abs(D),Math.abs(Ne))&&Math.abs(F-ir)<=we*Math.max(1,Math.abs(F),Math.abs(ir))&&Math.abs(V-Fe)<=we*Math.max(1,Math.abs(V),Math.abs(Fe))&&Math.abs(q-Re)<=we*Math.max(1,Math.abs(q),Math.abs(Re))&&Math.abs(X-Me)<=we*Math.max(1,Math.abs(X),Math.abs(Me))&&Math.abs(rt-Ye)<=we*Math.max(1,Math.abs(rt),Math.abs(Ye))&&Math.abs(at-Ie)<=we*Math.max(1,Math.abs(at),Math.abs(Ie))&&Math.abs(ct-Ae)<=we*Math.max(1,Math.abs(ct),Math.abs(Ae))&&Math.abs(mt-hr)<=we*Math.max(1,Math.abs(mt),Math.abs(hr))&&Math.abs(bt-sr)<=we*Math.max(1,Math.abs(bt),Math.abs(sr))&&Math.abs(Pt-ri)<=we*Math.max(1,Math.abs(Pt),Math.abs(ri))},n.b2=function(u,a){return u[0]=a[0],u[1]=a[1],u[2]=a[2],u[3]=a[3],u[4]=a[4],u[5]=a[5],u[6]=a[6],u[7]=a[7],u[8]=a[8],u[9]=a[9],u[10]=a[10],u[11]=a[11],u[12]=a[12],u[13]=a[13],u[14]=a[14],u[15]=a[15],u},n.b3=function(u,a,h){return u[0]=a[0]*h[0],u[1]=a[1]*h[1],u[2]=a[2]*h[2],u[3]=a[3]*h[3],u},n.b4=function(u,a){return u[0]*a[0]+u[1]*a[1]+u[2]*a[2]+u[3]*a[3]},n.b5=Et,n.b6=O6,n.b7=k6,n.b8=function(u,a,h,A,x){var E,P=1/Math.tan(a/2);return u[0]=P/h,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=P,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=-1,u[12]=0,u[13]=0,u[15]=0,x!=null&&x!==1/0?(u[10]=(x+A)*(E=1/(A-x)),u[14]=2*x*A*E):(u[10]=-1,u[14]=-2*A),u},n.b9=function(u,a,h){var A=Math.sin(h),x=Math.cos(h),E=a[4],P=a[5],D=a[6],F=a[7],V=a[8],q=a[9],X=a[10],rt=a[11];return a!==u&&(u[0]=a[0],u[1]=a[1],u[2]=a[2],u[3]=a[3],u[12]=a[12],u[13]=a[13],u[14]=a[14],u[15]=a[15]),u[4]=E*x+V*A,u[5]=P*x+q*A,u[6]=D*x+X*A,u[7]=F*x+rt*A,u[8]=V*x-E*A,u[9]=q*x-P*A,u[10]=X*x-D*A,u[11]=rt*x-F*A,u},n.bA=f,n.bB=a6,n.bC=Qp,n.bD=ua,n.ba=K,n.bb=J,n.bc=function(u,a){return u[0]=a[0],u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=a[1],u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=a[2],u[11]=0,u[12]=0,u[13]=0,u[14]=0,u[15]=1,u},n.bd=class extends gh{},n.be=BC,n.bf=R6,n.bg=AJ,n.bi=Xi,n.bj=function(u,a,h=!1){if(us===u0||us===iA||us===nA)throw new Error(\"setRTLTextPlugin cannot be called multiple times.\");_u=kc.resolveURL(u),us=u0,ph=a,h0(),h||v_()},n.bk=f0,n.bl=function(u,a){let h={};for(let x=0;xAe*Hs)}let Fe=P?\"center\":h.get(\"text-justify\").evaluate(V,{},u.canonical),Re=h.get(\"symbol-placement\"),Me=Re===\"point\"?h.get(\"text-max-width\").evaluate(V,{},u.canonical)*Hs:0,Ye=()=>{u.bucket.allowVerticalPlacement&&o0(Gt)&&(ct.vertical=nT(mt,u.glyphMap,u.glyphPositions,u.imagePositions,q,Me,E,Ne,\"left\",ce,Pt,n.ai.vertical,!0,Re,rt,X))};if(!P&&ir){let Ie=new Set;if(Fe===\"auto\")for(let hr=0;hr{a(null,h),URL.revokeObjectURL(h.src),h.onload=null,window.requestAnimationFrame(()=>{h.src=No})},h.onerror=()=>a(new Error(\"Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.\"));let A=new Blob([new Uint8Array(u)],{type:\"image/png\"});h.src=u.byteLength?URL.createObjectURL(A):No},n.e=kt,n.f=function(u,a){return Vo(kt(u,{type:\"json\"}),a)},n.g=ki,n.h=kc,n.i=Li,n.j=ao,n.k=as,n.l=cl,n.m=Vo,n.n=function(u){return new MC(u).readFields(WK,[])},n.o=function(u,a,h){if(!u.length)return h(null,[]);let A=u.length,x=new Array(u.length),E=null;u.forEach((P,D)=>{a(P,(F,V)=>{F&&(E=F),x[D]=V,--A==0&&h(E,x)})})},n.p=A6,n.q=Vx,n.r=Hn,n.s=xo,n.t=hh,n.u=Oe,n.v=ee,n.w=Ke,n.x=fh,n.y=za,n.z=function([u,a,h]){return a+=90,a*=Math.PI/180,h*=Math.PI/180,{x:u*Math.cos(a)*Math.sin(h),y:u*Math.sin(a)*Math.sin(h),z:u*Math.cos(h)}}}),i([\"./shared\"],function(n){\"use strict\";class o{constructor(tt){this.keyCache={},tt&&this.replace(tt)}replace(tt){this._layerConfigs={},this._layers={},this.update(tt,[])}update(tt,nt){for(let vt of tt){this._layerConfigs[vt.id]=vt;let xt=this._layers[vt.id]=n.aC(vt);xt._featureFilter=n.a6(xt.filter),this.keyCache[vt.id]&&delete this.keyCache[vt.id]}for(let vt of nt)delete this.keyCache[vt],delete this._layerConfigs[vt],delete this._layers[vt];this.familiesBySource={};let ht=n.bl(Object.values(this._layerConfigs),this.keyCache);for(let vt of ht){let xt=vt.map(se=>this._layers[se.id]),_t=xt[0];if(_t.visibility===\"none\")continue;let Dt=_t.source||\"\",Mt=this.familiesBySource[Dt];Mt||(Mt=this.familiesBySource[Dt]={});let Vt=_t.sourceLayer||\"_geojsonTileLayer\",ie=Mt[Vt];ie||(ie=Mt[Vt]=[]),ie.push(xt)}}}class c{constructor(tt){let nt={},ht=[];for(let Dt in tt){let Mt=tt[Dt],Vt=nt[Dt]={};for(let ie in Mt){let se=Mt[+ie];if(!se||se.bitmap.width===0||se.bitmap.height===0)continue;let ae={x:0,y:0,w:se.bitmap.width+2,h:se.bitmap.height+2};ht.push(ae),Vt[ie]={rect:ae,metrics:se.metrics}}}let{w:vt,h:xt}=n.p(ht),_t=new n.q({width:vt||1,height:xt||1});for(let Dt in tt){let Mt=tt[Dt];for(let Vt in Mt){let ie=Mt[+Vt];if(!ie||ie.bitmap.width===0||ie.bitmap.height===0)continue;let se=nt[Dt][Vt].rect;n.q.copy(ie.bitmap,_t,{x:0,y:0},{x:se.x+1,y:se.y+1},ie.bitmap)}}this.image=_t,this.positions=nt}}n.bm(\"GlyphAtlas\",c);class f{constructor(tt){this.tileID=new n.O(tt.tileID.overscaledZ,tt.tileID.wrap,tt.tileID.canonical.z,tt.tileID.canonical.x,tt.tileID.canonical.y),this.uid=tt.uid,this.zoom=tt.zoom,this.pixelRatio=tt.pixelRatio,this.tileSize=tt.tileSize,this.source=tt.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=tt.showCollisionBoxes,this.collectResourceTiming=!!tt.collectResourceTiming,this.returnDependencies=!!tt.returnDependencies,this.promoteId=tt.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(tt,nt,ht,vt,xt){this.status=\"parsing\",this.data=tt,this.collisionBoxArray=new n.a3;let _t=new n.bn(Object.keys(tt.layers).sort()),Dt=new n.bo(this.tileID,this.promoteId);Dt.bucketLayerIDs=[];let Mt={},Vt={featureIndex:Dt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ht},ie=nt.familiesBySource[this.source];for(let ni in ie){let Hr=tt.layers[ni];if(!Hr)continue;Hr.version===1&&n.w(`Vector tile source \"${this.source}\" layer \"${ni}\" does not use vector tile spec v2 and therefore may have some rendering errors.`);let jn=_t.encode(ni),Bi=[];for(let xn=0;xn=es.maxzoom||es.visibility!==\"none\"&&(_(xn,this.zoom,ht),(Mt[es.id]=es.createBucket({index:Dt.bucketLayerIDs.length,layers:xn,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:jn,sourceID:this.source})).populate(Bi,Vt,this.tileID.canonical),Dt.bucketLayerIDs.push(xn.map(oa=>oa.id)))}}let se,ae,lr,vr,Xe=n.aH(Vt.glyphDependencies,ni=>Object.keys(ni).map(Number));this.inFlightDependencies.forEach(ni=>ni?.cancel()),this.inFlightDependencies=[];let cr=++this.dependencySentinel;Object.keys(Xe).length?this.inFlightDependencies.push(vt.send(\"getGlyphs\",{uid:this.uid,stacks:Xe,source:this.source,tileID:this.tileID,type:\"glyphs\"},(ni,Hr)=>{cr===this.dependencySentinel&&(se||(se=ni,ae=Hr,zi.call(this)))})):ae={};let wr=Object.keys(Vt.iconDependencies);wr.length?this.inFlightDependencies.push(vt.send(\"getImages\",{icons:wr,source:this.source,tileID:this.tileID,type:\"icons\"},(ni,Hr)=>{cr===this.dependencySentinel&&(se||(se=ni,lr=Hr,zi.call(this)))})):lr={};let xi=Object.keys(Vt.patternDependencies);function zi(){if(se)return xt(se);if(ae&&lr&&vr){let ni=new c(ae),Hr=new n.bp(lr,vr);for(let jn in Mt){let Bi=Mt[jn];Bi instanceof n.a4?(_(Bi.layers,this.zoom,ht),n.bq({bucket:Bi,glyphMap:ae,glyphPositions:ni.positions,imageMap:lr,imagePositions:Hr.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Bi.hasPattern&&(Bi instanceof n.br||Bi instanceof n.bs||Bi instanceof n.bt)&&(_(Bi.layers,this.zoom,ht),Bi.addFeatures(Vt,this.tileID.canonical,Hr.patternPositions))}this.status=\"done\",xt(null,{buckets:Object.values(Mt).filter(jn=>!jn.isEmpty()),featureIndex:Dt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ni.image,imageAtlas:Hr,glyphMap:this.returnDependencies?ae:null,iconMap:this.returnDependencies?lr:null,glyphPositions:this.returnDependencies?ni.positions:null})}}xi.length?this.inFlightDependencies.push(vt.send(\"getImages\",{icons:xi,source:this.source,tileID:this.tileID,type:\"patterns\"},(ni,Hr)=>{cr===this.dependencySentinel&&(se||(se=ni,vr=Hr,zi.call(this)))})):vr={},zi.call(this)}}function _(gt,tt,nt){let ht=new n.a8(tt);for(let vt of gt)vt.recalculate(ht,nt)}function w(gt,tt){let nt=n.l(gt.request,(ht,vt,xt,_t)=>{if(ht)tt(ht);else if(vt)try{let Dt=new n.bw.VectorTile(new n.bv(vt));tt(null,{vectorTile:Dt,rawData:vt,cacheControl:xt,expires:_t})}catch(Dt){let Mt=new Uint8Array(vt),Vt=`Unable to parse the tile at ${gt.request.url}, `;Vt+=Mt[0]===31&&Mt[1]===139?\"please make sure the data is not gzipped and that you have configured the relevant header in the server\":`got error: ${Dt.messge}`,tt(new Error(Vt))}});return()=>{nt.cancel(),tt()}}class I{constructor(tt,nt,ht,vt){this.actor=tt,this.layerIndex=nt,this.availableImages=ht,this.loadVectorData=vt||w,this.fetching={},this.loading={},this.loaded={}}loadTile(tt,nt){let ht=tt.uid;this.loading||(this.loading={});let vt=!!(tt&&tt.request&&tt.request.collectResourceTiming)&&new n.bu(tt.request),xt=this.loading[ht]=new f(tt);xt.abort=this.loadVectorData(tt,(_t,Dt)=>{if(delete this.loading[ht],_t||!Dt)return xt.status=\"done\",this.loaded[ht]=xt,nt(_t);let Mt=Dt.rawData,Vt={};Dt.expires&&(Vt.expires=Dt.expires),Dt.cacheControl&&(Vt.cacheControl=Dt.cacheControl);let ie={};if(vt){let se=vt.finish();se&&(ie.resourceTiming=JSON.parse(JSON.stringify(se)))}xt.vectorTile=Dt.vectorTile,xt.parse(Dt.vectorTile,this.layerIndex,this.availableImages,this.actor,(se,ae)=>{if(delete this.fetching[ht],se||!ae)return nt(se);nt(null,n.e({rawTileData:Mt.slice(0)},ae,Vt,ie))}),this.loaded=this.loaded||{},this.loaded[ht]=xt,this.fetching[ht]={rawTileData:Mt,cacheControl:Vt,resourceTiming:ie}})}reloadTile(tt,nt){let ht=this.loaded,vt=tt.uid;if(ht&&ht[vt]){let xt=ht[vt];xt.showCollisionBoxes=tt.showCollisionBoxes,xt.status===\"parsing\"?xt.parse(xt.vectorTile,this.layerIndex,this.availableImages,this.actor,(_t,Dt)=>{if(_t||!Dt)return nt(_t,Dt);let Mt;if(this.fetching[vt]){let{rawTileData:Vt,cacheControl:ie,resourceTiming:se}=this.fetching[vt];delete this.fetching[vt],Mt=n.e({rawTileData:Vt.slice(0)},Dt,ie,se)}else Mt=Dt;nt(null,Mt)}):xt.status===\"done\"&&(xt.vectorTile?xt.parse(xt.vectorTile,this.layerIndex,this.availableImages,this.actor,nt):nt())}}abortTile(tt,nt){let ht=this.loading,vt=tt.uid;ht&&ht[vt]&&ht[vt].abort&&(ht[vt].abort(),delete ht[vt]),nt()}removeTile(tt,nt){let ht=this.loaded,vt=tt.uid;ht&&ht[vt]&&delete ht[vt],nt()}}class R{constructor(){this.loaded={}}loadTile(tt,nt){return n._(this,void 0,void 0,function*(){let{uid:ht,encoding:vt,rawImageData:xt,redFactor:_t,greenFactor:Dt,blueFactor:Mt,baseShift:Vt}=tt,ie=xt.width+2,se=xt.height+2,ae=n.a(xt)?new n.R({width:ie,height:se},yield n.bx(xt,-1,-1,ie,se)):xt,lr=new n.by(ht,ae,vt,_t,Dt,Mt,Vt);this.loaded=this.loaded||{},this.loaded[ht]=lr,nt(null,lr)})}removeTile(tt){let nt=this.loaded,ht=tt.uid;nt&&nt[ht]&&delete nt[ht]}}function N(gt,tt){if(gt.length!==0){j(gt[0],tt);for(var nt=1;nt=Math.abs(Dt)?nt-Mt+Dt:Dt-Mt+nt,nt=Mt}nt+ht>=0!=!!tt&>.reverse()}var Q=n.bz(function gt(tt,nt){var ht,vt=tt&&tt.type;if(vt===\"FeatureCollection\")for(ht=0;ht>31}function Li(gt,tt){for(var nt=gt.loadGeometry(),ht=gt.type,vt=0,xt=0,_t=nt.length,Dt=0;Dt<_t;Dt++){var Mt=nt[Dt],Vt=1;ht===1&&(Vt=Mt.length),tt.writeVarint(rr(1,Vt));for(var ie=ht===3?Mt.length-1:Mt.length,se=0;segt},ih=Math.fround||(Uo=new Float32Array(1),gt=>(Uo[0]=+gt,Uo[0]));var Uo;let Si=3,Ns=5,ll=6;class kc{constructor(tt){this.options=Object.assign(Object.create(No),tt),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(tt){let{log:nt,minZoom:ht,maxZoom:vt}=this.options;nt&&console.time(\"total time\");let xt=`prepare ${tt.length} points`;nt&&console.time(xt),this.points=tt;let _t=[];for(let Mt=0;Mt=ht;Mt--){let Vt=+Date.now();Dt=this.trees[Mt]=this._createTree(this._cluster(Dt,Mt)),nt&&console.log(\"z%d: %d clusters in %dms\",Mt,Dt.numItems,+Date.now()-Vt)}return nt&&console.timeEnd(\"total time\"),this}getClusters(tt,nt){let ht=((tt[0]+180)%360+360)%360-180,vt=Math.max(-90,Math.min(90,tt[1])),xt=tt[2]===180?180:((tt[2]+180)%360+360)%360-180,_t=Math.max(-90,Math.min(90,tt[3]));if(tt[2]-tt[0]>=360)ht=-180,xt=180;else if(ht>xt){let se=this.getClusters([ht,vt,180,_t],nt),ae=this.getClusters([-180,vt,xt,_t],nt);return se.concat(ae)}let Dt=this.trees[this._limitZoom(nt)],Mt=Dt.range(Jn(ht),ki(_t),Jn(xt),ki(vt)),Vt=Dt.data,ie=[];for(let se of Mt){let ae=this.stride*se;ie.push(Vt[ae+Ns]>1?Rc(Vt,ae,this.clusterProps):this.points[Vt[ae+Si]])}return ie}getChildren(tt){let nt=this._getOriginId(tt),ht=this._getOriginZoom(tt),vt=\"No cluster with the specified id.\",xt=this.trees[ht];if(!xt)throw new Error(vt);let _t=xt.data;if(nt*this.stride>=_t.length)throw new Error(vt);let Dt=this.options.radius/(this.options.extent*Math.pow(2,ht-1)),Mt=xt.within(_t[nt*this.stride],_t[nt*this.stride+1],Dt),Vt=[];for(let ie of Mt){let se=ie*this.stride;_t[se+4]===tt&&Vt.push(_t[se+Ns]>1?Rc(_t,se,this.clusterProps):this.points[_t[se+Si]])}if(Vt.length===0)throw new Error(vt);return Vt}getLeaves(tt,nt,ht){let vt=[];return this._appendLeaves(vt,tt,nt=nt||10,ht=ht||0,0),vt}getTile(tt,nt,ht){let vt=this.trees[this._limitZoom(tt)],xt=Math.pow(2,tt),{extent:_t,radius:Dt}=this.options,Mt=Dt/_t,Vt=(ht-Mt)/xt,ie=(ht+1+Mt)/xt,se={features:[]};return this._addTileFeatures(vt.range((nt-Mt)/xt,Vt,(nt+1+Mt)/xt,ie),vt.data,nt,ht,xt,se),nt===0&&this._addTileFeatures(vt.range(1-Mt/xt,Vt,1,ie),vt.data,xt,ht,xt,se),nt===xt-1&&this._addTileFeatures(vt.range(0,Vt,Mt/xt,ie),vt.data,-1,ht,xt,se),se.features.length?se:null}getClusterExpansionZoom(tt){let nt=this._getOriginZoom(tt)-1;for(;nt<=this.options.maxZoom;){let ht=this.getChildren(tt);if(nt++,ht.length!==1)break;tt=ht[0].properties.cluster_id}return nt}_appendLeaves(tt,nt,ht,vt,xt){let _t=this.getChildren(nt);for(let Dt of _t){let Mt=Dt.properties;if(Mt&&Mt.cluster?xt+Mt.point_count<=vt?xt+=Mt.point_count:xt=this._appendLeaves(tt,Mt.cluster_id,ht,vt,xt):xt1,ie,se,ae;if(Vt)ie=Xi(nt,Mt,this.clusterProps),se=nt[Mt],ae=nt[Mt+1];else{let Xe=this.points[nt[Mt+Si]];ie=Xe.properties;let[cr,wr]=Xe.geometry.coordinates;se=Jn(cr),ae=ki(wr)}let lr={type:1,geometry:[[Math.round(this.options.extent*(se*xt-ht)),Math.round(this.options.extent*(ae*xt-vt))]],tags:ie},vr;vr=Vt||this.options.generateId?nt[Mt+Si]:this.points[nt[Mt+Si]].id,vr!==void 0&&(lr.id=vr),_t.features.push(lr)}}_limitZoom(tt){return Math.max(this.options.minZoom,Math.min(Math.floor(+tt),this.options.maxZoom+1))}_cluster(tt,nt){let{radius:ht,extent:vt,reduce:xt,minPoints:_t}=this.options,Dt=ht/(vt*Math.pow(2,nt)),Mt=tt.data,Vt=[],ie=this.stride;for(let se=0;sent&&(cr+=Mt[xi+Ns])}if(cr>Xe&&cr>=_t){let wr,xi=ae*Xe,zi=lr*Xe,ni=-1,Hr=((se/ie|0)<<5)+(nt+1)+this.points.length;for(let jn of vr){let Bi=jn*ie;if(Mt[Bi+2]<=nt)continue;Mt[Bi+2]=nt;let xn=Mt[Bi+Ns];xi+=Mt[Bi]*xn,zi+=Mt[Bi+1]*xn,Mt[Bi+4]=Hr,xt&&(wr||(wr=this._map(Mt,se,!0),ni=this.clusterProps.length,this.clusterProps.push(wr)),xt(wr,this._map(Mt,Bi)))}Mt[se+4]=Hr,Vt.push(xi/cr,zi/cr,1/0,Hr,-1,cr),xt&&Vt.push(ni)}else{for(let wr=0;wr1)for(let wr of vr){let xi=wr*ie;if(!(Mt[xi+2]<=nt)){Mt[xi+2]=nt;for(let zi=0;zi>5}_getOriginZoom(tt){return(tt-this.points.length)%32}_map(tt,nt,ht){if(tt[nt+Ns]>1){let _t=this.clusterProps[tt[nt+ll]];return ht?Object.assign({},_t):_t}let vt=this.points[tt[nt+Si]].properties,xt=this.options.map(vt);return ht&&xt===vt?Object.assign({},xt):xt}}function Rc(gt,tt,nt){return{type:\"Feature\",id:gt[tt+Si],properties:Xi(gt,tt,nt),geometry:{type:\"Point\",coordinates:[(ht=gt[tt],360*(ht-.5)),ts(gt[tt+1])]}};var ht}function Xi(gt,tt,nt){let ht=gt[tt+Ns],vt=ht>=1e4?`${Math.round(ht/1e3)}k`:ht>=1e3?Math.round(ht/100)/10+\"k\":ht,xt=gt[tt+ll],_t=xt===-1?{}:Object.assign({},nt[xt]);return Object.assign(_t,{cluster:!0,cluster_id:gt[tt+Si],point_count:ht,point_count_abbreviated:vt})}function Jn(gt){return gt/360+.5}function ki(gt){let tt=Math.sin(gt*Math.PI/180),nt=.5-.25*Math.log((1+tt)/(1-tt))/Math.PI;return nt<0?0:nt>1?1:nt}function ts(gt){let tt=(180-360*gt)*Math.PI/180;return 360*Math.atan(Math.exp(tt))/Math.PI-90}function Vo(gt,tt,nt,ht){for(var vt,xt=ht,_t=nt-tt>>1,Dt=nt-tt,Mt=gt[tt],Vt=gt[tt+1],ie=gt[nt],se=gt[nt+1],ae=tt+3;aext)vt=ae,xt=lr;else if(lr===xt){var vr=Math.abs(ae-_t);vrht&&(vt-tt>3&&Vo(gt,tt,vt,ht),gt[vt+2]=xt,nt-vt>3&&Vo(gt,vt,nt,ht))}function cl(gt,tt,nt,ht,vt,xt){var _t=vt-nt,Dt=xt-ht;if(_t!==0||Dt!==0){var Mt=((gt-nt)*_t+(tt-ht)*Dt)/(_t*_t+Dt*Dt);Mt>1?(nt=vt,ht=xt):Mt>0&&(nt+=_t*Mt,ht+=Dt*Mt)}return(_t=gt-nt)*_t+(Dt=tt-ht)*Dt}function xo(gt,tt,nt,ht){var vt={id:gt===void 0?null:gt,type:tt,geometry:nt,tags:ht,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(xt){var _t=xt.geometry,Dt=xt.type;if(Dt===\"Point\"||Dt===\"MultiPoint\"||Dt===\"LineString\")Pa(xt,_t);else if(Dt===\"Polygon\"||Dt===\"MultiLineString\")for(var Mt=0;Mt<_t.length;Mt++)Pa(xt,_t[Mt]);else if(Dt===\"MultiPolygon\")for(Mt=0;Mt<_t.length;Mt++)for(var Vt=0;Vt<_t[Mt].length;Vt++)Pa(xt,_t[Mt][Vt])}(vt),vt}function Pa(gt,tt){for(var nt=0;nt0&&(_t+=ht?(vt*Vt-Mt*xt)/2:Math.sqrt(Math.pow(Mt-vt,2)+Math.pow(Vt-xt,2))),vt=Mt,xt=Vt}var ie=tt.length-3;tt[2]=1,Vo(tt,0,ie,nt),tt[ie+2]=1,tt.size=Math.abs(_t),tt.start=0,tt.end=tt.size}function Nl(gt,tt,nt,ht){for(var vt=0;vt1?1:nt}function mn(gt,tt,nt,ht,vt,xt,_t,Dt){if(ht/=tt,xt>=(nt/=tt)&&_t=ht)return null;for(var Mt=[],Vt=0;Vt=nt&&vr=ht)){var Xe=[];if(ae===\"Point\"||ae===\"MultiPoint\")gi(se,Xe,nt,ht,vt);else if(ae===\"LineString\")oi(se,Xe,nt,ht,vt,!1,Dt.lineMetrics);else if(ae===\"MultiLineString\")du(se,Xe,nt,ht,vt,!1);else if(ae===\"Polygon\")du(se,Xe,nt,ht,vt,!0);else if(ae===\"MultiPolygon\")for(var cr=0;cr=nt&&_t<=ht&&(tt.push(gt[xt]),tt.push(gt[xt+1]),tt.push(gt[xt+2]))}}function oi(gt,tt,nt,ht,vt,xt,_t){for(var Dt,Mt,Vt=lo(gt),ie=vt===0?bo:hl,se=gt.start,ae=0;aent&&(Mt=ie(Vt,lr,vr,cr,wr,nt),_t&&(Vt.start=se+Dt*Mt)):xi>ht?zi=nt&&(Mt=ie(Vt,lr,vr,cr,wr,nt),ni=!0),zi>ht&&xi<=ht&&(Mt=ie(Vt,lr,vr,cr,wr,ht),ni=!0),!xt&&ni&&(_t&&(Vt.end=se+Dt*Mt),tt.push(Vt),Vt=lo(gt)),_t&&(se+=Dt)}var Hr=gt.length-3;lr=gt[Hr],vr=gt[Hr+1],Xe=gt[Hr+2],(xi=vt===0?lr:vr)>=nt&&xi<=ht&&ul(Vt,lr,vr,Xe),Hr=Vt.length-3,xt&&Hr>=3&&(Vt[Hr]!==Vt[0]||Vt[Hr+1]!==Vt[1])&&ul(Vt,Vt[0],Vt[1],Vt[2]),Vt.length&&tt.push(Vt)}function lo(gt){var tt=[];return tt.size=gt.size,tt.start=gt.start,tt.end=gt.end,tt}function du(gt,tt,nt,ht,vt,xt){for(var _t=0;_t_t.maxX&&(_t.maxX=ie),se>_t.maxY&&(_t.maxY=se)}return _t}function Ul(gt,tt,nt,ht){var vt=tt.geometry,xt=tt.type,_t=[];if(xt===\"Point\"||xt===\"MultiPoint\")for(var Dt=0;Dt0&&tt.size<(vt?_t:ht))nt.numPoints+=tt.length/3;else{for(var Dt=[],Mt=0;Mt_t)&&(nt.numSimplified++,Dt.push(tt[Mt]),Dt.push(tt[Mt+1])),nt.numPoints++;vt&&function(Vt,ie){for(var se=0,ae=0,lr=Vt.length,vr=lr-2;ae0===ie)for(ae=0,lr=Vt.length;ae24)throw new Error(\"maxZoom should be in the 0-24 range\");if(tt.promoteId&&tt.generateId)throw new Error(\"promoteId and generateId cannot be used together.\");var ht=function(vt,xt){var _t=[];if(vt.type===\"FeatureCollection\")for(var Dt=0;Dt1&&console.time(\"creation\"),ae=this.tiles[se]=gn(gt,tt,nt,ht,Mt),this.tileCoords.push({z:tt,x:nt,y:ht}),Vt)){Vt>1&&(console.log(\"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)\",tt,nt,ht,ae.numFeatures,ae.numPoints,ae.numSimplified),console.timeEnd(\"creation\"));var lr=\"z\"+tt;this.stats[lr]=(this.stats[lr]||0)+1,this.total++}if(ae.source=gt,vt){if(tt===Mt.maxZoom||tt===vt)continue;var vr=1<1&&console.time(\"clipping\");var Xe,cr,wr,xi,zi,ni,Hr=.5*Mt.buffer/Mt.extent,jn=.5-Hr,Bi=.5+Hr,xn=1+Hr;Xe=cr=wr=xi=null,zi=mn(gt,ie,nt-Hr,nt+Bi,0,ae.minX,ae.maxX,Mt),ni=mn(gt,ie,nt+jn,nt+xn,0,ae.minX,ae.maxX,Mt),gt=null,zi&&(Xe=mn(zi,ie,ht-Hr,ht+Bi,1,ae.minY,ae.maxY,Mt),cr=mn(zi,ie,ht+jn,ht+xn,1,ae.minY,ae.maxY,Mt),zi=null),ni&&(wr=mn(ni,ie,ht-Hr,ht+Bi,1,ae.minY,ae.maxY,Mt),xi=mn(ni,ie,ht+jn,ht+xn,1,ae.minY,ae.maxY,Mt),ni=null),Vt>1&&console.timeEnd(\"clipping\"),Dt.push(Xe||[],tt+1,2*nt,2*ht),Dt.push(cr||[],tt+1,2*nt,2*ht+1),Dt.push(wr||[],tt+1,2*nt+1,2*ht),Dt.push(xi||[],tt+1,2*nt+1,2*ht+1)}}},Te.prototype.getTile=function(gt,tt,nt){var ht=this.options,vt=ht.extent,xt=ht.debug;if(gt<0||gt>24)return null;var _t=1<1&&console.log(\"drilling down to z%d-%d-%d\",gt,tt,nt);for(var Mt,Vt=gt,ie=tt,se=nt;!Mt&&Vt>0;)Vt--,ie=Math.floor(ie/2),se=Math.floor(se/2),Mt=this.tiles[Dr(Vt,ie,se)];return Mt&&Mt.source?(xt>1&&console.log(\"found parent tile z%d-%d-%d\",Vt,ie,se),xt>1&&console.time(\"drilling down\"),this.splitTile(Mt.source,Vt,ie,se,gt,tt,nt),xt>1&&console.timeEnd(\"drilling down\"),this.tiles[Dt]?ve(this.tiles[Dt],vt):null):null};class Mr extends I{constructor(tt,nt,ht,vt){super(tt,nt,ht),this._dataUpdateable=new Map,this.loadGeoJSON=(xt,_t)=>{let{promoteId:Dt}=xt;if(xt.request)return n.f(xt.request,(Mt,Vt,ie,se)=>{this._dataUpdateable=Us(Vt,Dt)?La(Vt,Dt):void 0,_t(Mt,Vt,ie,se)});if(typeof xt.data==\"string\")try{let Mt=JSON.parse(xt.data);this._dataUpdateable=Us(Mt,Dt)?La(Mt,Dt):void 0,_t(null,Mt)}catch{_t(new Error(`Input data given to '${xt.source}' is not a valid GeoJSON object.`))}else xt.dataDiff?this._dataUpdateable?(function(Mt,Vt,ie){var se,ae,lr,vr;if(Vt.removeAll&&Mt.clear(),Vt.remove)for(let Xe of Vt.remove)Mt.delete(Xe);if(Vt.add)for(let Xe of Vt.add){let cr=gr(Xe,ie);cr!=null&&Mt.set(cr,Xe)}if(Vt.update)for(let Xe of Vt.update){let cr=Mt.get(Xe.id);if(cr==null)continue;let wr=!Xe.removeAllProperties&&(((se=Xe.removeProperties)===null||se===void 0?void 0:se.length)>0||((ae=Xe.addOrUpdateProperties)===null||ae===void 0?void 0:ae.length)>0);if((Xe.newGeometry||Xe.removeAllProperties||wr)&&(cr=Object.assign({},cr),Mt.set(Xe.id,cr),wr&&(cr.properties=Object.assign({},cr.properties))),Xe.newGeometry&&(cr.geometry=Xe.newGeometry),Xe.removeAllProperties)cr.properties={};else if(((lr=Xe.removeProperties)===null||lr===void 0?void 0:lr.length)>0)for(let xi of Xe.removeProperties)Object.prototype.hasOwnProperty.call(cr.properties,xi)&&delete cr.properties[xi];if(((vr=Xe.addOrUpdateProperties)===null||vr===void 0?void 0:vr.length)>0)for(let{key:xi,value:zi}of Xe.addOrUpdateProperties)cr.properties[xi]=zi}}(this._dataUpdateable,xt.dataDiff,Dt),_t(null,{type:\"FeatureCollection\",features:Array.from(this._dataUpdateable.values())})):_t(new Error(`Cannot update existing geojson data in ${xt.source}`)):_t(new Error(`Input data given to '${xt.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},this.loadVectorData=this.loadGeoJSONTile,vt&&(this.loadGeoJSON=vt)}loadGeoJSONTile(tt,nt){let ht=tt.tileID.canonical;if(!this._geoJSONIndex)return nt(null,null);let vt=this._geoJSONIndex.getTile(ht.z,ht.x,ht.y);if(!vt)return nt(null,null);let xt=new class{constructor(Dt){this.layers={_geojsonTileLayer:this},this.name=\"_geojsonTileLayer\",this.extent=n.N,this.length=Dt.length,this._features=Dt}feature(Dt){return new class{constructor(Mt){this._feature=Mt,this.extent=n.N,this.type=Mt.type,this.properties=Mt.tags,\"id\"in Mt&&!isNaN(Mt.id)&&(this.id=parseInt(Mt.id,10))}loadGeometry(){if(this._feature.type===1){let Mt=[];for(let Vt of this._feature.geometry)Mt.push([new n.P(Vt[0],Vt[1])]);return Mt}{let Mt=[];for(let Vt of this._feature.geometry){let ie=[];for(let se of Vt)ie.push(new n.P(se[0],se[1]));Mt.push(ie)}return Mt}}toGeoJSON(Mt,Vt,ie){return et.call(this,Mt,Vt,ie)}}(this._features[Dt])}}(vt.features),_t=zl(xt);_t.byteOffset===0&&_t.byteLength===_t.buffer.byteLength||(_t=new Uint8Array(_t)),nt(null,{vectorTile:xt,rawData:_t.buffer})}loadData(tt,nt){var ht;(ht=this._pendingRequest)===null||ht===void 0||ht.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});let vt=!!(tt&&tt.request&&tt.request.collectResourceTiming)&&new n.bu(tt.request);this._pendingCallback=nt,this._pendingRequest=this.loadGeoJSON(tt,(xt,_t)=>{if(delete this._pendingCallback,delete this._pendingRequest,xt||!_t)return nt(xt);if(typeof _t!=\"object\")return nt(new Error(`Input data given to '${tt.source}' is not a valid GeoJSON object.`));{Q(_t,!0);try{if(tt.filter){let Mt=n.bC(tt.filter,{type:\"boolean\",\"property-type\":\"data-driven\",overridable:!1,transition:!1});if(Mt.result===\"error\")throw new Error(Mt.value.map(ie=>`${ie.key}: ${ie.message}`).join(\", \"));_t={type:\"FeatureCollection\",features:_t.features.filter(ie=>Mt.value.evaluate({zoom:0},ie))}}this._geoJSONIndex=tt.cluster?new kc(function({superclusterOptions:Mt,clusterProperties:Vt}){if(!Vt||!Mt)return Mt;let ie={},se={},ae={accumulated:null,zoom:0},lr={properties:null},vr=Object.keys(Vt);for(let Xe of vr){let[cr,wr]=Vt[Xe],xi=n.bC(wr),zi=n.bC(typeof cr==\"string\"?[cr,[\"accumulated\"],[\"get\",Xe]]:cr);ie[Xe]=xi.value,se[Xe]=zi.value}return Mt.map=Xe=>{lr.properties=Xe;let cr={};for(let wr of vr)cr[wr]=ie[wr].evaluate(ae,lr);return cr},Mt.reduce=(Xe,cr)=>{lr.properties=cr;for(let wr of vr)ae.accumulated=Xe[wr],Xe[wr]=se[wr].evaluate(ae,lr)},Mt}(tt)).load(_t.features):function(Mt,Vt){return new Te(Mt,Vt)}(_t,tt.geojsonVtOptions)}catch(Mt){return nt(Mt)}this.loaded={};let Dt={};if(vt){let Mt=vt.finish();Mt&&(Dt.resourceTiming={},Dt.resourceTiming[tt.source]=JSON.parse(JSON.stringify(Mt)))}nt(null,Dt)}})}reloadTile(tt,nt){let ht=this.loaded;return ht&&ht[tt.uid]?super.reloadTile(tt,nt):this.loadTile(tt,nt)}removeSource(tt,nt){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),nt()}getClusterExpansionZoom(tt,nt){try{nt(null,this._geoJSONIndex.getClusterExpansionZoom(tt.clusterId))}catch(ht){nt(ht)}}getClusterChildren(tt,nt){try{nt(null,this._geoJSONIndex.getChildren(tt.clusterId))}catch(ht){nt(ht)}}getClusterLeaves(tt,nt){try{nt(null,this._geoJSONIndex.getLeaves(tt.clusterId,tt.limit,tt.offset))}catch(ht){nt(ht)}}}class sa{constructor(tt){this.self=tt,this.actor=new n.C(tt,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:I,geojson:Mr},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(nt,ht)=>{if(this.workerSourceTypes[nt])throw new Error(`Worker source with name \"${nt}\" already registered.`);this.workerSourceTypes[nt]=ht},this.self.registerRTLTextPlugin=nt=>{if(n.bD.isParsed())throw new Error(\"RTL text plugin already registered.\");n.bD.applyArabicShaping=nt.applyArabicShaping,n.bD.processBidirectionalText=nt.processBidirectionalText,n.bD.processStyledBidirectionalText=nt.processStyledBidirectionalText}}setReferrer(tt,nt){this.referrer=nt}setImages(tt,nt,ht){this.availableImages[tt]=nt;for(let vt in this.workerSources[tt]){let xt=this.workerSources[tt][vt];for(let _t in xt)xt[_t].availableImages=nt}ht()}setLayers(tt,nt,ht){this.getLayerIndex(tt).replace(nt),ht()}updateLayers(tt,nt,ht){this.getLayerIndex(tt).update(nt.layers,nt.removedIds),ht()}loadTile(tt,nt,ht){this.getWorkerSource(tt,nt.type,nt.source).loadTile(nt,ht)}loadDEMTile(tt,nt,ht){this.getDEMWorkerSource(tt,nt.source).loadTile(nt,ht)}reloadTile(tt,nt,ht){this.getWorkerSource(tt,nt.type,nt.source).reloadTile(nt,ht)}abortTile(tt,nt,ht){this.getWorkerSource(tt,nt.type,nt.source).abortTile(nt,ht)}removeTile(tt,nt,ht){this.getWorkerSource(tt,nt.type,nt.source).removeTile(nt,ht)}removeDEMTile(tt,nt){this.getDEMWorkerSource(tt,nt.source).removeTile(nt)}removeSource(tt,nt,ht){if(!this.workerSources[tt]||!this.workerSources[tt][nt.type]||!this.workerSources[tt][nt.type][nt.source])return;let vt=this.workerSources[tt][nt.type][nt.source];delete this.workerSources[tt][nt.type][nt.source],vt.removeSource!==void 0?vt.removeSource(nt,ht):ht()}loadWorkerSource(tt,nt,ht){try{this.self.importScripts(nt.url),ht()}catch(vt){ht(vt.toString())}}syncRTLPluginState(tt,nt,ht){try{n.bD.setState(nt);let vt=n.bD.getPluginURL();if(n.bD.isLoaded()&&!n.bD.isParsed()&&vt!=null){this.self.importScripts(vt);let xt=n.bD.isParsed();ht(xt?void 0:new Error(`RTL Text Plugin failed to import scripts from ${vt}`),xt)}}catch(vt){ht(vt.toString())}}getAvailableImages(tt){let nt=this.availableImages[tt];return nt||(nt=[]),nt}getLayerIndex(tt){let nt=this.layerIndexes[tt];return nt||(nt=this.layerIndexes[tt]=new o),nt}getWorkerSource(tt,nt,ht){return this.workerSources[tt]||(this.workerSources[tt]={}),this.workerSources[tt][nt]||(this.workerSources[tt][nt]={}),this.workerSources[tt][nt][ht]||(this.workerSources[tt][nt][ht]=new this.workerSourceTypes[nt]({send:(vt,xt,_t)=>{this.actor.send(vt,xt,_t,tt)}},this.getLayerIndex(tt),this.getAvailableImages(tt))),this.workerSources[tt][nt][ht]}getDEMWorkerSource(tt,nt){return this.demWorkerSources[tt]||(this.demWorkerSources[tt]={}),this.demWorkerSources[tt][nt]||(this.demWorkerSources[tt][nt]=new R),this.demWorkerSources[tt][nt]}}return n.i()&&(self.worker=new sa(self)),sa}),i([\"./shared\"],function(n){\"use strict\";var o=\"3.6.2\";class c{static testProp(l){if(!c.docStyle)return l[0];for(let d=0;d{window.removeEventListener(\"click\",c.suppressClickInternal,!0)},0)}static mousePos(l,d){let v=l.getBoundingClientRect();return new n.P(d.clientX-v.left-l.clientLeft,d.clientY-v.top-l.clientTop)}static touchPos(l,d){let v=l.getBoundingClientRect(),b=[];for(let M=0;M{l=[],d=0,v=0,b={}},T.addThrottleControl=W=>{let Z=v++;return b[Z]=W,Z},T.removeThrottleControl=W=>{delete b[W],B()},T.getImage=(W,Z,$=!0)=>{f.supported&&(W.headers||(W.headers={}),W.headers.accept=\"image/webp,*/*\");let st={requestParameters:W,supportImageRefresh:$,callback:Z,cancelled:!1,completed:!1,cancel:()=>{st.completed||st.cancelled||(st.cancelled=!0,st.innerRequest&&(st.innerRequest.cancel(),d--),B())}};return l.push(st),B(),st};let M=W=>{let{requestParameters:Z,supportImageRefresh:$,callback:st}=W;return n.e(Z,{type:\"image\"}),($!==!1||n.i()||n.g(Z.url)||Z.headers&&!Object.keys(Z.headers).reduce((At,pt)=>At&&pt===\"accept\",!0)?n.m:U)(Z,(At,pt,yt,dt)=>{O(W,st,At,pt,yt,dt)})},O=(W,Z,$,st,At,pt)=>{$?Z($):st instanceof HTMLImageElement||n.a(st)?Z(null,st):st&&((yt,dt)=>{typeof createImageBitmap==\"function\"?n.b(yt,dt):n.d(yt,dt)})(st,(yt,dt)=>{yt!=null?Z(yt):dt!=null&&Z(null,dt,{cacheControl:At,expires:pt})}),W.cancelled||(W.completed=!0,d--,B())},B=()=>{let W=(()=>{let Z=Object.keys(b),$=!1;if(Z.length>0){for(let st of Z)if($=b[st](),$)break}return $})()?n.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:n.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let Z=d;Z0;Z++){let $=l.shift();if($.cancelled){Z--;continue}let st=M($);d++,$.innerRequest=st}},U=(W,Z)=>{let $=new Image,st=W.url,At=!1,pt=W.credentials;return pt&&pt===\"include\"?$.crossOrigin=\"use-credentials\":(pt&&pt===\"same-origin\"||!n.s(st))&&($.crossOrigin=\"anonymous\"),$.fetchPriority=\"high\",$.onload=()=>{Z(null,$),$.onerror=$.onload=null},$.onerror=()=>{At||Z(new Error(\"Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.\")),$.onerror=$.onload=null},$.src=st,{cancel:()=>{At=!0,$.src=\"\"}}}}(j||(j={})),j.resetRequestQueue(),function(T){T.Glyphs=\"Glyphs\",T.Image=\"Image\",T.Source=\"Source\",T.SpriteImage=\"SpriteImage\",T.SpriteJSON=\"SpriteJSON\",T.Style=\"Style\",T.Tile=\"Tile\",T.Unknown=\"Unknown\"}(Q||(Q={}));class et{constructor(l){this._transformRequestFn=l}transformRequest(l,d){return this._transformRequestFn&&this._transformRequestFn(l,d)||{url:l}}normalizeSpriteURL(l,d,v){let b=function(M){let O=M.match(Y);if(!O)throw new Error(`Unable to parse URL \"${M}\"`);return{protocol:O[1],authority:O[2],path:O[3]||\"/\",params:O[4]?O[4].split(\"&\"):[]}}(l);return b.path+=`${d}${v}`,function(M){let O=M.params.length?`?${M.params.join(\"&\")}`:\"\";return`${M.protocol}://${M.authority}${M.path}${O}`}(b)}setTransformRequest(l){this._transformRequestFn=l}}let Y=/^(\\w+):\\/\\/([^/?]*)(\\/[^?]+)?\\??(.+)?/;function K(T){var l=new n.A(3);return l[0]=T[0],l[1]=T[1],l[2]=T[2],l}var J,ut=function(T,l,d){return T[0]=l[0]-d[0],T[1]=l[1]-d[1],T[2]=l[2]-d[2],T};J=new n.A(3),n.A!=Float32Array&&(J[0]=0,J[1]=0,J[2]=0);var Et=function(T){var l=T[0],d=T[1];return l*l+d*d};function kt(T){let l=[];if(typeof T==\"string\")l.push({id:\"default\",url:T});else if(T&&T.length>0){let d=[];for(let{id:v,url:b}of T){let M=`${v}${b}`;d.indexOf(M)===-1&&(d.push(M),l.push({id:v,url:b}))}}return l}function Xt(T,l,d,v,b){if(v)return void T(v);if(b!==Object.values(l).length||b!==Object.values(d).length)return;let M={};for(let O in l){M[O]={};let B=n.h.getImageCanvasContext(d[O]),U=l[O];for(let W in U){let{width:Z,height:$,x:st,y:At,sdf:pt,pixelRatio:yt,stretchX:dt,stretchY:Ft,content:Ht}=U[W];M[O][W]={data:null,pixelRatio:yt,sdf:pt,stretchX:dt,stretchY:Ft,content:Ht,spriteData:{width:Z,height:$,x:st,y:At,context:B}}}}T(null,M)}(function(){var T=new n.A(2);n.A!=Float32Array&&(T[0]=0,T[1]=0)})();class qt{constructor(l,d,v,b){this.context=l,this.format=v,this.texture=l.gl.createTexture(),this.update(d,b)}update(l,d,v){let{width:b,height:M}=l,O=!(this.size&&this.size[0]===b&&this.size[1]===M||v),{context:B}=this,{gl:U}=B;if(this.useMipmap=!!(d&&d.useMipmap),U.bindTexture(U.TEXTURE_2D,this.texture),B.pixelStoreUnpackFlipY.set(!1),B.pixelStoreUnpack.set(1),B.pixelStoreUnpackPremultiplyAlpha.set(this.format===U.RGBA&&(!d||d.premultiply!==!1)),O)this.size=[b,M],l instanceof HTMLImageElement||l instanceof HTMLCanvasElement||l instanceof HTMLVideoElement||l instanceof ImageData||n.a(l)?U.texImage2D(U.TEXTURE_2D,0,this.format,this.format,U.UNSIGNED_BYTE,l):U.texImage2D(U.TEXTURE_2D,0,this.format,b,M,0,this.format,U.UNSIGNED_BYTE,l.data);else{let{x:W,y:Z}=v||{x:0,y:0};l instanceof HTMLImageElement||l instanceof HTMLCanvasElement||l instanceof HTMLVideoElement||l instanceof ImageData||n.a(l)?U.texSubImage2D(U.TEXTURE_2D,0,W,Z,U.RGBA,U.UNSIGNED_BYTE,l):U.texSubImage2D(U.TEXTURE_2D,0,W,Z,b,M,U.RGBA,U.UNSIGNED_BYTE,l.data)}this.useMipmap&&this.isSizePowerOfTwo()&&U.generateMipmap(U.TEXTURE_2D)}bind(l,d,v){let{context:b}=this,{gl:M}=b;M.bindTexture(M.TEXTURE_2D,this.texture),v!==M.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(v=M.LINEAR),l!==this.filter&&(M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MAG_FILTER,l),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MIN_FILTER,v||l),this.filter=l),d!==this.wrap&&(M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_S,d),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_T,d),this.wrap=d)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:l}=this.context;l.deleteTexture(this.texture),this.texture=null}}function le(T){let{userImage:l}=T;return!!(l&&l.render&&l.render())&&(T.data.replace(new Uint8Array(l.data.buffer)),!0)}class ue extends n.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new n.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(l){if(this.loaded!==l&&(this.loaded=l,l)){for(let{ids:d,callback:v}of this.requestors)this._notify(d,v);this.requestors=[]}}getImage(l){let d=this.images[l];if(d&&!d.data&&d.spriteData){let v=d.spriteData;d.data=new n.R({width:v.width,height:v.height},v.context.getImageData(v.x,v.y,v.width,v.height).data),d.spriteData=null}return d}addImage(l,d){if(this.images[l])throw new Error(`Image id ${l} already exist, use updateImage instead`);this._validate(l,d)&&(this.images[l]=d)}_validate(l,d){let v=!0,b=d.data||d.spriteData;return this._validateStretch(d.stretchX,b&&b.width)||(this.fire(new n.j(new Error(`Image \"${l}\" has invalid \"stretchX\" value`))),v=!1),this._validateStretch(d.stretchY,b&&b.height)||(this.fire(new n.j(new Error(`Image \"${l}\" has invalid \"stretchY\" value`))),v=!1),this._validateContent(d.content,d)||(this.fire(new n.j(new Error(`Image \"${l}\" has invalid \"content\" value`))),v=!1),v}_validateStretch(l,d){if(!l)return!0;let v=0;for(let b of l){if(b[0]-1);U++,M[U]=B,O[U]=W,O[U+1]=De}for(let B=0,U=0;B{let B=this.entries[b];B||(B=this.entries[b]={glyphs:{},requests:{},ranges:{}});let U=B.glyphs[M];if(U!==void 0)return void O(null,{stack:b,id:M,glyph:U});if(U=this._tinySDF(B,b,M),U)return B.glyphs[M]=U,void O(null,{stack:b,id:M,glyph:U});let W=Math.floor(M/256);if(256*W>65535)return void O(new Error(\"glyphs > 65535 not supported\"));if(B.ranges[W])return void O(null,{stack:b,id:M,glyph:U});if(!this.url)return void O(new Error(\"glyphsUrl is not set\"));let Z=B.requests[W];Z||(Z=B.requests[W]=[],Sr.loadGlyphRange(b,W,this.url,this.requestManager,($,st)=>{if(st){for(let At in st)this._doesCharSupportLocalGlyph(+At)||(B.glyphs[+At]=st[+At]);B.ranges[W]=!0}for(let At of Z)At($,st);delete B.requests[W]})),Z.push(($,st)=>{$?O($):st&&O(null,{stack:b,id:M,glyph:st[M]||null})})},(b,M)=>{if(b)d(b);else if(M){let O={};for(let{stack:B,id:U,glyph:W}of M)(O[B]||(O[B]={}))[U]=W&&{id:W.id,bitmap:W.bitmap.clone(),metrics:W.metrics};d(null,O)}})}_doesCharSupportLocalGlyph(l){return!!this.localIdeographFontFamily&&(n.u[\"CJK Unified Ideographs\"](l)||n.u[\"Hangul Syllables\"](l)||n.u.Hiragana(l)||n.u.Katakana(l))}_tinySDF(l,d,v){let b=this.localIdeographFontFamily;if(!b||!this._doesCharSupportLocalGlyph(v))return;let M=l.tinySDF;if(!M){let B=\"400\";/bold/i.test(d)?B=\"900\":/medium/i.test(d)?B=\"500\":/light/i.test(d)&&(B=\"200\"),M=l.tinySDF=new Sr.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:b,fontWeight:B})}let O=M.draw(String.fromCharCode(v));return{id:v,bitmap:new n.q({width:O.width||60,height:O.height||60},O.data),metrics:{width:O.glyphWidth/2||24,height:O.glyphHeight/2||24,left:O.glyphLeft/2+.5||0,top:O.glyphTop/2-27.5||-8,advance:O.glyphAdvance/2||24,isDoubleResolution:!0}}}}Sr.loadGlyphRange=function(T,l,d,v,b){let M=256*l,O=M+255,B=v.transformRequest(d.replace(\"{fontstack}\",T).replace(\"{range}\",`${M}-${O}`),Q.Glyphs);n.l(B,(U,W)=>{if(U)b(U);else if(W){let Z={};for(let $ of n.n(W))Z[$.id]=$;b(null,Z)}})},Sr.TinySDF=class{constructor({fontSize:T=24,buffer:l=3,radius:d=8,cutoff:v=.25,fontFamily:b=\"sans-serif\",fontWeight:M=\"normal\",fontStyle:O=\"normal\"}={}){this.buffer=l,this.cutoff=v,this.radius=d;let B=this.size=T+4*l,U=this._createCanvas(B),W=this.ctx=U.getContext(\"2d\",{willReadFrequently:!0});W.font=`${O} ${M} ${T}px ${b}`,W.textBaseline=\"alphabetic\",W.textAlign=\"left\",W.fillStyle=\"black\",this.gridOuter=new Float64Array(B*B),this.gridInner=new Float64Array(B*B),this.f=new Float64Array(B),this.z=new Float64Array(B+1),this.v=new Uint16Array(B)}_createCanvas(T){let l=document.createElement(\"canvas\");return l.width=l.height=T,l}draw(T){let{width:l,actualBoundingBoxAscent:d,actualBoundingBoxDescent:v,actualBoundingBoxLeft:b,actualBoundingBoxRight:M}=this.ctx.measureText(T),O=Math.ceil(d),B=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(M-b))),U=Math.min(this.size-this.buffer,O+Math.ceil(v)),W=B+2*this.buffer,Z=U+2*this.buffer,$=Math.max(W*Z,0),st=new Uint8ClampedArray($),At={data:st,width:W,height:Z,glyphWidth:B,glyphHeight:U,glyphTop:O,glyphLeft:0,glyphAdvance:l};if(B===0||U===0)return At;let{ctx:pt,buffer:yt,gridInner:dt,gridOuter:Ft}=this;pt.clearRect(yt,yt,B,U),pt.fillText(T,yt,yt+O);let Ht=pt.getImageData(yt,yt,B,U);Ft.fill(De,0,$),dt.fill(0,0,$);for(let St=0;St0?oe*oe:0,dt[$t]=oe<0?oe*oe:0}}Ke(Ft,0,0,W,Z,W,this.f,this.v,this.z),Ke(dt,yt,yt,B,U,W,this.f,this.v,this.z);for(let St=0;St<$;St++){let Bt=Math.sqrt(Ft[St])-Math.sqrt(dt[St]);st[St]=Math.round(255-255*(Bt/this.radius+this.cutoff))}return At}};class Li{constructor(){this.specification=n.v.light.position}possiblyEvaluate(l,d){return n.z(l.expression.evaluate(d))}interpolate(l,d,v){return{x:n.B.number(l.x,d.x,v),y:n.B.number(l.y,d.y,v),z:n.B.number(l.z,d.z,v)}}}let oo;class zl extends n.E{constructor(l){super(),oo=oo||new n.r({anchor:new n.D(n.v.light.anchor),position:new Li,color:new n.D(n.v.light.color),intensity:new n.D(n.v.light.intensity)}),this._transitionable=new n.T(oo),this.setLight(l),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(l,d={}){if(!this._validate(n.t,l,d))for(let v in l){let b=l[v];v.endsWith(\"-transition\")?this._transitionable.setTransition(v.slice(0,-11),b):this._transitionable.setValue(v,b)}}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,d,v){return(!v||v.validate!==!1)&&n.x(this,l.call(n.y,n.e({value:d,style:{glyphs:!0,sprite:!0},styleSpec:n.v})))}}class No{constructor(l,d){this.width=l,this.height=d,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(l,d){let v=l.join(\",\")+String(d);return this.dashEntry[v]||(this.dashEntry[v]=this.addDash(l,d)),this.dashEntry[v]}getDashRanges(l,d,v){let b=[],M=l.length%2==1?-l[l.length-1]*v:0,O=l[0]*v,B=!0;b.push({left:M,right:O,isDash:B,zeroLength:l[0]===0});let U=l[0];for(let W=1;W1&&(U=l[++B]);let Z=Math.abs(W-U.left),$=Math.abs(W-U.right),st=Math.min(Z,$),At,pt=M/v*(b+1);if(U.isDash){let yt=b-Math.abs(pt);At=Math.sqrt(st*st+yt*yt)}else At=b-Math.sqrt(st*st+pt*pt);this.data[O+W]=Math.max(0,Math.min(255,At+128))}}}addRegularDash(l){for(let B=l.length-1;B>=0;--B){let U=l[B],W=l[B+1];U.zeroLength?l.splice(B,1):W&&W.isDash===U.isDash&&(W.left=U.left,l.splice(B,1))}let d=l[0],v=l[l.length-1];d.isDash===v.isDash&&(d.left=v.left-this.width,v.right=d.right+this.width);let b=this.width*this.nextRow,M=0,O=l[M];for(let B=0;B1&&(O=l[++M]);let U=Math.abs(B-O.left),W=Math.abs(B-O.right),Z=Math.min(U,W);this.data[b+B]=Math.max(0,Math.min(255,(O.isDash?Z:-Z)+128))}}addDash(l,d){let v=d?7:0,b=2*v+1;if(this.nextRow+b>this.height)return n.w(\"LineAtlas out of space\"),null;let M=0;for(let B=0;B{b.send(l,d,M)},v=v||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(l=!0){this.actors.forEach(d=>{d.remove()}),this.actors=[],l&&this.workerPool.release(this.id)}}function Uo(T,l,d){let v=function(b,M){if(b)return d(b);if(M){let O=n.F(n.e(M,T),[\"tiles\",\"minzoom\",\"maxzoom\",\"attribution\",\"bounds\",\"scheme\",\"tileSize\",\"encoding\"]);M.vector_layers&&(O.vectorLayers=M.vector_layers,O.vectorLayerIds=O.vectorLayers.map(B=>B.id)),d(null,O)}};return T.url?n.f(l.transformRequest(T.url,Q.Source),v):n.h.frame(()=>v(null,T))}class Si{constructor(l,d){l&&(d?this.setSouthWest(l).setNorthEast(d):Array.isArray(l)&&(l.length===4?this.setSouthWest([l[0],l[1]]).setNorthEast([l[2],l[3]]):this.setSouthWest(l[0]).setNorthEast(l[1])))}setNorthEast(l){return this._ne=l instanceof n.L?new n.L(l.lng,l.lat):n.L.convert(l),this}setSouthWest(l){return this._sw=l instanceof n.L?new n.L(l.lng,l.lat):n.L.convert(l),this}extend(l){let d=this._sw,v=this._ne,b,M;if(l instanceof n.L)b=l,M=l;else{if(!(l instanceof Si))return Array.isArray(l)?l.length===4||l.every(Array.isArray)?this.extend(Si.convert(l)):this.extend(n.L.convert(l)):l&&(\"lng\"in l||\"lon\"in l)&&\"lat\"in l?this.extend(n.L.convert(l)):this;if(b=l._sw,M=l._ne,!b||!M)return this}return d||v?(d.lng=Math.min(b.lng,d.lng),d.lat=Math.min(b.lat,d.lat),v.lng=Math.max(M.lng,v.lng),v.lat=Math.max(M.lat,v.lat)):(this._sw=new n.L(b.lng,b.lat),this._ne=new n.L(M.lng,M.lat)),this}getCenter(){return new n.L((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new n.L(this.getWest(),this.getNorth())}getSouthEast(){return new n.L(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(l){let{lng:d,lat:v}=n.L.convert(l),b=this._sw.lng<=d&&d<=this._ne.lng;return this._sw.lng>this._ne.lng&&(b=this._sw.lng>=d&&d>=this._ne.lng),this._sw.lat<=v&&v<=this._ne.lat&&b}static convert(l){return l instanceof Si?l:l&&new Si(l)}static fromLngLat(l,d=0){let v=360*d/40075017,b=v/Math.cos(Math.PI/180*l.lat);return new Si(new n.L(l.lng-b,l.lat-v),new n.L(l.lng+b,l.lat+v))}}class Ns{constructor(l,d,v){this.bounds=Si.convert(this.validateBounds(l)),this.minzoom=d||0,this.maxzoom=v||24}validateBounds(l){return Array.isArray(l)&&l.length===4?[Math.max(-180,l[0]),Math.max(-90,l[1]),Math.min(180,l[2]),Math.min(90,l[3])]:[-180,-90,180,90]}contains(l){let d=Math.pow(2,l.z),v=Math.floor(n.G(this.bounds.getWest())*d),b=Math.floor(n.H(this.bounds.getNorth())*d),M=Math.ceil(n.G(this.bounds.getEast())*d),O=Math.ceil(n.H(this.bounds.getSouth())*d);return l.x>=v&&l.x=b&&l.y{this._loaded=!1,this.fire(new n.k(\"dataloading\",{dataType:\"source\"})),this._tileJSONRequest=Uo(this._options,this.map._requestManager,(M,O)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),M?this.fire(new n.j(M)):O&&(n.e(this,O),O.bounds&&(this.tileBounds=new Ns(O.bounds,this.minzoom,this.maxzoom)),this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})),this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"content\"})))})},this.serialize=()=>n.e({},this._options),this.id=l,this.dispatcher=v,this.type=\"vector\",this.minzoom=0,this.maxzoom=22,this.scheme=\"xyz\",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,n.e(this,n.F(d,[\"url\",\"scheme\",\"tileSize\",\"promoteId\"])),this._options=n.e({type:\"vector\"},d),this._collectResourceTiming=d.collectResourceTiming,this.tileSize!==512)throw new Error(\"vector tile sources must have a tileSize of 512\");this.setEventedParent(b)}loaded(){return this._loaded}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}onAdd(l){this.map=l,this.load()}setSourceProperty(l){this._tileJSONRequest&&this._tileJSONRequest.cancel(),l(),this.load()}setTiles(l){return this.setSourceProperty(()=>{this._options.tiles=l}),this}setUrl(l){return this.setSourceProperty(()=>{this.url=l,this._options.url=l}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(l,d){let v=l.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),b={request:this.map._requestManager.transformRequest(v,Q.Tile),uid:l.uid,tileID:l.tileID,zoom:l.tileID.overscaledZ,tileSize:this.tileSize*l.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function M(O,B){return delete l.request,l.aborted?d(null):O&&O.status!==404?d(O):(B&&B.resourceTiming&&(l.resourceTiming=B.resourceTiming),this.map._refreshExpiredTiles&&B&&l.setExpiryData(B),l.loadVectorData(B,this.map.painter),d(null),void(l.reloadCallback&&(this.loadTile(l,l.reloadCallback),l.reloadCallback=null)))}b.request.collectResourceTiming=this._collectResourceTiming,l.actor&&l.state!==\"expired\"?l.state===\"loading\"?l.reloadCallback=d:l.request=l.actor.send(\"reloadTile\",b,M.bind(this)):(l.actor=this.dispatcher.getActor(),l.request=l.actor.send(\"loadTile\",b,M.bind(this)))}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.actor&&l.actor.send(\"abortTile\",{uid:l.uid,type:this.type,source:this.id},void 0)}unloadTile(l){l.unloadVectorData(),l.actor&&l.actor.send(\"removeTile\",{uid:l.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class kc extends n.E{constructor(l,d,v,b){super(),this.id=l,this.dispatcher=v,this.setEventedParent(b),this.type=\"raster\",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme=\"xyz\",this.tileSize=512,this._loaded=!1,this._options=n.e({type:\"raster\"},d),n.e(this,n.F(d,[\"url\",\"scheme\",\"tileSize\"]))}load(){this._loaded=!1,this.fire(new n.k(\"dataloading\",{dataType:\"source\"})),this._tileJSONRequest=Uo(this._options,this.map._requestManager,(l,d)=>{this._tileJSONRequest=null,this._loaded=!0,l?this.fire(new n.j(l)):d&&(n.e(this,d),d.bounds&&(this.tileBounds=new Ns(d.bounds,this.minzoom,this.maxzoom)),this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})),this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"content\"})))})}loaded(){return this._loaded}onAdd(l){this.map=l,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}setSourceProperty(l){this._tileJSONRequest&&this._tileJSONRequest.cancel(),l(),this.load()}setTiles(l){return this.setSourceProperty(()=>{this._options.tiles=l}),this}serialize(){return n.e({},this._options)}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}loadTile(l,d){let v=l.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);l.request=j.getImage(this.map._requestManager.transformRequest(v,Q.Tile),(b,M,O)=>{if(delete l.request,l.aborted)l.state=\"unloaded\",d(null);else if(b)l.state=\"errored\",d(b);else if(M){this.map._refreshExpiredTiles&&O&&l.setExpiryData(O);let B=this.map.painter.context,U=B.gl;l.texture=this.map.painter.getTileTexture(M.width),l.texture?l.texture.update(M,{useMipmap:!0}):(l.texture=new qt(B,M,U.RGBA,{useMipmap:!0}),l.texture.bind(U.LINEAR,U.CLAMP_TO_EDGE,U.LINEAR_MIPMAP_NEAREST),B.extTextureFilterAnisotropic&&U.texParameterf(U.TEXTURE_2D,B.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,B.extTextureFilterAnisotropicMax)),l.state=\"loaded\",d(null)}},this.map._refreshExpiredTiles)}abortTile(l,d){l.request&&(l.request.cancel(),delete l.request),d()}unloadTile(l,d){l.texture&&this.map.painter.saveTileTexture(l.texture),d()}hasTransition(){return!1}}class Rc extends kc{constructor(l,d,v,b){super(l,d,v,b),this.type=\"raster-dem\",this.maxzoom=22,this._options=n.e({type:\"raster-dem\"},d),this.encoding=d.encoding||\"mapbox\",this.redFactor=d.redFactor,this.greenFactor=d.greenFactor,this.blueFactor=d.blueFactor,this.baseShift=d.baseShift}loadTile(l,d){let v=l.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),b=this.map._requestManager.transformRequest(v,Q.Tile);function M(O,B){O&&(l.state=\"errored\",d(O)),B&&(l.dem=B,l.needsHillshadePrepare=!0,l.needsTerrainPrepare=!0,l.state=\"loaded\",d(null))}l.neighboringTiles=this._getNeighboringTiles(l.tileID),l.request=j.getImage(b,(O,B,U)=>n._(this,void 0,void 0,function*(){if(delete l.request,l.aborted)l.state=\"unloaded\",d(null);else if(O)l.state=\"errored\",d(O);else if(B){this.map._refreshExpiredTiles&&l.setExpiryData(U);let W=n.a(B)&&n.J()?B:yield function($){return n._(this,void 0,void 0,function*(){if(typeof VideoFrame<\"u\"&&n.K()){let st=$.width+2,At=$.height+2;try{return new n.R({width:st,height:At},yield n.M($,-1,-1,st,At))}catch{}}return n.h.getImageData($,1)})}(B),Z={uid:l.uid,coord:l.tileID,source:this.id,rawImageData:W,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};l.actor&&l.state!==\"expired\"||(l.actor=this.dispatcher.getActor(),l.actor.send(\"loadDEMTile\",Z,M))}}),this.map._refreshExpiredTiles)}_getNeighboringTiles(l){let d=l.canonical,v=Math.pow(2,d.z),b=(d.x-1+v)%v,M=d.x===0?l.wrap-1:l.wrap,O=(d.x+1+v)%v,B=d.x+1===v?l.wrap+1:l.wrap,U={};return U[new n.O(l.overscaledZ,M,d.z,b,d.y).key]={backfilled:!1},U[new n.O(l.overscaledZ,B,d.z,O,d.y).key]={backfilled:!1},d.y>0&&(U[new n.O(l.overscaledZ,M,d.z,b,d.y-1).key]={backfilled:!1},U[new n.O(l.overscaledZ,l.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},U[new n.O(l.overscaledZ,B,d.z,O,d.y-1).key]={backfilled:!1}),d.y+1{this._updateWorkerData()},this.serialize=()=>n.e({},this._options,{type:this.type,data:this._data}),this.id=l,this.type=\"geojson\",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=v.getActor(),this.setEventedParent(b),this._data=d.data,this._options=n.e({},d),this._collectResourceTiming=d.collectResourceTiming,d.maxzoom!==void 0&&(this.maxzoom=d.maxzoom),d.type&&(this.type=d.type),d.attribution&&(this.attribution=d.attribution),this.promoteId=d.promoteId;let M=n.N/this.tileSize;this.workerOptions=n.e({source:this.id,cluster:d.cluster||!1,geojsonVtOptions:{buffer:(d.buffer!==void 0?d.buffer:128)*M,tolerance:(d.tolerance!==void 0?d.tolerance:.375)*M,extent:n.N,maxZoom:this.maxzoom,lineMetrics:d.lineMetrics||!1,generateId:d.generateId||!1},superclusterOptions:{maxZoom:d.clusterMaxZoom!==void 0?d.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,d.clusterMinPoints||2),extent:n.N,radius:(d.clusterRadius||50)*M,log:!1,generateId:d.generateId||!1},clusterProperties:d.clusterProperties,filter:d.filter},d.workerOptions),typeof this.promoteId==\"string\"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(l){this.map=l,this.load()}setData(l){return this._data=l,this._updateWorkerData(),this}updateData(l){return this._updateWorkerData(l),this}setClusterOptions(l){return this.workerOptions.cluster=l.cluster,l&&(l.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=l.clusterRadius),l.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=l.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(l,d){return this.actor.send(\"geojson.getClusterExpansionZoom\",{clusterId:l,source:this.id},d),this}getClusterChildren(l,d){return this.actor.send(\"geojson.getClusterChildren\",{clusterId:l,source:this.id},d),this}getClusterLeaves(l,d,v,b){return this.actor.send(\"geojson.getClusterLeaves\",{source:this.id,clusterId:l,limit:d,offset:v},b),this}_updateWorkerData(l){let d=n.e({},this.workerOptions);l?d.dataDiff=l:typeof this._data==\"string\"?(d.request=this.map._requestManager.transformRequest(n.h.resolveURL(this._data),Q.Source),d.request.collectResourceTiming=this._collectResourceTiming):d.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new n.k(\"dataloading\",{dataType:\"source\"})),this.actor.send(`${this.type}.loadData`,d,(v,b)=>{if(this._pendingLoads--,this._removed||b&&b.abandoned)return void this.fire(new n.k(\"dataabort\",{dataType:\"source\"}));let M=null;if(b&&b.resourceTiming&&b.resourceTiming[this.id]&&(M=b.resourceTiming[this.id].slice(0)),v)return void this.fire(new n.j(v));let O={dataType:\"source\"};this._collectResourceTiming&&M&&M.length>0&&n.e(O,{resourceTiming:M}),this.fire(new n.k(\"data\",Object.assign(Object.assign({},O),{sourceDataType:\"metadata\"}))),this.fire(new n.k(\"data\",Object.assign(Object.assign({},O),{sourceDataType:\"content\"})))})}loaded(){return this._pendingLoads===0}loadTile(l,d){let v=l.actor?\"reloadTile\":\"loadTile\";l.actor=this.actor;let b={type:this.type,uid:l.uid,tileID:l.tileID,zoom:l.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};l.request=this.actor.send(v,b,(M,O)=>(delete l.request,l.unloadVectorData(),l.aborted?d(null):M?d(M):(l.loadVectorData(O,this.map.painter,v===\"reloadTile\"),d(null))))}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.aborted=!0}unloadTile(l){l.unloadVectorData(),this.actor.send(\"removeTile\",{uid:l.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send(\"removeSource\",{type:this.type,source:this.id})}hasTransition(){return!1}}var Jn=n.Q([{name:\"a_pos\",type:\"Int16\",components:2},{name:\"a_texture_pos\",type:\"Int16\",components:2}]);class ki extends n.E{constructor(l,d,v,b){super(),this.load=(M,O)=>{this._loaded=!1,this.fire(new n.k(\"dataloading\",{dataType:\"source\"})),this.url=this.options.url,this._request=j.getImage(this.map._requestManager.transformRequest(this.url,Q.Image),(B,U)=>{this._request=null,this._loaded=!0,B?this.fire(new n.j(B)):U&&(this.image=U,M&&(this.coordinates=M),O&&O(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;let M=this.map.painter.context,O=M.gl;this.boundsBuffer||(this.boundsBuffer=M.createVertexBuffer(this._boundsArray,Jn.members)),this.boundsSegments||(this.boundsSegments=n.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new qt(M,this.image,O.RGBA),this.texture.bind(O.LINEAR,O.CLAMP_TO_EDGE));let B=!1;for(let U in this.tiles){let W=this.tiles[U];W.state!==\"loaded\"&&(W.state=\"loaded\",W.texture=this.texture,B=!0)}B&&this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"idle\",sourceId:this.id}))},this.serialize=()=>({type:\"image\",url:this.options.url,coordinates:this.coordinates}),this.id=l,this.dispatcher=v,this.coordinates=d.coordinates,this.type=\"image\",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(b),this.options=d}loaded(){return this._loaded}updateImage(l){return l.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=l.url,this.load(l.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})))}onAdd(l){this.map=l,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(l){this.coordinates=l;let d=l.map(n.U.fromLngLat);this.tileID=function(b){let M=1/0,O=1/0,B=-1/0,U=-1/0;for(let st of b)M=Math.min(M,st.x),O=Math.min(O,st.y),B=Math.max(B,st.x),U=Math.max(U,st.y);let W=Math.max(B-M,U-O),Z=Math.max(0,Math.floor(-Math.log(W)/Math.LN2)),$=Math.pow(2,Z);return new n.W(Z,Math.floor((M+B)/2*$),Math.floor((O+U)/2*$))}(d),this.minzoom=this.maxzoom=this.tileID.z;let v=d.map(b=>this.tileID.getTilePoint(b)._round());return this._boundsArray=new n.V,this._boundsArray.emplaceBack(v[0].x,v[0].y,0,0),this._boundsArray.emplaceBack(v[1].x,v[1].y,n.N,0),this._boundsArray.emplaceBack(v[3].x,v[3].y,0,n.N),this._boundsArray.emplaceBack(v[2].x,v[2].y,n.N,n.N),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"content\"})),this}loadTile(l,d){this.tileID&&this.tileID.equals(l.tileID.canonical)?(this.tiles[String(l.tileID.wrap)]=l,l.buckets={},d(null)):(l.state=\"errored\",d(null))}hasTransition(){return!1}}class ts extends ki{constructor(l,d,v,b){super(l,d,v,b),this.load=()=>{this._loaded=!1;let M=this.options;this.urls=[];for(let O of M.urls)this.urls.push(this.map._requestManager.transformRequest(O,Q.Source).url);n.X(this.urls,(O,B)=>{this._loaded=!0,O?this.fire(new n.j(O)):B&&(this.video=B,this.video.loop=!0,this.video.addEventListener(\"playing\",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let M=this.map.painter.context,O=M.gl;this.boundsBuffer||(this.boundsBuffer=M.createVertexBuffer(this._boundsArray,Jn.members)),this.boundsSegments||(this.boundsSegments=n.S.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(O.LINEAR,O.CLAMP_TO_EDGE),O.texSubImage2D(O.TEXTURE_2D,0,0,0,O.RGBA,O.UNSIGNED_BYTE,this.video)):(this.texture=new qt(M,this.video,O.RGBA),this.texture.bind(O.LINEAR,O.CLAMP_TO_EDGE));let B=!1;for(let U in this.tiles){let W=this.tiles[U];W.state!==\"loaded\"&&(W.state=\"loaded\",W.texture=this.texture,B=!0)}B&&this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"idle\",sourceId:this.id}))},this.serialize=()=>({type:\"video\",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type=\"video\",this.options=d}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(l){if(this.video){let d=this.video.seekable;ld.end(0)?this.fire(new n.j(new n.Y(`sources.${this.id}`,null,`Playback for this video can be set only between the ${d.start(0)} and ${d.end(0)}-second mark.`))):this.video.currentTime=l}}getVideo(){return this.video}onAdd(l){this.map||(this.map=l,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}}class Vo extends ki{constructor(l,d,v,b){super(l,d,v,b),this.load=()=>{this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new n.j(new Error(\"Canvas dimensions cannot be less than or equal to zero.\"))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},this.prepare=()=>{let M=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,M=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,M=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let O=this.map.painter.context,B=O.gl;this.boundsBuffer||(this.boundsBuffer=O.createVertexBuffer(this._boundsArray,Jn.members)),this.boundsSegments||(this.boundsSegments=n.S.simpleSegment(0,0,4,2)),this.texture?(M||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new qt(O,this.canvas,B.RGBA,{premultiply:!0});let U=!1;for(let W in this.tiles){let Z=this.tiles[W];Z.state!==\"loaded\"&&(Z.state=\"loaded\",Z.texture=this.texture,U=!0)}U&&this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"idle\",sourceId:this.id}))},this.serialize=()=>({type:\"canvas\",coordinates:this.coordinates}),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(M=>!Array.isArray(M)||M.length!==2||M.some(O=>typeof O!=\"number\"))||this.fire(new n.j(new n.Y(`sources.${l}`,null,'\"coordinates\" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new n.j(new n.Y(`sources.${l}`,null,'missing required property \"coordinates\"'))),d.animate&&typeof d.animate!=\"boolean\"&&this.fire(new n.j(new n.Y(`sources.${l}`,null,'optional \"animate\" property must be a boolean value'))),d.canvas?typeof d.canvas==\"string\"||d.canvas instanceof HTMLCanvasElement||this.fire(new n.j(new n.Y(`sources.${l}`,null,'\"canvas\" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new n.j(new n.Y(`sources.${l}`,null,'missing required property \"canvas\"'))),this.options=d,this.animate=d.animate===void 0||d.animate}getCanvas(){return this.canvas}onAdd(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let l of[this.canvas.width,this.canvas.height])if(isNaN(l)||l<=0)return!0;return!1}}let cl={},xo=T=>{switch(T){case\"geojson\":return Xi;case\"image\":return ki;case\"raster\":return kc;case\"raster-dem\":return Rc;case\"vector\":return ll;case\"video\":return ts;case\"canvas\":return Vo}return cl[T]};function Pa(T,l){let d=n.Z();return n.$(d,d,[1,1,0]),n.a0(d,d,[.5*T.width,.5*T.height,1]),n.a1(d,d,T.calculatePosMatrix(l.toUnwrapped()))}function na(T,l,d,v,b,M){let O=function($,st,At){if($)for(let pt of $){let yt=st[pt];if(yt&&yt.source===At&&yt.type===\"fill-extrusion\")return!0}else for(let pt in st){let yt=st[pt];if(yt.source===At&&yt.type===\"fill-extrusion\")return!0}return!1}(b&&b.layers,l,T.id),B=M.maxPitchScaleFactor(),U=T.tilesIn(v,B,O);U.sort(as);let W=[];for(let $ of U)W.push({wrappedTileID:$.tileID.wrapped().key,queryResults:$.tile.queryRenderedFeatures(l,d,T._state,$.queryGeometry,$.cameraQueryGeometry,$.scale,b,M,B,Pa(T.transform,$.tileID))});let Z=function($){let st={},At={};for(let pt of $){let yt=pt.queryResults,dt=pt.wrappedTileID,Ft=At[dt]=At[dt]||{};for(let Ht in yt){let St=yt[Ht],Bt=Ft[Ht]=Ft[Ht]||{},Qt=st[Ht]=st[Ht]||[];for(let $t of St)Bt[$t.featureIndex]||(Bt[$t.featureIndex]=!0,Qt.push($t))}}return st}(W);for(let $ in Z)Z[$].forEach(st=>{let At=st.feature,pt=T.getFeatureState(At.layer[\"source-layer\"],At.id);At.source=At.layer.source,At.layer[\"source-layer\"]&&(At.sourceLayer=At.layer[\"source-layer\"]),At.state=pt});return Z}function as(T,l){let d=T.tileID,v=l.tileID;return d.overscaledZ-v.overscaledZ||d.canonical.y-v.canonical.y||d.wrap-v.wrap||d.canonical.x-v.canonical.x}class ao{constructor(l,d){this.timeAdded=0,this.fadeEndTime=0,this.tileID=l,this.uid=n.a2(),this.uses=0,this.tileSize=d,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state=\"loading\"}registerFadeDuration(l){let d=l+this.timeAdded;dM.getLayer(W)).filter(Boolean);if(U.length!==0){B.layers=U,B.stateDependentLayerIds&&(B.stateDependentLayers=B.stateDependentLayerIds.map(W=>U.filter(Z=>Z.id===W)[0]));for(let W of U)O[W.id]=B}}return O}(l.buckets,d.style),this.hasSymbolBuckets=!1;for(let b in this.buckets){let M=this.buckets[b];if(M instanceof n.a4){if(this.hasSymbolBuckets=!0,!v)break;M.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let b in this.buckets){let M=this.buckets[b];if(M instanceof n.a4&&M.hasRTLText){this.hasRTLText=!0,n.a5();break}}this.queryPadding=0;for(let b in this.buckets){let M=this.buckets[b];this.queryPadding=Math.max(this.queryPadding,d.style.getLayer(b).queryRadius(M))}l.imageAtlas&&(this.imageAtlas=l.imageAtlas),l.glyphAtlasImage&&(this.glyphAtlasImage=l.glyphAtlasImage)}else this.collisionBoxArray=new n.a3}unloadVectorData(){for(let l in this.buckets)this.buckets[l].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state=\"unloaded\"}getBucket(l){return this.buckets[l.id]}upload(l){for(let v in this.buckets){let b=this.buckets[v];b.uploadPending()&&b.upload(l)}let d=l.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new qt(l,this.imageAtlas.image,d.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new qt(l,this.glyphAtlasImage,d.ALPHA),this.glyphAtlasImage=null)}prepare(l){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(l,this.imageAtlasTexture)}queryRenderedFeatures(l,d,v,b,M,O,B,U,W,Z){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:b,cameraQueryGeometry:M,scale:O,tileSize:this.tileSize,pixelPosMatrix:Z,transform:U,params:B,queryPadding:this.queryPadding*W},l,d,v):{}}querySourceFeatures(l,d){let v=this.latestFeatureIndex;if(!v||!v.rawTileData)return;let b=v.loadVTLayers(),M=d&&d.sourceLayer?d.sourceLayer:\"\",O=b._geojsonTileLayer||b[M];if(!O)return;let B=n.a6(d&&d.filter),{z:U,x:W,y:Z}=this.tileID.canonical,$={z:U,x:W,y:Z};for(let st=0;stv)b=!1;else if(d)if(this.expirationTime{this.remove(l,M)},v)),this.data[b].push(M),this.order.push(b),this.order.length>this.max){let O=this._getAndRemoveByKey(this.order[0]);O&&this.onRemove(O)}return this}has(l){return l.wrapped().key in this.data}getAndRemove(l){return this.has(l)?this._getAndRemoveByKey(l.wrapped().key):null}_getAndRemoveByKey(l){let d=this.data[l].shift();return d.timeout&&clearTimeout(d.timeout),this.data[l].length===0&&delete this.data[l],this.order.splice(this.order.indexOf(l),1),d.value}getByKey(l){let d=this.data[l];return d?d[0].value:null}get(l){return this.has(l)?this.data[l.wrapped().key][0].value:null}remove(l,d){if(!this.has(l))return this;let v=l.wrapped().key,b=d===void 0?0:this.data[v].indexOf(d),M=this.data[v][b];return this.data[v].splice(b,1),M.timeout&&clearTimeout(M.timeout),this.data[v].length===0&&delete this.data[v],this.onRemove(M.value),this.order.splice(this.order.indexOf(v),1),this}setMaxSize(l){for(this.max=l;this.order.length>this.max;){let d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this}filter(l){let d=[];for(let v in this.data)for(let b of this.data[v])l(b.value)||d.push(b);for(let v of d)this.remove(v.value.tileID,v)}}class ee{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(l,d,v){let b=String(d);if(this.stateChanges[l]=this.stateChanges[l]||{},this.stateChanges[l][b]=this.stateChanges[l][b]||{},n.e(this.stateChanges[l][b],v),this.deletedStates[l]===null){this.deletedStates[l]={};for(let M in this.state[l])M!==b&&(this.deletedStates[l][M]=null)}else if(this.deletedStates[l]&&this.deletedStates[l][b]===null){this.deletedStates[l][b]={};for(let M in this.state[l][b])v[M]||(this.deletedStates[l][b][M]=null)}else for(let M in v)this.deletedStates[l]&&this.deletedStates[l][b]&&this.deletedStates[l][b][M]===null&&delete this.deletedStates[l][b][M]}removeFeatureState(l,d,v){if(this.deletedStates[l]===null)return;let b=String(d);if(this.deletedStates[l]=this.deletedStates[l]||{},v&&d!==void 0)this.deletedStates[l][b]!==null&&(this.deletedStates[l][b]=this.deletedStates[l][b]||{},this.deletedStates[l][b][v]=null);else if(d!==void 0)if(this.stateChanges[l]&&this.stateChanges[l][b])for(v in this.deletedStates[l][b]={},this.stateChanges[l][b])this.deletedStates[l][b][v]=null;else this.deletedStates[l][b]=null;else this.deletedStates[l]=null}getState(l,d){let v=String(d),b=n.e({},(this.state[l]||{})[v],(this.stateChanges[l]||{})[v]);if(this.deletedStates[l]===null)return{};if(this.deletedStates[l]){let M=this.deletedStates[l][d];if(M===null)return{};for(let O in M)delete b[O]}return b}initializeTileState(l,d){l.setFeatureState(this.state,d)}coalesceChanges(l,d){let v={};for(let b in this.stateChanges){this.state[b]=this.state[b]||{};let M={};for(let O in this.stateChanges[b])this.state[b][O]||(this.state[b][O]={}),n.e(this.state[b][O],this.stateChanges[b][O]),M[O]=this.state[b][O];v[b]=M}for(let b in this.deletedStates){this.state[b]=this.state[b]||{};let M={};if(this.deletedStates[b]===null)for(let O in this.state[b])M[O]={},this.state[b][O]={};else for(let O in this.deletedStates[b]){if(this.deletedStates[b][O]===null)this.state[b][O]={};else for(let B of Object.keys(this.deletedStates[b][O]))delete this.state[b][O][B];M[O]=this.state[b][O]}v[b]=v[b]||{},n.e(v[b],M)}if(this.stateChanges={},this.deletedStates={},Object.keys(v).length!==0)for(let b in l)l[b].setFeatureState(v,d)}}class ls extends n.E{constructor(l,d,v){super(),this.id=l,this.dispatcher=v,this.on(\"data\",b=>{b.dataType===\"source\"&&b.sourceDataType===\"metadata\"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&b.dataType===\"source\"&&b.sourceDataType===\"content\"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on(\"dataloading\",()=>{this._sourceErrored=!1}),this.on(\"error\",()=>{this._sourceErrored=this._source.loaded()}),this._source=((b,M,O,B)=>{let U=new(xo(M.type))(b,M,O,B);if(U.id!==b)throw new Error(`Expected Source id to be ${b} instead of ${U.id}`);return U})(l,d,v,this),this._tiles={},this._cache=new Nl(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ee,this._didEmitContent=!1,this._updated=!1}onAdd(l){this.map=l,this._maxTileCacheSize=l?l._maxTileCacheSize:null,this._maxTileCacheZoomLevels=l?l._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(l)}onRemove(l){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(l)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let l in this._tiles){let d=this._tiles[l];if(d.state!==\"loaded\"&&d.state!==\"errored\")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let l=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,l&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(l,d){return this._source.loadTile(l,d)}_unloadTile(l){if(this._source.unloadTile)return this._source.unloadTile(l,()=>{})}_abortTile(l){this._source.abortTile&&this._source.abortTile(l,()=>{}),this._source.fire(new n.k(\"dataabort\",{tile:l,coord:l.tileID,dataType:\"source\"}))}serialize(){return this._source.serialize()}prepare(l){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let d in this._tiles){let v=this._tiles[d];v.upload(l),v.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(l=>l.tileID).sort(mn).map(l=>l.key)}getRenderableIds(l){let d=[];for(let v in this._tiles)this._isIdRenderable(v,l)&&d.push(this._tiles[v]);return l?d.sort((v,b)=>{let M=v.tileID,O=b.tileID,B=new n.P(M.canonical.x,M.canonical.y)._rotate(this.transform.angle),U=new n.P(O.canonical.x,O.canonical.y)._rotate(this.transform.angle);return M.overscaledZ-O.overscaledZ||U.y-B.y||U.x-B.x}).map(v=>v.tileID.key):d.map(v=>v.tileID).sort(mn).map(v=>v.key)}hasRenderableParent(l){let d=this.findLoadedParent(l,0);return!!d&&this._isIdRenderable(d.tileID.key)}_isIdRenderable(l,d){return this._tiles[l]&&this._tiles[l].hasData()&&!this._coveredTiles[l]&&(d||!this._tiles[l].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let l in this._tiles)this._tiles[l].state!==\"errored\"&&this._reloadTile(l,\"reloading\")}}_reloadTile(l,d){let v=this._tiles[l];v&&(v.state!==\"loading\"&&(v.state=d),this._loadTile(v,this._tileLoaded.bind(this,v,l,d)))}_tileLoaded(l,d,v,b){if(b)return l.state=\"errored\",void(b.status!==404?this._source.fire(new n.j(b,{tile:l})):this.update(this.transform,this.terrain));l.timeAdded=n.h.now(),v===\"expired\"&&(l.refreshedUponExpiration=!0),this._setTileReloadTimer(d,l),this.getSource().type===\"raster-dem\"&&l.dem&&this._backfillDEM(l),this._state.initializeTileState(l,this.map?this.map.painter:null),l.aborted||this._source.fire(new n.k(\"data\",{dataType:\"source\",tile:l,coord:l.tileID}))}_backfillDEM(l){let d=this.getRenderableIds();for(let b=0;b1||(Math.abs(O)>1&&(Math.abs(O+U)===1?O+=U:Math.abs(O-U)===1&&(O-=U)),M.dem&&b.dem&&(b.dem.backfillBorder(M.dem,O,B),b.neighboringTiles&&b.neighboringTiles[W]&&(b.neighboringTiles[W].backfilled=!0)))}}getTile(l){return this.getTileByID(l.key)}getTileByID(l){return this._tiles[l]}_retainLoadedChildren(l,d,v,b){for(let M in this._tiles){let O=this._tiles[M];if(b[M]||!O.hasData()||O.tileID.overscaledZ<=d||O.tileID.overscaledZ>v)continue;let B=O.tileID;for(;O&&O.tileID.overscaledZ>d+1;){let W=O.tileID.scaledTo(O.tileID.overscaledZ-1);O=this._tiles[W.key],O&&O.hasData()&&(B=W)}let U=B;for(;U.overscaledZ>d;)if(U=U.scaledTo(U.overscaledZ-1),l[U.key]){b[B.key]=B;break}}}findLoadedParent(l,d){if(l.key in this._loadedParentTiles){let v=this._loadedParentTiles[l.key];return v&&v.tileID.overscaledZ>=d?v:null}for(let v=l.overscaledZ-1;v>=d;v--){let b=l.scaledTo(v),M=this._getLoadedTile(b);if(M)return M}}_getLoadedTile(l){let d=this._tiles[l.key];return d&&d.hasData()?d:this._cache.getByKey(l.wrapped().key)}updateCacheSize(l){let d=Math.ceil(l.width/this._source.tileSize)+1,v=Math.ceil(l.height/this._source.tileSize)+1,b=Math.floor(d*v*(this._maxTileCacheZoomLevels===null?n.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),M=typeof this._maxTileCacheSize==\"number\"?Math.min(this._maxTileCacheSize,b):b;this._cache.setMaxSize(M)}handleWrapJump(l){let d=Math.round((l-(this._prevLng===void 0?l:this._prevLng))/360);if(this._prevLng=l,d){let v={};for(let b in this._tiles){let M=this._tiles[b];M.tileID=M.tileID.unwrapTo(M.tileID.wrap+d),v[M.tileID.key]=M}this._tiles=v;for(let b in this._timers)clearTimeout(this._timers[b]),delete this._timers[b];for(let b in this._tiles)this._setTileReloadTimer(b,this._tiles[b])}}update(l,d){if(this.transform=l,this.terrain=d,!this._sourceLoaded||this._paused)return;let v;this.updateCacheSize(l),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?v=l.getVisibleUnwrappedCoordinates(this._source.tileID).map(Z=>new n.O(Z.canonical.z,Z.wrap,Z.canonical.z,Z.canonical.x,Z.canonical.y)):(v=l.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:d}),this._source.hasTile&&(v=v.filter(Z=>this._source.hasTile(Z)))):v=[];let b=l.coveringZoomLevel(this._source),M=Math.max(b-ls.maxOverzooming,this._source.minzoom),O=Math.max(b+ls.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let Z={};for(let $ of v)if($.canonical.z>this._source.minzoom){let st=$.scaledTo($.canonical.z-1);Z[st.key]=st;let At=$.scaledTo(Math.max(this._source.minzoom,Math.min($.canonical.z,5)));Z[At.key]=At}v=v.concat(Object.values(Z))}let B=v.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,B&&this.fire(new n.k(\"data\",{sourceDataType:\"idle\",dataType:\"source\",sourceId:this.id}));let U=this._updateRetainedTiles(v,b);if(gi(this._source.type)){let Z={},$={},st=Object.keys(U),At=n.h.now();for(let pt of st){let yt=U[pt],dt=this._tiles[pt];if(!dt||dt.fadeEndTime!==0&&dt.fadeEndTime<=At)continue;let Ft=this.findLoadedParent(yt,M);Ft&&(this._addTile(Ft.tileID),Z[Ft.tileID.key]=Ft.tileID),$[pt]=yt}this._retainLoadedChildren($,b,O,U);for(let pt in Z)U[pt]||(this._coveredTiles[pt]=!0,U[pt]=Z[pt]);if(d){let pt={},yt={};for(let dt of v)this._tiles[dt.key].hasData()?pt[dt.key]=dt:yt[dt.key]=dt;for(let dt in yt){let Ft=yt[dt].children(this._source.maxzoom);this._tiles[Ft[0].key]&&this._tiles[Ft[1].key]&&this._tiles[Ft[2].key]&&this._tiles[Ft[3].key]&&(pt[Ft[0].key]=U[Ft[0].key]=Ft[0],pt[Ft[1].key]=U[Ft[1].key]=Ft[1],pt[Ft[2].key]=U[Ft[2].key]=Ft[2],pt[Ft[3].key]=U[Ft[3].key]=Ft[3],delete yt[dt])}for(let dt in yt){let Ft=this.findLoadedParent(yt[dt],this._source.minzoom);if(Ft){pt[Ft.tileID.key]=U[Ft.tileID.key]=Ft.tileID;for(let Ht in pt)pt[Ht].isChildOf(Ft.tileID)&&delete pt[Ht]}}for(let dt in this._tiles)pt[dt]||(this._coveredTiles[dt]=!0)}}for(let Z in U)this._tiles[Z].clearFadeHold();let W=n.ab(this._tiles,U);for(let Z of W){let $=this._tiles[Z];$.hasSymbolBuckets&&!$.holdingForFade()?$.setHoldDuration(this.map._fadeDuration):$.hasSymbolBuckets&&!$.symbolFadeFinished()||this._removeTile(Z)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let l in this._tiles)this._tiles[l].holdingForFade()&&this._removeTile(l)}_updateRetainedTiles(l,d){let v={},b={},M=Math.max(d-ls.maxOverzooming,this._source.minzoom),O=Math.max(d+ls.maxUnderzooming,this._source.minzoom),B={};for(let U of l){let W=this._addTile(U);v[U.key]=U,W.hasData()||dthis._source.maxzoom){let $=U.children(this._source.maxzoom)[0],st=this.getTile($);if(st&&st.hasData()){v[$.key]=$;continue}}else{let $=U.children(this._source.maxzoom);if(v[$[0].key]&&v[$[1].key]&&v[$[2].key]&&v[$[3].key])continue}let Z=W.wasRequested();for(let $=U.overscaledZ-1;$>=M;--$){let st=U.scaledTo($);if(b[st.key])break;if(b[st.key]=!0,W=this.getTile(st),!W&&Z&&(W=this._addTile(st)),W){let At=W.hasData();if((Z||At)&&(v[st.key]=st),Z=W.wasRequested(),At)break}}}return v}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let l in this._tiles){let d=[],v,b=this._tiles[l].tileID;for(;b.overscaledZ>0;){if(b.key in this._loadedParentTiles){v=this._loadedParentTiles[b.key];break}d.push(b.key);let M=b.scaledTo(b.overscaledZ-1);if(v=this._getLoadedTile(M),v)break;b=M}for(let M of d)this._loadedParentTiles[M]=v}}_addTile(l){let d=this._tiles[l.key];if(d)return d;d=this._cache.getAndRemove(l),d&&(this._setTileReloadTimer(l.key,d),d.tileID=l,this._state.initializeTileState(d,this.map?this.map.painter:null),this._cacheTimers[l.key]&&(clearTimeout(this._cacheTimers[l.key]),delete this._cacheTimers[l.key],this._setTileReloadTimer(l.key,d)));let v=d;return d||(d=new ao(l,this._source.tileSize*l.overscaleFactor()),this._loadTile(d,this._tileLoaded.bind(this,d,l.key,d.state))),d.uses++,this._tiles[l.key]=d,v||this._source.fire(new n.k(\"dataloading\",{tile:d,coord:d.tileID,dataType:\"source\"})),d}_setTileReloadTimer(l,d){l in this._timers&&(clearTimeout(this._timers[l]),delete this._timers[l]);let v=d.getExpiryTimeout();v&&(this._timers[l]=setTimeout(()=>{this._reloadTile(l,\"expired\"),delete this._timers[l]},v))}_removeTile(l){let d=this._tiles[l];d&&(d.uses--,delete this._tiles[l],this._timers[l]&&(clearTimeout(this._timers[l]),delete this._timers[l]),d.uses>0||(d.hasData()&&d.state!==\"reloading\"?this._cache.add(d.tileID,d,d.getExpiryTimeout()):(d.aborted=!0,this._abortTile(d),this._unloadTile(d))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let l in this._tiles)this._removeTile(l);this._cache.reset()}tilesIn(l,d,v){let b=[],M=this.transform;if(!M)return b;let O=v?M.getCameraQueryGeometry(l):l,B=l.map(pt=>M.pointCoordinate(pt,this.terrain)),U=O.map(pt=>M.pointCoordinate(pt,this.terrain)),W=this.getIds(),Z=1/0,$=1/0,st=-1/0,At=-1/0;for(let pt of U)Z=Math.min(Z,pt.x),$=Math.min($,pt.y),st=Math.max(st,pt.x),At=Math.max(At,pt.y);for(let pt=0;pt=0&&St[1].y+Ht>=0){let Bt=B.map($t=>dt.getTilePoint($t)),Qt=U.map($t=>dt.getTilePoint($t));b.push({tile:yt,tileID:dt,queryGeometry:Bt,cameraQueryGeometry:Qt,scale:Ft})}}return b}getVisibleCoordinates(l){let d=this.getRenderableIds(l).map(v=>this._tiles[v].tileID);for(let v of d)v.posMatrix=this.transform.calculatePosMatrix(v.toUnwrapped());return d}hasTransition(){if(this._source.hasTransition())return!0;if(gi(this._source.type)){let l=n.h.now();for(let d in this._tiles)if(this._tiles[d].fadeEndTime>=l)return!0}return!1}setFeatureState(l,d,v){this._state.updateState(l=l||\"_geojsonTileLayer\",d,v)}removeFeatureState(l,d,v){this._state.removeFeatureState(l=l||\"_geojsonTileLayer\",d,v)}getFeatureState(l,d){return this._state.getState(l=l||\"_geojsonTileLayer\",d)}setDependencies(l,d,v){let b=this._tiles[l];b&&b.setDependencies(d,v)}reloadTilesForDependencies(l,d){for(let v in this._tiles)this._tiles[v].hasDependency(l,d)&&this._reloadTile(v,\"reloading\");this._cache.filter(v=>!v.hasDependency(l,d))}}function mn(T,l){let d=Math.abs(2*T.wrap)-+(T.wrap<0),v=Math.abs(2*l.wrap)-+(l.wrap<0);return T.overscaledZ-l.overscaledZ||v-d||l.canonical.y-T.canonical.y||l.canonical.x-T.canonical.x}function gi(T){return T===\"raster\"||T===\"image\"||T===\"video\"}ls.maxOverzooming=10,ls.maxUnderzooming=3;let oi=\"mapboxgl_preloaded_worker_pool\";class lo{constructor(){this.active={}}acquire(l){if(!this.workers)for(this.workers=[];this.workers.length{d.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[oi]}numActive(){return Object.keys(this.active).length}}let du=Math.floor(n.h.hardwareConcurrency/2),ul;function bo(){return ul||(ul=new lo),ul}lo.workerCount=n.ac(globalThis)?Math.max(Math.min(du,3),1):1;class hl{constructor(l,d){this.reset(l,d)}reset(l,d){this.points=l||[],this._distances=[0];for(let v=1;v0?(b-O)/B:0;return this.points[M].mult(1-U).add(this.points[d].mult(U))}}function Ia(T,l){let d=!0;return T===\"always\"||T!==\"never\"&&l!==\"never\"||(d=!1),d}class wo{constructor(l,d,v){let b=this.boxCells=[],M=this.circleCells=[];this.xCellCount=Math.ceil(l/v),this.yCellCount=Math.ceil(d/v);for(let O=0;Othis.width||b<0||d>this.height)return[];let U=[];if(l<=0&&d<=0&&this.width<=v&&this.height<=b){if(M)return[{key:null,x1:l,y1:d,x2:v,y2:b}];for(let W=0;W0}hitTestCircle(l,d,v,b,M){let O=l-v,B=l+v,U=d-v,W=d+v;if(B<0||O>this.width||W<0||U>this.height)return!1;let Z=[];return this._forEachCell(O,U,B,W,this._queryCellCircle,Z,{hitTest:!0,overlapMode:b,circle:{x:l,y:d,radius:v},seenUids:{box:{},circle:{}}},M),Z.length>0}_queryCell(l,d,v,b,M,O,B,U){let{seenUids:W,hitTest:Z,overlapMode:$}=B,st=this.boxCells[M];if(st!==null){let pt=this.bboxes;for(let yt of st)if(!W.box[yt]){W.box[yt]=!0;let dt=4*yt,Ft=this.boxKeys[yt];if(l<=pt[dt+2]&&d<=pt[dt+3]&&v>=pt[dt+0]&&b>=pt[dt+1]&&(!U||U(Ft))&&(!Z||!Ia($,Ft.overlapMode))&&(O.push({key:Ft,x1:pt[dt],y1:pt[dt+1],x2:pt[dt+2],y2:pt[dt+3]}),Z))return!0}}let At=this.circleCells[M];if(At!==null){let pt=this.circles;for(let yt of At)if(!W.circle[yt]){W.circle[yt]=!0;let dt=3*yt,Ft=this.circleKeys[yt];if(this._circleAndRectCollide(pt[dt],pt[dt+1],pt[dt+2],l,d,v,b)&&(!U||U(Ft))&&(!Z||!Ia($,Ft.overlapMode))){let Ht=pt[dt],St=pt[dt+1],Bt=pt[dt+2];if(O.push({key:Ft,x1:Ht-Bt,y1:St-Bt,x2:Ht+Bt,y2:St+Bt}),Z)return!0}}}return!1}_queryCellCircle(l,d,v,b,M,O,B,U){let{circle:W,seenUids:Z,overlapMode:$}=B,st=this.boxCells[M];if(st!==null){let pt=this.bboxes;for(let yt of st)if(!Z.box[yt]){Z.box[yt]=!0;let dt=4*yt,Ft=this.boxKeys[yt];if(this._circleAndRectCollide(W.x,W.y,W.radius,pt[dt+0],pt[dt+1],pt[dt+2],pt[dt+3])&&(!U||U(Ft))&&!Ia($,Ft.overlapMode))return O.push(!0),!0}}let At=this.circleCells[M];if(At!==null){let pt=this.circles;for(let yt of At)if(!Z.circle[yt]){Z.circle[yt]=!0;let dt=3*yt,Ft=this.circleKeys[yt];if(this._circlesCollide(pt[dt],pt[dt+1],pt[dt+2],W.x,W.y,W.radius)&&(!U||U(Ft))&&!Ia($,Ft.overlapMode))return O.push(!0),!0}}}_forEachCell(l,d,v,b,M,O,B,U){let W=this._convertToXCellCoord(l),Z=this._convertToYCellCoord(d),$=this._convertToXCellCoord(v),st=this._convertToYCellCoord(b);for(let At=W;At<=$;At++)for(let pt=Z;pt<=st;pt++)if(M.call(this,l,d,v,b,this.xCellCount*pt+At,O,B,U))return}_convertToXCellCoord(l){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(l*this.xScale)))}_convertToYCellCoord(l){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(l*this.yScale)))}_circlesCollide(l,d,v,b,M,O){let B=b-l,U=M-d,W=v+O;return W*W>B*B+U*U}_circleAndRectCollide(l,d,v,b,M,O,B){let U=(O-b)/2,W=Math.abs(l-(b+U));if(W>U+v)return!1;let Z=(B-M)/2,$=Math.abs(d-(M+Z));if($>Z+v)return!1;if(W<=U||$<=Z)return!0;let st=W-U,At=$-Z;return st*st+At*At<=v*v}}function ve(T,l,d,v,b){let M=n.Z();return l?(n.a0(M,M,[1/b,1/b,1]),d||n.ae(M,M,v.angle)):n.a1(M,v.labelPlaneMatrix,T),M}function jo(T,l,d,v,b){if(l){let M=n.af(T);return n.a0(M,M,[b,b,1]),d||n.ae(M,M,-v.angle),M}return v.glCoordMatrix}function gn(T,l,d){let v;d?(v=[T.x,T.y,d(T.x,T.y),1],n.ag(v,v,l)):(v=[T.x,T.y,0,1],vt(v,v,l));let b=v[3];return{point:new n.P(v[0]/b,v[1]/b),signedDistanceFromCamera:b}}function Ul(T,l){return .5+T/l*.5}function Ca(T,l){let d=T[0]/T[3],v=T[1]/T[3];return d>=-l[0]&&d<=l[0]&&v>=-l[1]&&v<=l[1]}function Te(T,l,d,v,b,M,O,B,U,W){let Z=v?T.textSizeData:T.iconSizeData,$=n.ah(Z,d.transform.zoom),st=[256/d.width*2+1,256/d.height*2+1],At=v?T.text.dynamicLayoutVertexArray:T.icon.dynamicLayoutVertexArray;At.clear();let pt=T.lineVertexArray,yt=v?T.text.placedSymbolArray:T.icon.placedSymbolArray,dt=d.transform.width/d.transform.height,Ft=!1;for(let Ht=0;HtMath.abs(d.x-l.x)*v?{useVertical:!0}:(T===n.ai.vertical?l.yd.x)?{needsFlipping:!0}:null}function Us(T,l,d,v,b,M,O,B,U,W,Z,$,st,At,pt,yt){let dt=l/24,Ft=T.lineOffsetX*dt,Ht=T.lineOffsetY*dt,St;if(T.numGlyphs>1){let Bt=T.glyphStartIndex+T.numGlyphs,Qt=T.lineStartIndex,$t=T.lineStartIndex+T.lineLength,oe=Dr(dt,B,Ft,Ht,d,Z,$,T,U,M,st,pt,yt);if(!oe)return{notEnoughRoom:!0};let pe=gn(oe.first.point,O,yt).point,he=gn(oe.last.point,O,yt).point;if(v&&!d){let be=gr(T.writingMode,pe,he,At);if(be)return be}St=[oe.first];for(let be=T.glyphStartIndex+1;be0?pe.point:La($,oe,Qt,1,b,yt),be=gr(T.writingMode,Qt,he,At);if(be)return be}let Bt=tt(dt*B.getoffsetX(T.glyphStartIndex),Ft,Ht,d,Z,$,T.segment,T.lineStartIndex,T.lineStartIndex+T.lineLength,U,M,st,pt,yt);if(!Bt)return{notEnoughRoom:!0};St=[Bt]}for(let Bt of St)n.ak(W,Bt.point,Bt.angle);return{}}function La(T,l,d,v,b,M){let O=gn(T.add(T.sub(l)._unit()),b,M).point,B=d.sub(O);return d.add(B._mult(v/B.mag()))}function Mr(T,l){let{projectionCache:d,lineVertexArray:v,labelPlaneMatrix:b,tileAnchorPoint:M,distanceFromAnchor:O,getElevation:B,previousVertex:U,direction:W,absOffsetX:Z}=l;if(d.projections[T])return d.projections[T];let $=new n.P(v.getx(T),v.gety(T)),st=gn($,b,B);if(st.signedDistanceFromCamera>0)return d.projections[T]=st.point,st.point;let At=T-W;return La(O===0?M:new n.P(v.getx(At),v.gety(At)),$,U,Z-O+1,b,B)}function sa(T,l,d){return T._unit()._perp()._mult(l*d)}function gt(T,l,d,v,b,M,O,B){let{projectionCache:U,direction:W}=B;if(U.offsets[T])return U.offsets[T];let Z=d.add(l);if(T+W=b)return U.offsets[T]=Z,Z;let $=Mr(T+W,B),st=sa($.sub(d),O,W),At=d.add(st),pt=$.add(st);return U.offsets[T]=n.al(M,Z,At,pt)||Z,U.offsets[T]}function tt(T,l,d,v,b,M,O,B,U,W,Z,$,st,At){let pt=v?T-l:T+l,yt=pt>0?1:-1,dt=0;v&&(yt*=-1,dt=Math.PI),yt<0&&(dt+=Math.PI);let Ft,Ht,St=yt>0?B+O:B+O+1,Bt=b,Qt=b,$t=0,oe=0,pe=Math.abs(pt),he=[],be;for(;$t+oe<=pe;){if(St+=yt,St=U)return null;$t+=oe,Qt=Bt,Ht=Ft;let Ee={projectionCache:$,lineVertexArray:W,labelPlaneMatrix:Z,tileAnchorPoint:M,distanceFromAnchor:$t,getElevation:At,previousVertex:Qt,direction:yt,absOffsetX:pe};if(Bt=Mr(St,Ee),d===0)he.push(Qt),be=Bt.sub(Qt);else{let pr,tr=Bt.sub(Qt);pr=tr.mag()===0?sa(Mr(St+yt,Ee).sub(Bt),d,yt):sa(tr,d,yt),Ht||(Ht=Qt.add(pr)),Ft=gt(St,pr,Bt,B,U,Ht,d,Ee),he.push(Ht),be=Ft.sub(Ht)}oe=be.mag()}let Ze=be._mult((pe-$t)/oe)._add(Ht||Qt),Kr=dt+Math.atan2(Bt.y-Qt.y,Bt.x-Qt.x);return he.push(Ze),{point:Ze,angle:st?Kr:0,path:he}}let nt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ht(T,l){for(let d=0;d=1;Vr--)tr.push(Ee.path[Vr]);for(let Vr=1;Vrgn(ei,U,pt));tr=Vr.some(ei=>ei.signedDistanceFromCamera<=0)?[]:Vr.map(ei=>ei.point)}let Jr=[];if(tr.length>0){let Vr=tr[0].clone(),ei=tr[0].clone();for(let On=1;On=be.x&&ei.x<=Ze.x&&Vr.y>=be.y&&ei.y<=Ze.y?[tr]:ei.xZe.x||ei.yZe.y?[]:n.am([tr],be.x,be.y,Ze.x,Ze.y)}for(let Vr of Jr){Kr.reset(Vr,.25*he);let ei=0;ei=Kr.length<=.5*he?1:Math.ceil(Kr.paddedLength/Gi)+1;for(let On=0;On=this.screenRightBoundary||bthis.screenBottomBoundary}isInsideGrid(l,d,v,b){return v>=0&&l=0&&dv.collisionGroupID===d}}return this.collisionGroups[l]}}function vr(T,l,d,v,b){let{horizontalAlign:M,verticalAlign:O}=n.au(T);return new n.P(-(M-.5)*l+v[0]*b,-(O-.5)*d+v[1]*b)}function Xe(T,l,d,v,b,M){let{x1:O,x2:B,y1:U,y2:W,anchorPointX:Z,anchorPointY:$}=T,st=new n.P(l,d);return v&&st._rotate(b?M:-M),{x1:O+st.x,y1:U+st.y,x2:B+st.x,y2:W+st.y,anchorPointX:Z,anchorPointY:$}}class cr{constructor(l,d,v,b,M){this.transform=l.clone(),this.terrain=d,this.collisionIndex=new _t(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=v,this.retainedQueryData={},this.collisionGroups=new lr(b),this.collisionCircleArrays={},this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(l,d,v,b){let M=v.getBucket(d),O=v.latestFeatureIndex;if(!M||!O||d.id!==M.layerIds[0])return;let B=v.collisionBoxArray,U=M.layers[0].layout,W=Math.pow(2,this.transform.zoom-v.tileID.overscaledZ),Z=v.tileSize/n.N,$=this.transform.calculatePosMatrix(v.tileID.toUnwrapped()),st=U.get(\"text-pitch-alignment\")===\"map\",At=U.get(\"text-rotation-alignment\")===\"map\",pt=Dt(v,1,this.transform.zoom),yt=ve($,st,At,this.transform,pt),dt=null;if(st){let Ht=jo($,st,At,this.transform,pt);dt=n.a1([],this.transform.labelPlaneMatrix,Ht)}this.retainedQueryData[M.bucketInstanceId]=new ae(M.bucketInstanceId,O,M.sourceLayerIndex,M.index,v.tileID);let Ft={bucket:M,layout:U,posMatrix:$,textLabelPlaneMatrix:yt,labelToScreenMatrix:dt,scale:W,textPixelRatio:Z,holdingForFade:v.holdingForFade(),collisionBoxArray:B,partiallyEvaluatedTextSize:n.ah(M.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(M.sourceID)};if(b)for(let Ht of M.sortKeyRanges){let{sortKey:St,symbolInstanceStart:Bt,symbolInstanceEnd:Qt}=Ht;l.push({sortKey:St,symbolInstanceStart:Bt,symbolInstanceEnd:Qt,parameters:Ft})}else l.push({symbolInstanceStart:0,symbolInstanceEnd:M.symbolInstances.length,parameters:Ft})}attemptAnchorPlacement(l,d,v,b,M,O,B,U,W,Z,$,st,At,pt,yt,dt){let Ft=n.aq[l.textAnchor],Ht=[l.textOffset0,l.textOffset1],St=vr(Ft,v,b,Ht,M),Bt=this.collisionIndex.placeCollisionBox(Xe(d,St.x,St.y,O,B,this.transform.angle),$,U,W,Z.predicate,dt);if((!yt||this.collisionIndex.placeCollisionBox(Xe(yt,St.x,St.y,O,B,this.transform.angle),$,U,W,Z.predicate,dt).box.length!==0)&&Bt.box.length>0){let Qt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[st.crossTileID]&&this.prevPlacement.placements[st.crossTileID]&&this.prevPlacement.placements[st.crossTileID].text&&(Qt=this.prevPlacement.variableOffsets[st.crossTileID].anchor),st.crossTileID===0)throw new Error(\"symbolInstance.crossTileID can't be 0\");return this.variableOffsets[st.crossTileID]={textOffset:Ht,width:v,height:b,anchor:Ft,textBoxScale:M,prevAnchor:Qt},this.markUsedJustification(At,Ft,st,pt),At.allowVerticalPlacement&&(this.markUsedOrientation(At,pt,st),this.placedOrientations[st.crossTileID]=pt),{shift:St,placedGlyphBoxes:Bt}}}placeLayerBucketPart(l,d,v){let{bucket:b,layout:M,posMatrix:O,textLabelPlaneMatrix:B,labelToScreenMatrix:U,textPixelRatio:W,holdingForFade:Z,collisionBoxArray:$,partiallyEvaluatedTextSize:st,collisionGroup:At}=l.parameters,pt=M.get(\"text-optional\"),yt=M.get(\"icon-optional\"),dt=n.ar(M,\"text-overlap\",\"text-allow-overlap\"),Ft=dt===\"always\",Ht=n.ar(M,\"icon-overlap\",\"icon-allow-overlap\"),St=Ht===\"always\",Bt=M.get(\"text-rotation-alignment\")===\"map\",Qt=M.get(\"text-pitch-alignment\")===\"map\",$t=M.get(\"icon-text-fit\")!==\"none\",oe=M.get(\"symbol-z-order\")===\"viewport-y\",pe=Ft&&(St||!b.hasIconData()||yt),he=St&&(Ft||!b.hasTextData()||pt);!b.collisionArrays&&$&&b.deserializeCollisionBoxes($);let be=this.retainedQueryData[b.bucketInstanceId].tileID,Ze=this.terrain?(Ee,pr)=>this.terrain.getElevation(be,Ee,pr):null,Kr=(Ee,pr)=>{var tr,Gi;if(d[Ee.crossTileID])return;if(Z)return void(this.placements[Ee.crossTileID]=new ie(!1,!1,!1));let Jr=!1,Vr=!1,ei=!0,On=null,tn={box:null,offscreen:null},Gs={box:null,offscreen:null},hs=null,Bn=null,qo=null,jr=0,ql=0,Zl=0;pr.textFeatureIndex?jr=pr.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(jr=Ee.featureIndex),pr.verticalTextFeatureIndex&&(ql=pr.verticalTextFeatureIndex);let yu=pr.textBox;if(yu){let Ws=Fn=>{let fs=n.ai.horizontal;if(b.allowVerticalPlacement&&!Fn&&this.prevPlacement){let Zo=this.prevPlacement.placedOrientations[Ee.crossTileID];Zo&&(this.placedOrientations[Ee.crossTileID]=Zo,fs=Zo,this.markUsedOrientation(b,fs,Ee))}return fs},Ps=(Fn,fs)=>{if(b.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&pr.verticalTextBox){for(let Zo of b.writingModes)if(Zo===n.ai.vertical?(tn=fs(),Gs=tn):tn=Fn(),tn&&tn.box&&tn.box.length)break}else tn=Fn()},Eo=Ee.textAnchorOffsetStartIndex,yh=Ee.textAnchorOffsetEndIndex;if(yh===Eo){let Fn=(fs,Zo)=>{let _n=this.collisionIndex.placeCollisionBox(fs,dt,W,O,At.predicate,Ze);return _n&&_n.box&&_n.box.length&&(this.markUsedOrientation(b,Zo,Ee),this.placedOrientations[Ee.crossTileID]=Zo),_n};Ps(()=>Fn(yu,n.ai.horizontal),()=>{let fs=pr.verticalTextBox;return b.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&fs?Fn(fs,n.ai.vertical):{box:null,offscreen:null}}),Ws(tn&&tn.box&&tn.box.length)}else{let Fn=n.aq[(Gi=(tr=this.prevPlacement)===null||tr===void 0?void 0:tr.variableOffsets[Ee.crossTileID])===null||Gi===void 0?void 0:Gi.anchor],fs=(_n,ho,Gr)=>{let Ua=_n.x2-_n.x1,S_=_n.y2-_n.y1,zd=Ee.textBoxScale,cA=$t&&Ht===\"never\"?ho:null,Yl={box:[],offscreen:!1},Yo=dt===\"never\"?1:2,me=\"never\";Fn&&Yo++;for(let ke=0;kefs(yu,pr.iconBox,n.ai.horizontal),()=>{let _n=pr.verticalTextBox;return b.allowVerticalPlacement&&!(tn&&tn.box&&tn.box.length)&&Ee.numVerticalGlyphVertices>0&&_n?fs(_n,pr.verticalIconBox,n.ai.vertical):{box:null,offscreen:null}}),tn&&(Jr=tn.box,ei=tn.offscreen);let Zo=Ws(tn&&tn.box);if(!Jr&&this.prevPlacement){let _n=this.prevPlacement.variableOffsets[Ee.crossTileID];_n&&(this.variableOffsets[Ee.crossTileID]=_n,this.markUsedJustification(b,_n.anchor,Ee,Zo))}}}if(hs=tn,Jr=hs&&hs.box&&hs.box.length>0,ei=hs&&hs.offscreen,Ee.useRuntimeCollisionCircles){let Ws=b.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),Ps=n.aj(b.textSizeData,st,Ws),Eo=M.get(\"text-padding\");Bn=this.collisionIndex.placeCollisionCircles(dt,Ws,b.lineVertexArray,b.glyphOffsetArray,Ps,O,B,U,v,Qt,At.predicate,Ee.collisionCircleDiameter,Eo,Ze),Bn.circles.length&&Bn.collisionDetected&&!v&&n.w(\"Collisions detected, but collision boxes are not shown\"),Jr=Ft||Bn.circles.length>0&&!Bn.collisionDetected,ei=ei&&Bn.offscreen}if(pr.iconFeatureIndex&&(Zl=pr.iconFeatureIndex),pr.iconBox){let Ws=Ps=>{let Eo=$t&&On?Xe(Ps,On.x,On.y,Bt,Qt,this.transform.angle):Ps;return this.collisionIndex.placeCollisionBox(Eo,Ht,W,O,At.predicate,Ze)};Gs&&Gs.box&&Gs.box.length&&pr.verticalIconBox?(qo=Ws(pr.verticalIconBox),Vr=qo.box.length>0):(qo=Ws(pr.iconBox),Vr=qo.box.length>0),ei=ei&&qo.offscreen}let vu=pt||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,_h=yt||Ee.numIconVertices===0;if(vu||_h?_h?vu||(Vr=Vr&&Jr):Jr=Vr&&Jr:Vr=Jr=Vr&&Jr,Jr&&hs&&hs.box&&this.collisionIndex.insertCollisionBox(hs.box,dt,M.get(\"text-ignore-placement\"),b.bucketInstanceId,Gs&&Gs.box&&ql?ql:jr,At.ID),Vr&&qo&&this.collisionIndex.insertCollisionBox(qo.box,Ht,M.get(\"icon-ignore-placement\"),b.bucketInstanceId,Zl,At.ID),Bn&&(Jr&&this.collisionIndex.insertCollisionCircles(Bn.circles,dt,M.get(\"text-ignore-placement\"),b.bucketInstanceId,jr,At.ID),v)){let Ws=b.bucketInstanceId,Ps=this.collisionCircleArrays[Ws];Ps===void 0&&(Ps=this.collisionCircleArrays[Ws]=new se);for(let Eo=0;Eo=0;--pr){let tr=Ee[pr];Kr(b.symbolInstances.get(tr),b.collisionArrays[tr])}}else for(let Ee=l.symbolInstanceStart;Ee=0&&(l.text.placedSymbolArray.get(B).crossTileID=M>=0&&B!==M?0:v.crossTileID)}markUsedOrientation(l,d,v){let b=d===n.ai.horizontal||d===n.ai.horizontalOnly?d:0,M=d===n.ai.vertical?d:0,O=[v.leftJustifiedTextSymbolIndex,v.centerJustifiedTextSymbolIndex,v.rightJustifiedTextSymbolIndex];for(let B of O)l.text.placedSymbolArray.get(B).placedOrientation=b;v.verticalPlacedTextSymbolIndex&&(l.text.placedSymbolArray.get(v.verticalPlacedTextSymbolIndex).placedOrientation=M)}commit(l){this.commitTime=l,this.zoomAtLastRecencyCheck=this.transform.zoom;let d=this.prevPlacement,v=!1;this.prevZoomAdjustment=d?d.zoomAdjustment(this.transform.zoom):0;let b=d?d.symbolFadeChange(l):1,M=d?d.opacities:{},O=d?d.variableOffsets:{},B=d?d.placedOrientations:{};for(let U in this.placements){let W=this.placements[U],Z=M[U];Z?(this.opacities[U]=new Vt(Z,b,W.text,W.icon),v=v||W.text!==Z.text.placed||W.icon!==Z.icon.placed):(this.opacities[U]=new Vt(null,b,W.text,W.icon,W.skipFade),v=v||W.text||W.icon)}for(let U in M){let W=M[U];if(!this.opacities[U]){let Z=new Vt(W,b,!1,!1);Z.isHidden()||(this.opacities[U]=Z,v=v||W.text.placed||W.icon.placed)}}for(let U in O)this.variableOffsets[U]||!this.opacities[U]||this.opacities[U].isHidden()||(this.variableOffsets[U]=O[U]);for(let U in B)this.placedOrientations[U]||!this.opacities[U]||this.opacities[U].isHidden()||(this.placedOrientations[U]=B[U]);if(d&&d.lastPlacementChangeTime===void 0)throw new Error(\"Last placement time for previous placement is not defined\");v?this.lastPlacementChangeTime=l:typeof this.lastPlacementChangeTime!=\"number\"&&(this.lastPlacementChangeTime=d?d.lastPlacementChangeTime:l)}updateLayerOpacities(l,d){let v={};for(let b of d){let M=b.getBucket(l);M&&b.latestFeatureIndex&&l.id===M.layerIds[0]&&this.updateBucketOpacities(M,v,b.collisionBoxArray)}}updateBucketOpacities(l,d,v){l.hasTextData()&&(l.text.opacityVertexArray.clear(),l.text.hasVisibleVertices=!1),l.hasIconData()&&(l.icon.opacityVertexArray.clear(),l.icon.hasVisibleVertices=!1),l.hasIconCollisionBoxData()&&l.iconCollisionBox.collisionVertexArray.clear(),l.hasTextCollisionBoxData()&&l.textCollisionBox.collisionVertexArray.clear();let b=l.layers[0],M=b.layout,O=new Vt(null,0,!1,!1,!0),B=M.get(\"text-allow-overlap\"),U=M.get(\"icon-allow-overlap\"),W=b._unevaluatedLayout.hasValue(\"text-variable-anchor\")||b._unevaluatedLayout.hasValue(\"text-variable-anchor-offset\"),Z=M.get(\"text-rotation-alignment\")===\"map\",$=M.get(\"text-pitch-alignment\")===\"map\",st=M.get(\"icon-text-fit\")!==\"none\",At=new Vt(null,0,B&&(U||!l.hasIconData()||M.get(\"icon-optional\")),U&&(B||!l.hasTextData()||M.get(\"text-optional\")),!0);!l.collisionArrays&&v&&(l.hasIconCollisionBoxData()||l.hasTextCollisionBoxData())&&l.deserializeCollisionBoxes(v);let pt=(yt,dt,Ft)=>{for(let Ht=0;Ht
0,$t=this.placedOrientations[dt.crossTileID],oe=$t===n.ai.vertical,pe=$t===n.ai.horizontal||$t===n.ai.horizontalOnly;if(Ft>0||Ht>0){let he=es(Bt.text);pt(l.text,Ft,oe?oa:he),pt(l.text,Ht,pe?oa:he);let be=Bt.text.isHidden();[dt.rightJustifiedTextSymbolIndex,dt.centerJustifiedTextSymbolIndex,dt.leftJustifiedTextSymbolIndex].forEach(Ee=>{Ee>=0&&(l.text.placedSymbolArray.get(Ee).hidden=be||oe?1:0)}),dt.verticalPlacedTextSymbolIndex>=0&&(l.text.placedSymbolArray.get(dt.verticalPlacedTextSymbolIndex).hidden=be||pe?1:0);let Ze=this.variableOffsets[dt.crossTileID];Ze&&this.markUsedJustification(l,Ze.anchor,dt,$t);let Kr=this.placedOrientations[dt.crossTileID];Kr&&(this.markUsedJustification(l,\"left\",dt,Kr),this.markUsedOrientation(l,Kr,dt))}if(Qt){let he=es(Bt.icon),be=!(st&&dt.verticalPlacedIconSymbolIndex&&oe);dt.placedIconSymbolIndex>=0&&(pt(l.icon,dt.numIconVertices,be?he:oa),l.icon.placedSymbolArray.get(dt.placedIconSymbolIndex).hidden=Bt.icon.isHidden()),dt.verticalPlacedIconSymbolIndex>=0&&(pt(l.icon,dt.numVerticalIconVertices,be?oa:he),l.icon.placedSymbolArray.get(dt.verticalPlacedIconSymbolIndex).hidden=Bt.icon.isHidden())}if(l.hasIconCollisionBoxData()||l.hasTextCollisionBoxData()){let he=l.collisionArrays[yt];if(he){let be=new n.P(0,0);if(he.textBox||he.verticalTextBox){let Kr=!0;if(W){let Ee=this.variableOffsets[St];Ee?(be=vr(Ee.anchor,Ee.width,Ee.height,Ee.textOffset,Ee.textBoxScale),Z&&be._rotate($?this.transform.angle:-this.transform.angle)):Kr=!1}he.textBox&&wr(l.textCollisionBox.collisionVertexArray,Bt.text.placed,!Kr||oe,be.x,be.y),he.verticalTextBox&&wr(l.textCollisionBox.collisionVertexArray,Bt.text.placed,!Kr||pe,be.x,be.y)}let Ze=!!(!pe&&he.verticalIconBox);he.iconBox&&wr(l.iconCollisionBox.collisionVertexArray,Bt.icon.placed,Ze,st?be.x:0,st?be.y:0),he.verticalIconBox&&wr(l.iconCollisionBox.collisionVertexArray,Bt.icon.placed,!Ze,st?be.x:0,st?be.y:0)}}}if(l.sortFeatures(this.transform.angle),this.retainedQueryData[l.bucketInstanceId]&&(this.retainedQueryData[l.bucketInstanceId].featureSortOrder=l.featureSortOrder),l.hasTextData()&&l.text.opacityVertexBuffer&&l.text.opacityVertexBuffer.updateData(l.text.opacityVertexArray),l.hasIconData()&&l.icon.opacityVertexBuffer&&l.icon.opacityVertexBuffer.updateData(l.icon.opacityVertexArray),l.hasIconCollisionBoxData()&&l.iconCollisionBox.collisionVertexBuffer&&l.iconCollisionBox.collisionVertexBuffer.updateData(l.iconCollisionBox.collisionVertexArray),l.hasTextCollisionBoxData()&&l.textCollisionBox.collisionVertexBuffer&&l.textCollisionBox.collisionVertexBuffer.updateData(l.textCollisionBox.collisionVertexArray),l.text.opacityVertexArray.length!==l.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${l.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${l.text.layoutVertexArray.length}) / 4`);if(l.icon.opacityVertexArray.length!==l.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${l.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${l.icon.layoutVertexArray.length}) / 4`);if(l.bucketInstanceId in this.collisionCircleArrays){let yt=this.collisionCircleArrays[l.bucketInstanceId];l.placementInvProjMatrix=yt.invProjMatrix,l.placementViewportMatrix=yt.viewportMatrix,l.collisionCircleArray=yt.circles,delete this.collisionCircleArrays[l.bucketInstanceId]}}symbolFadeChange(l){return this.fadeDuration===0?1:(l-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(l){return Math.max(0,(this.transform.zoom-l)/1.5)}hasTransitions(l){return this.stale||l-this.lastPlacementChangeTimel}setStale(){this.stale=!0}}function wr(T,l,d,v,b){T.emplaceBack(l?1:0,d?1:0,v||0,b||0),T.emplaceBack(l?1:0,d?1:0,v||0,b||0),T.emplaceBack(l?1:0,d?1:0,v||0,b||0),T.emplaceBack(l?1:0,d?1:0,v||0,b||0)}let xi=Math.pow(2,25),zi=Math.pow(2,24),ni=Math.pow(2,17),Hr=Math.pow(2,16),jn=Math.pow(2,9),Bi=Math.pow(2,8),xn=Math.pow(2,1);function es(T){if(T.opacity===0&&!T.placed)return 0;if(T.opacity===1&&T.placed)return 4294967295;let l=T.placed?1:0,d=Math.floor(127*T.opacity);return d*xi+l*zi+d*ni+l*Hr+d*jn+l*Bi+d*xn+l}let oa=0;class Um{constructor(l){this._sortAcrossTiles=l.layout.get(\"symbol-z-order\")!==\"viewport-y\"&&!l.layout.get(\"symbol-sort-key\").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(l,d,v,b,M){let O=this._bucketParts;for(;this._currentTileIndexB.sortKey-U.sortKey));this._currentPartIndex!this._forceFullPlacement&&n.h.now()-b>2;for(;this._currentPlacementIndex>=0;){let O=d[l[this._currentPlacementIndex]],B=this.placement.collisionIndex.transform.zoom;if(O.type===\"symbol\"&&(!O.minzoom||O.minzoom<=B)&&(!O.maxzoom||O.maxzoom>B)){if(this._inProgressLayer||(this._inProgressLayer=new Um(O)),this._inProgressLayer.continuePlacement(v[O.source],this.placement,this._showCollisionBoxes,O,M))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(l){return this.placement.commit(l),this.placement}}let Ss=512/n.N/2;class nh{constructor(l,d,v){this.tileID=l,this.bucketInstanceId=v,this._symbolsByKey={};let b=new Map;for(let M=0;M({x:Math.floor(U.anchorX*Ss),y:Math.floor(U.anchorY*Ss)})),crossTileIDs:O.map(U=>U.crossTileID)};if(B.positions.length>128){let U=new n.av(B.positions.length,16,Uint16Array);for(let{x:W,y:Z}of B.positions)U.add(W,Z);U.finish(),delete B.positions,B.index=U}this._symbolsByKey[M]=B}}getScaledCoordinates(l,d){let{x:v,y:b,z:M}=this.tileID.canonical,{x:O,y:B,z:U}=d.canonical,W=Ss/Math.pow(2,U-M),Z=(B*n.N+l.anchorY)*W,$=b*n.N*Ss;return{x:Math.floor((O*n.N+l.anchorX)*W-v*n.N*Ss),y:Math.floor(Z-$)}}findMatches(l,d,v){let b=this.tileID.canonical.zl)}}class ai{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ka{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(l){let d=Math.round((l-this.lng)/360);if(d!==0)for(let v in this.indexes){let b=this.indexes[v],M={};for(let O in b){let B=b[O];B.tileID=B.tileID.unwrapTo(B.tileID.wrap+d),M[B.tileID.key]=B}this.indexes[v]=M}this.lng=l}addBucket(l,d,v){if(this.indexes[l.overscaledZ]&&this.indexes[l.overscaledZ][l.key]){if(this.indexes[l.overscaledZ][l.key].bucketInstanceId===d.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(l.overscaledZ,this.indexes[l.overscaledZ][l.key])}for(let M=0;Ml.overscaledZ)for(let B in O){let U=O[B];U.tileID.isChildOf(l)&&U.findMatches(d.symbolInstances,l,b)}else{let B=O[l.scaledTo(Number(M)).key];B&&B.findMatches(d.symbolInstances,l,b)}}for(let M=0;M{d[v]=!0});for(let v in this.layerIndexes)d[v]||delete this.layerIndexes[v]}}let ln=(T,l)=>n.x(T,l&&l.filter(d=>d.identifier!==\"source.canvas\")),Dn=n.F(n.ax,[\"addLayer\",\"removeLayer\",\"setPaintProperty\",\"setLayoutProperty\",\"setFilter\",\"addSource\",\"removeSource\",\"setLayerZoomRange\",\"setLight\",\"setTransition\",\"setGeoJSONSourceData\",\"setGlyphs\",\"setSprite\"]),Vm=n.F(n.ax,[\"setCenter\",\"setZoom\",\"setBearing\",\"setPitch\"]),Go=n.aw();class Gn extends n.E{constructor(l,d={}){super(),this.map=l,this.dispatcher=new ih(bo(),this,l._getMapId()),this.imageManager=new ue,this.imageManager.setEventedParent(this),this.glyphManager=new Sr(l._requestManager,d.localIdeographFontFamily),this.lineAtlas=new No(256,512),this.crossTileSymbolIndex=new Dc,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new n.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast(\"setReferrer\",n.az());let v=this;this._rtlTextPluginCallback=Gn.registerForPluginStateChange(b=>{v.dispatcher.broadcast(\"syncRTLPluginState\",{pluginStatus:b.pluginStatus,pluginURL:b.pluginURL},(M,O)=>{if(n.aA(M),O&&O.every(B=>B))for(let B in v.sourceCaches){let U=v.sourceCaches[B].getSource().type;U!==\"vector\"&&U!==\"geojson\"||v.sourceCaches[B].reload()}})}),this.on(\"data\",b=>{if(b.dataType!==\"source\"||b.sourceDataType!==\"metadata\")return;let M=this.sourceCaches[b.sourceId];if(!M)return;let O=M.getSource();if(O&&O.vectorLayerIds)for(let B in this._layers){let U=this._layers[B];U.source===O.id&&this._validateLayer(U)}})}loadURL(l,d={},v){this.fire(new n.k(\"dataloading\",{dataType:\"style\"})),d.validate=typeof d.validate!=\"boolean\"||d.validate;let b=this.map._requestManager.transformRequest(l,Q.Style);this._request=n.f(b,(M,O)=>{this._request=null,M?this.fire(new n.j(M)):O&&this._load(O,d,v)})}loadJSON(l,d={},v){this.fire(new n.k(\"dataloading\",{dataType:\"style\"})),this._request=n.h.frame(()=>{this._request=null,d.validate=d.validate!==!1,this._load(l,d,v)})}loadEmpty(){this.fire(new n.k(\"dataloading\",{dataType:\"style\"})),this._load(Go,{validate:!1})}_load(l,d,v){var b;let M=d.transformStyle?d.transformStyle(v,l):l;if(!d.validate||!ln(this,n.y(M))){this._loaded=!0,this.stylesheet=M;for(let O in M.sources)this.addSource(O,M.sources[O],{validate:!1});M.sprite?this._loadSprite(M.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(M.glyphs),this._createLayers(),this.light=new zl(this.stylesheet.light),this.map.setTerrain((b=this.stylesheet.terrain)!==null&&b!==void 0?b:null),this.fire(new n.k(\"data\",{dataType:\"style\"})),this.fire(new n.k(\"style.load\"))}}_createLayers(){let l=n.aB(this.stylesheet.layers);this.dispatcher.broadcast(\"setLayers\",l),this._order=l.map(d=>d.id),this._layers={},this._serializedLayers=null;for(let d of l){let v=n.aC(d);v.setEventedParent(this,{layer:{id:d.id}}),this._layers[d.id]=v}}_loadSprite(l,d=!1,v=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(b,M,O,B){let U=kt(b),W=U.length,Z=O>1?\"@2x\":\"\",$={},st={},At={};for(let{id:pt,url:yt}of U){let dt=M.transformRequest(M.normalizeSpriteURL(yt,Z,\".json\"),Q.SpriteJSON),Ft=`${pt}_${dt.url}`;$[Ft]=n.f(dt,(Bt,Qt)=>{delete $[Ft],st[pt]=Qt,Xt(B,st,At,Bt,W)});let Ht=M.transformRequest(M.normalizeSpriteURL(yt,Z,\".png\"),Q.SpriteImage),St=`${pt}_${Ht.url}`;$[St]=j.getImage(Ht,(Bt,Qt)=>{delete $[St],At[pt]=Qt,Xt(B,st,At,Bt,W)})}return{cancel(){for(let pt of Object.values($))pt.cancel()}}}(l,this.map._requestManager,this.map.getPixelRatio(),(b,M)=>{if(this._spriteRequest=null,b)this.fire(new n.j(b));else if(M)for(let O in M){this._spritesImagesIds[O]=[];let B=this._spritesImagesIds[O]?this._spritesImagesIds[O].filter(U=>!(U in M)):[];for(let U of B)this.imageManager.removeImage(U),this._changedImages[U]=!0;for(let U in M[O]){let W=O===\"default\"?U:`${O}:${U}`;this._spritesImagesIds[O].push(W),W in this.imageManager.images?this.imageManager.updateImage(W,M[O][U],!1):this.imageManager.addImage(W,M[O][U]),d&&(this._changedImages[W]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),d&&(this._changed=!0),this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new n.k(\"data\",{dataType:\"style\"})),v&&v(b)})}_unloadSprite(){for(let l of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(l),this._changedImages[l]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new n.k(\"data\",{dataType:\"style\"}))}_validateLayer(l){let d=this.sourceCaches[l.source];if(!d)return;let v=l.sourceLayer;if(!v)return;let b=d.getSource();(b.type===\"geojson\"||b.vectorLayerIds&&b.vectorLayerIds.indexOf(v)===-1)&&this.fire(new n.j(new Error(`Source layer \"${v}\" does not exist on source \"${b.id}\" as specified by style layer \"${l.id}\".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let l in this.sourceCaches)if(!this.sourceCaches[l].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(l){let d=this._serializedAllLayers();if(!l||l.length===0)return Object.values(d);let v=[];for(let b of l)d[b]&&v.push(d[b]);return v}_serializedAllLayers(){let l=this._serializedLayers;if(l)return l;l=this._serializedLayers={};let d=Object.keys(this._layers);for(let v of d){let b=this._layers[v];b.type!==\"custom\"&&(l[v]=b.serialize())}return l}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(let l in this.sourceCaches)if(this.sourceCaches[l].hasTransition())return!0;for(let l in this._layers)if(this._layers[l].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error(\"Style is not done loading.\")}update(l){if(!this._loaded)return;let d=this._changed;if(this._changed){let b=Object.keys(this._updatedLayers),M=Object.keys(this._removedLayers);(b.length||M.length)&&this._updateWorkerLayers(b,M);for(let O in this._updatedSources){let B=this._updatedSources[O];if(B===\"reload\")this._reloadSource(O);else{if(B!==\"clear\")throw new Error(`Invalid action ${B}`);this._clearSource(O)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let O in this._updatedPaintProps)this._layers[O].updateTransitions(l);this.light.updateTransitions(l),this._resetUpdates()}let v={};for(let b in this.sourceCaches){let M=this.sourceCaches[b];v[b]=M.used,M.used=!1}for(let b of this._order){let M=this._layers[b];M.recalculate(l,this._availableImages),!M.isHidden(l.zoom)&&M.source&&(this.sourceCaches[M.source].used=!0)}for(let b in v){let M=this.sourceCaches[b];v[b]!==M.used&&M.fire(new n.k(\"data\",{sourceDataType:\"visibility\",dataType:\"source\",sourceId:b}))}this.light.recalculate(l),this.z=l.zoom,d&&this.fire(new n.k(\"data\",{dataType:\"style\"}))}_updateTilesForChangedImages(){let l=Object.keys(this._changedImages);if(l.length){for(let d in this.sourceCaches)this.sourceCaches[d].reloadTilesForDependencies([\"icons\",\"patterns\"],l);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let l in this.sourceCaches)this.sourceCaches[l].reloadTilesForDependencies([\"glyphs\"],[\"\"]);this._glyphsDidChange=!1}}_updateWorkerLayers(l,d){this.dispatcher.broadcast(\"updateLayers\",{layers:this._serializeByIds(l),removedIds:d})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(l,d={}){this._checkLoaded();let v=this.serialize();if(l=d.transformStyle?d.transformStyle(v,l):l,ln(this,n.y(l)))return!1;(l=n.aD(l)).layers=n.aB(l.layers);let b=n.aE(v,l).filter(O=>!(O.command in Vm));if(b.length===0)return!1;let M=b.filter(O=>!(O.command in Dn));if(M.length>0)throw new Error(`Unimplemented: ${M.map(O=>O.command).join(\", \")}.`);for(let O of b)O.command!==\"setTransition\"&&this[O.command].apply(this,O.args);return this.stylesheet=l,this._serializedLayers=null,!0}addImage(l,d){if(this.getImage(l))return this.fire(new n.j(new Error(`An image named \"${l}\" already exists.`)));this.imageManager.addImage(l,d),this._afterImageUpdated(l)}updateImage(l,d){this.imageManager.updateImage(l,d)}getImage(l){return this.imageManager.getImage(l)}removeImage(l){if(!this.getImage(l))return this.fire(new n.j(new Error(`An image named \"${l}\" does not exist.`)));this.imageManager.removeImage(l),this._afterImageUpdated(l)}_afterImageUpdated(l){this._availableImages=this.imageManager.listImages(),this._changedImages[l]=!0,this._changed=!0,this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new n.k(\"data\",{dataType:\"style\"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(l,d,v={}){if(this._checkLoaded(),this.sourceCaches[l]!==void 0)throw new Error(`Source \"${l}\" already exists.`);if(!d.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(d).join(\", \")}.`);if([\"vector\",\"raster\",\"geojson\",\"video\",\"image\"].indexOf(d.type)>=0&&this._validate(n.y.source,`sources.${l}`,d,null,v))return;this.map&&this.map._collectResourceTiming&&(d.collectResourceTiming=!0);let b=this.sourceCaches[l]=new ls(l,d,this.dispatcher);b.style=this,b.setEventedParent(this,()=>({isSourceLoaded:b.loaded(),source:b.serialize(),sourceId:l})),b.onAdd(this.map),this._changed=!0}removeSource(l){if(this._checkLoaded(),this.sourceCaches[l]===void 0)throw new Error(\"There is no source with this ID\");for(let v in this._layers)if(this._layers[v].source===l)return this.fire(new n.j(new Error(`Source \"${l}\" cannot be removed while layer \"${v}\" is using it.`)));let d=this.sourceCaches[l];delete this.sourceCaches[l],delete this._updatedSources[l],d.fire(new n.k(\"data\",{sourceDataType:\"metadata\",dataType:\"source\",sourceId:l})),d.setEventedParent(null),d.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(l,d){if(this._checkLoaded(),this.sourceCaches[l]===void 0)throw new Error(`There is no source with this ID=${l}`);let v=this.sourceCaches[l].getSource();if(v.type!==\"geojson\")throw new Error(`geojsonSource.type is ${v.type}, which is !== 'geojson`);v.setData(d),this._changed=!0}getSource(l){return this.sourceCaches[l]&&this.sourceCaches[l].getSource()}addLayer(l,d,v={}){this._checkLoaded();let b=l.id;if(this.getLayer(b))return void this.fire(new n.j(new Error(`Layer \"${b}\" already exists on this map.`)));let M;if(l.type===\"custom\"){if(ln(this,n.aF(l)))return;M=n.aC(l)}else{if(\"source\"in l&&typeof l.source==\"object\"&&(this.addSource(b,l.source),l=n.aD(l),l=n.e(l,{source:b})),this._validate(n.y.layer,`layers.${b}`,l,{arrayIndex:-1},v))return;M=n.aC(l),this._validateLayer(M),M.setEventedParent(this,{layer:{id:b}})}let O=d?this._order.indexOf(d):this._order.length;if(d&&O===-1)this.fire(new n.j(new Error(`Cannot add layer \"${b}\" before non-existing layer \"${d}\".`)));else{if(this._order.splice(O,0,b),this._layerOrderChanged=!0,this._layers[b]=M,this._removedLayers[b]&&M.source&&M.type!==\"custom\"){let B=this._removedLayers[b];delete this._removedLayers[b],B.type!==M.type?this._updatedSources[M.source]=\"clear\":(this._updatedSources[M.source]=\"reload\",this.sourceCaches[M.source].pause())}this._updateLayer(M),M.onAdd&&M.onAdd(this.map)}}moveLayer(l,d){if(this._checkLoaded(),this._changed=!0,!this._layers[l])return void this.fire(new n.j(new Error(`The layer '${l}' does not exist in the map's style and cannot be moved.`)));if(l===d)return;let v=this._order.indexOf(l);this._order.splice(v,1);let b=d?this._order.indexOf(d):this._order.length;d&&b===-1?this.fire(new n.j(new Error(`Cannot move layer \"${l}\" before non-existing layer \"${d}\".`))):(this._order.splice(b,0,l),this._layerOrderChanged=!0)}removeLayer(l){this._checkLoaded();let d=this._layers[l];if(!d)return void this.fire(new n.j(new Error(`Cannot remove non-existing layer \"${l}\".`)));d.setEventedParent(null);let v=this._order.indexOf(l);this._order.splice(v,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[l]=d,delete this._layers[l],this._serializedLayers&&delete this._serializedLayers[l],delete this._updatedLayers[l],delete this._updatedPaintProps[l],d.onRemove&&d.onRemove(this.map)}getLayer(l){return this._layers[l]}getLayersOrder(){return[...this._order]}hasLayer(l){return l in this._layers}setLayerZoomRange(l,d,v){this._checkLoaded();let b=this.getLayer(l);b?b.minzoom===d&&b.maxzoom===v||(d!=null&&(b.minzoom=d),v!=null&&(b.maxzoom=v),this._updateLayer(b)):this.fire(new n.j(new Error(`Cannot set the zoom range of non-existing layer \"${l}\".`)))}setFilter(l,d,v={}){this._checkLoaded();let b=this.getLayer(l);if(b){if(!n.aG(b.filter,d))return d==null?(b.filter=void 0,void this._updateLayer(b)):void(this._validate(n.y.filter,`layers.${b.id}.filter`,d,null,v)||(b.filter=n.aD(d),this._updateLayer(b)))}else this.fire(new n.j(new Error(`Cannot filter non-existing layer \"${l}\".`)))}getFilter(l){return n.aD(this.getLayer(l).filter)}setLayoutProperty(l,d,v,b={}){this._checkLoaded();let M=this.getLayer(l);M?n.aG(M.getLayoutProperty(d),v)||(M.setLayoutProperty(d,v,b),this._updateLayer(M)):this.fire(new n.j(new Error(`Cannot style non-existing layer \"${l}\".`)))}getLayoutProperty(l,d){let v=this.getLayer(l);if(v)return v.getLayoutProperty(d);this.fire(new n.j(new Error(`Cannot get style of non-existing layer \"${l}\".`)))}setPaintProperty(l,d,v,b={}){this._checkLoaded();let M=this.getLayer(l);M?n.aG(M.getPaintProperty(d),v)||(M.setPaintProperty(d,v,b)&&this._updateLayer(M),this._changed=!0,this._updatedPaintProps[l]=!0):this.fire(new n.j(new Error(`Cannot style non-existing layer \"${l}\".`)))}getPaintProperty(l,d){return this.getLayer(l).getPaintProperty(d)}setFeatureState(l,d){this._checkLoaded();let v=l.source,b=l.sourceLayer,M=this.sourceCaches[v];if(M===void 0)return void this.fire(new n.j(new Error(`The source '${v}' does not exist in the map's style.`)));let O=M.getSource().type;O===\"geojson\"&&b?this.fire(new n.j(new Error(\"GeoJSON sources cannot have a sourceLayer parameter.\"))):O!==\"vector\"||b?(l.id===void 0&&this.fire(new n.j(new Error(\"The feature id parameter must be provided.\"))),M.setFeatureState(b,l.id,d)):this.fire(new n.j(new Error(\"The sourceLayer parameter must be provided for vector source types.\")))}removeFeatureState(l,d){this._checkLoaded();let v=l.source,b=this.sourceCaches[v];if(b===void 0)return void this.fire(new n.j(new Error(`The source '${v}' does not exist in the map's style.`)));let M=b.getSource().type,O=M===\"vector\"?l.sourceLayer:void 0;M!==\"vector\"||O?d&&typeof l.id!=\"string\"&&typeof l.id!=\"number\"?this.fire(new n.j(new Error(\"A feature id is required to remove its specific state property.\"))):b.removeFeatureState(O,l.id,d):this.fire(new n.j(new Error(\"The sourceLayer parameter must be provided for vector source types.\")))}getFeatureState(l){this._checkLoaded();let d=l.source,v=l.sourceLayer,b=this.sourceCaches[d];if(b!==void 0)return b.getSource().type!==\"vector\"||v?(l.id===void 0&&this.fire(new n.j(new Error(\"The feature id parameter must be provided.\"))),b.getFeatureState(v,l.id)):void this.fire(new n.j(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));this.fire(new n.j(new Error(`The source '${d}' does not exist in the map's style.`)))}getTransition(){return n.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let l=n.aH(this.sourceCaches,M=>M.serialize()),d=this._serializeByIds(this._order),v=this.map.getTerrain()||void 0,b=this.stylesheet;return n.aI({version:b.version,name:b.name,metadata:b.metadata,light:b.light,center:b.center,zoom:b.zoom,bearing:b.bearing,pitch:b.pitch,sprite:b.sprite,glyphs:b.glyphs,transition:b.transition,sources:l,layers:d,terrain:v},M=>M!==void 0)}_updateLayer(l){this._updatedLayers[l.id]=!0,l.source&&!this._updatedSources[l.source]&&this.sourceCaches[l.source].getSource().type!==\"raster\"&&(this._updatedSources[l.source]=\"reload\",this.sourceCaches[l.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(l){let d=O=>this._layers[O].type===\"fill-extrusion\",v={},b=[];for(let O=this._order.length-1;O>=0;O--){let B=this._order[O];if(d(B)){v[B]=O;for(let U of l){let W=U[B];if(W)for(let Z of W)b.push(Z)}}}b.sort((O,B)=>B.intersectionZ-O.intersectionZ);let M=[];for(let O=this._order.length-1;O>=0;O--){let B=this._order[O];if(d(B))for(let U=b.length-1;U>=0;U--){let W=b[U].feature;if(v[W.layer.id]{let pe=Ft.featureSortOrder;if(pe){let he=pe.indexOf($t.featureIndex);return pe.indexOf(oe.featureIndex)-he}return oe.featureIndex-$t.featureIndex});for(let $t of Qt)Bt.push($t)}}for(let Ft in pt)pt[Ft].forEach(Ht=>{let St=Ht.feature,Bt=W[B[Ft].source].getFeatureState(St.layer[\"source-layer\"],St.id);St.source=St.layer.source,St.layer[\"source-layer\"]&&(St.sourceLayer=St.layer[\"source-layer\"]),St.state=Bt});return pt}(this._layers,O,this.sourceCaches,l,d,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(M)}querySourceFeatures(l,d){d&&d.filter&&this._validate(n.y.filter,\"querySourceFeatures.filter\",d.filter,null,d);let v=this.sourceCaches[l];return v?function(b,M){let O=b.getRenderableIds().map(W=>b.getTileByID(W)),B=[],U={};for(let W=0;W{cl[b]=M})(l,d),d.workerSourceURL?void this.dispatcher.broadcast(\"loadWorkerSource\",{name:l,url:d.workerSourceURL},v):v(null,null))}getLight(){return this.light.getLight()}setLight(l,d={}){this._checkLoaded();let v=this.light.getLight(),b=!1;for(let O in l)if(!n.aG(l[O],v[O])){b=!0;break}if(!b)return;let M={now:n.h.now(),transition:n.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(l,d),this.light.updateTransitions(M)}_validate(l,d,v,b,M={}){return(!M||M.validate!==!1)&&ln(this,l.call(n.y,n.e({key:d,style:this.serialize(),value:v,styleSpec:n.v},b)))}_remove(l=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),n.aJ.off(\"pluginStateChange\",this._rtlTextPluginCallback);for(let d in this._layers)this._layers[d].setEventedParent(null);for(let d in this.sourceCaches){let v=this.sourceCaches[d];v.setEventedParent(null),v.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(l)}_clearSource(l){this.sourceCaches[l].clearTiles()}_reloadSource(l){this.sourceCaches[l].resume(),this.sourceCaches[l].reload()}_updateSources(l){for(let d in this.sourceCaches)this.sourceCaches[d].update(l,this.map.terrain)}_generateCollisionBoxes(){for(let l in this.sourceCaches)this._reloadSource(l)}_updatePlacement(l,d,v,b,M=!1){let O=!1,B=!1,U={};for(let W of this._order){let Z=this._layers[W];if(Z.type!==\"symbol\")continue;if(!U[Z.source]){let st=this.sourceCaches[Z.source];U[Z.source]=st.getRenderableIds(!0).map(At=>st.getTileByID(At)).sort((At,pt)=>pt.tileID.overscaledZ-At.tileID.overscaledZ||(At.tileID.isLessThan(pt.tileID)?-1:1))}let $=this.crossTileSymbolIndex.addLayer(Z,U[Z.source],l.center.lng);O=O||$}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((M=M||this._layerOrderChanged||v===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(n.h.now(),l.zoom))&&(this.pauseablePlacement=new Vl(l,this.map.terrain,this._order,M,d,v,b,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,U),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(n.h.now()),B=!0),O&&this.pauseablePlacement.placement.setStale()),B||O)for(let W of this._order){let Z=this._layers[W];Z.type===\"symbol\"&&this.placement.updateLayerOpacities(Z,U[Z.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(n.h.now())}_releaseSymbolFadeTiles(){for(let l in this.sourceCaches)this.sourceCaches[l].releaseSymbolFadeTiles()}getImages(l,d,v){this.imageManager.getImages(d.icons,v),this._updateTilesForChangedImages();let b=this.sourceCaches[d.source];b&&b.setDependencies(d.tileID.key,d.type,d.icons)}getGlyphs(l,d,v){this.glyphManager.getGlyphs(d.stacks,v);let b=this.sourceCaches[d.source];b&&b.setDependencies(d.tileID.key,d.type,[\"\"])}getResource(l,d,v){return n.m(d,v)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(l,d={}){this._checkLoaded(),l&&this._validate(n.y.glyphs,\"glyphs\",l,null,d)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=l,this.glyphManager.entries={},this.glyphManager.setURL(l))}addSprite(l,d,v={},b){this._checkLoaded();let M=[{id:l,url:d}],O=[...kt(this.stylesheet.sprite),...M];this._validate(n.y.sprite,\"sprite\",O,null,v)||(this.stylesheet.sprite=O,this._loadSprite(M,!0,b))}removeSprite(l){this._checkLoaded();let d=kt(this.stylesheet.sprite);if(d.find(v=>v.id===l)){if(this._spritesImagesIds[l])for(let v of this._spritesImagesIds[l])this.imageManager.removeImage(v),this._changedImages[v]=!0;d.splice(d.findIndex(v=>v.id===l),1),this.stylesheet.sprite=d.length>0?d:void 0,delete this._spritesImagesIds[l],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new n.k(\"data\",{dataType:\"style\"}))}else this.fire(new n.j(new Error(`Sprite \"${l}\" doesn't exists on this map.`)))}getSprite(){return kt(this.stylesheet.sprite)}setSprite(l,d={},v){this._checkLoaded(),l&&this._validate(n.y.sprite,\"sprite\",l,null,d)||(this.stylesheet.sprite=l,l?this._loadSprite(l,!0,v):(this._unloadSprite(),v&&v(null)))}}Gn.registerForPluginStateChange=n.aK;var So=n.Q([{name:\"a_pos\",type:\"Int16\",components:2}]),jl=\"attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}\";let Ki={prelude:_i(`#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\n`,`#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}`),background:_i(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,\"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}\"),backgroundPattern:_i(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,\"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}\"),circle:_i(`varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:_i(\"void main() {gl_FragColor=vec4(1.0);}\",\"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}\"),heatmap:_i(`uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:_i(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}`,\"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}\"),collisionBox:_i(\"varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}\",\"attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}\"),collisionCircle:_i(\"varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}\",\"attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}\"),debug:_i(\"uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}\",\"attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}\"),fill:_i(`#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:_i(`varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:_i(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:_i(`#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:_i(`varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:_i(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:_i(`#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,\"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}\"),hillshade:_i(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,\"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}\"),line:_i(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}`),lineGradient:_i(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}`),linePattern:_i(`#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:_i(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:_i(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,\"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}\"),symbolIcon:_i(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:_i(`#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:_i(`#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:_i(\"uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}\",jl),terrainDepth:_i(\"varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}\",jl),terrainCoords:_i(\"precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}\",jl)};function _i(T,l){let d=/#pragma mapbox: ([\\w]+) ([\\w]+) ([\\w]+) ([\\w]+)/g,v=l.match(/attribute ([\\w]+) ([\\w]+)/g),b=T.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g),M=l.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g),O=M?M.concat(b):b,B={};return{fragmentSource:T=T.replace(d,(U,W,Z,$,st)=>(B[st]=!0,W===\"define\"?`\n#ifndef HAS_UNIFORM_u_${st}\nvarying ${Z} ${$} ${st};\n#else\nuniform ${Z} ${$} u_${st};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${st}\n ${Z} ${$} ${st} = u_${st};\n#endif\n`)),vertexSource:l=l.replace(d,(U,W,Z,$,st)=>{let At=$===\"float\"?\"vec2\":\"vec4\",pt=st.match(/color/)?\"color\":At;return B[st]?W===\"define\"?`\n#ifndef HAS_UNIFORM_u_${st}\nuniform lowp float u_${st}_t;\nattribute ${Z} ${At} a_${st};\nvarying ${Z} ${$} ${st};\n#else\nuniform ${Z} ${$} u_${st};\n#endif\n`:pt===\"vec4\"?`\n#ifndef HAS_UNIFORM_u_${st}\n ${st} = a_${st};\n#else\n ${Z} ${$} ${st} = u_${st};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${st}\n ${st} = unpack_mix_${pt}(a_${st}, u_${st}_t);\n#else\n ${Z} ${$} ${st} = u_${st};\n#endif\n`:W===\"define\"?`\n#ifndef HAS_UNIFORM_u_${st}\nuniform lowp float u_${st}_t;\nattribute ${Z} ${At} a_${st};\n#else\nuniform ${Z} ${$} u_${st};\n#endif\n`:pt===\"vec4\"?`\n#ifndef HAS_UNIFORM_u_${st}\n ${Z} ${$} ${st} = a_${st};\n#else\n ${Z} ${$} ${st} = u_${st};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${st}\n ${Z} ${$} ${st} = unpack_mix_${pt}(a_${st}, u_${st}_t);\n#else\n ${Z} ${$} ${st} = u_${st};\n#endif\n`}),staticAttributes:v,staticUniforms:O}}class Gl{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(l,d,v,b,M,O,B,U,W){this.context=l;let Z=this.boundPaintVertexBuffers.length!==b.length;for(let $=0;!Z&&$({u_depth:new n.aL($t,oe.u_depth),u_terrain:new n.aL($t,oe.u_terrain),u_terrain_dim:new n.aM($t,oe.u_terrain_dim),u_terrain_matrix:new n.aN($t,oe.u_terrain_matrix),u_terrain_unpack:new n.aO($t,oe.u_terrain_unpack),u_terrain_exaggeration:new n.aM($t,oe.u_terrain_exaggeration)}))(l,Qt),this.binderUniforms=v?v.getUniforms(l,Qt):[]}draw(l,d,v,b,M,O,B,U,W,Z,$,st,At,pt,yt,dt,Ft,Ht){let St=l.gl;if(this.failedToCreate)return;if(l.program.set(this.program),l.setDepthMode(v),l.setStencilMode(b),l.setColorMode(M),l.setCullFace(O),U){l.activeTexture.set(St.TEXTURE2),St.bindTexture(St.TEXTURE_2D,U.depthTexture),l.activeTexture.set(St.TEXTURE3),St.bindTexture(St.TEXTURE_2D,U.texture);for(let Qt in this.terrainUniforms)this.terrainUniforms[Qt].set(U[Qt])}for(let Qt in this.fixedUniforms)this.fixedUniforms[Qt].set(B[Qt]);yt&&yt.setUniforms(l,this.binderUniforms,At,{zoom:pt});let Bt=0;switch(d){case St.LINES:Bt=2;break;case St.TRIANGLES:Bt=3;break;case St.LINE_STRIP:Bt=1}for(let Qt of st.get()){let $t=Qt.vaos||(Qt.vaos={});($t[W]||($t[W]=new Gl)).bind(l,this,Z,yt?yt.getPaintVertexBuffers():[],$,Qt.vertexOffset,dt,Ft,Ht),St.drawElements(d,Qt.primitiveLength*Bt,St.UNSIGNED_SHORT,Qt.primitiveOffset*Bt*2)}}}function rs(T,l,d){let v=1/Dt(d,1,l.transform.tileZoom),b=Math.pow(2,d.tileID.overscaledZ),M=d.tileSize*Math.pow(2,l.transform.tileZoom)/b,O=M*(d.tileID.canonical.x+d.tileID.wrap*b),B=M*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture.size,u_scale:[v,T.fromScale,T.toScale],u_fade:T.t,u_pixel_coord_upper:[O>>16,B>>16],u_pixel_coord_lower:[65535&O,65535&B]}}let Gp=(T,l,d,v)=>{let b=l.style.light,M=b.properties.get(\"position\"),O=[M.x,M.y,M.z],B=function(){var W=new n.A(9);return n.A!=Float32Array&&(W[1]=0,W[2]=0,W[3]=0,W[5]=0,W[6]=0,W[7]=0),W[0]=1,W[4]=1,W[8]=1,W}();b.properties.get(\"anchor\")===\"viewport\"&&function(W,Z){var $=Math.sin(Z),st=Math.cos(Z);W[0]=st,W[1]=$,W[2]=0,W[3]=-$,W[4]=st,W[5]=0,W[6]=0,W[7]=0,W[8]=1}(B,-l.transform.angle),function(W,Z,$){var st=Z[0],At=Z[1],pt=Z[2];W[0]=st*$[0]+At*$[3]+pt*$[6],W[1]=st*$[1]+At*$[4]+pt*$[7],W[2]=st*$[2]+At*$[5]+pt*$[8]}(O,O,B);let U=b.properties.get(\"color\");return{u_matrix:T,u_lightpos:O,u_lightintensity:b.properties.get(\"intensity\"),u_lightcolor:[U.r,U.g,U.b],u_vertical_gradient:+d,u_opacity:v}},Wl=(T,l,d,v,b,M,O)=>n.e(Gp(T,l,d,v),rs(M,l,O),{u_height_factor:-Math.pow(2,b.overscaledZ)/O.tileSize/8}),_d=T=>({u_matrix:T}),yd=(T,l,d,v)=>n.e(_d(T),rs(d,l,v)),vd=(T,l)=>({u_matrix:T,u_world:l}),xd=(T,l,d,v,b)=>n.e(yd(T,l,d,v),{u_world:b}),lt=(T,l,d,v)=>{let b=T.transform,M,O;if(v.paint.get(\"circle-pitch-alignment\")===\"map\"){let B=Dt(d,1,b.zoom);M=!0,O=[B,B]}else M=!1,O=b.pixelsToGLUnits;return{u_camera_to_center_distance:b.cameraToCenterDistance,u_scale_with_map:+(v.paint.get(\"circle-pitch-scale\")===\"map\"),u_matrix:T.translatePosMatrix(l.posMatrix,d,v.paint.get(\"circle-translate\"),v.paint.get(\"circle-translate-anchor\")),u_pitch_with_map:+M,u_device_pixel_ratio:T.pixelRatio,u_extrude_scale:O}},ft=(T,l,d)=>{let v=Dt(d,1,l.zoom),b=Math.pow(2,l.zoom-d.tileID.overscaledZ),M=d.tileID.overscaleFactor();return{u_matrix:T,u_camera_to_center_distance:l.cameraToCenterDistance,u_pixels_to_tile_units:v,u_extrude_scale:[l.pixelsToGLUnits[0]/(v*b),l.pixelsToGLUnits[1]/(v*b)],u_overscale_factor:M}},Lt=(T,l,d=1)=>({u_matrix:T,u_color:l,u_overlay:0,u_overlay_scale:d}),Kt=T=>({u_matrix:T}),ge=(T,l,d,v)=>({u_matrix:T,u_extrude_scale:Dt(l,1,d),u_intensity:v});function Qe(T,l){let d=Math.pow(2,l.canonical.z),v=l.canonical.y;return[new n.U(0,v/d).toLngLat().lat,new n.U(0,(v+1)/d).toLngLat().lat]}let ti=(T,l,d,v)=>{let b=T.transform;return{u_matrix:jm(T,l,d,v),u_ratio:1/Dt(l,1,b.zoom),u_device_pixel_ratio:T.pixelRatio,u_units_to_pixels:[1/b.pixelsToGLUnits[0],1/b.pixelsToGLUnits[1]]}},is=(T,l,d,v,b)=>n.e(ti(T,l,d,b),{u_image:0,u_image_height:v}),Ts=(T,l,d,v,b)=>{let M=T.transform,O=Ra(l,M);return{u_matrix:jm(T,l,d,b),u_texsize:l.imageAtlasTexture.size,u_ratio:1/Dt(l,1,M.zoom),u_device_pixel_ratio:T.pixelRatio,u_image:0,u_scale:[O,v.fromScale,v.toScale],u_fade:v.t,u_units_to_pixels:[1/M.pixelsToGLUnits[0],1/M.pixelsToGLUnits[1]]}},Vs=(T,l,d,v,b,M)=>{let O=T.lineAtlas,B=Ra(l,T.transform),U=d.layout.get(\"line-cap\")===\"round\",W=O.getDash(v.from,U),Z=O.getDash(v.to,U),$=W.width*b.fromScale,st=Z.width*b.toScale;return n.e(ti(T,l,d,M),{u_patternscale_a:[B/$,-W.height/2],u_patternscale_b:[B/st,-Z.height/2],u_sdfgamma:O.width/(256*Math.min($,st)*T.pixelRatio)/2,u_image:0,u_tex_y_a:W.y,u_tex_y_b:Z.y,u_mix:b.t})};function Ra(T,l){return 1/Dt(T,1,l.tileZoom)}function jm(T,l,d,v){return T.translatePosMatrix(v?v.posMatrix:l.tileID.posMatrix,l,d.paint.get(\"line-translate\"),d.paint.get(\"line-translate-anchor\"))}let Ox=(T,l,d,v,b)=>{return{u_matrix:T,u_tl_parent:l,u_scale_parent:d,u_buffer_scale:1,u_fade_t:v.mix,u_opacity:v.opacity*b.paint.get(\"raster-opacity\"),u_image0:0,u_image1:1,u_brightness_low:b.paint.get(\"raster-brightness-min\"),u_brightness_high:b.paint.get(\"raster-brightness-max\"),u_saturation_factor:(O=b.paint.get(\"raster-saturation\"),O>0?1-1/(1.001-O):-O),u_contrast_factor:(M=b.paint.get(\"raster-contrast\"),M>0?1/(1-M):1+M),u_spin_weights:Bx(b.paint.get(\"raster-hue-rotate\"))};var M,O};function Bx(T){T*=Math.PI/180;let l=Math.sin(T),d=Math.cos(T);return[(2*d+1)/3,(-Math.sqrt(3)*l-d+1)/3,(Math.sqrt(3)*l-d+1)/3]}let l_=(T,l,d,v,b,M,O,B,U,W)=>{let Z=b.transform;return{u_is_size_zoom_constant:+(T===\"constant\"||T===\"source\"),u_is_size_feature_constant:+(T===\"constant\"||T===\"camera\"),u_size_t:l?l.uSizeT:0,u_size:l?l.uSize:0,u_camera_to_center_distance:Z.cameraToCenterDistance,u_pitch:Z.pitch/360*2*Math.PI,u_rotate_symbol:+d,u_aspect_ratio:Z.width/Z.height,u_fade_change:b.options.fadeDuration?b.symbolFadeChange:1,u_matrix:M,u_label_plane_matrix:O,u_coord_matrix:B,u_is_text:+U,u_pitch_with_map:+v,u_texsize:W,u_texture:0}},c_=(T,l,d,v,b,M,O,B,U,W,Z)=>{let $=b.transform;return n.e(l_(T,l,d,v,b,M,O,B,U,W),{u_gamma_scale:v?Math.cos($._pitch)*$.cameraToCenterDistance:1,u_device_pixel_ratio:b.pixelRatio,u_is_halo:+Z})},gf=(T,l,d,v,b,M,O,B,U,W)=>n.e(c_(T,l,d,v,b,M,O,B,!0,U,!0),{u_texsize_icon:W,u_texture_icon:1}),Gm=(T,l,d)=>({u_matrix:T,u_opacity:l,u_color:d}),fl=(T,l,d,v,b,M)=>n.e(function(O,B,U,W){let Z=U.imageManager.getPattern(O.from.toString()),$=U.imageManager.getPattern(O.to.toString()),{width:st,height:At}=U.imageManager.getPixelSize(),pt=Math.pow(2,W.tileID.overscaledZ),yt=W.tileSize*Math.pow(2,U.transform.tileZoom)/pt,dt=yt*(W.tileID.canonical.x+W.tileID.wrap*pt),Ft=yt*W.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:Z.tl,u_pattern_br_a:Z.br,u_pattern_tl_b:$.tl,u_pattern_br_b:$.br,u_texsize:[st,At],u_mix:B.t,u_pattern_size_a:Z.displaySize,u_pattern_size_b:$.displaySize,u_scale_a:B.fromScale,u_scale_b:B.toScale,u_tile_units_to_pixels:1/Dt(W,1,U.transform.tileZoom),u_pixel_coord_upper:[dt>>16,Ft>>16],u_pixel_coord_lower:[65535&dt,65535&Ft]}}(v,M,d,b),{u_matrix:T,u_opacity:l}),Wm={fillExtrusion:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_lightpos:new n.aP(T,l.u_lightpos),u_lightintensity:new n.aM(T,l.u_lightintensity),u_lightcolor:new n.aP(T,l.u_lightcolor),u_vertical_gradient:new n.aM(T,l.u_vertical_gradient),u_opacity:new n.aM(T,l.u_opacity)}),fillExtrusionPattern:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_lightpos:new n.aP(T,l.u_lightpos),u_lightintensity:new n.aM(T,l.u_lightintensity),u_lightcolor:new n.aP(T,l.u_lightcolor),u_vertical_gradient:new n.aM(T,l.u_vertical_gradient),u_height_factor:new n.aM(T,l.u_height_factor),u_image:new n.aL(T,l.u_image),u_texsize:new n.aQ(T,l.u_texsize),u_pixel_coord_upper:new n.aQ(T,l.u_pixel_coord_upper),u_pixel_coord_lower:new n.aQ(T,l.u_pixel_coord_lower),u_scale:new n.aP(T,l.u_scale),u_fade:new n.aM(T,l.u_fade),u_opacity:new n.aM(T,l.u_opacity)}),fill:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix)}),fillPattern:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_image:new n.aL(T,l.u_image),u_texsize:new n.aQ(T,l.u_texsize),u_pixel_coord_upper:new n.aQ(T,l.u_pixel_coord_upper),u_pixel_coord_lower:new n.aQ(T,l.u_pixel_coord_lower),u_scale:new n.aP(T,l.u_scale),u_fade:new n.aM(T,l.u_fade)}),fillOutline:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_world:new n.aQ(T,l.u_world)}),fillOutlinePattern:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_world:new n.aQ(T,l.u_world),u_image:new n.aL(T,l.u_image),u_texsize:new n.aQ(T,l.u_texsize),u_pixel_coord_upper:new n.aQ(T,l.u_pixel_coord_upper),u_pixel_coord_lower:new n.aQ(T,l.u_pixel_coord_lower),u_scale:new n.aP(T,l.u_scale),u_fade:new n.aM(T,l.u_fade)}),circle:(T,l)=>({u_camera_to_center_distance:new n.aM(T,l.u_camera_to_center_distance),u_scale_with_map:new n.aL(T,l.u_scale_with_map),u_pitch_with_map:new n.aL(T,l.u_pitch_with_map),u_extrude_scale:new n.aQ(T,l.u_extrude_scale),u_device_pixel_ratio:new n.aM(T,l.u_device_pixel_ratio),u_matrix:new n.aN(T,l.u_matrix)}),collisionBox:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_camera_to_center_distance:new n.aM(T,l.u_camera_to_center_distance),u_pixels_to_tile_units:new n.aM(T,l.u_pixels_to_tile_units),u_extrude_scale:new n.aQ(T,l.u_extrude_scale),u_overscale_factor:new n.aM(T,l.u_overscale_factor)}),collisionCircle:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_inv_matrix:new n.aN(T,l.u_inv_matrix),u_camera_to_center_distance:new n.aM(T,l.u_camera_to_center_distance),u_viewport_size:new n.aQ(T,l.u_viewport_size)}),debug:(T,l)=>({u_color:new n.aR(T,l.u_color),u_matrix:new n.aN(T,l.u_matrix),u_overlay:new n.aL(T,l.u_overlay),u_overlay_scale:new n.aM(T,l.u_overlay_scale)}),clippingMask:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix)}),heatmap:(T,l)=>({u_extrude_scale:new n.aM(T,l.u_extrude_scale),u_intensity:new n.aM(T,l.u_intensity),u_matrix:new n.aN(T,l.u_matrix)}),heatmapTexture:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_world:new n.aQ(T,l.u_world),u_image:new n.aL(T,l.u_image),u_color_ramp:new n.aL(T,l.u_color_ramp),u_opacity:new n.aM(T,l.u_opacity)}),hillshade:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_image:new n.aL(T,l.u_image),u_latrange:new n.aQ(T,l.u_latrange),u_light:new n.aQ(T,l.u_light),u_shadow:new n.aR(T,l.u_shadow),u_highlight:new n.aR(T,l.u_highlight),u_accent:new n.aR(T,l.u_accent)}),hillshadePrepare:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_image:new n.aL(T,l.u_image),u_dimension:new n.aQ(T,l.u_dimension),u_zoom:new n.aM(T,l.u_zoom),u_unpack:new n.aO(T,l.u_unpack)}),line:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_ratio:new n.aM(T,l.u_ratio),u_device_pixel_ratio:new n.aM(T,l.u_device_pixel_ratio),u_units_to_pixels:new n.aQ(T,l.u_units_to_pixels)}),lineGradient:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_ratio:new n.aM(T,l.u_ratio),u_device_pixel_ratio:new n.aM(T,l.u_device_pixel_ratio),u_units_to_pixels:new n.aQ(T,l.u_units_to_pixels),u_image:new n.aL(T,l.u_image),u_image_height:new n.aM(T,l.u_image_height)}),linePattern:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_texsize:new n.aQ(T,l.u_texsize),u_ratio:new n.aM(T,l.u_ratio),u_device_pixel_ratio:new n.aM(T,l.u_device_pixel_ratio),u_image:new n.aL(T,l.u_image),u_units_to_pixels:new n.aQ(T,l.u_units_to_pixels),u_scale:new n.aP(T,l.u_scale),u_fade:new n.aM(T,l.u_fade)}),lineSDF:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_ratio:new n.aM(T,l.u_ratio),u_device_pixel_ratio:new n.aM(T,l.u_device_pixel_ratio),u_units_to_pixels:new n.aQ(T,l.u_units_to_pixels),u_patternscale_a:new n.aQ(T,l.u_patternscale_a),u_patternscale_b:new n.aQ(T,l.u_patternscale_b),u_sdfgamma:new n.aM(T,l.u_sdfgamma),u_image:new n.aL(T,l.u_image),u_tex_y_a:new n.aM(T,l.u_tex_y_a),u_tex_y_b:new n.aM(T,l.u_tex_y_b),u_mix:new n.aM(T,l.u_mix)}),raster:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_tl_parent:new n.aQ(T,l.u_tl_parent),u_scale_parent:new n.aM(T,l.u_scale_parent),u_buffer_scale:new n.aM(T,l.u_buffer_scale),u_fade_t:new n.aM(T,l.u_fade_t),u_opacity:new n.aM(T,l.u_opacity),u_image0:new n.aL(T,l.u_image0),u_image1:new n.aL(T,l.u_image1),u_brightness_low:new n.aM(T,l.u_brightness_low),u_brightness_high:new n.aM(T,l.u_brightness_high),u_saturation_factor:new n.aM(T,l.u_saturation_factor),u_contrast_factor:new n.aM(T,l.u_contrast_factor),u_spin_weights:new n.aP(T,l.u_spin_weights)}),symbolIcon:(T,l)=>({u_is_size_zoom_constant:new n.aL(T,l.u_is_size_zoom_constant),u_is_size_feature_constant:new n.aL(T,l.u_is_size_feature_constant),u_size_t:new n.aM(T,l.u_size_t),u_size:new n.aM(T,l.u_size),u_camera_to_center_distance:new n.aM(T,l.u_camera_to_center_distance),u_pitch:new n.aM(T,l.u_pitch),u_rotate_symbol:new n.aL(T,l.u_rotate_symbol),u_aspect_ratio:new n.aM(T,l.u_aspect_ratio),u_fade_change:new n.aM(T,l.u_fade_change),u_matrix:new n.aN(T,l.u_matrix),u_label_plane_matrix:new n.aN(T,l.u_label_plane_matrix),u_coord_matrix:new n.aN(T,l.u_coord_matrix),u_is_text:new n.aL(T,l.u_is_text),u_pitch_with_map:new n.aL(T,l.u_pitch_with_map),u_texsize:new n.aQ(T,l.u_texsize),u_texture:new n.aL(T,l.u_texture)}),symbolSDF:(T,l)=>({u_is_size_zoom_constant:new n.aL(T,l.u_is_size_zoom_constant),u_is_size_feature_constant:new n.aL(T,l.u_is_size_feature_constant),u_size_t:new n.aM(T,l.u_size_t),u_size:new n.aM(T,l.u_size),u_camera_to_center_distance:new n.aM(T,l.u_camera_to_center_distance),u_pitch:new n.aM(T,l.u_pitch),u_rotate_symbol:new n.aL(T,l.u_rotate_symbol),u_aspect_ratio:new n.aM(T,l.u_aspect_ratio),u_fade_change:new n.aM(T,l.u_fade_change),u_matrix:new n.aN(T,l.u_matrix),u_label_plane_matrix:new n.aN(T,l.u_label_plane_matrix),u_coord_matrix:new n.aN(T,l.u_coord_matrix),u_is_text:new n.aL(T,l.u_is_text),u_pitch_with_map:new n.aL(T,l.u_pitch_with_map),u_texsize:new n.aQ(T,l.u_texsize),u_texture:new n.aL(T,l.u_texture),u_gamma_scale:new n.aM(T,l.u_gamma_scale),u_device_pixel_ratio:new n.aM(T,l.u_device_pixel_ratio),u_is_halo:new n.aL(T,l.u_is_halo)}),symbolTextAndIcon:(T,l)=>({u_is_size_zoom_constant:new n.aL(T,l.u_is_size_zoom_constant),u_is_size_feature_constant:new n.aL(T,l.u_is_size_feature_constant),u_size_t:new n.aM(T,l.u_size_t),u_size:new n.aM(T,l.u_size),u_camera_to_center_distance:new n.aM(T,l.u_camera_to_center_distance),u_pitch:new n.aM(T,l.u_pitch),u_rotate_symbol:new n.aL(T,l.u_rotate_symbol),u_aspect_ratio:new n.aM(T,l.u_aspect_ratio),u_fade_change:new n.aM(T,l.u_fade_change),u_matrix:new n.aN(T,l.u_matrix),u_label_plane_matrix:new n.aN(T,l.u_label_plane_matrix),u_coord_matrix:new n.aN(T,l.u_coord_matrix),u_is_text:new n.aL(T,l.u_is_text),u_pitch_with_map:new n.aL(T,l.u_pitch_with_map),u_texsize:new n.aQ(T,l.u_texsize),u_texsize_icon:new n.aQ(T,l.u_texsize_icon),u_texture:new n.aL(T,l.u_texture),u_texture_icon:new n.aL(T,l.u_texture_icon),u_gamma_scale:new n.aM(T,l.u_gamma_scale),u_device_pixel_ratio:new n.aM(T,l.u_device_pixel_ratio),u_is_halo:new n.aL(T,l.u_is_halo)}),background:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_opacity:new n.aM(T,l.u_opacity),u_color:new n.aR(T,l.u_color)}),backgroundPattern:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_opacity:new n.aM(T,l.u_opacity),u_image:new n.aL(T,l.u_image),u_pattern_tl_a:new n.aQ(T,l.u_pattern_tl_a),u_pattern_br_a:new n.aQ(T,l.u_pattern_br_a),u_pattern_tl_b:new n.aQ(T,l.u_pattern_tl_b),u_pattern_br_b:new n.aQ(T,l.u_pattern_br_b),u_texsize:new n.aQ(T,l.u_texsize),u_mix:new n.aM(T,l.u_mix),u_pattern_size_a:new n.aQ(T,l.u_pattern_size_a),u_pattern_size_b:new n.aQ(T,l.u_pattern_size_b),u_scale_a:new n.aM(T,l.u_scale_a),u_scale_b:new n.aM(T,l.u_scale_b),u_pixel_coord_upper:new n.aQ(T,l.u_pixel_coord_upper),u_pixel_coord_lower:new n.aQ(T,l.u_pixel_coord_lower),u_tile_units_to_pixels:new n.aM(T,l.u_tile_units_to_pixels)}),terrain:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_texture:new n.aL(T,l.u_texture),u_ele_delta:new n.aM(T,l.u_ele_delta)}),terrainDepth:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_ele_delta:new n.aM(T,l.u_ele_delta)}),terrainCoords:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_texture:new n.aL(T,l.u_texture),u_terrain_coords_id:new n.aM(T,l.u_terrain_coords_id),u_ele_delta:new n.aM(T,l.u_ele_delta)})};class Hm{constructor(l,d,v){this.context=l;let b=l.gl;this.buffer=b.createBuffer(),this.dynamicDraw=!!v,this.context.unbindVAO(),l.bindElementBuffer.set(this.buffer),b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?b.DYNAMIC_DRAW:b.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(l){let d=this.context.gl;if(!this.dynamicDraw)throw new Error(\"Attempted to update data while not in dynamic mode.\");this.context.unbindVAO(),this.bind(),d.bufferSubData(d.ELEMENT_ARRAY_BUFFER,0,l.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let Wp={Int8:\"BYTE\",Uint8:\"UNSIGNED_BYTE\",Int16:\"SHORT\",Uint16:\"UNSIGNED_SHORT\",Int32:\"INT\",Uint32:\"UNSIGNED_INT\",Float32:\"FLOAT\"};class qm{constructor(l,d,v,b){this.length=d.length,this.attributes=v,this.itemSize=d.bytesPerElement,this.dynamicDraw=b,this.context=l;let M=l.gl;this.buffer=M.createBuffer(),l.bindVertexBuffer.set(this.buffer),M.bufferData(M.ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?M.DYNAMIC_DRAW:M.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(l){if(l.length!==this.length)throw new Error(`Length of new data is ${l.length}, which doesn't match current length of ${this.length}`);let d=this.context.gl;this.bind(),d.bufferSubData(d.ARRAY_BUFFER,0,l.arrayBuffer)}enableAttributes(l,d){for(let v=0;v0){let be=n.Z(),Ze=oe;n.aU(be,$t.placementInvProjMatrix,T.transform.glCoordMatrix),n.aU(be,be,$t.placementViewportMatrix),Z.push({circleArray:he,circleOffset:st,transform:Ze,invTransform:be,coord:Bt}),$+=he.length/4,st=$}pe&&W.draw(B,U.LINES,ci.disabled,Je.disabled,T.colorModeForRenderPass(),It.disabled,ft(oe,T.transform,Qt),T.style.map.terrain&&T.style.map.terrain.getTerrainData(Bt),d.id,pe.layoutVertexBuffer,pe.indexBuffer,pe.segments,null,T.transform.zoom,null,null,pe.collisionVertexBuffer)}if(!O||!Z.length)return;let At=T.useProgram(\"collisionCircle\"),pt=new n.aV;pt.resize(4*$),pt._trim();let yt=0;for(let St of Z)for(let Bt=0;Bt=0&&(pt[dt.associatedIconIndex]={shiftedAnchor:Kr,angle:Ee})}else ht(dt.numGlyphs,st)}if(W){At.clear();let yt=T.icon.placedSymbolArray;for(let dt=0;dtT.style.map.terrain.getElevation(pe,Zo,_n):null,fs=d.layout.get(\"text-rotation-alignment\")===\"map\";Te(be,pe.posMatrix,T,b,jr,ql,dt,W,fs,Fn)}let vu=T.translatePosMatrix(pe.posMatrix,he,M,O),_h=Ft||b&&$t||yu?Jm:jr,Ws=T.translatePosMatrix(ql,he,M,O,!0),Ps=Ee&&d.paint.get(b?\"text-halo-width\":\"icon-halo-width\").constantOr(1)!==0,Eo;Eo=Ee?be.iconsInText?gf(pr.kind,Jr,Ht,dt,T,vu,_h,Ws,ei,hs):c_(pr.kind,Jr,Ht,dt,T,vu,_h,Ws,b,ei,!0):l_(pr.kind,Jr,Ht,dt,T,vu,_h,Ws,b,ei);let yh={program:Gi,buffers:Ze,uniformValues:Eo,atlasTexture:On,atlasTextureIcon:Bn,atlasInterpolation:tn,atlasInterpolationIcon:Gs,isSDF:Ee,hasHalo:Ps};if(St&&be.canOverlap){Bt=!0;let Fn=Ze.segments.get();for(let fs of Fn)oe.push({segments:new n.S([fs]),sortKey:fs.sortKey,state:yh,terrainData:Vr})}else oe.push({segments:Ze.segments,sortKey:0,state:yh,terrainData:Vr})}Bt&&oe.sort((pe,he)=>pe.sortKey-he.sortKey);for(let pe of oe){let he=pe.state;if(st.activeTexture.set(At.TEXTURE0),he.atlasTexture.bind(he.atlasInterpolation,At.CLAMP_TO_EDGE),he.atlasTextureIcon&&(st.activeTexture.set(At.TEXTURE1),he.atlasTextureIcon&&he.atlasTextureIcon.bind(he.atlasInterpolationIcon,At.CLAMP_TO_EDGE)),he.isSDF){let be=he.uniformValues;he.hasHalo&&(be.u_is_halo=1,e0(he.buffers,pe.segments,d,T,he.program,Qt,Z,$,be,pe.terrainData)),be.u_is_halo=0}e0(he.buffers,pe.segments,d,T,he.program,Qt,Z,$,he.uniformValues,pe.terrainData)}}function e0(T,l,d,v,b,M,O,B,U,W){let Z=v.context;b.draw(Z,Z.gl.TRIANGLES,M,O,B,It.disabled,U,W,d.id,T.layoutVertexBuffer,T.indexBuffer,l,d.paint,v.transform.zoom,T.programConfigurations.get(d.id),T.dynamicLayoutVertexBuffer,T.opacityVertexBuffer)}function Ed(T,l,d,v,b){if(!d||!v||!v.imageAtlas)return;let M=v.imageAtlas.patternPositions,O=M[d.to.toString()],B=M[d.from.toString()];if(!O&&B&&(O=B),!B&&O&&(B=O),!O||!B){let U=b.getPaintProperty(l);O=M[U],B=M[U]}O&&B&&T.setConstantPatternPositions(O,B)}function Pd(T,l,d,v,b,M,O){let B=T.context.gl,U=\"fill-pattern\",W=d.paint.get(U),Z=W&&W.constantOr(1),$=d.getCrossfadeParameters(),st,At,pt,yt,dt;O?(At=Z&&!d.getPaintProperty(\"fill-outline-color\")?\"fillOutlinePattern\":\"fillOutline\",st=B.LINES):(At=Z?\"fillPattern\":\"fill\",st=B.TRIANGLES);let Ft=W.constantOr(null);for(let Ht of v){let St=l.getTile(Ht);if(Z&&!St.patternsLoaded())continue;let Bt=St.getBucket(d);if(!Bt)continue;let Qt=Bt.programConfigurations.get(d.id),$t=T.useProgram(At,Qt),oe=T.style.map.terrain&&T.style.map.terrain.getTerrainData(Ht);Z&&(T.context.activeTexture.set(B.TEXTURE0),St.imageAtlasTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE),Qt.updatePaintBuffers($)),Ed(Qt,U,Ft,St,d);let pe=oe?Ht:null,he=T.translatePosMatrix(pe?pe.posMatrix:Ht.posMatrix,St,d.paint.get(\"fill-translate\"),d.paint.get(\"fill-translate-anchor\"));if(O){yt=Bt.indexBuffer2,dt=Bt.segments2;let be=[B.drawingBufferWidth,B.drawingBufferHeight];pt=At===\"fillOutlinePattern\"&&Z?xd(he,T,$,St,be):vd(he,be)}else yt=Bt.indexBuffer,dt=Bt.segments,pt=Z?yd(he,T,$,St):_d(he);$t.draw(T.context,st,b,T.stencilModeForClipping(Ht),M,It.disabled,pt,oe,d.id,Bt.layoutVertexBuffer,yt,dt,d.paint,T.transform.zoom,Qt)}}function Id(T,l,d,v,b,M,O){let B=T.context,U=B.gl,W=\"fill-extrusion-pattern\",Z=d.paint.get(W),$=Z.constantOr(1),st=d.getCrossfadeParameters(),At=d.paint.get(\"fill-extrusion-opacity\"),pt=Z.constantOr(null);for(let yt of v){let dt=l.getTile(yt),Ft=dt.getBucket(d);if(!Ft)continue;let Ht=T.style.map.terrain&&T.style.map.terrain.getTerrainData(yt),St=Ft.programConfigurations.get(d.id),Bt=T.useProgram($?\"fillExtrusionPattern\":\"fillExtrusion\",St);$&&(T.context.activeTexture.set(U.TEXTURE0),dt.imageAtlasTexture.bind(U.LINEAR,U.CLAMP_TO_EDGE),St.updatePaintBuffers(st)),Ed(St,W,pt,dt,d);let Qt=T.translatePosMatrix(yt.posMatrix,dt,d.paint.get(\"fill-extrusion-translate\"),d.paint.get(\"fill-extrusion-translate-anchor\")),$t=d.paint.get(\"fill-extrusion-vertical-gradient\"),oe=$?Wl(Qt,T,$t,At,yt,st,dt):Gp(Qt,T,$t,At);Bt.draw(B,B.gl.TRIANGLES,b,M,O,It.backCCW,oe,Ht,d.id,Ft.layoutVertexBuffer,Ft.indexBuffer,Ft.segments,d.paint,T.transform.zoom,St,T.style.map.terrain&&Ft.centroidVertexBuffer)}}function Fx(T,l,d,v,b,M,O){let B=T.context,U=B.gl,W=d.fbo;if(!W)return;let Z=T.useProgram(\"hillshade\"),$=T.style.map.terrain&&T.style.map.terrain.getTerrainData(l);B.activeTexture.set(U.TEXTURE0),U.bindTexture(U.TEXTURE_2D,W.colorAttachment.get()),Z.draw(B,U.TRIANGLES,b,M,O,It.disabled,((st,At,pt,yt)=>{let dt=pt.paint.get(\"hillshade-shadow-color\"),Ft=pt.paint.get(\"hillshade-highlight-color\"),Ht=pt.paint.get(\"hillshade-accent-color\"),St=pt.paint.get(\"hillshade-illumination-direction\")*(Math.PI/180);pt.paint.get(\"hillshade-illumination-anchor\")===\"viewport\"&&(St-=st.transform.angle);let Bt=!st.options.moving;return{u_matrix:yt?yt.posMatrix:st.transform.calculatePosMatrix(At.tileID.toUnwrapped(),Bt),u_image:0,u_latrange:Qe(0,At.tileID),u_light:[pt.paint.get(\"hillshade-exaggeration\"),St],u_shadow:dt,u_highlight:Ft,u_accent:Ht}})(T,d,v,$?l:null),$,v.id,T.rasterBoundsBuffer,T.quadTriangleIndexBuffer,T.rasterBoundsSegments)}function r0(T,l,d,v,b,M){let O=T.context,B=O.gl,U=l.dem;if(U&&U.data){let W=U.dim,Z=U.stride,$=U.getPixels();if(O.activeTexture.set(B.TEXTURE1),O.pixelStoreUnpackPremultiplyAlpha.set(!1),l.demTexture=l.demTexture||T.getTileTexture(Z),l.demTexture){let At=l.demTexture;At.update($,{premultiply:!1}),At.bind(B.NEAREST,B.CLAMP_TO_EDGE)}else l.demTexture=new qt(O,$,B.RGBA,{premultiply:!1}),l.demTexture.bind(B.NEAREST,B.CLAMP_TO_EDGE);O.activeTexture.set(B.TEXTURE0);let st=l.fbo;if(!st){let At=new qt(O,{width:W,height:W,data:null},B.RGBA);At.bind(B.LINEAR,B.CLAMP_TO_EDGE),st=l.fbo=O.createFramebuffer(W,W,!0,!1),st.colorAttachment.set(At.texture)}O.bindFramebuffer.set(st.framebuffer),O.viewport.set([0,0,W,W]),T.useProgram(\"hillshadePrepare\").draw(O,B.TRIANGLES,v,b,M,It.disabled,((At,pt)=>{let yt=pt.stride,dt=n.Z();return n.aS(dt,0,n.N,-n.N,0,0,1),n.$(dt,dt,[0,-n.N,0]),{u_matrix:dt,u_image:1,u_dimension:[yt,yt],u_zoom:At.overscaledZ,u_unpack:pt.getUnpackVector()}})(l.tileID,U),null,d.id,T.rasterBoundsBuffer,T.quadTriangleIndexBuffer,T.rasterBoundsSegments),l.needsHillshadePrepare=!1}}function f_(T,l,d,v,b,M){let O=v.paint.get(\"raster-fade-duration\");if(!M&&O>0){let B=n.h.now(),U=(B-T.timeAdded)/O,W=l?(B-l.timeAdded)/O:-1,Z=d.getSource(),$=b.coveringZoomLevel({tileSize:Z.tileSize,roundZoom:Z.roundZoom}),st=!l||Math.abs(l.tileID.overscaledZ-$)>Math.abs(T.tileID.overscaledZ-$),At=st&&T.refreshedUponExpiration?1:n.ad(st?U:1-W,0,1);return T.refreshedUponExpiration&&U>=1&&(T.refreshedUponExpiration=!1),l?{opacity:1,mix:1-At}:{opacity:At,mix:0}}return{opacity:1,mix:0}}let d_=new n.aT(1,0,0,1),yf=new n.aT(0,1,0,1),Ba=new n.aT(0,0,1,1),Wn=new n.aT(1,0,1,1),p_=new n.aT(0,1,1,1);function Cd(T,l,d,v){Xp(T,0,l+d/2,T.transform.width,d,v)}function $p(T,l,d,v){Xp(T,l-d/2,0,d,T.transform.height,v)}function Xp(T,l,d,v,b,M){let O=T.context,B=O.gl;B.enable(B.SCISSOR_TEST),B.scissor(l*T.pixelRatio,d*T.pixelRatio,v*T.pixelRatio,b*T.pixelRatio),O.clear({color:M}),B.disable(B.SCISSOR_TEST)}function i0(T,l,d){let v=T.context,b=v.gl,M=d.posMatrix,O=T.useProgram(\"debug\"),B=ci.disabled,U=Je.disabled,W=T.colorModeForRenderPass(),Z=\"$debug\",$=T.style.map.terrain&&T.style.map.terrain.getTerrainData(d);v.activeTexture.set(b.TEXTURE0);let st=l.getTileByID(d.key).latestRawTileData,At=Math.floor((st&&st.byteLength||0)/1024),pt=l.getTile(d).tileSize,yt=512/Math.min(pt,512)*(d.overscaledZ/T.transform.zoom)*.5,dt=d.canonical.toString();d.overscaledZ!==d.canonical.z&&(dt+=` => ${d.overscaledZ}`),function(Ft,Ht){Ft.initDebugOverlayCanvas();let St=Ft.debugOverlayCanvas,Bt=Ft.context.gl,Qt=Ft.debugOverlayCanvas.getContext(\"2d\");Qt.clearRect(0,0,St.width,St.height),Qt.shadowColor=\"white\",Qt.shadowBlur=2,Qt.lineWidth=1.5,Qt.strokeStyle=\"white\",Qt.textBaseline=\"top\",Qt.font=\"bold 36px Open Sans, sans-serif\",Qt.fillText(Ht,5,5),Qt.strokeText(Ht,5,5),Ft.debugOverlayTexture.update(St),Ft.debugOverlayTexture.bind(Bt.LINEAR,Bt.CLAMP_TO_EDGE)}(T,`${dt} ${At}kB`),O.draw(v,b.TRIANGLES,B,U,Ji.alphaBlended,It.disabled,Lt(M,n.aT.transparent,yt),null,Z,T.debugBuffer,T.quadTriangleIndexBuffer,T.debugSegments),O.draw(v,b.LINE_STRIP,B,U,W,It.disabled,Lt(M,n.aT.red),$,Z,T.debugBuffer,T.tileBorderIndexBuffer,T.debugSegments)}function Cn(T,l,d){let v=T.context,b=v.gl,M=T.colorModeForRenderPass(),O=new ci(b.LEQUAL,ci.ReadWrite,T.depthRangeFor3D),B=T.useProgram(\"terrain\"),U=l.getTerrainMesh();v.bindFramebuffer.set(null),v.viewport.set([0,0,T.width,T.height]);for(let W of d){let Z=T.renderToTexture.getTexture(W),$=l.getTerrainData(W.tileID);v.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,Z.texture);let st={u_matrix:T.transform.calculatePosMatrix(W.tileID.toUnwrapped()),u_texture:0,u_ele_delta:l.getMeshFrameDelta(T.transform.zoom)};B.draw(v,b.TRIANGLES,O,Je.disabled,M,It.backCCW,st,$,\"terrain\",U.vertexBuffer,U.indexBuffer,U.segments)}}class ah{constructor(l,d){this.context=new Oc(l),this.transform=d,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:n.Z(),renderTime:0},this.setup(),this.numSublayers=ls.maxUnderzooming+ls.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Dc}resize(l,d,v){if(this.width=Math.floor(l*v),this.height=Math.floor(d*v),this.pixelRatio=v,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let b of this.style._order)this.style._layers[b].resize()}setup(){let l=this.context,d=new n.a_;d.emplaceBack(0,0),d.emplaceBack(n.N,0),d.emplaceBack(0,n.N),d.emplaceBack(n.N,n.N),this.tileExtentBuffer=l.createVertexBuffer(d,So.members),this.tileExtentSegments=n.S.simpleSegment(0,0,4,2);let v=new n.a_;v.emplaceBack(0,0),v.emplaceBack(n.N,0),v.emplaceBack(0,n.N),v.emplaceBack(n.N,n.N),this.debugBuffer=l.createVertexBuffer(v,So.members),this.debugSegments=n.S.simpleSegment(0,0,4,5);let b=new n.V;b.emplaceBack(0,0,0,0),b.emplaceBack(n.N,0,n.N,0),b.emplaceBack(0,n.N,0,n.N),b.emplaceBack(n.N,n.N,n.N,n.N),this.rasterBoundsBuffer=l.createVertexBuffer(b,Jn.members),this.rasterBoundsSegments=n.S.simpleSegment(0,0,4,2);let M=new n.a_;M.emplaceBack(0,0),M.emplaceBack(1,0),M.emplaceBack(0,1),M.emplaceBack(1,1),this.viewportBuffer=l.createVertexBuffer(M,So.members),this.viewportSegments=n.S.simpleSegment(0,0,4,2);let O=new n.a$;O.emplaceBack(0),O.emplaceBack(1),O.emplaceBack(3),O.emplaceBack(2),O.emplaceBack(0),this.tileBorderIndexBuffer=l.createIndexBuffer(O);let B=new n.b0;B.emplaceBack(0,1,2),B.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=l.createIndexBuffer(B);let U=this.context.gl;this.stencilClearMode=new Je({func:U.ALWAYS,mask:0},0,255,U.ZERO,U.ZERO,U.ZERO)}clearStencil(){let l=this.context,d=l.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let v=n.Z();n.aS(v,0,this.width,this.height,0,0,1),n.a0(v,v,[d.drawingBufferWidth,d.drawingBufferHeight,0]),this.useProgram(\"clippingMask\").draw(l,d.TRIANGLES,ci.disabled,this.stencilClearMode,Ji.disabled,It.disabled,Kt(v),null,\"$clipping\",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(l,d){if(this.currentStencilSource===l.source||!l.isTileClipped()||!d||!d.length)return;this.currentStencilSource=l.source;let v=this.context,b=v.gl;this.nextStencilID+d.length>256&&this.clearStencil(),v.setColorMode(Ji.disabled),v.setDepthMode(ci.disabled);let M=this.useProgram(\"clippingMask\");this._tileClippingMaskIDs={};for(let O of d){let B=this._tileClippingMaskIDs[O.key]=this.nextStencilID++,U=this.style.map.terrain&&this.style.map.terrain.getTerrainData(O);M.draw(v,b.TRIANGLES,ci.disabled,new Je({func:b.ALWAYS,mask:0},B,255,b.KEEP,b.KEEP,b.REPLACE),Ji.disabled,It.disabled,Kt(O.posMatrix),U,\"$clipping\",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let l=this.nextStencilID++,d=this.context.gl;return new Je({func:d.NOTEQUAL,mask:255},l,255,d.KEEP,d.KEEP,d.REPLACE)}stencilModeForClipping(l){let d=this.context.gl;return new Je({func:d.EQUAL,mask:255},this._tileClippingMaskIDs[l.key],0,d.KEEP,d.KEEP,d.REPLACE)}stencilConfigForOverlap(l){let d=this.context.gl,v=l.sort((O,B)=>B.overscaledZ-O.overscaledZ),b=v[v.length-1].overscaledZ,M=v[0].overscaledZ-b+1;if(M>1){this.currentStencilSource=void 0,this.nextStencilID+M>256&&this.clearStencil();let O={};for(let B=0;B=0;this.currentLayer--){let U=this.style._layers[v[this.currentLayer]],W=b[U.source],Z=M[U.source];this._renderTileClippingMasks(U,Z),this.renderLayer(this,W,U,Z)}for(this.renderPass=\"translucent\",this.currentLayer=0;this.currentLayerdt.source&&!dt.isHidden(Z)?[W.sourceCaches[dt.source]]:[]),At=st.filter(dt=>dt.getSource().type===\"vector\"),pt=st.filter(dt=>dt.getSource().type!==\"vector\"),yt=dt=>{(!$||$.getSource().maxzoomyt(dt)),$||pt.forEach(dt=>yt(dt)),$}(this.style,this.transform.zoom);U&&function(W,Z,$){for(let st=0;st<$.length;st++)i0(W,Z,$[st])}(this,U,U.getVisibleCoordinates())}this.options.showPadding&&function(U){let W=U.transform.padding;Cd(U,U.transform.height-(W.top||0),3,d_),Cd(U,W.bottom||0,3,yf),$p(U,W.left||0,3,Ba),$p(U,U.transform.width-(W.right||0),3,Wn);let Z=U.transform.centerPoint;(function($,st,At,pt){Xp($,st-1,At-10,2,20,pt),Xp($,st-10,At-1,20,2,pt)})(U,Z.x,U.transform.height-Z.y,p_)}(this),this.context.setDefault()}renderLayer(l,d,v,b){if(!v.isHidden(this.transform.zoom)&&(v.type===\"background\"||v.type===\"custom\"||(b||[]).length))switch(this.id=v.id,v.type){case\"symbol\":(function(M,O,B,U,W){if(M.renderPass!==\"translucent\")return;let Z=Je.disabled,$=M.colorModeForRenderPass();(B._unevaluatedLayout.hasValue(\"text-variable-anchor\")||B._unevaluatedLayout.hasValue(\"text-variable-anchor-offset\"))&&function(st,At,pt,yt,dt,Ft,Ht){let St=At.transform,Bt=dt===\"map\",Qt=Ft===\"map\";for(let $t of st){let oe=yt.getTile($t),pe=oe.getBucket(pt);if(!pe||!pe.text||!pe.text.segments.get().length)continue;let he=n.ah(pe.textSizeData,St.zoom),be=Dt(oe,1,At.transform.zoom),Ze=ve($t.posMatrix,Qt,Bt,At.transform,be),Kr=pt.layout.get(\"icon-text-fit\")!==\"none\"&&pe.hasIconData();if(he){let Ee=Math.pow(2,St.zoom-oe.tileID.overscaledZ);Qp(pe,Bt,Qt,Ht,St,Ze,$t.posMatrix,Ee,he,Kr,At.style.map.terrain?(pr,tr)=>At.style.map.terrain.getElevation($t,pr,tr):null)}}}(U,M,B,O,B.layout.get(\"text-rotation-alignment\"),B.layout.get(\"text-pitch-alignment\"),W),B.paint.get(\"icon-opacity\").constantOr(1)!==0&&wt(M,O,B,U,!1,B.paint.get(\"icon-translate\"),B.paint.get(\"icon-translate-anchor\"),B.layout.get(\"icon-rotation-alignment\"),B.layout.get(\"icon-pitch-alignment\"),B.layout.get(\"icon-keep-upright\"),Z,$),B.paint.get(\"text-opacity\").constantOr(1)!==0&&wt(M,O,B,U,!0,B.paint.get(\"text-translate\"),B.paint.get(\"text-translate-anchor\"),B.layout.get(\"text-rotation-alignment\"),B.layout.get(\"text-pitch-alignment\"),B.layout.get(\"text-keep-upright\"),Z,$),O.map.showCollisionBoxes&&(Km(M,O,B,U,B.paint.get(\"text-translate\"),B.paint.get(\"text-translate-anchor\"),!0),Km(M,O,B,U,B.paint.get(\"icon-translate\"),B.paint.get(\"icon-translate-anchor\"),!1))})(l,d,v,b,this.style.placement.variableOffsets);break;case\"circle\":(function(M,O,B,U){if(M.renderPass!==\"translucent\")return;let W=B.paint.get(\"circle-opacity\"),Z=B.paint.get(\"circle-stroke-width\"),$=B.paint.get(\"circle-stroke-opacity\"),st=!B.layout.get(\"circle-sort-key\").isConstant();if(W.constantOr(1)===0&&(Z.constantOr(1)===0||$.constantOr(1)===0))return;let At=M.context,pt=At.gl,yt=M.depthModeForSublayer(0,ci.ReadOnly),dt=Je.disabled,Ft=M.colorModeForRenderPass(),Ht=[];for(let St=0;StSt.sortKey-Bt.sortKey);for(let St of Ht){let{programConfiguration:Bt,program:Qt,layoutVertexBuffer:$t,indexBuffer:oe,uniformValues:pe,terrainData:he}=St.state;Qt.draw(At,pt.TRIANGLES,yt,dt,Ft,It.disabled,pe,he,B.id,$t,oe,St.segments,B.paint,M.transform.zoom,Bt)}})(l,d,v,b);break;case\"heatmap\":(function(M,O,B,U){if(B.paint.get(\"heatmap-opacity\")!==0)if(M.renderPass===\"offscreen\"){let W=M.context,Z=W.gl,$=Je.disabled,st=new Ji([Z.ONE,Z.ONE],n.aT.transparent,[!0,!0,!0,!0]);(function(At,pt,yt){let dt=At.gl;At.activeTexture.set(dt.TEXTURE1),At.viewport.set([0,0,pt.width/4,pt.height/4]);let Ft=yt.heatmapFbo;if(Ft)dt.bindTexture(dt.TEXTURE_2D,Ft.colorAttachment.get()),At.bindFramebuffer.set(Ft.framebuffer);else{let Ht=dt.createTexture();dt.bindTexture(dt.TEXTURE_2D,Ht),dt.texParameteri(dt.TEXTURE_2D,dt.TEXTURE_WRAP_S,dt.CLAMP_TO_EDGE),dt.texParameteri(dt.TEXTURE_2D,dt.TEXTURE_WRAP_T,dt.CLAMP_TO_EDGE),dt.texParameteri(dt.TEXTURE_2D,dt.TEXTURE_MIN_FILTER,dt.LINEAR),dt.texParameteri(dt.TEXTURE_2D,dt.TEXTURE_MAG_FILTER,dt.LINEAR),Ft=yt.heatmapFbo=At.createFramebuffer(pt.width/4,pt.height/4,!1,!1),function(St,Bt,Qt,$t){var oe,pe;let he=St.gl,be=(oe=St.HALF_FLOAT)!==null&&oe!==void 0?oe:he.UNSIGNED_BYTE,Ze=(pe=St.RGBA16F)!==null&&pe!==void 0?pe:he.RGBA;he.texImage2D(he.TEXTURE_2D,0,Ze,Bt.width/4,Bt.height/4,0,he.RGBA,be,null),$t.colorAttachment.set(Qt)}(At,pt,Ht,Ft)}})(W,M,B),W.clear({color:n.aT.transparent});for(let At=0;At{let St=n.Z();n.aS(St,0,yt.width,yt.height,0,0,1);let Bt=yt.context.gl;return{u_matrix:St,u_world:[Bt.drawingBufferWidth,Bt.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:dt.paint.get(\"heatmap-opacity\")}})(W,Z),null,Z.id,W.viewportBuffer,W.quadTriangleIndexBuffer,W.viewportSegments,Z.paint,W.transform.zoom)}(M,B))})(l,d,v,b);break;case\"line\":(function(M,O,B,U){if(M.renderPass!==\"translucent\")return;let W=B.paint.get(\"line-opacity\"),Z=B.paint.get(\"line-width\");if(W.constantOr(1)===0||Z.constantOr(1)===0)return;let $=M.depthModeForSublayer(0,ci.ReadOnly),st=M.colorModeForRenderPass(),At=B.paint.get(\"line-dasharray\"),pt=B.paint.get(\"line-pattern\"),yt=pt.constantOr(1),dt=B.paint.get(\"line-gradient\"),Ft=B.getCrossfadeParameters(),Ht=yt?\"linePattern\":At?\"lineSDF\":dt?\"lineGradient\":\"line\",St=M.context,Bt=St.gl,Qt=!0;for(let $t of U){let oe=O.getTile($t);if(yt&&!oe.patternsLoaded())continue;let pe=oe.getBucket(B);if(!pe)continue;let he=pe.programConfigurations.get(B.id),be=M.context.program.get(),Ze=M.useProgram(Ht,he),Kr=Qt||Ze.program!==be,Ee=M.style.map.terrain&&M.style.map.terrain.getTerrainData($t),pr=pt.constantOr(null);if(pr&&oe.imageAtlas){let Jr=oe.imageAtlas,Vr=Jr.patternPositions[pr.to.toString()],ei=Jr.patternPositions[pr.from.toString()];Vr&&ei&&he.setConstantPatternPositions(Vr,ei)}let tr=Ee?$t:null,Gi=yt?Ts(M,oe,B,Ft,tr):At?Vs(M,oe,B,At,Ft,tr):dt?is(M,oe,B,pe.lineClipsArray.length,tr):ti(M,oe,B,tr);if(yt)St.activeTexture.set(Bt.TEXTURE0),oe.imageAtlasTexture.bind(Bt.LINEAR,Bt.CLAMP_TO_EDGE),he.updatePaintBuffers(Ft);else if(At&&(Kr||M.lineAtlas.dirty))St.activeTexture.set(Bt.TEXTURE0),M.lineAtlas.bind(St);else if(dt){let Jr=pe.gradients[B.id],Vr=Jr.texture;if(B.gradientVersion!==Jr.version){let ei=256;if(B.stepInterpolant){let On=O.getSource().maxzoom,tn=$t.canonical.z===On?Math.ceil(1<0?d.pop():null}isPatternMissing(l){if(!l)return!1;if(!l.from||!l.to)return!0;let d=this.imageManager.getPattern(l.from.toString()),v=this.imageManager.getPattern(l.to.toString());return!d||!v}useProgram(l,d){this.cache=this.cache||{};let v=l+(d?d.cacheKey:\"\")+(this._showOverdrawInspector?\"/overdraw\":\"\")+(this.style.map.terrain?\"/terrain\":\"\");return this.cache[v]||(this.cache[v]=new pu(this.context,Ki[l],d,Wm[l],this._showOverdrawInspector,this.style.map.terrain)),this.cache[v]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let l=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(l.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement(\"canvas\"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new qt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:l,drawingBufferHeight:d}=this.context.gl;return this.width!==l||this.height!==d}}class fi{constructor(l,d){this.points=l,this.planes=d}static fromInvProjectionMatrix(l,d,v){let b=Math.pow(2,v),M=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(B=>{let U=1/(B=n.ag([],B,l))[3]/d*b;return n.b3(B,B,[U,U,1/B[3],U])}),O=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(B=>{let U=function(st,At){var pt=At[0],yt=At[1],dt=At[2],Ft=pt*pt+yt*yt+dt*dt;return Ft>0&&(Ft=1/Math.sqrt(Ft)),st[0]=At[0]*Ft,st[1]=At[1]*Ft,st[2]=At[2]*Ft,st}([],function(st,At,pt){var yt=At[0],dt=At[1],Ft=At[2],Ht=pt[0],St=pt[1],Bt=pt[2];return st[0]=dt*Bt-Ft*St,st[1]=Ft*Ht-yt*Bt,st[2]=yt*St-dt*Ht,st}([],ut([],M[B[0]],M[B[1]]),ut([],M[B[2]],M[B[1]]))),W=-((Z=U)[0]*($=M[B[1]])[0]+Z[1]*$[1]+Z[2]*$[2]);var Z,$;return U.concat(W)});return new fi(M,O)}}class mu{constructor(l,d){this.min=l,this.max=d,this.center=function(v,b,M){return v[0]=.5*b[0],v[1]=.5*b[1],v[2]=.5*b[2],v}([],function(v,b,M){return v[0]=b[0]+M[0],v[1]=b[1]+M[1],v[2]=b[2]+M[2],v}([],this.min,this.max))}quadrant(l){let d=[l%2==0,l<2],v=K(this.min),b=K(this.max);for(let M=0;M=0&&O++;if(O===0)return 0;O!==d.length&&(v=!1)}if(v)return 2;for(let b=0;b<3;b++){let M=Number.MAX_VALUE,O=-Number.MAX_VALUE;for(let B=0;Bthis.max[b]-this.min[b])return 0}return 1}}class vf{constructor(l=0,d=0,v=0,b=0){if(isNaN(l)||l<0||isNaN(d)||d<0||isNaN(v)||v<0||isNaN(b)||b<0)throw new Error(\"Invalid value for edge-insets, top, bottom, left and right must all be numbers\");this.top=l,this.bottom=d,this.left=v,this.right=b}interpolate(l,d,v){return d.top!=null&&l.top!=null&&(this.top=n.B.number(l.top,d.top,v)),d.bottom!=null&&l.bottom!=null&&(this.bottom=n.B.number(l.bottom,d.bottom,v)),d.left!=null&&l.left!=null&&(this.left=n.B.number(l.left,d.left,v)),d.right!=null&&l.right!=null&&(this.right=n.B.number(l.right,d.right,v)),this}getCenter(l,d){let v=n.ad((this.left+l-this.right)/2,0,l),b=n.ad((this.top+d-this.bottom)/2,0,d);return new n.P(v,b)}equals(l){return this.top===l.top&&this.bottom===l.bottom&&this.left===l.left&&this.right===l.right}clone(){return new vf(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Kp{constructor(l,d,v,b,M){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=M===void 0||!!M,this._minZoom=l||0,this._maxZoom=d||22,this._minPitch=v??0,this._maxPitch=b??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new n.L(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new vf,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){let l=new Kp(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return l.apply(this),l}apply(l){this.tileSize=l.tileSize,this.latRange=l.latRange,this.width=l.width,this.height=l.height,this._center=l._center,this._elevation=l._elevation,this._minEleveationForCurrentTile=l._minEleveationForCurrentTile,this.zoom=l.zoom,this.angle=l.angle,this._fov=l._fov,this._pitch=l._pitch,this._unmodified=l._unmodified,this._edgeInsets=l._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(l){this._minZoom!==l&&(this._minZoom=l,this.zoom=Math.max(this.zoom,l))}get maxZoom(){return this._maxZoom}set maxZoom(l){this._maxZoom!==l&&(this._maxZoom=l,this.zoom=Math.min(this.zoom,l))}get minPitch(){return this._minPitch}set minPitch(l){this._minPitch!==l&&(this._minPitch=l,this.pitch=Math.max(this.pitch,l))}get maxPitch(){return this._maxPitch}set maxPitch(l){this._maxPitch!==l&&(this._maxPitch=l,this.pitch=Math.min(this.pitch,l))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(l){l===void 0?l=!0:l===null&&(l=!1),this._renderWorldCopies=l}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new n.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(l){let d=-n.b5(l,-180,180)*Math.PI/180;this.angle!==d&&(this._unmodified=!1,this.angle=d,this._calcMatrices(),this.rotationMatrix=function(){var v=new n.A(4);return n.A!=Float32Array&&(v[1]=0,v[2]=0),v[0]=1,v[3]=1,v}(),function(v,b,M){var O=b[0],B=b[1],U=b[2],W=b[3],Z=Math.sin(M),$=Math.cos(M);v[0]=O*$+U*Z,v[1]=B*$+W*Z,v[2]=O*-Z+U*$,v[3]=B*-Z+W*$}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(l){let d=n.ad(l,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==d&&(this._unmodified=!1,this._pitch=d,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(l){l=Math.max(.01,Math.min(60,l)),this._fov!==l&&(this._unmodified=!1,this._fov=l/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(l){let d=Math.min(Math.max(l,this.minZoom),this.maxZoom);this._zoom!==d&&(this._unmodified=!1,this._zoom=d,this.tileZoom=Math.max(0,Math.floor(d)),this.scale=this.zoomScale(d),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(l){l.lat===this._center.lat&&l.lng===this._center.lng||(this._unmodified=!1,this._center=l,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(l){l!==this._elevation&&(this._elevation=l,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(l){this._edgeInsets.equals(l)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,l,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(l){return this._edgeInsets.equals(l)}interpolatePadding(l,d,v){this._unmodified=!1,this._edgeInsets.interpolate(l,d,v),this._constrain(),this._calcMatrices()}coveringZoomLevel(l){let d=(l.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/l.tileSize));return Math.max(0,d)}getVisibleUnwrappedCoordinates(l){let d=[new n.b6(0,l)];if(this._renderWorldCopies){let v=this.pointCoordinate(new n.P(0,0)),b=this.pointCoordinate(new n.P(this.width,0)),M=this.pointCoordinate(new n.P(this.width,this.height)),O=this.pointCoordinate(new n.P(0,this.height)),B=Math.floor(Math.min(v.x,b.x,M.x,O.x)),U=Math.floor(Math.max(v.x,b.x,M.x,O.x)),W=1;for(let Z=B-W;Z<=U+W;Z++)Z!==0&&d.push(new n.b6(Z,l))}return d}coveringTiles(l){var d,v;let b=this.coveringZoomLevel(l),M=b;if(l.minzoom!==void 0&&bl.maxzoom&&(b=l.maxzoom);let O=this.pointCoordinate(this.getCameraPoint()),B=n.U.fromLngLat(this.center),U=Math.pow(2,b),W=[U*O.x,U*O.y,0],Z=[U*B.x,U*B.y,0],$=fi.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,b),st=l.minzoom||0;!l.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(st=b);let At=l.terrain?2/Math.min(this.tileSize,l.tileSize)*this.tileSize:3,pt=St=>({aabb:new mu([St*U,0,0],[(St+1)*U,U,0]),zoom:0,x:0,y:0,wrap:St,fullyVisible:!1}),yt=[],dt=[],Ft=b,Ht=l.reparseOverscaled?M:b;if(this._renderWorldCopies)for(let St=1;St<=3;St++)yt.push(pt(-St)),yt.push(pt(St));for(yt.push(pt(0));yt.length>0;){let St=yt.pop(),Bt=St.x,Qt=St.y,$t=St.fullyVisible;if(!$t){let Ze=St.aabb.intersects($);if(Ze===0)continue;$t=Ze===2}let oe=l.terrain?W:Z,pe=St.aabb.distanceX(oe),he=St.aabb.distanceY(oe),be=Math.max(Math.abs(pe),Math.abs(he));if(St.zoom===Ft||be>At+(1<=st){let Ze=Ft-St.zoom,Kr=W[0]-.5-(Bt<>1),pr=St.zoom+1,tr=St.aabb.quadrant(Ze);if(l.terrain){let Gi=new n.O(pr,St.wrap,pr,Kr,Ee),Jr=l.terrain.getMinMaxElevation(Gi),Vr=(d=Jr.minElevation)!==null&&d!==void 0?d:this.elevation,ei=(v=Jr.maxElevation)!==null&&v!==void 0?v:this.elevation;tr=new mu([tr.min[0],tr.min[1],Vr],[tr.max[0],tr.max[1],ei])}yt.push({aabb:tr,zoom:pr,x:Kr,y:Ee,wrap:St.wrap,fullyVisible:$t})}}return dt.sort((St,Bt)=>St.distanceSq-Bt.distanceSq).map(St=>St.tileID)}resize(l,d){this.width=l,this.height=d,this.pixelsToGLUnits=[2/l,-2/d],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(l){return Math.pow(2,l)}scaleZoom(l){return Math.log(l)/Math.LN2}project(l){let d=n.ad(l.lat,-this.maxValidLatitude,this.maxValidLatitude);return new n.P(n.G(l.lng)*this.worldSize,n.H(d)*this.worldSize)}unproject(l){return new n.U(l.x/this.worldSize,l.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(l){let d=this.pointLocation(this.centerPoint,l),v=l.getElevationForLngLatZoom(d,this.tileZoom);if(!(this.elevation-v))return;let b=this.getCameraPosition(),M=n.U.fromLngLat(b.lngLat,b.altitude),O=n.U.fromLngLat(d,v),B=M.x-O.x,U=M.y-O.y,W=M.z-O.z,Z=Math.sqrt(B*B+U*U+W*W),$=this.scaleZoom(this.cameraToCenterDistance/Z/this.tileSize);this._elevation=v,this._center=d,this.zoom=$}setLocationAtPoint(l,d){let v=this.pointCoordinate(d),b=this.pointCoordinate(this.centerPoint),M=this.locationCoordinate(l),O=new n.U(M.x-(v.x-b.x),M.y-(v.y-b.y));this.center=this.coordinateLocation(O),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(l,d){return d?this.coordinatePoint(this.locationCoordinate(l),d.getElevationForLngLatZoom(l,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(l))}pointLocation(l,d){return this.coordinateLocation(this.pointCoordinate(l,d))}locationCoordinate(l){return n.U.fromLngLat(l)}coordinateLocation(l){return l&&l.toLngLat()}pointCoordinate(l,d){if(d){let st=d.pointCoordinate(l);if(st!=null)return st}let v=[l.x,l.y,0,1],b=[l.x,l.y,1,1];n.ag(v,v,this.pixelMatrixInverse),n.ag(b,b,this.pixelMatrixInverse);let M=v[3],O=b[3],B=v[1]/M,U=b[1]/O,W=v[2]/M,Z=b[2]/O,$=W===Z?0:(0-W)/(Z-W);return new n.U(n.B.number(v[0]/M,b[0]/O,$)/this.worldSize,n.B.number(B,U,$)/this.worldSize)}coordinatePoint(l,d=0,v=this.pixelMatrix){let b=[l.x*this.worldSize,l.y*this.worldSize,d,1];return n.ag(b,b,v),new n.P(b[0]/b[3],b[1]/b[3])}getBounds(){let l=Math.max(0,this.height/2-this.getHorizon());return new Si().extend(this.pointLocation(new n.P(0,l))).extend(this.pointLocation(new n.P(this.width,l))).extend(this.pointLocation(new n.P(this.width,this.height))).extend(this.pointLocation(new n.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Si([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(l){l?(this.lngRange=[l.getWest(),l.getEast()],this.latRange=[l.getSouth(),l.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(l,d=!1){let v=l.key,b=d?this._alignedPosMatrixCache:this._posMatrixCache;if(b[v])return b[v];let M=l.canonical,O=this.worldSize/this.zoomScale(M.z),B=M.x+Math.pow(2,M.z)*l.wrap,U=n.ao(new Float64Array(16));return n.$(U,U,[B*O,M.y*O,0]),n.a0(U,U,[O/n.N,O/n.N,1]),n.a1(U,d?this.alignedProjMatrix:this.projMatrix,U),b[v]=new Float32Array(U),b[v]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let l,d,v,b,M=-90,O=90,B=-180,U=180,W=this.size,Z=this._unmodified;if(this.latRange){let At=this.latRange;M=n.H(At[1])*this.worldSize,O=n.H(At[0])*this.worldSize,l=O-MO&&(b=O-pt)}if(this.lngRange){let At=(B+U)/2,pt=n.b5($.x,At-this.worldSize/2,At+this.worldSize/2),yt=W.x/2;pt-ytU&&(v=U-yt)}v===void 0&&b===void 0||(this.center=this.unproject(new n.P(v!==void 0?v:$.x,b!==void 0?b:$.y)).wrap()),this._unmodified=Z,this._constraining=!1}_calcMatrices(){if(!this.height)return;let l=this.centerOffset,d=this.point.x,v=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=n.b7(1,this.center.lat)*this.worldSize;let b=n.ao(new Float64Array(16));n.a0(b,b,[this.width/2,-this.height/2,1]),n.$(b,b,[1,-1,0]),this.labelPlaneMatrix=b,b=n.ao(new Float64Array(16)),n.a0(b,b,[1,-1,1]),n.$(b,b,[-1,-1,0]),n.a0(b,b,[2/this.width,2/this.height,1]),this.glCoordMatrix=b;let M=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),O=Math.min(this.elevation,this._minEleveationForCurrentTile),B=M-O*this._pixelPerMeter/Math.cos(this._pitch),U=O<0?B:M,W=Math.PI/2+this._pitch,Z=this._fov*(.5+l.y/this.height),$=Math.sin(Z)*U/Math.sin(n.ad(Math.PI-W-Z,.01,Math.PI-.01)),st=this.getHorizon(),At=2*Math.atan(st/this.cameraToCenterDistance)*(.5+l.y/(2*st)),pt=Math.sin(At)*U/Math.sin(n.ad(Math.PI-W-At,.01,Math.PI-.01)),yt=Math.min($,pt),dt=1.01*(Math.cos(Math.PI/2-this._pitch)*yt+U),Ft=this.height/50;b=new Float64Array(16),n.b8(b,this._fov,this.width/this.height,Ft,dt),b[8]=2*-l.x/this.width,b[9]=2*l.y/this.height,n.a0(b,b,[1,-1,1]),n.$(b,b,[0,0,-this.cameraToCenterDistance]),n.b9(b,b,this._pitch),n.ae(b,b,this.angle),n.$(b,b,[-d,-v,0]),this.mercatorMatrix=n.a0([],b,[this.worldSize,this.worldSize,this.worldSize]),n.a0(b,b,[1,1,this._pixelPerMeter]),this.pixelMatrix=n.a1(new Float64Array(16),this.labelPlaneMatrix,b),n.$(b,b,[0,0,-this.elevation]),this.projMatrix=b,this.invProjMatrix=n.as([],b),this.pixelMatrix3D=n.a1(new Float64Array(16),this.labelPlaneMatrix,b);let Ht=this.width%2/2,St=this.height%2/2,Bt=Math.cos(this.angle),Qt=Math.sin(this.angle),$t=d-Math.round(d)+Bt*Ht+Qt*St,oe=v-Math.round(v)+Bt*St+Qt*Ht,pe=new Float64Array(b);if(n.$(pe,pe,[$t>.5?$t-1:$t,oe>.5?oe-1:oe,0]),this.alignedProjMatrix=pe,b=n.as(new Float64Array(16),this.pixelMatrix),!b)throw new Error(\"failed to invert matrix\");this.pixelMatrixInverse=b,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let l=this.pointCoordinate(new n.P(0,0)),d=[l.x*this.worldSize,l.y*this.worldSize,0,1];return n.ag(d,d,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let l=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new n.P(0,l))}getCameraQueryGeometry(l){let d=this.getCameraPoint();if(l.length===1)return[l[0],d];{let v=d.x,b=d.y,M=d.x,O=d.y;for(let B of l)v=Math.min(v,B.x),b=Math.min(b,B.y),M=Math.max(M,B.x),O=Math.max(O,B.y);return[new n.P(v,b),new n.P(M,b),new n.P(M,O),new n.P(v,O),new n.P(v,b)]}}}function lh(T,l){let d,v=!1,b=null,M=null,O=()=>{b=null,v&&(T.apply(M,d),b=setTimeout(O,l),v=!1)};return(...B)=>(v=!0,M=this,d=B,b||O(),b)}class Ld{constructor(l){this._getCurrentHash=()=>{let d=window.location.hash.replace(\"#\",\"\");if(this._hashName){let v;return d.split(\"&\").map(b=>b.split(\"=\")).forEach(b=>{b[0]===this._hashName&&(v=b)}),(v&&v[1]||\"\").split(\"/\")}return d.split(\"/\")},this._onHashChange=()=>{let d=this._getCurrentHash();if(d.length>=3&&!d.some(v=>isNaN(v))){let v=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(d[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+d[2],+d[1]],zoom:+d[0],bearing:v,pitch:+(d[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{let d=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,d)}catch{}},this._updateHash=lh(this._updateHashUnthrottled,300),this._hashName=l&&encodeURIComponent(l)}addTo(l){return this._map=l,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()),delete this._map,this}getHashString(l){let d=this._map.getCenter(),v=Math.round(100*this._map.getZoom())/100,b=Math.ceil((v*Math.LN2+Math.log(512/360/.5))/Math.LN10),M=Math.pow(10,b),O=Math.round(d.lng*M)/M,B=Math.round(d.lat*M)/M,U=this._map.getBearing(),W=this._map.getPitch(),Z=\"\";if(Z+=l?`/${O}/${B}/${v}`:`${v}/${B}/${O}`,(U||W)&&(Z+=\"/\"+Math.round(10*U)/10),W&&(Z+=`/${Math.round(W)}`),this._hashName){let $=this._hashName,st=!1,At=window.location.hash.slice(1).split(\"&\").map(pt=>{let yt=pt.split(\"=\")[0];return yt===$?(st=!0,`${yt}=${Z}`):pt}).filter(pt=>pt);return st||At.push(`${$}=${Z}`),`#${At.join(\"&\")}`}return`#${Z}`}}let ch={linearity:.3,easing:n.ba(0,0,.3,1)},Jp=n.e({deceleration:2500,maxSpeed:1400},ch),tA=n.e({deceleration:20,maxSpeed:1400},ch),A_=n.e({deceleration:1e3,maxSpeed:360},ch),m_=n.e({deceleration:1e3,maxSpeed:90},ch);class n0{constructor(l){this._map=l,this.clear()}clear(){this._inertiaBuffer=[]}record(l){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:n.h.now(),settings:l})}_drainInertiaBuffer(){let l=this._inertiaBuffer,d=n.h.now();for(;l.length>0&&d-l[0].time>160;)l.shift()}_onMoveEnd(l){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let d={zoom:0,bearing:0,pitch:0,pan:new n.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:M}of this._inertiaBuffer)d.zoom+=M.zoomDelta||0,d.bearing+=M.bearingDelta||0,d.pitch+=M.pitchDelta||0,M.panDelta&&d.pan._add(M.panDelta),M.around&&(d.around=M.around),M.pinchAround&&(d.pinchAround=M.pinchAround);let v=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,b={};if(d.pan.mag()){let M=uh(d.pan.mag(),v,n.e({},Jp,l||{}));b.offset=d.pan.mult(M.amount/d.pan.mag()),b.center=this._map.transform.center,pl(b,M)}if(d.zoom){let M=uh(d.zoom,v,tA);b.zoom=this._map.transform.zoom+M.amount,pl(b,M)}if(d.bearing){let M=uh(d.bearing,v,A_);b.bearing=this._map.transform.bearing+n.ad(M.amount,-179,179),pl(b,M)}if(d.pitch){let M=uh(d.pitch,v,m_);b.pitch=this._map.transform.pitch+M.amount,pl(b,M)}if(b.zoom||b.bearing){let M=d.pinchAround===void 0?d.around:d.pinchAround;b.around=M?this._map.unproject(M):this._map.getCenter()}return this.clear(),n.e(b,{noMoveStart:!0})}}function pl(T,l){(!T.duration||T.durationd.unproject(U)),B=M.reduce((U,W,Z,$)=>U.add(W.div($.length)),new n.P(0,0));super(l,{points:M,point:B,lngLats:O,lngLat:d.unproject(B),originalEvent:v}),this._defaultPrevented=!1}}class g_ extends n.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(l,d,v){super(l,{originalEvent:v}),this._defaultPrevented=!1}}class js{constructor(l,d){this._map=l,this._clickTolerance=d.clickTolerance}reset(){delete this._mousedownPos}wheel(l){return this._firePreventable(new g_(l.type,this._map,l))}mousedown(l,d){return this._mousedownPos=d,this._firePreventable(new la(l.type,this._map,l))}mouseup(l){this._map.fire(new la(l.type,this._map,l))}click(l,d){this._mousedownPos&&this._mousedownPos.dist(d)>=this._clickTolerance||this._map.fire(new la(l.type,this._map,l))}dblclick(l){return this._firePreventable(new la(l.type,this._map,l))}mouseover(l){this._map.fire(new la(l.type,this._map,l))}mouseout(l){this._map.fire(new la(l.type,this._map,l))}touchstart(l){return this._firePreventable(new kd(l.type,this._map,l))}touchmove(l){this._map.fire(new kd(l.type,this._map,l))}touchend(l){this._map.fire(new kd(l.type,this._map,l))}touchcancel(l){this._map.fire(new kd(l.type,this._map,l))}_firePreventable(l){if(this._map.fire(l),l.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class gu{constructor(l){this._map=l}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(l){this._map.fire(new la(l.type,this._map,l))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new la(\"contextmenu\",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(l){this._delayContextMenu?this._contextMenuEvent=l:this._ignoreContextMenu||this._map.fire(new la(l.type,this._map,l)),this._map.listens(\"contextmenu\")&&l.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ln{constructor(l){this._map=l}get transform(){return this._map._requestedCameraState||this._map.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(l){return this.transform.pointLocation(n.P.convert(l),this._map.terrain)}}class eA{constructor(l,d){this._map=l,this._tr=new Ln(l),this._el=l.getCanvasContainer(),this._container=l.getContainer(),this._clickTolerance=d.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(l,d){this.isEnabled()&&l.shiftKey&&l.button===0&&(c.disableDrag(),this._startPos=this._lastPos=d,this._active=!0)}mousemoveWindow(l,d){if(!this._active)return;let v=d;if(this._lastPos.equals(v)||!this._box&&v.dist(this._startPos)M.fitScreenCoordinates(v,b,this._tr.bearing,{linear:!0})};this._fireEvent(\"boxzoomcancel\",l)}keydown(l){this._active&&l.keyCode===27&&(this.reset(),this._fireEvent(\"boxzoomcancel\",l))}reset(){this._active=!1,this._container.classList.remove(\"maplibregl-crosshair\"),this._box&&(c.remove(this._box),this._box=null),c.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(l,d){return this._map.fire(new n.k(l,{originalEvent:d}))}}function ca(T,l){if(T.length!==l.length)throw new Error(`The number of touches and points are not equal - touches ${T.length}, points ${l.length}`);let d={};for(let v=0;vthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=l.timeStamp),v.length===this.numTouches&&(this.centroid=function(b){let M=new n.P(0,0);for(let O of b)M._add(O);return M.div(b.length)}(d),this.touches=ca(v,d)))}touchmove(l,d,v){if(this.aborted||!this.centroid)return;let b=ca(v,d);for(let M in this.touches){let O=b[M];(!O||O.dist(this.touches[M])>30)&&(this.aborted=!0)}}touchend(l,d,v){if((!this.centroid||l.timeStamp-this.startTime>500)&&(this.aborted=!0),v.length===0){let b=!this.aborted&&this.centroid;if(this.reset(),b)return b}}}class Rd{constructor(l){this.singleTap=new Fa(l),this.numTaps=l.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(l,d,v){this.singleTap.touchstart(l,d,v)}touchmove(l,d,v){this.singleTap.touchmove(l,d,v)}touchend(l,d,v){let b=this.singleTap.touchend(l,d,v);if(b){let M=l.timeStamp-this.lastTime<500,O=!this.lastTap||this.lastTap.dist(b)<30;if(M&&O||this.reset(),this.count++,this.lastTime=l.timeStamp,this.lastTap=b,this.count===this.numTaps)return this.reset(),b}}}class Al{constructor(l){this._tr=new Ln(l),this._zoomIn=new Rd({numTouches:1,numTaps:2}),this._zoomOut=new Rd({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(l,d,v){this._zoomIn.touchstart(l,d,v),this._zoomOut.touchstart(l,d,v)}touchmove(l,d,v){this._zoomIn.touchmove(l,d,v),this._zoomOut.touchmove(l,d,v)}touchend(l,d,v){let b=this._zoomIn.touchend(l,d,v),M=this._zoomOut.touchend(l,d,v),O=this._tr;return b?(this._active=!0,l.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:B=>B.easeTo({duration:300,zoom:O.zoom+1,around:O.unproject(b)},{originalEvent:l})}):M?(this._active=!0,l.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:B=>B.easeTo({duration:300,zoom:O.zoom-1,around:O.unproject(M)},{originalEvent:l})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class za{constructor(l){this._enabled=!!l.enable,this._moveStateManager=l.moveStateManager,this._clickTolerance=l.clickTolerance||1,this._moveFunction=l.move,this._activateOnStart=!!l.activateOnStart,l.assignEvents(this),this.reset()}reset(l){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(l)}_move(...l){let d=this._moveFunction(...l);if(d.bearingDelta||d.pitchDelta||d.around||d.panDelta)return this._active=!0,d}dragStart(l,d){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(l)&&(this._moveStateManager.startMove(l),this._lastPoint=d.length?d[0]:d,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(l,d){if(!this.isEnabled())return;let v=this._lastPoint;if(!v)return;if(l.preventDefault(),!this._moveStateManager.isValidMoveEvent(l))return void this.reset(l);let b=d.length?d[0]:d;return!this._moved&&b.dist(v){T.mousedown=T.dragStart,T.mousemoveWindow=T.dragMove,T.mouseup=T.dragEnd,T.contextmenu=function(l){l.preventDefault()}},Na=({enable:T,clickTolerance:l,bearingDegreesPerPixelMoved:d=.8})=>{let v=new rA({checkCorrectEvent:b=>c.mouseButton(b)===0&&b.ctrlKey||c.mouseButton(b)===2});return new za({clickTolerance:l,move:(b,M)=>({bearingDelta:(M.x-b.x)*d}),moveStateManager:v,enable:T,assignEvents:fh})},co=({enable:T,clickTolerance:l,pitchDegreesPerPixelMoved:d=-.5})=>{let v=new rA({checkCorrectEvent:b=>c.mouseButton(b)===0&&b.ctrlKey||c.mouseButton(b)===2});return new za({clickTolerance:l,move:(b,M)=>({pitchDelta:(M.y-b.y)*d}),moveStateManager:v,enable:T,assignEvents:fh})};class Ge{constructor(l,d){this._minTouches=l.cooperativeGestures?2:1,this._clickTolerance=l.clickTolerance||1,this._map=d,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new n.P(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(l,d,v){return this._calculateTransform(l,d,v)}touchmove(l,d,v){if(this._map._cooperativeGestures&&(this._minTouches===2&&v.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(l,!1,v.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(v.length0&&(this._active=!0);let b=ca(v,d),M=new n.P(0,0),O=new n.P(0,0),B=0;for(let W in b){let Z=b[W],$=this._touches[W];$&&(M._add(Z),O._add(Z.sub($)),B++,b[W]=Z)}if(this._touches=b,BMath.abs(T.x)}class zx extends Dd{constructor(l){super(),this._map=l}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(l,d,v){super.touchstart(l,d,v),this._currentTouchCount=v.length}_start(l){this._lastPoints=l,a0(l[0].sub(l[1]))&&(this._valid=!1)}_move(l,d,v){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;let b=l[0].sub(this._lastPoints[0]),M=l[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(b,M,v.timeStamp),this._valid?(this._lastPoints=l,this._active=!0,{pitchDelta:(b.y+M.y)/2*-.5}):void 0}gestureBeginsVertically(l,d,v){if(this._valid!==void 0)return this._valid;let b=l.mag()>=2,M=d.mag()>=2;if(!b&&!M)return;if(!b||!M)return this._firstMove===void 0&&(this._firstMove=v),v-this._firstMove<100&&void 0;let O=l.y>0==d.y>0;return a0(l)&&a0(d)&&O}}let dh={panStep:100,bearingStep:15,pitchStep:10};class y_{constructor(l){this._tr=new Ln(l);let d=dh;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(l){if(l.altKey||l.ctrlKey||l.metaKey)return;let d=0,v=0,b=0,M=0,O=0;switch(l.keyCode){case 61:case 107:case 171:case 187:d=1;break;case 189:case 109:case 173:d=-1;break;case 37:l.shiftKey?v=-1:(l.preventDefault(),M=-1);break;case 39:l.shiftKey?v=1:(l.preventDefault(),M=1);break;case 38:l.shiftKey?b=1:(l.preventDefault(),O=-1);break;case 40:l.shiftKey?b=-1:(l.preventDefault(),O=1);break;default:return}return this._rotationDisabled&&(v=0,b=0),{cameraAnimation:B=>{let U=this._tr;B.easeTo({duration:300,easeId:\"keyboardHandler\",easing:l0,zoom:d?Math.round(U.zoom)+d*(l.shiftKey?2:1):U.zoom,bearing:U.bearing+v*this._bearingStep,pitch:U.pitch+b*this._pitchStep,offset:[-M*this._panStep,-O*this._panStep],center:U.center},{originalEvent:l})}}}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}}function l0(T){return T*(2-T)}let c0=4.000244140625;class bf{constructor(l,d){this._onTimeout=v=>{this._type=\"wheel\",this._delta-=this._lastValue,this._active||this._start(v)},this._map=l,this._tr=new Ln(l),this._el=l.getCanvasContainer(),this._triggerRenderFrame=d,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(l){this._defaultZoomRate=l}setWheelZoomRate(l){this._wheelZoomRate=l}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(l){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!l&&l.around===\"center\")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(l){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!l[this._map._metaKey])return;l.preventDefault()}let d=l.deltaMode===WheelEvent.DOM_DELTA_LINE?40*l.deltaY:l.deltaY,v=n.h.now(),b=v-(this._lastWheelEventTime||0);this._lastWheelEventTime=v,d!==0&&d%c0==0?this._type=\"wheel\":d!==0&&Math.abs(d)<4?this._type=\"trackpad\":b>400?(this._type=null,this._lastValue=d,this._timeout=setTimeout(this._onTimeout,40,l)):this._type||(this._type=Math.abs(b*d)<200?\"trackpad\":\"wheel\",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,d+=this._lastValue)),l.shiftKey&&d&&(d/=4),this._type&&(this._lastWheelEvent=l,this._delta-=d,this._active||this._start(l)),l.preventDefault()}_start(l){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let d=c.mousePos(this._el,l),v=this._tr;this._around=n.L.convert(this._aroundCenter?v.center:v.unproject(d)),this._aroundPoint=v.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let l=this._tr.transform;if(this._delta!==0){let B=this._type===\"wheel\"&&Math.abs(this._delta)>c0?this._wheelZoomRate:this._defaultZoomRate,U=2/(1+Math.exp(-Math.abs(this._delta*B)));this._delta<0&&U!==0&&(U=1/U);let W=typeof this._targetZoom==\"number\"?l.zoomScale(this._targetZoom):l.scale;this._targetZoom=Math.min(l.maxZoom,Math.max(l.minZoom,l.scaleZoom(W*U))),this._type===\"wheel\"&&(this._startZoom=l.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let d=typeof this._targetZoom==\"number\"?this._targetZoom:l.zoom,v=this._startZoom,b=this._easing,M,O=!1;if(this._type===\"wheel\"&&v&&b){let B=Math.min((n.h.now()-this._lastWheelEventTime)/200,1),U=b(B);M=n.B.number(v,d,U),B<1?this._frameId||(this._frameId=!0):O=!0}else M=d,O=!0;return this._active=!0,O&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!O,zoomDelta:M-l.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(l){let d=n.bb;if(this._prevEase){let v=this._prevEase,b=(n.h.now()-v.start)/v.duration,M=v.easing(b+.01)-v.easing(b),O=.27/Math.sqrt(M*M+1e-4)*.01,B=Math.sqrt(.0729-O*O);d=n.ba(O,B,.25,1)}return this._prevEase={start:n.h.now(),duration:l,easing:d},d}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class u0{constructor(l,d){this._clickZoom=l,this._tapZoom=d}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()}}class iA{constructor(l){this._tr=new Ln(l),this.reset()}reset(){this._active=!1}dblclick(l,d){return l.preventDefault(),{cameraAnimation:v=>{v.easeTo({duration:300,zoom:this._tr.zoom+(l.shiftKey?-1:1),around:this._tr.unproject(d)},{originalEvent:l})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nA{constructor(){this._tap=new Rd({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(l,d,v){if(!this._swipePoint)if(this._tapTime){let b=d[0],M=l.timeStamp-this._tapTime<500,O=this._tapPoint.dist(b)<30;M&&O?v.length>0&&(this._swipePoint=b,this._swipeTouch=v[0].identifier):this.reset()}else this._tap.touchstart(l,d,v)}touchmove(l,d,v){if(this._tapTime){if(this._swipePoint){if(v[0].identifier!==this._swipeTouch)return;let b=d[0],M=b.y-this._swipePoint.y;return this._swipePoint=b,l.preventDefault(),this._active=!0,{zoomDelta:M/128}}}else this._tap.touchmove(l,d,v)}touchend(l,d,v){if(this._tapTime)this._swipePoint&&v.length===0&&this.reset();else{let b=this._tap.touchend(l,d,v);b&&(this._tapTime=l.timeStamp,this._tapPoint=b)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ph{constructor(l,d,v){this._el=l,this._mousePan=d,this._touchPan=v}enable(l){this._inertiaOptions=l||{},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()}}class us{constructor(l,d,v){this._pitchWithRotate=l.pitchWithRotate,this._mouseRotate=d,this._mousePitch=v}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class _u{constructor(l,d,v,b){this._el=l,this._touchZoom=d,this._touchRotate=v,this._tapDragZoom=b,this._rotationDisabled=!1,this._enabled=!0}enable(l){this._touchZoom.enable(l),this._rotationDisabled||this._touchRotate.enable(l),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()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}let Bc=T=>T.zoom||T.drag||T.pitch||T.rotate;class h0 extends n.k{}function Od(T){return T.panDelta&&T.panDelta.mag()||T.zoomDelta||T.bearingDelta||T.pitchDelta}class f0{constructor(l,d){this.handleWindowEvent=b=>{this.handleEvent(b,`${b.type}Window`)},this.handleEvent=(b,M)=>{if(b.type===\"blur\")return void this.stop(!0);this._updatingCamera=!0;let O=b.type===\"renderFrame\"?void 0:b,B={needsRenderFrame:!1},U={},W={},Z=b.touches,$=Z?this._getMapTouches(Z):void 0,st=$?c.touchPos(this._el,$):c.mousePos(this._el,b);for(let{handlerName:yt,handler:dt,allowed:Ft}of this._handlers){if(!dt.isEnabled())continue;let Ht;this._blockedByActive(W,Ft,yt)?dt.reset():dt[M||b.type]&&(Ht=dt[M||b.type](b,st,$),this.mergeHandlerResult(B,U,Ht,yt,O),Ht&&Ht.needsRenderFrame&&this._triggerRenderFrame()),(Ht||dt.isActive())&&(W[yt]=dt)}let At={};for(let yt in this._previousActiveHandlers)W[yt]||(At[yt]=O);this._previousActiveHandlers=W,(Object.keys(At).length||Od(B))&&(this._changes.push([B,U,At]),this._triggerRenderFrame()),(Object.keys(W).length||Od(B))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:pt}=B;pt&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],pt(this._map))},this._map=l,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new n0(l),this._bearingSnap=d.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(d);let v=this._el;this._listeners=[[v,\"touchstart\",{passive:!0}],[v,\"touchmove\",{passive:!1}],[v,\"touchend\",void 0],[v,\"touchcancel\",void 0],[v,\"mousedown\",void 0],[v,\"mousemove\",void 0],[v,\"mouseup\",void 0],[document,\"mousemove\",{capture:!0}],[document,\"mouseup\",void 0],[v,\"mouseover\",void 0],[v,\"mouseout\",void 0],[v,\"dblclick\",void 0],[v,\"click\",void 0],[v,\"keydown\",{capture:!1}],[v,\"keyup\",void 0],[v,\"wheel\",{passive:!1}],[v,\"contextmenu\",void 0],[window,\"blur\",void 0]];for(let[b,M,O]of this._listeners)c.addEventListener(b,M,b===document?this.handleWindowEvent:this.handleEvent,O)}destroy(){for(let[l,d,v]of this._listeners)c.removeEventListener(l,d,l===document?this.handleWindowEvent:this.handleEvent,v)}_addDefaultHandlers(l){let d=this._map,v=d.getCanvasContainer();this._add(\"mapEvent\",new js(d,l));let b=d.boxZoom=new eA(d,l);this._add(\"boxZoom\",b),l.interactive&&l.boxZoom&&b.enable();let M=new Al(d),O=new iA(d);d.doubleClickZoom=new u0(O,M),this._add(\"tapZoom\",M),this._add(\"clickZoom\",O),l.interactive&&l.doubleClickZoom&&d.doubleClickZoom.enable();let B=new nA;this._add(\"tapDragZoom\",B);let U=d.touchPitch=new zx(d);this._add(\"touchPitch\",U),l.interactive&&l.touchPitch&&d.touchPitch.enable(l.touchPitch);let W=Na(l),Z=co(l);d.dragRotate=new us(l,W,Z),this._add(\"mouseRotate\",W,[\"mousePitch\"]),this._add(\"mousePitch\",Z,[\"mouseRotate\"]),l.interactive&&l.dragRotate&&d.dragRotate.enable();let $=(({enable:Ft,clickTolerance:Ht})=>{let St=new rA({checkCorrectEvent:Bt=>c.mouseButton(Bt)===0&&!Bt.ctrlKey});return new za({clickTolerance:Ht,move:(Bt,Qt)=>({around:Qt,panDelta:Qt.sub(Bt)}),activateOnStart:!0,moveStateManager:St,enable:Ft,assignEvents:fh})})(l),st=new Ge(l,d);d.dragPan=new ph(v,$,st),this._add(\"mousePan\",$),this._add(\"touchPan\",st,[\"touchZoom\",\"touchRotate\"]),l.interactive&&l.dragPan&&d.dragPan.enable(l.dragPan);let At=new o0,pt=new __;d.touchZoomRotate=new _u(v,pt,At,B),this._add(\"touchRotate\",At,[\"touchPan\",\"touchZoom\"]),this._add(\"touchZoom\",pt,[\"touchPan\",\"touchRotate\"]),l.interactive&&l.touchZoomRotate&&d.touchZoomRotate.enable(l.touchZoomRotate);let yt=d.scrollZoom=new bf(d,()=>this._triggerRenderFrame());this._add(\"scrollZoom\",yt,[\"mousePan\"]),l.interactive&&l.scrollZoom&&d.scrollZoom.enable(l.scrollZoom);let dt=d.keyboard=new y_(d);this._add(\"keyboard\",dt),l.interactive&&l.keyboard&&d.keyboard.enable(),this._add(\"blockableMapEvent\",new gu(d))}_add(l,d,v){this._handlers.push({handlerName:l,handler:d,allowed:v}),this._handlersById[l]=d}stop(l){if(!this._updatingCamera){for(let{handler:d}of this._handlers)d.reset();this._inertia.clear(),this._fireEvents({},{},l),this._changes=[]}}isActive(){for(let{handler:l}of this._handlers)if(l.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Bc(this._eventsInProgress)||this.isZooming()}_blockedByActive(l,d,v){for(let b in l)if(b!==v&&(!d||d.indexOf(b)<0))return!0;return!1}_getMapTouches(l){let d=[];for(let v of l)this._el.contains(v.target)&&d.push(v);return d}mergeHandlerResult(l,d,v,b,M){if(!v)return;n.e(l,v);let O={handlerName:b,originalEvent:v.originalEvent||M};v.zoomDelta!==void 0&&(d.zoom=O),v.panDelta!==void 0&&(d.drag=O),v.pitchDelta!==void 0&&(d.pitch=O),v.bearingDelta!==void 0&&(d.rotate=O)}_applyChanges(){let l={},d={},v={};for(let[b,M,O]of this._changes)b.panDelta&&(l.panDelta=(l.panDelta||new n.P(0,0))._add(b.panDelta)),b.zoomDelta&&(l.zoomDelta=(l.zoomDelta||0)+b.zoomDelta),b.bearingDelta&&(l.bearingDelta=(l.bearingDelta||0)+b.bearingDelta),b.pitchDelta&&(l.pitchDelta=(l.pitchDelta||0)+b.pitchDelta),b.around!==void 0&&(l.around=b.around),b.pinchAround!==void 0&&(l.pinchAround=b.pinchAround),b.noInertia&&(l.noInertia=b.noInertia),n.e(d,M),n.e(v,O);this._updateMapTransform(l,d,v),this._changes=[]}_updateMapTransform(l,d,v){let b=this._map,M=b._getTransformForUpdate(),O=b.terrain;if(!(Od(l)||O&&this._terrainMovement))return this._fireEvents(d,v,!0);let{panDelta:B,zoomDelta:U,bearingDelta:W,pitchDelta:Z,around:$,pinchAround:st}=l;st!==void 0&&($=st),b._stop(!0),$=$||b.transform.centerPoint;let At=M.pointLocation(B?$.sub(B):$);W&&(M.bearing+=W),Z&&(M.pitch+=Z),U&&(M.zoom+=U),O?this._terrainMovement||!d.drag&&!d.zoom?d.drag&&this._terrainMovement?M.center=M.pointLocation(M.centerPoint.sub(B)):M.setLocationAtPoint(At,$):(this._terrainMovement=!0,this._map._elevationFreeze=!0,M.setLocationAtPoint(At,$),this._map.once(\"moveend\",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,M.recalculateZoom(b.terrain)})):M.setLocationAtPoint(At,$),b._applyUpdatedTransform(M),this._map._update(),l.noInertia||this._inertia.record(l),this._fireEvents(d,v,!0)}_fireEvents(l,d,v){let b=Bc(this._eventsInProgress),M=Bc(l),O={};for(let Z in l){let{originalEvent:$}=l[Z];this._eventsInProgress[Z]||(O[`${Z}start`]=$),this._eventsInProgress[Z]=l[Z]}!b&&M&&this._fireEvent(\"movestart\",M.originalEvent);for(let Z in O)this._fireEvent(Z,O[Z]);M&&this._fireEvent(\"move\",M.originalEvent);for(let Z in l){let{originalEvent:$}=l[Z];this._fireEvent(Z,$)}let B={},U;for(let Z in this._eventsInProgress){let{handlerName:$,originalEvent:st}=this._eventsInProgress[Z];this._handlersById[$].isActive()||(delete this._eventsInProgress[Z],U=d[$]||st,B[`${Z}end`]=U)}for(let Z in B)this._fireEvent(Z,B[Z]);let W=Bc(this._eventsInProgress);if(v&&(b||M)&&!W){this._updatingCamera=!0;let Z=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),$=st=>st!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new h0(\"renderFrame\",{timeStamp:l})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class v_ extends n.E{constructor(l,d){super(),this._renderFrameCallback=()=>{let v=Math.min((n.h.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(v)),v<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=l,this._bearingSnap=d.bearingSnap,this.on(\"moveend\",()=>{delete this._requestedCameraState})}getCenter(){return new n.L(this.transform.center.lng,this.transform.center.lat)}setCenter(l,d){return this.jumpTo({center:l},d)}panBy(l,d,v){return l=n.P.convert(l).mult(-1),this.panTo(this.transform.center,n.e({offset:l},d),v)}panTo(l,d,v){return this.easeTo(n.e({center:l},d),v)}getZoom(){return this.transform.zoom}setZoom(l,d){return this.jumpTo({zoom:l},d),this}zoomTo(l,d,v){return this.easeTo(n.e({zoom:l},d),v)}zoomIn(l,d){return this.zoomTo(this.getZoom()+1,l,d),this}zoomOut(l,d){return this.zoomTo(this.getZoom()-1,l,d),this}getBearing(){return this.transform.bearing}setBearing(l,d){return this.jumpTo({bearing:l},d),this}getPadding(){return this.transform.padding}setPadding(l,d){return this.jumpTo({padding:l},d),this}rotateTo(l,d,v){return this.easeTo(n.e({bearing:l},d),v)}resetNorth(l,d){return this.rotateTo(0,n.e({duration:1e3},l),d),this}resetNorthPitch(l,d){return this.easeTo(n.e({bearing:0,pitch:0,duration:1e3},l),d),this}snapToNorth(l,d){return Math.abs(this.getBearing()){if(this._zooming&&(v.zoom=n.B.number(b,U,$t)),this._rotating&&(v.bearing=n.B.number(M,W,$t)),this._pitching&&(v.pitch=n.B.number(O,Z,$t)),this._padding&&(v.interpolatePadding(B,$,$t),At=v.centerPoint.add(st)),this.terrain&&!l.freezeElevation&&this._updateElevation($t),St)v.setLocationAtPoint(St,Bt);else{let oe=v.zoomScale(v.zoom-b),pe=U>b?Math.min(2,Ht):Math.max(.5,Ht),he=Math.pow(pe,1-$t),be=v.unproject(dt.add(Ft.mult($t*he)).mult(oe));v.setLocationAtPoint(v.renderWorldCopies?be.wrap():be,At)}this._applyUpdatedTransform(v),this._fireMoveEvents(d)},$t=>{this.terrain&&this._finalizeElevation(),this._afterEase(d,$t)},l),this}_prepareEase(l,d,v={}){this._moving=!0,d||v.moving||this.fire(new n.k(\"movestart\",l)),this._zooming&&!v.zooming&&this.fire(new n.k(\"zoomstart\",l)),this._rotating&&!v.rotating&&this.fire(new n.k(\"rotatestart\",l)),this._pitching&&!v.pitching&&this.fire(new n.k(\"pitchstart\",l))}_prepareElevation(l){this._elevationCenter=l,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(l,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(l){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let d=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(l<1&&d!==this._elevationTarget){let v=this._elevationTarget-this._elevationStart;this._elevationStart+=l*(v-(d-(v*l+this._elevationStart))/(1-l)),this._elevationTarget=d}this.transform.elevation=n.B.number(this._elevationStart,this._elevationTarget,l)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(l){if(!this.transformCameraUpdate)return;let d=l.clone(),{center:v,zoom:b,pitch:M,bearing:O,elevation:B}=this.transformCameraUpdate(d);v&&(d.center=v),b!==void 0&&(d.zoom=b),M!==void 0&&(d.pitch=M),O!==void 0&&(d.bearing=O),B!==void 0&&(d.elevation=B),this.transform.apply(d)}_fireMoveEvents(l){this.fire(new n.k(\"move\",l)),this._zooming&&this.fire(new n.k(\"zoom\",l)),this._rotating&&this.fire(new n.k(\"rotate\",l)),this._pitching&&this.fire(new n.k(\"pitch\",l))}_afterEase(l,d){if(this._easeId&&d&&this._easeId===d)return;delete this._easeId;let v=this._zooming,b=this._rotating,M=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,v&&this.fire(new n.k(\"zoomend\",l)),b&&this.fire(new n.k(\"rotateend\",l)),M&&this.fire(new n.k(\"pitchend\",l)),this.fire(new n.k(\"moveend\",l))}flyTo(l,d){if(!l.essential&&n.h.prefersReducedMotion){let tr=n.F(l,[\"center\",\"zoom\",\"bearing\",\"pitch\",\"around\"]);return this.jumpTo(tr,d)}this.stop(),l=n.e({offset:[0,0],speed:1.2,curve:1.42,easing:n.bb},l);let v=this._getTransformForUpdate(),b=this.getZoom(),M=this.getBearing(),O=this.getPitch(),B=this.getPadding(),U=\"zoom\"in l?n.ad(+l.zoom,v.minZoom,v.maxZoom):b,W=\"bearing\"in l?this._normalizeBearing(l.bearing,M):M,Z=\"pitch\"in l?+l.pitch:O,$=\"padding\"in l?l.padding:v.padding,st=v.zoomScale(U-b),At=n.P.convert(l.offset),pt=v.centerPoint.add(At),yt=v.pointLocation(pt),dt=n.L.convert(l.center||yt);this._normalizeCenter(dt);let Ft=v.project(yt),Ht=v.project(dt).sub(Ft),St=l.curve,Bt=Math.max(v.width,v.height),Qt=Bt/st,$t=Ht.mag();if(\"minZoom\"in l){let tr=n.ad(Math.min(l.minZoom,b,U),v.minZoom,v.maxZoom),Gi=Bt/v.zoomScale(tr-b);St=Math.sqrt(Gi/$t*2)}let oe=St*St;function pe(tr){let Gi=(Qt*Qt-Bt*Bt+(tr?-1:1)*oe*oe*$t*$t)/(2*(tr?Qt:Bt)*oe*$t);return Math.log(Math.sqrt(Gi*Gi+1)-Gi)}function he(tr){return(Math.exp(tr)-Math.exp(-tr))/2}function be(tr){return(Math.exp(tr)+Math.exp(-tr))/2}let Ze=pe(!1),Kr=function(tr){return be(Ze)/be(Ze+St*tr)},Ee=function(tr){return Bt*((be(Ze)*(he(Gi=Ze+St*tr)/be(Gi))-he(Ze))/oe)/$t;var Gi},pr=(pe(!0)-Ze)/St;if(Math.abs($t)<1e-6||!isFinite(pr)){if(Math.abs(Bt-Qt)<1e-6)return this.easeTo(l,d);let tr=Qtl.maxDuration&&(l.duration=0),this._zooming=!0,this._rotating=M!==W,this._pitching=Z!==O,this._padding=!v.isPaddingEqual($),this._prepareEase(d,!1),this.terrain&&this._prepareElevation(dt),this._ease(tr=>{let Gi=tr*pr,Jr=1/Kr(Gi);v.zoom=tr===1?U:b+v.scaleZoom(Jr),this._rotating&&(v.bearing=n.B.number(M,W,tr)),this._pitching&&(v.pitch=n.B.number(O,Z,tr)),this._padding&&(v.interpolatePadding(B,$,tr),pt=v.centerPoint.add(At)),this.terrain&&!l.freezeElevation&&this._updateElevation(tr);let Vr=tr===1?dt:v.unproject(Ft.add(Ht.mult(Ee(Gi))).mult(Jr));v.setLocationAtPoint(v.renderWorldCopies?Vr.wrap():Vr,pt),this._applyUpdatedTransform(v),this._fireMoveEvents(d)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(d)},l),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(l,d){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let v=this._onEaseEnd;delete this._onEaseEnd,v.call(this,d)}if(!l){let v=this.handlers;v&&v.stop(!1)}return this}_ease(l,d,v){v.animate===!1||v.duration===0?(l(1),d()):(this._easeStart=n.h.now(),this._easeOptions=v,this._onEaseFrame=l,this._onEaseEnd=d,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(l,d){l=n.b5(l,-180,180);let v=Math.abs(l-d);return Math.abs(l-360-d)180?-360:v<-180?360:0}queryTerrainElevation(l){return this.terrain?this.terrain.getElevationForLngLatZoom(n.L.convert(l),this.transform.tileZoom)-this.transform.elevation:null}}class ua{constructor(l={}){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=d=>{!d||d.sourceDataType!==\"metadata\"&&d.sourceDataType!==\"visibility\"&&d.dataType!==\"style\"&&d.type!==\"terrain\"||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=l}getDefaultPosition(){return\"bottom-right\"}onAdd(l){return this._map=l,this._compact=this.options&&this.options.compact,this._container=c.create(\"details\",\"maplibregl-ctrl maplibregl-ctrl-attrib\"),this._compactButton=c.create(\"summary\",\"maplibregl-ctrl-attrib-button\",this._container),this._compactButton.addEventListener(\"click\",this._toggleAttribution),this._setElementTitle(this._compactButton,\"ToggleAttribution\"),this._innerContainer=c.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(){c.remove(this._container),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(l,d){let v=this._map._getUIString(`AttributionControl.${d}`);l.title=v,l.setAttribute(\"aria-label\",v)}_updateAttributions(){if(!this._map.style)return;let l=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?l=l.concat(this.options.customAttribution.map(b=>typeof b!=\"string\"?\"\":b)):typeof this.options.customAttribution==\"string\"&&l.push(this.options.customAttribution)),this._map.style.stylesheet){let b=this._map.style.stylesheet;this.styleOwner=b.owner,this.styleId=b.id}let d=this._map.style.sourceCaches;for(let b in d){let M=d[b];if(M.used||M.usedForTerrain){let O=M.getSource();O.attribution&&l.indexOf(O.attribution)<0&&l.push(O.attribution)}}l=l.filter(b=>String(b).trim()),l.sort((b,M)=>b.length-M.length),l=l.filter((b,M)=>{for(let O=M+1;O=0)return!1;return!0});let v=l.join(\" | \");v!==this._attribHTML&&(this._attribHTML=v,l.length?(this._innerContainer.innerHTML=v,this._container.classList.remove(\"maplibregl-attrib-empty\")):this._container.classList.add(\"maplibregl-attrib-empty\"),this._updateCompact(),this._editLink=null)}}class un{constructor(l={}){this._updateCompact=()=>{let d=this._container.children;if(d.length){let v=d[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&v.classList.add(\"maplibregl-compact\"):v.classList.remove(\"maplibregl-compact\")}},this.options=l}getDefaultPosition(){return\"bottom-left\"}onAdd(l){this._map=l,this._compact=this.options&&this.options.compact,this._container=c.create(\"div\",\"maplibregl-ctrl\");let d=c.create(\"a\",\"maplibregl-ctrl-logo\");return d.target=\"_blank\",d.rel=\"noopener nofollow\",d.href=\"https://maplibre.org/\",d.setAttribute(\"aria-label\",this._map._getUIString(\"LogoControl.Title\")),d.setAttribute(\"rel\",\"noopener nofollow\"),this._container.appendChild(d),this._container.style.display=\"block\",this._map.on(\"resize\",this._updateCompact),this._updateCompact(),this._container}onRemove(){c.remove(this._container),this._map.off(\"resize\",this._updateCompact),this._map=void 0,this._compact=void 0}}class sA{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(l){let d=++this._id;return this._queue.push({callback:l,id:d,cancelled:!1}),d}remove(l){let d=this._currentlyRunning,v=d?this._queue.concat(d):this._queue;for(let b of v)if(b.id===l)return void(b.cancelled=!0)}run(l=0){if(this._currentlyRunning)throw new Error(\"Attempting to run(), but is already running.\");let d=this._currentlyRunning=this._queue;this._queue=[];for(let v of d)if(!v.cancelled&&(v.callback(l),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}let d0={\"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\":\"Mapbox logo\",\"NavigationControl.ResetBearing\":\"Reset bearing to north\",\"NavigationControl.ZoomIn\":\"Zoom in\",\"NavigationControl.ZoomOut\":\"Zoom out\",\"ScaleControl.Feet\":\"ft\",\"ScaleControl.Meters\":\"m\",\"ScaleControl.Kilometers\":\"km\",\"ScaleControl.Miles\":\"mi\",\"ScaleControl.NauticalMiles\":\"nm\",\"TerrainControl.enableTerrain\":\"Enable terrain\",\"TerrainControl.disableTerrain\":\"Disable terrain\"};var Ah=n.Q([{name:\"a_pos3d\",type:\"Int16\",components:3}]);class x_ extends n.E{constructor(l){super(),this.sourceCache=l,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,l.usedForTerrain=!0,l.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(l,d){this.sourceCache.update(l,d),this._renderableTilesKeys=[];let v={};for(let b of l.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:d}))v[b.key]=!0,this._renderableTilesKeys.push(b.key),this._tiles[b.key]||(b.posMatrix=new Float64Array(16),n.aS(b.posMatrix,0,n.N,0,n.N,0,1),this._tiles[b.key]=new ao(b,this.tileSize));for(let b in this._tiles)v[b]||delete this._tiles[b]}freeRtt(l){for(let d in this._tiles){let v=this._tiles[d];(!l||v.tileID.equals(l)||v.tileID.isChildOf(l)||l.isChildOf(v.tileID))&&(v.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(l=>this.getTileByID(l))}getTileByID(l){return this._tiles[l]}getTerrainCoords(l){let d={};for(let v of this._renderableTilesKeys){let b=this._tiles[v].tileID;if(b.canonical.equals(l.canonical)){let M=l.clone();M.posMatrix=new Float64Array(16),n.aS(M.posMatrix,0,n.N,0,n.N,0,1),d[v]=M}else if(b.canonical.isChildOf(l.canonical)){let M=l.clone();M.posMatrix=new Float64Array(16);let O=b.canonical.z-l.canonical.z,B=b.canonical.x-(b.canonical.x>>O<>O<>O;n.aS(M.posMatrix,0,W,0,W,0,1),n.$(M.posMatrix,M.posMatrix,[-B*W,-U*W,0]),d[v]=M}else if(l.canonical.isChildOf(b.canonical)){let M=l.clone();M.posMatrix=new Float64Array(16);let O=l.canonical.z-b.canonical.z,B=l.canonical.x-(l.canonical.x>>O<>O<>O;n.aS(M.posMatrix,0,n.N,0,n.N,0,1),n.$(M.posMatrix,M.posMatrix,[B*W,U*W,0]),n.a0(M.posMatrix,M.posMatrix,[1/2**O,1/2**O,0]),d[v]=M}}return d}getSourceTile(l,d){let v=this.sourceCache._source,b=l.overscaledZ-this.deltaZoom;if(b>v.maxzoom&&(b=v.maxzoom),b=v.minzoom&&(!M||!M.dem);)M=this.sourceCache.getTileByID(l.scaledTo(b--).key);return M}tilesAfterTime(l=Date.now()){return Object.values(this._tiles).filter(d=>d.timeAdded>=l)}}class b_{constructor(l,d,v){this.painter=l,this.sourceCache=new x_(d),this.options=v,this.exaggeration=typeof v.exaggeration==\"number\"?v.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(l,d,v,b=n.N){var M;if(!(d>=0&&d=0&&vl.canonical.z&&(l.canonical.z>=b?M=l.canonical.z-b:n.w(\"cannot calculate elevation if elevation maxzoom > source.maxzoom\"));let O=l.canonical.x-(l.canonical.x>>M<>M<>8<<4|M>>8,d[O+3]=0;let v=new n.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(d.buffer)),b=new qt(l,v,l.gl.RGBA,{premultiply:!1});return b.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._coordsTexture=b,b}pointCoordinate(l){let d=new Uint8Array(4),v=this.painter.context,b=v.gl;v.bindFramebuffer.set(this.getFramebuffer(\"coords\").framebuffer),b.readPixels(l.x,this.painter.height/devicePixelRatio-l.y-1,1,1,b.RGBA,b.UNSIGNED_BYTE,d),v.bindFramebuffer.set(null);let M=d[0]+(d[2]>>4<<8),O=d[1]+((15&d[2])<<8),B=this.coordsIndex[255-d[3]],U=B&&this.sourceCache.getTileByID(B);if(!U)return null;let W=this._coordsTextureSize,Z=(1<0&&Math.sign(M)<0||!v&&Math.sign(b)<0&&Math.sign(M)>0?(b=360*Math.sign(M)+b,n.G(b)):d}}class Nx{constructor(l,d,v){this._context=l,this._size=d,this._tileSize=v,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let l of this._objects)l.texture.destroy(),l.fbo.destroy()}_createObject(l){let d=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),v=new qt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return v.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),d.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),d.colorAttachment.set(v.texture),{id:l,fbo:d,texture:v,stamp:-1,inUse:!1}}getObjectForId(l){return this._objects[l]}useObject(l){l.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(d=>l.id!==d),this._recentlyUsed.push(l.id)}stampObject(l){l.stamp=++this._stamp}getOrCreateFreeObject(){for(let d of this._recentlyUsed)if(!this._objects[d].inUse)return this._objects[d];if(this._objects.length>=this._size)throw new Error(\"No free RenderPool available, call freeAllObjects() required!\");let l=this._createObject(this._objects.length);return this._objects.push(l),l}freeObject(l){l.inUse=!1}freeAllObjects(){for(let l of this._objects)this.freeObject(l)}isFull(){return!(this._objects.length!l.inUse)===!1}}let Mo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class oA{constructor(l,d){this.painter=l,this.terrain=d,this.pool=new Nx(l.context,30,d.sourceCache.tileSize*d.qualityFactor)}destruct(){this.pool.destruct()}getTexture(l){return this.pool.getObjectForId(l.rtt[this._stacks.length-1].id).texture}prepareForRender(l,d){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=l._order.filter(v=>!l._layers[v].isHidden(d)),this._coordsDescendingInv={};for(let v in l.sourceCaches){this._coordsDescendingInv[v]={};let b=l.sourceCaches[v].getVisibleCoordinates();for(let M of b){let O=this.terrain.sourceCache.getTerrainCoords(M);for(let B in O)this._coordsDescendingInv[v][B]||(this._coordsDescendingInv[v][B]=[]),this._coordsDescendingInv[v][B].push(O[B])}}this._coordsDescendingInvStr={};for(let v of l._order){let b=l._layers[v],M=b.source;if(Mo[b.type]&&!this._coordsDescendingInvStr[M]){this._coordsDescendingInvStr[M]={};for(let O in this._coordsDescendingInv[M])this._coordsDescendingInvStr[M][O]=this._coordsDescendingInv[M][O].map(B=>B.key).sort().join()}}for(let v of this._renderableTiles)for(let b in this._coordsDescendingInvStr){let M=this._coordsDescendingInvStr[b][v.tileID.key];M&&M!==v.rttCoords[b]&&(v.rtt=[])}}renderLayer(l){if(l.isHidden(this.painter.transform.zoom))return!1;let d=l.type,v=this.painter,b=this._renderableLayerIds[this._renderableLayerIds.length-1]===l.id;if(Mo[d]&&(this._prevType&&Mo[this._prevType]||this._stacks.push([]),this._prevType=d,this._stacks[this._stacks.length-1].push(l.id),!b))return!0;if(Mo[this._prevType]||Mo[d]&&b){this._prevType=d;let M=this._stacks.length-1,O=this._stacks[M]||[];for(let B of this._renderableTiles){if(this.pool.isFull()&&(Cn(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(B),B.rtt[M]){let W=this.pool.getObjectForId(B.rtt[M].id);if(W.stamp===B.rtt[M].stamp){this.pool.useObject(W);continue}}let U=this.pool.getOrCreateFreeObject();this.pool.useObject(U),this.pool.stampObject(U),B.rtt[M]={id:U.id,stamp:U.stamp},v.context.bindFramebuffer.set(U.fbo.framebuffer),v.context.clear({color:n.aT.transparent,stencil:0}),v.currentStencilSource=void 0;for(let W=0;W{T.touchstart=T.dragStart,T.touchmoveWindow=T.dragMove,T.touchend=T.dragEnd},aA={showCompass:!0,showZoom:!0,visualizePitch:!1};class Bd{constructor(l,d,v=!1){this.mousedown=O=>{this.startMouse(n.e({},O,{ctrlKey:!0,preventDefault:()=>O.preventDefault()}),c.mousePos(this.element,O)),c.addEventListener(window,\"mousemove\",this.mousemove),c.addEventListener(window,\"mouseup\",this.mouseup)},this.mousemove=O=>{this.moveMouse(O,c.mousePos(this.element,O))},this.mouseup=O=>{this.mouseRotate.dragEnd(O),this.mousePitch&&this.mousePitch.dragEnd(O),this.offTemp()},this.touchstart=O=>{O.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=c.touchPos(this.element,O.targetTouches)[0],this.startTouch(O,this._startPos),c.addEventListener(window,\"touchmove\",this.touchmove,{passive:!1}),c.addEventListener(window,\"touchend\",this.touchend))},this.touchmove=O=>{O.targetTouches.length!==1?this.reset():(this._lastPos=c.touchPos(this.element,O.targetTouches)[0],this.moveTouch(O,this._lastPos))},this.touchend=O=>{O.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;let b=l.dragRotate._mouseRotate.getClickTolerance(),M=l.dragRotate._mousePitch.getClickTolerance();this.element=d,this.mouseRotate=Na({clickTolerance:b,enable:!0}),this.touchRotate=(({enable:O,clickTolerance:B,bearingDegreesPerPixelMoved:U=.8})=>{let W=new s0;return new za({clickTolerance:B,move:(Z,$)=>({bearingDelta:($.x-Z.x)*U}),moveStateManager:W,enable:O,assignEvents:wf})})({clickTolerance:b,enable:!0}),this.map=l,v&&(this.mousePitch=co({clickTolerance:M,enable:!0}),this.touchPitch=(({enable:O,clickTolerance:B,pitchDegreesPerPixelMoved:U=-.5})=>{let W=new s0;return new za({clickTolerance:B,move:(Z,$)=>({pitchDelta:($.y-Z.y)*U}),moveStateManager:W,enable:O,assignEvents:wf})})({clickTolerance:M,enable:!0})),c.addEventListener(d,\"mousedown\",this.mousedown),c.addEventListener(d,\"touchstart\",this.touchstart,{passive:!1}),c.addEventListener(d,\"touchcancel\",this.reset)}startMouse(l,d){this.mouseRotate.dragStart(l,d),this.mousePitch&&this.mousePitch.dragStart(l,d),c.disableDrag()}startTouch(l,d){this.touchRotate.dragStart(l,d),this.touchPitch&&this.touchPitch.dragStart(l,d),c.disableDrag()}moveMouse(l,d){let v=this.map,{bearingDelta:b}=this.mouseRotate.dragMove(l,d)||{};if(b&&v.setBearing(v.getBearing()+b),this.mousePitch){let{pitchDelta:M}=this.mousePitch.dragMove(l,d)||{};M&&v.setPitch(v.getPitch()+M)}}moveTouch(l,d){let v=this.map,{bearingDelta:b}=this.touchRotate.dragMove(l,d)||{};if(b&&v.setBearing(v.getBearing()+b),this.touchPitch){let{pitchDelta:M}=this.touchPitch.dragMove(l,d)||{};M&&v.setPitch(v.getPitch()+M)}}off(){let l=this.element;c.removeEventListener(l,\"mousedown\",this.mousedown),c.removeEventListener(l,\"touchstart\",this.touchstart,{passive:!1}),c.removeEventListener(window,\"touchmove\",this.touchmove,{passive:!1}),c.removeEventListener(window,\"touchend\",this.touchend),c.removeEventListener(l,\"touchcancel\",this.reset),this.offTemp()}offTemp(){c.enableDrag(),c.removeEventListener(window,\"mousemove\",this.mousemove),c.removeEventListener(window,\"mouseup\",this.mouseup),c.removeEventListener(window,\"touchmove\",this.touchmove,{passive:!1}),c.removeEventListener(window,\"touchend\",this.touchend)}}let Hn;function uo(T,l,d){if(T=new n.L(T.lng,T.lat),l){let v=new n.L(T.lng-360,T.lat),b=new n.L(T.lng+360,T.lat),M=d.locationPoint(T).distSqr(l);d.locationPoint(v).distSqr(l)180;){let v=d.locationPoint(T);if(v.x>=0&&v.y>=0&&v.x<=d.width&&v.y<=d.height)break;T.lng>d.center.lng?T.lng-=360:T.lng+=360}return T}let ji={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%)\"};function w_(T,l,d){let v=T.classList;for(let b in ji)v.remove(`maplibregl-${d}-anchor-${b}`);v.add(`maplibregl-${d}-anchor-${l}`)}class mh extends n.E{constructor(l){if(super(),this._onKeyPress=d=>{let v=d.code,b=d.charCode||d.keyCode;v!==\"Space\"&&v!==\"Enter\"&&b!==32&&b!==13||this.togglePopup()},this._onMapClick=d=>{let v=d.originalEvent.target,b=this._element;this._popup&&(v===b||b.contains(v))&&this.togglePopup()},this._update=d=>{if(!this._map)return;let v=this._map.loaded()&&!this._map.isMoving();(d?.type===\"terrain\"||d?.type===\"render\"&&!v)&&this._map.once(\"render\",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=uo(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let b=\"\";this._rotationAlignment===\"viewport\"||this._rotationAlignment===\"auto\"?b=`rotateZ(${this._rotation}deg)`:this._rotationAlignment===\"map\"&&(b=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let M=\"\";this._pitchAlignment===\"viewport\"||this._pitchAlignment===\"auto\"?M=\"rotateX(0deg)\":this._pitchAlignment===\"map\"&&(M=`rotateX(${this._map.getPitch()}deg)`),d&&d.type!==\"moveend\"||(this._pos=this._pos.round()),c.setTransform(this._element,`${ji[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${M} ${b}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{let O=this._map.unproject(this._pos),B=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=O.distanceTo(this._lngLat)>20*B?\"0.2\":\"1.0\",this._opacityTimeout=null},100))},this._onMove=d=>{if(!this._isDragging){let v=this._clickTolerance||this._map._clickTolerance;this._isDragging=d.point.dist(this._pointerdownPos)>=v}this._isDragging&&(this._pos=d.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 n.k(\"dragstart\"))),this.fire(new n.k(\"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 n.k(\"dragend\")),this._state=\"inactive\"},this._addDragHandler=d=>{this._element.contains(d.originalEvent.target)&&(d.preventDefault(),this._positionDelta=d.point.sub(this._pos).add(this._offset),this._pointerdownPos=d.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=l&&l.anchor||\"center\",this._color=l&&l.color||\"#3FB1CE\",this._scale=l&&l.scale||1,this._draggable=l&&l.draggable||!1,this._clickTolerance=l&&l.clickTolerance||0,this._isDragging=!1,this._state=\"inactive\",this._rotation=l&&l.rotation||0,this._rotationAlignment=l&&l.rotationAlignment||\"auto\",this._pitchAlignment=l&&l.pitchAlignment&&l.pitchAlignment!==\"auto\"?l.pitchAlignment:this._rotationAlignment,l&&l.element)this._element=l.element,this._offset=n.P.convert(l&&l.offset||[0,0]);else{this._defaultMarker=!0,this._element=c.create(\"div\"),this._element.setAttribute(\"aria-label\",\"Map marker\");let d=c.createNS(\"http://www.w3.org/2000/svg\",\"svg\"),v=41,b=27;d.setAttributeNS(null,\"display\",\"block\"),d.setAttributeNS(null,\"height\",`${v}px`),d.setAttributeNS(null,\"width\",`${b}px`),d.setAttributeNS(null,\"viewBox\",`0 0 ${b} ${v}`);let M=c.createNS(\"http://www.w3.org/2000/svg\",\"g\");M.setAttributeNS(null,\"stroke\",\"none\"),M.setAttributeNS(null,\"stroke-width\",\"1\"),M.setAttributeNS(null,\"fill\",\"none\"),M.setAttributeNS(null,\"fill-rule\",\"evenodd\");let O=c.createNS(\"http://www.w3.org/2000/svg\",\"g\");O.setAttributeNS(null,\"fill-rule\",\"nonzero\");let B=c.createNS(\"http://www.w3.org/2000/svg\",\"g\");B.setAttributeNS(null,\"transform\",\"translate(3.0, 29.0)\"),B.setAttributeNS(null,\"fill\",\"#000000\");let U=[{rx:\"10.5\",ry:\"5.25002273\"},{rx:\"10.5\",ry:\"5.25002273\"},{rx:\"9.5\",ry:\"4.77275007\"},{rx:\"8.5\",ry:\"4.29549936\"},{rx:\"7.5\",ry:\"3.81822308\"},{rx:\"6.5\",ry:\"3.34094679\"},{rx:\"5.5\",ry:\"2.86367051\"},{rx:\"4.5\",ry:\"2.38636864\"}];for(let Ft of U){let Ht=c.createNS(\"http://www.w3.org/2000/svg\",\"ellipse\");Ht.setAttributeNS(null,\"opacity\",\"0.04\"),Ht.setAttributeNS(null,\"cx\",\"10.5\"),Ht.setAttributeNS(null,\"cy\",\"5.80029008\"),Ht.setAttributeNS(null,\"rx\",Ft.rx),Ht.setAttributeNS(null,\"ry\",Ft.ry),B.appendChild(Ht)}let W=c.createNS(\"http://www.w3.org/2000/svg\",\"g\");W.setAttributeNS(null,\"fill\",this._color);let Z=c.createNS(\"http://www.w3.org/2000/svg\",\"path\");Z.setAttributeNS(null,\"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\"),W.appendChild(Z);let $=c.createNS(\"http://www.w3.org/2000/svg\",\"g\");$.setAttributeNS(null,\"opacity\",\"0.25\"),$.setAttributeNS(null,\"fill\",\"#000000\");let st=c.createNS(\"http://www.w3.org/2000/svg\",\"path\");st.setAttributeNS(null,\"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\"),$.appendChild(st);let At=c.createNS(\"http://www.w3.org/2000/svg\",\"g\");At.setAttributeNS(null,\"transform\",\"translate(6.0, 7.0)\"),At.setAttributeNS(null,\"fill\",\"#FFFFFF\");let pt=c.createNS(\"http://www.w3.org/2000/svg\",\"g\");pt.setAttributeNS(null,\"transform\",\"translate(8.0, 8.0)\");let yt=c.createNS(\"http://www.w3.org/2000/svg\",\"circle\");yt.setAttributeNS(null,\"fill\",\"#000000\"),yt.setAttributeNS(null,\"opacity\",\"0.25\"),yt.setAttributeNS(null,\"cx\",\"5.5\"),yt.setAttributeNS(null,\"cy\",\"5.5\"),yt.setAttributeNS(null,\"r\",\"5.4999962\");let dt=c.createNS(\"http://www.w3.org/2000/svg\",\"circle\");dt.setAttributeNS(null,\"fill\",\"#FFFFFF\"),dt.setAttributeNS(null,\"cx\",\"5.5\"),dt.setAttributeNS(null,\"cy\",\"5.5\"),dt.setAttributeNS(null,\"r\",\"5.4999962\"),pt.appendChild(yt),pt.appendChild(dt),O.appendChild(B),O.appendChild(W),O.appendChild($),O.appendChild(At),O.appendChild(pt),d.appendChild(O),d.setAttributeNS(null,\"height\",v*this._scale+\"px\"),d.setAttributeNS(null,\"width\",b*this._scale+\"px\"),this._element.appendChild(d),this._offset=n.P.convert(l&&l.offset||[0,-14])}if(this._element.classList.add(\"maplibregl-marker\"),this._element.addEventListener(\"dragstart\",d=>{d.preventDefault()}),this._element.addEventListener(\"mousedown\",d=>{d.preventDefault()}),w_(this._element,this._anchor,\"marker\"),l&&l.className)for(let d of l.className.split(\" \"))this._element.classList.add(d);this._popup=null}addTo(l){return this.remove(),this._map=l,l.getCanvasContainer().appendChild(this._element),l.on(\"move\",this._update),l.on(\"moveend\",this._update),l.on(\"terrain\",this._update),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(\"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),c.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(l){return this._lngLat=n.L.convert(l),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(l){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener(\"keypress\",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute(\"tabindex\")),l){if(!(\"offset\"in l.options)){let b=Math.abs(13.5)/Math.SQRT2;l.options.offset=this._defaultMarker?{top:[0,0],\"top-left\":[0,0],\"top-right\":[0,0],bottom:[0,-38.1],\"bottom-left\":[b,-1*(38.1-13.5+b)],\"bottom-right\":[-b,-1*(38.1-13.5+b)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=l,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute(\"tabindex\"),this._originalTabIndex||this._element.setAttribute(\"tabindex\",\"0\"),this._element.addEventListener(\"keypress\",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){let l=this._popup;return l?(l.isOpen()?l.remove():l.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(l){return this._offset=n.P.convert(l),this._update(),this}addClassName(l){this._element.classList.add(l)}removeClassName(l){this._element.classList.remove(l)}toggleClassName(l){return this._element.classList.toggle(l)}setDraggable(l){return this._draggable=!!l,this._map&&(l?(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}isDraggable(){return this._draggable}setRotation(l){return this._rotation=l||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(l){return this._rotationAlignment=l||\"auto\",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(l){return this._pitchAlignment=l&&l!==\"auto\"?l:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}let kn={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},wn=0,Sf=!1,Es={maxWidth:100,unit:\"metric\"};function gh(T,l,d){let v=d&&d.maxWidth||100,b=T._container.clientHeight/2,M=T.unproject([0,b]),O=T.unproject([v,b]),B=M.distanceTo(O);if(d&&d.unit===\"imperial\"){let U=3.2808*B;U>5280?Wo(l,v,U/5280,T._getUIString(\"ScaleControl.Miles\")):Wo(l,v,U,T._getUIString(\"ScaleControl.Feet\"))}else d&&d.unit===\"nautical\"?Wo(l,v,B/1852,T._getUIString(\"ScaleControl.NauticalMiles\")):B>=1e3?Wo(l,v,B/1e3,T._getUIString(\"ScaleControl.Kilometers\")):Wo(l,v,B,T._getUIString(\"ScaleControl.Meters\"))}function Wo(T,l,d,v){let b=function(M){let O=Math.pow(10,`${Math.floor(M)}`.length-1),B=M/O;return B=B>=10?10:B>=5?5:B>=3?3:B>=2?2:B>=1?1:function(U){let W=Math.pow(10,Math.ceil(-Math.log(U)/Math.LN10));return Math.round(U*W)/W}(B),O*B}(d);T.style.width=l*(b/d)+\"px\",T.innerHTML=`${b} ${v}`}let p0={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:\"\",maxWidth:\"240px\"},Fd=[\"a[href]\",\"[tabindex]:not([tabindex='-1'])\",\"[contenteditable]:not([contenteditable='false'])\",\"button:not([disabled])\",\"input:not([disabled])\",\"select:not([disabled])\",\"textarea:not([disabled])\"].join(\", \");function Tf(T){if(T){if(typeof T==\"number\"){let l=Math.round(Math.abs(T)/Math.SQRT2);return{center:new n.P(0,0),top:new n.P(0,T),\"top-left\":new n.P(l,l),\"top-right\":new n.P(-l,l),bottom:new n.P(0,-T),\"bottom-left\":new n.P(l,-l),\"bottom-right\":new n.P(-l,-l),left:new n.P(T,0),right:new n.P(-T,0)}}if(T instanceof n.P||Array.isArray(T)){let l=n.P.convert(T);return{center:l,top:l,\"top-left\":l,\"top-right\":l,bottom:l,\"bottom-left\":l,\"bottom-right\":l,left:l,right:l}}return{center:n.P.convert(T.center||[0,0]),top:n.P.convert(T.top||[0,0]),\"top-left\":n.P.convert(T[\"top-left\"]||[0,0]),\"top-right\":n.P.convert(T[\"top-right\"]||[0,0]),bottom:n.P.convert(T.bottom||[0,0]),\"bottom-left\":n.P.convert(T[\"bottom-left\"]||[0,0]),\"bottom-right\":n.P.convert(T[\"bottom-right\"]||[0,0]),left:n.P.convert(T.left||[0,0]),right:n.P.convert(T.right||[0,0])}}return Tf(new n.P(0,0))}let Ho={extend:(T,...l)=>n.e(T,...l),run(T){T()},logToElement(T,l=!1,d=\"log\"){let v=window.document.getElementById(d);v&&(l&&(v.innerHTML=\"\"),v.innerHTML+=`
${T}`)}},lA=o;class bi{static get version(){return lA}static get workerCount(){return lo.workerCount}static set workerCount(l){lo.workerCount=l}static get maxParallelImageRequests(){return n.c.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(l){n.c.MAX_PARALLEL_IMAGE_REQUESTS=l}static get workerUrl(){return n.c.WORKER_URL}static set workerUrl(l){n.c.WORKER_URL=l}static addProtocol(l,d){n.c.REGISTERED_PROTOCOLS[l]=d}static removeProtocol(l){delete n.c.REGISTERED_PROTOCOLS[l]}}return bi.Map=class extends v_{constructor(T){if(n.bg.mark(n.bh.create),(T=n.e({},dr,T)).minZoom!=null&&T.maxZoom!=null&&T.minZoom>T.maxZoom)throw new Error(\"maxZoom must be greater than or equal to minZoom\");if(T.minPitch!=null&&T.maxPitch!=null&&T.minPitch>T.maxPitch)throw new Error(\"maxPitch must be greater than or equal to minPitch\");if(T.minPitch!=null&&T.minPitch<0)throw new Error(\"minPitch must be greater than or equal to 0\");if(T.maxPitch!=null&&T.maxPitch>85)throw new Error(\"maxPitch must be less than or equal to 85\");if(super(new Kp(T.minZoom,T.maxZoom,T.minPitch,T.maxPitch,T.renderWorldCopies),{bearingSnap:T.bearingSnap}),this._cooperativeGesturesOnWheel=l=>{this._onCooperativeGesture(l,l[this._metaKey],1)},this._contextLost=l=>{l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new n.k(\"webglcontextlost\",{originalEvent:l}))},this._contextRestored=l=>{this._setupPainter(),this.resize(),this._update(),this.fire(new n.k(\"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()},this._interactive=T.interactive,this._cooperativeGestures=T.cooperativeGestures,this._metaKey=navigator.platform.indexOf(\"Mac\")===0?\"metaKey\":\"ctrlKey\",this._maxTileCacheSize=T.maxTileCacheSize,this._maxTileCacheZoomLevels=T.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=T.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=T.preserveDrawingBuffer,this._antialias=T.antialias,this._trackResize=T.trackResize,this._bearingSnap=T.bearingSnap,this._refreshExpiredTiles=T.refreshExpiredTiles,this._fadeDuration=T.fadeDuration,this._crossSourceCollisions=T.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=T.collectResourceTiming,this._renderTaskQueue=new sA,this._controls=[],this._mapId=n.a2(),this._locale=n.e({},d0,T.locale),this._clickTolerance=T.clickTolerance,this._overridePixelRatio=T.pixelRatio,this._maxCanvasSize=T.maxCanvasSize,this.transformCameraUpdate=T.transformCameraUpdate,this._imageQueueHandle=j.addThrottleControl(()=>this.isMoving()),this._requestManager=new et(T.transformRequest),typeof T.container==\"string\"){if(this._container=document.getElementById(T.container),!this._container)throw new Error(`Container '${T.container}' not found.`)}else{if(!(T.container instanceof HTMLElement))throw new Error(\"Invalid type: 'container' must be a String or HTMLElement.\");this._container=T.container}if(T.maxBounds&&this.setMaxBounds(T.maxBounds),this._setupContainer(),this._setupPainter(),this.on(\"move\",()=>this._update(!1)),this.on(\"moveend\",()=>this._update(!1)),this.on(\"zoom\",()=>this._update(!0)),this.on(\"terrain\",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once(\"idle\",()=>{this._idleTriggered=!0}),typeof window<\"u\"){addEventListener(\"online\",this._onWindowOnline,!1);let l=!1,d=lh(v=>{this._trackResize&&!this._removed&&this.resize(v)._update()},50);this._resizeObserver=new ResizeObserver(v=>{l?d(v):l=!0}),this._resizeObserver.observe(this._container)}this.handlers=new f0(this,T),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=T.hash&&new Ld(typeof T.hash==\"string\"&&T.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:T.center,zoom:T.zoom,bearing:T.bearing,pitch:T.pitch}),T.bounds&&(this.resize(),this.fitBounds(T.bounds,n.e({},T.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=T.localIdeographFontFamily,this._validateStyle=T.validateStyle,T.style&&this.setStyle(T.style,{localIdeographFontFamily:T.localIdeographFontFamily}),T.attributionControl&&this.addControl(new ua({customAttribution:T.customAttribution})),T.maplibreLogo&&this.addControl(new un,T.logoPosition),this.on(\"style.load\",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on(\"data\",l=>{this._update(l.dataType===\"style\"),this.fire(new n.k(`${l.dataType}data`,l))}),this.on(\"dataloading\",l=>{this.fire(new n.k(`${l.dataType}dataloading`,l))}),this.on(\"dataabort\",l=>{this.fire(new n.k(\"sourcedataabort\",l))})}_getMapId(){return this._mapId}addControl(T,l){if(l===void 0&&(l=T.getDefaultPosition?T.getDefaultPosition():\"top-right\"),!T||!T.onAdd)return this.fire(new n.j(new Error(\"Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.\")));let d=T.onAdd(this);this._controls.push(T);let v=this._controlPositions[l];return l.indexOf(\"bottom\")!==-1?v.insertBefore(d,v.firstChild):v.appendChild(d),this}removeControl(T){if(!T||!T.onRemove)return this.fire(new n.j(new Error(\"Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.\")));let l=this._controls.indexOf(T);return l>-1&&this._controls.splice(l,1),T.onRemove(this),this}hasControl(T){return this._controls.indexOf(T)>-1}calculateCameraOptionsFromTo(T,l,d,v){return v==null&&this.terrain&&(v=this.terrain.getElevationForLngLatZoom(d,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(T,l,d,v)}resize(T){var l;let d=this._containerDimensions(),v=d[0],b=d[1],M=this._getClampedPixelRatio(v,b);if(this._resizeCanvas(v,b,M),this.painter.resize(v,b,M),this.painter.overLimit()){let B=this.painter.context.gl;this._maxCanvasSize=[B.drawingBufferWidth,B.drawingBufferHeight];let U=this._getClampedPixelRatio(v,b);this._resizeCanvas(v,b,U),this.painter.resize(v,b,U)}this.transform.resize(v,b),(l=this._requestedCameraState)===null||l===void 0||l.resize(v,b);let O=!this._moving;return O&&(this.stop(),this.fire(new n.k(\"movestart\",T)).fire(new n.k(\"move\",T))),this.fire(new n.k(\"resize\",T)),O&&this.fire(new n.k(\"moveend\",T)),this}_getClampedPixelRatio(T,l){let{0:d,1:v}=this._maxCanvasSize,b=this.getPixelRatio(),M=T*b,O=l*b;return Math.min(M>d?d/M:1,O>v?v/O:1)*b}getPixelRatio(){var T;return(T=this._overridePixelRatio)!==null&&T!==void 0?T:devicePixelRatio}setPixelRatio(T){this._overridePixelRatio=T,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(T){return this.transform.setMaxBounds(Si.convert(T)),this._update()}setMinZoom(T){if((T=T??-2)>=-2&&T<=this.transform.maxZoom)return this.transform.minZoom=T,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=T,this._update(),this.getZoom()>T&&this.setZoom(T),this;throw new Error(\"maxZoom must be greater than the current minZoom\")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(T){if((T=T??0)<0)throw new Error(\"minPitch must be greater than or equal to 0\");if(T>=0&&T<=this.transform.maxPitch)return this.transform.minPitch=T,this._update(),this.getPitch()85)throw new Error(\"maxPitch must be less than or equal to 85\");if(T>=this.transform.minPitch)return this.transform.maxPitch=T,this._update(),this.getPitch()>T&&this.setPitch(T),this;throw new Error(\"maxPitch must be greater than the current minPitch\")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(T){return this.transform.renderWorldCopies=T,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(T){return this._cooperativeGestures=T,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(T){return this.transform.locationPoint(n.L.convert(T),this.style&&this.terrain)}unproject(T){return this.transform.pointLocation(n.P.convert(T),this.terrain)}isMoving(){var T;return this._moving||((T=this.handlers)===null||T===void 0?void 0:T.isMoving())}isZooming(){var T;return this._zooming||((T=this.handlers)===null||T===void 0?void 0:T.isZooming())}isRotating(){var T;return this._rotating||((T=this.handlers)===null||T===void 0?void 0:T.isRotating())}_createDelegatedListener(T,l,d){if(T===\"mouseenter\"||T===\"mouseover\"){let v=!1;return{layer:l,listener:d,delegates:{mousemove:M=>{let O=this.getLayer(l)?this.queryRenderedFeatures(M.point,{layers:[l]}):[];O.length?v||(v=!0,d.call(this,new la(T,this,M.originalEvent,{features:O}))):v=!1},mouseout:()=>{v=!1}}}}if(T===\"mouseleave\"||T===\"mouseout\"){let v=!1;return{layer:l,listener:d,delegates:{mousemove:O=>{(this.getLayer(l)?this.queryRenderedFeatures(O.point,{layers:[l]}):[]).length?v=!0:v&&(v=!1,d.call(this,new la(T,this,O.originalEvent)))},mouseout:O=>{v&&(v=!1,d.call(this,new la(T,this,O.originalEvent)))}}}}{let v=b=>{let M=this.getLayer(l)?this.queryRenderedFeatures(b.point,{layers:[l]}):[];M.length&&(b.features=M,d.call(this,b),delete b.features)};return{layer:l,listener:d,delegates:{[T]:v}}}}on(T,l,d){if(d===void 0)return super.on(T,l);let v=this._createDelegatedListener(T,l,d);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[T]=this._delegatedListeners[T]||[],this._delegatedListeners[T].push(v);for(let b in v.delegates)this.on(b,v.delegates[b]);return this}once(T,l,d){if(d===void 0)return super.once(T,l);let v=this._createDelegatedListener(T,l,d);for(let b in v.delegates)this.once(b,v.delegates[b]);return this}off(T,l,d){return d===void 0?super.off(T,l):(this._delegatedListeners&&this._delegatedListeners[T]&&(v=>{let b=this._delegatedListeners[T];for(let M=0;Mthis._updateStyle(T,l));let d=this.style&&l.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!T)),T?(this.style=new Gn(this,l||{}),this.style.setEventedParent(this,{style:this.style}),typeof T==\"string\"?this.style.loadURL(T,l,d):this.style.loadJSON(T,l,d),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Gn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(T,l){if(typeof T==\"string\"){let d=this._requestManager.transformRequest(T,Q.Style);n.f(d,(v,b)=>{v?this.fire(new n.j(v)):b&&this._updateDiff(b,l)})}else typeof T==\"object\"&&this._updateDiff(T,l)}_updateDiff(T,l){try{this.style.setState(T,l)&&this._update(!0)}catch(d){n.w(`Unable to perform style diff: ${d.message||d.error||d}. Rebuilding the style from scratch.`),this._updateStyle(T,l)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():n.w(\"There is no style added to the map.\")}addSource(T,l){return this._lazyInitEmptyStyle(),this.style.addSource(T,l),this._update(!0)}isSourceLoaded(T){let l=this.style&&this.style.sourceCaches[T];if(l!==void 0)return l.loaded();this.fire(new n.j(new Error(`There is no source with ID '${T}'`)))}setTerrain(T){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off(\"data\",this._terrainDataCallback),T){let l=this.style.sourceCaches[T.source];if(!l)throw new Error(`cannot load terrain, because there exists no source with ID: ${T.source}`);for(let d in this.style._layers){let v=this.style._layers[d];v.type===\"hillshade\"&&v.source===T.source&&n.w(\"You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.\")}this.terrain=new b_(this.painter,l,T),this.painter.renderToTexture=new oA(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=d=>{d.dataType===\"style\"?this.terrain.sourceCache.freeRtt():d.dataType===\"source\"&&d.tile&&(d.sourceId!==T.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(d.tile.tileID))},this.style.on(\"data\",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new n.k(\"terrain\",{terrain:T})),this}getTerrain(){var T,l;return(l=(T=this.terrain)===null||T===void 0?void 0:T.options)!==null&&l!==void 0?l:null}areTilesLoaded(){let T=this.style&&this.style.sourceCaches;for(let l in T){let d=T[l]._tiles;for(let v in d){let b=d[v];if(b.state!==\"loaded\"&&b.state!==\"errored\")return!1}}return!0}addSourceType(T,l,d){return this._lazyInitEmptyStyle(),this.style.addSourceType(T,l,d)}removeSource(T){return this.style.removeSource(T),this._update(!0)}getSource(T){return this.style.getSource(T)}addImage(T,l,d={}){let{pixelRatio:v=1,sdf:b=!1,stretchX:M,stretchY:O,content:B}=d;if(this._lazyInitEmptyStyle(),!(l instanceof HTMLImageElement||n.a(l))){if(l.width===void 0||l.height===void 0)return this.fire(new n.j(new 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`\")));{let{width:U,height:W,data:Z}=l,$=l;return this.style.addImage(T,{data:new n.R({width:U,height:W},new Uint8Array(Z)),pixelRatio:v,stretchX:M,stretchY:O,content:B,sdf:b,version:0,userImage:$}),$.onAdd&&$.onAdd(this,T),this}}{let{width:U,height:W,data:Z}=n.h.getImageData(l);this.style.addImage(T,{data:new n.R({width:U,height:W},Z),pixelRatio:v,stretchX:M,stretchY:O,content:B,sdf:b,version:0})}}updateImage(T,l){let d=this.style.getImage(T);if(!d)return this.fire(new n.j(new Error(\"The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.\")));let v=l instanceof HTMLImageElement||n.a(l)?n.h.getImageData(l):l,{width:b,height:M,data:O}=v;if(b===void 0||M===void 0)return this.fire(new n.j(new 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(b!==d.data.width||M!==d.data.height)return this.fire(new n.j(new Error(\"The width and height of the updated image must be that same as the previous version of the image\")));let B=!(l instanceof HTMLImageElement||n.a(l));return d.data.replace(O,B),this.style.updateImage(T,d),this}getImage(T){return this.style.getImage(T)}hasImage(T){return T?!!this.style.getImage(T):(this.fire(new n.j(new Error(\"Missing required image id\"))),!1)}removeImage(T){this.style.removeImage(T)}loadImage(T,l){j.getImage(this._requestManager.transformRequest(T,Q.Image),l)}listImages(){return this.style.listImages()}addLayer(T,l){return this._lazyInitEmptyStyle(),this.style.addLayer(T,l),this._update(!0)}moveLayer(T,l){return this.style.moveLayer(T,l),this._update(!0)}removeLayer(T){return this.style.removeLayer(T),this._update(!0)}getLayer(T){return this.style.getLayer(T)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(T,l,d){return this.style.setLayerZoomRange(T,l,d),this._update(!0)}setFilter(T,l,d={}){return this.style.setFilter(T,l,d),this._update(!0)}getFilter(T){return this.style.getFilter(T)}setPaintProperty(T,l,d,v={}){return this.style.setPaintProperty(T,l,d,v),this._update(!0)}getPaintProperty(T,l){return this.style.getPaintProperty(T,l)}setLayoutProperty(T,l,d,v={}){return this.style.setLayoutProperty(T,l,d,v),this._update(!0)}getLayoutProperty(T,l){return this.style.getLayoutProperty(T,l)}setGlyphs(T,l={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(T,l),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(T,l,d={}){return this._lazyInitEmptyStyle(),this.style.addSprite(T,l,d,v=>{v||this._update(!0)}),this}removeSprite(T){return this._lazyInitEmptyStyle(),this.style.removeSprite(T),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(T,l={}){return this._lazyInitEmptyStyle(),this.style.setSprite(T,l,d=>{d||this._update(!0)}),this}setLight(T,l={}){return this._lazyInitEmptyStyle(),this.style.setLight(T,l),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(T,l){return this.style.setFeatureState(T,l),this._update()}removeFeatureState(T,l){return this.style.removeFeatureState(T,l),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,l=0;return this._container&&(T=this._container.clientWidth||400,l=this._container.clientHeight||300),[T,l]}_setupContainer(){let T=this._container;T.classList.add(\"maplibregl-map\");let l=this._canvasContainer=c.create(\"div\",\"maplibregl-canvas-container\",T);this._interactive&&l.classList.add(\"maplibregl-interactive\"),this._canvas=c.create(\"canvas\",\"maplibregl-canvas\",l),this._canvas.addEventListener(\"webglcontextlost\",this._contextLost,!1),this._canvas.addEventListener(\"webglcontextrestored\",this._contextRestored,!1),this._canvas.setAttribute(\"tabindex\",\"0\"),this._canvas.setAttribute(\"aria-label\",\"Map\"),this._canvas.setAttribute(\"role\",\"region\");let d=this._containerDimensions(),v=this._getClampedPixelRatio(d[0],d[1]);this._resizeCanvas(d[0],d[1],v);let b=this._controlContainer=c.create(\"div\",\"maplibregl-control-container\",T),M=this._controlPositions={};[\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"].forEach(O=>{M[O]=c.create(\"div\",`maplibregl-ctrl-${O} `,b)}),this._container.addEventListener(\"scroll\",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=c.create(\"div\",\"maplibregl-cooperative-gesture-screen\",this._container);let T=typeof this._cooperativeGestures!=\"boolean\"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:\"Use Ctrl + scroll to zoom the map\";navigator.platform.indexOf(\"Mac\")===0&&(T=typeof this._cooperativeGestures!=\"boolean\"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:\"Use \\u2318 + scroll to zoom the map\"),this._cooperativeGesturesScreen.innerHTML=`\n
${T}
\n
${typeof this._cooperativeGestures!=\"boolean\"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:\"Use two fingers to move the map\"}
\n `,this._cooperativeGesturesScreen.setAttribute(\"aria-hidden\",\"true\"),this._canvasContainer.addEventListener(\"wheel\",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add(\"maplibregl-cooperative-gestures\")}_destroyCooperativeGestures(){c.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener(\"wheel\",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove(\"maplibregl-cooperative-gestures\")}_resizeCanvas(T,l,d){this._canvas.width=Math.floor(d*T),this._canvas.height=Math.floor(d*l),this._canvas.style.width=`${T}px`,this._canvas.style.height=`${l}px`}_setupPainter(){let T={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},l=null;this._canvas.addEventListener(\"webglcontextcreationerror\",v=>{l={requestedAttributes:T},v&&(l.statusMessage=v.statusMessage,l.type=v.type)},{once:!0});let d=this._canvas.getContext(\"webgl2\",T)||this._canvas.getContext(\"webgl\",T);if(!d){let v=\"Failed to initialize WebGL\";throw l?(l.message=v,new Error(JSON.stringify(l))):new Error(v)}this.painter=new ah(d,this.transform),f.testSupport(d)}_onCooperativeGesture(T,l,d){return!l&&d<2&&(this._cooperativeGesturesScreen.classList.add(\"maplibregl-show\"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove(\"maplibregl-show\")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(T){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||T,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(T){return this._update(),this._renderTaskQueue.add(T)}_cancelRenderFrame(T){this._renderTaskQueue.remove(T)}_render(T){let l=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(T),this._removed)return;let d=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let b=this.transform.zoom,M=n.h.now();this.style.zoomHistory.update(b,M);let O=new n.a8(b,{now:M,fadeDuration:l,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),B=O.crossFadingFactor();B===1&&B===this._crossFadingFactor||(d=!0,this._crossFadingFactor=B),this.style.update(O)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,l,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,showPadding:this.showPadding}),this.fire(new n.k(\"render\")),this.loaded()&&!this._loaded&&(this._loaded=!0,n.bg.mark(n.bh.load),this.fire(new n.k(\"load\"))),this.style&&(this.style.hasTransitions()||d)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let v=this._sourcesDirty||this._styleDirty||this._placementDirty;return v||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new n.k(\"idle\")),!this._loaded||this._fullyLoaded||v||(this._fullyLoaded=!0,n.bg.mark(n.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var T;this._hash&&this._hash.remove();for(let d of this._controls)d.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<\"u\"&&removeEventListener(\"online\",this._onWindowOnline,!1),j.removeThrottleControl(this._imageQueueHandle),(T=this._resizeObserver)===null||T===void 0||T.disconnect();let l=this.painter.context.gl.getExtension(\"WEBGL_lose_context\");l&&l.loseContext(),this._canvas.removeEventListener(\"webglcontextrestored\",this._contextRestored,!1),this._canvas.removeEventListener(\"webglcontextlost\",this._contextLost,!1),c.remove(this._canvasContainer),c.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove(\"maplibregl-map\"),n.bg.clearMetrics(),this._removed=!0,this.fire(new n.k(\"remove\"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=n.h.frame(T=>{n.bg.frame(T),this._frame=null,this._render(T)}))}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 nr}getCameraTargetElevation(){return this.transform.elevation}},bi.NavigationControl=class{constructor(T){this._updateZoomButtons=()=>{let l=this._map.getZoom(),d=l===this._map.getMaxZoom(),v=l===this._map.getMinZoom();this._zoomInButton.disabled=d,this._zoomOutButton.disabled=v,this._zoomInButton.setAttribute(\"aria-disabled\",d.toString()),this._zoomOutButton.setAttribute(\"aria-disabled\",v.toString())},this._rotateCompassArrow=()=>{let l=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=l},this._setButtonTitle=(l,d)=>{let v=this._map._getUIString(`NavigationControl.${d}`);l.title=v,l.setAttribute(\"aria-label\",v)},this.options=n.e({},aA,T),this._container=c.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._container.addEventListener(\"contextmenu\",l=>l.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton(\"maplibregl-ctrl-zoom-in\",l=>this._map.zoomIn({},{originalEvent:l})),c.create(\"span\",\"maplibregl-ctrl-icon\",this._zoomInButton).setAttribute(\"aria-hidden\",\"true\"),this._zoomOutButton=this._createButton(\"maplibregl-ctrl-zoom-out\",l=>this._map.zoomOut({},{originalEvent:l})),c.create(\"span\",\"maplibregl-ctrl-icon\",this._zoomOutButton).setAttribute(\"aria-hidden\",\"true\")),this.options.showCompass&&(this._compass=this._createButton(\"maplibregl-ctrl-compass\",l=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:l}):this._map.resetNorth({},{originalEvent:l})}),this._compassIcon=c.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(\"zoom\",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,\"ResetBearing\"),this.options.visualizePitch&&this._map.on(\"pitch\",this._rotateCompassArrow),this._map.on(\"rotate\",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Bd(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){c.remove(this._container),this.options.showZoom&&this._map.off(\"zoom\",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off(\"pitch\",this._rotateCompassArrow),this._map.off(\"rotate\",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(T,l){let d=c.create(\"button\",T,this._container);return d.type=\"button\",d.addEventListener(\"click\",l),d}},bi.GeolocateControl=class extends n.E{constructor(T){super(),this._onSuccess=l=>{if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new n.k(\"outofmaxbounds\",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,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 new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!==\"OFF\"&&this._updateMarker(l),this.options.trackUserLocation&&this._watchState!==\"ACTIVE_LOCK\"||this._updateCamera(l),this.options.showUserLocation&&this._dotElement.classList.remove(\"maplibregl-user-location-dot-stale\"),this.fire(new n.k(\"geolocate\",l)),this._finish()}},this._updateCamera=l=>{let d=new n.L(l.coords.longitude,l.coords.latitude),v=l.coords.accuracy,b=this._map.getBearing(),M=n.e({bearing:b},this.options.fitBoundsOptions),O=Si.fromLngLat(d,v);this._map.fitBounds(O,M,{geolocateSource:!0})},this._updateMarker=l=>{if(l){let d=new n.L(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=l=>{if(this._map){if(this.options.trackUserLocation)if(l.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 d=this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");this._geolocateButton.title=d,this._geolocateButton.setAttribute(\"aria-label\",d),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&Sf)return;this._setErrorState()}this._watchState!==\"OFF\"&&this.options.showUserLocation&&this._dotElement.classList.add(\"maplibregl-user-location-dot-stale\"),this.fire(new n.k(\"error\",l)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=l=>{if(this._map){if(this._container.addEventListener(\"contextmenu\",d=>d.preventDefault()),this._geolocateButton=c.create(\"button\",\"maplibregl-ctrl-geolocate\",this._container),c.create(\"span\",\"maplibregl-ctrl-icon\",this._geolocateButton).setAttribute(\"aria-hidden\",\"true\"),this._geolocateButton.type=\"button\",l===!1){n.w(\"Geolocation support is not available so the GeolocateControl will be disabled.\");let d=this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");this._geolocateButton.disabled=!0,this._geolocateButton.title=d,this._geolocateButton.setAttribute(\"aria-label\",d)}else{let d=this._map._getUIString(\"GeolocateControl.FindMyLocation\");this._geolocateButton.title=d,this._geolocateButton.setAttribute(\"aria-label\",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute(\"aria-pressed\",\"false\"),this._watchState=\"OFF\"),this.options.showUserLocation&&(this._dotElement=c.create(\"div\",\"maplibregl-user-location-dot\"),this._userLocationDotMarker=new mh({element:this._dotElement}),this._circleElement=c.create(\"div\",\"maplibregl-user-location-accuracy-circle\"),this._accuracyCircleMarker=new mh({element:this._circleElement,pitchAlignment:\"map\"}),this.options.trackUserLocation&&(this._watchState=\"OFF\"),this._map.on(\"zoom\",this._onZoom)),this._geolocateButton.addEventListener(\"click\",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on(\"movestart\",d=>{d.geolocateSource||this._watchState!==\"ACTIVE_LOCK\"||d.originalEvent&&d.originalEvent.type===\"resize\"||(this._watchState=\"BACKGROUND\",this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-background\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this.fire(new n.k(\"trackuserlocationend\")))})}},this.options=n.e({},kn,T)}onAdd(T){return this._map=T,this._container=c.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),function(l,d=!1){Hn===void 0||d?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:\"geolocation\"}).then(v=>{Hn=v.state!==\"denied\",l(Hn)}).catch(()=>{Hn=!!window.navigator.geolocation,l(Hn)}):(Hn=!!window.navigator.geolocation,l(Hn)):l(Hn)}(this._setupUI),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(),c.remove(this._container),this._map.off(\"zoom\",this._onZoom),this._map=void 0,wn=0,Sf=!1}_isOutOfMapMaxBounds(T){let l=this._map.getMaxBounds(),d=T.coords;return l&&(d.longitudel.getEast()||d.latitudel.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\":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){let T=this._map.getBounds(),l=T.getSouthEast(),d=T.getNorthEast(),v=l.distanceTo(d),b=Math.ceil(this._accuracy/(v/this._map._container.clientHeight)*2);this._circleElement.style.width=`${b}px`,this._circleElement.style.height=`${b}px`}trigger(){if(!this._setup)return n.w(\"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 n.k(\"trackuserlocationstart\"));break;case\"WAITING_ACTIVE\":case\"ACTIVE_LOCK\":case\"ACTIVE_ERROR\":case\"BACKGROUND_ERROR\":wn--,Sf=!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 n.k(\"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 n.k(\"trackuserlocationstart\"));break;default:throw new 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 new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState===\"OFF\"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let T;this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.setAttribute(\"aria-pressed\",\"true\"),wn++,wn>1?(T={maximumAge:6e5,timeout:0},Sf=!0):(T=this.options.positionOptions,Sf=!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)}},bi.AttributionControl=ua,bi.LogoControl=un,bi.ScaleControl=class{constructor(T){this._onMove=()=>{gh(this._map,this._container,this.options)},this.setUnit=l=>{this.options.unit=l,gh(this._map,this._container,this.options)},this.options=n.e({},Es,T)}getDefaultPosition(){return\"bottom-left\"}onAdd(T){return this._map=T,this._container=c.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-scale\",T.getContainer()),this._map.on(\"move\",this._onMove),this._onMove(),this._container}onRemove(){c.remove(this._container),this._map.off(\"move\",this._onMove),this._map=void 0}},bi.FullscreenControl=class extends n.E{constructor(T={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,T&&T.container&&(T.container instanceof HTMLElement?this._container=T.container:n.w(\"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=c.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._setupUI(),this._controlContainer}onRemove(){c.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let T=this._fullscreenButton=c.create(\"button\",\"maplibregl-ctrl-fullscreen\",this._controlContainer);c.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 n.k(\"fullscreenstart\")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new n.k(\"fullscreenend\")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle(\"maplibregl-pseudo-fullscreen\"),this._handleFullscreenChange(),this._map.resize()}},bi.TerrainControl=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.disableTerrain\")):(this._terrainButton.classList.add(\"maplibregl-ctrl-terrain\"),this._terrainButton.title=this._map._getUIString(\"TerrainControl.enableTerrain\"))},this.options=T}onAdd(T){return this._map=T,this._container=c.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._terrainButton=c.create(\"button\",\"maplibregl-ctrl-terrain\",this._container),c.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(){c.remove(this._container),this._map.off(\"terrain\",this._updateTerrainIcon),this._map=void 0}},bi.Popup=class extends n.E{constructor(T){super(),this.remove=()=>(this._content&&c.remove(this._content),this._container&&(c.remove(this._container),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(\"mousemove\",this._onMouseMove),this._map.off(\"mouseup\",this._onMouseUp),this._map.off(\"drag\",this._onDrag),delete this._map),this.fire(new n.k(\"close\")),this),this._onMouseUp=l=>{this._update(l.point)},this._onMouseMove=l=>{this._update(l.point)},this._onDrag=l=>{this._update(l.point)},this._update=l=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=c.create(\"div\",\"maplibregl-popup\",this._map.getContainer()),this._tip=c.create(\"div\",\"maplibregl-popup-tip\",this._container),this._container.appendChild(this._content),this.options.className)for(let O of this.options.className.split(\" \"))this._container.classList.add(O);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._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=uo(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!l)return;let d=this._pos=this._trackPointer&&l?l:this._map.project(this._lngLat),v=this.options.anchor,b=Tf(this.options.offset);if(!v){let O=this._container.offsetWidth,B=this._container.offsetHeight,U;U=d.y+b.bottom.ythis._map.transform.height-B?[\"bottom\"]:[],d.xthis._map.transform.width-O/2&&U.push(\"right\"),v=U.length===0?\"bottom\":U.join(\"-\")}let M=d.add(b[v]).round();c.setTransform(this._container,`${ji[v]} translate(${M.x}px,${M.y}px)`),w_(this._container,v,\"popup\")},this._onClose=()=>{this.remove()},this.options=n.e(Object.create(p0),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._update(),this._focusFirstElement(),this._trackPointer?(this._map.on(\"mousemove\",this._onMouseMove),this._map.on(\"mouseup\",this._onMouseUp),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 n.k(\"open\")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(T){return this._lngLat=n.L.convert(T),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on(\"move\",this._update),this._map.off(\"mousemove\",this._onMouseMove),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._update(),this._map&&(this._map.off(\"move\",this._update),this._map.on(\"mousemove\",this._onMouseMove),this._map.on(\"drag\",this._onDrag),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 l=document.createDocumentFragment(),d=document.createElement(\"body\"),v;for(d.innerHTML=T;v=d.firstChild,v;)l.appendChild(v);return this.setDOMContent(l)}getMaxWidth(){var T;return(T=this._container)===null||T===void 0?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=c.create(\"div\",\"maplibregl-popup-content\",this._container);return this._content.appendChild(T),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(T){this._container&&this._container.classList.add(T)}removeClassName(T){this._container&&this._container.classList.remove(T)}setOffset(T){return this.options.offset=T,this._update(),this}toggleClassName(T){if(this._container)return this._container.classList.toggle(T)}_createCloseButton(){this.options.closeButton&&(this._closeButton=c.create(\"button\",\"maplibregl-popup-close-button\",this._content),this._closeButton.type=\"button\",this._closeButton.setAttribute(\"aria-label\",\"Close popup\"),this._closeButton.innerHTML=\"×\",this._closeButton.addEventListener(\"click\",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let T=this._container.querySelector(Fd);T&&T.focus()}},bi.Marker=mh,bi.Style=Gn,bi.LngLat=n.L,bi.LngLatBounds=Si,bi.Point=n.P,bi.MercatorCoordinate=n.U,bi.Evented=n.E,bi.AJAXError=n.bi,bi.config=n.c,bi.CanvasSource=Vo,bi.GeoJSONSource=Xi,bi.ImageSource=ki,bi.RasterDEMTileSource=Rc,bi.RasterTileSource=kc,bi.VectorTileSource=ll,bi.VideoSource=ts,bi.setRTLTextPlugin=n.bj,bi.getRTLTextPluginStatus=n.bk,bi.prewarm=function(){bo().acquire(oi)},bi.clearPrewarmedResources=function(){let T=ul;T&&(T.isPreloaded()&&T.numActive()===1?(T.release(oi),ul=null):console.warn(\"Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()\"))},Ho.extend(bi,{isSafari:n.ac,getPerformanceMetrics:n.bg.getPerformanceMetrics}),bi});var s=r;return s})});var TG=Br((p6t,oP)=>{(function(e,t,r,i){\"use strict\";var s=[\"\",\"webkit\",\"Moz\",\"MS\",\"ms\",\"o\"],n=t.createElement(\"div\"),o=\"function\",c=Math.round,f=Math.abs,_=Date.now;function w(lt,ft,Lt){return setTimeout(K(lt,Lt),ft)}function I(lt,ft,Lt){return Array.isArray(lt)?(R(lt,Lt[ft],Lt),!0):!1}function R(lt,ft,Lt){var Kt;if(lt)if(lt.forEach)lt.forEach(ft,Lt);else if(lt.length!==i)for(Kt=0;Kt\\s*\\(/gm,\"{anonymous}()@\"):\"Unknown Stack Trace\",ti=e.console&&(e.console.warn||e.console.log);return ti&&ti.call(e.console,Kt,Qe),lt.apply(this,arguments)}}var j;typeof Object.assign!=\"function\"?j=function(ft){if(ft===i||ft===null)throw new TypeError(\"Cannot convert undefined or null to object\");for(var Lt=Object(ft),Kt=1;Kt-1}function le(lt){return lt.trim().split(/\\s+/g)}function ue(lt,ft,Lt){if(lt.indexOf&&!Lt)return lt.indexOf(ft);for(var Kt=0;KtVs[ft]}):Kt=Kt.sort()),Kt}function rr(lt,ft){for(var Lt,Kt,ge=ft[0].toUpperCase()+ft.slice(1),Qe=0;Qe1&&!Lt.firstMultiple?Lt.firstMultiple=bo(ft):ge===1&&(Lt.firstMultiple=!1);var Qe=Lt.firstInput,ti=Lt.firstMultiple,is=ti?ti.center:Qe.center,Ts=ft.center=hl(Kt);ft.timeStamp=_(),ft.deltaTime=ft.timeStamp-Qe.timeStamp,ft.angle=jo(is,Ts),ft.distance=ve(is,Ts),du(Lt,ft),ft.offsetDirection=wo(ft.deltaX,ft.deltaY);var Vs=Ia(ft.deltaTime,ft.deltaX,ft.deltaY);ft.overallVelocityX=Vs.x,ft.overallVelocityY=Vs.y,ft.overallVelocity=f(Vs.x)>f(Vs.y)?Vs.x:Vs.y,ft.scale=ti?Ul(ti.pointers,Kt):1,ft.rotation=ti?gn(ti.pointers,Kt):0,ft.maxPointers=Lt.prevInput?ft.pointers.length>Lt.prevInput.maxPointers?ft.pointers.length:Lt.prevInput.maxPointers:ft.pointers.length,ul(Lt,ft);var Ra=lt.element;Xt(ft.srcEvent.target,Ra)&&(Ra=ft.srcEvent.target),ft.target=Ra}function du(lt,ft){var Lt=ft.center,Kt=lt.offsetDelta||{},ge=lt.prevDelta||{},Qe=lt.prevInput||{};(ft.eventType===Xi||Qe.eventType===ki)&&(ge=lt.prevDelta={x:Qe.deltaX||0,y:Qe.deltaY||0},Kt=lt.offsetDelta={x:Lt.x,y:Lt.y}),ft.deltaX=ge.x+(Lt.x-Kt.x),ft.deltaY=ge.y+(Lt.y-Kt.y)}function ul(lt,ft){var Lt=lt.lastInterval||ft,Kt=ft.timeStamp-Lt.timeStamp,ge,Qe,ti,is;if(ft.eventType!=ts&&(Kt>Rc||Lt.velocity===i)){var Ts=ft.deltaX-Lt.deltaX,Vs=ft.deltaY-Lt.deltaY,Ra=Ia(Kt,Ts,Vs);Qe=Ra.x,ti=Ra.y,ge=f(Ra.x)>f(Ra.y)?Ra.x:Ra.y,is=wo(Ts,Vs),lt.lastInterval=ft}else ge=Lt.velocity,Qe=Lt.velocityX,ti=Lt.velocityY,is=Lt.direction;ft.velocity=ge,ft.velocityX=Qe,ft.velocityY=ti,ft.direction=is}function bo(lt){for(var ft=[],Lt=0;Lt=f(ft)?lt<0?cl:xo:ft<0?Pa:na}function ve(lt,ft,Lt){Lt||(Lt=ee);var Kt=ft[Lt[0]]-lt[Lt[0]],ge=ft[Lt[1]]-lt[Lt[1]];return Math.sqrt(Kt*Kt+ge*ge)}function jo(lt,ft,Lt){Lt||(Lt=ee);var Kt=ft[Lt[0]]-lt[Lt[0]],ge=ft[Lt[1]]-lt[Lt[1]];return Math.atan2(ge,Kt)*180/Math.PI}function gn(lt,ft){return jo(ft[1],ft[0],ls)+jo(lt[1],lt[0],ls)}function Ul(lt,ft){return ve(ft[0],ft[1],ls)/ve(lt[0],lt[1],ls)}var Ca={mousedown:Xi,mousemove:Jn,mouseup:ki},Te=\"mousedown\",Dr=\"mousemove mouseup\";function gr(){this.evEl=Te,this.evWin=Dr,this.pressed=!1,mn.apply(this,arguments)}Y(gr,mn,{handler:function(ft){var Lt=Ca[ft.type];Lt&Xi&&ft.button===0&&(this.pressed=!0),Lt&Jn&&ft.which!==1&&(Lt=ki),this.pressed&&(Lt&ki&&(this.pressed=!1),this.callback(this.manager,Lt,{pointers:[ft],changedPointers:[ft],pointerType:ll,srcEvent:ft}))}});var Us={pointerdown:Xi,pointermove:Jn,pointerup:ki,pointercancel:ts,pointerout:ts},La={2:Si,3:Ns,4:ll,5:kc},Mr=\"pointerdown\",sa=\"pointermove pointerup pointercancel\";e.MSPointerEvent&&!e.PointerEvent&&(Mr=\"MSPointerDown\",sa=\"MSPointerMove MSPointerUp MSPointerCancel\");function gt(){this.evEl=Mr,this.evWin=sa,mn.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}Y(gt,mn,{handler:function(ft){var Lt=this.store,Kt=!1,ge=ft.type.toLowerCase().replace(\"ms\",\"\"),Qe=Us[ge],ti=La[ft.pointerType]||ft.pointerType,is=ti==Si,Ts=ue(Lt,ft.pointerId,\"pointerId\");Qe&Xi&&(ft.button===0||is)?Ts<0&&(Lt.push(ft),Ts=Lt.length-1):Qe&(ki|ts)&&(Kt=!0),!(Ts<0)&&(Lt[Ts]=ft,this.callback(this.manager,Qe,{pointers:Lt,changedPointers:[ft],pointerType:ti,srcEvent:ft}),Kt&&Lt.splice(Ts,1))}});var tt={touchstart:Xi,touchmove:Jn,touchend:ki,touchcancel:ts},nt=\"touchstart\",ht=\"touchstart touchmove touchend touchcancel\";function vt(){this.evTarget=nt,this.evWin=ht,this.started=!1,mn.apply(this,arguments)}Y(vt,mn,{handler:function(ft){var Lt=tt[ft.type];if(Lt===Xi&&(this.started=!0),!!this.started){var Kt=xt.call(this,ft,Lt);Lt&(ki|ts)&&Kt[0].length-Kt[1].length===0&&(this.started=!1),this.callback(this.manager,Lt,{pointers:Kt[0],changedPointers:Kt[1],pointerType:Si,srcEvent:ft})}}});function xt(lt,ft){var Lt=De(lt.touches),Kt=De(lt.changedTouches);return ft&(ki|ts)&&(Lt=Ke(Lt.concat(Kt),\"identifier\",!0)),[Lt,Kt]}var _t={touchstart:Xi,touchmove:Jn,touchend:ki,touchcancel:ts},Dt=\"touchstart touchmove touchend touchcancel\";function Mt(){this.evTarget=Dt,this.targetIds={},mn.apply(this,arguments)}Y(Mt,mn,{handler:function(ft){var Lt=_t[ft.type],Kt=Vt.call(this,ft,Lt);Kt&&this.callback(this.manager,Lt,{pointers:Kt[0],changedPointers:Kt[1],pointerType:Si,srcEvent:ft})}});function Vt(lt,ft){var Lt=De(lt.touches),Kt=this.targetIds;if(ft&(Xi|Jn)&&Lt.length===1)return Kt[Lt[0].identifier]=!0,[Lt,Lt];var ge,Qe,ti=De(lt.changedTouches),is=[],Ts=this.target;if(Qe=Lt.filter(function(Vs){return Xt(Vs.target,Ts)}),ft===Xi)for(ge=0;ge-1&&Kt.splice(Qe,1)};setTimeout(ge,ie)}}function Xe(lt){for(var ft=lt.srcEvent.clientX,Lt=lt.srcEvent.clientY,Kt=0;Kt-1&&this.requireFail.splice(ft,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(lt){return!!this.simultaneous[lt.id]},emit:function(lt){var ft=this,Lt=this.state;function Kt(ge){ft.manager.emit(ge,lt)}Lt=ai&&Kt(ft.options.event+Vm(Lt))},tryEmit:function(lt){if(this.canEmit())return this.emit(lt);this.state=ln},canEmit:function(){for(var lt=0;ltft.threshold&&ge&ft.direction},attrTest:function(lt){return So.prototype.attrTest.call(this,lt)&&(this.state&Ss||!(this.state&Ss)&&this.directionTest(lt))},emit:function(lt){this.pX=lt.deltaX,this.pY=lt.deltaY;var ft=Go(lt.direction);ft&&(lt.additionalEvent=this.options.event+ft),this._super.emit.call(this,lt)}});function Ki(){So.apply(this,arguments)}Y(Ki,So,{defaults:{event:\"pinch\",threshold:0,pointers:2},getTouchAction:function(){return[Hr]},attrTest:function(lt){return this._super.attrTest.call(this,lt)&&(Math.abs(lt.scale-1)>this.options.threshold||this.state&Ss)},emit:function(lt){if(lt.scale!==1){var ft=lt.scale<1?\"in\":\"out\";lt.additionalEvent=this.options.event+ft}this._super.emit.call(this,lt)}});function _i(){Dn.apply(this,arguments),this._timer=null,this._input=null}Y(_i,Dn,{defaults:{event:\"press\",pointers:1,time:251,threshold:9},getTouchAction:function(){return[zi]},process:function(lt){var ft=this.options,Lt=lt.pointers.length===ft.pointers,Kt=lt.distanceft.time;if(this._input=lt,!Kt||!Lt||lt.eventType&(ki|ts)&&!ge)this.reset();else if(lt.eventType&Xi)this.reset(),this._timer=w(function(){this.state=ka,this.tryEmit()},ft.time,this);else if(lt.eventType&ki)return ka;return ln},reset:function(){clearTimeout(this._timer)},emit:function(lt){this.state===ka&&(lt&<.eventType&ki?this.manager.emit(this.options.event+\"up\",lt):(this._input.timeStamp=_(),this.manager.emit(this.options.event,this._input)))}});function Gl(){So.apply(this,arguments)}Y(Gl,So,{defaults:{event:\"rotate\",threshold:0,pointers:2},getTouchAction:function(){return[Hr]},attrTest:function(lt){return this._super.attrTest.call(this,lt)&&(Math.abs(lt.rotation)>this.options.threshold||this.state&Ss)}});function cn(){So.apply(this,arguments)}Y(cn,So,{defaults:{event:\"swipe\",threshold:10,velocity:.3,direction:as|ao,pointers:1},getTouchAction:function(){return jl.prototype.getTouchAction.call(this)},attrTest:function(lt){var ft=this.options.direction,Lt;return ft&(as|ao)?Lt=lt.overallVelocity:ft&as?Lt=lt.overallVelocityX:ft&ao&&(Lt=lt.overallVelocityY),this._super.attrTest.call(this,lt)&&ft<.offsetDirection&<.distance>this.options.threshold&<.maxPointers==this.options.pointers&&f(Lt)>this.options.velocity&<.eventType&ki},emit:function(lt){var ft=Go(lt.offsetDirection);ft&&this.manager.emit(this.options.event+ft,lt),this.manager.emit(this.options.event,lt)}});function pu(){Dn.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}Y(pu,Dn,{defaults:{event:\"tap\",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ni]},process:function(lt){var ft=this.options,Lt=lt.pointers.length===ft.pointers,Kt=lt.distance{\"use strict\";hB.exports=U3;hB.exports.default=U3;function U3(e,t,r){r=r||2;var i=t&&t.length,s=i?t[0]*r:e.length,n=Lq(e,0,s,r,!0),o=[];if(!n||n.next===n.prev)return o;var c,f,_,w,I,R,N;if(i&&(n=wpt(e,t,n,r)),e.length>80*r){c=_=e[0],f=w=e[1];for(var j=r;j_&&(_=I),R>w&&(w=R);N=Math.max(_-c,w-f),N=N!==0?32767/N:0}return X2(n,o,r,c,f,N,0),o}function Lq(e,t,r,i,s){var n,o;if(s===uB(e,t,r,i)>0)for(n=t;n=t;n-=i)o=Cq(n,e[n],e[n+1],o);return o&&V3(o,o.next)&&(J2(o),o=o.next),o}function jg(e,t){if(!e)return e;t||(t=e);var r=e,i;do if(i=!1,!r.steiner&&(V3(r,r.next)||_s(r.prev,r,r.next)===0)){if(J2(r),r=t=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==t);return t}function X2(e,t,r,i,s,n,o){if(e){!o&&n&&Ppt(e,i,s,n);for(var c=e,f,_;e.prev!==e.next;){if(f=e.prev,_=e.next,n?vpt(e,i,s,n):ypt(e)){t.push(f.i/r|0),t.push(e.i/r|0),t.push(_.i/r|0),J2(e),e=_.next,c=_.next;continue}if(e=_,e===c){o?o===1?(e=xpt(jg(e),t,r),X2(e,t,r,i,s,n,2)):o===2&&bpt(e,t,r,i,s,n):X2(jg(e),t,r,i,s,n,1);break}}}}function ypt(e){var t=e.prev,r=e,i=e.next;if(_s(t,r,i)>=0)return!1;for(var s=t.x,n=r.x,o=i.x,c=t.y,f=r.y,_=i.y,w=sn?s>o?s:o:n>o?n:o,N=c>f?c>_?c:_:f>_?f:_,j=i.next;j!==t;){if(j.x>=w&&j.x<=R&&j.y>=I&&j.y<=N&&Jv(s,c,n,f,o,_,j.x,j.y)&&_s(j.prev,j,j.next)>=0)return!1;j=j.next}return!0}function vpt(e,t,r,i){var s=e.prev,n=e,o=e.next;if(_s(s,n,o)>=0)return!1;for(var c=s.x,f=n.x,_=o.x,w=s.y,I=n.y,R=o.y,N=cf?c>_?c:_:f>_?f:_,et=w>I?w>R?w:R:I>R?I:R,Y=lB(N,j,t,r,i),K=lB(Q,et,t,r,i),J=e.prevZ,ut=e.nextZ;J&&J.z>=Y&&ut&&ut.z<=K;){if(J.x>=N&&J.x<=Q&&J.y>=j&&J.y<=et&&J!==s&&J!==o&&Jv(c,w,f,I,_,R,J.x,J.y)&&_s(J.prev,J,J.next)>=0||(J=J.prevZ,ut.x>=N&&ut.x<=Q&&ut.y>=j&&ut.y<=et&&ut!==s&&ut!==o&&Jv(c,w,f,I,_,R,ut.x,ut.y)&&_s(ut.prev,ut,ut.next)>=0))return!1;ut=ut.nextZ}for(;J&&J.z>=Y;){if(J.x>=N&&J.x<=Q&&J.y>=j&&J.y<=et&&J!==s&&J!==o&&Jv(c,w,f,I,_,R,J.x,J.y)&&_s(J.prev,J,J.next)>=0)return!1;J=J.prevZ}for(;ut&&ut.z<=K;){if(ut.x>=N&&ut.x<=Q&&ut.y>=j&&ut.y<=et&&ut!==s&&ut!==o&&Jv(c,w,f,I,_,R,ut.x,ut.y)&&_s(ut.prev,ut,ut.next)>=0)return!1;ut=ut.nextZ}return!0}function xpt(e,t,r){var i=e;do{var s=i.prev,n=i.next.next;!V3(s,n)&&kq(s,i,i.next,n)&&K2(s,n)&&K2(n,s)&&(t.push(s.i/r|0),t.push(i.i/r|0),t.push(n.i/r|0),J2(i),J2(i.next),i=e=n),i=i.next}while(i!==e);return jg(i)}function bpt(e,t,r,i,s,n){var o=e;do{for(var c=o.next.next;c!==o.prev;){if(o.i!==c.i&&Lpt(o,c)){var f=Rq(o,c);o=jg(o,o.next),f=jg(f,f.next),X2(o,t,r,i,s,n,0),X2(f,t,r,i,s,n,0);return}c=c.next}o=o.next}while(o!==e)}function wpt(e,t,r,i){var s=[],n,o,c,f,_;for(n=0,o=t.length;n=r.next.y&&r.next.y!==r.y){var c=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(c<=i&&c>n&&(n=c,o=r.x=r.x&&r.x>=_&&i!==r.x&&Jv(so.x||r.x===o.x&&Ept(o,r)))&&(o=r,I=R)),r=r.next;while(r!==f);return o}function Ept(e,t){return _s(e.prev,e,t.prev)<0&&_s(t.next,e,e.next)<0}function Ppt(e,t,r,i){var s=e;do s.z===0&&(s.z=lB(s.x,s.y,t,r,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,Ipt(s)}function Ipt(e){var t,r,i,s,n,o,c,f,_=1;do{for(r=e,e=null,n=null,o=0;r;){for(o++,i=r,c=0,t=0;t<_&&(c++,i=i.nextZ,!!i);t++);for(f=_;c>0||f>0&&i;)c!==0&&(f===0||!i||r.z<=i.z)?(s=r,r=r.nextZ,c--):(s=i,i=i.nextZ,f--),n?n.nextZ=s:e=s,s.prevZ=n,n=s;r=i}n.nextZ=null,_*=2}while(o>1);return e}function lB(e,t,r,i,s){return e=(e-r)*s|0,t=(t-i)*s|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Cpt(e){var t=e,r=e;do(t.x=(e-o)*(n-c)&&(e-o)*(i-c)>=(r-o)*(t-c)&&(r-o)*(n-c)>=(s-o)*(i-c)}function Lpt(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!kpt(e,t)&&(K2(e,t)&&K2(t,e)&&Rpt(e,t)&&(_s(e.prev,e,t.prev)||_s(e,t.prev,t))||V3(e,t)&&_s(e.prev,e,e.next)>0&&_s(t.prev,t,t.next)>0)}function _s(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function V3(e,t){return e.x===t.x&&e.y===t.y}function kq(e,t,r,i){var s=N3(_s(e,t,r)),n=N3(_s(e,t,i)),o=N3(_s(r,i,e)),c=N3(_s(r,i,t));return!!(s!==n&&o!==c||s===0&&z3(e,r,t)||n===0&&z3(e,i,t)||o===0&&z3(r,e,i)||c===0&&z3(r,t,i))}function z3(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function N3(e){return e>0?1:e<0?-1:0}function kpt(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&kq(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function K2(e,t){return _s(e.prev,e,e.next)<0?_s(e,t,e.next)>=0&&_s(e,e.prev,t)>=0:_s(e,t,e.prev)<0||_s(e,e.next,t)<0}function Rpt(e,t){var r=e,i=!1,s=(e.x+t.x)/2,n=(e.y+t.y)/2;do r.y>n!=r.next.y>n&&r.next.y!==r.y&&s<(r.next.x-r.x)*(n-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==e);return i}function Rq(e,t){var r=new cB(e.i,e.x,e.y),i=new cB(t.i,t.x,t.y),s=e.next,n=t.prev;return e.next=t,t.prev=e,r.next=s,s.prev=r,i.next=r,r.prev=i,n.next=i,i.prev=n,i}function Cq(e,t,r,i){var s=new cB(e,t,r);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function J2(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function cB(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}U3.deviation=function(e,t,r,i){var s=t&&t.length,n=s?t[0]*r:e.length,o=Math.abs(uB(e,0,n,r));if(s)for(var c=0,f=t.length;c0&&(i+=e[s-1].length,r.holes.push(i))}return r}});var nF=Br(Tx=>{\"use strict\";Object.defineProperty(Tx,\"__esModule\",{value:!0});Tx.DefaultSerializer=Tx.extendSerializer=void 0;function Hyt(e,t){let r=e.deserialize.bind(e),i=e.serialize.bind(e);return{deserialize(s){return t.deserialize(s,r)},serialize(s){return t.serialize(s,i)}}}Tx.extendSerializer=Hyt;var w$={deserialize(e){return Object.assign(Error(e.message),{name:e.name,stack:e.stack})},serialize(e){return{__error_marker:\"$$error\",message:e.message,name:e.name,stack:e.stack}}},qyt=e=>e&&typeof e==\"object\"&&\"__error_marker\"in e&&e.__error_marker===\"$$error\";Tx.DefaultSerializer={deserialize(e){return qyt(e)?w$.deserialize(e):e},serialize(e){return e instanceof Error?w$.serialize(e):e}}});var Mx=Br(km=>{\"use strict\";Object.defineProperty(km,\"__esModule\",{value:!0});km.serialize=km.deserialize=km.registerSerializer=void 0;var S$=nF(),zI=S$.DefaultSerializer;function Zyt(e){zI=S$.extendSerializer(zI,e)}km.registerSerializer=Zyt;function Yyt(e){return zI.deserialize(e)}km.deserialize=Yyt;function Qyt(e){return zI.serialize(e)}km.serialize=Qyt});var M$=Br(Ex=>{\"use strict\";Object.defineProperty(Ex,\"__esModule\",{value:!0});Ex.getBundleURL=Ex.getBaseURL=void 0;var sF;function $yt(){return sF||(sF=Xyt()),sF}Ex.getBundleURL=$yt;function Xyt(){try{throw new Error}catch(e){let t=(\"\"+e.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\\/\\/[^)\\n]+/g);if(t)return T$(t[0])}return\"/\"}function T$(e){return(\"\"+e).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\\/\\/.+)?\\/[^/]+(?:\\?.*)?$/,\"$1\")+\"/\"}Ex.getBaseURL=T$});var aF=Br(Rm=>{\"use strict\";Object.defineProperty(Rm,\"__esModule\",{value:!0});Rm.isWorkerRuntime=Rm.getWorkerImplementation=Rm.defaultPoolSize=void 0;var E$=M$();Rm.defaultPoolSize=typeof navigator<\"u\"&&navigator.hardwareConcurrency?navigator.hardwareConcurrency:4;var P$=e=>/^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(e);function I$(e){let t=new Blob([e],{type:\"application/javascript\"});return URL.createObjectURL(t)}function Kyt(){if(typeof Worker>\"u\")return class{constructor(){throw Error(\"No web worker implementation available. You might have tried to spawn a worker within a worker in a browser that doesn't support workers in workers.\")}};class e extends Worker{constructor(i,s){var n,o;typeof i==\"string\"&&s&&s._baseURL?i=new URL(i,s._baseURL):typeof i==\"string\"&&!P$(i)&&E$.getBundleURL().match(/^file:\\/\\//i)&&(i=new URL(i,E$.getBundleURL().replace(/\\/[^\\/]+$/,\"/\")),(!((n=s?.CORSWorkaround)!==null&&n!==void 0)||n)&&(i=I$(`importScripts(${JSON.stringify(i)});`))),typeof i==\"string\"&&P$(i)&&(!((o=s?.CORSWorkaround)!==null&&o!==void 0)||o)&&(i=I$(`importScripts(${JSON.stringify(i)});`)),super(i,s)}}class t extends e{constructor(i,s){let n=window.URL.createObjectURL(i);super(n,s)}static fromText(i,s){let n=new window.Blob([i],{type:\"text/javascript\"});return new t(n,s)}}return{blob:t,default:e}}var oF;function Jyt(){return oF||(oF=Kyt()),oF}Rm.getWorkerImplementation=Jyt;function tvt(){let e=typeof self<\"u\"&&typeof Window<\"u\"&&self instanceof Window;return!!(typeof self<\"u\"&&self.postMessage&&!e)}Rm.isWorkerRuntime=tvt});var L$=Br((Vle,C$)=>{var Px=1e3,Ix=Px*60,Cx=Ix*60,r_=Cx*24,evt=r_*7,rvt=r_*365.25;C$.exports=function(e,t){t=t||{};var r=typeof e;if(r===\"string\"&&e.length>0)return ivt(e);if(r===\"number\"&&isFinite(e))return t.long?svt(e):nvt(e);throw new Error(\"val is not a non-empty string or a valid number. val=\"+JSON.stringify(e))};function ivt(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),i=(t[2]||\"ms\").toLowerCase();switch(i){case\"years\":case\"year\":case\"yrs\":case\"yr\":case\"y\":return r*rvt;case\"weeks\":case\"week\":case\"w\":return r*evt;case\"days\":case\"day\":case\"d\":return r*r_;case\"hours\":case\"hour\":case\"hrs\":case\"hr\":case\"h\":return r*Cx;case\"minutes\":case\"minute\":case\"mins\":case\"min\":case\"m\":return r*Ix;case\"seconds\":case\"second\":case\"secs\":case\"sec\":case\"s\":return r*Px;case\"milliseconds\":case\"millisecond\":case\"msecs\":case\"msec\":case\"ms\":return r;default:return}}}}function nvt(e){var t=Math.abs(e);return t>=r_?Math.round(e/r_)+\"d\":t>=Cx?Math.round(e/Cx)+\"h\":t>=Ix?Math.round(e/Ix)+\"m\":t>=Px?Math.round(e/Px)+\"s\":e+\"ms\"}function svt(e){var t=Math.abs(e);return t>=r_?NI(e,t,r_,\"day\"):t>=Cx?NI(e,t,Cx,\"hour\"):t>=Ix?NI(e,t,Ix,\"minute\"):t>=Px?NI(e,t,Px,\"second\"):e+\" ms\"}function NI(e,t,r,i){var s=t>=r*1.5;return Math.round(e/r)+\" \"+i+(s?\"s\":\"\")}});var R$=Br((jle,k$)=>{function ovt(e){r.debug=r,r.default=r,r.coerce=f,r.disable=n,r.enable=s,r.enabled=o,r.humanize=L$(),r.destroy=_,Object.keys(e).forEach(w=>{r[w]=e[w]}),r.names=[],r.skips=[],r.formatters={};function t(w){let I=0;for(let R=0;R{if(kt===\"%%\")return\"%\";ut++;let qt=r.formatters[Xt];if(typeof qt==\"function\"){let le=et[ut];kt=qt.call(Y,le),et.splice(ut,1),ut--}return kt}),r.formatArgs.call(Y,et),(Y.log||r.log).apply(Y,et)}return Q.namespace=w,Q.useColors=r.useColors(),Q.color=r.selectColor(w),Q.extend=i,Q.destroy=r.destroy,Object.defineProperty(Q,\"enabled\",{enumerable:!0,configurable:!1,get:()=>R!==null?R:(N!==r.namespaces&&(N=r.namespaces,j=r.enabled(w)),j),set:et=>{R=et}}),typeof r.init==\"function\"&&r.init(Q),Q}function i(w,I){let R=r(this.namespace+(typeof I>\"u\"?\":\":I)+w);return R.log=this.log,R}function s(w){r.save(w),r.namespaces=w,r.names=[],r.skips=[];let I,R=(typeof w==\"string\"?w:\"\").split(/[\\s,]+/),N=R.length;for(I=0;I\"-\"+I)].join(\",\");return r.enable(\"\"),w}function o(w){if(w[w.length-1]===\"*\")return!0;let I,R;for(I=0,R=r.skips.length;I{hu.formatArgs=lvt;hu.save=cvt;hu.load=uvt;hu.useColors=avt;hu.storage=hvt();hu.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn(\"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.\"))}})();hu.colors=[\"#0000CC\",\"#0000FF\",\"#0033CC\",\"#0033FF\",\"#0066CC\",\"#0066FF\",\"#0099CC\",\"#0099FF\",\"#00CC00\",\"#00CC33\",\"#00CC66\",\"#00CC99\",\"#00CCCC\",\"#00CCFF\",\"#3300CC\",\"#3300FF\",\"#3333CC\",\"#3333FF\",\"#3366CC\",\"#3366FF\",\"#3399CC\",\"#3399FF\",\"#33CC00\",\"#33CC33\",\"#33CC66\",\"#33CC99\",\"#33CCCC\",\"#33CCFF\",\"#6600CC\",\"#6600FF\",\"#6633CC\",\"#6633FF\",\"#66CC00\",\"#66CC33\",\"#9900CC\",\"#9900FF\",\"#9933CC\",\"#9933FF\",\"#99CC00\",\"#99CC33\",\"#CC0000\",\"#CC0033\",\"#CC0066\",\"#CC0099\",\"#CC00CC\",\"#CC00FF\",\"#CC3300\",\"#CC3333\",\"#CC3366\",\"#CC3399\",\"#CC33CC\",\"#CC33FF\",\"#CC6600\",\"#CC6633\",\"#CC9900\",\"#CC9933\",\"#CCCC00\",\"#CCCC33\",\"#FF0000\",\"#FF0033\",\"#FF0066\",\"#FF0099\",\"#FF00CC\",\"#FF00FF\",\"#FF3300\",\"#FF3333\",\"#FF3366\",\"#FF3399\",\"#FF33CC\",\"#FF33FF\",\"#FF6600\",\"#FF6633\",\"#FF9900\",\"#FF9933\",\"#FFCC00\",\"#FFCC33\"];function avt(){return typeof window<\"u\"&&window.process&&(window.process.type===\"renderer\"||window.process.__nwjs)?!0:typeof navigator<\"u\"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)?!1:typeof document<\"u\"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<\"u\"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<\"u\"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<\"u\"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/)}function lvt(e){if(e[0]=(this.useColors?\"%c\":\"\")+this.namespace+(this.useColors?\" %c\":\" \")+e[0]+(this.useColors?\"%c \":\" \")+\"+\"+UI.exports.humanize(this.diff),!this.useColors)return;let t=\"color: \"+this.color;e.splice(1,0,t,\"color: inherit\");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!==\"%%\"&&(r++,s===\"%c\"&&(i=r))}),e.splice(i,0,t)}hu.log=console.debug||console.log||(()=>{});function cvt(e){try{e?hu.storage.setItem(\"debug\",e):hu.storage.removeItem(\"debug\")}catch{}}function uvt(){let e;try{e=hu.storage.getItem(\"debug\")}catch{}return!e&&typeof process<\"u\"&&\"env\"in process&&(e=process.env.DEBUG),e}function hvt(){try{return localStorage}catch{}}UI.exports=R$()(hu);var{formatters:fvt}=UI.exports;fvt.j=function(e){try{return JSON.stringify(e)}catch(t){return\"[UnexpectedJSONParseError]: \"+t.message}}});var kS=Br(Lx=>{\"use strict\";var dvt=Lx&&Lx.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})};Object.defineProperty(Lx,\"__esModule\",{value:!0});Lx.AsyncSerialScheduler=void 0;var lF=class{constructor(t){this._baseObserver=t,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then(()=>this._baseObserver.complete()).catch(t=>this._baseObserver.error(t))}error(t){this._baseObserver.error(t)}schedule(t){let r=Promise.all(this._pendingPromises),i=[],s=o=>i.push(o),n=Promise.resolve().then(()=>dvt(this,void 0,void 0,function*(){yield r,yield t(s),this._pendingPromises.delete(n);for(let o of i)this._baseObserver.next(o)})).catch(o=>{this._pendingPromises.delete(n),this._baseObserver.error(o)});this._pendingPromises.add(n)}};Lx.AsyncSerialScheduler=lF});var O$=Br(D$=>{\"use strict\";Object.defineProperty(D$,\"__esModule\",{value:!0})});var cF=Br(Bl=>{\"use strict\";Object.defineProperty(Bl,\"__esModule\",{value:!0});Bl.registerObservableSymbol=Bl.getSymbol=Bl.hasSymbol=Bl.hasSymbols=void 0;var pvt=()=>typeof Symbol==\"function\";Bl.hasSymbols=pvt;var Avt=e=>Bl.hasSymbols()&&!!Symbol[e];Bl.hasSymbol=Avt;var mvt=e=>Bl.hasSymbol(e)?Symbol[e]:\"@@\"+e;Bl.getSymbol=mvt;function gvt(){Bl.hasSymbols()&&!Bl.hasSymbol(\"observable\")&&(Symbol.observable=Symbol(\"observable\"))}Bl.registerObservableSymbol=gvt;Bl.hasSymbol(\"asyncIterator\")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for(\"Symbol.asyncIterator\"))});var gd=Br(Vp=>{\"use strict\";Object.defineProperty(Vp,\"__esModule\",{value:!0});Vp.Observable=Vp.SubscriptionObserver=Vp.Subscription=void 0;O$();var DS=cF(),_vt=DS.getSymbol(\"iterator\"),hF=DS.getSymbol(\"observable\"),B$=DS.getSymbol(\"species\");function GI(e,t){let r=e[t];if(r!=null){if(typeof r!=\"function\")throw new TypeError(r+\" is not a function\");return r}}function RS(e){let t=e.constructor;return t!==void 0&&(t=t[B$],t===null&&(t=void 0)),t!==void 0?t:i_}function yvt(e){return e instanceof i_}function kx(e){kx.log?kx.log(e):setTimeout(()=>{throw e},0)}function jI(e){Promise.resolve().then(()=>{try{e()}catch(t){kx(t)}})}function F$(e){let t=e._cleanup;if(t!==void 0&&(e._cleanup=void 0,!!t))try{if(typeof t==\"function\")t();else{let r=GI(t,\"unsubscribe\");r&&r.call(t)}}catch(r){kx(r)}}function fF(e){e._observer=void 0,e._queue=void 0,e._state=\"closed\"}function vvt(e){let t=e._queue;if(t){e._queue=void 0,e._state=\"ready\";for(let r of t)if(z$(e,r.type,r.value),e._state===\"closed\")break}}function z$(e,t,r){e._state=\"running\";let i=e._observer;try{let s=i?GI(i,t):void 0;switch(t){case\"next\":s&&s.call(i,r);break;case\"error\":if(fF(e),s)s.call(i,r);else throw r;break;case\"complete\":fF(e),s&&s.call(i);break}}catch(s){kx(s)}e._state===\"closed\"?F$(e):e._state===\"running\"&&(e._state=\"ready\")}function uF(e,t,r){if(e._state!==\"closed\"){if(e._state===\"buffering\"){e._queue=e._queue||[],e._queue.push({type:t,value:r});return}if(e._state!==\"ready\"){e._state=\"buffering\",e._queue=[{type:t,value:r}],jI(()=>vvt(e));return}z$(e,t,r)}}var WI=class{constructor(t,r){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state=\"initializing\";let i=new HI(this);try{this._cleanup=r.call(void 0,i)}catch(s){i.error(s)}this._state===\"initializing\"&&(this._state=\"ready\")}get closed(){return this._state===\"closed\"}unsubscribe(){this._state!==\"closed\"&&(fF(this),F$(this))}};Vp.Subscription=WI;var HI=class{constructor(t){this._subscription=t}get closed(){return this._subscription._state===\"closed\"}next(t){uF(this._subscription,\"next\",t)}error(t){uF(this._subscription,\"error\",t)}complete(){uF(this._subscription,\"complete\")}};Vp.SubscriptionObserver=HI;var i_=class e{constructor(t){if(!(this instanceof e))throw new TypeError(\"Observable cannot be called as a function\");if(typeof t!=\"function\")throw new TypeError(\"Observable initializer must be a function\");this._subscriber=t}subscribe(t,r,i){return(typeof t!=\"object\"||t===null)&&(t={next:t,error:r,complete:i}),new WI(t,this._subscriber)}pipe(t,...r){let i=this;for(let s of[t,...r])i=s(i);return i}tap(t,r,i){let s=typeof t!=\"object\"||t===null?{next:t,error:r,complete:i}:t;return new e(n=>this.subscribe({next(o){s.next&&s.next(o),n.next(o)},error(o){s.error&&s.error(o),n.error(o)},complete(){s.complete&&s.complete(),n.complete()},start(o){s.start&&s.start(o)}}))}forEach(t){return new Promise((r,i)=>{if(typeof t!=\"function\"){i(new TypeError(t+\" is not a function\"));return}function s(){n.unsubscribe(),r(void 0)}let n=this.subscribe({next(o){try{t(o,s)}catch(c){i(c),n.unsubscribe()}},error(o){i(o)},complete(){r(void 0)}})})}map(t){if(typeof t!=\"function\")throw new TypeError(t+\" is not a function\");let r=RS(this);return new r(i=>this.subscribe({next(s){let n=s;try{n=t(s)}catch(o){return i.error(o)}i.next(n)},error(s){i.error(s)},complete(){i.complete()}}))}filter(t){if(typeof t!=\"function\")throw new TypeError(t+\" is not a function\");let r=RS(this);return new r(i=>this.subscribe({next(s){try{if(!t(s))return}catch(n){return i.error(n)}i.next(s)},error(s){i.error(s)},complete(){i.complete()}}))}reduce(t,r){if(typeof t!=\"function\")throw new TypeError(t+\" is not a function\");let i=RS(this),s=arguments.length>1,n=!1,o=r;return new i(c=>this.subscribe({next(f){let _=!n;if(n=!0,!_||s)try{o=t(o,f)}catch(w){return c.error(w)}else o=f},error(f){c.error(f)},complete(){if(!n&&!s)return c.error(new TypeError(\"Cannot reduce an empty sequence\"));c.next(o),c.complete()}}))}concat(...t){let r=RS(this);return new r(i=>{let s,n=0;function o(c){s=c.subscribe({next(f){i.next(f)},error(f){i.error(f)},complete(){n===t.length?(s=void 0,i.complete()):o(r.from(t[n++]))}})}return o(this),()=>{s&&(s.unsubscribe(),s=void 0)}})}flatMap(t){if(typeof t!=\"function\")throw new TypeError(t+\" is not a function\");let r=RS(this);return new r(i=>{let s=[],n=this.subscribe({next(c){let f;if(t)try{f=t(c)}catch(w){return i.error(w)}else f=c;let _=r.from(f).subscribe({next(w){i.next(w)},error(w){i.error(w)},complete(){let w=s.indexOf(_);w>=0&&s.splice(w,1),o()}});s.push(_)},error(c){i.error(c)},complete(){o()}});function o(){n.closed&&s.length===0&&i.complete()}return()=>{s.forEach(c=>c.unsubscribe()),n.unsubscribe()}})}[(Symbol.observable,hF)](){return this}static from(t){let r=typeof this==\"function\"?this:e;if(t==null)throw new TypeError(t+\" is not an object\");let i=GI(t,hF);if(i){let s=i.call(t);if(Object(s)!==s)throw new TypeError(s+\" is not an object\");return yvt(s)&&s.constructor===r?s:new r(n=>s.subscribe(n))}if(DS.hasSymbol(\"iterator\")){let s=GI(t,_vt);if(s)return new r(n=>{jI(()=>{if(!n.closed){for(let o of s.call(t))if(n.next(o),n.closed)return;n.complete()}})})}if(Array.isArray(t))return new r(s=>{jI(()=>{if(!s.closed){for(let n of t)if(s.next(n),s.closed)return;s.complete()}})});throw new TypeError(t+\" is not observable\")}static of(...t){let r=typeof this==\"function\"?this:e;return new r(i=>{jI(()=>{if(!i.closed){for(let s of t)if(i.next(s),i.closed)return;i.complete()}})})}static get[B$](){return this}};Vp.Observable=i_;DS.hasSymbols()&&Object.defineProperty(i_,Symbol(\"extensions\"),{value:{symbol:hF,hostReportError:kx},configurable:!0});Vp.default=i_});var Dm=Br(dF=>{\"use strict\";Object.defineProperty(dF,\"__esModule\",{value:!0});function xvt(e){typeof e==\"function\"?e():e&&typeof e.unsubscribe==\"function\"&&e.unsubscribe()}dF.default=xvt});var N$=Br(OS=>{\"use strict\";var bvt=OS&&OS.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})};Object.defineProperty(OS,\"__esModule\",{value:!0});var wvt=kS(),Svt=gd(),Tvt=Dm();function Mvt(e){return t=>new Svt.default(r=>{let i=new wvt.AsyncSerialScheduler(r),s=t.subscribe({complete(){i.complete()},error(n){i.error(n)},next(n){i.schedule(o=>bvt(this,void 0,void 0,function*(){(yield e(n))&&o(n)}))}});return()=>Tvt.default(s)})}OS.default=Mvt});var V$=Br(Rx=>{\"use strict\";Object.defineProperty(Rx,\"__esModule\",{value:!0});Rx.isIterator=Rx.isAsyncIterator=void 0;var U$=cF();function Evt(e){return e&&U$.hasSymbol(\"asyncIterator\")&&e[Symbol.asyncIterator]}Rx.isAsyncIterator=Evt;function Pvt(e){return e&&U$.hasSymbol(\"iterator\")&&e[Symbol.iterator]}Rx.isIterator=Pvt});var G$=Br(n_=>{\"use strict\";var Ivt=n_&&n_.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})},Cvt=n_&&n_.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError(\"Symbol.asyncIterator is not defined.\");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof __values==\"function\"?__values(e):e[Symbol.iterator](),r={},i(\"next\"),i(\"throw\"),i(\"return\"),r[Symbol.asyncIterator]=function(){return this},r);function i(n){r[n]=e[n]&&function(o){return new Promise(function(c,f){o=e[n](o),s(c,f,o.done,o.value)})}}function s(n,o,c,f){Promise.resolve(f).then(function(_){n({value:_,done:c})},o)}};Object.defineProperty(n_,\"__esModule\",{value:!0});var Lvt=kS(),j$=V$(),kvt=gd(),Rvt=Dm();function Dvt(e){return t=>new kvt.default(r=>{let i=new Lvt.AsyncSerialScheduler(r),s=t.subscribe({complete(){i.complete()},error(n){i.error(n)},next(n){i.schedule(o=>Ivt(this,void 0,void 0,function*(){var c,f;let _=yield e(n);if(j$.isIterator(_)||j$.isAsyncIterator(_))try{for(var w=Cvt(_),I;I=yield w.next(),!I.done;){let R=I.value;o(R)}}catch(R){c={error:R}}finally{try{I&&!I.done&&(f=w.return)&&(yield f.call(w))}finally{if(c)throw c.error}}else _.map(R=>o(R))}))}});return()=>Rvt.default(s)})}n_.default=Dvt});var W$=Br(pF=>{\"use strict\";Object.defineProperty(pF,\"__esModule\",{value:!0});var Ovt=gd();function Bvt(e){return new Ovt.Observable(t=>{let r=0,i=setInterval(()=>{t.next(r++)},e);return()=>clearInterval(i)})}pF.default=Bvt});var H$=Br(BS=>{\"use strict\";var Fvt=BS&&BS.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})};Object.defineProperty(BS,\"__esModule\",{value:!0});var zvt=kS(),Nvt=gd(),Uvt=Dm();function Vvt(e){return t=>new Nvt.default(r=>{let i=new zvt.AsyncSerialScheduler(r),s=t.subscribe({complete(){i.complete()},error(n){i.error(n)},next(n){i.schedule(o=>Fvt(this,void 0,void 0,function*(){let c=yield e(n);o(c)}))}});return()=>Uvt.default(s)})}BS.default=Vvt});var Z$=Br(AF=>{\"use strict\";Object.defineProperty(AF,\"__esModule\",{value:!0});var q$=gd(),jvt=Dm();function Gvt(...e){return e.length===0?q$.Observable.from([]):new q$.Observable(t=>{let r=0,i=e.map(n=>n.subscribe({error(o){t.error(o),s()},next(o){t.next(o)},complete(){++r===e.length&&(t.complete(),s())}})),s=()=>{i.forEach(n=>jvt.default(n))};return s})}AF.default=Gvt});var _F=Br(gF=>{\"use strict\";Object.defineProperty(gF,\"__esModule\",{value:!0});var Wvt=gd(),mF=class extends Wvt.default{constructor(){super(t=>(this._observers.add(t),()=>this._observers.delete(t))),this._observers=new Set}next(t){for(let r of this._observers)r.next(t)}error(t){for(let r of this._observers)r.error(t)}complete(){for(let t of this._observers)t.complete()}};gF.default=mF});var Y$=Br(yF=>{\"use strict\";Object.defineProperty(yF,\"__esModule\",{value:!0});var Hvt=gd(),qvt=_F(),Zvt=Dm();function Yvt(e){let t=new qvt.default,r,i=0;return new Hvt.default(s=>{r||(r=e.subscribe(t));let n=t.subscribe(s);return i++,()=>{i--,n.unsubscribe(),i===0&&(Zvt.default(r),r=void 0)}})}yF.default=Yvt});var Q$=Br(FS=>{\"use strict\";var Qvt=FS&&FS.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})};Object.defineProperty(FS,\"__esModule\",{value:!0});var $vt=kS(),Xvt=gd(),Kvt=Dm();function Jvt(e,t){return r=>new Xvt.default(i=>{let s,n=0,o=new $vt.AsyncSerialScheduler(i),c=r.subscribe({complete(){o.complete()},error(f){o.error(f)},next(f){o.schedule(_=>Qvt(this,void 0,void 0,function*(){s=yield e(n===0?typeof t>\"u\"?f:t:s,f,n++),_(s)}))}});return()=>Kvt.default(c)})}FS.default=Jvt});var $$=Br(zs=>{\"use strict\";Object.defineProperty(zs,\"__esModule\",{value:!0});zs.unsubscribe=zs.Subject=zs.scan=zs.Observable=zs.multicast=zs.merge=zs.map=zs.interval=zs.flatMap=zs.filter=void 0;var txt=N$();Object.defineProperty(zs,\"filter\",{enumerable:!0,get:function(){return txt.default}});var ext=G$();Object.defineProperty(zs,\"flatMap\",{enumerable:!0,get:function(){return ext.default}});var rxt=W$();Object.defineProperty(zs,\"interval\",{enumerable:!0,get:function(){return rxt.default}});var ixt=H$();Object.defineProperty(zs,\"map\",{enumerable:!0,get:function(){return ixt.default}});var nxt=Z$();Object.defineProperty(zs,\"merge\",{enumerable:!0,get:function(){return nxt.default}});var sxt=Y$();Object.defineProperty(zs,\"multicast\",{enumerable:!0,get:function(){return sxt.default}});var oxt=gd();Object.defineProperty(zs,\"Observable\",{enumerable:!0,get:function(){return oxt.default}});var axt=Q$();Object.defineProperty(zs,\"scan\",{enumerable:!0,get:function(){return axt.default}});var lxt=_F();Object.defineProperty(zs,\"Subject\",{enumerable:!0,get:function(){return lxt.default}});var cxt=Dm();Object.defineProperty(zs,\"unsubscribe\",{enumerable:!0,get:function(){return cxt.default}})});var zS=Br((nce,X$)=>{X$.exports=$$()});var K$=Br(qI=>{\"use strict\";Object.defineProperty(qI,\"__esModule\",{value:!0});qI.allSettled=void 0;function uxt(e){return Promise.all(e.map(t=>{let r=n=>({status:\"fulfilled\",value:n}),i=n=>({status:\"rejected\",reason:n}),s=Promise.resolve(t);try{return s.then(r,i)}catch(n){return Promise.reject(n)}}))}qI.allSettled=uxt});var J$=Br(NS=>{\"use strict\";Object.defineProperty(NS,\"__esModule\",{value:!0});NS.PoolEventType=void 0;var hxt;(function(e){e.initialized=\"initialized\",e.taskCanceled=\"taskCanceled\",e.taskCompleted=\"taskCompleted\",e.taskFailed=\"taskFailed\",e.taskQueued=\"taskQueued\",e.taskQueueDrained=\"taskQueueDrained\",e.taskStart=\"taskStart\",e.terminated=\"terminated\"})(hxt=NS.PoolEventType||(NS.PoolEventType={}))});var US=Br(eh=>{\"use strict\";Object.defineProperty(eh,\"__esModule\",{value:!0});eh.$worker=eh.$transferable=eh.$terminate=eh.$events=eh.$errors=void 0;eh.$errors=Symbol(\"thread.errors\");eh.$events=Symbol(\"thread.events\");eh.$terminate=Symbol(\"thread.terminate\");eh.$transferable=Symbol(\"thread.transferable\");eh.$worker=Symbol(\"thread.worker\")});var xF=Br(ZI=>{\"use strict\";Object.defineProperty(ZI,\"__esModule\",{value:!0});ZI.Thread=void 0;var vF=US();function tX(e){throw Error(e)}ZI.Thread={errors(e){return e[vF.$errors]||tX(\"Error observable not found. Make sure to pass a thread instance as returned by the spawn() promise.\")},events(e){return e[vF.$events]||tX(\"Events observable not found. Make sure to pass a thread instance as returned by the spawn() promise.\")},terminate(e){return e[vF.$terminate]()}}});var nX=Br(rh=>{\"use strict\";var s_=rh&&rh.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})},fxt=rh&&rh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(rh,\"__esModule\",{value:!0});rh.Pool=rh.Thread=rh.PoolEventType=void 0;var dxt=fxt(VI()),bF=zS(),eX=K$(),pxt=aF(),ia=J$();Object.defineProperty(rh,\"PoolEventType\",{enumerable:!0,get:function(){return ia.PoolEventType}});var rX=xF();Object.defineProperty(rh,\"Thread\",{enumerable:!0,get:function(){return rX.Thread}});var Axt=1;function mxt(e){let t=[];for(let r=0;rsetTimeout(t,e))}function _xt(e,t){return e.reduce((r,i)=>[...r,...t(i)],[])}function yxt(e){return e.replace(/\\W/g,\" \").trim().replace(/\\s+/g,\"-\")}function vxt(e,t){return mxt(t).map(()=>({init:e(),runningTasks:[]}))}var YI=class{constructor(t,r){this.eventSubject=new bF.Subject,this.initErrors=[],this.isClosing=!1,this.nextTaskID=1,this.taskQueue=[];let i=typeof r==\"number\"?{size:r}:r||{},{size:s=pxt.defaultPoolSize}=i;this.debug=dxt.default(`threads:pool:${yxt(i.name||String(Axt++))}`),this.options=i,this.workers=vxt(t,s),this.eventObservable=bF.multicast(bF.Observable.from(this.eventSubject)),Promise.all(this.workers.map(n=>n.init)).then(()=>this.eventSubject.next({type:ia.PoolEventType.initialized,size:this.workers.length}),n=>{this.debug(\"Error while initializing pool worker:\",n),this.eventSubject.error(n),this.initErrors.push(n)})}findIdlingWorker(){let{concurrency:t=1}=this.options;return this.workers.find(r=>r.runningTasks.length{t.runningTasks=t.runningTasks.filter(n=>n!==i)};yield gxt(0);try{yield this.runPoolTask(t,r)}finally{s(),this.isClosing||this.scheduleWork()}});t.runningTasks.push(i)})}scheduleWork(){this.debug(\"Attempt de-queueing a task in order to run it...\");let t=this.findIdlingWorker();if(!t)return;let r=this.taskQueue.shift();if(!r){this.debug(\"Task queue is empty\"),this.eventSubject.next({type:ia.PoolEventType.taskQueueDrained});return}this.run(t,r)}taskCompletion(t){return new Promise((r,i)=>{let s=this.events().subscribe(n=>{n.type===ia.PoolEventType.taskCompleted&&n.taskID===t?(s.unsubscribe(),r(n.returnValue)):n.type===ia.PoolEventType.taskFailed&&n.taskID===t?(s.unsubscribe(),i(n.error)):n.type===ia.PoolEventType.terminated&&(s.unsubscribe(),i(Error(\"Pool has been terminated before task was run.\")))})})}settled(t=!1){return s_(this,void 0,void 0,function*(){let r=()=>_xt(this.workers,n=>n.runningTasks),i=[],s=this.eventObservable.subscribe(n=>{n.type===ia.PoolEventType.taskFailed&&i.push(n.error)});return this.initErrors.length>0?Promise.reject(this.initErrors[0]):t&&this.taskQueue.length===0?(yield eX.allSettled(r()),i):(yield new Promise((n,o)=>{let c=this.eventObservable.subscribe({next(f){f.type===ia.PoolEventType.taskQueueDrained&&(c.unsubscribe(),n(void 0))},error:o})}),yield eX.allSettled(r()),s.unsubscribe(),i)})}completed(t=!1){return s_(this,void 0,void 0,function*(){let r=this.settled(t),i=new Promise((n,o)=>{let c=this.eventObservable.subscribe({next(f){f.type===ia.PoolEventType.taskQueueDrained?(c.unsubscribe(),n(r)):f.type===ia.PoolEventType.taskFailed&&(c.unsubscribe(),o(f.error))},error:o})}),s=yield Promise.race([r,i]);if(s.length>0)throw s[0]})}events(){return this.eventObservable}queue(t){let{maxQueuedJobs:r=1/0}=this.options;if(this.isClosing)throw Error(\"Cannot schedule pool tasks after terminate() has been called.\");if(this.initErrors.length>0)throw this.initErrors[0];let i=this.nextTaskID++,s=this.taskCompletion(i);s.catch(o=>{this.debug(`Task #${i} errored:`,o)});let n={id:i,run:t,cancel:()=>{this.taskQueue.indexOf(n)!==-1&&(this.taskQueue=this.taskQueue.filter(o=>o!==n),this.eventSubject.next({type:ia.PoolEventType.taskCanceled,taskID:n.id}))},then:s.then.bind(s)};if(this.taskQueue.length>=r)throw Error(`Maximum number of pool tasks queued. Refusing to queue another one.\nThis usually happens for one of two reasons: We are either at peak workload right now or some tasks just won't finish, thus blocking the pool.`);return this.debug(`Queueing task #${n.id}...`),this.taskQueue.push(n),this.eventSubject.next({type:ia.PoolEventType.taskQueued,taskID:n.id}),this.scheduleWork(),n}terminate(t){return s_(this,void 0,void 0,function*(){this.isClosing=!0,t||(yield this.completed(!0)),this.eventSubject.next({type:ia.PoolEventType.terminated,remainingQueue:[...this.taskQueue]}),this.eventSubject.complete(),yield Promise.all(this.workers.map(r=>s_(this,void 0,void 0,function*(){return rX.Thread.terminate(yield r.init)})))})}};YI.EventType=ia.PoolEventType;function iX(e,t){return new YI(e,t)}iX.EventType=ia.PoolEventType;rh.Pool=iX});var sX=Br(QI=>{\"use strict\";Object.defineProperty(QI,\"__esModule\",{value:!0});QI.createPromiseWithResolver=void 0;var xxt=()=>{};function bxt(){let e=!1,t,r=xxt;return[new Promise(n=>{e?n(t):r=n}),n=>{e=!0,t=n,r(t)}]}QI.createPromiseWithResolver=bxt});var oX=Br(VS=>{\"use strict\";Object.defineProperty(VS,\"__esModule\",{value:!0});VS.WorkerEventType=void 0;var hce=US(),wxt;(function(e){e.internalError=\"internalError\",e.message=\"message\",e.termination=\"termination\"})(wxt=VS.WorkerEventType||(VS.WorkerEventType={}))});var lX=Br($I=>{\"use strict\";Object.defineProperty($I,\"__esModule\",{value:!0});$I.ObservablePromise=void 0;var Sxt=zS(),Txt=()=>{},Mxt=e=>e,aX=e=>Promise.resolve().then(e);function Ext(e){throw e}function Pxt(e){return e&&typeof e.then==\"function\"}var wF=class e extends Sxt.Observable{constructor(t){super(r=>{let i=this,s=Object.assign(Object.assign({},r),{complete(){r.complete(),i.onCompletion()},error(n){r.error(n),i.onError(n)},next(n){r.next(n),i.onNext(n)}});try{return this.initHasRun=!0,t(s)}catch(n){s.error(n)}}),this.initHasRun=!1,this.fulfillmentCallbacks=[],this.rejectionCallbacks=[],this.firstValueSet=!1,this.state=\"pending\"}onNext(t){this.firstValueSet||(this.firstValue=t,this.firstValueSet=!0)}onError(t){this.state=\"rejected\",this.rejection=t;for(let r of this.rejectionCallbacks)aX(()=>r(t))}onCompletion(){this.state=\"fulfilled\";for(let t of this.fulfillmentCallbacks)aX(()=>t(this.firstValue))}then(t,r){let i=t||Mxt,s=r||Ext,n=!1;return new Promise((o,c)=>{let f=w=>{if(!n){n=!0;try{o(s(w))}catch(I){c(I)}}},_=w=>{try{o(i(w))}catch(I){f(I)}};if(this.initHasRun||this.subscribe({error:f}),this.state===\"fulfilled\")return o(i(this.firstValue));if(this.state===\"rejected\")return n=!0,o(s(this.rejection));this.fulfillmentCallbacks.push(_),this.rejectionCallbacks.push(f)})}catch(t){return this.then(void 0,t)}finally(t){let r=t||Txt;return this.then(i=>(r(),i),()=>r())}static from(t){return Pxt(t)?new e(r=>{let i=n=>{r.next(n),r.complete()},s=n=>{r.error(n)};t.then(i,s)}):super.from(t)}};$I.ObservablePromise=wF});var jS=Br(Dx=>{\"use strict\";Object.defineProperty(Dx,\"__esModule\",{value:!0});Dx.Transfer=Dx.isTransferDescriptor=void 0;var cX=US();function Ixt(e){return!(!e||typeof e!=\"object\")}function Cxt(e){return e&&typeof e==\"object\"&&e[cX.$transferable]}Dx.isTransferDescriptor=Cxt;function Lxt(e,t){if(!t){if(!Ixt(e))throw Error();t=[e]}return{[cX.$transferable]:!0,send:e,transferables:t}}Dx.Transfer=Lxt});var SF=Br(Om=>{\"use strict\";Object.defineProperty(Om,\"__esModule\",{value:!0});Om.WorkerMessageType=Om.MasterMessageType=void 0;var kxt;(function(e){e.cancel=\"cancel\",e.run=\"run\"})(kxt=Om.MasterMessageType||(Om.MasterMessageType={}));var Rxt;(function(e){e.error=\"error\",e.init=\"init\",e.result=\"result\",e.running=\"running\",e.uncaughtError=\"uncaughtError\"})(Rxt=Om.WorkerMessageType||(Om.WorkerMessageType={}))});var pX=Br(Bm=>{\"use strict\";var Dxt=Bm&&Bm.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Bm,\"__esModule\",{value:!0});Bm.createProxyModule=Bm.createProxyFunction=void 0;var Oxt=Dxt(VI()),hX=zS(),GS=Mx(),uX=lX(),Bxt=jS(),WS=SF(),fX=Oxt.default(\"threads:master:messages\"),Fxt=1,zxt=e=>Array.from(new Set(e)),Nxt=e=>e&&e.type===WS.WorkerMessageType.error,Uxt=e=>e&&e.type===WS.WorkerMessageType.result,Vxt=e=>e&&e.type===WS.WorkerMessageType.running;function jxt(e,t){return new hX.Observable(r=>{let i,s=n=>{if(fX(\"Message from worker:\",n.data),!(!n.data||n.data.uid!==t)){if(Vxt(n.data))i=n.data.resultType;else if(Uxt(n.data))i===\"promise\"?(typeof n.data.payload<\"u\"&&r.next(GS.deserialize(n.data.payload)),r.complete(),e.removeEventListener(\"message\",s)):(n.data.payload&&r.next(GS.deserialize(n.data.payload)),n.data.complete&&(r.complete(),e.removeEventListener(\"message\",s)));else if(Nxt(n.data)){let o=GS.deserialize(n.data.error);r.error(o),e.removeEventListener(\"message\",s)}}};return e.addEventListener(\"message\",s),()=>{if(i===\"observable\"||!i){let n={type:WS.MasterMessageType.cancel,uid:t};e.postMessage(n)}e.removeEventListener(\"message\",s)}})}function Gxt(e){if(e.length===0)return{args:[],transferables:[]};let t=[],r=[];for(let i of e)Bxt.isTransferDescriptor(i)?(t.push(GS.serialize(i.send)),r.push(...i.transferables)):t.push(GS.serialize(i));return{args:t,transferables:r.length===0?r:zxt(r)}}function dX(e,t){return(...r)=>{let i=Fxt++,{args:s,transferables:n}=Gxt(r),o={type:WS.MasterMessageType.run,uid:i,method:t,args:s};fX(\"Sending command to run function to worker:\",o);try{e.postMessage(o,n)}catch(c){return uX.ObservablePromise.from(Promise.reject(c))}return uX.ObservablePromise.from(hX.multicast(jxt(e,i)))}}Bm.createProxyFunction=dX;function Wxt(e,t){let r={};for(let i of t)r[i]=dX(e,i);return r}Bm.createProxyModule=Wxt});var _X=Br(Fm=>{\"use strict\";var TF=Fm&&Fm.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})},Hxt=Fm&&Fm.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Fm,\"__esModule\",{value:!0});Fm.spawn=void 0;var MF=Hxt(VI()),qxt=zS(),Zxt=Mx(),Yxt=sX(),XI=US(),KI=oX(),AX=pX(),Qxt=MF.default(\"threads:master:messages\"),$xt=MF.default(\"threads:master:spawn\"),gX=MF.default(\"threads:master:thread-utils\"),Xxt=e=>e&&e.type===\"init\",Kxt=e=>e&&e.type===\"uncaughtError\",Jxt=typeof process<\"u\"&&process.env.THREADS_WORKER_INIT_TIMEOUT?Number.parseInt(process.env.THREADS_WORKER_INIT_TIMEOUT,10):1e4;function t1t(e,t,r){return TF(this,void 0,void 0,function*(){let i,s=new Promise((o,c)=>{i=setTimeout(()=>c(Error(r)),t)}),n=yield Promise.race([e,s]);return clearTimeout(i),n})}function e1t(e){return new Promise((t,r)=>{let i=s=>{Qxt(\"Message from worker before finishing initialization:\",s.data),Xxt(s.data)?(e.removeEventListener(\"message\",i),t(s.data)):Kxt(s.data)&&(e.removeEventListener(\"message\",i),r(Zxt.deserialize(s.data.error)))};e.addEventListener(\"message\",i)})}function r1t(e,t){return new qxt.Observable(r=>{let i=n=>{let o={type:KI.WorkerEventType.message,data:n.data};r.next(o)},s=n=>{gX(\"Unhandled promise rejection event in thread:\",n);let o={type:KI.WorkerEventType.internalError,error:Error(n.reason)};r.next(o)};e.addEventListener(\"message\",i),e.addEventListener(\"unhandledrejection\",s),t.then(()=>{let n={type:KI.WorkerEventType.termination};e.removeEventListener(\"message\",i),e.removeEventListener(\"unhandledrejection\",s),r.next(n),r.complete()})})}function i1t(e){let[t,r]=Yxt.createPromiseWithResolver();return{terminate:()=>TF(this,void 0,void 0,function*(){gX(\"Terminating worker\"),yield e.terminate(),r()}),termination:t}}function mX(e,t,r,i){let s=r.filter(n=>n.type===KI.WorkerEventType.internalError).map(n=>n.error);return Object.assign(e,{[XI.$errors]:s,[XI.$events]:r,[XI.$terminate]:i,[XI.$worker]:t})}function n1t(e,t){return TF(this,void 0,void 0,function*(){$xt(\"Initializing new thread\");let r=t&&t.timeout?t.timeout:Jxt,s=(yield t1t(e1t(e),r,`Timeout: Did not receive an init message from worker after ${r}ms. Make sure the worker calls expose().`)).exposed,{termination:n,terminate:o}=i1t(e),c=r1t(e,n);if(s.type===\"function\"){let f=AX.createProxyFunction(e);return mX(f,e,c,o)}else if(s.type===\"module\"){let f=AX.createProxyModule(e,s.methods);return mX(f,e,c,o)}else{let f=s.type;throw Error(`Worker init message states unexpected type of expose(): ${f}`)}})}Fm.spawn=n1t});var yX=Br(Cc=>{\"use strict\";Object.defineProperty(Cc,\"__esModule\",{value:!0});Cc.Worker=Cc.BlobWorker=Cc.isWorkerRuntime=Cc.Thread=Cc.spawn=Cc.Pool=void 0;var EF=aF();Object.defineProperty(Cc,\"isWorkerRuntime\",{enumerable:!0,get:function(){return EF.isWorkerRuntime}});var s1t=nX();Object.defineProperty(Cc,\"Pool\",{enumerable:!0,get:function(){return s1t.Pool}});var o1t=_X();Object.defineProperty(Cc,\"spawn\",{enumerable:!0,get:function(){return o1t.spawn}});var a1t=xF();Object.defineProperty(Cc,\"Thread\",{enumerable:!0,get:function(){return a1t.Thread}});Cc.BlobWorker=EF.getWorkerImplementation().blob;Cc.Worker=EF.getWorkerImplementation().default});var xX=Br((yce,vX)=>{\"use strict\";vX.exports=e=>e?typeof Symbol.observable==\"symbol\"&&typeof e[Symbol.observable]==\"function\"?e===e[Symbol.observable]():typeof e[\"@@observable\"]==\"function\"?e===e[\"@@observable\"]():!1:!1});var bX=Br(PF=>{\"use strict\";Object.defineProperty(PF,\"__esModule\",{value:!0});var l1t=function(){let t=typeof self<\"u\"&&typeof Window<\"u\"&&self instanceof Window;return!!(typeof self<\"u\"&&self.postMessage&&!t)},c1t=function(t,r){self.postMessage(t,r)},u1t=function(t){let r=s=>{t(s.data)},i=()=>{self.removeEventListener(\"message\",r)};return self.addEventListener(\"message\",r),i};PF.default={isWorkerRuntime:l1t,postMessageToMaster:c1t,subscribeToMasterMessages:u1t}});var IX=Br(Lc=>{\"use strict\";var h1t=Lc&&Lc.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})},EX=Lc&&Lc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Lc,\"__esModule\",{value:!0});Lc.expose=Lc.isWorkerRuntime=Lc.Transfer=Lc.registerSerializer=void 0;var f1t=EX(xX()),zm=Mx(),d1t=jS(),Nm=SF(),fu=EX(bX()),p1t=Mx();Object.defineProperty(Lc,\"registerSerializer\",{enumerable:!0,get:function(){return p1t.registerSerializer}});var A1t=jS();Object.defineProperty(Lc,\"Transfer\",{enumerable:!0,get:function(){return A1t.Transfer}});Lc.isWorkerRuntime=fu.default.isWorkerRuntime;var wX=!1,HS=new Map,m1t=e=>e&&e.type===Nm.MasterMessageType.cancel,SX=e=>e&&e.type===Nm.MasterMessageType.run,TX=e=>f1t.default(e)||g1t(e);function g1t(e){return e&&typeof e==\"object\"&&typeof e.subscribe==\"function\"}function PX(e){return d1t.isTransferDescriptor(e)?{payload:e.send,transferables:e.transferables}:{payload:e,transferables:void 0}}function _1t(){let e={type:Nm.WorkerMessageType.init,exposed:{type:\"function\"}};fu.default.postMessageToMaster(e)}function y1t(e){let t={type:Nm.WorkerMessageType.init,exposed:{type:\"module\",methods:e}};fu.default.postMessageToMaster(t)}function IF(e,t){let{payload:r,transferables:i}=PX(t),s={type:Nm.WorkerMessageType.error,uid:e,error:zm.serialize(r)};fu.default.postMessageToMaster(s,i)}function CF(e,t,r){let{payload:i,transferables:s}=PX(r),n={type:Nm.WorkerMessageType.result,uid:e,complete:t?!0:void 0,payload:i};fu.default.postMessageToMaster(n,s)}function v1t(e,t){let r={type:Nm.WorkerMessageType.running,uid:e,resultType:t};fu.default.postMessageToMaster(r)}function JI(e){try{let t={type:Nm.WorkerMessageType.uncaughtError,error:zm.serialize(e)};fu.default.postMessageToMaster(t)}catch(t){console.error(`Not reporting uncaught error back to master thread as it occured while reporting an uncaught error already.\nLatest error:`,t,`\nOriginal error:`,e)}}function MX(e,t,r){return h1t(this,void 0,void 0,function*(){let i;try{i=t(...r)}catch(n){return IF(e,n)}let s=TX(i)?\"observable\":\"promise\";if(v1t(e,s),TX(i)){let n=i.subscribe(o=>CF(e,!1,zm.serialize(o)),o=>{IF(e,zm.serialize(o)),HS.delete(e)},()=>{CF(e,!0),HS.delete(e)});HS.set(e,n)}else try{let n=yield i;CF(e,!0,zm.serialize(n))}catch(n){IF(e,zm.serialize(n))}})}function x1t(e){if(!fu.default.isWorkerRuntime())throw Error(\"expose() called in the master thread.\");if(wX)throw Error(\"expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.\");if(wX=!0,typeof e==\"function\")fu.default.subscribeToMasterMessages(t=>{SX(t)&&!t.method&&MX(t.uid,e,t.args.map(zm.deserialize))}),_1t();else if(typeof e==\"object\"&&e){fu.default.subscribeToMasterMessages(r=>{SX(r)&&r.method&&MX(r.uid,e[r.method],r.args.map(zm.deserialize))});let t=Object.keys(e).filter(r=>typeof e[r]==\"function\");y1t(t)}else throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${e}`);fu.default.subscribeToMasterMessages(t=>{if(m1t(t)){let r=t.uid,i=HS.get(r);i&&(i.unsubscribe(),HS.delete(r))}})}Lc.expose=x1t;typeof self<\"u\"&&typeof self.addEventListener==\"function\"&&fu.default.isWorkerRuntime()&&(self.addEventListener(\"error\",e=>{setTimeout(()=>JI(e.error||e),250)}),self.addEventListener(\"unhandledrejection\",e=>{let t=e.reason;t&&typeof t.message==\"string\"&&setTimeout(()=>JI(t),250)}));typeof process<\"u\"&&typeof process.on==\"function\"&&fu.default.isWorkerRuntime()&&(process.on(\"uncaughtException\",e=>{setTimeout(()=>JI(e),250)}),process.on(\"unhandledRejection\",e=>{e&&typeof e.message==\"string\"&&setTimeout(()=>JI(e),250)}))});var CX=Br(Fl=>{\"use strict\";var b1t=Fl&&Fl.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),w1t=Fl&&Fl.__exportStar||function(e,t){for(var r in e)r!==\"default\"&&!Object.prototype.hasOwnProperty.call(t,r)&&b1t(t,e,r)};Object.defineProperty(Fl,\"__esModule\",{value:!0});Fl.Transfer=Fl.DefaultSerializer=Fl.expose=Fl.registerSerializer=void 0;var S1t=Mx();Object.defineProperty(Fl,\"registerSerializer\",{enumerable:!0,get:function(){return S1t.registerSerializer}});w1t(yX(),Fl);var T1t=IX();Object.defineProperty(Fl,\"expose\",{enumerable:!0,get:function(){return T1t.expose}});var M1t=nF();Object.defineProperty(Fl,\"DefaultSerializer\",{enumerable:!0,get:function(){return M1t.DefaultSerializer}});var E1t=jS();Object.defineProperty(Fl,\"Transfer\",{enumerable:!0,get:function(){return E1t.Transfer}})});var hC=Ri(Yi(),1),a_=Ri(Yi(),1);var ec=Ri(Yi(),1),U8=Ri(N8(),1),V8=ec.createContext(null);function Ket(){let e=ec.useContext(V8);if(!e)throw new Error(\"RenderContext not found\");return e}function Y1(){return Ket().model}function zA(e){let t=Y1(),[r,i]=ec.useState(t.get(e));return ec.useEffect(()=>{let s=()=>i(t.get(e));return t.on(`change:${e}`,s),()=>t.off(`change:${e}`,s)},[t,e]),[r,s=>{t.set(e,s),t.save_changes()}]}function j8(e){return({el:t,model:r,experimental:i})=>{let s=U8.createRoot(t);return s.render(ec.createElement(ec.StrictMode,null,ec.createElement(V8.Provider,{value:{model:r,experimental:i}},ec.createElement(e)))),()=>s.unmount()}}var rU=Ri(Yi());var cy=Ri(Yi()),Yc=Ri(Yi());var m4=Ri(Yi()),zM=Ri(Yi());var G8=m4.createContext(null);function W8(e,t){let r=Array.isArray(e)?e[0]:e?e.x:0,i=Array.isArray(e)?e[1]:e?e.y:0,s=Array.isArray(t)?t[0]:t?t.x:0,n=Array.isArray(t)?t[1]:t?t.y:0;return r===s&&i===n}function rc(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r{let s=null;\"interactive\"in i&&(s=Object.assign({},i),delete s.interactive);let n=t[i.ref];if(n){s=s||Object.assign({},i),delete s.ref;for(let o of Jet)o in n&&(s[o]=n[o])}return s||i});return{...e,layers:r}}var q8={version:8,sources:{},layers:[]},Z8={mousedown:\"onMouseDown\",mouseup:\"onMouseUp\",mouseover:\"onMouseOver\",mousemove:\"onMouseMove\",click:\"onClick\",dblclick:\"onDblClick\",mouseenter:\"onMouseEnter\",mouseleave:\"onMouseLeave\",mouseout:\"onMouseOut\",contextmenu:\"onContextMenu\",touchstart:\"onTouchStart\",touchend:\"onTouchEnd\",touchmove:\"onTouchMove\",touchcancel:\"onTouchCancel\"},x4={movestart:\"onMoveStart\",move:\"onMove\",moveend:\"onMoveEnd\",dragstart:\"onDragStart\",drag:\"onDrag\",dragend:\"onDragEnd\",zoomstart:\"onZoomStart\",zoom:\"onZoom\",zoomend:\"onZoomEnd\",rotatestart:\"onRotateStart\",rotate:\"onRotate\",rotateend:\"onRotateEnd\",pitchstart:\"onPitchStart\",pitch:\"onPitch\",pitchend:\"onPitchEnd\"},Y8={wheel:\"onWheel\",boxzoomstart:\"onBoxZoomStart\",boxzoomend:\"onBoxZoomEnd\",boxzoomcancel:\"onBoxZoomCancel\",resize:\"onResize\",load:\"onLoad\",render:\"onRender\",idle:\"onIdle\",remove:\"onRemove\",data:\"onData\",styledata:\"onStyleData\",sourcedata:\"onSourceData\",error:\"onError\"},trt=[\"minZoom\",\"maxZoom\",\"minPitch\",\"maxPitch\",\"maxBounds\",\"projection\",\"renderWorldCopies\"],ert=[\"scrollZoom\",\"boxZoom\",\"dragRotate\",\"dragPan\",\"keyboard\",\"doubleClickZoom\",\"touchZoomRotate\",\"touchPitch\"],R0=class e{constructor(t,r,i){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=s=>{let n=this.props[Y8[s.type]];n?n(s):s.type===\"error\"&&console.error(s.error)},this._onPointerEvent=s=>{(s.type===\"mousemove\"||s.type===\"mouseout\")&&this._updateHover(s);let n=this.props[Z8[s.type]];n&&(this.props.interactiveLayerIds&&s.type!==\"mouseover\"&&s.type!==\"mouseout\"&&(s.features=this._hoveredFeatures||this._queryRenderedFeatures(s.point)),n(s),delete s.features)},this._onCameraEvent=s=>{if(!this._internalUpdate){let n=this.props[x4[s.type]];n&&n(s)}s.type in this._deferredEvents&&(this._deferredEvents[s.type]=!1)},this._MapClass=t,this.props=r,this._initialize(i)}get map(){return this._map}get transform(){return this._renderTransform}setProps(t){let r=this.props;this.props=t;let i=this._updateSettings(t,r);i&&this._createShadowTransform(this._map);let s=this._updateSize(t),n=this._updateViewState(t,!0);this._updateStyle(t,r),this._updateStyleComponents(t,r),this._updateHandlers(t,r),(i||s||n&&!this._map.isMoving())&&this.redraw()}static reuse(t,r){let i=e.savedMaps.pop();if(!i)return null;let s=i.map,n=s.getContainer();for(r.className=n.className;n.childNodes.length>0;)r.appendChild(n.childNodes[0]);s._container=r;let o=s._resizeObserver;o&&(o.disconnect(),o.observe(r)),i.setProps({...t,styleDiffing:!1}),s.resize();let{initialViewState:c}=t;return c&&(c.bounds?s.fitBounds(c.bounds,{...c.fitBoundsOptions,duration:0}):i._updateViewState(c,!1)),s.isStyleLoaded()?s.fire(\"load\"):s.once(\"styledata\",()=>s.fire(\"load\")),s._update(),i}_initialize(t){let{props:r}=this,{mapStyle:i=q8}=r,s={...r,...r.initialViewState,accessToken:r.mapboxAccessToken||rrt()||null,container:t,style:v4(i)},n=s.initialViewState||s.viewState||s;if(Object.assign(s,{center:[n.longitude||0,n.latitude||0],zoom:n.zoom||0,pitch:n.pitch||0,bearing:n.bearing||0}),r.gl){let w=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=w,r.gl)}let o=new this._MapClass(s);n.padding&&o.setPadding(n.padding),r.cursor&&(o.getCanvas().style.cursor=r.cursor),this._createShadowTransform(o);let c=o._render;o._render=w=>{this._inRender=!0,c.call(o,w),this._inRender=!1};let f=o._renderTaskQueue.run;o._renderTaskQueue.run=w=>{f.call(o._renderTaskQueue,w),this._onBeforeRepaint()},o.on(\"render\",()=>this._onAfterRepaint());let _=o.fire;o.fire=this._fireEvent.bind(this,_),o.on(\"resize\",()=>{this._renderTransform.resize(o.transform.width,o.transform.height)}),o.on(\"styledata\",()=>{this._updateStyleComponents(this.props,{}),g4(o.transform,this._renderTransform)}),o.on(\"sourcedata\",()=>this._updateStyleComponents(this.props,{}));for(let w in Z8)o.on(w,this._onPointerEvent);for(let w in x4)o.on(w,this._onCameraEvent);for(let w in Y8)o.on(w,this._onEvent);this._map=o}recycle(){let r=this.map.getContainer().querySelector(\"[mapboxgl-children]\");r?.remove(),e.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){let t=this._map;!this._inRender&&t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_createShadowTransform(t){let r=H8(t.transform);t.painter.transform=r,this._renderTransform=r}_updateSize(t){let{viewState:r}=t;if(r){let i=this._map;if(r.width!==i.transform.width||r.height!==i.transform.height)return i.resize(),!0}return!1}_updateViewState(t,r){if(this._internalUpdate)return!1;let i=this._map,s=this._renderTransform,{zoom:n,pitch:o,bearing:c}=s,f=i.isMoving();f&&(s.cameraElevationReference=\"sea\");let _=y4(s,{..._4(i.transform),...t});if(f&&(s.cameraElevationReference=\"ground\"),_&&r){let w=this._deferredEvents;w.move=!0,w.zoom||(w.zoom=n!==s.zoom),w.rotate||(w.rotate=c!==s.bearing),w.pitch||(w.pitch=o!==s.pitch)}return f||y4(i.transform,t),_}_updateSettings(t,r){let i=this._map,s=!1;for(let n of trt)if(n in t&&!rc(t[n],r[n])){s=!0;let o=i[`set${n[0].toUpperCase()}${n.slice(1)}`];o?.call(i,t[n])}return s}_updateStyle(t,r){if(t.cursor!==r.cursor&&(this._map.getCanvas().style.cursor=t.cursor||\"\"),t.mapStyle!==r.mapStyle){let{mapStyle:i=q8,styleDiffing:s=!0}=t,n={diff:s};return\"localIdeographFontFamily\"in t&&(n.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(v4(i),n),!0}return!1}_updateStyleComponents(t,r){let i=this._map,s=!1;return i.isStyleLoaded()&&(\"light\"in t&&i.setLight&&!rc(t.light,r.light)&&(s=!0,i.setLight(t.light)),\"fog\"in t&&i.setFog&&!rc(t.fog,r.fog)&&(s=!0,i.setFog(t.fog)),\"terrain\"in t&&i.setTerrain&&!rc(t.terrain,r.terrain)&&(!t.terrain||i.getSource(t.terrain.source))&&(s=!0,i.setTerrain(t.terrain))),s}_updateHandlers(t,r){var i,s;let n=this._map,o=!1;for(let c of ert){let f=(i=t[c])!==null&&i!==void 0?i:!0,_=(s=r[c])!==null&&s!==void 0?s:!0;rc(f,_)||(o=!0,f?n[c].enable(f):n[c].disable())}return o}_queryRenderedFeatures(t){let r=this._map,i=r.transform,{interactiveLayerIds:s=[]}=this.props;try{return r.transform=this._renderTransform,r.queryRenderedFeatures(t,{layers:s.filter(r.getLayer.bind(r))})}catch{return[]}finally{r.transform=i}}_updateHover(t){var r;let{props:i}=this;if(i.interactiveLayerIds&&(i.onMouseMove||i.onMouseEnter||i.onMouseLeave)){let n=t.type,o=((r=this._hoveredFeatures)===null||r===void 0?void 0:r.length)>0,c=this._queryRenderedFeatures(t.point),f=c.length>0;!f&&o&&(t.type=\"mouseleave\",this._onPointerEvent(t)),this._hoveredFeatures=c,f&&!o&&(t.type=\"mouseenter\",this._onPointerEvent(t)),t.type=n}else this._hoveredFeatures=null}_fireEvent(t,r,i){let s=this._map,n=s.transform,o=typeof r==\"string\"?r:r.type;return o===\"move\"&&this._updateViewState(this.props,!1),o in x4&&(typeof r==\"object\"&&(r.viewState=_4(n)),this._map.isMoving())?(s.transform=this._renderTransform,t.call(s,r,i),s.transform=n,s):(t.call(s,r,i),s)}_onBeforeRepaint(){let t=this._map;this._internalUpdate=!0;for(let i in this._deferredEvents)this._deferredEvents[i]&&t.fire(i);this._internalUpdate=!1;let r=this._map.transform;t.transform=this._renderTransform,this._onAfterRepaint=()=>{g4(this._renderTransform,r),t.transform=r}}};R0.savedMaps=[];function rrt(){let e=null;if(typeof location<\"u\"){let t=/access_token=([^&\\/]*)/.exec(location.search);e=t&&t[1]}try{e=e||process.env.MapboxAccessToken}catch{}try{e=e||process.env.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return e}var irt=[\"setMaxBounds\",\"setMinZoom\",\"setMaxZoom\",\"setMinPitch\",\"setMaxPitch\",\"setRenderWorldCopies\",\"setProjection\",\"setStyle\",\"addSource\",\"removeSource\",\"addLayer\",\"removeLayer\",\"setLayerZoomRange\",\"setFilter\",\"setPaintProperty\",\"setLayoutProperty\",\"setLight\",\"setTerrain\",\"setFog\",\"remove\"];function b4(e){if(!e)return null;let t=e.map,r={getMap:()=>t,getCenter:()=>e.transform.center,getZoom:()=>e.transform.zoom,getBearing:()=>e.transform.bearing,getPitch:()=>e.transform.pitch,getPadding:()=>e.transform.padding,getBounds:()=>e.transform.getBounds(),project:i=>{let s=t.transform;t.transform=e.transform;let n=t.project(i);return t.transform=s,n},unproject:i=>{let s=t.transform;t.transform=e.transform;let n=t.unproject(i);return t.transform=s,n},queryTerrainElevation:(i,s)=>{let n=t.transform;t.transform=e.transform;let o=t.queryTerrainElevation(i,s);return t.transform=n,o},queryRenderedFeatures:(i,s)=>{let n=t.transform;t.transform=e.transform;let o=t.queryRenderedFeatures(i,s);return t.transform=n,o}};for(let i of nrt(t))!(i in r)&&!irt.includes(i)&&(r[i]=t[i].bind(t));return r}function nrt(e){let t=new Set,r=e;for(;r;){for(let i of Object.getOwnPropertyNames(r))i[0]!==\"_\"&&typeof e[i]==\"function\"&&i!==\"fire\"&&i!==\"setEventedParent\"&&t.add(i);r=Object.getPrototypeOf(r)}return Array.from(t)}var NM=Ri(Yi()),srt=typeof document<\"u\"?NM.useLayoutEffect:NM.useEffect,Q8=srt;var ort=[\"baseApiUrl\",\"maxParallelImageRequests\",\"workerClass\",\"workerCount\",\"workerUrl\"];function w4(e,t){for(let i of ort)i in t&&(e[i]=t[i]);let{RTLTextPlugin:r=\"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js\"}=t;r&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()===\"unavailable\"&&e.setRTLTextPlugin(r,i=>{i&&console.error(i)},!0)}var Of=cy.createContext(null);function S4(e,t,r){let i=(0,Yc.useContext)(G8),[s,n]=(0,Yc.useState)(null),o=(0,Yc.useRef)(),{current:c}=(0,Yc.useRef)({mapLib:null,map:null});(0,Yc.useEffect)(()=>{let w=e.mapLib,I=!0,R;return Promise.resolve(w||r).then(N=>{if(!I)return;if(!N)throw new Error(\"Invalid mapLib\");let j=\"Map\"in N?N:N.default;if(!j.Map)throw new Error(\"Invalid mapLib\");if(w4(j,e),!j.supported||j.supported(e))e.reuseMaps&&(R=R0.reuse(e,o.current)),R||(R=new R0(j.Map,e,o.current)),c.map=b4(R),c.mapLib=j,n(R),i?.onMapMount(c.map,e.id);else throw new Error(\"Map is not supported by this browser\")}).catch(N=>{let{onError:j}=e;j?j({type:\"error\",target:null,originalEvent:null,error:N}):console.error(N)}),()=>{I=!1,R&&(i?.onMapUnmount(e.id),e.reuseMaps?R.recycle():R.destroy())}},[]),Q8(()=>{s&&s.setProps(e)}),(0,Yc.useImperativeHandle)(t,()=>c.map,[s]);let f=(0,Yc.useMemo)(()=>({position:\"relative\",width:\"100%\",height:\"100%\",...e.style}),[e.style]),_={height:\"100%\"};return cy.createElement(\"div\",{id:e.id,ref:o,style:f},s&&cy.createElement(Of.Provider,{value:c},cy.createElement(\"div\",{\"mapboxgl-children\":\"\",style:_},e.children)))}var $8=Ri(Yi()),X8=Ri(FM()),Tl=Ri(Yi());var art=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function ic(e,t){if(!e||!t)return;let r=e.style;for(let i in t){let s=t[i];Number.isFinite(s)&&!art.test(i)?r[i]=`${s}px`:r[i]=s}}function lrt(e,t){let{map:r,mapLib:i}=(0,Tl.useContext)(Of),s=(0,Tl.useRef)({props:e});s.current.props=e;let n=(0,Tl.useMemo)(()=>{let Q=!1;$8.Children.forEach(e.children,K=>{K&&(Q=!0)});let et={...e,element:Q?document.createElement(\"div\"):null},Y=new i.Marker(et);return Y.setLngLat([e.longitude,e.latitude]),Y.getElement().addEventListener(\"click\",K=>{var J,ut;(ut=(J=s.current.props).onClick)===null||ut===void 0||ut.call(J,{type:\"click\",target:Y,originalEvent:K})}),Y.on(\"dragstart\",K=>{var J,ut;let Et=K;Et.lngLat=n.getLngLat(),(ut=(J=s.current.props).onDragStart)===null||ut===void 0||ut.call(J,Et)}),Y.on(\"drag\",K=>{var J,ut;let Et=K;Et.lngLat=n.getLngLat(),(ut=(J=s.current.props).onDrag)===null||ut===void 0||ut.call(J,Et)}),Y.on(\"dragend\",K=>{var J,ut;let Et=K;Et.lngLat=n.getLngLat(),(ut=(J=s.current.props).onDragEnd)===null||ut===void 0||ut.call(J,Et)}),Y},[]);(0,Tl.useEffect)(()=>(n.addTo(r.getMap()),()=>{n.remove()}),[]);let{longitude:o,latitude:c,offset:f,style:_,draggable:w=!1,popup:I=null,rotation:R=0,rotationAlignment:N=\"auto\",pitchAlignment:j=\"auto\"}=e;return(0,Tl.useEffect)(()=>{ic(n.getElement(),_)},[_]),(0,Tl.useImperativeHandle)(t,()=>n,[]),(n.getLngLat().lng!==o||n.getLngLat().lat!==c)&&n.setLngLat([o,c]),f&&!W8(n.getOffset(),f)&&n.setOffset(f),n.isDraggable()!==w&&n.setDraggable(w),n.getRotation()!==R&&n.setRotation(R),n.getRotationAlignment()!==N&&n.setRotationAlignment(N),n.getPitchAlignment()!==j&&n.setPitchAlignment(j),n.getPopup()!==I&&n.setPopup(I),(0,X8.createPortal)(e.children,n.getElement())}var crt=(0,Tl.memo)((0,Tl.forwardRef)(lrt));var J8=Ri(FM()),Xa=Ri(Yi());function K8(e){return new Set(e?e.trim().split(/\\s+/):[])}function urt(e,t){let{map:r,mapLib:i}=(0,Xa.useContext)(Of),s=(0,Xa.useMemo)(()=>document.createElement(\"div\"),[]),n=(0,Xa.useRef)({props:e});n.current.props=e;let o=(0,Xa.useMemo)(()=>{let c={...e},f=new i.Popup(c);return f.setLngLat([e.longitude,e.latitude]),f.once(\"open\",_=>{var w,I;(I=(w=n.current.props).onOpen)===null||I===void 0||I.call(w,_)}),f},[]);if((0,Xa.useEffect)(()=>{let c=f=>{var _,w;(w=(_=n.current.props).onClose)===null||w===void 0||w.call(_,f)};return o.on(\"close\",c),o.setDOMContent(s).addTo(r.getMap()),()=>{o.off(\"close\",c),o.isOpen()&&o.remove()}},[]),(0,Xa.useEffect)(()=>{ic(o.getElement(),e.style)},[e.style]),(0,Xa.useImperativeHandle)(t,()=>o,[]),o.isOpen()&&((o.getLngLat().lng!==e.longitude||o.getLngLat().lat!==e.latitude)&&o.setLngLat([e.longitude,e.latitude]),e.offset&&!rc(o.options.offset,e.offset)&&o.setOffset(e.offset),(o.options.anchor!==e.anchor||o.options.maxWidth!==e.maxWidth)&&(o.options.anchor=e.anchor,o.setMaxWidth(e.maxWidth)),o.options.className!==e.className)){let c=K8(o.options.className),f=K8(e.className);for(let _ of c)f.has(_)||o.removeClassName(_);for(let _ of f)c.has(_)||o.addClassName(_);o.options.className=e.className}return(0,J8.createPortal)(e.children,s)}var hrt=(0,Xa.memo)((0,Xa.forwardRef)(urt));var UM=Ri(Yi());var uy=Ri(Yi());function frt(e,t,r,i){let s=(0,uy.useContext)(Of),n=(0,uy.useMemo)(()=>e(s),[]);return(0,uy.useEffect)(()=>{let o=i||r||t,c=typeof t==\"function\"&&typeof r==\"function\"?t:null,f=typeof r==\"function\"?r:typeof t==\"function\"?t:null,{map:_}=s;return _.hasControl(n)||(_.addControl(n,o?.position),c&&c(s)),()=>{f&&f(s),_.hasControl(n)&&_.removeControl(n)}},[]),n}var kh=frt;function drt(e){let t=kh(({mapLib:r})=>new r.AttributionControl(e),{position:e.position});return(0,UM.useEffect)(()=>{ic(t._container,e.style)},[e.style]),null}var prt=(0,UM.memo)(drt);var VM=Ri(Yi());function Art(e){let t=kh(({mapLib:r})=>new r.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return(0,VM.useEffect)(()=>{ic(t._controlContainer,e.style)},[e.style]),null}var mrt=(0,VM.memo)(Art);var Bf=Ri(Yi());function grt(e,t){let r=(0,Bf.useRef)({props:e}),i=kh(({mapLib:s})=>{let n=new s.GeolocateControl(e),o=n._setupUI;return n._setupUI=c=>{n._container.hasChildNodes()||o(c)},n.on(\"geolocate\",c=>{var f,_;(_=(f=r.current.props).onGeolocate)===null||_===void 0||_.call(f,c)}),n.on(\"error\",c=>{var f,_;(_=(f=r.current.props).onError)===null||_===void 0||_.call(f,c)}),n.on(\"outofmaxbounds\",c=>{var f,_;(_=(f=r.current.props).onOutOfMaxBounds)===null||_===void 0||_.call(f,c)}),n.on(\"trackuserlocationstart\",c=>{var f,_;(_=(f=r.current.props).onTrackUserLocationStart)===null||_===void 0||_.call(f,c)}),n.on(\"trackuserlocationend\",c=>{var f,_;(_=(f=r.current.props).onTrackUserLocationEnd)===null||_===void 0||_.call(f,c)}),n},{position:e.position});return r.current.props=e,(0,Bf.useImperativeHandle)(t,()=>i,[]),(0,Bf.useEffect)(()=>{ic(i._container,e.style)},[e.style]),null}var _rt=(0,Bf.memo)((0,Bf.forwardRef)(grt));var jM=Ri(Yi());function yrt(e){let t=kh(({mapLib:r})=>new r.NavigationControl(e),{position:e.position});return(0,jM.useEffect)(()=>{ic(t._container,e.style)},[e.style]),null}var vrt=(0,jM.memo)(yrt);var hy=Ri(Yi());function xrt(e){let t=kh(({mapLib:n})=>new n.ScaleControl(e),{position:e.position}),r=(0,hy.useRef)(e),i=r.current;r.current=e;let{style:s}=e;return e.maxWidth!==void 0&&e.maxWidth!==i.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==i.unit&&t.setUnit(e.unit),(0,hy.useEffect)(()=>{ic(t._container,s)},[s]),null}var brt=(0,hy.memo)(xrt);var Q1=Ri(Yi());var Srt=Ri(Yi()),$1=Ri(Yi()),Trt=Ri(Yi());var Mrt=Promise.resolve().then(()=>Ri(eU())),Ert=rU.forwardRef(function(t,r){return S4(t,r,Mrt)});var iU=Ert;var Do=Ri(Yi());function NA(e,t){if(!e)throw new Error(t||\"loader assertion failed.\")}var Ff={self:typeof self<\"u\"&&self,window:typeof window<\"u\"&&window,global:typeof global<\"u\"&&global,document:typeof document<\"u\"&&document},Prt=Ff.self||Ff.window||Ff.global||{},Irt=Ff.window||Ff.self||Ff.global||{},Crt=Ff.global||Ff.self||Ff.window||{},Lrt=Ff.document||{};var D0=!!(typeof process!=\"object\"||String(process)!==\"[object process]\"||process.browser);var nU=typeof process<\"u\"&&process.version&&/v([0-9]*)/.exec(process.version),krt=nU&&parseFloat(nU[1])||0;var sU=\"3.4.14\";function Ka(e,t){if(!e)throw new Error(t||\"loaders.gl assertion failed.\")}var zf={self:typeof self<\"u\"&&self,window:typeof window<\"u\"&&window,global:typeof global<\"u\"&&global,document:typeof document<\"u\"&&document},Xwt=zf.self||zf.window||zf.global||{},Kwt=zf.window||zf.self||zf.global||{},Jwt=zf.global||zf.self||zf.window||{},t2t=zf.document||{};var O0=typeof process!=\"object\"||String(process)!==\"[object process]\"||process.browser;var aU=typeof window<\"u\"&&typeof window.orientation<\"u\",oU=typeof process<\"u\"&&process.version&&/v([0-9]*)/.exec(process.version),e2t=oU&&parseFloat(oU[1])||0;function B0(e){\"@babel/helpers - typeof\";return B0=typeof Symbol==\"function\"&&typeof Symbol.iterator==\"symbol\"?function(t){return typeof t}:function(t){return t&&typeof Symbol==\"function\"&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},B0(e)}function lU(e,t){if(B0(e)!=\"object\"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||\"default\");if(B0(i)!=\"object\")return i;throw new TypeError(\"@@toPrimitive must return a primitive value.\")}return(t===\"string\"?String:Number)(e)}function cU(e){var t=lU(e,\"string\");return B0(t)==\"symbol\"?t:t+\"\"}function G(e,t,r){return(t=cU(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var X1=class{constructor(t,r){G(this,\"name\",void 0),G(this,\"workerThread\",void 0),G(this,\"isRunning\",!0),G(this,\"result\",void 0),G(this,\"_resolve\",()=>{}),G(this,\"_reject\",()=>{}),this.name=t,this.workerThread=r,this.result=new Promise((i,s)=>{this._resolve=i,this._reject=s})}postMessage(t,r){this.workerThread.postMessage({source:\"loaders.gl\",type:t,payload:r})}done(t){Ka(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Ka(this.isRunning),this.isRunning=!1,this._reject(t)}};var fy=class{terminate(){}};var E4=new Map;function uU(e){Ka(e.source&&!e.url||!e.source&&e.url);let t=E4.get(e.source||e.url);return t||(e.url&&(t=Rrt(e.url),E4.set(e.url,t)),e.source&&(t=hU(e.source),E4.set(e.source,t))),Ka(t),t}function Rrt(e){if(!e.startsWith(\"http\"))return e;let t=Drt(e);return hU(t)}function hU(e){let t=new Blob([e],{type:\"application/javascript\"});return URL.createObjectURL(t)}function Drt(e){return`try {\n importScripts('`.concat(e,`');\n} catch (error) {\n console.error(error);\n throw error;\n}`)}function P4(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2?arguments[2]:void 0,i=r||new Set;if(e){if(fU(e))i.add(e);else if(fU(e.buffer))i.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(t&&typeof e==\"object\")for(let s in e)P4(e[s],t,i)}}return r===void 0?Array.from(i):[]}function fU(e){return e?e instanceof ArrayBuffer||typeof MessagePort<\"u\"&&e instanceof MessagePort||typeof ImageBitmap<\"u\"&&e instanceof ImageBitmap||typeof OffscreenCanvas<\"u\"&&e instanceof OffscreenCanvas:!1}var I4=()=>{},UA=class{static isSupported(){return typeof Worker<\"u\"&&O0||typeof fy<\"u\"&&!O0}constructor(t){G(this,\"name\",void 0),G(this,\"source\",void 0),G(this,\"url\",void 0),G(this,\"terminated\",!1),G(this,\"worker\",void 0),G(this,\"onMessage\",void 0),G(this,\"onError\",void 0),G(this,\"_loadableURL\",\"\");let{name:r,source:i,url:s}=t;Ka(i||s),this.name=r,this.source=i,this.url=s,this.onMessage=I4,this.onError=n=>console.log(n),this.worker=O0?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=I4,this.onError=I4,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(t,r){r=r||P4(t),this.worker.postMessage(t,r)}_getErrorFromErrorEvent(t){let r=\"Failed to load \";return r+=\"worker \".concat(this.name,\" from \").concat(this.url,\". \"),t.message&&(r+=\"\".concat(t.message,\" in \")),t.lineno&&(r+=\":\".concat(t.lineno,\":\").concat(t.colno)),new Error(r)}_createBrowserWorker(){this._loadableURL=uU({source:this.source,url:this.url});let t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error(\"No data received\"))},t.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},t.onmessageerror=r=>console.error(r),t}_createNodeWorker(){let t;if(this.url){let i=this.url.includes(\":/\")||this.url.startsWith(\"/\")?this.url:\"./\".concat(this.url);t=new fy(i,{eval:!1})}else if(this.source)t=new fy(this.source,{eval:!0});else throw new Error(\"no worker\");return t.on(\"message\",r=>{this.onMessage(r)}),t.on(\"error\",r=>{this.onError(r)}),t.on(\"exit\",r=>{}),t}};var K1=class{static isSupported(){return UA.isSupported()}constructor(t){G(this,\"name\",\"unnamed\"),G(this,\"source\",void 0),G(this,\"url\",void 0),G(this,\"maxConcurrency\",1),G(this,\"maxMobileConcurrency\",1),G(this,\"onDebug\",()=>{}),G(this,\"reuseWorkers\",!0),G(this,\"props\",{}),G(this,\"jobQueue\",[]),G(this,\"idleQueue\",[]),G(this,\"count\",0),G(this,\"isDestroyed\",!1),this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(n,o,c)=>n.done(c),i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(n,o)=>n.error(o),s=new Promise(n=>(this.jobQueue.push({name:t,onMessage:r,onError:i,onStart:n}),this));return this._startQueuedJob(),await s}async _startQueuedJob(){if(!this.jobQueue.length)return;let t=this._getAvailableWorker();if(!t)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:\"Starting job\",name:r.name,workerThread:t,backlog:this.jobQueue.length});let i=new X1(r.name,t);t.onMessage=s=>r.onMessage(i,s.type,s.payload),t.onError=s=>r.onError(i,s),r.onStart(i);try{await i.result}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count{}},VA=class e{static isSupported(){return UA.isSupported()}static getWorkerFarm(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e._workerFarm=e._workerFarm||new e({}),e._workerFarm.setProps(t),e._workerFarm}constructor(t){G(this,\"props\",void 0),G(this,\"workerPools\",new Map),this.props={...Ort},this.setProps(t),this.workerPools=new Map}destroy(){for(let t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(t){let{name:r,source:i,url:s}=t,n=this.workerPools.get(r);return n||(n=new K1({name:r,source:i,url:s}),n.setProps(this._getWorkerPoolProps()),this.workerPools.set(r,n)),n}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}};G(VA,\"_workerFarm\",void 0);var Brt=\"latest\";function C4(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t[e.id]||{},i=\"\".concat(e.id,\"-worker.js\"),s=r.workerUrl;if(!s&&e.id===\"compression\"&&(s=t.workerUrl),t._workerType===\"test\"&&(s=\"modules/\".concat(e.module,\"/dist/\").concat(i)),!s){let n=e.version;n===\"latest\"&&(n=Brt);let o=n?\"@\".concat(n):\"\";s=\"https://unpkg.com/@loaders.gl/\".concat(e.module).concat(o,\"/dist/\").concat(i)}return Ka(s),s}function L4(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:sU;Ka(e,\"no worker provided\");let r=e.version;return!(!t||!r)}function k4(e,t){return!VA.isSupported()||!O0&&!(t!=null&&t._nodeWorkers)?!1:e.worker&&t?.worker}async function R4(e,t,r,i,s){let n=e.id,o=C4(e,r),f=VA.getWorkerFarm(r).getWorkerPool({name:n,url:o});r=JSON.parse(JSON.stringify(r)),i=JSON.parse(JSON.stringify(i||{}));let _=await f.startJob(\"process-on-worker\",Frt.bind(null,s));return _.postMessage(\"process\",{input:t,options:r,context:i}),await(await _.result).result}async function Frt(e,t,r,i){switch(r){case\"done\":t.done(i);break;case\"error\":t.error(new Error(i.error));break;case\"process\":let{id:s,input:n,options:o}=i;try{let c=await e(n,o);t.postMessage(\"done\",{id:s,result:c})}catch(c){let f=c instanceof Error?c.message:\"unknown error\";t.postMessage(\"error\",{id:s,error:f})}break;default:console.warn(\"parse-with-worker unknown message \".concat(r))}}function D4(e,t,r){if(r=r||e.byteLength,e.byteLengthc instanceof ArrayBuffer?new Uint8Array(c):c),s=i.reduce((c,f)=>c+f.byteLength,0),n=new Uint8Array(s),o=0;for(let c of i)n.set(c,o),o+=c.byteLength;return n.buffer}async function B4(e){let t=[];for await(let r of e)t.push(r);return O4(...t)}function J1(){let e;if(typeof window<\"u\"&&window.performance)e=window.performance.now();else if(typeof process<\"u\"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var F0=class{constructor(t,r){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=J1(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(J1()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var dy=class{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:\"count\";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:i}=t,s=this.stats[r];return s||(t instanceof F0?s=t:s=new F0(r,i),this.stats[r]=s),s}};var zrt=\"Queued Requests\",Nrt=\"Active Requests\",Urt=\"Cancelled Requests\",Vrt=\"Queued Requests Ever\",jrt=\"Active Requests Ever\",Grt={id:\"request-scheduler\",throttleRequests:!0,maxRequests:6},py=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};G(this,\"props\",void 0),G(this,\"stats\",void 0),G(this,\"activeRequestCount\",0),G(this,\"requestQueue\",[]),G(this,\"requestMap\",new Map),G(this,\"deferredUpdate\",null),this.props={...Grt,...t},this.stats=new dy({id:this.props.id}),this.stats.get(zrt),this.stats.get(Nrt),this.stats.get(Urt),this.stats.get(Vrt),this.stats.get(jrt)}scheduleRequest(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:()=>0;if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let i={handle:t,priority:0,getPriority:r},s=new Promise(n=>(i.resolve=n,i));return this.requestQueue.push(i),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:r,resolve:i}=t,s=!1,n=()=>{s||(s=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,i?i({done:n}):Promise.resolve({done:n})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;rr.priority-i.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var Wrt=\"\",dU={};function F4(e){for(let t in dU)if(e.startsWith(t)){let r=dU[t];e=e.replace(t,r)}return!e.startsWith(\"http://\")&&!e.startsWith(\"https://\")&&(e=\"\".concat(Wrt).concat(e)),e}function pU(e){return e&&typeof e==\"object\"&&e.isBuffer}function GM(e){if(pU(e))return e;if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if(typeof e==\"string\"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e==\"object\"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(\"toArrayBuffer\")}var z0={};mA(z0,{dirname:()=>qrt,filename:()=>Hrt,join:()=>Zrt,resolve:()=>Yrt});function AU(){var e;if(typeof process<\"u\"&&typeof process.cwd<\"u\")return process.cwd();let t=(e=window.location)===null||e===void 0?void 0:e.pathname;return t?.slice(0,t.lastIndexOf(\"/\")+1)||\"\"}function Hrt(e){let t=e?e.lastIndexOf(\"/\"):-1;return t>=0?e.substr(t+1):\"\"}function qrt(e){let t=e?e.lastIndexOf(\"/\"):-1;return t>=0?e.substr(0,t):\"\"}function Zrt(){for(var e=arguments.length,t=new Array(e),r=0;r(n&&(s=s.replace(new RegExp(\"^\".concat(i)),\"\")),n!==t.length-1&&(s=s.replace(new RegExp(\"\".concat(i,\"$\")),\"\")),s)),t.join(i)}function Yrt(){let e=[];for(let s=0;s=-1&&!r;s--){let n;s>=0?n=e[s]:(i===void 0&&(i=AU()),n=i),n.length!==0&&(t=\"\".concat(n,\"/\").concat(t),r=n.charCodeAt(0)===tb)}return t=Qrt(t,!r),r?\"/\".concat(t):t.length>0?t:\".\"}var tb=47,z4=46;function Qrt(e,t){let r=\"\",i=-1,s=0,n,o=!1;for(let c=0;c<=e.length;++c){if(c2){let f=r.length-1,_=f;for(;_>=0&&r.charCodeAt(_)!==tb;--_);if(_!==f){r=_===-1?\"\":r.slice(0,_),i=c,s=0,o=!1;continue}}else if(r.length===2||r.length===1){r=\"\",i=c,s=0,o=!1;continue}}t&&(r.length>0?r+=\"/..\":r=\"..\",o=!0)}else{let f=e.slice(i+1,c);r.length>0?r+=\"/\".concat(f):r=f,o=!1}i=c,s=0}else n===z4&&s!==-1?++s:s=-1}return r}var $rt=e=>typeof e==\"boolean\",eb=e=>typeof e==\"function\",N0=e=>e!==null&&typeof e==\"object\",N4=e=>N0(e)&&e.constructor==={}.constructor;var mU=e=>e&&typeof e[Symbol.iterator]==\"function\",gU=e=>e&&typeof e[Symbol.asyncIterator]==\"function\";var Cu=e=>typeof Response<\"u\"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var Lu=e=>typeof Blob<\"u\"&&e instanceof Blob,_U=e=>e&&typeof e==\"object\"&&e.isBuffer;var Xrt=e=>typeof ReadableStream<\"u\"&&e instanceof ReadableStream||N0(e)&&eb(e.tee)&&eb(e.cancel)&&eb(e.getReader);var Krt=e=>N0(e)&&eb(e.read)&&eb(e.pipe)&&$rt(e.readable),WM=e=>Xrt(e)||Krt(e);var Jrt=/^data:([-\\w.]+\\/[-\\w.+]+)(;|,)/,tit=/^([-\\w.]+\\/[-\\w.+]+)/;function yU(e){let t=tit.exec(e);return t?t[1]:e}function U4(e){let t=Jrt.exec(e);return t?t[1]:\"\"}var vU=/\\?.*/;function xU(e){let t=e.match(vU);return t&&t[0]}function Ay(e){return e.replace(vU,\"\")}function U0(e){return Cu(e)?e.url:Lu(e)?e.name||\"\":typeof e==\"string\"?e:\"\"}function rb(e){if(Cu(e)){let t=e,r=t.headers.get(\"content-type\")||\"\",i=Ay(t.url);return yU(r)||U4(i)}return Lu(e)?e.type||\"\":typeof e==\"string\"?U4(e):\"\"}function bU(e){return Cu(e)?e.headers[\"content-length\"]||-1:Lu(e)?e.size:typeof e==\"string\"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function HM(e){if(Cu(e))return e;let t={},r=bU(e);r>=0&&(t[\"content-length\"]=String(r));let i=U0(e),s=rb(e);s&&(t[\"content-type\"]=s);let n=await rit(e);n&&(t[\"x-first-bytes\"]=n),typeof e==\"string\"&&(e=new TextEncoder().encode(e));let o=new Response(e,{headers:t});return Object.defineProperty(o,\"url\",{value:i}),o}async function wU(e){if(!e.ok){let t=await eit(e);throw new Error(t)}}async function eit(e){let t=\"Failed to fetch resource \".concat(e.url,\" (\").concat(e.status,\"): \");try{let r=e.headers.get(\"Content-Type\"),i=e.statusText;r.includes(\"application/json\")&&(i+=\" \".concat(await e.text())),t+=i,t=t.length>60?\"\".concat(t.slice(0,60),\"...\"):t}catch{}return t}async function rit(e){if(typeof e==\"string\")return\"data:,\".concat(e.slice(0,5));if(e instanceof Blob){let r=e.slice(0,5);return await new Promise(i=>{let s=new FileReader;s.onload=n=>{var o;return i(n==null||(o=n.target)===null||o===void 0?void 0:o.result)},s.readAsDataURL(r)})}if(e instanceof ArrayBuffer){let r=e.slice(0,5),i=iit(r);return\"data:base64,\".concat(i)}return null}function iit(e){let t=\"\",r=new Uint8Array(e);for(let i=0;i=0)}function Rh(){return!(typeof process==\"object\"&&String(process)===\"[object process]\"&&!process.browser)||j4()}var nit=globalThis.self||globalThis.window||globalThis.global,my=globalThis.window||globalThis.self||globalThis.global,sit=globalThis.document||{},V0=globalThis.process||{},oit=globalThis.console,qSt=globalThis.navigator||{};var qM=typeof __VERSION__<\"u\"?__VERSION__:\"untranspiled source\",QSt=Rh();function ait(e){try{let t=window[e],r=\"__storage_test__\";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var ZM=class{constructor(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:\"sessionStorage\";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=ait(i),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function SU(e){let t;return e<10?t=\"\".concat(e.toFixed(2),\"ms\"):e<100?t=\"\".concat(e.toFixed(1),\"ms\"):e<1e3?t=\"\".concat(e.toFixed(0),\"ms\"):t=\"\".concat((e/1e3).toFixed(2),\"s\"),t}function TU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return\"\".concat(\" \".repeat(r)).concat(e)}function YM(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,s=e.src.replace(/\\(/g,\"%28\").replace(/\\)/g,\"%29\");e.width>i&&(r=Math.min(r,i/e.width));let n=e.width*r,o=e.height*r,c=[\"font-size:1px;\",\"padding:\".concat(Math.floor(o/2),\"px \").concat(Math.floor(n/2),\"px;\"),\"line-height:\".concat(o,\"px;\"),\"background:url(\".concat(s,\");\"),\"background-size:\".concat(n,\"px \").concat(o,\"px;\"),\"color:transparent;\"].join(\"\");return[\"\".concat(t,\" %c+\"),c]}var QM;(function(e){e[e.BLACK=30]=\"BLACK\",e[e.RED=31]=\"RED\",e[e.GREEN=32]=\"GREEN\",e[e.YELLOW=33]=\"YELLOW\",e[e.BLUE=34]=\"BLUE\",e[e.MAGENTA=35]=\"MAGENTA\",e[e.CYAN=36]=\"CYAN\",e[e.WHITE=37]=\"WHITE\",e[e.BRIGHT_BLACK=90]=\"BRIGHT_BLACK\",e[e.BRIGHT_RED=91]=\"BRIGHT_RED\",e[e.BRIGHT_GREEN=92]=\"BRIGHT_GREEN\",e[e.BRIGHT_YELLOW=93]=\"BRIGHT_YELLOW\",e[e.BRIGHT_BLUE=94]=\"BRIGHT_BLUE\",e[e.BRIGHT_MAGENTA=95]=\"BRIGHT_MAGENTA\",e[e.BRIGHT_CYAN=96]=\"BRIGHT_CYAN\",e[e.BRIGHT_WHITE=97]=\"BRIGHT_WHITE\"})(QM||(QM={}));var lit=10;function MU(e){return typeof e!=\"string\"?e:(e=e.toUpperCase(),QM[e]||QM.WHITE)}function EU(e,t,r){if(!Rh&&typeof e==\"string\"){if(t){let i=MU(t);e=\"\\x1B[\".concat(i,\"m\").concat(e,\"\\x1B[39m\")}if(r){let i=MU(r);e=\"\\x1B[\".concat(i+lit,\"m\").concat(e,\"\\x1B[49m\")}}return e}function PU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[\"constructor\"],r=Object.getPrototypeOf(e),i=Object.getOwnPropertyNames(r),s=e;for(let n of i){let o=s[n];typeof o==\"function\"&&(t.find(c=>n===c)||(s[n]=o.bind(e)))}}function gy(e,t){if(!e)throw new Error(t||\"Assertion failed\")}function j0(){let e;if(Rh()&&my.performance){var t,r;e=my===null||my===void 0||(t=my.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if(\"hrtime\"in V0){var i;let s=V0===null||V0===void 0||(i=V0.hrtime)===null||i===void 0?void 0:i.call(V0);e=s[0]*1e3+s[1]/1e6}else e=Date.now();return e}var _y={debug:Rh()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},cit={enabled:!0,level:0};function ku(){}var IU={},CU={once:!0},Nf=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:\"\"};this.id=void 0,this.VERSION=qM,this._startTs=j0(),this._deltaTs=j0(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new ZM(\"__probe-\".concat(this.id,\"__\"),cit),this.timeStamp(\"\".concat(this.id,\" started\")),PU(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((j0()-this._startTs).toPrecision(10))}getDelta(){return Number((j0()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){gy(t,r)}warn(t){return this._getLogFunction(0,t,_y.warn,arguments,CU)}error(t){return this._getLogFunction(0,t,_y.error,arguments)}deprecated(t,r){return this.warn(\"`\".concat(t,\"` is deprecated and will be removed in a later version. Use `\").concat(r,\"` instead\"))}removed(t,r){return this.error(\"`\".concat(t,\"` has been removed. Use `\").concat(r,\"` instead\"))}probe(t,r){return this._getLogFunction(t,r,_y.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,_y.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,_y.debug||_y.info,arguments,CU)}table(t,r,i){return r?this._getLogFunction(t,r,console.table||ku,i&&[i],{tag:dit(r)}):ku}image(t){let{logLevel:r,priority:i,image:s,message:n=\"\",scale:o=1}=t;return this._shouldLog(r||i)?Rh()?fit({image:s,message:n,scale:o}):hit({image:s,message:n,scale:o}):ku}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||ku)}group(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},s=LU({logLevel:t,message:r,opts:i}),{collapsed:n}=i;return s.method=(n?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},i,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,\"\",console.groupEnd||ku)}withGroup(t,r,i){this.group(t,r)();try{i()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=kU(t)}_getLogFunction(t,r,i,s,n){if(this._shouldLog(t)){n=LU({logLevel:t,message:r,args:s,opts:n}),i=i||n.method,gy(i),n.total=this.getTotal(),n.delta=this.getDelta(),this._deltaTs=j0();let o=n.tag||n.message;if(n.once&&o)if(!IU[o])IU[o]=j0();else return ku;return r=uit(this.id,n.message,n),i.bind(console,r,...n.args)}return ku}};Nf.VERSION=qM;function kU(e){if(!e)return 0;let t;switch(typeof e){case\"number\":t=e;break;case\"object\":t=e.logLevel||e.priority||0;break;default:return 0}return gy(Number.isFinite(t)&&t>=0),t}function LU(e){let{logLevel:t,message:r}=e;e.logLevel=kU(t);let i=e.args?Array.from(e.args):[];for(;i.length&&i.shift()!==r;);switch(typeof t){case\"string\":case\"function\":r!==void 0&&i.unshift(r),e.message=t;break;case\"object\":Object.assign(e,t);break;default:}typeof e.message==\"function\"&&(e.message=e.message());let s=typeof e.message;return gy(s===\"string\"||s===\"object\"),Object.assign(e,{args:i},e.opts)}function uit(e,t,r){if(typeof t==\"string\"){let i=r.time?TU(SU(r.total)):\"\";t=r.time?\"\".concat(e,\": \").concat(i,\" \").concat(t):\"\".concat(e,\": \").concat(t),t=EU(t,r.color,r.background)}return t}function hit(e){let{image:t,message:r=\"\",scale:i=1}=e;return console.warn(\"removed\"),ku}function fit(e){let{image:t,message:r=\"\",scale:i=1}=e;if(typeof t==\"string\"){let n=new Image;return n.onload=()=>{let o=YM(n,r,i);console.log(...o)},n.src=t,ku}let s=t.nodeName||\"\";if(s.toLowerCase()===\"img\")return console.log(...YM(t,r,i)),ku;if(s.toLowerCase()===\"canvas\"){let n=new Image;return n.onload=()=>console.log(...YM(n,r,i)),n.src=t.toDataURL(),ku}return ku}function dit(e){for(let t in e)for(let r in e[t])return r||\"untitled\";return\"empty\"}var vTt=new Nf({id:\"@probe.gl/log\"});var G4=new Nf({id:\"loaders.gl\"}),$M=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},XM=class{constructor(){G(this,\"console\",void 0),this.console=console}log(){for(var t=arguments.length,r=new Array(t),i=0;i{let e=H4();return e.globalOptions=e.globalOptions||{...W4},e.globalOptions};function BU(e,t,r,i){return r=r||[],r=Array.isArray(r)?r:[r],pit(e,r),mit(t,e,i)}function pit(e,t){DU(e,null,W4,RU,t);for(let r of t){let i=e&&e[r.id]||{},s=r.options&&r.options[r.id]||{},n=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};DU(i,r.id,s,n,t)}}function DU(e,t,r,i,s){let n=t||\"Top level\",o=t?\"\".concat(t,\".\"):\"\";for(let c in e){let f=!t&&N0(e[c]),_=c===\"baseUri\"&&!t,w=c===\"workerUrl\"&&t;if(!(c in r)&&!_&&!w){if(c in i)G4.warn(\"\".concat(n,\" loader option '\").concat(o).concat(c,\"' no longer supported, use '\").concat(i[c],\"'\"))();else if(!f){let I=Ait(c,s);G4.warn(\"\".concat(n,\" loader option '\").concat(o).concat(c,\"' not recognized. \").concat(I))()}}}}function Ait(e,t){let r=e.toLowerCase(),i=\"\";for(let s of t)for(let n in s.options){if(e===n)return\"Did you mean '\".concat(s.id,\".\").concat(n,\"'?\");let o=n.toLowerCase();(r.startsWith(o)||o.startsWith(r))&&(i=i||\"Did you mean '\".concat(s.id,\".\").concat(n,\"'?\"))}return i}function mit(e,t,r){let s={...e.options||{}};return git(s,r),s.log===null&&(s.log=new $M),OU(s,q4()),OU(s,t),s}function OU(e,t){for(let r in t)if(r in t){let i=t[r];N4(i)&&N4(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r]}}function git(e,t){t&&!(\"baseUri\"in e)&&(e.baseUri=t)}function ib(e){var t;return e?(Array.isArray(e)&&(e=e[0]),Array.isArray((t=e)===null||t===void 0?void 0:t.extensions)):!1}function nb(e){var t,r;NA(e,\"null loader\"),NA(ib(e),\"invalid loader\");let i;return Array.isArray(e)&&(i=e[1],e=e[0],e={...e,options:{...e.options,...i}}),((t=e)!==null&&t!==void 0&&t.parseTextSync||(r=e)!==null&&r!==void 0&&r.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var FU=()=>{let e=H4();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function Z4(e){let t=FU();e=Array.isArray(e)?e:[e];for(let r of e){let i=nb(r);t.find(s=>i===s)||t.unshift(i)}}function zU(){return FU()}var NU=new Nf({id:\"loaders.gl\"});var _it=/\\.([^.]+)$/;async function jU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!GU(e))return null;let s=UU(e,t,{...r,nothrow:!0},i);if(s)return s;if(Lu(e)&&(e=await e.slice(0,10).arrayBuffer(),s=UU(e,t,r,i)),!s&&!(r!=null&&r.nothrow))throw new Error(WU(e));return s}function UU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!GU(e))return null;if(t&&!Array.isArray(t))return nb(t);let s=[];t&&(s=s.concat(t)),r!=null&&r.ignoreRegisteredLoaders||s.push(...zU()),vit(s);let n=yit(e,s,r,i);if(!n&&!(r!=null&&r.nothrow))throw new Error(WU(e));return n}function yit(e,t,r,i){let s=U0(e),n=rb(e),o=Ay(s)||i?.url,c=null,f=\"\";if(r!=null&&r.mimeType&&(c=Y4(t,r?.mimeType),f=\"match forced by supplied MIME type \".concat(r?.mimeType)),c=c||xit(t,o),f=f||(c?\"matched url \".concat(o):\"\"),c=c||Y4(t,n),f=f||(c?\"matched MIME type \".concat(n):\"\"),c=c||wit(t,e),f=f||(c?\"matched initial data \".concat(HU(e)):\"\"),c=c||Y4(t,r?.fallbackMimeType),f=f||(c?\"matched fallback MIME type \".concat(n):\"\"),f){var _;NU.log(1,\"selectLoader selected \".concat((_=c)===null||_===void 0?void 0:_.name,\": \").concat(f,\".\"))}return c}function GU(e){return!(e instanceof Response&&e.status===204)}function WU(e){let t=U0(e),r=rb(e),i=\"No valid loader found (\";i+=t?\"\".concat(z0.filename(t),\", \"):\"no url provided, \",i+=\"MIME type: \".concat(r?'\"'.concat(r,'\"'):\"not provided\",\", \");let s=e?HU(e):\"\";return i+=s?' first bytes: \"'.concat(s,'\"'):\"first bytes: not available\",i+=\")\",i}function vit(e){for(let t of e)nb(t)}function xit(e,t){let r=t&&_it.exec(t),i=r&&r[1];return i?bit(e,i):null}function bit(e,t){t=t.toLowerCase();for(let r of e)for(let i of r.extensions)if(i.toLowerCase()===t)return r;return null}function Y4(e,t){for(let r of e)if(r.mimeTypes&&r.mimeTypes.includes(t)||t===\"application/x.\".concat(r.id))return r;return null}function wit(e,t){if(!t)return null;for(let r of e)if(typeof t==\"string\"){if(Sit(t,r))return r}else if(ArrayBuffer.isView(t)){if(VU(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer&&VU(t,0,r))return r;return null}function Sit(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(i=>e.startsWith(i))}function VU(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(s=>Tit(e,t,r,s))}function Tit(e,t,r,i){if(i instanceof ArrayBuffer)return D4(i,e,i.byteLength);switch(typeof i){case\"function\":return i(e,r);case\"string\":let s=Q4(e,t,i.length);return i===s;default:return!1}}function HU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;return typeof e==\"string\"?e.slice(0,t):ArrayBuffer.isView(e)?Q4(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?Q4(e,0,t):\"\"}function Q4(e,t,r){if(e.byteLength1&&arguments[1]!==void 0?arguments[1]:{};return function*(){let{chunkSize:r=262144}=t,i=0;for(;iV4(s,i):t!=null&&t.fetch?t?.fetch:V4}function KU(e,t,r){if(r)return r;let i={fetch:KM(t,e),...e};if(i.url){let s=Ay(i.url);i.baseUrl=s,i.queryString=xU(i.url),i.filename=z0.filename(s),i.baseUrl=z0.dirname(s)}return Array.isArray(i.loaders)||(i.loaders=null),i}function JU(e,t){if(!t&&e&&!Array.isArray(e))return e;let r;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){let i=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...i]:i}return r&&r.length?r:null}async function JM(e,t,r,i){Ka(!i||typeof i==\"object\"),t&&!Array.isArray(t)&&!ib(t)&&(i=void 0,r=t,t=void 0),e=await e,r=r||{};let s=U0(e),o=JU(t,i),c=await jU(e,o,r);return c?(r=BU(r,c,o,s),i=KU({url:s,parse:JM,loaders:o},r,i||null),await Iit(c,e,r,i)):null}async function Iit(e,t,r,i){if(L4(e),Cu(t)){let s=t,{ok:n,redirected:o,status:c,statusText:f,type:_,url:w}=s,I=Object.fromEntries(s.headers.entries());i.response={headers:I,ok:n,redirected:o,status:c,statusText:f,type:_,url:w}}if(t=await XU(t,e,r),e.parseTextSync&&typeof t==\"string\")return r.dataType=\"text\",e.parseTextSync(t,r,i,e);if(k4(e,r))return await R4(e,t,r,i,JM);if(e.parseText&&typeof t==\"string\")return await e.parseText(t,r,i,e);if(e.parse)return await e.parse(t,r,i,e);throw Ka(!e.parseSync),new Error(\"\".concat(e.id,\" loader - no parser found and worker is disabled\"))}async function jA(e,t,r,i){!Array.isArray(t)&&!ib(t)&&(i=void 0,r=t,t=void 0);let s=KM(r),n=e;return typeof e==\"string\"&&(n=await s(e)),Lu(e)&&(n=await s(e)),await JM(n,t,r)}var tV=\"3.4.14\";var{_parseImageNode:Cit}=globalThis,X4=typeof Image<\"u\",K4=typeof ImageBitmap<\"u\",Lit=!!Cit,J4=D0?!0:Lit;function eV(e){switch(e){case\"auto\":return K4||X4||J4;case\"imagebitmap\":return K4;case\"image\":return X4;case\"data\":return J4;default:throw new Error(\"@loaders.gl/images: image \".concat(e,\" not supported in this environment\"))}}function rV(){if(K4)return\"imagebitmap\";if(X4)return\"image\";if(J4)return\"data\";throw new Error(\"Install '@loaders.gl/polyfills' to parse images under Node.js\")}function kit(e){let t=Rit(e);if(!t)throw new Error(\"Not an image\");return t}function iV(e){switch(kit(e)){case\"data\":return e;case\"image\":case\"imagebitmap\":let t=document.createElement(\"canvas\"),r=t.getContext(\"2d\");if(!r)throw new Error(\"getImageData\");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error(\"getImageData\")}}function Rit(e){return typeof ImageBitmap<\"u\"&&e instanceof ImageBitmap?\"imagebitmap\":typeof Image<\"u\"&&e instanceof Image?\"image\":e&&typeof e==\"object\"&&e.data&&e.width&&e.height?\"data\":null}var Dit=/^data:image\\/svg\\+xml/,Oit=/\\.svg((\\?|#).*)?$/;function tE(e){return e&&(Dit.test(e)||Oit.test(e))}function nV(e,t){if(tE(t)){let i=new TextDecoder().decode(e);try{typeof unescape==\"function\"&&typeof encodeURIComponent==\"function\"&&(i=unescape(encodeURIComponent(i)))}catch(n){throw new Error(n.message)}return\"data:image/svg+xml;base64,\".concat(btoa(i))}return tR(e,t)}function tR(e,t){if(tE(t))throw new Error(\"SVG cannot be parsed directly to imagebitmap\");return new Blob([new Uint8Array(e)])}async function eE(e,t,r){let i=nV(e,r),s=self.URL||self.webkitURL,n=typeof i!=\"string\"&&s.createObjectURL(i);try{return await Bit(n||i,t)}finally{n&&s.revokeObjectURL(n)}}async function Bit(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((i,s)=>{try{r.onload=()=>i(r),r.onerror=n=>s(new Error(\"Could not load image \".concat(e,\": \").concat(n)))}catch(n){s(n)}})}var Fit={},sV=!0;async function oV(e,t,r){let i;tE(r)?i=await eE(e,t,r):i=tR(e,r);let s=t&&t.imagebitmap;return await zit(i,s)}async function zit(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if((Nit(t)||!sV)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),sV=!1}return await createImageBitmap(e)}function Nit(e){for(let t in e||Fit)return!1;return!0}function aV(e){return!Git(e,\"ftyp\",4)||!(e[8]&96)?null:Uit(e)}function Uit(e){switch(Vit(e,8,12).replace(\"\\0\",\" \").trim()){case\"avif\":case\"avis\":return{extension:\"avif\",mimeType:\"image/avif\"};default:return null}}function Vit(e,t,r){return String.fromCharCode(...e.slice(t,r))}function jit(e){return[...e].map(t=>t.charCodeAt(0))}function Git(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=jit(t);for(let s=0;s=24&&t.getUint32(0,Uf)===2303741511?{mimeType:\"image/png\",width:t.getUint32(16,Uf),height:t.getUint32(20,Uf)}:null}function qit(e){let t=ob(e);return t.byteLength>=10&&t.getUint32(0,Uf)===1195984440?{mimeType:\"image/gif\",width:t.getUint16(6,sb),height:t.getUint16(8,sb)}:null}function Zit(e){let t=ob(e);return t.byteLength>=14&&t.getUint16(0,Uf)===16973&&t.getUint32(2,sb)===t.byteLength?{mimeType:\"image/bmp\",width:t.getUint32(18,sb),height:t.getUint32(22,sb)}:null}function Yit(e){let t=ob(e);if(!(t.byteLength>=3&&t.getUint16(0,Uf)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:s}=Qit(),n=2;for(;n+9!!rE(new DataView(e))],options:Jit};function ab(e){if(typeof window<\"u\"&&typeof window.process==\"object\"&&window.process.type===\"renderer\"||typeof process<\"u\"&&typeof process.versions==\"object\"&&process.versions.electron)return!0;let t=typeof navigator==\"object\"&&typeof navigator.userAgent==\"string\"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf(\"Electron\")>=0)}function Lo(){return!(typeof process==\"object\"&&String(process)===\"[object process]\"&&!process.browser)||ab()}var GA={self:typeof self<\"u\"&&self,window:typeof window<\"u\"&&window,global:typeof global<\"u\"&&global,document:typeof document<\"u\"&&document,process:typeof process==\"object\"&&process};var tnt=GA.self||GA.window||GA.global,yy=GA.window||GA.self||GA.global,ent=GA.document||{},G0=GA.process||{};var iE=typeof __VERSION__<\"u\"?__VERSION__:\"untranspiled source\",gEt=Lo();var rR=globalThis;function vy(e){if(!e&&!Lo())return\"Node\";if(ab(e))return\"Electron\";let r=e||(typeof navigator<\"u\"?navigator:{}).userAgent||\"\";if(r.indexOf(\"Edge\")>-1)return\"Edge\";let i=r.indexOf(\"MSIE \")!==-1,s=r.indexOf(\"Trident/\")!==-1;return i||s?\"IE\":rR.chrome?\"Chrome\":rR.safari?\"Safari\":rR.mozInnerScreenX?\"Firefox\":\"Unknown\"}function rnt(e){try{let t=window[e],r=\"__storage_test__\";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var nE=class{constructor(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:\"sessionStorage\";G(this,\"storage\",void 0),G(this,\"id\",void 0),G(this,\"config\",void 0),this.storage=rnt(i),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function uV(e){let t;return e<10?t=\"\".concat(e.toFixed(2),\"ms\"):e<100?t=\"\".concat(e.toFixed(1),\"ms\"):e<1e3?t=\"\".concat(e.toFixed(0),\"ms\"):t=\"\".concat((e/1e3).toFixed(2),\"s\"),t}function hV(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return\"\".concat(\" \".repeat(r)).concat(e)}function sE(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,s=e.src.replace(/\\(/g,\"%28\").replace(/\\)/g,\"%29\");e.width>i&&(r=Math.min(r,i/e.width));let n=e.width*r,o=e.height*r,c=[\"font-size:1px;\",\"padding:\".concat(Math.floor(o/2),\"px \").concat(Math.floor(n/2),\"px;\"),\"line-height:\".concat(o,\"px;\"),\"background:url(\".concat(s,\");\"),\"background-size:\".concat(n,\"px \").concat(o,\"px;\"),\"color:transparent;\"].join(\"\");return[\"\".concat(t,\" %c+\"),c]}var oE;(function(e){e[e.BLACK=30]=\"BLACK\",e[e.RED=31]=\"RED\",e[e.GREEN=32]=\"GREEN\",e[e.YELLOW=33]=\"YELLOW\",e[e.BLUE=34]=\"BLUE\",e[e.MAGENTA=35]=\"MAGENTA\",e[e.CYAN=36]=\"CYAN\",e[e.WHITE=37]=\"WHITE\",e[e.BRIGHT_BLACK=90]=\"BRIGHT_BLACK\",e[e.BRIGHT_RED=91]=\"BRIGHT_RED\",e[e.BRIGHT_GREEN=92]=\"BRIGHT_GREEN\",e[e.BRIGHT_YELLOW=93]=\"BRIGHT_YELLOW\",e[e.BRIGHT_BLUE=94]=\"BRIGHT_BLUE\",e[e.BRIGHT_MAGENTA=95]=\"BRIGHT_MAGENTA\",e[e.BRIGHT_CYAN=96]=\"BRIGHT_CYAN\",e[e.BRIGHT_WHITE=97]=\"BRIGHT_WHITE\"})(oE||(oE={}));function fV(e){return typeof e==\"string\"?oE[e.toUpperCase()]||oE.WHITE:e}function dV(e,t,r){return!Lo&&typeof e==\"string\"&&(t&&(t=fV(t),e=\"\\x1B[\".concat(t,\"m\").concat(e,\"\\x1B[39m\")),r&&(t=fV(r),e=\"\\x1B[\".concat(r+10,\"m\").concat(e,\"\\x1B[49m\"))),e}function pV(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[\"constructor\"],r=Object.getPrototypeOf(e),i=Object.getOwnPropertyNames(r);for(let s of i)typeof e[s]==\"function\"&&(t.find(n=>s===n)||(e[s]=e[s].bind(e)))}function xy(e,t){if(!e)throw new Error(t||\"Assertion failed\")}function W0(){let e;if(Lo&&\"performance\"in yy){var t,r;e=yy===null||yy===void 0||(t=yy.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if(\"hrtime\"in G0){var i;let s=G0===null||G0===void 0||(i=G0.hrtime)===null||i===void 0?void 0:i.call(G0);e=s[0]*1e3+s[1]/1e6}else e=Date.now();return e}var by={debug:Lo&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},int={enabled:!0,level:0};function Ru(){}var AV={},mV={once:!0},Vf=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:\"\"};G(this,\"id\",void 0),G(this,\"VERSION\",iE),G(this,\"_startTs\",W0()),G(this,\"_deltaTs\",W0()),G(this,\"_storage\",void 0),G(this,\"userData\",{}),G(this,\"LOG_THROTTLE_TIMEOUT\",0),this.id=t,this.userData={},this._storage=new nE(\"__probe-\".concat(this.id,\"__\"),int),this.timeStamp(\"\".concat(this.id,\" started\")),pV(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((W0()-this._startTs).toPrecision(10))}getDelta(){return Number((W0()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){xy(t,r)}warn(t){return this._getLogFunction(0,t,by.warn,arguments,mV)}error(t){return this._getLogFunction(0,t,by.error,arguments)}deprecated(t,r){return this.warn(\"`\".concat(t,\"` is deprecated and will be removed in a later version. Use `\").concat(r,\"` instead\"))}removed(t,r){return this.error(\"`\".concat(t,\"` has been removed. Use `\").concat(r,\"` instead\"))}probe(t,r){return this._getLogFunction(t,r,by.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,by.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){for(var i=arguments.length,s=new Array(i>2?i-2:0),n=2;n2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},s=gV({logLevel:t,message:r,opts:i}),{collapsed:n}=i;return s.method=(n?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},i,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,\"\",console.groupEnd||Ru)}withGroup(t,r,i){this.group(t,r)();try{i()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=_V(t)}_getLogFunction(t,r,i,s,n){if(this._shouldLog(t)){n=gV({logLevel:t,message:r,args:s,opts:n}),i=i||n.method,xy(i),n.total=this.getTotal(),n.delta=this.getDelta(),this._deltaTs=W0();let o=n.tag||n.message;if(n.once)if(!AV[o])AV[o]=W0();else return Ru;return r=nnt(this.id,n.message,n),i.bind(console,r,...n.args)}return Ru}};G(Vf,\"VERSION\",iE);function _V(e){if(!e)return 0;let t;switch(typeof e){case\"number\":t=e;break;case\"object\":t=e.logLevel||e.priority||0;break;default:return 0}return xy(Number.isFinite(t)&&t>=0),t}function gV(e){let{logLevel:t,message:r}=e;e.logLevel=_V(t);let i=e.args?Array.from(e.args):[];for(;i.length&&i.shift()!==r;);switch(typeof t){case\"string\":case\"function\":r!==void 0&&i.unshift(r),e.message=t;break;case\"object\":Object.assign(e,t);break;default:}typeof e.message==\"function\"&&(e.message=e.message());let s=typeof e.message;return xy(s===\"string\"||s===\"object\"),Object.assign(e,{args:i},e.opts)}function nnt(e,t,r){if(typeof t==\"string\"){let i=r.time?hV(uV(r.total)):\"\";t=r.time?\"\".concat(e,\": \").concat(i,\" \").concat(t):\"\".concat(e,\": \").concat(t),t=dV(t,r.color,r.background)}return t}function snt(e){let{image:t,message:r=\"\",scale:i=1}=e;return console.warn(\"removed\"),Ru}function ont(e){let{image:t,message:r=\"\",scale:i=1}=e;if(typeof t==\"string\"){let n=new Image;return n.onload=()=>{let o=sE(n,r,i);console.log(...o)},n.src=t,Ru}let s=t.nodeName||\"\";if(s.toLowerCase()===\"img\")return console.log(...sE(t,r,i)),Ru;if(s.toLowerCase()===\"canvas\"){let n=new Image;return n.onload=()=>console.log(...sE(n,r,i)),n.src=t.toDataURL(),Ru}return Ru}function ant(e){for(let t in e)for(let r in e[t])return r||\"untitled\";return\"empty\"}var $Et=new Vf({id:\"@probe.gl/log\"});var or=new Vf({id:\"deck\"});var iR={};function yV(e){iR=e}function Ls(e,t,r,i){or.level>0&&iR[e]&&iR[e].call(null,t,r,i)}function lnt(e){let t=e[0],r=e[e.length-1];return t===\"{\"&&r===\"}\"||t===\"[\"&&r===\"]\"}var vV={id:\"JSON\",name:\"JSON\",module:\"\",version:\"\",options:{},extensions:[\"json\",\"geojson\"],mimeTypes:[\"application/json\",\"application/geo+json\"],testText:lnt,parseTextSync:JSON.parse};function cnt(){let e=\"8.9.35\",t=globalThis.deck&&globalThis.deck.VERSION;if(t&&t!==e)throw new Error(\"deck.gl - multiple versions detected: \".concat(t,\" vs \").concat(e));return t||(or.log(1,\"deck.gl \".concat(e))(),globalThis.deck={...globalThis.deck,VERSION:e,version:e,log:or,_registerLoggers:yV},Z4([vV,[eR,{imagebitmap:{premultiplyAlpha:\"none\"}}]])),e}var xV=cnt();var Yr={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(Yr,\"IDENTITY\",{get:()=>(or.deprecated(\"COORDINATE_SYSTEM.IDENTITY\",\"COORDINATE_SYSTEM.CARTESIAN\")(),0)});var Ja={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},po={common:0,meters:1,pixels:2},nR={click:{handler:\"onClick\"},panstart:{handler:\"onDragStart\"},panmove:{handler:\"onDrag\"},panend:{handler:\"onDragEnd\"}};var He=new Vf({id:\"luma.gl\"});function Ks(e,t){if(!e)throw new Error(t||\"luma.gl: assertion failed.\")}var unt=\"Invalid WebGLRenderingContext\";var hnt=\"Requires WebGL2\";function Jd(e){return typeof WebGLRenderingContext<\"u\"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<\"u\"&&e instanceof WebGL2RenderingContext?!0:!!(e&&Number.isFinite(e._version))}function fr(e){return typeof WebGL2RenderingContext<\"u\"&&e instanceof WebGL2RenderingContext?!0:!!(e&&e._version===2)}function sR(e){return fr(e)?e:null}function tp(e){return Ks(Jd(e),unt),e}function Yn(e){return Ks(fr(e),hnt),e}var lb={};function fnt(e){globalThis.console&&globalThis.console.error&&globalThis.console.error(e)}function dnt(e){globalThis.console&&globalThis.console.log&&globalThis.console.log(e)}function pnt(e,t){lb[e]=!0,t!==void 0&&fnt(t)}function Ant(e){let t=e.getError;e.getError=function(){let i;do i=t.apply(e),i!==0&&(lb[i]=!0);while(i!==0);for(i in lb)if(lb[i])return delete lb[i],parseInt(i,10);return 0}}var cb=function e(t){let r=t.gl;this.ext=t,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(t.maxVertexAttribs);for(let i=0;i{dnt(\"OESVertexArrayObject emulation library context restored\"),r.reset_()},!0),this.reset_()};H0.prototype.VERTEX_ARRAY_BINDING_OES=34229;H0.prototype.reset_=function(){if(this.vertexArrayObjects!==void 0)for(let i=0;ifr(e)?void 0:0,Tnt={3074:e=>fr(e)?void 0:36064,[ynt]:e=>fr(e)?void 0:vnt,35977:Un,32937:Un,[xnt]:(e,t)=>{let r=fr(e)?e.getExtension(gnt):e.getExtension(mnt);return r&&r.GPU_DISJOINT_EXT?t(r.GPU_DISJOINT_EXT):0},[wnt]:(e,t)=>{let r=e.getExtension(TV);return t(r&&r.UNMASKED_VENDOR_WEBGL||7936)},[Snt]:(e,t)=>{let r=e.getExtension(TV);return t(r&&r.UNMASKED_RENDERER_WEBGL||7937)},[bnt]:(e,t)=>{let r=e.luma.extensions[_nt];return r?t(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1},32883:Un,35071:Un,37447:Un,36063:(e,t)=>{if(!fr(e)){let r=e.getExtension(SV);return r?t(r.MAX_COLOR_ATTACHMENTS_WEBGL):0}},35379:Un,35374:Un,35377:Un,34852:e=>{if(!fr(e)){let t=e.getExtension(SV);return t?t.MAX_DRAW_BUFFERS_WEBGL:0}},36203:e=>e.getExtension(wV)?2147483647:65535,33001:e=>e.getExtension(wV)?16777216:65535,33e3:e=>16777216,37157:Un,35373:Un,35657:Un,36183:Un,37137:Un,34045:Un,35978:Un,35979:Un,35968:Un,35376:Un,35375:Un,35659:Un,37154:Un,35371:Un,35658:Un,35076:Un,35077:Un,35380:Un};function MV(e,t,r){let i=Tnt[r],s=typeof i==\"function\"?i(e,t,r):i;return s!==void 0?s:t(r)}var Mnt=\"OES_vertex_array_object\",EV=\"ANGLE_instanced_arrays\",Ent=\"WEBGL_draw_buffers\",Pnt=\"EXT_disjoint_timer_query\",Int=\"EXT_texture_filter_anisotropic\",Cnt=\"VertexArray requires WebGL2 or OES_vertex_array_object extension\";function Lnt(e,t){return{webgl2:fr(e),ext:e.getExtension(t)}}var oR={[Mnt]:{meta:{suffix:\"OES\"},createVertexArray:()=>{Ks(!1,Cnt)},deleteVertexArray:()=>{},bindVertexArray:()=>{},isVertexArray:()=>!1},[EV]:{meta:{suffix:\"ANGLE\"},vertexAttribDivisor(e,t){Ks(t===0,\"WebGL instanced rendering not supported\")},drawElementsInstanced:()=>{},drawArraysInstanced:()=>{}},[Ent]:{meta:{suffix:\"WEBGL\"},drawBuffers:()=>{Ks(!1)}},[Pnt]:{meta:{suffix:\"EXT\"},createQuery:()=>{Ks(!1)},deleteQuery:()=>{Ks(!1)},beginQuery:()=>{Ks(!1)},endQuery:()=>{},getQuery(e,t){return this.getQueryObject(e,t)},getQueryParameter(e,t){return this.getQueryObject(e,t)},getQueryObject:()=>{}}},aE={readBuffer:(e,t,r)=>{fr(e)&&t(r)},getVertexAttrib:(e,t,r,i)=>{let{webgl2:s,ext:n}=Lnt(e,EV),o;switch(i){case 35069:o=s?void 0:!1;break;case 35070:o=!s&&!n?0:void 0;break;default:}return o!==void 0?o:t(r,i)},getProgramParameter:(e,t,r,i)=>{if(!fr(e))switch(i){case 35967:return 35981;case 35971:return 0;case 35382:return 0;default:}return t(r,i)},getInternalformatParameter:(e,t,r,i,s)=>{if(!fr(e))switch(s){case 32937:return new Int32Array([0]);default:}return e.getInternalformatParameter(r,i,s)},getTexParameter(e,t,r,i){switch(i){case 34046:let{extensions:s}=e.luma,n=s[Int];i=n&&n.TEXTURE_MAX_ANISOTROPY_EXT||34046;break;default:}return t(r,i)},getParameter:MV,hint(e,t,r,i){return t(r,i)}};function PV(e){e.luma=e.luma||{};let{luma:t}=e;return t.polyfilled||(bV(e),knt(e),Dnt(e,oR),Rnt(e,{target:t,target2:e}),t.polyfilled=!0),e}globalThis.polyfillContext=PV;function knt(e){e.luma.extensions={};let t=e.getSupportedExtensions()||[];for(let r of t)e.luma[r]=e.getExtension(r)}function Rnt(e,t){let{target:r,target2:i}=t;Object.keys(aE).forEach(s=>{if(typeof aE[s]==\"function\"){let n=e[s]?e[s].bind(e):()=>{},o=aE[s].bind(null,e,n);r[s]=o,i[s]=o}})}function Dnt(e,t){for(let r of Object.getOwnPropertyNames(t))r!==\"overrides\"&&Ont(e,{extension:r,target:e.luma,target2:e})}function Ont(e,t){let{extension:r,target:i,target2:s}=t,n=oR[r];Ks(n);let{meta:o={}}=n,{suffix:c=\"\"}=o,f=e.getExtension(r);for(let _ of Object.keys(n)){let w=\"\".concat(_).concat(c),I=null;_===\"meta\"||typeof e[_]==\"function\"||(f&&typeof f[w]==\"function\"?I=function(){return f[w](...arguments)}:typeof n[_]==\"function\"&&(I=n[_].bind(i))),I&&(i[_]=I,s[_]=I)}}var hb={3042:!1,32773:new Float32Array([0,0,0,0]),32777:32774,34877:32774,32969:1,32968:0,32971:1,32970:0,3106:new Float32Array([0,0,0,0]),3107:[!0,!0,!0,!0],2884:!1,2885:1029,2929:!1,2931:1,2932:513,2928:new Float32Array([0,1]),2930:!0,3024:!0,36006:null,2886:2305,33170:4352,2849:1,32823:!1,32824:0,10752:0,32938:1,32939:!1,3089:!1,3088:new Int32Array([0,0,1024,1024]),2960:!1,2961:0,2968:4294967295,36005:4294967295,2962:519,2967:0,2963:4294967295,34816:519,36003:0,36004:4294967295,2964:7680,2965:7680,2966:7680,34817:7680,34818:7680,34819:7680,2978:[0,0,1024,1024],3333:4,3317:4,37440:!1,37441:!1,37443:37444,35723:4352,36010:null,35977:!1,3330:0,3332:0,3331:0,3314:0,32878:0,3316:0,3315:0,32877:0},WA=(e,t,r)=>t?e.enable(r):e.disable(r),IV=(e,t,r)=>e.hint(r,t),Qc=(e,t,r)=>e.pixelStorei(r,t),Bnt=(e,t)=>{let r=fr(e)?36009:36160;return e.bindFramebuffer(r,t)},Fnt=(e,t)=>e.bindFramebuffer(36008,t);function ub(e){return Array.isArray(e)||ArrayBuffer.isView(e)}var CV={3042:WA,32773:(e,t)=>e.blendColor(...t),32777:\"blendEquation\",34877:\"blendEquation\",32969:\"blendFunc\",32968:\"blendFunc\",32971:\"blendFunc\",32970:\"blendFunc\",3106:(e,t)=>e.clearColor(...t),3107:(e,t)=>e.colorMask(...t),2884:WA,2885:(e,t)=>e.cullFace(t),2929:WA,2931:(e,t)=>e.clearDepth(t),2932:(e,t)=>e.depthFunc(t),2928:(e,t)=>e.depthRange(...t),2930:(e,t)=>e.depthMask(t),3024:WA,35723:IV,36006:Bnt,2886:(e,t)=>e.frontFace(t),33170:IV,2849:(e,t)=>e.lineWidth(t),32823:WA,32824:\"polygonOffset\",10752:\"polygonOffset\",35977:WA,32938:\"sampleCoverage\",32939:\"sampleCoverage\",3089:WA,3088:(e,t)=>e.scissor(...t),2960:WA,2961:(e,t)=>e.clearStencil(t),2968:(e,t)=>e.stencilMaskSeparate(1028,t),36005:(e,t)=>e.stencilMaskSeparate(1029,t),2962:\"stencilFuncFront\",2967:\"stencilFuncFront\",2963:\"stencilFuncFront\",34816:\"stencilFuncBack\",36003:\"stencilFuncBack\",36004:\"stencilFuncBack\",2964:\"stencilOpFront\",2965:\"stencilOpFront\",2966:\"stencilOpFront\",34817:\"stencilOpBack\",34818:\"stencilOpBack\",34819:\"stencilOpBack\",2978:(e,t)=>e.viewport(...t),3333:Qc,3317:Qc,37440:Qc,37441:Qc,37443:Qc,3330:Qc,3332:Qc,3331:Qc,36010:Fnt,3314:Qc,32878:Qc,3316:Qc,3315:Qc,32877:Qc,framebuffer:(e,t)=>{let r=t&&\"handle\"in t?t.handle:t;return e.bindFramebuffer(36160,r)},blend:(e,t)=>t?e.enable(3042):e.disable(3042),blendColor:(e,t)=>e.blendColor(...t),blendEquation:(e,t)=>{t=ub(t)?t:[t,t],e.blendEquationSeparate(...t)},blendFunc:(e,t)=>{t=ub(t)&&t.length===2?[...t,...t]:t,e.blendFuncSeparate(...t)},clearColor:(e,t)=>e.clearColor(...t),clearDepth:(e,t)=>e.clearDepth(t),clearStencil:(e,t)=>e.clearStencil(t),colorMask:(e,t)=>e.colorMask(...t),cull:(e,t)=>t?e.enable(2884):e.disable(2884),cullFace:(e,t)=>e.cullFace(t),depthTest:(e,t)=>t?e.enable(2929):e.disable(2929),depthFunc:(e,t)=>e.depthFunc(t),depthMask:(e,t)=>e.depthMask(t),depthRange:(e,t)=>e.depthRange(...t),dither:(e,t)=>t?e.enable(3024):e.disable(3024),derivativeHint:(e,t)=>{e.hint(35723,t)},frontFace:(e,t)=>e.frontFace(t),mipmapHint:(e,t)=>e.hint(33170,t),lineWidth:(e,t)=>e.lineWidth(t),polygonOffsetFill:(e,t)=>t?e.enable(32823):e.disable(32823),polygonOffset:(e,t)=>e.polygonOffset(...t),sampleCoverage:(e,t)=>e.sampleCoverage(...t),scissorTest:(e,t)=>t?e.enable(3089):e.disable(3089),scissor:(e,t)=>e.scissor(...t),stencilTest:(e,t)=>t?e.enable(2960):e.disable(2960),stencilMask:(e,t)=>{t=ub(t)?t:[t,t];let[r,i]=t;e.stencilMaskSeparate(1028,r),e.stencilMaskSeparate(1029,i)},stencilFunc:(e,t)=>{t=ub(t)&&t.length===3?[...t,...t]:t;let[r,i,s,n,o,c]=t;e.stencilFuncSeparate(1028,r,i,s),e.stencilFuncSeparate(1029,n,o,c)},stencilOp:(e,t)=>{t=ub(t)&&t.length===3?[...t,...t]:t;let[r,i,s,n,o,c]=t;e.stencilOpSeparate(1028,r,i,s),e.stencilOpSeparate(1029,n,o,c)},viewport:(e,t)=>e.viewport(...t)};function ks(e,t,r){return t[e]!==void 0?t[e]:r[e]}var LV={blendEquation:(e,t,r)=>e.blendEquationSeparate(ks(32777,t,r),ks(34877,t,r)),blendFunc:(e,t,r)=>e.blendFuncSeparate(ks(32969,t,r),ks(32968,t,r),ks(32971,t,r),ks(32970,t,r)),polygonOffset:(e,t,r)=>e.polygonOffset(ks(32824,t,r),ks(10752,t,r)),sampleCoverage:(e,t,r)=>e.sampleCoverage(ks(32938,t,r),ks(32939,t,r)),stencilFuncFront:(e,t,r)=>e.stencilFuncSeparate(1028,ks(2962,t,r),ks(2967,t,r),ks(2963,t,r)),stencilFuncBack:(e,t,r)=>e.stencilFuncSeparate(1029,ks(34816,t,r),ks(36003,t,r),ks(36004,t,r)),stencilOpFront:(e,t,r)=>e.stencilOpSeparate(1028,ks(2964,t,r),ks(2965,t,r),ks(2966,t,r)),stencilOpBack:(e,t,r)=>e.stencilOpSeparate(1029,ks(34817,t,r),ks(34818,t,r),ks(34819,t,r))},aR={enable:(e,t)=>e({[t]:!0}),disable:(e,t)=>e({[t]:!1}),pixelStorei:(e,t,r)=>e({[t]:r}),hint:(e,t,r)=>e({[t]:r}),bindFramebuffer:(e,t,r)=>{switch(t){case 36160:return e({36006:r,36010:r});case 36009:return e({36006:r});case 36008:return e({36010:r});default:return null}},blendColor:(e,t,r,i,s)=>e({32773:new Float32Array([t,r,i,s])}),blendEquation:(e,t)=>e({32777:t,34877:t}),blendEquationSeparate:(e,t,r)=>e({32777:t,34877:r}),blendFunc:(e,t,r)=>e({32969:t,32968:r,32971:t,32970:r}),blendFuncSeparate:(e,t,r,i,s)=>e({32969:t,32968:r,32971:i,32970:s}),clearColor:(e,t,r,i,s)=>e({3106:new Float32Array([t,r,i,s])}),clearDepth:(e,t)=>e({2931:t}),clearStencil:(e,t)=>e({2961:t}),colorMask:(e,t,r,i,s)=>e({3107:[t,r,i,s]}),cullFace:(e,t)=>e({2885:t}),depthFunc:(e,t)=>e({2932:t}),depthRange:(e,t,r)=>e({2928:new Float32Array([t,r])}),depthMask:(e,t)=>e({2930:t}),frontFace:(e,t)=>e({2886:t}),lineWidth:(e,t)=>e({2849:t}),polygonOffset:(e,t,r)=>e({32824:t,10752:r}),sampleCoverage:(e,t,r)=>e({32938:t,32939:r}),scissor:(e,t,r,i,s)=>e({3088:new Int32Array([t,r,i,s])}),stencilMask:(e,t)=>e({2968:t,36005:t}),stencilMaskSeparate:(e,t,r)=>e({[t===1028?2968:36005]:r}),stencilFunc:(e,t,r,i)=>e({2962:t,2967:r,2963:i,34816:t,36003:r,36004:i}),stencilFuncSeparate:(e,t,r,i,s)=>e({[t===1028?2962:34816]:r,[t===1028?2967:36003]:i,[t===1028?2963:36004]:s}),stencilOp:(e,t,r,i)=>e({2964:t,2965:r,2966:i,34817:t,34818:r,34819:i}),stencilOpSeparate:(e,t,r,i,s)=>e({[t===1028?2964:34817]:r,[t===1028?2965:34818]:i,[t===1028?2966:34819]:s}),viewport:(e,t,r,i,s)=>e({2978:[t,r,i,s]})},jf=(e,t)=>e.isEnabled(t),lR={3042:jf,2884:jf,2929:jf,3024:jf,32823:jf,32926:jf,32928:jf,3089:jf,2960:jf,35977:jf};function cR(e){for(let t in e)return!1;return!0}function kV(e,t){if(e===t)return!0;let r=Array.isArray(e)||ArrayBuffer.isView(e),i=Array.isArray(t)||ArrayBuffer.isView(t);if(r&&i&&e.length===t.length){for(let s=0;s{}}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.program=null,this.stateStack=[],this.enable=!0,this.cache=r?wy(t):Object.assign({},hb),this.log=i,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.stateStack.push({})}pop(){Ks(this.stateStack.length>0);let t=this.stateStack[this.stateStack.length-1];Ml(this.gl,t),this.stateStack.pop()}_updateCache(t){let r=!1,i,s=this.stateStack.length>0&&this.stateStack[this.stateStack.length-1];for(let n in t){Ks(n!==void 0);let o=t[n],c=this.cache[n];kV(o,c)||(r=!0,i=c,s&&!(n in s)&&(s[n]=c),this.cache[n]=o)}return{valueChanged:r,oldValue:i}}};function lE(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{enable:r=!0,copyState:i}=t;if(Ks(i!==void 0),!e.state){let{polyfillContext:s}=globalThis;s&&s(e),e.state=new uR(e,{copyState:i}),Nnt(e);for(let n in aR){let o=aR[n];znt(e,n,o)}RV(e,\"getParameter\"),RV(e,\"isEnabled\")}return e.state.enable=r,e}function hR(e){e.state||lE(e,{copyState:!1}),e.state.push()}function cE(e){Ks(e.state),e.state.pop()}function Ml(e,t){if(Ks(Jd(e),\"setParameters requires a WebGL context\"),cR(t))return;let r={};for(let s in t){let n=Number(s),o=CV[s];o&&(typeof o==\"string\"?r[o]=!0:o(e,t[s],n))}let i=e.state&&e.state.cache;if(i)for(let s in r){let n=LV[s];n(e,t,i)}}function wy(e,t){if(t=t||hb,typeof t==\"number\"){let s=t,n=lR[s];return n?n(e,s):e.getParameter(s)}let r=Array.isArray(t)?t:Object.keys(t),i={};for(let s of r){let n=lR[s];i[s]=n?n(e,Number(s)):e.getParameter(Number(s))}return i}function uE(e){Ml(e,hb)}function Mn(e,t,r){if(cR(t))return r(e);let{nocatch:i=!0}=t;hR(e),Ml(e,t);let s;if(i)s=r(e),cE(e);else try{s=r(e)}finally{cE(e)}return s}function El(e){let{luma:t}=e;if(e.canvas&&t){let r=t.canvasSizeInfo,i=\"clientWidth\"in r?r.clientWidth:e.canvas.clientWidth;return i?e.drawingBufferWidth/i:1}return 1}function Sy(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=El(e),s=e.drawingBufferWidth,n=e.drawingBufferHeight;return Unt(t,i,s,n,r)}function BV(e){let t=typeof window>\"u\"?1:window.devicePixelRatio||1;return Number.isFinite(e)?e<=0?1:e:e?t:1}function Unt(e,t,r,i,s){let n=DV(e[0],t,r),o=OV(e[1],t,i,s),c=DV(e[0]+1,t,r),f=c===r-1?c:c-1;c=OV(e[1]+1,t,i,s);let _;return s?(c=c===0?c:c+1,_=o,o=c):_=c===i-1?c:c-1,{x:n,y:o,width:Math.max(f-n+1,1),height:Math.max(_-o+1,1)}}function DV(e,t,r){return Math.min(Math.round(e*t),r-1)}function OV(e,t,r,i){return i?Math.max(0,r-1-Math.round(e*t)):Math.min(Math.round(e*t),r-1)}var fR=Lo(),Vnt=fR&&typeof document<\"u\",FV={webgl2:!0,webgl1:!0,throwOnError:!0,manageState:!0,canvas:null,debug:!1,width:800,height:600};function Ty(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ks(fR,`createGLContext only available in the browser.\nCreate your own headless context or use 'createHeadlessContext' from @luma.gl/test-utils`),e=Object.assign({},FV,e);let{width:t,height:r}=e;function i(c){if(e.throwOnError)throw new Error(c);return console.error(c),null}e.onError=i;let s,{canvas:n}=e,o=Gnt({canvas:n,width:t,height:r,onError:i});return s=jnt(o,e),s?(s=q0(s,e),Wnt(s),s):null}function q0(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||e._instrumented)return e;e._version=e._version||Hnt(e),e.luma=e.luma||{},e.luma.canvasSizeInfo=e.luma.canvasSizeInfo||{},t=Object.assign({},FV,t);let{manageState:r,debug:i}=t;return r&&lE(e,{copyState:!1,log:function(){for(var s=arguments.length,n=new Array(s),o=0;o1&&arguments[1]!==void 0?arguments[1]:{};if(e.canvas){let i=BV(t.useDevicePixels);qnt(e,i,t);return}let r=e.getExtension(\"STACKGL_resize_drawingbuffer\");r&&\"width\"in t&&\"height\"in t&&r.resize(t.width,t.height)}function jnt(e,t){let{onError:r}=t,i=null,s=f=>i=f.statusMessage||i;e.addEventListener(\"webglcontextcreationerror\",s,!1);let{webgl1:n=!0,webgl2:o=!0}=t,c=null;return o&&(c=c||e.getContext(\"webgl2\",t),c=c||e.getContext(\"experimental-webgl2\",t)),n&&(c=c||e.getContext(\"webgl\",t),c=c||e.getContext(\"experimental-webgl\",t)),e.removeEventListener(\"webglcontextcreationerror\",s,!1),c?(t.onContextLost&&e.addEventListener(\"webglcontextlost\",t.onContextLost,!1),t.onContextRestored&&e.addEventListener(\"webglcontextrestored\",t.onContextRestored,!1),c):r(\"Failed to create \".concat(o&&!n?\"WebGL2\":\"WebGL\",\" context: \").concat(i||\"Unknown error\"))}function Gnt(e){let{canvas:t,width:r=800,height:i=600,onError:s}=e,n;return typeof t==\"string\"?(Vnt&&document.readyState===\"complete\"||s(\"createGLContext called on canvas '\".concat(t,\"' before page was loaded\")),n=document.getElementById(t)):t?n=t:(n=document.createElement(\"canvas\"),n.id=\"lumagl-canvas\",n.style.width=Number.isFinite(r)?\"\".concat(r,\"px\"):\"100%\",n.style.height=Number.isFinite(i)?\"\".concat(i,\"px\"):\"100%\",document.body.insertBefore(n,document.body.firstChild)),n}function Wnt(e){let t=fr(e)?\"WebGL2\":\"WebGL1\",r=zV(e),i=r?\"(\".concat(r.vendor,\",\").concat(r.renderer,\")\"):\"\",s=e.debug?\" debug\":\"\";He.info(1,\"\".concat(t).concat(s,\" context \").concat(i))()}function Hnt(e){return typeof WebGL2RenderingContext<\"u\"&&e instanceof WebGL2RenderingContext?2:1}function qnt(e,t,r){let i=\"width\"in r?r.width:e.canvas.clientWidth,s=\"height\"in r?r.height:e.canvas.clientHeight;(!i||!s)&&(He.log(1,\"Canvas clientWidth/clientHeight is 0\")(),t=1,i=e.canvas.width||1,s=e.canvas.height||1),e.luma=e.luma||{},e.luma.canvasSizeInfo=e.luma.canvasSizeInfo||{};let n=e.luma.canvasSizeInfo;if(n.clientWidth!==i||n.clientHeight!==s||n.devicePixelRatio!==t){let o=t,c=Math.floor(i*o),f=Math.floor(s*o);e.canvas.width=c,e.canvas.height=f,(e.drawingBufferWidth!==c||e.drawingBufferHeight!==f)&&(He.warn(\"Device pixel ratio clamped\")(),o=Math.min(e.drawingBufferWidth/i,e.drawingBufferHeight/s),e.canvas.width=Math.floor(i*o),e.canvas.height=Math.floor(s*o)),Object.assign(e.luma.canvasSizeInfo,{clientWidth:i,clientHeight:s,devicePixelRatio:t})}}function fb(){let e;if(typeof window<\"u\"&&window.performance)e=window.performance.now();else if(typeof process<\"u\"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Z0=class{constructor(t,r){G(this,\"name\",void 0),G(this,\"type\",void 0),G(this,\"sampleSize\",1),G(this,\"time\",void 0),G(this,\"count\",void 0),G(this,\"samples\",void 0),G(this,\"lastTiming\",void 0),G(this,\"lastSampleTime\",void 0),G(this,\"lastSampleCount\",void 0),G(this,\"_count\",0),G(this,\"_time\",0),G(this,\"_samples\",0),G(this,\"_startTime\",0),G(this,\"_timerPending\",!1),this.name=t,this.type=r,this.reset()}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=fb(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(fb()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var Gf=class{constructor(t){G(this,\"id\",void 0),G(this,\"stats\",{}),this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:\"count\";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t in this.stats)this.stats[t].reset();return this}forEach(t){for(let r in this.stats)t(this.stats[r])}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){if(!t||!t.name)return null;let{name:r,type:i}=t;return this.stats[r]||(t instanceof Z0?this.stats[r]=t:this.stats[r]=new Z0(r,i)),this.stats[r]}};var db=\"8.5.21\",Znt=\"set luma.log.level=1 (or higher) to trace rendering\",pR=class{constructor(){this.stats=new Map}get(t){return this.stats.has(t)||this.stats.set(t,new Gf({id:t})),this.stats.get(t)}},Du=new pR;if(globalThis.luma&&globalThis.luma.VERSION!==db)throw new Error(\"luma.gl - multiple VERSIONs detected: \".concat(globalThis.luma.VERSION,\" vs \").concat(db));globalThis.luma||(Lo()&&He.log(1,\"luma.gl \".concat(db,\" - \").concat(Znt))(),globalThis.luma=globalThis.luma||{VERSION:db,version:db,log:He,stats:Du,globals:{modules:{},nodeIO:{}}});var _3t=globalThis.luma;function AR(e){return typeof window<\"u\"&&window.requestAnimationFrame?window.requestAnimationFrame(e):setTimeout(e,1e3/60)}function mR(e){return typeof window<\"u\"&&window.cancelAnimationFrame?window.cancelAnimationFrame(e):clearTimeout(e)}function ye(e,t){if(!e)throw new Error(t||\"luma.gl: assertion failed.\")}function hE(e,t){if(typeof t!=\"string\")return t;let r=Number(t);if(!isNaN(r))return r;t=t.replace(/^.*\\./,\"\");let i=e[t];return ye(i!==void 0,\"Accessing undefined constant GL.\".concat(t)),i}function Ou(e,t){t=Number(t);for(let r in e)if(e[r]===t)return\"GL.\".concat(r);return String(t)}var gR={};function ta(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:\"id\";gR[e]=gR[e]||1;let t=gR[e]++;return\"\".concat(e,\"-\").concat(t)}function _R(e){return ye(typeof e==\"number\",\"Input must be a number\"),e&&(e&e-1)===0}function Wf(e){let t=!0;for(let r in e){t=!1;break}return t}function fE(e,t,r,i){let s=\"See luma.gl \".concat(r,\" Upgrade Guide at https://luma.gl/docs/upgrade-guide\"),n=Object.getPrototypeOf(e);i.forEach(o=>{n.methodName||(n[o]=()=>{throw He.removed(\"Calling removed method \".concat(t,\".\").concat(o,\": \"),s)(),new Error(o)})})}var My=\"Resource subclass must define virtual methods\",Js=class{get[Symbol.toStringTag](){return\"Resource\"}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};tp(t);let{id:i,userData:s={}}=r;this.gl=t,this.gl2=t,this.id=i||ta(this[Symbol.toStringTag]),this.userData=s,this._bound=!1,this._handle=r.handle,this._handle===void 0&&(this._handle=this._createHandle()),this.byteLength=0,this._addStats()}toString(){return\"\".concat(this[Symbol.toStringTag]||this.constructor.name,\"(\").concat(this.id,\")\")}get handle(){return this._handle}delete(){let{deleteChildren:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=this._handle&&this._deleteHandle(this._handle);return this._handle&&this._removeStats(),this._handle=null,r&&t&&r.filter(Boolean).forEach(i=>i.delete()),this}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.handle;if(typeof t!=\"function\")return this._bindHandle(t),this;let r;return this._bound?r=t():(this._bindHandle(this.handle),this._bound=!0,r=t(),this._bound=!1,this._bindHandle(null)),r}unbind(){this.bind(null)}getParameter(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};t=hE(this.gl,t),ye(t);let s=(this.constructor.PARAMETERS||{})[t];if(s){let n=fr(this.gl);if(!((!(\"webgl2\"in s)||n)&&(!(\"extension\"in s)||this.gl.getExtension(s.extension)))){let c=s.webgl1,f=\"webgl2\"in s?s.webgl2:s.webgl1;return n?f:c}}return this._getParameter(t,r)}getParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{parameters:r,keys:i}=t,s=this.constructor.PARAMETERS||{},n=fr(this.gl),o={},c=r||Object.keys(s);for(let f of c){let _=s[f];if(_&&(!(\"webgl2\"in _)||n)&&(!(\"extension\"in _)||this.gl.getExtension(_.extension))){let I=i?Ou(this.gl,f):f;o[I]=this.getParameter(f,t),i&&_.type===\"GLenum\"&&(o[I]=Ou(this.gl,o[I]))}}return o}setParameter(t,r){t=hE(this.gl,t),ye(t);let s=(this.constructor.PARAMETERS||{})[t];if(s){let n=fr(this.gl);if(!((!(\"webgl2\"in s)||n)&&(!(\"extension\"in s)||this.gl.getExtension(s.extension))))throw new Error(\"Parameter not available on this platform\");s.type===\"GLenum\"&&(r=hE(r))}return this._setParameter(t,r),this}setParameters(t){for(let r in t)this.setParameter(r,t[r]);return this}stubRemovedMethods(t,r,i){return fE(this,t,r,i)}initialize(t){}_createHandle(){throw new Error(My)}_deleteHandle(){throw new Error(My)}_bindHandle(t){throw new Error(My)}_getOptsFromHandle(){throw new Error(My)}_getParameter(t,r){throw new Error(My)}_setParameter(t,r){throw new Error(My)}_context(){return this.gl.luma=this.gl.luma||{},this.gl.luma}_addStats(){let t=this[Symbol.toStringTag],r=Du.get(\"Resource Counts\");r.get(\"Resources Created\").incrementCount(),r.get(\"\".concat(t,\"s Created\")).incrementCount(),r.get(\"\".concat(t,\"s Active\")).incrementCount()}_removeStats(){let t=this[Symbol.toStringTag];Du.get(\"Resource Counts\").get(\"\".concat(t,\"s Active\")).decrementCount()}_trackAllocatedMemory(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag];this._trackAllocatedMemoryForContext(t,r),this._trackAllocatedMemoryForContext(t,r,this.gl.canvas&&this.gl.canvas.id),this.byteLength=t}_trackAllocatedMemoryForContext(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:\"\",s=Du.get(\"Memory Usage\".concat(i));s.get(\"GPU Memory\").addCount(t),s.get(\"\".concat(r,\" Memory\")).addCount(t)}_trackDeallocatedMemory(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag];this._trackDeallocatedMemoryForContext(t),this._trackDeallocatedMemoryForContext(t,this.gl.canvas&&this.gl.canvas.id),this.byteLength=0}_trackDeallocatedMemoryForContext(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:\"\",i=Du.get(\"Memory Usage\".concat(r));i.get(\"GPU Memory\").subtractCount(this.byteLength),i.get(\"\".concat(t,\" Memory\")).subtractCount(this.byteLength)}};var Ynt=\"Failed to deduce GL constant from typed array\";function pb(e){switch(ArrayBuffer.isView(e)?e.constructor:e){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(Ynt)}}function HA(e){let{clamped:t=!0}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};switch(e){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return t?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error(\"Failed to deduce typed array type from GL constant\")}}function NV(e){let{data:t,width:r,height:i,bytesPerPixel:s=4,temp:n}=e,o=r*s;n=n||new Uint8Array(o);for(let c=0;cthis._assign(s)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return e.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return e.getBytesPerVertex(this)}_assign(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t=Ab(\"Accessor\",t,$nt),t.type!==void 0&&(this.type=t.type,(t.type===5124||t.type===5125)&&(this.integer=!0)),t.size!==void 0&&(this.size=t.size),t.offset!==void 0&&(this.offset=t.offset),t.stride!==void 0&&(this.stride=t.stride),t.normalized!==void 0&&(this.normalized=t.normalized),t.integer!==void 0&&(this.integer=t.integer),t.divisor!==void 0&&(this.divisor=t.divisor),t.buffer!==void 0&&(this.buffer=t.buffer),t.index!==void 0&&(typeof t.index==\"boolean\"?this.index=t.index?1:0:this.index=t.index),t.instanced!==void 0&&(this.divisor=t.instanced?1:0),t.isInstanced!==void 0&&(this.divisor=t.isInstanced?1:0),this}};var VV=10,jV={offset:\"accessor.offset\",stride:\"accessor.stride\",type:\"accessor.type\",size:\"accessor.size\",divisor:\"accessor.divisor\",normalized:\"accessor.normalized\",integer:\"accessor.integer\",instanced:\"accessor.divisor\",isInstanced:\"accessor.divisor\"},Xnt={removedProps:{},replacedProps:{bytes:\"byteLength\"},deprecatedProps:jV},Knt={removedProps:jV},Fr=class extends Js{get[Symbol.toStringTag](){return\"Buffer\"}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.stubRemovedMethods(\"Buffer\",\"v6.0\",[\"layout\",\"setLayout\",\"getIndexedParameter\"]),this.target=r.target||(this.gl.webgl2?36662:34962),this.initialize(r),Object.seal(this)}getElementCount(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.accessor;return Math.round(this.byteLength/Pl.getBytesPerElement(t))}getVertexCount(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.accessor;return Math.round(this.byteLength/Pl.getBytesPerVertex(t))}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ArrayBuffer.isView(t)&&(t={data:t}),Number.isFinite(t)&&(t={byteLength:t}),t=Ab(\"Buffer\",t,Xnt),this.usage=t.usage||35044,this.debugData=null,this.setAccessor(Object.assign({},t,t.accessor)),t.data?this._setData(t.data,t.offset,t.byteLength):this._setByteLength(t.byteLength||0),this}setProps(t){return t=Ab(\"Buffer\",t,Knt),\"accessor\"in t&&this.setAccessor(t.accessor),this}setAccessor(t){return t=Object.assign({},t),delete t.buffer,this.accessor=new Pl(t),this}reallocate(t){return t>this.byteLength?(this._setByteLength(t),!0):(this.bytesUsed=t,!1)}setData(t){return this.initialize(t)}subData(t){ArrayBuffer.isView(t)&&(t={data:t});let{data:r,offset:i=0,srcOffset:s=0}=t,n=t.byteLength||t.length;ye(r);let o=this.gl.webgl2?36663:this.target;return this.gl.bindBuffer(o,this.handle),s!==0||n!==void 0?(Yn(this.gl),this.gl.bufferSubData(this.target,i,r,s,n)):this.gl.bufferSubData(o,i,r),this.gl.bindBuffer(o,null),this.debugData=null,this._inferType(r),this}copyData(t){let{sourceBuffer:r,readOffset:i=0,writeOffset:s=0,size:n}=t,{gl:o}=this;return Yn(o),o.bindBuffer(36662,r.handle),o.bindBuffer(36663,this.handle),o.copyBufferSubData(36662,36663,i,s,n),o.bindBuffer(36662,null),o.bindBuffer(36663,null),this.debugData=null,this}getData(){let{dstData:t=null,srcByteOffset:r=0,dstOffset:i=0,length:s=0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Yn(this.gl);let n=HA(this.accessor.type||5126,{clamped:!1}),o=this._getAvailableElementCount(r),c=i,f,_;t?(_=t.length,f=_-c):(f=Math.min(o,s||o),_=c+f);let w=Math.min(o,f);return s=s||w,ye(s<=w),t=t||new n(_),this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,r,t,i,s),this.gl.bindBuffer(36662,null),t}bind(){let{target:t=this.target,index:r=this.accessor&&this.accessor.index,offset:i=0,size:s}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t===35345||t===35982?s!==void 0?this.gl.bindBufferRange(t,r,this.handle,i,s):(ye(i===0),this.gl.bindBufferBase(t,r,this.handle)):this.gl.bindBuffer(t,this.handle),this}unbind(){let{target:t=this.target,index:r=this.accessor&&this.accessor.index}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t===35345||t===35982?this.gl.bindBufferBase(t,r,null):this.gl.bindBuffer(t,null),this}getDebugData(){return this.debugData?{data:this.debugData,changed:!1}:(this.debugData=this.getData({length:Math.min(VV,this.byteLength)}),{data:this.debugData,changed:!0})}invalidateDebugData(){this.debugData=null}_setData(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.byteLength+r;ye(ArrayBuffer.isView(t)),this._trackDeallocatedMemory();let s=this._getTarget();this.gl.bindBuffer(s,this.handle),this.gl.bufferData(s,i,this.usage),this.gl.bufferSubData(s,r,t),this.gl.bindBuffer(s,null),this.debugData=t.slice(0,VV),this.bytesUsed=i,this._trackAllocatedMemory(i);let n=pb(t);return ye(n),this.setAccessor(new Pl(this.accessor,{type:n})),this}_setByteLength(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.usage;ye(t>=0),this._trackDeallocatedMemory();let i=t;t===0&&(i=new Float32Array(0));let s=this._getTarget();return this.gl.bindBuffer(s,this.handle),this.gl.bufferData(s,i,r),this.gl.bindBuffer(s,null),this.usage=r,this.debugData=null,this.bytesUsed=t,this._trackAllocatedMemory(t),this}_getTarget(){return this.gl.webgl2?36663:this.target}_getAvailableElementCount(t){let r=HA(this.accessor.type||5126,{clamped:!1}),i=t/r.BYTES_PER_ELEMENT;return this.getElementCount()-i}_inferType(t){this.accessor.type||this.setAccessor(new Pl(this.accessor,{type:pb(t)}))}_createHandle(){return this.gl.createBuffer()}_deleteHandle(){this.gl.deleteBuffer(this.handle),this._trackDeallocatedMemory()}_getParameter(t){this.gl.bindBuffer(this.target,this.handle);let r=this.gl.getBufferParameter(this.target,t);return this.gl.bindBuffer(this.target,null),r}get type(){return He.deprecated(\"Buffer.type\",\"Buffer.accessor.type\")(),this.accessor.type}get bytes(){return He.deprecated(\"Buffer.bytes\",\"Buffer.byteLength\")(),this.byteLength}setByteLength(t){return He.deprecated(\"setByteLength\",\"reallocate\")(),this.reallocate(t)}updateAccessor(t){return He.deprecated(\"updateAccessor(...)\",\"setAccessor(new Accessor(buffer.accessor, ...)\")(),this.accessor=new Pl(this.accessor,t),this}};var dE={6407:{dataFormat:6407,types:[5121,33635]},6408:{dataFormat:6408,types:[5121,32819,32820]},6406:{dataFormat:6406,types:[5121]},6409:{dataFormat:6409,types:[5121]},6410:{dataFormat:6410,types:[5121]},33326:{dataFormat:6403,types:[5126],gl2:!0},33328:{dataFormat:33319,types:[5126],gl2:!0},34837:{dataFormat:6407,types:[5126],gl2:!0},34836:{dataFormat:6408,types:[5126],gl2:!0}},pE={6403:1,36244:1,33319:2,33320:2,6407:3,36248:3,6408:4,36249:4,6402:1,34041:1,6406:1,6409:1,6410:2},AE={5126:4,5125:4,5124:4,5123:2,5122:2,5131:2,5120:1,5121:1};function GV(e,t){let r=dE[t];if(!r)return!1;if(r.gl1===void 0&&r.gl2===void 0)return!0;let i=fr(e)&&r.gl2||r.gl1;return typeof i==\"string\"?e.getExtension(i):i}function WV(e,t){let r=dE[t];switch(r&&r.types[0]){case 5126:return e.getExtension(\"OES_texture_float_linear\");case 5131:return e.getExtension(\"OES_texture_half_float_linear\");default:return!0}}var Jnt=[9729,9728],HV=globalThis.WebGLBuffer||function(){},tl=class extends Js{get[Symbol.toStringTag](){return\"Texture\"}static isSupported(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{format:i,linearFiltering:s}=r,n=!0;return i&&(n=n&&GV(t,i),n=n&&(!s||WV(t,i))),n}constructor(t,r){let{id:i=ta(\"texture\"),handle:s,target:n}=r;super(t,{id:i,handle:s}),this.target=n,this.textureUnit=void 0,this.loaded=!1,this.width=void 0,this.height=void 0,this.depth=void 0,this.format=void 0,this.type=void 0,this.dataFormat=void 0,this.border=void 0,this.textureUnit=void 0,this.mipmaps=void 0}toString(){return\"Texture(\".concat(this.id,\",\").concat(this.width,\"x\").concat(this.height,\")\")}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.data;if(r instanceof Promise)return r.then(K=>this.initialize(Object.assign({},t,{pixels:K,data:K}))),this;let i=typeof HTMLVideoElement<\"u\"&&r instanceof HTMLVideoElement;if(i&&r.readyStatethis.initialize(t)),this;let{pixels:s=null,format:n=6408,border:o=0,recreate:c=!1,parameters:f={},pixelStore:_={},textureUnit:w=void 0}=t;r||(r=s);let{width:I,height:R,dataFormat:N,type:j,compressed:Q=!1,mipmaps:et=!0}=t,{depth:Y=0}=t;return{width:I,height:R,compressed:Q,dataFormat:N,type:j}=this._deduceParameters({format:n,type:j,dataFormat:N,compressed:Q,data:r,width:I,height:R}),this.width=I,this.height=R,this.depth=Y,this.format=n,this.type=j,this.dataFormat=N,this.border=o,this.textureUnit=w,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),et&&this._isNPOT()&&(He.warn(\"texture: \".concat(this,\" is Non-Power-Of-Two, disabling mipmaping\"))(),et=!1,this._updateForNPOT(f)),this.mipmaps=et,this.setImageData({data:r,width:I,height:R,depth:Y,format:n,type:j,dataFormat:N,border:o,mipmaps:et,parameters:_,compressed:Q}),et&&this.generateMipmap(),this.setParameters(f),c&&(this.data=r),i&&(this._video={video:r,parameters:f,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}update(){if(this._video){let{video:t,parameters:r,lastTime:i}=this._video;if(i===t.currentTime||t.readyState0&&arguments[0]!==void 0?arguments[0]:{};return this._isNPOT()?(He.warn(\"texture: \".concat(this,\" is Non-Power-Of-Two, disabling mipmaping\"))(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),Mn(this.gl,t,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this)}setImageData(t){this._trackDeallocatedMemory(\"Texture\");let{target:r=this.target,pixels:i=null,level:s=0,format:n=this.format,border:o=this.border,offset:c=0,parameters:f={}}=t,{data:_=null,type:w=this.type,width:I=this.width,height:R=this.height,dataFormat:N=this.dataFormat,compressed:j=!1}=t;_||(_=i),{type:w,dataFormat:N,compressed:j,width:I,height:R}=this._deduceParameters({format:n,type:w,dataFormat:N,compressed:j,data:_,width:I,height:R});let{gl:Q}=this;Q.bindTexture(this.target,this.handle);let et=null;({data:_,dataType:et}=this._getDataType({data:_,compressed:j}));let Y,K=0;if(Mn(this.gl,f,()=>{switch(et){case\"null\":Q.texImage2D(r,s,n,I,R,o,N,w,_);break;case\"typed-array\":Q.texImage2D(r,s,n,I,R,o,N,w,_,c);break;case\"buffer\":Y=Yn(Q),Y.bindBuffer(35052,_.handle||_),Y.texImage2D(r,s,n,I,R,o,N,w,c),Y.bindBuffer(35052,null);break;case\"browser-object\":fr(Q)?Q.texImage2D(r,s,n,I,R,o,N,w,_):Q.texImage2D(r,s,n,N,w,_);break;case\"compressed\":for(let[J,ut]of _.entries())Q.compressedTexImage2D(r,J,ut.format,ut.width,ut.height,o,ut.data),K+=ut.levelSize;break;default:ye(!1,\"Unknown image data type\")}}),et===\"compressed\")this._trackAllocatedMemory(K,\"Texture\");else if(_&&_.byteLength)this._trackAllocatedMemory(_.byteLength,\"Texture\");else{let J=pE[this.dataFormat]||4,ut=AE[this.type]||1;this._trackAllocatedMemory(this.width*this.height*J*ut,\"Texture\")}return this.loaded=!0,this}setSubImageData(t){let{target:r=this.target,pixels:i=null,data:s=null,x:n=0,y:o=0,width:c=this.width,height:f=this.height,level:_=0,format:w=this.format,type:I=this.type,dataFormat:R=this.dataFormat,compressed:N=!1,offset:j=0,border:Q=this.border,parameters:et={}}=t;if({type:I,dataFormat:R,compressed:N,width:c,height:f}=this._deduceParameters({format:w,type:I,dataFormat:R,compressed:N,data:s,width:c,height:f}),ye(this.depth===0,\"texSubImage not supported for 3D textures\"),s||(s=i),s&&s.data){let Y=s;s=Y.data,c=Y.shape[0],f=Y.shape[1]}s instanceof Fr&&(s=s.handle),this.gl.bindTexture(this.target,this.handle),Mn(this.gl,et,()=>{if(N)this.gl.compressedTexSubImage2D(r,_,n,o,c,f,w,s);else if(s===null)this.gl.texSubImage2D(r,_,n,o,c,f,R,I,null);else if(ArrayBuffer.isView(s))this.gl.texSubImage2D(r,_,n,o,c,f,R,I,s,j);else if(s instanceof HV){let Y=Yn(this.gl);Y.bindBuffer(35052,s),Y.texSubImage2D(r,_,n,o,c,f,R,I,j),Y.bindBuffer(35052,null)}else fr(this.gl)?Yn(this.gl).texSubImage2D(r,_,n,o,c,f,R,I,s):this.gl.texSubImage2D(r,_,n,o,R,I,s)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.error(\"Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})\")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.target,this.handle),t}unbind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.target,null),t}_getDataType(t){let{data:r,compressed:i=!1}=t;return i?{data:r,dataType:\"compressed\"}:r===null?{data:r,dataType:\"null\"}:ArrayBuffer.isView(r)?{data:r,dataType:\"typed-array\"}:r instanceof Fr?{data:r.handle,dataType:\"buffer\"}:r instanceof HV?{data:r,dataType:\"buffer\"}:{data:r,dataType:\"browser-object\"}}_deduceParameters(t){let{format:r,data:i}=t,{width:s,height:n,dataFormat:o,type:c,compressed:f}=t,_=dE[r];return o=o||_&&_.dataFormat,c=c||_&&_.types[0],f=f||_&&_.compressed,{width:s,height:n}=this._deduceImageSize(i,s,n),{dataFormat:o,type:c,compressed:f,width:s,height:n,format:r,data:i}}_deduceImageSize(t,r,i){let s;return typeof ImageData<\"u\"&&t instanceof ImageData?s={width:t.width,height:t.height}:typeof HTMLImageElement<\"u\"&&t instanceof HTMLImageElement?s={width:t.naturalWidth,height:t.naturalHeight}:typeof HTMLCanvasElement<\"u\"&&t instanceof HTMLCanvasElement?s={width:t.width,height:t.height}:typeof ImageBitmap<\"u\"&&t instanceof ImageBitmap?s={width:t.width,height:t.height}:typeof HTMLVideoElement<\"u\"&&t instanceof HTMLVideoElement?s={width:t.videoWidth,height:t.videoHeight}:t?s={width:r,height:i}:s={width:r>=0?r:1,height:i>=0?i:1},ye(s,\"Could not deduced texture size\"),ye(r===void 0||s.width===r,\"Deduced texture width does not match supplied width\"),ye(i===void 0||s.height===i,\"Deduced texture height does not match supplied height\"),s}_createHandle(){return this.gl.createTexture()}_deleteHandle(){this.gl.deleteTexture(this.handle),this._trackDeallocatedMemory(\"Texture\")}_getParameter(t){switch(t){case 4096:return this.width;case 4097:return this.height;default:this.gl.bindTexture(this.target,this.handle);let r=this.gl.getTexParameter(this.target,t);return this.gl.bindTexture(this.target,null),r}}_setParameter(t,r){switch(this.gl.bindTexture(this.target,this.handle),r=this._getNPOTParam(t,r),t){case 33082:case 33083:this.gl.texParameterf(this.handle,t,r);break;case 4096:case 4097:ye(!1);break;default:this.gl.texParameteri(this.target,t,r);break}return this.gl.bindTexture(this.target,null),this}_isNPOT(){return fr(this.gl)||!this.width||!this.height?!1:!_R(this.width)||!_R(this.height)}_updateForNPOT(t){t[this.gl.TEXTURE_MIN_FILTER]===void 0&&(t[this.gl.TEXTURE_MIN_FILTER]=this.gl.LINEAR),t[this.gl.TEXTURE_WRAP_S]===void 0&&(t[this.gl.TEXTURE_WRAP_S]=this.gl.CLAMP_TO_EDGE),t[this.gl.TEXTURE_WRAP_T]===void 0&&(t[this.gl.TEXTURE_WRAP_T]=this.gl.CLAMP_TO_EDGE)}_getNPOTParam(t,r){if(this._isNPOT())switch(t){case 10241:Jnt.indexOf(r)===-1&&(r=9729);break;case 10242:case 10243:r!==33071&&(r=33071);break;default:break}return r}};var tst=\"\";function qV(e,t){return ye(typeof e==\"string\"),e=tst+e,new Promise((r,i)=>{try{let s=new Image;s.onload=()=>r(s),s.onerror=()=>i(new Error(\"Could not load image \".concat(e,\".\"))),s.crossOrigin=t&&t.crossOrigin||\"anonymous\",s.src=e}catch(s){i(s)}})}var pi=class extends tl{get[Symbol.toStringTag](){return\"Texture2D\"}static isSupported(t,r){return tl.isSupported(t,r)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};tp(t),(r instanceof Promise||typeof r==\"string\")&&(r={data:r}),typeof r.data==\"string\"&&(r=Object.assign({},r,{data:qV(r.data)})),super(t,Object.assign({},r,{target:3553})),this.initialize(r),Object.seal(this)}};var yR=[34069,34070,34071,34072,34073,34074],Y0=class extends tl{get[Symbol.toStringTag](){return\"TextureCube\"}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};tp(t),super(t,Object.assign({},r,{target:34067})),this.initialize(r),Object.seal(this)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{mipmaps:r=!0,parameters:i={}}=t;return this.opts=t,this.setCubeMapImageData(t).then(()=>{this.loaded=!0,r&&this.generateMipmap(t),this.setParameters(i)}),this}subImage(t){let{face:r,data:i,x:s=0,y:n=0,mipmapLevel:o=0}=t;return this._subImage({target:r,data:i,x:s,y:n,mipmapLevel:o})}async setCubeMapImageData(t){let{width:r,height:i,pixels:s,data:n,border:o=0,format:c=6408,type:f=5121}=t,{gl:_}=this,w=s||n,I=await Promise.all(yR.map(R=>{let N=w[R];return Promise.all(Array.isArray(N)?N:[N])}));this.bind(),yR.forEach((R,N)=>{I[N].length>1&&this.opts.mipmaps!==!1&&He.warn(\"\".concat(this.id,\" has mipmap and multiple LODs.\"))(),I[N].forEach((j,Q)=>{r&&i?_.texImage2D(R,Q,c,r,i,o,c,f,j):_.texImage2D(R,Q,c,c,f,j)})}),this.unbind()}setImageDataForFace(t){let{face:r,width:i,height:s,pixels:n,data:o,border:c=0,format:f=6408,type:_=5121}=t,{gl:w}=this,I=n||o;return this.bind(),I instanceof Promise?I.then(R=>this.setImageDataForFace(Object.assign({},t,{face:r,data:R,pixels:R}))):this.width||this.height?w.texImage2D(r,0,f,i,s,c,f,_,I):w.texImage2D(r,0,f,f,_,I),this}};Y0.FACES=yR;var Ey=class extends tl{get[Symbol.toStringTag](){return\"Texture3D\"}static isSupported(t){return fr(t)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Yn(t),r=Object.assign({depth:1},r,{target:32879,unpackFlipY:!1}),super(t,r),this.initialize(r),Object.seal(this)}setImageData(t){let{level:r=0,dataFormat:i=6408,width:s,height:n,depth:o=1,border:c=0,format:f,type:_=5121,offset:w=0,data:I,parameters:R={}}=t;if(this._trackDeallocatedMemory(\"Texture\"),this.gl.bindTexture(this.target,this.handle),Mn(this.gl,R,()=>{ArrayBuffer.isView(I)&&this.gl.texImage3D(this.target,r,i,s,n,o,c,f,_,I),I instanceof Fr&&(this.gl.bindBuffer(35052,I.handle),this.gl.texImage3D(this.target,r,i,s,n,o,c,f,_,w))}),I&&I.byteLength)this._trackAllocatedMemory(I.byteLength,\"Texture\");else{let N=pE[this.dataFormat]||4,j=AE[this.type]||1;this._trackAllocatedMemory(this.width*this.height*this.depth*N*j,\"Texture\")}return this.loaded=!0,this}};var Q0=\"EXT_color_buffer_float\",vR={33189:{bpp:2},33190:{gl2:!0,bpp:3},36012:{gl2:!0,bpp:4},36168:{bpp:1},34041:{bpp:4},35056:{gl2:!0,bpp:4},36013:{gl2:!0,bpp:5},32854:{bpp:2},36194:{bpp:2},32855:{bpp:2},33321:{gl2:!0,bpp:1},33330:{gl2:!0,bpp:1},33329:{gl2:!0,bpp:1},33332:{gl2:!0,bpp:2},33331:{gl2:!0,bpp:2},33334:{gl2:!0,bpp:4},33333:{gl2:!0,bpp:4},33323:{gl2:!0,bpp:2},33336:{gl2:!0,bpp:2},33335:{gl2:!0,bpp:2},33338:{gl2:!0,bpp:4},33337:{gl2:!0,bpp:4},33340:{gl2:!0,bpp:8},33339:{gl2:!0,bpp:8},32849:{gl2:!0,bpp:3},32856:{gl2:!0,bpp:4},32857:{gl2:!0,bpp:4},36220:{gl2:!0,bpp:4},36238:{gl2:!0,bpp:4},36975:{gl2:!0,bpp:4},36214:{gl2:!0,bpp:8},36232:{gl2:!0,bpp:8},36226:{gl2:!0,bpp:16},36208:{gl2:!0,bpp:16},33325:{gl2:Q0,bpp:2},33327:{gl2:Q0,bpp:4},34842:{gl2:Q0,bpp:8},33326:{gl2:Q0,bpp:4},33328:{gl2:Q0,bpp:8},34836:{gl2:Q0,bpp:16},35898:{gl2:Q0,bpp:4}};function est(e,t,r){let i=r[t];if(!i)return!1;let s=fr(e)&&i.gl2||i.gl1;return typeof s==\"string\"?e.getExtension(s):s}var el=class extends Js{get[Symbol.toStringTag](){return\"Renderbuffer\"}static isSupported(t){let{format:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{format:null};return!r||est(t,r,vR)}static getSamplesForFormat(t,r){let{format:i}=r;return t.getInternalformatParameter(36161,i,32937)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.initialize(r),Object.seal(this)}initialize(t){let{format:r,width:i=1,height:s=1,samples:n=0}=t;return ye(r,\"Needs format\"),this._trackDeallocatedMemory(),this.gl.bindRenderbuffer(36161,this.handle),n!==0&&fr(this.gl)?this.gl.renderbufferStorageMultisample(36161,n,r,i,s):this.gl.renderbufferStorage(36161,r,i,s),this.format=r,this.width=i,this.height=s,this.samples=n,this._trackAllocatedMemory(this.width*this.height*(this.samples||1)*vR[this.format].bpp),this}resize(t){let{width:r,height:i}=t;return r!==this.width||i!==this.height?this.initialize({width:r,height:i,format:this.format,samples:this.samples}):this}_createHandle(){return this.gl.createRenderbuffer()}_deleteHandle(){this.gl.deleteRenderbuffer(this.handle),this._trackDeallocatedMemory()}_bindHandle(t){this.gl.bindRenderbuffer(36161,t)}_syncHandle(t){this.format=this.getParameter(36164),this.width=this.getParameter(36162),this.height=this.getParameter(36163),this.samples=this.getParameter(36011)}_getParameter(t){return this.gl.bindRenderbuffer(36161,this.handle),this.gl.getRenderbufferParameter(36161,t)}};var rst=256,ist=1024,nst=16384,ZV=6144,YV=6145,QV=6146,$V=34041,XV=\"clear: bad arguments\";function Hf(e){let{framebuffer:t=null,color:r=null,depth:i=null,stencil:s=null}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n={};t&&(n.framebuffer=t);let o=0;r&&(o|=nst,r!==!0&&(n.clearColor=r)),i&&(o|=rst,i!==!0&&(n.clearDepth=i)),s&&(o|=ist,i!==!0&&(n.clearStencil=i)),ye(o!==0,XV),Mn(e,n,()=>{e.clear(o)})}function xR(e){let{framebuffer:t=null,buffer:r=ZV,drawBuffer:i=0,value:s=[0,0,0,0]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Yn(e),Mn(e,{framebuffer:t},()=>{switch(r){case ZV:switch(s.constructor){case Int32Array:e.clearBufferiv(r,i,s);break;case Uint32Array:e.clearBufferuiv(r,i,s);break;case Float32Array:default:e.clearBufferfv(r,i,s)}break;case YV:e.clearBufferfv(YV,0,[s]);break;case QV:e.clearBufferiv(QV,0,[s]);break;case $V:let[n,o]=s;e.clearBufferfi($V,0,n,o);break;default:ye(!1,XV)}})}function KV(e){switch(e){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return ye(!1),0}}function Dh(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{sourceX:r=0,sourceY:i=0,sourceFormat:s=6408}=t,{sourceAttachment:n=36064,target:o=null,sourceWidth:c,sourceHeight:f,sourceType:_}=t,{framebuffer:w,deleteFramebuffer:I}=JV(e);ye(w);let{gl:R,handle:N,attachments:j}=w;c=c||w.width,f=f||w.height,n===36064&&N===null&&(n=1028),ye(j[n]),_=_||j[n].type,o=sst(o,_,s,c,f),_=_||pb(o);let Q=R.bindFramebuffer(36160,N);return R.readPixels(r,i,c,f,s,_,o),R.bindFramebuffer(36160,Q||null),I&&w.delete(),o}function mE(e){let{sourceAttachment:t=36064,targetMaxHeight:r=Number.MAX_SAFE_INTEGER}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=Dh(e,{sourceAttachment:t}),{width:s,height:n}=e;for(;n>r;)({data:i,width:s,height:n}=UV({data:i,width:s,height:n}));NV({data:i,width:s,height:n});let o=document.createElement(\"canvas\");o.width=s,o.height=n;let c=o.getContext(\"2d\"),f=c.createImageData(s,n);return f.data.set(i),c.putImageData(f,0,0),o.toDataURL()}function gE(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{sourceX:i=0,sourceY:s=0,targetMipmaplevel:n=0,targetInternalFormat:o=6408}=r,{targetX:c,targetY:f,targetZ:_,width:w,height:I}=r,{framebuffer:R,deleteFramebuffer:N}=JV(e);ye(R);let{gl:j,handle:Q}=R,et=typeof c<\"u\"||typeof f<\"u\"||typeof _<\"u\";c=c||0,f=f||0,_=_||0;let Y=j.bindFramebuffer(36160,Q);ye(t);let K=null;if(t instanceof tl&&(K=t,w=Number.isFinite(w)?w:K.width,I=Number.isFinite(I)?I:K.height,K.bind(0),t=K.target),!et)j.copyTexImage2D(t,n,o,i,s,w,I,0);else switch(t){case 3553:case 34067:j.copyTexSubImage2D(t,n,c,f,i,s,w,I);break;case 35866:case 32879:Yn(j).copyTexSubImage3D(t,n,c,f,_,i,s,w,I);break;default:}return K&&K.unbind(),j.bindFramebuffer(36160,Y||null),N&&R.delete(),K}function JV(e){return e instanceof yi?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:tj(e),deleteFramebuffer:!0}}function sst(e,t,r,i,s){if(e)return e;t=t||5121;let n=HA(t,{clamped:!1}),o=KV(r);return new n(i*s*o)}var Ii={WEBGL2:\"WEBGL2\",VERTEX_ARRAY_OBJECT:\"VERTEX_ARRAY_OBJECT\",TIMER_QUERY:\"TIMER_QUERY\",INSTANCED_RENDERING:\"INSTANCED_RENDERING\",MULTIPLE_RENDER_TARGETS:\"MULTIPLE_RENDER_TARGETS\",ELEMENT_INDEX_UINT32:\"ELEMENT_INDEX_UINT32\",BLEND_EQUATION_MINMAX:\"BLEND_EQUATION_MINMAX\",FLOAT_BLEND:\"FLOAT_BLEND\",COLOR_ENCODING_SRGB:\"COLOR_ENCODING_SRGB\",TEXTURE_DEPTH:\"TEXTURE_DEPTH\",TEXTURE_FLOAT:\"TEXTURE_FLOAT\",TEXTURE_HALF_FLOAT:\"TEXTURE_HALF_FLOAT\",TEXTURE_FILTER_LINEAR_FLOAT:\"TEXTURE_FILTER_LINEAR_FLOAT\",TEXTURE_FILTER_LINEAR_HALF_FLOAT:\"TEXTURE_FILTER_LINEAR_HALF_FLOAT\",TEXTURE_FILTER_ANISOTROPIC:\"TEXTURE_FILTER_ANISOTROPIC\",COLOR_ATTACHMENT_RGBA32F:\"COLOR_ATTACHMENT_RGBA32F\",COLOR_ATTACHMENT_FLOAT:\"COLOR_ATTACHMENT_FLOAT\",COLOR_ATTACHMENT_HALF_FLOAT:\"COLOR_ATTACHMENT_HALF_FLOAT\",GLSL_FRAG_DATA:\"GLSL_FRAG_DATA\",GLSL_FRAG_DEPTH:\"GLSL_FRAG_DEPTH\",GLSL_DERIVATIVES:\"GLSL_DERIVATIVES\",GLSL_TEXTURE_LOD:\"GLSL_TEXTURE_LOD\"};function ost(e){let t=new pi(e,{format:6408,type:5126,dataFormat:6408}),r=new yi(e,{id:\"test-framebuffer\",check:!1,attachments:{36064:t}}),i=r.getStatus();return t.delete(),r.delete(),i===36053}var bR={[Ii.WEBGL2]:[!1,!0],[Ii.VERTEX_ARRAY_OBJECT]:[\"OES_vertex_array_object\",!0],[Ii.TIMER_QUERY]:[\"EXT_disjoint_timer_query\",\"EXT_disjoint_timer_query_webgl2\"],[Ii.INSTANCED_RENDERING]:[\"ANGLE_instanced_arrays\",!0],[Ii.MULTIPLE_RENDER_TARGETS]:[\"WEBGL_draw_buffers\",!0],[Ii.ELEMENT_INDEX_UINT32]:[\"OES_element_index_uint\",!0],[Ii.BLEND_EQUATION_MINMAX]:[\"EXT_blend_minmax\",!0],[Ii.FLOAT_BLEND]:[\"EXT_float_blend\"],[Ii.COLOR_ENCODING_SRGB]:[\"EXT_sRGB\",!0],[Ii.TEXTURE_DEPTH]:[\"WEBGL_depth_texture\",!0],[Ii.TEXTURE_FLOAT]:[\"OES_texture_float\",!0],[Ii.TEXTURE_HALF_FLOAT]:[\"OES_texture_half_float\",!0],[Ii.TEXTURE_FILTER_LINEAR_FLOAT]:[\"OES_texture_float_linear\"],[Ii.TEXTURE_FILTER_LINEAR_HALF_FLOAT]:[\"OES_texture_half_float_linear\"],[Ii.TEXTURE_FILTER_ANISOTROPIC]:[\"EXT_texture_filter_anisotropic\"],[Ii.COLOR_ATTACHMENT_RGBA32F]:[ost,\"EXT_color_buffer_float\"],[Ii.COLOR_ATTACHMENT_FLOAT]:[!1,\"EXT_color_buffer_float\"],[Ii.COLOR_ATTACHMENT_HALF_FLOAT]:[\"EXT_color_buffer_half_float\"],[Ii.GLSL_FRAG_DATA]:[\"WEBGL_draw_buffers\",!0],[Ii.GLSL_FRAG_DEPTH]:[\"EXT_frag_depth\",!0],[Ii.GLSL_DERIVATIVES]:[\"OES_standard_derivatives\",!0],[Ii.GLSL_TEXTURE_LOD]:[\"EXT_shader_texture_lod\",!0]};var ast=2;function $0(e,t){return Oh(e,t)}function Oh(e,t){return t=Array.isArray(t)?t:[t],t.every(r=>ej(e,r))}function _E(e){e.luma=e.luma||{},e.luma.caps=e.luma.caps||{};for(let t in bR)e.luma.caps[t]===void 0&&(e.luma.caps[t]=ej(e,t));return e.luma.caps}function ej(e,t){return e.luma=e.luma||{},e.luma.caps=e.luma.caps||{},e.luma.caps[t]===void 0&&(e.luma.caps[t]=lst(e,t)),e.luma.caps[t]||He.log(ast,\"Feature: \".concat(t,\" not supported\"))(),e.luma.caps[t]}function lst(e,t){let r=bR[t];ye(r,t);let i,s=fr(e)&&r[1]||r[0];if(typeof s==\"function\")i=s(e);else if(Array.isArray(s)){i=!0;for(let n of s)i=i&&!!e.getExtension(n)}else typeof s==\"string\"?i=!!e.getExtension(s):typeof s==\"boolean\"?i=s:ye(!1);return i}var rj=\"Multiple render targets not supported\",yi=class e extends Js{get[Symbol.toStringTag](){return\"Framebuffer\"}static isSupported(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{colorBufferFloat:i,colorBufferHalfFloat:s}=r,n=!0;return i&&(n=!!(t.getExtension(\"EXT_color_buffer_float\")||t.getExtension(\"WEBGL_color_buffer_float\")||t.getExtension(\"OES_texture_float\"))),s&&(n=n&&!!(t.getExtension(\"EXT_color_buffer_float\")||t.getExtension(\"EXT_color_buffer_half_float\"))),n}static getDefaultFramebuffer(t){return t.luma=t.luma||{},t.luma.defaultFramebuffer=t.luma.defaultFramebuffer||new e(t,{id:\"default-framebuffer\",handle:null,attachments:{}}),t.luma.defaultFramebuffer}get MAX_COLOR_ATTACHMENTS(){let t=Yn(this.gl);return t.getParameter(t.MAX_COLOR_ATTACHMENTS)}get MAX_DRAW_BUFFERS(){let t=Yn(this.gl);return t.getParameter(t.MAX_DRAW_BUFFERS)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.width=null,this.height=null,this.attachments={},this.readBuffer=36064,this.drawBuffers=[36064],this.ownResources=[],this.initialize(r),Object.seal(this)}get color(){return this.attachments[36064]||null}get texture(){return this.attachments[36064]||null}get depth(){return this.attachments[36096]||this.attachments[33306]||null}get stencil(){return this.attachments[36128]||this.attachments[33306]||null}initialize(t){let{width:r=1,height:i=1,attachments:s=null,color:n=!0,depth:o=!0,stencil:c=!1,check:f=!0,readBuffer:_=void 0,drawBuffers:w=void 0}=t;if(ye(r>=0&&i>=0,\"Width and height need to be integers\"),this.width=r,this.height=i,s)for(let I in s){let R=s[I];(Array.isArray(R)?R[0]:R).resize({width:r,height:i})}else s=this._createDefaultAttachments(n,o,c,r,i);this.update({clearAttachments:!0,attachments:s,readBuffer:_,drawBuffers:w}),s&&f&&this.checkStatus()}delete(){for(let t of this.ownResources)t.delete();return super.delete(),this}update(t){let{attachments:r={},readBuffer:i,drawBuffers:s,clearAttachments:n=!1,resizeAttachments:o=!0}=t;this.attach(r,{clearAttachments:n,resizeAttachments:o});let{gl:c}=this,f=c.bindFramebuffer(36160,this.handle);return i&&this._setReadBuffer(i),s&&this._setDrawBuffers(s),c.bindFramebuffer(36160,f||null),this}resize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{width:r,height:i}=t;if(this.handle===null)return ye(r===void 0&&i===void 0),this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;r===void 0&&(r=this.gl.drawingBufferWidth),i===void 0&&(i=this.gl.drawingBufferHeight),r!==this.width&&i!==this.height&&He.log(2,\"Resizing framebuffer \".concat(this.id,\" to \").concat(r,\"x\").concat(i))();for(let s in this.attachments)this.attachments[s].resize({width:r,height:i});return this.width=r,this.height=i,this}attach(t){let{clearAttachments:r=!1,resizeAttachments:i=!0}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s={};r&&Object.keys(this.attachments).forEach(o=>{s[o]=null}),Object.assign(s,t);let n=this.gl.bindFramebuffer(36160,this.handle);for(let o in s){ye(o!==void 0,\"Misspelled framebuffer binding point?\");let c=Number(o),f=s[c],_=f;if(!_)this._unattach(c);else if(_ instanceof el)this._attachRenderbuffer({attachment:c,renderbuffer:_});else if(Array.isArray(f)){let[w,I=0,R=0]=f;_=w,this._attachTexture({attachment:c,texture:w,layer:I,level:R})}else this._attachTexture({attachment:c,texture:_,layer:0,level:0});i&&_&&_.resize({width:this.width,height:this.height})}this.gl.bindFramebuffer(36160,n||null),Object.assign(this.attachments,t),Object.keys(this.attachments).filter(o=>!this.attachments[o]).forEach(o=>{delete this.attachments[o]})}checkStatus(){let{gl:t}=this,r=this.getStatus();if(r!==36053)throw new Error(ust(r));return this}getStatus(){let{gl:t}=this,r=t.bindFramebuffer(36160,this.handle),i=t.checkFramebufferStatus(36160);return t.bindFramebuffer(36160,r||null),i}clear(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{color:r,depth:i,stencil:s,drawBuffers:n=[]}=t,o=this.gl.bindFramebuffer(36160,this.handle);return(r||i||s)&&Hf(this.gl,{color:r,depth:i,stencil:s}),n.forEach((c,f)=>{xR(this.gl,{drawBuffer:f,value:c})}),this.gl.bindFramebuffer(36160,o||null),this}readPixels(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.error(\"Framebuffer.readPixels() is no logner supported, use readPixelsToArray(framebuffer)\")(),null}readPixelsToBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.error(\"Framebuffer.readPixelsToBuffer()is no logner supported, use readPixelsToBuffer(framebuffer)\")(),null}copyToDataUrl(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.error(\"Framebuffer.copyToDataUrl() is no logner supported, use copyToDataUrl(framebuffer)\")(),null}copyToImage(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.error(\"Framebuffer.copyToImage() is no logner supported, use copyToImage(framebuffer)\")(),null}copyToTexture(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.error(\"Framebuffer.copyToTexture({...}) is no logner supported, use copyToTexture(source, target, opts})\")(),null}blit(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.error(\"Framebuffer.blit({...}) is no logner supported, use blit(source, target, opts)\")(),null}invalidate(t){let{attachments:r=[],x:i=0,y:s=0,width:n,height:o}=t,c=Yn(this.gl),f=c.bindFramebuffer(36008,this.handle);return i===0&&s===0&&n===void 0&&o===void 0?c.invalidateFramebuffer(36008,r):c.invalidateFramebuffer(36008,r,i,s,n,o),c.bindFramebuffer(36008,f),this}getAttachmentParameter(t,r,i){let s=this._getAttachmentParameterFallback(r);return s===null&&(this.gl.bindFramebuffer(36160,this.handle),s=this.gl.getFramebufferAttachmentParameter(36160,t,r),this.gl.bindFramebuffer(36160,null)),i&&s>1e3&&(s=Ou(this.gl,s)),s}getAttachmentParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:36064,r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.constructor.ATTACHMENT_PARAMETERS||[],s={};for(let n of i){let o=r?Ou(this.gl,n):n;s[o]=this.getAttachmentParameter(t,n,r)}return s}getParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r=Object.keys(this.attachments),i={};for(let s of r){let n=Number(s),o=t?Ou(this.gl,n):n;i[o]=this.getAttachmentParameters(n,t)}return i}show(){return typeof window<\"u\"&&window.open(mE(this),\"luma-debug-texture\"),this}log(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:\"\";if(t>He.level||typeof window>\"u\")return this;r=r||\"Framebuffer \".concat(this.id);let i=mE(this,{targetMaxHeight:100});return He.image({logLevel:t,message:r,image:i},r)(),this}bind(){let{target:t=36160}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.gl.bindFramebuffer(t,this.handle),this}unbind(){let{target:t=36160}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.gl.bindFramebuffer(t,null),this}_createDefaultAttachments(t,r,i,s,n){let o=null;return t&&(o=o||{},o[36064]=new pi(this.gl,{id:\"\".concat(this.id,\"-color0\"),pixels:null,format:6408,type:5121,width:s,height:n,mipmaps:!1,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.ownResources.push(o[36064])),r&&i?(o=o||{},o[33306]=new el(this.gl,{id:\"\".concat(this.id,\"-depth-stencil\"),format:35056,width:s,height:111}),this.ownResources.push(o[33306])):r?(o=o||{},o[36096]=new el(this.gl,{id:\"\".concat(this.id,\"-depth\"),format:33189,width:s,height:n}),this.ownResources.push(o[36096])):i&&ye(!1),o}_unattach(t){let r=this.attachments[t];r&&(r instanceof el?this.gl.framebufferRenderbuffer(36160,t,36161,null):this.gl.framebufferTexture2D(36160,t,3553,null,0),delete this.attachments[t])}_attachRenderbuffer(t){let{attachment:r=36064,renderbuffer:i}=t,{gl:s}=this;s.framebufferRenderbuffer(36160,r,36161,i.handle),this.attachments[r]=i}_attachTexture(t){let{attachment:r=36064,texture:i,layer:s,level:n}=t,{gl:o}=this;switch(o.bindTexture(i.target,i.handle),i.target){case 35866:case 32879:Yn(o).framebufferTextureLayer(36160,r,i.target,n,s);break;case 34067:let f=cst(s);o.framebufferTexture2D(36160,r,f,i.handle,n);break;case 3553:o.framebufferTexture2D(36160,r,3553,i.handle,n);break;default:ye(!1,\"Illegal texture type\")}o.bindTexture(i.target,null),this.attachments[r]=i}_setReadBuffer(t){let r=sR(this.gl);r?r.readBuffer(t):ye(t===36064||t===1029,rj),this.readBuffer=t}_setDrawBuffers(t){let{gl:r}=this,i=Yn(r);if(i)i.drawBuffers(t);else{let s=r.getExtension(\"WEBGL_draw_buffers\");s?s.drawBuffersWEBGL(t):ye(t.length===1&&(t[0]===36064||t[0]===1029),rj)}this.drawBuffers=t}_getAttachmentParameterFallback(t){let r=_E(this.gl);switch(t){case 36052:return r.WEBGL2?null:0;case 33298:case 33299:case 33300:case 33301:case 33302:case 33303:return r.WEBGL2?null:8;case 33297:return r.WEBGL2?null:5125;case 33296:return!r.WEBGL2&&!r.EXT_sRGB?9729:null;default:return null}}_createHandle(){return this.gl.createFramebuffer()}_deleteHandle(){this.gl.deleteFramebuffer(this.handle)}_bindHandle(t){return this.gl.bindFramebuffer(36160,t)}};function cst(e){return e<34069?e+34069:e}function ust(e){return(yi.STATUS||{})[e]||\"Framebuffer error \".concat(e)}var hst=[36049,36048,33296,33298,33299,33300,33301,33302,33303];yi.ATTACHMENT_PARAMETERS=hst;function yE(e,t){ye(e instanceof pi||e instanceof Y0||e instanceof Ey);let r=e.constructor,{gl:i,width:s,height:n,format:o,type:c,dataFormat:f,border:_,mipmaps:w}=e,I=Object.assign({width:s,height:n,format:o,type:c,dataFormat:f,border:_,mipmaps:w},t);return new r(i,I)}function tj(e,t){let{gl:r,width:i,height:s,id:n}=e;return new yi(r,Object.assign({},t,{id:\"framebuffer-for-\".concat(n),width:i,height:s,attachments:{36064:e}}))}function qA(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:\"unnamed\",r=/#define[\\s*]SHADER_NAME[\\s*]([A-Za-z0-9_-]+)[\\s*]/,i=e.match(r);return i?i[1]:t}function wR(e){switch(e){case 35632:return\"fragment\";case 35633:return\"vertex\";default:return\"unknown type\"}}function SR(e,t,r,i){let s=e.split(/\\r?\\n/),n={},o={},c=i||qA(t)||\"(unnamed)\",f=\"\".concat(wR(r),\" shader \").concat(c);for(let w=0;w1&&arguments[1]!==void 0?arguments[1]:1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:\": \",i=e.split(/\\r?\\n/),s=String(i.length+t-1).length;return i.map((n,o)=>{let c=String(o+t),f=c.length;return nj(c,s-f)+r+n})}function nj(e,t){let r=\"\";for(let i=0;i=2&&r[0]===\"#version\"){let i=parseInt(r[1],10);Number.isFinite(i)&&(t=i)}return t}var dst=\"Shader: GLSL source code must be a JavaScript string\",vE=class e extends Js{get[Symbol.toStringTag](){return\"Shader\"}static getTypeName(t){switch(t){case 35633:return\"vertex-shader\";case 35632:return\"fragment-shader\";default:return ye(!1),\"unknown\"}}constructor(t,r){tp(t),ye(typeof r.source==\"string\",dst);let i=qA(r.source,null)||r.id||ta(\"unnamed \".concat(e.getTypeName(r.shaderType)));super(t,{id:i}),this.shaderType=r.shaderType,this.source=r.source,this.initialize(r)}initialize(t){let{source:r}=t,i=qA(r,null);i&&(this.id=ta(i)),this._compile(r)}getParameter(t){return this.gl.getShaderParameter(this.handle,t)}toString(){return\"\".concat(e.getTypeName(this.shaderType),\":\").concat(this.id)}getName(){return qA(this.source)||\"unnamed-shader\"}getSource(){return this.gl.getShaderSource(this.handle)}getTranslatedSource(){let t=this.gl.getExtension(\"WEBGL_debug_shaders\");return t?t.getTranslatedShaderSource(this.handle):\"No translated source available. WEBGL_debug_shaders not implemented\"}_compile(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.source;if(t.startsWith(\"#version \")||(t=`#version 100\n`.concat(t)),this.source=t,this.gl.shaderSource(this.handle,this.source),this.gl.compileShader(this.handle),!this.getParameter(35713)){let i=this.gl.getShaderInfoLog(this.handle),{shaderName:s,errors:n,warnings:o}=SR(i,this.source,this.shaderType,this.id);throw He.error(\"GLSL compilation errors in \".concat(s,`\n`).concat(n))(),He.warn(\"GLSL compilation warnings in \".concat(s,`\n`).concat(o))(),new Error(\"GLSL compilation errors in \".concat(s))}}_deleteHandle(){this.gl.deleteShader(this.handle)}_getOptsFromHandle(){return{type:this.getParameter(35663),source:this.getSource()}}},X0=class extends vE{get[Symbol.toStringTag](){return\"VertexShader\"}constructor(t,r){typeof r==\"string\"&&(r={source:r}),super(t,Object.assign({},r,{shaderType:35633}))}_createHandle(){return this.gl.createShader(35633)}},K0=class extends vE{get[Symbol.toStringTag](){return\"FragmentShader\"}constructor(t,r){typeof r==\"string\"&&(r={source:r}),super(t,Object.assign({},r,{shaderType:35632}))}_createHandle(){return this.gl.createShader(35632)}};var pst={5126:Qn.bind(null,\"uniform1fv\",$c,1,rl),35664:Qn.bind(null,\"uniform2fv\",$c,2,rl),35665:Qn.bind(null,\"uniform3fv\",$c,3,rl),35666:Qn.bind(null,\"uniform4fv\",$c,4,rl),5124:Qn.bind(null,\"uniform1iv\",ZA,1,rl),35667:Qn.bind(null,\"uniform2iv\",ZA,2,rl),35668:Qn.bind(null,\"uniform3iv\",ZA,3,rl),35669:Qn.bind(null,\"uniform4iv\",ZA,4,rl),35670:Qn.bind(null,\"uniform1iv\",ZA,1,rl),35671:Qn.bind(null,\"uniform2iv\",ZA,2,rl),35672:Qn.bind(null,\"uniform3iv\",ZA,3,rl),35673:Qn.bind(null,\"uniform4iv\",ZA,4,rl),35674:Qn.bind(null,\"uniformMatrix2fv\",$c,4,ep),35675:Qn.bind(null,\"uniformMatrix3fv\",$c,9,ep),35676:Qn.bind(null,\"uniformMatrix4fv\",$c,16,ep),35678:_a,35680:_a,5125:Qn.bind(null,\"uniform1uiv\",xE,1,rl),36294:Qn.bind(null,\"uniform2uiv\",xE,2,rl),36295:Qn.bind(null,\"uniform3uiv\",xE,3,rl),36296:Qn.bind(null,\"uniform4uiv\",xE,4,rl),35685:Qn.bind(null,\"uniformMatrix2x3fv\",$c,6,ep),35686:Qn.bind(null,\"uniformMatrix2x4fv\",$c,8,ep),35687:Qn.bind(null,\"uniformMatrix3x2fv\",$c,6,ep),35688:Qn.bind(null,\"uniformMatrix3x4fv\",$c,12,ep),35689:Qn.bind(null,\"uniformMatrix4x2fv\",$c,8,ep),35690:Qn.bind(null,\"uniformMatrix4x3fv\",$c,12,ep),35678:_a,35680:_a,35679:_a,35682:_a,36289:_a,36292:_a,36293:_a,36298:_a,36299:_a,36300:_a,36303:_a,36306:_a,36307:_a,36308:_a,36311:_a},Ast={},mst={},gst={},sj=[0];function TR(e,t,r,i){t===1&&typeof e==\"boolean\"&&(e=e?1:0),Number.isFinite(e)&&(sj[0]=e,e=sj);let s=e.length;if(s%t&&He.warn(\"Uniform size should be multiples of \".concat(t),e)(),e instanceof r)return e;let n=i[s];n||(n=new r(s),i[s]=n);for(let o=0;o{let s=e!==i;return s&&(t.uniform1i(r,i),e=i),s}}function Qn(e,t,r,i){let s=null,n=null;return(o,c,f)=>{let _=t(f,r),w=_.length,I=!1;if(s===null)s=new Float32Array(w),n=w,I=!0;else{ye(n===w,\"Uniform length cannot change.\");for(let R=0;R=0&&this._addAttribute(f,n,o,c)}this.attributeInfos.sort((s,n)=>s.location-n.location)}_readVaryingsFromProgram(t){let{gl:r}=t;if(!fr(r))return;let i=r.getProgramParameter(t.handle,35971);for(let s=0;ss.location-n.location)}_addAttribute(t,r,i,s){let{type:n,components:o}=PR(i),c={type:n,size:s*o};this._inferProperties(t,r,c);let f={location:t,name:r,accessor:new Pl(c)};this.attributeInfos.push(f),this.attributeInfosByLocation[t]=f,this.attributeInfosByName[f.name]=f}_inferProperties(t,r,i){/instance/i.test(r)&&(i.divisor=1)}_addVarying(t,r,i,s){let{type:n,components:o}=PR(i),c=new Pl({type:n,size:s*o}),f={location:t,name:r,accessor:c};this.varyingInfos.push(f),this.varyingInfosByName[f.name]=f}};var hj=4,$st=35981,Xst=[\"setVertexArray\",\"setAttributes\",\"setBuffers\",\"unsetBuffers\",\"use\",\"getUniformCount\",\"getUniformInfo\",\"getUniformLocation\",\"getUniformValue\",\"getVarying\",\"getFragDataLocation\",\"getAttachedShaders\",\"getAttributeCount\",\"getAttributeLocation\",\"getAttributeInfo\"],rp=class extends Js{get[Symbol.toStringTag](){return\"Program\"}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.stubRemovedMethods(\"Program\",\"v6.0\",Xst),this._isCached=!1,this.initialize(r),Object.seal(this),this._setId(r.id)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{hash:r,vs:i,fs:s,varyings:n,bufferMode:o=$st}=t;return this.hash=r||\"\",this.vs=typeof i==\"string\"?new X0(this.gl,{id:\"\".concat(t.id,\"-vs\"),source:i}):i,this.fs=typeof s==\"string\"?new K0(this.gl,{id:\"\".concat(t.id,\"-fs\"),source:s}):s,ye(this.vs instanceof X0),ye(this.fs instanceof K0),this.uniforms={},this._textureUniforms={},n&&n.length>0&&(Yn(this.gl),this.varyings=n,this.gl2.transformFeedbackVaryings(this.handle,n,o)),this._compileAndLink(),this._readUniformLocationsFromLinkedProgram(),this.configuration=new _b(this),this.setProps(t)}delete(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this._isCached?this:super.delete(t)}setProps(t){return\"uniforms\"in t&&this.setUniforms(t.uniforms),this}draw(t){let{logPriority:r,drawMode:i=4,vertexCount:s,offset:n=0,start:o,end:c,isIndexed:f=!1,indexType:_=5123,instanceCount:w=0,isInstanced:I=w>0,vertexArray:R=null,transformFeedback:N,framebuffer:j,parameters:Q={},uniforms:et,samplers:Y}=t;if((et||Y)&&(He.deprecated(\"Program.draw({uniforms})\",\"Program.setUniforms(uniforms)\")(),this.setUniforms(et||{})),He.priority>=r){let K=j?j.id:\"default\",J=\"mode=\".concat(Ou(this.gl,i),\" verts=\").concat(s,\" \")+\"instances=\".concat(w,\" indexType=\").concat(Ou(this.gl,_),\" \")+\"isInstanced=\".concat(I,\" isIndexed=\").concat(f,\" \")+\"Framebuffer=\".concat(K);He.log(r,J)()}return ye(R),this.gl.useProgram(this.handle),!this._areTexturesRenderable()||s===0||I&&w===0?!1:(R.bindForDraw(s,w,()=>{if(j!==void 0&&(Q=Object.assign({},Q,{framebuffer:j})),N){let K=uj(i);N.begin(K)}this._bindTextures(),Mn(this.gl,Q,()=>{f&&I?this.gl2.drawElementsInstanced(i,s,_,n,w):f&&fr(this.gl)&&!isNaN(o)&&!isNaN(c)?this.gl2.drawRangeElements(i,o,c,s,_,n):f?this.gl.drawElements(i,s,_,n):I?this.gl2.drawArraysInstanced(i,n,s,w):this.gl.drawArrays(i,n,s)}),N&&N.end()}),!0)}setUniforms(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};He.priority>=2&&aj(t,this.id,this._uniformSetters),this.gl.useProgram(this.handle);for(let r in t){let i=t[r],s=this._uniformSetters[r];if(s){let n=i,o=!1;if(n instanceof yi&&(n=n.texture),n instanceof tl)if(o=this.uniforms[r]!==i,o){s.textureIndex===void 0&&(s.textureIndex=this._textureIndexCounter++);let c=n,{textureIndex:f}=s;c.bind(f),n=f,this._textureUniforms[r]=c}else n=s.textureIndex;else this._textureUniforms[r]&&delete this._textureUniforms[r];(s(n)||o)&&lj(this.uniforms,r,i)}}return this}_areTexturesRenderable(){let t=!0;for(let r in this._textureUniforms){let i=this._textureUniforms[r];i.update(),t=t&&i.loaded}return t}_bindTextures(){for(let t in this._textureUniforms){let r=this._uniformSetters[t].textureIndex;this._textureUniforms[t].bind(r)}}_createHandle(){return this.gl.createProgram()}_deleteHandle(){this.gl.deleteProgram(this.handle)}_getOptionsFromHandle(t){let r=this.gl.getAttachedShaders(t),i={};for(let s of r)switch(this.gl.getShaderParameter(this.handle,35663)){case 35633:i.vs=new X0({handle:s});break;case 35632:i.fs=new K0({handle:s});break;default:}return i}_getParameter(t){return this.gl.getProgramParameter(this.handle,t)}_setId(t){if(!t){let r=this._getName();this.id=ta(r)}}_getName(){let t=this.vs.getName()||this.fs.getName();return t=t.replace(/shader/i,\"\"),t=t?\"\".concat(t,\"-program\"):\"program\",t}_compileAndLink(){let{gl:t}=this;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),He.time(hj,\"linkProgram for \".concat(this._getName()))(),t.linkProgram(this.handle),He.timeEnd(hj,\"linkProgram for \".concat(this._getName()))(),t.debug||He.level>0){if(!t.getProgramParameter(this.handle,35714))throw new Error(\"Error linking: \".concat(t.getProgramInfoLog(this.handle)));if(t.validateProgram(this.handle),!t.getProgramParameter(this.handle,35715))throw new Error(\"Error validating: \".concat(t.getProgramInfoLog(this.handle)))}}_readUniformLocationsFromLinkedProgram(){let{gl:t}=this;this._uniformSetters={},this._uniformCount=this._getParameter(35718);for(let r=0;r1)for(let o=0;o1&&arguments[1]!==void 0?arguments[1]:[],i=fr(t),s=Oh(t,Ii.TIMER_QUERY),n=i||s;for(let o of r)switch(o){case\"queries\":n=n&&i;break;case\"timers\":n=n&&s;break;default:ye(!1)}return n}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.target=null,this._queryPending=!1,this._pollingPromise=null,Object.seal(this)}beginTimeElapsedQuery(){return this.begin(tot)}beginOcclusionQuery(){let{conservative:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.begin(t?not:iot)}beginTransformFeedbackQuery(){return this.begin(rot)}begin(t){return this._queryPending?this:(this.target=t,this.gl2.beginQuery(this.target,this.handle),this)}end(){return this._queryPending?this:(this.target&&(this.gl2.endQuery(this.target),this.target=null,this._queryPending=!0),this)}isResultAvailable(){if(!this._queryPending)return!1;let t=this.gl2.getQueryParameter(this.handle,Jst);return t&&(this._queryPending=!1),t}isTimerDisjoint(){return this.gl2.getParameter(eot)}getResult(){return this.gl2.getQueryParameter(this.handle,Kst)}getTimerMilliseconds(){return this.getResult()/1e6}createPoll(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Number.POSITIVE_INFINITY;if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((i,s)=>{let n=()=>{this.isResultAvailable()?(i(this.getResult()),this._pollingPromise=null):r++>t?(s(\"Timed out\"),this._pollingPromise=null):requestAnimationFrame(n)};requestAnimationFrame(n)}),this._pollingPromise}_createHandle(){return e.isSupported(this.gl)?this.gl2.createQuery():null}_deleteHandle(){this.gl2.deleteQuery(this.handle)}};var ip=class extends Js{get[Symbol.toStringTag](){return\"TransformFeedback\"}static isSupported(t){return fr(t)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Yn(t),super(t,r),this.initialize(r),this.stubRemovedMethods(\"TransformFeedback\",\"v6.0\",[\"pause\",\"resume\"]),Object.seal(this)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.buffers={},this.unused={},this.configuration=null,this.bindOnUse=!0,Wf(this.buffers)||this.bind(()=>this._unbindBuffers()),this.setProps(t),this}setProps(t){\"program\"in t&&(this.configuration=t.program&&t.program.configuration),\"configuration\"in t&&(this.configuration=t.configuration),\"bindOnUse\"in t&&(t=t.bindOnUse),\"buffers\"in t&&this.setBuffers(t.buffers)}setBuffers(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.bind(()=>{for(let r in t)this.setBuffer(r,t[r])}),this}setBuffer(t,r){let i=this._getVaryingIndex(t),{buffer:s,byteSize:n,byteOffset:o}=this._getBufferParams(r);return i<0?(this.unused[t]=s,He.warn(\"\".concat(this.id,\" unused varying buffer \").concat(t))(),this):(this.buffers[i]=r,this.bindOnUse||this._bindBuffer(i,s,o,n),this)}begin(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this.gl.bindTransformFeedback(36386,this.handle),this._bindBuffers(),this.gl.beginTransformFeedback(t),this}end(){return this.gl.endTransformFeedback(),this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null),this}_getBufferParams(t){let r,i,s;return t instanceof Fr?s=t:(s=t.buffer,i=t.byteSize,r=t.byteOffset),(r!==void 0||i!==void 0)&&(r=r||0,i=i||s.byteLength-r),{buffer:s,byteOffset:r,byteSize:i}}_getVaryingInfo(t){return this.configuration&&this.configuration.getVaryingInfo(t)}_getVaryingIndex(t){if(this.configuration)return this.configuration.getVaryingInfo(t).location;let r=Number(t);return Number.isFinite(r)?r:-1}_bindBuffers(){if(this.bindOnUse)for(let t in this.buffers){let{buffer:r,byteSize:i,byteOffset:s}=this._getBufferParams(this.buffers[t]);this._bindBuffer(t,r,s,i)}}_unbindBuffers(){if(this.bindOnUse)for(let t in this.buffers)this._bindBuffer(t,null)}_bindBuffer(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0,n=r&&r.handle;return!n||s===void 0?this.gl.bindBufferBase(35982,t,n):this.gl.bindBufferRange(35982,t,n,i,s),this}_createHandle(){return this.gl.createTransformFeedback()}_deleteHandle(){this.gl.deleteTransformFeedback(this.handle)}_bindHandle(t){this.gl.bindTransformFeedback(36386,this.handle)}};var TE=null;function sot(e){return(!TE||TE.byteLength1&&arguments[1]!==void 0?arguments[1]:{}).constantAttributeZero?fr(t)||vy()===\"Chrome\":!0}static getDefaultArray(t){return t.luma=t.luma||{},t.luma.defaultVertexArray||(t.luma.defaultVertexArray=new e(t,{handle:null,isDefaultArray:!0})),t.luma.defaultVertexArray}static getMaxAttributes(t){return e.MAX_ATTRIBUTES=e.MAX_ATTRIBUTES||t.getParameter(34921),e.MAX_ATTRIBUTES}static setConstant(t,r,i){switch(i.constructor){case Float32Array:e._setConstantFloatArray(t,r,i);break;case Int32Array:e._setConstantIntArray(t,r,i);break;case Uint32Array:e._setConstantUintArray(t,r,i);break;default:ye(!1)}}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.id||r.program&&r.program.id;super(t,Object.assign({},r,{id:i})),this.buffer=null,this.bufferValue=null,this.isDefaultArray=r.isDefaultArray||!1,this.gl2=t,this.initialize(r),Object.seal(this)}delete(){return super.delete(),this.buffer&&this.buffer.delete(),this}get MAX_ATTRIBUTES(){return e.getMaxAttributes(this.gl)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.setProps(t)}setProps(t){return this}setElementBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ye(!t||t.target===34963,oot),this.bind(()=>{this.gl.bindBuffer(34963,t?t.handle:null)}),this}setBuffer(t,r,i){if(r.target===34963)return this.setElementBuffer(r,i);let{size:s,type:n,stride:o,offset:c,normalized:f,integer:_,divisor:w}=i,{gl:I,gl2:R}=this;return t=Number(t),this.bind(()=>{I.bindBuffer(34962,r.handle),_?(ye(fr(I)),R.vertexAttribIPointer(t,s,n,o,c)):I.vertexAttribPointer(t,s,n,f,o,c),I.enableVertexAttribArray(t),R.vertexAttribDivisor(t,w||0)}),this}enable(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return!r&&t===0&&!e.isSupported(this.gl,{constantAttributeZero:!0})||(t=Number(t),this.bind(()=>r?this.gl.enableVertexAttribArray(t):this.gl.disableVertexAttribArray(t))),this}getConstantBuffer(t,r){let i=this._normalizeConstantArrayValue(r),s=i.byteLength*t,n=i.length*t,o=!this.buffer;if(this.buffer=this.buffer||new Fr(this.gl,s),o=o||this.buffer.reallocate(s),o=o||!this._compareConstantArrayValues(i,this.bufferValue),o){let c=fj(r.constructor,n);dj({target:c,source:i,start:0,count:n}),this.buffer.subData(c),this.bufferValue=r}return this.buffer}_normalizeConstantArrayValue(t){return Array.isArray(t)?new Float32Array(t):t}_compareConstantArrayValues(t,r){if(!t||!r||t.length!==r.length||t.constructor!==r.constructor)return!1;for(let i=0;i{switch(t){case 34373:return this.gl.getVertexAttribOffset(i,t);default:return this.gl.getVertexAttrib(i,t)}})}};var aot=\"VertexArray: attributes must be Buffers or constants (i.e. typed array)\",lot=/^(.+)__LOCATION_([0-9]+)$/,cot=[\"setBuffers\",\"setGeneric\",\"clearBindings\",\"setLocations\",\"setGenericValues\",\"setDivisor\",\"enable\",\"disable\"],Iy=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.id||r.program&&r.program.id;this.id=i,this.gl=t,this.configuration=null,this.elements=null,this.elementsAccessor=null,this.values=null,this.accessors=null,this.unused=null,this.drawParams=null,this.buffer=null,this.attributes={},this.vertexArrayObject=new tg(t),fE(this,\"VertexArray\",\"v6.0\",cot),this.initialize(r),Object.seal(this)}delete(){this.buffer&&this.buffer.delete(),this.vertexArrayObject.delete()}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.reset(),this.configuration=null,this.bindOnUse=!1,this.setProps(t)}reset(){this.elements=null,this.elementsAccessor=null;let{MAX_ATTRIBUTES:t}=this.vertexArrayObject;return this.values=new Array(t).fill(null),this.accessors=new Array(t).fill(null),this.unused={},this.drawParams=null,this}setProps(t){return\"program\"in t&&(this.configuration=t.program&&t.program.configuration),\"configuration\"in t&&(this.configuration=t.configuration),\"attributes\"in t&&this.setAttributes(t.attributes),\"elements\"in t&&this.setElementBuffer(t.elements),\"bindOnUse\"in t&&(t=t.bindOnUse),this}clearDrawParams(){this.drawParams=null}getDrawParams(){return this.drawParams=this.drawParams||this._updateDrawParams(),this.drawParams}setAttributes(t){return Object.assign(this.attributes,t),this.vertexArrayObject.bind(()=>{for(let r in t){let i=t[r];this._setAttribute(r,i)}this.gl.bindBuffer(34962,null)}),this}setElementBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.elements=t,this.elementsAccessor=r,this.clearDrawParams(),this.vertexArrayObject.setElementBuffer(t,r),this}setBuffer(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(r.target===34963)return this.setElementBuffer(r,i);let{location:s,accessor:n}=this._resolveLocationAndAccessor(t,r,r.accessor,i);return s>=0&&(this.values[s]=r,this.accessors[s]=n,this.clearDrawParams(),this.vertexArrayObject.setBuffer(s,r,n)),this}setConstant(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{location:s,accessor:n}=this._resolveLocationAndAccessor(t,r,Object.assign({size:r.length},i));return s>=0&&(r=this.vertexArrayObject._normalizeConstantArrayValue(r),this.values[s]=r,this.accessors[s]=n,this.clearDrawParams(),this.vertexArrayObject.enable(s,!1)),this}unbindBuffers(){return this.vertexArrayObject.bind(()=>{this.elements&&this.vertexArrayObject.setElementBuffer(null),this.buffer=this.buffer||new Fr(this.gl,{accessor:{size:4}});for(let t=0;t{this.elements&&this.setElementBuffer(this.elements);for(let t=0;t{this._setConstantAttributes(t,r),s=i()}),s}_resolveLocationAndAccessor(t,r,i,s){let n={location:-1,accessor:null},{location:o,name:c}=this._getAttributeIndex(t);if(!Number.isFinite(o)||o<0)return this.unused[t]=r,He.once(3,()=>\"unused value \".concat(t,\" in \").concat(this.id))(),n;let f=this._getAttributeInfo(c||o);if(!f)return n;let _=this.accessors[o]||{},w=Pl.resolve(f.accessor,_,i,s),{size:I,type:R}=w;return ye(Number.isFinite(I)&&Number.isFinite(R)),{location:o,accessor:w}}_getAttributeInfo(t){return this.configuration&&this.configuration.getAttributeInfo(t)}_getAttributeIndex(t){let r=Number(t);if(Number.isFinite(r))return{location:r};let i=lot.exec(t),s=i?i[1]:t,n=i?Number(i[2]):0;return this.configuration?{location:this.configuration.getAttributeLocation(s)+n,name:s}:{location:-1}}_setAttribute(t,r){if(r instanceof Fr)this.setBuffer(t,r);else if(Array.isArray(r)&&r.length&&r[0]instanceof Fr){let i=r[0],s=r[1];this.setBuffer(t,i,s)}else if(ArrayBuffer.isView(r)||Array.isArray(r)){let i=r;this.setConstant(t,i)}else if(r.buffer instanceof Fr){let i=r;this.setBuffer(t,i.buffer,i)}else throw new Error(aot)}_setConstantAttributes(t,r){let i=Math.max(t|0,r|0),s=this.values[0];ArrayBuffer.isView(s)&&this._setConstantAttributeZero(s,i);for(let n=1;n0;if(t.isInstanced=t.isInstanced||o,i instanceof Fr){let c=i;if(o){let f=c.getVertexCount(s);t.instanceCount=Math.min(t.instanceCount,f)}else{let f=c.getVertexCount(s);t.vertexCount=Math.min(t.vertexCount,f)}}}setElements(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return He.deprecated(\"setElements\",\"setElementBuffer\")(),this.setElementBuffer(t,r)}};function uot(e,t){let{maxElts:r=16,size:i=1}=t,s=\"[\";for(let o=0;o0&&(s+=\",\".concat(o%i===0?\" \":\"\")),s+=eg(e[o],t);let n=e.length>r?\"...\":\"]\";return\"\".concat(s).concat(n)}function eg(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=1e-16,{isInteger:i=!1}=t;if(Array.isArray(e)||ArrayBuffer.isView(e))return uot(e,t);if(!Number.isFinite(e))return String(e);if(Math.abs(e)100&&Math.abs(e)<1e4)return e.toFixed(0);let s=e.toPrecision(2);return s.indexOf(\".0\")===s.length-2?s.slice(0,-1):s}function ME(e){let{header:t=\"Uniforms\",program:r,uniforms:i,undefinedOnly:s=!1}=e;ye(r);let n=\".*_.*\",o=\".*Matrix\",c=r._uniformSetters,f={},_=Object.keys(c).sort(),w=0;for(let N of _)!N.match(n)&&!N.match(o)&&IR({table:f,header:t,uniforms:i,uniformName:N,undefinedOnly:s})&&w++;for(let N of _)N.match(o)&&IR({table:f,header:t,uniforms:i,uniformName:N,undefinedOnly:s})&&w++;for(let N of _)f[N]||IR({table:f,header:t,uniforms:i,uniformName:N,undefinedOnly:s})&&w++;let I=0,R={};if(!s)for(let N in i){let j=i[N];f[N]||(I++,R[N]={Type:\"NOT USED: \".concat(j),[t]:eg(j)})}return{table:f,count:w,unusedTable:R,unusedCount:I}}function IR(e){let{table:t,header:r,uniforms:i,uniformName:s,undefinedOnly:n}=e,o=i[s],c=hot(o);return!n||!c?(t[s]={[r]:c?eg(o):\"N/A\",\"Uniform Type\":c?o:\"NOT PROVIDED\"},!0):!1}function hot(e){return e!=null}function CR(e){let{vertexArray:t,header:r=\"Attributes\"}=e;if(!t.configuration)return{};let i={};t.elements&&(i.ELEMENT_ARRAY_BUFFER=pj(t,t.elements,null,r));let s=t.values;for(let n in s){let o=t._getAttributeInfo(n);if(o){let c=\"\".concat(n,\": \").concat(o.name),f=t.accessors[o.location];f&&(c=\"\".concat(n,\": \").concat(fot(o.name,f))),i[c]=pj(t,s[n],f,r)}}return i}function pj(e,t,r,i){let{gl:s}=e;if(!t)return{[i]:\"null\",\"Format \":\"N/A\"};let n=\"NOT PROVIDED\",o=1,c=0,f=0,_,w,I;if(r&&(n=r.type,o=r.size,n=String(n).replace(\"Array\",\"\"),_=n.indexOf(\"nt\")!==-1),t instanceof Fr){let R=t,{data:N,changed:j}=R.getDebugData();w=j?\"*\":\"\",I=N,f=R.byteLength,c=f/N.BYTES_PER_ELEMENT/o;let Q;if(r){let et=r.divisor>0;Q=\"\".concat(et?\"I \":\"P \",\" \").concat(c,\" (x\").concat(o,\"=\").concat(f,\" bytes \").concat(Ou(s,n),\")\")}else _=!0,Q=\"\".concat(f,\" bytes\");return{[i]:\"\".concat(w).concat(eg(I,{size:o,isInteger:_})),\"Format \":Q}}return I=t,o=t.length,n=String(t.constructor.name).replace(\"Array\",\"\"),_=n.indexOf(\"nt\")!==-1,{[i]:\"\".concat(eg(I,{size:o,isInteger:_}),\" (constant)\"),\"Format \":\"\".concat(o,\"x\").concat(n,\" (constant)\")}}function fot(e,t){let{type:r,size:i}=t,s=SE(r,i);return s?\"\".concat(e,\" (\").concat(s.name,\")\"):e}function LR(e){let t={},r=\"Accessors for \".concat(e.id);for(let i of e.attributeInfos)if(i){let s=Aj(i);t[\"in \".concat(s)]={[r]:JSON.stringify(i.accessor)}}for(let i of e.varyingInfos)if(i){let s=Aj(i);t[\"out \".concat(s)]={[r]:JSON.stringify(i.accessor)}}return t}function Aj(e){let{type:t,size:r}=e.accessor,i=SE(t,r);return i?\"\".concat(i.name,\" \").concat(e.name):e.name}var mj=Lo()&&typeof document<\"u\",pot=0,rg=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{onCreateContext:r=et=>Ty(et),onAddHTML:i=null,onInitialize:s=()=>{},onRender:n=()=>{},onFinalize:o=()=>{},onError:c,gl:f=null,glOptions:_={},debug:w=!1,createFramebuffer:I=!1,autoResizeViewport:R=!0,autoResizeDrawingBuffer:N=!0,stats:j=Du.get(\"animation-loop-\".concat(pot++))}=t,{useDevicePixels:Q=!0}=t;\"useDevicePixelRatio\"in t&&(He.deprecated(\"useDevicePixelRatio\",\"useDevicePixels\")(),Q=t.useDevicePixelRatio),this.props={onCreateContext:r,onAddHTML:i,onInitialize:s,onRender:n,onFinalize:o,onError:c,gl:f,glOptions:_,debug:w,createFramebuffer:I},this.gl=f,this.needsRedraw=null,this.timeline=null,this.stats=j,this.cpuTime=this.stats.get(\"CPU Time\"),this.gpuTime=this.stats.get(\"GPU Time\"),this.frameRate=this.stats.get(\"Frame Rate\"),this._initialized=!1,this._running=!1,this._animationFrameId=null,this._nextFramePromise=null,this._resolveNextFrame=null,this._cpuStartTime=0,this.setProps({autoResizeViewport:R,autoResizeDrawingBuffer:N,useDevicePixels:Q}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._pageLoadPromise=null,this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}delete(){this.stop(),this._setDisplay(null)}setNeedsRedraw(t){return ye(typeof t==\"string\"),this.needsRedraw=this.needsRedraw||t,this}setProps(t){return\"autoResizeViewport\"in t&&(this.autoResizeViewport=t.autoResizeViewport),\"autoResizeDrawingBuffer\"in t&&(this.autoResizeDrawingBuffer=t.autoResizeDrawingBuffer),\"useDevicePixels\"in t&&(this.useDevicePixels=t.useDevicePixels),this}start(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this._running)return this;this._running=!0;let r=this._getPageLoadPromise().then(()=>!this._running||this._initialized?null:(this._createWebGLContext(t),this._createFramebuffer(),this._startEventHandling(),this._initializeCallbackData(),this._updateCallbackData(),this._resizeCanvasDrawingBuffer(),this._resizeViewport(),this._gpuTimeQuery=J0.isSupported(this.gl,[\"timers\"])?new J0(this.gl):null,this._initialized=!0,this.onInitialize(this.animationProps))).then(i=>{this._running&&(this._addCallbackData(i||{}),i!==!1&&this._startLoop())});return this.props.onError&&r.catch(this.props.onError),this}redraw(){return this.isContextLost()?this:(this._beginTimers(),this._setupFrame(),this._updateCallbackData(),this._renderFrame(this.animationProps),this._clearNeedsRedraw(),this.offScreen&&this.gl.commit&&this.gl.commit(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endTimers(),this)}stop(){return this._running&&(this._finalizeCallbackData(),this._cancelAnimationFrame(this._animationFrameId),this._nextFramePromise=null,this._resolveNextFrame=null,this._animationFrameId=null,this._running=!1),this}attachTimeline(t){return this.timeline=t,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw(\"waitForRender\"),this._nextFramePromise||(this._nextFramePromise=new Promise(t=>{this._resolveNextFrame=t})),this._nextFramePromise}async toDataURL(){return this.setNeedsRedraw(\"toDataURL\"),await this.waitForRender(),this.gl.canvas.toDataURL()}isContextLost(){return this.gl.isContextLost()}onCreateContext(){return this.props.onCreateContext(...arguments)}onInitialize(){return this.props.onInitialize(...arguments)}onRender(){return this.props.onRender(...arguments)}onFinalize(){return this.props.onFinalize(...arguments)}getHTMLControlValue(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,i=document.getElementById(t);return i?Number(i.value):r}setViewParameters(){return He.removed(\"AnimationLoop.setViewParameters\",\"AnimationLoop.setProps\")(),this}_startLoop(){let t=()=>{this._running&&(this.redraw(),this._animationFrameId=this._requestAnimationFrame(t))};this._cancelAnimationFrame(this._animationFrameId),this._animationFrameId=this._requestAnimationFrame(t)}_getPageLoadPromise(){return this._pageLoadPromise||(this._pageLoadPromise=mj?new Promise((t,r)=>{if(mj&&document.readyState===\"complete\"){t(document);return}window.addEventListener(\"load\",()=>{t(document)})}):Promise.resolve({})),this._pageLoadPromise}_setDisplay(t){this.display&&(this.display.delete(),this.display.animationLoop=null),t&&(t.animationLoop=this),this.display=t}_cancelAnimationFrame(t){return this.display&&this.display.cancelAnimationFrame?this.display.cancelAnimationFrame(t):mR(t)}_requestAnimationFrame(t){if(this._running)return this.display&&this.display.requestAnimationFrame?this.display.requestAnimationFrame(t):AR(t)}_renderFrame(){if(this.display){this.display._renderFrame(...arguments);return}this.onRender(...arguments)}_clearNeedsRedraw(){this.needsRedraw=null}_setupFrame(){this._resizeCanvasDrawingBuffer(),this._resizeViewport(),this._resizeFramebuffer()}_initializeCallbackData(){this.animationProps={gl:this.gl,stop:this.stop,canvas:this.gl.canvas,framebuffer:this.framebuffer,useDevicePixels:this.useDevicePixels,needsRedraw:null,startTime:Date.now(),engineTime:0,tick:0,tock:0,time:0,_timeline:this.timeline,_loop:this,_animationLoop:this,_mousePosition:null}}_updateCallbackData(){let{width:t,height:r,aspect:i}=this._getSizeAndAspect();(t!==this.animationProps.width||r!==this.animationProps.height)&&this.setNeedsRedraw(\"drawing buffer resized\"),i!==this.animationProps.aspect&&this.setNeedsRedraw(\"drawing buffer aspect changed\"),this.animationProps.width=t,this.animationProps.height=r,this.animationProps.aspect=i,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime,this.animationProps._offScreen=this.offScreen}_finalizeCallbackData(){this.onFinalize(this.animationProps)}_addCallbackData(t){typeof t==\"object\"&&t!==null&&(this.animationProps=Object.assign({},this.animationProps,t))}_createWebGLContext(t){if(this.offScreen=t.canvas&&typeof OffscreenCanvas<\"u\"&&t.canvas instanceof OffscreenCanvas,t=Object.assign({},t,this.props.glOptions),this.gl=this.props.gl?q0(this.props.gl,t):this.onCreateContext(t),!Jd(this.gl))throw new Error(\"AnimationLoop.onCreateContext - illegal context returned\");uE(this.gl),this._createInfoDiv()}_createInfoDiv(){if(this.gl.canvas&&this.props.onAddHTML){let t=document.createElement(\"div\");document.body.appendChild(t),t.style.position=\"relative\";let r=document.createElement(\"div\");r.style.position=\"absolute\",r.style.left=\"10px\",r.style.bottom=\"10px\",r.style.width=\"300px\",r.style.background=\"white\",t.appendChild(this.gl.canvas),t.appendChild(r);let i=this.props.onAddHTML(r);i&&(r.innerHTML=i)}}_getSizeAndAspect(){let t=this.gl.drawingBufferWidth,r=this.gl.drawingBufferHeight,i=1,{canvas:s}=this.gl;return s&&s.clientHeight?i=s.clientWidth/s.clientHeight:t>0&&r>0&&(i=t/r),{width:t,height:r,aspect:i}}_resizeViewport(){this.autoResizeViewport&&this.gl.viewport(0,0,this.gl.drawingBufferWidth,this.gl.drawingBufferHeight)}_resizeCanvasDrawingBuffer(){this.autoResizeDrawingBuffer&&dR(this.gl,{useDevicePixels:this.useDevicePixels})}_createFramebuffer(){this.props.createFramebuffer&&(this.framebuffer=new yi(this.gl))}_resizeFramebuffer(){this.framebuffer&&this.framebuffer.resize({width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight})}_beginTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this._gpuTimeQuery&&this._gpuTimeQuery.isResultAvailable()&&!this._gpuTimeQuery.isTimerDisjoint()&&this.stats.get(\"GPU Time\").addTime(this._gpuTimeQuery.getTimerMilliseconds()),this._gpuTimeQuery&&this._gpuTimeQuery.beginTimeElapsedQuery(),this.cpuTime.timeStart()}_endTimers(){this.cpuTime.timeEnd(),this._gpuTimeQuery&&this._gpuTimeQuery.end()}_startEventHandling(){let{canvas:t}=this.gl;t&&(t.addEventListener(\"mousemove\",this._onMousemove),t.addEventListener(\"mouseleave\",this._onMouseleave))}_onMousemove(t){this.animationProps._mousePosition=[t.offsetX,t.offsetY]}_onMouseleave(t){this.animationProps._mousePosition=null}};var ig=\"vs\",yb=\"fs\";function to(e,t){if(!e)throw new Error(t||\"shadertools: assertion failed.\")}var kR={number:{validate(e,t){return Number.isFinite(e)&&(!(\"max\"in t)||e<=t.max)&&(!(\"min\"in t)||e>=t.min)}},array:{validate(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function _j(e){let t={};for(let r in e){let i=e[r],s=Aot(i);t[r]=s}return t}function Aot(e){let t=gj(e);return t===\"object\"?e?\"type\"in e?Object.assign({},e,kR[e.type]):\"value\"in e?(t=gj(e.value),Object.assign({type:t},e,kR[t])):{type:\"object\",value:e}:{type:\"object\",value:null}:Object.assign({type:t,value:e},kR[t])}function gj(e){return Array.isArray(e)||ArrayBuffer.isView(e)?\"array\":typeof e}var mot=\"vs\",got=\"fs\",Cy=class{constructor(t){let{name:r,vs:i,fs:s,dependencies:n=[],uniforms:o,getUniforms:c,deprecations:f=[],defines:_={},inject:w={},vertexShader:I,fragmentShader:R}=t;to(typeof r==\"string\"),this.name=r,this.vs=i||I,this.fs=s||R,this.getModuleUniforms=c,this.dependencies=n,this.deprecations=this._parseDeprecationDefinitions(f),this.defines=_,this.injections=_ot(w),o&&(this.uniforms=_j(o))}getModuleSource(t){let r;switch(t){case mot:r=this.vs||\"\";break;case got:r=this.fs||\"\";break;default:to(!1)}return\"#define MODULE_\".concat(this.name.toUpperCase().replace(/[^0-9a-z]/gi,\"_\"),`\n`).concat(r,\"// END MODULE_\").concat(this.name,`\n\n`)}getUniforms(t,r){return this.getModuleUniforms?this.getModuleUniforms(t,r):this.uniforms?this._defaultGetUniforms(t):{}}getDefines(){return this.defines}checkDeprecations(t,r){this.deprecations.forEach(i=>{i.regex.test(t)&&(i.deprecated?r.deprecated(i.old,i.new)():r.removed(i.old,i.new)())})}_parseDeprecationDefinitions(t){return t.forEach(r=>{switch(r.type){case\"function\":r.regex=new RegExp(\"\\\\b\".concat(r.old,\"\\\\(\"));break;default:r.regex=new RegExp(\"\".concat(r.type,\" \").concat(r.old,\";\"))}}),t}_defaultGetUniforms(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={},i=this.uniforms;for(let s in i){let n=i[s];s in t&&!n.private?(n.validate&&to(n.validate(t[s],n),\"\".concat(this.name,\": invalid \").concat(s)),r[s]=t[s]):r[s]=n.value}return r}};function _ot(e){let t={vs:{},fs:{}};for(let r in e){let i=e[r],s=r.slice(0,2);typeof i==\"string\"&&(i={order:0,injection:i}),t[s][r]=i}return t}function yj(e){return yot(xj(e))}function yot(e){let t={},r={};return vj({modules:e,level:0,moduleMap:t,moduleDepth:r}),Object.keys(r).sort((i,s)=>r[s]-r[i]).map(i=>t[i])}function vj(e){let{modules:t,level:r,moduleMap:i,moduleDepth:s}=e;if(r>=5)throw new Error(\"Possible loop in shader dependency graph\");for(let n of t)i[n.name]=n,(s[n.name]===void 0||s[n.name](r instanceof Cy||(to(typeof r!=\"string\",\"Shader module use by name is deprecated. Import shader module '\".concat(r,\"' and use it directly.\")),to(r.name,\"shader module has no name\"),r=new Cy(r),r.dependencies=xj(r.dependencies)),r))}function RR(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=typeof window<\"u\"?window.navigator||{}:{},r=e.userAgent||t.userAgent||\"\",i=r.indexOf(\"MSIE \")!==-1,s=r.indexOf(\"Trident/\")!==-1;return i||s}var vot=7936,xot=7937,bot=7938,wot=35724,OR={GLSL_FRAG_DATA:[\"WEBGL_draw_buffers\",!0],GLSL_FRAG_DEPTH:[\"EXT_frag_depth\",!0],GLSL_DERIVATIVES:[\"OES_standard_derivatives\",!0],GLSL_TEXTURE_LOD:[\"EXT_shader_texture_lod\",!0]},YA={};Object.keys(OR).forEach(e=>{YA[e]=e});function Sot(e){return typeof WebGL2RenderingContext<\"u\"&&e instanceof WebGL2RenderingContext?!0:!!(e&&e._version===2)}function bj(e){let t=e.getExtension(\"WEBGL_debug_renderer_info\"),r=e.getParameter(t&&t.UNMASKED_VENDOR_WEBGL||vot),i=e.getParameter(t&&t.UNMASKED_RENDERER_WEBGL||xot);return{gpuVendor:Tot(r,i),vendor:r,renderer:i,version:e.getParameter(bot),shadingLanguageVersion:e.getParameter(wot)}}function Tot(e,t){return e.match(/NVIDIA/i)||t.match(/NVIDIA/i)?\"NVIDIA\":e.match(/INTEL/i)||t.match(/INTEL/i)?\"INTEL\":e.match(/AMD/i)||t.match(/AMD/i)||e.match(/ATI/i)||t.match(/ATI/i)?\"AMD\":\"UNKNOWN GPU\"}var DR={};function BR(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=OR[t];if(to(i,t),!RR(r))return!0;if(t in DR)return DR[t];let s=i[0],n=r.behavior||\"enable\",o=\"#extension GL_\".concat(s,\" : \").concat(n,`\nvoid main(void) {}`),c=e.createShader(35633);e.shaderSource(c,o),e.compileShader(c);let f=e.getShaderParameter(c,35713);return e.deleteShader(c),DR[t]=f,f}function Mot(e,t){let r=OR[t];to(r,t);let i=Sot(e)&&r[1]||r[0],s=typeof i==\"string\"?!!e.getExtension(i):i;return to(s===!1||s===!0),s}function vb(e,t){return t=Array.isArray(t)?t:[t],t.every(r=>Mot(e,r))}function wj(e){switch(bj(e).gpuVendor.toLowerCase()){case\"nvidia\":return`#define NVIDIA_GPU\n// Nvidia optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n`;case\"intel\":return`#define INTEL_GPU\n// Intel optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel's built-in 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n`;case\"amd\":return`#define AMD_GPU\n`;default:return`#define DEFAULT_GPU\n// Prevent driver from optimizing away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel's built-in 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n`}}function Sj(e,t,r){let i=`#if (__VERSION__ > 120)\n\n# define FEATURE_GLSL_DERIVATIVES\n# define FEATURE_GLSL_DRAW_BUFFERS\n# define FEATURE_GLSL_FRAG_DEPTH\n# define FEATURE_GLSL_TEXTURE_LOD\n\n// DEPRECATED FLAGS, remove in v9\n# define FRAG_DEPTH\n# define DERIVATIVES\n# define DRAW_BUFFERS\n# define TEXTURE_LOD\n\n#endif // __VERSION\n`;return vb(e,YA.GLSL_FRAG_DEPTH)&&(i+=`\n// FRAG_DEPTH => gl_FragDepth is available\n#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n# define FEATURE_GLSL_FRAG_DEPTH\n# define FRAG_DEPTH\n# define gl_FragDepth gl_FragDepthEXT\n#endif\n`),vb(e,YA.GLSL_DERIVATIVES)&&BR(e,YA.GLSL_DERIVATIVES)&&(i+=`\n// DERIVATIVES => dxdF, dxdY and fwidth are available\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n# define FEATURE_GLSL_DERIVATIVES\n# define DERIVATIVES\n#endif\n`),vb(e,YA.GLSL_FRAG_DATA)&&BR(e,YA.GLSL_FRAG_DATA,{behavior:\"require\"})&&(i+=`\n// DRAW_BUFFERS => gl_FragData[] is available\n#ifdef GL_EXT_draw_buffers\n#extension GL_EXT_draw_buffers : require\n#define FEATURE_GLSL_DRAW_BUFFERS\n#define DRAW_BUFFERS\n#endif\n`),vb(e,YA.GLSL_TEXTURE_LOD)&&(i+=`// TEXTURE_LOD => texture2DLod etc are available\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod : enable\n\n# define FEATURE_GLSL_TEXTURE_LOD\n# define TEXTURE_LOD\n\n#endif\n`),i}var Tj=`#ifdef MODULE_LOGDEPTH\n logdepth_adjustPosition(gl_Position);\n#endif\n`,Mj=`#ifdef MODULE_MATERIAL\n gl_FragColor = material_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LIGHTING\n gl_FragColor = lighting_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_FOG\n gl_FragColor = fog_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_PICKING\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LOGDEPTH\n logdepth_setFragDepth();\n#endif\n`;var Eot={[ig]:Tj,[yb]:Mj},xb=\"__LUMA_INJECT_DECLARATIONS__\",Ej=/void\\s+main\\s*\\([^)]*\\)\\s*\\{\\n?/,Pj=/}\\n?[^{}]*$/,FR=[];function EE(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=t===ig;for(let n in r){let o=r[n];o.sort((f,_)=>f.order-_.order),FR.length=o.length;for(let f=0,_=o.length;f<_;++f)FR[f]=o[f].injection;let c=\"\".concat(FR.join(`\n`),`\n`);switch(n){case\"vs:#decl\":s&&(e=e.replace(xb,c));break;case\"vs:#main-start\":s&&(e=e.replace(Ej,f=>f+c));break;case\"vs:#main-end\":s&&(e=e.replace(Pj,f=>c+f));break;case\"fs:#decl\":s||(e=e.replace(xb,c));break;case\"fs:#main-start\":s||(e=e.replace(Ej,f=>f+c));break;case\"fs:#main-end\":s||(e=e.replace(Pj,f=>c+f));break;default:e=e.replace(n,f=>f+c)}}return e=e.replace(xb,\"\"),i&&(e=e.replace(/\\}\\s*$/,n=>n+Eot[t])),e}function Ly(e){let t={};return to(Array.isArray(e)&&e.length>1),e.forEach(r=>{for(let i in r)t[i]=t[i]?\"\".concat(t[i],`\n`).concat(r[i]):r[i]}),t}function ky(e){return new RegExp(\"\\\\b\".concat(e,\"[ \\\\t]+(\\\\w+[ \\\\t]+\\\\w+(\\\\[\\\\w+\\\\])?;)\"),\"g\")}var Ij=[[/^(#version[ \\t]+(100|300[ \\t]+es))?[ \\t]*\\n/,`#version 300 es\n`],[/\\btexture(2D|2DProj|Cube)Lod(EXT)?\\(/g,\"textureLod(\"],[/\\btexture(2D|2DProj|Cube)(EXT)?\\(/g,\"texture(\"]],Pot=[...Ij,[ky(\"attribute\"),\"in $1\"],[ky(\"varying\"),\"out $1\"]],Iot=[...Ij,[ky(\"varying\"),\"in $1\"]],Cj=[[/^#version[ \\t]+300[ \\t]+es/,\"#version 100\"],[/\\btexture(2D|2DProj|Cube)Lod\\(/g,\"texture$1LodEXT(\"],[/\\btexture\\(/g,\"texture2D(\"],[/\\btextureLod\\(/g,\"texture2DLodEXT(\"]],Cot=[...Cj,[ky(\"in\"),\"attribute $1\"],[ky(\"out\"),\"varying $1\"]],Lot=[...Cj,[ky(\"in\"),\"varying $1\"]],zR=\"gl_FragColor\",NR=/\\bout[ \\t]+vec4[ \\t]+(\\w+)[ \\t]*;\\n?/,kot=/void\\s+main\\s*\\([^)]*\\)\\s*\\{\\n?/;function UR(e,t,r){switch(t){case 300:return r?PE(e,Pot):Rot(e);case 100:return r?PE(e,Cot):Dot(e);default:throw new Error(\"unknown GLSL version \".concat(t))}}function PE(e,t){for(let[r,i]of t)e=e.replace(r,i);return e}function Rot(e){e=PE(e,Iot);let t=e.match(NR);if(t){let r=t[1];e=e.replace(new RegExp(\"\\\\b\".concat(zR,\"\\\\b\"),\"g\"),r)}else{let r=\"fragmentColor\";e=e.replace(kot,i=>\"out vec4 \".concat(r,`;\n`).concat(i)).replace(new RegExp(\"\\\\b\".concat(zR,\"\\\\b\"),\"g\"),r)}return e}function Dot(e){e=PE(e,Lot);let t=e.match(NR);if(t){let r=t[1];e=e.replace(NR,\"\").replace(new RegExp(\"\\\\b\".concat(r,\"\\\\b\"),\"g\"),zR)}return e}var Oot=`\n\n`.concat(xb,`\n\n`),kj={[ig]:\"vertex\",[yb]:\"fragment\"},Bot=`precision highp float;\n\n`;function VR(e,t){let{vs:r,fs:i}=t,s=yj(t.modules||[]);return{gl:e,vs:Lj(e,Object.assign({},t,{source:r,type:ig,modules:s})),fs:Lj(e,Object.assign({},t,{source:i,type:yb,modules:s})),getUniforms:Fot(s)}}function Lj(e,t){let{id:r,source:i,type:s,modules:n,defines:o={},hookFunctions:c=[],inject:f={},transpileToGLSL100:_=!1,prologue:w=!0,log:I}=t;to(typeof i==\"string\",\"shader source must be a string\");let R=s===ig,N=i.split(`\n`),j=100,Q=\"\",et=i;N[0].indexOf(\"#version \")===0?(j=300,Q=N[0],et=N.slice(1).join(`\n`)):Q=\"#version \".concat(j);let Y={};n.forEach(Xt=>{Object.assign(Y,Xt.getDefines())}),Object.assign(Y,o);let K=w?\"\".concat(Q,`\n`).concat(Not({id:r,source:i,type:s}),`\n`).concat(zot({type:s}),`\n`).concat(wj(e),`\n`).concat(Sj(e,j,!R),`\n`).concat(Uot(Y),`\n`).concat(R?\"\":Bot,`\n`):\"\".concat(Q,`\n`),J=jot(c),ut={},Et={},kt={};for(let Xt in f){let qt=typeof f[Xt]==\"string\"?{injection:f[Xt],order:0}:f[Xt],le=Xt.match(/^(v|f)s:(#)?([\\w-]+)$/);if(le){let ue=le[2],De=le[3];ue?De===\"decl\"?Et[Xt]=[qt]:kt[Xt]=[qt]:ut[Xt]=[qt]}else kt[Xt]=[qt]}for(let Xt of n){I&&Xt.checkDeprecations(et,I);let qt=Xt.getModuleSource(s,j);K+=qt;let le=Xt.injections[s];for(let ue in le){let De=ue.match(/^(v|f)s:#([\\w-]+)$/);if(De){let rr=De[2]===\"decl\"?Et:kt;rr[ue]=rr[ue]||[],rr[ue].push(le[ue])}else ut[ue]=ut[ue]||[],ut[ue].push(le[ue])}}return K+=Oot,K=EE(K,s,Et),K+=Vot(J[s],ut),K+=et,K=EE(K,s,kt),K=UR(K,_?100:j,R),K}function Fot(e){return function(r){let i={};for(let s of e){let n=s.getUniforms(r,i);Object.assign(i,n)}return i}}function zot(e){let{type:t}=e;return`\n#define SHADER_TYPE_`.concat(kj[t].toUpperCase(),`\n`)}function Not(e){let{id:t,source:r,type:i}=e;return t&&typeof t==\"string\"&&r.indexOf(\"SHADER_NAME\")===-1?`\n#define SHADER_NAME `.concat(t,\"_\").concat(kj[i],`\n\n`):\"\"}function Uot(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=0,r=\"\";for(let i in e){t===0&&(r+=`\n// APPLICATION DEFINES\n`),t++;let s=e[i];(s||Number.isFinite(s))&&(r+=\"#define \".concat(i.toUpperCase(),\" \").concat(e[i],`\n`))}return t===0&&(r+=`\n`),r}function Vot(e,t){let r=\"\";for(let i in e){let s=e[i];if(r+=\"void \".concat(s.signature,` {\n`),s.header&&(r+=\" \".concat(s.header)),t[i]){let n=t[i];n.sort((o,c)=>o.order-c.order);for(let o of n)r+=\" \".concat(o.injection,`\n`)}s.footer&&(r+=\" \".concat(s.footer)),r+=`}\n`}return r}function jot(e){let t={vs:{},fs:{}};return e.forEach(r=>{let i;typeof r!=\"string\"?(i=r,r=i.hook):i={},r=r.trim();let[s,n]=r.split(\":\"),o=r.replace(/\\(.+/,\"\");t[s][o]=Object.assign(i,{signature:n})}),t}var Got=\"void main() {gl_FragColor = vec4(0);}\",Rj=`out vec4 transform_output;\nvoid main() {\n transform_output = vec4(0);\n}`,Wot=`#version 300 es\n`.concat(Rj);function IE(e,t){t=Array.isArray(t)?t:[t];let r=e.replace(/^\\s+/,\"\").split(/\\s+/),[i,s,n]=r;if(!t.includes(i)||!s||!n)return null;let o=n.split(\";\")[0];return{qualifier:i,type:s,name:o}}function bb(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{version:t=100,input:r,inputType:i,output:s}=e;if(!r)return t===300?Wot:t>300?\"#version \".concat(t,`\n`).concat(Rj):Got;let n=Dj(r,i);return t>=300?\"#version \".concat(t,\" \").concat(t===300?\"es\":\"\",`\nin `).concat(i,\" \").concat(r,`;\nout vec4 `).concat(s,`;\nvoid main() {\n `).concat(s,\" = \").concat(n,`;\n}`):\"varying \".concat(i,\" \").concat(r,`;\nvoid main() {\n gl_FragColor = `).concat(n,`;\n}`)}function jR(e){switch(e){case\"float\":return\"x\";case\"vec2\":return\"xy\";case\"vec3\":return\"xyz\";case\"vec4\":return\"xyzw\";default:return to(!1),null}}function GR(e){switch(e){case\"float\":return 1;case\"vec2\":return 2;case\"vec3\":return 3;case\"vec4\":return 4;default:return to(!1),null}}function Dj(e,t){switch(t){case\"float\":return\"vec4(\".concat(e,\", 0.0, 0.0, 1.0)\");case\"vec2\":return\"vec4(\".concat(e,\", 0.0, 1.0)\");case\"vec3\":return\"vec4(\".concat(e,\", 1.0)\");case\"vec4\":return e;default:return to(!1),null}}var Hot=`#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\nconst float TWO_PI = 6.2831854820251465;\nconst float PI_2 = 1.5707963705062866;\nconst float PI_16 = 0.1963495463132858;\n\nconst float SIN_TABLE_0 = 0.19509032368659973;\nconst float SIN_TABLE_1 = 0.3826834261417389;\nconst float SIN_TABLE_2 = 0.5555702447891235;\nconst float SIN_TABLE_3 = 0.7071067690849304;\n\nconst float COS_TABLE_0 = 0.9807852506637573;\nconst float COS_TABLE_1 = 0.9238795042037964;\nconst float COS_TABLE_2 = 0.8314695954322815;\nconst float COS_TABLE_3 = 0.7071067690849304;\n\nconst float INVERSE_FACTORIAL_3 = 1.666666716337204e-01;\nconst float INVERSE_FACTORIAL_5 = 8.333333767950535e-03;\nconst float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04;\nconst float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06;\n\nfloat sin_taylor_fp32(float a) {\n float r, s, t, x;\n\n if (a == 0.0) {\n return 0.0;\n }\n\n x = -a * a;\n s = a;\n r = a;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_3;\n s = s + t;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_5;\n s = s + t;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_7;\n s = s + t;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_9;\n s = s + t;\n\n return s;\n}\n\nvoid sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {\n if (a == 0.0) {\n sin_t = 0.0;\n cos_t = 1.0;\n }\n sin_t = sin_taylor_fp32(a);\n cos_t = sqrt(1.0 - sin_t * sin_t);\n}\n\nfloat tan_taylor_fp32(float a) {\n float sin_a;\n float cos_a;\n\n if (a == 0.0) {\n return 0.0;\n }\n float z = floor(a / TWO_PI);\n float r = a - TWO_PI * z;\n\n float t;\n float q = floor(r / PI_2 + 0.5);\n int j = int(q);\n\n if (j < -2 || j > 2) {\n return 1.0 / 0.0;\n }\n\n t = r - PI_2 * q;\n\n q = floor(t / PI_16 + 0.5);\n int k = int(q);\n int abs_k = int(abs(float(k)));\n\n if (abs_k > 4) {\n return 1.0 / 0.0;\n } else {\n t = t - PI_16 * q;\n }\n\n float u = 0.0;\n float v = 0.0;\n\n float sin_t, cos_t;\n float s, c;\n sincos_taylor_fp32(t, sin_t, cos_t);\n\n if (k == 0) {\n s = sin_t;\n c = cos_t;\n } else {\n if (abs(float(abs_k) - 1.0) < 0.5) {\n u = COS_TABLE_0;\n v = SIN_TABLE_0;\n } else if (abs(float(abs_k) - 2.0) < 0.5) {\n u = COS_TABLE_1;\n v = SIN_TABLE_1;\n } else if (abs(float(abs_k) - 3.0) < 0.5) {\n u = COS_TABLE_2;\n v = SIN_TABLE_2;\n } else if (abs(float(abs_k) - 4.0) < 0.5) {\n u = COS_TABLE_3;\n v = SIN_TABLE_3;\n }\n if (k > 0) {\n s = u * sin_t + v * cos_t;\n c = u * cos_t - v * sin_t;\n } else {\n s = u * sin_t - v * cos_t;\n c = u * cos_t + v * sin_t;\n }\n }\n\n if (j == 0) {\n sin_a = s;\n cos_a = c;\n } else if (j == 1) {\n sin_a = c;\n cos_a = -s;\n } else if (j == -1) {\n sin_a = -c;\n cos_a = s;\n } else {\n sin_a = -s;\n cos_a = -c;\n }\n return sin_a / cos_a;\n}\n#endif\n\nfloat tan_fp32(float a) {\n#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\n return tan_taylor_fp32(a);\n#else\n return tan(a);\n#endif\n}\n`,CE={name:\"fp32\",vs:Hot,fs:null};function Bh(e,t){if(!e)throw new Error(\"math.gl assertion \".concat(t))}var Gkt=1/Math.PI*180,Wkt=1/180*Math.PI,eo={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function WR(e,{precision:t=eo.precision}={}){return e=qot(e),\"\".concat(parseFloat(e.toPrecision(t)))}function Fh(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Il(e,t,r){return Yot(e,i=>Math.max(t,Math.min(r,i)))}function il(e,t,r){return Fh(e)?e.map((i,s)=>il(i,t[s],r)):r*t+(1-r)*e}function Ro(e,t,r){let i=eo.EPSILON;r&&(eo.EPSILON=r);try{if(e===t)return!0;if(Fh(e)&&Fh(t)){if(e.length!==t.length)return!1;for(let s=0;s0?\", \":\"\")+WR(this[i],t);return\"\".concat(t.printTypes?this.constructor.name:\"\",\"[\").concat(r,\"]\")}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r=0&&t=0&&t0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function YR(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Dy(e,t,r){var i=t[0],s=t[1],n=t[2],o=r[0],c=r[1],f=r[2];return e[0]=s*f-n*c,e[1]=n*o-i*f,e[2]=i*c-s*o,e}function Hj(e,t,r,i){var s=t[0],n=t[1],o=t[2];return e[0]=s+i*(r[0]-s),e[1]=n+i*(r[1]-n),e[2]=o+i*(r[2]-o),e}function Oy(e,t,r){var i=t[0],s=t[1],n=t[2],o=r[3]*i+r[7]*s+r[11]*n+r[15];return o=o||1,e[0]=(r[0]*i+r[4]*s+r[8]*n+r[12])/o,e[1]=(r[1]*i+r[5]*s+r[9]*n+r[13])/o,e[2]=(r[2]*i+r[6]*s+r[10]*n+r[14])/o,e}function OE(e,t,r){var i=t[0],s=t[1],n=t[2];return e[0]=i*r[0]+s*r[3]+n*r[6],e[1]=i*r[1]+s*r[4]+n*r[7],e[2]=i*r[2]+s*r[5]+n*r[8],e}function BE(e,t,r){var i=r[0],s=r[1],n=r[2],o=r[3],c=t[0],f=t[1],_=t[2],w=s*_-n*f,I=n*c-i*_,R=i*f-s*c,N=s*R-n*I,j=n*w-i*R,Q=i*I-s*w,et=o*2;return w*=et,I*=et,R*=et,N*=2,j*=2,Q*=2,e[0]=c+w+N,e[1]=f+I+j,e[2]=_+R+Q,e}function qj(e,t,r,i){var s=[],n=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],n[0]=s[0],n[1]=s[1]*Math.cos(i)-s[2]*Math.sin(i),n[2]=s[1]*Math.sin(i)+s[2]*Math.cos(i),e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function Zj(e,t,r,i){var s=[],n=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],n[0]=s[2]*Math.sin(i)+s[0]*Math.cos(i),n[1]=s[1],n[2]=s[2]*Math.cos(i)-s[0]*Math.sin(i),e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function Yj(e,t,r,i){var s=[],n=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],n[0]=s[0]*Math.cos(i)-s[1]*Math.sin(i),n[1]=s[0]*Math.sin(i)+s[1]*Math.cos(i),n[2]=s[2],e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function Qj(e,t){var r=e[0],i=e[1],s=e[2],n=t[0],o=t[1],c=t[2],f=Math.sqrt(r*r+i*i+s*s),_=Math.sqrt(n*n+o*o+c*c),w=f*_,I=w&&YR(e,t)/w;return Math.acos(Math.min(Math.max(I,-1),1))}var FE=tat;var $j=eat;var zE=Jot,NE=rat,i4t=function(){var e=qR();return function(t,r,i,s,n,o){var c,f;for(r||(r=3),i||(i=0),s?f=Math.min(s*r+i,t.length):f=t.length,c=i;c0?this.copy([t,...r]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(iat)}fromObject(t){return this.check()}fromQuaternion(t){return i7(this,t),this.check()}set(t,r,i,s,n,o,c,f,_){return this[0]=t,this[1]=r,this[2]=i,this[3]=s,this[4]=n,this[5]=o,this[6]=c,this[7]=f,this[8]=_,this.check()}setRowMajor(t,r,i,s,n,o,c,f,_){return this[0]=t,this[1]=s,this[2]=c,this[3]=r,this[4]=n,this[5]=f,this[6]=i,this[7]=o,this[8]=_,this.check()}determinant(){return t7(this)}transpose(){return Kj(this,this),this.check()}invert(){return Jj(this,this),this.check()}multiplyLeft(t){return $R(this,t,this),this.check()}multiplyRight(t){return $R(this,this,t),this.check()}rotate(t){return r7(this,this,t),this.check()}scale(t){return Array.isArray(t)?XR(this,this,t):XR(this,this,[t,t]),this.check()}translate(t){return e7(this,this,t),this.check()}transform(t,r){let i;switch(t.length){case 2:i=Fj(r||[-0,-0],t,this);break;case 3:i=OE(r||[-0,-0,-0],t,this);break;case 4:i=DE(r||[-0,-0,-0,-0],t,this);break;default:throw new Error(\"Illegal vector\")}return QA(i,t.length),i}transformVector(t,r){return this.transform(t,r)}transformVector2(t,r){return this.transform(t,r)}transformVector3(t,r){return this.transform(t,r)}},jE,GE;function nat(){return jE||(jE=new ss([0,0,0,0,0,0,0,0,0]),Object.freeze(jE)),jE}function sat(){return GE||(GE=new ss,Object.freeze(GE)),GE}function oat(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function s7(e,t){if(e===t){var r=t[1],i=t[2],s=t[3],n=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=n,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function Sb(e,t){var r=t[0],i=t[1],s=t[2],n=t[3],o=t[4],c=t[5],f=t[6],_=t[7],w=t[8],I=t[9],R=t[10],N=t[11],j=t[12],Q=t[13],et=t[14],Y=t[15],K=r*c-i*o,J=r*f-s*o,ut=r*_-n*o,Et=i*f-s*c,kt=i*_-n*c,Xt=s*_-n*f,qt=w*Q-I*j,le=w*et-R*j,ue=w*Y-N*j,De=I*et-R*Q,Ke=I*Y-N*Q,rr=R*Y-N*et,Sr=K*rr-J*Ke+ut*De+Et*ue-kt*le+Xt*qt;return Sr?(Sr=1/Sr,e[0]=(c*rr-f*Ke+_*De)*Sr,e[1]=(s*Ke-i*rr-n*De)*Sr,e[2]=(Q*Xt-et*kt+Y*Et)*Sr,e[3]=(R*kt-I*Xt-N*Et)*Sr,e[4]=(f*ue-o*rr-_*le)*Sr,e[5]=(r*rr-s*ue+n*le)*Sr,e[6]=(et*ut-j*Xt-Y*J)*Sr,e[7]=(w*Xt-R*ut+N*J)*Sr,e[8]=(o*Ke-c*ue+_*qt)*Sr,e[9]=(i*ue-r*Ke-n*qt)*Sr,e[10]=(j*kt-Q*ut+Y*K)*Sr,e[11]=(I*ut-w*kt-N*K)*Sr,e[12]=(c*le-o*De-f*qt)*Sr,e[13]=(r*De-i*le+s*qt)*Sr,e[14]=(Q*J-j*Et-et*K)*Sr,e[15]=(w*Et-I*J+R*K)*Sr,e):null}function o7(e){var t=e[0],r=e[1],i=e[2],s=e[3],n=e[4],o=e[5],c=e[6],f=e[7],_=e[8],w=e[9],I=e[10],R=e[11],N=e[12],j=e[13],Q=e[14],et=e[15],Y=t*o-r*n,K=t*c-i*n,J=t*f-s*n,ut=r*c-i*o,Et=r*f-s*o,kt=i*f-s*c,Xt=_*j-w*N,qt=_*Q-I*N,le=_*et-R*N,ue=w*Q-I*j,De=w*et-R*j,Ke=I*et-R*Q;return Y*Ke-K*De+J*ue+ut*le-Et*qt+kt*Xt}function qf(e,t,r){var i=t[0],s=t[1],n=t[2],o=t[3],c=t[4],f=t[5],_=t[6],w=t[7],I=t[8],R=t[9],N=t[10],j=t[11],Q=t[12],et=t[13],Y=t[14],K=t[15],J=r[0],ut=r[1],Et=r[2],kt=r[3];return e[0]=J*i+ut*c+Et*I+kt*Q,e[1]=J*s+ut*f+Et*R+kt*et,e[2]=J*n+ut*_+Et*N+kt*Y,e[3]=J*o+ut*w+Et*j+kt*K,J=r[4],ut=r[5],Et=r[6],kt=r[7],e[4]=J*i+ut*c+Et*I+kt*Q,e[5]=J*s+ut*f+Et*R+kt*et,e[6]=J*n+ut*_+Et*N+kt*Y,e[7]=J*o+ut*w+Et*j+kt*K,J=r[8],ut=r[9],Et=r[10],kt=r[11],e[8]=J*i+ut*c+Et*I+kt*Q,e[9]=J*s+ut*f+Et*R+kt*et,e[10]=J*n+ut*_+Et*N+kt*Y,e[11]=J*o+ut*w+Et*j+kt*K,J=r[12],ut=r[13],Et=r[14],kt=r[15],e[12]=J*i+ut*c+Et*I+kt*Q,e[13]=J*s+ut*f+Et*R+kt*et,e[14]=J*n+ut*_+Et*N+kt*Y,e[15]=J*o+ut*w+Et*j+kt*K,e}function ag(e,t,r){var i=r[0],s=r[1],n=r[2],o,c,f,_,w,I,R,N,j,Q,et,Y;return t===e?(e[12]=t[0]*i+t[4]*s+t[8]*n+t[12],e[13]=t[1]*i+t[5]*s+t[9]*n+t[13],e[14]=t[2]*i+t[6]*s+t[10]*n+t[14],e[15]=t[3]*i+t[7]*s+t[11]*n+t[15]):(o=t[0],c=t[1],f=t[2],_=t[3],w=t[4],I=t[5],R=t[6],N=t[7],j=t[8],Q=t[9],et=t[10],Y=t[11],e[0]=o,e[1]=c,e[2]=f,e[3]=_,e[4]=w,e[5]=I,e[6]=R,e[7]=N,e[8]=j,e[9]=Q,e[10]=et,e[11]=Y,e[12]=o*i+w*s+j*n+t[12],e[13]=c*i+I*s+Q*n+t[13],e[14]=f*i+R*s+et*n+t[14],e[15]=_*i+N*s+Y*n+t[15]),e}function By(e,t,r){var i=r[0],s=r[1],n=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function a7(e,t,r,i){var s=i[0],n=i[1],o=i[2],c=Math.hypot(s,n,o),f,_,w,I,R,N,j,Q,et,Y,K,J,ut,Et,kt,Xt,qt,le,ue,De,Ke,rr,Sr,Li;return c0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=i*o,e[2]=s*o,e[3]=n*o,e}function _7(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function y7(e,t,r,i){var s=t[0],n=t[1],o=t[2],c=t[3];return e[0]=s+i*(r[0]-s),e[1]=n+i*(r[1]-n),e[2]=o+i*(r[2]-o),e[3]=c+i*(r[3]-c),e}function Nh(e,t,r){var i=t[0],s=t[1],n=t[2],o=t[3];return e[0]=r[0]*i+r[4]*s+r[8]*n+r[12]*o,e[1]=r[1]*i+r[5]*s+r[9]*n+r[13]*o,e[2]=r[2]*i+r[6]*s+r[10]*n+r[14]*o,e[3]=r[3]*i+r[7]*s+r[11]*n+r[15]*o,e}function v7(e,t,r){var i=t[0],s=t[1],n=t[2],o=r[0],c=r[1],f=r[2],_=r[3],w=_*i+c*n-f*s,I=_*s+f*i-o*n,R=_*n+o*s-c*i,N=-o*i-c*s-f*n;return e[0]=w*_+N*-o+I*-f-R*-c,e[1]=I*_+N*-c+R*-o-w*-f,e[2]=R*_+N*-f+w*-c-I*-o,e[3]=t[3],e}var b4t=function(){var e=cat();return function(t,r,i,s,n,o){var c,f;for(r||(r=4),i||(i=0),s?f=Math.min(s*r+i,t.length):f=t.length,c=i;cMath.PI*2)throw Error(\"expected radians\")}function Aat(e,t,r,i,s,n){let o=2*n/(r-t),c=2*n/(s-i),f=(r+t)/(r-t),_=(s+i)/(s-i),w=-1,I=-1,R=-2*n;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=f,e[9]=_,e[10]=w,e[11]=I,e[12]=0,e[13]=0,e[14]=R,e[15]=0,e}function b7(){var e=new ya(4);return ya!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function w7(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function iD(e,t,r){r=r*.5;var i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e}function nD(e,t,r){var i=t[0],s=t[1],n=t[2],o=t[3],c=r[0],f=r[1],_=r[2],w=r[3];return e[0]=i*w+o*c+s*_-n*f,e[1]=s*w+o*f+n*c-i*_,e[2]=n*w+o*_+i*f-s*c,e[3]=o*w-i*c-s*f-n*_,e}function S7(e,t,r){r*=.5;var i=t[0],s=t[1],n=t[2],o=t[3],c=Math.sin(r),f=Math.cos(r);return e[0]=i*f+o*c,e[1]=s*f+n*c,e[2]=n*f-s*c,e[3]=o*f-i*c,e}function T7(e,t,r){r*=.5;var i=t[0],s=t[1],n=t[2],o=t[3],c=Math.sin(r),f=Math.cos(r);return e[0]=i*f-n*c,e[1]=s*f+o*c,e[2]=n*f+i*c,e[3]=o*f-s*c,e}function M7(e,t,r){r*=.5;var i=t[0],s=t[1],n=t[2],o=t[3],c=Math.sin(r),f=Math.cos(r);return e[0]=i*f+s*c,e[1]=s*f-i*c,e[2]=n*f+o*c,e[3]=o*f-n*c,e}function E7(e,t){var r=t[0],i=t[1],s=t[2];return e[0]=r,e[1]=i,e[2]=s,e[3]=Math.sqrt(Math.abs(1-r*r-i*i-s*s)),e}function Mb(e,t,r,i){var s=t[0],n=t[1],o=t[2],c=t[3],f=r[0],_=r[1],w=r[2],I=r[3],R,N,j,Q,et;return N=s*f+n*_+o*w+c*I,N<0&&(N=-N,f=-f,_=-_,w=-w,I=-I),1-N>zh?(R=Math.acos(N),j=Math.sin(R),Q=Math.sin((1-i)*R)/j,et=Math.sin(i*R)/j):(Q=1-i,et=i),e[0]=Q*s+et*f,e[1]=Q*n+et*_,e[2]=Q*o+et*w,e[3]=Q*c+et*I,e}function P7(e,t){var r=t[0],i=t[1],s=t[2],n=t[3],o=r*r+i*i+s*s+n*n,c=o?1/o:0;return e[0]=-r*c,e[1]=-i*c,e[2]=-s*c,e[3]=n*c,e}function I7(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function sD(e,t){var r=t[0]+t[4]+t[8],i;if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{var s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);var n=(s+1)%3,o=(s+2)%3;i=Math.sqrt(t[s*3+s]-t[n*3+n]-t[o*3+o]+1),e[s]=.5*i,i=.5/i,e[3]=(t[n*3+o]-t[o*3+n])*i,e[n]=(t[n*3+s]+t[s*3+n])*i,e[o]=(t[o*3+s]+t[s*3+o])*i}return e}var C7=p7;var L7=Fy,k7=_7,R7=y7,D7=A7;var O7=m7;var B7=g7;var F7=function(){var e=qR(),t=ZR(1,0,0),r=ZR(0,1,0);return function(i,s,n){var o=YR(s,n);return o<-.999999?(Dy(e,t,s),zE(e)<1e-6&&Dy(e,r,s),Wj(e,e),iD(i,e,Math.PI),i):o>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(Dy(e,s,n),i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=1+o,B7(i,i))}}(),R4t=function(){var e=b7(),t=b7();return function(r,i,s,n,o,c){return Mb(e,i,o,c),Mb(t,s,n,c),Mb(r,e,t,2*c*(1-c)),r}}(),D4t=function(){var e=Xj();return function(t,r,i,s){return e[0]=i[0],e[3]=i[1],e[6]=i[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],B7(t,sD(t,e))}}();var gat=[0,0,0,1],lg=class extends np{constructor(t=0,r=0,i=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,i,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,r,i,s){return this[0]=t,this[1]=r,this[2]=i,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return sD(this,t),this.check()}fromAxisRotation(t,r){return iD(this,t,r),this.check()}identity(){return w7(this),this.check()}setAxisAngle(t,r){return this.fromAxisRotation(t,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=Qi(t)}get y(){return this[1]}set y(t){this[1]=Qi(t)}get z(){return this[2]}set z(t){this[2]=Qi(t)}get w(){return this[3]}set w(t){this[3]=Qi(t)}len(){return D7(this)}lengthSquared(){return O7(this)}dot(t){return k7(this,t)}rotationTo(t,r){return F7(this,t,r),this.check()}add(t){return C7(this,this,t),this.check()}calculateW(){return E7(this,this),this.check()}conjugate(){return I7(this,this),this.check()}invert(){return P7(this,this),this.check()}lerp(t,r,i){return i===void 0?this.lerp(this,t,r):(R7(this,t,r,i),this.check())}multiplyRight(t){return nD(this,this,t),this.check()}multiplyLeft(t){return nD(this,t,this),this.check()}normalize(){let t=this.len(),r=t>0?1/t:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,t===0&&(this[3]=1),this.check()}rotateX(t){return S7(this,this,t),this.check()}rotateY(t){return T7(this,this,t),this.check()}rotateZ(t){return M7(this,this,t),this.check()}scale(t){return L7(this,this,t),this.check()}slerp(t,r,i){let s,n,o;switch(arguments.length){case 1:({start:s=gat,target:n,ratio:o}=t);break;case 2:s=this,n=t,o=r;break;default:s=t,n=r,o=i}return Mb(this,s,n,o),this.check()}transformVector4(t,r=new wb){return v7(r,t,this),QA(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var YE={EPSILON1:.1,EPSILON2:.01,EPSILON3:.001,EPSILON4:1e-4,EPSILON5:1e-5,EPSILON6:1e-6,EPSILON7:1e-7,EPSILON8:1e-8,EPSILON9:1e-9,EPSILON10:1e-10,EPSILON11:1e-11,EPSILON12:1e-12,EPSILON13:1e-13,EPSILON14:1e-14,EPSILON15:1e-15,EPSILON16:1e-16,EPSILON17:1e-17,EPSILON18:1e-18,EPSILON19:1e-19,EPSILON20:1e-20,PI_OVER_TWO:Math.PI/2,PI_OVER_FOUR:Math.PI/4,PI_OVER_SIX:Math.PI/6,TWO_PI:Math.PI*2};var oD=`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))\n\nstruct AmbientLight {\n vec3 color;\n};\n\nstruct PointLight {\n vec3 color;\n vec3 position;\n vec3 attenuation;\n};\n\nstruct DirectionalLight {\n vec3 color;\n vec3 direction;\n};\n\nuniform AmbientLight lighting_uAmbientLight;\nuniform PointLight lighting_uPointLight[MAX_LIGHTS];\nuniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS];\nuniform int lighting_uPointLightCount;\nuniform int lighting_uDirectionalLightCount;\n\nuniform bool lighting_uEnabled;\n\nfloat getPointLightAttenuation(PointLight pointLight, float distance) {\n return pointLight.attenuation.x\n + pointLight.attenuation.y * distance\n + pointLight.attenuation.z * distance * distance;\n}\n\n#endif\n`;var _at={lightSources:{}};function aD(){let{color:e=[0,0,0],intensity:t=1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e.map(r=>r*t/255)}function yat(e){let{ambientLight:t,pointLights:r=[],directionalLights:i=[]}=e,s={};return t?s[\"lighting_uAmbientLight.color\"]=aD(t):s[\"lighting_uAmbientLight.color\"]=[0,0,0],r.forEach((n,o)=>{s[\"lighting_uPointLight[\".concat(o,\"].color\")]=aD(n),s[\"lighting_uPointLight[\".concat(o,\"].position\")]=n.position,s[\"lighting_uPointLight[\".concat(o,\"].attenuation\")]=n.attenuation||[1,0,0]}),s.lighting_uPointLightCount=r.length,i.forEach((n,o)=>{s[\"lighting_uDirectionalLight[\".concat(o,\"].color\")]=aD(n),s[\"lighting_uDirectionalLight[\".concat(o,\"].direction\")]=n.direction}),s.lighting_uDirectionalLightCount=i.length,s}function z7(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_at;if(\"lightSources\"in e){let{ambientLight:t,pointLights:r,directionalLights:i}=e.lightSources||{};return t||r&&r.length>0||i&&i.length>0?Object.assign({},yat({ambientLight:t,pointLights:r,directionalLights:i}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if(\"lights\"in e){let t={pointLights:[],directionalLights:[]};for(let r of e.lights||[])switch(r.type){case\"ambient\":t.ambientLight=r;break;case\"directional\":t.directionalLights.push(r);break;case\"point\":t.pointLights.push(r);break;default:}return z7({lightSources:t})}return{}}var lD={name:\"lights\",vs:oD,fs:oD,getUniforms:z7,defines:{MAX_LIGHTS:3}};var vat=new Uint8Array([0,255,255,255]),xat={pickingSelectedColor:null,pickingHighlightColor:vat,pickingActive:!1,pickingAttribute:!1};function bat(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:xat,t={};if(e.pickingSelectedColor!==void 0)if(!e.pickingSelectedColor)t.picking_uSelectedColorValid=0;else{let r=e.pickingSelectedColor.slice(0,3);t.picking_uSelectedColorValid=1,t.picking_uSelectedColor=r}if(e.pickingHighlightColor){let r=Array.from(e.pickingHighlightColor,i=>i/255);Number.isFinite(r[3])||(r[3]=1),t.picking_uHighlightColor=r}return e.pickingActive!==void 0&&(t.picking_uActive=!!e.pickingActive,t.picking_uAttribute=!!e.pickingAttribute),t}var wat=`uniform bool picking_uActive;\nuniform bool picking_uAttribute;\nuniform vec3 picking_uSelectedColor;\nuniform bool picking_uSelectedColorValid;\n\nout vec4 picking_vRGBcolor_Avalid;\n\nconst float COLOR_SCALE = 1. / 255.;\n\nbool picking_isColorValid(vec3 color) {\n return dot(color, vec3(1.0)) > 0.001;\n}\n\nbool isVertexPicked(vec3 vertexColor) {\n return\n picking_uSelectedColorValid &&\n !picking_isColorValid(abs(vertexColor - picking_uSelectedColor));\n}\n\nvoid picking_setPickingColor(vec3 pickingColor) {\n if (picking_uActive) {\n picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor));\n\n if (!picking_uAttribute) {\n picking_vRGBcolor_Avalid.rgb = pickingColor * COLOR_SCALE;\n }\n } else {\n picking_vRGBcolor_Avalid.a = float(isVertexPicked(pickingColor));\n }\n}\n\nvoid picking_setPickingAttribute(float value) {\n if (picking_uAttribute) {\n picking_vRGBcolor_Avalid.r = value;\n }\n}\nvoid picking_setPickingAttribute(vec2 value) {\n if (picking_uAttribute) {\n picking_vRGBcolor_Avalid.rg = value;\n }\n}\nvoid picking_setPickingAttribute(vec3 value) {\n if (picking_uAttribute) {\n picking_vRGBcolor_Avalid.rgb = value;\n }\n}\n`,Sat=`uniform bool picking_uActive;\nuniform vec3 picking_uSelectedColor;\nuniform vec4 picking_uHighlightColor;\n\nin vec4 picking_vRGBcolor_Avalid;\nvec4 picking_filterHighlightColor(vec4 color) {\n if (picking_uActive) {\n return color;\n }\n bool selected = bool(picking_vRGBcolor_Avalid.a);\n\n if (selected) {\n float highLightAlpha = picking_uHighlightColor.a;\n float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);\n float highLightRatio = highLightAlpha / blendedAlpha;\n\n vec3 blendedRGB = mix(color.rgb, picking_uHighlightColor.rgb, highLightRatio);\n return vec4(blendedRGB, blendedAlpha);\n } else {\n return color;\n }\n}\nvec4 picking_filterPickingColor(vec4 color) {\n if (picking_uActive) {\n if (picking_vRGBcolor_Avalid.a == 0.0) {\n discard;\n }\n return picking_vRGBcolor_Avalid;\n }\n return color;\n}\nvec4 picking_filterColor(vec4 color) {\n vec4 highightColor = picking_filterHighlightColor(color);\n return picking_filterPickingColor(highightColor);\n}\n\n`,QE={name:\"picking\",vs:wat,fs:Sat,getUniforms:bat};var cD=`\nuniform float lighting_uAmbient;\nuniform float lighting_uDiffuse;\nuniform float lighting_uShininess;\nuniform vec3 lighting_uSpecularColor;\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {\n vec3 halfway_direction = normalize(light_direction + view_direction);\n float lambertian = dot(light_direction, normal_worldspace);\n float specular = 0.0;\n if (lambertian > 0.0) {\n float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);\n specular = pow(specular_angle, lighting_uShininess);\n }\n lambertian = max(lambertian, 0.0);\n return (lambertian * lighting_uDiffuse * surfaceColor + specular * lighting_uSpecularColor) * color;\n}\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n vec3 lightColor = surfaceColor;\n\n if (lighting_uEnabled) {\n vec3 view_direction = normalize(cameraPosition - position_worldspace);\n lightColor = lighting_uAmbient * surfaceColor * lighting_uAmbientLight.color;\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uPointLightCount) {\n break;\n }\n PointLight pointLight = lighting_uPointLight[i];\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n }\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uDirectionalLightCount) {\n break;\n }\n DirectionalLight directionalLight = lighting_uDirectionalLight[i];\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n }\n }\n return lightColor;\n}\n\nvec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n vec3 lightColor = vec3(0, 0, 0);\n vec3 surfaceColor = vec3(0, 0, 0);\n\n if (lighting_uEnabled) {\n vec3 view_direction = normalize(cameraPosition - position_worldspace);\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uPointLightCount) {\n break;\n }\n PointLight pointLight = lighting_uPointLight[i];\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n }\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uDirectionalLightCount) {\n break;\n }\n DirectionalLight directionalLight = lighting_uDirectionalLight[i];\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n }\n }\n return lightColor;\n}\n`;var Tat={};function Mat(e){let{ambient:t=.35,diffuse:r=.6,shininess:i=32,specularColor:s=[30,30,30]}=e;return{lighting_uAmbient:t,lighting_uDiffuse:r,lighting_uShininess:i,lighting_uSpecularColor:s.map(n=>n/255)}}function N7(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Tat;if(!(\"material\"in e))return{};let{material:t}=e;return t?Mat(t):{lighting_uEnabled:!1}}var Zf={name:\"gouraud-lighting\",dependencies:[lD],vs:cD,defines:{LIGHTING_VERTEX:1},getUniforms:N7},Ny={name:\"phong-lighting\",dependencies:[lD],fs:cD,defines:{LIGHTING_FRAGMENT:1},getUniforms:N7};var Eat=`attribute float transform_elementID;\nvec2 transform_getPixelSizeHalf(vec2 size) {\n return vec2(1.) / (2. * size);\n}\n\nvec2 transform_getPixelIndices(vec2 texSize, vec2 pixelSizeHalf) {\n float yIndex = floor((transform_elementID / texSize[0]) + pixelSizeHalf[1]);\n float xIndex = transform_elementID - (yIndex * texSize[0]);\n return vec2(xIndex, yIndex);\n}\nvec2 transform_getTexCoord(vec2 size) {\n vec2 pixelSizeHalf = transform_getPixelSizeHalf(size);\n vec2 indices = transform_getPixelIndices(size, pixelSizeHalf);\n vec2 coord = indices / size + pixelSizeHalf;\n return coord;\n}\nvec2 transform_getPos(vec2 size) {\n vec2 texCoord = transform_getTexCoord(size);\n vec2 pos = (texCoord * (2.0, 2.0)) - (1., 1.);\n return pos;\n}\nvec4 transform_getInput(sampler2D texSampler, vec2 size) {\n vec2 texCoord = transform_getTexCoord(size);\n vec4 textureColor = texture2D(texSampler, texCoord);\n return textureColor;\n}\n`,uD={name:\"transform\",vs:Eat,fs:null};var Uh=class e{static getDefaultProgramManager(t){return t.luma=t.luma||{},t.luma.defaultProgramManager=t.luma.defaultProgramManager||new e(t),t.luma.defaultProgramManager}constructor(t){this.gl=t,this._programCache={},this._getUniforms={},this._registeredModules={},this._hookFunctions=[],this._defaultModules=[],this._hashes={},this._hashCounter=0,this.stateHash=0,this._useCounts={}}addDefaultModule(t){this._defaultModules.find(r=>r.name===t.name)||this._defaultModules.push(t),this.stateHash++}removeDefaultModule(t){let r=typeof t==\"string\"?t:t.name;this._defaultModules=this._defaultModules.filter(i=>i.name!==r),this.stateHash++}addShaderHook(t,r){r&&(t=Object.assign(r,{hook:t})),this._hookFunctions.push(t),this.stateHash++}get(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{vs:r=\"\",fs:i=\"\",defines:s={},inject:n={},varyings:o=[],bufferMode:c=35981,transpileToGLSL100:f=!1}=t,_=this._getModuleList(t.modules),w=this._getHash(r),I=this._getHash(i),R=_.map(J=>this._getHash(J.name)).sort(),N=o.map(J=>this._getHash(J)),j=Object.keys(s).sort(),Q=Object.keys(n).sort(),et=[],Y=[];for(let J of j)et.push(this._getHash(J)),et.push(this._getHash(s[J]));for(let J of Q)Y.push(this._getHash(J)),Y.push(this._getHash(n[J]));let K=\"\".concat(w,\"/\").concat(I,\"D\").concat(et.join(\"/\"),\"M\").concat(R.join(\"/\"),\"I\").concat(Y.join(\"/\"),\"V\").concat(N.join(\"/\"),\"H\").concat(this.stateHash,\"B\").concat(c).concat(f?\"T\":\"\");if(!this._programCache[K]){let J=VR(this.gl,{vs:r,fs:i,modules:_,inject:n,defines:s,hookFunctions:this._hookFunctions,transpileToGLSL100:f});this._programCache[K]=new rp(this.gl,{hash:K,vs:J.vs,fs:J.fs,varyings:o,bufferMode:c}),this._getUniforms[K]=J.getUniforms||(ut=>{}),this._useCounts[K]=0}return this._useCounts[K]++,this._programCache[K]}getUniforms(t){return this._getUniforms[t.hash]||null}release(t){let r=t.hash;this._useCounts[r]--,this._useCounts[r]===0&&(this._programCache[r].delete(),delete this._programCache[r],delete this._getUniforms[r],delete this._useCounts[r])}_getHash(t){return this._hashes[t]===void 0&&(this._hashes[t]=this._hashCounter++),this._hashes[t]}_getModuleList(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=new Array(this._defaultModules.length+t.length),i={},s=0;for(let n=0,o=this._defaultModules.length;n{},Rat={},fn=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{id:i=ta(\"model\")}=r;ye(Jd(t)),this.id=i,this.gl=t,this.id=r.id||ta(\"Model\"),this.lastLogTime=0,this.animated=!1,this.initialize(r)}initialize(t){this.props={},this.programManager=t.programManager||Uh.getDefaultProgramManager(this.gl),this._programManagerState=-1,this._managedProgram=!1;let{program:r=null,vs:i,fs:s,modules:n,defines:o,inject:c,varyings:f,bufferMode:_,transpileToGLSL100:w}=t;this.programProps={program:r,vs:i,fs:s,modules:n,defines:o,inject:c,varyings:f,bufferMode:_,transpileToGLSL100:w},this.program=null,this.vertexArray=null,this._programDirty=!0,this.userData={},this.needsRedraw=!0,this._attributes={},this.attributes={},this.uniforms={},this.pickable=!0,this._checkProgram(),this.setUniforms(Object.assign({},this.getModuleUniforms(t.moduleSettings))),this.drawMode=t.drawMode!==void 0?t.drawMode:4,this.vertexCount=t.vertexCount||0,this.geometryBuffers={},this.isInstanced=t.isInstanced||t.instanced||t.instanceCount>0,this._setModelProps(t),this.geometry={},ye(this.drawMode!==void 0&&Number.isFinite(this.vertexCount),kat)}setProps(t){this._setModelProps(t)}delete(){for(let t in this._attributes)this._attributes[t]!==this.attributes[t]&&this._attributes[t].delete();this._managedProgram&&(this.programManager.release(this.program),this._managedProgram=!1),this.vertexArray.delete(),this._deleteGeometryBuffers()}getDrawMode(){return this.drawMode}getVertexCount(){return this.vertexCount}getInstanceCount(){return this.instanceCount}getAttributes(){return this.attributes}getProgram(){return this.program}setProgram(t){let{program:r,vs:i,fs:s,modules:n,defines:o,inject:c,varyings:f,bufferMode:_,transpileToGLSL100:w}=t;this.programProps={program:r,vs:i,fs:s,modules:n,defines:o,inject:c,varyings:f,bufferMode:_,transpileToGLSL100:w},this._programDirty=!0}getUniforms(){return this.uniforms}setDrawMode(t){return this.drawMode=t,this}setVertexCount(t){return ye(Number.isFinite(t)),this.vertexCount=t,this}setInstanceCount(t){return ye(Number.isFinite(t)),this.instanceCount=t,this}setGeometry(t){return this.drawMode=t.drawMode,this.vertexCount=t.getVertexCount(),this._deleteGeometryBuffers(),this.geometryBuffers=U7(this.gl,t),this.vertexArray.setAttributes(this.geometryBuffers),this}setAttributes(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Wf(t))return this;let r={};for(let i in t){let s=t[i];r[i]=s.getValue?s.getValue():s}return this.vertexArray.setAttributes(r),this}setUniforms(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.assign(this.uniforms,t),this}getModuleUniforms(t){this._checkProgram();let r=this.programManager.getUniforms(this.program);return r?r(t):{}}updateModuleSettings(t){let r=this.getModuleUniforms(t||{});return this.setUniforms(r)}clear(t){return Hf(this.program.gl,t),this}draw(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._checkProgram();let{moduleSettings:r=null,framebuffer:i,uniforms:s={},attributes:n={},transformFeedback:o=this.transformFeedback,parameters:c={},vertexArray:f=this.vertexArray}=t;this.setAttributes(n),this.updateModuleSettings(r),this.setUniforms(s);let _;He.priority>=Uy&&(_=this._logDrawCallStart(Uy));let w=this.vertexArray.getDrawParams(),{isIndexed:I=w.isIndexed,indexType:R=w.indexType,indexOffset:N=w.indexOffset,vertexArrayInstanced:j=w.isInstanced}=this.props;j&&!this.isInstanced&&He.warn(\"Found instanced attributes on non-instanced model\",this.id)();let{isInstanced:Q,instanceCount:et}=this,{onBeforeRender:Y=V7,onAfterRender:K=V7}=this.props;Y(),this.program.setUniforms(this.uniforms);let J=this.program.draw(Object.assign(Rat,t,{logPriority:_,uniforms:null,framebuffer:i,parameters:c,drawMode:this.getDrawMode(),vertexCount:this.getVertexCount(),vertexArray:f,transformFeedback:o,isIndexed:I,indexType:R,isInstanced:Q,instanceCount:et,offset:I?N:0}));return K(),He.priority>=Uy&&this._logDrawCallEnd(_,f,i),J}transform(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{discard:r=!0,feedbackBuffers:i,unbindModels:s=[]}=t,{parameters:n}=t;i&&this._setFeedbackBuffers(i),r&&(n=Object.assign({},n,{35977:r})),s.forEach(o=>o.vertexArray.unbindBuffers());try{this.draw(Object.assign({},t,{parameters:n}))}finally{s.forEach(o=>o.vertexArray.bindBuffers())}return this}render(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.warn(\"Model.render() is deprecated. Use Model.setUniforms() and Model.draw()\")(),this.setUniforms(t).draw()}_setModelProps(t){Object.assign(this.props,t),\"uniforms\"in t&&this.setUniforms(t.uniforms),\"pickable\"in t&&(this.pickable=t.pickable),\"instanceCount\"in t&&(this.instanceCount=t.instanceCount),\"geometry\"in t&&this.setGeometry(t.geometry),\"attributes\"in t&&this.setAttributes(t.attributes),\"_feedbackBuffers\"in t&&this._setFeedbackBuffers(t._feedbackBuffers)}_checkProgram(){if(!(this._programDirty||this.programManager.stateHash!==this._programManagerState))return;let{program:r}=this.programProps;if(r)this._managedProgram=!1;else{let{vs:i,fs:s,modules:n,inject:o,defines:c,varyings:f,bufferMode:_,transpileToGLSL100:w}=this.programProps;r=this.programManager.get({vs:i,fs:s,modules:n,inject:o,defines:c,varyings:f,bufferMode:_,transpileToGLSL100:w}),this.program&&this._managedProgram&&this.programManager.release(this.program),this._programManagerState=this.programManager.stateHash,this._managedProgram=!0}ye(r instanceof rp,\"Model needs a program\"),this._programDirty=!1,r!==this.program&&(this.program=r,this.vertexArray?this.vertexArray.setProps({program:this.program,attributes:this.vertexArray.attributes}):this.vertexArray=new Iy(this.gl,{program:this.program}),this.setUniforms(Object.assign({},this.getModuleUniforms())))}_deleteGeometryBuffers(){for(let t in this.geometryBuffers){let r=this.geometryBuffers[t][0]||this.geometryBuffers[t];r instanceof Fr&&r.delete()}}_setAnimationProps(t){this.animated&&ye(t,\"Model.draw(): animated uniforms but no animationProps\")}_setFeedbackBuffers(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Wf(t))return this;let{gl:r}=this.program;return this.transformFeedback=this.transformFeedback||new ip(r,{program:this.program}),this.transformFeedback.setBuffers(t),this}_logDrawCallStart(t){let r=t>3?0:Lat;if(!(Date.now()-this.lastLogTime>> DRAWING MODEL \".concat(this.id),{collapsed:He.level<=2})(),t}_logDrawCallEnd(t,r,i,s){if(t===void 0)return;let n=CR({vertexArray:r,header:\"\".concat(this.id,\" attributes\"),attributes:this._attributes}),{table:o,unusedTable:c,unusedCount:f}=ME({header:\"\".concat(this.id,\" uniforms\"),program:this.program,uniforms:Object.assign({},this.program.uniforms,i)}),{table:_,count:w}=ME({header:\"\".concat(this.id,\" uniforms\"),program:this.program,uniforms:Object.assign({},this.program.uniforms,i),undefinedOnly:!0});w>0&&He.log(\"MISSING UNIFORMS\",Object.keys(_))(),f>0&&He.log(\"UNUSED UNIFORMS\",Object.keys(c))();let I=LR(this.vertexArray.configuration);He.table(t,n)(),He.table(t,o)(),He.table(t+1,I)(),s&&s.log({logLevel:Uy,message:\"Rendered to \".concat(s.id)}),He.groupEnd(Uy)()}};var Eb=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.currentIndex=0,this.feedbackMap={},this.varyings=null,this.bindings=[],this.resources={},this._initialize(r),Object.seal(this)}setupResources(t){for(let r of this.bindings)this._setupTransformFeedback(r,t)}updateModelProps(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{varyings:r}=this;return r.length>0&&(t=Object.assign({},t,{varyings:r})),t}getDrawOptions(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=this.bindings[this.currentIndex],{sourceBuffers:i,transformFeedback:s}=r;return{attributes:Object.assign({},i,t.attributes),transformFeedback:s}}swap(){return this.feedbackMap?(this.currentIndex=this._getNextIndex(),!0):!1}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._setupBuffers(t)}getBuffer(t){let{feedbackBuffers:r}=this.bindings[this.currentIndex],i=t?r[t]:null;return i?i instanceof Fr?i:i.buffer:null}getData(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{varyingName:r}=t,i=this.getBuffer(r);return i?i.getData():null}delete(){for(let t in this.resources)this.resources[t].delete()}_initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._setupBuffers(t),this.varyings=t.varyings||Object.keys(this.bindings[this.currentIndex].feedbackBuffers),this.varyings.length>0&&ye(fr(this.gl))}_getFeedbackBuffers(t){let{sourceBuffers:r={}}=t,i={};if(this.bindings[this.currentIndex]&&Object.assign(i,this.bindings[this.currentIndex].feedbackBuffers),this.feedbackMap)for(let s in this.feedbackMap){let n=this.feedbackMap[s];s in r&&(i[n]=s)}Object.assign(i,t.feedbackBuffers);for(let s in i){let n=i[s];if(typeof n==\"string\"){let o=r[n],{byteLength:c,usage:f,accessor:_}=o;i[s]=this._createNewBuffer(s,{byteLength:c,usage:f,accessor:_})}}return i}_setupBuffers(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{sourceBuffers:r=null}=t;Object.assign(this.feedbackMap,t.feedbackMap);let i=this._getFeedbackBuffers(t);this._updateBindings({sourceBuffers:r,feedbackBuffers:i})}_setupTransformFeedback(t,r){let{model:i}=r,{program:s}=i;t.transformFeedback=new ip(this.gl,{program:s,buffers:t.feedbackBuffers})}_updateBindings(t){if(this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t),this.feedbackMap){let{sourceBuffers:r,feedbackBuffers:i}=this._swapBuffers(this.bindings[this.currentIndex]),s=this._getNextIndex();this.bindings[s]=this._updateBinding(this.bindings[s],{sourceBuffers:r,feedbackBuffers:i})}}_updateBinding(t,r){return t?(Object.assign(t.sourceBuffers,r.sourceBuffers),Object.assign(t.feedbackBuffers,r.feedbackBuffers),t.transformFeedback&&t.transformFeedback.setBuffers(t.feedbackBuffers),t):{sourceBuffers:Object.assign({},r.sourceBuffers),feedbackBuffers:Object.assign({},r.feedbackBuffers)}}_swapBuffers(t){if(!this.feedbackMap)return null;let r=Object.assign({},t.sourceBuffers),i=Object.assign({},t.feedbackBuffers);for(let s in this.feedbackMap){let n=this.feedbackMap[s];r[s]=t.feedbackBuffers[n],i[n]=t.sourceBuffers[s],ye(i[n]instanceof Fr)}return{sourceBuffers:r,feedbackBuffers:i}}_createNewBuffer(t,r){let i=new Fr(this.gl,r);return this.resources[t]&&this.resources[t].delete(),this.resources[t]=i,i}_getNextIndex(){return(this.currentIndex+1)%2}};var Dat=\"transform_uSampler_\",$E=\"transform_uSize_\",j7=\"transform_position\";function G7(e){let{vs:t,sourceTextureMap:r,targetTextureVarying:i,targetTexture:s}=e,o=Object.keys(r).length,c=null,f={},_=t,w={};if(o>0||i){let I=_.split(`\n`),R=I.slice();if(I.forEach((N,j,Q)=>{if(o>0){let et=zat(N,r);if(et){let{updatedLine:Y,inject:K}=et;R[j]=Y,w=Ly([w,K]),Object.assign(f,et.samplerTextureMap),o--}}i&&!c&&(c=Fat(N,i))}),i){ye(s);let N=\"\".concat($E).concat(i),j=\"uniform vec2 \".concat(N,`;\n`),Q=\" vec2 \".concat(j7,\" = transform_getPos(\").concat(N,`);\n gl_Position = vec4(`).concat(j7,`, 0, 1.);\n`);w=Ly([w,{\"vs:#decl\":j,\"vs:#main-start\":Q}])}_=R.join(`\n`)}return{vs:_,targetTextureType:c,inject:w,samplerTextureMap:f}}function W7(e){let{sourceTextureMap:t,targetTextureVarying:r,targetTexture:i}=e,s={},n,o;r&&({width:n,height:o}=i,s[\"\".concat($E).concat(r)]=[n,o]);for(let c in t)({width:n,height:o}=t[c]),s[\"\".concat($E).concat(c)]=[n,o];return s}function Oat(e){return IE(e,[\"attribute\",\"in\"])}function Bat(e){let t=\"\".concat(Dat).concat(e),r=\"\".concat($E).concat(e),i=\" uniform sampler2D \".concat(t,`;\n uniform vec2 `).concat(r,\";\");return{samplerName:t,sizeName:r,uniformDeclerations:i}}function Fat(e,t){let r=IE(e,[\"varying\",\"out\"]);return r&&r.name===t?r.type:null}function zat(e,t){let r={},i=Oat(e);if(!i)return null;let{type:s,name:n}=i;if(n&&t[n]){let o=\"// \".concat(e,\" => Replaced by Transform with a sampler\"),{samplerName:c,sizeName:f,uniformDeclerations:_}=Bat(n),w=jR(s),I=\" \".concat(s,\" \").concat(n,\" = transform_getInput(\").concat(c,\", \").concat(f,\").\").concat(w,`;\n`);return r[c]=n,{updatedLine:o,inject:{\"vs:#decl\":_,\"vs:#main-start\":I},samplerTextureMap:r}}return null}var Nat={10241:9728,10240:9728,10242:33071,10243:33071},Uat=\"transform_output\",Pb=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.id=this.currentIndex=0,this._swapTexture=null,this.targetTextureVarying=null,this.targetTextureType=null,this.samplerTextureMap=null,this.bindings=[],this.resources={},this._initialize(r),Object.seal(this)}updateModelProps(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=this._processVertexShader(t);return Object.assign({},t,r)}getDrawOptions(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{sourceBuffers:r,sourceTextures:i,framebuffer:s,targetTexture:n}=this.bindings[this.currentIndex],o=Object.assign({},r,t.attributes),c=Object.assign({},t.uniforms),f=Object.assign({},t.parameters),_=t.discard;if(this.hasSourceTextures||this.hasTargetTexture){o.transform_elementID=this.elementIDBuffer;for(let I in this.samplerTextureMap){let R=this.samplerTextureMap[I];c[I]=i[R]}this._setSourceTextureParameters();let w=W7({sourceTextureMap:i,targetTextureVarying:this.targetTextureVarying,targetTexture:n});Object.assign(c,w)}return this.hasTargetTexture&&(_=!1,f.viewport=[0,0,s.width,s.height]),{attributes:o,framebuffer:s,uniforms:c,discard:_,parameters:f}}swap(){return this._swapTexture?(this.currentIndex=this._getNextIndex(),!0):!1}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._setupTextures(t)}getTargetTexture(){let{targetTexture:t}=this.bindings[this.currentIndex];return t}getData(){let{packed:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{framebuffer:r}=this.bindings[this.currentIndex],i=Dh(r);if(!t)return i;let s=i.constructor,n=GR(this.targetTextureType),o=new s(i.length*n/4),c=0;for(let f=0;f0&&arguments[0]!==void 0?arguments[0]:{},{_targetTextureVarying:r,_swapTexture:i}=t;this._swapTexture=i,this.targetTextureVarying=r,this.hasTargetTexture=r,this._setupTextures(t)}_createTargetTexture(t){let{sourceTextures:r,textureOrReference:i}=t;if(i instanceof pi)return i;let s=r[i];return s?(this._targetRefTexName=i,this._createNewTexture(s)):null}_setupTextures(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{sourceBuffers:r,_sourceTextures:i={},_targetTexture:s}=t,n=this._createTargetTexture({sourceTextures:i,textureOrReference:s});this.hasSourceTextures=this.hasSourceTextures||i&&Object.keys(i).length>0,this._updateBindings({sourceBuffers:r,sourceTextures:i,targetTexture:n}),\"elementCount\"in t&&this._updateElementIDBuffer(t.elementCount)}_updateElementIDBuffer(t){if(typeof t!=\"number\"||this.elementCount>=t)return;let r=new Float32Array(t);r.forEach((i,s,n)=>{n[s]=s}),this.elementIDBuffer?this.elementIDBuffer.setData({data:r}):this.elementIDBuffer=new Fr(this.gl,{data:r,accessor:{size:1}}),this.elementCount=t}_updateBindings(t){if(this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t),this._swapTexture){let{sourceTextures:r,targetTexture:i}=this._swapTextures(this.bindings[this.currentIndex]),s=this._getNextIndex();this.bindings[s]=this._updateBinding(this.bindings[s],{sourceTextures:r,targetTexture:i})}}_updateBinding(t,r){let{sourceBuffers:i,sourceTextures:s,targetTexture:n}=r;if(t||(t={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(t.sourceTextures,s),Object.assign(t.sourceBuffers,i),n){t.targetTexture=n;let{width:o,height:c}=n,{framebuffer:f}=t;f?(f.update({attachments:{36064:n},resizeAttachments:!1}),f.resize({width:o,height:c})):t.framebuffer=new yi(this.gl,{id:\"transform-framebuffer\",width:o,height:c,attachments:{36064:n}})}return t}_setSourceTextureParameters(){let t=this.currentIndex,{sourceTextures:r}=this.bindings[t];for(let i in r)r[i].setParameters(Nat)}_swapTextures(t){if(!this._swapTexture)return null;let r=Object.assign({},t.sourceTextures);r[this._swapTexture]=t.targetTexture;let i=t.sourceTextures[this._swapTexture];return{sourceTextures:r,targetTexture:i}}_createNewTexture(t){let r=yE(t,{parameters:{10241:9728,10240:9728,10242:33071,10243:33071},pixelStore:{37440:!1}});return this.ownTexture&&this.ownTexture.delete(),this.ownTexture=r,r}_getNextIndex(){return(this.currentIndex+1)%2}_processVertexShader(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{sourceTextures:r,targetTexture:i}=this.bindings[this.currentIndex],{vs:s,uniforms:n,targetTextureType:o,inject:c,samplerTextureMap:f}=G7({vs:t.vs,sourceTextureMap:r,targetTextureVarying:this.targetTextureVarying,targetTexture:i}),_=Ly([t.inject||{},c]);this.targetTextureType=o,this.samplerTextureMap=f;let w=t._fs||bb({version:Py(s),input:this.targetTextureVarying,inputType:o,output:Uat}),I=this.hasSourceTextures||this.targetTextureVarying?[uD].concat(t.modules||[]):t.modules;return{vs:s,fs:w,modules:I,uniforms:n,inject:_}}};var nc=class{static isSupported(t){return fr(t)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.model=null,this.elementCount=0,this.bufferTransform=null,this.textureTransform=null,this.elementIDBuffer=null,this._initialize(r),Object.seal(this)}delete(){let{model:t,bufferTransform:r,textureTransform:i}=this;t&&t.delete(),r&&r.delete(),i&&i.delete()}run(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{clearRenderTarget:r=!0}=t,i=this._updateDrawOptions(t);r&&i.framebuffer&&i.framebuffer.clear({color:!0}),this.model.transform(i)}swap(){let t=!1,r=[this.bufferTransform,this.textureTransform].filter(Boolean);for(let i of r)t=t||i.swap();ye(t,\"Nothing to swap\")}getBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.bufferTransform&&this.bufferTransform.getBuffer(t)}getData(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=[this.bufferTransform,this.textureTransform].filter(Boolean);for(let i of r){let s=i.getData(t);if(s)return s}return null}getFramebuffer(){return this.textureTransform&&this.textureTransform.getFramebuffer()}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};\"elementCount\"in t&&this.model.setVertexCount(t.elementCount);let r=[this.bufferTransform,this.textureTransform].filter(Boolean);for(let i of r)i.update(t)}_initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{gl:r}=this;this._buildResourceTransforms(r,t),t=this._updateModelProps(t),this.model=new fn(r,Object.assign({},t,{fs:t.fs||bb({version:Py(t.vs)}),id:t.id||\"transform-model\",drawMode:t.drawMode||0,vertexCount:t.elementCount})),this.bufferTransform&&this.bufferTransform.setupResources({model:this.model})}_updateModelProps(t){let r=Object.assign({},t),i=[this.bufferTransform,this.textureTransform].filter(Boolean);for(let s of i)r=s.updateModelProps(r);return r}_buildResourceTransforms(t,r){Vat(r)&&(this.bufferTransform=new Eb(t,r)),jat(r)&&(this.textureTransform=new Pb(t,r)),ye(this.bufferTransform||this.textureTransform,\"must provide source/feedback buffers or source/target textures\")}_updateDrawOptions(t){let r=Object.assign({},t),i=[this.bufferTransform,this.textureTransform].filter(Boolean);for(let s of i)r=Object.assign(r,s.getDrawOptions(r));return r}};function Vat(e){return!!(!Wf(e.feedbackBuffers)||!Wf(e.feedbackMap)||e.varyings&&e.varyings.length>0)}function jat(e){return!!(!Wf(e._sourceTextures)||e._targetTexture||e._targetTextureVarying)}var H7={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},$n=class{static get DRAW_MODE(){return H7}constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{id:r=ta(\"geometry\"),drawMode:i=H7.TRIANGLES,attributes:s={},indices:n=null,vertexCount:o=null}=t;this.id=r,this.drawMode=i|0,this.attributes={},this.userData={},this._setAttributes(s,n),this.vertexCount=o||this._calculateVertexCount(this.attributes,this.indices)}get mode(){return this.drawMode}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(t){return\"Geometry \".concat(this.id,\" attribute \").concat(t)}_setAttributes(t,r){r&&(this.indices=ArrayBuffer.isView(r)?{value:r,size:1}:r);for(let i in t){let s=t[i];s=ArrayBuffer.isView(s)?{value:s}:s,ye(ArrayBuffer.isView(s.value),\"\".concat(this._print(i),\": must be typed array or object with value as typed array\")),(i===\"POSITION\"||i===\"positions\")&&!s.size&&(s.size=3),i===\"indices\"?(ye(!this.indices),this.indices=s):this.attributes[i]=s}return this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this}_calculateVertexCount(t,r){if(r)return r.value.length;let i=1/0;for(let s in t){let n=t[s],{value:o,size:c,constant:f}=n;!f&&o&&c>=1&&(i=Math.min(i,o.length/c))}return ye(Number.isFinite(i)),i}};var Gat=1,Wat=1,KA=class{constructor(){this.time=0,this.channels=new Map,this.animations=new Map,this.playing=!1,this.lastEngineTime=-1}addChannel(t){let{delay:r=0,duration:i=Number.POSITIVE_INFINITY,rate:s=1,repeat:n=1}=t,o=Gat++,c={time:0,delay:r,duration:i,rate:s,repeat:n};return this._setChannelTime(c,this.time),this.channels.set(o,c),o}removeChannel(t){this.channels.delete(t);for(let[r,i]of this.animations)i.channel===t&&this.detachAnimation(r)}isFinished(t){let r=this.channels.get(t);return r===void 0?!1:this.time>=r.delay+r.duration*r.repeat}getTime(t){if(t===void 0)return this.time;let r=this.channels.get(t);return r===void 0?-1:r.time}setTime(t){this.time=Math.max(0,t);let r=this.channels.values();for(let s of r)this._setChannelTime(s,this.time);let i=this.animations.values();for(let s of i){let{animation:n,channel:o}=s;n.setTime(this.getTime(o))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(t,r){let i=Wat++;return this.animations.set(i,{animation:t,channel:r}),t.setTime(this.getTime(r)),i}detachAnimation(t){this.animations.delete(t)}update(t){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=t),this.setTime(this.time+(t-this.lastEngineTime)),this.lastEngineTime=t)}_setChannelTime(t,r){let i=r-t.delay,s=t.duration*t.repeat;i>=s?t.time=t.duration*t.rate:(t.time=Math.max(0,i)%t.duration,t.time*=t.rate)}};var Hat=[255,255,255],qat=1,Zat=0,XE=class{constructor(t={}){G(this,\"id\",void 0),G(this,\"color\",void 0),G(this,\"intensity\",void 0),G(this,\"type\",\"ambient\");let{color:r=Hat}=t,{intensity:i=qat}=t;this.id=t.id||\"ambient-\".concat(Zat++),this.color=r,this.intensity=i}};var Yat=[255,255,255],Qat=1,$at=[0,0,-1],Xat=0,Ib=class{constructor(t={}){G(this,\"id\",void 0),G(this,\"color\",void 0),G(this,\"intensity\",void 0),G(this,\"type\",\"directional\"),G(this,\"direction\",void 0),G(this,\"shadow\",void 0);let{color:r=Yat}=t,{intensity:i=Qat}=t,{direction:s=$at}=t,{_shadow:n=!1}=t;this.id=t.id||\"directional-\".concat(Xat++),this.color=r,this.intensity=i,this.type=\"directional\",this.direction=new Ve(s).normalize().toArray(),this.shadow=n}getProjectedLight(t){return this}};var Cb=class{constructor(t,r={id:\"pass\"}){G(this,\"id\",void 0),G(this,\"gl\",void 0),G(this,\"props\",void 0);let{id:i}=r;this.id=i,this.gl=t,this.props={...r}}setProps(t){Object.assign(this.props,t)}render(t){}cleanup(){}};var sc=class extends Cb{constructor(...t){super(...t),G(this,\"_lastRenderIndex\",-1)}render(t){let r=this.gl;return Ml(r,{framebuffer:t.target}),this._drawLayers(t)}_drawLayers(t){let{target:r,moduleParameters:i,viewports:s,views:n,onViewportActive:o,clearStack:c=!0,clearCanvas:f=!0}=t;t.pass=t.pass||\"unknown\";let _=this.gl;f&&Jat(_,r),c&&(this._lastRenderIndex=-1);let w=[];for(let I of s){let R=n&&n[I.id];o?.(I);let N=this._getDrawLayerParams(I,t),j=I.subViewports||[I];for(let Q of j){let et=this._drawLayersInViewport(_,{target:r,moduleParameters:i,viewport:Q,view:R,pass:t.pass,layers:t.layers},N);w.push(et)}}return w}_getDrawLayerParams(t,{layers:r,pass:i,isPicking:s=!1,layerFilter:n,cullRect:o,effects:c,moduleParameters:f},_=!1){let w=[],I=q7(this._lastRenderIndex+1),R={layer:r[0],viewport:t,isPicking:s,renderPass:i,cullRect:o},N={};for(let j=0;jHf(t,I))}let w={totalCount:r.length,visibleCount:0,compositeCount:0,pickableCount:0};Ml(t,{viewport:_});for(let I=0;I{let o=s.props._offset,c=s.id,f=s.parent&&s.parent.id,_;if(f&&!(f in t)&&i(s.parent,!1),f in r){let w=r[f]=r[f]||q7(t[f],t);_=w(s,n),r[c]=w}else Number.isFinite(o)?(_=o+(t[f]||0),r[c]=null):_=e;return n&&_>=e&&(e=_+1),t[c]=_,_};return i}function Kat(e,{moduleParameters:t,target:r,viewport:i}){let s=r&&r.id!==\"default-framebuffer\",n=t&&t.devicePixelRatio||El(e),o=s?r.height:e.drawingBufferHeight,c=i;return[c.x*n,o-(c.y+c.height)*n,c.width*n,c.height*n]}function Jat(e,t){let r=t?t.width:e.drawingBufferWidth,i=t?t.height:e.drawingBufferHeight;Ml(e,{viewport:[0,0,r,i]}),e.clear(16640)}var Lb=class extends sc{constructor(t,r){super(t,r),G(this,\"shadowMap\",void 0),G(this,\"depthBuffer\",void 0),G(this,\"fbo\",void 0),this.shadowMap=new pi(t,{width:1,height:1,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.depthBuffer=new el(t,{format:33189,width:1,height:1}),this.fbo=new yi(t,{id:\"shadowmap\",width:1,height:1,attachments:{36064:this.shadowMap,36096:this.depthBuffer}})}render(t){let r=this.fbo;Mn(this.gl,{depthRange:[0,1],depthTest:!0,blend:!1,clearColor:[1,1,1,1]},()=>{let i=t.viewports[0],s=El(this.gl),n=i.width*s,o=i.height*s;(n!==r.width||o!==r.height)&&r.resize({width:n,height:o}),super.render({...t,target:r,pass:\"shadow\"})})}shouldDrawLayer(t){return t.props.shadowEnabled!==!1}getModuleParameters(){return{drawToShadowMap:!0}}delete(){this.fbo&&(this.fbo.delete(),this.fbo=null),this.shadowMap&&(this.shadowMap.delete(),this.shadowMap=null),this.depthBuffer&&(this.depthBuffer.delete(),this.depthBuffer=null)}};var Z7=\"#define SMOOTH_EDGE_RADIUS 0.5\",tlt=`\n`.concat(Z7,`\n\nstruct VertexGeometry {\n vec4 position;\n vec3 worldPosition;\n vec3 worldPositionAlt;\n vec3 normal;\n vec2 uv;\n vec3 pickingColor;\n} geometry = VertexGeometry(\n vec4(0.0, 0.0, 1.0, 0.0),\n vec3(0.0),\n vec3(0.0),\n vec3(0.0),\n vec2(0.0),\n vec3(0.0)\n);\n`),elt=`\n`.concat(Z7,`\n\nstruct FragmentGeometry {\n vec2 uv;\n} geometry;\n\nfloat smoothedge(float edge, float x) {\n return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);\n}\n`),Y7={name:\"geometry\",vs:tlt,fs:elt};var rlt=Object.keys(Yr).map(e=>\"const int COORDINATE_SYSTEM_\".concat(e,\" = \").concat(Yr[e],\";\")).join(\"\"),ilt=Object.keys(Ja).map(e=>\"const int PROJECTION_MODE_\".concat(e,\" = \").concat(Ja[e],\";\")).join(\"\"),nlt=Object.keys(po).map(e=>\"const int UNIT_\".concat(e.toUpperCase(),\" = \").concat(po[e],\";\")).join(\"\"),Q7=\"\".concat(rlt,`\n`).concat(ilt,`\n`).concat(nlt,`\n\nuniform int project_uCoordinateSystem;\nuniform int project_uProjectionMode;\nuniform float project_uScale;\nuniform bool project_uWrapLongitude;\nuniform vec3 project_uCommonUnitsPerMeter;\nuniform vec3 project_uCommonUnitsPerWorldUnit;\nuniform vec3 project_uCommonUnitsPerWorldUnit2;\nuniform vec4 project_uCenter;\nuniform mat4 project_uModelMatrix;\nuniform mat4 project_uViewProjectionMatrix;\nuniform vec2 project_uViewportSize;\nuniform float project_uDevicePixelRatio;\nuniform float project_uFocalDistance;\nuniform vec3 project_uCameraPosition;\nuniform vec3 project_uCoordinateOrigin;\nuniform vec3 project_uCommonOrigin;\nuniform bool project_uPseudoMeters;\n\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / (PI * 2.0);\nconst vec3 ZERO_64_LOW = vec3(0.0);\nconst float EARTH_RADIUS = 6370972.0;\nconst float GLOBE_RADIUS = 256.0;\nfloat project_size_at_latitude(float lat) {\n float y = clamp(lat, -89.9, 89.9);\n return 1.0 / cos(radians(y));\n}\n\nfloat project_size() {\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR &&\n project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT &&\n project_uPseudoMeters == false) {\n \n if (geometry.position.w == 0.0) {\n return project_size_at_latitude(geometry.worldPosition.y);\n }\n \n float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0;\n float y2 = y * y;\n float y4 = y2 * y2;\n float y6 = y4 * y2;\n return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;\n }\n return 1.0;\n}\n\nfloat project_size_at_latitude(float meters, float lat) {\n return meters * project_uCommonUnitsPerMeter.z * project_size_at_latitude(lat);\n}\nfloat project_size(float meters) {\n return meters * project_uCommonUnitsPerMeter.z * project_size();\n}\n\nvec2 project_size(vec2 meters) {\n return meters * project_uCommonUnitsPerMeter.xy * project_size();\n}\n\nvec3 project_size(vec3 meters) {\n return meters * project_uCommonUnitsPerMeter * project_size();\n}\n\nvec4 project_size(vec4 meters) {\n return vec4(meters.xyz * project_uCommonUnitsPerMeter, meters.w);\n}\nmat3 project_get_orientation_matrix(vec3 up) {\n vec3 uz = normalize(up);\n vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0));\n vec3 uy = cross(uz, ux);\n return mat3(ux, uy, uz);\n}\n\nbool project_needs_rotation(vec3 commonPosition, out mat3 transform) {\n if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {\n transform = project_get_orientation_matrix(commonPosition);\n return true;\n }\n return false;\n}\nvec3 project_normal(vec3 vector) {\n vec4 normal_modelspace = project_uModelMatrix * vec4(vector, 0.0);\n vec3 n = normalize(normal_modelspace.xyz * project_uCommonUnitsPerMeter);\n mat3 rotation;\n if (project_needs_rotation(geometry.position.xyz, rotation)) {\n n = rotation * n;\n }\n return n;\n}\n\nvec4 project_offset_(vec4 offset) {\n float dy = offset.y;\n vec3 commonUnitsPerWorldUnit = project_uCommonUnitsPerWorldUnit + project_uCommonUnitsPerWorldUnit2 * dy;\n return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w);\n}\nvec2 project_mercator_(vec2 lnglat) {\n float x = lnglat.x;\n if (project_uWrapLongitude) {\n x = mod(x + 180., 360.0) - 180.;\n }\n float y = clamp(lnglat.y, -89.9, 89.9);\n return vec2(\n radians(x) + PI,\n PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5))\n ) * WORLD_SCALE;\n}\n\nvec3 project_globe_(vec3 lnglatz) {\n float lambda = radians(lnglatz.x);\n float phi = radians(lnglatz.y);\n float cosPhi = cos(phi);\n float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;\n\n return vec3(\n sin(lambda) * cosPhi,\n -cos(lambda) * cosPhi,\n sin(phi)\n ) * D;\n}\nvec4 project_position(vec4 position, vec3 position64Low) {\n vec4 position_world = project_uModelMatrix * position;\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n return vec4(\n project_mercator_(position_world.xy),\n project_size_at_latitude(position_world.z, position_world.y),\n position_world.w\n );\n }\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {\n position_world.xyz += project_uCoordinateOrigin;\n }\n }\n if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n return vec4(\n project_globe_(position_world.xyz),\n position_world.w\n );\n }\n }\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n if (abs(position_world.y - project_uCoordinateOrigin.y) > 0.25) {\n return vec4(\n project_mercator_(position_world.xy) - project_uCommonOrigin.xy,\n project_size(position_world.z),\n position_world.w\n );\n }\n }\n }\n if (project_uProjectionMode == PROJECTION_MODE_IDENTITY ||\n (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&\n (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {\n position_world.xyz -= project_uCoordinateOrigin;\n }\n return project_offset_(position_world) + project_offset_(project_uModelMatrix * vec4(position64Low, 0.0));\n}\n\nvec4 project_position(vec4 position) {\n return project_position(position, ZERO_64_LOW);\n}\n\nvec3 project_position(vec3 position, vec3 position64Low) {\n vec4 projected_position = project_position(vec4(position, 1.0), position64Low);\n return projected_position.xyz;\n}\n\nvec3 project_position(vec3 position) {\n vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW);\n return projected_position.xyz;\n}\n\nvec2 project_position(vec2 position) {\n vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW);\n return projected_position.xy;\n}\n\nvec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {\n return viewProjectionMatrix * position + center;\n}\nvec4 project_common_position_to_clipspace(vec4 position) {\n return project_common_position_to_clipspace(position, project_uViewProjectionMatrix, project_uCenter);\n}\nvec2 project_pixel_size_to_clipspace(vec2 pixels) {\n vec2 offset = pixels / project_uViewportSize * project_uDevicePixelRatio * 2.0;\n return offset * project_uFocalDistance;\n}\n\nfloat project_size_to_pixel(float meters) {\n return project_size(meters) * project_uScale;\n}\nfloat project_size_to_pixel(float size, int unit) {\n if (unit == UNIT_METERS) return project_size_to_pixel(size);\n if (unit == UNIT_COMMON) return size * project_uScale;\n return size;\n}\nfloat project_pixel_size(float pixels) {\n return pixels / project_uScale;\n}\nvec2 project_pixel_size(vec2 pixels) {\n return pixels / project_uScale;\n}\n`);function slt(e,t){if(e===t)return!0;if(Array.isArray(e)){let r=e.length;if(!t||t.length!==r)return!1;for(let i=0;i{for(let s in i)if(!slt(i[s],t[s])){r=e(i),t=i;break}return r}}var $7=[0,0,0,0],olt=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],X7=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],alt=[0,0,0],K7=[0,0,0],llt=Yf(ult);function hD(e,t,r=K7){r.length<3&&(r=[r[0],r[1],0]);let i=r,s,n=!0;switch(t===Yr.LNGLAT_OFFSETS||t===Yr.METER_OFFSETS?s=r:s=e.isGeospatial?[Math.fround(e.longitude),Math.fround(e.latitude),0]:null,e.projectionMode){case Ja.WEB_MERCATOR:(t===Yr.LNGLAT||t===Yr.CARTESIAN)&&(s=[0,0,0],n=!1);break;case Ja.WEB_MERCATOR_AUTO_OFFSET:t===Yr.LNGLAT?i=s:t===Yr.CARTESIAN&&(i=[Math.fround(e.center[0]),Math.fround(e.center[1]),0],s=e.unprojectPosition(i),i[0]-=r[0],i[1]-=r[1],i[2]-=r[2]);break;case Ja.IDENTITY:i=e.position.map(Math.fround),i[2]=i[2]||0;break;case Ja.GLOBE:n=!1,s=null;break;default:n=!1}return{geospatialOrigin:s,shaderCoordinateOrigin:i,offsetMode:n}}function clt(e,t,r){let{viewMatrixUncentered:i,projectionMatrix:s}=e,{viewMatrix:n,viewProjectionMatrix:o}=e,c=$7,f=$7,_=e.cameraPosition,{geospatialOrigin:w,shaderCoordinateOrigin:I,offsetMode:R}=hD(e,t,r);return R&&(f=e.projectPosition(w||I),_=[_[0]-f[0],_[1]-f[1],_[2]-f[2]],f[3]=1,c=Nh([],f,o),n=i||n,o=qf([],s,n),o=qf([],o,olt)),{viewMatrix:n,viewProjectionMatrix:o,projectionCenter:c,originCommon:f,cameraPosCommon:_,shaderCoordinateOrigin:I,geospatialOrigin:w}}function J7({viewport:e,devicePixelRatio:t=1,modelMatrix:r=null,coordinateSystem:i=Yr.DEFAULT,coordinateOrigin:s=K7,autoWrapLongitude:n=!1}){i===Yr.DEFAULT&&(i=e.isGeospatial?Yr.LNGLAT:Yr.CARTESIAN);let o=llt({viewport:e,devicePixelRatio:t,coordinateSystem:i,coordinateOrigin:s});return o.project_uWrapLongitude=n,o.project_uModelMatrix=r||X7,o}function ult({viewport:e,devicePixelRatio:t,coordinateSystem:r,coordinateOrigin:i}){let{projectionCenter:s,viewProjectionMatrix:n,originCommon:o,cameraPosCommon:c,shaderCoordinateOrigin:f,geospatialOrigin:_}=clt(e,r,i),w=e.getDistanceScales(),I=[e.width*t,e.height*t],R=Nh([],[0,0,-e.focalDistance,1],e.projectionMatrix)[3]||1,N={project_uCoordinateSystem:r,project_uProjectionMode:e.projectionMode,project_uCoordinateOrigin:f,project_uCommonOrigin:o.slice(0,3),project_uCenter:s,project_uPseudoMeters:!!e._pseudoMeters,project_uViewportSize:I,project_uDevicePixelRatio:t,project_uFocalDistance:R,project_uCommonUnitsPerMeter:w.unitsPerMeter,project_uCommonUnitsPerWorldUnit:w.unitsPerMeter,project_uCommonUnitsPerWorldUnit2:alt,project_uScale:e.scale,project_uWrapLongitude:!1,project_uViewProjectionMatrix:n,project_uModelMatrix:X7,project_uCameraPosition:c};if(_){let j=e.getDistanceScales(_);switch(r){case Yr.METER_OFFSETS:N.project_uCommonUnitsPerWorldUnit=j.unitsPerMeter,N.project_uCommonUnitsPerWorldUnit2=j.unitsPerMeter2;break;case Yr.LNGLAT:case Yr.LNGLAT_OFFSETS:e._pseudoMeters||(N.project_uCommonUnitsPerMeter=j.unitsPerMeter),N.project_uCommonUnitsPerWorldUnit=j.unitsPerDegree,N.project_uCommonUnitsPerWorldUnit2=j.unitsPerDegree2;break;case Yr.CARTESIAN:N.project_uCommonUnitsPerWorldUnit=[1,1,j.unitsPerMeter[2]],N.project_uCommonUnitsPerWorldUnit2=[0,0,j.unitsPerMeter2[2]];break;default:break}}return N}var hlt={};function flt(e=hlt){return\"viewport\"in e?J7(e):{}}var Vh={name:\"project\",dependencies:[CE,Y7],vs:Q7,getUniforms:flt};function fD(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function JA(e,t){let r=Nh([],t,e);return Fy(r,r,1/r[3]),r}function dD(e,t){let r=e%t;return r<0?t+r:r}function tG(e,t,r){return r*t+(1-r)*e}function kb(e,t,r){return er?r:e}function dlt(e){return Math.log(e)*Math.LOG2E}var Vy=Math.log2||dlt;function Bu(e,t){if(!e)throw new Error(t||\"@math.gl/web-mercator: assertion failed.\")}var jh=Math.PI,eG=jh/4,Fu=jh/180,pD=180/jh,jy=512,KE=4003e4,Gy=85.051129,rG=1.5;function Rb(e){return Math.pow(2,e)}function JE(e){return Vy(e)}function va(e){let[t,r]=e;Bu(Number.isFinite(t)),Bu(Number.isFinite(r)&&r>=-90&&r<=90,\"invalid latitude\");let i=t*Fu,s=r*Fu,n=jy*(i+jh)/(2*jh),o=jy*(jh+Math.log(Math.tan(eG+s*.5)))/(2*jh);return[n,o]}function oc(e){let[t,r]=e,i=t/jy*(2*jh)-jh,s=2*(Math.atan(Math.exp(r/jy*(2*jh)-jh))-eG);return[i*pD,s*pD]}function AD(e){let{latitude:t}=e;Bu(Number.isFinite(t));let r=Math.cos(t*Fu);return JE(KE*r)-9}function Db(e){let t=Math.cos(e*Fu);return jy/KE/t}function Wy(e){let{latitude:t,longitude:r,highPrecision:i=!1}=e;Bu(Number.isFinite(t)&&Number.isFinite(r));let s=jy,n=Math.cos(t*Fu),o=s/360,c=o/n,f=s/KE/n,_={unitsPerMeter:[f,f,f],metersPerUnit:[1/f,1/f,1/f],unitsPerDegree:[o,c,f],degreesPerUnit:[1/o,1/c,1/f]};if(i){let w=Fu*Math.tan(t*Fu)/n,I=o*w/2,R=s/KE*w,N=R/c*f;_.unitsPerDegree2=[0,I,R],_.unitsPerMeter2=[N,0,N]}return _}function Ob(e,t){let[r,i,s]=e,[n,o,c]=t,{unitsPerMeter:f,unitsPerMeter2:_}=Wy({longitude:r,latitude:i,highPrecision:!0}),w=va(e);w[0]+=n*(f[0]+_[0]*o),w[1]+=o*(f[1]+_[1]*o);let I=oc(w),R=(s||0)+(c||0);return Number.isFinite(s)||Number.isFinite(c)?[I[0],I[1],R]:I}function tP(e){let{height:t,pitch:r,bearing:i,altitude:s,scale:n,center:o}=e,c=fD();ag(c,c,[0,0,-s]),WE(c,c,-r*Fu),HE(c,c,i*Fu);let f=n/t;return By(c,c,[f,f,f]),o&&ag(c,c,Gj([],o)),c}function mD(e){let{width:t,height:r,altitude:i,pitch:s=0,offset:n,center:o,scale:c,nearZMultiplier:f=1,farZMultiplier:_=1}=e,{fovy:w=cg(rG)}=e;i!==void 0&&(w=cg(i));let I=w*Fu,R=s*Fu,N=Bb(w),j=N;o&&(j+=o[2]*c/Math.cos(R)/r);let Q=I*(.5+(n?n[1]:0)/r),et=Math.sin(Q)*j/Math.sin(kb(Math.PI/2-R-Q,.01,Math.PI-.01)),Y=Math.sin(R)*et+j,K=j*10,J=Math.min(Y*_,K);return{fov:I,aspect:t/r,focalDistance:N,near:f,far:J}}function cg(e){return 2*Math.atan(.5/e)*pD}function Bb(e){return .5/Math.tan(.5*e*Fu)}function Hy(e,t){let[r,i,s=0]=e;return Bu(Number.isFinite(r)&&Number.isFinite(i)&&Number.isFinite(s)),JA(t,[r,i,s,1])}function Qf(e,t,r=0){let[i,s,n]=e;if(Bu(Number.isFinite(i)&&Number.isFinite(s),\"invalid pixel coordinate\"),Number.isFinite(n))return JA(t,[i,s,n,1]);let o=JA(t,[i,s,0,1]),c=JA(t,[i,s,1,1]),f=o[2],_=c[2],w=f===_?0:((r||0)-f)/(_-f);return kE([],o,c,w)}function Fb(e){let{width:t,height:r,bounds:i,minExtent:s=0,maxZoom:n=24,offset:o=[0,0]}=e,[[c,f],[_,w]]=i,I=plt(e.padding),R=va([c,kb(w,-Gy,Gy)]),N=va([_,kb(f,-Gy,Gy)]),j=[Math.max(Math.abs(N[0]-R[0]),s),Math.max(Math.abs(N[1]-R[1]),s)],Q=[t-I.left-I.right-Math.abs(o[0])*2,r-I.top-I.bottom-Math.abs(o[1])*2];Bu(Q[0]>0&&Q[1]>0);let et=Q[0]/j[0],Y=Q[1]/j[1],K=(I.right-I.left)/2/et,J=(I.top-I.bottom)/2/Y,ut=[(N[0]+R[0])/2+K,(N[1]+R[1])/2+J],Et=oc(ut),kt=Math.min(n,Vy(Math.abs(Math.min(et,Y))));return Bu(Number.isFinite(kt)),{longitude:Et[0],latitude:Et[1],zoom:kt}}function plt(e=0){return typeof e==\"number\"?{top:e,bottom:e,left:e,right:e}:(Bu(Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&Number.isFinite(e.left)&&Number.isFinite(e.right)),e)}var iG=Math.PI/180;function zb(e,t=0){let{width:r,height:i,unproject:s}=e,n={targetZ:t},o=s([0,i],n),c=s([r,i],n),f,_,w=e.fovy?.5*e.fovy*iG:Math.atan(.5/e.altitude),I=(90-e.pitch)*iG;return w>I-.01?(f=nG(e,0,t),_=nG(e,r,t)):(f=s([0,0],n),_=s([r,0],n)),[o,c,_,f]}function nG(e,t,r){let{pixelUnprojectionMatrix:i}=e,s=JA(i,[t,0,1,1]),n=JA(i,[t,e.height,1,1]),c=(r*e.distanceScales.unitsPerMeter[2]-s[2])/(n[2]-s[2]),f=kE([],s,n,c),_=oc(f);return _.push(r),_}var sG=512;function eP(e){let{width:t,height:r,pitch:i=0}=e,{longitude:s,latitude:n,zoom:o,bearing:c=0}=e;(s<-180||s>180)&&(s=dD(s+180,360)-180),(c<-180||c>180)&&(c=dD(c+180,360)-180);let f=Vy(r/sG);if(o<=f)o=f,n=0;else{let _=r/2/Math.pow(2,o),w=oc([0,_])[1];if(nI&&(n=I)}}return{width:t,height:r,longitude:s,latitude:n,zoom:o,pitch:i,bearing:c}}var oG=.01,mlt=[\"longitude\",\"latitude\",\"zoom\"],aG={curve:1.414,speed:1.2};function rP(e,t,r,i){let{startZoom:s,startCenterXY:n,uDelta:o,w0:c,u1:f,S:_,rho:w,rho2:I,r0:R}=lG(e,t,i);if(fo?0:w}function lG(e,t,r){r=Object.assign({},aG,r);let i=r.curve,s=e.zoom,n=[e.longitude,e.latitude],o=Rb(s),c=t.zoom,f=[t.longitude,t.latitude],_=Rb(c-s),w=va(n),I=va(f),R=Nj([],I,w),N=Math.max(e.width,e.height),j=N/_,Q=Bj(R)*o,et=Math.max(Q,oG),Y=i*i,K=(j*j-N*N+Y*Y*et*et)/(2*N*Y*et),J=(j*j-N*N-Y*Y*et*et)/(2*j*Y*et),ut=Math.log(Math.sqrt(K*K+1)-K),Et=Math.log(Math.sqrt(J*J+1)-J),kt=(Et-ut)/i;return{startZoom:s,startCenterXY:w,uDelta:R,w0:N,u1:Q,S:kt,rho:i,rho2:Y,r0:ut,r1:Et}}var _lt=`\nconst int max_lights = 2;\nuniform mat4 shadow_uViewProjectionMatrices[max_lights];\nuniform vec4 shadow_uProjectCenters[max_lights];\nuniform bool shadow_uDrawShadowMap;\nuniform bool shadow_uUseShadowMap;\nuniform int shadow_uLightId;\nuniform float shadow_uLightCount;\n\nvarying vec3 shadow_vPosition[max_lights];\n\nvec4 shadow_setVertexPosition(vec4 position_commonspace) {\n if (shadow_uDrawShadowMap) {\n return project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[shadow_uLightId], shadow_uProjectCenters[shadow_uLightId]);\n }\n if (shadow_uUseShadowMap) {\n for (int i = 0; i < max_lights; i++) {\n if(i < int(shadow_uLightCount)) {\n vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[i], shadow_uProjectCenters[i]);\n shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0;\n }\n }\n }\n return gl_Position;\n}\n`,ylt=`\nconst int max_lights = 2;\nuniform bool shadow_uDrawShadowMap;\nuniform bool shadow_uUseShadowMap;\nuniform sampler2D shadow_uShadowMap0;\nuniform sampler2D shadow_uShadowMap1;\nuniform vec4 shadow_uColor;\nuniform float shadow_uLightCount;\n\nvarying vec3 shadow_vPosition[max_lights];\n\nconst vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0);\nconst vec4 bitUnpackShift = 1.0 / bitPackShift;\nconst vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n\nfloat shadow_getShadowWeight(vec3 position, sampler2D shadowMap) {\n vec4 rgbaDepth = texture2D(shadowMap, position.xy);\n\n float z = dot(rgbaDepth, bitUnpackShift);\n return smoothstep(0.001, 0.01, position.z - z);\n}\n\nvec4 shadow_filterShadowColor(vec4 color) {\n if (shadow_uDrawShadowMap) {\n vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift);\n rgbaDepth -= rgbaDepth.gbaa * bitMask;\n return rgbaDepth;\n }\n if (shadow_uUseShadowMap) {\n float shadowAlpha = 0.0;\n shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0);\n if(shadow_uLightCount > 1.0) {\n shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1);\n }\n shadowAlpha *= shadow_uColor.a / shadow_uLightCount;\n float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha);\n\n return vec4(\n mix(color.rgb, shadow_uColor.rgb, shadowAlpha / blendedAlpha),\n blendedAlpha\n );\n }\n return color;\n}\n`,vlt=Yf(Tlt),xlt=Yf(Mlt),blt=[0,0,0,1],wlt=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];function Slt(e,t){let[r,i,s]=e,n=Qf([r,i,s],t);return Number.isFinite(s)?n:[n[0],n[1],0]}function Tlt({viewport:e,center:t}){return new En(e.viewProjectionMatrix).invert().transform(t)}function Mlt({viewport:e,shadowMatrices:t}){let r=[],i=e.pixelUnprojectionMatrix,s=e.isGeospatial?void 0:1,n=[[0,0,s],[e.width,0,s],[0,e.height,s],[e.width,e.height,s],[0,0,-1],[e.width,0,-1],[0,e.height,-1],[e.width,e.height,-1]].map(o=>Slt(o,i));for(let o of t){let c=o.clone().translate(new Ve(e.center).negate()),f=n.map(w=>c.transform(w)),_=new En().ortho({left:Math.min(...f.map(w=>w[0])),right:Math.max(...f.map(w=>w[0])),bottom:Math.min(...f.map(w=>w[1])),top:Math.max(...f.map(w=>w[1])),near:Math.min(...f.map(w=>-w[2])),far:Math.max(...f.map(w=>-w[2]))});r.push(_.multiplyRight(o))}return r}function Elt(e,t){let{shadowEnabled:r=!0}=e;if(!r||!e.shadowMatrices||!e.shadowMatrices.length)return{shadow_uDrawShadowMap:!1,shadow_uUseShadowMap:!1};let i={shadow_uDrawShadowMap:!!e.drawToShadowMap,shadow_uUseShadowMap:e.shadowMaps?e.shadowMaps.length>0:!1,shadow_uColor:e.shadowColor||blt,shadow_uLightId:e.shadowLightId||0,shadow_uLightCount:e.shadowMatrices.length},s=vlt({viewport:e.viewport,center:t.project_uCenter}),n=[],o=xlt({shadowMatrices:e.shadowMatrices,viewport:e.viewport}).slice();for(let c=0;c0?i[\"shadow_uShadowMap\".concat(c)]=e.shadowMaps[c]:i[\"shadow_uShadowMap\".concat(c)]=e.dummyShadowMap;return i}var Nb={name:\"shadow\",dependencies:[Vh],vs:_lt,fs:ylt,inject:{\"vs:DECKGL_FILTER_GL_POSITION\":`\n position = shadow_setVertexPosition(geometry.position);\n `,\"fs:DECKGL_FILTER_COLOR\":`\n color = shadow_filterShadowColor(color);\n `},getUniforms:(e={},t={})=>\"viewport\"in e&&(e.drawToShadowMap||e.shadowMaps&&e.shadowMaps.length>0)?Elt(e,t):{}};var Plt={color:[255,255,255],intensity:1},cG=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],Ilt=[0,0,0,200/255],qy=class{constructor(t={}){G(this,\"id\",\"lighting-effect\"),G(this,\"props\",void 0),G(this,\"shadowColor\",Ilt),G(this,\"shadow\",void 0),G(this,\"ambientLight\",void 0),G(this,\"directionalLights\",void 0),G(this,\"pointLights\",void 0),G(this,\"shadowPasses\",[]),G(this,\"shadowMaps\",[]),G(this,\"dummyShadowMap\",null),G(this,\"programManager\",void 0),G(this,\"shadowMatrices\",void 0),this.setProps(t)}setProps(t){this.ambientLight=null,this.directionalLights=[],this.pointLights=[];for(let r in t){let i=t[r];switch(i.type){case\"ambient\":this.ambientLight=i;break;case\"directional\":this.directionalLights.push(i);break;case\"point\":this.pointLights.push(i);break;default:}}this._applyDefaultLights(),this.shadow=this.directionalLights.some(r=>r.shadow),this.props=t}preRender(t,{layers:r,layerFilter:i,viewports:s,onViewportActive:n,views:o}){if(this.shadow){this.shadowMatrices=this._calculateMatrices(),this.shadowPasses.length===0&&this._createShadowPasses(t),this.programManager||(this.programManager=Uh.getDefaultProgramManager(t),Nb&&this.programManager.addDefaultModule(Nb)),this.dummyShadowMap||(this.dummyShadowMap=new pi(t,{width:1,height:1}));for(let c=0;ci.getProjectedLight({layer:t})),pointLights:this.pointLights.map(i=>i.getProjectedLight({layer:t}))},r}cleanup(){for(let t of this.shadowPasses)t.delete();this.shadowPasses.length=0,this.shadowMaps.length=0,this.dummyShadowMap&&(this.dummyShadowMap.delete(),this.dummyShadowMap=null),this.shadow&&this.programManager&&(this.programManager.removeDefaultModule(Nb),this.programManager=null)}_calculateMatrices(){let t=[];for(let r of this.directionalLights){let i=new En().lookAt({eye:new Ve(r.direction).negate()});t.push(i)}return t}_createShadowPasses(t){for(let r=0;rs&&(n=s);let o=this._pool,c=t.BYTES_PER_ELEMENT*n,f=o.findIndex(_=>_.byteLength>=c);if(f>=0){let _=new t(o.splice(f,1)[0],0,n);return i&&_.fill(0),_}return new t(n)}_release(t){if(!ArrayBuffer.isView(t))return;let r=this._pool,{buffer:i}=t,{byteLength:s}=i,n=r.findIndex(o=>o.byteLength>=s);n<0?r.push(i):(n>0||r.lengththis.opts.poolSize&&r.shift()}},Gh=new _D;function Yy(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function hG(e){return[e[12],e[13],e[14]]}function fG(e){return{left:Zy(e[3]+e[0],e[7]+e[4],e[11]+e[8],e[15]+e[12]),right:Zy(e[3]-e[0],e[7]-e[4],e[11]-e[8],e[15]-e[12]),bottom:Zy(e[3]+e[1],e[7]+e[5],e[11]+e[9],e[15]+e[13]),top:Zy(e[3]-e[1],e[7]-e[5],e[11]-e[9],e[15]-e[13]),near:Zy(e[3]+e[2],e[7]+e[6],e[11]+e[10],e[15]+e[14]),far:Zy(e[3]-e[2],e[7]-e[6],e[11]-e[10],e[15]-e[14])}}var uG=new Ve;function Zy(e,t,r,i){uG.set(e,t,r);let s=uG.len();return{distance:i/s,normal:new Ve(-e/s,-t/s,-r/s)}}function Clt(e){return e-Math.fround(e)}var Ub;function iP(e,t){let{size:r=1,startIndex:i=0}=t,s=t.endIndex!==void 0?t.endIndex:e.length,n=(s-i)/r;Ub=Gh.allocate(Ub,n,{type:Float32Array,size:r*2});let o=i,c=0;for(;osuper.render({target:o,layers:t,layerFilter:r,views:i,viewports:s,onViewportActive:n,cullRect:I,effects:R?.filter(ut=>ut.useInPicking),pass:N,isPicking:!0,moduleParameters:Q}));return this._colorEncoderState=null,{decodePickingColor:Y&&Flt.bind(null,Y),stats:K}}shouldDrawLayer(t){let{pickable:r,operation:i}=t.props;return r&&i.includes(\"draw\")||i.includes(\"terrain\")||i.includes(\"mask\")}getModuleParameters(){return{pickingActive:1,pickingAttribute:this.pickZ,lightSources:{}}}getLayerParameters(t,r,i){let s={...t.props.parameters},{pickable:n,operation:o}=t.props;return this._colorEncoderState?n&&o.includes(\"draw\")&&(Object.assign(s,gG),s.blend=!0,s.blendColor=Blt(this._colorEncoderState,t,i)):s.blend=!1,o.includes(\"terrain\")&&(s.blend=!1),s}_resetColorEncoder(t){return this._colorEncoderState=t?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}};function Blt(e,t,r){let{byLayer:i,byAlpha:s}=e,n,o=i.get(t);return o?(o.viewports.push(r),n=o.a):(n=i.size+1,n<=255?(o={a:n,layer:t,viewports:[r]},i.set(t,o),s[n]=o):(or.warn(\"Too many pickable layers, only picking the first 255\")(),n=0)),[0,0,0,n/255]}function Flt(e,t){let r=e.byAlpha[t[3]];return r&&{pickedLayer:r.layer,pickedViewports:r.viewports,pickedObjectIndex:r.layer.decodePickingColor(t)}}var tm={NO_STATE:\"Awaiting state\",MATCHED:\"Matched. State transferred from previous layer\",INITIALIZED:\"Initialized\",AWAITING_GC:\"Discarded. Awaiting garbage collection\",AWAITING_FINALIZATION:\"No longer matched. Awaiting garbage collection\",FINALIZED:\"Finalized! Awaiting garbage collection\"},Qy=Symbol.for(\"component\"),zu=Symbol.for(\"propTypes\"),nP=Symbol.for(\"deprecatedProps\"),sp=Symbol.for(\"asyncPropDefaults\"),$f=Symbol.for(\"asyncPropOriginal\"),Wh=Symbol.for(\"asyncPropResolved\");function op(e,t=()=>!0){return Array.isArray(e)?_G(e,t,[]):t(e)?[e]:[]}function _G(e,t,r){let i=-1;for(;++i0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(t,r){if(t===this._data&&!r)return;this._data=t;let i=++this._loadCount,s=t;typeof t==\"string\"&&(s=jA(t)),s instanceof Promise?(this.isLoaded=!1,this._loader=s.then(n=>{this._loadCount===i&&(this.isLoaded=!0,this._error=void 0,this._content=n)}).catch(n=>{this._loadCount===i&&(this.isLoaded=!0,this._error=n||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=t);for(let n of this._subscribers)n.onChange(this.getData())}};var jb=class{constructor({gl:t,protocol:r}){G(this,\"protocol\",void 0),G(this,\"_context\",void 0),G(this,\"_resources\",void 0),G(this,\"_consumers\",void 0),G(this,\"_pruneRequest\",void 0),this.protocol=r||\"resource://\",this._context={gl:t,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(t){return t.startsWith(this.protocol)?!0:t in this._resources}add({resourceId:t,data:r,forceUpdate:i=!1,persistent:s=!0}){let n=this._resources[t];n?n.setData(r,i):(n=new Vb(t,r,this._context),this._resources[t]=n),n.persistent=s}remove(t){let r=this._resources[t];r&&(r.delete(),delete this._resources[t])}unsubscribe({consumerId:t}){let r=this._consumers[t];if(r){for(let i in r){let s=r[i],n=this._resources[s.resourceId];n&&n.unsubscribe(s)}delete this._consumers[t],this.prune()}}subscribe({resourceId:t,onChange:r,consumerId:i,requestId:s=\"default\"}){let{_resources:n,protocol:o}=this;t.startsWith(o)&&(t=t.replace(o,\"\"),n[t]||this.add({resourceId:t,data:null,persistent:!1}));let c=n[t];if(this._track(i,s,c,r),c)return c.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(let t in this._resources)this._resources[t].delete()}_track(t,r,i,s){let n=this._consumers,o=n[t]=n[t]||{},c=o[r]||{},f=c.resourceId&&this._resources[c.resourceId];f&&(f.unsubscribe(c),this.prune()),i&&(o[r]=c,c.onChange=s,c.resourceId=i.id,i.subscribe(c))}_prune(){this._pruneRequest=null;for(let t of Object.keys(this._resources)){let r=this._resources[t];!r.persistent&&!r.inUse()&&(r.delete(),delete this._resources[t])}}};var zlt=`\nvec4 project_position_to_clipspace(\n vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition\n) {\n vec3 projectedPosition = project_position(position, position64Low);\n mat3 rotation;\n if (project_needs_rotation(projectedPosition, rotation)) {\n // offset is specified as ENU\n // when in globe projection, rotate offset so that the ground alighs with the surface of the globe\n offset = rotation * offset;\n }\n commonPosition = vec4(projectedPosition + offset, 1.0);\n return project_common_position_to_clipspace(commonPosition);\n}\n\nvec4 project_position_to_clipspace(\n vec3 position, vec3 position64Low, vec3 offset\n) {\n vec4 commonPosition;\n return project_position_to_clipspace(position, position64Low, offset, commonPosition);\n}\n`,Rs={name:\"project32\",dependencies:[Vh],vs:zlt};var Ao={inject:{\"vs:DECKGL_FILTER_GL_POSITION\":`\n // for picking depth values\n picking_setPickingAttribute(position.z / position.w);\n `,\"vs:DECKGL_FILTER_COLOR\":`\n picking_setPickingColor(geometry.pickingColor);\n `,\"fs:#decl\":`\nuniform bool picking_uAttribute;\n `,\"fs:DECKGL_FILTER_COLOR\":{order:99,injection:`\n // use highlight color if this fragment belongs to the selected object.\n color = picking_filterHighlightColor(color);\n\n // use picking color if rendering to picking FBO.\n color = picking_filterPickingColor(color);\n `}},...QE};var Nlt=[Vh],Ult=[\"vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)\",\"vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)\",\"vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)\",\"fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)\"];function yG(e){let t=Uh.getDefaultProgramManager(e);for(let r of Nlt)t.addDefaultModule(r);for(let r of Ult)t.addShaderHook(r);return t}var Vlt=\"layerManager.setLayers\",jlt=\"layerManager.activateViewport\",Gb=class{constructor(t,{deck:r,stats:i,viewport:s,timeline:n}={}){G(this,\"layers\",void 0),G(this,\"context\",void 0),G(this,\"resourceManager\",void 0),G(this,\"_lastRenderedLayers\",[]),G(this,\"_needsRedraw\",!1),G(this,\"_needsUpdate\",!1),G(this,\"_nextLayers\",null),G(this,\"_debug\",!1),G(this,\"activateViewport\",o=>{Ls(jlt,this,o),o&&(this.context.viewport=o)}),this.layers=[],this.resourceManager=new jb({gl:t,protocol:\"deck://\"}),this.context={mousePosition:null,userData:{},layerManager:this,gl:t,deck:r,programManager:t&&yG(t),stats:i||new Gf({id:\"deck.gl\"}),viewport:s||new ac({id:\"DEFAULT-INITIAL-VIEWPORT\"}),timeline:n||new KA,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(let t of this.layers)this._finalizeLayer(t)}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);for(let i of this.layers){let s=i.getNeedsRedraw(t);r=r||s}return r}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?\"layers changed\":this._needsUpdate}setNeedsRedraw(t){this._needsRedraw=this._needsRedraw||t}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t}getLayers({layerIds:t}={}){return t?this.layers.filter(r=>t.find(i=>r.id.indexOf(i)===0)):this.layers}setProps(t){\"debug\"in t&&(this._debug=t.debug),\"userData\"in t&&(this.context.userData=t.userData),\"layers\"in t&&(this._nextLayers=t.layers),\"onError\"in t&&(this.context.onError=t.onError)}setLayers(t,r){Ls(Vlt,this,r,t),this._lastRenderedLayers=t;let i=op(t,Boolean);for(let s of i)s.context=this.context;this._updateLayers(this.layers,i)}updateLayers(){let t=this.needsUpdate();t&&(this.setNeedsRedraw(\"updating layers: \".concat(t)),this.setLayers(this._nextLayers||this._lastRenderedLayers,t)),this._nextLayers=null}_handleError(t,r,i){i.raiseError(r,\"\".concat(t,\" of \").concat(i))}_updateLayers(t,r){let i={};for(let o of t)i[o.id]?or.warn(\"Multiple old layers with same id \".concat(o.id))():i[o.id]=o;let s=[];this._updateSublayersRecursively(r,i,s),this._finalizeOldLayers(i);let n=!1;for(let o of s)if(o.hasUniformTransition()){n=\"Uniform transition in \".concat(o);break}this._needsUpdate=n,this.layers=s}_updateSublayersRecursively(t,r,i){for(let s of t){s.context=this.context;let n=r[s.id];n===null&&or.warn(\"Multiple new layers with same id \".concat(s.id))(),r[s.id]=null;let o=null;try{this._debug&&n!==s&&s.validateProps(),n?(this._transferLayerState(n,s),this._updateLayer(s)):this._initializeLayer(s),i.push(s),o=s.isComposite?s.getSubLayers():null}catch(c){this._handleError(\"matching\",c,s)}o&&this._updateSublayersRecursively(o,r,i)}}_finalizeOldLayers(t){for(let r in t){let i=t[r];i&&this._finalizeLayer(i)}}_initializeLayer(t){try{t._initialize(),t.lifecycle=tm.INITIALIZED}catch(r){this._handleError(\"initialization\",r,t)}}_transferLayerState(t,r){r._transferState(t),r.lifecycle=tm.MATCHED,r!==t&&(t.lifecycle=tm.AWAITING_GC)}_updateLayer(t){try{t._update()}catch(r){this._handleError(\"update\",r,t)}}_finalizeLayer(t){this._needsRedraw=this._needsRedraw||\"finalized \".concat(t),t.lifecycle=tm.AWAITING_FINALIZATION;try{t._finalize(),t.lifecycle=tm.FINALIZED}catch(r){this._handleError(\"finalization\",r,t)}}};function mo(e,t,r){if(e===t)return!0;if(!r||!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;ir.containsPixel(t)):this._viewports}getViews(){let t={};return this.views.forEach(r=>{t[r.id]=r}),t}getView(t){return this.views.find(r=>r.id===t)}getViewState(t){let r=typeof t==\"string\"?this.getView(t):t,i=r&&this.viewState[r.getViewStateId()]||this.viewState;return r?r.filterViewState(i):i}getViewport(t){return this._viewportMap[t]}unproject(t,r){let i=this.getViewports(),s={x:t[0],y:t[1]};for(let n=i.length-1;n>=0;--n){let o=i[n];if(o.containsPixel(s)){let c=t.slice();return c[0]-=o.x,c[1]-=o.y,o.unproject(c,r)}}return null}setProps(t){t.views&&this._setViews(t.views),t.viewState&&this._setViewState(t.viewState),(\"width\"in t||\"height\"in t)&&this._setSize(t.width,t.height),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(t,r){(t!==this.width||r!==this.height)&&(this.width=t,this.height=r,this.setNeedsUpdate(\"Size changed\"))}_setViews(t){t=op(t,Boolean),this._diffViews(t,this.views)&&this.setNeedsUpdate(\"views changed\"),this.views=t}_setViewState(t){t?(!mo(t,this.viewState,3)&&this.setNeedsUpdate(\"viewState changed\"),this.viewState=t):or.warn(\"missing `viewState` or `initialViewState`\")()}_onViewStateChange(t,r){this._eventCallbacks.onViewStateChange&&this._eventCallbacks.onViewStateChange({...r,viewId:t})}_createController(t,r){let i=r.type;return new i({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._onViewStateChange.bind(this,r.id),onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:n=>{var o;return(o=this.getView(t.id))===null||o===void 0?void 0:o.makeViewport({viewState:n,width:this.width,height:this.height})}})}_updateController(t,r,i,s){let n=t.controller;if(n&&i){let o={...r,...n,id:t.id,x:i.x,y:i.y,width:i.width,height:i.height};return(!s||s.constructor!==n.type)&&(s=this._createController(t,o)),s&&s.setProps(o),s}return null}_rebuildViewports(){let{views:t}=this,r=this.controllers;this._viewports=[],this.controllers={};let i=!1;for(let s=t.length;s--;){let n=t[s],o=this.getViewState(n),c=n.makeViewport({viewState:o,width:this.width,height:this.height}),f=r[n.id],_=!!n.controller;_&&!f&&(i=!0),(i||!_)&&f&&(f.finalize(),f=null),this.controllers[n.id]=this._updateController(n,o,c,f),c&&this._viewports.unshift(c)}for(let s in r){let n=r[s];n&&!this.controllers[s]&&n.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(t=>{t.id&&(this._viewportMap[t.id]=this._viewportMap[t.id]||t)})}_diffViews(t,r){return t.length!==r.length?!0:t.some((i,s)=>!t[s].equals(r[s]))}};var Glt=/([0-9]+\\.?[0-9]*)(%|px)/;function ap(e){switch(typeof e){case\"number\":return{position:e,relative:!1};case\"string\":let t=Glt.exec(e);if(t&&t.length>=3){let r=t[2]===\"%\",i=parseFloat(t[1]);return{position:r?i/100:i,relative:r}}default:throw new Error(\"Could not parse position string \".concat(e))}}function lp(e,t){return e.relative?Math.round(e.position*t):e.position}function _r(e,t){if(!e)throw new Error(t||\"deck.gl: assertion failed.\")}var Xc=class{constructor(t){G(this,\"id\",void 0),G(this,\"viewportInstance\",void 0),G(this,\"_x\",void 0),G(this,\"_y\",void 0),G(this,\"_width\",void 0),G(this,\"_height\",void 0),G(this,\"_padding\",void 0),G(this,\"props\",void 0);let{id:r,x:i=0,y:s=0,width:n=\"100%\",height:o=\"100%\",padding:c=null,viewportInstance:f}=t||{};_r(!f||f instanceof ac),this.viewportInstance=f,this.id=r||this.constructor.displayName||\"view\",this.props={...t,id:this.id},this._x=ap(i),this._y=ap(s),this._width=ap(n),this._height=ap(o),this._padding=c&&{left:ap(c.left||0),right:ap(c.right||0),top:ap(c.top||0),bottom:ap(c.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(t){return this===t?!0:this.viewportInstance?t.viewportInstance?this.viewportInstance.equals(t.viewportInstance):!1:this.ViewportType===t.ViewportType&&mo(this.props,t.props,2)}makeViewport({width:t,height:r,viewState:i}){if(this.viewportInstance)return this.viewportInstance;i=this.filterViewState(i);let s=this.getDimensions({width:t,height:r});return!s.height||!s.width?null:new this.ViewportType({...i,...this.props,...s})}getViewStateId(){let{viewState:t}=this.props;return typeof t==\"string\"?t:t?.id||this.id}filterViewState(t){if(this.props.viewState&&typeof this.props.viewState==\"object\"){if(!this.props.viewState.id)return this.props.viewState;let r={...t};for(let i in this.props.viewState)i!==\"id\"&&(r[i]=this.props.viewState[i]);return r}return t}getDimensions({width:t,height:r}){let i={x:lp(this._x,t),y:lp(this._y,r),width:lp(this._width,t),height:lp(this._height,r)};return this._padding&&(i.padding={left:lp(this._padding.left,t),top:lp(this._padding.top,r),right:lp(this._padding.right,t),bottom:lp(this._padding.bottom,r)}),i}get controller(){let t=this.props.controller;return t?t===!0?{type:this.ControllerType}:typeof t==\"function\"?{type:t}:{type:this.ControllerType,...t}:null}};var Kc=class{constructor(t){G(this,\"_inProgress\",void 0),G(this,\"_handle\",void 0),G(this,\"_timeline\",void 0),G(this,\"time\",void 0),G(this,\"settings\",void 0),this._inProgress=!1,this._handle=null,this._timeline=t,this.time=0,this.settings={duration:0}}get inProgress(){return this._inProgress}start(t){var r,i;this.cancel(),this.settings=t,this._inProgress=!0,(r=(i=this.settings).onStart)===null||r===void 0||r.call(i,this)}end(){if(this._inProgress){var t,r;this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,(t=(r=this.settings).onEnd)===null||t===void 0||t.call(r,this)}}cancel(){if(this._inProgress){var t,r;(t=(r=this.settings).onInterrupt)===null||t===void 0||t.call(r,this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1}}update(){var t,r;if(!this._inProgress)return!1;if(this._handle===null){let{_timeline:i,settings:s}=this;this._handle=i.addChannel({delay:i.getTime(),duration:s.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),(t=(r=this.settings).onUpdate)===null||t===void 0||t.call(r,this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}};var vG=()=>{},bD={BREAK:1,SNAP_TO_END:2,IGNORE:3},Wlt=e=>e,Hlt=bD.BREAK,Hb=class{constructor(t){G(this,\"getControllerState\",void 0),G(this,\"props\",void 0),G(this,\"propsInTransition\",void 0),G(this,\"transition\",void 0),G(this,\"onViewStateChange\",void 0),G(this,\"onStateChange\",void 0),G(this,\"_onTransitionUpdate\",r=>{let{time:i,settings:{interpolator:s,startProps:n,endProps:o,duration:c,easing:f}}=r,_=f(i/c),w=s.interpolateProps(n,o,_);this.propsInTransition=this.getControllerState({...this.props,...w}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})}),this.getControllerState=t.getControllerState,this.propsInTransition=null,this.transition=new Kc(t.timeline),this.onViewStateChange=t.onViewStateChange||vG,this.onStateChange=t.onStateChange||vG}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(t){let r=!1,i=this.props;if(this.props=t,!i||this._shouldIgnoreViewportChange(i,t))return!1;if(this._isTransitionEnabled(t)){let s=i;if(this.transition.inProgress){let{interruption:n,endProps:o}=this.transition.settings;s={...i,...n===bD.SNAP_TO_END?o:this.propsInTransition||i}}this._triggerTransition(s,t),r=!0}else this.transition.cancel();return r}updateTransition(){this.transition.update()}_isTransitionEnabled(t){let{transitionDuration:r,transitionInterpolator:i}=t;return(r>0||r===\"auto\")&&!!i}_isUpdateDueToCurrentTransition(t){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(t,this.propsInTransition):!1}_shouldIgnoreViewportChange(t,r){return this.transition.inProgress?this.transition.settings.interruption===bD.IGNORE||this._isUpdateDueToCurrentTransition(r):this._isTransitionEnabled(r)?r.transitionInterpolator.arePropsEqual(t,r):!0}_triggerTransition(t,r){let i=this.getControllerState(t),s=this.getControllerState(r).shortestPathFrom(i),n=r.transitionInterpolator,o=n.getDuration?n.getDuration(t,r):r.transitionDuration;if(o===0)return;let c=n.initializeProps(t,s);this.propsInTransition={};let f={duration:o,easing:r.transitionEasing||Wlt,interpolator:n,interruption:r.transitionInterruption||Hlt,startProps:c.start,endProps:c.end,onStart:r.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(r.onTransitionInterrupt),onEnd:this._onTransitionEnd(r.onTransitionEnd)};this.transition.start(f),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(t){return r=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),t?.(r)}}};var hg=class{constructor(t){G(this,\"_propsToCompare\",void 0),G(this,\"_propsToExtract\",void 0),G(this,\"_requiredProps\",void 0);let{compare:r,extract:i,required:s}=t;this._propsToCompare=r,this._propsToExtract=i||r,this._requiredProps=s}arePropsEqual(t,r){for(let i of this._propsToCompare)if(!(i in t)||!(i in r)||!Ro(t[i],r[i]))return!1;return!0}initializeProps(t,r){let i={},s={};for(let n of this._propsToExtract)(n in t||n in r)&&(i[n]=t[n],s[n]=r[n]);return this._checkRequiredProps(i),this._checkRequiredProps(s),{start:i,end:s}}getDuration(t,r){return r.transitionDuration}_checkRequiredProps(t){this._requiredProps&&this._requiredProps.forEach(r=>{let i=t[r];_r(Number.isFinite(i)||Array.isArray(i),\"\".concat(r,\" is required for transition\"))})}};var qlt=[\"longitude\",\"latitude\",\"zoom\",\"bearing\",\"pitch\"],Zlt=[\"longitude\",\"latitude\",\"zoom\"],fg=class extends hg{constructor(t={}){let r=Array.isArray(t)?t:t.transitionProps,i=Array.isArray(t)?{}:t;i.transitionProps=Array.isArray(r)?{compare:r,required:r}:r||{compare:qlt,required:Zlt},super(i.transitionProps),G(this,\"opts\",void 0),this.opts=i}initializeProps(t,r){let i=super.initializeProps(t,r),{makeViewport:s,around:n}=this.opts;if(s&&n){let o=s(t),c=s(r),f=o.unproject(n);i.start.around=n,Object.assign(i.end,{around:c.project(f),aroundPosition:f,width:r.width,height:r.height})}return i}interpolateProps(t,r,i){let s={};for(let n of this._propsToExtract)s[n]=il(t[n]||0,r[n]||0,i);if(r.aroundPosition&&this.opts.makeViewport){let n=this.opts.makeViewport({...r,...s});Object.assign(s,n.panByPosition(r.aroundPosition,il(t.around,r.around,i)))}return s}};var em={transitionDuration:0},Ylt=300,sP=e=>1-(1-e)*(1-e),$y={WHEEL:[\"wheel\"],PAN:[\"panstart\",\"panmove\",\"panend\"],PINCH:[\"pinchstart\",\"pinchmove\",\"pinchend\"],TRIPLE_PAN:[\"tripanstart\",\"tripanmove\",\"tripanend\"],DOUBLE_TAP:[\"doubletap\"],KEYBOARD:[\"keydown\"]},dg={},qb=class{constructor(t){G(this,\"props\",void 0),G(this,\"state\",{}),G(this,\"transitionManager\",void 0),G(this,\"eventManager\",void 0),G(this,\"onViewStateChange\",void 0),G(this,\"onStateChange\",void 0),G(this,\"makeViewport\",void 0),G(this,\"_controllerState\",void 0),G(this,\"_events\",{}),G(this,\"_interactionState\",{isDragging:!1}),G(this,\"_customEvents\",[]),G(this,\"_eventStartBlocked\",null),G(this,\"_panMove\",!1),G(this,\"invertPan\",!1),G(this,\"dragMode\",\"rotate\"),G(this,\"inertia\",0),G(this,\"scrollZoom\",!0),G(this,\"dragPan\",!0),G(this,\"dragRotate\",!0),G(this,\"doubleClickZoom\",!0),G(this,\"touchZoom\",!0),G(this,\"touchRotate\",!1),G(this,\"keyboard\",!0),this.transitionManager=new Hb({...t,getControllerState:r=>new this.ControllerState(r),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=t.eventManager,this.onViewStateChange=t.onViewStateChange||(()=>{}),this.onStateChange=t.onStateChange||(()=>{}),this.makeViewport=t.makeViewport}set events(t){this.toggleEvents(this._customEvents,!1),this.toggleEvents(t,!0),this._customEvents=t,this.props&&this.setProps(this.props)}finalize(){for(let r in this._events)if(this._events[r]){var t;(t=this.eventManager)===null||t===void 0||t.off(r,this.handleEvent)}this.transitionManager.finalize()}handleEvent(t){this._controllerState=void 0;let r=this._eventStartBlocked;switch(t.type){case\"panstart\":return r?!1:this._onPanStart(t);case\"panmove\":return this._onPan(t);case\"panend\":return this._onPanEnd(t);case\"pinchstart\":return r?!1:this._onPinchStart(t);case\"pinchmove\":return this._onPinch(t);case\"pinchend\":return this._onPinchEnd(t);case\"tripanstart\":return r?!1:this._onTriplePanStart(t);case\"tripanmove\":return this._onTriplePan(t);case\"tripanend\":return this._onTriplePanEnd(t);case\"doubletap\":return this._onDoubleTap(t);case\"wheel\":return this._onWheel(t);case\"keydown\":return this._onKeyDown(t);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(t){let{x:r,y:i}=this.props,{offsetCenter:s}=t;return[s.x-r,s.y-i]}isPointInBounds(t,r){let{width:i,height:s}=this.props;if(r&&r.handled)return!1;let n=t[0]>=0&&t[0]<=i&&t[1]>=0&&t[1]<=s;return n&&r&&r.stopPropagation(),n}isFunctionKeyPressed(t){let{srcEvent:r}=t;return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(t){let r=setTimeout(()=>{this._eventStartBlocked===r&&(this._eventStartBlocked=null)},t);this._eventStartBlocked=r}setProps(t){t.dragMode&&(this.dragMode=t.dragMode),this.props=t,\"transitionInterpolator\"in t||(t.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(t);let{inertia:r}=t;this.inertia=Number.isFinite(r)?r:r===!0?Ylt:0;let{scrollZoom:i=!0,dragPan:s=!0,dragRotate:n=!0,doubleClickZoom:o=!0,touchZoom:c=!0,touchRotate:f=!1,keyboard:_=!0}=t,w=!!this.onViewStateChange;this.toggleEvents($y.WHEEL,w&&i),this.toggleEvents($y.PAN,w),this.toggleEvents($y.PINCH,w&&(c||f)),this.toggleEvents($y.TRIPLE_PAN,w&&f),this.toggleEvents($y.DOUBLE_TAP,w&&o),this.toggleEvents($y.KEYBOARD,w&&_),this.scrollZoom=i,this.dragPan=s,this.dragRotate=n,this.doubleClickZoom=o,this.touchZoom=c,this.touchRotate=f,this.keyboard=_}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(t,r){this.eventManager&&t.forEach(i=>{this._events[i]!==r&&(this._events[i]=r,r?this.eventManager.on(i,this.handleEvent):this.eventManager.off(i,this.handleEvent))})}updateViewport(t,r=null,i={}){let s={...t.getViewportProps(),...r},n=this.controllerState!==t;if(this.state=t.getState(),this._setInteractionState(i),n){let o=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:s,interactionState:this._interactionState,oldViewState:o})}}_onTransition(t){this.onViewStateChange({...t,interactionState:this._interactionState})}_setInteractionState(t){Object.assign(this._interactionState,t),this.onStateChange(this._interactionState)}_onPanStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let i=this.isFunctionKeyPressed(t)||t.rightButton||!1;(this.invertPan||this.dragMode===\"pan\")&&(i=!i);let s=this.controllerState[i?\"panStart\":\"rotateStart\"]({pos:r});return this._panMove=i,this.updateViewport(s,em,{isDragging:!0}),!0}_onPan(t){return this.isDragging()?this._panMove?this._onPanMove(t):this._onPanRotate(t):!1}_onPanEnd(t){return this.isDragging()?this._panMove?this._onPanMoveEnd(t):this._onPanRotateEnd(t):!1}_onPanMove(t){if(!this.dragPan)return!1;let r=this.getCenter(t),i=this.controllerState.pan({pos:r});return this.updateViewport(i,em,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(t){let{inertia:r}=this;if(this.dragPan&&r&&t.velocity){let i=this.getCenter(t),s=[i[0]+t.velocityX*r/2,i[1]+t.velocityY*r/2],n=this.controllerState.pan({pos:s}).panEnd();this.updateViewport(n,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:sP},{isDragging:!1,isPanning:!0})}else{let i=this.controllerState.panEnd();this.updateViewport(i,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(t){if(!this.dragRotate)return!1;let r=this.getCenter(t),i=this.controllerState.rotate({pos:r});return this.updateViewport(i,em,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(t){let{inertia:r}=this;if(this.dragRotate&&r&&t.velocity){let i=this.getCenter(t),s=[i[0]+t.velocityX*r/2,i[1]+t.velocityY*r/2],n=this.controllerState.rotate({pos:s}).rotateEnd();this.updateViewport(n,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:sP},{isDragging:!1,isRotating:!0})}else{let i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(t){if(!this.scrollZoom)return!1;let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;t.srcEvent.preventDefault();let{speed:i=.01,smooth:s=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:n}=t,o=2/(1+Math.exp(-Math.abs(n*i)));n<0&&o!==0&&(o=1/o);let c=this.controllerState.zoom({pos:r,scale:o});return this.updateViewport(c,{...this._getTransitionProps({around:r}),transitionDuration:s?250:1},{isZooming:!0,isPanning:!0}),!0}_onTriplePanStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let i=this.controllerState.rotateStart({pos:r});return this.updateViewport(i,em,{isDragging:!0}),!0}_onTriplePan(t){if(!this.touchRotate||!this.isDragging())return!1;let r=this.getCenter(t);r[0]-=t.deltaX;let i=this.controllerState.rotate({pos:r});return this.updateViewport(i,em,{isDragging:!0,isRotating:!0}),!0}_onTriplePanEnd(t){if(!this.isDragging())return!1;let{inertia:r}=this;if(this.touchRotate&&r&&t.velocityY){let i=this.getCenter(t),s=[i[0],i[1]+=t.velocityY*r/2],n=this.controllerState.rotate({pos:s});this.updateViewport(n,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:sP},{isDragging:!1,isRotating:!0}),this.blockEvents(r)}else{let i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let i=this.controllerState.zoomStart({pos:r}).rotateStart({pos:r});return dg._startPinchRotation=t.rotation,dg._lastPinchEvent=t,this.updateViewport(i,em,{isDragging:!0}),!0}_onPinch(t){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let r=this.controllerState;if(this.touchZoom){let{scale:i}=t,s=this.getCenter(t);r=r.zoom({pos:s,scale:i})}if(this.touchRotate){let{rotation:i}=t;r=r.rotate({deltaAngleX:dg._startPinchRotation-i})}return this.updateViewport(r,em,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),dg._lastPinchEvent=t,!0}_onPinchEnd(t){if(!this.isDragging())return!1;let{inertia:r}=this,{_lastPinchEvent:i}=dg;if(this.touchZoom&&r&&i&&t.scale!==i.scale){let s=this.getCenter(t),n=this.controllerState.rotateEnd(),o=Math.log2(t.scale),c=(o-Math.log2(i.scale))/(t.deltaTime-i.deltaTime),f=Math.pow(2,o+c*r/2);n=n.zoom({pos:s,scale:f}).zoomEnd(),this.updateViewport(n,{...this._getTransitionProps({around:s}),transitionDuration:r,transitionEasing:sP},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(r)}else{let s=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(s,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return dg._startPinchRotation=null,dg._lastPinchEvent=null,!0}_onDoubleTap(t){if(!this.doubleClickZoom)return!1;let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let i=this.isFunctionKeyPressed(t),s=this.controllerState.zoom({pos:r,scale:i?.5:2});return this.updateViewport(s,this._getTransitionProps({around:r}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(t){if(!this.keyboard)return!1;let r=this.isFunctionKeyPressed(t),{zoomSpeed:i,moveSpeed:s,rotateSpeedX:n,rotateSpeedY:o}=this.keyboard===!0?{}:this.keyboard,{controllerState:c}=this,f,_={};switch(t.srcEvent.code){case\"Minus\":f=r?c.zoomOut(i).zoomOut(i):c.zoomOut(i),_.isZooming=!0;break;case\"Equal\":f=r?c.zoomIn(i).zoomIn(i):c.zoomIn(i),_.isZooming=!0;break;case\"ArrowLeft\":r?(f=c.rotateLeft(n),_.isRotating=!0):(f=c.moveLeft(s),_.isPanning=!0);break;case\"ArrowRight\":r?(f=c.rotateRight(n),_.isRotating=!0):(f=c.moveRight(s),_.isPanning=!0);break;case\"ArrowUp\":r?(f=c.rotateUp(o),_.isRotating=!0):(f=c.moveUp(s),_.isPanning=!0);break;case\"ArrowDown\":r?(f=c.rotateDown(o),_.isRotating=!0):(f=c.moveDown(s),_.isPanning=!0);break;default:return!1}return this.updateViewport(f,this._getTransitionProps(),_),!0}_getTransitionProps(t){let{transition:r}=this;return!r||!r.transitionInterpolator?em:t?{...r,transitionInterpolator:new fg({...t,...r.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:r}};var Zb=class{constructor(t,r){G(this,\"_viewportProps\",void 0),G(this,\"_state\",void 0),this._viewportProps=this.applyConstraints(t),this._state=r}getViewportProps(){return this._viewportProps}getState(){return this._state}};var xG=5,Qlt=1.2,wD=class extends Zb{constructor(t){let{width:r,height:i,latitude:s,longitude:n,zoom:o,bearing:c=0,pitch:f=0,altitude:_=1.5,position:w=[0,0,0],maxZoom:I=20,minZoom:R=0,maxPitch:N=60,minPitch:j=0,startPanLngLat:Q,startZoomLngLat:et,startRotatePos:Y,startBearing:K,startPitch:J,startZoom:ut,normalize:Et=!0}=t;_r(Number.isFinite(n)),_r(Number.isFinite(s)),_r(Number.isFinite(o)),super({width:r,height:i,latitude:s,longitude:n,zoom:o,bearing:c,pitch:f,altitude:_,maxZoom:I,minZoom:R,maxPitch:N,minPitch:j,normalize:Et,position:w},{startPanLngLat:Q,startZoomLngLat:et,startRotatePos:Y,startBearing:K,startPitch:J,startZoom:ut}),G(this,\"makeViewport\",void 0),this.makeViewport=t.makeViewport}panStart({pos:t}){return this._getUpdatedState({startPanLngLat:this._unproject(t)})}pan({pos:t,startPos:r}){let i=this.getState().startPanLngLat||this._unproject(r);if(!i)return this;let n=this.makeViewport(this.getViewportProps()).panByPosition(i,t);return this._getUpdatedState(n)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:t}){return this._getUpdatedState({startRotatePos:t,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:t,deltaAngleX:r=0,deltaAngleY:i=0}){let{startRotatePos:s,startBearing:n,startPitch:o}=this.getState();if(!s||n===void 0||o===void 0)return this;let c;return t?c=this._getNewRotation(t,s,o,n):c={bearing:n+r,pitch:o+i},this._getUpdatedState(c)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:t}){return this._getUpdatedState({startZoomLngLat:this._unproject(t),startZoom:this.getViewportProps().zoom})}zoom({pos:t,startPos:r,scale:i}){let{startZoom:s,startZoomLngLat:n}=this.getState();if(n||(s=this.getViewportProps().zoom,n=this._unproject(r)||this._unproject(t)),!n)return this;let{maxZoom:o,minZoom:c}=this.getViewportProps(),f=s+Math.log2(i);f=Il(f,c,o);let _=this.makeViewport({...this.getViewportProps(),zoom:f});return this._getUpdatedState({zoom:f,..._.panByPosition(n,t)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(t=2){return this._zoomFromCenter(t)}zoomOut(t=2){return this._zoomFromCenter(1/t)}moveLeft(t=100){return this._panFromCenter([t,0])}moveRight(t=100){return this._panFromCenter([-t,0])}moveUp(t=100){return this._panFromCenter([0,t])}moveDown(t=100){return this._panFromCenter([0,-t])}rotateLeft(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-t})}rotateRight(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+t})}rotateUp(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+t})}rotateDown(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-t})}shortestPathFrom(t){let r=t.getViewportProps(),i={...this.getViewportProps()},{bearing:s,longitude:n}=i;return Math.abs(s-r.bearing)>180&&(i.bearing=s<0?s+360:s-360),Math.abs(n-r.longitude)>180&&(i.longitude=n<0?n+360:n-360),i}applyConstraints(t){let{maxZoom:r,minZoom:i,zoom:s}=t;t.zoom=Il(s,i,r);let{maxPitch:n,minPitch:o,pitch:c}=t;t.pitch=Il(c,o,n);let{normalize:f=!0}=t;return f&&Object.assign(t,eP(t)),t}_zoomFromCenter(t){let{width:r,height:i}=this.getViewportProps();return this.zoom({pos:[r/2,i/2],scale:t})}_panFromCenter(t){let{width:r,height:i}=this.getViewportProps();return this.pan({startPos:[r/2,i/2],pos:[r/2+t[0],i/2+t[1]]})}_getUpdatedState(t){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...t})}_unproject(t){let r=this.makeViewport(this.getViewportProps());return t&&r.unproject(t)}_getNewRotation(t,r,i,s){let n=t[0]-r[0],o=t[1]-r[1],c=t[1],f=r[1],{width:_,height:w}=this.getViewportProps(),I=n/_,R=0;o>0?Math.abs(w-f)>xG&&(R=o/(f-w)*Qlt):o<0&&f>xG&&(R=1-c/f),R=Il(R,-1,1);let{minPitch:N,maxPitch:j}=this.getViewportProps(),Q=s+180*I,et=i;return R>0?et=i+R*(j-i):R<0&&(et=i-R*(N-i)),{pitch:et,bearing:Q}}},Yb=class extends qb{constructor(...t){super(...t),G(this,\"ControllerState\",wD),G(this,\"transition\",{transitionDuration:300,transitionInterpolator:new fg({transitionProps:{compare:[\"longitude\",\"latitude\",\"zoom\",\"bearing\",\"pitch\",\"position\"],required:[\"longitude\",\"latitude\",\"zoom\"]}})}),G(this,\"dragMode\",\"pan\")}setProps(t){t.position=t.position||[0,0,0];let r=this.props;super.setProps(t),(!r||r.height!==t.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...t,...this.state}))}};var Xy=class extends Xc{get ViewportType(){return lc}get ControllerType(){return Yb}};G(Xy,\"displayName\",\"MapView\");var $lt=new qy;function Xlt(e,t){var r,i;let s=(r=e.order)!==null&&r!==void 0?r:1/0,n=(i=t.order)!==null&&i!==void 0?i:1/0;return s-n}var Qb=class{constructor(){G(this,\"effects\",void 0),G(this,\"_resolvedEffects\",[]),G(this,\"_defaultEffects\",[]),G(this,\"_needsRedraw\",void 0),this.effects=[],this._needsRedraw=\"Initial render\",this._setEffects([])}addDefaultEffect(t){let r=this._defaultEffects;if(!r.find(i=>i.id===t.id)){let i=r.findIndex(s=>Xlt(s,t)>0);i<0?r.push(t):r.splice(i,0,t),this._setEffects(this.effects)}}setProps(t){\"effects\"in t&&(mo(t.effects,this.effects,1)||this._setEffects(t.effects))}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),r}getEffects(){return this._resolvedEffects}_setEffects(t){let r={};for(let s of this.effects)r[s.id]=s;let i=[];for(let s of t){let n=r[s.id];n&&n!==s?n.setProps?(n.setProps(s.props),i.push(n)):(n.cleanup(),i.push(s)):i.push(s),delete r[s.id]}for(let s in r)r[s].cleanup();this.effects=i,this._resolvedEffects=i.concat(this._defaultEffects),t.some(s=>s instanceof qy)||this._resolvedEffects.push($lt),this._needsRedraw=\"effects changed\"}finalize(){for(let t of this._resolvedEffects)t.cleanup();this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}};var $b=class extends sc{shouldDrawLayer(t){let{operation:r}=t.props;return r.includes(\"draw\")||r.includes(\"terrain\")}};var Klt=\"deckRenderer.renderLayers\",Xb=class{constructor(t){G(this,\"gl\",void 0),G(this,\"layerFilter\",void 0),G(this,\"drawPickingColors\",void 0),G(this,\"drawLayersPass\",void 0),G(this,\"pickLayersPass\",void 0),G(this,\"renderCount\",void 0),G(this,\"_needsRedraw\",void 0),G(this,\"renderBuffers\",void 0),G(this,\"lastPostProcessEffect\",void 0),this.gl=t,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new $b(t),this.pickLayersPass=new ug(t),this.renderCount=0,this._needsRedraw=\"Initial render\",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(t){this.layerFilter!==t.layerFilter&&(this.layerFilter=t.layerFilter,this._needsRedraw=\"layerFilter changed\"),this.drawPickingColors!==t.drawPickingColors&&(this.drawPickingColors=t.drawPickingColors,this._needsRedraw=\"drawPickingColors changed\")}renderLayers(t){if(!t.viewports.length)return;let r=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,i={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...t,target:t.target||yi.getDefaultFramebuffer(this.gl)};i.effects&&this._preRender(i.effects,i);let s=this.lastPostProcessEffect?this.renderBuffers[0]:i.target,n=r.render({...i,target:s});i.effects&&this._postRender(i.effects,i),this.renderCount++,Ls(Klt,this,n,t)}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),r}finalize(){let{renderBuffers:t}=this;for(let r of t)r.delete();t.length=0}_preRender(t,r){this.lastPostProcessEffect=null,r.preRenderStats=r.preRenderStats||{};for(let i of t)r.preRenderStats[i.id]=i.preRender(this.gl,r),i.postRender&&(this.lastPostProcessEffect=i.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){let{renderBuffers:t}=this;t.length===0&&t.push(new yi(this.gl),new yi(this.gl));for(let r of t)r.resize()}_postRender(t,r){let{renderBuffers:i}=this,s={...r,inputBuffer:i[0],swapBuffer:i[1],target:null};for(let n of t)if(n.postRender){if(n.id===this.lastPostProcessEffect){s.target=r.target,n.postRender(this.gl,s);break}let o=n.postRender(this.gl,s);s.inputBuffer=o,s.swapBuffer=o===i[0]?i[1]:i[0]}}};var Jlt={pickedColor:null,pickedObjectIndex:-1};function bG({pickedColors:e,decodePickingColor:t,deviceX:r,deviceY:i,deviceRadius:s,deviceRect:n}){let{x:o,y:c,width:f,height:_}=n,w=s*s,I=-1,R=0;for(let N=0;N<_;N++){let j=N+c-i,Q=j*j;if(Q>w)R+=4*f;else for(let et=0;et=0){let K=et+o-r,J=K*K+Q;J<=w&&(w=J,I=R)}R+=4}}if(I>=0){let N=e.slice(I,I+4),j=t(N);if(j){let Q=Math.floor(I/4/f),et=I/4-Q*f;return{...j,pickedColor:N,pickedX:o+et,pickedY:c+Q}}or.error(\"Picked non-existent layer. Is picking buffer corrupt?\")()}return Jlt}function wG({pickedColors:e,decodePickingColor:t}){let r=new Map;if(e){for(let i=0;i=0){let n=e.slice(i,i+4),o=n.join(\",\");if(!r.has(o)){let c=t(n);c?r.set(o,{...c,color:n}):or.error(\"Picked non-existent layer. Is picking buffer corrupt?\")()}}}return Array.from(r.values())}function SD({pickInfo:e,viewports:t,pixelRatio:r,x:i,y:s,z:n}){let o=t[0];t.length>1&&(o=tct(e?.pickedViewports||t,{x:i,y:s}));let c;if(o){let f=[i-o.x,s-o.y];n!==void 0&&(f[2]=n),c=o.unproject(f)}return{color:null,layer:null,viewport:o,index:-1,picked:!1,x:i,y:s,pixel:[i,s],coordinate:c,devicePixel:e&&\"pickedX\"in e?[e.pickedX,e.pickedY]:void 0,pixelRatio:r}}function SG(e){let{pickInfo:t,lastPickedInfo:r,mode:i,layers:s}=e,{pickedColor:n,pickedLayer:o,pickedObjectIndex:c}=t,f=o?[o]:[];if(i===\"hover\"){let I=r.index,R=r.layerId,N=o?o.props.id:null;if(N!==R||c!==I){if(N!==R){let j=s.find(Q=>Q.props.id===R);j&&f.unshift(j)}r.layerId=N,r.index=c,r.info=null}}let _=SD(e),w=new Map;return w.set(null,_),f.forEach(I=>{let R={..._};I===o&&(R.color=n,R.index=c,R.picked=!0),R=TD({layer:I,info:R,mode:i});let N=R.layer;I===o&&i===\"hover\"&&(r.info=R),w.set(N.id,R),i===\"hover\"&&N.updateAutoHighlight(R)}),w}function TD({layer:e,info:t,mode:r}){for(;e&&t;){let i=t.layer||null;t.sourceLayer=i,t.layer=e,t=e.getPickingInfo({info:t,mode:r,sourceLayer:i}),e=e.parent}return t}function tct(e,t){for(let r=e.length-1;r>=0;r--){let i=e[r];if(i.containsPixel(t))return i}return e[0]}var Kb=class{constructor(t){G(this,\"gl\",void 0),G(this,\"pickingFBO\",void 0),G(this,\"depthFBO\",void 0),G(this,\"pickLayersPass\",void 0),G(this,\"layerFilter\",void 0),G(this,\"lastPickedInfo\",void 0),G(this,\"_pickable\",!0),this.gl=t,this.pickLayersPass=new ug(t),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(t){\"layerFilter\"in t&&(this.layerFilter=t.layerFilter),\"_pickable\"in t&&(this._pickable=t._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.delete(),this.depthFBO&&(this.depthFBO.color.delete(),this.depthFBO.delete())}pickObject(t){return this._pickClosestObject(t)}pickObjects(t){return this._pickVisibleObjects(t)}getLastPickedObject({x:t,y:r,layers:i,viewports:s},n=this.lastPickedInfo.info){let o=n&&n.layer&&n.layer.id,c=n&&n.viewport&&n.viewport.id,f=o?i.find(R=>R.id===o):null,_=c&&s.find(R=>R.id===c)||s[0],w=_&&_.unproject([t-_.x,r-_.y]);return{...n,...{x:t,y:r,viewport:_,coordinate:w,layer:f}}}_resizeBuffer(){var t,r;let{gl:i}=this;if(!this.pickingFBO&&(this.pickingFBO=new yi(i),yi.isSupported(i,{colorBufferFloat:!0}))){let s=new yi(i);s.attach({36064:new pi(i,{format:fr(i)?34836:6408,type:5126})}),this.depthFBO=s}(t=this.pickingFBO)===null||t===void 0||t.resize({width:i.canvas.width,height:i.canvas.height}),(r=this.depthFBO)===null||r===void 0||r.resize({width:i.canvas.width,height:i.canvas.height})}_getPickable(t){if(this._pickable===!1)return null;let r=t.filter(i=>this.pickLayersPass.shouldDrawLayer(i)&&!i.isComposite);return r.length?r:null}_pickClosestObject({layers:t,views:r,viewports:i,x:s,y:n,radius:o=0,depth:c=1,mode:f=\"query\",unproject3D:_,onViewportActive:w,effects:I}){let R=this._getPickable(t),N=El(this.gl);if(!R)return{result:[],emptyInfo:SD({viewports:i,x:s,y:n,pixelRatio:N})};this._resizeBuffer();let j=Sy(this.gl,[s,n],!0),Q=[j.x+Math.floor(j.width/2),j.y+Math.floor(j.height/2)],et=Math.round(o*N),{width:Y,height:K}=this.pickingFBO,J=this._getPickingRect({deviceX:Q[0],deviceY:Q[1],deviceRadius:et,deviceWidth:Y,deviceHeight:K}),ut={x:s-o,y:n-o,width:o*2+1,height:o*2+1},Et,kt=[],Xt=new Set;for(let qt=0;qt=_)break;let De=kt[ue],Ke={color:De.pickedColor,layer:null,index:De.pickedObjectIndex,picked:!0,x:s,y:n,pixelRatio:N};Ke=TD({layer:De.pickedLayer,info:Ke,mode:f});let rr=(le=Ke.object)!==null&&le!==void 0?le:\"\".concat(Ke.layer.id,\"[\").concat(Ke.index,\"]\");Xt.has(rr)||Xt.set(rr,Ke)}return Array.from(Xt.values())}_drawAndSample({layers:t,views:r,viewports:i,onViewportActive:s,deviceRect:n,cullRect:o,effects:c,pass:f},_=!1){let w=_?this.depthFBO:this.pickingFBO,I={layers:t,layerFilter:this.layerFilter,views:r,viewports:i,onViewportActive:s,pickingFBO:w,deviceRect:n,cullRect:o,effects:c,pass:f,pickZ:_,preRenderStats:{}};for(let K of c)K.useInPicking&&(I.preRenderStats[K.id]=K.preRender(this.gl,I));let{decodePickingColor:R}=this.pickLayersPass.render(I),{x:N,y:j,width:Q,height:et}=n,Y=new(_?Float32Array:Uint8Array)(Q*et*4);return Dh(w,{sourceX:N,sourceY:j,sourceWidth:Q,sourceHeight:et,target:Y}),{pickedColors:Y,decodePickingColor:R}}_getPickingRect({deviceX:t,deviceY:r,deviceRadius:i,deviceWidth:s,deviceHeight:n}){let o=Math.max(0,t-i),c=Math.max(0,r-i),f=Math.min(s,t+i+1)-o,_=Math.min(n,r+i+1)-c;return f<=0||_<=0?null:{x:o,y:c,width:f,height:_}}};var ect={zIndex:\"1\",position:\"absolute\",pointerEvents:\"none\",color:\"#a0a7b4\",backgroundColor:\"#29323c\",padding:\"10px\",top:\"0\",left:\"0\",display:\"none\"},Jb=class{constructor(t){G(this,\"el\",null),G(this,\"isVisible\",!1);let r=t.parentElement;r&&(this.el=document.createElement(\"div\"),this.el.className=\"deck-tooltip\",Object.assign(this.el.style,ect),r.appendChild(this.el))}setTooltip(t,r,i){let s=this.el;if(s){if(typeof t==\"string\")s.innerText=t;else if(t)t.text&&(s.innerText=t.text),t.html&&(s.innerHTML=t.html),t.className&&(s.className=t.className);else{this.isVisible=!1,s.style.display=\"none\";return}this.isVisible=!0,s.style.display=\"block\",s.style.transform=\"translate(\".concat(r,\"px, \").concat(i,\"px)\"),t&&typeof t==\"object\"&&\"style\"in t&&Object.assign(s.style,t.style)}}remove(){this.el&&(this.el.remove(),this.el=null)}};var pg=Ri(TG());var rct={mousedown:1,mousemove:2,mouseup:4};function ict(e,t){for(let r=0;r0&&i.type===\"pointerdown\"&&(ict(s,n=>n.pointerId===i.pointerId)||s.push(i)),t.call(this,i)}}function EG(e){e.prototype.handler=function(r){let i=rct[r.type];i&1&&r.button>=0&&(this.pressed=!0),i&2&&r.which===0&&(i=4),this.pressed&&(i&4&&(this.pressed=!1),this.callback(this.manager,i,{pointers:[r],changedPointers:[r],pointerType:\"mouse\",srcEvent:r}))}}MG(pg.PointerEventInput);EG(pg.MouseInput);var PG=pg.Manager,Hh=pg;var qh=class{constructor(t,r,i){this.element=t,this.callback=r,this.options={enable:!0,...i}}};var IG=Hh?[[Hh.Pan,{event:\"tripan\",pointers:3,threshold:0,enable:!1}],[Hh.Rotate,{enable:!1}],[Hh.Pinch,{enable:!1}],[Hh.Swipe,{enable:!1}],[Hh.Pan,{threshold:0,enable:!1}],[Hh.Press,{enable:!1}],[Hh.Tap,{event:\"doubletap\",taps:2,enable:!1}],[Hh.Tap,{event:\"anytap\",enable:!1}],[Hh.Tap,{enable:!1}]]:null,MD={tripan:[\"rotate\",\"pinch\",\"pan\"],rotate:[\"pinch\"],pinch:[\"pan\"],pan:[\"press\",\"doubletap\",\"anytap\",\"tap\"],doubletap:[\"anytap\"],anytap:[\"tap\"]},CG={doubletap:[\"tap\"]},LG={pointerdown:\"pointerdown\",pointermove:\"pointermove\",pointerup:\"pointerup\",touchstart:\"pointerdown\",touchmove:\"pointermove\",touchend:\"pointerup\",mousedown:\"pointerdown\",mousemove:\"pointermove\",mouseup:\"pointerup\"},Ky={KEY_EVENTS:[\"keydown\",\"keyup\"],MOUSE_EVENTS:[\"mousedown\",\"mousemove\",\"mouseup\",\"mouseover\",\"mouseout\",\"mouseleave\"],WHEEL_EVENTS:[\"wheel\",\"mousewheel\"]},kG={tap:\"tap\",anytap:\"anytap\",doubletap:\"doubletap\",press:\"press\",pinch:\"pinch\",pinchin:\"pinch\",pinchout:\"pinch\",pinchstart:\"pinch\",pinchmove:\"pinch\",pinchend:\"pinch\",pinchcancel:\"pinch\",rotate:\"rotate\",rotatestart:\"rotate\",rotatemove:\"rotate\",rotateend:\"rotate\",rotatecancel:\"rotate\",tripan:\"tripan\",tripanstart:\"tripan\",tripanmove:\"tripan\",tripanup:\"tripan\",tripandown:\"tripan\",tripanleft:\"tripan\",tripanright:\"tripan\",tripanend:\"tripan\",tripancancel:\"tripan\",pan:\"pan\",panstart:\"pan\",panmove:\"pan\",panup:\"pan\",pandown:\"pan\",panleft:\"pan\",panright:\"pan\",panend:\"pan\",pancancel:\"pan\",swipe:\"swipe\",swipeleft:\"swipe\",swiperight:\"swipe\",swipeup:\"swipe\",swipedown:\"swipe\"},ED={click:\"tap\",anyclick:\"anytap\",dblclick:\"doubletap\",mousedown:\"pointerdown\",mousemove:\"pointermove\",mouseup:\"pointerup\",mouseover:\"pointerover\",mouseout:\"pointerout\",mouseleave:\"pointerleave\"};var RG=typeof navigator<\"u\"&&navigator.userAgent?navigator.userAgent.toLowerCase():\"\",Ag=typeof window<\"u\"?window:global;var aP=!1;try{let e={get passive(){return aP=!0,!0}};Ag.addEventListener(\"test\",null,e),Ag.removeEventListener(\"test\",null)}catch{aP=!1}var nct=RG.indexOf(\"firefox\")!==-1,{WHEEL_EVENTS:sct}=Ky,DG=\"wheel\",OG=4.000244140625,oct=40,act=.25,tw=class extends qh{constructor(t,r,i){super(t,r,i),this.handleEvent=s=>{if(!this.options.enable)return;let n=s.deltaY;Ag.WheelEvent&&(nct&&s.deltaMode===Ag.WheelEvent.DOM_DELTA_PIXEL&&(n/=Ag.devicePixelRatio),s.deltaMode===Ag.WheelEvent.DOM_DELTA_LINE&&(n*=oct)),n!==0&&n%OG===0&&(n=Math.floor(n/OG)),s.shiftKey&&n&&(n=n*act),this.callback({type:DG,center:{x:s.clientX,y:s.clientY},delta:-n,srcEvent:s,pointerType:\"mouse\",target:s.target})},this.events=(this.options.events||[]).concat(sct),this.events.forEach(s=>t.addEventListener(s,this.handleEvent,aP?{passive:!1}:!1))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,r){t===DG&&(this.options.enable=r)}};var{MOUSE_EVENTS:lct}=Ky,BG=\"pointermove\",FG=\"pointerover\",zG=\"pointerout\",NG=\"pointerenter\",UG=\"pointerleave\",ew=class extends qh{constructor(t,r,i){super(t,r,i),this.handleEvent=n=>{this.handleOverEvent(n),this.handleOutEvent(n),this.handleEnterEvent(n),this.handleLeaveEvent(n),this.handleMoveEvent(n)},this.pressed=!1;let{enable:s}=this.options;this.enableMoveEvent=s,this.enableLeaveEvent=s,this.enableEnterEvent=s,this.enableOutEvent=s,this.enableOverEvent=s,this.events=(this.options.events||[]).concat(lct),this.events.forEach(n=>t.addEventListener(n,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,r){t===BG&&(this.enableMoveEvent=r),t===FG&&(this.enableOverEvent=r),t===zG&&(this.enableOutEvent=r),t===NG&&(this.enableEnterEvent=r),t===UG&&(this.enableLeaveEvent=r)}handleOverEvent(t){this.enableOverEvent&&t.type===\"mouseover\"&&this._emit(FG,t)}handleOutEvent(t){this.enableOutEvent&&t.type===\"mouseout\"&&this._emit(zG,t)}handleEnterEvent(t){this.enableEnterEvent&&t.type===\"mouseenter\"&&this._emit(NG,t)}handleLeaveEvent(t){this.enableLeaveEvent&&t.type===\"mouseleave\"&&this._emit(UG,t)}handleMoveEvent(t){if(this.enableMoveEvent)switch(t.type){case\"mousedown\":t.button>=0&&(this.pressed=!0);break;case\"mousemove\":t.which===0&&(this.pressed=!1),this.pressed||this._emit(BG,t);break;case\"mouseup\":this.pressed=!1;break;default:}}_emit(t,r){this.callback({type:t,center:{x:r.clientX,y:r.clientY},srcEvent:r,pointerType:\"mouse\",target:r.target})}};var{KEY_EVENTS:cct}=Ky,VG=\"keydown\",jG=\"keyup\",rw=class extends qh{constructor(t,r,i){super(t,r,i),this.handleEvent=s=>{let n=s.target||s.srcElement;n.tagName===\"INPUT\"&&n.type===\"text\"||n.tagName===\"TEXTAREA\"||(this.enableDownEvent&&s.type===\"keydown\"&&this.callback({type:VG,srcEvent:s,key:s.key,target:s.target}),this.enableUpEvent&&s.type===\"keyup\"&&this.callback({type:jG,srcEvent:s,key:s.key,target:s.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=(this.options.events||[]).concat(cct),t.tabIndex=this.options.tabIndex||0,t.style.outline=\"none\",this.events.forEach(s=>t.addEventListener(s,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,r){t===VG&&(this.enableDownEvent=r),t===jG&&(this.enableUpEvent=r)}};var GG=\"contextmenu\",iw=class extends qh{constructor(t,r,i){super(t,r,i),this.handleEvent=s=>{this.options.enable&&this.callback({type:GG,center:{x:s.clientX,y:s.clientY},srcEvent:s,pointerType:\"mouse\",target:s.target})},t.addEventListener(\"contextmenu\",this.handleEvent)}destroy(){this.element.removeEventListener(\"contextmenu\",this.handleEvent)}enableEventType(t,r){t===GG&&(this.options.enable=r)}};var uct={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},hct=1,fct=2,dct=3,pct=0,Act=1,mct=2,gct=1,_ct=2,yct=4;function WG(e){let t=uct[e.srcEvent.type];if(!t)return null;let{buttons:r,button:i,which:s}=e.srcEvent,n=!1,o=!1,c=!1;return t===4||t===2&&!Number.isFinite(r)?(n=s===hct,o=s===fct,c=s===dct):t===2?(n=!!(r&gct),o=!!(r&yct),c=!!(r&_ct)):t===1&&(n=i===pct,o=i===Act,c=i===mct),{leftButton:n,middleButton:o,rightButton:c}}function HG(e,t){let r=e.center;if(!r)return null;let i=t.getBoundingClientRect(),s=i.width/t.offsetWidth||1,n=i.height/t.offsetHeight||1,o={x:(r.x-i.left-t.clientLeft)/s,y:(r.y-i.top-t.clientTop)/n};return{center:r,offsetCenter:o}}var PD={srcElement:\"root\",priority:0},nw=class{constructor(t){this.handleEvent=r=>{if(this.isEmpty())return;let i=this._normalizeEvent(r),s=r.srcEvent.target;for(;s&&s!==i.rootElement;){if(this._emit(i,s),i.handled)return;s=s.parentNode}this._emit(i,\"root\")},this.eventManager=t,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(t,r,i,s=!1,n=!1){let{handlers:o,handlersByElement:c}=this,f=PD;typeof i==\"string\"||i&&i.addEventListener?f={...PD,srcElement:i}:i&&(f={...PD,...i});let _=c.get(f.srcElement);_||(_=[],c.set(f.srcElement,_));let w={type:t,handler:r,srcElement:f.srcElement,priority:f.priority};s&&(w.once=!0),n&&(w.passive=!0),o.push(w),this._active=this._active||!w.passive;let I=_.length-1;for(;I>=0&&!(_[I].priority>=w.priority);)I--;_.splice(I+1,0,w)}remove(t,r){let{handlers:i,handlersByElement:s}=this;for(let n=i.length-1;n>=0;n--){let o=i[n];if(o.type===t&&o.handler===r){i.splice(n,1);let c=s.get(o.srcElement);c.splice(c.indexOf(o),1),c.length===0&&s.delete(o.srcElement)}}this._active=i.some(n=>!n.passive)}_emit(t,r){let i=this.handlersByElement.get(r);if(i){let s=!1,n=()=>{t.handled=!0},o=()=>{t.handled=!0,s=!0},c=[];for(let f=0;f{t.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:r}}};var vct={events:null,recognizers:null,recognizerOptions:{},Manager:PG,touchAction:\"none\",tabIndex:0},Jy=class{constructor(t=null,r){this._onBasicInput=s=>{let{srcEvent:n}=s,o=LG[n.type];o&&this.manager.emit(o,s)},this._onOtherEvent=s=>{this.manager.emit(s.type,s)},this.options={...vct,...r},this.events=new Map,this.setElement(t);let{events:i}=this.options;i&&this.on(i)}getElement(){return this.element}setElement(t){if(this.element&&this.destroy(),this.element=t,!t)return;let{options:r}=this,i=r.Manager;this.manager=new i(t,{touchAction:r.touchAction,recognizers:r.recognizers||IG}).on(\"hammer.input\",this._onBasicInput),r.recognizers||Object.keys(MD).forEach(s=>{let n=this.manager.get(s);n&&MD[s].forEach(o=>{n.recognizeWith(o)})});for(let s in r.recognizerOptions){let n=this.manager.get(s);if(n){let o=r.recognizerOptions[s];delete o.enable,n.set(o)}}this.wheelInput=new tw(t,this._onOtherEvent,{enable:!1}),this.moveInput=new ew(t,this._onOtherEvent,{enable:!1}),this.keyInput=new rw(t,this._onOtherEvent,{enable:!1,tabIndex:r.tabIndex}),this.contextmenuInput=new iw(t,this._onOtherEvent,{enable:!1});for(let[s,n]of this.events)n.isEmpty()||(this._toggleRecognizer(n.recognizerName,!0),this.manager.on(s,n.handleEvent))}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}on(t,r,i){this._addEventHandler(t,r,i,!1)}once(t,r,i){this._addEventHandler(t,r,i,!0)}watch(t,r,i){this._addEventHandler(t,r,i,!1,!0)}off(t,r){this._removeEventHandler(t,r)}_toggleRecognizer(t,r){let{manager:i}=this;if(!i)return;let s=i.get(t);if(s&&s.options.enable!==r){s.set({enable:r});let n=CG[t];n&&!this.options.recognizers&&n.forEach(o=>{let c=i.get(o);r?(c.requireFailure(t),s.dropRequireFailure(o)):c.dropRequireFailure(t)})}this.wheelInput.enableEventType(t,r),this.moveInput.enableEventType(t,r),this.keyInput.enableEventType(t,r),this.contextmenuInput.enableEventType(t,r)}_addEventHandler(t,r,i,s,n){if(typeof t!=\"string\"){i=r;for(let w in t)this._addEventHandler(w,t[w],i,s,n);return}let{manager:o,events:c}=this,f=ED[t]||t,_=c.get(f);_||(_=new nw(this),c.set(f,_),_.recognizerName=kG[f]||f,o&&o.on(f,_.handleEvent)),_.add(t,r,i,s,n),_.isEmpty()||this._toggleRecognizer(_.recognizerName,!0)}_removeEventHandler(t,r){if(typeof t!=\"string\"){for(let o in t)this._removeEventHandler(o,t[o]);return}let{events:i}=this,s=ED[t]||t,n=i.get(s);if(n&&(n.remove(t,r),n.isEmpty())){let{recognizerName:o}=n,c=!1;for(let f of i.values())if(f.recognizerName===o&&!f.isEmpty()){c=!0;break}c||this._toggleRecognizer(o,!1)}}};function mg(){}var xct=({isDragging:e})=>e?\"grabbing\":\"grab\",qG={id:\"\",width:\"100%\",height:\"100%\",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,glOptions:{},parameters:{},parent:null,gl:null,canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:\"none\",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,onWebGLInitialized:mg,onResize:mg,onViewStateChange:mg,onInteractionStateChange:mg,onBeforeRender:mg,onAfterRender:mg,onLoad:mg,onError:e=>or.error(e.message,e.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:xct,getTooltip:null,debug:!1,drawPickingColors:!1},cp=class{constructor(t){G(this,\"props\",void 0),G(this,\"width\",0),G(this,\"height\",0),G(this,\"userData\",{}),G(this,\"canvas\",null),G(this,\"viewManager\",null),G(this,\"layerManager\",null),G(this,\"effectManager\",null),G(this,\"deckRenderer\",null),G(this,\"deckPicker\",null),G(this,\"eventManager\",null),G(this,\"tooltip\",null),G(this,\"metrics\",void 0),G(this,\"animationLoop\",void 0),G(this,\"stats\",void 0),G(this,\"viewState\",void 0),G(this,\"cursorState\",void 0),G(this,\"_needsRedraw\",void 0),G(this,\"_pickRequest\",void 0),G(this,\"_lastPointerDownInfo\",null),G(this,\"_metricsCounter\",void 0),G(this,\"_onPointerMove\",r=>{let{_pickRequest:i}=this;if(r.type===\"pointerleave\")i.x=-1,i.y=-1,i.radius=0;else{if(r.leftButton||r.rightButton)return;{let s=r.offsetCenter;if(!s)return;i.x=s.x,i.y=s.y,i.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:i.x,y:i.y}),i.event=r}),G(this,\"_onEvent\",r=>{let i=nR[r.type],s=r.offsetCenter;if(!i||!s||!this.layerManager)return;let n=this.layerManager.getLayers(),o=this.deckPicker.getLastPickedObject({x:s.x,y:s.y,layers:n,viewports:this.getViewports(s)},this._lastPointerDownInfo),{layer:c}=o,f=c&&(c[i.handler]||c.props[i.handler]),_=this.props[i.handler],w=!1;f&&(w=f.call(c,o,r)),!w&&_&&_(o,r)}),G(this,\"_onPointerDown\",r=>{let i=r.offsetCenter,s=this._pick(\"pickObject\",\"pickObject Time\",{x:i.x,y:i.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=s.result[0]||s.emptyInfo}),this.props={...qG,...t},t=this.props,this._needsRedraw=\"Initial render\",this._pickRequest={mode:\"hover\",x:-1,y:-1,radius:0,event:null},this.cursorState={isHovering:!1,isDragging:!1},t.viewState&&t.initialViewState&&or.warn(\"View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.\")(),vy()===\"IE\"&&or.warn(\"IE 11 is not supported\")(),this.viewState=t.initialViewState,t.gl||typeof document<\"u\"&&(this.canvas=this._createCanvas(t)),this.animationLoop=this._createAnimationLoop(t),this.stats=new Gf({id:\"deck.gl\"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this.setProps(t),t._typedArrayManagerProps&&Gh.setOptions(t._typedArrayManagerProps),this.animationLoop.start()}finalize(){var t,r,i,s,n,o,c,f;if((t=this.animationLoop)===null||t===void 0||t.stop(),this.animationLoop=null,this._lastPointerDownInfo=null,(r=this.layerManager)===null||r===void 0||r.finalize(),this.layerManager=null,(i=this.viewManager)===null||i===void 0||i.finalize(),this.viewManager=null,(s=this.effectManager)===null||s===void 0||s.finalize(),this.effectManager=null,(n=this.deckRenderer)===null||n===void 0||n.finalize(),this.deckRenderer=null,(o=this.deckPicker)===null||o===void 0||o.finalize(),this.deckPicker=null,(c=this.eventManager)===null||c===void 0||c.destroy(),this.eventManager=null,(f=this.tooltip)===null||f===void 0||f.remove(),this.tooltip=null,!this.props.canvas&&!this.props.gl&&this.canvas){var _;(_=this.canvas.parentElement)===null||_===void 0||_.removeChild(this.canvas),this.canvas=null}}setProps(t){this.stats.get(\"setProps Time\").timeStart(),\"onLayerHover\"in t&&or.removed(\"onLayerHover\",\"onHover\")(),\"onLayerClick\"in t&&or.removed(\"onLayerClick\",\"onClick\")(),t.initialViewState&&!mo(this.props.initialViewState,t.initialViewState,3)&&(this.viewState=t.initialViewState),Object.assign(this.props,t),this._setCanvasSize(this.props);let r=Object.create(this.props);Object.assign(r,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),this.animationLoop.setProps(r),this.layerManager&&(this.viewManager.setProps(r),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(r),this.effectManager.setProps(r),this.deckRenderer.setProps(r),this.deckPicker.setProps(r)),this.stats.get(\"setProps Time\").timeEnd()}needsRedraw(t={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return\"Deck._animate\";let r=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);let i=this.viewManager.needsRedraw(t),s=this.layerManager.needsRedraw(t),n=this.effectManager.needsRedraw(t),o=this.deckRenderer.needsRedraw(t);return r=r||i||s||n||o,r}redraw(t){if(!this.layerManager)return;let r=this.needsRedraw({clearRedrawFlags:!0});r=t||r,r&&(this.stats.get(\"Redraw Count\").incrementCount(),this.props._customRender?this.props._customRender(r):this._drawLayers(r))}get isInitialized(){return this.viewManager!==null}getViews(){return _r(this.viewManager),this.viewManager.views}getViewports(t){return _r(this.viewManager),this.viewManager.getViewports(t)}getCanvas(){return this.canvas}pickObject(t){let r=this._pick(\"pickObject\",\"pickObject Time\",t).result;return r.length?r[0]:null}pickMultipleObjects(t){return t.depth=t.depth||10,this._pick(\"pickObject\",\"pickMultipleObjects Time\",t).result}pickObjects(t){return this._pick(\"pickObjects\",\"pickObjects Time\",t)}_addResources(t,r=!1){for(let i in t)this.layerManager.resourceManager.add({resourceId:i,data:t[i],forceUpdate:r})}_removeResources(t){for(let r of t)this.layerManager.resourceManager.remove(r)}_addDefaultEffect(t){this.effectManager.addDefaultEffect(t)}_pick(t,r,i){_r(this.deckPicker);let{stats:s}=this;s.get(\"Pick Count\").incrementCount(),s.get(r).timeStart();let n=this.deckPicker[t]({layers:this.layerManager.getLayers(i),views:this.viewManager.getViews(),viewports:this.getViewports(i),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...i});return s.get(r).timeEnd(),n}_createCanvas(t){let r=t.canvas;return typeof r==\"string\"&&(r=document.getElementById(r),_r(r)),r||(r=document.createElement(\"canvas\"),r.id=t.id||\"deckgl-overlay\",(t.parent||document.body).appendChild(r)),Object.assign(r.style,t.style),r}_setCanvasSize(t){if(!this.canvas)return;let{width:r,height:i}=t;if(r||r===0){let n=Number.isFinite(r)?\"\".concat(r,\"px\"):r;this.canvas.style.width=n}if(i||i===0){var s;let n=Number.isFinite(i)?\"\".concat(i,\"px\"):i;this.canvas.style.position=((s=t.style)===null||s===void 0?void 0:s.position)||\"absolute\",this.canvas.style.height=n}}_updateCanvasSize(){var t,r;let{canvas:i}=this;if(!i)return;let s=(t=i.clientWidth)!==null&&t!==void 0?t:i.width,n=(r=i.clientHeight)!==null&&r!==void 0?r:i.height;if(s!==this.width||n!==this.height){var o,c;this.width=s,this.height=n,(o=this.viewManager)===null||o===void 0||o.setProps({width:s,height:n}),(c=this.layerManager)===null||c===void 0||c.activateViewport(this.getViewports()[0]),this.props.onResize({width:s,height:n})}}_createAnimationLoop(t){let{width:r,height:i,gl:s,glOptions:n,debug:o,onError:c,onBeforeRender:f,onAfterRender:_,useDevicePixels:w}=t;return new rg({width:r,height:i,useDevicePixels:w,autoResizeDrawingBuffer:!s,autoResizeViewport:!1,gl:s,onCreateContext:I=>Ty({...n,...I,canvas:this.canvas,debug:o,onContextLost:()=>this._onContextLost()}),onInitialize:I=>this._setGLContext(I.gl),onRender:this._onRenderFrame.bind(this),onBeforeRender:f,onAfterRender:_,onError:c})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let t=this.props.views||[new Xy({id:\"default-view\"})];return t=Array.isArray(t)?t:[t],t.length&&this.props.controller&&(t[0].props.controller=this.props.controller),t}_onContextLost(){let{onError:t}=this.props;this.animationLoop&&t&&t(new Error(\"WebGL context is lost\"))}_pickAndCallback(){let{_pickRequest:t}=this;if(t.event){let{result:i,emptyInfo:s}=this._pick(\"pickObject\",\"pickObject Time\",t);this.cursorState.isHovering=i.length>0;let n=s,o=!1;for(let c of i){var r;n=c,o=((r=c.layer)===null||r===void 0?void 0:r.onHover(c,t.event))||o}if(!o&&this.props.onHover&&this.props.onHover(n,t.event),this.props.getTooltip&&this.tooltip){let c=this.props.getTooltip(n);this.tooltip.setTooltip(c,n.x,n.y)}t.event=null}}_updateCursor(){let t=this.props.parent||this.canvas;t&&(t.style.cursor=this.props.getCursor(this.cursorState))}_setGLContext(t){if(this.layerManager)return;this.canvas||(this.canvas=t.canvas,q0(t,{enable:!0,copyState:!0})),this.tooltip=new Jb(this.canvas),Ml(t,{blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onWebGLInitialized(t);let r=new KA;r.play(),this.animationLoop.attachTimeline(r),this.eventManager=new Jy(this.props.parent||t.canvas,{touchAction:this.props.touchAction,recognizerOptions:this.props.eventRecognizerOptions,events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(let s in nR)this.eventManager.on(s,this._onEvent);this.viewManager=new Wb({timeline:r,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});let i=this.viewManager.getViewports()[0];this.layerManager=new Gb(t,{deck:this,stats:this.stats,viewport:i,timeline:r}),this.effectManager=new Qb,this.deckRenderer=new Xb(t),this.deckPicker=new Kb(t),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(t,r){let{gl:i}=this.layerManager.context;Ml(i,this.props.parameters),this.props.onBeforeRender({gl:i}),this.deckRenderer.renderLayers({target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:\"screen\",effects:this.effectManager.getEffects(),...r}),this.props.onAfterRender({gl:i})}_onRenderFrame(t){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),or.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.tooltip.isVisible&&this.viewManager.needsRedraw()&&this.tooltip.setTooltip(null),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(t){let r=this.props.onViewStateChange(t)||t.viewState;this.viewState&&(this.viewState={...this.viewState,[t.viewId]:r},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(t){this.cursorState.isDragging=t.isDragging||!1,this.props.onInteractionStateChange(t)}_getFrameStats(){let{stats:t}=this;t.get(\"frameRate\").timeEnd(),t.get(\"frameRate\").timeStart();let r=this.animationLoop.stats;t.get(\"GPU Time\").addTime(r.get(\"GPU Time\").lastTiming),t.get(\"CPU Time\").addTime(r.get(\"CPU Time\").lastTiming)}_getMetrics(){let{metrics:t,stats:r}=this;t.fps=r.get(\"frameRate\").getHz(),t.setPropsTime=r.get(\"setProps Time\").time,t.updateAttributesTime=r.get(\"Update Attributes\").time,t.framesRedrawn=r.get(\"Redraw Count\").count,t.pickTime=r.get(\"pickObject Time\").time+r.get(\"pickMultipleObjects Time\").time+r.get(\"pickObjects Time\").time,t.pickCount=r.get(\"Pick Count\").count,t.gpuTime=r.get(\"GPU Time\").time,t.cpuTime=r.get(\"CPU Time\").time,t.gpuTimePerFrame=r.get(\"GPU Time\").getAverageTime(),t.cpuTimePerFrame=r.get(\"CPU Time\").getAverageTime();let i=Du.get(\"Memory Usage\");t.bufferMemory=i.get(\"Buffer Memory\").count,t.textureMemory=i.get(\"Texture Memory\").count,t.renderbufferMemory=i.get(\"Renderbuffer Memory\").count,t.gpuMemory=i.get(\"GPU Memory\").count}};G(cp,\"defaultProps\",qG);G(cp,\"VERSION\",xV);var gg=class{constructor(t,r){G(this,\"opts\",void 0),G(this,\"source\",void 0),this.opts=r,this.source=t}get value(){return this.source.value}getValue(){let t=this.source.getBuffer(),r=this.getAccessor();if(t)return[t,r];let{value:i}=this.source,{size:s}=r,n=i;if(i&&i.length!==s){n=new Float32Array(s);let o=r.elementOffset||0;for(let c=0;c=n){let o=new Array(s).fill(1/0),c=new Array(s).fill(-1/0);for(let f=0;fc[_]&&(c[_]=w)}t=[o,c]}}return this.state.bounds=t,t}setData(t){let{state:r}=this,i;ArrayBuffer.isView(t)?i={value:t}:t instanceof Fr?i={buffer:t}:i=t;let s={...this.settings,...i};if(r.bufferAccessor=s,r.bounds=null,i.constant){let n=i.value;if(n=this._normalizeValue(n,[],0),this.settings.normalized&&(n=this.normalizeConstant(n)),!(!r.constant||!this._areValuesEqual(n,this.value)))return!1;r.externalBuffer=null,r.constant=!0,this.value=n}else if(i.buffer){let n=i.buffer;r.externalBuffer=n,r.constant=!1,this.value=i.value||null;let o=i.value instanceof Float64Array;s.type=i.type||n.accessor.type,s.bytesPerElement=n.accessor.BYTES_PER_ELEMENT*(o?2:1),s.stride=lP(s)}else if(i.value){this._checkExternalBuffer(i);let n=i.value;r.externalBuffer=null,r.constant=!1,this.value=n,s.bytesPerElement=n.BYTES_PER_ELEMENT,s.stride=lP(s);let{buffer:o,byteOffset:c}=this;this.doublePrecision&&n instanceof Float64Array&&(n=iP(n,s));let f=n.byteLength+c+s.stride*2;o.byteLength(r+128)/255*2-1);case 5122:return new Float32Array(t).map(r=>(r+32768)/65535*2-1);case 5121:return new Float32Array(t).map(r=>r/255);case 5123:return new Float32Array(t).map(r=>r/65535);default:return t}}_normalizeValue(t,r,i){let{defaultValue:s,size:n}=this.settings;if(Number.isFinite(t))return r[i]=t,r;if(!t){let o=n;for(;--o>=0;)r[i+o]=s[o];return r}switch(n){case 4:r[i+3]=Number.isFinite(t[3])?t[3]:s[3];case 3:r[i+2]=Number.isFinite(t[2])?t[2]:s[2];case 2:r[i+1]=Number.isFinite(t[1])?t[1]:s[1];case 1:r[i+0]=Number.isFinite(t[0])?t[0]:s[0];break;default:let o=n;for(;--o>=0;)r[i+o]=Number.isFinite(t[o])?t[o]:s[o]}return r}_areValuesEqual(t,r){if(!t||!r)return!1;let{size:i}=this;for(let s=0;s0&&($G.length=e.length,i=$G):i=QG,(t>0||Number.isFinite(r))&&(i=(Array.isArray(i)?i:Array.from(i)).slice(t,r),s.index=t-1),{iterable:i,objectInfo:s}}function cP(e){return e&&e[Symbol.asyncIterator]}function uP(e,t){let{size:r,stride:i,offset:s,startIndices:n,nested:o}=t,c=e.BYTES_PER_ELEMENT,f=i?i/c:r,_=s?s/c:0,w=Math.floor((e.length-_)/f);return(I,{index:R,target:N})=>{if(!n){let Y=R*f+_;for(let K=0;K=t[1]))return e;let r=[],i=e.length,s=0;for(let n=0;nt[1]?r.push(o):t=[Math.min(o[0],t[0]),Math.max(o[1],t[1])]}return r.splice(s,0,t),r}function ID(e){let{source:t,target:r,start:i=0,size:s,getData:n}=e,o=e.end||r.length,c=t.length,f=o-i;if(c>f){r.set(t.subarray(0,f),i);return}if(r.set(t,i),!n)return;let _=c;for(;_i(w+c,I)),_=Math.min(s.length,n.length);for(let w=1;w<_;w++){let I=s[w]*r,R=n[w]*r;ID({source:e.subarray(o,I),target:t,start:c,end:R,size:r,getData:f}),o=I,c=R}return ce},spring:{stiffness:.05,damping:.5}};function hP(e,t){if(!e)return null;Number.isFinite(e)&&(e={type:\"interpolation\",duration:e});let r=e.type||\"interpolation\";return{...Sct[r],...t,...e,type:r}}function fP(e,t){let r=t.getBuffer();return r?[r,{divisor:0,size:t.size,normalized:t.settings.normalized}]:t.value}function dP(e){switch(e){case 1:return\"float\";case 2:return\"vec2\";case 3:return\"vec3\";case 4:return\"vec4\";default:throw new Error('No defined attribute type for size \"'.concat(e,'\"'))}}function pP(e){e.push(e.shift())}function aw(e,t){let{doublePrecision:r,settings:i,value:s,size:n}=e,o=r&&s instanceof Float64Array?2:1;return(i.noAlloc?s.length:t*n)*o}function AP({buffer:e,numInstances:t,attribute:r,fromLength:i,fromStartIndices:s,getData:n=o=>o}){let o=r.doublePrecision&&r.value instanceof Float64Array?2:1,c=r.size*o,f=r.byteOffset,_=r.startIndices,w=s&&_,I=aw(r,t),R=r.isConstant;if(!w&&i>=I)return;let N=R?r.value:r.getBuffer().getData({srcByteOffset:f});if(r.settings.normalized&&!R){let Y=n;n=(K,J)=>r.normalizeConstant(Y(K,J))}let j=R?(Y,K)=>n(N,K):(Y,K)=>n(N.subarray(Y,Y+c),K),Q=e.getData({length:i}),et=new Float32Array(I);JG({source:Q,target:et,sourceStartIndices:s,targetStartIndices:_,size:c,getData:j}),e.byteLengtht[n])]:t[r];return hP(s,i)}setNeedsUpdate(t=this.id,r){if(this.state.needsUpdate=this.state.needsUpdate||t,this.setNeedsRedraw(t),r){let{startRow:i=0,endRow:s=1/0}=r;this.state.updateRanges=KG(this.state.updateRanges,[i,s])}else this.state.updateRanges=ow}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=XG}setNeedsRedraw(t=this.id){this.state.needsRedraw=this.state.needsRedraw||t}allocate(t){let{state:r,settings:i}=this;return i.noAlloc?!1:i.update?(super.allocate(t,r.updateRanges!==ow),!0):!1}updateBuffer({numInstances:t,data:r,props:i,context:s}){if(!this.needsUpdate())return!1;let{state:{updateRanges:n},settings:{update:o,noAlloc:c}}=this,f=!0;if(o){for(let[_,w]of n)o.call(s,this,{data:r,startRow:_,endRow:w,props:i,numInstances:t});if(this.value)if(this.constant||this.buffer.byteLengthw?_.set(J,Q):(t._normalizeValue(J,Y.target,0),xD({target:_,source:Y.target,start:Q,count:ut}));Q+=ut*w}else t._normalizeValue(J,_,Q),Q+=w}}_validateAttributeUpdaters(){let{settings:t}=this;if(!(t.noAlloc||typeof t.update==\"function\"))throw new Error(\"Attribute \".concat(this.id,\" missing update or accessor\"))}_checkAttributeArray(){let{value:t}=this,r=Math.min(4,this.size);if(t&&t.length>=r){let i=!0;switch(r){case 4:i=i&&Number.isFinite(t[3]);case 3:i=i&&Number.isFinite(t[2]);case 2:i=i&&Number.isFinite(t[1]);case 1:i=i&&Number.isFinite(t[0]);break;default:i=!1}if(!i)throw new Error(\"Illegal attribute generated for \".concat(this.id))}}};var lw=class{constructor({gl:t,attribute:r,timeline:i}){G(this,\"gl\",void 0),G(this,\"type\",\"interpolation\"),G(this,\"attributeInTransition\",void 0),G(this,\"settings\",void 0),G(this,\"attribute\",void 0),G(this,\"transition\",void 0),G(this,\"currentStartIndices\",void 0),G(this,\"currentLength\",void 0),G(this,\"transform\",void 0),G(this,\"buffers\",void 0),this.gl=t,this.transition=new Kc(i),this.attribute=r,this.attributeInTransition=new up(t,r.settings),this.currentStartIndices=r.startIndices,this.currentLength=0,this.transform=Mct(t,r);let s={byteLength:0,usage:35050};this.buffers=[new Fr(t,s),new Fr(t,s)]}get inProgress(){return this.transition.inProgress}start(t,r){if(t.duration<=0){this.transition.cancel();return}this.settings=t;let{gl:i,buffers:s,attribute:n}=this;pP(s);let o={numInstances:r,attribute:n,fromLength:this.currentLength,fromStartIndices:this.currentStartIndices,getData:t.enter};for(let c of s)AP({buffer:c,...o});this.currentStartIndices=n.startIndices,this.currentLength=aw(n,r),this.attributeInTransition.setData({buffer:s[1],value:n.value}),this.transition.start(t),this.transform.update({elementCount:Math.floor(this.currentLength/n.size),sourceBuffers:{aFrom:s[0],aTo:fP(i,n)},feedbackBuffers:{vCurrent:s[1]}})}update(){let t=this.transition.update();if(t){let{duration:r,easing:i}=this.settings,{time:s}=this.transition,n=s/r;i&&(n=i(n)),this.transform.run({uniforms:{time:n}})}return t}cancel(){this.transition.cancel(),this.transform.delete();for(let t of this.buffers)t.delete();this.buffers.length=0}},Tct=`\n#define SHADER_NAME interpolation-transition-vertex-shader\n\nuniform float time;\nattribute ATTRIBUTE_TYPE aFrom;\nattribute ATTRIBUTE_TYPE aTo;\nvarying ATTRIBUTE_TYPE vCurrent;\n\nvoid main(void) {\n vCurrent = mix(aFrom, aTo, time);\n gl_Position = vec4(0.0);\n}\n`;function Mct(e,t){let r=dP(t.size);return new nc(e,{vs:Tct,defines:{ATTRIBUTE_TYPE:r},varyings:[\"vCurrent\"]})}var cw=class{constructor({gl:t,attribute:r,timeline:i}){G(this,\"gl\",void 0),G(this,\"type\",\"spring\"),G(this,\"attributeInTransition\",void 0),G(this,\"settings\",void 0),G(this,\"attribute\",void 0),G(this,\"transition\",void 0),G(this,\"currentStartIndices\",void 0),G(this,\"currentLength\",void 0),G(this,\"texture\",void 0),G(this,\"framebuffer\",void 0),G(this,\"transform\",void 0),G(this,\"buffers\",void 0),this.gl=t,this.type=\"spring\",this.transition=new Kc(i),this.attribute=r,this.attributeInTransition=new up(t,{...r.settings,normalized:!1}),this.currentStartIndices=r.startIndices,this.currentLength=0,this.texture=Pct(t),this.framebuffer=Ict(t,this.texture),this.transform=Ect(t,r,this.framebuffer);let s={byteLength:0,usage:35050};this.buffers=[new Fr(t,s),new Fr(t,s),new Fr(t,s)]}get inProgress(){return this.transition.inProgress}start(t,r){let{gl:i,buffers:s,attribute:n}=this,o={numInstances:r,attribute:n,fromLength:this.currentLength,fromStartIndices:this.currentStartIndices,getData:t.enter};for(let c of s)AP({buffer:c,...o});this.settings=t,this.currentStartIndices=n.startIndices,this.currentLength=aw(n,r),this.attributeInTransition.setData({buffer:s[1],value:n.value}),this.transition.start({...t,duration:1/0}),this.transform.update({elementCount:Math.floor(this.currentLength/n.size),sourceBuffers:{aTo:fP(i,n)}})}update(){let{buffers:t,transform:r,framebuffer:i,transition:s}=this;if(!s.update())return!1;let o=this.settings;return r.update({sourceBuffers:{aPrev:t[0],aCur:t[1]},feedbackBuffers:{vNext:t[2]}}),r.run({framebuffer:i,discard:!1,clearRenderTarget:!0,uniforms:{stiffness:o.stiffness,damping:o.damping},parameters:{depthTest:!1,blend:!0,viewport:[0,0,1,1],blendFunc:[1,1],blendEquation:[32776,32776]}}),pP(t),this.attributeInTransition.setData({buffer:t[1],value:this.attribute.value}),Dh(i)[0]>0||s.end(),!0}cancel(){this.transition.cancel(),this.transform.delete();for(let t of this.buffers)t.delete();this.buffers.length=0,this.texture.delete(),this.framebuffer.delete()}};function Ect(e,t,r){let i=dP(t.size);return new nc(e,{framebuffer:r,vs:`\n#define SHADER_NAME spring-transition-vertex-shader\n\n#define EPSILON 0.00001\n\nuniform float stiffness;\nuniform float damping;\nattribute ATTRIBUTE_TYPE aPrev;\nattribute ATTRIBUTE_TYPE aCur;\nattribute ATTRIBUTE_TYPE aTo;\nvarying ATTRIBUTE_TYPE vNext;\nvarying float vIsTransitioningFlag;\n\nATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) {\n ATTRIBUTE_TYPE velocity = cur - prev;\n ATTRIBUTE_TYPE delta = dest - cur;\n ATTRIBUTE_TYPE spring = delta * stiffness;\n ATTRIBUTE_TYPE damper = velocity * -1.0 * damping;\n return spring + damper + velocity + cur;\n}\n\nvoid main(void) {\n bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON;\n vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0;\n\n vNext = getNextValue(aCur, aPrev, aTo);\n gl_Position = vec4(0, 0, 0, 1);\n gl_PointSize = 100.0;\n}\n`,fs:`\n#define SHADER_NAME spring-transition-is-transitioning-fragment-shader\n\nvarying float vIsTransitioningFlag;\n\nvoid main(void) {\n if (vIsTransitioningFlag == 0.0) {\n discard;\n }\n gl_FragColor = vec4(1.0);\n}`,defines:{ATTRIBUTE_TYPE:i},varyings:[\"vNext\"]})}function Pct(e){return new pi(e,{data:new Uint8Array(4),format:6408,type:5121,border:0,mipmaps:!1,dataFormat:6408,width:1,height:1})}function Ict(e,t){return new yi(e,{id:\"spring-transition-is-transitioning-framebuffer\",width:1,height:1,attachments:{36064:t}})}var Cct={interpolation:lw,spring:cw},uw=class{constructor(t,{id:r,timeline:i}){G(this,\"id\",void 0),G(this,\"isSupported\",void 0),G(this,\"gl\",void 0),G(this,\"timeline\",void 0),G(this,\"transitions\",void 0),G(this,\"needsRedraw\",void 0),G(this,\"numInstances\",void 0),this.id=r,this.gl=t,this.timeline=i,this.transitions={},this.needsRedraw=!1,this.numInstances=1,this.isSupported=nc.isSupported(t)}finalize(){for(let t in this.transitions)this._removeTransition(t)}update({attributes:t,transitions:r,numInstances:i}){this.numInstances=i||1;for(let s in t){let n=t[s],o=n.getTransitionSetting(r);o&&this._updateAttribute(s,n,o)}for(let s in this.transitions){let n=t[s];(!n||!n.getTransitionSetting(r))&&this._removeTransition(s)}}hasAttribute(t){let r=this.transitions[t];return r&&r.inProgress}getAttributes(){let t={};for(let r in this.transitions){let i=this.transitions[r];i.inProgress&&(t[r]=i.attributeInTransition)}return t}run(){if(!this.isSupported||this.numInstances===0)return!1;for(let r in this.transitions)this.transitions[r].update()&&(this.needsRedraw=!0);let t=this.needsRedraw;return this.needsRedraw=!1,t}_removeTransition(t){this.transitions[t].cancel(),delete this.transitions[t]}_updateAttribute(t,r,i){let s=this.transitions[t],n=!s||s.type!==i.type;if(n){if(!this.isSupported){or.warn(\"WebGL2 not supported by this browser. Transition for \".concat(t,\" is disabled.\"))();return}s&&this._removeTransition(t);let o=Cct[i.type];o?this.transitions[t]=new o({attribute:r,timeline:this.timeline,gl:this.gl}):(or.error(\"unsupported transition type '\".concat(i.type,\"'\"))(),n=!1)}(n||r.needsRedraw())&&(this.needsRedraw=!0,this.transitions[t].start(i,this.numInstances))}};var t9=\"attributeManager.invalidate\",Lct=\"attributeManager.updateStart\",kct=\"attributeManager.updateEnd\",Rct=\"attribute.updateStart\",Dct=\"attribute.allocate\",Oct=\"attribute.updateEnd\",Xf=class{constructor(t,{id:r=\"attribute-manager\",stats:i,timeline:s}={}){G(this,\"id\",void 0),G(this,\"gl\",void 0),G(this,\"attributes\",void 0),G(this,\"updateTriggers\",void 0),G(this,\"needsRedraw\",void 0),G(this,\"userData\",void 0),G(this,\"stats\",void 0),G(this,\"attributeTransitionManager\",void 0),G(this,\"mergeBoundsMemoized\",Yf(dG)),this.id=r,this.gl=t,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=i,this.attributeTransitionManager=new uw(t,{id:\"\".concat(r,\"-transitions\"),timeline:s}),Object.seal(this)}finalize(){for(let t in this.attributes)this.attributes[t].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(t={clearRedrawFlags:!1}){let r=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!t.clearRedrawFlags,r&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(t){this._add(t)}addInstanced(t){this._add(t,{instanced:1})}remove(t){for(let r of t)this.attributes[r]!==void 0&&(this.attributes[r].delete(),delete this.attributes[r])}invalidate(t,r){let i=this._invalidateTrigger(t,r);Ls(t9,this,t,i)}invalidateAll(t){for(let r in this.attributes)this.attributes[r].setNeedsUpdate(r,t);Ls(t9,this,\"all\")}update({data:t,numInstances:r,startIndices:i=null,transitions:s,props:n={},buffers:o={},context:c={}}){let f=!1;Ls(Lct,this),this.stats&&this.stats.get(\"Update Attributes\").timeStart();for(let _ in this.attributes){let w=this.attributes[_],I=w.settings.accessor;w.startIndices=i,w.numInstances=r,n[_]&&or.removed(\"props.\".concat(_),\"data.attributes.\".concat(_))(),w.setExternalBuffer(o[_])||w.setBinaryValue(typeof I==\"string\"?o[I]:void 0,t.startIndices)||typeof I==\"string\"&&!o[I]&&w.setConstantValue(n[I])||w.needsUpdate()&&(f=!0,this._updateAttribute({attribute:w,numInstances:r,data:t,props:n,context:c})),this.needsRedraw=this.needsRedraw||w.needsRedraw()}f&&Ls(kct,this,r),this.stats&&this.stats.get(\"Update Attributes\").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:r,transitions:s})}updateTransition(){let{attributeTransitionManager:t}=this,r=t.run();return this.needsRedraw=this.needsRedraw||r,r}getAttributes(){return this.attributes}getBounds(t){let r=t.map(i=>{var s;return(s=this.attributes[i])===null||s===void 0?void 0:s.getBounds()});return this.mergeBoundsMemoized(r)}getChangedAttributes(t={clearChangedFlags:!1}){let{attributes:r,attributeTransitionManager:i}=this,s={...i.getAttributes()};for(let n in r){let o=r[n];o.needsRedraw(t)&&!i.hasAttribute(n)&&(s[n]=o)}return s}getShaderAttributes(t,r={}){t||(t=this.getAttributes());let i={};for(let s in t)r[s]||Object.assign(i,t[s].getShaderAttributes());return i}_add(t,r={}){for(let i in t){let s=t[i];this.attributes[i]=this._createAttribute(i,s,r)}this._mapUpdateTriggersToAttributes()}_createAttribute(t,r,i){let s={...r,id:t,size:r.isIndexed&&1||r.size||1,divisor:i.instanced?1:r.divisor||0};return new up(this.gl,s)}_mapUpdateTriggersToAttributes(){let t={};for(let r in this.attributes)this.attributes[r].getUpdateTriggers().forEach(s=>{t[s]||(t[s]=[]),t[s].push(r)});this.updateTriggers=t}_invalidateTrigger(t,r){let{attributes:i,updateTriggers:s}=this,n=s[t];return n&&n.forEach(o=>{let c=i[o];c&&c.setNeedsUpdate(c.id,r)}),n}_updateAttribute(t){let{attribute:r,numInstances:i}=t;if(Ls(Rct,r),r.constant){r.setConstantValue(r.value);return}r.allocate(i)&&Ls(Dct,r,i),r.updateBuffer(t)&&(this.needsRedraw=!0,Ls(Oct,r,i))}};var hw=class extends Kc{get value(){return this._value}_onUpdate(){let{time:t,settings:{fromValue:r,toValue:i,duration:s,easing:n}}=this,o=n(t/s);this._value=il(r,i,o)}};var e9=1e-5;function r9(e,t,r,i,s){let n=t-e,c=(r-t)*s,f=-n*i;return c+f+n+t}function Bct(e,t,r,i,s){if(Array.isArray(r)){let n=[];for(let o=0;o0}add(t,r,i,s){let{transitions:n}=this;if(n.has(t)){let f=n.get(t),{value:_=f.settings.fromValue}=f;r=_,this.remove(t)}if(s=hP(s),!s)return;let o=Fct[s.type];if(!o){or.error(\"unsupported transition type '\".concat(s.type,\"'\"))();return}let c=new o(this.timeline);c.start({...s,fromValue:r,toValue:i}),n.set(t,c)}remove(t){let{transitions:r}=this;r.has(t)&&(r.get(t).cancel(),r.delete(t))}update(){let t={};for(let[r,i]of this.transitions)i.update(),t[r]=i.value,i.inProgress||this.remove(r);return t}clear(){for(let t of this.transitions.keys())this.remove(t)}};function s9(e){let t=e[zu];for(let r in t){let i=t[r],{validate:s}=i;if(s&&!s(e[r],i))throw new Error(\"Invalid prop \".concat(r,\": \").concat(e[r]))}}function o9(e,t){let r=pw({newProps:e,oldProps:t,propTypes:e[zu],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),i=Nct(e,t),s=!1;return i||(s=Uct(e,t)),{dataChanged:i,propsChanged:r,updateTriggersChanged:s,extensionsChanged:Vct(e,t),transitionsChanged:zct(e,t)}}function zct(e,t){if(!e.transitions)return!1;let r={},i=e[zu],s=!1;for(let n in e.transitions){let o=i[n],c=o&&o.type;(c===\"number\"||c===\"color\"||c===\"array\")&&CD(e[n],t[n],o)&&(r[n]=!0,s=!0)}return s?r:!1}function pw({newProps:e,oldProps:t,ignoreProps:r={},propTypes:i={},triggerName:s=\"props\"}){if(t===e)return!1;if(typeof e!=\"object\"||e===null||typeof t!=\"object\"||t===null)return\"\".concat(s,\" changed shallowly\");for(let n of Object.keys(e))if(!(n in r)){if(!(n in t))return\"\".concat(s,\".\").concat(n,\" added\");let o=CD(e[n],t[n],i[n]);if(o)return\"\".concat(s,\".\").concat(n,\" \").concat(o)}for(let n of Object.keys(t))if(!(n in r)){if(!(n in e))return\"\".concat(s,\".\").concat(n,\" dropped\");if(!Object.hasOwnProperty.call(e,n)){let o=CD(e[n],t[n],i[n]);if(o)return\"\".concat(s,\".\").concat(n,\" \").concat(o)}}return!1}function CD(e,t,r){let i=r&&r.equal;return i&&!i(e,t,r)||!i&&(i=e&&t&&e.equals,i&&!i.call(e,t))?\"changed deeply\":!i&&t!==e?\"changed shallowly\":null}function Nct(e,t){if(t===null)return\"oldProps is null, initial diff\";let r=!1,{dataComparator:i,_dataDiff:s}=e;return i?i(e.data,t.data)||(r=\"Data comparator detected a change\"):e.data!==t.data&&(r=\"A new data container was supplied\"),r&&s&&(r=s(e.data,t.data)||r),r}function Uct(e,t){if(t===null)return{all:!0};if(\"all\"in e.updateTriggers&&n9(e,t,\"all\"))return{all:!0};let r={},i=!1;for(let s in e.updateTriggers)s!==\"all\"&&n9(e,t,s)&&(r[s]=!0,i=!0);return i?r:!1}function Vct(e,t){if(t===null)return!0;let r=t.extensions,{extensions:i}=e;if(i===r)return!1;if(!r||!i||i.length!==r.length)return!0;for(let s=0;si.name===\"project64\"))){let i=r.modules.findIndex(s=>s.name===\"project32\");i>=0&&r.modules.splice(i,1)}if(\"inject\"in t)if(!e.inject)r.inject=t.inject;else{let i={...e.inject};for(let s in t.inject)i[s]=(i[s]||\"\")+t.inject[s];r.inject=i}return r}var qct={10241:9987,10240:9729,10242:33071,10243:33071},LD={};function l9(e,t,r,i){if(r instanceof pi)return r;r.constructor&&r.constructor.name!==\"Object\"&&(r={data:r});let s=null;r.compressed&&(s={10241:r.data.length>1?9985:9729});let n=new pi(t,{...r,parameters:{...qct,...s,...i}});return LD[n.id]=e,n}function c9(e,t){!t||!(t instanceof pi)||LD[t.id]===e&&(t.delete(),delete LD[t.id])}var Zct={boolean:{validate(e,t){return!0},equal(e,t,r){return!!e==!!t}},number:{validate(e,t){return Number.isFinite(e)&&(!(\"max\"in t)||e<=t.max)&&(!(\"min\"in t)||e>=t.min)}},color:{validate(e,t){return t.optional&&!e||kD(e)&&(e.length===3||e.length===4)},equal(e,t,r){return mo(e,t,1)}},accessor:{validate(e,t){let r=mP(e);return r===\"function\"||r===mP(t.value)},equal(e,t,r){return typeof t==\"function\"?!0:mo(e,t,1)}},array:{validate(e,t){return t.optional&&!e||kD(e)},equal(e,t,r){let{compare:i}=r,s=Number.isInteger(i)?i:i?1:0;return i?mo(e,t,s):e===t}},object:{equal(e,t,r){if(r.ignore)return!0;let{compare:i}=r,s=Number.isInteger(i)?i:i?1:0;return i?mo(e,t,s):e===t}},function:{validate(e,t){return t.optional&&!e||typeof e==\"function\"},equal(e,t,r){return!r.compare&&r.ignore!==!1||e===t}},data:{transform:(e,t,r)=>{let{dataTransform:i}=r.props;return i&&e?i(e):e}},image:{transform:(e,t,r)=>{let i=r.context;return!i||!i.gl?null:l9(r.id,i.gl,e,{...t.parameters,...r.props.textureParameters})},release:(e,t,r)=>{c9(r.id,e)}}};function u9(e){let t={},r={},i={};for(let[s,n]of Object.entries(e)){let o=n?.deprecatedFor;if(o)i[s]=Array.isArray(o)?o:[o];else{let c=Yct(s,n);t[s]=c,r[s]=c.value}}return{propTypes:t,defaultProps:r,deprecatedProps:i}}function Yct(e,t){switch(mP(t)){case\"object\":return Aw(e,t);case\"array\":return Aw(e,{type:\"array\",value:t,compare:!1});case\"boolean\":return Aw(e,{type:\"boolean\",value:t});case\"number\":return Aw(e,{type:\"number\",value:t});case\"function\":return Aw(e,{type:\"function\",value:t,compare:!0});default:return{name:e,type:\"unknown\",value:t}}}function Aw(e,t){return\"type\"in t?{name:e,...Zct[t.type],...t}:\"value\"in t?{name:e,type:mP(t.value),...t}:{name:e,type:\"object\",value:t}}function kD(e){return Array.isArray(e)||ArrayBuffer.isView(e)}function mP(e){return kD(e)?\"array\":e===null?\"null\":typeof e}function h9(e,t){let r;for(let n=t.length-1;n>=0;n--){let o=t[n];\"extensions\"in o&&(r=o.extensions)}let i=RD(e.constructor,r),s=Object.create(i);s[Qy]=e,s[$f]={},s[Wh]={};for(let n=0;n{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(let t in this.asyncProps){let r=this.asyncProps[t];r&&r.type&&r.type.release&&r.type.release(r.resolvedValue,r.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||iut}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(t){return t in this.asyncProps}getAsyncProp(t){let r=this.asyncProps[t];return r&&r.resolvedValue}isAsyncPropLoading(t){if(t){let r=this.asyncProps[t];return!!(r&&r.pendingLoadCount>0&&r.pendingLoadCount!==r.resolvedLoadCount)}for(let r in this.asyncProps)if(this.isAsyncPropLoading(r))return!0;return!1}reloadAsyncProp(t,r){this._watchPromise(t,Promise.resolve(r))}setAsyncProps(t){this.component=t[Qy]||this.component;let r=t[Wh]||{},i=t[$f]||t,s=t[sp]||{};for(let n in r){let o=r[n];this._createAsyncPropData(n,s[n]),this._updateAsyncProp(n,o),r[n]=this.getAsyncProp(n)}for(let n in i){let o=i[n];this._createAsyncPropData(n,s[n]),this._updateAsyncProp(n,o)}}_fetch(t,r){return null}_onResolve(t,r){}_onError(t,r){}_updateAsyncProp(t,r){if(this._didAsyncInputValueChange(t,r)){if(typeof r==\"string\"&&(r=this._fetch(t,r)),r instanceof Promise){this._watchPromise(t,r);return}if(cP(r)){this._resolveAsyncIterable(t,r);return}this._setPropValue(t,r)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(let t in this.asyncProps)Object.defineProperty(this.oldAsyncProps,t,{enumerable:!0,value:this.oldProps[t]})}}_didAsyncInputValueChange(t,r){let i=this.asyncProps[t];return r===i.resolvedValue||r===i.lastValue?!1:(i.lastValue=r,!0)}_setPropValue(t,r){this._freezeAsyncOldProps();let i=this.asyncProps[t];i&&(r=this._postProcessValue(i,r),i.resolvedValue=r,i.pendingLoadCount++,i.resolvedLoadCount=i.pendingLoadCount)}_setAsyncPropValue(t,r,i){let s=this.asyncProps[t];s&&i>=s.resolvedLoadCount&&r!==void 0&&(this._freezeAsyncOldProps(),s.resolvedValue=r,s.resolvedLoadCount=i,this.onAsyncPropUpdated(t,r))}_watchPromise(t,r){let i=this.asyncProps[t];if(i){i.pendingLoadCount++;let s=i.pendingLoadCount;r.then(n=>{this.component&&(n=this._postProcessValue(i,n),this._setAsyncPropValue(t,n,s),this._onResolve(t,n))}).catch(n=>{this._onError(t,n)})}}async _resolveAsyncIterable(t,r){if(t!==\"data\"){this._setPropValue(t,r);return}let i=this.asyncProps[t];if(!i)return;i.pendingLoadCount++;let s=i.pendingLoadCount,n=[],o=0;for await(let c of r){if(!this.component)return;let{dataTransform:f}=this.component.props;f?n=f(c,n):n=n.concat(c),Object.defineProperty(n,\"__diff\",{enumerable:!1,value:[{startRow:o,endRow:n.length}]}),o=n.length,this._setAsyncPropValue(t,n,s)}this._onResolve(t,n)}_postProcessValue(t,r){let i=t.type;return i&&this.component&&(i.release&&i.release(t.resolvedValue,i,this.component),i.transform)?i.transform(r,i,this.component):r}_createAsyncPropData(t,r){if(!this.asyncProps[t]){let s=this.component&&this.component.props[zu];this.asyncProps[t]={type:s&&s[t],lastValue:null,resolvedValue:r,pendingLoadCount:0,resolvedLoadCount:0}}}};var gw=class extends mw{constructor({attributeManager:t,layer:r}){super(r),G(this,\"attributeManager\",void 0),G(this,\"needsRedraw\",void 0),G(this,\"needsUpdate\",void 0),G(this,\"subLayers\",void 0),G(this,\"usesPickingColorCache\",void 0),G(this,\"hasPickingBuffer\",void 0),G(this,\"changeFlags\",void 0),G(this,\"viewport\",void 0),G(this,\"uniformTransitions\",void 0),G(this,\"propsInTransition\",void 0),this.attributeManager=t,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(t,r){let i=this.layer,s=i?.props.fetch;return s?s(r,{propName:t,layer:i}):super._fetch(t,r)}_onResolve(t,r){let i=this.layer;if(i){let s=i.props.onDataLoad;t===\"data\"&&s&&s(r,{propName:t,layer:i})}}_onError(t,r){let i=this.layer;i&&i.raiseError(r,\"loading \".concat(t,\" of \").concat(this.layer))}};var nut=\"layer.changeFlag\",sut=\"layer.initialize\",out=\"layer.update\",aut=\"layer.finalize\",lut=\"layer.matched\",d9=2**24-1,cut=Object.freeze([]),uut=Yf(({oldViewport:e,viewport:t})=>e.equals(t)),Kf=new Uint8ClampedArray(0),hut={data:{type:\"data\",value:cut,async:!0},dataComparator:{type:\"function\",value:null,optional:!0},_dataDiff:{type:\"function\",value:e=>e&&e.__diff,optional:!0},dataTransform:{type:\"function\",value:null,optional:!0},onDataLoad:{type:\"function\",value:null,optional:!0},onError:{type:\"function\",value:null,optional:!0},fetch:{type:\"function\",value:(e,{propName:t,layer:r,loaders:i,loadOptions:s,signal:n})=>{let{resourceManager:o}=r.context;if(s=s||r.getLoadOptions(),i=i||r.props.loaders,n){var c;s={...s,fetch:{...(c=s)===null||c===void 0?void 0:c.fetch,signal:n}}}let f=o.contains(e);return!f&&!s&&(o.add({resourceId:e,data:jA(e,i),persistent:!1}),f=!0),f?o.subscribe({resourceId:e,onChange:_=>{var w;return(w=r.internalState)===null||w===void 0?void 0:w.reloadAsyncProp(t,_)},consumerId:r.id,requestId:t}):jA(e,i,s)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:\"number\",min:0,max:1,value:1},operation:\"draw\",onHover:{type:\"function\",value:null,optional:!0},onClick:{type:\"function\",value:null,optional:!0},onDragStart:{type:\"function\",value:null,optional:!0},onDrag:{type:\"function\",value:null,optional:!0},onDragEnd:{type:\"function\",value:null,optional:!0},coordinateSystem:Yr.DEFAULT,coordinateOrigin:{type:\"array\",value:[0,0,0],compare:!0},modelMatrix:{type:\"array\",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:\"XYZ\",colorFormat:\"RGBA\",parameters:{type:\"object\",value:{},optional:!0,compare:2},loadOptions:{type:\"object\",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:\"array\",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:\"function\",value:({layerIndex:e})=>[0,-e*100]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:\"accessor\",value:[0,0,128,128]}},dn=class extends _g{constructor(...t){super(...t),G(this,\"internalState\",null),G(this,\"lifecycle\",tm.NO_STATE),G(this,\"context\",void 0),G(this,\"state\",void 0),G(this,\"parent\",null)}static get componentName(){return Object.prototype.hasOwnProperty.call(this,\"layerName\")?this.layerName:\"\"}get root(){let t=this;for(;t.parent;)t=t.parent;return t}toString(){let t=this.constructor.layerName||this.constructor.name;return\"\".concat(t,\"({id: '\").concat(this.props.id,\"'})\")}project(t){_r(this.internalState);let r=this.internalState.viewport||this.context.viewport,i=vD(t,{viewport:r,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[s,n,o]=Hy(i,r.pixelProjectionMatrix);return t.length===2?[s,n]:[s,n,o]}unproject(t){return _r(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(t)}projectPosition(t,r){_r(this.internalState);let i=this.internalState.viewport||this.context.viewport;return mG(t,{viewport:i,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...r})}get isComposite(){return!1}setState(t){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,t),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return this.internalState?!this.internalState.isAsyncPropLoading():!1}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){return this.state&&(this.state.models||this.state.model&&[this.state.model])||[]}setModuleParameters(t){for(let r of this.getModels())r.updateModuleSettings(t)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){let{coordinateSystem:t}=this.props;return t===Yr.DEFAULT||t===Yr.LNGLAT||t===Yr.CARTESIAN}onHover(t,r){return this.props.onHover&&this.props.onHover(t,r)||!1}onClick(t,r){return this.props.onClick&&this.props.onClick(t,r)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(t,r=[]){return r[0]=t+1&255,r[1]=t+1>>8&255,r[2]=t+1>>8>>8&255,r}decodePickingColor(t){_r(t instanceof Uint8Array);let[r,i,s]=t;return r+i*256+s*65536-1}getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&this.state.numInstances!==void 0?this.state.numInstances:a9(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){var t;return(t=this.getAttributeManager())===null||t===void 0?void 0:t.getBounds([\"positions\",\"instancePositions\"])}getShaders(t){for(let r of this.props.extensions)t=tv(t,r.getShaders.call(this,r));return t}shouldUpdateState(t){return t.changeFlags.propsOrDataChanged}updateState(t){let r=this.getAttributeManager(),{dataChanged:i}=t.changeFlags;if(i&&r)if(Array.isArray(i))for(let s of i)r.invalidateAll(s);else r.invalidateAll();if(r){let{props:s}=t,n=this.internalState.hasPickingBuffer,o=Number.isInteger(s.highlightedObjectIndex)||s.pickable||s.extensions.some(c=>c.getNeedsPickingBuffer.call(this,c));if(n!==o){this.internalState.hasPickingBuffer=o;let{pickingColors:c,instancePickingColors:f}=r.attributes,_=c||f;_&&(o&&_.constant&&(_.constant=!1,r.invalidate(_.id)),!_.value&&!o&&(_.constant=!0,_.value=[0,0,0]))}}}finalizeState(t){for(let i of this.getModels())i.delete();let r=this.getAttributeManager();r&&r.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(t){for(let r of this.getModels())r.draw(t)}getPickingInfo({info:t,mode:r,sourceLayer:i}){let{index:s}=t;return s>=0&&Array.isArray(this.props.data)&&(t.object=this.props.data[s]),t}raiseError(t,r){var i,s;if(r&&(t=new Error(\"\".concat(r,\": \").concat(t.message),{cause:t})),!((i=(s=this.props).onError)!==null&&i!==void 0&&i.call(s,t))){var n,o;(n=this.context)===null||n===void 0||(o=n.onError)===null||o===void 0||o.call(n,t,this)}}getNeedsRedraw(t={clearRedrawFlags:!1}){return this._getNeedsRedraw(t)}needsUpdate(){return this.internalState?this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()):!1}hasUniformTransition(){var t;return((t=this.internalState)===null||t===void 0?void 0:t.uniformTransitions.active)||!1}activateViewport(t){if(!this.internalState)return;let r=this.internalState.viewport;this.internalState.viewport=t,(!r||!uut({oldViewport:r,viewport:t}))&&(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(t=\"all\"){let r=this.getAttributeManager();r&&(t===\"all\"?r.invalidateAll():r.invalidate(t))}updateAttributes(t){for(let r of this.getModels())this._setModelAttributes(r,t)}_updateAttributes(){let t=this.getAttributeManager();if(!t)return;let r=this.props,i=this.getNumInstances(),s=this.getStartIndices();t.update({data:r.data,numInstances:i,startIndices:s,props:r,transitions:r.transitions,buffers:r.data.attributes,context:this});let n=t.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(n)}_updateAttributeTransition(){let t=this.getAttributeManager();t&&t.updateTransition()}_updateUniformTransition(){let{uniformTransitions:t}=this.internalState;if(t.active){let r=t.update(),i=Object.create(this.props);for(let s in r)Object.defineProperty(i,s,{value:r[s]});return i}return this.props}calculateInstancePickingColors(t,{numInstances:r}){if(t.constant)return;let i=Math.floor(Kf.length/3);if(this.internalState.usesPickingColorCache=!0,id9&&or.warn(\"Layer has too many data objects. Picking might not be able to distinguish all objects.\")(),Kf=Gh.allocate(Kf,r,{size:3,copy:!0,maxCount:Math.max(r,d9)});let s=Math.floor(Kf.length/3),n=[];for(let o=i;o(or.deprecated(\"layer.state.attributeManager\",\"layer.getAttributeManager()\")(),t)}),this.internalState.uniformTransitions=new dw(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(let r of this.props.extensions)r.initializeState.call(this,this.context,r);this.setChangeFlags({dataChanged:\"init\",propsChanged:\"init\",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(t){Ls(lut,this,this===t);let{state:r,internalState:i}=t;this!==t&&(this.internalState=i,this.state=r,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){let t=this.needsUpdate();if(Ls(out,this,t),!t)return;let r=this.props,i=this.context,s=this.internalState,n=i.viewport,o=this._updateUniformTransition();s.propsInTransition=o,i.viewport=s.viewport||n,this.props=o;try{let c=this._getUpdateParams(),f=this.getModels();if(i.gl)this.updateState(c);else try{this.updateState(c)}catch{}for(let w of this.props.extensions)w.updateState.call(this,c,w);let _=this.getModels()[0]!==f[0];this._postUpdate(c,_)}finally{i.viewport=n,this.props=r,this._clearChangeFlags(),s.needsUpdate=!1,s.resetOldProps()}}_finalize(){Ls(aut,this),this.finalizeState(this.context);for(let t of this.props.extensions)t.finalizeState.call(this,this.context,t)}_drawLayer({moduleParameters:t=null,uniforms:r={},parameters:i={}}){this._updateAttributeTransition();let s=this.props,n=this.context;this.props=this.internalState.propsInTransition||s;let o=this.props.opacity;r.opacity=Math.pow(o,1/2.2);try{t&&this.setModuleParameters(t);let{getPolygonOffset:c}=this.props,f=c&&c(r)||[0,0];Ml(n.gl,{polygonOffset:f}),Mn(n.gl,i,()=>{let _={moduleParameters:t,uniforms:r,parameters:i,context:n};for(let w of this.props.extensions)w.draw.call(this,_,w);this.draw(_)})}finally{this.props=s}}getChangeFlags(){var t;return(t=this.internalState)===null||t===void 0?void 0:t.changeFlags}setChangeFlags(t){if(!this.internalState)return;let{changeFlags:r}=this.internalState;for(let s in t)if(t[s]){let n=!1;switch(s){case\"dataChanged\":let o=t[s],c=r[s];o&&Array.isArray(c)&&(r.dataChanged=Array.isArray(o)?c.concat(o):o,n=!0);default:r[s]||(r[s]=t[s],n=!0)}n&&Ls(nut,this,s,t)}let i=!!(r.dataChanged||r.updateTriggersChanged||r.propsChanged||r.extensionsChanged);r.propsOrDataChanged=i,r.somethingChanged=i||r.viewportChanged||r.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(t,r){let i=o9(t,r);if(i.updateTriggersChanged)for(let n in i.updateTriggersChanged)i.updateTriggersChanged[n]&&this.invalidateAttribute(n);if(i.transitionsChanged)for(let n in i.transitionsChanged){var s;this.internalState.uniformTransitions.add(n,r[n],t[n],(s=t.transitions)===null||s===void 0?void 0:s[n])}return this.setChangeFlags(i)}validateProps(){s9(this.props)}updateAutoHighlight(t){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(t)}_updateAutoHighlight(t){let r={pickingSelectedColor:t.picked?t.color:null},{highlightColor:i}=this.props;t.picked&&typeof i==\"function\"&&(r.pickingHighlightColor=i(t)),this.setModuleParameters(r),this.setNeedsRedraw()}_getAttributeManager(){let t=this.context;return new Xf(t.gl,{id:this.props.id,stats:t.stats,timeline:t.timeline})}_postUpdate(t,r){let{props:i,oldProps:s}=t;this.setNeedsRedraw(),this._updateAttributes();let{model:n}=this.state;n?.setInstanceCount(this.getNumInstances());let{autoHighlight:o,highlightedObjectIndex:c,highlightColor:f}=i;if(r||s.autoHighlight!==o||s.highlightedObjectIndex!==c||s.highlightColor!==f){let _={};o||(_.pickingSelectedColor=null),Array.isArray(f)&&(_.pickingHighlightColor=f),(r||c!==s.highlightedObjectIndex)&&(_.pickingSelectedColor=Number.isFinite(c)&&c>=0?this.encodePickingColor(c):null),this.setModuleParameters(_)}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(t){if(!this.internalState)return!1;let r=!1;r=r||this.internalState.needsRedraw&&this.id;let i=this.getAttributeManager(),s=i?i.getNeedsRedraw(t):!1;if(r=r||s,r)for(let n of this.props.extensions)n.onNeedsRedraw.call(this,n);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!t.clearRedrawFlags,r}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}};G(dn,\"defaultProps\",hut);G(dn,\"layerName\",\"Layer\");var fut=\"compositeLayer.renderLayers\",Ni=class extends dn{get isComposite(){return!0}get isLoaded(){return super.isLoaded&&this.getSubLayers().every(t=>t.isLoaded)}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(t){}setState(t){super.setState(t),this.setNeedsUpdate()}getPickingInfo({info:t}){let{object:r}=t;return r&&r.__source&&r.__source.parent&&r.__source.parent.id===this.id&&(t.object=r.__source.object,t.index=r.__source.index),t}filterSubLayer(t){return!0}shouldRenderSubLayer(t,r){return r&&r.length}getSubLayerClass(t,r){let{_subLayerProps:i}=this.props;return i&&i[t]&&i[t].type||r}getSubLayerRow(t,r,i){return t.__source={parent:this,object:r,index:i},t}getSubLayerAccessor(t){if(typeof t==\"function\"){let r={index:-1,data:this.props.data,target:[]};return(i,s)=>i&&i.__source?(r.index=i.__source.index,t(i.__source.object,r)):t(i,s)}return t}getSubLayerProps(t={}){var r;let{opacity:i,pickable:s,visible:n,parameters:o,getPolygonOffset:c,highlightedObjectIndex:f,autoHighlight:_,highlightColor:w,coordinateSystem:I,coordinateOrigin:R,wrapLongitude:N,positionFormat:j,modelMatrix:Q,extensions:et,fetch:Y,operation:K,_subLayerProps:J}=this.props,ut={id:\"\",updateTriggers:{},opacity:i,pickable:s,visible:n,parameters:o,getPolygonOffset:c,highlightedObjectIndex:f,autoHighlight:_,highlightColor:w,coordinateSystem:I,coordinateOrigin:R,wrapLongitude:N,positionFormat:j,modelMatrix:Q,extensions:et,fetch:Y,operation:K},Et=J&&t.id&&J[t.id],kt=Et&&Et.updateTriggers,Xt=t.id||\"sublayer\";if(Et){let qt=this.props[zu],le=t.type?t.type._propTypes:{};for(let ue in Et){let De=le[ue]||qt[ue];De&&De.type===\"accessor\"&&(Et[ue]=this.getSubLayerAccessor(Et[ue]))}}Object.assign(ut,t,Et),ut.id=\"\".concat(this.props.id,\"-\").concat(Xt),ut.updateTriggers={all:(r=this.props.updateTriggers)===null||r===void 0?void 0:r.all,...t.updateTriggers,...kt};for(let qt of et){let le=qt.getSubLayerProps.call(this,qt);le&&Object.assign(ut,le,{updateTriggers:Object.assign(ut.updateTriggers,le.updateTriggers)})}return ut}_updateAutoHighlight(t){for(let r of this.getSubLayers())r.updateAutoHighlight(t)}_getAttributeManager(){return null}_postUpdate(t,r){let i=this.internalState.subLayers,s=!i||this.needsUpdate();if(s){let n=this.renderLayers();i=op(n,Boolean),this.internalState.subLayers=i}Ls(fut,this,s,i);for(let n of i)n.parent=this}};G(Ni,\"layerName\",\"CompositeLayer\");var gP=Math.PI/180,p9=180/Math.PI,_P=6370972,ev=256;function dut(){let e=ev/_P,t=Math.PI/180*ev;return{unitsPerMeter:[e,e,e],unitsPerMeter2:[0,0,0],metersPerUnit:[1/e,1/e,1/e],unitsPerDegree:[t,t,e],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/t,1/t,1/e]}}var rv=class extends ac{constructor(t={}){let{latitude:r=0,longitude:i=0,zoom:s=0,nearZMultiplier:n=.1,farZMultiplier:o=2,resolution:c=10}=t,{height:f,altitude:_=1.5}=t;f=f||1,_=Math.max(.75,_);let w=new En().lookAt({eye:[0,-_,0],up:[0,0,1]}),I=Math.pow(2,s);w.rotateX(r*gP),w.rotateZ(-i*gP),w.scale(I/f);let R=Math.atan(.5/_),N=ev*2*I/f;super({...t,height:f,viewMatrix:w,longitude:i,latitude:r,zoom:s,distanceScales:dut(),fovyRadians:R*2,focalDistance:_,near:n,far:Math.min(2,1/N+1)*_*o}),G(this,\"longitude\",void 0),G(this,\"latitude\",void 0),G(this,\"resolution\",void 0),this.latitude=r,this.longitude=i,this.resolution=c}get projectionMode(){return Ja.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(t={}){let r={targetZ:t.z||0},i=this.unproject([0,this.height/2],r),s=this.unproject([this.width/2,0],r),n=this.unproject([this.width,this.height/2],r),o=this.unproject([this.width/2,this.height],r);return n[0]this.longitude&&(i[0]-=360),[Math.min(i[0],n[0],s[0],o[0]),Math.min(i[1],n[1],s[1],o[1]),Math.max(i[0],n[0],s[0],o[0]),Math.max(i[1],n[1],s[1],o[1])]}unproject(t,{topLeft:r=!0,targetZ:i}={}){let[s,n,o]=t,c=r?n:this.height-n,{pixelUnprojectionMatrix:f}=this,_;if(Number.isFinite(o))_=OD(f,[s,c,o,1]);else{let N=OD(f,[s,c,-1,1]),j=OD(f,[s,c,1,1]),Q=((i||0)/_P+1)*ev,et=NE(FE([],N,j)),Y=NE(N),K=NE(j),ut=4*((4*Y*K-(et-Y-K)**2)/16)/et,Et=Math.sqrt(Y-ut),kt=Math.sqrt(Math.max(0,Q*Q-ut)),Xt=(Et-kt)/Math.sqrt(et);_=Hj([],N,j,Xt)}let[w,I,R]=this.unprojectPosition(_);return Number.isFinite(o)?[w,I,R]:Number.isFinite(i)?[w,I,i]:[w,I]}projectPosition(t){let[r,i,s=0]=t,n=r*gP,o=i*gP,c=Math.cos(o),f=(s/_P+1)*ev;return[Math.sin(n)*c*f,-Math.cos(n)*c*f,Math.sin(o)*f]}unprojectPosition(t){let[r,i,s]=t,n=zE(t),o=Math.asin(s/n),f=Math.atan2(r,-i)*p9,_=o*p9,w=(n/ev-1)*_P;return[f,_,w]}projectFlat(t){return t}unprojectFlat(t){return t}panByPosition(t,r){let i=this.unproject(r);return{longitude:t[0]-i[0]+this.longitude,latitude:t[1]-i[1]+this.latitude}}};function OD(e,t){let r=Nh([],t,e);return Fy(r,r,1/r[3]),r}var put=new En().lookAt({eye:[0,0,1]});function Aut({width:e,height:t,near:r,far:i,padding:s}){let n=-e/2,o=e/2,c=-t/2,f=t/2;if(s){let{left:_=0,right:w=0,top:I=0,bottom:R=0}=s,N=Il((_+e-w)/2,0,e)-e/2,j=Il((I+t-R)/2,0,t)-t/2;n-=N,o-=N,c+=j,f+=j}return new En().ortho({left:n,right:o,bottom:c,top:f,near:r,far:i})}var iv=class extends ac{constructor(t){let{width:r,height:i,near:s=.1,far:n=1e3,zoom:o=0,target:c=[0,0,0],padding:f=null,flipY:_=!0}=t,w=Array.isArray(o)?o[0]:o,I=Array.isArray(o)?o[1]:o,R=Math.min(w,I),N=Math.pow(2,R),j;if(w!==I){let Q=Math.pow(2,w),et=Math.pow(2,I);j={unitsPerMeter:[Q/N,et/N,1],metersPerUnit:[N/Q,N/et,1]}}super({...t,longitude:void 0,position:c,viewMatrix:put.clone().scale([N,N*(_?-1:1),N]),projectionMatrix:Aut({width:r||1,height:i||1,padding:f,near:s,far:n}),zoom:R,distanceScales:j})}projectFlat([t,r]){let{unitsPerMeter:i}=this.distanceScales;return[t*i[0],r*i[1]]}unprojectFlat([t,r]){let{metersPerUnit:i}=this.distanceScales;return[t*i[0],r*i[1]]}panByPosition(t,r){let i=Qf(r,this.pixelUnprojectionMatrix),s=this.projectFlat(t),n=$A([],s,LE([],i)),o=$A([],this.center,n);return{target:this.unprojectFlat(o)}}};var cc=class{static get componentName(){return Object.prototype.hasOwnProperty.call(this,\"extensionName\")?this.extensionName:\"\"}constructor(t){G(this,\"opts\",void 0),t&&(this.opts=t)}equals(t){return this===t?!0:this.constructor===t.constructor&&mo(this.opts,t.opts,1)}getShaders(t){return null}getSubLayerProps(t){let{defaultProps:r}=t.constructor,i={updateTriggers:{}};for(let s in r)if(s in this.props){let n=r[s],o=this.props[s];i[s]=o,n&&n.type===\"accessor\"&&(i.updateTriggers[s]=this.props.updateTriggers[s],typeof o==\"function\"&&(i[s]=this.getSubLayerAccessor(o)))}return i}initializeState(t,r){}updateState(t,r){}onNeedsRedraw(t){}getNeedsPickingBuffer(t){return!1}draw(t,r){}finalizeState(t,r){}};G(cc,\"defaultProps\",{});G(cc,\"extensionName\",\"LayerExtension\");var BD={bearing:0,pitch:0,position:[0,0,0]},mut={speed:1.2,curve:1.414},nv=class extends hg{constructor(t={}){super({compare:[\"longitude\",\"latitude\",\"zoom\",\"bearing\",\"pitch\",\"position\"],extract:[\"width\",\"height\",\"longitude\",\"latitude\",\"zoom\",\"bearing\",\"pitch\",\"position\"],required:[\"width\",\"height\",\"latitude\",\"longitude\",\"zoom\"]}),G(this,\"opts\",void 0),this.opts={...mut,...t}}interpolateProps(t,r,i){let s=rP(t,r,i,this.opts);for(let n in BD)s[n]=il(t[n]||BD[n],r[n]||BD[n],i);return s}getDuration(t,r){let{transitionDuration:i}=r;return i===\"auto\"&&(i=gD(t,r,this.opts)),i}};var rm=class{constructor(t){G(this,\"opts\",void 0),G(this,\"typedArrayManager\",void 0),G(this,\"indexStarts\",[0]),G(this,\"vertexStarts\",[0]),G(this,\"vertexCount\",0),G(this,\"instanceCount\",0),G(this,\"attributes\",void 0),G(this,\"_attributeDefs\",void 0),G(this,\"data\",void 0),G(this,\"getGeometry\",void 0),G(this,\"geometryBuffer\",void 0),G(this,\"buffers\",void 0),G(this,\"positionSize\",void 0),G(this,\"normalize\",void 0);let{attributes:r={}}=t;this.typedArrayManager=Gh,this.attributes={},this._attributeDefs=r,this.opts=t,this.updateGeometry(t)}updateGeometry(t){Object.assign(this.opts,t);let{data:r,buffers:i={},getGeometry:s,geometryBuffer:n,positionFormat:o,dataChanged:c,normalize:f=!0}=this.opts;if(this.data=r,this.getGeometry=s,this.positionSize=n&&n.size||(o===\"XY\"?2:3),this.buffers=i,this.normalize=f,n&&(_r(r.startIndices),this.getGeometry=this.getGeometryFromBuffer(n),f||(i.positions=n)),this.geometryBuffer=i.positions,Array.isArray(c))for(let _ of c)this._rebuildGeometry(_);else this._rebuildGeometry()}updatePartialGeometry({startRow:t,endRow:r}){this._rebuildGeometry({startRow:t,endRow:r})}getGeometryFromBuffer(t){let r=t.value||t;return ArrayBuffer.isView(r)?uP(r,{size:this.positionSize,offset:t.offset,stride:t.stride,startIndices:this.data.startIndices}):null}_allocate(t,r){let{attributes:i,buffers:s,_attributeDefs:n,typedArrayManager:o}=this;for(let c in n)if(c in s)o.release(i[c]),i[c]=null;else{let f=n[c];f.copy=r,i[c]=o.allocate(i[c],t,f)}}_forEachGeometry(t,r,i){let{data:s,getGeometry:n}=this,{iterable:o,objectInfo:c}=Jc(s,r,i);for(let f of o){c.index++;let _=n?n(f,c):null;t(_,c.index)}}_rebuildGeometry(t){if(!this.data)return;let{indexStarts:r,vertexStarts:i,instanceCount:s}=this,{data:n,geometryBuffer:o}=this,{startRow:c=0,endRow:f=1/0}=t||{},_={};if(t||(r=[0],i=[0]),this.normalize||!o)this._forEachGeometry((I,R)=>{let N=I&&this.normalizeGeometry(I);_[R]=N,i[R+1]=i[R]+(N?this.getGeometrySize(N):0)},c,f),s=i[i.length-1];else if(i=n.startIndices,s=i[n.length]||0,ArrayBuffer.isView(o))s=s||o.length/this.positionSize;else if(o instanceof Fr){let I=o.accessor.stride||this.positionSize*4;s=s||o.byteLength/I}else if(o.buffer){let I=o.stride||this.positionSize*4;s=s||o.buffer.byteLength/I}else if(o.value){let I=o.value,R=o.stride/I.BYTES_PER_ELEMENT||this.positionSize;s=s||I.length/R}this._allocate(s,!!t),this.indexStarts=r,this.vertexStarts=i,this.instanceCount=s;let w={};this._forEachGeometry((I,R)=>{let N=_[R]||I;w.vertexStart=i[R],w.indexStart=r[R];let j=RvP(r,t));if(ov(e)){if(yut(e))return t.style=_ut,(0,FD.cloneElement)(e,t);if(vut(e))return(0,FD.cloneElement)(e,t)}return e}function ov(e){return e&&typeof e==\"object\"&&\"type\"in e||!1}function yut(e){var t;return(t=e.props)===null||t===void 0?void 0:t.mapStyle}function vut(e){let t=e.type;return t&&t.deckGLViewProps}function zD(e){if(typeof e==\"function\")return(0,m9.createElement)(Xc,{},e);if(Array.isArray(e))return e.map(zD);if(ov(e)){if(e.type===xP.Fragment)return zD(e.props.children);if(sv(e.type,Xc))return e}return e}function ND({children:e,layers:t=[],views:r=null}){let i=[],s=[],n={};return xP.Children.forEach(zD(e),o=>{if(ov(o)){let c=o.type;if(sv(c,dn)){let f=xut(c,o.props);s.push(f)}else i.push(o);if(sv(c,Xc)&&c!==Xc&&o.props.id){let f=new c(o.props);n[f.id]=f}}else o&&i.push(o)}),Object.keys(n).length>0&&(Array.isArray(r)?r.forEach(o=>{n[o.id]=o}):r&&(n[r.id]=r),r=Object.values(n)),t=s.length>0?[...s,...t]:t,{layers:t,children:i,views:r}}function xut(e,t){let r={},i=e.defaultProps||{};for(let s in t)i[s]!==t[s]&&(r[s]=t[s]);return new e(r)}var UD=Ri(Yi());function VD({children:e,deck:t,ContextProvider:r}){let{viewManager:i}=t||{};if(!i||!i.views.length)return[];let s={},n=i.views[0].id;for(let o of e){let c=n,f=o;ov(o)&&sv(o.type,Xc)&&(c=o.props.id||n,f=o.props.children);let _=i.getViewport(c),w=i.getViewState(c);if(_){w.padding=_.padding;let{x:I,y:R,width:N,height:j}=_;f=vP(f,{x:I,y:R,width:N,height:j,viewport:_,viewState:w}),s[c]||(s[c]={viewport:_,children:[]}),s[c].children.push(f)}}return Object.keys(s).map(o=>{let{viewport:c,children:f}=s[o],{x:_,y:w,width:I,height:R}=c,N={position:\"absolute\",left:_,top:w,width:I,height:R},j=\"view-\".concat(o),Q=(0,UD.createElement)(\"div\",{key:j,id:j,style:N},...f);if(r){let et={viewport:c,container:t.canvas.offsetParent,eventManager:t.eventManager,onViewStateChange:Y=>{Y.viewId=o,t._onViewStateChange(Y)}};return(0,UD.createElement)(r,{key:j,value:et},Q)}return Q})}var but={mixBlendMode:null};function jD({width:e,height:t,style:r}){let i={position:\"absolute\",zIndex:0,left:0,top:0,width:e,height:t},s={left:0,top:0};if(r)for(let n in r)n in but?s[n]=r[n]:i[n]=r[n];return{containerStyle:i,canvasStyle:s}}function wut(e){return{get deck(){return e.deck},pickObject:t=>e.deck.pickObject(t),pickMultipleObjects:t=>e.deck.pickMultipleObjects(t),pickObjects:t=>e.deck.pickObjects(t)}}function g9(e){e.redrawReason&&(e.deck._drawLayers(e.redrawReason),e.redrawReason=null)}function Sut(e,t,r){let i=new t({...r,_customRender:s=>{e.redrawReason=s;let n=i.getViewports();e.lastRenderedViewports!==n?e.forceUpdate():g9(e)}});return i}var _9=(0,Do.forwardRef)((e,t)=>{let[r,i]=(0,Do.useState)(0),n=(0,Do.useRef)({control:null,version:r,forceUpdate:()=>i(Et=>Et+1)}).current,o=(0,Do.useRef)(null),c=(0,Do.useRef)(null),f=(0,Do.useMemo)(()=>ND(e),[e.layers,e.views,e.children]),_=!0,w=Et=>{var kt;return _&&e.viewState?(n.viewStateUpdateRequested=Et,null):(n.viewStateUpdateRequested=null,(kt=e.onViewStateChange)===null||kt===void 0?void 0:kt.call(e,Et))},I=Et=>{if(_)n.interactionStateUpdateRequested=Et;else{var kt;n.interactionStateUpdateRequested=null,(kt=e.onInteractionStateChange)===null||kt===void 0||kt.call(e,Et)}},R=(0,Do.useMemo)(()=>{let Et={...e,style:null,width:\"100%\",height:\"100%\",parent:o.current,canvas:c.current,layers:f.layers,views:f.views,onViewStateChange:w,onInteractionStateChange:I};return delete Et._customRender,n.deck&&n.deck.setProps(Et),Et},[e]);(0,Do.useEffect)(()=>{let Et=e.Deck||cp;return n.deck=Sut(n,Et,{...R,parent:o.current,canvas:c.current}),()=>{var kt;return(kt=n.deck)===null||kt===void 0?void 0:kt.finalize()}},[]),A9(()=>{g9(n);let{viewStateUpdateRequested:Et,interactionStateUpdateRequested:kt}=n;Et&&w(Et),kt&&I(kt)}),(0,Do.useImperativeHandle)(t,()=>wut(n),[]);let N=n.deck&&n.deck.isInitialized?n.deck.getViewports():void 0,{ContextProvider:j,width:Q,height:et,id:Y,style:K}=e,{containerStyle:J,canvasStyle:ut}=(0,Do.useMemo)(()=>jD({width:Q,height:et,style:K}),[Q,et,K]);if(!n.viewStateUpdateRequested&&n.lastRenderedViewports===N||n.version!==r){n.lastRenderedViewports=N,n.version=r;let Et=VD({children:f.children,deck:n.deck,ContextProvider:j}),kt=(0,Do.createElement)(\"canvas\",{key:\"canvas\",id:Y||\"deckgl-overlay\",ref:c,style:ut});n.control=(0,Do.createElement)(\"div\",{id:\"\".concat(Y||\"deckgl\",\"-wrapper\"),ref:o,style:J},[kt,Et])}return _=!1,n.control});_9.defaultProps=cp.defaultProps;var GD=_9;var zt,hp=new Array(128).fill(void 0);hp.push(void 0,null,!0,!1);var ww=hp.length;function qe(e){ww===hp.length&&hp.push(hp.length+1);let t=ww;return ww=hp[t],hp[t]=e,t}function xe(e){return hp[e]}function Tut(e){e<132||(hp[e]=ww,ww=e)}function nn(e){let t=xe(e);return Tut(e),t}var R9=typeof TextDecoder<\"u\"?new TextDecoder(\"utf-8\",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error(\"TextDecoder not available\")}};typeof TextDecoder<\"u\"&&R9.decode();var _w=null;function av(){return(_w===null||_w.byteLength===0)&&(_w=new Uint8Array(zt.memory.buffer)),_w}function tu(e,t){return e=e>>>0,R9.decode(av().subarray(e,e+t))}function uc(e){return e==null}var yw=null;function Mut(){return(yw===null||yw.byteLength===0)&&(yw=new Float64Array(zt.memory.buffer)),yw}var vw=null;function Ue(){return(vw===null||vw.byteLength===0)&&(vw=new Int32Array(zt.memory.buffer)),vw}var hc=0,bP=typeof TextEncoder<\"u\"?new TextEncoder(\"utf-8\"):{encode:()=>{throw Error(\"TextEncoder not available\")}},Eut=typeof bP.encodeInto==\"function\"?function(e,t){return bP.encodeInto(e,t)}:function(e,t){let r=bP.encode(e);return t.set(r),{read:e.length,written:r.length}};function fp(e,t,r){if(r===void 0){let c=bP.encode(e),f=t(c.length,1)>>>0;return av().subarray(f,f+c.length).set(c),hc=c.length,f}let i=e.length,s=t(i,1)>>>0,n=av(),o=0;for(;o127)break;n[s+o]=c}if(o!==i){o!==0&&(e=e.slice(o)),s=r(s,i,i=o+e.length*3,1)>>>0;let c=av().subarray(s+o,s+i),f=Eut(e,c);o+=f.written,s=r(s,i,o,1)>>>0}return hc=o,s}var xw=null;function Put(){return(xw===null||xw.byteLength===0)&&(xw=new BigInt64Array(zt.memory.buffer)),xw}function WD(e){let t=typeof e;if(t==\"number\"||t==\"boolean\"||e==null)return`${e}`;if(t==\"string\")return`\"${e}\"`;if(t==\"symbol\"){let s=e.description;return s==null?\"Symbol\":`Symbol(${s})`}if(t==\"function\"){let s=e.name;return typeof s==\"string\"&&s.length>0?`Function(${s})`:\"Function\"}if(Array.isArray(e)){let s=e.length,n=\"[\";s>0&&(n+=WD(e[0]));for(let o=1;o1)i=r[1];else return toString.call(e);if(i==\"Object\")try{return\"Object(\"+JSON.stringify(e)+\")\"}catch{return\"Object\"}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:i}var y9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>{zt.__wbindgen_export_2.get(e.dtor)(e.a,e.b)});function Iut(e,t,r,i){let s={a:e,b:t,cnt:1,dtor:r},n=(...o)=>{s.cnt++;let c=s.a;s.a=0;try{return i(c,s.b,...o)}finally{--s.cnt===0?(zt.__wbindgen_export_2.get(s.dtor)(c,s.b),y9.unregister(s)):s.a=c}};return n.original=s,y9.register(n,s,s),n}function Cut(e,t,r){zt._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1de40baa0df51db0(e,t,qe(r))}function D9(e,t){let r=t(e.length*1,1)>>>0;return av().set(e,r/1),hc=e.length,r}function O9(e,t){try{let n=zt.__wbindgen_add_to_stack_pointer(-16),o=D9(e,zt.__wbindgen_malloc),c=hc;zt.readParquet(n,o,c,uc(t)?0:qe(t));var r=Ue()[n/4+0],i=Ue()[n/4+1],s=Ue()[n/4+2];if(s)throw nn(i);return IP.__wrap(r)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}function Lut(e,t){if(!(e instanceof t))throw new Error(`expected instance of ${t.name}`);return e.ptr}function XD(e,t){return e=e>>>0,av().subarray(e/1,e/1+t)}var bw=null;function B9(){return(bw===null||bw.byteLength===0)&&(bw=new Uint32Array(zt.memory.buffer)),bw}function wP(e,t){e=e>>>0;let i=B9().subarray(e/4,e/4+t),s=[];for(let n=0;n>>0,B9().subarray(e/4,e/4+t)}function Rut(e,t,r,i){zt.wasm_bindgen__convert__closures__invoke2_mut__h26b6dc7d05b06fdf(e,t,qe(r),qe(i))}var E8t=Object.freeze({V1:0,0:\"V1\",V2:1,1:\"V2\"}),P8t=Object.freeze({None:0,0:\"None\",Chunk:1,1:\"Chunk\",Page:2,2:\"Page\"}),I8t=Object.freeze({PLAIN:0,0:\"PLAIN\",PLAIN_DICTIONARY:1,1:\"PLAIN_DICTIONARY\",RLE:2,2:\"RLE\",BIT_PACKED:3,3:\"BIT_PACKED\",DELTA_BINARY_PACKED:4,4:\"DELTA_BINARY_PACKED\",DELTA_LENGTH_BYTE_ARRAY:5,5:\"DELTA_LENGTH_BYTE_ARRAY\",DELTA_BYTE_ARRAY:6,6:\"DELTA_BYTE_ARRAY\",RLE_DICTIONARY:7,7:\"RLE_DICTIONARY\",BYTE_STREAM_SPLIT:8,8:\"BYTE_STREAM_SPLIT\"}),C8t=Object.freeze({UNCOMPRESSED:0,0:\"UNCOMPRESSED\",SNAPPY:1,1:\"SNAPPY\",GZIP:2,2:\"GZIP\",BROTLI:3,3:\"BROTLI\",LZ4:4,4:\"LZ4\",ZSTD:5,5:\"ZSTD\",LZ4_RAW:6,6:\"LZ4_RAW\",LZO:7,7:\"LZO\"}),v9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_columnchunkmetadata_free(e>>>0)),SP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,v9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,v9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_columnchunkmetadata_free(t)}filePath(){try{let i=zt.__wbindgen_add_to_stack_pointer(-16);zt.columnchunkmetadata_filePath(i,this.__wbg_ptr);var t=Ue()[i/4+0],r=Ue()[i/4+1];let s;return t!==0&&(s=tu(t,r).slice(),zt.__wbindgen_free(t,r*1,1)),s}finally{zt.__wbindgen_add_to_stack_pointer(16)}}fileOffset(){return zt.columnchunkmetadata_fileOffset(this.__wbg_ptr)}columnPath(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.columnchunkmetadata_columnPath(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=wP(t,r).slice();return zt.__wbindgen_free(t,r*4,4),i}finally{zt.__wbindgen_add_to_stack_pointer(16)}}encodings(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.columnchunkmetadata_encodings(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=wP(t,r).slice();return zt.__wbindgen_free(t,r*4,4),i}finally{zt.__wbindgen_add_to_stack_pointer(16)}}numValues(){return zt.columnchunkmetadata_numValues(this.__wbg_ptr)}compression(){return zt.columnchunkmetadata_compression(this.__wbg_ptr)}compressedSize(){return zt.columnchunkmetadata_compressedSize(this.__wbg_ptr)}uncompressedSize(){return zt.columnchunkmetadata_uncompressedSize(this.__wbg_ptr)}},L8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_ffiarrowarray_free(e>>>0));var x9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_ffiarrowschema_free(e>>>0)),TP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,x9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,x9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_ffiarrowschema_free(t)}addr(){return zt.ffiarrowschema_addr(this.__wbg_ptr)>>>0}},k8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_ffidata_free(e>>>0));var b9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_ffirecordbatch_free(e>>>0)),MP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,b9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,b9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_ffirecordbatch_free(t)}arrayAddr(){return zt.ffirecordbatch_arrayAddr(this.__wbg_ptr)>>>0}schemaAddr(){return zt.ffirecordbatch_schemaAddr(this.__wbg_ptr)>>>0}},w9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_ffitable_free(e>>>0)),EP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,w9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,w9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_ffitable_free(t)}numBatches(){return zt.ffitable_numBatches(this.__wbg_ptr)>>>0}schemaAddr(){return zt.ffitable_schemaAddr(this.__wbg_ptr)>>>0}arrayAddr(t){return zt.ffitable_arrayAddr(this.__wbg_ptr,t)>>>0}arrayAddrs(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.ffitable_arrayAddrs(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=kut(t,r).slice();return zt.__wbindgen_free(t,r*4,4),i}finally{zt.__wbindgen_add_to_stack_pointer(16)}}drop(){let t=this.__destroy_into_raw();zt.ffitable_drop(t)}},R8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_ffivector_free(e>>>0));var S9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_filemetadata_free(e>>>0)),HD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,S9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,S9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_filemetadata_free(t)}version(){return zt.filemetadata_version(this.__wbg_ptr)}numRows(){return zt.filemetadata_numRows(this.__wbg_ptr)}createdBy(){try{let i=zt.__wbindgen_add_to_stack_pointer(-16);zt.filemetadata_createdBy(i,this.__wbg_ptr);var t=Ue()[i/4+0],r=Ue()[i/4+1];let s;return t!==0&&(s=tu(t,r).slice(),zt.__wbindgen_free(t,r*1,1)),s}finally{zt.__wbindgen_add_to_stack_pointer(16)}}keyValueMetadata(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.filemetadata_keyValueMetadata(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=Ue()[s/4+2];if(i)throw nn(r);return nn(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}},D8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_intounderlyingbytesource_free(e>>>0));var O8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_intounderlyingsink_free(e>>>0));var T9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_intounderlyingsource_free(e>>>0)),qD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,T9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,T9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_intounderlyingsource_free(t)}pull(t){let r=zt.intounderlyingsource_pull(this.__wbg_ptr,qe(t));return nn(r)}cancel(){let t=this.__destroy_into_raw();zt.intounderlyingsource_cancel(t)}},M9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_parquetfile_free(e>>>0)),ZD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,M9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,M9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_parquetfile_free(t)}static fromUrl(t,r){let i=fp(t,zt.__wbindgen_malloc,zt.__wbindgen_realloc),s=hc,n=zt.parquetfile_fromUrl(i,s,uc(r)?0:qe(r));return nn(n)}static fromFile(t){let r=zt.parquetfile_fromFile(qe(t));return nn(r)}metadata(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.parquetfile_metadata(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=Ue()[s/4+2];if(i)throw nn(r);return YD.__wrap(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}read(t){let r=zt.parquetfile_read(this.__wbg_ptr,uc(t)?0:qe(t));return nn(r)}stream(t){let r=zt.parquetfile_stream(this.__wbg_ptr,uc(t)?0:qe(t));return nn(r)}},E9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_parquetmetadata_free(e>>>0)),YD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,E9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,E9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_parquetmetadata_free(t)}fileMetadata(){let t=zt.parquetmetadata_fileMetadata(this.__wbg_ptr);return HD.__wrap(t)}numRowGroups(){return zt.parquetmetadata_numRowGroups(this.__wbg_ptr)>>>0}rowGroup(t){let r=zt.parquetmetadata_rowGroup(this.__wbg_ptr,t);return PP.__wrap(r)}rowGroups(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.parquetmetadata_rowGroups(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=wP(t,r).slice();return zt.__wbindgen_free(t,r*4,4),i}finally{zt.__wbindgen_add_to_stack_pointer(16)}}},P9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_recordbatch_free(e>>>0)),QD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,P9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,P9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_recordbatch_free(t)}get numRows(){return zt.recordbatch_numRows(this.__wbg_ptr)>>>0}get numColumns(){return zt.recordbatch_numColumns(this.__wbg_ptr)>>>0}get schema(){let t=zt.recordbatch_schema(this.__wbg_ptr);return Sw.__wrap(t)}toFFI(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.recordbatch_toFFI(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=Ue()[s/4+2];if(i)throw nn(r);return MP.__wrap(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}intoFFI(){try{let s=this.__destroy_into_raw(),n=zt.__wbindgen_add_to_stack_pointer(-16);zt.recordbatch_intoFFI(n,s);var t=Ue()[n/4+0],r=Ue()[n/4+1],i=Ue()[n/4+2];if(i)throw nn(r);return MP.__wrap(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}intoIPCStream(){try{let o=this.__destroy_into_raw(),c=zt.__wbindgen_add_to_stack_pointer(-16);zt.recordbatch_intoIPCStream(c,o);var t=Ue()[c/4+0],r=Ue()[c/4+1],i=Ue()[c/4+2],s=Ue()[c/4+3];if(s)throw nn(i);var n=XD(t,r).slice();return zt.__wbindgen_free(t,r*1,1),n}finally{zt.__wbindgen_add_to_stack_pointer(16)}}withSchema(t){try{let o=zt.__wbindgen_add_to_stack_pointer(-16);Lut(t,Sw);var r=t.__destroy_into_raw();zt.recordbatch_withSchema(o,this.__wbg_ptr,r);var i=Ue()[o/4+0],s=Ue()[o/4+1],n=Ue()[o/4+2];if(n)throw nn(s);return e.__wrap(i)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}slice(t,r){let i=zt.recordbatch_slice(this.__wbg_ptr,t,r);return e.__wrap(i)}getArrayMemorySize(){return zt.recordbatch_getArrayMemorySize(this.__wbg_ptr)>>>0}},I9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_rowgroupmetadata_free(e>>>0)),PP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,I9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,I9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_rowgroupmetadata_free(t)}numColumns(){return zt.rowgroupmetadata_numColumns(this.__wbg_ptr)>>>0}column(t){let r=zt.rowgroupmetadata_column(this.__wbg_ptr,t);return SP.__wrap(r)}columns(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.rowgroupmetadata_columns(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=wP(t,r).slice();return zt.__wbindgen_free(t,r*4,4),i}finally{zt.__wbindgen_add_to_stack_pointer(16)}}numRows(){return zt.rowgroupmetadata_numRows(this.__wbg_ptr)}totalByteSize(){return zt.rowgroupmetadata_totalByteSize(this.__wbg_ptr)}compressedSize(){return zt.rowgroupmetadata_compressedSize(this.__wbg_ptr)}},C9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_schema_free(e>>>0)),Sw=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,C9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,C9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_schema_free(t)}toFFI(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.schema_toFFI(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=Ue()[s/4+2];if(i)throw nn(r);return TP.__wrap(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}intoFFI(){try{let s=this.__destroy_into_raw(),n=zt.__wbindgen_add_to_stack_pointer(-16);zt.schema_intoFFI(n,s);var t=Ue()[n/4+0],r=Ue()[n/4+1],i=Ue()[n/4+2];if(i)throw nn(r);return TP.__wrap(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}intoIPCStream(){try{let o=this.__destroy_into_raw(),c=zt.__wbindgen_add_to_stack_pointer(-16);zt.schema_intoIPCStream(c,o);var t=Ue()[c/4+0],r=Ue()[c/4+1],i=Ue()[c/4+2],s=Ue()[c/4+3];if(s)throw nn(i);var n=XD(t,r).slice();return zt.__wbindgen_free(t,r*1,1),n}finally{zt.__wbindgen_add_to_stack_pointer(16)}}withMetadata(t){try{let n=zt.__wbindgen_add_to_stack_pointer(-16);zt.schema_withMetadata(n,this.__wbg_ptr,qe(t));var r=Ue()[n/4+0],i=Ue()[n/4+1],s=Ue()[n/4+2];if(s)throw nn(i);return e.__wrap(r)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}indexOf(t){try{let n=zt.__wbindgen_add_to_stack_pointer(-16),o=fp(t,zt.__wbindgen_malloc,zt.__wbindgen_realloc),c=hc;zt.schema_indexOf(n,this.__wbg_ptr,o,c);var r=Ue()[n/4+0],i=Ue()[n/4+1],s=Ue()[n/4+2];if(s)throw nn(i);return r>>>0}finally{zt.__wbindgen_add_to_stack_pointer(16)}}metadata(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.schema_metadata(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=Ue()[s/4+2];if(i)throw nn(r);return nn(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}},L9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_table_free(e>>>0)),IP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,L9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,L9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_table_free(t)}get schema(){let t=zt.table_schema(this.__wbg_ptr);return Sw.__wrap(t)}get numBatches(){return zt.table_numBatches(this.__wbg_ptr)>>>0}toFFI(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.table_toFFI(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=Ue()[s/4+2];if(i)throw nn(r);return EP.__wrap(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}intoFFI(){try{let s=this.__destroy_into_raw(),n=zt.__wbindgen_add_to_stack_pointer(-16);zt.table_intoFFI(n,s);var t=Ue()[n/4+0],r=Ue()[n/4+1],i=Ue()[n/4+2];if(i)throw nn(r);return EP.__wrap(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}intoIPCStream(){try{let o=this.__destroy_into_raw(),c=zt.__wbindgen_add_to_stack_pointer(-16);zt.table_intoIPCStream(c,o);var t=Ue()[c/4+0],r=Ue()[c/4+1],i=Ue()[c/4+2],s=Ue()[c/4+3];if(s)throw nn(i);var n=XD(t,r).slice();return zt.__wbindgen_free(t,r*1,1),n}finally{zt.__wbindgen_add_to_stack_pointer(16)}}static fromIPCStream(t){try{let n=zt.__wbindgen_add_to_stack_pointer(-16),o=D9(t,zt.__wbindgen_malloc),c=hc;zt.table_fromIPCStream(n,o,c);var r=Ue()[n/4+0],i=Ue()[n/4+1],s=Ue()[n/4+2];if(s)throw nn(i);return e.__wrap(r)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}getArrayMemorySize(){return zt.table_getArrayMemorySize(this.__wbg_ptr)>>>0}},B8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_wasmgetoptions_free(e>>>0));var k9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_wasmobjectmeta_free(e>>>0)),$D=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,k9.register(r,r.__wbg_ptr,r),r}toJSON(){return{location:this.location,last_modified:this.last_modified,size:this.size,e_tag:this.e_tag,version:this.version}}toString(){return JSON.stringify(this)}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,k9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_wasmobjectmeta_free(t)}get location(){let t,r;try{let n=zt.__wbindgen_add_to_stack_pointer(-16);zt.__wbg_get_wasmobjectmeta_location(n,this.__wbg_ptr);var i=Ue()[n/4+0],s=Ue()[n/4+1];return t=i,r=s,tu(i,s)}finally{zt.__wbindgen_add_to_stack_pointer(16),zt.__wbindgen_free(t,r,1)}}set location(t){let r=fp(t,zt.__wbindgen_malloc,zt.__wbindgen_realloc),i=hc;zt.__wbg_set_wasmobjectmeta_location(this.__wbg_ptr,r,i)}get last_modified(){let t=zt.__wbg_get_wasmobjectmeta_last_modified(this.__wbg_ptr);return nn(t)}set last_modified(t){zt.__wbg_set_wasmobjectmeta_last_modified(this.__wbg_ptr,qe(t))}get size(){return zt.__wbg_get_wasmobjectmeta_size(this.__wbg_ptr)>>>0}set size(t){zt.__wbg_set_wasmobjectmeta_size(this.__wbg_ptr,t)}get e_tag(){try{let i=zt.__wbindgen_add_to_stack_pointer(-16);zt.__wbg_get_wasmobjectmeta_e_tag(i,this.__wbg_ptr);var t=Ue()[i/4+0],r=Ue()[i/4+1];let s;return t!==0&&(s=tu(t,r).slice(),zt.__wbindgen_free(t,r*1,1)),s}finally{zt.__wbindgen_add_to_stack_pointer(16)}}set e_tag(t){var r=uc(t)?0:fp(t,zt.__wbindgen_malloc,zt.__wbindgen_realloc),i=hc;zt.__wbg_set_wasmobjectmeta_e_tag(this.__wbg_ptr,r,i)}get version(){try{let i=zt.__wbindgen_add_to_stack_pointer(-16);zt.__wbg_get_wasmobjectmeta_version(i,this.__wbg_ptr);var t=Ue()[i/4+0],r=Ue()[i/4+1];let s;return t!==0&&(s=tu(t,r).slice(),zt.__wbindgen_free(t,r*1,1)),s}finally{zt.__wbindgen_add_to_stack_pointer(16)}}set version(t){var r=uc(t)?0:fp(t,zt.__wbindgen_malloc,zt.__wbindgen_realloc),i=hc;zt.__wbg_set_wasmobjectmeta_version(this.__wbg_ptr,r,i)}},F8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_wasmobjectstore_free(e>>>0));var z8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_writerproperties_free(e>>>0));var N8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_writerpropertiesbuilder_free(e>>>0));async function Dut(e,t){if(typeof Response==\"function\"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==\"function\")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){if(e.headers.get(\"Content-Type\")!=\"application/wasm\")console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",i);else throw i}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}function Out(){let e={};return e.wbg={},e.wbg.__wbindgen_number_new=function(t){return qe(t)},e.wbg.__wbg_columnchunkmetadata_new=function(t){let r=SP.__wrap(t);return qe(r)},e.wbg.__wbg_rowgroupmetadata_new=function(t){let r=PP.__wrap(t);return qe(r)},e.wbg.__wbg_parquetfile_new=function(t){let r=ZD.__wrap(t);return qe(r)},e.wbg.__wbindgen_object_drop_ref=function(t){nn(t)},e.wbg.__wbindgen_object_clone_ref=function(t){let r=xe(t);return qe(r)},e.wbg.__wbindgen_error_new=function(t,r){let i=new Error(tu(t,r));return qe(i)},e.wbg.__wbindgen_is_undefined=function(t){return xe(t)===void 0},e.wbg.__wbindgen_in=function(t,r){return xe(t)in xe(r)},e.wbg.__wbindgen_is_bigint=function(t){return typeof xe(t)==\"bigint\"},e.wbg.__wbindgen_bigint_from_u64=function(t){let r=BigInt.asUintN(64,t);return qe(r)},e.wbg.__wbindgen_jsval_eq=function(t,r){return xe(t)===xe(r)},e.wbg.__wbindgen_is_object=function(t){let r=xe(t);return typeof r==\"object\"&&r!==null},e.wbg.__wbindgen_string_new=function(t,r){let i=tu(t,r);return qe(i)},e.wbg.__wbindgen_number_get=function(t,r){let i=xe(r),s=typeof i==\"number\"?i:void 0;Mut()[t/8+1]=uc(s)?0:s,Ue()[t/4+0]=!uc(s)},e.wbg.__wbg_fetch_1db5b0ae726d68b5=function(t){let r=fetch(xe(t));return qe(r)},e.wbg.__wbg_wasmobjectmeta_new=function(t){let r=$D.__wrap(t);return qe(r)},e.wbg.__wbindgen_string_get=function(t,r){let i=xe(r),s=typeof i==\"string\"?i:void 0;var n=uc(s)?0:fp(s,zt.__wbindgen_malloc,zt.__wbindgen_realloc),o=hc;Ue()[t/4+1]=o,Ue()[t/4+0]=n},e.wbg.__wbg_fetch_bc7c8e27076a5c84=function(t){let r=fetch(xe(t));return qe(r)},e.wbg.__wbg_done_2ffa852272310e47=function(t){return xe(t).done},e.wbg.__wbg_value_9f6eeb1e2aab8d96=function(t){let r=xe(t).value;return qe(r)},e.wbg.__wbg_newwithintounderlyingsource_a03a82aa1bbbb292=function(t,r){let i=new ReadableStream(qD.__wrap(t),nn(r));return qe(i)},e.wbg.__wbg_getReader_ab94afcb5cb7689a=function(){return Ds(function(t){let r=xe(t).getReader();return qe(r)},arguments)},e.wbg.__wbg_sethighWaterMark_ea50ed3ec2143088=function(t,r){xe(t).highWaterMark=r},e.wbg.__wbg_recordbatch_new=function(t){let r=QD.__wrap(t);return qe(r)},e.wbg.__wbg_table_new=function(t){let r=IP.__wrap(t);return qe(r)},e.wbg.__wbindgen_jsval_loose_eq=function(t,r){return xe(t)==xe(r)},e.wbg.__wbindgen_boolean_get=function(t){let r=xe(t);return typeof r==\"boolean\"?r?1:0:2},e.wbg.__wbindgen_as_number=function(t){return+xe(t)},e.wbg.__wbg_String_b9412f8799faab3e=function(t,r){let i=String(xe(r)),s=fp(i,zt.__wbindgen_malloc,zt.__wbindgen_realloc),n=hc;Ue()[t/4+1]=n,Ue()[t/4+0]=s},e.wbg.__wbg_getwithrefkey_edc2c8960f0f1191=function(t,r){let i=xe(t)[xe(r)];return qe(i)},e.wbg.__wbg_set_f975102236d3c502=function(t,r,i){xe(t)[nn(r)]=nn(i)},e.wbg.__wbindgen_cb_drop=function(t){let r=nn(t).original;return r.cnt--==1?(r.a=0,!0):!1},e.wbg.__wbg_queueMicrotask_481971b0d87f3dd4=function(t){queueMicrotask(xe(t))},e.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6=function(t){let r=xe(t).queueMicrotask;return qe(r)},e.wbg.__wbindgen_is_function=function(t){return typeof xe(t)==\"function\"},e.wbg.__wbg_fetch_921fad6ef9e883dd=function(t,r){let i=xe(t).fetch(xe(r));return qe(i)},e.wbg.__wbg_new_ab6fd82b10560829=function(){return Ds(function(){let t=new Headers;return qe(t)},arguments)},e.wbg.__wbg_append_7bfcb4937d1d5e29=function(){return Ds(function(t,r,i,s,n){xe(t).append(tu(r,i),tu(s,n))},arguments)},e.wbg.__wbg_close_a994f9425dab445c=function(){return Ds(function(t){xe(t).close()},arguments)},e.wbg.__wbg_enqueue_ea194723156c0cc2=function(){return Ds(function(t,r){xe(t).enqueue(xe(r))},arguments)},e.wbg.__wbg_size_9c7e57fbd4f0f4b5=function(t){return xe(t).size},e.wbg.__wbg_arrayBuffer_307ddd1bd1d04e23=function(t){let r=xe(t).arrayBuffer();return qe(r)},e.wbg.__wbg_slice_1991e6e71a6587f3=function(){return Ds(function(t,r,i){let s=xe(t).slice(r,i);return qe(s)},arguments)},e.wbg.__wbg_read_e7d0f8a49be01d86=function(t){let r=xe(t).read();return qe(r)},e.wbg.__wbg_releaseLock_5c49db976c08b864=function(t){xe(t).releaseLock()},e.wbg.__wbg_cancel_6ee33d4006737aef=function(t){let r=xe(t).cancel();return qe(r)},e.wbg.__wbg_byobRequest_72fca99f9c32c193=function(t){let r=xe(t).byobRequest;return uc(r)?0:qe(r)},e.wbg.__wbg_close_184931724d961ccc=function(){return Ds(function(t){xe(t).close()},arguments)},e.wbg.__wbg_instanceof_Response_849eb93e75734b6e=function(t){let r;try{r=xe(t)instanceof Response}catch{r=!1}return r},e.wbg.__wbg_url_5f6dc4009ac5f99d=function(t,r){let i=xe(r).url,s=fp(i,zt.__wbindgen_malloc,zt.__wbindgen_realloc),n=hc;Ue()[t/4+1]=n,Ue()[t/4+0]=s},e.wbg.__wbg_status_61a01141acd3cf74=function(t){return xe(t).status},e.wbg.__wbg_headers_9620bfada380764a=function(t){let r=xe(t).headers;return qe(r)},e.wbg.__wbg_body_9545a94f397829db=function(t){let r=xe(t).body;return uc(r)?0:qe(r)},e.wbg.__wbg_arrayBuffer_29931d52c7206b02=function(){return Ds(function(t){let r=xe(t).arrayBuffer();return qe(r)},arguments)},e.wbg.__wbg_signal_a61f78a3478fd9bc=function(t){let r=xe(t).signal;return qe(r)},e.wbg.__wbg_new_0d76b0581eca6298=function(){return Ds(function(){let t=new AbortController;return qe(t)},arguments)},e.wbg.__wbg_abort_2aa7521d5690750e=function(t){xe(t).abort()},e.wbg.__wbg_view_7f0ce470793a340f=function(t){let r=xe(t).view;return uc(r)?0:qe(r)},e.wbg.__wbg_respond_b1a43b2e3a06d525=function(){return Ds(function(t,r){xe(t).respond(r>>>0)},arguments)},e.wbg.__wbg_newwithstrandinit_3fd6fba4083ff2d0=function(){return Ds(function(t,r,i){let s=new Request(tu(t,r),xe(i));return qe(s)},arguments)},e.wbg.__wbg_get_bd8e338fbd5f5cc8=function(t,r){let i=xe(t)[r>>>0];return qe(i)},e.wbg.__wbg_length_cd7af8117672b8b8=function(t){return xe(t).length},e.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(t,r){let i=new Function(tu(t,r));return qe(i)},e.wbg.__wbg_new_d9bc3a0147634640=function(){return qe(new Map)},e.wbg.__wbg_next_40fc327bfc8770e6=function(t){let r=xe(t).next;return qe(r)},e.wbg.__wbg_next_196c84450b364254=function(){return Ds(function(t){let r=xe(t).next();return qe(r)},arguments)},e.wbg.__wbg_done_298b57d23c0fc80c=function(t){return xe(t).done},e.wbg.__wbg_value_d93c65011f51a456=function(t){let r=xe(t).value;return qe(r)},e.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return qe(Symbol.iterator)},e.wbg.__wbg_get_e3c254076557e348=function(){return Ds(function(t,r){let i=Reflect.get(xe(t),xe(r));return qe(i)},arguments)},e.wbg.__wbg_call_27c0f87801dedf93=function(){return Ds(function(t,r){let i=xe(t).call(xe(r));return qe(i)},arguments)},e.wbg.__wbg_new_72fb9a18b5ae2624=function(){let t=new Object;return qe(t)},e.wbg.__wbindgen_is_string=function(t){return typeof xe(t)==\"string\"},e.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return Ds(function(){let t=self.self;return qe(t)},arguments)},e.wbg.__wbg_window_c6fb939a7f436783=function(){return Ds(function(){let t=window.window;return qe(t)},arguments)},e.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return Ds(function(){let t=globalThis.globalThis;return qe(t)},arguments)},e.wbg.__wbg_global_207b558942527489=function(){return Ds(function(){let t=global.global;return qe(t)},arguments)},e.wbg.__wbg_isArray_2ab64d95e09ea0ae=function(t){return Array.isArray(xe(t))},e.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(t){let r;try{r=xe(t)instanceof ArrayBuffer}catch{r=!1}return r},e.wbg.__wbg_new_28c511d9baebfa89=function(t,r){let i=new Error(tu(t,r));return qe(i)},e.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return Ds(function(t,r,i){let s=xe(t).call(xe(r),xe(i));return qe(s)},arguments)},e.wbg.__wbg_set_8417257aaedc936b=function(t,r,i){let s=xe(t).set(xe(r),xe(i));return qe(s)},e.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2=function(t){return Number.isSafeInteger(xe(t))},e.wbg.__wbg_new_cf3ec55744a78578=function(t){let r=new Date(xe(t));return qe(r)},e.wbg.__wbg_entries_95cc2c823b285a09=function(t){let r=Object.entries(xe(t));return qe(r)},e.wbg.__wbg_new_81740750da40724f=function(t,r){try{var i={a:t,b:r},s=(o,c)=>{let f=i.a;i.a=0;try{return Rut(f,i.b,o,c)}finally{i.a=f}};let n=new Promise(s);return qe(n)}finally{i.a=i.b=0}},e.wbg.__wbg_resolve_b0083a7967828ec8=function(t){let r=Promise.resolve(xe(t));return qe(r)},e.wbg.__wbg_catch_0260e338d10f79ae=function(t,r){let i=xe(t).catch(xe(r));return qe(i)},e.wbg.__wbg_then_0c86a60e8fcfe9f6=function(t,r){let i=xe(t).then(xe(r));return qe(i)},e.wbg.__wbg_then_a73caa9a87991566=function(t,r,i){let s=xe(t).then(xe(r),xe(i));return qe(s)},e.wbg.__wbg_buffer_12d079cc21e14bdb=function(t){let r=xe(t).buffer;return qe(r)},e.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb=function(t,r,i){let s=new Uint8Array(xe(t),r>>>0,i>>>0);return qe(s)},e.wbg.__wbg_new_63b92bc8671ed464=function(t){let r=new Uint8Array(xe(t));return qe(r)},e.wbg.__wbg_set_a47bac70306a19a7=function(t,r,i){xe(t).set(xe(r),i>>>0)},e.wbg.__wbg_length_c20a40f15020d68a=function(t){return xe(t).length},e.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(t){let r;try{r=xe(t)instanceof Uint8Array}catch{r=!1}return r},e.wbg.__wbg_newwithlength_e9b4878cebadb3d3=function(t){let r=new Uint8Array(t>>>0);return qe(r)},e.wbg.__wbg_newwithbyteoffset_27c6424791adc775=function(t,r){let i=new Uint8Array(xe(t),r>>>0);return qe(i)},e.wbg.__wbg_buffer_dd7f74bc60f1faab=function(t){let r=xe(t).buffer;return qe(r)},e.wbg.__wbg_byteLength_58f7b4fab1919d44=function(t){return xe(t).byteLength},e.wbg.__wbg_byteOffset_81d60f7392524f62=function(t){return xe(t).byteOffset},e.wbg.__wbg_stringify_8887fe74e1c50d81=function(){return Ds(function(t){let r=JSON.stringify(xe(t));return qe(r)},arguments)},e.wbg.__wbg_has_0af94d20077affa2=function(){return Ds(function(t,r){return Reflect.has(xe(t),xe(r))},arguments)},e.wbg.__wbg_set_1f9b04f170055d33=function(){return Ds(function(t,r,i){return Reflect.set(xe(t),xe(r),xe(i))},arguments)},e.wbg.__wbindgen_bigint_get_as_i64=function(t,r){let i=xe(r),s=typeof i==\"bigint\"?i:void 0;Put()[t/8+1]=uc(s)?BigInt(0):s,Ue()[t/4+0]=!uc(s)},e.wbg.__wbindgen_debug_string=function(t,r){let i=WD(xe(r)),s=fp(i,zt.__wbindgen_malloc,zt.__wbindgen_realloc),n=hc;Ue()[t/4+1]=n,Ue()[t/4+0]=s},e.wbg.__wbindgen_throw=function(t,r){throw new Error(tu(t,r))},e.wbg.__wbindgen_memory=function(){let t=zt.memory;return qe(t)},e.wbg.__wbindgen_function_table=function(){let t=zt.__wbindgen_export_2;return qe(t)},e.wbg.__wbindgen_closure_wrapper13295=function(t,r,i){let s=Iut(t,r,3248,Cut);return qe(s)},e}function But(e,t){return zt=e.exports,F9.__wbindgen_wasm_module=t,xw=null,yw=null,vw=null,bw=null,_w=null,zt}async function F9(e){if(zt!==void 0)return zt;typeof e>\"u\"&&(e=new URL(\"parquet_wasm_bg.wasm\",import.meta.url));let t=Out();(typeof e==\"string\"||typeof Request==\"function\"&&e instanceof Request||typeof URL==\"function\"&&e instanceof URL)&&(e=fetch(e));let{instance:r,module:i}=await Dut(await e,t);return But(r,i)}var z9=F9;function U9(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols==\"function\")for(var s=0,i=Object.getOwnPropertySymbols(e);s=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?\"Object is not iterable.\":\"Symbol.iterator is not defined.\")}function ii(e){return this instanceof ii?(this.v=e,this):new ii(e)}function eu(e,t,r){if(!Symbol.asyncIterator)throw new TypeError(\"Symbol.asyncIterator is not defined.\");var i=r.apply(e,t||[]),s,n=[];return s={},o(\"next\"),o(\"throw\"),o(\"return\"),s[Symbol.asyncIterator]=function(){return this},s;function o(R){i[R]&&(s[R]=function(N){return new Promise(function(j,Q){n.push([R,N,j,Q])>1||c(R,N)})})}function c(R,N){try{f(i[R](N))}catch(j){I(n[0][3],j)}}function f(R){R.value instanceof ii?Promise.resolve(R.value.v).then(_,w):I(n[0][2],R)}function _(R){c(\"next\",R)}function w(R){c(\"throw\",R)}function I(R,N){R(N),n.shift(),n.length&&c(n[0][0],n[0][1])}}function lv(e){var t,r;return t={},i(\"next\"),i(\"throw\",function(s){throw s}),i(\"return\"),t[Symbol.iterator]=function(){return this},t;function i(s,n){t[s]=e[s]?function(o){return(r=!r)?{value:ii(e[s](o)),done:!1}:n?n(o):o}:n}}function Zh(e){if(!Symbol.asyncIterator)throw new TypeError(\"Symbol.asyncIterator is not defined.\");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof N9==\"function\"?N9(e):e[Symbol.iterator](),r={},i(\"next\"),i(\"throw\"),i(\"return\"),r[Symbol.asyncIterator]=function(){return this},r);function i(n){r[n]=e[n]&&function(o){return new Promise(function(c,f){o=e[n](o),s(c,f,o.done,o.value)})}}function s(n,o,c,f){Promise.resolve(f).then(function(_){n({value:_,done:c})},o)}}var iO={};mA(iO,{compareArrayLike:()=>rO,joinUint8Arrays:()=>iu,memcpy:()=>Ew,rebaseValueOffsets:()=>FP,toArrayBufferView:()=>Ai,toArrayBufferViewAsyncIterator:()=>Qh,toArrayBufferViewIterator:()=>td,toBigInt64Array:()=>BP,toBigUint64Array:()=>Hut,toFloat32Array:()=>qut,toFloat32ArrayAsyncIterator:()=>lht,toFloat32ArrayIterator:()=>tht,toFloat64Array:()=>Zut,toFloat64ArrayAsyncIterator:()=>cht,toFloat64ArrayIterator:()=>eht,toInt16Array:()=>jut,toInt16ArrayAsyncIterator:()=>nht,toInt16ArrayIterator:()=>$ut,toInt32Array:()=>yg,toInt32ArrayAsyncIterator:()=>sht,toInt32ArrayIterator:()=>Xut,toInt8Array:()=>Vut,toInt8ArrayAsyncIterator:()=>iht,toInt8ArrayIterator:()=>Qut,toUint16Array:()=>Gut,toUint16ArrayAsyncIterator:()=>oht,toUint16ArrayIterator:()=>Kut,toUint32Array:()=>Wut,toUint32ArrayAsyncIterator:()=>aht,toUint32ArrayIterator:()=>Jut,toUint8Array:()=>Rr,toUint8ArrayAsyncIterator:()=>eO,toUint8ArrayIterator:()=>tO,toUint8ClampedArray:()=>Yut,toUint8ClampedArrayAsyncIterator:()=>uht,toUint8ClampedArrayIterator:()=>rht});var Fut=new TextDecoder(\"utf-8\"),Tw=e=>Fut.decode(e),zut=new TextEncoder,Jf=e=>zut.encode(e);var Nut=e=>typeof e==\"number\",V9=e=>typeof e==\"boolean\",Oo=e=>typeof e==\"function\",Cl=e=>e!=null&&Object(e)===e,ru=e=>Cl(e)&&Oo(e.then);var Yh=e=>Cl(e)&&Oo(e[Symbol.iterator]),Nu=e=>Cl(e)&&Oo(e[Symbol.asyncIterator]),CP=e=>Cl(e)&&Cl(e.schema);var LP=e=>Cl(e)&&\"done\"in e&&\"value\"in e;var kP=e=>Cl(e)&&Oo(e.stat)&&Nut(e.fd);var RP=e=>Cl(e)&&Mw(e.body),DP=e=>\"_getDOMStream\"in e&&\"_getNodeStream\"in e,j9=e=>Cl(e)&&Oo(e.abort)&&Oo(e.getWriter)&&!DP(e),Mw=e=>Cl(e)&&Oo(e.cancel)&&Oo(e.getReader)&&!DP(e),G9=e=>Cl(e)&&Oo(e.end)&&Oo(e.write)&&V9(e.writable)&&!DP(e),OP=e=>Cl(e)&&Oo(e.read)&&Oo(e.pipe)&&V9(e.readable)&&!DP(e),W9=e=>Cl(e)&&Oo(e.clear)&&Oo(e.bytes)&&Oo(e.position)&&Oo(e.setPosition)&&Oo(e.capacity)&&Oo(e.getBufferIdentifier)&&Oo(e.createLong);var JD=typeof SharedArrayBuffer<\"u\"?SharedArrayBuffer:ArrayBuffer;function Uut(e){let t=e[0]?[e[0]]:[],r,i,s,n;for(let o,c,f=0,_=0,w=e.length;++fw+I.byteLength,0),s,n,o,c=0,f=-1,_=Math.min(t||Number.POSITIVE_INFINITY,i);for(let w=r.length;++fAi(Int8Array,e),jut=e=>Ai(Int16Array,e),yg=e=>Ai(Int32Array,e),BP=e=>Ai(BigInt64Array,e),Rr=e=>Ai(Uint8Array,e),Gut=e=>Ai(Uint16Array,e),Wut=e=>Ai(Uint32Array,e),Hut=e=>Ai(BigUint64Array,e),qut=e=>Ai(Float32Array,e),Zut=e=>Ai(Float64Array,e),Yut=e=>Ai(Uint8ClampedArray,e),KD=e=>(e.next(),e);function*td(e,t){let r=function*(s){yield s},i=typeof t==\"string\"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof JD?r(t):Yh(t)?t:r(t);return yield*KD(function*(s){let n=null;do n=s.next(yield Ai(e,n));while(!n.done)}(i[Symbol.iterator]())),new e}var Qut=e=>td(Int8Array,e),$ut=e=>td(Int16Array,e),Xut=e=>td(Int32Array,e),tO=e=>td(Uint8Array,e),Kut=e=>td(Uint16Array,e),Jut=e=>td(Uint32Array,e),tht=e=>td(Float32Array,e),eht=e=>td(Float64Array,e),rht=e=>td(Uint8ClampedArray,e);function Qh(e,t){return eu(this,arguments,function*(){if(ru(t))return yield ii(yield ii(yield*lv(Zh(Qh(e,yield ii(t))))));let i=function(o){return eu(this,arguments,function*(){yield yield ii(yield ii(o))})},s=function(o){return eu(this,arguments,function*(){yield ii(yield*lv(Zh(KD(function*(c){let f=null;do f=c.next(yield f?.value);while(!f.done)}(o[Symbol.iterator]())))))})},n=typeof t==\"string\"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof JD?i(t):Yh(t)?s(t):Nu(t)?t:i(t);return yield ii(yield*lv(Zh(KD(function(o){return eu(this,arguments,function*(){let c=null;do c=yield ii(o.next(yield yield ii(Ai(e,c))));while(!c.done)})}(n[Symbol.asyncIterator]()))))),yield ii(new e)})}var iht=e=>Qh(Int8Array,e),nht=e=>Qh(Int16Array,e),sht=e=>Qh(Int32Array,e),eO=e=>Qh(Uint8Array,e),oht=e=>Qh(Uint16Array,e),aht=e=>Qh(Uint32Array,e),lht=e=>Qh(Float32Array,e),cht=e=>Qh(Float64Array,e),uht=e=>Qh(Uint8ClampedArray,e);function FP(e,t,r){if(e!==0){r=r.slice(0,t);for(let i=-1,s=r.length;++i0)do if(e[r]!==t[r])return!1;while(++r(e.next(),e);function*hht(e){let t,r=!1,i=[],s,n,o,c=0;function f(){return n===\"peek\"?iu(i,o)[0]:([s,i,c]=iu(i,o),s)}({cmd:n,size:o}=(yield null)||{cmd:\"read\",size:0});let _=tO(e)[Symbol.iterator]();try{do if({done:t,value:s}=Number.isNaN(o-c)?_.next():_.next(o-c),!t&&s.byteLength>0&&(i.push(s),c+=s.byteLength),t||o<=c)do({cmd:n,size:o}=yield f());while(o0&&(s.push(n),f+=n.byteLength),r||c<=f)do({cmd:o,size:c}=yield yield ii(_()));while(c0&&(s.push(Rr(n)),f+=n.byteLength),r||c<=f)do({cmd:o,size:c}=yield yield ii(_()));while(c{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return ar(this,void 0,void 0,function*(){let{reader:r,source:i}=this;r&&(yield r.cancel(t).catch(()=>{})),i&&i.locked&&this.releaseLock()})}read(t){return ar(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=Rr(r)),r})}},nO=(e,t)=>{let r=s=>i([t,s]),i;return[t,r,new Promise(s=>(i=s)&&e.once(t,r))]};function pht(e){return eu(this,arguments,function*(){let r=[],i=\"error\",s=!1,n=null,o,c,f=0,_=[],w;function I(){return o===\"peek\"?iu(_,c)[0]:([w,_,f]=iu(_,c),w)}if({cmd:o,size:c}=(yield yield ii(null))||{cmd:\"read\",size:0},e.isTTY)return yield yield ii(new Uint8Array(0)),yield ii(null);try{r[0]=nO(e,\"end\"),r[1]=nO(e,\"error\");do{if(r[2]=nO(e,\"readable\"),[i,n]=yield ii(Promise.race(r.map(N=>N[2]))),i===\"error\")break;if((s=i===\"end\")||(Number.isFinite(c-f)?(w=Rr(e.read(c-f)),w.byteLength0&&(_.push(w),f+=w.byteLength)),s||c<=f)do({cmd:o,size:c}=yield yield ii(I()));while(c{for(let[Y,K]of N)e.off(Y,K);try{let Y=e.destroy;Y&&Y.call(e,j),j=void 0}catch(Y){j=Y||j}finally{j!=null?et(j):Q()}})}})}var sn;(function(e){e[e.V1=0]=\"V1\",e[e.V2=1]=\"V2\",e[e.V3=2]=\"V3\",e[e.V4=3]=\"V4\",e[e.V5=4]=\"V5\"})(sn||(sn={}));var Pn;(function(e){e[e.Sparse=0]=\"Sparse\",e[e.Dense=1]=\"Dense\"})(Pn||(Pn={}));var $i;(function(e){e[e.HALF=0]=\"HALF\",e[e.SINGLE=1]=\"SINGLE\",e[e.DOUBLE=2]=\"DOUBLE\"})($i||($i={}));var Os;(function(e){e[e.DAY=0]=\"DAY\",e[e.MILLISECOND=1]=\"MILLISECOND\"})(Os||(Os={}));var Ar;(function(e){e[e.SECOND=0]=\"SECOND\",e[e.MILLISECOND=1]=\"MILLISECOND\",e[e.MICROSECOND=2]=\"MICROSECOND\",e[e.NANOSECOND=3]=\"NANOSECOND\"})(Ar||(Ar={}));var Bo;(function(e){e[e.YEAR_MONTH=0]=\"YEAR_MONTH\",e[e.DAY_TIME=1]=\"DAY_TIME\",e[e.MONTH_DAY_NANO=2]=\"MONTH_DAY_NANO\"})(Bo||(Bo={}));var ed=new Int32Array(2),NP=new Float32Array(ed.buffer),UP=new Float64Array(ed.buffer),cv=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Pw;(function(e){e[e.UTF8_BYTES=1]=\"UTF8_BYTES\",e[e.UTF16_STRING=2]=\"UTF16_STRING\"})(Pw||(Pw={}));var nu=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){NP[0]=r,this.writeInt32(t,ed[0])}writeFloat64(t,r){UP[0]=r,this.writeInt32(t,ed[cv?0:1]),this.writeInt32(t+4,ed[cv?1:0])}getBufferIdentifier(){if(this.bytes_.lengththis.minalign&&(this.minalign=t);let i=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space=0&&this.vtable[r]==0;r--);let i=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let s=2;this.addInt16(t-this.object_start);let n=(i+s)*2;this.addInt16(n);let o=0,c=this.space;t:for(r=0;r=0;o--)this.writeInt8(n.charCodeAt(o))}this.prep(this.minalign,4+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let i=this.bb.capacity()-t,s=i-this.bb.readInt32(i);if(!(r=0;i--)t.addInt32(r[i]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,i){return e.startUnion(t),e.addMode(t,r),e.addTypeIds(t,i),e.endUnion(t)}};var Nw=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}};var In;(function(e){e[e.NONE=0]=\"NONE\",e[e.Null=1]=\"Null\",e[e.Int=2]=\"Int\",e[e.FloatingPoint=3]=\"FloatingPoint\",e[e.Binary=4]=\"Binary\",e[e.Utf8=5]=\"Utf8\",e[e.Bool=6]=\"Bool\",e[e.Decimal=7]=\"Decimal\",e[e.Date=8]=\"Date\",e[e.Time=9]=\"Time\",e[e.Timestamp=10]=\"Timestamp\",e[e.Interval=11]=\"Interval\",e[e.List=12]=\"List\",e[e.Struct_=13]=\"Struct_\",e[e.Union=14]=\"Union\",e[e.FixedSizeBinary=15]=\"FixedSizeBinary\",e[e.FixedSizeList=16]=\"FixedSizeList\",e[e.Map=17]=\"Map\",e[e.Duration=18]=\"Duration\",e[e.LargeBinary=19]=\"LargeBinary\",e[e.LargeUtf8=20]=\"LargeUtf8\",e[e.LargeList=21]=\"LargeList\",e[e.RunEndEncoded=22]=\"RunEndEncoded\"})(In||(In={}));var nl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):In.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new rd).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let i=this.bb.__offset(this.bb_pos,14);return i?(r||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,16);return i?(r||new Fo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,In.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}};var fc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):im.Little}fields(t,r){let i=this.bb.__offset(this.bb_pos,6);return i?(r||new nl).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new Fo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,im.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addInt64(r[i]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,r){t.finish(r)}static finishSizePrefixedSchemaBuffer(t,r){t.finish(r,void 0,!0)}static createSchema(t,r,i,s,n){return e.startSchema(t),e.addEndianness(t,r),e.addFields(t,i),e.addCustomMetadata(t,s),e.addFeatures(t,n),e.endSchema(t)}};var wi;(function(e){e[e.NONE=0]=\"NONE\",e[e.Schema=1]=\"Schema\",e[e.DictionaryBatch=2]=\"DictionaryBatch\",e[e.RecordBatch=3]=\"RecordBatch\",e[e.Tensor=4]=\"Tensor\",e[e.SparseTensor=5]=\"SparseTensor\"})(wi||(wi={}));var Ot;(function(e){e[e.NONE=0]=\"NONE\",e[e.Null=1]=\"Null\",e[e.Int=2]=\"Int\",e[e.Float=3]=\"Float\",e[e.Binary=4]=\"Binary\",e[e.Utf8=5]=\"Utf8\",e[e.Bool=6]=\"Bool\",e[e.Decimal=7]=\"Decimal\",e[e.Date=8]=\"Date\",e[e.Time=9]=\"Time\",e[e.Timestamp=10]=\"Timestamp\",e[e.Interval=11]=\"Interval\",e[e.List=12]=\"List\",e[e.Struct=13]=\"Struct\",e[e.Union=14]=\"Union\",e[e.FixedSizeBinary=15]=\"FixedSizeBinary\",e[e.FixedSizeList=16]=\"FixedSizeList\",e[e.Map=17]=\"Map\",e[e.Duration=18]=\"Duration\",e[e.LargeBinary=19]=\"LargeBinary\",e[e.LargeUtf8=20]=\"LargeUtf8\",e[e.Dictionary=-1]=\"Dictionary\",e[e.Int8=-2]=\"Int8\",e[e.Int16=-3]=\"Int16\",e[e.Int32=-4]=\"Int32\",e[e.Int64=-5]=\"Int64\",e[e.Uint8=-6]=\"Uint8\",e[e.Uint16=-7]=\"Uint16\",e[e.Uint32=-8]=\"Uint32\",e[e.Uint64=-9]=\"Uint64\",e[e.Float16=-10]=\"Float16\",e[e.Float32=-11]=\"Float32\",e[e.Float64=-12]=\"Float64\",e[e.DateDay=-13]=\"DateDay\",e[e.DateMillisecond=-14]=\"DateMillisecond\",e[e.TimestampSecond=-15]=\"TimestampSecond\",e[e.TimestampMillisecond=-16]=\"TimestampMillisecond\",e[e.TimestampMicrosecond=-17]=\"TimestampMicrosecond\",e[e.TimestampNanosecond=-18]=\"TimestampNanosecond\",e[e.TimeSecond=-19]=\"TimeSecond\",e[e.TimeMillisecond=-20]=\"TimeMillisecond\",e[e.TimeMicrosecond=-21]=\"TimeMicrosecond\",e[e.TimeNanosecond=-22]=\"TimeNanosecond\",e[e.DenseUnion=-23]=\"DenseUnion\",e[e.SparseUnion=-24]=\"SparseUnion\",e[e.IntervalDayTime=-25]=\"IntervalDayTime\",e[e.IntervalYearMonth=-26]=\"IntervalYearMonth\",e[e.DurationSecond=-27]=\"DurationSecond\",e[e.DurationMillisecond=-28]=\"DurationMillisecond\",e[e.DurationMicrosecond=-29]=\"DurationMicrosecond\",e[e.DurationNanosecond=-30]=\"DurationNanosecond\"})(Ot||(Ot={}));var Oi;(function(e){e[e.OFFSET=0]=\"OFFSET\",e[e.DATA=1]=\"DATA\",e[e.VALIDITY=2]=\"VALIDITY\",e[e.TYPE=3]=\"TYPE\"})(Oi||(Oi={}));var TO={};mA(TO,{clampRange:()=>Kw,createElementComparator:()=>pm,wrapIndex:()=>xg});var oO={};mA(oO,{valueToString:()=>Jh});function Jh(e){if(e===null)return\"null\";if(e===void 0)return\"undefined\";switch(typeof e){case\"number\":return`${e}`;case\"bigint\":return`${e}`;case\"string\":return`\"${e}\"`}return typeof e[Symbol.toPrimitive]==\"function\"?e[Symbol.toPrimitive](\"string\"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>Jh(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r==\"bigint\"?`${r}`:r)}var uO={};mA(uO,{BN:()=>Vw,bigNumToBigInt:()=>q9,bigNumToNumber:()=>cO,bigNumToString:()=>pv,isArrowBigNumSymbol:()=>H9});function Wi(e){if(typeof e==\"bigint\"&&(eNumber.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function aO(e,t){return Wi(e/t)+Wi(e%t)/Wi(t)}var H9=Symbol.for(\"isArrowBigNum\");function tf(e,...t){return t.length===0?Object.setPrototypeOf(Ai(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}tf.prototype[H9]=!0;tf.prototype.toJSON=function(){return`\"${pv(this)}\"`};tf.prototype.valueOf=function(e){return cO(this,e)};tf.prototype.toString=function(){return pv(this)};tf.prototype[Symbol.toPrimitive]=function(e=\"default\"){switch(e){case\"number\":return cO(this);case\"string\":return pv(this);case\"default\":return q9(this)}return pv(this)};function fv(...e){return tf.apply(this,e)}function dv(...e){return tf.apply(this,e)}function Uw(...e){return tf.apply(this,e)}Object.setPrototypeOf(fv.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(dv.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Uw.prototype,Object.create(Uint32Array.prototype));Object.assign(fv.prototype,tf.prototype,{constructor:fv,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(dv.prototype,tf.prototype,{constructor:dv,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Uw.prototype,tf.prototype,{constructor:Uw,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var Aht=BigInt(4294967296)*BigInt(4294967296),mht=Aht-BigInt(1);function cO(e,t){let{buffer:r,byteOffset:i,byteLength:s,signed:n}=e,o=new BigUint64Array(r,i,s/8),c=n&&o.at(-1)&BigInt(1)<=0)return lO(e);t=t.slice();let i=1;for(let n=0;n(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]=\"DataType\"))(ze.prototype);var ea=class extends ze{constructor(){super(Ot.Null)}toString(){return\"Null\"}};Y9=Symbol.toStringTag;ea[Y9]=(e=>e[Symbol.toStringTag]=\"Null\")(ea.prototype);var Bs=class extends ze{constructor(t,r){super(Ot.Int),this.isSigned=t,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?\"I\":\"Ui\"}nt${this.bitWidth}`}};Q9=Symbol.toStringTag;Bs[Q9]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]=\"Int\"))(Bs.prototype);var jw=class extends Bs{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Gw=class extends Bs{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},ef=class extends Bs{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Ww=class extends Bs{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Hw=class extends Bs{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},qw=class extends Bs{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Zw=class extends Bs{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Yw=class extends Bs{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(jw.prototype,\"ArrayType\",{value:Int8Array});Object.defineProperty(Gw.prototype,\"ArrayType\",{value:Int16Array});Object.defineProperty(ef.prototype,\"ArrayType\",{value:Int32Array});Object.defineProperty(Ww.prototype,\"ArrayType\",{value:BigInt64Array});Object.defineProperty(Hw.prototype,\"ArrayType\",{value:Uint8Array});Object.defineProperty(qw.prototype,\"ArrayType\",{value:Uint16Array});Object.defineProperty(Zw.prototype,\"ArrayType\",{value:Uint32Array});Object.defineProperty(Yw.prototype,\"ArrayType\",{value:BigUint64Array});var ra=class extends ze{constructor(t){super(Ot.Float),this.precision=t}get ArrayType(){switch(this.precision){case $i.HALF:return Uint16Array;case $i.SINGLE:return Float32Array;case $i.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};$9=Symbol.toStringTag;ra[$9]=(e=>(e.precision=null,e[Symbol.toStringTag]=\"Float\"))(ra.prototype);var Qw=class extends ra{constructor(){super($i.HALF)}},$w=class extends ra{constructor(){super($i.SINGLE)}},Av=class extends ra{constructor(){super($i.DOUBLE)}};Object.defineProperty(Qw.prototype,\"ArrayType\",{value:Uint16Array});Object.defineProperty($w.prototype,\"ArrayType\",{value:Float32Array});Object.defineProperty(Av.prototype,\"ArrayType\",{value:Float64Array});var Vu=class extends ze{constructor(){super(Ot.Binary)}toString(){return\"Binary\"}};X9=Symbol.toStringTag;Vu[X9]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=\"Binary\"))(Vu.prototype);var nd=class extends ze{constructor(){super(Ot.LargeBinary)}toString(){return\"LargeBinary\"}};K9=Symbol.toStringTag;nd[K9]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=\"LargeBinary\"))(nd.prototype);var ju=class extends ze{constructor(){super(Ot.Utf8)}toString(){return\"Utf8\"}};J9=Symbol.toStringTag;ju[J9]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=\"Utf8\"))(ju.prototype);var sd=class extends ze{constructor(){super(Ot.LargeUtf8)}toString(){return\"LargeUtf8\"}};tW=Symbol.toStringTag;sd[tW]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=\"LargeUtf8\"))(sd.prototype);var dc=class extends ze{constructor(){super(Ot.Bool)}toString(){return\"Bool\"}};eW=Symbol.toStringTag;dc[eW]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=\"Bool\"))(dc.prototype);var Gu=class extends ze{constructor(t,r,i=128){super(Ot.Decimal),this.scale=t,this.precision=r,this.bitWidth=i}toString(){return`Decimal[${this.precision}e${this.scale>0?\"+\":\"\"}${this.scale}]`}};rW=Symbol.toStringTag;Gu[rW]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]=\"Decimal\"))(Gu.prototype);var Wu=class extends ze{constructor(t){super(Ot.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Os[this.unit]}>`}get ArrayType(){return this.unit===Os.DAY?Int32Array:BigInt64Array}};iW=Symbol.toStringTag;Wu[iW]=(e=>(e.unit=null,e[Symbol.toStringTag]=\"Date\"))(Wu.prototype);var Hu=class extends ze{constructor(t,r){super(Ot.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${Ar[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};nW=Symbol.toStringTag;Hu[nW]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]=\"Time\"))(Hu.prototype);var qu=class extends ze{constructor(t,r){super(Ot.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${Ar[this.unit]}${this.timezone?`, ${this.timezone}`:\"\"}>`}};sW=Symbol.toStringTag;qu[sW]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=\"Timestamp\"))(qu.prototype);var Zu=class extends ze{constructor(t){super(Ot.Interval),this.unit=t}toString(){return`Interval<${Bo[this.unit]}>`}};oW=Symbol.toStringTag;Zu[oW]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]=\"Interval\"))(Zu.prototype);var Yu=class extends ze{constructor(t){super(Ot.Duration),this.unit=t}toString(){return`Duration<${Ar[this.unit]}>`}};aW=Symbol.toStringTag;Yu[aW]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=\"Duration\"))(Yu.prototype);var sl=class extends ze{constructor(t){super(Ot.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};lW=Symbol.toStringTag;sl[lW]=(e=>(e.children=null,e[Symbol.toStringTag]=\"List\"))(sl.prototype);var pn=class extends ze{constructor(t){super(Ot.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(\", \")}}>`}};cW=Symbol.toStringTag;pn[cW]=(e=>(e.children=null,e[Symbol.toStringTag]=\"Struct\"))(pn.prototype);var pc=class extends ze{constructor(t,r,i){super(Ot.Union),this.mode=t,this.children=i,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((s,n,o)=>(s[n]=o)&&s||s,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(\" | \")}>`}};uW=Symbol.toStringTag;pc[uW]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]=\"Union\"))(pc.prototype);var Qu=class extends ze{constructor(t){super(Ot.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};hW=Symbol.toStringTag;Qu[hW]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]=\"FixedSizeBinary\"))(Qu.prototype);var Ll=class extends ze{constructor(t,r){super(Ot.FixedSizeList),this.listSize=t,this.children=[r]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};fW=Symbol.toStringTag;Ll[fW]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]=\"FixedSizeList\"))(Ll.prototype);var Ac=class extends ze{constructor(t,r=!1){var i,s,n;if(super(Ot.Map),this.children=[t],this.keysSorted=r,t&&(t.name=\"entries\",!((i=t?.type)===null||i===void 0)&&i.children)){let o=(s=t?.type)===null||s===void 0?void 0:s.children[0];o&&(o.name=\"key\");let c=(n=t?.type)===null||n===void 0?void 0:n.children[1];c&&(c.name=\"value\")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(\", \")}}>`}};dW=Symbol.toStringTag;Ac[dW]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]=\"Map_\"))(Ac.prototype);var ght=(e=>()=>++e)(-1),mc=class extends ze{constructor(t,r,i,s){super(Ot.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=s||!1,this.id=i==null?ght():Wi(i)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};pW=Symbol.toStringTag;mc[pW]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]=\"Dictionary\"))(mc.prototype);function ou(e){let t=e;switch(e.typeId){case Ot.Decimal:return e.bitWidth/32;case Ot.Interval:return 1+t.unit;case Ot.FixedSizeList:return t.listSize;case Ot.FixedSizeBinary:return t.byteWidth;default:return 1}}var Er=class{visitMany(t,...r){return t.map((i,s)=>this.visit(i,...r.map(n=>n[s])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return _ht(this,t,r)}getVisitFnByTypeId(t,r=!0){return mv(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};function _ht(e,t,r=!0){return typeof t==\"number\"?mv(e,t,r):typeof t==\"string\"&&t in Ot?mv(e,Ot[t],r):t&&t instanceof ze?mv(e,AW(t),r):t?.type&&t.type instanceof ze?mv(e,AW(t.type),r):mv(e,Ot.NONE,r)}function mv(e,t,r=!0){let i=null;switch(t){case Ot.Null:i=e.visitNull;break;case Ot.Bool:i=e.visitBool;break;case Ot.Int:i=e.visitInt;break;case Ot.Int8:i=e.visitInt8||e.visitInt;break;case Ot.Int16:i=e.visitInt16||e.visitInt;break;case Ot.Int32:i=e.visitInt32||e.visitInt;break;case Ot.Int64:i=e.visitInt64||e.visitInt;break;case Ot.Uint8:i=e.visitUint8||e.visitInt;break;case Ot.Uint16:i=e.visitUint16||e.visitInt;break;case Ot.Uint32:i=e.visitUint32||e.visitInt;break;case Ot.Uint64:i=e.visitUint64||e.visitInt;break;case Ot.Float:i=e.visitFloat;break;case Ot.Float16:i=e.visitFloat16||e.visitFloat;break;case Ot.Float32:i=e.visitFloat32||e.visitFloat;break;case Ot.Float64:i=e.visitFloat64||e.visitFloat;break;case Ot.Utf8:i=e.visitUtf8;break;case Ot.LargeUtf8:i=e.visitLargeUtf8;break;case Ot.Binary:i=e.visitBinary;break;case Ot.LargeBinary:i=e.visitLargeBinary;break;case Ot.FixedSizeBinary:i=e.visitFixedSizeBinary;break;case Ot.Date:i=e.visitDate;break;case Ot.DateDay:i=e.visitDateDay||e.visitDate;break;case Ot.DateMillisecond:i=e.visitDateMillisecond||e.visitDate;break;case Ot.Timestamp:i=e.visitTimestamp;break;case Ot.TimestampSecond:i=e.visitTimestampSecond||e.visitTimestamp;break;case Ot.TimestampMillisecond:i=e.visitTimestampMillisecond||e.visitTimestamp;break;case Ot.TimestampMicrosecond:i=e.visitTimestampMicrosecond||e.visitTimestamp;break;case Ot.TimestampNanosecond:i=e.visitTimestampNanosecond||e.visitTimestamp;break;case Ot.Time:i=e.visitTime;break;case Ot.TimeSecond:i=e.visitTimeSecond||e.visitTime;break;case Ot.TimeMillisecond:i=e.visitTimeMillisecond||e.visitTime;break;case Ot.TimeMicrosecond:i=e.visitTimeMicrosecond||e.visitTime;break;case Ot.TimeNanosecond:i=e.visitTimeNanosecond||e.visitTime;break;case Ot.Decimal:i=e.visitDecimal;break;case Ot.List:i=e.visitList;break;case Ot.Struct:i=e.visitStruct;break;case Ot.Union:i=e.visitUnion;break;case Ot.DenseUnion:i=e.visitDenseUnion||e.visitUnion;break;case Ot.SparseUnion:i=e.visitSparseUnion||e.visitUnion;break;case Ot.Dictionary:i=e.visitDictionary;break;case Ot.Interval:i=e.visitInterval;break;case Ot.IntervalDayTime:i=e.visitIntervalDayTime||e.visitInterval;break;case Ot.IntervalYearMonth:i=e.visitIntervalYearMonth||e.visitInterval;break;case Ot.Duration:i=e.visitDuration;break;case Ot.DurationSecond:i=e.visitDurationSecond||e.visitDuration;break;case Ot.DurationMillisecond:i=e.visitDurationMillisecond||e.visitDuration;break;case Ot.DurationMicrosecond:i=e.visitDurationMicrosecond||e.visitDuration;break;case Ot.DurationNanosecond:i=e.visitDurationNanosecond||e.visitDuration;break;case Ot.FixedSizeList:i=e.visitFixedSizeList;break;case Ot.Map:i=e.visitMap;break}if(typeof i==\"function\")return i;if(!r)return()=>null;throw new Error(`Unrecognized type '${Ot[t]}'`)}function AW(e){switch(e.typeId){case Ot.Null:return Ot.Null;case Ot.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?Ot.Int8:Ot.Uint8;case 16:return r?Ot.Int16:Ot.Uint16;case 32:return r?Ot.Int32:Ot.Uint32;case 64:return r?Ot.Int64:Ot.Uint64}return Ot.Int}case Ot.Float:switch(e.precision){case $i.HALF:return Ot.Float16;case $i.SINGLE:return Ot.Float32;case $i.DOUBLE:return Ot.Float64}return Ot.Float;case Ot.Binary:return Ot.Binary;case Ot.LargeBinary:return Ot.LargeBinary;case Ot.Utf8:return Ot.Utf8;case Ot.LargeUtf8:return Ot.LargeUtf8;case Ot.Bool:return Ot.Bool;case Ot.Decimal:return Ot.Decimal;case Ot.Time:switch(e.unit){case Ar.SECOND:return Ot.TimeSecond;case Ar.MILLISECOND:return Ot.TimeMillisecond;case Ar.MICROSECOND:return Ot.TimeMicrosecond;case Ar.NANOSECOND:return Ot.TimeNanosecond}return Ot.Time;case Ot.Timestamp:switch(e.unit){case Ar.SECOND:return Ot.TimestampSecond;case Ar.MILLISECOND:return Ot.TimestampMillisecond;case Ar.MICROSECOND:return Ot.TimestampMicrosecond;case Ar.NANOSECOND:return Ot.TimestampNanosecond}return Ot.Timestamp;case Ot.Date:switch(e.unit){case Os.DAY:return Ot.DateDay;case Os.MILLISECOND:return Ot.DateMillisecond}return Ot.Date;case Ot.Interval:switch(e.unit){case Bo.DAY_TIME:return Ot.IntervalDayTime;case Bo.YEAR_MONTH:return Ot.IntervalYearMonth}return Ot.Interval;case Ot.Duration:switch(e.unit){case Ar.SECOND:return Ot.DurationSecond;case Ar.MILLISECOND:return Ot.DurationMillisecond;case Ar.MICROSECOND:return Ot.DurationMicrosecond;case Ar.NANOSECOND:return Ot.DurationNanosecond}return Ot.Duration;case Ot.Map:return Ot.Map;case Ot.List:return Ot.List;case Ot.Struct:return Ot.Struct;case Ot.Union:switch(e.mode){case Pn.Dense:return Ot.DenseUnion;case Pn.Sparse:return Ot.SparseUnion}return Ot.Union;case Ot.FixedSizeBinary:return Ot.FixedSizeBinary;case Ot.FixedSizeList:return Ot.FixedSizeList;case Ot.Dictionary:return Ot.Dictionary}throw new Error(`Unrecognized type '${Ot[e.typeId]}'`)}Er.prototype.visitInt8=null;Er.prototype.visitInt16=null;Er.prototype.visitInt32=null;Er.prototype.visitInt64=null;Er.prototype.visitUint8=null;Er.prototype.visitUint16=null;Er.prototype.visitUint32=null;Er.prototype.visitUint64=null;Er.prototype.visitFloat16=null;Er.prototype.visitFloat32=null;Er.prototype.visitFloat64=null;Er.prototype.visitDateDay=null;Er.prototype.visitDateMillisecond=null;Er.prototype.visitTimestampSecond=null;Er.prototype.visitTimestampMillisecond=null;Er.prototype.visitTimestampMicrosecond=null;Er.prototype.visitTimestampNanosecond=null;Er.prototype.visitTimeSecond=null;Er.prototype.visitTimeMillisecond=null;Er.prototype.visitTimeMicrosecond=null;Er.prototype.visitTimeNanosecond=null;Er.prototype.visitDenseUnion=null;Er.prototype.visitSparseUnion=null;Er.prototype.visitIntervalDayTime=null;Er.prototype.visitIntervalYearMonth=null;Er.prototype.visitDuration=null;Er.prototype.visitDurationSecond=null;Er.prototype.visitDurationMillisecond=null;Er.prototype.visitDurationMicrosecond=null;Er.prototype.visitDurationNanosecond=null;var hO={};mA(hO,{float64ToUint16:()=>Xw,uint16ToFloat64:()=>GP});var mW=new Float64Array(1),gv=new Uint32Array(mW.buffer);function GP(e){let t=(e&31744)>>10,r=(e&1023)/1024,i=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return i*(r?Number.NaN:1/0);case 0:return i*(r?6103515625e-14*r:0)}return i*Math.pow(2,t-15)*(1+r)}function Xw(e){if(e!==e)return 32256;mW[0]=e;let t=(gv[1]&2147483648)>>16&65535,r=gv[1]&2146435072,i=0;return r>=1089470464?gv[0]>0?r=31744:(r=(r&2080374784)>>16,i=(gv[1]&1048575)>>10):r<=1056964608?(i=1048576+(gv[1]&1048575),i=1048576+(i<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,i=(gv[1]&1048575)+512>>10),t|r|i&65535}var kr=class extends Er{};function Wr(e){return(t,r,i)=>{if(t.setValid(r,i!=null))return e(t,r,i)}}var yht=(e,t,r)=>{e[t]=Math.floor(r/864e5)},gW=(e,t,r,i)=>{if(r+1{let s=e+r;i?t[s>>3]|=1<>3]&=~(1<{e[t]=r},fO=({values:e},t,r)=>{e[t]=r},_W=({values:e},t,r)=>{e[t]=Xw(r)},xht=(e,t,r)=>{switch(e.type.precision){case $i.HALF:return _W(e,t,r);case $i.SINGLE:case $i.DOUBLE:return fO(e,t,r)}},WP=({values:e},t,r)=>{yht(e,t,r.valueOf())},HP=({values:e},t,r)=>{e[t]=BigInt(r)},dO=({stride:e,values:t},r,i)=>{t.set(i.subarray(0,e),e*r)},yW=({values:e,valueOffsets:t},r,i)=>gW(e,t,r,i),vW=({values:e,valueOffsets:t},r,i)=>gW(e,t,r,Jf(i)),pO=(e,t,r)=>{e.type.unit===Os.DAY?WP(e,t,r):HP(e,t,r)},qP=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},ZP=({values:e},t,r)=>{e[t]=BigInt(r)},YP=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},QP=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},AO=(e,t,r)=>{switch(e.type.unit){case Ar.SECOND:return qP(e,t,r);case Ar.MILLISECOND:return ZP(e,t,r);case Ar.MICROSECOND:return YP(e,t,r);case Ar.NANOSECOND:return QP(e,t,r)}},$P=({values:e},t,r)=>{e[t]=r},XP=({values:e},t,r)=>{e[t]=r},KP=({values:e},t,r)=>{e[t]=r},JP=({values:e},t,r)=>{e[t]=r},mO=(e,t,r)=>{switch(e.type.unit){case Ar.SECOND:return $P(e,t,r);case Ar.MILLISECOND:return XP(e,t,r);case Ar.MICROSECOND:return KP(e,t,r);case Ar.NANOSECOND:return JP(e,t,r)}},gO=({values:e,stride:t},r,i)=>{e.set(i.subarray(0,t),t*r)},bht=(e,t,r)=>{let i=e.children[0],s=e.valueOffsets,n=ba.getVisitFn(i);if(Array.isArray(r))for(let o=-1,c=s[t],f=s[t+1];c{let i=e.children[0],{valueOffsets:s}=e,n=ba.getVisitFn(i),{[t]:o,[t+1]:c}=s,f=r instanceof Map?r.entries():Object.entries(r);for(let _ of f)if(n(i,o,_),++o>=c)break},Sht=(e,t)=>(r,i,s,n)=>i&&r(i,e,t[n]),Tht=(e,t)=>(r,i,s,n)=>i&&r(i,e,t.get(n)),Mht=(e,t)=>(r,i,s,n)=>i&&r(i,e,t.get(s.name)),Eht=(e,t)=>(r,i,s,n)=>i&&r(i,e,t[s.name]),Pht=(e,t,r)=>{let i=e.type.children.map(n=>ba.getVisitFn(n.type)),s=r instanceof Map?Mht(t,r):r instanceof xr?Tht(t,r):Array.isArray(r)?Sht(t,r):Eht(t,r);e.type.children.forEach((n,o)=>s(i[o],e.children[o],n,o))},Iht=(e,t,r)=>{e.type.mode===Pn.Dense?xW(e,t,r):bW(e,t,r)},xW=(e,t,r)=>{let i=e.type.typeIdToChildIndex[e.typeIds[t]],s=e.children[i];ba.visit(s,e.valueOffsets[t],r)},bW=(e,t,r)=>{let i=e.type.typeIdToChildIndex[e.typeIds[t]],s=e.children[i];ba.visit(s,t,r)},Cht=(e,t,r)=>{var i;(i=e.dictionary)===null||i===void 0||i.set(e.values[t],r)},_O=(e,t,r)=>{e.type.unit===Bo.DAY_TIME?t3(e,t,r):e3(e,t,r)},t3=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},e3=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},r3=({values:e},t,r)=>{e[t]=r},i3=({values:e},t,r)=>{e[t]=r},n3=({values:e},t,r)=>{e[t]=r},s3=({values:e},t,r)=>{e[t]=r},yO=(e,t,r)=>{switch(e.type.unit){case Ar.SECOND:return r3(e,t,r);case Ar.MILLISECOND:return i3(e,t,r);case Ar.MICROSECOND:return n3(e,t,r);case Ar.NANOSECOND:return s3(e,t,r)}},Lht=(e,t,r)=>{let{stride:i}=e,s=e.children[0],n=ba.getVisitFn(s);if(Array.isArray(r))for(let o=-1,c=t*i;++o`${Jh(t)}: ${Jh(r)}`).join(\", \")}}`}[Symbol.for(\"nodejs.util.inspect.custom\")](){return this.toString()}[Symbol.iterator](){return new vO(this[rf],this[_v])}},vO=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return tr.name)}has(t,r){return t[rf].type.children.findIndex(i=>i.name===r)!==-1}getOwnPropertyDescriptor(t,r){if(t[rf].type.children.findIndex(i=>i.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let i=t[rf].type.children.findIndex(s=>s.name===r);if(i!==-1){let s=go.visit(t[rf].children[i],t[_v]);return Reflect.set(t,r,s),s}}set(t,r,i){let s=t[rf].type.children.findIndex(n=>n.name===r);return s!==-1?(ba.visit(t[rf].children[s],t[_v],i),Reflect.set(t,r,i)):Reflect.has(t,r)||typeof r==\"symbol\"?Reflect.set(t,r,i):!1}};var Pr=class extends Er{};function zr(e){return(t,r)=>t.getValid(r)?e(t,r):null}var kht=(e,t)=>864e5*e[t],Rht=(e,t)=>null,wW=(e,t,r)=>{if(r+1>=t.length)return null;let i=Wi(t[r]),s=Wi(t[r+1]);return e.subarray(i,s)},Dht=({offset:e,values:t},r)=>{let i=e+r;return(t[i>>3]&1<kht(e,t),TW=({values:e},t)=>Wi(e[t]),fm=({stride:e,values:t},r)=>t[e*r],Oht=({stride:e,values:t},r)=>GP(t[e*r]),MW=({values:e},t)=>e[t],Bht=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),EW=({values:e,valueOffsets:t},r)=>wW(e,t,r),PW=({values:e,valueOffsets:t},r)=>{let i=wW(e,t,r);return i!==null?Tw(i):null},Fht=({values:e},t)=>e[t],zht=({type:e,values:t},r)=>e.precision!==$i.HALF?t[r]:GP(t[r]),Nht=(e,t)=>e.type.unit===Os.DAY?SW(e,t):TW(e,t),IW=({values:e},t)=>1e3*Wi(e[t]),CW=({values:e},t)=>Wi(e[t]),LW=({values:e},t)=>aO(e[t],BigInt(1e3)),kW=({values:e},t)=>aO(e[t],BigInt(1e6)),Uht=(e,t)=>{switch(e.type.unit){case Ar.SECOND:return IW(e,t);case Ar.MILLISECOND:return CW(e,t);case Ar.MICROSECOND:return LW(e,t);case Ar.NANOSECOND:return kW(e,t)}},RW=({values:e},t)=>e[t],DW=({values:e},t)=>e[t],OW=({values:e},t)=>e[t],BW=({values:e},t)=>e[t],Vht=(e,t)=>{switch(e.type.unit){case Ar.SECOND:return RW(e,t);case Ar.MILLISECOND:return DW(e,t);case Ar.MICROSECOND:return OW(e,t);case Ar.NANOSECOND:return BW(e,t)}},jht=({values:e,stride:t},r)=>Vw.decimal(e.subarray(t*r,t*(r+1))),Ght=(e,t)=>{let{valueOffsets:r,stride:i,children:s}=e,{[t*i]:n,[t*i+1]:o}=r,f=s[0].slice(n,o-n);return new xr([f])},Wht=(e,t)=>{let{valueOffsets:r,children:i}=e,{[t]:s,[t+1]:n}=r,o=i[0];return new od(o.slice(s,n-s))},Hht=(e,t)=>new hm(e,t),qht=(e,t)=>e.type.mode===Pn.Dense?FW(e,t):zW(e,t),FW=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];return go.visit(i,e.valueOffsets[t])},zW=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];return go.visit(i,t)},Zht=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},Yht=(e,t)=>e.type.unit===Bo.DAY_TIME?NW(e,t):UW(e,t),NW=({values:e},t)=>e.subarray(2*t,2*(t+1)),UW=({values:e},t)=>{let r=e[t],i=new Int32Array(2);return i[0]=Math.trunc(r/12),i[1]=Math.trunc(r%12),i},VW=({values:e},t)=>e[t],jW=({values:e},t)=>e[t],GW=({values:e},t)=>e[t],WW=({values:e},t)=>e[t],Qht=(e,t)=>{switch(e.type.unit){case Ar.SECOND:return VW(e,t);case Ar.MILLISECOND:return jW(e,t);case Ar.MICROSECOND:return GW(e,t);case Ar.NANOSECOND:return WW(e,t)}},$ht=(e,t)=>{let{stride:r,children:i}=e,n=i[0].slice(t*r,r);return new xr([n])};Pr.prototype.visitNull=zr(Rht);Pr.prototype.visitBool=zr(Dht);Pr.prototype.visitInt=zr(Fht);Pr.prototype.visitInt8=zr(fm);Pr.prototype.visitInt16=zr(fm);Pr.prototype.visitInt32=zr(fm);Pr.prototype.visitInt64=zr(MW);Pr.prototype.visitUint8=zr(fm);Pr.prototype.visitUint16=zr(fm);Pr.prototype.visitUint32=zr(fm);Pr.prototype.visitUint64=zr(MW);Pr.prototype.visitFloat=zr(zht);Pr.prototype.visitFloat16=zr(Oht);Pr.prototype.visitFloat32=zr(fm);Pr.prototype.visitFloat64=zr(fm);Pr.prototype.visitUtf8=zr(PW);Pr.prototype.visitLargeUtf8=zr(PW);Pr.prototype.visitBinary=zr(EW);Pr.prototype.visitLargeBinary=zr(EW);Pr.prototype.visitFixedSizeBinary=zr(Bht);Pr.prototype.visitDate=zr(Nht);Pr.prototype.visitDateDay=zr(SW);Pr.prototype.visitDateMillisecond=zr(TW);Pr.prototype.visitTimestamp=zr(Uht);Pr.prototype.visitTimestampSecond=zr(IW);Pr.prototype.visitTimestampMillisecond=zr(CW);Pr.prototype.visitTimestampMicrosecond=zr(LW);Pr.prototype.visitTimestampNanosecond=zr(kW);Pr.prototype.visitTime=zr(Vht);Pr.prototype.visitTimeSecond=zr(RW);Pr.prototype.visitTimeMillisecond=zr(DW);Pr.prototype.visitTimeMicrosecond=zr(OW);Pr.prototype.visitTimeNanosecond=zr(BW);Pr.prototype.visitDecimal=zr(jht);Pr.prototype.visitList=zr(Ght);Pr.prototype.visitStruct=zr(Hht);Pr.prototype.visitUnion=zr(qht);Pr.prototype.visitDenseUnion=zr(FW);Pr.prototype.visitSparseUnion=zr(zW);Pr.prototype.visitDictionary=zr(Zht);Pr.prototype.visitInterval=zr(Yht);Pr.prototype.visitIntervalDayTime=zr(NW);Pr.prototype.visitIntervalYearMonth=zr(UW);Pr.prototype.visitDuration=zr(Qht);Pr.prototype.visitDurationSecond=zr(VW);Pr.prototype.visitDurationMillisecond=zr(jW);Pr.prototype.visitDurationMicrosecond=zr(GW);Pr.prototype.visitDurationNanosecond=zr(WW);Pr.prototype.visitFixedSizeList=zr($ht);Pr.prototype.visitMap=zr(Wht);var go=new Pr;var dm=Symbol.for(\"keys\"),vv=Symbol.for(\"vals\"),yv=Symbol.for(\"kKeysAsStrings\"),bO=Symbol.for(\"_kKeysAsStrings\"),od=class{constructor(t){return this[dm]=new xr([t.children[0]]).memoize(),this[vv]=t.children[1],new Proxy(this,new SO)}get[yv](){return this[bO]||(this[bO]=Array.from(this[dm].toArray(),String))}[Symbol.iterator](){return new wO(this[dm],this[vv])}get size(){return this[dm].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[dm],r=this[vv],i={};for(let s=-1,n=t.length;++s`${Jh(t)}: ${Jh(r)}`).join(\", \")}}`}[Symbol.for(\"nodejs.util.inspect.custom\")](){return this.toString()}},wO=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),go.visit(this.vals,t)]})}},SO=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[yv]}has(t,r){return t[yv].includes(r)}getOwnPropertyDescriptor(t,r){if(t[yv].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let i=t[yv].indexOf(r);if(i!==-1){let s=go.visit(Reflect.get(t,vv),i);return Reflect.set(t,r,s),s}}set(t,r,i){let s=t[yv].indexOf(r);return s!==-1?(ba.visit(Reflect.get(t,vv),s,i),Reflect.set(t,r,i)):Reflect.has(t,r)?Reflect.set(t,r,i):!1}};Object.defineProperties(od.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:\"Row\"},[dm]:{writable:!0,enumerable:!1,configurable:!1,value:null},[vv]:{writable:!0,enumerable:!1,configurable:!1,value:null},[bO]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var HW;function Kw(e,t,r,i){let{length:s=0}=e,n=typeof t!=\"number\"?0:t,o=typeof r!=\"number\"?s:r;return n<0&&(n=(n%s+s)%s),o<0&&(o=(o%s+s)%s),os&&(o=s),i?i(e,n,o):[n,o]}var xg=(e,t)=>e<0?t+e:e,qW=e=>e!==e;function pm(e){if(typeof e!==\"object\"||e===null)return qW(e)?qW:r=>r===e;if(e instanceof Date){let r=e.valueOf();return i=>i instanceof Date?i.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?rO(e,r):!1:e instanceof Map?Kht(e):Array.isArray(e)?Xht(e):e instanceof xr?Jht(e):tft(e,!0)}function Xht(e){let t=[];for(let r=-1,i=e.length;++r!1;let i=[];for(let s=-1,n=r.length;++s{if(!r||typeof r!=\"object\")return!1;switch(r.constructor){case Array:return eft(e,r);case Map:return ZW(e,r,r.keys());case od:case hm:case Object:case void 0:return ZW(e,r,t||Object.keys(r))}return r instanceof xr?rft(e,r):!1}}function eft(e,t){let r=e.length;if(t.length!==r)return!1;for(let i=-1;++ibg,getBit:()=>YW,getBool:()=>l3,packBools:()=>Sg,popcnt_array:()=>QW,popcnt_bit_range:()=>Jw,popcnt_uint32:()=>a3,setBool:()=>ift,truncateBitmap:()=>wg});function l3(e,t,r,i){return(r&1<>i}function ift(e,t,r){return r?!!(e[t>>3]|=1<>3]&=~(1<0||r.byteLength>3):Sg(new bg(r,e,t,null,l3)).subarray(0,i)),s}return r}function Sg(e){let t=[],r=0,i=0,s=0;for(let o of e)o&&(s|=1<0)&&(t[r++]=s);let n=new Uint8Array(t.length+7&-8);return n.set(t),n}var bg=class{constructor(t,r,i,s,n){this.bytes=t,this.length=i,this.context=s,this.get=n,this.bit=r%8,this.byteIndex=r>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index>3<<3,s=t+(t%8===0?0:8-t%8);return Jw(e,t,s)+Jw(e,i,r)+QW(e,s>>3,i-s>>3)}function QW(e,t,r){let i=0,s=Math.trunc(t),n=new DataView(e.buffer,e.byteOffset,e.byteLength),o=r===void 0?e.byteLength:s+r;for(;o-s>=4;)i+=a3(n.getUint32(s)),s+=4;for(;o-s>=2;)i+=a3(n.getUint16(s)),s+=2;for(;o-s>=1;)i+=a3(n.getUint8(s)),s+=1;return i}function a3(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var nft=-1,Fi=class e{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return ze.isSparseUnion(t)?this.children.some(r=>r.nullable):ze.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:i,nullBitmap:s,typeIds:n}=this;return r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),n&&(t+=n.byteLength),this.children.reduce((o,c)=>o+c.byteLength,t)}get nullCount(){if(ze.isUnion(this.type))return this.children.reduce((i,s)=>i+s.nullCount,0);let t=this._nullCount,r;return t<=nft&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-Jw(r,this.offset,this.offset+this.length)),t}constructor(t,r,i,s,n,o=[],c){this.type=t,this.children=o,this.dictionary=c,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(i||0,0)),this._nullCount=Math.floor(Math.max(s||0,-1));let f;n instanceof e?(this.stride=n.stride,this.values=n.values,this.typeIds=n.typeIds,this.nullBitmap=n.nullBitmap,this.valueOffsets=n.valueOffsets):(this.stride=ou(t),n&&((f=n[0])&&(this.valueOffsets=f),(f=n[1])&&(this.values=f),(f=n[2])&&(this.nullBitmap=f),(f=n[3])&&(this.typeIds=f)))}getValid(t){let{type:r}=this;if(ze.isUnion(r)){let i=r,s=this.children[i.typeIdToChildIndex[this.typeIds[t]]],n=i.mode===Pn.Dense?this.valueOffsets[t]:t;return s.getValid(n)}if(this.nullable&&this.nullCount>0){let i=this.offset+t;return(this.nullBitmap[i>>3]&1<>3;(!n||n.byteLength<=w)&&(n=new Uint8Array((o+c+63&-64)>>3).fill(255),this.nullCount>0?(n.set(wg(o,c,this.nullBitmap),0),Object.assign(this,{nullBitmap:n})):Object.assign(this,{nullBitmap:n,_nullCount:0}));let I=n[w];i=(I&_)!==0,n[w]=r?I|_:I&~_}return i!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,i=this.length,s=this._nullCount,n=this,o=this.children){return new e(t,r,i,s,n,o,this.dictionary)}slice(t,r){let{stride:i,typeId:s,children:n}=this,o=+(this._nullCount===0)-1,c=s===16?i:1,f=this._sliceBuffers(t,r,i,s);return this.clone(this.type,this.offset+t,r,o,f,n.length===0||this.valueOffsets?n:this._sliceChildren(n,c*t,c*r))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===Ot.Null)return this.clone(this.type,0,t,0);let{length:r,nullCount:i}=this,s=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);s[r>>3]=(1<0&&s.set(wg(this.offset,r,this.nullBitmap),0);let n=this.buffers;return n[Oi.VALIDITY]=s,this.clone(this.type,0,t,i+(t-r),n)}_sliceBuffers(t,r,i,s){let n,{buffers:o}=this;return(n=o[Oi.TYPE])&&(o[Oi.TYPE]=n.subarray(t,t+r)),(n=o[Oi.OFFSET])&&(o[Oi.OFFSET]=n.subarray(t,t+r+1))||(n=o[Oi.DATA])&&(o[Oi.DATA]=s===6?n:n.subarray(i*t,i*(t+r))),o}_sliceChildren(t,r,i){return t.map(s=>s.slice(r,i))}};Fi.prototype.children=Object.freeze([]);var EO=class e extends Er{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"length\"]:s=0}=t;return new Fi(r,i,s,s)}visitBool(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length>>3,[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitInt(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length,[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitFloat(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length,[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitUtf8(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.data),n=Rr(t.nullBitmap),o=yg(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:f=t.nullBitmap?-1:0}=t;return new Fi(r,i,c,f,[o,s,n])}visitLargeUtf8(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.data),n=Rr(t.nullBitmap),o=BP(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:f=t.nullBitmap?-1:0}=t;return new Fi(r,i,c,f,[o,s,n])}visitBinary(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.data),n=Rr(t.nullBitmap),o=yg(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:f=t.nullBitmap?-1:0}=t;return new Fi(r,i,c,f,[o,s,n])}visitLargeBinary(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.data),n=Rr(t.nullBitmap),o=BP(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:f=t.nullBitmap?-1:0}=t;return new Fi(r,i,c,f,[o,s,n])}visitFixedSizeBinary(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length/ou(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitDate(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length/ou(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitTimestamp(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length/ou(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitTime(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length/ou(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitDecimal(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length/ou(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitList(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"child\"]:s}=t,n=Rr(t.nullBitmap),o=yg(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:f=t.nullBitmap?-1:0}=t;return new Fi(r,i,c,f,[o,void 0,n],[s])}visitStruct(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"children\"]:s=[]}=t,n=Rr(t.nullBitmap),{length:o=s.reduce((f,{length:_})=>Math.max(f,_),0),nullCount:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,void 0,n],s)}visitUnion(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"children\"]:s=[]}=t,n=Ai(r.ArrayType,t.typeIds),{[\"length\"]:o=n.length,[\"nullCount\"]:c=-1}=t;if(ze.isSparseUnion(r))return new Fi(r,i,o,c,[void 0,void 0,void 0,n],s);let f=yg(t.valueOffsets);return new Fi(r,i,o,c,[f,void 0,void 0,n],s)}visitDictionary(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.indices.ArrayType,t.data),{[\"dictionary\"]:o=new xr([new e().visit({type:r.dictionary})])}=t,{[\"length\"]:c=n.length,[\"nullCount\"]:f=t.nullBitmap?-1:0}=t;return new Fi(r,i,c,f,[void 0,n,s],[],o)}visitInterval(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length/ou(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitDuration(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length,[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitFixedSizeList(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"child\"]:s=new e().visit({type:r.valueType})}=t,n=Rr(t.nullBitmap),{[\"length\"]:o=s.length/ou(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,void 0,n],[s])}visitMap(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"child\"]:s=new e().visit({type:r.childType})}=t,n=Rr(t.nullBitmap),o=yg(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:f=t.nullBitmap?-1:0}=t;return new Fi(r,i,c,f,[o,void 0,n],[s])}},sft=new EO;function yr(e){return sft.visit(e)}var t2=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndext.nullable)}function c3(e){return e.reduce((t,r)=>t+r.nullCount,0)}function u3(e){return e.reduce((t,r,i)=>(t[i+1]=t[i]+r.length,t),new Uint32Array(e.length+1))}function h3(e,t,r,i){let s=[];for(let n=-1,o=e.length;++n=i)break;if(r>=f+_)continue;if(f>=r&&f+_<=i){s.push(c);continue}let w=Math.max(0,r-f),I=Math.min(i-f,_);s.push(c.slice(w,I-w))}return s.length===0&&s.push(e[0].slice(0,0)),s}function PO(e,t,r,i){let s=0,n=0,o=t.length-1;do{if(s>=o-1)return r0?0:-1}function aft(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let i=0;for(let s of new bg(r,e.offset+(t||0),e.length,r,l3)){if(!s)return i;++i}return-1}function Qr(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case Ot.Union:break;case Ot.Dictionary:break;default:return aft(e,r)}let i=go.getVisitFn(e),s=pm(t);for(let n=(r||0)-1,o=e.length;++n{let s=e.data[i];return s.values.subarray(0,s.length)[Symbol.iterator]()});let r=0;return new t2(e.data.length,i=>{let n=e.data[i].length,o=e.slice(r,r+n);return r+=n,new IO(o)})}var IO=class{constructor(t){this.vector=t,this.index=0}next(){return this.indexc.data):t;if(n.length===0||n.some(c=>!(c instanceof Fi)))throw new TypeError(\"Vector constructor expects an Array of Data instances.\");let o=(r=n[0])===null||r===void 0?void 0:r.type;switch(n.length){case 0:this._offsets=[0];break;case 1:{let{get:c,set:f,indexOf:_}=JW[o.typeId],w=n[0];this.isValid=I=>e2(w,I),this.get=I=>c(w,I),this.set=(I,R)=>f(w,I,R),this.indexOf=I=>_(w,I),this._offsets=[0,w.length];break}default:Object.setPrototypeOf(this,tH[o.typeId]),this._offsets=u3(n);break}this.data=n,this.type=o,this.stride=ou(o),this.numChildren=(s=(i=o.children)===null||i===void 0?void 0:i.length)!==null&&s!==void 0?s:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return $W(this.data)}get nullCount(){return c3(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${Ot[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(xg(t,this.length))}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return bv.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new e(Kw(this,t,r,({data:i,_offsets:s},n,o)=>h3(i,s,n,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:i,stride:s,ArrayType:n}=this;switch(t.typeId){case Ot.Int:case Ot.Float:case Ot.Decimal:case Ot.Time:case Ot.Timestamp:switch(r.length){case 0:return new n;case 1:return r[0].values.subarray(0,i*s);default:return r.reduce((o,{values:c,length:f})=>(o.array.set(c.subarray(0,f*s),o.offset),o.offset+=f*s,o),{array:new n(i*s),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(\",\")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&tr[t])):null}get isMemoized(){return ze.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(ze.isDictionary(this.type)){let t=new p3(this.data[0].dictionary),r=this.data.map(i=>{let s=i.clone();return s.dictionary=t,s});return new e(r)}return new p3(this)}unmemoize(){if(ze.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(i=>{let s=i.clone();return s.dictionary=t,s});return new e(r)}return this}};KW=Symbol.toStringTag;xr[KW]=(e=>{e.type=ze.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(Ot).map(r=>Ot[r]).filter(r=>typeof r==\"number\"&&r!==Ot.NONE);for(let r of t){let i=go.getVisitFnByTypeId(r),s=ba.getVisitFnByTypeId(r),n=Tg.getVisitFnByTypeId(r);JW[r]={get:i,set:s,indexOf:n},tH[r]=Object.create(e,{isValid:{value:xv(e2)},get:{value:xv(go.getVisitFnByTypeId(r))},set:{value:f3(ba.getVisitFnByTypeId(r))},indexOf:{value:d3(Tg.getVisitFnByTypeId(r))}})}return\"Vector\"})(xr.prototype);var p3=class e extends xr{constructor(t){super(t.data);let r=this.get,i=this.set,s=this.slice,n=new Array(this.length);Object.defineProperty(this,\"get\",{value(o){let c=n[o];if(c!==void 0)return c;let f=r.call(this,o);return n[o]=f,f}}),Object.defineProperty(this,\"set\",{value(o,c){i.call(this,o,c),n[o]=c}}),Object.defineProperty(this,\"slice\",{value:(o,c)=>new e(s.call(this,o,c))}),Object.defineProperty(this,\"isMemoized\",{value:!0}),Object.defineProperty(this,\"unmemoize\",{value:()=>new xr(this.data)}),Object.defineProperty(this,\"memoize\",{value:()=>this})}};function eH(e){if(!e||e.length<=0)return function(s){return!0};let t=\"\",r=e.filter(i=>i===i);return r.length>0&&(t=`\n switch (x) {${r.map(i=>`\n case ${lft(i)}:`).join(\"\")}\n return false;\n }`),e.length!==r.length&&(t=`if (x !== x) return false;\n${t}`),new Function(\"x\",`${t}\nreturn true;`)}function lft(e){return typeof e!=\"bigint\"?Jh(e):`${Jh(e)}n`}function CO(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function rH(e,t=0){return e.length>=t?e.subarray(0,t):Ew(new e.constructor(t),e,0)}var nf=class{constructor(t,r=0,i=1){this.length=Math.ceil(r/i),this.buffer=new t(this.length),this.stride=i,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,i=this.length*r,s=this.buffer.length;i>=s&&this._resize(s===0?CO(i*1,this.BYTES_PER_ELEMENT):CO(i*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=CO(t*this.stride,this.BYTES_PER_ELEMENT);let r=rH(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=rH(this.buffer,t)}},gp=class extends nf{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},wv=class extends gp{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:i}=this.reserve(t-this.length+1),s=t>>3,n=t%8,o=i[s]>>n&1;return r?o===0&&(i[s]|=1<=0&&s.fill(s[i],i,t),s[t]=s[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var Xn=class{static throughNode(t){throw new Error('\"throughNode\" not available in this environment')}static throughDOM(t){throw new Error('\"throughDOM\" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=ou(t),this._nulls=new wv,r&&r.length>0&&(this._isValid=eH(r))}toVector(){return new xr([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:i,_nulls:s,_typeIds:n,children:o}=this;return r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),n&&(t+=n.byteLength),o.reduce((c,f)=>c+f.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,i)=>r+i.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type \"${this.type}\"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,i,s,{type:n,length:o,nullCount:c,_typeIds:f,_offsets:_,_values:w,_nulls:I}=this;(r=f?.flush(o))?s=_?.flush(o):(s=_?.flush(o))?t=w?.flush(_.last()):t=w?.flush(o),c>0&&(i=I?.flush(o));let R=this.children.map(N=>N.flush());return this.clear(),yr({type:n,length:o,nullCount:c,children:R,child:R[0],data:t,typeIds:r,nullBitmap:i,valueOffsets:s})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,i,s;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(i=this._offsets)===null||i===void 0||i.clear(),(s=this._typeIds)===null||s===void 0||s.clear();for(let n of this.children)n.clear();return this}};Xn.prototype.length=1;Xn.prototype.stride=1;Xn.prototype.children=null;Xn.prototype.finished=!1;Xn.prototype.nullValues=null;Xn.prototype._isValid=()=>!0;var _o=class extends Xn{constructor(t){super(t),this._values=new gp(this.ArrayType,0,this.stride)}setValue(t,r){let i=this._values;return i.reserve(t-i.length+1),super.setValue(t,r)}},gc=class extends Xn{constructor(t){super(t),this._pendingLength=0,this._offsets=new Sv(t.type)}setValue(t,r){let i=this._pending||(this._pending=new Map),s=i.get(t);s&&(this._pendingLength-=s.length),this._pendingLength+=r instanceof od?r[dm].length:r.length,i.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}};var Mg=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,r,i,s){return t.prep(8,24),t.writeInt64(BigInt(s??0)),t.pad(4),t.writeInt32(i),t.writeInt64(BigInt(r??0)),t.offset()}};var au=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):sn.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new fc).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new Mg).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let i=this.bb.__offset(this.bb_pos,10);return i?(r||new Mg).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new Fo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,sn.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}};var an=class e{constructor(t=[],r,i,s=sn.V5){this.fields=t||[],this.metadata=r||new Map,i||(i=LO(t)),this.dictionaries=i,this.metadataVersion=s}get[Symbol.toStringTag](){return\"Schema\"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(\", \")} }>`}select(t){let r=new Set(t),i=this.fields.filter(s=>r.has(s.name));return new e(i,this.metadata)}selectAt(t){let r=t.map(i=>this.fields[i]).filter(Boolean);return new e(r,this.metadata)}assign(...t){let r=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),i=[...this.fields],s=A3(A3(new Map,this.metadata),r.metadata),n=r.fields.filter(c=>{let f=i.findIndex(_=>_.name===c.name);return~f?(i[f]=c.clone({metadata:A3(A3(new Map,i[f].metadata),c.metadata)}))&&!1:!0}),o=LO(n,new Map);return new e([...i,...n],s,new Map([...this.dictionaries,...o]))}};an.prototype.fields=null;an.prototype.metadata=null;an.prototype.dictionaries=null;var si=class e{static new(...t){let[r,i,s,n]=t;return t[0]&&typeof t[0]==\"object\"&&({name:r}=t[0],i===void 0&&(i=t[0].type),s===void 0&&(s=t[0].nullable),n===void 0&&(n=t[0].metadata)),new e(`${r}`,i,s,n)}constructor(t,r,i=!1,s){this.name=t,this.type=r,this.nullable=i,this.metadata=s||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return\"Field\"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,i,s,n]=t;return!t[0]||typeof t[0]!=\"object\"?[r=this.name,i=this.type,s=this.nullable,n=this.metadata]=t:{name:r=this.name,type:i=this.type,nullable:s=this.nullable,metadata:n=this.metadata}=t[0],e.new(r,i,s,n)}};si.prototype.type=null;si.prototype.name=null;si.prototype.nullable=null;si.prototype.metadata=null;function A3(e,t){return new Map([...e||new Map,...t||new Map])}function LO(e,t=new Map){for(let r=-1,i=e.length;++r0&&LO(n.children,t)}return t}var cft=vg,uft=nu,_p=class{static decode(t){t=new uft(Rr(t));let r=au.getRootAsFooter(t),i=an.decode(r.schema(),new Map,r.version());return new kO(i,r)}static encode(t){let r=new cft,i=an.encode(r,t.schema);au.startRecordBatchesVector(r,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())yp.encode(r,o);let s=r.endVector();au.startDictionariesVector(r,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())yp.encode(r,o);let n=r.endVector();return au.startFooter(r),au.addSchema(r,i),au.addVersion(r,sn.V5),au.addRecordBatches(r,s),au.addDictionaries(r,n),au.finishFooterBuffer(r,au.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=sn.V5,i,s){this.schema=t,this.version=r,i&&(this._recordBatches=i),s&&(this._dictionaryBatches=s)}*recordBatches(){for(let t,r=-1,i=this.numRecordBatches;++r=0&&t=0&&t=0&&t=0&&tthis._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return ar(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(Vn);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return xa.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return xa.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return ar(this,void 0,void 0,function*(){return yield this.abort(t),Vn})}return(t){return ar(this,void 0,void 0,function*(){return yield this.close(),Vn})}read(t){return ar(this,void 0,void 0,function*(){return(yield this.next(t,\"read\")).value})}peek(t){return ar(this,void 0,void 0,function*(){return(yield this.next(t,\"peek\")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,i)=>{this.resolvers.push({resolve:r,reject:i})}):Promise.resolve(Vn)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error(\"AsyncQueue is closed\")}};var ad=class extends m3{write(t){if((t=Rr(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Tw(this.toUint8Array(!0)):this.toUint8Array(!1).then(Tw)}toUint8Array(t=!1){return t?iu(this._values)[0]:ar(this,void 0,void 0,function*(){var r,i,s,n;let o=[],c=0;try{for(var f=!0,_=Zh(this),w;w=yield _.next(),r=w.done,!r;f=!0){n=w.value,f=!1;let I=n;o.push(I),c+=I.byteLength}}catch(I){i={error:I}}finally{try{!f&&!r&&(s=_.return)&&(yield s.call(_))}finally{if(i)throw i.error}}return iu(o,c)[0]})}},ld=class{constructor(t){t&&(this.source=new RO(xa.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},$u=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof ad?this.source=new vp(xa.fromAsyncIterable(t)):OP(t)?this.source=new vp(xa.fromNodeStream(t)):Mw(t)?this.source=new vp(xa.fromDOMStream(t)):RP(t)?this.source=new vp(xa.fromDOMStream(t.body)):Yh(t)?this.source=new vp(xa.fromIterable(t)):ru(t)?this.source=new vp(xa.fromAsyncIterable(t)):Nu(t)&&(this.source=new vp(xa.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},RO=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,\"peek\").value}read(t){return this.next(t,\"read\").value}next(t,r=\"read\"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||Vn)}return(t){return Object.create(this.source.return&&this.source.return(t)||Vn)}},vp=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return ar(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return ar(this,void 0,void 0,function*(){return(yield this.next(t,\"read\")).value})}peek(t){return ar(this,void 0,void 0,function*(){return(yield this.next(t,\"peek\")).value})}next(t){return ar(this,arguments,void 0,function*(r,i=\"read\"){return yield this.source.next({cmd:i,size:r})})}throw(t){return ar(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||Vn;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return ar(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||Vn;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}};var i2=class extends ld{constructor(t,r){super(),this.position=0,this.buffer=Rr(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:i}=this.readAt(t,4);return new DataView(r,i).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),tn2,Int128:()=>s2,Int64:()=>xp,Uint64:()=>gs});function Tv(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var Mv=8,DO=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],n2=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),i=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),s=r[3]*i[3];this.buffer[0]=s&65535;let n=s>>>16;return s=r[2]*i[3],n+=s,s=r[3]*i[2]>>>0,n+=s,this.buffer[0]+=n<<16,this.buffer[1]=n>>>0>>16,this.buffer[1]+=r[1]*i[3]+r[2]*i[2]+r[3]*i[1],this.buffer[1]+=r[0]*i[3]+r[1]*i[2]+r[2]*i[1]+r[3]*i[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(t){return this.buffer[1]>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]>>0&&++r[1],r[1]>>0&&++r[2],r[2]>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${Tv(this.buffer[3])} ${Tv(this.buffer[2])} ${Tv(this.buffer[1])} ${Tv(this.buffer[0])}`}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return e.fromString(typeof t==\"string\"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let i=t.startsWith(\"-\"),s=t.length,n=new e(r);for(let o=i?1:0;o0&&this.readData(t,i)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:i}=this.nextBufferRange()){return this.bytes.subarray(i,i+r)}readDictionary(t){return this.dictionaries.get(t.id)}},g3=class extends o2{constructor(t,r,i,s,n){super(new Uint8Array(0),r,i,s,n),this.sources=t}readNullBitmap(t,r,{offset:i}=this.nextBufferRange()){return r<=0?new Uint8Array(0):Sg(this.sources[i])}readOffsets(t,{offset:r}=this.nextBufferRange()){return Ai(Uint8Array,Ai(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return Ai(Uint8Array,Ai(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:i}=this;return ze.isTimestamp(t)?Ai(Uint8Array,xp.convertArray(i[r])):(ze.isInt(t)||ze.isTime(t))&&t.bitWidth===64||ze.isDuration(t)?Ai(Uint8Array,xp.convertArray(i[r])):ze.isDate(t)&&t.unit===Os.MILLISECOND?Ai(Uint8Array,xp.convertArray(i[r])):ze.isDecimal(t)?Ai(Uint8Array,s2.convertArray(i[r])):ze.isBinary(t)||ze.isLargeBinary(t)||ze.isFixedSizeBinary(t)?hft(i[r]):ze.isBool(t)?Sg(i[r]):ze.isUtf8(t)||ze.isLargeUtf8(t)?Jf(i[r].join(\"\")):Ai(Uint8Array,Ai(t.ArrayType,i[r].map(s=>+s)))}};function hft(e){let t=e.join(\"\"),r=new Uint8Array(t.length/2);for(let i=0;i>1]=Number.parseInt(t.slice(i,i+2),16);return r}var Pg=class extends gc{constructor(t){super(t),this._values=new nf(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Rr(r))}_flushPending(t,r){let i=this._offsets,s=this._values.reserve(r).buffer,n=0;for(let[o,c]of t)if(c===void 0)i.set(o,0);else{let f=c.length;s.set(c,n),i.set(o,f),n+=f}}};var Ig=class extends gc{constructor(t){super(t),this._values=new nf(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Rr(r))}_flushPending(t,r){let i=this._offsets,s=this._values.reserve(r).buffer,n=0;for(let[o,c]of t)if(c===void 0)i.set(o,BigInt(0));else{let f=c.length;s.set(c,n),i.set(o,BigInt(f)),n+=f}}};var mm=class extends Xn{constructor(t){super(t),this._values=new wv}setValue(t,r){this._values.set(t,+r)}};var gm=class extends _o{};gm.prototype._setValue=pO;var Ev=class extends gm{};Ev.prototype._setValue=WP;var Pv=class extends gm{};Pv.prototype._setValue=HP;var Iv=class extends _o{};Iv.prototype._setValue=gO;var a2=class extends Xn{constructor({type:t,nullValues:r,dictionaryHashFunction:i}){super({type:new mc(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Cg({type:this.type.indices,nullValues:r}),this.dictionary=Cg({type:this.type.dictionary,nullValues:null}),typeof i==\"function\"&&(this.valueToKey=i)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let i=this.indices;return r=i.setValid(t,r),this.length=i.length,r}setValue(t,r){let i=this._keysToIndices,s=this.valueToKey(r),n=i[s];return n===void 0&&(i[s]=n=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,n)}flush(){let t=this.type,r=this._dictionary,i=this.dictionary.toVector(),s=this.indices.flush().clone(t);return s.dictionary=r?r.concat(i):i,this.finished||(this._dictionaryOffset+=i.length),this._dictionary=s.dictionary,this.clear(),s}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t==\"string\"?t:`${t}`}};var Cv=class extends _o{};Cv.prototype._setValue=dO;var l2=class extends Xn{setValue(t,r){let[i]=this.children,s=t*this.stride;for(let n=-1,o=r.length;++n0)throw new Error(\"FixedSizeListBuilder can only have one child.\");let i=this.children.push(t);return this.type=new Ll(this.type.listSize,new si(r,t.type,!0)),i}};var _m=class extends _o{setValue(t,r){this._values.set(t,r)}},c2=class extends _m{setValue(t,r){super.setValue(t,Xw(r))}},u2=class extends _m{},h2=class extends _m{};var ym=class extends _o{};ym.prototype._setValue=_O;var Lv=class extends ym{};Lv.prototype._setValue=t3;var kv=class extends ym{};kv.prototype._setValue=e3;var cd=class extends _o{};cd.prototype._setValue=yO;var Rv=class extends cd{};Rv.prototype._setValue=r3;var Dv=class extends cd{};Dv.prototype._setValue=i3;var Ov=class extends cd{};Ov.prototype._setValue=n3;var Bv=class extends cd{};Bv.prototype._setValue=s3;var lu=class extends _o{setValue(t,r){this._values.set(t,r)}},f2=class extends lu{},d2=class extends lu{},p2=class extends lu{},A2=class extends lu{},m2=class extends lu{},g2=class extends lu{},_2=class extends lu{},y2=class extends lu{};var v2=class extends gc{constructor(t){super(t),this._offsets=new Sv(t.type)}addChild(t,r=\"0\"){if(this.numChildren>0)throw new Error(\"ListBuilder can only have one child.\");return this.children[this.numChildren]=t,this.type=new sl(new si(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[i]=this.children;for(let[s,n]of t)if(typeof n>\"u\")r.set(s,0);else{let o=n,c=o.length,f=r.set(s,c).buffer[s];for(let _=-1;++_0)throw new Error(\"ListBuilder can only have one child.\");return this.children[this.numChildren]=t,this.type=new Ac(new si(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[i]=this.children;for(let[s,n]of t)if(n===void 0)r.set(s,0);else{let{[s]:o,[s+1]:c}=r.set(s,n.size).buffer;for(let f of n.entries())if(i.set(o,f),++o>=c)break}}};var b2=class extends Xn{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var w2=class extends Xn{setValue(t,r){let{children:i,type:s}=this;switch(Array.isArray(r)||r.constructor){case!0:return s.children.forEach((n,o)=>i[o].set(t,r[o]));case Map:return s.children.forEach((n,o)=>i[o].set(t,r.get(n.name)));default:return s.children.forEach((n,o)=>i[o].set(t,r[n.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(i=>i.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let i=this.children.push(t);return this.type=new pn([...this.type.children,new si(r,t.type,!0)]),i}};var ud=class extends _o{};ud.prototype._setValue=AO;var Fv=class extends ud{};Fv.prototype._setValue=qP;var zv=class extends ud{};zv.prototype._setValue=ZP;var Nv=class extends ud{};Nv.prototype._setValue=YP;var Uv=class extends ud{};Uv.prototype._setValue=QP;var hd=class extends _o{};hd.prototype._setValue=mO;var Vv=class extends hd{};Vv.prototype._setValue=$P;var jv=class extends hd{};jv.prototype._setValue=XP;var Gv=class extends hd{};Gv.prototype._setValue=KP;var Wv=class extends hd{};Wv.prototype._setValue=JP;var Lg=class extends Xn{constructor(t){super(t),this._typeIds=new gp(Int8Array,0,1),typeof t.valueToChildTypeId==\"function\"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,i){return i===void 0&&(i=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,i),this}setValue(t,r,i){this._typeIds.set(t,i);let s=this.type.typeIdToChildIndex[i],n=this.children[s];n?.set(t,r)}addChild(t,r=`${this.children.length}`){let i=this.children.push(t),{type:{children:s,mode:n,typeIds:o}}=this,c=[...s,new si(r,t.type)];return this.type=new pc(n,[...o,i],c),i}_valueToChildTypeId(t,r,i){throw new Error(\"Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.\")}},S2=class extends Lg{},T2=class extends Lg{constructor(t){super(t),this._offsets=new gp(Int32Array)}setValue(t,r,i){let s=this._typeIds.set(t,i).buffer[t],n=this.getChildAt(this.type.typeIdToChildIndex[s]),o=this._offsets.set(t,n.length).buffer[t];n?.set(o,r)}};var Hv=class extends gc{constructor(t){super(t),this._values=new nf(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Jf(r))}_flushPending(t,r){}};Hv.prototype._flushPending=Pg.prototype._flushPending;var qv=class extends gc{constructor(t){super(t),this._values=new nf(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Jf(r))}_flushPending(t,r){}};qv.prototype._flushPending=Ig.prototype._flushPending;var BO=class extends Er{visitNull(){return b2}visitBool(){return mm}visitInt(){return lu}visitInt8(){return f2}visitInt16(){return d2}visitInt32(){return p2}visitInt64(){return A2}visitUint8(){return m2}visitUint16(){return g2}visitUint32(){return _2}visitUint64(){return y2}visitFloat(){return _m}visitFloat16(){return c2}visitFloat32(){return u2}visitFloat64(){return h2}visitUtf8(){return Hv}visitLargeUtf8(){return qv}visitBinary(){return Pg}visitLargeBinary(){return Ig}visitFixedSizeBinary(){return Cv}visitDate(){return gm}visitDateDay(){return Ev}visitDateMillisecond(){return Pv}visitTimestamp(){return ud}visitTimestampSecond(){return Fv}visitTimestampMillisecond(){return zv}visitTimestampMicrosecond(){return Nv}visitTimestampNanosecond(){return Uv}visitTime(){return hd}visitTimeSecond(){return Vv}visitTimeMillisecond(){return jv}visitTimeMicrosecond(){return Gv}visitTimeNanosecond(){return Wv}visitDecimal(){return Iv}visitList(){return v2}visitStruct(){return w2}visitUnion(){return Lg}visitDenseUnion(){return T2}visitSparseUnion(){return S2}visitDictionary(){return a2}visitInterval(){return ym}visitIntervalDayTime(){return Lv}visitIntervalYearMonth(){return kv}visitDuration(){return cd}visitDurationSecond(){return Rv}visitDurationMillisecond(){return Dv}visitDurationMicrosecond(){return Ov}visitDurationNanosecond(){return Bv}visitFixedSizeList(){return l2}visitMap(){return x2}},iH=new BO;var Lr=class extends Er{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((i,s)=>this.compareFields(i,r[s]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};function kl(e,t){return t instanceof e.constructor}function kg(e,t){return e===t||kl(e,t)}function bp(e,t){return e===t||kl(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function _3(e,t){return e===t||kl(e,t)&&e.precision===t.precision}function fft(e,t){return e===t||kl(e,t)&&e.byteWidth===t.byteWidth}function FO(e,t){return e===t||kl(e,t)&&e.unit===t.unit}function M2(e,t){return e===t||kl(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function E2(e,t){return e===t||kl(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function dft(e,t){return e===t||kl(e,t)&&e.children.length===t.children.length&&fd.compareManyFields(e.children,t.children)}function pft(e,t){return e===t||kl(e,t)&&e.children.length===t.children.length&&fd.compareManyFields(e.children,t.children)}function zO(e,t){return e===t||kl(e,t)&&e.mode===t.mode&&e.typeIds.every((r,i)=>r===t.typeIds[i])&&fd.compareManyFields(e.children,t.children)}function Aft(e,t){return e===t||kl(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&fd.visit(e.indices,t.indices)&&fd.visit(e.dictionary,t.dictionary)}function NO(e,t){return e===t||kl(e,t)&&e.unit===t.unit}function P2(e,t){return e===t||kl(e,t)&&e.unit===t.unit}function mft(e,t){return e===t||kl(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&fd.compareManyFields(e.children,t.children)}function gft(e,t){return e===t||kl(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&fd.compareManyFields(e.children,t.children)}Lr.prototype.visitNull=kg;Lr.prototype.visitBool=kg;Lr.prototype.visitInt=bp;Lr.prototype.visitInt8=bp;Lr.prototype.visitInt16=bp;Lr.prototype.visitInt32=bp;Lr.prototype.visitInt64=bp;Lr.prototype.visitUint8=bp;Lr.prototype.visitUint16=bp;Lr.prototype.visitUint32=bp;Lr.prototype.visitUint64=bp;Lr.prototype.visitFloat=_3;Lr.prototype.visitFloat16=_3;Lr.prototype.visitFloat32=_3;Lr.prototype.visitFloat64=_3;Lr.prototype.visitUtf8=kg;Lr.prototype.visitLargeUtf8=kg;Lr.prototype.visitBinary=kg;Lr.prototype.visitLargeBinary=kg;Lr.prototype.visitFixedSizeBinary=fft;Lr.prototype.visitDate=FO;Lr.prototype.visitDateDay=FO;Lr.prototype.visitDateMillisecond=FO;Lr.prototype.visitTimestamp=M2;Lr.prototype.visitTimestampSecond=M2;Lr.prototype.visitTimestampMillisecond=M2;Lr.prototype.visitTimestampMicrosecond=M2;Lr.prototype.visitTimestampNanosecond=M2;Lr.prototype.visitTime=E2;Lr.prototype.visitTimeSecond=E2;Lr.prototype.visitTimeMillisecond=E2;Lr.prototype.visitTimeMicrosecond=E2;Lr.prototype.visitTimeNanosecond=E2;Lr.prototype.visitDecimal=kg;Lr.prototype.visitList=dft;Lr.prototype.visitStruct=pft;Lr.prototype.visitUnion=zO;Lr.prototype.visitDenseUnion=zO;Lr.prototype.visitSparseUnion=zO;Lr.prototype.visitDictionary=Aft;Lr.prototype.visitInterval=NO;Lr.prototype.visitIntervalDayTime=NO;Lr.prototype.visitIntervalYearMonth=NO;Lr.prototype.visitDuration=P2;Lr.prototype.visitDurationSecond=P2;Lr.prototype.visitDurationMillisecond=P2;Lr.prototype.visitDurationMicrosecond=P2;Lr.prototype.visitDurationNanosecond=P2;Lr.prototype.visitFixedSizeList=mft;Lr.prototype.visitMap=gft;var fd=new Lr;function Rg(e,t){return fd.compareSchemas(e,t)}function nH(e,t){return fd.compareFields(e,t)}function sH(e,t){return fd.visit(e,t)}function Cg(e){let t=e.type,r=new(iH.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let i=e.children||[],s={nullValues:e.nullValues},n=Array.isArray(i)?(o,c)=>i[c]||s:({name:o})=>i[o]||s;for(let[o,c]of t.children.entries()){let{type:f}=c,_=n(c,o);r.children.push(Cg(Object.assign(Object.assign({},_),{type:f})))}}return r}function y3(e,t){return _ft(e,t.map(r=>r.data.concat()))}function _ft(e,t){let r=[...e.fields],i=[],s={numBatches:t.reduce((I,R)=>Math.max(I,R.length),0)},n=0,o=0,c=-1,f=t.length,_,w=[];for(;s.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,c=-1;++c0&&(i[n++]=yr({type:new pn(r),length:o,nullCount:0,children:w.slice()})))}return[e=e.assign(r),i.map(I=>new Fs(e,I))]}function yft(e,t,r,i,s){var n;let o=(t+63&-64)>>3;for(let c=-1,f=i.length;++c=t)w===t?r[c]=_:(r[c]=_.slice(0,t),s.numBatches=Math.max(s.numBatches,i[c].unshift(_.slice(t,w-t))));else{let I=e[c];e[c]=I.clone({nullable:!0}),r[c]=(n=_?._changeLengthAndBackfillNullBitmap(t))!==null&&n!==void 0?n:yr({type:I.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return r}var aH,wa=class e{constructor(...t){var r,i;if(t.length===0)return this.batches=[],this.schema=new an([]),this._offsets=[0],this;let s,n;t[0]instanceof an&&(s=t.shift()),t.at(-1)instanceof Uint32Array&&(n=t.pop());let o=f=>{if(f){if(f instanceof Fs)return[f];if(f instanceof e)return f.batches;if(f instanceof Fi){if(f.type instanceof pn)return[new Fs(new an(f.type.children),f)]}else{if(Array.isArray(f))return f.flatMap(_=>o(_));if(typeof f[Symbol.iterator]==\"function\")return[...f].flatMap(_=>o(_));if(typeof f==\"object\"){let _=Object.keys(f),w=_.map(N=>new xr([f[N]])),I=s??new an(_.map((N,j)=>new si(String(N),w[j].type,w[j].nullable))),[,R]=y3(I,w);return R.length===0?[new Fs(f)]:R}}}return[]},c=t.flatMap(f=>o(f));if(s=(i=s??((r=c[0])===null||r===void 0?void 0:r.schema))!==null&&i!==void 0?i:new an([]),!(s instanceof an))throw new TypeError(\"Table constructor expects a [Schema, RecordBatch[]] pair.\");for(let f of c){if(!(f instanceof Fs))throw new TypeError(\"Table constructor expects a [Schema, RecordBatch[]] pair.\");if(!Rg(s,f.schema))throw new TypeError(\"Table and inner RecordBatch schemas must be equivalent.\")}this.schema=s,this.batches=c,this._offsets=n??u3(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=c3(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(xg(t,this.numRows))}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?bv.visit(new xr(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[\n ${this.toArray().join(`,\n `)}\n]`}concat(...t){let r=this.schema,i=this.data.concat(t.flatMap(({data:s})=>s));return new e(r,i.map(s=>new Fs(r,s)))}slice(t,r){let i=this.schema;[t,r]=Kw({length:this.numRows},t,r);let s=h3(this.data,this._offsets,t,r);return new e(i,s.map(n=>new Fs(i,n)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&ti.children[t]);if(r.length===0){let{type:i}=this.schema.fields[t],s=yr({type:i,length:0,nullCount:0});r.push(s._changeLengthAndBackfillNullBitmap(this.numRows))}return new xr(r)}return null}setChild(t,r){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(s=>s.name===t),r)}setChildAt(t,r){let i=this.schema,s=[...this.batches];if(t>-1&&tthis.getChildAt(_));[n[t],c[t]]=[o,r],[i,s]=y3(i,c)}return new e(i,s)}select(t){let r=this.schema.fields.reduce((i,s,n)=>i.set(s.name,n),new Map);return this.selectAt(t.map(i=>r.get(i)).filter(i=>i>-1))}selectAt(t){let r=this.schema.selectAt(t),i=this.batches.map(s=>s.selectAt(t));return new e(r,i)}assign(t){let r=this.schema.fields,[i,s]=t.schema.fields.reduce((c,f,_)=>{let[w,I]=c,R=r.findIndex(N=>N.name===f.name);return~R?I[R]=_:w.push(_),c},[[],[]]),n=this.schema.assign(t.schema),o=[...r.map((c,f)=>[f,s[f]]).map(([c,f])=>f===void 0?this.getChildAt(c):t.getChildAt(f)),...i.map(c=>t.getChildAt(c))].filter(Boolean);return new e(...y3(n,o))}};aH=Symbol.toStringTag;wa[aH]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=xv(e2),e.get=xv(go.getVisitFn(Ot.Struct)),e.set=f3(ba.getVisitFn(Ot.Struct)),e.indexOf=d3(Tg.getVisitFn(Ot.Struct)),\"Table\"))(wa.prototype);var cH,Fs=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof an))throw new TypeError(\"RecordBatch constructor expects a [Schema, Data] pair.\");if([,this.data=yr({nullCount:0,type:new pn(this.schema.fields),children:this.schema.fields.map(r=>yr({type:r.type,nullCount:0}))})]=t,!(this.data instanceof Fi))throw new TypeError(\"RecordBatch constructor expects a [Schema, Data] pair.\");[this.schema,this.data]=lH(this.schema,this.data.children);break}case 1:{let[r]=t,{fields:i,children:s,length:n}=Object.keys(r).reduce((f,_,w)=>(f.children[w]=r[_],f.length=Math.max(f.length,r[_].length),f.fields[w]=si.new({name:_,type:r[_].type,nullable:!0}),f),{length:0,fields:new Array,children:new Array}),o=new an(i),c=yr({type:new pn(i),length:n,children:s,nullCount:0});[this.schema,this.data]=lH(o,c.children,n);break}default:throw new TypeError(\"RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.\")}}get dictionaries(){return this._dictionaries||(this._dictionaries=uH(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return go.visit(this.data,t)}at(t){return this.get(xg(t,this.numRows))}set(t,r){return ba.visit(this.data,t,r)}indexOf(t,r){return Tg.visit(this.data,t,r)}[Symbol.iterator](){return bv.visit(new xr([this.data]))}toArray(){return[...this]}concat(...t){return new wa(this.schema,[this,...t])}slice(t,r){let[i]=new xr([this.data]).slice(t,r).data;return new e(this.schema,i)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&ts.name===t),r)}setChildAt(t,r){let i=this.schema,s=this.data;if(t>-1&&tc.name===n);~o&&(s[o]=this.data.children[o])}return new e(r,yr({type:i,length:this.numRows,children:s}))}selectAt(t){let r=this.schema.selectAt(t),i=t.map(n=>this.data.children[n]).filter(Boolean),s=yr({type:new pn(r.fields),length:this.numRows,children:i});return new e(r,s)}};cH=Symbol.toStringTag;Fs[cH]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,\"RecordBatch\"))(Fs.prototype);function lH(e,t,r=t.reduce((i,s)=>Math.max(i,s.length),0)){var i;let s=[...e.fields],n=[...t],o=(r+63&-64)>>3;for(let[c,f]of e.fields.entries()){let _=t[c];(!_||_.length!==r)&&(s[c]=f.clone({nullable:!0}),n[c]=(i=_?._changeLengthAndBackfillNullBitmap(r))!==null&&i!==void 0?i:yr({type:f.type,length:r,nullCount:r,nullBitmap:new Uint8Array(o)}))}return[e.assign(s),yr({type:new pn(s),length:r,children:n})]}function uH(e,t,r=new Map){var i,s;if(((i=e?.length)!==null&&i!==void 0?i:0)>0&&e?.length===t?.length)for(let n=-1,o=e.length;++nyr({type:s.type})),i=yr({type:new pn(t.fields),nullCount:0,children:r});super(t,i)}};var sf=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):sn.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):wi.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt(\"0\")}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new Fo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,sn.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,wi.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt(\"0\"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,i,s,n,o){return e.startMessage(t),e.addVersion(t,r),e.addHeaderType(t,i),e.addHeader(t,s),e.addBodyLength(t,n),e.addCustomMetadata(t,o),e.endMessage(t)}};var UO=class extends Er{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return Fw.startNull(r),Fw.endNull(r)}visitInt(t,r){return Xh.startInt(r),Xh.addBitWidth(r,t.bitWidth),Xh.addIsSigned(r,t.isSigned),Xh.endInt(r)}visitFloat(t,r){return lm.startFloatingPoint(r),lm.addPrecision(r,t.precision),lm.endFloatingPoint(r)}visitBinary(t,r){return kw.startBinary(r),kw.endBinary(r)}visitLargeBinary(t,r){return Dw.startLargeBinary(r),Dw.endLargeBinary(r)}visitBool(t,r){return Rw.startBool(r),Rw.endBool(r)}visitUtf8(t,r){return Nw.startUtf8(r),Nw.endUtf8(r)}visitLargeUtf8(t,r){return Ow.startLargeUtf8(r),Ow.endLargeUtf8(r)}visitDecimal(t,r){return id.startDecimal(r),id.addScale(r,t.scale),id.addPrecision(r,t.precision),id.addBitWidth(r,t.bitWidth),id.endDecimal(r)}visitDate(t,r){return nm.startDate(r),nm.addUnit(r,t.unit),nm.endDate(r)}visitTime(t,r){return pp.startTime(r),pp.addUnit(r,t.unit),pp.addBitWidth(r,t.bitWidth),pp.endTime(r)}visitTimestamp(t,r){let i=t.timezone&&r.createString(t.timezone)||void 0;return Ap.startTimestamp(r),Ap.addUnit(r,t.unit),i!==void 0&&Ap.addTimezone(r,i),Ap.endTimestamp(r)}visitInterval(t,r){return cm.startInterval(r),cm.addUnit(r,t.unit),cm.endInterval(r)}visitDuration(t,r){return sm.startDuration(r),sm.addUnit(r,t.unit),sm.endDuration(r)}visitList(t,r){return Bw.startList(r),Bw.endList(r)}visitStruct(t,r){return zw.startStruct_(r),zw.endStruct_(r)}visitUnion(t,r){Kh.startTypeIdsVector(r,t.typeIds.length);let i=Kh.createTypeIdsVector(r,t.typeIds);return Kh.startUnion(r),Kh.addMode(r,t.mode),Kh.addTypeIds(r,i),Kh.endUnion(r)}visitDictionary(t,r){let i=this.visit(t.indices,r);return rd.startDictionaryEncoding(r),rd.addId(r,BigInt(t.id)),rd.addIsOrdered(r,t.isOrdered),i!==void 0&&rd.addIndexType(r,i),rd.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return om.startFixedSizeBinary(r),om.addByteWidth(r,t.byteWidth),om.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return am.startFixedSizeList(r),am.addListSize(r,t.listSize),am.endFixedSizeList(r)}visitMap(t,r){return um.startMap(r),um.addKeysSorted(r,t.keysSorted),um.endMap(r)}},v3=new UO;function pH(e,t=new Map){return new an(vft(e,t),x3(e.metadata),t)}function VO(e){return new Sa(e.count,mH(e.columns),gH(e.columns))}function AH(e){return new yc(VO(e.data),e.id,e.isDelta)}function vft(e,t){return(e.fields||[]).filter(Boolean).map(r=>si.fromJSON(r,t))}function hH(e,t){return(e.children||[]).filter(Boolean).map(r=>si.fromJSON(r,t))}function mH(e){return(e||[]).reduce((t,r)=>[...t,new Xu(r.count,xft(r.VALIDITY)),...mH(r.children)],[])}function gH(e,t=[]){for(let r=-1,i=(e||[]).length;++rt+ +(r===0),0)}function _H(e,t){let r,i,s,n,o,c;return!t||!(n=e.dictionary)?(o=dH(e,hH(e,t)),s=new si(e.name,o,e.nullable,x3(e.metadata))):t.has(r=n.id)?(i=(i=n.indexType)?fH(i):new ef,c=new mc(t.get(r),i,r,n.isOrdered),s=new si(e.name,c,e.nullable,x3(e.metadata))):(i=(i=n.indexType)?fH(i):new ef,t.set(r,o=dH(e,hH(e,t))),c=new mc(o,i,r,n.isOrdered),s=new si(e.name,c,e.nullable,x3(e.metadata))),s||null}function x3(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function fH(e){return new Bs(e.isSigned,e.bitWidth)}function dH(e,t){let r=e.type.name;switch(r){case\"NONE\":return new ea;case\"null\":return new ea;case\"binary\":return new Vu;case\"largebinary\":return new nd;case\"utf8\":return new ju;case\"largeutf8\":return new sd;case\"bool\":return new dc;case\"list\":return new sl((t||[])[0]);case\"struct\":return new pn(t||[]);case\"struct_\":return new pn(t||[])}switch(r){case\"int\":{let i=e.type;return new Bs(i.isSigned,i.bitWidth)}case\"floatingpoint\":{let i=e.type;return new ra($i[i.precision])}case\"decimal\":{let i=e.type;return new Gu(i.scale,i.precision,i.bitWidth)}case\"date\":{let i=e.type;return new Wu(Os[i.unit])}case\"time\":{let i=e.type;return new Hu(Ar[i.unit],i.bitWidth)}case\"timestamp\":{let i=e.type;return new qu(Ar[i.unit],i.timezone)}case\"interval\":{let i=e.type;return new Zu(Bo[i.unit])}case\"duration\":{let i=e.type;return new Yu(Ar[i.unit])}case\"union\":{let i=e.type,[s,...n]=(i.mode+\"\").toLowerCase(),o=s.toUpperCase()+n.join(\"\");return new pc(Pn[o],i.typeIds||[],t||[])}case\"fixedsizebinary\":{let i=e.type;return new Qu(i.byteWidth)}case\"fixedsizelist\":{let i=e.type;return new Ll(i.listSize,(t||[])[0])}case\"map\":{let i=e.type;return new Ac((t||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: \"${r}\"`)}var bft=vg,wft=nu,vc=class e{static fromJSON(t,r){let i=new e(0,sn.V5,r);return i._createHeader=Sft(t,r),i}static decode(t){t=new wft(Rr(t));let r=sf.getRootAsMessage(t),i=r.bodyLength(),s=r.version(),n=r.headerType(),o=new e(i,s,n);return o._createHeader=Tft(r,n),o}static encode(t){let r=new bft,i=-1;return t.isSchema()?i=an.encode(r,t.header()):t.isRecordBatch()?i=Sa.encode(r,t.header()):t.isDictionaryBatch()&&(i=yc.encode(r,t.header())),sf.startMessage(r),sf.addVersion(r,sn.V5),sf.addHeader(r,i),sf.addHeaderType(r,t.headerType),sf.addBodyLength(r,BigInt(t.bodyLength)),sf.finishMessageBuffer(r,sf.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof an)return new e(0,sn.V5,wi.Schema,t);if(t instanceof Sa)return new e(r,sn.V5,wi.RecordBatch,t);if(t instanceof yc)return new e(r,sn.V5,wi.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===wi.Schema}isRecordBatch(){return this.headerType===wi.RecordBatch}isDictionaryBatch(){return this.headerType===wi.DictionaryBatch}constructor(t,r,i,s){this._version=r,this._headerType=i,this.body=new Uint8Array(0),s&&(this._createHeader=()=>s),this._bodyLength=Wi(t)}},Sa=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,r,i){this._nodes=r,this._buffers=i,this._length=Wi(t)}},yc=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,i=!1){this._data=t,this._isDelta=i,this._id=Wi(r)}},_c=class{constructor(t,r){this.offset=Wi(t),this.length=Wi(r)}},Xu=class{constructor(t,r){this.length=Wi(t),this.nullCount=Wi(r)}};function Sft(e,t){return()=>{switch(t){case wi.Schema:return an.fromJSON(e);case wi.RecordBatch:return Sa.fromJSON(e);case wi.DictionaryBatch:return yc.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${wi[t]}, type: ${t} }`)}}function Tft(e,t){return()=>{switch(t){case wi.Schema:return an.decode(e.header(new fc),new Map,e.version());case wi.RecordBatch:return Sa.decode(e.header(new su),e.version());case wi.DictionaryBatch:return yc.decode(e.header(new dp),e.version())}throw new Error(`Unrecognized Message type: { name: ${wi[t]}, type: ${t} }`)}}si.encode=Bft;si.decode=Dft;si.fromJSON=_H;an.encode=Oft;an.decode=Mft;an.fromJSON=pH;Sa.encode=Fft;Sa.decode=Eft;Sa.fromJSON=VO;yc.encode=zft;yc.decode=Pft;yc.fromJSON=AH;Xu.encode=Nft;Xu.decode=Cft;_c.encode=Uft;_c.decode=Ift;function Mft(e,t=new Map,r=sn.V5){let i=Rft(e,t);return new an(i,b3(e),t,r)}function Eft(e,t=sn.V5){if(e.compression()!==null)throw new Error(\"Record batch compression not implemented\");return new Sa(e.length(),Lft(e),kft(e,t))}function Pft(e,t=sn.V5){return new yc(Sa.decode(e.data(),t),e.id(),e.isDelta())}function Ift(e){return new _c(e.offset(),e.length())}function Cft(e){return new Xu(e.length(),e.nullCount())}function Lft(e){let t=[];for(let r,i=-1,s=-1,n=e.nodesLength();++isi.encode(e,n));fc.startFieldsVector(e,r.length);let i=fc.createFieldsVector(e,r),s=t.metadata&&t.metadata.size>0?fc.createCustomMetadataVector(e,[...t.metadata].map(([n,o])=>{let c=e.createString(`${n}`),f=e.createString(`${o}`);return Fo.startKeyValue(e),Fo.addKey(e,c),Fo.addValue(e,f),Fo.endKeyValue(e)})):-1;return fc.startSchema(e),fc.addFields(e,i),fc.addEndianness(e,Vft?im.Little:im.Big),s!==-1&&fc.addCustomMetadata(e,s),fc.endSchema(e)}function Bft(e,t){let r=-1,i=-1,s=-1,n=t.type,o=t.typeId;ze.isDictionary(n)?(o=n.dictionary.typeId,s=v3.visit(n,e),i=v3.visit(n.dictionary,e)):i=v3.visit(n,e);let c=(n.children||[]).map(w=>si.encode(e,w)),f=nl.createChildrenVector(e,c),_=t.metadata&&t.metadata.size>0?nl.createCustomMetadataVector(e,[...t.metadata].map(([w,I])=>{let R=e.createString(`${w}`),N=e.createString(`${I}`);return Fo.startKeyValue(e),Fo.addKey(e,R),Fo.addValue(e,N),Fo.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),nl.startField(e),nl.addType(e,i),nl.addTypeType(e,o),nl.addChildren(e,f),nl.addNullable(e,!!t.nullable),r!==-1&&nl.addName(e,r),s!==-1&&nl.addDictionary(e,s),_!==-1&&nl.addCustomMetadata(e,_),nl.endField(e)}function Fft(e,t){let r=t.nodes||[],i=t.buffers||[];su.startNodesVector(e,r.length);for(let o of r.slice().reverse())Xu.encode(e,o);let s=e.endVector();su.startBuffersVector(e,i.length);for(let o of i.slice().reverse())_c.encode(e,o);let n=e.endVector();return su.startRecordBatch(e),su.addLength(e,BigInt(t.length)),su.addNodes(e,s),su.addBuffers(e,n),su.endRecordBatch(e)}function zft(e,t){let r=Sa.encode(e,t.data);return dp.startDictionaryBatch(e),dp.addId(e,BigInt(t.id)),dp.addIsDelta(e,t.isDelta),dp.addData(e,r),dp.endDictionaryBatch(e)}function Nft(e,t){return hv.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Uft(e,t){return uv.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var Vft=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var GO=e=>`Expected ${wi[e]} Message in stream, but was null or length 0.`,WO=e=>`Header pointer of flatbuffer-encoded ${wi[e]} Message is null or length 0.`,bH=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,wH=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,Zv=class{constructor(t){this.source=t instanceof ld?t:new ld(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?Vn:t.value===-1&&(t=this.readMetadataLength()).done?Vn:(t=this.readMetadata(t.value)).done?Vn:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(GO(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=Rr(this.source.read(t));if(r.byteLength[...s,...n.VALIDITY&&[n.VALIDITY]||[],...n.TYPE_ID&&[n.TYPE_ID]||[],...n.OFFSET&&[n.OFFSET]||[],...n.DATA&&[n.DATA]||[],...r(n.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(GO(t));return r.value}readSchema(){let t=wi.Schema,r=this.readMessage(t),i=r?.header();if(!r||!i)throw new Error(WO(t));return i}},w3=4,jO=\"ARROW1\",Yv=new Uint8Array(jO.length);for(let e=0;ethis):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return xa.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return xa.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('\"throughNode\" not available in this environment')}static throughDOM(t,r){throw new Error('\"throughDOM\" not available in this environment')}static from(t){return t instanceof e?t:CP(t)?Gft(t):kP(t)?qft(t):ru(t)?ar(this,void 0,void 0,function*(){return yield e.from(yield t)}):RP(t)||Mw(t)||OP(t)||Nu(t)?Hft(new $u(t)):Wft(new ld(t))}static readAll(t){return t instanceof e?t.isSync()?TH(t):MH(t):CP(t)||ArrayBuffer.isView(t)||Yh(t)||LP(t)?TH(t):MH(t)}},wp=class extends cu{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return eu(this,arguments,function*(){yield ii(yield*lv(Zh(this[Symbol.iterator]())))})}},Og=class extends cu{constructor(t){super(t),this._impl=t}readAll(){return ar(this,void 0,void 0,function*(){var t,r,i,s;let n=new Array;try{for(var o=!0,c=Zh(this),f;f=yield c.next(),t=f.done,!t;o=!0){s=f.value,o=!1;let _=s;n.push(_)}}catch(_){r={error:_}}finally{try{!o&&!t&&(i=c.return)&&(yield i.call(c))}finally{if(r)throw r.error}}return n})}[Symbol.iterator](){throw new Error(\"AsyncRecordBatchStreamReader is not Iterable\")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Bg=class extends wp{constructor(t){super(t),this._impl=t}},T3=class extends Og{constructor(t){super(t),this._impl=t}},M3=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r){let i=this._loadVectors(t,r,this.schema.fields),s=yr({type:new pn(this.schema.fields),length:t.length,children:i});return new Fs(this.schema,s)}_loadDictionaryBatch(t,r){let{id:i,isDelta:s}=t,{dictionaries:n,schema:o}=this,c=n.get(i);if(s||!c){let f=o.dictionaries.get(i),_=this._loadVectors(t.data,r,[f]);return(c&&s?c.concat(new xr(_)):new xr(_)).memoize()}return c.memoize()}_loadVectors(t,r,i){return new o2(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}},$v=class extends M3{constructor(t,r){super(r),this._reader=CP(t)?new C2(this._handle=t):new Zv(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=EH(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):Vn}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Vn}next(){if(this.closed)return Vn;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),s=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),s=r.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,n)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Dg(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Xv=class extends M3{constructor(t,r){super(r),this._reader=new I2(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return ar(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return ar(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=EH(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return ar(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Vn})}return(t){return ar(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Vn})}next(){return ar(this,void 0,void 0,function*(){if(this.closed)return Vn;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),s=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),s=yield r.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,n)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Dg(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return ar(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},E3=class extends $v{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,r){super(t instanceof i2?t:new i2(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(i&&this._handle.seek(i.offset)){let s=this._reader.readMessage(wi.RecordBatch);if(s?.isRecordBatch()){let n=s.header(),o=this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(n,o)}}return null}_readDictionaryBatch(t){var r;let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(i&&this._handle.seek(i.offset)){let s=this._reader.readMessage(wi.DictionaryBatch);if(s?.isDictionaryBatch()){let n=s.header(),o=this._reader.readMessageBody(s.bodyLength),c=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,c)}}}_readFooter(){let{_handle:t}=this,r=t.size-HO,i=t.readInt32(r),s=t.readAt(r-i,i);return _p.decode(s)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return ar(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let i of this._footer.dictionaryBatches())i&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){return ar(this,void 0,void 0,function*(){var r;if(this.closed)return null;this._footer||(yield this.open());let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(i&&(yield this._handle.seek(i.offset))){let s=yield this._reader.readMessage(wi.RecordBatch);if(s?.isRecordBatch()){let n=s.header(),o=yield this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(n,o)}}return null})}_readDictionaryBatch(t){return ar(this,void 0,void 0,function*(){var r;let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(i&&(yield this._handle.seek(i.offset))){let s=yield this._reader.readMessage(wi.DictionaryBatch);if(s?.isDictionaryBatch()){let n=s.header(),o=yield this._reader.readMessageBody(s.bodyLength),c=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,c)}}})}_readFooter(){return ar(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-HO,i=yield t.readInt32(r),s=yield t.readAt(r-i,i);return _p.decode(s)})}_readNextMessageAndValidate(t){return ar(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?S3(t)?new Bg(new E3(e.read())):new wp(new $v(e)):new wp(new $v(function*(){}()))}function Hft(e){return ar(this,void 0,void 0,function*(){let t=yield e.peek(Qv+7&-8);return t&&t.byteLength>=4?S3(t)?new Bg(new E3(yield e.read())):new Og(new Xv(e)):new Og(new Xv(function(){return eu(this,arguments,function*(){})}()))})}function qft(e){return ar(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Am(e,t);return t>=SH&&S3(yield r.readAt(0,Qv+7&-8))?new T3(new qO(r)):new Og(new Xv(r))})}var os=class e extends Er{static assemble(...t){let r=s=>s.flatMap(n=>Array.isArray(n)?r(n):n instanceof Fs?n.data.children:n.data),i=new e;return i.visitMany(r(t)),i}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof xr)return this.visitMany(t.data),this;let{type:r}=t;if(!ze.isDictionary(r)){let{length:i}=t;if(i>2147483647)throw new RangeError(\"Cannot write arrays larger than 2^31 - 1 in length\");if(ze.isUnion(r))this.nodes.push(new Xu(i,0));else{let{nullCount:s}=t;ze.isNull(r)||of.call(this,s<=0?new Uint8Array(0):wg(t.offset,i,t.nullBitmap)),this.nodes.push(new Xu(i,s))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function of(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new _c(this._byteLength,t)),this._byteLength+=t,this}function Zft(e){var t;let{type:r,length:i,typeIds:s,valueOffsets:n}=e;if(of.call(this,s),r.mode===Pn.Sparse)return YO.call(this,e);if(r.mode===Pn.Dense){if(e.offset<=0)return of.call(this,n),YO.call(this,e);{let o=new Int32Array(i),c=Object.create(null),f=Object.create(null);for(let _,w,I=-1;++I{let I=r.typeIds[w],R=c[I],N=f[I];return _.slice(R,Math.min(i,N))}))}}return this}function Yft(e){let t;return e.nullCount>=e.length?of.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?of.call(this,wg(e.offset,e.length,t)):of.call(this,Sg(e.values))}function Sp(e){return of.call(this,e.values.subarray(0,e.length*e.stride))}function P3(e){let{length:t,values:r,valueOffsets:i}=e,s=Wi(i[0]),n=Wi(i[t]),o=Math.min(n-s,r.byteLength-s);return of.call(this,FP(-s,t+1,i)),of.call(this,r.subarray(s,s+o)),this}function QO(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:i,[t]:s}=r;return of.call(this,FP(-i,t+1,r)),this.visit(e.children[0].slice(i,s-i))}return this.visit(e.children[0])}function YO(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}os.prototype.visitBool=Yft;os.prototype.visitInt=Sp;os.prototype.visitFloat=Sp;os.prototype.visitUtf8=P3;os.prototype.visitLargeUtf8=P3;os.prototype.visitBinary=P3;os.prototype.visitLargeBinary=P3;os.prototype.visitFixedSizeBinary=Sp;os.prototype.visitDate=Sp;os.prototype.visitTimestamp=Sp;os.prototype.visitTime=Sp;os.prototype.visitDecimal=Sp;os.prototype.visitList=QO;os.prototype.visitStruct=YO;os.prototype.visitUnion=Zft;os.prototype.visitInterval=Sp;os.prototype.visitDuration=Sp;os.prototype.visitFixedSizeList=QO;os.prototype.visitMap=QO;var Fg=class extends Eg{static throughNode(t){throw new Error('\"throughNode\" not available in this environment')}static throughDOM(t,r){throw new Error('\"throughDOM\" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new ad,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Cl(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy==\"boolean\"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat==\"boolean\"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return ru(t)?t.then(r=>this.writeAll(r)):Nu(t)?XO(this,t):$O(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof ad?this._sink=t:(this._sink=new ad,t&&j9(t)?this.toDOMStream({type:\"bytes\"}).pipeTo(t):t&&G9(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!r||!Rg(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof wa&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof Fs&&!(r=t.schema))return this.finish()&&void 0}else throw new Error(\"RecordBatchWriter is closed\");if(r&&!Rg(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof Fs?t instanceof Dg||this._writeRecordBatch(t):t instanceof wa?this.writeAll(t.batches):Yh(t)&&this.writeAll(t)}_writeMessage(t,r=8){let i=r-1,s=vc.encode(t),n=s.byteLength,o=this._writeLegacyIpcFormat?4:8,c=n+o+i&~i,f=c-n-o;return t.headerType===wi.RecordBatch?this._recordBatchBlocks.push(new yp(c,t.bodyLength,this._position)):t.headerType===wi.DictionaryBatch&&this._dictionaryBlocks.push(new yp(c,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(c-o)),n>0&&this._write(s),this._writePadding(f)}_write(t){if(this._started){let r=Rr(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(vc.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Yv)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:i,bufferRegions:s,buffers:n}=os.assemble(t),o=new Sa(t.numRows,i,s),c=vc.from(o,r);return this._writeDictionaries(t)._writeMessage(c)._writeBodyBuffers(n)}_writeDictionaryBatch(t,r,i=!1){this._dictionaryDeltaOffsets.set(r,t.length+(this._dictionaryDeltaOffsets.get(r)||0));let{byteLength:s,nodes:n,bufferRegions:o,buffers:c}=os.assemble(new xr([t])),f=new Sa(t.length,n,o),_=new yc(f,r,i),w=vc.from(_,s);return this._writeMessage(w)._writeBodyBuffers(c)}_writeBodyBuffers(t){let r,i,s;for(let n=-1,o=t.length;++n0&&(this._write(r),(s=(i+7&-8)-i)>0&&this._writePadding(s));return this}_writeDictionaries(t){for(let[r,i]of t.dictionaries){let s=this._dictionaryDeltaOffsets.get(r)||0;if(s===0||(i=i?.slice(s)).length>0)for(let n of i.data)this._writeDictionaryBatch(n,r,s>0),s+=n.length}return this}},L2=class e extends Fg{static writeAll(t,r){let i=new e(r);return ru(t)?t.then(s=>i.writeAll(s)):Nu(t)?XO(i,t):$O(i,t)}},k2=class e extends Fg{static writeAll(t){let r=new e;return ru(t)?t.then(i=>r.writeAll(i)):Nu(t)?XO(r,t):$O(r,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let r=_p.encode(new _p(t,sn.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function $O(e,t){let r=t;t instanceof wa&&(r=t.batches,e.reset(void 0,t.schema));for(let i of r)e.write(i);return e.finish()}function XO(e,t){return ar(this,void 0,void 0,function*(){var r,i,s,n,o,c,f;try{for(r=!0,i=Zh(t);s=yield i.next(),n=s.done,!n;r=!0){f=s.value,r=!1;let _=f;e.write(_)}}catch(_){o={error:_}}finally{try{!r&&!n&&(c=i.return)&&(yield c.call(i))}finally{if(o)throw o.error}}return e.finish()})}function PH(e,t){if(Nu(e))return $ft(e,t);if(Yh(e))return Qft(e,t);throw new Error(\"toDOMStream() must be called with an Iterable or AsyncIterable\")}function Qft(e,t){let r=null,i=t?.type===\"bytes\"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){n(o,r||(r=e[Symbol.iterator]()))},pull(o){r?n(o,r):o.close()},cancel(){(r?.return&&r.return()||!0)&&(r=null)}}),Object.assign({highWaterMark:i?s:void 0},t));function n(o,c){let f,_=null,w=o.desiredSize||null;for(;!(_=c.next(i?w:null)).done;)if(ArrayBuffer.isView(_.value)&&(f=Rr(_.value))&&(w!=null&&i&&(w=w-f.byteLength+1),_.value=f),o.enqueue(_.value),w!=null&&--w<=0)return;o.close()}}function $ft(e,t){let r=null,i=t?.type===\"bytes\"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){return ar(this,void 0,void 0,function*(){yield n(o,r||(r=e[Symbol.asyncIterator]()))})},pull(o){return ar(this,void 0,void 0,function*(){r?yield n(o,r):o.close()})},cancel(){return ar(this,void 0,void 0,function*(){(r?.return&&(yield r.return())||!0)&&(r=null)})}}),Object.assign({highWaterMark:i?s:void 0},t));function n(o,c){return ar(this,void 0,void 0,function*(){let f,_=null,w=o.desiredSize||null;for(;!(_=yield c.next(i?w:null)).done;)if(ArrayBuffer.isView(_.value)&&(f=Rr(_.value))&&(w!=null&&i&&(w=w-f.byteLength+1),_.value=f),o.enqueue(_.value),w!=null&&--w<=0)return;o.close()})}}function LH(e){return new KO(e)}var KO=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{[\"readableStrategy\"]:r,[\"writableStrategy\"]:i,[\"queueingStrategy\"]:s=\"count\"}=t,n=U9(t,[\"readableStrategy\",\"writableStrategy\",\"queueingStrategy\"]);this._controller=null,this._builder=Cg(n),this._getSize=s!==\"bytes\"?IH:CH;let{[\"highWaterMark\"]:o=s===\"bytes\"?Math.pow(2,14):1e3}=Object.assign({},r),{[\"highWaterMark\"]:c=s===\"bytes\"?Math.pow(2,14):1e3}=Object.assign({},i);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:f=>{this._maybeFlush(this._builder,this._controller=f)},start:f=>{this._maybeFlush(this._builder,this._controller=f)}},{highWaterMark:o,size:s!==\"bytes\"?IH:CH}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:c,size:f=>this._writeValueAndReturnChunkSize(f)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},IH=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},CH=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function I3(e,t){let r=new ad,i=null,s=new ReadableStream({cancel(){return ar(this,void 0,void 0,function*(){yield r.close()})},start(c){return ar(this,void 0,void 0,function*(){yield o(c,i||(i=yield n()))})},pull(c){return ar(this,void 0,void 0,function*(){i?yield o(c,i):c.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:s};function n(){return ar(this,void 0,void 0,function*(){return yield(yield cu.from(r)).open(t)})}function o(c,f){return ar(this,void 0,void 0,function*(){let _=c.desiredSize,w=null;for(;!(w=yield f.next()).done;)if(c.enqueue(w.value),_!=null&&--_<=0)return;c.close()})}}function C3(e,t){let r=new this(e),i=new $u(r),s=new ReadableStream({cancel(){return ar(this,void 0,void 0,function*(){yield i.cancel()})},pull(o){return ar(this,void 0,void 0,function*(){yield n(o)})},start(o){return ar(this,void 0,void 0,function*(){yield n(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:s};function n(o){return ar(this,void 0,void 0,function*(){let c=null,f=o.desiredSize;for(;c=yield i.read(f||null);)if(o.enqueue(c),f!=null&&(f-=c.byteLength)<=0)return;o.close()})}}function R2(e){let t=cu.from(e);return ru(t)?t.then(r=>R2(r)):t.isAsync()?t.readAll().then(r=>new wa(r)):new wa(t.readAll())}var _dt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},uO),OO),MO),hO),iO),TO),oO),{compareSchemas:Rg,compareFields:nH,compareTypes:sH});xa.toDOMStream=PH;Xn.throughDOM=LH;cu.throughDOM=I3;Bg.throughDOM=I3;wp.throughDOM=I3;Fg.throughDOM=C3;k2.throughDOM=C3;L2.throughDOM=C3;var ydt=\"0.6.1\",vdt=`https://cdn.jsdelivr.net/npm/parquet-wasm@${ydt}/esm/parquet_wasm_bg.wasm`,JO=!1;async function kH(){JO||(await z9(vdt),JO=!0)}function xdt(e){if(!JO)throw new Error(\"wasm not ready\");console.time(\"readParquet\");let t=O9(new Uint8Array(e.buffer),{batchSize:Math.pow(2,31)}).intoIPCStream(),r=R2(t);return console.timeEnd(\"readParquet\"),r}function O2(e){let t=[];for(let r of e){let i=xdt(r);i.batches.length!==1&&console.warn(\"Expected one batch\"),t.push(...i.batches)}return new wa(t)}var RH=Ri(Yi(),1);function tB(e){return e instanceof Array&&e?.[0]instanceof DataView?e?.[0].byteLength>0?O2(e).getChildAt(0):null:e}var zg=class{model;callbacks;updateStateCallback;constructor(t,r){this.model=t,this.model.on(\"change\",r),this.updateStateCallback=r,this.callbacks=new Map,this.callbacks.set(\"change\",r)}async loadSubModels(){}initRegularAttribute(t,r){this[r]=this.model.get(t),this.model.off(`change:${t}`);let i=()=>{this[r]=this.model.get(t)};this.model.on(`change:${t}`,i),this.callbacks.set(`change:${t}`,i)}initVectorizedAccessor(t,r){this[r]=tB(this.model.get(t)),this.model.off(`change:${t}`);let i=()=>{this[r]=tB(this.model.get(t))};this.model.on(`change:${t}`,i),this.callbacks.set(`change:${t}`,i)}finalize(){for(let[t,r]of Object.entries(this.callbacks))this.model.off(t,r)}};async function L3(e,t){let r=[];for(let i of t)r.push(e.get_model(i.slice(10)));return await Promise.all(r)}function Jt(e){return e!=null}function DH(e,t=20){let r;return(...s)=>{clearTimeout(r),r=setTimeout(()=>e(...s),t)}}var bdt=`\n uniform bool brushing_enabled;\n uniform int brushing_target;\n uniform vec2 brushing_mousePos;\n uniform float brushing_radius;\n\n #ifdef NON_INSTANCED_MODEL\n attribute vec2 brushingTargets;\n #else\n attribute vec2 instanceBrushingTargets;\n #endif\n\n varying float brushing_isVisible;\n\n bool brushing_isPointInRange(vec2 position) {\n if (!brushing_enabled) {\n return true;\n }\n vec2 source_commonspace = project_position(position);\n vec2 target_commonspace = project_position(brushing_mousePos);\n float distance = length((target_commonspace - source_commonspace) / project_uCommonUnitsPerMeter.xy);\n\n return distance <= brushing_radius;\n }\n\n bool brushing_arePointsInRange(vec2 sourcePos, vec2 targetPos) {\n return brushing_isPointInRange(sourcePos) || brushing_isPointInRange(targetPos);\n }\n\n void brushing_setVisible(bool visible) {\n brushing_isVisible = float(visible);\n }\n`,wdt=`\n uniform bool brushing_enabled;\n varying float brushing_isVisible;\n`,Sdt={source:0,target:1,custom:2,source_target:3},Tdt={\"vs:DECKGL_FILTER_GL_POSITION\":`\n vec2 brushingTarget;\n vec2 brushingSource;\n if (brushing_target == 3) {\n brushingTarget = geometry.worldPositionAlt.xy;\n brushingSource = geometry.worldPosition.xy;\n } else if (brushing_target == 0) {\n brushingTarget = geometry.worldPosition.xy;\n } else if (brushing_target == 1) {\n brushingTarget = geometry.worldPositionAlt.xy;\n } else {\n #ifdef NON_INSTANCED_MODEL\n brushingTarget = brushingTargets;\n #else\n brushingTarget = instanceBrushingTargets;\n #endif\n }\n bool visible;\n if (brushing_target == 3) {\n visible = brushing_arePointsInRange(brushingSource, brushingTarget);\n } else {\n visible = brushing_isPointInRange(brushingTarget);\n }\n brushing_setVisible(visible);\n `,\"fs:DECKGL_FILTER_COLOR\":`\n if (brushing_enabled && brushing_isVisible < 0.5) {\n discard;\n }\n `},OH={name:\"brushing\",dependencies:[Vh],vs:bdt,fs:wdt,inject:Tdt,getUniforms:e=>{if(!e||!(\"viewport\"in e))return{};let{brushingEnabled:t=!0,brushingRadius:r=1e4,brushingTarget:i=\"source\",mousePosition:s,viewport:n}=e;return{brushing_enabled:!!(t&&s&&n.containsPixel(s)),brushing_radius:r,brushing_target:Sdt[i]||0,brushing_mousePos:s?n.unproject([s.x-n.x,s.y-n.y]):[0,0]}}};var Mdt={getBrushingTarget:{type:\"accessor\",value:[0,0]},brushingTarget:\"source\",brushingEnabled:!0,brushingRadius:1e4},vm=class extends cc{getShaders(){return{modules:[OH]}}initializeState(t,r){let i=this.getAttributeManager();i&&i.add({brushingTargets:{size:2,accessor:\"getBrushingTarget\",shaderAttributes:{brushingTargets:{divisor:0},instanceBrushingTargets:{divisor:1}}}}),this.state.onMouseMove=()=>{var s;(s=this.getCurrentLayer())===null||s===void 0||s.setNeedsRedraw()},t.deck&&t.deck.eventManager.on({pointermove:this.state.onMouseMove,pointerleave:this.state.onMouseMove})}finalizeState(t,r){t.deck&&t.deck.eventManager.off({pointermove:this.state.onMouseMove,pointerleave:this.state.onMouseMove})}};G(vm,\"defaultProps\",Mdt);G(vm,\"extensionName\",\"BrushingExtension\");var BH=`\nuniform DATAFILTER_TYPE filter_min;\nuniform DATAFILTER_TYPE filter_softMin;\nuniform DATAFILTER_TYPE filter_softMax;\nuniform DATAFILTER_TYPE filter_max;\nuniform bool filter_useSoftMargin;\nuniform bool filter_enabled;\nuniform bool filter_transformSize;\n\n#ifdef NON_INSTANCED_MODEL\n #define DATAFILTER_ATTRIB filterValues\n #define DATAFILTER_ATTRIB_64LOW filterValues64Low\n#else\n #define DATAFILTER_ATTRIB instanceFilterValues\n #define DATAFILTER_ATTRIB_64LOW instanceFilterValues64Low\n#endif\n\nattribute DATAFILTER_TYPE DATAFILTER_ATTRIB;\n#ifdef DATAFILTER_DOUBLE\n attribute DATAFILTER_TYPE DATAFILTER_ATTRIB_64LOW;\n\n uniform DATAFILTER_TYPE filter_min64High;\n uniform DATAFILTER_TYPE filter_max64High;\n#endif\n\nvarying float dataFilter_value;\n\nfloat dataFilter_reduceValue(float value) {\n return value;\n}\nfloat dataFilter_reduceValue(vec2 value) {\n return min(value.x, value.y);\n}\nfloat dataFilter_reduceValue(vec3 value) {\n return min(min(value.x, value.y), value.z);\n}\nfloat dataFilter_reduceValue(vec4 value) {\n return min(min(value.x, value.y), min(value.z, value.w));\n}\nvoid dataFilter_setValue(DATAFILTER_TYPE valueFromMin, DATAFILTER_TYPE valueFromMax) {\n if (filter_enabled) {\n if (filter_useSoftMargin) {\n dataFilter_value = dataFilter_reduceValue(\n smoothstep(filter_min, filter_softMin, valueFromMin) *\n (1.0 - smoothstep(filter_softMax, filter_max, valueFromMax))\n );\n } else {\n dataFilter_value = dataFilter_reduceValue(\n step(filter_min, valueFromMin) * step(valueFromMax, filter_max)\n );\n }\n } else {\n dataFilter_value = 1.0;\n }\n}\n`,FH=`\nuniform bool filter_transformColor;\nvarying float dataFilter_value;\n`;function zH(e){if(!e||!(\"extensions\"in e))return{};let{filterRange:t=[-1,1],filterEnabled:r=!0,filterTransformSize:i=!0,filterTransformColor:s=!0}=e,n=e.filterSoftRange||t;return{...Number.isFinite(t[0])?{filter_min:t[0],filter_softMin:n[0],filter_softMax:n[1],filter_max:t[1]}:{filter_min:t.map(o=>o[0]),filter_softMin:n.map(o=>o[0]),filter_softMax:n.map(o=>o[1]),filter_max:t.map(o=>o[1])},filter_enabled:r,filter_useSoftMargin:!!e.filterSoftRange,filter_transformSize:r&&i,filter_transformColor:r&&s}}function Edt(e){if(!e||!(\"extensions\"in e))return{};let t=zH(e);if(Number.isFinite(t.filter_min)){let r=Math.fround(t.filter_min);t.filter_min-=r,t.filter_softMin-=r,t.filter_min64High=r;let i=Math.fround(t.filter_max);t.filter_max-=i,t.filter_softMax-=i,t.filter_max64High=i}else{let r=t.filter_min.map(Math.fround);t.filter_min=t.filter_min.map((s,n)=>s-r[n]),t.filter_softMin=t.filter_softMin.map((s,n)=>s-r[n]),t.filter_min64High=r;let i=t.filter_max.map(Math.fround);t.filter_max=t.filter_max.map((s,n)=>s-i[n]),t.filter_softMax=t.filter_softMax.map((s,n)=>s-i[n]),t.filter_max64High=i}return t}var NH={\"vs:#main-start\":`\n #ifdef DATAFILTER_DOUBLE\n dataFilter_setValue(\n DATAFILTER_ATTRIB - filter_min64High + DATAFILTER_ATTRIB_64LOW,\n DATAFILTER_ATTRIB - filter_max64High + DATAFILTER_ATTRIB_64LOW\n );\n #else\n dataFilter_setValue(DATAFILTER_ATTRIB, DATAFILTER_ATTRIB);\n #endif\n `,\"vs:#main-end\":`\n if (dataFilter_value == 0.0) {\n gl_Position = vec4(0.);\n }\n `,\"vs:DECKGL_FILTER_SIZE\":`\n if (filter_transformSize) {\n size = size * dataFilter_value;\n }\n `,\"fs:DECKGL_FILTER_COLOR\":`\n if (dataFilter_value == 0.0) discard;\n if (filter_transformColor) {\n color.a *= dataFilter_value;\n }\n `},UH={name:\"data-filter\",vs:BH,fs:FH,inject:NH,getUniforms:zH},VH={name:\"data-filter-fp64\",vs:BH,fs:FH,inject:NH,getUniforms:Edt};var Pdt=`#define SHADER_NAME data-filter-vertex-shader\n\n#ifdef FLOAT_TARGET\n attribute float filterIndices;\n attribute float filterPrevIndices;\n#else\n attribute vec2 filterIndices;\n attribute vec2 filterPrevIndices;\n#endif\n\nvarying vec4 vColor;\nconst float component = 1.0 / 255.0;\n\nvoid main() {\n #ifdef FLOAT_TARGET\n dataFilter_value *= float(filterIndices != filterPrevIndices);\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n vColor = vec4(0.0, 0.0, 0.0, 1.0);\n #else\n // Float texture is not supported: pack result into 4 channels x 256 px x 64px\n dataFilter_value *= float(filterIndices.x != filterPrevIndices.x);\n float col = filterIndices.x;\n float row = filterIndices.y * 4.0;\n float channel = floor(row);\n row = fract(row);\n vColor = component * vec4(bvec4(channel == 0.0, channel == 1.0, channel == 2.0, channel == 3.0));\n gl_Position = vec4(col * 2.0 - 1.0, row * 2.0 - 1.0, 0.0, 1.0);\n #endif\n gl_PointSize = 1.0;\n}\n`,Idt=`#define SHADER_NAME data-filter-fragment-shader\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main() {\n if (dataFilter_value < 0.5) {\n discard;\n }\n gl_FragColor = vColor;\n}\n`;function jH(e){return!!(e.getExtension(\"EXT_float_blend\")&&(e.getExtension(\"EXT_color_buffer_float\")||e.getExtension(\"WEBGL_color_buffer_float\")))}function GH(e,t){return t?new yi(e,{width:1,height:1,attachments:{36064:new pi(e,{format:fr(e)?34836:6408,type:5126,mipmaps:!1})}}):new yi(e,{width:256,height:64,depth:!1})}function WH(e,t,r){return t.defines.NON_INSTANCED_MODEL=1,r&&(t.defines.FLOAT_TARGET=1),new fn(e,{id:\"data-filter-aggregation-model\",vertexCount:1,isInstanced:!1,drawMode:0,vs:Pdt,fs:Idt,...t})}var HH={blend:!0,blendFunc:[1,1,1,1],blendEquation:[32774,32774],depthTest:!1};var Ldt={getFilterValue:{type:\"accessor\",value:0},onFilteredItemsChange:{type:\"function\",value:null,optional:!0},filterEnabled:!0,filterRange:[-1,1],filterSoftRange:null,filterTransformSize:!0,filterTransformColor:!0},qH={1:\"float\",2:\"vec2\",3:\"vec3\",4:\"vec4\"},xm=class extends cc{constructor({filterSize:t=1,fp64:r=!1,countItems:i=!1}={}){if(!qH[t])throw new Error(\"filterSize out of range\");super({filterSize:t,fp64:r,countItems:i})}getShaders(t){let{filterSize:r,fp64:i}=t.opts;return{modules:[i?VH:UH],defines:{DATAFILTER_TYPE:qH[r],DATAFILTER_DOUBLE:!!i}}}initializeState(t,r){let i=this.getAttributeManager();i&&i.add({filterValues:{size:r.opts.filterSize,type:r.opts.fp64?5130:5126,accessor:\"getFilterValue\",shaderAttributes:{filterValues:{divisor:0},instanceFilterValues:{divisor:1}}}});let{gl:s}=this.context;if(i&&r.opts.countItems){let n=jH(s);i.add({filterIndices:{size:n?1:2,vertexOffset:1,type:5121,normalized:!0,accessor:(f,{index:_})=>{let w=f&&f.__source?f.__source.index:_;return n?(w+1)%255:[(w+1)%255,Math.floor(w/255)%255]},shaderAttributes:{filterPrevIndices:{vertexOffset:0},filterIndices:{vertexOffset:1}}}});let o=GH(s,n),c=WH(s,r.getShaders.call(this,r),n);this.setState({filterFBO:o,filterModel:c})}}updateState({props:t,oldProps:r}){if(this.state.filterModel){let s=this.getAttributeManager().attributes.filterValues.needsUpdate()||t.filterEnabled!==r.filterEnabled||t.filterRange!==r.filterRange||t.filterSoftRange!==r.filterSoftRange;s&&this.setState({filterNeedsUpdate:s})}}draw(t,r){let{filterFBO:i,filterModel:s,filterNeedsUpdate:n}=this.state,{onFilteredItemsChange:o}=this.props;if(n&&o&&s){let{attributes:{filterValues:c,filterIndices:f}}=this.getAttributeManager();s.setVertexCount(this.getNumInstances());let{gl:_}=this.context;Hf(_,{framebuffer:i,color:[0,0,0,0]}),s.updateModuleSettings(t.moduleParameters).setAttributes({...c.getShaderAttributes(),...f&&f.getShaderAttributes()}).draw({framebuffer:i,parameters:{...HH,viewport:[0,0,i.width,i.height]}});let w=Dh(i),I=0;for(let R=0;R 0.0) {\n if (dashAlignMode == 0.0) {\n offset = vDashOffset;\n } else {\n unitLength = vPathLength / round(vPathLength / unitLength);\n offset = solidLength / 2.0;\n }\n\n float unitOffset = mod(vPathPosition.y + offset, unitLength);\n\n if (gapLength > 0.0 && unitOffset > solidLength) {\n if (capType <= 0.5) {\n if (!(dashGapPickable && picking_uActive)) {\n discard;\n }\n } else {\n float distToEnd = length(vec2(\n min(unitOffset - solidLength, unitLength - unitOffset),\n vPathPosition.x\n ));\n if (distToEnd > 1.0) {\n if (!(dashGapPickable && picking_uActive)) {\n discard;\n }\n }\n }\n }\n }\n`}},YH={inject:{\"vs:#decl\":`\nattribute float instanceOffsets;\n`,\"vs:DECKGL_FILTER_SIZE\":`\n float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;\n size *= offsetWidth;\n`,\"vs:#main-end\":`\n float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;\n float offsetDir = sign(instanceOffsets);\n vPathPosition.x = (vPathPosition.x + offsetDir) * offsetWidth - offsetDir;\n vPathPosition.y *= offsetWidth;\n vPathLength *= offsetWidth;\n`,\"fs:#main-start\":`\n float isInside;\n isInside = step(-1.0, vPathPosition.x) * step(vPathPosition.x, 1.0);\n if (isInside == 0.0) {\n discard;\n }\n`}};var kdt={getDashArray:{type:\"accessor\",value:[0,0]},getOffset:{type:\"accessor\",value:0},dashJustified:!1,dashGapPickable:!1},bm=class extends cc{constructor({dash:t=!1,offset:r=!1,highPrecisionDash:i=!1}={}){super({dash:t||i,offset:r,highPrecisionDash:i})}isEnabled(t){return\"pathTesselator\"in t.state}getShaders(t){if(!t.isEnabled(this))return null;let r={};return t.opts.dash&&(r=tv(r,ZH)),t.opts.offset&&(r=tv(r,YH)),r}initializeState(t,r){let i=this.getAttributeManager();!i||!r.isEnabled(this)||(r.opts.dash&&i.addInstanced({instanceDashArrays:{size:2,accessor:\"getDashArray\"}}),r.opts.highPrecisionDash&&i.addInstanced({instanceDashOffsets:{size:1,accessor:\"getPath\",transform:r.getDashOffsets.bind(this)}}),r.opts.offset&&i.addInstanced({instanceOffsets:{size:1,accessor:\"getOffset\"}}))}updateState(t,r){if(!r.isEnabled(this))return;let i={};r.opts.dash&&(i.dashAlignMode=this.props.dashJustified?1:0,i.dashGapPickable=!!this.props.dashGapPickable),this.state.model.setUniforms(i)}getDashOffsets(t){let r=[0],i=this.props.positionFormat===\"XY\"?2:3,s=Array.isArray(t[0]),n=s?t.length:t.length/i,o,c;for(let f=0;f0&&(r[f]=r[f-1]+$j(c,o)),c=o;return r}};G(bm,\"defaultProps\",kdt);G(bm,\"extensionName\",\"PathStyleExtension\");var Rdt=`\n#ifdef NON_INSTANCED_MODEL\nattribute float collisionPriorities;\n#else\nattribute float instanceCollisionPriorities;\n#endif\n\nuniform sampler2D collision_texture;\nuniform bool collision_sort;\nuniform bool collision_enabled;\n\nvec2 collision_getCoords(vec4 position) {\n vec4 collision_clipspace = project_common_position_to_clipspace(position);\n return (1.0 + collision_clipspace.xy / collision_clipspace.w) / 2.0;\n}\n\nfloat collision_match(vec2 tex, vec3 pickingColor) {\n vec4 collision_pickingColor = texture2D(collision_texture, tex);\n float delta = dot(abs(collision_pickingColor.rgb - pickingColor), vec3(1.0));\n float e = 0.001;\n return step(delta, e);\n}\n\nfloat collision_isVisible(vec2 texCoords, vec3 pickingColor) {\n if (!collision_enabled) {\n return 1.0;\n }\n\n // Visibility test, sample area of 5x5 pixels in order to fade in/out.\n // Due to the locality, the lookups will be cached\n // This reduces the flicker present when objects are shown/hidden\n const int N = 2;\n float accumulator = 0.0;\n vec2 step = vec2(1.0 / project_uViewportSize);\n\n const float floatN = float(N);\n vec2 delta = -floatN * step;\n for(int i = -N; i <= N; i++) {\n delta.x = -step.x * floatN;\n for(int j = -N; j <= N; j++) {\n accumulator += collision_match(texCoords + delta, pickingColor);\n delta.x += step.x;\n }\n delta.y += step.y;\n }\n\n float W = 2.0 * floatN + 1.0;\n return pow(accumulator / (W * W), 2.2);\n}\n`,Ddt={\"vs:#decl\":`\n float collision_fade = 1.0;\n`,\"vs:DECKGL_FILTER_GL_POSITION\":`\n if (collision_sort) {\n #ifdef NON_INSTANCED_MODEL\n float collisionPriority = collisionPriorities;\n #else\n float collisionPriority = instanceCollisionPriorities;\n #endif\n position.z = -0.001 * collisionPriority * position.w; // Support range -1000 -> 1000\n }\n\n if (collision_enabled) {\n vec4 collision_common_position = project_position(vec4(geometry.worldPosition, 1.0));\n vec2 collision_texCoords = collision_getCoords(collision_common_position);\n collision_fade = collision_isVisible(collision_texCoords, geometry.pickingColor / 255.0);\n if (collision_fade < 0.0001) {\n // Position outside clip space bounds to discard\n position = vec4(0.0, 0.0, 2.0, 1.0);\n }\n }\n `,\"vs:DECKGL_FILTER_COLOR\":`\n color.a *= collision_fade;\n `},Odt=(e,t)=>{if(!e||!(\"dummyCollisionMap\"in e))return{};let{collisionFBO:r,drawToCollisionMap:i,dummyCollisionMap:s}=e;return{collision_sort:!!i,collision_texture:!i&&r?r:s}},QH={name:\"collision\",dependencies:[Vh],vs:Rdt,inject:Ddt,getUniforms:Odt};var B2=class extends sc{renderCollisionMap(t,r){let i=this.gl,s=1;return Mn(i,{scissorTest:!0,scissor:[s,s,t.width-2*s,t.height-2*s],clearColor:[0,0,0,0],blend:!1,depthTest:!0,depthRange:[0,1]},()=>this.render({...r,target:t,pass:\"collision\"}))}getModuleParameters(){return{drawToCollisionMap:!0,pickingActive:1,pickingAttribute:!1,lightSources:{}}}};var F2=class extends sc{constructor(t,r){super(t,r),G(this,\"maskMap\",void 0),G(this,\"fbo\",void 0);let{mapSize:i=2048}=r;this.maskMap=new pi(t,{width:i,height:i,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.fbo=new yi(t,{id:\"maskmap\",width:i,height:i,attachments:{36064:this.maskMap}})}render(t){let r=this.gl,i=[!1,!1,!1,!1];return i[t.channel]=!0,Mn(r,{clearColor:[255,255,255,255],blend:!0,blendFunc:[0,1],blendEquation:32778,colorMask:i,depthTest:!1},()=>super.render({...t,target:this.fbo,pass:\"mask\"}))}shouldDrawLayer(t){return t.props.operation.includes(\"mask\")}delete(){this.fbo.delete(),this.maskMap.delete()}};function $H(e,t){let r=[1/0,1/0,-1/0,-1/0];for(let i of e){let s=i.getBounds();if(s){let n=i.projectPosition(s[0],{viewport:t,autoOffset:!1}),o=i.projectPosition(s[1],{viewport:t,autoOffset:!1});r[0]=Math.min(r[0],n[0]),r[1]=Math.min(r[1],n[1]),r[2]=Math.max(r[2],o[0]),r[3]=Math.max(r[3],o[1])}}return Number.isFinite(r[0])?r:null}var Bdt=2048;function XH(e){let{bounds:t,viewport:r,border:i=0}=e,{isGeospatial:s}=r;if(t[2]<=t[0]||t[3]<=t[1])return null;let n=r.unprojectPosition([(t[0]+t[2])/2,(t[1]+t[3])/2,0]),{width:o,height:c,zoom:f}=e;if(f===void 0){o=o-i*2,c=c-i*2;let _=Math.min(o/(t[2]-t[0]),c/(t[3]-t[1]));f=Math.min(Math.log2(_),20)}else if(!o||!c){let _=2**f;o=Math.round(Math.abs(t[2]-t[0])*_),c=Math.round(Math.abs(t[3]-t[1])*_);let w=Bdt-i*2;if(o>w||c>w){let I=w/Math.max(o,c);o=Math.round(o*I),c=Math.round(c*I),f+=Math.log2(I)}}return s?new lc({id:r.id,x:i,y:i,width:o,height:c,longitude:n[0],latitude:n[1],zoom:f,orthographic:!0}):new iv({id:r.id,x:i,y:i,width:o,height:c,target:n,zoom:f,flipY:!1})}function Fdt(e,t){let r;if(t&&t.length===2){let[n,o]=t,c=e.getBounds({z:n}),f=e.getBounds({z:o});r=[Math.min(c[0],f[0]),Math.min(c[1],f[1]),Math.max(c[2],f[2]),Math.max(c[3],f[3])]}else r=e.getBounds();let i=e.projectPosition(r.slice(0,2)),s=e.projectPosition(r.slice(2,4));return[i[0],i[1],s[0],s[1]]}function KH(e,t,r){if(!e)return[0,0,1,1];let i=Fdt(t,r),s=zdt(i);return e[2]-e[0]<=s[2]-s[0]&&e[3]-e[1]<=s[3]-s[1]?e:[Math.max(e[0],s[0]),Math.max(e[1],s[1]),Math.min(e[2],s[2]),Math.min(e[3],s[3])]}function zdt(e){let t=e[2]-e[0],r=e[3]-e[1],i=(e[0]+e[2])/2,s=(e[1]+e[3])/2;return[i-t,s-r,i+t,s+r]}var z2=class{constructor(){G(this,\"id\",\"mask-effect\"),G(this,\"props\",null),G(this,\"useInPicking\",!0),G(this,\"order\",0),G(this,\"dummyMaskMap\",void 0),G(this,\"channels\",[]),G(this,\"masks\",null),G(this,\"maskPass\",void 0),G(this,\"maskMap\",void 0),G(this,\"lastViewport\",void 0)}preRender(t,{layers:r,layerFilter:i,viewports:s,onViewportActive:n,views:o,isPicking:c}){let f=!1;if(this.dummyMaskMap||(this.dummyMaskMap=new pi(t,{width:1,height:1})),c)return{didRender:f};let _=r.filter(N=>N.props.visible&&N.props.operation.includes(\"mask\"));if(_.length===0)return this.masks=null,this.channels.length=0,{didRender:f};this.masks={},this.maskPass||(this.maskPass=new F2(t,{id:\"default-mask\"}),this.maskMap=this.maskPass.maskMap);let w=this._sortMaskChannels(_),I=s[0],R=!this.lastViewport||!this.lastViewport.equals(I);if(I.resolution!==void 0)return or.warn(\"MaskExtension is not supported in GlobeView\")(),{didRender:f};for(let N in w){let j=this._renderChannel(w[N],{layerFilter:i,onViewportActive:n,views:o,viewport:I,viewportChanged:R});f||(f=j)}return{didRender:f}}_renderChannel(t,{layerFilter:r,onViewportActive:i,views:s,viewport:n,viewportChanged:o}){let c=!1,f=this.channels[t.index];if(!f)return c;let _=t===f||t.layers.length!==f.layers.length||t.layers.some((w,I)=>w!==f.layers[I]||w.props.transitions)||t.layerBounds.some((w,I)=>w!==f.layerBounds[I]);if(t.bounds=f.bounds,t.maskBounds=f.maskBounds,this.channels[t.index]=t,_||o){this.lastViewport=n;let w=$H(t.layers,n);if(t.bounds=w&&KH(w,n),_||!Ro(t.bounds,f.bounds)){let{maskPass:I,maskMap:R}=this,N=w&&XH({bounds:t.bounds,viewport:n,width:R.width,height:R.height,border:1});t.maskBounds=N?N.getBounds():[0,0,1,1],I.render({pass:\"mask\",channel:t.index,layers:t.layers,layerFilter:r,viewports:N?[N]:[],onViewportActive:i,views:s,moduleParameters:{devicePixelRatio:1}}),c=!0}}return this.masks[t.id]={index:t.index,bounds:t.maskBounds,coordinateOrigin:t.coordinateOrigin,coordinateSystem:t.coordinateSystem},c}_sortMaskChannels(t){let r={},i=0;for(let s of t){let{id:n}=s.root,o=r[n];if(!o){if(++i>4){or.warn(\"Too many mask layers. The max supported is 4\")();continue}o={id:n,index:this.channels.findIndex(c=>c?.id===n),layers:[],layerBounds:[],coordinateOrigin:s.root.props.coordinateOrigin,coordinateSystem:s.root.props.coordinateSystem},r[n]=o}o.layers.push(s),o.layerBounds.push(s.getBounds())}for(let s=0;s<4;s++){let n=this.channels[s];(!n||!(n.id in r))&&(this.channels[s]=null)}for(let s in r){let n=r[s];n.index<0&&(n.index=this.channels.findIndex(o=>!o),this.channels[n.index]=n)}return r}getModuleParameters(){return{maskMap:this.masks?this.maskMap:this.dummyMaskMap,maskChannels:this.masks}}cleanup(){this.dummyMaskMap&&(this.dummyMaskMap.delete(),this.dummyMaskMap=void 0),this.maskPass&&(this.maskPass.delete(),this.maskPass=void 0,this.maskMap=void 0),this.lastViewport=void 0,this.masks=null,this.channels.length=0}};var eB=2,N2=class{constructor(){G(this,\"id\",\"collision-filter-effect\"),G(this,\"props\",null),G(this,\"useInPicking\",!0),G(this,\"order\",1),G(this,\"channels\",{}),G(this,\"collisionFilterPass\",void 0),G(this,\"collisionFBOs\",{}),G(this,\"dummyCollisionMap\",void 0),G(this,\"lastViewport\",void 0)}preRender(t,{effects:r,layers:i,layerFilter:s,viewports:n,onViewportActive:o,views:c,isPicking:f,preRenderStats:_={}}){var w;if(this.dummyCollisionMap||(this.dummyCollisionMap=new pi(t,{width:1,height:1})),f)return;let I=i.filter(({props:{visible:Y,collisionEnabled:K}})=>Y&&K);if(I.length===0){this.channels={};return}this.collisionFilterPass||(this.collisionFilterPass=new B2(t,{id:\"default-collision-filter\"}));let R=r?.filter(Y=>Y.constructor===z2),N=(w=_[\"mask-effect\"])===null||w===void 0?void 0:w.didRender,j=this._groupByCollisionGroup(t,I),Q=n[0],et=!this.lastViewport||!this.lastViewport.equals(Q)||N;for(let Y in j){let K=this.collisionFBOs[Y],J=j[Y];K.resize({width:t.canvas.width/eB,height:t.canvas.height/eB}),this._render(J,{effects:R,layerFilter:s,onViewportActive:o,views:c,viewport:Q,viewportChanged:et})}}_render(t,{effects:r,layerFilter:i,onViewportActive:s,views:n,viewport:o,viewportChanged:c}){let{collisionGroup:f}=t,_=this.channels[f];if(!_)return;let w=c||t===_||!mo(_.layers,t.layers,1)||t.layerBounds.some((I,R)=>!Ro(I,_.layerBounds[R]))||t.allLayersLoaded!==_.allLayersLoaded||t.layers.some(I=>I.props.transitions);if(this.channels[f]=t,w){this.lastViewport=o;let I=this.collisionFBOs[f];this.collisionFilterPass.renderCollisionMap(I,{pass:\"collision-filter\",isPicking:!0,layers:t.layers,effects:r,layerFilter:i,viewports:o?[o]:[],onViewportActive:s,views:n,moduleParameters:{dummyCollisionMap:this.dummyCollisionMap,devicePixelRatio:El(I.gl)/eB}})}}_groupByCollisionGroup(t,r){let i={};for(let s of r){let{collisionGroup:n}=s.props,o=i[n];o||(o={collisionGroup:n,layers:[],layerBounds:[],allLayersLoaded:!0},i[n]=o),o.layers.push(s),o.layerBounds.push(s.getBounds()),s.isLoaded||(o.allLayersLoaded=!1)}for(let s of Object.keys(i))this.collisionFBOs[s]||this.createFBO(t,s),this.channels[s]||(this.channels[s]=i[s]);for(let s of Object.keys(this.collisionFBOs))i[s]||this.destroyFBO(s);return i}getModuleParameters(t){let{collisionGroup:r}=t.props,{collisionFBOs:i,dummyCollisionMap:s}=this;return{collisionFBO:i[r],dummyCollisionMap:s}}cleanup(){this.dummyCollisionMap&&(this.dummyCollisionMap.delete(),this.dummyCollisionMap=void 0),this.channels={};for(let t of Object.keys(this.collisionFBOs))this.destroyFBO(t);this.collisionFBOs={},this.lastViewport=void 0}createFBO(t,r){let{width:i,height:s}=t.canvas,n=new pi(t,{width:i,height:s,parameters:{10241:9728,10240:9728,10242:33071,10243:33071}}),o=new el(t,{format:33189,width:i,height:s});this.collisionFBOs[r]=new yi(t,{id:\"Collision-\".concat(r),width:i,height:s,attachments:{36064:n,36096:o}})}destroyFBO(t){let r=this.collisionFBOs[t];for(let i of Object.values(r.attachments))i.delete();r.delete(),delete this.collisionFBOs[t]}};var Ndt={getCollisionPriority:{type:\"accessor\",value:0},collisionEnabled:!0,collisionGroup:{type:\"string\",value:\"default\"},collisionTestProps:{}},wm=class extends cc{getShaders(){return{modules:[QH]}}draw({uniforms:t,context:r,moduleParameters:i}){let{collisionEnabled:s}=this.props,{collisionFBO:n,drawToCollisionMap:o}=i,c=s&&!!n;t.collision_enabled=c,o&&(this.props=this.clone(this.props.collisionTestProps).props)}initializeState(t,r){var i;if(this.getAttributeManager()===null)return;(i=this.context.deck)===null||i===void 0||i._addDefaultEffect(new N2),this.getAttributeManager().add({collisionPriorities:{size:1,accessor:\"getCollisionPriority\",shaderAttributes:{collisionPriorities:{divisor:0},instanceCollisionPriorities:{divisor:1}}}})}getNeedsPickingBuffer(){return this.props.collisionEnabled}};G(wm,\"defaultProps\",Ndt);G(wm,\"extensionName\",\"CollisionFilterExtension\");var Ng=class extends zg{static extensionType;constructor(t,r){super(t,r)}},U2=class extends Ng{static extensionType=\"brushing\";extensionInstance;constructor(t,r,i){super(t,i),this.extensionInstance=new vm,r.initRegularAttribute(\"brushing_enabled\",\"brushingEnabled\"),r.initRegularAttribute(\"brushing_target\",\"brushingTarget\"),r.initRegularAttribute(\"brushing_radius\",\"brushingRadius\"),r.initVectorizedAccessor(\"get_brushing_target\",\"getBrushingTarget\"),r.extensionLayerPropertyNames=[...r.extensionLayerPropertyNames,\"brushingEnabled\",\"brushingTarget\",\"brushingRadius\",\"getBrushingTarget\"]}},V2=class extends Ng{static extensionType=\"collision-filter\";extensionInstance;constructor(t,r,i){super(t,i),this.extensionInstance=new wm,r.initRegularAttribute(\"collision_enabled\",\"collisionEnabled\"),r.initRegularAttribute(\"collision_group\",\"collisionGroup\"),r.initRegularAttribute(\"collision_test_props\",\"collisionTestProps\"),r.initVectorizedAccessor(\"get_collision_priority\",\"getCollisionPriority\"),r.extensionLayerPropertyNames=[...r.extensionLayerPropertyNames,\"collisionEnabled\",\"collisionGroup\",\"collisionTestProps\",\"getCollisionPriority\"]}},k3=class extends Ng{static extensionType=\"data-filter\";extensionInstance;constructor(t,r,i){super(t,i);let s=this.model.get(\"filter_size\");this.extensionInstance=new xm({filterSize:s}),r.initRegularAttribute(\"filter_enabled\",\"filterEnabled\"),r.initRegularAttribute(\"filter_range\",\"filterRange\"),r.initRegularAttribute(\"filter_soft_range\",\"filterSoftRange\"),r.initRegularAttribute(\"filter_transform_size\",\"filterTransformSize\"),r.initRegularAttribute(\"filter_transform_color\",\"filterTransformColor\"),r.initVectorizedAccessor(\"get_filter_value\",\"getFilterValue\"),r.extensionLayerPropertyNames=[...r.extensionLayerPropertyNames,\"filterEnabled\",\"filterRange\",\"filterSoftRange\",\"filterTransformSize\",\"filterTransformColor\",\"getFilterValue\"]}},j2=class extends Ng{static extensionType=\"path-style\";extensionInstance;constructor(t,r,i){super(t,i);let s=this.model.get(\"dash\"),n=this.model.get(\"high_precision_dash\"),o=this.model.get(\"offset\");this.extensionInstance=new bm({...Jt(s)?{dash:s}:{},...Jt(n)?{highPrecisionDash:n}:{},...Jt(o)?{offset:o}:{}}),r.initRegularAttribute(\"dash_gap_pickable\",\"dashGapPickable\"),r.initRegularAttribute(\"dash_justified\",\"dashJustified\"),r.initVectorizedAccessor(\"get_dash_array\",\"getDashArray\"),r.initVectorizedAccessor(\"get_offset\",\"getOffset\"),r.extensionLayerPropertyNames=[...r.extensionLayerPropertyNames,\"dashGapPickable\",\"dashJustified\",\"getDashArray\",\"getOffset\"]}};async function rB(e,t,r){let i=e.get(\"_extension_type\"),s;switch(i){case U2.extensionType:s=new U2(e,t,r);break;case V2.extensionType:s=new V2(e,t,r);break;case k3.extensionType:s=new k3(e,t,r);break;case j2.extensionType:s=new j2(e,t,r);break;default:throw new Error(`no known model for extension type ${i}`)}return await s.loadSubModels(),s}var Ug=class extends zg{pickable;visible;opacity;autoHighlight;extensions;extensionLayerPropertyNames=[];constructor(t,r){super(t,r),this.initRegularAttribute(\"pickable\",\"pickable\"),this.initRegularAttribute(\"visible\",\"visible\"),this.initRegularAttribute(\"opacity\",\"opacity\"),this.initRegularAttribute(\"auto_highlight\",\"autoHighlight\"),this.extensions=[]}async loadSubModels(){await this.initLayerExtensions()}extensionInstances(){return this.extensions.map(t=>t.extensionInstance)}extensionProps(){let t={};for(let r of this.extensionLayerPropertyNames)Jt(this[r])&&(t[r]=this[r]);return t}onClick(t){t.index&&(this.model.set(\"selected_index\",t.index),this.model.save_changes())}baseLayerProps(){return{extensions:this.extensionInstances(),...this.extensionProps(),id:this.model.model_id,pickable:this.pickable,visible:this.visible,opacity:this.opacity,autoHighlight:this.autoHighlight,onClick:this.onClick.bind(this)}}async initLayerExtensions(){let t=async()=>{let r=this.model.get(\"extensions\");if(!r){this.extensions=[];return}let i=await L3(this.model.widget_manager,r),s=[];for(let n of i){let o=await rB(n,this,this.updateStateCallback);s.push(o)}this.extensions=s};await t(),this.model.off(\"change:extensions\"),this.model.on(\"change:extensions\",t),this.callbacks.set(\"change:extensions\",t)}};var JH=`#define SHADER_NAME arc-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec4 instanceSourceColors;\nattribute vec4 instanceTargetColors;\nattribute vec3 instanceSourcePositions;\nattribute vec3 instanceSourcePositions64Low;\nattribute vec3 instanceTargetPositions;\nattribute vec3 instanceTargetPositions64Low;\nattribute vec3 instancePickingColors;\nattribute float instanceWidths;\nattribute float instanceHeights;\nattribute float instanceTilts;\n\nuniform bool greatCircle;\nuniform bool useShortestPath;\nuniform float numSegments;\nuniform float opacity;\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform int widthUnits;\n\nvarying vec4 vColor;\nvarying vec2 uv;\nvarying float isValid;\n\nfloat paraboloid(float distance, float sourceZ, float targetZ, float ratio) {\n\n float deltaZ = targetZ - sourceZ;\n float dh = distance * instanceHeights;\n if (dh == 0.0) {\n return sourceZ + deltaZ * ratio;\n }\n float unitZ = deltaZ / dh;\n float p2 = unitZ * unitZ + 1.0;\n float dir = step(deltaZ, 0.0);\n float z0 = mix(sourceZ, targetZ, dir);\n float r = mix(ratio, 1.0 - ratio, dir);\n return sqrt(r * (p2 - r)) * dh + z0;\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {\n vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize);\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n return dir_screenspace * offset_direction * width / 2.0;\n}\n\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (numSegments - 1.0));\n}\n\nvec3 interpolateFlat(vec3 source, vec3 target, float segmentRatio) {\n float distance = length(source.xy - target.xy);\n float z = paraboloid(distance, source.z, target.z, segmentRatio);\n\n float tiltAngle = radians(instanceTilts);\n vec2 tiltDirection = normalize(target.xy - source.xy);\n vec2 tilt = vec2(-tiltDirection.y, tiltDirection.x) * z * sin(tiltAngle);\n\n return vec3(\n mix(source.xy, target.xy, segmentRatio) + tilt,\n z * cos(tiltAngle)\n );\n}\nfloat getAngularDist (vec2 source, vec2 target) {\n vec2 sourceRadians = radians(source);\n vec2 targetRadians = radians(target);\n vec2 sin_half_delta = sin((sourceRadians - targetRadians) / 2.0);\n vec2 shd_sq = sin_half_delta * sin_half_delta;\n\n float a = shd_sq.y + cos(sourceRadians.y) * cos(targetRadians.y) * shd_sq.x;\n return 2.0 * asin(sqrt(a));\n}\n\nvec3 interpolateGreatCircle(vec3 source, vec3 target, vec3 source3D, vec3 target3D, float angularDist, float t) {\n vec2 lngLat;\n if(abs(angularDist - PI) < 0.001) {\n lngLat = (1.0 - t) * source.xy + t * target.xy;\n } else {\n float a = sin((1.0 - t) * angularDist);\n float b = sin(t * angularDist);\n vec3 p = source3D.yxz * a + target3D.yxz * b;\n lngLat = degrees(vec2(atan(p.y, -p.x), atan(p.z, length(p.xy))));\n }\n\n float z = paraboloid(angularDist * EARTH_RADIUS, source.z, target.z, t);\n\n return vec3(lngLat, z);\n}\n\nvoid main(void) {\n geometry.worldPosition = instanceSourcePositions;\n geometry.worldPositionAlt = instanceTargetPositions;\n\n float segmentIndex = positions.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n float prevSegmentRatio = getSegmentRatio(max(0.0, segmentIndex - 1.0));\n float nextSegmentRatio = getSegmentRatio(min(numSegments - 1.0, segmentIndex + 1.0));\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n isValid = 1.0;\n\n uv = vec2(segmentRatio, positions.y);\n geometry.uv = uv;\n geometry.pickingColor = instancePickingColors;\n\n vec4 curr;\n vec4 next;\n vec3 source;\n vec3 target;\n\n if ((greatCircle || project_uProjectionMode == PROJECTION_MODE_GLOBE) && project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n source = project_globe_(vec3(instanceSourcePositions.xy, 0.0));\n target = project_globe_(vec3(instanceTargetPositions.xy, 0.0));\n float angularDist = getAngularDist(instanceSourcePositions.xy, instanceTargetPositions.xy);\n\n vec3 prevPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, prevSegmentRatio);\n vec3 currPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, segmentRatio);\n vec3 nextPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, nextSegmentRatio);\n\n if (abs(currPos.x - prevPos.x) > 180.0) {\n indexDir = -1.0;\n isValid = 0.0;\n } else if (abs(currPos.x - nextPos.x) > 180.0) {\n indexDir = 1.0;\n isValid = 0.0;\n }\n nextPos = indexDir < 0.0 ? prevPos : nextPos;\n nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;\n\n if (isValid == 0.0) {\n nextPos.x += nextPos.x > 0.0 ? -360.0 : 360.0;\n float t = ((currPos.x > 0.0 ? 180.0 : -180.0) - currPos.x) / (nextPos.x - currPos.x);\n currPos = mix(currPos, nextPos, t);\n segmentRatio = mix(segmentRatio, nextSegmentRatio, t);\n }\n\n vec3 currPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, segmentRatio);\n vec3 nextPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, nextSegmentRatio);\n \n curr = project_position_to_clipspace(currPos, currPos64Low, vec3(0.0), geometry.position);\n next = project_position_to_clipspace(nextPos, nextPos64Low, vec3(0.0));\n \n } else {\n vec3 source_world = instanceSourcePositions;\n vec3 target_world = instanceTargetPositions;\n if (useShortestPath) {\n source_world.x = mod(source_world.x + 180., 360.0) - 180.;\n target_world.x = mod(target_world.x + 180., 360.0) - 180.;\n\n float deltaLng = target_world.x - source_world.x;\n if (deltaLng > 180.) target_world.x -= 360.;\n if (deltaLng < -180.) source_world.x -= 360.;\n }\n source = project_position(source_world, instanceSourcePositions64Low);\n target = project_position(target_world, instanceTargetPositions64Low);\n float antiMeridianX = 0.0;\n\n if (useShortestPath) {\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\n antiMeridianX = -(project_uCoordinateOrigin.x + 180.) / 360. * TILE_SIZE;\n }\n float thresholdRatio = (antiMeridianX - source.x) / (target.x - source.x);\n\n if (prevSegmentRatio <= thresholdRatio && nextSegmentRatio > thresholdRatio) {\n isValid = 0.0;\n indexDir = sign(segmentRatio - thresholdRatio);\n segmentRatio = thresholdRatio;\n }\n }\n\n nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;\n vec3 currPos = interpolateFlat(source, target, segmentRatio);\n vec3 nextPos = interpolateFlat(source, target, nextSegmentRatio);\n\n if (useShortestPath) {\n if (nextPos.x < antiMeridianX) {\n currPos.x += TILE_SIZE;\n nextPos.x += TILE_SIZE;\n }\n }\n\n curr = project_common_position_to_clipspace(vec4(currPos, 1.0));\n next = project_common_position_to_clipspace(vec4(nextPos, 1.0));\n geometry.position = vec4(currPos, 1.0);\n }\n float widthPixels = clamp(\n project_size_to_pixel(instanceWidths * widthScale, widthUnits),\n widthMinPixels, widthMaxPixels\n );\n vec3 offset = vec3(\n getExtrusionOffset((next.xy - curr.xy) * indexDir, positions.y, widthPixels),\n 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n DECKGL_FILTER_GL_POSITION(curr, geometry);\n gl_Position = curr + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);\n\n vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio);\n vColor = vec4(color.rgb, color.a * opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;var tq=`#define SHADER_NAME arc-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\nvarying vec2 uv;\nvarying float isValid;\n\nvoid main(void) {\n if (isValid == 0.0) {\n discard;\n }\n\n gl_FragColor = vColor;\n geometry.uv = uv;\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var R3=[0,0,0,255],Udt={getSourcePosition:{type:\"accessor\",value:e=>e.sourcePosition},getTargetPosition:{type:\"accessor\",value:e=>e.targetPosition},getSourceColor:{type:\"accessor\",value:R3},getTargetColor:{type:\"accessor\",value:R3},getWidth:{type:\"accessor\",value:1},getHeight:{type:\"accessor\",value:1},getTilt:{type:\"accessor\",value:0},greatCircle:!1,numSegments:{type:\"number\",value:50,min:1},widthUnits:\"pixels\",widthScale:{type:\"number\",value:1,min:0},widthMinPixels:{type:\"number\",value:0,min:0},widthMaxPixels:{type:\"number\",value:Number.MAX_SAFE_INTEGER,min:0}},Tp=class extends dn{constructor(...t){super(...t),G(this,\"state\",void 0)}getBounds(){var t;return(t=this.getAttributeManager())===null||t===void 0?void 0:t.getBounds([\"instanceSourcePositions\",\"instanceTargetPositions\"])}getShaders(){return super.getShaders({vs:JH,fs:tq,modules:[Rs,Ao]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getSourcePosition\"},instanceTargetPositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getTargetPosition\"},instanceSourceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getSourceColor\",defaultValue:R3},instanceTargetColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getTargetColor\",defaultValue:R3},instanceWidths:{size:1,transition:!0,accessor:\"getWidth\",defaultValue:1},instanceHeights:{size:1,transition:!0,accessor:\"getHeight\",defaultValue:1},instanceTilts:{size:1,transition:!0,accessor:\"getTilt\",defaultValue:0}})}updateState(t){super.updateState(t);let{props:r,oldProps:i,changeFlags:s}=t;if(s.extensionsChanged||s.propsChanged&&r.numSegments!==i.numSegments){var n;let{gl:o}=this.context;(n=this.state.model)===null||n===void 0||n.delete(),this.state.model=this._getModel(o),this.getAttributeManager().invalidateAll()}}draw({uniforms:t}){let{widthUnits:r,widthScale:i,widthMinPixels:s,widthMaxPixels:n,greatCircle:o,wrapLongitude:c}=this.props;this.state.model.setUniforms(t).setUniforms({greatCircle:o,widthUnits:po[r],widthScale:i,widthMinPixels:s,widthMaxPixels:n,useShortestPath:c}).draw()}_getModel(t){let{id:r,numSegments:i}=this.props,s=[];for(let o=0;o0&&j>0&&(c[I++]=w-n,c[I++]=w-n-1,c[I++]=w-1,c[I++]=w-n,c[I++]=w-1,c[I++]=w),w++}}return{vertexCount:o,positions:_,indices:c,texCoords:f}}function Gdt(e){let t=new Float64Array(12);for(let r=0;r 0.5) {\n vTexPos = geometry.worldPosition.xy;\n }\n\n vec4 color = vec4(0.0);\n DECKGL_FILTER_COLOR(color, geometry);\n}\n`;var Hdt=`\nvec3 packUVsIntoRGB(vec2 uv) {\n // Extract the top 8 bits. We want values to be truncated down so we can add a fraction\n vec2 uv8bit = floor(uv * 256.);\n\n // Calculate the normalized remainders of u and v parts that do not fit into 8 bits\n // Scale and clamp to 0-1 range\n vec2 uvFraction = fract(uv * 256.);\n vec2 uvFraction4bit = floor(uvFraction * 16.);\n\n // Remainder can be encoded in blue channel, encode as 4 bits for pixel coordinates\n float fractions = uvFraction4bit.x + uvFraction4bit.y * 16.;\n\n return vec3(uv8bit, fractions) / 255.;\n}\n`,rq=`\n#define SHADER_NAME bitmap-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D bitmapTexture;\n\nvarying vec2 vTexCoord;\nvarying vec2 vTexPos;\n\nuniform float desaturate;\nuniform vec4 transparentColor;\nuniform vec3 tintColor;\nuniform float opacity;\n\nuniform float coordinateConversion;\nuniform vec4 bounds;\n\n/* projection utils */\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / PI / 2.0;\n\n// from degrees to Web Mercator\nvec2 lnglat_to_mercator(vec2 lnglat) {\n float x = lnglat.x;\n float y = clamp(lnglat.y, -89.9, 89.9);\n return vec2(\n radians(x) + PI,\n PI + log(tan(PI * 0.25 + radians(y) * 0.5))\n ) * WORLD_SCALE;\n}\n\n// from Web Mercator to degrees\nvec2 mercator_to_lnglat(vec2 xy) {\n xy /= WORLD_SCALE;\n return degrees(vec2(\n xy.x - PI,\n atan(exp(xy.y - PI)) * 2.0 - PI * 0.5\n ));\n}\n/* End projection utils */\n\n// apply desaturation\nvec3 color_desaturate(vec3 color) {\n float luminance = (color.r + color.g + color.b) * 0.333333333;\n return mix(color, vec3(luminance), desaturate);\n}\n\n// apply tint\nvec3 color_tint(vec3 color) {\n return color * tintColor;\n}\n\n// blend with background color\nvec4 apply_opacity(vec3 color, float alpha) {\n if (transparentColor.a == 0.0) {\n return vec4(color, alpha);\n }\n float blendedAlpha = alpha + transparentColor.a * (1.0 - alpha);\n float highLightRatio = alpha / blendedAlpha;\n vec3 blendedRGB = mix(transparentColor.rgb, color, highLightRatio);\n return vec4(blendedRGB, blendedAlpha);\n}\n\nvec2 getUV(vec2 pos) {\n return vec2(\n (pos.x - bounds[0]) / (bounds[2] - bounds[0]),\n (pos.y - bounds[3]) / (bounds[1] - bounds[3])\n );\n}\n\n`.concat(Hdt,`\n\nvoid main(void) {\n vec2 uv = vTexCoord;\n if (coordinateConversion < -0.5) {\n vec2 lnglat = mercator_to_lnglat(vTexPos);\n uv = getUV(lnglat);\n } else if (coordinateConversion > 0.5) {\n vec2 commonPos = lnglat_to_mercator(vTexPos);\n uv = getUV(commonPos);\n }\n vec4 bitmapColor = texture2D(bitmapTexture, uv);\n\n gl_FragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * opacity);\n\n geometry.uv = uv;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n\n if (picking_uActive && !picking_uAttribute) {\n // Since instance information is not used, we can use picking color for pixel index\n gl_FragColor.rgb = packUVsIntoRGB(uv);\n }\n}\n`);var qdt={image:{type:\"image\",value:null,async:!0},bounds:{type:\"array\",value:[1,0,0,1],compare:!0},_imageCoordinateSystem:Yr.DEFAULT,desaturate:{type:\"number\",min:0,max:1,value:0},transparentColor:{type:\"color\",value:[0,0,0,0]},tintColor:{type:\"color\",value:[255,255,255]},textureParameters:{type:\"object\",ignore:!0}},Mp=class extends dn{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(){return super.getShaders({vs:eq,fs:rq,modules:[Rs,Ao]})}initializeState(){let t=this.getAttributeManager();t.remove([\"instancePickingColors\"]);let r=!0;t.add({indices:{size:1,isIndexed:!0,update:i=>i.value=this.state.mesh.indices,noAlloc:r},positions:{size:3,type:5130,fp64:this.use64bitPositions(),update:i=>i.value=this.state.mesh.positions,noAlloc:r},texCoords:{size:2,update:i=>i.value=this.state.mesh.texCoords,noAlloc:r}})}updateState({props:t,oldProps:r,changeFlags:i}){let s=this.getAttributeManager();if(i.extensionsChanged){var n;let{gl:o}=this.context;(n=this.state.model)===null||n===void 0||n.delete(),this.state.model=this._getModel(o),s.invalidateAll()}if(t.bounds!==r.bounds){let o=this.state.mesh,c=this._createMesh();this.state.model.setVertexCount(c.vertexCount);for(let f in c)o&&o[f]!==c[f]&&s.invalidate(f);this.setState({mesh:c,...this._getCoordinateUniforms()})}else t._imageCoordinateSystem!==r._imageCoordinateSystem&&this.setState(this._getCoordinateUniforms())}getPickingInfo(t){let{image:r}=this.props,i=t.info;if(!i.color||!r)return i.bitmap=null,i;let{width:s,height:n}=r;i.index=0;let o=Zdt(i.color),c=[Math.floor(o[0]*s),Math.floor(o[1]*n)];return i.bitmap={size:{width:s,height:n},uv:o,pixel:c},i}disablePickingIndex(){this.setState({disablePicking:!0})}restorePickingColors(){this.setState({disablePicking:!1})}_updateAutoHighlight(t){super._updateAutoHighlight({...t,color:this.encodePickingColor(0)})}_createMesh(){let{bounds:t}=this.props,r=t;return iq(t)&&(r=[[t[0],t[1]],[t[0],t[3]],[t[2],t[3]],[t[2],t[1]]]),iB(r,this.context.viewport.resolution)}_getModel(t){return t?new fn(t,{...this.getShaders(),id:this.props.id,geometry:new $n({drawMode:4,vertexCount:6}),isInstanced:!1}):null}draw(t){let{uniforms:r,moduleParameters:i}=t,{model:s,coordinateConversion:n,bounds:o,disablePicking:c}=this.state,{image:f,desaturate:_,transparentColor:w,tintColor:I}=this.props;i.pickingActive&&c||f&&s&&s.setUniforms(r).setUniforms({bitmapTexture:f,desaturate:_,transparentColor:w.map(R=>R/255),tintColor:I.slice(0,3).map(R=>R/255),coordinateConversion:n,bounds:o}).draw()}_getCoordinateUniforms(){let{LNGLAT:t,CARTESIAN:r,DEFAULT:i}=Yr,{_imageCoordinateSystem:s}=this.props;if(s!==i){let{bounds:n}=this.props;if(!iq(n))throw new Error(\"_imageCoordinateSystem only supports rectangular bounds\");let o=this.context.viewport.resolution?t:r;if(s=s===t?t:r,s===t&&o===r)return{coordinateConversion:-1,bounds:n};if(s===r&&o===t){let c=va([n[0],n[1]]),f=va([n[2],n[3]]);return{coordinateConversion:1,bounds:[c[0],c[1],f[0],f[1]]}}}return{coordinateConversion:0,bounds:[0,0,0,0]}}};G(Mp,\"layerName\",\"BitmapLayer\");G(Mp,\"defaultProps\",qdt);function Zdt(e){let[t,r,i]=e,s=(i&240)/256,n=(i&15)/16;return[(t+n)/256,(r+s)/256]}function iq(e){return Number.isFinite(e[0])}var nq=`#define SHADER_NAME icon-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute float instanceSizes;\nattribute float instanceAngles;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute vec4 instanceIconFrames;\nattribute float instanceColorModes;\nattribute vec2 instanceOffsets;\nattribute vec2 instancePixelOffset;\n\nuniform float sizeScale;\nuniform vec2 iconsTextureDim;\nuniform float sizeMinPixels;\nuniform float sizeMaxPixels;\nuniform bool billboard;\nuniform int sizeUnits;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\nvarying vec2 uv;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n float angle_radian = angle * PI / 180.0;\n float cos_angle = cos(angle_radian);\n float sin_angle = sin(angle_radian);\n mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n geometry.uv = positions;\n geometry.pickingColor = instancePickingColors;\n uv = positions;\n\n vec2 iconSize = instanceIconFrames.zw;\n float sizePixels = clamp(\n project_size_to_pixel(instanceSizes * sizeScale, sizeUnits), \n sizeMinPixels, sizeMaxPixels\n );\n float instanceScale = iconSize.y == 0.0 ? 0.0 : sizePixels / iconSize.y;\n vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;\n pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale;\n pixelOffset += instancePixelOffset;\n pixelOffset.y *= -1.0;\n\n if (billboard) {\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vec3 offset = vec3(pixelOffset, 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n\n } else {\n vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);\n DECKGL_FILTER_SIZE(offset_common, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); \n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n\n vTextureCoords = mix(\n instanceIconFrames.xy,\n instanceIconFrames.xy + iconSize,\n (positions.xy + 1.0) / 2.0\n ) / iconsTextureDim;\n\n vColor = instanceColors;\n DECKGL_FILTER_COLOR(vColor, geometry);\n\n vColorMode = instanceColorModes;\n}\n`;var sq=`#define SHADER_NAME icon-layer-fragment-shader\n\nprecision highp float;\n\nuniform float opacity;\nuniform sampler2D iconsTexture;\nuniform float alphaCutoff;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\nvarying vec2 uv;\n\nvoid main(void) {\n geometry.uv = uv;\n\n vec4 texColor = texture2D(iconsTexture, vTextureCoords);\n vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode);\n float a = texColor.a * opacity * vColor.a;\n\n if (a < alphaCutoff) {\n discard;\n }\n\n gl_FragColor = vec4(color, a);\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var Ydt=1024,Qdt=4,oq=()=>{},aq={10241:9987,10240:9729,10242:33071,10243:33071};function $dt(e){return Math.pow(2,Math.ceil(Math.log2(e)))}function Xdt(e,t,r,i){let s=Math.min(r/t.width,i/t.height),n=Math.floor(t.width*s),o=Math.floor(t.height*s);return s===1?{data:t,width:n,height:o}:(e.canvas.height=o,e.canvas.width=n,e.clearRect(0,0,n,o),e.drawImage(t,0,0,t.width,t.height,0,0,n,o),{data:e.canvas,width:n,height:o})}function G2(e){return e&&(e.id||e.url)}function Kdt(e,t,r,i){let s=e.width,n=e.height,o=new pi(e.gl,{width:t,height:r,parameters:i});return gE(e,o,{targetY:0,width:s,height:n}),e.delete(),o}function lq(e,t,r){for(let i=0;io&&(lq(r,c,s),i=0,s=n+s+t,n=0,c=[]),c.push({icon:_,xOffset:i}),i=i+R+t,n=Math.max(n,I)}}return c.length>0&&lq(r,c,s),{mapping:r,rowHeight:n,xOffset:i,yOffset:s,canvasWidth:o,canvasHeight:$dt(n+s+t)}}function tpt(e,t,r){if(!e||!t)return null;r=r||{};let i={},{iterable:s,objectInfo:n}=Jc(e);for(let o of s){n.index++;let c=t(o,n),f=G2(c);if(!c)throw new Error(\"Icon is missing.\");if(!c.url)throw new Error(\"Icon url is missing.\");!i[f]&&(!r[f]||c.url!==r[f].url)&&(i[f]={...c,source:o,sourceIndex:n.index})}return i}var W2=class{constructor(t,{onUpdate:r=oq,onError:i=oq}){G(this,\"gl\",void 0),G(this,\"onUpdate\",void 0),G(this,\"onError\",void 0),G(this,\"_loadOptions\",null),G(this,\"_texture\",null),G(this,\"_externalTexture\",null),G(this,\"_mapping\",{}),G(this,\"_textureParameters\",null),G(this,\"_pendingCount\",0),G(this,\"_autoPacking\",!1),G(this,\"_xOffset\",0),G(this,\"_yOffset\",0),G(this,\"_rowHeight\",0),G(this,\"_buffer\",Qdt),G(this,\"_canvasWidth\",Ydt),G(this,\"_canvasHeight\",0),G(this,\"_canvas\",null),this.gl=t,this.onUpdate=r,this.onError=i}finalize(){var t;(t=this._texture)===null||t===void 0||t.delete()}getTexture(){return this._texture||this._externalTexture}getIconMapping(t){let r=this._autoPacking?G2(t):t;return this._mapping[r]||{}}setProps({loadOptions:t,autoPacking:r,iconAtlas:i,iconMapping:s,textureParameters:n}){if(t&&(this._loadOptions=t),r!==void 0&&(this._autoPacking=r),s&&(this._mapping=s),i){var o;(o=this._texture)===null||o===void 0||o.delete(),this._texture=null,this._externalTexture=i}n&&(this._textureParameters=n)}get isLoaded(){return this._pendingCount===0}packIcons(t,r){if(!this._autoPacking||typeof document>\"u\")return;let i=Object.values(tpt(t,r,this._mapping)||{});if(i.length>0){let{mapping:s,xOffset:n,yOffset:o,rowHeight:c,canvasHeight:f}=Jdt({icons:i,buffer:this._buffer,canvasWidth:this._canvasWidth,mapping:this._mapping,rowHeight:this._rowHeight,xOffset:this._xOffset,yOffset:this._yOffset});this._rowHeight=c,this._mapping=s,this._xOffset=n,this._yOffset=o,this._canvasHeight=f,this._texture||(this._texture=new pi(this.gl,{width:this._canvasWidth,height:this._canvasHeight,parameters:this._textureParameters||aq})),this._texture.height!==this._canvasHeight&&(this._texture=Kdt(this._texture,this._canvasWidth,this._canvasHeight,this._textureParameters||aq)),this.onUpdate(),this._canvas=this._canvas||document.createElement(\"canvas\"),this._loadIcons(i)}}_loadIcons(t){let r=this._canvas.getContext(\"2d\",{willReadFrequently:!0});for(let i of t)this._pendingCount++,jA(i.url,this._loadOptions).then(s=>{let n=G2(i),o=this._mapping[n],{x:c,y:f,width:_,height:w}=o,{data:I,width:R,height:N}=Xdt(r,s,_,w);this._texture.setSubImageData({data:I,x:c+(_-R)/2,y:f+(w-N)/2,width:R,height:N}),o.width=R,o.height=N,this._texture.generateMipmap(),this.onUpdate()}).catch(s=>{this.onError({url:i.url,source:i.source,sourceIndex:i.sourceIndex,loadOptions:this._loadOptions,error:s})}).finally(()=>{this._pendingCount--})}};var cq=[0,0,0,255],ept={iconAtlas:{type:\"image\",value:null,async:!0},iconMapping:{type:\"object\",value:{},async:!0},sizeScale:{type:\"number\",value:1,min:0},billboard:!0,sizeUnits:\"pixels\",sizeMinPixels:{type:\"number\",min:0,value:0},sizeMaxPixels:{type:\"number\",min:0,value:Number.MAX_SAFE_INTEGER},alphaCutoff:{type:\"number\",value:.05,min:0,max:1},getPosition:{type:\"accessor\",value:e=>e.position},getIcon:{type:\"accessor\",value:e=>e.icon},getColor:{type:\"accessor\",value:cq},getSize:{type:\"accessor\",value:1},getAngle:{type:\"accessor\",value:0},getPixelOffset:{type:\"accessor\",value:[0,0]},onIconError:{type:\"function\",value:null,optional:!0},textureParameters:{type:\"object\",ignore:!0}},Ep=class extends dn{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(){return super.getShaders({vs:nq,fs:sq,modules:[Rs,Ao]})}initializeState(){this.state={iconManager:new W2(this.context.gl,{onUpdate:this._onUpdate.bind(this),onError:this._onError.bind(this)})},this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getPosition\"},instanceSizes:{size:1,transition:!0,accessor:\"getSize\",defaultValue:1},instanceOffsets:{size:2,accessor:\"getIcon\",transform:this.getInstanceOffset},instanceIconFrames:{size:4,accessor:\"getIcon\",transform:this.getInstanceIconFrame},instanceColorModes:{size:1,type:5121,accessor:\"getIcon\",transform:this.getInstanceColorMode},instanceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getColor\",defaultValue:cq},instanceAngles:{size:1,transition:!0,accessor:\"getAngle\"},instancePixelOffset:{size:2,transition:!0,accessor:\"getPixelOffset\"}})}updateState(t){super.updateState(t);let{props:r,oldProps:i,changeFlags:s}=t,n=this.getAttributeManager(),{iconAtlas:o,iconMapping:c,data:f,getIcon:_,textureParameters:w}=r,{iconManager:I}=this.state,R=o||this.internalState.isAsyncPropLoading(\"iconAtlas\");if(I.setProps({loadOptions:r.loadOptions,autoPacking:!R,iconAtlas:o,iconMapping:R?c:null,textureParameters:w}),R?i.iconMapping!==r.iconMapping&&n.invalidate(\"getIcon\"):(s.dataChanged||s.updateTriggersChanged&&(s.updateTriggersChanged.all||s.updateTriggersChanged.getIcon))&&I.packIcons(f,_),s.extensionsChanged){var N;let{gl:j}=this.context;(N=this.state.model)===null||N===void 0||N.delete(),this.state.model=this._getModel(j),n.invalidateAll()}}get isLoaded(){return super.isLoaded&&this.state.iconManager.isLoaded}finalizeState(t){super.finalizeState(t),this.state.iconManager.finalize()}draw({uniforms:t}){let{sizeScale:r,sizeMinPixels:i,sizeMaxPixels:s,sizeUnits:n,billboard:o,alphaCutoff:c}=this.props,{iconManager:f}=this.state,_=f.getTexture();_&&this.state.model.setUniforms(t).setUniforms({iconsTexture:_,iconsTextureDim:[_.width,_.height],sizeUnits:po[n],sizeScale:r,sizeMinPixels:i,sizeMaxPixels:s,billboard:o,alphaCutoff:c}).draw()}_getModel(t){let r=[-1,-1,-1,1,1,1,1,-1];return new fn(t,{...this.getShaders(),id:this.props.id,geometry:new $n({drawMode:6,attributes:{positions:{size:2,value:new Float32Array(r)}}}),isInstanced:!0})}_onUpdate(){this.setNeedsRedraw()}_onError(t){var r;let i=(r=this.getCurrentLayer())===null||r===void 0?void 0:r.props.onIconError;i?i(t):or.error(t.error.message)()}getInstanceOffset(t){let{width:r,height:i,anchorX:s=r/2,anchorY:n=i/2}=this.state.iconManager.getIconMapping(t);return[r/2-s,i/2-n]}getInstanceColorMode(t){return this.state.iconManager.getIconMapping(t).mask?1:0}getInstanceIconFrame(t){let{x:r,y:i,width:s,height:n}=this.state.iconManager.getIconMapping(t);return[r,i,s,n]}};G(Ep,\"defaultProps\",ept);G(Ep,\"layerName\",\"IconLayer\");var uq=`#define SHADER_NAME point-cloud-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 instanceNormals;\nattribute vec4 instanceColors;\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute vec3 instancePickingColors;\n\nuniform float opacity;\nuniform float radiusPixels;\nuniform int sizeUnits;\n\nvarying vec4 vColor;\nvarying vec2 unitPosition;\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n geometry.normal = project_normal(instanceNormals);\n unitPosition = positions.xy;\n geometry.uv = unitPosition;\n geometry.pickingColor = instancePickingColors;\n vec3 offset = vec3(positions.xy * project_size_to_pixel(radiusPixels, sizeUnits), 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n vec3 lightColor = lighting_getLightColor(instanceColors.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal);\n vColor = vec4(lightColor, instanceColors.a * opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;var hq=`#define SHADER_NAME point-cloud-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\nvarying vec2 unitPosition;\n\nvoid main(void) {\n geometry.uv = unitPosition;\n\n float distToCenter = length(unitPosition);\n\n if (distToCenter > 1.0) {\n discard;\n }\n\n gl_FragColor = vColor;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var fq=[0,0,0,255],dq=[0,0,1],rpt={sizeUnits:\"pixels\",pointSize:{type:\"number\",min:0,value:10},getPosition:{type:\"accessor\",value:e=>e.position},getNormal:{type:\"accessor\",value:dq},getColor:{type:\"accessor\",value:fq},material:!0,radiusPixels:{deprecatedFor:\"pointSize\"}};function ipt(e){let{header:t,attributes:r}=e;!t||!r||(e.length=t.vertexCount,r.POSITION&&(r.instancePositions=r.POSITION),r.NORMAL&&(r.instanceNormals=r.NORMAL),r.COLOR_0&&(r.instanceColors=r.COLOR_0))}var Pp=class extends dn{getShaders(){return super.getShaders({vs:uq,fs:hq,modules:[Rs,Zf,Ao]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getPosition\"},instanceNormals:{size:3,transition:!0,accessor:\"getNormal\",defaultValue:dq},instanceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getColor\",defaultValue:fq}})}updateState(t){let{changeFlags:r,props:i}=t;if(super.updateState(t),r.extensionsChanged){var s;let{gl:n}=this.context;(s=this.state.model)===null||s===void 0||s.delete(),this.state.model=this._getModel(n),this.getAttributeManager().invalidateAll()}r.dataChanged&&ipt(i.data)}draw({uniforms:t}){let{pointSize:r,sizeUnits:i}=this.props;this.state.model.setUniforms(t).setUniforms({sizeUnits:po[i],radiusPixels:r}).draw()}_getModel(t){let r=[];for(let i=0;i<3;i++){let s=i/3*Math.PI*2;r.push(Math.cos(s)*2,Math.sin(s)*2,0)}return new fn(t,{...this.getShaders(),id:this.props.id,geometry:new $n({drawMode:4,attributes:{positions:new Float32Array(r)}}),isInstanced:!0})}};G(Pp,\"layerName\",\"PointCloudLayer\");G(Pp,\"defaultProps\",rpt);var pq=`#define SHADER_NAME scatterplot-layer-vertex-shader\n\nattribute vec3 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute float instanceRadius;\nattribute float instanceLineWidths;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\nuniform float opacity;\nuniform float radiusScale;\nuniform float radiusMinPixels;\nuniform float radiusMaxPixels;\nuniform float lineWidthScale;\nuniform float lineWidthMinPixels;\nuniform float lineWidthMaxPixels;\nuniform float stroked;\nuniform bool filled;\nuniform bool antialiasing;\nuniform bool billboard;\nuniform int radiusUnits;\nuniform int lineWidthUnits;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying vec2 unitPosition;\nvarying float innerUnitRadius;\nvarying float outerRadiusPixels;\n\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n outerRadiusPixels = clamp(\n project_size_to_pixel(radiusScale * instanceRadius, radiusUnits),\n radiusMinPixels, radiusMaxPixels\n );\n float lineWidthPixels = clamp(\n project_size_to_pixel(lineWidthScale * instanceLineWidths, lineWidthUnits),\n lineWidthMinPixels, lineWidthMaxPixels\n );\n outerRadiusPixels += stroked * lineWidthPixels / 2.0;\n float edgePadding = antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0;\n unitPosition = edgePadding * positions.xy;\n geometry.uv = unitPosition;\n geometry.pickingColor = instancePickingColors;\n\n innerUnitRadius = 1.0 - stroked * lineWidthPixels / outerRadiusPixels;\n \n if (billboard) {\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vec3 offset = edgePadding * positions * outerRadiusPixels;\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n } else {\n vec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);\n DECKGL_FILTER_COLOR(vFillColor, geometry);\n vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);\n DECKGL_FILTER_COLOR(vLineColor, geometry);\n}\n`;var Aq=`#define SHADER_NAME scatterplot-layer-fragment-shader\n\nprecision highp float;\n\nuniform bool filled;\nuniform float stroked;\nuniform bool antialiasing;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying vec2 unitPosition;\nvarying float innerUnitRadius;\nvarying float outerRadiusPixels;\n\nvoid main(void) {\n geometry.uv = unitPosition;\n\n float distToCenter = length(unitPosition) * outerRadiusPixels;\n float inCircle = antialiasing ? \n smoothedge(distToCenter, outerRadiusPixels) : \n step(distToCenter, outerRadiusPixels);\n\n if (inCircle == 0.0) {\n discard;\n }\n\n if (stroked > 0.5) {\n float isLine = antialiasing ? \n smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) :\n step(innerUnitRadius * outerRadiusPixels, distToCenter);\n\n if (filled) {\n gl_FragColor = mix(vFillColor, vLineColor, isLine);\n } else {\n if (isLine == 0.0) {\n discard;\n }\n gl_FragColor = vec4(vLineColor.rgb, vLineColor.a * isLine);\n }\n } else if (!filled) {\n discard;\n } else {\n gl_FragColor = vFillColor;\n }\n\n gl_FragColor.a *= inCircle;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var mq=[0,0,0,255],npt={radiusUnits:\"meters\",radiusScale:{type:\"number\",min:0,value:1},radiusMinPixels:{type:\"number\",min:0,value:0},radiusMaxPixels:{type:\"number\",min:0,value:Number.MAX_SAFE_INTEGER},lineWidthUnits:\"meters\",lineWidthScale:{type:\"number\",min:0,value:1},lineWidthMinPixels:{type:\"number\",min:0,value:0},lineWidthMaxPixels:{type:\"number\",min:0,value:Number.MAX_SAFE_INTEGER},stroked:!1,filled:!0,billboard:!1,antialiasing:!0,getPosition:{type:\"accessor\",value:e=>e.position},getRadius:{type:\"accessor\",value:1},getFillColor:{type:\"accessor\",value:mq},getLineColor:{type:\"accessor\",value:mq},getLineWidth:{type:\"accessor\",value:1},strokeWidth:{deprecatedFor:\"getLineWidth\"},outline:{deprecatedFor:\"stroked\"},getColor:{deprecatedFor:[\"getFillColor\",\"getLineColor\"]}},Ku=class extends dn{getShaders(){return super.getShaders({vs:pq,fs:Aq,modules:[Rs,Ao]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getPosition\"},instanceRadius:{size:1,transition:!0,accessor:\"getRadius\",defaultValue:1},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,normalized:!0,type:5121,accessor:\"getFillColor\",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,normalized:!0,type:5121,accessor:\"getLineColor\",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:\"getLineWidth\",defaultValue:1}})}updateState(t){if(super.updateState(t),t.changeFlags.extensionsChanged){var r;let{gl:i}=this.context;(r=this.state.model)===null||r===void 0||r.delete(),this.state.model=this._getModel(i),this.getAttributeManager().invalidateAll()}}draw({uniforms:t}){let{radiusUnits:r,radiusScale:i,radiusMinPixels:s,radiusMaxPixels:n,stroked:o,filled:c,billboard:f,antialiasing:_,lineWidthUnits:w,lineWidthScale:I,lineWidthMinPixels:R,lineWidthMaxPixels:N}=this.props;this.state.model.setUniforms(t).setUniforms({stroked:o?1:0,filled:c,billboard:f,antialiasing:_,radiusUnits:po[r],radiusScale:i,radiusMinPixels:s,radiusMaxPixels:n,lineWidthUnits:po[w],lineWidthScale:I,lineWidthMinPixels:R,lineWidthMaxPixels:N}).draw()}_getModel(t){let r=[-1,-1,0,1,-1,0,1,1,0,-1,1,0];return new fn(t,{...this.getShaders(),id:this.props.id,geometry:new $n({drawMode:6,vertexCount:4,attributes:{positions:{size:3,value:new Float32Array(r)}}}),isInstanced:!0})}};G(Ku,\"defaultProps\",npt);G(Ku,\"layerName\",\"ScatterplotLayer\");var Kv={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function Vg(e,t,r={}){return gq(e,r)!==t?(spt(e,r),!0):!1}function gq(e,t={}){return Math.sign(D3(e,t))}function D3(e,t={}){let{start:r=0,end:i=e.length}=t,s=t.size||2,n=0;for(let o=r,c=i-s;o0){let s=!0;for(let n=0;nt[2]&&(r|=2),e[1]t[3]&&(r|=8),r}function Z2(e,t){let{size:r=2,broken:i=!1,gridResolution:s=10,gridOffset:n=[0,0],startIndex:o=0,endIndex:c=e.length}=t||{},f=(c-o)/r,_=[],w=[_],I=Sm(e,0,r,o),R,N,j=vq(I,s,n,[]),Q=[];xc(_,I);for(let et=1;etr&&(_=[],w.push(_),xc(_,I)),N=q2(R,j)}xc(_,R),H2(I,R)}return i?w:w[0]}var _q=0,apt=1;function B3(e,t){for(let r=0;r=0?(xc(_,N)&&I.push(Q),ut+=j):I.length&&(I[I.length-1]=_q),H2(et,N),Y=j,K=Q;return[J?{pos:f,types:t&&w}:null,ut?{pos:_,types:t&&I}:null]}function vq(e,t,r,i){let s=Math.floor((e[0]-r[0])/t)*t+r[0],n=Math.floor((e[1]-r[1])/t)*t+r[1];return i[0]=s,i[1]=n,i[2]=s+t,i[3]=n+t,i}function lpt(e,t,r){r&8?(e[1]+=t,e[3]+=t):r&4?(e[1]-=t,e[3]-=t):r&2?(e[0]+=t,e[2]+=t):r&1&&(e[0]-=t,e[2]-=t)}function cpt(e,t,r,i){let s=1/0,n=-1/0,o=1/0,c=-1/0;for(let f=0;fn?_:n,o=wc?w:c}return i[0][0]=s,i[0][1]=o,i[1][0]=n,i[1][1]=c,i}var upt=85.051129;function nB(e,t){let{size:r=2,startIndex:i=0,endIndex:s=e.length,normalize:n=!0}=t||{},o=e.slice(i,s);xq(o,r,0,s-i);let c=Z2(o,{size:r,broken:!0,gridResolution:360,gridOffset:[-180,-180]});if(n)for(let f of c)bq(f,r);return c}function sB(e,t=null,r){let{size:i=2,normalize:s=!0,edgeTypes:n=!1}=r||{};t=t||[];let o=[],c=[],f=0,_=0;for(let I=0;I<=t.length;I++){let R=t[I]||e.length,N=_,j=hpt(e,i,f,R);for(let Q=j;Qs&&(s=c,n=o-1)}return n}function fpt(e,t,r,i,s=upt){let n=e[r],o=e[i-t];if(Math.abs(n-o)>180){let c=Sm(e,0,t,r);c[0]+=Math.round((o-n)/360)*360,xc(e,c),c[1]=Math.sign(c[1])*s,xc(e,c),c[0]=n,xc(e,c)}}function xq(e,t,r,i){let s=e[0],n;for(let o=r;o180||c<-180)&&(n-=Math.round(c/360)*360),e[o]=s=n}}function bq(e,t){let r,i=e.length/t;for(let n=0;n=i),s=s.flatMap(N=>[N[0],N[1]]),Vg(s,Kv.COUNTER_CLOCKWISE));let n=r>0,o=i+1,c=n?o*3+1:i,f=Math.PI*2/i,_=new Uint16Array(n?i*3*2:0),w=new Float32Array(c*3),I=new Float32Array(c*3),R=0;if(n){for(let N=0;N 0.0 && instanceElevations >= 0.0);\n float dotRadius = radius * coverage * shouldRender;\n\n geometry.pickingColor = instancePickingColors;\n vec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation);\n vec3 centroidPosition64Low = instancePositions64Low;\n vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + offset) * dotRadius;\n if (radiusUnits == UNIT_METERS) {\n offset = project_size(offset);\n }\n vec3 pos = vec3(offset, 0.);\n DECKGL_FILTER_SIZE(pos, geometry);\n\n gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);\n geometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z));\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n if (extruded && !isStroke) {\n#ifdef FLAT_SHADING\n position_commonspace = geometry.position;\n vColor = vec4(color.rgb, color.a * opacity);\n#else\n vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal);\n vColor = vec4(lightColor, color.a * opacity);\n#endif\n } else {\n vColor = vec4(color.rgb, color.a * opacity);\n }\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;var Sq=`#version 300 es\n#define SHADER_NAME column-layer-fragment-shader\n\nprecision highp float;\n\nuniform vec3 project_uCameraPosition;\nuniform bool extruded;\nuniform bool isStroke;\n\nout vec4 fragColor;\n\nin vec4 vColor;\n#ifdef FLAT_SHADING\nin vec4 position_commonspace;\n#endif\n\nvoid main(void) {\n fragColor = vColor;\n#ifdef FLAT_SHADING\n if (extruded && !isStroke && !picking_uActive) {\n vec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n fragColor.rgb = lighting_getLightColor(vColor.rgb, project_uCameraPosition, position_commonspace.xyz, normal);\n }\n#endif\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`;var F3=[0,0,0,255],Apt={diskResolution:{type:\"number\",min:4,value:20},vertices:null,radius:{type:\"number\",min:0,value:1e3},angle:{type:\"number\",value:0},offset:{type:\"array\",value:[0,0]},coverage:{type:\"number\",min:0,max:1,value:1},elevationScale:{type:\"number\",min:0,value:1},radiusUnits:\"meters\",lineWidthUnits:\"meters\",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,extruded:!0,wireframe:!1,filled:!0,stroked:!1,getPosition:{type:\"accessor\",value:e=>e.position},getFillColor:{type:\"accessor\",value:F3},getLineColor:{type:\"accessor\",value:F3},getLineWidth:{type:\"accessor\",value:1},getElevation:{type:\"accessor\",value:1e3},material:!0,getColor:{deprecatedFor:[\"getFillColor\",\"getLineColor\"]}},af=class extends dn{getShaders(){let{gl:t}=this.context,r=!fr(t),i={},s=this.props.flatShading&&$0(t,Ii.GLSL_DERIVATIVES);return s&&(i.FLAT_SHADING=1),super.getShaders({vs:wq,fs:Sq,defines:i,transpileToGLSL100:r,modules:[Rs,s?Ny:Zf,Ao]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getPosition\"},instanceElevations:{size:1,transition:!0,accessor:\"getElevation\"},instanceFillColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getFillColor\",defaultValue:F3},instanceLineColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getLineColor\",defaultValue:F3},instanceStrokeWidths:{size:1,accessor:\"getLineWidth\",transition:!0}})}updateState(t){super.updateState(t);let{props:r,oldProps:i,changeFlags:s}=t,n=s.extensionsChanged||r.flatShading!==i.flatShading;if(n){var o;let{gl:c}=this.context;(o=this.state.model)===null||o===void 0||o.delete(),this.state.model=this._getModel(c),this.getAttributeManager().invalidateAll()}(n||r.diskResolution!==i.diskResolution||r.vertices!==i.vertices||(r.extruded||r.stroked)!==(i.extruded||i.stroked))&&this._updateGeometry(r)}getGeometry(t,r,i){let s=new Q2({radius:1,height:i?2:0,vertices:r,nradial:t}),n=0;if(r)for(let o=0;o=t.length&&(r+=1-t.length/s);let n=r*s;return i[0]=t[n],i[1]=t[n+1],i[2]=s===3&&t[n+2]||0,i}isClosed(t){if(!this.normalize)return!!this.opts.loop;let{positionSize:r}=this,i=t.length-r;return t[0]===t[i]&&t[1]===t[i+1]&&(r===2||t[2]===t[i+2])}};function Mq(e){return Array.isArray(e[0])}var Eq=`#define SHADER_NAME path-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute float instanceTypes;\nattribute vec3 instanceStartPositions;\nattribute vec3 instanceEndPositions;\nattribute vec3 instanceLeftPositions;\nattribute vec3 instanceRightPositions;\nattribute vec3 instanceLeftPositions64Low;\nattribute vec3 instanceStartPositions64Low;\nattribute vec3 instanceEndPositions64Low;\nattribute vec3 instanceRightPositions64Low;\nattribute float instanceStrokeWidths;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform float jointType;\nuniform float capType;\nuniform float miterLimit;\nuniform bool billboard;\nuniform int widthUnits;\n\nuniform float opacity;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vPathPosition;\nvarying float vPathLength;\nvarying float vJointType;\n\nconst float EPSILON = 0.001;\nconst vec3 ZERO_OFFSET = vec3(0.0);\n\nfloat flipIfTrue(bool flag) {\n return -(float(flag) * 2. - 1.);\n}\nvec3 getLineJoinOffset(\n vec3 prevPoint, vec3 currPoint, vec3 nextPoint,\n vec2 width\n) {\n bool isEnd = positions.x > 0.0;\n float sideOfPath = positions.y;\n float isJoint = float(sideOfPath == 0.0);\n\n vec3 deltaA3 = (currPoint - prevPoint);\n vec3 deltaB3 = (nextPoint - currPoint);\n\n mat3 rotationMatrix;\n bool needsRotation = !billboard && project_needs_rotation(currPoint, rotationMatrix);\n if (needsRotation) {\n deltaA3 = deltaA3 * rotationMatrix;\n deltaB3 = deltaB3 * rotationMatrix;\n }\n vec2 deltaA = deltaA3.xy / width;\n vec2 deltaB = deltaB3.xy / width;\n\n float lenA = length(deltaA);\n float lenB = length(deltaB);\n\n vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0);\n vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0);\n\n vec2 perpA = vec2(-dirA.y, dirA.x);\n vec2 perpB = vec2(-dirB.y, dirB.x);\n vec2 tangent = dirA + dirB;\n tangent = length(tangent) > 0. ? normalize(tangent) : perpA;\n vec2 miterVec = vec2(-tangent.y, tangent.x);\n vec2 dir = isEnd ? dirA : dirB;\n vec2 perp = isEnd ? perpA : perpB;\n float L = isEnd ? lenA : lenB;\n float sinHalfA = abs(dot(miterVec, perp));\n float cosHalfA = abs(dot(dirA, miterVec));\n float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x);\n float cornerPosition = sideOfPath * turnDirection;\n\n float miterSize = 1.0 / max(sinHalfA, EPSILON);\n miterSize = mix(\n min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)),\n miterSize,\n step(0.0, cornerPosition)\n );\n\n vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition))\n * (sideOfPath + isJoint * turnDirection);\n bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0));\n bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0));\n bool isCap = isStartCap || isEndCap;\n if (isCap) {\n offsetVec = mix(perp * sideOfPath, dir * capType * 4.0 * flipIfTrue(isStartCap), isJoint);\n vJointType = capType;\n } else {\n vJointType = jointType;\n }\n vPathLength = L;\n vCornerOffset = offsetVec;\n vMiterLength = dot(vCornerOffset, miterVec * turnDirection);\n vMiterLength = isCap ? isJoint : vMiterLength;\n\n vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd);\n vPathPosition = vec2(\n dot(offsetFromStartOfPath, perp),\n dot(offsetFromStartOfPath, dir)\n );\n geometry.uv = vPathPosition;\n\n float isValid = step(instanceTypes, 3.5);\n vec3 offset = vec3(offsetVec * width * isValid, 0.0);\n\n if (needsRotation) {\n offset = rotationMatrix * offset;\n }\n return offset;\n}\nvoid clipLine(inout vec4 position, vec4 refPosition) {\n if (position.w < EPSILON) {\n float r = (EPSILON - refPosition.w) / (position.w - refPosition.w);\n position = refPosition + (position - refPosition) * r;\n }\n}\n\nvoid main() {\n geometry.pickingColor = instancePickingColors;\n\n vColor = vec4(instanceColors.rgb, instanceColors.a * opacity);\n\n float isEnd = positions.x;\n\n vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd);\n vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd);\n\n vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);\n vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd);\n\n vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd);\n vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd);\n\n geometry.worldPosition = currPosition;\n vec2 widthPixels = vec2(clamp(\n project_size_to_pixel(instanceStrokeWidths * widthScale, widthUnits),\n widthMinPixels, widthMaxPixels) / 2.0);\n vec3 width;\n\n if (billboard) {\n vec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET);\n vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position);\n vec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET);\n\n clipLine(prevPositionScreen, currPositionScreen);\n clipLine(nextPositionScreen, currPositionScreen);\n clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd));\n\n width = vec3(widthPixels, 0.0);\n DECKGL_FILTER_SIZE(width, geometry);\n\n vec3 offset = getLineJoinOffset(\n prevPositionScreen.xyz / prevPositionScreen.w,\n currPositionScreen.xyz / currPositionScreen.w,\n nextPositionScreen.xyz / nextPositionScreen.w,\n project_pixel_size_to_clipspace(width.xy)\n );\n\n DECKGL_FILTER_GL_POSITION(currPositionScreen, geometry);\n gl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w);\n } else {\n prevPosition = project_position(prevPosition, prevPosition64Low);\n currPosition = project_position(currPosition, currPosition64Low);\n nextPosition = project_position(nextPosition, nextPosition64Low);\n\n width = vec3(project_pixel_size(widthPixels), 0.0);\n DECKGL_FILTER_SIZE(width, geometry);\n\n vec3 offset = getLineJoinOffset(prevPosition, currPosition, nextPosition, width.xy);\n geometry.position = vec4(currPosition + offset, 1.0);\n gl_Position = project_common_position_to_clipspace(geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;var Pq=`#define SHADER_NAME path-layer-fragment-shader\n\nprecision highp float;\n\nuniform float miterLimit;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vPathPosition;\nvarying float vPathLength;\nvarying float vJointType;\n\nvoid main(void) {\n geometry.uv = vPathPosition;\n\n if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) {\n if (vJointType > 0.5 && length(vCornerOffset) > 1.0) {\n discard;\n }\n if (vJointType < 0.5 && vMiterLength > miterLimit + 1.0) {\n discard;\n }\n }\n gl_FragColor = vColor;\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var Iq=[0,0,0,255],_pt={widthUnits:\"meters\",widthScale:{type:\"number\",min:0,value:1},widthMinPixels:{type:\"number\",min:0,value:0},widthMaxPixels:{type:\"number\",min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:\"number\",min:0,value:4},billboard:!1,_pathType:null,getPath:{type:\"accessor\",value:e=>e.path},getColor:{type:\"accessor\",value:Iq},getWidth:{type:\"accessor\",value:1},rounded:{deprecatedFor:[\"jointRounded\",\"capRounded\"]}},aB={enter:(e,t)=>t.length?t.subarray(t.length-e.length):e},bc=class extends dn{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(){return super.getShaders({vs:Eq,fs:Pq,modules:[Rs,Ao]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({positions:{size:3,vertexOffset:1,type:5130,fp64:this.use64bitPositions(),transition:aB,accessor:\"getPath\",update:this.calculatePositions,noAlloc:!0,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}},instanceTypes:{size:1,type:5121,update:this.calculateSegmentTypes,noAlloc:!0},instanceStrokeWidths:{size:1,accessor:\"getWidth\",transition:aB,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,accessor:\"getColor\",transition:aB,defaultValue:Iq},instancePickingColors:{size:3,type:5121,accessor:(i,{index:s,target:n})=>this.encodePickingColor(i&&i.__source?i.__source.index:s,n)}}),this.setState({pathTesselator:new $2({fp64:this.use64bitPositions()})})}updateState(t){super.updateState(t);let{props:r,changeFlags:i}=t,s=this.getAttributeManager();if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPath)){let{pathTesselator:c}=this.state,f=r.data.attributes||{};c.updateGeometry({data:r.data,geometryBuffer:f.getPath,buffers:f,normalize:!r._pathType,loop:r._pathType===\"loop\",getGeometry:r.getPath,positionFormat:r.positionFormat,wrapLongitude:r.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:i.dataChanged}),this.setState({numInstances:c.instanceCount,startIndices:c.vertexStarts}),i.dataChanged||s.invalidateAll()}if(i.extensionsChanged){var o;let{gl:c}=this.context;(o=this.state.model)===null||o===void 0||o.delete(),this.state.model=this._getModel(c),s.invalidateAll()}}getPickingInfo(t){let r=super.getPickingInfo(t),{index:i}=r,{data:s}=this.props;return s[0]&&s[0].__source&&(r.object=s.find(n=>n.__source.index===i)),r}disablePickingIndex(t){let{data:r}=this.props;if(r[0]&&r[0].__source)for(let i=0;i=1&&e[0].length>=2&&Number.isFinite(e[0][0])}function Fpt(e){let t=e[0],r=e[e.length-1];return t[0]===r[0]&&t[1]===r[1]&&t[2]===r[2]}function zpt(e,t,r,i){for(let s=0;sc/t));let n=tx(e),o=i&&t===3;if(r){let c=n.length;n=n.slice();let f=[];for(let _=0;_f&&c>_||(f>_?(r||(n=n.slice()),zq(n,0,2,1)):(r||(n=n.slice()),zq(n,2,0,1)))}return(0,Nq.default)(n,s,t)}var eS=class extends rm{constructor(t){let{fp64:r,IndexType:i=Uint32Array}=t;super({...t,attributes:{positions:{size:3,type:r?Float64Array:Float32Array},vertexValid:{type:Uint8ClampedArray,size:1},indices:{type:i,size:1}}})}get(t){let{attributes:r}=this;return t===\"indices\"?r.indices&&r.indices.subarray(0,this.vertexCount):r[t]}updateGeometry(t){super.updateGeometry(t);let r=this.buffers.indices;if(r)this.vertexCount=(r.value||r).length;else if(this.data&&!this.getGeometry)throw new Error(\"missing indices buffer\")}normalizeGeometry(t){if(this.normalize){let r=G3(t,this.positionSize);return this.opts.resolution?Y2(tx(r),tS(r),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0}):this.opts.wrapLongitude?sB(tx(r),tS(r),{size:this.positionSize,maxLatitude:86,edgeTypes:!0}):r}return t}getGeometrySize(t){if(jq(t)){let r=0;for(let i of t)r+=this.getGeometrySize(i);return r}return tx(t).length/this.positionSize}getGeometryFromBuffer(t){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(t):null}updateGeometryAttributes(t,r){if(t&&jq(t))for(let i of t){let s=this.getGeometrySize(i);r.geometrySize=s,this.updateGeometryAttributes(i,r),r.vertexStart+=s,r.indexStart=this.indexStarts[r.geometryIndex+1]}else this._updateIndices(t,r),this._updatePositions(t,r),this._updateVertexValid(t,r)}_updateIndices(t,{geometryIndex:r,vertexStart:i,indexStart:s}){let{attributes:n,indexStarts:o,typedArrayManager:c}=this,f=n.indices;if(!f||!t)return;let _=s,w=Uq(t,this.positionSize,this.opts.preproject,this.opts.full3d);f=c.allocate(f,s+w.length,{copy:!0});for(let I=0;I2?o[f*n+2]:0;s[c*3]=_,s[c*3+1]=w,s[c*3+2]=I}}_updateVertexValid(t,{vertexStart:r,geometrySize:i}){let{positionSize:s}=this,n=this.attributes.vertexValid,o=t&&tS(t);if(t&&t.edgeTypes?n.set(t.edgeTypes,r):n.fill(1,r,r+i),o)for(let c=0;c0&&!Number.isFinite(e[0])}var W3=`\nattribute vec2 vertexPositions;\nattribute float vertexValid;\n\nuniform bool extruded;\nuniform bool isWireframe;\nuniform float elevationScale;\nuniform float opacity;\n\nvarying vec4 vColor;\n\nstruct PolygonProps {\n vec4 fillColors;\n vec4 lineColors;\n vec3 positions;\n vec3 nextPositions;\n vec3 pickingColors;\n vec3 positions64Low;\n vec3 nextPositions64Low;\n float elevations;\n};\n\nvec3 project_offset_normal(vec3 vector) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {\n return normalize(vector * project_uCommonUnitsPerWorldUnit);\n }\n return project_normal(vector);\n}\n\nvoid calculatePosition(PolygonProps props) {\n#ifdef IS_SIDE_VERTEX\n if(vertexValid < 0.5){\n gl_Position = vec4(0.);\n return;\n }\n#endif\n\n vec3 pos;\n vec3 pos64Low;\n vec3 normal;\n vec4 colors = isWireframe ? props.lineColors : props.fillColors;\n\n geometry.worldPosition = props.positions;\n geometry.worldPositionAlt = props.nextPositions;\n geometry.pickingColor = props.pickingColors;\n\n#ifdef IS_SIDE_VERTEX\n pos = mix(props.positions, props.nextPositions, vertexPositions.x);\n pos64Low = mix(props.positions64Low, props.nextPositions64Low, vertexPositions.x);\n#else\n pos = props.positions;\n pos64Low = props.positions64Low;\n#endif\n\n if (extruded) {\n pos.z += props.elevations * vertexPositions.y * elevationScale;\n }\n gl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position);\n\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n if (extruded) {\n #ifdef IS_SIDE_VERTEX\n normal = vec3(\n props.positions.y - props.nextPositions.y + (props.positions64Low.y - props.nextPositions64Low.y),\n props.nextPositions.x - props.positions.x + (props.nextPositions64Low.x - props.positions64Low.x),\n 0.0);\n normal = project_offset_normal(normal);\n #else\n normal = project_normal(vec3(0.0, 0.0, 1.0));\n #endif\n geometry.normal = normal;\n vec3 lightColor = lighting_getLightColor(colors.rgb, project_uCameraPosition, geometry.position.xyz, normal);\n vColor = vec4(lightColor, colors.a * opacity);\n } else {\n vColor = vec4(colors.rgb, colors.a * opacity);\n }\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;var Gq=`#define SHADER_NAME solid-polygon-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 positions64Low;\nattribute float elevations;\nattribute vec4 fillColors;\nattribute vec4 lineColors;\nattribute vec3 pickingColors;\n\n`.concat(W3,`\n\nvoid main(void) {\n PolygonProps props;\n\n props.positions = positions;\n props.positions64Low = positions64Low;\n props.elevations = elevations;\n props.fillColors = fillColors;\n props.lineColors = lineColors;\n props.pickingColors = pickingColors;\n\n calculatePosition(props);\n}\n`);var Wq=`#define SHADER_NAME solid-polygon-layer-vertex-shader-side\n#define IS_SIDE_VERTEX\n\n\nattribute vec3 instancePositions;\nattribute vec3 nextPositions;\nattribute vec3 instancePositions64Low;\nattribute vec3 nextPositions64Low;\nattribute float instanceElevations;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\n`.concat(W3,`\n\nvoid main(void) {\n PolygonProps props;\n\n #if RING_WINDING_ORDER_CW == 1\n props.positions = instancePositions;\n props.positions64Low = instancePositions64Low;\n props.nextPositions = nextPositions;\n props.nextPositions64Low = nextPositions64Low;\n #else\n props.positions = nextPositions;\n props.positions64Low = nextPositions64Low;\n props.nextPositions = instancePositions;\n props.nextPositions64Low = instancePositions64Low;\n #endif\n props.elevations = instanceElevations;\n props.fillColors = instanceFillColors;\n props.lineColors = instanceLineColors;\n props.pickingColors = instancePickingColors;\n\n calculatePosition(props);\n}\n`);var Hq=`#define SHADER_NAME solid-polygon-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n gl_FragColor = vColor;\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var q3=[0,0,0,255],Npt={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:\"CW\",_full3d:!1,elevationScale:{type:\"number\",min:0,value:1},getPolygon:{type:\"accessor\",value:e=>e.polygon},getElevation:{type:\"accessor\",value:1e3},getFillColor:{type:\"accessor\",value:q3},getLineColor:{type:\"accessor\",value:q3},material:!0},H3={enter:(e,t)=>t.length?t.subarray(t.length-e.length):e},wc=class extends dn{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(t){return super.getShaders({vs:t===\"top\"?Gq:Wq,fs:Hq,defines:{RING_WINDING_ORDER_CW:!this.props._normalize&&this.props._windingOrder===\"CCW\"?0:1},modules:[Rs,Zf,Ao]})}get wrapLongitude(){return!1}initializeState(){let{gl:t,viewport:r}=this.context,{coordinateSystem:i}=this.props,{_full3d:s}=this.props;r.isGeospatial&&i===Yr.DEFAULT&&(i=Yr.LNGLAT);let n;i===Yr.LNGLAT&&(s?n=r.projectPosition.bind(r):n=r.projectFlat.bind(r)),this.setState({numInstances:0,polygonTesselator:new eS({preproject:n,fp64:this.use64bitPositions(),IndexType:!t||Oh(t,Ii.ELEMENT_INDEX_UINT32)?Uint32Array:Uint16Array})});let o=this.getAttributeManager(),c=!0;o.remove([\"instancePickingColors\"]),o.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:c},positions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:H3,accessor:\"getPolygon\",update:this.calculatePositions,noAlloc:c,shaderAttributes:{positions:{vertexOffset:0,divisor:0},instancePositions:{vertexOffset:0,divisor:1},nextPositions:{vertexOffset:1,divisor:1}}},vertexValid:{size:1,divisor:1,type:5121,update:this.calculateVertexValid,noAlloc:c},elevations:{size:1,transition:H3,accessor:\"getElevation\",shaderAttributes:{elevations:{divisor:0},instanceElevations:{divisor:1}}},fillColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:H3,accessor:\"getFillColor\",defaultValue:q3,shaderAttributes:{fillColors:{divisor:0},instanceFillColors:{divisor:1}}},lineColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:H3,accessor:\"getLineColor\",defaultValue:q3,shaderAttributes:{lineColors:{divisor:0},instanceLineColors:{divisor:1}}},pickingColors:{size:3,type:5121,accessor:(f,{index:_,target:w})=>this.encodePickingColor(f&&f.__source?f.__source.index:_,w),shaderAttributes:{pickingColors:{divisor:0},instancePickingColors:{divisor:1}}}})}getPickingInfo(t){let r=super.getPickingInfo(t),{index:i}=r,{data:s}=this.props;return s[0]&&s[0].__source&&(r.object=s.find(n=>n.__source.index===i)),r}disablePickingIndex(t){let{data:r}=this.props;if(r[0]&&r[0].__source)for(let i=0;if.delete()),this.setState(this._getModels(this.context.gl)),n.invalidateAll()}}updateGeometry({props:t,oldProps:r,changeFlags:i}){if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPolygon)){let{polygonTesselator:n}=this.state,o=t.data.attributes||{};n.updateGeometry({data:t.data,normalize:t._normalize,geometryBuffer:o.getPolygon,buffers:o,getGeometry:t.getPolygon,positionFormat:t.positionFormat,wrapLongitude:t.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:i.dataChanged,full3d:t._full3d}),this.setState({numInstances:n.instanceCount,startIndices:n.vertexStarts}),i.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(t){let{id:r,filled:i,extruded:s}=this.props,n,o;if(i){let c=this.getShaders(\"top\");c.defines.NON_INSTANCED_MODEL=1,n=new fn(t,{...c,id:\"\".concat(r,\"-top\"),drawMode:4,attributes:{vertexPositions:new Float32Array([0,1])},uniforms:{isWireframe:!1,isSideVertex:!1},vertexCount:0,isIndexed:!0})}return s&&(o=new fn(t,{...this.getShaders(\"side\"),id:\"\".concat(r,\"-side\"),geometry:new $n({drawMode:1,vertexCount:4,attributes:{vertexPositions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),instanceCount:0,isInstanced:1}),o.userData.excludeAttributes={indices:!0}),{models:[o,n].filter(Boolean),topModel:n,sideModel:o}}calculateIndices(t){let{polygonTesselator:r}=this.state;t.startIndices=r.indexStarts,t.value=r.get(\"indices\")}calculatePositions(t){let{polygonTesselator:r}=this.state;t.startIndices=r.vertexStarts,t.value=r.get(\"positions\")}calculateVertexValid(t){t.value=this.state.polygonTesselator.get(\"vertexValid\")}};G(wc,\"defaultProps\",Npt);G(wc,\"layerName\",\"SolidPolygonLayer\");function Z3({data:e,getIndex:t,dataRange:r,replace:i}){let{startRow:s=0,endRow:n=1/0}=r,o=e.length,c=o,f=o;for(let R=0;RR&&N>=s&&(c=R),N>=n){f=R;break}}let _=c,I=f-c!==i.length?e.slice(f):void 0;for(let R=0;Re.polygon},getFillColor:{type:\"accessor\",value:Upt},getLineColor:{type:\"accessor\",value:qq},getLineWidth:{type:\"accessor\",value:1},getElevation:{type:\"accessor\",value:1e3},material:!0},lf=class extends Ni{initializeState(){this.state={paths:[]},this.props.getLineDashArray&&or.removed(\"getLineDashArray\",\"PathStyleExtension\")()}updateState({changeFlags:t}){let r=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getPolygon);if(r&&Array.isArray(t.dataChanged)){let i=this.state.paths.slice(),s=t.dataChanged.map(n=>Z3({data:i,getIndex:o=>o.__source.index,dataRange:n,replace:this._getPaths(n)}));this.setState({paths:i,pathsDiff:s})}else r&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(t={}){let{data:r,getPolygon:i,positionFormat:s,_normalize:n}=this.props,o=[],c=s===\"XY\"?2:3,{startRow:f,endRow:_}=t,{iterable:w,objectInfo:I}=Jc(r,f,_);for(let R of w){I.index++;let N=i(R,I);n&&(N=G3(N,c));let{holeIndices:j}=N,Q=N.positions||N;if(j)for(let et=0;et<=j.length;et++){let Y=Q.slice(j[et-1]||0,j[et]||Q.length);o.push(this.getSubLayerRow({path:Y},R,I.index))}else o.push(this.getSubLayerRow({path:Q},R,I.index))}return o}renderLayers(){let{data:t,_dataDiff:r,stroked:i,filled:s,extruded:n,wireframe:o,_normalize:c,_windingOrder:f,elevationScale:_,transitions:w,positionFormat:I}=this.props,{lineWidthUnits:R,lineWidthScale:N,lineWidthMinPixels:j,lineWidthMaxPixels:Q,lineJointRounded:et,lineMiterLimit:Y,lineDashJustified:K}=this.props,{getFillColor:J,getLineColor:ut,getLineWidth:Et,getLineDashArray:kt,getElevation:Xt,getPolygon:qt,updateTriggers:le,material:ue}=this.props,{paths:De,pathsDiff:Ke}=this.state,rr=this.getSubLayerClass(\"fill\",wc),Sr=this.getSubLayerClass(\"stroke\",bc),Li=this.shouldRenderSubLayer(\"fill\",De)&&new rr({_dataDiff:r,extruded:n,elevationScale:_,filled:s,wireframe:o,_normalize:c,_windingOrder:f,getElevation:Xt,getFillColor:J,getLineColor:n&&o?ut:qq,material:ue,transitions:w},this.getSubLayerProps({id:\"fill\",updateTriggers:le&&{getPolygon:le.getPolygon,getElevation:le.getElevation,getFillColor:le.getFillColor,lineColors:n&&o,getLineColor:le.getLineColor}}),{data:t,positionFormat:I,getPolygon:qt}),oo=!n&&i&&this.shouldRenderSubLayer(\"stroke\",De)&&new Sr({_dataDiff:Ke&&(()=>Ke),widthUnits:R,widthScale:N,widthMinPixels:j,widthMaxPixels:Q,jointRounded:et,miterLimit:Y,dashJustified:K,_pathType:\"loop\",transitions:w&&{getWidth:w.getLineWidth,getColor:w.getLineColor,getPath:w.getPolygon},getColor:this.getSubLayerAccessor(ut),getWidth:this.getSubLayerAccessor(Et),getDashArray:this.getSubLayerAccessor(kt)},this.getSubLayerProps({id:\"stroke\",updateTriggers:le&&{getWidth:le.getLineWidth,getColor:le.getLineColor,getDashArray:le.getLineDashArray}}),{data:De,positionFormat:I,getPath:zl=>zl.path});return[!n&&Li,oo,n&&Li]}};G(lf,\"layerName\",\"PolygonLayer\");G(lf,\"defaultProps\",Vpt);function Zq(e,t){if(!e)return null;let r=\"startIndices\"in e?e.startIndices[t]:t,i=e.featureIds.value[r];return r!==-1?jpt(e,i,r):null}function jpt(e,t,r){let i={properties:{...e.properties[t]}};for(let s in e.numericProps)i.properties[s]=e.numericProps[s].value[r];return i}function Yq(e,t){let r={points:null,lines:null,polygons:null};for(let i in r){let s=e[i].globalFeatureIds.value;r[i]=new Uint8ClampedArray(s.length*3);let n=[];for(let o=0;o 0.0) {\n float inFill = alpha;\n float inBorder = smoothstep(outlineBuffer - gamma, outlineBuffer + gamma, distance);\n color = mix(outlineColor, vColor, inFill);\n alpha = inBorder;\n }\n }\n float a = alpha * color.a;\n \n if (a < alphaCutoff) {\n discard;\n }\n\n gl_FragColor = vec4(color.rgb, a * opacity);\n }\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var dB=192/256,$q=[],Gpt={getIconOffsets:{type:\"accessor\",value:e=>e.offsets},alphaCutoff:.001,smoothing:.1,outlineWidth:0,outlineColor:{type:\"color\",value:[0,0,0,255]}},Gg=class extends Ep{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(){return{...super.getShaders(),fs:Qq}}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({instanceOffsets:{size:2,accessor:\"getIconOffsets\"},instancePickingColors:{type:5121,size:3,accessor:(r,{index:i,target:s})=>this.encodePickingColor(i,s)}})}updateState(t){super.updateState(t);let{props:r,oldProps:i}=t,{outlineColor:s}=r;s!==i.outlineColor&&(s=s.map(n=>n/255),s[3]=Number.isFinite(s[3])?s[3]:1,this.setState({outlineColor:s})),!r.sdf&&r.outlineWidth&&or.warn(\"\".concat(this.id,\": fontSettings.sdf is required to render outline\"))()}draw(t){let{sdf:r,smoothing:i,outlineWidth:s}=this.props,{outlineColor:n}=this.state,o=s?Math.max(i,dB*(1-s)):-1;if(t.uniforms={...t.uniforms,sdfBuffer:dB,outlineBuffer:o,gamma:i,sdf:!!r,outlineColor:n},super.draw(t),r&&s){let{iconManager:c}=this.state;c.getTexture()&&this.state.model.draw({uniforms:{outlineBuffer:dB}})}}getInstanceOffset(t){return t?Array.from(t).flatMap(r=>super.getInstanceOffset(r)):$q}getInstanceColorMode(t){return 1}getInstanceIconFrame(t){return t?Array.from(t).flatMap(r=>super.getInstanceIconFrame(r)):$q}};G(Gg,\"defaultProps\",Gpt);G(Gg,\"layerName\",\"MultiIconLayer\");var rS=class{constructor({fontSize:t=24,buffer:r=3,radius:i=8,cutoff:s=.25,fontFamily:n=\"sans-serif\",fontWeight:o=\"normal\",fontStyle:c=\"normal\"}={}){this.buffer=r,this.cutoff=s,this.radius=i;let f=this.size=t+r*4,_=this._createCanvas(f),w=this.ctx=_.getContext(\"2d\",{willReadFrequently:!0});w.font=`${c} ${o} ${t}px ${n}`,w.textBaseline=\"alphabetic\",w.textAlign=\"left\",w.fillStyle=\"black\",this.gridOuter=new Float64Array(f*f),this.gridInner=new Float64Array(f*f),this.f=new Float64Array(f),this.z=new Float64Array(f+1),this.v=new Uint16Array(f)}_createCanvas(t){let r=document.createElement(\"canvas\");return r.width=r.height=t,r}draw(t){let{width:r,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(t),c=Math.ceil(i),f=0,_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),w=Math.min(this.size-this.buffer,c+Math.ceil(s)),I=_+2*this.buffer,R=w+2*this.buffer,N=Math.max(I*R,0),j=new Uint8ClampedArray(N),Q={data:j,width:I,height:R,glyphWidth:_,glyphHeight:w,glyphTop:c,glyphLeft:f,glyphAdvance:r};if(_===0||w===0)return Q;let{ctx:et,buffer:Y,gridInner:K,gridOuter:J}=this;et.clearRect(Y,Y,_,w),et.fillText(t,Y,Y+c);let ut=et.getImageData(Y,Y,_,w);J.fill(1e20,0,N),K.fill(0,0,N);for(let Et=0;Et0?le*le:0,K[qt]=le<0?le*le:0}}Xq(J,0,0,I,R,I,this.f,this.v,this.z),Xq(K,Y,Y,_,w,I,this.f,this.v,this.z);for(let Et=0;Et-1);f++,n[f]=c,o[f]=_,o[f+1]=1e20}for(let c=0,f=0;cs&&(_=0,f++),n[I]={x:_+i,y:c+f*w+i,width:R,height:w,layoutWidth:R,layoutHeight:r},_+=R+i*2}return{mapping:n,xOffset:_,yOffset:c+f*w,canvasHeight:qpt(c+(f+1)*w)}}function tZ(e,t,r,i){let s=0;for(let o=t;oi&&(oc){let I=tZ(e,c,f,s);_+I>i&&(oi&&(I=eZ(e,c,f,i,s,n),o=n[n.length-1])),c=f,_+=I}return _}function Ypt(e,t,r,i,s=0,n){n===void 0&&(n=e.length);let o=[];return t===\"break-all\"?eZ(e,s,n,r,i,o):Zpt(e,s,n,r,i,o),o}function Qpt(e,t,r,i,s,n){let o=0,c=0;for(let f=t;f0,I=[0,0],R=[0,0],N=0,j=0,Q=0;for(let Y=0;Y<=o;Y++){let K=n[Y];if((K===`\n`||Y===o)&&(Q=Y),Q>j){let J=w?Ypt(n,r,i,s,j,Q):Hpt;for(let ut=0;ut<=J.length;ut++){let Et=ut===0?j:J[ut-1],kt=ut1||f>0){let N=e.constructor;R=new N(_);for(let j=0;j<_;j++)R[j]=e[j*c+f]}for(let N=0;N=0&&this._order.splice(r,1)}_appendOrder(t){this._order.push(t)}};function $pt(){let e=[];for(let t=32;t<128;t++)e.push(String.fromCharCode(t));return e}var Wg={fontFamily:\"Monaco, monospace\",fontWeight:\"normal\",characterSet:$pt(),fontSize:64,buffer:4,sdf:!1,cutoff:.25,radius:12,smoothing:.1},nZ=1024,sZ=.9,oZ=1.2,lZ=3,Y3=new ex(lZ);function Xpt(e,t){let r;typeof t==\"string\"?r=new Set(Array.from(t)):r=new Set(t);let i=Y3.get(e);if(!i)return r;for(let s in i.mapping)r.has(s)&&r.delete(s);return r}function Kpt(e,t){for(let r=0;r=lZ,\"Invalid cache limit\"),Y3=new ex(e)}var iS=class{constructor(){G(this,\"props\",{...Wg}),G(this,\"_key\",void 0),G(this,\"_atlas\",void 0)}get texture(){return this._atlas}get mapping(){return this._atlas&&this._atlas.mapping}get scale(){let{fontSize:t,buffer:r}=this.props;return(t*oZ+r*2)/t}setProps(t={}){Object.assign(this.props,t),this._key=this._getKey();let r=Xpt(this._key,this.props.characterSet),i=Y3.get(this._key);if(i&&r.size===0){this._atlas!==i&&(this._atlas=i);return}let s=this._generateFontAtlas(r,i);this._atlas=s,Y3.set(this._key,s)}_generateFontAtlas(t,r){let{fontFamily:i,fontWeight:s,fontSize:n,buffer:o,sdf:c,radius:f,cutoff:_}=this.props,w=r&&r.data;w||(w=document.createElement(\"canvas\"),w.width=nZ);let I=w.getContext(\"2d\",{willReadFrequently:!0});aZ(I,i,n,s);let{mapping:R,canvasHeight:N,xOffset:j,yOffset:Q}=Jq({getFontWidth:et=>I.measureText(et).width,fontHeight:n*oZ,buffer:o,characterSet:t,maxCanvasWidth:nZ,...r&&{mapping:r.mapping,xOffset:r.xOffset,yOffset:r.yOffset}});if(w.height!==N){let et=I.getImageData(0,0,w.width,w.height);w.height=N,I.putImageData(et,0,0)}if(aZ(I,i,n,s),c){let et=new rS({fontSize:n,buffer:o,radius:f,cutoff:_,fontFamily:i,fontWeight:\"\".concat(s)});for(let Y of t){let{data:K,width:J,height:ut,glyphTop:Et}=et.draw(Y);R[Y].width=J,R[Y].layoutOffsetY=n*sZ-Et;let kt=I.createImageData(J,ut);Kpt(K,kt),I.putImageData(kt,R[Y].x,R[Y].y)}}else for(let et of t)I.fillText(et,R[et].x,R[et].y+o+n*sZ);return{xOffset:j,yOffset:Q,mapping:R,data:w,width:w.width,height:w.height}}_getKey(){let{fontFamily:t,fontWeight:r,fontSize:i,buffer:s,sdf:n,radius:o,cutoff:c}=this.props;return n?\"\".concat(t,\" \").concat(r,\" \").concat(i,\" \").concat(s,\" \").concat(o,\" \").concat(c):\"\".concat(t,\" \").concat(r,\" \").concat(i,\" \").concat(s)}};var uZ=`#define SHADER_NAME text-background-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute vec4 instanceRects;\nattribute float instanceSizes;\nattribute float instanceAngles;\nattribute vec2 instancePixelOffsets;\nattribute float instanceLineWidths;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\nuniform bool billboard;\nuniform float opacity;\nuniform float sizeScale;\nuniform float sizeMinPixels;\nuniform float sizeMaxPixels;\nuniform vec4 padding;\nuniform int sizeUnits;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying float vLineWidth;\nvarying vec2 uv;\nvarying vec2 dimensions;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n float angle_radian = radians(angle);\n float cos_angle = cos(angle_radian);\n float sin_angle = sin(angle_radian);\n mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n geometry.uv = positions;\n geometry.pickingColor = instancePickingColors;\n uv = positions;\n vLineWidth = instanceLineWidths;\n float sizePixels = clamp(\n project_size_to_pixel(instanceSizes * sizeScale, sizeUnits),\n sizeMinPixels, sizeMaxPixels\n );\n\n dimensions = instanceRects.zw * sizePixels + padding.xy + padding.zw;\n\n vec2 pixelOffset = (positions * instanceRects.zw + instanceRects.xy) * sizePixels + mix(-padding.xy, padding.zw, positions);\n pixelOffset = rotate_by_angle(pixelOffset, instanceAngles);\n pixelOffset += instancePixelOffsets;\n pixelOffset.y *= -1.0;\n\n if (billboard) {\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vec3 offset = vec3(pixelOffset, 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n } else {\n vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);\n DECKGL_FILTER_SIZE(offset_common, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);\n DECKGL_FILTER_COLOR(vFillColor, geometry);\n vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);\n DECKGL_FILTER_COLOR(vLineColor, geometry);\n}\n`;var hZ=`#define SHADER_NAME text-background-layer-fragment-shader\n\nprecision highp float;\n\nuniform bool stroked;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying float vLineWidth;\nvarying vec2 uv;\nvarying vec2 dimensions;\n\nvoid main(void) {\n geometry.uv = uv;\n\n vec2 pixelPosition = uv * dimensions;\n if (stroked) {\n float distToEdge = min(\n min(pixelPosition.x, dimensions.x - pixelPosition.x),\n min(pixelPosition.y, dimensions.y - pixelPosition.y)\n );\n float isBorder = smoothedge(distToEdge, vLineWidth);\n gl_FragColor = mix(vFillColor, vLineColor, isBorder);\n } else {\n gl_FragColor = vFillColor;\n }\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var Jpt={billboard:!0,sizeScale:1,sizeUnits:\"pixels\",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,padding:{type:\"array\",value:[0,0,0,0]},getPosition:{type:\"accessor\",value:e=>e.position},getSize:{type:\"accessor\",value:1},getAngle:{type:\"accessor\",value:0},getPixelOffset:{type:\"accessor\",value:[0,0]},getBoundingRect:{type:\"accessor\",value:[0,0,0,0]},getFillColor:{type:\"accessor\",value:[0,0,0,255]},getLineColor:{type:\"accessor\",value:[0,0,0,255]},getLineWidth:{type:\"accessor\",value:1}},Hg=class extends dn{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(){return super.getShaders({vs:uZ,fs:hZ,modules:[Rs,Ao]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getPosition\"},instanceSizes:{size:1,transition:!0,accessor:\"getSize\",defaultValue:1},instanceAngles:{size:1,transition:!0,accessor:\"getAngle\"},instanceRects:{size:4,accessor:\"getBoundingRect\"},instancePixelOffsets:{size:2,transition:!0,accessor:\"getPixelOffset\"},instanceFillColors:{size:4,transition:!0,normalized:!0,type:5121,accessor:\"getFillColor\",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,normalized:!0,type:5121,accessor:\"getLineColor\",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:\"getLineWidth\",defaultValue:1}})}updateState(t){super.updateState(t);let{changeFlags:r}=t;if(r.extensionsChanged){var i;let{gl:s}=this.context;(i=this.state.model)===null||i===void 0||i.delete(),this.state.model=this._getModel(s),this.getAttributeManager().invalidateAll()}}draw({uniforms:t}){let{billboard:r,sizeScale:i,sizeUnits:s,sizeMinPixels:n,sizeMaxPixels:o,getLineWidth:c}=this.props,{padding:f}=this.props;f.length<4&&(f=[f[0],f[1],f[0],f[1]]),this.state.model.setUniforms(t).setUniforms({billboard:r,stroked:!!c,padding:f,sizeUnits:po[s],sizeScale:i,sizeMinPixels:n,sizeMaxPixels:o}).draw()}_getModel(t){let r=[0,0,1,0,1,1,0,1];return new fn(t,{...this.getShaders(),id:this.props.id,geometry:new $n({drawMode:6,vertexCount:4,attributes:{positions:{size:2,value:new Float32Array(r)}}}),isInstanced:!0})}};G(Hg,\"defaultProps\",Jpt);G(Hg,\"layerName\",\"TextBackgroundLayer\");var fZ={start:1,middle:0,end:-1},dZ={top:1,center:0,bottom:-1},pB=[0,0,0,255],tAt=1,eAt={billboard:!0,sizeScale:1,sizeUnits:\"pixels\",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:\"accessor\",value:[255,255,255,255]},getBorderColor:{type:\"accessor\",value:pB},getBorderWidth:{type:\"accessor\",value:0},backgroundPadding:{type:\"array\",value:[0,0,0,0]},characterSet:{type:\"object\",value:Wg.characterSet},fontFamily:Wg.fontFamily,fontWeight:Wg.fontWeight,lineHeight:tAt,outlineWidth:{type:\"number\",value:0,min:0},outlineColor:{type:\"color\",value:pB},fontSettings:{type:\"object\",value:{},compare:1},wordBreak:\"break-word\",maxWidth:{type:\"number\",value:-1},getText:{type:\"accessor\",value:e=>e.text},getPosition:{type:\"accessor\",value:e=>e.position},getColor:{type:\"accessor\",value:pB},getSize:{type:\"accessor\",value:32},getAngle:{type:\"accessor\",value:0},getTextAnchor:{type:\"accessor\",value:\"middle\"},getAlignmentBaseline:{type:\"accessor\",value:\"center\"},getPixelOffset:{type:\"accessor\",value:[0,0]},backgroundColor:{deprecatedFor:[\"background\",\"getBackgroundColor\"]}},cf=class extends Ni{constructor(...t){super(...t),G(this,\"state\",void 0),G(this,\"getBoundingRect\",(r,i)=>{let{size:[s,n]}=this.transformParagraph(r,i),{fontSize:o}=this.state.fontAtlasManager.props;s/=o,n/=o;let{getTextAnchor:c,getAlignmentBaseline:f}=this.props,_=fZ[typeof c==\"function\"?c(r,i):c],w=dZ[typeof f==\"function\"?f(r,i):f];return[(_-1)*s/2,(w-1)*n/2,s,n]}),G(this,\"getIconOffsets\",(r,i)=>{let{getTextAnchor:s,getAlignmentBaseline:n}=this.props,{x:o,y:c,rowWidth:f,size:[_,w]}=this.transformParagraph(r,i),I=fZ[typeof s==\"function\"?s(r,i):s],R=dZ[typeof n==\"function\"?n(r,i):n],N=o.length,j=new Array(N*2),Q=0;for(let et=0;et0&&or.warn(\"v8.9 breaking change: TextLayer maxWidth is now relative to text size\")()}updateState(t){let{props:r,oldProps:i,changeFlags:s}=t;(s.dataChanged||s.updateTriggersChanged&&(s.updateTriggersChanged.all||s.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||r.lineHeight!==i.lineHeight||r.wordBreak!==i.wordBreak||r.maxWidth!==i.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo({info:t}){return t.object=t.index>=0?this.props.data[t.index]:null,t}_updateFontAtlas(){let{fontSettings:t,fontFamily:r,fontWeight:i}=this.props,{fontAtlasManager:s,characterSet:n}=this.state,o={...t,characterSet:n,fontFamily:r,fontWeight:i};if(!s.mapping)return s.setProps(o),!0;for(let c in o)if(o[c]!==s.props[c])return s.setProps(o),!0;return!1}_updateText(){var t;let{data:r,characterSet:i}=this.props,s=(t=r.attributes)===null||t===void 0?void 0:t.getText,{getText:n}=this.props,o=r.startIndices,c,f=i===\"auto\"&&new Set;if(s&&o){let{texts:_,characterCount:w}=iZ({...ArrayBuffer.isView(s)?{value:s}:s,length:r.length,startIndices:o,characterSet:f});c=w,n=(I,{index:R})=>_[R]}else{let{iterable:_,objectInfo:w}=Jc(r);o=[0],c=0;for(let I of _){w.index++;let R=Array.from(n(I,w)||\"\");f&&R.forEach(f.add,f),c+=R.length,o.push(c)}}this.setState({getText:n,startIndices:o,numInstances:c,characterSet:f||i})}transformParagraph(t,r){let{fontAtlasManager:i}=this.state,s=i.mapping,n=this.state.getText,{wordBreak:o,lineHeight:c,maxWidth:f}=this.props,_=n(t,r)||\"\";return rZ(_,c,o,f*i.props.fontSize,s)}renderLayers(){let{startIndices:t,numInstances:r,getText:i,fontAtlasManager:{scale:s,texture:n,mapping:o},styleVersion:c}=this.state,{data:f,_dataDiff:_,getPosition:w,getColor:I,getSize:R,getAngle:N,getPixelOffset:j,getBackgroundColor:Q,getBorderColor:et,getBorderWidth:Y,backgroundPadding:K,background:J,billboard:ut,fontSettings:Et,outlineWidth:kt,outlineColor:Xt,sizeScale:qt,sizeUnits:le,sizeMinPixels:ue,sizeMaxPixels:De,transitions:Ke,updateTriggers:rr}=this.props,Sr=this.getSubLayerClass(\"characters\",Gg),Li=this.getSubLayerClass(\"background\",Hg);return[J&&new Li({getFillColor:Q,getLineColor:et,getLineWidth:Y,padding:K,getPosition:w,getSize:R,getAngle:N,getPixelOffset:j,billboard:ut,sizeScale:qt,sizeUnits:le,sizeMinPixels:ue,sizeMaxPixels:De,transitions:Ke&&{getPosition:Ke.getPosition,getAngle:Ke.getAngle,getSize:Ke.getSize,getFillColor:Ke.getBackgroundColor,getLineColor:Ke.getBorderColor,getLineWidth:Ke.getBorderWidth,getPixelOffset:Ke.getPixelOffset}},this.getSubLayerProps({id:\"background\",updateTriggers:{getPosition:rr.getPosition,getAngle:rr.getAngle,getSize:rr.getSize,getFillColor:rr.getBackgroundColor,getLineColor:rr.getBorderColor,getLineWidth:rr.getBorderWidth,getPixelOffset:rr.getPixelOffset,getBoundingRect:{getText:rr.getText,getTextAnchor:rr.getTextAnchor,getAlignmentBaseline:rr.getAlignmentBaseline,styleVersion:c}}}),{data:f.attributes&&f.attributes.background?{length:f.length,attributes:f.attributes.background}:f,_dataDiff:_,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new Sr({sdf:Et.sdf,smoothing:Number.isFinite(Et.smoothing)?Et.smoothing:Wg.smoothing,outlineWidth:kt/(Et.radius||Wg.radius),outlineColor:Xt,iconAtlas:n,iconMapping:o,getPosition:w,getColor:I,getSize:R,getAngle:N,getPixelOffset:j,billboard:ut,sizeScale:qt*s,sizeUnits:le,sizeMinPixels:ue*s,sizeMaxPixels:De*s,transitions:Ke&&{getPosition:Ke.getPosition,getAngle:Ke.getAngle,getColor:Ke.getColor,getSize:Ke.getSize,getPixelOffset:Ke.getPixelOffset}},this.getSubLayerProps({id:\"characters\",updateTriggers:{all:rr.getText,getPosition:rr.getPosition,getAngle:rr.getAngle,getColor:rr.getColor,getSize:rr.getSize,getPixelOffset:rr.getPixelOffset,getIconOffsets:{getTextAnchor:rr.getTextAnchor,getAlignmentBaseline:rr.getAlignmentBaseline,styleVersion:c}}}),{data:f,_dataDiff:_,startIndices:t,numInstances:r,getIconOffsets:this.getIconOffsets,getIcon:i})]}static set fontAtlasCacheLimit(t){cZ(t)}};G(cf,\"defaultProps\",eAt);G(cf,\"layerName\",\"TextLayer\");var nS={circle:{type:Ku,props:{filled:\"filled\",stroked:\"stroked\",lineWidthMaxPixels:\"lineWidthMaxPixels\",lineWidthMinPixels:\"lineWidthMinPixels\",lineWidthScale:\"lineWidthScale\",lineWidthUnits:\"lineWidthUnits\",pointRadiusMaxPixels:\"radiusMaxPixels\",pointRadiusMinPixels:\"radiusMinPixels\",pointRadiusScale:\"radiusScale\",pointRadiusUnits:\"radiusUnits\",pointAntialiasing:\"antialiasing\",pointBillboard:\"billboard\",getFillColor:\"getFillColor\",getLineColor:\"getLineColor\",getLineWidth:\"getLineWidth\",getPointRadius:\"getRadius\"}},icon:{type:Ep,props:{iconAtlas:\"iconAtlas\",iconMapping:\"iconMapping\",iconSizeMaxPixels:\"sizeMaxPixels\",iconSizeMinPixels:\"sizeMinPixels\",iconSizeScale:\"sizeScale\",iconSizeUnits:\"sizeUnits\",iconAlphaCutoff:\"alphaCutoff\",iconBillboard:\"billboard\",getIcon:\"getIcon\",getIconAngle:\"getAngle\",getIconColor:\"getColor\",getIconPixelOffset:\"getPixelOffset\",getIconSize:\"getSize\"}},text:{type:cf,props:{textSizeMaxPixels:\"sizeMaxPixels\",textSizeMinPixels:\"sizeMinPixels\",textSizeScale:\"sizeScale\",textSizeUnits:\"sizeUnits\",textBackground:\"background\",textBackgroundPadding:\"backgroundPadding\",textFontFamily:\"fontFamily\",textFontWeight:\"fontWeight\",textLineHeight:\"lineHeight\",textMaxWidth:\"maxWidth\",textOutlineColor:\"outlineColor\",textOutlineWidth:\"outlineWidth\",textWordBreak:\"wordBreak\",textCharacterSet:\"characterSet\",textBillboard:\"billboard\",textFontSettings:\"fontSettings\",getText:\"getText\",getTextAngle:\"getAngle\",getTextColor:\"getColor\",getTextPixelOffset:\"getPixelOffset\",getTextSize:\"getSize\",getTextAnchor:\"getTextAnchor\",getTextAlignmentBaseline:\"getAlignmentBaseline\",getTextBackgroundColor:\"getBackgroundColor\",getTextBorderColor:\"getBorderColor\",getTextBorderWidth:\"getBorderWidth\"}}},sS={type:bc,props:{lineWidthUnits:\"widthUnits\",lineWidthScale:\"widthScale\",lineWidthMinPixels:\"widthMinPixels\",lineWidthMaxPixels:\"widthMaxPixels\",lineJointRounded:\"jointRounded\",lineCapRounded:\"capRounded\",lineMiterLimit:\"miterLimit\",lineBillboard:\"billboard\",getLineColor:\"getColor\",getLineWidth:\"getWidth\"}},Q3={type:wc,props:{extruded:\"extruded\",filled:\"filled\",wireframe:\"wireframe\",elevationScale:\"elevationScale\",material:\"material\",_full3d:\"_full3d\",getElevation:\"getElevation\",getFillColor:\"getFillColor\",getLineColor:\"getLineColor\"}};function rx({type:e,props:t}){let r={};for(let i in t)r[i]=e.defaultProps[t[i]];return r}function $3(e,t){let{transitions:r,updateTriggers:i}=e.props,s={updateTriggers:{},transitions:r&&{getPosition:r.geometry}};for(let n in t){let o=t[n],c=e.props[n];n.startsWith(\"get\")&&(c=e.getSubLayerAccessor(c),s.updateTriggers[o]=i[n],r&&(s.transitions[o]=r[n])),s[o]=c}return s}function AZ(e){if(Array.isArray(e))return e;switch(or.assert(e.type,\"GeoJSON does not have type\"),e.type){case\"Feature\":return[e];case\"FeatureCollection\":return or.assert(Array.isArray(e.features),\"GeoJSON does not have features array\"),e.features;default:return[{geometry:e}]}}function AB(e,t,r={}){let i={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:s=0,endRow:n=e.length}=r;for(let o=s;o{c.push(r({geometry:{type:\"Point\",coordinates:I}},i,s))});break;case\"LineString\":f.push(r({geometry:e},i,s));break;case\"MultiLineString\":o.forEach(I=>{f.push(r({geometry:{type:\"LineString\",coordinates:I}},i,s))});break;case\"Polygon\":_.push(r({geometry:e},i,s)),o.forEach(I=>{w.push(r({geometry:{type:\"LineString\",coordinates:I}},i,s))});break;case\"MultiPolygon\":o.forEach(I=>{_.push(r({geometry:{type:\"Polygon\",coordinates:I}},i,s)),I.forEach(R=>{w.push(r({geometry:{type:\"LineString\",coordinates:R}},i,s))})});break;default:}}var rAt={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function iAt(e,t){let r=rAt[e];for(or.assert(r,\"Unknown GeoJSON type \".concat(e));t&&--r>0;)t=t[0];return t&&Number.isFinite(t[0])}function mZ(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function X3(e){return e.geometry.coordinates}function gZ(e,t){let r=mZ(),{pointFeatures:i,lineFeatures:s,polygonFeatures:n,polygonOutlineFeatures:o}=e;return r.points.data=i,r.points._dataDiff=t.pointFeatures&&(()=>t.pointFeatures),r.points.getPosition=X3,r.lines.data=s,r.lines._dataDiff=t.lineFeatures&&(()=>t.lineFeatures),r.lines.getPath=X3,r.polygons.data=n,r.polygons._dataDiff=t.polygonFeatures&&(()=>t.polygonFeatures),r.polygons.getPolygon=X3,r.polygonsOutline.data=o,r.polygonsOutline._dataDiff=t.polygonOutlineFeatures&&(()=>t.polygonOutlineFeatures),r.polygonsOutline.getPath=X3,r}function _Z(e,t){let r=mZ(),{points:i,lines:s,polygons:n}=e,o=Yq(e,t);return r.points.data={length:i.positions.value.length/i.positions.size,attributes:{...i.attributes,getPosition:i.positions,instancePickingColors:{size:3,value:o.points}},properties:i.properties,numericProps:i.numericProps,featureIds:i.featureIds},r.lines.data={length:s.pathIndices.value.length-1,startIndices:s.pathIndices.value,attributes:{...s.attributes,getPath:s.positions,instancePickingColors:{size:3,value:o.lines}},properties:s.properties,numericProps:s.numericProps,featureIds:s.featureIds},r.lines._pathType=\"open\",r.polygons.data={length:n.polygonIndices.value.length-1,startIndices:n.polygonIndices.value,attributes:{...n.attributes,getPolygon:n.positions,pickingColors:{size:3,value:o.polygons}},properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},r.polygons._normalize=!1,n.triangles&&(r.polygons.data.attributes.indices=n.triangles.value),r.polygonsOutline.data={length:n.primitivePolygonIndices.value.length-1,startIndices:n.primitivePolygonIndices.value,attributes:{...n.attributes,getPath:n.positions,instancePickingColors:{size:3,value:o.polygons}},properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},r.polygonsOutline._pathType=\"open\",r}var nAt=[\"points\",\"linestrings\",\"polygons\"],sAt={...rx(nS.circle),...rx(nS.icon),...rx(nS.text),...rx(sS),...rx(Q3),stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:\"object\",value:null},iconMapping:{type:\"object\",value:{}},getIcon:{type:\"accessor\",value:e=>e.properties.icon},getText:{type:\"accessor\",value:e=>e.properties.text},pointType:\"circle\",getRadius:{deprecatedFor:\"getPointRadius\"}},Mm=class extends Ni{initializeState(){this.state={layerProps:{},features:{}}}updateState({props:t,changeFlags:r}){if(!r.dataChanged)return;let{data:i}=this.props,s=i&&\"points\"in i&&\"polygons\"in i&&\"lines\"in i;this.setState({binary:s}),s?this._updateStateBinary({props:t,changeFlags:r}):this._updateStateJSON({props:t,changeFlags:r})}_updateStateBinary({props:t,changeFlags:r}){let i=_Z(t.data,this.encodePickingColor);this.setState({layerProps:i})}_updateStateJSON({props:t,changeFlags:r}){let i=AZ(t.data),s=this.getSubLayerRow.bind(this),n={},o={};if(Array.isArray(r.dataChanged)){let f=this.state.features;for(let _ in f)n[_]=f[_].slice(),o[_]=[];for(let _ of r.dataChanged){let w=AB(i,s,_);for(let I in f)o[I].push(Z3({data:n[I],getIndex:R=>R.__source.index,dataRange:_,replace:w[I]}))}}else n=AB(i,s);let c=gZ(n,o);this.setState({features:n,featuresDiff:o,layerProps:c})}getPickingInfo(t){let r=super.getPickingInfo(t),{index:i,sourceLayer:s}=r;return r.featureType=nAt.find(n=>s.id.startsWith(\"\".concat(this.id,\"-\").concat(n,\"-\"))),i>=0&&s.id.startsWith(\"\".concat(this.id,\"-points-text\"))&&this.state.binary&&(r.index=this.props.data.points.globalFeatureIds.value[i]),r}_updateAutoHighlight(t){let r=\"\".concat(this.id,\"-points-\"),i=t.featureType===\"points\";for(let s of this.getSubLayers())s.id.startsWith(r)===i&&s.updateAutoHighlight(t)}_renderPolygonLayer(){let{extruded:t,wireframe:r}=this.props,{layerProps:i}=this.state,s=\"polygons-fill\",n=this.shouldRenderSubLayer(s,i.polygons.data)&&this.getSubLayerClass(s,Q3.type);if(n){let o=$3(this,Q3.props),c=t&&r;return c||delete o.getLineColor,o.updateTriggers.lineColors=c,new n(o,this.getSubLayerProps({id:s,updateTriggers:o.updateTriggers}),i.polygons)}return null}_renderLineLayers(){let{extruded:t,stroked:r}=this.props,{layerProps:i}=this.state,s=\"polygons-stroke\",n=\"linestrings\",o=!t&&r&&this.shouldRenderSubLayer(s,i.polygonsOutline.data)&&this.getSubLayerClass(s,sS.type),c=this.shouldRenderSubLayer(n,i.lines.data)&&this.getSubLayerClass(n,sS.type);if(o||c){let f=$3(this,sS.props);return[o&&new o(f,this.getSubLayerProps({id:s,updateTriggers:f.updateTriggers}),i.polygonsOutline),c&&new c(f,this.getSubLayerProps({id:n,updateTriggers:f.updateTriggers}),i.lines)]}return null}_renderPointLayers(){let{pointType:t}=this.props,{layerProps:r,binary:i}=this.state,{highlightedObjectIndex:s}=this.props;!i&&Number.isFinite(s)&&(s=r.points.data.findIndex(c=>c.__source.index===s));let n=new Set(t.split(\"+\")),o=[];for(let c of n){let f=\"points-\".concat(c),_=nS[c],w=_&&this.shouldRenderSubLayer(f,r.points.data)&&this.getSubLayerClass(f,_.type);if(w){let I=$3(this,_.props),R=r.points;if(c===\"text\"&&i){let{instancePickingColors:N,...j}=R.data.attributes;R={...R,data:{...R.data,attributes:j}}}o.push(new w(I,this.getSubLayerProps({id:f,updateTriggers:I.updateTriggers,highlightedObjectIndex:s}),R))}}return o}renderLayers(){let{extruded:t}=this.props,r=this._renderPolygonLayer(),i=this._renderLineLayers(),s=this._renderPointLayers();return[!t&&r,i,s,t&&r]}getSubLayerAccessor(t){let{binary:r}=this.state;return!r||typeof t!=\"function\"?super.getSubLayerAccessor(t):(i,s)=>{let{data:n,index:o}=s,c=Zq(n,o);return t(c,s)}}};G(Mm,\"layerName\",\"GeoJsonLayer\");G(Mm,\"defaultProps\",sAt);var QXt=1/Math.PI*180,$Xt=1/180*Math.PI,oAt={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...oAt}};var oS=globalThis.mathgl.config;function aS(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ix(e,t,r){let i=oS.EPSILON;r&&(oS.EPSILON=r);try{if(e===t)return!0;if(aS(e)&&aS(t)){if(e.length!==t.length)return!1;for(let s=0;s{t([r,i],[s,n],o,c)},this.options):xZ(this.points,t,this.options)}modifyWindingDirection(t){return this.isFlatArray?mB(this.points,t,this.options):vZ(this.points,t,this.options)}};function vB(e,t,r=2,i,s=\"xy\"){let n=t&&t.length,o=n?t[0]*r:e.length,c=wZ(e,0,o,r,!0,i&&i[0],s),f=[];if(!c||c.next===c.prev)return f;let _,w,I,R,N,j,Q;if(n&&(c=dAt(e,t,c,r,i,s)),e.length>80*r){R=w=e[0],N=I=e[1];for(let et=r;etw&&(w=j),Q>I&&(I=Q);_=Math.max(w-R,I-N),_=_!==0?32767/_:0}return lS(c,f,r,R,N,_,0),f}function wZ(e,t,r,i,s,n,o){let c,f;n===void 0&&(n=nx(e,{start:t,end:r,size:i,plane:o}));let _=qg[o[0]],w=qg[o[1]];if(s===n<0)for(c=t;c=t;c-=i)f=bZ(c,e[c+_],e[c+w],f);return f&&eI(f,f.next)&&(uS(f),f=f.next),f}function Zg(e,t){if(!e)return e;t||(t=e);let r=e,i;do if(i=!1,!r.steiner&&(eI(r,r.next)||ys(r.prev,r,r.next)===0)){if(uS(r),r=t=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==t);return t}function lS(e,t,r,i,s,n,o){if(!e)return;!o&&n&&_At(e,i,s,n);let c=e,f,_;for(;e.prev!==e.next;){if(f=e.prev,_=e.next,n?uAt(e,i,s,n):cAt(e)){t.push(f.i/r|0),t.push(e.i/r|0),t.push(_.i/r|0),uS(e),e=_.next,c=_.next;continue}if(e=_,e===c){o?o===1?(e=hAt(Zg(e),t,r),lS(e,t,r,i,s,n,2)):o===2&&fAt(e,t,r,i,s,n):lS(Zg(e),t,r,i,s,n,1);break}}}function cAt(e){let t=e.prev,r=e,i=e.next;if(ys(t,r,i)>=0)return!1;let s=t.x,n=r.x,o=i.x,c=t.y,f=r.y,_=i.y,w=sn?s>o?s:o:n>o?n:o,N=c>f?c>_?c:_:f>_?f:_,j=i.next;for(;j!==t;){if(j.x>=w&&j.x<=R&&j.y>=I&&j.y<=N&&ox(s,c,n,f,o,_,j.x,j.y)&&ys(j.prev,j,j.next)>=0)return!1;j=j.next}return!0}function uAt(e,t,r,i){let s=e.prev,n=e,o=e.next;if(ys(s,n,o)>=0)return!1;let c=s.x,f=n.x,_=o.x,w=s.y,I=n.y,R=o.y,N=cf?c>_?c:_:f>_?f:_,et=w>I?w>R?w:R:I>R?I:R,Y=yB(N,j,t,r,i),K=yB(Q,et,t,r,i),J=e.prevZ,ut=e.nextZ;for(;J&&J.z>=Y&&ut&&ut.z<=K;){if(J.x>=N&&J.x<=Q&&J.y>=j&&J.y<=et&&J!==s&&J!==o&&ox(c,w,f,I,_,R,J.x,J.y)&&ys(J.prev,J,J.next)>=0||(J=J.prevZ,ut.x>=N&&ut.x<=Q&&ut.y>=j&&ut.y<=et&&ut!==s&&ut!==o&&ox(c,w,f,I,_,R,ut.x,ut.y)&&ys(ut.prev,ut,ut.next)>=0))return!1;ut=ut.nextZ}for(;J&&J.z>=Y;){if(J.x>=N&&J.x<=Q&&J.y>=j&&J.y<=et&&J!==s&&J!==o&&ox(c,w,f,I,_,R,J.x,J.y)&&ys(J.prev,J,J.next)>=0)return!1;J=J.prevZ}for(;ut&&ut.z<=K;){if(ut.x>=N&&ut.x<=Q&&ut.y>=j&&ut.y<=et&&ut!==s&&ut!==o&&ox(c,w,f,I,_,R,ut.x,ut.y)&&ys(ut.prev,ut,ut.next)>=0)return!1;ut=ut.nextZ}return!0}function hAt(e,t,r){let i=e;do{let s=i.prev,n=i.next.next;!eI(s,n)&&SZ(s,i,i.next,n)&&cS(s,n)&&cS(n,s)&&(t.push(s.i/r|0),t.push(i.i/r|0),t.push(n.i/r|0),uS(i),uS(i.next),i=e=n),i=i.next}while(i!==e);return Zg(i)}function fAt(e,t,r,i,s,n){let o=e;do{let c=o.next.next;for(;c!==o.prev;){if(o.i!==c.i&&xAt(o,c)){let f=TZ(o,c);o=Zg(o,o.next),f=Zg(f,f.next),lS(o,t,r,i,s,n,0),lS(f,t,r,i,s,n,0);return}c=c.next}o=o.next}while(o!==e)}function dAt(e,t,r,i,s,n){let o=[],c,f,_,w,I;for(c=0,f=t.length;c=r.next.y&&r.next.y!==r.y){let R=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(R<=i&&R>n&&(n=R,o=r.x=r.x&&r.x>=f&&i!==r.x&&ox(s<_?i:n,s,f,_,s<_?n:i,s,r.x,r.y)&&(I=Math.abs(s-r.y)/(i-r.x),cS(r,e)&&(Io.x||r.x===o.x&&gAt(o,r)))&&(o=r,w=I)),r=r.next;while(r!==c);return o}function gAt(e,t){return ys(e.prev,e,t.prev)<0&&ys(t.next,e,e.next)<0}function _At(e,t,r,i){let s=e;do s.z===0&&(s.z=yB(s.x,s.y,t,r,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,yAt(s)}function yAt(e){let t,r,i=1,s,n,o,c,f,_;do{for(n=e,e=null,_=null,s=0;n;){for(s++,c=n,o=0,r=0;r0||f>0&&c;)o!==0&&(f===0||!c||n.z<=c.z)?(t=n,n=n.nextZ,o--):(t=c,c=c.nextZ,f--),_?_.nextZ=t:e=t,t.prevZ=_,_=t;n=c}_.nextZ=null,i*=2}while(s>1);return e}function yB(e,t,r,i,s){return e=(e-r)*s|0,t=(t-i)*s|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function vAt(e){let t=e,r=e;do(t.x=(e-o)*(n-c)&&(e-o)*(i-c)>=(r-o)*(t-c)&&(r-o)*(n-c)>=(s-o)*(i-c)}function xAt(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!bAt(e,t)&&(cS(e,t)&&cS(t,e)&&wAt(e,t)&&(ys(e.prev,e,t.prev)||ys(e,t.prev,t))||eI(e,t)&&ys(e.prev,e,e.next)>0&&ys(t.prev,t,t.next)>0)}function ys(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function eI(e,t){return e.x===t.x&&e.y===t.y}function SZ(e,t,r,i){let s=tI(ys(e,t,r)),n=tI(ys(e,t,i)),o=tI(ys(r,i,e)),c=tI(ys(r,i,t));return!!(s!==n&&o!==c||s===0&&J3(e,r,t)||n===0&&J3(e,i,t)||o===0&&J3(r,e,i)||c===0&&J3(r,t,i))}function J3(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function tI(e){return e>0?1:e<0?-1:0}function bAt(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&SZ(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function cS(e,t){return ys(e.prev,e,e.next)<0?ys(e,t,e.next)>=0&&ys(e,e.prev,t)>=0:ys(e,t,e.prev)<0||ys(e,e.next,t)<0}function wAt(e,t){let r=e,i=!1,s=(e.x+t.x)/2,n=(e.y+t.y)/2;do r.y>n!=r.next.y>n&&r.next.y!==r.y&&s<(r.next.x-r.x)*(n-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==e);return i}function TZ(e,t){let r=new hS(e.i,e.x,e.y),i=new hS(t.i,t.x,t.y),s=e.next,n=t.prev;return e.next=t,t.prev=e,r.next=s,s.prev=r,i.next=r,r.prev=i,n.next=i,i.prev=n,i}function bZ(e,t,r,i){let s=new hS(e,t,r);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function uS(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var hS=class{constructor(t,r,i){G(this,\"i\",void 0),G(this,\"x\",void 0),G(this,\"y\",void 0),G(this,\"prev\",null),G(this,\"next\",null),G(this,\"z\",0),G(this,\"prevZ\",null),G(this,\"nextZ\",null),G(this,\"steiner\",!1),this.i=t,this.x=r,this.y=i}};function PZ(e){e(\"EPSG:4326\",\"+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees\"),e(\"EPSG:4269\",\"+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees\"),e(\"EPSG:3857\",\"+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs\"),e.WGS84=e[\"EPSG:4326\"],e[\"EPSG:3785\"]=e[\"EPSG:3857\"],e.GOOGLE=e[\"EPSG:3857\"],e[\"EPSG:900913\"]=e[\"EPSG:3857\"],e[\"EPSG:102113\"]=e[\"EPSG:3857\"]}var uf=1,hf=2,Ip=3,IZ=4,fS=5,xB=6378137,CZ=6356752314e-3,bB=.0066943799901413165,Yg=484813681109536e-20,de=Math.PI/2,LZ=.16666666666666666,kZ=.04722222222222222,RZ=.022156084656084655,Se=1e-10,vs=.017453292519943295,Sc=57.29577951308232,Ui=Math.PI/4,Em=Math.PI*2,xs=3.14159265359;var Rl={};Rl.greenwich=0;Rl.lisbon=-9.131906111111;Rl.paris=2.337229166667;Rl.bogota=-74.080916666667;Rl.madrid=-3.687938888889;Rl.rome=12.452333333333;Rl.bern=7.439583333333;Rl.jakarta=106.807719444444;Rl.ferro=-17.666666666667;Rl.brussels=4.367975;Rl.stockholm=18.058277777778;Rl.athens=23.7163375;Rl.oslo=10.722916666667;var DZ={ft:{to_meter:.3048},\"us-ft\":{to_meter:1200/3937}};var OZ=/[\\s_\\-\\/\\(\\)]/g;function uu(e,t){if(e[t])return e[t];for(var r=Object.keys(e),i=t.toLowerCase().replace(OZ,\"\"),s=-1,n,o;++s=this.text.length)return;e=this.text[this.place++]}switch(this.state){case pS:return this.neutral(e);case FZ:return this.keyword(e);case rI:return this.quoted(e);case NZ:return this.afterquote(e);case zZ:return this.number(e);case wB:return}};Cp.prototype.afterquote=function(e){if(e==='\"'){this.word+='\"',this.state=rI;return}if(iI.test(e)){this.word=this.word.trim(),this.afterItem(e);return}throw new Error(`havn't handled \"`+e+'\" in afterquote yet, index '+this.place)};Cp.prototype.afterItem=function(e){if(e===\",\"){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=pS;return}if(e===\"]\"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=pS,this.currentObject=this.stack.pop(),this.currentObject||(this.state=wB);return}};Cp.prototype.number=function(e){if(UZ.test(e)){this.word+=e;return}if(iI.test(e)){this.word=parseFloat(this.word),this.afterItem(e);return}throw new Error(`havn't handled \"`+e+'\" in number yet, index '+this.place)};Cp.prototype.quoted=function(e){if(e==='\"'){this.state=NZ;return}this.word+=e};Cp.prototype.keyword=function(e){if(IAt.test(e)){this.word+=e;return}if(e===\"[\"){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=pS;return}if(iI.test(e)){this.afterItem(e);return}throw new Error(`havn't handled \"`+e+'\" in keyword yet, index '+this.place)};Cp.prototype.neutral=function(e){if(PAt.test(e)){this.word=e,this.state=FZ;return}if(e==='\"'){this.word=\"\",this.state=rI;return}if(UZ.test(e)){this.word=e,this.state=zZ;return}if(iI.test(e)){this.afterItem(e);return}throw new Error(`havn't handled \"`+e+'\" in neutral yet, index '+this.place)};Cp.prototype.output=function(){for(;this.place0?90:-90),e.lat_ts=e.lat1):!e.lat_ts&&e.lat0&&e.projName===\"Polar_Stereographic\"&&(e.lat_ts=e.lat0,e.lat0=dd(e.lat0>0?90:-90))}function nI(e){var t=BZ(e),r=t.shift(),i=t.shift();t.unshift([\"name\",i]),t.unshift([\"type\",r]);var s={};return Qg(t,s),RAt(s),s}function Ju(e){var t=this;if(arguments.length===2){var r=arguments[1];typeof r==\"string\"?r.charAt(0)===\"+\"?Ju[e]=dS(arguments[1]):Ju[e]=nI(arguments[1]):Ju[e]=r}else if(arguments.length===1){if(Array.isArray(e))return e.map(function(i){Array.isArray(i)?Ju.apply(t,i):Ju(i)});if(typeof e==\"string\"){if(e in Ju)return Ju[e]}else\"EPSG\"in e?Ju[\"EPSG:\"+e.EPSG]=e:\"ESRI\"in e?Ju[\"ESRI:\"+e.ESRI]=e:\"IAU2000\"in e?Ju[\"IAU2000:\"+e.IAU2000]=e:console.log(e);return}}PZ(Ju);var ax=Ju;function DAt(e){return typeof e==\"string\"}function OAt(e){return e in ax}var BAt=[\"PROJECTEDCRS\",\"PROJCRS\",\"GEOGCS\",\"GEOCCS\",\"PROJCS\",\"LOCAL_CS\",\"GEODCRS\",\"GEODETICCRS\",\"GEODETICDATUM\",\"ENGCRS\",\"ENGINEERINGCRS\"];function FAt(e){return BAt.some(function(t){return e.indexOf(t)>-1})}var zAt=[\"3857\",\"900913\",\"3785\",\"102113\"];function NAt(e){var t=uu(e,\"authority\");if(t){var r=uu(t,\"epsg\");return r&&zAt.indexOf(r)>-1}}function UAt(e){var t=uu(e,\"extension\");if(t)return uu(t,\"proj4\")}function VAt(e){return e[0]===\"+\"}function jAt(e){if(DAt(e)){if(OAt(e))return ax[e];if(FAt(e)){var t=nI(e);if(NAt(t))return ax[\"EPSG:3857\"];var r=UAt(t);return r?dS(r):t}if(VAt(e))return dS(e)}else return e}var jZ=jAt;function SB(e,t){e=e||{};var r,i;if(!t)return e;for(i in t)r=t[i],r!==void 0&&(e[i]=r);return e}function ol(e,t,r){var i=e*t;return r/Math.sqrt(1-i*i)}function pd(e){return e<0?-1:1}function Ce(e){return Math.abs(e)<=xs?e:e-pd(e)*Em}function Dl(e,t,r){var i=e*r,s=.5*e;return i=Math.pow((1-i)/(1+i),s),Math.tan(.5*(de-t))/i}function Lp(e,t){for(var r=.5*e,i,s,n=de-2*Math.atan(t),o=0;o<=15;o++)if(i=e*Math.sin(n),s=de-2*Math.atan(t*Math.pow((1-i)/(1+i),r))-n,n+=s,Math.abs(s)<=1e-10)return n;return-9999}function GAt(){var e=this.b/this.a;this.es=1-e*e,\"x0\"in this||(this.x0=0),\"y0\"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=ol(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function WAt(e){var t=e.x,r=e.y;if(r*Sc>90&&r*Sc<-90&&t*Sc>180&&t*Sc<-180)return null;var i,s;if(Math.abs(Math.abs(r)-de)<=Se)return null;if(this.sphere)i=this.x0+this.a*this.k0*Ce(t-this.long0),s=this.y0+this.a*this.k0*Math.log(Math.tan(Ui+.5*r));else{var n=Math.sin(r),o=Dl(this.e,r,n);i=this.x0+this.a*this.k0*Ce(t-this.long0),s=this.y0-this.a*this.k0*Math.log(o)}return e.x=i,e.y=s,e}function HAt(e){var t=e.x-this.x0,r=e.y-this.y0,i,s;if(this.sphere)s=de-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var n=Math.exp(-r/(this.a*this.k0));if(s=Lp(this.e,n),s===-9999)return null}return i=Ce(this.long0+t/(this.a*this.k0)),e.x=i,e.y=s,e}var qAt=[\"Mercator\",\"Popular Visualisation Pseudo Mercator\",\"Mercator_1SP\",\"Mercator_Auxiliary_Sphere\",\"merc\"],GZ={init:GAt,forward:WAt,inverse:HAt,names:qAt};function ZAt(){}function WZ(e){return e}var YAt=[\"longlat\",\"identity\"],HZ={init:ZAt,forward:WZ,inverse:WZ,names:YAt};var QAt=[GZ,HZ],sI={},oI=[];function qZ(e,t){var r=oI.length;return e.names?(oI[r]=e,e.names.forEach(function(i){sI[i.toLowerCase()]=r}),this):(console.log(t),!0)}function $At(e){if(!e)return!1;var t=e.toLowerCase();if(typeof sI[t]<\"u\"&&oI[sI[t]])return oI[sI[t]]}function XAt(){QAt.forEach(qZ)}var ZZ={start:XAt,add:qZ,get:$At};var Xr={};Xr.MERIT={a:6378137,rf:298.257,ellipseName:\"MERIT 1983\"};Xr.SGS85={a:6378136,rf:298.257,ellipseName:\"Soviet Geodetic System 85\"};Xr.GRS80={a:6378137,rf:298.257222101,ellipseName:\"GRS 1980(IUGG, 1980)\"};Xr.IAU76={a:6378140,rf:298.257,ellipseName:\"IAU 1976\"};Xr.airy={a:6377563396e-3,b:635625691e-2,ellipseName:\"Airy 1830\"};Xr.APL4={a:6378137,rf:298.25,ellipseName:\"Appl. Physics. 1965\"};Xr.NWL9D={a:6378145,rf:298.25,ellipseName:\"Naval Weapons Lab., 1965\"};Xr.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:\"Modified Airy\"};Xr.andrae={a:637710443e-2,rf:300,ellipseName:\"Andrae 1876 (Den., Iclnd.)\"};Xr.aust_SA={a:6378160,rf:298.25,ellipseName:\"Australian Natl & S. Amer. 1969\"};Xr.GRS67={a:6378160,rf:298.247167427,ellipseName:\"GRS 67(IUGG 1967)\"};Xr.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:\"Bessel 1841\"};Xr.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:\"Bessel 1841 (Namibia)\"};Xr.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:\"Clarke 1866\"};Xr.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:\"Clarke 1880 mod.\"};Xr.clrk80ign={a:63782492e-1,b:6356515,rf:293.4660213,ellipseName:\"Clarke 1880 (IGN)\"};Xr.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:\"Clarke 1858\"};Xr.CPM={a:63757387e-1,rf:334.29,ellipseName:\"Comm. des Poids et Mesures 1799\"};Xr.delmbr={a:6376428,rf:311.5,ellipseName:\"Delambre 1810 (Belgium)\"};Xr.engelis={a:637813605e-2,rf:298.2566,ellipseName:\"Engelis 1985\"};Xr.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:\"Everest 1830\"};Xr.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:\"Everest 1948\"};Xr.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:\"Everest 1956\"};Xr.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:\"Everest 1969\"};Xr.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:\"Everest (Sabah & Sarawak)\"};Xr.fschr60={a:6378166,rf:298.3,ellipseName:\"Fischer (Mercury Datum) 1960\"};Xr.fschr60m={a:6378155,rf:298.3,ellipseName:\"Fischer 1960\"};Xr.fschr68={a:6378150,rf:298.3,ellipseName:\"Fischer 1968\"};Xr.helmert={a:6378200,rf:298.3,ellipseName:\"Helmert 1906\"};Xr.hough={a:6378270,rf:297,ellipseName:\"Hough\"};Xr.intl={a:6378388,rf:297,ellipseName:\"International 1909 (Hayford)\"};Xr.kaula={a:6378163,rf:298.24,ellipseName:\"Kaula 1961\"};Xr.lerch={a:6378139,rf:298.257,ellipseName:\"Lerch 1979\"};Xr.mprts={a:6397300,rf:191,ellipseName:\"Maupertius 1738\"};Xr.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:\"New International 1967\"};Xr.plessis={a:6376523,rf:6355863,ellipseName:\"Plessis 1817 (France)\"};Xr.krass={a:6378245,rf:298.3,ellipseName:\"Krassovsky, 1942\"};Xr.SEasia={a:6378155,b:63567733205e-4,ellipseName:\"Southeast Asia\"};Xr.walbeck={a:6376896,b:63558348467e-4,ellipseName:\"Walbeck\"};Xr.WGS60={a:6378165,rf:298.3,ellipseName:\"WGS 60\"};Xr.WGS66={a:6378145,rf:298.25,ellipseName:\"WGS 66\"};Xr.WGS7={a:6378135,rf:298.26,ellipseName:\"WGS 72\"};var YZ=Xr.WGS84={a:6378137,rf:298.257223563,ellipseName:\"WGS 84\"};Xr.sphere={a:6370997,b:6370997,ellipseName:\"Normal Sphere (r=6370997)\"};function QZ(e,t,r,i){var s=e*e,n=t*t,o=(s-n)/s,c=0;i?(e*=1-o*(LZ+o*(kZ+o*RZ)),s=e*e,o=0):c=Math.sqrt(o);var f=(s-n)/n;return{es:o,e:c,ep2:f}}function $Z(e,t,r,i,s){if(!e){var n=uu(Xr,i);n||(n=YZ),e=n.a,t=n.b,r=n.rf}return r&&!t&&(t=(1-1/r)*e),(r===0||Math.abs(e-t)3&&(c.datum_params[3]!==0||c.datum_params[4]!==0||c.datum_params[5]!==0||c.datum_params[6]!==0)&&(c.datum_type=hf,c.datum_params[3]*=Yg,c.datum_params[4]*=Yg,c.datum_params[5]*=Yg,c.datum_params[6]=c.datum_params[6]/1e6+1)),o&&(c.datum_type=Ip,c.grids=o),c.a=r,c.b=i,c.es=s,c.ep2=n,c}var XZ=KAt;var KZ={};function MB(e,t){var r=new DataView(t),i=tmt(r),s=emt(r,i),n=rmt(r,s,i),o={header:s,subgrids:n};return KZ[e]=o,o}function JZ(e){if(e===void 0)return null;var t=e.split(\",\");return t.map(JAt)}function JAt(e){if(e.length===0)return null;var t=e[0]===\"@\";return t&&(e=e.slice(1)),e===\"null\"?{name:\"null\",mandatory:!t,grid:null,isNull:!0}:{name:e,mandatory:!t,grid:KZ[e]||null,isNull:!1}}function lx(e){return e/3600*Math.PI/180}function tmt(e){var t=e.getInt32(8,!1);return t===11?!1:(t=e.getInt32(8,!0),t!==11&&console.warn(\"Failed to detect nadgrid endian-ness, defaulting to little-endian\"),!0)}function emt(e,t){return{nFields:e.getInt32(8,t),nSubgridFields:e.getInt32(24,t),nSubgrids:e.getInt32(40,t),shiftType:TB(e,56,64).trim(),fromSemiMajorAxis:e.getFloat64(120,t),fromSemiMinorAxis:e.getFloat64(136,t),toSemiMajorAxis:e.getFloat64(152,t),toSemiMinorAxis:e.getFloat64(168,t)}}function TB(e,t,r){return String.fromCharCode.apply(null,new Uint8Array(e.buffer.slice(t,r)))}function rmt(e,t,r){for(var i=176,s=[],n=0;n5e-11?!1:e.datum_type===uf?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]:e.datum_type===hf?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]&&e.datum_params[3]===t.datum_params[3]&&e.datum_params[4]===t.datum_params[4]&&e.datum_params[5]===t.datum_params[5]&&e.datum_params[6]===t.datum_params[6]:!0}function aI(e,t,r){var i=e.x,s=e.y,n=e.z?e.z:0,o,c,f,_;if(s<-de&&s>-1.001*de)s=-de;else if(s>de&&s<1.001*de)s=de;else{if(s<-de)return{x:-1/0,y:-1/0,z:e.z};if(s>de)return{x:1/0,y:1/0,z:e.z}}return i>Math.PI&&(i-=2*Math.PI),c=Math.sin(s),_=Math.cos(s),f=c*c,o=r/Math.sqrt(1-t*f),{x:(o+n)*_*Math.cos(i),y:(o+n)*_*Math.sin(i),z:(o*(1-t)+n)*c}}function lI(e,t,r,i){var s=1e-12,n=s*s,o=30,c,f,_,w,I,R,N,j,Q,et,Y,K,J,ut=e.x,Et=e.y,kt=e.z?e.z:0,Xt,qt,le;if(c=Math.sqrt(ut*ut+Et*Et),f=Math.sqrt(ut*ut+Et*Et+kt*kt),c/rn&&Ji.y||j>i.x||Yc&&Math.abs(f.y)>c);if(o<0)return console.log(\"Inverse grid shift iterator failed to converge.\"),i;i.x=Ce(n.x+r.ll[0]),i.y=n.y+r.ll[1]}else isNaN(n.x)||(i.x=e.x+n.x,i.y=e.y+n.y);return i}function nY(e,t){var r={x:e.x/t.del[0],y:e.y/t.del[1]},i={x:Math.floor(r.x),y:Math.floor(r.y)},s={x:r.x-1*i.x,y:r.y-1*i.y},n={x:Number.NaN,y:Number.NaN},o;if(i.x<0||i.x>=t.lim[0]||i.y<0||i.y>=t.lim[1])return n;o=i.y*t.lim[0]+i.x;var c={x:t.cvs[o][0],y:t.cvs[o][1]};o++;var f={x:t.cvs[o][0],y:t.cvs[o][1]};o+=t.lim[0];var _={x:t.cvs[o][0],y:t.cvs[o][1]};o--;var w={x:t.cvs[o][0],y:t.cvs[o][1]},I=s.x*s.y,R=s.x*(1-s.y),N=(1-s.x)*(1-s.y),j=(1-s.x)*s.y;return n.x=N*c.x+R*f.x+j*w.x+I*_.x,n.y=N*c.y+R*f.y+j*w.y+I*_.y,n}function EB(e,t,r){var i=r.x,s=r.y,n=r.z||0,o,c,f,_={};for(f=0;f<3;f++)if(!(t&&f===2&&r.z===void 0))switch(f===0?(o=i,\"ew\".indexOf(e.axis[f])!==-1?c=\"x\":c=\"y\"):f===1?(o=s,\"ns\".indexOf(e.axis[f])!==-1?c=\"y\":c=\"x\"):(o=n,c=\"z\"),e.axis[f]){case\"e\":_[c]=o;break;case\"w\":_[c]=-o;break;case\"n\":_[c]=o;break;case\"s\":_[c]=-o;break;case\"u\":r[c]!==void 0&&(_.z=o);break;case\"d\":r[c]!==void 0&&(_.z=-o);break;default:return null}return _}function uI(e){var t={x:e[0],y:e[1]};return e.length>2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t}function aY(e){oY(e.x),oY(e.y)}function oY(e){if(typeof Number.isFinite==\"function\"){if(Number.isFinite(e))return;throw new TypeError(\"coordinates must be finite numbers\")}if(typeof e!=\"number\"||e!==e||!isFinite(e))throw new TypeError(\"coordinates must be finite numbers\")}function amt(e,t){return(e.datum.datum_type===uf||e.datum.datum_type===hf||e.datum.datum_type===Ip)&&t.datumCode!==\"WGS84\"||(t.datum.datum_type===uf||t.datum.datum_type===hf||t.datum.datum_type===Ip)&&e.datumCode!==\"WGS84\"}function $g(e,t,r,i){var s;Array.isArray(r)?r=uI(r):r={x:r.x,y:r.y,z:r.z,m:r.m};var n=r.z!==void 0;if(aY(r),e.datum&&t.datum&&amt(e,t)&&(s=new Pm(\"WGS84\"),r=$g(e,s,r,i),e=s),i&&e.axis!==\"enu\"&&(r=EB(e,!1,r)),e.projName===\"longlat\")r={x:r.x*vs,y:r.y*vs,z:r.z||0};else if(e.to_meter&&(r={x:r.x*e.to_meter,y:r.y*e.to_meter,z:r.z||0}),r=e.inverse(r),!r)return;if(e.from_greenwich&&(r.x+=e.from_greenwich),r=sY(e.datum,t.datum,r),!!r)return t.from_greenwich&&(r={x:r.x-t.from_greenwich,y:r.y,z:r.z||0}),t.projName===\"longlat\"?r={x:r.x*Sc,y:r.y*Sc,z:r.z||0}:(r=t.forward(r),t.to_meter&&(r={x:r.x/t.to_meter,y:r.y/t.to_meter,z:r.z||0})),i&&t.axis!==\"enu\"?EB(t,!0,r):(r&&!n&&delete r.z,r)}var lY=Pm(\"WGS84\");function PB(e,t,r,i){var s,n,o;return Array.isArray(r)?(s=$g(e,t,r,i)||{x:NaN,y:NaN},r.length>2?typeof e.name<\"u\"&&e.name===\"geocent\"||typeof t.name<\"u\"&&t.name===\"geocent\"?typeof s.z==\"number\"?[s.x,s.y,s.z].concat(r.splice(3)):[s.x,s.y,r[2]].concat(r.splice(3)):[s.x,s.y].concat(r.splice(2)):[s.x,s.y]):(n=$g(e,t,r,i),o=Object.keys(r),o.length===2||o.forEach(function(c){if(typeof e.name<\"u\"&&e.name===\"geocent\"||typeof t.name<\"u\"&&t.name===\"geocent\"){if(c===\"x\"||c===\"y\"||c===\"z\")return}else if(c===\"x\"||c===\"y\")return;n[c]=r[c]}),n)}function cY(e){return e instanceof Pm?e:e.oProj?e.oProj:Pm(e)}function lmt(e,t,r){e=cY(e);var i=!1,s;return typeof t>\"u\"?(t=e,e=lY,i=!0):(typeof t.x<\"u\"||Array.isArray(t))&&(r=t,t=e,e=lY,i=!0),t=cY(t),r?PB(e,t,r):(s={forward:function(n,o){return PB(e,t,n,o)},inverse:function(n,o){return PB(t,e,n,o)}},i&&(s.oProj=t),s)}var Tc=lmt;var uY=6,fY=\"AJSAJS\",dY=\"AFAFAF\",ux=65,Mc=73,th=79,AS=86,mS=90,pY={forward:CB,inverse:cmt,toPoint:LB};function CB(e,t){return t=t||5,fmt(umt({lat:e[1],lon:e[0]}),t)}function cmt(e){var t=kB(mY(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function LB(e){var t=kB(mY(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function IB(e){return e*(Math.PI/180)}function hY(e){return 180*(e/Math.PI)}function umt(e){var t=e.lat,r=e.lon,i=6378137,s=.00669438,n=.9996,o,c,f,_,w,I,R,N=IB(t),j=IB(r),Q,et;et=Math.floor((r+180)/6)+1,r===180&&(et=60),t>=56&&t<64&&r>=3&&r<12&&(et=32),t>=72&&t<84&&(r>=0&&r<9?et=31:r>=9&&r<21?et=33:r>=21&&r<33?et=35:r>=33&&r<42&&(et=37)),o=(et-1)*6-180+3,Q=IB(o),c=s/(1-s),f=i/Math.sqrt(1-s*Math.sin(N)*Math.sin(N)),_=Math.tan(N)*Math.tan(N),w=c*Math.cos(N)*Math.cos(N),I=Math.cos(N)*(j-Q),R=i*((1-s/4-3*s*s/64-5*s*s*s/256)*N-(3*s/8+3*s*s/32+45*s*s*s/1024)*Math.sin(2*N)+(15*s*s/256+45*s*s*s/1024)*Math.sin(4*N)-35*s*s*s/3072*Math.sin(6*N));var Y=n*f*(I+(1-_+w)*I*I*I/6+(5-18*_+_*_+72*w-58*c)*I*I*I*I*I/120)+5e5,K=n*(R+f*Math.tan(N)*(I*I/2+(5-_+9*w+4*w*w)*I*I*I*I/24+(61-58*_+_*_+600*w-330*c)*I*I*I*I*I*I/720));return t<0&&(K+=1e7),{northing:Math.round(K),easting:Math.round(Y),zoneNumber:et,zoneLetter:hmt(t)}}function kB(e){var t=e.northing,r=e.easting,i=e.zoneLetter,s=e.zoneNumber;if(s<0||s>60)return null;var n=.9996,o=6378137,c=.00669438,f,_=(1-Math.sqrt(1-c))/(1+Math.sqrt(1-c)),w,I,R,N,j,Q,et,Y,K,J=r-5e5,ut=t;i<\"N\"&&(ut-=1e7),et=(s-1)*6-180+3,f=c/(1-c),Q=ut/n,Y=Q/(o*(1-c/4-3*c*c/64-5*c*c*c/256)),K=Y+(3*_/2-27*_*_*_/32)*Math.sin(2*Y)+(21*_*_/16-55*_*_*_*_/32)*Math.sin(4*Y)+151*_*_*_/96*Math.sin(6*Y),w=o/Math.sqrt(1-c*Math.sin(K)*Math.sin(K)),I=Math.tan(K)*Math.tan(K),R=f*Math.cos(K)*Math.cos(K),N=o*(1-c)/Math.pow(1-c*Math.sin(K)*Math.sin(K),1.5),j=J/(w*n);var Et=K-w*Math.tan(K)/N*(j*j/2-(5+3*I+10*R-4*R*R-9*f)*j*j*j*j/24+(61+90*I+298*R+45*I*I-252*f-3*R*R)*j*j*j*j*j*j/720);Et=hY(Et);var kt=(j-(1+2*I+R)*j*j*j/6+(5-2*R+28*I-3*R*R+8*f+24*I*I)*j*j*j*j*j/120)/Math.cos(K);kt=et+hY(kt);var Xt;if(e.accuracy){var qt=kB({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});Xt={top:qt.lat,right:qt.lon,bottom:Et,left:kt}}else Xt={lat:Et,lon:kt};return Xt}function hmt(e){var t=\"Z\";return 84>=e&&e>=72?t=\"X\":72>e&&e>=64?t=\"W\":64>e&&e>=56?t=\"V\":56>e&&e>=48?t=\"U\":48>e&&e>=40?t=\"T\":40>e&&e>=32?t=\"S\":32>e&&e>=24?t=\"R\":24>e&&e>=16?t=\"Q\":16>e&&e>=8?t=\"P\":8>e&&e>=0?t=\"N\":0>e&&e>=-8?t=\"M\":-8>e&&e>=-16?t=\"L\":-16>e&&e>=-24?t=\"K\":-24>e&&e>=-32?t=\"J\":-32>e&&e>=-40?t=\"H\":-40>e&&e>=-48?t=\"G\":-48>e&&e>=-56?t=\"F\":-56>e&&e>=-64?t=\"E\":-64>e&&e>=-72?t=\"D\":-72>e&&e>=-80&&(t=\"C\"),t}function fmt(e,t){var r=\"00000\"+e.easting,i=\"00000\"+e.northing;return e.zoneNumber+e.zoneLetter+dmt(e.easting,e.northing,e.zoneNumber)+r.substr(r.length-5,t)+i.substr(i.length-5,t)}function dmt(e,t,r){var i=AY(r),s=Math.floor(e/1e5),n=Math.floor(t/1e5)%20;return pmt(s,n,i)}function AY(e){var t=e%uY;return t===0&&(t=uY),t}function pmt(e,t,r){var i=r-1,s=fY.charCodeAt(i),n=dY.charCodeAt(i),o=s+e-1,c=n+t,f=!1;o>mS&&(o=o-mS+ux-1,f=!0),(o===Mc||sMc||(o>Mc||sth||(o>th||smS&&(o=o-mS+ux-1),c>AS?(c=c-AS+ux-1,f=!0):f=!1,(c===Mc||nMc||(c>Mc||nth||(c>th||nAS&&(c=c-AS+ux-1);var _=String.fromCharCode(o)+String.fromCharCode(c);return _}function mY(e){if(e&&e.length===0)throw\"MGRSPoint coverting from nothing\";for(var t=e.length,r=null,i=\"\",s,n=0;!/[A-Z]/.test(s=e.charAt(n));){if(n>=2)throw\"MGRSPoint bad conversion from: \"+e;i+=s,n++}var o=parseInt(i,10);if(n===0||n+3>t)throw\"MGRSPoint bad conversion from: \"+e;var c=e.charAt(n++);if(c<=\"A\"||c===\"B\"||c===\"Y\"||c>=\"Z\"||c===\"I\"||c===\"O\")throw\"MGRSPoint zone letter \"+c+\" not handled: \"+e;r=e.substring(n,n+=2);for(var f=AY(o),_=Amt(r.charAt(0),f),w=mmt(r.charAt(1),f);w0&&(Q=1e5/Math.pow(10,R),et=e.substring(n,n+R),N=parseFloat(et)*Q,Y=e.substring(n+R),j=parseFloat(Y)*Q),K=N+_,J=j+w,{easting:K,northing:J,zoneLetter:c,zoneNumber:o,accuracy:Q}}function Amt(e,t){for(var r=fY.charCodeAt(t-1),i=1e5,s=!1;r!==e.charCodeAt(0);){if(r++,r===Mc&&r++,r===th&&r++,r>mS){if(s)throw\"Bad character: \"+e;r=ux,s=!0}i+=1e5}return i}function mmt(e,t){if(e>\"V\")throw\"MGRSPoint given invalid Northing \"+e;for(var r=dY.charCodeAt(t-1),i=0,s=!1;r!==e.charCodeAt(0);){if(r++,r===Mc&&r++,r===th&&r++,r>AS){if(s)throw\"Bad character: \"+e;r=ux,s=!0}i+=1e5}return i}function gmt(e){var t;switch(e){case\"C\":t=11e5;break;case\"D\":t=2e6;break;case\"E\":t=28e5;break;case\"F\":t=37e5;break;case\"G\":t=46e5;break;case\"H\":t=55e5;break;case\"J\":t=64e5;break;case\"K\":t=73e5;break;case\"L\":t=82e5;break;case\"M\":t=91e5;break;case\"N\":t=0;break;case\"P\":t=8e5;break;case\"Q\":t=17e5;break;case\"R\":t=26e5;break;case\"S\":t=35e5;break;case\"T\":t=44e5;break;case\"U\":t=53e5;break;case\"V\":t=62e5;break;case\"W\":t=7e6;break;case\"X\":t=79e5;break;default:t=-1}if(t>=0)return t;throw\"Invalid zone letter: \"+e}function hx(e,t,r){if(!(this instanceof hx))return new hx(e,t,r);if(Array.isArray(e))this.x=e[0],this.y=e[1],this.z=e[2]||0;else if(typeof e==\"object\")this.x=e.x,this.y=e.y,this.z=e.z||0;else if(typeof e==\"string\"&&typeof t>\"u\"){var i=e.split(\",\");this.x=parseFloat(i[0],10),this.y=parseFloat(i[1],10),this.z=parseFloat(i[2],10)||0}else this.x=e,this.y=t,this.z=r||0;console.warn(\"proj4.Point will be removed in version 3, use proj4.toPoint\")}hx.fromMGRS=function(e){return new hx(LB(e))};hx.prototype.toMGRS=function(e){return CB([this.x,this.y],e)};var gY=hx;var _mt=1,ymt=.25,_Y=.046875,yY=.01953125,vY=.01068115234375,vmt=.75,xmt=.46875,bmt=.013020833333333334,wmt=.007120768229166667,Smt=.3645833333333333,Tmt=.005696614583333333,Mmt=.3076171875;function hI(e){var t=[];t[0]=_mt-e*(ymt+e*(_Y+e*(yY+e*vY))),t[1]=e*(vmt-e*(_Y+e*(yY+e*vY)));var r=e*e;return t[2]=r*(xmt-e*(bmt+e*wmt)),r*=e,t[3]=r*(Smt-e*Tmt),t[4]=r*e*Mmt,t}function Xg(e,t,r,i){return r*=t,t*=t,i[0]*e-r*(i[1]+t*(i[2]+t*(i[3]+t*i[4])))}var Emt=20;function fI(e,t,r){for(var i=1/(1-t),s=e,n=Emt;n;--n){var o=Math.sin(s),c=1-t*o*o;if(c=(Xg(s,o,Math.cos(s),r)-e)*(c*Math.sqrt(c))*i,s-=c,Math.abs(c)Se?Math.tan(r):0,Q=Math.pow(j,2),et=Math.pow(Q,2);s=1-this.es*Math.pow(c,2),w=w/Math.sqrt(s);var Y=Xg(r,c,f,this.en);n=this.a*(this.k0*w*(1+I/6*(1-Q+R+I/20*(5-18*Q+et+14*R-58*Q*R+I/42*(61+179*et-et*Q-479*Q)))))+this.x0,o=this.a*(this.k0*(Y-this.ml0+c*i*w/2*(1+I/12*(5-Q+9*R+4*N+I/30*(61+et-58*Q+270*R-330*Q*R+I/56*(1385+543*et-et*Q-3111*Q))))))+this.y0}else{var _=f*Math.sin(i);if(Math.abs(Math.abs(_)-1)=1){if(_-1>Se)return 93;o=0}else o=Math.acos(o);r<0&&(o=-o),o=this.a*this.k0*(o-this.lat0)+this.y0}return e.x=n,e.y=o,e}function Cmt(e){var t,r,i,s,n=(e.x-this.x0)*(1/this.a),o=(e.y-this.y0)*(1/this.a);if(this.es)if(t=this.ml0+o/this.k0,r=fI(t,this.es,this.en),Math.abs(r)Se?Math.tan(r):0,j=this.ep2*Math.pow(R,2),Q=Math.pow(j,2),et=Math.pow(N,2),Y=Math.pow(et,2);t=1-this.es*Math.pow(I,2);var K=n*Math.sqrt(t)/this.k0,J=Math.pow(K,2);t=t*N,i=r-t*J/(1-this.es)*.5*(1-J/12*(5+3*et-9*j*et+j-4*Q-J/30*(61+90*et-252*j*et+45*Y+46*j-J/56*(1385+3633*et+4095*Y+1574*Y*et)))),s=Ce(this.long0+K*(1-J/6*(1+2*et+j-J/20*(5+28*et+24*Y+8*j*et+6*j-J/42*(61+662*et+1320*Y+720*Y*et))))/R)}else i=de*pd(o),s=0;else{var c=Math.exp(n/this.k0),f=.5*(c-1/c),_=this.lat0+o/this.k0,w=Math.cos(_);t=Math.sqrt((1-Math.pow(w,2))/(1+Math.pow(f,2))),i=Math.asin(t),o<0&&(i=-i),f===0&&w===0?s=0:s=Ce(Math.atan2(f,w)+this.long0)}return e.x=s,e.y=i,e}var Lmt=[\"Fast_Transverse_Mercator\",\"Fast Transverse Mercator\"],fx={init:Pmt,forward:Imt,inverse:Cmt,names:Lmt};function dI(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function Ta(e,t){e=Math.abs(e),t=Math.abs(t);var r=Math.max(e,t),i=Math.min(e,t)/(r||1);return r*Math.sqrt(1+Math.pow(i,2))}function xY(e){var t=1+e,r=t-1;return r===0?e:e*Math.log(t)/r}function bY(e){var t=Math.abs(e);return t=xY(t*(1+t/(Ta(1,t)+1))),e<0?-t:t}function pI(e,t){for(var r=2*Math.cos(2*t),i=e.length-1,s=e[i],n=0,o;--i>=0;)o=-n+r*s+e[i],n=s,s=o;return t+o*Math.sin(2*t)}function wY(e,t){for(var r=2*Math.cos(t),i=e.length-1,s=e[i],n=0,o;--i>=0;)o=-n+r*s+e[i],n=s,s=o;return Math.sin(t)*o}function SY(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function RB(e,t,r){for(var i=Math.sin(t),s=Math.cos(t),n=dI(r),o=SY(r),c=2*s*o,f=-2*i*n,_=e.length-1,w=e[_],I=0,R=0,N=0,j,Q;--_>=0;)j=R,Q=I,R=w,I=N,w=-j+c*R-f*I+e[_],N=-Q+f*R+c*I;return c=i*o,f=s*n,[c*w-f*N,c*N+f*w]}function kmt(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION[\"Fast_Transverse_Mercator\"] in the WKT.');this.approx&&(fx.init.apply(this),this.forward=fx.forward,this.inverse=fx.inverse),this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var e=this.es/(1+Math.sqrt(1-this.es)),t=e/(2-e),r=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+t*(-2854/675)))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+t*(4642/4725)))))),r=r*t,this.cgb[1]=r*(7/3+t*(-8/5+t*(-227/45+t*(2704/315+t*(2323/945))))),this.cbg[1]=r*(5/3+t*(-16/15+t*(-13/9+t*(904/315+t*(-1522/945))))),r=r*t,this.cgb[2]=r*(56/15+t*(-136/35+t*(-1262/105+t*(73814/2835)))),this.cbg[2]=r*(-26/15+t*(34/21+t*(8/5+t*(-12686/2835)))),r=r*t,this.cgb[3]=r*(4279/630+t*(-332/35+t*(-399572/14175))),this.cbg[3]=r*(1237/630+t*(-12/5+t*(-24832/14175))),r=r*t,this.cgb[4]=r*(4174/315+t*(-144838/6237)),this.cbg[4]=r*(-734/315+t*(109598/31185)),r=r*t,this.cgb[5]=r*(601676/22275),this.cbg[5]=r*(444337/155925),r=Math.pow(t,2),this.Qn=this.k0/(1+t)*(1+r*(1/4+r*(1/64+r/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+t*(-96199/604800)))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+t*(7891/37800)))))),this.utg[1]=r*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+t*(1118711/3870720))))),this.gtu[1]=r*(13/48+t*(-3/5+t*(557/1440+t*(281/630+t*(-1983433/1935360))))),r=r*t,this.utg[2]=r*(-17/480+t*(37/840+t*(209/4480+t*(-5569/90720)))),this.gtu[2]=r*(61/240+t*(-103/140+t*(15061/26880+t*(167603/181440)))),r=r*t,this.utg[3]=r*(-4397/161280+t*(11/504+t*(830251/7257600))),this.gtu[3]=r*(49561/161280+t*(-179/168+t*(6601661/7257600))),r=r*t,this.utg[4]=r*(-4583/161280+t*(108847/3991680)),this.gtu[4]=r*(34729/80640+t*(-3418889/1995840)),r=r*t,this.utg[5]=r*(-20648693/638668800),this.gtu[5]=r*(212378941/319334400);var i=pI(this.cbg,this.lat0);this.Zb=-this.Qn*(i+wY(this.gtu,2*i))}function Rmt(e){var t=Ce(e.x-this.long0),r=e.y;r=pI(this.cbg,r);var i=Math.sin(r),s=Math.cos(r),n=Math.sin(t),o=Math.cos(t);r=Math.atan2(i,o*s),t=Math.atan2(n*s,Ta(i,s*o)),t=bY(Math.tan(t));var c=RB(this.gtu,2*r,2*t);r=r+c[0],t=t+c[1];var f,_;return Math.abs(t)<=2.623395162778?(f=this.a*(this.Qn*t)+this.x0,_=this.a*(this.Qn*r+this.Zb)+this.y0):(f=1/0,_=1/0),e.x=f,e.y=_,e}function Dmt(e){var t=(e.x-this.x0)*(1/this.a),r=(e.y-this.y0)*(1/this.a);r=(r-this.Zb)/this.Qn,t=t/this.Qn;var i,s;if(Math.abs(t)<=2.623395162778){var n=RB(this.utg,2*r,2*t);r=r+n[0],t=t+n[1],t=Math.atan(dI(t));var o=Math.sin(r),c=Math.cos(r),f=Math.sin(t),_=Math.cos(t);r=Math.atan2(o*_,Ta(f,_*c)),t=Math.atan2(f,_*c),i=Ce(t+this.long0),s=pI(this.cgb,r)}else i=1/0,s=1/0;return e.x=i,e.y=s,e}var Omt=[\"Extended_Transverse_Mercator\",\"Extended Transverse Mercator\",\"etmerc\",\"Transverse_Mercator\",\"Transverse Mercator\",\"Gauss Kruger\",\"Gauss_Kruger\",\"tmerc\"],dx={init:kmt,forward:Rmt,inverse:Dmt,names:Omt};function TY(e,t){if(e===void 0){if(e=Math.floor((Ce(t)+Math.PI)*30/Math.PI)+1,e<0)return 0;if(e>60)return 60}return e}var Bmt=\"etmerc\";function Fmt(){var e=TY(this.zone,this.long0);if(e===void 0)throw new Error(\"unknown utm zone\");this.lat0=0,this.long0=(6*Math.abs(e)-183)*vs,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,dx.init.apply(this),this.forward=dx.forward,this.inverse=dx.inverse}var zmt=[\"Universal Transverse Mercator System\",\"utm\"],MY={init:Fmt,names:zmt,dependsOn:Bmt};function AI(e,t){return Math.pow((1-e)/(1+e),t)}var Nmt=20;function Umt(){var e=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*e*e),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(e/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+Ui)/(Math.pow(Math.tan(.5*this.lat0+Ui),this.C)*AI(this.e*e,this.ratexp))}function Vmt(e){var t=e.x,r=e.y;return e.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*r+Ui),this.C)*AI(this.e*Math.sin(r),this.ratexp))-de,e.x=this.C*t,e}function jmt(e){for(var t=1e-14,r=e.x/this.C,i=e.y,s=Math.pow(Math.tan(.5*i+Ui)/this.K,1/this.C),n=Nmt;n>0&&(i=2*Math.atan(s*AI(this.e*Math.sin(e.y),-.5*this.e))-de,!(Math.abs(i-e.y)0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Se&&Math.abs(Math.cos(this.lat_ts))>Se&&(this.k0=.5*this.cons*ol(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Dl(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=ol(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-de,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function $mt(e){var t=e.x,r=e.y,i=Math.sin(r),s=Math.cos(r),n,o,c,f,_,w,I=Ce(t-this.long0);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=Se&&Math.abs(r+this.lat0)<=Se?(e.x=NaN,e.y=NaN,e):this.sphere?(n=2*this.k0/(1+this.sinlat0*i+this.coslat0*s*Math.cos(I)),e.x=this.a*n*s*Math.sin(I)+this.x0,e.y=this.a*n*(this.coslat0*i-this.sinlat0*s*Math.cos(I))+this.y0,e):(o=2*Math.atan(this.ssfn_(r,i,this.e))-de,f=Math.cos(o),c=Math.sin(o),Math.abs(this.coslat0)<=Se?(_=Dl(this.e,r*this.con,this.con*i),w=2*this.a*this.k0*_/this.cons,e.x=this.x0+w*Math.sin(t-this.long0),e.y=this.y0-this.con*w*Math.cos(t-this.long0),e):(Math.abs(this.sinlat0)0?t=Ce(this.long0+Math.atan2(e.x,-1*e.y)):t=Ce(this.long0+Math.atan2(e.x,e.y)):t=Ce(this.long0+Math.atan2(e.x*Math.sin(c),o*this.coslat0*Math.cos(c)-e.y*this.sinlat0*Math.sin(c))),e.x=t,e.y=r,e)}else if(Math.abs(this.coslat0)<=Se){if(o<=Se)return r=this.lat0,t=this.long0,e.x=t,e.y=r,e;e.x*=this.con,e.y*=this.con,i=o*this.cons/(2*this.a*this.k0),r=this.con*Lp(this.e,i),t=this.con*Ce(this.con*this.long0+Math.atan2(e.x,-1*e.y))}else s=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,o<=Se?n=this.X0:(n=Math.asin(Math.cos(s)*this.sinX0+e.y*Math.sin(s)*this.cosX0/o),t=Ce(this.long0+Math.atan2(e.x*Math.sin(s),o*this.cosX0*Math.cos(s)-e.y*this.sinX0*Math.sin(s)))),r=-1*Lp(this.e,Math.tan(.5*(de+n)));return e.x=t,e.y=r,e}var Kmt=[\"stere\",\"Stereographic_South_Pole\",\"Polar Stereographic (variant B)\",\"Polar_Stereographic\"],PY={init:Qmt,forward:$mt,inverse:Xmt,names:Kmt,ssfn_:Ymt};function Jmt(){var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),r=this.a,i=this.rf,s=1/i,n=2*s-Math.pow(s,2),o=this.e=Math.sqrt(n);this.R=this.k0*r*Math.sqrt(1-n)/(1-n*Math.pow(t,2)),this.alpha=Math.sqrt(1+n/(1-n)*Math.pow(Math.cos(e),4)),this.b0=Math.asin(t/this.alpha);var c=Math.log(Math.tan(Math.PI/4+this.b0/2)),f=Math.log(Math.tan(Math.PI/4+e/2)),_=Math.log((1+o*t)/(1-o*t));this.K=c-this.alpha*f+this.alpha*o/2*_}function t0t(e){var t=Math.log(Math.tan(Math.PI/4-e.y/2)),r=this.e/2*Math.log((1+this.e*Math.sin(e.y))/(1-this.e*Math.sin(e.y))),i=-this.alpha*(t+r)+this.K,s=2*(Math.atan(Math.exp(i))-Math.PI/4),n=this.alpha*(e.x-this.lambda0),o=Math.atan(Math.sin(n)/(Math.sin(this.b0)*Math.tan(s)+Math.cos(this.b0)*Math.cos(n))),c=Math.asin(Math.cos(this.b0)*Math.sin(s)-Math.sin(this.b0)*Math.cos(s)*Math.cos(n));return e.y=this.R/2*Math.log((1+Math.sin(c))/(1-Math.sin(c)))+this.y0,e.x=this.R*o+this.x0,e}function e0t(e){for(var t=e.x-this.x0,r=e.y-this.y0,i=t/this.R,s=2*(Math.atan(Math.exp(r/this.R))-Math.PI/4),n=Math.asin(Math.cos(this.b0)*Math.sin(s)+Math.sin(this.b0)*Math.cos(s)*Math.cos(i)),o=Math.atan(Math.sin(i)/(Math.cos(this.b0)*Math.cos(i)-Math.sin(this.b0)*Math.tan(s))),c=this.lambda0+o/this.alpha,f=0,_=n,w=-1e3,I=0;Math.abs(_-w)>1e-7;){if(++I>20)return;f=1/this.alpha*(Math.log(Math.tan(Math.PI/4+n/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(_))/2)),w=_,_=2*Math.atan(Math.exp(f))-Math.PI/2}return e.x=c,e.y=_,e}var r0t=[\"somerc\"],IY={init:Jmt,forward:t0t,inverse:e0t,names:r0t};var px=1e-7;function i0t(e){var t=[\"Hotine_Oblique_Mercator\",\"Hotine_Oblique_Mercator_Azimuth_Natural_Origin\"],r=typeof e.PROJECTION==\"object\"?Object.keys(e.PROJECTION)[0]:e.PROJECTION;return\"no_uoff\"in e||\"no_off\"in e||t.indexOf(r)!==-1}function n0t(){var e,t,r,i,s,n,o,c,f,_,w=0,I,R=0,N=0,j=0,Q=0,et=0,Y=0,K;this.no_off=i0t(this),this.no_rot=\"no_rot\"in this;var J=!1;\"alpha\"in this&&(J=!0);var ut=!1;if(\"rectified_grid_angle\"in this&&(ut=!0),J&&(Y=this.alpha),ut&&(w=this.rectified_grid_angle*vs),J||ut)R=this.longc;else if(N=this.long1,Q=this.lat1,j=this.long2,et=this.lat2,Math.abs(Q-et)<=px||(e=Math.abs(Q))<=px||Math.abs(e-de)<=px||Math.abs(Math.abs(this.lat0)-de)<=px||Math.abs(Math.abs(et)-de)<=px)throw new Error;var Et=1-this.es;t=Math.sqrt(Et),Math.abs(this.lat0)>Se?(c=Math.sin(this.lat0),r=Math.cos(this.lat0),e=1-this.es*c*c,this.B=r*r,this.B=Math.sqrt(1+this.es*this.B*this.B/Et),this.A=this.B*this.k0*t/e,i=this.B*t/(r*Math.sqrt(e)),s=i*i-1,s<=0?s=0:(s=Math.sqrt(s),this.lat0<0&&(s=-s)),this.E=s+=i,this.E*=Math.pow(Dl(this.e,this.lat0,c),this.B)):(this.B=1/t,this.A=this.k0,this.E=i=s=1),J||ut?(J?(I=Math.asin(Math.sin(Y)/i),ut||(w=Y)):(I=w,Y=Math.asin(i*Math.sin(I))),this.lam0=R-Math.asin(.5*(s-1/s)*Math.tan(I))/this.B):(n=Math.pow(Dl(this.e,Q,Math.sin(Q)),this.B),o=Math.pow(Dl(this.e,et,Math.sin(et)),this.B),s=this.E/n,f=(o-n)/(o+n),_=this.E*this.E,_=(_-o*n)/(_+o*n),e=N-j,e<-Math.pi?j-=Em:e>Math.pi&&(j+=Em),this.lam0=Ce(.5*(N+j)-Math.atan(_*Math.tan(.5*this.B*(N-j))/f)/this.B),I=Math.atan(2*Math.sin(this.B*Ce(N-this.lam0))/(s-1/s)),w=Y=Math.asin(i*Math.sin(I))),this.singam=Math.sin(I),this.cosgam=Math.cos(I),this.sinrot=Math.sin(w),this.cosrot=Math.cos(w),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,K=this.A*this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(i*i-1)/Math.cos(Y))),this.lat0<0&&(this.u_0=-this.u_0)),s=.5*I,this.v_pole_n=this.ArB*Math.log(Math.tan(Ui-s)),this.v_pole_s=this.ArB*Math.log(Math.tan(Ui+s))}function s0t(e){var t={},r,i,s,n,o,c,f,_;if(e.x=e.x-this.lam0,Math.abs(Math.abs(e.y)-de)>Se){if(o=this.E/Math.pow(Dl(this.e,e.y,Math.sin(e.y)),this.B),c=1/o,r=.5*(o-c),i=.5*(o+c),n=Math.sin(this.B*e.x),s=(r*this.singam-n*this.cosgam)/i,Math.abs(Math.abs(s)-1)0?this.v_pole_n:this.v_pole_s,f=this.ArB*e.y;return this.no_rot?(t.x=f,t.y=_):(f-=this.u_0,t.x=_*this.cosrot+f*this.sinrot,t.y=f*this.cosrot-_*this.sinrot),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function o0t(e){var t,r,i,s,n,o,c,f={};if(e.x=(e.x-this.x0)*(1/this.a),e.y=(e.y-this.y0)*(1/this.a),this.no_rot?(r=e.y,t=e.x):(r=e.x*this.cosrot-e.y*this.sinrot,t=e.y*this.cosrot+e.x*this.sinrot+this.u_0),i=Math.exp(-this.BrA*r),s=.5*(i-1/i),n=.5*(i+1/i),o=Math.sin(this.BrA*t),c=(o*this.cosgam+s*this.singam)/n,Math.abs(Math.abs(c)-1)Se?this.ns=Math.log(i/c)/Math.log(s/f):this.ns=t,isNaN(this.ns)&&(this.ns=t),this.f0=i/(this.ns*Math.pow(s,this.ns)),this.rh=this.a*this.f0*Math.pow(_,this.ns),this.title||(this.title=\"Lambert Conformal Conic\")}}function c0t(e){var t=e.x,r=e.y;Math.abs(2*Math.abs(r)-Math.PI)<=Se&&(r=pd(r)*(de-2*Se));var i=Math.abs(Math.abs(r)-de),s,n;if(i>Se)s=Dl(this.e,r,Math.sin(r)),n=this.a*this.f0*Math.pow(s,this.ns);else{if(i=r*this.ns,i<=0)return null;n=0}var o=this.ns*Ce(t-this.long0);return e.x=this.k0*(n*Math.sin(o))+this.x0,e.y=this.k0*(this.rh-n*Math.cos(o))+this.y0,e}function u0t(e){var t,r,i,s,n,o=(e.x-this.x0)/this.k0,c=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(o*o+c*c),r=1):(t=-Math.sqrt(o*o+c*c),r=-1);var f=0;if(t!==0&&(f=Math.atan2(r*o,r*c)),t!==0||this.ns>0){if(r=1/this.ns,i=Math.pow(t/(this.a*this.f0),r),s=Lp(this.e,i),s===-9999)return null}else s=-de;return n=Ce(f/this.ns+this.long0),e.x=n,e.y=s,e}var h0t=[\"Lambert Tangential Conformal Conic Projection\",\"Lambert_Conformal_Conic\",\"Lambert_Conformal_Conic_1SP\",\"Lambert_Conformal_Conic_2SP\",\"lcc\",\"Lambert Conic Conformal (1SP)\",\"Lambert Conic Conformal (2SP)\"],LY={init:l0t,forward:c0t,inverse:u0t,names:h0t};function f0t(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function d0t(e){var t,r,i,s,n,o,c,f=e.x,_=e.y,w=Ce(f-this.long0);return t=Math.pow((1+this.e*Math.sin(_))/(1-this.e*Math.sin(_)),this.alfa*this.e/2),r=2*(Math.atan(this.k*Math.pow(Math.tan(_/2+this.s45),this.alfa)/t)-this.s45),i=-w*this.alfa,s=Math.asin(Math.cos(this.ad)*Math.sin(r)+Math.sin(this.ad)*Math.cos(r)*Math.cos(i)),n=Math.asin(Math.cos(r)*Math.sin(i)/Math.cos(s)),o=this.n*n,c=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(s/2+this.s45),this.n),e.y=c*Math.cos(o)/1,e.x=c*Math.sin(o)/1,this.czech||(e.y*=-1,e.x*=-1),e}function p0t(e){var t,r,i,s,n,o,c,f,_=e.x;e.x=e.y,e.y=_,this.czech||(e.y*=-1,e.x*=-1),o=Math.sqrt(e.x*e.x+e.y*e.y),n=Math.atan2(e.y,e.x),s=n/Math.sin(this.s0),i=2*(Math.atan(Math.pow(this.ro0/o,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(i)-Math.sin(this.ad)*Math.cos(i)*Math.cos(s)),r=Math.asin(Math.cos(i)*Math.sin(s)/Math.cos(t)),e.x=this.long0-r/this.alfa,c=t,f=0;var w=0;do e.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(t/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(c))/(1-this.e*Math.sin(c)),this.e/2))-this.s45),Math.abs(c-e.y)<1e-10&&(f=1),c=e.y,w+=1;while(f===0&&w<15);return w>=15?null:e}var A0t=[\"Krovak\",\"krovak\"],kY={init:f0t,forward:d0t,inverse:p0t,names:A0t};function zo(e,t,r,i,s){return e*s-t*Math.sin(2*s)+r*Math.sin(4*s)-i*Math.sin(6*s)}function kp(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function Rp(e){return .375*e*(1+.25*e*(1+.46875*e))}function Dp(e){return .05859375*e*e*(1+.75*e)}function Op(e){return e*e*e*(35/3072)}function Bp(e,t,r){var i=t*r;return e/Math.sqrt(1-i*i)}function ff(e){return Math.abs(e)1e-7?(r=e*t,(1-e*e)*(t/(1-r*r)-.5/e*Math.log((1-r)/(1+r)))):2*t}var v0t=1,x0t=2,b0t=3,w0t=4;function S0t(){var e=Math.abs(this.lat0);if(Math.abs(e-de)0){var t;switch(this.qp=df(this.e,1),this.mmf=.5/(1-this.es),this.apa=R0t(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=df(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function T0t(e){var t,r,i,s,n,o,c,f,_,w,I=e.x,R=e.y;if(I=Ce(I-this.long0),this.sphere){if(n=Math.sin(R),w=Math.cos(R),i=Math.cos(I),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(r=this.mode===this.EQUIT?1+w*i:1+this.sinph0*n+this.cosph0*w*i,r<=Se)return null;r=Math.sqrt(2/r),t=r*w*Math.sin(I),r*=this.mode===this.EQUIT?n:this.cosph0*n-this.sinph0*w*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(R+this.lat0)=0?(t=(_=Math.sqrt(o))*s,r=i*(this.mode===this.S_POLE?_:-_)):t=r=0;break}}return e.x=this.a*t+this.x0,e.y=this.a*r+this.y0,e}function M0t(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,r=e.y/this.a,i,s,n,o,c,f,_;if(this.sphere){var w=0,I,R=0;if(I=Math.sqrt(t*t+r*r),s=I*.5,s>1)return null;switch(s=2*Math.asin(s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(R=Math.sin(s),w=Math.cos(s)),this.mode){case this.EQUIT:s=Math.abs(I)<=Se?0:Math.asin(r*R/I),t*=R,r=w*I;break;case this.OBLIQ:s=Math.abs(I)<=Se?this.lat0:Math.asin(w*this.sinph0+r*R*this.cosph0/I),t*=R*this.cosph0,r=(w-Math.sin(s)*this.sinph0)*I;break;case this.N_POLE:r=-r,s=de-s;break;case this.S_POLE:s-=de;break}i=r===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,r)}else{if(_=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,r*=this.dd,f=Math.sqrt(t*t+r*r),f1&&(e=e>1?1:-1),Math.asin(e)}function B0t(){Math.abs(this.lat1+this.lat2)Se?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function F0t(e){var t=e.x,r=e.y;this.sin_phi=Math.sin(r),this.cos_phi=Math.cos(r);var i=df(this.e3,this.sin_phi),s=this.a*Math.sqrt(this.c-this.ns0*i)/this.ns0,n=this.ns0*Ce(t-this.long0),o=s*Math.sin(n)+this.x0,c=this.rh-s*Math.cos(n)+this.y0;return e.x=o,e.y=c,e}function z0t(e){var t,r,i,s,n,o;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns0>=0?(t=Math.sqrt(e.x*e.x+e.y*e.y),i=1):(t=-Math.sqrt(e.x*e.x+e.y*e.y),i=-1),s=0,t!==0&&(s=Math.atan2(i*e.x,i*e.y)),i=t*this.ns0/this.a,this.sphere?o=Math.asin((this.c-i*i)/(2*this.ns0)):(r=(this.c-i*i)/this.ns0,o=this.phi1z(this.e3,r)),n=Ce(s/this.ns0+this.long0),e.x=n,e.y=o,e}function N0t(e,t){var r,i,s,n,o,c=Ec(.5*t);if(e0||Math.abs(o)<=Se?(c=this.x0+this.a*n*r*Math.sin(i)/o,f=this.y0+this.a*n*(this.cos_p14*t-this.sin_p14*r*s)/o):(c=this.x0+this.infinity_dist*r*Math.sin(i),f=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*r*s)),e.x=c,e.y=f,e}function G0t(e){var t,r,i,s,n,o;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=Math.sqrt(e.x*e.x+e.y*e.y))?(s=Math.atan2(t,this.rc),r=Math.sin(s),i=Math.cos(s),o=Ec(i*this.sin_p14+e.y*r*this.cos_p14/t),n=Math.atan2(e.x*r,t*this.cos_p14*i-e.y*this.sin_p14*r),n=Ce(this.long0+n)):(o=this.phic0,n=0),e.x=n,e.y=o,e}var W0t=[\"gnom\"],BY={init:V0t,forward:j0t,inverse:G0t,names:W0t};function FY(e,t){var r=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));if(Math.abs(Math.abs(t)-r)<1e-6)return t<0?-1*de:de;for(var i=Math.asin(.5*t),s,n,o,c,f=0;f<30;f++)if(n=Math.sin(i),o=Math.cos(i),c=e*n,s=Math.pow(1-c*c,2)/(2*o)*(t/(1-e*e)-n/(1-c*c)+.5/e*Math.log((1-c)/(1+c))),i+=s,Math.abs(s)<=1e-10)return i;return NaN}function H0t(){this.sphere||(this.k0=ol(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function q0t(e){var t=e.x,r=e.y,i,s,n=Ce(t-this.long0);if(this.sphere)i=this.x0+this.a*n*Math.cos(this.lat_ts),s=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var o=df(this.e,Math.sin(r));i=this.x0+this.a*this.k0*n,s=this.y0+this.a*o*.5/this.k0}return e.x=i,e.y=s,e}function Z0t(e){e.x-=this.x0,e.y-=this.y0;var t,r;return this.sphere?(t=Ce(this.long0+e.x/this.a/Math.cos(this.lat_ts)),r=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(r=FY(this.e,2*e.y*this.k0/this.a),t=Ce(this.long0+e.x/(this.a*this.k0))),e.x=t,e.y=r,e}var Y0t=[\"cea\"],zY={init:H0t,forward:q0t,inverse:Z0t,names:Y0t};function Q0t(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||\"Equidistant Cylindrical (Plate Carre)\",this.rc=Math.cos(this.lat_ts)}function $0t(e){var t=e.x,r=e.y,i=Ce(t-this.long0),s=ff(r-this.lat0);return e.x=this.x0+this.a*i*this.rc,e.y=this.y0+this.a*s,e}function X0t(e){var t=e.x,r=e.y;return e.x=Ce(this.long0+(t-this.x0)/(this.a*this.rc)),e.y=ff(this.lat0+(r-this.y0)/this.a),e}var K0t=[\"Equirectangular\",\"Equidistant_Cylindrical\",\"eqc\"],NY={init:Q0t,forward:$0t,inverse:X0t,names:K0t};var UY=20;function J0t(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=kp(this.es),this.e1=Rp(this.es),this.e2=Dp(this.es),this.e3=Op(this.es),this.ml0=this.a*zo(this.e0,this.e1,this.e2,this.e3,this.lat0)}function tgt(e){var t=e.x,r=e.y,i,s,n,o=Ce(t-this.long0);if(n=o*Math.sin(r),this.sphere)Math.abs(r)<=Se?(i=this.a*o,s=-1*this.a*this.lat0):(i=this.a*Math.sin(n)/Math.tan(r),s=this.a*(ff(r-this.lat0)+(1-Math.cos(n))/Math.tan(r)));else if(Math.abs(r)<=Se)i=this.a*o,s=-1*this.ml0;else{var c=Bp(this.a,this.e,Math.sin(r))/Math.tan(r);i=c*Math.sin(n),s=this.a*zo(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+c*(1-Math.cos(n))}return e.x=i+this.x0,e.y=s+this.y0,e}function egt(e){var t,r,i,s,n,o,c,f,_;if(i=e.x-this.x0,s=e.y-this.y0,this.sphere)if(Math.abs(s+this.a*this.lat0)<=Se)t=Ce(i/this.a+this.long0),r=0;else{o=this.lat0+s/this.a,c=i*i/this.a/this.a+o*o,f=o;var w;for(n=UY;n;--n)if(w=Math.tan(f),_=-1*(o*(f*w+1)-f-.5*(f*f+c)*w)/((f-o)/w-1),f+=_,Math.abs(_)<=Se){r=f;break}t=Ce(this.long0+Math.asin(i*Math.tan(f)/this.a)/Math.sin(r))}else if(Math.abs(s+this.ml0)<=Se)r=0,t=Ce(this.long0+i/this.a);else{o=(this.ml0+s)/this.a,c=i*i/this.a/this.a+o*o,f=o;var I,R,N,j,Q;for(n=UY;n;--n)if(Q=this.e*Math.sin(f),I=Math.sqrt(1-Q*Q)*Math.tan(f),R=this.a*zo(this.e0,this.e1,this.e2,this.e3,f),N=this.e0-2*this.e1*Math.cos(2*f)+4*this.e2*Math.cos(4*f)-6*this.e3*Math.cos(6*f),j=R/this.a,_=(o*(I*j+1)-j-.5*I*(j*j+c))/(this.es*Math.sin(2*f)*(j*j+c-2*o*j)/(4*I)+(o-j)*(I*N-2/Math.sin(2*f))-N),f-=_,Math.abs(_)<=Se){r=f;break}I=Math.sqrt(1-this.es*Math.pow(Math.sin(r),2))*Math.tan(r),t=Ce(this.long0+Math.asin(i*I/this.a)/Math.sin(r))}return e.x=t,e.y=r,e}var rgt=[\"Polyconic\",\"poly\"],VY={init:J0t,forward:tgt,inverse:egt,names:rgt};function igt(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function ngt(e){var t,r=e.x,i=e.y,s=i-this.lat0,n=r-this.long0,o=s/Yg*1e-5,c=n,f=1,_=0;for(t=1;t<=10;t++)f=f*o,_=_+this.A[t]*f;var w=_,I=c,R=1,N=0,j,Q,et=0,Y=0;for(t=1;t<=6;t++)j=R*w-N*I,Q=N*w+R*I,R=j,N=Q,et=et+this.B_re[t]*R-this.B_im[t]*N,Y=Y+this.B_im[t]*R+this.B_re[t]*N;return e.x=Y*this.a+this.x0,e.y=et*this.a+this.y0,e}function sgt(e){var t,r=e.x,i=e.y,s=r-this.x0,n=i-this.y0,o=n/this.a,c=s/this.a,f=1,_=0,w,I,R=0,N=0;for(t=1;t<=6;t++)w=f*o-_*c,I=_*o+f*c,f=w,_=I,R=R+this.C_re[t]*f-this.C_im[t]*_,N=N+this.C_im[t]*f+this.C_re[t]*_;for(var j=0;j.999999999999&&(r=.999999999999),t=Math.asin(r);var i=Ce(this.long0+e.x/(.900316316158*this.a*Math.cos(t)));i<-Math.PI&&(i=-Math.PI),i>Math.PI&&(i=Math.PI),r=(2*t+Math.sin(2*t))/Math.PI,Math.abs(r)>1&&(r=1);var s=Math.asin(r);return e.x=i,e.y=s,e}var ygt=[\"Mollweide\",\"moll\"],HY={init:mgt,forward:ggt,inverse:_gt,names:ygt};function vgt(){Math.abs(this.lat1+this.lat2)=0?(r=Math.sqrt(e.x*e.x+e.y*e.y),t=1):(r=-Math.sqrt(e.x*e.x+e.y*e.y),t=-1);var n=0;if(r!==0&&(n=Math.atan2(t*e.x,t*e.y)),this.sphere)return s=Ce(this.long0+n/this.ns),i=ff(this.g-r/this.a),e.x=s,e.y=i,e;var o=this.g-r/this.a;return i=Kg(o,this.e0,this.e1,this.e2,this.e3),s=Ce(this.long0+n/this.ns),e.x=s,e.y=i,e}var wgt=[\"Equidistant_Conic\",\"eqdc\"],qY={init:vgt,forward:xgt,inverse:bgt,names:wgt};function Sgt(){this.R=this.a}function Tgt(e){var t=e.x,r=e.y,i=Ce(t-this.long0),s,n;Math.abs(r)<=Se&&(s=this.x0+this.R*i,n=this.y0);var o=Ec(2*Math.abs(r/Math.PI));(Math.abs(i)<=Se||Math.abs(Math.abs(r)-de)<=Se)&&(s=this.x0,r>=0?n=this.y0+Math.PI*this.R*Math.tan(.5*o):n=this.y0+Math.PI*this.R*-Math.tan(.5*o));var c=.5*Math.abs(Math.PI/i-i/Math.PI),f=c*c,_=Math.sin(o),w=Math.cos(o),I=w/(_+w-1),R=I*I,N=I*(2/_-1),j=N*N,Q=Math.PI*this.R*(c*(I-j)+Math.sqrt(f*(I-j)*(I-j)-(j+f)*(R-j)))/(j+f);i<0&&(Q=-Q),s=this.x0+Q;var et=f+I;return Q=Math.PI*this.R*(N*et-c*Math.sqrt((j+f)*(f+1)-et*et))/(j+f),r>=0?n=this.y0+Q:n=this.y0-Q,e.x=s,e.y=n,e}function Mgt(e){var t,r,i,s,n,o,c,f,_,w,I,R,N;return e.x-=this.x0,e.y-=this.y0,I=Math.PI*this.R,i=e.x/I,s=e.y/I,n=i*i+s*s,o=-Math.abs(s)*(1+n),c=o-2*s*s+i*i,f=-2*o+1+2*s*s+n*n,N=s*s/f+(2*c*c*c/f/f/f-9*o*c/f/f)/27,_=(o-c*c/3/f)/f,w=2*Math.sqrt(-_/3),I=3*N/_/w,Math.abs(I)>1&&(I>=0?I=1:I=-1),R=Math.acos(I)/3,e.y>=0?r=(-w*Math.cos(R+Math.PI/3)-c/3/f)*Math.PI:r=-(-w*Math.cos(R+Math.PI/3)-c/3/f)*Math.PI,Math.abs(i)2*de*this.a?void 0:(r=t/this.a,i=Math.sin(r),s=Math.cos(r),n=this.long0,Math.abs(t)<=Se?o=this.lat0:(o=Ec(s*this.sin_p12+e.y*i*this.cos_p12/t),c=Math.abs(this.lat0)-de,Math.abs(c)<=Se?this.lat0>=0?n=Ce(this.long0+Math.atan2(e.x,-e.y)):n=Ce(this.long0-Math.atan2(-e.x,e.y)):n=Ce(this.long0+Math.atan2(e.x*i,t*this.cos_p12*s-e.y*this.sin_p12*i))),e.x=n,e.y=o,e)):(f=kp(this.es),_=Rp(this.es),w=Dp(this.es),I=Op(this.es),Math.abs(this.sin_p12-1)<=Se?(R=this.a*zo(f,_,w,I,de),t=Math.sqrt(e.x*e.x+e.y*e.y),N=R-t,o=Kg(N/this.a,f,_,w,I),n=Ce(this.long0+Math.atan2(e.x,-1*e.y)),e.x=n,e.y=o,e):Math.abs(this.sin_p12+1)<=Se?(R=this.a*zo(f,_,w,I,de),t=Math.sqrt(e.x*e.x+e.y*e.y),N=t-R,o=Kg(N/this.a,f,_,w,I),n=Ce(this.long0+Math.atan2(e.x,e.y)),e.x=n,e.y=o,e):(t=Math.sqrt(e.x*e.x+e.y*e.y),et=Math.atan2(e.x,e.y),j=Bp(this.a,this.e,this.sin_p12),Y=Math.cos(et),K=this.e*this.cos_p12*Y,J=-K*K/(1-this.es),ut=3*this.es*(1-J)*this.sin_p12*this.cos_p12*Y/(1-this.es),Et=t/j,kt=Et-J*(1+J)*Math.pow(Et,3)/6-ut*(1+3*J)*Math.pow(Et,4)/24,Xt=1-J*kt*kt/2-Et*kt*kt*kt/6,Q=Math.asin(this.sin_p12*Math.cos(kt)+this.cos_p12*Math.sin(kt)*Y),n=Ce(this.long0+Math.asin(Math.sin(et)*Math.sin(kt)/Math.cos(Q))),qt=Math.sin(Q),o=Math.atan2((qt-this.es*Xt*this.sin_p12)*Math.tan(Q),qt*(1-this.es)),e.x=n,e.y=o,e))}var Lgt=[\"Azimuthal_Equidistant\",\"aeqd\"],YY={init:Pgt,forward:Igt,inverse:Cgt,names:Lgt};function kgt(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function Rgt(e){var t,r,i,s,n,o,c,f,_=e.x,w=e.y;return i=Ce(_-this.long0),t=Math.sin(w),r=Math.cos(w),s=Math.cos(i),o=this.sin_p14*t+this.cos_p14*r*s,n=1,(o>0||Math.abs(o)<=Se)&&(c=this.a*n*r*Math.sin(i),f=this.y0+this.a*n*(this.cos_p14*t-this.sin_p14*r*s)),e.x=c,e.y=f,e}function Dgt(e){var t,r,i,s,n,o,c;return e.x-=this.x0,e.y-=this.y0,t=Math.sqrt(e.x*e.x+e.y*e.y),r=Ec(t/this.a),i=Math.sin(r),s=Math.cos(r),o=this.long0,Math.abs(t)<=Se?(c=this.lat0,e.x=o,e.y=c,e):(c=Ec(s*this.sin_p14+e.y*i*this.cos_p14/t),n=Math.abs(this.lat0)-de,Math.abs(n)<=Se?(this.lat0>=0?o=Ce(this.long0+Math.atan2(e.x,-e.y)):o=Ce(this.long0-Math.atan2(-e.x,e.y)),e.x=o,e.y=c,e):(o=Ce(this.long0+Math.atan2(e.x*i,t*this.cos_p14*s-e.y*this.sin_p14*i)),e.x=o,e.y=c,e))}var Ogt=[\"ortho\"],QY={init:kgt,forward:Rgt,inverse:Dgt,names:Ogt};var bs={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},An={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Bgt(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||\"Quadrilateralized Spherical Cube\",this.lat0>=de-Ui/2?this.face=bs.TOP:this.lat0<=-(de-Ui/2)?this.face=bs.BOTTOM:Math.abs(this.long0)<=Ui?this.face=bs.FRONT:Math.abs(this.long0)<=de+Ui?this.face=this.long0>0?bs.RIGHT:bs.LEFT:this.face=bs.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function Fgt(e){var t={x:0,y:0},r,i,s,n,o,c,f={value:0};if(e.x-=this.long0,this.es!==0?r=Math.atan(this.one_minus_f_squared*Math.tan(e.y)):r=e.y,i=e.x,this.face===bs.TOP)n=de-r,i>=Ui&&i<=de+Ui?(f.value=An.AREA_0,s=i-de):i>de+Ui||i<=-(de+Ui)?(f.value=An.AREA_1,s=i>0?i-xs:i+xs):i>-(de+Ui)&&i<=-Ui?(f.value=An.AREA_2,s=i+de):(f.value=An.AREA_3,s=i);else if(this.face===bs.BOTTOM)n=de+r,i>=Ui&&i<=de+Ui?(f.value=An.AREA_0,s=-i+de):i=-Ui?(f.value=An.AREA_1,s=-i):i<-Ui&&i>=-(de+Ui)?(f.value=An.AREA_2,s=-i-de):(f.value=An.AREA_3,s=i>0?-i+xs:-i-xs);else{var _,w,I,R,N,j,Q;this.face===bs.RIGHT?i=Ax(i,+de):this.face===bs.BACK?i=Ax(i,+xs):this.face===bs.LEFT&&(i=Ax(i,-de)),R=Math.sin(r),N=Math.cos(r),j=Math.sin(i),Q=Math.cos(i),_=N*Q,w=N*j,I=R,this.face===bs.FRONT?(n=Math.acos(_),s=gI(n,I,w,f)):this.face===bs.RIGHT?(n=Math.acos(w),s=gI(n,I,-_,f)):this.face===bs.BACK?(n=Math.acos(-_),s=gI(n,I,-w,f)):this.face===bs.LEFT?(n=Math.acos(-w),s=gI(n,I,_,f)):(n=s=0,f.value=An.AREA_0)}return c=Math.atan(12/xs*(s+Math.acos(Math.sin(s)*Math.cos(Ui))-de)),o=Math.sqrt((1-Math.cos(n))/(Math.cos(c)*Math.cos(c))/(1-Math.cos(Math.atan(1/Math.cos(s))))),f.value===An.AREA_1?c+=de:f.value===An.AREA_2?c+=xs:f.value===An.AREA_3&&(c+=1.5*xs),t.x=o*Math.cos(c),t.y=o*Math.sin(c),t.x=t.x*this.a+this.x0,t.y=t.y*this.a+this.y0,e.x=t.x,e.y=t.y,e}function zgt(e){var t={lam:0,phi:0},r,i,s,n,o,c,f,_,w,I={value:0};if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,i=Math.atan(Math.sqrt(e.x*e.x+e.y*e.y)),r=Math.atan2(e.y,e.x),e.x>=0&&e.x>=Math.abs(e.y)?I.value=An.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(I.value=An.AREA_1,r-=de):e.x<0&&-e.x>=Math.abs(e.y)?(I.value=An.AREA_2,r=r<0?r+xs:r-xs):(I.value=An.AREA_3,r+=de),w=xs/12*Math.tan(r),o=Math.sin(w)/(Math.cos(w)-1/Math.sqrt(2)),c=Math.atan(o),s=Math.cos(r),n=Math.tan(i),f=1-s*s*n*n*(1-Math.cos(Math.atan(1/Math.cos(c)))),f<-1?f=-1:f>1&&(f=1),this.face===bs.TOP)_=Math.acos(f),t.phi=de-_,I.value===An.AREA_0?t.lam=c+de:I.value===An.AREA_1?t.lam=c<0?c+xs:c-xs:I.value===An.AREA_2?t.lam=c-de:t.lam=c;else if(this.face===bs.BOTTOM)_=Math.acos(f),t.phi=_-de,I.value===An.AREA_0?t.lam=-c+de:I.value===An.AREA_1?t.lam=-c:I.value===An.AREA_2?t.lam=-c-de:t.lam=c<0?-c-xs:-c+xs;else{var R,N,j;R=f,w=R*R,w>=1?j=0:j=Math.sqrt(1-w)*Math.sin(c),w+=j*j,w>=1?N=0:N=Math.sqrt(1-w),I.value===An.AREA_1?(w=N,N=-j,j=w):I.value===An.AREA_2?(N=-N,j=-j):I.value===An.AREA_3&&(w=N,N=j,j=-w),this.face===bs.RIGHT?(w=R,R=-N,N=w):this.face===bs.BACK?(R=-R,N=-N):this.face===bs.LEFT&&(w=R,R=N,N=-w),t.phi=Math.acos(-j)-de,t.lam=Math.atan2(N,R),this.face===bs.RIGHT?t.lam=Ax(t.lam,-de):this.face===bs.BACK?t.lam=Ax(t.lam,-xs):this.face===bs.LEFT&&(t.lam=Ax(t.lam,+de))}if(this.es!==0){var Q,et,Y;Q=t.phi<0?1:0,et=Math.tan(t.phi),Y=this.b/Math.sqrt(et*et+this.one_minus_f_squared),t.phi=Math.atan(Math.sqrt(this.a*this.a-Y*Y)/(this.one_minus_f*Y)),Q&&(t.phi=-t.phi)}return t.lam+=this.long0,e.x=t.lam,e.y=t.phi,e}function gI(e,t,r,i){var s;return eUi&&s<=de+Ui?(i.value=An.AREA_1,s-=de):s>de+Ui||s<=-(de+Ui)?(i.value=An.AREA_2,s=s>=0?s-xs:s+xs):(i.value=An.AREA_3,s+=de)),s}function Ax(e,t){var r=e+t;return r<-xs?r+=Em:r>+xs&&(r-=Em),r}var Ngt=[\"Quadrilateralized Spherical Cube\",\"Quadrilateralized_Spherical_Cube\",\"qsc\"],$Y={init:Bgt,forward:Fgt,inverse:zgt,names:Ngt};var DB=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],gS=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],XY=.8487,KY=1.3523,JY=Sc/5,Ugt=1/JY,mx=18,_I=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},Vgt=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function jgt(e,t,r,i){for(var s=t;i;--i){var n=e(s);if(s-=n,Math.abs(n)=mx&&(i=mx-1),r=Sc*(r-Ugt*i);var s={x:_I(DB[i],r)*t,y:_I(gS[i],r)};return e.y<0&&(s.y=-s.y),s.x=s.x*this.a*XY+this.x0,s.y=s.y*this.a*KY+this.y0,s}function Hgt(e){var t={x:(e.x-this.x0)/(this.a*XY),y:Math.abs(e.y-this.y0)/(this.a*KY)};if(t.y>=1)t.x/=DB[mx][0],t.y=e.y<0?-de:de;else{var r=Math.floor(t.y*mx);for(r<0?r=0:r>=mx&&(r=mx-1);;)if(gS[r][0]>t.y)--r;else if(gS[r+1][0]<=t.y)++r;else break;var i=gS[r],s=5*(t.y-i[0])/(gS[r+1][0]-i[0]);s=jgt(function(n){return(_I(i,n)-t.y)/Vgt(i,n)},s,Se,100),t.x/=_I(DB[r],s),t.y=(5*r+s)*vs,e.y<0&&(t.y=-t.y)}return t.x=Ce(t.x+this.long0),t}var qgt=[\"Robinson\",\"robin\"],tQ={init:Ggt,forward:Wgt,inverse:Hgt,names:qgt};function Zgt(){this.name=\"geocent\"}function Ygt(e){var t=aI(e,this.es,this.a);return t}function Qgt(e){var t=lI(e,this.es,this.a,this.b);return t}var $gt=[\"Geocentric\",\"geocentric\",\"geocent\",\"Geocent\"],eQ={init:Zgt,forward:Ygt,inverse:Qgt,names:$gt};var al={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},_S={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function Xgt(){if(Object.keys(_S).forEach(function(r){if(typeof this[r]>\"u\")this[r]=_S[r].def;else{if(_S[r].num&&isNaN(this[r]))throw new Error(\"Invalid parameter value, must be numeric \"+r+\" = \"+this[r]);_S[r].num&&(this[r]=parseFloat(this[r]))}_S[r].degrees&&(this[r]=this[r]*vs)}.bind(this)),Math.abs(Math.abs(this.lat0)-de)1e10)throw new Error(\"Invalid height\");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var e=this.tilt,t=this.azi;this.cg=Math.cos(t),this.sg=Math.sin(t),this.cw=Math.cos(e),this.sw=Math.sin(e)}function Kgt(e){e.x-=this.long0;var t=Math.sin(e.y),r=Math.cos(e.y),i=Math.cos(e.x),s,n;switch(this.mode){case al.OBLIQ:n=this.sinph0*t+this.cosph0*r*i;break;case al.EQUIT:n=r*i;break;case al.S_POLE:n=-t;break;case al.N_POLE:n=t;break}switch(n=this.pn1/(this.p-n),s=n*r*Math.sin(e.x),this.mode){case al.OBLIQ:n*=this.cosph0*t-this.sinph0*r*i;break;case al.EQUIT:n*=t;break;case al.N_POLE:n*=-(r*i);break;case al.S_POLE:n*=r*i;break}var o,c;return o=n*this.cg+s*this.sg,c=1/(o*this.sw*this.h1+this.cw),s=(s*this.cg-n*this.sg)*this.cw*c,n=o*c,e.x=s*this.a,e.y=n*this.a,e}function Jgt(e){e.x/=this.a,e.y/=this.a;var t={x:e.x,y:e.y},r,i,s;s=1/(this.pn1-e.y*this.sw),r=this.pn1*e.x*s,i=this.pn1*e.y*this.cw*s,e.x=r*this.cg+i*this.sg,e.y=i*this.cg-r*this.sg;var n=Ta(e.x,e.y);if(Math.abs(n)1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var e=1-this.es,t=1/e;this.radius_p=Math.sqrt(e),this.radius_p2=e,this.radius_p_inv2=t,this.shape=\"ellipse\"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape=\"sphere\";this.title||(this.title=\"Geostationary Satellite View\")}function r_t(e){var t=e.x,r=e.y,i,s,n,o;if(t=t-this.long0,this.shape===\"ellipse\"){r=Math.atan(this.radius_p2*Math.tan(r));var c=this.radius_p/Ta(this.radius_p*Math.cos(r),Math.sin(r));if(s=c*Math.cos(t)*Math.cos(r),n=c*Math.sin(t)*Math.cos(r),o=c*Math.sin(r),(this.radius_g-s)*s-n*n-o*o*this.radius_p_inv2<0)return e.x=Number.NaN,e.y=Number.NaN,e;i=this.radius_g-s,this.flip_axis?(e.x=this.radius_g_1*Math.atan(n/Ta(o,i)),e.y=this.radius_g_1*Math.atan(o/i)):(e.x=this.radius_g_1*Math.atan(n/i),e.y=this.radius_g_1*Math.atan(o/Ta(n,i)))}else this.shape===\"sphere\"&&(i=Math.cos(r),s=Math.cos(t)*i,n=Math.sin(t)*i,o=Math.sin(r),i=this.radius_g-s,this.flip_axis?(e.x=this.radius_g_1*Math.atan(n/Ta(o,i)),e.y=this.radius_g_1*Math.atan(o/i)):(e.x=this.radius_g_1*Math.atan(n/i),e.y=this.radius_g_1*Math.atan(o/Ta(n,i))));return e.x=e.x*this.a,e.y=e.y*this.a,e}function i_t(e){var t=-1,r=0,i=0,s,n,o,c;if(e.x=e.x/this.a,e.y=e.y/this.a,this.shape===\"ellipse\"){this.flip_axis?(i=Math.tan(e.y/this.radius_g_1),r=Math.tan(e.x/this.radius_g_1)*Ta(1,i)):(r=Math.tan(e.x/this.radius_g_1),i=Math.tan(e.y/this.radius_g_1)*Ta(1,r));var f=i/this.radius_p;if(s=r*r+f*f+t*t,n=2*this.radius_g*t,o=n*n-4*s*this.C,o<0)return e.x=Number.NaN,e.y=Number.NaN,e;c=(-n-Math.sqrt(o))/(2*s),t=this.radius_g+c*t,r*=c,i*=c,e.x=Math.atan2(r,t),e.y=Math.atan(i*Math.cos(e.x)/t),e.y=Math.atan(this.radius_p_inv2*Math.tan(e.y))}else if(this.shape===\"sphere\"){if(this.flip_axis?(i=Math.tan(e.y/this.radius_g_1),r=Math.tan(e.x/this.radius_g_1)*Math.sqrt(1+i*i)):(r=Math.tan(e.x/this.radius_g_1),i=Math.tan(e.y/this.radius_g_1)*Math.sqrt(1+r*r)),s=r*r+i*i+t*t,n=2*this.radius_g*t,o=n*n-4*s*this.C,o<0)return e.x=Number.NaN,e.y=Number.NaN,e;c=(-n-Math.sqrt(o))/(2*s),t=this.radius_g+c*t,r*=c,i*=c,e.x=Math.atan2(r,t),e.y=Math.atan(i*Math.cos(e.x)/t)}return e.x=e.x+this.long0,e}var n_t=[\"Geostationary Satellite View\",\"Geostationary_Satellite\",\"geos\"],iQ={init:e_t,forward:r_t,inverse:i_t,names:n_t};function nQ(e){e.Proj.projections.add(fx),e.Proj.projections.add(dx),e.Proj.projections.add(MY),e.Proj.projections.add(EY),e.Proj.projections.add(PY),e.Proj.projections.add(IY),e.Proj.projections.add(CY),e.Proj.projections.add(LY),e.Proj.projections.add(kY),e.Proj.projections.add(RY),e.Proj.projections.add(DY),e.Proj.projections.add(OY),e.Proj.projections.add(BY),e.Proj.projections.add(zY),e.Proj.projections.add(NY),e.Proj.projections.add(VY),e.Proj.projections.add(jY),e.Proj.projections.add(GY),e.Proj.projections.add(WY),e.Proj.projections.add(HY),e.Proj.projections.add(qY),e.Proj.projections.add(ZY),e.Proj.projections.add(YY),e.Proj.projections.add(QY),e.Proj.projections.add($Y),e.Proj.projections.add(tQ),e.Proj.projections.add(eQ),e.Proj.projections.add(rQ),e.Proj.projections.add(iQ)}Tc.defaultDatum=\"WGS84\";Tc.Proj=Pm;Tc.WGS84=new Tc.Proj(\"WGS84\");Tc.Point=gY;Tc.toPoint=uI;Tc.defs=ax;Tc.nadgrid=MB;Tc.transform=$g;Tc.mgrs=pY;Tc.version=\"__VERSION__\";nQ(Tc);var sQ=Tc;function xS(e){return\"data\"in e?e.getChildAt(0):e.children[0]}function bS(e){return\"data\"in e?e.getChildAt(0):e.children[0]}function gx(e){return\"data\"in e?e.getChildAt(0):e.children[0]}function s_t(e){return\"data\"in e?e.getChildAt(0):e.children[0]}function o_t(e){return\"data\"in e?e.getChildAt(0):e.children[0]}function wI(e){return\"data\"in e?e.getChildAt(0):e.children[0]}var vi=Object.freeze({__proto__:null,getLineStringChild:bS,getMultiLineStringChild:o_t,getMultiPointChild:s_t,getMultiPolygonChild:wI,getPointChild:xS,getPolygonChild:gx});function SI(e,t){let r=e.valueOffsets,i=gx(e),s=i.valueOffsets,n=bS(i),o=n.type.listSize,c=xS(n),f=r[t],_=r[t+1],w=s[f],I=s[_],R=c.values.subarray(w*o,I*o);return new sx(R,{size:o,isClosed:!0})}function aQ(e){if(\"data\"in e)return new xr(e.data.map(r=>aQ(r)));let t=new Float64Array(e.length);for(let r=0;rlQ(r)));let t=new Float64Array(e.length);for(let r=0;rcQ(n));let t=[],r=0;for(let n=0;nuQ(t))):gx(e)}function hQ(e){return\"data\"in e?new xr(e.data.map(t=>hQ(t))):wI(e)}function TI(e){return ze.isFixedSizeList(e)?!(![2,3,4].includes(e.listSize)||!ze.isFloat(e.children[0])):ze.isStruct(e)?!(![2,3,4].includes(e.children.length)||!e.children.every(t=>[\"x\",\"y\",\"z\",\"m\"].includes(t.name))||!e.children.every(t=>ze.isFloat(t))):!1}function MI(e){return!(!ze.isList(e)||!TI(e.children[0].type))}function zB(e){return!(!ze.isList(e)||!MI(e.children[0].type))}function fQ(e){return!(!ze.isList(e)||!TI(e.children[0].type))}function dQ(e){return!(!ze.isList(e)||!MI(e.children[0].type))}function pQ(e){return!(!ze.isList(e)||!zB(e.children[0].type))}function l_t(e){return TI(e.type)}function c_t(e){return MI(e.type)}function u_t(e){return zB(e.type)}function h_t(e){return fQ(e.type)}function f_t(e){return dQ(e.type)}function d_t(e){return pQ(e.type)}function p_t(e,t){if(!e)throw new Error(`assertion failed ${t}`)}function A_t(){throw new Error(\"assertion failed\")}function AQ(e,t){if(l_t(e))return mQ(e,t);if(c_t(e))return OB(e,t);if(u_t(e))return BB(e,t);if(h_t(e))return OB(e,t);if(f_t(e))return BB(e,t);if(d_t(e))return m_t(e,t);A_t()}function mQ(e,t){p_t(e.type.listSize===2,\"expected 2D\");let r=xS(e),i=r.values,s=new Float64Array(i.length);for(let o=0;ooQ(s,i))):oQ(e,i)}function oQ(e,t){let r=[0,0];return AQ(e,(s,n)=>(r[0]=s,r[1]=n,t.forward(r)))}var Im;(function(e){e.POINT=\"geoarrow.point\",e.LINESTRING=\"geoarrow.linestring\",e.POLYGON=\"geoarrow.polygon\",e.MULTIPOINT=\"geoarrow.multipoint\",e.MULTILINESTRING=\"geoarrow.multilinestring\",e.MULTIPOLYGON=\"geoarrow.multipolygon\"})(Im||(Im={}));var bI=class{minX;minY;maxX;maxY;constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}updateBbox(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.maxY>this.maxY&&(this.maxY=t.maxY)}updateCoord(t,r){tthis.maxX&&(this.maxX=t),r>this.maxY&&(this.maxY=r)}};function __t(e,t){switch(t.metadata.get(\"ARROW:extension:name\")){case Im.POINT:return gQ(e);case Im.LINESTRING:case Im.MULTIPOINT:return _Q(e);case Im.POLYGON:case Im.MULTILINESTRING:return yQ(e);case Im.MULTIPOLYGON:return v_t(e);default:throw new Error(\"Unknown ext type name\")}}function y_t(e){let r=xS(e).values,i=new bI;for(let s=0;svQ(r)));let t=new mm({type:new dc,nullValues:[null]});t.set(e.length-1,null);for(let r=0;rxQ(r,t));return}for(let r=0;rvS(n,t)));let r=[];for(let n of e.children)r.push(vS(n,t));let i;e.dictionary!==void 0&&(i=vS(e.dictionary,t));let s={[Oi.OFFSET]:yI(e.buffers[Oi.OFFSET],t),[Oi.DATA]:yI(e.buffers[Oi.DATA],t),[Oi.VALIDITY]:yI(e.buffers[Oi.VALIDITY],t),[Oi.TYPE]:yI(e.buffers[Oi.TYPE],t)};return new Fi(e.type,e.offset,e.length,e._nullCount,s,r,i)}function vI(e){if(\"data\"in e)return e.data.some(r=>vI(r));for(let r of e.children)if(vI(r))return!0;if(e.dictionary!==void 0&&vI(e.dictionary))return!0;let t=[Oi.OFFSET,Oi.DATA,Oi.VALIDITY,Oi.TYPE];for(let r of t)if(e.buffers[r]!==void 0&&bQ(e.buffers[r]))return!0;return!1}function bQ(e){return!(e.byteOffset===0&&e.byteLength===e.buffer.byteLength)}function yI(e,t){return e===void 0||!t&&!bQ(e)?e:e.slice()}function xI(e,t=!1){if(\"data\"in e){let i=[],s=[];for(let o of e.data){let[c,f]=xI(o);i.push(c),s.push(...f)}return[new xr(i),s]}e=vS(e,t);let r=[];for(let i=0;i1)throw new Error(\"expected 1 field\");return new sl(t[0])}case Ot.Struct:{let t=e.children.map(yS);return new pn(t)}case Ot.Union:{let t=e.children.map(yS);return new pc(e.mode,e.typeIds,t)}case Ot.FixedSizeBinary:return new Qu(e.byteWidth);case Ot.FixedSizeList:{let t=e.children.map(yS);if(t.length>1)throw new Error(\"expected 1 field\");return new Ll(e.listSize,t[0])}case Ot.Map:{let t=e.children.map(yS);if(t.length>1)throw new Error(\"expected 1 field\");let r=t[0];return new Ac(r,e.keysSorted)}case Ot.Duration:return new Yu(e.unit);default:throw new Error(`unknown type ${e}`)}}function yS(e){let t=wQ(e.type);return new si(e.name,t,e.nullable,e.metadata)}function UB(e){let t=e.children.map(s=>UB(s)),r=e.dictionary?SQ(e.dictionary):void 0,i={[Oi.OFFSET]:e.valueOffsets,[Oi.DATA]:e.values,[Oi.VALIDITY]:e.nullBitmap,[Oi.TYPE]:e.typeIds};return new Fi(wQ(e.type),e.offset,e.length,e._nullCount,i,t,r)}function SQ(e){return new xr(e.data.map(t=>UB(t)))}var VB=Object.freeze({__proto__:null,hardClone:vS,isShared:vI,preparePostMessage:xI,rehydrateData:UB,rehydrateVector:SQ});function E_t(e,t,r){let i=e.fields.findIndex(s=>s.name===r||s.metadata.get(\"ARROW:extension:name\")===t);return i!==-1?i:null}function P_t(e,t){let{index:r,data:i}=e,s=r;i.invertedGeomOffsets!==void 0&&(s=i.invertedGeomOffsets[r]);let n={data:i.data,length:i.length,attributes:i.attributes},o={index:s,data:n,target:e.target};return t(o)}function ro(e){let{props:t,propName:r,propInput:i,chunkIdx:s,geomCoordOffsets:n}=e;if(i!==void 0)if(i instanceof xr){let o=i.data[s];if(ze.isFixedSizeList(o)){_r(o.children.length===1);let c=o.children[0].values;n&&(c=EI(c,o.type.listSize,n)),t.data.attributes[r]={value:c,size:o.type.listSize,normalized:!0}}else if(ze.isFloat(o)){let c=o.values;n&&(c=EI(c,1,n)),t.data.attributes[r]={value:c,size:1}}}else typeof i==\"function\"?t[r]=(o,c)=>r===\"getPolygonOffset\"?i(o,c):P_t(c,i):t[r]=i}function EI(e,t,r){let i=r[r.length-1],s=new e.constructor(i*t);for(let n=0;n(t[i+1]=t[i]+r.length,t),new Uint32Array(e.length+1))}function no(e,t){let r=[],i=[];for(let[s,n]of Object.entries(e))s.startsWith(\"get\")&&n instanceof xr&&(r.push(n),s.endsWith(\"Color\")&&i.push(n));I_t(t,r);for(let s of i)C_t(s)}function I_t(e,t){for(let r of t)_r(e.batches.length===r.data.length);for(let r of t)for(let i=0;ithis.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return!!this._loader&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error(\"byteLength not defined in tile data\"),t}async _loadData({getData:t,requestScheduler:r,onLoad:i,onError:s}){let{index:n,id:o,bbox:c,userData:f,zoom:_}=this,w=this._loaderId;this._abortController=new AbortController;let{signal:I}=this._abortController,R=await r.scheduleRequest(this,Q=>Q.isSelected?1:-1);if(!R){this._isCancelled=!0;return}if(this._isCancelled){R.done();return}let N=null,j;try{N=await t({index:n,id:o,bbox:c,userData:f,zoom:_,signal:I})}catch(Q){j=Q||!0}finally{R.done()}if(w===this._loaderId){if(this._loader=void 0,this.content=N,this._isCancelled&&!N){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,j?s(j,this):i(this)}}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){var t;this.isLoaded||(this._isCancelled=!0,(t=this._abortController)===null||t===void 0||t.abort())}};var so={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var IQ=new Ve,O_t=new Ve,Jg=class e{constructor(t=[0,0,0],r=[0,0,0],i){G(this,\"center\",void 0),G(this,\"halfDiagonal\",void 0),G(this,\"minimum\",void 0),G(this,\"maximum\",void 0),i=i||IQ.copy(t).add(r).scale(.5),this.center=new Ve(i),this.halfDiagonal=new Ve(r).subtract(this.center),this.minimum=new Ve(t),this.maximum=new Ve(r)}clone(){return new e(this.minimum,this.maximum,this.center)}equals(t){return this===t||!!t&&this.minimum.equals(t.minimum)&&this.maximum.equals(t.maximum)}transform(t){return this.center.transformAsPoint(t),this.halfDiagonal.transform(t),this.minimum.transform(t),this.maximum.transform(t),this}intersectPlane(t){let{halfDiagonal:r}=this,i=O_t.from(t.normal),s=r.x*Math.abs(i.x)+r.y*Math.abs(i.y)+r.z*Math.abs(i.z),n=this.center.dot(i)+t.distance;return n-s>0?so.INSIDE:n+s<0?so.OUTSIDE:so.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=IQ.from(t).subtract(this.center),{halfDiagonal:i}=this,s=0,n;return n=Math.abs(r.x)-i.x,n>0&&(s+=n*n),n=Math.abs(r.y)-i.y,n>0&&(s+=n*n),n=Math.abs(r.z)-i.z,n>0&&(s+=n*n),s}};var TS=new Ve,CQ=new Ve,t_=class e{constructor(t=[0,0,0],r=0){G(this,\"center\",void 0),G(this,\"radius\",void 0),this.radius=-0,this.center=new Ve,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=TS.from(r),this.center=new Ve().from(t).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new e(this.center,this.radius)}union(t){let r=this.center,i=this.radius,s=t.center,n=t.radius,o=TS.copy(s).subtract(r),c=o.magnitude();if(i>=c+n)return this.clone();if(n>=c+i)return t.clone();let f=(i+c+n)*.5;return CQ.copy(o).scale((-i+f)/c).add(r),this.center.copy(CQ),this.radius=f,this}expand(t){let i=TS.from(t).subtract(this.center).magnitude();return i>this.radius&&(this.radius=i),this}transform(t){this.center.transform(t);let r=c7(TS,t);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(t){let r=this.distanceTo(t);return r*r}distanceTo(t){let i=TS.from(t).subtract(this.center);return Math.max(0,i.len()-this.radius)}intersectPlane(t){let r=this.center,i=this.radius,n=t.normal.dot(r)+t.distance;return n<-i?so.OUTSIDE:n=f?so.INSIDE:so.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=F_t.from(t).subtract(this.center),i=this.halfAxes,s=i.getColumn(0,II),n=i.getColumn(1,CI),o=i.getColumn(2,LI),c=s.magnitude(),f=n.magnitude(),_=o.magnitude();s.normalize(),n.normalize(),o.normalize();let w=0,I;return I=Math.abs(r.dot(s))-c,I>0&&(w+=I*I),I=Math.abs(r.dot(n))-f,I>0&&(w+=I*I),I=Math.abs(r.dot(o))-_,I>0&&(w+=I*I),w}computePlaneDistances(t,r,i=[-0,-0]){let s=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,o=this.center,c=this.halfAxes,f=c.getColumn(0,II),_=c.getColumn(1,CI),w=c.getColumn(2,LI),I=z_t.copy(f).add(_).add(w).add(o),R=N_t.copy(I).subtract(t),N=r.dot(R);return s=Math.min(N,s),n=Math.max(N,n),I.copy(o).add(f).add(_).subtract(w),R.copy(I).subtract(t),N=r.dot(R),s=Math.min(N,s),n=Math.max(N,n),I.copy(o).add(f).subtract(_).add(w),R.copy(I).subtract(t),N=r.dot(R),s=Math.min(N,s),n=Math.max(N,n),I.copy(o).add(f).subtract(_).subtract(w),R.copy(I).subtract(t),N=r.dot(R),s=Math.min(N,s),n=Math.max(N,n),o.copy(I).subtract(f).add(_).add(w),R.copy(I).subtract(t),N=r.dot(R),s=Math.min(N,s),n=Math.max(N,n),o.copy(I).subtract(f).add(_).subtract(w),R.copy(I).subtract(t),N=r.dot(R),s=Math.min(N,s),n=Math.max(N,n),o.copy(I).subtract(f).subtract(_).add(w),R.copy(I).subtract(t),N=r.dot(R),s=Math.min(N,s),n=Math.max(N,n),o.copy(I).subtract(f).subtract(_).subtract(w),R.copy(I).subtract(t),N=r.dot(R),s=Math.min(N,s),n=Math.max(N,n),i[0]=s,i[1]=n,i}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,II);r.transformAsPoint(t);let i=this.halfAxes.getColumn(1,CI);i.transformAsPoint(t);let s=this.halfAxes.getColumn(2,LI);return s.transformAsPoint(t),this.halfAxes=new ss([...r,...i,...s]),this}getTransform(){throw new Error(\"not implemented\")}};var LQ=new Ve,kQ=new Ve,Af=class e{constructor(t=[0,0,1],r=0){G(this,\"normal\",void 0),G(this,\"distance\",void 0),this.normal=new Ve,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return Bh(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=LQ.from(t),this.normal.from(r).normalize();let i=-this.normal.dot(t);return this.distance=i,this}fromCoefficients(t,r,i,s){return this.normal.set(t,r,i),Bh(Ro(this.normal.len(),1)),this.distance=s,this}clone(){return new e(this.normal,this.distance)}equals(t){return Ro(this.distance,t.distance)&&Ro(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=kQ.copy(this.normal).transformAsVector(t).normalize(),i=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(i,r)}projectPointOntoPlane(t,r=[0,0,0]){t=LQ.from(t);let i=this.getPointDistance(t),s=kQ.copy(this.normal).scale(i);return t.subtract(s).to(r)}};var RQ=[new Ve([1,0,0]),new Ve([0,1,0]),new Ve([0,0,1])],DQ=new Ve,U_t=new Ve,Rse=new Af(new Ve(1,0,0),0),Ad=class e{constructor(t=[]){G(this,\"planes\",void 0),this.planes=t}fromBoundingSphere(t){this.planes.length=2*RQ.length;let r=t.center,i=t.radius,s=0;for(let n of RQ){let o=this.planes[s],c=this.planes[s+1];o||(o=this.planes[s]=new Af),c||(c=this.planes[s+1]=new Af);let f=DQ.copy(n).scale(-i).add(r),_=-n.dot(f);o.fromPointNormal(f,n);let w=DQ.copy(n).scale(i).add(r),I=U_t.copy(n).negate(),R=-I.dot(w);c.fromPointNormal(w,I),s+=2}return this}computeVisibility(t){let r=so.INSIDE;for(let i of this.planes)switch(t.intersectPlane(i)){case so.OUTSIDE:return so.OUTSIDE;case so.INTERSECTING:r=so.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(Bh(Number.isFinite(r),\"parentPlaneMask is required.\"),r===e.MASK_OUTSIDE||r===e.MASK_INSIDE)return r;let i=e.MASK_INSIDE,s=this.planes;for(let n=0;nf;)q_t(c,kI),OQ.copy(kI).transpose(),c.multiplyRight(kI),c.multiplyLeft(OQ),o.multiplyRight(kI),++s>2&&(++n,s=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=c.toTarget(t.diagonal),t}function W_t(e){let t=0;for(let r=0;r<9;++r){let i=e[r];t+=i*i}return Math.sqrt(t)}var GB=[1,0,0],WB=[2,2,1];function H_t(e){let t=0;for(let r=0;r<3;++r){let i=e[md.getElementIndex(WB[r],GB[r])];t+=2*i*i}return Math.sqrt(t)}function q_t(e,t){let r=YE.EPSILON15,i=0,s=1;for(let _=0;_<3;++_){let w=Math.abs(e[md.getElementIndex(WB[_],GB[_])]);w>i&&(s=_,i=w)}let n=GB[s],o=WB[s],c=1,f=0;if(Math.abs(e[md.getElementIndex(o,n)])>r){let _=e[md.getElementIndex(o,o)],w=e[md.getElementIndex(n,n)],I=e[md.getElementIndex(o,n)],R=(_-w)/2/I,N;R<0?N=-1/(-R+Math.sqrt(1+R*R)):N=1/(R+Math.sqrt(1+R*R)),c=1/Math.sqrt(1+N*N),f=N*c}return ss.IDENTITY.to(t),t[md.getElementIndex(n,n)]=t[md.getElementIndex(o,o)]=c,t[md.getElementIndex(o,n)]=f,t[md.getElementIndex(n,o)]=-f,t}var Cm=new Ve,Z_t=new Ve,Y_t=new Ve,Q_t=new Ve,$_t=new Ve,X_t=new ss,K_t={diagonal:new ss,unitary:new ss};function HB(e,t=new yx){if(!e||e.length===0)return t.halfAxes=new ss([0,0,0,0,0,0,0,0,0]),t.center=new Ve,t;let r=e.length,i=new Ve(0,0,0);for(let le of e)i.add(le);let s=1/r;i.multiplyByScalar(s);let n=0,o=0,c=0,f=0,_=0,w=0;for(let le of e){let ue=Cm.copy(le).subtract(i);n+=ue.x*ue.x,o+=ue.x*ue.y,c+=ue.x*ue.z,f+=ue.y*ue.y,_+=ue.y*ue.z,w+=ue.z*ue.z}n*=s,o*=s,c*=s,f*=s,_*=s,w*=s;let I=X_t;I[0]=n,I[1]=o,I[2]=c,I[3]=o,I[4]=f,I[5]=_,I[6]=c,I[7]=_,I[8]=w;let{unitary:R}=RI(I,K_t),N=t.halfAxes.copy(R),j=N.getColumn(0,Y_t),Q=N.getColumn(1,Q_t),et=N.getColumn(2,$_t),Y=-Number.MAX_VALUE,K=-Number.MAX_VALUE,J=-Number.MAX_VALUE,ut=Number.MAX_VALUE,Et=Number.MAX_VALUE,kt=Number.MAX_VALUE;for(let le of e)Cm.copy(le),Y=Math.max(Cm.dot(j),Y),K=Math.max(Cm.dot(Q),K),J=Math.max(Cm.dot(et),J),ut=Math.min(Cm.dot(j),ut),Et=Math.min(Cm.dot(Q),Et),kt=Math.min(Cm.dot(et),kt);j=j.multiplyByScalar(.5*(ut+Y)),Q=Q.multiplyByScalar(.5*(Et+K)),et=et.multiplyByScalar(.5*(kt+J)),t.center.copy(j).add(Q).add(et);let Xt=Z_t.set(Y-ut,K-Et,J-kt).multiplyByScalar(.5),qt=new ss([Xt[0],0,0,0,Xt[1],0,0,0,Xt[2]]);return t.halfAxes.multiplyRight(qt),t}var vx=512,BQ=3,FQ=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],zQ=FQ.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),J_t=zQ.concat([[.25,.5],[.75,.5]]),qB=class e{constructor(t,r,i){G(this,\"x\",void 0),G(this,\"y\",void 0),G(this,\"z\",void 0),G(this,\"childVisible\",void 0),G(this,\"selected\",void 0),G(this,\"_children\",void 0),this.x=t,this.y=r,this.z=i}get children(){if(!this._children){let t=this.x*2,r=this.y*2,i=this.z+1;this._children=[new e(t,r,i),new e(t,r+1,i),new e(t+1,r,i),new e(t+1,r+1,i)]}return this._children}update(t){let{viewport:r,cullingVolume:i,elevationBounds:s,minZ:n,maxZ:o,bounds:c,offset:f,project:_}=t,w=this.getBoundingVolume(s,f,_);if(c&&!this.insideBounds(c)||i.computeVisibility(w)<0)return!1;if(!this.childVisible){let{z:R}=this;if(R=n){let N=w.distanceTo(r.cameraPosition)*r.scale/r.height;R+=Math.floor(Math.log2(N))}if(R>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let R of this.children)R.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let r of this._children)r.getSelected(t);return t}insideBounds([t,r,i,s]){let n=Math.pow(2,this.z),o=vx/n;return this.x*ot&&(this.y+1)*o>r}getBoundingVolume(t,r,i){if(i){let f=this.z<1?J_t:this.z<2?zQ:FQ,_=[];for(let w of f){let I=DI(this.x+w[0],this.y+w[1],this.z);I[2]=t[0],_.push(i(I)),t[0]!==t[1]&&(I[2]=t[1],_.push(i(I)))}return HB(_)}let s=Math.pow(2,this.z),n=vx/s,o=this.x*n+r*vx,c=vx-(this.y+1)*n;return new Jg([o,c,t[0]],[o+n,c+n,t[1]])}};function NQ(e,t,r,i){let s=e instanceof rv&&e.resolution?e.projectPosition:null,n=Object.values(e.getFrustumPlanes()).map(({normal:N,distance:j})=>new Af(N.clone().negate(),j)),o=new Ad(n),c=e.distanceScales.unitsPerMeter[2],f=r&&r[0]*c||0,_=r&&r[1]*c||0,w=e instanceof lc&&e.pitch<=60?t:0;if(i){let[N,j,Q,et]=i,Y=va([N,et]),K=va([Q,j]);i=[Y[0],vx-Y[1],K[0],vx-K[1]]}let I=new qB(0,0,0),R={viewport:e,project:s,cullingVolume:o,elevationBounds:[f,_],minZ:w,maxZ:t,bounds:i,offset:0};if(I.update(R),e instanceof lc&&e.subViewports&&e.subViewports.length>1){for(R.offset=-1;I.update(R)&&!(--R.offset<-BQ););for(R.offset=1;I.update(R)&&!(++R.offset>BQ););}return I.getSelected()}var zp=512,tyt=[-1/0,-1/0,1/0,1/0],YB={type:\"object\",value:null,validate:(e,t)=>t.optional&&e===null||typeof e==\"string\"||Array.isArray(e)&&e.every(r=>typeof r==\"string\"),equal:(e,t)=>{if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;let r=e.length;if(r!==t.length)return!1;for(let i=0;is[0])),Math.min(...r.map(s=>s[1])),Math.max(...r.map(s=>s[0])),Math.max(...r.map(s=>s[1]))]}function eyt(e){return Math.abs(e.split(\"\").reduce((t,r)=>(t<<5)-t+r.charCodeAt(0)|0,0))}function QB(e,t){if(!e||!e.length)return null;let{index:r,id:i}=t;if(Array.isArray(e)){let n=eyt(i)%e.length;e=e[n]}let s=e;for(let n of Object.keys(r)){let o=new RegExp(\"{\".concat(n,\"}\"),\"g\");s=s.replace(o,String(r[n]))}return Number.isInteger(r.y)&&Number.isInteger(r.z)&&(s=s.replace(/\\{-y\\}/g,String(Math.pow(2,r.z)-r.y-1))),s}function ryt(e,t,r){let i;if(t&&t.length===2){let[s,n]=t,o=e.getBounds({z:s}),c=e.getBounds({z:n});i=[Math.min(o[0],c[0]),Math.min(o[1],c[1]),Math.max(o[2],c[2]),Math.max(o[3],c[3])]}else i=e.getBounds();return e.isGeospatial?[Math.max(i[0],r[0]),Math.max(i[1],r[1]),Math.min(i[2],r[2]),Math.min(i[3],r[3])]:[Math.max(Math.min(i[0],r[2]),r[0]),Math.max(Math.min(i[1],r[3]),r[1]),Math.min(Math.max(i[2],r[0]),r[2]),Math.min(Math.max(i[3],r[1]),r[3])]}function jQ({viewport:e,z:t=0,cullRect:r}){return(e.subViewports||[e]).map(s=>ZB(s,t,r))}function ZB(e,t,r){if(!Array.isArray(t)){let n=r.x-e.x,o=r.y-e.y,{width:c,height:f}=r,_={targetZ:t},w=e.unproject([n,o],_),I=e.unproject([n+c,o],_),R=e.unproject([n,o+f],_),N=e.unproject([n+c,o+f],_);return[Math.min(w[0],I[0],R[0],N[0]),Math.min(w[1],I[1],R[1],N[1]),Math.max(w[0],I[0],R[0],N[0]),Math.max(w[1],I[1],R[1],N[1])]}let i=ZB(e,t[0],r),s=ZB(e,t[1],r);return[Math.min(i[0],s[0]),Math.min(i[1],s[1]),Math.max(i[2],s[2]),Math.max(i[3],s[3])]}function iyt(e,t,r){return r?VQ(e,r).map(s=>s*t/zp):e.map(i=>i*t/zp)}function $B(e,t){return Math.pow(2,e)*zp/t}function DI(e,t,r){let i=$B(r,zp),s=e/i*360-180,n=Math.PI-2*Math.PI*t/i,o=180/Math.PI*Math.atan(.5*(Math.exp(n)-Math.exp(-n)));return[s,o]}function UQ(e,t,r,i){let s=$B(r,i);return[e/s*zp,t/s*zp]}function XB(e,t,r,i,s=zp){if(e.isGeospatial){let[_,w]=DI(t,r,i),[I,R]=DI(t+1,r+1,i);return{west:_,north:w,east:I,south:R}}let[n,o]=UQ(t,r,i,s),[c,f]=UQ(t+1,r+1,i,s);return{left:n,top:o,right:c,bottom:f}}function nyt(e,t,r,i,s){let n=ryt(e,null,i),o=$B(t,r),[c,f,_,w]=iyt(n,o,s),I=[];for(let R=Math.floor(c);R<_;R++)for(let N=Math.floor(f);Nt&&(_=t);let w=s;return o&&c&&s&&!e.isGeospatial&&(w=VQ(s,o)),e.isGeospatial?NQ(e,_,i,s):nyt(e,_,n,w||tyt,c)}function GQ(e){let t={},r;return i=>{for(let s in i)if(!syt(i[s],t[s])){r=e(i),t=i;break}return r}}function syt(e,t){if(e===t)return!0;if(Array.isArray(e)){let r=e.length;if(!t||t.length!==r)return!1;for(let i=0;i{}},uyt={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:\"best-available\",zRange:null,maxRequests:6,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},MS=class{constructor(t){G(this,\"opts\",void 0),G(this,\"_requestScheduler\",void 0),G(this,\"_cache\",void 0),G(this,\"_dirty\",void 0),G(this,\"_tiles\",void 0),G(this,\"_cacheByteSize\",void 0),G(this,\"_viewport\",void 0),G(this,\"_zRange\",void 0),G(this,\"_selectedTiles\",void 0),G(this,\"_frameNumber\",void 0),G(this,\"_modelMatrix\",void 0),G(this,\"_modelMatrixInverse\",void 0),G(this,\"_maxZoom\",void 0),G(this,\"_minZoom\",void 0),G(this,\"onTileLoad\",void 0),G(this,\"_getCullBounds\",GQ(jQ)),this.opts={...uyt,...t},this.onTileLoad=r=>{var i,s;(i=(s=this.opts).onTileLoad)===null||i===void 0||i.call(s,r),this.opts.maxCacheByteSize&&(this._cacheByteSize+=r.byteLength,this._resizeCache())},this._requestScheduler=new py({maxRequests:t.maxRequests,throttleRequests:!!(t.maxRequests&&t.maxRequests>0)}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new En,this._modelMatrixInverse=new En,this.setOptions(t)}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(t=>t.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(t=>t.needsReload)}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(let t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let t of this._cache.keys()){let r=this._cache.get(t);!this._selectedTiles||!this._selectedTiles.includes(r)?this._cache.delete(t):r.setNeedsReload()}}update(t,{zRange:r,modelMatrix:i}={}){let s=new En(i),n=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!Ro(this._zRange,r)||n){n&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=t,this._zRange=r;let c=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:r,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=c.map(f=>this._getTile(f,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(c=>this._getTile(c.index,!0)));let o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(t,r){if(!t.isVisible)return!1;if(r&&this._viewport){let i=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:s}=t;for(let[n,o,c,f]of i){let _;if(\"west\"in s)_=s.westn&&s.southo;else{let w=Math.min(s.top,s.bottom),I=Math.max(s.top,s.bottom);_=s.leftn&&wo}if(_)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:r,minZoom:i,zRange:s,modelMatrix:n,modelMatrixInverse:o}){let{tileSize:c,extent:f,zoomOffset:_}=this.opts;return KB({viewport:t,maxZoom:r,minZoom:i,zRange:s,tileSize:c,extent:f,modelMatrix:n,modelMatrixInverse:o,zoomOffset:_})}getTileId(t){return\"\".concat(t.x,\"-\").concat(t.y,\"-\").concat(t.z)}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:r}=this.opts;return{bbox:XB(this._viewport,t.x,t.y,t.z,r)}}getParentIndex(t){let r=Math.floor(t.x/2),i=Math.floor(t.y/2),s=t.z-1;return{x:r,y:i,z:s}}updateTileStates(){let t=this.opts.refinementStrategy||ES,r=new Array(this._cache.size),i=0;for(let s of this._cache.values())r[i++]=s.isVisible,s.isSelected=!1,s.isVisible=!1;for(let s of this._selectedTiles)s.isSelected=!0,s.isVisible=!0;(typeof t==\"function\"?t:cyt[t])(Array.from(this._cache.values())),i=0;for(let s of this._cache.values())if(r[i++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:t=0}=this.opts,r=[],i=0;for(let s of this._cache.values())s.isLoading&&(i++,!s.isSelected&&!s.isVisible&&r.push(s));for(;t>0&&i>t&&r.length>0;)r.shift().abort(),i--}_rebuildTree(){let{_cache:t}=this;for(let r of t.values())r.parent=null,r.children&&(r.children.length=0);for(let r of t.values()){let i=this._getNearestAncestor(r);r.parent=i,i!=null&&i.children&&i.children.push(r)}}_resizeCache(){let{_cache:t,opts:r}=this,i=r.maxCacheSize||(r.maxCacheByteSize?1/0:lyt*this.selectedTiles.length),s=r.maxCacheByteSize||1/0;if(t.size>i||this._cacheByteSize>s){for(let[f,_]of t){if(!_.isVisible&&!_.isSelected){var o,c;this._cacheByteSize-=r.maxCacheByteSize?_.byteLength:0,t.delete(f),(o=(c=this.opts).onTileUnload)===null||o===void 0||o.call(c,_)}if(t.size<=i&&this._cacheByteSize<=s)break}this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((f,_)=>f.zoom-_.zoom),this._dirty=!1)}_getTile(t,r){let i=this.getTileId(t),s=this._cache.get(i),n=!1;return!s&&r?(s=new PI(t),Object.assign(s,this.getTileMetadata(s.index)),Object.assign(s,{id:i,zoom:this.getTileZoom(s.index)}),n=!0,this._cache.set(i,s),this._dirty=!0):s&&s.needsReload&&(n=!0),s&&n&&s.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),s}_getNearestAncestor(t){let{_minZoom:r=0}=this,i=t.index;for(;this.getTileZoom(i)>r;){i=this.getParentIndex(i);let s=this._getTile(i);if(s)return s}return null}};function hyt(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!HQ(t)&&JB(t);for(let t of e)t.isVisible=!!(t.state&OI)}function fyt(e){for(let r of e)r.state=0;for(let r of e)r.isSelected&&HQ(r);let t=Array.from(e).sort((r,i)=>r.zoom-i.zoom);for(let r of t)if(r.isVisible=!!(r.state&OI),r.children&&(r.isVisible||r.state&WQ))for(let i of r.children)i.state=WQ;else r.isSelected&&JB(r)}function HQ(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=OI,!0;t=t.parent}return!1}function JB(e){for(let t of e.children)t.isLoaded||t.content?t.state|=OI:JB(t)}var dyt={TilesetClass:MS,data:{type:\"data\",value:[]},dataComparator:YB.equal,renderSubLayers:{type:\"function\",value:e=>new Mm(e)},getTileData:{type:\"function\",optional:!0,value:null},onViewportLoad:{type:\"function\",optional:!0,value:null},onTileLoad:{type:\"function\",value:e=>{}},onTileUnload:{type:\"function\",value:e=>{}},onTileError:{type:\"function\",value:e=>console.error(e)},extent:{type:\"array\",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:ES,zRange:null,maxRequests:6,zoomOffset:0},Lm=class extends Ni{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){var t,r;(t=this.state)===null||t===void 0||(r=t.tileset)===null||r===void 0||r.finalize()}get isLoaded(){var t,r,i;return(t=this.state)===null||t===void 0||(r=t.tileset)===null||r===void 0||(i=r.selectedTiles)===null||i===void 0?void 0:i.every(s=>s.isLoaded&&s.layers&&s.layers.every(n=>n.isLoaded))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:r}=this.state,i=t.propsOrDataChanged||t.updateTriggersChanged,s=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);r?i&&(r.setOptions(this._getTilesetOptions()),s?r.reloadAll():this.state.tileset.tiles.forEach(n=>{n.layers=null})):(r=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:r})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:r,maxCacheByteSize:i,refinementStrategy:s,extent:n,maxZoom:o,minZoom:c,maxRequests:f,zoomOffset:_}=this.props;return{maxCacheSize:r,maxCacheByteSize:i,maxZoom:o,minZoom:c,tileSize:t,refinementStrategy:s,extent:n,maxRequests:f,zoomOffset:_,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let{tileset:t}=this.state,{zRange:r,modelMatrix:i}=this.props,s=t.update(this.context.viewport,{zRange:r,modelMatrix:i}),{isLoaded:n}=t,o=this.state.isLoaded!==n,c=this.state.frameNumber!==s;n&&(o||c)&&this._onViewportLoad(),c&&this.setState({frameNumber:s}),this.state.isLoaded=n}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:r}=this.props;r&&r(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,r){this.props.onTileError(t),r.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:r,getTileData:i,fetch:s}=this.props,{signal:n}=t;return t.url=typeof r==\"string\"||Array.isArray(r)?QB(r,t):null,i?i(t):s&&t.url?s(t.url,{propName:\"data\",layer:this,signal:n}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}getPickingInfo({info:t,sourceLayer:r}){let i=r.props.tile;return t.picked&&(t.tile=i),t.sourceTile=i,t}_updateAutoHighlight(t){let r=t.sourceTile;if(r&&r.layers)for(let i of r.layers)i.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{let r=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)r&&t.layers[0]&&Object.keys(r).some(i=>t.layers[0].props[i]!==r[i])&&(t.layers=t.layers.map(i=>i.clone(r)));else{let i=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=op(i,Boolean).map(s=>s.clone({tile:t,...r}))}return t.layers})}filterSubLayer({layer:t,cullRect:r}){let{tile:i}=t.props;return this.state.tileset.isTileVisible(i,r)}};G(Lm,\"defaultProps\",dyt);G(Lm,\"layerName\",\"TileLayer\");var Ic=function(e){e=e||{};var t=typeof e<\"u\"?e:{},r={},i;for(i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);var s=[],n=\"\";function o(Zt){return t.locateFile?t.locateFile(Zt,n):n+Zt}var c;document.currentScript&&(n=document.currentScript.src),n.indexOf(\"blob:\")!==0?n=n.substr(0,n.lastIndexOf(\"/\")+1):n=\"\",c=function(fe,Be,br){var g=new XMLHttpRequest;g.open(\"GET\",fe,!0),g.responseType=\"arraybuffer\",g.onload=function(){if(g.status==200||g.status==0&&g.response){Be(g.response);return}var Ti=ht(fe);if(Ti){Be(Ti.buffer);return}br()},g.onerror=br,g.send(null)};var f=t.print||console.log.bind(console),_=t.printErr||console.warn.bind(console);for(i in r)r.hasOwnProperty(i)&&(t[i]=r[i]);r=null,t.arguments&&(s=t.arguments);var w=0,I=function(Zt){w=Zt},R=function(){return w},N=8;function j(Zt,fe,Be,br){switch(Be=Be||\"i8\",Be.charAt(Be.length-1)===\"*\"&&(Be=\"i32\"),Be){case\"i1\":Sr[Zt>>0]=fe;break;case\"i8\":Sr[Zt>>0]=fe;break;case\"i16\":oo[Zt>>1]=fe;break;case\"i32\":No[Zt>>2]=fe;break;case\"i64\":ve=[fe>>>0,(wo=fe,+Nl(wo)>=1?wo>0?(mn(+ls(wo/4294967296),4294967295)|0)>>>0:~~+ee((wo-+(~~wo>>>0))/4294967296)>>>0:0)],No[Zt>>2]=ve[0],No[Zt+4>>2]=ve[1];break;case\"float\":Uo[Zt>>2]=fe;break;case\"double\":Si[Zt>>3]=fe;break;default:oh(\"invalid type for setValue: \"+Be)}}function Q(Zt,fe,Be){switch(fe=fe||\"i8\",fe.charAt(fe.length-1)===\"*\"&&(fe=\"i32\"),fe){case\"i1\":return Sr[Zt>>0];case\"i8\":return Sr[Zt>>0];case\"i16\":return oo[Zt>>1];case\"i32\":return No[Zt>>2];case\"i64\":return No[Zt>>2];case\"float\":return Uo[Zt>>2];case\"double\":return Si[Zt>>3];default:oh(\"invalid type for getValue: \"+fe)}return null}var et=!1;function Y(Zt,fe){Zt||oh(\"Assertion failed: \"+fe)}function K(Zt){var fe=t[\"_\"+Zt];return Y(fe,\"Cannot call unknown function \"+Zt+\", make sure it is exported\"),fe}function J(Zt,fe,Be,br,g){var Vi={string:function(Ur){var hi=0;if(Ur!=null&&Ur!==0){var To=(Ur.length<<2)+1;hi=Hp(To),le(Ur,hi,To)}return hi},array:function(Ur){var hi=Hp(Ur.length);return De(Ur,hi),hi}};function Ti(Ur){return fe===\"string\"?Xt(Ur):fe===\"boolean\"?!!Ur:Ur}var Tt=K(Zt),Ms=[],cs=0;if(br)for(var li=0;li=br);)++g;if(g-fe>16&&Zt.subarray&&Et)return Et.decode(Zt.subarray(fe,g));for(var Vi=\"\";fe>10,56320|cs&1023)}}return Vi}function Xt(Zt,fe){return Zt?kt(Li,Zt,fe):\"\"}function qt(Zt,fe,Be,br){if(!(br>0))return 0;for(var g=Be,Vi=Be+br-1,Ti=0;Ti=55296&&Tt<=57343){var Ms=Zt.charCodeAt(++Ti);Tt=65536+((Tt&1023)<<10)|Ms&1023}if(Tt<=127){if(Be>=Vi)break;fe[Be++]=Tt}else if(Tt<=2047){if(Be+1>=Vi)break;fe[Be++]=192|Tt>>6,fe[Be++]=128|Tt&63}else if(Tt<=65535){if(Be+2>=Vi)break;fe[Be++]=224|Tt>>12,fe[Be++]=128|Tt>>6&63,fe[Be++]=128|Tt&63}else{if(Be+3>=Vi)break;fe[Be++]=240|Tt>>18,fe[Be++]=128|Tt>>12&63,fe[Be++]=128|Tt>>6&63,fe[Be++]=128|Tt&63}}return fe[Be]=0,Be-g}function le(Zt,fe,Be){return qt(Zt,Li,fe,Be)}var ue=typeof TextDecoder<\"u\"?new TextDecoder(\"utf-16le\"):void 0;function De(Zt,fe){Sr.set(Zt,fe)}function Ke(Zt,fe){return Zt%fe>0&&(Zt+=fe-Zt%fe),Zt}var rr,Sr,Li,oo,zl,No,ih,Uo,Si;function Ns(Zt){rr=Zt,t.HEAP8=Sr=new Int8Array(Zt),t.HEAP16=oo=new Int16Array(Zt),t.HEAP32=No=new Int32Array(Zt),t.HEAPU8=Li=new Uint8Array(Zt),t.HEAPU16=zl=new Uint16Array(Zt),t.HEAPU32=ih=new Uint32Array(Zt),t.HEAPF32=Uo=new Float32Array(Zt),t.HEAPF64=Si=new Float64Array(Zt)}var ll=5266928,kc=24016,Rc=t.TOTAL_MEMORY||33554432;t.buffer?rr=t.buffer:rr=new ArrayBuffer(Rc),Rc=rr.byteLength,Ns(rr),No[kc>>2]=ll;function Xi(Zt){for(;Zt.length>0;){var fe=Zt.shift();if(typeof fe==\"function\"){fe();continue}var Be=fe.func;typeof Be==\"number\"?fe.arg===void 0?t.dynCall_v(Be):t.dynCall_vi(Be,fe.arg):Be(fe.arg===void 0?null:fe.arg)}}var Jn=[],ki=[],ts=[],Vo=[];function cl(){if(t.preRun)for(typeof t.preRun==\"function\"&&(t.preRun=[t.preRun]);t.preRun.length;)as(t.preRun.shift());Xi(Jn)}function xo(){Xi(ki)}function Pa(){Xi(ts)}function na(){if(t.postRun)for(typeof t.postRun==\"function\"&&(t.postRun=[t.postRun]);t.postRun.length;)ao(t.postRun.shift());Xi(Vo)}function as(Zt){Jn.unshift(Zt)}function ao(Zt){Vo.unshift(Zt)}var Nl=Math.abs,ee=Math.ceil,ls=Math.floor,mn=Math.min,gi=0,oi=null,lo=null;function du(Zt){gi++,t.monitorRunDependencies&&t.monitorRunDependencies(gi)}function ul(Zt){if(gi--,t.monitorRunDependencies&&t.monitorRunDependencies(gi),gi==0&&(oi!==null&&(clearInterval(oi),oi=null),lo)){var fe=lo;lo=null,fe()}}t.preloadedImages={},t.preloadedAudios={};var bo=null,hl=\"data:application/octet-stream;base64,\";function Ia(Zt){return String.prototype.startsWith?Zt.startsWith(hl):Zt.indexOf(hl)===0}var wo,ve;bo=\"data:application/octet-stream;base64,AAAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAABAAAAAMAAAAGAAAABQAAAAIAAAAAAAAAAgAAAAMAAAABAAAABAAAAAYAAAAAAAAABQAAAAMAAAAGAAAABAAAAAUAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAABAAAABQAAAAIAAAAAAAAAAQAAAAMAAAAGAAAABAAAAAYAAAAAAAAABQAAAAIAAAABAAAABAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAgAAAAMAAAAAAAAAAAAAAAIAAAAAAAAAAQAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABgAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAAAAAAAAAAAAAAAAAIAAAAAAAAABgAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAAAAAACAAAAAwAAAAQAAAAFAAAABgAAAAAAAAABAAAAAwAAAAQAAAAFAAAABgAAAAAAAAABAAAAAgAAAAQAAAAFAAAABgAAAAAAAAABAAAAAgAAAAMAAAAFAAAABgAAAAAAAAABAAAAAgAAAAMAAAAEAAAABgAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAAAAAAABgAAAAAAAAADAAAAAgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAUAAAAEAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAEAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAUAAAACAAAABAAAAAMAAAAIAAAAAQAAAAcAAAAGAAAACQAAAAAAAAADAAAAAgAAAAIAAAAGAAAACgAAAAsAAAAAAAAAAQAAAAUAAAADAAAADQAAAAEAAAAHAAAABAAAAAwAAAAAAAAABAAAAH8AAAAPAAAACAAAAAMAAAAAAAAADAAAAAUAAAACAAAAEgAAAAoAAAAIAAAAAAAAABAAAAAGAAAADgAAAAsAAAARAAAAAQAAAAkAAAACAAAABwAAABUAAAAJAAAAEwAAAAMAAAANAAAAAQAAAAgAAAAFAAAAFgAAABAAAAAEAAAAAAAAAA8AAAAJAAAAEwAAAA4AAAAUAAAAAQAAAAcAAAAGAAAACgAAAAsAAAAYAAAAFwAAAAUAAAACAAAAEgAAAAsAAAARAAAAFwAAABkAAAACAAAABgAAAAoAAAAMAAAAHAAAAA0AAAAaAAAABAAAAA8AAAADAAAADQAAABoAAAAVAAAAHQAAAAMAAAAMAAAABwAAAA4AAAB/AAAAEQAAABsAAAAJAAAAFAAAAAYAAAAPAAAAFgAAABwAAAAfAAAABAAAAAgAAAAMAAAAEAAAABIAAAAhAAAAHgAAAAgAAAAFAAAAFgAAABEAAAALAAAADgAAAAYAAAAjAAAAGQAAABsAAAASAAAAGAAAAB4AAAAgAAAABQAAAAoAAAAQAAAAEwAAACIAAAAUAAAAJAAAAAcAAAAVAAAACQAAABQAAAAOAAAAEwAAAAkAAAAoAAAAGwAAACQAAAAVAAAAJgAAABMAAAAiAAAADQAAAB0AAAAHAAAAFgAAABAAAAApAAAAIQAAAA8AAAAIAAAAHwAAABcAAAAYAAAACwAAAAoAAAAnAAAAJQAAABkAAAAYAAAAfwAAACAAAAAlAAAACgAAABcAAAASAAAAGQAAABcAAAARAAAACwAAAC0AAAAnAAAAIwAAABoAAAAqAAAAHQAAACsAAAAMAAAAHAAAAA0AAAAbAAAAKAAAACMAAAAuAAAADgAAABQAAAARAAAAHAAAAB8AAAAqAAAALAAAAAwAAAAPAAAAGgAAAB0AAAArAAAAJgAAAC8AAAANAAAAGgAAABUAAAAeAAAAIAAAADAAAAAyAAAAEAAAABIAAAAhAAAAHwAAACkAAAAsAAAANQAAAA8AAAAWAAAAHAAAACAAAAAeAAAAGAAAABIAAAA0AAAAMgAAACUAAAAhAAAAHgAAADEAAAAwAAAAFgAAABAAAAApAAAAIgAAABMAAAAmAAAAFQAAADYAAAAkAAAAMwAAACMAAAAuAAAALQAAADgAAAARAAAAGwAAABkAAAAkAAAAFAAAACIAAAATAAAANwAAACgAAAA2AAAAJQAAACcAAAA0AAAAOQAAABgAAAAXAAAAIAAAACYAAAB/AAAAIgAAADMAAAAdAAAALwAAABUAAAAnAAAAJQAAABkAAAAXAAAAOwAAADkAAAAtAAAAKAAAABsAAAAkAAAAFAAAADwAAAAuAAAANwAAACkAAAAxAAAANQAAAD0AAAAWAAAAIQAAAB8AAAAqAAAAOgAAACsAAAA+AAAAHAAAACwAAAAaAAAAKwAAAD4AAAAvAAAAQAAAABoAAAAqAAAAHQAAACwAAAA1AAAAOgAAAEEAAAAcAAAAHwAAACoAAAAtAAAAJwAAACMAAAAZAAAAPwAAADsAAAA4AAAALgAAADwAAAA4AAAARAAAABsAAAAoAAAAIwAAAC8AAAAmAAAAKwAAAB0AAABFAAAAMwAAAEAAAAAwAAAAMQAAAB4AAAAhAAAAQwAAAEIAAAAyAAAAMQAAAH8AAAA9AAAAQgAAACEAAAAwAAAAKQAAADIAAAAwAAAAIAAAAB4AAABGAAAAQwAAADQAAAAzAAAARQAAADYAAABHAAAAJgAAAC8AAAAiAAAANAAAADkAAABGAAAASgAAACAAAAAlAAAAMgAAADUAAAA9AAAAQQAAAEsAAAAfAAAAKQAAACwAAAA2AAAARwAAADcAAABJAAAAIgAAADMAAAAkAAAANwAAACgAAAA2AAAAJAAAAEgAAAA8AAAASQAAADgAAABEAAAAPwAAAE0AAAAjAAAALgAAAC0AAAA5AAAAOwAAAEoAAABOAAAAJQAAACcAAAA0AAAAOgAAAH8AAAA+AAAATAAAACwAAABBAAAAKgAAADsAAAA/AAAATgAAAE8AAAAnAAAALQAAADkAAAA8AAAASAAAAEQAAABQAAAAKAAAADcAAAAuAAAAPQAAADUAAAAxAAAAKQAAAFEAAABLAAAAQgAAAD4AAAArAAAAOgAAACoAAABSAAAAQAAAAEwAAAA/AAAAfwAAADgAAAAtAAAATwAAADsAAABNAAAAQAAAAC8AAAA+AAAAKwAAAFQAAABFAAAAUgAAAEEAAAA6AAAANQAAACwAAABWAAAATAAAAEsAAABCAAAAQwAAAFEAAABVAAAAMQAAADAAAAA9AAAAQwAAAEIAAAAyAAAAMAAAAFcAAABVAAAARgAAAEQAAAA4AAAAPAAAAC4AAABaAAAATQAAAFAAAABFAAAAMwAAAEAAAAAvAAAAWQAAAEcAAABUAAAARgAAAEMAAAA0AAAAMgAAAFMAAABXAAAASgAAAEcAAABZAAAASQAAAFsAAAAzAAAARQAAADYAAABIAAAAfwAAAEkAAAA3AAAAUAAAADwAAABYAAAASQAAAFsAAABIAAAAWAAAADYAAABHAAAANwAAAEoAAABOAAAAUwAAAFwAAAA0AAAAOQAAAEYAAABLAAAAQQAAAD0AAAA1AAAAXgAAAFYAAABRAAAATAAAAFYAAABSAAAAYAAAADoAAABBAAAAPgAAAE0AAAA/AAAARAAAADgAAABdAAAATwAAAFoAAABOAAAASgAAADsAAAA5AAAAXwAAAFwAAABPAAAATwAAAE4AAAA/AAAAOwAAAF0AAABfAAAATQAAAFAAAABEAAAASAAAADwAAABjAAAAWgAAAFgAAABRAAAAVQAAAF4AAABlAAAAPQAAAEIAAABLAAAAUgAAAGAAAABUAAAAYgAAAD4AAABMAAAAQAAAAFMAAAB/AAAASgAAAEYAAABkAAAAVwAAAFwAAABUAAAARQAAAFIAAABAAAAAYQAAAFkAAABiAAAAVQAAAFcAAABlAAAAZgAAAEIAAABDAAAAUQAAAFYAAABMAAAASwAAAEEAAABoAAAAYAAAAF4AAABXAAAAUwAAAGYAAABkAAAAQwAAAEYAAABVAAAAWAAAAEgAAABbAAAASQAAAGMAAABQAAAAaQAAAFkAAABhAAAAWwAAAGcAAABFAAAAVAAAAEcAAABaAAAATQAAAFAAAABEAAAAagAAAF0AAABjAAAAWwAAAEkAAABZAAAARwAAAGkAAABYAAAAZwAAAFwAAABTAAAATgAAAEoAAABsAAAAZAAAAF8AAABdAAAATwAAAFoAAABNAAAAbQAAAF8AAABqAAAAXgAAAFYAAABRAAAASwAAAGsAAABoAAAAZQAAAF8AAABcAAAATwAAAE4AAABtAAAAbAAAAF0AAABgAAAAaAAAAGIAAABuAAAATAAAAFYAAABSAAAAYQAAAH8AAABiAAAAVAAAAGcAAABZAAAAbwAAAGIAAABuAAAAYQAAAG8AAABSAAAAYAAAAFQAAABjAAAAUAAAAGkAAABYAAAAagAAAFoAAABxAAAAZAAAAGYAAABTAAAAVwAAAGwAAAByAAAAXAAAAGUAAABmAAAAawAAAHAAAABRAAAAVQAAAF4AAABmAAAAZQAAAFcAAABVAAAAcgAAAHAAAABkAAAAZwAAAFsAAABhAAAAWQAAAHQAAABpAAAAbwAAAGgAAABrAAAAbgAAAHMAAABWAAAAXgAAAGAAAABpAAAAWAAAAGcAAABbAAAAcQAAAGMAAAB0AAAAagAAAF0AAABjAAAAWgAAAHUAAABtAAAAcQAAAGsAAAB/AAAAZQAAAF4AAABzAAAAaAAAAHAAAABsAAAAZAAAAF8AAABcAAAAdgAAAHIAAABtAAAAbQAAAGwAAABdAAAAXwAAAHUAAAB2AAAAagAAAG4AAABiAAAAaAAAAGAAAAB3AAAAbwAAAHMAAABvAAAAYQAAAG4AAABiAAAAdAAAAGcAAAB3AAAAcAAAAGsAAABmAAAAZQAAAHgAAABzAAAAcgAAAHEAAABjAAAAdAAAAGkAAAB1AAAAagAAAHkAAAByAAAAcAAAAGQAAABmAAAAdgAAAHgAAABsAAAAcwAAAG4AAABrAAAAaAAAAHgAAAB3AAAAcAAAAHQAAABnAAAAdwAAAG8AAABxAAAAaQAAAHkAAAB1AAAAfwAAAG0AAAB2AAAAcQAAAHkAAABqAAAAdgAAAHgAAABsAAAAcgAAAHUAAAB5AAAAbQAAAHcAAABvAAAAcwAAAG4AAAB5AAAAdAAAAHgAAAB4AAAAcwAAAHIAAABwAAAAeQAAAHcAAAB2AAAAeQAAAHQAAAB4AAAAdwAAAHUAAABxAAAAdgAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAEAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAQAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAADAAAABQAAAAEAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAgAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAABQAAAAUAAAAAAAAAAAAAAP////8BAAAAAAAAAAMAAAAEAAAAAgAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAQAAAP//////////AQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAIAAAAAAAAAAAAAAAEAAAACAAAABgAAAAQAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAoAAAACAAAAAAAAAAAAAAABAAAAAQAAAAUAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAAAAAAAAAAAAAEAAAADAAAABwAAAAYAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAHAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAAAAAAAAAAAAQAAAAAAAAAJAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAAAAAAAAAAAAQAAAAQAAAAIAAAACgAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAAAAAAAAAAABAAAACwAAAA8AAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA4AAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAgAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAACAAAAAAAAAAAAAAABAAAADAAAABAAAAAMAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAEAAAAKAAAAEwAAAAgAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAJAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAgAAAAAAAAAAAAAAAQAAAA0AAAARAAAADQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABMAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAAAAAAAAAAAAAEAAAAOAAAAEgAAAA8AAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABMAAAACAAAAAAAAAAAAAAABAAAA//////////8TAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABMAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABIAAAAAAAAAGAAAAAAAAAAhAAAAAAAAAB4AAAAAAAAAIAAAAAMAAAAxAAAAAQAAADAAAAADAAAAMgAAAAMAAAAIAAAAAAAAAAUAAAAFAAAACgAAAAUAAAAWAAAAAAAAABAAAAAAAAAAEgAAAAAAAAApAAAAAQAAACEAAAAAAAAAHgAAAAAAAAAEAAAAAAAAAAAAAAAFAAAAAgAAAAUAAAAPAAAAAQAAAAgAAAAAAAAABQAAAAUAAAAfAAAAAQAAABYAAAAAAAAAEAAAAAAAAAACAAAAAAAAAAYAAAAAAAAADgAAAAAAAAAKAAAAAAAAAAsAAAAAAAAAEQAAAAMAAAAYAAAAAQAAABcAAAADAAAAGQAAAAMAAAAAAAAAAAAAAAEAAAAFAAAACQAAAAUAAAAFAAAAAAAAAAIAAAAAAAAABgAAAAAAAAASAAAAAQAAAAoAAAAAAAAACwAAAAAAAAAEAAAAAQAAAAMAAAAFAAAABwAAAAUAAAAIAAAAAQAAAAAAAAAAAAAAAQAAAAUAAAAQAAAAAQAAAAUAAAAAAAAAAgAAAAAAAAAHAAAAAAAAABUAAAAAAAAAJgAAAAAAAAAJAAAAAAAAABMAAAAAAAAAIgAAAAMAAAAOAAAAAQAAABQAAAADAAAAJAAAAAMAAAADAAAAAAAAAA0AAAAFAAAAHQAAAAUAAAABAAAAAAAAAAcAAAAAAAAAFQAAAAAAAAAGAAAAAQAAAAkAAAAAAAAAEwAAAAAAAAAEAAAAAgAAAAwAAAAFAAAAGgAAAAUAAAAAAAAAAQAAAAMAAAAAAAAADQAAAAUAAAACAAAAAQAAAAEAAAAAAAAABwAAAAAAAAAaAAAAAAAAACoAAAAAAAAAOgAAAAAAAAAdAAAAAAAAACsAAAAAAAAAPgAAAAMAAAAmAAAAAQAAAC8AAAADAAAAQAAAAAMAAAAMAAAAAAAAABwAAAAFAAAALAAAAAUAAAANAAAAAAAAABoAAAAAAAAAKgAAAAAAAAAVAAAAAQAAAB0AAAAAAAAAKwAAAAAAAAAEAAAAAwAAAA8AAAAFAAAAHwAAAAUAAAADAAAAAQAAAAwAAAAAAAAAHAAAAAUAAAAHAAAAAQAAAA0AAAAAAAAAGgAAAAAAAAAfAAAAAAAAACkAAAAAAAAAMQAAAAAAAAAsAAAAAAAAADUAAAAAAAAAPQAAAAMAAAA6AAAAAQAAAEEAAAADAAAASwAAAAMAAAAPAAAAAAAAABYAAAAFAAAAIQAAAAUAAAAcAAAAAAAAAB8AAAAAAAAAKQAAAAAAAAAqAAAAAQAAACwAAAAAAAAANQAAAAAAAAAEAAAABAAAAAgAAAAFAAAAEAAAAAUAAAAMAAAAAQAAAA8AAAAAAAAAFgAAAAUAAAAaAAAAAQAAABwAAAAAAAAAHwAAAAAAAAAyAAAAAAAAADAAAAAAAAAAMQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAIQAAAAMAAAAYAAAAAwAAABIAAAADAAAAEAAAAAMAAABGAAAAAAAAAEMAAAAAAAAAQgAAAAMAAAA0AAAAAwAAADIAAAAAAAAAMAAAAAAAAAAlAAAAAwAAACAAAAAAAAAAHgAAAAMAAABTAAAAAAAAAFcAAAADAAAAVQAAAAMAAABKAAAAAwAAAEYAAAAAAAAAQwAAAAAAAAA5AAAAAQAAADQAAAADAAAAMgAAAAAAAAAZAAAAAAAAABcAAAAAAAAAGAAAAAMAAAARAAAAAAAAAAsAAAADAAAACgAAAAMAAAAOAAAAAwAAAAYAAAADAAAAAgAAAAMAAAAtAAAAAAAAACcAAAAAAAAAJQAAAAMAAAAjAAAAAwAAABkAAAAAAAAAFwAAAAAAAAAbAAAAAwAAABEAAAAAAAAACwAAAAMAAAA/AAAAAAAAADsAAAADAAAAOQAAAAMAAAA4AAAAAwAAAC0AAAAAAAAAJwAAAAAAAAAuAAAAAwAAACMAAAADAAAAGQAAAAAAAAAkAAAAAAAAABQAAAAAAAAADgAAAAMAAAAiAAAAAAAAABMAAAADAAAACQAAAAMAAAAmAAAAAwAAABUAAAADAAAABwAAAAMAAAA3AAAAAAAAACgAAAAAAAAAGwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAFAAAAAAAAAAzAAAAAwAAACIAAAAAAAAAEwAAAAMAAABIAAAAAAAAADwAAAADAAAALgAAAAMAAABJAAAAAwAAADcAAAAAAAAAKAAAAAAAAABHAAAAAwAAADYAAAADAAAAJAAAAAAAAABAAAAAAAAAAC8AAAAAAAAAJgAAAAMAAAA+AAAAAAAAACsAAAADAAAAHQAAAAMAAAA6AAAAAwAAACoAAAADAAAAGgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAMwAAAAMAAABSAAAAAwAAAEAAAAAAAAAALwAAAAAAAABMAAAAAwAAAD4AAAAAAAAAKwAAAAMAAABhAAAAAAAAAFkAAAADAAAARwAAAAMAAABiAAAAAwAAAFQAAAAAAAAARQAAAAAAAABgAAAAAwAAAFIAAAADAAAAQAAAAAAAAABLAAAAAAAAAEEAAAAAAAAAOgAAAAMAAAA9AAAAAAAAADUAAAADAAAALAAAAAMAAAAxAAAAAwAAACkAAAADAAAAHwAAAAMAAABeAAAAAAAAAFYAAAAAAAAATAAAAAMAAABRAAAAAwAAAEsAAAAAAAAAQQAAAAAAAABCAAAAAwAAAD0AAAAAAAAANQAAAAMAAABrAAAAAAAAAGgAAAADAAAAYAAAAAMAAABlAAAAAwAAAF4AAAAAAAAAVgAAAAAAAABVAAAAAwAAAFEAAAADAAAASwAAAAAAAAA5AAAAAAAAADsAAAAAAAAAPwAAAAMAAABKAAAAAAAAAE4AAAADAAAATwAAAAMAAABTAAAAAwAAAFwAAAADAAAAXwAAAAMAAAAlAAAAAAAAACcAAAADAAAALQAAAAMAAAA0AAAAAAAAADkAAAAAAAAAOwAAAAAAAABGAAAAAwAAAEoAAAAAAAAATgAAAAMAAAAYAAAAAAAAABcAAAADAAAAGQAAAAMAAAAgAAAAAwAAACUAAAAAAAAAJwAAAAMAAAAyAAAAAwAAADQAAAAAAAAAOQAAAAAAAAAuAAAAAAAAADwAAAAAAAAASAAAAAMAAAA4AAAAAAAAAEQAAAADAAAAUAAAAAMAAAA/AAAAAwAAAE0AAAADAAAAWgAAAAMAAAAbAAAAAAAAACgAAAADAAAANwAAAAMAAAAjAAAAAAAAAC4AAAAAAAAAPAAAAAAAAAAtAAAAAwAAADgAAAAAAAAARAAAAAMAAAAOAAAAAAAAABQAAAADAAAAJAAAAAMAAAARAAAAAwAAABsAAAAAAAAAKAAAAAMAAAAZAAAAAwAAACMAAAAAAAAALgAAAAAAAABHAAAAAAAAAFkAAAAAAAAAYQAAAAMAAABJAAAAAAAAAFsAAAADAAAAZwAAAAMAAABIAAAAAwAAAFgAAAADAAAAaQAAAAMAAAAzAAAAAAAAAEUAAAADAAAAVAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAWQAAAAAAAAA3AAAAAwAAAEkAAAAAAAAAWwAAAAMAAAAmAAAAAAAAAC8AAAADAAAAQAAAAAMAAAAiAAAAAwAAADMAAAAAAAAARQAAAAMAAAAkAAAAAwAAADYAAAAAAAAARwAAAAAAAABgAAAAAAAAAGgAAAAAAAAAawAAAAMAAABiAAAAAAAAAG4AAAADAAAAcwAAAAMAAABhAAAAAwAAAG8AAAADAAAAdwAAAAMAAABMAAAAAAAAAFYAAAADAAAAXgAAAAMAAABSAAAAAAAAAGAAAAAAAAAAaAAAAAAAAABUAAAAAwAAAGIAAAAAAAAAbgAAAAMAAAA6AAAAAAAAAEEAAAADAAAASwAAAAMAAAA+AAAAAwAAAEwAAAAAAAAAVgAAAAMAAABAAAAAAwAAAFIAAAAAAAAAYAAAAAAAAABVAAAAAAAAAFcAAAAAAAAAUwAAAAMAAABlAAAAAAAAAGYAAAADAAAAZAAAAAMAAABrAAAAAwAAAHAAAAADAAAAcgAAAAMAAABCAAAAAAAAAEMAAAADAAAARgAAAAMAAABRAAAAAAAAAFUAAAAAAAAAVwAAAAAAAABeAAAAAwAAAGUAAAAAAAAAZgAAAAMAAAAxAAAAAAAAADAAAAADAAAAMgAAAAMAAAA9AAAAAwAAAEIAAAAAAAAAQwAAAAMAAABLAAAAAwAAAFEAAAAAAAAAVQAAAAAAAABfAAAAAAAAAFwAAAAAAAAAUwAAAAAAAABPAAAAAAAAAE4AAAAAAAAASgAAAAMAAAA/AAAAAQAAADsAAAADAAAAOQAAAAMAAABtAAAAAAAAAGwAAAAAAAAAZAAAAAUAAABdAAAAAQAAAF8AAAAAAAAAXAAAAAAAAABNAAAAAQAAAE8AAAAAAAAATgAAAAAAAAB1AAAABAAAAHYAAAAFAAAAcgAAAAUAAABqAAAAAQAAAG0AAAAAAAAAbAAAAAAAAABaAAAAAQAAAF0AAAABAAAAXwAAAAAAAABaAAAAAAAAAE0AAAAAAAAAPwAAAAAAAABQAAAAAAAAAEQAAAAAAAAAOAAAAAMAAABIAAAAAQAAADwAAAADAAAALgAAAAMAAABqAAAAAAAAAF0AAAAAAAAATwAAAAUAAABjAAAAAQAAAFoAAAAAAAAATQAAAAAAAABYAAAAAQAAAFAAAAAAAAAARAAAAAAAAAB1AAAAAwAAAG0AAAAFAAAAXwAAAAUAAABxAAAAAQAAAGoAAAAAAAAAXQAAAAAAAABpAAAAAQAAAGMAAAABAAAAWgAAAAAAAABpAAAAAAAAAFgAAAAAAAAASAAAAAAAAABnAAAAAAAAAFsAAAAAAAAASQAAAAMAAABhAAAAAQAAAFkAAAADAAAARwAAAAMAAABxAAAAAAAAAGMAAAAAAAAAUAAAAAUAAAB0AAAAAQAAAGkAAAAAAAAAWAAAAAAAAABvAAAAAQAAAGcAAAAAAAAAWwAAAAAAAAB1AAAAAgAAAGoAAAAFAAAAWgAAAAUAAAB5AAAAAQAAAHEAAAAAAAAAYwAAAAAAAAB3AAAAAQAAAHQAAAABAAAAaQAAAAAAAAB3AAAAAAAAAG8AAAAAAAAAYQAAAAAAAABzAAAAAAAAAG4AAAAAAAAAYgAAAAMAAABrAAAAAQAAAGgAAAADAAAAYAAAAAMAAAB5AAAAAAAAAHQAAAAAAAAAZwAAAAUAAAB4AAAAAQAAAHcAAAAAAAAAbwAAAAAAAABwAAAAAQAAAHMAAAAAAAAAbgAAAAAAAAB1AAAAAQAAAHEAAAAFAAAAaQAAAAUAAAB2AAAAAQAAAHkAAAAAAAAAdAAAAAAAAAByAAAAAQAAAHgAAAABAAAAdwAAAAAAAAByAAAAAAAAAHAAAAAAAAAAawAAAAAAAABkAAAAAAAAAGYAAAAAAAAAZQAAAAMAAABTAAAAAQAAAFcAAAADAAAAVQAAAAMAAAB2AAAAAAAAAHgAAAAAAAAAcwAAAAUAAABsAAAAAQAAAHIAAAAAAAAAcAAAAAAAAABcAAAAAQAAAGQAAAAAAAAAZgAAAAAAAAB1AAAAAAAAAHkAAAAFAAAAdwAAAAUAAABtAAAAAQAAAHYAAAAAAAAAeAAAAAAAAABfAAAAAQAAAGwAAAABAAAAcgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAB+ogX28rbpPxqumpJv+fM/165tC4ns9D+XaEnTqUsEQFrOtNlC4PA/3U+0XG6P9b9TdUUBxTTjP4PUp8ex1ty/B1rD/EN43z+lcDi6LLrZP/a45NWEHMY/oJ5ijLDZ+j/xw3rjxWPjP2B8A46ioQdAotff3wla2z+FMSpA1jj+v6b5Y1mtPbS/cIu8K0F457/2esiyJpDNv98k5Ts2NeA/pvljWa09tD88ClUJ60MDQPZ6yLImkM0/4ONKxa0UBcD2uOTVhBzGv5G7JRxGave/8cN648Vj47+HCwtkjAXIv6LX398JWtu/qyheaCAL9D9TdUUBxTTjv4gyTxslhwVAB1rD/EN4378EH/28teoFwH6iBfbytum/F6ztFYdK/r/Xrm0Liez0vwcS6wNGWeO/Ws602ULg8L9TCtRLiLT8P8pi5RexJsw/BlIKPVwR5T95Wyu0/QjnP5PjoT7YYcu/mBhKZ6zrwj8wRYS7NebuP3qW6geh+Ls/SLrixebL3r+pcyymN9XrPwmkNHp7xec/GWNMZVAA17+82s+x2BLiPwn2ytbJ9ek/LgEH1sMS1j8yp/2LhTfeP+SnWwtQBbu/d38gkp5X7z8ytsuHaADGPzUYObdf1+m/7IauECWhwz+cjSACjzniP76Z+wUhN9K/1+GEKzup67+/GYr/04baPw6idWOvsuc/ZedTWsRa5b/EJQOuRzi0v/OncYhHPes/h49PixY53j+i8wWfC03Nvw2idWOvsue/ZedTWsRa5T/EJQOuRzi0P/KncYhHPeu/iY9PixY53r+i8wWfC03NP9anWwtQBbs/d38gkp5X778ytsuHaADGvzUYObdf1+k/74auECWhw7+cjSACjzniv8CZ+wUhN9I/1uGEKzup6z+/GYr/04bavwmkNHp7xee/F2NMZVAA1z+82s+x2BLivwr2ytbJ9em/KwEH1sMS1r8yp/2LhTfev81i5RexJsy/BlIKPVwR5b95Wyu0/Qjnv5DjoT7YYcs/nBhKZ6zrwr8wRYS7Nebuv3OW6geh+Lu/SLrixebL3j+pcyymN9Xrv8rHIFfWehZAMBwUdlo0DECTUc17EOb2PxpVB1SWChdAzjbhb9pTDUDQhmdvECX5P9FlMKCC9+g/IIAzjELgE0DajDngMv8GQFhWDmDPjNs/y1guLh96EkAxPi8k7DIEQJCc4URlhRhA3eLKKLwkEECqpNAyTBD/P6xpjXcDiwVAFtl//cQm4z+Ibt3XKiYTQM7mCLUb3QdAoM1t8yVv7D8aLZv2Nk8UQEAJPV5nQwxAtSsfTCoE9z9TPjXLXIIWQBVanC5W9AtAYM3d7Adm9j++5mQz1FoWQBUThyaVBghAwH5muQsV7T89Q1qv82MUQJoWGOfNuBdAzrkClkmwDkDQjKq77t37Py+g0dtitsE/ZwAMTwVPEUBojepluNwBQGYbtuW+t9w/HNWIJs6MEkDTNuQUSlgEQKxktPP5TcQ/ixbLB8JjEUCwuWjXMQYCQAS/R09FkRdAowpiZjhhDkB7LmlczD/7P01iQmhhsAVAnrtTwDy84z/Z6jfQ2TgTQChOCXMnWwpAhrW3daoz8z/HYJvVPI4VQLT3ik5FcA5Angi7LOZd+z+NNVzDy5gXQBXdvVTFUA1AYNMgOeYe+T8+qHXGCwkXQKQTOKwa5AJA8gFVoEMW0T+FwzJyttIRQAEAAAD/////BwAAAP////8xAAAA/////1cBAAD/////YQkAAP////+nQQAA/////5HLAQD/////95AMAP/////B9lcAAAAAAAAAAAAAAAAAAgAAAP////8OAAAA/////2IAAAD/////rgIAAP/////CEgAA/////06DAAD/////IpcDAP/////uIRkA/////4LtrwAAAAAAAAAAAAAAAAAAAAAAAgAAAP//////////AQAAAAMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////wIAAAD//////////wEAAAAAAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA/////////////////////wEAAAD///////////////8CAAAA////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD///////////////////////////////8CAAAA////////////////AQAAAP////////////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAAAQAAAP//////////AgAAAP//////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAAEAAAD//////////wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAgAAAAAAAAACAAAAAQAAAAEAAAACAAAAAgAAAAAAAAAFAAAABQAAAAAAAAACAAAAAgAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAABAAAAAgAAAAIAAAACAAAAAAAAAAUAAAAGAAAAAAAAAAIAAAACAAAAAwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAAAAAAAAgAAAAEAAAADAAAAAgAAAAIAAAAAAAAABQAAAAcAAAAAAAAAAgAAAAIAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAACAAAAAQAAAAQAAAACAAAAAgAAAAAAAAAFAAAACAAAAAAAAAACAAAAAgAAAAMAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAUAAAAJAAAAAAAAAAIAAAACAAAAAwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAIAAAACAAAAAAAAAAMAAAAOAAAAAgAAAAAAAAACAAAAAwAAAAAAAAAAAAAAAgAAAAIAAAADAAAABgAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAgAAAAIAAAAAAAAAAwAAAAoAAAACAAAAAAAAAAIAAAADAAAAAQAAAAAAAAACAAAAAgAAAAMAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAgAAAAAAAAADAAAACwAAAAIAAAAAAAAAAgAAAAMAAAACAAAAAAAAAAIAAAACAAAAAwAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAACAAAAAAAAAAMAAAAMAAAAAgAAAAAAAAACAAAAAwAAAAMAAAAAAAAAAgAAAAIAAAADAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAIAAAAAAAAAAwAAAA0AAAACAAAAAAAAAAIAAAADAAAABAAAAAAAAAACAAAAAgAAAAMAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAgAAAAAAAAADAAAABgAAAAIAAAAAAAAAAgAAAAMAAAAPAAAAAAAAAAIAAAACAAAAAwAAAAsAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAIAAAACAAAAAAAAAAMAAAAHAAAAAgAAAAAAAAACAAAAAwAAABAAAAAAAAAAAgAAAAIAAAADAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAIAAAAAAAAAAwAAAAgAAAACAAAAAAAAAAIAAAADAAAAEQAAAAAAAAACAAAAAgAAAAMAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAACAAAAAgAAAAAAAAADAAAACQAAAAIAAAAAAAAAAgAAAAMAAAASAAAAAAAAAAIAAAACAAAAAwAAAA4AAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAACAAAAAAAAAAMAAAAFAAAAAgAAAAAAAAACAAAAAwAAABMAAAAAAAAAAgAAAAIAAAADAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAgAAAAAAAAACAAAAAQAAABMAAAACAAAAAgAAAAAAAAAFAAAACgAAAAAAAAACAAAAAgAAAAMAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABEAAAACAAAAAAAAAAIAAAABAAAADwAAAAIAAAACAAAAAAAAAAUAAAALAAAAAAAAAAIAAAACAAAAAwAAABEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAIAAAAAAAAAAgAAAAEAAAAQAAAAAgAAAAIAAAAAAAAABQAAAAwAAAAAAAAAAgAAAAIAAAADAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAACAAAAAQAAABEAAAACAAAAAgAAAAAAAAAFAAAADQAAAAAAAAACAAAAAgAAAAMAAAATAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAACAAAAAAAAAAIAAAABAAAAEgAAAAIAAAACAAAAAAAAAAUAAAAOAAAAAAAAAAIAAAACAAAAAwAAAAIAAAABAAAAAAAAAAEAAAACAAAAAAAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAEAAAAAAAAAAgAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAgAAAAAAAAABAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAFAAAAAAAAAAEAAAAAAAAAAAAAAMuhRbbsNlBBYqHW9OmHIkF9XBuqnS31QAK37uYhNMhAOSo3UUupm0DC+6pc6JxvQHV9eseEEEJAzURsCyqlFEB8BQ4NMJjnPyy3tBoS97o/xawXQznRjj89J2K2CZxhP6vX43RIIDQ/S8isgygEBz+LvFHQkmzaPjFFFO7wMq4+AADMLkTtjkIAAOgkJqxhQgAAU7B0MjRCAADwpBcVB0IAAACYP2HaQQAAAIn/Ja5BzczM4Eg6gUHNzMxMU7BTQTMzMzNfgCZBAAAAAEi3+UAAAAAAwGPNQDMzMzMzy6BAmpmZmZkxc0AzMzMzM/NFQDMzMzMzMxlAzczMzMzM7D+ygXSx2U6RQKimJOvQKnpA23hmONTHY0A/AGcxyudNQNb3K647mzZA+S56rrwWIUAm4kUQ+9UJQKre9hGzh/M/BLvoy9WG3T+LmqMf8VHGP2m3nYNV37A/gbFHcyeCmT+cBPWBckiDP61tZACjKW0/q2RbYVUYVj8uDypVyLNAP6jGS5cA5zBBwcqhBdCNGUEGEhQ/JVEDQT6WPnRbNO1AB/AWSJgT1kDfUWNCNLDAQNk+5C33OqlAchWL34QSk0DKvtDIrNV8QNF0G3kFzGVASSeWhBl6UED+/0mNGuk4QGjA/dm/1CJALPLPMql6DEDSHoDrwpP1P2jouzWST+A/egAAAAAAAABKAwAAAAAAAPoWAAAAAAAAyqAAAAAAAAB6ZQQAAAAAAErGHgAAAAAA+mvXAAAAAADK8+MFAAAAAHqqOykAAAAASqmhIAEAAAD6oGvkBwAAAMpm8T43AAAAes+ZuIIBAABKrDQMkwoAAPq1cFUFSgAAyvkUViUGAgAAAAAAAwAAAAYAAAACAAAABQAAAAEAAAAEAAAAAAAAAAAAAAAFAAAAAwAAAAEAAAAGAAAABAAAAAIAAAAAAAAAAAAAAP////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAA/////wAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAP////8AAAAAAAAAAAEAAAABAAAAAAAAAAAAAAD/////AAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAA/////wUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAUAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAAAAAAABAAEAAAEBAAAAAAABAAAAAQAAAAEAAQAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAHAAAABwAAAAEAAAACAAAABAAAAAMAAAAAAAAAAAAAAAcAAAADAAAAAQAAAAIAAAAFAAAABAAAAAAAAAAAAAAAYWxnb3MuYwBfcG9seWZpbGxJbnRlcm5hbABhZGphY2VudEZhY2VEaXJbdG1wRmlqay5mYWNlXVtmaWprLmZhY2VdID09IEtJAGZhY2VpamsuYwBfZmFjZUlqa1BlbnRUb0dlb0JvdW5kYXJ5AGFkamFjZW50RmFjZURpcltjZW50ZXJJSksuZmFjZV1bZmFjZTJdID09IEtJAF9mYWNlSWprVG9HZW9Cb3VuZGFyeQBwb2x5Z29uLT5uZXh0ID09IE5VTEwAbGlua2VkR2VvLmMAYWRkTmV3TGlua2VkUG9seWdvbgBuZXh0ICE9IE5VTEwAbG9vcCAhPSBOVUxMAGFkZE5ld0xpbmtlZExvb3AAcG9seWdvbi0+Zmlyc3QgPT0gTlVMTABhZGRMaW5rZWRMb29wAGNvb3JkICE9IE5VTEwAYWRkTGlua2VkQ29vcmQAbG9vcC0+Zmlyc3QgPT0gTlVMTABpbm5lckxvb3BzICE9IE5VTEwAbm9ybWFsaXplTXVsdGlQb2x5Z29uAGJib3hlcyAhPSBOVUxMAGNhbmRpZGF0ZXMgIT0gTlVMTABmaW5kUG9seWdvbkZvckhvbGUAY2FuZGlkYXRlQkJveGVzICE9IE5VTEwAcmV2RGlyICE9IElOVkFMSURfRElHSVQAbG9jYWxpai5jAGgzVG9Mb2NhbElqawBiYXNlQ2VsbCAhPSBvcmlnaW5CYXNlQ2VsbAAhKG9yaWdpbk9uUGVudCAmJiBpbmRleE9uUGVudCkAcGVudGFnb25Sb3RhdGlvbnMgPj0gMABkaXJlY3Rpb25Sb3RhdGlvbnMgPj0gMABiYXNlQ2VsbCA9PSBvcmlnaW5CYXNlQ2VsbABiYXNlQ2VsbCAhPSBJTlZBTElEX0JBU0VfQ0VMTABsb2NhbElqa1RvSDMAIV9pc0Jhc2VDZWxsUGVudGFnb24oYmFzZUNlbGwpAGJhc2VDZWxsUm90YXRpb25zID49IDAAd2l0aGluUGVudGFnb25Sb3RhdGlvbnMgPj0gMABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl\";var jo=24032;function gn(Zt){return Zt}function Ul(Zt){var fe=/\\b__Z[\\w\\d_]+/g;return Zt.replace(fe,function(Be){var br=Be;return Be===br?Be:br+\" [\"+Be+\"]\"})}function Ca(){var Zt=new Error;if(!Zt.stack){try{throw new Error(0)}catch(fe){Zt=fe}if(!Zt.stack)return\"(no stack trace available)\"}return Zt.stack.toString()}function Te(){var Zt=Ca();return t.extraStackTrace&&(Zt+=`\n`+t.extraStackTrace()),Ul(Zt)}function Dr(Zt,fe,Be,br){oh(\"Assertion failed: \"+Xt(Zt)+\", at: \"+[fe?Xt(fe):\"unknown filename\",Be,br?Xt(br):\"unknown function\"])}function gr(){return Sr.length}function Us(Zt,fe,Be){Li.set(Li.subarray(fe,fe+Be),Zt)}function La(Zt){return t.___errno_location&&(No[t.___errno_location()>>2]=Zt),Zt}function Mr(Zt){oh(\"OOM\")}function sa(Zt){try{var fe=new ArrayBuffer(Zt);return fe.byteLength!=Zt?void 0:(new Int8Array(fe).set(Sr),xi(fe),Ns(fe),1)}catch{}}function gt(Zt){var fe=gr(),Be=16777216,br=2147483648-Be;if(Zt>br)return!1;for(var g=16777216,Vi=Math.max(fe,g);Vi>4,g=(Tt&15)<<4|Ms>>2,Vi=(Ms&3)<<6|cs,Be=Be+String.fromCharCode(br),Ms!==64&&(Be=Be+String.fromCharCode(g)),cs!==64&&(Be=Be+String.fromCharCode(Vi));while(li>2]=p,g[k+4>>2]=m,k=(C|0)!=0,k&&(g[C>>2]=0),ji(p,m)|0)return Nt=1,wt=Wt,Nt|0;g[Nt>>2]=0;t:do if((y|0)>=1)if(k)for(it=0,ot=1,Ct=1,L=0,k=p;;){if(!(L|it)){if(k=Wn(k,m,4,Nt)|0,m=It()|0,(k|0)==0&(m|0)==0){k=2;break t}if(ji(k,m)|0){k=1;break t}}if(k=Wn(k,m,g[16+(it<<2)>>2]|0,Nt)|0,m=It()|0,(k|0)==0&(m|0)==0){k=2;break t}if(p=S+(Ct<<3)|0,g[p>>2]=k,g[p+4>>2]=m,g[C+(Ct<<2)>>2]=ot,L=L+1|0,p=(L|0)==(ot|0),z=it+1|0,H=(z|0)==6,ji(k,m)|0){k=1;break t}if(ot=ot+(H&p&1)|0,(ot|0)>(y|0)){k=0;break}else it=p?H?0:z:it,Ct=Ct+1|0,L=p?0:L}else for(it=0,ot=1,Ct=1,L=0,k=p;;){if(!(L|it)){if(k=Wn(k,m,4,Nt)|0,m=It()|0,(k|0)==0&(m|0)==0){k=2;break t}if(ji(k,m)|0){k=1;break t}}if(k=Wn(k,m,g[16+(it<<2)>>2]|0,Nt)|0,m=It()|0,(k|0)==0&(m|0)==0){k=2;break t}if(p=S+(Ct<<3)|0,g[p>>2]=k,g[p+4>>2]=m,L=L+1|0,p=(L|0)==(ot|0),z=it+1|0,H=(z|0)==6,ji(k,m)|0){k=1;break t}if(ot=ot+(H&p&1)|0,(ot|0)>(y|0)){k=0;break}else it=p?H?0:z:it,Ct=Ct+1|0,L=p?0:L}else k=0;while(!1);return Nt=k,wt=Wt,Nt|0}function Ba(p,m,y,S,C,k,L){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0,k=k|0,L=L|0;var z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0;if(Ct=wt,wt=wt+16|0,ot=Ct,(p|0)==0&(m|0)==0){wt=Ct;return}if(z=Yo(p|0,m|0,k|0,((k|0)<0)<<31>>31|0)|0,It()|0,H=S+(z<<3)|0,Nt=H,Wt=g[Nt>>2]|0,Nt=g[Nt+4>>2]|0,it=(Wt|0)==(p|0)&(Nt|0)==(m|0),!((Wt|0)==0&(Nt|0)==0|it))do z=(z+1|0)%(k|0)|0,H=S+(z<<3)|0,Wt=H,Nt=g[Wt>>2]|0,Wt=g[Wt+4>>2]|0,it=(Nt|0)==(p|0)&(Wt|0)==(m|0);while(!((Nt|0)==0&(Wt|0)==0|it));if(z=C+(z<<2)|0,it&&(g[z>>2]|0)<=(L|0)){wt=Ct;return}if(Wt=H,g[Wt>>2]=p,g[Wt+4>>2]=m,g[z>>2]=L,(L|0)>=(y|0)){wt=Ct;return}Wt=L+1|0,g[ot>>2]=0,Nt=Wn(p,m,2,ot)|0,Ba(Nt,It()|0,y,S,C,k,Wt),g[ot>>2]=0,Nt=Wn(p,m,3,ot)|0,Ba(Nt,It()|0,y,S,C,k,Wt),g[ot>>2]=0,Nt=Wn(p,m,1,ot)|0,Ba(Nt,It()|0,y,S,C,k,Wt),g[ot>>2]=0,Nt=Wn(p,m,5,ot)|0,Ba(Nt,It()|0,y,S,C,k,Wt),g[ot>>2]=0,Nt=Wn(p,m,4,ot)|0,Ba(Nt,It()|0,y,S,C,k,Wt),g[ot>>2]=0,Nt=Wn(p,m,6,ot)|0,Ba(Nt,It()|0,y,S,C,k,Wt),wt=Ct}function Wn(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0;if((g[S>>2]|0)>0){C=0;do y=Na(y)|0,C=C+1|0;while((C|0)<(g[S>>2]|0))}z=me(p|0,m|0,45)|0,It()|0,H=z&127,k=Es(p,m)|0,C=me(p|0,m|0,52)|0,It()|0,C=C&15;t:do if(!C)L=6;else for(;;){if(Ct=(15-C|0)*3|0,Nt=me(p|0,m|0,Ct|0)|0,It()|0,Nt=Nt&7,Wt=(Ho(C)|0)==0,C=C+-1|0,ot=ke(7,0,Ct|0)|0,m=m&~(It()|0),Ct=ke(g[(Wt?464:48)+(Nt*28|0)+(y<<2)>>2]|0,0,Ct|0)|0,it=It()|0,y=g[(Wt?672:256)+(Nt*28|0)+(y<<2)>>2]|0,p=Ct|p&~ot,m=it|m,!y){y=0;break t}if(!C){L=6;break}}while(!1);(L|0)==6&&(Wt=g[880+(H*28|0)+(y<<2)>>2]|0,Nt=ke(Wt|0,0,45)|0,p=Nt|p,m=It()|0|m&-1040385,y=g[4304+(H*28|0)+(y<<2)>>2]|0,(Wt&127|0)==127&&(Wt=ke(g[880+(H*28|0)+20>>2]|0,0,45)|0,m=It()|0|m&-1040385,y=g[4304+(H*28|0)+20>>2]|0,p=Wo(Wt|p,m)|0,m=It()|0,g[S>>2]=(g[S>>2]|0)+1)),L=me(p|0,m|0,45)|0,It()|0,L=L&127;t:do if(fi(L)|0){e:do if((Es(p,m)|0)==1){if((H|0)!=(L|0))if(ch(L,g[7728+(H*28|0)>>2]|0)|0){p=Fd(p,m)|0,k=1,m=It()|0;break}else{p=Wo(p,m)|0,k=1,m=It()|0;break}switch(k|0){case 5:{p=Fd(p,m)|0,m=It()|0,g[S>>2]=(g[S>>2]|0)+5,k=0;break e}case 3:{p=Wo(p,m)|0,m=It()|0,g[S>>2]=(g[S>>2]|0)+1,k=0;break e}default:return Nt=0,Wt=0,Je(Nt|0),Wt|0}}else k=0;while(!1);if((y|0)>0){C=0;do p=gh(p,m)|0,m=It()|0,C=C+1|0;while((C|0)!=(y|0))}if((H|0)!=(L|0)){if(!(mu(L)|0)){if((k|0)!=0|(Es(p,m)|0)!=5)break;g[S>>2]=(g[S>>2]|0)+1;break}switch(z&127){case 8:case 118:break t;default:}(Es(p,m)|0)!=3&&(g[S>>2]=(g[S>>2]|0)+1)}}else if((y|0)>0){C=0;do p=Wo(p,m)|0,m=It()|0,C=C+1|0;while((C|0)!=(y|0))}while(!1);return g[S>>2]=((g[S>>2]|0)+y|0)%6|0,Nt=m,Wt=p,Je(Nt|0),Wt|0}function p_(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0;if(Ct=wt,wt=wt+16|0,ot=Ct,!y)return ot=S,g[ot>>2]=p,g[ot+4>>2]=m,ot=0,wt=Ct,ot|0;g[ot>>2]=0;t:do if(ji(p,m)|0)p=1;else{if(k=(y|0)>0,k){C=0,it=p;do{if(it=Wn(it,m,4,ot)|0,m=It()|0,(it|0)==0&(m|0)==0){p=2;break t}if(C=C+1|0,ji(it,m)|0){p=1;break t}}while((C|0)<(y|0));if(H=S,g[H>>2]=it,g[H+4>>2]=m,H=y+-1|0,k){k=0,L=1,C=it,p=m;do{if(C=Wn(C,p,2,ot)|0,p=It()|0,(C|0)==0&(p|0)==0){p=2;break t}if(z=S+(L<<3)|0,g[z>>2]=C,g[z+4>>2]=p,L=L+1|0,ji(C,p)|0){p=1;break t}k=k+1|0}while((k|0)<(y|0));z=0,k=L;do{if(C=Wn(C,p,3,ot)|0,p=It()|0,(C|0)==0&(p|0)==0){p=2;break t}if(L=S+(k<<3)|0,g[L>>2]=C,g[L+4>>2]=p,k=k+1|0,ji(C,p)|0){p=1;break t}z=z+1|0}while((z|0)<(y|0));L=0;do{if(C=Wn(C,p,1,ot)|0,p=It()|0,(C|0)==0&(p|0)==0){p=2;break t}if(z=S+(k<<3)|0,g[z>>2]=C,g[z+4>>2]=p,k=k+1|0,ji(C,p)|0){p=1;break t}L=L+1|0}while((L|0)<(y|0));L=0;do{if(C=Wn(C,p,5,ot)|0,p=It()|0,(C|0)==0&(p|0)==0){p=2;break t}if(z=S+(k<<3)|0,g[z>>2]=C,g[z+4>>2]=p,k=k+1|0,ji(C,p)|0){p=1;break t}L=L+1|0}while((L|0)<(y|0));L=0;do{if(C=Wn(C,p,4,ot)|0,p=It()|0,(C|0)==0&(p|0)==0){p=2;break t}if(z=S+(k<<3)|0,g[z>>2]=C,g[z+4>>2]=p,k=k+1|0,ji(C,p)|0){p=1;break t}L=L+1|0}while((L|0)<(y|0));for(L=0;;){if(C=Wn(C,p,6,ot)|0,p=It()|0,(C|0)==0&(p|0)==0){p=2;break t}if((L|0)!=(H|0))if(z=S+(k<<3)|0,g[z>>2]=C,g[z+4>>2]=p,!(ji(C,p)|0))k=k+1|0;else{p=1;break t}if(L=L+1|0,(L|0)>=(y|0)){L=it,k=m;break}}}else L=it,C=it,k=m,p=m}else L=S,g[L>>2]=p,g[L+4>>2]=m,L=p,C=p,k=m,p=m;p=((L|0)!=(C|0)|(k|0)!=(p|0))&1}while(!1);return ot=p,wt=Ct,ot|0}function Cd(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0;if(k=wt,wt=wt+48|0,C=k+8|0,S=k,z=p,L=g[z+4>>2]|0,y=S,g[y>>2]=g[z>>2],g[y+4>>2]=L,Ee(S,C),C=uh(C,m)|0,m=g[S>>2]|0,S=g[p+8>>2]|0,(S|0)<=0)return z=m,L=(C|0)<(z|0),z=L?z:C,z=z+12|0,wt=k,z|0;y=g[p+12>>2]|0,p=0;do m=(g[y+(p<<3)>>2]|0)+m|0,p=p+1|0;while((p|0)<(S|0));return z=(C|0)<(m|0),z=z?m:C,z=z+12|0,wt=k,z|0}function $p(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0;if(z=wt,wt=wt+48|0,S=z+8|0,C=z,!(Xp(p,m,y)|0)){wt=z;return}if(H=p,k=g[H+4>>2]|0,L=C,g[L>>2]=g[H>>2],g[L+4>>2]=k,Ee(C,S),L=uh(S,m)|0,m=g[C>>2]|0,k=g[p+8>>2]|0,(k|0)>0){C=g[p+12>>2]|0,S=0;do m=(g[C+(S<<3)>>2]|0)+m|0,S=S+1|0;while((S|0)!=(k|0))}if(m=(L|0)<(m|0)?m:L,(m|0)<=-12){wt=z;return}H=m+11|0,Fc(y|0,0,(((H|0)>0?H:0)<<3)+8|0)|0,wt=z}function Xp(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0,we=0,je=0,Zr=0,qi=0,Ei=0,hn=0,Pi=0,Sn=0,yn=0,Or=0;if(Or=wt,wt=wt+112|0,hn=Or+80|0,H=Or+72|0,Pi=Or,Sn=Or+56|0,it=p+8|0,yn=ho((g[it>>2]<<5)+32|0)|0,yn||Mi(22848,22448,800,22456),pr(p,yn),k=p,S=g[k+4>>2]|0,z=H,g[z>>2]=g[k>>2],g[z+4>>2]=S,Ee(H,hn),z=uh(hn,m)|0,S=g[H>>2]|0,k=g[it>>2]|0,(k|0)>0){L=g[p+12>>2]|0,C=0;do S=(g[L+(C<<3)>>2]|0)+S|0,C=C+1|0;while((C|0)!=(k|0))}if(z=(z|0)<(S|0)?S:z,Ei=z+12|0,C=Ua(Ei,8)|0,ot=Ua(Ei,8)|0,g[hn>>2]=0,Zr=p,qi=g[Zr+4>>2]|0,S=H,g[S>>2]=g[Zr>>2],g[S+4>>2]=qi,S=i0(H,Ei,m,hn,C,ot)|0,S|0)return Gr(C),Gr(ot),Gr(yn),yn=S,wt=Or,yn|0;t:do if((g[it>>2]|0)>0){for(k=p+12|0,S=0;L=i0((g[k>>2]|0)+(S<<3)|0,Ei,m,hn,C,ot)|0,S=S+1|0,!(L|0);)if((S|0)>=(g[it>>2]|0))break t;return Gr(C),Gr(ot),Gr(yn),yn=L,wt=Or,yn|0}while(!1);(z|0)>-12&&Fc(ot|0,0,((Ei|0)>1?Ei:1)<<3|0)|0;t:do if((g[hn>>2]|0)>0){qi=((Ei|0)<0)<<31>>31,Ut=C,$e=ot,er=C,we=C,je=ot,Zr=C,S=C,Le=C,We=ot,te=ot,_e=ot,C=ot;e:for(;;){for(ne=g[hn>>2]|0,Wt=0,re=0,k=0;;){L=Pi,z=L+56|0;do g[L>>2]=0,L=L+4|0;while((L|0)<(z|0));if(m=Ut+(Wt<<3)|0,H=g[m>>2]|0,m=g[m+4>>2]|0,yf(H,m,1,Pi,0)|0){L=Pi,z=L+56|0;do g[L>>2]=0,L=L+4|0;while((L|0)<(z|0));L=Ua(7,4)|0,L|0&&(Ba(H,m,1,Pi,L,7,0),Gr(L))}Nt=0;do{Ct=Pi+(Nt<<3)|0,ot=g[Ct>>2]|0,Ct=g[Ct+4>>2]|0;r:do if(!((ot|0)==0&(Ct|0)==0)){if(H=Yo(ot|0,Ct|0,Ei|0,qi|0)|0,It()|0,L=y+(H<<3)|0,z=L,m=g[z>>2]|0,z=g[z+4>>2]|0,!((m|0)==0&(z|0)==0))for(it=0;;){if((it|0)>(Ei|0))break e;if((m|0)==(ot|0)&(z|0)==(Ct|0))break r;if(H=(H+1|0)%(Ei|0)|0,L=y+(H<<3)|0,z=L,m=g[z>>2]|0,z=g[z+4>>2]|0,(m|0)==0&(z|0)==0)break;it=it+1|0}(ot|0)==0&(Ct|0)==0||(l(ot,Ct,Sn),tr(p,yn,Sn)|0&&(it=L,g[it>>2]=ot,g[it+4>>2]=Ct,it=$e+(k<<3)|0,g[it>>2]=ot,g[it+4>>2]=Ct,k=k+1|0))}while(!1);Nt=Nt+1|0}while(Nt>>>0<7);if(re=re+1|0,(re|0)>=(ne|0))break;Wt=Wt+1|0}if((ne|0)>0&&Fc(er|0,0,ne<<3|0)|0,g[hn>>2]=k,(k|0)>0)ot=C,Ct=_e,Nt=Zr,Wt=te,re=We,ne=$e,C=Le,_e=S,te=we,We=er,Le=ot,S=Ct,Zr=je,je=Nt,we=Wt,er=re,$e=Ut,Ut=ne;else break t}return Gr(we),Gr(je),Gr(yn),yn=-1,wt=Or,yn|0}else S=ot;while(!1);return Gr(yn),Gr(C),Gr(S),yn=0,wt=Or,yn|0}function i0(p,m,y,S,C,k){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0,k=k|0;var L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0,we=0,je=0,Zr=0,qi=0,Ei=0,hn=0;if(qi=wt,wt=wt+48|0,er=qi+32|0,we=qi+16|0,je=qi,L=g[p>>2]|0,(L|0)<=0)return Zr=0,wt=qi,Zr|0;We=p+4|0,te=er+8|0,_e=we+8|0,Ut=je+8|0,$e=((m|0)<0)<<31>>31,Le=0;t:for(;;){z=g[We>>2]|0,re=z+(Le<<4)|0,g[er>>2]=g[re>>2],g[er+4>>2]=g[re+4>>2],g[er+8>>2]=g[re+8>>2],g[er+12>>2]=g[re+12>>2],(Le|0)==(L+-1|0)?(g[we>>2]=g[z>>2],g[we+4>>2]=g[z+4>>2],g[we+8>>2]=g[z+8>>2],g[we+12>>2]=g[z+12>>2]):(re=z+(Le+1<<4)|0,g[we>>2]=g[re>>2],g[we+4>>2]=g[re+4>>2],g[we+8>>2]=g[re+8>>2],g[we+12>>2]=g[re+12>>2]),re=la(er,we,y)|0;e:do if((re|0)>0){ne=+(re|0),Wt=0;r:for(;;){hn=+(re-Wt|0),Ei=+(Wt|0),Tt[je>>3]=+Tt[er>>3]*hn/ne+ +Tt[we>>3]*Ei/ne,Tt[Ut>>3]=+Tt[te>>3]*hn/ne+ +Tt[_e>>3]*Ei/ne,Ct=lA(je,y)|0,Nt=It()|0,z=Yo(Ct|0,Nt|0,m|0,$e|0)|0,It()|0,L=k+(z<<3)|0,H=L,it=g[H>>2]|0,H=g[H+4>>2]|0;i:do if((it|0)==0&(H|0)==0)Zr=14;else for(ot=0;;){if((ot|0)>(m|0)){L=1;break i}if((it|0)==(Ct|0)&(H|0)==(Nt|0)){L=7;break i}if(z=(z+1|0)%(m|0)|0,L=k+(z<<3)|0,H=L,it=g[H>>2]|0,H=g[H+4>>2]|0,(it|0)==0&(H|0)==0){Zr=14;break}else ot=ot+1|0}while(!1);switch((Zr|0)==14&&(Zr=0,(Ct|0)==0&(Nt|0)==0?L=7:(g[L>>2]=Ct,g[L+4>>2]=Nt,L=g[S>>2]|0,ot=C+(L<<3)|0,g[ot>>2]=Ct,g[ot+4>>2]=Nt,g[S>>2]=L+1,L=0)),L&7){case 7:case 0:break;default:break r}if(Wt=Wt+1|0,(re|0)<=(Wt|0)){Zr=8;break e}}if(L|0){L=-1,Zr=20;break t}}else Zr=8;while(!1);if((Zr|0)==8&&(Zr=0),Le=Le+1|0,L=g[p>>2]|0,(Le|0)>=(L|0)){L=0,Zr=20;break}}return(Zr|0)==20?(wt=qi,L|0):0}function Cn(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0;if(it=wt,wt=wt+176|0,H=it,(m|0)<1){vu(y,0,0),wt=it;return}L=p,L=me(g[L>>2]|0,g[L+4>>2]|0,52)|0,It()|0,vu(y,(m|0)>6?m:6,L&15),L=0;do{if(S=p+(L<<3)|0,d(g[S>>2]|0,g[S+4>>2]|0,H),S=g[H>>2]|0,(S|0)>0){z=0;do k=H+8+(z<<4)|0,z=z+1|0,S=H+8+(((z|0)%(S|0)|0)<<4)|0,C=yh(y,S,k)|0,C?Ps(y,C)|0:Eo(y,k,S)|0,S=g[H>>2]|0;while((z|0)<(S|0))}L=L+1|0}while((L|0)!=(m|0));wt=it}function ah(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0;if(k=wt,wt=wt+32|0,S=k,C=k+16|0,Cn(p,m,C),g[y>>2]=0,g[y+4>>2]=0,g[y+8>>2]=0,p=Ws(C)|0,!p){Ht(y)|0,_h(C),wt=k;return}do{m=yt(y)|0;do dt(m,p)|0,L=p+16|0,g[S>>2]=g[L>>2],g[S+4>>2]=g[L+4>>2],g[S+8>>2]=g[L+8>>2],g[S+12>>2]=g[L+12>>2],Ps(C,p)|0,p=Fn(C,S)|0;while(p|0);p=Ws(C)|0}while(p|0);Ht(y)|0,_h(C),wt=k}function fi(p){return p=p|0,g[7728+(p*28|0)+16>>2]|0}function mu(p){return p=p|0,(p|0)==4|(p|0)==117|0}function vf(p){return p=p|0,g[11152+((g[p>>2]|0)*216|0)+((g[p+4>>2]|0)*72|0)+((g[p+8>>2]|0)*24|0)+(g[p+12>>2]<<3)>>2]|0}function Kp(p){return p=p|0,g[11152+((g[p>>2]|0)*216|0)+((g[p+4>>2]|0)*72|0)+((g[p+8>>2]|0)*24|0)+(g[p+12>>2]<<3)+4>>2]|0}function lh(p,m){p=p|0,m=m|0,p=7728+(p*28|0)|0,g[m>>2]=g[p>>2],g[m+4>>2]=g[p+4>>2],g[m+8>>2]=g[p+8>>2],g[m+12>>2]=g[p+12>>2]}function Ld(p,m){p=p|0,m=m|0;var y=0,S=0;if(m>>>0>20)return m=-1,m|0;do if((g[11152+(m*216|0)>>2]|0)!=(p|0))if((g[11152+(m*216|0)+8>>2]|0)!=(p|0))if((g[11152+(m*216|0)+16>>2]|0)!=(p|0))if((g[11152+(m*216|0)+24>>2]|0)!=(p|0))if((g[11152+(m*216|0)+32>>2]|0)!=(p|0))if((g[11152+(m*216|0)+40>>2]|0)!=(p|0))if((g[11152+(m*216|0)+48>>2]|0)!=(p|0))if((g[11152+(m*216|0)+56>>2]|0)!=(p|0))if((g[11152+(m*216|0)+64>>2]|0)!=(p|0))if((g[11152+(m*216|0)+72>>2]|0)!=(p|0))if((g[11152+(m*216|0)+80>>2]|0)!=(p|0))if((g[11152+(m*216|0)+88>>2]|0)!=(p|0))if((g[11152+(m*216|0)+96>>2]|0)!=(p|0))if((g[11152+(m*216|0)+104>>2]|0)!=(p|0))if((g[11152+(m*216|0)+112>>2]|0)!=(p|0))if((g[11152+(m*216|0)+120>>2]|0)!=(p|0))if((g[11152+(m*216|0)+128>>2]|0)!=(p|0))if((g[11152+(m*216|0)+136>>2]|0)==(p|0))p=2,y=1,S=2;else{if((g[11152+(m*216|0)+144>>2]|0)==(p|0)){p=0,y=2,S=0;break}if((g[11152+(m*216|0)+152>>2]|0)==(p|0)){p=0,y=2,S=1;break}if((g[11152+(m*216|0)+160>>2]|0)==(p|0)){p=0,y=2,S=2;break}if((g[11152+(m*216|0)+168>>2]|0)==(p|0)){p=1,y=2,S=0;break}if((g[11152+(m*216|0)+176>>2]|0)==(p|0)){p=1,y=2,S=1;break}if((g[11152+(m*216|0)+184>>2]|0)==(p|0)){p=1,y=2,S=2;break}if((g[11152+(m*216|0)+192>>2]|0)==(p|0)){p=2,y=2,S=0;break}if((g[11152+(m*216|0)+200>>2]|0)==(p|0)){p=2,y=2,S=1;break}if((g[11152+(m*216|0)+208>>2]|0)==(p|0)){p=2,y=2,S=2;break}else p=-1;return p|0}else p=2,y=1,S=1;else p=2,y=1,S=0;else p=1,y=1,S=2;else p=1,y=1,S=1;else p=1,y=1,S=0;else p=0,y=1,S=2;else p=0,y=1,S=1;else p=0,y=1,S=0;else p=2,y=0,S=2;else p=2,y=0,S=1;else p=2,y=0,S=0;else p=1,y=0,S=2;else p=1,y=0,S=1;else p=1,y=0,S=0;else p=0,y=0,S=2;else p=0,y=0,S=1;else p=0,y=0,S=0;while(!1);return m=g[11152+(m*216|0)+(y*72|0)+(p*24|0)+(S<<3)+4>>2]|0,m|0}function ch(p,m){return p=p|0,m=m|0,(g[7728+(p*28|0)+20>>2]|0)==(m|0)?(m=1,m|0):(m=(g[7728+(p*28|0)+24>>2]|0)==(m|0),m|0)}function Jp(p,m){return p=p|0,m=m|0,g[880+(p*28|0)+(m<<2)>>2]|0}function tA(p,m){return p=p|0,m=m|0,(g[880+(p*28|0)>>2]|0)==(m|0)?(m=0,m|0):(g[880+(p*28|0)+4>>2]|0)==(m|0)?(m=1,m|0):(g[880+(p*28|0)+8>>2]|0)==(m|0)?(m=2,m|0):(g[880+(p*28|0)+12>>2]|0)==(m|0)?(m=3,m|0):(g[880+(p*28|0)+16>>2]|0)==(m|0)?(m=4,m|0):(g[880+(p*28|0)+20>>2]|0)==(m|0)?(m=5,m|0):((g[880+(p*28|0)+24>>2]|0)==(m|0)?6:7)|0}function A_(){return 122}function m_(p){p=p|0;var m=0,y=0,S=0;m=0;do ke(m|0,0,45)|0,S=It()|0|134225919,y=p+(m<<3)|0,g[y>>2]=-1,g[y+4>>2]=S,m=m+1|0;while((m|0)!=122)}function n0(p){return p=p|0,+Tt[p+16>>3]<+Tt[p+24>>3]|0}function pl(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;return y=+Tt[m>>3],!(y>=+Tt[p+8>>3])||!(y<=+Tt[p>>3])?(m=0,m|0):(S=+Tt[p+16>>3],y=+Tt[p+24>>3],C=+Tt[m+8>>3],m=C>=y,p=C<=S&1,S>2]=0,k=k+4|0;while((k|0)<(z|0));return O(m,C),k=C,z=g[k>>2]|0,k=g[k+4>>2]|0,l(z,k,y),d(z,k,S),H=+Bc(y,S+8|0),Tt[y>>3]=+Tt[p>>3],k=y+8|0,Tt[k>>3]=+Tt[p+16>>3],Tt[S>>3]=+Tt[p+8>>3],z=S+8|0,Tt[z>>3]=+Tt[p+24>>3],it=+Bc(y,S),z=~~+Ji(+(it*it/+ml(+ +li(+((+Tt[k>>3]-+Tt[z>>3])/(+Tt[y>>3]-+Tt[S>>3]))),3)/(H*(H*2.59807621135)*.8))),wt=L,(z|0?z:1)|0}function la(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0;z=wt,wt=wt+288|0,S=z+264|0,C=z+96|0,k=z,L=k,H=L+96|0;do g[L>>2]=0,L=L+4|0;while((L|0)<(H|0));return O(y,k),H=k,L=g[H>>2]|0,H=g[H+4>>2]|0,l(L,H,S),d(L,H,C),it=+Bc(S,C+8|0),H=~~+Ji(+(+Bc(p,m)/(it*2))),wt=z,(H|0?H:1)|0}function kd(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0,g[p>>2]=m,g[p+4>>2]=y,g[p+8>>2]=S}function g_(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0;Ct=m+8|0,g[Ct>>2]=0,H=+Tt[p>>3],L=+li(+H),it=+Tt[p+8>>3],z=+li(+it)/.8660254037844386,L=L+z*.5,y=~~L,p=~~z,L=L-+(y|0),z=z-+(p|0);do if(L<.5)if(L<.3333333333333333)if(g[m>>2]=y,z<(L+1)*.5){g[m+4>>2]=p;break}else{p=p+1|0,g[m+4>>2]=p;break}else if(Nt=1-L,p=(!(z>2]=p,Nt<=z&z>2]=y;break}else{g[m>>2]=y;break}else{if(!(L<.6666666666666666))if(y=y+1|0,g[m>>2]=y,z>2]=p;break}else{p=p+1|0,g[m+4>>2]=p;break}if(z<1-L){if(g[m+4>>2]=p,L*2+-1>2]=y;break}}else p=p+1|0,g[m+4>>2]=p;y=y+1|0,g[m>>2]=y}while(!1);do if(H<0)if(p&1){ot=(p+1|0)/2|0,ot=zd(y|0,((y|0)<0)<<31>>31|0,ot|0,((ot|0)<0)<<31>>31|0)|0,y=~~(+(y|0)-((+(ot>>>0)+4294967296*+(It()|0))*2+1)),g[m>>2]=y;break}else{ot=(p|0)/2|0,ot=zd(y|0,((y|0)<0)<<31>>31|0,ot|0,((ot|0)<0)<<31>>31|0)|0,y=~~(+(y|0)-(+(ot>>>0)+4294967296*+(It()|0))*2),g[m>>2]=y;break}while(!1);ot=m+4|0,it<0&&(y=y-((p<<1|1|0)/2|0)|0,g[m>>2]=y,p=0-p|0,g[ot>>2]=p),S=p-y|0,(y|0)<0?(C=0-y|0,g[ot>>2]=S,g[Ct>>2]=C,g[m>>2]=0,p=S,y=0):C=0,(p|0)<0&&(y=y-p|0,g[m>>2]=y,C=C-p|0,g[Ct>>2]=C,g[ot>>2]=0,p=0),k=y-C|0,S=p-C|0,(C|0)<0&&(g[m>>2]=k,g[ot>>2]=S,g[Ct>>2]=0,p=S,y=k,C=0),S=(p|0)<(y|0)?p:y,S=(C|0)<(S|0)?C:S,!((S|0)<=0)&&(g[m>>2]=y-S,g[ot>>2]=p-S,g[Ct>>2]=C-S)}function js(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0;m=g[p>>2]|0,L=p+4|0,y=g[L>>2]|0,(m|0)<0&&(y=y-m|0,g[L>>2]=y,k=p+8|0,g[k>>2]=(g[k>>2]|0)-m,g[p>>2]=0,m=0),(y|0)<0?(m=m-y|0,g[p>>2]=m,k=p+8|0,C=(g[k>>2]|0)-y|0,g[k>>2]=C,g[L>>2]=0,y=0):(C=p+8|0,k=C,C=g[C>>2]|0),(C|0)<0&&(m=m-C|0,g[p>>2]=m,y=y-C|0,g[L>>2]=y,g[k>>2]=0,C=0),S=(y|0)<(m|0)?y:m,S=(C|0)<(S|0)?C:S,!((S|0)<=0)&&(g[p>>2]=m-S,g[L>>2]=y-S,g[k>>2]=C-S)}function gu(p,m){p=p|0,m=m|0;var y=0,S=0;S=g[p+8>>2]|0,y=+((g[p+4>>2]|0)-S|0),Tt[m>>3]=+((g[p>>2]|0)-S|0)-y*.5,Tt[m+8>>3]=y*.8660254037844386}function Ln(p,m,y){p=p|0,m=m|0,y=y|0,g[y>>2]=(g[m>>2]|0)+(g[p>>2]|0),g[y+4>>2]=(g[m+4>>2]|0)+(g[p+4>>2]|0),g[y+8>>2]=(g[m+8>>2]|0)+(g[p+8>>2]|0)}function eA(p,m,y){p=p|0,m=m|0,y=y|0,g[y>>2]=(g[p>>2]|0)-(g[m>>2]|0),g[y+4>>2]=(g[p+4>>2]|0)-(g[m+4>>2]|0),g[y+8>>2]=(g[p+8>>2]|0)-(g[m+8>>2]|0)}function ca(p,m){p=p|0,m=m|0;var y=0,S=0;y=Oc(g[p>>2]|0,m)|0,g[p>>2]=y,y=p+4|0,S=Oc(g[y>>2]|0,m)|0,g[y>>2]=S,p=p+8|0,m=Oc(g[p>>2]|0,m)|0,g[p>>2]=m}function Fa(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;L=g[p>>2]|0,z=(L|0)<0,S=(g[p+4>>2]|0)-(z?L:0)|0,k=(S|0)<0,C=(k?0-S|0:0)+((g[p+8>>2]|0)-(z?L:0))|0,y=(C|0)<0,p=y?0:C,m=(k?0:S)-(y?C:0)|0,C=(z?0:L)-(k?S:0)-(y?C:0)|0,y=(m|0)<(C|0)?m:C,y=(p|0)<(y|0)?p:y,S=(y|0)>0,p=p-(S?y:0)|0,m=m-(S?y:0)|0;t:do switch(C-(S?y:0)|0){case 0:switch(m|0){case 0:return z=p|0?(p|0)==1?1:7:0,z|0;case 1:return z=p|0?(p|0)==1?3:7:2,z|0;default:break t}case 1:switch(m|0){case 0:return z=p|0?(p|0)==1?5:7:4,z|0;case 1:{if(!p)p=6;else break t;return p|0}default:break t}default:}while(!1);return z=7,z|0}function Rd(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;L=p+8|0,y=g[L>>2]|0,m=(g[p>>2]|0)-y|0,z=p+4|0,y=(g[z>>2]|0)-y|0,S=_n(+((m*3|0)-y|0)/7)|0,g[p>>2]=S,m=_n(+((y<<1)+m|0)/7)|0,g[z>>2]=m,g[L>>2]=0,y=m-S|0,(S|0)<0?(k=0-S|0,g[z>>2]=y,g[L>>2]=k,g[p>>2]=0,m=y,S=0,y=k):y=0,(m|0)<0&&(S=S-m|0,g[p>>2]=S,y=y-m|0,g[L>>2]=y,g[z>>2]=0,m=0),k=S-y|0,C=m-y|0,(y|0)<0?(g[p>>2]=k,g[z>>2]=C,g[L>>2]=0,m=C,C=k,y=0):C=S,S=(m|0)<(C|0)?m:C,S=(y|0)<(S|0)?y:S,!((S|0)<=0)&&(g[p>>2]=C-S,g[z>>2]=m-S,g[L>>2]=y-S)}function Al(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;L=p+8|0,y=g[L>>2]|0,m=(g[p>>2]|0)-y|0,z=p+4|0,y=(g[z>>2]|0)-y|0,S=_n(+((m<<1)+y|0)/7)|0,g[p>>2]=S,m=_n(+((y*3|0)-m|0)/7)|0,g[z>>2]=m,g[L>>2]=0,y=m-S|0,(S|0)<0?(k=0-S|0,g[z>>2]=y,g[L>>2]=k,g[p>>2]=0,m=y,S=0,y=k):y=0,(m|0)<0&&(S=S-m|0,g[p>>2]=S,y=y-m|0,g[L>>2]=y,g[z>>2]=0,m=0),k=S-y|0,C=m-y|0,(y|0)<0?(g[p>>2]=k,g[z>>2]=C,g[L>>2]=0,m=C,C=k,y=0):C=S,S=(m|0)<(C|0)?m:C,S=(y|0)<(S|0)?y:S,!((S|0)<=0)&&(g[p>>2]=C-S,g[z>>2]=m-S,g[L>>2]=y-S)}function za(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;m=g[p>>2]|0,L=p+4|0,y=g[L>>2]|0,z=p+8|0,S=g[z>>2]|0,C=y+(m*3|0)|0,g[p>>2]=C,y=S+(y*3|0)|0,g[L>>2]=y,m=(S*3|0)+m|0,g[z>>2]=m,S=y-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=S,g[z>>2]=m,g[p>>2]=0,y=S,S=0):S=C,(y|0)<0&&(S=S-y|0,g[p>>2]=S,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=S-m|0,C=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=C,g[z>>2]=0,S=k,m=0):C=y,y=(C|0)<(S|0)?C:S,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=S-y,g[L>>2]=C-y,g[z>>2]=m-y)}function hh(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;C=g[p>>2]|0,L=p+4|0,m=g[L>>2]|0,z=p+8|0,y=g[z>>2]|0,S=(m*3|0)+C|0,C=y+(C*3|0)|0,g[p>>2]=C,g[L>>2]=S,m=(y*3|0)+m|0,g[z>>2]=m,y=S-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=y,g[z>>2]=m,g[p>>2]=0,C=0):y=S,(y|0)<0&&(C=C-y|0,g[p>>2]=C,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=C-m|0,S=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=S,g[z>>2]=0,C=k,m=0):S=y,y=(S|0)<(C|0)?S:C,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=C-y,g[L>>2]=S-y,g[z>>2]=m-y)}function rA(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0;(m+-1|0)>>>0>=6||(C=(g[15472+(m*12|0)>>2]|0)+(g[p>>2]|0)|0,g[p>>2]=C,z=p+4|0,S=(g[15472+(m*12|0)+4>>2]|0)+(g[z>>2]|0)|0,g[z>>2]=S,L=p+8|0,m=(g[15472+(m*12|0)+8>>2]|0)+(g[L>>2]|0)|0,g[L>>2]=m,y=S-C|0,(C|0)<0?(m=m-C|0,g[z>>2]=y,g[L>>2]=m,g[p>>2]=0,S=0):(y=S,S=C),(y|0)<0&&(S=S-y|0,g[p>>2]=S,m=m-y|0,g[L>>2]=m,g[z>>2]=0,y=0),k=S-m|0,C=y-m|0,(m|0)<0?(g[p>>2]=k,g[z>>2]=C,g[L>>2]=0,S=k,m=0):C=y,y=(C|0)<(S|0)?C:S,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=S-y,g[z>>2]=C-y,g[L>>2]=m-y))}function s0(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;C=g[p>>2]|0,L=p+4|0,m=g[L>>2]|0,z=p+8|0,y=g[z>>2]|0,S=m+C|0,C=y+C|0,g[p>>2]=C,g[L>>2]=S,m=y+m|0,g[z>>2]=m,y=S-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=y,g[z>>2]=m,g[p>>2]=0,S=0):(y=S,S=C),(y|0)<0&&(S=S-y|0,g[p>>2]=S,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=S-m|0,C=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=C,g[z>>2]=0,S=k,m=0):C=y,y=(C|0)<(S|0)?C:S,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=S-y,g[L>>2]=C-y,g[z>>2]=m-y)}function fh(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;m=g[p>>2]|0,L=p+4|0,S=g[L>>2]|0,z=p+8|0,y=g[z>>2]|0,C=S+m|0,g[p>>2]=C,S=y+S|0,g[L>>2]=S,m=y+m|0,g[z>>2]=m,y=S-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=y,g[z>>2]=m,g[p>>2]=0,S=0):(y=S,S=C),(y|0)<0&&(S=S-y|0,g[p>>2]=S,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=S-m|0,C=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=C,g[z>>2]=0,S=k,m=0):C=y,y=(C|0)<(S|0)?C:S,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=S-y,g[L>>2]=C-y,g[z>>2]=m-y)}function Na(p){switch(p=p|0,p|0){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:}return p|0}function co(p){switch(p=p|0,p|0){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:}return p|0}function Ge(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;m=g[p>>2]|0,L=p+4|0,y=g[L>>2]|0,z=p+8|0,S=g[z>>2]|0,C=y+(m<<1)|0,g[p>>2]=C,y=S+(y<<1)|0,g[L>>2]=y,m=(S<<1)+m|0,g[z>>2]=m,S=y-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=S,g[z>>2]=m,g[p>>2]=0,y=S,S=0):S=C,(y|0)<0&&(S=S-y|0,g[p>>2]=S,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=S-m|0,C=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=C,g[z>>2]=0,S=k,m=0):C=y,y=(C|0)<(S|0)?C:S,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=S-y,g[L>>2]=C-y,g[z>>2]=m-y)}function Dd(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;C=g[p>>2]|0,L=p+4|0,m=g[L>>2]|0,z=p+8|0,y=g[z>>2]|0,S=(m<<1)+C|0,C=y+(C<<1)|0,g[p>>2]=C,g[L>>2]=S,m=(y<<1)+m|0,g[z>>2]=m,y=S-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=y,g[z>>2]=m,g[p>>2]=0,C=0):y=S,(y|0)<0&&(C=C-y|0,g[p>>2]=C,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=C-m|0,S=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=S,g[z>>2]=0,C=k,m=0):S=y,y=(S|0)<(C|0)?S:C,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=C-y,g[L>>2]=S-y,g[z>>2]=m-y)}function Hl(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0;return L=(g[p>>2]|0)-(g[m>>2]|0)|0,z=(L|0)<0,S=(g[p+4>>2]|0)-(g[m+4>>2]|0)-(z?L:0)|0,k=(S|0)<0,C=(z?0-L|0:0)+(g[p+8>>2]|0)-(g[m+8>>2]|0)+(k?0-S|0:0)|0,p=(C|0)<0,m=p?0:C,y=(k?0:S)-(p?C:0)|0,C=(z?0:L)-(k?S:0)-(p?C:0)|0,p=(y|0)<(C|0)?y:C,p=(m|0)<(p|0)?m:p,S=(p|0)>0,m=m-(S?p:0)|0,y=y-(S?p:0)|0,p=C-(S?p:0)|0,p=(p|0)>-1?p:0-p|0,y=(y|0)>-1?y:0-y|0,m=(m|0)>-1?m:0-m|0,m=(y|0)>(m|0)?y:m,((p|0)>(m|0)?p:m)|0}function xf(p,m){p=p|0,m=m|0;var y=0;y=g[p+8>>2]|0,g[m>>2]=(g[p>>2]|0)-y,g[m+4>>2]=(g[p+4>>2]|0)-y}function __(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0;S=g[p>>2]|0,g[m>>2]=S,p=g[p+4>>2]|0,L=m+4|0,g[L>>2]=p,z=m+8|0,g[z>>2]=0,y=p-S|0,(S|0)<0?(p=0-S|0,g[L>>2]=y,g[z>>2]=p,g[m>>2]=0,S=0):(y=p,p=0),(y|0)<0&&(S=S-y|0,g[m>>2]=S,p=p-y|0,g[z>>2]=p,g[L>>2]=0,y=0),k=S-p|0,C=y-p|0,(p|0)<0?(g[m>>2]=k,g[L>>2]=C,g[z>>2]=0,y=C,C=k,p=0):C=S,S=(y|0)<(C|0)?y:C,S=(p|0)<(S|0)?p:S,!((S|0)<=0)&&(g[m>>2]=C-S,g[L>>2]=y-S,g[z>>2]=p-S)}function Oe(p){p=p|0;var m=0,y=0,S=0,C=0;m=p+8|0,C=g[m>>2]|0,y=C-(g[p>>2]|0)|0,g[p>>2]=y,S=p+4|0,p=(g[S>>2]|0)-C|0,g[S>>2]=p,g[m>>2]=0-(p+y)}function o0(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;y=g[p>>2]|0,m=0-y|0,g[p>>2]=m,L=p+8|0,g[L>>2]=0,z=p+4|0,S=g[z>>2]|0,C=S+y|0,(y|0)>0?(g[z>>2]=C,g[L>>2]=y,g[p>>2]=0,m=0,S=C):y=0,(S|0)<0?(k=m-S|0,g[p>>2]=k,y=y-S|0,g[L>>2]=y,g[z>>2]=0,C=k-y|0,m=0-y|0,(y|0)<0?(g[p>>2]=C,g[z>>2]=m,g[L>>2]=0,S=m,y=0):(S=0,C=k)):C=m,m=(S|0)<(C|0)?S:C,m=(y|0)<(m|0)?y:m,!((m|0)<=0)&&(g[p>>2]=C-m,g[z>>2]=S-m,g[L>>2]=y-m)}function a0(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;S=wt,wt=wt+16|0,C=S,zx(p,m,y,C),g_(C,y+4|0),wt=S}function zx(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0;if(H=wt,wt=wt+32|0,k=H,ql(p,k),g[y>>2]=0,C=+jr(15888,k),L=+jr(15912,k),L>2]=1,C=L),L=+jr(15936,k),L>2]=2,C=L),L=+jr(15960,k),L>2]=3,C=L),L=+jr(15984,k),L>2]=4,C=L),L=+jr(16008,k),L>2]=5,C=L),L=+jr(16032,k),L>2]=6,C=L),L=+jr(16056,k),L>2]=7,C=L),L=+jr(16080,k),L>2]=8,C=L),L=+jr(16104,k),L>2]=9,C=L),L=+jr(16128,k),L>2]=10,C=L),L=+jr(16152,k),L>2]=11,C=L),L=+jr(16176,k),L>2]=12,C=L),L=+jr(16200,k),L>2]=13,C=L),L=+jr(16224,k),L>2]=14,C=L),L=+jr(16248,k),L>2]=15,C=L),L=+jr(16272,k),L>2]=16,C=L),L=+jr(16296,k),L>2]=17,C=L),L=+jr(16320,k),L>2]=18,C=L),L=+jr(16344,k),L>2]=19,C=L),L=+_f(+(1-C*.5)),L<1e-16){g[S>>2]=0,g[S+4>>2]=0,g[S+8>>2]=0,g[S+12>>2]=0,wt=H;return}if(y=g[y>>2]|0,C=+Tt[16368+(y*24|0)>>3],C=+ph(C-+ph(+Od(15568+(y<<4)|0,p))),Ho(m)|0?z=+ph(C+-.3334731722518321):z=C,C=+To(+L)/.381966011250105,(m|0)>0){k=0;do C=C*2.6457513110645907,k=k+1|0;while((k|0)!=(m|0))}L=+Ur(+z)*C,Tt[S>>3]=L,z=+hi(+z)*C,Tt[S+8>>3]=z,wt=H}function dh(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0;if(k=+hs(p),k<1e-16){m=15568+(m<<4)|0,g[C>>2]=g[m>>2],g[C+4>>2]=g[m+4>>2],g[C+8>>2]=g[m+8>>2],g[C+12>>2]=g[m+12>>2];return}if(L=+qr(+ +Tt[p+8>>3],+ +Tt[p>>3]),(y|0)>0){p=0;do k=k/2.6457513110645907,p=p+1|0;while((p|0)!=(y|0))}S?(k=k/3,y=(Ho(y)|0)==0,k=+Md(+((y?k:k/2.6457513110645907)*.381966011250105))):(k=+Md(+(k*.381966011250105)),Ho(y)|0&&(L=+ph(L+.3334731722518321))),f0(15568+(m<<4)|0,+ph(+Tt[16368+(m*24|0)>>3]-L),k,C)}function y_(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;S=wt,wt=wt+16|0,C=S,gu(p+4|0,C),dh(C,g[p>>2]|0,m,0,y),wt=S}function l0(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0,we=0,je=0,Zr=0,qi=0,Ei=0,hn=0,Pi=0,Sn=0,yn=0,Or=0;if(Sn=wt,wt=wt+272|0,k=Sn+256|0,te=Sn+240|0,Ei=Sn,hn=Sn+224|0,Pi=Sn+208|0,_e=Sn+176|0,Ut=Sn+160|0,$e=Sn+192|0,er=Sn+144|0,we=Sn+128|0,je=Sn+112|0,Zr=Sn+96|0,qi=Sn+80|0,g[k>>2]=m,g[te>>2]=g[p>>2],g[te+4>>2]=g[p+4>>2],g[te+8>>2]=g[p+8>>2],g[te+12>>2]=g[p+12>>2],c0(te,k,Ei),g[C>>2]=0,te=S+y+((S|0)==5&1)|0,(te|0)<=(y|0)){wt=Sn;return}H=g[k>>2]|0,it=hn+4|0,ot=_e+4|0,Ct=y+5|0,Nt=16848+(H<<2)|0,Wt=16928+(H<<2)|0,re=we+8|0,ne=je+8|0,Le=Zr+8|0,We=Pi+4|0,z=y;t:for(;;){L=Ei+(((z|0)%5|0)<<4)|0,g[Pi>>2]=g[L>>2],g[Pi+4>>2]=g[L+4>>2],g[Pi+8>>2]=g[L+8>>2],g[Pi+12>>2]=g[L+12>>2];do;while((bf(Pi,H,0,1)|0)==2);if((z|0)>(y|0)&(Ho(m)|0)!=0){if(g[_e>>2]=g[Pi>>2],g[_e+4>>2]=g[Pi+4>>2],g[_e+8>>2]=g[Pi+8>>2],g[_e+12>>2]=g[Pi+12>>2],gu(it,Ut),S=g[_e>>2]|0,k=g[17008+(S*80|0)+(g[hn>>2]<<2)>>2]|0,g[_e>>2]=g[18608+(S*80|0)+(k*20|0)>>2],L=g[18608+(S*80|0)+(k*20|0)+16>>2]|0,(L|0)>0){p=0;do s0(ot),p=p+1|0;while((p|0)<(L|0))}switch(L=18608+(S*80|0)+(k*20|0)+4|0,g[$e>>2]=g[L>>2],g[$e+4>>2]=g[L+4>>2],g[$e+8>>2]=g[L+8>>2],ca($e,(g[Nt>>2]|0)*3|0),Ln(ot,$e,ot),js(ot),gu(ot,er),yn=+(g[Wt>>2]|0),Tt[we>>3]=yn*3,Tt[re>>3]=0,Or=yn*-1.5,Tt[je>>3]=Or,Tt[ne>>3]=yn*2.598076211353316,Tt[Zr>>3]=Or,Tt[Le>>3]=yn*-2.598076211353316,g[17008+((g[_e>>2]|0)*80|0)+(g[Pi>>2]<<2)>>2]|0){case 1:{p=je,S=we;break}case 3:{p=Zr,S=je;break}case 2:{p=we,S=Zr;break}default:{p=12;break t}}Bn(Ut,er,S,p,qi),dh(qi,g[_e>>2]|0,H,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1}if((z|0)<(Ct|0)&&(gu(We,_e),dh(_e,g[Pi>>2]|0,H,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1),g[hn>>2]=g[Pi>>2],g[hn+4>>2]=g[Pi+4>>2],g[hn+8>>2]=g[Pi+8>>2],g[hn+12>>2]=g[Pi+12>>2],z=z+1|0,(z|0)>=(te|0)){p=3;break}}if((p|0)==3){wt=Sn;return}else(p|0)==12&&Mi(22474,22521,581,22531)}function c0(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0;H=wt,wt=wt+128|0,S=H+64|0,C=H,k=S,L=20208,z=k+60|0;do g[k>>2]=g[L>>2],k=k+4|0,L=L+4|0;while((k|0)<(z|0));k=C,L=20272,z=k+60|0;do g[k>>2]=g[L>>2],k=k+4|0,L=L+4|0;while((k|0)<(z|0));z=(Ho(g[m>>2]|0)|0)==0,S=z?S:C,C=p+4|0,Ge(C),Dd(C),Ho(g[m>>2]|0)|0&&(hh(C),g[m>>2]=(g[m>>2]|0)+1),g[y>>2]=g[p>>2],m=y+4|0,Ln(C,S,m),js(m),g[y+16>>2]=g[p>>2],m=y+20|0,Ln(C,S+12|0,m),js(m),g[y+32>>2]=g[p>>2],m=y+36|0,Ln(C,S+24|0,m),js(m),g[y+48>>2]=g[p>>2],m=y+52|0,Ln(C,S+36|0,m),js(m),g[y+64>>2]=g[p>>2],y=y+68|0,Ln(C,S+48|0,y),js(y),wt=H}function bf(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0;if(re=wt,wt=wt+32|0,Nt=re+12|0,z=re,Wt=p+4|0,Ct=g[16928+(m<<2)>>2]|0,ot=(S|0)!=0,Ct=ot?Ct*3|0:Ct,C=g[Wt>>2]|0,it=p+8|0,L=g[it>>2]|0,ot){if(k=p+12|0,S=g[k>>2]|0,C=L+C+S|0,(C|0)==(Ct|0))return Wt=1,wt=re,Wt|0;H=k}else H=p+12|0,S=g[H>>2]|0,C=L+C+S|0;if((C|0)<=(Ct|0))return Wt=0,wt=re,Wt|0;do if((S|0)>0){if(S=g[p>>2]|0,(L|0)>0){k=18608+(S*80|0)+60|0,S=p;break}S=18608+(S*80|0)+40|0,y?(kd(Nt,Ct,0,0),eA(Wt,Nt,z),fh(z),Ln(z,Nt,Wt),k=S,S=p):(k=S,S=p)}else k=18608+((g[p>>2]|0)*80|0)+20|0,S=p;while(!1);if(g[S>>2]=g[k>>2],C=k+16|0,(g[C>>2]|0)>0){S=0;do s0(Wt),S=S+1|0;while((S|0)<(g[C>>2]|0))}return p=k+4|0,g[Nt>>2]=g[p>>2],g[Nt+4>>2]=g[p+4>>2],g[Nt+8>>2]=g[p+8>>2],m=g[16848+(m<<2)>>2]|0,ca(Nt,ot?m*3|0:m),Ln(Wt,Nt,Wt),js(Wt),ot?S=((g[it>>2]|0)+(g[Wt>>2]|0)+(g[H>>2]|0)|0)==(Ct|0)?1:2:S=2,Wt=S,wt=re,Wt|0}function u0(p,m){p=p|0,m=m|0;var y=0;do y=bf(p,m,0,1)|0;while((y|0)==2);return y|0}function iA(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0,we=0,je=0,Zr=0,qi=0,Ei=0;if(Zr=wt,wt=wt+240|0,k=Zr+224|0,$e=Zr+208|0,er=Zr,we=Zr+192|0,je=Zr+176|0,Le=Zr+160|0,We=Zr+144|0,te=Zr+128|0,_e=Zr+112|0,Ut=Zr+96|0,g[k>>2]=m,g[$e>>2]=g[p>>2],g[$e+4>>2]=g[p+4>>2],g[$e+8>>2]=g[p+8>>2],g[$e+12>>2]=g[p+12>>2],nA($e,k,er),g[C>>2]=0,ne=S+y+((S|0)==6&1)|0,(ne|0)<=(y|0)){wt=Zr;return}H=g[k>>2]|0,it=y+6|0,ot=16928+(H<<2)|0,Ct=We+8|0,Nt=te+8|0,Wt=_e+8|0,re=we+4|0,L=0,z=y,S=-1;t:for(;;){if(k=(z|0)%6|0,p=er+(k<<4)|0,g[we>>2]=g[p>>2],g[we+4>>2]=g[p+4>>2],g[we+8>>2]=g[p+8>>2],g[we+12>>2]=g[p+12>>2],p=L,L=bf(we,H,0,1)|0,(z|0)>(y|0)&(Ho(m)|0)!=0&&(p|0)!=1&&(g[we>>2]|0)!=(S|0)){switch(gu(er+(((k+5|0)%6|0)<<4)+4|0,je),gu(er+(k<<4)+4|0,Le),qi=+(g[ot>>2]|0),Tt[We>>3]=qi*3,Tt[Ct>>3]=0,Ei=qi*-1.5,Tt[te>>3]=Ei,Tt[Nt>>3]=qi*2.598076211353316,Tt[_e>>3]=Ei,Tt[Wt>>3]=qi*-2.598076211353316,k=g[$e>>2]|0,g[17008+(k*80|0)+(((S|0)==(k|0)?g[we>>2]|0:S)<<2)>>2]|0){case 1:{p=te,S=We;break}case 3:{p=_e,S=te;break}case 2:{p=We,S=_e;break}default:{p=8;break t}}Bn(je,Le,S,p,Ut),!(qo(je,Ut)|0)&&!(qo(Le,Ut)|0)&&(dh(Ut,g[$e>>2]|0,H,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1)}if((z|0)<(it|0)&&(gu(re,je),dh(je,g[we>>2]|0,H,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1),z=z+1|0,(z|0)>=(ne|0)){p=3;break}else S=g[we>>2]|0}if((p|0)==3){wt=Zr;return}else(p|0)==8&&Mi(22557,22521,746,22602)}function nA(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0;H=wt,wt=wt+160|0,S=H+80|0,C=H,k=S,L=20336,z=k+72|0;do g[k>>2]=g[L>>2],k=k+4|0,L=L+4|0;while((k|0)<(z|0));k=C,L=20416,z=k+72|0;do g[k>>2]=g[L>>2],k=k+4|0,L=L+4|0;while((k|0)<(z|0));z=(Ho(g[m>>2]|0)|0)==0,S=z?S:C,C=p+4|0,Ge(C),Dd(C),Ho(g[m>>2]|0)|0&&(hh(C),g[m>>2]=(g[m>>2]|0)+1),g[y>>2]=g[p>>2],m=y+4|0,Ln(C,S,m),js(m),g[y+16>>2]=g[p>>2],m=y+20|0,Ln(C,S+12|0,m),js(m),g[y+32>>2]=g[p>>2],m=y+36|0,Ln(C,S+24|0,m),js(m),g[y+48>>2]=g[p>>2],m=y+52|0,Ln(C,S+36|0,m),js(m),g[y+64>>2]=g[p>>2],m=y+68|0,Ln(C,S+48|0,m),js(m),g[y+80>>2]=g[p>>2],y=y+84|0,Ln(C,S+60|0,y),js(y),wt=H}function ph(p){p=+p;var m=0;return m=p<0?p+6.283185307179586:p,+(p>=6.283185307179586?m+-6.283185307179586:m)}function us(p,m){return p=p|0,m=m|0,+li(+(+Tt[p>>3]-+Tt[m>>3]))<17453292519943298e-27?(m=+li(+(+Tt[p+8>>3]-+Tt[m+8>>3]))<17453292519943298e-27,m|0):(m=0,m|0)}function _u(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0;return C=+Tt[m>>3],S=+Tt[p>>3],k=+hi(+((C-S)*.5)),y=+hi(+((+Tt[m+8>>3]-+Tt[p+8>>3])*.5)),y=k*k+y*(+Ur(+C)*+Ur(+S)*y),+(+qr(+ +bn(+y),+ +bn(+(1-y)))*2)}function Bc(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0;return C=+Tt[m>>3],S=+Tt[p>>3],k=+hi(+((C-S)*.5)),y=+hi(+((+Tt[m+8>>3]-+Tt[p+8>>3])*.5)),y=k*k+y*(+Ur(+C)*+Ur(+S)*y),+(+qr(+ +bn(+y),+ +bn(+(1-y)))*2*6371.007180918475)}function h0(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0;return C=+Tt[m>>3],S=+Tt[p>>3],k=+hi(+((C-S)*.5)),y=+hi(+((+Tt[m+8>>3]-+Tt[p+8>>3])*.5)),y=k*k+y*(+Ur(+C)*+Ur(+S)*y),+(+qr(+ +bn(+y),+ +bn(+(1-y)))*2*6371.007180918475*1e3)}function Od(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;return k=+Tt[m>>3],S=+Ur(+k),C=+Tt[m+8>>3]-+Tt[p+8>>3],L=S*+hi(+C),y=+Tt[p>>3],+ +qr(+L,+(+hi(+k)*+Ur(+y)-+Ur(+C)*(S*+hi(+y))))}function f0(p,m,y,S){p=p|0,m=+m,y=+y,S=S|0;var C=0,k=0,L=0,z=0;if(y<1e-16){g[S>>2]=g[p>>2],g[S+4>>2]=g[p+4>>2],g[S+8>>2]=g[p+8>>2],g[S+12>>2]=g[p+12>>2];return}k=m<0?m+6.283185307179586:m,k=m>=6.283185307179586?k+-6.283185307179586:k;do if(k<1e-16)m=+Tt[p>>3]+y,Tt[S>>3]=m,C=S;else{if(C=+li(+(k+-3.141592653589793))<1e-16,m=+Tt[p>>3],C){m=m-y,Tt[S>>3]=m,C=S;break}if(L=+Ur(+y),y=+hi(+y),m=L*+hi(+m)+ +Ur(+k)*(y*+Ur(+m)),m=m>1?1:m,m=+h_(+(m<-1?-1:m)),Tt[S>>3]=m,+li(+(m+-1.5707963267948966))<1e-16){Tt[S>>3]=1.5707963267948966,Tt[S+8>>3]=0;return}if(+li(+(m+1.5707963267948966))<1e-16){Tt[S>>3]=-1.5707963267948966,Tt[S+8>>3]=0;return}if(z=+Ur(+m),k=y*+hi(+k)/z,y=+Tt[p>>3],m=(L-+hi(+m)*+hi(+y))/+Ur(+y)/z,L=k>1?1:k,m=m>1?1:m,m=+Tt[p+8>>3]+ +qr(+(L<-1?-1:L),+(m<-1?-1:m)),m>3.141592653589793)do m=m+-6.283185307179586;while(m>3.141592653589793);if(m<-3.141592653589793)do m=m+6.283185307179586;while(m<-3.141592653589793);Tt[S+8>>3]=m;return}while(!1);if(+li(+(m+-1.5707963267948966))<1e-16){Tt[C>>3]=1.5707963267948966,Tt[S+8>>3]=0;return}if(+li(+(m+1.5707963267948966))<1e-16){Tt[C>>3]=-1.5707963267948966,Tt[S+8>>3]=0;return}if(m=+Tt[p+8>>3],m>3.141592653589793)do m=m+-6.283185307179586;while(m>3.141592653589793);if(m<-3.141592653589793)do m=m+6.283185307179586;while(m<-3.141592653589793);Tt[S+8>>3]=m}function v_(p){return p=p|0,+ +Tt[20496+(p<<3)>>3]}function ua(p){return p=p|0,+ +Tt[20624+(p<<3)>>3]}function un(p){return p=p|0,+ +Tt[20752+(p<<3)>>3]}function sA(p){return p=p|0,+ +Tt[20880+(p<<3)>>3]}function d0(p){p=p|0;var m=0;return m=21008+(p<<3)|0,p=g[m>>2]|0,Je(g[m+4>>2]|0),p|0}function Ah(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0;return Nt=+Tt[m>>3],ot=+Tt[p>>3],H=+hi(+((Nt-ot)*.5)),k=+Tt[m+8>>3],it=+Tt[p+8>>3],L=+hi(+((k-it)*.5)),z=+Ur(+ot),Ct=+Ur(+Nt),L=H*H+L*(Ct*z*L),L=+qr(+ +bn(+L),+ +bn(+(1-L)))*2,H=+Tt[y>>3],Nt=+hi(+((H-Nt)*.5)),S=+Tt[y+8>>3],k=+hi(+((S-k)*.5)),C=+Ur(+H),k=Nt*Nt+k*(Ct*C*k),k=+qr(+ +bn(+k),+ +bn(+(1-k)))*2,H=+hi(+((ot-H)*.5)),S=+hi(+((it-S)*.5)),S=H*H+S*(z*C*S),S=+qr(+ +bn(+S),+ +bn(+(1-S)))*2,C=(L+k+S)*.5,+(+Md(+ +bn(+(+To(+(C*.5))*+To(+((C-L)*.5))*+To(+((C-k)*.5))*+To(+((C-S)*.5)))))*4)}function x_(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;if(k=wt,wt=wt+192|0,S=k+168|0,C=k,l(p,m,S),d(p,m,C),m=g[C>>2]|0,(m|0)<=0)return y=0,wt=k,+y;if(y=+Ah(C+8|0,C+8+(((m|0)!=1&1)<<4)|0,S)+0,(m|0)==1)return wt=k,+y;p=1;do L=p,p=p+1|0,y=y+ +Ah(C+8+(L<<4)|0,C+8+(((p|0)%(m|0)|0)<<4)|0,S);while((p|0)<(m|0));return wt=k,+y}function b_(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;if(k=wt,wt=wt+192|0,S=k+168|0,C=k,l(p,m,S),d(p,m,C),m=g[C>>2]|0,(m|0)>0){if(y=+Ah(C+8|0,C+8+(((m|0)!=1&1)<<4)|0,S)+0,(m|0)!=1){p=1;do L=p,p=p+1|0,y=y+ +Ah(C+8+(L<<4)|0,C+8+(((p|0)%(m|0)|0)<<4)|0,S);while((p|0)<(m|0))}}else y=0;return wt=k,+(y*6371.007180918475*6371.007180918475)}function Nx(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;if(k=wt,wt=wt+192|0,S=k+168|0,C=k,l(p,m,S),d(p,m,C),m=g[C>>2]|0,(m|0)>0){if(y=+Ah(C+8|0,C+8+(((m|0)!=1&1)<<4)|0,S)+0,(m|0)!=1){p=1;do L=p,p=p+1|0,y=y+ +Ah(C+8+(L<<4)|0,C+8+(((p|0)%(m|0)|0)<<4)|0,S);while((p|0)<(m|0))}}else y=0;return wt=k,+(y*6371.007180918475*6371.007180918475*1e3*1e3)}function Mo(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0;if(L=wt,wt=wt+176|0,k=L,pt(p,m,k),p=g[k>>2]|0,(p|0)<=1)return C=0,wt=L,+C;m=p+-1|0,p=0,y=0,S=+Tt[k+8>>3],C=+Tt[k+16>>3];do p=p+1|0,H=S,S=+Tt[k+8+(p<<4)>>3],it=+hi(+((S-H)*.5)),z=C,C=+Tt[k+8+(p<<4)+8>>3],z=+hi(+((C-z)*.5)),z=it*it+z*(+Ur(+S)*+Ur(+H)*z),y=y+ +qr(+ +bn(+z),+ +bn(+(1-z)))*2;while((p|0)<(m|0));return wt=L,+y}function oA(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0;if(L=wt,wt=wt+176|0,k=L,pt(p,m,k),p=g[k>>2]|0,(p|0)<=1)return C=0,wt=L,+C;m=p+-1|0,p=0,y=0,S=+Tt[k+8>>3],C=+Tt[k+16>>3];do p=p+1|0,H=S,S=+Tt[k+8+(p<<4)>>3],it=+hi(+((S-H)*.5)),z=C,C=+Tt[k+8+(p<<4)+8>>3],z=+hi(+((C-z)*.5)),z=it*it+z*(+Ur(+H)*+Ur(+S)*z),y=y+ +qr(+ +bn(+z),+ +bn(+(1-z)))*2;while((p|0)!=(m|0));return it=y*6371.007180918475,wt=L,+it}function nr(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0;if(L=wt,wt=wt+176|0,k=L,pt(p,m,k),p=g[k>>2]|0,(p|0)<=1)return C=0,wt=L,+C;m=p+-1|0,p=0,y=0,S=+Tt[k+8>>3],C=+Tt[k+16>>3];do p=p+1|0,H=S,S=+Tt[k+8+(p<<4)>>3],it=+hi(+((S-H)*.5)),z=C,C=+Tt[k+8+(p<<4)+8>>3],z=+hi(+((C-z)*.5)),z=it*it+z*(+Ur(+H)*+Ur(+S)*z),y=y+ +qr(+ +bn(+z),+ +bn(+(1-z)))*2;while((p|0)!=(m|0));return it=y*6371.007180918475*1e3,wt=L,+it}function dr(p,m){return p=p|0,m=m|0,m=me(p|0,m|0,52)|0,It()|0,m&15|0}function wf(p,m){return p=p|0,m=m|0,m=me(p|0,m|0,45)|0,It()|0,m&127|0}function aA(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0;if(!(!0&(m&-16777216|0)==134217728)||(L=me(p|0,m|0,45)|0,It()|0,L=L&127,L>>>0>121))return m=0,m|0;y=me(p|0,m|0,52)|0,It()|0,y=y&15;do if(y|0){for(C=1,S=0;;){if(k=me(p|0,m|0,(15-C|0)*3|0)|0,It()|0,k=k&7,(k|0)!=0&(S^1))if((k|0)==1&(fi(L)|0)!=0){z=0,S=13;break}else S=1;if((k|0)==7){z=0,S=13;break}if(C>>>0>>0)C=C+1|0;else{S=9;break}}if((S|0)==9){if((y|0)==15)z=1;else break;return z|0}else if((S|0)==13)return z|0}while(!1);for(;;){if(z=me(p|0,m|0,(14-y|0)*3|0)|0,It()|0,!((z&7|0)==7&!0)){z=0,S=13;break}if(y>>>0<14)y=y+1|0;else{z=1,S=13;break}}return(S|0)==13?z|0:0}function Bd(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;if(S=me(p|0,m|0,52)|0,It()|0,S=S&15,(S|0)>=(y|0)){if((S|0)!=(y|0))if(y>>>0<=15){if(C=ke(y|0,0,52)|0,p=C|p,m=It()|0|m&-15728641,(S|0)>(y|0))do C=ke(7,0,(14-y|0)*3|0)|0,y=y+1|0,p=C|p,m=It()|0|m;while((y|0)<(S|0))}else m=0,p=0}else m=0,p=0;return Je(m|0),p|0}function Hn(p,m,y){return p=p|0,m=m|0,y=y|0,p=me(p|0,m|0,52)|0,It()|0,p=p&15,(y|0)<16&(p|0)<=(y|0)?(y=Ze(7,y-p|0)|0,y|0):(y=0,y|0)}function uo(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,it=0,ot=0;if(L=me(p|0,m|0,52)|0,It()|0,L=L&15,!!((y|0)<16&(L|0)<=(y|0))){if((L|0)==(y|0)){y=S,g[y>>2]=p,g[y+4>>2]=m;return}if(H=Ze(7,y-L|0)|0,it=(H|0)/7|0,z=me(p|0,m|0,45)|0,It()|0,!(fi(z&127)|0))k=0;else{t:do if(!L)C=0;else for(k=1;;){if(C=me(p|0,m|0,(15-k|0)*3|0)|0,It()|0,C=C&7,C|0)break t;if(k>>>0>>0)k=k+1|0;else{C=0;break}}while(!1);k=(C|0)==0}if(ot=ke(L+1|0,0,52)|0,C=It()|0|m&-15728641,z=(14-L|0)*3|0,m=ke(7,0,z|0)|0,m=(ot|p)&~m,L=C&~(It()|0),uo(m,L,y,S),C=S+(it<<3)|0,!k){ot=ke(1,0,z|0)|0,uo(ot|m,It()|0|L,y,C),ot=C+(it<<3)|0,H=ke(2,0,z|0)|0,uo(H|m,It()|0|L,y,ot),ot=ot+(it<<3)|0,H=ke(3,0,z|0)|0,uo(H|m,It()|0|L,y,ot),ot=ot+(it<<3)|0,H=ke(4,0,z|0)|0,uo(H|m,It()|0|L,y,ot),ot=ot+(it<<3)|0,H=ke(5,0,z|0)|0,uo(H|m,It()|0|L,y,ot),H=ke(6,0,z|0)|0,uo(H|m,It()|0|L,y,ot+(it<<3)|0);return}k=C+(it<<3)|0,(H|0)>6&&(H=C+8|0,ot=(k>>>0>H>>>0?k:H)+-1+(0-C)|0,Fc(C|0,0,ot+8&-8|0)|0,C=H+(ot>>>3<<3)|0),ot=ke(2,0,z|0)|0,uo(ot|m,It()|0|L,y,C),ot=C+(it<<3)|0,H=ke(3,0,z|0)|0,uo(H|m,It()|0|L,y,ot),ot=ot+(it<<3)|0,H=ke(4,0,z|0)|0,uo(H|m,It()|0|L,y,ot),ot=ot+(it<<3)|0,H=ke(5,0,z|0)|0,uo(H|m,It()|0|L,y,ot),H=ke(6,0,z|0)|0,uo(H|m,It()|0|L,y,ot+(it<<3)|0)}}function ji(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;if(C=me(p|0,m|0,45)|0,It()|0,!(fi(C&127)|0))return C=0,C|0;C=me(p|0,m|0,52)|0,It()|0,C=C&15;t:do if(!C)y=0;else for(S=1;;){if(y=me(p|0,m|0,(15-S|0)*3|0)|0,It()|0,y=y&7,y|0)break t;if(S>>>0>>0)S=S+1|0;else{y=0;break}}while(!1);return C=(y|0)==0&1,C|0}function w_(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;if(S=me(p|0,m|0,52)|0,It()|0,S=S&15,(y|0)<16&(S|0)<=(y|0)){if((S|0)!=(y|0)&&(C=ke(y|0,0,52)|0,p=C|p,m=It()|0|m&-15728641,(S|0)<(y|0)))do C=ke(7,0,(14-S|0)*3|0)|0,S=S+1|0,p=p&~C,m=m&~(It()|0);while((S|0)<(y|0))}else m=0,p=0;return Je(m|0),p|0}function mh(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0,we=0,je=0;if(!y)return we=0,we|0;if(C=p,S=g[C>>2]|0,C=g[C+4>>2]|0,!0&(C&15728640|0)==0){if((y|0)<=0||(we=m,g[we>>2]=S,g[we+4>>2]=C,(y|0)==1))return we=0,we|0;S=1;do $e=p+(S<<3)|0,er=g[$e+4>>2]|0,we=m+(S<<3)|0,g[we>>2]=g[$e>>2],g[we+4>>2]=er,S=S+1|0;while((S|0)!=(y|0));return S=0,S|0}if($e=y<<3,er=ho($e)|0,!er)return we=-3,we|0;if(Va(er|0,p|0,$e|0)|0,Ut=Ua(y,8)|0,!Ut)return Gr(er),we=-3,we|0;S=y;t:for(;;){L=er,ot=g[L>>2]|0,L=g[L+4>>2]|0,te=me(ot|0,L|0,52)|0,It()|0,te=te&15,_e=te+-1|0,We=(S|0)>0;e:do if(We){if(Le=((S|0)<0)<<31>>31,re=ke(_e|0,0,52)|0,ne=It()|0,_e>>>0>15)for(C=0,p=ot,y=L;;){if(!((p|0)==0&(y|0)==0)){if(k=me(p|0,y|0,52)|0,It()|0,k=k&15,z=(k|0)<(_e|0),k=(k|0)==(_e|0),it=z?0:k?p:0,p=z?0:k?y:0,y=Yo(it|0,p|0,S|0,Le|0)|0,It()|0,k=Ut+(y<<3)|0,z=k,H=g[z>>2]|0,z=g[z+4>>2]|0,(H|0)==0&(z|0)==0)y=it;else for(re=0,Wt=y,Nt=z,y=it;;){if((re|0)>(S|0)){we=41;break t}if((H|0)==(y|0)&(Nt&-117440513|0)==(p|0)){it=me(H|0,Nt|0,56)|0,It()|0,it=it&7,Ct=it+1|0,ne=me(H|0,Nt|0,45)|0,It()|0;r:do if(!(fi(ne&127)|0))z=7;else{if(H=me(H|0,Nt|0,52)|0,It()|0,H=H&15,!H){z=6;break}for(z=1;;){if(ne=ke(7,0,(15-z|0)*3|0)|0,!((ne&y|0)==0&((It()|0)&p|0)==0)){z=7;break r}if(z>>>0>>0)z=z+1|0;else{z=6;break}}}while(!1);if((it+2|0)>>>0>z>>>0){we=51;break t}ne=ke(Ct|0,0,56)|0,p=It()|0|p&-117440513,z=k,g[z>>2]=0,g[z+4>>2]=0,z=Wt,y=ne|y}else z=(Wt+1|0)%(S|0)|0;if(k=Ut+(z<<3)|0,Nt=k,H=g[Nt>>2]|0,Nt=g[Nt+4>>2]|0,(H|0)==0&(Nt|0)==0)break;re=re+1|0,Wt=z}ne=k,g[ne>>2]=y,g[ne+4>>2]=p}if(C=C+1|0,(C|0)>=(S|0))break e;y=er+(C<<3)|0,p=g[y>>2]|0,y=g[y+4>>2]|0}for(C=0,p=ot,y=L;;){if(!((p|0)==0&(y|0)==0)){if(z=me(p|0,y|0,52)|0,It()|0,z=z&15,(z|0)>=(_e|0)){if((z|0)!=(_e|0)&&(p=p|re,y=y&-15728641|ne,z>>>0>=te>>>0)){k=_e;do Wt=ke(7,0,(14-k|0)*3|0)|0,k=k+1|0,p=Wt|p,y=It()|0|y;while(k>>>0>>0)}}else p=0,y=0;if(z=Yo(p|0,y|0,S|0,Le|0)|0,It()|0,k=Ut+(z<<3)|0,H=k,it=g[H>>2]|0,H=g[H+4>>2]|0,!((it|0)==0&(H|0)==0))for(Wt=0;;){if((Wt|0)>(S|0)){we=41;break t}if((it|0)==(p|0)&(H&-117440513|0)==(y|0)){Ct=me(it|0,H|0,56)|0,It()|0,Ct=Ct&7,Nt=Ct+1|0,je=me(it|0,H|0,45)|0,It()|0;r:do if(!(fi(je&127)|0))H=7;else{if(it=me(it|0,H|0,52)|0,It()|0,it=it&15,!it){H=6;break}for(H=1;;){if(je=ke(7,0,(15-H|0)*3|0)|0,!((je&p|0)==0&((It()|0)&y|0)==0)){H=7;break r}if(H>>>0>>0)H=H+1|0;else{H=6;break}}}while(!1);if((Ct+2|0)>>>0>H>>>0){we=51;break t}je=ke(Nt|0,0,56)|0,y=It()|0|y&-117440513,Nt=k,g[Nt>>2]=0,g[Nt+4>>2]=0,p=je|p}else z=(z+1|0)%(S|0)|0;if(k=Ut+(z<<3)|0,H=k,it=g[H>>2]|0,H=g[H+4>>2]|0,(it|0)==0&(H|0)==0)break;Wt=Wt+1|0}je=k,g[je>>2]=p,g[je+4>>2]=y}if(C=C+1|0,(C|0)>=(S|0))break e;y=er+(C<<3)|0,p=g[y>>2]|0,y=g[y+4>>2]|0}}while(!1);if((S+5|0)>>>0<11){we=99;break}if(ne=Ua((S|0)/6|0,8)|0,!ne){we=58;break}e:do if(We){Wt=0,Nt=0;do{if(z=Ut+(Wt<<3)|0,p=z,C=g[p>>2]|0,p=g[p+4>>2]|0,!((C|0)==0&(p|0)==0)){H=me(C|0,p|0,56)|0,It()|0,H=H&7,y=H+1|0,it=p&-117440513,je=me(C|0,p|0,45)|0,It()|0;r:do if(fi(je&127)|0){if(Ct=me(C|0,p|0,52)|0,It()|0,Ct=Ct&15,Ct|0)for(k=1;;){if(je=ke(7,0,(15-k|0)*3|0)|0,!((C&je|0)==0&(it&(It()|0)|0)==0))break r;if(k>>>0>>0)k=k+1|0;else break}p=ke(y|0,0,56)|0,C=p|C,p=It()|0|it,y=z,g[y>>2]=C,g[y+4>>2]=p,y=H+2|0}while(!1);(y|0)==7&&(je=ne+(Nt<<3)|0,g[je>>2]=C,g[je+4>>2]=p&-117440513,Nt=Nt+1|0)}Wt=Wt+1|0}while((Wt|0)!=(S|0));if(We){if(re=((S|0)<0)<<31>>31,Ct=ke(_e|0,0,52)|0,Wt=It()|0,_e>>>0>15)for(p=0,C=0;;){do if(!((ot|0)==0&(L|0)==0)){for(H=me(ot|0,L|0,52)|0,It()|0,H=H&15,k=(H|0)<(_e|0),H=(H|0)==(_e|0),z=k?0:H?ot:0,H=k?0:H?L:0,k=Yo(z|0,H|0,S|0,re|0)|0,It()|0,y=0;;){if((y|0)>(S|0)){we=98;break t}if(je=Ut+(k<<3)|0,it=g[je+4>>2]|0,(it&-117440513|0)==(H|0)&&(g[je>>2]|0)==(z|0)){we=70;break}if(k=(k+1|0)%(S|0)|0,je=Ut+(k<<3)|0,(g[je>>2]|0)==(z|0)&&(g[je+4>>2]|0)==(H|0))break;y=y+1|0}if((we|0)==70&&(we=0,!0&(it&117440512|0)==100663296))break;je=m+(C<<3)|0,g[je>>2]=ot,g[je+4>>2]=L,C=C+1|0}while(!1);if(p=p+1|0,(p|0)>=(S|0)){S=Nt;break e}L=er+(p<<3)|0,ot=g[L>>2]|0,L=g[L+4>>2]|0}for(p=0,C=0;;){do if(!((ot|0)==0&(L|0)==0)){if(H=me(ot|0,L|0,52)|0,It()|0,H=H&15,(H|0)>=(_e|0))if((H|0)!=(_e|0))if(y=ot|Ct,k=L&-15728641|Wt,H>>>0>>0)H=k;else{z=_e;do je=ke(7,0,(14-z|0)*3|0)|0,z=z+1|0,y=je|y,k=It()|0|k;while(z>>>0>>0);H=k}else y=ot,H=L;else y=0,H=0;for(z=Yo(y|0,H|0,S|0,re|0)|0,It()|0,k=0;;){if((k|0)>(S|0)){we=98;break t}if(je=Ut+(z<<3)|0,it=g[je+4>>2]|0,(it&-117440513|0)==(H|0)&&(g[je>>2]|0)==(y|0)){we=93;break}if(z=(z+1|0)%(S|0)|0,je=Ut+(z<<3)|0,(g[je>>2]|0)==(y|0)&&(g[je+4>>2]|0)==(H|0))break;k=k+1|0}if((we|0)==93&&(we=0,!0&(it&117440512|0)==100663296))break;je=m+(C<<3)|0,g[je>>2]=ot,g[je+4>>2]=L,C=C+1|0}while(!1);if(p=p+1|0,(p|0)>=(S|0)){S=Nt;break e}L=er+(p<<3)|0,ot=g[L>>2]|0,L=g[L+4>>2]|0}}else C=0,S=Nt}else C=0,S=0;while(!1);if(Fc(Ut|0,0,$e|0)|0,Va(er|0,ne|0,S<<3|0)|0,Gr(ne),S)m=m+(C<<3)|0;else break}return(we|0)==41?(Gr(er),Gr(Ut),je=-1,je|0):(we|0)==51?(Gr(er),Gr(Ut),je=-2,je|0):(we|0)==58?(Gr(er),Gr(Ut),je=-3,je|0):(we|0)==98?(Gr(ne),Gr(er),Gr(Ut),je=-1,je|0):((we|0)==99&&Va(m|0,er|0,S<<3|0)|0,Gr(er),Gr(Ut),je=0,je|0)}function kn(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,it=0,ot=0;if((m|0)<=0)return C=0,C|0;if((C|0)>=16){for(k=0;;){if(ot=p+(k<<3)|0,!((g[ot>>2]|0)==0&(g[ot+4>>2]|0)==0)){k=14;break}if(k=k+1|0,(k|0)>=(m|0)){L=0,k=16;break}}if((k|0)==14)return((S|0)>0?-2:-1)|0;if((k|0)==16)return L|0}k=0,ot=0;t:for(;;){it=p+(ot<<3)|0,z=it,L=g[z>>2]|0,z=g[z+4>>2]|0;do if(!((L|0)==0&(z|0)==0)){if((k|0)>=(S|0)){L=-1,k=16;break t}if(H=me(L|0,z|0,52)|0,It()|0,H=H&15,(H|0)>(C|0)){L=-2,k=16;break t}if((H|0)==(C|0)){it=y+(k<<3)|0,g[it>>2]=L,g[it+4>>2]=z,k=k+1|0;break}if(L=(Ze(7,C-H|0)|0)+k|0,(L|0)>(S|0)){L=-1,k=16;break t}uo(g[it>>2]|0,g[it+4>>2]|0,C,y+(k<<3)|0),k=L}while(!1);if(ot=ot+1|0,(ot|0)>=(m|0)){L=0,k=16;break}}return(k|0)==16?L|0:0}function wn(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0;if((m|0)<=0)return y=0,y|0;if((y|0)>=16){for(S=0;;){if(L=p+(S<<3)|0,!((g[L>>2]|0)==0&(g[L+4>>2]|0)==0)){S=-1,C=13;break}if(S=S+1|0,(S|0)>=(m|0)){S=0,C=13;break}}if((C|0)==13)return S|0}S=0,L=0;t:for(;;){C=p+(L<<3)|0,k=g[C>>2]|0,C=g[C+4>>2]|0;do if(!((k|0)==0&(C|0)==0)){if(C=me(k|0,C|0,52)|0,It()|0,C=C&15,(C|0)>(y|0)){S=-1,C=13;break t}if((C|0)==(y|0)){S=S+1|0;break}else{S=(Ze(7,y-C|0)|0)+S|0;break}}while(!1);if(L=L+1|0,(L|0)>=(m|0)){C=13;break}}return(C|0)==13?S|0:0}function Sf(p,m){return p=p|0,m=m|0,m=me(p|0,m|0,52)|0,It()|0,m&1|0}function Es(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;if(C=me(p|0,m|0,52)|0,It()|0,C=C&15,!C)return C=0,C|0;for(S=1;;){if(y=me(p|0,m|0,(15-S|0)*3|0)|0,It()|0,y=y&7,y|0){S=5;break}if(S>>>0>>0)S=S+1|0;else{y=0,S=5;break}}return(S|0)==5?y|0:0}function gh(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0;if(H=me(p|0,m|0,52)|0,It()|0,H=H&15,!H)return z=m,H=p,Je(z|0),H|0;for(z=1,y=0;;){k=(15-z|0)*3|0,S=ke(7,0,k|0)|0,C=It()|0,L=me(p|0,m|0,k|0)|0,It()|0,k=ke(Na(L&7)|0,0,k|0)|0,L=It()|0,p=k|p&~S,m=L|m&~C;t:do if(!y)if((k&S|0)==0&(L&C|0)==0)y=0;else if(S=me(p|0,m|0,52)|0,It()|0,S=S&15,!S)y=1;else{y=1;e:for(;;){switch(L=me(p|0,m|0,(15-y|0)*3|0)|0,It()|0,L&7){case 1:break e;case 0:break;default:{y=1;break t}}if(y>>>0>>0)y=y+1|0;else{y=1;break t}}for(y=1;;)if(L=(15-y|0)*3|0,C=me(p|0,m|0,L|0)|0,It()|0,k=ke(7,0,L|0)|0,m=m&~(It()|0),L=ke(Na(C&7)|0,0,L|0)|0,p=p&~k|L,m=m|(It()|0),y>>>0>>0)y=y+1|0;else{y=1;break}}while(!1);if(z>>>0>>0)z=z+1|0;else break}return Je(m|0),p|0}function Wo(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;if(S=me(p|0,m|0,52)|0,It()|0,S=S&15,!S)return y=m,S=p,Je(y|0),S|0;for(y=1;k=(15-y|0)*3|0,L=me(p|0,m|0,k|0)|0,It()|0,C=ke(7,0,k|0)|0,m=m&~(It()|0),k=ke(Na(L&7)|0,0,k|0)|0,p=k|p&~C,m=It()|0|m,y>>>0>>0;)y=y+1|0;return Je(m|0),p|0}function p0(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0;if(H=me(p|0,m|0,52)|0,It()|0,H=H&15,!H)return z=m,H=p,Je(z|0),H|0;for(z=1,y=0;;){k=(15-z|0)*3|0,S=ke(7,0,k|0)|0,C=It()|0,L=me(p|0,m|0,k|0)|0,It()|0,k=ke(co(L&7)|0,0,k|0)|0,L=It()|0,p=k|p&~S,m=L|m&~C;t:do if(!y)if((k&S|0)==0&(L&C|0)==0)y=0;else if(S=me(p|0,m|0,52)|0,It()|0,S=S&15,!S)y=1;else{y=1;e:for(;;){switch(L=me(p|0,m|0,(15-y|0)*3|0)|0,It()|0,L&7){case 1:break e;case 0:break;default:{y=1;break t}}if(y>>>0>>0)y=y+1|0;else{y=1;break t}}for(y=1;;)if(C=(15-y|0)*3|0,k=ke(7,0,C|0)|0,L=m&~(It()|0),m=me(p|0,m|0,C|0)|0,It()|0,m=ke(co(m&7)|0,0,C|0)|0,p=p&~k|m,m=L|(It()|0),y>>>0>>0)y=y+1|0;else{y=1;break}}while(!1);if(z>>>0>>0)z=z+1|0;else break}return Je(m|0),p|0}function Fd(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;if(S=me(p|0,m|0,52)|0,It()|0,S=S&15,!S)return y=m,S=p,Je(y|0),S|0;for(y=1;L=(15-y|0)*3|0,k=ke(7,0,L|0)|0,C=m&~(It()|0),m=me(p|0,m|0,L|0)|0,It()|0,m=ke(co(m&7)|0,0,L|0)|0,p=m|p&~k,m=It()|0|C,y>>>0>>0;)y=y+1|0;return Je(m|0),p|0}function Tf(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0;if(H=wt,wt=wt+64|0,z=H+40|0,S=H+24|0,C=H+12|0,k=H,ke(m|0,0,52)|0,y=It()|0|134225919,!m)return(g[p+4>>2]|0)>2||(g[p+8>>2]|0)>2||(g[p+12>>2]|0)>2?(L=0,z=0,Je(L|0),wt=H,z|0):(ke(vf(p)|0,0,45)|0,L=It()|0|y,z=-1,Je(L|0),wt=H,z|0);if(g[z>>2]=g[p>>2],g[z+4>>2]=g[p+4>>2],g[z+8>>2]=g[p+8>>2],g[z+12>>2]=g[p+12>>2],L=z+4|0,(m|0)>0)for(p=-1;g[S>>2]=g[L>>2],g[S+4>>2]=g[L+4>>2],g[S+8>>2]=g[L+8>>2],m&1?(Rd(L),g[C>>2]=g[L>>2],g[C+4>>2]=g[L+4>>2],g[C+8>>2]=g[L+8>>2],za(C)):(Al(L),g[C>>2]=g[L>>2],g[C+4>>2]=g[L+4>>2],g[C+8>>2]=g[L+8>>2],hh(C)),eA(S,C,k),js(k),ot=(15-m|0)*3|0,it=ke(7,0,ot|0)|0,y=y&~(It()|0),ot=ke(Fa(k)|0,0,ot|0)|0,p=ot|p&~it,y=It()|0|y,(m|0)>1;)m=m+-1|0;else p=-1;t:do if((g[L>>2]|0)<=2&&(g[z+8>>2]|0)<=2&&(g[z+12>>2]|0)<=2){if(S=vf(z)|0,m=ke(S|0,0,45)|0,m=m|p,p=It()|0|y&-1040385,k=Kp(z)|0,!(fi(S)|0)){if((k|0)<=0)break;for(C=0;;){if(S=me(m|0,p|0,52)|0,It()|0,S=S&15,S)for(y=1;ot=(15-y|0)*3|0,z=me(m|0,p|0,ot|0)|0,It()|0,it=ke(7,0,ot|0)|0,p=p&~(It()|0),ot=ke(Na(z&7)|0,0,ot|0)|0,m=m&~it|ot,p=p|(It()|0),y>>>0>>0;)y=y+1|0;if(C=C+1|0,(C|0)==(k|0))break t}}C=me(m|0,p|0,52)|0,It()|0,C=C&15;e:do if(C){y=1;r:for(;;){switch(ot=me(m|0,p|0,(15-y|0)*3|0)|0,It()|0,ot&7){case 1:break r;case 0:break;default:break e}if(y>>>0>>0)y=y+1|0;else break e}if(ch(S,g[z>>2]|0)|0)for(y=1;z=(15-y|0)*3|0,it=ke(7,0,z|0)|0,ot=p&~(It()|0),p=me(m|0,p|0,z|0)|0,It()|0,p=ke(co(p&7)|0,0,z|0)|0,m=m&~it|p,p=ot|(It()|0),y>>>0>>0;)y=y+1|0;else for(y=1;ot=(15-y|0)*3|0,z=me(m|0,p|0,ot|0)|0,It()|0,it=ke(7,0,ot|0)|0,p=p&~(It()|0),ot=ke(Na(z&7)|0,0,ot|0)|0,m=m&~it|ot,p=p|(It()|0),y>>>0>>0;)y=y+1|0}while(!1);if((k|0)>0){y=0;do m=gh(m,p)|0,p=It()|0,y=y+1|0;while((y|0)!=(k|0))}}else m=0,p=0;while(!1);return it=p,ot=m,Je(it|0),wt=H,ot|0}function Ho(p){return p=p|0,(p|0)%2|0|0}function lA(p,m){p=p|0,m=m|0;var y=0,S=0;return S=wt,wt=wt+16|0,y=S,m>>>0<=15&&(g[p+4>>2]&2146435072|0)!=2146435072&&(g[p+8+4>>2]&2146435072|0)!=2146435072?(a0(p,m,y),m=Tf(y,m)|0,p=It()|0):(p=0,m=0),Je(p|0),wt=S,m|0}function bi(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0;if(C=y+4|0,k=me(p|0,m|0,52)|0,It()|0,k=k&15,L=me(p|0,m|0,45)|0,It()|0,S=(k|0)==0,fi(L&127)|0){if(S)return L=1,L|0;S=1}else{if(S)return L=0,L|0;!(g[C>>2]|0)&&!(g[y+8>>2]|0)?S=(g[y+12>>2]|0)!=0&1:S=1}for(y=1;y&1?za(C):hh(C),L=me(p|0,m|0,(15-y|0)*3|0)|0,It()|0,rA(C,L&7),y>>>0>>0;)y=y+1|0;return S|0}function T(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0;ot=wt,wt=wt+16|0,H=ot,it=me(p|0,m|0,45)|0,It()|0,it=it&127;t:do if(fi(it)|0&&(k=me(p|0,m|0,52)|0,It()|0,k=k&15,(k|0)!=0)){S=1;e:for(;;){switch(z=me(p|0,m|0,(15-S|0)*3|0)|0,It()|0,z&7){case 5:break e;case 0:break;default:{S=m;break t}}if(S>>>0>>0)S=S+1|0;else{S=m;break t}}for(C=1,S=m;m=(15-C|0)*3|0,L=ke(7,0,m|0)|0,z=S&~(It()|0),S=me(p|0,S|0,m|0)|0,It()|0,S=ke(co(S&7)|0,0,m|0)|0,p=p&~L|S,S=z|(It()|0),C>>>0>>0;)C=C+1|0}else S=m;while(!1);if(z=7728+(it*28|0)|0,g[y>>2]=g[z>>2],g[y+4>>2]=g[z+4>>2],g[y+8>>2]=g[z+8>>2],g[y+12>>2]=g[z+12>>2],!(bi(p,S,y)|0)){wt=ot;return}if(L=y+4|0,g[H>>2]=g[L>>2],g[H+4>>2]=g[L+4>>2],g[H+8>>2]=g[L+8>>2],k=me(p|0,S|0,52)|0,It()|0,z=k&15,k&1?(hh(L),k=z+1|0):k=z,!(fi(it)|0))S=0;else{t:do if(!z)S=0;else for(m=1;;){if(C=me(p|0,S|0,(15-m|0)*3|0)|0,It()|0,C=C&7,C|0){S=C;break t}if(m>>>0>>0)m=m+1|0;else{S=0;break}}while(!1);S=(S|0)==4&1}if(!(bf(y,k,S,0)|0))(k|0)!=(z|0)&&(g[L>>2]=g[H>>2],g[L+4>>2]=g[H+4>>2],g[L+8>>2]=g[H+8>>2]);else{if(fi(it)|0)do;while(bf(y,k,0,0)|0);(k|0)!=(z|0)&&Al(L)}wt=ot}function l(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;S=wt,wt=wt+16|0,C=S,T(p,m,C),m=me(p|0,m|0,52)|0,It()|0,y_(C,m&15,y),wt=S}function d(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0;L=wt,wt=wt+16|0,k=L,T(p,m,k),S=me(p|0,m|0,45)|0,It()|0,S=(fi(S&127)|0)==0,C=me(p|0,m|0,52)|0,It()|0,C=C&15;t:do if(!S){if(C|0)for(S=1;;){if(z=ke(7,0,(15-S|0)*3|0)|0,!((z&p|0)==0&((It()|0)&m|0)==0))break t;if(S>>>0>>0)S=S+1|0;else break}l0(k,C,0,5,y),wt=L;return}while(!1);iA(k,C,0,6,y),wt=L}function v(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;if(S=me(p|0,m|0,45)|0,It()|0,!(fi(S&127)|0))return S=2,S|0;if(S=me(p|0,m|0,52)|0,It()|0,S=S&15,!S)return S=5,S|0;for(y=1;;){if(C=ke(7,0,(15-y|0)*3|0)|0,!((C&p|0)==0&((It()|0)&m|0)==0)){y=2,p=6;break}if(y>>>0>>0)y=y+1|0;else{y=5,p=6;break}}return(p|0)==6?y|0:0}function b(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0;Ct=wt,wt=wt+128|0,it=Ct+112|0,k=Ct+96|0,ot=Ct,C=me(p|0,m|0,52)|0,It()|0,z=C&15,g[it>>2]=z,L=me(p|0,m|0,45)|0,It()|0,L=L&127;t:do if(fi(L)|0){if(z|0)for(S=1;;){if(H=ke(7,0,(15-S|0)*3|0)|0,!((H&p|0)==0&((It()|0)&m|0)==0)){C=0;break t}if(S>>>0>>0)S=S+1|0;else break}if(C&1)C=1;else{H=ke(z+1|0,0,52)|0,ot=It()|0|m&-15728641,it=ke(7,0,(14-z|0)*3|0)|0,b((H|p)&~it,ot&~(It()|0),y),wt=Ct;return}}else C=0;while(!1);T(p,m,k),C?(c0(k,it,ot),H=5):(nA(k,it,ot),H=6);t:do if(fi(L)|0)if(!z)S=20;else for(S=1;;){if(L=ke(7,0,(15-S|0)*3|0)|0,!((L&p|0)==0&((It()|0)&m|0)==0)){S=8;break t}if(S>>>0>>0)S=S+1|0;else{S=20;break}}else S=8;while(!1);if(Fc(y|0,-1,S|0)|0,C){C=0;do{for(k=ot+(C<<4)|0,u0(k,g[it>>2]|0)|0,k=g[k>>2]|0,S=0;L=y+(S<<2)|0,z=g[L>>2]|0,!((z|0)==-1|(z|0)==(k|0));)S=S+1|0;g[L>>2]=k,C=C+1|0}while((C|0)!=(H|0))}else{C=0;do{for(k=ot+(C<<4)|0,bf(k,g[it>>2]|0,0,1)|0,k=g[k>>2]|0,S=0;L=y+(S<<2)|0,z=g[L>>2]|0,!((z|0)==-1|(z|0)==(k|0));)S=S+1|0;g[L>>2]=k,C=C+1|0}while((C|0)!=(H|0))}wt=Ct}function M(){return 12}function O(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0;if(ke(p|0,0,52)|0,z=It()|0|134225919,(p|0)<1){S=0,y=0;do fi(S)|0&&(ke(S|0,0,45)|0,L=z|(It()|0),p=m+(y<<3)|0,g[p>>2]=-1,g[p+4>>2]=L,y=y+1|0),S=S+1|0;while((S|0)!=122);return}L=0,y=0;do{if(fi(L)|0){for(ke(L|0,0,45)|0,S=1,C=-1,k=z|(It()|0);H=ke(7,0,(15-S|0)*3|0)|0,C=C&~H,k=k&~(It()|0),(S|0)!=(p|0);)S=S+1|0;H=m+(y<<3)|0,g[H>>2]=C,g[H+4>>2]=k,y=y+1|0}L=L+1|0}while((L|0)!=122)}function B(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,it=0;if(z=wt,wt=wt+64|0,L=z,(p|0)==(y|0)&(m|0)==(S|0)|(!1|(m&2013265920|0)!=134217728|(!1|(S&2013265920|0)!=134217728))||(C=me(p|0,m|0,52)|0,It()|0,C=C&15,k=me(y|0,S|0,52)|0,It()|0,(C|0)!=(k&15|0)))return L=0,wt=z,L|0;if(k=C+-1|0,C>>>0>1&&(it=Bd(p,m,k)|0,H=It()|0,k=Bd(y,S,k)|0,(it|0)==(k|0)&(H|0)==(It()|0))&&(k=(C^15)*3|0,C=me(p|0,m|0,k|0)|0,It()|0,C=C&7,k=me(y|0,S|0,k|0)|0,It()|0,k=k&7,(C|0)==0|(k|0)==0||(g[21136+(C<<2)>>2]|0)==(k|0)||(g[21168+(C<<2)>>2]|0)==(k|0)))return it=1,wt=z,it|0;C=L,k=C+56|0;do g[C>>2]=0,C=C+4|0;while((C|0)<(k|0));return f_(p,m,1,L),it=L,!((g[it>>2]|0)==(y|0)&&(g[it+4>>2]|0)==(S|0))&&(it=L+8|0,!((g[it>>2]|0)==(y|0)&&(g[it+4>>2]|0)==(S|0)))&&(it=L+16|0,!((g[it>>2]|0)==(y|0)&&(g[it+4>>2]|0)==(S|0)))&&(it=L+24|0,!((g[it>>2]|0)==(y|0)&&(g[it+4>>2]|0)==(S|0)))&&(it=L+32|0,!((g[it>>2]|0)==(y|0)&&(g[it+4>>2]|0)==(S|0)))&&(it=L+40|0,!((g[it>>2]|0)==(y|0)&&(g[it+4>>2]|0)==(S|0)))?(C=L+48|0,C=((g[C>>2]|0)==(y|0)?(g[C+4>>2]|0)==(S|0):0)&1):C=1,it=C,wt=z,it|0}function U(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,it=0,ot=0;if(it=wt,wt=wt+16|0,L=it,!(B(p,m,y,S)|0))return z=0,H=0,Je(z|0),wt=it,H|0;for(z=m&-2130706433,C=(ji(p,m)|0)==0,C=C?1:2;g[L>>2]=0,ot=Wn(p,m,C,L)|0,k=C+1|0,!((ot|0)==(y|0)&(It()|0)==(S|0));)if(k>>>0<7)C=k;else{C=0,p=0,H=6;break}return(H|0)==6?(Je(C|0),wt=it,p|0):(ot=ke(C|0,0,56)|0,H=z|(It()|0)|268435456,ot=p|ot,Je(H|0),wt=it,ot|0)}function W(p,m){p=p|0,m=m|0;var y=0;return y=!0&(m&2013265920|0)==268435456,Je((y?m&-2130706433|134217728:0)|0),(y?p:0)|0}function Z(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;return S=wt,wt=wt+16|0,y=S,!0&(m&2013265920|0)==268435456?(C=me(p|0,m|0,56)|0,It()|0,g[y>>2]=0,y=Wn(p,m&-2130706433|134217728,C&7,y)|0,m=It()|0,Je(m|0),wt=S,y|0):(m=0,y=0,Je(m|0),wt=S,y|0)}function $(p,m){p=p|0,m=m|0;var y=0;if(!(!0&(m&2013265920|0)==268435456))return y=0,y|0;switch(y=me(p|0,m|0,56)|0,It()|0,y&7){case 0:case 7:return y=0,y|0;default:}return y=m&-2130706433|134217728,!0&(m&117440512|0)==16777216&(ji(p,y)|0)!=0?(y=0,y|0):(y=aA(p,y)|0,y|0)}function st(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0;k=wt,wt=wt+16|0,S=k,L=!0&(m&2013265920|0)==268435456,C=m&-2130706433|134217728,z=y,g[z>>2]=L?p:0,g[z+4>>2]=L?C:0,L?(m=me(p|0,m|0,56)|0,It()|0,g[S>>2]=0,p=Wn(p,C,m&7,S)|0,m=It()|0):(p=0,m=0),z=y+8|0,g[z>>2]=p,g[z+4>>2]=m,wt=k}function At(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;C=(ji(p,m)|0)==0,m=m&-2130706433,S=y,g[S>>2]=C?p:0,g[S+4>>2]=C?m|285212672:0,S=y+8|0,g[S>>2]=p,g[S+4>>2]=m|301989888,S=y+16|0,g[S>>2]=p,g[S+4>>2]=m|318767104,S=y+24|0,g[S>>2]=p,g[S+4>>2]=m|335544320,S=y+32|0,g[S>>2]=p,g[S+4>>2]=m|352321536,y=y+40|0,g[y>>2]=p,g[y+4>>2]=m|369098752}function pt(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0;if(L=wt,wt=wt+16|0,k=L,S=me(p|0,m|0,56)|0,It()|0,z=!0&(m&2013265920|0)==268435456,C=z?p:0,p=z?m&-2130706433|134217728:0,m=yu(C,p,S&7)|0,(m|0)==-1){g[y>>2]=0,wt=L;return}T(C,p,k),S=me(C|0,p|0,52)|0,It()|0,S=S&15,ji(C,p)|0?l0(k,S,m,2,y):iA(k,S,m,2,y),wt=L}function yt(p){p=p|0;var m=0,y=0,S=0;return m=Ua(1,12)|0,m||Mi(22691,22646,49,22704),y=p+4|0,S=g[y>>2]|0,S|0?(S=S+8|0,g[S>>2]=m,g[y>>2]=m,m|0):(g[p>>2]|0&&Mi(22721,22646,61,22744),S=p,g[S>>2]=m,g[y>>2]=m,m|0)}function dt(p,m){p=p|0,m=m|0;var y=0,S=0;return S=ho(24)|0,S||Mi(22758,22646,78,22772),g[S>>2]=g[m>>2],g[S+4>>2]=g[m+4>>2],g[S+8>>2]=g[m+8>>2],g[S+12>>2]=g[m+12>>2],g[S+16>>2]=0,m=p+4|0,y=g[m>>2]|0,y|0?(g[y+16>>2]=S,g[m>>2]=S,S|0):(g[p>>2]|0&&Mi(22787,22646,82,22772),g[p>>2]=S,g[m>>2]=S,S|0)}function Ft(p){p=p|0;var m=0,y=0,S=0,C=0;if(p)for(S=1;;){if(m=g[p>>2]|0,m|0)do{if(y=g[m>>2]|0,y|0)do C=y,y=g[y+16>>2]|0,Gr(C);while(y|0);C=m,m=g[m+8>>2]|0,Gr(C)}while(m|0);if(m=p,p=g[p+8>>2]|0,S||Gr(m),p)S=0;else break}}function Ht(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0,we=0,je=0,Zr=0,qi=0,Ei=0,hn=0,Pi=0,Sn=0,yn=0,Or=0;if(C=p+8|0,g[C>>2]|0)return Or=1,Or|0;if(S=g[p>>2]|0,!S)return Or=0,Or|0;m=S,y=0;do y=y+1|0,m=g[m+8>>2]|0;while(m|0);if(y>>>0<2)return Or=0,Or|0;Sn=ho(y<<2)|0,Sn||Mi(22807,22646,317,22826),Pi=ho(y<<5)|0,Pi||Mi(22848,22646,321,22826),g[p>>2]=0,er=p+4|0,g[er>>2]=0,g[C>>2]=0,y=0,hn=0,$e=0,Ct=0;t:for(;;){if(ot=g[S>>2]|0,ot){k=0,L=ot;do{if(H=+Tt[L+8>>3],m=L,L=g[L+16>>2]|0,it=(L|0)==0,C=it?ot:L,z=+Tt[C+8>>3],+li(+(H-z))>3.141592653589793){Or=14;break}k=k+(z-H)*(+Tt[m>>3]+ +Tt[C>>3])}while(!it);if((Or|0)==14){Or=0,k=0,m=ot;do Ut=+Tt[m+8>>3],Ei=m+16|0,qi=g[Ei>>2]|0,qi=qi|0?qi:ot,_e=+Tt[qi+8>>3],k=k+(+Tt[m>>3]+ +Tt[qi>>3])*((_e<0?_e+6.283185307179586:_e)-(Ut<0?Ut+6.283185307179586:Ut)),m=g[(m|0?Ei:S)>>2]|0;while(m|0)}k>0?(g[Sn+(hn<<2)>>2]=S,hn=hn+1|0,C=$e,m=Ct):Or=19}else Or=19;if((Or|0)==19){Or=0;do if(y){if(m=y+8|0,g[m>>2]|0){Or=21;break t}if(y=Ua(1,12)|0,!y){Or=23;break t}g[m>>2]=y,C=y+4|0,L=y,m=Ct}else if(Ct){C=er,L=Ct+8|0,m=S,y=p;break}else if(g[p>>2]|0){Or=27;break t}else{C=er,L=p,m=S,y=p;break}while(!1);if(g[L>>2]=S,g[C>>2]=S,L=Pi+($e<<5)|0,it=g[S>>2]|0,it){for(ot=Pi+($e<<5)+8|0,Tt[ot>>3]=17976931348623157e292,Ct=Pi+($e<<5)+24|0,Tt[Ct>>3]=17976931348623157e292,Tt[L>>3]=-17976931348623157e292,Nt=Pi+($e<<5)+16|0,Tt[Nt>>3]=-17976931348623157e292,We=17976931348623157e292,te=-17976931348623157e292,C=0,Wt=it,H=17976931348623157e292,ne=17976931348623157e292,Le=-17976931348623157e292,z=-17976931348623157e292;k=+Tt[Wt>>3],Ut=+Tt[Wt+8>>3],Wt=g[Wt+16>>2]|0,re=(Wt|0)==0,_e=+Tt[(re?it:Wt)+8>>3],k>3]=k,H=k),Ut>3]=Ut,ne=Ut),k>Le?Tt[L>>3]=k:k=Le,Ut>z&&(Tt[Nt>>3]=Ut,z=Ut),We=Ut>0&Utte?Ut:te,C=C|+li(+(Ut-_e))>3.141592653589793,!re;)Le=k;C&&(Tt[Nt>>3]=te,Tt[Ct>>3]=We)}else g[L>>2]=0,g[L+4>>2]=0,g[L+8>>2]=0,g[L+12>>2]=0,g[L+16>>2]=0,g[L+20>>2]=0,g[L+24>>2]=0,g[L+28>>2]=0;C=$e+1|0}if(Ei=S+8|0,S=g[Ei>>2]|0,g[Ei>>2]=0,S)$e=C,Ct=m;else{Or=45;break}}if((Or|0)==21)Mi(22624,22646,35,22658);else if((Or|0)==23)Mi(22678,22646,37,22658);else if((Or|0)==27)Mi(22721,22646,61,22744);else if((Or|0)==45){t:do if((hn|0)>0){for(Ei=(C|0)==0,Zr=C<<2,qi=(p|0)==0,je=0,m=0;;){if(we=g[Sn+(je<<2)>>2]|0,Ei)Or=73;else{if($e=ho(Zr)|0,!$e){Or=50;break}if(er=ho(Zr)|0,!er){Or=52;break}e:do if(qi)y=0;else{for(C=0,y=0,L=p;S=Pi+(C<<5)|0,St(g[L>>2]|0,S,g[we>>2]|0)|0?(g[$e+(y<<2)>>2]=L,g[er+(y<<2)>>2]=S,re=y+1|0):re=y,L=g[L+8>>2]|0,L;)C=C+1|0,y=re;if((re|0)>0)if(S=g[$e>>2]|0,(re|0)==1)y=S;else for(Nt=0,Wt=-1,y=S,Ct=S;;){for(it=g[Ct>>2]|0,S=0,L=0;C=g[g[$e+(L<<2)>>2]>>2]|0,(C|0)==(it|0)?ot=S:ot=S+((St(C,g[er+(L<<2)>>2]|0,g[it>>2]|0)|0)&1)|0,L=L+1|0,(L|0)!=(re|0);)S=ot;if(C=(ot|0)>(Wt|0),y=C?Ct:y,S=Nt+1|0,(S|0)==(re|0))break e;Nt=S,Wt=C?ot:Wt,Ct=g[$e+(S<<2)>>2]|0}else y=0}while(!1);if(Gr($e),Gr(er),y){if(C=y+4|0,S=g[C>>2]|0,S)y=S+8|0;else if(g[y>>2]|0){Or=70;break}g[y>>2]=we,g[C>>2]=we}else Or=73}if((Or|0)==73){if(Or=0,m=g[we>>2]|0,m|0)do er=m,m=g[m+16>>2]|0,Gr(er);while(m|0);Gr(we),m=2}if(je=je+1|0,(je|0)>=(hn|0)){yn=m;break t}}(Or|0)==50?Mi(22863,22646,249,22882):(Or|0)==52?Mi(22901,22646,252,22882):(Or|0)==70&&Mi(22721,22646,61,22744)}else yn=0;while(!1);return Gr(Sn),Gr(Pi),Or=yn,Or|0}return 0}function St(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0;if(!(pl(m,y)|0)||(m=n0(m)|0,it=+Tt[y>>3],S=+Tt[y+8>>3],S=m&S<0?S+6.283185307179586:S,p=g[p>>2]|0,!p))return p=0,p|0;if(m){m=0,y=p;t:for(;;){for(;L=+Tt[y>>3],H=+Tt[y+8>>3],y=y+16|0,ot=g[y>>2]|0,ot=ot|0?ot:p,k=+Tt[ot>>3],C=+Tt[ot+8>>3],L>k?(z=L,L=H):(z=k,k=L,L=C,C=H),!!(itz);)if(y=g[y>>2]|0,!y){y=22;break t}if(H=C<0?C+6.283185307179586:C,L=L<0?L+6.283185307179586:L,S=L==S|H==S?S+-2220446049250313e-31:S,H=H+(it-k)/(z-k)*(L-H),(H<0?H+6.283185307179586:H)>S&&(m=m^1),y=g[y>>2]|0,!y){y=22;break}}if((y|0)==22)return m|0}else{m=0,y=p;t:for(;;){for(;L=+Tt[y>>3],H=+Tt[y+8>>3],y=y+16|0,ot=g[y>>2]|0,ot=ot|0?ot:p,k=+Tt[ot>>3],C=+Tt[ot+8>>3],L>k?(z=L,L=H):(z=k,k=L,L=C,C=H),!!(itz);)if(y=g[y>>2]|0,!y){y=22;break t}if(S=L==S|C==S?S+-2220446049250313e-31:S,C+(it-k)/(z-k)*(L-C)>S&&(m=m^1),y=g[y>>2]|0,!y){y=22;break}}if((y|0)==22)return m|0}return 0}function Bt(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0;if(te=wt,wt=wt+32|0,We=te+16|0,Le=te,k=me(p|0,m|0,52)|0,It()|0,k=k&15,Wt=me(y|0,S|0,52)|0,It()|0,(k|0)!=(Wt&15|0))return We=1,wt=te,We|0;if(it=me(p|0,m|0,45)|0,It()|0,it=it&127,ot=me(y|0,S|0,45)|0,It()|0,ot=ot&127,Wt=(it|0)!=(ot|0),Wt){if(z=tA(it,ot)|0,(z|0)==7)return We=2,wt=te,We|0;H=tA(ot,it)|0,(H|0)==7?Mi(22925,22949,151,22959):(re=z,L=H)}else re=0,L=0;Ct=fi(it)|0,Nt=fi(ot)|0,g[We>>2]=0,g[We+4>>2]=0,g[We+8>>2]=0,g[We+12>>2]=0;do if(re){if(ot=g[4304+(it*28|0)+(re<<2)>>2]|0,z=(ot|0)>0,Nt)if(z){it=0,H=y,z=S;do H=p0(H,z)|0,z=It()|0,L=co(L)|0,(L|0)==1&&(L=co(1)|0),it=it+1|0;while((it|0)!=(ot|0));ot=L,it=H,H=z}else ot=L,it=y,H=S;else if(z){it=0,H=y,z=S;do H=Fd(H,z)|0,z=It()|0,L=co(L)|0,it=it+1|0;while((it|0)!=(ot|0));ot=L,it=H,H=z}else ot=L,it=y,H=S;if(bi(it,H,We)|0,Wt||Mi(22972,22949,181,22959),z=(Ct|0)!=0,L=(Nt|0)!=0,z&L&&Mi(22999,22949,182,22959),z){if(L=Es(p,m)|0,br[22032+(L*7|0)+re>>0]|0){k=3;break}H=g[21200+(L*28|0)+(re<<2)>>2]|0,it=H,ne=26}else if(L){if(L=Es(it,H)|0,br[22032+(L*7|0)+ot>>0]|0){k=4;break}it=0,H=g[21200+(ot*28|0)+(L<<2)>>2]|0,ne=26}else L=0;if((ne|0)==26)if((H|0)<=-1&&Mi(23030,22949,212,22959),(it|0)<=-1&&Mi(23053,22949,213,22959),(H|0)>0){z=We+4|0,L=0;do fh(z),L=L+1|0;while((L|0)!=(H|0));L=it}else L=it;if(g[Le>>2]=0,g[Le+4>>2]=0,g[Le+8>>2]=0,rA(Le,re),k|0)for(;Ho(k)|0?za(Le):hh(Le),(k|0)>1;)k=k+-1|0;if((L|0)>0){k=0;do fh(Le),k=k+1|0;while((k|0)!=(L|0))}ne=We+4|0,Ln(ne,Le,ne),js(ne),ne=50}else if(bi(y,S,We)|0,(Ct|0)!=0&(Nt|0)!=0)if((ot|0)!=(it|0)&&Mi(23077,22949,243,22959),L=Es(p,m)|0,k=Es(y,S)|0,br[22032+(L*7|0)+k>>0]|0)k=5;else if(L=g[21200+(L*28|0)+(k<<2)>>2]|0,(L|0)>0){z=We+4|0,k=0;do fh(z),k=k+1|0;while((k|0)!=(L|0));ne=50}else ne=50;else ne=50;while(!1);return(ne|0)==50&&(k=We+4|0,g[C>>2]=g[k>>2],g[C+4>>2]=g[k+4>>2],g[C+8>>2]=g[k+8>>2],k=0),We=k,wt=te,We|0}function Qt(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0;if(re=wt,wt=wt+48|0,L=re+36|0,z=re+24|0,H=re+12|0,it=re,k=me(p|0,m|0,52)|0,It()|0,k=k&15,Nt=me(p|0,m|0,45)|0,It()|0,Nt=Nt&127,ot=fi(Nt)|0,ke(k|0,0,52)|0,Le=It()|0|134225919,ne=S,g[ne>>2]=-1,g[ne+4>>2]=Le,!k)return(g[y>>2]|0)>1||(g[y+4>>2]|0)>1||(g[y+8>>2]|0)>1||(C=Jp(Nt,Fa(y)|0)|0,(C|0)==127)?(Le=1,wt=re,Le|0):(Wt=ke(C|0,0,45)|0,ne=It()|0,Nt=S,ne=g[Nt+4>>2]&-1040385|ne,Le=S,g[Le>>2]=g[Nt>>2]|Wt,g[Le+4>>2]=ne,Le=0,wt=re,Le|0);for(g[L>>2]=g[y>>2],g[L+4>>2]=g[y+4>>2],g[L+8>>2]=g[y+8>>2];g[z>>2]=g[L>>2],g[z+4>>2]=g[L+4>>2],g[z+8>>2]=g[L+8>>2],Ho(k)|0?(Rd(L),g[H>>2]=g[L>>2],g[H+4>>2]=g[L+4>>2],g[H+8>>2]=g[L+8>>2],za(H)):(Al(L),g[H>>2]=g[L>>2],g[H+4>>2]=g[L+4>>2],g[H+8>>2]=g[L+8>>2],hh(H)),eA(z,H,it),js(it),ne=S,We=g[ne>>2]|0,ne=g[ne+4>>2]|0,te=(15-k|0)*3|0,y=ke(7,0,te|0)|0,ne=ne&~(It()|0),te=ke(Fa(it)|0,0,te|0)|0,ne=It()|0|ne,Le=S,g[Le>>2]=te|We&~y,g[Le+4>>2]=ne,(k|0)>1;)k=k+-1|0;t:do if((g[L>>2]|0)<=1&&(g[L+4>>2]|0)<=1&&(g[L+8>>2]|0)<=1){k=Fa(L)|0,z=Jp(Nt,k)|0,(z|0)==127?it=0:it=fi(z)|0;e:do if(k){if(ot){if(L=21408+((Es(p,m)|0)*28|0)+(k<<2)|0,L=g[L>>2]|0,(L|0)>0){y=0;do k=Na(k)|0,y=y+1|0;while((y|0)!=(L|0))}if((k|0)==1){C=3;break t}y=Jp(Nt,k)|0,(y|0)==127&&Mi(23104,22949,376,23134),fi(y)|0?Mi(23147,22949,377,23134):(Wt=L,Ct=k,C=y)}else Wt=0,Ct=k,C=z;if(H=g[4304+(Nt*28|0)+(Ct<<2)>>2]|0,(H|0)<=-1&&Mi(23178,22949,384,23134),!it){if((Wt|0)<=-1&&Mi(23030,22949,417,23134),Wt|0){L=S,k=0,y=g[L>>2]|0,L=g[L+4>>2]|0;do y=Wo(y,L)|0,L=It()|0,te=S,g[te>>2]=y,g[te+4>>2]=L,k=k+1|0;while((k|0)<(Wt|0))}if((H|0)<=0){k=54;break}for(L=S,k=0,y=g[L>>2]|0,L=g[L+4>>2]|0;;)if(y=Wo(y,L)|0,L=It()|0,te=S,g[te>>2]=y,g[te+4>>2]=L,k=k+1|0,(k|0)==(H|0)){k=54;break e}}if(z=tA(C,Nt)|0,(z|0)==7&&Mi(22925,22949,393,23134),k=S,y=g[k>>2]|0,k=g[k+4>>2]|0,(H|0)>0){L=0;do y=Wo(y,k)|0,k=It()|0,te=S,g[te>>2]=y,g[te+4>>2]=k,L=L+1|0;while((L|0)!=(H|0))}if(y=Es(y,k)|0,te=mu(C)|0,y=g[(te?21824:21616)+(z*28|0)+(y<<2)>>2]|0,(y|0)<=-1&&Mi(23030,22949,412,23134),!y)k=54;else{z=S,k=0,L=g[z>>2]|0,z=g[z+4>>2]|0;do L=gh(L,z)|0,z=It()|0,te=S,g[te>>2]=L,g[te+4>>2]=z,k=k+1|0;while((k|0)<(y|0));k=54}}else if((ot|0)!=0&(it|0)!=0)if(te=Es(p,m)|0,k=S,k=21408+(te*28|0)+((Es(g[k>>2]|0,g[k+4>>2]|0)|0)<<2)|0,k=g[k>>2]|0,(k|0)<=-1&&Mi(23201,22949,433,23134),!k)C=z,k=55;else{L=S,C=0,y=g[L>>2]|0,L=g[L+4>>2]|0;do y=Wo(y,L)|0,L=It()|0,te=S,g[te>>2]=y,g[te+4>>2]=L,C=C+1|0;while((C|0)<(k|0));C=z,k=54}else C=z,k=54;while(!1);if((k|0)==54&&it&&(k=55),(k|0)==55&&(te=S,(Es(g[te>>2]|0,g[te+4>>2]|0)|0)==1)){C=4;break}te=S,Le=g[te>>2]|0,te=g[te+4>>2]&-1040385,We=ke(C|0,0,45)|0,te=te|(It()|0),C=S,g[C>>2]=Le|We,g[C+4>>2]=te,C=0}else C=2;while(!1);return te=C,wt=re,te|0}function $t(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0;return L=wt,wt=wt+16|0,k=L,p=Bt(p,m,y,S,k)|0,p||(xf(k,C),p=0),wt=L,p|0}function oe(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0;return C=wt,wt=wt+16|0,k=C,__(y,k),S=Qt(p,m,k,S)|0,wt=C,S|0}function pe(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0;return L=wt,wt=wt+32|0,C=L+12|0,k=L,!(Bt(p,m,p,m,C)|0)&&!(Bt(p,m,y,S,k)|0)?p=Hl(C,k)|0:p=-1,wt=L,p|0}function he(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0;return L=wt,wt=wt+32|0,C=L+12|0,k=L,!(Bt(p,m,p,m,C)|0)&&!(Bt(p,m,y,S,k)|0)?p=Hl(C,k)|0:p=-1,wt=L,(p>>>31^1)+p|0}function be(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0;if($e=wt,wt=wt+48|0,k=$e+24|0,L=$e+12|0,Ut=$e,!(Bt(p,m,p,m,k)|0)&&!(Bt(p,m,y,S,L)|0)){if(_e=Hl(k,L)|0,(_e|0)<0)return Ut=_e,wt=$e,Ut|0;for(g[k>>2]=0,g[k+4>>2]=0,g[k+8>>2]=0,g[L>>2]=0,g[L+4>>2]=0,g[L+8>>2]=0,Bt(p,m,p,m,k)|0,Bt(p,m,y,S,L)|0,Oe(k),Oe(L),_e?(ot=g[k>>2]|0,Wt=+(_e|0),Le=k+4|0,Ct=g[Le>>2]|0,We=k+8|0,Nt=g[We>>2]|0,te=k,y=ot,S=Ct,k=Nt,re=+((g[L>>2]|0)-ot|0)/Wt,ne=+((g[L+4>>2]|0)-Ct|0)/Wt,Wt=+((g[L+8>>2]|0)-Nt|0)/Wt):(S=k+4|0,Nt=k+8|0,Le=S,We=Nt,te=k,y=g[k>>2]|0,S=g[S>>2]|0,k=g[Nt>>2]|0,re=0,ne=0,Wt=0),g[Ut>>2]=y,Nt=Ut+4|0,g[Nt>>2]=S,Ct=Ut+8|0,g[Ct>>2]=k,ot=0;;){H=+(ot|0),er=re*H+ +(y|0),z=ne*H+ +(g[Le>>2]|0),H=Wt*H+ +(g[We>>2]|0),S=~~+Mf(+er),L=~~+Mf(+z),y=~~+Mf(+H),er=+li(+(+(S|0)-er)),z=+li(+(+(L|0)-z)),H=+li(+(+(y|0)-H));do if(er>z&er>H)S=0-(L+y)|0,k=L;else if(it=0-S|0,z>H){k=it-y|0;break}else{k=L,y=it-L|0;break}while(!1);if(g[Ut>>2]=S,g[Nt>>2]=k,g[Ct>>2]=y,o0(Ut),Qt(p,m,Ut,C+(ot<<3)|0)|0,(ot|0)==(_e|0))break;ot=ot+1|0,y=g[te>>2]|0}return Ut=0,wt=$e,Ut|0}return Ut=-1,wt=$e,Ut|0}function Ze(p,m){p=p|0,m=m|0;var y=0;if(!m)return y=1,y|0;y=p,p=1;do p=Oc(m&1|0?y:1,p)|0,m=m>>1,y=Oc(y,y)|0;while(m|0);return p|0}function Kr(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0;if(!(pl(m,y)|0)||(m=n0(m)|0,Nt=+Tt[y>>3],S=+Tt[y+8>>3],S=m&S<0?S+6.283185307179586:S,Ct=g[p>>2]|0,(Ct|0)<=0))return Ct=0,Ct|0;if(ot=g[p+4>>2]|0,m){m=0,y=-1,p=0;t:for(;;){for(it=p;L=+Tt[ot+(it<<4)>>3],H=+Tt[ot+(it<<4)+8>>3],p=(y+2|0)%(Ct|0)|0,k=+Tt[ot+(p<<4)>>3],C=+Tt[ot+(p<<4)+8>>3],L>k?(z=L,L=H):(z=k,k=L,L=C,C=H),!!(Ntz);)if(y=it+1|0,(y|0)<(Ct|0))p=it,it=y,y=p;else{y=22;break t}if(H=C<0?C+6.283185307179586:C,L=L<0?L+6.283185307179586:L,S=L==S|H==S?S+-2220446049250313e-31:S,H=H+(Nt-k)/(z-k)*(L-H),(H<0?H+6.283185307179586:H)>S&&(m=m^1),p=it+1|0,(p|0)>=(Ct|0)){y=22;break}else y=it}if((y|0)==22)return m|0}else{m=0,y=-1,p=0;t:for(;;){for(it=p;L=+Tt[ot+(it<<4)>>3],H=+Tt[ot+(it<<4)+8>>3],p=(y+2|0)%(Ct|0)|0,k=+Tt[ot+(p<<4)>>3],C=+Tt[ot+(p<<4)+8>>3],L>k?(z=L,L=H):(z=k,k=L,L=C,C=H),!!(Ntz);)if(y=it+1|0,(y|0)<(Ct|0))p=it,it=y,y=p;else{y=22;break t}if(S=L==S|C==S?S+-2220446049250313e-31:S,C+(Nt-k)/(z-k)*(L-C)>S&&(m=m^1),p=it+1|0,(p|0)>=(Ct|0)){y=22;break}else y=it}if((y|0)==22)return m|0}return 0}function Ee(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0;if(re=g[p>>2]|0,!re){g[m>>2]=0,g[m+4>>2]=0,g[m+8>>2]=0,g[m+12>>2]=0,g[m+16>>2]=0,g[m+20>>2]=0,g[m+24>>2]=0,g[m+28>>2]=0;return}if(ne=m+8|0,Tt[ne>>3]=17976931348623157e292,Le=m+24|0,Tt[Le>>3]=17976931348623157e292,Tt[m>>3]=-17976931348623157e292,We=m+16|0,Tt[We>>3]=-17976931348623157e292,!((re|0)<=0)){for(Nt=g[p+4>>2]|0,it=17976931348623157e292,ot=-17976931348623157e292,Ct=0,p=-1,k=17976931348623157e292,L=17976931348623157e292,H=-17976931348623157e292,S=-17976931348623157e292,Wt=0;y=+Tt[Nt+(Wt<<4)>>3],z=+Tt[Nt+(Wt<<4)+8>>3],p=p+2|0,C=+Tt[Nt+(((p|0)==(re|0)?0:p)<<4)+8>>3],y>3]=y,k=y),z>3]=z,L=z),y>H?Tt[m>>3]=y:y=H,z>S&&(Tt[We>>3]=z,S=z),it=z>0&zot?z:ot,Ct=Ct|+li(+(z-C))>3.141592653589793,p=Wt+1|0,(p|0)!=(re|0);)te=Wt,H=y,Wt=p,p=te;Ct&&(Tt[We>>3]=ot,Tt[Le>>3]=it)}}function pr(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0,we=0;if(re=g[p>>2]|0,re){if(ne=m+8|0,Tt[ne>>3]=17976931348623157e292,Le=m+24|0,Tt[Le>>3]=17976931348623157e292,Tt[m>>3]=-17976931348623157e292,We=m+16|0,Tt[We>>3]=-17976931348623157e292,(re|0)>0){for(C=g[p+4>>2]|0,Nt=17976931348623157e292,Wt=-17976931348623157e292,S=0,y=-1,H=17976931348623157e292,it=17976931348623157e292,Ct=-17976931348623157e292,L=-17976931348623157e292,te=0;k=+Tt[C+(te<<4)>>3],ot=+Tt[C+(te<<4)+8>>3],er=y+2|0,z=+Tt[C+(((er|0)==(re|0)?0:er)<<4)+8>>3],k>3]=k,H=k),ot>3]=ot,it=ot),k>Ct?Tt[m>>3]=k:k=Ct,ot>L&&(Tt[We>>3]=ot,L=ot),Nt=ot>0&otWt?ot:Wt,S=S|+li(+(ot-z))>3.141592653589793,y=te+1|0,(y|0)!=(re|0);)er=te,Ct=k,te=y,y=er;S&&(Tt[We>>3]=Wt,Tt[Le>>3]=Nt)}}else g[m>>2]=0,g[m+4>>2]=0,g[m+8>>2]=0,g[m+12>>2]=0,g[m+16>>2]=0,g[m+20>>2]=0,g[m+24>>2]=0,g[m+28>>2]=0;if(er=p+8|0,y=g[er>>2]|0,!((y|0)<=0)){$e=p+12|0,Ut=0;do if(C=g[$e>>2]|0,S=Ut,Ut=Ut+1|0,Le=m+(Ut<<5)|0,We=g[C+(S<<3)>>2]|0,We){if(te=m+(Ut<<5)+8|0,Tt[te>>3]=17976931348623157e292,p=m+(Ut<<5)+24|0,Tt[p>>3]=17976931348623157e292,Tt[Le>>3]=-17976931348623157e292,_e=m+(Ut<<5)+16|0,Tt[_e>>3]=-17976931348623157e292,(We|0)>0){for(re=g[C+(S<<3)+4>>2]|0,Nt=17976931348623157e292,Wt=-17976931348623157e292,C=0,S=-1,ne=0,H=17976931348623157e292,it=17976931348623157e292,ot=-17976931348623157e292,L=-17976931348623157e292;k=+Tt[re+(ne<<4)>>3],Ct=+Tt[re+(ne<<4)+8>>3],S=S+2|0,z=+Tt[re+(((S|0)==(We|0)?0:S)<<4)+8>>3],k>3]=k,H=k),Ct>3]=Ct,it=Ct),k>ot?Tt[Le>>3]=k:k=ot,Ct>L&&(Tt[_e>>3]=Ct,L=Ct),Nt=Ct>0&CtWt?Ct:Wt,C=C|+li(+(Ct-z))>3.141592653589793,S=ne+1|0,(S|0)!=(We|0);)we=ne,ne=S,ot=k,S=we;C&&(Tt[_e>>3]=Wt,Tt[p>>3]=Nt)}}else g[Le>>2]=0,g[Le+4>>2]=0,g[Le+8>>2]=0,g[Le+12>>2]=0,g[Le+16>>2]=0,g[Le+20>>2]=0,g[Le+24>>2]=0,g[Le+28>>2]=0,y=g[er>>2]|0;while((Ut|0)<(y|0))}}function tr(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0;if(!(Kr(p,m,y)|0))return C=0,C|0;if(C=p+8|0,(g[C>>2]|0)<=0)return C=1,C|0;for(S=p+12|0,p=0;;){if(k=p,p=p+1|0,Kr((g[S>>2]|0)+(k<<3)|0,m+(p<<5)|0,y)|0){p=0,S=6;break}if((p|0)>=(g[C>>2]|0)){p=1,S=6;break}}return(S|0)==6?p|0:0}function Gi(){return 8}function Jr(){return 16}function Vr(){return 168}function ei(){return 8}function On(){return 16}function tn(){return 12}function Gs(){return 8}function hs(p){p=p|0;var m=0,y=0;return y=+Tt[p>>3],m=+Tt[p+8>>3],+ +bn(+(y*y+m*m))}function Bn(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0;it=+Tt[p>>3],H=+Tt[m>>3]-it,z=+Tt[p+8>>3],L=+Tt[m+8>>3]-z,Ct=+Tt[y>>3],k=+Tt[S>>3]-Ct,Nt=+Tt[y+8>>3],ot=+Tt[S+8>>3]-Nt,k=(k*(z-Nt)-(it-Ct)*ot)/(H*ot-L*k),Tt[C>>3]=it+H*k,Tt[C+8>>3]=z+L*k}function qo(p,m){return p=p|0,m=m|0,+Tt[p>>3]!=+Tt[m>>3]?(m=0,m|0):(m=+Tt[p+8>>3]==+Tt[m+8>>3],m|0)}function jr(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;return C=+Tt[p>>3]-+Tt[m>>3],S=+Tt[p+8>>3]-+Tt[m+8>>3],y=+Tt[p+16>>3]-+Tt[m+16>>3],+(C*C+S*S+y*y)}function ql(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;y=+Tt[p>>3],S=+Ur(+y),y=+hi(+y),Tt[m+16>>3]=y,y=+Tt[p+8>>3],C=S*+Ur(+y),Tt[m>>3]=C,y=S*+hi(+y),Tt[m+8>>3]=y}function Zl(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0;if(it=wt,wt=wt+32|0,C=it+16|0,k=it,T(p,m,C),L=wf(p,m)|0,H=Es(p,m)|0,lh(L,k),m=Ld(L,g[C>>2]|0)|0,!(fi(L)|0))return H=m,wt=it,H|0;do switch(L|0){case 4:{p=0,y=14;break}case 14:{p=1,y=14;break}case 24:{p=2,y=14;break}case 38:{p=3,y=14;break}case 49:{p=4,y=14;break}case 58:{p=5,y=14;break}case 63:{p=6,y=14;break}case 72:{p=7,y=14;break}case 83:{p=8,y=14;break}case 97:{p=9,y=14;break}case 107:{p=10,y=14;break}case 117:{p=11,y=14;break}default:z=0,S=0}while(!1);return(y|0)==14&&(z=g[22096+(p*24|0)+8>>2]|0,S=g[22096+(p*24|0)+16>>2]|0),p=g[C>>2]|0,(p|0)!=(g[k>>2]|0)&&(L=mu(L)|0,p=g[C>>2]|0,L|(p|0)==(S|0)&&(m=(m+1|0)%6|0)),(H|0)==3&(p|0)==(S|0)?(H=(m+5|0)%6|0,wt=it,H|0):(H|0)==5&(p|0)==(z|0)?(H=(m+1|0)%6|0,wt=it,H|0):(H=m,wt=it,H|0)}function yu(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;return S=ji(p,m)|0,(y+-1|0)>>>0>5||(C=(S|0)!=0,(y|0)==1&C)?(y=-1,y|0):(S=Zl(p,m)|0,C?(y=(5-S+(g[22384+(y<<2)>>2]|0)|0)%5|0,y|0):(y=(6-S+(g[22416+(y<<2)>>2]|0)|0)%6|0,y|0))}function vu(p,m,y){p=p|0,m=m|0,y=y|0;var S=0;(m|0)>0?(S=Ua(m,4)|0,g[p>>2]=S,S||Mi(23230,23253,40,23267)):g[p>>2]=0,g[p+4>>2]=m,g[p+8>>2]=0,g[p+12>>2]=y}function _h(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;C=p+4|0,k=p+12|0,L=p+8|0;t:for(;;){for(y=g[C>>2]|0,m=0;;){if((m|0)>=(y|0))break t;if(S=g[p>>2]|0,z=g[S+(m<<2)>>2]|0,!z)m=m+1|0;else break}m=S+(~~(+li(+(+dl(10,+ +(15-(g[k>>2]|0)|0))*(+Tt[z>>3]+ +Tt[z+8>>3])))%+(y|0))>>>0<<2)|0,y=g[m>>2]|0;e:do if(y|0){if(S=z+32|0,(y|0)==(z|0))g[m>>2]=g[S>>2];else{if(y=y+32|0,m=g[y>>2]|0,!m)break;for(;(m|0)!=(z|0);)if(y=m+32|0,m=g[y>>2]|0,!m)break e;g[y>>2]=g[S>>2]}Gr(z),g[L>>2]=(g[L>>2]|0)+-1}while(!1)}Gr(g[p>>2]|0)}function Ws(p){p=p|0;var m=0,y=0,S=0;for(S=g[p+4>>2]|0,y=0;;){if((y|0)>=(S|0)){m=0,y=4;break}if(m=g[(g[p>>2]|0)+(y<<2)>>2]|0,!m)y=y+1|0;else{y=4;break}}return(y|0)==4?m|0:0}function Ps(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0;if(y=~~(+li(+(+dl(10,+ +(15-(g[p+12>>2]|0)|0))*(+Tt[m>>3]+ +Tt[m+8>>3])))%+(g[p+4>>2]|0))>>>0,y=(g[p>>2]|0)+(y<<2)|0,S=g[y>>2]|0,!S)return k=1,k|0;k=m+32|0;do if((S|0)!=(m|0)){if(y=g[S+32>>2]|0,!y)return k=1,k|0;for(C=y;;){if((C|0)==(m|0)){C=8;break}if(y=g[C+32>>2]|0,y)S=C,C=y;else{y=1,C=10;break}}if((C|0)==8){g[S+32>>2]=g[k>>2];break}else if((C|0)==10)return y|0}else g[y>>2]=g[k>>2];while(!1);return Gr(m),k=p+8|0,g[k>>2]=(g[k>>2]|0)+-1,k=0,k|0}function Eo(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0;k=ho(40)|0,k||Mi(23283,23253,98,23296),g[k>>2]=g[m>>2],g[k+4>>2]=g[m+4>>2],g[k+8>>2]=g[m+8>>2],g[k+12>>2]=g[m+12>>2],C=k+16|0,g[C>>2]=g[y>>2],g[C+4>>2]=g[y+4>>2],g[C+8>>2]=g[y+8>>2],g[C+12>>2]=g[y+12>>2],g[k+32>>2]=0,C=~~(+li(+(+dl(10,+ +(15-(g[p+12>>2]|0)|0))*(+Tt[m>>3]+ +Tt[m+8>>3])))%+(g[p+4>>2]|0))>>>0,C=(g[p>>2]|0)+(C<<2)|0,S=g[C>>2]|0;do if(!S)g[C>>2]=k;else{for(;!(us(S,m)|0&&us(S+16|0,y)|0);)if(C=g[S+32>>2]|0,S=C|0?C:S,!(g[S+32>>2]|0)){L=10;break}if((L|0)==10){g[S+32>>2]=k;break}return Gr(k),L=S,L|0}while(!1);return L=p+8|0,g[L>>2]=(g[L>>2]|0)+1,L=k,L|0}function yh(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;if(C=~~(+li(+(+dl(10,+ +(15-(g[p+12>>2]|0)|0))*(+Tt[m>>3]+ +Tt[m+8>>3])))%+(g[p+4>>2]|0))>>>0,C=g[(g[p>>2]|0)+(C<<2)>>2]|0,!C)return y=0,y|0;if(!y){for(p=C;;){if(us(p,m)|0){S=10;break}if(p=g[p+32>>2]|0,!p){p=0,S=10;break}}if((S|0)==10)return p|0}for(p=C;;){if(us(p,m)|0&&us(p+16|0,y)|0){S=10;break}if(p=g[p+32>>2]|0,!p){p=0,S=10;break}}return(S|0)==10?p|0:0}function Fn(p,m){p=p|0,m=m|0;var y=0;if(y=~~(+li(+(+dl(10,+ +(15-(g[p+12>>2]|0)|0))*(+Tt[m>>3]+ +Tt[m+8>>3])))%+(g[p+4>>2]|0))>>>0,p=g[(g[p>>2]|0)+(y<<2)>>2]|0,!p)return y=0,y|0;for(;;){if(us(p,m)|0){m=5;break}if(p=g[p+32>>2]|0,!p){p=0,m=5;break}}return(m|0)==5?p|0:0}function fs(){return 23312}function Zo(p){return p=+p,+ +Ux(+p)}function _n(p){return p=+p,~~+Zo(p)|0}function ho(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0;$e=wt,wt=wt+16|0,Nt=$e;do if(p>>>0<245){if(it=p>>>0<11?16:p+11&-8,p=it>>>3,Ct=g[5829]|0,y=Ct>>>p,y&3|0)return m=(y&1^1)+p|0,p=23356+(m<<1<<2)|0,y=p+8|0,S=g[y>>2]|0,C=S+8|0,k=g[C>>2]|0,(k|0)==(p|0)?g[5829]=Ct&~(1<>2]=p,g[y>>2]=k),Ut=m<<3,g[S+4>>2]=Ut|3,Ut=S+Ut+4|0,g[Ut>>2]=g[Ut>>2]|1,Ut=C,wt=$e,Ut|0;if(ot=g[5831]|0,it>>>0>ot>>>0){if(y|0)return m=2<>>12&16,m=m>>>z,y=m>>>5&8,m=m>>>y,k=m>>>2&4,m=m>>>k,p=m>>>1&2,m=m>>>p,S=m>>>1&1,S=(y|z|k|p|S)+(m>>>S)|0,m=23356+(S<<1<<2)|0,p=m+8|0,k=g[p>>2]|0,z=k+8|0,y=g[z>>2]|0,(y|0)==(m|0)?(p=Ct&~(1<>2]=m,g[p>>2]=y,p=Ct),Ut=S<<3,L=Ut-it|0,g[k+4>>2]=it|3,C=k+it|0,g[C+4>>2]=L|1,g[k+Ut>>2]=L,ot|0&&(S=g[5834]|0,m=ot>>>3,y=23356+(m<<1<<2)|0,m=1<>2]|0):(g[5829]=p|m,m=y,p=y+8|0),g[p>>2]=S,g[m+12>>2]=S,g[S+8>>2]=m,g[S+12>>2]=y),g[5831]=L,g[5834]=C,Ut=z,wt=$e,Ut|0;if(k=g[5830]|0,k){for(y=(k&0-k)+-1|0,C=y>>>12&16,y=y>>>C,S=y>>>5&8,y=y>>>S,L=y>>>2&4,y=y>>>L,z=y>>>1&2,y=y>>>z,H=y>>>1&1,H=g[23620+((S|C|L|z|H)+(y>>>H)<<2)>>2]|0,y=H,z=H,H=(g[H+4>>2]&-8)-it|0;p=g[y+16>>2]|0,!(!p&&(p=g[y+20>>2]|0,!p));)L=(g[p+4>>2]&-8)-it|0,C=L>>>0>>0,y=p,z=C?p:z,H=C?L:H;if(L=z+it|0,L>>>0>z>>>0){C=g[z+24>>2]|0,m=g[z+12>>2]|0;do if((m|0)==(z|0)){if(p=z+20|0,m=g[p>>2]|0,!m&&(p=z+16|0,m=g[p>>2]|0,!m)){y=0;break}for(;;)if(S=m+20|0,y=g[S>>2]|0,y)m=y,p=S;else if(S=m+16|0,y=g[S>>2]|0,y)m=y,p=S;else break;g[p>>2]=0,y=m}else y=g[z+8>>2]|0,g[y+12>>2]=m,g[m+8>>2]=y,y=m;while(!1);do if(C|0){if(m=g[z+28>>2]|0,p=23620+(m<<2)|0,(z|0)==(g[p>>2]|0)){if(g[p>>2]=y,!y){g[5830]=k&~(1<>2]|0)==(z|0)?Ut:C+20|0)>>2]=y,!y)break;g[y+24>>2]=C,m=g[z+16>>2]|0,m|0&&(g[y+16>>2]=m,g[m+24>>2]=y),m=g[z+20>>2]|0,m|0&&(g[y+20>>2]=m,g[m+24>>2]=y)}while(!1);return H>>>0<16?(Ut=H+it|0,g[z+4>>2]=Ut|3,Ut=z+Ut+4|0,g[Ut>>2]=g[Ut>>2]|1):(g[z+4>>2]=it|3,g[L+4>>2]=H|1,g[L+H>>2]=H,ot|0&&(S=g[5834]|0,m=ot>>>3,y=23356+(m<<1<<2)|0,m=1<>2]|0):(g[5829]=m|Ct,m=y,p=y+8|0),g[p>>2]=S,g[m+12>>2]=S,g[S+8>>2]=m,g[S+12>>2]=y),g[5831]=H,g[5834]=L),Ut=z+8|0,wt=$e,Ut|0}else Ct=it}else Ct=it}else Ct=it}else if(p>>>0<=4294967231)if(p=p+11|0,it=p&-8,S=g[5830]|0,S){C=0-it|0,p=p>>>8,p?it>>>0>16777215?H=31:(Ct=(p+1048320|0)>>>16&8,ne=p<>>16&4,ne=ne<>>16&2,H=14-(z|Ct|H)+(ne<>>15)|0,H=it>>>(H+7|0)&1|H<<1):H=0,y=g[23620+(H<<2)>>2]|0;t:do if(!y)y=0,p=0,ne=61;else for(p=0,z=it<<((H|0)==31?0:25-(H>>>1)|0),k=0;;){if(L=(g[y+4>>2]&-8)-it|0,L>>>0>>0)if(L)p=y,C=L;else{p=y,C=0,ne=65;break t}if(ne=g[y+20>>2]|0,y=g[y+16+(z>>>31<<2)>>2]|0,k=(ne|0)==0|(ne|0)==(y|0)?k:ne,y)z=z<<1;else{y=k,ne=61;break}}while(!1);if((ne|0)==61){if((y|0)==0&(p|0)==0){if(p=2<>>12&16,Ct=Ct>>>L,k=Ct>>>5&8,Ct=Ct>>>k,z=Ct>>>2&4,Ct=Ct>>>z,H=Ct>>>1&2,Ct=Ct>>>H,y=Ct>>>1&1,p=0,y=g[23620+((k|L|z|H|y)+(Ct>>>y)<<2)>>2]|0}y?ne=65:(z=p,L=C)}if((ne|0)==65)for(k=y;;)if(Ct=(g[k+4>>2]&-8)-it|0,y=Ct>>>0>>0,C=y?Ct:C,p=y?k:p,y=g[k+16>>2]|0,y||(y=g[k+20>>2]|0),y)k=y;else{z=p,L=C;break}if(z|0&&L>>>0<((g[5831]|0)-it|0)>>>0&&(ot=z+it|0,ot>>>0>z>>>0)){k=g[z+24>>2]|0,m=g[z+12>>2]|0;do if((m|0)==(z|0)){if(p=z+20|0,m=g[p>>2]|0,!m&&(p=z+16|0,m=g[p>>2]|0,!m)){m=0;break}for(;;)if(C=m+20|0,y=g[C>>2]|0,y)m=y,p=C;else if(C=m+16|0,y=g[C>>2]|0,y)m=y,p=C;else break;g[p>>2]=0}else Ut=g[z+8>>2]|0,g[Ut+12>>2]=m,g[m+8>>2]=Ut;while(!1);do if(k){if(p=g[z+28>>2]|0,y=23620+(p<<2)|0,(z|0)==(g[y>>2]|0)){if(g[y>>2]=m,!m){S=S&~(1<>2]|0)==(z|0)?Ut:k+20|0)>>2]=m,!m)break;g[m+24>>2]=k,p=g[z+16>>2]|0,p|0&&(g[m+16>>2]=p,g[p+24>>2]=m),p=g[z+20>>2]|0,p&&(g[m+20>>2]=p,g[p+24>>2]=m)}while(!1);t:do if(L>>>0<16)Ut=L+it|0,g[z+4>>2]=Ut|3,Ut=z+Ut+4|0,g[Ut>>2]=g[Ut>>2]|1;else{if(g[z+4>>2]=it|3,g[ot+4>>2]=L|1,g[ot+L>>2]=L,m=L>>>3,L>>>0<256){y=23356+(m<<1<<2)|0,p=g[5829]|0,m=1<>2]|0):(g[5829]=p|m,m=y,p=y+8|0),g[p>>2]=ot,g[m+12>>2]=ot,g[ot+8>>2]=m,g[ot+12>>2]=y;break}if(m=L>>>8,m?L>>>0>16777215?y=31:(_e=(m+1048320|0)>>>16&8,Ut=m<<_e,te=(Ut+520192|0)>>>16&4,Ut=Ut<>>16&2,y=14-(te|_e|y)+(Ut<>>15)|0,y=L>>>(y+7|0)&1|y<<1):y=0,m=23620+(y<<2)|0,g[ot+28>>2]=y,p=ot+16|0,g[p+4>>2]=0,g[p>>2]=0,p=1<>2]=ot,g[ot+24>>2]=m,g[ot+12>>2]=ot,g[ot+8>>2]=ot;break}m=g[m>>2]|0;e:do if((g[m+4>>2]&-8|0)!=(L|0)){for(S=L<<((y|0)==31?0:25-(y>>>1)|0);y=m+16+(S>>>31<<2)|0,p=g[y>>2]|0,!!p;)if((g[p+4>>2]&-8|0)==(L|0)){m=p;break e}else S=S<<1,m=p;g[y>>2]=ot,g[ot+24>>2]=m,g[ot+12>>2]=ot,g[ot+8>>2]=ot;break t}while(!1);_e=m+8|0,Ut=g[_e>>2]|0,g[Ut+12>>2]=ot,g[_e>>2]=ot,g[ot+8>>2]=Ut,g[ot+12>>2]=m,g[ot+24>>2]=0}while(!1);return Ut=z+8|0,wt=$e,Ut|0}else Ct=it}else Ct=it;else Ct=-1;while(!1);if(y=g[5831]|0,y>>>0>=Ct>>>0)return m=y-Ct|0,p=g[5834]|0,m>>>0>15?(Ut=p+Ct|0,g[5834]=Ut,g[5831]=m,g[Ut+4>>2]=m|1,g[p+y>>2]=m,g[p+4>>2]=Ct|3):(g[5831]=0,g[5834]=0,g[p+4>>2]=y|3,Ut=p+y+4|0,g[Ut>>2]=g[Ut>>2]|1),Ut=p+8|0,wt=$e,Ut|0;if(L=g[5832]|0,L>>>0>Ct>>>0)return te=L-Ct|0,g[5832]=te,Ut=g[5835]|0,_e=Ut+Ct|0,g[5835]=_e,g[_e+4>>2]=te|1,g[Ut+4>>2]=Ct|3,Ut=Ut+8|0,wt=$e,Ut|0;if(g[5947]|0?p=g[5949]|0:(g[5949]=4096,g[5948]=4096,g[5950]=-1,g[5951]=-1,g[5952]=0,g[5940]=0,g[5947]=Nt&-16^1431655768,p=4096),z=Ct+48|0,H=Ct+47|0,k=p+H|0,C=0-p|0,it=k&C,it>>>0<=Ct>>>0||(p=g[5939]|0,p|0&&(ot=g[5937]|0,Nt=ot+it|0,Nt>>>0<=ot>>>0|Nt>>>0>p>>>0)))return Ut=0,wt=$e,Ut|0;t:do if(g[5940]&4)m=0,ne=143;else{y=g[5835]|0;e:do if(y){for(S=23764;Nt=g[S>>2]|0,!(Nt>>>0<=y>>>0&&(Nt+(g[S+4>>2]|0)|0)>>>0>y>>>0);)if(p=g[S+8>>2]|0,p)S=p;else{ne=128;break e}if(m=k-L&C,m>>>0<2147483647)if(p=en(m|0)|0,(p|0)==((g[S>>2]|0)+(g[S+4>>2]|0)|0)){if((p|0)!=-1){L=m,k=p,ne=145;break t}}else S=p,ne=136;else m=0}else ne=128;while(!1);do if((ne|0)==128)if(y=en(0)|0,(y|0)!=-1&&(m=y,Wt=g[5948]|0,re=Wt+-1|0,m=(re&m|0?(re+m&0-Wt)-m|0:0)+it|0,Wt=g[5937]|0,re=m+Wt|0,m>>>0>Ct>>>0&m>>>0<2147483647)){if(Nt=g[5939]|0,Nt|0&&re>>>0<=Wt>>>0|re>>>0>Nt>>>0){m=0;break}if(p=en(m|0)|0,(p|0)==(y|0)){L=m,k=y,ne=145;break t}else S=p,ne=136}else m=0;while(!1);do if((ne|0)==136){if(y=0-m|0,!(z>>>0>m>>>0&(m>>>0<2147483647&(S|0)!=-1)))if((S|0)==-1){m=0;break}else{L=m,k=S,ne=145;break t}if(p=g[5949]|0,p=H-m+p&0-p,p>>>0>=2147483647){L=m,k=S,ne=145;break t}if((en(p|0)|0)==-1){en(y|0)|0,m=0;break}else{L=p+m|0,k=S,ne=145;break t}}while(!1);g[5940]=g[5940]|4,ne=143}while(!1);if((ne|0)==143&&it>>>0<2147483647&&(te=en(it|0)|0,re=en(0)|0,Le=re-te|0,We=Le>>>0>(Ct+40|0)>>>0,!((te|0)==-1|We^1|te>>>0>>0&((te|0)!=-1&(re|0)!=-1)^1))&&(L=We?Le:m,k=te,ne=145),(ne|0)==145){m=(g[5937]|0)+L|0,g[5937]=m,m>>>0>(g[5938]|0)>>>0&&(g[5938]=m),H=g[5835]|0;t:do if(H){for(m=23764;;){if(p=g[m>>2]|0,y=g[m+4>>2]|0,(k|0)==(p+y|0)){ne=154;break}if(S=g[m+8>>2]|0,S)m=S;else break}if((ne|0)==154&&(_e=m+4|0,(g[m+12>>2]&8|0)==0)&&k>>>0>H>>>0&p>>>0<=H>>>0){g[_e>>2]=y+L,Ut=(g[5832]|0)+L|0,te=H+8|0,te=te&7|0?0-te&7:0,_e=H+te|0,te=Ut-te|0,g[5835]=_e,g[5832]=te,g[_e+4>>2]=te|1,g[H+Ut+4>>2]=40,g[5836]=g[5951];break}for(k>>>0<(g[5833]|0)>>>0&&(g[5833]=k),y=k+L|0,m=23764;;){if((g[m>>2]|0)==(y|0)){ne=162;break}if(p=g[m+8>>2]|0,p)m=p;else break}if((ne|0)==162&&!(g[m+12>>2]&8|0)){g[m>>2]=k,ot=m+4|0,g[ot>>2]=(g[ot>>2]|0)+L,ot=k+8|0,ot=k+(ot&7|0?0-ot&7:0)|0,m=y+8|0,m=y+(m&7|0?0-m&7:0)|0,it=ot+Ct|0,z=m-ot-Ct|0,g[ot+4>>2]=Ct|3;e:do if((H|0)==(m|0))Ut=(g[5832]|0)+z|0,g[5832]=Ut,g[5835]=it,g[it+4>>2]=Ut|1;else{if((g[5834]|0)==(m|0)){Ut=(g[5831]|0)+z|0,g[5831]=Ut,g[5834]=it,g[it+4>>2]=Ut|1,g[it+Ut>>2]=Ut;break}if(p=g[m+4>>2]|0,(p&3|0)==1){L=p&-8,S=p>>>3;r:do if(p>>>0<256)if(p=g[m+8>>2]|0,y=g[m+12>>2]|0,(y|0)==(p|0)){g[5829]=g[5829]&~(1<>2]=y,g[y+8>>2]=p;break}else{k=g[m+24>>2]|0,p=g[m+12>>2]|0;do if((p|0)==(m|0)){if(y=m+16|0,S=y+4|0,p=g[S>>2]|0,p)y=S;else if(p=g[y>>2]|0,!p){p=0;break}for(;;)if(C=p+20|0,S=g[C>>2]|0,S)p=S,y=C;else if(C=p+16|0,S=g[C>>2]|0,S)p=S,y=C;else break;g[y>>2]=0}else Ut=g[m+8>>2]|0,g[Ut+12>>2]=p,g[p+8>>2]=Ut;while(!1);if(!k)break;y=g[m+28>>2]|0,S=23620+(y<<2)|0;do if((g[S>>2]|0)!=(m|0)){if(Ut=k+16|0,g[((g[Ut>>2]|0)==(m|0)?Ut:k+20|0)>>2]=p,!p)break r}else{if(g[S>>2]=p,p|0)break;g[5830]=g[5830]&~(1<>2]=k,y=m+16|0,S=g[y>>2]|0,S|0&&(g[p+16>>2]=S,g[S+24>>2]=p),y=g[y+4>>2]|0,!y)break;g[p+20>>2]=y,g[y+24>>2]=p}while(!1);m=m+L|0,C=L+z|0}else C=z;if(m=m+4|0,g[m>>2]=g[m>>2]&-2,g[it+4>>2]=C|1,g[it+C>>2]=C,m=C>>>3,C>>>0<256){y=23356+(m<<1<<2)|0,p=g[5829]|0,m=1<>2]|0):(g[5829]=p|m,m=y,p=y+8|0),g[p>>2]=it,g[m+12>>2]=it,g[it+8>>2]=m,g[it+12>>2]=y;break}m=C>>>8;do if(!m)S=0;else{if(C>>>0>16777215){S=31;break}_e=(m+1048320|0)>>>16&8,Ut=m<<_e,te=(Ut+520192|0)>>>16&4,Ut=Ut<>>16&2,S=14-(te|_e|S)+(Ut<>>15)|0,S=C>>>(S+7|0)&1|S<<1}while(!1);if(m=23620+(S<<2)|0,g[it+28>>2]=S,p=it+16|0,g[p+4>>2]=0,g[p>>2]=0,p=g[5830]|0,y=1<>2]=it,g[it+24>>2]=m,g[it+12>>2]=it,g[it+8>>2]=it;break}m=g[m>>2]|0;r:do if((g[m+4>>2]&-8|0)!=(C|0)){for(S=C<<((S|0)==31?0:25-(S>>>1)|0);y=m+16+(S>>>31<<2)|0,p=g[y>>2]|0,!!p;)if((g[p+4>>2]&-8|0)==(C|0)){m=p;break r}else S=S<<1,m=p;g[y>>2]=it,g[it+24>>2]=m,g[it+12>>2]=it,g[it+8>>2]=it;break e}while(!1);_e=m+8|0,Ut=g[_e>>2]|0,g[Ut+12>>2]=it,g[_e>>2]=it,g[it+8>>2]=Ut,g[it+12>>2]=m,g[it+24>>2]=0}while(!1);return Ut=ot+8|0,wt=$e,Ut|0}for(m=23764;p=g[m>>2]|0,!(p>>>0<=H>>>0&&(Ut=p+(g[m+4>>2]|0)|0,Ut>>>0>H>>>0));)m=g[m+8>>2]|0;C=Ut+-47|0,p=C+8|0,p=C+(p&7|0?0-p&7:0)|0,C=H+16|0,p=p>>>0>>0?H:p,m=p+8|0,y=L+-40|0,te=k+8|0,te=te&7|0?0-te&7:0,_e=k+te|0,te=y-te|0,g[5835]=_e,g[5832]=te,g[_e+4>>2]=te|1,g[k+y+4>>2]=40,g[5836]=g[5951],y=p+4|0,g[y>>2]=27,g[m>>2]=g[5941],g[m+4>>2]=g[5942],g[m+8>>2]=g[5943],g[m+12>>2]=g[5944],g[5941]=k,g[5942]=L,g[5944]=0,g[5943]=m,m=p+24|0;do _e=m,m=m+4|0,g[m>>2]=7;while((_e+8|0)>>>0>>0);if((p|0)!=(H|0)){if(k=p-H|0,g[y>>2]=g[y>>2]&-2,g[H+4>>2]=k|1,g[p>>2]=k,m=k>>>3,k>>>0<256){y=23356+(m<<1<<2)|0,p=g[5829]|0,m=1<>2]|0):(g[5829]=p|m,m=y,p=y+8|0),g[p>>2]=H,g[m+12>>2]=H,g[H+8>>2]=m,g[H+12>>2]=y;break}if(m=k>>>8,m?k>>>0>16777215?S=31:(_e=(m+1048320|0)>>>16&8,Ut=m<<_e,te=(Ut+520192|0)>>>16&4,Ut=Ut<>>16&2,S=14-(te|_e|S)+(Ut<>>15)|0,S=k>>>(S+7|0)&1|S<<1):S=0,y=23620+(S<<2)|0,g[H+28>>2]=S,g[H+20>>2]=0,g[C>>2]=0,m=g[5830]|0,p=1<>2]=H,g[H+24>>2]=y,g[H+12>>2]=H,g[H+8>>2]=H;break}m=g[y>>2]|0;e:do if((g[m+4>>2]&-8|0)!=(k|0)){for(S=k<<((S|0)==31?0:25-(S>>>1)|0);y=m+16+(S>>>31<<2)|0,p=g[y>>2]|0,!!p;)if((g[p+4>>2]&-8|0)==(k|0)){m=p;break e}else S=S<<1,m=p;g[y>>2]=H,g[H+24>>2]=m,g[H+12>>2]=H,g[H+8>>2]=H;break t}while(!1);_e=m+8|0,Ut=g[_e>>2]|0,g[Ut+12>>2]=H,g[_e>>2]=H,g[H+8>>2]=Ut,g[H+12>>2]=m,g[H+24>>2]=0}}else Ut=g[5833]|0,(Ut|0)==0|k>>>0>>0&&(g[5833]=k),g[5941]=k,g[5942]=L,g[5944]=0,g[5838]=g[5947],g[5837]=-1,g[5842]=23356,g[5841]=23356,g[5844]=23364,g[5843]=23364,g[5846]=23372,g[5845]=23372,g[5848]=23380,g[5847]=23380,g[5850]=23388,g[5849]=23388,g[5852]=23396,g[5851]=23396,g[5854]=23404,g[5853]=23404,g[5856]=23412,g[5855]=23412,g[5858]=23420,g[5857]=23420,g[5860]=23428,g[5859]=23428,g[5862]=23436,g[5861]=23436,g[5864]=23444,g[5863]=23444,g[5866]=23452,g[5865]=23452,g[5868]=23460,g[5867]=23460,g[5870]=23468,g[5869]=23468,g[5872]=23476,g[5871]=23476,g[5874]=23484,g[5873]=23484,g[5876]=23492,g[5875]=23492,g[5878]=23500,g[5877]=23500,g[5880]=23508,g[5879]=23508,g[5882]=23516,g[5881]=23516,g[5884]=23524,g[5883]=23524,g[5886]=23532,g[5885]=23532,g[5888]=23540,g[5887]=23540,g[5890]=23548,g[5889]=23548,g[5892]=23556,g[5891]=23556,g[5894]=23564,g[5893]=23564,g[5896]=23572,g[5895]=23572,g[5898]=23580,g[5897]=23580,g[5900]=23588,g[5899]=23588,g[5902]=23596,g[5901]=23596,g[5904]=23604,g[5903]=23604,Ut=L+-40|0,te=k+8|0,te=te&7|0?0-te&7:0,_e=k+te|0,te=Ut-te|0,g[5835]=_e,g[5832]=te,g[_e+4>>2]=te|1,g[k+Ut+4>>2]=40,g[5836]=g[5951];while(!1);if(m=g[5832]|0,m>>>0>Ct>>>0)return te=m-Ct|0,g[5832]=te,Ut=g[5835]|0,_e=Ut+Ct|0,g[5835]=_e,g[_e+4>>2]=te|1,g[Ut+4>>2]=Ct|3,Ut=Ut+8|0,wt=$e,Ut|0}return Ut=fs()|0,g[Ut>>2]=12,Ut=0,wt=$e,Ut|0}function Gr(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0,H=0;if(p){y=p+-8|0,C=g[5833]|0,p=g[p+-4>>2]|0,m=p&-8,H=y+m|0;do if(p&1)z=y,L=y;else{if(S=g[y>>2]|0,!(p&3)||(L=y+(0-S)|0,k=S+m|0,L>>>0>>0))return;if((g[5834]|0)==(L|0)){if(p=H+4|0,m=g[p>>2]|0,(m&3|0)!=3){z=L,m=k;break}g[5831]=k,g[p>>2]=m&-2,g[L+4>>2]=k|1,g[L+k>>2]=k;return}if(y=S>>>3,S>>>0<256)if(p=g[L+8>>2]|0,m=g[L+12>>2]|0,(m|0)==(p|0)){g[5829]=g[5829]&~(1<>2]=m,g[m+8>>2]=p,z=L,m=k;break}C=g[L+24>>2]|0,p=g[L+12>>2]|0;do if((p|0)==(L|0)){if(m=L+16|0,y=m+4|0,p=g[y>>2]|0,p)m=y;else if(p=g[m>>2]|0,!p){p=0;break}for(;;)if(S=p+20|0,y=g[S>>2]|0,y)p=y,m=S;else if(S=p+16|0,y=g[S>>2]|0,y)p=y,m=S;else break;g[m>>2]=0}else z=g[L+8>>2]|0,g[z+12>>2]=p,g[p+8>>2]=z;while(!1);if(C){if(m=g[L+28>>2]|0,y=23620+(m<<2)|0,(g[y>>2]|0)==(L|0)){if(g[y>>2]=p,!p){g[5830]=g[5830]&~(1<>2]|0)==(L|0)?z:C+20|0)>>2]=p,!p){z=L,m=k;break}g[p+24>>2]=C,m=L+16|0,y=g[m>>2]|0,y|0&&(g[p+16>>2]=y,g[y+24>>2]=p),m=g[m+4>>2]|0,m?(g[p+20>>2]=m,g[m+24>>2]=p,z=L,m=k):(z=L,m=k)}else z=L,m=k}while(!1);if(!(L>>>0>=H>>>0)&&(p=H+4|0,S=g[p>>2]|0,!!(S&1))){if(S&2)g[p>>2]=S&-2,g[z+4>>2]=m|1,g[L+m>>2]=m,C=m;else{if((g[5835]|0)==(H|0)){if(H=(g[5832]|0)+m|0,g[5832]=H,g[5835]=z,g[z+4>>2]=H|1,(z|0)!=(g[5834]|0))return;g[5834]=0,g[5831]=0;return}if((g[5834]|0)==(H|0)){H=(g[5831]|0)+m|0,g[5831]=H,g[5834]=L,g[z+4>>2]=H|1,g[L+H>>2]=H;return}C=(S&-8)+m|0,y=S>>>3;do if(S>>>0<256)if(m=g[H+8>>2]|0,p=g[H+12>>2]|0,(p|0)==(m|0)){g[5829]=g[5829]&~(1<>2]=p,g[p+8>>2]=m;break}else{k=g[H+24>>2]|0,p=g[H+12>>2]|0;do if((p|0)==(H|0)){if(m=H+16|0,y=m+4|0,p=g[y>>2]|0,p)m=y;else if(p=g[m>>2]|0,!p){y=0;break}for(;;)if(S=p+20|0,y=g[S>>2]|0,y)p=y,m=S;else if(S=p+16|0,y=g[S>>2]|0,y)p=y,m=S;else break;g[m>>2]=0,y=p}else y=g[H+8>>2]|0,g[y+12>>2]=p,g[p+8>>2]=y,y=p;while(!1);if(k|0){if(p=g[H+28>>2]|0,m=23620+(p<<2)|0,(g[m>>2]|0)==(H|0)){if(g[m>>2]=y,!y){g[5830]=g[5830]&~(1<>2]|0)==(H|0)?S:k+20|0)>>2]=y,!y)break;g[y+24>>2]=k,p=H+16|0,m=g[p>>2]|0,m|0&&(g[y+16>>2]=m,g[m+24>>2]=y),p=g[p+4>>2]|0,p|0&&(g[y+20>>2]=p,g[p+24>>2]=y)}}while(!1);if(g[z+4>>2]=C|1,g[L+C>>2]=C,(z|0)==(g[5834]|0)){g[5831]=C;return}}if(p=C>>>3,C>>>0<256){y=23356+(p<<1<<2)|0,m=g[5829]|0,p=1<>2]|0):(g[5829]=m|p,p=y,m=y+8|0),g[m>>2]=z,g[p+12>>2]=z,g[z+8>>2]=p,g[z+12>>2]=y;return}p=C>>>8,p?C>>>0>16777215?S=31:(L=(p+1048320|0)>>>16&8,H=p<>>16&4,H=H<>>16&2,S=14-(k|L|S)+(H<>>15)|0,S=C>>>(S+7|0)&1|S<<1):S=0,p=23620+(S<<2)|0,g[z+28>>2]=S,g[z+20>>2]=0,g[z+16>>2]=0,m=g[5830]|0,y=1<>2]=z,g[z+24>>2]=p,g[z+12>>2]=z,g[z+8>>2]=z;else{p=g[p>>2]|0;e:do if((g[p+4>>2]&-8|0)!=(C|0)){for(S=C<<((S|0)==31?0:25-(S>>>1)|0);y=p+16+(S>>>31<<2)|0,m=g[y>>2]|0,!!m;)if((g[m+4>>2]&-8|0)==(C|0)){p=m;break e}else S=S<<1,p=m;g[y>>2]=z,g[z+24>>2]=p,g[z+12>>2]=z,g[z+8>>2]=z;break t}while(!1);L=p+8|0,H=g[L>>2]|0,g[H+12>>2]=z,g[L>>2]=z,g[z+8>>2]=H,g[z+12>>2]=p,g[z+24>>2]=0}while(!1);if(H=(g[5837]|0)+-1|0,g[5837]=H,!(H|0)){for(p=23772;p=g[p>>2]|0,p;)p=p+8|0;g[5837]=-1}}}}function Ua(p,m){p=p|0,m=m|0;var y=0;return p?(y=Oc(m,p)|0,(m|p)>>>0>65535&&(y=((y>>>0)/(p>>>0)|0|0)==(m|0)?y:-1)):y=0,p=ho(y)|0,!p||!(g[p+-4>>2]&3)||Fc(p|0,0,y|0)|0,p|0}function S_(p,m,y,S){return p=p|0,m=m|0,y=y|0,S=S|0,y=p+y>>>0,Je(m+S+(y>>>0

>>0|0)>>>0|0),y|0|0}function zd(p,m,y,S){return p=p|0,m=m|0,y=y|0,S=S|0,S=m-S-(y>>>0>p>>>0|0)>>>0,Je(S|0),p-y>>>0|0|0}function cA(p){return p=p|0,(p?31-(aa(p^p-1)|0)|0:32)|0}function Yl(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0;if(ot=p,H=m,it=H,L=y,Nt=S,z=Nt,!it)return k=(C|0)!=0,z?k?(g[C>>2]=p|0,g[C+4>>2]=m&0,Nt=0,C=0,Je(Nt|0),C|0):(Nt=0,C=0,Je(Nt|0),C|0):(k&&(g[C>>2]=(ot>>>0)%(L>>>0),g[C+4>>2]=0),Nt=0,C=(ot>>>0)/(L>>>0)>>>0,Je(Nt|0),C|0);k=(z|0)==0;do if(L){if(!k){if(k=(aa(z|0)|0)-(aa(it|0)|0)|0,k>>>0<=31){Ct=k+1|0,z=31-k|0,m=k-31>>31,L=Ct,p=ot>>>(Ct>>>0)&m|it<>>(Ct>>>0)&m,k=0,z=ot<>2]=p|0,g[C+4>>2]=H|m&0,Nt=0,C=0,Je(Nt|0),C|0):(Nt=0,C=0,Je(Nt|0),C|0)}if(k=L-1|0,k&L|0){z=(aa(L|0)|0)+33-(aa(it|0)|0)|0,re=64-z|0,Ct=32-z|0,H=Ct>>31,Wt=z-32|0,m=Wt>>31,L=z,p=Ct-1>>31&it>>>(Wt>>>0)|(it<>>(z>>>0))&m,m=m&it>>>(z>>>0),k=ot<>>(Wt>>>0))&H|ot<>31;break}return C|0&&(g[C>>2]=k&ot,g[C+4>>2]=0),(L|0)==1?(Wt=H|m&0,re=p|0|0,Je(Wt|0),re|0):(re=cA(L|0)|0,Wt=it>>>(re>>>0)|0,re=it<<32-re|ot>>>(re>>>0)|0,Je(Wt|0),re|0)}else{if(k)return C|0&&(g[C>>2]=(it>>>0)%(L>>>0),g[C+4>>2]=0),Wt=0,re=(it>>>0)/(L>>>0)>>>0,Je(Wt|0),re|0;if(!ot)return C|0&&(g[C>>2]=0,g[C+4>>2]=(it>>>0)%(z>>>0)),Wt=0,re=(it>>>0)/(z>>>0)>>>0,Je(Wt|0),re|0;if(k=z-1|0,!(k&z))return C|0&&(g[C>>2]=p|0,g[C+4>>2]=k&it|m&0),Wt=0,re=it>>>((cA(z|0)|0)>>>0),Je(Wt|0),re|0;if(k=(aa(z|0)|0)-(aa(it|0)|0)|0,k>>>0<=30){m=k+1|0,z=31-k|0,L=m,p=it<>>(m>>>0),m=it>>>(m>>>0),k=0,z=ot<>2]=p|0,g[C+4>>2]=H|m&0,Wt=0,re=0,Je(Wt|0),re|0):(Wt=0,re=0,Je(Wt|0),re|0)}while(!1);if(!L)it=z,H=0,z=0;else{Ct=y|0|0,ot=Nt|S&0,it=S_(Ct|0,ot|0,-1,-1)|0,y=It()|0,H=z,z=0;do S=H,H=k>>>31|H<<1,k=z|k<<1,S=p<<1|S>>>31|0,Nt=p>>>31|m<<1|0,zd(it|0,y|0,S|0,Nt|0)|0,re=It()|0,Wt=re>>31|((re|0)<0?-1:0)<<1,z=Wt&1,p=zd(S|0,Nt|0,Wt&Ct|0,(((re|0)<0?-1:0)>>31|((re|0)<0?-1:0)<<1)&ot|0)|0,m=It()|0,L=L-1|0;while(L|0);it=H,H=0}return L=0,C|0&&(g[C>>2]=p,g[C+4>>2]=m),Wt=(k|0)>>>31|(it|L)<<1|(L<<1|k>>>31)&0|H,re=(k<<1|0)&-2|z,Je(Wt|0),re|0}function Yo(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0;return k=wt,wt=wt+16|0,C=k|0,Yl(p,m,y,S,C)|0,wt=k,Je(g[C+4>>2]|0),g[C>>2]|0|0}function me(p,m,y){return p=p|0,m=m|0,y=y|0,(y|0)<32?(Je(m>>>y|0),p>>>y|(m&(1<>>y-32|0)}function ke(p,m,y){return p=p|0,m=m|0,y=y|0,(y|0)<32?(Je(m<>>32-y|0),p<=0?+cs(p+.5):+Ji(p-.5)}function Va(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0;if((y|0)>=8192)return Yp(p|0,m|0,y|0)|0,p|0;if(k=p|0,C=p+y|0,(p&3)==(m&3)){for(;p&3;){if(!y)return k|0;br[p>>0]=br[m>>0]|0,p=p+1|0,m=m+1|0,y=y-1|0}for(y=C&-4|0,S=y-64|0;(p|0)<=(S|0);)g[p>>2]=g[m>>2],g[p+4>>2]=g[m+4>>2],g[p+8>>2]=g[m+8>>2],g[p+12>>2]=g[m+12>>2],g[p+16>>2]=g[m+16>>2],g[p+20>>2]=g[m+20>>2],g[p+24>>2]=g[m+24>>2],g[p+28>>2]=g[m+28>>2],g[p+32>>2]=g[m+32>>2],g[p+36>>2]=g[m+36>>2],g[p+40>>2]=g[m+40>>2],g[p+44>>2]=g[m+44>>2],g[p+48>>2]=g[m+48>>2],g[p+52>>2]=g[m+52>>2],g[p+56>>2]=g[m+56>>2],g[p+60>>2]=g[m+60>>2],p=p+64|0,m=m+64|0;for(;(p|0)<(y|0);)g[p>>2]=g[m>>2],p=p+4|0,m=m+4|0}else for(y=C-4|0;(p|0)<(y|0);)br[p>>0]=br[m>>0]|0,br[p+1>>0]=br[m+1>>0]|0,br[p+2>>0]=br[m+2>>0]|0,br[p+3>>0]=br[m+3>>0]|0,p=p+4|0,m=m+4|0;for(;(p|0)<(C|0);)br[p>>0]=br[m>>0]|0,p=p+1|0,m=m+1|0;return k|0}function Fc(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0;if(k=p+y|0,m=m&255,(y|0)>=67){for(;p&3;)br[p>>0]=m,p=p+1|0;for(S=k&-4|0,L=m|m<<8|m<<16|m<<24,C=S-64|0;(p|0)<=(C|0);)g[p>>2]=L,g[p+4>>2]=L,g[p+8>>2]=L,g[p+12>>2]=L,g[p+16>>2]=L,g[p+20>>2]=L,g[p+24>>2]=L,g[p+28>>2]=L,g[p+32>>2]=L,g[p+36>>2]=L,g[p+40>>2]=L,g[p+44>>2]=L,g[p+48>>2]=L,g[p+52>>2]=L,g[p+56>>2]=L,g[p+60>>2]=L,p=p+64|0;for(;(p|0)<(S|0);)g[p>>2]=L,p=p+4|0}for(;(p|0)<(k|0);)br[p>>0]=m,p=p+1|0;return k-y|0}function Ux(p){return p=+p,p>=0?+cs(p+.5):+Ji(p-.5)}function en(p){p=p|0;var m=0,y=0,S=0;return S=Jm()|0,y=g[Ms>>2]|0,m=y+p|0,(p|0)>0&(m|0)<(y|0)|(m|0)<0?(t0(m|0)|0,Km(12),-1):(m|0)>(S|0)&&!(Qp(m|0)|0)?(Km(12),-1):(g[Ms>>2]=m,y|0)}return{___uremdi3:Yo,_bitshift64Lshr:me,_bitshift64Shl:ke,_calloc:Ua,_cellAreaKm2:b_,_cellAreaM2:Nx,_cellAreaRads2:x_,_compact:mh,_destroyLinkedPolygon:Ft,_edgeLengthKm:un,_edgeLengthM:sA,_emscripten_replace_memory:e0,_exactEdgeLengthKm:oA,_exactEdgeLengthM:nr,_exactEdgeLengthRads:Mo,_experimentalH3ToLocalIj:$t,_experimentalLocalIjToH3:oe,_free:Gr,_geoToH3:lA,_getDestinationH3IndexFromUnidirectionalEdge:Z,_getH3IndexesFromUnidirectionalEdge:st,_getH3UnidirectionalEdge:U,_getH3UnidirectionalEdgeBoundary:pt,_getH3UnidirectionalEdgesFromHexagon:At,_getOriginH3IndexFromUnidirectionalEdge:W,_getPentagonIndexes:O,_getRes0Indexes:m_,_h3Distance:pe,_h3GetBaseCell:wf,_h3GetFaces:b,_h3GetResolution:dr,_h3IndexesAreNeighbors:B,_h3IsPentagon:ji,_h3IsResClassIII:Sf,_h3IsValid:aA,_h3Line:be,_h3LineSize:he,_h3SetToLinkedGeo:ah,_h3ToCenterChild:w_,_h3ToChildren:uo,_h3ToGeo:l,_h3ToGeoBoundary:d,_h3ToParent:Bd,_h3UnidirectionalEdgeIsValid:$,_hexAreaKm2:v_,_hexAreaM2:ua,_hexRing:p_,_i64Subtract:zd,_kRing:f_,_kRingDistances:d_,_llvm_minnum_f64:ml,_llvm_round_f64:Mf,_malloc:ho,_maxFaceCount:v,_maxH3ToChildrenSize:Hn,_maxKringSize:r0,_maxPolyfillSize:Cd,_maxUncompactSize:wn,_memcpy:Va,_memset:Fc,_numHexagons:d0,_pentagonIndexCount:M,_pointDistKm:Bc,_pointDistM:h0,_pointDistRads:_u,_polyfill:$p,_res0IndexCount:A_,_round:Ux,_sbrk:en,_sizeOfCoordIJ:Gs,_sizeOfGeoBoundary:Vr,_sizeOfGeoCoord:Jr,_sizeOfGeoPolygon:On,_sizeOfGeofence:ei,_sizeOfH3Index:Gi,_sizeOfLinkedGeoPolygon:tn,_uncompact:kn,establishStackSpace:Fx,stackAlloc:Ed,stackRestore:Id,stackSave:Pd}}(vt,xt,rr),Dt=t.___uremdi3=_t.___uremdi3,Mt=t._bitshift64Lshr=_t._bitshift64Lshr,Vt=t._bitshift64Shl=_t._bitshift64Shl,ie=t._calloc=_t._calloc,se=t._cellAreaKm2=_t._cellAreaKm2,ae=t._cellAreaM2=_t._cellAreaM2,lr=t._cellAreaRads2=_t._cellAreaRads2,vr=t._compact=_t._compact,Xe=t._destroyLinkedPolygon=_t._destroyLinkedPolygon,cr=t._edgeLengthKm=_t._edgeLengthKm,wr=t._edgeLengthM=_t._edgeLengthM,xi=t._emscripten_replace_memory=_t._emscripten_replace_memory,zi=t._exactEdgeLengthKm=_t._exactEdgeLengthKm,ni=t._exactEdgeLengthM=_t._exactEdgeLengthM,Hr=t._exactEdgeLengthRads=_t._exactEdgeLengthRads,jn=t._experimentalH3ToLocalIj=_t._experimentalH3ToLocalIj,Bi=t._experimentalLocalIjToH3=_t._experimentalLocalIjToH3,xn=t._free=_t._free,es=t._geoToH3=_t._geoToH3,oa=t._getDestinationH3IndexFromUnidirectionalEdge=_t._getDestinationH3IndexFromUnidirectionalEdge,Um=t._getH3IndexesFromUnidirectionalEdge=_t._getH3IndexesFromUnidirectionalEdge,Vl=t._getH3UnidirectionalEdge=_t._getH3UnidirectionalEdge,Ss=t._getH3UnidirectionalEdgeBoundary=_t._getH3UnidirectionalEdgeBoundary,nh=t._getH3UnidirectionalEdgesFromHexagon=_t._getH3UnidirectionalEdgesFromHexagon,ai=t._getOriginH3IndexFromUnidirectionalEdge=_t._getOriginH3IndexFromUnidirectionalEdge,ka=t._getPentagonIndexes=_t._getPentagonIndexes,Dc=t._getRes0Indexes=_t._getRes0Indexes,ln=t._h3Distance=_t._h3Distance,Dn=t._h3GetBaseCell=_t._h3GetBaseCell,Vm=t._h3GetFaces=_t._h3GetFaces,Go=t._h3GetResolution=_t._h3GetResolution,Gn=t._h3IndexesAreNeighbors=_t._h3IndexesAreNeighbors,So=t._h3IsPentagon=_t._h3IsPentagon,jl=t._h3IsResClassIII=_t._h3IsResClassIII,Ki=t._h3IsValid=_t._h3IsValid,_i=t._h3Line=_t._h3Line,Gl=t._h3LineSize=_t._h3LineSize,cn=t._h3SetToLinkedGeo=_t._h3SetToLinkedGeo,pu=t._h3ToCenterChild=_t._h3ToCenterChild,rs=t._h3ToChildren=_t._h3ToChildren,Gp=t._h3ToGeo=_t._h3ToGeo,Wl=t._h3ToGeoBoundary=_t._h3ToGeoBoundary,_d=t._h3ToParent=_t._h3ToParent,yd=t._h3UnidirectionalEdgeIsValid=_t._h3UnidirectionalEdgeIsValid,vd=t._hexAreaKm2=_t._hexAreaKm2,xd=t._hexAreaM2=_t._hexAreaM2,lt=t._hexRing=_t._hexRing,ft=t._i64Subtract=_t._i64Subtract,Lt=t._kRing=_t._kRing,Kt=t._kRingDistances=_t._kRingDistances,ge=t._llvm_minnum_f64=_t._llvm_minnum_f64,Qe=t._llvm_round_f64=_t._llvm_round_f64,ti=t._malloc=_t._malloc,is=t._maxFaceCount=_t._maxFaceCount,Ts=t._maxH3ToChildrenSize=_t._maxH3ToChildrenSize,Vs=t._maxKringSize=_t._maxKringSize,Ra=t._maxPolyfillSize=_t._maxPolyfillSize,jm=t._maxUncompactSize=_t._maxUncompactSize,Ox=t._memcpy=_t._memcpy,Bx=t._memset=_t._memset,l_=t._numHexagons=_t._numHexagons,c_=t._pentagonIndexCount=_t._pentagonIndexCount,gf=t._pointDistKm=_t._pointDistKm,Gm=t._pointDistM=_t._pointDistM,fl=t._pointDistRads=_t._pointDistRads,Wm=t._polyfill=_t._polyfill,Hm=t._res0IndexCount=_t._res0IndexCount,Wp=t._round=_t._round,qm=t._sbrk=_t._sbrk,bd=t._sizeOfCoordIJ=_t._sizeOfCoordIJ,sh=t._sizeOfGeoBoundary=_t._sizeOfGeoBoundary,ui=t._sizeOfGeoCoord=_t._sizeOfGeoCoord,Zm=t._sizeOfGeoPolygon=_t._sizeOfGeoPolygon,Da=t._sizeOfGeofence=_t._sizeOfGeofence,Oa=t._sizeOfH3Index=_t._sizeOfH3Index,u_=t._sizeOfLinkedGeoPolygon=_t._sizeOfLinkedGeoPolygon,Ym=t._uncompact=_t._uncompact,Qm=t.establishStackSpace=_t.establishStackSpace,Hp=t.stackAlloc=_t.stackAlloc,$m=t.stackRestore=_t.stackRestore,qp=t.stackSave=_t.stackSave;if(t.asm=_t,t.cwrap=ut,t.setValue=j,t.getValue=Q,t.getTempRet0=R,bo){Ia(bo)||(bo=o(bo));{du(\"memory initializer\");var wd=function(Zt){Zt.byteLength&&(Zt=new Uint8Array(Zt)),Li.set(Zt,N),t.memoryInitializerRequest&&delete t.memoryInitializerRequest.response,ul(\"memory initializer\")},Zp=function(){c(bo,wd,function(){throw\"could not load memory initializer \"+bo})},Sd=ht(bo);if(Sd)wd(Sd.buffer);else if(t.memoryInitializerRequest){var Xm=function(){var Zt=t.memoryInitializerRequest,fe=Zt.response;if(Zt.status!==200&&Zt.status!==0){var Be=ht(t.memoryInitializerRequestURL);if(Be)fe=Be.buffer;else{console.warn(\"a problem seems to have happened with Module.memoryInitializerRequest, status: \"+Zt.status+\", retrying \"+bo),Zp();return}}wd(fe)};t.memoryInitializerRequest.response?setTimeout(Xm,0):t.memoryInitializerRequest.addEventListener(\"load\",Xm)}else Zp()}}var Td;lo=function Zt(){Td||Au(),Td||(lo=Zt)};function Au(Zt){if(Zt=Zt||s,gi>0||(cl(),gi>0))return;function fe(){Td||(Td=!0,!et&&(xo(),Pa(),t.onRuntimeInitialized&&t.onRuntimeInitialized(),na()))}t.setStatus?(t.setStatus(\"Running...\"),setTimeout(function(){setTimeout(function(){t.setStatus(\"\")},1),fe()},1)):fe()}t.run=Au;function oh(Zt){throw t.onAbort&&t.onAbort(Zt),Zt+=\"\",f(Zt),_(Zt),et=!0,\"abort(\"+Zt+\"). Build with -s ASSERTIONS=1 for more info.\"}if(t.abort=oh,t.preInit)for(typeof t.preInit==\"function\"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return Au(),e}(typeof Ic==\"object\"?Ic:{}),Tr=\"number\",PS=Tr,$r=Tr,mi=Tr,Pc=Tr,Hi=Tr,pyt=[[\"sizeOfH3Index\",Tr],[\"sizeOfGeoCoord\",Tr],[\"sizeOfGeoBoundary\",Tr],[\"sizeOfGeoPolygon\",Tr],[\"sizeOfGeofence\",Tr],[\"sizeOfLinkedGeoPolygon\",Tr],[\"sizeOfCoordIJ\",Tr],[\"h3IsValid\",PS,[$r,mi]],[\"geoToH3\",$r,[Tr,Tr,Pc]],[\"h3ToGeo\",null,[$r,mi,Hi]],[\"h3ToGeoBoundary\",null,[$r,mi,Hi]],[\"maxKringSize\",Tr,[Tr]],[\"kRing\",null,[$r,mi,Tr,Hi]],[\"kRingDistances\",null,[$r,mi,Tr,Hi,Hi]],[\"hexRing\",null,[$r,mi,Tr,Hi]],[\"maxPolyfillSize\",Tr,[Hi,Pc]],[\"polyfill\",null,[Hi,Pc,Hi]],[\"h3SetToLinkedGeo\",null,[Hi,Tr,Hi]],[\"destroyLinkedPolygon\",null,[Hi]],[\"compact\",Tr,[Hi,Hi,Tr]],[\"uncompact\",Tr,[Hi,Tr,Hi,Tr,Pc]],[\"maxUncompactSize\",Tr,[Hi,Tr,Pc]],[\"h3IsPentagon\",PS,[$r,mi]],[\"h3IsResClassIII\",PS,[$r,mi]],[\"h3GetBaseCell\",Tr,[$r,mi]],[\"h3GetResolution\",Tr,[$r,mi]],[\"maxFaceCount\",Tr,[$r,mi]],[\"h3GetFaces\",null,[$r,mi,Hi]],[\"h3ToParent\",$r,[$r,mi,Pc]],[\"h3ToChildren\",null,[$r,mi,Pc,Hi]],[\"h3ToCenterChild\",$r,[$r,mi,Pc]],[\"maxH3ToChildrenSize\",Tr,[$r,mi,Pc]],[\"h3IndexesAreNeighbors\",PS,[$r,mi,$r,mi]],[\"getH3UnidirectionalEdge\",$r,[$r,mi,$r,mi]],[\"getOriginH3IndexFromUnidirectionalEdge\",$r,[$r,mi]],[\"getDestinationH3IndexFromUnidirectionalEdge\",$r,[$r,mi]],[\"h3UnidirectionalEdgeIsValid\",PS,[$r,mi]],[\"getH3IndexesFromUnidirectionalEdge\",null,[$r,mi,Hi]],[\"getH3UnidirectionalEdgesFromHexagon\",null,[$r,mi,Hi]],[\"getH3UnidirectionalEdgeBoundary\",null,[$r,mi,Hi]],[\"h3Distance\",Tr,[$r,mi,$r,mi]],[\"h3Line\",Tr,[$r,mi,$r,mi,Hi]],[\"h3LineSize\",Tr,[$r,mi,$r,mi]],[\"experimentalH3ToLocalIj\",Tr,[$r,mi,$r,mi,Hi]],[\"experimentalLocalIjToH3\",Tr,[$r,mi,Hi,Hi]],[\"hexAreaM2\",Tr,[Pc]],[\"hexAreaKm2\",Tr,[Pc]],[\"edgeLengthM\",Tr,[Pc]],[\"edgeLengthKm\",Tr,[Pc]],[\"pointDistM\",Tr,[Hi,Hi]],[\"pointDistKm\",Tr,[Hi,Hi]],[\"pointDistRads\",Tr,[Hi,Hi]],[\"cellAreaM2\",Tr,[$r,mi]],[\"cellAreaKm2\",Tr,[$r,mi]],[\"cellAreaRads2\",Tr,[$r,mi]],[\"exactEdgeLengthM\",Tr,[$r,mi]],[\"exactEdgeLengthKm\",Tr,[$r,mi]],[\"exactEdgeLengthRads\",Tr,[$r,mi]],[\"numHexagons\",Tr,[Pc]],[\"getRes0Indexes\",null,[Hi]],[\"res0IndexCount\",Tr],[\"getPentagonIndexes\",null,[Tr,Hi]],[\"pentagonIndexCount\",Tr]],Ma={};pyt.forEach(function(t){Ma[t[0]]=Ic.cwrap.apply(Ic,t)});var xx=16;var IS=8,sae=Ma.sizeOfH3Index(),YQ=Ma.sizeOfGeoCoord(),Ayt=Ma.sizeOfGeoBoundary(),oae=Ma.sizeOfGeoPolygon(),aae=Ma.sizeOfGeofence(),lae=Ma.sizeOfLinkedGeoPolygon(),cae=Ma.sizeOfCoordIJ(),qQ={m:\"m\",m2:\"m2\",km:\"km\",km2:\"km2\",rads:\"rads\",rads2:\"rads2\"};function myt(e){if(typeof e!=\"number\"||e<0||e>15||Math.floor(e)!==e)throw new Error(\"Invalid resolution: \"+e)}var gyt=/[^0-9a-fA-F]/;function bx(e){if(Array.isArray(e)&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1]))return e;if(typeof e!=\"string\"||gyt.test(e))return[0,0];var t=parseInt(e.substring(0,e.length-8),xx),r=parseInt(e.substring(e.length-8),xx);return[r,t]}function ZQ(e){if(e>=0)return e.toString(xx);e=e&2147483647;var t=QQ(8,e.toString(xx)),r=(parseInt(t[0],xx)+8).toString(xx);return t=r+t.substring(1),t}function _yt(e,t){return ZQ(t)+QQ(8,ZQ(e))}function QQ(e,t){for(var r=e-t.length,i=\"\",s=0;s180?r[0]-=360:i<-180&&(r[0]+=360)}}function Myt(e,t,r){let[i,s]=FI(e),n=t.length;n$(t,s);let o=t[0]===t[n-1]?n-1:n;for(let c=0;ce.hexagon},extruded:!0},Np=class e extends Ni{constructor(...t){super(...t),G(this,\"state\",void 0)}initializeState(){e._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}}shouldUpdateState({changeFlags:t}){return this._shouldUseHighPrecision()?t.propsOrDataChanged:t.somethingChanged}updateState({props:t,changeFlags:r}){if(t.highPrecision!==!0&&(r.dataChanged||r.updateTriggersChanged&&r.updateTriggersChanged.getHexagon)){let i=this._calculateH3DataProps();this.setState(i)}this._updateVertices(this.context.viewport)}_calculateH3DataProps(){let t=-1,r=!1,i=!1,{iterable:s,objectInfo:n}=Jc(this.props.data);for(let o of s){n.index++;let c=this.props.getHexagon(o,n),f=KQ(c);if(t<0){if(t=f,!this.props.highPrecision)break}else if(t!==f){i=!0;break}if(XQ(c)){r=!0;break}}return{resolution:t,edgeLengthKM:t>=0?r$(t,\"km\"):0,hasMultipleRes:i,hasPentagon:r}}_shouldUseHighPrecision(){if(this.props.highPrecision===\"auto\"){let{resolution:t,hasPentagon:r,hasMultipleRes:i}=this.state,{viewport:s}=this.context;return!!s?.resolution||i||r||t>=0&&t<=5}return this.props.highPrecision}_updateVertices(t){if(this._shouldUseHighPrecision())return;let{resolution:r,edgeLengthKM:i,centerHex:s}=this.state;if(r<0)return;let n=this.props.centerHexagon||JQ(t.latitude,t.longitude,r);if(s===n)return;if(s){let R=e$(s,n);if(R>=0&&R*i{let N=t.projectFlat(R);return[(N[0]-w)/o[0],(N[1]-I)/o[1]]}),this.setState({centerHex:n,vertices:c})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:t,material:r,coverage:i,extruded:s,wireframe:n,stroked:o,filled:c,lineWidthUnits:f,lineWidthScale:_,lineWidthMinPixels:w,lineWidthMaxPixels:I,getFillColor:R,getElevation:N,getLineColor:j,getLineWidth:Q,transitions:et,updateTriggers:Y}=this.props;return{elevationScale:t,extruded:s,coverage:i,wireframe:n,stroked:o,filled:c,lineWidthUnits:f,lineWidthScale:_,lineWidthMinPixels:w,lineWidthMaxPixels:I,material:r,getElevation:N,getFillColor:R,getLineColor:j,getLineWidth:Q,transitions:et,updateTriggers:{getFillColor:Y.getFillColor,getElevation:Y.getElevation,getLineColor:Y.getLineColor,getLineWidth:Y.getLineWidth}}}_renderPolygonLayer(){let{data:t,getHexagon:r,updateTriggers:i,coverage:s}=this.props,n=this.getSubLayerClass(\"hexagon-cell-hifi\",lf),o=this._getForwardProps();return o.updateTriggers.getPolygon=Iyt(i.getHexagon,s),new n(o,this.getSubLayerProps({id:\"hexagon-cell-hifi\",updateTriggers:o.updateTriggers}),{data:t,_normalize:!1,_windingOrder:\"CCW\",positionFormat:\"XY\",getPolygon:(c,f)=>{let _=r(c,f);return Pyt(i$(_,s))}})}_renderColumnLayer(){let{data:t,getHexagon:r,updateTriggers:i}=this.props,s=this.getSubLayerClass(\"hexagon-cell\",af),n=this._getForwardProps();return n.updateTriggers.getPosition=i.getHexagon,new s(n,this.getSubLayerProps({id:\"hexagon-cell\",flatShading:!0,updateTriggers:n.updateTriggers}),{data:t,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:Eyt.bind(null,r)})}};G(Np,\"defaultProps\",Cyt);G(Np,\"layerName\",\"H3HexagonLayer\");G(Np,\"_checkH3Lib\",()=>{});var{data:Sae,getHexagon:Tae,...Lyt}=Np.defaultProps,kyt={_validate:!0},Mae={...Lyt,...kyt};var s$=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function o$(e,t=!1,r=Float32Array){let i;if(Number.isFinite(e[0]))i=new r(e);else{i=new r(e.length*4);let s=0;for(let n=0;nc[0]),r=e.map(c=>c[1]),i=Math.min.apply(null,t),s=Math.max.apply(null,t),n=Math.min.apply(null,r),o=Math.max.apply(null,r);return[i,n,s,o]}function u$(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}var l$=new Float32Array(12);function tF(e,t=2){let r=0;for(let i of e)for(let s=0;s 0.) {\n maxValue = colorDomain[1];\n minValue = colorDomain[0];\n }\n vIntensityMax = intensity / maxValue;\n vIntensityMin = intensity / minValue;\n}\n`;var A$=`#define SHADER_NAME triangle-layer-fragment-shader\n\nprecision highp float;\n\nuniform float opacity;\nuniform sampler2D texture;\nuniform sampler2D colorTexture;\nuniform float aggregationMode;\n\nvarying vec2 vTexCoords;\nvarying float vIntensityMin;\nvarying float vIntensityMax;\n\nvec4 getLinearColor(float value) {\n float factor = clamp(value * vIntensityMax, 0., 1.);\n vec4 color = texture2D(colorTexture, vec2(factor, 0.5));\n color.a *= min(value * vIntensityMin, 1.0);\n return color;\n}\n\nvoid main(void) {\n vec4 weights = texture2D(texture, vTexCoords);\n float weight = weights.r;\n\n if (aggregationMode > 0.5) {\n weight /= max(1.0, weights.a);\n }\n if (weight <= 0.) {\n discard;\n }\n\n vec4 linearColor = getLinearColor(weight);\n linearColor.a *= opacity;\n gl_FragColor =linearColor;\n}\n`;var Sx=class extends dn{getShaders(){return{vs:p$,fs:A$,modules:[Rs]}}initializeState({gl:t}){this.getAttributeManager().add({positions:{size:3,noAlloc:!0},texCoords:{size:2,noAlloc:!0}}),this.setState({model:this._getModel(t)})}_getModel(t){let{vertexCount:r}=this.props;return new fn(t,{...this.getShaders(),id:this.props.id,geometry:new $n({drawMode:6,vertexCount:r})})}draw({uniforms:t}){let{model:r}=this.state,{texture:i,maxTexture:s,colorTexture:n,intensity:o,threshold:c,aggregationMode:f,colorDomain:_}=this.props;r.setUniforms({...t,texture:i,maxTexture:s,colorTexture:n,intensity:o,threshold:c,aggregationMode:f,colorDomain:_}).draw()}};G(Sx,\"layerName\",\"TriangleLayer\");var m$=`attribute vec3 positions;\nattribute vec3 positions64Low;\nattribute float weights;\nvarying vec4 weightsTexture;\nuniform float radiusPixels;\nuniform float textureWidth;\nuniform vec4 commonBounds;\nuniform float weightsScale;\nvoid main()\n{\n weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);\n\n float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);\n gl_PointSize = radiusTexels * 2.;\n\n vec3 commonPosition = project_position(positions, positions64Low);\n gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;\n gl_Position.xy = (gl_Position.xy * 2.) - (1.);\n}\n`;var g$=`varying vec4 weightsTexture;\nfloat gaussianKDE(float u){\n return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);\n}\nvoid main()\n{\n float dist = length(gl_PointCoord - vec2(0.5, 0.5));\n if (dist > 0.5) {\n discard;\n }\n gl_FragColor = weightsTexture * gaussianKDE(2. * dist);\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var _$=`attribute vec4 inTexture;\nvarying vec4 outTexture;\n\nvoid main()\n{\noutTexture = inTexture;\ngl_Position = vec4(0, 0, 0, 1.);\ngl_PointSize = 1.0;\n}\n`;var y$=`varying vec4 outTexture;\nvoid main() {\n gl_FragColor = outTexture;\n gl_FragColor.g = outTexture.r / max(1.0, outTexture.a);\n}\n`;var Dyt=2,eF={mipmaps:!1,parameters:{10240:9729,10241:9729,10242:33071,10243:33071},dataFormat:6408},v$=[0,0],Oyt={SUM:0,MEAN:1},Byt={getPosition:{type:\"accessor\",value:e=>e.position},getWeight:{type:\"accessor\",value:1},intensity:{type:\"number\",min:0,value:1},radiusPixels:{type:\"number\",min:1,max:100,value:50},colorRange:s$,threshold:{type:\"number\",min:0,max:1,value:.05},colorDomain:{type:\"array\",value:null,optional:!0},aggregation:\"SUM\",weightsTextureSize:{type:\"number\",min:128,max:2048,value:2048},debounceTimeout:{type:\"number\",min:0,max:1e3,value:500}},Fyt=[Ii.BLEND_EQUATION_MINMAX,Ii.TEXTURE_FLOAT],zyt=[Ii.COLOR_ATTACHMENT_RGBA32F,Ii.FLOAT_BLEND],Nyt={data:{props:[\"radiusPixels\"]}},Up=class extends wx{constructor(...t){super(...t),G(this,\"state\",void 0)}initializeState(){let{gl:t}=this.context;if(!Oh(t,Fyt)){this.setState({supported:!1}),or.error(\"HeatmapLayer: \".concat(this.id,\" is not supported on this browser\"))();return}super.initializeAggregationLayer(Nyt),this.setState({supported:!0,colorDomain:v$}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState(t){this.state.supported&&(super.updateState(t),this._updateHeatmapState(t))}_updateHeatmapState(t){let{props:r,oldProps:i}=t,s=this._getChangeFlags(t);(s.dataChanged||s.viewportChanged)&&(s.boundsChanged=this._updateBounds(s.dataChanged),this._updateTextureRenderingBounds()),s.dataChanged||s.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):s.viewportZoomChanged&&this._debouncedUpdateWeightmap(),r.colorRange!==i.colorRange&&this._updateColorTexture(t),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:t.context.viewport.zoom})}renderLayers(){if(!this.state.supported)return[];let{weightsTexture:t,triPositionBuffer:r,triTexCoordBuffer:i,maxWeightsTexture:s,colorTexture:n,colorDomain:o}=this.state,{updateTriggers:c,intensity:f,threshold:_,aggregation:w}=this.props,I=this.getSubLayerClass(\"triangle\",Sx);return new I(this.getSubLayerProps({id:\"triangle-layer\",updateTriggers:c}),{coordinateSystem:Yr.DEFAULT,data:{attributes:{positions:r,texCoords:i}},vertexCount:4,maxTexture:s,colorTexture:n,aggregationMode:Oyt[w]||0,texture:t,intensity:f,threshold:_,colorDomain:o})}finalizeState(t){super.finalizeState(t);let{weightsTransform:r,weightsTexture:i,maxWeightTransform:s,maxWeightsTexture:n,triPositionBuffer:o,triTexCoordBuffer:c,colorTexture:f,updateTimer:_}=this.state;r?.delete(),i?.delete(),s?.delete(),n?.delete(),o?.delete(),c?.delete(),f?.delete(),_&&clearTimeout(_)}_getAttributeManager(){return new Xf(this.context.gl,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(t){let r={},{dimensions:i}=this.state;r.dataChanged=this.isAttributeChanged()||this.isAggregationDirty(t,{compareAll:!0,dimension:i.data}),r.viewportChanged=t.changeFlags.viewportChanged;let{zoom:s}=this.state;return(!t.context.viewport||t.context.viewport.zoom!==s)&&(r.viewportZoomChanged=!0),r}_createTextures(){let{gl:t}=this.context,{textureSize:r,format:i,type:s}=this.state;this.setState({weightsTexture:new pi(t,{width:r,height:r,format:i,type:s,...eF}),maxWeightsTexture:new pi(t,{format:i,type:s,...eF})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:5130,accessor:\"getPosition\"},weights:{size:1,accessor:\"getWeight\"}}),this.setState({positionAttributeName:\"positions\"})}_setupTextureParams(){let{gl:t}=this.context,{weightsTextureSize:r}=this.props,i=Math.min(r,wy(t,3379)),s=Oh(t,zyt),{format:n,type:o}=d$({gl:t,floatTargetSupport:s}),c=s?1:1/255;this.setState({textureSize:i,format:n,type:o,weightsScale:c}),s||or.warn(\"HeatmapLayer: \".concat(this.id,\" rendering to float texture not supported, fallingback to low precession format\"))()}getShaders(t){return super.getShaders(t===\"max-weights-transform\"?{vs:_$,_fs:y$}:{vs:m$,_fs:g$})}_createWeightsTransform(t={}){var r;let{gl:i}=this.context,{weightsTransform:s}=this.state,{weightsTexture:n}=this.state;(r=s)===null||r===void 0||r.delete(),s=new nc(i,{id:\"\".concat(this.id,\"-weights-transform\"),elementCount:1,_targetTexture:n,_targetTextureVarying:\"weightsTexture\",...t}),this.setState({weightsTransform:s})}_setupResources(){let{gl:t}=this.context;this._createTextures();let{textureSize:r,weightsTexture:i,maxWeightsTexture:s}=this.state,n=this.getShaders(\"weights-transform\");this._createWeightsTransform(n);let o=this.getShaders(\"max-weights-transform\"),c=new nc(t,{id:\"\".concat(this.id,\"-max-weights-transform\"),_sourceTextures:{inTexture:i},_targetTexture:s,_targetTextureVarying:\"outTexture\",...o,elementCount:r*r});this.setState({weightsTexture:i,maxWeightsTexture:s,maxWeightTransform:c,zoom:null,triPositionBuffer:new Fr(t,{byteLength:48,accessor:{size:3}}),triTexCoordBuffer:new Fr(t,{byteLength:48,accessor:{size:2}})})}updateShaders(t){this._createWeightsTransform(t)}_updateMaxWeightValue(){let{maxWeightTransform:t}=this.state;t.run({parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32776}})}_updateBounds(t=!1){let{viewport:r}=this.context,i=[r.unproject([0,0]),r.unproject([r.width,0]),r.unproject([r.width,r.height]),r.unproject([0,r.height])].map(c=>c.map(Math.fround)),s=c$(i),n={visibleWorldBounds:s,viewportCorners:i},o=!1;if(t||!this.state.worldBounds||!u$(this.state.worldBounds,s)){let c=this._worldToCommonBounds(s),f=this._commonToWorldBounds(c);this.props.coordinateSystem===Yr.LNGLAT&&(f[1]=Math.max(f[1],-85.051129),f[3]=Math.min(f[3],85.051129),f[0]=Math.max(f[0],-360),f[2]=Math.min(f[2],360));let _=this._worldToCommonBounds(f);n.worldBounds=f,n.normalizedCommonBounds=_,o=!0}return this.setState(n),o}_updateTextureRenderingBounds(){let{triPositionBuffer:t,triTexCoordBuffer:r,normalizedCommonBounds:i,viewportCorners:s}=this.state,{viewport:n}=this.context;t.subData(tF(s,3));let o=s.map(c=>f$(n.projectPosition(c),i));r.subData(tF(o,2))}_updateColorTexture(t){let{colorRange:r}=t.props,{colorTexture:i}=this.state,s=o$(r,!1,Uint8Array);i?i.setImageData({data:s,width:r.length}):i=new pi(this.context.gl,{data:s,width:r.length,height:1,...eF}),this.setState({colorTexture:i})}_updateWeightmap(){let{radiusPixels:t,colorDomain:r,aggregation:i}=this.props,{weightsTransform:s,worldBounds:n,textureSize:o,weightsTexture:c,weightsScale:f}=this.state;this.state.isWeightMapDirty=!1;let _=this._worldToCommonBounds(n,{useLayerCoordinateSystem:!0});if(r&&i===\"SUM\"){let{viewport:I}=this.context,R=I.distanceScales.metersPerUnit[2]*(_[2]-_[0])/o;this.state.colorDomain=r.map(N=>N*R*f)}else this.state.colorDomain=r||v$;let w={radiusPixels:t,commonBounds:_,textureWidth:o,weightsScale:f};s.update({elementCount:this.getNumInstances()}),Mn(this.context.gl,{clearColor:[0,0,0,0]},()=>{s.run({uniforms:w,parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32774},clearRenderTarget:!0,attributes:this.getAttributes(),moduleSettings:this.getModuleSettings()})}),this._updateMaxWeightValue(),c.setParameters({10240:9729,10241:9729})}_debouncedUpdateWeightmap(t=!1){let{updateTimer:r}=this.state,{debounceTimeout:i}=this.props;t?(r=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(r),r=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),i)),this.setState({updateTimer:r})}_worldToCommonBounds(t,r={}){let{useLayerCoordinateSystem:i=!1}=r,[s,n,o,c]=t,{viewport:f}=this.context,{textureSize:_}=this.state,{coordinateSystem:w}=this.props,I=i&&(w===Yr.LNGLAT_OFFSETS||w===Yr.METER_OFFSETS),R=I?f.projectPosition(this.props.coordinateOrigin):[0,0],N=_*Dyt/f.scale,j,Q;return i&&!I?(j=this.projectPosition([s,n,0]),Q=this.projectPosition([o,c,0])):(j=f.projectPosition([s,n,0]),Q=f.projectPosition([o,c,0])),h$([j[0]-R[0],j[1]-R[1],Q[0]-R[0],Q[1]-R[1]],N,N)}_commonToWorldBounds(t){let[r,i,s,n]=t,{viewport:o}=this.context,c=o.unprojectPosition([r,i]),f=o.unprojectPosition([s,n]);return c.slice(0,2).concat(f.slice(0,2))}};G(Up,\"layerName\",\"HeatmapLayer\");G(Up,\"defaultProps\",Byt);var{data:Ale,getPosition:mle,...Uyt}=Up.defaultProps,x$={_validate:!0},Vyt={...Uyt,...x$},CS=class extends Ni{static defaultProps=Vyt;static layerName=\"GeoArrowHeatmapLayer\";renderLayers(){let{data:t}=this.props,r=ws(t,Kn.POINT);if(r!==null)return this._renderLayersPoint(r);let i=this.props.getPosition;if(i!==void 0&&Ci.isPointVector(i))return this._renderLayersPoint(i);throw new Error(\"getPosition not GeoArrow point\")}_renderLayersPoint(t){let{data:r}=this.props;this.props._validate&&(_r(Ci.isPointVector(t)),no(this.props,r));let[i,s]=io(this.props,[\"getPosition\"]),n=vo(r.data),o=[];for(let c=0;cr.text()),earcutWorkerPool:null}}async initEarcutPool(){if(this.state.earcutWorkerPool)return this.state.earcutWorkerPool;let t=await this.state.earcutWorkerRequest;if(!t||window?.location?.href.startsWith(\"file://\"))return null;try{let r=RX(()=>LX(kX.fromText(t)),8);return this.state.earcutWorkerPool=r,this.state.earcutWorkerPool}catch{return null}}async finalizeState(t){await this.state?.earcutWorkerPool?.terminate(),console.log(\"terminated\")}async updateData(){let{data:t}=this.props,r=await this._updateEarcut(t),i=vo(t.data);this.setState({table:this.props.data,triangles:r,tableOffsets:i})}async _updateEarcut(t){let r=ws(t,Kn.POLYGON);if(r!==null)return this._earcutPolygonVector(r);let i=ws(t,Kn.MULTIPOLYGON);if(i!==null)return this._earcutMultiPolygonVector(i);let s=this.props.getPolygon;if(s!==void 0&&Ci.isPolygonVector(s))return this._earcutPolygonVector(s);if(s!==void 0&&Ci.isMultiPolygonVector(s))return this._earcutMultiPolygonVector(s);throw new Error(\"geometryColumn not Polygon or MultiPolygon\")}async _earcutPolygonVector(t){let r=await this.initEarcutPool();if(!r)return this._earcutPolygonVectorMainThread(t);let i=new Array(t.data.length);console.time(\"earcut\");for(let s=0;s{let _=await f(LF(o,c));i[s]=_})}return await r.completed(),console.timeEnd(\"earcut\"),i}_earcutPolygonVectorMainThread(t){let r=new Array(t.data.length);for(let i=0;i{let w=await _(LF(c,f));i[s]=w})}return await r.completed(),console.timeEnd(\"earcut\"),i}_earcutMultiPolygonVectorMainThread(t){let r=new Array(t.data.length);for(let i=0;iDX(t))):e}function OX(e){if(\"data\"in e)return new xr(e.data.map(o=>OX(o)));let t=e.valueOffsets,r=vi.getMultiPolygonChild(e),i=r.valueOffsets,s=vi.getPolygonChild(r),n=new Int32Array(t.length);for(let o=0;o{this.table=O2(this.model.get(t))};this.model.on(`change:${t}`,r),this.callbacks.set(`change:${t}`,r)}},tC=class extends mf{static layerType=\"arc\";greatCircle;numSegments;widthUnits;widthScale;widthMinPixels;widthMaxPixels;getSourcePosition;getTargetPosition;getSourceColor;getTargetColor;getWidth;getHeight;getTilt;constructor(t,r){super(t,r),this.initRegularAttribute(\"great_circle\",\"greatCircle\"),this.initRegularAttribute(\"num_segments\",\"numSegments\"),this.initRegularAttribute(\"width_units\",\"widthUnits\"),this.initRegularAttribute(\"width_scale\",\"widthScale\"),this.initRegularAttribute(\"width_min_pixels\",\"widthMinPixels\"),this.initRegularAttribute(\"width_max_pixels\",\"widthMaxPixels\"),this.initVectorizedAccessor(\"get_source_position\",\"getSourcePosition\"),this.initVectorizedAccessor(\"get_target_position\",\"getTargetPosition\"),this.initVectorizedAccessor(\"get_source_color\",\"getSourceColor\"),this.initVectorizedAccessor(\"get_target_color\",\"getTargetColor\"),this.initVectorizedAccessor(\"get_width\",\"getWidth\"),this.initVectorizedAccessor(\"get_height\",\"getHeight\"),this.initVectorizedAccessor(\"get_tilt\",\"getTilt\")}layerProps(){return{data:this.table,getSourcePosition:this.getSourcePosition,getTargetPosition:this.getTargetPosition,...Jt(this.greatCircle)&&{greatCircle:this.greatCircle},...Jt(this.numSegments)&&{numSegments:this.numSegments},...Jt(this.widthUnits)&&{widthUnits:this.widthUnits},...Jt(this.widthScale)&&{widthScale:this.widthScale},...Jt(this.widthMinPixels)&&{widthMinPixels:this.widthMinPixels},...Jt(this.widthMaxPixels)&&{widthMaxPixels:this.widthMaxPixels},...Jt(this.getSourceColor)&&{getSourceColor:this.getSourceColor},...Jt(this.getTargetColor)&&{getTargetColor:this.getTargetColor},...Jt(this.getWidth)&&{getWidth:this.getWidth},...Jt(this.getHeight)&&{getHeight:this.getHeight},...Jt(this.getTilt)&&{getTilt:this.getTilt}}}render(){return new wS({...this.baseLayerProps(),...this.layerProps()})}},eC=class extends Ug{static layerType=\"bitmap\";image;bounds;desaturate;transparentColor;tintColor;constructor(t,r){super(t,r),this.initRegularAttribute(\"image\",\"image\"),this.initRegularAttribute(\"bounds\",\"bounds\"),this.initRegularAttribute(\"desaturate\",\"desaturate\"),this.initRegularAttribute(\"transparent_color\",\"transparentColor\"),this.initRegularAttribute(\"tint_color\",\"tintColor\")}layerProps(){return{...Jt(this.image)&&{image:this.image},...Jt(this.bounds)&&{bounds:this.bounds},...Jt(this.desaturate)&&{desaturate:this.desaturate},...Jt(this.transparentColor)&&{transparentColor:this.transparentColor},...Jt(this.tintColor)&&{tintColor:this.tintColor}}}render(){return new Mp({...this.baseLayerProps(),...this.layerProps(),data:void 0,pickable:!1})}},rC=class extends Ug{static layerType=\"bitmap-tile\";data;tileSize;zoomOffset;maxZoom;minZoom;extent;maxCacheSize;maxCacheByteSize;refinementStrategy;maxRequests;desaturate;transparentColor;tintColor;constructor(t,r){super(t,r),this.initRegularAttribute(\"data\",\"data\"),this.initRegularAttribute(\"tile_size\",\"tileSize\"),this.initRegularAttribute(\"zoom_offset\",\"zoomOffset\"),this.initRegularAttribute(\"max_zoom\",\"maxZoom\"),this.initRegularAttribute(\"min_zoom\",\"minZoom\"),this.initRegularAttribute(\"extent\",\"extent\"),this.initRegularAttribute(\"max_cache_size\",\"maxCacheSize\"),this.initRegularAttribute(\"max_cache_byte_size\",\"maxCacheByteSize\"),this.initRegularAttribute(\"refinement_strategy\",\"refinementStrategy\"),this.initRegularAttribute(\"max_requests\",\"maxRequests\"),this.initRegularAttribute(\"desaturate\",\"desaturate\"),this.initRegularAttribute(\"transparent_color\",\"transparentColor\"),this.initRegularAttribute(\"tint_color\",\"tintColor\")}bitmapLayerProps(){return{...Jt(this.desaturate)&&{desaturate:this.desaturate},...Jt(this.transparentColor)&&{transparentColor:this.transparentColor},...Jt(this.tintColor)&&{tintColor:this.tintColor}}}layerProps(){return{data:this.data,...Jt(this.tileSize)&&{tileSize:this.tileSize},...Jt(this.zoomOffset)&&{zoomOffset:this.zoomOffset},...Jt(this.maxZoom)&&{maxZoom:this.maxZoom},...Jt(this.minZoom)&&{minZoom:this.minZoom},...Jt(this.extent)&&{extent:this.extent},...Jt(this.maxCacheSize)&&{maxCacheSize:this.maxCacheSize},...Jt(this.maxCacheByteSize)&&{maxCacheByteSize:this.maxCacheByteSize},...Jt(this.refinementStrategy)&&{refinementStrategy:this.refinementStrategy},...Jt(this.maxRequests)&&{maxRequests:this.maxRequests}}}render(){return new Lm({...this.baseLayerProps(),...this.layerProps(),renderSubLayers:t=>{let[r,i]=t.tile.boundingBox;return new Mp(t,{...this.bitmapLayerProps(),data:void 0,image:t.data,bounds:[r[0],r[1],i[0],i[1]]})}})}},iC=class extends mf{static layerType=\"column\";diskResolution;radius;angle;vertices;offset;coverage;elevationScale;filled;stroked;extruded;wireframe;flatShading;radiusUnits;lineWidthUnits;lineWidthScale;lineWidthMinPixels;lineWidthMaxPixels;material;getPosition;getFillColor;getLineColor;getElevation;getLineWidth;constructor(t,r){super(t,r),this.initRegularAttribute(\"disk_resolution\",\"diskResolution\"),this.initRegularAttribute(\"radius\",\"radius\"),this.initRegularAttribute(\"angle\",\"angle\"),this.initRegularAttribute(\"vertices\",\"vertices\"),this.initRegularAttribute(\"offset\",\"offset\"),this.initRegularAttribute(\"coverage\",\"coverage\"),this.initRegularAttribute(\"elevation_scale\",\"elevationScale\"),this.initRegularAttribute(\"filled\",\"filled\"),this.initRegularAttribute(\"stroked\",\"stroked\"),this.initRegularAttribute(\"extruded\",\"extruded\"),this.initRegularAttribute(\"wireframe\",\"wireframe\"),this.initRegularAttribute(\"flat_shading\",\"flatShading\"),this.initRegularAttribute(\"radius_units\",\"radiusUnits\"),this.initRegularAttribute(\"line_width_units\",\"lineWidthUnits\"),this.initRegularAttribute(\"line_width_scale\",\"lineWidthScale\"),this.initRegularAttribute(\"line_width_min_pixels\",\"lineWidthMinPixels\"),this.initRegularAttribute(\"line_width_max_pixels\",\"lineWidthMaxPixels\"),this.initRegularAttribute(\"material\",\"material\"),this.initVectorizedAccessor(\"get_position\",\"getPosition\"),this.initVectorizedAccessor(\"get_fill_color\",\"getFillColor\"),this.initVectorizedAccessor(\"get_line_color\",\"getLineColor\"),this.initVectorizedAccessor(\"get_elevation\",\"getElevation\"),this.initVectorizedAccessor(\"get_line_width\",\"getLineWidth\")}layerProps(){return{data:this.table,...Jt(this.diskResolution)&&{diskResolution:this.diskResolution},...Jt(this.radius)&&{radius:this.radius},...Jt(this.angle)&&{angle:this.angle},...Jt(this.vertices)&&this.vertices!==void 0&&{vertices:this.vertices},...Jt(this.offset)&&{offset:this.offset},...Jt(this.coverage)&&{coverage:this.coverage},...Jt(this.elevationScale)&&{elevationScale:this.elevationScale},...Jt(this.filled)&&{filled:this.filled},...Jt(this.stroked)&&{stroked:this.stroked},...Jt(this.extruded)&&{extruded:this.extruded},...Jt(this.wireframe)&&{wireframe:this.wireframe},...Jt(this.flatShading)&&{flatShading:this.flatShading},...Jt(this.radiusUnits)&&{radiusUnits:this.radiusUnits},...Jt(this.lineWidthUnits)&&{lineWidthUnits:this.lineWidthUnits},...Jt(this.lineWidthScale)&&{lineWidthScale:this.lineWidthScale},...Jt(this.lineWidthMinPixels)&&{lineWidthMinPixels:this.lineWidthMinPixels},...Jt(this.lineWidthMaxPixels)&&{lineWidthMaxPixels:this.lineWidthMaxPixels},...Jt(this.material)&&{material:this.material},...Jt(this.getPosition)&&{getPosition:this.getPosition},...Jt(this.getFillColor)&&{getFillColor:this.getFillColor},...Jt(this.getLineColor)&&{getLineColor:this.getLineColor},...Jt(this.getElevation)&&{getElevation:this.getElevation},...Jt(this.getLineWidth)&&{getLineWidth:this.getLineWidth}}}render(){return new SS({...this.baseLayerProps(),...this.layerProps()})}},nC=class extends mf{static layerType=\"heatmap\";radiusPixels;colorRange;intensity;threshold;colorDomain;aggregation;weightsTextureSize;debounceTimeout;getPosition;getWeight;constructor(t,r){super(t,r),this.initRegularAttribute(\"radius_pixels\",\"radiusPixels\"),this.initRegularAttribute(\"color_range\",\"colorRange\"),this.initRegularAttribute(\"intensity\",\"intensity\"),this.initRegularAttribute(\"threshold\",\"threshold\"),this.initRegularAttribute(\"color_domain\",\"colorDomain\"),this.initRegularAttribute(\"aggregation\",\"aggregation\"),this.initRegularAttribute(\"weights_texture_size\",\"weightsTextureSize\"),this.initRegularAttribute(\"debounce_timeout\",\"debounceTimeout\"),this.initVectorizedAccessor(\"get_position\",\"getPosition\"),this.initVectorizedAccessor(\"get_weight\",\"getWeight\")}layerProps(){return{data:this.table,...Jt(this.radiusPixels)&&{radiusPixels:this.radiusPixels},...Jt(this.colorRange)&&{colorRange:this.colorRange},...Jt(this.intensity)&&{intensity:this.intensity},...Jt(this.threshold)&&{threshold:this.threshold},...Jt(this.colorDomain)&&{colorDomain:this.colorDomain},...Jt(this.aggregation)&&{aggregation:this.aggregation},...Jt(this.weightsTextureSize)&&{weightsTextureSize:this.weightsTextureSize},...Jt(this.debounceTimeout)&&{debounceTimeout:this.debounceTimeout},...Jt(this.getPosition)&&{getPosition:this.getPosition},...Jt(this.getWeight)&&{getWeight:this.getWeight}}}render(){return new CS({...this.baseLayerProps(),...this.layerProps()})}},QS=class extends mf{static layerType=\"path\";widthUnits;widthScale;widthMinPixels;widthMaxPixels;jointRounded;capRounded;miterLimit;billboard;getColor;getWidth;constructor(t,r){super(t,r),this.initRegularAttribute(\"width_units\",\"widthUnits\"),this.initRegularAttribute(\"width_scale\",\"widthScale\"),this.initRegularAttribute(\"width_min_pixels\",\"widthMinPixels\"),this.initRegularAttribute(\"width_max_pixels\",\"widthMaxPixels\"),this.initRegularAttribute(\"joint_rounded\",\"jointRounded\"),this.initRegularAttribute(\"cap_rounded\",\"capRounded\"),this.initRegularAttribute(\"miter_limit\",\"miterLimit\"),this.initRegularAttribute(\"billboard\",\"billboard\"),this.initVectorizedAccessor(\"get_color\",\"getColor\"),this.initVectorizedAccessor(\"get_width\",\"getWidth\")}layerProps(){return{data:this.table,...Jt(this.widthUnits)&&{widthUnits:this.widthUnits},...Jt(this.widthScale)&&{widthScale:this.widthScale},...Jt(this.widthMinPixels)&&{widthMinPixels:this.widthMinPixels},...Jt(this.widthMaxPixels)&&{widthMaxPixels:this.widthMaxPixels},...Jt(this.jointRounded)&&{jointRounded:this.jointRounded},...Jt(this.capRounded)&&{capRounded:this.capRounded},...Jt(this.miterLimit)&&{miterLimit:this.miterLimit},...Jt(this.billboard)&&{billboard:this.billboard},...Jt(this.getColor)&&{getColor:this.getColor},...Jt(this.getWidth)&&{getWidth:this.getWidth}}}render(){return new e_({...this.baseLayerProps(),...this.layerProps()})}},sC=class extends mf{static layerType=\"point-cloud\";sizeUnits;pointSize;getColor;getNormal;constructor(t,r){super(t,r),this.initRegularAttribute(\"size_units\",\"sizeUnits\"),this.initRegularAttribute(\"point_size\",\"pointSize\"),this.initVectorizedAccessor(\"get_color\",\"getColor\"),this.initVectorizedAccessor(\"get_normal\",\"getNormal\")}layerProps(){return{data:this.table,...Jt(this.sizeUnits)&&{sizeUnits:this.sizeUnits},...Jt(this.pointSize)&&{pointSize:this.pointSize},...Jt(this.getColor)&&{getColor:this.getColor},...Jt(this.getNormal)&&{getNormal:this.getNormal}}}render(){return new LS({...this.baseLayerProps(),...this.layerProps()})}},oC=class extends mf{static layerType=\"polygon\";stroked;filled;extruded;wireframe;elevationScale;lineWidthUnits;lineWidthScale;lineWidthMinPixels;lineWidthMaxPixels;lineJointRounded;lineMiterLimit;getFillColor;getLineColor;getLineWidth;getElevation;constructor(t,r){super(t,r),this.initRegularAttribute(\"stroked\",\"stroked\"),this.initRegularAttribute(\"filled\",\"filled\"),this.initRegularAttribute(\"extruded\",\"extruded\"),this.initRegularAttribute(\"wireframe\",\"wireframe\"),this.initRegularAttribute(\"elevation_scale\",\"elevationScale\"),this.initRegularAttribute(\"line_width_units\",\"lineWidthUnits\"),this.initRegularAttribute(\"line_width_scale\",\"lineWidthScale\"),this.initRegularAttribute(\"line_width_min_pixels\",\"lineWidthMinPixels\"),this.initRegularAttribute(\"line_width_max_pixels\",\"lineWidthMaxPixels\"),this.initRegularAttribute(\"line_joint_rounded\",\"lineJointRounded\"),this.initRegularAttribute(\"line_miter_limit\",\"lineMiterLimit\"),this.initVectorizedAccessor(\"get_fill_color\",\"getFillColor\"),this.initVectorizedAccessor(\"get_line_color\",\"getLineColor\"),this.initVectorizedAccessor(\"get_line_width\",\"getLineWidth\"),this.initVectorizedAccessor(\"get_elevation\",\"getElevation\")}layerProps(){return{data:this.table,...Jt(this.stroked)&&{stroked:this.stroked},...Jt(this.filled)&&{filled:this.filled},...Jt(this.extruded)&&{extruded:this.extruded},...Jt(this.wireframe)&&{wireframe:this.wireframe},...Jt(this.elevationScale)&&{elevationScale:this.elevationScale},...Jt(this.lineWidthUnits)&&{lineWidthUnits:this.lineWidthUnits},...Jt(this.lineWidthScale)&&{lineWidthScale:this.lineWidthScale},...Jt(this.lineWidthMinPixels)&&{lineWidthMinPixels:this.lineWidthMinPixels},...Jt(this.lineWidthMaxPixels)&&{lineWidthMaxPixels:this.lineWidthMaxPixels},...Jt(this.lineJointRounded)&&{lineJointRounded:this.lineJointRounded},...Jt(this.lineMiterLimit)&&{lineMiterLimit:this.lineMiterLimit},...Jt(this.getFillColor)&&{getFillColor:this.getFillColor},...Jt(this.getLineColor)&&{getLineColor:this.getLineColor},...Jt(this.getLineWidth)&&{getLineWidth:this.getLineWidth},...Jt(this.getElevation)&&{getElevation:this.getElevation}}}render(){return new qS({...this.baseLayerProps(),...this.layerProps()})}},$S=class extends mf{static layerType=\"scatterplot\";radiusUnits;radiusScale;radiusMinPixels;radiusMaxPixels;lineWidthUnits;lineWidthScale;lineWidthMinPixels;lineWidthMaxPixels;stroked;filled;billboard;antialiasing;getRadius;getFillColor;getLineColor;getLineWidth;constructor(t,r){super(t,r),this.initRegularAttribute(\"radius_units\",\"radiusUnits\"),this.initRegularAttribute(\"radius_scale\",\"radiusScale\"),this.initRegularAttribute(\"radius_min_pixels\",\"radiusMinPixels\"),this.initRegularAttribute(\"radius_max_pixels\",\"radiusMaxPixels\"),this.initRegularAttribute(\"line_width_units\",\"lineWidthUnits\"),this.initRegularAttribute(\"line_width_scale\",\"lineWidthScale\"),this.initRegularAttribute(\"line_width_min_pixels\",\"lineWidthMinPixels\"),this.initRegularAttribute(\"line_width_max_pixels\",\"lineWidthMaxPixels\"),this.initRegularAttribute(\"stroked\",\"stroked\"),this.initRegularAttribute(\"filled\",\"filled\"),this.initRegularAttribute(\"billboard\",\"billboard\"),this.initRegularAttribute(\"antialiasing\",\"antialiasing\"),this.initVectorizedAccessor(\"get_radius\",\"getRadius\"),this.initVectorizedAccessor(\"get_fill_color\",\"getFillColor\"),this.initVectorizedAccessor(\"get_line_color\",\"getLineColor\"),this.initVectorizedAccessor(\"get_line_width\",\"getLineWidth\")}layerProps(){return{data:this.table,...Jt(this.radiusUnits)&&{radiusUnits:this.radiusUnits},...Jt(this.radiusScale)&&{radiusScale:this.radiusScale},...Jt(this.radiusMinPixels)&&{radiusMinPixels:this.radiusMinPixels},...Jt(this.radiusMaxPixels)&&{radiusMaxPixels:this.radiusMaxPixels},...Jt(this.lineWidthUnits)&&{lineWidthUnits:this.lineWidthUnits},...Jt(this.lineWidthScale)&&{lineWidthScale:this.lineWidthScale},...Jt(this.lineWidthMinPixels)&&{lineWidthMinPixels:this.lineWidthMinPixels},...Jt(this.lineWidthMaxPixels)&&{lineWidthMaxPixels:this.lineWidthMaxPixels},...Jt(this.stroked)&&{stroked:this.stroked},...Jt(this.filled)&&{filled:this.filled},...Jt(this.billboard)&&{billboard:this.billboard},...Jt(this.antialiasing)&&{antialiasing:this.antialiasing},...Jt(this.getRadius)&&{getRadius:this.getRadius},...Jt(this.getFillColor)&&{getFillColor:this.getFillColor},...Jt(this.getLineColor)&&{getLineColor:this.getLineColor},...Jt(this.getLineWidth)&&{getLineWidth:this.getLineWidth}}}render(){return new ZS({...this.baseLayerProps(),...this.layerProps()})}},XS=class extends mf{static layerType=\"solid-polygon\";filled;extruded;wireframe;elevationScale;getElevation;getFillColor;getLineColor;constructor(t,r){super(t,r),this.initRegularAttribute(\"filled\",\"filled\"),this.initRegularAttribute(\"extruded\",\"extruded\"),this.initRegularAttribute(\"wireframe\",\"wireframe\"),this.initRegularAttribute(\"elevation_scale\",\"elevationScale\"),this.initVectorizedAccessor(\"get_elevation\",\"getElevation\"),this.initVectorizedAccessor(\"get_fill_color\",\"getFillColor\"),this.initVectorizedAccessor(\"get_line_color\",\"getLineColor\")}layerProps(){return{data:this.table,...Jt(this.filled)&&{filled:this.filled},...Jt(this.extruded)&&{extruded:this.extruded},...Jt(this.wireframe)&&{wireframe:this.wireframe},...Jt(this.elevationScale)&&{elevationScale:this.elevationScale},...Jt(this.getElevation)&&{getElevation:this.getElevation},...Jt(this.getFillColor)&&{getFillColor:this.getFillColor},...Jt(this.getLineColor)&&{getLineColor:this.getLineColor}}}render(){return new o_({...this.baseLayerProps(),...this.layerProps()})}},aC=class extends mf{static layerType=\"text\";billboard;sizeScale;sizeUnits;sizeMinPixels;sizeMaxPixels;getBackgroundColor;getBorderColor;getBorderWidth;backgroundPadding;characterSet;fontFamily;fontWeight;lineHeight;outlineWidth;outlineColor;fontSettings;wordBreak;maxWidth;getText;getPosition;getColor;getSize;getAngle;getTextAnchor;getAlignmentBaseline;getPixelOffset;constructor(t,r){super(t,r),this.initRegularAttribute(\"billboard\",\"billboard\"),this.initRegularAttribute(\"size_scale\",\"sizeScale\"),this.initRegularAttribute(\"size_units\",\"sizeUnits\"),this.initRegularAttribute(\"size_min_pixels\",\"sizeMinPixels\"),this.initRegularAttribute(\"size_max_pixels\",\"sizeMaxPixels\"),this.initRegularAttribute(\"background_padding\",\"backgroundPadding\"),this.initRegularAttribute(\"character_set\",\"characterSet\"),this.initRegularAttribute(\"font_family\",\"fontFamily\"),this.initRegularAttribute(\"font_weight\",\"fontWeight\"),this.initRegularAttribute(\"line_height\",\"lineHeight\"),this.initRegularAttribute(\"outline_width\",\"outlineWidth\"),this.initRegularAttribute(\"outline_color\",\"outlineColor\"),this.initRegularAttribute(\"font_settings\",\"fontSettings\"),this.initRegularAttribute(\"word_break\",\"wordBreak\"),this.initRegularAttribute(\"max_width\",\"maxWidth\"),this.initVectorizedAccessor(\"get_background_color\",\"getBackgroundColor\"),this.initVectorizedAccessor(\"get_border_color\",\"getBorderColor\"),this.initVectorizedAccessor(\"get_border_width\",\"getBorderWidth\"),this.initVectorizedAccessor(\"get_text\",\"getText\"),this.initVectorizedAccessor(\"get_position\",\"getPosition\"),this.initVectorizedAccessor(\"get_color\",\"getColor\"),this.initVectorizedAccessor(\"get_size\",\"getSize\"),this.initVectorizedAccessor(\"get_angle\",\"getAngle\"),this.initVectorizedAccessor(\"get_text_anchor\",\"getTextAnchor\"),this.initVectorizedAccessor(\"get_alignment_baseline\",\"getAlignmentBaseline\"),this.initVectorizedAccessor(\"get_pixel_offset\",\"getPixelOffset\")}layerProps(){return{data:this.table,getText:this.getText,...Jt(this.billboard)&&{billboard:this.billboard},...Jt(this.sizeScale)&&{sizeScale:this.sizeScale},...Jt(this.sizeUnits)&&{sizeUnits:this.sizeUnits},...Jt(this.sizeMinPixels)&&{sizeMinPixels:this.sizeMinPixels},...Jt(this.sizeMaxPixels)&&{sizeMaxPixels:this.sizeMaxPixels},...Jt(this.backgroundPadding)&&{backgroundPadding:this.backgroundPadding},...Jt(this.characterSet)&&{characterSet:this.characterSet},...Jt(this.fontFamily)&&{fontFamily:this.fontFamily},...Jt(this.fontWeight)&&{fontWeight:this.fontWeight},...Jt(this.lineHeight)&&{lineHeight:this.lineHeight},...Jt(this.outlineWidth)&&{outlineWidth:this.outlineWidth},...Jt(this.outlineColor)&&{outlineColor:this.outlineColor},...Jt(this.fontSettings)&&{fontSettings:this.fontSettings},...Jt(this.wordBreak)&&{wordBreak:this.wordBreak},...Jt(this.maxWidth)&&{maxWidth:this.maxWidth},...Jt(this.getBackgroundColor)&&{getBackgroundColor:this.getBackgroundColor},...Jt(this.getBorderColor)&&{getBorderColor:this.getBorderColor},...Jt(this.getBorderWidth)&&{getBorderWidth:this.getBorderWidth},...Jt(this.getPosition)&&{getPosition:this.getPosition},...Jt(this.getColor)&&{getColor:this.getColor},...Jt(this.getSize)&&{getSize:this.getSize},...Jt(this.getAngle)&&{getAngle:this.getAngle},...Jt(this.getTextAnchor)&&{getTextAnchor:this.getTextAnchor},...Jt(this.getAlignmentBaseline)&&{getAlignmentBaseline:this.getAlignmentBaseline},...Jt(this.getPixelOffset)&&{getPixelOffset:this.getPixelOffset}}}render(){return new YS({...this.baseLayerProps(),...this.layerProps()})}};async function DF(e,t){let r=e.get(\"_layer_type\"),i;switch(r){case tC.layerType:i=new tC(e,t);break;case eC.layerType:i=new eC(e,t);break;case rC.layerType:i=new rC(e,t);break;case iC.layerType:i=new iC(e,t);break;case nC.layerType:i=new nC(e,t);break;case QS.layerType:i=new QS(e,t);break;case sC.layerType:i=new sC(e,t);break;case oC.layerType:i=new oC(e,t);break;case $S.layerType:i=new $S(e,t);break;case XS.layerType:i=new XS(e,t);break;case aC.layerType:i=new aC(e,t);break;default:throw new Error(`no layer supported for ${r}`)}return await i.loadSubModels(),i}var lC=Symbol.for(\"rowIndex\");function U1t(e){return`\n \n ${Object.keys(e).map(t=>{let r=e[t];return`\n \n \n `}).join(\"\")}\n \n
${t}${r}
`}function FX({object:e}){if(e){if(e[lC]===null||e[lC]===void 0||e[lC]&&e[lC]<0)return null;let t=e.toJSON();return!t||(delete t.geometry,Object.keys(t).length===0)?null:{className:\"lonboard-tooltip\",html:U1t(t),style:{backgroundColor:\"#fff\",boxShadow:\"0 0 15px rgba(0, 0, 0, 0.1)\",color:\"#000\",padding:\"6px\"}}}return null}var cC,V1t=new Uint8Array(16);function OF(){if(!cC&&(cC=typeof crypto<\"u\"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!cC))throw new Error(\"crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported\");return cC(V1t)}var Ea=[];for(let e=0;e<256;++e)Ea.push((e+256).toString(16).slice(1));function zX(e,t=0){return Ea[e[t+0]]+Ea[e[t+1]]+Ea[e[t+2]]+Ea[e[t+3]]+\"-\"+Ea[e[t+4]]+Ea[e[t+5]]+\"-\"+Ea[e[t+6]]+Ea[e[t+7]]+\"-\"+Ea[e[t+8]]+Ea[e[t+9]]+\"-\"+Ea[e[t+10]]+Ea[e[t+11]]+Ea[e[t+12]]+Ea[e[t+13]]+Ea[e[t+14]]+Ea[e[t+15]]}var j1t=typeof crypto<\"u\"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),BF={randomUUID:j1t};function G1t(e,t,r){if(BF.randomUUID&&!t&&!e)return BF.randomUUID();e=e||{};let i=e.random||(e.rng||OF)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let s=0;s<16;++s)t[r+s]=i[s];return t}return zX(i)}var FF=G1t;function NX(e,t){let{longitude:r,latitude:i,zoom:s,pitch:n,bearing:o,transitionDuration:c,curve:f,speed:_,screenSpeed:w}=e,I=new nv({...Jt(f)&&{curve:f},...Jt(_)&&{speed:_},...Jt(w)&&{screenSpeed:w}});t({longitude:r,latitude:i,zoom:s,pitch:n,bearing:o,transitionDuration:c,transitionInterpolator:I})}var uC=Ri(Yi(),1);var W1t=DH(e=>{let t=e.get(\"view_state\");\"transitionInterpolator\"in t&&(console.debug(\"Deleting transitionInterpolator!\"),delete t.transitionInterpolator,e.set(\"view_state\",t)),e.save_changes()},300);function UX(e){let t=Y1(),[r,i]=uC.useState(t.get(e));return uC.useEffect(()=>{let s=()=>{i(t.get(e))};return t.on(`change:${e}`,s),()=>t.off(`change:${e}`,s)},[t,e]),[r,s=>{t.set(e,s),W1t(t)}]}await kH();var H1t={latitude:10,longitude:0,zoom:.5,bearing:0,pitch:0},q1t=\"https://basemaps.cartocdn.com/gl/positron-nolabels-gl-style/style.json\";async function Z1t(e,t,r,i){let s={},n=()=>i(new Date);for(let o=0;o{switch(et.type){case\"fly-to\":NX(et,f);break;default:break}});let[_]=(0,a_.useState)(FF()),[w,I]=(0,a_.useState)({}),[R]=zA(\"layers\"),[N,j]=(0,a_.useState)(new Date);(0,a_.useEffect)(()=>{(async()=>{let Y=await L3(e.widget_manager,R),K=await Z1t(Y,R,w,j);I(K)})().catch(console.error)},[R]);let Q=[];for(let et of Object.values(w))Q.push(et.render());return(0,a_.useEffect)(()=>{if(r)return;let Y=document.getElementById(`map-${_}`)?.parentElement;if(Y){let K=window.getComputedStyle(Y);(!K.height||K.height===\"0px\")&&(Y.style.height=\"100%\",Y.style.minHeight=\"500px\")}},[]),hC.createElement(\"div\",{id:`map-${_}`,style:{height:r||\"100%\"}},hC.createElement(GD,{initialViewState:[\"longitude\",\"latitude\",\"zoom\"].every(et=>Object.keys(c).includes(et))?c:H1t,controller:!0,layers:Q,getTooltip:i&&FX,pickingRadius:s,useDevicePixels:Jt(n)?n:!0,_typedArrayManagerProps:{overAlloc:1,poolSize:0},onViewStateChange:et=>{let{viewState:Y}=et,{longitude:K,latitude:J,zoom:ut,pitch:Et,bearing:kt}=Y;f({longitude:K,latitude:J,zoom:ut,pitch:Et,bearing:kt})},parameters:o||{}},hC.createElement(iU,{mapStyle:t||q1t})))}var Q1t={render:j8(Y1t)},Che=Q1t;export{Che as default};\n/*! Bundled license information:\n\nreact/cjs/react.production.min.js:\n (**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nscheduler/cjs/scheduler.production.min.js:\n (**\n * @license React\n * scheduler.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nreact-dom/cjs/react-dom.production.min.js:\n (**\n * @license React\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nhammerjs/hammer.js:\n (*! Hammer.JS - v2.0.7 - 2016-04-22\n * http://hammerjs.github.io/\n *\n * Copyright (c) 2016 Jorik Tangelder;\n * Licensed under the MIT license *)\n*/\n", + "_height": null, + "_model_module": "anywidget", + "_model_module_version": "~0.9.*", + "_model_name": "AnyModel", + "_view_module": "anywidget", + "_view_module_version": "~0.9.*", + "_view_name": "AnyView", + "basemap_style": "https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json", + "layers": [ + "IPY_MODEL_9d658f15dca344cbb9c641c6611bddfc" + ], + "layout": "IPY_MODEL_c0376471f7054687a5d467df53b0b62a", + "parameters": null, + "picking_radius": 5, + "show_tooltip": true, + "use_device_pixels": null, + "view_state": { + "bearing": 0, + "latitude": 41.7085886898, + "longitude": -76.3724423472, + "pitch": 0, + "zoom": 3 + } + } + }, + "c0376471f7054687a5d467df53b0b62a": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": {} + }, + "eda08da05f4045979e351373b05df28f": { + "model_module": "anywidget", + "model_module_version": "~0.9.*", + "model_name": "AnyModel", + "state": { + "_anywidget_id": "lonboard._map.Map", + "_css": ".lonboard-tooltip{font-family:var(--jp-ui-font-family);font-size:var(--jp-ui-font-size1)}.lonboard-tooltip table{border-collapse:collapse}.lonboard-tooltip table tr:nth-child(odd){background-color:#fff}.lonboard-tooltip table tr:nth-child(2n){background-color:#f1f1f1}.lonboard-tooltip td{border:1px solid rgb(204,204,204);padding:5px}.lonboard-tooltip td:first-child{font-weight:450}\n", + "_esm": "var EJ=Object.create;var $C=Object.defineProperty;var PJ=Object.getOwnPropertyDescriptor;var IJ=Object.getOwnPropertyNames;var CJ=Object.getPrototypeOf,LJ=Object.prototype.hasOwnProperty;var Br=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),mA=(e,t)=>{for(var r in t)$C(e,r,{get:t[r],enumerable:!0})},kJ=(e,t,r,i)=>{if(t&&typeof t==\"object\"||typeof t==\"function\")for(let s of IJ(t))!LJ.call(e,s)&&s!==r&&$C(e,s,{get:()=>t[s],enumerable:!(i=PJ(t,s))||i.enumerable});return e};var Ri=(e,t,r)=>(r=e!=null?EJ(CJ(e)):{},kJ(t||!e||!e.__esModule?$C(r,\"default\",{value:e,enumerable:!0}):r,e));var _z=Br(Di=>{\"use strict\";var r1=Symbol.for(\"react.element\"),RJ=Symbol.for(\"react.portal\"),DJ=Symbol.for(\"react.fragment\"),OJ=Symbol.for(\"react.strict_mode\"),BJ=Symbol.for(\"react.profiler\"),FJ=Symbol.for(\"react.provider\"),zJ=Symbol.for(\"react.context\"),NJ=Symbol.for(\"react.forward_ref\"),UJ=Symbol.for(\"react.suspense\"),VJ=Symbol.for(\"react.memo\"),jJ=Symbol.for(\"react.lazy\"),az=Symbol.iterator;function GJ(e){return e===null||typeof e!=\"object\"?null:(e=az&&e[az]||e[\"@@iterator\"],typeof e==\"function\"?e:null)}var uz={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},hz=Object.assign,fz={};function R_(e,t,r){this.props=e,this.context=t,this.refs=fz,this.updater=r||uz}R_.prototype.isReactComponent={};R_.prototype.setState=function(e,t){if(typeof e!=\"object\"&&typeof e!=\"function\"&&e!=null)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,e,t,\"setState\")};R_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,\"forceUpdate\")};function dz(){}dz.prototype=R_.prototype;function KC(e,t,r){this.props=e,this.context=t,this.refs=fz,this.updater=r||uz}var JC=KC.prototype=new dz;JC.constructor=KC;hz(JC,R_.prototype);JC.isPureReactComponent=!0;var lz=Array.isArray,pz=Object.prototype.hasOwnProperty,tL={current:null},Az={key:!0,ref:!0,__self:!0,__source:!0};function mz(e,t,r){var i,s={},n=null,o=null;if(t!=null)for(i in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(n=\"\"+t.key),t)pz.call(t,i)&&!Az.hasOwnProperty(i)&&(s[i]=t[i]);var c=arguments.length-2;if(c===1)s.children=r;else if(1{\"use strict\";yz.exports=_z()});var Iz=Br(zn=>{\"use strict\";function sL(e,t){var r=e.length;e.push(t);t:for(;0>>1,s=e[i];if(0<_T(s,t))e[i]=t,e[r]=s,r=i;else break t}}function Sh(e){return e.length===0?null:e[0]}function vT(e){if(e.length===0)return null;var t=e[0],r=e.pop();if(r!==t){e[0]=r;t:for(var i=0,s=e.length,n=s>>>1;i_T(c,r))f_T(_,c)?(e[i]=_,e[f]=r,i=f):(e[i]=c,e[o]=r,i=o);else if(f_T(_,r))e[i]=_,e[f]=r,i=f;else break t}}return t}function _T(e,t){var r=e.sortIndex-t.sortIndex;return r!==0?r:e.id-t.id}typeof performance==\"object\"&&typeof performance.now==\"function\"?(vz=performance,zn.unstable_now=function(){return vz.now()}):(rL=Date,xz=rL.now(),zn.unstable_now=function(){return rL.now()-xz});var vz,rL,xz,If=[],gA=[],YJ=1,wu=null,qa=3,xT=!1,_0=!1,n1=!1,Sz=typeof setTimeout==\"function\"?setTimeout:null,Tz=typeof clearTimeout==\"function\"?clearTimeout:null,bz=typeof setImmediate<\"u\"?setImmediate:null;typeof navigator<\"u\"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function oL(e){for(var t=Sh(gA);t!==null;){if(t.callback===null)vT(gA);else if(t.startTime<=e)vT(gA),t.sortIndex=t.expirationTime,sL(If,t);else break;t=Sh(gA)}}function aL(e){if(n1=!1,oL(e),!_0)if(Sh(If)!==null)_0=!0,cL(lL);else{var t=Sh(gA);t!==null&&uL(aL,t.startTime-e)}}function lL(e,t){_0=!1,n1&&(n1=!1,Tz(s1),s1=-1),xT=!0;var r=qa;try{for(oL(t),wu=Sh(If);wu!==null&&(!(wu.expirationTime>t)||e&&!Pz());){var i=wu.callback;if(typeof i==\"function\"){wu.callback=null,qa=wu.priorityLevel;var s=i(wu.expirationTime<=t);t=zn.unstable_now(),typeof s==\"function\"?wu.callback=s:wu===Sh(If)&&vT(If),oL(t)}else vT(If);wu=Sh(If)}if(wu!==null)var n=!0;else{var o=Sh(gA);o!==null&&uL(aL,o.startTime-t),n=!1}return n}finally{wu=null,qa=r,xT=!1}}var bT=!1,yT=null,s1=-1,Mz=5,Ez=-1;function Pz(){return!(zn.unstable_now()-Eze||125i?(e.sortIndex=r,sL(gA,e),Sh(If)===null&&e===Sh(gA)&&(n1?(Tz(s1),s1=-1):n1=!0,uL(aL,r-i))):(e.sortIndex=s,sL(If,e),_0||xT||(_0=!0,cL(lL))),e};zn.unstable_shouldYield=Pz;zn.unstable_wrapCallback=function(e){var t=qa;return function(){var r=qa;qa=t;try{return e.apply(this,arguments)}finally{qa=r}}}});var Lz=Br((tbt,Cz)=>{\"use strict\";Cz.exports=Iz()});var O8=Br(Zc=>{\"use strict\";var QJ=Yi(),Hc=Lz();function Pe(e){for(var t=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+e,r=1;r\"u\"||typeof window.document>\"u\"||typeof window.document.createElement>\"u\"),RL=Object.prototype.hasOwnProperty,$J=/^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$/,kz={},Rz={};function XJ(e){return RL.call(Rz,e)?!0:RL.call(kz,e)?!1:$J.test(e)?Rz[e]=!0:(kz[e]=!0,!1)}function KJ(e,t,r,i){if(r!==null&&r.type===0)return!1;switch(typeof t){case\"function\":case\"symbol\":return!0;case\"boolean\":return i?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!==\"data-\"&&e!==\"aria-\");default:return!1}}function JJ(e,t,r,i){if(t===null||typeof t>\"u\"||KJ(e,t,r,i))return!0;if(i)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Sl(e,t,r,i,s,n,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=i,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=n,this.removeEmptyString=o}var ga={};\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(e){ga[e]=new Sl(e,0,!1,e,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(e){var t=e[0];ga[t]=new Sl(t,1,!1,e[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(e){ga[e]=new Sl(e,2,!1,e.toLowerCase(),null,!1,!1)});[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(e){ga[e]=new Sl(e,2,!1,e,null,!1,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(e){ga[e]=new Sl(e,3,!1,e.toLowerCase(),null,!1,!1)});[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(e){ga[e]=new Sl(e,3,!0,e,null,!1,!1)});[\"capture\",\"download\"].forEach(function(e){ga[e]=new Sl(e,4,!1,e,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(e){ga[e]=new Sl(e,6,!1,e,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(e){ga[e]=new Sl(e,5,!1,e.toLowerCase(),null,!1,!1)});var Tk=/[\\-:]([a-z])/g;function Mk(e){return e[1].toUpperCase()}\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(e){var t=e.replace(Tk,Mk);ga[t]=new Sl(t,1,!1,e,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(e){var t=e.replace(Tk,Mk);ga[t]=new Sl(t,1,!1,e,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(e){var t=e.replace(Tk,Mk);ga[t]=new Sl(t,1,!1,e,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(e){ga[e]=new Sl(e,1,!1,e.toLowerCase(),null,!1,!1)});ga.xlinkHref=new Sl(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(e){ga[e]=new Sl(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ek(e,t,r,i){var s=ga.hasOwnProperty(t)?ga[t]:null;(s!==null?s.type!==0:i||!(2c||s[o]!==n[c]){var f=`\n`+s[o].replace(\" at new \",\" at \");return e.displayName&&f.includes(\"\")&&(f=f.replace(\"\",e.displayName)),f}while(1<=o&&0<=c);break}}}finally{fL=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:\"\")?p1(e):\"\"}function ttt(e){switch(e.tag){case 5:return p1(e.type);case 16:return p1(\"Lazy\");case 13:return p1(\"Suspense\");case 19:return p1(\"SuspenseList\");case 0:case 2:case 15:return e=dL(e.type,!1),e;case 11:return e=dL(e.type.render,!1),e;case 1:return e=dL(e.type,!0),e;default:return\"\"}}function FL(e){if(e==null)return null;if(typeof e==\"function\")return e.displayName||e.name||null;if(typeof e==\"string\")return e;switch(e){case F_:return\"Fragment\";case B_:return\"Portal\";case DL:return\"Profiler\";case Pk:return\"StrictMode\";case OL:return\"Suspense\";case BL:return\"SuspenseList\"}if(typeof e==\"object\")switch(e.$$typeof){case U5:return(e.displayName||\"Context\")+\".Consumer\";case N5:return(e._context.displayName||\"Context\")+\".Provider\";case Ik:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||\"\",e=e!==\"\"?\"ForwardRef(\"+e+\")\":\"ForwardRef\"),e;case Ck:return t=e.displayName||null,t!==null?t:FL(e.type)||\"Memo\";case yA:t=e._payload,e=e._init;try{return FL(e(t))}catch{}}return null}function ett(e){var t=e.type;switch(e.tag){case 24:return\"Cache\";case 9:return(t.displayName||\"Context\")+\".Consumer\";case 10:return(t._context.displayName||\"Context\")+\".Provider\";case 18:return\"DehydratedFragment\";case 11:return e=t.render,e=e.displayName||e.name||\"\",t.displayName||(e!==\"\"?\"ForwardRef(\"+e+\")\":\"ForwardRef\");case 7:return\"Fragment\";case 5:return t;case 4:return\"Portal\";case 3:return\"Root\";case 6:return\"Text\";case 16:return FL(t);case 8:return t===Pk?\"StrictMode\":\"Mode\";case 22:return\"Offscreen\";case 12:return\"Profiler\";case 21:return\"Scope\";case 13:return\"Suspense\";case 19:return\"SuspenseList\";case 25:return\"TracingMarker\";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==\"function\")return t.displayName||t.name||null;if(typeof t==\"string\")return t}return null}function RA(e){switch(typeof e){case\"boolean\":case\"number\":case\"string\":case\"undefined\":return e;case\"object\":return e;default:return\"\"}}function j5(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===\"input\"&&(t===\"checkbox\"||t===\"radio\")}function rtt(e){var t=j5(e)?\"checked\":\"value\",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),i=\"\"+e[t];if(!e.hasOwnProperty(t)&&typeof r<\"u\"&&typeof r.get==\"function\"&&typeof r.set==\"function\"){var s=r.get,n=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){i=\"\"+o,n.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return i},setValue:function(o){i=\"\"+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ST(e){e._valueTracker||(e._valueTracker=rtt(e))}function G5(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),i=\"\";return e&&(i=j5(e)?e.checked?\"true\":\"false\":e.value),e=i,e!==r?(t.setValue(e),!0):!1}function KT(e){if(e=e||(typeof document<\"u\"?document:void 0),typeof e>\"u\")return null;try{return e.activeElement||e.body}catch{return e.body}}function zL(e,t){var r=t.checked;return ms({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Oz(e,t){var r=t.defaultValue==null?\"\":t.defaultValue,i=t.checked!=null?t.checked:t.defaultChecked;r=RA(t.value!=null?t.value:r),e._wrapperState={initialChecked:i,initialValue:r,controlled:t.type===\"checkbox\"||t.type===\"radio\"?t.checked!=null:t.value!=null}}function W5(e,t){t=t.checked,t!=null&&Ek(e,\"checked\",t,!1)}function NL(e,t){W5(e,t);var r=RA(t.value),i=t.type;if(r!=null)i===\"number\"?(r===0&&e.value===\"\"||e.value!=r)&&(e.value=\"\"+r):e.value!==\"\"+r&&(e.value=\"\"+r);else if(i===\"submit\"||i===\"reset\"){e.removeAttribute(\"value\");return}t.hasOwnProperty(\"value\")?UL(e,t.type,r):t.hasOwnProperty(\"defaultValue\")&&UL(e,t.type,RA(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Bz(e,t,r){if(t.hasOwnProperty(\"value\")||t.hasOwnProperty(\"defaultValue\")){var i=t.type;if(!(i!==\"submit\"&&i!==\"reset\"||t.value!==void 0&&t.value!==null))return;t=\"\"+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==\"\"&&(e.name=\"\"),e.defaultChecked=!!e._wrapperState.initialChecked,r!==\"\"&&(e.name=r)}function UL(e,t,r){(t!==\"number\"||KT(e.ownerDocument)!==e)&&(r==null?e.defaultValue=\"\"+e._wrapperState.initialValue:e.defaultValue!==\"\"+r&&(e.defaultValue=\"\"+r))}var A1=Array.isArray;function Y_(e,t,r,i){if(e=e.options,t){t={};for(var s=0;s\"+t.valueOf().toString()+\"\",t=TT.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function P1(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var _1={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},itt=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(_1).forEach(function(e){itt.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),_1[t]=_1[e]})});function Y5(e,t,r){return t==null||typeof t==\"boolean\"||t===\"\"?\"\":r||typeof t!=\"number\"||t===0||_1.hasOwnProperty(e)&&_1[e]?(\"\"+t).trim():t+\"px\"}function Q5(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var i=r.indexOf(\"--\")===0,s=Y5(r,t[r],i);r===\"float\"&&(r=\"cssFloat\"),i?e.setProperty(r,s):e[r]=s}}var ntt=ms({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function GL(e,t){if(t){if(ntt[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Pe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Pe(60));if(typeof t.dangerouslySetInnerHTML!=\"object\"||!(\"__html\"in t.dangerouslySetInnerHTML))throw Error(Pe(61))}if(t.style!=null&&typeof t.style!=\"object\")throw Error(Pe(62))}}function WL(e,t){if(e.indexOf(\"-\")===-1)return typeof t.is==\"string\";switch(e){case\"annotation-xml\":case\"color-profile\":case\"font-face\":case\"font-face-src\":case\"font-face-uri\":case\"font-face-format\":case\"font-face-name\":case\"missing-glyph\":return!1;default:return!0}}var HL=null;function Lk(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qL=null,Q_=null,$_=null;function Nz(e){if(e=q1(e)){if(typeof qL!=\"function\")throw Error(Pe(280));var t=e.stateNode;t&&(t=MM(t),qL(e.stateNode,e.type,t))}}function $5(e){Q_?$_?$_.push(e):$_=[e]:Q_=e}function X5(){if(Q_){var e=Q_,t=$_;if($_=Q_=null,Nz(e),t)for(e=0;e>>=0,e===0?32:31-(Att(e)/mtt|0)|0}var MT=64,ET=4194304;function m1(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function rM(e,t){var r=e.pendingLanes;if(r===0)return 0;var i=0,s=e.suspendedLanes,n=e.pingedLanes,o=r&268435455;if(o!==0){var c=o&~s;c!==0?i=m1(c):(n&=o,n!==0&&(i=m1(n)))}else o=r&~s,o!==0?i=m1(o):n!==0&&(i=m1(n));if(i===0)return 0;if(t!==0&&t!==i&&!(t&s)&&(s=i&-i,n=t&-t,s>=n||s===16&&(n&4194240)!==0))return t;if(i&4&&(i|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=i;0r;r++)t.push(e);return t}function W1(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ih(t),e[t]=r}function vtt(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var i=e.eventTimes;for(e=e.expirationTimes;0=v1),Yz=\" \",Qz=!1;function gN(e,t){switch(e){case\"keyup\":return Ytt.indexOf(t.keyCode)!==-1;case\"keydown\":return t.keyCode!==229;case\"keypress\":case\"mousedown\":case\"focusout\":return!0;default:return!1}}function _N(e){return e=e.detail,typeof e==\"object\"&&\"data\"in e?e.data:null}var z_=!1;function $tt(e,t){switch(e){case\"compositionend\":return _N(t);case\"keypress\":return t.which!==32?null:(Qz=!0,Yz);case\"textInput\":return e=t.data,e===Yz&&Qz?null:e;default:return null}}function Xtt(e,t){if(z_)return e===\"compositionend\"||!Nk&&gN(e,t)?(e=AN(),GT=Bk=wA=null,z_=!1,e):null;switch(e){case\"paste\":return null;case\"keypress\":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=i}t:{for(;r;){if(r.nextSibling){r=r.nextSibling;break t}r=r.parentNode}r=void 0}r=Kz(r)}}function bN(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?bN(e,t.parentNode):\"contains\"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wN(){for(var e=window,t=KT();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href==\"string\"}catch{r=!1}if(r)e=t.contentWindow;else break;t=KT(e.document)}return t}function Uk(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===\"input\"&&(e.type===\"text\"||e.type===\"search\"||e.type===\"tel\"||e.type===\"url\"||e.type===\"password\")||t===\"textarea\"||e.contentEditable===\"true\")}function oet(e){var t=wN(),r=e.focusedElem,i=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&bN(r.ownerDocument.documentElement,r)){if(i!==null&&Uk(r)){if(t=i.start,e=i.end,e===void 0&&(e=t),\"selectionStart\"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=r.textContent.length,n=Math.min(i.start,s);i=i.end===void 0?n:Math.min(i.end,s),!e.extend&&n>i&&(s=i,i=n,n=s),s=Jz(r,n);var o=Jz(r,i);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),n>i?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus==\"function\"&&r.focus(),r=0;r=document.documentMode,N_=null,KL=null,b1=null,JL=!1;function t5(e,t,r){var i=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;JL||N_==null||N_!==KT(i)||(i=N_,\"selectionStart\"in i&&Uk(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),b1&&D1(b1,i)||(b1=i,i=sM(KL,\"onSelect\"),0j_||(e.current=sk[j_],sk[j_]=null,j_--)}function Nn(e,t){j_++,sk[j_]=e.current,e.current=t}var DA={},$a=BA(DA),Kl=BA(!1),M0=DA;function ey(e,t){var r=e.type.contextTypes;if(!r)return DA;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===t)return i.__reactInternalMemoizedMaskedChildContext;var s={},n;for(n in r)s[n]=t[n];return i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Jl(e){return e=e.childContextTypes,e!=null}function aM(){Zn(Kl),Zn($a)}function c5(e,t,r){if($a.current!==DA)throw Error(Pe(168));Nn($a,t),Nn(Kl,r)}function kN(e,t,r){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=\"function\")return r;i=i.getChildContext();for(var s in i)if(!(s in t))throw Error(Pe(108,ett(e)||\"Unknown\",s));return ms({},r,i)}function lM(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||DA,M0=$a.current,Nn($a,e),Nn(Kl,Kl.current),!0}function u5(e,t,r){var i=e.stateNode;if(!i)throw Error(Pe(169));r?(e=kN(e,t,M0),i.__reactInternalMemoizedMergedChildContext=e,Zn(Kl),Zn($a),Nn($a,e)):Zn(Kl),Nn(Kl,r)}var Wd=null,EM=!1,SL=!1;function RN(e){Wd===null?Wd=[e]:Wd.push(e)}function get(e){EM=!0,RN(e)}function FA(){if(!SL&&Wd!==null){SL=!0;var e=0,t=vn;try{var r=Wd;for(vn=1;e>=o,s-=o,Hd=1<<32-Ih(t)+s|r<qt?(le=Xt,Xt=null):le=Xt.sibling;var ue=R(Y,Xt,J[qt],ut);if(ue===null){Xt===null&&(Xt=le);break}e&&Xt&&ue.alternate===null&&t(Y,Xt),K=n(ue,K,qt),kt===null?Et=ue:kt.sibling=ue,kt=ue,Xt=le}if(qt===J.length)return r(Y,Xt),ns&&y0(Y,qt),Et;if(Xt===null){for(;qtqt?(le=Xt,Xt=null):le=Xt.sibling;var De=R(Y,Xt,ue.value,ut);if(De===null){Xt===null&&(Xt=le);break}e&&Xt&&De.alternate===null&&t(Y,Xt),K=n(De,K,qt),kt===null?Et=De:kt.sibling=De,kt=De,Xt=le}if(ue.done)return r(Y,Xt),ns&&y0(Y,qt),Et;if(Xt===null){for(;!ue.done;qt++,ue=J.next())ue=I(Y,ue.value,ut),ue!==null&&(K=n(ue,K,qt),kt===null?Et=ue:kt.sibling=ue,kt=ue);return ns&&y0(Y,qt),Et}for(Xt=i(Y,Xt);!ue.done;qt++,ue=J.next())ue=N(Xt,Y,qt,ue.value,ut),ue!==null&&(e&&ue.alternate!==null&&Xt.delete(ue.key===null?qt:ue.key),K=n(ue,K,qt),kt===null?Et=ue:kt.sibling=ue,kt=ue);return e&&Xt.forEach(function(Ke){return t(Y,Ke)}),ns&&y0(Y,qt),Et}function et(Y,K,J,ut){if(typeof J==\"object\"&&J!==null&&J.type===F_&&J.key===null&&(J=J.props.children),typeof J==\"object\"&&J!==null){switch(J.$$typeof){case wT:t:{for(var Et=J.key,kt=K;kt!==null;){if(kt.key===Et){if(Et=J.type,Et===F_){if(kt.tag===7){r(Y,kt.sibling),K=s(kt,J.props.children),K.return=Y,Y=K;break t}}else if(kt.elementType===Et||typeof Et==\"object\"&&Et!==null&&Et.$$typeof===yA&&d5(Et)===kt.type){r(Y,kt.sibling),K=s(kt,J.props),K.ref=u1(Y,kt,J),K.return=Y,Y=K;break t}r(Y,kt);break}else t(Y,kt);kt=kt.sibling}J.type===F_?(K=T0(J.props.children,Y.mode,ut,J.key),K.return=Y,Y=K):(ut=XT(J.type,J.key,J.props,null,Y.mode,ut),ut.ref=u1(Y,K,J),ut.return=Y,Y=ut)}return o(Y);case B_:t:{for(kt=J.key;K!==null;){if(K.key===kt)if(K.tag===4&&K.stateNode.containerInfo===J.containerInfo&&K.stateNode.implementation===J.implementation){r(Y,K.sibling),K=s(K,J.children||[]),K.return=Y,Y=K;break t}else{r(Y,K);break}else t(Y,K);K=K.sibling}K=kL(J,Y.mode,ut),K.return=Y,Y=K}return o(Y);case yA:return kt=J._init,et(Y,K,kt(J._payload),ut)}if(A1(J))return j(Y,K,J,ut);if(o1(J))return Q(Y,K,J,ut);zT(Y,J)}return typeof J==\"string\"&&J!==\"\"||typeof J==\"number\"?(J=\"\"+J,K!==null&&K.tag===6?(r(Y,K.sibling),K=s(K,J),K.return=Y,Y=K):(r(Y,K),K=LL(J,Y.mode,ut),K.return=Y,Y=K),o(Y)):r(Y,K)}return et}var iy=FN(!0),zN=FN(!1),hM=BA(null),fM=null,H_=null,Wk=null;function Hk(){Wk=H_=fM=null}function qk(e){var t=hM.current;Zn(hM),e._currentValue=t}function lk(e,t,r){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===r)break;e=e.return}}function K_(e,t){fM=e,Wk=H_=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Xl=!0),e.firstContext=null)}function Pu(e){var t=e._currentValue;if(Wk!==e)if(e={context:e,memoizedValue:t,next:null},H_===null){if(fM===null)throw Error(Pe(308));H_=e,fM.dependencies={lanes:0,firstContext:e}}else H_=H_.next=e;return t}var b0=null;function Zk(e){b0===null?b0=[e]:b0.push(e)}function NN(e,t,r,i){var s=t.interleaved;return s===null?(r.next=r,Zk(t)):(r.next=s.next,s.next=r),t.interleaved=r,$d(e,i)}function $d(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var vA=!1;function Yk(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function UN(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Zd(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function IA(e,t,r){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,Zi&2){var s=i.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),i.pending=t,$d(e,r)}return s=i.interleaved,s===null?(t.next=t,Zk(i)):(t.next=s.next,s.next=t),i.interleaved=t,$d(e,r)}function HT(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,Rk(e,r)}}function p5(e,t){var r=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,r===i)){var s=null,n=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};n===null?s=n=o:n=n.next=o,r=r.next}while(r!==null);n===null?s=n=t:n=n.next=t}else s=n=t;r={baseState:i.baseState,firstBaseUpdate:s,lastBaseUpdate:n,shared:i.shared,effects:i.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function dM(e,t,r,i){var s=e.updateQueue;vA=!1;var n=s.firstBaseUpdate,o=s.lastBaseUpdate,c=s.shared.pending;if(c!==null){s.shared.pending=null;var f=c,_=f.next;f.next=null,o===null?n=_:o.next=_,o=f;var w=e.alternate;w!==null&&(w=w.updateQueue,c=w.lastBaseUpdate,c!==o&&(c===null?w.firstBaseUpdate=_:c.next=_,w.lastBaseUpdate=f))}if(n!==null){var I=s.baseState;o=0,w=_=f=null,c=n;do{var R=c.lane,N=c.eventTime;if((i&R)===R){w!==null&&(w=w.next={eventTime:N,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});t:{var j=e,Q=c;switch(R=t,N=r,Q.tag){case 1:if(j=Q.payload,typeof j==\"function\"){I=j.call(N,I,R);break t}I=j;break t;case 3:j.flags=j.flags&-65537|128;case 0:if(j=Q.payload,R=typeof j==\"function\"?j.call(N,I,R):j,R==null)break t;I=ms({},I,R);break t;case 2:vA=!0}}c.callback!==null&&c.lane!==0&&(e.flags|=64,R=s.effects,R===null?s.effects=[c]:R.push(c))}else N={eventTime:N,lane:R,tag:c.tag,payload:c.payload,callback:c.callback,next:null},w===null?(_=w=N,f=I):w=w.next=N,o|=R;if(c=c.next,c===null){if(c=s.shared.pending,c===null)break;R=c,c=R.next,R.next=null,s.lastBaseUpdate=R,s.shared.pending=null}}while(!0);if(w===null&&(f=I),s.baseState=f,s.firstBaseUpdate=_,s.lastBaseUpdate=w,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else n===null&&(s.shared.lanes=0);I0|=o,e.lanes=o,e.memoizedState=I}}function A5(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var i=ML.transition;ML.transition={};try{e(!1),t()}finally{vn=r,ML.transition=i}}function i8(){return Iu().memoizedState}function xet(e,t,r){var i=LA(e);if(r={lane:i,action:r,hasEagerState:!1,eagerState:null,next:null},n8(e))s8(t,r);else if(r=NN(e,t,r,i),r!==null){var s=wl();Ch(r,e,i,s),o8(r,t,i)}}function bet(e,t,r){var i=LA(e),s={lane:i,action:r,hasEagerState:!1,eagerState:null,next:null};if(n8(e))s8(t,s);else{var n=e.alternate;if(e.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var o=t.lastRenderedState,c=n(o,r);if(s.hasEagerState=!0,s.eagerState=c,Lh(c,o)){var f=t.interleaved;f===null?(s.next=s,Zk(t)):(s.next=f.next,f.next=s),t.interleaved=s;return}}catch{}finally{}r=NN(e,t,s,i),r!==null&&(s=wl(),Ch(r,e,i,s),o8(r,t,i))}}function n8(e){var t=e.alternate;return e===As||t!==null&&t===As}function s8(e,t){w1=AM=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function o8(e,t,r){if(r&4194240){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,Rk(e,r)}}var mM={readContext:Pu,useCallback:Za,useContext:Za,useEffect:Za,useImperativeHandle:Za,useInsertionEffect:Za,useLayoutEffect:Za,useMemo:Za,useReducer:Za,useRef:Za,useState:Za,useDebugValue:Za,useDeferredValue:Za,useTransition:Za,useMutableSource:Za,useSyncExternalStore:Za,useId:Za,unstable_isNewReconciler:!1},wet={readContext:Pu,useCallback:function(e,t){return Lf().memoizedState=[e,t===void 0?null:t],e},useContext:Pu,useEffect:g5,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,ZT(4194308,4,KN.bind(null,t,e),r)},useLayoutEffect:function(e,t){return ZT(4194308,4,e,t)},useInsertionEffect:function(e,t){return ZT(4,2,e,t)},useMemo:function(e,t){var r=Lf();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var i=Lf();return t=r!==void 0?r(t):t,i.memoizedState=i.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},i.queue=e,e=e.dispatch=xet.bind(null,As,e),[i.memoizedState,e]},useRef:function(e){var t=Lf();return e={current:e},t.memoizedState=e},useState:m5,useDebugValue:r4,useDeferredValue:function(e){return Lf().memoizedState=e},useTransition:function(){var e=m5(!1),t=e[0];return e=vet.bind(null,e[1]),Lf().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var i=As,s=Lf();if(ns){if(r===void 0)throw Error(Pe(407));r=r()}else{if(r=t(),Jo===null)throw Error(Pe(349));P0&30||WN(i,t,r)}s.memoizedState=r;var n={value:r,getSnapshot:t};return s.queue=n,g5(qN.bind(null,i,n,e),[e]),i.flags|=2048,j1(9,HN.bind(null,i,n,r,t),void 0,null),r},useId:function(){var e=Lf(),t=Jo.identifierPrefix;if(ns){var r=qd,i=Hd;r=(i&~(1<<32-Ih(i)-1)).toString(32)+r,t=\":\"+t+\"R\"+r,r=U1++,0<\\/script>\",e=e.removeChild(e.firstChild)):typeof i.is==\"string\"?e=o.createElement(r,{is:i.is}):(e=o.createElement(r),r===\"select\"&&(o=e,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):e=o.createElementNS(e,r),e[kf]=t,e[F1]=i,m8(e,t,!1,!1),t.stateNode=e;t:{switch(o=WL(r,i),r){case\"dialog\":qn(\"cancel\",e),qn(\"close\",e),s=i;break;case\"iframe\":case\"object\":case\"embed\":qn(\"load\",e),s=i;break;case\"video\":case\"audio\":for(s=0;soy&&(t.flags|=128,i=!0,h1(n,!1),t.lanes=4194304)}else{if(!i)if(e=pM(o),e!==null){if(t.flags|=128,i=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),h1(n,!0),n.tail===null&&n.tailMode===\"hidden\"&&!o.alternate&&!ns)return Ya(t),null}else 2*Xs()-n.renderingStartTime>oy&&r!==1073741824&&(t.flags|=128,i=!0,h1(n,!1),t.lanes=4194304);n.isBackwards?(o.sibling=t.child,t.child=o):(r=n.last,r!==null?r.sibling=o:t.child=o,n.last=o)}return n.tail!==null?(t=n.tail,n.rendering=t,n.tail=t.sibling,n.renderingStartTime=Xs(),t.sibling=null,r=ps.current,Nn(ps,i?r&1|2:r&1),t):(Ya(t),null);case 22:case 23:return l4(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?jc&1073741824&&(Ya(t),t.subtreeFlags&6&&(t.flags|=8192)):Ya(t),null;case 24:return null;case 25:return null}throw Error(Pe(156,t.tag))}function ket(e,t){switch(jk(t),t.tag){case 1:return Jl(t.type)&&aM(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ny(),Zn(Kl),Zn($a),Xk(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return $k(t),null;case 13:if(Zn(ps),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Pe(340));ry()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Zn(ps),null;case 4:return ny(),null;case 10:return qk(t.type._context),null;case 22:case 23:return l4(),null;case 24:return null;default:return null}}var UT=!1,Qa=!1,Ret=typeof WeakSet==\"function\"?WeakSet:Set,ur=null;function q_(e,t){var r=e.ref;if(r!==null)if(typeof r==\"function\")try{r(null)}catch(i){Cs(e,t,i)}else r.current=null}function gk(e,t,r){try{r()}catch(i){Cs(e,t,i)}}var P5=!1;function Det(e,t){if(tk=iM,e=wN(),Uk(e)){if(\"selectionStart\"in e)var r={start:e.selectionStart,end:e.selectionEnd};else t:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var s=i.anchorOffset,n=i.focusNode;i=i.focusOffset;try{r.nodeType,n.nodeType}catch{r=null;break t}var o=0,c=-1,f=-1,_=0,w=0,I=e,R=null;e:for(;;){for(var N;I!==r||s!==0&&I.nodeType!==3||(c=o+s),I!==n||i!==0&&I.nodeType!==3||(f=o+i),I.nodeType===3&&(o+=I.nodeValue.length),(N=I.firstChild)!==null;)R=I,I=N;for(;;){if(I===e)break e;if(R===r&&++_===s&&(c=o),R===n&&++w===i&&(f=o),(N=I.nextSibling)!==null)break;I=R,R=I.parentNode}I=N}r=c===-1||f===-1?null:{start:c,end:f}}else r=null}r=r||{start:0,end:0}}else r=null;for(ek={focusedElem:e,selectionRange:r},iM=!1,ur=t;ur!==null;)if(t=ur,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ur=e;else for(;ur!==null;){t=ur;try{var j=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(j!==null){var Q=j.memoizedProps,et=j.memoizedState,Y=t.stateNode,K=Y.getSnapshotBeforeUpdate(t.elementType===t.type?Q:Mh(t.type,Q),et);Y.__reactInternalSnapshotBeforeUpdate=K}break;case 3:var J=t.stateNode.containerInfo;J.nodeType===1?J.textContent=\"\":J.nodeType===9&&J.documentElement&&J.removeChild(J.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Pe(163))}}catch(ut){Cs(t,t.return,ut)}if(e=t.sibling,e!==null){e.return=t.return,ur=e;break}ur=t.return}return j=P5,P5=!1,j}function S1(e,t,r){var i=t.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var s=i=i.next;do{if((s.tag&e)===e){var n=s.destroy;s.destroy=void 0,n!==void 0&&gk(t,r,n)}s=s.next}while(s!==i)}}function CM(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var i=r.create;r.destroy=i()}r=r.next}while(r!==t)}}function _k(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t==\"function\"?t(e):t.current=e}}function y8(e){var t=e.alternate;t!==null&&(e.alternate=null,y8(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[kf],delete t[F1],delete t[nk],delete t[Aet],delete t[met])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function v8(e){return e.tag===5||e.tag===3||e.tag===4}function I5(e){t:for(;;){for(;e.sibling===null;){if(e.return===null||v8(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue t;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function yk(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=oM));else if(i!==4&&(e=e.child,e!==null))for(yk(e,t,r),e=e.sibling;e!==null;)yk(e,t,r),e=e.sibling}function vk(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(i!==4&&(e=e.child,e!==null))for(vk(e,t,r),e=e.sibling;e!==null;)vk(e,t,r),e=e.sibling}var Aa=null,Eh=!1;function _A(e,t,r){for(r=r.child;r!==null;)x8(e,t,r),r=r.sibling}function x8(e,t,r){if(Rf&&typeof Rf.onCommitFiberUnmount==\"function\")try{Rf.onCommitFiberUnmount(bM,r)}catch{}switch(r.tag){case 5:Qa||q_(r,t);case 6:var i=Aa,s=Eh;Aa=null,_A(e,t,r),Aa=i,Eh=s,Aa!==null&&(Eh?(e=Aa,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Aa.removeChild(r.stateNode));break;case 18:Aa!==null&&(Eh?(e=Aa,r=r.stateNode,e.nodeType===8?wL(e.parentNode,r):e.nodeType===1&&wL(e,r),k1(e)):wL(Aa,r.stateNode));break;case 4:i=Aa,s=Eh,Aa=r.stateNode.containerInfo,Eh=!0,_A(e,t,r),Aa=i,Eh=s;break;case 0:case 11:case 14:case 15:if(!Qa&&(i=r.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){s=i=i.next;do{var n=s,o=n.destroy;n=n.tag,o!==void 0&&(n&2||n&4)&&gk(r,t,o),s=s.next}while(s!==i)}_A(e,t,r);break;case 1:if(!Qa&&(q_(r,t),i=r.stateNode,typeof i.componentWillUnmount==\"function\"))try{i.props=r.memoizedProps,i.state=r.memoizedState,i.componentWillUnmount()}catch(c){Cs(r,t,c)}_A(e,t,r);break;case 21:_A(e,t,r);break;case 22:r.mode&1?(Qa=(i=Qa)||r.memoizedState!==null,_A(e,t,r),Qa=i):_A(e,t,r);break;default:_A(e,t,r)}}function C5(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Ret),t.forEach(function(i){var s=Get.bind(null,e,i);r.has(i)||(r.add(i),i.then(s,s))})}}function Th(e,t){var r=t.deletions;if(r!==null)for(var i=0;is&&(s=o),i&=~n}if(i=s,i=Xs()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Bet(i/1960))-i,10e?16:e,SA===null)var i=!1;else{if(e=SA,SA=null,yM=0,Zi&6)throw Error(Pe(331));var s=Zi;for(Zi|=4,ur=e.current;ur!==null;){var n=ur,o=n.child;if(ur.flags&16){var c=n.deletions;if(c!==null){for(var f=0;fXs()-o4?S0(e,0):s4|=r),tc(e,t)}function I8(e,t){t===0&&(e.mode&1?(t=ET,ET<<=1,!(ET&130023424)&&(ET=4194304)):t=1);var r=wl();e=$d(e,t),e!==null&&(W1(e,t,r),tc(e,r))}function jet(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),I8(e,r)}function Get(e,t){var r=0;switch(e.tag){case 13:var i=e.stateNode,s=e.memoizedState;s!==null&&(r=s.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(Pe(314))}i!==null&&i.delete(t),I8(e,r)}var C8;C8=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Kl.current)Xl=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Xl=!1,Cet(e,t,r);Xl=!!(e.flags&131072)}else Xl=!1,ns&&t.flags&1048576&&DN(t,uM,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;YT(e,t),e=t.pendingProps;var s=ey(t,$a.current);K_(t,r),s=Jk(null,t,i,e,s,r);var n=t4();return t.flags|=1,typeof s==\"object\"&&s!==null&&typeof s.render==\"function\"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Jl(i)?(n=!0,lM(t)):n=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Yk(t),s.updater=IM,t.stateNode=s,s._reactInternals=t,uk(t,i,e,r),t=dk(null,t,i,!0,n,r)):(t.tag=0,ns&&n&&Vk(t),bl(null,t,s,r),t=t.child),t;case 16:i=t.elementType;t:{switch(YT(e,t),e=t.pendingProps,s=i._init,i=s(i._payload),t.type=i,s=t.tag=Het(i),e=Mh(i,e),s){case 0:t=fk(null,t,i,e,r);break t;case 1:t=T5(null,t,i,e,r);break t;case 11:t=w5(null,t,i,e,r);break t;case 14:t=S5(null,t,i,Mh(i.type,e),r);break t}throw Error(Pe(306,i,\"\"))}return t;case 0:return i=t.type,s=t.pendingProps,s=t.elementType===i?s:Mh(i,s),fk(e,t,i,s,r);case 1:return i=t.type,s=t.pendingProps,s=t.elementType===i?s:Mh(i,s),T5(e,t,i,s,r);case 3:t:{if(d8(t),e===null)throw Error(Pe(387));i=t.pendingProps,n=t.memoizedState,s=n.element,UN(e,t),dM(t,i,null,r);var o=t.memoizedState;if(i=o.element,n.isDehydrated)if(n={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=n,t.memoizedState=n,t.flags&256){s=sy(Error(Pe(423)),t),t=M5(e,t,i,r,s);break t}else if(i!==s){s=sy(Error(Pe(424)),t),t=M5(e,t,i,r,s);break t}else for(Gc=PA(t.stateNode.containerInfo.firstChild),Wc=t,ns=!0,Ph=null,r=zN(t,null,i,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(ry(),i===s){t=Xd(e,t,r);break t}bl(e,t,i,r)}t=t.child}return t;case 5:return VN(t),e===null&&ak(t),i=t.type,s=t.pendingProps,n=e!==null?e.memoizedProps:null,o=s.children,rk(i,s)?o=null:n!==null&&rk(i,n)&&(t.flags|=32),f8(e,t),bl(e,t,o,r),t.child;case 6:return e===null&&ak(t),null;case 13:return p8(e,t,r);case 4:return Qk(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=iy(t,null,i,r):bl(e,t,i,r),t.child;case 11:return i=t.type,s=t.pendingProps,s=t.elementType===i?s:Mh(i,s),w5(e,t,i,s,r);case 7:return bl(e,t,t.pendingProps,r),t.child;case 8:return bl(e,t,t.pendingProps.children,r),t.child;case 12:return bl(e,t,t.pendingProps.children,r),t.child;case 10:t:{if(i=t.type._context,s=t.pendingProps,n=t.memoizedProps,o=s.value,Nn(hM,i._currentValue),i._currentValue=o,n!==null)if(Lh(n.value,o)){if(n.children===s.children&&!Kl.current){t=Xd(e,t,r);break t}}else for(n=t.child,n!==null&&(n.return=t);n!==null;){var c=n.dependencies;if(c!==null){o=n.child;for(var f=c.firstContext;f!==null;){if(f.context===i){if(n.tag===1){f=Zd(-1,r&-r),f.tag=2;var _=n.updateQueue;if(_!==null){_=_.shared;var w=_.pending;w===null?f.next=f:(f.next=w.next,w.next=f),_.pending=f}}n.lanes|=r,f=n.alternate,f!==null&&(f.lanes|=r),lk(n.return,r,t),c.lanes|=r;break}f=f.next}}else if(n.tag===10)o=n.type===t.type?null:n.child;else if(n.tag===18){if(o=n.return,o===null)throw Error(Pe(341));o.lanes|=r,c=o.alternate,c!==null&&(c.lanes|=r),lk(o,r,t),o=n.sibling}else o=n.child;if(o!==null)o.return=n;else for(o=n;o!==null;){if(o===t){o=null;break}if(n=o.sibling,n!==null){n.return=o.return,o=n;break}o=o.return}n=o}bl(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,i=t.pendingProps.children,K_(t,r),s=Pu(s),i=i(s),t.flags|=1,bl(e,t,i,r),t.child;case 14:return i=t.type,s=Mh(i,t.pendingProps),s=Mh(i.type,s),S5(e,t,i,s,r);case 15:return u8(e,t,t.type,t.pendingProps,r);case 17:return i=t.type,s=t.pendingProps,s=t.elementType===i?s:Mh(i,s),YT(e,t),t.tag=1,Jl(i)?(e=!0,lM(t)):e=!1,K_(t,r),a8(t,i,s),uk(t,i,s,r),dk(null,t,i,!0,e,r);case 19:return A8(e,t,r);case 22:return h8(e,t,r)}throw Error(Pe(156,t.tag))};function L8(e,t){return nN(e,t)}function Wet(e,t,r,i){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mu(e,t,r,i){return new Wet(e,t,r,i)}function u4(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Het(e){if(typeof e==\"function\")return u4(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ik)return 11;if(e===Ck)return 14}return 2}function kA(e,t){var r=e.alternate;return r===null?(r=Mu(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function XT(e,t,r,i,s,n){var o=2;if(i=e,typeof e==\"function\")u4(e)&&(o=1);else if(typeof e==\"string\")o=5;else t:switch(e){case F_:return T0(r.children,s,n,t);case Pk:o=8,s|=8;break;case DL:return e=Mu(12,r,t,s|2),e.elementType=DL,e.lanes=n,e;case OL:return e=Mu(13,r,t,s),e.elementType=OL,e.lanes=n,e;case BL:return e=Mu(19,r,t,s),e.elementType=BL,e.lanes=n,e;case V5:return kM(r,s,n,t);default:if(typeof e==\"object\"&&e!==null)switch(e.$$typeof){case N5:o=10;break t;case U5:o=9;break t;case Ik:o=11;break t;case Ck:o=14;break t;case yA:o=16,i=null;break t}throw Error(Pe(130,e==null?e:typeof e,\"\"))}return t=Mu(o,r,t,s),t.elementType=e,t.type=i,t.lanes=n,t}function T0(e,t,r,i){return e=Mu(7,e,i,t),e.lanes=r,e}function kM(e,t,r,i){return e=Mu(22,e,i,t),e.elementType=V5,e.lanes=r,e.stateNode={isHidden:!1},e}function LL(e,t,r){return e=Mu(6,e,null,t),e.lanes=r,e}function kL(e,t,r){return t=Mu(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function qet(e,t,r,i,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=AL(0),this.expirationTimes=AL(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=AL(0),this.identifierPrefix=i,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function h4(e,t,r,i,s,n,o,c,f){return e=new qet(e,t,r,c,f),t===1?(t=1,n===!0&&(t|=8)):t=0,n=Mu(3,null,null,t),e.current=n,n.stateNode=e,n.memoizedState={element:i,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yk(n),e}function Zet(e,t,r){var i=3{\"use strict\";function B8(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>\"u\"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=\"function\"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(B8)}catch(e){console.error(e)}}B8(),F8.exports=O8()});var N8=Br(A4=>{\"use strict\";var z8=FM();A4.createRoot=z8.createRoot,A4.hydrateRoot=z8.hydrateRoot;var ibt});var eU=Br((T4,M4)=>{(function(e,t){typeof T4==\"object\"&&typeof M4<\"u\"?M4.exports=t():(e=typeof globalThis<\"u\"?globalThis:e||self,e.maplibregl=t())})(T4,function(){\"use strict\";var e,t,r;function i(n,o){if(!e)e=o;else if(!t)t=o;else{var c=\"var sharedChunk = {}; (\"+e+\")(sharedChunk); (\"+t+\")(sharedChunk);\",f={};e(f),r=o(f),typeof window<\"u\"&&(r.workerUrl=window.URL.createObjectURL(new Blob([c],{type:\"text/javascript\"})))}}i([\"exports\"],function(n){\"use strict\";function o(u,a,h,A){return new(h||(h=Promise))(function(x,E){function P(V){try{F(A.next(V))}catch(q){E(q)}}function D(V){try{F(A.throw(V))}catch(q){E(q)}}function F(V){var q;V.done?x(V.value):(q=V.value,q instanceof h?q:new h(function(X){X(q)})).then(P,D)}F((A=A.apply(u,a||[])).next())})}function c(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,\"default\")?u.default:u}typeof SuppressedError==\"function\"&&SuppressedError;var f=_;function _(u,a){this.x=u,this.y=a}_.prototype={clone:function(){return new _(this.x,this.y)},add:function(u){return this.clone()._add(u)},sub:function(u){return this.clone()._sub(u)},multByPoint:function(u){return this.clone()._multByPoint(u)},divByPoint:function(u){return this.clone()._divByPoint(u)},mult:function(u){return this.clone()._mult(u)},div:function(u){return this.clone()._div(u)},rotate:function(u){return this.clone()._rotate(u)},rotateAround:function(u,a){return this.clone()._rotateAround(u,a)},matMult:function(u){return this.clone()._matMult(u)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(u){return this.x===u.x&&this.y===u.y},dist:function(u){return Math.sqrt(this.distSqr(u))},distSqr:function(u){var a=u.x-this.x,h=u.y-this.y;return a*a+h*h},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(u){return Math.atan2(this.y-u.y,this.x-u.x)},angleWith:function(u){return this.angleWithSep(u.x,u.y)},angleWithSep:function(u,a){return Math.atan2(this.x*a-this.y*u,this.x*u+this.y*a)},_matMult:function(u){var a=u[2]*this.x+u[3]*this.y;return this.x=u[0]*this.x+u[1]*this.y,this.y=a,this},_add:function(u){return this.x+=u.x,this.y+=u.y,this},_sub:function(u){return this.x-=u.x,this.y-=u.y,this},_mult:function(u){return this.x*=u,this.y*=u,this},_div:function(u){return this.x/=u,this.y/=u,this},_multByPoint:function(u){return this.x*=u.x,this.y*=u.y,this},_divByPoint:function(u){return this.x/=u.x,this.y/=u.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var u=this.y;return this.y=this.x,this.x=-u,this},_rotate:function(u){var a=Math.cos(u),h=Math.sin(u),A=h*this.x+a*this.y;return this.x=a*this.x-h*this.y,this.y=A,this},_rotateAround:function(u,a){var h=Math.cos(u),A=Math.sin(u),x=a.y+A*(this.x-a.x)+h*(this.y-a.y);return this.x=a.x+h*(this.x-a.x)-A*(this.y-a.y),this.y=x,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},_.convert=function(u){return u instanceof _?u:Array.isArray(u)?new _(u[0],u[1]):u};var w=c(f),I=R;function R(u,a,h,A){this.cx=3*u,this.bx=3*(h-u)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*a,this.by=3*(A-a)-this.cy,this.ay=1-this.cy-this.by,this.p1x=u,this.p1y=a,this.p2x=h,this.p2y=A}R.prototype={sampleCurveX:function(u){return((this.ax*u+this.bx)*u+this.cx)*u},sampleCurveY:function(u){return((this.ay*u+this.by)*u+this.cy)*u},sampleCurveDerivativeX:function(u){return(3*this.ax*u+2*this.bx)*u+this.cx},solveCurveX:function(u,a){if(a===void 0&&(a=1e-6),u<0)return 0;if(u>1)return 1;for(var h=u,A=0;A<8;A++){var x=this.sampleCurveX(h)-u;if(Math.abs(x)x?P=h:D=h,h=.5*(D-P)+P;return h},solve:function(u,a){return this.sampleCurveY(this.solveCurveX(u,a))}};var N=c(I);let j,Q;function et(){return j==null&&(j=typeof OffscreenCanvas<\"u\"&&new OffscreenCanvas(1,1).getContext(\"2d\")&&typeof createImageBitmap==\"function\"),j}function Y(){if(Q==null&&(Q=!1,et())){let a=new OffscreenCanvas(5,5).getContext(\"2d\",{willReadFrequently:!0});if(a){for(let A=0;A<5*5;A++){let x=4*A;a.fillStyle=`rgb(${x},${x+1},${x+2})`,a.fillRect(A%5,Math.floor(A/5),1,1)}let h=a.getImageData(0,0,5,5).data;for(let A=0;A<5*5*4;A++)if(A%4!=3&&h[A]!==A){Q=!0;break}}}return Q||!1}function K(u,a,h,A){let x=new N(u,a,h,A);return function(E){return x.solve(E)}}let J=K(.25,.1,.25,1);function ut(u,a,h){return Math.min(h,Math.max(a,u))}function Et(u,a,h){let A=h-a,x=((u-a)%A+A)%A+a;return x===a?h:x}function kt(u,...a){for(let h of a)for(let A in h)u[A]=h[A];return u}let Xt=1;function qt(u,a,h){let A={};for(let x in u)A[x]=a.call(h||this,u[x],x,u);return A}function le(u,a,h){let A={};for(let x in u)a.call(h||this,u[x],x,u)&&(A[x]=u[x]);return A}function ue(u){return Array.isArray(u)?u.map(ue):typeof u==\"object\"&&u?qt(u,ue):u}let De={};function Ke(u){De[u]||(typeof console<\"u\"&&console.warn(u),De[u]=!0)}function rr(u,a,h){return(h.y-u.y)*(a.x-u.x)>(a.y-u.y)*(h.x-u.x)}function Sr(u){let a=0;for(let h,A,x=0,E=u.length,P=E-1;x\"u\")throw new Error(\"VideoFrame not supported\");let E=new VideoFrame(u,{timestamp:0});try{let P=E?.format;if(!P||!P.startsWith(\"BGR\")&&!P.startsWith(\"RGB\"))throw new Error(`Unrecognized format ${P}`);let D=P.startsWith(\"BGR\"),F=new Uint8ClampedArray(A*x*4);if(yield E.copyTo(F,function(V,q,X,rt,at){let ct=4*Math.max(-q,0),mt=(Math.max(0,X)-X)*rt*4+ct,bt=4*rt,Pt=Math.max(0,q),jt=Math.max(0,X);return{rect:{x:Pt,y:jt,width:Math.min(V.width,q+rt)-Pt,height:Math.min(V.height,X+at)-jt},layout:[{offset:mt,stride:bt}]}}(u,a,h,A,x)),D)for(let V=0;VcancelAnimationFrame(a)}},getImageData(u,a=0){return this.getImageCanvasContext(u).getImageData(-a,-a,u.width+2*a,u.height+2*a)},getImageCanvasContext(u){let a=window.document.createElement(\"canvas\"),h=a.getContext(\"2d\",{willReadFrequently:!0});if(!h)throw new Error(\"failed to create canvas 2d context\");return a.width=u.width,a.height=u.height,h.drawImage(u,0,0,u.width,u.height),h},resolveURL:u=>(Ns||(Ns=document.createElement(\"a\")),Ns.href=u,Ns.href),hardwareConcurrency:typeof navigator<\"u\"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(ll==null&&(ll=matchMedia(\"(prefers-reduced-motion: reduce)\")),ll.matches)}},Rc={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:\"\"};class Xi extends Error{constructor(a,h,A,x){super(`AJAXError: ${h} (${a}): ${A}`),this.status=a,this.statusText=h,this.url=A,this.body=x}}let Jn=Li()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol===\"blob:\"?window.parent:window).location.href,ki=u=>Rc.REGISTERED_PROTOCOLS[u.substring(0,u.indexOf(\"://\"))];function ts(u,a){let h=new AbortController,A=new Request(u.url,{method:u.method||\"GET\",body:u.body,credentials:u.credentials,headers:u.headers,cache:u.cache,referrer:Jn(),signal:h.signal}),x=!1,E=!1;return u.type===\"json\"&&A.headers.set(\"Accept\",\"application/json\"),E||fetch(A).then(P=>P.ok?(D=>{(u.type===\"arrayBuffer\"||u.type===\"image\"?D.arrayBuffer():u.type===\"json\"?D.json():D.text()).then(F=>{E||(x=!0,a(null,F,D.headers.get(\"Cache-Control\"),D.headers.get(\"Expires\")))}).catch(F=>{E||a(new Error(F.message))})})(P):P.blob().then(D=>a(new Xi(P.status,P.statusText,u.url,D)))).catch(P=>{P.code!==20&&a(new Error(P.message))}),{cancel:()=>{E=!0,x||h.abort()}}}let Vo=function(u,a){if(/:\\/\\//.test(u.url)&&!/^https?:|^file:/.test(u.url)){if(Li()&&self.worker&&self.worker.actor)return self.worker.actor.send(\"getResource\",u,a);if(!Li())return(ki(u.url)||ts)(u,a)}if(!(/^file:/.test(h=u.url)||/^file:/.test(Jn())&&!/^\\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,\"signal\"))return ts(u,a);if(Li()&&self.worker&&self.worker.actor)return self.worker.actor.send(\"getResource\",u,a,void 0,!0)}var h;return function(A,x){let E=new XMLHttpRequest;E.open(A.method||\"GET\",A.url,!0),A.type!==\"arrayBuffer\"&&A.type!==\"image\"||(E.responseType=\"arraybuffer\");for(let P in A.headers)E.setRequestHeader(P,A.headers[P]);return A.type===\"json\"&&(E.responseType=\"text\",E.setRequestHeader(\"Accept\",\"application/json\")),E.withCredentials=A.credentials===\"include\",E.onerror=()=>{x(new Error(E.statusText))},E.onload=()=>{if((E.status>=200&&E.status<300||E.status===0)&&E.response!==null){let P=E.response;if(A.type===\"json\")try{P=JSON.parse(E.response)}catch(D){return x(D)}x(null,P,E.getResponseHeader(\"Cache-Control\"),E.getResponseHeader(\"Expires\"))}else{let P=new Blob([E.response],{type:E.getResponseHeader(\"Content-Type\")});x(new Xi(E.status,E.statusText,A.url,P))}},E.send(A.body),{cancel:()=>E.abort()}}(u,a)},cl=function(u,a){return Vo(kt(u,{type:\"arrayBuffer\"}),a)};function xo(u){if(!u||u.indexOf(\"://\")<=0||u.indexOf(\"data:image/\")===0||u.indexOf(\"blob:\")===0)return!0;let a=new URL(u),h=window.location;return a.protocol===h.protocol&&a.host===h.host}function Pa(u,a,h){h[u]&&h[u].indexOf(a)!==-1||(h[u]=h[u]||[],h[u].push(a))}function na(u,a,h){if(h&&h[u]){let A=h[u].indexOf(a);A!==-1&&h[u].splice(A,1)}}class as{constructor(a,h={}){kt(this,h),this.type=a}}class ao extends as{constructor(a,h={}){super(\"error\",kt({error:a},h))}}class Nl{on(a,h){return this._listeners=this._listeners||{},Pa(a,h,this._listeners),this}off(a,h){return na(a,h,this._listeners),na(a,h,this._oneTimeListeners),this}once(a,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},Pa(a,h,this._oneTimeListeners),this):new Promise(A=>this.once(a,A))}fire(a,h){typeof a==\"string\"&&(a=new as(a,h||{}));let A=a.type;if(this.listens(A)){a.target=this;let x=this._listeners&&this._listeners[A]?this._listeners[A].slice():[];for(let D of x)D.call(this,a);let E=this._oneTimeListeners&&this._oneTimeListeners[A]?this._oneTimeListeners[A].slice():[];for(let D of E)na(A,D,this._oneTimeListeners),D.call(this,a);let P=this._eventedParent;P&&(kt(a,typeof this._eventedParentData==\"function\"?this._eventedParentData():this._eventedParentData),P.fire(a))}else a instanceof ao&&console.error(a.error);return this}listens(a){return this._listeners&&this._listeners[a]&&this._listeners[a].length>0||this._oneTimeListeners&&this._oneTimeListeners[a]&&this._oneTimeListeners[a].length>0||this._eventedParent&&this._eventedParent.listens(a)}setEventedParent(a,h){return this._eventedParent=a,this._eventedParentData=h,this}}var ee={$version:8,$root:{version:{required:!0,type:\"enum\",values:[8]},name:{type:\"string\"},metadata:{type:\"*\"},center:{type:\"array\",value:\"number\"},zoom:{type:\"number\"},bearing:{type:\"number\",default:0,period:360,units:\"degrees\"},pitch:{type:\"number\",default:0,units:\"degrees\"},light:{type:\"light\"},terrain:{type:\"terrain\"},sources:{required:!0,type:\"sources\"},sprite:{type:\"sprite\"},glyphs:{type:\"string\"},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},\"*\":{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:\"*\"},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:{required:!0,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:{},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_background\"],layout_background:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"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\",\"property-type\":\"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\",\"property-type\":\"constant\"}},layout_heatmap:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},\"layout_fill-extrusion\":{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_line:{\"line-cap\":{type:\"enum\",values:{butt:{},round:{},square:{}},default:\"butt\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"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\"]},\"property-type\":\"data-constant\"},\"line-round-limit\":{type:\"number\",default:1.05,requires:[{\"line-join\":\"round\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"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\"]},\"property-type\":\"data-constant\"},\"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\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_raster:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_hillshade:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},filter:{type:\"array\",value:\"*\"},filter_operator:{type:\"enum\",values:{\"==\":{},\"!=\":{},\">\":{},\">=\":{},\"<\":{},\"<=\":{},in:{},\"!in\":{},all:{},any:{},none:{},has:{},\"!has\":{},within:{}}},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:\"*\",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}},terrain:{source:{type:\"string\",required:!0},exaggeration:{type:\"number\",minimum:0,default:1}},paint:[\"paint_fill\",\"paint_line\",\"paint_circle\",\"paint_heatmap\",\"paint_fill-extrusion\",\"paint_symbol\",\"paint_raster\",\"paint_hillshade\",\"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-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"fill-pattern\"}],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,minimum:0,units:\"meters\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-base\":{type:\"number\",default:0,minimum: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-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\"]},\"property-type\":\"cross-faded\"},\"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\"},\"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:\"number\",default:335,minimum:0,maximum:359,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:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-highlight-color\":{type:\"color\",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\"}},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\"}}};let ls=[\"type\",\"source\",\"source-layer\",\"minzoom\",\"maxzoom\",\"filter\",\"layout\"];function mn(u,a){let h={};for(let A in u)A!==\"ref\"&&(h[A]=u[A]);return ls.forEach(A=>{A in a&&(h[A]=a[A])}),h}function gi(u,a){if(Array.isArray(u)){if(!Array.isArray(a)||u.length!==a.length)return!1;for(let h=0;h`:u.itemType.kind===\"value\"?\"array\":`array<${a}>`}return u.kind}let _t=[Ca,Te,Dr,gr,Us,gt,La,vt(Mr),tt,nt,ht];function Dt(u,a){if(a.kind===\"error\")return null;if(u.kind===\"array\"){if(a.kind===\"array\"&&(a.N===0&&a.itemType.kind===\"value\"||!Dt(u.itemType,a.itemType))&&(typeof u.N!=\"number\"||u.N===a.N))return null}else{if(u.kind===a.kind)return null;if(u.kind===\"value\"){for(let h of _t)if(!Dt(h,a))return null}}return`Expected ${xt(u)} but found ${xt(a)} instead.`}function Mt(u,a){return a.some(h=>h.kind===u.kind)}function Vt(u,a){return a.some(h=>h===\"null\"?u===null:h===\"array\"?Array.isArray(u):h===\"object\"?u&&!Array.isArray(u)&&typeof u==\"object\":h===typeof u)}function ie(u,a){return u.kind===\"array\"&&a.kind===\"array\"?u.itemType.kind===a.itemType.kind&&typeof u.N==\"number\":u.kind===a.kind}let se=.96422,ae=.82521,lr=4/29,vr=6/29,Xe=3*vr*vr,cr=vr*vr*vr,wr=Math.PI/180,xi=180/Math.PI;function zi(u){return(u%=360)<0&&(u+=360),u}function ni([u,a,h,A]){let x,E,P=jn((.2225045*(u=Hr(u))+.7168786*(a=Hr(a))+.0606169*(h=Hr(h)))/1);u===a&&a===h?x=E=P:(x=jn((.4360747*u+.3850649*a+.1430804*h)/se),E=jn((.0139322*u+.0971045*a+.7141733*h)/ae));let D=116*P-16;return[D<0?0:D,500*(x-P),200*(P-E),A]}function Hr(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function jn(u){return u>cr?Math.pow(u,1/3):u/Xe+lr}function Bi([u,a,h,A]){let x=(u+16)/116,E=isNaN(a)?x:x+a/500,P=isNaN(h)?x:x-h/200;return x=1*es(x),E=se*es(E),P=ae*es(P),[xn(3.1338561*E-1.6168667*x-.4906146*P),xn(-.9787684*E+1.9161415*x+.033454*P),xn(.0719453*E-.2289914*x+1.4052427*P),A]}function xn(u){return(u=u<=.00304?12.92*u:1.055*Math.pow(u,1/2.4)-.055)<0?0:u>1?1:u}function es(u){return u>vr?u*u*u:Xe*(u-lr)}function oa(u){return parseInt(u.padEnd(2,u),16)/255}function Um(u,a){return Vl(a?u/100:u,0,1)}function Vl(u,a,h){return Math.min(Math.max(a,u),h)}function Ss(u){return!u.some(Number.isNaN)}let nh={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]};class ai{constructor(a,h,A,x=1,E=!0){this.r=a,this.g=h,this.b=A,this.a=x,E||(this.r*=x,this.g*=x,this.b*=x,x||this.overwriteGetter(\"rgb\",[a,h,A,x]))}static parse(a){if(a instanceof ai)return a;if(typeof a!=\"string\")return;let h=function(A){if((A=A.toLowerCase().trim())===\"transparent\")return[0,0,0,0];let x=nh[A];if(x){let[P,D,F]=x;return[P/255,D/255,F/255,1]}if(A.startsWith(\"#\")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(A)){let P=A.length<6?1:2,D=1;return[oa(A.slice(D,D+=P)),oa(A.slice(D,D+=P)),oa(A.slice(D,D+=P)),oa(A.slice(D,D+P)||\"ff\")]}if(A.startsWith(\"rgb\")){let P=A.match(/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(P){let[D,F,V,q,X,rt,at,ct,mt,bt,Pt,jt]=P,Rt=[q||\" \",at||\" \",bt].join(\"\");if(Rt===\" \"||Rt===\" /\"||Rt===\",,\"||Rt===\",,,\"){let Gt=[V,rt,mt].join(\"\"),Yt=Gt===\"%%%\"?100:Gt===\"\"?255:0;if(Yt){let ce=[Vl(+F/Yt,0,1),Vl(+X/Yt,0,1),Vl(+ct/Yt,0,1),Pt?Um(+Pt,jt):1];if(Ss(ce))return ce}}return}}let E=A.match(/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(E){let[P,D,F,V,q,X,rt,at,ct]=E,mt=[F||\" \",q||\" \",rt].join(\"\");if(mt===\" \"||mt===\" /\"||mt===\",,\"||mt===\",,,\"){let bt=[+D,Vl(+V,0,100),Vl(+X,0,100),at?Um(+at,ct):1];if(Ss(bt))return function([Pt,jt,Rt,Gt]){function Yt(ce){let Ne=(ce+Pt/30)%12,ir=jt*Math.min(Rt,1-Rt);return Rt-ir*Math.max(-1,Math.min(Ne-3,9-Ne,1))}return Pt=zi(Pt),jt/=100,Rt/=100,[Yt(0),Yt(8),Yt(4),Gt]}(bt)}}}(a);return h?new ai(...h,!1):void 0}get rgb(){let{r:a,g:h,b:A,a:x}=this,E=x||1/0;return this.overwriteGetter(\"rgb\",[a/E,h/E,A/E,x])}get hcl(){return this.overwriteGetter(\"hcl\",function(a){let[h,A,x,E]=ni(a),P=Math.sqrt(A*A+x*x);return[Math.round(1e4*P)?zi(Math.atan2(x,A)*xi):NaN,P,h,E]}(this.rgb))}get lab(){return this.overwriteGetter(\"lab\",ni(this.rgb))}overwriteGetter(a,h){return Object.defineProperty(this,a,{value:h}),h}toString(){let[a,h,A,x]=this.rgb;return`rgba(${[a,h,A].map(E=>Math.round(255*E)).join(\",\")},${x})`}}ai.black=new ai(0,0,0,1),ai.white=new ai(1,1,1,1),ai.transparent=new ai(0,0,0,0),ai.red=new ai(1,0,0,1);class ka{constructor(a,h,A){this.sensitivity=a?h?\"variant\":\"case\":h?\"accent\":\"base\",this.locale=A,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:\"search\"})}compare(a,h){return this.collator.compare(a,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Dc{constructor(a,h,A,x,E){this.text=a,this.image=h,this.scale=A,this.fontStack=x,this.textColor=E}}class ln{constructor(a){this.sections=a}static fromString(a){return new ln([new Dc(a,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(a=>a.text.length!==0||a.image&&a.image.name.length!==0)}static factory(a){return a instanceof ln?a:ln.fromString(a)}toString(){return this.sections.length===0?\"\":this.sections.map(a=>a.text).join(\"\")}}class Dn{constructor(a){this.values=a.slice()}static parse(a){if(a instanceof Dn)return a;if(typeof a==\"number\")return new Dn([a,a,a,a]);if(Array.isArray(a)&&!(a.length<1||a.length>4)){for(let h of a)if(typeof h!=\"number\")return;switch(a.length){case 1:a=[a[0],a[0],a[0],a[0]];break;case 2:a=[a[0],a[1],a[0],a[1]];break;case 3:a=[a[0],a[1],a[2],a[1]]}return new Dn(a)}}toString(){return JSON.stringify(this.values)}}let Vm=new Set([\"center\",\"left\",\"right\",\"top\",\"bottom\",\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"]);class Go{constructor(a){this.values=a.slice()}static parse(a){if(a instanceof Go)return a;if(Array.isArray(a)&&!(a.length<1)&&a.length%2==0){for(let h=0;h=0&&u<=255&&typeof a==\"number\"&&a>=0&&a<=255&&typeof h==\"number\"&&h>=0&&h<=255?A===void 0||typeof A==\"number\"&&A>=0&&A<=1?null:`Invalid rgba value [${[u,a,h,A].join(\", \")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof A==\"number\"?[u,a,h,A]:[u,a,h]).join(\", \")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function jl(u){if(u===null||typeof u==\"string\"||typeof u==\"boolean\"||typeof u==\"number\"||u instanceof ai||u instanceof ka||u instanceof ln||u instanceof Dn||u instanceof Go||u instanceof Gn)return!0;if(Array.isArray(u)){for(let a of u)if(!jl(a))return!1;return!0}if(typeof u==\"object\"){for(let a in u)if(!jl(u[a]))return!1;return!0}return!1}function Ki(u){if(u===null)return Ca;if(typeof u==\"string\")return Dr;if(typeof u==\"boolean\")return gr;if(typeof u==\"number\")return Te;if(u instanceof ai)return Us;if(u instanceof ka)return sa;if(u instanceof ln)return gt;if(u instanceof Dn)return tt;if(u instanceof Go)return ht;if(u instanceof Gn)return nt;if(Array.isArray(u)){let a=u.length,h;for(let A of u){let x=Ki(A);if(h){if(h===x)continue;h=Mr;break}h=x}return vt(h||Mr,a)}return La}function _i(u){let a=typeof u;return u===null?\"\":a===\"string\"||a===\"number\"||a===\"boolean\"?String(u):u instanceof ai||u instanceof ln||u instanceof Dn||u instanceof Go||u instanceof Gn?u.toString():JSON.stringify(u)}class Gl{constructor(a,h){this.type=a,this.value=h}static parse(a,h){if(a.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${a.length-1} instead.`);if(!jl(a[1]))return h.error(\"invalid value\");let A=a[1],x=Ki(A),E=h.expectedType;return x.kind!==\"array\"||x.N!==0||!E||E.kind!==\"array\"||typeof E.N==\"number\"&&E.N!==0||(x=E),new Gl(x,A)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class cn{constructor(a){this.name=\"ExpressionEvaluationError\",this.message=a}toJSON(){return this.message}}let pu={string:Dr,number:Te,boolean:gr,object:La};class rs{constructor(a,h){this.type=a,this.args=h}static parse(a,h){if(a.length<2)return h.error(\"Expected at least one argument.\");let A,x=1,E=a[0];if(E===\"array\"){let D,F;if(a.length>2){let V=a[1];if(typeof V!=\"string\"||!(V in pu)||V===\"object\")return h.error('The item type argument of \"array\" must be one of string, number, boolean',1);D=pu[V],x++}else D=Mr;if(a.length>3){if(a[2]!==null&&(typeof a[2]!=\"number\"||a[2]<0||a[2]!==Math.floor(a[2])))return h.error('The length argument to \"array\" must be a positive integer literal',2);F=a[2],x++}A=vt(D,F)}else{if(!pu[E])throw new Error(`Types doesn't contain name = ${E}`);A=pu[E]}let P=[];for(;xa.outputDefined())}}let Gp={\"to-boolean\":gr,\"to-color\":Us,\"to-number\":Te,\"to-string\":Dr};class Wl{constructor(a,h){this.type=a,this.args=h}static parse(a,h){if(a.length<2)return h.error(\"Expected at least one argument.\");let A=a[0];if(!Gp[A])throw new Error(`Can't parse ${A} as it is not part of the known types`);if((A===\"to-boolean\"||A===\"to-string\")&&a.length!==2)return h.error(\"Expected one argument.\");let x=Gp[A],E=[];for(let P=1;P4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:So(h[0],h[1],h[2],h[3]),!A))return new ai(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new cn(A||`Could not parse color from value '${typeof h==\"string\"?h:JSON.stringify(h)}'`)}case\"padding\":{let h;for(let A of this.args){h=A.evaluate(a);let x=Dn.parse(h);if(x)return x}throw new cn(`Could not parse padding from value '${typeof h==\"string\"?h:JSON.stringify(h)}'`)}case\"variableAnchorOffsetCollection\":{let h;for(let A of this.args){h=A.evaluate(a);let x=Go.parse(h);if(x)return x}throw new cn(`Could not parse variableAnchorOffsetCollection from value '${typeof h==\"string\"?h:JSON.stringify(h)}'`)}case\"number\":{let h=null;for(let A of this.args){if(h=A.evaluate(a),h===null)return 0;let x=Number(h);if(!isNaN(x))return x}throw new cn(`Could not convert ${JSON.stringify(h)} to number.`)}case\"formatted\":return ln.fromString(_i(this.args[0].evaluate(a)));case\"resolvedImage\":return Gn.fromString(_i(this.args[0].evaluate(a)));default:return _i(this.args[0].evaluate(a))}}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}}let _d=[\"Unknown\",\"Point\",\"LineString\",\"Polygon\"];class yd{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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\"?_d[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(a){let h=this._parseColorCache[a];return h||(h=this._parseColorCache[a]=ai.parse(a)),h}}class vd{constructor(a,h,A=[],x,E=new Ul,P=[]){this.registry=a,this.path=A,this.key=A.map(D=>`[${D}]`).join(\"\"),this.scope=E,this.errors=P,this.expectedType=x,this._isConstant=h}parse(a,h,A,x,E={}){return h?this.concat(h,A,x)._parse(a,E):this._parse(a,E)}_parse(a,h){function A(x,E,P){return P===\"assert\"?new rs(E,[x]):P===\"coerce\"?new Wl(E,[x]):x}if(a!==null&&typeof a!=\"string\"&&typeof a!=\"boolean\"&&typeof a!=\"number\"||(a=[\"literal\",a]),Array.isArray(a)){if(a.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].');let x=a[0];if(typeof x!=\"string\")return this.error(`Expression name must be a string, but found ${typeof x} instead. If you wanted a literal array, use [\"literal\", [...]].`,0),null;let E=this.registry[x];if(E){let P=E.parse(a,this);if(!P)return null;if(this.expectedType){let D=this.expectedType,F=P.type;if(D.kind!==\"string\"&&D.kind!==\"number\"&&D.kind!==\"boolean\"&&D.kind!==\"object\"&&D.kind!==\"array\"||F.kind!==\"value\")if(D.kind!==\"color\"&&D.kind!==\"formatted\"&&D.kind!==\"resolvedImage\"||F.kind!==\"value\"&&F.kind!==\"string\")if(D.kind!==\"padding\"||F.kind!==\"value\"&&F.kind!==\"number\"&&F.kind!==\"array\")if(D.kind!==\"variableAnchorOffsetCollection\"||F.kind!==\"value\"&&F.kind!==\"array\"){if(this.checkSubtype(D,F))return null}else P=A(P,D,h.typeAnnotation||\"coerce\");else P=A(P,D,h.typeAnnotation||\"coerce\");else P=A(P,D,h.typeAnnotation||\"coerce\");else P=A(P,D,h.typeAnnotation||\"assert\")}if(!(P instanceof Gl)&&P.type.kind!==\"resolvedImage\"&&this._isConstant(P)){let D=new yd;try{P=new Gl(P.type,P.evaluate(D))}catch(F){return this.error(F.message),null}}return P}return this.error(`Unknown expression \"${x}\". If you wanted a literal array, use [\"literal\", [...]].`,0)}return this.error(a===void 0?\"'undefined' value invalid. Use null instead.\":typeof a==\"object\"?'Bare objects invalid. Use [\"literal\", {...}] instead.':`Expected an array, but found ${typeof a} instead.`)}concat(a,h,A){let x=typeof a==\"number\"?this.path.concat(a):this.path,E=A?this.scope.concat(A):this.scope;return new vd(this.registry,this._isConstant,x,h||null,E,this.errors)}error(a,...h){let A=`${this.key}${h.map(x=>`[${x}]`).join(\"\")}`;this.errors.push(new gn(A,a))}checkSubtype(a,h){let A=Dt(a,h);return A&&this.error(A),A}}class xd{constructor(a,h,A){this.type=sa,this.locale=A,this.caseSensitive=a,this.diacriticSensitive=h}static parse(a,h){if(a.length!==2)return h.error(\"Expected one argument.\");let A=a[1];if(typeof A!=\"object\"||Array.isArray(A))return h.error(\"Collator options argument must be an object.\");let x=h.parse(A[\"case-sensitive\"]!==void 0&&A[\"case-sensitive\"],1,gr);if(!x)return null;let E=h.parse(A[\"diacritic-sensitive\"]!==void 0&&A[\"diacritic-sensitive\"],1,gr);if(!E)return null;let P=null;return A.locale&&(P=h.parse(A.locale,1,Dr),!P)?null:new xd(x,E,P)}evaluate(a){return new ka(this.caseSensitive.evaluate(a),this.diacriticSensitive.evaluate(a),this.locale?this.locale.evaluate(a):null)}eachChild(a){a(this.caseSensitive),a(this.diacriticSensitive),this.locale&&a(this.locale)}outputDefined(){return!1}}let lt=8192;function ft(u,a){u[0]=Math.min(u[0],a[0]),u[1]=Math.min(u[1],a[1]),u[2]=Math.max(u[2],a[0]),u[3]=Math.max(u[3],a[1])}function Lt(u,a){return!(u[0]<=a[0]||u[2]>=a[2]||u[1]<=a[1]||u[3]>=a[3])}function Kt(u,a){let h=(180+u[0])/360,A=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u[1]*Math.PI/360)))/360,x=Math.pow(2,a.z);return[Math.round(h*x*lt),Math.round(A*x*lt)]}function ge(u,a,h){let A=u[0]-a[0],x=u[1]-a[1],E=u[0]-h[0],P=u[1]-h[1];return A*P-E*x==0&&A*E<=0&&x*P<=0}function Qe(u,a){let h=!1;for(let P=0,D=a.length;P(A=u)[1]!=(E=F[V+1])[1]>A[1]&&A[0]<(E[0]-x[0])*(A[1]-x[1])/(E[1]-x[1])+x[0]&&(h=!h)}}var A,x,E;return h}function ti(u,a){for(let h=0;h0&&D<0||P<0&&D>0}function Ts(u,a,h){for(let V of h)for(let q=0;qh[2]){let x=.5*A,E=u[0]-h[0]>x?-A:h[0]-u[0]>x?A:0;E===0&&(E=u[0]-h[2]>x?-A:h[2]-u[0]>x?A:0),u[0]+=E}ft(a,u)}function l_(u,a,h,A){let x=Math.pow(2,A.z)*lt,E=[A.x*lt,A.y*lt],P=[];for(let D of u)for(let F of D){let V=[F.x+E[0],F.y+E[1]];Bx(V,a,h,x),P.push(V)}return P}function c_(u,a,h,A){let x=Math.pow(2,A.z)*lt,E=[A.x*lt,A.y*lt],P=[];for(let F of u){let V=[];for(let q of F){let X=[q.x+E[0],q.y+E[1]];ft(a,X),V.push(X)}P.push(V)}if(a[2]-a[0]<=x/2){(D=a)[0]=D[1]=1/0,D[2]=D[3]=-1/0;for(let F of P)for(let V of F)Bx(V,a,h,x)}var D;return P}class gf{constructor(a,h){this.type=gr,this.geojson=a,this.geometries=h}static parse(a,h){if(a.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${a.length-1} instead.`);if(jl(a[1])){let A=a[1];if(A.type===\"FeatureCollection\")for(let x=0;x!Array.isArray(V)||V.length===a.length-1),F=null;for(let[V,q]of D){F=new vd(h.registry,Wm,h.path,null,h.scope);let X=[],rt=!1;for(let at=1;at{return rt=X,Array.isArray(rt)?`(${rt.map(xt).join(\", \")})`:`(${xt(rt.type)}...)`;var rt}).join(\" | \"),q=[];for(let X=1;X{h=a?h&&Wm(A):h&&A instanceof Gl}),!!h&&Hm(u)&&qm(u,[\"zoom\",\"heatmap-density\",\"line-progress\",\"accumulated\",\"is-supported-script\"])}function Hm(u){if(u instanceof fl&&(u.name===\"get\"&&u.args.length===1||u.name===\"feature-state\"||u.name===\"has\"&&u.args.length===1||u.name===\"properties\"||u.name===\"geometry-type\"||u.name===\"id\"||/^filter-/.test(u.name))||u instanceof gf)return!1;let a=!0;return u.eachChild(h=>{a&&!Hm(h)&&(a=!1)}),a}function Wp(u){if(u instanceof fl&&u.name===\"feature-state\")return!1;let a=!0;return u.eachChild(h=>{a&&!Wp(h)&&(a=!1)}),a}function qm(u,a){if(u instanceof fl&&a.indexOf(u.name)>=0)return!1;let h=!0;return u.eachChild(A=>{h&&!qm(A,a)&&(h=!1)}),h}function bd(u,a){let h=u.length-1,A,x,E=0,P=h,D=0;for(;E<=P;)if(D=Math.floor((E+P)/2),A=u[D],x=u[D+1],A<=a){if(D===h||aa))throw new cn(\"Input is not a number.\");P=D-1}return 0}class sh{constructor(a,h,A){this.type=a,this.input=h,this.labels=[],this.outputs=[];for(let[x,E]of A)this.labels.push(x),this.outputs.push(E)}static parse(a,h){if(a.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if((a.length-1)%2!=0)return h.error(\"Expected an even number of arguments.\");let A=h.parse(a[1],1,Te);if(!A)return null;let x=[],E=null;h.expectedType&&h.expectedType.kind!==\"value\"&&(E=h.expectedType);for(let P=1;P=D)return h.error('Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.',V);let X=h.parse(F,q,E);if(!X)return null;E=E||X.type,x.push([D,X])}return new sh(E,A,x)}evaluate(a){let h=this.labels,A=this.outputs;if(h.length===1)return A[0].evaluate(a);let x=this.input.evaluate(a);if(x<=h[0])return A[0].evaluate(a);let E=h.length;return x>=h[E-1]?A[E-1].evaluate(a):A[bd(h,x)].evaluate(a)}eachChild(a){a(this.input);for(let h of this.outputs)a(h)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}}function ui(u,a,h){return u+h*(a-u)}function Zm(u,a,h){return u.map((A,x)=>ui(A,a[x],h))}let Da={number:ui,color:function(u,a,h,A=\"rgb\"){switch(A){case\"rgb\":{let[x,E,P,D]=Zm(u.rgb,a.rgb,h);return new ai(x,E,P,D,!1)}case\"hcl\":{let[x,E,P,D]=u.hcl,[F,V,q,X]=a.hcl,rt,at;if(isNaN(x)||isNaN(F))isNaN(x)?isNaN(F)?rt=NaN:(rt=F,P!==1&&P!==0||(at=V)):(rt=x,q!==1&&q!==0||(at=E));else{let jt=F-x;F>x&&jt>180?jt-=360:F180&&(jt+=360),rt=x+h*jt}let[ct,mt,bt,Pt]=function([jt,Rt,Gt,Yt]){return jt=isNaN(jt)?0:jt*wr,Bi([Gt,Math.cos(jt)*Rt,Math.sin(jt)*Rt,Yt])}([rt,at??ui(E,V,h),ui(P,q,h),ui(D,X,h)]);return new ai(ct,mt,bt,Pt,!1)}case\"lab\":{let[x,E,P,D]=Bi(Zm(u.lab,a.lab,h));return new ai(x,E,P,D,!1)}}},array:Zm,padding:function(u,a,h){return new Dn(Zm(u.values,a.values,h))},variableAnchorOffsetCollection:function(u,a,h){let A=u.values,x=a.values;if(A.length!==x.length)throw new cn(`Cannot interpolate values of different length. from: ${u.toString()}, to: ${a.toString()}`);let E=[];for(let P=0;Ptypeof q!=\"number\"||q<0||q>1))return h.error(\"Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.\",1);x={name:\"cubic-bezier\",controlPoints:V}}}if(a.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if((a.length-1)%2!=0)return h.error(\"Expected an even number of arguments.\");if(E=h.parse(E,2,Te),!E)return null;let D=[],F=null;A===\"interpolate-hcl\"||A===\"interpolate-lab\"?F=Us:h.expectedType&&h.expectedType.kind!==\"value\"&&(F=h.expectedType);for(let V=0;V=q)return h.error('Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.',rt);let ct=h.parse(X,at,F);if(!ct)return null;F=F||ct.type,D.push([q,ct])}return ie(F,Te)||ie(F,Us)||ie(F,tt)||ie(F,ht)||ie(F,vt(Te))?new Oa(F,A,x,E,D):h.error(`Type ${xt(F)} is not interpolatable.`)}evaluate(a){let h=this.labels,A=this.outputs;if(h.length===1)return A[0].evaluate(a);let x=this.input.evaluate(a);if(x<=h[0])return A[0].evaluate(a);let E=h.length;if(x>=h[E-1])return A[E-1].evaluate(a);let P=bd(h,x),D=Oa.interpolationFactor(this.interpolation,x,h[P],h[P+1]),F=A[P].evaluate(a),V=A[P+1].evaluate(a);switch(this.operator){case\"interpolate\":return Da[this.type.kind](F,V,D);case\"interpolate-hcl\":return Da.color(F,V,D,\"hcl\");case\"interpolate-lab\":return Da.color(F,V,D,\"lab\")}}eachChild(a){a(this.input);for(let h of this.outputs)a(h)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}}function u_(u,a,h,A){let x=A-h,E=u-h;return x===0?0:a===1?E/x:(Math.pow(a,E)-1)/(Math.pow(a,x)-1)}class Ym{constructor(a,h){this.type=a,this.args=h}static parse(a,h){if(a.length<2)return h.error(\"Expectected at least one argument.\");let A=null,x=h.expectedType;x&&x.kind!==\"value\"&&(A=x);let E=[];for(let D of a.slice(1)){let F=h.parse(D,1+E.length,A,void 0,{typeAnnotation:\"omit\"});if(!F)return null;A=A||F.type,E.push(F)}if(!A)throw new Error(\"No output type\");let P=x&&E.some(D=>Dt(x,D.type));return new Ym(P?Mr:A,E)}evaluate(a){let h,A=null,x=0;for(let E of this.args)if(x++,A=E.evaluate(a),A&&A instanceof Gn&&!A.available&&(h||(h=A.name),A=null,x===this.args.length&&(A=h)),A!==null)break;return A}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}}class Qm{constructor(a,h){this.type=h.type,this.bindings=[].concat(a),this.result=h}evaluate(a){return this.result.evaluate(a)}eachChild(a){for(let h of this.bindings)a(h[1]);a(this.result)}static parse(a,h){if(a.length<4)return h.error(`Expected at least 3 arguments, but found ${a.length-1} instead.`);let A=[];for(let E=1;E=A.length)throw new cn(`Array index out of bounds: ${h} > ${A.length-1}.`);if(h!==Math.floor(h))throw new cn(`Array index must be an integer, but found ${h} instead.`);return A[h]}eachChild(a){a(this.index),a(this.input)}outputDefined(){return!1}}class $m{constructor(a,h){this.type=gr,this.needle=a,this.haystack=h}static parse(a,h){if(a.length!==3)return h.error(`Expected 2 arguments, but found ${a.length-1} instead.`);let A=h.parse(a[1],1,Mr),x=h.parse(a[2],2,Mr);return A&&x?Mt(A.type,[gr,Dr,Te,Ca,Mr])?new $m(A,x):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${xt(A.type)} instead`):null}evaluate(a){let h=this.needle.evaluate(a),A=this.haystack.evaluate(a);if(!A)return!1;if(!Vt(h,[\"boolean\",\"string\",\"number\",\"null\"]))throw new cn(`Expected first argument to be of type boolean, string, number or null, but found ${xt(Ki(h))} instead.`);if(!Vt(A,[\"string\",\"array\"]))throw new cn(`Expected second argument to be of type array or string, but found ${xt(Ki(A))} instead.`);return A.indexOf(h)>=0}eachChild(a){a(this.needle),a(this.haystack)}outputDefined(){return!0}}class qp{constructor(a,h,A){this.type=Te,this.needle=a,this.haystack=h,this.fromIndex=A}static parse(a,h){if(a.length<=2||a.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${a.length-1} instead.`);let A=h.parse(a[1],1,Mr),x=h.parse(a[2],2,Mr);if(!A||!x)return null;if(!Mt(A.type,[gr,Dr,Te,Ca,Mr]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${xt(A.type)} instead`);if(a.length===4){let E=h.parse(a[3],3,Te);return E?new qp(A,x,E):null}return new qp(A,x)}evaluate(a){let h=this.needle.evaluate(a),A=this.haystack.evaluate(a);if(!Vt(h,[\"boolean\",\"string\",\"number\",\"null\"]))throw new cn(`Expected first argument to be of type boolean, string, number or null, but found ${xt(Ki(h))} instead.`);if(!Vt(A,[\"string\",\"array\"]))throw new cn(`Expected second argument to be of type array or string, but found ${xt(Ki(A))} instead.`);if(this.fromIndex){let x=this.fromIndex.evaluate(a);return A.indexOf(h,x)}return A.indexOf(h)}eachChild(a){a(this.needle),a(this.haystack),this.fromIndex&&a(this.fromIndex)}outputDefined(){return!1}}class wd{constructor(a,h,A,x,E,P){this.inputType=a,this.type=h,this.input=A,this.cases=x,this.outputs=E,this.otherwise=P}static parse(a,h){if(a.length<5)return h.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if(a.length%2!=1)return h.error(\"Expected an even number of arguments.\");let A,x;h.expectedType&&h.expectedType.kind!==\"value\"&&(x=h.expectedType);let E={},P=[];for(let V=2;VNumber.MAX_SAFE_INTEGER)return rt.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ct==\"number\"&&Math.floor(ct)!==ct)return rt.error(\"Numeric branch labels must be integer values.\");if(A){if(rt.checkSubtype(A,Ki(ct)))return null}else A=Ki(ct);if(E[String(ct)]!==void 0)return rt.error(\"Branch labels must be unique.\");E[String(ct)]=P.length}let at=h.parse(X,V,x);if(!at)return null;x=x||at.type,P.push(at)}let D=h.parse(a[1],1,Mr);if(!D)return null;let F=h.parse(a[a.length-1],a.length-1,x);return F?D.type.kind!==\"value\"&&h.concat(1).checkSubtype(A,D.type)?null:new wd(A,x,D,E,P,F):null}evaluate(a){let h=this.input.evaluate(a);return(Ki(h)===this.inputType&&this.outputs[this.cases[h]]||this.otherwise).evaluate(a)}eachChild(a){a(this.input),this.outputs.forEach(a),a(this.otherwise)}outputDefined(){return this.outputs.every(a=>a.outputDefined())&&this.otherwise.outputDefined()}}class Zp{constructor(a,h,A){this.type=a,this.branches=h,this.otherwise=A}static parse(a,h){if(a.length<4)return h.error(`Expected at least 3 arguments, but found only ${a.length-1}.`);if(a.length%2!=0)return h.error(\"Expected an odd number of arguments.\");let A;h.expectedType&&h.expectedType.kind!==\"value\"&&(A=h.expectedType);let x=[];for(let P=1;Ph.outputDefined())&&this.otherwise.outputDefined()}}class Sd{constructor(a,h,A,x){this.type=a,this.input=h,this.beginIndex=A,this.endIndex=x}static parse(a,h){if(a.length<=2||a.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${a.length-1} instead.`);let A=h.parse(a[1],1,Mr),x=h.parse(a[2],2,Te);if(!A||!x)return null;if(!Mt(A.type,[vt(Mr),Dr,Mr]))return h.error(`Expected first argument to be of type array or string, but found ${xt(A.type)} instead`);if(a.length===4){let E=h.parse(a[3],3,Te);return E?new Sd(A.type,A,x,E):null}return new Sd(A.type,A,x)}evaluate(a){let h=this.input.evaluate(a),A=this.beginIndex.evaluate(a);if(!Vt(h,[\"string\",\"array\"]))throw new cn(`Expected first argument to be of type array or string, but found ${xt(Ki(h))} instead.`);if(this.endIndex){let x=this.endIndex.evaluate(a);return h.slice(A,x)}return h.slice(A)}eachChild(a){a(this.input),a(this.beginIndex),this.endIndex&&a(this.endIndex)}outputDefined(){return!1}}function Xm(u,a){return u===\"==\"||u===\"!=\"?a.kind===\"boolean\"||a.kind===\"string\"||a.kind===\"number\"||a.kind===\"null\"||a.kind===\"value\":a.kind===\"string\"||a.kind===\"number\"||a.kind===\"value\"}function Td(u,a,h,A){return A.compare(a,h)===0}function Au(u,a,h){let A=u!==\"==\"&&u!==\"!=\";return class tU{constructor(E,P,D){this.type=gr,this.lhs=E,this.rhs=P,this.collator=D,this.hasUntypedArgument=E.type.kind===\"value\"||P.type.kind===\"value\"}static parse(E,P){if(E.length!==3&&E.length!==4)return P.error(\"Expected two or three arguments.\");let D=E[0],F=P.parse(E[1],1,Mr);if(!F)return null;if(!Xm(D,F.type))return P.concat(1).error(`\"${D}\" comparisons are not supported for type '${xt(F.type)}'.`);let V=P.parse(E[2],2,Mr);if(!V)return null;if(!Xm(D,V.type))return P.concat(2).error(`\"${D}\" comparisons are not supported for type '${xt(V.type)}'.`);if(F.type.kind!==V.type.kind&&F.type.kind!==\"value\"&&V.type.kind!==\"value\")return P.error(`Cannot compare types '${xt(F.type)}' and '${xt(V.type)}'.`);A&&(F.type.kind===\"value\"&&V.type.kind!==\"value\"?F=new rs(V.type,[F]):F.type.kind!==\"value\"&&V.type.kind===\"value\"&&(V=new rs(F.type,[V])));let q=null;if(E.length===4){if(F.type.kind!==\"string\"&&V.type.kind!==\"string\"&&F.type.kind!==\"value\"&&V.type.kind!==\"value\")return P.error(\"Cannot use collator to compare non-string types.\");if(q=P.parse(E[3],3,sa),!q)return null}return new tU(F,V,q)}evaluate(E){let P=this.lhs.evaluate(E),D=this.rhs.evaluate(E);if(A&&this.hasUntypedArgument){let F=Ki(P),V=Ki(D);if(F.kind!==V.kind||F.kind!==\"string\"&&F.kind!==\"number\")throw new cn(`Expected arguments for \"${u}\" to be (string, string) or (number, number), but found (${F.kind}, ${V.kind}) instead.`)}if(this.collator&&!A&&this.hasUntypedArgument){let F=Ki(P),V=Ki(D);if(F.kind!==\"string\"||V.kind!==\"string\")return a(E,P,D)}return this.collator?h(E,P,D,this.collator.evaluate(E)):a(E,P,D)}eachChild(E){E(this.lhs),E(this.rhs),this.collator&&E(this.collator)}outputDefined(){return!0}}}let oh=Au(\"==\",function(u,a,h){return a===h},Td),Zt=Au(\"!=\",function(u,a,h){return a!==h},function(u,a,h,A){return!Td(0,a,h,A)}),fe=Au(\"<\",function(u,a,h){return a\",function(u,a,h){return a>h},function(u,a,h,A){return A.compare(a,h)>0}),br=Au(\"<=\",function(u,a,h){return a<=h},function(u,a,h,A){return A.compare(a,h)<=0}),g=Au(\">=\",function(u,a,h){return a>=h},function(u,a,h,A){return A.compare(a,h)>=0});class Vi{constructor(a,h,A,x,E){this.type=Dr,this.number=a,this.locale=h,this.currency=A,this.minFractionDigits=x,this.maxFractionDigits=E}static parse(a,h){if(a.length!==3)return h.error(\"Expected two arguments.\");let A=h.parse(a[1],1,Te);if(!A)return null;let x=a[2];if(typeof x!=\"object\"||Array.isArray(x))return h.error(\"NumberFormat options argument must be an object.\");let E=null;if(x.locale&&(E=h.parse(x.locale,1,Dr),!E))return null;let P=null;if(x.currency&&(P=h.parse(x.currency,1,Dr),!P))return null;let D=null;if(x[\"min-fraction-digits\"]&&(D=h.parse(x[\"min-fraction-digits\"],1,Te),!D))return null;let F=null;return x[\"max-fraction-digits\"]&&(F=h.parse(x[\"max-fraction-digits\"],1,Te),!F)?null:new Vi(A,E,P,D,F)}evaluate(a){return new Intl.NumberFormat(this.locale?this.locale.evaluate(a):[],{style:this.currency?\"currency\":\"decimal\",currency:this.currency?this.currency.evaluate(a):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(a):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(a):void 0}).format(this.number.evaluate(a))}eachChild(a){a(this.number),this.locale&&a(this.locale),this.currency&&a(this.currency),this.minFractionDigits&&a(this.minFractionDigits),this.maxFractionDigits&&a(this.maxFractionDigits)}outputDefined(){return!1}}class Ti{constructor(a){this.type=gt,this.sections=a}static parse(a,h){if(a.length<2)return h.error(\"Expected at least one argument.\");let A=a[1];if(!Array.isArray(A)&&typeof A==\"object\")return h.error(\"First argument must be an image or text section.\");let x=[],E=!1;for(let P=1;P<=a.length-1;++P){let D=a[P];if(E&&typeof D==\"object\"&&!Array.isArray(D)){E=!1;let F=null;if(D[\"font-scale\"]&&(F=h.parse(D[\"font-scale\"],1,Te),!F))return null;let V=null;if(D[\"text-font\"]&&(V=h.parse(D[\"text-font\"],1,vt(Dr)),!V))return null;let q=null;if(D[\"text-color\"]&&(q=h.parse(D[\"text-color\"],1,Us),!q))return null;let X=x[x.length-1];X.scale=F,X.font=V,X.textColor=q}else{let F=h.parse(a[P],1,Mr);if(!F)return null;let V=F.type.kind;if(V!==\"string\"&&V!==\"value\"&&V!==\"null\"&&V!==\"resolvedImage\")return h.error(\"Formatted text type must be 'string', 'value', 'image' or 'null'.\");E=!0,x.push({content:F,scale:null,font:null,textColor:null})}}return new Ti(x)}evaluate(a){return new ln(this.sections.map(h=>{let A=h.content.evaluate(a);return Ki(A)===nt?new Dc(\"\",A,null,null,null):new Dc(_i(A),null,h.scale?h.scale.evaluate(a):null,h.font?h.font.evaluate(a).join(\",\"):null,h.textColor?h.textColor.evaluate(a):null)}))}eachChild(a){for(let h of this.sections)a(h.content),h.scale&&a(h.scale),h.font&&a(h.font),h.textColor&&a(h.textColor)}outputDefined(){return!1}}class Tt{constructor(a){this.type=nt,this.input=a}static parse(a,h){if(a.length!==2)return h.error(\"Expected two arguments.\");let A=h.parse(a[1],1,Dr);return A?new Tt(A):h.error(\"No image name provided.\")}evaluate(a){let h=this.input.evaluate(a),A=Gn.fromString(h);return A&&a.availableImages&&(A.available=a.availableImages.indexOf(h)>-1),A}eachChild(a){a(this.input)}outputDefined(){return!1}}class Ms{constructor(a){this.type=Te,this.input=a}static parse(a,h){if(a.length!==2)return h.error(`Expected 1 argument, but found ${a.length-1} instead.`);let A=h.parse(a[1],1);return A?A.type.kind!==\"array\"&&A.type.kind!==\"string\"&&A.type.kind!==\"value\"?h.error(`Expected argument of type string or array, but found ${xt(A.type)} instead.`):new Ms(A):null}evaluate(a){let h=this.input.evaluate(a);if(typeof h==\"string\"||Array.isArray(h))return h.length;throw new cn(`Expected value to be of type string or array, but found ${xt(Ki(h))} instead.`)}eachChild(a){a(this.input)}outputDefined(){return!1}}let cs={\"==\":oh,\"!=\":Zt,\">\":Be,\"<\":fe,\">=\":g,\"<=\":br,array:rs,at:Hp,boolean:rs,case:Zp,coalesce:Ym,collator:xd,format:Ti,image:Tt,in:$m,\"index-of\":qp,interpolate:Oa,\"interpolate-hcl\":Oa,\"interpolate-lab\":Oa,length:Ms,let:Qm,literal:Gl,match:wd,number:rs,\"number-format\":Vi,object:rs,slice:Sd,step:sh,string:rs,\"to-boolean\":Wl,\"to-color\":Wl,\"to-number\":Wl,\"to-string\":Wl,var:Gm,within:gf};function li(u,[a,h,A,x]){a=a.evaluate(u),h=h.evaluate(u),A=A.evaluate(u);let E=x?x.evaluate(u):1,P=So(a,h,A,E);if(P)throw new cn(P);return new ai(a/255,h/255,A/255,E,!1)}function bn(u,a){return u in a}function dl(u,a){let h=a[u];return h===void 0?null:h}function Ur(u){return{type:u}}function hi(u){return{result:\"success\",value:u}}function To(u){return{result:\"error\",value:u}}function _f(u){return u[\"property-type\"]===\"data-driven\"||u[\"property-type\"]===\"cross-faded-data-driven\"}function h_(u){return!!u.expression&&u.expression.parameters.indexOf(\"zoom\")>-1}function Md(u){return!!u.expression&&u.expression.interpolated}function qr(u){return u instanceof Number?\"number\":u instanceof String?\"string\":u instanceof Boolean?\"boolean\":Array.isArray(u)?\"array\":u===null?\"null\":typeof u}function Ji(u){return typeof u==\"object\"&&u!==null&&!Array.isArray(u)}function Oc(u){return u}function ci(u,a){let h=a.type===\"color\",A=u.stops&&typeof u.stops[0][0]==\"object\",x=A||!(A||u.property!==void 0),E=u.type||(Md(a)?\"exponential\":\"interval\");if(h||a.type===\"padding\"){let q=h?ai.parse:Dn.parse;(u=jo({},u)).stops&&(u.stops=u.stops.map(X=>[X[0],q(X[1])])),u.default=q(u.default?u.default:a.default)}if(u.colorSpace&&(P=u.colorSpace)!==\"rgb\"&&P!==\"hcl\"&&P!==\"lab\")throw new Error(`Unknown color space: \"${u.colorSpace}\"`);var P;let D,F,V;if(E===\"exponential\")D=Mi;else if(E===\"interval\")D=It;else if(E===\"categorical\"){D=Je,F=Object.create(null);for(let q of u.stops)F[q[0]]=q[1];V=typeof u.stops[0][0]}else{if(E!==\"identity\")throw new Error(`Unknown function type \"${E}\"`);D=Km}if(A){let q={},X=[];for(let ct=0;ctct[0]),evaluate:({zoom:ct},mt)=>Mi({stops:rt,base:u.base},a,ct).evaluate(ct,mt)}}if(x){let q=E===\"exponential\"?{name:\"exponential\",base:u.base!==void 0?u.base:1}:null;return{kind:\"camera\",interpolationType:q,interpolationFactor:Oa.interpolationFactor.bind(void 0,q),zoomStops:u.stops.map(X=>X[0]),evaluate:({zoom:X})=>D(u,a,X,F,V)}}return{kind:\"source\",evaluate(q,X){let rt=X&&X.properties?X.properties[u.property]:void 0;return rt===void 0?aa(u.default,a.default):D(u,a,rt,F,V)}}}function aa(u,a,h){return u!==void 0?u:a!==void 0?a:h!==void 0?h:void 0}function Je(u,a,h,A,x){return aa(typeof h===x?A[h]:void 0,u.default,a.default)}function It(u,a,h){if(qr(h)!==\"number\")return aa(u.default,a.default);let A=u.stops.length;if(A===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[A-1][0])return u.stops[A-1][1];let x=bd(u.stops.map(E=>E[0]),h);return u.stops[x][1]}function Mi(u,a,h){let A=u.base!==void 0?u.base:1;if(qr(h)!==\"number\")return aa(u.default,a.default);let x=u.stops.length;if(x===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[x-1][0])return u.stops[x-1][1];let E=bd(u.stops.map(q=>q[0]),h),P=function(q,X,rt,at){let ct=at-rt,mt=q-rt;return ct===0?0:X===1?mt/ct:(Math.pow(X,mt)-1)/(Math.pow(X,ct)-1)}(h,A,u.stops[E][0],u.stops[E+1][0]),D=u.stops[E][1],F=u.stops[E+1][1],V=Da[a.type]||Oc;return typeof D.evaluate==\"function\"?{evaluate(...q){let X=D.evaluate.apply(void 0,q),rt=F.evaluate.apply(void 0,q);if(X!==void 0&&rt!==void 0)return V(X,rt,P,u.colorSpace)}}:V(D,F,P,u.colorSpace)}function Km(u,a,h){switch(a.type){case\"color\":h=ai.parse(h);break;case\"formatted\":h=ln.fromString(h.toString());break;case\"resolvedImage\":h=Gn.fromString(h.toString());break;case\"padding\":h=Dn.parse(h);break;default:qr(h)===a.type||a.type===\"enum\"&&a.values[h]||(h=void 0)}return aa(h,u.default,a.default)}fl.register(cs,{error:[{kind:\"error\"},[Dr],(u,[a])=>{throw new cn(a.evaluate(u))}],typeof:[Dr,[Mr],(u,[a])=>xt(Ki(a.evaluate(u)))],\"to-rgba\":[vt(Te,4),[Us],(u,[a])=>{let[h,A,x,E]=a.evaluate(u).rgb;return[255*h,255*A,255*x,E]}],rgb:[Us,[Te,Te,Te],li],rgba:[Us,[Te,Te,Te,Te],li],has:{type:gr,overloads:[[[Dr],(u,[a])=>bn(a.evaluate(u),u.properties())],[[Dr,La],(u,[a,h])=>bn(a.evaluate(u),h.evaluate(u))]]},get:{type:Mr,overloads:[[[Dr],(u,[a])=>dl(a.evaluate(u),u.properties())],[[Dr,La],(u,[a,h])=>dl(a.evaluate(u),h.evaluate(u))]]},\"feature-state\":[Mr,[Dr],(u,[a])=>dl(a.evaluate(u),u.featureState||{})],properties:[La,[],u=>u.properties()],\"geometry-type\":[Dr,[],u=>u.geometryType()],id:[Mr,[],u=>u.id()],zoom:[Te,[],u=>u.globals.zoom],\"heatmap-density\":[Te,[],u=>u.globals.heatmapDensity||0],\"line-progress\":[Te,[],u=>u.globals.lineProgress||0],accumulated:[Mr,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],\"+\":[Te,Ur(Te),(u,a)=>{let h=0;for(let A of a)h+=A.evaluate(u);return h}],\"*\":[Te,Ur(Te),(u,a)=>{let h=1;for(let A of a)h*=A.evaluate(u);return h}],\"-\":{type:Te,overloads:[[[Te,Te],(u,[a,h])=>a.evaluate(u)-h.evaluate(u)],[[Te],(u,[a])=>-a.evaluate(u)]]},\"/\":[Te,[Te,Te],(u,[a,h])=>a.evaluate(u)/h.evaluate(u)],\"%\":[Te,[Te,Te],(u,[a,h])=>a.evaluate(u)%h.evaluate(u)],ln2:[Te,[],()=>Math.LN2],pi:[Te,[],()=>Math.PI],e:[Te,[],()=>Math.E],\"^\":[Te,[Te,Te],(u,[a,h])=>Math.pow(a.evaluate(u),h.evaluate(u))],sqrt:[Te,[Te],(u,[a])=>Math.sqrt(a.evaluate(u))],log10:[Te,[Te],(u,[a])=>Math.log(a.evaluate(u))/Math.LN10],ln:[Te,[Te],(u,[a])=>Math.log(a.evaluate(u))],log2:[Te,[Te],(u,[a])=>Math.log(a.evaluate(u))/Math.LN2],sin:[Te,[Te],(u,[a])=>Math.sin(a.evaluate(u))],cos:[Te,[Te],(u,[a])=>Math.cos(a.evaluate(u))],tan:[Te,[Te],(u,[a])=>Math.tan(a.evaluate(u))],asin:[Te,[Te],(u,[a])=>Math.asin(a.evaluate(u))],acos:[Te,[Te],(u,[a])=>Math.acos(a.evaluate(u))],atan:[Te,[Te],(u,[a])=>Math.atan(a.evaluate(u))],min:[Te,Ur(Te),(u,a)=>Math.min(...a.map(h=>h.evaluate(u)))],max:[Te,Ur(Te),(u,a)=>Math.max(...a.map(h=>h.evaluate(u)))],abs:[Te,[Te],(u,[a])=>Math.abs(a.evaluate(u))],round:[Te,[Te],(u,[a])=>{let h=a.evaluate(u);return h<0?-Math.round(-h):Math.round(h)}],floor:[Te,[Te],(u,[a])=>Math.floor(a.evaluate(u))],ceil:[Te,[Te],(u,[a])=>Math.ceil(a.evaluate(u))],\"filter-==\":[gr,[Dr,Mr],(u,[a,h])=>u.properties()[a.value]===h.value],\"filter-id-==\":[gr,[Mr],(u,[a])=>u.id()===a.value],\"filter-type-==\":[gr,[Dr],(u,[a])=>u.geometryType()===a.value],\"filter-<\":[gr,[Dr,Mr],(u,[a,h])=>{let A=u.properties()[a.value],x=h.value;return typeof A==typeof x&&A{let h=u.id(),A=a.value;return typeof h==typeof A&&h\":[gr,[Dr,Mr],(u,[a,h])=>{let A=u.properties()[a.value],x=h.value;return typeof A==typeof x&&A>x}],\"filter-id->\":[gr,[Mr],(u,[a])=>{let h=u.id(),A=a.value;return typeof h==typeof A&&h>A}],\"filter-<=\":[gr,[Dr,Mr],(u,[a,h])=>{let A=u.properties()[a.value],x=h.value;return typeof A==typeof x&&A<=x}],\"filter-id-<=\":[gr,[Mr],(u,[a])=>{let h=u.id(),A=a.value;return typeof h==typeof A&&h<=A}],\"filter->=\":[gr,[Dr,Mr],(u,[a,h])=>{let A=u.properties()[a.value],x=h.value;return typeof A==typeof x&&A>=x}],\"filter-id->=\":[gr,[Mr],(u,[a])=>{let h=u.id(),A=a.value;return typeof h==typeof A&&h>=A}],\"filter-has\":[gr,[Mr],(u,[a])=>a.value in u.properties()],\"filter-has-id\":[gr,[],u=>u.id()!==null&&u.id()!==void 0],\"filter-type-in\":[gr,[vt(Dr)],(u,[a])=>a.value.indexOf(u.geometryType())>=0],\"filter-id-in\":[gr,[vt(Mr)],(u,[a])=>a.value.indexOf(u.id())>=0],\"filter-in-small\":[gr,[Dr,vt(Mr)],(u,[a,h])=>h.value.indexOf(u.properties()[a.value])>=0],\"filter-in-large\":[gr,[Dr,vt(Mr)],(u,[a,h])=>function(A,x,E,P){for(;E<=P;){let D=E+P>>1;if(x[D]===A)return!0;x[D]>A?P=D-1:E=D+1}return!1}(u.properties()[a.value],h.value,0,h.value.length-1)],all:{type:gr,overloads:[[[gr,gr],(u,[a,h])=>a.evaluate(u)&&h.evaluate(u)],[Ur(gr),(u,a)=>{for(let h of a)if(!h.evaluate(u))return!1;return!0}]]},any:{type:gr,overloads:[[[gr,gr],(u,[a,h])=>a.evaluate(u)||h.evaluate(u)],[Ur(gr),(u,a)=>{for(let h of a)if(h.evaluate(u))return!0;return!1}]]},\"!\":[gr,[gr],(u,[a])=>!a.evaluate(u)],\"is-supported-script\":[gr,[Dr],(u,[a])=>{let h=u.globals&&u.globals.isSupportedScript;return!h||h(a.evaluate(u))}],upcase:[Dr,[Dr],(u,[a])=>a.evaluate(u).toUpperCase()],downcase:[Dr,[Dr],(u,[a])=>a.evaluate(u).toLowerCase()],concat:[Dr,Ur(Mr),(u,a)=>a.map(h=>_i(h.evaluate(u))).join(\"\")],\"resolved-locale\":[Dr,[sa],(u,[a])=>a.evaluate(u).resolvedLocale()]});class Jm{constructor(a,h){var A;this.expression=a,this._warningHistory={},this._evaluator=new yd,this._defaultValue=h?(A=h).type===\"color\"&&Ji(A.default)?new ai(0,0,0,0):A.type===\"color\"?ai.parse(A.default)||null:A.type===\"padding\"?Dn.parse(A.default)||null:A.type===\"variableAnchorOffsetCollection\"?Go.parse(A.default)||null:A.default===void 0?null:A.default:null,this._enumValues=h&&h.type===\"enum\"?h.values:null}evaluateWithoutErrorHandling(a,h,A,x,E,P){return this._evaluator.globals=a,this._evaluator.feature=h,this._evaluator.featureState=A,this._evaluator.canonical=x,this._evaluator.availableImages=E||null,this._evaluator.formattedSection=P,this.expression.evaluate(this._evaluator)}evaluate(a,h,A,x,E,P){this._evaluator.globals=a,this._evaluator.feature=h||null,this._evaluator.featureState=A||null,this._evaluator.canonical=x,this._evaluator.availableImages=E||null,this._evaluator.formattedSection=P||null;try{let D=this.expression.evaluate(this._evaluator);if(D==null||typeof D==\"number\"&&D!=D)return this._defaultValue;if(this._enumValues&&!(D in this._enumValues))throw new cn(`Expected value to be one of ${Object.keys(this._enumValues).map(F=>JSON.stringify(F)).join(\", \")}, but found ${JSON.stringify(D)} instead.`);return D}catch(D){return this._warningHistory[D.message]||(this._warningHistory[D.message]=!0,typeof console<\"u\"&&console.warn(D.message)),this._defaultValue}}}function Yp(u){return Array.isArray(u)&&u.length>0&&typeof u[0]==\"string\"&&u[0]in cs}function Qp(u,a){let h=new vd(cs,Wm,[],a?function(x){let E={color:Us,string:Dr,number:Te,enum:Dr,boolean:gr,formatted:gt,padding:tt,resolvedImage:nt,variableAnchorOffsetCollection:ht};return x.type===\"array\"?vt(E[x.value]||Mr,x.length):E[x.type]}(a):void 0),A=h.parse(u,void 0,void 0,void 0,a&&a.type===\"string\"?{typeAnnotation:\"coerce\"}:void 0);return A?hi(new Jm(A,a)):To(h.errors)}class t0{constructor(a,h){this.kind=a,this._styleExpression=h,this.isStateDependent=a!==\"constant\"&&!Wp(h.expression)}evaluateWithoutErrorHandling(a,h,A,x,E,P){return this._styleExpression.evaluateWithoutErrorHandling(a,h,A,x,E,P)}evaluate(a,h,A,x,E,P){return this._styleExpression.evaluate(a,h,A,x,E,P)}}class wt{constructor(a,h,A,x){this.kind=a,this.zoomStops=A,this._styleExpression=h,this.isStateDependent=a!==\"camera\"&&!Wp(h.expression),this.interpolationType=x}evaluateWithoutErrorHandling(a,h,A,x,E,P){return this._styleExpression.evaluateWithoutErrorHandling(a,h,A,x,E,P)}evaluate(a,h,A,x,E,P){return this._styleExpression.evaluate(a,h,A,x,E,P)}interpolationFactor(a,h,A){return this.interpolationType?Oa.interpolationFactor(this.interpolationType,a,h,A):0}}function e0(u,a){let h=Qp(u,a);if(h.result===\"error\")return h;let A=h.value.expression,x=Hm(A);if(!x&&!_f(a))return To([new gn(\"\",\"data expressions not supported\")]);let E=qm(A,[\"zoom\"]);if(!E&&!h_(a))return To([new gn(\"\",\"zoom expressions not supported\")]);let P=Pd(A);return P||E?P instanceof gn?To([P]):P instanceof Oa&&!Md(a)?To([new gn(\"\",'\"interpolate\" expressions cannot be used with this property')]):hi(P?new wt(x?\"camera\":\"composite\",h.value,P.labels,P instanceof Oa?P.interpolation:void 0):new t0(x?\"constant\":\"source\",h.value)):To([new gn(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.')])}class Ed{constructor(a,h){this._parameters=a,this._specification=h,jo(this,ci(this._parameters,this._specification))}static deserialize(a){return new Ed(a._parameters,a._specification)}static serialize(a){return{_parameters:a._parameters,_specification:a._specification}}}function Pd(u){let a=null;if(u instanceof Qm)a=Pd(u.result);else if(u instanceof Ym){for(let h of u.args)if(a=Pd(h),a)break}else(u instanceof sh||u instanceof Oa)&&u.input instanceof fl&&u.input.name===\"zoom\"&&(a=u);return a instanceof gn||u.eachChild(h=>{let A=Pd(h);A instanceof gn?a=A:!a&&A?a=new gn(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.'):a&&A&&a!==A&&(a=new gn(\"\",'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.'))}),a}function Id(u){if(u===!0||u===!1)return!0;if(!Array.isArray(u)||u.length===0)return!1;switch(u[0]){case\"has\":return u.length>=2&&u[1]!==\"$id\"&&u[1]!==\"$type\";case\"in\":return u.length>=3&&(typeof u[1]!=\"string\"||Array.isArray(u[2]));case\"!in\":case\"!has\":case\"none\":return!1;case\"==\":case\"!=\":case\">\":case\">=\":case\"<\":case\"<=\":return u.length!==3||Array.isArray(u[1])||Array.isArray(u[2]);case\"any\":case\"all\":for(let a of u.slice(1))if(!Id(a)&&typeof a!=\"boolean\")return!1;return!0;default:return!0}}let Fx={type:\"boolean\",default:!1,transition:!1,\"property-type\":\"data-driven\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]}};function r0(u){if(u==null)return{filter:()=>!0,needGeometry:!1};Id(u)||(u=yf(u));let a=Qp(u,Fx);if(a.result===\"error\")throw new Error(a.value.map(h=>`${h.key}: ${h.message}`).join(\", \"));return{filter:(h,A,x)=>a.value.evaluate(h,A,{},x),needGeometry:d_(u)}}function f_(u,a){return ua?1:0}function d_(u){if(!Array.isArray(u))return!1;if(u[0]===\"within\")return!0;for(let a=1;a\"||a===\"<=\"||a===\">=\"?Ba(u[1],u[2],a):a===\"any\"?(h=u.slice(1),[\"any\"].concat(h.map(yf))):a===\"all\"?[\"all\"].concat(u.slice(1).map(yf)):a===\"none\"?[\"all\"].concat(u.slice(1).map(yf).map(Cd)):a===\"in\"?Wn(u[1],u.slice(2)):a===\"!in\"?Cd(Wn(u[1],u.slice(2))):a===\"has\"?p_(u[1]):a===\"!has\"?Cd(p_(u[1])):a!==\"within\"||u;var h}function Ba(u,a,h){switch(u){case\"$type\":return[`filter-type-${h}`,a];case\"$id\":return[`filter-id-${h}`,a];default:return[`filter-${h}`,u,a]}}function Wn(u,a){if(a.length===0)return!1;switch(u){case\"$type\":return[\"filter-type-in\",[\"literal\",a]];case\"$id\":return[\"filter-id-in\",[\"literal\",a]];default:return a.length>200&&!a.some(h=>typeof h!=typeof a[0])?[\"filter-in-large\",u,[\"literal\",a.sort(f_)]]:[\"filter-in-small\",u,[\"literal\",a]]}}function p_(u){switch(u){case\"$type\":return!0;case\"$id\":return[\"filter-has-id\"];default:return[\"filter-has\",u]}}function Cd(u){return[\"!\",u]}function $p(u){let a=typeof u;if(a===\"number\"||a===\"boolean\"||a===\"string\"||u==null)return JSON.stringify(u);if(Array.isArray(u)){let x=\"[\";for(let E of u)x+=`${$p(E)},`;return`${x}]`}let h=Object.keys(u).sort(),A=\"{\";for(let x=0;xA.maximum?[new ve(a,h,`${h} is greater than the maximum value ${A.maximum}`)]:[]}function Kp(u){let a=u.valueSpec,h=Cn(u.value.type),A,x,E,P={},D=h!==\"categorical\"&&u.value.property===void 0,F=!D,V=qr(u.value.stops)===\"array\"&&qr(u.value.stops[0])===\"array\"&&qr(u.value.stops[0][0])===\"object\",q=fi({key:u.key,value:u.value,valueSpec:u.styleSpec.function,validateSpec:u.validateSpec,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(at){if(h===\"identity\")return[new ve(at.key,at.value,'identity function may not have a \"stops\" property')];let ct=[],mt=at.value;return ct=ct.concat(mu({key:at.key,value:mt,valueSpec:at.valueSpec,validateSpec:at.validateSpec,style:at.style,styleSpec:at.styleSpec,arrayElementValidator:X})),qr(mt)===\"array\"&&mt.length===0&&ct.push(new ve(at.key,mt,\"array must have at least one stop\")),ct},default:function(at){return at.validateSpec({key:at.key,value:at.value,valueSpec:a,validateSpec:at.validateSpec,style:at.style,styleSpec:at.styleSpec})}}});return h===\"identity\"&&D&&q.push(new ve(u.key,u.value,'missing required property \"property\"')),h===\"identity\"||u.value.stops||q.push(new ve(u.key,u.value,'missing required property \"stops\"')),h===\"exponential\"&&u.valueSpec.expression&&!Md(u.valueSpec)&&q.push(new ve(u.key,u.value,\"exponential functions not supported\")),u.styleSpec.$version>=8&&(F&&!_f(u.valueSpec)?q.push(new ve(u.key,u.value,\"property functions not supported\")):D&&!h_(u.valueSpec)&&q.push(new ve(u.key,u.value,\"zoom functions not supported\"))),h!==\"categorical\"&&!V||u.value.property!==void 0||q.push(new ve(u.key,u.value,'\"property\" property is required')),q;function X(at){let ct=[],mt=at.value,bt=at.key;if(qr(mt)!==\"array\")return[new ve(bt,mt,`array expected, ${qr(mt)} found`)];if(mt.length!==2)return[new ve(bt,mt,`array length 2 expected, length ${mt.length} found`)];if(V){if(qr(mt[0])!==\"object\")return[new ve(bt,mt,`object expected, ${qr(mt[0])} found`)];if(mt[0].zoom===void 0)return[new ve(bt,mt,\"object stop key must have zoom\")];if(mt[0].value===void 0)return[new ve(bt,mt,\"object stop key must have value\")];if(E&&E>Cn(mt[0].zoom))return[new ve(bt,mt[0].zoom,\"stop zoom values must appear in ascending order\")];Cn(mt[0].zoom)!==E&&(E=Cn(mt[0].zoom),x=void 0,P={}),ct=ct.concat(fi({key:`${bt}[0]`,value:mt[0],valueSpec:{zoom:{}},validateSpec:at.validateSpec,style:at.style,styleSpec:at.styleSpec,objectElementValidators:{zoom:vf,value:rt}}))}else ct=ct.concat(rt({key:`${bt}[0]`,value:mt[0],valueSpec:{},validateSpec:at.validateSpec,style:at.style,styleSpec:at.styleSpec},mt));return Yp(ah(mt[1]))?ct.concat([new ve(`${bt}[1]`,mt[1],\"expressions are not allowed in function stops.\")]):ct.concat(at.validateSpec({key:`${bt}[1]`,value:mt[1],valueSpec:a,validateSpec:at.validateSpec,style:at.style,styleSpec:at.styleSpec}))}function rt(at,ct){let mt=qr(at.value),bt=Cn(at.value),Pt=at.value!==null?at.value:ct;if(A){if(mt!==A)return[new ve(at.key,Pt,`${mt} stop domain type must match previous stop domain type ${A}`)]}else A=mt;if(mt!==\"number\"&&mt!==\"string\"&&mt!==\"boolean\")return[new ve(at.key,Pt,\"stop domain value must be a number, string, or boolean\")];if(mt!==\"number\"&&h!==\"categorical\"){let jt=`number expected, ${mt} found`;return _f(a)&&h===void 0&&(jt+='\\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.'),[new ve(at.key,Pt,jt)]}return h!==\"categorical\"||mt!==\"number\"||isFinite(bt)&&Math.floor(bt)===bt?h!==\"categorical\"&&mt===\"number\"&&x!==void 0&&btnew ve(`${u.key}${A.key}`,u.value,A.message));let h=a.value.expression||a.value._styleExpression.expression;if(u.expressionContext===\"property\"&&u.propertyKey===\"text-font\"&&!h.outputDefined())return[new ve(u.key,u.value,`Invalid data expression for \"${u.propertyKey}\". Output values must be contained as literals within the expression.`)];if(u.expressionContext===\"property\"&&u.propertyType===\"layout\"&&!Wp(h))return[new ve(u.key,u.value,'\"feature-state\" data expressions are not supported with layout properties.')];if(u.expressionContext===\"filter\"&&!Wp(h))return[new ve(u.key,u.value,'\"feature-state\" data expressions are not supported with filters.')];if(u.expressionContext&&u.expressionContext.indexOf(\"cluster\")===0){if(!qm(h,[\"zoom\",\"feature-state\"]))return[new ve(u.key,u.value,'\"zoom\" and \"feature-state\" expressions are not supported with cluster properties.')];if(u.expressionContext===\"cluster-initial\"&&!Hm(h))return[new ve(u.key,u.value,\"Feature data expressions are not supported with initial expression part of cluster properties.\")]}return[]}function Ld(u){let a=u.key,h=u.value,A=u.valueSpec,x=[];return Array.isArray(A.values)?A.values.indexOf(Cn(h))===-1&&x.push(new ve(a,h,`expected one of [${A.values.join(\", \")}], ${JSON.stringify(h)} found`)):Object.keys(A.values).indexOf(Cn(h))===-1&&x.push(new ve(a,h,`expected one of [${Object.keys(A.values).join(\", \")}], ${JSON.stringify(h)} found`)),x}function ch(u){return Id(ah(u.value))?lh(jo({},u,{expressionContext:\"filter\",valueSpec:{value:\"boolean\"}})):Jp(u)}function Jp(u){let a=u.value,h=u.key;if(qr(a)!==\"array\")return[new ve(h,a,`array expected, ${qr(a)} found`)];let A=u.styleSpec,x,E=[];if(a.length<1)return[new ve(h,a,\"filter array must have at least 1 element\")];switch(E=E.concat(Ld({key:`${h}[0]`,value:a[0],valueSpec:A.filter_operator,style:u.style,styleSpec:u.styleSpec})),Cn(a[0])){case\"<\":case\"<=\":case\">\":case\">=\":a.length>=2&&Cn(a[1])===\"$type\"&&E.push(new ve(h,a,`\"$type\" cannot be use with operator \"${a[0]}\"`));case\"==\":case\"!=\":a.length!==3&&E.push(new ve(h,a,`filter array for operator \"${a[0]}\" must have 3 elements`));case\"in\":case\"!in\":a.length>=2&&(x=qr(a[1]),x!==\"string\"&&E.push(new ve(`${h}[1]`,a[1],`string expected, ${x} found`)));for(let P=2;P{V in h&&a.push(new ve(A,h[V],`\"${V}\" is prohibited for ref layers`))}),x.layers.forEach(V=>{Cn(V.id)===D&&(F=V)}),F?F.ref?a.push(new ve(A,h.ref,\"ref cannot reference another ref layer\")):P=Cn(F.type):a.push(new ve(A,h.ref,`ref layer \"${D}\" not found`))}else if(P!==\"background\")if(h.source){let F=x.sources&&x.sources[h.source],V=F&&Cn(F.type);F?V===\"vector\"&&P===\"raster\"?a.push(new ve(A,h.source,`layer \"${h.id}\" requires a raster source`)):V!==\"raster-dem\"&&P===\"hillshade\"?a.push(new ve(A,h.source,`layer \"${h.id}\" requires a raster-dem source`)):V===\"raster\"&&P!==\"raster\"?a.push(new ve(A,h.source,`layer \"${h.id}\" requires a vector source`)):V!==\"vector\"||h[\"source-layer\"]?V===\"raster-dem\"&&P!==\"hillshade\"?a.push(new ve(A,h.source,\"raster-dem source can only be used with layer type 'hillshade'.\")):P!==\"line\"||!h.paint||!h.paint[\"line-gradient\"]||V===\"geojson\"&&F.lineMetrics||a.push(new ve(A,h,`layer \"${h.id}\" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):a.push(new ve(A,h,`layer \"${h.id}\" must specify a \"source-layer\"`)):a.push(new ve(A,h.source,`source \"${h.source}\" not found`))}else a.push(new ve(A,h,'missing required property \"source\"'));return a=a.concat(fi({key:A,value:h,valueSpec:E.layer,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{\"*\":()=>[],type:()=>u.validateSpec({key:`${A}.type`,value:h.type,valueSpec:E.layer.type,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,object:h,objectKey:\"type\"}),filter:ch,layout:F=>fi({layer:h,key:F.key,value:F.value,style:F.style,styleSpec:F.styleSpec,validateSpec:F.validateSpec,objectElementValidators:{\"*\":V=>m_(jo({layerType:P},V))}}),paint:F=>fi({layer:h,key:F.key,value:F.value,style:F.style,styleSpec:F.styleSpec,validateSpec:F.validateSpec,objectElementValidators:{\"*\":V=>A_(jo({layerType:P},V))}})}})),a}function pl(u){let a=u.value,h=u.key,A=qr(a);return A!==\"string\"?[new ve(h,a,`string expected, ${A} found`)]:[]}let uh={promoteId:function({key:u,value:a}){if(qr(a)===\"string\")return pl({key:u,value:a});{let h=[];for(let A in a)h.push(...pl({key:`${u}.${A}`,value:a[A]}));return h}}};function la(u){let a=u.value,h=u.key,A=u.styleSpec,x=u.style,E=u.validateSpec;if(!a.type)return[new ve(h,a,'\"type\" is required')];let P=Cn(a.type),D;switch(P){case\"vector\":case\"raster\":return D=fi({key:h,value:a,valueSpec:A[`source_${P.replace(\"-\",\"_\")}`],style:u.style,styleSpec:A,objectElementValidators:uh,validateSpec:E}),D;case\"raster-dem\":return D=function(F){var V;let q=(V=F.sourceName)!==null&&V!==void 0?V:\"\",X=F.value,rt=F.styleSpec,at=rt.source_raster_dem,ct=F.style,mt=[],bt=qr(X);if(X===void 0)return mt;if(bt!==\"object\")return mt.push(new ve(\"source_raster_dem\",X,`object expected, ${bt} found`)),mt;let Pt=Cn(X.encoding)===\"custom\",jt=[\"redFactor\",\"greenFactor\",\"blueFactor\",\"baseShift\"],Rt=F.value.encoding?`\"${F.value.encoding}\"`:\"Default\";for(let Gt in X)!Pt&&jt.includes(Gt)?mt.push(new ve(Gt,X[Gt],`In \"${q}\": \"${Gt}\" is only valid when \"encoding\" is set to \"custom\". ${Rt} encoding found`)):at[Gt]?mt=mt.concat(F.validateSpec({key:Gt,value:X[Gt],valueSpec:at[Gt],validateSpec:F.validateSpec,style:ct,styleSpec:rt})):mt.push(new ve(Gt,X[Gt],`unknown property \"${Gt}\"`));return mt}({sourceName:h,value:a,style:u.style,styleSpec:A,validateSpec:E}),D;case\"geojson\":if(D=fi({key:h,value:a,valueSpec:A.source_geojson,style:x,styleSpec:A,validateSpec:E,objectElementValidators:uh}),a.cluster)for(let F in a.clusterProperties){let[V,q]=a.clusterProperties[F],X=typeof V==\"string\"?[V,[\"accumulated\"],[\"get\",F]]:V;D.push(...lh({key:`${h}.${F}.map`,value:q,validateSpec:E,expressionContext:\"cluster-map\"})),D.push(...lh({key:`${h}.${F}.reduce`,value:X,validateSpec:E,expressionContext:\"cluster-reduce\"}))}return D;case\"video\":return fi({key:h,value:a,valueSpec:A.source_video,style:x,validateSpec:E,styleSpec:A});case\"image\":return fi({key:h,value:a,valueSpec:A.source_image,style:x,validateSpec:E,styleSpec:A});case\"canvas\":return[new ve(h,null,\"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.\",\"source.canvas\")];default:return Ld({key:`${h}.type`,value:a.type,valueSpec:{values:[\"vector\",\"raster\",\"raster-dem\",\"geojson\",\"video\",\"image\"]},style:x,validateSpec:E,styleSpec:A})}}function kd(u){let a=u.value,h=u.styleSpec,A=h.light,x=u.style,E=[],P=qr(a);if(a===void 0)return E;if(P!==\"object\")return E=E.concat([new ve(\"light\",a,`object expected, ${P} found`)]),E;for(let D in a){let F=D.match(/^(.*)-transition$/);E=E.concat(F&&A[F[1]]&&A[F[1]].transition?u.validateSpec({key:D,value:a[D],valueSpec:h.transition,validateSpec:u.validateSpec,style:x,styleSpec:h}):A[D]?u.validateSpec({key:D,value:a[D],valueSpec:A[D],validateSpec:u.validateSpec,style:x,styleSpec:h}):[new ve(D,a[D],`unknown property \"${D}\"`)])}return E}function g_(u){let a=u.value,h=u.styleSpec,A=h.terrain,x=u.style,E=[],P=qr(a);if(a===void 0)return E;if(P!==\"object\")return E=E.concat([new ve(\"terrain\",a,`object expected, ${P} found`)]),E;for(let D in a)E=E.concat(A[D]?u.validateSpec({key:D,value:a[D],valueSpec:A[D],validateSpec:u.validateSpec,style:x,styleSpec:h}):[new ve(D,a[D],`unknown property \"${D}\"`)]);return E}function js(u){let a=[],h=u.value,A=u.key;if(Array.isArray(h)){let x=[],E=[];for(let P in h)h[P].id&&x.includes(h[P].id)&&a.push(new ve(A,h,`all the sprites' ids must be unique, but ${h[P].id} is duplicated`)),x.push(h[P].id),h[P].url&&E.includes(h[P].url)&&a.push(new ve(A,h,`all the sprites' URLs must be unique, but ${h[P].url} is duplicated`)),E.push(h[P].url),a=a.concat(fi({key:`${A}[${P}]`,value:h[P],valueSpec:{id:{type:\"string\",required:!0},url:{type:\"string\",required:!0}},validateSpec:u.validateSpec}));return a}return pl({key:A,value:h})}let gu={\"*\":()=>[],array:mu,boolean:function(u){let a=u.value,h=u.key,A=qr(a);return A!==\"boolean\"?[new ve(h,a,`boolean expected, ${A} found`)]:[]},number:vf,color:function(u){let a=u.key,h=u.value,A=qr(h);return A!==\"string\"?[new ve(a,h,`color expected, ${A} found`)]:ai.parse(String(h))?[]:[new ve(a,h,`color expected, \"${h}\" found`)]},constants:i0,enum:Ld,filter:ch,function:Kp,layer:n0,object:fi,source:la,light:kd,terrain:g_,string:pl,formatted:function(u){return pl(u).length===0?[]:lh(u)},resolvedImage:function(u){return pl(u).length===0?[]:lh(u)},padding:function(u){let a=u.key,h=u.value;if(qr(h)===\"array\"){if(h.length<1||h.length>4)return[new ve(a,h,`padding requires 1 to 4 values; ${h.length} values found`)];let A={type:\"number\"},x=[];for(let E=0;E[]}})),u.constants&&(h=h.concat(i0({key:\"constants\",value:u.constants,style:u,styleSpec:a,validateSpec:Ln}))),Rd(h)}function Fa(u){return function(a){return u({...a,validateSpec:Ln})}}function Rd(u){return[].concat(u).sort((a,h)=>a.line-h.line)}function Al(u){return function(...a){return Rd(u.apply(this,a))}}ca.source=Al(Fa(la)),ca.sprite=Al(Fa(js)),ca.glyphs=Al(Fa(eA)),ca.light=Al(Fa(kd)),ca.terrain=Al(Fa(g_)),ca.layer=Al(Fa(n0)),ca.filter=Al(Fa(ch)),ca.paintProperty=Al(Fa(A_)),ca.layoutProperty=Al(Fa(m_));let za=ca,hh=za.light,rA=za.paintProperty,s0=za.layoutProperty;function fh(u,a){let h=!1;if(a&&a.length)for(let A of a)u.fire(new ao(new Error(A.message))),h=!0;return h}class Na{constructor(a,h,A){let x=this.cells=[];if(a instanceof ArrayBuffer){this.arrayBuffer=a;let P=new Int32Array(this.arrayBuffer);a=P[0],this.d=(h=P[1])+2*(A=P[2]);for(let F=0;F=X[ct+0]&&x>=X[ct+1])?(D[at]=!0,P.push(q[at])):D[at]=!1}}}}_forEachCell(a,h,A,x,E,P,D,F){let V=this._convertToCellCoord(a),q=this._convertToCellCoord(h),X=this._convertToCellCoord(A),rt=this._convertToCellCoord(x);for(let at=V;at<=X;at++)for(let ct=q;ct<=rt;ct++){let mt=this.d*ct+at;if((!F||F(this._convertFromCellCoord(at),this._convertFromCellCoord(ct),this._convertFromCellCoord(at+1),this._convertFromCellCoord(ct+1)))&&E.call(this,a,h,A,x,mt,P,D,F))return}}_convertFromCellCoord(a){return(a-this.padding)/this.scale}_convertToCellCoord(a){return Math.max(0,Math.min(this.d-1,Math.floor(a*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let a=this.cells,h=3+this.cells.length+1+1,A=0;for(let P=0;P=0)continue;let P=u[E];x[E]=co[A].shallow.indexOf(E)>=0?P:Hl(P,a)}u instanceof Error&&(x.message=u.message)}if(x.$name)throw new Error(\"$name property is reserved for worker serialization logic.\");return A!==\"Object\"&&(x.$name=A),x}throw new Error(\"can't serialize object of type \"+typeof u)}function xf(u){if(u==null||typeof u==\"boolean\"||typeof u==\"number\"||typeof u==\"string\"||u instanceof Boolean||u instanceof Number||u instanceof String||u instanceof Date||u instanceof RegExp||u instanceof Blob||Dd(u)||zl(u)||ArrayBuffer.isView(u)||u instanceof ImageData)return u;if(Array.isArray(u))return u.map(xf);if(typeof u==\"object\"){let a=u.$name||\"Object\";if(!co[a])throw new Error(`can't deserialize unregistered class ${a}`);let{klass:h}=co[a];if(!h)throw new Error(`can't deserialize unregistered class ${a}`);if(h.deserialize)return h.deserialize(u);let A=Object.create(h.prototype);for(let x of Object.keys(u)){if(x===\"$name\")continue;let E=u[x];A[x]=co[a].shallow.indexOf(x)>=0?E:xf(E)}return A}throw new Error(\"can't deserialize object of type \"+typeof u)}class __{constructor(){this.first=!0}update(a,h){let A=Math.floor(a);return this.first?(this.first=!1,this.lastIntegerZoom=A,this.lastIntegerZoomTime=0,this.lastZoom=a,this.lastFloorZoom=A,!0):(this.lastFloorZoom>A?(this.lastIntegerZoom=A+1,this.lastIntegerZoomTime=h):this.lastFloorZoomu>=128&&u<=255,Arabic:u=>u>=1536&&u<=1791,\"Arabic Supplement\":u=>u>=1872&&u<=1919,\"Arabic Extended-A\":u=>u>=2208&&u<=2303,\"Hangul Jamo\":u=>u>=4352&&u<=4607,\"Unified Canadian Aboriginal Syllabics\":u=>u>=5120&&u<=5759,Khmer:u=>u>=6016&&u<=6143,\"Unified Canadian Aboriginal Syllabics Extended\":u=>u>=6320&&u<=6399,\"General Punctuation\":u=>u>=8192&&u<=8303,\"Letterlike Symbols\":u=>u>=8448&&u<=8527,\"Number Forms\":u=>u>=8528&&u<=8591,\"Miscellaneous Technical\":u=>u>=8960&&u<=9215,\"Control Pictures\":u=>u>=9216&&u<=9279,\"Optical Character Recognition\":u=>u>=9280&&u<=9311,\"Enclosed Alphanumerics\":u=>u>=9312&&u<=9471,\"Geometric Shapes\":u=>u>=9632&&u<=9727,\"Miscellaneous Symbols\":u=>u>=9728&&u<=9983,\"Miscellaneous Symbols and Arrows\":u=>u>=11008&&u<=11263,\"CJK Radicals Supplement\":u=>u>=11904&&u<=12031,\"Kangxi Radicals\":u=>u>=12032&&u<=12255,\"Ideographic Description Characters\":u=>u>=12272&&u<=12287,\"CJK Symbols and Punctuation\":u=>u>=12288&&u<=12351,Hiragana:u=>u>=12352&&u<=12447,Katakana:u=>u>=12448&&u<=12543,Bopomofo:u=>u>=12544&&u<=12591,\"Hangul Compatibility Jamo\":u=>u>=12592&&u<=12687,Kanbun:u=>u>=12688&&u<=12703,\"Bopomofo Extended\":u=>u>=12704&&u<=12735,\"CJK Strokes\":u=>u>=12736&&u<=12783,\"Katakana Phonetic Extensions\":u=>u>=12784&&u<=12799,\"Enclosed CJK Letters and Months\":u=>u>=12800&&u<=13055,\"CJK Compatibility\":u=>u>=13056&&u<=13311,\"CJK Unified Ideographs Extension A\":u=>u>=13312&&u<=19903,\"Yijing Hexagram Symbols\":u=>u>=19904&&u<=19967,\"CJK Unified Ideographs\":u=>u>=19968&&u<=40959,\"Yi Syllables\":u=>u>=40960&&u<=42127,\"Yi Radicals\":u=>u>=42128&&u<=42191,\"Hangul Jamo Extended-A\":u=>u>=43360&&u<=43391,\"Hangul Syllables\":u=>u>=44032&&u<=55215,\"Hangul Jamo Extended-B\":u=>u>=55216&&u<=55295,\"Private Use Area\":u=>u>=57344&&u<=63743,\"CJK Compatibility Ideographs\":u=>u>=63744&&u<=64255,\"Arabic Presentation Forms-A\":u=>u>=64336&&u<=65023,\"Vertical Forms\":u=>u>=65040&&u<=65055,\"CJK Compatibility Forms\":u=>u>=65072&&u<=65103,\"Small Form Variants\":u=>u>=65104&&u<=65135,\"Arabic Presentation Forms-B\":u=>u>=65136&&u<=65279,\"Halfwidth and Fullwidth Forms\":u=>u>=65280&&u<=65519};function o0(u){for(let a of u)if(dh(a.charCodeAt(0)))return!0;return!1}function a0(u){for(let a of u)if(!zx(a.charCodeAt(0)))return!1;return!0}function zx(u){return!(Oe.Arabic(u)||Oe[\"Arabic Supplement\"](u)||Oe[\"Arabic Extended-A\"](u)||Oe[\"Arabic Presentation Forms-A\"](u)||Oe[\"Arabic Presentation Forms-B\"](u))}function dh(u){return!(u!==746&&u!==747&&(u<4352||!(Oe[\"Bopomofo Extended\"](u)||Oe.Bopomofo(u)||Oe[\"CJK Compatibility Forms\"](u)&&!(u>=65097&&u<=65103)||Oe[\"CJK Compatibility Ideographs\"](u)||Oe[\"CJK Compatibility\"](u)||Oe[\"CJK Radicals Supplement\"](u)||Oe[\"CJK Strokes\"](u)||!(!Oe[\"CJK Symbols and Punctuation\"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||Oe[\"CJK Unified Ideographs Extension A\"](u)||Oe[\"CJK Unified Ideographs\"](u)||Oe[\"Enclosed CJK Letters and Months\"](u)||Oe[\"Hangul Compatibility Jamo\"](u)||Oe[\"Hangul Jamo Extended-A\"](u)||Oe[\"Hangul Jamo Extended-B\"](u)||Oe[\"Hangul Jamo\"](u)||Oe[\"Hangul Syllables\"](u)||Oe.Hiragana(u)||Oe[\"Ideographic Description Characters\"](u)||Oe.Kanbun(u)||Oe[\"Kangxi Radicals\"](u)||Oe[\"Katakana Phonetic Extensions\"](u)||Oe.Katakana(u)&&u!==12540||!(!Oe[\"Halfwidth and Fullwidth Forms\"](u)||u===65288||u===65289||u===65293||u>=65306&&u<=65310||u===65339||u===65341||u===65343||u>=65371&&u<=65503||u===65507||u>=65512&&u<=65519)||!(!Oe[\"Small Form Variants\"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||Oe[\"Unified Canadian Aboriginal Syllabics\"](u)||Oe[\"Unified Canadian Aboriginal Syllabics Extended\"](u)||Oe[\"Vertical Forms\"](u)||Oe[\"Yijing Hexagram Symbols\"](u)||Oe[\"Yi Syllables\"](u)||Oe[\"Yi Radicals\"](u))))}function y_(u){return!(dh(u)||function(a){return!!(Oe[\"Latin-1 Supplement\"](a)&&(a===167||a===169||a===174||a===177||a===188||a===189||a===190||a===215||a===247)||Oe[\"General Punctuation\"](a)&&(a===8214||a===8224||a===8225||a===8240||a===8241||a===8251||a===8252||a===8258||a===8263||a===8264||a===8265||a===8273)||Oe[\"Letterlike Symbols\"](a)||Oe[\"Number Forms\"](a)||Oe[\"Miscellaneous Technical\"](a)&&(a>=8960&&a<=8967||a>=8972&&a<=8991||a>=8996&&a<=9e3||a===9003||a>=9085&&a<=9114||a>=9150&&a<=9165||a===9167||a>=9169&&a<=9179||a>=9186&&a<=9215)||Oe[\"Control Pictures\"](a)&&a!==9251||Oe[\"Optical Character Recognition\"](a)||Oe[\"Enclosed Alphanumerics\"](a)||Oe[\"Geometric Shapes\"](a)||Oe[\"Miscellaneous Symbols\"](a)&&!(a>=9754&&a<=9759)||Oe[\"Miscellaneous Symbols and Arrows\"](a)&&(a>=11026&&a<=11055||a>=11088&&a<=11097||a>=11192&&a<=11243)||Oe[\"CJK Symbols and Punctuation\"](a)||Oe.Katakana(a)||Oe[\"Private Use Area\"](a)||Oe[\"CJK Compatibility Forms\"](a)||Oe[\"Small Form Variants\"](a)||Oe[\"Halfwidth and Fullwidth Forms\"](a)||a===8734||a===8756||a===8757||a>=9984&&a<=10087||a>=10102&&a<=10131||a===65532||a===65533)}(u))}function l0(u){return u>=1424&&u<=2303||Oe[\"Arabic Presentation Forms-A\"](u)||Oe[\"Arabic Presentation Forms-B\"](u)}function c0(u,a){return!(!a&&l0(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||Oe.Khmer(u))}function bf(u){for(let a of u)if(l0(a.charCodeAt(0)))return!0;return!1}let u0=\"deferred\",iA=\"loading\",nA=\"loaded\",ph=null,us=\"unavailable\",_u=null,Bc=function(u){u&&typeof u==\"string\"&&u.indexOf(\"NetworkError\")>-1&&(us=\"error\"),ph&&ph(u)};function h0(){Od.fire(new as(\"pluginStateChange\",{pluginStatus:us,pluginURL:_u}))}let Od=new Nl,f0=function(){return us},v_=function(){if(us!==u0||!_u)throw new Error(\"rtl-text-plugin cannot be downloaded unless a pluginURL is specified\");us=iA,h0(),_u&&cl({url:_u},u=>{u?Bc(u):(us=nA,h0())})},ua={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>us===nA||ua.applyArabicShaping!=null,isLoading:()=>us===iA,setState(u){if(!Li())throw new Error(\"Cannot set the state of the rtl-text-plugin when not in the web-worker context\");us=u.pluginStatus,_u=u.pluginURL},isParsed(){if(!Li())throw new Error(\"rtl-text-plugin is only parsed on the worker-threads\");return ua.applyArabicShaping!=null&&ua.processBidirectionalText!=null&&ua.processStyledBidirectionalText!=null},getPluginURL(){if(!Li())throw new Error(\"rtl-text-plugin url can only be queried from the worker threads\");return _u}};class un{constructor(a,h){this.zoom=a,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.zoomHistory=h.zoomHistory,this.transition=h.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new __,this.transition={})}isSupportedScript(a){return function(h,A){for(let x of h)if(!c0(x.charCodeAt(0),A))return!1;return!0}(a,ua.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let a=this.zoom,h=a-Math.floor(a),A=this.crossFadingFactor();return a>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*A}:{fromScale:.5,toScale:1,t:1-(1-A)*h}}}class sA{constructor(a,h){this.property=a,this.value=h,this.expression=function(A,x){if(Ji(A))return new Ed(A,x);if(Yp(A)){let E=e0(A,x);if(E.result===\"error\")throw new Error(E.value.map(P=>`${P.key}: ${P.message}`).join(\", \"));return E.value}{let E=A;return x.type===\"color\"&&typeof A==\"string\"?E=ai.parse(A):x.type!==\"padding\"||typeof A!=\"number\"&&!Array.isArray(A)?x.type===\"variableAnchorOffsetCollection\"&&Array.isArray(A)&&(E=Go.parse(A)):E=Dn.parse(A),{kind:\"constant\",evaluate:()=>E}}}(h===void 0?a.specification.default:h,a.specification)}isDataDriven(){return this.expression.kind===\"source\"||this.expression.kind===\"composite\"}possiblyEvaluate(a,h,A){return this.property.possiblyEvaluate(this,a,h,A)}}class d0{constructor(a){this.property=a,this.value=new sA(a,void 0)}transitioned(a,h){return new x_(this.property,this.value,h,kt({},a.transition,this.transition),a.now)}untransitioned(){return new x_(this.property,this.value,null,{},0)}}class Ah{constructor(a){this._properties=a,this._values=Object.create(a.defaultTransitionablePropertyValues)}getValue(a){return ue(this._values[a].value.value)}setValue(a,h){Object.prototype.hasOwnProperty.call(this._values,a)||(this._values[a]=new d0(this._values[a].property)),this._values[a].value=new sA(this._values[a].property,h===null?void 0:ue(h))}getTransition(a){return ue(this._values[a].transition)}setTransition(a,h){Object.prototype.hasOwnProperty.call(this._values,a)||(this._values[a]=new d0(this._values[a].property)),this._values[a].transition=ue(h)||void 0}serialize(){let a={};for(let h of Object.keys(this._values)){let A=this.getValue(h);A!==void 0&&(a[h]=A);let x=this.getTransition(h);x!==void 0&&(a[`${h}-transition`]=x)}return a}transitioned(a,h){let A=new b_(this._properties);for(let x of Object.keys(this._values))A._values[x]=this._values[x].transitioned(a,h._values[x]);return A}untransitioned(){let a=new b_(this._properties);for(let h of Object.keys(this._values))a._values[h]=this._values[h].untransitioned();return a}}class x_{constructor(a,h,A,x,E){this.property=a,this.value=h,this.begin=E+x.delay||0,this.end=this.begin+x.duration||0,a.specification.transition&&(x.delay||x.duration)&&(this.prior=A)}possiblyEvaluate(a,h,A){let x=a.now||0,E=this.value.possiblyEvaluate(a,h,A),P=this.prior;if(P){if(x>this.end)return this.prior=null,E;if(this.value.isDataDriven())return this.prior=null,E;if(x=1)return 1;let V=F*F,q=V*F;return 4*(F<.5?q:3*(F-V)+q-.75)}(D))}}return E}}class b_{constructor(a){this._properties=a,this._values=Object.create(a.defaultTransitioningPropertyValues)}possiblyEvaluate(a,h,A){let x=new oA(this._properties);for(let E of Object.keys(this._values))x._values[E]=this._values[E].possiblyEvaluate(a,h,A);return x}hasTransition(){for(let a of Object.keys(this._values))if(this._values[a].prior)return!0;return!1}}class Nx{constructor(a){this._properties=a,this._values=Object.create(a.defaultPropertyValues)}hasValue(a){return this._values[a].value!==void 0}getValue(a){return ue(this._values[a].value)}setValue(a,h){this._values[a]=new sA(this._values[a].property,h===null?void 0:ue(h))}serialize(){let a={};for(let h of Object.keys(this._values)){let A=this.getValue(h);A!==void 0&&(a[h]=A)}return a}possiblyEvaluate(a,h,A){let x=new oA(this._properties);for(let E of Object.keys(this._values))x._values[E]=this._values[E].possiblyEvaluate(a,h,A);return x}}class Mo{constructor(a,h,A){this.property=a,this.value=h,this.parameters=A}isConstant(){return this.value.kind===\"constant\"}constantOr(a){return this.value.kind===\"constant\"?this.value.value:a}evaluate(a,h,A,x){return this.property.evaluate(this.value,this.parameters,a,h,A,x)}}class oA{constructor(a){this._properties=a,this._values=Object.create(a.defaultPossiblyEvaluatedValues)}get(a){return this._values[a]}}class nr{constructor(a){this.specification=a}possiblyEvaluate(a,h){if(a.isDataDriven())throw new Error(\"Value should not be data driven\");return a.expression.evaluate(h)}interpolate(a,h,A){let x=Da[this.specification.type];return x?x(a,h,A):a}}class dr{constructor(a,h){this.specification=a,this.overrides=h}possiblyEvaluate(a,h,A,x){return new Mo(this,a.expression.kind===\"constant\"||a.expression.kind===\"camera\"?{kind:\"constant\",value:a.expression.evaluate(h,null,{},A,x)}:a.expression,h)}interpolate(a,h,A){if(a.value.kind!==\"constant\"||h.value.kind!==\"constant\")return a;if(a.value.value===void 0||h.value.value===void 0)return new Mo(this,{kind:\"constant\",value:void 0},a.parameters);let x=Da[this.specification.type];if(x){let E=x(a.value.value,h.value.value,A);return new Mo(this,{kind:\"constant\",value:E},a.parameters)}return a}evaluate(a,h,A,x,E,P){return a.kind===\"constant\"?a.value:a.evaluate(h,A,x,E,P)}}class wf extends dr{possiblyEvaluate(a,h,A,x){if(a.value===void 0)return new Mo(this,{kind:\"constant\",value:void 0},h);if(a.expression.kind===\"constant\"){let E=a.expression.evaluate(h,null,{},A,x),P=a.property.specification.type===\"resolvedImage\"&&typeof E!=\"string\"?E.name:E,D=this._calculate(P,P,P,h);return new Mo(this,{kind:\"constant\",value:D},h)}if(a.expression.kind===\"camera\"){let E=this._calculate(a.expression.evaluate({zoom:h.zoom-1}),a.expression.evaluate({zoom:h.zoom}),a.expression.evaluate({zoom:h.zoom+1}),h);return new Mo(this,{kind:\"constant\",value:E},h)}return new Mo(this,a.expression,h)}evaluate(a,h,A,x,E,P){if(a.kind===\"source\"){let D=a.evaluate(h,A,x,E,P);return this._calculate(D,D,D,h)}return a.kind===\"composite\"?this._calculate(a.evaluate({zoom:Math.floor(h.zoom)-1},A,x),a.evaluate({zoom:Math.floor(h.zoom)},A,x),a.evaluate({zoom:Math.floor(h.zoom)+1},A,x),h):a.value}_calculate(a,h,A,x){return x.zoom>x.zoomHistory.lastIntegerZoom?{from:a,to:h}:{from:A,to:h}}interpolate(a){return a}}class aA{constructor(a){this.specification=a}possiblyEvaluate(a,h,A,x){if(a.value!==void 0){if(a.expression.kind===\"constant\"){let E=a.expression.evaluate(h,null,{},A,x);return this._calculate(E,E,E,h)}return this._calculate(a.expression.evaluate(new un(Math.floor(h.zoom-1),h)),a.expression.evaluate(new un(Math.floor(h.zoom),h)),a.expression.evaluate(new un(Math.floor(h.zoom+1),h)),h)}}_calculate(a,h,A,x){return x.zoom>x.zoomHistory.lastIntegerZoom?{from:a,to:h}:{from:A,to:h}}interpolate(a){return a}}class Bd{constructor(a){this.specification=a}possiblyEvaluate(a,h,A,x){return!!a.expression.evaluate(h,null,{},A,x)}interpolate(){return!1}}class Hn{constructor(a){this.properties=a,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let h in a){let A=a[h];A.specification.overridable&&this.overridableProperties.push(h);let x=this.defaultPropertyValues[h]=new sA(A,void 0),E=this.defaultTransitionablePropertyValues[h]=new d0(A);this.defaultTransitioningPropertyValues[h]=E.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=x.possiblyEvaluate({})}}}Ge(\"DataDrivenProperty\",dr),Ge(\"DataConstantProperty\",nr),Ge(\"CrossFadedDataDrivenProperty\",wf),Ge(\"CrossFadedProperty\",aA),Ge(\"ColorRampProperty\",Bd);let uo=\"-transition\";class ji extends Nl{constructor(a,h){if(super(),this.id=a.id,this.type=a.type,this._featureFilter={filter:()=>!0,needGeometry:!1},a.type!==\"custom\"&&(this.metadata=a.metadata,this.minzoom=a.minzoom,this.maxzoom=a.maxzoom,a.type!==\"background\"&&(this.source=a.source,this.sourceLayer=a[\"source-layer\"],this.filter=a.filter),h.layout&&(this._unevaluatedLayout=new Nx(h.layout)),h.paint)){this._transitionablePaint=new Ah(h.paint);for(let A in a.paint)this.setPaintProperty(A,a.paint[A],{validate:!1});for(let A in a.layout)this.setLayoutProperty(A,a.layout[A],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new oA(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(a){return a===\"visibility\"?this.visibility:this._unevaluatedLayout.getValue(a)}setLayoutProperty(a,h,A={}){h!=null&&this._validate(s0,`layers.${this.id}.layout.${a}`,a,h,A)||(a!==\"visibility\"?this._unevaluatedLayout.setValue(a,h):this.visibility=h)}getPaintProperty(a){return a.endsWith(uo)?this._transitionablePaint.getTransition(a.slice(0,-11)):this._transitionablePaint.getValue(a)}setPaintProperty(a,h,A={}){if(h!=null&&this._validate(rA,`layers.${this.id}.paint.${a}`,a,h,A))return!1;if(a.endsWith(uo))return this._transitionablePaint.setTransition(a.slice(0,-11),h||void 0),!1;{let x=this._transitionablePaint._values[a],E=x.property.specification[\"property-type\"]===\"cross-faded-data-driven\",P=x.value.isDataDriven(),D=x.value;this._transitionablePaint.setValue(a,h),this._handleSpecialPaintPropertyUpdate(a);let F=this._transitionablePaint._values[a].value;return F.isDataDriven()||P||E||this._handleOverridablePaintPropertyUpdate(a,D,F)}}_handleSpecialPaintPropertyUpdate(a){}_handleOverridablePaintPropertyUpdate(a,h,A){return!1}isHidden(a){return!!(this.minzoom&&a=this.maxzoom)||this.visibility===\"none\"}updateTransitions(a){this._transitioningPaint=this._transitionablePaint.transitioned(a,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(a,h){a.getCrossfadeParameters&&(this._crossfadeParameters=a.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(a,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(a,void 0,h)}serialize(){let a={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:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(a.layout=a.layout||{},a.layout.visibility=this.visibility),le(a,(h,A)=>!(h===void 0||A===\"layout\"&&!Object.keys(h).length||A===\"paint\"&&!Object.keys(h).length))}_validate(a,h,A,x,E={}){return(!E||E.validate!==!1)&&fh(this,a.call(za,{key:h,layerType:this.type,objectKey:A,value:x,styleSpec:ee,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let a in this.paint._values){let h=this.paint.get(a);if(h instanceof Mo&&_f(h.property.specification)&&(h.value.kind===\"source\"||h.value.kind===\"composite\")&&h.value.isStateDependent)return!0}return!1}}let w_={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class mh{constructor(a,h){this._structArray=a,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class kn{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(a,h){return a._trim(),h&&(a.isTransferred=!0,h.push(a.arrayBuffer)),{length:a.length,arrayBuffer:a.arrayBuffer}}static deserialize(a){let h=Object.create(this.prototype);return h.arrayBuffer=a.arrayBuffer,h.length=a.length,h.capacity=a.arrayBuffer.byteLength/h.bytesPerElement,h._refreshViews(),h}_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(a){this.reserve(a),this.length=a}reserve(a){if(a>this.capacity){this.capacity=Math.max(a,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}_refreshViews(){throw new Error(\"_refreshViews() must be implemented by each concrete StructArray layout\")}}function wn(u,a=1){let h=0,A=0;return{members:u.map(x=>{let E=w_[x.type].BYTES_PER_ELEMENT,P=h=Sf(h,Math.max(a,E)),D=x.components||1;return A=Math.max(A,E),h+=E*D,{name:x.name,type:x.type,components:D,offset:P}}),size:Sf(h,Math.max(A,a)),alignment:a}}function Sf(u,a){return Math.ceil(u/a)*a}class Es extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h){let A=this.length;return this.resize(A+1),this.emplace(A,a,h)}emplace(a,h,A){let x=2*a;return this.int16[x+0]=h,this.int16[x+1]=A,a}}Es.prototype.bytesPerElement=4,Ge(\"StructArrayLayout2i4\",Es);class gh extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A){let x=this.length;return this.resize(x+1),this.emplace(x,a,h,A)}emplace(a,h,A,x){let E=3*a;return this.int16[E+0]=h,this.int16[E+1]=A,this.int16[E+2]=x,a}}gh.prototype.bytesPerElement=6,Ge(\"StructArrayLayout3i6\",gh);class Wo extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A,x){let E=this.length;return this.resize(E+1),this.emplace(E,a,h,A,x)}emplace(a,h,A,x,E){let P=4*a;return this.int16[P+0]=h,this.int16[P+1]=A,this.int16[P+2]=x,this.int16[P+3]=E,a}}Wo.prototype.bytesPerElement=8,Ge(\"StructArrayLayout4i8\",Wo);class p0 extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E,P){let D=this.length;return this.resize(D+1),this.emplace(D,a,h,A,x,E,P)}emplace(a,h,A,x,E,P,D){let F=6*a;return this.int16[F+0]=h,this.int16[F+1]=A,this.int16[F+2]=x,this.int16[F+3]=E,this.int16[F+4]=P,this.int16[F+5]=D,a}}p0.prototype.bytesPerElement=12,Ge(\"StructArrayLayout2i4i12\",p0);class Fd extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E,P){let D=this.length;return this.resize(D+1),this.emplace(D,a,h,A,x,E,P)}emplace(a,h,A,x,E,P,D){let F=4*a,V=8*a;return this.int16[F+0]=h,this.int16[F+1]=A,this.uint8[V+4]=x,this.uint8[V+5]=E,this.uint8[V+6]=P,this.uint8[V+7]=D,a}}Fd.prototype.bytesPerElement=8,Ge(\"StructArrayLayout2i4ub8\",Fd);class Tf extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h){let A=this.length;return this.resize(A+1),this.emplace(A,a,h)}emplace(a,h,A){let x=2*a;return this.float32[x+0]=h,this.float32[x+1]=A,a}}Tf.prototype.bytesPerElement=8,Ge(\"StructArrayLayout2f8\",Tf);class Ho extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E,P,D,F,V,q){let X=this.length;return this.resize(X+1),this.emplace(X,a,h,A,x,E,P,D,F,V,q)}emplace(a,h,A,x,E,P,D,F,V,q,X){let rt=10*a;return this.uint16[rt+0]=h,this.uint16[rt+1]=A,this.uint16[rt+2]=x,this.uint16[rt+3]=E,this.uint16[rt+4]=P,this.uint16[rt+5]=D,this.uint16[rt+6]=F,this.uint16[rt+7]=V,this.uint16[rt+8]=q,this.uint16[rt+9]=X,a}}Ho.prototype.bytesPerElement=20,Ge(\"StructArrayLayout10ui20\",Ho);class lA extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E,P,D,F,V,q,X,rt){let at=this.length;return this.resize(at+1),this.emplace(at,a,h,A,x,E,P,D,F,V,q,X,rt)}emplace(a,h,A,x,E,P,D,F,V,q,X,rt,at){let ct=12*a;return this.int16[ct+0]=h,this.int16[ct+1]=A,this.int16[ct+2]=x,this.int16[ct+3]=E,this.uint16[ct+4]=P,this.uint16[ct+5]=D,this.uint16[ct+6]=F,this.uint16[ct+7]=V,this.int16[ct+8]=q,this.int16[ct+9]=X,this.int16[ct+10]=rt,this.int16[ct+11]=at,a}}lA.prototype.bytesPerElement=24,Ge(\"StructArrayLayout4i4ui4i24\",lA);class bi extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,A){let x=this.length;return this.resize(x+1),this.emplace(x,a,h,A)}emplace(a,h,A,x){let E=3*a;return this.float32[E+0]=h,this.float32[E+1]=A,this.float32[E+2]=x,a}}bi.prototype.bytesPerElement=12,Ge(\"StructArrayLayout3f12\",bi);class T extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(a){let h=this.length;return this.resize(h+1),this.emplace(h,a)}emplace(a,h){return this.uint32[1*a+0]=h,a}}T.prototype.bytesPerElement=4,Ge(\"StructArrayLayout1ul4\",T);class l extends kn{_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(a,h,A,x,E,P,D,F,V){let q=this.length;return this.resize(q+1),this.emplace(q,a,h,A,x,E,P,D,F,V)}emplace(a,h,A,x,E,P,D,F,V,q){let X=10*a,rt=5*a;return this.int16[X+0]=h,this.int16[X+1]=A,this.int16[X+2]=x,this.int16[X+3]=E,this.int16[X+4]=P,this.int16[X+5]=D,this.uint32[rt+3]=F,this.uint16[X+8]=V,this.uint16[X+9]=q,a}}l.prototype.bytesPerElement=20,Ge(\"StructArrayLayout6i1ul2ui20\",l);class d extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E,P){let D=this.length;return this.resize(D+1),this.emplace(D,a,h,A,x,E,P)}emplace(a,h,A,x,E,P,D){let F=6*a;return this.int16[F+0]=h,this.int16[F+1]=A,this.int16[F+2]=x,this.int16[F+3]=E,this.int16[F+4]=P,this.int16[F+5]=D,a}}d.prototype.bytesPerElement=12,Ge(\"StructArrayLayout2i2i2i12\",d);class v extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,h,A,x,E){let P=this.length;return this.resize(P+1),this.emplace(P,a,h,A,x,E)}emplace(a,h,A,x,E,P){let D=4*a,F=8*a;return this.float32[D+0]=h,this.float32[D+1]=A,this.float32[D+2]=x,this.int16[F+6]=E,this.int16[F+7]=P,a}}v.prototype.bytesPerElement=16,Ge(\"StructArrayLayout2f1f2i16\",v);class b extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,A,x){let E=this.length;return this.resize(E+1),this.emplace(E,a,h,A,x)}emplace(a,h,A,x,E){let P=12*a,D=3*a;return this.uint8[P+0]=h,this.uint8[P+1]=A,this.float32[D+1]=x,this.float32[D+2]=E,a}}b.prototype.bytesPerElement=12,Ge(\"StructArrayLayout2ub2f12\",b);class M extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,A){let x=this.length;return this.resize(x+1),this.emplace(x,a,h,A)}emplace(a,h,A,x){let E=3*a;return this.uint16[E+0]=h,this.uint16[E+1]=A,this.uint16[E+2]=x,a}}M.prototype.bytesPerElement=6,Ge(\"StructArrayLayout3ui6\",M);class O extends kn{_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(a,h,A,x,E,P,D,F,V,q,X,rt,at,ct,mt,bt,Pt){let jt=this.length;return this.resize(jt+1),this.emplace(jt,a,h,A,x,E,P,D,F,V,q,X,rt,at,ct,mt,bt,Pt)}emplace(a,h,A,x,E,P,D,F,V,q,X,rt,at,ct,mt,bt,Pt,jt){let Rt=24*a,Gt=12*a,Yt=48*a;return this.int16[Rt+0]=h,this.int16[Rt+1]=A,this.uint16[Rt+2]=x,this.uint16[Rt+3]=E,this.uint32[Gt+2]=P,this.uint32[Gt+3]=D,this.uint32[Gt+4]=F,this.uint16[Rt+10]=V,this.uint16[Rt+11]=q,this.uint16[Rt+12]=X,this.float32[Gt+7]=rt,this.float32[Gt+8]=at,this.uint8[Yt+36]=ct,this.uint8[Yt+37]=mt,this.uint8[Yt+38]=bt,this.uint32[Gt+10]=Pt,this.int16[Rt+22]=jt,a}}O.prototype.bytesPerElement=48,Ge(\"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48\",O);class B extends kn{_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(a,h,A,x,E,P,D,F,V,q,X,rt,at,ct,mt,bt,Pt,jt,Rt,Gt,Yt,ce,Ne,ir,Fe,Re,Me,Ye){let Ie=this.length;return this.resize(Ie+1),this.emplace(Ie,a,h,A,x,E,P,D,F,V,q,X,rt,at,ct,mt,bt,Pt,jt,Rt,Gt,Yt,ce,Ne,ir,Fe,Re,Me,Ye)}emplace(a,h,A,x,E,P,D,F,V,q,X,rt,at,ct,mt,bt,Pt,jt,Rt,Gt,Yt,ce,Ne,ir,Fe,Re,Me,Ye,Ie){let Ae=32*a,hr=16*a;return this.int16[Ae+0]=h,this.int16[Ae+1]=A,this.int16[Ae+2]=x,this.int16[Ae+3]=E,this.int16[Ae+4]=P,this.int16[Ae+5]=D,this.int16[Ae+6]=F,this.int16[Ae+7]=V,this.uint16[Ae+8]=q,this.uint16[Ae+9]=X,this.uint16[Ae+10]=rt,this.uint16[Ae+11]=at,this.uint16[Ae+12]=ct,this.uint16[Ae+13]=mt,this.uint16[Ae+14]=bt,this.uint16[Ae+15]=Pt,this.uint16[Ae+16]=jt,this.uint16[Ae+17]=Rt,this.uint16[Ae+18]=Gt,this.uint16[Ae+19]=Yt,this.uint16[Ae+20]=ce,this.uint16[Ae+21]=Ne,this.uint16[Ae+22]=ir,this.uint32[hr+12]=Fe,this.float32[hr+13]=Re,this.float32[hr+14]=Me,this.uint16[Ae+30]=Ye,this.uint16[Ae+31]=Ie,a}}B.prototype.bytesPerElement=64,Ge(\"StructArrayLayout8i15ui1ul2f2ui64\",B);class U extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a){let h=this.length;return this.resize(h+1),this.emplace(h,a)}emplace(a,h){return this.float32[1*a+0]=h,a}}U.prototype.bytesPerElement=4,Ge(\"StructArrayLayout1f4\",U);class W extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,A){let x=this.length;return this.resize(x+1),this.emplace(x,a,h,A)}emplace(a,h,A,x){let E=3*a;return this.uint16[6*a+0]=h,this.float32[E+1]=A,this.float32[E+2]=x,a}}W.prototype.bytesPerElement=12,Ge(\"StructArrayLayout1ui2f12\",W);class Z extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h,A){let x=this.length;return this.resize(x+1),this.emplace(x,a,h,A)}emplace(a,h,A,x){let E=4*a;return this.uint32[2*a+0]=h,this.uint16[E+2]=A,this.uint16[E+3]=x,a}}Z.prototype.bytesPerElement=8,Ge(\"StructArrayLayout1ul2ui8\",Z);class $ extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,h){let A=this.length;return this.resize(A+1),this.emplace(A,a,h)}emplace(a,h,A){let x=2*a;return this.uint16[x+0]=h,this.uint16[x+1]=A,a}}$.prototype.bytesPerElement=4,Ge(\"StructArrayLayout2ui4\",$);class st extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a){let h=this.length;return this.resize(h+1),this.emplace(h,a)}emplace(a,h){return this.uint16[1*a+0]=h,a}}st.prototype.bytesPerElement=2,Ge(\"StructArrayLayout1ui2\",st);class At extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,h,A,x){let E=this.length;return this.resize(E+1),this.emplace(E,a,h,A,x)}emplace(a,h,A,x,E){let P=4*a;return this.float32[P+0]=h,this.float32[P+1]=A,this.float32[P+2]=x,this.float32[P+3]=E,a}}At.prototype.bytesPerElement=16,Ge(\"StructArrayLayout4f16\",At);class pt extends mh{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 w(this.anchorPointX,this.anchorPointY)}}pt.prototype.size=20;class yt extends l{get(a){return new pt(this,a)}}Ge(\"CollisionBoxArray\",yt);class dt extends mh{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(a){this._structArray.uint8[this._pos1+37]=a}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(a){this._structArray.uint8[this._pos1+38]=a}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(a){this._structArray.uint32[this._pos4+10]=a}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}dt.prototype.size=48;class Ft extends O{get(a){return new dt(this,a)}}Ge(\"PlacedSymbolArray\",Ft);class Ht extends mh{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(a){this._structArray.uint32[this._pos4+12]=a}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]}}Ht.prototype.size=64;class St extends B{get(a){return new Ht(this,a)}}Ge(\"SymbolInstanceArray\",St);class Bt extends U{getoffsetX(a){return this.float32[1*a+0]}}Ge(\"GlyphOffsetArray\",Bt);class Qt extends gh{getx(a){return this.int16[3*a+0]}gety(a){return this.int16[3*a+1]}gettileUnitDistanceFromAnchor(a){return this.int16[3*a+2]}}Ge(\"SymbolLineVertexArray\",Qt);class $t extends mh{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]}}$t.prototype.size=12;class oe extends W{get(a){return new $t(this,a)}}Ge(\"TextAnchorOffsetArray\",oe);class pe extends mh{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]}}pe.prototype.size=8;class he extends Z{get(a){return new pe(this,a)}}Ge(\"FeatureIndexArray\",he);class be extends Es{}class Ze extends Es{}class Kr extends Es{}class Ee extends p0{}class pr extends Fd{}class tr extends Tf{}class Gi extends Ho{}class Jr extends lA{}class Vr extends bi{}class ei extends T{}class On extends d{}class tn extends b{}class Gs extends M{}class hs extends ${}let Bn=wn([{name:\"a_pos\",components:2,type:\"Int16\"}],4),{members:qo}=Bn;class jr{constructor(a=[]){this.segments=a}prepareSegment(a,h,A,x){let E=this.segments[this.segments.length-1];return a>jr.MAX_VERTEX_ARRAY_LENGTH&&Ke(`Max vertices per segment is ${jr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${a}`),(!E||E.vertexLength+a>jr.MAX_VERTEX_ARRAY_LENGTH||E.sortKey!==x)&&(E={vertexOffset:h.length,primitiveOffset:A.length,vertexLength:0,primitiveLength:0},x!==void 0&&(E.sortKey=x),this.segments.push(E)),E}get(){return this.segments}destroy(){for(let a of this.segments)for(let h in a.vaos)a.vaos[h].destroy()}static simpleSegment(a,h,A,x){return new jr([{vertexOffset:a,primitiveOffset:h,vertexLength:A,primitiveLength:x,vaos:{},sortKey:0}])}}function ql(u,a){return 256*(u=ut(Math.floor(u),0,255))+ut(Math.floor(a),0,255)}jr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ge(\"SegmentVector\",jr);let Zl=wn([{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\"}]);var yu={exports:{}},vu={exports:{}};vu.exports=function(u,a){var h,A,x,E,P,D,F,V;for(A=u.length-(h=3&u.length),x=a,P=3432918353,D=461845907,V=0;V>>16)*P&65535)<<16)&4294967295)<<15|F>>>17))*D+(((F>>>16)*D&65535)<<16)&4294967295)<<13|x>>>19))+((5*(x>>>16)&65535)<<16)&4294967295))+((58964+(E>>>16)&65535)<<16);switch(F=0,h){case 3:F^=(255&u.charCodeAt(V+2))<<16;case 2:F^=(255&u.charCodeAt(V+1))<<8;case 1:x^=F=(65535&(F=(F=(65535&(F^=255&u.charCodeAt(V)))*P+(((F>>>16)*P&65535)<<16)&4294967295)<<15|F>>>17))*D+(((F>>>16)*D&65535)<<16)&4294967295}return x^=u.length,x=2246822507*(65535&(x^=x>>>16))+((2246822507*(x>>>16)&65535)<<16)&4294967295,x=3266489909*(65535&(x^=x>>>13))+((3266489909*(x>>>16)&65535)<<16)&4294967295,(x^=x>>>16)>>>0};var _h=vu.exports,Ws={exports:{}};Ws.exports=function(u,a){for(var h,A=u.length,x=a^A,E=0;A>=4;)h=1540483477*(65535&(h=255&u.charCodeAt(E)|(255&u.charCodeAt(++E))<<8|(255&u.charCodeAt(++E))<<16|(255&u.charCodeAt(++E))<<24))+((1540483477*(h>>>16)&65535)<<16),x=1540483477*(65535&x)+((1540483477*(x>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),A-=4,++E;switch(A){case 3:x^=(255&u.charCodeAt(E+2))<<16;case 2:x^=(255&u.charCodeAt(E+1))<<8;case 1:x=1540483477*(65535&(x^=255&u.charCodeAt(E)))+((1540483477*(x>>>16)&65535)<<16)}return x=1540483477*(65535&(x^=x>>>13))+((1540483477*(x>>>16)&65535)<<16),(x^=x>>>15)>>>0};var Ps=_h,Eo=Ws.exports;yu.exports=Ps,yu.exports.murmur3=Ps,yu.exports.murmur2=Eo;var yh=c(yu.exports);class Fn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(a,h,A,x){this.ids.push(fs(a)),this.positions.push(h,A,x)}getPositions(a){if(!this.indexed)throw new Error(\"Trying to get index, but feature positions are not indexed\");let h=fs(a),A=0,x=this.ids.length-1;for(;A>1;this.ids[P]>=h?x=P:A=P+1}let E=[];for(;this.ids[A]===h;)E.push({index:this.positions[3*A],start:this.positions[3*A+1],end:this.positions[3*A+2]}),A++;return E}static serialize(a,h){let A=new Float64Array(a.ids),x=new Uint32Array(a.positions);return Zo(A,x,0,A.length-1),h&&h.push(A.buffer,x.buffer),{ids:A,positions:x}}static deserialize(a){let h=new Fn;return h.ids=a.ids,h.positions=a.positions,h.indexed=!0,h}}function fs(u){let a=+u;return!isNaN(a)&&a<=Number.MAX_SAFE_INTEGER?a:yh(String(u))}function Zo(u,a,h,A){for(;h>1],E=h-1,P=A+1;for(;;){do E++;while(u[E]x);if(E>=P)break;_n(u,E,P),_n(a,3*E,3*P),_n(a,3*E+1,3*P+1),_n(a,3*E+2,3*P+2)}P-h`u_${x}`),this.type=A}setUniform(a,h,A){a.set(A.constantOr(this.value))}getBinding(a,h,A){return this.type===\"color\"?new S_(a,h):new Gr(a,h)}}class Yo{constructor(a,h){this.uniformNames=h.map(A=>`u_${A}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(a,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=a.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=a.tlbr}setUniform(a,h,A,x){let E=x===\"u_pattern_to\"?this.patternTo:x===\"u_pattern_from\"?this.patternFrom:x===\"u_pixel_ratio_to\"?this.pixelRatioTo:x===\"u_pixel_ratio_from\"?this.pixelRatioFrom:null;E&&a.set(E)}getBinding(a,h,A){return A.substr(0,9)===\"u_pattern\"?new Ua(a,h):new Gr(a,h)}}class me{constructor(a,h,A,x){this.expression=a,this.type=A,this.maxValue=0,this.paintVertexAttributes=h.map(E=>({name:`a_${E}`,type:\"Float32\",components:A===\"color\"?2:1,offset:0})),this.paintVertexArray=new x}populatePaintArray(a,h,A,x,E){let P=this.paintVertexArray.length,D=this.expression.evaluate(new un(0),h,{},x,[],E);this.paintVertexArray.resize(a),this._setPaintValue(P,a,D)}updatePaintArray(a,h,A,x){let E=this.expression.evaluate({zoom:0},A,x);this._setPaintValue(a,h,E)}_setPaintValue(a,h,A){if(this.type===\"color\"){let x=cA(A);for(let E=a;E`u_${D}_t`),this.type=A,this.useIntegerZoom=x,this.zoom=E,this.maxValue=0,this.paintVertexAttributes=h.map(D=>({name:`a_${D}`,type:\"Float32\",components:A===\"color\"?4:2,offset:0})),this.paintVertexArray=new P}populatePaintArray(a,h,A,x,E){let P=this.expression.evaluate(new un(this.zoom),h,{},x,[],E),D=this.expression.evaluate(new un(this.zoom+1),h,{},x,[],E),F=this.paintVertexArray.length;this.paintVertexArray.resize(a),this._setPaintValue(F,a,P,D)}updatePaintArray(a,h,A,x){let E=this.expression.evaluate({zoom:this.zoom},A,x),P=this.expression.evaluate({zoom:this.zoom+1},A,x);this._setPaintValue(a,h,E,P)}_setPaintValue(a,h,A,x){if(this.type===\"color\"){let E=cA(A),P=cA(x);for(let D=a;D`#define HAS_UNIFORM_${x}`))}return a}getBinderAttributes(){let a=[];for(let h in this.binders){let A=this.binders[h];if(A instanceof me||A instanceof ke)for(let x=0;x!0){this.programConfigurations={};for(let x of a)this.programConfigurations[x.id]=new Mf(x,h,A);this.needsUpload=!1,this._featureMap=new Fn,this._bufferOffset=0}populatePaintArrays(a,h,A,x,E,P){for(let D in this.programConfigurations)this.programConfigurations[D].populatePaintArrays(a,h,x,E,P);h.id!==void 0&&this._featureMap.add(h.id,A,this._bufferOffset,a),this._bufferOffset=a,this.needsUpload=!0}updatePaintArrays(a,h,A,x){for(let E of A)this.needsUpload=this.programConfigurations[E.id].updatePaintArrays(a,this._featureMap,h,E,x)||this.needsUpload}get(a){return this.programConfigurations[a]}upload(a){if(this.needsUpload){for(let h in this.programConfigurations)this.programConfigurations[h].upload(a);this.needsUpload=!1}}destroy(){for(let a in this.programConfigurations)this.programConfigurations[a].destroy()}}function Fc(u,a){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-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\"]}[u]||[u.replace(`${a}-`,\"\").replace(/-/g,\"_\")]}function Ux(u,a,h){let A={color:{source:Tf,composite:At},number:{source:U,composite:Tf}},x=function(E){return{\"line-pattern\":{source:Gi,composite:Gi},\"fill-pattern\":{source:Gi,composite:Gi},\"fill-extrusion-pattern\":{source:Gi,composite:Gi}}[E]}(u);return x&&x[h]||A[a][h]}Ge(\"ConstantBinder\",Yl),Ge(\"CrossFadedConstantBinder\",Yo),Ge(\"SourceExpressionBinder\",me),Ge(\"CrossFadedCompositeBinder\",ml),Ge(\"CompositeExpressionBinder\",ke),Ge(\"ProgramConfiguration\",Mf,{omit:[\"_buffers\"]}),Ge(\"ProgramConfigurationSet\",Va);let en=8192,p=Math.pow(2,14)-1,m=-p-1;function y(u){let a=en/u.extent,h=u.loadGeometry();for(let A=0;AP.x+1||FP.y+1)&&Ke(\"Geometry exceeds allowed extent, reduce your vector tile buffer size\")}}return h}function S(u,a){return{type:u.type,id:u.id,properties:u.properties,geometry:a?y(u):[]}}function C(u,a,h,A,x){u.emplaceBack(2*a+(A+1)/2,2*h+(x+1)/2)}class k{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(h=>h.id),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new Ze,this.indexArray=new Gs,this.segments=new jr,this.programConfigurations=new Va(a.layers,a.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,A){let x=this.layers[0],E=[],P=null,D=!1;x.type===\"circle\"&&(P=x.layout.get(\"circle-sort-key\"),D=!P.isConstant());for(let{feature:F,id:V,index:q,sourceLayerIndex:X}of a){let rt=this.layers[0]._featureFilter.needGeometry,at=S(F,rt);if(!this.layers[0]._featureFilter.filter(new un(this.zoom),at,A))continue;let ct=D?P.evaluate(at,{},A):void 0,mt={id:V,properties:F.properties,type:F.type,sourceLayerIndex:X,index:q,geometry:rt?at.geometry:y(F),patterns:{},sortKey:ct};E.push(mt)}D&&E.sort((F,V)=>F.sortKey-V.sortKey);for(let F of E){let{geometry:V,index:q,sourceLayerIndex:X}=F,rt=a[q].feature;this.addFeature(F,V,q,A),h.featureIndex.insert(rt,V,q,X,this.index)}}update(a,h,A){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,A)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,qo),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(a,h,A,x){for(let E of h)for(let P of E){let D=P.x,F=P.y;if(D<0||D>=en||F<0||F>=en)continue;let V=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,a.sortKey),q=V.vertexLength;C(this.layoutVertexArray,D,F,-1,-1),C(this.layoutVertexArray,D,F,1,-1),C(this.layoutVertexArray,D,F,1,1),C(this.layoutVertexArray,D,F,-1,1),this.indexArray.emplaceBack(q,q+1,q+2),this.indexArray.emplaceBack(q,q+3,q+2),V.vertexLength+=4,V.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,A,{},x)}}function L(u,a){for(let h=0;h1){if(ot(u,a))return!0;for(let A=0;A1?h:h.sub(a)._mult(x)._add(a))}function re(u,a){let h,A,x,E=!1;for(let P=0;Pa.y!=x.y>a.y&&a.x<(x.x-A.x)*(a.y-A.y)/(x.y-A.y)+A.x&&(E=!E)}return E}function ne(u,a){let h=!1;for(let A=0,x=u.length-1;Aa.y!=P.y>a.y&&a.x<(P.x-E.x)*(a.y-E.y)/(P.y-E.y)+E.x&&(h=!h)}return h}function Le(u,a,h){let A=h[0],x=h[2];if(u.xx.x&&a.x>x.x||u.yx.y&&a.y>x.y)return!1;let E=rr(u,a,h[0]);return E!==rr(u,a,h[1])||E!==rr(u,a,h[2])||E!==rr(u,a,h[3])}function We(u,a,h){let A=a.paint.get(u).value;return A.kind===\"constant\"?A.value:h.programConfigurations.get(a.id).getMaxValue(u)}function te(u){return Math.sqrt(u[0]*u[0]+u[1]*u[1])}function _e(u,a,h,A,x){if(!a[0]&&!a[1])return u;let E=w.convert(a)._mult(x);h===\"viewport\"&&E._rotate(-A);let P=[];for(let D=0;Dyn(bt,mt))}(V,F),at=X?q*D:q;for(let ct of x)for(let mt of ct){let bt=X?mt:yn(mt,F),Pt=at,jt=Pi([],[mt.x,mt.y,0,1],F);if(this.paint.get(\"circle-pitch-scale\")===\"viewport\"&&this.paint.get(\"circle-pitch-alignment\")===\"map\"?Pt*=jt[3]/P.cameraToCenterDistance:this.paint.get(\"circle-pitch-scale\")===\"map\"&&this.paint.get(\"circle-pitch-alignment\")===\"viewport\"&&(Pt*=P.cameraToCenterDistance/jt[3]),z(rt,bt,Pt))return!0}return!1}}function yn(u,a){let h=Pi([],[u.x,u.y,0,1],a);return new w(h[0]/h[3],h[1]/h[3])}class Or extends k{}let zF;Ge(\"HeatmapBucket\",Or,{omit:[\"layers\"]});var VX={get paint(){return zF=zF||new Hn({\"heatmap-radius\":new dr(ee.paint_heatmap[\"heatmap-radius\"]),\"heatmap-weight\":new dr(ee.paint_heatmap[\"heatmap-weight\"]),\"heatmap-intensity\":new nr(ee.paint_heatmap[\"heatmap-intensity\"]),\"heatmap-color\":new Bd(ee.paint_heatmap[\"heatmap-color\"]),\"heatmap-opacity\":new nr(ee.paint_heatmap[\"heatmap-opacity\"])})}};function fC(u,{width:a,height:h},A,x){if(x){if(x instanceof Uint8ClampedArray)x=new Uint8Array(x.buffer);else if(x.length!==a*h*A)throw new RangeError(`mismatched image size. expected: ${x.length} but got: ${a*h*A}`)}else x=new Uint8Array(a*h*A);return u.width=a,u.height=h,u.data=x,u}function NF(u,{width:a,height:h},A){if(a===u.width&&h===u.height)return;let x=fC({},{width:a,height:h},A);dC(u,x,{x:0,y:0},{x:0,y:0},{width:Math.min(u.width,a),height:Math.min(u.height,h)},A),u.width=a,u.height=h,u.data=x.data}function dC(u,a,h,A,x,E){if(x.width===0||x.height===0)return a;if(x.width>u.width||x.height>u.height||h.x>u.width-x.width||h.y>u.height-x.height)throw new RangeError(\"out of range source coordinates for image copy\");if(x.width>a.width||x.height>a.height||A.x>a.width-x.width||A.y>a.height-x.height)throw new RangeError(\"out of range destination coordinates for image copy\");let P=u.data,D=a.data;if(P===D)throw new Error(\"srcData equals dstData, so image is already copied\");for(let F=0;F{a[u.evaluationKey]=F;let V=u.expression.evaluate(a);x.data[P+D+0]=Math.floor(255*V.r/V.a),x.data[P+D+1]=Math.floor(255*V.g/V.a),x.data[P+D+2]=Math.floor(255*V.b/V.a),x.data[P+D+3]=Math.floor(255*V.a)};if(u.clips)for(let P=0,D=0;P80*h){A=E=u[0],x=P=u[1];for(var ct=h;ctE&&(E=D),F>P&&(P=F);V=(V=Math.max(E-A,P-x))!==0?32767/V:0}return jx(rt,at,h,A,x,V,0),at}function jF(u,a,h,A,x){var E,P;if(x===gC(u,a,h,A)>0)for(E=a;E=a;E-=A)P=HF(E,u[E],u[E+1],P);return P&&JS(P,P.next)&&(Wx(P),P=P.next),P}function A0(u,a){if(!u)return u;a||(a=u);var h,A=u;do if(h=!1,A.steiner||!JS(A,A.next)&&ds(A.prev,A,A.next)!==0)A=A.next;else{if(Wx(A),(A=a=A.prev)===A.next)break;h=!0}while(h||A!==a);return a}function jx(u,a,h,A,x,E,P){if(u){!P&&E&&function(q,X,rt,at){var ct=q;do ct.z===0&&(ct.z=AC(ct.x,ct.y,X,rt,at)),ct.prevZ=ct.prev,ct.nextZ=ct.next,ct=ct.next;while(ct!==q);ct.prevZ.nextZ=null,ct.prevZ=null,function(mt){var bt,Pt,jt,Rt,Gt,Yt,ce,Ne,ir=1;do{for(Pt=mt,mt=null,Gt=null,Yt=0;Pt;){for(Yt++,jt=Pt,ce=0,bt=0;bt0||Ne>0&&jt;)ce!==0&&(Ne===0||!jt||Pt.z<=jt.z)?(Rt=Pt,Pt=Pt.nextZ,ce--):(Rt=jt,jt=jt.nextZ,Ne--),Gt?Gt.nextZ=Rt:mt=Rt,Rt.prevZ=Gt,Gt=Rt;Pt=jt}Gt.nextZ=null,ir*=2}while(Yt>1)}(ct)}(u,A,x,E);for(var D,F,V=u;u.prev!==u.next;)if(D=u.prev,F=u.next,E?YX(u,A,x,E):ZX(u))a.push(D.i/h|0),a.push(u.i/h|0),a.push(F.i/h|0),Wx(u),u=F.next,V=F.next;else if((u=F)===V){P?P===1?jx(u=QX(A0(u),a,h),a,h,A,x,E,2):P===2&&$X(u,a,h,A,x,E):jx(A0(u),a,h,A,x,E,1);break}}}function ZX(u){var a=u.prev,h=u,A=u.next;if(ds(a,h,A)>=0)return!1;for(var x=a.x,E=h.x,P=A.x,D=a.y,F=h.y,V=A.y,q=xE?x>P?x:P:E>P?E:P,at=D>F?D>V?D:V:F>V?F:V,ct=A.next;ct!==a;){if(ct.x>=q&&ct.x<=rt&&ct.y>=X&&ct.y<=at&&T_(x,D,E,F,P,V,ct.x,ct.y)&&ds(ct.prev,ct,ct.next)>=0)return!1;ct=ct.next}return!0}function YX(u,a,h,A){var x=u.prev,E=u,P=u.next;if(ds(x,E,P)>=0)return!1;for(var D=x.x,F=E.x,V=P.x,q=x.y,X=E.y,rt=P.y,at=DF?D>V?D:V:F>V?F:V,bt=q>X?q>rt?q:rt:X>rt?X:rt,Pt=AC(at,ct,a,h,A),jt=AC(mt,bt,a,h,A),Rt=u.prevZ,Gt=u.nextZ;Rt&&Rt.z>=Pt&&Gt&&Gt.z<=jt;){if(Rt.x>=at&&Rt.x<=mt&&Rt.y>=ct&&Rt.y<=bt&&Rt!==x&&Rt!==P&&T_(D,q,F,X,V,rt,Rt.x,Rt.y)&&ds(Rt.prev,Rt,Rt.next)>=0||(Rt=Rt.prevZ,Gt.x>=at&&Gt.x<=mt&&Gt.y>=ct&&Gt.y<=bt&&Gt!==x&&Gt!==P&&T_(D,q,F,X,V,rt,Gt.x,Gt.y)&&ds(Gt.prev,Gt,Gt.next)>=0))return!1;Gt=Gt.nextZ}for(;Rt&&Rt.z>=Pt;){if(Rt.x>=at&&Rt.x<=mt&&Rt.y>=ct&&Rt.y<=bt&&Rt!==x&&Rt!==P&&T_(D,q,F,X,V,rt,Rt.x,Rt.y)&&ds(Rt.prev,Rt,Rt.next)>=0)return!1;Rt=Rt.prevZ}for(;Gt&&Gt.z<=jt;){if(Gt.x>=at&&Gt.x<=mt&&Gt.y>=ct&&Gt.y<=bt&&Gt!==x&&Gt!==P&&T_(D,q,F,X,V,rt,Gt.x,Gt.y)&&ds(Gt.prev,Gt,Gt.next)>=0)return!1;Gt=Gt.nextZ}return!0}function QX(u,a,h){var A=u;do{var x=A.prev,E=A.next.next;!JS(x,E)&&GF(x,A,A.next,E)&&Gx(x,E)&&Gx(E,x)&&(a.push(x.i/h|0),a.push(A.i/h|0),a.push(E.i/h|0),Wx(A),Wx(A.next),A=u=E),A=A.next}while(A!==u);return A0(A)}function $X(u,a,h,A,x,E){var P=u;do{for(var D=P.next.next;D!==P.prev;){if(P.i!==D.i&&eK(P,D)){var F=WF(P,D);return P=A0(P,P.next),F=A0(F,F.next),jx(P,a,h,A,x,E,0),void jx(F,a,h,A,x,E,0)}D=D.next}P=P.next}while(P!==u)}function XX(u,a){return u.x-a.x}function KX(u,a){var h=function(x,E){var P,D=E,F=x.x,V=x.y,q=-1/0;do{if(V<=D.y&&V>=D.next.y&&D.next.y!==D.y){var X=D.x+(V-D.y)*(D.next.x-D.x)/(D.next.y-D.y);if(X<=F&&X>q&&(q=X,P=D.x=D.x&&D.x>=ct&&F!==D.x&&T_(VP.x||D.x===P.x&&JX(P,D)))&&(P=D,bt=rt)),D=D.next;while(D!==at);return P}(u,a);if(!h)return a;var A=WF(h,u);return A0(A,A.next),A0(h,h.next)}function JX(u,a){return ds(u.prev,u,a.prev)<0&&ds(a.next,u,u.next)<0}function AC(u,a,h,A,x){return(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=(u-h)*x|0)|u<<8))|u<<4))|u<<2))|u<<1))|(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=(a-A)*x|0)|a<<8))|a<<4))|a<<2))|a<<1))<<1}function tK(u){var a=u,h=u;do(a.x=(u-P)*(E-D)&&(u-P)*(A-D)>=(h-P)*(a-D)&&(h-P)*(E-D)>=(x-P)*(A-D)}function eK(u,a){return u.next.i!==a.i&&u.prev.i!==a.i&&!function(h,A){var x=h;do{if(x.i!==h.i&&x.next.i!==h.i&&x.i!==A.i&&x.next.i!==A.i&&GF(x,x.next,h,A))return!0;x=x.next}while(x!==h);return!1}(u,a)&&(Gx(u,a)&&Gx(a,u)&&function(h,A){var x=h,E=!1,P=(h.x+A.x)/2,D=(h.y+A.y)/2;do x.y>D!=x.next.y>D&&x.next.y!==x.y&&P<(x.next.x-x.x)*(D-x.y)/(x.next.y-x.y)+x.x&&(E=!E),x=x.next;while(x!==h);return E}(u,a)&&(ds(u.prev,u,a.prev)||ds(u,a.prev,a))||JS(u,a)&&ds(u.prev,u,u.next)>0&&ds(a.prev,a,a.next)>0)}function ds(u,a,h){return(a.y-u.y)*(h.x-a.x)-(a.x-u.x)*(h.y-a.y)}function JS(u,a){return u.x===a.x&&u.y===a.y}function GF(u,a,h,A){var x=eT(ds(u,a,h)),E=eT(ds(u,a,A)),P=eT(ds(h,A,u)),D=eT(ds(h,A,a));return x!==E&&P!==D||!(x!==0||!tT(u,h,a))||!(E!==0||!tT(u,A,a))||!(P!==0||!tT(h,u,A))||!(D!==0||!tT(h,a,A))}function tT(u,a,h){return a.x<=Math.max(u.x,h.x)&&a.x>=Math.min(u.x,h.x)&&a.y<=Math.max(u.y,h.y)&&a.y>=Math.min(u.y,h.y)}function eT(u){return u>0?1:u<0?-1:0}function Gx(u,a){return ds(u.prev,u,u.next)<0?ds(u,a,u.next)>=0&&ds(u,u.prev,a)>=0:ds(u,a,u.prev)<0||ds(u,u.next,a)<0}function WF(u,a){var h=new mC(u.i,u.x,u.y),A=new mC(a.i,a.x,a.y),x=u.next,E=a.prev;return u.next=a,a.prev=u,h.next=x,x.prev=h,A.next=h,h.prev=A,E.next=A,A.prev=E,A}function HF(u,a,h,A){var x=new mC(u,a,h);return A?(x.next=A.next,x.prev=A,A.next.prev=x,A.next=x):(x.prev=x,x.next=x),x}function Wx(u){u.next.prev=u.prev,u.prev.next=u.next,u.prevZ&&(u.prevZ.nextZ=u.nextZ),u.nextZ&&(u.nextZ.prevZ=u.prevZ)}function mC(u,a,h){this.i=u,this.x=a,this.y=h,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function gC(u,a,h,A){for(var x=0,E=a,P=h-A;E0&&h.holes.push(A+=u[x-1].length)}return h};var qF=c(pC.exports);function rK(u,a,h,A,x){ZF(u,a,h||0,A||u.length-1,x||iK)}function ZF(u,a,h,A,x){for(;A>h;){if(A-h>600){var E=A-h+1,P=a-h+1,D=Math.log(E),F=.5*Math.exp(2*D/3),V=.5*Math.sqrt(D*F*(E-F)/E)*(P-E/2<0?-1:1);ZF(u,a,Math.max(h,Math.floor(a-P*F/E+V)),Math.min(A,Math.floor(a+(E-P)*F/E+V)),x)}var q=u[a],X=h,rt=A;for(Hx(u,h,a),x(u[A],q)>0&&Hx(u,h,A);X0;)rt--}x(u[h],q)===0?Hx(u,h,rt):Hx(u,++rt,A),rt<=a&&(h=rt+1),a<=rt&&(A=rt-1)}}function Hx(u,a,h){var A=u[a];u[a]=u[h],u[h]=A}function iK(u,a){return ua?1:0}function _C(u,a){let h=u.length;if(h<=1)return[u];let A=[],x,E;for(let P=0;P1)for(let P=0;Ph.id),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Kr,this.indexArray=new Gs,this.indexArray2=new hs,this.programConfigurations=new Va(a.layers,a.zoom),this.segments=new jr,this.segments2=new jr,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,A){this.hasPattern=yC(\"fill\",this.layers,h);let x=this.layers[0].layout.get(\"fill-sort-key\"),E=!x.isConstant(),P=[];for(let{feature:D,id:F,index:V,sourceLayerIndex:q}of a){let X=this.layers[0]._featureFilter.needGeometry,rt=S(D,X);if(!this.layers[0]._featureFilter.filter(new un(this.zoom),rt,A))continue;let at=E?x.evaluate(rt,{},A,h.availableImages):void 0,ct={id:F,properties:D.properties,type:D.type,sourceLayerIndex:q,index:V,geometry:X?rt.geometry:y(D),patterns:{},sortKey:at};P.push(ct)}E&&P.sort((D,F)=>D.sortKey-F.sortKey);for(let D of P){let{geometry:F,index:V,sourceLayerIndex:q}=D;if(this.hasPattern){let X=vC(\"fill\",this.layers,D,this.zoom,h);this.patternFeatures.push(X)}else this.addFeature(D,F,V,A,{});h.featureIndex.insert(a[V].feature,F,V,q,this.index)}}update(a,h,A){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,A)}addFeatures(a,h,A){for(let x of this.patternFeatures)this.addFeature(x,x.geometry,x.index,h,A)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,qX),this.indexBuffer=a.createIndexBuffer(this.indexArray),this.indexBuffer2=a.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(a),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(a,h,A,x,E){for(let P of _C(h,500)){let D=0;for(let at of P)D+=at.length;let F=this.segments.prepareSegment(D,this.layoutVertexArray,this.indexArray),V=F.vertexLength,q=[],X=[];for(let at of P){if(at.length===0)continue;at!==P[0]&&X.push(q.length/2);let ct=this.segments2.prepareSegment(at.length,this.layoutVertexArray,this.indexArray2),mt=ct.vertexLength;this.layoutVertexArray.emplaceBack(at[0].x,at[0].y),this.indexArray2.emplaceBack(mt+at.length-1,mt),q.push(at[0].x),q.push(at[0].y);for(let bt=1;bt>3}if(x--,A===1||A===2)E+=u.readSVarint(),P+=u.readSVarint(),A===1&&(a&&D.push(a),a=[]),a.push(new uK(E,P));else{if(A!==7)throw new Error(\"unknown command \"+A);a&&a.push(a[0].clone())}}return a&&D.push(a),D},M_.prototype.bbox=function(){var u=this._pbf;u.pos=this._geometry;for(var a=u.readVarint()+u.pos,h=1,A=0,x=0,E=0,P=1/0,D=-1/0,F=1/0,V=-1/0;u.pos>3}if(A--,h===1||h===2)(x+=u.readSVarint())D&&(D=x),(E+=u.readSVarint())V&&(V=E);else if(h!==7)throw new Error(\"unknown command \"+h)}return[P,F,D,V]},M_.prototype.toGeoJSON=function(u,a,h){var A,x,E=this.extent*Math.pow(2,h),P=this.extent*u,D=this.extent*a,F=this.loadGeometry(),V=M_.types[this.type];function q(at){for(var ct=0;ct>3;x=P===1?A.readString():P===2?A.readFloat():P===3?A.readDouble():P===4?A.readVarint64():P===5?A.readVarint():P===6?A.readSVarint():P===7?A.readBoolean():null}return x}(h))}KF.prototype.feature=function(u){if(u<0||u>=this._features.length)throw new Error(\"feature index out of bounds\");this._pbf.pos=this._features[u];var a=this._pbf.readVarint()+this._pbf.pos;return new dK(this._pbf,a,this.extent,this._keys,this._values)};var AK=XF;function mK(u,a,h){if(u===3){var A=new AK(h,h.readVarint()+h.pos);A.length&&(a[A.name]=A)}}uA.VectorTile=function(u,a){this.layers=u.readFields(mK,{},a)},uA.VectorTileFeature=$F,uA.VectorTileLayer=XF;let gK=uA.VectorTileFeature.types,bC=Math.pow(2,13);function qx(u,a,h,A,x,E,P,D){u.emplaceBack(a,h,2*Math.floor(A*bC)+P,x*bC*2,E*bC*2,Math.round(D))}class wC{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(h=>h.id),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new Ee,this.centroidVertexArray=new be,this.indexArray=new Gs,this.programConfigurations=new Va(a.layers,a.zoom),this.segments=new jr,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,A){this.features=[],this.hasPattern=yC(\"fill-extrusion\",this.layers,h);for(let{feature:x,id:E,index:P,sourceLayerIndex:D}of a){let F=this.layers[0]._featureFilter.needGeometry,V=S(x,F);if(!this.layers[0]._featureFilter.filter(new un(this.zoom),V,A))continue;let q={id:E,sourceLayerIndex:D,index:P,geometry:F?V.geometry:y(x),properties:x.properties,type:x.type,patterns:{}};this.hasPattern?this.features.push(vC(\"fill-extrusion\",this.layers,q,this.zoom,h)):this.addFeature(q,q.geometry,P,A,{}),h.featureIndex.insert(x,q.geometry,P,D,this.index,!0)}}addFeatures(a,h,A){for(let x of this.features){let{geometry:E}=x;this.addFeature(x,E,x.index,h,A)}}update(a,h,A){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,A)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,cK),this.centroidVertexBuffer=a.createVertexBuffer(this.centroidVertexArray,lK.members,!0),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(a,h,A,x,E){let P={x:0,y:0,vertexCount:0};for(let D of _C(h,500)){let F=0;for(let ct of D)F+=ct.length;let V=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let ct of D){if(ct.length===0||yK(ct))continue;let mt=0;for(let bt=0;bt=1){let jt=ct[bt-1];if(!_K(Pt,jt)){V.vertexLength+4>jr.MAX_VERTEX_ARRAY_LENGTH&&(V=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let Rt=Pt.sub(jt)._perp()._unit(),Gt=jt.dist(Pt);mt+Gt>32768&&(mt=0),qx(this.layoutVertexArray,Pt.x,Pt.y,Rt.x,Rt.y,0,0,mt),qx(this.layoutVertexArray,Pt.x,Pt.y,Rt.x,Rt.y,0,1,mt),P.x+=2*Pt.x,P.y+=2*Pt.y,P.vertexCount+=2,mt+=Gt,qx(this.layoutVertexArray,jt.x,jt.y,Rt.x,Rt.y,0,0,mt),qx(this.layoutVertexArray,jt.x,jt.y,Rt.x,Rt.y,0,1,mt),P.x+=2*jt.x,P.y+=2*jt.y,P.vertexCount+=2;let Yt=V.vertexLength;this.indexArray.emplaceBack(Yt,Yt+2,Yt+1),this.indexArray.emplaceBack(Yt+1,Yt+2,Yt+3),V.vertexLength+=4,V.primitiveLength+=2}}}}if(V.vertexLength+F>jr.MAX_VERTEX_ARRAY_LENGTH&&(V=this.segments.prepareSegment(F,this.layoutVertexArray,this.indexArray)),gK[a.type]!==\"Polygon\")continue;let q=[],X=[],rt=V.vertexLength;for(let ct of D)if(ct.length!==0){ct!==D[0]&&X.push(q.length/2);for(let mt=0;mten)||u.y===a.y&&(u.y<0||u.y>en)}function yK(u){return u.every(a=>a.x<0)||u.every(a=>a.x>en)||u.every(a=>a.y<0)||u.every(a=>a.y>en)}let JF;Ge(\"FillExtrusionBucket\",wC,{omit:[\"layers\",\"features\"]});var vK={get paint(){return JF=JF||new Hn({\"fill-extrusion-opacity\":new nr(ee[\"paint_fill-extrusion\"][\"fill-extrusion-opacity\"]),\"fill-extrusion-color\":new dr(ee[\"paint_fill-extrusion\"][\"fill-extrusion-color\"]),\"fill-extrusion-translate\":new nr(ee[\"paint_fill-extrusion\"][\"fill-extrusion-translate\"]),\"fill-extrusion-translate-anchor\":new nr(ee[\"paint_fill-extrusion\"][\"fill-extrusion-translate-anchor\"]),\"fill-extrusion-pattern\":new wf(ee[\"paint_fill-extrusion\"][\"fill-extrusion-pattern\"]),\"fill-extrusion-height\":new dr(ee[\"paint_fill-extrusion\"][\"fill-extrusion-height\"]),\"fill-extrusion-base\":new dr(ee[\"paint_fill-extrusion\"][\"fill-extrusion-base\"]),\"fill-extrusion-vertical-gradient\":new nr(ee[\"paint_fill-extrusion\"][\"fill-extrusion-vertical-gradient\"])})}};class xK extends ji{constructor(a){super(a,vK)}createBucket(a){return new wC(a)}queryRadius(){return te(this.paint.get(\"fill-extrusion-translate\"))}is3D(){return!0}queryIntersectsFeature(a,h,A,x,E,P,D,F){let V=_e(a,this.paint.get(\"fill-extrusion-translate\"),this.paint.get(\"fill-extrusion-translate-anchor\"),P.angle,D),q=this.paint.get(\"fill-extrusion-height\").evaluate(h,A),X=this.paint.get(\"fill-extrusion-base\").evaluate(h,A),rt=function(ct,mt,bt,Pt){let jt=[];for(let Rt of ct){let Gt=[Rt.x,Rt.y,0,1];Pi(Gt,Gt,mt),jt.push(new w(Gt[0]/Gt[3],Gt[1]/Gt[3]))}return jt}(V,F),at=function(ct,mt,bt,Pt){let jt=[],Rt=[],Gt=Pt[8]*mt,Yt=Pt[9]*mt,ce=Pt[10]*mt,Ne=Pt[11]*mt,ir=Pt[8]*bt,Fe=Pt[9]*bt,Re=Pt[10]*bt,Me=Pt[11]*bt;for(let Ye of ct){let Ie=[],Ae=[];for(let hr of Ye){let sr=hr.x,ri=hr.y,Tn=Pt[0]*sr+Pt[4]*ri+Pt[12],Rn=Pt[1]*sr+Pt[5]*ri+Pt[13],qs=Pt[2]*sr+Pt[6]*ri+Pt[14],Ql=Pt[3]*sr+Pt[7]*ri+Pt[15],ja=qs+ce,Is=Ql+Ne,Po=Tn+ir,$o=Rn+Fe,Ga=qs+Re,Wa=Ql+Me,Zs=new w((Tn+Gt)/Is,(Rn+Yt)/Is);Zs.z=ja/Is,Ie.push(Zs);let Ys=new w(Po/Wa,$o/Wa);Ys.z=Ga/Wa,Ae.push(Ys)}jt.push(Ie),Rt.push(Ae)}return[jt,Rt]}(x,X,q,F);return function(ct,mt,bt){let Pt=1/0;H(bt,mt)&&(Pt=t6(bt,mt[0]));for(let jt=0;jth.id),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new pr,this.layoutVertexArray2=new tr,this.indexArray=new Gs,this.programConfigurations=new Va(a.layers,a.zoom),this.segments=new jr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(a,h,A){this.hasPattern=yC(\"line\",this.layers,h);let x=this.layers[0].layout.get(\"line-sort-key\"),E=!x.isConstant(),P=[];for(let{feature:D,id:F,index:V,sourceLayerIndex:q}of a){let X=this.layers[0]._featureFilter.needGeometry,rt=S(D,X);if(!this.layers[0]._featureFilter.filter(new un(this.zoom),rt,A))continue;let at=E?x.evaluate(rt,{},A):void 0,ct={id:F,properties:D.properties,type:D.type,sourceLayerIndex:q,index:V,geometry:X?rt.geometry:y(D),patterns:{},sortKey:at};P.push(ct)}E&&P.sort((D,F)=>D.sortKey-F.sortKey);for(let D of P){let{geometry:F,index:V,sourceLayerIndex:q}=D;if(this.hasPattern){let X=vC(\"line\",this.layers,D,this.zoom,h);this.patternFeatures.push(X)}else this.addFeature(D,F,V,A,{});h.featureIndex.insert(a[V].feature,F,V,q,this.index)}}update(a,h,A){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,h,this.stateDependentLayers,A)}addFeatures(a,h,A){for(let x of this.patternFeatures)this.addFeature(x,x.geometry,x.index,h,A)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=a.createVertexBuffer(this.layoutVertexArray2,TK)),this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,wK),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(a){if(a.properties&&Object.prototype.hasOwnProperty.call(a.properties,\"mapbox_clip_start\")&&Object.prototype.hasOwnProperty.call(a.properties,\"mapbox_clip_end\"))return{start:+a.properties.mapbox_clip_start,end:+a.properties.mapbox_clip_end}}addFeature(a,h,A,x,E){let P=this.layers[0].layout,D=P.get(\"line-join\").evaluate(a,{}),F=P.get(\"line-cap\"),V=P.get(\"line-miter-limit\"),q=P.get(\"line-round-limit\");this.lineClips=this.lineFeatureClips(a);for(let X of h)this.addLine(X,a,D,F,V,q);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,A,E,x)}addLine(a,h,A,x,E,P){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Pt=0;Pt=2&&a[F-1].equals(a[F-2]);)F--;let V=0;for(;V0;if(Ne&&Pt>V){let Me=rt.dist(at);if(Me>2*q){let Ye=rt.sub(rt.sub(at)._mult(q/Me)._round());this.updateDistance(at,Ye),this.addCurrentVertex(Ye,mt,0,0,X),at=Ye}}let Fe=at&&ct,Re=Fe?A:D?\"butt\":x;if(Fe&&Re===\"round\"&&(YtE&&(Re=\"bevel\"),Re===\"bevel\"&&(Yt>2&&(Re=\"flipbevel\"),Yt100)jt=bt.mult(-1);else{let Me=Yt*mt.add(bt).mag()/mt.sub(bt).mag();jt._perp()._mult(Me*(ir?-1:1))}this.addCurrentVertex(rt,jt,0,0,X),this.addCurrentVertex(rt,jt.mult(-1),0,0,X)}else if(Re===\"bevel\"||Re===\"fakeround\"){let Me=-Math.sqrt(Yt*Yt-1),Ye=ir?Me:0,Ie=ir?0:Me;if(at&&this.addCurrentVertex(rt,mt,Ye,Ie,X),Re===\"fakeround\"){let Ae=Math.round(180*ce/Math.PI/20);for(let hr=1;hr2*q){let Ye=rt.add(ct.sub(rt)._mult(q/Me)._round());this.updateDistance(rt,Ye),this.addCurrentVertex(Ye,bt,0,0,X),rt=Ye}}}}addCurrentVertex(a,h,A,x,E,P=!1){let D=h.y*x-h.x,F=-h.y-h.x*x;this.addHalfVertex(a,h.x+h.y*A,h.y-h.x*A,P,!1,A,E),this.addHalfVertex(a,D,F,P,!0,-x,E),this.distance>e6/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(a,h,A,x,E,P))}addHalfVertex({x:a,y:h},A,x,E,P,D,F){let V=.5*(this.lineClips?this.scaledDistance*(e6-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((a<<1)+(E?1:0),(h<<1)+(P?1:0),Math.round(63*A)+128,Math.round(63*x)+128,1+(D===0?0:D<0?-1:1)|(63&V)<<2,V>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let q=F.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,q),F.primitiveLength++),P?this.e2=q:this.e1=q}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(a,h){this.distance+=a.dist(h),this.updateScaledDistance()}}let r6,i6;Ge(\"LineBucket\",SC,{omit:[\"layers\",\"patternFeatures\"]});var n6={get paint(){return i6=i6||new Hn({\"line-opacity\":new dr(ee.paint_line[\"line-opacity\"]),\"line-color\":new dr(ee.paint_line[\"line-color\"]),\"line-translate\":new nr(ee.paint_line[\"line-translate\"]),\"line-translate-anchor\":new nr(ee.paint_line[\"line-translate-anchor\"]),\"line-width\":new dr(ee.paint_line[\"line-width\"]),\"line-gap-width\":new dr(ee.paint_line[\"line-gap-width\"]),\"line-offset\":new dr(ee.paint_line[\"line-offset\"]),\"line-blur\":new dr(ee.paint_line[\"line-blur\"]),\"line-dasharray\":new aA(ee.paint_line[\"line-dasharray\"]),\"line-pattern\":new wf(ee.paint_line[\"line-pattern\"]),\"line-gradient\":new Bd(ee.paint_line[\"line-gradient\"])})},get layout(){return r6=r6||new Hn({\"line-cap\":new nr(ee.layout_line[\"line-cap\"]),\"line-join\":new dr(ee.layout_line[\"line-join\"]),\"line-miter-limit\":new nr(ee.layout_line[\"line-miter-limit\"]),\"line-round-limit\":new nr(ee.layout_line[\"line-round-limit\"]),\"line-sort-key\":new dr(ee.layout_line[\"line-sort-key\"])})}};class PK extends dr{possiblyEvaluate(a,h){return h=new un(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(a,h)}evaluate(a,h,A,x){return h=kt({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(a,h,A,x)}}let rT;class IK extends ji{constructor(a){super(a,n6),this.gradientVersion=0,rT||(rT=new PK(n6.paint.properties[\"line-width\"].specification),rT.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(a){if(a===\"line-gradient\"){let h=this.gradientExpression();this.stepInterpolant=!!function(A){return A._styleExpression!==void 0}(h)&&h._styleExpression.expression instanceof sh,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values[\"line-gradient\"].value.expression}recalculate(a,h){super.recalculate(a,h),this.paint._values[\"line-floorwidth\"]=rT.possiblyEvaluate(this._transitioningPaint._values[\"line-width\"].value,a)}createBucket(a){return new SC(a)}queryRadius(a){let h=a,A=s6(We(\"line-width\",this,h),We(\"line-gap-width\",this,h)),x=We(\"line-offset\",this,h);return A/2+Math.abs(x)+te(this.paint.get(\"line-translate\"))}queryIntersectsFeature(a,h,A,x,E,P,D){let F=_e(a,this.paint.get(\"line-translate\"),this.paint.get(\"line-translate-anchor\"),P.angle,D),V=D/2*s6(this.paint.get(\"line-width\").evaluate(h,A),this.paint.get(\"line-gap-width\").evaluate(h,A)),q=this.paint.get(\"line-offset\").evaluate(h,A);return q&&(x=function(X,rt){let at=[];for(let ct=0;ct=3){for(let bt=0;bt0?a+2*u:u}let CK=wn([{name:\"a_pos_offset\",components:4,type:\"Int16\"},{name:\"a_data\",components:4,type:\"Uint16\"},{name:\"a_pixeloffset\",components:4,type:\"Int16\"}],4),LK=wn([{name:\"a_projected_pos\",components:3,type:\"Float32\"}],4);wn([{name:\"a_fade_opacity\",components:1,type:\"Uint32\"}],4);let kK=wn([{name:\"a_placed\",components:2,type:\"Uint8\"},{name:\"a_shift\",components:2,type:\"Float32\"}]);wn([{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\"}]);let o6=wn([{name:\"a_pos\",components:2,type:\"Int16\"},{name:\"a_anchor_pos\",components:2,type:\"Int16\"},{name:\"a_extrude\",components:2,type:\"Int16\"}],4),RK=wn([{name:\"a_pos\",components:2,type:\"Float32\"},{name:\"a_radius\",components:1,type:\"Float32\"},{name:\"a_flags\",components:2,type:\"Int16\"}],4);function DK(u,a,h){return u.sections.forEach(A=>{A.text=function(x,E,P){let D=E.layout.get(\"text-transform\").evaluate(P,{});return D===\"uppercase\"?x=x.toLocaleUpperCase():D===\"lowercase\"&&(x=x.toLocaleLowerCase()),ua.applyArabicShaping&&(x=ua.applyArabicShaping(x)),x}(A.text,a,h)}),u}wn([{name:\"triangle\",components:3,type:\"Uint16\"}]),wn([{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\"}]),wn([{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\"}]),wn([{type:\"Float32\",name:\"offsetX\"}]),wn([{type:\"Int16\",name:\"x\"},{type:\"Int16\",name:\"y\"},{type:\"Int16\",name:\"tileUnitDistanceFromAnchor\"}]),wn([{type:\"Uint16\",name:\"textAnchor\"},{type:\"Float32\",components:2,name:\"textOffset\"}]);let Yx={\"!\":\"\\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\",\"\\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\"};var Hs=24,a6=rn,l6=function(u,a,h,A,x){var E,P,D=8*x-A-1,F=(1<>1,q=-7,X=h?x-1:0,rt=h?-1:1,at=u[a+X];for(X+=rt,E=at&(1<<-q)-1,at>>=-q,q+=D;q>0;E=256*E+u[a+X],X+=rt,q-=8);for(P=E&(1<<-q)-1,E>>=-q,q+=A;q>0;P=256*P+u[a+X],X+=rt,q-=8);if(E===0)E=1-V;else{if(E===F)return P?NaN:1/0*(at?-1:1);P+=Math.pow(2,A),E-=V}return(at?-1:1)*P*Math.pow(2,E-A)},c6=function(u,a,h,A,x,E){var P,D,F,V=8*E-x-1,q=(1<>1,rt=x===23?Math.pow(2,-24)-Math.pow(2,-77):0,at=A?0:E-1,ct=A?1:-1,mt=a<0||a===0&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(D=isNaN(a)?1:0,P=q):(P=Math.floor(Math.log(a)/Math.LN2),a*(F=Math.pow(2,-P))<1&&(P--,F*=2),(a+=P+X>=1?rt/F:rt*Math.pow(2,1-X))*F>=2&&(P++,F/=2),P+X>=q?(D=0,P=q):P+X>=1?(D=(a*F-1)*Math.pow(2,x),P+=X):(D=a*Math.pow(2,X-1)*Math.pow(2,x),P=0));x>=8;u[h+at]=255&D,at+=ct,D/=256,x-=8);for(P=P<0;u[h+at]=255&P,at+=ct,P/=256,V-=8);u[h+at-ct]|=128*mt};function rn(u){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(u)?u:new Uint8Array(u||0),this.pos=0,this.type=0,this.length=this.buf.length}rn.Varint=0,rn.Fixed64=1,rn.Bytes=2,rn.Fixed32=5;var TC=4294967296,u6=1/TC,h6=typeof TextDecoder>\"u\"?null:new TextDecoder(\"utf8\");function Nd(u){return u.type===rn.Bytes?u.readVarint()+u.pos:u.pos+1}function E_(u,a,h){return h?4294967296*a+(u>>>0):4294967296*(a>>>0)+(u>>>0)}function f6(u,a,h){var A=a<=16383?1:a<=2097151?2:a<=268435455?3:Math.floor(Math.log(a)/(7*Math.LN2));h.realloc(A);for(var x=h.pos-1;x>=u;x--)h.buf[x+A]=h.buf[x]}function OK(u,a){for(var h=0;h>>8,u[h+2]=a>>>16,u[h+3]=a>>>24}function d6(u,a){return(u[a]|u[a+1]<<8|u[a+2]<<16)+(u[a+3]<<24)}rn.prototype={destroy:function(){this.buf=null},readFields:function(u,a,h){for(h=h||this.length;this.pos>3,E=this.pos;this.type=7&A,u(x,a,this),this.pos===E&&this.skip(A)}return a},readMessage:function(u,a){return this.readFields(u,a,this.readVarint()+this.pos)},readFixed32:function(){var u=iT(this.buf,this.pos);return this.pos+=4,u},readSFixed32:function(){var u=d6(this.buf,this.pos);return this.pos+=4,u},readFixed64:function(){var u=iT(this.buf,this.pos)+iT(this.buf,this.pos+4)*TC;return this.pos+=8,u},readSFixed64:function(){var u=iT(this.buf,this.pos)+d6(this.buf,this.pos+4)*TC;return this.pos+=8,u},readFloat:function(){var u=l6(this.buf,this.pos,!0,23,4);return this.pos+=4,u},readDouble:function(){var u=l6(this.buf,this.pos,!0,52,8);return this.pos+=8,u},readVarint:function(u){var a,h,A=this.buf;return a=127&(h=A[this.pos++]),h<128?a:(a|=(127&(h=A[this.pos++]))<<7,h<128?a:(a|=(127&(h=A[this.pos++]))<<14,h<128?a:(a|=(127&(h=A[this.pos++]))<<21,h<128?a:function(x,E,P){var D,F,V=P.buf;if(D=(112&(F=V[P.pos++]))>>4,F<128||(D|=(127&(F=V[P.pos++]))<<3,F<128)||(D|=(127&(F=V[P.pos++]))<<10,F<128)||(D|=(127&(F=V[P.pos++]))<<17,F<128)||(D|=(127&(F=V[P.pos++]))<<24,F<128)||(D|=(1&(F=V[P.pos++]))<<31,F<128))return E_(x,D,E);throw new Error(\"Expected varint not more than 10 bytes\")}(a|=(15&(h=A[this.pos]))<<28,u,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var u=this.readVarint();return u%2==1?(u+1)/-2:u/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var u=this.readVarint()+this.pos,a=this.pos;return this.pos=u,u-a>=12&&h6?function(h,A,x){return h6.decode(h.subarray(A,x))}(this.buf,a,u):function(h,A,x){for(var E=\"\",P=A;P239?4:q>223?3:q>191?2:1;if(P+rt>x)break;rt===1?q<128&&(X=q):rt===2?(192&(D=h[P+1]))==128&&(X=(31&q)<<6|63&D)<=127&&(X=null):rt===3?(F=h[P+2],(192&(D=h[P+1]))==128&&(192&F)==128&&((X=(15&q)<<12|(63&D)<<6|63&F)<=2047||X>=55296&&X<=57343)&&(X=null)):rt===4&&(F=h[P+2],V=h[P+3],(192&(D=h[P+1]))==128&&(192&F)==128&&(192&V)==128&&((X=(15&q)<<18|(63&D)<<12|(63&F)<<6|63&V)<=65535||X>=1114112)&&(X=null)),X===null?(X=65533,rt=1):X>65535&&(X-=65536,E+=String.fromCharCode(X>>>10&1023|55296),X=56320|1023&X),E+=String.fromCharCode(X),P+=rt}return E}(this.buf,a,u)},readBytes:function(){var u=this.readVarint()+this.pos,a=this.buf.subarray(this.pos,u);return this.pos=u,a},readPackedVarint:function(u,a){if(this.type!==rn.Bytes)return u.push(this.readVarint(a));var h=Nd(this);for(u=u||[];this.pos127;);else if(a===rn.Bytes)this.pos=this.readVarint()+this.pos;else if(a===rn.Fixed32)this.pos+=4;else{if(a!==rn.Fixed64)throw new Error(\"Unimplemented type: \"+a);this.pos+=8}},writeTag:function(u,a){this.writeVarint(u<<3|a)},realloc:function(u){for(var a=this.length||16;a268435455||u<0?function(a,h){var A,x;if(a>=0?(A=a%4294967296|0,x=a/4294967296|0):(x=~(-a/4294967296),4294967295^(A=~(-a%4294967296))?A=A+1|0:(A=0,x=x+1|0)),a>=18446744073709552e3||a<-18446744073709552e3)throw new Error(\"Given varint doesn't fit into 10 bytes\");h.realloc(10),function(E,P,D){D.buf[D.pos++]=127&E|128,E>>>=7,D.buf[D.pos++]=127&E|128,E>>>=7,D.buf[D.pos++]=127&E|128,E>>>=7,D.buf[D.pos++]=127&E|128,D.buf[D.pos]=127&(E>>>=7)}(A,0,h),function(E,P){var D=(7&E)<<4;P.buf[P.pos++]|=D|((E>>>=3)?128:0),E&&(P.buf[P.pos++]=127&E|((E>>>=7)?128:0),E&&(P.buf[P.pos++]=127&E|((E>>>=7)?128:0),E&&(P.buf[P.pos++]=127&E|((E>>>=7)?128:0),E&&(P.buf[P.pos++]=127&E|((E>>>=7)?128:0),E&&(P.buf[P.pos++]=127&E)))))}(x,h)}(u,this):(this.realloc(4),this.buf[this.pos++]=127&u|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=u>>>7&127))))},writeSVarint:function(u){this.writeVarint(u<0?2*-u-1:2*u)},writeBoolean:function(u){this.writeVarint(!!u)},writeString:function(u){u=String(u),this.realloc(4*u.length),this.pos++;var a=this.pos;this.pos=function(A,x,E){for(var P,D,F=0;F55295&&P<57344){if(!D){P>56319||F+1===x.length?(A[E++]=239,A[E++]=191,A[E++]=189):D=P;continue}if(P<56320){A[E++]=239,A[E++]=191,A[E++]=189,D=P;continue}P=D-55296<<10|P-56320|65536,D=null}else D&&(A[E++]=239,A[E++]=191,A[E++]=189,D=null);P<128?A[E++]=P:(P<2048?A[E++]=P>>6|192:(P<65536?A[E++]=P>>12|224:(A[E++]=P>>18|240,A[E++]=P>>12&63|128),A[E++]=P>>6&63|128),A[E++]=63&P|128)}return E}(this.buf,u,this.pos);var h=this.pos-a;h>=128&&f6(a,h,this),this.pos=a-1,this.writeVarint(h),this.pos+=h},writeFloat:function(u){this.realloc(4),c6(this.buf,u,this.pos,!0,23,4),this.pos+=4},writeDouble:function(u){this.realloc(8),c6(this.buf,u,this.pos,!0,52,8),this.pos+=8},writeBytes:function(u){var a=u.length;this.writeVarint(a),this.realloc(a);for(var h=0;h=128&&f6(h,A,this),this.pos=h-1,this.writeVarint(A),this.pos+=A},writeMessage:function(u,a,h){this.writeTag(u,rn.Bytes),this.writeRawMessage(a,h)},writePackedVarint:function(u,a){a.length&&this.writeMessage(u,OK,a)},writePackedSVarint:function(u,a){a.length&&this.writeMessage(u,BK,a)},writePackedBoolean:function(u,a){a.length&&this.writeMessage(u,NK,a)},writePackedFloat:function(u,a){a.length&&this.writeMessage(u,FK,a)},writePackedDouble:function(u,a){a.length&&this.writeMessage(u,zK,a)},writePackedFixed32:function(u,a){a.length&&this.writeMessage(u,UK,a)},writePackedSFixed32:function(u,a){a.length&&this.writeMessage(u,VK,a)},writePackedFixed64:function(u,a){a.length&&this.writeMessage(u,jK,a)},writePackedSFixed64:function(u,a){a.length&&this.writeMessage(u,GK,a)},writeBytesField:function(u,a){this.writeTag(u,rn.Bytes),this.writeBytes(a)},writeFixed32Field:function(u,a){this.writeTag(u,rn.Fixed32),this.writeFixed32(a)},writeSFixed32Field:function(u,a){this.writeTag(u,rn.Fixed32),this.writeSFixed32(a)},writeFixed64Field:function(u,a){this.writeTag(u,rn.Fixed64),this.writeFixed64(a)},writeSFixed64Field:function(u,a){this.writeTag(u,rn.Fixed64),this.writeSFixed64(a)},writeVarintField:function(u,a){this.writeTag(u,rn.Varint),this.writeVarint(a)},writeSVarintField:function(u,a){this.writeTag(u,rn.Varint),this.writeSVarint(a)},writeStringField:function(u,a){this.writeTag(u,rn.Bytes),this.writeString(a)},writeFloatField:function(u,a){this.writeTag(u,rn.Fixed32),this.writeFloat(a)},writeDoubleField:function(u,a){this.writeTag(u,rn.Fixed64),this.writeDouble(a)},writeBooleanField:function(u,a){this.writeVarintField(u,!!a)}};var MC=c(a6);let EC=3;function WK(u,a,h){u===1&&h.readMessage(HK,a)}function HK(u,a,h){if(u===3){let{id:A,bitmap:x,width:E,height:P,left:D,top:F,advance:V}=h.readMessage(qK,{});a.push({id:A,bitmap:new Vx({width:E+2*EC,height:P+2*EC},x),metrics:{width:E,height:P,left:D,top:F,advance:V}})}}function qK(u,a,h){u===1?a.id=h.readVarint():u===2?a.bitmap=h.readBytes():u===3?a.width=h.readVarint():u===4?a.height=h.readVarint():u===5?a.left=h.readSVarint():u===6?a.top=h.readSVarint():u===7&&(a.advance=h.readVarint())}let p6=EC;function A6(u){let a=0,h=0;for(let P of u)a+=P.w*P.h,h=Math.max(h,P.w);u.sort((P,D)=>D.h-P.h);let A=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(a/.95)),h),h:1/0}],x=0,E=0;for(let P of u)for(let D=A.length-1;D>=0;D--){let F=A[D];if(!(P.w>F.w||P.h>F.h)){if(P.x=F.x,P.y=F.y,E=Math.max(E,P.y+P.h),x=Math.max(x,P.x+P.w),P.w===F.w&&P.h===F.h){let V=A.pop();D=0&&A>=a&&sT[this.text.charCodeAt(A)];A--)h--;this.text=this.text.substring(a,h),this.sectionIndex=this.sectionIndex.slice(a,h)}substring(a,h){let A=new I_;return A.text=this.text.substring(a,h),A.sectionIndex=this.sectionIndex.slice(a,h),A.sections=this.sections,A}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((a,h)=>Math.max(a,this.sections[h].scale),0)}addTextSection(a,h){this.text+=a.text,this.sections.push($x.forText(a.scale,a.fontStack||h));let A=this.sections.length-1;for(let x=0;x=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function nT(u,a,h,A,x,E,P,D,F,V,q,X,rt,at,ct,mt){let bt=I_.fromFeature(u,x),Pt;X===n.ai.vertical&&bt.verticalizePunctuation();let{processBidirectionalText:jt,processStyledBidirectionalText:Rt}=ua;if(jt&&bt.sections.length===1){Pt=[];let ce=jt(bt.toString(),IC(bt,V,E,a,A,at,ct));for(let Ne of ce){let ir=new I_;ir.text=Ne,ir.sections=bt.sections;for(let Fe=0;Fe0&&Vd>_l&&(_l=Vd)}else{let Uc=ir[di.fontStack],vl=Uc&&Uc[Xo];if(vl&&vl.rect)vh=vl.rect,xu=vl.metrics;else{let Vd=Ne[di.fontStack],e1=Vd&&Vd[Xo];if(!e1)continue;xu=e1.metrics}$s=(Ys-di.scale)*Hs}bu?(ce.verticalizable=!0,fa.push({glyph:Xo,imageName:xh,x:Tn,y:Rn+$s,vertical:bu,scale:di.scale,fontStack:di.fontStack,sectionIndex:da,metrics:xu,rect:vh}),Tn+=Ud*di.scale+hr):(fa.push({glyph:Xo,imageName:xh,x:Tn,y:Rn+$s,vertical:bu,scale:di.scale,fontStack:di.fontStack,sectionIndex:da,metrics:xu,rect:vh}),Tn+=xu.advance*di.scale+hr)}fa.length!==0&&(qs=Math.max(Tn-hr,qs),QK(fa,0,fa.length-1,ja,_l)),Tn=0;let yl=Me*Ys+_l;Ha.lineOffset=Math.max(_l,ha),Rn+=yl,Ql=Math.max(yl,Ql),++Is}var Po;let $o=Rn-Qx,{horizontalAlign:Ga,verticalAlign:Wa}=CC(Ye);(function(Zs,Ys,ha,Ha,fa,_l,yl,Qs,di){let da=(Ys-ha)*fa,Xo=0;Xo=_l!==yl?-Qs*Ha-Qx:(-Ha*di+.5)*yl;for(let $s of Zs)for(let xu of $s.positionedGlyphs)xu.x+=da,xu.y+=Xo})(ce.positionedLines,ja,Ga,Wa,qs,Ql,Me,$o,Re.length),ce.top+=-Wa*$o,ce.bottom=ce.top+$o,ce.left+=-Ga*qs,ce.right=ce.left+qs}(Yt,a,h,A,Pt,P,D,F,X,V,rt,mt),!function(ce){for(let Ne of ce)if(Ne.positionedGlyphs.length!==0)return!1;return!0}(Gt)&&Yt}let sT={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ZK={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function g6(u,a,h,A,x,E){if(a.imageName){let P=A[a.imageName];return P?P.displaySize[0]*a.scale*Hs/E+x:0}{let P=h[a.fontStack],D=P&&P[u];return D?D.metrics.advance*a.scale+x:0}}function _6(u,a,h,A){let x=Math.pow(u-a,2);return A?u=0,q=0;for(let rt=0;rtP.id),this.index=a.index,this.pixelRatio=a.pixelRatio,this.sourceLayerIndex=a.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Zr([]),this.placementViewportMatrix=Zr([]);let h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=b6(this.zoom,h[\"text-size\"]),this.iconSizeData=b6(this.zoom,h[\"icon-size\"]);let A=this.layers[0].layout,x=A.get(\"symbol-sort-key\"),E=A.get(\"symbol-z-order\");this.canOverlap=LC(A,\"text-overlap\",\"text-allow-overlap\")!==\"never\"||LC(A,\"icon-overlap\",\"icon-allow-overlap\")!==\"never\"||A.get(\"text-ignore-placement\")||A.get(\"icon-ignore-placement\"),this.sortFeaturesByKey=E!==\"viewport-y\"&&!x.isConstant(),this.sortFeaturesByY=(E===\"viewport-y\"||E===\"auto\"&&!this.sortFeaturesByKey)&&this.canOverlap,A.get(\"symbol-placement\")===\"point\"&&(this.writingModes=A.get(\"text-writing-mode\").map(P=>n.ai[P])),this.stateDependentLayerIds=this.layers.filter(P=>P.isStateDependent()).map(P=>P.id),this.sourceID=a.sourceID}createArrays(){this.text=new RC(new Va(this.layers,this.zoom,a=>/^text/.test(a))),this.icon=new RC(new Va(this.layers,this.zoom,a=>/^icon/.test(a))),this.glyphOffsetArray=new Bt,this.lineVertexArray=new Qt,this.symbolInstances=new St,this.textAnchorOffsets=new oe}calculateGlyphDependencies(a,h,A,x,E){for(let P=0;P0)&&(P.value.kind!==\"constant\"||P.value.value.length>0),q=F.value.kind!==\"constant\"||!!F.value.value||Object.keys(F.parameters).length>0,X=E.get(\"symbol-sort-key\");if(this.features=[],!V&&!q)return;let rt=h.iconDependencies,at=h.glyphDependencies,ct=h.availableImages,mt=new un(this.zoom);for(let{feature:bt,id:Pt,index:jt,sourceLayerIndex:Rt}of a){let Gt=x._featureFilter.needGeometry,Yt=S(bt,Gt);if(!x._featureFilter.filter(mt,Yt,A))continue;let ce,Ne;if(Gt||(Yt.geometry=y(bt)),V){let Fe=x.getValueAndResolveTokens(\"text-field\",Yt,A,ct),Re=ln.factory(Fe);JK(Re)&&(this.hasRTLText=!0),(!this.hasRTLText||f0()===\"unavailable\"||this.hasRTLText&&ua.isParsed())&&(ce=DK(Re,x,Yt))}if(q){let Fe=x.getValueAndResolveTokens(\"icon-image\",Yt,A,ct);Ne=Fe instanceof Gn?Fe:Gn.fromString(Fe)}if(!ce&&!Ne)continue;let ir=this.sortFeaturesByKey?X.evaluate(Yt,{},A):void 0;if(this.features.push({id:Pt,text:ce,icon:Ne,index:jt,sourceLayerIndex:Rt,geometry:Yt.geometry,properties:bt.properties,type:XK[bt.type],sortKey:ir}),Ne&&(rt[Ne.name]=!0),ce){let Fe=P.evaluate(Yt,{},A).join(\",\"),Re=E.get(\"text-rotation-alignment\")!==\"viewport\"&&E.get(\"symbol-placement\")!==\"point\";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(n.ai.vertical)>=0;for(let Me of ce.sections)if(Me.image)rt[Me.image.name]=!0;else{let Ye=o0(ce.toString()),Ie=Me.fontStack||Fe,Ae=at[Ie]=at[Ie]||{};this.calculateGlyphDependencies(Me.text,Ae,Re,this.allowVerticalPlacement,Ye)}}}E.get(\"symbol-placement\")===\"line\"&&(this.features=function(bt){let Pt={},jt={},Rt=[],Gt=0;function Yt(Fe){Rt.push(bt[Fe]),Gt++}function ce(Fe,Re,Me){let Ye=jt[Fe];return delete jt[Fe],jt[Re]=Ye,Rt[Ye].geometry[0].pop(),Rt[Ye].geometry[0]=Rt[Ye].geometry[0].concat(Me[0]),Ye}function Ne(Fe,Re,Me){let Ye=Pt[Re];return delete Pt[Re],Pt[Fe]=Ye,Rt[Ye].geometry[0].shift(),Rt[Ye].geometry[0]=Me[0].concat(Rt[Ye].geometry[0]),Ye}function ir(Fe,Re,Me){let Ye=Me?Re[0][Re[0].length-1]:Re[0][0];return`${Fe}:${Ye.x}:${Ye.y}`}for(let Fe=0;FeFe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((bt,Pt)=>bt.sortKey-Pt.sortKey)}update(a,h,A){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(a,h,this.layers,A),this.icon.programConfigurations.updatePaintArrays(a,h,this.layers,A))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(a){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(a),this.iconCollisionBox.upload(a)),this.text.upload(a,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(a,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(a,h){let A=this.lineVertexArray.length;if(a.segment!==void 0){let x=a.dist(h[a.segment+1]),E=a.dist(h[a.segment]),P={};for(let D=a.segment+1;D=0;D--)P[D]={x:h[D].x,y:h[D].y,tileUnitDistanceFromAnchor:E},D>0&&(E+=h[D-1].dist(h[D]));for(let D=0;D0}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(a,h){let A=a.placedSymbolArray.get(h),x=A.vertexStartIndex+4*A.numGlyphs;for(let E=A.vertexStartIndex;Ex[D]-x[F]||E[F]-E[D]),P}addToSortKeyRanges(a,h){let A=this.sortKeyRanges[this.sortKeyRanges.length-1];A&&A.sortKey===h?A.symbolInstanceEnd=a+1:this.sortKeyRanges.push({sortKey:h,symbolInstanceStart:a,symbolInstanceEnd:a+1})}sortFeatures(a){if(this.sortFeaturesByY&&this.sortedAngle!==a&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(a),this.sortedAngle=a,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let h of this.symbolInstanceIndexes){let A=this.symbolInstances.get(h);this.featureSortOrder.push(A.featureIndex),[A.rightJustifiedTextSymbolIndex,A.centerJustifiedTextSymbolIndex,A.leftJustifiedTextSymbolIndex].forEach((x,E,P)=>{x>=0&&P.indexOf(x)===E&&this.addIndicesForPlacedSymbol(this.text,x)}),A.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,A.verticalPlacedTextSymbolIndex),A.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,A.placedIconSymbolIndex),A.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,A.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let w6,S6;Ge(\"SymbolBucket\",C_,{omit:[\"layers\",\"collisionBoxArray\",\"features\",\"compareText\"]}),C_.MAX_GLYPHS=65535,C_.addDynamicAttributes=kC;var OC={get paint(){return S6=S6||new Hn({\"icon-opacity\":new dr(ee.paint_symbol[\"icon-opacity\"]),\"icon-color\":new dr(ee.paint_symbol[\"icon-color\"]),\"icon-halo-color\":new dr(ee.paint_symbol[\"icon-halo-color\"]),\"icon-halo-width\":new dr(ee.paint_symbol[\"icon-halo-width\"]),\"icon-halo-blur\":new dr(ee.paint_symbol[\"icon-halo-blur\"]),\"icon-translate\":new nr(ee.paint_symbol[\"icon-translate\"]),\"icon-translate-anchor\":new nr(ee.paint_symbol[\"icon-translate-anchor\"]),\"text-opacity\":new dr(ee.paint_symbol[\"text-opacity\"]),\"text-color\":new dr(ee.paint_symbol[\"text-color\"],{runtimeType:Us,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),\"text-halo-color\":new dr(ee.paint_symbol[\"text-halo-color\"]),\"text-halo-width\":new dr(ee.paint_symbol[\"text-halo-width\"]),\"text-halo-blur\":new dr(ee.paint_symbol[\"text-halo-blur\"]),\"text-translate\":new nr(ee.paint_symbol[\"text-translate\"]),\"text-translate-anchor\":new nr(ee.paint_symbol[\"text-translate-anchor\"])})},get layout(){return w6=w6||new Hn({\"symbol-placement\":new nr(ee.layout_symbol[\"symbol-placement\"]),\"symbol-spacing\":new nr(ee.layout_symbol[\"symbol-spacing\"]),\"symbol-avoid-edges\":new nr(ee.layout_symbol[\"symbol-avoid-edges\"]),\"symbol-sort-key\":new dr(ee.layout_symbol[\"symbol-sort-key\"]),\"symbol-z-order\":new nr(ee.layout_symbol[\"symbol-z-order\"]),\"icon-allow-overlap\":new nr(ee.layout_symbol[\"icon-allow-overlap\"]),\"icon-overlap\":new nr(ee.layout_symbol[\"icon-overlap\"]),\"icon-ignore-placement\":new nr(ee.layout_symbol[\"icon-ignore-placement\"]),\"icon-optional\":new nr(ee.layout_symbol[\"icon-optional\"]),\"icon-rotation-alignment\":new nr(ee.layout_symbol[\"icon-rotation-alignment\"]),\"icon-size\":new dr(ee.layout_symbol[\"icon-size\"]),\"icon-text-fit\":new nr(ee.layout_symbol[\"icon-text-fit\"]),\"icon-text-fit-padding\":new nr(ee.layout_symbol[\"icon-text-fit-padding\"]),\"icon-image\":new dr(ee.layout_symbol[\"icon-image\"]),\"icon-rotate\":new dr(ee.layout_symbol[\"icon-rotate\"]),\"icon-padding\":new dr(ee.layout_symbol[\"icon-padding\"]),\"icon-keep-upright\":new nr(ee.layout_symbol[\"icon-keep-upright\"]),\"icon-offset\":new dr(ee.layout_symbol[\"icon-offset\"]),\"icon-anchor\":new dr(ee.layout_symbol[\"icon-anchor\"]),\"icon-pitch-alignment\":new nr(ee.layout_symbol[\"icon-pitch-alignment\"]),\"text-pitch-alignment\":new nr(ee.layout_symbol[\"text-pitch-alignment\"]),\"text-rotation-alignment\":new nr(ee.layout_symbol[\"text-rotation-alignment\"]),\"text-field\":new dr(ee.layout_symbol[\"text-field\"]),\"text-font\":new dr(ee.layout_symbol[\"text-font\"]),\"text-size\":new dr(ee.layout_symbol[\"text-size\"]),\"text-max-width\":new dr(ee.layout_symbol[\"text-max-width\"]),\"text-line-height\":new nr(ee.layout_symbol[\"text-line-height\"]),\"text-letter-spacing\":new dr(ee.layout_symbol[\"text-letter-spacing\"]),\"text-justify\":new dr(ee.layout_symbol[\"text-justify\"]),\"text-radial-offset\":new dr(ee.layout_symbol[\"text-radial-offset\"]),\"text-variable-anchor\":new nr(ee.layout_symbol[\"text-variable-anchor\"]),\"text-variable-anchor-offset\":new dr(ee.layout_symbol[\"text-variable-anchor-offset\"]),\"text-anchor\":new dr(ee.layout_symbol[\"text-anchor\"]),\"text-max-angle\":new nr(ee.layout_symbol[\"text-max-angle\"]),\"text-writing-mode\":new nr(ee.layout_symbol[\"text-writing-mode\"]),\"text-rotate\":new dr(ee.layout_symbol[\"text-rotate\"]),\"text-padding\":new nr(ee.layout_symbol[\"text-padding\"]),\"text-keep-upright\":new nr(ee.layout_symbol[\"text-keep-upright\"]),\"text-transform\":new dr(ee.layout_symbol[\"text-transform\"]),\"text-offset\":new dr(ee.layout_symbol[\"text-offset\"]),\"text-allow-overlap\":new nr(ee.layout_symbol[\"text-allow-overlap\"]),\"text-overlap\":new nr(ee.layout_symbol[\"text-overlap\"]),\"text-ignore-placement\":new nr(ee.layout_symbol[\"text-ignore-placement\"]),\"text-optional\":new nr(ee.layout_symbol[\"text-optional\"])})}};class T6{constructor(a){if(a.property.overrides===void 0)throw new Error(\"overrides must be provided to instantiate FormatSectionOverride class\");this.type=a.property.overrides?a.property.overrides.runtimeType:Ca,this.defaultValue=a}evaluate(a){if(a.formattedSection){let h=this.defaultValue.property.overrides;if(h&&h.hasOverride(a.formattedSection))return h.getOverride(a.formattedSection)}return a.feature&&a.featureState?this.defaultValue.evaluate(a.feature,a.featureState):this.defaultValue.property.specification.default}eachChild(a){this.defaultValue.isConstant()||a(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ge(\"FormatSectionOverride\",T6,{omit:[\"defaultValue\"]});class aT extends ji{constructor(a){super(a,OC)}recalculate(a,h){if(super.recalculate(a,h),this.layout.get(\"icon-rotation-alignment\")===\"auto\"&&(this.layout._values[\"icon-rotation-alignment\"]=this.layout.get(\"symbol-placement\")!==\"point\"?\"map\":\"viewport\"),this.layout.get(\"text-rotation-alignment\")===\"auto\"&&(this.layout._values[\"text-rotation-alignment\"]=this.layout.get(\"symbol-placement\")!==\"point\"?\"map\":\"viewport\"),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\")),this.layout.get(\"symbol-placement\")===\"point\"){let A=this.layout.get(\"text-writing-mode\");if(A){let x=[];for(let E of A)x.indexOf(E)<0&&x.push(E);this.layout._values[\"text-writing-mode\"]=x}else this.layout._values[\"text-writing-mode\"]=[\"horizontal\"]}this._setPaintOverrides()}getValueAndResolveTokens(a,h,A,x){let E=this.layout.get(a).evaluate(h,{},A,x),P=this._unevaluatedLayout._values[a];return P.isDataDriven()||Yp(P.value)||!E?E:function(D,F){return F.replace(/{([^{}]+)}/g,(V,q)=>D&&q in D?String(D[q]):\"\")}(h.properties,E)}createBucket(a){return new C_(a)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error(\"Should take a different path in FeatureIndex\")}_setPaintOverrides(){for(let a of OC.paint.overridableProperties){if(!aT.hasPaintOverride(this.layout,a))continue;let h=this.paint.get(a),A=new T6(h),x=new Jm(A,h.property.specification),E=null;E=h.value.kind===\"constant\"||h.value.kind===\"source\"?new t0(\"source\",x):new wt(\"composite\",x,h.value.zoomStops),this.paint._values[a]=new Mo(h.property,E,h.parameters)}}_handleOverridablePaintPropertyUpdate(a,h,A){return!(!this.layout||h.isDataDriven()||A.isDataDriven())&&aT.hasPaintOverride(this.layout,a)}static hasPaintOverride(a,h){let A=a.get(\"text-field\"),x=OC.paint.properties[h],E=!1,P=D=>{for(let F of D)if(x.overrides&&x.overrides.hasOverride(F))return void(E=!0)};if(A.value.kind===\"constant\"&&A.value.value instanceof ln)P(A.value.value.sections);else if(A.value.kind===\"source\"){let D=V=>{E||(V instanceof Gl&&Ki(V.value)===gt?P(V.value.sections):V instanceof Ti?P(V.sections):V.eachChild(D))},F=A.value;F._styleExpression&&D(F._styleExpression.expression)}return E}}let M6;var tJ={get paint(){return M6=M6||new Hn({\"background-color\":new nr(ee.paint_background[\"background-color\"]),\"background-pattern\":new aA(ee.paint_background[\"background-pattern\"]),\"background-opacity\":new nr(ee.paint_background[\"background-opacity\"])})}};class eJ extends ji{constructor(a){super(a,tJ)}}let E6;var rJ={get paint(){return E6=E6||new Hn({\"raster-opacity\":new nr(ee.paint_raster[\"raster-opacity\"]),\"raster-hue-rotate\":new nr(ee.paint_raster[\"raster-hue-rotate\"]),\"raster-brightness-min\":new nr(ee.paint_raster[\"raster-brightness-min\"]),\"raster-brightness-max\":new nr(ee.paint_raster[\"raster-brightness-max\"]),\"raster-saturation\":new nr(ee.paint_raster[\"raster-saturation\"]),\"raster-contrast\":new nr(ee.paint_raster[\"raster-contrast\"]),\"raster-resampling\":new nr(ee.paint_raster[\"raster-resampling\"]),\"raster-fade-duration\":new nr(ee.paint_raster[\"raster-fade-duration\"])})}};class iJ extends ji{constructor(a){super(a,rJ)}}class nJ extends ji{constructor(a){super(a,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.painter.context.gl)},this.implementation=a}is3D(){return this.implementation.renderingMode===\"3d\"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error(\"Custom layers cannot be serialized\")}}class sJ{constructor(a){this._callback=a,this._triggered=!1,typeof MessageChannel<\"u\"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}let BC=63710088e-1;class dA{constructor(a,h){if(isNaN(a)||isNaN(h))throw new Error(`Invalid LngLat object: (${a}, ${h})`);if(this.lng=+a,this.lat=+h,this.lat>90||this.lat<-90)throw new Error(\"Invalid LngLat latitude value: must be between -90 and 90\")}wrap(){return new dA(Et(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(a){let h=Math.PI/180,A=this.lat*h,x=a.lat*h,E=Math.sin(A)*Math.sin(x)+Math.cos(A)*Math.cos(x)*Math.cos((a.lng-this.lng)*h);return BC*Math.acos(Math.min(E,1))}static convert(a){if(a instanceof dA)return a;if(Array.isArray(a)&&(a.length===2||a.length===3))return new dA(Number(a[0]),Number(a[1]));if(!Array.isArray(a)&&typeof a==\"object\"&&a!==null)return new dA(Number(\"lng\"in a?a.lng:a.lon),Number(a.lat));throw new Error(\"`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]\")}}let P6=2*Math.PI*BC;function I6(u){return P6*Math.cos(u*Math.PI/180)}function C6(u){return(180+u)/360}function L6(u){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u*Math.PI/360)))/360}function k6(u,a){return u/I6(a)}function R6(u){return 360*u-180}function FC(u){return 360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90}class lT{constructor(a,h,A=0){this.x=+a,this.y=+h,this.z=+A}static fromLngLat(a,h=0){let A=dA.convert(a);return new lT(C6(A.lng),L6(A.lat),k6(h,A.lat))}toLngLat(){return new dA(R6(this.x),FC(this.y))}toAltitude(){return this.z*I6(FC(this.y))}meterInMercatorCoordinateUnits(){return 1/P6*(a=FC(this.y),1/Math.cos(a*Math.PI/180));var a}}function D6(u,a,h){var A=2*Math.PI*6378137/256/Math.pow(2,h);return[u*A-2*Math.PI*6378137/2,a*A-2*Math.PI*6378137/2]}class zC{constructor(a,h,A){if(a<0||a>25||A<0||A>=Math.pow(2,a)||h<0||h>=Math.pow(2,a))throw new Error(`x=${h}, y=${A}, z=${a} outside of bounds. 0<=x<${Math.pow(2,a)}, 0<=y<${Math.pow(2,a)} 0<=z<=25 `);this.z=a,this.x=h,this.y=A,this.key=Kx(0,a,a,h,A)}equals(a){return this.z===a.z&&this.x===a.x&&this.y===a.y}url(a,h,A){let x=(P=this.y,D=this.z,F=D6(256*(E=this.x),256*(P=Math.pow(2,D)-P-1),D),V=D6(256*(E+1),256*(P+1),D),F[0]+\",\"+F[1]+\",\"+V[0]+\",\"+V[1]);var E,P,D,F,V;let q=function(X,rt,at){let ct,mt=\"\";for(let bt=X;bt>0;bt--)ct=1<1?\"@2x\":\"\").replace(/{quadkey}/g,q).replace(/{bbox-epsg-3857}/g,x)}isChildOf(a){let h=this.z-a.z;return h>0&&a.x===this.x>>h&&a.y===this.y>>h}getTilePoint(a){let h=Math.pow(2,this.z);return new w((a.x*h-this.x)*en,(a.y*h-this.y)*en)}toString(){return`${this.z}/${this.x}/${this.y}`}}class O6{constructor(a,h){this.wrap=a,this.canonical=h,this.key=Kx(a,h.z,h.z,h.x,h.y)}}class Nc{constructor(a,h,A,x,E){if(a= z; overscaledZ = ${a}; z = ${A}`);this.overscaledZ=a,this.wrap=h,this.canonical=new zC(A,+x,+E),this.key=Kx(h,a,A,x,E)}clone(){return new Nc(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(a){return this.overscaledZ===a.overscaledZ&&this.wrap===a.wrap&&this.canonical.equals(a.canonical)}scaledTo(a){if(a>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${a}; overscaledZ = ${this.overscaledZ}`);let h=this.canonical.z-a;return a>this.canonical.z?new Nc(a,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Nc(a,this.wrap,a,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(a,h){if(a>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${a}; overscaledZ = ${this.overscaledZ}`);let A=this.canonical.z-a;return a>this.canonical.z?Kx(this.wrap*+h,a,this.canonical.z,this.canonical.x,this.canonical.y):Kx(this.wrap*+h,a,a,this.canonical.x>>A,this.canonical.y>>A)}isChildOf(a){if(a.wrap!==this.wrap)return!1;let h=this.canonical.z-a.canonical.z;return a.overscaledZ===0||a.overscaledZ>h&&a.canonical.y===this.canonical.y>>h}children(a){if(this.overscaledZ>=a)return[new Nc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let h=this.canonical.z+1,A=2*this.canonical.x,x=2*this.canonical.y;return[new Nc(h,this.wrap,h,A,x),new Nc(h,this.wrap,h,A+1,x),new Nc(h,this.wrap,h,A,x+1),new Nc(h,this.wrap,h,A+1,x+1)]}isLessThan(a){return this.wrapa.wrap)&&(this.overscaledZa.overscaledZ)&&(this.canonical.xa.canonical.x)&&this.canonical.ythis.max&&(this.max=X),X=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError(\"out of range source coordinates for DEM data\");return(h+1)*this.stride+(a+1)}unpack(a,h,A){return a*this.redFactor+h*this.greenFactor+A*this.blueFactor-this.baseShift}getPixels(){return new zc({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(a,h,A){if(this.dim!==a.dim)throw new Error(\"dem dimension mismatch\");let x=h*this.dim,E=h*this.dim+this.dim,P=A*this.dim,D=A*this.dim+this.dim;switch(h){case-1:x=E-1;break;case 1:E=x+1}switch(A){case-1:P=D-1;break;case 1:D=P+1}let F=-h*this.dim,V=-A*this.dim;for(let q=P;q=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${a} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[a]}}class z6{constructor(a,h,A,x,E){this.type=\"Feature\",this._vectorTileFeature=a,a._z=h,a._x=A,a._y=x,this.properties=a.properties,this.id=E}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(a){this._geometry=a}toJSON(){let a={geometry:this.geometry};for(let h in this)h!==\"_geometry\"&&h!==\"_vectorTileFeature\"&&(a[h]=this[h]);return a}}class N6{constructor(a,h){this.tileID=a,this.x=a.canonical.x,this.y=a.canonical.y,this.z=a.canonical.z,this.grid=new Na(en,16,0),this.grid3D=new Na(en,16,0),this.featureIndexArray=new he,this.promoteId=h}insert(a,h,A,x,E,P){let D=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(A,x,E);let F=P?this.grid3D:this.grid;for(let V=0;V=0&&X[3]>=0&&F.insert(D,X[0],X[1],X[2],X[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new uA.VectorTile(new MC(this.rawTileData)).layers,this.sourceLayerCoder=new F6(this.vtLayers?Object.keys(this.vtLayers).sort():[\"_geojsonTileLayer\"])),this.vtLayers}query(a,h,A,x){this.loadVTLayers();let E=a.params||{},P=en/a.tileSize/a.scale,D=r0(E.filter),F=a.queryGeometry,V=a.queryPadding*P,q=V6(F),X=this.grid.query(q.minX-V,q.minY-V,q.maxX+V,q.maxY+V),rt=V6(a.cameraQueryGeometry),at=this.grid3D.query(rt.minX-V,rt.minY-V,rt.maxX+V,rt.maxY+V,(bt,Pt,jt,Rt)=>function(Gt,Yt,ce,Ne,ir){for(let Re of Gt)if(Yt<=Re.x&&ce<=Re.y&&Ne>=Re.x&&ir>=Re.y)return!0;let Fe=[new w(Yt,ce),new w(Yt,ir),new w(Ne,ir),new w(Ne,ce)];if(Gt.length>2){for(let Re of Fe)if(ne(Gt,Re))return!0}for(let Re=0;Re(Rt||(Rt=y(Gt)),Yt.queryIntersectsFeature(F,Gt,ce,Rt,this.z,a.transform,P,a.pixelPosMatrix)))}return ct}loadMatchingFeature(a,h,A,x,E,P,D,F,V,q,X){let rt=this.bucketLayerIDs[h];if(P&&!function(bt,Pt){for(let jt=0;jt=0)return!0;return!1}(P,rt))return;let at=this.sourceLayerCoder.decode(A),ct=this.vtLayers[at].feature(x);if(E.needGeometry){let bt=S(ct,!0);if(!E.filter(new un(this.tileID.overscaledZ),bt,this.tileID.canonical))return}else if(!E.filter(new un(this.tileID.overscaledZ),ct))return;let mt=this.getId(ct,at);for(let bt=0;bt{let D=a instanceof oA?a.get(P):null;return D&&D.evaluate?D.evaluate(h,A,x):D})}function V6(u){let a=1/0,h=1/0,A=-1/0,x=-1/0;for(let E of u)a=Math.min(a,E.x),h=Math.min(h,E.y),A=Math.max(A,E.x),x=Math.max(x,E.y);return{minX:a,minY:h,maxX:A,maxY:x}}function oJ(u,a){return a-u}function j6(u,a,h,A,x){let E=[];for(let P=0;P=A&&X.x>=A||(q.x>=A?q=new w(A,q.y+(A-q.x)/(X.x-q.x)*(X.y-q.y))._round():X.x>=A&&(X=new w(A,q.y+(A-q.x)/(X.x-q.x)*(X.y-q.y))._round()),q.y>=x&&X.y>=x||(q.y>=x?q=new w(q.x+(x-q.y)/(X.y-q.y)*(X.x-q.x),x)._round():X.y>=x&&(X=new w(q.x+(x-q.y)/(X.y-q.y)*(X.x-q.x),x)._round()),F&&q.equals(F[F.length-1])||(F=[q],E.push(F)),F.push(X)))))}}return E}Ge(\"FeatureIndex\",N6,{omit:[\"rawTileData\",\"sourceLayerCoder\"]});class pA extends w{constructor(a,h,A,x){super(a,h),this.angle=A,x!==void 0&&(this.segment=x)}clone(){return new pA(this.x,this.y,this.angle,this.segment)}}function G6(u,a,h,A,x){if(a.segment===void 0||h===0)return!0;let E=a,P=a.segment+1,D=0;for(;D>-h/2;){if(P--,P<0)return!1;D-=u[P].dist(E),E=u[P]}D+=u[P].dist(u[P+1]),P++;let F=[],V=0;for(;DA;)V-=F.shift().angleDelta;if(V>x)return!1;P++,D+=q.dist(X)}return!0}function W6(u){let a=0;for(let h=0;hV){let ct=(V-F)/at,mt=Da.number(X.x,rt.x,ct),bt=Da.number(X.y,rt.y,ct),Pt=new pA(mt,bt,rt.angleTo(X),q);return Pt._round(),!P||G6(u,Pt,D,P,a)?Pt:void 0}F+=at}}function lJ(u,a,h,A,x,E,P,D,F){let V=H6(A,E,P),q=q6(A,x),X=q*P,rt=u[0].x===0||u[0].x===F||u[0].y===0||u[0].y===F;return a-X
=0&&Gt=0&&Yt=0&&rt+V<=q){let ce=new pA(Gt,Yt,jt,ct);ce._round(),A&&!G6(u,ce,E,A,x)||at.push(ce)}}X+=Pt}return D||at.length||P||(at=Z6(u,X/2,h,A,x,E,P,!0,F)),at}Ge(\"Anchor\",pA);let L_=gl;function Y6(u,a,h,A){let x=[],E=u.image,P=E.pixelRatio,D=E.paddedRect.w-2*L_,F=E.paddedRect.h-2*L_,V=u.right-u.left,q=u.bottom-u.top,X=E.stretchX||[[0,D]],rt=E.stretchY||[[0,F]],at=(Me,Ye)=>Me+Ye[1]-Ye[0],ct=X.reduce(at,0),mt=rt.reduce(at,0),bt=D-ct,Pt=F-mt,jt=0,Rt=ct,Gt=0,Yt=mt,ce=0,Ne=bt,ir=0,Fe=Pt;if(E.content&&A){let Me=E.content;jt=cT(X,0,Me[0]),Gt=cT(rt,0,Me[1]),Rt=cT(X,Me[0],Me[2]),Yt=cT(rt,Me[1],Me[3]),ce=Me[0]-jt,ir=Me[1]-Gt,Ne=Me[2]-Me[0]-Rt,Fe=Me[3]-Me[1]-Yt}let Re=(Me,Ye,Ie,Ae)=>{let hr=uT(Me.stretch-jt,Rt,V,u.left),sr=hT(Me.fixed-ce,Ne,Me.stretch,ct),ri=uT(Ye.stretch-Gt,Yt,q,u.top),Tn=hT(Ye.fixed-ir,Fe,Ye.stretch,mt),Rn=uT(Ie.stretch-jt,Rt,V,u.left),qs=hT(Ie.fixed-ce,Ne,Ie.stretch,ct),Ql=uT(Ae.stretch-Gt,Yt,q,u.top),ja=hT(Ae.fixed-ir,Fe,Ae.stretch,mt),Is=new w(hr,ri),Po=new w(Rn,ri),$o=new w(Rn,Ql),Ga=new w(hr,Ql),Wa=new w(sr/P,Tn/P),Zs=new w(qs/P,ja/P),Ys=a*Math.PI/180;if(Ys){let fa=Math.sin(Ys),_l=Math.cos(Ys),yl=[_l,-fa,fa,_l];Is._matMult(yl),Po._matMult(yl),Ga._matMult(yl),$o._matMult(yl)}let ha=Me.stretch+Me.fixed,Ha=Ye.stretch+Ye.fixed;return{tl:Is,tr:Po,bl:Ga,br:$o,tex:{x:E.paddedRect.x+L_+ha,y:E.paddedRect.y+L_+Ha,w:Ie.stretch+Ie.fixed-ha,h:Ae.stretch+Ae.fixed-Ha},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Wa,pixelOffsetBR:Zs,minFontScaleX:Ne/P/V,minFontScaleY:Fe/P/q,isSDF:h}};if(A&&(E.stretchX||E.stretchY)){let Me=Q6(X,bt,ct),Ye=Q6(rt,Pt,mt);for(let Ie=0;Ie0&&(ct=Math.max(10,ct),this.circleDiameter=ct)}else{let X=P.top*D-F[0],rt=P.bottom*D+F[2],at=P.left*D-F[3],ct=P.right*D+F[1],mt=P.collisionPadding;if(mt&&(at-=mt[0]*D,X-=mt[1]*D,ct+=mt[2]*D,rt+=mt[3]*D),q){let bt=new w(at,X),Pt=new w(ct,X),jt=new w(at,rt),Rt=new w(ct,rt),Gt=q*Math.PI/180;bt._rotate(Gt),Pt._rotate(Gt),jt._rotate(Gt),Rt._rotate(Gt),at=Math.min(bt.x,Pt.x,jt.x,Rt.x),ct=Math.max(bt.x,Pt.x,jt.x,Rt.x),X=Math.min(bt.y,Pt.y,jt.y,Rt.y),rt=Math.max(bt.y,Pt.y,jt.y,Rt.y)}a.emplaceBack(h.x,h.y,at,X,ct,rt,A,x,E)}this.boxEndIndex=a.length}}class cJ{constructor(a=[],h=uJ){if(this.data=a,this.length=this.data.length,this.compare=h,this.length>0)for(let A=(this.length>>1)-1;A>=0;A--)this._down(A)}push(a){this.data.push(a),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let a=this.data[0],h=this.data.pop();return this.length--,this.length>0&&(this.data[0]=h,this._down(0)),a}peek(){return this.data[0]}_up(a){let{data:h,compare:A}=this,x=h[a];for(;a>0;){let E=a-1>>1,P=h[E];if(A(x,P)>=0)break;h[a]=P,a=E}h[a]=x}_down(a){let{data:h,compare:A}=this,x=this.length>>1,E=h[a];for(;a=0)break;h[a]=D,a=P}h[a]=E}}function uJ(u,a){return ua?1:0}function hJ(u,a=1,h=!1){let A=1/0,x=1/0,E=-1/0,P=-1/0,D=u[0];for(let at=0;atE)&&(E=ct.x),(!at||ct.y>P)&&(P=ct.y)}let F=Math.min(E-A,P-x),V=F/2,q=new cJ([],fJ);if(F===0)return new w(A,x);for(let at=A;atX.d||!X.d)&&(X=at,h&&console.log(\"found best %d after %d probes\",Math.round(1e4*at.d)/1e4,rt)),at.max-X.d<=a||(V=at.h/2,q.push(new k_(at.p.x-V,at.p.y-V,V,u)),q.push(new k_(at.p.x+V,at.p.y-V,V,u)),q.push(new k_(at.p.x-V,at.p.y+V,V,u)),q.push(new k_(at.p.x+V,at.p.y+V,V,u)),rt+=4)}return h&&(console.log(`num probes: ${rt}`),console.log(`best distance: ${X.d}`)),X.p}function fJ(u,a){return a.max-u.max}function k_(u,a,h,A){this.p=new w(u,a),this.h=h,this.d=function(x,E){let P=!1,D=1/0;for(let F=0;Fx.y!=ct.y>x.y&&x.x<(ct.x-at.x)*(x.y-at.y)/(ct.y-at.y)+at.x&&(P=!P),D=Math.min(D,Wt(x,at,ct))}}return(P?1:-1)*Math.sqrt(D)}(this.p,A),this.max=this.d+this.h*Math.SQRT2}var Qo;n.aq=void 0,(Qo=n.aq||(n.aq={}))[Qo.center=1]=\"center\",Qo[Qo.left=2]=\"left\",Qo[Qo.right=3]=\"right\",Qo[Qo.top=4]=\"top\",Qo[Qo.bottom=5]=\"bottom\",Qo[Qo[\"top-left\"]=6]=\"top-left\",Qo[Qo[\"top-right\"]=7]=\"top-right\",Qo[Qo[\"bottom-left\"]=8]=\"bottom-left\",Qo[Qo[\"bottom-right\"]=9]=\"bottom-right\";let AA=7,NC=Number.POSITIVE_INFINITY;function $6(u,a){return a[1]!==NC?function(h,A,x){let E=0,P=0;switch(A=Math.abs(A),x=Math.abs(x),h){case\"top-right\":case\"top-left\":case\"top\":P=x-AA;break;case\"bottom-right\":case\"bottom-left\":case\"bottom\":P=-x+AA}switch(h){case\"top-right\":case\"bottom-right\":case\"right\":E=-A;break;case\"top-left\":case\"bottom-left\":case\"left\":E=A}return[E,P]}(u,a[0],a[1]):function(h,A){let x=0,E=0;A<0&&(A=0);let P=A/Math.SQRT2;switch(h){case\"top-right\":case\"top-left\":E=P-AA;break;case\"bottom-right\":case\"bottom-left\":E=-P+AA;break;case\"bottom\":E=-A+AA;break;case\"top\":E=A-AA}switch(h){case\"top-right\":case\"bottom-right\":x=-P;break;case\"top-left\":case\"bottom-left\":x=P;break;case\"left\":x=A;break;case\"right\":x=-A}return[x,E]}(u,a[0])}function X6(u,a,h){var A;let x=u.layout,E=(A=x.get(\"text-variable-anchor-offset\"))===null||A===void 0?void 0:A.evaluate(a,{},h);if(E){let D=E.values,F=[];for(let V=0;Vrt*Hs);q.startsWith(\"top\")?X[1]-=AA:q.startsWith(\"bottom\")&&(X[1]+=AA),F[V+1]=X}return new Go(F)}let P=x.get(\"text-variable-anchor\");if(P){let D;D=u._unevaluatedLayout.getValue(\"text-radial-offset\")!==void 0?[x.get(\"text-radial-offset\").evaluate(a,{},h)*Hs,NC]:x.get(\"text-offset\").evaluate(a,{},h).map(V=>V*Hs);let F=[];for(let V of P)F.push(V,$6(V,D));return new Go(F)}return null}function UC(u){switch(u){case\"right\":case\"top-right\":case\"bottom-right\":return\"right\";case\"left\":case\"top-left\":case\"bottom-left\":return\"left\"}return\"center\"}function dJ(u,a,h,A,x,E,P,D,F,V,q){let X=E.textMaxSize.evaluate(a,{});X===void 0&&(X=P);let rt=u.layers[0].layout,at=rt.get(\"icon-offset\").evaluate(a,{},q),ct=J6(h.horizontal),mt=P/24,bt=u.tilePixelRatio*mt,Pt=u.tilePixelRatio*X/24,jt=u.tilePixelRatio*D,Rt=u.tilePixelRatio*rt.get(\"symbol-spacing\"),Gt=rt.get(\"text-padding\")*u.tilePixelRatio,Yt=function(Ae,hr,sr,ri=1){let Tn=Ae.get(\"icon-padding\").evaluate(hr,{},sr),Rn=Tn&&Tn.values;return[Rn[0]*ri,Rn[1]*ri,Rn[2]*ri,Rn[3]*ri]}(rt,a,q,u.tilePixelRatio),ce=rt.get(\"text-max-angle\")/180*Math.PI,Ne=rt.get(\"text-rotation-alignment\")!==\"viewport\"&&rt.get(\"symbol-placement\")!==\"point\",ir=rt.get(\"icon-rotation-alignment\")===\"map\"&&rt.get(\"symbol-placement\")!==\"point\",Fe=rt.get(\"symbol-placement\"),Re=Rt/2,Me=rt.get(\"icon-text-fit\"),Ye;A&&Me!==\"none\"&&(u.allowVerticalPlacement&&h.vertical&&(Ye=x6(A,h.vertical,Me,rt.get(\"icon-text-fit-padding\"),at,mt)),ct&&(A=x6(A,ct,Me,rt.get(\"icon-text-fit-padding\"),at,mt)));let Ie=(Ae,hr)=>{hr.x<0||hr.x>=en||hr.y<0||hr.y>=en||function(sr,ri,Tn,Rn,qs,Ql,ja,Is,Po,$o,Ga,Wa,Zs,Ys,ha,Ha,fa,_l,yl,Qs,di,da,Xo,$s,xu){let vh=sr.addToLineVertexArray(ri,Tn),xh,Ud,bu,Uc,vl=0,Vd=0,e1=0,iz=0,YC=-1,QC=-1,jd={},nz=yh(\"\");if(sr.allowVerticalPlacement&&Rn.vertical){let pa=Is.layout.get(\"text-rotate\").evaluate(di,{},$s)+90;bu=new fT(Po,ri,$o,Ga,Wa,Rn.vertical,Zs,Ys,ha,pa),ja&&(Uc=new fT(Po,ri,$o,Ga,Wa,ja,fa,_l,ha,pa))}if(qs){let pa=Is.layout.get(\"icon-rotate\").evaluate(di,{}),Vc=Is.layout.get(\"icon-text-fit\")!==\"none\",m0=Y6(qs,pa,Xo,Vc),wh=ja?Y6(ja,pa,Xo,Vc):void 0;Ud=new fT(Po,ri,$o,Ga,Wa,qs,fa,_l,!1,pa),vl=4*m0.length;let g0=sr.iconSizeData,Pf=null;g0.kind===\"source\"?(Pf=[Ef*Is.layout.get(\"icon-size\").evaluate(di,{})],Pf[0]>fA&&Ke(`${sr.layerIds[0]}: Value for \"icon-size\" is >= ${Xx}. Reduce your \"icon-size\".`)):g0.kind===\"composite\"&&(Pf=[Ef*da.compositeIconSizes[0].evaluate(di,{},$s),Ef*da.compositeIconSizes[1].evaluate(di,{},$s)],(Pf[0]>fA||Pf[1]>fA)&&Ke(`${sr.layerIds[0]}: Value for \"icon-size\" is >= ${Xx}. Reduce your \"icon-size\".`)),sr.addSymbols(sr.icon,m0,Pf,Qs,yl,di,n.ai.none,ri,vh.lineStartIndex,vh.lineLength,-1,$s),YC=sr.icon.placedSymbolArray.length-1,wh&&(Vd=4*wh.length,sr.addSymbols(sr.icon,wh,Pf,Qs,yl,di,n.ai.vertical,ri,vh.lineStartIndex,vh.lineLength,-1,$s),QC=sr.icon.placedSymbolArray.length-1)}let sz=Object.keys(Rn.horizontal);for(let pa of sz){let Vc=Rn.horizontal[pa];if(!xh){nz=yh(Vc.text);let wh=Is.layout.get(\"text-rotate\").evaluate(di,{},$s);xh=new fT(Po,ri,$o,Ga,Wa,Vc,Zs,Ys,ha,wh)}let m0=Vc.positionedLines.length===1;if(e1+=K6(sr,ri,Vc,Ql,Is,ha,di,Ha,vh,Rn.vertical?n.ai.horizontal:n.ai.horizontalOnly,m0?sz:[pa],jd,YC,da,$s),m0)break}Rn.vertical&&(iz+=K6(sr,ri,Rn.vertical,Ql,Is,ha,di,Ha,vh,n.ai.vertical,[\"vertical\"],jd,QC,da,$s));let mJ=xh?xh.boxStartIndex:sr.collisionBoxArray.length,gJ=xh?xh.boxEndIndex:sr.collisionBoxArray.length,_J=bu?bu.boxStartIndex:sr.collisionBoxArray.length,yJ=bu?bu.boxEndIndex:sr.collisionBoxArray.length,vJ=Ud?Ud.boxStartIndex:sr.collisionBoxArray.length,xJ=Ud?Ud.boxEndIndex:sr.collisionBoxArray.length,bJ=Uc?Uc.boxStartIndex:sr.collisionBoxArray.length,wJ=Uc?Uc.boxEndIndex:sr.collisionBoxArray.length,bh=-1,pT=(pa,Vc)=>pa&&pa.circleDiameter?Math.max(pa.circleDiameter,Vc):Vc;bh=pT(xh,bh),bh=pT(bu,bh),bh=pT(Ud,bh),bh=pT(Uc,bh);let oz=bh>-1?1:0;oz&&(bh*=xu/Hs),sr.glyphOffsetArray.length>=C_.MAX_GLYPHS&&Ke(\"Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907\"),di.sortKey!==void 0&&sr.addToSortKeyRanges(sr.symbolInstances.length,di.sortKey);let SJ=X6(Is,di,$s),[TJ,MJ]=function(pa,Vc){let m0=pa.length,wh=Vc?.values;if(wh?.length>0)for(let g0=0;g0=0?jd.right:-1,jd.center>=0?jd.center:-1,jd.left>=0?jd.left:-1,jd.vertical||-1,YC,QC,nz,mJ,gJ,_J,yJ,vJ,xJ,bJ,wJ,$o,e1,iz,vl,Vd,oz,0,Zs,bh,TJ,MJ)}(u,hr,Ae,h,A,x,Ye,u.layers[0],u.collisionBoxArray,a.index,a.sourceLayerIndex,u.index,bt,[Gt,Gt,Gt,Gt],Ne,F,jt,Yt,ir,at,a,E,V,q,P)};if(Fe===\"line\")for(let Ae of j6(a.geometry,0,0,en,en)){let hr=lJ(Ae,Rt,ce,h.vertical||ct,A,24,Pt,u.overscaling,en);for(let sr of hr)ct&&pJ(u,ct.text,Re,sr)||Ie(Ae,sr)}else if(Fe===\"line-center\"){for(let Ae of a.geometry)if(Ae.length>1){let hr=aJ(Ae,ce,h.vertical||ct,A,24,Pt);hr&&Ie(Ae,hr)}}else if(a.type===\"Polygon\")for(let Ae of _C(a.geometry,0)){let hr=hJ(Ae,16);Ie(Ae[0],new pA(hr.x,hr.y,0))}else if(a.type===\"LineString\")for(let Ae of a.geometry)Ie(Ae,new pA(Ae[0].x,Ae[0].y,0));else if(a.type===\"Point\")for(let Ae of a.geometry)for(let hr of Ae)Ie([hr],new pA(hr.x,hr.y,0))}function K6(u,a,h,A,x,E,P,D,F,V,q,X,rt,at,ct){let mt=function(jt,Rt,Gt,Yt,ce,Ne,ir,Fe){let Re=Yt.layout.get(\"text-rotate\").evaluate(Ne,{})*Math.PI/180,Me=[];for(let Ye of Rt.positionedLines)for(let Ie of Ye.positionedGlyphs){if(!Ie.rect)continue;let Ae=Ie.rect||{},hr=p6+1,sr=!0,ri=1,Tn=0,Rn=(ce||Fe)&&Ie.vertical,qs=Ie.metrics.advance*Ie.scale/2;if(Fe&&Rt.verticalizable&&(Tn=Ye.lineOffset/2-(Ie.imageName?-(Hs-Ie.metrics.width*Ie.scale)/2:(Ie.scale-1)*Hs)),Ie.imageName){let Qs=ir[Ie.imageName];sr=Qs.sdf,ri=Qs.pixelRatio,hr=gl/ri}let Ql=ce?[Ie.x+qs,Ie.y]:[0,0],ja=ce?[0,0]:[Ie.x+qs+Gt[0],Ie.y+Gt[1]-Tn],Is=[0,0];Rn&&(Is=ja,ja=[0,0]);let Po=Ie.metrics.isDoubleResolution?2:1,$o=(Ie.metrics.left-hr)*Ie.scale-qs+ja[0],Ga=(-Ie.metrics.top-hr)*Ie.scale+ja[1],Wa=$o+Ae.w/Po*Ie.scale/ri,Zs=Ga+Ae.h/Po*Ie.scale/ri,Ys=new w($o,Ga),ha=new w(Wa,Ga),Ha=new w($o,Zs),fa=new w(Wa,Zs);if(Rn){let Qs=new w(-qs,qs-Qx),di=-Math.PI/2,da=Hs/2-qs,Xo=new w(5-Qx-da,-(Ie.imageName?da:0)),$s=new w(...Is);Ys._rotateAround(di,Qs)._add(Xo)._add($s),ha._rotateAround(di,Qs)._add(Xo)._add($s),Ha._rotateAround(di,Qs)._add(Xo)._add($s),fa._rotateAround(di,Qs)._add(Xo)._add($s)}if(Re){let Qs=Math.sin(Re),di=Math.cos(Re),da=[di,-Qs,Qs,di];Ys._matMult(da),ha._matMult(da),Ha._matMult(da),fa._matMult(da)}let _l=new w(0,0),yl=new w(0,0);Me.push({tl:Ys,tr:ha,bl:Ha,br:fa,tex:Ae,writingMode:Rt.writingMode,glyphOffset:Ql,sectionIndex:Ie.sectionIndex,isSDF:sr,pixelOffsetTL:_l,pixelOffsetBR:yl,minFontScaleX:0,minFontScaleY:0})}return Me}(0,h,D,x,E,P,A,u.allowVerticalPlacement),bt=u.textSizeData,Pt=null;bt.kind===\"source\"?(Pt=[Ef*x.layout.get(\"text-size\").evaluate(P,{})],Pt[0]>fA&&Ke(`${u.layerIds[0]}: Value for \"text-size\" is >= ${Xx}. Reduce your \"text-size\".`)):bt.kind===\"composite\"&&(Pt=[Ef*at.compositeTextSizes[0].evaluate(P,{},ct),Ef*at.compositeTextSizes[1].evaluate(P,{},ct)],(Pt[0]>fA||Pt[1]>fA)&&Ke(`${u.layerIds[0]}: Value for \"text-size\" is >= ${Xx}. Reduce your \"text-size\".`)),u.addSymbols(u.text,mt,Pt,D,E,P,V,a,F.lineStartIndex,F.lineLength,rt,ct);for(let jt of q)X[jt]=u.text.placedSymbolArray.length-1;return 4*mt.length}function J6(u){for(let a in u)return u[a];return null}function pJ(u,a,h,A){let x=u.compareText;if(a in x){let E=x[a];for(let P=E.length-1;P>=0;P--)if(A.dist(E[P])>4;if(x!==1)throw new Error(`Got v${x} data when expected v1.`);let E=tz[15&A];if(!E)throw new Error(\"Unrecognized array type.\");let[P]=new Uint16Array(a,2,1),[D]=new Uint32Array(a,4,1);return new VC(D,P,E,a)}constructor(a,h=64,A=Float64Array,x){if(isNaN(a)||a<0)throw new Error(`Unpexpected numItems value: ${a}.`);this.numItems=+a,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=A,this.IndexArrayType=a<65536?Uint16Array:Uint32Array;let E=tz.indexOf(this.ArrayType),P=2*a*this.ArrayType.BYTES_PER_ELEMENT,D=a*this.IndexArrayType.BYTES_PER_ELEMENT,F=(8-D%8)%8;if(E<0)throw new Error(`Unexpected typed array class: ${A}.`);x&&x instanceof ArrayBuffer?(this.data=x,this.ids=new this.IndexArrayType(this.data,8,a),this.coords=new this.ArrayType(this.data,8+D+F,2*a),this._pos=2*a,this._finished=!0):(this.data=new ArrayBuffer(8+P+D+F),this.ids=new this.IndexArrayType(this.data,8,a),this.coords=new this.ArrayType(this.data,8+D+F,2*a),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+E]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=a)}add(a,h){let A=this._pos>>1;return this.ids[A]=A,this.coords[this._pos++]=a,this.coords[this._pos++]=h,A}finish(){let a=this._pos>>1;if(a!==this.numItems)throw new Error(`Added ${a} items when expected ${this.numItems}.`);return jC(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(a,h,A,x){if(!this._finished)throw new Error(\"Data not yet indexed - call index.finish().\");let{ids:E,coords:P,nodeSize:D}=this,F=[0,E.length-1,0],V=[];for(;F.length;){let q=F.pop()||0,X=F.pop()||0,rt=F.pop()||0;if(X-rt<=D){for(let bt=rt;bt<=X;bt++){let Pt=P[2*bt],jt=P[2*bt+1];Pt>=a&&Pt<=A&&jt>=h&&jt<=x&&V.push(E[bt])}continue}let at=rt+X>>1,ct=P[2*at],mt=P[2*at+1];ct>=a&&ct<=A&&mt>=h&&mt<=x&&V.push(E[at]),(q===0?a<=ct:h<=mt)&&(F.push(rt),F.push(at-1),F.push(1-q)),(q===0?A>=ct:x>=mt)&&(F.push(at+1),F.push(X),F.push(1-q))}return V}within(a,h,A){if(!this._finished)throw new Error(\"Data not yet indexed - call index.finish().\");let{ids:x,coords:E,nodeSize:P}=this,D=[0,x.length-1,0],F=[],V=A*A;for(;D.length;){let q=D.pop()||0,X=D.pop()||0,rt=D.pop()||0;if(X-rt<=P){for(let bt=rt;bt<=X;bt++)rz(E[2*bt],E[2*bt+1],a,h)<=V&&F.push(x[bt]);continue}let at=rt+X>>1,ct=E[2*at],mt=E[2*at+1];rz(ct,mt,a,h)<=V&&F.push(x[at]),(q===0?a-A<=ct:h-A<=mt)&&(D.push(rt),D.push(at-1),D.push(1-q)),(q===0?a+A>=ct:h+A>=mt)&&(D.push(at+1),D.push(X),D.push(1-q))}return F}}function jC(u,a,h,A,x,E){if(x-A<=h)return;let P=A+x>>1;ez(u,a,P,A,x,E),jC(u,a,h,A,P-1,1-E),jC(u,a,h,P+1,x,1-E)}function ez(u,a,h,A,x,E){for(;x>A;){if(x-A>600){let V=x-A+1,q=h-A+1,X=Math.log(V),rt=.5*Math.exp(2*X/3),at=.5*Math.sqrt(X*rt*(V-rt)/V)*(q-V/2<0?-1:1);ez(u,a,h,Math.max(A,Math.floor(h-q*rt/V+at)),Math.min(x,Math.floor(h+(V-q)*rt/V+at)),E)}let P=a[2*h+E],D=A,F=x;for(Jx(u,a,A,h),a[2*x+E]>P&&Jx(u,a,A,x);DP;)F--}a[2*A+E]===P?Jx(u,a,A,F):(F++,Jx(u,a,F,x)),F<=h&&(A=F+1),h<=F&&(x=F-1)}}function Jx(u,a,h,A){GC(u,h,A),GC(a,2*h,2*A),GC(a,2*h+1,2*A+1)}function GC(u,a,h){let A=u[a];u[a]=u[h],u[h]=A}function rz(u,a,h,A){let x=u-h,E=a-A;return x*x+E*E}var WC;n.bh=void 0,(WC=n.bh||(n.bh={})).create=\"create\",WC.load=\"load\",WC.fullLoad=\"fullLoad\";let dT=null,t1=[],HC=1e3/60,qC=\"loadTime\",ZC=\"fullLoadTime\",AJ={mark(u){performance.mark(u)},frame(u){let a=u;dT!=null&&t1.push(a-dT),dT=a},clearMetrics(){dT=null,t1=[],performance.clearMeasures(qC),performance.clearMeasures(ZC);for(let u in n.bh)performance.clearMarks(n.bh[u])},getPerformanceMetrics(){performance.measure(qC,n.bh.create,n.bh.load),performance.measure(ZC,n.bh.create,n.bh.fullLoad);let u=performance.getEntriesByName(qC)[0].duration,a=performance.getEntriesByName(ZC)[0].duration,h=t1.length,A=1/(t1.reduce((E,P)=>E+P,0)/h/1e3),x=t1.filter(E=>E>HC).reduce((E,P)=>E+(P-HC)/HC,0);return{loadTime:u,fullLoadTime:a,fps:A,percentDroppedFrames:x/(h+x)*100,totalFrames:h}}};n.$=function(u,a,h){var A,x,E,P,D,F,V,q,X,rt,at,ct,mt=h[0],bt=h[1],Pt=h[2];return a===u?(u[12]=a[0]*mt+a[4]*bt+a[8]*Pt+a[12],u[13]=a[1]*mt+a[5]*bt+a[9]*Pt+a[13],u[14]=a[2]*mt+a[6]*bt+a[10]*Pt+a[14],u[15]=a[3]*mt+a[7]*bt+a[11]*Pt+a[15]):(x=a[1],E=a[2],P=a[3],D=a[4],F=a[5],V=a[6],q=a[7],X=a[8],rt=a[9],at=a[10],ct=a[11],u[0]=A=a[0],u[1]=x,u[2]=E,u[3]=P,u[4]=D,u[5]=F,u[6]=V,u[7]=q,u[8]=X,u[9]=rt,u[10]=at,u[11]=ct,u[12]=A*mt+D*bt+X*Pt+a[12],u[13]=x*mt+F*bt+rt*Pt+a[13],u[14]=E*mt+V*bt+at*Pt+a[14],u[15]=P*mt+q*bt+ct*Pt+a[15]),u},n.A=je,n.B=Da,n.C=class{constructor(u,a,h){this.receive=A=>{let x=A.data,E=x.id;if(E&&(!x.targetMapId||this.mapId===x.targetMapId))if(x.type===\"\"){delete this.tasks[E];let P=this.cancelCallbacks[E];delete this.cancelCallbacks[E],P&&P()}else Li()||x.mustQueue?(this.tasks[E]=x,this.taskQueue.push(E),this.invoker.trigger()):this.processTask(E,x)},this.process=()=>{if(!this.taskQueue.length)return;let A=this.taskQueue.shift(),x=this.tasks[A];delete this.tasks[A],this.taskQueue.length&&this.invoker.trigger(),x&&this.processTask(A,x)},this.target=u,this.parent=a,this.mapId=h,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new sJ(this.process),this.target.addEventListener(\"message\",this.receive,!1),this.globalScope=Li()?u:window}send(u,a,h,A,x=!1){let E=Math.round(1e18*Math.random()).toString(36).substring(0,10);h&&(this.callbacks[E]=h);let P=[],D={id:E,type:u,hasCallback:!!h,targetMapId:A,mustQueue:x,sourceMapId:this.mapId,data:Hl(a,P)};return this.target.postMessage(D,{transfer:P}),{cancel:()=>{h&&delete this.callbacks[E],this.target.postMessage({id:E,type:\"\",targetMapId:A,sourceMapId:this.mapId})}}}processTask(u,a){if(a.type===\"\"){let h=this.callbacks[u];delete this.callbacks[u],h&&(a.error?h(xf(a.error)):h(null,xf(a.data)))}else{let h=!1,A=[],x=a.hasCallback?(D,F)=>{h=!0,delete this.cancelCallbacks[u];let V={id:u,type:\"\",sourceMapId:this.mapId,error:D?Hl(D):null,data:Hl(F,A)};this.target.postMessage(V,{transfer:A})}:D=>{h=!0},E=null,P=xf(a.data);if(this.parent[a.type])E=this.parent[a.type](a.sourceMapId,P,x);else if(\"getWorkerSource\"in this.parent){let D=a.type.split(\".\");E=this.parent.getWorkerSource(a.sourceMapId,D[0],P.source)[D[1]](P,x)}else x(new Error(`Could not find function ${a.type}`));!h&&E&&E.cancel&&(this.cancelCallbacks[u]=E.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener(\"message\",this.receive,!1)}},n.D=nr,n.E=Nl,n.F=function(u,a){let h={};for(let A=0;A{}}},n.Y=ve,n.Z=function(){var u=new je(16);return je!=Float32Array&&(u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=0,u[12]=0,u[13]=0,u[14]=0),u[0]=1,u[5]=1,u[10]=1,u[15]=1,u},n._=o,n.a=zl,n.a$=class extends st{},n.a0=function(u,a,h){var A=h[0],x=h[1],E=h[2];return u[0]=a[0]*A,u[1]=a[1]*A,u[2]=a[2]*A,u[3]=a[3]*A,u[4]=a[4]*x,u[5]=a[5]*x,u[6]=a[6]*x,u[7]=a[7]*x,u[8]=a[8]*E,u[9]=a[9]*E,u[10]=a[10]*E,u[11]=a[11]*E,u[12]=a[12],u[13]=a[13],u[14]=a[14],u[15]=a[15],u},n.a1=qi,n.a2=function(){return Xt++},n.a3=yt,n.a4=C_,n.a5=function(){ua.isLoading()||ua.isLoaded()||f0()!==\"deferred\"||v_()},n.a6=r0,n.a7=S,n.a8=un,n.a9=z6,n.aA=Bc,n.aB=function(u){u=u.slice();let a=Object.create(null);for(let h=0;h{A[P.source]?h.push({command:oi.removeLayer,args:[P.id]}):E.push(P)}),h=h.concat(x),function(P,D,F){D=D||[];let V=(P=P||[]).map(Ia),q=D.map(Ia),X=P.reduce(wo,{}),rt=D.reduce(wo,{}),at=V.slice(),ct=Object.create(null),mt,bt,Pt,jt,Rt,Gt,Yt;for(mt=0,bt=0;mt@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)(?:\\=(?:([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)|(?:\\\"((?:[^\"\\\\]|\\\\.)*)\\\")))?/g,(h,A,x,E)=>{let P=x||E;return a[A]=!P||P.toLowerCase(),\"\"}),a[\"max-age\"]){let h=parseInt(a[\"max-age\"],10);isNaN(h)?delete a[\"max-age\"]:a[\"max-age\"]=h}return a},n.ab=function(u,a){let h=[];for(let A in u)A in a||h.push(A);return h},n.ac=function(u){if(oo==null){let a=u.navigator?u.navigator.userAgent:null;oo=!!u.safari||!(!a||!(/\\b(iPad|iPhone|iPod)\\b/.test(a)||a.match(\"Safari\")&&!a.match(\"Chrome\")))}return oo},n.ad=ut,n.ae=function(u,a,h){var A=Math.sin(h),x=Math.cos(h),E=a[0],P=a[1],D=a[2],F=a[3],V=a[4],q=a[5],X=a[6],rt=a[7];return a!==u&&(u[8]=a[8],u[9]=a[9],u[10]=a[10],u[11]=a[11],u[12]=a[12],u[13]=a[13],u[14]=a[14],u[15]=a[15]),u[0]=E*x+V*A,u[1]=P*x+q*A,u[2]=D*x+X*A,u[3]=F*x+rt*A,u[4]=V*x-E*A,u[5]=q*x-P*A,u[6]=X*x-D*A,u[7]=rt*x-F*A,u},n.af=function(u){var a=new je(16);return a[0]=u[0],a[1]=u[1],a[2]=u[2],a[3]=u[3],a[4]=u[4],a[5]=u[5],a[6]=u[6],a[7]=u[7],a[8]=u[8],a[9]=u[9],a[10]=u[10],a[11]=u[11],a[12]=u[12],a[13]=u[13],a[14]=u[14],a[15]=u[15],a},n.ag=Pi,n.ah=function(u,a){let h=0,A=0;if(u.kind===\"constant\")A=u.layoutSize;else if(u.kind!==\"source\"){let{interpolationType:x,minZoom:E,maxZoom:P}=u,D=x?ut(Oa.interpolationFactor(x,a,E,P),0,1):0;u.kind===\"camera\"?A=Da.number(u.minSize,u.maxSize,D):h=D}return{uSizeT:h,uSize:A}},n.aj=function(u,{uSize:a,uSizeT:h},{lowerSize:A,upperSize:x}){return u.kind===\"source\"?A/Ef:u.kind===\"composite\"?Da.number(A/Ef,x/Ef,h):a},n.ak=kC,n.al=function(u,a,h,A){let x=a.y-u.y,E=a.x-u.x,P=A.y-h.y,D=A.x-h.x,F=P*E-D*x;if(F===0)return null;let V=(D*(u.y-h.y)-P*(u.x-h.x))/F;return new w(u.x+V*E,u.y+V*x)},n.am=j6,n.an=L,n.ao=Zr,n.ap=Hs,n.ar=LC,n.as=function(u,a){var h=a[0],A=a[1],x=a[2],E=a[3],P=a[4],D=a[5],F=a[6],V=a[7],q=a[8],X=a[9],rt=a[10],at=a[11],ct=a[12],mt=a[13],bt=a[14],Pt=a[15],jt=h*D-A*P,Rt=h*F-x*P,Gt=h*V-E*P,Yt=A*F-x*D,ce=A*V-E*D,Ne=x*V-E*F,ir=q*mt-X*ct,Fe=q*bt-rt*ct,Re=q*Pt-at*ct,Me=X*bt-rt*mt,Ye=X*Pt-at*mt,Ie=rt*Pt-at*bt,Ae=jt*Ie-Rt*Ye+Gt*Me+Yt*Re-ce*Fe+Ne*ir;return Ae?(u[0]=(D*Ie-F*Ye+V*Me)*(Ae=1/Ae),u[1]=(x*Ye-A*Ie-E*Me)*Ae,u[2]=(mt*Ne-bt*ce+Pt*Yt)*Ae,u[3]=(rt*ce-X*Ne-at*Yt)*Ae,u[4]=(F*Re-P*Ie-V*Fe)*Ae,u[5]=(h*Ie-x*Re+E*Fe)*Ae,u[6]=(bt*Gt-ct*Ne-Pt*Rt)*Ae,u[7]=(q*Ne-rt*Gt+at*Rt)*Ae,u[8]=(P*Ye-D*Re+V*ir)*Ae,u[9]=(A*Re-h*Ye-E*ir)*Ae,u[10]=(ct*ce-mt*Gt+Pt*jt)*Ae,u[11]=(X*Gt-q*ce-at*jt)*Ae,u[12]=(D*Fe-P*Me-F*ir)*Ae,u[13]=(h*Me-A*Fe+x*ir)*Ae,u[14]=(mt*Rt-ct*Yt-bt*jt)*Ae,u[15]=(q*Yt-X*Rt+rt*jt)*Ae,u):null},n.at=UC,n.au=CC,n.av=VC,n.aw=function(){let u={},a=ee.$version;for(let h in ee.$root){let A=ee.$root[h];if(A.required){let x=null;x=h===\"version\"?a:A.type===\"array\"?[]:{},x!=null&&(u[h]=x)}}return u},n.ax=oi,n.ay=__,n.az=Jn,n.b=function(u,a){let h=new Blob([new Uint8Array(u)],{type:\"image/png\"});createImageBitmap(h).then(A=>{a(null,A)}).catch(A=>{a(new Error(`Could not load image because of ${A.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},n.b0=Gs,n.b1=function(u,a){var h=u[0],A=u[1],x=u[2],E=u[3],P=u[4],D=u[5],F=u[6],V=u[7],q=u[8],X=u[9],rt=u[10],at=u[11],ct=u[12],mt=u[13],bt=u[14],Pt=u[15],jt=a[0],Rt=a[1],Gt=a[2],Yt=a[3],ce=a[4],Ne=a[5],ir=a[6],Fe=a[7],Re=a[8],Me=a[9],Ye=a[10],Ie=a[11],Ae=a[12],hr=a[13],sr=a[14],ri=a[15];return Math.abs(h-jt)<=we*Math.max(1,Math.abs(h),Math.abs(jt))&&Math.abs(A-Rt)<=we*Math.max(1,Math.abs(A),Math.abs(Rt))&&Math.abs(x-Gt)<=we*Math.max(1,Math.abs(x),Math.abs(Gt))&&Math.abs(E-Yt)<=we*Math.max(1,Math.abs(E),Math.abs(Yt))&&Math.abs(P-ce)<=we*Math.max(1,Math.abs(P),Math.abs(ce))&&Math.abs(D-Ne)<=we*Math.max(1,Math.abs(D),Math.abs(Ne))&&Math.abs(F-ir)<=we*Math.max(1,Math.abs(F),Math.abs(ir))&&Math.abs(V-Fe)<=we*Math.max(1,Math.abs(V),Math.abs(Fe))&&Math.abs(q-Re)<=we*Math.max(1,Math.abs(q),Math.abs(Re))&&Math.abs(X-Me)<=we*Math.max(1,Math.abs(X),Math.abs(Me))&&Math.abs(rt-Ye)<=we*Math.max(1,Math.abs(rt),Math.abs(Ye))&&Math.abs(at-Ie)<=we*Math.max(1,Math.abs(at),Math.abs(Ie))&&Math.abs(ct-Ae)<=we*Math.max(1,Math.abs(ct),Math.abs(Ae))&&Math.abs(mt-hr)<=we*Math.max(1,Math.abs(mt),Math.abs(hr))&&Math.abs(bt-sr)<=we*Math.max(1,Math.abs(bt),Math.abs(sr))&&Math.abs(Pt-ri)<=we*Math.max(1,Math.abs(Pt),Math.abs(ri))},n.b2=function(u,a){return u[0]=a[0],u[1]=a[1],u[2]=a[2],u[3]=a[3],u[4]=a[4],u[5]=a[5],u[6]=a[6],u[7]=a[7],u[8]=a[8],u[9]=a[9],u[10]=a[10],u[11]=a[11],u[12]=a[12],u[13]=a[13],u[14]=a[14],u[15]=a[15],u},n.b3=function(u,a,h){return u[0]=a[0]*h[0],u[1]=a[1]*h[1],u[2]=a[2]*h[2],u[3]=a[3]*h[3],u},n.b4=function(u,a){return u[0]*a[0]+u[1]*a[1]+u[2]*a[2]+u[3]*a[3]},n.b5=Et,n.b6=O6,n.b7=k6,n.b8=function(u,a,h,A,x){var E,P=1/Math.tan(a/2);return u[0]=P/h,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=P,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=-1,u[12]=0,u[13]=0,u[15]=0,x!=null&&x!==1/0?(u[10]=(x+A)*(E=1/(A-x)),u[14]=2*x*A*E):(u[10]=-1,u[14]=-2*A),u},n.b9=function(u,a,h){var A=Math.sin(h),x=Math.cos(h),E=a[4],P=a[5],D=a[6],F=a[7],V=a[8],q=a[9],X=a[10],rt=a[11];return a!==u&&(u[0]=a[0],u[1]=a[1],u[2]=a[2],u[3]=a[3],u[12]=a[12],u[13]=a[13],u[14]=a[14],u[15]=a[15]),u[4]=E*x+V*A,u[5]=P*x+q*A,u[6]=D*x+X*A,u[7]=F*x+rt*A,u[8]=V*x-E*A,u[9]=q*x-P*A,u[10]=X*x-D*A,u[11]=rt*x-F*A,u},n.bA=f,n.bB=a6,n.bC=Qp,n.bD=ua,n.ba=K,n.bb=J,n.bc=function(u,a){return u[0]=a[0],u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=a[1],u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=a[2],u[11]=0,u[12]=0,u[13]=0,u[14]=0,u[15]=1,u},n.bd=class extends gh{},n.be=BC,n.bf=R6,n.bg=AJ,n.bi=Xi,n.bj=function(u,a,h=!1){if(us===u0||us===iA||us===nA)throw new Error(\"setRTLTextPlugin cannot be called multiple times.\");_u=kc.resolveURL(u),us=u0,ph=a,h0(),h||v_()},n.bk=f0,n.bl=function(u,a){let h={};for(let x=0;xAe*Hs)}let Fe=P?\"center\":h.get(\"text-justify\").evaluate(V,{},u.canonical),Re=h.get(\"symbol-placement\"),Me=Re===\"point\"?h.get(\"text-max-width\").evaluate(V,{},u.canonical)*Hs:0,Ye=()=>{u.bucket.allowVerticalPlacement&&o0(Gt)&&(ct.vertical=nT(mt,u.glyphMap,u.glyphPositions,u.imagePositions,q,Me,E,Ne,\"left\",ce,Pt,n.ai.vertical,!0,Re,rt,X))};if(!P&&ir){let Ie=new Set;if(Fe===\"auto\")for(let hr=0;hr{a(null,h),URL.revokeObjectURL(h.src),h.onload=null,window.requestAnimationFrame(()=>{h.src=No})},h.onerror=()=>a(new Error(\"Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.\"));let A=new Blob([new Uint8Array(u)],{type:\"image/png\"});h.src=u.byteLength?URL.createObjectURL(A):No},n.e=kt,n.f=function(u,a){return Vo(kt(u,{type:\"json\"}),a)},n.g=ki,n.h=kc,n.i=Li,n.j=ao,n.k=as,n.l=cl,n.m=Vo,n.n=function(u){return new MC(u).readFields(WK,[])},n.o=function(u,a,h){if(!u.length)return h(null,[]);let A=u.length,x=new Array(u.length),E=null;u.forEach((P,D)=>{a(P,(F,V)=>{F&&(E=F),x[D]=V,--A==0&&h(E,x)})})},n.p=A6,n.q=Vx,n.r=Hn,n.s=xo,n.t=hh,n.u=Oe,n.v=ee,n.w=Ke,n.x=fh,n.y=za,n.z=function([u,a,h]){return a+=90,a*=Math.PI/180,h*=Math.PI/180,{x:u*Math.cos(a)*Math.sin(h),y:u*Math.sin(a)*Math.sin(h),z:u*Math.cos(h)}}}),i([\"./shared\"],function(n){\"use strict\";class o{constructor(tt){this.keyCache={},tt&&this.replace(tt)}replace(tt){this._layerConfigs={},this._layers={},this.update(tt,[])}update(tt,nt){for(let vt of tt){this._layerConfigs[vt.id]=vt;let xt=this._layers[vt.id]=n.aC(vt);xt._featureFilter=n.a6(xt.filter),this.keyCache[vt.id]&&delete this.keyCache[vt.id]}for(let vt of nt)delete this.keyCache[vt],delete this._layerConfigs[vt],delete this._layers[vt];this.familiesBySource={};let ht=n.bl(Object.values(this._layerConfigs),this.keyCache);for(let vt of ht){let xt=vt.map(se=>this._layers[se.id]),_t=xt[0];if(_t.visibility===\"none\")continue;let Dt=_t.source||\"\",Mt=this.familiesBySource[Dt];Mt||(Mt=this.familiesBySource[Dt]={});let Vt=_t.sourceLayer||\"_geojsonTileLayer\",ie=Mt[Vt];ie||(ie=Mt[Vt]=[]),ie.push(xt)}}}class c{constructor(tt){let nt={},ht=[];for(let Dt in tt){let Mt=tt[Dt],Vt=nt[Dt]={};for(let ie in Mt){let se=Mt[+ie];if(!se||se.bitmap.width===0||se.bitmap.height===0)continue;let ae={x:0,y:0,w:se.bitmap.width+2,h:se.bitmap.height+2};ht.push(ae),Vt[ie]={rect:ae,metrics:se.metrics}}}let{w:vt,h:xt}=n.p(ht),_t=new n.q({width:vt||1,height:xt||1});for(let Dt in tt){let Mt=tt[Dt];for(let Vt in Mt){let ie=Mt[+Vt];if(!ie||ie.bitmap.width===0||ie.bitmap.height===0)continue;let se=nt[Dt][Vt].rect;n.q.copy(ie.bitmap,_t,{x:0,y:0},{x:se.x+1,y:se.y+1},ie.bitmap)}}this.image=_t,this.positions=nt}}n.bm(\"GlyphAtlas\",c);class f{constructor(tt){this.tileID=new n.O(tt.tileID.overscaledZ,tt.tileID.wrap,tt.tileID.canonical.z,tt.tileID.canonical.x,tt.tileID.canonical.y),this.uid=tt.uid,this.zoom=tt.zoom,this.pixelRatio=tt.pixelRatio,this.tileSize=tt.tileSize,this.source=tt.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=tt.showCollisionBoxes,this.collectResourceTiming=!!tt.collectResourceTiming,this.returnDependencies=!!tt.returnDependencies,this.promoteId=tt.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(tt,nt,ht,vt,xt){this.status=\"parsing\",this.data=tt,this.collisionBoxArray=new n.a3;let _t=new n.bn(Object.keys(tt.layers).sort()),Dt=new n.bo(this.tileID,this.promoteId);Dt.bucketLayerIDs=[];let Mt={},Vt={featureIndex:Dt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ht},ie=nt.familiesBySource[this.source];for(let ni in ie){let Hr=tt.layers[ni];if(!Hr)continue;Hr.version===1&&n.w(`Vector tile source \"${this.source}\" layer \"${ni}\" does not use vector tile spec v2 and therefore may have some rendering errors.`);let jn=_t.encode(ni),Bi=[];for(let xn=0;xn=es.maxzoom||es.visibility!==\"none\"&&(_(xn,this.zoom,ht),(Mt[es.id]=es.createBucket({index:Dt.bucketLayerIDs.length,layers:xn,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:jn,sourceID:this.source})).populate(Bi,Vt,this.tileID.canonical),Dt.bucketLayerIDs.push(xn.map(oa=>oa.id)))}}let se,ae,lr,vr,Xe=n.aH(Vt.glyphDependencies,ni=>Object.keys(ni).map(Number));this.inFlightDependencies.forEach(ni=>ni?.cancel()),this.inFlightDependencies=[];let cr=++this.dependencySentinel;Object.keys(Xe).length?this.inFlightDependencies.push(vt.send(\"getGlyphs\",{uid:this.uid,stacks:Xe,source:this.source,tileID:this.tileID,type:\"glyphs\"},(ni,Hr)=>{cr===this.dependencySentinel&&(se||(se=ni,ae=Hr,zi.call(this)))})):ae={};let wr=Object.keys(Vt.iconDependencies);wr.length?this.inFlightDependencies.push(vt.send(\"getImages\",{icons:wr,source:this.source,tileID:this.tileID,type:\"icons\"},(ni,Hr)=>{cr===this.dependencySentinel&&(se||(se=ni,lr=Hr,zi.call(this)))})):lr={};let xi=Object.keys(Vt.patternDependencies);function zi(){if(se)return xt(se);if(ae&&lr&&vr){let ni=new c(ae),Hr=new n.bp(lr,vr);for(let jn in Mt){let Bi=Mt[jn];Bi instanceof n.a4?(_(Bi.layers,this.zoom,ht),n.bq({bucket:Bi,glyphMap:ae,glyphPositions:ni.positions,imageMap:lr,imagePositions:Hr.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Bi.hasPattern&&(Bi instanceof n.br||Bi instanceof n.bs||Bi instanceof n.bt)&&(_(Bi.layers,this.zoom,ht),Bi.addFeatures(Vt,this.tileID.canonical,Hr.patternPositions))}this.status=\"done\",xt(null,{buckets:Object.values(Mt).filter(jn=>!jn.isEmpty()),featureIndex:Dt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ni.image,imageAtlas:Hr,glyphMap:this.returnDependencies?ae:null,iconMap:this.returnDependencies?lr:null,glyphPositions:this.returnDependencies?ni.positions:null})}}xi.length?this.inFlightDependencies.push(vt.send(\"getImages\",{icons:xi,source:this.source,tileID:this.tileID,type:\"patterns\"},(ni,Hr)=>{cr===this.dependencySentinel&&(se||(se=ni,vr=Hr,zi.call(this)))})):vr={},zi.call(this)}}function _(gt,tt,nt){let ht=new n.a8(tt);for(let vt of gt)vt.recalculate(ht,nt)}function w(gt,tt){let nt=n.l(gt.request,(ht,vt,xt,_t)=>{if(ht)tt(ht);else if(vt)try{let Dt=new n.bw.VectorTile(new n.bv(vt));tt(null,{vectorTile:Dt,rawData:vt,cacheControl:xt,expires:_t})}catch(Dt){let Mt=new Uint8Array(vt),Vt=`Unable to parse the tile at ${gt.request.url}, `;Vt+=Mt[0]===31&&Mt[1]===139?\"please make sure the data is not gzipped and that you have configured the relevant header in the server\":`got error: ${Dt.messge}`,tt(new Error(Vt))}});return()=>{nt.cancel(),tt()}}class I{constructor(tt,nt,ht,vt){this.actor=tt,this.layerIndex=nt,this.availableImages=ht,this.loadVectorData=vt||w,this.fetching={},this.loading={},this.loaded={}}loadTile(tt,nt){let ht=tt.uid;this.loading||(this.loading={});let vt=!!(tt&&tt.request&&tt.request.collectResourceTiming)&&new n.bu(tt.request),xt=this.loading[ht]=new f(tt);xt.abort=this.loadVectorData(tt,(_t,Dt)=>{if(delete this.loading[ht],_t||!Dt)return xt.status=\"done\",this.loaded[ht]=xt,nt(_t);let Mt=Dt.rawData,Vt={};Dt.expires&&(Vt.expires=Dt.expires),Dt.cacheControl&&(Vt.cacheControl=Dt.cacheControl);let ie={};if(vt){let se=vt.finish();se&&(ie.resourceTiming=JSON.parse(JSON.stringify(se)))}xt.vectorTile=Dt.vectorTile,xt.parse(Dt.vectorTile,this.layerIndex,this.availableImages,this.actor,(se,ae)=>{if(delete this.fetching[ht],se||!ae)return nt(se);nt(null,n.e({rawTileData:Mt.slice(0)},ae,Vt,ie))}),this.loaded=this.loaded||{},this.loaded[ht]=xt,this.fetching[ht]={rawTileData:Mt,cacheControl:Vt,resourceTiming:ie}})}reloadTile(tt,nt){let ht=this.loaded,vt=tt.uid;if(ht&&ht[vt]){let xt=ht[vt];xt.showCollisionBoxes=tt.showCollisionBoxes,xt.status===\"parsing\"?xt.parse(xt.vectorTile,this.layerIndex,this.availableImages,this.actor,(_t,Dt)=>{if(_t||!Dt)return nt(_t,Dt);let Mt;if(this.fetching[vt]){let{rawTileData:Vt,cacheControl:ie,resourceTiming:se}=this.fetching[vt];delete this.fetching[vt],Mt=n.e({rawTileData:Vt.slice(0)},Dt,ie,se)}else Mt=Dt;nt(null,Mt)}):xt.status===\"done\"&&(xt.vectorTile?xt.parse(xt.vectorTile,this.layerIndex,this.availableImages,this.actor,nt):nt())}}abortTile(tt,nt){let ht=this.loading,vt=tt.uid;ht&&ht[vt]&&ht[vt].abort&&(ht[vt].abort(),delete ht[vt]),nt()}removeTile(tt,nt){let ht=this.loaded,vt=tt.uid;ht&&ht[vt]&&delete ht[vt],nt()}}class R{constructor(){this.loaded={}}loadTile(tt,nt){return n._(this,void 0,void 0,function*(){let{uid:ht,encoding:vt,rawImageData:xt,redFactor:_t,greenFactor:Dt,blueFactor:Mt,baseShift:Vt}=tt,ie=xt.width+2,se=xt.height+2,ae=n.a(xt)?new n.R({width:ie,height:se},yield n.bx(xt,-1,-1,ie,se)):xt,lr=new n.by(ht,ae,vt,_t,Dt,Mt,Vt);this.loaded=this.loaded||{},this.loaded[ht]=lr,nt(null,lr)})}removeTile(tt){let nt=this.loaded,ht=tt.uid;nt&&nt[ht]&&delete nt[ht]}}function N(gt,tt){if(gt.length!==0){j(gt[0],tt);for(var nt=1;nt=Math.abs(Dt)?nt-Mt+Dt:Dt-Mt+nt,nt=Mt}nt+ht>=0!=!!tt&>.reverse()}var Q=n.bz(function gt(tt,nt){var ht,vt=tt&&tt.type;if(vt===\"FeatureCollection\")for(ht=0;ht>31}function Li(gt,tt){for(var nt=gt.loadGeometry(),ht=gt.type,vt=0,xt=0,_t=nt.length,Dt=0;Dt<_t;Dt++){var Mt=nt[Dt],Vt=1;ht===1&&(Vt=Mt.length),tt.writeVarint(rr(1,Vt));for(var ie=ht===3?Mt.length-1:Mt.length,se=0;segt},ih=Math.fround||(Uo=new Float32Array(1),gt=>(Uo[0]=+gt,Uo[0]));var Uo;let Si=3,Ns=5,ll=6;class kc{constructor(tt){this.options=Object.assign(Object.create(No),tt),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(tt){let{log:nt,minZoom:ht,maxZoom:vt}=this.options;nt&&console.time(\"total time\");let xt=`prepare ${tt.length} points`;nt&&console.time(xt),this.points=tt;let _t=[];for(let Mt=0;Mt=ht;Mt--){let Vt=+Date.now();Dt=this.trees[Mt]=this._createTree(this._cluster(Dt,Mt)),nt&&console.log(\"z%d: %d clusters in %dms\",Mt,Dt.numItems,+Date.now()-Vt)}return nt&&console.timeEnd(\"total time\"),this}getClusters(tt,nt){let ht=((tt[0]+180)%360+360)%360-180,vt=Math.max(-90,Math.min(90,tt[1])),xt=tt[2]===180?180:((tt[2]+180)%360+360)%360-180,_t=Math.max(-90,Math.min(90,tt[3]));if(tt[2]-tt[0]>=360)ht=-180,xt=180;else if(ht>xt){let se=this.getClusters([ht,vt,180,_t],nt),ae=this.getClusters([-180,vt,xt,_t],nt);return se.concat(ae)}let Dt=this.trees[this._limitZoom(nt)],Mt=Dt.range(Jn(ht),ki(_t),Jn(xt),ki(vt)),Vt=Dt.data,ie=[];for(let se of Mt){let ae=this.stride*se;ie.push(Vt[ae+Ns]>1?Rc(Vt,ae,this.clusterProps):this.points[Vt[ae+Si]])}return ie}getChildren(tt){let nt=this._getOriginId(tt),ht=this._getOriginZoom(tt),vt=\"No cluster with the specified id.\",xt=this.trees[ht];if(!xt)throw new Error(vt);let _t=xt.data;if(nt*this.stride>=_t.length)throw new Error(vt);let Dt=this.options.radius/(this.options.extent*Math.pow(2,ht-1)),Mt=xt.within(_t[nt*this.stride],_t[nt*this.stride+1],Dt),Vt=[];for(let ie of Mt){let se=ie*this.stride;_t[se+4]===tt&&Vt.push(_t[se+Ns]>1?Rc(_t,se,this.clusterProps):this.points[_t[se+Si]])}if(Vt.length===0)throw new Error(vt);return Vt}getLeaves(tt,nt,ht){let vt=[];return this._appendLeaves(vt,tt,nt=nt||10,ht=ht||0,0),vt}getTile(tt,nt,ht){let vt=this.trees[this._limitZoom(tt)],xt=Math.pow(2,tt),{extent:_t,radius:Dt}=this.options,Mt=Dt/_t,Vt=(ht-Mt)/xt,ie=(ht+1+Mt)/xt,se={features:[]};return this._addTileFeatures(vt.range((nt-Mt)/xt,Vt,(nt+1+Mt)/xt,ie),vt.data,nt,ht,xt,se),nt===0&&this._addTileFeatures(vt.range(1-Mt/xt,Vt,1,ie),vt.data,xt,ht,xt,se),nt===xt-1&&this._addTileFeatures(vt.range(0,Vt,Mt/xt,ie),vt.data,-1,ht,xt,se),se.features.length?se:null}getClusterExpansionZoom(tt){let nt=this._getOriginZoom(tt)-1;for(;nt<=this.options.maxZoom;){let ht=this.getChildren(tt);if(nt++,ht.length!==1)break;tt=ht[0].properties.cluster_id}return nt}_appendLeaves(tt,nt,ht,vt,xt){let _t=this.getChildren(nt);for(let Dt of _t){let Mt=Dt.properties;if(Mt&&Mt.cluster?xt+Mt.point_count<=vt?xt+=Mt.point_count:xt=this._appendLeaves(tt,Mt.cluster_id,ht,vt,xt):xt1,ie,se,ae;if(Vt)ie=Xi(nt,Mt,this.clusterProps),se=nt[Mt],ae=nt[Mt+1];else{let Xe=this.points[nt[Mt+Si]];ie=Xe.properties;let[cr,wr]=Xe.geometry.coordinates;se=Jn(cr),ae=ki(wr)}let lr={type:1,geometry:[[Math.round(this.options.extent*(se*xt-ht)),Math.round(this.options.extent*(ae*xt-vt))]],tags:ie},vr;vr=Vt||this.options.generateId?nt[Mt+Si]:this.points[nt[Mt+Si]].id,vr!==void 0&&(lr.id=vr),_t.features.push(lr)}}_limitZoom(tt){return Math.max(this.options.minZoom,Math.min(Math.floor(+tt),this.options.maxZoom+1))}_cluster(tt,nt){let{radius:ht,extent:vt,reduce:xt,minPoints:_t}=this.options,Dt=ht/(vt*Math.pow(2,nt)),Mt=tt.data,Vt=[],ie=this.stride;for(let se=0;sent&&(cr+=Mt[xi+Ns])}if(cr>Xe&&cr>=_t){let wr,xi=ae*Xe,zi=lr*Xe,ni=-1,Hr=((se/ie|0)<<5)+(nt+1)+this.points.length;for(let jn of vr){let Bi=jn*ie;if(Mt[Bi+2]<=nt)continue;Mt[Bi+2]=nt;let xn=Mt[Bi+Ns];xi+=Mt[Bi]*xn,zi+=Mt[Bi+1]*xn,Mt[Bi+4]=Hr,xt&&(wr||(wr=this._map(Mt,se,!0),ni=this.clusterProps.length,this.clusterProps.push(wr)),xt(wr,this._map(Mt,Bi)))}Mt[se+4]=Hr,Vt.push(xi/cr,zi/cr,1/0,Hr,-1,cr),xt&&Vt.push(ni)}else{for(let wr=0;wr1)for(let wr of vr){let xi=wr*ie;if(!(Mt[xi+2]<=nt)){Mt[xi+2]=nt;for(let zi=0;zi>5}_getOriginZoom(tt){return(tt-this.points.length)%32}_map(tt,nt,ht){if(tt[nt+Ns]>1){let _t=this.clusterProps[tt[nt+ll]];return ht?Object.assign({},_t):_t}let vt=this.points[tt[nt+Si]].properties,xt=this.options.map(vt);return ht&&xt===vt?Object.assign({},xt):xt}}function Rc(gt,tt,nt){return{type:\"Feature\",id:gt[tt+Si],properties:Xi(gt,tt,nt),geometry:{type:\"Point\",coordinates:[(ht=gt[tt],360*(ht-.5)),ts(gt[tt+1])]}};var ht}function Xi(gt,tt,nt){let ht=gt[tt+Ns],vt=ht>=1e4?`${Math.round(ht/1e3)}k`:ht>=1e3?Math.round(ht/100)/10+\"k\":ht,xt=gt[tt+ll],_t=xt===-1?{}:Object.assign({},nt[xt]);return Object.assign(_t,{cluster:!0,cluster_id:gt[tt+Si],point_count:ht,point_count_abbreviated:vt})}function Jn(gt){return gt/360+.5}function ki(gt){let tt=Math.sin(gt*Math.PI/180),nt=.5-.25*Math.log((1+tt)/(1-tt))/Math.PI;return nt<0?0:nt>1?1:nt}function ts(gt){let tt=(180-360*gt)*Math.PI/180;return 360*Math.atan(Math.exp(tt))/Math.PI-90}function Vo(gt,tt,nt,ht){for(var vt,xt=ht,_t=nt-tt>>1,Dt=nt-tt,Mt=gt[tt],Vt=gt[tt+1],ie=gt[nt],se=gt[nt+1],ae=tt+3;aext)vt=ae,xt=lr;else if(lr===xt){var vr=Math.abs(ae-_t);vrht&&(vt-tt>3&&Vo(gt,tt,vt,ht),gt[vt+2]=xt,nt-vt>3&&Vo(gt,vt,nt,ht))}function cl(gt,tt,nt,ht,vt,xt){var _t=vt-nt,Dt=xt-ht;if(_t!==0||Dt!==0){var Mt=((gt-nt)*_t+(tt-ht)*Dt)/(_t*_t+Dt*Dt);Mt>1?(nt=vt,ht=xt):Mt>0&&(nt+=_t*Mt,ht+=Dt*Mt)}return(_t=gt-nt)*_t+(Dt=tt-ht)*Dt}function xo(gt,tt,nt,ht){var vt={id:gt===void 0?null:gt,type:tt,geometry:nt,tags:ht,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(xt){var _t=xt.geometry,Dt=xt.type;if(Dt===\"Point\"||Dt===\"MultiPoint\"||Dt===\"LineString\")Pa(xt,_t);else if(Dt===\"Polygon\"||Dt===\"MultiLineString\")for(var Mt=0;Mt<_t.length;Mt++)Pa(xt,_t[Mt]);else if(Dt===\"MultiPolygon\")for(Mt=0;Mt<_t.length;Mt++)for(var Vt=0;Vt<_t[Mt].length;Vt++)Pa(xt,_t[Mt][Vt])}(vt),vt}function Pa(gt,tt){for(var nt=0;nt0&&(_t+=ht?(vt*Vt-Mt*xt)/2:Math.sqrt(Math.pow(Mt-vt,2)+Math.pow(Vt-xt,2))),vt=Mt,xt=Vt}var ie=tt.length-3;tt[2]=1,Vo(tt,0,ie,nt),tt[ie+2]=1,tt.size=Math.abs(_t),tt.start=0,tt.end=tt.size}function Nl(gt,tt,nt,ht){for(var vt=0;vt1?1:nt}function mn(gt,tt,nt,ht,vt,xt,_t,Dt){if(ht/=tt,xt>=(nt/=tt)&&_t=ht)return null;for(var Mt=[],Vt=0;Vt=nt&&vr=ht)){var Xe=[];if(ae===\"Point\"||ae===\"MultiPoint\")gi(se,Xe,nt,ht,vt);else if(ae===\"LineString\")oi(se,Xe,nt,ht,vt,!1,Dt.lineMetrics);else if(ae===\"MultiLineString\")du(se,Xe,nt,ht,vt,!1);else if(ae===\"Polygon\")du(se,Xe,nt,ht,vt,!0);else if(ae===\"MultiPolygon\")for(var cr=0;cr=nt&&_t<=ht&&(tt.push(gt[xt]),tt.push(gt[xt+1]),tt.push(gt[xt+2]))}}function oi(gt,tt,nt,ht,vt,xt,_t){for(var Dt,Mt,Vt=lo(gt),ie=vt===0?bo:hl,se=gt.start,ae=0;aent&&(Mt=ie(Vt,lr,vr,cr,wr,nt),_t&&(Vt.start=se+Dt*Mt)):xi>ht?zi=nt&&(Mt=ie(Vt,lr,vr,cr,wr,nt),ni=!0),zi>ht&&xi<=ht&&(Mt=ie(Vt,lr,vr,cr,wr,ht),ni=!0),!xt&&ni&&(_t&&(Vt.end=se+Dt*Mt),tt.push(Vt),Vt=lo(gt)),_t&&(se+=Dt)}var Hr=gt.length-3;lr=gt[Hr],vr=gt[Hr+1],Xe=gt[Hr+2],(xi=vt===0?lr:vr)>=nt&&xi<=ht&&ul(Vt,lr,vr,Xe),Hr=Vt.length-3,xt&&Hr>=3&&(Vt[Hr]!==Vt[0]||Vt[Hr+1]!==Vt[1])&&ul(Vt,Vt[0],Vt[1],Vt[2]),Vt.length&&tt.push(Vt)}function lo(gt){var tt=[];return tt.size=gt.size,tt.start=gt.start,tt.end=gt.end,tt}function du(gt,tt,nt,ht,vt,xt){for(var _t=0;_t_t.maxX&&(_t.maxX=ie),se>_t.maxY&&(_t.maxY=se)}return _t}function Ul(gt,tt,nt,ht){var vt=tt.geometry,xt=tt.type,_t=[];if(xt===\"Point\"||xt===\"MultiPoint\")for(var Dt=0;Dt0&&tt.size<(vt?_t:ht))nt.numPoints+=tt.length/3;else{for(var Dt=[],Mt=0;Mt_t)&&(nt.numSimplified++,Dt.push(tt[Mt]),Dt.push(tt[Mt+1])),nt.numPoints++;vt&&function(Vt,ie){for(var se=0,ae=0,lr=Vt.length,vr=lr-2;ae0===ie)for(ae=0,lr=Vt.length;ae24)throw new Error(\"maxZoom should be in the 0-24 range\");if(tt.promoteId&&tt.generateId)throw new Error(\"promoteId and generateId cannot be used together.\");var ht=function(vt,xt){var _t=[];if(vt.type===\"FeatureCollection\")for(var Dt=0;Dt1&&console.time(\"creation\"),ae=this.tiles[se]=gn(gt,tt,nt,ht,Mt),this.tileCoords.push({z:tt,x:nt,y:ht}),Vt)){Vt>1&&(console.log(\"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)\",tt,nt,ht,ae.numFeatures,ae.numPoints,ae.numSimplified),console.timeEnd(\"creation\"));var lr=\"z\"+tt;this.stats[lr]=(this.stats[lr]||0)+1,this.total++}if(ae.source=gt,vt){if(tt===Mt.maxZoom||tt===vt)continue;var vr=1<1&&console.time(\"clipping\");var Xe,cr,wr,xi,zi,ni,Hr=.5*Mt.buffer/Mt.extent,jn=.5-Hr,Bi=.5+Hr,xn=1+Hr;Xe=cr=wr=xi=null,zi=mn(gt,ie,nt-Hr,nt+Bi,0,ae.minX,ae.maxX,Mt),ni=mn(gt,ie,nt+jn,nt+xn,0,ae.minX,ae.maxX,Mt),gt=null,zi&&(Xe=mn(zi,ie,ht-Hr,ht+Bi,1,ae.minY,ae.maxY,Mt),cr=mn(zi,ie,ht+jn,ht+xn,1,ae.minY,ae.maxY,Mt),zi=null),ni&&(wr=mn(ni,ie,ht-Hr,ht+Bi,1,ae.minY,ae.maxY,Mt),xi=mn(ni,ie,ht+jn,ht+xn,1,ae.minY,ae.maxY,Mt),ni=null),Vt>1&&console.timeEnd(\"clipping\"),Dt.push(Xe||[],tt+1,2*nt,2*ht),Dt.push(cr||[],tt+1,2*nt,2*ht+1),Dt.push(wr||[],tt+1,2*nt+1,2*ht),Dt.push(xi||[],tt+1,2*nt+1,2*ht+1)}}},Te.prototype.getTile=function(gt,tt,nt){var ht=this.options,vt=ht.extent,xt=ht.debug;if(gt<0||gt>24)return null;var _t=1<1&&console.log(\"drilling down to z%d-%d-%d\",gt,tt,nt);for(var Mt,Vt=gt,ie=tt,se=nt;!Mt&&Vt>0;)Vt--,ie=Math.floor(ie/2),se=Math.floor(se/2),Mt=this.tiles[Dr(Vt,ie,se)];return Mt&&Mt.source?(xt>1&&console.log(\"found parent tile z%d-%d-%d\",Vt,ie,se),xt>1&&console.time(\"drilling down\"),this.splitTile(Mt.source,Vt,ie,se,gt,tt,nt),xt>1&&console.timeEnd(\"drilling down\"),this.tiles[Dt]?ve(this.tiles[Dt],vt):null):null};class Mr extends I{constructor(tt,nt,ht,vt){super(tt,nt,ht),this._dataUpdateable=new Map,this.loadGeoJSON=(xt,_t)=>{let{promoteId:Dt}=xt;if(xt.request)return n.f(xt.request,(Mt,Vt,ie,se)=>{this._dataUpdateable=Us(Vt,Dt)?La(Vt,Dt):void 0,_t(Mt,Vt,ie,se)});if(typeof xt.data==\"string\")try{let Mt=JSON.parse(xt.data);this._dataUpdateable=Us(Mt,Dt)?La(Mt,Dt):void 0,_t(null,Mt)}catch{_t(new Error(`Input data given to '${xt.source}' is not a valid GeoJSON object.`))}else xt.dataDiff?this._dataUpdateable?(function(Mt,Vt,ie){var se,ae,lr,vr;if(Vt.removeAll&&Mt.clear(),Vt.remove)for(let Xe of Vt.remove)Mt.delete(Xe);if(Vt.add)for(let Xe of Vt.add){let cr=gr(Xe,ie);cr!=null&&Mt.set(cr,Xe)}if(Vt.update)for(let Xe of Vt.update){let cr=Mt.get(Xe.id);if(cr==null)continue;let wr=!Xe.removeAllProperties&&(((se=Xe.removeProperties)===null||se===void 0?void 0:se.length)>0||((ae=Xe.addOrUpdateProperties)===null||ae===void 0?void 0:ae.length)>0);if((Xe.newGeometry||Xe.removeAllProperties||wr)&&(cr=Object.assign({},cr),Mt.set(Xe.id,cr),wr&&(cr.properties=Object.assign({},cr.properties))),Xe.newGeometry&&(cr.geometry=Xe.newGeometry),Xe.removeAllProperties)cr.properties={};else if(((lr=Xe.removeProperties)===null||lr===void 0?void 0:lr.length)>0)for(let xi of Xe.removeProperties)Object.prototype.hasOwnProperty.call(cr.properties,xi)&&delete cr.properties[xi];if(((vr=Xe.addOrUpdateProperties)===null||vr===void 0?void 0:vr.length)>0)for(let{key:xi,value:zi}of Xe.addOrUpdateProperties)cr.properties[xi]=zi}}(this._dataUpdateable,xt.dataDiff,Dt),_t(null,{type:\"FeatureCollection\",features:Array.from(this._dataUpdateable.values())})):_t(new Error(`Cannot update existing geojson data in ${xt.source}`)):_t(new Error(`Input data given to '${xt.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},this.loadVectorData=this.loadGeoJSONTile,vt&&(this.loadGeoJSON=vt)}loadGeoJSONTile(tt,nt){let ht=tt.tileID.canonical;if(!this._geoJSONIndex)return nt(null,null);let vt=this._geoJSONIndex.getTile(ht.z,ht.x,ht.y);if(!vt)return nt(null,null);let xt=new class{constructor(Dt){this.layers={_geojsonTileLayer:this},this.name=\"_geojsonTileLayer\",this.extent=n.N,this.length=Dt.length,this._features=Dt}feature(Dt){return new class{constructor(Mt){this._feature=Mt,this.extent=n.N,this.type=Mt.type,this.properties=Mt.tags,\"id\"in Mt&&!isNaN(Mt.id)&&(this.id=parseInt(Mt.id,10))}loadGeometry(){if(this._feature.type===1){let Mt=[];for(let Vt of this._feature.geometry)Mt.push([new n.P(Vt[0],Vt[1])]);return Mt}{let Mt=[];for(let Vt of this._feature.geometry){let ie=[];for(let se of Vt)ie.push(new n.P(se[0],se[1]));Mt.push(ie)}return Mt}}toGeoJSON(Mt,Vt,ie){return et.call(this,Mt,Vt,ie)}}(this._features[Dt])}}(vt.features),_t=zl(xt);_t.byteOffset===0&&_t.byteLength===_t.buffer.byteLength||(_t=new Uint8Array(_t)),nt(null,{vectorTile:xt,rawData:_t.buffer})}loadData(tt,nt){var ht;(ht=this._pendingRequest)===null||ht===void 0||ht.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});let vt=!!(tt&&tt.request&&tt.request.collectResourceTiming)&&new n.bu(tt.request);this._pendingCallback=nt,this._pendingRequest=this.loadGeoJSON(tt,(xt,_t)=>{if(delete this._pendingCallback,delete this._pendingRequest,xt||!_t)return nt(xt);if(typeof _t!=\"object\")return nt(new Error(`Input data given to '${tt.source}' is not a valid GeoJSON object.`));{Q(_t,!0);try{if(tt.filter){let Mt=n.bC(tt.filter,{type:\"boolean\",\"property-type\":\"data-driven\",overridable:!1,transition:!1});if(Mt.result===\"error\")throw new Error(Mt.value.map(ie=>`${ie.key}: ${ie.message}`).join(\", \"));_t={type:\"FeatureCollection\",features:_t.features.filter(ie=>Mt.value.evaluate({zoom:0},ie))}}this._geoJSONIndex=tt.cluster?new kc(function({superclusterOptions:Mt,clusterProperties:Vt}){if(!Vt||!Mt)return Mt;let ie={},se={},ae={accumulated:null,zoom:0},lr={properties:null},vr=Object.keys(Vt);for(let Xe of vr){let[cr,wr]=Vt[Xe],xi=n.bC(wr),zi=n.bC(typeof cr==\"string\"?[cr,[\"accumulated\"],[\"get\",Xe]]:cr);ie[Xe]=xi.value,se[Xe]=zi.value}return Mt.map=Xe=>{lr.properties=Xe;let cr={};for(let wr of vr)cr[wr]=ie[wr].evaluate(ae,lr);return cr},Mt.reduce=(Xe,cr)=>{lr.properties=cr;for(let wr of vr)ae.accumulated=Xe[wr],Xe[wr]=se[wr].evaluate(ae,lr)},Mt}(tt)).load(_t.features):function(Mt,Vt){return new Te(Mt,Vt)}(_t,tt.geojsonVtOptions)}catch(Mt){return nt(Mt)}this.loaded={};let Dt={};if(vt){let Mt=vt.finish();Mt&&(Dt.resourceTiming={},Dt.resourceTiming[tt.source]=JSON.parse(JSON.stringify(Mt)))}nt(null,Dt)}})}reloadTile(tt,nt){let ht=this.loaded;return ht&&ht[tt.uid]?super.reloadTile(tt,nt):this.loadTile(tt,nt)}removeSource(tt,nt){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),nt()}getClusterExpansionZoom(tt,nt){try{nt(null,this._geoJSONIndex.getClusterExpansionZoom(tt.clusterId))}catch(ht){nt(ht)}}getClusterChildren(tt,nt){try{nt(null,this._geoJSONIndex.getChildren(tt.clusterId))}catch(ht){nt(ht)}}getClusterLeaves(tt,nt){try{nt(null,this._geoJSONIndex.getLeaves(tt.clusterId,tt.limit,tt.offset))}catch(ht){nt(ht)}}}class sa{constructor(tt){this.self=tt,this.actor=new n.C(tt,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:I,geojson:Mr},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(nt,ht)=>{if(this.workerSourceTypes[nt])throw new Error(`Worker source with name \"${nt}\" already registered.`);this.workerSourceTypes[nt]=ht},this.self.registerRTLTextPlugin=nt=>{if(n.bD.isParsed())throw new Error(\"RTL text plugin already registered.\");n.bD.applyArabicShaping=nt.applyArabicShaping,n.bD.processBidirectionalText=nt.processBidirectionalText,n.bD.processStyledBidirectionalText=nt.processStyledBidirectionalText}}setReferrer(tt,nt){this.referrer=nt}setImages(tt,nt,ht){this.availableImages[tt]=nt;for(let vt in this.workerSources[tt]){let xt=this.workerSources[tt][vt];for(let _t in xt)xt[_t].availableImages=nt}ht()}setLayers(tt,nt,ht){this.getLayerIndex(tt).replace(nt),ht()}updateLayers(tt,nt,ht){this.getLayerIndex(tt).update(nt.layers,nt.removedIds),ht()}loadTile(tt,nt,ht){this.getWorkerSource(tt,nt.type,nt.source).loadTile(nt,ht)}loadDEMTile(tt,nt,ht){this.getDEMWorkerSource(tt,nt.source).loadTile(nt,ht)}reloadTile(tt,nt,ht){this.getWorkerSource(tt,nt.type,nt.source).reloadTile(nt,ht)}abortTile(tt,nt,ht){this.getWorkerSource(tt,nt.type,nt.source).abortTile(nt,ht)}removeTile(tt,nt,ht){this.getWorkerSource(tt,nt.type,nt.source).removeTile(nt,ht)}removeDEMTile(tt,nt){this.getDEMWorkerSource(tt,nt.source).removeTile(nt)}removeSource(tt,nt,ht){if(!this.workerSources[tt]||!this.workerSources[tt][nt.type]||!this.workerSources[tt][nt.type][nt.source])return;let vt=this.workerSources[tt][nt.type][nt.source];delete this.workerSources[tt][nt.type][nt.source],vt.removeSource!==void 0?vt.removeSource(nt,ht):ht()}loadWorkerSource(tt,nt,ht){try{this.self.importScripts(nt.url),ht()}catch(vt){ht(vt.toString())}}syncRTLPluginState(tt,nt,ht){try{n.bD.setState(nt);let vt=n.bD.getPluginURL();if(n.bD.isLoaded()&&!n.bD.isParsed()&&vt!=null){this.self.importScripts(vt);let xt=n.bD.isParsed();ht(xt?void 0:new Error(`RTL Text Plugin failed to import scripts from ${vt}`),xt)}}catch(vt){ht(vt.toString())}}getAvailableImages(tt){let nt=this.availableImages[tt];return nt||(nt=[]),nt}getLayerIndex(tt){let nt=this.layerIndexes[tt];return nt||(nt=this.layerIndexes[tt]=new o),nt}getWorkerSource(tt,nt,ht){return this.workerSources[tt]||(this.workerSources[tt]={}),this.workerSources[tt][nt]||(this.workerSources[tt][nt]={}),this.workerSources[tt][nt][ht]||(this.workerSources[tt][nt][ht]=new this.workerSourceTypes[nt]({send:(vt,xt,_t)=>{this.actor.send(vt,xt,_t,tt)}},this.getLayerIndex(tt),this.getAvailableImages(tt))),this.workerSources[tt][nt][ht]}getDEMWorkerSource(tt,nt){return this.demWorkerSources[tt]||(this.demWorkerSources[tt]={}),this.demWorkerSources[tt][nt]||(this.demWorkerSources[tt][nt]=new R),this.demWorkerSources[tt][nt]}}return n.i()&&(self.worker=new sa(self)),sa}),i([\"./shared\"],function(n){\"use strict\";var o=\"3.6.2\";class c{static testProp(l){if(!c.docStyle)return l[0];for(let d=0;d{window.removeEventListener(\"click\",c.suppressClickInternal,!0)},0)}static mousePos(l,d){let v=l.getBoundingClientRect();return new n.P(d.clientX-v.left-l.clientLeft,d.clientY-v.top-l.clientTop)}static touchPos(l,d){let v=l.getBoundingClientRect(),b=[];for(let M=0;M{l=[],d=0,v=0,b={}},T.addThrottleControl=W=>{let Z=v++;return b[Z]=W,Z},T.removeThrottleControl=W=>{delete b[W],B()},T.getImage=(W,Z,$=!0)=>{f.supported&&(W.headers||(W.headers={}),W.headers.accept=\"image/webp,*/*\");let st={requestParameters:W,supportImageRefresh:$,callback:Z,cancelled:!1,completed:!1,cancel:()=>{st.completed||st.cancelled||(st.cancelled=!0,st.innerRequest&&(st.innerRequest.cancel(),d--),B())}};return l.push(st),B(),st};let M=W=>{let{requestParameters:Z,supportImageRefresh:$,callback:st}=W;return n.e(Z,{type:\"image\"}),($!==!1||n.i()||n.g(Z.url)||Z.headers&&!Object.keys(Z.headers).reduce((At,pt)=>At&&pt===\"accept\",!0)?n.m:U)(Z,(At,pt,yt,dt)=>{O(W,st,At,pt,yt,dt)})},O=(W,Z,$,st,At,pt)=>{$?Z($):st instanceof HTMLImageElement||n.a(st)?Z(null,st):st&&((yt,dt)=>{typeof createImageBitmap==\"function\"?n.b(yt,dt):n.d(yt,dt)})(st,(yt,dt)=>{yt!=null?Z(yt):dt!=null&&Z(null,dt,{cacheControl:At,expires:pt})}),W.cancelled||(W.completed=!0,d--,B())},B=()=>{let W=(()=>{let Z=Object.keys(b),$=!1;if(Z.length>0){for(let st of Z)if($=b[st](),$)break}return $})()?n.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:n.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let Z=d;Z0;Z++){let $=l.shift();if($.cancelled){Z--;continue}let st=M($);d++,$.innerRequest=st}},U=(W,Z)=>{let $=new Image,st=W.url,At=!1,pt=W.credentials;return pt&&pt===\"include\"?$.crossOrigin=\"use-credentials\":(pt&&pt===\"same-origin\"||!n.s(st))&&($.crossOrigin=\"anonymous\"),$.fetchPriority=\"high\",$.onload=()=>{Z(null,$),$.onerror=$.onload=null},$.onerror=()=>{At||Z(new Error(\"Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.\")),$.onerror=$.onload=null},$.src=st,{cancel:()=>{At=!0,$.src=\"\"}}}}(j||(j={})),j.resetRequestQueue(),function(T){T.Glyphs=\"Glyphs\",T.Image=\"Image\",T.Source=\"Source\",T.SpriteImage=\"SpriteImage\",T.SpriteJSON=\"SpriteJSON\",T.Style=\"Style\",T.Tile=\"Tile\",T.Unknown=\"Unknown\"}(Q||(Q={}));class et{constructor(l){this._transformRequestFn=l}transformRequest(l,d){return this._transformRequestFn&&this._transformRequestFn(l,d)||{url:l}}normalizeSpriteURL(l,d,v){let b=function(M){let O=M.match(Y);if(!O)throw new Error(`Unable to parse URL \"${M}\"`);return{protocol:O[1],authority:O[2],path:O[3]||\"/\",params:O[4]?O[4].split(\"&\"):[]}}(l);return b.path+=`${d}${v}`,function(M){let O=M.params.length?`?${M.params.join(\"&\")}`:\"\";return`${M.protocol}://${M.authority}${M.path}${O}`}(b)}setTransformRequest(l){this._transformRequestFn=l}}let Y=/^(\\w+):\\/\\/([^/?]*)(\\/[^?]+)?\\??(.+)?/;function K(T){var l=new n.A(3);return l[0]=T[0],l[1]=T[1],l[2]=T[2],l}var J,ut=function(T,l,d){return T[0]=l[0]-d[0],T[1]=l[1]-d[1],T[2]=l[2]-d[2],T};J=new n.A(3),n.A!=Float32Array&&(J[0]=0,J[1]=0,J[2]=0);var Et=function(T){var l=T[0],d=T[1];return l*l+d*d};function kt(T){let l=[];if(typeof T==\"string\")l.push({id:\"default\",url:T});else if(T&&T.length>0){let d=[];for(let{id:v,url:b}of T){let M=`${v}${b}`;d.indexOf(M)===-1&&(d.push(M),l.push({id:v,url:b}))}}return l}function Xt(T,l,d,v,b){if(v)return void T(v);if(b!==Object.values(l).length||b!==Object.values(d).length)return;let M={};for(let O in l){M[O]={};let B=n.h.getImageCanvasContext(d[O]),U=l[O];for(let W in U){let{width:Z,height:$,x:st,y:At,sdf:pt,pixelRatio:yt,stretchX:dt,stretchY:Ft,content:Ht}=U[W];M[O][W]={data:null,pixelRatio:yt,sdf:pt,stretchX:dt,stretchY:Ft,content:Ht,spriteData:{width:Z,height:$,x:st,y:At,context:B}}}}T(null,M)}(function(){var T=new n.A(2);n.A!=Float32Array&&(T[0]=0,T[1]=0)})();class qt{constructor(l,d,v,b){this.context=l,this.format=v,this.texture=l.gl.createTexture(),this.update(d,b)}update(l,d,v){let{width:b,height:M}=l,O=!(this.size&&this.size[0]===b&&this.size[1]===M||v),{context:B}=this,{gl:U}=B;if(this.useMipmap=!!(d&&d.useMipmap),U.bindTexture(U.TEXTURE_2D,this.texture),B.pixelStoreUnpackFlipY.set(!1),B.pixelStoreUnpack.set(1),B.pixelStoreUnpackPremultiplyAlpha.set(this.format===U.RGBA&&(!d||d.premultiply!==!1)),O)this.size=[b,M],l instanceof HTMLImageElement||l instanceof HTMLCanvasElement||l instanceof HTMLVideoElement||l instanceof ImageData||n.a(l)?U.texImage2D(U.TEXTURE_2D,0,this.format,this.format,U.UNSIGNED_BYTE,l):U.texImage2D(U.TEXTURE_2D,0,this.format,b,M,0,this.format,U.UNSIGNED_BYTE,l.data);else{let{x:W,y:Z}=v||{x:0,y:0};l instanceof HTMLImageElement||l instanceof HTMLCanvasElement||l instanceof HTMLVideoElement||l instanceof ImageData||n.a(l)?U.texSubImage2D(U.TEXTURE_2D,0,W,Z,U.RGBA,U.UNSIGNED_BYTE,l):U.texSubImage2D(U.TEXTURE_2D,0,W,Z,b,M,U.RGBA,U.UNSIGNED_BYTE,l.data)}this.useMipmap&&this.isSizePowerOfTwo()&&U.generateMipmap(U.TEXTURE_2D)}bind(l,d,v){let{context:b}=this,{gl:M}=b;M.bindTexture(M.TEXTURE_2D,this.texture),v!==M.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(v=M.LINEAR),l!==this.filter&&(M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MAG_FILTER,l),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MIN_FILTER,v||l),this.filter=l),d!==this.wrap&&(M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_S,d),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_T,d),this.wrap=d)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:l}=this.context;l.deleteTexture(this.texture),this.texture=null}}function le(T){let{userImage:l}=T;return!!(l&&l.render&&l.render())&&(T.data.replace(new Uint8Array(l.data.buffer)),!0)}class ue extends n.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new n.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(l){if(this.loaded!==l&&(this.loaded=l,l)){for(let{ids:d,callback:v}of this.requestors)this._notify(d,v);this.requestors=[]}}getImage(l){let d=this.images[l];if(d&&!d.data&&d.spriteData){let v=d.spriteData;d.data=new n.R({width:v.width,height:v.height},v.context.getImageData(v.x,v.y,v.width,v.height).data),d.spriteData=null}return d}addImage(l,d){if(this.images[l])throw new Error(`Image id ${l} already exist, use updateImage instead`);this._validate(l,d)&&(this.images[l]=d)}_validate(l,d){let v=!0,b=d.data||d.spriteData;return this._validateStretch(d.stretchX,b&&b.width)||(this.fire(new n.j(new Error(`Image \"${l}\" has invalid \"stretchX\" value`))),v=!1),this._validateStretch(d.stretchY,b&&b.height)||(this.fire(new n.j(new Error(`Image \"${l}\" has invalid \"stretchY\" value`))),v=!1),this._validateContent(d.content,d)||(this.fire(new n.j(new Error(`Image \"${l}\" has invalid \"content\" value`))),v=!1),v}_validateStretch(l,d){if(!l)return!0;let v=0;for(let b of l){if(b[0]-1);U++,M[U]=B,O[U]=W,O[U+1]=De}for(let B=0,U=0;B{let B=this.entries[b];B||(B=this.entries[b]={glyphs:{},requests:{},ranges:{}});let U=B.glyphs[M];if(U!==void 0)return void O(null,{stack:b,id:M,glyph:U});if(U=this._tinySDF(B,b,M),U)return B.glyphs[M]=U,void O(null,{stack:b,id:M,glyph:U});let W=Math.floor(M/256);if(256*W>65535)return void O(new Error(\"glyphs > 65535 not supported\"));if(B.ranges[W])return void O(null,{stack:b,id:M,glyph:U});if(!this.url)return void O(new Error(\"glyphsUrl is not set\"));let Z=B.requests[W];Z||(Z=B.requests[W]=[],Sr.loadGlyphRange(b,W,this.url,this.requestManager,($,st)=>{if(st){for(let At in st)this._doesCharSupportLocalGlyph(+At)||(B.glyphs[+At]=st[+At]);B.ranges[W]=!0}for(let At of Z)At($,st);delete B.requests[W]})),Z.push(($,st)=>{$?O($):st&&O(null,{stack:b,id:M,glyph:st[M]||null})})},(b,M)=>{if(b)d(b);else if(M){let O={};for(let{stack:B,id:U,glyph:W}of M)(O[B]||(O[B]={}))[U]=W&&{id:W.id,bitmap:W.bitmap.clone(),metrics:W.metrics};d(null,O)}})}_doesCharSupportLocalGlyph(l){return!!this.localIdeographFontFamily&&(n.u[\"CJK Unified Ideographs\"](l)||n.u[\"Hangul Syllables\"](l)||n.u.Hiragana(l)||n.u.Katakana(l))}_tinySDF(l,d,v){let b=this.localIdeographFontFamily;if(!b||!this._doesCharSupportLocalGlyph(v))return;let M=l.tinySDF;if(!M){let B=\"400\";/bold/i.test(d)?B=\"900\":/medium/i.test(d)?B=\"500\":/light/i.test(d)&&(B=\"200\"),M=l.tinySDF=new Sr.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:b,fontWeight:B})}let O=M.draw(String.fromCharCode(v));return{id:v,bitmap:new n.q({width:O.width||60,height:O.height||60},O.data),metrics:{width:O.glyphWidth/2||24,height:O.glyphHeight/2||24,left:O.glyphLeft/2+.5||0,top:O.glyphTop/2-27.5||-8,advance:O.glyphAdvance/2||24,isDoubleResolution:!0}}}}Sr.loadGlyphRange=function(T,l,d,v,b){let M=256*l,O=M+255,B=v.transformRequest(d.replace(\"{fontstack}\",T).replace(\"{range}\",`${M}-${O}`),Q.Glyphs);n.l(B,(U,W)=>{if(U)b(U);else if(W){let Z={};for(let $ of n.n(W))Z[$.id]=$;b(null,Z)}})},Sr.TinySDF=class{constructor({fontSize:T=24,buffer:l=3,radius:d=8,cutoff:v=.25,fontFamily:b=\"sans-serif\",fontWeight:M=\"normal\",fontStyle:O=\"normal\"}={}){this.buffer=l,this.cutoff=v,this.radius=d;let B=this.size=T+4*l,U=this._createCanvas(B),W=this.ctx=U.getContext(\"2d\",{willReadFrequently:!0});W.font=`${O} ${M} ${T}px ${b}`,W.textBaseline=\"alphabetic\",W.textAlign=\"left\",W.fillStyle=\"black\",this.gridOuter=new Float64Array(B*B),this.gridInner=new Float64Array(B*B),this.f=new Float64Array(B),this.z=new Float64Array(B+1),this.v=new Uint16Array(B)}_createCanvas(T){let l=document.createElement(\"canvas\");return l.width=l.height=T,l}draw(T){let{width:l,actualBoundingBoxAscent:d,actualBoundingBoxDescent:v,actualBoundingBoxLeft:b,actualBoundingBoxRight:M}=this.ctx.measureText(T),O=Math.ceil(d),B=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(M-b))),U=Math.min(this.size-this.buffer,O+Math.ceil(v)),W=B+2*this.buffer,Z=U+2*this.buffer,$=Math.max(W*Z,0),st=new Uint8ClampedArray($),At={data:st,width:W,height:Z,glyphWidth:B,glyphHeight:U,glyphTop:O,glyphLeft:0,glyphAdvance:l};if(B===0||U===0)return At;let{ctx:pt,buffer:yt,gridInner:dt,gridOuter:Ft}=this;pt.clearRect(yt,yt,B,U),pt.fillText(T,yt,yt+O);let Ht=pt.getImageData(yt,yt,B,U);Ft.fill(De,0,$),dt.fill(0,0,$);for(let St=0;St0?oe*oe:0,dt[$t]=oe<0?oe*oe:0}}Ke(Ft,0,0,W,Z,W,this.f,this.v,this.z),Ke(dt,yt,yt,B,U,W,this.f,this.v,this.z);for(let St=0;St<$;St++){let Bt=Math.sqrt(Ft[St])-Math.sqrt(dt[St]);st[St]=Math.round(255-255*(Bt/this.radius+this.cutoff))}return At}};class Li{constructor(){this.specification=n.v.light.position}possiblyEvaluate(l,d){return n.z(l.expression.evaluate(d))}interpolate(l,d,v){return{x:n.B.number(l.x,d.x,v),y:n.B.number(l.y,d.y,v),z:n.B.number(l.z,d.z,v)}}}let oo;class zl extends n.E{constructor(l){super(),oo=oo||new n.r({anchor:new n.D(n.v.light.anchor),position:new Li,color:new n.D(n.v.light.color),intensity:new n.D(n.v.light.intensity)}),this._transitionable=new n.T(oo),this.setLight(l),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(l,d={}){if(!this._validate(n.t,l,d))for(let v in l){let b=l[v];v.endsWith(\"-transition\")?this._transitionable.setTransition(v.slice(0,-11),b):this._transitionable.setValue(v,b)}}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,d,v){return(!v||v.validate!==!1)&&n.x(this,l.call(n.y,n.e({value:d,style:{glyphs:!0,sprite:!0},styleSpec:n.v})))}}class No{constructor(l,d){this.width=l,this.height=d,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(l,d){let v=l.join(\",\")+String(d);return this.dashEntry[v]||(this.dashEntry[v]=this.addDash(l,d)),this.dashEntry[v]}getDashRanges(l,d,v){let b=[],M=l.length%2==1?-l[l.length-1]*v:0,O=l[0]*v,B=!0;b.push({left:M,right:O,isDash:B,zeroLength:l[0]===0});let U=l[0];for(let W=1;W1&&(U=l[++B]);let Z=Math.abs(W-U.left),$=Math.abs(W-U.right),st=Math.min(Z,$),At,pt=M/v*(b+1);if(U.isDash){let yt=b-Math.abs(pt);At=Math.sqrt(st*st+yt*yt)}else At=b-Math.sqrt(st*st+pt*pt);this.data[O+W]=Math.max(0,Math.min(255,At+128))}}}addRegularDash(l){for(let B=l.length-1;B>=0;--B){let U=l[B],W=l[B+1];U.zeroLength?l.splice(B,1):W&&W.isDash===U.isDash&&(W.left=U.left,l.splice(B,1))}let d=l[0],v=l[l.length-1];d.isDash===v.isDash&&(d.left=v.left-this.width,v.right=d.right+this.width);let b=this.width*this.nextRow,M=0,O=l[M];for(let B=0;B1&&(O=l[++M]);let U=Math.abs(B-O.left),W=Math.abs(B-O.right),Z=Math.min(U,W);this.data[b+B]=Math.max(0,Math.min(255,(O.isDash?Z:-Z)+128))}}addDash(l,d){let v=d?7:0,b=2*v+1;if(this.nextRow+b>this.height)return n.w(\"LineAtlas out of space\"),null;let M=0;for(let B=0;B{b.send(l,d,M)},v=v||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(l=!0){this.actors.forEach(d=>{d.remove()}),this.actors=[],l&&this.workerPool.release(this.id)}}function Uo(T,l,d){let v=function(b,M){if(b)return d(b);if(M){let O=n.F(n.e(M,T),[\"tiles\",\"minzoom\",\"maxzoom\",\"attribution\",\"bounds\",\"scheme\",\"tileSize\",\"encoding\"]);M.vector_layers&&(O.vectorLayers=M.vector_layers,O.vectorLayerIds=O.vectorLayers.map(B=>B.id)),d(null,O)}};return T.url?n.f(l.transformRequest(T.url,Q.Source),v):n.h.frame(()=>v(null,T))}class Si{constructor(l,d){l&&(d?this.setSouthWest(l).setNorthEast(d):Array.isArray(l)&&(l.length===4?this.setSouthWest([l[0],l[1]]).setNorthEast([l[2],l[3]]):this.setSouthWest(l[0]).setNorthEast(l[1])))}setNorthEast(l){return this._ne=l instanceof n.L?new n.L(l.lng,l.lat):n.L.convert(l),this}setSouthWest(l){return this._sw=l instanceof n.L?new n.L(l.lng,l.lat):n.L.convert(l),this}extend(l){let d=this._sw,v=this._ne,b,M;if(l instanceof n.L)b=l,M=l;else{if(!(l instanceof Si))return Array.isArray(l)?l.length===4||l.every(Array.isArray)?this.extend(Si.convert(l)):this.extend(n.L.convert(l)):l&&(\"lng\"in l||\"lon\"in l)&&\"lat\"in l?this.extend(n.L.convert(l)):this;if(b=l._sw,M=l._ne,!b||!M)return this}return d||v?(d.lng=Math.min(b.lng,d.lng),d.lat=Math.min(b.lat,d.lat),v.lng=Math.max(M.lng,v.lng),v.lat=Math.max(M.lat,v.lat)):(this._sw=new n.L(b.lng,b.lat),this._ne=new n.L(M.lng,M.lat)),this}getCenter(){return new n.L((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new n.L(this.getWest(),this.getNorth())}getSouthEast(){return new n.L(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(l){let{lng:d,lat:v}=n.L.convert(l),b=this._sw.lng<=d&&d<=this._ne.lng;return this._sw.lng>this._ne.lng&&(b=this._sw.lng>=d&&d>=this._ne.lng),this._sw.lat<=v&&v<=this._ne.lat&&b}static convert(l){return l instanceof Si?l:l&&new Si(l)}static fromLngLat(l,d=0){let v=360*d/40075017,b=v/Math.cos(Math.PI/180*l.lat);return new Si(new n.L(l.lng-b,l.lat-v),new n.L(l.lng+b,l.lat+v))}}class Ns{constructor(l,d,v){this.bounds=Si.convert(this.validateBounds(l)),this.minzoom=d||0,this.maxzoom=v||24}validateBounds(l){return Array.isArray(l)&&l.length===4?[Math.max(-180,l[0]),Math.max(-90,l[1]),Math.min(180,l[2]),Math.min(90,l[3])]:[-180,-90,180,90]}contains(l){let d=Math.pow(2,l.z),v=Math.floor(n.G(this.bounds.getWest())*d),b=Math.floor(n.H(this.bounds.getNorth())*d),M=Math.ceil(n.G(this.bounds.getEast())*d),O=Math.ceil(n.H(this.bounds.getSouth())*d);return l.x>=v&&l.x=b&&l.y{this._loaded=!1,this.fire(new n.k(\"dataloading\",{dataType:\"source\"})),this._tileJSONRequest=Uo(this._options,this.map._requestManager,(M,O)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),M?this.fire(new n.j(M)):O&&(n.e(this,O),O.bounds&&(this.tileBounds=new Ns(O.bounds,this.minzoom,this.maxzoom)),this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})),this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"content\"})))})},this.serialize=()=>n.e({},this._options),this.id=l,this.dispatcher=v,this.type=\"vector\",this.minzoom=0,this.maxzoom=22,this.scheme=\"xyz\",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,n.e(this,n.F(d,[\"url\",\"scheme\",\"tileSize\",\"promoteId\"])),this._options=n.e({type:\"vector\"},d),this._collectResourceTiming=d.collectResourceTiming,this.tileSize!==512)throw new Error(\"vector tile sources must have a tileSize of 512\");this.setEventedParent(b)}loaded(){return this._loaded}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}onAdd(l){this.map=l,this.load()}setSourceProperty(l){this._tileJSONRequest&&this._tileJSONRequest.cancel(),l(),this.load()}setTiles(l){return this.setSourceProperty(()=>{this._options.tiles=l}),this}setUrl(l){return this.setSourceProperty(()=>{this.url=l,this._options.url=l}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(l,d){let v=l.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),b={request:this.map._requestManager.transformRequest(v,Q.Tile),uid:l.uid,tileID:l.tileID,zoom:l.tileID.overscaledZ,tileSize:this.tileSize*l.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function M(O,B){return delete l.request,l.aborted?d(null):O&&O.status!==404?d(O):(B&&B.resourceTiming&&(l.resourceTiming=B.resourceTiming),this.map._refreshExpiredTiles&&B&&l.setExpiryData(B),l.loadVectorData(B,this.map.painter),d(null),void(l.reloadCallback&&(this.loadTile(l,l.reloadCallback),l.reloadCallback=null)))}b.request.collectResourceTiming=this._collectResourceTiming,l.actor&&l.state!==\"expired\"?l.state===\"loading\"?l.reloadCallback=d:l.request=l.actor.send(\"reloadTile\",b,M.bind(this)):(l.actor=this.dispatcher.getActor(),l.request=l.actor.send(\"loadTile\",b,M.bind(this)))}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.actor&&l.actor.send(\"abortTile\",{uid:l.uid,type:this.type,source:this.id},void 0)}unloadTile(l){l.unloadVectorData(),l.actor&&l.actor.send(\"removeTile\",{uid:l.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class kc extends n.E{constructor(l,d,v,b){super(),this.id=l,this.dispatcher=v,this.setEventedParent(b),this.type=\"raster\",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme=\"xyz\",this.tileSize=512,this._loaded=!1,this._options=n.e({type:\"raster\"},d),n.e(this,n.F(d,[\"url\",\"scheme\",\"tileSize\"]))}load(){this._loaded=!1,this.fire(new n.k(\"dataloading\",{dataType:\"source\"})),this._tileJSONRequest=Uo(this._options,this.map._requestManager,(l,d)=>{this._tileJSONRequest=null,this._loaded=!0,l?this.fire(new n.j(l)):d&&(n.e(this,d),d.bounds&&(this.tileBounds=new Ns(d.bounds,this.minzoom,this.maxzoom)),this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})),this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"content\"})))})}loaded(){return this._loaded}onAdd(l){this.map=l,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}setSourceProperty(l){this._tileJSONRequest&&this._tileJSONRequest.cancel(),l(),this.load()}setTiles(l){return this.setSourceProperty(()=>{this._options.tiles=l}),this}serialize(){return n.e({},this._options)}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}loadTile(l,d){let v=l.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);l.request=j.getImage(this.map._requestManager.transformRequest(v,Q.Tile),(b,M,O)=>{if(delete l.request,l.aborted)l.state=\"unloaded\",d(null);else if(b)l.state=\"errored\",d(b);else if(M){this.map._refreshExpiredTiles&&O&&l.setExpiryData(O);let B=this.map.painter.context,U=B.gl;l.texture=this.map.painter.getTileTexture(M.width),l.texture?l.texture.update(M,{useMipmap:!0}):(l.texture=new qt(B,M,U.RGBA,{useMipmap:!0}),l.texture.bind(U.LINEAR,U.CLAMP_TO_EDGE,U.LINEAR_MIPMAP_NEAREST),B.extTextureFilterAnisotropic&&U.texParameterf(U.TEXTURE_2D,B.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,B.extTextureFilterAnisotropicMax)),l.state=\"loaded\",d(null)}},this.map._refreshExpiredTiles)}abortTile(l,d){l.request&&(l.request.cancel(),delete l.request),d()}unloadTile(l,d){l.texture&&this.map.painter.saveTileTexture(l.texture),d()}hasTransition(){return!1}}class Rc extends kc{constructor(l,d,v,b){super(l,d,v,b),this.type=\"raster-dem\",this.maxzoom=22,this._options=n.e({type:\"raster-dem\"},d),this.encoding=d.encoding||\"mapbox\",this.redFactor=d.redFactor,this.greenFactor=d.greenFactor,this.blueFactor=d.blueFactor,this.baseShift=d.baseShift}loadTile(l,d){let v=l.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),b=this.map._requestManager.transformRequest(v,Q.Tile);function M(O,B){O&&(l.state=\"errored\",d(O)),B&&(l.dem=B,l.needsHillshadePrepare=!0,l.needsTerrainPrepare=!0,l.state=\"loaded\",d(null))}l.neighboringTiles=this._getNeighboringTiles(l.tileID),l.request=j.getImage(b,(O,B,U)=>n._(this,void 0,void 0,function*(){if(delete l.request,l.aborted)l.state=\"unloaded\",d(null);else if(O)l.state=\"errored\",d(O);else if(B){this.map._refreshExpiredTiles&&l.setExpiryData(U);let W=n.a(B)&&n.J()?B:yield function($){return n._(this,void 0,void 0,function*(){if(typeof VideoFrame<\"u\"&&n.K()){let st=$.width+2,At=$.height+2;try{return new n.R({width:st,height:At},yield n.M($,-1,-1,st,At))}catch{}}return n.h.getImageData($,1)})}(B),Z={uid:l.uid,coord:l.tileID,source:this.id,rawImageData:W,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};l.actor&&l.state!==\"expired\"||(l.actor=this.dispatcher.getActor(),l.actor.send(\"loadDEMTile\",Z,M))}}),this.map._refreshExpiredTiles)}_getNeighboringTiles(l){let d=l.canonical,v=Math.pow(2,d.z),b=(d.x-1+v)%v,M=d.x===0?l.wrap-1:l.wrap,O=(d.x+1+v)%v,B=d.x+1===v?l.wrap+1:l.wrap,U={};return U[new n.O(l.overscaledZ,M,d.z,b,d.y).key]={backfilled:!1},U[new n.O(l.overscaledZ,B,d.z,O,d.y).key]={backfilled:!1},d.y>0&&(U[new n.O(l.overscaledZ,M,d.z,b,d.y-1).key]={backfilled:!1},U[new n.O(l.overscaledZ,l.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},U[new n.O(l.overscaledZ,B,d.z,O,d.y-1).key]={backfilled:!1}),d.y+1{this._updateWorkerData()},this.serialize=()=>n.e({},this._options,{type:this.type,data:this._data}),this.id=l,this.type=\"geojson\",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=v.getActor(),this.setEventedParent(b),this._data=d.data,this._options=n.e({},d),this._collectResourceTiming=d.collectResourceTiming,d.maxzoom!==void 0&&(this.maxzoom=d.maxzoom),d.type&&(this.type=d.type),d.attribution&&(this.attribution=d.attribution),this.promoteId=d.promoteId;let M=n.N/this.tileSize;this.workerOptions=n.e({source:this.id,cluster:d.cluster||!1,geojsonVtOptions:{buffer:(d.buffer!==void 0?d.buffer:128)*M,tolerance:(d.tolerance!==void 0?d.tolerance:.375)*M,extent:n.N,maxZoom:this.maxzoom,lineMetrics:d.lineMetrics||!1,generateId:d.generateId||!1},superclusterOptions:{maxZoom:d.clusterMaxZoom!==void 0?d.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,d.clusterMinPoints||2),extent:n.N,radius:(d.clusterRadius||50)*M,log:!1,generateId:d.generateId||!1},clusterProperties:d.clusterProperties,filter:d.filter},d.workerOptions),typeof this.promoteId==\"string\"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(l){this.map=l,this.load()}setData(l){return this._data=l,this._updateWorkerData(),this}updateData(l){return this._updateWorkerData(l),this}setClusterOptions(l){return this.workerOptions.cluster=l.cluster,l&&(l.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=l.clusterRadius),l.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=l.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(l,d){return this.actor.send(\"geojson.getClusterExpansionZoom\",{clusterId:l,source:this.id},d),this}getClusterChildren(l,d){return this.actor.send(\"geojson.getClusterChildren\",{clusterId:l,source:this.id},d),this}getClusterLeaves(l,d,v,b){return this.actor.send(\"geojson.getClusterLeaves\",{source:this.id,clusterId:l,limit:d,offset:v},b),this}_updateWorkerData(l){let d=n.e({},this.workerOptions);l?d.dataDiff=l:typeof this._data==\"string\"?(d.request=this.map._requestManager.transformRequest(n.h.resolveURL(this._data),Q.Source),d.request.collectResourceTiming=this._collectResourceTiming):d.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new n.k(\"dataloading\",{dataType:\"source\"})),this.actor.send(`${this.type}.loadData`,d,(v,b)=>{if(this._pendingLoads--,this._removed||b&&b.abandoned)return void this.fire(new n.k(\"dataabort\",{dataType:\"source\"}));let M=null;if(b&&b.resourceTiming&&b.resourceTiming[this.id]&&(M=b.resourceTiming[this.id].slice(0)),v)return void this.fire(new n.j(v));let O={dataType:\"source\"};this._collectResourceTiming&&M&&M.length>0&&n.e(O,{resourceTiming:M}),this.fire(new n.k(\"data\",Object.assign(Object.assign({},O),{sourceDataType:\"metadata\"}))),this.fire(new n.k(\"data\",Object.assign(Object.assign({},O),{sourceDataType:\"content\"})))})}loaded(){return this._pendingLoads===0}loadTile(l,d){let v=l.actor?\"reloadTile\":\"loadTile\";l.actor=this.actor;let b={type:this.type,uid:l.uid,tileID:l.tileID,zoom:l.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};l.request=this.actor.send(v,b,(M,O)=>(delete l.request,l.unloadVectorData(),l.aborted?d(null):M?d(M):(l.loadVectorData(O,this.map.painter,v===\"reloadTile\"),d(null))))}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.aborted=!0}unloadTile(l){l.unloadVectorData(),this.actor.send(\"removeTile\",{uid:l.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send(\"removeSource\",{type:this.type,source:this.id})}hasTransition(){return!1}}var Jn=n.Q([{name:\"a_pos\",type:\"Int16\",components:2},{name:\"a_texture_pos\",type:\"Int16\",components:2}]);class ki extends n.E{constructor(l,d,v,b){super(),this.load=(M,O)=>{this._loaded=!1,this.fire(new n.k(\"dataloading\",{dataType:\"source\"})),this.url=this.options.url,this._request=j.getImage(this.map._requestManager.transformRequest(this.url,Q.Image),(B,U)=>{this._request=null,this._loaded=!0,B?this.fire(new n.j(B)):U&&(this.image=U,M&&(this.coordinates=M),O&&O(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;let M=this.map.painter.context,O=M.gl;this.boundsBuffer||(this.boundsBuffer=M.createVertexBuffer(this._boundsArray,Jn.members)),this.boundsSegments||(this.boundsSegments=n.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new qt(M,this.image,O.RGBA),this.texture.bind(O.LINEAR,O.CLAMP_TO_EDGE));let B=!1;for(let U in this.tiles){let W=this.tiles[U];W.state!==\"loaded\"&&(W.state=\"loaded\",W.texture=this.texture,B=!0)}B&&this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"idle\",sourceId:this.id}))},this.serialize=()=>({type:\"image\",url:this.options.url,coordinates:this.coordinates}),this.id=l,this.dispatcher=v,this.coordinates=d.coordinates,this.type=\"image\",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(b),this.options=d}loaded(){return this._loaded}updateImage(l){return l.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=l.url,this.load(l.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})))}onAdd(l){this.map=l,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(l){this.coordinates=l;let d=l.map(n.U.fromLngLat);this.tileID=function(b){let M=1/0,O=1/0,B=-1/0,U=-1/0;for(let st of b)M=Math.min(M,st.x),O=Math.min(O,st.y),B=Math.max(B,st.x),U=Math.max(U,st.y);let W=Math.max(B-M,U-O),Z=Math.max(0,Math.floor(-Math.log(W)/Math.LN2)),$=Math.pow(2,Z);return new n.W(Z,Math.floor((M+B)/2*$),Math.floor((O+U)/2*$))}(d),this.minzoom=this.maxzoom=this.tileID.z;let v=d.map(b=>this.tileID.getTilePoint(b)._round());return this._boundsArray=new n.V,this._boundsArray.emplaceBack(v[0].x,v[0].y,0,0),this._boundsArray.emplaceBack(v[1].x,v[1].y,n.N,0),this._boundsArray.emplaceBack(v[3].x,v[3].y,0,n.N),this._boundsArray.emplaceBack(v[2].x,v[2].y,n.N,n.N),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"content\"})),this}loadTile(l,d){this.tileID&&this.tileID.equals(l.tileID.canonical)?(this.tiles[String(l.tileID.wrap)]=l,l.buckets={},d(null)):(l.state=\"errored\",d(null))}hasTransition(){return!1}}class ts extends ki{constructor(l,d,v,b){super(l,d,v,b),this.load=()=>{this._loaded=!1;let M=this.options;this.urls=[];for(let O of M.urls)this.urls.push(this.map._requestManager.transformRequest(O,Q.Source).url);n.X(this.urls,(O,B)=>{this._loaded=!0,O?this.fire(new n.j(O)):B&&(this.video=B,this.video.loop=!0,this.video.addEventListener(\"playing\",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let M=this.map.painter.context,O=M.gl;this.boundsBuffer||(this.boundsBuffer=M.createVertexBuffer(this._boundsArray,Jn.members)),this.boundsSegments||(this.boundsSegments=n.S.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(O.LINEAR,O.CLAMP_TO_EDGE),O.texSubImage2D(O.TEXTURE_2D,0,0,0,O.RGBA,O.UNSIGNED_BYTE,this.video)):(this.texture=new qt(M,this.video,O.RGBA),this.texture.bind(O.LINEAR,O.CLAMP_TO_EDGE));let B=!1;for(let U in this.tiles){let W=this.tiles[U];W.state!==\"loaded\"&&(W.state=\"loaded\",W.texture=this.texture,B=!0)}B&&this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"idle\",sourceId:this.id}))},this.serialize=()=>({type:\"video\",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type=\"video\",this.options=d}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(l){if(this.video){let d=this.video.seekable;ld.end(0)?this.fire(new n.j(new n.Y(`sources.${this.id}`,null,`Playback for this video can be set only between the ${d.start(0)} and ${d.end(0)}-second mark.`))):this.video.currentTime=l}}getVideo(){return this.video}onAdd(l){this.map||(this.map=l,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}}class Vo extends ki{constructor(l,d,v,b){super(l,d,v,b),this.load=()=>{this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new n.j(new Error(\"Canvas dimensions cannot be less than or equal to zero.\"))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},this.prepare=()=>{let M=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,M=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,M=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let O=this.map.painter.context,B=O.gl;this.boundsBuffer||(this.boundsBuffer=O.createVertexBuffer(this._boundsArray,Jn.members)),this.boundsSegments||(this.boundsSegments=n.S.simpleSegment(0,0,4,2)),this.texture?(M||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new qt(O,this.canvas,B.RGBA,{premultiply:!0});let U=!1;for(let W in this.tiles){let Z=this.tiles[W];Z.state!==\"loaded\"&&(Z.state=\"loaded\",Z.texture=this.texture,U=!0)}U&&this.fire(new n.k(\"data\",{dataType:\"source\",sourceDataType:\"idle\",sourceId:this.id}))},this.serialize=()=>({type:\"canvas\",coordinates:this.coordinates}),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(M=>!Array.isArray(M)||M.length!==2||M.some(O=>typeof O!=\"number\"))||this.fire(new n.j(new n.Y(`sources.${l}`,null,'\"coordinates\" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new n.j(new n.Y(`sources.${l}`,null,'missing required property \"coordinates\"'))),d.animate&&typeof d.animate!=\"boolean\"&&this.fire(new n.j(new n.Y(`sources.${l}`,null,'optional \"animate\" property must be a boolean value'))),d.canvas?typeof d.canvas==\"string\"||d.canvas instanceof HTMLCanvasElement||this.fire(new n.j(new n.Y(`sources.${l}`,null,'\"canvas\" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new n.j(new n.Y(`sources.${l}`,null,'missing required property \"canvas\"'))),this.options=d,this.animate=d.animate===void 0||d.animate}getCanvas(){return this.canvas}onAdd(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let l of[this.canvas.width,this.canvas.height])if(isNaN(l)||l<=0)return!0;return!1}}let cl={},xo=T=>{switch(T){case\"geojson\":return Xi;case\"image\":return ki;case\"raster\":return kc;case\"raster-dem\":return Rc;case\"vector\":return ll;case\"video\":return ts;case\"canvas\":return Vo}return cl[T]};function Pa(T,l){let d=n.Z();return n.$(d,d,[1,1,0]),n.a0(d,d,[.5*T.width,.5*T.height,1]),n.a1(d,d,T.calculatePosMatrix(l.toUnwrapped()))}function na(T,l,d,v,b,M){let O=function($,st,At){if($)for(let pt of $){let yt=st[pt];if(yt&&yt.source===At&&yt.type===\"fill-extrusion\")return!0}else for(let pt in st){let yt=st[pt];if(yt.source===At&&yt.type===\"fill-extrusion\")return!0}return!1}(b&&b.layers,l,T.id),B=M.maxPitchScaleFactor(),U=T.tilesIn(v,B,O);U.sort(as);let W=[];for(let $ of U)W.push({wrappedTileID:$.tileID.wrapped().key,queryResults:$.tile.queryRenderedFeatures(l,d,T._state,$.queryGeometry,$.cameraQueryGeometry,$.scale,b,M,B,Pa(T.transform,$.tileID))});let Z=function($){let st={},At={};for(let pt of $){let yt=pt.queryResults,dt=pt.wrappedTileID,Ft=At[dt]=At[dt]||{};for(let Ht in yt){let St=yt[Ht],Bt=Ft[Ht]=Ft[Ht]||{},Qt=st[Ht]=st[Ht]||[];for(let $t of St)Bt[$t.featureIndex]||(Bt[$t.featureIndex]=!0,Qt.push($t))}}return st}(W);for(let $ in Z)Z[$].forEach(st=>{let At=st.feature,pt=T.getFeatureState(At.layer[\"source-layer\"],At.id);At.source=At.layer.source,At.layer[\"source-layer\"]&&(At.sourceLayer=At.layer[\"source-layer\"]),At.state=pt});return Z}function as(T,l){let d=T.tileID,v=l.tileID;return d.overscaledZ-v.overscaledZ||d.canonical.y-v.canonical.y||d.wrap-v.wrap||d.canonical.x-v.canonical.x}class ao{constructor(l,d){this.timeAdded=0,this.fadeEndTime=0,this.tileID=l,this.uid=n.a2(),this.uses=0,this.tileSize=d,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state=\"loading\"}registerFadeDuration(l){let d=l+this.timeAdded;dM.getLayer(W)).filter(Boolean);if(U.length!==0){B.layers=U,B.stateDependentLayerIds&&(B.stateDependentLayers=B.stateDependentLayerIds.map(W=>U.filter(Z=>Z.id===W)[0]));for(let W of U)O[W.id]=B}}return O}(l.buckets,d.style),this.hasSymbolBuckets=!1;for(let b in this.buckets){let M=this.buckets[b];if(M instanceof n.a4){if(this.hasSymbolBuckets=!0,!v)break;M.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let b in this.buckets){let M=this.buckets[b];if(M instanceof n.a4&&M.hasRTLText){this.hasRTLText=!0,n.a5();break}}this.queryPadding=0;for(let b in this.buckets){let M=this.buckets[b];this.queryPadding=Math.max(this.queryPadding,d.style.getLayer(b).queryRadius(M))}l.imageAtlas&&(this.imageAtlas=l.imageAtlas),l.glyphAtlasImage&&(this.glyphAtlasImage=l.glyphAtlasImage)}else this.collisionBoxArray=new n.a3}unloadVectorData(){for(let l in this.buckets)this.buckets[l].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state=\"unloaded\"}getBucket(l){return this.buckets[l.id]}upload(l){for(let v in this.buckets){let b=this.buckets[v];b.uploadPending()&&b.upload(l)}let d=l.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new qt(l,this.imageAtlas.image,d.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new qt(l,this.glyphAtlasImage,d.ALPHA),this.glyphAtlasImage=null)}prepare(l){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(l,this.imageAtlasTexture)}queryRenderedFeatures(l,d,v,b,M,O,B,U,W,Z){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:b,cameraQueryGeometry:M,scale:O,tileSize:this.tileSize,pixelPosMatrix:Z,transform:U,params:B,queryPadding:this.queryPadding*W},l,d,v):{}}querySourceFeatures(l,d){let v=this.latestFeatureIndex;if(!v||!v.rawTileData)return;let b=v.loadVTLayers(),M=d&&d.sourceLayer?d.sourceLayer:\"\",O=b._geojsonTileLayer||b[M];if(!O)return;let B=n.a6(d&&d.filter),{z:U,x:W,y:Z}=this.tileID.canonical,$={z:U,x:W,y:Z};for(let st=0;stv)b=!1;else if(d)if(this.expirationTime{this.remove(l,M)},v)),this.data[b].push(M),this.order.push(b),this.order.length>this.max){let O=this._getAndRemoveByKey(this.order[0]);O&&this.onRemove(O)}return this}has(l){return l.wrapped().key in this.data}getAndRemove(l){return this.has(l)?this._getAndRemoveByKey(l.wrapped().key):null}_getAndRemoveByKey(l){let d=this.data[l].shift();return d.timeout&&clearTimeout(d.timeout),this.data[l].length===0&&delete this.data[l],this.order.splice(this.order.indexOf(l),1),d.value}getByKey(l){let d=this.data[l];return d?d[0].value:null}get(l){return this.has(l)?this.data[l.wrapped().key][0].value:null}remove(l,d){if(!this.has(l))return this;let v=l.wrapped().key,b=d===void 0?0:this.data[v].indexOf(d),M=this.data[v][b];return this.data[v].splice(b,1),M.timeout&&clearTimeout(M.timeout),this.data[v].length===0&&delete this.data[v],this.onRemove(M.value),this.order.splice(this.order.indexOf(v),1),this}setMaxSize(l){for(this.max=l;this.order.length>this.max;){let d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this}filter(l){let d=[];for(let v in this.data)for(let b of this.data[v])l(b.value)||d.push(b);for(let v of d)this.remove(v.value.tileID,v)}}class ee{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(l,d,v){let b=String(d);if(this.stateChanges[l]=this.stateChanges[l]||{},this.stateChanges[l][b]=this.stateChanges[l][b]||{},n.e(this.stateChanges[l][b],v),this.deletedStates[l]===null){this.deletedStates[l]={};for(let M in this.state[l])M!==b&&(this.deletedStates[l][M]=null)}else if(this.deletedStates[l]&&this.deletedStates[l][b]===null){this.deletedStates[l][b]={};for(let M in this.state[l][b])v[M]||(this.deletedStates[l][b][M]=null)}else for(let M in v)this.deletedStates[l]&&this.deletedStates[l][b]&&this.deletedStates[l][b][M]===null&&delete this.deletedStates[l][b][M]}removeFeatureState(l,d,v){if(this.deletedStates[l]===null)return;let b=String(d);if(this.deletedStates[l]=this.deletedStates[l]||{},v&&d!==void 0)this.deletedStates[l][b]!==null&&(this.deletedStates[l][b]=this.deletedStates[l][b]||{},this.deletedStates[l][b][v]=null);else if(d!==void 0)if(this.stateChanges[l]&&this.stateChanges[l][b])for(v in this.deletedStates[l][b]={},this.stateChanges[l][b])this.deletedStates[l][b][v]=null;else this.deletedStates[l][b]=null;else this.deletedStates[l]=null}getState(l,d){let v=String(d),b=n.e({},(this.state[l]||{})[v],(this.stateChanges[l]||{})[v]);if(this.deletedStates[l]===null)return{};if(this.deletedStates[l]){let M=this.deletedStates[l][d];if(M===null)return{};for(let O in M)delete b[O]}return b}initializeTileState(l,d){l.setFeatureState(this.state,d)}coalesceChanges(l,d){let v={};for(let b in this.stateChanges){this.state[b]=this.state[b]||{};let M={};for(let O in this.stateChanges[b])this.state[b][O]||(this.state[b][O]={}),n.e(this.state[b][O],this.stateChanges[b][O]),M[O]=this.state[b][O];v[b]=M}for(let b in this.deletedStates){this.state[b]=this.state[b]||{};let M={};if(this.deletedStates[b]===null)for(let O in this.state[b])M[O]={},this.state[b][O]={};else for(let O in this.deletedStates[b]){if(this.deletedStates[b][O]===null)this.state[b][O]={};else for(let B of Object.keys(this.deletedStates[b][O]))delete this.state[b][O][B];M[O]=this.state[b][O]}v[b]=v[b]||{},n.e(v[b],M)}if(this.stateChanges={},this.deletedStates={},Object.keys(v).length!==0)for(let b in l)l[b].setFeatureState(v,d)}}class ls extends n.E{constructor(l,d,v){super(),this.id=l,this.dispatcher=v,this.on(\"data\",b=>{b.dataType===\"source\"&&b.sourceDataType===\"metadata\"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&b.dataType===\"source\"&&b.sourceDataType===\"content\"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on(\"dataloading\",()=>{this._sourceErrored=!1}),this.on(\"error\",()=>{this._sourceErrored=this._source.loaded()}),this._source=((b,M,O,B)=>{let U=new(xo(M.type))(b,M,O,B);if(U.id!==b)throw new Error(`Expected Source id to be ${b} instead of ${U.id}`);return U})(l,d,v,this),this._tiles={},this._cache=new Nl(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ee,this._didEmitContent=!1,this._updated=!1}onAdd(l){this.map=l,this._maxTileCacheSize=l?l._maxTileCacheSize:null,this._maxTileCacheZoomLevels=l?l._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(l)}onRemove(l){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(l)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let l in this._tiles){let d=this._tiles[l];if(d.state!==\"loaded\"&&d.state!==\"errored\")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let l=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,l&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(l,d){return this._source.loadTile(l,d)}_unloadTile(l){if(this._source.unloadTile)return this._source.unloadTile(l,()=>{})}_abortTile(l){this._source.abortTile&&this._source.abortTile(l,()=>{}),this._source.fire(new n.k(\"dataabort\",{tile:l,coord:l.tileID,dataType:\"source\"}))}serialize(){return this._source.serialize()}prepare(l){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let d in this._tiles){let v=this._tiles[d];v.upload(l),v.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(l=>l.tileID).sort(mn).map(l=>l.key)}getRenderableIds(l){let d=[];for(let v in this._tiles)this._isIdRenderable(v,l)&&d.push(this._tiles[v]);return l?d.sort((v,b)=>{let M=v.tileID,O=b.tileID,B=new n.P(M.canonical.x,M.canonical.y)._rotate(this.transform.angle),U=new n.P(O.canonical.x,O.canonical.y)._rotate(this.transform.angle);return M.overscaledZ-O.overscaledZ||U.y-B.y||U.x-B.x}).map(v=>v.tileID.key):d.map(v=>v.tileID).sort(mn).map(v=>v.key)}hasRenderableParent(l){let d=this.findLoadedParent(l,0);return!!d&&this._isIdRenderable(d.tileID.key)}_isIdRenderable(l,d){return this._tiles[l]&&this._tiles[l].hasData()&&!this._coveredTiles[l]&&(d||!this._tiles[l].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let l in this._tiles)this._tiles[l].state!==\"errored\"&&this._reloadTile(l,\"reloading\")}}_reloadTile(l,d){let v=this._tiles[l];v&&(v.state!==\"loading\"&&(v.state=d),this._loadTile(v,this._tileLoaded.bind(this,v,l,d)))}_tileLoaded(l,d,v,b){if(b)return l.state=\"errored\",void(b.status!==404?this._source.fire(new n.j(b,{tile:l})):this.update(this.transform,this.terrain));l.timeAdded=n.h.now(),v===\"expired\"&&(l.refreshedUponExpiration=!0),this._setTileReloadTimer(d,l),this.getSource().type===\"raster-dem\"&&l.dem&&this._backfillDEM(l),this._state.initializeTileState(l,this.map?this.map.painter:null),l.aborted||this._source.fire(new n.k(\"data\",{dataType:\"source\",tile:l,coord:l.tileID}))}_backfillDEM(l){let d=this.getRenderableIds();for(let b=0;b1||(Math.abs(O)>1&&(Math.abs(O+U)===1?O+=U:Math.abs(O-U)===1&&(O-=U)),M.dem&&b.dem&&(b.dem.backfillBorder(M.dem,O,B),b.neighboringTiles&&b.neighboringTiles[W]&&(b.neighboringTiles[W].backfilled=!0)))}}getTile(l){return this.getTileByID(l.key)}getTileByID(l){return this._tiles[l]}_retainLoadedChildren(l,d,v,b){for(let M in this._tiles){let O=this._tiles[M];if(b[M]||!O.hasData()||O.tileID.overscaledZ<=d||O.tileID.overscaledZ>v)continue;let B=O.tileID;for(;O&&O.tileID.overscaledZ>d+1;){let W=O.tileID.scaledTo(O.tileID.overscaledZ-1);O=this._tiles[W.key],O&&O.hasData()&&(B=W)}let U=B;for(;U.overscaledZ>d;)if(U=U.scaledTo(U.overscaledZ-1),l[U.key]){b[B.key]=B;break}}}findLoadedParent(l,d){if(l.key in this._loadedParentTiles){let v=this._loadedParentTiles[l.key];return v&&v.tileID.overscaledZ>=d?v:null}for(let v=l.overscaledZ-1;v>=d;v--){let b=l.scaledTo(v),M=this._getLoadedTile(b);if(M)return M}}_getLoadedTile(l){let d=this._tiles[l.key];return d&&d.hasData()?d:this._cache.getByKey(l.wrapped().key)}updateCacheSize(l){let d=Math.ceil(l.width/this._source.tileSize)+1,v=Math.ceil(l.height/this._source.tileSize)+1,b=Math.floor(d*v*(this._maxTileCacheZoomLevels===null?n.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),M=typeof this._maxTileCacheSize==\"number\"?Math.min(this._maxTileCacheSize,b):b;this._cache.setMaxSize(M)}handleWrapJump(l){let d=Math.round((l-(this._prevLng===void 0?l:this._prevLng))/360);if(this._prevLng=l,d){let v={};for(let b in this._tiles){let M=this._tiles[b];M.tileID=M.tileID.unwrapTo(M.tileID.wrap+d),v[M.tileID.key]=M}this._tiles=v;for(let b in this._timers)clearTimeout(this._timers[b]),delete this._timers[b];for(let b in this._tiles)this._setTileReloadTimer(b,this._tiles[b])}}update(l,d){if(this.transform=l,this.terrain=d,!this._sourceLoaded||this._paused)return;let v;this.updateCacheSize(l),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?v=l.getVisibleUnwrappedCoordinates(this._source.tileID).map(Z=>new n.O(Z.canonical.z,Z.wrap,Z.canonical.z,Z.canonical.x,Z.canonical.y)):(v=l.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:d}),this._source.hasTile&&(v=v.filter(Z=>this._source.hasTile(Z)))):v=[];let b=l.coveringZoomLevel(this._source),M=Math.max(b-ls.maxOverzooming,this._source.minzoom),O=Math.max(b+ls.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let Z={};for(let $ of v)if($.canonical.z>this._source.minzoom){let st=$.scaledTo($.canonical.z-1);Z[st.key]=st;let At=$.scaledTo(Math.max(this._source.minzoom,Math.min($.canonical.z,5)));Z[At.key]=At}v=v.concat(Object.values(Z))}let B=v.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,B&&this.fire(new n.k(\"data\",{sourceDataType:\"idle\",dataType:\"source\",sourceId:this.id}));let U=this._updateRetainedTiles(v,b);if(gi(this._source.type)){let Z={},$={},st=Object.keys(U),At=n.h.now();for(let pt of st){let yt=U[pt],dt=this._tiles[pt];if(!dt||dt.fadeEndTime!==0&&dt.fadeEndTime<=At)continue;let Ft=this.findLoadedParent(yt,M);Ft&&(this._addTile(Ft.tileID),Z[Ft.tileID.key]=Ft.tileID),$[pt]=yt}this._retainLoadedChildren($,b,O,U);for(let pt in Z)U[pt]||(this._coveredTiles[pt]=!0,U[pt]=Z[pt]);if(d){let pt={},yt={};for(let dt of v)this._tiles[dt.key].hasData()?pt[dt.key]=dt:yt[dt.key]=dt;for(let dt in yt){let Ft=yt[dt].children(this._source.maxzoom);this._tiles[Ft[0].key]&&this._tiles[Ft[1].key]&&this._tiles[Ft[2].key]&&this._tiles[Ft[3].key]&&(pt[Ft[0].key]=U[Ft[0].key]=Ft[0],pt[Ft[1].key]=U[Ft[1].key]=Ft[1],pt[Ft[2].key]=U[Ft[2].key]=Ft[2],pt[Ft[3].key]=U[Ft[3].key]=Ft[3],delete yt[dt])}for(let dt in yt){let Ft=this.findLoadedParent(yt[dt],this._source.minzoom);if(Ft){pt[Ft.tileID.key]=U[Ft.tileID.key]=Ft.tileID;for(let Ht in pt)pt[Ht].isChildOf(Ft.tileID)&&delete pt[Ht]}}for(let dt in this._tiles)pt[dt]||(this._coveredTiles[dt]=!0)}}for(let Z in U)this._tiles[Z].clearFadeHold();let W=n.ab(this._tiles,U);for(let Z of W){let $=this._tiles[Z];$.hasSymbolBuckets&&!$.holdingForFade()?$.setHoldDuration(this.map._fadeDuration):$.hasSymbolBuckets&&!$.symbolFadeFinished()||this._removeTile(Z)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let l in this._tiles)this._tiles[l].holdingForFade()&&this._removeTile(l)}_updateRetainedTiles(l,d){let v={},b={},M=Math.max(d-ls.maxOverzooming,this._source.minzoom),O=Math.max(d+ls.maxUnderzooming,this._source.minzoom),B={};for(let U of l){let W=this._addTile(U);v[U.key]=U,W.hasData()||dthis._source.maxzoom){let $=U.children(this._source.maxzoom)[0],st=this.getTile($);if(st&&st.hasData()){v[$.key]=$;continue}}else{let $=U.children(this._source.maxzoom);if(v[$[0].key]&&v[$[1].key]&&v[$[2].key]&&v[$[3].key])continue}let Z=W.wasRequested();for(let $=U.overscaledZ-1;$>=M;--$){let st=U.scaledTo($);if(b[st.key])break;if(b[st.key]=!0,W=this.getTile(st),!W&&Z&&(W=this._addTile(st)),W){let At=W.hasData();if((Z||At)&&(v[st.key]=st),Z=W.wasRequested(),At)break}}}return v}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let l in this._tiles){let d=[],v,b=this._tiles[l].tileID;for(;b.overscaledZ>0;){if(b.key in this._loadedParentTiles){v=this._loadedParentTiles[b.key];break}d.push(b.key);let M=b.scaledTo(b.overscaledZ-1);if(v=this._getLoadedTile(M),v)break;b=M}for(let M of d)this._loadedParentTiles[M]=v}}_addTile(l){let d=this._tiles[l.key];if(d)return d;d=this._cache.getAndRemove(l),d&&(this._setTileReloadTimer(l.key,d),d.tileID=l,this._state.initializeTileState(d,this.map?this.map.painter:null),this._cacheTimers[l.key]&&(clearTimeout(this._cacheTimers[l.key]),delete this._cacheTimers[l.key],this._setTileReloadTimer(l.key,d)));let v=d;return d||(d=new ao(l,this._source.tileSize*l.overscaleFactor()),this._loadTile(d,this._tileLoaded.bind(this,d,l.key,d.state))),d.uses++,this._tiles[l.key]=d,v||this._source.fire(new n.k(\"dataloading\",{tile:d,coord:d.tileID,dataType:\"source\"})),d}_setTileReloadTimer(l,d){l in this._timers&&(clearTimeout(this._timers[l]),delete this._timers[l]);let v=d.getExpiryTimeout();v&&(this._timers[l]=setTimeout(()=>{this._reloadTile(l,\"expired\"),delete this._timers[l]},v))}_removeTile(l){let d=this._tiles[l];d&&(d.uses--,delete this._tiles[l],this._timers[l]&&(clearTimeout(this._timers[l]),delete this._timers[l]),d.uses>0||(d.hasData()&&d.state!==\"reloading\"?this._cache.add(d.tileID,d,d.getExpiryTimeout()):(d.aborted=!0,this._abortTile(d),this._unloadTile(d))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let l in this._tiles)this._removeTile(l);this._cache.reset()}tilesIn(l,d,v){let b=[],M=this.transform;if(!M)return b;let O=v?M.getCameraQueryGeometry(l):l,B=l.map(pt=>M.pointCoordinate(pt,this.terrain)),U=O.map(pt=>M.pointCoordinate(pt,this.terrain)),W=this.getIds(),Z=1/0,$=1/0,st=-1/0,At=-1/0;for(let pt of U)Z=Math.min(Z,pt.x),$=Math.min($,pt.y),st=Math.max(st,pt.x),At=Math.max(At,pt.y);for(let pt=0;pt=0&&St[1].y+Ht>=0){let Bt=B.map($t=>dt.getTilePoint($t)),Qt=U.map($t=>dt.getTilePoint($t));b.push({tile:yt,tileID:dt,queryGeometry:Bt,cameraQueryGeometry:Qt,scale:Ft})}}return b}getVisibleCoordinates(l){let d=this.getRenderableIds(l).map(v=>this._tiles[v].tileID);for(let v of d)v.posMatrix=this.transform.calculatePosMatrix(v.toUnwrapped());return d}hasTransition(){if(this._source.hasTransition())return!0;if(gi(this._source.type)){let l=n.h.now();for(let d in this._tiles)if(this._tiles[d].fadeEndTime>=l)return!0}return!1}setFeatureState(l,d,v){this._state.updateState(l=l||\"_geojsonTileLayer\",d,v)}removeFeatureState(l,d,v){this._state.removeFeatureState(l=l||\"_geojsonTileLayer\",d,v)}getFeatureState(l,d){return this._state.getState(l=l||\"_geojsonTileLayer\",d)}setDependencies(l,d,v){let b=this._tiles[l];b&&b.setDependencies(d,v)}reloadTilesForDependencies(l,d){for(let v in this._tiles)this._tiles[v].hasDependency(l,d)&&this._reloadTile(v,\"reloading\");this._cache.filter(v=>!v.hasDependency(l,d))}}function mn(T,l){let d=Math.abs(2*T.wrap)-+(T.wrap<0),v=Math.abs(2*l.wrap)-+(l.wrap<0);return T.overscaledZ-l.overscaledZ||v-d||l.canonical.y-T.canonical.y||l.canonical.x-T.canonical.x}function gi(T){return T===\"raster\"||T===\"image\"||T===\"video\"}ls.maxOverzooming=10,ls.maxUnderzooming=3;let oi=\"mapboxgl_preloaded_worker_pool\";class lo{constructor(){this.active={}}acquire(l){if(!this.workers)for(this.workers=[];this.workers.length{d.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[oi]}numActive(){return Object.keys(this.active).length}}let du=Math.floor(n.h.hardwareConcurrency/2),ul;function bo(){return ul||(ul=new lo),ul}lo.workerCount=n.ac(globalThis)?Math.max(Math.min(du,3),1):1;class hl{constructor(l,d){this.reset(l,d)}reset(l,d){this.points=l||[],this._distances=[0];for(let v=1;v0?(b-O)/B:0;return this.points[M].mult(1-U).add(this.points[d].mult(U))}}function Ia(T,l){let d=!0;return T===\"always\"||T!==\"never\"&&l!==\"never\"||(d=!1),d}class wo{constructor(l,d,v){let b=this.boxCells=[],M=this.circleCells=[];this.xCellCount=Math.ceil(l/v),this.yCellCount=Math.ceil(d/v);for(let O=0;Othis.width||b<0||d>this.height)return[];let U=[];if(l<=0&&d<=0&&this.width<=v&&this.height<=b){if(M)return[{key:null,x1:l,y1:d,x2:v,y2:b}];for(let W=0;W0}hitTestCircle(l,d,v,b,M){let O=l-v,B=l+v,U=d-v,W=d+v;if(B<0||O>this.width||W<0||U>this.height)return!1;let Z=[];return this._forEachCell(O,U,B,W,this._queryCellCircle,Z,{hitTest:!0,overlapMode:b,circle:{x:l,y:d,radius:v},seenUids:{box:{},circle:{}}},M),Z.length>0}_queryCell(l,d,v,b,M,O,B,U){let{seenUids:W,hitTest:Z,overlapMode:$}=B,st=this.boxCells[M];if(st!==null){let pt=this.bboxes;for(let yt of st)if(!W.box[yt]){W.box[yt]=!0;let dt=4*yt,Ft=this.boxKeys[yt];if(l<=pt[dt+2]&&d<=pt[dt+3]&&v>=pt[dt+0]&&b>=pt[dt+1]&&(!U||U(Ft))&&(!Z||!Ia($,Ft.overlapMode))&&(O.push({key:Ft,x1:pt[dt],y1:pt[dt+1],x2:pt[dt+2],y2:pt[dt+3]}),Z))return!0}}let At=this.circleCells[M];if(At!==null){let pt=this.circles;for(let yt of At)if(!W.circle[yt]){W.circle[yt]=!0;let dt=3*yt,Ft=this.circleKeys[yt];if(this._circleAndRectCollide(pt[dt],pt[dt+1],pt[dt+2],l,d,v,b)&&(!U||U(Ft))&&(!Z||!Ia($,Ft.overlapMode))){let Ht=pt[dt],St=pt[dt+1],Bt=pt[dt+2];if(O.push({key:Ft,x1:Ht-Bt,y1:St-Bt,x2:Ht+Bt,y2:St+Bt}),Z)return!0}}}return!1}_queryCellCircle(l,d,v,b,M,O,B,U){let{circle:W,seenUids:Z,overlapMode:$}=B,st=this.boxCells[M];if(st!==null){let pt=this.bboxes;for(let yt of st)if(!Z.box[yt]){Z.box[yt]=!0;let dt=4*yt,Ft=this.boxKeys[yt];if(this._circleAndRectCollide(W.x,W.y,W.radius,pt[dt+0],pt[dt+1],pt[dt+2],pt[dt+3])&&(!U||U(Ft))&&!Ia($,Ft.overlapMode))return O.push(!0),!0}}let At=this.circleCells[M];if(At!==null){let pt=this.circles;for(let yt of At)if(!Z.circle[yt]){Z.circle[yt]=!0;let dt=3*yt,Ft=this.circleKeys[yt];if(this._circlesCollide(pt[dt],pt[dt+1],pt[dt+2],W.x,W.y,W.radius)&&(!U||U(Ft))&&!Ia($,Ft.overlapMode))return O.push(!0),!0}}}_forEachCell(l,d,v,b,M,O,B,U){let W=this._convertToXCellCoord(l),Z=this._convertToYCellCoord(d),$=this._convertToXCellCoord(v),st=this._convertToYCellCoord(b);for(let At=W;At<=$;At++)for(let pt=Z;pt<=st;pt++)if(M.call(this,l,d,v,b,this.xCellCount*pt+At,O,B,U))return}_convertToXCellCoord(l){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(l*this.xScale)))}_convertToYCellCoord(l){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(l*this.yScale)))}_circlesCollide(l,d,v,b,M,O){let B=b-l,U=M-d,W=v+O;return W*W>B*B+U*U}_circleAndRectCollide(l,d,v,b,M,O,B){let U=(O-b)/2,W=Math.abs(l-(b+U));if(W>U+v)return!1;let Z=(B-M)/2,$=Math.abs(d-(M+Z));if($>Z+v)return!1;if(W<=U||$<=Z)return!0;let st=W-U,At=$-Z;return st*st+At*At<=v*v}}function ve(T,l,d,v,b){let M=n.Z();return l?(n.a0(M,M,[1/b,1/b,1]),d||n.ae(M,M,v.angle)):n.a1(M,v.labelPlaneMatrix,T),M}function jo(T,l,d,v,b){if(l){let M=n.af(T);return n.a0(M,M,[b,b,1]),d||n.ae(M,M,-v.angle),M}return v.glCoordMatrix}function gn(T,l,d){let v;d?(v=[T.x,T.y,d(T.x,T.y),1],n.ag(v,v,l)):(v=[T.x,T.y,0,1],vt(v,v,l));let b=v[3];return{point:new n.P(v[0]/b,v[1]/b),signedDistanceFromCamera:b}}function Ul(T,l){return .5+T/l*.5}function Ca(T,l){let d=T[0]/T[3],v=T[1]/T[3];return d>=-l[0]&&d<=l[0]&&v>=-l[1]&&v<=l[1]}function Te(T,l,d,v,b,M,O,B,U,W){let Z=v?T.textSizeData:T.iconSizeData,$=n.ah(Z,d.transform.zoom),st=[256/d.width*2+1,256/d.height*2+1],At=v?T.text.dynamicLayoutVertexArray:T.icon.dynamicLayoutVertexArray;At.clear();let pt=T.lineVertexArray,yt=v?T.text.placedSymbolArray:T.icon.placedSymbolArray,dt=d.transform.width/d.transform.height,Ft=!1;for(let Ht=0;HtMath.abs(d.x-l.x)*v?{useVertical:!0}:(T===n.ai.vertical?l.yd.x)?{needsFlipping:!0}:null}function Us(T,l,d,v,b,M,O,B,U,W,Z,$,st,At,pt,yt){let dt=l/24,Ft=T.lineOffsetX*dt,Ht=T.lineOffsetY*dt,St;if(T.numGlyphs>1){let Bt=T.glyphStartIndex+T.numGlyphs,Qt=T.lineStartIndex,$t=T.lineStartIndex+T.lineLength,oe=Dr(dt,B,Ft,Ht,d,Z,$,T,U,M,st,pt,yt);if(!oe)return{notEnoughRoom:!0};let pe=gn(oe.first.point,O,yt).point,he=gn(oe.last.point,O,yt).point;if(v&&!d){let be=gr(T.writingMode,pe,he,At);if(be)return be}St=[oe.first];for(let be=T.glyphStartIndex+1;be0?pe.point:La($,oe,Qt,1,b,yt),be=gr(T.writingMode,Qt,he,At);if(be)return be}let Bt=tt(dt*B.getoffsetX(T.glyphStartIndex),Ft,Ht,d,Z,$,T.segment,T.lineStartIndex,T.lineStartIndex+T.lineLength,U,M,st,pt,yt);if(!Bt)return{notEnoughRoom:!0};St=[Bt]}for(let Bt of St)n.ak(W,Bt.point,Bt.angle);return{}}function La(T,l,d,v,b,M){let O=gn(T.add(T.sub(l)._unit()),b,M).point,B=d.sub(O);return d.add(B._mult(v/B.mag()))}function Mr(T,l){let{projectionCache:d,lineVertexArray:v,labelPlaneMatrix:b,tileAnchorPoint:M,distanceFromAnchor:O,getElevation:B,previousVertex:U,direction:W,absOffsetX:Z}=l;if(d.projections[T])return d.projections[T];let $=new n.P(v.getx(T),v.gety(T)),st=gn($,b,B);if(st.signedDistanceFromCamera>0)return d.projections[T]=st.point,st.point;let At=T-W;return La(O===0?M:new n.P(v.getx(At),v.gety(At)),$,U,Z-O+1,b,B)}function sa(T,l,d){return T._unit()._perp()._mult(l*d)}function gt(T,l,d,v,b,M,O,B){let{projectionCache:U,direction:W}=B;if(U.offsets[T])return U.offsets[T];let Z=d.add(l);if(T+W=b)return U.offsets[T]=Z,Z;let $=Mr(T+W,B),st=sa($.sub(d),O,W),At=d.add(st),pt=$.add(st);return U.offsets[T]=n.al(M,Z,At,pt)||Z,U.offsets[T]}function tt(T,l,d,v,b,M,O,B,U,W,Z,$,st,At){let pt=v?T-l:T+l,yt=pt>0?1:-1,dt=0;v&&(yt*=-1,dt=Math.PI),yt<0&&(dt+=Math.PI);let Ft,Ht,St=yt>0?B+O:B+O+1,Bt=b,Qt=b,$t=0,oe=0,pe=Math.abs(pt),he=[],be;for(;$t+oe<=pe;){if(St+=yt,St=U)return null;$t+=oe,Qt=Bt,Ht=Ft;let Ee={projectionCache:$,lineVertexArray:W,labelPlaneMatrix:Z,tileAnchorPoint:M,distanceFromAnchor:$t,getElevation:At,previousVertex:Qt,direction:yt,absOffsetX:pe};if(Bt=Mr(St,Ee),d===0)he.push(Qt),be=Bt.sub(Qt);else{let pr,tr=Bt.sub(Qt);pr=tr.mag()===0?sa(Mr(St+yt,Ee).sub(Bt),d,yt):sa(tr,d,yt),Ht||(Ht=Qt.add(pr)),Ft=gt(St,pr,Bt,B,U,Ht,d,Ee),he.push(Ht),be=Ft.sub(Ht)}oe=be.mag()}let Ze=be._mult((pe-$t)/oe)._add(Ht||Qt),Kr=dt+Math.atan2(Bt.y-Qt.y,Bt.x-Qt.x);return he.push(Ze),{point:Ze,angle:st?Kr:0,path:he}}let nt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ht(T,l){for(let d=0;d=1;Vr--)tr.push(Ee.path[Vr]);for(let Vr=1;Vrgn(ei,U,pt));tr=Vr.some(ei=>ei.signedDistanceFromCamera<=0)?[]:Vr.map(ei=>ei.point)}let Jr=[];if(tr.length>0){let Vr=tr[0].clone(),ei=tr[0].clone();for(let On=1;On=be.x&&ei.x<=Ze.x&&Vr.y>=be.y&&ei.y<=Ze.y?[tr]:ei.xZe.x||ei.yZe.y?[]:n.am([tr],be.x,be.y,Ze.x,Ze.y)}for(let Vr of Jr){Kr.reset(Vr,.25*he);let ei=0;ei=Kr.length<=.5*he?1:Math.ceil(Kr.paddedLength/Gi)+1;for(let On=0;On=this.screenRightBoundary||bthis.screenBottomBoundary}isInsideGrid(l,d,v,b){return v>=0&&l=0&&dv.collisionGroupID===d}}return this.collisionGroups[l]}}function vr(T,l,d,v,b){let{horizontalAlign:M,verticalAlign:O}=n.au(T);return new n.P(-(M-.5)*l+v[0]*b,-(O-.5)*d+v[1]*b)}function Xe(T,l,d,v,b,M){let{x1:O,x2:B,y1:U,y2:W,anchorPointX:Z,anchorPointY:$}=T,st=new n.P(l,d);return v&&st._rotate(b?M:-M),{x1:O+st.x,y1:U+st.y,x2:B+st.x,y2:W+st.y,anchorPointX:Z,anchorPointY:$}}class cr{constructor(l,d,v,b,M){this.transform=l.clone(),this.terrain=d,this.collisionIndex=new _t(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=v,this.retainedQueryData={},this.collisionGroups=new lr(b),this.collisionCircleArrays={},this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(l,d,v,b){let M=v.getBucket(d),O=v.latestFeatureIndex;if(!M||!O||d.id!==M.layerIds[0])return;let B=v.collisionBoxArray,U=M.layers[0].layout,W=Math.pow(2,this.transform.zoom-v.tileID.overscaledZ),Z=v.tileSize/n.N,$=this.transform.calculatePosMatrix(v.tileID.toUnwrapped()),st=U.get(\"text-pitch-alignment\")===\"map\",At=U.get(\"text-rotation-alignment\")===\"map\",pt=Dt(v,1,this.transform.zoom),yt=ve($,st,At,this.transform,pt),dt=null;if(st){let Ht=jo($,st,At,this.transform,pt);dt=n.a1([],this.transform.labelPlaneMatrix,Ht)}this.retainedQueryData[M.bucketInstanceId]=new ae(M.bucketInstanceId,O,M.sourceLayerIndex,M.index,v.tileID);let Ft={bucket:M,layout:U,posMatrix:$,textLabelPlaneMatrix:yt,labelToScreenMatrix:dt,scale:W,textPixelRatio:Z,holdingForFade:v.holdingForFade(),collisionBoxArray:B,partiallyEvaluatedTextSize:n.ah(M.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(M.sourceID)};if(b)for(let Ht of M.sortKeyRanges){let{sortKey:St,symbolInstanceStart:Bt,symbolInstanceEnd:Qt}=Ht;l.push({sortKey:St,symbolInstanceStart:Bt,symbolInstanceEnd:Qt,parameters:Ft})}else l.push({symbolInstanceStart:0,symbolInstanceEnd:M.symbolInstances.length,parameters:Ft})}attemptAnchorPlacement(l,d,v,b,M,O,B,U,W,Z,$,st,At,pt,yt,dt){let Ft=n.aq[l.textAnchor],Ht=[l.textOffset0,l.textOffset1],St=vr(Ft,v,b,Ht,M),Bt=this.collisionIndex.placeCollisionBox(Xe(d,St.x,St.y,O,B,this.transform.angle),$,U,W,Z.predicate,dt);if((!yt||this.collisionIndex.placeCollisionBox(Xe(yt,St.x,St.y,O,B,this.transform.angle),$,U,W,Z.predicate,dt).box.length!==0)&&Bt.box.length>0){let Qt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[st.crossTileID]&&this.prevPlacement.placements[st.crossTileID]&&this.prevPlacement.placements[st.crossTileID].text&&(Qt=this.prevPlacement.variableOffsets[st.crossTileID].anchor),st.crossTileID===0)throw new Error(\"symbolInstance.crossTileID can't be 0\");return this.variableOffsets[st.crossTileID]={textOffset:Ht,width:v,height:b,anchor:Ft,textBoxScale:M,prevAnchor:Qt},this.markUsedJustification(At,Ft,st,pt),At.allowVerticalPlacement&&(this.markUsedOrientation(At,pt,st),this.placedOrientations[st.crossTileID]=pt),{shift:St,placedGlyphBoxes:Bt}}}placeLayerBucketPart(l,d,v){let{bucket:b,layout:M,posMatrix:O,textLabelPlaneMatrix:B,labelToScreenMatrix:U,textPixelRatio:W,holdingForFade:Z,collisionBoxArray:$,partiallyEvaluatedTextSize:st,collisionGroup:At}=l.parameters,pt=M.get(\"text-optional\"),yt=M.get(\"icon-optional\"),dt=n.ar(M,\"text-overlap\",\"text-allow-overlap\"),Ft=dt===\"always\",Ht=n.ar(M,\"icon-overlap\",\"icon-allow-overlap\"),St=Ht===\"always\",Bt=M.get(\"text-rotation-alignment\")===\"map\",Qt=M.get(\"text-pitch-alignment\")===\"map\",$t=M.get(\"icon-text-fit\")!==\"none\",oe=M.get(\"symbol-z-order\")===\"viewport-y\",pe=Ft&&(St||!b.hasIconData()||yt),he=St&&(Ft||!b.hasTextData()||pt);!b.collisionArrays&&$&&b.deserializeCollisionBoxes($);let be=this.retainedQueryData[b.bucketInstanceId].tileID,Ze=this.terrain?(Ee,pr)=>this.terrain.getElevation(be,Ee,pr):null,Kr=(Ee,pr)=>{var tr,Gi;if(d[Ee.crossTileID])return;if(Z)return void(this.placements[Ee.crossTileID]=new ie(!1,!1,!1));let Jr=!1,Vr=!1,ei=!0,On=null,tn={box:null,offscreen:null},Gs={box:null,offscreen:null},hs=null,Bn=null,qo=null,jr=0,ql=0,Zl=0;pr.textFeatureIndex?jr=pr.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(jr=Ee.featureIndex),pr.verticalTextFeatureIndex&&(ql=pr.verticalTextFeatureIndex);let yu=pr.textBox;if(yu){let Ws=Fn=>{let fs=n.ai.horizontal;if(b.allowVerticalPlacement&&!Fn&&this.prevPlacement){let Zo=this.prevPlacement.placedOrientations[Ee.crossTileID];Zo&&(this.placedOrientations[Ee.crossTileID]=Zo,fs=Zo,this.markUsedOrientation(b,fs,Ee))}return fs},Ps=(Fn,fs)=>{if(b.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&pr.verticalTextBox){for(let Zo of b.writingModes)if(Zo===n.ai.vertical?(tn=fs(),Gs=tn):tn=Fn(),tn&&tn.box&&tn.box.length)break}else tn=Fn()},Eo=Ee.textAnchorOffsetStartIndex,yh=Ee.textAnchorOffsetEndIndex;if(yh===Eo){let Fn=(fs,Zo)=>{let _n=this.collisionIndex.placeCollisionBox(fs,dt,W,O,At.predicate,Ze);return _n&&_n.box&&_n.box.length&&(this.markUsedOrientation(b,Zo,Ee),this.placedOrientations[Ee.crossTileID]=Zo),_n};Ps(()=>Fn(yu,n.ai.horizontal),()=>{let fs=pr.verticalTextBox;return b.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&fs?Fn(fs,n.ai.vertical):{box:null,offscreen:null}}),Ws(tn&&tn.box&&tn.box.length)}else{let Fn=n.aq[(Gi=(tr=this.prevPlacement)===null||tr===void 0?void 0:tr.variableOffsets[Ee.crossTileID])===null||Gi===void 0?void 0:Gi.anchor],fs=(_n,ho,Gr)=>{let Ua=_n.x2-_n.x1,S_=_n.y2-_n.y1,zd=Ee.textBoxScale,cA=$t&&Ht===\"never\"?ho:null,Yl={box:[],offscreen:!1},Yo=dt===\"never\"?1:2,me=\"never\";Fn&&Yo++;for(let ke=0;kefs(yu,pr.iconBox,n.ai.horizontal),()=>{let _n=pr.verticalTextBox;return b.allowVerticalPlacement&&!(tn&&tn.box&&tn.box.length)&&Ee.numVerticalGlyphVertices>0&&_n?fs(_n,pr.verticalIconBox,n.ai.vertical):{box:null,offscreen:null}}),tn&&(Jr=tn.box,ei=tn.offscreen);let Zo=Ws(tn&&tn.box);if(!Jr&&this.prevPlacement){let _n=this.prevPlacement.variableOffsets[Ee.crossTileID];_n&&(this.variableOffsets[Ee.crossTileID]=_n,this.markUsedJustification(b,_n.anchor,Ee,Zo))}}}if(hs=tn,Jr=hs&&hs.box&&hs.box.length>0,ei=hs&&hs.offscreen,Ee.useRuntimeCollisionCircles){let Ws=b.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),Ps=n.aj(b.textSizeData,st,Ws),Eo=M.get(\"text-padding\");Bn=this.collisionIndex.placeCollisionCircles(dt,Ws,b.lineVertexArray,b.glyphOffsetArray,Ps,O,B,U,v,Qt,At.predicate,Ee.collisionCircleDiameter,Eo,Ze),Bn.circles.length&&Bn.collisionDetected&&!v&&n.w(\"Collisions detected, but collision boxes are not shown\"),Jr=Ft||Bn.circles.length>0&&!Bn.collisionDetected,ei=ei&&Bn.offscreen}if(pr.iconFeatureIndex&&(Zl=pr.iconFeatureIndex),pr.iconBox){let Ws=Ps=>{let Eo=$t&&On?Xe(Ps,On.x,On.y,Bt,Qt,this.transform.angle):Ps;return this.collisionIndex.placeCollisionBox(Eo,Ht,W,O,At.predicate,Ze)};Gs&&Gs.box&&Gs.box.length&&pr.verticalIconBox?(qo=Ws(pr.verticalIconBox),Vr=qo.box.length>0):(qo=Ws(pr.iconBox),Vr=qo.box.length>0),ei=ei&&qo.offscreen}let vu=pt||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,_h=yt||Ee.numIconVertices===0;if(vu||_h?_h?vu||(Vr=Vr&&Jr):Jr=Vr&&Jr:Vr=Jr=Vr&&Jr,Jr&&hs&&hs.box&&this.collisionIndex.insertCollisionBox(hs.box,dt,M.get(\"text-ignore-placement\"),b.bucketInstanceId,Gs&&Gs.box&&ql?ql:jr,At.ID),Vr&&qo&&this.collisionIndex.insertCollisionBox(qo.box,Ht,M.get(\"icon-ignore-placement\"),b.bucketInstanceId,Zl,At.ID),Bn&&(Jr&&this.collisionIndex.insertCollisionCircles(Bn.circles,dt,M.get(\"text-ignore-placement\"),b.bucketInstanceId,jr,At.ID),v)){let Ws=b.bucketInstanceId,Ps=this.collisionCircleArrays[Ws];Ps===void 0&&(Ps=this.collisionCircleArrays[Ws]=new se);for(let Eo=0;Eo=0;--pr){let tr=Ee[pr];Kr(b.symbolInstances.get(tr),b.collisionArrays[tr])}}else for(let Ee=l.symbolInstanceStart;Ee=0&&(l.text.placedSymbolArray.get(B).crossTileID=M>=0&&B!==M?0:v.crossTileID)}markUsedOrientation(l,d,v){let b=d===n.ai.horizontal||d===n.ai.horizontalOnly?d:0,M=d===n.ai.vertical?d:0,O=[v.leftJustifiedTextSymbolIndex,v.centerJustifiedTextSymbolIndex,v.rightJustifiedTextSymbolIndex];for(let B of O)l.text.placedSymbolArray.get(B).placedOrientation=b;v.verticalPlacedTextSymbolIndex&&(l.text.placedSymbolArray.get(v.verticalPlacedTextSymbolIndex).placedOrientation=M)}commit(l){this.commitTime=l,this.zoomAtLastRecencyCheck=this.transform.zoom;let d=this.prevPlacement,v=!1;this.prevZoomAdjustment=d?d.zoomAdjustment(this.transform.zoom):0;let b=d?d.symbolFadeChange(l):1,M=d?d.opacities:{},O=d?d.variableOffsets:{},B=d?d.placedOrientations:{};for(let U in this.placements){let W=this.placements[U],Z=M[U];Z?(this.opacities[U]=new Vt(Z,b,W.text,W.icon),v=v||W.text!==Z.text.placed||W.icon!==Z.icon.placed):(this.opacities[U]=new Vt(null,b,W.text,W.icon,W.skipFade),v=v||W.text||W.icon)}for(let U in M){let W=M[U];if(!this.opacities[U]){let Z=new Vt(W,b,!1,!1);Z.isHidden()||(this.opacities[U]=Z,v=v||W.text.placed||W.icon.placed)}}for(let U in O)this.variableOffsets[U]||!this.opacities[U]||this.opacities[U].isHidden()||(this.variableOffsets[U]=O[U]);for(let U in B)this.placedOrientations[U]||!this.opacities[U]||this.opacities[U].isHidden()||(this.placedOrientations[U]=B[U]);if(d&&d.lastPlacementChangeTime===void 0)throw new Error(\"Last placement time for previous placement is not defined\");v?this.lastPlacementChangeTime=l:typeof this.lastPlacementChangeTime!=\"number\"&&(this.lastPlacementChangeTime=d?d.lastPlacementChangeTime:l)}updateLayerOpacities(l,d){let v={};for(let b of d){let M=b.getBucket(l);M&&b.latestFeatureIndex&&l.id===M.layerIds[0]&&this.updateBucketOpacities(M,v,b.collisionBoxArray)}}updateBucketOpacities(l,d,v){l.hasTextData()&&(l.text.opacityVertexArray.clear(),l.text.hasVisibleVertices=!1),l.hasIconData()&&(l.icon.opacityVertexArray.clear(),l.icon.hasVisibleVertices=!1),l.hasIconCollisionBoxData()&&l.iconCollisionBox.collisionVertexArray.clear(),l.hasTextCollisionBoxData()&&l.textCollisionBox.collisionVertexArray.clear();let b=l.layers[0],M=b.layout,O=new Vt(null,0,!1,!1,!0),B=M.get(\"text-allow-overlap\"),U=M.get(\"icon-allow-overlap\"),W=b._unevaluatedLayout.hasValue(\"text-variable-anchor\")||b._unevaluatedLayout.hasValue(\"text-variable-anchor-offset\"),Z=M.get(\"text-rotation-alignment\")===\"map\",$=M.get(\"text-pitch-alignment\")===\"map\",st=M.get(\"icon-text-fit\")!==\"none\",At=new Vt(null,0,B&&(U||!l.hasIconData()||M.get(\"icon-optional\")),U&&(B||!l.hasTextData()||M.get(\"text-optional\")),!0);!l.collisionArrays&&v&&(l.hasIconCollisionBoxData()||l.hasTextCollisionBoxData())&&l.deserializeCollisionBoxes(v);let pt=(yt,dt,Ft)=>{for(let Ht=0;Ht

0,$t=this.placedOrientations[dt.crossTileID],oe=$t===n.ai.vertical,pe=$t===n.ai.horizontal||$t===n.ai.horizontalOnly;if(Ft>0||Ht>0){let he=es(Bt.text);pt(l.text,Ft,oe?oa:he),pt(l.text,Ht,pe?oa:he);let be=Bt.text.isHidden();[dt.rightJustifiedTextSymbolIndex,dt.centerJustifiedTextSymbolIndex,dt.leftJustifiedTextSymbolIndex].forEach(Ee=>{Ee>=0&&(l.text.placedSymbolArray.get(Ee).hidden=be||oe?1:0)}),dt.verticalPlacedTextSymbolIndex>=0&&(l.text.placedSymbolArray.get(dt.verticalPlacedTextSymbolIndex).hidden=be||pe?1:0);let Ze=this.variableOffsets[dt.crossTileID];Ze&&this.markUsedJustification(l,Ze.anchor,dt,$t);let Kr=this.placedOrientations[dt.crossTileID];Kr&&(this.markUsedJustification(l,\"left\",dt,Kr),this.markUsedOrientation(l,Kr,dt))}if(Qt){let he=es(Bt.icon),be=!(st&&dt.verticalPlacedIconSymbolIndex&&oe);dt.placedIconSymbolIndex>=0&&(pt(l.icon,dt.numIconVertices,be?he:oa),l.icon.placedSymbolArray.get(dt.placedIconSymbolIndex).hidden=Bt.icon.isHidden()),dt.verticalPlacedIconSymbolIndex>=0&&(pt(l.icon,dt.numVerticalIconVertices,be?oa:he),l.icon.placedSymbolArray.get(dt.verticalPlacedIconSymbolIndex).hidden=Bt.icon.isHidden())}if(l.hasIconCollisionBoxData()||l.hasTextCollisionBoxData()){let he=l.collisionArrays[yt];if(he){let be=new n.P(0,0);if(he.textBox||he.verticalTextBox){let Kr=!0;if(W){let Ee=this.variableOffsets[St];Ee?(be=vr(Ee.anchor,Ee.width,Ee.height,Ee.textOffset,Ee.textBoxScale),Z&&be._rotate($?this.transform.angle:-this.transform.angle)):Kr=!1}he.textBox&&wr(l.textCollisionBox.collisionVertexArray,Bt.text.placed,!Kr||oe,be.x,be.y),he.verticalTextBox&&wr(l.textCollisionBox.collisionVertexArray,Bt.text.placed,!Kr||pe,be.x,be.y)}let Ze=!!(!pe&&he.verticalIconBox);he.iconBox&&wr(l.iconCollisionBox.collisionVertexArray,Bt.icon.placed,Ze,st?be.x:0,st?be.y:0),he.verticalIconBox&&wr(l.iconCollisionBox.collisionVertexArray,Bt.icon.placed,!Ze,st?be.x:0,st?be.y:0)}}}if(l.sortFeatures(this.transform.angle),this.retainedQueryData[l.bucketInstanceId]&&(this.retainedQueryData[l.bucketInstanceId].featureSortOrder=l.featureSortOrder),l.hasTextData()&&l.text.opacityVertexBuffer&&l.text.opacityVertexBuffer.updateData(l.text.opacityVertexArray),l.hasIconData()&&l.icon.opacityVertexBuffer&&l.icon.opacityVertexBuffer.updateData(l.icon.opacityVertexArray),l.hasIconCollisionBoxData()&&l.iconCollisionBox.collisionVertexBuffer&&l.iconCollisionBox.collisionVertexBuffer.updateData(l.iconCollisionBox.collisionVertexArray),l.hasTextCollisionBoxData()&&l.textCollisionBox.collisionVertexBuffer&&l.textCollisionBox.collisionVertexBuffer.updateData(l.textCollisionBox.collisionVertexArray),l.text.opacityVertexArray.length!==l.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${l.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${l.text.layoutVertexArray.length}) / 4`);if(l.icon.opacityVertexArray.length!==l.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${l.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${l.icon.layoutVertexArray.length}) / 4`);if(l.bucketInstanceId in this.collisionCircleArrays){let yt=this.collisionCircleArrays[l.bucketInstanceId];l.placementInvProjMatrix=yt.invProjMatrix,l.placementViewportMatrix=yt.viewportMatrix,l.collisionCircleArray=yt.circles,delete this.collisionCircleArrays[l.bucketInstanceId]}}symbolFadeChange(l){return this.fadeDuration===0?1:(l-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(l){return Math.max(0,(this.transform.zoom-l)/1.5)}hasTransitions(l){return this.stale||l-this.lastPlacementChangeTimel}setStale(){this.stale=!0}}function wr(T,l,d,v,b){T.emplaceBack(l?1:0,d?1:0,v||0,b||0),T.emplaceBack(l?1:0,d?1:0,v||0,b||0),T.emplaceBack(l?1:0,d?1:0,v||0,b||0),T.emplaceBack(l?1:0,d?1:0,v||0,b||0)}let xi=Math.pow(2,25),zi=Math.pow(2,24),ni=Math.pow(2,17),Hr=Math.pow(2,16),jn=Math.pow(2,9),Bi=Math.pow(2,8),xn=Math.pow(2,1);function es(T){if(T.opacity===0&&!T.placed)return 0;if(T.opacity===1&&T.placed)return 4294967295;let l=T.placed?1:0,d=Math.floor(127*T.opacity);return d*xi+l*zi+d*ni+l*Hr+d*jn+l*Bi+d*xn+l}let oa=0;class Um{constructor(l){this._sortAcrossTiles=l.layout.get(\"symbol-z-order\")!==\"viewport-y\"&&!l.layout.get(\"symbol-sort-key\").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(l,d,v,b,M){let O=this._bucketParts;for(;this._currentTileIndexB.sortKey-U.sortKey));this._currentPartIndex!this._forceFullPlacement&&n.h.now()-b>2;for(;this._currentPlacementIndex>=0;){let O=d[l[this._currentPlacementIndex]],B=this.placement.collisionIndex.transform.zoom;if(O.type===\"symbol\"&&(!O.minzoom||O.minzoom<=B)&&(!O.maxzoom||O.maxzoom>B)){if(this._inProgressLayer||(this._inProgressLayer=new Um(O)),this._inProgressLayer.continuePlacement(v[O.source],this.placement,this._showCollisionBoxes,O,M))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(l){return this.placement.commit(l),this.placement}}let Ss=512/n.N/2;class nh{constructor(l,d,v){this.tileID=l,this.bucketInstanceId=v,this._symbolsByKey={};let b=new Map;for(let M=0;M({x:Math.floor(U.anchorX*Ss),y:Math.floor(U.anchorY*Ss)})),crossTileIDs:O.map(U=>U.crossTileID)};if(B.positions.length>128){let U=new n.av(B.positions.length,16,Uint16Array);for(let{x:W,y:Z}of B.positions)U.add(W,Z);U.finish(),delete B.positions,B.index=U}this._symbolsByKey[M]=B}}getScaledCoordinates(l,d){let{x:v,y:b,z:M}=this.tileID.canonical,{x:O,y:B,z:U}=d.canonical,W=Ss/Math.pow(2,U-M),Z=(B*n.N+l.anchorY)*W,$=b*n.N*Ss;return{x:Math.floor((O*n.N+l.anchorX)*W-v*n.N*Ss),y:Math.floor(Z-$)}}findMatches(l,d,v){let b=this.tileID.canonical.zl)}}class ai{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ka{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(l){let d=Math.round((l-this.lng)/360);if(d!==0)for(let v in this.indexes){let b=this.indexes[v],M={};for(let O in b){let B=b[O];B.tileID=B.tileID.unwrapTo(B.tileID.wrap+d),M[B.tileID.key]=B}this.indexes[v]=M}this.lng=l}addBucket(l,d,v){if(this.indexes[l.overscaledZ]&&this.indexes[l.overscaledZ][l.key]){if(this.indexes[l.overscaledZ][l.key].bucketInstanceId===d.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(l.overscaledZ,this.indexes[l.overscaledZ][l.key])}for(let M=0;Ml.overscaledZ)for(let B in O){let U=O[B];U.tileID.isChildOf(l)&&U.findMatches(d.symbolInstances,l,b)}else{let B=O[l.scaledTo(Number(M)).key];B&&B.findMatches(d.symbolInstances,l,b)}}for(let M=0;M{d[v]=!0});for(let v in this.layerIndexes)d[v]||delete this.layerIndexes[v]}}let ln=(T,l)=>n.x(T,l&&l.filter(d=>d.identifier!==\"source.canvas\")),Dn=n.F(n.ax,[\"addLayer\",\"removeLayer\",\"setPaintProperty\",\"setLayoutProperty\",\"setFilter\",\"addSource\",\"removeSource\",\"setLayerZoomRange\",\"setLight\",\"setTransition\",\"setGeoJSONSourceData\",\"setGlyphs\",\"setSprite\"]),Vm=n.F(n.ax,[\"setCenter\",\"setZoom\",\"setBearing\",\"setPitch\"]),Go=n.aw();class Gn extends n.E{constructor(l,d={}){super(),this.map=l,this.dispatcher=new ih(bo(),this,l._getMapId()),this.imageManager=new ue,this.imageManager.setEventedParent(this),this.glyphManager=new Sr(l._requestManager,d.localIdeographFontFamily),this.lineAtlas=new No(256,512),this.crossTileSymbolIndex=new Dc,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new n.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast(\"setReferrer\",n.az());let v=this;this._rtlTextPluginCallback=Gn.registerForPluginStateChange(b=>{v.dispatcher.broadcast(\"syncRTLPluginState\",{pluginStatus:b.pluginStatus,pluginURL:b.pluginURL},(M,O)=>{if(n.aA(M),O&&O.every(B=>B))for(let B in v.sourceCaches){let U=v.sourceCaches[B].getSource().type;U!==\"vector\"&&U!==\"geojson\"||v.sourceCaches[B].reload()}})}),this.on(\"data\",b=>{if(b.dataType!==\"source\"||b.sourceDataType!==\"metadata\")return;let M=this.sourceCaches[b.sourceId];if(!M)return;let O=M.getSource();if(O&&O.vectorLayerIds)for(let B in this._layers){let U=this._layers[B];U.source===O.id&&this._validateLayer(U)}})}loadURL(l,d={},v){this.fire(new n.k(\"dataloading\",{dataType:\"style\"})),d.validate=typeof d.validate!=\"boolean\"||d.validate;let b=this.map._requestManager.transformRequest(l,Q.Style);this._request=n.f(b,(M,O)=>{this._request=null,M?this.fire(new n.j(M)):O&&this._load(O,d,v)})}loadJSON(l,d={},v){this.fire(new n.k(\"dataloading\",{dataType:\"style\"})),this._request=n.h.frame(()=>{this._request=null,d.validate=d.validate!==!1,this._load(l,d,v)})}loadEmpty(){this.fire(new n.k(\"dataloading\",{dataType:\"style\"})),this._load(Go,{validate:!1})}_load(l,d,v){var b;let M=d.transformStyle?d.transformStyle(v,l):l;if(!d.validate||!ln(this,n.y(M))){this._loaded=!0,this.stylesheet=M;for(let O in M.sources)this.addSource(O,M.sources[O],{validate:!1});M.sprite?this._loadSprite(M.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(M.glyphs),this._createLayers(),this.light=new zl(this.stylesheet.light),this.map.setTerrain((b=this.stylesheet.terrain)!==null&&b!==void 0?b:null),this.fire(new n.k(\"data\",{dataType:\"style\"})),this.fire(new n.k(\"style.load\"))}}_createLayers(){let l=n.aB(this.stylesheet.layers);this.dispatcher.broadcast(\"setLayers\",l),this._order=l.map(d=>d.id),this._layers={},this._serializedLayers=null;for(let d of l){let v=n.aC(d);v.setEventedParent(this,{layer:{id:d.id}}),this._layers[d.id]=v}}_loadSprite(l,d=!1,v=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(b,M,O,B){let U=kt(b),W=U.length,Z=O>1?\"@2x\":\"\",$={},st={},At={};for(let{id:pt,url:yt}of U){let dt=M.transformRequest(M.normalizeSpriteURL(yt,Z,\".json\"),Q.SpriteJSON),Ft=`${pt}_${dt.url}`;$[Ft]=n.f(dt,(Bt,Qt)=>{delete $[Ft],st[pt]=Qt,Xt(B,st,At,Bt,W)});let Ht=M.transformRequest(M.normalizeSpriteURL(yt,Z,\".png\"),Q.SpriteImage),St=`${pt}_${Ht.url}`;$[St]=j.getImage(Ht,(Bt,Qt)=>{delete $[St],At[pt]=Qt,Xt(B,st,At,Bt,W)})}return{cancel(){for(let pt of Object.values($))pt.cancel()}}}(l,this.map._requestManager,this.map.getPixelRatio(),(b,M)=>{if(this._spriteRequest=null,b)this.fire(new n.j(b));else if(M)for(let O in M){this._spritesImagesIds[O]=[];let B=this._spritesImagesIds[O]?this._spritesImagesIds[O].filter(U=>!(U in M)):[];for(let U of B)this.imageManager.removeImage(U),this._changedImages[U]=!0;for(let U in M[O]){let W=O===\"default\"?U:`${O}:${U}`;this._spritesImagesIds[O].push(W),W in this.imageManager.images?this.imageManager.updateImage(W,M[O][U],!1):this.imageManager.addImage(W,M[O][U]),d&&(this._changedImages[W]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),d&&(this._changed=!0),this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new n.k(\"data\",{dataType:\"style\"})),v&&v(b)})}_unloadSprite(){for(let l of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(l),this._changedImages[l]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new n.k(\"data\",{dataType:\"style\"}))}_validateLayer(l){let d=this.sourceCaches[l.source];if(!d)return;let v=l.sourceLayer;if(!v)return;let b=d.getSource();(b.type===\"geojson\"||b.vectorLayerIds&&b.vectorLayerIds.indexOf(v)===-1)&&this.fire(new n.j(new Error(`Source layer \"${v}\" does not exist on source \"${b.id}\" as specified by style layer \"${l.id}\".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let l in this.sourceCaches)if(!this.sourceCaches[l].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(l){let d=this._serializedAllLayers();if(!l||l.length===0)return Object.values(d);let v=[];for(let b of l)d[b]&&v.push(d[b]);return v}_serializedAllLayers(){let l=this._serializedLayers;if(l)return l;l=this._serializedLayers={};let d=Object.keys(this._layers);for(let v of d){let b=this._layers[v];b.type!==\"custom\"&&(l[v]=b.serialize())}return l}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(let l in this.sourceCaches)if(this.sourceCaches[l].hasTransition())return!0;for(let l in this._layers)if(this._layers[l].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error(\"Style is not done loading.\")}update(l){if(!this._loaded)return;let d=this._changed;if(this._changed){let b=Object.keys(this._updatedLayers),M=Object.keys(this._removedLayers);(b.length||M.length)&&this._updateWorkerLayers(b,M);for(let O in this._updatedSources){let B=this._updatedSources[O];if(B===\"reload\")this._reloadSource(O);else{if(B!==\"clear\")throw new Error(`Invalid action ${B}`);this._clearSource(O)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let O in this._updatedPaintProps)this._layers[O].updateTransitions(l);this.light.updateTransitions(l),this._resetUpdates()}let v={};for(let b in this.sourceCaches){let M=this.sourceCaches[b];v[b]=M.used,M.used=!1}for(let b of this._order){let M=this._layers[b];M.recalculate(l,this._availableImages),!M.isHidden(l.zoom)&&M.source&&(this.sourceCaches[M.source].used=!0)}for(let b in v){let M=this.sourceCaches[b];v[b]!==M.used&&M.fire(new n.k(\"data\",{sourceDataType:\"visibility\",dataType:\"source\",sourceId:b}))}this.light.recalculate(l),this.z=l.zoom,d&&this.fire(new n.k(\"data\",{dataType:\"style\"}))}_updateTilesForChangedImages(){let l=Object.keys(this._changedImages);if(l.length){for(let d in this.sourceCaches)this.sourceCaches[d].reloadTilesForDependencies([\"icons\",\"patterns\"],l);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let l in this.sourceCaches)this.sourceCaches[l].reloadTilesForDependencies([\"glyphs\"],[\"\"]);this._glyphsDidChange=!1}}_updateWorkerLayers(l,d){this.dispatcher.broadcast(\"updateLayers\",{layers:this._serializeByIds(l),removedIds:d})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(l,d={}){this._checkLoaded();let v=this.serialize();if(l=d.transformStyle?d.transformStyle(v,l):l,ln(this,n.y(l)))return!1;(l=n.aD(l)).layers=n.aB(l.layers);let b=n.aE(v,l).filter(O=>!(O.command in Vm));if(b.length===0)return!1;let M=b.filter(O=>!(O.command in Dn));if(M.length>0)throw new Error(`Unimplemented: ${M.map(O=>O.command).join(\", \")}.`);for(let O of b)O.command!==\"setTransition\"&&this[O.command].apply(this,O.args);return this.stylesheet=l,this._serializedLayers=null,!0}addImage(l,d){if(this.getImage(l))return this.fire(new n.j(new Error(`An image named \"${l}\" already exists.`)));this.imageManager.addImage(l,d),this._afterImageUpdated(l)}updateImage(l,d){this.imageManager.updateImage(l,d)}getImage(l){return this.imageManager.getImage(l)}removeImage(l){if(!this.getImage(l))return this.fire(new n.j(new Error(`An image named \"${l}\" does not exist.`)));this.imageManager.removeImage(l),this._afterImageUpdated(l)}_afterImageUpdated(l){this._availableImages=this.imageManager.listImages(),this._changedImages[l]=!0,this._changed=!0,this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new n.k(\"data\",{dataType:\"style\"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(l,d,v={}){if(this._checkLoaded(),this.sourceCaches[l]!==void 0)throw new Error(`Source \"${l}\" already exists.`);if(!d.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(d).join(\", \")}.`);if([\"vector\",\"raster\",\"geojson\",\"video\",\"image\"].indexOf(d.type)>=0&&this._validate(n.y.source,`sources.${l}`,d,null,v))return;this.map&&this.map._collectResourceTiming&&(d.collectResourceTiming=!0);let b=this.sourceCaches[l]=new ls(l,d,this.dispatcher);b.style=this,b.setEventedParent(this,()=>({isSourceLoaded:b.loaded(),source:b.serialize(),sourceId:l})),b.onAdd(this.map),this._changed=!0}removeSource(l){if(this._checkLoaded(),this.sourceCaches[l]===void 0)throw new Error(\"There is no source with this ID\");for(let v in this._layers)if(this._layers[v].source===l)return this.fire(new n.j(new Error(`Source \"${l}\" cannot be removed while layer \"${v}\" is using it.`)));let d=this.sourceCaches[l];delete this.sourceCaches[l],delete this._updatedSources[l],d.fire(new n.k(\"data\",{sourceDataType:\"metadata\",dataType:\"source\",sourceId:l})),d.setEventedParent(null),d.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(l,d){if(this._checkLoaded(),this.sourceCaches[l]===void 0)throw new Error(`There is no source with this ID=${l}`);let v=this.sourceCaches[l].getSource();if(v.type!==\"geojson\")throw new Error(`geojsonSource.type is ${v.type}, which is !== 'geojson`);v.setData(d),this._changed=!0}getSource(l){return this.sourceCaches[l]&&this.sourceCaches[l].getSource()}addLayer(l,d,v={}){this._checkLoaded();let b=l.id;if(this.getLayer(b))return void this.fire(new n.j(new Error(`Layer \"${b}\" already exists on this map.`)));let M;if(l.type===\"custom\"){if(ln(this,n.aF(l)))return;M=n.aC(l)}else{if(\"source\"in l&&typeof l.source==\"object\"&&(this.addSource(b,l.source),l=n.aD(l),l=n.e(l,{source:b})),this._validate(n.y.layer,`layers.${b}`,l,{arrayIndex:-1},v))return;M=n.aC(l),this._validateLayer(M),M.setEventedParent(this,{layer:{id:b}})}let O=d?this._order.indexOf(d):this._order.length;if(d&&O===-1)this.fire(new n.j(new Error(`Cannot add layer \"${b}\" before non-existing layer \"${d}\".`)));else{if(this._order.splice(O,0,b),this._layerOrderChanged=!0,this._layers[b]=M,this._removedLayers[b]&&M.source&&M.type!==\"custom\"){let B=this._removedLayers[b];delete this._removedLayers[b],B.type!==M.type?this._updatedSources[M.source]=\"clear\":(this._updatedSources[M.source]=\"reload\",this.sourceCaches[M.source].pause())}this._updateLayer(M),M.onAdd&&M.onAdd(this.map)}}moveLayer(l,d){if(this._checkLoaded(),this._changed=!0,!this._layers[l])return void this.fire(new n.j(new Error(`The layer '${l}' does not exist in the map's style and cannot be moved.`)));if(l===d)return;let v=this._order.indexOf(l);this._order.splice(v,1);let b=d?this._order.indexOf(d):this._order.length;d&&b===-1?this.fire(new n.j(new Error(`Cannot move layer \"${l}\" before non-existing layer \"${d}\".`))):(this._order.splice(b,0,l),this._layerOrderChanged=!0)}removeLayer(l){this._checkLoaded();let d=this._layers[l];if(!d)return void this.fire(new n.j(new Error(`Cannot remove non-existing layer \"${l}\".`)));d.setEventedParent(null);let v=this._order.indexOf(l);this._order.splice(v,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[l]=d,delete this._layers[l],this._serializedLayers&&delete this._serializedLayers[l],delete this._updatedLayers[l],delete this._updatedPaintProps[l],d.onRemove&&d.onRemove(this.map)}getLayer(l){return this._layers[l]}getLayersOrder(){return[...this._order]}hasLayer(l){return l in this._layers}setLayerZoomRange(l,d,v){this._checkLoaded();let b=this.getLayer(l);b?b.minzoom===d&&b.maxzoom===v||(d!=null&&(b.minzoom=d),v!=null&&(b.maxzoom=v),this._updateLayer(b)):this.fire(new n.j(new Error(`Cannot set the zoom range of non-existing layer \"${l}\".`)))}setFilter(l,d,v={}){this._checkLoaded();let b=this.getLayer(l);if(b){if(!n.aG(b.filter,d))return d==null?(b.filter=void 0,void this._updateLayer(b)):void(this._validate(n.y.filter,`layers.${b.id}.filter`,d,null,v)||(b.filter=n.aD(d),this._updateLayer(b)))}else this.fire(new n.j(new Error(`Cannot filter non-existing layer \"${l}\".`)))}getFilter(l){return n.aD(this.getLayer(l).filter)}setLayoutProperty(l,d,v,b={}){this._checkLoaded();let M=this.getLayer(l);M?n.aG(M.getLayoutProperty(d),v)||(M.setLayoutProperty(d,v,b),this._updateLayer(M)):this.fire(new n.j(new Error(`Cannot style non-existing layer \"${l}\".`)))}getLayoutProperty(l,d){let v=this.getLayer(l);if(v)return v.getLayoutProperty(d);this.fire(new n.j(new Error(`Cannot get style of non-existing layer \"${l}\".`)))}setPaintProperty(l,d,v,b={}){this._checkLoaded();let M=this.getLayer(l);M?n.aG(M.getPaintProperty(d),v)||(M.setPaintProperty(d,v,b)&&this._updateLayer(M),this._changed=!0,this._updatedPaintProps[l]=!0):this.fire(new n.j(new Error(`Cannot style non-existing layer \"${l}\".`)))}getPaintProperty(l,d){return this.getLayer(l).getPaintProperty(d)}setFeatureState(l,d){this._checkLoaded();let v=l.source,b=l.sourceLayer,M=this.sourceCaches[v];if(M===void 0)return void this.fire(new n.j(new Error(`The source '${v}' does not exist in the map's style.`)));let O=M.getSource().type;O===\"geojson\"&&b?this.fire(new n.j(new Error(\"GeoJSON sources cannot have a sourceLayer parameter.\"))):O!==\"vector\"||b?(l.id===void 0&&this.fire(new n.j(new Error(\"The feature id parameter must be provided.\"))),M.setFeatureState(b,l.id,d)):this.fire(new n.j(new Error(\"The sourceLayer parameter must be provided for vector source types.\")))}removeFeatureState(l,d){this._checkLoaded();let v=l.source,b=this.sourceCaches[v];if(b===void 0)return void this.fire(new n.j(new Error(`The source '${v}' does not exist in the map's style.`)));let M=b.getSource().type,O=M===\"vector\"?l.sourceLayer:void 0;M!==\"vector\"||O?d&&typeof l.id!=\"string\"&&typeof l.id!=\"number\"?this.fire(new n.j(new Error(\"A feature id is required to remove its specific state property.\"))):b.removeFeatureState(O,l.id,d):this.fire(new n.j(new Error(\"The sourceLayer parameter must be provided for vector source types.\")))}getFeatureState(l){this._checkLoaded();let d=l.source,v=l.sourceLayer,b=this.sourceCaches[d];if(b!==void 0)return b.getSource().type!==\"vector\"||v?(l.id===void 0&&this.fire(new n.j(new Error(\"The feature id parameter must be provided.\"))),b.getFeatureState(v,l.id)):void this.fire(new n.j(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));this.fire(new n.j(new Error(`The source '${d}' does not exist in the map's style.`)))}getTransition(){return n.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let l=n.aH(this.sourceCaches,M=>M.serialize()),d=this._serializeByIds(this._order),v=this.map.getTerrain()||void 0,b=this.stylesheet;return n.aI({version:b.version,name:b.name,metadata:b.metadata,light:b.light,center:b.center,zoom:b.zoom,bearing:b.bearing,pitch:b.pitch,sprite:b.sprite,glyphs:b.glyphs,transition:b.transition,sources:l,layers:d,terrain:v},M=>M!==void 0)}_updateLayer(l){this._updatedLayers[l.id]=!0,l.source&&!this._updatedSources[l.source]&&this.sourceCaches[l.source].getSource().type!==\"raster\"&&(this._updatedSources[l.source]=\"reload\",this.sourceCaches[l.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(l){let d=O=>this._layers[O].type===\"fill-extrusion\",v={},b=[];for(let O=this._order.length-1;O>=0;O--){let B=this._order[O];if(d(B)){v[B]=O;for(let U of l){let W=U[B];if(W)for(let Z of W)b.push(Z)}}}b.sort((O,B)=>B.intersectionZ-O.intersectionZ);let M=[];for(let O=this._order.length-1;O>=0;O--){let B=this._order[O];if(d(B))for(let U=b.length-1;U>=0;U--){let W=b[U].feature;if(v[W.layer.id]{let pe=Ft.featureSortOrder;if(pe){let he=pe.indexOf($t.featureIndex);return pe.indexOf(oe.featureIndex)-he}return oe.featureIndex-$t.featureIndex});for(let $t of Qt)Bt.push($t)}}for(let Ft in pt)pt[Ft].forEach(Ht=>{let St=Ht.feature,Bt=W[B[Ft].source].getFeatureState(St.layer[\"source-layer\"],St.id);St.source=St.layer.source,St.layer[\"source-layer\"]&&(St.sourceLayer=St.layer[\"source-layer\"]),St.state=Bt});return pt}(this._layers,O,this.sourceCaches,l,d,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(M)}querySourceFeatures(l,d){d&&d.filter&&this._validate(n.y.filter,\"querySourceFeatures.filter\",d.filter,null,d);let v=this.sourceCaches[l];return v?function(b,M){let O=b.getRenderableIds().map(W=>b.getTileByID(W)),B=[],U={};for(let W=0;W{cl[b]=M})(l,d),d.workerSourceURL?void this.dispatcher.broadcast(\"loadWorkerSource\",{name:l,url:d.workerSourceURL},v):v(null,null))}getLight(){return this.light.getLight()}setLight(l,d={}){this._checkLoaded();let v=this.light.getLight(),b=!1;for(let O in l)if(!n.aG(l[O],v[O])){b=!0;break}if(!b)return;let M={now:n.h.now(),transition:n.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(l,d),this.light.updateTransitions(M)}_validate(l,d,v,b,M={}){return(!M||M.validate!==!1)&&ln(this,l.call(n.y,n.e({key:d,style:this.serialize(),value:v,styleSpec:n.v},b)))}_remove(l=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),n.aJ.off(\"pluginStateChange\",this._rtlTextPluginCallback);for(let d in this._layers)this._layers[d].setEventedParent(null);for(let d in this.sourceCaches){let v=this.sourceCaches[d];v.setEventedParent(null),v.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(l)}_clearSource(l){this.sourceCaches[l].clearTiles()}_reloadSource(l){this.sourceCaches[l].resume(),this.sourceCaches[l].reload()}_updateSources(l){for(let d in this.sourceCaches)this.sourceCaches[d].update(l,this.map.terrain)}_generateCollisionBoxes(){for(let l in this.sourceCaches)this._reloadSource(l)}_updatePlacement(l,d,v,b,M=!1){let O=!1,B=!1,U={};for(let W of this._order){let Z=this._layers[W];if(Z.type!==\"symbol\")continue;if(!U[Z.source]){let st=this.sourceCaches[Z.source];U[Z.source]=st.getRenderableIds(!0).map(At=>st.getTileByID(At)).sort((At,pt)=>pt.tileID.overscaledZ-At.tileID.overscaledZ||(At.tileID.isLessThan(pt.tileID)?-1:1))}let $=this.crossTileSymbolIndex.addLayer(Z,U[Z.source],l.center.lng);O=O||$}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((M=M||this._layerOrderChanged||v===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(n.h.now(),l.zoom))&&(this.pauseablePlacement=new Vl(l,this.map.terrain,this._order,M,d,v,b,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,U),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(n.h.now()),B=!0),O&&this.pauseablePlacement.placement.setStale()),B||O)for(let W of this._order){let Z=this._layers[W];Z.type===\"symbol\"&&this.placement.updateLayerOpacities(Z,U[Z.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(n.h.now())}_releaseSymbolFadeTiles(){for(let l in this.sourceCaches)this.sourceCaches[l].releaseSymbolFadeTiles()}getImages(l,d,v){this.imageManager.getImages(d.icons,v),this._updateTilesForChangedImages();let b=this.sourceCaches[d.source];b&&b.setDependencies(d.tileID.key,d.type,d.icons)}getGlyphs(l,d,v){this.glyphManager.getGlyphs(d.stacks,v);let b=this.sourceCaches[d.source];b&&b.setDependencies(d.tileID.key,d.type,[\"\"])}getResource(l,d,v){return n.m(d,v)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(l,d={}){this._checkLoaded(),l&&this._validate(n.y.glyphs,\"glyphs\",l,null,d)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=l,this.glyphManager.entries={},this.glyphManager.setURL(l))}addSprite(l,d,v={},b){this._checkLoaded();let M=[{id:l,url:d}],O=[...kt(this.stylesheet.sprite),...M];this._validate(n.y.sprite,\"sprite\",O,null,v)||(this.stylesheet.sprite=O,this._loadSprite(M,!0,b))}removeSprite(l){this._checkLoaded();let d=kt(this.stylesheet.sprite);if(d.find(v=>v.id===l)){if(this._spritesImagesIds[l])for(let v of this._spritesImagesIds[l])this.imageManager.removeImage(v),this._changedImages[v]=!0;d.splice(d.findIndex(v=>v.id===l),1),this.stylesheet.sprite=d.length>0?d:void 0,delete this._spritesImagesIds[l],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new n.k(\"data\",{dataType:\"style\"}))}else this.fire(new n.j(new Error(`Sprite \"${l}\" doesn't exists on this map.`)))}getSprite(){return kt(this.stylesheet.sprite)}setSprite(l,d={},v){this._checkLoaded(),l&&this._validate(n.y.sprite,\"sprite\",l,null,d)||(this.stylesheet.sprite=l,l?this._loadSprite(l,!0,v):(this._unloadSprite(),v&&v(null)))}}Gn.registerForPluginStateChange=n.aK;var So=n.Q([{name:\"a_pos\",type:\"Int16\",components:2}]),jl=\"attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}\";let Ki={prelude:_i(`#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\n`,`#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}`),background:_i(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,\"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}\"),backgroundPattern:_i(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,\"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}\"),circle:_i(`varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:_i(\"void main() {gl_FragColor=vec4(1.0);}\",\"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}\"),heatmap:_i(`uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:_i(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}`,\"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}\"),collisionBox:_i(\"varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}\",\"attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}\"),collisionCircle:_i(\"varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}\",\"attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}\"),debug:_i(\"uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}\",\"attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}\"),fill:_i(`#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:_i(`varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:_i(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:_i(`#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:_i(`varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:_i(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:_i(`#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,\"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}\"),hillshade:_i(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,\"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}\"),line:_i(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}`),lineGradient:_i(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}`),linePattern:_i(`#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:_i(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:_i(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,\"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}\"),symbolIcon:_i(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:_i(`#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:_i(`#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:_i(\"uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}\",jl),terrainDepth:_i(\"varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}\",jl),terrainCoords:_i(\"precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}\",jl)};function _i(T,l){let d=/#pragma mapbox: ([\\w]+) ([\\w]+) ([\\w]+) ([\\w]+)/g,v=l.match(/attribute ([\\w]+) ([\\w]+)/g),b=T.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g),M=l.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g),O=M?M.concat(b):b,B={};return{fragmentSource:T=T.replace(d,(U,W,Z,$,st)=>(B[st]=!0,W===\"define\"?`\n#ifndef HAS_UNIFORM_u_${st}\nvarying ${Z} ${$} ${st};\n#else\nuniform ${Z} ${$} u_${st};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${st}\n ${Z} ${$} ${st} = u_${st};\n#endif\n`)),vertexSource:l=l.replace(d,(U,W,Z,$,st)=>{let At=$===\"float\"?\"vec2\":\"vec4\",pt=st.match(/color/)?\"color\":At;return B[st]?W===\"define\"?`\n#ifndef HAS_UNIFORM_u_${st}\nuniform lowp float u_${st}_t;\nattribute ${Z} ${At} a_${st};\nvarying ${Z} ${$} ${st};\n#else\nuniform ${Z} ${$} u_${st};\n#endif\n`:pt===\"vec4\"?`\n#ifndef HAS_UNIFORM_u_${st}\n ${st} = a_${st};\n#else\n ${Z} ${$} ${st} = u_${st};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${st}\n ${st} = unpack_mix_${pt}(a_${st}, u_${st}_t);\n#else\n ${Z} ${$} ${st} = u_${st};\n#endif\n`:W===\"define\"?`\n#ifndef HAS_UNIFORM_u_${st}\nuniform lowp float u_${st}_t;\nattribute ${Z} ${At} a_${st};\n#else\nuniform ${Z} ${$} u_${st};\n#endif\n`:pt===\"vec4\"?`\n#ifndef HAS_UNIFORM_u_${st}\n ${Z} ${$} ${st} = a_${st};\n#else\n ${Z} ${$} ${st} = u_${st};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${st}\n ${Z} ${$} ${st} = unpack_mix_${pt}(a_${st}, u_${st}_t);\n#else\n ${Z} ${$} ${st} = u_${st};\n#endif\n`}),staticAttributes:v,staticUniforms:O}}class Gl{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(l,d,v,b,M,O,B,U,W){this.context=l;let Z=this.boundPaintVertexBuffers.length!==b.length;for(let $=0;!Z&&$({u_depth:new n.aL($t,oe.u_depth),u_terrain:new n.aL($t,oe.u_terrain),u_terrain_dim:new n.aM($t,oe.u_terrain_dim),u_terrain_matrix:new n.aN($t,oe.u_terrain_matrix),u_terrain_unpack:new n.aO($t,oe.u_terrain_unpack),u_terrain_exaggeration:new n.aM($t,oe.u_terrain_exaggeration)}))(l,Qt),this.binderUniforms=v?v.getUniforms(l,Qt):[]}draw(l,d,v,b,M,O,B,U,W,Z,$,st,At,pt,yt,dt,Ft,Ht){let St=l.gl;if(this.failedToCreate)return;if(l.program.set(this.program),l.setDepthMode(v),l.setStencilMode(b),l.setColorMode(M),l.setCullFace(O),U){l.activeTexture.set(St.TEXTURE2),St.bindTexture(St.TEXTURE_2D,U.depthTexture),l.activeTexture.set(St.TEXTURE3),St.bindTexture(St.TEXTURE_2D,U.texture);for(let Qt in this.terrainUniforms)this.terrainUniforms[Qt].set(U[Qt])}for(let Qt in this.fixedUniforms)this.fixedUniforms[Qt].set(B[Qt]);yt&&yt.setUniforms(l,this.binderUniforms,At,{zoom:pt});let Bt=0;switch(d){case St.LINES:Bt=2;break;case St.TRIANGLES:Bt=3;break;case St.LINE_STRIP:Bt=1}for(let Qt of st.get()){let $t=Qt.vaos||(Qt.vaos={});($t[W]||($t[W]=new Gl)).bind(l,this,Z,yt?yt.getPaintVertexBuffers():[],$,Qt.vertexOffset,dt,Ft,Ht),St.drawElements(d,Qt.primitiveLength*Bt,St.UNSIGNED_SHORT,Qt.primitiveOffset*Bt*2)}}}function rs(T,l,d){let v=1/Dt(d,1,l.transform.tileZoom),b=Math.pow(2,d.tileID.overscaledZ),M=d.tileSize*Math.pow(2,l.transform.tileZoom)/b,O=M*(d.tileID.canonical.x+d.tileID.wrap*b),B=M*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture.size,u_scale:[v,T.fromScale,T.toScale],u_fade:T.t,u_pixel_coord_upper:[O>>16,B>>16],u_pixel_coord_lower:[65535&O,65535&B]}}let Gp=(T,l,d,v)=>{let b=l.style.light,M=b.properties.get(\"position\"),O=[M.x,M.y,M.z],B=function(){var W=new n.A(9);return n.A!=Float32Array&&(W[1]=0,W[2]=0,W[3]=0,W[5]=0,W[6]=0,W[7]=0),W[0]=1,W[4]=1,W[8]=1,W}();b.properties.get(\"anchor\")===\"viewport\"&&function(W,Z){var $=Math.sin(Z),st=Math.cos(Z);W[0]=st,W[1]=$,W[2]=0,W[3]=-$,W[4]=st,W[5]=0,W[6]=0,W[7]=0,W[8]=1}(B,-l.transform.angle),function(W,Z,$){var st=Z[0],At=Z[1],pt=Z[2];W[0]=st*$[0]+At*$[3]+pt*$[6],W[1]=st*$[1]+At*$[4]+pt*$[7],W[2]=st*$[2]+At*$[5]+pt*$[8]}(O,O,B);let U=b.properties.get(\"color\");return{u_matrix:T,u_lightpos:O,u_lightintensity:b.properties.get(\"intensity\"),u_lightcolor:[U.r,U.g,U.b],u_vertical_gradient:+d,u_opacity:v}},Wl=(T,l,d,v,b,M,O)=>n.e(Gp(T,l,d,v),rs(M,l,O),{u_height_factor:-Math.pow(2,b.overscaledZ)/O.tileSize/8}),_d=T=>({u_matrix:T}),yd=(T,l,d,v)=>n.e(_d(T),rs(d,l,v)),vd=(T,l)=>({u_matrix:T,u_world:l}),xd=(T,l,d,v,b)=>n.e(yd(T,l,d,v),{u_world:b}),lt=(T,l,d,v)=>{let b=T.transform,M,O;if(v.paint.get(\"circle-pitch-alignment\")===\"map\"){let B=Dt(d,1,b.zoom);M=!0,O=[B,B]}else M=!1,O=b.pixelsToGLUnits;return{u_camera_to_center_distance:b.cameraToCenterDistance,u_scale_with_map:+(v.paint.get(\"circle-pitch-scale\")===\"map\"),u_matrix:T.translatePosMatrix(l.posMatrix,d,v.paint.get(\"circle-translate\"),v.paint.get(\"circle-translate-anchor\")),u_pitch_with_map:+M,u_device_pixel_ratio:T.pixelRatio,u_extrude_scale:O}},ft=(T,l,d)=>{let v=Dt(d,1,l.zoom),b=Math.pow(2,l.zoom-d.tileID.overscaledZ),M=d.tileID.overscaleFactor();return{u_matrix:T,u_camera_to_center_distance:l.cameraToCenterDistance,u_pixels_to_tile_units:v,u_extrude_scale:[l.pixelsToGLUnits[0]/(v*b),l.pixelsToGLUnits[1]/(v*b)],u_overscale_factor:M}},Lt=(T,l,d=1)=>({u_matrix:T,u_color:l,u_overlay:0,u_overlay_scale:d}),Kt=T=>({u_matrix:T}),ge=(T,l,d,v)=>({u_matrix:T,u_extrude_scale:Dt(l,1,d),u_intensity:v});function Qe(T,l){let d=Math.pow(2,l.canonical.z),v=l.canonical.y;return[new n.U(0,v/d).toLngLat().lat,new n.U(0,(v+1)/d).toLngLat().lat]}let ti=(T,l,d,v)=>{let b=T.transform;return{u_matrix:jm(T,l,d,v),u_ratio:1/Dt(l,1,b.zoom),u_device_pixel_ratio:T.pixelRatio,u_units_to_pixels:[1/b.pixelsToGLUnits[0],1/b.pixelsToGLUnits[1]]}},is=(T,l,d,v,b)=>n.e(ti(T,l,d,b),{u_image:0,u_image_height:v}),Ts=(T,l,d,v,b)=>{let M=T.transform,O=Ra(l,M);return{u_matrix:jm(T,l,d,b),u_texsize:l.imageAtlasTexture.size,u_ratio:1/Dt(l,1,M.zoom),u_device_pixel_ratio:T.pixelRatio,u_image:0,u_scale:[O,v.fromScale,v.toScale],u_fade:v.t,u_units_to_pixels:[1/M.pixelsToGLUnits[0],1/M.pixelsToGLUnits[1]]}},Vs=(T,l,d,v,b,M)=>{let O=T.lineAtlas,B=Ra(l,T.transform),U=d.layout.get(\"line-cap\")===\"round\",W=O.getDash(v.from,U),Z=O.getDash(v.to,U),$=W.width*b.fromScale,st=Z.width*b.toScale;return n.e(ti(T,l,d,M),{u_patternscale_a:[B/$,-W.height/2],u_patternscale_b:[B/st,-Z.height/2],u_sdfgamma:O.width/(256*Math.min($,st)*T.pixelRatio)/2,u_image:0,u_tex_y_a:W.y,u_tex_y_b:Z.y,u_mix:b.t})};function Ra(T,l){return 1/Dt(T,1,l.tileZoom)}function jm(T,l,d,v){return T.translatePosMatrix(v?v.posMatrix:l.tileID.posMatrix,l,d.paint.get(\"line-translate\"),d.paint.get(\"line-translate-anchor\"))}let Ox=(T,l,d,v,b)=>{return{u_matrix:T,u_tl_parent:l,u_scale_parent:d,u_buffer_scale:1,u_fade_t:v.mix,u_opacity:v.opacity*b.paint.get(\"raster-opacity\"),u_image0:0,u_image1:1,u_brightness_low:b.paint.get(\"raster-brightness-min\"),u_brightness_high:b.paint.get(\"raster-brightness-max\"),u_saturation_factor:(O=b.paint.get(\"raster-saturation\"),O>0?1-1/(1.001-O):-O),u_contrast_factor:(M=b.paint.get(\"raster-contrast\"),M>0?1/(1-M):1+M),u_spin_weights:Bx(b.paint.get(\"raster-hue-rotate\"))};var M,O};function Bx(T){T*=Math.PI/180;let l=Math.sin(T),d=Math.cos(T);return[(2*d+1)/3,(-Math.sqrt(3)*l-d+1)/3,(Math.sqrt(3)*l-d+1)/3]}let l_=(T,l,d,v,b,M,O,B,U,W)=>{let Z=b.transform;return{u_is_size_zoom_constant:+(T===\"constant\"||T===\"source\"),u_is_size_feature_constant:+(T===\"constant\"||T===\"camera\"),u_size_t:l?l.uSizeT:0,u_size:l?l.uSize:0,u_camera_to_center_distance:Z.cameraToCenterDistance,u_pitch:Z.pitch/360*2*Math.PI,u_rotate_symbol:+d,u_aspect_ratio:Z.width/Z.height,u_fade_change:b.options.fadeDuration?b.symbolFadeChange:1,u_matrix:M,u_label_plane_matrix:O,u_coord_matrix:B,u_is_text:+U,u_pitch_with_map:+v,u_texsize:W,u_texture:0}},c_=(T,l,d,v,b,M,O,B,U,W,Z)=>{let $=b.transform;return n.e(l_(T,l,d,v,b,M,O,B,U,W),{u_gamma_scale:v?Math.cos($._pitch)*$.cameraToCenterDistance:1,u_device_pixel_ratio:b.pixelRatio,u_is_halo:+Z})},gf=(T,l,d,v,b,M,O,B,U,W)=>n.e(c_(T,l,d,v,b,M,O,B,!0,U,!0),{u_texsize_icon:W,u_texture_icon:1}),Gm=(T,l,d)=>({u_matrix:T,u_opacity:l,u_color:d}),fl=(T,l,d,v,b,M)=>n.e(function(O,B,U,W){let Z=U.imageManager.getPattern(O.from.toString()),$=U.imageManager.getPattern(O.to.toString()),{width:st,height:At}=U.imageManager.getPixelSize(),pt=Math.pow(2,W.tileID.overscaledZ),yt=W.tileSize*Math.pow(2,U.transform.tileZoom)/pt,dt=yt*(W.tileID.canonical.x+W.tileID.wrap*pt),Ft=yt*W.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:Z.tl,u_pattern_br_a:Z.br,u_pattern_tl_b:$.tl,u_pattern_br_b:$.br,u_texsize:[st,At],u_mix:B.t,u_pattern_size_a:Z.displaySize,u_pattern_size_b:$.displaySize,u_scale_a:B.fromScale,u_scale_b:B.toScale,u_tile_units_to_pixels:1/Dt(W,1,U.transform.tileZoom),u_pixel_coord_upper:[dt>>16,Ft>>16],u_pixel_coord_lower:[65535&dt,65535&Ft]}}(v,M,d,b),{u_matrix:T,u_opacity:l}),Wm={fillExtrusion:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_lightpos:new n.aP(T,l.u_lightpos),u_lightintensity:new n.aM(T,l.u_lightintensity),u_lightcolor:new n.aP(T,l.u_lightcolor),u_vertical_gradient:new n.aM(T,l.u_vertical_gradient),u_opacity:new n.aM(T,l.u_opacity)}),fillExtrusionPattern:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_lightpos:new n.aP(T,l.u_lightpos),u_lightintensity:new n.aM(T,l.u_lightintensity),u_lightcolor:new n.aP(T,l.u_lightcolor),u_vertical_gradient:new n.aM(T,l.u_vertical_gradient),u_height_factor:new n.aM(T,l.u_height_factor),u_image:new n.aL(T,l.u_image),u_texsize:new n.aQ(T,l.u_texsize),u_pixel_coord_upper:new n.aQ(T,l.u_pixel_coord_upper),u_pixel_coord_lower:new n.aQ(T,l.u_pixel_coord_lower),u_scale:new n.aP(T,l.u_scale),u_fade:new n.aM(T,l.u_fade),u_opacity:new n.aM(T,l.u_opacity)}),fill:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix)}),fillPattern:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_image:new n.aL(T,l.u_image),u_texsize:new n.aQ(T,l.u_texsize),u_pixel_coord_upper:new n.aQ(T,l.u_pixel_coord_upper),u_pixel_coord_lower:new n.aQ(T,l.u_pixel_coord_lower),u_scale:new n.aP(T,l.u_scale),u_fade:new n.aM(T,l.u_fade)}),fillOutline:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_world:new n.aQ(T,l.u_world)}),fillOutlinePattern:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_world:new n.aQ(T,l.u_world),u_image:new n.aL(T,l.u_image),u_texsize:new n.aQ(T,l.u_texsize),u_pixel_coord_upper:new n.aQ(T,l.u_pixel_coord_upper),u_pixel_coord_lower:new n.aQ(T,l.u_pixel_coord_lower),u_scale:new n.aP(T,l.u_scale),u_fade:new n.aM(T,l.u_fade)}),circle:(T,l)=>({u_camera_to_center_distance:new n.aM(T,l.u_camera_to_center_distance),u_scale_with_map:new n.aL(T,l.u_scale_with_map),u_pitch_with_map:new n.aL(T,l.u_pitch_with_map),u_extrude_scale:new n.aQ(T,l.u_extrude_scale),u_device_pixel_ratio:new n.aM(T,l.u_device_pixel_ratio),u_matrix:new n.aN(T,l.u_matrix)}),collisionBox:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_camera_to_center_distance:new n.aM(T,l.u_camera_to_center_distance),u_pixels_to_tile_units:new n.aM(T,l.u_pixels_to_tile_units),u_extrude_scale:new n.aQ(T,l.u_extrude_scale),u_overscale_factor:new n.aM(T,l.u_overscale_factor)}),collisionCircle:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_inv_matrix:new n.aN(T,l.u_inv_matrix),u_camera_to_center_distance:new n.aM(T,l.u_camera_to_center_distance),u_viewport_size:new n.aQ(T,l.u_viewport_size)}),debug:(T,l)=>({u_color:new n.aR(T,l.u_color),u_matrix:new n.aN(T,l.u_matrix),u_overlay:new n.aL(T,l.u_overlay),u_overlay_scale:new n.aM(T,l.u_overlay_scale)}),clippingMask:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix)}),heatmap:(T,l)=>({u_extrude_scale:new n.aM(T,l.u_extrude_scale),u_intensity:new n.aM(T,l.u_intensity),u_matrix:new n.aN(T,l.u_matrix)}),heatmapTexture:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_world:new n.aQ(T,l.u_world),u_image:new n.aL(T,l.u_image),u_color_ramp:new n.aL(T,l.u_color_ramp),u_opacity:new n.aM(T,l.u_opacity)}),hillshade:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_image:new n.aL(T,l.u_image),u_latrange:new n.aQ(T,l.u_latrange),u_light:new n.aQ(T,l.u_light),u_shadow:new n.aR(T,l.u_shadow),u_highlight:new n.aR(T,l.u_highlight),u_accent:new n.aR(T,l.u_accent)}),hillshadePrepare:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_image:new n.aL(T,l.u_image),u_dimension:new n.aQ(T,l.u_dimension),u_zoom:new n.aM(T,l.u_zoom),u_unpack:new n.aO(T,l.u_unpack)}),line:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_ratio:new n.aM(T,l.u_ratio),u_device_pixel_ratio:new n.aM(T,l.u_device_pixel_ratio),u_units_to_pixels:new n.aQ(T,l.u_units_to_pixels)}),lineGradient:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_ratio:new n.aM(T,l.u_ratio),u_device_pixel_ratio:new n.aM(T,l.u_device_pixel_ratio),u_units_to_pixels:new n.aQ(T,l.u_units_to_pixels),u_image:new n.aL(T,l.u_image),u_image_height:new n.aM(T,l.u_image_height)}),linePattern:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_texsize:new n.aQ(T,l.u_texsize),u_ratio:new n.aM(T,l.u_ratio),u_device_pixel_ratio:new n.aM(T,l.u_device_pixel_ratio),u_image:new n.aL(T,l.u_image),u_units_to_pixels:new n.aQ(T,l.u_units_to_pixels),u_scale:new n.aP(T,l.u_scale),u_fade:new n.aM(T,l.u_fade)}),lineSDF:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_ratio:new n.aM(T,l.u_ratio),u_device_pixel_ratio:new n.aM(T,l.u_device_pixel_ratio),u_units_to_pixels:new n.aQ(T,l.u_units_to_pixels),u_patternscale_a:new n.aQ(T,l.u_patternscale_a),u_patternscale_b:new n.aQ(T,l.u_patternscale_b),u_sdfgamma:new n.aM(T,l.u_sdfgamma),u_image:new n.aL(T,l.u_image),u_tex_y_a:new n.aM(T,l.u_tex_y_a),u_tex_y_b:new n.aM(T,l.u_tex_y_b),u_mix:new n.aM(T,l.u_mix)}),raster:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_tl_parent:new n.aQ(T,l.u_tl_parent),u_scale_parent:new n.aM(T,l.u_scale_parent),u_buffer_scale:new n.aM(T,l.u_buffer_scale),u_fade_t:new n.aM(T,l.u_fade_t),u_opacity:new n.aM(T,l.u_opacity),u_image0:new n.aL(T,l.u_image0),u_image1:new n.aL(T,l.u_image1),u_brightness_low:new n.aM(T,l.u_brightness_low),u_brightness_high:new n.aM(T,l.u_brightness_high),u_saturation_factor:new n.aM(T,l.u_saturation_factor),u_contrast_factor:new n.aM(T,l.u_contrast_factor),u_spin_weights:new n.aP(T,l.u_spin_weights)}),symbolIcon:(T,l)=>({u_is_size_zoom_constant:new n.aL(T,l.u_is_size_zoom_constant),u_is_size_feature_constant:new n.aL(T,l.u_is_size_feature_constant),u_size_t:new n.aM(T,l.u_size_t),u_size:new n.aM(T,l.u_size),u_camera_to_center_distance:new n.aM(T,l.u_camera_to_center_distance),u_pitch:new n.aM(T,l.u_pitch),u_rotate_symbol:new n.aL(T,l.u_rotate_symbol),u_aspect_ratio:new n.aM(T,l.u_aspect_ratio),u_fade_change:new n.aM(T,l.u_fade_change),u_matrix:new n.aN(T,l.u_matrix),u_label_plane_matrix:new n.aN(T,l.u_label_plane_matrix),u_coord_matrix:new n.aN(T,l.u_coord_matrix),u_is_text:new n.aL(T,l.u_is_text),u_pitch_with_map:new n.aL(T,l.u_pitch_with_map),u_texsize:new n.aQ(T,l.u_texsize),u_texture:new n.aL(T,l.u_texture)}),symbolSDF:(T,l)=>({u_is_size_zoom_constant:new n.aL(T,l.u_is_size_zoom_constant),u_is_size_feature_constant:new n.aL(T,l.u_is_size_feature_constant),u_size_t:new n.aM(T,l.u_size_t),u_size:new n.aM(T,l.u_size),u_camera_to_center_distance:new n.aM(T,l.u_camera_to_center_distance),u_pitch:new n.aM(T,l.u_pitch),u_rotate_symbol:new n.aL(T,l.u_rotate_symbol),u_aspect_ratio:new n.aM(T,l.u_aspect_ratio),u_fade_change:new n.aM(T,l.u_fade_change),u_matrix:new n.aN(T,l.u_matrix),u_label_plane_matrix:new n.aN(T,l.u_label_plane_matrix),u_coord_matrix:new n.aN(T,l.u_coord_matrix),u_is_text:new n.aL(T,l.u_is_text),u_pitch_with_map:new n.aL(T,l.u_pitch_with_map),u_texsize:new n.aQ(T,l.u_texsize),u_texture:new n.aL(T,l.u_texture),u_gamma_scale:new n.aM(T,l.u_gamma_scale),u_device_pixel_ratio:new n.aM(T,l.u_device_pixel_ratio),u_is_halo:new n.aL(T,l.u_is_halo)}),symbolTextAndIcon:(T,l)=>({u_is_size_zoom_constant:new n.aL(T,l.u_is_size_zoom_constant),u_is_size_feature_constant:new n.aL(T,l.u_is_size_feature_constant),u_size_t:new n.aM(T,l.u_size_t),u_size:new n.aM(T,l.u_size),u_camera_to_center_distance:new n.aM(T,l.u_camera_to_center_distance),u_pitch:new n.aM(T,l.u_pitch),u_rotate_symbol:new n.aL(T,l.u_rotate_symbol),u_aspect_ratio:new n.aM(T,l.u_aspect_ratio),u_fade_change:new n.aM(T,l.u_fade_change),u_matrix:new n.aN(T,l.u_matrix),u_label_plane_matrix:new n.aN(T,l.u_label_plane_matrix),u_coord_matrix:new n.aN(T,l.u_coord_matrix),u_is_text:new n.aL(T,l.u_is_text),u_pitch_with_map:new n.aL(T,l.u_pitch_with_map),u_texsize:new n.aQ(T,l.u_texsize),u_texsize_icon:new n.aQ(T,l.u_texsize_icon),u_texture:new n.aL(T,l.u_texture),u_texture_icon:new n.aL(T,l.u_texture_icon),u_gamma_scale:new n.aM(T,l.u_gamma_scale),u_device_pixel_ratio:new n.aM(T,l.u_device_pixel_ratio),u_is_halo:new n.aL(T,l.u_is_halo)}),background:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_opacity:new n.aM(T,l.u_opacity),u_color:new n.aR(T,l.u_color)}),backgroundPattern:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_opacity:new n.aM(T,l.u_opacity),u_image:new n.aL(T,l.u_image),u_pattern_tl_a:new n.aQ(T,l.u_pattern_tl_a),u_pattern_br_a:new n.aQ(T,l.u_pattern_br_a),u_pattern_tl_b:new n.aQ(T,l.u_pattern_tl_b),u_pattern_br_b:new n.aQ(T,l.u_pattern_br_b),u_texsize:new n.aQ(T,l.u_texsize),u_mix:new n.aM(T,l.u_mix),u_pattern_size_a:new n.aQ(T,l.u_pattern_size_a),u_pattern_size_b:new n.aQ(T,l.u_pattern_size_b),u_scale_a:new n.aM(T,l.u_scale_a),u_scale_b:new n.aM(T,l.u_scale_b),u_pixel_coord_upper:new n.aQ(T,l.u_pixel_coord_upper),u_pixel_coord_lower:new n.aQ(T,l.u_pixel_coord_lower),u_tile_units_to_pixels:new n.aM(T,l.u_tile_units_to_pixels)}),terrain:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_texture:new n.aL(T,l.u_texture),u_ele_delta:new n.aM(T,l.u_ele_delta)}),terrainDepth:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_ele_delta:new n.aM(T,l.u_ele_delta)}),terrainCoords:(T,l)=>({u_matrix:new n.aN(T,l.u_matrix),u_texture:new n.aL(T,l.u_texture),u_terrain_coords_id:new n.aM(T,l.u_terrain_coords_id),u_ele_delta:new n.aM(T,l.u_ele_delta)})};class Hm{constructor(l,d,v){this.context=l;let b=l.gl;this.buffer=b.createBuffer(),this.dynamicDraw=!!v,this.context.unbindVAO(),l.bindElementBuffer.set(this.buffer),b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?b.DYNAMIC_DRAW:b.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(l){let d=this.context.gl;if(!this.dynamicDraw)throw new Error(\"Attempted to update data while not in dynamic mode.\");this.context.unbindVAO(),this.bind(),d.bufferSubData(d.ELEMENT_ARRAY_BUFFER,0,l.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let Wp={Int8:\"BYTE\",Uint8:\"UNSIGNED_BYTE\",Int16:\"SHORT\",Uint16:\"UNSIGNED_SHORT\",Int32:\"INT\",Uint32:\"UNSIGNED_INT\",Float32:\"FLOAT\"};class qm{constructor(l,d,v,b){this.length=d.length,this.attributes=v,this.itemSize=d.bytesPerElement,this.dynamicDraw=b,this.context=l;let M=l.gl;this.buffer=M.createBuffer(),l.bindVertexBuffer.set(this.buffer),M.bufferData(M.ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?M.DYNAMIC_DRAW:M.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(l){if(l.length!==this.length)throw new Error(`Length of new data is ${l.length}, which doesn't match current length of ${this.length}`);let d=this.context.gl;this.bind(),d.bufferSubData(d.ARRAY_BUFFER,0,l.arrayBuffer)}enableAttributes(l,d){for(let v=0;v0){let be=n.Z(),Ze=oe;n.aU(be,$t.placementInvProjMatrix,T.transform.glCoordMatrix),n.aU(be,be,$t.placementViewportMatrix),Z.push({circleArray:he,circleOffset:st,transform:Ze,invTransform:be,coord:Bt}),$+=he.length/4,st=$}pe&&W.draw(B,U.LINES,ci.disabled,Je.disabled,T.colorModeForRenderPass(),It.disabled,ft(oe,T.transform,Qt),T.style.map.terrain&&T.style.map.terrain.getTerrainData(Bt),d.id,pe.layoutVertexBuffer,pe.indexBuffer,pe.segments,null,T.transform.zoom,null,null,pe.collisionVertexBuffer)}if(!O||!Z.length)return;let At=T.useProgram(\"collisionCircle\"),pt=new n.aV;pt.resize(4*$),pt._trim();let yt=0;for(let St of Z)for(let Bt=0;Bt=0&&(pt[dt.associatedIconIndex]={shiftedAnchor:Kr,angle:Ee})}else ht(dt.numGlyphs,st)}if(W){At.clear();let yt=T.icon.placedSymbolArray;for(let dt=0;dtT.style.map.terrain.getElevation(pe,Zo,_n):null,fs=d.layout.get(\"text-rotation-alignment\")===\"map\";Te(be,pe.posMatrix,T,b,jr,ql,dt,W,fs,Fn)}let vu=T.translatePosMatrix(pe.posMatrix,he,M,O),_h=Ft||b&&$t||yu?Jm:jr,Ws=T.translatePosMatrix(ql,he,M,O,!0),Ps=Ee&&d.paint.get(b?\"text-halo-width\":\"icon-halo-width\").constantOr(1)!==0,Eo;Eo=Ee?be.iconsInText?gf(pr.kind,Jr,Ht,dt,T,vu,_h,Ws,ei,hs):c_(pr.kind,Jr,Ht,dt,T,vu,_h,Ws,b,ei,!0):l_(pr.kind,Jr,Ht,dt,T,vu,_h,Ws,b,ei);let yh={program:Gi,buffers:Ze,uniformValues:Eo,atlasTexture:On,atlasTextureIcon:Bn,atlasInterpolation:tn,atlasInterpolationIcon:Gs,isSDF:Ee,hasHalo:Ps};if(St&&be.canOverlap){Bt=!0;let Fn=Ze.segments.get();for(let fs of Fn)oe.push({segments:new n.S([fs]),sortKey:fs.sortKey,state:yh,terrainData:Vr})}else oe.push({segments:Ze.segments,sortKey:0,state:yh,terrainData:Vr})}Bt&&oe.sort((pe,he)=>pe.sortKey-he.sortKey);for(let pe of oe){let he=pe.state;if(st.activeTexture.set(At.TEXTURE0),he.atlasTexture.bind(he.atlasInterpolation,At.CLAMP_TO_EDGE),he.atlasTextureIcon&&(st.activeTexture.set(At.TEXTURE1),he.atlasTextureIcon&&he.atlasTextureIcon.bind(he.atlasInterpolationIcon,At.CLAMP_TO_EDGE)),he.isSDF){let be=he.uniformValues;he.hasHalo&&(be.u_is_halo=1,e0(he.buffers,pe.segments,d,T,he.program,Qt,Z,$,be,pe.terrainData)),be.u_is_halo=0}e0(he.buffers,pe.segments,d,T,he.program,Qt,Z,$,he.uniformValues,pe.terrainData)}}function e0(T,l,d,v,b,M,O,B,U,W){let Z=v.context;b.draw(Z,Z.gl.TRIANGLES,M,O,B,It.disabled,U,W,d.id,T.layoutVertexBuffer,T.indexBuffer,l,d.paint,v.transform.zoom,T.programConfigurations.get(d.id),T.dynamicLayoutVertexBuffer,T.opacityVertexBuffer)}function Ed(T,l,d,v,b){if(!d||!v||!v.imageAtlas)return;let M=v.imageAtlas.patternPositions,O=M[d.to.toString()],B=M[d.from.toString()];if(!O&&B&&(O=B),!B&&O&&(B=O),!O||!B){let U=b.getPaintProperty(l);O=M[U],B=M[U]}O&&B&&T.setConstantPatternPositions(O,B)}function Pd(T,l,d,v,b,M,O){let B=T.context.gl,U=\"fill-pattern\",W=d.paint.get(U),Z=W&&W.constantOr(1),$=d.getCrossfadeParameters(),st,At,pt,yt,dt;O?(At=Z&&!d.getPaintProperty(\"fill-outline-color\")?\"fillOutlinePattern\":\"fillOutline\",st=B.LINES):(At=Z?\"fillPattern\":\"fill\",st=B.TRIANGLES);let Ft=W.constantOr(null);for(let Ht of v){let St=l.getTile(Ht);if(Z&&!St.patternsLoaded())continue;let Bt=St.getBucket(d);if(!Bt)continue;let Qt=Bt.programConfigurations.get(d.id),$t=T.useProgram(At,Qt),oe=T.style.map.terrain&&T.style.map.terrain.getTerrainData(Ht);Z&&(T.context.activeTexture.set(B.TEXTURE0),St.imageAtlasTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE),Qt.updatePaintBuffers($)),Ed(Qt,U,Ft,St,d);let pe=oe?Ht:null,he=T.translatePosMatrix(pe?pe.posMatrix:Ht.posMatrix,St,d.paint.get(\"fill-translate\"),d.paint.get(\"fill-translate-anchor\"));if(O){yt=Bt.indexBuffer2,dt=Bt.segments2;let be=[B.drawingBufferWidth,B.drawingBufferHeight];pt=At===\"fillOutlinePattern\"&&Z?xd(he,T,$,St,be):vd(he,be)}else yt=Bt.indexBuffer,dt=Bt.segments,pt=Z?yd(he,T,$,St):_d(he);$t.draw(T.context,st,b,T.stencilModeForClipping(Ht),M,It.disabled,pt,oe,d.id,Bt.layoutVertexBuffer,yt,dt,d.paint,T.transform.zoom,Qt)}}function Id(T,l,d,v,b,M,O){let B=T.context,U=B.gl,W=\"fill-extrusion-pattern\",Z=d.paint.get(W),$=Z.constantOr(1),st=d.getCrossfadeParameters(),At=d.paint.get(\"fill-extrusion-opacity\"),pt=Z.constantOr(null);for(let yt of v){let dt=l.getTile(yt),Ft=dt.getBucket(d);if(!Ft)continue;let Ht=T.style.map.terrain&&T.style.map.terrain.getTerrainData(yt),St=Ft.programConfigurations.get(d.id),Bt=T.useProgram($?\"fillExtrusionPattern\":\"fillExtrusion\",St);$&&(T.context.activeTexture.set(U.TEXTURE0),dt.imageAtlasTexture.bind(U.LINEAR,U.CLAMP_TO_EDGE),St.updatePaintBuffers(st)),Ed(St,W,pt,dt,d);let Qt=T.translatePosMatrix(yt.posMatrix,dt,d.paint.get(\"fill-extrusion-translate\"),d.paint.get(\"fill-extrusion-translate-anchor\")),$t=d.paint.get(\"fill-extrusion-vertical-gradient\"),oe=$?Wl(Qt,T,$t,At,yt,st,dt):Gp(Qt,T,$t,At);Bt.draw(B,B.gl.TRIANGLES,b,M,O,It.backCCW,oe,Ht,d.id,Ft.layoutVertexBuffer,Ft.indexBuffer,Ft.segments,d.paint,T.transform.zoom,St,T.style.map.terrain&&Ft.centroidVertexBuffer)}}function Fx(T,l,d,v,b,M,O){let B=T.context,U=B.gl,W=d.fbo;if(!W)return;let Z=T.useProgram(\"hillshade\"),$=T.style.map.terrain&&T.style.map.terrain.getTerrainData(l);B.activeTexture.set(U.TEXTURE0),U.bindTexture(U.TEXTURE_2D,W.colorAttachment.get()),Z.draw(B,U.TRIANGLES,b,M,O,It.disabled,((st,At,pt,yt)=>{let dt=pt.paint.get(\"hillshade-shadow-color\"),Ft=pt.paint.get(\"hillshade-highlight-color\"),Ht=pt.paint.get(\"hillshade-accent-color\"),St=pt.paint.get(\"hillshade-illumination-direction\")*(Math.PI/180);pt.paint.get(\"hillshade-illumination-anchor\")===\"viewport\"&&(St-=st.transform.angle);let Bt=!st.options.moving;return{u_matrix:yt?yt.posMatrix:st.transform.calculatePosMatrix(At.tileID.toUnwrapped(),Bt),u_image:0,u_latrange:Qe(0,At.tileID),u_light:[pt.paint.get(\"hillshade-exaggeration\"),St],u_shadow:dt,u_highlight:Ft,u_accent:Ht}})(T,d,v,$?l:null),$,v.id,T.rasterBoundsBuffer,T.quadTriangleIndexBuffer,T.rasterBoundsSegments)}function r0(T,l,d,v,b,M){let O=T.context,B=O.gl,U=l.dem;if(U&&U.data){let W=U.dim,Z=U.stride,$=U.getPixels();if(O.activeTexture.set(B.TEXTURE1),O.pixelStoreUnpackPremultiplyAlpha.set(!1),l.demTexture=l.demTexture||T.getTileTexture(Z),l.demTexture){let At=l.demTexture;At.update($,{premultiply:!1}),At.bind(B.NEAREST,B.CLAMP_TO_EDGE)}else l.demTexture=new qt(O,$,B.RGBA,{premultiply:!1}),l.demTexture.bind(B.NEAREST,B.CLAMP_TO_EDGE);O.activeTexture.set(B.TEXTURE0);let st=l.fbo;if(!st){let At=new qt(O,{width:W,height:W,data:null},B.RGBA);At.bind(B.LINEAR,B.CLAMP_TO_EDGE),st=l.fbo=O.createFramebuffer(W,W,!0,!1),st.colorAttachment.set(At.texture)}O.bindFramebuffer.set(st.framebuffer),O.viewport.set([0,0,W,W]),T.useProgram(\"hillshadePrepare\").draw(O,B.TRIANGLES,v,b,M,It.disabled,((At,pt)=>{let yt=pt.stride,dt=n.Z();return n.aS(dt,0,n.N,-n.N,0,0,1),n.$(dt,dt,[0,-n.N,0]),{u_matrix:dt,u_image:1,u_dimension:[yt,yt],u_zoom:At.overscaledZ,u_unpack:pt.getUnpackVector()}})(l.tileID,U),null,d.id,T.rasterBoundsBuffer,T.quadTriangleIndexBuffer,T.rasterBoundsSegments),l.needsHillshadePrepare=!1}}function f_(T,l,d,v,b,M){let O=v.paint.get(\"raster-fade-duration\");if(!M&&O>0){let B=n.h.now(),U=(B-T.timeAdded)/O,W=l?(B-l.timeAdded)/O:-1,Z=d.getSource(),$=b.coveringZoomLevel({tileSize:Z.tileSize,roundZoom:Z.roundZoom}),st=!l||Math.abs(l.tileID.overscaledZ-$)>Math.abs(T.tileID.overscaledZ-$),At=st&&T.refreshedUponExpiration?1:n.ad(st?U:1-W,0,1);return T.refreshedUponExpiration&&U>=1&&(T.refreshedUponExpiration=!1),l?{opacity:1,mix:1-At}:{opacity:At,mix:0}}return{opacity:1,mix:0}}let d_=new n.aT(1,0,0,1),yf=new n.aT(0,1,0,1),Ba=new n.aT(0,0,1,1),Wn=new n.aT(1,0,1,1),p_=new n.aT(0,1,1,1);function Cd(T,l,d,v){Xp(T,0,l+d/2,T.transform.width,d,v)}function $p(T,l,d,v){Xp(T,l-d/2,0,d,T.transform.height,v)}function Xp(T,l,d,v,b,M){let O=T.context,B=O.gl;B.enable(B.SCISSOR_TEST),B.scissor(l*T.pixelRatio,d*T.pixelRatio,v*T.pixelRatio,b*T.pixelRatio),O.clear({color:M}),B.disable(B.SCISSOR_TEST)}function i0(T,l,d){let v=T.context,b=v.gl,M=d.posMatrix,O=T.useProgram(\"debug\"),B=ci.disabled,U=Je.disabled,W=T.colorModeForRenderPass(),Z=\"$debug\",$=T.style.map.terrain&&T.style.map.terrain.getTerrainData(d);v.activeTexture.set(b.TEXTURE0);let st=l.getTileByID(d.key).latestRawTileData,At=Math.floor((st&&st.byteLength||0)/1024),pt=l.getTile(d).tileSize,yt=512/Math.min(pt,512)*(d.overscaledZ/T.transform.zoom)*.5,dt=d.canonical.toString();d.overscaledZ!==d.canonical.z&&(dt+=` => ${d.overscaledZ}`),function(Ft,Ht){Ft.initDebugOverlayCanvas();let St=Ft.debugOverlayCanvas,Bt=Ft.context.gl,Qt=Ft.debugOverlayCanvas.getContext(\"2d\");Qt.clearRect(0,0,St.width,St.height),Qt.shadowColor=\"white\",Qt.shadowBlur=2,Qt.lineWidth=1.5,Qt.strokeStyle=\"white\",Qt.textBaseline=\"top\",Qt.font=\"bold 36px Open Sans, sans-serif\",Qt.fillText(Ht,5,5),Qt.strokeText(Ht,5,5),Ft.debugOverlayTexture.update(St),Ft.debugOverlayTexture.bind(Bt.LINEAR,Bt.CLAMP_TO_EDGE)}(T,`${dt} ${At}kB`),O.draw(v,b.TRIANGLES,B,U,Ji.alphaBlended,It.disabled,Lt(M,n.aT.transparent,yt),null,Z,T.debugBuffer,T.quadTriangleIndexBuffer,T.debugSegments),O.draw(v,b.LINE_STRIP,B,U,W,It.disabled,Lt(M,n.aT.red),$,Z,T.debugBuffer,T.tileBorderIndexBuffer,T.debugSegments)}function Cn(T,l,d){let v=T.context,b=v.gl,M=T.colorModeForRenderPass(),O=new ci(b.LEQUAL,ci.ReadWrite,T.depthRangeFor3D),B=T.useProgram(\"terrain\"),U=l.getTerrainMesh();v.bindFramebuffer.set(null),v.viewport.set([0,0,T.width,T.height]);for(let W of d){let Z=T.renderToTexture.getTexture(W),$=l.getTerrainData(W.tileID);v.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,Z.texture);let st={u_matrix:T.transform.calculatePosMatrix(W.tileID.toUnwrapped()),u_texture:0,u_ele_delta:l.getMeshFrameDelta(T.transform.zoom)};B.draw(v,b.TRIANGLES,O,Je.disabled,M,It.backCCW,st,$,\"terrain\",U.vertexBuffer,U.indexBuffer,U.segments)}}class ah{constructor(l,d){this.context=new Oc(l),this.transform=d,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:n.Z(),renderTime:0},this.setup(),this.numSublayers=ls.maxUnderzooming+ls.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Dc}resize(l,d,v){if(this.width=Math.floor(l*v),this.height=Math.floor(d*v),this.pixelRatio=v,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let b of this.style._order)this.style._layers[b].resize()}setup(){let l=this.context,d=new n.a_;d.emplaceBack(0,0),d.emplaceBack(n.N,0),d.emplaceBack(0,n.N),d.emplaceBack(n.N,n.N),this.tileExtentBuffer=l.createVertexBuffer(d,So.members),this.tileExtentSegments=n.S.simpleSegment(0,0,4,2);let v=new n.a_;v.emplaceBack(0,0),v.emplaceBack(n.N,0),v.emplaceBack(0,n.N),v.emplaceBack(n.N,n.N),this.debugBuffer=l.createVertexBuffer(v,So.members),this.debugSegments=n.S.simpleSegment(0,0,4,5);let b=new n.V;b.emplaceBack(0,0,0,0),b.emplaceBack(n.N,0,n.N,0),b.emplaceBack(0,n.N,0,n.N),b.emplaceBack(n.N,n.N,n.N,n.N),this.rasterBoundsBuffer=l.createVertexBuffer(b,Jn.members),this.rasterBoundsSegments=n.S.simpleSegment(0,0,4,2);let M=new n.a_;M.emplaceBack(0,0),M.emplaceBack(1,0),M.emplaceBack(0,1),M.emplaceBack(1,1),this.viewportBuffer=l.createVertexBuffer(M,So.members),this.viewportSegments=n.S.simpleSegment(0,0,4,2);let O=new n.a$;O.emplaceBack(0),O.emplaceBack(1),O.emplaceBack(3),O.emplaceBack(2),O.emplaceBack(0),this.tileBorderIndexBuffer=l.createIndexBuffer(O);let B=new n.b0;B.emplaceBack(0,1,2),B.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=l.createIndexBuffer(B);let U=this.context.gl;this.stencilClearMode=new Je({func:U.ALWAYS,mask:0},0,255,U.ZERO,U.ZERO,U.ZERO)}clearStencil(){let l=this.context,d=l.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let v=n.Z();n.aS(v,0,this.width,this.height,0,0,1),n.a0(v,v,[d.drawingBufferWidth,d.drawingBufferHeight,0]),this.useProgram(\"clippingMask\").draw(l,d.TRIANGLES,ci.disabled,this.stencilClearMode,Ji.disabled,It.disabled,Kt(v),null,\"$clipping\",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(l,d){if(this.currentStencilSource===l.source||!l.isTileClipped()||!d||!d.length)return;this.currentStencilSource=l.source;let v=this.context,b=v.gl;this.nextStencilID+d.length>256&&this.clearStencil(),v.setColorMode(Ji.disabled),v.setDepthMode(ci.disabled);let M=this.useProgram(\"clippingMask\");this._tileClippingMaskIDs={};for(let O of d){let B=this._tileClippingMaskIDs[O.key]=this.nextStencilID++,U=this.style.map.terrain&&this.style.map.terrain.getTerrainData(O);M.draw(v,b.TRIANGLES,ci.disabled,new Je({func:b.ALWAYS,mask:0},B,255,b.KEEP,b.KEEP,b.REPLACE),Ji.disabled,It.disabled,Kt(O.posMatrix),U,\"$clipping\",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let l=this.nextStencilID++,d=this.context.gl;return new Je({func:d.NOTEQUAL,mask:255},l,255,d.KEEP,d.KEEP,d.REPLACE)}stencilModeForClipping(l){let d=this.context.gl;return new Je({func:d.EQUAL,mask:255},this._tileClippingMaskIDs[l.key],0,d.KEEP,d.KEEP,d.REPLACE)}stencilConfigForOverlap(l){let d=this.context.gl,v=l.sort((O,B)=>B.overscaledZ-O.overscaledZ),b=v[v.length-1].overscaledZ,M=v[0].overscaledZ-b+1;if(M>1){this.currentStencilSource=void 0,this.nextStencilID+M>256&&this.clearStencil();let O={};for(let B=0;B=0;this.currentLayer--){let U=this.style._layers[v[this.currentLayer]],W=b[U.source],Z=M[U.source];this._renderTileClippingMasks(U,Z),this.renderLayer(this,W,U,Z)}for(this.renderPass=\"translucent\",this.currentLayer=0;this.currentLayerdt.source&&!dt.isHidden(Z)?[W.sourceCaches[dt.source]]:[]),At=st.filter(dt=>dt.getSource().type===\"vector\"),pt=st.filter(dt=>dt.getSource().type!==\"vector\"),yt=dt=>{(!$||$.getSource().maxzoomyt(dt)),$||pt.forEach(dt=>yt(dt)),$}(this.style,this.transform.zoom);U&&function(W,Z,$){for(let st=0;st<$.length;st++)i0(W,Z,$[st])}(this,U,U.getVisibleCoordinates())}this.options.showPadding&&function(U){let W=U.transform.padding;Cd(U,U.transform.height-(W.top||0),3,d_),Cd(U,W.bottom||0,3,yf),$p(U,W.left||0,3,Ba),$p(U,U.transform.width-(W.right||0),3,Wn);let Z=U.transform.centerPoint;(function($,st,At,pt){Xp($,st-1,At-10,2,20,pt),Xp($,st-10,At-1,20,2,pt)})(U,Z.x,U.transform.height-Z.y,p_)}(this),this.context.setDefault()}renderLayer(l,d,v,b){if(!v.isHidden(this.transform.zoom)&&(v.type===\"background\"||v.type===\"custom\"||(b||[]).length))switch(this.id=v.id,v.type){case\"symbol\":(function(M,O,B,U,W){if(M.renderPass!==\"translucent\")return;let Z=Je.disabled,$=M.colorModeForRenderPass();(B._unevaluatedLayout.hasValue(\"text-variable-anchor\")||B._unevaluatedLayout.hasValue(\"text-variable-anchor-offset\"))&&function(st,At,pt,yt,dt,Ft,Ht){let St=At.transform,Bt=dt===\"map\",Qt=Ft===\"map\";for(let $t of st){let oe=yt.getTile($t),pe=oe.getBucket(pt);if(!pe||!pe.text||!pe.text.segments.get().length)continue;let he=n.ah(pe.textSizeData,St.zoom),be=Dt(oe,1,At.transform.zoom),Ze=ve($t.posMatrix,Qt,Bt,At.transform,be),Kr=pt.layout.get(\"icon-text-fit\")!==\"none\"&&pe.hasIconData();if(he){let Ee=Math.pow(2,St.zoom-oe.tileID.overscaledZ);Qp(pe,Bt,Qt,Ht,St,Ze,$t.posMatrix,Ee,he,Kr,At.style.map.terrain?(pr,tr)=>At.style.map.terrain.getElevation($t,pr,tr):null)}}}(U,M,B,O,B.layout.get(\"text-rotation-alignment\"),B.layout.get(\"text-pitch-alignment\"),W),B.paint.get(\"icon-opacity\").constantOr(1)!==0&&wt(M,O,B,U,!1,B.paint.get(\"icon-translate\"),B.paint.get(\"icon-translate-anchor\"),B.layout.get(\"icon-rotation-alignment\"),B.layout.get(\"icon-pitch-alignment\"),B.layout.get(\"icon-keep-upright\"),Z,$),B.paint.get(\"text-opacity\").constantOr(1)!==0&&wt(M,O,B,U,!0,B.paint.get(\"text-translate\"),B.paint.get(\"text-translate-anchor\"),B.layout.get(\"text-rotation-alignment\"),B.layout.get(\"text-pitch-alignment\"),B.layout.get(\"text-keep-upright\"),Z,$),O.map.showCollisionBoxes&&(Km(M,O,B,U,B.paint.get(\"text-translate\"),B.paint.get(\"text-translate-anchor\"),!0),Km(M,O,B,U,B.paint.get(\"icon-translate\"),B.paint.get(\"icon-translate-anchor\"),!1))})(l,d,v,b,this.style.placement.variableOffsets);break;case\"circle\":(function(M,O,B,U){if(M.renderPass!==\"translucent\")return;let W=B.paint.get(\"circle-opacity\"),Z=B.paint.get(\"circle-stroke-width\"),$=B.paint.get(\"circle-stroke-opacity\"),st=!B.layout.get(\"circle-sort-key\").isConstant();if(W.constantOr(1)===0&&(Z.constantOr(1)===0||$.constantOr(1)===0))return;let At=M.context,pt=At.gl,yt=M.depthModeForSublayer(0,ci.ReadOnly),dt=Je.disabled,Ft=M.colorModeForRenderPass(),Ht=[];for(let St=0;StSt.sortKey-Bt.sortKey);for(let St of Ht){let{programConfiguration:Bt,program:Qt,layoutVertexBuffer:$t,indexBuffer:oe,uniformValues:pe,terrainData:he}=St.state;Qt.draw(At,pt.TRIANGLES,yt,dt,Ft,It.disabled,pe,he,B.id,$t,oe,St.segments,B.paint,M.transform.zoom,Bt)}})(l,d,v,b);break;case\"heatmap\":(function(M,O,B,U){if(B.paint.get(\"heatmap-opacity\")!==0)if(M.renderPass===\"offscreen\"){let W=M.context,Z=W.gl,$=Je.disabled,st=new Ji([Z.ONE,Z.ONE],n.aT.transparent,[!0,!0,!0,!0]);(function(At,pt,yt){let dt=At.gl;At.activeTexture.set(dt.TEXTURE1),At.viewport.set([0,0,pt.width/4,pt.height/4]);let Ft=yt.heatmapFbo;if(Ft)dt.bindTexture(dt.TEXTURE_2D,Ft.colorAttachment.get()),At.bindFramebuffer.set(Ft.framebuffer);else{let Ht=dt.createTexture();dt.bindTexture(dt.TEXTURE_2D,Ht),dt.texParameteri(dt.TEXTURE_2D,dt.TEXTURE_WRAP_S,dt.CLAMP_TO_EDGE),dt.texParameteri(dt.TEXTURE_2D,dt.TEXTURE_WRAP_T,dt.CLAMP_TO_EDGE),dt.texParameteri(dt.TEXTURE_2D,dt.TEXTURE_MIN_FILTER,dt.LINEAR),dt.texParameteri(dt.TEXTURE_2D,dt.TEXTURE_MAG_FILTER,dt.LINEAR),Ft=yt.heatmapFbo=At.createFramebuffer(pt.width/4,pt.height/4,!1,!1),function(St,Bt,Qt,$t){var oe,pe;let he=St.gl,be=(oe=St.HALF_FLOAT)!==null&&oe!==void 0?oe:he.UNSIGNED_BYTE,Ze=(pe=St.RGBA16F)!==null&&pe!==void 0?pe:he.RGBA;he.texImage2D(he.TEXTURE_2D,0,Ze,Bt.width/4,Bt.height/4,0,he.RGBA,be,null),$t.colorAttachment.set(Qt)}(At,pt,Ht,Ft)}})(W,M,B),W.clear({color:n.aT.transparent});for(let At=0;At{let St=n.Z();n.aS(St,0,yt.width,yt.height,0,0,1);let Bt=yt.context.gl;return{u_matrix:St,u_world:[Bt.drawingBufferWidth,Bt.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:dt.paint.get(\"heatmap-opacity\")}})(W,Z),null,Z.id,W.viewportBuffer,W.quadTriangleIndexBuffer,W.viewportSegments,Z.paint,W.transform.zoom)}(M,B))})(l,d,v,b);break;case\"line\":(function(M,O,B,U){if(M.renderPass!==\"translucent\")return;let W=B.paint.get(\"line-opacity\"),Z=B.paint.get(\"line-width\");if(W.constantOr(1)===0||Z.constantOr(1)===0)return;let $=M.depthModeForSublayer(0,ci.ReadOnly),st=M.colorModeForRenderPass(),At=B.paint.get(\"line-dasharray\"),pt=B.paint.get(\"line-pattern\"),yt=pt.constantOr(1),dt=B.paint.get(\"line-gradient\"),Ft=B.getCrossfadeParameters(),Ht=yt?\"linePattern\":At?\"lineSDF\":dt?\"lineGradient\":\"line\",St=M.context,Bt=St.gl,Qt=!0;for(let $t of U){let oe=O.getTile($t);if(yt&&!oe.patternsLoaded())continue;let pe=oe.getBucket(B);if(!pe)continue;let he=pe.programConfigurations.get(B.id),be=M.context.program.get(),Ze=M.useProgram(Ht,he),Kr=Qt||Ze.program!==be,Ee=M.style.map.terrain&&M.style.map.terrain.getTerrainData($t),pr=pt.constantOr(null);if(pr&&oe.imageAtlas){let Jr=oe.imageAtlas,Vr=Jr.patternPositions[pr.to.toString()],ei=Jr.patternPositions[pr.from.toString()];Vr&&ei&&he.setConstantPatternPositions(Vr,ei)}let tr=Ee?$t:null,Gi=yt?Ts(M,oe,B,Ft,tr):At?Vs(M,oe,B,At,Ft,tr):dt?is(M,oe,B,pe.lineClipsArray.length,tr):ti(M,oe,B,tr);if(yt)St.activeTexture.set(Bt.TEXTURE0),oe.imageAtlasTexture.bind(Bt.LINEAR,Bt.CLAMP_TO_EDGE),he.updatePaintBuffers(Ft);else if(At&&(Kr||M.lineAtlas.dirty))St.activeTexture.set(Bt.TEXTURE0),M.lineAtlas.bind(St);else if(dt){let Jr=pe.gradients[B.id],Vr=Jr.texture;if(B.gradientVersion!==Jr.version){let ei=256;if(B.stepInterpolant){let On=O.getSource().maxzoom,tn=$t.canonical.z===On?Math.ceil(1<0?d.pop():null}isPatternMissing(l){if(!l)return!1;if(!l.from||!l.to)return!0;let d=this.imageManager.getPattern(l.from.toString()),v=this.imageManager.getPattern(l.to.toString());return!d||!v}useProgram(l,d){this.cache=this.cache||{};let v=l+(d?d.cacheKey:\"\")+(this._showOverdrawInspector?\"/overdraw\":\"\")+(this.style.map.terrain?\"/terrain\":\"\");return this.cache[v]||(this.cache[v]=new pu(this.context,Ki[l],d,Wm[l],this._showOverdrawInspector,this.style.map.terrain)),this.cache[v]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let l=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(l.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement(\"canvas\"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new qt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:l,drawingBufferHeight:d}=this.context.gl;return this.width!==l||this.height!==d}}class fi{constructor(l,d){this.points=l,this.planes=d}static fromInvProjectionMatrix(l,d,v){let b=Math.pow(2,v),M=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(B=>{let U=1/(B=n.ag([],B,l))[3]/d*b;return n.b3(B,B,[U,U,1/B[3],U])}),O=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(B=>{let U=function(st,At){var pt=At[0],yt=At[1],dt=At[2],Ft=pt*pt+yt*yt+dt*dt;return Ft>0&&(Ft=1/Math.sqrt(Ft)),st[0]=At[0]*Ft,st[1]=At[1]*Ft,st[2]=At[2]*Ft,st}([],function(st,At,pt){var yt=At[0],dt=At[1],Ft=At[2],Ht=pt[0],St=pt[1],Bt=pt[2];return st[0]=dt*Bt-Ft*St,st[1]=Ft*Ht-yt*Bt,st[2]=yt*St-dt*Ht,st}([],ut([],M[B[0]],M[B[1]]),ut([],M[B[2]],M[B[1]]))),W=-((Z=U)[0]*($=M[B[1]])[0]+Z[1]*$[1]+Z[2]*$[2]);var Z,$;return U.concat(W)});return new fi(M,O)}}class mu{constructor(l,d){this.min=l,this.max=d,this.center=function(v,b,M){return v[0]=.5*b[0],v[1]=.5*b[1],v[2]=.5*b[2],v}([],function(v,b,M){return v[0]=b[0]+M[0],v[1]=b[1]+M[1],v[2]=b[2]+M[2],v}([],this.min,this.max))}quadrant(l){let d=[l%2==0,l<2],v=K(this.min),b=K(this.max);for(let M=0;M=0&&O++;if(O===0)return 0;O!==d.length&&(v=!1)}if(v)return 2;for(let b=0;b<3;b++){let M=Number.MAX_VALUE,O=-Number.MAX_VALUE;for(let B=0;Bthis.max[b]-this.min[b])return 0}return 1}}class vf{constructor(l=0,d=0,v=0,b=0){if(isNaN(l)||l<0||isNaN(d)||d<0||isNaN(v)||v<0||isNaN(b)||b<0)throw new Error(\"Invalid value for edge-insets, top, bottom, left and right must all be numbers\");this.top=l,this.bottom=d,this.left=v,this.right=b}interpolate(l,d,v){return d.top!=null&&l.top!=null&&(this.top=n.B.number(l.top,d.top,v)),d.bottom!=null&&l.bottom!=null&&(this.bottom=n.B.number(l.bottom,d.bottom,v)),d.left!=null&&l.left!=null&&(this.left=n.B.number(l.left,d.left,v)),d.right!=null&&l.right!=null&&(this.right=n.B.number(l.right,d.right,v)),this}getCenter(l,d){let v=n.ad((this.left+l-this.right)/2,0,l),b=n.ad((this.top+d-this.bottom)/2,0,d);return new n.P(v,b)}equals(l){return this.top===l.top&&this.bottom===l.bottom&&this.left===l.left&&this.right===l.right}clone(){return new vf(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Kp{constructor(l,d,v,b,M){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=M===void 0||!!M,this._minZoom=l||0,this._maxZoom=d||22,this._minPitch=v??0,this._maxPitch=b??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new n.L(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new vf,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){let l=new Kp(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return l.apply(this),l}apply(l){this.tileSize=l.tileSize,this.latRange=l.latRange,this.width=l.width,this.height=l.height,this._center=l._center,this._elevation=l._elevation,this._minEleveationForCurrentTile=l._minEleveationForCurrentTile,this.zoom=l.zoom,this.angle=l.angle,this._fov=l._fov,this._pitch=l._pitch,this._unmodified=l._unmodified,this._edgeInsets=l._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(l){this._minZoom!==l&&(this._minZoom=l,this.zoom=Math.max(this.zoom,l))}get maxZoom(){return this._maxZoom}set maxZoom(l){this._maxZoom!==l&&(this._maxZoom=l,this.zoom=Math.min(this.zoom,l))}get minPitch(){return this._minPitch}set minPitch(l){this._minPitch!==l&&(this._minPitch=l,this.pitch=Math.max(this.pitch,l))}get maxPitch(){return this._maxPitch}set maxPitch(l){this._maxPitch!==l&&(this._maxPitch=l,this.pitch=Math.min(this.pitch,l))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(l){l===void 0?l=!0:l===null&&(l=!1),this._renderWorldCopies=l}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new n.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(l){let d=-n.b5(l,-180,180)*Math.PI/180;this.angle!==d&&(this._unmodified=!1,this.angle=d,this._calcMatrices(),this.rotationMatrix=function(){var v=new n.A(4);return n.A!=Float32Array&&(v[1]=0,v[2]=0),v[0]=1,v[3]=1,v}(),function(v,b,M){var O=b[0],B=b[1],U=b[2],W=b[3],Z=Math.sin(M),$=Math.cos(M);v[0]=O*$+U*Z,v[1]=B*$+W*Z,v[2]=O*-Z+U*$,v[3]=B*-Z+W*$}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(l){let d=n.ad(l,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==d&&(this._unmodified=!1,this._pitch=d,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(l){l=Math.max(.01,Math.min(60,l)),this._fov!==l&&(this._unmodified=!1,this._fov=l/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(l){let d=Math.min(Math.max(l,this.minZoom),this.maxZoom);this._zoom!==d&&(this._unmodified=!1,this._zoom=d,this.tileZoom=Math.max(0,Math.floor(d)),this.scale=this.zoomScale(d),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(l){l.lat===this._center.lat&&l.lng===this._center.lng||(this._unmodified=!1,this._center=l,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(l){l!==this._elevation&&(this._elevation=l,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(l){this._edgeInsets.equals(l)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,l,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(l){return this._edgeInsets.equals(l)}interpolatePadding(l,d,v){this._unmodified=!1,this._edgeInsets.interpolate(l,d,v),this._constrain(),this._calcMatrices()}coveringZoomLevel(l){let d=(l.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/l.tileSize));return Math.max(0,d)}getVisibleUnwrappedCoordinates(l){let d=[new n.b6(0,l)];if(this._renderWorldCopies){let v=this.pointCoordinate(new n.P(0,0)),b=this.pointCoordinate(new n.P(this.width,0)),M=this.pointCoordinate(new n.P(this.width,this.height)),O=this.pointCoordinate(new n.P(0,this.height)),B=Math.floor(Math.min(v.x,b.x,M.x,O.x)),U=Math.floor(Math.max(v.x,b.x,M.x,O.x)),W=1;for(let Z=B-W;Z<=U+W;Z++)Z!==0&&d.push(new n.b6(Z,l))}return d}coveringTiles(l){var d,v;let b=this.coveringZoomLevel(l),M=b;if(l.minzoom!==void 0&&bl.maxzoom&&(b=l.maxzoom);let O=this.pointCoordinate(this.getCameraPoint()),B=n.U.fromLngLat(this.center),U=Math.pow(2,b),W=[U*O.x,U*O.y,0],Z=[U*B.x,U*B.y,0],$=fi.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,b),st=l.minzoom||0;!l.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(st=b);let At=l.terrain?2/Math.min(this.tileSize,l.tileSize)*this.tileSize:3,pt=St=>({aabb:new mu([St*U,0,0],[(St+1)*U,U,0]),zoom:0,x:0,y:0,wrap:St,fullyVisible:!1}),yt=[],dt=[],Ft=b,Ht=l.reparseOverscaled?M:b;if(this._renderWorldCopies)for(let St=1;St<=3;St++)yt.push(pt(-St)),yt.push(pt(St));for(yt.push(pt(0));yt.length>0;){let St=yt.pop(),Bt=St.x,Qt=St.y,$t=St.fullyVisible;if(!$t){let Ze=St.aabb.intersects($);if(Ze===0)continue;$t=Ze===2}let oe=l.terrain?W:Z,pe=St.aabb.distanceX(oe),he=St.aabb.distanceY(oe),be=Math.max(Math.abs(pe),Math.abs(he));if(St.zoom===Ft||be>At+(1<=st){let Ze=Ft-St.zoom,Kr=W[0]-.5-(Bt<>1),pr=St.zoom+1,tr=St.aabb.quadrant(Ze);if(l.terrain){let Gi=new n.O(pr,St.wrap,pr,Kr,Ee),Jr=l.terrain.getMinMaxElevation(Gi),Vr=(d=Jr.minElevation)!==null&&d!==void 0?d:this.elevation,ei=(v=Jr.maxElevation)!==null&&v!==void 0?v:this.elevation;tr=new mu([tr.min[0],tr.min[1],Vr],[tr.max[0],tr.max[1],ei])}yt.push({aabb:tr,zoom:pr,x:Kr,y:Ee,wrap:St.wrap,fullyVisible:$t})}}return dt.sort((St,Bt)=>St.distanceSq-Bt.distanceSq).map(St=>St.tileID)}resize(l,d){this.width=l,this.height=d,this.pixelsToGLUnits=[2/l,-2/d],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(l){return Math.pow(2,l)}scaleZoom(l){return Math.log(l)/Math.LN2}project(l){let d=n.ad(l.lat,-this.maxValidLatitude,this.maxValidLatitude);return new n.P(n.G(l.lng)*this.worldSize,n.H(d)*this.worldSize)}unproject(l){return new n.U(l.x/this.worldSize,l.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(l){let d=this.pointLocation(this.centerPoint,l),v=l.getElevationForLngLatZoom(d,this.tileZoom);if(!(this.elevation-v))return;let b=this.getCameraPosition(),M=n.U.fromLngLat(b.lngLat,b.altitude),O=n.U.fromLngLat(d,v),B=M.x-O.x,U=M.y-O.y,W=M.z-O.z,Z=Math.sqrt(B*B+U*U+W*W),$=this.scaleZoom(this.cameraToCenterDistance/Z/this.tileSize);this._elevation=v,this._center=d,this.zoom=$}setLocationAtPoint(l,d){let v=this.pointCoordinate(d),b=this.pointCoordinate(this.centerPoint),M=this.locationCoordinate(l),O=new n.U(M.x-(v.x-b.x),M.y-(v.y-b.y));this.center=this.coordinateLocation(O),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(l,d){return d?this.coordinatePoint(this.locationCoordinate(l),d.getElevationForLngLatZoom(l,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(l))}pointLocation(l,d){return this.coordinateLocation(this.pointCoordinate(l,d))}locationCoordinate(l){return n.U.fromLngLat(l)}coordinateLocation(l){return l&&l.toLngLat()}pointCoordinate(l,d){if(d){let st=d.pointCoordinate(l);if(st!=null)return st}let v=[l.x,l.y,0,1],b=[l.x,l.y,1,1];n.ag(v,v,this.pixelMatrixInverse),n.ag(b,b,this.pixelMatrixInverse);let M=v[3],O=b[3],B=v[1]/M,U=b[1]/O,W=v[2]/M,Z=b[2]/O,$=W===Z?0:(0-W)/(Z-W);return new n.U(n.B.number(v[0]/M,b[0]/O,$)/this.worldSize,n.B.number(B,U,$)/this.worldSize)}coordinatePoint(l,d=0,v=this.pixelMatrix){let b=[l.x*this.worldSize,l.y*this.worldSize,d,1];return n.ag(b,b,v),new n.P(b[0]/b[3],b[1]/b[3])}getBounds(){let l=Math.max(0,this.height/2-this.getHorizon());return new Si().extend(this.pointLocation(new n.P(0,l))).extend(this.pointLocation(new n.P(this.width,l))).extend(this.pointLocation(new n.P(this.width,this.height))).extend(this.pointLocation(new n.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Si([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(l){l?(this.lngRange=[l.getWest(),l.getEast()],this.latRange=[l.getSouth(),l.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(l,d=!1){let v=l.key,b=d?this._alignedPosMatrixCache:this._posMatrixCache;if(b[v])return b[v];let M=l.canonical,O=this.worldSize/this.zoomScale(M.z),B=M.x+Math.pow(2,M.z)*l.wrap,U=n.ao(new Float64Array(16));return n.$(U,U,[B*O,M.y*O,0]),n.a0(U,U,[O/n.N,O/n.N,1]),n.a1(U,d?this.alignedProjMatrix:this.projMatrix,U),b[v]=new Float32Array(U),b[v]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let l,d,v,b,M=-90,O=90,B=-180,U=180,W=this.size,Z=this._unmodified;if(this.latRange){let At=this.latRange;M=n.H(At[1])*this.worldSize,O=n.H(At[0])*this.worldSize,l=O-MO&&(b=O-pt)}if(this.lngRange){let At=(B+U)/2,pt=n.b5($.x,At-this.worldSize/2,At+this.worldSize/2),yt=W.x/2;pt-ytU&&(v=U-yt)}v===void 0&&b===void 0||(this.center=this.unproject(new n.P(v!==void 0?v:$.x,b!==void 0?b:$.y)).wrap()),this._unmodified=Z,this._constraining=!1}_calcMatrices(){if(!this.height)return;let l=this.centerOffset,d=this.point.x,v=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=n.b7(1,this.center.lat)*this.worldSize;let b=n.ao(new Float64Array(16));n.a0(b,b,[this.width/2,-this.height/2,1]),n.$(b,b,[1,-1,0]),this.labelPlaneMatrix=b,b=n.ao(new Float64Array(16)),n.a0(b,b,[1,-1,1]),n.$(b,b,[-1,-1,0]),n.a0(b,b,[2/this.width,2/this.height,1]),this.glCoordMatrix=b;let M=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),O=Math.min(this.elevation,this._minEleveationForCurrentTile),B=M-O*this._pixelPerMeter/Math.cos(this._pitch),U=O<0?B:M,W=Math.PI/2+this._pitch,Z=this._fov*(.5+l.y/this.height),$=Math.sin(Z)*U/Math.sin(n.ad(Math.PI-W-Z,.01,Math.PI-.01)),st=this.getHorizon(),At=2*Math.atan(st/this.cameraToCenterDistance)*(.5+l.y/(2*st)),pt=Math.sin(At)*U/Math.sin(n.ad(Math.PI-W-At,.01,Math.PI-.01)),yt=Math.min($,pt),dt=1.01*(Math.cos(Math.PI/2-this._pitch)*yt+U),Ft=this.height/50;b=new Float64Array(16),n.b8(b,this._fov,this.width/this.height,Ft,dt),b[8]=2*-l.x/this.width,b[9]=2*l.y/this.height,n.a0(b,b,[1,-1,1]),n.$(b,b,[0,0,-this.cameraToCenterDistance]),n.b9(b,b,this._pitch),n.ae(b,b,this.angle),n.$(b,b,[-d,-v,0]),this.mercatorMatrix=n.a0([],b,[this.worldSize,this.worldSize,this.worldSize]),n.a0(b,b,[1,1,this._pixelPerMeter]),this.pixelMatrix=n.a1(new Float64Array(16),this.labelPlaneMatrix,b),n.$(b,b,[0,0,-this.elevation]),this.projMatrix=b,this.invProjMatrix=n.as([],b),this.pixelMatrix3D=n.a1(new Float64Array(16),this.labelPlaneMatrix,b);let Ht=this.width%2/2,St=this.height%2/2,Bt=Math.cos(this.angle),Qt=Math.sin(this.angle),$t=d-Math.round(d)+Bt*Ht+Qt*St,oe=v-Math.round(v)+Bt*St+Qt*Ht,pe=new Float64Array(b);if(n.$(pe,pe,[$t>.5?$t-1:$t,oe>.5?oe-1:oe,0]),this.alignedProjMatrix=pe,b=n.as(new Float64Array(16),this.pixelMatrix),!b)throw new Error(\"failed to invert matrix\");this.pixelMatrixInverse=b,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let l=this.pointCoordinate(new n.P(0,0)),d=[l.x*this.worldSize,l.y*this.worldSize,0,1];return n.ag(d,d,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let l=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new n.P(0,l))}getCameraQueryGeometry(l){let d=this.getCameraPoint();if(l.length===1)return[l[0],d];{let v=d.x,b=d.y,M=d.x,O=d.y;for(let B of l)v=Math.min(v,B.x),b=Math.min(b,B.y),M=Math.max(M,B.x),O=Math.max(O,B.y);return[new n.P(v,b),new n.P(M,b),new n.P(M,O),new n.P(v,O),new n.P(v,b)]}}}function lh(T,l){let d,v=!1,b=null,M=null,O=()=>{b=null,v&&(T.apply(M,d),b=setTimeout(O,l),v=!1)};return(...B)=>(v=!0,M=this,d=B,b||O(),b)}class Ld{constructor(l){this._getCurrentHash=()=>{let d=window.location.hash.replace(\"#\",\"\");if(this._hashName){let v;return d.split(\"&\").map(b=>b.split(\"=\")).forEach(b=>{b[0]===this._hashName&&(v=b)}),(v&&v[1]||\"\").split(\"/\")}return d.split(\"/\")},this._onHashChange=()=>{let d=this._getCurrentHash();if(d.length>=3&&!d.some(v=>isNaN(v))){let v=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(d[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+d[2],+d[1]],zoom:+d[0],bearing:v,pitch:+(d[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{let d=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,d)}catch{}},this._updateHash=lh(this._updateHashUnthrottled,300),this._hashName=l&&encodeURIComponent(l)}addTo(l){return this._map=l,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()),delete this._map,this}getHashString(l){let d=this._map.getCenter(),v=Math.round(100*this._map.getZoom())/100,b=Math.ceil((v*Math.LN2+Math.log(512/360/.5))/Math.LN10),M=Math.pow(10,b),O=Math.round(d.lng*M)/M,B=Math.round(d.lat*M)/M,U=this._map.getBearing(),W=this._map.getPitch(),Z=\"\";if(Z+=l?`/${O}/${B}/${v}`:`${v}/${B}/${O}`,(U||W)&&(Z+=\"/\"+Math.round(10*U)/10),W&&(Z+=`/${Math.round(W)}`),this._hashName){let $=this._hashName,st=!1,At=window.location.hash.slice(1).split(\"&\").map(pt=>{let yt=pt.split(\"=\")[0];return yt===$?(st=!0,`${yt}=${Z}`):pt}).filter(pt=>pt);return st||At.push(`${$}=${Z}`),`#${At.join(\"&\")}`}return`#${Z}`}}let ch={linearity:.3,easing:n.ba(0,0,.3,1)},Jp=n.e({deceleration:2500,maxSpeed:1400},ch),tA=n.e({deceleration:20,maxSpeed:1400},ch),A_=n.e({deceleration:1e3,maxSpeed:360},ch),m_=n.e({deceleration:1e3,maxSpeed:90},ch);class n0{constructor(l){this._map=l,this.clear()}clear(){this._inertiaBuffer=[]}record(l){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:n.h.now(),settings:l})}_drainInertiaBuffer(){let l=this._inertiaBuffer,d=n.h.now();for(;l.length>0&&d-l[0].time>160;)l.shift()}_onMoveEnd(l){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let d={zoom:0,bearing:0,pitch:0,pan:new n.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:M}of this._inertiaBuffer)d.zoom+=M.zoomDelta||0,d.bearing+=M.bearingDelta||0,d.pitch+=M.pitchDelta||0,M.panDelta&&d.pan._add(M.panDelta),M.around&&(d.around=M.around),M.pinchAround&&(d.pinchAround=M.pinchAround);let v=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,b={};if(d.pan.mag()){let M=uh(d.pan.mag(),v,n.e({},Jp,l||{}));b.offset=d.pan.mult(M.amount/d.pan.mag()),b.center=this._map.transform.center,pl(b,M)}if(d.zoom){let M=uh(d.zoom,v,tA);b.zoom=this._map.transform.zoom+M.amount,pl(b,M)}if(d.bearing){let M=uh(d.bearing,v,A_);b.bearing=this._map.transform.bearing+n.ad(M.amount,-179,179),pl(b,M)}if(d.pitch){let M=uh(d.pitch,v,m_);b.pitch=this._map.transform.pitch+M.amount,pl(b,M)}if(b.zoom||b.bearing){let M=d.pinchAround===void 0?d.around:d.pinchAround;b.around=M?this._map.unproject(M):this._map.getCenter()}return this.clear(),n.e(b,{noMoveStart:!0})}}function pl(T,l){(!T.duration||T.durationd.unproject(U)),B=M.reduce((U,W,Z,$)=>U.add(W.div($.length)),new n.P(0,0));super(l,{points:M,point:B,lngLats:O,lngLat:d.unproject(B),originalEvent:v}),this._defaultPrevented=!1}}class g_ extends n.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(l,d,v){super(l,{originalEvent:v}),this._defaultPrevented=!1}}class js{constructor(l,d){this._map=l,this._clickTolerance=d.clickTolerance}reset(){delete this._mousedownPos}wheel(l){return this._firePreventable(new g_(l.type,this._map,l))}mousedown(l,d){return this._mousedownPos=d,this._firePreventable(new la(l.type,this._map,l))}mouseup(l){this._map.fire(new la(l.type,this._map,l))}click(l,d){this._mousedownPos&&this._mousedownPos.dist(d)>=this._clickTolerance||this._map.fire(new la(l.type,this._map,l))}dblclick(l){return this._firePreventable(new la(l.type,this._map,l))}mouseover(l){this._map.fire(new la(l.type,this._map,l))}mouseout(l){this._map.fire(new la(l.type,this._map,l))}touchstart(l){return this._firePreventable(new kd(l.type,this._map,l))}touchmove(l){this._map.fire(new kd(l.type,this._map,l))}touchend(l){this._map.fire(new kd(l.type,this._map,l))}touchcancel(l){this._map.fire(new kd(l.type,this._map,l))}_firePreventable(l){if(this._map.fire(l),l.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class gu{constructor(l){this._map=l}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(l){this._map.fire(new la(l.type,this._map,l))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new la(\"contextmenu\",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(l){this._delayContextMenu?this._contextMenuEvent=l:this._ignoreContextMenu||this._map.fire(new la(l.type,this._map,l)),this._map.listens(\"contextmenu\")&&l.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ln{constructor(l){this._map=l}get transform(){return this._map._requestedCameraState||this._map.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(l){return this.transform.pointLocation(n.P.convert(l),this._map.terrain)}}class eA{constructor(l,d){this._map=l,this._tr=new Ln(l),this._el=l.getCanvasContainer(),this._container=l.getContainer(),this._clickTolerance=d.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(l,d){this.isEnabled()&&l.shiftKey&&l.button===0&&(c.disableDrag(),this._startPos=this._lastPos=d,this._active=!0)}mousemoveWindow(l,d){if(!this._active)return;let v=d;if(this._lastPos.equals(v)||!this._box&&v.dist(this._startPos)M.fitScreenCoordinates(v,b,this._tr.bearing,{linear:!0})};this._fireEvent(\"boxzoomcancel\",l)}keydown(l){this._active&&l.keyCode===27&&(this.reset(),this._fireEvent(\"boxzoomcancel\",l))}reset(){this._active=!1,this._container.classList.remove(\"maplibregl-crosshair\"),this._box&&(c.remove(this._box),this._box=null),c.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(l,d){return this._map.fire(new n.k(l,{originalEvent:d}))}}function ca(T,l){if(T.length!==l.length)throw new Error(`The number of touches and points are not equal - touches ${T.length}, points ${l.length}`);let d={};for(let v=0;vthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=l.timeStamp),v.length===this.numTouches&&(this.centroid=function(b){let M=new n.P(0,0);for(let O of b)M._add(O);return M.div(b.length)}(d),this.touches=ca(v,d)))}touchmove(l,d,v){if(this.aborted||!this.centroid)return;let b=ca(v,d);for(let M in this.touches){let O=b[M];(!O||O.dist(this.touches[M])>30)&&(this.aborted=!0)}}touchend(l,d,v){if((!this.centroid||l.timeStamp-this.startTime>500)&&(this.aborted=!0),v.length===0){let b=!this.aborted&&this.centroid;if(this.reset(),b)return b}}}class Rd{constructor(l){this.singleTap=new Fa(l),this.numTaps=l.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(l,d,v){this.singleTap.touchstart(l,d,v)}touchmove(l,d,v){this.singleTap.touchmove(l,d,v)}touchend(l,d,v){let b=this.singleTap.touchend(l,d,v);if(b){let M=l.timeStamp-this.lastTime<500,O=!this.lastTap||this.lastTap.dist(b)<30;if(M&&O||this.reset(),this.count++,this.lastTime=l.timeStamp,this.lastTap=b,this.count===this.numTaps)return this.reset(),b}}}class Al{constructor(l){this._tr=new Ln(l),this._zoomIn=new Rd({numTouches:1,numTaps:2}),this._zoomOut=new Rd({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(l,d,v){this._zoomIn.touchstart(l,d,v),this._zoomOut.touchstart(l,d,v)}touchmove(l,d,v){this._zoomIn.touchmove(l,d,v),this._zoomOut.touchmove(l,d,v)}touchend(l,d,v){let b=this._zoomIn.touchend(l,d,v),M=this._zoomOut.touchend(l,d,v),O=this._tr;return b?(this._active=!0,l.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:B=>B.easeTo({duration:300,zoom:O.zoom+1,around:O.unproject(b)},{originalEvent:l})}):M?(this._active=!0,l.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:B=>B.easeTo({duration:300,zoom:O.zoom-1,around:O.unproject(M)},{originalEvent:l})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class za{constructor(l){this._enabled=!!l.enable,this._moveStateManager=l.moveStateManager,this._clickTolerance=l.clickTolerance||1,this._moveFunction=l.move,this._activateOnStart=!!l.activateOnStart,l.assignEvents(this),this.reset()}reset(l){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(l)}_move(...l){let d=this._moveFunction(...l);if(d.bearingDelta||d.pitchDelta||d.around||d.panDelta)return this._active=!0,d}dragStart(l,d){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(l)&&(this._moveStateManager.startMove(l),this._lastPoint=d.length?d[0]:d,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(l,d){if(!this.isEnabled())return;let v=this._lastPoint;if(!v)return;if(l.preventDefault(),!this._moveStateManager.isValidMoveEvent(l))return void this.reset(l);let b=d.length?d[0]:d;return!this._moved&&b.dist(v){T.mousedown=T.dragStart,T.mousemoveWindow=T.dragMove,T.mouseup=T.dragEnd,T.contextmenu=function(l){l.preventDefault()}},Na=({enable:T,clickTolerance:l,bearingDegreesPerPixelMoved:d=.8})=>{let v=new rA({checkCorrectEvent:b=>c.mouseButton(b)===0&&b.ctrlKey||c.mouseButton(b)===2});return new za({clickTolerance:l,move:(b,M)=>({bearingDelta:(M.x-b.x)*d}),moveStateManager:v,enable:T,assignEvents:fh})},co=({enable:T,clickTolerance:l,pitchDegreesPerPixelMoved:d=-.5})=>{let v=new rA({checkCorrectEvent:b=>c.mouseButton(b)===0&&b.ctrlKey||c.mouseButton(b)===2});return new za({clickTolerance:l,move:(b,M)=>({pitchDelta:(M.y-b.y)*d}),moveStateManager:v,enable:T,assignEvents:fh})};class Ge{constructor(l,d){this._minTouches=l.cooperativeGestures?2:1,this._clickTolerance=l.clickTolerance||1,this._map=d,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new n.P(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(l,d,v){return this._calculateTransform(l,d,v)}touchmove(l,d,v){if(this._map._cooperativeGestures&&(this._minTouches===2&&v.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(l,!1,v.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(v.length0&&(this._active=!0);let b=ca(v,d),M=new n.P(0,0),O=new n.P(0,0),B=0;for(let W in b){let Z=b[W],$=this._touches[W];$&&(M._add(Z),O._add(Z.sub($)),B++,b[W]=Z)}if(this._touches=b,BMath.abs(T.x)}class zx extends Dd{constructor(l){super(),this._map=l}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(l,d,v){super.touchstart(l,d,v),this._currentTouchCount=v.length}_start(l){this._lastPoints=l,a0(l[0].sub(l[1]))&&(this._valid=!1)}_move(l,d,v){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;let b=l[0].sub(this._lastPoints[0]),M=l[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(b,M,v.timeStamp),this._valid?(this._lastPoints=l,this._active=!0,{pitchDelta:(b.y+M.y)/2*-.5}):void 0}gestureBeginsVertically(l,d,v){if(this._valid!==void 0)return this._valid;let b=l.mag()>=2,M=d.mag()>=2;if(!b&&!M)return;if(!b||!M)return this._firstMove===void 0&&(this._firstMove=v),v-this._firstMove<100&&void 0;let O=l.y>0==d.y>0;return a0(l)&&a0(d)&&O}}let dh={panStep:100,bearingStep:15,pitchStep:10};class y_{constructor(l){this._tr=new Ln(l);let d=dh;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(l){if(l.altKey||l.ctrlKey||l.metaKey)return;let d=0,v=0,b=0,M=0,O=0;switch(l.keyCode){case 61:case 107:case 171:case 187:d=1;break;case 189:case 109:case 173:d=-1;break;case 37:l.shiftKey?v=-1:(l.preventDefault(),M=-1);break;case 39:l.shiftKey?v=1:(l.preventDefault(),M=1);break;case 38:l.shiftKey?b=1:(l.preventDefault(),O=-1);break;case 40:l.shiftKey?b=-1:(l.preventDefault(),O=1);break;default:return}return this._rotationDisabled&&(v=0,b=0),{cameraAnimation:B=>{let U=this._tr;B.easeTo({duration:300,easeId:\"keyboardHandler\",easing:l0,zoom:d?Math.round(U.zoom)+d*(l.shiftKey?2:1):U.zoom,bearing:U.bearing+v*this._bearingStep,pitch:U.pitch+b*this._pitchStep,offset:[-M*this._panStep,-O*this._panStep],center:U.center},{originalEvent:l})}}}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}}function l0(T){return T*(2-T)}let c0=4.000244140625;class bf{constructor(l,d){this._onTimeout=v=>{this._type=\"wheel\",this._delta-=this._lastValue,this._active||this._start(v)},this._map=l,this._tr=new Ln(l),this._el=l.getCanvasContainer(),this._triggerRenderFrame=d,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(l){this._defaultZoomRate=l}setWheelZoomRate(l){this._wheelZoomRate=l}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(l){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!l&&l.around===\"center\")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(l){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!l[this._map._metaKey])return;l.preventDefault()}let d=l.deltaMode===WheelEvent.DOM_DELTA_LINE?40*l.deltaY:l.deltaY,v=n.h.now(),b=v-(this._lastWheelEventTime||0);this._lastWheelEventTime=v,d!==0&&d%c0==0?this._type=\"wheel\":d!==0&&Math.abs(d)<4?this._type=\"trackpad\":b>400?(this._type=null,this._lastValue=d,this._timeout=setTimeout(this._onTimeout,40,l)):this._type||(this._type=Math.abs(b*d)<200?\"trackpad\":\"wheel\",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,d+=this._lastValue)),l.shiftKey&&d&&(d/=4),this._type&&(this._lastWheelEvent=l,this._delta-=d,this._active||this._start(l)),l.preventDefault()}_start(l){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let d=c.mousePos(this._el,l),v=this._tr;this._around=n.L.convert(this._aroundCenter?v.center:v.unproject(d)),this._aroundPoint=v.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let l=this._tr.transform;if(this._delta!==0){let B=this._type===\"wheel\"&&Math.abs(this._delta)>c0?this._wheelZoomRate:this._defaultZoomRate,U=2/(1+Math.exp(-Math.abs(this._delta*B)));this._delta<0&&U!==0&&(U=1/U);let W=typeof this._targetZoom==\"number\"?l.zoomScale(this._targetZoom):l.scale;this._targetZoom=Math.min(l.maxZoom,Math.max(l.minZoom,l.scaleZoom(W*U))),this._type===\"wheel\"&&(this._startZoom=l.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let d=typeof this._targetZoom==\"number\"?this._targetZoom:l.zoom,v=this._startZoom,b=this._easing,M,O=!1;if(this._type===\"wheel\"&&v&&b){let B=Math.min((n.h.now()-this._lastWheelEventTime)/200,1),U=b(B);M=n.B.number(v,d,U),B<1?this._frameId||(this._frameId=!0):O=!0}else M=d,O=!0;return this._active=!0,O&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!O,zoomDelta:M-l.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(l){let d=n.bb;if(this._prevEase){let v=this._prevEase,b=(n.h.now()-v.start)/v.duration,M=v.easing(b+.01)-v.easing(b),O=.27/Math.sqrt(M*M+1e-4)*.01,B=Math.sqrt(.0729-O*O);d=n.ba(O,B,.25,1)}return this._prevEase={start:n.h.now(),duration:l,easing:d},d}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class u0{constructor(l,d){this._clickZoom=l,this._tapZoom=d}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()}}class iA{constructor(l){this._tr=new Ln(l),this.reset()}reset(){this._active=!1}dblclick(l,d){return l.preventDefault(),{cameraAnimation:v=>{v.easeTo({duration:300,zoom:this._tr.zoom+(l.shiftKey?-1:1),around:this._tr.unproject(d)},{originalEvent:l})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nA{constructor(){this._tap=new Rd({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(l,d,v){if(!this._swipePoint)if(this._tapTime){let b=d[0],M=l.timeStamp-this._tapTime<500,O=this._tapPoint.dist(b)<30;M&&O?v.length>0&&(this._swipePoint=b,this._swipeTouch=v[0].identifier):this.reset()}else this._tap.touchstart(l,d,v)}touchmove(l,d,v){if(this._tapTime){if(this._swipePoint){if(v[0].identifier!==this._swipeTouch)return;let b=d[0],M=b.y-this._swipePoint.y;return this._swipePoint=b,l.preventDefault(),this._active=!0,{zoomDelta:M/128}}}else this._tap.touchmove(l,d,v)}touchend(l,d,v){if(this._tapTime)this._swipePoint&&v.length===0&&this.reset();else{let b=this._tap.touchend(l,d,v);b&&(this._tapTime=l.timeStamp,this._tapPoint=b)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ph{constructor(l,d,v){this._el=l,this._mousePan=d,this._touchPan=v}enable(l){this._inertiaOptions=l||{},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()}}class us{constructor(l,d,v){this._pitchWithRotate=l.pitchWithRotate,this._mouseRotate=d,this._mousePitch=v}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class _u{constructor(l,d,v,b){this._el=l,this._touchZoom=d,this._touchRotate=v,this._tapDragZoom=b,this._rotationDisabled=!1,this._enabled=!0}enable(l){this._touchZoom.enable(l),this._rotationDisabled||this._touchRotate.enable(l),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()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}let Bc=T=>T.zoom||T.drag||T.pitch||T.rotate;class h0 extends n.k{}function Od(T){return T.panDelta&&T.panDelta.mag()||T.zoomDelta||T.bearingDelta||T.pitchDelta}class f0{constructor(l,d){this.handleWindowEvent=b=>{this.handleEvent(b,`${b.type}Window`)},this.handleEvent=(b,M)=>{if(b.type===\"blur\")return void this.stop(!0);this._updatingCamera=!0;let O=b.type===\"renderFrame\"?void 0:b,B={needsRenderFrame:!1},U={},W={},Z=b.touches,$=Z?this._getMapTouches(Z):void 0,st=$?c.touchPos(this._el,$):c.mousePos(this._el,b);for(let{handlerName:yt,handler:dt,allowed:Ft}of this._handlers){if(!dt.isEnabled())continue;let Ht;this._blockedByActive(W,Ft,yt)?dt.reset():dt[M||b.type]&&(Ht=dt[M||b.type](b,st,$),this.mergeHandlerResult(B,U,Ht,yt,O),Ht&&Ht.needsRenderFrame&&this._triggerRenderFrame()),(Ht||dt.isActive())&&(W[yt]=dt)}let At={};for(let yt in this._previousActiveHandlers)W[yt]||(At[yt]=O);this._previousActiveHandlers=W,(Object.keys(At).length||Od(B))&&(this._changes.push([B,U,At]),this._triggerRenderFrame()),(Object.keys(W).length||Od(B))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:pt}=B;pt&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],pt(this._map))},this._map=l,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new n0(l),this._bearingSnap=d.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(d);let v=this._el;this._listeners=[[v,\"touchstart\",{passive:!0}],[v,\"touchmove\",{passive:!1}],[v,\"touchend\",void 0],[v,\"touchcancel\",void 0],[v,\"mousedown\",void 0],[v,\"mousemove\",void 0],[v,\"mouseup\",void 0],[document,\"mousemove\",{capture:!0}],[document,\"mouseup\",void 0],[v,\"mouseover\",void 0],[v,\"mouseout\",void 0],[v,\"dblclick\",void 0],[v,\"click\",void 0],[v,\"keydown\",{capture:!1}],[v,\"keyup\",void 0],[v,\"wheel\",{passive:!1}],[v,\"contextmenu\",void 0],[window,\"blur\",void 0]];for(let[b,M,O]of this._listeners)c.addEventListener(b,M,b===document?this.handleWindowEvent:this.handleEvent,O)}destroy(){for(let[l,d,v]of this._listeners)c.removeEventListener(l,d,l===document?this.handleWindowEvent:this.handleEvent,v)}_addDefaultHandlers(l){let d=this._map,v=d.getCanvasContainer();this._add(\"mapEvent\",new js(d,l));let b=d.boxZoom=new eA(d,l);this._add(\"boxZoom\",b),l.interactive&&l.boxZoom&&b.enable();let M=new Al(d),O=new iA(d);d.doubleClickZoom=new u0(O,M),this._add(\"tapZoom\",M),this._add(\"clickZoom\",O),l.interactive&&l.doubleClickZoom&&d.doubleClickZoom.enable();let B=new nA;this._add(\"tapDragZoom\",B);let U=d.touchPitch=new zx(d);this._add(\"touchPitch\",U),l.interactive&&l.touchPitch&&d.touchPitch.enable(l.touchPitch);let W=Na(l),Z=co(l);d.dragRotate=new us(l,W,Z),this._add(\"mouseRotate\",W,[\"mousePitch\"]),this._add(\"mousePitch\",Z,[\"mouseRotate\"]),l.interactive&&l.dragRotate&&d.dragRotate.enable();let $=(({enable:Ft,clickTolerance:Ht})=>{let St=new rA({checkCorrectEvent:Bt=>c.mouseButton(Bt)===0&&!Bt.ctrlKey});return new za({clickTolerance:Ht,move:(Bt,Qt)=>({around:Qt,panDelta:Qt.sub(Bt)}),activateOnStart:!0,moveStateManager:St,enable:Ft,assignEvents:fh})})(l),st=new Ge(l,d);d.dragPan=new ph(v,$,st),this._add(\"mousePan\",$),this._add(\"touchPan\",st,[\"touchZoom\",\"touchRotate\"]),l.interactive&&l.dragPan&&d.dragPan.enable(l.dragPan);let At=new o0,pt=new __;d.touchZoomRotate=new _u(v,pt,At,B),this._add(\"touchRotate\",At,[\"touchPan\",\"touchZoom\"]),this._add(\"touchZoom\",pt,[\"touchPan\",\"touchRotate\"]),l.interactive&&l.touchZoomRotate&&d.touchZoomRotate.enable(l.touchZoomRotate);let yt=d.scrollZoom=new bf(d,()=>this._triggerRenderFrame());this._add(\"scrollZoom\",yt,[\"mousePan\"]),l.interactive&&l.scrollZoom&&d.scrollZoom.enable(l.scrollZoom);let dt=d.keyboard=new y_(d);this._add(\"keyboard\",dt),l.interactive&&l.keyboard&&d.keyboard.enable(),this._add(\"blockableMapEvent\",new gu(d))}_add(l,d,v){this._handlers.push({handlerName:l,handler:d,allowed:v}),this._handlersById[l]=d}stop(l){if(!this._updatingCamera){for(let{handler:d}of this._handlers)d.reset();this._inertia.clear(),this._fireEvents({},{},l),this._changes=[]}}isActive(){for(let{handler:l}of this._handlers)if(l.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Bc(this._eventsInProgress)||this.isZooming()}_blockedByActive(l,d,v){for(let b in l)if(b!==v&&(!d||d.indexOf(b)<0))return!0;return!1}_getMapTouches(l){let d=[];for(let v of l)this._el.contains(v.target)&&d.push(v);return d}mergeHandlerResult(l,d,v,b,M){if(!v)return;n.e(l,v);let O={handlerName:b,originalEvent:v.originalEvent||M};v.zoomDelta!==void 0&&(d.zoom=O),v.panDelta!==void 0&&(d.drag=O),v.pitchDelta!==void 0&&(d.pitch=O),v.bearingDelta!==void 0&&(d.rotate=O)}_applyChanges(){let l={},d={},v={};for(let[b,M,O]of this._changes)b.panDelta&&(l.panDelta=(l.panDelta||new n.P(0,0))._add(b.panDelta)),b.zoomDelta&&(l.zoomDelta=(l.zoomDelta||0)+b.zoomDelta),b.bearingDelta&&(l.bearingDelta=(l.bearingDelta||0)+b.bearingDelta),b.pitchDelta&&(l.pitchDelta=(l.pitchDelta||0)+b.pitchDelta),b.around!==void 0&&(l.around=b.around),b.pinchAround!==void 0&&(l.pinchAround=b.pinchAround),b.noInertia&&(l.noInertia=b.noInertia),n.e(d,M),n.e(v,O);this._updateMapTransform(l,d,v),this._changes=[]}_updateMapTransform(l,d,v){let b=this._map,M=b._getTransformForUpdate(),O=b.terrain;if(!(Od(l)||O&&this._terrainMovement))return this._fireEvents(d,v,!0);let{panDelta:B,zoomDelta:U,bearingDelta:W,pitchDelta:Z,around:$,pinchAround:st}=l;st!==void 0&&($=st),b._stop(!0),$=$||b.transform.centerPoint;let At=M.pointLocation(B?$.sub(B):$);W&&(M.bearing+=W),Z&&(M.pitch+=Z),U&&(M.zoom+=U),O?this._terrainMovement||!d.drag&&!d.zoom?d.drag&&this._terrainMovement?M.center=M.pointLocation(M.centerPoint.sub(B)):M.setLocationAtPoint(At,$):(this._terrainMovement=!0,this._map._elevationFreeze=!0,M.setLocationAtPoint(At,$),this._map.once(\"moveend\",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,M.recalculateZoom(b.terrain)})):M.setLocationAtPoint(At,$),b._applyUpdatedTransform(M),this._map._update(),l.noInertia||this._inertia.record(l),this._fireEvents(d,v,!0)}_fireEvents(l,d,v){let b=Bc(this._eventsInProgress),M=Bc(l),O={};for(let Z in l){let{originalEvent:$}=l[Z];this._eventsInProgress[Z]||(O[`${Z}start`]=$),this._eventsInProgress[Z]=l[Z]}!b&&M&&this._fireEvent(\"movestart\",M.originalEvent);for(let Z in O)this._fireEvent(Z,O[Z]);M&&this._fireEvent(\"move\",M.originalEvent);for(let Z in l){let{originalEvent:$}=l[Z];this._fireEvent(Z,$)}let B={},U;for(let Z in this._eventsInProgress){let{handlerName:$,originalEvent:st}=this._eventsInProgress[Z];this._handlersById[$].isActive()||(delete this._eventsInProgress[Z],U=d[$]||st,B[`${Z}end`]=U)}for(let Z in B)this._fireEvent(Z,B[Z]);let W=Bc(this._eventsInProgress);if(v&&(b||M)&&!W){this._updatingCamera=!0;let Z=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),$=st=>st!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new h0(\"renderFrame\",{timeStamp:l})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class v_ extends n.E{constructor(l,d){super(),this._renderFrameCallback=()=>{let v=Math.min((n.h.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(v)),v<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=l,this._bearingSnap=d.bearingSnap,this.on(\"moveend\",()=>{delete this._requestedCameraState})}getCenter(){return new n.L(this.transform.center.lng,this.transform.center.lat)}setCenter(l,d){return this.jumpTo({center:l},d)}panBy(l,d,v){return l=n.P.convert(l).mult(-1),this.panTo(this.transform.center,n.e({offset:l},d),v)}panTo(l,d,v){return this.easeTo(n.e({center:l},d),v)}getZoom(){return this.transform.zoom}setZoom(l,d){return this.jumpTo({zoom:l},d),this}zoomTo(l,d,v){return this.easeTo(n.e({zoom:l},d),v)}zoomIn(l,d){return this.zoomTo(this.getZoom()+1,l,d),this}zoomOut(l,d){return this.zoomTo(this.getZoom()-1,l,d),this}getBearing(){return this.transform.bearing}setBearing(l,d){return this.jumpTo({bearing:l},d),this}getPadding(){return this.transform.padding}setPadding(l,d){return this.jumpTo({padding:l},d),this}rotateTo(l,d,v){return this.easeTo(n.e({bearing:l},d),v)}resetNorth(l,d){return this.rotateTo(0,n.e({duration:1e3},l),d),this}resetNorthPitch(l,d){return this.easeTo(n.e({bearing:0,pitch:0,duration:1e3},l),d),this}snapToNorth(l,d){return Math.abs(this.getBearing()){if(this._zooming&&(v.zoom=n.B.number(b,U,$t)),this._rotating&&(v.bearing=n.B.number(M,W,$t)),this._pitching&&(v.pitch=n.B.number(O,Z,$t)),this._padding&&(v.interpolatePadding(B,$,$t),At=v.centerPoint.add(st)),this.terrain&&!l.freezeElevation&&this._updateElevation($t),St)v.setLocationAtPoint(St,Bt);else{let oe=v.zoomScale(v.zoom-b),pe=U>b?Math.min(2,Ht):Math.max(.5,Ht),he=Math.pow(pe,1-$t),be=v.unproject(dt.add(Ft.mult($t*he)).mult(oe));v.setLocationAtPoint(v.renderWorldCopies?be.wrap():be,At)}this._applyUpdatedTransform(v),this._fireMoveEvents(d)},$t=>{this.terrain&&this._finalizeElevation(),this._afterEase(d,$t)},l),this}_prepareEase(l,d,v={}){this._moving=!0,d||v.moving||this.fire(new n.k(\"movestart\",l)),this._zooming&&!v.zooming&&this.fire(new n.k(\"zoomstart\",l)),this._rotating&&!v.rotating&&this.fire(new n.k(\"rotatestart\",l)),this._pitching&&!v.pitching&&this.fire(new n.k(\"pitchstart\",l))}_prepareElevation(l){this._elevationCenter=l,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(l,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(l){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let d=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(l<1&&d!==this._elevationTarget){let v=this._elevationTarget-this._elevationStart;this._elevationStart+=l*(v-(d-(v*l+this._elevationStart))/(1-l)),this._elevationTarget=d}this.transform.elevation=n.B.number(this._elevationStart,this._elevationTarget,l)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(l){if(!this.transformCameraUpdate)return;let d=l.clone(),{center:v,zoom:b,pitch:M,bearing:O,elevation:B}=this.transformCameraUpdate(d);v&&(d.center=v),b!==void 0&&(d.zoom=b),M!==void 0&&(d.pitch=M),O!==void 0&&(d.bearing=O),B!==void 0&&(d.elevation=B),this.transform.apply(d)}_fireMoveEvents(l){this.fire(new n.k(\"move\",l)),this._zooming&&this.fire(new n.k(\"zoom\",l)),this._rotating&&this.fire(new n.k(\"rotate\",l)),this._pitching&&this.fire(new n.k(\"pitch\",l))}_afterEase(l,d){if(this._easeId&&d&&this._easeId===d)return;delete this._easeId;let v=this._zooming,b=this._rotating,M=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,v&&this.fire(new n.k(\"zoomend\",l)),b&&this.fire(new n.k(\"rotateend\",l)),M&&this.fire(new n.k(\"pitchend\",l)),this.fire(new n.k(\"moveend\",l))}flyTo(l,d){if(!l.essential&&n.h.prefersReducedMotion){let tr=n.F(l,[\"center\",\"zoom\",\"bearing\",\"pitch\",\"around\"]);return this.jumpTo(tr,d)}this.stop(),l=n.e({offset:[0,0],speed:1.2,curve:1.42,easing:n.bb},l);let v=this._getTransformForUpdate(),b=this.getZoom(),M=this.getBearing(),O=this.getPitch(),B=this.getPadding(),U=\"zoom\"in l?n.ad(+l.zoom,v.minZoom,v.maxZoom):b,W=\"bearing\"in l?this._normalizeBearing(l.bearing,M):M,Z=\"pitch\"in l?+l.pitch:O,$=\"padding\"in l?l.padding:v.padding,st=v.zoomScale(U-b),At=n.P.convert(l.offset),pt=v.centerPoint.add(At),yt=v.pointLocation(pt),dt=n.L.convert(l.center||yt);this._normalizeCenter(dt);let Ft=v.project(yt),Ht=v.project(dt).sub(Ft),St=l.curve,Bt=Math.max(v.width,v.height),Qt=Bt/st,$t=Ht.mag();if(\"minZoom\"in l){let tr=n.ad(Math.min(l.minZoom,b,U),v.minZoom,v.maxZoom),Gi=Bt/v.zoomScale(tr-b);St=Math.sqrt(Gi/$t*2)}let oe=St*St;function pe(tr){let Gi=(Qt*Qt-Bt*Bt+(tr?-1:1)*oe*oe*$t*$t)/(2*(tr?Qt:Bt)*oe*$t);return Math.log(Math.sqrt(Gi*Gi+1)-Gi)}function he(tr){return(Math.exp(tr)-Math.exp(-tr))/2}function be(tr){return(Math.exp(tr)+Math.exp(-tr))/2}let Ze=pe(!1),Kr=function(tr){return be(Ze)/be(Ze+St*tr)},Ee=function(tr){return Bt*((be(Ze)*(he(Gi=Ze+St*tr)/be(Gi))-he(Ze))/oe)/$t;var Gi},pr=(pe(!0)-Ze)/St;if(Math.abs($t)<1e-6||!isFinite(pr)){if(Math.abs(Bt-Qt)<1e-6)return this.easeTo(l,d);let tr=Qtl.maxDuration&&(l.duration=0),this._zooming=!0,this._rotating=M!==W,this._pitching=Z!==O,this._padding=!v.isPaddingEqual($),this._prepareEase(d,!1),this.terrain&&this._prepareElevation(dt),this._ease(tr=>{let Gi=tr*pr,Jr=1/Kr(Gi);v.zoom=tr===1?U:b+v.scaleZoom(Jr),this._rotating&&(v.bearing=n.B.number(M,W,tr)),this._pitching&&(v.pitch=n.B.number(O,Z,tr)),this._padding&&(v.interpolatePadding(B,$,tr),pt=v.centerPoint.add(At)),this.terrain&&!l.freezeElevation&&this._updateElevation(tr);let Vr=tr===1?dt:v.unproject(Ft.add(Ht.mult(Ee(Gi))).mult(Jr));v.setLocationAtPoint(v.renderWorldCopies?Vr.wrap():Vr,pt),this._applyUpdatedTransform(v),this._fireMoveEvents(d)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(d)},l),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(l,d){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let v=this._onEaseEnd;delete this._onEaseEnd,v.call(this,d)}if(!l){let v=this.handlers;v&&v.stop(!1)}return this}_ease(l,d,v){v.animate===!1||v.duration===0?(l(1),d()):(this._easeStart=n.h.now(),this._easeOptions=v,this._onEaseFrame=l,this._onEaseEnd=d,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(l,d){l=n.b5(l,-180,180);let v=Math.abs(l-d);return Math.abs(l-360-d)180?-360:v<-180?360:0}queryTerrainElevation(l){return this.terrain?this.terrain.getElevationForLngLatZoom(n.L.convert(l),this.transform.tileZoom)-this.transform.elevation:null}}class ua{constructor(l={}){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=d=>{!d||d.sourceDataType!==\"metadata\"&&d.sourceDataType!==\"visibility\"&&d.dataType!==\"style\"&&d.type!==\"terrain\"||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=l}getDefaultPosition(){return\"bottom-right\"}onAdd(l){return this._map=l,this._compact=this.options&&this.options.compact,this._container=c.create(\"details\",\"maplibregl-ctrl maplibregl-ctrl-attrib\"),this._compactButton=c.create(\"summary\",\"maplibregl-ctrl-attrib-button\",this._container),this._compactButton.addEventListener(\"click\",this._toggleAttribution),this._setElementTitle(this._compactButton,\"ToggleAttribution\"),this._innerContainer=c.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(){c.remove(this._container),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(l,d){let v=this._map._getUIString(`AttributionControl.${d}`);l.title=v,l.setAttribute(\"aria-label\",v)}_updateAttributions(){if(!this._map.style)return;let l=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?l=l.concat(this.options.customAttribution.map(b=>typeof b!=\"string\"?\"\":b)):typeof this.options.customAttribution==\"string\"&&l.push(this.options.customAttribution)),this._map.style.stylesheet){let b=this._map.style.stylesheet;this.styleOwner=b.owner,this.styleId=b.id}let d=this._map.style.sourceCaches;for(let b in d){let M=d[b];if(M.used||M.usedForTerrain){let O=M.getSource();O.attribution&&l.indexOf(O.attribution)<0&&l.push(O.attribution)}}l=l.filter(b=>String(b).trim()),l.sort((b,M)=>b.length-M.length),l=l.filter((b,M)=>{for(let O=M+1;O=0)return!1;return!0});let v=l.join(\" | \");v!==this._attribHTML&&(this._attribHTML=v,l.length?(this._innerContainer.innerHTML=v,this._container.classList.remove(\"maplibregl-attrib-empty\")):this._container.classList.add(\"maplibregl-attrib-empty\"),this._updateCompact(),this._editLink=null)}}class un{constructor(l={}){this._updateCompact=()=>{let d=this._container.children;if(d.length){let v=d[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&v.classList.add(\"maplibregl-compact\"):v.classList.remove(\"maplibregl-compact\")}},this.options=l}getDefaultPosition(){return\"bottom-left\"}onAdd(l){this._map=l,this._compact=this.options&&this.options.compact,this._container=c.create(\"div\",\"maplibregl-ctrl\");let d=c.create(\"a\",\"maplibregl-ctrl-logo\");return d.target=\"_blank\",d.rel=\"noopener nofollow\",d.href=\"https://maplibre.org/\",d.setAttribute(\"aria-label\",this._map._getUIString(\"LogoControl.Title\")),d.setAttribute(\"rel\",\"noopener nofollow\"),this._container.appendChild(d),this._container.style.display=\"block\",this._map.on(\"resize\",this._updateCompact),this._updateCompact(),this._container}onRemove(){c.remove(this._container),this._map.off(\"resize\",this._updateCompact),this._map=void 0,this._compact=void 0}}class sA{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(l){let d=++this._id;return this._queue.push({callback:l,id:d,cancelled:!1}),d}remove(l){let d=this._currentlyRunning,v=d?this._queue.concat(d):this._queue;for(let b of v)if(b.id===l)return void(b.cancelled=!0)}run(l=0){if(this._currentlyRunning)throw new Error(\"Attempting to run(), but is already running.\");let d=this._currentlyRunning=this._queue;this._queue=[];for(let v of d)if(!v.cancelled&&(v.callback(l),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}let d0={\"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\":\"Mapbox logo\",\"NavigationControl.ResetBearing\":\"Reset bearing to north\",\"NavigationControl.ZoomIn\":\"Zoom in\",\"NavigationControl.ZoomOut\":\"Zoom out\",\"ScaleControl.Feet\":\"ft\",\"ScaleControl.Meters\":\"m\",\"ScaleControl.Kilometers\":\"km\",\"ScaleControl.Miles\":\"mi\",\"ScaleControl.NauticalMiles\":\"nm\",\"TerrainControl.enableTerrain\":\"Enable terrain\",\"TerrainControl.disableTerrain\":\"Disable terrain\"};var Ah=n.Q([{name:\"a_pos3d\",type:\"Int16\",components:3}]);class x_ extends n.E{constructor(l){super(),this.sourceCache=l,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,l.usedForTerrain=!0,l.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(l,d){this.sourceCache.update(l,d),this._renderableTilesKeys=[];let v={};for(let b of l.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:d}))v[b.key]=!0,this._renderableTilesKeys.push(b.key),this._tiles[b.key]||(b.posMatrix=new Float64Array(16),n.aS(b.posMatrix,0,n.N,0,n.N,0,1),this._tiles[b.key]=new ao(b,this.tileSize));for(let b in this._tiles)v[b]||delete this._tiles[b]}freeRtt(l){for(let d in this._tiles){let v=this._tiles[d];(!l||v.tileID.equals(l)||v.tileID.isChildOf(l)||l.isChildOf(v.tileID))&&(v.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(l=>this.getTileByID(l))}getTileByID(l){return this._tiles[l]}getTerrainCoords(l){let d={};for(let v of this._renderableTilesKeys){let b=this._tiles[v].tileID;if(b.canonical.equals(l.canonical)){let M=l.clone();M.posMatrix=new Float64Array(16),n.aS(M.posMatrix,0,n.N,0,n.N,0,1),d[v]=M}else if(b.canonical.isChildOf(l.canonical)){let M=l.clone();M.posMatrix=new Float64Array(16);let O=b.canonical.z-l.canonical.z,B=b.canonical.x-(b.canonical.x>>O<>O<>O;n.aS(M.posMatrix,0,W,0,W,0,1),n.$(M.posMatrix,M.posMatrix,[-B*W,-U*W,0]),d[v]=M}else if(l.canonical.isChildOf(b.canonical)){let M=l.clone();M.posMatrix=new Float64Array(16);let O=l.canonical.z-b.canonical.z,B=l.canonical.x-(l.canonical.x>>O<>O<>O;n.aS(M.posMatrix,0,n.N,0,n.N,0,1),n.$(M.posMatrix,M.posMatrix,[B*W,U*W,0]),n.a0(M.posMatrix,M.posMatrix,[1/2**O,1/2**O,0]),d[v]=M}}return d}getSourceTile(l,d){let v=this.sourceCache._source,b=l.overscaledZ-this.deltaZoom;if(b>v.maxzoom&&(b=v.maxzoom),b=v.minzoom&&(!M||!M.dem);)M=this.sourceCache.getTileByID(l.scaledTo(b--).key);return M}tilesAfterTime(l=Date.now()){return Object.values(this._tiles).filter(d=>d.timeAdded>=l)}}class b_{constructor(l,d,v){this.painter=l,this.sourceCache=new x_(d),this.options=v,this.exaggeration=typeof v.exaggeration==\"number\"?v.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(l,d,v,b=n.N){var M;if(!(d>=0&&d=0&&vl.canonical.z&&(l.canonical.z>=b?M=l.canonical.z-b:n.w(\"cannot calculate elevation if elevation maxzoom > source.maxzoom\"));let O=l.canonical.x-(l.canonical.x>>M<>M<>8<<4|M>>8,d[O+3]=0;let v=new n.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(d.buffer)),b=new qt(l,v,l.gl.RGBA,{premultiply:!1});return b.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._coordsTexture=b,b}pointCoordinate(l){let d=new Uint8Array(4),v=this.painter.context,b=v.gl;v.bindFramebuffer.set(this.getFramebuffer(\"coords\").framebuffer),b.readPixels(l.x,this.painter.height/devicePixelRatio-l.y-1,1,1,b.RGBA,b.UNSIGNED_BYTE,d),v.bindFramebuffer.set(null);let M=d[0]+(d[2]>>4<<8),O=d[1]+((15&d[2])<<8),B=this.coordsIndex[255-d[3]],U=B&&this.sourceCache.getTileByID(B);if(!U)return null;let W=this._coordsTextureSize,Z=(1<0&&Math.sign(M)<0||!v&&Math.sign(b)<0&&Math.sign(M)>0?(b=360*Math.sign(M)+b,n.G(b)):d}}class Nx{constructor(l,d,v){this._context=l,this._size=d,this._tileSize=v,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let l of this._objects)l.texture.destroy(),l.fbo.destroy()}_createObject(l){let d=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),v=new qt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return v.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),d.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),d.colorAttachment.set(v.texture),{id:l,fbo:d,texture:v,stamp:-1,inUse:!1}}getObjectForId(l){return this._objects[l]}useObject(l){l.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(d=>l.id!==d),this._recentlyUsed.push(l.id)}stampObject(l){l.stamp=++this._stamp}getOrCreateFreeObject(){for(let d of this._recentlyUsed)if(!this._objects[d].inUse)return this._objects[d];if(this._objects.length>=this._size)throw new Error(\"No free RenderPool available, call freeAllObjects() required!\");let l=this._createObject(this._objects.length);return this._objects.push(l),l}freeObject(l){l.inUse=!1}freeAllObjects(){for(let l of this._objects)this.freeObject(l)}isFull(){return!(this._objects.length!l.inUse)===!1}}let Mo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class oA{constructor(l,d){this.painter=l,this.terrain=d,this.pool=new Nx(l.context,30,d.sourceCache.tileSize*d.qualityFactor)}destruct(){this.pool.destruct()}getTexture(l){return this.pool.getObjectForId(l.rtt[this._stacks.length-1].id).texture}prepareForRender(l,d){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=l._order.filter(v=>!l._layers[v].isHidden(d)),this._coordsDescendingInv={};for(let v in l.sourceCaches){this._coordsDescendingInv[v]={};let b=l.sourceCaches[v].getVisibleCoordinates();for(let M of b){let O=this.terrain.sourceCache.getTerrainCoords(M);for(let B in O)this._coordsDescendingInv[v][B]||(this._coordsDescendingInv[v][B]=[]),this._coordsDescendingInv[v][B].push(O[B])}}this._coordsDescendingInvStr={};for(let v of l._order){let b=l._layers[v],M=b.source;if(Mo[b.type]&&!this._coordsDescendingInvStr[M]){this._coordsDescendingInvStr[M]={};for(let O in this._coordsDescendingInv[M])this._coordsDescendingInvStr[M][O]=this._coordsDescendingInv[M][O].map(B=>B.key).sort().join()}}for(let v of this._renderableTiles)for(let b in this._coordsDescendingInvStr){let M=this._coordsDescendingInvStr[b][v.tileID.key];M&&M!==v.rttCoords[b]&&(v.rtt=[])}}renderLayer(l){if(l.isHidden(this.painter.transform.zoom))return!1;let d=l.type,v=this.painter,b=this._renderableLayerIds[this._renderableLayerIds.length-1]===l.id;if(Mo[d]&&(this._prevType&&Mo[this._prevType]||this._stacks.push([]),this._prevType=d,this._stacks[this._stacks.length-1].push(l.id),!b))return!0;if(Mo[this._prevType]||Mo[d]&&b){this._prevType=d;let M=this._stacks.length-1,O=this._stacks[M]||[];for(let B of this._renderableTiles){if(this.pool.isFull()&&(Cn(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(B),B.rtt[M]){let W=this.pool.getObjectForId(B.rtt[M].id);if(W.stamp===B.rtt[M].stamp){this.pool.useObject(W);continue}}let U=this.pool.getOrCreateFreeObject();this.pool.useObject(U),this.pool.stampObject(U),B.rtt[M]={id:U.id,stamp:U.stamp},v.context.bindFramebuffer.set(U.fbo.framebuffer),v.context.clear({color:n.aT.transparent,stencil:0}),v.currentStencilSource=void 0;for(let W=0;W{T.touchstart=T.dragStart,T.touchmoveWindow=T.dragMove,T.touchend=T.dragEnd},aA={showCompass:!0,showZoom:!0,visualizePitch:!1};class Bd{constructor(l,d,v=!1){this.mousedown=O=>{this.startMouse(n.e({},O,{ctrlKey:!0,preventDefault:()=>O.preventDefault()}),c.mousePos(this.element,O)),c.addEventListener(window,\"mousemove\",this.mousemove),c.addEventListener(window,\"mouseup\",this.mouseup)},this.mousemove=O=>{this.moveMouse(O,c.mousePos(this.element,O))},this.mouseup=O=>{this.mouseRotate.dragEnd(O),this.mousePitch&&this.mousePitch.dragEnd(O),this.offTemp()},this.touchstart=O=>{O.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=c.touchPos(this.element,O.targetTouches)[0],this.startTouch(O,this._startPos),c.addEventListener(window,\"touchmove\",this.touchmove,{passive:!1}),c.addEventListener(window,\"touchend\",this.touchend))},this.touchmove=O=>{O.targetTouches.length!==1?this.reset():(this._lastPos=c.touchPos(this.element,O.targetTouches)[0],this.moveTouch(O,this._lastPos))},this.touchend=O=>{O.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;let b=l.dragRotate._mouseRotate.getClickTolerance(),M=l.dragRotate._mousePitch.getClickTolerance();this.element=d,this.mouseRotate=Na({clickTolerance:b,enable:!0}),this.touchRotate=(({enable:O,clickTolerance:B,bearingDegreesPerPixelMoved:U=.8})=>{let W=new s0;return new za({clickTolerance:B,move:(Z,$)=>({bearingDelta:($.x-Z.x)*U}),moveStateManager:W,enable:O,assignEvents:wf})})({clickTolerance:b,enable:!0}),this.map=l,v&&(this.mousePitch=co({clickTolerance:M,enable:!0}),this.touchPitch=(({enable:O,clickTolerance:B,pitchDegreesPerPixelMoved:U=-.5})=>{let W=new s0;return new za({clickTolerance:B,move:(Z,$)=>({pitchDelta:($.y-Z.y)*U}),moveStateManager:W,enable:O,assignEvents:wf})})({clickTolerance:M,enable:!0})),c.addEventListener(d,\"mousedown\",this.mousedown),c.addEventListener(d,\"touchstart\",this.touchstart,{passive:!1}),c.addEventListener(d,\"touchcancel\",this.reset)}startMouse(l,d){this.mouseRotate.dragStart(l,d),this.mousePitch&&this.mousePitch.dragStart(l,d),c.disableDrag()}startTouch(l,d){this.touchRotate.dragStart(l,d),this.touchPitch&&this.touchPitch.dragStart(l,d),c.disableDrag()}moveMouse(l,d){let v=this.map,{bearingDelta:b}=this.mouseRotate.dragMove(l,d)||{};if(b&&v.setBearing(v.getBearing()+b),this.mousePitch){let{pitchDelta:M}=this.mousePitch.dragMove(l,d)||{};M&&v.setPitch(v.getPitch()+M)}}moveTouch(l,d){let v=this.map,{bearingDelta:b}=this.touchRotate.dragMove(l,d)||{};if(b&&v.setBearing(v.getBearing()+b),this.touchPitch){let{pitchDelta:M}=this.touchPitch.dragMove(l,d)||{};M&&v.setPitch(v.getPitch()+M)}}off(){let l=this.element;c.removeEventListener(l,\"mousedown\",this.mousedown),c.removeEventListener(l,\"touchstart\",this.touchstart,{passive:!1}),c.removeEventListener(window,\"touchmove\",this.touchmove,{passive:!1}),c.removeEventListener(window,\"touchend\",this.touchend),c.removeEventListener(l,\"touchcancel\",this.reset),this.offTemp()}offTemp(){c.enableDrag(),c.removeEventListener(window,\"mousemove\",this.mousemove),c.removeEventListener(window,\"mouseup\",this.mouseup),c.removeEventListener(window,\"touchmove\",this.touchmove,{passive:!1}),c.removeEventListener(window,\"touchend\",this.touchend)}}let Hn;function uo(T,l,d){if(T=new n.L(T.lng,T.lat),l){let v=new n.L(T.lng-360,T.lat),b=new n.L(T.lng+360,T.lat),M=d.locationPoint(T).distSqr(l);d.locationPoint(v).distSqr(l)180;){let v=d.locationPoint(T);if(v.x>=0&&v.y>=0&&v.x<=d.width&&v.y<=d.height)break;T.lng>d.center.lng?T.lng-=360:T.lng+=360}return T}let ji={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%)\"};function w_(T,l,d){let v=T.classList;for(let b in ji)v.remove(`maplibregl-${d}-anchor-${b}`);v.add(`maplibregl-${d}-anchor-${l}`)}class mh extends n.E{constructor(l){if(super(),this._onKeyPress=d=>{let v=d.code,b=d.charCode||d.keyCode;v!==\"Space\"&&v!==\"Enter\"&&b!==32&&b!==13||this.togglePopup()},this._onMapClick=d=>{let v=d.originalEvent.target,b=this._element;this._popup&&(v===b||b.contains(v))&&this.togglePopup()},this._update=d=>{if(!this._map)return;let v=this._map.loaded()&&!this._map.isMoving();(d?.type===\"terrain\"||d?.type===\"render\"&&!v)&&this._map.once(\"render\",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=uo(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let b=\"\";this._rotationAlignment===\"viewport\"||this._rotationAlignment===\"auto\"?b=`rotateZ(${this._rotation}deg)`:this._rotationAlignment===\"map\"&&(b=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let M=\"\";this._pitchAlignment===\"viewport\"||this._pitchAlignment===\"auto\"?M=\"rotateX(0deg)\":this._pitchAlignment===\"map\"&&(M=`rotateX(${this._map.getPitch()}deg)`),d&&d.type!==\"moveend\"||(this._pos=this._pos.round()),c.setTransform(this._element,`${ji[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${M} ${b}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{let O=this._map.unproject(this._pos),B=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=O.distanceTo(this._lngLat)>20*B?\"0.2\":\"1.0\",this._opacityTimeout=null},100))},this._onMove=d=>{if(!this._isDragging){let v=this._clickTolerance||this._map._clickTolerance;this._isDragging=d.point.dist(this._pointerdownPos)>=v}this._isDragging&&(this._pos=d.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 n.k(\"dragstart\"))),this.fire(new n.k(\"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 n.k(\"dragend\")),this._state=\"inactive\"},this._addDragHandler=d=>{this._element.contains(d.originalEvent.target)&&(d.preventDefault(),this._positionDelta=d.point.sub(this._pos).add(this._offset),this._pointerdownPos=d.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=l&&l.anchor||\"center\",this._color=l&&l.color||\"#3FB1CE\",this._scale=l&&l.scale||1,this._draggable=l&&l.draggable||!1,this._clickTolerance=l&&l.clickTolerance||0,this._isDragging=!1,this._state=\"inactive\",this._rotation=l&&l.rotation||0,this._rotationAlignment=l&&l.rotationAlignment||\"auto\",this._pitchAlignment=l&&l.pitchAlignment&&l.pitchAlignment!==\"auto\"?l.pitchAlignment:this._rotationAlignment,l&&l.element)this._element=l.element,this._offset=n.P.convert(l&&l.offset||[0,0]);else{this._defaultMarker=!0,this._element=c.create(\"div\"),this._element.setAttribute(\"aria-label\",\"Map marker\");let d=c.createNS(\"http://www.w3.org/2000/svg\",\"svg\"),v=41,b=27;d.setAttributeNS(null,\"display\",\"block\"),d.setAttributeNS(null,\"height\",`${v}px`),d.setAttributeNS(null,\"width\",`${b}px`),d.setAttributeNS(null,\"viewBox\",`0 0 ${b} ${v}`);let M=c.createNS(\"http://www.w3.org/2000/svg\",\"g\");M.setAttributeNS(null,\"stroke\",\"none\"),M.setAttributeNS(null,\"stroke-width\",\"1\"),M.setAttributeNS(null,\"fill\",\"none\"),M.setAttributeNS(null,\"fill-rule\",\"evenodd\");let O=c.createNS(\"http://www.w3.org/2000/svg\",\"g\");O.setAttributeNS(null,\"fill-rule\",\"nonzero\");let B=c.createNS(\"http://www.w3.org/2000/svg\",\"g\");B.setAttributeNS(null,\"transform\",\"translate(3.0, 29.0)\"),B.setAttributeNS(null,\"fill\",\"#000000\");let U=[{rx:\"10.5\",ry:\"5.25002273\"},{rx:\"10.5\",ry:\"5.25002273\"},{rx:\"9.5\",ry:\"4.77275007\"},{rx:\"8.5\",ry:\"4.29549936\"},{rx:\"7.5\",ry:\"3.81822308\"},{rx:\"6.5\",ry:\"3.34094679\"},{rx:\"5.5\",ry:\"2.86367051\"},{rx:\"4.5\",ry:\"2.38636864\"}];for(let Ft of U){let Ht=c.createNS(\"http://www.w3.org/2000/svg\",\"ellipse\");Ht.setAttributeNS(null,\"opacity\",\"0.04\"),Ht.setAttributeNS(null,\"cx\",\"10.5\"),Ht.setAttributeNS(null,\"cy\",\"5.80029008\"),Ht.setAttributeNS(null,\"rx\",Ft.rx),Ht.setAttributeNS(null,\"ry\",Ft.ry),B.appendChild(Ht)}let W=c.createNS(\"http://www.w3.org/2000/svg\",\"g\");W.setAttributeNS(null,\"fill\",this._color);let Z=c.createNS(\"http://www.w3.org/2000/svg\",\"path\");Z.setAttributeNS(null,\"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\"),W.appendChild(Z);let $=c.createNS(\"http://www.w3.org/2000/svg\",\"g\");$.setAttributeNS(null,\"opacity\",\"0.25\"),$.setAttributeNS(null,\"fill\",\"#000000\");let st=c.createNS(\"http://www.w3.org/2000/svg\",\"path\");st.setAttributeNS(null,\"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\"),$.appendChild(st);let At=c.createNS(\"http://www.w3.org/2000/svg\",\"g\");At.setAttributeNS(null,\"transform\",\"translate(6.0, 7.0)\"),At.setAttributeNS(null,\"fill\",\"#FFFFFF\");let pt=c.createNS(\"http://www.w3.org/2000/svg\",\"g\");pt.setAttributeNS(null,\"transform\",\"translate(8.0, 8.0)\");let yt=c.createNS(\"http://www.w3.org/2000/svg\",\"circle\");yt.setAttributeNS(null,\"fill\",\"#000000\"),yt.setAttributeNS(null,\"opacity\",\"0.25\"),yt.setAttributeNS(null,\"cx\",\"5.5\"),yt.setAttributeNS(null,\"cy\",\"5.5\"),yt.setAttributeNS(null,\"r\",\"5.4999962\");let dt=c.createNS(\"http://www.w3.org/2000/svg\",\"circle\");dt.setAttributeNS(null,\"fill\",\"#FFFFFF\"),dt.setAttributeNS(null,\"cx\",\"5.5\"),dt.setAttributeNS(null,\"cy\",\"5.5\"),dt.setAttributeNS(null,\"r\",\"5.4999962\"),pt.appendChild(yt),pt.appendChild(dt),O.appendChild(B),O.appendChild(W),O.appendChild($),O.appendChild(At),O.appendChild(pt),d.appendChild(O),d.setAttributeNS(null,\"height\",v*this._scale+\"px\"),d.setAttributeNS(null,\"width\",b*this._scale+\"px\"),this._element.appendChild(d),this._offset=n.P.convert(l&&l.offset||[0,-14])}if(this._element.classList.add(\"maplibregl-marker\"),this._element.addEventListener(\"dragstart\",d=>{d.preventDefault()}),this._element.addEventListener(\"mousedown\",d=>{d.preventDefault()}),w_(this._element,this._anchor,\"marker\"),l&&l.className)for(let d of l.className.split(\" \"))this._element.classList.add(d);this._popup=null}addTo(l){return this.remove(),this._map=l,l.getCanvasContainer().appendChild(this._element),l.on(\"move\",this._update),l.on(\"moveend\",this._update),l.on(\"terrain\",this._update),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(\"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),c.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(l){return this._lngLat=n.L.convert(l),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(l){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener(\"keypress\",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute(\"tabindex\")),l){if(!(\"offset\"in l.options)){let b=Math.abs(13.5)/Math.SQRT2;l.options.offset=this._defaultMarker?{top:[0,0],\"top-left\":[0,0],\"top-right\":[0,0],bottom:[0,-38.1],\"bottom-left\":[b,-1*(38.1-13.5+b)],\"bottom-right\":[-b,-1*(38.1-13.5+b)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=l,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute(\"tabindex\"),this._originalTabIndex||this._element.setAttribute(\"tabindex\",\"0\"),this._element.addEventListener(\"keypress\",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){let l=this._popup;return l?(l.isOpen()?l.remove():l.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(l){return this._offset=n.P.convert(l),this._update(),this}addClassName(l){this._element.classList.add(l)}removeClassName(l){this._element.classList.remove(l)}toggleClassName(l){return this._element.classList.toggle(l)}setDraggable(l){return this._draggable=!!l,this._map&&(l?(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}isDraggable(){return this._draggable}setRotation(l){return this._rotation=l||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(l){return this._rotationAlignment=l||\"auto\",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(l){return this._pitchAlignment=l&&l!==\"auto\"?l:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}let kn={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},wn=0,Sf=!1,Es={maxWidth:100,unit:\"metric\"};function gh(T,l,d){let v=d&&d.maxWidth||100,b=T._container.clientHeight/2,M=T.unproject([0,b]),O=T.unproject([v,b]),B=M.distanceTo(O);if(d&&d.unit===\"imperial\"){let U=3.2808*B;U>5280?Wo(l,v,U/5280,T._getUIString(\"ScaleControl.Miles\")):Wo(l,v,U,T._getUIString(\"ScaleControl.Feet\"))}else d&&d.unit===\"nautical\"?Wo(l,v,B/1852,T._getUIString(\"ScaleControl.NauticalMiles\")):B>=1e3?Wo(l,v,B/1e3,T._getUIString(\"ScaleControl.Kilometers\")):Wo(l,v,B,T._getUIString(\"ScaleControl.Meters\"))}function Wo(T,l,d,v){let b=function(M){let O=Math.pow(10,`${Math.floor(M)}`.length-1),B=M/O;return B=B>=10?10:B>=5?5:B>=3?3:B>=2?2:B>=1?1:function(U){let W=Math.pow(10,Math.ceil(-Math.log(U)/Math.LN10));return Math.round(U*W)/W}(B),O*B}(d);T.style.width=l*(b/d)+\"px\",T.innerHTML=`${b} ${v}`}let p0={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:\"\",maxWidth:\"240px\"},Fd=[\"a[href]\",\"[tabindex]:not([tabindex='-1'])\",\"[contenteditable]:not([contenteditable='false'])\",\"button:not([disabled])\",\"input:not([disabled])\",\"select:not([disabled])\",\"textarea:not([disabled])\"].join(\", \");function Tf(T){if(T){if(typeof T==\"number\"){let l=Math.round(Math.abs(T)/Math.SQRT2);return{center:new n.P(0,0),top:new n.P(0,T),\"top-left\":new n.P(l,l),\"top-right\":new n.P(-l,l),bottom:new n.P(0,-T),\"bottom-left\":new n.P(l,-l),\"bottom-right\":new n.P(-l,-l),left:new n.P(T,0),right:new n.P(-T,0)}}if(T instanceof n.P||Array.isArray(T)){let l=n.P.convert(T);return{center:l,top:l,\"top-left\":l,\"top-right\":l,bottom:l,\"bottom-left\":l,\"bottom-right\":l,left:l,right:l}}return{center:n.P.convert(T.center||[0,0]),top:n.P.convert(T.top||[0,0]),\"top-left\":n.P.convert(T[\"top-left\"]||[0,0]),\"top-right\":n.P.convert(T[\"top-right\"]||[0,0]),bottom:n.P.convert(T.bottom||[0,0]),\"bottom-left\":n.P.convert(T[\"bottom-left\"]||[0,0]),\"bottom-right\":n.P.convert(T[\"bottom-right\"]||[0,0]),left:n.P.convert(T.left||[0,0]),right:n.P.convert(T.right||[0,0])}}return Tf(new n.P(0,0))}let Ho={extend:(T,...l)=>n.e(T,...l),run(T){T()},logToElement(T,l=!1,d=\"log\"){let v=window.document.getElementById(d);v&&(l&&(v.innerHTML=\"\"),v.innerHTML+=`
${T}`)}},lA=o;class bi{static get version(){return lA}static get workerCount(){return lo.workerCount}static set workerCount(l){lo.workerCount=l}static get maxParallelImageRequests(){return n.c.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(l){n.c.MAX_PARALLEL_IMAGE_REQUESTS=l}static get workerUrl(){return n.c.WORKER_URL}static set workerUrl(l){n.c.WORKER_URL=l}static addProtocol(l,d){n.c.REGISTERED_PROTOCOLS[l]=d}static removeProtocol(l){delete n.c.REGISTERED_PROTOCOLS[l]}}return bi.Map=class extends v_{constructor(T){if(n.bg.mark(n.bh.create),(T=n.e({},dr,T)).minZoom!=null&&T.maxZoom!=null&&T.minZoom>T.maxZoom)throw new Error(\"maxZoom must be greater than or equal to minZoom\");if(T.minPitch!=null&&T.maxPitch!=null&&T.minPitch>T.maxPitch)throw new Error(\"maxPitch must be greater than or equal to minPitch\");if(T.minPitch!=null&&T.minPitch<0)throw new Error(\"minPitch must be greater than or equal to 0\");if(T.maxPitch!=null&&T.maxPitch>85)throw new Error(\"maxPitch must be less than or equal to 85\");if(super(new Kp(T.minZoom,T.maxZoom,T.minPitch,T.maxPitch,T.renderWorldCopies),{bearingSnap:T.bearingSnap}),this._cooperativeGesturesOnWheel=l=>{this._onCooperativeGesture(l,l[this._metaKey],1)},this._contextLost=l=>{l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new n.k(\"webglcontextlost\",{originalEvent:l}))},this._contextRestored=l=>{this._setupPainter(),this.resize(),this._update(),this.fire(new n.k(\"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()},this._interactive=T.interactive,this._cooperativeGestures=T.cooperativeGestures,this._metaKey=navigator.platform.indexOf(\"Mac\")===0?\"metaKey\":\"ctrlKey\",this._maxTileCacheSize=T.maxTileCacheSize,this._maxTileCacheZoomLevels=T.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=T.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=T.preserveDrawingBuffer,this._antialias=T.antialias,this._trackResize=T.trackResize,this._bearingSnap=T.bearingSnap,this._refreshExpiredTiles=T.refreshExpiredTiles,this._fadeDuration=T.fadeDuration,this._crossSourceCollisions=T.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=T.collectResourceTiming,this._renderTaskQueue=new sA,this._controls=[],this._mapId=n.a2(),this._locale=n.e({},d0,T.locale),this._clickTolerance=T.clickTolerance,this._overridePixelRatio=T.pixelRatio,this._maxCanvasSize=T.maxCanvasSize,this.transformCameraUpdate=T.transformCameraUpdate,this._imageQueueHandle=j.addThrottleControl(()=>this.isMoving()),this._requestManager=new et(T.transformRequest),typeof T.container==\"string\"){if(this._container=document.getElementById(T.container),!this._container)throw new Error(`Container '${T.container}' not found.`)}else{if(!(T.container instanceof HTMLElement))throw new Error(\"Invalid type: 'container' must be a String or HTMLElement.\");this._container=T.container}if(T.maxBounds&&this.setMaxBounds(T.maxBounds),this._setupContainer(),this._setupPainter(),this.on(\"move\",()=>this._update(!1)),this.on(\"moveend\",()=>this._update(!1)),this.on(\"zoom\",()=>this._update(!0)),this.on(\"terrain\",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once(\"idle\",()=>{this._idleTriggered=!0}),typeof window<\"u\"){addEventListener(\"online\",this._onWindowOnline,!1);let l=!1,d=lh(v=>{this._trackResize&&!this._removed&&this.resize(v)._update()},50);this._resizeObserver=new ResizeObserver(v=>{l?d(v):l=!0}),this._resizeObserver.observe(this._container)}this.handlers=new f0(this,T),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=T.hash&&new Ld(typeof T.hash==\"string\"&&T.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:T.center,zoom:T.zoom,bearing:T.bearing,pitch:T.pitch}),T.bounds&&(this.resize(),this.fitBounds(T.bounds,n.e({},T.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=T.localIdeographFontFamily,this._validateStyle=T.validateStyle,T.style&&this.setStyle(T.style,{localIdeographFontFamily:T.localIdeographFontFamily}),T.attributionControl&&this.addControl(new ua({customAttribution:T.customAttribution})),T.maplibreLogo&&this.addControl(new un,T.logoPosition),this.on(\"style.load\",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on(\"data\",l=>{this._update(l.dataType===\"style\"),this.fire(new n.k(`${l.dataType}data`,l))}),this.on(\"dataloading\",l=>{this.fire(new n.k(`${l.dataType}dataloading`,l))}),this.on(\"dataabort\",l=>{this.fire(new n.k(\"sourcedataabort\",l))})}_getMapId(){return this._mapId}addControl(T,l){if(l===void 0&&(l=T.getDefaultPosition?T.getDefaultPosition():\"top-right\"),!T||!T.onAdd)return this.fire(new n.j(new Error(\"Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.\")));let d=T.onAdd(this);this._controls.push(T);let v=this._controlPositions[l];return l.indexOf(\"bottom\")!==-1?v.insertBefore(d,v.firstChild):v.appendChild(d),this}removeControl(T){if(!T||!T.onRemove)return this.fire(new n.j(new Error(\"Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.\")));let l=this._controls.indexOf(T);return l>-1&&this._controls.splice(l,1),T.onRemove(this),this}hasControl(T){return this._controls.indexOf(T)>-1}calculateCameraOptionsFromTo(T,l,d,v){return v==null&&this.terrain&&(v=this.terrain.getElevationForLngLatZoom(d,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(T,l,d,v)}resize(T){var l;let d=this._containerDimensions(),v=d[0],b=d[1],M=this._getClampedPixelRatio(v,b);if(this._resizeCanvas(v,b,M),this.painter.resize(v,b,M),this.painter.overLimit()){let B=this.painter.context.gl;this._maxCanvasSize=[B.drawingBufferWidth,B.drawingBufferHeight];let U=this._getClampedPixelRatio(v,b);this._resizeCanvas(v,b,U),this.painter.resize(v,b,U)}this.transform.resize(v,b),(l=this._requestedCameraState)===null||l===void 0||l.resize(v,b);let O=!this._moving;return O&&(this.stop(),this.fire(new n.k(\"movestart\",T)).fire(new n.k(\"move\",T))),this.fire(new n.k(\"resize\",T)),O&&this.fire(new n.k(\"moveend\",T)),this}_getClampedPixelRatio(T,l){let{0:d,1:v}=this._maxCanvasSize,b=this.getPixelRatio(),M=T*b,O=l*b;return Math.min(M>d?d/M:1,O>v?v/O:1)*b}getPixelRatio(){var T;return(T=this._overridePixelRatio)!==null&&T!==void 0?T:devicePixelRatio}setPixelRatio(T){this._overridePixelRatio=T,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(T){return this.transform.setMaxBounds(Si.convert(T)),this._update()}setMinZoom(T){if((T=T??-2)>=-2&&T<=this.transform.maxZoom)return this.transform.minZoom=T,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=T,this._update(),this.getZoom()>T&&this.setZoom(T),this;throw new Error(\"maxZoom must be greater than the current minZoom\")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(T){if((T=T??0)<0)throw new Error(\"minPitch must be greater than or equal to 0\");if(T>=0&&T<=this.transform.maxPitch)return this.transform.minPitch=T,this._update(),this.getPitch()85)throw new Error(\"maxPitch must be less than or equal to 85\");if(T>=this.transform.minPitch)return this.transform.maxPitch=T,this._update(),this.getPitch()>T&&this.setPitch(T),this;throw new Error(\"maxPitch must be greater than the current minPitch\")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(T){return this.transform.renderWorldCopies=T,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(T){return this._cooperativeGestures=T,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(T){return this.transform.locationPoint(n.L.convert(T),this.style&&this.terrain)}unproject(T){return this.transform.pointLocation(n.P.convert(T),this.terrain)}isMoving(){var T;return this._moving||((T=this.handlers)===null||T===void 0?void 0:T.isMoving())}isZooming(){var T;return this._zooming||((T=this.handlers)===null||T===void 0?void 0:T.isZooming())}isRotating(){var T;return this._rotating||((T=this.handlers)===null||T===void 0?void 0:T.isRotating())}_createDelegatedListener(T,l,d){if(T===\"mouseenter\"||T===\"mouseover\"){let v=!1;return{layer:l,listener:d,delegates:{mousemove:M=>{let O=this.getLayer(l)?this.queryRenderedFeatures(M.point,{layers:[l]}):[];O.length?v||(v=!0,d.call(this,new la(T,this,M.originalEvent,{features:O}))):v=!1},mouseout:()=>{v=!1}}}}if(T===\"mouseleave\"||T===\"mouseout\"){let v=!1;return{layer:l,listener:d,delegates:{mousemove:O=>{(this.getLayer(l)?this.queryRenderedFeatures(O.point,{layers:[l]}):[]).length?v=!0:v&&(v=!1,d.call(this,new la(T,this,O.originalEvent)))},mouseout:O=>{v&&(v=!1,d.call(this,new la(T,this,O.originalEvent)))}}}}{let v=b=>{let M=this.getLayer(l)?this.queryRenderedFeatures(b.point,{layers:[l]}):[];M.length&&(b.features=M,d.call(this,b),delete b.features)};return{layer:l,listener:d,delegates:{[T]:v}}}}on(T,l,d){if(d===void 0)return super.on(T,l);let v=this._createDelegatedListener(T,l,d);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[T]=this._delegatedListeners[T]||[],this._delegatedListeners[T].push(v);for(let b in v.delegates)this.on(b,v.delegates[b]);return this}once(T,l,d){if(d===void 0)return super.once(T,l);let v=this._createDelegatedListener(T,l,d);for(let b in v.delegates)this.once(b,v.delegates[b]);return this}off(T,l,d){return d===void 0?super.off(T,l):(this._delegatedListeners&&this._delegatedListeners[T]&&(v=>{let b=this._delegatedListeners[T];for(let M=0;Mthis._updateStyle(T,l));let d=this.style&&l.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!T)),T?(this.style=new Gn(this,l||{}),this.style.setEventedParent(this,{style:this.style}),typeof T==\"string\"?this.style.loadURL(T,l,d):this.style.loadJSON(T,l,d),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Gn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(T,l){if(typeof T==\"string\"){let d=this._requestManager.transformRequest(T,Q.Style);n.f(d,(v,b)=>{v?this.fire(new n.j(v)):b&&this._updateDiff(b,l)})}else typeof T==\"object\"&&this._updateDiff(T,l)}_updateDiff(T,l){try{this.style.setState(T,l)&&this._update(!0)}catch(d){n.w(`Unable to perform style diff: ${d.message||d.error||d}. Rebuilding the style from scratch.`),this._updateStyle(T,l)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():n.w(\"There is no style added to the map.\")}addSource(T,l){return this._lazyInitEmptyStyle(),this.style.addSource(T,l),this._update(!0)}isSourceLoaded(T){let l=this.style&&this.style.sourceCaches[T];if(l!==void 0)return l.loaded();this.fire(new n.j(new Error(`There is no source with ID '${T}'`)))}setTerrain(T){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off(\"data\",this._terrainDataCallback),T){let l=this.style.sourceCaches[T.source];if(!l)throw new Error(`cannot load terrain, because there exists no source with ID: ${T.source}`);for(let d in this.style._layers){let v=this.style._layers[d];v.type===\"hillshade\"&&v.source===T.source&&n.w(\"You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.\")}this.terrain=new b_(this.painter,l,T),this.painter.renderToTexture=new oA(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=d=>{d.dataType===\"style\"?this.terrain.sourceCache.freeRtt():d.dataType===\"source\"&&d.tile&&(d.sourceId!==T.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(d.tile.tileID))},this.style.on(\"data\",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new n.k(\"terrain\",{terrain:T})),this}getTerrain(){var T,l;return(l=(T=this.terrain)===null||T===void 0?void 0:T.options)!==null&&l!==void 0?l:null}areTilesLoaded(){let T=this.style&&this.style.sourceCaches;for(let l in T){let d=T[l]._tiles;for(let v in d){let b=d[v];if(b.state!==\"loaded\"&&b.state!==\"errored\")return!1}}return!0}addSourceType(T,l,d){return this._lazyInitEmptyStyle(),this.style.addSourceType(T,l,d)}removeSource(T){return this.style.removeSource(T),this._update(!0)}getSource(T){return this.style.getSource(T)}addImage(T,l,d={}){let{pixelRatio:v=1,sdf:b=!1,stretchX:M,stretchY:O,content:B}=d;if(this._lazyInitEmptyStyle(),!(l instanceof HTMLImageElement||n.a(l))){if(l.width===void 0||l.height===void 0)return this.fire(new n.j(new 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`\")));{let{width:U,height:W,data:Z}=l,$=l;return this.style.addImage(T,{data:new n.R({width:U,height:W},new Uint8Array(Z)),pixelRatio:v,stretchX:M,stretchY:O,content:B,sdf:b,version:0,userImage:$}),$.onAdd&&$.onAdd(this,T),this}}{let{width:U,height:W,data:Z}=n.h.getImageData(l);this.style.addImage(T,{data:new n.R({width:U,height:W},Z),pixelRatio:v,stretchX:M,stretchY:O,content:B,sdf:b,version:0})}}updateImage(T,l){let d=this.style.getImage(T);if(!d)return this.fire(new n.j(new Error(\"The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.\")));let v=l instanceof HTMLImageElement||n.a(l)?n.h.getImageData(l):l,{width:b,height:M,data:O}=v;if(b===void 0||M===void 0)return this.fire(new n.j(new 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(b!==d.data.width||M!==d.data.height)return this.fire(new n.j(new Error(\"The width and height of the updated image must be that same as the previous version of the image\")));let B=!(l instanceof HTMLImageElement||n.a(l));return d.data.replace(O,B),this.style.updateImage(T,d),this}getImage(T){return this.style.getImage(T)}hasImage(T){return T?!!this.style.getImage(T):(this.fire(new n.j(new Error(\"Missing required image id\"))),!1)}removeImage(T){this.style.removeImage(T)}loadImage(T,l){j.getImage(this._requestManager.transformRequest(T,Q.Image),l)}listImages(){return this.style.listImages()}addLayer(T,l){return this._lazyInitEmptyStyle(),this.style.addLayer(T,l),this._update(!0)}moveLayer(T,l){return this.style.moveLayer(T,l),this._update(!0)}removeLayer(T){return this.style.removeLayer(T),this._update(!0)}getLayer(T){return this.style.getLayer(T)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(T,l,d){return this.style.setLayerZoomRange(T,l,d),this._update(!0)}setFilter(T,l,d={}){return this.style.setFilter(T,l,d),this._update(!0)}getFilter(T){return this.style.getFilter(T)}setPaintProperty(T,l,d,v={}){return this.style.setPaintProperty(T,l,d,v),this._update(!0)}getPaintProperty(T,l){return this.style.getPaintProperty(T,l)}setLayoutProperty(T,l,d,v={}){return this.style.setLayoutProperty(T,l,d,v),this._update(!0)}getLayoutProperty(T,l){return this.style.getLayoutProperty(T,l)}setGlyphs(T,l={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(T,l),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(T,l,d={}){return this._lazyInitEmptyStyle(),this.style.addSprite(T,l,d,v=>{v||this._update(!0)}),this}removeSprite(T){return this._lazyInitEmptyStyle(),this.style.removeSprite(T),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(T,l={}){return this._lazyInitEmptyStyle(),this.style.setSprite(T,l,d=>{d||this._update(!0)}),this}setLight(T,l={}){return this._lazyInitEmptyStyle(),this.style.setLight(T,l),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(T,l){return this.style.setFeatureState(T,l),this._update()}removeFeatureState(T,l){return this.style.removeFeatureState(T,l),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,l=0;return this._container&&(T=this._container.clientWidth||400,l=this._container.clientHeight||300),[T,l]}_setupContainer(){let T=this._container;T.classList.add(\"maplibregl-map\");let l=this._canvasContainer=c.create(\"div\",\"maplibregl-canvas-container\",T);this._interactive&&l.classList.add(\"maplibregl-interactive\"),this._canvas=c.create(\"canvas\",\"maplibregl-canvas\",l),this._canvas.addEventListener(\"webglcontextlost\",this._contextLost,!1),this._canvas.addEventListener(\"webglcontextrestored\",this._contextRestored,!1),this._canvas.setAttribute(\"tabindex\",\"0\"),this._canvas.setAttribute(\"aria-label\",\"Map\"),this._canvas.setAttribute(\"role\",\"region\");let d=this._containerDimensions(),v=this._getClampedPixelRatio(d[0],d[1]);this._resizeCanvas(d[0],d[1],v);let b=this._controlContainer=c.create(\"div\",\"maplibregl-control-container\",T),M=this._controlPositions={};[\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"].forEach(O=>{M[O]=c.create(\"div\",`maplibregl-ctrl-${O} `,b)}),this._container.addEventListener(\"scroll\",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=c.create(\"div\",\"maplibregl-cooperative-gesture-screen\",this._container);let T=typeof this._cooperativeGestures!=\"boolean\"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:\"Use Ctrl + scroll to zoom the map\";navigator.platform.indexOf(\"Mac\")===0&&(T=typeof this._cooperativeGestures!=\"boolean\"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:\"Use \\u2318 + scroll to zoom the map\"),this._cooperativeGesturesScreen.innerHTML=`\n
${T}
\n
${typeof this._cooperativeGestures!=\"boolean\"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:\"Use two fingers to move the map\"}
\n `,this._cooperativeGesturesScreen.setAttribute(\"aria-hidden\",\"true\"),this._canvasContainer.addEventListener(\"wheel\",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add(\"maplibregl-cooperative-gestures\")}_destroyCooperativeGestures(){c.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener(\"wheel\",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove(\"maplibregl-cooperative-gestures\")}_resizeCanvas(T,l,d){this._canvas.width=Math.floor(d*T),this._canvas.height=Math.floor(d*l),this._canvas.style.width=`${T}px`,this._canvas.style.height=`${l}px`}_setupPainter(){let T={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},l=null;this._canvas.addEventListener(\"webglcontextcreationerror\",v=>{l={requestedAttributes:T},v&&(l.statusMessage=v.statusMessage,l.type=v.type)},{once:!0});let d=this._canvas.getContext(\"webgl2\",T)||this._canvas.getContext(\"webgl\",T);if(!d){let v=\"Failed to initialize WebGL\";throw l?(l.message=v,new Error(JSON.stringify(l))):new Error(v)}this.painter=new ah(d,this.transform),f.testSupport(d)}_onCooperativeGesture(T,l,d){return!l&&d<2&&(this._cooperativeGesturesScreen.classList.add(\"maplibregl-show\"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove(\"maplibregl-show\")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(T){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||T,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(T){return this._update(),this._renderTaskQueue.add(T)}_cancelRenderFrame(T){this._renderTaskQueue.remove(T)}_render(T){let l=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(T),this._removed)return;let d=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let b=this.transform.zoom,M=n.h.now();this.style.zoomHistory.update(b,M);let O=new n.a8(b,{now:M,fadeDuration:l,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),B=O.crossFadingFactor();B===1&&B===this._crossFadingFactor||(d=!0,this._crossFadingFactor=B),this.style.update(O)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,l,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,showPadding:this.showPadding}),this.fire(new n.k(\"render\")),this.loaded()&&!this._loaded&&(this._loaded=!0,n.bg.mark(n.bh.load),this.fire(new n.k(\"load\"))),this.style&&(this.style.hasTransitions()||d)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let v=this._sourcesDirty||this._styleDirty||this._placementDirty;return v||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new n.k(\"idle\")),!this._loaded||this._fullyLoaded||v||(this._fullyLoaded=!0,n.bg.mark(n.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var T;this._hash&&this._hash.remove();for(let d of this._controls)d.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<\"u\"&&removeEventListener(\"online\",this._onWindowOnline,!1),j.removeThrottleControl(this._imageQueueHandle),(T=this._resizeObserver)===null||T===void 0||T.disconnect();let l=this.painter.context.gl.getExtension(\"WEBGL_lose_context\");l&&l.loseContext(),this._canvas.removeEventListener(\"webglcontextrestored\",this._contextRestored,!1),this._canvas.removeEventListener(\"webglcontextlost\",this._contextLost,!1),c.remove(this._canvasContainer),c.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove(\"maplibregl-map\"),n.bg.clearMetrics(),this._removed=!0,this.fire(new n.k(\"remove\"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=n.h.frame(T=>{n.bg.frame(T),this._frame=null,this._render(T)}))}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 nr}getCameraTargetElevation(){return this.transform.elevation}},bi.NavigationControl=class{constructor(T){this._updateZoomButtons=()=>{let l=this._map.getZoom(),d=l===this._map.getMaxZoom(),v=l===this._map.getMinZoom();this._zoomInButton.disabled=d,this._zoomOutButton.disabled=v,this._zoomInButton.setAttribute(\"aria-disabled\",d.toString()),this._zoomOutButton.setAttribute(\"aria-disabled\",v.toString())},this._rotateCompassArrow=()=>{let l=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=l},this._setButtonTitle=(l,d)=>{let v=this._map._getUIString(`NavigationControl.${d}`);l.title=v,l.setAttribute(\"aria-label\",v)},this.options=n.e({},aA,T),this._container=c.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._container.addEventListener(\"contextmenu\",l=>l.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton(\"maplibregl-ctrl-zoom-in\",l=>this._map.zoomIn({},{originalEvent:l})),c.create(\"span\",\"maplibregl-ctrl-icon\",this._zoomInButton).setAttribute(\"aria-hidden\",\"true\"),this._zoomOutButton=this._createButton(\"maplibregl-ctrl-zoom-out\",l=>this._map.zoomOut({},{originalEvent:l})),c.create(\"span\",\"maplibregl-ctrl-icon\",this._zoomOutButton).setAttribute(\"aria-hidden\",\"true\")),this.options.showCompass&&(this._compass=this._createButton(\"maplibregl-ctrl-compass\",l=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:l}):this._map.resetNorth({},{originalEvent:l})}),this._compassIcon=c.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(\"zoom\",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,\"ResetBearing\"),this.options.visualizePitch&&this._map.on(\"pitch\",this._rotateCompassArrow),this._map.on(\"rotate\",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Bd(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){c.remove(this._container),this.options.showZoom&&this._map.off(\"zoom\",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off(\"pitch\",this._rotateCompassArrow),this._map.off(\"rotate\",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(T,l){let d=c.create(\"button\",T,this._container);return d.type=\"button\",d.addEventListener(\"click\",l),d}},bi.GeolocateControl=class extends n.E{constructor(T){super(),this._onSuccess=l=>{if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new n.k(\"outofmaxbounds\",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,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 new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!==\"OFF\"&&this._updateMarker(l),this.options.trackUserLocation&&this._watchState!==\"ACTIVE_LOCK\"||this._updateCamera(l),this.options.showUserLocation&&this._dotElement.classList.remove(\"maplibregl-user-location-dot-stale\"),this.fire(new n.k(\"geolocate\",l)),this._finish()}},this._updateCamera=l=>{let d=new n.L(l.coords.longitude,l.coords.latitude),v=l.coords.accuracy,b=this._map.getBearing(),M=n.e({bearing:b},this.options.fitBoundsOptions),O=Si.fromLngLat(d,v);this._map.fitBounds(O,M,{geolocateSource:!0})},this._updateMarker=l=>{if(l){let d=new n.L(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=l=>{if(this._map){if(this.options.trackUserLocation)if(l.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 d=this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");this._geolocateButton.title=d,this._geolocateButton.setAttribute(\"aria-label\",d),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&Sf)return;this._setErrorState()}this._watchState!==\"OFF\"&&this.options.showUserLocation&&this._dotElement.classList.add(\"maplibregl-user-location-dot-stale\"),this.fire(new n.k(\"error\",l)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=l=>{if(this._map){if(this._container.addEventListener(\"contextmenu\",d=>d.preventDefault()),this._geolocateButton=c.create(\"button\",\"maplibregl-ctrl-geolocate\",this._container),c.create(\"span\",\"maplibregl-ctrl-icon\",this._geolocateButton).setAttribute(\"aria-hidden\",\"true\"),this._geolocateButton.type=\"button\",l===!1){n.w(\"Geolocation support is not available so the GeolocateControl will be disabled.\");let d=this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");this._geolocateButton.disabled=!0,this._geolocateButton.title=d,this._geolocateButton.setAttribute(\"aria-label\",d)}else{let d=this._map._getUIString(\"GeolocateControl.FindMyLocation\");this._geolocateButton.title=d,this._geolocateButton.setAttribute(\"aria-label\",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute(\"aria-pressed\",\"false\"),this._watchState=\"OFF\"),this.options.showUserLocation&&(this._dotElement=c.create(\"div\",\"maplibregl-user-location-dot\"),this._userLocationDotMarker=new mh({element:this._dotElement}),this._circleElement=c.create(\"div\",\"maplibregl-user-location-accuracy-circle\"),this._accuracyCircleMarker=new mh({element:this._circleElement,pitchAlignment:\"map\"}),this.options.trackUserLocation&&(this._watchState=\"OFF\"),this._map.on(\"zoom\",this._onZoom)),this._geolocateButton.addEventListener(\"click\",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on(\"movestart\",d=>{d.geolocateSource||this._watchState!==\"ACTIVE_LOCK\"||d.originalEvent&&d.originalEvent.type===\"resize\"||(this._watchState=\"BACKGROUND\",this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-background\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this.fire(new n.k(\"trackuserlocationend\")))})}},this.options=n.e({},kn,T)}onAdd(T){return this._map=T,this._container=c.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),function(l,d=!1){Hn===void 0||d?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:\"geolocation\"}).then(v=>{Hn=v.state!==\"denied\",l(Hn)}).catch(()=>{Hn=!!window.navigator.geolocation,l(Hn)}):(Hn=!!window.navigator.geolocation,l(Hn)):l(Hn)}(this._setupUI),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(),c.remove(this._container),this._map.off(\"zoom\",this._onZoom),this._map=void 0,wn=0,Sf=!1}_isOutOfMapMaxBounds(T){let l=this._map.getMaxBounds(),d=T.coords;return l&&(d.longitudel.getEast()||d.latitudel.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\":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){let T=this._map.getBounds(),l=T.getSouthEast(),d=T.getNorthEast(),v=l.distanceTo(d),b=Math.ceil(this._accuracy/(v/this._map._container.clientHeight)*2);this._circleElement.style.width=`${b}px`,this._circleElement.style.height=`${b}px`}trigger(){if(!this._setup)return n.w(\"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 n.k(\"trackuserlocationstart\"));break;case\"WAITING_ACTIVE\":case\"ACTIVE_LOCK\":case\"ACTIVE_ERROR\":case\"BACKGROUND_ERROR\":wn--,Sf=!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 n.k(\"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 n.k(\"trackuserlocationstart\"));break;default:throw new 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 new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState===\"OFF\"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let T;this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.setAttribute(\"aria-pressed\",\"true\"),wn++,wn>1?(T={maximumAge:6e5,timeout:0},Sf=!0):(T=this.options.positionOptions,Sf=!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)}},bi.AttributionControl=ua,bi.LogoControl=un,bi.ScaleControl=class{constructor(T){this._onMove=()=>{gh(this._map,this._container,this.options)},this.setUnit=l=>{this.options.unit=l,gh(this._map,this._container,this.options)},this.options=n.e({},Es,T)}getDefaultPosition(){return\"bottom-left\"}onAdd(T){return this._map=T,this._container=c.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-scale\",T.getContainer()),this._map.on(\"move\",this._onMove),this._onMove(),this._container}onRemove(){c.remove(this._container),this._map.off(\"move\",this._onMove),this._map=void 0}},bi.FullscreenControl=class extends n.E{constructor(T={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,T&&T.container&&(T.container instanceof HTMLElement?this._container=T.container:n.w(\"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=c.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._setupUI(),this._controlContainer}onRemove(){c.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let T=this._fullscreenButton=c.create(\"button\",\"maplibregl-ctrl-fullscreen\",this._controlContainer);c.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 n.k(\"fullscreenstart\")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new n.k(\"fullscreenend\")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle(\"maplibregl-pseudo-fullscreen\"),this._handleFullscreenChange(),this._map.resize()}},bi.TerrainControl=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.disableTerrain\")):(this._terrainButton.classList.add(\"maplibregl-ctrl-terrain\"),this._terrainButton.title=this._map._getUIString(\"TerrainControl.enableTerrain\"))},this.options=T}onAdd(T){return this._map=T,this._container=c.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._terrainButton=c.create(\"button\",\"maplibregl-ctrl-terrain\",this._container),c.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(){c.remove(this._container),this._map.off(\"terrain\",this._updateTerrainIcon),this._map=void 0}},bi.Popup=class extends n.E{constructor(T){super(),this.remove=()=>(this._content&&c.remove(this._content),this._container&&(c.remove(this._container),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(\"mousemove\",this._onMouseMove),this._map.off(\"mouseup\",this._onMouseUp),this._map.off(\"drag\",this._onDrag),delete this._map),this.fire(new n.k(\"close\")),this),this._onMouseUp=l=>{this._update(l.point)},this._onMouseMove=l=>{this._update(l.point)},this._onDrag=l=>{this._update(l.point)},this._update=l=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=c.create(\"div\",\"maplibregl-popup\",this._map.getContainer()),this._tip=c.create(\"div\",\"maplibregl-popup-tip\",this._container),this._container.appendChild(this._content),this.options.className)for(let O of this.options.className.split(\" \"))this._container.classList.add(O);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._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=uo(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!l)return;let d=this._pos=this._trackPointer&&l?l:this._map.project(this._lngLat),v=this.options.anchor,b=Tf(this.options.offset);if(!v){let O=this._container.offsetWidth,B=this._container.offsetHeight,U;U=d.y+b.bottom.ythis._map.transform.height-B?[\"bottom\"]:[],d.xthis._map.transform.width-O/2&&U.push(\"right\"),v=U.length===0?\"bottom\":U.join(\"-\")}let M=d.add(b[v]).round();c.setTransform(this._container,`${ji[v]} translate(${M.x}px,${M.y}px)`),w_(this._container,v,\"popup\")},this._onClose=()=>{this.remove()},this.options=n.e(Object.create(p0),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._update(),this._focusFirstElement(),this._trackPointer?(this._map.on(\"mousemove\",this._onMouseMove),this._map.on(\"mouseup\",this._onMouseUp),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 n.k(\"open\")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(T){return this._lngLat=n.L.convert(T),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on(\"move\",this._update),this._map.off(\"mousemove\",this._onMouseMove),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._update(),this._map&&(this._map.off(\"move\",this._update),this._map.on(\"mousemove\",this._onMouseMove),this._map.on(\"drag\",this._onDrag),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 l=document.createDocumentFragment(),d=document.createElement(\"body\"),v;for(d.innerHTML=T;v=d.firstChild,v;)l.appendChild(v);return this.setDOMContent(l)}getMaxWidth(){var T;return(T=this._container)===null||T===void 0?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=c.create(\"div\",\"maplibregl-popup-content\",this._container);return this._content.appendChild(T),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(T){this._container&&this._container.classList.add(T)}removeClassName(T){this._container&&this._container.classList.remove(T)}setOffset(T){return this.options.offset=T,this._update(),this}toggleClassName(T){if(this._container)return this._container.classList.toggle(T)}_createCloseButton(){this.options.closeButton&&(this._closeButton=c.create(\"button\",\"maplibregl-popup-close-button\",this._content),this._closeButton.type=\"button\",this._closeButton.setAttribute(\"aria-label\",\"Close popup\"),this._closeButton.innerHTML=\"×\",this._closeButton.addEventListener(\"click\",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let T=this._container.querySelector(Fd);T&&T.focus()}},bi.Marker=mh,bi.Style=Gn,bi.LngLat=n.L,bi.LngLatBounds=Si,bi.Point=n.P,bi.MercatorCoordinate=n.U,bi.Evented=n.E,bi.AJAXError=n.bi,bi.config=n.c,bi.CanvasSource=Vo,bi.GeoJSONSource=Xi,bi.ImageSource=ki,bi.RasterDEMTileSource=Rc,bi.RasterTileSource=kc,bi.VectorTileSource=ll,bi.VideoSource=ts,bi.setRTLTextPlugin=n.bj,bi.getRTLTextPluginStatus=n.bk,bi.prewarm=function(){bo().acquire(oi)},bi.clearPrewarmedResources=function(){let T=ul;T&&(T.isPreloaded()&&T.numActive()===1?(T.release(oi),ul=null):console.warn(\"Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()\"))},Ho.extend(bi,{isSafari:n.ac,getPerformanceMetrics:n.bg.getPerformanceMetrics}),bi});var s=r;return s})});var TG=Br((p6t,oP)=>{(function(e,t,r,i){\"use strict\";var s=[\"\",\"webkit\",\"Moz\",\"MS\",\"ms\",\"o\"],n=t.createElement(\"div\"),o=\"function\",c=Math.round,f=Math.abs,_=Date.now;function w(lt,ft,Lt){return setTimeout(K(lt,Lt),ft)}function I(lt,ft,Lt){return Array.isArray(lt)?(R(lt,Lt[ft],Lt),!0):!1}function R(lt,ft,Lt){var Kt;if(lt)if(lt.forEach)lt.forEach(ft,Lt);else if(lt.length!==i)for(Kt=0;Kt\\s*\\(/gm,\"{anonymous}()@\"):\"Unknown Stack Trace\",ti=e.console&&(e.console.warn||e.console.log);return ti&&ti.call(e.console,Kt,Qe),lt.apply(this,arguments)}}var j;typeof Object.assign!=\"function\"?j=function(ft){if(ft===i||ft===null)throw new TypeError(\"Cannot convert undefined or null to object\");for(var Lt=Object(ft),Kt=1;Kt-1}function le(lt){return lt.trim().split(/\\s+/g)}function ue(lt,ft,Lt){if(lt.indexOf&&!Lt)return lt.indexOf(ft);for(var Kt=0;KtVs[ft]}):Kt=Kt.sort()),Kt}function rr(lt,ft){for(var Lt,Kt,ge=ft[0].toUpperCase()+ft.slice(1),Qe=0;Qe1&&!Lt.firstMultiple?Lt.firstMultiple=bo(ft):ge===1&&(Lt.firstMultiple=!1);var Qe=Lt.firstInput,ti=Lt.firstMultiple,is=ti?ti.center:Qe.center,Ts=ft.center=hl(Kt);ft.timeStamp=_(),ft.deltaTime=ft.timeStamp-Qe.timeStamp,ft.angle=jo(is,Ts),ft.distance=ve(is,Ts),du(Lt,ft),ft.offsetDirection=wo(ft.deltaX,ft.deltaY);var Vs=Ia(ft.deltaTime,ft.deltaX,ft.deltaY);ft.overallVelocityX=Vs.x,ft.overallVelocityY=Vs.y,ft.overallVelocity=f(Vs.x)>f(Vs.y)?Vs.x:Vs.y,ft.scale=ti?Ul(ti.pointers,Kt):1,ft.rotation=ti?gn(ti.pointers,Kt):0,ft.maxPointers=Lt.prevInput?ft.pointers.length>Lt.prevInput.maxPointers?ft.pointers.length:Lt.prevInput.maxPointers:ft.pointers.length,ul(Lt,ft);var Ra=lt.element;Xt(ft.srcEvent.target,Ra)&&(Ra=ft.srcEvent.target),ft.target=Ra}function du(lt,ft){var Lt=ft.center,Kt=lt.offsetDelta||{},ge=lt.prevDelta||{},Qe=lt.prevInput||{};(ft.eventType===Xi||Qe.eventType===ki)&&(ge=lt.prevDelta={x:Qe.deltaX||0,y:Qe.deltaY||0},Kt=lt.offsetDelta={x:Lt.x,y:Lt.y}),ft.deltaX=ge.x+(Lt.x-Kt.x),ft.deltaY=ge.y+(Lt.y-Kt.y)}function ul(lt,ft){var Lt=lt.lastInterval||ft,Kt=ft.timeStamp-Lt.timeStamp,ge,Qe,ti,is;if(ft.eventType!=ts&&(Kt>Rc||Lt.velocity===i)){var Ts=ft.deltaX-Lt.deltaX,Vs=ft.deltaY-Lt.deltaY,Ra=Ia(Kt,Ts,Vs);Qe=Ra.x,ti=Ra.y,ge=f(Ra.x)>f(Ra.y)?Ra.x:Ra.y,is=wo(Ts,Vs),lt.lastInterval=ft}else ge=Lt.velocity,Qe=Lt.velocityX,ti=Lt.velocityY,is=Lt.direction;ft.velocity=ge,ft.velocityX=Qe,ft.velocityY=ti,ft.direction=is}function bo(lt){for(var ft=[],Lt=0;Lt=f(ft)?lt<0?cl:xo:ft<0?Pa:na}function ve(lt,ft,Lt){Lt||(Lt=ee);var Kt=ft[Lt[0]]-lt[Lt[0]],ge=ft[Lt[1]]-lt[Lt[1]];return Math.sqrt(Kt*Kt+ge*ge)}function jo(lt,ft,Lt){Lt||(Lt=ee);var Kt=ft[Lt[0]]-lt[Lt[0]],ge=ft[Lt[1]]-lt[Lt[1]];return Math.atan2(ge,Kt)*180/Math.PI}function gn(lt,ft){return jo(ft[1],ft[0],ls)+jo(lt[1],lt[0],ls)}function Ul(lt,ft){return ve(ft[0],ft[1],ls)/ve(lt[0],lt[1],ls)}var Ca={mousedown:Xi,mousemove:Jn,mouseup:ki},Te=\"mousedown\",Dr=\"mousemove mouseup\";function gr(){this.evEl=Te,this.evWin=Dr,this.pressed=!1,mn.apply(this,arguments)}Y(gr,mn,{handler:function(ft){var Lt=Ca[ft.type];Lt&Xi&&ft.button===0&&(this.pressed=!0),Lt&Jn&&ft.which!==1&&(Lt=ki),this.pressed&&(Lt&ki&&(this.pressed=!1),this.callback(this.manager,Lt,{pointers:[ft],changedPointers:[ft],pointerType:ll,srcEvent:ft}))}});var Us={pointerdown:Xi,pointermove:Jn,pointerup:ki,pointercancel:ts,pointerout:ts},La={2:Si,3:Ns,4:ll,5:kc},Mr=\"pointerdown\",sa=\"pointermove pointerup pointercancel\";e.MSPointerEvent&&!e.PointerEvent&&(Mr=\"MSPointerDown\",sa=\"MSPointerMove MSPointerUp MSPointerCancel\");function gt(){this.evEl=Mr,this.evWin=sa,mn.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}Y(gt,mn,{handler:function(ft){var Lt=this.store,Kt=!1,ge=ft.type.toLowerCase().replace(\"ms\",\"\"),Qe=Us[ge],ti=La[ft.pointerType]||ft.pointerType,is=ti==Si,Ts=ue(Lt,ft.pointerId,\"pointerId\");Qe&Xi&&(ft.button===0||is)?Ts<0&&(Lt.push(ft),Ts=Lt.length-1):Qe&(ki|ts)&&(Kt=!0),!(Ts<0)&&(Lt[Ts]=ft,this.callback(this.manager,Qe,{pointers:Lt,changedPointers:[ft],pointerType:ti,srcEvent:ft}),Kt&&Lt.splice(Ts,1))}});var tt={touchstart:Xi,touchmove:Jn,touchend:ki,touchcancel:ts},nt=\"touchstart\",ht=\"touchstart touchmove touchend touchcancel\";function vt(){this.evTarget=nt,this.evWin=ht,this.started=!1,mn.apply(this,arguments)}Y(vt,mn,{handler:function(ft){var Lt=tt[ft.type];if(Lt===Xi&&(this.started=!0),!!this.started){var Kt=xt.call(this,ft,Lt);Lt&(ki|ts)&&Kt[0].length-Kt[1].length===0&&(this.started=!1),this.callback(this.manager,Lt,{pointers:Kt[0],changedPointers:Kt[1],pointerType:Si,srcEvent:ft})}}});function xt(lt,ft){var Lt=De(lt.touches),Kt=De(lt.changedTouches);return ft&(ki|ts)&&(Lt=Ke(Lt.concat(Kt),\"identifier\",!0)),[Lt,Kt]}var _t={touchstart:Xi,touchmove:Jn,touchend:ki,touchcancel:ts},Dt=\"touchstart touchmove touchend touchcancel\";function Mt(){this.evTarget=Dt,this.targetIds={},mn.apply(this,arguments)}Y(Mt,mn,{handler:function(ft){var Lt=_t[ft.type],Kt=Vt.call(this,ft,Lt);Kt&&this.callback(this.manager,Lt,{pointers:Kt[0],changedPointers:Kt[1],pointerType:Si,srcEvent:ft})}});function Vt(lt,ft){var Lt=De(lt.touches),Kt=this.targetIds;if(ft&(Xi|Jn)&&Lt.length===1)return Kt[Lt[0].identifier]=!0,[Lt,Lt];var ge,Qe,ti=De(lt.changedTouches),is=[],Ts=this.target;if(Qe=Lt.filter(function(Vs){return Xt(Vs.target,Ts)}),ft===Xi)for(ge=0;ge-1&&Kt.splice(Qe,1)};setTimeout(ge,ie)}}function Xe(lt){for(var ft=lt.srcEvent.clientX,Lt=lt.srcEvent.clientY,Kt=0;Kt-1&&this.requireFail.splice(ft,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(lt){return!!this.simultaneous[lt.id]},emit:function(lt){var ft=this,Lt=this.state;function Kt(ge){ft.manager.emit(ge,lt)}Lt=ai&&Kt(ft.options.event+Vm(Lt))},tryEmit:function(lt){if(this.canEmit())return this.emit(lt);this.state=ln},canEmit:function(){for(var lt=0;ltft.threshold&&ge&ft.direction},attrTest:function(lt){return So.prototype.attrTest.call(this,lt)&&(this.state&Ss||!(this.state&Ss)&&this.directionTest(lt))},emit:function(lt){this.pX=lt.deltaX,this.pY=lt.deltaY;var ft=Go(lt.direction);ft&&(lt.additionalEvent=this.options.event+ft),this._super.emit.call(this,lt)}});function Ki(){So.apply(this,arguments)}Y(Ki,So,{defaults:{event:\"pinch\",threshold:0,pointers:2},getTouchAction:function(){return[Hr]},attrTest:function(lt){return this._super.attrTest.call(this,lt)&&(Math.abs(lt.scale-1)>this.options.threshold||this.state&Ss)},emit:function(lt){if(lt.scale!==1){var ft=lt.scale<1?\"in\":\"out\";lt.additionalEvent=this.options.event+ft}this._super.emit.call(this,lt)}});function _i(){Dn.apply(this,arguments),this._timer=null,this._input=null}Y(_i,Dn,{defaults:{event:\"press\",pointers:1,time:251,threshold:9},getTouchAction:function(){return[zi]},process:function(lt){var ft=this.options,Lt=lt.pointers.length===ft.pointers,Kt=lt.distanceft.time;if(this._input=lt,!Kt||!Lt||lt.eventType&(ki|ts)&&!ge)this.reset();else if(lt.eventType&Xi)this.reset(),this._timer=w(function(){this.state=ka,this.tryEmit()},ft.time,this);else if(lt.eventType&ki)return ka;return ln},reset:function(){clearTimeout(this._timer)},emit:function(lt){this.state===ka&&(lt&<.eventType&ki?this.manager.emit(this.options.event+\"up\",lt):(this._input.timeStamp=_(),this.manager.emit(this.options.event,this._input)))}});function Gl(){So.apply(this,arguments)}Y(Gl,So,{defaults:{event:\"rotate\",threshold:0,pointers:2},getTouchAction:function(){return[Hr]},attrTest:function(lt){return this._super.attrTest.call(this,lt)&&(Math.abs(lt.rotation)>this.options.threshold||this.state&Ss)}});function cn(){So.apply(this,arguments)}Y(cn,So,{defaults:{event:\"swipe\",threshold:10,velocity:.3,direction:as|ao,pointers:1},getTouchAction:function(){return jl.prototype.getTouchAction.call(this)},attrTest:function(lt){var ft=this.options.direction,Lt;return ft&(as|ao)?Lt=lt.overallVelocity:ft&as?Lt=lt.overallVelocityX:ft&ao&&(Lt=lt.overallVelocityY),this._super.attrTest.call(this,lt)&&ft<.offsetDirection&<.distance>this.options.threshold&<.maxPointers==this.options.pointers&&f(Lt)>this.options.velocity&<.eventType&ki},emit:function(lt){var ft=Go(lt.offsetDirection);ft&&this.manager.emit(this.options.event+ft,lt),this.manager.emit(this.options.event,lt)}});function pu(){Dn.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}Y(pu,Dn,{defaults:{event:\"tap\",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ni]},process:function(lt){var ft=this.options,Lt=lt.pointers.length===ft.pointers,Kt=lt.distance{\"use strict\";hB.exports=U3;hB.exports.default=U3;function U3(e,t,r){r=r||2;var i=t&&t.length,s=i?t[0]*r:e.length,n=Lq(e,0,s,r,!0),o=[];if(!n||n.next===n.prev)return o;var c,f,_,w,I,R,N;if(i&&(n=wpt(e,t,n,r)),e.length>80*r){c=_=e[0],f=w=e[1];for(var j=r;j_&&(_=I),R>w&&(w=R);N=Math.max(_-c,w-f),N=N!==0?32767/N:0}return X2(n,o,r,c,f,N,0),o}function Lq(e,t,r,i,s){var n,o;if(s===uB(e,t,r,i)>0)for(n=t;n=t;n-=i)o=Cq(n,e[n],e[n+1],o);return o&&V3(o,o.next)&&(J2(o),o=o.next),o}function jg(e,t){if(!e)return e;t||(t=e);var r=e,i;do if(i=!1,!r.steiner&&(V3(r,r.next)||_s(r.prev,r,r.next)===0)){if(J2(r),r=t=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==t);return t}function X2(e,t,r,i,s,n,o){if(e){!o&&n&&Ppt(e,i,s,n);for(var c=e,f,_;e.prev!==e.next;){if(f=e.prev,_=e.next,n?vpt(e,i,s,n):ypt(e)){t.push(f.i/r|0),t.push(e.i/r|0),t.push(_.i/r|0),J2(e),e=_.next,c=_.next;continue}if(e=_,e===c){o?o===1?(e=xpt(jg(e),t,r),X2(e,t,r,i,s,n,2)):o===2&&bpt(e,t,r,i,s,n):X2(jg(e),t,r,i,s,n,1);break}}}}function ypt(e){var t=e.prev,r=e,i=e.next;if(_s(t,r,i)>=0)return!1;for(var s=t.x,n=r.x,o=i.x,c=t.y,f=r.y,_=i.y,w=sn?s>o?s:o:n>o?n:o,N=c>f?c>_?c:_:f>_?f:_,j=i.next;j!==t;){if(j.x>=w&&j.x<=R&&j.y>=I&&j.y<=N&&Jv(s,c,n,f,o,_,j.x,j.y)&&_s(j.prev,j,j.next)>=0)return!1;j=j.next}return!0}function vpt(e,t,r,i){var s=e.prev,n=e,o=e.next;if(_s(s,n,o)>=0)return!1;for(var c=s.x,f=n.x,_=o.x,w=s.y,I=n.y,R=o.y,N=cf?c>_?c:_:f>_?f:_,et=w>I?w>R?w:R:I>R?I:R,Y=lB(N,j,t,r,i),K=lB(Q,et,t,r,i),J=e.prevZ,ut=e.nextZ;J&&J.z>=Y&&ut&&ut.z<=K;){if(J.x>=N&&J.x<=Q&&J.y>=j&&J.y<=et&&J!==s&&J!==o&&Jv(c,w,f,I,_,R,J.x,J.y)&&_s(J.prev,J,J.next)>=0||(J=J.prevZ,ut.x>=N&&ut.x<=Q&&ut.y>=j&&ut.y<=et&&ut!==s&&ut!==o&&Jv(c,w,f,I,_,R,ut.x,ut.y)&&_s(ut.prev,ut,ut.next)>=0))return!1;ut=ut.nextZ}for(;J&&J.z>=Y;){if(J.x>=N&&J.x<=Q&&J.y>=j&&J.y<=et&&J!==s&&J!==o&&Jv(c,w,f,I,_,R,J.x,J.y)&&_s(J.prev,J,J.next)>=0)return!1;J=J.prevZ}for(;ut&&ut.z<=K;){if(ut.x>=N&&ut.x<=Q&&ut.y>=j&&ut.y<=et&&ut!==s&&ut!==o&&Jv(c,w,f,I,_,R,ut.x,ut.y)&&_s(ut.prev,ut,ut.next)>=0)return!1;ut=ut.nextZ}return!0}function xpt(e,t,r){var i=e;do{var s=i.prev,n=i.next.next;!V3(s,n)&&kq(s,i,i.next,n)&&K2(s,n)&&K2(n,s)&&(t.push(s.i/r|0),t.push(i.i/r|0),t.push(n.i/r|0),J2(i),J2(i.next),i=e=n),i=i.next}while(i!==e);return jg(i)}function bpt(e,t,r,i,s,n){var o=e;do{for(var c=o.next.next;c!==o.prev;){if(o.i!==c.i&&Lpt(o,c)){var f=Rq(o,c);o=jg(o,o.next),f=jg(f,f.next),X2(o,t,r,i,s,n,0),X2(f,t,r,i,s,n,0);return}c=c.next}o=o.next}while(o!==e)}function wpt(e,t,r,i){var s=[],n,o,c,f,_;for(n=0,o=t.length;n=r.next.y&&r.next.y!==r.y){var c=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(c<=i&&c>n&&(n=c,o=r.x=r.x&&r.x>=_&&i!==r.x&&Jv(so.x||r.x===o.x&&Ept(o,r)))&&(o=r,I=R)),r=r.next;while(r!==f);return o}function Ept(e,t){return _s(e.prev,e,t.prev)<0&&_s(t.next,e,e.next)<0}function Ppt(e,t,r,i){var s=e;do s.z===0&&(s.z=lB(s.x,s.y,t,r,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,Ipt(s)}function Ipt(e){var t,r,i,s,n,o,c,f,_=1;do{for(r=e,e=null,n=null,o=0;r;){for(o++,i=r,c=0,t=0;t<_&&(c++,i=i.nextZ,!!i);t++);for(f=_;c>0||f>0&&i;)c!==0&&(f===0||!i||r.z<=i.z)?(s=r,r=r.nextZ,c--):(s=i,i=i.nextZ,f--),n?n.nextZ=s:e=s,s.prevZ=n,n=s;r=i}n.nextZ=null,_*=2}while(o>1);return e}function lB(e,t,r,i,s){return e=(e-r)*s|0,t=(t-i)*s|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Cpt(e){var t=e,r=e;do(t.x=(e-o)*(n-c)&&(e-o)*(i-c)>=(r-o)*(t-c)&&(r-o)*(n-c)>=(s-o)*(i-c)}function Lpt(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!kpt(e,t)&&(K2(e,t)&&K2(t,e)&&Rpt(e,t)&&(_s(e.prev,e,t.prev)||_s(e,t.prev,t))||V3(e,t)&&_s(e.prev,e,e.next)>0&&_s(t.prev,t,t.next)>0)}function _s(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function V3(e,t){return e.x===t.x&&e.y===t.y}function kq(e,t,r,i){var s=N3(_s(e,t,r)),n=N3(_s(e,t,i)),o=N3(_s(r,i,e)),c=N3(_s(r,i,t));return!!(s!==n&&o!==c||s===0&&z3(e,r,t)||n===0&&z3(e,i,t)||o===0&&z3(r,e,i)||c===0&&z3(r,t,i))}function z3(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function N3(e){return e>0?1:e<0?-1:0}function kpt(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&kq(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function K2(e,t){return _s(e.prev,e,e.next)<0?_s(e,t,e.next)>=0&&_s(e,e.prev,t)>=0:_s(e,t,e.prev)<0||_s(e,e.next,t)<0}function Rpt(e,t){var r=e,i=!1,s=(e.x+t.x)/2,n=(e.y+t.y)/2;do r.y>n!=r.next.y>n&&r.next.y!==r.y&&s<(r.next.x-r.x)*(n-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==e);return i}function Rq(e,t){var r=new cB(e.i,e.x,e.y),i=new cB(t.i,t.x,t.y),s=e.next,n=t.prev;return e.next=t,t.prev=e,r.next=s,s.prev=r,i.next=r,r.prev=i,n.next=i,i.prev=n,i}function Cq(e,t,r,i){var s=new cB(e,t,r);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function J2(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function cB(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}U3.deviation=function(e,t,r,i){var s=t&&t.length,n=s?t[0]*r:e.length,o=Math.abs(uB(e,0,n,r));if(s)for(var c=0,f=t.length;c0&&(i+=e[s-1].length,r.holes.push(i))}return r}});var nF=Br(Tx=>{\"use strict\";Object.defineProperty(Tx,\"__esModule\",{value:!0});Tx.DefaultSerializer=Tx.extendSerializer=void 0;function Hyt(e,t){let r=e.deserialize.bind(e),i=e.serialize.bind(e);return{deserialize(s){return t.deserialize(s,r)},serialize(s){return t.serialize(s,i)}}}Tx.extendSerializer=Hyt;var w$={deserialize(e){return Object.assign(Error(e.message),{name:e.name,stack:e.stack})},serialize(e){return{__error_marker:\"$$error\",message:e.message,name:e.name,stack:e.stack}}},qyt=e=>e&&typeof e==\"object\"&&\"__error_marker\"in e&&e.__error_marker===\"$$error\";Tx.DefaultSerializer={deserialize(e){return qyt(e)?w$.deserialize(e):e},serialize(e){return e instanceof Error?w$.serialize(e):e}}});var Mx=Br(km=>{\"use strict\";Object.defineProperty(km,\"__esModule\",{value:!0});km.serialize=km.deserialize=km.registerSerializer=void 0;var S$=nF(),zI=S$.DefaultSerializer;function Zyt(e){zI=S$.extendSerializer(zI,e)}km.registerSerializer=Zyt;function Yyt(e){return zI.deserialize(e)}km.deserialize=Yyt;function Qyt(e){return zI.serialize(e)}km.serialize=Qyt});var M$=Br(Ex=>{\"use strict\";Object.defineProperty(Ex,\"__esModule\",{value:!0});Ex.getBundleURL=Ex.getBaseURL=void 0;var sF;function $yt(){return sF||(sF=Xyt()),sF}Ex.getBundleURL=$yt;function Xyt(){try{throw new Error}catch(e){let t=(\"\"+e.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\\/\\/[^)\\n]+/g);if(t)return T$(t[0])}return\"/\"}function T$(e){return(\"\"+e).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\\/\\/.+)?\\/[^/]+(?:\\?.*)?$/,\"$1\")+\"/\"}Ex.getBaseURL=T$});var aF=Br(Rm=>{\"use strict\";Object.defineProperty(Rm,\"__esModule\",{value:!0});Rm.isWorkerRuntime=Rm.getWorkerImplementation=Rm.defaultPoolSize=void 0;var E$=M$();Rm.defaultPoolSize=typeof navigator<\"u\"&&navigator.hardwareConcurrency?navigator.hardwareConcurrency:4;var P$=e=>/^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(e);function I$(e){let t=new Blob([e],{type:\"application/javascript\"});return URL.createObjectURL(t)}function Kyt(){if(typeof Worker>\"u\")return class{constructor(){throw Error(\"No web worker implementation available. You might have tried to spawn a worker within a worker in a browser that doesn't support workers in workers.\")}};class e extends Worker{constructor(i,s){var n,o;typeof i==\"string\"&&s&&s._baseURL?i=new URL(i,s._baseURL):typeof i==\"string\"&&!P$(i)&&E$.getBundleURL().match(/^file:\\/\\//i)&&(i=new URL(i,E$.getBundleURL().replace(/\\/[^\\/]+$/,\"/\")),(!((n=s?.CORSWorkaround)!==null&&n!==void 0)||n)&&(i=I$(`importScripts(${JSON.stringify(i)});`))),typeof i==\"string\"&&P$(i)&&(!((o=s?.CORSWorkaround)!==null&&o!==void 0)||o)&&(i=I$(`importScripts(${JSON.stringify(i)});`)),super(i,s)}}class t extends e{constructor(i,s){let n=window.URL.createObjectURL(i);super(n,s)}static fromText(i,s){let n=new window.Blob([i],{type:\"text/javascript\"});return new t(n,s)}}return{blob:t,default:e}}var oF;function Jyt(){return oF||(oF=Kyt()),oF}Rm.getWorkerImplementation=Jyt;function tvt(){let e=typeof self<\"u\"&&typeof Window<\"u\"&&self instanceof Window;return!!(typeof self<\"u\"&&self.postMessage&&!e)}Rm.isWorkerRuntime=tvt});var L$=Br((Vle,C$)=>{var Px=1e3,Ix=Px*60,Cx=Ix*60,r_=Cx*24,evt=r_*7,rvt=r_*365.25;C$.exports=function(e,t){t=t||{};var r=typeof e;if(r===\"string\"&&e.length>0)return ivt(e);if(r===\"number\"&&isFinite(e))return t.long?svt(e):nvt(e);throw new Error(\"val is not a non-empty string or a valid number. val=\"+JSON.stringify(e))};function ivt(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),i=(t[2]||\"ms\").toLowerCase();switch(i){case\"years\":case\"year\":case\"yrs\":case\"yr\":case\"y\":return r*rvt;case\"weeks\":case\"week\":case\"w\":return r*evt;case\"days\":case\"day\":case\"d\":return r*r_;case\"hours\":case\"hour\":case\"hrs\":case\"hr\":case\"h\":return r*Cx;case\"minutes\":case\"minute\":case\"mins\":case\"min\":case\"m\":return r*Ix;case\"seconds\":case\"second\":case\"secs\":case\"sec\":case\"s\":return r*Px;case\"milliseconds\":case\"millisecond\":case\"msecs\":case\"msec\":case\"ms\":return r;default:return}}}}function nvt(e){var t=Math.abs(e);return t>=r_?Math.round(e/r_)+\"d\":t>=Cx?Math.round(e/Cx)+\"h\":t>=Ix?Math.round(e/Ix)+\"m\":t>=Px?Math.round(e/Px)+\"s\":e+\"ms\"}function svt(e){var t=Math.abs(e);return t>=r_?NI(e,t,r_,\"day\"):t>=Cx?NI(e,t,Cx,\"hour\"):t>=Ix?NI(e,t,Ix,\"minute\"):t>=Px?NI(e,t,Px,\"second\"):e+\" ms\"}function NI(e,t,r,i){var s=t>=r*1.5;return Math.round(e/r)+\" \"+i+(s?\"s\":\"\")}});var R$=Br((jle,k$)=>{function ovt(e){r.debug=r,r.default=r,r.coerce=f,r.disable=n,r.enable=s,r.enabled=o,r.humanize=L$(),r.destroy=_,Object.keys(e).forEach(w=>{r[w]=e[w]}),r.names=[],r.skips=[],r.formatters={};function t(w){let I=0;for(let R=0;R{if(kt===\"%%\")return\"%\";ut++;let qt=r.formatters[Xt];if(typeof qt==\"function\"){let le=et[ut];kt=qt.call(Y,le),et.splice(ut,1),ut--}return kt}),r.formatArgs.call(Y,et),(Y.log||r.log).apply(Y,et)}return Q.namespace=w,Q.useColors=r.useColors(),Q.color=r.selectColor(w),Q.extend=i,Q.destroy=r.destroy,Object.defineProperty(Q,\"enabled\",{enumerable:!0,configurable:!1,get:()=>R!==null?R:(N!==r.namespaces&&(N=r.namespaces,j=r.enabled(w)),j),set:et=>{R=et}}),typeof r.init==\"function\"&&r.init(Q),Q}function i(w,I){let R=r(this.namespace+(typeof I>\"u\"?\":\":I)+w);return R.log=this.log,R}function s(w){r.save(w),r.namespaces=w,r.names=[],r.skips=[];let I,R=(typeof w==\"string\"?w:\"\").split(/[\\s,]+/),N=R.length;for(I=0;I\"-\"+I)].join(\",\");return r.enable(\"\"),w}function o(w){if(w[w.length-1]===\"*\")return!0;let I,R;for(I=0,R=r.skips.length;I{hu.formatArgs=lvt;hu.save=cvt;hu.load=uvt;hu.useColors=avt;hu.storage=hvt();hu.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn(\"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.\"))}})();hu.colors=[\"#0000CC\",\"#0000FF\",\"#0033CC\",\"#0033FF\",\"#0066CC\",\"#0066FF\",\"#0099CC\",\"#0099FF\",\"#00CC00\",\"#00CC33\",\"#00CC66\",\"#00CC99\",\"#00CCCC\",\"#00CCFF\",\"#3300CC\",\"#3300FF\",\"#3333CC\",\"#3333FF\",\"#3366CC\",\"#3366FF\",\"#3399CC\",\"#3399FF\",\"#33CC00\",\"#33CC33\",\"#33CC66\",\"#33CC99\",\"#33CCCC\",\"#33CCFF\",\"#6600CC\",\"#6600FF\",\"#6633CC\",\"#6633FF\",\"#66CC00\",\"#66CC33\",\"#9900CC\",\"#9900FF\",\"#9933CC\",\"#9933FF\",\"#99CC00\",\"#99CC33\",\"#CC0000\",\"#CC0033\",\"#CC0066\",\"#CC0099\",\"#CC00CC\",\"#CC00FF\",\"#CC3300\",\"#CC3333\",\"#CC3366\",\"#CC3399\",\"#CC33CC\",\"#CC33FF\",\"#CC6600\",\"#CC6633\",\"#CC9900\",\"#CC9933\",\"#CCCC00\",\"#CCCC33\",\"#FF0000\",\"#FF0033\",\"#FF0066\",\"#FF0099\",\"#FF00CC\",\"#FF00FF\",\"#FF3300\",\"#FF3333\",\"#FF3366\",\"#FF3399\",\"#FF33CC\",\"#FF33FF\",\"#FF6600\",\"#FF6633\",\"#FF9900\",\"#FF9933\",\"#FFCC00\",\"#FFCC33\"];function avt(){return typeof window<\"u\"&&window.process&&(window.process.type===\"renderer\"||window.process.__nwjs)?!0:typeof navigator<\"u\"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)?!1:typeof document<\"u\"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<\"u\"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<\"u\"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<\"u\"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/)}function lvt(e){if(e[0]=(this.useColors?\"%c\":\"\")+this.namespace+(this.useColors?\" %c\":\" \")+e[0]+(this.useColors?\"%c \":\" \")+\"+\"+UI.exports.humanize(this.diff),!this.useColors)return;let t=\"color: \"+this.color;e.splice(1,0,t,\"color: inherit\");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!==\"%%\"&&(r++,s===\"%c\"&&(i=r))}),e.splice(i,0,t)}hu.log=console.debug||console.log||(()=>{});function cvt(e){try{e?hu.storage.setItem(\"debug\",e):hu.storage.removeItem(\"debug\")}catch{}}function uvt(){let e;try{e=hu.storage.getItem(\"debug\")}catch{}return!e&&typeof process<\"u\"&&\"env\"in process&&(e=process.env.DEBUG),e}function hvt(){try{return localStorage}catch{}}UI.exports=R$()(hu);var{formatters:fvt}=UI.exports;fvt.j=function(e){try{return JSON.stringify(e)}catch(t){return\"[UnexpectedJSONParseError]: \"+t.message}}});var kS=Br(Lx=>{\"use strict\";var dvt=Lx&&Lx.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})};Object.defineProperty(Lx,\"__esModule\",{value:!0});Lx.AsyncSerialScheduler=void 0;var lF=class{constructor(t){this._baseObserver=t,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then(()=>this._baseObserver.complete()).catch(t=>this._baseObserver.error(t))}error(t){this._baseObserver.error(t)}schedule(t){let r=Promise.all(this._pendingPromises),i=[],s=o=>i.push(o),n=Promise.resolve().then(()=>dvt(this,void 0,void 0,function*(){yield r,yield t(s),this._pendingPromises.delete(n);for(let o of i)this._baseObserver.next(o)})).catch(o=>{this._pendingPromises.delete(n),this._baseObserver.error(o)});this._pendingPromises.add(n)}};Lx.AsyncSerialScheduler=lF});var O$=Br(D$=>{\"use strict\";Object.defineProperty(D$,\"__esModule\",{value:!0})});var cF=Br(Bl=>{\"use strict\";Object.defineProperty(Bl,\"__esModule\",{value:!0});Bl.registerObservableSymbol=Bl.getSymbol=Bl.hasSymbol=Bl.hasSymbols=void 0;var pvt=()=>typeof Symbol==\"function\";Bl.hasSymbols=pvt;var Avt=e=>Bl.hasSymbols()&&!!Symbol[e];Bl.hasSymbol=Avt;var mvt=e=>Bl.hasSymbol(e)?Symbol[e]:\"@@\"+e;Bl.getSymbol=mvt;function gvt(){Bl.hasSymbols()&&!Bl.hasSymbol(\"observable\")&&(Symbol.observable=Symbol(\"observable\"))}Bl.registerObservableSymbol=gvt;Bl.hasSymbol(\"asyncIterator\")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for(\"Symbol.asyncIterator\"))});var gd=Br(Vp=>{\"use strict\";Object.defineProperty(Vp,\"__esModule\",{value:!0});Vp.Observable=Vp.SubscriptionObserver=Vp.Subscription=void 0;O$();var DS=cF(),_vt=DS.getSymbol(\"iterator\"),hF=DS.getSymbol(\"observable\"),B$=DS.getSymbol(\"species\");function GI(e,t){let r=e[t];if(r!=null){if(typeof r!=\"function\")throw new TypeError(r+\" is not a function\");return r}}function RS(e){let t=e.constructor;return t!==void 0&&(t=t[B$],t===null&&(t=void 0)),t!==void 0?t:i_}function yvt(e){return e instanceof i_}function kx(e){kx.log?kx.log(e):setTimeout(()=>{throw e},0)}function jI(e){Promise.resolve().then(()=>{try{e()}catch(t){kx(t)}})}function F$(e){let t=e._cleanup;if(t!==void 0&&(e._cleanup=void 0,!!t))try{if(typeof t==\"function\")t();else{let r=GI(t,\"unsubscribe\");r&&r.call(t)}}catch(r){kx(r)}}function fF(e){e._observer=void 0,e._queue=void 0,e._state=\"closed\"}function vvt(e){let t=e._queue;if(t){e._queue=void 0,e._state=\"ready\";for(let r of t)if(z$(e,r.type,r.value),e._state===\"closed\")break}}function z$(e,t,r){e._state=\"running\";let i=e._observer;try{let s=i?GI(i,t):void 0;switch(t){case\"next\":s&&s.call(i,r);break;case\"error\":if(fF(e),s)s.call(i,r);else throw r;break;case\"complete\":fF(e),s&&s.call(i);break}}catch(s){kx(s)}e._state===\"closed\"?F$(e):e._state===\"running\"&&(e._state=\"ready\")}function uF(e,t,r){if(e._state!==\"closed\"){if(e._state===\"buffering\"){e._queue=e._queue||[],e._queue.push({type:t,value:r});return}if(e._state!==\"ready\"){e._state=\"buffering\",e._queue=[{type:t,value:r}],jI(()=>vvt(e));return}z$(e,t,r)}}var WI=class{constructor(t,r){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state=\"initializing\";let i=new HI(this);try{this._cleanup=r.call(void 0,i)}catch(s){i.error(s)}this._state===\"initializing\"&&(this._state=\"ready\")}get closed(){return this._state===\"closed\"}unsubscribe(){this._state!==\"closed\"&&(fF(this),F$(this))}};Vp.Subscription=WI;var HI=class{constructor(t){this._subscription=t}get closed(){return this._subscription._state===\"closed\"}next(t){uF(this._subscription,\"next\",t)}error(t){uF(this._subscription,\"error\",t)}complete(){uF(this._subscription,\"complete\")}};Vp.SubscriptionObserver=HI;var i_=class e{constructor(t){if(!(this instanceof e))throw new TypeError(\"Observable cannot be called as a function\");if(typeof t!=\"function\")throw new TypeError(\"Observable initializer must be a function\");this._subscriber=t}subscribe(t,r,i){return(typeof t!=\"object\"||t===null)&&(t={next:t,error:r,complete:i}),new WI(t,this._subscriber)}pipe(t,...r){let i=this;for(let s of[t,...r])i=s(i);return i}tap(t,r,i){let s=typeof t!=\"object\"||t===null?{next:t,error:r,complete:i}:t;return new e(n=>this.subscribe({next(o){s.next&&s.next(o),n.next(o)},error(o){s.error&&s.error(o),n.error(o)},complete(){s.complete&&s.complete(),n.complete()},start(o){s.start&&s.start(o)}}))}forEach(t){return new Promise((r,i)=>{if(typeof t!=\"function\"){i(new TypeError(t+\" is not a function\"));return}function s(){n.unsubscribe(),r(void 0)}let n=this.subscribe({next(o){try{t(o,s)}catch(c){i(c),n.unsubscribe()}},error(o){i(o)},complete(){r(void 0)}})})}map(t){if(typeof t!=\"function\")throw new TypeError(t+\" is not a function\");let r=RS(this);return new r(i=>this.subscribe({next(s){let n=s;try{n=t(s)}catch(o){return i.error(o)}i.next(n)},error(s){i.error(s)},complete(){i.complete()}}))}filter(t){if(typeof t!=\"function\")throw new TypeError(t+\" is not a function\");let r=RS(this);return new r(i=>this.subscribe({next(s){try{if(!t(s))return}catch(n){return i.error(n)}i.next(s)},error(s){i.error(s)},complete(){i.complete()}}))}reduce(t,r){if(typeof t!=\"function\")throw new TypeError(t+\" is not a function\");let i=RS(this),s=arguments.length>1,n=!1,o=r;return new i(c=>this.subscribe({next(f){let _=!n;if(n=!0,!_||s)try{o=t(o,f)}catch(w){return c.error(w)}else o=f},error(f){c.error(f)},complete(){if(!n&&!s)return c.error(new TypeError(\"Cannot reduce an empty sequence\"));c.next(o),c.complete()}}))}concat(...t){let r=RS(this);return new r(i=>{let s,n=0;function o(c){s=c.subscribe({next(f){i.next(f)},error(f){i.error(f)},complete(){n===t.length?(s=void 0,i.complete()):o(r.from(t[n++]))}})}return o(this),()=>{s&&(s.unsubscribe(),s=void 0)}})}flatMap(t){if(typeof t!=\"function\")throw new TypeError(t+\" is not a function\");let r=RS(this);return new r(i=>{let s=[],n=this.subscribe({next(c){let f;if(t)try{f=t(c)}catch(w){return i.error(w)}else f=c;let _=r.from(f).subscribe({next(w){i.next(w)},error(w){i.error(w)},complete(){let w=s.indexOf(_);w>=0&&s.splice(w,1),o()}});s.push(_)},error(c){i.error(c)},complete(){o()}});function o(){n.closed&&s.length===0&&i.complete()}return()=>{s.forEach(c=>c.unsubscribe()),n.unsubscribe()}})}[(Symbol.observable,hF)](){return this}static from(t){let r=typeof this==\"function\"?this:e;if(t==null)throw new TypeError(t+\" is not an object\");let i=GI(t,hF);if(i){let s=i.call(t);if(Object(s)!==s)throw new TypeError(s+\" is not an object\");return yvt(s)&&s.constructor===r?s:new r(n=>s.subscribe(n))}if(DS.hasSymbol(\"iterator\")){let s=GI(t,_vt);if(s)return new r(n=>{jI(()=>{if(!n.closed){for(let o of s.call(t))if(n.next(o),n.closed)return;n.complete()}})})}if(Array.isArray(t))return new r(s=>{jI(()=>{if(!s.closed){for(let n of t)if(s.next(n),s.closed)return;s.complete()}})});throw new TypeError(t+\" is not observable\")}static of(...t){let r=typeof this==\"function\"?this:e;return new r(i=>{jI(()=>{if(!i.closed){for(let s of t)if(i.next(s),i.closed)return;i.complete()}})})}static get[B$](){return this}};Vp.Observable=i_;DS.hasSymbols()&&Object.defineProperty(i_,Symbol(\"extensions\"),{value:{symbol:hF,hostReportError:kx},configurable:!0});Vp.default=i_});var Dm=Br(dF=>{\"use strict\";Object.defineProperty(dF,\"__esModule\",{value:!0});function xvt(e){typeof e==\"function\"?e():e&&typeof e.unsubscribe==\"function\"&&e.unsubscribe()}dF.default=xvt});var N$=Br(OS=>{\"use strict\";var bvt=OS&&OS.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})};Object.defineProperty(OS,\"__esModule\",{value:!0});var wvt=kS(),Svt=gd(),Tvt=Dm();function Mvt(e){return t=>new Svt.default(r=>{let i=new wvt.AsyncSerialScheduler(r),s=t.subscribe({complete(){i.complete()},error(n){i.error(n)},next(n){i.schedule(o=>bvt(this,void 0,void 0,function*(){(yield e(n))&&o(n)}))}});return()=>Tvt.default(s)})}OS.default=Mvt});var V$=Br(Rx=>{\"use strict\";Object.defineProperty(Rx,\"__esModule\",{value:!0});Rx.isIterator=Rx.isAsyncIterator=void 0;var U$=cF();function Evt(e){return e&&U$.hasSymbol(\"asyncIterator\")&&e[Symbol.asyncIterator]}Rx.isAsyncIterator=Evt;function Pvt(e){return e&&U$.hasSymbol(\"iterator\")&&e[Symbol.iterator]}Rx.isIterator=Pvt});var G$=Br(n_=>{\"use strict\";var Ivt=n_&&n_.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})},Cvt=n_&&n_.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError(\"Symbol.asyncIterator is not defined.\");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof __values==\"function\"?__values(e):e[Symbol.iterator](),r={},i(\"next\"),i(\"throw\"),i(\"return\"),r[Symbol.asyncIterator]=function(){return this},r);function i(n){r[n]=e[n]&&function(o){return new Promise(function(c,f){o=e[n](o),s(c,f,o.done,o.value)})}}function s(n,o,c,f){Promise.resolve(f).then(function(_){n({value:_,done:c})},o)}};Object.defineProperty(n_,\"__esModule\",{value:!0});var Lvt=kS(),j$=V$(),kvt=gd(),Rvt=Dm();function Dvt(e){return t=>new kvt.default(r=>{let i=new Lvt.AsyncSerialScheduler(r),s=t.subscribe({complete(){i.complete()},error(n){i.error(n)},next(n){i.schedule(o=>Ivt(this,void 0,void 0,function*(){var c,f;let _=yield e(n);if(j$.isIterator(_)||j$.isAsyncIterator(_))try{for(var w=Cvt(_),I;I=yield w.next(),!I.done;){let R=I.value;o(R)}}catch(R){c={error:R}}finally{try{I&&!I.done&&(f=w.return)&&(yield f.call(w))}finally{if(c)throw c.error}}else _.map(R=>o(R))}))}});return()=>Rvt.default(s)})}n_.default=Dvt});var W$=Br(pF=>{\"use strict\";Object.defineProperty(pF,\"__esModule\",{value:!0});var Ovt=gd();function Bvt(e){return new Ovt.Observable(t=>{let r=0,i=setInterval(()=>{t.next(r++)},e);return()=>clearInterval(i)})}pF.default=Bvt});var H$=Br(BS=>{\"use strict\";var Fvt=BS&&BS.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})};Object.defineProperty(BS,\"__esModule\",{value:!0});var zvt=kS(),Nvt=gd(),Uvt=Dm();function Vvt(e){return t=>new Nvt.default(r=>{let i=new zvt.AsyncSerialScheduler(r),s=t.subscribe({complete(){i.complete()},error(n){i.error(n)},next(n){i.schedule(o=>Fvt(this,void 0,void 0,function*(){let c=yield e(n);o(c)}))}});return()=>Uvt.default(s)})}BS.default=Vvt});var Z$=Br(AF=>{\"use strict\";Object.defineProperty(AF,\"__esModule\",{value:!0});var q$=gd(),jvt=Dm();function Gvt(...e){return e.length===0?q$.Observable.from([]):new q$.Observable(t=>{let r=0,i=e.map(n=>n.subscribe({error(o){t.error(o),s()},next(o){t.next(o)},complete(){++r===e.length&&(t.complete(),s())}})),s=()=>{i.forEach(n=>jvt.default(n))};return s})}AF.default=Gvt});var _F=Br(gF=>{\"use strict\";Object.defineProperty(gF,\"__esModule\",{value:!0});var Wvt=gd(),mF=class extends Wvt.default{constructor(){super(t=>(this._observers.add(t),()=>this._observers.delete(t))),this._observers=new Set}next(t){for(let r of this._observers)r.next(t)}error(t){for(let r of this._observers)r.error(t)}complete(){for(let t of this._observers)t.complete()}};gF.default=mF});var Y$=Br(yF=>{\"use strict\";Object.defineProperty(yF,\"__esModule\",{value:!0});var Hvt=gd(),qvt=_F(),Zvt=Dm();function Yvt(e){let t=new qvt.default,r,i=0;return new Hvt.default(s=>{r||(r=e.subscribe(t));let n=t.subscribe(s);return i++,()=>{i--,n.unsubscribe(),i===0&&(Zvt.default(r),r=void 0)}})}yF.default=Yvt});var Q$=Br(FS=>{\"use strict\";var Qvt=FS&&FS.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})};Object.defineProperty(FS,\"__esModule\",{value:!0});var $vt=kS(),Xvt=gd(),Kvt=Dm();function Jvt(e,t){return r=>new Xvt.default(i=>{let s,n=0,o=new $vt.AsyncSerialScheduler(i),c=r.subscribe({complete(){o.complete()},error(f){o.error(f)},next(f){o.schedule(_=>Qvt(this,void 0,void 0,function*(){s=yield e(n===0?typeof t>\"u\"?f:t:s,f,n++),_(s)}))}});return()=>Kvt.default(c)})}FS.default=Jvt});var $$=Br(zs=>{\"use strict\";Object.defineProperty(zs,\"__esModule\",{value:!0});zs.unsubscribe=zs.Subject=zs.scan=zs.Observable=zs.multicast=zs.merge=zs.map=zs.interval=zs.flatMap=zs.filter=void 0;var txt=N$();Object.defineProperty(zs,\"filter\",{enumerable:!0,get:function(){return txt.default}});var ext=G$();Object.defineProperty(zs,\"flatMap\",{enumerable:!0,get:function(){return ext.default}});var rxt=W$();Object.defineProperty(zs,\"interval\",{enumerable:!0,get:function(){return rxt.default}});var ixt=H$();Object.defineProperty(zs,\"map\",{enumerable:!0,get:function(){return ixt.default}});var nxt=Z$();Object.defineProperty(zs,\"merge\",{enumerable:!0,get:function(){return nxt.default}});var sxt=Y$();Object.defineProperty(zs,\"multicast\",{enumerable:!0,get:function(){return sxt.default}});var oxt=gd();Object.defineProperty(zs,\"Observable\",{enumerable:!0,get:function(){return oxt.default}});var axt=Q$();Object.defineProperty(zs,\"scan\",{enumerable:!0,get:function(){return axt.default}});var lxt=_F();Object.defineProperty(zs,\"Subject\",{enumerable:!0,get:function(){return lxt.default}});var cxt=Dm();Object.defineProperty(zs,\"unsubscribe\",{enumerable:!0,get:function(){return cxt.default}})});var zS=Br((nce,X$)=>{X$.exports=$$()});var K$=Br(qI=>{\"use strict\";Object.defineProperty(qI,\"__esModule\",{value:!0});qI.allSettled=void 0;function uxt(e){return Promise.all(e.map(t=>{let r=n=>({status:\"fulfilled\",value:n}),i=n=>({status:\"rejected\",reason:n}),s=Promise.resolve(t);try{return s.then(r,i)}catch(n){return Promise.reject(n)}}))}qI.allSettled=uxt});var J$=Br(NS=>{\"use strict\";Object.defineProperty(NS,\"__esModule\",{value:!0});NS.PoolEventType=void 0;var hxt;(function(e){e.initialized=\"initialized\",e.taskCanceled=\"taskCanceled\",e.taskCompleted=\"taskCompleted\",e.taskFailed=\"taskFailed\",e.taskQueued=\"taskQueued\",e.taskQueueDrained=\"taskQueueDrained\",e.taskStart=\"taskStart\",e.terminated=\"terminated\"})(hxt=NS.PoolEventType||(NS.PoolEventType={}))});var US=Br(eh=>{\"use strict\";Object.defineProperty(eh,\"__esModule\",{value:!0});eh.$worker=eh.$transferable=eh.$terminate=eh.$events=eh.$errors=void 0;eh.$errors=Symbol(\"thread.errors\");eh.$events=Symbol(\"thread.events\");eh.$terminate=Symbol(\"thread.terminate\");eh.$transferable=Symbol(\"thread.transferable\");eh.$worker=Symbol(\"thread.worker\")});var xF=Br(ZI=>{\"use strict\";Object.defineProperty(ZI,\"__esModule\",{value:!0});ZI.Thread=void 0;var vF=US();function tX(e){throw Error(e)}ZI.Thread={errors(e){return e[vF.$errors]||tX(\"Error observable not found. Make sure to pass a thread instance as returned by the spawn() promise.\")},events(e){return e[vF.$events]||tX(\"Events observable not found. Make sure to pass a thread instance as returned by the spawn() promise.\")},terminate(e){return e[vF.$terminate]()}}});var nX=Br(rh=>{\"use strict\";var s_=rh&&rh.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})},fxt=rh&&rh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(rh,\"__esModule\",{value:!0});rh.Pool=rh.Thread=rh.PoolEventType=void 0;var dxt=fxt(VI()),bF=zS(),eX=K$(),pxt=aF(),ia=J$();Object.defineProperty(rh,\"PoolEventType\",{enumerable:!0,get:function(){return ia.PoolEventType}});var rX=xF();Object.defineProperty(rh,\"Thread\",{enumerable:!0,get:function(){return rX.Thread}});var Axt=1;function mxt(e){let t=[];for(let r=0;rsetTimeout(t,e))}function _xt(e,t){return e.reduce((r,i)=>[...r,...t(i)],[])}function yxt(e){return e.replace(/\\W/g,\" \").trim().replace(/\\s+/g,\"-\")}function vxt(e,t){return mxt(t).map(()=>({init:e(),runningTasks:[]}))}var YI=class{constructor(t,r){this.eventSubject=new bF.Subject,this.initErrors=[],this.isClosing=!1,this.nextTaskID=1,this.taskQueue=[];let i=typeof r==\"number\"?{size:r}:r||{},{size:s=pxt.defaultPoolSize}=i;this.debug=dxt.default(`threads:pool:${yxt(i.name||String(Axt++))}`),this.options=i,this.workers=vxt(t,s),this.eventObservable=bF.multicast(bF.Observable.from(this.eventSubject)),Promise.all(this.workers.map(n=>n.init)).then(()=>this.eventSubject.next({type:ia.PoolEventType.initialized,size:this.workers.length}),n=>{this.debug(\"Error while initializing pool worker:\",n),this.eventSubject.error(n),this.initErrors.push(n)})}findIdlingWorker(){let{concurrency:t=1}=this.options;return this.workers.find(r=>r.runningTasks.length{t.runningTasks=t.runningTasks.filter(n=>n!==i)};yield gxt(0);try{yield this.runPoolTask(t,r)}finally{s(),this.isClosing||this.scheduleWork()}});t.runningTasks.push(i)})}scheduleWork(){this.debug(\"Attempt de-queueing a task in order to run it...\");let t=this.findIdlingWorker();if(!t)return;let r=this.taskQueue.shift();if(!r){this.debug(\"Task queue is empty\"),this.eventSubject.next({type:ia.PoolEventType.taskQueueDrained});return}this.run(t,r)}taskCompletion(t){return new Promise((r,i)=>{let s=this.events().subscribe(n=>{n.type===ia.PoolEventType.taskCompleted&&n.taskID===t?(s.unsubscribe(),r(n.returnValue)):n.type===ia.PoolEventType.taskFailed&&n.taskID===t?(s.unsubscribe(),i(n.error)):n.type===ia.PoolEventType.terminated&&(s.unsubscribe(),i(Error(\"Pool has been terminated before task was run.\")))})})}settled(t=!1){return s_(this,void 0,void 0,function*(){let r=()=>_xt(this.workers,n=>n.runningTasks),i=[],s=this.eventObservable.subscribe(n=>{n.type===ia.PoolEventType.taskFailed&&i.push(n.error)});return this.initErrors.length>0?Promise.reject(this.initErrors[0]):t&&this.taskQueue.length===0?(yield eX.allSettled(r()),i):(yield new Promise((n,o)=>{let c=this.eventObservable.subscribe({next(f){f.type===ia.PoolEventType.taskQueueDrained&&(c.unsubscribe(),n(void 0))},error:o})}),yield eX.allSettled(r()),s.unsubscribe(),i)})}completed(t=!1){return s_(this,void 0,void 0,function*(){let r=this.settled(t),i=new Promise((n,o)=>{let c=this.eventObservable.subscribe({next(f){f.type===ia.PoolEventType.taskQueueDrained?(c.unsubscribe(),n(r)):f.type===ia.PoolEventType.taskFailed&&(c.unsubscribe(),o(f.error))},error:o})}),s=yield Promise.race([r,i]);if(s.length>0)throw s[0]})}events(){return this.eventObservable}queue(t){let{maxQueuedJobs:r=1/0}=this.options;if(this.isClosing)throw Error(\"Cannot schedule pool tasks after terminate() has been called.\");if(this.initErrors.length>0)throw this.initErrors[0];let i=this.nextTaskID++,s=this.taskCompletion(i);s.catch(o=>{this.debug(`Task #${i} errored:`,o)});let n={id:i,run:t,cancel:()=>{this.taskQueue.indexOf(n)!==-1&&(this.taskQueue=this.taskQueue.filter(o=>o!==n),this.eventSubject.next({type:ia.PoolEventType.taskCanceled,taskID:n.id}))},then:s.then.bind(s)};if(this.taskQueue.length>=r)throw Error(`Maximum number of pool tasks queued. Refusing to queue another one.\nThis usually happens for one of two reasons: We are either at peak workload right now or some tasks just won't finish, thus blocking the pool.`);return this.debug(`Queueing task #${n.id}...`),this.taskQueue.push(n),this.eventSubject.next({type:ia.PoolEventType.taskQueued,taskID:n.id}),this.scheduleWork(),n}terminate(t){return s_(this,void 0,void 0,function*(){this.isClosing=!0,t||(yield this.completed(!0)),this.eventSubject.next({type:ia.PoolEventType.terminated,remainingQueue:[...this.taskQueue]}),this.eventSubject.complete(),yield Promise.all(this.workers.map(r=>s_(this,void 0,void 0,function*(){return rX.Thread.terminate(yield r.init)})))})}};YI.EventType=ia.PoolEventType;function iX(e,t){return new YI(e,t)}iX.EventType=ia.PoolEventType;rh.Pool=iX});var sX=Br(QI=>{\"use strict\";Object.defineProperty(QI,\"__esModule\",{value:!0});QI.createPromiseWithResolver=void 0;var xxt=()=>{};function bxt(){let e=!1,t,r=xxt;return[new Promise(n=>{e?n(t):r=n}),n=>{e=!0,t=n,r(t)}]}QI.createPromiseWithResolver=bxt});var oX=Br(VS=>{\"use strict\";Object.defineProperty(VS,\"__esModule\",{value:!0});VS.WorkerEventType=void 0;var hce=US(),wxt;(function(e){e.internalError=\"internalError\",e.message=\"message\",e.termination=\"termination\"})(wxt=VS.WorkerEventType||(VS.WorkerEventType={}))});var lX=Br($I=>{\"use strict\";Object.defineProperty($I,\"__esModule\",{value:!0});$I.ObservablePromise=void 0;var Sxt=zS(),Txt=()=>{},Mxt=e=>e,aX=e=>Promise.resolve().then(e);function Ext(e){throw e}function Pxt(e){return e&&typeof e.then==\"function\"}var wF=class e extends Sxt.Observable{constructor(t){super(r=>{let i=this,s=Object.assign(Object.assign({},r),{complete(){r.complete(),i.onCompletion()},error(n){r.error(n),i.onError(n)},next(n){r.next(n),i.onNext(n)}});try{return this.initHasRun=!0,t(s)}catch(n){s.error(n)}}),this.initHasRun=!1,this.fulfillmentCallbacks=[],this.rejectionCallbacks=[],this.firstValueSet=!1,this.state=\"pending\"}onNext(t){this.firstValueSet||(this.firstValue=t,this.firstValueSet=!0)}onError(t){this.state=\"rejected\",this.rejection=t;for(let r of this.rejectionCallbacks)aX(()=>r(t))}onCompletion(){this.state=\"fulfilled\";for(let t of this.fulfillmentCallbacks)aX(()=>t(this.firstValue))}then(t,r){let i=t||Mxt,s=r||Ext,n=!1;return new Promise((o,c)=>{let f=w=>{if(!n){n=!0;try{o(s(w))}catch(I){c(I)}}},_=w=>{try{o(i(w))}catch(I){f(I)}};if(this.initHasRun||this.subscribe({error:f}),this.state===\"fulfilled\")return o(i(this.firstValue));if(this.state===\"rejected\")return n=!0,o(s(this.rejection));this.fulfillmentCallbacks.push(_),this.rejectionCallbacks.push(f)})}catch(t){return this.then(void 0,t)}finally(t){let r=t||Txt;return this.then(i=>(r(),i),()=>r())}static from(t){return Pxt(t)?new e(r=>{let i=n=>{r.next(n),r.complete()},s=n=>{r.error(n)};t.then(i,s)}):super.from(t)}};$I.ObservablePromise=wF});var jS=Br(Dx=>{\"use strict\";Object.defineProperty(Dx,\"__esModule\",{value:!0});Dx.Transfer=Dx.isTransferDescriptor=void 0;var cX=US();function Ixt(e){return!(!e||typeof e!=\"object\")}function Cxt(e){return e&&typeof e==\"object\"&&e[cX.$transferable]}Dx.isTransferDescriptor=Cxt;function Lxt(e,t){if(!t){if(!Ixt(e))throw Error();t=[e]}return{[cX.$transferable]:!0,send:e,transferables:t}}Dx.Transfer=Lxt});var SF=Br(Om=>{\"use strict\";Object.defineProperty(Om,\"__esModule\",{value:!0});Om.WorkerMessageType=Om.MasterMessageType=void 0;var kxt;(function(e){e.cancel=\"cancel\",e.run=\"run\"})(kxt=Om.MasterMessageType||(Om.MasterMessageType={}));var Rxt;(function(e){e.error=\"error\",e.init=\"init\",e.result=\"result\",e.running=\"running\",e.uncaughtError=\"uncaughtError\"})(Rxt=Om.WorkerMessageType||(Om.WorkerMessageType={}))});var pX=Br(Bm=>{\"use strict\";var Dxt=Bm&&Bm.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Bm,\"__esModule\",{value:!0});Bm.createProxyModule=Bm.createProxyFunction=void 0;var Oxt=Dxt(VI()),hX=zS(),GS=Mx(),uX=lX(),Bxt=jS(),WS=SF(),fX=Oxt.default(\"threads:master:messages\"),Fxt=1,zxt=e=>Array.from(new Set(e)),Nxt=e=>e&&e.type===WS.WorkerMessageType.error,Uxt=e=>e&&e.type===WS.WorkerMessageType.result,Vxt=e=>e&&e.type===WS.WorkerMessageType.running;function jxt(e,t){return new hX.Observable(r=>{let i,s=n=>{if(fX(\"Message from worker:\",n.data),!(!n.data||n.data.uid!==t)){if(Vxt(n.data))i=n.data.resultType;else if(Uxt(n.data))i===\"promise\"?(typeof n.data.payload<\"u\"&&r.next(GS.deserialize(n.data.payload)),r.complete(),e.removeEventListener(\"message\",s)):(n.data.payload&&r.next(GS.deserialize(n.data.payload)),n.data.complete&&(r.complete(),e.removeEventListener(\"message\",s)));else if(Nxt(n.data)){let o=GS.deserialize(n.data.error);r.error(o),e.removeEventListener(\"message\",s)}}};return e.addEventListener(\"message\",s),()=>{if(i===\"observable\"||!i){let n={type:WS.MasterMessageType.cancel,uid:t};e.postMessage(n)}e.removeEventListener(\"message\",s)}})}function Gxt(e){if(e.length===0)return{args:[],transferables:[]};let t=[],r=[];for(let i of e)Bxt.isTransferDescriptor(i)?(t.push(GS.serialize(i.send)),r.push(...i.transferables)):t.push(GS.serialize(i));return{args:t,transferables:r.length===0?r:zxt(r)}}function dX(e,t){return(...r)=>{let i=Fxt++,{args:s,transferables:n}=Gxt(r),o={type:WS.MasterMessageType.run,uid:i,method:t,args:s};fX(\"Sending command to run function to worker:\",o);try{e.postMessage(o,n)}catch(c){return uX.ObservablePromise.from(Promise.reject(c))}return uX.ObservablePromise.from(hX.multicast(jxt(e,i)))}}Bm.createProxyFunction=dX;function Wxt(e,t){let r={};for(let i of t)r[i]=dX(e,i);return r}Bm.createProxyModule=Wxt});var _X=Br(Fm=>{\"use strict\";var TF=Fm&&Fm.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})},Hxt=Fm&&Fm.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Fm,\"__esModule\",{value:!0});Fm.spawn=void 0;var MF=Hxt(VI()),qxt=zS(),Zxt=Mx(),Yxt=sX(),XI=US(),KI=oX(),AX=pX(),Qxt=MF.default(\"threads:master:messages\"),$xt=MF.default(\"threads:master:spawn\"),gX=MF.default(\"threads:master:thread-utils\"),Xxt=e=>e&&e.type===\"init\",Kxt=e=>e&&e.type===\"uncaughtError\",Jxt=typeof process<\"u\"&&process.env.THREADS_WORKER_INIT_TIMEOUT?Number.parseInt(process.env.THREADS_WORKER_INIT_TIMEOUT,10):1e4;function t1t(e,t,r){return TF(this,void 0,void 0,function*(){let i,s=new Promise((o,c)=>{i=setTimeout(()=>c(Error(r)),t)}),n=yield Promise.race([e,s]);return clearTimeout(i),n})}function e1t(e){return new Promise((t,r)=>{let i=s=>{Qxt(\"Message from worker before finishing initialization:\",s.data),Xxt(s.data)?(e.removeEventListener(\"message\",i),t(s.data)):Kxt(s.data)&&(e.removeEventListener(\"message\",i),r(Zxt.deserialize(s.data.error)))};e.addEventListener(\"message\",i)})}function r1t(e,t){return new qxt.Observable(r=>{let i=n=>{let o={type:KI.WorkerEventType.message,data:n.data};r.next(o)},s=n=>{gX(\"Unhandled promise rejection event in thread:\",n);let o={type:KI.WorkerEventType.internalError,error:Error(n.reason)};r.next(o)};e.addEventListener(\"message\",i),e.addEventListener(\"unhandledrejection\",s),t.then(()=>{let n={type:KI.WorkerEventType.termination};e.removeEventListener(\"message\",i),e.removeEventListener(\"unhandledrejection\",s),r.next(n),r.complete()})})}function i1t(e){let[t,r]=Yxt.createPromiseWithResolver();return{terminate:()=>TF(this,void 0,void 0,function*(){gX(\"Terminating worker\"),yield e.terminate(),r()}),termination:t}}function mX(e,t,r,i){let s=r.filter(n=>n.type===KI.WorkerEventType.internalError).map(n=>n.error);return Object.assign(e,{[XI.$errors]:s,[XI.$events]:r,[XI.$terminate]:i,[XI.$worker]:t})}function n1t(e,t){return TF(this,void 0,void 0,function*(){$xt(\"Initializing new thread\");let r=t&&t.timeout?t.timeout:Jxt,s=(yield t1t(e1t(e),r,`Timeout: Did not receive an init message from worker after ${r}ms. Make sure the worker calls expose().`)).exposed,{termination:n,terminate:o}=i1t(e),c=r1t(e,n);if(s.type===\"function\"){let f=AX.createProxyFunction(e);return mX(f,e,c,o)}else if(s.type===\"module\"){let f=AX.createProxyModule(e,s.methods);return mX(f,e,c,o)}else{let f=s.type;throw Error(`Worker init message states unexpected type of expose(): ${f}`)}})}Fm.spawn=n1t});var yX=Br(Cc=>{\"use strict\";Object.defineProperty(Cc,\"__esModule\",{value:!0});Cc.Worker=Cc.BlobWorker=Cc.isWorkerRuntime=Cc.Thread=Cc.spawn=Cc.Pool=void 0;var EF=aF();Object.defineProperty(Cc,\"isWorkerRuntime\",{enumerable:!0,get:function(){return EF.isWorkerRuntime}});var s1t=nX();Object.defineProperty(Cc,\"Pool\",{enumerable:!0,get:function(){return s1t.Pool}});var o1t=_X();Object.defineProperty(Cc,\"spawn\",{enumerable:!0,get:function(){return o1t.spawn}});var a1t=xF();Object.defineProperty(Cc,\"Thread\",{enumerable:!0,get:function(){return a1t.Thread}});Cc.BlobWorker=EF.getWorkerImplementation().blob;Cc.Worker=EF.getWorkerImplementation().default});var xX=Br((yce,vX)=>{\"use strict\";vX.exports=e=>e?typeof Symbol.observable==\"symbol\"&&typeof e[Symbol.observable]==\"function\"?e===e[Symbol.observable]():typeof e[\"@@observable\"]==\"function\"?e===e[\"@@observable\"]():!1:!1});var bX=Br(PF=>{\"use strict\";Object.defineProperty(PF,\"__esModule\",{value:!0});var l1t=function(){let t=typeof self<\"u\"&&typeof Window<\"u\"&&self instanceof Window;return!!(typeof self<\"u\"&&self.postMessage&&!t)},c1t=function(t,r){self.postMessage(t,r)},u1t=function(t){let r=s=>{t(s.data)},i=()=>{self.removeEventListener(\"message\",r)};return self.addEventListener(\"message\",r),i};PF.default={isWorkerRuntime:l1t,postMessageToMaster:c1t,subscribeToMasterMessages:u1t}});var IX=Br(Lc=>{\"use strict\";var h1t=Lc&&Lc.__awaiter||function(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function c(w){try{_(i.next(w))}catch(I){o(I)}}function f(w){try{_(i.throw(w))}catch(I){o(I)}}function _(w){w.done?n(w.value):s(w.value).then(c,f)}_((i=i.apply(e,t||[])).next())})},EX=Lc&&Lc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Lc,\"__esModule\",{value:!0});Lc.expose=Lc.isWorkerRuntime=Lc.Transfer=Lc.registerSerializer=void 0;var f1t=EX(xX()),zm=Mx(),d1t=jS(),Nm=SF(),fu=EX(bX()),p1t=Mx();Object.defineProperty(Lc,\"registerSerializer\",{enumerable:!0,get:function(){return p1t.registerSerializer}});var A1t=jS();Object.defineProperty(Lc,\"Transfer\",{enumerable:!0,get:function(){return A1t.Transfer}});Lc.isWorkerRuntime=fu.default.isWorkerRuntime;var wX=!1,HS=new Map,m1t=e=>e&&e.type===Nm.MasterMessageType.cancel,SX=e=>e&&e.type===Nm.MasterMessageType.run,TX=e=>f1t.default(e)||g1t(e);function g1t(e){return e&&typeof e==\"object\"&&typeof e.subscribe==\"function\"}function PX(e){return d1t.isTransferDescriptor(e)?{payload:e.send,transferables:e.transferables}:{payload:e,transferables:void 0}}function _1t(){let e={type:Nm.WorkerMessageType.init,exposed:{type:\"function\"}};fu.default.postMessageToMaster(e)}function y1t(e){let t={type:Nm.WorkerMessageType.init,exposed:{type:\"module\",methods:e}};fu.default.postMessageToMaster(t)}function IF(e,t){let{payload:r,transferables:i}=PX(t),s={type:Nm.WorkerMessageType.error,uid:e,error:zm.serialize(r)};fu.default.postMessageToMaster(s,i)}function CF(e,t,r){let{payload:i,transferables:s}=PX(r),n={type:Nm.WorkerMessageType.result,uid:e,complete:t?!0:void 0,payload:i};fu.default.postMessageToMaster(n,s)}function v1t(e,t){let r={type:Nm.WorkerMessageType.running,uid:e,resultType:t};fu.default.postMessageToMaster(r)}function JI(e){try{let t={type:Nm.WorkerMessageType.uncaughtError,error:zm.serialize(e)};fu.default.postMessageToMaster(t)}catch(t){console.error(`Not reporting uncaught error back to master thread as it occured while reporting an uncaught error already.\nLatest error:`,t,`\nOriginal error:`,e)}}function MX(e,t,r){return h1t(this,void 0,void 0,function*(){let i;try{i=t(...r)}catch(n){return IF(e,n)}let s=TX(i)?\"observable\":\"promise\";if(v1t(e,s),TX(i)){let n=i.subscribe(o=>CF(e,!1,zm.serialize(o)),o=>{IF(e,zm.serialize(o)),HS.delete(e)},()=>{CF(e,!0),HS.delete(e)});HS.set(e,n)}else try{let n=yield i;CF(e,!0,zm.serialize(n))}catch(n){IF(e,zm.serialize(n))}})}function x1t(e){if(!fu.default.isWorkerRuntime())throw Error(\"expose() called in the master thread.\");if(wX)throw Error(\"expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.\");if(wX=!0,typeof e==\"function\")fu.default.subscribeToMasterMessages(t=>{SX(t)&&!t.method&&MX(t.uid,e,t.args.map(zm.deserialize))}),_1t();else if(typeof e==\"object\"&&e){fu.default.subscribeToMasterMessages(r=>{SX(r)&&r.method&&MX(r.uid,e[r.method],r.args.map(zm.deserialize))});let t=Object.keys(e).filter(r=>typeof e[r]==\"function\");y1t(t)}else throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${e}`);fu.default.subscribeToMasterMessages(t=>{if(m1t(t)){let r=t.uid,i=HS.get(r);i&&(i.unsubscribe(),HS.delete(r))}})}Lc.expose=x1t;typeof self<\"u\"&&typeof self.addEventListener==\"function\"&&fu.default.isWorkerRuntime()&&(self.addEventListener(\"error\",e=>{setTimeout(()=>JI(e.error||e),250)}),self.addEventListener(\"unhandledrejection\",e=>{let t=e.reason;t&&typeof t.message==\"string\"&&setTimeout(()=>JI(t),250)}));typeof process<\"u\"&&typeof process.on==\"function\"&&fu.default.isWorkerRuntime()&&(process.on(\"uncaughtException\",e=>{setTimeout(()=>JI(e),250)}),process.on(\"unhandledRejection\",e=>{e&&typeof e.message==\"string\"&&setTimeout(()=>JI(e),250)}))});var CX=Br(Fl=>{\"use strict\";var b1t=Fl&&Fl.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),w1t=Fl&&Fl.__exportStar||function(e,t){for(var r in e)r!==\"default\"&&!Object.prototype.hasOwnProperty.call(t,r)&&b1t(t,e,r)};Object.defineProperty(Fl,\"__esModule\",{value:!0});Fl.Transfer=Fl.DefaultSerializer=Fl.expose=Fl.registerSerializer=void 0;var S1t=Mx();Object.defineProperty(Fl,\"registerSerializer\",{enumerable:!0,get:function(){return S1t.registerSerializer}});w1t(yX(),Fl);var T1t=IX();Object.defineProperty(Fl,\"expose\",{enumerable:!0,get:function(){return T1t.expose}});var M1t=nF();Object.defineProperty(Fl,\"DefaultSerializer\",{enumerable:!0,get:function(){return M1t.DefaultSerializer}});var E1t=jS();Object.defineProperty(Fl,\"Transfer\",{enumerable:!0,get:function(){return E1t.Transfer}})});var hC=Ri(Yi(),1),a_=Ri(Yi(),1);var ec=Ri(Yi(),1),U8=Ri(N8(),1),V8=ec.createContext(null);function Ket(){let e=ec.useContext(V8);if(!e)throw new Error(\"RenderContext not found\");return e}function Y1(){return Ket().model}function zA(e){let t=Y1(),[r,i]=ec.useState(t.get(e));return ec.useEffect(()=>{let s=()=>i(t.get(e));return t.on(`change:${e}`,s),()=>t.off(`change:${e}`,s)},[t,e]),[r,s=>{t.set(e,s),t.save_changes()}]}function j8(e){return({el:t,model:r,experimental:i})=>{let s=U8.createRoot(t);return s.render(ec.createElement(ec.StrictMode,null,ec.createElement(V8.Provider,{value:{model:r,experimental:i}},ec.createElement(e)))),()=>s.unmount()}}var rU=Ri(Yi());var cy=Ri(Yi()),Yc=Ri(Yi());var m4=Ri(Yi()),zM=Ri(Yi());var G8=m4.createContext(null);function W8(e,t){let r=Array.isArray(e)?e[0]:e?e.x:0,i=Array.isArray(e)?e[1]:e?e.y:0,s=Array.isArray(t)?t[0]:t?t.x:0,n=Array.isArray(t)?t[1]:t?t.y:0;return r===s&&i===n}function rc(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r{let s=null;\"interactive\"in i&&(s=Object.assign({},i),delete s.interactive);let n=t[i.ref];if(n){s=s||Object.assign({},i),delete s.ref;for(let o of Jet)o in n&&(s[o]=n[o])}return s||i});return{...e,layers:r}}var q8={version:8,sources:{},layers:[]},Z8={mousedown:\"onMouseDown\",mouseup:\"onMouseUp\",mouseover:\"onMouseOver\",mousemove:\"onMouseMove\",click:\"onClick\",dblclick:\"onDblClick\",mouseenter:\"onMouseEnter\",mouseleave:\"onMouseLeave\",mouseout:\"onMouseOut\",contextmenu:\"onContextMenu\",touchstart:\"onTouchStart\",touchend:\"onTouchEnd\",touchmove:\"onTouchMove\",touchcancel:\"onTouchCancel\"},x4={movestart:\"onMoveStart\",move:\"onMove\",moveend:\"onMoveEnd\",dragstart:\"onDragStart\",drag:\"onDrag\",dragend:\"onDragEnd\",zoomstart:\"onZoomStart\",zoom:\"onZoom\",zoomend:\"onZoomEnd\",rotatestart:\"onRotateStart\",rotate:\"onRotate\",rotateend:\"onRotateEnd\",pitchstart:\"onPitchStart\",pitch:\"onPitch\",pitchend:\"onPitchEnd\"},Y8={wheel:\"onWheel\",boxzoomstart:\"onBoxZoomStart\",boxzoomend:\"onBoxZoomEnd\",boxzoomcancel:\"onBoxZoomCancel\",resize:\"onResize\",load:\"onLoad\",render:\"onRender\",idle:\"onIdle\",remove:\"onRemove\",data:\"onData\",styledata:\"onStyleData\",sourcedata:\"onSourceData\",error:\"onError\"},trt=[\"minZoom\",\"maxZoom\",\"minPitch\",\"maxPitch\",\"maxBounds\",\"projection\",\"renderWorldCopies\"],ert=[\"scrollZoom\",\"boxZoom\",\"dragRotate\",\"dragPan\",\"keyboard\",\"doubleClickZoom\",\"touchZoomRotate\",\"touchPitch\"],R0=class e{constructor(t,r,i){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=s=>{let n=this.props[Y8[s.type]];n?n(s):s.type===\"error\"&&console.error(s.error)},this._onPointerEvent=s=>{(s.type===\"mousemove\"||s.type===\"mouseout\")&&this._updateHover(s);let n=this.props[Z8[s.type]];n&&(this.props.interactiveLayerIds&&s.type!==\"mouseover\"&&s.type!==\"mouseout\"&&(s.features=this._hoveredFeatures||this._queryRenderedFeatures(s.point)),n(s),delete s.features)},this._onCameraEvent=s=>{if(!this._internalUpdate){let n=this.props[x4[s.type]];n&&n(s)}s.type in this._deferredEvents&&(this._deferredEvents[s.type]=!1)},this._MapClass=t,this.props=r,this._initialize(i)}get map(){return this._map}get transform(){return this._renderTransform}setProps(t){let r=this.props;this.props=t;let i=this._updateSettings(t,r);i&&this._createShadowTransform(this._map);let s=this._updateSize(t),n=this._updateViewState(t,!0);this._updateStyle(t,r),this._updateStyleComponents(t,r),this._updateHandlers(t,r),(i||s||n&&!this._map.isMoving())&&this.redraw()}static reuse(t,r){let i=e.savedMaps.pop();if(!i)return null;let s=i.map,n=s.getContainer();for(r.className=n.className;n.childNodes.length>0;)r.appendChild(n.childNodes[0]);s._container=r;let o=s._resizeObserver;o&&(o.disconnect(),o.observe(r)),i.setProps({...t,styleDiffing:!1}),s.resize();let{initialViewState:c}=t;return c&&(c.bounds?s.fitBounds(c.bounds,{...c.fitBoundsOptions,duration:0}):i._updateViewState(c,!1)),s.isStyleLoaded()?s.fire(\"load\"):s.once(\"styledata\",()=>s.fire(\"load\")),s._update(),i}_initialize(t){let{props:r}=this,{mapStyle:i=q8}=r,s={...r,...r.initialViewState,accessToken:r.mapboxAccessToken||rrt()||null,container:t,style:v4(i)},n=s.initialViewState||s.viewState||s;if(Object.assign(s,{center:[n.longitude||0,n.latitude||0],zoom:n.zoom||0,pitch:n.pitch||0,bearing:n.bearing||0}),r.gl){let w=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=w,r.gl)}let o=new this._MapClass(s);n.padding&&o.setPadding(n.padding),r.cursor&&(o.getCanvas().style.cursor=r.cursor),this._createShadowTransform(o);let c=o._render;o._render=w=>{this._inRender=!0,c.call(o,w),this._inRender=!1};let f=o._renderTaskQueue.run;o._renderTaskQueue.run=w=>{f.call(o._renderTaskQueue,w),this._onBeforeRepaint()},o.on(\"render\",()=>this._onAfterRepaint());let _=o.fire;o.fire=this._fireEvent.bind(this,_),o.on(\"resize\",()=>{this._renderTransform.resize(o.transform.width,o.transform.height)}),o.on(\"styledata\",()=>{this._updateStyleComponents(this.props,{}),g4(o.transform,this._renderTransform)}),o.on(\"sourcedata\",()=>this._updateStyleComponents(this.props,{}));for(let w in Z8)o.on(w,this._onPointerEvent);for(let w in x4)o.on(w,this._onCameraEvent);for(let w in Y8)o.on(w,this._onEvent);this._map=o}recycle(){let r=this.map.getContainer().querySelector(\"[mapboxgl-children]\");r?.remove(),e.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){let t=this._map;!this._inRender&&t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_createShadowTransform(t){let r=H8(t.transform);t.painter.transform=r,this._renderTransform=r}_updateSize(t){let{viewState:r}=t;if(r){let i=this._map;if(r.width!==i.transform.width||r.height!==i.transform.height)return i.resize(),!0}return!1}_updateViewState(t,r){if(this._internalUpdate)return!1;let i=this._map,s=this._renderTransform,{zoom:n,pitch:o,bearing:c}=s,f=i.isMoving();f&&(s.cameraElevationReference=\"sea\");let _=y4(s,{..._4(i.transform),...t});if(f&&(s.cameraElevationReference=\"ground\"),_&&r){let w=this._deferredEvents;w.move=!0,w.zoom||(w.zoom=n!==s.zoom),w.rotate||(w.rotate=c!==s.bearing),w.pitch||(w.pitch=o!==s.pitch)}return f||y4(i.transform,t),_}_updateSettings(t,r){let i=this._map,s=!1;for(let n of trt)if(n in t&&!rc(t[n],r[n])){s=!0;let o=i[`set${n[0].toUpperCase()}${n.slice(1)}`];o?.call(i,t[n])}return s}_updateStyle(t,r){if(t.cursor!==r.cursor&&(this._map.getCanvas().style.cursor=t.cursor||\"\"),t.mapStyle!==r.mapStyle){let{mapStyle:i=q8,styleDiffing:s=!0}=t,n={diff:s};return\"localIdeographFontFamily\"in t&&(n.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(v4(i),n),!0}return!1}_updateStyleComponents(t,r){let i=this._map,s=!1;return i.isStyleLoaded()&&(\"light\"in t&&i.setLight&&!rc(t.light,r.light)&&(s=!0,i.setLight(t.light)),\"fog\"in t&&i.setFog&&!rc(t.fog,r.fog)&&(s=!0,i.setFog(t.fog)),\"terrain\"in t&&i.setTerrain&&!rc(t.terrain,r.terrain)&&(!t.terrain||i.getSource(t.terrain.source))&&(s=!0,i.setTerrain(t.terrain))),s}_updateHandlers(t,r){var i,s;let n=this._map,o=!1;for(let c of ert){let f=(i=t[c])!==null&&i!==void 0?i:!0,_=(s=r[c])!==null&&s!==void 0?s:!0;rc(f,_)||(o=!0,f?n[c].enable(f):n[c].disable())}return o}_queryRenderedFeatures(t){let r=this._map,i=r.transform,{interactiveLayerIds:s=[]}=this.props;try{return r.transform=this._renderTransform,r.queryRenderedFeatures(t,{layers:s.filter(r.getLayer.bind(r))})}catch{return[]}finally{r.transform=i}}_updateHover(t){var r;let{props:i}=this;if(i.interactiveLayerIds&&(i.onMouseMove||i.onMouseEnter||i.onMouseLeave)){let n=t.type,o=((r=this._hoveredFeatures)===null||r===void 0?void 0:r.length)>0,c=this._queryRenderedFeatures(t.point),f=c.length>0;!f&&o&&(t.type=\"mouseleave\",this._onPointerEvent(t)),this._hoveredFeatures=c,f&&!o&&(t.type=\"mouseenter\",this._onPointerEvent(t)),t.type=n}else this._hoveredFeatures=null}_fireEvent(t,r,i){let s=this._map,n=s.transform,o=typeof r==\"string\"?r:r.type;return o===\"move\"&&this._updateViewState(this.props,!1),o in x4&&(typeof r==\"object\"&&(r.viewState=_4(n)),this._map.isMoving())?(s.transform=this._renderTransform,t.call(s,r,i),s.transform=n,s):(t.call(s,r,i),s)}_onBeforeRepaint(){let t=this._map;this._internalUpdate=!0;for(let i in this._deferredEvents)this._deferredEvents[i]&&t.fire(i);this._internalUpdate=!1;let r=this._map.transform;t.transform=this._renderTransform,this._onAfterRepaint=()=>{g4(this._renderTransform,r),t.transform=r}}};R0.savedMaps=[];function rrt(){let e=null;if(typeof location<\"u\"){let t=/access_token=([^&\\/]*)/.exec(location.search);e=t&&t[1]}try{e=e||process.env.MapboxAccessToken}catch{}try{e=e||process.env.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return e}var irt=[\"setMaxBounds\",\"setMinZoom\",\"setMaxZoom\",\"setMinPitch\",\"setMaxPitch\",\"setRenderWorldCopies\",\"setProjection\",\"setStyle\",\"addSource\",\"removeSource\",\"addLayer\",\"removeLayer\",\"setLayerZoomRange\",\"setFilter\",\"setPaintProperty\",\"setLayoutProperty\",\"setLight\",\"setTerrain\",\"setFog\",\"remove\"];function b4(e){if(!e)return null;let t=e.map,r={getMap:()=>t,getCenter:()=>e.transform.center,getZoom:()=>e.transform.zoom,getBearing:()=>e.transform.bearing,getPitch:()=>e.transform.pitch,getPadding:()=>e.transform.padding,getBounds:()=>e.transform.getBounds(),project:i=>{let s=t.transform;t.transform=e.transform;let n=t.project(i);return t.transform=s,n},unproject:i=>{let s=t.transform;t.transform=e.transform;let n=t.unproject(i);return t.transform=s,n},queryTerrainElevation:(i,s)=>{let n=t.transform;t.transform=e.transform;let o=t.queryTerrainElevation(i,s);return t.transform=n,o},queryRenderedFeatures:(i,s)=>{let n=t.transform;t.transform=e.transform;let o=t.queryRenderedFeatures(i,s);return t.transform=n,o}};for(let i of nrt(t))!(i in r)&&!irt.includes(i)&&(r[i]=t[i].bind(t));return r}function nrt(e){let t=new Set,r=e;for(;r;){for(let i of Object.getOwnPropertyNames(r))i[0]!==\"_\"&&typeof e[i]==\"function\"&&i!==\"fire\"&&i!==\"setEventedParent\"&&t.add(i);r=Object.getPrototypeOf(r)}return Array.from(t)}var NM=Ri(Yi()),srt=typeof document<\"u\"?NM.useLayoutEffect:NM.useEffect,Q8=srt;var ort=[\"baseApiUrl\",\"maxParallelImageRequests\",\"workerClass\",\"workerCount\",\"workerUrl\"];function w4(e,t){for(let i of ort)i in t&&(e[i]=t[i]);let{RTLTextPlugin:r=\"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js\"}=t;r&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()===\"unavailable\"&&e.setRTLTextPlugin(r,i=>{i&&console.error(i)},!0)}var Of=cy.createContext(null);function S4(e,t,r){let i=(0,Yc.useContext)(G8),[s,n]=(0,Yc.useState)(null),o=(0,Yc.useRef)(),{current:c}=(0,Yc.useRef)({mapLib:null,map:null});(0,Yc.useEffect)(()=>{let w=e.mapLib,I=!0,R;return Promise.resolve(w||r).then(N=>{if(!I)return;if(!N)throw new Error(\"Invalid mapLib\");let j=\"Map\"in N?N:N.default;if(!j.Map)throw new Error(\"Invalid mapLib\");if(w4(j,e),!j.supported||j.supported(e))e.reuseMaps&&(R=R0.reuse(e,o.current)),R||(R=new R0(j.Map,e,o.current)),c.map=b4(R),c.mapLib=j,n(R),i?.onMapMount(c.map,e.id);else throw new Error(\"Map is not supported by this browser\")}).catch(N=>{let{onError:j}=e;j?j({type:\"error\",target:null,originalEvent:null,error:N}):console.error(N)}),()=>{I=!1,R&&(i?.onMapUnmount(e.id),e.reuseMaps?R.recycle():R.destroy())}},[]),Q8(()=>{s&&s.setProps(e)}),(0,Yc.useImperativeHandle)(t,()=>c.map,[s]);let f=(0,Yc.useMemo)(()=>({position:\"relative\",width:\"100%\",height:\"100%\",...e.style}),[e.style]),_={height:\"100%\"};return cy.createElement(\"div\",{id:e.id,ref:o,style:f},s&&cy.createElement(Of.Provider,{value:c},cy.createElement(\"div\",{\"mapboxgl-children\":\"\",style:_},e.children)))}var $8=Ri(Yi()),X8=Ri(FM()),Tl=Ri(Yi());var art=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function ic(e,t){if(!e||!t)return;let r=e.style;for(let i in t){let s=t[i];Number.isFinite(s)&&!art.test(i)?r[i]=`${s}px`:r[i]=s}}function lrt(e,t){let{map:r,mapLib:i}=(0,Tl.useContext)(Of),s=(0,Tl.useRef)({props:e});s.current.props=e;let n=(0,Tl.useMemo)(()=>{let Q=!1;$8.Children.forEach(e.children,K=>{K&&(Q=!0)});let et={...e,element:Q?document.createElement(\"div\"):null},Y=new i.Marker(et);return Y.setLngLat([e.longitude,e.latitude]),Y.getElement().addEventListener(\"click\",K=>{var J,ut;(ut=(J=s.current.props).onClick)===null||ut===void 0||ut.call(J,{type:\"click\",target:Y,originalEvent:K})}),Y.on(\"dragstart\",K=>{var J,ut;let Et=K;Et.lngLat=n.getLngLat(),(ut=(J=s.current.props).onDragStart)===null||ut===void 0||ut.call(J,Et)}),Y.on(\"drag\",K=>{var J,ut;let Et=K;Et.lngLat=n.getLngLat(),(ut=(J=s.current.props).onDrag)===null||ut===void 0||ut.call(J,Et)}),Y.on(\"dragend\",K=>{var J,ut;let Et=K;Et.lngLat=n.getLngLat(),(ut=(J=s.current.props).onDragEnd)===null||ut===void 0||ut.call(J,Et)}),Y},[]);(0,Tl.useEffect)(()=>(n.addTo(r.getMap()),()=>{n.remove()}),[]);let{longitude:o,latitude:c,offset:f,style:_,draggable:w=!1,popup:I=null,rotation:R=0,rotationAlignment:N=\"auto\",pitchAlignment:j=\"auto\"}=e;return(0,Tl.useEffect)(()=>{ic(n.getElement(),_)},[_]),(0,Tl.useImperativeHandle)(t,()=>n,[]),(n.getLngLat().lng!==o||n.getLngLat().lat!==c)&&n.setLngLat([o,c]),f&&!W8(n.getOffset(),f)&&n.setOffset(f),n.isDraggable()!==w&&n.setDraggable(w),n.getRotation()!==R&&n.setRotation(R),n.getRotationAlignment()!==N&&n.setRotationAlignment(N),n.getPitchAlignment()!==j&&n.setPitchAlignment(j),n.getPopup()!==I&&n.setPopup(I),(0,X8.createPortal)(e.children,n.getElement())}var crt=(0,Tl.memo)((0,Tl.forwardRef)(lrt));var J8=Ri(FM()),Xa=Ri(Yi());function K8(e){return new Set(e?e.trim().split(/\\s+/):[])}function urt(e,t){let{map:r,mapLib:i}=(0,Xa.useContext)(Of),s=(0,Xa.useMemo)(()=>document.createElement(\"div\"),[]),n=(0,Xa.useRef)({props:e});n.current.props=e;let o=(0,Xa.useMemo)(()=>{let c={...e},f=new i.Popup(c);return f.setLngLat([e.longitude,e.latitude]),f.once(\"open\",_=>{var w,I;(I=(w=n.current.props).onOpen)===null||I===void 0||I.call(w,_)}),f},[]);if((0,Xa.useEffect)(()=>{let c=f=>{var _,w;(w=(_=n.current.props).onClose)===null||w===void 0||w.call(_,f)};return o.on(\"close\",c),o.setDOMContent(s).addTo(r.getMap()),()=>{o.off(\"close\",c),o.isOpen()&&o.remove()}},[]),(0,Xa.useEffect)(()=>{ic(o.getElement(),e.style)},[e.style]),(0,Xa.useImperativeHandle)(t,()=>o,[]),o.isOpen()&&((o.getLngLat().lng!==e.longitude||o.getLngLat().lat!==e.latitude)&&o.setLngLat([e.longitude,e.latitude]),e.offset&&!rc(o.options.offset,e.offset)&&o.setOffset(e.offset),(o.options.anchor!==e.anchor||o.options.maxWidth!==e.maxWidth)&&(o.options.anchor=e.anchor,o.setMaxWidth(e.maxWidth)),o.options.className!==e.className)){let c=K8(o.options.className),f=K8(e.className);for(let _ of c)f.has(_)||o.removeClassName(_);for(let _ of f)c.has(_)||o.addClassName(_);o.options.className=e.className}return(0,J8.createPortal)(e.children,s)}var hrt=(0,Xa.memo)((0,Xa.forwardRef)(urt));var UM=Ri(Yi());var uy=Ri(Yi());function frt(e,t,r,i){let s=(0,uy.useContext)(Of),n=(0,uy.useMemo)(()=>e(s),[]);return(0,uy.useEffect)(()=>{let o=i||r||t,c=typeof t==\"function\"&&typeof r==\"function\"?t:null,f=typeof r==\"function\"?r:typeof t==\"function\"?t:null,{map:_}=s;return _.hasControl(n)||(_.addControl(n,o?.position),c&&c(s)),()=>{f&&f(s),_.hasControl(n)&&_.removeControl(n)}},[]),n}var kh=frt;function drt(e){let t=kh(({mapLib:r})=>new r.AttributionControl(e),{position:e.position});return(0,UM.useEffect)(()=>{ic(t._container,e.style)},[e.style]),null}var prt=(0,UM.memo)(drt);var VM=Ri(Yi());function Art(e){let t=kh(({mapLib:r})=>new r.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return(0,VM.useEffect)(()=>{ic(t._controlContainer,e.style)},[e.style]),null}var mrt=(0,VM.memo)(Art);var Bf=Ri(Yi());function grt(e,t){let r=(0,Bf.useRef)({props:e}),i=kh(({mapLib:s})=>{let n=new s.GeolocateControl(e),o=n._setupUI;return n._setupUI=c=>{n._container.hasChildNodes()||o(c)},n.on(\"geolocate\",c=>{var f,_;(_=(f=r.current.props).onGeolocate)===null||_===void 0||_.call(f,c)}),n.on(\"error\",c=>{var f,_;(_=(f=r.current.props).onError)===null||_===void 0||_.call(f,c)}),n.on(\"outofmaxbounds\",c=>{var f,_;(_=(f=r.current.props).onOutOfMaxBounds)===null||_===void 0||_.call(f,c)}),n.on(\"trackuserlocationstart\",c=>{var f,_;(_=(f=r.current.props).onTrackUserLocationStart)===null||_===void 0||_.call(f,c)}),n.on(\"trackuserlocationend\",c=>{var f,_;(_=(f=r.current.props).onTrackUserLocationEnd)===null||_===void 0||_.call(f,c)}),n},{position:e.position});return r.current.props=e,(0,Bf.useImperativeHandle)(t,()=>i,[]),(0,Bf.useEffect)(()=>{ic(i._container,e.style)},[e.style]),null}var _rt=(0,Bf.memo)((0,Bf.forwardRef)(grt));var jM=Ri(Yi());function yrt(e){let t=kh(({mapLib:r})=>new r.NavigationControl(e),{position:e.position});return(0,jM.useEffect)(()=>{ic(t._container,e.style)},[e.style]),null}var vrt=(0,jM.memo)(yrt);var hy=Ri(Yi());function xrt(e){let t=kh(({mapLib:n})=>new n.ScaleControl(e),{position:e.position}),r=(0,hy.useRef)(e),i=r.current;r.current=e;let{style:s}=e;return e.maxWidth!==void 0&&e.maxWidth!==i.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==i.unit&&t.setUnit(e.unit),(0,hy.useEffect)(()=>{ic(t._container,s)},[s]),null}var brt=(0,hy.memo)(xrt);var Q1=Ri(Yi());var Srt=Ri(Yi()),$1=Ri(Yi()),Trt=Ri(Yi());var Mrt=Promise.resolve().then(()=>Ri(eU())),Ert=rU.forwardRef(function(t,r){return S4(t,r,Mrt)});var iU=Ert;var Do=Ri(Yi());function NA(e,t){if(!e)throw new Error(t||\"loader assertion failed.\")}var Ff={self:typeof self<\"u\"&&self,window:typeof window<\"u\"&&window,global:typeof global<\"u\"&&global,document:typeof document<\"u\"&&document},Prt=Ff.self||Ff.window||Ff.global||{},Irt=Ff.window||Ff.self||Ff.global||{},Crt=Ff.global||Ff.self||Ff.window||{},Lrt=Ff.document||{};var D0=!!(typeof process!=\"object\"||String(process)!==\"[object process]\"||process.browser);var nU=typeof process<\"u\"&&process.version&&/v([0-9]*)/.exec(process.version),krt=nU&&parseFloat(nU[1])||0;var sU=\"3.4.14\";function Ka(e,t){if(!e)throw new Error(t||\"loaders.gl assertion failed.\")}var zf={self:typeof self<\"u\"&&self,window:typeof window<\"u\"&&window,global:typeof global<\"u\"&&global,document:typeof document<\"u\"&&document},Xwt=zf.self||zf.window||zf.global||{},Kwt=zf.window||zf.self||zf.global||{},Jwt=zf.global||zf.self||zf.window||{},t2t=zf.document||{};var O0=typeof process!=\"object\"||String(process)!==\"[object process]\"||process.browser;var aU=typeof window<\"u\"&&typeof window.orientation<\"u\",oU=typeof process<\"u\"&&process.version&&/v([0-9]*)/.exec(process.version),e2t=oU&&parseFloat(oU[1])||0;function B0(e){\"@babel/helpers - typeof\";return B0=typeof Symbol==\"function\"&&typeof Symbol.iterator==\"symbol\"?function(t){return typeof t}:function(t){return t&&typeof Symbol==\"function\"&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},B0(e)}function lU(e,t){if(B0(e)!=\"object\"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||\"default\");if(B0(i)!=\"object\")return i;throw new TypeError(\"@@toPrimitive must return a primitive value.\")}return(t===\"string\"?String:Number)(e)}function cU(e){var t=lU(e,\"string\");return B0(t)==\"symbol\"?t:t+\"\"}function G(e,t,r){return(t=cU(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var X1=class{constructor(t,r){G(this,\"name\",void 0),G(this,\"workerThread\",void 0),G(this,\"isRunning\",!0),G(this,\"result\",void 0),G(this,\"_resolve\",()=>{}),G(this,\"_reject\",()=>{}),this.name=t,this.workerThread=r,this.result=new Promise((i,s)=>{this._resolve=i,this._reject=s})}postMessage(t,r){this.workerThread.postMessage({source:\"loaders.gl\",type:t,payload:r})}done(t){Ka(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Ka(this.isRunning),this.isRunning=!1,this._reject(t)}};var fy=class{terminate(){}};var E4=new Map;function uU(e){Ka(e.source&&!e.url||!e.source&&e.url);let t=E4.get(e.source||e.url);return t||(e.url&&(t=Rrt(e.url),E4.set(e.url,t)),e.source&&(t=hU(e.source),E4.set(e.source,t))),Ka(t),t}function Rrt(e){if(!e.startsWith(\"http\"))return e;let t=Drt(e);return hU(t)}function hU(e){let t=new Blob([e],{type:\"application/javascript\"});return URL.createObjectURL(t)}function Drt(e){return`try {\n importScripts('`.concat(e,`');\n} catch (error) {\n console.error(error);\n throw error;\n}`)}function P4(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2?arguments[2]:void 0,i=r||new Set;if(e){if(fU(e))i.add(e);else if(fU(e.buffer))i.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(t&&typeof e==\"object\")for(let s in e)P4(e[s],t,i)}}return r===void 0?Array.from(i):[]}function fU(e){return e?e instanceof ArrayBuffer||typeof MessagePort<\"u\"&&e instanceof MessagePort||typeof ImageBitmap<\"u\"&&e instanceof ImageBitmap||typeof OffscreenCanvas<\"u\"&&e instanceof OffscreenCanvas:!1}var I4=()=>{},UA=class{static isSupported(){return typeof Worker<\"u\"&&O0||typeof fy<\"u\"&&!O0}constructor(t){G(this,\"name\",void 0),G(this,\"source\",void 0),G(this,\"url\",void 0),G(this,\"terminated\",!1),G(this,\"worker\",void 0),G(this,\"onMessage\",void 0),G(this,\"onError\",void 0),G(this,\"_loadableURL\",\"\");let{name:r,source:i,url:s}=t;Ka(i||s),this.name=r,this.source=i,this.url=s,this.onMessage=I4,this.onError=n=>console.log(n),this.worker=O0?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=I4,this.onError=I4,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(t,r){r=r||P4(t),this.worker.postMessage(t,r)}_getErrorFromErrorEvent(t){let r=\"Failed to load \";return r+=\"worker \".concat(this.name,\" from \").concat(this.url,\". \"),t.message&&(r+=\"\".concat(t.message,\" in \")),t.lineno&&(r+=\":\".concat(t.lineno,\":\").concat(t.colno)),new Error(r)}_createBrowserWorker(){this._loadableURL=uU({source:this.source,url:this.url});let t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error(\"No data received\"))},t.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},t.onmessageerror=r=>console.error(r),t}_createNodeWorker(){let t;if(this.url){let i=this.url.includes(\":/\")||this.url.startsWith(\"/\")?this.url:\"./\".concat(this.url);t=new fy(i,{eval:!1})}else if(this.source)t=new fy(this.source,{eval:!0});else throw new Error(\"no worker\");return t.on(\"message\",r=>{this.onMessage(r)}),t.on(\"error\",r=>{this.onError(r)}),t.on(\"exit\",r=>{}),t}};var K1=class{static isSupported(){return UA.isSupported()}constructor(t){G(this,\"name\",\"unnamed\"),G(this,\"source\",void 0),G(this,\"url\",void 0),G(this,\"maxConcurrency\",1),G(this,\"maxMobileConcurrency\",1),G(this,\"onDebug\",()=>{}),G(this,\"reuseWorkers\",!0),G(this,\"props\",{}),G(this,\"jobQueue\",[]),G(this,\"idleQueue\",[]),G(this,\"count\",0),G(this,\"isDestroyed\",!1),this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(n,o,c)=>n.done(c),i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(n,o)=>n.error(o),s=new Promise(n=>(this.jobQueue.push({name:t,onMessage:r,onError:i,onStart:n}),this));return this._startQueuedJob(),await s}async _startQueuedJob(){if(!this.jobQueue.length)return;let t=this._getAvailableWorker();if(!t)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:\"Starting job\",name:r.name,workerThread:t,backlog:this.jobQueue.length});let i=new X1(r.name,t);t.onMessage=s=>r.onMessage(i,s.type,s.payload),t.onError=s=>r.onError(i,s),r.onStart(i);try{await i.result}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count{}},VA=class e{static isSupported(){return UA.isSupported()}static getWorkerFarm(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e._workerFarm=e._workerFarm||new e({}),e._workerFarm.setProps(t),e._workerFarm}constructor(t){G(this,\"props\",void 0),G(this,\"workerPools\",new Map),this.props={...Ort},this.setProps(t),this.workerPools=new Map}destroy(){for(let t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(t){let{name:r,source:i,url:s}=t,n=this.workerPools.get(r);return n||(n=new K1({name:r,source:i,url:s}),n.setProps(this._getWorkerPoolProps()),this.workerPools.set(r,n)),n}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}};G(VA,\"_workerFarm\",void 0);var Brt=\"latest\";function C4(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t[e.id]||{},i=\"\".concat(e.id,\"-worker.js\"),s=r.workerUrl;if(!s&&e.id===\"compression\"&&(s=t.workerUrl),t._workerType===\"test\"&&(s=\"modules/\".concat(e.module,\"/dist/\").concat(i)),!s){let n=e.version;n===\"latest\"&&(n=Brt);let o=n?\"@\".concat(n):\"\";s=\"https://unpkg.com/@loaders.gl/\".concat(e.module).concat(o,\"/dist/\").concat(i)}return Ka(s),s}function L4(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:sU;Ka(e,\"no worker provided\");let r=e.version;return!(!t||!r)}function k4(e,t){return!VA.isSupported()||!O0&&!(t!=null&&t._nodeWorkers)?!1:e.worker&&t?.worker}async function R4(e,t,r,i,s){let n=e.id,o=C4(e,r),f=VA.getWorkerFarm(r).getWorkerPool({name:n,url:o});r=JSON.parse(JSON.stringify(r)),i=JSON.parse(JSON.stringify(i||{}));let _=await f.startJob(\"process-on-worker\",Frt.bind(null,s));return _.postMessage(\"process\",{input:t,options:r,context:i}),await(await _.result).result}async function Frt(e,t,r,i){switch(r){case\"done\":t.done(i);break;case\"error\":t.error(new Error(i.error));break;case\"process\":let{id:s,input:n,options:o}=i;try{let c=await e(n,o);t.postMessage(\"done\",{id:s,result:c})}catch(c){let f=c instanceof Error?c.message:\"unknown error\";t.postMessage(\"error\",{id:s,error:f})}break;default:console.warn(\"parse-with-worker unknown message \".concat(r))}}function D4(e,t,r){if(r=r||e.byteLength,e.byteLengthc instanceof ArrayBuffer?new Uint8Array(c):c),s=i.reduce((c,f)=>c+f.byteLength,0),n=new Uint8Array(s),o=0;for(let c of i)n.set(c,o),o+=c.byteLength;return n.buffer}async function B4(e){let t=[];for await(let r of e)t.push(r);return O4(...t)}function J1(){let e;if(typeof window<\"u\"&&window.performance)e=window.performance.now();else if(typeof process<\"u\"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var F0=class{constructor(t,r){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=J1(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(J1()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var dy=class{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:\"count\";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:i}=t,s=this.stats[r];return s||(t instanceof F0?s=t:s=new F0(r,i),this.stats[r]=s),s}};var zrt=\"Queued Requests\",Nrt=\"Active Requests\",Urt=\"Cancelled Requests\",Vrt=\"Queued Requests Ever\",jrt=\"Active Requests Ever\",Grt={id:\"request-scheduler\",throttleRequests:!0,maxRequests:6},py=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};G(this,\"props\",void 0),G(this,\"stats\",void 0),G(this,\"activeRequestCount\",0),G(this,\"requestQueue\",[]),G(this,\"requestMap\",new Map),G(this,\"deferredUpdate\",null),this.props={...Grt,...t},this.stats=new dy({id:this.props.id}),this.stats.get(zrt),this.stats.get(Nrt),this.stats.get(Urt),this.stats.get(Vrt),this.stats.get(jrt)}scheduleRequest(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:()=>0;if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let i={handle:t,priority:0,getPriority:r},s=new Promise(n=>(i.resolve=n,i));return this.requestQueue.push(i),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:r,resolve:i}=t,s=!1,n=()=>{s||(s=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,i?i({done:n}):Promise.resolve({done:n})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;rr.priority-i.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var Wrt=\"\",dU={};function F4(e){for(let t in dU)if(e.startsWith(t)){let r=dU[t];e=e.replace(t,r)}return!e.startsWith(\"http://\")&&!e.startsWith(\"https://\")&&(e=\"\".concat(Wrt).concat(e)),e}function pU(e){return e&&typeof e==\"object\"&&e.isBuffer}function GM(e){if(pU(e))return e;if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if(typeof e==\"string\"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e==\"object\"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(\"toArrayBuffer\")}var z0={};mA(z0,{dirname:()=>qrt,filename:()=>Hrt,join:()=>Zrt,resolve:()=>Yrt});function AU(){var e;if(typeof process<\"u\"&&typeof process.cwd<\"u\")return process.cwd();let t=(e=window.location)===null||e===void 0?void 0:e.pathname;return t?.slice(0,t.lastIndexOf(\"/\")+1)||\"\"}function Hrt(e){let t=e?e.lastIndexOf(\"/\"):-1;return t>=0?e.substr(t+1):\"\"}function qrt(e){let t=e?e.lastIndexOf(\"/\"):-1;return t>=0?e.substr(0,t):\"\"}function Zrt(){for(var e=arguments.length,t=new Array(e),r=0;r(n&&(s=s.replace(new RegExp(\"^\".concat(i)),\"\")),n!==t.length-1&&(s=s.replace(new RegExp(\"\".concat(i,\"$\")),\"\")),s)),t.join(i)}function Yrt(){let e=[];for(let s=0;s=-1&&!r;s--){let n;s>=0?n=e[s]:(i===void 0&&(i=AU()),n=i),n.length!==0&&(t=\"\".concat(n,\"/\").concat(t),r=n.charCodeAt(0)===tb)}return t=Qrt(t,!r),r?\"/\".concat(t):t.length>0?t:\".\"}var tb=47,z4=46;function Qrt(e,t){let r=\"\",i=-1,s=0,n,o=!1;for(let c=0;c<=e.length;++c){if(c2){let f=r.length-1,_=f;for(;_>=0&&r.charCodeAt(_)!==tb;--_);if(_!==f){r=_===-1?\"\":r.slice(0,_),i=c,s=0,o=!1;continue}}else if(r.length===2||r.length===1){r=\"\",i=c,s=0,o=!1;continue}}t&&(r.length>0?r+=\"/..\":r=\"..\",o=!0)}else{let f=e.slice(i+1,c);r.length>0?r+=\"/\".concat(f):r=f,o=!1}i=c,s=0}else n===z4&&s!==-1?++s:s=-1}return r}var $rt=e=>typeof e==\"boolean\",eb=e=>typeof e==\"function\",N0=e=>e!==null&&typeof e==\"object\",N4=e=>N0(e)&&e.constructor==={}.constructor;var mU=e=>e&&typeof e[Symbol.iterator]==\"function\",gU=e=>e&&typeof e[Symbol.asyncIterator]==\"function\";var Cu=e=>typeof Response<\"u\"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var Lu=e=>typeof Blob<\"u\"&&e instanceof Blob,_U=e=>e&&typeof e==\"object\"&&e.isBuffer;var Xrt=e=>typeof ReadableStream<\"u\"&&e instanceof ReadableStream||N0(e)&&eb(e.tee)&&eb(e.cancel)&&eb(e.getReader);var Krt=e=>N0(e)&&eb(e.read)&&eb(e.pipe)&&$rt(e.readable),WM=e=>Xrt(e)||Krt(e);var Jrt=/^data:([-\\w.]+\\/[-\\w.+]+)(;|,)/,tit=/^([-\\w.]+\\/[-\\w.+]+)/;function yU(e){let t=tit.exec(e);return t?t[1]:e}function U4(e){let t=Jrt.exec(e);return t?t[1]:\"\"}var vU=/\\?.*/;function xU(e){let t=e.match(vU);return t&&t[0]}function Ay(e){return e.replace(vU,\"\")}function U0(e){return Cu(e)?e.url:Lu(e)?e.name||\"\":typeof e==\"string\"?e:\"\"}function rb(e){if(Cu(e)){let t=e,r=t.headers.get(\"content-type\")||\"\",i=Ay(t.url);return yU(r)||U4(i)}return Lu(e)?e.type||\"\":typeof e==\"string\"?U4(e):\"\"}function bU(e){return Cu(e)?e.headers[\"content-length\"]||-1:Lu(e)?e.size:typeof e==\"string\"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function HM(e){if(Cu(e))return e;let t={},r=bU(e);r>=0&&(t[\"content-length\"]=String(r));let i=U0(e),s=rb(e);s&&(t[\"content-type\"]=s);let n=await rit(e);n&&(t[\"x-first-bytes\"]=n),typeof e==\"string\"&&(e=new TextEncoder().encode(e));let o=new Response(e,{headers:t});return Object.defineProperty(o,\"url\",{value:i}),o}async function wU(e){if(!e.ok){let t=await eit(e);throw new Error(t)}}async function eit(e){let t=\"Failed to fetch resource \".concat(e.url,\" (\").concat(e.status,\"): \");try{let r=e.headers.get(\"Content-Type\"),i=e.statusText;r.includes(\"application/json\")&&(i+=\" \".concat(await e.text())),t+=i,t=t.length>60?\"\".concat(t.slice(0,60),\"...\"):t}catch{}return t}async function rit(e){if(typeof e==\"string\")return\"data:,\".concat(e.slice(0,5));if(e instanceof Blob){let r=e.slice(0,5);return await new Promise(i=>{let s=new FileReader;s.onload=n=>{var o;return i(n==null||(o=n.target)===null||o===void 0?void 0:o.result)},s.readAsDataURL(r)})}if(e instanceof ArrayBuffer){let r=e.slice(0,5),i=iit(r);return\"data:base64,\".concat(i)}return null}function iit(e){let t=\"\",r=new Uint8Array(e);for(let i=0;i=0)}function Rh(){return!(typeof process==\"object\"&&String(process)===\"[object process]\"&&!process.browser)||j4()}var nit=globalThis.self||globalThis.window||globalThis.global,my=globalThis.window||globalThis.self||globalThis.global,sit=globalThis.document||{},V0=globalThis.process||{},oit=globalThis.console,qSt=globalThis.navigator||{};var qM=typeof __VERSION__<\"u\"?__VERSION__:\"untranspiled source\",QSt=Rh();function ait(e){try{let t=window[e],r=\"__storage_test__\";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var ZM=class{constructor(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:\"sessionStorage\";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=ait(i),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function SU(e){let t;return e<10?t=\"\".concat(e.toFixed(2),\"ms\"):e<100?t=\"\".concat(e.toFixed(1),\"ms\"):e<1e3?t=\"\".concat(e.toFixed(0),\"ms\"):t=\"\".concat((e/1e3).toFixed(2),\"s\"),t}function TU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return\"\".concat(\" \".repeat(r)).concat(e)}function YM(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,s=e.src.replace(/\\(/g,\"%28\").replace(/\\)/g,\"%29\");e.width>i&&(r=Math.min(r,i/e.width));let n=e.width*r,o=e.height*r,c=[\"font-size:1px;\",\"padding:\".concat(Math.floor(o/2),\"px \").concat(Math.floor(n/2),\"px;\"),\"line-height:\".concat(o,\"px;\"),\"background:url(\".concat(s,\");\"),\"background-size:\".concat(n,\"px \").concat(o,\"px;\"),\"color:transparent;\"].join(\"\");return[\"\".concat(t,\" %c+\"),c]}var QM;(function(e){e[e.BLACK=30]=\"BLACK\",e[e.RED=31]=\"RED\",e[e.GREEN=32]=\"GREEN\",e[e.YELLOW=33]=\"YELLOW\",e[e.BLUE=34]=\"BLUE\",e[e.MAGENTA=35]=\"MAGENTA\",e[e.CYAN=36]=\"CYAN\",e[e.WHITE=37]=\"WHITE\",e[e.BRIGHT_BLACK=90]=\"BRIGHT_BLACK\",e[e.BRIGHT_RED=91]=\"BRIGHT_RED\",e[e.BRIGHT_GREEN=92]=\"BRIGHT_GREEN\",e[e.BRIGHT_YELLOW=93]=\"BRIGHT_YELLOW\",e[e.BRIGHT_BLUE=94]=\"BRIGHT_BLUE\",e[e.BRIGHT_MAGENTA=95]=\"BRIGHT_MAGENTA\",e[e.BRIGHT_CYAN=96]=\"BRIGHT_CYAN\",e[e.BRIGHT_WHITE=97]=\"BRIGHT_WHITE\"})(QM||(QM={}));var lit=10;function MU(e){return typeof e!=\"string\"?e:(e=e.toUpperCase(),QM[e]||QM.WHITE)}function EU(e,t,r){if(!Rh&&typeof e==\"string\"){if(t){let i=MU(t);e=\"\\x1B[\".concat(i,\"m\").concat(e,\"\\x1B[39m\")}if(r){let i=MU(r);e=\"\\x1B[\".concat(i+lit,\"m\").concat(e,\"\\x1B[49m\")}}return e}function PU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[\"constructor\"],r=Object.getPrototypeOf(e),i=Object.getOwnPropertyNames(r),s=e;for(let n of i){let o=s[n];typeof o==\"function\"&&(t.find(c=>n===c)||(s[n]=o.bind(e)))}}function gy(e,t){if(!e)throw new Error(t||\"Assertion failed\")}function j0(){let e;if(Rh()&&my.performance){var t,r;e=my===null||my===void 0||(t=my.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if(\"hrtime\"in V0){var i;let s=V0===null||V0===void 0||(i=V0.hrtime)===null||i===void 0?void 0:i.call(V0);e=s[0]*1e3+s[1]/1e6}else e=Date.now();return e}var _y={debug:Rh()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},cit={enabled:!0,level:0};function ku(){}var IU={},CU={once:!0},Nf=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:\"\"};this.id=void 0,this.VERSION=qM,this._startTs=j0(),this._deltaTs=j0(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new ZM(\"__probe-\".concat(this.id,\"__\"),cit),this.timeStamp(\"\".concat(this.id,\" started\")),PU(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((j0()-this._startTs).toPrecision(10))}getDelta(){return Number((j0()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){gy(t,r)}warn(t){return this._getLogFunction(0,t,_y.warn,arguments,CU)}error(t){return this._getLogFunction(0,t,_y.error,arguments)}deprecated(t,r){return this.warn(\"`\".concat(t,\"` is deprecated and will be removed in a later version. Use `\").concat(r,\"` instead\"))}removed(t,r){return this.error(\"`\".concat(t,\"` has been removed. Use `\").concat(r,\"` instead\"))}probe(t,r){return this._getLogFunction(t,r,_y.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,_y.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,_y.debug||_y.info,arguments,CU)}table(t,r,i){return r?this._getLogFunction(t,r,console.table||ku,i&&[i],{tag:dit(r)}):ku}image(t){let{logLevel:r,priority:i,image:s,message:n=\"\",scale:o=1}=t;return this._shouldLog(r||i)?Rh()?fit({image:s,message:n,scale:o}):hit({image:s,message:n,scale:o}):ku}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||ku)}group(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},s=LU({logLevel:t,message:r,opts:i}),{collapsed:n}=i;return s.method=(n?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},i,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,\"\",console.groupEnd||ku)}withGroup(t,r,i){this.group(t,r)();try{i()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=kU(t)}_getLogFunction(t,r,i,s,n){if(this._shouldLog(t)){n=LU({logLevel:t,message:r,args:s,opts:n}),i=i||n.method,gy(i),n.total=this.getTotal(),n.delta=this.getDelta(),this._deltaTs=j0();let o=n.tag||n.message;if(n.once&&o)if(!IU[o])IU[o]=j0();else return ku;return r=uit(this.id,n.message,n),i.bind(console,r,...n.args)}return ku}};Nf.VERSION=qM;function kU(e){if(!e)return 0;let t;switch(typeof e){case\"number\":t=e;break;case\"object\":t=e.logLevel||e.priority||0;break;default:return 0}return gy(Number.isFinite(t)&&t>=0),t}function LU(e){let{logLevel:t,message:r}=e;e.logLevel=kU(t);let i=e.args?Array.from(e.args):[];for(;i.length&&i.shift()!==r;);switch(typeof t){case\"string\":case\"function\":r!==void 0&&i.unshift(r),e.message=t;break;case\"object\":Object.assign(e,t);break;default:}typeof e.message==\"function\"&&(e.message=e.message());let s=typeof e.message;return gy(s===\"string\"||s===\"object\"),Object.assign(e,{args:i},e.opts)}function uit(e,t,r){if(typeof t==\"string\"){let i=r.time?TU(SU(r.total)):\"\";t=r.time?\"\".concat(e,\": \").concat(i,\" \").concat(t):\"\".concat(e,\": \").concat(t),t=EU(t,r.color,r.background)}return t}function hit(e){let{image:t,message:r=\"\",scale:i=1}=e;return console.warn(\"removed\"),ku}function fit(e){let{image:t,message:r=\"\",scale:i=1}=e;if(typeof t==\"string\"){let n=new Image;return n.onload=()=>{let o=YM(n,r,i);console.log(...o)},n.src=t,ku}let s=t.nodeName||\"\";if(s.toLowerCase()===\"img\")return console.log(...YM(t,r,i)),ku;if(s.toLowerCase()===\"canvas\"){let n=new Image;return n.onload=()=>console.log(...YM(n,r,i)),n.src=t.toDataURL(),ku}return ku}function dit(e){for(let t in e)for(let r in e[t])return r||\"untitled\";return\"empty\"}var vTt=new Nf({id:\"@probe.gl/log\"});var G4=new Nf({id:\"loaders.gl\"}),$M=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},XM=class{constructor(){G(this,\"console\",void 0),this.console=console}log(){for(var t=arguments.length,r=new Array(t),i=0;i{let e=H4();return e.globalOptions=e.globalOptions||{...W4},e.globalOptions};function BU(e,t,r,i){return r=r||[],r=Array.isArray(r)?r:[r],pit(e,r),mit(t,e,i)}function pit(e,t){DU(e,null,W4,RU,t);for(let r of t){let i=e&&e[r.id]||{},s=r.options&&r.options[r.id]||{},n=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};DU(i,r.id,s,n,t)}}function DU(e,t,r,i,s){let n=t||\"Top level\",o=t?\"\".concat(t,\".\"):\"\";for(let c in e){let f=!t&&N0(e[c]),_=c===\"baseUri\"&&!t,w=c===\"workerUrl\"&&t;if(!(c in r)&&!_&&!w){if(c in i)G4.warn(\"\".concat(n,\" loader option '\").concat(o).concat(c,\"' no longer supported, use '\").concat(i[c],\"'\"))();else if(!f){let I=Ait(c,s);G4.warn(\"\".concat(n,\" loader option '\").concat(o).concat(c,\"' not recognized. \").concat(I))()}}}}function Ait(e,t){let r=e.toLowerCase(),i=\"\";for(let s of t)for(let n in s.options){if(e===n)return\"Did you mean '\".concat(s.id,\".\").concat(n,\"'?\");let o=n.toLowerCase();(r.startsWith(o)||o.startsWith(r))&&(i=i||\"Did you mean '\".concat(s.id,\".\").concat(n,\"'?\"))}return i}function mit(e,t,r){let s={...e.options||{}};return git(s,r),s.log===null&&(s.log=new $M),OU(s,q4()),OU(s,t),s}function OU(e,t){for(let r in t)if(r in t){let i=t[r];N4(i)&&N4(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r]}}function git(e,t){t&&!(\"baseUri\"in e)&&(e.baseUri=t)}function ib(e){var t;return e?(Array.isArray(e)&&(e=e[0]),Array.isArray((t=e)===null||t===void 0?void 0:t.extensions)):!1}function nb(e){var t,r;NA(e,\"null loader\"),NA(ib(e),\"invalid loader\");let i;return Array.isArray(e)&&(i=e[1],e=e[0],e={...e,options:{...e.options,...i}}),((t=e)!==null&&t!==void 0&&t.parseTextSync||(r=e)!==null&&r!==void 0&&r.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var FU=()=>{let e=H4();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function Z4(e){let t=FU();e=Array.isArray(e)?e:[e];for(let r of e){let i=nb(r);t.find(s=>i===s)||t.unshift(i)}}function zU(){return FU()}var NU=new Nf({id:\"loaders.gl\"});var _it=/\\.([^.]+)$/;async function jU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!GU(e))return null;let s=UU(e,t,{...r,nothrow:!0},i);if(s)return s;if(Lu(e)&&(e=await e.slice(0,10).arrayBuffer(),s=UU(e,t,r,i)),!s&&!(r!=null&&r.nothrow))throw new Error(WU(e));return s}function UU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!GU(e))return null;if(t&&!Array.isArray(t))return nb(t);let s=[];t&&(s=s.concat(t)),r!=null&&r.ignoreRegisteredLoaders||s.push(...zU()),vit(s);let n=yit(e,s,r,i);if(!n&&!(r!=null&&r.nothrow))throw new Error(WU(e));return n}function yit(e,t,r,i){let s=U0(e),n=rb(e),o=Ay(s)||i?.url,c=null,f=\"\";if(r!=null&&r.mimeType&&(c=Y4(t,r?.mimeType),f=\"match forced by supplied MIME type \".concat(r?.mimeType)),c=c||xit(t,o),f=f||(c?\"matched url \".concat(o):\"\"),c=c||Y4(t,n),f=f||(c?\"matched MIME type \".concat(n):\"\"),c=c||wit(t,e),f=f||(c?\"matched initial data \".concat(HU(e)):\"\"),c=c||Y4(t,r?.fallbackMimeType),f=f||(c?\"matched fallback MIME type \".concat(n):\"\"),f){var _;NU.log(1,\"selectLoader selected \".concat((_=c)===null||_===void 0?void 0:_.name,\": \").concat(f,\".\"))}return c}function GU(e){return!(e instanceof Response&&e.status===204)}function WU(e){let t=U0(e),r=rb(e),i=\"No valid loader found (\";i+=t?\"\".concat(z0.filename(t),\", \"):\"no url provided, \",i+=\"MIME type: \".concat(r?'\"'.concat(r,'\"'):\"not provided\",\", \");let s=e?HU(e):\"\";return i+=s?' first bytes: \"'.concat(s,'\"'):\"first bytes: not available\",i+=\")\",i}function vit(e){for(let t of e)nb(t)}function xit(e,t){let r=t&&_it.exec(t),i=r&&r[1];return i?bit(e,i):null}function bit(e,t){t=t.toLowerCase();for(let r of e)for(let i of r.extensions)if(i.toLowerCase()===t)return r;return null}function Y4(e,t){for(let r of e)if(r.mimeTypes&&r.mimeTypes.includes(t)||t===\"application/x.\".concat(r.id))return r;return null}function wit(e,t){if(!t)return null;for(let r of e)if(typeof t==\"string\"){if(Sit(t,r))return r}else if(ArrayBuffer.isView(t)){if(VU(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer&&VU(t,0,r))return r;return null}function Sit(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(i=>e.startsWith(i))}function VU(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(s=>Tit(e,t,r,s))}function Tit(e,t,r,i){if(i instanceof ArrayBuffer)return D4(i,e,i.byteLength);switch(typeof i){case\"function\":return i(e,r);case\"string\":let s=Q4(e,t,i.length);return i===s;default:return!1}}function HU(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;return typeof e==\"string\"?e.slice(0,t):ArrayBuffer.isView(e)?Q4(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?Q4(e,0,t):\"\"}function Q4(e,t,r){if(e.byteLength1&&arguments[1]!==void 0?arguments[1]:{};return function*(){let{chunkSize:r=262144}=t,i=0;for(;iV4(s,i):t!=null&&t.fetch?t?.fetch:V4}function KU(e,t,r){if(r)return r;let i={fetch:KM(t,e),...e};if(i.url){let s=Ay(i.url);i.baseUrl=s,i.queryString=xU(i.url),i.filename=z0.filename(s),i.baseUrl=z0.dirname(s)}return Array.isArray(i.loaders)||(i.loaders=null),i}function JU(e,t){if(!t&&e&&!Array.isArray(e))return e;let r;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){let i=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...i]:i}return r&&r.length?r:null}async function JM(e,t,r,i){Ka(!i||typeof i==\"object\"),t&&!Array.isArray(t)&&!ib(t)&&(i=void 0,r=t,t=void 0),e=await e,r=r||{};let s=U0(e),o=JU(t,i),c=await jU(e,o,r);return c?(r=BU(r,c,o,s),i=KU({url:s,parse:JM,loaders:o},r,i||null),await Iit(c,e,r,i)):null}async function Iit(e,t,r,i){if(L4(e),Cu(t)){let s=t,{ok:n,redirected:o,status:c,statusText:f,type:_,url:w}=s,I=Object.fromEntries(s.headers.entries());i.response={headers:I,ok:n,redirected:o,status:c,statusText:f,type:_,url:w}}if(t=await XU(t,e,r),e.parseTextSync&&typeof t==\"string\")return r.dataType=\"text\",e.parseTextSync(t,r,i,e);if(k4(e,r))return await R4(e,t,r,i,JM);if(e.parseText&&typeof t==\"string\")return await e.parseText(t,r,i,e);if(e.parse)return await e.parse(t,r,i,e);throw Ka(!e.parseSync),new Error(\"\".concat(e.id,\" loader - no parser found and worker is disabled\"))}async function jA(e,t,r,i){!Array.isArray(t)&&!ib(t)&&(i=void 0,r=t,t=void 0);let s=KM(r),n=e;return typeof e==\"string\"&&(n=await s(e)),Lu(e)&&(n=await s(e)),await JM(n,t,r)}var tV=\"3.4.14\";var{_parseImageNode:Cit}=globalThis,X4=typeof Image<\"u\",K4=typeof ImageBitmap<\"u\",Lit=!!Cit,J4=D0?!0:Lit;function eV(e){switch(e){case\"auto\":return K4||X4||J4;case\"imagebitmap\":return K4;case\"image\":return X4;case\"data\":return J4;default:throw new Error(\"@loaders.gl/images: image \".concat(e,\" not supported in this environment\"))}}function rV(){if(K4)return\"imagebitmap\";if(X4)return\"image\";if(J4)return\"data\";throw new Error(\"Install '@loaders.gl/polyfills' to parse images under Node.js\")}function kit(e){let t=Rit(e);if(!t)throw new Error(\"Not an image\");return t}function iV(e){switch(kit(e)){case\"data\":return e;case\"image\":case\"imagebitmap\":let t=document.createElement(\"canvas\"),r=t.getContext(\"2d\");if(!r)throw new Error(\"getImageData\");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error(\"getImageData\")}}function Rit(e){return typeof ImageBitmap<\"u\"&&e instanceof ImageBitmap?\"imagebitmap\":typeof Image<\"u\"&&e instanceof Image?\"image\":e&&typeof e==\"object\"&&e.data&&e.width&&e.height?\"data\":null}var Dit=/^data:image\\/svg\\+xml/,Oit=/\\.svg((\\?|#).*)?$/;function tE(e){return e&&(Dit.test(e)||Oit.test(e))}function nV(e,t){if(tE(t)){let i=new TextDecoder().decode(e);try{typeof unescape==\"function\"&&typeof encodeURIComponent==\"function\"&&(i=unescape(encodeURIComponent(i)))}catch(n){throw new Error(n.message)}return\"data:image/svg+xml;base64,\".concat(btoa(i))}return tR(e,t)}function tR(e,t){if(tE(t))throw new Error(\"SVG cannot be parsed directly to imagebitmap\");return new Blob([new Uint8Array(e)])}async function eE(e,t,r){let i=nV(e,r),s=self.URL||self.webkitURL,n=typeof i!=\"string\"&&s.createObjectURL(i);try{return await Bit(n||i,t)}finally{n&&s.revokeObjectURL(n)}}async function Bit(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((i,s)=>{try{r.onload=()=>i(r),r.onerror=n=>s(new Error(\"Could not load image \".concat(e,\": \").concat(n)))}catch(n){s(n)}})}var Fit={},sV=!0;async function oV(e,t,r){let i;tE(r)?i=await eE(e,t,r):i=tR(e,r);let s=t&&t.imagebitmap;return await zit(i,s)}async function zit(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if((Nit(t)||!sV)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),sV=!1}return await createImageBitmap(e)}function Nit(e){for(let t in e||Fit)return!1;return!0}function aV(e){return!Git(e,\"ftyp\",4)||!(e[8]&96)?null:Uit(e)}function Uit(e){switch(Vit(e,8,12).replace(\"\\0\",\" \").trim()){case\"avif\":case\"avis\":return{extension:\"avif\",mimeType:\"image/avif\"};default:return null}}function Vit(e,t,r){return String.fromCharCode(...e.slice(t,r))}function jit(e){return[...e].map(t=>t.charCodeAt(0))}function Git(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=jit(t);for(let s=0;s=24&&t.getUint32(0,Uf)===2303741511?{mimeType:\"image/png\",width:t.getUint32(16,Uf),height:t.getUint32(20,Uf)}:null}function qit(e){let t=ob(e);return t.byteLength>=10&&t.getUint32(0,Uf)===1195984440?{mimeType:\"image/gif\",width:t.getUint16(6,sb),height:t.getUint16(8,sb)}:null}function Zit(e){let t=ob(e);return t.byteLength>=14&&t.getUint16(0,Uf)===16973&&t.getUint32(2,sb)===t.byteLength?{mimeType:\"image/bmp\",width:t.getUint32(18,sb),height:t.getUint32(22,sb)}:null}function Yit(e){let t=ob(e);if(!(t.byteLength>=3&&t.getUint16(0,Uf)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:s}=Qit(),n=2;for(;n+9!!rE(new DataView(e))],options:Jit};function ab(e){if(typeof window<\"u\"&&typeof window.process==\"object\"&&window.process.type===\"renderer\"||typeof process<\"u\"&&typeof process.versions==\"object\"&&process.versions.electron)return!0;let t=typeof navigator==\"object\"&&typeof navigator.userAgent==\"string\"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf(\"Electron\")>=0)}function Lo(){return!(typeof process==\"object\"&&String(process)===\"[object process]\"&&!process.browser)||ab()}var GA={self:typeof self<\"u\"&&self,window:typeof window<\"u\"&&window,global:typeof global<\"u\"&&global,document:typeof document<\"u\"&&document,process:typeof process==\"object\"&&process};var tnt=GA.self||GA.window||GA.global,yy=GA.window||GA.self||GA.global,ent=GA.document||{},G0=GA.process||{};var iE=typeof __VERSION__<\"u\"?__VERSION__:\"untranspiled source\",gEt=Lo();var rR=globalThis;function vy(e){if(!e&&!Lo())return\"Node\";if(ab(e))return\"Electron\";let r=e||(typeof navigator<\"u\"?navigator:{}).userAgent||\"\";if(r.indexOf(\"Edge\")>-1)return\"Edge\";let i=r.indexOf(\"MSIE \")!==-1,s=r.indexOf(\"Trident/\")!==-1;return i||s?\"IE\":rR.chrome?\"Chrome\":rR.safari?\"Safari\":rR.mozInnerScreenX?\"Firefox\":\"Unknown\"}function rnt(e){try{let t=window[e],r=\"__storage_test__\";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var nE=class{constructor(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:\"sessionStorage\";G(this,\"storage\",void 0),G(this,\"id\",void 0),G(this,\"config\",void 0),this.storage=rnt(i),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function uV(e){let t;return e<10?t=\"\".concat(e.toFixed(2),\"ms\"):e<100?t=\"\".concat(e.toFixed(1),\"ms\"):e<1e3?t=\"\".concat(e.toFixed(0),\"ms\"):t=\"\".concat((e/1e3).toFixed(2),\"s\"),t}function hV(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return\"\".concat(\" \".repeat(r)).concat(e)}function sE(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,s=e.src.replace(/\\(/g,\"%28\").replace(/\\)/g,\"%29\");e.width>i&&(r=Math.min(r,i/e.width));let n=e.width*r,o=e.height*r,c=[\"font-size:1px;\",\"padding:\".concat(Math.floor(o/2),\"px \").concat(Math.floor(n/2),\"px;\"),\"line-height:\".concat(o,\"px;\"),\"background:url(\".concat(s,\");\"),\"background-size:\".concat(n,\"px \").concat(o,\"px;\"),\"color:transparent;\"].join(\"\");return[\"\".concat(t,\" %c+\"),c]}var oE;(function(e){e[e.BLACK=30]=\"BLACK\",e[e.RED=31]=\"RED\",e[e.GREEN=32]=\"GREEN\",e[e.YELLOW=33]=\"YELLOW\",e[e.BLUE=34]=\"BLUE\",e[e.MAGENTA=35]=\"MAGENTA\",e[e.CYAN=36]=\"CYAN\",e[e.WHITE=37]=\"WHITE\",e[e.BRIGHT_BLACK=90]=\"BRIGHT_BLACK\",e[e.BRIGHT_RED=91]=\"BRIGHT_RED\",e[e.BRIGHT_GREEN=92]=\"BRIGHT_GREEN\",e[e.BRIGHT_YELLOW=93]=\"BRIGHT_YELLOW\",e[e.BRIGHT_BLUE=94]=\"BRIGHT_BLUE\",e[e.BRIGHT_MAGENTA=95]=\"BRIGHT_MAGENTA\",e[e.BRIGHT_CYAN=96]=\"BRIGHT_CYAN\",e[e.BRIGHT_WHITE=97]=\"BRIGHT_WHITE\"})(oE||(oE={}));function fV(e){return typeof e==\"string\"?oE[e.toUpperCase()]||oE.WHITE:e}function dV(e,t,r){return!Lo&&typeof e==\"string\"&&(t&&(t=fV(t),e=\"\\x1B[\".concat(t,\"m\").concat(e,\"\\x1B[39m\")),r&&(t=fV(r),e=\"\\x1B[\".concat(r+10,\"m\").concat(e,\"\\x1B[49m\"))),e}function pV(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[\"constructor\"],r=Object.getPrototypeOf(e),i=Object.getOwnPropertyNames(r);for(let s of i)typeof e[s]==\"function\"&&(t.find(n=>s===n)||(e[s]=e[s].bind(e)))}function xy(e,t){if(!e)throw new Error(t||\"Assertion failed\")}function W0(){let e;if(Lo&&\"performance\"in yy){var t,r;e=yy===null||yy===void 0||(t=yy.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if(\"hrtime\"in G0){var i;let s=G0===null||G0===void 0||(i=G0.hrtime)===null||i===void 0?void 0:i.call(G0);e=s[0]*1e3+s[1]/1e6}else e=Date.now();return e}var by={debug:Lo&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},int={enabled:!0,level:0};function Ru(){}var AV={},mV={once:!0},Vf=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:\"\"};G(this,\"id\",void 0),G(this,\"VERSION\",iE),G(this,\"_startTs\",W0()),G(this,\"_deltaTs\",W0()),G(this,\"_storage\",void 0),G(this,\"userData\",{}),G(this,\"LOG_THROTTLE_TIMEOUT\",0),this.id=t,this.userData={},this._storage=new nE(\"__probe-\".concat(this.id,\"__\"),int),this.timeStamp(\"\".concat(this.id,\" started\")),pV(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((W0()-this._startTs).toPrecision(10))}getDelta(){return Number((W0()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){xy(t,r)}warn(t){return this._getLogFunction(0,t,by.warn,arguments,mV)}error(t){return this._getLogFunction(0,t,by.error,arguments)}deprecated(t,r){return this.warn(\"`\".concat(t,\"` is deprecated and will be removed in a later version. Use `\").concat(r,\"` instead\"))}removed(t,r){return this.error(\"`\".concat(t,\"` has been removed. Use `\").concat(r,\"` instead\"))}probe(t,r){return this._getLogFunction(t,r,by.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,by.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){for(var i=arguments.length,s=new Array(i>2?i-2:0),n=2;n2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},s=gV({logLevel:t,message:r,opts:i}),{collapsed:n}=i;return s.method=(n?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},i,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,\"\",console.groupEnd||Ru)}withGroup(t,r,i){this.group(t,r)();try{i()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=_V(t)}_getLogFunction(t,r,i,s,n){if(this._shouldLog(t)){n=gV({logLevel:t,message:r,args:s,opts:n}),i=i||n.method,xy(i),n.total=this.getTotal(),n.delta=this.getDelta(),this._deltaTs=W0();let o=n.tag||n.message;if(n.once)if(!AV[o])AV[o]=W0();else return Ru;return r=nnt(this.id,n.message,n),i.bind(console,r,...n.args)}return Ru}};G(Vf,\"VERSION\",iE);function _V(e){if(!e)return 0;let t;switch(typeof e){case\"number\":t=e;break;case\"object\":t=e.logLevel||e.priority||0;break;default:return 0}return xy(Number.isFinite(t)&&t>=0),t}function gV(e){let{logLevel:t,message:r}=e;e.logLevel=_V(t);let i=e.args?Array.from(e.args):[];for(;i.length&&i.shift()!==r;);switch(typeof t){case\"string\":case\"function\":r!==void 0&&i.unshift(r),e.message=t;break;case\"object\":Object.assign(e,t);break;default:}typeof e.message==\"function\"&&(e.message=e.message());let s=typeof e.message;return xy(s===\"string\"||s===\"object\"),Object.assign(e,{args:i},e.opts)}function nnt(e,t,r){if(typeof t==\"string\"){let i=r.time?hV(uV(r.total)):\"\";t=r.time?\"\".concat(e,\": \").concat(i,\" \").concat(t):\"\".concat(e,\": \").concat(t),t=dV(t,r.color,r.background)}return t}function snt(e){let{image:t,message:r=\"\",scale:i=1}=e;return console.warn(\"removed\"),Ru}function ont(e){let{image:t,message:r=\"\",scale:i=1}=e;if(typeof t==\"string\"){let n=new Image;return n.onload=()=>{let o=sE(n,r,i);console.log(...o)},n.src=t,Ru}let s=t.nodeName||\"\";if(s.toLowerCase()===\"img\")return console.log(...sE(t,r,i)),Ru;if(s.toLowerCase()===\"canvas\"){let n=new Image;return n.onload=()=>console.log(...sE(n,r,i)),n.src=t.toDataURL(),Ru}return Ru}function ant(e){for(let t in e)for(let r in e[t])return r||\"untitled\";return\"empty\"}var $Et=new Vf({id:\"@probe.gl/log\"});var or=new Vf({id:\"deck\"});var iR={};function yV(e){iR=e}function Ls(e,t,r,i){or.level>0&&iR[e]&&iR[e].call(null,t,r,i)}function lnt(e){let t=e[0],r=e[e.length-1];return t===\"{\"&&r===\"}\"||t===\"[\"&&r===\"]\"}var vV={id:\"JSON\",name:\"JSON\",module:\"\",version:\"\",options:{},extensions:[\"json\",\"geojson\"],mimeTypes:[\"application/json\",\"application/geo+json\"],testText:lnt,parseTextSync:JSON.parse};function cnt(){let e=\"8.9.35\",t=globalThis.deck&&globalThis.deck.VERSION;if(t&&t!==e)throw new Error(\"deck.gl - multiple versions detected: \".concat(t,\" vs \").concat(e));return t||(or.log(1,\"deck.gl \".concat(e))(),globalThis.deck={...globalThis.deck,VERSION:e,version:e,log:or,_registerLoggers:yV},Z4([vV,[eR,{imagebitmap:{premultiplyAlpha:\"none\"}}]])),e}var xV=cnt();var Yr={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(Yr,\"IDENTITY\",{get:()=>(or.deprecated(\"COORDINATE_SYSTEM.IDENTITY\",\"COORDINATE_SYSTEM.CARTESIAN\")(),0)});var Ja={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},po={common:0,meters:1,pixels:2},nR={click:{handler:\"onClick\"},panstart:{handler:\"onDragStart\"},panmove:{handler:\"onDrag\"},panend:{handler:\"onDragEnd\"}};var He=new Vf({id:\"luma.gl\"});function Ks(e,t){if(!e)throw new Error(t||\"luma.gl: assertion failed.\")}var unt=\"Invalid WebGLRenderingContext\";var hnt=\"Requires WebGL2\";function Jd(e){return typeof WebGLRenderingContext<\"u\"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<\"u\"&&e instanceof WebGL2RenderingContext?!0:!!(e&&Number.isFinite(e._version))}function fr(e){return typeof WebGL2RenderingContext<\"u\"&&e instanceof WebGL2RenderingContext?!0:!!(e&&e._version===2)}function sR(e){return fr(e)?e:null}function tp(e){return Ks(Jd(e),unt),e}function Yn(e){return Ks(fr(e),hnt),e}var lb={};function fnt(e){globalThis.console&&globalThis.console.error&&globalThis.console.error(e)}function dnt(e){globalThis.console&&globalThis.console.log&&globalThis.console.log(e)}function pnt(e,t){lb[e]=!0,t!==void 0&&fnt(t)}function Ant(e){let t=e.getError;e.getError=function(){let i;do i=t.apply(e),i!==0&&(lb[i]=!0);while(i!==0);for(i in lb)if(lb[i])return delete lb[i],parseInt(i,10);return 0}}var cb=function e(t){let r=t.gl;this.ext=t,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(t.maxVertexAttribs);for(let i=0;i{dnt(\"OESVertexArrayObject emulation library context restored\"),r.reset_()},!0),this.reset_()};H0.prototype.VERTEX_ARRAY_BINDING_OES=34229;H0.prototype.reset_=function(){if(this.vertexArrayObjects!==void 0)for(let i=0;ifr(e)?void 0:0,Tnt={3074:e=>fr(e)?void 0:36064,[ynt]:e=>fr(e)?void 0:vnt,35977:Un,32937:Un,[xnt]:(e,t)=>{let r=fr(e)?e.getExtension(gnt):e.getExtension(mnt);return r&&r.GPU_DISJOINT_EXT?t(r.GPU_DISJOINT_EXT):0},[wnt]:(e,t)=>{let r=e.getExtension(TV);return t(r&&r.UNMASKED_VENDOR_WEBGL||7936)},[Snt]:(e,t)=>{let r=e.getExtension(TV);return t(r&&r.UNMASKED_RENDERER_WEBGL||7937)},[bnt]:(e,t)=>{let r=e.luma.extensions[_nt];return r?t(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1},32883:Un,35071:Un,37447:Un,36063:(e,t)=>{if(!fr(e)){let r=e.getExtension(SV);return r?t(r.MAX_COLOR_ATTACHMENTS_WEBGL):0}},35379:Un,35374:Un,35377:Un,34852:e=>{if(!fr(e)){let t=e.getExtension(SV);return t?t.MAX_DRAW_BUFFERS_WEBGL:0}},36203:e=>e.getExtension(wV)?2147483647:65535,33001:e=>e.getExtension(wV)?16777216:65535,33e3:e=>16777216,37157:Un,35373:Un,35657:Un,36183:Un,37137:Un,34045:Un,35978:Un,35979:Un,35968:Un,35376:Un,35375:Un,35659:Un,37154:Un,35371:Un,35658:Un,35076:Un,35077:Un,35380:Un};function MV(e,t,r){let i=Tnt[r],s=typeof i==\"function\"?i(e,t,r):i;return s!==void 0?s:t(r)}var Mnt=\"OES_vertex_array_object\",EV=\"ANGLE_instanced_arrays\",Ent=\"WEBGL_draw_buffers\",Pnt=\"EXT_disjoint_timer_query\",Int=\"EXT_texture_filter_anisotropic\",Cnt=\"VertexArray requires WebGL2 or OES_vertex_array_object extension\";function Lnt(e,t){return{webgl2:fr(e),ext:e.getExtension(t)}}var oR={[Mnt]:{meta:{suffix:\"OES\"},createVertexArray:()=>{Ks(!1,Cnt)},deleteVertexArray:()=>{},bindVertexArray:()=>{},isVertexArray:()=>!1},[EV]:{meta:{suffix:\"ANGLE\"},vertexAttribDivisor(e,t){Ks(t===0,\"WebGL instanced rendering not supported\")},drawElementsInstanced:()=>{},drawArraysInstanced:()=>{}},[Ent]:{meta:{suffix:\"WEBGL\"},drawBuffers:()=>{Ks(!1)}},[Pnt]:{meta:{suffix:\"EXT\"},createQuery:()=>{Ks(!1)},deleteQuery:()=>{Ks(!1)},beginQuery:()=>{Ks(!1)},endQuery:()=>{},getQuery(e,t){return this.getQueryObject(e,t)},getQueryParameter(e,t){return this.getQueryObject(e,t)},getQueryObject:()=>{}}},aE={readBuffer:(e,t,r)=>{fr(e)&&t(r)},getVertexAttrib:(e,t,r,i)=>{let{webgl2:s,ext:n}=Lnt(e,EV),o;switch(i){case 35069:o=s?void 0:!1;break;case 35070:o=!s&&!n?0:void 0;break;default:}return o!==void 0?o:t(r,i)},getProgramParameter:(e,t,r,i)=>{if(!fr(e))switch(i){case 35967:return 35981;case 35971:return 0;case 35382:return 0;default:}return t(r,i)},getInternalformatParameter:(e,t,r,i,s)=>{if(!fr(e))switch(s){case 32937:return new Int32Array([0]);default:}return e.getInternalformatParameter(r,i,s)},getTexParameter(e,t,r,i){switch(i){case 34046:let{extensions:s}=e.luma,n=s[Int];i=n&&n.TEXTURE_MAX_ANISOTROPY_EXT||34046;break;default:}return t(r,i)},getParameter:MV,hint(e,t,r,i){return t(r,i)}};function PV(e){e.luma=e.luma||{};let{luma:t}=e;return t.polyfilled||(bV(e),knt(e),Dnt(e,oR),Rnt(e,{target:t,target2:e}),t.polyfilled=!0),e}globalThis.polyfillContext=PV;function knt(e){e.luma.extensions={};let t=e.getSupportedExtensions()||[];for(let r of t)e.luma[r]=e.getExtension(r)}function Rnt(e,t){let{target:r,target2:i}=t;Object.keys(aE).forEach(s=>{if(typeof aE[s]==\"function\"){let n=e[s]?e[s].bind(e):()=>{},o=aE[s].bind(null,e,n);r[s]=o,i[s]=o}})}function Dnt(e,t){for(let r of Object.getOwnPropertyNames(t))r!==\"overrides\"&&Ont(e,{extension:r,target:e.luma,target2:e})}function Ont(e,t){let{extension:r,target:i,target2:s}=t,n=oR[r];Ks(n);let{meta:o={}}=n,{suffix:c=\"\"}=o,f=e.getExtension(r);for(let _ of Object.keys(n)){let w=\"\".concat(_).concat(c),I=null;_===\"meta\"||typeof e[_]==\"function\"||(f&&typeof f[w]==\"function\"?I=function(){return f[w](...arguments)}:typeof n[_]==\"function\"&&(I=n[_].bind(i))),I&&(i[_]=I,s[_]=I)}}var hb={3042:!1,32773:new Float32Array([0,0,0,0]),32777:32774,34877:32774,32969:1,32968:0,32971:1,32970:0,3106:new Float32Array([0,0,0,0]),3107:[!0,!0,!0,!0],2884:!1,2885:1029,2929:!1,2931:1,2932:513,2928:new Float32Array([0,1]),2930:!0,3024:!0,36006:null,2886:2305,33170:4352,2849:1,32823:!1,32824:0,10752:0,32938:1,32939:!1,3089:!1,3088:new Int32Array([0,0,1024,1024]),2960:!1,2961:0,2968:4294967295,36005:4294967295,2962:519,2967:0,2963:4294967295,34816:519,36003:0,36004:4294967295,2964:7680,2965:7680,2966:7680,34817:7680,34818:7680,34819:7680,2978:[0,0,1024,1024],3333:4,3317:4,37440:!1,37441:!1,37443:37444,35723:4352,36010:null,35977:!1,3330:0,3332:0,3331:0,3314:0,32878:0,3316:0,3315:0,32877:0},WA=(e,t,r)=>t?e.enable(r):e.disable(r),IV=(e,t,r)=>e.hint(r,t),Qc=(e,t,r)=>e.pixelStorei(r,t),Bnt=(e,t)=>{let r=fr(e)?36009:36160;return e.bindFramebuffer(r,t)},Fnt=(e,t)=>e.bindFramebuffer(36008,t);function ub(e){return Array.isArray(e)||ArrayBuffer.isView(e)}var CV={3042:WA,32773:(e,t)=>e.blendColor(...t),32777:\"blendEquation\",34877:\"blendEquation\",32969:\"blendFunc\",32968:\"blendFunc\",32971:\"blendFunc\",32970:\"blendFunc\",3106:(e,t)=>e.clearColor(...t),3107:(e,t)=>e.colorMask(...t),2884:WA,2885:(e,t)=>e.cullFace(t),2929:WA,2931:(e,t)=>e.clearDepth(t),2932:(e,t)=>e.depthFunc(t),2928:(e,t)=>e.depthRange(...t),2930:(e,t)=>e.depthMask(t),3024:WA,35723:IV,36006:Bnt,2886:(e,t)=>e.frontFace(t),33170:IV,2849:(e,t)=>e.lineWidth(t),32823:WA,32824:\"polygonOffset\",10752:\"polygonOffset\",35977:WA,32938:\"sampleCoverage\",32939:\"sampleCoverage\",3089:WA,3088:(e,t)=>e.scissor(...t),2960:WA,2961:(e,t)=>e.clearStencil(t),2968:(e,t)=>e.stencilMaskSeparate(1028,t),36005:(e,t)=>e.stencilMaskSeparate(1029,t),2962:\"stencilFuncFront\",2967:\"stencilFuncFront\",2963:\"stencilFuncFront\",34816:\"stencilFuncBack\",36003:\"stencilFuncBack\",36004:\"stencilFuncBack\",2964:\"stencilOpFront\",2965:\"stencilOpFront\",2966:\"stencilOpFront\",34817:\"stencilOpBack\",34818:\"stencilOpBack\",34819:\"stencilOpBack\",2978:(e,t)=>e.viewport(...t),3333:Qc,3317:Qc,37440:Qc,37441:Qc,37443:Qc,3330:Qc,3332:Qc,3331:Qc,36010:Fnt,3314:Qc,32878:Qc,3316:Qc,3315:Qc,32877:Qc,framebuffer:(e,t)=>{let r=t&&\"handle\"in t?t.handle:t;return e.bindFramebuffer(36160,r)},blend:(e,t)=>t?e.enable(3042):e.disable(3042),blendColor:(e,t)=>e.blendColor(...t),blendEquation:(e,t)=>{t=ub(t)?t:[t,t],e.blendEquationSeparate(...t)},blendFunc:(e,t)=>{t=ub(t)&&t.length===2?[...t,...t]:t,e.blendFuncSeparate(...t)},clearColor:(e,t)=>e.clearColor(...t),clearDepth:(e,t)=>e.clearDepth(t),clearStencil:(e,t)=>e.clearStencil(t),colorMask:(e,t)=>e.colorMask(...t),cull:(e,t)=>t?e.enable(2884):e.disable(2884),cullFace:(e,t)=>e.cullFace(t),depthTest:(e,t)=>t?e.enable(2929):e.disable(2929),depthFunc:(e,t)=>e.depthFunc(t),depthMask:(e,t)=>e.depthMask(t),depthRange:(e,t)=>e.depthRange(...t),dither:(e,t)=>t?e.enable(3024):e.disable(3024),derivativeHint:(e,t)=>{e.hint(35723,t)},frontFace:(e,t)=>e.frontFace(t),mipmapHint:(e,t)=>e.hint(33170,t),lineWidth:(e,t)=>e.lineWidth(t),polygonOffsetFill:(e,t)=>t?e.enable(32823):e.disable(32823),polygonOffset:(e,t)=>e.polygonOffset(...t),sampleCoverage:(e,t)=>e.sampleCoverage(...t),scissorTest:(e,t)=>t?e.enable(3089):e.disable(3089),scissor:(e,t)=>e.scissor(...t),stencilTest:(e,t)=>t?e.enable(2960):e.disable(2960),stencilMask:(e,t)=>{t=ub(t)?t:[t,t];let[r,i]=t;e.stencilMaskSeparate(1028,r),e.stencilMaskSeparate(1029,i)},stencilFunc:(e,t)=>{t=ub(t)&&t.length===3?[...t,...t]:t;let[r,i,s,n,o,c]=t;e.stencilFuncSeparate(1028,r,i,s),e.stencilFuncSeparate(1029,n,o,c)},stencilOp:(e,t)=>{t=ub(t)&&t.length===3?[...t,...t]:t;let[r,i,s,n,o,c]=t;e.stencilOpSeparate(1028,r,i,s),e.stencilOpSeparate(1029,n,o,c)},viewport:(e,t)=>e.viewport(...t)};function ks(e,t,r){return t[e]!==void 0?t[e]:r[e]}var LV={blendEquation:(e,t,r)=>e.blendEquationSeparate(ks(32777,t,r),ks(34877,t,r)),blendFunc:(e,t,r)=>e.blendFuncSeparate(ks(32969,t,r),ks(32968,t,r),ks(32971,t,r),ks(32970,t,r)),polygonOffset:(e,t,r)=>e.polygonOffset(ks(32824,t,r),ks(10752,t,r)),sampleCoverage:(e,t,r)=>e.sampleCoverage(ks(32938,t,r),ks(32939,t,r)),stencilFuncFront:(e,t,r)=>e.stencilFuncSeparate(1028,ks(2962,t,r),ks(2967,t,r),ks(2963,t,r)),stencilFuncBack:(e,t,r)=>e.stencilFuncSeparate(1029,ks(34816,t,r),ks(36003,t,r),ks(36004,t,r)),stencilOpFront:(e,t,r)=>e.stencilOpSeparate(1028,ks(2964,t,r),ks(2965,t,r),ks(2966,t,r)),stencilOpBack:(e,t,r)=>e.stencilOpSeparate(1029,ks(34817,t,r),ks(34818,t,r),ks(34819,t,r))},aR={enable:(e,t)=>e({[t]:!0}),disable:(e,t)=>e({[t]:!1}),pixelStorei:(e,t,r)=>e({[t]:r}),hint:(e,t,r)=>e({[t]:r}),bindFramebuffer:(e,t,r)=>{switch(t){case 36160:return e({36006:r,36010:r});case 36009:return e({36006:r});case 36008:return e({36010:r});default:return null}},blendColor:(e,t,r,i,s)=>e({32773:new Float32Array([t,r,i,s])}),blendEquation:(e,t)=>e({32777:t,34877:t}),blendEquationSeparate:(e,t,r)=>e({32777:t,34877:r}),blendFunc:(e,t,r)=>e({32969:t,32968:r,32971:t,32970:r}),blendFuncSeparate:(e,t,r,i,s)=>e({32969:t,32968:r,32971:i,32970:s}),clearColor:(e,t,r,i,s)=>e({3106:new Float32Array([t,r,i,s])}),clearDepth:(e,t)=>e({2931:t}),clearStencil:(e,t)=>e({2961:t}),colorMask:(e,t,r,i,s)=>e({3107:[t,r,i,s]}),cullFace:(e,t)=>e({2885:t}),depthFunc:(e,t)=>e({2932:t}),depthRange:(e,t,r)=>e({2928:new Float32Array([t,r])}),depthMask:(e,t)=>e({2930:t}),frontFace:(e,t)=>e({2886:t}),lineWidth:(e,t)=>e({2849:t}),polygonOffset:(e,t,r)=>e({32824:t,10752:r}),sampleCoverage:(e,t,r)=>e({32938:t,32939:r}),scissor:(e,t,r,i,s)=>e({3088:new Int32Array([t,r,i,s])}),stencilMask:(e,t)=>e({2968:t,36005:t}),stencilMaskSeparate:(e,t,r)=>e({[t===1028?2968:36005]:r}),stencilFunc:(e,t,r,i)=>e({2962:t,2967:r,2963:i,34816:t,36003:r,36004:i}),stencilFuncSeparate:(e,t,r,i,s)=>e({[t===1028?2962:34816]:r,[t===1028?2967:36003]:i,[t===1028?2963:36004]:s}),stencilOp:(e,t,r,i)=>e({2964:t,2965:r,2966:i,34817:t,34818:r,34819:i}),stencilOpSeparate:(e,t,r,i,s)=>e({[t===1028?2964:34817]:r,[t===1028?2965:34818]:i,[t===1028?2966:34819]:s}),viewport:(e,t,r,i,s)=>e({2978:[t,r,i,s]})},jf=(e,t)=>e.isEnabled(t),lR={3042:jf,2884:jf,2929:jf,3024:jf,32823:jf,32926:jf,32928:jf,3089:jf,2960:jf,35977:jf};function cR(e){for(let t in e)return!1;return!0}function kV(e,t){if(e===t)return!0;let r=Array.isArray(e)||ArrayBuffer.isView(e),i=Array.isArray(t)||ArrayBuffer.isView(t);if(r&&i&&e.length===t.length){for(let s=0;s{}}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.program=null,this.stateStack=[],this.enable=!0,this.cache=r?wy(t):Object.assign({},hb),this.log=i,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.stateStack.push({})}pop(){Ks(this.stateStack.length>0);let t=this.stateStack[this.stateStack.length-1];Ml(this.gl,t),this.stateStack.pop()}_updateCache(t){let r=!1,i,s=this.stateStack.length>0&&this.stateStack[this.stateStack.length-1];for(let n in t){Ks(n!==void 0);let o=t[n],c=this.cache[n];kV(o,c)||(r=!0,i=c,s&&!(n in s)&&(s[n]=c),this.cache[n]=o)}return{valueChanged:r,oldValue:i}}};function lE(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{enable:r=!0,copyState:i}=t;if(Ks(i!==void 0),!e.state){let{polyfillContext:s}=globalThis;s&&s(e),e.state=new uR(e,{copyState:i}),Nnt(e);for(let n in aR){let o=aR[n];znt(e,n,o)}RV(e,\"getParameter\"),RV(e,\"isEnabled\")}return e.state.enable=r,e}function hR(e){e.state||lE(e,{copyState:!1}),e.state.push()}function cE(e){Ks(e.state),e.state.pop()}function Ml(e,t){if(Ks(Jd(e),\"setParameters requires a WebGL context\"),cR(t))return;let r={};for(let s in t){let n=Number(s),o=CV[s];o&&(typeof o==\"string\"?r[o]=!0:o(e,t[s],n))}let i=e.state&&e.state.cache;if(i)for(let s in r){let n=LV[s];n(e,t,i)}}function wy(e,t){if(t=t||hb,typeof t==\"number\"){let s=t,n=lR[s];return n?n(e,s):e.getParameter(s)}let r=Array.isArray(t)?t:Object.keys(t),i={};for(let s of r){let n=lR[s];i[s]=n?n(e,Number(s)):e.getParameter(Number(s))}return i}function uE(e){Ml(e,hb)}function Mn(e,t,r){if(cR(t))return r(e);let{nocatch:i=!0}=t;hR(e),Ml(e,t);let s;if(i)s=r(e),cE(e);else try{s=r(e)}finally{cE(e)}return s}function El(e){let{luma:t}=e;if(e.canvas&&t){let r=t.canvasSizeInfo,i=\"clientWidth\"in r?r.clientWidth:e.canvas.clientWidth;return i?e.drawingBufferWidth/i:1}return 1}function Sy(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=El(e),s=e.drawingBufferWidth,n=e.drawingBufferHeight;return Unt(t,i,s,n,r)}function BV(e){let t=typeof window>\"u\"?1:window.devicePixelRatio||1;return Number.isFinite(e)?e<=0?1:e:e?t:1}function Unt(e,t,r,i,s){let n=DV(e[0],t,r),o=OV(e[1],t,i,s),c=DV(e[0]+1,t,r),f=c===r-1?c:c-1;c=OV(e[1]+1,t,i,s);let _;return s?(c=c===0?c:c+1,_=o,o=c):_=c===i-1?c:c-1,{x:n,y:o,width:Math.max(f-n+1,1),height:Math.max(_-o+1,1)}}function DV(e,t,r){return Math.min(Math.round(e*t),r-1)}function OV(e,t,r,i){return i?Math.max(0,r-1-Math.round(e*t)):Math.min(Math.round(e*t),r-1)}var fR=Lo(),Vnt=fR&&typeof document<\"u\",FV={webgl2:!0,webgl1:!0,throwOnError:!0,manageState:!0,canvas:null,debug:!1,width:800,height:600};function Ty(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ks(fR,`createGLContext only available in the browser.\nCreate your own headless context or use 'createHeadlessContext' from @luma.gl/test-utils`),e=Object.assign({},FV,e);let{width:t,height:r}=e;function i(c){if(e.throwOnError)throw new Error(c);return console.error(c),null}e.onError=i;let s,{canvas:n}=e,o=Gnt({canvas:n,width:t,height:r,onError:i});return s=jnt(o,e),s?(s=q0(s,e),Wnt(s),s):null}function q0(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||e._instrumented)return e;e._version=e._version||Hnt(e),e.luma=e.luma||{},e.luma.canvasSizeInfo=e.luma.canvasSizeInfo||{},t=Object.assign({},FV,t);let{manageState:r,debug:i}=t;return r&&lE(e,{copyState:!1,log:function(){for(var s=arguments.length,n=new Array(s),o=0;o1&&arguments[1]!==void 0?arguments[1]:{};if(e.canvas){let i=BV(t.useDevicePixels);qnt(e,i,t);return}let r=e.getExtension(\"STACKGL_resize_drawingbuffer\");r&&\"width\"in t&&\"height\"in t&&r.resize(t.width,t.height)}function jnt(e,t){let{onError:r}=t,i=null,s=f=>i=f.statusMessage||i;e.addEventListener(\"webglcontextcreationerror\",s,!1);let{webgl1:n=!0,webgl2:o=!0}=t,c=null;return o&&(c=c||e.getContext(\"webgl2\",t),c=c||e.getContext(\"experimental-webgl2\",t)),n&&(c=c||e.getContext(\"webgl\",t),c=c||e.getContext(\"experimental-webgl\",t)),e.removeEventListener(\"webglcontextcreationerror\",s,!1),c?(t.onContextLost&&e.addEventListener(\"webglcontextlost\",t.onContextLost,!1),t.onContextRestored&&e.addEventListener(\"webglcontextrestored\",t.onContextRestored,!1),c):r(\"Failed to create \".concat(o&&!n?\"WebGL2\":\"WebGL\",\" context: \").concat(i||\"Unknown error\"))}function Gnt(e){let{canvas:t,width:r=800,height:i=600,onError:s}=e,n;return typeof t==\"string\"?(Vnt&&document.readyState===\"complete\"||s(\"createGLContext called on canvas '\".concat(t,\"' before page was loaded\")),n=document.getElementById(t)):t?n=t:(n=document.createElement(\"canvas\"),n.id=\"lumagl-canvas\",n.style.width=Number.isFinite(r)?\"\".concat(r,\"px\"):\"100%\",n.style.height=Number.isFinite(i)?\"\".concat(i,\"px\"):\"100%\",document.body.insertBefore(n,document.body.firstChild)),n}function Wnt(e){let t=fr(e)?\"WebGL2\":\"WebGL1\",r=zV(e),i=r?\"(\".concat(r.vendor,\",\").concat(r.renderer,\")\"):\"\",s=e.debug?\" debug\":\"\";He.info(1,\"\".concat(t).concat(s,\" context \").concat(i))()}function Hnt(e){return typeof WebGL2RenderingContext<\"u\"&&e instanceof WebGL2RenderingContext?2:1}function qnt(e,t,r){let i=\"width\"in r?r.width:e.canvas.clientWidth,s=\"height\"in r?r.height:e.canvas.clientHeight;(!i||!s)&&(He.log(1,\"Canvas clientWidth/clientHeight is 0\")(),t=1,i=e.canvas.width||1,s=e.canvas.height||1),e.luma=e.luma||{},e.luma.canvasSizeInfo=e.luma.canvasSizeInfo||{};let n=e.luma.canvasSizeInfo;if(n.clientWidth!==i||n.clientHeight!==s||n.devicePixelRatio!==t){let o=t,c=Math.floor(i*o),f=Math.floor(s*o);e.canvas.width=c,e.canvas.height=f,(e.drawingBufferWidth!==c||e.drawingBufferHeight!==f)&&(He.warn(\"Device pixel ratio clamped\")(),o=Math.min(e.drawingBufferWidth/i,e.drawingBufferHeight/s),e.canvas.width=Math.floor(i*o),e.canvas.height=Math.floor(s*o)),Object.assign(e.luma.canvasSizeInfo,{clientWidth:i,clientHeight:s,devicePixelRatio:t})}}function fb(){let e;if(typeof window<\"u\"&&window.performance)e=window.performance.now();else if(typeof process<\"u\"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Z0=class{constructor(t,r){G(this,\"name\",void 0),G(this,\"type\",void 0),G(this,\"sampleSize\",1),G(this,\"time\",void 0),G(this,\"count\",void 0),G(this,\"samples\",void 0),G(this,\"lastTiming\",void 0),G(this,\"lastSampleTime\",void 0),G(this,\"lastSampleCount\",void 0),G(this,\"_count\",0),G(this,\"_time\",0),G(this,\"_samples\",0),G(this,\"_startTime\",0),G(this,\"_timerPending\",!1),this.name=t,this.type=r,this.reset()}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=fb(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(fb()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var Gf=class{constructor(t){G(this,\"id\",void 0),G(this,\"stats\",{}),this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:\"count\";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t in this.stats)this.stats[t].reset();return this}forEach(t){for(let r in this.stats)t(this.stats[r])}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){if(!t||!t.name)return null;let{name:r,type:i}=t;return this.stats[r]||(t instanceof Z0?this.stats[r]=t:this.stats[r]=new Z0(r,i)),this.stats[r]}};var db=\"8.5.21\",Znt=\"set luma.log.level=1 (or higher) to trace rendering\",pR=class{constructor(){this.stats=new Map}get(t){return this.stats.has(t)||this.stats.set(t,new Gf({id:t})),this.stats.get(t)}},Du=new pR;if(globalThis.luma&&globalThis.luma.VERSION!==db)throw new Error(\"luma.gl - multiple VERSIONs detected: \".concat(globalThis.luma.VERSION,\" vs \").concat(db));globalThis.luma||(Lo()&&He.log(1,\"luma.gl \".concat(db,\" - \").concat(Znt))(),globalThis.luma=globalThis.luma||{VERSION:db,version:db,log:He,stats:Du,globals:{modules:{},nodeIO:{}}});var _3t=globalThis.luma;function AR(e){return typeof window<\"u\"&&window.requestAnimationFrame?window.requestAnimationFrame(e):setTimeout(e,1e3/60)}function mR(e){return typeof window<\"u\"&&window.cancelAnimationFrame?window.cancelAnimationFrame(e):clearTimeout(e)}function ye(e,t){if(!e)throw new Error(t||\"luma.gl: assertion failed.\")}function hE(e,t){if(typeof t!=\"string\")return t;let r=Number(t);if(!isNaN(r))return r;t=t.replace(/^.*\\./,\"\");let i=e[t];return ye(i!==void 0,\"Accessing undefined constant GL.\".concat(t)),i}function Ou(e,t){t=Number(t);for(let r in e)if(e[r]===t)return\"GL.\".concat(r);return String(t)}var gR={};function ta(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:\"id\";gR[e]=gR[e]||1;let t=gR[e]++;return\"\".concat(e,\"-\").concat(t)}function _R(e){return ye(typeof e==\"number\",\"Input must be a number\"),e&&(e&e-1)===0}function Wf(e){let t=!0;for(let r in e){t=!1;break}return t}function fE(e,t,r,i){let s=\"See luma.gl \".concat(r,\" Upgrade Guide at https://luma.gl/docs/upgrade-guide\"),n=Object.getPrototypeOf(e);i.forEach(o=>{n.methodName||(n[o]=()=>{throw He.removed(\"Calling removed method \".concat(t,\".\").concat(o,\": \"),s)(),new Error(o)})})}var My=\"Resource subclass must define virtual methods\",Js=class{get[Symbol.toStringTag](){return\"Resource\"}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};tp(t);let{id:i,userData:s={}}=r;this.gl=t,this.gl2=t,this.id=i||ta(this[Symbol.toStringTag]),this.userData=s,this._bound=!1,this._handle=r.handle,this._handle===void 0&&(this._handle=this._createHandle()),this.byteLength=0,this._addStats()}toString(){return\"\".concat(this[Symbol.toStringTag]||this.constructor.name,\"(\").concat(this.id,\")\")}get handle(){return this._handle}delete(){let{deleteChildren:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=this._handle&&this._deleteHandle(this._handle);return this._handle&&this._removeStats(),this._handle=null,r&&t&&r.filter(Boolean).forEach(i=>i.delete()),this}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.handle;if(typeof t!=\"function\")return this._bindHandle(t),this;let r;return this._bound?r=t():(this._bindHandle(this.handle),this._bound=!0,r=t(),this._bound=!1,this._bindHandle(null)),r}unbind(){this.bind(null)}getParameter(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};t=hE(this.gl,t),ye(t);let s=(this.constructor.PARAMETERS||{})[t];if(s){let n=fr(this.gl);if(!((!(\"webgl2\"in s)||n)&&(!(\"extension\"in s)||this.gl.getExtension(s.extension)))){let c=s.webgl1,f=\"webgl2\"in s?s.webgl2:s.webgl1;return n?f:c}}return this._getParameter(t,r)}getParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{parameters:r,keys:i}=t,s=this.constructor.PARAMETERS||{},n=fr(this.gl),o={},c=r||Object.keys(s);for(let f of c){let _=s[f];if(_&&(!(\"webgl2\"in _)||n)&&(!(\"extension\"in _)||this.gl.getExtension(_.extension))){let I=i?Ou(this.gl,f):f;o[I]=this.getParameter(f,t),i&&_.type===\"GLenum\"&&(o[I]=Ou(this.gl,o[I]))}}return o}setParameter(t,r){t=hE(this.gl,t),ye(t);let s=(this.constructor.PARAMETERS||{})[t];if(s){let n=fr(this.gl);if(!((!(\"webgl2\"in s)||n)&&(!(\"extension\"in s)||this.gl.getExtension(s.extension))))throw new Error(\"Parameter not available on this platform\");s.type===\"GLenum\"&&(r=hE(r))}return this._setParameter(t,r),this}setParameters(t){for(let r in t)this.setParameter(r,t[r]);return this}stubRemovedMethods(t,r,i){return fE(this,t,r,i)}initialize(t){}_createHandle(){throw new Error(My)}_deleteHandle(){throw new Error(My)}_bindHandle(t){throw new Error(My)}_getOptsFromHandle(){throw new Error(My)}_getParameter(t,r){throw new Error(My)}_setParameter(t,r){throw new Error(My)}_context(){return this.gl.luma=this.gl.luma||{},this.gl.luma}_addStats(){let t=this[Symbol.toStringTag],r=Du.get(\"Resource Counts\");r.get(\"Resources Created\").incrementCount(),r.get(\"\".concat(t,\"s Created\")).incrementCount(),r.get(\"\".concat(t,\"s Active\")).incrementCount()}_removeStats(){let t=this[Symbol.toStringTag];Du.get(\"Resource Counts\").get(\"\".concat(t,\"s Active\")).decrementCount()}_trackAllocatedMemory(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag];this._trackAllocatedMemoryForContext(t,r),this._trackAllocatedMemoryForContext(t,r,this.gl.canvas&&this.gl.canvas.id),this.byteLength=t}_trackAllocatedMemoryForContext(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:\"\",s=Du.get(\"Memory Usage\".concat(i));s.get(\"GPU Memory\").addCount(t),s.get(\"\".concat(r,\" Memory\")).addCount(t)}_trackDeallocatedMemory(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag];this._trackDeallocatedMemoryForContext(t),this._trackDeallocatedMemoryForContext(t,this.gl.canvas&&this.gl.canvas.id),this.byteLength=0}_trackDeallocatedMemoryForContext(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:\"\",i=Du.get(\"Memory Usage\".concat(r));i.get(\"GPU Memory\").subtractCount(this.byteLength),i.get(\"\".concat(t,\" Memory\")).subtractCount(this.byteLength)}};var Ynt=\"Failed to deduce GL constant from typed array\";function pb(e){switch(ArrayBuffer.isView(e)?e.constructor:e){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(Ynt)}}function HA(e){let{clamped:t=!0}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};switch(e){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return t?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error(\"Failed to deduce typed array type from GL constant\")}}function NV(e){let{data:t,width:r,height:i,bytesPerPixel:s=4,temp:n}=e,o=r*s;n=n||new Uint8Array(o);for(let c=0;cthis._assign(s)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return e.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return e.getBytesPerVertex(this)}_assign(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t=Ab(\"Accessor\",t,$nt),t.type!==void 0&&(this.type=t.type,(t.type===5124||t.type===5125)&&(this.integer=!0)),t.size!==void 0&&(this.size=t.size),t.offset!==void 0&&(this.offset=t.offset),t.stride!==void 0&&(this.stride=t.stride),t.normalized!==void 0&&(this.normalized=t.normalized),t.integer!==void 0&&(this.integer=t.integer),t.divisor!==void 0&&(this.divisor=t.divisor),t.buffer!==void 0&&(this.buffer=t.buffer),t.index!==void 0&&(typeof t.index==\"boolean\"?this.index=t.index?1:0:this.index=t.index),t.instanced!==void 0&&(this.divisor=t.instanced?1:0),t.isInstanced!==void 0&&(this.divisor=t.isInstanced?1:0),this}};var VV=10,jV={offset:\"accessor.offset\",stride:\"accessor.stride\",type:\"accessor.type\",size:\"accessor.size\",divisor:\"accessor.divisor\",normalized:\"accessor.normalized\",integer:\"accessor.integer\",instanced:\"accessor.divisor\",isInstanced:\"accessor.divisor\"},Xnt={removedProps:{},replacedProps:{bytes:\"byteLength\"},deprecatedProps:jV},Knt={removedProps:jV},Fr=class extends Js{get[Symbol.toStringTag](){return\"Buffer\"}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.stubRemovedMethods(\"Buffer\",\"v6.0\",[\"layout\",\"setLayout\",\"getIndexedParameter\"]),this.target=r.target||(this.gl.webgl2?36662:34962),this.initialize(r),Object.seal(this)}getElementCount(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.accessor;return Math.round(this.byteLength/Pl.getBytesPerElement(t))}getVertexCount(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.accessor;return Math.round(this.byteLength/Pl.getBytesPerVertex(t))}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ArrayBuffer.isView(t)&&(t={data:t}),Number.isFinite(t)&&(t={byteLength:t}),t=Ab(\"Buffer\",t,Xnt),this.usage=t.usage||35044,this.debugData=null,this.setAccessor(Object.assign({},t,t.accessor)),t.data?this._setData(t.data,t.offset,t.byteLength):this._setByteLength(t.byteLength||0),this}setProps(t){return t=Ab(\"Buffer\",t,Knt),\"accessor\"in t&&this.setAccessor(t.accessor),this}setAccessor(t){return t=Object.assign({},t),delete t.buffer,this.accessor=new Pl(t),this}reallocate(t){return t>this.byteLength?(this._setByteLength(t),!0):(this.bytesUsed=t,!1)}setData(t){return this.initialize(t)}subData(t){ArrayBuffer.isView(t)&&(t={data:t});let{data:r,offset:i=0,srcOffset:s=0}=t,n=t.byteLength||t.length;ye(r);let o=this.gl.webgl2?36663:this.target;return this.gl.bindBuffer(o,this.handle),s!==0||n!==void 0?(Yn(this.gl),this.gl.bufferSubData(this.target,i,r,s,n)):this.gl.bufferSubData(o,i,r),this.gl.bindBuffer(o,null),this.debugData=null,this._inferType(r),this}copyData(t){let{sourceBuffer:r,readOffset:i=0,writeOffset:s=0,size:n}=t,{gl:o}=this;return Yn(o),o.bindBuffer(36662,r.handle),o.bindBuffer(36663,this.handle),o.copyBufferSubData(36662,36663,i,s,n),o.bindBuffer(36662,null),o.bindBuffer(36663,null),this.debugData=null,this}getData(){let{dstData:t=null,srcByteOffset:r=0,dstOffset:i=0,length:s=0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Yn(this.gl);let n=HA(this.accessor.type||5126,{clamped:!1}),o=this._getAvailableElementCount(r),c=i,f,_;t?(_=t.length,f=_-c):(f=Math.min(o,s||o),_=c+f);let w=Math.min(o,f);return s=s||w,ye(s<=w),t=t||new n(_),this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,r,t,i,s),this.gl.bindBuffer(36662,null),t}bind(){let{target:t=this.target,index:r=this.accessor&&this.accessor.index,offset:i=0,size:s}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t===35345||t===35982?s!==void 0?this.gl.bindBufferRange(t,r,this.handle,i,s):(ye(i===0),this.gl.bindBufferBase(t,r,this.handle)):this.gl.bindBuffer(t,this.handle),this}unbind(){let{target:t=this.target,index:r=this.accessor&&this.accessor.index}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t===35345||t===35982?this.gl.bindBufferBase(t,r,null):this.gl.bindBuffer(t,null),this}getDebugData(){return this.debugData?{data:this.debugData,changed:!1}:(this.debugData=this.getData({length:Math.min(VV,this.byteLength)}),{data:this.debugData,changed:!0})}invalidateDebugData(){this.debugData=null}_setData(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.byteLength+r;ye(ArrayBuffer.isView(t)),this._trackDeallocatedMemory();let s=this._getTarget();this.gl.bindBuffer(s,this.handle),this.gl.bufferData(s,i,this.usage),this.gl.bufferSubData(s,r,t),this.gl.bindBuffer(s,null),this.debugData=t.slice(0,VV),this.bytesUsed=i,this._trackAllocatedMemory(i);let n=pb(t);return ye(n),this.setAccessor(new Pl(this.accessor,{type:n})),this}_setByteLength(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.usage;ye(t>=0),this._trackDeallocatedMemory();let i=t;t===0&&(i=new Float32Array(0));let s=this._getTarget();return this.gl.bindBuffer(s,this.handle),this.gl.bufferData(s,i,r),this.gl.bindBuffer(s,null),this.usage=r,this.debugData=null,this.bytesUsed=t,this._trackAllocatedMemory(t),this}_getTarget(){return this.gl.webgl2?36663:this.target}_getAvailableElementCount(t){let r=HA(this.accessor.type||5126,{clamped:!1}),i=t/r.BYTES_PER_ELEMENT;return this.getElementCount()-i}_inferType(t){this.accessor.type||this.setAccessor(new Pl(this.accessor,{type:pb(t)}))}_createHandle(){return this.gl.createBuffer()}_deleteHandle(){this.gl.deleteBuffer(this.handle),this._trackDeallocatedMemory()}_getParameter(t){this.gl.bindBuffer(this.target,this.handle);let r=this.gl.getBufferParameter(this.target,t);return this.gl.bindBuffer(this.target,null),r}get type(){return He.deprecated(\"Buffer.type\",\"Buffer.accessor.type\")(),this.accessor.type}get bytes(){return He.deprecated(\"Buffer.bytes\",\"Buffer.byteLength\")(),this.byteLength}setByteLength(t){return He.deprecated(\"setByteLength\",\"reallocate\")(),this.reallocate(t)}updateAccessor(t){return He.deprecated(\"updateAccessor(...)\",\"setAccessor(new Accessor(buffer.accessor, ...)\")(),this.accessor=new Pl(this.accessor,t),this}};var dE={6407:{dataFormat:6407,types:[5121,33635]},6408:{dataFormat:6408,types:[5121,32819,32820]},6406:{dataFormat:6406,types:[5121]},6409:{dataFormat:6409,types:[5121]},6410:{dataFormat:6410,types:[5121]},33326:{dataFormat:6403,types:[5126],gl2:!0},33328:{dataFormat:33319,types:[5126],gl2:!0},34837:{dataFormat:6407,types:[5126],gl2:!0},34836:{dataFormat:6408,types:[5126],gl2:!0}},pE={6403:1,36244:1,33319:2,33320:2,6407:3,36248:3,6408:4,36249:4,6402:1,34041:1,6406:1,6409:1,6410:2},AE={5126:4,5125:4,5124:4,5123:2,5122:2,5131:2,5120:1,5121:1};function GV(e,t){let r=dE[t];if(!r)return!1;if(r.gl1===void 0&&r.gl2===void 0)return!0;let i=fr(e)&&r.gl2||r.gl1;return typeof i==\"string\"?e.getExtension(i):i}function WV(e,t){let r=dE[t];switch(r&&r.types[0]){case 5126:return e.getExtension(\"OES_texture_float_linear\");case 5131:return e.getExtension(\"OES_texture_half_float_linear\");default:return!0}}var Jnt=[9729,9728],HV=globalThis.WebGLBuffer||function(){},tl=class extends Js{get[Symbol.toStringTag](){return\"Texture\"}static isSupported(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{format:i,linearFiltering:s}=r,n=!0;return i&&(n=n&&GV(t,i),n=n&&(!s||WV(t,i))),n}constructor(t,r){let{id:i=ta(\"texture\"),handle:s,target:n}=r;super(t,{id:i,handle:s}),this.target=n,this.textureUnit=void 0,this.loaded=!1,this.width=void 0,this.height=void 0,this.depth=void 0,this.format=void 0,this.type=void 0,this.dataFormat=void 0,this.border=void 0,this.textureUnit=void 0,this.mipmaps=void 0}toString(){return\"Texture(\".concat(this.id,\",\").concat(this.width,\"x\").concat(this.height,\")\")}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.data;if(r instanceof Promise)return r.then(K=>this.initialize(Object.assign({},t,{pixels:K,data:K}))),this;let i=typeof HTMLVideoElement<\"u\"&&r instanceof HTMLVideoElement;if(i&&r.readyStatethis.initialize(t)),this;let{pixels:s=null,format:n=6408,border:o=0,recreate:c=!1,parameters:f={},pixelStore:_={},textureUnit:w=void 0}=t;r||(r=s);let{width:I,height:R,dataFormat:N,type:j,compressed:Q=!1,mipmaps:et=!0}=t,{depth:Y=0}=t;return{width:I,height:R,compressed:Q,dataFormat:N,type:j}=this._deduceParameters({format:n,type:j,dataFormat:N,compressed:Q,data:r,width:I,height:R}),this.width=I,this.height=R,this.depth=Y,this.format=n,this.type=j,this.dataFormat=N,this.border=o,this.textureUnit=w,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),et&&this._isNPOT()&&(He.warn(\"texture: \".concat(this,\" is Non-Power-Of-Two, disabling mipmaping\"))(),et=!1,this._updateForNPOT(f)),this.mipmaps=et,this.setImageData({data:r,width:I,height:R,depth:Y,format:n,type:j,dataFormat:N,border:o,mipmaps:et,parameters:_,compressed:Q}),et&&this.generateMipmap(),this.setParameters(f),c&&(this.data=r),i&&(this._video={video:r,parameters:f,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}update(){if(this._video){let{video:t,parameters:r,lastTime:i}=this._video;if(i===t.currentTime||t.readyState0&&arguments[0]!==void 0?arguments[0]:{};return this._isNPOT()?(He.warn(\"texture: \".concat(this,\" is Non-Power-Of-Two, disabling mipmaping\"))(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),Mn(this.gl,t,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this)}setImageData(t){this._trackDeallocatedMemory(\"Texture\");let{target:r=this.target,pixels:i=null,level:s=0,format:n=this.format,border:o=this.border,offset:c=0,parameters:f={}}=t,{data:_=null,type:w=this.type,width:I=this.width,height:R=this.height,dataFormat:N=this.dataFormat,compressed:j=!1}=t;_||(_=i),{type:w,dataFormat:N,compressed:j,width:I,height:R}=this._deduceParameters({format:n,type:w,dataFormat:N,compressed:j,data:_,width:I,height:R});let{gl:Q}=this;Q.bindTexture(this.target,this.handle);let et=null;({data:_,dataType:et}=this._getDataType({data:_,compressed:j}));let Y,K=0;if(Mn(this.gl,f,()=>{switch(et){case\"null\":Q.texImage2D(r,s,n,I,R,o,N,w,_);break;case\"typed-array\":Q.texImage2D(r,s,n,I,R,o,N,w,_,c);break;case\"buffer\":Y=Yn(Q),Y.bindBuffer(35052,_.handle||_),Y.texImage2D(r,s,n,I,R,o,N,w,c),Y.bindBuffer(35052,null);break;case\"browser-object\":fr(Q)?Q.texImage2D(r,s,n,I,R,o,N,w,_):Q.texImage2D(r,s,n,N,w,_);break;case\"compressed\":for(let[J,ut]of _.entries())Q.compressedTexImage2D(r,J,ut.format,ut.width,ut.height,o,ut.data),K+=ut.levelSize;break;default:ye(!1,\"Unknown image data type\")}}),et===\"compressed\")this._trackAllocatedMemory(K,\"Texture\");else if(_&&_.byteLength)this._trackAllocatedMemory(_.byteLength,\"Texture\");else{let J=pE[this.dataFormat]||4,ut=AE[this.type]||1;this._trackAllocatedMemory(this.width*this.height*J*ut,\"Texture\")}return this.loaded=!0,this}setSubImageData(t){let{target:r=this.target,pixels:i=null,data:s=null,x:n=0,y:o=0,width:c=this.width,height:f=this.height,level:_=0,format:w=this.format,type:I=this.type,dataFormat:R=this.dataFormat,compressed:N=!1,offset:j=0,border:Q=this.border,parameters:et={}}=t;if({type:I,dataFormat:R,compressed:N,width:c,height:f}=this._deduceParameters({format:w,type:I,dataFormat:R,compressed:N,data:s,width:c,height:f}),ye(this.depth===0,\"texSubImage not supported for 3D textures\"),s||(s=i),s&&s.data){let Y=s;s=Y.data,c=Y.shape[0],f=Y.shape[1]}s instanceof Fr&&(s=s.handle),this.gl.bindTexture(this.target,this.handle),Mn(this.gl,et,()=>{if(N)this.gl.compressedTexSubImage2D(r,_,n,o,c,f,w,s);else if(s===null)this.gl.texSubImage2D(r,_,n,o,c,f,R,I,null);else if(ArrayBuffer.isView(s))this.gl.texSubImage2D(r,_,n,o,c,f,R,I,s,j);else if(s instanceof HV){let Y=Yn(this.gl);Y.bindBuffer(35052,s),Y.texSubImage2D(r,_,n,o,c,f,R,I,j),Y.bindBuffer(35052,null)}else fr(this.gl)?Yn(this.gl).texSubImage2D(r,_,n,o,c,f,R,I,s):this.gl.texSubImage2D(r,_,n,o,R,I,s)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.error(\"Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})\")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.target,this.handle),t}unbind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.target,null),t}_getDataType(t){let{data:r,compressed:i=!1}=t;return i?{data:r,dataType:\"compressed\"}:r===null?{data:r,dataType:\"null\"}:ArrayBuffer.isView(r)?{data:r,dataType:\"typed-array\"}:r instanceof Fr?{data:r.handle,dataType:\"buffer\"}:r instanceof HV?{data:r,dataType:\"buffer\"}:{data:r,dataType:\"browser-object\"}}_deduceParameters(t){let{format:r,data:i}=t,{width:s,height:n,dataFormat:o,type:c,compressed:f}=t,_=dE[r];return o=o||_&&_.dataFormat,c=c||_&&_.types[0],f=f||_&&_.compressed,{width:s,height:n}=this._deduceImageSize(i,s,n),{dataFormat:o,type:c,compressed:f,width:s,height:n,format:r,data:i}}_deduceImageSize(t,r,i){let s;return typeof ImageData<\"u\"&&t instanceof ImageData?s={width:t.width,height:t.height}:typeof HTMLImageElement<\"u\"&&t instanceof HTMLImageElement?s={width:t.naturalWidth,height:t.naturalHeight}:typeof HTMLCanvasElement<\"u\"&&t instanceof HTMLCanvasElement?s={width:t.width,height:t.height}:typeof ImageBitmap<\"u\"&&t instanceof ImageBitmap?s={width:t.width,height:t.height}:typeof HTMLVideoElement<\"u\"&&t instanceof HTMLVideoElement?s={width:t.videoWidth,height:t.videoHeight}:t?s={width:r,height:i}:s={width:r>=0?r:1,height:i>=0?i:1},ye(s,\"Could not deduced texture size\"),ye(r===void 0||s.width===r,\"Deduced texture width does not match supplied width\"),ye(i===void 0||s.height===i,\"Deduced texture height does not match supplied height\"),s}_createHandle(){return this.gl.createTexture()}_deleteHandle(){this.gl.deleteTexture(this.handle),this._trackDeallocatedMemory(\"Texture\")}_getParameter(t){switch(t){case 4096:return this.width;case 4097:return this.height;default:this.gl.bindTexture(this.target,this.handle);let r=this.gl.getTexParameter(this.target,t);return this.gl.bindTexture(this.target,null),r}}_setParameter(t,r){switch(this.gl.bindTexture(this.target,this.handle),r=this._getNPOTParam(t,r),t){case 33082:case 33083:this.gl.texParameterf(this.handle,t,r);break;case 4096:case 4097:ye(!1);break;default:this.gl.texParameteri(this.target,t,r);break}return this.gl.bindTexture(this.target,null),this}_isNPOT(){return fr(this.gl)||!this.width||!this.height?!1:!_R(this.width)||!_R(this.height)}_updateForNPOT(t){t[this.gl.TEXTURE_MIN_FILTER]===void 0&&(t[this.gl.TEXTURE_MIN_FILTER]=this.gl.LINEAR),t[this.gl.TEXTURE_WRAP_S]===void 0&&(t[this.gl.TEXTURE_WRAP_S]=this.gl.CLAMP_TO_EDGE),t[this.gl.TEXTURE_WRAP_T]===void 0&&(t[this.gl.TEXTURE_WRAP_T]=this.gl.CLAMP_TO_EDGE)}_getNPOTParam(t,r){if(this._isNPOT())switch(t){case 10241:Jnt.indexOf(r)===-1&&(r=9729);break;case 10242:case 10243:r!==33071&&(r=33071);break;default:break}return r}};var tst=\"\";function qV(e,t){return ye(typeof e==\"string\"),e=tst+e,new Promise((r,i)=>{try{let s=new Image;s.onload=()=>r(s),s.onerror=()=>i(new Error(\"Could not load image \".concat(e,\".\"))),s.crossOrigin=t&&t.crossOrigin||\"anonymous\",s.src=e}catch(s){i(s)}})}var pi=class extends tl{get[Symbol.toStringTag](){return\"Texture2D\"}static isSupported(t,r){return tl.isSupported(t,r)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};tp(t),(r instanceof Promise||typeof r==\"string\")&&(r={data:r}),typeof r.data==\"string\"&&(r=Object.assign({},r,{data:qV(r.data)})),super(t,Object.assign({},r,{target:3553})),this.initialize(r),Object.seal(this)}};var yR=[34069,34070,34071,34072,34073,34074],Y0=class extends tl{get[Symbol.toStringTag](){return\"TextureCube\"}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};tp(t),super(t,Object.assign({},r,{target:34067})),this.initialize(r),Object.seal(this)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{mipmaps:r=!0,parameters:i={}}=t;return this.opts=t,this.setCubeMapImageData(t).then(()=>{this.loaded=!0,r&&this.generateMipmap(t),this.setParameters(i)}),this}subImage(t){let{face:r,data:i,x:s=0,y:n=0,mipmapLevel:o=0}=t;return this._subImage({target:r,data:i,x:s,y:n,mipmapLevel:o})}async setCubeMapImageData(t){let{width:r,height:i,pixels:s,data:n,border:o=0,format:c=6408,type:f=5121}=t,{gl:_}=this,w=s||n,I=await Promise.all(yR.map(R=>{let N=w[R];return Promise.all(Array.isArray(N)?N:[N])}));this.bind(),yR.forEach((R,N)=>{I[N].length>1&&this.opts.mipmaps!==!1&&He.warn(\"\".concat(this.id,\" has mipmap and multiple LODs.\"))(),I[N].forEach((j,Q)=>{r&&i?_.texImage2D(R,Q,c,r,i,o,c,f,j):_.texImage2D(R,Q,c,c,f,j)})}),this.unbind()}setImageDataForFace(t){let{face:r,width:i,height:s,pixels:n,data:o,border:c=0,format:f=6408,type:_=5121}=t,{gl:w}=this,I=n||o;return this.bind(),I instanceof Promise?I.then(R=>this.setImageDataForFace(Object.assign({},t,{face:r,data:R,pixels:R}))):this.width||this.height?w.texImage2D(r,0,f,i,s,c,f,_,I):w.texImage2D(r,0,f,f,_,I),this}};Y0.FACES=yR;var Ey=class extends tl{get[Symbol.toStringTag](){return\"Texture3D\"}static isSupported(t){return fr(t)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Yn(t),r=Object.assign({depth:1},r,{target:32879,unpackFlipY:!1}),super(t,r),this.initialize(r),Object.seal(this)}setImageData(t){let{level:r=0,dataFormat:i=6408,width:s,height:n,depth:o=1,border:c=0,format:f,type:_=5121,offset:w=0,data:I,parameters:R={}}=t;if(this._trackDeallocatedMemory(\"Texture\"),this.gl.bindTexture(this.target,this.handle),Mn(this.gl,R,()=>{ArrayBuffer.isView(I)&&this.gl.texImage3D(this.target,r,i,s,n,o,c,f,_,I),I instanceof Fr&&(this.gl.bindBuffer(35052,I.handle),this.gl.texImage3D(this.target,r,i,s,n,o,c,f,_,w))}),I&&I.byteLength)this._trackAllocatedMemory(I.byteLength,\"Texture\");else{let N=pE[this.dataFormat]||4,j=AE[this.type]||1;this._trackAllocatedMemory(this.width*this.height*this.depth*N*j,\"Texture\")}return this.loaded=!0,this}};var Q0=\"EXT_color_buffer_float\",vR={33189:{bpp:2},33190:{gl2:!0,bpp:3},36012:{gl2:!0,bpp:4},36168:{bpp:1},34041:{bpp:4},35056:{gl2:!0,bpp:4},36013:{gl2:!0,bpp:5},32854:{bpp:2},36194:{bpp:2},32855:{bpp:2},33321:{gl2:!0,bpp:1},33330:{gl2:!0,bpp:1},33329:{gl2:!0,bpp:1},33332:{gl2:!0,bpp:2},33331:{gl2:!0,bpp:2},33334:{gl2:!0,bpp:4},33333:{gl2:!0,bpp:4},33323:{gl2:!0,bpp:2},33336:{gl2:!0,bpp:2},33335:{gl2:!0,bpp:2},33338:{gl2:!0,bpp:4},33337:{gl2:!0,bpp:4},33340:{gl2:!0,bpp:8},33339:{gl2:!0,bpp:8},32849:{gl2:!0,bpp:3},32856:{gl2:!0,bpp:4},32857:{gl2:!0,bpp:4},36220:{gl2:!0,bpp:4},36238:{gl2:!0,bpp:4},36975:{gl2:!0,bpp:4},36214:{gl2:!0,bpp:8},36232:{gl2:!0,bpp:8},36226:{gl2:!0,bpp:16},36208:{gl2:!0,bpp:16},33325:{gl2:Q0,bpp:2},33327:{gl2:Q0,bpp:4},34842:{gl2:Q0,bpp:8},33326:{gl2:Q0,bpp:4},33328:{gl2:Q0,bpp:8},34836:{gl2:Q0,bpp:16},35898:{gl2:Q0,bpp:4}};function est(e,t,r){let i=r[t];if(!i)return!1;let s=fr(e)&&i.gl2||i.gl1;return typeof s==\"string\"?e.getExtension(s):s}var el=class extends Js{get[Symbol.toStringTag](){return\"Renderbuffer\"}static isSupported(t){let{format:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{format:null};return!r||est(t,r,vR)}static getSamplesForFormat(t,r){let{format:i}=r;return t.getInternalformatParameter(36161,i,32937)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.initialize(r),Object.seal(this)}initialize(t){let{format:r,width:i=1,height:s=1,samples:n=0}=t;return ye(r,\"Needs format\"),this._trackDeallocatedMemory(),this.gl.bindRenderbuffer(36161,this.handle),n!==0&&fr(this.gl)?this.gl.renderbufferStorageMultisample(36161,n,r,i,s):this.gl.renderbufferStorage(36161,r,i,s),this.format=r,this.width=i,this.height=s,this.samples=n,this._trackAllocatedMemory(this.width*this.height*(this.samples||1)*vR[this.format].bpp),this}resize(t){let{width:r,height:i}=t;return r!==this.width||i!==this.height?this.initialize({width:r,height:i,format:this.format,samples:this.samples}):this}_createHandle(){return this.gl.createRenderbuffer()}_deleteHandle(){this.gl.deleteRenderbuffer(this.handle),this._trackDeallocatedMemory()}_bindHandle(t){this.gl.bindRenderbuffer(36161,t)}_syncHandle(t){this.format=this.getParameter(36164),this.width=this.getParameter(36162),this.height=this.getParameter(36163),this.samples=this.getParameter(36011)}_getParameter(t){return this.gl.bindRenderbuffer(36161,this.handle),this.gl.getRenderbufferParameter(36161,t)}};var rst=256,ist=1024,nst=16384,ZV=6144,YV=6145,QV=6146,$V=34041,XV=\"clear: bad arguments\";function Hf(e){let{framebuffer:t=null,color:r=null,depth:i=null,stencil:s=null}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n={};t&&(n.framebuffer=t);let o=0;r&&(o|=nst,r!==!0&&(n.clearColor=r)),i&&(o|=rst,i!==!0&&(n.clearDepth=i)),s&&(o|=ist,i!==!0&&(n.clearStencil=i)),ye(o!==0,XV),Mn(e,n,()=>{e.clear(o)})}function xR(e){let{framebuffer:t=null,buffer:r=ZV,drawBuffer:i=0,value:s=[0,0,0,0]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Yn(e),Mn(e,{framebuffer:t},()=>{switch(r){case ZV:switch(s.constructor){case Int32Array:e.clearBufferiv(r,i,s);break;case Uint32Array:e.clearBufferuiv(r,i,s);break;case Float32Array:default:e.clearBufferfv(r,i,s)}break;case YV:e.clearBufferfv(YV,0,[s]);break;case QV:e.clearBufferiv(QV,0,[s]);break;case $V:let[n,o]=s;e.clearBufferfi($V,0,n,o);break;default:ye(!1,XV)}})}function KV(e){switch(e){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return ye(!1),0}}function Dh(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{sourceX:r=0,sourceY:i=0,sourceFormat:s=6408}=t,{sourceAttachment:n=36064,target:o=null,sourceWidth:c,sourceHeight:f,sourceType:_}=t,{framebuffer:w,deleteFramebuffer:I}=JV(e);ye(w);let{gl:R,handle:N,attachments:j}=w;c=c||w.width,f=f||w.height,n===36064&&N===null&&(n=1028),ye(j[n]),_=_||j[n].type,o=sst(o,_,s,c,f),_=_||pb(o);let Q=R.bindFramebuffer(36160,N);return R.readPixels(r,i,c,f,s,_,o),R.bindFramebuffer(36160,Q||null),I&&w.delete(),o}function mE(e){let{sourceAttachment:t=36064,targetMaxHeight:r=Number.MAX_SAFE_INTEGER}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=Dh(e,{sourceAttachment:t}),{width:s,height:n}=e;for(;n>r;)({data:i,width:s,height:n}=UV({data:i,width:s,height:n}));NV({data:i,width:s,height:n});let o=document.createElement(\"canvas\");o.width=s,o.height=n;let c=o.getContext(\"2d\"),f=c.createImageData(s,n);return f.data.set(i),c.putImageData(f,0,0),o.toDataURL()}function gE(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{sourceX:i=0,sourceY:s=0,targetMipmaplevel:n=0,targetInternalFormat:o=6408}=r,{targetX:c,targetY:f,targetZ:_,width:w,height:I}=r,{framebuffer:R,deleteFramebuffer:N}=JV(e);ye(R);let{gl:j,handle:Q}=R,et=typeof c<\"u\"||typeof f<\"u\"||typeof _<\"u\";c=c||0,f=f||0,_=_||0;let Y=j.bindFramebuffer(36160,Q);ye(t);let K=null;if(t instanceof tl&&(K=t,w=Number.isFinite(w)?w:K.width,I=Number.isFinite(I)?I:K.height,K.bind(0),t=K.target),!et)j.copyTexImage2D(t,n,o,i,s,w,I,0);else switch(t){case 3553:case 34067:j.copyTexSubImage2D(t,n,c,f,i,s,w,I);break;case 35866:case 32879:Yn(j).copyTexSubImage3D(t,n,c,f,_,i,s,w,I);break;default:}return K&&K.unbind(),j.bindFramebuffer(36160,Y||null),N&&R.delete(),K}function JV(e){return e instanceof yi?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:tj(e),deleteFramebuffer:!0}}function sst(e,t,r,i,s){if(e)return e;t=t||5121;let n=HA(t,{clamped:!1}),o=KV(r);return new n(i*s*o)}var Ii={WEBGL2:\"WEBGL2\",VERTEX_ARRAY_OBJECT:\"VERTEX_ARRAY_OBJECT\",TIMER_QUERY:\"TIMER_QUERY\",INSTANCED_RENDERING:\"INSTANCED_RENDERING\",MULTIPLE_RENDER_TARGETS:\"MULTIPLE_RENDER_TARGETS\",ELEMENT_INDEX_UINT32:\"ELEMENT_INDEX_UINT32\",BLEND_EQUATION_MINMAX:\"BLEND_EQUATION_MINMAX\",FLOAT_BLEND:\"FLOAT_BLEND\",COLOR_ENCODING_SRGB:\"COLOR_ENCODING_SRGB\",TEXTURE_DEPTH:\"TEXTURE_DEPTH\",TEXTURE_FLOAT:\"TEXTURE_FLOAT\",TEXTURE_HALF_FLOAT:\"TEXTURE_HALF_FLOAT\",TEXTURE_FILTER_LINEAR_FLOAT:\"TEXTURE_FILTER_LINEAR_FLOAT\",TEXTURE_FILTER_LINEAR_HALF_FLOAT:\"TEXTURE_FILTER_LINEAR_HALF_FLOAT\",TEXTURE_FILTER_ANISOTROPIC:\"TEXTURE_FILTER_ANISOTROPIC\",COLOR_ATTACHMENT_RGBA32F:\"COLOR_ATTACHMENT_RGBA32F\",COLOR_ATTACHMENT_FLOAT:\"COLOR_ATTACHMENT_FLOAT\",COLOR_ATTACHMENT_HALF_FLOAT:\"COLOR_ATTACHMENT_HALF_FLOAT\",GLSL_FRAG_DATA:\"GLSL_FRAG_DATA\",GLSL_FRAG_DEPTH:\"GLSL_FRAG_DEPTH\",GLSL_DERIVATIVES:\"GLSL_DERIVATIVES\",GLSL_TEXTURE_LOD:\"GLSL_TEXTURE_LOD\"};function ost(e){let t=new pi(e,{format:6408,type:5126,dataFormat:6408}),r=new yi(e,{id:\"test-framebuffer\",check:!1,attachments:{36064:t}}),i=r.getStatus();return t.delete(),r.delete(),i===36053}var bR={[Ii.WEBGL2]:[!1,!0],[Ii.VERTEX_ARRAY_OBJECT]:[\"OES_vertex_array_object\",!0],[Ii.TIMER_QUERY]:[\"EXT_disjoint_timer_query\",\"EXT_disjoint_timer_query_webgl2\"],[Ii.INSTANCED_RENDERING]:[\"ANGLE_instanced_arrays\",!0],[Ii.MULTIPLE_RENDER_TARGETS]:[\"WEBGL_draw_buffers\",!0],[Ii.ELEMENT_INDEX_UINT32]:[\"OES_element_index_uint\",!0],[Ii.BLEND_EQUATION_MINMAX]:[\"EXT_blend_minmax\",!0],[Ii.FLOAT_BLEND]:[\"EXT_float_blend\"],[Ii.COLOR_ENCODING_SRGB]:[\"EXT_sRGB\",!0],[Ii.TEXTURE_DEPTH]:[\"WEBGL_depth_texture\",!0],[Ii.TEXTURE_FLOAT]:[\"OES_texture_float\",!0],[Ii.TEXTURE_HALF_FLOAT]:[\"OES_texture_half_float\",!0],[Ii.TEXTURE_FILTER_LINEAR_FLOAT]:[\"OES_texture_float_linear\"],[Ii.TEXTURE_FILTER_LINEAR_HALF_FLOAT]:[\"OES_texture_half_float_linear\"],[Ii.TEXTURE_FILTER_ANISOTROPIC]:[\"EXT_texture_filter_anisotropic\"],[Ii.COLOR_ATTACHMENT_RGBA32F]:[ost,\"EXT_color_buffer_float\"],[Ii.COLOR_ATTACHMENT_FLOAT]:[!1,\"EXT_color_buffer_float\"],[Ii.COLOR_ATTACHMENT_HALF_FLOAT]:[\"EXT_color_buffer_half_float\"],[Ii.GLSL_FRAG_DATA]:[\"WEBGL_draw_buffers\",!0],[Ii.GLSL_FRAG_DEPTH]:[\"EXT_frag_depth\",!0],[Ii.GLSL_DERIVATIVES]:[\"OES_standard_derivatives\",!0],[Ii.GLSL_TEXTURE_LOD]:[\"EXT_shader_texture_lod\",!0]};var ast=2;function $0(e,t){return Oh(e,t)}function Oh(e,t){return t=Array.isArray(t)?t:[t],t.every(r=>ej(e,r))}function _E(e){e.luma=e.luma||{},e.luma.caps=e.luma.caps||{};for(let t in bR)e.luma.caps[t]===void 0&&(e.luma.caps[t]=ej(e,t));return e.luma.caps}function ej(e,t){return e.luma=e.luma||{},e.luma.caps=e.luma.caps||{},e.luma.caps[t]===void 0&&(e.luma.caps[t]=lst(e,t)),e.luma.caps[t]||He.log(ast,\"Feature: \".concat(t,\" not supported\"))(),e.luma.caps[t]}function lst(e,t){let r=bR[t];ye(r,t);let i,s=fr(e)&&r[1]||r[0];if(typeof s==\"function\")i=s(e);else if(Array.isArray(s)){i=!0;for(let n of s)i=i&&!!e.getExtension(n)}else typeof s==\"string\"?i=!!e.getExtension(s):typeof s==\"boolean\"?i=s:ye(!1);return i}var rj=\"Multiple render targets not supported\",yi=class e extends Js{get[Symbol.toStringTag](){return\"Framebuffer\"}static isSupported(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{colorBufferFloat:i,colorBufferHalfFloat:s}=r,n=!0;return i&&(n=!!(t.getExtension(\"EXT_color_buffer_float\")||t.getExtension(\"WEBGL_color_buffer_float\")||t.getExtension(\"OES_texture_float\"))),s&&(n=n&&!!(t.getExtension(\"EXT_color_buffer_float\")||t.getExtension(\"EXT_color_buffer_half_float\"))),n}static getDefaultFramebuffer(t){return t.luma=t.luma||{},t.luma.defaultFramebuffer=t.luma.defaultFramebuffer||new e(t,{id:\"default-framebuffer\",handle:null,attachments:{}}),t.luma.defaultFramebuffer}get MAX_COLOR_ATTACHMENTS(){let t=Yn(this.gl);return t.getParameter(t.MAX_COLOR_ATTACHMENTS)}get MAX_DRAW_BUFFERS(){let t=Yn(this.gl);return t.getParameter(t.MAX_DRAW_BUFFERS)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.width=null,this.height=null,this.attachments={},this.readBuffer=36064,this.drawBuffers=[36064],this.ownResources=[],this.initialize(r),Object.seal(this)}get color(){return this.attachments[36064]||null}get texture(){return this.attachments[36064]||null}get depth(){return this.attachments[36096]||this.attachments[33306]||null}get stencil(){return this.attachments[36128]||this.attachments[33306]||null}initialize(t){let{width:r=1,height:i=1,attachments:s=null,color:n=!0,depth:o=!0,stencil:c=!1,check:f=!0,readBuffer:_=void 0,drawBuffers:w=void 0}=t;if(ye(r>=0&&i>=0,\"Width and height need to be integers\"),this.width=r,this.height=i,s)for(let I in s){let R=s[I];(Array.isArray(R)?R[0]:R).resize({width:r,height:i})}else s=this._createDefaultAttachments(n,o,c,r,i);this.update({clearAttachments:!0,attachments:s,readBuffer:_,drawBuffers:w}),s&&f&&this.checkStatus()}delete(){for(let t of this.ownResources)t.delete();return super.delete(),this}update(t){let{attachments:r={},readBuffer:i,drawBuffers:s,clearAttachments:n=!1,resizeAttachments:o=!0}=t;this.attach(r,{clearAttachments:n,resizeAttachments:o});let{gl:c}=this,f=c.bindFramebuffer(36160,this.handle);return i&&this._setReadBuffer(i),s&&this._setDrawBuffers(s),c.bindFramebuffer(36160,f||null),this}resize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{width:r,height:i}=t;if(this.handle===null)return ye(r===void 0&&i===void 0),this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;r===void 0&&(r=this.gl.drawingBufferWidth),i===void 0&&(i=this.gl.drawingBufferHeight),r!==this.width&&i!==this.height&&He.log(2,\"Resizing framebuffer \".concat(this.id,\" to \").concat(r,\"x\").concat(i))();for(let s in this.attachments)this.attachments[s].resize({width:r,height:i});return this.width=r,this.height=i,this}attach(t){let{clearAttachments:r=!1,resizeAttachments:i=!0}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s={};r&&Object.keys(this.attachments).forEach(o=>{s[o]=null}),Object.assign(s,t);let n=this.gl.bindFramebuffer(36160,this.handle);for(let o in s){ye(o!==void 0,\"Misspelled framebuffer binding point?\");let c=Number(o),f=s[c],_=f;if(!_)this._unattach(c);else if(_ instanceof el)this._attachRenderbuffer({attachment:c,renderbuffer:_});else if(Array.isArray(f)){let[w,I=0,R=0]=f;_=w,this._attachTexture({attachment:c,texture:w,layer:I,level:R})}else this._attachTexture({attachment:c,texture:_,layer:0,level:0});i&&_&&_.resize({width:this.width,height:this.height})}this.gl.bindFramebuffer(36160,n||null),Object.assign(this.attachments,t),Object.keys(this.attachments).filter(o=>!this.attachments[o]).forEach(o=>{delete this.attachments[o]})}checkStatus(){let{gl:t}=this,r=this.getStatus();if(r!==36053)throw new Error(ust(r));return this}getStatus(){let{gl:t}=this,r=t.bindFramebuffer(36160,this.handle),i=t.checkFramebufferStatus(36160);return t.bindFramebuffer(36160,r||null),i}clear(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{color:r,depth:i,stencil:s,drawBuffers:n=[]}=t,o=this.gl.bindFramebuffer(36160,this.handle);return(r||i||s)&&Hf(this.gl,{color:r,depth:i,stencil:s}),n.forEach((c,f)=>{xR(this.gl,{drawBuffer:f,value:c})}),this.gl.bindFramebuffer(36160,o||null),this}readPixels(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.error(\"Framebuffer.readPixels() is no logner supported, use readPixelsToArray(framebuffer)\")(),null}readPixelsToBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.error(\"Framebuffer.readPixelsToBuffer()is no logner supported, use readPixelsToBuffer(framebuffer)\")(),null}copyToDataUrl(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.error(\"Framebuffer.copyToDataUrl() is no logner supported, use copyToDataUrl(framebuffer)\")(),null}copyToImage(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.error(\"Framebuffer.copyToImage() is no logner supported, use copyToImage(framebuffer)\")(),null}copyToTexture(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.error(\"Framebuffer.copyToTexture({...}) is no logner supported, use copyToTexture(source, target, opts})\")(),null}blit(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.error(\"Framebuffer.blit({...}) is no logner supported, use blit(source, target, opts)\")(),null}invalidate(t){let{attachments:r=[],x:i=0,y:s=0,width:n,height:o}=t,c=Yn(this.gl),f=c.bindFramebuffer(36008,this.handle);return i===0&&s===0&&n===void 0&&o===void 0?c.invalidateFramebuffer(36008,r):c.invalidateFramebuffer(36008,r,i,s,n,o),c.bindFramebuffer(36008,f),this}getAttachmentParameter(t,r,i){let s=this._getAttachmentParameterFallback(r);return s===null&&(this.gl.bindFramebuffer(36160,this.handle),s=this.gl.getFramebufferAttachmentParameter(36160,t,r),this.gl.bindFramebuffer(36160,null)),i&&s>1e3&&(s=Ou(this.gl,s)),s}getAttachmentParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:36064,r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.constructor.ATTACHMENT_PARAMETERS||[],s={};for(let n of i){let o=r?Ou(this.gl,n):n;s[o]=this.getAttachmentParameter(t,n,r)}return s}getParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r=Object.keys(this.attachments),i={};for(let s of r){let n=Number(s),o=t?Ou(this.gl,n):n;i[o]=this.getAttachmentParameters(n,t)}return i}show(){return typeof window<\"u\"&&window.open(mE(this),\"luma-debug-texture\"),this}log(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:\"\";if(t>He.level||typeof window>\"u\")return this;r=r||\"Framebuffer \".concat(this.id);let i=mE(this,{targetMaxHeight:100});return He.image({logLevel:t,message:r,image:i},r)(),this}bind(){let{target:t=36160}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.gl.bindFramebuffer(t,this.handle),this}unbind(){let{target:t=36160}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.gl.bindFramebuffer(t,null),this}_createDefaultAttachments(t,r,i,s,n){let o=null;return t&&(o=o||{},o[36064]=new pi(this.gl,{id:\"\".concat(this.id,\"-color0\"),pixels:null,format:6408,type:5121,width:s,height:n,mipmaps:!1,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.ownResources.push(o[36064])),r&&i?(o=o||{},o[33306]=new el(this.gl,{id:\"\".concat(this.id,\"-depth-stencil\"),format:35056,width:s,height:111}),this.ownResources.push(o[33306])):r?(o=o||{},o[36096]=new el(this.gl,{id:\"\".concat(this.id,\"-depth\"),format:33189,width:s,height:n}),this.ownResources.push(o[36096])):i&&ye(!1),o}_unattach(t){let r=this.attachments[t];r&&(r instanceof el?this.gl.framebufferRenderbuffer(36160,t,36161,null):this.gl.framebufferTexture2D(36160,t,3553,null,0),delete this.attachments[t])}_attachRenderbuffer(t){let{attachment:r=36064,renderbuffer:i}=t,{gl:s}=this;s.framebufferRenderbuffer(36160,r,36161,i.handle),this.attachments[r]=i}_attachTexture(t){let{attachment:r=36064,texture:i,layer:s,level:n}=t,{gl:o}=this;switch(o.bindTexture(i.target,i.handle),i.target){case 35866:case 32879:Yn(o).framebufferTextureLayer(36160,r,i.target,n,s);break;case 34067:let f=cst(s);o.framebufferTexture2D(36160,r,f,i.handle,n);break;case 3553:o.framebufferTexture2D(36160,r,3553,i.handle,n);break;default:ye(!1,\"Illegal texture type\")}o.bindTexture(i.target,null),this.attachments[r]=i}_setReadBuffer(t){let r=sR(this.gl);r?r.readBuffer(t):ye(t===36064||t===1029,rj),this.readBuffer=t}_setDrawBuffers(t){let{gl:r}=this,i=Yn(r);if(i)i.drawBuffers(t);else{let s=r.getExtension(\"WEBGL_draw_buffers\");s?s.drawBuffersWEBGL(t):ye(t.length===1&&(t[0]===36064||t[0]===1029),rj)}this.drawBuffers=t}_getAttachmentParameterFallback(t){let r=_E(this.gl);switch(t){case 36052:return r.WEBGL2?null:0;case 33298:case 33299:case 33300:case 33301:case 33302:case 33303:return r.WEBGL2?null:8;case 33297:return r.WEBGL2?null:5125;case 33296:return!r.WEBGL2&&!r.EXT_sRGB?9729:null;default:return null}}_createHandle(){return this.gl.createFramebuffer()}_deleteHandle(){this.gl.deleteFramebuffer(this.handle)}_bindHandle(t){return this.gl.bindFramebuffer(36160,t)}};function cst(e){return e<34069?e+34069:e}function ust(e){return(yi.STATUS||{})[e]||\"Framebuffer error \".concat(e)}var hst=[36049,36048,33296,33298,33299,33300,33301,33302,33303];yi.ATTACHMENT_PARAMETERS=hst;function yE(e,t){ye(e instanceof pi||e instanceof Y0||e instanceof Ey);let r=e.constructor,{gl:i,width:s,height:n,format:o,type:c,dataFormat:f,border:_,mipmaps:w}=e,I=Object.assign({width:s,height:n,format:o,type:c,dataFormat:f,border:_,mipmaps:w},t);return new r(i,I)}function tj(e,t){let{gl:r,width:i,height:s,id:n}=e;return new yi(r,Object.assign({},t,{id:\"framebuffer-for-\".concat(n),width:i,height:s,attachments:{36064:e}}))}function qA(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:\"unnamed\",r=/#define[\\s*]SHADER_NAME[\\s*]([A-Za-z0-9_-]+)[\\s*]/,i=e.match(r);return i?i[1]:t}function wR(e){switch(e){case 35632:return\"fragment\";case 35633:return\"vertex\";default:return\"unknown type\"}}function SR(e,t,r,i){let s=e.split(/\\r?\\n/),n={},o={},c=i||qA(t)||\"(unnamed)\",f=\"\".concat(wR(r),\" shader \").concat(c);for(let w=0;w1&&arguments[1]!==void 0?arguments[1]:1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:\": \",i=e.split(/\\r?\\n/),s=String(i.length+t-1).length;return i.map((n,o)=>{let c=String(o+t),f=c.length;return nj(c,s-f)+r+n})}function nj(e,t){let r=\"\";for(let i=0;i=2&&r[0]===\"#version\"){let i=parseInt(r[1],10);Number.isFinite(i)&&(t=i)}return t}var dst=\"Shader: GLSL source code must be a JavaScript string\",vE=class e extends Js{get[Symbol.toStringTag](){return\"Shader\"}static getTypeName(t){switch(t){case 35633:return\"vertex-shader\";case 35632:return\"fragment-shader\";default:return ye(!1),\"unknown\"}}constructor(t,r){tp(t),ye(typeof r.source==\"string\",dst);let i=qA(r.source,null)||r.id||ta(\"unnamed \".concat(e.getTypeName(r.shaderType)));super(t,{id:i}),this.shaderType=r.shaderType,this.source=r.source,this.initialize(r)}initialize(t){let{source:r}=t,i=qA(r,null);i&&(this.id=ta(i)),this._compile(r)}getParameter(t){return this.gl.getShaderParameter(this.handle,t)}toString(){return\"\".concat(e.getTypeName(this.shaderType),\":\").concat(this.id)}getName(){return qA(this.source)||\"unnamed-shader\"}getSource(){return this.gl.getShaderSource(this.handle)}getTranslatedSource(){let t=this.gl.getExtension(\"WEBGL_debug_shaders\");return t?t.getTranslatedShaderSource(this.handle):\"No translated source available. WEBGL_debug_shaders not implemented\"}_compile(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.source;if(t.startsWith(\"#version \")||(t=`#version 100\n`.concat(t)),this.source=t,this.gl.shaderSource(this.handle,this.source),this.gl.compileShader(this.handle),!this.getParameter(35713)){let i=this.gl.getShaderInfoLog(this.handle),{shaderName:s,errors:n,warnings:o}=SR(i,this.source,this.shaderType,this.id);throw He.error(\"GLSL compilation errors in \".concat(s,`\n`).concat(n))(),He.warn(\"GLSL compilation warnings in \".concat(s,`\n`).concat(o))(),new Error(\"GLSL compilation errors in \".concat(s))}}_deleteHandle(){this.gl.deleteShader(this.handle)}_getOptsFromHandle(){return{type:this.getParameter(35663),source:this.getSource()}}},X0=class extends vE{get[Symbol.toStringTag](){return\"VertexShader\"}constructor(t,r){typeof r==\"string\"&&(r={source:r}),super(t,Object.assign({},r,{shaderType:35633}))}_createHandle(){return this.gl.createShader(35633)}},K0=class extends vE{get[Symbol.toStringTag](){return\"FragmentShader\"}constructor(t,r){typeof r==\"string\"&&(r={source:r}),super(t,Object.assign({},r,{shaderType:35632}))}_createHandle(){return this.gl.createShader(35632)}};var pst={5126:Qn.bind(null,\"uniform1fv\",$c,1,rl),35664:Qn.bind(null,\"uniform2fv\",$c,2,rl),35665:Qn.bind(null,\"uniform3fv\",$c,3,rl),35666:Qn.bind(null,\"uniform4fv\",$c,4,rl),5124:Qn.bind(null,\"uniform1iv\",ZA,1,rl),35667:Qn.bind(null,\"uniform2iv\",ZA,2,rl),35668:Qn.bind(null,\"uniform3iv\",ZA,3,rl),35669:Qn.bind(null,\"uniform4iv\",ZA,4,rl),35670:Qn.bind(null,\"uniform1iv\",ZA,1,rl),35671:Qn.bind(null,\"uniform2iv\",ZA,2,rl),35672:Qn.bind(null,\"uniform3iv\",ZA,3,rl),35673:Qn.bind(null,\"uniform4iv\",ZA,4,rl),35674:Qn.bind(null,\"uniformMatrix2fv\",$c,4,ep),35675:Qn.bind(null,\"uniformMatrix3fv\",$c,9,ep),35676:Qn.bind(null,\"uniformMatrix4fv\",$c,16,ep),35678:_a,35680:_a,5125:Qn.bind(null,\"uniform1uiv\",xE,1,rl),36294:Qn.bind(null,\"uniform2uiv\",xE,2,rl),36295:Qn.bind(null,\"uniform3uiv\",xE,3,rl),36296:Qn.bind(null,\"uniform4uiv\",xE,4,rl),35685:Qn.bind(null,\"uniformMatrix2x3fv\",$c,6,ep),35686:Qn.bind(null,\"uniformMatrix2x4fv\",$c,8,ep),35687:Qn.bind(null,\"uniformMatrix3x2fv\",$c,6,ep),35688:Qn.bind(null,\"uniformMatrix3x4fv\",$c,12,ep),35689:Qn.bind(null,\"uniformMatrix4x2fv\",$c,8,ep),35690:Qn.bind(null,\"uniformMatrix4x3fv\",$c,12,ep),35678:_a,35680:_a,35679:_a,35682:_a,36289:_a,36292:_a,36293:_a,36298:_a,36299:_a,36300:_a,36303:_a,36306:_a,36307:_a,36308:_a,36311:_a},Ast={},mst={},gst={},sj=[0];function TR(e,t,r,i){t===1&&typeof e==\"boolean\"&&(e=e?1:0),Number.isFinite(e)&&(sj[0]=e,e=sj);let s=e.length;if(s%t&&He.warn(\"Uniform size should be multiples of \".concat(t),e)(),e instanceof r)return e;let n=i[s];n||(n=new r(s),i[s]=n);for(let o=0;o{let s=e!==i;return s&&(t.uniform1i(r,i),e=i),s}}function Qn(e,t,r,i){let s=null,n=null;return(o,c,f)=>{let _=t(f,r),w=_.length,I=!1;if(s===null)s=new Float32Array(w),n=w,I=!0;else{ye(n===w,\"Uniform length cannot change.\");for(let R=0;R=0&&this._addAttribute(f,n,o,c)}this.attributeInfos.sort((s,n)=>s.location-n.location)}_readVaryingsFromProgram(t){let{gl:r}=t;if(!fr(r))return;let i=r.getProgramParameter(t.handle,35971);for(let s=0;ss.location-n.location)}_addAttribute(t,r,i,s){let{type:n,components:o}=PR(i),c={type:n,size:s*o};this._inferProperties(t,r,c);let f={location:t,name:r,accessor:new Pl(c)};this.attributeInfos.push(f),this.attributeInfosByLocation[t]=f,this.attributeInfosByName[f.name]=f}_inferProperties(t,r,i){/instance/i.test(r)&&(i.divisor=1)}_addVarying(t,r,i,s){let{type:n,components:o}=PR(i),c=new Pl({type:n,size:s*o}),f={location:t,name:r,accessor:c};this.varyingInfos.push(f),this.varyingInfosByName[f.name]=f}};var hj=4,$st=35981,Xst=[\"setVertexArray\",\"setAttributes\",\"setBuffers\",\"unsetBuffers\",\"use\",\"getUniformCount\",\"getUniformInfo\",\"getUniformLocation\",\"getUniformValue\",\"getVarying\",\"getFragDataLocation\",\"getAttachedShaders\",\"getAttributeCount\",\"getAttributeLocation\",\"getAttributeInfo\"],rp=class extends Js{get[Symbol.toStringTag](){return\"Program\"}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.stubRemovedMethods(\"Program\",\"v6.0\",Xst),this._isCached=!1,this.initialize(r),Object.seal(this),this._setId(r.id)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{hash:r,vs:i,fs:s,varyings:n,bufferMode:o=$st}=t;return this.hash=r||\"\",this.vs=typeof i==\"string\"?new X0(this.gl,{id:\"\".concat(t.id,\"-vs\"),source:i}):i,this.fs=typeof s==\"string\"?new K0(this.gl,{id:\"\".concat(t.id,\"-fs\"),source:s}):s,ye(this.vs instanceof X0),ye(this.fs instanceof K0),this.uniforms={},this._textureUniforms={},n&&n.length>0&&(Yn(this.gl),this.varyings=n,this.gl2.transformFeedbackVaryings(this.handle,n,o)),this._compileAndLink(),this._readUniformLocationsFromLinkedProgram(),this.configuration=new _b(this),this.setProps(t)}delete(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this._isCached?this:super.delete(t)}setProps(t){return\"uniforms\"in t&&this.setUniforms(t.uniforms),this}draw(t){let{logPriority:r,drawMode:i=4,vertexCount:s,offset:n=0,start:o,end:c,isIndexed:f=!1,indexType:_=5123,instanceCount:w=0,isInstanced:I=w>0,vertexArray:R=null,transformFeedback:N,framebuffer:j,parameters:Q={},uniforms:et,samplers:Y}=t;if((et||Y)&&(He.deprecated(\"Program.draw({uniforms})\",\"Program.setUniforms(uniforms)\")(),this.setUniforms(et||{})),He.priority>=r){let K=j?j.id:\"default\",J=\"mode=\".concat(Ou(this.gl,i),\" verts=\").concat(s,\" \")+\"instances=\".concat(w,\" indexType=\").concat(Ou(this.gl,_),\" \")+\"isInstanced=\".concat(I,\" isIndexed=\").concat(f,\" \")+\"Framebuffer=\".concat(K);He.log(r,J)()}return ye(R),this.gl.useProgram(this.handle),!this._areTexturesRenderable()||s===0||I&&w===0?!1:(R.bindForDraw(s,w,()=>{if(j!==void 0&&(Q=Object.assign({},Q,{framebuffer:j})),N){let K=uj(i);N.begin(K)}this._bindTextures(),Mn(this.gl,Q,()=>{f&&I?this.gl2.drawElementsInstanced(i,s,_,n,w):f&&fr(this.gl)&&!isNaN(o)&&!isNaN(c)?this.gl2.drawRangeElements(i,o,c,s,_,n):f?this.gl.drawElements(i,s,_,n):I?this.gl2.drawArraysInstanced(i,n,s,w):this.gl.drawArrays(i,n,s)}),N&&N.end()}),!0)}setUniforms(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};He.priority>=2&&aj(t,this.id,this._uniformSetters),this.gl.useProgram(this.handle);for(let r in t){let i=t[r],s=this._uniformSetters[r];if(s){let n=i,o=!1;if(n instanceof yi&&(n=n.texture),n instanceof tl)if(o=this.uniforms[r]!==i,o){s.textureIndex===void 0&&(s.textureIndex=this._textureIndexCounter++);let c=n,{textureIndex:f}=s;c.bind(f),n=f,this._textureUniforms[r]=c}else n=s.textureIndex;else this._textureUniforms[r]&&delete this._textureUniforms[r];(s(n)||o)&&lj(this.uniforms,r,i)}}return this}_areTexturesRenderable(){let t=!0;for(let r in this._textureUniforms){let i=this._textureUniforms[r];i.update(),t=t&&i.loaded}return t}_bindTextures(){for(let t in this._textureUniforms){let r=this._uniformSetters[t].textureIndex;this._textureUniforms[t].bind(r)}}_createHandle(){return this.gl.createProgram()}_deleteHandle(){this.gl.deleteProgram(this.handle)}_getOptionsFromHandle(t){let r=this.gl.getAttachedShaders(t),i={};for(let s of r)switch(this.gl.getShaderParameter(this.handle,35663)){case 35633:i.vs=new X0({handle:s});break;case 35632:i.fs=new K0({handle:s});break;default:}return i}_getParameter(t){return this.gl.getProgramParameter(this.handle,t)}_setId(t){if(!t){let r=this._getName();this.id=ta(r)}}_getName(){let t=this.vs.getName()||this.fs.getName();return t=t.replace(/shader/i,\"\"),t=t?\"\".concat(t,\"-program\"):\"program\",t}_compileAndLink(){let{gl:t}=this;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),He.time(hj,\"linkProgram for \".concat(this._getName()))(),t.linkProgram(this.handle),He.timeEnd(hj,\"linkProgram for \".concat(this._getName()))(),t.debug||He.level>0){if(!t.getProgramParameter(this.handle,35714))throw new Error(\"Error linking: \".concat(t.getProgramInfoLog(this.handle)));if(t.validateProgram(this.handle),!t.getProgramParameter(this.handle,35715))throw new Error(\"Error validating: \".concat(t.getProgramInfoLog(this.handle)))}}_readUniformLocationsFromLinkedProgram(){let{gl:t}=this;this._uniformSetters={},this._uniformCount=this._getParameter(35718);for(let r=0;r1)for(let o=0;o1&&arguments[1]!==void 0?arguments[1]:[],i=fr(t),s=Oh(t,Ii.TIMER_QUERY),n=i||s;for(let o of r)switch(o){case\"queries\":n=n&&i;break;case\"timers\":n=n&&s;break;default:ye(!1)}return n}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.target=null,this._queryPending=!1,this._pollingPromise=null,Object.seal(this)}beginTimeElapsedQuery(){return this.begin(tot)}beginOcclusionQuery(){let{conservative:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.begin(t?not:iot)}beginTransformFeedbackQuery(){return this.begin(rot)}begin(t){return this._queryPending?this:(this.target=t,this.gl2.beginQuery(this.target,this.handle),this)}end(){return this._queryPending?this:(this.target&&(this.gl2.endQuery(this.target),this.target=null,this._queryPending=!0),this)}isResultAvailable(){if(!this._queryPending)return!1;let t=this.gl2.getQueryParameter(this.handle,Jst);return t&&(this._queryPending=!1),t}isTimerDisjoint(){return this.gl2.getParameter(eot)}getResult(){return this.gl2.getQueryParameter(this.handle,Kst)}getTimerMilliseconds(){return this.getResult()/1e6}createPoll(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Number.POSITIVE_INFINITY;if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((i,s)=>{let n=()=>{this.isResultAvailable()?(i(this.getResult()),this._pollingPromise=null):r++>t?(s(\"Timed out\"),this._pollingPromise=null):requestAnimationFrame(n)};requestAnimationFrame(n)}),this._pollingPromise}_createHandle(){return e.isSupported(this.gl)?this.gl2.createQuery():null}_deleteHandle(){this.gl2.deleteQuery(this.handle)}};var ip=class extends Js{get[Symbol.toStringTag](){return\"TransformFeedback\"}static isSupported(t){return fr(t)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Yn(t),super(t,r),this.initialize(r),this.stubRemovedMethods(\"TransformFeedback\",\"v6.0\",[\"pause\",\"resume\"]),Object.seal(this)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.buffers={},this.unused={},this.configuration=null,this.bindOnUse=!0,Wf(this.buffers)||this.bind(()=>this._unbindBuffers()),this.setProps(t),this}setProps(t){\"program\"in t&&(this.configuration=t.program&&t.program.configuration),\"configuration\"in t&&(this.configuration=t.configuration),\"bindOnUse\"in t&&(t=t.bindOnUse),\"buffers\"in t&&this.setBuffers(t.buffers)}setBuffers(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.bind(()=>{for(let r in t)this.setBuffer(r,t[r])}),this}setBuffer(t,r){let i=this._getVaryingIndex(t),{buffer:s,byteSize:n,byteOffset:o}=this._getBufferParams(r);return i<0?(this.unused[t]=s,He.warn(\"\".concat(this.id,\" unused varying buffer \").concat(t))(),this):(this.buffers[i]=r,this.bindOnUse||this._bindBuffer(i,s,o,n),this)}begin(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this.gl.bindTransformFeedback(36386,this.handle),this._bindBuffers(),this.gl.beginTransformFeedback(t),this}end(){return this.gl.endTransformFeedback(),this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null),this}_getBufferParams(t){let r,i,s;return t instanceof Fr?s=t:(s=t.buffer,i=t.byteSize,r=t.byteOffset),(r!==void 0||i!==void 0)&&(r=r||0,i=i||s.byteLength-r),{buffer:s,byteOffset:r,byteSize:i}}_getVaryingInfo(t){return this.configuration&&this.configuration.getVaryingInfo(t)}_getVaryingIndex(t){if(this.configuration)return this.configuration.getVaryingInfo(t).location;let r=Number(t);return Number.isFinite(r)?r:-1}_bindBuffers(){if(this.bindOnUse)for(let t in this.buffers){let{buffer:r,byteSize:i,byteOffset:s}=this._getBufferParams(this.buffers[t]);this._bindBuffer(t,r,s,i)}}_unbindBuffers(){if(this.bindOnUse)for(let t in this.buffers)this._bindBuffer(t,null)}_bindBuffer(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0,n=r&&r.handle;return!n||s===void 0?this.gl.bindBufferBase(35982,t,n):this.gl.bindBufferRange(35982,t,n,i,s),this}_createHandle(){return this.gl.createTransformFeedback()}_deleteHandle(){this.gl.deleteTransformFeedback(this.handle)}_bindHandle(t){this.gl.bindTransformFeedback(36386,this.handle)}};var TE=null;function sot(e){return(!TE||TE.byteLength1&&arguments[1]!==void 0?arguments[1]:{}).constantAttributeZero?fr(t)||vy()===\"Chrome\":!0}static getDefaultArray(t){return t.luma=t.luma||{},t.luma.defaultVertexArray||(t.luma.defaultVertexArray=new e(t,{handle:null,isDefaultArray:!0})),t.luma.defaultVertexArray}static getMaxAttributes(t){return e.MAX_ATTRIBUTES=e.MAX_ATTRIBUTES||t.getParameter(34921),e.MAX_ATTRIBUTES}static setConstant(t,r,i){switch(i.constructor){case Float32Array:e._setConstantFloatArray(t,r,i);break;case Int32Array:e._setConstantIntArray(t,r,i);break;case Uint32Array:e._setConstantUintArray(t,r,i);break;default:ye(!1)}}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.id||r.program&&r.program.id;super(t,Object.assign({},r,{id:i})),this.buffer=null,this.bufferValue=null,this.isDefaultArray=r.isDefaultArray||!1,this.gl2=t,this.initialize(r),Object.seal(this)}delete(){return super.delete(),this.buffer&&this.buffer.delete(),this}get MAX_ATTRIBUTES(){return e.getMaxAttributes(this.gl)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.setProps(t)}setProps(t){return this}setElementBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ye(!t||t.target===34963,oot),this.bind(()=>{this.gl.bindBuffer(34963,t?t.handle:null)}),this}setBuffer(t,r,i){if(r.target===34963)return this.setElementBuffer(r,i);let{size:s,type:n,stride:o,offset:c,normalized:f,integer:_,divisor:w}=i,{gl:I,gl2:R}=this;return t=Number(t),this.bind(()=>{I.bindBuffer(34962,r.handle),_?(ye(fr(I)),R.vertexAttribIPointer(t,s,n,o,c)):I.vertexAttribPointer(t,s,n,f,o,c),I.enableVertexAttribArray(t),R.vertexAttribDivisor(t,w||0)}),this}enable(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return!r&&t===0&&!e.isSupported(this.gl,{constantAttributeZero:!0})||(t=Number(t),this.bind(()=>r?this.gl.enableVertexAttribArray(t):this.gl.disableVertexAttribArray(t))),this}getConstantBuffer(t,r){let i=this._normalizeConstantArrayValue(r),s=i.byteLength*t,n=i.length*t,o=!this.buffer;if(this.buffer=this.buffer||new Fr(this.gl,s),o=o||this.buffer.reallocate(s),o=o||!this._compareConstantArrayValues(i,this.bufferValue),o){let c=fj(r.constructor,n);dj({target:c,source:i,start:0,count:n}),this.buffer.subData(c),this.bufferValue=r}return this.buffer}_normalizeConstantArrayValue(t){return Array.isArray(t)?new Float32Array(t):t}_compareConstantArrayValues(t,r){if(!t||!r||t.length!==r.length||t.constructor!==r.constructor)return!1;for(let i=0;i{switch(t){case 34373:return this.gl.getVertexAttribOffset(i,t);default:return this.gl.getVertexAttrib(i,t)}})}};var aot=\"VertexArray: attributes must be Buffers or constants (i.e. typed array)\",lot=/^(.+)__LOCATION_([0-9]+)$/,cot=[\"setBuffers\",\"setGeneric\",\"clearBindings\",\"setLocations\",\"setGenericValues\",\"setDivisor\",\"enable\",\"disable\"],Iy=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.id||r.program&&r.program.id;this.id=i,this.gl=t,this.configuration=null,this.elements=null,this.elementsAccessor=null,this.values=null,this.accessors=null,this.unused=null,this.drawParams=null,this.buffer=null,this.attributes={},this.vertexArrayObject=new tg(t),fE(this,\"VertexArray\",\"v6.0\",cot),this.initialize(r),Object.seal(this)}delete(){this.buffer&&this.buffer.delete(),this.vertexArrayObject.delete()}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.reset(),this.configuration=null,this.bindOnUse=!1,this.setProps(t)}reset(){this.elements=null,this.elementsAccessor=null;let{MAX_ATTRIBUTES:t}=this.vertexArrayObject;return this.values=new Array(t).fill(null),this.accessors=new Array(t).fill(null),this.unused={},this.drawParams=null,this}setProps(t){return\"program\"in t&&(this.configuration=t.program&&t.program.configuration),\"configuration\"in t&&(this.configuration=t.configuration),\"attributes\"in t&&this.setAttributes(t.attributes),\"elements\"in t&&this.setElementBuffer(t.elements),\"bindOnUse\"in t&&(t=t.bindOnUse),this}clearDrawParams(){this.drawParams=null}getDrawParams(){return this.drawParams=this.drawParams||this._updateDrawParams(),this.drawParams}setAttributes(t){return Object.assign(this.attributes,t),this.vertexArrayObject.bind(()=>{for(let r in t){let i=t[r];this._setAttribute(r,i)}this.gl.bindBuffer(34962,null)}),this}setElementBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.elements=t,this.elementsAccessor=r,this.clearDrawParams(),this.vertexArrayObject.setElementBuffer(t,r),this}setBuffer(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(r.target===34963)return this.setElementBuffer(r,i);let{location:s,accessor:n}=this._resolveLocationAndAccessor(t,r,r.accessor,i);return s>=0&&(this.values[s]=r,this.accessors[s]=n,this.clearDrawParams(),this.vertexArrayObject.setBuffer(s,r,n)),this}setConstant(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{location:s,accessor:n}=this._resolveLocationAndAccessor(t,r,Object.assign({size:r.length},i));return s>=0&&(r=this.vertexArrayObject._normalizeConstantArrayValue(r),this.values[s]=r,this.accessors[s]=n,this.clearDrawParams(),this.vertexArrayObject.enable(s,!1)),this}unbindBuffers(){return this.vertexArrayObject.bind(()=>{this.elements&&this.vertexArrayObject.setElementBuffer(null),this.buffer=this.buffer||new Fr(this.gl,{accessor:{size:4}});for(let t=0;t{this.elements&&this.setElementBuffer(this.elements);for(let t=0;t{this._setConstantAttributes(t,r),s=i()}),s}_resolveLocationAndAccessor(t,r,i,s){let n={location:-1,accessor:null},{location:o,name:c}=this._getAttributeIndex(t);if(!Number.isFinite(o)||o<0)return this.unused[t]=r,He.once(3,()=>\"unused value \".concat(t,\" in \").concat(this.id))(),n;let f=this._getAttributeInfo(c||o);if(!f)return n;let _=this.accessors[o]||{},w=Pl.resolve(f.accessor,_,i,s),{size:I,type:R}=w;return ye(Number.isFinite(I)&&Number.isFinite(R)),{location:o,accessor:w}}_getAttributeInfo(t){return this.configuration&&this.configuration.getAttributeInfo(t)}_getAttributeIndex(t){let r=Number(t);if(Number.isFinite(r))return{location:r};let i=lot.exec(t),s=i?i[1]:t,n=i?Number(i[2]):0;return this.configuration?{location:this.configuration.getAttributeLocation(s)+n,name:s}:{location:-1}}_setAttribute(t,r){if(r instanceof Fr)this.setBuffer(t,r);else if(Array.isArray(r)&&r.length&&r[0]instanceof Fr){let i=r[0],s=r[1];this.setBuffer(t,i,s)}else if(ArrayBuffer.isView(r)||Array.isArray(r)){let i=r;this.setConstant(t,i)}else if(r.buffer instanceof Fr){let i=r;this.setBuffer(t,i.buffer,i)}else throw new Error(aot)}_setConstantAttributes(t,r){let i=Math.max(t|0,r|0),s=this.values[0];ArrayBuffer.isView(s)&&this._setConstantAttributeZero(s,i);for(let n=1;n0;if(t.isInstanced=t.isInstanced||o,i instanceof Fr){let c=i;if(o){let f=c.getVertexCount(s);t.instanceCount=Math.min(t.instanceCount,f)}else{let f=c.getVertexCount(s);t.vertexCount=Math.min(t.vertexCount,f)}}}setElements(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return He.deprecated(\"setElements\",\"setElementBuffer\")(),this.setElementBuffer(t,r)}};function uot(e,t){let{maxElts:r=16,size:i=1}=t,s=\"[\";for(let o=0;o0&&(s+=\",\".concat(o%i===0?\" \":\"\")),s+=eg(e[o],t);let n=e.length>r?\"...\":\"]\";return\"\".concat(s).concat(n)}function eg(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=1e-16,{isInteger:i=!1}=t;if(Array.isArray(e)||ArrayBuffer.isView(e))return uot(e,t);if(!Number.isFinite(e))return String(e);if(Math.abs(e)100&&Math.abs(e)<1e4)return e.toFixed(0);let s=e.toPrecision(2);return s.indexOf(\".0\")===s.length-2?s.slice(0,-1):s}function ME(e){let{header:t=\"Uniforms\",program:r,uniforms:i,undefinedOnly:s=!1}=e;ye(r);let n=\".*_.*\",o=\".*Matrix\",c=r._uniformSetters,f={},_=Object.keys(c).sort(),w=0;for(let N of _)!N.match(n)&&!N.match(o)&&IR({table:f,header:t,uniforms:i,uniformName:N,undefinedOnly:s})&&w++;for(let N of _)N.match(o)&&IR({table:f,header:t,uniforms:i,uniformName:N,undefinedOnly:s})&&w++;for(let N of _)f[N]||IR({table:f,header:t,uniforms:i,uniformName:N,undefinedOnly:s})&&w++;let I=0,R={};if(!s)for(let N in i){let j=i[N];f[N]||(I++,R[N]={Type:\"NOT USED: \".concat(j),[t]:eg(j)})}return{table:f,count:w,unusedTable:R,unusedCount:I}}function IR(e){let{table:t,header:r,uniforms:i,uniformName:s,undefinedOnly:n}=e,o=i[s],c=hot(o);return!n||!c?(t[s]={[r]:c?eg(o):\"N/A\",\"Uniform Type\":c?o:\"NOT PROVIDED\"},!0):!1}function hot(e){return e!=null}function CR(e){let{vertexArray:t,header:r=\"Attributes\"}=e;if(!t.configuration)return{};let i={};t.elements&&(i.ELEMENT_ARRAY_BUFFER=pj(t,t.elements,null,r));let s=t.values;for(let n in s){let o=t._getAttributeInfo(n);if(o){let c=\"\".concat(n,\": \").concat(o.name),f=t.accessors[o.location];f&&(c=\"\".concat(n,\": \").concat(fot(o.name,f))),i[c]=pj(t,s[n],f,r)}}return i}function pj(e,t,r,i){let{gl:s}=e;if(!t)return{[i]:\"null\",\"Format \":\"N/A\"};let n=\"NOT PROVIDED\",o=1,c=0,f=0,_,w,I;if(r&&(n=r.type,o=r.size,n=String(n).replace(\"Array\",\"\"),_=n.indexOf(\"nt\")!==-1),t instanceof Fr){let R=t,{data:N,changed:j}=R.getDebugData();w=j?\"*\":\"\",I=N,f=R.byteLength,c=f/N.BYTES_PER_ELEMENT/o;let Q;if(r){let et=r.divisor>0;Q=\"\".concat(et?\"I \":\"P \",\" \").concat(c,\" (x\").concat(o,\"=\").concat(f,\" bytes \").concat(Ou(s,n),\")\")}else _=!0,Q=\"\".concat(f,\" bytes\");return{[i]:\"\".concat(w).concat(eg(I,{size:o,isInteger:_})),\"Format \":Q}}return I=t,o=t.length,n=String(t.constructor.name).replace(\"Array\",\"\"),_=n.indexOf(\"nt\")!==-1,{[i]:\"\".concat(eg(I,{size:o,isInteger:_}),\" (constant)\"),\"Format \":\"\".concat(o,\"x\").concat(n,\" (constant)\")}}function fot(e,t){let{type:r,size:i}=t,s=SE(r,i);return s?\"\".concat(e,\" (\").concat(s.name,\")\"):e}function LR(e){let t={},r=\"Accessors for \".concat(e.id);for(let i of e.attributeInfos)if(i){let s=Aj(i);t[\"in \".concat(s)]={[r]:JSON.stringify(i.accessor)}}for(let i of e.varyingInfos)if(i){let s=Aj(i);t[\"out \".concat(s)]={[r]:JSON.stringify(i.accessor)}}return t}function Aj(e){let{type:t,size:r}=e.accessor,i=SE(t,r);return i?\"\".concat(i.name,\" \").concat(e.name):e.name}var mj=Lo()&&typeof document<\"u\",pot=0,rg=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{onCreateContext:r=et=>Ty(et),onAddHTML:i=null,onInitialize:s=()=>{},onRender:n=()=>{},onFinalize:o=()=>{},onError:c,gl:f=null,glOptions:_={},debug:w=!1,createFramebuffer:I=!1,autoResizeViewport:R=!0,autoResizeDrawingBuffer:N=!0,stats:j=Du.get(\"animation-loop-\".concat(pot++))}=t,{useDevicePixels:Q=!0}=t;\"useDevicePixelRatio\"in t&&(He.deprecated(\"useDevicePixelRatio\",\"useDevicePixels\")(),Q=t.useDevicePixelRatio),this.props={onCreateContext:r,onAddHTML:i,onInitialize:s,onRender:n,onFinalize:o,onError:c,gl:f,glOptions:_,debug:w,createFramebuffer:I},this.gl=f,this.needsRedraw=null,this.timeline=null,this.stats=j,this.cpuTime=this.stats.get(\"CPU Time\"),this.gpuTime=this.stats.get(\"GPU Time\"),this.frameRate=this.stats.get(\"Frame Rate\"),this._initialized=!1,this._running=!1,this._animationFrameId=null,this._nextFramePromise=null,this._resolveNextFrame=null,this._cpuStartTime=0,this.setProps({autoResizeViewport:R,autoResizeDrawingBuffer:N,useDevicePixels:Q}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._pageLoadPromise=null,this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}delete(){this.stop(),this._setDisplay(null)}setNeedsRedraw(t){return ye(typeof t==\"string\"),this.needsRedraw=this.needsRedraw||t,this}setProps(t){return\"autoResizeViewport\"in t&&(this.autoResizeViewport=t.autoResizeViewport),\"autoResizeDrawingBuffer\"in t&&(this.autoResizeDrawingBuffer=t.autoResizeDrawingBuffer),\"useDevicePixels\"in t&&(this.useDevicePixels=t.useDevicePixels),this}start(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this._running)return this;this._running=!0;let r=this._getPageLoadPromise().then(()=>!this._running||this._initialized?null:(this._createWebGLContext(t),this._createFramebuffer(),this._startEventHandling(),this._initializeCallbackData(),this._updateCallbackData(),this._resizeCanvasDrawingBuffer(),this._resizeViewport(),this._gpuTimeQuery=J0.isSupported(this.gl,[\"timers\"])?new J0(this.gl):null,this._initialized=!0,this.onInitialize(this.animationProps))).then(i=>{this._running&&(this._addCallbackData(i||{}),i!==!1&&this._startLoop())});return this.props.onError&&r.catch(this.props.onError),this}redraw(){return this.isContextLost()?this:(this._beginTimers(),this._setupFrame(),this._updateCallbackData(),this._renderFrame(this.animationProps),this._clearNeedsRedraw(),this.offScreen&&this.gl.commit&&this.gl.commit(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endTimers(),this)}stop(){return this._running&&(this._finalizeCallbackData(),this._cancelAnimationFrame(this._animationFrameId),this._nextFramePromise=null,this._resolveNextFrame=null,this._animationFrameId=null,this._running=!1),this}attachTimeline(t){return this.timeline=t,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw(\"waitForRender\"),this._nextFramePromise||(this._nextFramePromise=new Promise(t=>{this._resolveNextFrame=t})),this._nextFramePromise}async toDataURL(){return this.setNeedsRedraw(\"toDataURL\"),await this.waitForRender(),this.gl.canvas.toDataURL()}isContextLost(){return this.gl.isContextLost()}onCreateContext(){return this.props.onCreateContext(...arguments)}onInitialize(){return this.props.onInitialize(...arguments)}onRender(){return this.props.onRender(...arguments)}onFinalize(){return this.props.onFinalize(...arguments)}getHTMLControlValue(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,i=document.getElementById(t);return i?Number(i.value):r}setViewParameters(){return He.removed(\"AnimationLoop.setViewParameters\",\"AnimationLoop.setProps\")(),this}_startLoop(){let t=()=>{this._running&&(this.redraw(),this._animationFrameId=this._requestAnimationFrame(t))};this._cancelAnimationFrame(this._animationFrameId),this._animationFrameId=this._requestAnimationFrame(t)}_getPageLoadPromise(){return this._pageLoadPromise||(this._pageLoadPromise=mj?new Promise((t,r)=>{if(mj&&document.readyState===\"complete\"){t(document);return}window.addEventListener(\"load\",()=>{t(document)})}):Promise.resolve({})),this._pageLoadPromise}_setDisplay(t){this.display&&(this.display.delete(),this.display.animationLoop=null),t&&(t.animationLoop=this),this.display=t}_cancelAnimationFrame(t){return this.display&&this.display.cancelAnimationFrame?this.display.cancelAnimationFrame(t):mR(t)}_requestAnimationFrame(t){if(this._running)return this.display&&this.display.requestAnimationFrame?this.display.requestAnimationFrame(t):AR(t)}_renderFrame(){if(this.display){this.display._renderFrame(...arguments);return}this.onRender(...arguments)}_clearNeedsRedraw(){this.needsRedraw=null}_setupFrame(){this._resizeCanvasDrawingBuffer(),this._resizeViewport(),this._resizeFramebuffer()}_initializeCallbackData(){this.animationProps={gl:this.gl,stop:this.stop,canvas:this.gl.canvas,framebuffer:this.framebuffer,useDevicePixels:this.useDevicePixels,needsRedraw:null,startTime:Date.now(),engineTime:0,tick:0,tock:0,time:0,_timeline:this.timeline,_loop:this,_animationLoop:this,_mousePosition:null}}_updateCallbackData(){let{width:t,height:r,aspect:i}=this._getSizeAndAspect();(t!==this.animationProps.width||r!==this.animationProps.height)&&this.setNeedsRedraw(\"drawing buffer resized\"),i!==this.animationProps.aspect&&this.setNeedsRedraw(\"drawing buffer aspect changed\"),this.animationProps.width=t,this.animationProps.height=r,this.animationProps.aspect=i,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime,this.animationProps._offScreen=this.offScreen}_finalizeCallbackData(){this.onFinalize(this.animationProps)}_addCallbackData(t){typeof t==\"object\"&&t!==null&&(this.animationProps=Object.assign({},this.animationProps,t))}_createWebGLContext(t){if(this.offScreen=t.canvas&&typeof OffscreenCanvas<\"u\"&&t.canvas instanceof OffscreenCanvas,t=Object.assign({},t,this.props.glOptions),this.gl=this.props.gl?q0(this.props.gl,t):this.onCreateContext(t),!Jd(this.gl))throw new Error(\"AnimationLoop.onCreateContext - illegal context returned\");uE(this.gl),this._createInfoDiv()}_createInfoDiv(){if(this.gl.canvas&&this.props.onAddHTML){let t=document.createElement(\"div\");document.body.appendChild(t),t.style.position=\"relative\";let r=document.createElement(\"div\");r.style.position=\"absolute\",r.style.left=\"10px\",r.style.bottom=\"10px\",r.style.width=\"300px\",r.style.background=\"white\",t.appendChild(this.gl.canvas),t.appendChild(r);let i=this.props.onAddHTML(r);i&&(r.innerHTML=i)}}_getSizeAndAspect(){let t=this.gl.drawingBufferWidth,r=this.gl.drawingBufferHeight,i=1,{canvas:s}=this.gl;return s&&s.clientHeight?i=s.clientWidth/s.clientHeight:t>0&&r>0&&(i=t/r),{width:t,height:r,aspect:i}}_resizeViewport(){this.autoResizeViewport&&this.gl.viewport(0,0,this.gl.drawingBufferWidth,this.gl.drawingBufferHeight)}_resizeCanvasDrawingBuffer(){this.autoResizeDrawingBuffer&&dR(this.gl,{useDevicePixels:this.useDevicePixels})}_createFramebuffer(){this.props.createFramebuffer&&(this.framebuffer=new yi(this.gl))}_resizeFramebuffer(){this.framebuffer&&this.framebuffer.resize({width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight})}_beginTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this._gpuTimeQuery&&this._gpuTimeQuery.isResultAvailable()&&!this._gpuTimeQuery.isTimerDisjoint()&&this.stats.get(\"GPU Time\").addTime(this._gpuTimeQuery.getTimerMilliseconds()),this._gpuTimeQuery&&this._gpuTimeQuery.beginTimeElapsedQuery(),this.cpuTime.timeStart()}_endTimers(){this.cpuTime.timeEnd(),this._gpuTimeQuery&&this._gpuTimeQuery.end()}_startEventHandling(){let{canvas:t}=this.gl;t&&(t.addEventListener(\"mousemove\",this._onMousemove),t.addEventListener(\"mouseleave\",this._onMouseleave))}_onMousemove(t){this.animationProps._mousePosition=[t.offsetX,t.offsetY]}_onMouseleave(t){this.animationProps._mousePosition=null}};var ig=\"vs\",yb=\"fs\";function to(e,t){if(!e)throw new Error(t||\"shadertools: assertion failed.\")}var kR={number:{validate(e,t){return Number.isFinite(e)&&(!(\"max\"in t)||e<=t.max)&&(!(\"min\"in t)||e>=t.min)}},array:{validate(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function _j(e){let t={};for(let r in e){let i=e[r],s=Aot(i);t[r]=s}return t}function Aot(e){let t=gj(e);return t===\"object\"?e?\"type\"in e?Object.assign({},e,kR[e.type]):\"value\"in e?(t=gj(e.value),Object.assign({type:t},e,kR[t])):{type:\"object\",value:e}:{type:\"object\",value:null}:Object.assign({type:t,value:e},kR[t])}function gj(e){return Array.isArray(e)||ArrayBuffer.isView(e)?\"array\":typeof e}var mot=\"vs\",got=\"fs\",Cy=class{constructor(t){let{name:r,vs:i,fs:s,dependencies:n=[],uniforms:o,getUniforms:c,deprecations:f=[],defines:_={},inject:w={},vertexShader:I,fragmentShader:R}=t;to(typeof r==\"string\"),this.name=r,this.vs=i||I,this.fs=s||R,this.getModuleUniforms=c,this.dependencies=n,this.deprecations=this._parseDeprecationDefinitions(f),this.defines=_,this.injections=_ot(w),o&&(this.uniforms=_j(o))}getModuleSource(t){let r;switch(t){case mot:r=this.vs||\"\";break;case got:r=this.fs||\"\";break;default:to(!1)}return\"#define MODULE_\".concat(this.name.toUpperCase().replace(/[^0-9a-z]/gi,\"_\"),`\n`).concat(r,\"// END MODULE_\").concat(this.name,`\n\n`)}getUniforms(t,r){return this.getModuleUniforms?this.getModuleUniforms(t,r):this.uniforms?this._defaultGetUniforms(t):{}}getDefines(){return this.defines}checkDeprecations(t,r){this.deprecations.forEach(i=>{i.regex.test(t)&&(i.deprecated?r.deprecated(i.old,i.new)():r.removed(i.old,i.new)())})}_parseDeprecationDefinitions(t){return t.forEach(r=>{switch(r.type){case\"function\":r.regex=new RegExp(\"\\\\b\".concat(r.old,\"\\\\(\"));break;default:r.regex=new RegExp(\"\".concat(r.type,\" \").concat(r.old,\";\"))}}),t}_defaultGetUniforms(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={},i=this.uniforms;for(let s in i){let n=i[s];s in t&&!n.private?(n.validate&&to(n.validate(t[s],n),\"\".concat(this.name,\": invalid \").concat(s)),r[s]=t[s]):r[s]=n.value}return r}};function _ot(e){let t={vs:{},fs:{}};for(let r in e){let i=e[r],s=r.slice(0,2);typeof i==\"string\"&&(i={order:0,injection:i}),t[s][r]=i}return t}function yj(e){return yot(xj(e))}function yot(e){let t={},r={};return vj({modules:e,level:0,moduleMap:t,moduleDepth:r}),Object.keys(r).sort((i,s)=>r[s]-r[i]).map(i=>t[i])}function vj(e){let{modules:t,level:r,moduleMap:i,moduleDepth:s}=e;if(r>=5)throw new Error(\"Possible loop in shader dependency graph\");for(let n of t)i[n.name]=n,(s[n.name]===void 0||s[n.name](r instanceof Cy||(to(typeof r!=\"string\",\"Shader module use by name is deprecated. Import shader module '\".concat(r,\"' and use it directly.\")),to(r.name,\"shader module has no name\"),r=new Cy(r),r.dependencies=xj(r.dependencies)),r))}function RR(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=typeof window<\"u\"?window.navigator||{}:{},r=e.userAgent||t.userAgent||\"\",i=r.indexOf(\"MSIE \")!==-1,s=r.indexOf(\"Trident/\")!==-1;return i||s}var vot=7936,xot=7937,bot=7938,wot=35724,OR={GLSL_FRAG_DATA:[\"WEBGL_draw_buffers\",!0],GLSL_FRAG_DEPTH:[\"EXT_frag_depth\",!0],GLSL_DERIVATIVES:[\"OES_standard_derivatives\",!0],GLSL_TEXTURE_LOD:[\"EXT_shader_texture_lod\",!0]},YA={};Object.keys(OR).forEach(e=>{YA[e]=e});function Sot(e){return typeof WebGL2RenderingContext<\"u\"&&e instanceof WebGL2RenderingContext?!0:!!(e&&e._version===2)}function bj(e){let t=e.getExtension(\"WEBGL_debug_renderer_info\"),r=e.getParameter(t&&t.UNMASKED_VENDOR_WEBGL||vot),i=e.getParameter(t&&t.UNMASKED_RENDERER_WEBGL||xot);return{gpuVendor:Tot(r,i),vendor:r,renderer:i,version:e.getParameter(bot),shadingLanguageVersion:e.getParameter(wot)}}function Tot(e,t){return e.match(/NVIDIA/i)||t.match(/NVIDIA/i)?\"NVIDIA\":e.match(/INTEL/i)||t.match(/INTEL/i)?\"INTEL\":e.match(/AMD/i)||t.match(/AMD/i)||e.match(/ATI/i)||t.match(/ATI/i)?\"AMD\":\"UNKNOWN GPU\"}var DR={};function BR(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=OR[t];if(to(i,t),!RR(r))return!0;if(t in DR)return DR[t];let s=i[0],n=r.behavior||\"enable\",o=\"#extension GL_\".concat(s,\" : \").concat(n,`\nvoid main(void) {}`),c=e.createShader(35633);e.shaderSource(c,o),e.compileShader(c);let f=e.getShaderParameter(c,35713);return e.deleteShader(c),DR[t]=f,f}function Mot(e,t){let r=OR[t];to(r,t);let i=Sot(e)&&r[1]||r[0],s=typeof i==\"string\"?!!e.getExtension(i):i;return to(s===!1||s===!0),s}function vb(e,t){return t=Array.isArray(t)?t:[t],t.every(r=>Mot(e,r))}function wj(e){switch(bj(e).gpuVendor.toLowerCase()){case\"nvidia\":return`#define NVIDIA_GPU\n// Nvidia optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n`;case\"intel\":return`#define INTEL_GPU\n// Intel optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel's built-in 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n`;case\"amd\":return`#define AMD_GPU\n`;default:return`#define DEFAULT_GPU\n// Prevent driver from optimizing away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel's built-in 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n`}}function Sj(e,t,r){let i=`#if (__VERSION__ > 120)\n\n# define FEATURE_GLSL_DERIVATIVES\n# define FEATURE_GLSL_DRAW_BUFFERS\n# define FEATURE_GLSL_FRAG_DEPTH\n# define FEATURE_GLSL_TEXTURE_LOD\n\n// DEPRECATED FLAGS, remove in v9\n# define FRAG_DEPTH\n# define DERIVATIVES\n# define DRAW_BUFFERS\n# define TEXTURE_LOD\n\n#endif // __VERSION\n`;return vb(e,YA.GLSL_FRAG_DEPTH)&&(i+=`\n// FRAG_DEPTH => gl_FragDepth is available\n#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n# define FEATURE_GLSL_FRAG_DEPTH\n# define FRAG_DEPTH\n# define gl_FragDepth gl_FragDepthEXT\n#endif\n`),vb(e,YA.GLSL_DERIVATIVES)&&BR(e,YA.GLSL_DERIVATIVES)&&(i+=`\n// DERIVATIVES => dxdF, dxdY and fwidth are available\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n# define FEATURE_GLSL_DERIVATIVES\n# define DERIVATIVES\n#endif\n`),vb(e,YA.GLSL_FRAG_DATA)&&BR(e,YA.GLSL_FRAG_DATA,{behavior:\"require\"})&&(i+=`\n// DRAW_BUFFERS => gl_FragData[] is available\n#ifdef GL_EXT_draw_buffers\n#extension GL_EXT_draw_buffers : require\n#define FEATURE_GLSL_DRAW_BUFFERS\n#define DRAW_BUFFERS\n#endif\n`),vb(e,YA.GLSL_TEXTURE_LOD)&&(i+=`// TEXTURE_LOD => texture2DLod etc are available\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod : enable\n\n# define FEATURE_GLSL_TEXTURE_LOD\n# define TEXTURE_LOD\n\n#endif\n`),i}var Tj=`#ifdef MODULE_LOGDEPTH\n logdepth_adjustPosition(gl_Position);\n#endif\n`,Mj=`#ifdef MODULE_MATERIAL\n gl_FragColor = material_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LIGHTING\n gl_FragColor = lighting_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_FOG\n gl_FragColor = fog_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_PICKING\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LOGDEPTH\n logdepth_setFragDepth();\n#endif\n`;var Eot={[ig]:Tj,[yb]:Mj},xb=\"__LUMA_INJECT_DECLARATIONS__\",Ej=/void\\s+main\\s*\\([^)]*\\)\\s*\\{\\n?/,Pj=/}\\n?[^{}]*$/,FR=[];function EE(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=t===ig;for(let n in r){let o=r[n];o.sort((f,_)=>f.order-_.order),FR.length=o.length;for(let f=0,_=o.length;f<_;++f)FR[f]=o[f].injection;let c=\"\".concat(FR.join(`\n`),`\n`);switch(n){case\"vs:#decl\":s&&(e=e.replace(xb,c));break;case\"vs:#main-start\":s&&(e=e.replace(Ej,f=>f+c));break;case\"vs:#main-end\":s&&(e=e.replace(Pj,f=>c+f));break;case\"fs:#decl\":s||(e=e.replace(xb,c));break;case\"fs:#main-start\":s||(e=e.replace(Ej,f=>f+c));break;case\"fs:#main-end\":s||(e=e.replace(Pj,f=>c+f));break;default:e=e.replace(n,f=>f+c)}}return e=e.replace(xb,\"\"),i&&(e=e.replace(/\\}\\s*$/,n=>n+Eot[t])),e}function Ly(e){let t={};return to(Array.isArray(e)&&e.length>1),e.forEach(r=>{for(let i in r)t[i]=t[i]?\"\".concat(t[i],`\n`).concat(r[i]):r[i]}),t}function ky(e){return new RegExp(\"\\\\b\".concat(e,\"[ \\\\t]+(\\\\w+[ \\\\t]+\\\\w+(\\\\[\\\\w+\\\\])?;)\"),\"g\")}var Ij=[[/^(#version[ \\t]+(100|300[ \\t]+es))?[ \\t]*\\n/,`#version 300 es\n`],[/\\btexture(2D|2DProj|Cube)Lod(EXT)?\\(/g,\"textureLod(\"],[/\\btexture(2D|2DProj|Cube)(EXT)?\\(/g,\"texture(\"]],Pot=[...Ij,[ky(\"attribute\"),\"in $1\"],[ky(\"varying\"),\"out $1\"]],Iot=[...Ij,[ky(\"varying\"),\"in $1\"]],Cj=[[/^#version[ \\t]+300[ \\t]+es/,\"#version 100\"],[/\\btexture(2D|2DProj|Cube)Lod\\(/g,\"texture$1LodEXT(\"],[/\\btexture\\(/g,\"texture2D(\"],[/\\btextureLod\\(/g,\"texture2DLodEXT(\"]],Cot=[...Cj,[ky(\"in\"),\"attribute $1\"],[ky(\"out\"),\"varying $1\"]],Lot=[...Cj,[ky(\"in\"),\"varying $1\"]],zR=\"gl_FragColor\",NR=/\\bout[ \\t]+vec4[ \\t]+(\\w+)[ \\t]*;\\n?/,kot=/void\\s+main\\s*\\([^)]*\\)\\s*\\{\\n?/;function UR(e,t,r){switch(t){case 300:return r?PE(e,Pot):Rot(e);case 100:return r?PE(e,Cot):Dot(e);default:throw new Error(\"unknown GLSL version \".concat(t))}}function PE(e,t){for(let[r,i]of t)e=e.replace(r,i);return e}function Rot(e){e=PE(e,Iot);let t=e.match(NR);if(t){let r=t[1];e=e.replace(new RegExp(\"\\\\b\".concat(zR,\"\\\\b\"),\"g\"),r)}else{let r=\"fragmentColor\";e=e.replace(kot,i=>\"out vec4 \".concat(r,`;\n`).concat(i)).replace(new RegExp(\"\\\\b\".concat(zR,\"\\\\b\"),\"g\"),r)}return e}function Dot(e){e=PE(e,Lot);let t=e.match(NR);if(t){let r=t[1];e=e.replace(NR,\"\").replace(new RegExp(\"\\\\b\".concat(r,\"\\\\b\"),\"g\"),zR)}return e}var Oot=`\n\n`.concat(xb,`\n\n`),kj={[ig]:\"vertex\",[yb]:\"fragment\"},Bot=`precision highp float;\n\n`;function VR(e,t){let{vs:r,fs:i}=t,s=yj(t.modules||[]);return{gl:e,vs:Lj(e,Object.assign({},t,{source:r,type:ig,modules:s})),fs:Lj(e,Object.assign({},t,{source:i,type:yb,modules:s})),getUniforms:Fot(s)}}function Lj(e,t){let{id:r,source:i,type:s,modules:n,defines:o={},hookFunctions:c=[],inject:f={},transpileToGLSL100:_=!1,prologue:w=!0,log:I}=t;to(typeof i==\"string\",\"shader source must be a string\");let R=s===ig,N=i.split(`\n`),j=100,Q=\"\",et=i;N[0].indexOf(\"#version \")===0?(j=300,Q=N[0],et=N.slice(1).join(`\n`)):Q=\"#version \".concat(j);let Y={};n.forEach(Xt=>{Object.assign(Y,Xt.getDefines())}),Object.assign(Y,o);let K=w?\"\".concat(Q,`\n`).concat(Not({id:r,source:i,type:s}),`\n`).concat(zot({type:s}),`\n`).concat(wj(e),`\n`).concat(Sj(e,j,!R),`\n`).concat(Uot(Y),`\n`).concat(R?\"\":Bot,`\n`):\"\".concat(Q,`\n`),J=jot(c),ut={},Et={},kt={};for(let Xt in f){let qt=typeof f[Xt]==\"string\"?{injection:f[Xt],order:0}:f[Xt],le=Xt.match(/^(v|f)s:(#)?([\\w-]+)$/);if(le){let ue=le[2],De=le[3];ue?De===\"decl\"?Et[Xt]=[qt]:kt[Xt]=[qt]:ut[Xt]=[qt]}else kt[Xt]=[qt]}for(let Xt of n){I&&Xt.checkDeprecations(et,I);let qt=Xt.getModuleSource(s,j);K+=qt;let le=Xt.injections[s];for(let ue in le){let De=ue.match(/^(v|f)s:#([\\w-]+)$/);if(De){let rr=De[2]===\"decl\"?Et:kt;rr[ue]=rr[ue]||[],rr[ue].push(le[ue])}else ut[ue]=ut[ue]||[],ut[ue].push(le[ue])}}return K+=Oot,K=EE(K,s,Et),K+=Vot(J[s],ut),K+=et,K=EE(K,s,kt),K=UR(K,_?100:j,R),K}function Fot(e){return function(r){let i={};for(let s of e){let n=s.getUniforms(r,i);Object.assign(i,n)}return i}}function zot(e){let{type:t}=e;return`\n#define SHADER_TYPE_`.concat(kj[t].toUpperCase(),`\n`)}function Not(e){let{id:t,source:r,type:i}=e;return t&&typeof t==\"string\"&&r.indexOf(\"SHADER_NAME\")===-1?`\n#define SHADER_NAME `.concat(t,\"_\").concat(kj[i],`\n\n`):\"\"}function Uot(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=0,r=\"\";for(let i in e){t===0&&(r+=`\n// APPLICATION DEFINES\n`),t++;let s=e[i];(s||Number.isFinite(s))&&(r+=\"#define \".concat(i.toUpperCase(),\" \").concat(e[i],`\n`))}return t===0&&(r+=`\n`),r}function Vot(e,t){let r=\"\";for(let i in e){let s=e[i];if(r+=\"void \".concat(s.signature,` {\n`),s.header&&(r+=\" \".concat(s.header)),t[i]){let n=t[i];n.sort((o,c)=>o.order-c.order);for(let o of n)r+=\" \".concat(o.injection,`\n`)}s.footer&&(r+=\" \".concat(s.footer)),r+=`}\n`}return r}function jot(e){let t={vs:{},fs:{}};return e.forEach(r=>{let i;typeof r!=\"string\"?(i=r,r=i.hook):i={},r=r.trim();let[s,n]=r.split(\":\"),o=r.replace(/\\(.+/,\"\");t[s][o]=Object.assign(i,{signature:n})}),t}var Got=\"void main() {gl_FragColor = vec4(0);}\",Rj=`out vec4 transform_output;\nvoid main() {\n transform_output = vec4(0);\n}`,Wot=`#version 300 es\n`.concat(Rj);function IE(e,t){t=Array.isArray(t)?t:[t];let r=e.replace(/^\\s+/,\"\").split(/\\s+/),[i,s,n]=r;if(!t.includes(i)||!s||!n)return null;let o=n.split(\";\")[0];return{qualifier:i,type:s,name:o}}function bb(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{version:t=100,input:r,inputType:i,output:s}=e;if(!r)return t===300?Wot:t>300?\"#version \".concat(t,`\n`).concat(Rj):Got;let n=Dj(r,i);return t>=300?\"#version \".concat(t,\" \").concat(t===300?\"es\":\"\",`\nin `).concat(i,\" \").concat(r,`;\nout vec4 `).concat(s,`;\nvoid main() {\n `).concat(s,\" = \").concat(n,`;\n}`):\"varying \".concat(i,\" \").concat(r,`;\nvoid main() {\n gl_FragColor = `).concat(n,`;\n}`)}function jR(e){switch(e){case\"float\":return\"x\";case\"vec2\":return\"xy\";case\"vec3\":return\"xyz\";case\"vec4\":return\"xyzw\";default:return to(!1),null}}function GR(e){switch(e){case\"float\":return 1;case\"vec2\":return 2;case\"vec3\":return 3;case\"vec4\":return 4;default:return to(!1),null}}function Dj(e,t){switch(t){case\"float\":return\"vec4(\".concat(e,\", 0.0, 0.0, 1.0)\");case\"vec2\":return\"vec4(\".concat(e,\", 0.0, 1.0)\");case\"vec3\":return\"vec4(\".concat(e,\", 1.0)\");case\"vec4\":return e;default:return to(!1),null}}var Hot=`#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\nconst float TWO_PI = 6.2831854820251465;\nconst float PI_2 = 1.5707963705062866;\nconst float PI_16 = 0.1963495463132858;\n\nconst float SIN_TABLE_0 = 0.19509032368659973;\nconst float SIN_TABLE_1 = 0.3826834261417389;\nconst float SIN_TABLE_2 = 0.5555702447891235;\nconst float SIN_TABLE_3 = 0.7071067690849304;\n\nconst float COS_TABLE_0 = 0.9807852506637573;\nconst float COS_TABLE_1 = 0.9238795042037964;\nconst float COS_TABLE_2 = 0.8314695954322815;\nconst float COS_TABLE_3 = 0.7071067690849304;\n\nconst float INVERSE_FACTORIAL_3 = 1.666666716337204e-01;\nconst float INVERSE_FACTORIAL_5 = 8.333333767950535e-03;\nconst float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04;\nconst float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06;\n\nfloat sin_taylor_fp32(float a) {\n float r, s, t, x;\n\n if (a == 0.0) {\n return 0.0;\n }\n\n x = -a * a;\n s = a;\n r = a;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_3;\n s = s + t;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_5;\n s = s + t;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_7;\n s = s + t;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_9;\n s = s + t;\n\n return s;\n}\n\nvoid sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {\n if (a == 0.0) {\n sin_t = 0.0;\n cos_t = 1.0;\n }\n sin_t = sin_taylor_fp32(a);\n cos_t = sqrt(1.0 - sin_t * sin_t);\n}\n\nfloat tan_taylor_fp32(float a) {\n float sin_a;\n float cos_a;\n\n if (a == 0.0) {\n return 0.0;\n }\n float z = floor(a / TWO_PI);\n float r = a - TWO_PI * z;\n\n float t;\n float q = floor(r / PI_2 + 0.5);\n int j = int(q);\n\n if (j < -2 || j > 2) {\n return 1.0 / 0.0;\n }\n\n t = r - PI_2 * q;\n\n q = floor(t / PI_16 + 0.5);\n int k = int(q);\n int abs_k = int(abs(float(k)));\n\n if (abs_k > 4) {\n return 1.0 / 0.0;\n } else {\n t = t - PI_16 * q;\n }\n\n float u = 0.0;\n float v = 0.0;\n\n float sin_t, cos_t;\n float s, c;\n sincos_taylor_fp32(t, sin_t, cos_t);\n\n if (k == 0) {\n s = sin_t;\n c = cos_t;\n } else {\n if (abs(float(abs_k) - 1.0) < 0.5) {\n u = COS_TABLE_0;\n v = SIN_TABLE_0;\n } else if (abs(float(abs_k) - 2.0) < 0.5) {\n u = COS_TABLE_1;\n v = SIN_TABLE_1;\n } else if (abs(float(abs_k) - 3.0) < 0.5) {\n u = COS_TABLE_2;\n v = SIN_TABLE_2;\n } else if (abs(float(abs_k) - 4.0) < 0.5) {\n u = COS_TABLE_3;\n v = SIN_TABLE_3;\n }\n if (k > 0) {\n s = u * sin_t + v * cos_t;\n c = u * cos_t - v * sin_t;\n } else {\n s = u * sin_t - v * cos_t;\n c = u * cos_t + v * sin_t;\n }\n }\n\n if (j == 0) {\n sin_a = s;\n cos_a = c;\n } else if (j == 1) {\n sin_a = c;\n cos_a = -s;\n } else if (j == -1) {\n sin_a = -c;\n cos_a = s;\n } else {\n sin_a = -s;\n cos_a = -c;\n }\n return sin_a / cos_a;\n}\n#endif\n\nfloat tan_fp32(float a) {\n#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\n return tan_taylor_fp32(a);\n#else\n return tan(a);\n#endif\n}\n`,CE={name:\"fp32\",vs:Hot,fs:null};function Bh(e,t){if(!e)throw new Error(\"math.gl assertion \".concat(t))}var Gkt=1/Math.PI*180,Wkt=1/180*Math.PI,eo={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function WR(e,{precision:t=eo.precision}={}){return e=qot(e),\"\".concat(parseFloat(e.toPrecision(t)))}function Fh(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Il(e,t,r){return Yot(e,i=>Math.max(t,Math.min(r,i)))}function il(e,t,r){return Fh(e)?e.map((i,s)=>il(i,t[s],r)):r*t+(1-r)*e}function Ro(e,t,r){let i=eo.EPSILON;r&&(eo.EPSILON=r);try{if(e===t)return!0;if(Fh(e)&&Fh(t)){if(e.length!==t.length)return!1;for(let s=0;s0?\", \":\"\")+WR(this[i],t);return\"\".concat(t.printTypes?this.constructor.name:\"\",\"[\").concat(r,\"]\")}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r=0&&t=0&&t0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function YR(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Dy(e,t,r){var i=t[0],s=t[1],n=t[2],o=r[0],c=r[1],f=r[2];return e[0]=s*f-n*c,e[1]=n*o-i*f,e[2]=i*c-s*o,e}function Hj(e,t,r,i){var s=t[0],n=t[1],o=t[2];return e[0]=s+i*(r[0]-s),e[1]=n+i*(r[1]-n),e[2]=o+i*(r[2]-o),e}function Oy(e,t,r){var i=t[0],s=t[1],n=t[2],o=r[3]*i+r[7]*s+r[11]*n+r[15];return o=o||1,e[0]=(r[0]*i+r[4]*s+r[8]*n+r[12])/o,e[1]=(r[1]*i+r[5]*s+r[9]*n+r[13])/o,e[2]=(r[2]*i+r[6]*s+r[10]*n+r[14])/o,e}function OE(e,t,r){var i=t[0],s=t[1],n=t[2];return e[0]=i*r[0]+s*r[3]+n*r[6],e[1]=i*r[1]+s*r[4]+n*r[7],e[2]=i*r[2]+s*r[5]+n*r[8],e}function BE(e,t,r){var i=r[0],s=r[1],n=r[2],o=r[3],c=t[0],f=t[1],_=t[2],w=s*_-n*f,I=n*c-i*_,R=i*f-s*c,N=s*R-n*I,j=n*w-i*R,Q=i*I-s*w,et=o*2;return w*=et,I*=et,R*=et,N*=2,j*=2,Q*=2,e[0]=c+w+N,e[1]=f+I+j,e[2]=_+R+Q,e}function qj(e,t,r,i){var s=[],n=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],n[0]=s[0],n[1]=s[1]*Math.cos(i)-s[2]*Math.sin(i),n[2]=s[1]*Math.sin(i)+s[2]*Math.cos(i),e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function Zj(e,t,r,i){var s=[],n=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],n[0]=s[2]*Math.sin(i)+s[0]*Math.cos(i),n[1]=s[1],n[2]=s[2]*Math.cos(i)-s[0]*Math.sin(i),e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function Yj(e,t,r,i){var s=[],n=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],n[0]=s[0]*Math.cos(i)-s[1]*Math.sin(i),n[1]=s[0]*Math.sin(i)+s[1]*Math.cos(i),n[2]=s[2],e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function Qj(e,t){var r=e[0],i=e[1],s=e[2],n=t[0],o=t[1],c=t[2],f=Math.sqrt(r*r+i*i+s*s),_=Math.sqrt(n*n+o*o+c*c),w=f*_,I=w&&YR(e,t)/w;return Math.acos(Math.min(Math.max(I,-1),1))}var FE=tat;var $j=eat;var zE=Jot,NE=rat,i4t=function(){var e=qR();return function(t,r,i,s,n,o){var c,f;for(r||(r=3),i||(i=0),s?f=Math.min(s*r+i,t.length):f=t.length,c=i;c0?this.copy([t,...r]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(iat)}fromObject(t){return this.check()}fromQuaternion(t){return i7(this,t),this.check()}set(t,r,i,s,n,o,c,f,_){return this[0]=t,this[1]=r,this[2]=i,this[3]=s,this[4]=n,this[5]=o,this[6]=c,this[7]=f,this[8]=_,this.check()}setRowMajor(t,r,i,s,n,o,c,f,_){return this[0]=t,this[1]=s,this[2]=c,this[3]=r,this[4]=n,this[5]=f,this[6]=i,this[7]=o,this[8]=_,this.check()}determinant(){return t7(this)}transpose(){return Kj(this,this),this.check()}invert(){return Jj(this,this),this.check()}multiplyLeft(t){return $R(this,t,this),this.check()}multiplyRight(t){return $R(this,this,t),this.check()}rotate(t){return r7(this,this,t),this.check()}scale(t){return Array.isArray(t)?XR(this,this,t):XR(this,this,[t,t]),this.check()}translate(t){return e7(this,this,t),this.check()}transform(t,r){let i;switch(t.length){case 2:i=Fj(r||[-0,-0],t,this);break;case 3:i=OE(r||[-0,-0,-0],t,this);break;case 4:i=DE(r||[-0,-0,-0,-0],t,this);break;default:throw new Error(\"Illegal vector\")}return QA(i,t.length),i}transformVector(t,r){return this.transform(t,r)}transformVector2(t,r){return this.transform(t,r)}transformVector3(t,r){return this.transform(t,r)}},jE,GE;function nat(){return jE||(jE=new ss([0,0,0,0,0,0,0,0,0]),Object.freeze(jE)),jE}function sat(){return GE||(GE=new ss,Object.freeze(GE)),GE}function oat(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function s7(e,t){if(e===t){var r=t[1],i=t[2],s=t[3],n=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=n,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function Sb(e,t){var r=t[0],i=t[1],s=t[2],n=t[3],o=t[4],c=t[5],f=t[6],_=t[7],w=t[8],I=t[9],R=t[10],N=t[11],j=t[12],Q=t[13],et=t[14],Y=t[15],K=r*c-i*o,J=r*f-s*o,ut=r*_-n*o,Et=i*f-s*c,kt=i*_-n*c,Xt=s*_-n*f,qt=w*Q-I*j,le=w*et-R*j,ue=w*Y-N*j,De=I*et-R*Q,Ke=I*Y-N*Q,rr=R*Y-N*et,Sr=K*rr-J*Ke+ut*De+Et*ue-kt*le+Xt*qt;return Sr?(Sr=1/Sr,e[0]=(c*rr-f*Ke+_*De)*Sr,e[1]=(s*Ke-i*rr-n*De)*Sr,e[2]=(Q*Xt-et*kt+Y*Et)*Sr,e[3]=(R*kt-I*Xt-N*Et)*Sr,e[4]=(f*ue-o*rr-_*le)*Sr,e[5]=(r*rr-s*ue+n*le)*Sr,e[6]=(et*ut-j*Xt-Y*J)*Sr,e[7]=(w*Xt-R*ut+N*J)*Sr,e[8]=(o*Ke-c*ue+_*qt)*Sr,e[9]=(i*ue-r*Ke-n*qt)*Sr,e[10]=(j*kt-Q*ut+Y*K)*Sr,e[11]=(I*ut-w*kt-N*K)*Sr,e[12]=(c*le-o*De-f*qt)*Sr,e[13]=(r*De-i*le+s*qt)*Sr,e[14]=(Q*J-j*Et-et*K)*Sr,e[15]=(w*Et-I*J+R*K)*Sr,e):null}function o7(e){var t=e[0],r=e[1],i=e[2],s=e[3],n=e[4],o=e[5],c=e[6],f=e[7],_=e[8],w=e[9],I=e[10],R=e[11],N=e[12],j=e[13],Q=e[14],et=e[15],Y=t*o-r*n,K=t*c-i*n,J=t*f-s*n,ut=r*c-i*o,Et=r*f-s*o,kt=i*f-s*c,Xt=_*j-w*N,qt=_*Q-I*N,le=_*et-R*N,ue=w*Q-I*j,De=w*et-R*j,Ke=I*et-R*Q;return Y*Ke-K*De+J*ue+ut*le-Et*qt+kt*Xt}function qf(e,t,r){var i=t[0],s=t[1],n=t[2],o=t[3],c=t[4],f=t[5],_=t[6],w=t[7],I=t[8],R=t[9],N=t[10],j=t[11],Q=t[12],et=t[13],Y=t[14],K=t[15],J=r[0],ut=r[1],Et=r[2],kt=r[3];return e[0]=J*i+ut*c+Et*I+kt*Q,e[1]=J*s+ut*f+Et*R+kt*et,e[2]=J*n+ut*_+Et*N+kt*Y,e[3]=J*o+ut*w+Et*j+kt*K,J=r[4],ut=r[5],Et=r[6],kt=r[7],e[4]=J*i+ut*c+Et*I+kt*Q,e[5]=J*s+ut*f+Et*R+kt*et,e[6]=J*n+ut*_+Et*N+kt*Y,e[7]=J*o+ut*w+Et*j+kt*K,J=r[8],ut=r[9],Et=r[10],kt=r[11],e[8]=J*i+ut*c+Et*I+kt*Q,e[9]=J*s+ut*f+Et*R+kt*et,e[10]=J*n+ut*_+Et*N+kt*Y,e[11]=J*o+ut*w+Et*j+kt*K,J=r[12],ut=r[13],Et=r[14],kt=r[15],e[12]=J*i+ut*c+Et*I+kt*Q,e[13]=J*s+ut*f+Et*R+kt*et,e[14]=J*n+ut*_+Et*N+kt*Y,e[15]=J*o+ut*w+Et*j+kt*K,e}function ag(e,t,r){var i=r[0],s=r[1],n=r[2],o,c,f,_,w,I,R,N,j,Q,et,Y;return t===e?(e[12]=t[0]*i+t[4]*s+t[8]*n+t[12],e[13]=t[1]*i+t[5]*s+t[9]*n+t[13],e[14]=t[2]*i+t[6]*s+t[10]*n+t[14],e[15]=t[3]*i+t[7]*s+t[11]*n+t[15]):(o=t[0],c=t[1],f=t[2],_=t[3],w=t[4],I=t[5],R=t[6],N=t[7],j=t[8],Q=t[9],et=t[10],Y=t[11],e[0]=o,e[1]=c,e[2]=f,e[3]=_,e[4]=w,e[5]=I,e[6]=R,e[7]=N,e[8]=j,e[9]=Q,e[10]=et,e[11]=Y,e[12]=o*i+w*s+j*n+t[12],e[13]=c*i+I*s+Q*n+t[13],e[14]=f*i+R*s+et*n+t[14],e[15]=_*i+N*s+Y*n+t[15]),e}function By(e,t,r){var i=r[0],s=r[1],n=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function a7(e,t,r,i){var s=i[0],n=i[1],o=i[2],c=Math.hypot(s,n,o),f,_,w,I,R,N,j,Q,et,Y,K,J,ut,Et,kt,Xt,qt,le,ue,De,Ke,rr,Sr,Li;return c0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=i*o,e[2]=s*o,e[3]=n*o,e}function _7(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function y7(e,t,r,i){var s=t[0],n=t[1],o=t[2],c=t[3];return e[0]=s+i*(r[0]-s),e[1]=n+i*(r[1]-n),e[2]=o+i*(r[2]-o),e[3]=c+i*(r[3]-c),e}function Nh(e,t,r){var i=t[0],s=t[1],n=t[2],o=t[3];return e[0]=r[0]*i+r[4]*s+r[8]*n+r[12]*o,e[1]=r[1]*i+r[5]*s+r[9]*n+r[13]*o,e[2]=r[2]*i+r[6]*s+r[10]*n+r[14]*o,e[3]=r[3]*i+r[7]*s+r[11]*n+r[15]*o,e}function v7(e,t,r){var i=t[0],s=t[1],n=t[2],o=r[0],c=r[1],f=r[2],_=r[3],w=_*i+c*n-f*s,I=_*s+f*i-o*n,R=_*n+o*s-c*i,N=-o*i-c*s-f*n;return e[0]=w*_+N*-o+I*-f-R*-c,e[1]=I*_+N*-c+R*-o-w*-f,e[2]=R*_+N*-f+w*-c-I*-o,e[3]=t[3],e}var b4t=function(){var e=cat();return function(t,r,i,s,n,o){var c,f;for(r||(r=4),i||(i=0),s?f=Math.min(s*r+i,t.length):f=t.length,c=i;cMath.PI*2)throw Error(\"expected radians\")}function Aat(e,t,r,i,s,n){let o=2*n/(r-t),c=2*n/(s-i),f=(r+t)/(r-t),_=(s+i)/(s-i),w=-1,I=-1,R=-2*n;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=f,e[9]=_,e[10]=w,e[11]=I,e[12]=0,e[13]=0,e[14]=R,e[15]=0,e}function b7(){var e=new ya(4);return ya!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function w7(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function iD(e,t,r){r=r*.5;var i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e}function nD(e,t,r){var i=t[0],s=t[1],n=t[2],o=t[3],c=r[0],f=r[1],_=r[2],w=r[3];return e[0]=i*w+o*c+s*_-n*f,e[1]=s*w+o*f+n*c-i*_,e[2]=n*w+o*_+i*f-s*c,e[3]=o*w-i*c-s*f-n*_,e}function S7(e,t,r){r*=.5;var i=t[0],s=t[1],n=t[2],o=t[3],c=Math.sin(r),f=Math.cos(r);return e[0]=i*f+o*c,e[1]=s*f+n*c,e[2]=n*f-s*c,e[3]=o*f-i*c,e}function T7(e,t,r){r*=.5;var i=t[0],s=t[1],n=t[2],o=t[3],c=Math.sin(r),f=Math.cos(r);return e[0]=i*f-n*c,e[1]=s*f+o*c,e[2]=n*f+i*c,e[3]=o*f-s*c,e}function M7(e,t,r){r*=.5;var i=t[0],s=t[1],n=t[2],o=t[3],c=Math.sin(r),f=Math.cos(r);return e[0]=i*f+s*c,e[1]=s*f-i*c,e[2]=n*f+o*c,e[3]=o*f-n*c,e}function E7(e,t){var r=t[0],i=t[1],s=t[2];return e[0]=r,e[1]=i,e[2]=s,e[3]=Math.sqrt(Math.abs(1-r*r-i*i-s*s)),e}function Mb(e,t,r,i){var s=t[0],n=t[1],o=t[2],c=t[3],f=r[0],_=r[1],w=r[2],I=r[3],R,N,j,Q,et;return N=s*f+n*_+o*w+c*I,N<0&&(N=-N,f=-f,_=-_,w=-w,I=-I),1-N>zh?(R=Math.acos(N),j=Math.sin(R),Q=Math.sin((1-i)*R)/j,et=Math.sin(i*R)/j):(Q=1-i,et=i),e[0]=Q*s+et*f,e[1]=Q*n+et*_,e[2]=Q*o+et*w,e[3]=Q*c+et*I,e}function P7(e,t){var r=t[0],i=t[1],s=t[2],n=t[3],o=r*r+i*i+s*s+n*n,c=o?1/o:0;return e[0]=-r*c,e[1]=-i*c,e[2]=-s*c,e[3]=n*c,e}function I7(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function sD(e,t){var r=t[0]+t[4]+t[8],i;if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{var s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);var n=(s+1)%3,o=(s+2)%3;i=Math.sqrt(t[s*3+s]-t[n*3+n]-t[o*3+o]+1),e[s]=.5*i,i=.5/i,e[3]=(t[n*3+o]-t[o*3+n])*i,e[n]=(t[n*3+s]+t[s*3+n])*i,e[o]=(t[o*3+s]+t[s*3+o])*i}return e}var C7=p7;var L7=Fy,k7=_7,R7=y7,D7=A7;var O7=m7;var B7=g7;var F7=function(){var e=qR(),t=ZR(1,0,0),r=ZR(0,1,0);return function(i,s,n){var o=YR(s,n);return o<-.999999?(Dy(e,t,s),zE(e)<1e-6&&Dy(e,r,s),Wj(e,e),iD(i,e,Math.PI),i):o>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(Dy(e,s,n),i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=1+o,B7(i,i))}}(),R4t=function(){var e=b7(),t=b7();return function(r,i,s,n,o,c){return Mb(e,i,o,c),Mb(t,s,n,c),Mb(r,e,t,2*c*(1-c)),r}}(),D4t=function(){var e=Xj();return function(t,r,i,s){return e[0]=i[0],e[3]=i[1],e[6]=i[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],B7(t,sD(t,e))}}();var gat=[0,0,0,1],lg=class extends np{constructor(t=0,r=0,i=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,i,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,r,i,s){return this[0]=t,this[1]=r,this[2]=i,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return sD(this,t),this.check()}fromAxisRotation(t,r){return iD(this,t,r),this.check()}identity(){return w7(this),this.check()}setAxisAngle(t,r){return this.fromAxisRotation(t,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=Qi(t)}get y(){return this[1]}set y(t){this[1]=Qi(t)}get z(){return this[2]}set z(t){this[2]=Qi(t)}get w(){return this[3]}set w(t){this[3]=Qi(t)}len(){return D7(this)}lengthSquared(){return O7(this)}dot(t){return k7(this,t)}rotationTo(t,r){return F7(this,t,r),this.check()}add(t){return C7(this,this,t),this.check()}calculateW(){return E7(this,this),this.check()}conjugate(){return I7(this,this),this.check()}invert(){return P7(this,this),this.check()}lerp(t,r,i){return i===void 0?this.lerp(this,t,r):(R7(this,t,r,i),this.check())}multiplyRight(t){return nD(this,this,t),this.check()}multiplyLeft(t){return nD(this,t,this),this.check()}normalize(){let t=this.len(),r=t>0?1/t:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,t===0&&(this[3]=1),this.check()}rotateX(t){return S7(this,this,t),this.check()}rotateY(t){return T7(this,this,t),this.check()}rotateZ(t){return M7(this,this,t),this.check()}scale(t){return L7(this,this,t),this.check()}slerp(t,r,i){let s,n,o;switch(arguments.length){case 1:({start:s=gat,target:n,ratio:o}=t);break;case 2:s=this,n=t,o=r;break;default:s=t,n=r,o=i}return Mb(this,s,n,o),this.check()}transformVector4(t,r=new wb){return v7(r,t,this),QA(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var YE={EPSILON1:.1,EPSILON2:.01,EPSILON3:.001,EPSILON4:1e-4,EPSILON5:1e-5,EPSILON6:1e-6,EPSILON7:1e-7,EPSILON8:1e-8,EPSILON9:1e-9,EPSILON10:1e-10,EPSILON11:1e-11,EPSILON12:1e-12,EPSILON13:1e-13,EPSILON14:1e-14,EPSILON15:1e-15,EPSILON16:1e-16,EPSILON17:1e-17,EPSILON18:1e-18,EPSILON19:1e-19,EPSILON20:1e-20,PI_OVER_TWO:Math.PI/2,PI_OVER_FOUR:Math.PI/4,PI_OVER_SIX:Math.PI/6,TWO_PI:Math.PI*2};var oD=`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))\n\nstruct AmbientLight {\n vec3 color;\n};\n\nstruct PointLight {\n vec3 color;\n vec3 position;\n vec3 attenuation;\n};\n\nstruct DirectionalLight {\n vec3 color;\n vec3 direction;\n};\n\nuniform AmbientLight lighting_uAmbientLight;\nuniform PointLight lighting_uPointLight[MAX_LIGHTS];\nuniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS];\nuniform int lighting_uPointLightCount;\nuniform int lighting_uDirectionalLightCount;\n\nuniform bool lighting_uEnabled;\n\nfloat getPointLightAttenuation(PointLight pointLight, float distance) {\n return pointLight.attenuation.x\n + pointLight.attenuation.y * distance\n + pointLight.attenuation.z * distance * distance;\n}\n\n#endif\n`;var _at={lightSources:{}};function aD(){let{color:e=[0,0,0],intensity:t=1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e.map(r=>r*t/255)}function yat(e){let{ambientLight:t,pointLights:r=[],directionalLights:i=[]}=e,s={};return t?s[\"lighting_uAmbientLight.color\"]=aD(t):s[\"lighting_uAmbientLight.color\"]=[0,0,0],r.forEach((n,o)=>{s[\"lighting_uPointLight[\".concat(o,\"].color\")]=aD(n),s[\"lighting_uPointLight[\".concat(o,\"].position\")]=n.position,s[\"lighting_uPointLight[\".concat(o,\"].attenuation\")]=n.attenuation||[1,0,0]}),s.lighting_uPointLightCount=r.length,i.forEach((n,o)=>{s[\"lighting_uDirectionalLight[\".concat(o,\"].color\")]=aD(n),s[\"lighting_uDirectionalLight[\".concat(o,\"].direction\")]=n.direction}),s.lighting_uDirectionalLightCount=i.length,s}function z7(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_at;if(\"lightSources\"in e){let{ambientLight:t,pointLights:r,directionalLights:i}=e.lightSources||{};return t||r&&r.length>0||i&&i.length>0?Object.assign({},yat({ambientLight:t,pointLights:r,directionalLights:i}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if(\"lights\"in e){let t={pointLights:[],directionalLights:[]};for(let r of e.lights||[])switch(r.type){case\"ambient\":t.ambientLight=r;break;case\"directional\":t.directionalLights.push(r);break;case\"point\":t.pointLights.push(r);break;default:}return z7({lightSources:t})}return{}}var lD={name:\"lights\",vs:oD,fs:oD,getUniforms:z7,defines:{MAX_LIGHTS:3}};var vat=new Uint8Array([0,255,255,255]),xat={pickingSelectedColor:null,pickingHighlightColor:vat,pickingActive:!1,pickingAttribute:!1};function bat(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:xat,t={};if(e.pickingSelectedColor!==void 0)if(!e.pickingSelectedColor)t.picking_uSelectedColorValid=0;else{let r=e.pickingSelectedColor.slice(0,3);t.picking_uSelectedColorValid=1,t.picking_uSelectedColor=r}if(e.pickingHighlightColor){let r=Array.from(e.pickingHighlightColor,i=>i/255);Number.isFinite(r[3])||(r[3]=1),t.picking_uHighlightColor=r}return e.pickingActive!==void 0&&(t.picking_uActive=!!e.pickingActive,t.picking_uAttribute=!!e.pickingAttribute),t}var wat=`uniform bool picking_uActive;\nuniform bool picking_uAttribute;\nuniform vec3 picking_uSelectedColor;\nuniform bool picking_uSelectedColorValid;\n\nout vec4 picking_vRGBcolor_Avalid;\n\nconst float COLOR_SCALE = 1. / 255.;\n\nbool picking_isColorValid(vec3 color) {\n return dot(color, vec3(1.0)) > 0.001;\n}\n\nbool isVertexPicked(vec3 vertexColor) {\n return\n picking_uSelectedColorValid &&\n !picking_isColorValid(abs(vertexColor - picking_uSelectedColor));\n}\n\nvoid picking_setPickingColor(vec3 pickingColor) {\n if (picking_uActive) {\n picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor));\n\n if (!picking_uAttribute) {\n picking_vRGBcolor_Avalid.rgb = pickingColor * COLOR_SCALE;\n }\n } else {\n picking_vRGBcolor_Avalid.a = float(isVertexPicked(pickingColor));\n }\n}\n\nvoid picking_setPickingAttribute(float value) {\n if (picking_uAttribute) {\n picking_vRGBcolor_Avalid.r = value;\n }\n}\nvoid picking_setPickingAttribute(vec2 value) {\n if (picking_uAttribute) {\n picking_vRGBcolor_Avalid.rg = value;\n }\n}\nvoid picking_setPickingAttribute(vec3 value) {\n if (picking_uAttribute) {\n picking_vRGBcolor_Avalid.rgb = value;\n }\n}\n`,Sat=`uniform bool picking_uActive;\nuniform vec3 picking_uSelectedColor;\nuniform vec4 picking_uHighlightColor;\n\nin vec4 picking_vRGBcolor_Avalid;\nvec4 picking_filterHighlightColor(vec4 color) {\n if (picking_uActive) {\n return color;\n }\n bool selected = bool(picking_vRGBcolor_Avalid.a);\n\n if (selected) {\n float highLightAlpha = picking_uHighlightColor.a;\n float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);\n float highLightRatio = highLightAlpha / blendedAlpha;\n\n vec3 blendedRGB = mix(color.rgb, picking_uHighlightColor.rgb, highLightRatio);\n return vec4(blendedRGB, blendedAlpha);\n } else {\n return color;\n }\n}\nvec4 picking_filterPickingColor(vec4 color) {\n if (picking_uActive) {\n if (picking_vRGBcolor_Avalid.a == 0.0) {\n discard;\n }\n return picking_vRGBcolor_Avalid;\n }\n return color;\n}\nvec4 picking_filterColor(vec4 color) {\n vec4 highightColor = picking_filterHighlightColor(color);\n return picking_filterPickingColor(highightColor);\n}\n\n`,QE={name:\"picking\",vs:wat,fs:Sat,getUniforms:bat};var cD=`\nuniform float lighting_uAmbient;\nuniform float lighting_uDiffuse;\nuniform float lighting_uShininess;\nuniform vec3 lighting_uSpecularColor;\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {\n vec3 halfway_direction = normalize(light_direction + view_direction);\n float lambertian = dot(light_direction, normal_worldspace);\n float specular = 0.0;\n if (lambertian > 0.0) {\n float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);\n specular = pow(specular_angle, lighting_uShininess);\n }\n lambertian = max(lambertian, 0.0);\n return (lambertian * lighting_uDiffuse * surfaceColor + specular * lighting_uSpecularColor) * color;\n}\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n vec3 lightColor = surfaceColor;\n\n if (lighting_uEnabled) {\n vec3 view_direction = normalize(cameraPosition - position_worldspace);\n lightColor = lighting_uAmbient * surfaceColor * lighting_uAmbientLight.color;\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uPointLightCount) {\n break;\n }\n PointLight pointLight = lighting_uPointLight[i];\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n }\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uDirectionalLightCount) {\n break;\n }\n DirectionalLight directionalLight = lighting_uDirectionalLight[i];\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n }\n }\n return lightColor;\n}\n\nvec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n vec3 lightColor = vec3(0, 0, 0);\n vec3 surfaceColor = vec3(0, 0, 0);\n\n if (lighting_uEnabled) {\n vec3 view_direction = normalize(cameraPosition - position_worldspace);\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uPointLightCount) {\n break;\n }\n PointLight pointLight = lighting_uPointLight[i];\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n }\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uDirectionalLightCount) {\n break;\n }\n DirectionalLight directionalLight = lighting_uDirectionalLight[i];\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n }\n }\n return lightColor;\n}\n`;var Tat={};function Mat(e){let{ambient:t=.35,diffuse:r=.6,shininess:i=32,specularColor:s=[30,30,30]}=e;return{lighting_uAmbient:t,lighting_uDiffuse:r,lighting_uShininess:i,lighting_uSpecularColor:s.map(n=>n/255)}}function N7(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Tat;if(!(\"material\"in e))return{};let{material:t}=e;return t?Mat(t):{lighting_uEnabled:!1}}var Zf={name:\"gouraud-lighting\",dependencies:[lD],vs:cD,defines:{LIGHTING_VERTEX:1},getUniforms:N7},Ny={name:\"phong-lighting\",dependencies:[lD],fs:cD,defines:{LIGHTING_FRAGMENT:1},getUniforms:N7};var Eat=`attribute float transform_elementID;\nvec2 transform_getPixelSizeHalf(vec2 size) {\n return vec2(1.) / (2. * size);\n}\n\nvec2 transform_getPixelIndices(vec2 texSize, vec2 pixelSizeHalf) {\n float yIndex = floor((transform_elementID / texSize[0]) + pixelSizeHalf[1]);\n float xIndex = transform_elementID - (yIndex * texSize[0]);\n return vec2(xIndex, yIndex);\n}\nvec2 transform_getTexCoord(vec2 size) {\n vec2 pixelSizeHalf = transform_getPixelSizeHalf(size);\n vec2 indices = transform_getPixelIndices(size, pixelSizeHalf);\n vec2 coord = indices / size + pixelSizeHalf;\n return coord;\n}\nvec2 transform_getPos(vec2 size) {\n vec2 texCoord = transform_getTexCoord(size);\n vec2 pos = (texCoord * (2.0, 2.0)) - (1., 1.);\n return pos;\n}\nvec4 transform_getInput(sampler2D texSampler, vec2 size) {\n vec2 texCoord = transform_getTexCoord(size);\n vec4 textureColor = texture2D(texSampler, texCoord);\n return textureColor;\n}\n`,uD={name:\"transform\",vs:Eat,fs:null};var Uh=class e{static getDefaultProgramManager(t){return t.luma=t.luma||{},t.luma.defaultProgramManager=t.luma.defaultProgramManager||new e(t),t.luma.defaultProgramManager}constructor(t){this.gl=t,this._programCache={},this._getUniforms={},this._registeredModules={},this._hookFunctions=[],this._defaultModules=[],this._hashes={},this._hashCounter=0,this.stateHash=0,this._useCounts={}}addDefaultModule(t){this._defaultModules.find(r=>r.name===t.name)||this._defaultModules.push(t),this.stateHash++}removeDefaultModule(t){let r=typeof t==\"string\"?t:t.name;this._defaultModules=this._defaultModules.filter(i=>i.name!==r),this.stateHash++}addShaderHook(t,r){r&&(t=Object.assign(r,{hook:t})),this._hookFunctions.push(t),this.stateHash++}get(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{vs:r=\"\",fs:i=\"\",defines:s={},inject:n={},varyings:o=[],bufferMode:c=35981,transpileToGLSL100:f=!1}=t,_=this._getModuleList(t.modules),w=this._getHash(r),I=this._getHash(i),R=_.map(J=>this._getHash(J.name)).sort(),N=o.map(J=>this._getHash(J)),j=Object.keys(s).sort(),Q=Object.keys(n).sort(),et=[],Y=[];for(let J of j)et.push(this._getHash(J)),et.push(this._getHash(s[J]));for(let J of Q)Y.push(this._getHash(J)),Y.push(this._getHash(n[J]));let K=\"\".concat(w,\"/\").concat(I,\"D\").concat(et.join(\"/\"),\"M\").concat(R.join(\"/\"),\"I\").concat(Y.join(\"/\"),\"V\").concat(N.join(\"/\"),\"H\").concat(this.stateHash,\"B\").concat(c).concat(f?\"T\":\"\");if(!this._programCache[K]){let J=VR(this.gl,{vs:r,fs:i,modules:_,inject:n,defines:s,hookFunctions:this._hookFunctions,transpileToGLSL100:f});this._programCache[K]=new rp(this.gl,{hash:K,vs:J.vs,fs:J.fs,varyings:o,bufferMode:c}),this._getUniforms[K]=J.getUniforms||(ut=>{}),this._useCounts[K]=0}return this._useCounts[K]++,this._programCache[K]}getUniforms(t){return this._getUniforms[t.hash]||null}release(t){let r=t.hash;this._useCounts[r]--,this._useCounts[r]===0&&(this._programCache[r].delete(),delete this._programCache[r],delete this._getUniforms[r],delete this._useCounts[r])}_getHash(t){return this._hashes[t]===void 0&&(this._hashes[t]=this._hashCounter++),this._hashes[t]}_getModuleList(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=new Array(this._defaultModules.length+t.length),i={},s=0;for(let n=0,o=this._defaultModules.length;n{},Rat={},fn=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{id:i=ta(\"model\")}=r;ye(Jd(t)),this.id=i,this.gl=t,this.id=r.id||ta(\"Model\"),this.lastLogTime=0,this.animated=!1,this.initialize(r)}initialize(t){this.props={},this.programManager=t.programManager||Uh.getDefaultProgramManager(this.gl),this._programManagerState=-1,this._managedProgram=!1;let{program:r=null,vs:i,fs:s,modules:n,defines:o,inject:c,varyings:f,bufferMode:_,transpileToGLSL100:w}=t;this.programProps={program:r,vs:i,fs:s,modules:n,defines:o,inject:c,varyings:f,bufferMode:_,transpileToGLSL100:w},this.program=null,this.vertexArray=null,this._programDirty=!0,this.userData={},this.needsRedraw=!0,this._attributes={},this.attributes={},this.uniforms={},this.pickable=!0,this._checkProgram(),this.setUniforms(Object.assign({},this.getModuleUniforms(t.moduleSettings))),this.drawMode=t.drawMode!==void 0?t.drawMode:4,this.vertexCount=t.vertexCount||0,this.geometryBuffers={},this.isInstanced=t.isInstanced||t.instanced||t.instanceCount>0,this._setModelProps(t),this.geometry={},ye(this.drawMode!==void 0&&Number.isFinite(this.vertexCount),kat)}setProps(t){this._setModelProps(t)}delete(){for(let t in this._attributes)this._attributes[t]!==this.attributes[t]&&this._attributes[t].delete();this._managedProgram&&(this.programManager.release(this.program),this._managedProgram=!1),this.vertexArray.delete(),this._deleteGeometryBuffers()}getDrawMode(){return this.drawMode}getVertexCount(){return this.vertexCount}getInstanceCount(){return this.instanceCount}getAttributes(){return this.attributes}getProgram(){return this.program}setProgram(t){let{program:r,vs:i,fs:s,modules:n,defines:o,inject:c,varyings:f,bufferMode:_,transpileToGLSL100:w}=t;this.programProps={program:r,vs:i,fs:s,modules:n,defines:o,inject:c,varyings:f,bufferMode:_,transpileToGLSL100:w},this._programDirty=!0}getUniforms(){return this.uniforms}setDrawMode(t){return this.drawMode=t,this}setVertexCount(t){return ye(Number.isFinite(t)),this.vertexCount=t,this}setInstanceCount(t){return ye(Number.isFinite(t)),this.instanceCount=t,this}setGeometry(t){return this.drawMode=t.drawMode,this.vertexCount=t.getVertexCount(),this._deleteGeometryBuffers(),this.geometryBuffers=U7(this.gl,t),this.vertexArray.setAttributes(this.geometryBuffers),this}setAttributes(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Wf(t))return this;let r={};for(let i in t){let s=t[i];r[i]=s.getValue?s.getValue():s}return this.vertexArray.setAttributes(r),this}setUniforms(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.assign(this.uniforms,t),this}getModuleUniforms(t){this._checkProgram();let r=this.programManager.getUniforms(this.program);return r?r(t):{}}updateModuleSettings(t){let r=this.getModuleUniforms(t||{});return this.setUniforms(r)}clear(t){return Hf(this.program.gl,t),this}draw(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._checkProgram();let{moduleSettings:r=null,framebuffer:i,uniforms:s={},attributes:n={},transformFeedback:o=this.transformFeedback,parameters:c={},vertexArray:f=this.vertexArray}=t;this.setAttributes(n),this.updateModuleSettings(r),this.setUniforms(s);let _;He.priority>=Uy&&(_=this._logDrawCallStart(Uy));let w=this.vertexArray.getDrawParams(),{isIndexed:I=w.isIndexed,indexType:R=w.indexType,indexOffset:N=w.indexOffset,vertexArrayInstanced:j=w.isInstanced}=this.props;j&&!this.isInstanced&&He.warn(\"Found instanced attributes on non-instanced model\",this.id)();let{isInstanced:Q,instanceCount:et}=this,{onBeforeRender:Y=V7,onAfterRender:K=V7}=this.props;Y(),this.program.setUniforms(this.uniforms);let J=this.program.draw(Object.assign(Rat,t,{logPriority:_,uniforms:null,framebuffer:i,parameters:c,drawMode:this.getDrawMode(),vertexCount:this.getVertexCount(),vertexArray:f,transformFeedback:o,isIndexed:I,indexType:R,isInstanced:Q,instanceCount:et,offset:I?N:0}));return K(),He.priority>=Uy&&this._logDrawCallEnd(_,f,i),J}transform(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{discard:r=!0,feedbackBuffers:i,unbindModels:s=[]}=t,{parameters:n}=t;i&&this._setFeedbackBuffers(i),r&&(n=Object.assign({},n,{35977:r})),s.forEach(o=>o.vertexArray.unbindBuffers());try{this.draw(Object.assign({},t,{parameters:n}))}finally{s.forEach(o=>o.vertexArray.bindBuffers())}return this}render(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return He.warn(\"Model.render() is deprecated. Use Model.setUniforms() and Model.draw()\")(),this.setUniforms(t).draw()}_setModelProps(t){Object.assign(this.props,t),\"uniforms\"in t&&this.setUniforms(t.uniforms),\"pickable\"in t&&(this.pickable=t.pickable),\"instanceCount\"in t&&(this.instanceCount=t.instanceCount),\"geometry\"in t&&this.setGeometry(t.geometry),\"attributes\"in t&&this.setAttributes(t.attributes),\"_feedbackBuffers\"in t&&this._setFeedbackBuffers(t._feedbackBuffers)}_checkProgram(){if(!(this._programDirty||this.programManager.stateHash!==this._programManagerState))return;let{program:r}=this.programProps;if(r)this._managedProgram=!1;else{let{vs:i,fs:s,modules:n,inject:o,defines:c,varyings:f,bufferMode:_,transpileToGLSL100:w}=this.programProps;r=this.programManager.get({vs:i,fs:s,modules:n,inject:o,defines:c,varyings:f,bufferMode:_,transpileToGLSL100:w}),this.program&&this._managedProgram&&this.programManager.release(this.program),this._programManagerState=this.programManager.stateHash,this._managedProgram=!0}ye(r instanceof rp,\"Model needs a program\"),this._programDirty=!1,r!==this.program&&(this.program=r,this.vertexArray?this.vertexArray.setProps({program:this.program,attributes:this.vertexArray.attributes}):this.vertexArray=new Iy(this.gl,{program:this.program}),this.setUniforms(Object.assign({},this.getModuleUniforms())))}_deleteGeometryBuffers(){for(let t in this.geometryBuffers){let r=this.geometryBuffers[t][0]||this.geometryBuffers[t];r instanceof Fr&&r.delete()}}_setAnimationProps(t){this.animated&&ye(t,\"Model.draw(): animated uniforms but no animationProps\")}_setFeedbackBuffers(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Wf(t))return this;let{gl:r}=this.program;return this.transformFeedback=this.transformFeedback||new ip(r,{program:this.program}),this.transformFeedback.setBuffers(t),this}_logDrawCallStart(t){let r=t>3?0:Lat;if(!(Date.now()-this.lastLogTime>> DRAWING MODEL \".concat(this.id),{collapsed:He.level<=2})(),t}_logDrawCallEnd(t,r,i,s){if(t===void 0)return;let n=CR({vertexArray:r,header:\"\".concat(this.id,\" attributes\"),attributes:this._attributes}),{table:o,unusedTable:c,unusedCount:f}=ME({header:\"\".concat(this.id,\" uniforms\"),program:this.program,uniforms:Object.assign({},this.program.uniforms,i)}),{table:_,count:w}=ME({header:\"\".concat(this.id,\" uniforms\"),program:this.program,uniforms:Object.assign({},this.program.uniforms,i),undefinedOnly:!0});w>0&&He.log(\"MISSING UNIFORMS\",Object.keys(_))(),f>0&&He.log(\"UNUSED UNIFORMS\",Object.keys(c))();let I=LR(this.vertexArray.configuration);He.table(t,n)(),He.table(t,o)(),He.table(t+1,I)(),s&&s.log({logLevel:Uy,message:\"Rendered to \".concat(s.id)}),He.groupEnd(Uy)()}};var Eb=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.currentIndex=0,this.feedbackMap={},this.varyings=null,this.bindings=[],this.resources={},this._initialize(r),Object.seal(this)}setupResources(t){for(let r of this.bindings)this._setupTransformFeedback(r,t)}updateModelProps(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{varyings:r}=this;return r.length>0&&(t=Object.assign({},t,{varyings:r})),t}getDrawOptions(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=this.bindings[this.currentIndex],{sourceBuffers:i,transformFeedback:s}=r;return{attributes:Object.assign({},i,t.attributes),transformFeedback:s}}swap(){return this.feedbackMap?(this.currentIndex=this._getNextIndex(),!0):!1}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._setupBuffers(t)}getBuffer(t){let{feedbackBuffers:r}=this.bindings[this.currentIndex],i=t?r[t]:null;return i?i instanceof Fr?i:i.buffer:null}getData(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{varyingName:r}=t,i=this.getBuffer(r);return i?i.getData():null}delete(){for(let t in this.resources)this.resources[t].delete()}_initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._setupBuffers(t),this.varyings=t.varyings||Object.keys(this.bindings[this.currentIndex].feedbackBuffers),this.varyings.length>0&&ye(fr(this.gl))}_getFeedbackBuffers(t){let{sourceBuffers:r={}}=t,i={};if(this.bindings[this.currentIndex]&&Object.assign(i,this.bindings[this.currentIndex].feedbackBuffers),this.feedbackMap)for(let s in this.feedbackMap){let n=this.feedbackMap[s];s in r&&(i[n]=s)}Object.assign(i,t.feedbackBuffers);for(let s in i){let n=i[s];if(typeof n==\"string\"){let o=r[n],{byteLength:c,usage:f,accessor:_}=o;i[s]=this._createNewBuffer(s,{byteLength:c,usage:f,accessor:_})}}return i}_setupBuffers(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{sourceBuffers:r=null}=t;Object.assign(this.feedbackMap,t.feedbackMap);let i=this._getFeedbackBuffers(t);this._updateBindings({sourceBuffers:r,feedbackBuffers:i})}_setupTransformFeedback(t,r){let{model:i}=r,{program:s}=i;t.transformFeedback=new ip(this.gl,{program:s,buffers:t.feedbackBuffers})}_updateBindings(t){if(this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t),this.feedbackMap){let{sourceBuffers:r,feedbackBuffers:i}=this._swapBuffers(this.bindings[this.currentIndex]),s=this._getNextIndex();this.bindings[s]=this._updateBinding(this.bindings[s],{sourceBuffers:r,feedbackBuffers:i})}}_updateBinding(t,r){return t?(Object.assign(t.sourceBuffers,r.sourceBuffers),Object.assign(t.feedbackBuffers,r.feedbackBuffers),t.transformFeedback&&t.transformFeedback.setBuffers(t.feedbackBuffers),t):{sourceBuffers:Object.assign({},r.sourceBuffers),feedbackBuffers:Object.assign({},r.feedbackBuffers)}}_swapBuffers(t){if(!this.feedbackMap)return null;let r=Object.assign({},t.sourceBuffers),i=Object.assign({},t.feedbackBuffers);for(let s in this.feedbackMap){let n=this.feedbackMap[s];r[s]=t.feedbackBuffers[n],i[n]=t.sourceBuffers[s],ye(i[n]instanceof Fr)}return{sourceBuffers:r,feedbackBuffers:i}}_createNewBuffer(t,r){let i=new Fr(this.gl,r);return this.resources[t]&&this.resources[t].delete(),this.resources[t]=i,i}_getNextIndex(){return(this.currentIndex+1)%2}};var Dat=\"transform_uSampler_\",$E=\"transform_uSize_\",j7=\"transform_position\";function G7(e){let{vs:t,sourceTextureMap:r,targetTextureVarying:i,targetTexture:s}=e,o=Object.keys(r).length,c=null,f={},_=t,w={};if(o>0||i){let I=_.split(`\n`),R=I.slice();if(I.forEach((N,j,Q)=>{if(o>0){let et=zat(N,r);if(et){let{updatedLine:Y,inject:K}=et;R[j]=Y,w=Ly([w,K]),Object.assign(f,et.samplerTextureMap),o--}}i&&!c&&(c=Fat(N,i))}),i){ye(s);let N=\"\".concat($E).concat(i),j=\"uniform vec2 \".concat(N,`;\n`),Q=\" vec2 \".concat(j7,\" = transform_getPos(\").concat(N,`);\n gl_Position = vec4(`).concat(j7,`, 0, 1.);\n`);w=Ly([w,{\"vs:#decl\":j,\"vs:#main-start\":Q}])}_=R.join(`\n`)}return{vs:_,targetTextureType:c,inject:w,samplerTextureMap:f}}function W7(e){let{sourceTextureMap:t,targetTextureVarying:r,targetTexture:i}=e,s={},n,o;r&&({width:n,height:o}=i,s[\"\".concat($E).concat(r)]=[n,o]);for(let c in t)({width:n,height:o}=t[c]),s[\"\".concat($E).concat(c)]=[n,o];return s}function Oat(e){return IE(e,[\"attribute\",\"in\"])}function Bat(e){let t=\"\".concat(Dat).concat(e),r=\"\".concat($E).concat(e),i=\" uniform sampler2D \".concat(t,`;\n uniform vec2 `).concat(r,\";\");return{samplerName:t,sizeName:r,uniformDeclerations:i}}function Fat(e,t){let r=IE(e,[\"varying\",\"out\"]);return r&&r.name===t?r.type:null}function zat(e,t){let r={},i=Oat(e);if(!i)return null;let{type:s,name:n}=i;if(n&&t[n]){let o=\"// \".concat(e,\" => Replaced by Transform with a sampler\"),{samplerName:c,sizeName:f,uniformDeclerations:_}=Bat(n),w=jR(s),I=\" \".concat(s,\" \").concat(n,\" = transform_getInput(\").concat(c,\", \").concat(f,\").\").concat(w,`;\n`);return r[c]=n,{updatedLine:o,inject:{\"vs:#decl\":_,\"vs:#main-start\":I},samplerTextureMap:r}}return null}var Nat={10241:9728,10240:9728,10242:33071,10243:33071},Uat=\"transform_output\",Pb=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.id=this.currentIndex=0,this._swapTexture=null,this.targetTextureVarying=null,this.targetTextureType=null,this.samplerTextureMap=null,this.bindings=[],this.resources={},this._initialize(r),Object.seal(this)}updateModelProps(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=this._processVertexShader(t);return Object.assign({},t,r)}getDrawOptions(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{sourceBuffers:r,sourceTextures:i,framebuffer:s,targetTexture:n}=this.bindings[this.currentIndex],o=Object.assign({},r,t.attributes),c=Object.assign({},t.uniforms),f=Object.assign({},t.parameters),_=t.discard;if(this.hasSourceTextures||this.hasTargetTexture){o.transform_elementID=this.elementIDBuffer;for(let I in this.samplerTextureMap){let R=this.samplerTextureMap[I];c[I]=i[R]}this._setSourceTextureParameters();let w=W7({sourceTextureMap:i,targetTextureVarying:this.targetTextureVarying,targetTexture:n});Object.assign(c,w)}return this.hasTargetTexture&&(_=!1,f.viewport=[0,0,s.width,s.height]),{attributes:o,framebuffer:s,uniforms:c,discard:_,parameters:f}}swap(){return this._swapTexture?(this.currentIndex=this._getNextIndex(),!0):!1}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._setupTextures(t)}getTargetTexture(){let{targetTexture:t}=this.bindings[this.currentIndex];return t}getData(){let{packed:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{framebuffer:r}=this.bindings[this.currentIndex],i=Dh(r);if(!t)return i;let s=i.constructor,n=GR(this.targetTextureType),o=new s(i.length*n/4),c=0;for(let f=0;f0&&arguments[0]!==void 0?arguments[0]:{},{_targetTextureVarying:r,_swapTexture:i}=t;this._swapTexture=i,this.targetTextureVarying=r,this.hasTargetTexture=r,this._setupTextures(t)}_createTargetTexture(t){let{sourceTextures:r,textureOrReference:i}=t;if(i instanceof pi)return i;let s=r[i];return s?(this._targetRefTexName=i,this._createNewTexture(s)):null}_setupTextures(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{sourceBuffers:r,_sourceTextures:i={},_targetTexture:s}=t,n=this._createTargetTexture({sourceTextures:i,textureOrReference:s});this.hasSourceTextures=this.hasSourceTextures||i&&Object.keys(i).length>0,this._updateBindings({sourceBuffers:r,sourceTextures:i,targetTexture:n}),\"elementCount\"in t&&this._updateElementIDBuffer(t.elementCount)}_updateElementIDBuffer(t){if(typeof t!=\"number\"||this.elementCount>=t)return;let r=new Float32Array(t);r.forEach((i,s,n)=>{n[s]=s}),this.elementIDBuffer?this.elementIDBuffer.setData({data:r}):this.elementIDBuffer=new Fr(this.gl,{data:r,accessor:{size:1}}),this.elementCount=t}_updateBindings(t){if(this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t),this._swapTexture){let{sourceTextures:r,targetTexture:i}=this._swapTextures(this.bindings[this.currentIndex]),s=this._getNextIndex();this.bindings[s]=this._updateBinding(this.bindings[s],{sourceTextures:r,targetTexture:i})}}_updateBinding(t,r){let{sourceBuffers:i,sourceTextures:s,targetTexture:n}=r;if(t||(t={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(t.sourceTextures,s),Object.assign(t.sourceBuffers,i),n){t.targetTexture=n;let{width:o,height:c}=n,{framebuffer:f}=t;f?(f.update({attachments:{36064:n},resizeAttachments:!1}),f.resize({width:o,height:c})):t.framebuffer=new yi(this.gl,{id:\"transform-framebuffer\",width:o,height:c,attachments:{36064:n}})}return t}_setSourceTextureParameters(){let t=this.currentIndex,{sourceTextures:r}=this.bindings[t];for(let i in r)r[i].setParameters(Nat)}_swapTextures(t){if(!this._swapTexture)return null;let r=Object.assign({},t.sourceTextures);r[this._swapTexture]=t.targetTexture;let i=t.sourceTextures[this._swapTexture];return{sourceTextures:r,targetTexture:i}}_createNewTexture(t){let r=yE(t,{parameters:{10241:9728,10240:9728,10242:33071,10243:33071},pixelStore:{37440:!1}});return this.ownTexture&&this.ownTexture.delete(),this.ownTexture=r,r}_getNextIndex(){return(this.currentIndex+1)%2}_processVertexShader(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{sourceTextures:r,targetTexture:i}=this.bindings[this.currentIndex],{vs:s,uniforms:n,targetTextureType:o,inject:c,samplerTextureMap:f}=G7({vs:t.vs,sourceTextureMap:r,targetTextureVarying:this.targetTextureVarying,targetTexture:i}),_=Ly([t.inject||{},c]);this.targetTextureType=o,this.samplerTextureMap=f;let w=t._fs||bb({version:Py(s),input:this.targetTextureVarying,inputType:o,output:Uat}),I=this.hasSourceTextures||this.targetTextureVarying?[uD].concat(t.modules||[]):t.modules;return{vs:s,fs:w,modules:I,uniforms:n,inject:_}}};var nc=class{static isSupported(t){return fr(t)}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.model=null,this.elementCount=0,this.bufferTransform=null,this.textureTransform=null,this.elementIDBuffer=null,this._initialize(r),Object.seal(this)}delete(){let{model:t,bufferTransform:r,textureTransform:i}=this;t&&t.delete(),r&&r.delete(),i&&i.delete()}run(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{clearRenderTarget:r=!0}=t,i=this._updateDrawOptions(t);r&&i.framebuffer&&i.framebuffer.clear({color:!0}),this.model.transform(i)}swap(){let t=!1,r=[this.bufferTransform,this.textureTransform].filter(Boolean);for(let i of r)t=t||i.swap();ye(t,\"Nothing to swap\")}getBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.bufferTransform&&this.bufferTransform.getBuffer(t)}getData(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=[this.bufferTransform,this.textureTransform].filter(Boolean);for(let i of r){let s=i.getData(t);if(s)return s}return null}getFramebuffer(){return this.textureTransform&&this.textureTransform.getFramebuffer()}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};\"elementCount\"in t&&this.model.setVertexCount(t.elementCount);let r=[this.bufferTransform,this.textureTransform].filter(Boolean);for(let i of r)i.update(t)}_initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{gl:r}=this;this._buildResourceTransforms(r,t),t=this._updateModelProps(t),this.model=new fn(r,Object.assign({},t,{fs:t.fs||bb({version:Py(t.vs)}),id:t.id||\"transform-model\",drawMode:t.drawMode||0,vertexCount:t.elementCount})),this.bufferTransform&&this.bufferTransform.setupResources({model:this.model})}_updateModelProps(t){let r=Object.assign({},t),i=[this.bufferTransform,this.textureTransform].filter(Boolean);for(let s of i)r=s.updateModelProps(r);return r}_buildResourceTransforms(t,r){Vat(r)&&(this.bufferTransform=new Eb(t,r)),jat(r)&&(this.textureTransform=new Pb(t,r)),ye(this.bufferTransform||this.textureTransform,\"must provide source/feedback buffers or source/target textures\")}_updateDrawOptions(t){let r=Object.assign({},t),i=[this.bufferTransform,this.textureTransform].filter(Boolean);for(let s of i)r=Object.assign(r,s.getDrawOptions(r));return r}};function Vat(e){return!!(!Wf(e.feedbackBuffers)||!Wf(e.feedbackMap)||e.varyings&&e.varyings.length>0)}function jat(e){return!!(!Wf(e._sourceTextures)||e._targetTexture||e._targetTextureVarying)}var H7={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},$n=class{static get DRAW_MODE(){return H7}constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{id:r=ta(\"geometry\"),drawMode:i=H7.TRIANGLES,attributes:s={},indices:n=null,vertexCount:o=null}=t;this.id=r,this.drawMode=i|0,this.attributes={},this.userData={},this._setAttributes(s,n),this.vertexCount=o||this._calculateVertexCount(this.attributes,this.indices)}get mode(){return this.drawMode}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(t){return\"Geometry \".concat(this.id,\" attribute \").concat(t)}_setAttributes(t,r){r&&(this.indices=ArrayBuffer.isView(r)?{value:r,size:1}:r);for(let i in t){let s=t[i];s=ArrayBuffer.isView(s)?{value:s}:s,ye(ArrayBuffer.isView(s.value),\"\".concat(this._print(i),\": must be typed array or object with value as typed array\")),(i===\"POSITION\"||i===\"positions\")&&!s.size&&(s.size=3),i===\"indices\"?(ye(!this.indices),this.indices=s):this.attributes[i]=s}return this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this}_calculateVertexCount(t,r){if(r)return r.value.length;let i=1/0;for(let s in t){let n=t[s],{value:o,size:c,constant:f}=n;!f&&o&&c>=1&&(i=Math.min(i,o.length/c))}return ye(Number.isFinite(i)),i}};var Gat=1,Wat=1,KA=class{constructor(){this.time=0,this.channels=new Map,this.animations=new Map,this.playing=!1,this.lastEngineTime=-1}addChannel(t){let{delay:r=0,duration:i=Number.POSITIVE_INFINITY,rate:s=1,repeat:n=1}=t,o=Gat++,c={time:0,delay:r,duration:i,rate:s,repeat:n};return this._setChannelTime(c,this.time),this.channels.set(o,c),o}removeChannel(t){this.channels.delete(t);for(let[r,i]of this.animations)i.channel===t&&this.detachAnimation(r)}isFinished(t){let r=this.channels.get(t);return r===void 0?!1:this.time>=r.delay+r.duration*r.repeat}getTime(t){if(t===void 0)return this.time;let r=this.channels.get(t);return r===void 0?-1:r.time}setTime(t){this.time=Math.max(0,t);let r=this.channels.values();for(let s of r)this._setChannelTime(s,this.time);let i=this.animations.values();for(let s of i){let{animation:n,channel:o}=s;n.setTime(this.getTime(o))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(t,r){let i=Wat++;return this.animations.set(i,{animation:t,channel:r}),t.setTime(this.getTime(r)),i}detachAnimation(t){this.animations.delete(t)}update(t){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=t),this.setTime(this.time+(t-this.lastEngineTime)),this.lastEngineTime=t)}_setChannelTime(t,r){let i=r-t.delay,s=t.duration*t.repeat;i>=s?t.time=t.duration*t.rate:(t.time=Math.max(0,i)%t.duration,t.time*=t.rate)}};var Hat=[255,255,255],qat=1,Zat=0,XE=class{constructor(t={}){G(this,\"id\",void 0),G(this,\"color\",void 0),G(this,\"intensity\",void 0),G(this,\"type\",\"ambient\");let{color:r=Hat}=t,{intensity:i=qat}=t;this.id=t.id||\"ambient-\".concat(Zat++),this.color=r,this.intensity=i}};var Yat=[255,255,255],Qat=1,$at=[0,0,-1],Xat=0,Ib=class{constructor(t={}){G(this,\"id\",void 0),G(this,\"color\",void 0),G(this,\"intensity\",void 0),G(this,\"type\",\"directional\"),G(this,\"direction\",void 0),G(this,\"shadow\",void 0);let{color:r=Yat}=t,{intensity:i=Qat}=t,{direction:s=$at}=t,{_shadow:n=!1}=t;this.id=t.id||\"directional-\".concat(Xat++),this.color=r,this.intensity=i,this.type=\"directional\",this.direction=new Ve(s).normalize().toArray(),this.shadow=n}getProjectedLight(t){return this}};var Cb=class{constructor(t,r={id:\"pass\"}){G(this,\"id\",void 0),G(this,\"gl\",void 0),G(this,\"props\",void 0);let{id:i}=r;this.id=i,this.gl=t,this.props={...r}}setProps(t){Object.assign(this.props,t)}render(t){}cleanup(){}};var sc=class extends Cb{constructor(...t){super(...t),G(this,\"_lastRenderIndex\",-1)}render(t){let r=this.gl;return Ml(r,{framebuffer:t.target}),this._drawLayers(t)}_drawLayers(t){let{target:r,moduleParameters:i,viewports:s,views:n,onViewportActive:o,clearStack:c=!0,clearCanvas:f=!0}=t;t.pass=t.pass||\"unknown\";let _=this.gl;f&&Jat(_,r),c&&(this._lastRenderIndex=-1);let w=[];for(let I of s){let R=n&&n[I.id];o?.(I);let N=this._getDrawLayerParams(I,t),j=I.subViewports||[I];for(let Q of j){let et=this._drawLayersInViewport(_,{target:r,moduleParameters:i,viewport:Q,view:R,pass:t.pass,layers:t.layers},N);w.push(et)}}return w}_getDrawLayerParams(t,{layers:r,pass:i,isPicking:s=!1,layerFilter:n,cullRect:o,effects:c,moduleParameters:f},_=!1){let w=[],I=q7(this._lastRenderIndex+1),R={layer:r[0],viewport:t,isPicking:s,renderPass:i,cullRect:o},N={};for(let j=0;jHf(t,I))}let w={totalCount:r.length,visibleCount:0,compositeCount:0,pickableCount:0};Ml(t,{viewport:_});for(let I=0;I{let o=s.props._offset,c=s.id,f=s.parent&&s.parent.id,_;if(f&&!(f in t)&&i(s.parent,!1),f in r){let w=r[f]=r[f]||q7(t[f],t);_=w(s,n),r[c]=w}else Number.isFinite(o)?(_=o+(t[f]||0),r[c]=null):_=e;return n&&_>=e&&(e=_+1),t[c]=_,_};return i}function Kat(e,{moduleParameters:t,target:r,viewport:i}){let s=r&&r.id!==\"default-framebuffer\",n=t&&t.devicePixelRatio||El(e),o=s?r.height:e.drawingBufferHeight,c=i;return[c.x*n,o-(c.y+c.height)*n,c.width*n,c.height*n]}function Jat(e,t){let r=t?t.width:e.drawingBufferWidth,i=t?t.height:e.drawingBufferHeight;Ml(e,{viewport:[0,0,r,i]}),e.clear(16640)}var Lb=class extends sc{constructor(t,r){super(t,r),G(this,\"shadowMap\",void 0),G(this,\"depthBuffer\",void 0),G(this,\"fbo\",void 0),this.shadowMap=new pi(t,{width:1,height:1,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.depthBuffer=new el(t,{format:33189,width:1,height:1}),this.fbo=new yi(t,{id:\"shadowmap\",width:1,height:1,attachments:{36064:this.shadowMap,36096:this.depthBuffer}})}render(t){let r=this.fbo;Mn(this.gl,{depthRange:[0,1],depthTest:!0,blend:!1,clearColor:[1,1,1,1]},()=>{let i=t.viewports[0],s=El(this.gl),n=i.width*s,o=i.height*s;(n!==r.width||o!==r.height)&&r.resize({width:n,height:o}),super.render({...t,target:r,pass:\"shadow\"})})}shouldDrawLayer(t){return t.props.shadowEnabled!==!1}getModuleParameters(){return{drawToShadowMap:!0}}delete(){this.fbo&&(this.fbo.delete(),this.fbo=null),this.shadowMap&&(this.shadowMap.delete(),this.shadowMap=null),this.depthBuffer&&(this.depthBuffer.delete(),this.depthBuffer=null)}};var Z7=\"#define SMOOTH_EDGE_RADIUS 0.5\",tlt=`\n`.concat(Z7,`\n\nstruct VertexGeometry {\n vec4 position;\n vec3 worldPosition;\n vec3 worldPositionAlt;\n vec3 normal;\n vec2 uv;\n vec3 pickingColor;\n} geometry = VertexGeometry(\n vec4(0.0, 0.0, 1.0, 0.0),\n vec3(0.0),\n vec3(0.0),\n vec3(0.0),\n vec2(0.0),\n vec3(0.0)\n);\n`),elt=`\n`.concat(Z7,`\n\nstruct FragmentGeometry {\n vec2 uv;\n} geometry;\n\nfloat smoothedge(float edge, float x) {\n return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);\n}\n`),Y7={name:\"geometry\",vs:tlt,fs:elt};var rlt=Object.keys(Yr).map(e=>\"const int COORDINATE_SYSTEM_\".concat(e,\" = \").concat(Yr[e],\";\")).join(\"\"),ilt=Object.keys(Ja).map(e=>\"const int PROJECTION_MODE_\".concat(e,\" = \").concat(Ja[e],\";\")).join(\"\"),nlt=Object.keys(po).map(e=>\"const int UNIT_\".concat(e.toUpperCase(),\" = \").concat(po[e],\";\")).join(\"\"),Q7=\"\".concat(rlt,`\n`).concat(ilt,`\n`).concat(nlt,`\n\nuniform int project_uCoordinateSystem;\nuniform int project_uProjectionMode;\nuniform float project_uScale;\nuniform bool project_uWrapLongitude;\nuniform vec3 project_uCommonUnitsPerMeter;\nuniform vec3 project_uCommonUnitsPerWorldUnit;\nuniform vec3 project_uCommonUnitsPerWorldUnit2;\nuniform vec4 project_uCenter;\nuniform mat4 project_uModelMatrix;\nuniform mat4 project_uViewProjectionMatrix;\nuniform vec2 project_uViewportSize;\nuniform float project_uDevicePixelRatio;\nuniform float project_uFocalDistance;\nuniform vec3 project_uCameraPosition;\nuniform vec3 project_uCoordinateOrigin;\nuniform vec3 project_uCommonOrigin;\nuniform bool project_uPseudoMeters;\n\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / (PI * 2.0);\nconst vec3 ZERO_64_LOW = vec3(0.0);\nconst float EARTH_RADIUS = 6370972.0;\nconst float GLOBE_RADIUS = 256.0;\nfloat project_size_at_latitude(float lat) {\n float y = clamp(lat, -89.9, 89.9);\n return 1.0 / cos(radians(y));\n}\n\nfloat project_size() {\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR &&\n project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT &&\n project_uPseudoMeters == false) {\n \n if (geometry.position.w == 0.0) {\n return project_size_at_latitude(geometry.worldPosition.y);\n }\n \n float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0;\n float y2 = y * y;\n float y4 = y2 * y2;\n float y6 = y4 * y2;\n return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;\n }\n return 1.0;\n}\n\nfloat project_size_at_latitude(float meters, float lat) {\n return meters * project_uCommonUnitsPerMeter.z * project_size_at_latitude(lat);\n}\nfloat project_size(float meters) {\n return meters * project_uCommonUnitsPerMeter.z * project_size();\n}\n\nvec2 project_size(vec2 meters) {\n return meters * project_uCommonUnitsPerMeter.xy * project_size();\n}\n\nvec3 project_size(vec3 meters) {\n return meters * project_uCommonUnitsPerMeter * project_size();\n}\n\nvec4 project_size(vec4 meters) {\n return vec4(meters.xyz * project_uCommonUnitsPerMeter, meters.w);\n}\nmat3 project_get_orientation_matrix(vec3 up) {\n vec3 uz = normalize(up);\n vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0));\n vec3 uy = cross(uz, ux);\n return mat3(ux, uy, uz);\n}\n\nbool project_needs_rotation(vec3 commonPosition, out mat3 transform) {\n if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {\n transform = project_get_orientation_matrix(commonPosition);\n return true;\n }\n return false;\n}\nvec3 project_normal(vec3 vector) {\n vec4 normal_modelspace = project_uModelMatrix * vec4(vector, 0.0);\n vec3 n = normalize(normal_modelspace.xyz * project_uCommonUnitsPerMeter);\n mat3 rotation;\n if (project_needs_rotation(geometry.position.xyz, rotation)) {\n n = rotation * n;\n }\n return n;\n}\n\nvec4 project_offset_(vec4 offset) {\n float dy = offset.y;\n vec3 commonUnitsPerWorldUnit = project_uCommonUnitsPerWorldUnit + project_uCommonUnitsPerWorldUnit2 * dy;\n return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w);\n}\nvec2 project_mercator_(vec2 lnglat) {\n float x = lnglat.x;\n if (project_uWrapLongitude) {\n x = mod(x + 180., 360.0) - 180.;\n }\n float y = clamp(lnglat.y, -89.9, 89.9);\n return vec2(\n radians(x) + PI,\n PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5))\n ) * WORLD_SCALE;\n}\n\nvec3 project_globe_(vec3 lnglatz) {\n float lambda = radians(lnglatz.x);\n float phi = radians(lnglatz.y);\n float cosPhi = cos(phi);\n float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;\n\n return vec3(\n sin(lambda) * cosPhi,\n -cos(lambda) * cosPhi,\n sin(phi)\n ) * D;\n}\nvec4 project_position(vec4 position, vec3 position64Low) {\n vec4 position_world = project_uModelMatrix * position;\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n return vec4(\n project_mercator_(position_world.xy),\n project_size_at_latitude(position_world.z, position_world.y),\n position_world.w\n );\n }\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {\n position_world.xyz += project_uCoordinateOrigin;\n }\n }\n if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n return vec4(\n project_globe_(position_world.xyz),\n position_world.w\n );\n }\n }\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n if (abs(position_world.y - project_uCoordinateOrigin.y) > 0.25) {\n return vec4(\n project_mercator_(position_world.xy) - project_uCommonOrigin.xy,\n project_size(position_world.z),\n position_world.w\n );\n }\n }\n }\n if (project_uProjectionMode == PROJECTION_MODE_IDENTITY ||\n (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&\n (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {\n position_world.xyz -= project_uCoordinateOrigin;\n }\n return project_offset_(position_world) + project_offset_(project_uModelMatrix * vec4(position64Low, 0.0));\n}\n\nvec4 project_position(vec4 position) {\n return project_position(position, ZERO_64_LOW);\n}\n\nvec3 project_position(vec3 position, vec3 position64Low) {\n vec4 projected_position = project_position(vec4(position, 1.0), position64Low);\n return projected_position.xyz;\n}\n\nvec3 project_position(vec3 position) {\n vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW);\n return projected_position.xyz;\n}\n\nvec2 project_position(vec2 position) {\n vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW);\n return projected_position.xy;\n}\n\nvec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {\n return viewProjectionMatrix * position + center;\n}\nvec4 project_common_position_to_clipspace(vec4 position) {\n return project_common_position_to_clipspace(position, project_uViewProjectionMatrix, project_uCenter);\n}\nvec2 project_pixel_size_to_clipspace(vec2 pixels) {\n vec2 offset = pixels / project_uViewportSize * project_uDevicePixelRatio * 2.0;\n return offset * project_uFocalDistance;\n}\n\nfloat project_size_to_pixel(float meters) {\n return project_size(meters) * project_uScale;\n}\nfloat project_size_to_pixel(float size, int unit) {\n if (unit == UNIT_METERS) return project_size_to_pixel(size);\n if (unit == UNIT_COMMON) return size * project_uScale;\n return size;\n}\nfloat project_pixel_size(float pixels) {\n return pixels / project_uScale;\n}\nvec2 project_pixel_size(vec2 pixels) {\n return pixels / project_uScale;\n}\n`);function slt(e,t){if(e===t)return!0;if(Array.isArray(e)){let r=e.length;if(!t||t.length!==r)return!1;for(let i=0;i{for(let s in i)if(!slt(i[s],t[s])){r=e(i),t=i;break}return r}}var $7=[0,0,0,0],olt=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],X7=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],alt=[0,0,0],K7=[0,0,0],llt=Yf(ult);function hD(e,t,r=K7){r.length<3&&(r=[r[0],r[1],0]);let i=r,s,n=!0;switch(t===Yr.LNGLAT_OFFSETS||t===Yr.METER_OFFSETS?s=r:s=e.isGeospatial?[Math.fround(e.longitude),Math.fround(e.latitude),0]:null,e.projectionMode){case Ja.WEB_MERCATOR:(t===Yr.LNGLAT||t===Yr.CARTESIAN)&&(s=[0,0,0],n=!1);break;case Ja.WEB_MERCATOR_AUTO_OFFSET:t===Yr.LNGLAT?i=s:t===Yr.CARTESIAN&&(i=[Math.fround(e.center[0]),Math.fround(e.center[1]),0],s=e.unprojectPosition(i),i[0]-=r[0],i[1]-=r[1],i[2]-=r[2]);break;case Ja.IDENTITY:i=e.position.map(Math.fround),i[2]=i[2]||0;break;case Ja.GLOBE:n=!1,s=null;break;default:n=!1}return{geospatialOrigin:s,shaderCoordinateOrigin:i,offsetMode:n}}function clt(e,t,r){let{viewMatrixUncentered:i,projectionMatrix:s}=e,{viewMatrix:n,viewProjectionMatrix:o}=e,c=$7,f=$7,_=e.cameraPosition,{geospatialOrigin:w,shaderCoordinateOrigin:I,offsetMode:R}=hD(e,t,r);return R&&(f=e.projectPosition(w||I),_=[_[0]-f[0],_[1]-f[1],_[2]-f[2]],f[3]=1,c=Nh([],f,o),n=i||n,o=qf([],s,n),o=qf([],o,olt)),{viewMatrix:n,viewProjectionMatrix:o,projectionCenter:c,originCommon:f,cameraPosCommon:_,shaderCoordinateOrigin:I,geospatialOrigin:w}}function J7({viewport:e,devicePixelRatio:t=1,modelMatrix:r=null,coordinateSystem:i=Yr.DEFAULT,coordinateOrigin:s=K7,autoWrapLongitude:n=!1}){i===Yr.DEFAULT&&(i=e.isGeospatial?Yr.LNGLAT:Yr.CARTESIAN);let o=llt({viewport:e,devicePixelRatio:t,coordinateSystem:i,coordinateOrigin:s});return o.project_uWrapLongitude=n,o.project_uModelMatrix=r||X7,o}function ult({viewport:e,devicePixelRatio:t,coordinateSystem:r,coordinateOrigin:i}){let{projectionCenter:s,viewProjectionMatrix:n,originCommon:o,cameraPosCommon:c,shaderCoordinateOrigin:f,geospatialOrigin:_}=clt(e,r,i),w=e.getDistanceScales(),I=[e.width*t,e.height*t],R=Nh([],[0,0,-e.focalDistance,1],e.projectionMatrix)[3]||1,N={project_uCoordinateSystem:r,project_uProjectionMode:e.projectionMode,project_uCoordinateOrigin:f,project_uCommonOrigin:o.slice(0,3),project_uCenter:s,project_uPseudoMeters:!!e._pseudoMeters,project_uViewportSize:I,project_uDevicePixelRatio:t,project_uFocalDistance:R,project_uCommonUnitsPerMeter:w.unitsPerMeter,project_uCommonUnitsPerWorldUnit:w.unitsPerMeter,project_uCommonUnitsPerWorldUnit2:alt,project_uScale:e.scale,project_uWrapLongitude:!1,project_uViewProjectionMatrix:n,project_uModelMatrix:X7,project_uCameraPosition:c};if(_){let j=e.getDistanceScales(_);switch(r){case Yr.METER_OFFSETS:N.project_uCommonUnitsPerWorldUnit=j.unitsPerMeter,N.project_uCommonUnitsPerWorldUnit2=j.unitsPerMeter2;break;case Yr.LNGLAT:case Yr.LNGLAT_OFFSETS:e._pseudoMeters||(N.project_uCommonUnitsPerMeter=j.unitsPerMeter),N.project_uCommonUnitsPerWorldUnit=j.unitsPerDegree,N.project_uCommonUnitsPerWorldUnit2=j.unitsPerDegree2;break;case Yr.CARTESIAN:N.project_uCommonUnitsPerWorldUnit=[1,1,j.unitsPerMeter[2]],N.project_uCommonUnitsPerWorldUnit2=[0,0,j.unitsPerMeter2[2]];break;default:break}}return N}var hlt={};function flt(e=hlt){return\"viewport\"in e?J7(e):{}}var Vh={name:\"project\",dependencies:[CE,Y7],vs:Q7,getUniforms:flt};function fD(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function JA(e,t){let r=Nh([],t,e);return Fy(r,r,1/r[3]),r}function dD(e,t){let r=e%t;return r<0?t+r:r}function tG(e,t,r){return r*t+(1-r)*e}function kb(e,t,r){return er?r:e}function dlt(e){return Math.log(e)*Math.LOG2E}var Vy=Math.log2||dlt;function Bu(e,t){if(!e)throw new Error(t||\"@math.gl/web-mercator: assertion failed.\")}var jh=Math.PI,eG=jh/4,Fu=jh/180,pD=180/jh,jy=512,KE=4003e4,Gy=85.051129,rG=1.5;function Rb(e){return Math.pow(2,e)}function JE(e){return Vy(e)}function va(e){let[t,r]=e;Bu(Number.isFinite(t)),Bu(Number.isFinite(r)&&r>=-90&&r<=90,\"invalid latitude\");let i=t*Fu,s=r*Fu,n=jy*(i+jh)/(2*jh),o=jy*(jh+Math.log(Math.tan(eG+s*.5)))/(2*jh);return[n,o]}function oc(e){let[t,r]=e,i=t/jy*(2*jh)-jh,s=2*(Math.atan(Math.exp(r/jy*(2*jh)-jh))-eG);return[i*pD,s*pD]}function AD(e){let{latitude:t}=e;Bu(Number.isFinite(t));let r=Math.cos(t*Fu);return JE(KE*r)-9}function Db(e){let t=Math.cos(e*Fu);return jy/KE/t}function Wy(e){let{latitude:t,longitude:r,highPrecision:i=!1}=e;Bu(Number.isFinite(t)&&Number.isFinite(r));let s=jy,n=Math.cos(t*Fu),o=s/360,c=o/n,f=s/KE/n,_={unitsPerMeter:[f,f,f],metersPerUnit:[1/f,1/f,1/f],unitsPerDegree:[o,c,f],degreesPerUnit:[1/o,1/c,1/f]};if(i){let w=Fu*Math.tan(t*Fu)/n,I=o*w/2,R=s/KE*w,N=R/c*f;_.unitsPerDegree2=[0,I,R],_.unitsPerMeter2=[N,0,N]}return _}function Ob(e,t){let[r,i,s]=e,[n,o,c]=t,{unitsPerMeter:f,unitsPerMeter2:_}=Wy({longitude:r,latitude:i,highPrecision:!0}),w=va(e);w[0]+=n*(f[0]+_[0]*o),w[1]+=o*(f[1]+_[1]*o);let I=oc(w),R=(s||0)+(c||0);return Number.isFinite(s)||Number.isFinite(c)?[I[0],I[1],R]:I}function tP(e){let{height:t,pitch:r,bearing:i,altitude:s,scale:n,center:o}=e,c=fD();ag(c,c,[0,0,-s]),WE(c,c,-r*Fu),HE(c,c,i*Fu);let f=n/t;return By(c,c,[f,f,f]),o&&ag(c,c,Gj([],o)),c}function mD(e){let{width:t,height:r,altitude:i,pitch:s=0,offset:n,center:o,scale:c,nearZMultiplier:f=1,farZMultiplier:_=1}=e,{fovy:w=cg(rG)}=e;i!==void 0&&(w=cg(i));let I=w*Fu,R=s*Fu,N=Bb(w),j=N;o&&(j+=o[2]*c/Math.cos(R)/r);let Q=I*(.5+(n?n[1]:0)/r),et=Math.sin(Q)*j/Math.sin(kb(Math.PI/2-R-Q,.01,Math.PI-.01)),Y=Math.sin(R)*et+j,K=j*10,J=Math.min(Y*_,K);return{fov:I,aspect:t/r,focalDistance:N,near:f,far:J}}function cg(e){return 2*Math.atan(.5/e)*pD}function Bb(e){return .5/Math.tan(.5*e*Fu)}function Hy(e,t){let[r,i,s=0]=e;return Bu(Number.isFinite(r)&&Number.isFinite(i)&&Number.isFinite(s)),JA(t,[r,i,s,1])}function Qf(e,t,r=0){let[i,s,n]=e;if(Bu(Number.isFinite(i)&&Number.isFinite(s),\"invalid pixel coordinate\"),Number.isFinite(n))return JA(t,[i,s,n,1]);let o=JA(t,[i,s,0,1]),c=JA(t,[i,s,1,1]),f=o[2],_=c[2],w=f===_?0:((r||0)-f)/(_-f);return kE([],o,c,w)}function Fb(e){let{width:t,height:r,bounds:i,minExtent:s=0,maxZoom:n=24,offset:o=[0,0]}=e,[[c,f],[_,w]]=i,I=plt(e.padding),R=va([c,kb(w,-Gy,Gy)]),N=va([_,kb(f,-Gy,Gy)]),j=[Math.max(Math.abs(N[0]-R[0]),s),Math.max(Math.abs(N[1]-R[1]),s)],Q=[t-I.left-I.right-Math.abs(o[0])*2,r-I.top-I.bottom-Math.abs(o[1])*2];Bu(Q[0]>0&&Q[1]>0);let et=Q[0]/j[0],Y=Q[1]/j[1],K=(I.right-I.left)/2/et,J=(I.top-I.bottom)/2/Y,ut=[(N[0]+R[0])/2+K,(N[1]+R[1])/2+J],Et=oc(ut),kt=Math.min(n,Vy(Math.abs(Math.min(et,Y))));return Bu(Number.isFinite(kt)),{longitude:Et[0],latitude:Et[1],zoom:kt}}function plt(e=0){return typeof e==\"number\"?{top:e,bottom:e,left:e,right:e}:(Bu(Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&Number.isFinite(e.left)&&Number.isFinite(e.right)),e)}var iG=Math.PI/180;function zb(e,t=0){let{width:r,height:i,unproject:s}=e,n={targetZ:t},o=s([0,i],n),c=s([r,i],n),f,_,w=e.fovy?.5*e.fovy*iG:Math.atan(.5/e.altitude),I=(90-e.pitch)*iG;return w>I-.01?(f=nG(e,0,t),_=nG(e,r,t)):(f=s([0,0],n),_=s([r,0],n)),[o,c,_,f]}function nG(e,t,r){let{pixelUnprojectionMatrix:i}=e,s=JA(i,[t,0,1,1]),n=JA(i,[t,e.height,1,1]),c=(r*e.distanceScales.unitsPerMeter[2]-s[2])/(n[2]-s[2]),f=kE([],s,n,c),_=oc(f);return _.push(r),_}var sG=512;function eP(e){let{width:t,height:r,pitch:i=0}=e,{longitude:s,latitude:n,zoom:o,bearing:c=0}=e;(s<-180||s>180)&&(s=dD(s+180,360)-180),(c<-180||c>180)&&(c=dD(c+180,360)-180);let f=Vy(r/sG);if(o<=f)o=f,n=0;else{let _=r/2/Math.pow(2,o),w=oc([0,_])[1];if(nI&&(n=I)}}return{width:t,height:r,longitude:s,latitude:n,zoom:o,pitch:i,bearing:c}}var oG=.01,mlt=[\"longitude\",\"latitude\",\"zoom\"],aG={curve:1.414,speed:1.2};function rP(e,t,r,i){let{startZoom:s,startCenterXY:n,uDelta:o,w0:c,u1:f,S:_,rho:w,rho2:I,r0:R}=lG(e,t,i);if(fo?0:w}function lG(e,t,r){r=Object.assign({},aG,r);let i=r.curve,s=e.zoom,n=[e.longitude,e.latitude],o=Rb(s),c=t.zoom,f=[t.longitude,t.latitude],_=Rb(c-s),w=va(n),I=va(f),R=Nj([],I,w),N=Math.max(e.width,e.height),j=N/_,Q=Bj(R)*o,et=Math.max(Q,oG),Y=i*i,K=(j*j-N*N+Y*Y*et*et)/(2*N*Y*et),J=(j*j-N*N-Y*Y*et*et)/(2*j*Y*et),ut=Math.log(Math.sqrt(K*K+1)-K),Et=Math.log(Math.sqrt(J*J+1)-J),kt=(Et-ut)/i;return{startZoom:s,startCenterXY:w,uDelta:R,w0:N,u1:Q,S:kt,rho:i,rho2:Y,r0:ut,r1:Et}}var _lt=`\nconst int max_lights = 2;\nuniform mat4 shadow_uViewProjectionMatrices[max_lights];\nuniform vec4 shadow_uProjectCenters[max_lights];\nuniform bool shadow_uDrawShadowMap;\nuniform bool shadow_uUseShadowMap;\nuniform int shadow_uLightId;\nuniform float shadow_uLightCount;\n\nvarying vec3 shadow_vPosition[max_lights];\n\nvec4 shadow_setVertexPosition(vec4 position_commonspace) {\n if (shadow_uDrawShadowMap) {\n return project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[shadow_uLightId], shadow_uProjectCenters[shadow_uLightId]);\n }\n if (shadow_uUseShadowMap) {\n for (int i = 0; i < max_lights; i++) {\n if(i < int(shadow_uLightCount)) {\n vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[i], shadow_uProjectCenters[i]);\n shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0;\n }\n }\n }\n return gl_Position;\n}\n`,ylt=`\nconst int max_lights = 2;\nuniform bool shadow_uDrawShadowMap;\nuniform bool shadow_uUseShadowMap;\nuniform sampler2D shadow_uShadowMap0;\nuniform sampler2D shadow_uShadowMap1;\nuniform vec4 shadow_uColor;\nuniform float shadow_uLightCount;\n\nvarying vec3 shadow_vPosition[max_lights];\n\nconst vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0);\nconst vec4 bitUnpackShift = 1.0 / bitPackShift;\nconst vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n\nfloat shadow_getShadowWeight(vec3 position, sampler2D shadowMap) {\n vec4 rgbaDepth = texture2D(shadowMap, position.xy);\n\n float z = dot(rgbaDepth, bitUnpackShift);\n return smoothstep(0.001, 0.01, position.z - z);\n}\n\nvec4 shadow_filterShadowColor(vec4 color) {\n if (shadow_uDrawShadowMap) {\n vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift);\n rgbaDepth -= rgbaDepth.gbaa * bitMask;\n return rgbaDepth;\n }\n if (shadow_uUseShadowMap) {\n float shadowAlpha = 0.0;\n shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0);\n if(shadow_uLightCount > 1.0) {\n shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1);\n }\n shadowAlpha *= shadow_uColor.a / shadow_uLightCount;\n float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha);\n\n return vec4(\n mix(color.rgb, shadow_uColor.rgb, shadowAlpha / blendedAlpha),\n blendedAlpha\n );\n }\n return color;\n}\n`,vlt=Yf(Tlt),xlt=Yf(Mlt),blt=[0,0,0,1],wlt=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];function Slt(e,t){let[r,i,s]=e,n=Qf([r,i,s],t);return Number.isFinite(s)?n:[n[0],n[1],0]}function Tlt({viewport:e,center:t}){return new En(e.viewProjectionMatrix).invert().transform(t)}function Mlt({viewport:e,shadowMatrices:t}){let r=[],i=e.pixelUnprojectionMatrix,s=e.isGeospatial?void 0:1,n=[[0,0,s],[e.width,0,s],[0,e.height,s],[e.width,e.height,s],[0,0,-1],[e.width,0,-1],[0,e.height,-1],[e.width,e.height,-1]].map(o=>Slt(o,i));for(let o of t){let c=o.clone().translate(new Ve(e.center).negate()),f=n.map(w=>c.transform(w)),_=new En().ortho({left:Math.min(...f.map(w=>w[0])),right:Math.max(...f.map(w=>w[0])),bottom:Math.min(...f.map(w=>w[1])),top:Math.max(...f.map(w=>w[1])),near:Math.min(...f.map(w=>-w[2])),far:Math.max(...f.map(w=>-w[2]))});r.push(_.multiplyRight(o))}return r}function Elt(e,t){let{shadowEnabled:r=!0}=e;if(!r||!e.shadowMatrices||!e.shadowMatrices.length)return{shadow_uDrawShadowMap:!1,shadow_uUseShadowMap:!1};let i={shadow_uDrawShadowMap:!!e.drawToShadowMap,shadow_uUseShadowMap:e.shadowMaps?e.shadowMaps.length>0:!1,shadow_uColor:e.shadowColor||blt,shadow_uLightId:e.shadowLightId||0,shadow_uLightCount:e.shadowMatrices.length},s=vlt({viewport:e.viewport,center:t.project_uCenter}),n=[],o=xlt({shadowMatrices:e.shadowMatrices,viewport:e.viewport}).slice();for(let c=0;c0?i[\"shadow_uShadowMap\".concat(c)]=e.shadowMaps[c]:i[\"shadow_uShadowMap\".concat(c)]=e.dummyShadowMap;return i}var Nb={name:\"shadow\",dependencies:[Vh],vs:_lt,fs:ylt,inject:{\"vs:DECKGL_FILTER_GL_POSITION\":`\n position = shadow_setVertexPosition(geometry.position);\n `,\"fs:DECKGL_FILTER_COLOR\":`\n color = shadow_filterShadowColor(color);\n `},getUniforms:(e={},t={})=>\"viewport\"in e&&(e.drawToShadowMap||e.shadowMaps&&e.shadowMaps.length>0)?Elt(e,t):{}};var Plt={color:[255,255,255],intensity:1},cG=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],Ilt=[0,0,0,200/255],qy=class{constructor(t={}){G(this,\"id\",\"lighting-effect\"),G(this,\"props\",void 0),G(this,\"shadowColor\",Ilt),G(this,\"shadow\",void 0),G(this,\"ambientLight\",void 0),G(this,\"directionalLights\",void 0),G(this,\"pointLights\",void 0),G(this,\"shadowPasses\",[]),G(this,\"shadowMaps\",[]),G(this,\"dummyShadowMap\",null),G(this,\"programManager\",void 0),G(this,\"shadowMatrices\",void 0),this.setProps(t)}setProps(t){this.ambientLight=null,this.directionalLights=[],this.pointLights=[];for(let r in t){let i=t[r];switch(i.type){case\"ambient\":this.ambientLight=i;break;case\"directional\":this.directionalLights.push(i);break;case\"point\":this.pointLights.push(i);break;default:}}this._applyDefaultLights(),this.shadow=this.directionalLights.some(r=>r.shadow),this.props=t}preRender(t,{layers:r,layerFilter:i,viewports:s,onViewportActive:n,views:o}){if(this.shadow){this.shadowMatrices=this._calculateMatrices(),this.shadowPasses.length===0&&this._createShadowPasses(t),this.programManager||(this.programManager=Uh.getDefaultProgramManager(t),Nb&&this.programManager.addDefaultModule(Nb)),this.dummyShadowMap||(this.dummyShadowMap=new pi(t,{width:1,height:1}));for(let c=0;ci.getProjectedLight({layer:t})),pointLights:this.pointLights.map(i=>i.getProjectedLight({layer:t}))},r}cleanup(){for(let t of this.shadowPasses)t.delete();this.shadowPasses.length=0,this.shadowMaps.length=0,this.dummyShadowMap&&(this.dummyShadowMap.delete(),this.dummyShadowMap=null),this.shadow&&this.programManager&&(this.programManager.removeDefaultModule(Nb),this.programManager=null)}_calculateMatrices(){let t=[];for(let r of this.directionalLights){let i=new En().lookAt({eye:new Ve(r.direction).negate()});t.push(i)}return t}_createShadowPasses(t){for(let r=0;rs&&(n=s);let o=this._pool,c=t.BYTES_PER_ELEMENT*n,f=o.findIndex(_=>_.byteLength>=c);if(f>=0){let _=new t(o.splice(f,1)[0],0,n);return i&&_.fill(0),_}return new t(n)}_release(t){if(!ArrayBuffer.isView(t))return;let r=this._pool,{buffer:i}=t,{byteLength:s}=i,n=r.findIndex(o=>o.byteLength>=s);n<0?r.push(i):(n>0||r.lengththis.opts.poolSize&&r.shift()}},Gh=new _D;function Yy(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function hG(e){return[e[12],e[13],e[14]]}function fG(e){return{left:Zy(e[3]+e[0],e[7]+e[4],e[11]+e[8],e[15]+e[12]),right:Zy(e[3]-e[0],e[7]-e[4],e[11]-e[8],e[15]-e[12]),bottom:Zy(e[3]+e[1],e[7]+e[5],e[11]+e[9],e[15]+e[13]),top:Zy(e[3]-e[1],e[7]-e[5],e[11]-e[9],e[15]-e[13]),near:Zy(e[3]+e[2],e[7]+e[6],e[11]+e[10],e[15]+e[14]),far:Zy(e[3]-e[2],e[7]-e[6],e[11]-e[10],e[15]-e[14])}}var uG=new Ve;function Zy(e,t,r,i){uG.set(e,t,r);let s=uG.len();return{distance:i/s,normal:new Ve(-e/s,-t/s,-r/s)}}function Clt(e){return e-Math.fround(e)}var Ub;function iP(e,t){let{size:r=1,startIndex:i=0}=t,s=t.endIndex!==void 0?t.endIndex:e.length,n=(s-i)/r;Ub=Gh.allocate(Ub,n,{type:Float32Array,size:r*2});let o=i,c=0;for(;osuper.render({target:o,layers:t,layerFilter:r,views:i,viewports:s,onViewportActive:n,cullRect:I,effects:R?.filter(ut=>ut.useInPicking),pass:N,isPicking:!0,moduleParameters:Q}));return this._colorEncoderState=null,{decodePickingColor:Y&&Flt.bind(null,Y),stats:K}}shouldDrawLayer(t){let{pickable:r,operation:i}=t.props;return r&&i.includes(\"draw\")||i.includes(\"terrain\")||i.includes(\"mask\")}getModuleParameters(){return{pickingActive:1,pickingAttribute:this.pickZ,lightSources:{}}}getLayerParameters(t,r,i){let s={...t.props.parameters},{pickable:n,operation:o}=t.props;return this._colorEncoderState?n&&o.includes(\"draw\")&&(Object.assign(s,gG),s.blend=!0,s.blendColor=Blt(this._colorEncoderState,t,i)):s.blend=!1,o.includes(\"terrain\")&&(s.blend=!1),s}_resetColorEncoder(t){return this._colorEncoderState=t?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}};function Blt(e,t,r){let{byLayer:i,byAlpha:s}=e,n,o=i.get(t);return o?(o.viewports.push(r),n=o.a):(n=i.size+1,n<=255?(o={a:n,layer:t,viewports:[r]},i.set(t,o),s[n]=o):(or.warn(\"Too many pickable layers, only picking the first 255\")(),n=0)),[0,0,0,n/255]}function Flt(e,t){let r=e.byAlpha[t[3]];return r&&{pickedLayer:r.layer,pickedViewports:r.viewports,pickedObjectIndex:r.layer.decodePickingColor(t)}}var tm={NO_STATE:\"Awaiting state\",MATCHED:\"Matched. State transferred from previous layer\",INITIALIZED:\"Initialized\",AWAITING_GC:\"Discarded. Awaiting garbage collection\",AWAITING_FINALIZATION:\"No longer matched. Awaiting garbage collection\",FINALIZED:\"Finalized! Awaiting garbage collection\"},Qy=Symbol.for(\"component\"),zu=Symbol.for(\"propTypes\"),nP=Symbol.for(\"deprecatedProps\"),sp=Symbol.for(\"asyncPropDefaults\"),$f=Symbol.for(\"asyncPropOriginal\"),Wh=Symbol.for(\"asyncPropResolved\");function op(e,t=()=>!0){return Array.isArray(e)?_G(e,t,[]):t(e)?[e]:[]}function _G(e,t,r){let i=-1;for(;++i0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(t,r){if(t===this._data&&!r)return;this._data=t;let i=++this._loadCount,s=t;typeof t==\"string\"&&(s=jA(t)),s instanceof Promise?(this.isLoaded=!1,this._loader=s.then(n=>{this._loadCount===i&&(this.isLoaded=!0,this._error=void 0,this._content=n)}).catch(n=>{this._loadCount===i&&(this.isLoaded=!0,this._error=n||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=t);for(let n of this._subscribers)n.onChange(this.getData())}};var jb=class{constructor({gl:t,protocol:r}){G(this,\"protocol\",void 0),G(this,\"_context\",void 0),G(this,\"_resources\",void 0),G(this,\"_consumers\",void 0),G(this,\"_pruneRequest\",void 0),this.protocol=r||\"resource://\",this._context={gl:t,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(t){return t.startsWith(this.protocol)?!0:t in this._resources}add({resourceId:t,data:r,forceUpdate:i=!1,persistent:s=!0}){let n=this._resources[t];n?n.setData(r,i):(n=new Vb(t,r,this._context),this._resources[t]=n),n.persistent=s}remove(t){let r=this._resources[t];r&&(r.delete(),delete this._resources[t])}unsubscribe({consumerId:t}){let r=this._consumers[t];if(r){for(let i in r){let s=r[i],n=this._resources[s.resourceId];n&&n.unsubscribe(s)}delete this._consumers[t],this.prune()}}subscribe({resourceId:t,onChange:r,consumerId:i,requestId:s=\"default\"}){let{_resources:n,protocol:o}=this;t.startsWith(o)&&(t=t.replace(o,\"\"),n[t]||this.add({resourceId:t,data:null,persistent:!1}));let c=n[t];if(this._track(i,s,c,r),c)return c.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(let t in this._resources)this._resources[t].delete()}_track(t,r,i,s){let n=this._consumers,o=n[t]=n[t]||{},c=o[r]||{},f=c.resourceId&&this._resources[c.resourceId];f&&(f.unsubscribe(c),this.prune()),i&&(o[r]=c,c.onChange=s,c.resourceId=i.id,i.subscribe(c))}_prune(){this._pruneRequest=null;for(let t of Object.keys(this._resources)){let r=this._resources[t];!r.persistent&&!r.inUse()&&(r.delete(),delete this._resources[t])}}};var zlt=`\nvec4 project_position_to_clipspace(\n vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition\n) {\n vec3 projectedPosition = project_position(position, position64Low);\n mat3 rotation;\n if (project_needs_rotation(projectedPosition, rotation)) {\n // offset is specified as ENU\n // when in globe projection, rotate offset so that the ground alighs with the surface of the globe\n offset = rotation * offset;\n }\n commonPosition = vec4(projectedPosition + offset, 1.0);\n return project_common_position_to_clipspace(commonPosition);\n}\n\nvec4 project_position_to_clipspace(\n vec3 position, vec3 position64Low, vec3 offset\n) {\n vec4 commonPosition;\n return project_position_to_clipspace(position, position64Low, offset, commonPosition);\n}\n`,Rs={name:\"project32\",dependencies:[Vh],vs:zlt};var Ao={inject:{\"vs:DECKGL_FILTER_GL_POSITION\":`\n // for picking depth values\n picking_setPickingAttribute(position.z / position.w);\n `,\"vs:DECKGL_FILTER_COLOR\":`\n picking_setPickingColor(geometry.pickingColor);\n `,\"fs:#decl\":`\nuniform bool picking_uAttribute;\n `,\"fs:DECKGL_FILTER_COLOR\":{order:99,injection:`\n // use highlight color if this fragment belongs to the selected object.\n color = picking_filterHighlightColor(color);\n\n // use picking color if rendering to picking FBO.\n color = picking_filterPickingColor(color);\n `}},...QE};var Nlt=[Vh],Ult=[\"vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)\",\"vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)\",\"vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)\",\"fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)\"];function yG(e){let t=Uh.getDefaultProgramManager(e);for(let r of Nlt)t.addDefaultModule(r);for(let r of Ult)t.addShaderHook(r);return t}var Vlt=\"layerManager.setLayers\",jlt=\"layerManager.activateViewport\",Gb=class{constructor(t,{deck:r,stats:i,viewport:s,timeline:n}={}){G(this,\"layers\",void 0),G(this,\"context\",void 0),G(this,\"resourceManager\",void 0),G(this,\"_lastRenderedLayers\",[]),G(this,\"_needsRedraw\",!1),G(this,\"_needsUpdate\",!1),G(this,\"_nextLayers\",null),G(this,\"_debug\",!1),G(this,\"activateViewport\",o=>{Ls(jlt,this,o),o&&(this.context.viewport=o)}),this.layers=[],this.resourceManager=new jb({gl:t,protocol:\"deck://\"}),this.context={mousePosition:null,userData:{},layerManager:this,gl:t,deck:r,programManager:t&&yG(t),stats:i||new Gf({id:\"deck.gl\"}),viewport:s||new ac({id:\"DEFAULT-INITIAL-VIEWPORT\"}),timeline:n||new KA,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(let t of this.layers)this._finalizeLayer(t)}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);for(let i of this.layers){let s=i.getNeedsRedraw(t);r=r||s}return r}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?\"layers changed\":this._needsUpdate}setNeedsRedraw(t){this._needsRedraw=this._needsRedraw||t}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t}getLayers({layerIds:t}={}){return t?this.layers.filter(r=>t.find(i=>r.id.indexOf(i)===0)):this.layers}setProps(t){\"debug\"in t&&(this._debug=t.debug),\"userData\"in t&&(this.context.userData=t.userData),\"layers\"in t&&(this._nextLayers=t.layers),\"onError\"in t&&(this.context.onError=t.onError)}setLayers(t,r){Ls(Vlt,this,r,t),this._lastRenderedLayers=t;let i=op(t,Boolean);for(let s of i)s.context=this.context;this._updateLayers(this.layers,i)}updateLayers(){let t=this.needsUpdate();t&&(this.setNeedsRedraw(\"updating layers: \".concat(t)),this.setLayers(this._nextLayers||this._lastRenderedLayers,t)),this._nextLayers=null}_handleError(t,r,i){i.raiseError(r,\"\".concat(t,\" of \").concat(i))}_updateLayers(t,r){let i={};for(let o of t)i[o.id]?or.warn(\"Multiple old layers with same id \".concat(o.id))():i[o.id]=o;let s=[];this._updateSublayersRecursively(r,i,s),this._finalizeOldLayers(i);let n=!1;for(let o of s)if(o.hasUniformTransition()){n=\"Uniform transition in \".concat(o);break}this._needsUpdate=n,this.layers=s}_updateSublayersRecursively(t,r,i){for(let s of t){s.context=this.context;let n=r[s.id];n===null&&or.warn(\"Multiple new layers with same id \".concat(s.id))(),r[s.id]=null;let o=null;try{this._debug&&n!==s&&s.validateProps(),n?(this._transferLayerState(n,s),this._updateLayer(s)):this._initializeLayer(s),i.push(s),o=s.isComposite?s.getSubLayers():null}catch(c){this._handleError(\"matching\",c,s)}o&&this._updateSublayersRecursively(o,r,i)}}_finalizeOldLayers(t){for(let r in t){let i=t[r];i&&this._finalizeLayer(i)}}_initializeLayer(t){try{t._initialize(),t.lifecycle=tm.INITIALIZED}catch(r){this._handleError(\"initialization\",r,t)}}_transferLayerState(t,r){r._transferState(t),r.lifecycle=tm.MATCHED,r!==t&&(t.lifecycle=tm.AWAITING_GC)}_updateLayer(t){try{t._update()}catch(r){this._handleError(\"update\",r,t)}}_finalizeLayer(t){this._needsRedraw=this._needsRedraw||\"finalized \".concat(t),t.lifecycle=tm.AWAITING_FINALIZATION;try{t._finalize(),t.lifecycle=tm.FINALIZED}catch(r){this._handleError(\"finalization\",r,t)}}};function mo(e,t,r){if(e===t)return!0;if(!r||!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;ir.containsPixel(t)):this._viewports}getViews(){let t={};return this.views.forEach(r=>{t[r.id]=r}),t}getView(t){return this.views.find(r=>r.id===t)}getViewState(t){let r=typeof t==\"string\"?this.getView(t):t,i=r&&this.viewState[r.getViewStateId()]||this.viewState;return r?r.filterViewState(i):i}getViewport(t){return this._viewportMap[t]}unproject(t,r){let i=this.getViewports(),s={x:t[0],y:t[1]};for(let n=i.length-1;n>=0;--n){let o=i[n];if(o.containsPixel(s)){let c=t.slice();return c[0]-=o.x,c[1]-=o.y,o.unproject(c,r)}}return null}setProps(t){t.views&&this._setViews(t.views),t.viewState&&this._setViewState(t.viewState),(\"width\"in t||\"height\"in t)&&this._setSize(t.width,t.height),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(t,r){(t!==this.width||r!==this.height)&&(this.width=t,this.height=r,this.setNeedsUpdate(\"Size changed\"))}_setViews(t){t=op(t,Boolean),this._diffViews(t,this.views)&&this.setNeedsUpdate(\"views changed\"),this.views=t}_setViewState(t){t?(!mo(t,this.viewState,3)&&this.setNeedsUpdate(\"viewState changed\"),this.viewState=t):or.warn(\"missing `viewState` or `initialViewState`\")()}_onViewStateChange(t,r){this._eventCallbacks.onViewStateChange&&this._eventCallbacks.onViewStateChange({...r,viewId:t})}_createController(t,r){let i=r.type;return new i({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._onViewStateChange.bind(this,r.id),onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:n=>{var o;return(o=this.getView(t.id))===null||o===void 0?void 0:o.makeViewport({viewState:n,width:this.width,height:this.height})}})}_updateController(t,r,i,s){let n=t.controller;if(n&&i){let o={...r,...n,id:t.id,x:i.x,y:i.y,width:i.width,height:i.height};return(!s||s.constructor!==n.type)&&(s=this._createController(t,o)),s&&s.setProps(o),s}return null}_rebuildViewports(){let{views:t}=this,r=this.controllers;this._viewports=[],this.controllers={};let i=!1;for(let s=t.length;s--;){let n=t[s],o=this.getViewState(n),c=n.makeViewport({viewState:o,width:this.width,height:this.height}),f=r[n.id],_=!!n.controller;_&&!f&&(i=!0),(i||!_)&&f&&(f.finalize(),f=null),this.controllers[n.id]=this._updateController(n,o,c,f),c&&this._viewports.unshift(c)}for(let s in r){let n=r[s];n&&!this.controllers[s]&&n.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(t=>{t.id&&(this._viewportMap[t.id]=this._viewportMap[t.id]||t)})}_diffViews(t,r){return t.length!==r.length?!0:t.some((i,s)=>!t[s].equals(r[s]))}};var Glt=/([0-9]+\\.?[0-9]*)(%|px)/;function ap(e){switch(typeof e){case\"number\":return{position:e,relative:!1};case\"string\":let t=Glt.exec(e);if(t&&t.length>=3){let r=t[2]===\"%\",i=parseFloat(t[1]);return{position:r?i/100:i,relative:r}}default:throw new Error(\"Could not parse position string \".concat(e))}}function lp(e,t){return e.relative?Math.round(e.position*t):e.position}function _r(e,t){if(!e)throw new Error(t||\"deck.gl: assertion failed.\")}var Xc=class{constructor(t){G(this,\"id\",void 0),G(this,\"viewportInstance\",void 0),G(this,\"_x\",void 0),G(this,\"_y\",void 0),G(this,\"_width\",void 0),G(this,\"_height\",void 0),G(this,\"_padding\",void 0),G(this,\"props\",void 0);let{id:r,x:i=0,y:s=0,width:n=\"100%\",height:o=\"100%\",padding:c=null,viewportInstance:f}=t||{};_r(!f||f instanceof ac),this.viewportInstance=f,this.id=r||this.constructor.displayName||\"view\",this.props={...t,id:this.id},this._x=ap(i),this._y=ap(s),this._width=ap(n),this._height=ap(o),this._padding=c&&{left:ap(c.left||0),right:ap(c.right||0),top:ap(c.top||0),bottom:ap(c.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(t){return this===t?!0:this.viewportInstance?t.viewportInstance?this.viewportInstance.equals(t.viewportInstance):!1:this.ViewportType===t.ViewportType&&mo(this.props,t.props,2)}makeViewport({width:t,height:r,viewState:i}){if(this.viewportInstance)return this.viewportInstance;i=this.filterViewState(i);let s=this.getDimensions({width:t,height:r});return!s.height||!s.width?null:new this.ViewportType({...i,...this.props,...s})}getViewStateId(){let{viewState:t}=this.props;return typeof t==\"string\"?t:t?.id||this.id}filterViewState(t){if(this.props.viewState&&typeof this.props.viewState==\"object\"){if(!this.props.viewState.id)return this.props.viewState;let r={...t};for(let i in this.props.viewState)i!==\"id\"&&(r[i]=this.props.viewState[i]);return r}return t}getDimensions({width:t,height:r}){let i={x:lp(this._x,t),y:lp(this._y,r),width:lp(this._width,t),height:lp(this._height,r)};return this._padding&&(i.padding={left:lp(this._padding.left,t),top:lp(this._padding.top,r),right:lp(this._padding.right,t),bottom:lp(this._padding.bottom,r)}),i}get controller(){let t=this.props.controller;return t?t===!0?{type:this.ControllerType}:typeof t==\"function\"?{type:t}:{type:this.ControllerType,...t}:null}};var Kc=class{constructor(t){G(this,\"_inProgress\",void 0),G(this,\"_handle\",void 0),G(this,\"_timeline\",void 0),G(this,\"time\",void 0),G(this,\"settings\",void 0),this._inProgress=!1,this._handle=null,this._timeline=t,this.time=0,this.settings={duration:0}}get inProgress(){return this._inProgress}start(t){var r,i;this.cancel(),this.settings=t,this._inProgress=!0,(r=(i=this.settings).onStart)===null||r===void 0||r.call(i,this)}end(){if(this._inProgress){var t,r;this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,(t=(r=this.settings).onEnd)===null||t===void 0||t.call(r,this)}}cancel(){if(this._inProgress){var t,r;(t=(r=this.settings).onInterrupt)===null||t===void 0||t.call(r,this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1}}update(){var t,r;if(!this._inProgress)return!1;if(this._handle===null){let{_timeline:i,settings:s}=this;this._handle=i.addChannel({delay:i.getTime(),duration:s.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),(t=(r=this.settings).onUpdate)===null||t===void 0||t.call(r,this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}};var vG=()=>{},bD={BREAK:1,SNAP_TO_END:2,IGNORE:3},Wlt=e=>e,Hlt=bD.BREAK,Hb=class{constructor(t){G(this,\"getControllerState\",void 0),G(this,\"props\",void 0),G(this,\"propsInTransition\",void 0),G(this,\"transition\",void 0),G(this,\"onViewStateChange\",void 0),G(this,\"onStateChange\",void 0),G(this,\"_onTransitionUpdate\",r=>{let{time:i,settings:{interpolator:s,startProps:n,endProps:o,duration:c,easing:f}}=r,_=f(i/c),w=s.interpolateProps(n,o,_);this.propsInTransition=this.getControllerState({...this.props,...w}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})}),this.getControllerState=t.getControllerState,this.propsInTransition=null,this.transition=new Kc(t.timeline),this.onViewStateChange=t.onViewStateChange||vG,this.onStateChange=t.onStateChange||vG}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(t){let r=!1,i=this.props;if(this.props=t,!i||this._shouldIgnoreViewportChange(i,t))return!1;if(this._isTransitionEnabled(t)){let s=i;if(this.transition.inProgress){let{interruption:n,endProps:o}=this.transition.settings;s={...i,...n===bD.SNAP_TO_END?o:this.propsInTransition||i}}this._triggerTransition(s,t),r=!0}else this.transition.cancel();return r}updateTransition(){this.transition.update()}_isTransitionEnabled(t){let{transitionDuration:r,transitionInterpolator:i}=t;return(r>0||r===\"auto\")&&!!i}_isUpdateDueToCurrentTransition(t){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(t,this.propsInTransition):!1}_shouldIgnoreViewportChange(t,r){return this.transition.inProgress?this.transition.settings.interruption===bD.IGNORE||this._isUpdateDueToCurrentTransition(r):this._isTransitionEnabled(r)?r.transitionInterpolator.arePropsEqual(t,r):!0}_triggerTransition(t,r){let i=this.getControllerState(t),s=this.getControllerState(r).shortestPathFrom(i),n=r.transitionInterpolator,o=n.getDuration?n.getDuration(t,r):r.transitionDuration;if(o===0)return;let c=n.initializeProps(t,s);this.propsInTransition={};let f={duration:o,easing:r.transitionEasing||Wlt,interpolator:n,interruption:r.transitionInterruption||Hlt,startProps:c.start,endProps:c.end,onStart:r.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(r.onTransitionInterrupt),onEnd:this._onTransitionEnd(r.onTransitionEnd)};this.transition.start(f),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(t){return r=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),t?.(r)}}};var hg=class{constructor(t){G(this,\"_propsToCompare\",void 0),G(this,\"_propsToExtract\",void 0),G(this,\"_requiredProps\",void 0);let{compare:r,extract:i,required:s}=t;this._propsToCompare=r,this._propsToExtract=i||r,this._requiredProps=s}arePropsEqual(t,r){for(let i of this._propsToCompare)if(!(i in t)||!(i in r)||!Ro(t[i],r[i]))return!1;return!0}initializeProps(t,r){let i={},s={};for(let n of this._propsToExtract)(n in t||n in r)&&(i[n]=t[n],s[n]=r[n]);return this._checkRequiredProps(i),this._checkRequiredProps(s),{start:i,end:s}}getDuration(t,r){return r.transitionDuration}_checkRequiredProps(t){this._requiredProps&&this._requiredProps.forEach(r=>{let i=t[r];_r(Number.isFinite(i)||Array.isArray(i),\"\".concat(r,\" is required for transition\"))})}};var qlt=[\"longitude\",\"latitude\",\"zoom\",\"bearing\",\"pitch\"],Zlt=[\"longitude\",\"latitude\",\"zoom\"],fg=class extends hg{constructor(t={}){let r=Array.isArray(t)?t:t.transitionProps,i=Array.isArray(t)?{}:t;i.transitionProps=Array.isArray(r)?{compare:r,required:r}:r||{compare:qlt,required:Zlt},super(i.transitionProps),G(this,\"opts\",void 0),this.opts=i}initializeProps(t,r){let i=super.initializeProps(t,r),{makeViewport:s,around:n}=this.opts;if(s&&n){let o=s(t),c=s(r),f=o.unproject(n);i.start.around=n,Object.assign(i.end,{around:c.project(f),aroundPosition:f,width:r.width,height:r.height})}return i}interpolateProps(t,r,i){let s={};for(let n of this._propsToExtract)s[n]=il(t[n]||0,r[n]||0,i);if(r.aroundPosition&&this.opts.makeViewport){let n=this.opts.makeViewport({...r,...s});Object.assign(s,n.panByPosition(r.aroundPosition,il(t.around,r.around,i)))}return s}};var em={transitionDuration:0},Ylt=300,sP=e=>1-(1-e)*(1-e),$y={WHEEL:[\"wheel\"],PAN:[\"panstart\",\"panmove\",\"panend\"],PINCH:[\"pinchstart\",\"pinchmove\",\"pinchend\"],TRIPLE_PAN:[\"tripanstart\",\"tripanmove\",\"tripanend\"],DOUBLE_TAP:[\"doubletap\"],KEYBOARD:[\"keydown\"]},dg={},qb=class{constructor(t){G(this,\"props\",void 0),G(this,\"state\",{}),G(this,\"transitionManager\",void 0),G(this,\"eventManager\",void 0),G(this,\"onViewStateChange\",void 0),G(this,\"onStateChange\",void 0),G(this,\"makeViewport\",void 0),G(this,\"_controllerState\",void 0),G(this,\"_events\",{}),G(this,\"_interactionState\",{isDragging:!1}),G(this,\"_customEvents\",[]),G(this,\"_eventStartBlocked\",null),G(this,\"_panMove\",!1),G(this,\"invertPan\",!1),G(this,\"dragMode\",\"rotate\"),G(this,\"inertia\",0),G(this,\"scrollZoom\",!0),G(this,\"dragPan\",!0),G(this,\"dragRotate\",!0),G(this,\"doubleClickZoom\",!0),G(this,\"touchZoom\",!0),G(this,\"touchRotate\",!1),G(this,\"keyboard\",!0),this.transitionManager=new Hb({...t,getControllerState:r=>new this.ControllerState(r),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=t.eventManager,this.onViewStateChange=t.onViewStateChange||(()=>{}),this.onStateChange=t.onStateChange||(()=>{}),this.makeViewport=t.makeViewport}set events(t){this.toggleEvents(this._customEvents,!1),this.toggleEvents(t,!0),this._customEvents=t,this.props&&this.setProps(this.props)}finalize(){for(let r in this._events)if(this._events[r]){var t;(t=this.eventManager)===null||t===void 0||t.off(r,this.handleEvent)}this.transitionManager.finalize()}handleEvent(t){this._controllerState=void 0;let r=this._eventStartBlocked;switch(t.type){case\"panstart\":return r?!1:this._onPanStart(t);case\"panmove\":return this._onPan(t);case\"panend\":return this._onPanEnd(t);case\"pinchstart\":return r?!1:this._onPinchStart(t);case\"pinchmove\":return this._onPinch(t);case\"pinchend\":return this._onPinchEnd(t);case\"tripanstart\":return r?!1:this._onTriplePanStart(t);case\"tripanmove\":return this._onTriplePan(t);case\"tripanend\":return this._onTriplePanEnd(t);case\"doubletap\":return this._onDoubleTap(t);case\"wheel\":return this._onWheel(t);case\"keydown\":return this._onKeyDown(t);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(t){let{x:r,y:i}=this.props,{offsetCenter:s}=t;return[s.x-r,s.y-i]}isPointInBounds(t,r){let{width:i,height:s}=this.props;if(r&&r.handled)return!1;let n=t[0]>=0&&t[0]<=i&&t[1]>=0&&t[1]<=s;return n&&r&&r.stopPropagation(),n}isFunctionKeyPressed(t){let{srcEvent:r}=t;return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(t){let r=setTimeout(()=>{this._eventStartBlocked===r&&(this._eventStartBlocked=null)},t);this._eventStartBlocked=r}setProps(t){t.dragMode&&(this.dragMode=t.dragMode),this.props=t,\"transitionInterpolator\"in t||(t.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(t);let{inertia:r}=t;this.inertia=Number.isFinite(r)?r:r===!0?Ylt:0;let{scrollZoom:i=!0,dragPan:s=!0,dragRotate:n=!0,doubleClickZoom:o=!0,touchZoom:c=!0,touchRotate:f=!1,keyboard:_=!0}=t,w=!!this.onViewStateChange;this.toggleEvents($y.WHEEL,w&&i),this.toggleEvents($y.PAN,w),this.toggleEvents($y.PINCH,w&&(c||f)),this.toggleEvents($y.TRIPLE_PAN,w&&f),this.toggleEvents($y.DOUBLE_TAP,w&&o),this.toggleEvents($y.KEYBOARD,w&&_),this.scrollZoom=i,this.dragPan=s,this.dragRotate=n,this.doubleClickZoom=o,this.touchZoom=c,this.touchRotate=f,this.keyboard=_}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(t,r){this.eventManager&&t.forEach(i=>{this._events[i]!==r&&(this._events[i]=r,r?this.eventManager.on(i,this.handleEvent):this.eventManager.off(i,this.handleEvent))})}updateViewport(t,r=null,i={}){let s={...t.getViewportProps(),...r},n=this.controllerState!==t;if(this.state=t.getState(),this._setInteractionState(i),n){let o=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:s,interactionState:this._interactionState,oldViewState:o})}}_onTransition(t){this.onViewStateChange({...t,interactionState:this._interactionState})}_setInteractionState(t){Object.assign(this._interactionState,t),this.onStateChange(this._interactionState)}_onPanStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let i=this.isFunctionKeyPressed(t)||t.rightButton||!1;(this.invertPan||this.dragMode===\"pan\")&&(i=!i);let s=this.controllerState[i?\"panStart\":\"rotateStart\"]({pos:r});return this._panMove=i,this.updateViewport(s,em,{isDragging:!0}),!0}_onPan(t){return this.isDragging()?this._panMove?this._onPanMove(t):this._onPanRotate(t):!1}_onPanEnd(t){return this.isDragging()?this._panMove?this._onPanMoveEnd(t):this._onPanRotateEnd(t):!1}_onPanMove(t){if(!this.dragPan)return!1;let r=this.getCenter(t),i=this.controllerState.pan({pos:r});return this.updateViewport(i,em,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(t){let{inertia:r}=this;if(this.dragPan&&r&&t.velocity){let i=this.getCenter(t),s=[i[0]+t.velocityX*r/2,i[1]+t.velocityY*r/2],n=this.controllerState.pan({pos:s}).panEnd();this.updateViewport(n,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:sP},{isDragging:!1,isPanning:!0})}else{let i=this.controllerState.panEnd();this.updateViewport(i,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(t){if(!this.dragRotate)return!1;let r=this.getCenter(t),i=this.controllerState.rotate({pos:r});return this.updateViewport(i,em,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(t){let{inertia:r}=this;if(this.dragRotate&&r&&t.velocity){let i=this.getCenter(t),s=[i[0]+t.velocityX*r/2,i[1]+t.velocityY*r/2],n=this.controllerState.rotate({pos:s}).rotateEnd();this.updateViewport(n,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:sP},{isDragging:!1,isRotating:!0})}else{let i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(t){if(!this.scrollZoom)return!1;let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;t.srcEvent.preventDefault();let{speed:i=.01,smooth:s=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:n}=t,o=2/(1+Math.exp(-Math.abs(n*i)));n<0&&o!==0&&(o=1/o);let c=this.controllerState.zoom({pos:r,scale:o});return this.updateViewport(c,{...this._getTransitionProps({around:r}),transitionDuration:s?250:1},{isZooming:!0,isPanning:!0}),!0}_onTriplePanStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let i=this.controllerState.rotateStart({pos:r});return this.updateViewport(i,em,{isDragging:!0}),!0}_onTriplePan(t){if(!this.touchRotate||!this.isDragging())return!1;let r=this.getCenter(t);r[0]-=t.deltaX;let i=this.controllerState.rotate({pos:r});return this.updateViewport(i,em,{isDragging:!0,isRotating:!0}),!0}_onTriplePanEnd(t){if(!this.isDragging())return!1;let{inertia:r}=this;if(this.touchRotate&&r&&t.velocityY){let i=this.getCenter(t),s=[i[0],i[1]+=t.velocityY*r/2],n=this.controllerState.rotate({pos:s});this.updateViewport(n,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:sP},{isDragging:!1,isRotating:!0}),this.blockEvents(r)}else{let i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let i=this.controllerState.zoomStart({pos:r}).rotateStart({pos:r});return dg._startPinchRotation=t.rotation,dg._lastPinchEvent=t,this.updateViewport(i,em,{isDragging:!0}),!0}_onPinch(t){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let r=this.controllerState;if(this.touchZoom){let{scale:i}=t,s=this.getCenter(t);r=r.zoom({pos:s,scale:i})}if(this.touchRotate){let{rotation:i}=t;r=r.rotate({deltaAngleX:dg._startPinchRotation-i})}return this.updateViewport(r,em,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),dg._lastPinchEvent=t,!0}_onPinchEnd(t){if(!this.isDragging())return!1;let{inertia:r}=this,{_lastPinchEvent:i}=dg;if(this.touchZoom&&r&&i&&t.scale!==i.scale){let s=this.getCenter(t),n=this.controllerState.rotateEnd(),o=Math.log2(t.scale),c=(o-Math.log2(i.scale))/(t.deltaTime-i.deltaTime),f=Math.pow(2,o+c*r/2);n=n.zoom({pos:s,scale:f}).zoomEnd(),this.updateViewport(n,{...this._getTransitionProps({around:s}),transitionDuration:r,transitionEasing:sP},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(r)}else{let s=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(s,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return dg._startPinchRotation=null,dg._lastPinchEvent=null,!0}_onDoubleTap(t){if(!this.doubleClickZoom)return!1;let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let i=this.isFunctionKeyPressed(t),s=this.controllerState.zoom({pos:r,scale:i?.5:2});return this.updateViewport(s,this._getTransitionProps({around:r}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(t){if(!this.keyboard)return!1;let r=this.isFunctionKeyPressed(t),{zoomSpeed:i,moveSpeed:s,rotateSpeedX:n,rotateSpeedY:o}=this.keyboard===!0?{}:this.keyboard,{controllerState:c}=this,f,_={};switch(t.srcEvent.code){case\"Minus\":f=r?c.zoomOut(i).zoomOut(i):c.zoomOut(i),_.isZooming=!0;break;case\"Equal\":f=r?c.zoomIn(i).zoomIn(i):c.zoomIn(i),_.isZooming=!0;break;case\"ArrowLeft\":r?(f=c.rotateLeft(n),_.isRotating=!0):(f=c.moveLeft(s),_.isPanning=!0);break;case\"ArrowRight\":r?(f=c.rotateRight(n),_.isRotating=!0):(f=c.moveRight(s),_.isPanning=!0);break;case\"ArrowUp\":r?(f=c.rotateUp(o),_.isRotating=!0):(f=c.moveUp(s),_.isPanning=!0);break;case\"ArrowDown\":r?(f=c.rotateDown(o),_.isRotating=!0):(f=c.moveDown(s),_.isPanning=!0);break;default:return!1}return this.updateViewport(f,this._getTransitionProps(),_),!0}_getTransitionProps(t){let{transition:r}=this;return!r||!r.transitionInterpolator?em:t?{...r,transitionInterpolator:new fg({...t,...r.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:r}};var Zb=class{constructor(t,r){G(this,\"_viewportProps\",void 0),G(this,\"_state\",void 0),this._viewportProps=this.applyConstraints(t),this._state=r}getViewportProps(){return this._viewportProps}getState(){return this._state}};var xG=5,Qlt=1.2,wD=class extends Zb{constructor(t){let{width:r,height:i,latitude:s,longitude:n,zoom:o,bearing:c=0,pitch:f=0,altitude:_=1.5,position:w=[0,0,0],maxZoom:I=20,minZoom:R=0,maxPitch:N=60,minPitch:j=0,startPanLngLat:Q,startZoomLngLat:et,startRotatePos:Y,startBearing:K,startPitch:J,startZoom:ut,normalize:Et=!0}=t;_r(Number.isFinite(n)),_r(Number.isFinite(s)),_r(Number.isFinite(o)),super({width:r,height:i,latitude:s,longitude:n,zoom:o,bearing:c,pitch:f,altitude:_,maxZoom:I,minZoom:R,maxPitch:N,minPitch:j,normalize:Et,position:w},{startPanLngLat:Q,startZoomLngLat:et,startRotatePos:Y,startBearing:K,startPitch:J,startZoom:ut}),G(this,\"makeViewport\",void 0),this.makeViewport=t.makeViewport}panStart({pos:t}){return this._getUpdatedState({startPanLngLat:this._unproject(t)})}pan({pos:t,startPos:r}){let i=this.getState().startPanLngLat||this._unproject(r);if(!i)return this;let n=this.makeViewport(this.getViewportProps()).panByPosition(i,t);return this._getUpdatedState(n)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:t}){return this._getUpdatedState({startRotatePos:t,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:t,deltaAngleX:r=0,deltaAngleY:i=0}){let{startRotatePos:s,startBearing:n,startPitch:o}=this.getState();if(!s||n===void 0||o===void 0)return this;let c;return t?c=this._getNewRotation(t,s,o,n):c={bearing:n+r,pitch:o+i},this._getUpdatedState(c)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:t}){return this._getUpdatedState({startZoomLngLat:this._unproject(t),startZoom:this.getViewportProps().zoom})}zoom({pos:t,startPos:r,scale:i}){let{startZoom:s,startZoomLngLat:n}=this.getState();if(n||(s=this.getViewportProps().zoom,n=this._unproject(r)||this._unproject(t)),!n)return this;let{maxZoom:o,minZoom:c}=this.getViewportProps(),f=s+Math.log2(i);f=Il(f,c,o);let _=this.makeViewport({...this.getViewportProps(),zoom:f});return this._getUpdatedState({zoom:f,..._.panByPosition(n,t)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(t=2){return this._zoomFromCenter(t)}zoomOut(t=2){return this._zoomFromCenter(1/t)}moveLeft(t=100){return this._panFromCenter([t,0])}moveRight(t=100){return this._panFromCenter([-t,0])}moveUp(t=100){return this._panFromCenter([0,t])}moveDown(t=100){return this._panFromCenter([0,-t])}rotateLeft(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-t})}rotateRight(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+t})}rotateUp(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+t})}rotateDown(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-t})}shortestPathFrom(t){let r=t.getViewportProps(),i={...this.getViewportProps()},{bearing:s,longitude:n}=i;return Math.abs(s-r.bearing)>180&&(i.bearing=s<0?s+360:s-360),Math.abs(n-r.longitude)>180&&(i.longitude=n<0?n+360:n-360),i}applyConstraints(t){let{maxZoom:r,minZoom:i,zoom:s}=t;t.zoom=Il(s,i,r);let{maxPitch:n,minPitch:o,pitch:c}=t;t.pitch=Il(c,o,n);let{normalize:f=!0}=t;return f&&Object.assign(t,eP(t)),t}_zoomFromCenter(t){let{width:r,height:i}=this.getViewportProps();return this.zoom({pos:[r/2,i/2],scale:t})}_panFromCenter(t){let{width:r,height:i}=this.getViewportProps();return this.pan({startPos:[r/2,i/2],pos:[r/2+t[0],i/2+t[1]]})}_getUpdatedState(t){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...t})}_unproject(t){let r=this.makeViewport(this.getViewportProps());return t&&r.unproject(t)}_getNewRotation(t,r,i,s){let n=t[0]-r[0],o=t[1]-r[1],c=t[1],f=r[1],{width:_,height:w}=this.getViewportProps(),I=n/_,R=0;o>0?Math.abs(w-f)>xG&&(R=o/(f-w)*Qlt):o<0&&f>xG&&(R=1-c/f),R=Il(R,-1,1);let{minPitch:N,maxPitch:j}=this.getViewportProps(),Q=s+180*I,et=i;return R>0?et=i+R*(j-i):R<0&&(et=i-R*(N-i)),{pitch:et,bearing:Q}}},Yb=class extends qb{constructor(...t){super(...t),G(this,\"ControllerState\",wD),G(this,\"transition\",{transitionDuration:300,transitionInterpolator:new fg({transitionProps:{compare:[\"longitude\",\"latitude\",\"zoom\",\"bearing\",\"pitch\",\"position\"],required:[\"longitude\",\"latitude\",\"zoom\"]}})}),G(this,\"dragMode\",\"pan\")}setProps(t){t.position=t.position||[0,0,0];let r=this.props;super.setProps(t),(!r||r.height!==t.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...t,...this.state}))}};var Xy=class extends Xc{get ViewportType(){return lc}get ControllerType(){return Yb}};G(Xy,\"displayName\",\"MapView\");var $lt=new qy;function Xlt(e,t){var r,i;let s=(r=e.order)!==null&&r!==void 0?r:1/0,n=(i=t.order)!==null&&i!==void 0?i:1/0;return s-n}var Qb=class{constructor(){G(this,\"effects\",void 0),G(this,\"_resolvedEffects\",[]),G(this,\"_defaultEffects\",[]),G(this,\"_needsRedraw\",void 0),this.effects=[],this._needsRedraw=\"Initial render\",this._setEffects([])}addDefaultEffect(t){let r=this._defaultEffects;if(!r.find(i=>i.id===t.id)){let i=r.findIndex(s=>Xlt(s,t)>0);i<0?r.push(t):r.splice(i,0,t),this._setEffects(this.effects)}}setProps(t){\"effects\"in t&&(mo(t.effects,this.effects,1)||this._setEffects(t.effects))}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),r}getEffects(){return this._resolvedEffects}_setEffects(t){let r={};for(let s of this.effects)r[s.id]=s;let i=[];for(let s of t){let n=r[s.id];n&&n!==s?n.setProps?(n.setProps(s.props),i.push(n)):(n.cleanup(),i.push(s)):i.push(s),delete r[s.id]}for(let s in r)r[s].cleanup();this.effects=i,this._resolvedEffects=i.concat(this._defaultEffects),t.some(s=>s instanceof qy)||this._resolvedEffects.push($lt),this._needsRedraw=\"effects changed\"}finalize(){for(let t of this._resolvedEffects)t.cleanup();this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}};var $b=class extends sc{shouldDrawLayer(t){let{operation:r}=t.props;return r.includes(\"draw\")||r.includes(\"terrain\")}};var Klt=\"deckRenderer.renderLayers\",Xb=class{constructor(t){G(this,\"gl\",void 0),G(this,\"layerFilter\",void 0),G(this,\"drawPickingColors\",void 0),G(this,\"drawLayersPass\",void 0),G(this,\"pickLayersPass\",void 0),G(this,\"renderCount\",void 0),G(this,\"_needsRedraw\",void 0),G(this,\"renderBuffers\",void 0),G(this,\"lastPostProcessEffect\",void 0),this.gl=t,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new $b(t),this.pickLayersPass=new ug(t),this.renderCount=0,this._needsRedraw=\"Initial render\",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(t){this.layerFilter!==t.layerFilter&&(this.layerFilter=t.layerFilter,this._needsRedraw=\"layerFilter changed\"),this.drawPickingColors!==t.drawPickingColors&&(this.drawPickingColors=t.drawPickingColors,this._needsRedraw=\"drawPickingColors changed\")}renderLayers(t){if(!t.viewports.length)return;let r=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,i={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...t,target:t.target||yi.getDefaultFramebuffer(this.gl)};i.effects&&this._preRender(i.effects,i);let s=this.lastPostProcessEffect?this.renderBuffers[0]:i.target,n=r.render({...i,target:s});i.effects&&this._postRender(i.effects,i),this.renderCount++,Ls(Klt,this,n,t)}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),r}finalize(){let{renderBuffers:t}=this;for(let r of t)r.delete();t.length=0}_preRender(t,r){this.lastPostProcessEffect=null,r.preRenderStats=r.preRenderStats||{};for(let i of t)r.preRenderStats[i.id]=i.preRender(this.gl,r),i.postRender&&(this.lastPostProcessEffect=i.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){let{renderBuffers:t}=this;t.length===0&&t.push(new yi(this.gl),new yi(this.gl));for(let r of t)r.resize()}_postRender(t,r){let{renderBuffers:i}=this,s={...r,inputBuffer:i[0],swapBuffer:i[1],target:null};for(let n of t)if(n.postRender){if(n.id===this.lastPostProcessEffect){s.target=r.target,n.postRender(this.gl,s);break}let o=n.postRender(this.gl,s);s.inputBuffer=o,s.swapBuffer=o===i[0]?i[1]:i[0]}}};var Jlt={pickedColor:null,pickedObjectIndex:-1};function bG({pickedColors:e,decodePickingColor:t,deviceX:r,deviceY:i,deviceRadius:s,deviceRect:n}){let{x:o,y:c,width:f,height:_}=n,w=s*s,I=-1,R=0;for(let N=0;N<_;N++){let j=N+c-i,Q=j*j;if(Q>w)R+=4*f;else for(let et=0;et=0){let K=et+o-r,J=K*K+Q;J<=w&&(w=J,I=R)}R+=4}}if(I>=0){let N=e.slice(I,I+4),j=t(N);if(j){let Q=Math.floor(I/4/f),et=I/4-Q*f;return{...j,pickedColor:N,pickedX:o+et,pickedY:c+Q}}or.error(\"Picked non-existent layer. Is picking buffer corrupt?\")()}return Jlt}function wG({pickedColors:e,decodePickingColor:t}){let r=new Map;if(e){for(let i=0;i=0){let n=e.slice(i,i+4),o=n.join(\",\");if(!r.has(o)){let c=t(n);c?r.set(o,{...c,color:n}):or.error(\"Picked non-existent layer. Is picking buffer corrupt?\")()}}}return Array.from(r.values())}function SD({pickInfo:e,viewports:t,pixelRatio:r,x:i,y:s,z:n}){let o=t[0];t.length>1&&(o=tct(e?.pickedViewports||t,{x:i,y:s}));let c;if(o){let f=[i-o.x,s-o.y];n!==void 0&&(f[2]=n),c=o.unproject(f)}return{color:null,layer:null,viewport:o,index:-1,picked:!1,x:i,y:s,pixel:[i,s],coordinate:c,devicePixel:e&&\"pickedX\"in e?[e.pickedX,e.pickedY]:void 0,pixelRatio:r}}function SG(e){let{pickInfo:t,lastPickedInfo:r,mode:i,layers:s}=e,{pickedColor:n,pickedLayer:o,pickedObjectIndex:c}=t,f=o?[o]:[];if(i===\"hover\"){let I=r.index,R=r.layerId,N=o?o.props.id:null;if(N!==R||c!==I){if(N!==R){let j=s.find(Q=>Q.props.id===R);j&&f.unshift(j)}r.layerId=N,r.index=c,r.info=null}}let _=SD(e),w=new Map;return w.set(null,_),f.forEach(I=>{let R={..._};I===o&&(R.color=n,R.index=c,R.picked=!0),R=TD({layer:I,info:R,mode:i});let N=R.layer;I===o&&i===\"hover\"&&(r.info=R),w.set(N.id,R),i===\"hover\"&&N.updateAutoHighlight(R)}),w}function TD({layer:e,info:t,mode:r}){for(;e&&t;){let i=t.layer||null;t.sourceLayer=i,t.layer=e,t=e.getPickingInfo({info:t,mode:r,sourceLayer:i}),e=e.parent}return t}function tct(e,t){for(let r=e.length-1;r>=0;r--){let i=e[r];if(i.containsPixel(t))return i}return e[0]}var Kb=class{constructor(t){G(this,\"gl\",void 0),G(this,\"pickingFBO\",void 0),G(this,\"depthFBO\",void 0),G(this,\"pickLayersPass\",void 0),G(this,\"layerFilter\",void 0),G(this,\"lastPickedInfo\",void 0),G(this,\"_pickable\",!0),this.gl=t,this.pickLayersPass=new ug(t),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(t){\"layerFilter\"in t&&(this.layerFilter=t.layerFilter),\"_pickable\"in t&&(this._pickable=t._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.delete(),this.depthFBO&&(this.depthFBO.color.delete(),this.depthFBO.delete())}pickObject(t){return this._pickClosestObject(t)}pickObjects(t){return this._pickVisibleObjects(t)}getLastPickedObject({x:t,y:r,layers:i,viewports:s},n=this.lastPickedInfo.info){let o=n&&n.layer&&n.layer.id,c=n&&n.viewport&&n.viewport.id,f=o?i.find(R=>R.id===o):null,_=c&&s.find(R=>R.id===c)||s[0],w=_&&_.unproject([t-_.x,r-_.y]);return{...n,...{x:t,y:r,viewport:_,coordinate:w,layer:f}}}_resizeBuffer(){var t,r;let{gl:i}=this;if(!this.pickingFBO&&(this.pickingFBO=new yi(i),yi.isSupported(i,{colorBufferFloat:!0}))){let s=new yi(i);s.attach({36064:new pi(i,{format:fr(i)?34836:6408,type:5126})}),this.depthFBO=s}(t=this.pickingFBO)===null||t===void 0||t.resize({width:i.canvas.width,height:i.canvas.height}),(r=this.depthFBO)===null||r===void 0||r.resize({width:i.canvas.width,height:i.canvas.height})}_getPickable(t){if(this._pickable===!1)return null;let r=t.filter(i=>this.pickLayersPass.shouldDrawLayer(i)&&!i.isComposite);return r.length?r:null}_pickClosestObject({layers:t,views:r,viewports:i,x:s,y:n,radius:o=0,depth:c=1,mode:f=\"query\",unproject3D:_,onViewportActive:w,effects:I}){let R=this._getPickable(t),N=El(this.gl);if(!R)return{result:[],emptyInfo:SD({viewports:i,x:s,y:n,pixelRatio:N})};this._resizeBuffer();let j=Sy(this.gl,[s,n],!0),Q=[j.x+Math.floor(j.width/2),j.y+Math.floor(j.height/2)],et=Math.round(o*N),{width:Y,height:K}=this.pickingFBO,J=this._getPickingRect({deviceX:Q[0],deviceY:Q[1],deviceRadius:et,deviceWidth:Y,deviceHeight:K}),ut={x:s-o,y:n-o,width:o*2+1,height:o*2+1},Et,kt=[],Xt=new Set;for(let qt=0;qt=_)break;let De=kt[ue],Ke={color:De.pickedColor,layer:null,index:De.pickedObjectIndex,picked:!0,x:s,y:n,pixelRatio:N};Ke=TD({layer:De.pickedLayer,info:Ke,mode:f});let rr=(le=Ke.object)!==null&&le!==void 0?le:\"\".concat(Ke.layer.id,\"[\").concat(Ke.index,\"]\");Xt.has(rr)||Xt.set(rr,Ke)}return Array.from(Xt.values())}_drawAndSample({layers:t,views:r,viewports:i,onViewportActive:s,deviceRect:n,cullRect:o,effects:c,pass:f},_=!1){let w=_?this.depthFBO:this.pickingFBO,I={layers:t,layerFilter:this.layerFilter,views:r,viewports:i,onViewportActive:s,pickingFBO:w,deviceRect:n,cullRect:o,effects:c,pass:f,pickZ:_,preRenderStats:{}};for(let K of c)K.useInPicking&&(I.preRenderStats[K.id]=K.preRender(this.gl,I));let{decodePickingColor:R}=this.pickLayersPass.render(I),{x:N,y:j,width:Q,height:et}=n,Y=new(_?Float32Array:Uint8Array)(Q*et*4);return Dh(w,{sourceX:N,sourceY:j,sourceWidth:Q,sourceHeight:et,target:Y}),{pickedColors:Y,decodePickingColor:R}}_getPickingRect({deviceX:t,deviceY:r,deviceRadius:i,deviceWidth:s,deviceHeight:n}){let o=Math.max(0,t-i),c=Math.max(0,r-i),f=Math.min(s,t+i+1)-o,_=Math.min(n,r+i+1)-c;return f<=0||_<=0?null:{x:o,y:c,width:f,height:_}}};var ect={zIndex:\"1\",position:\"absolute\",pointerEvents:\"none\",color:\"#a0a7b4\",backgroundColor:\"#29323c\",padding:\"10px\",top:\"0\",left:\"0\",display:\"none\"},Jb=class{constructor(t){G(this,\"el\",null),G(this,\"isVisible\",!1);let r=t.parentElement;r&&(this.el=document.createElement(\"div\"),this.el.className=\"deck-tooltip\",Object.assign(this.el.style,ect),r.appendChild(this.el))}setTooltip(t,r,i){let s=this.el;if(s){if(typeof t==\"string\")s.innerText=t;else if(t)t.text&&(s.innerText=t.text),t.html&&(s.innerHTML=t.html),t.className&&(s.className=t.className);else{this.isVisible=!1,s.style.display=\"none\";return}this.isVisible=!0,s.style.display=\"block\",s.style.transform=\"translate(\".concat(r,\"px, \").concat(i,\"px)\"),t&&typeof t==\"object\"&&\"style\"in t&&Object.assign(s.style,t.style)}}remove(){this.el&&(this.el.remove(),this.el=null)}};var pg=Ri(TG());var rct={mousedown:1,mousemove:2,mouseup:4};function ict(e,t){for(let r=0;r0&&i.type===\"pointerdown\"&&(ict(s,n=>n.pointerId===i.pointerId)||s.push(i)),t.call(this,i)}}function EG(e){e.prototype.handler=function(r){let i=rct[r.type];i&1&&r.button>=0&&(this.pressed=!0),i&2&&r.which===0&&(i=4),this.pressed&&(i&4&&(this.pressed=!1),this.callback(this.manager,i,{pointers:[r],changedPointers:[r],pointerType:\"mouse\",srcEvent:r}))}}MG(pg.PointerEventInput);EG(pg.MouseInput);var PG=pg.Manager,Hh=pg;var qh=class{constructor(t,r,i){this.element=t,this.callback=r,this.options={enable:!0,...i}}};var IG=Hh?[[Hh.Pan,{event:\"tripan\",pointers:3,threshold:0,enable:!1}],[Hh.Rotate,{enable:!1}],[Hh.Pinch,{enable:!1}],[Hh.Swipe,{enable:!1}],[Hh.Pan,{threshold:0,enable:!1}],[Hh.Press,{enable:!1}],[Hh.Tap,{event:\"doubletap\",taps:2,enable:!1}],[Hh.Tap,{event:\"anytap\",enable:!1}],[Hh.Tap,{enable:!1}]]:null,MD={tripan:[\"rotate\",\"pinch\",\"pan\"],rotate:[\"pinch\"],pinch:[\"pan\"],pan:[\"press\",\"doubletap\",\"anytap\",\"tap\"],doubletap:[\"anytap\"],anytap:[\"tap\"]},CG={doubletap:[\"tap\"]},LG={pointerdown:\"pointerdown\",pointermove:\"pointermove\",pointerup:\"pointerup\",touchstart:\"pointerdown\",touchmove:\"pointermove\",touchend:\"pointerup\",mousedown:\"pointerdown\",mousemove:\"pointermove\",mouseup:\"pointerup\"},Ky={KEY_EVENTS:[\"keydown\",\"keyup\"],MOUSE_EVENTS:[\"mousedown\",\"mousemove\",\"mouseup\",\"mouseover\",\"mouseout\",\"mouseleave\"],WHEEL_EVENTS:[\"wheel\",\"mousewheel\"]},kG={tap:\"tap\",anytap:\"anytap\",doubletap:\"doubletap\",press:\"press\",pinch:\"pinch\",pinchin:\"pinch\",pinchout:\"pinch\",pinchstart:\"pinch\",pinchmove:\"pinch\",pinchend:\"pinch\",pinchcancel:\"pinch\",rotate:\"rotate\",rotatestart:\"rotate\",rotatemove:\"rotate\",rotateend:\"rotate\",rotatecancel:\"rotate\",tripan:\"tripan\",tripanstart:\"tripan\",tripanmove:\"tripan\",tripanup:\"tripan\",tripandown:\"tripan\",tripanleft:\"tripan\",tripanright:\"tripan\",tripanend:\"tripan\",tripancancel:\"tripan\",pan:\"pan\",panstart:\"pan\",panmove:\"pan\",panup:\"pan\",pandown:\"pan\",panleft:\"pan\",panright:\"pan\",panend:\"pan\",pancancel:\"pan\",swipe:\"swipe\",swipeleft:\"swipe\",swiperight:\"swipe\",swipeup:\"swipe\",swipedown:\"swipe\"},ED={click:\"tap\",anyclick:\"anytap\",dblclick:\"doubletap\",mousedown:\"pointerdown\",mousemove:\"pointermove\",mouseup:\"pointerup\",mouseover:\"pointerover\",mouseout:\"pointerout\",mouseleave:\"pointerleave\"};var RG=typeof navigator<\"u\"&&navigator.userAgent?navigator.userAgent.toLowerCase():\"\",Ag=typeof window<\"u\"?window:global;var aP=!1;try{let e={get passive(){return aP=!0,!0}};Ag.addEventListener(\"test\",null,e),Ag.removeEventListener(\"test\",null)}catch{aP=!1}var nct=RG.indexOf(\"firefox\")!==-1,{WHEEL_EVENTS:sct}=Ky,DG=\"wheel\",OG=4.000244140625,oct=40,act=.25,tw=class extends qh{constructor(t,r,i){super(t,r,i),this.handleEvent=s=>{if(!this.options.enable)return;let n=s.deltaY;Ag.WheelEvent&&(nct&&s.deltaMode===Ag.WheelEvent.DOM_DELTA_PIXEL&&(n/=Ag.devicePixelRatio),s.deltaMode===Ag.WheelEvent.DOM_DELTA_LINE&&(n*=oct)),n!==0&&n%OG===0&&(n=Math.floor(n/OG)),s.shiftKey&&n&&(n=n*act),this.callback({type:DG,center:{x:s.clientX,y:s.clientY},delta:-n,srcEvent:s,pointerType:\"mouse\",target:s.target})},this.events=(this.options.events||[]).concat(sct),this.events.forEach(s=>t.addEventListener(s,this.handleEvent,aP?{passive:!1}:!1))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,r){t===DG&&(this.options.enable=r)}};var{MOUSE_EVENTS:lct}=Ky,BG=\"pointermove\",FG=\"pointerover\",zG=\"pointerout\",NG=\"pointerenter\",UG=\"pointerleave\",ew=class extends qh{constructor(t,r,i){super(t,r,i),this.handleEvent=n=>{this.handleOverEvent(n),this.handleOutEvent(n),this.handleEnterEvent(n),this.handleLeaveEvent(n),this.handleMoveEvent(n)},this.pressed=!1;let{enable:s}=this.options;this.enableMoveEvent=s,this.enableLeaveEvent=s,this.enableEnterEvent=s,this.enableOutEvent=s,this.enableOverEvent=s,this.events=(this.options.events||[]).concat(lct),this.events.forEach(n=>t.addEventListener(n,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,r){t===BG&&(this.enableMoveEvent=r),t===FG&&(this.enableOverEvent=r),t===zG&&(this.enableOutEvent=r),t===NG&&(this.enableEnterEvent=r),t===UG&&(this.enableLeaveEvent=r)}handleOverEvent(t){this.enableOverEvent&&t.type===\"mouseover\"&&this._emit(FG,t)}handleOutEvent(t){this.enableOutEvent&&t.type===\"mouseout\"&&this._emit(zG,t)}handleEnterEvent(t){this.enableEnterEvent&&t.type===\"mouseenter\"&&this._emit(NG,t)}handleLeaveEvent(t){this.enableLeaveEvent&&t.type===\"mouseleave\"&&this._emit(UG,t)}handleMoveEvent(t){if(this.enableMoveEvent)switch(t.type){case\"mousedown\":t.button>=0&&(this.pressed=!0);break;case\"mousemove\":t.which===0&&(this.pressed=!1),this.pressed||this._emit(BG,t);break;case\"mouseup\":this.pressed=!1;break;default:}}_emit(t,r){this.callback({type:t,center:{x:r.clientX,y:r.clientY},srcEvent:r,pointerType:\"mouse\",target:r.target})}};var{KEY_EVENTS:cct}=Ky,VG=\"keydown\",jG=\"keyup\",rw=class extends qh{constructor(t,r,i){super(t,r,i),this.handleEvent=s=>{let n=s.target||s.srcElement;n.tagName===\"INPUT\"&&n.type===\"text\"||n.tagName===\"TEXTAREA\"||(this.enableDownEvent&&s.type===\"keydown\"&&this.callback({type:VG,srcEvent:s,key:s.key,target:s.target}),this.enableUpEvent&&s.type===\"keyup\"&&this.callback({type:jG,srcEvent:s,key:s.key,target:s.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=(this.options.events||[]).concat(cct),t.tabIndex=this.options.tabIndex||0,t.style.outline=\"none\",this.events.forEach(s=>t.addEventListener(s,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,r){t===VG&&(this.enableDownEvent=r),t===jG&&(this.enableUpEvent=r)}};var GG=\"contextmenu\",iw=class extends qh{constructor(t,r,i){super(t,r,i),this.handleEvent=s=>{this.options.enable&&this.callback({type:GG,center:{x:s.clientX,y:s.clientY},srcEvent:s,pointerType:\"mouse\",target:s.target})},t.addEventListener(\"contextmenu\",this.handleEvent)}destroy(){this.element.removeEventListener(\"contextmenu\",this.handleEvent)}enableEventType(t,r){t===GG&&(this.options.enable=r)}};var uct={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},hct=1,fct=2,dct=3,pct=0,Act=1,mct=2,gct=1,_ct=2,yct=4;function WG(e){let t=uct[e.srcEvent.type];if(!t)return null;let{buttons:r,button:i,which:s}=e.srcEvent,n=!1,o=!1,c=!1;return t===4||t===2&&!Number.isFinite(r)?(n=s===hct,o=s===fct,c=s===dct):t===2?(n=!!(r&gct),o=!!(r&yct),c=!!(r&_ct)):t===1&&(n=i===pct,o=i===Act,c=i===mct),{leftButton:n,middleButton:o,rightButton:c}}function HG(e,t){let r=e.center;if(!r)return null;let i=t.getBoundingClientRect(),s=i.width/t.offsetWidth||1,n=i.height/t.offsetHeight||1,o={x:(r.x-i.left-t.clientLeft)/s,y:(r.y-i.top-t.clientTop)/n};return{center:r,offsetCenter:o}}var PD={srcElement:\"root\",priority:0},nw=class{constructor(t){this.handleEvent=r=>{if(this.isEmpty())return;let i=this._normalizeEvent(r),s=r.srcEvent.target;for(;s&&s!==i.rootElement;){if(this._emit(i,s),i.handled)return;s=s.parentNode}this._emit(i,\"root\")},this.eventManager=t,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(t,r,i,s=!1,n=!1){let{handlers:o,handlersByElement:c}=this,f=PD;typeof i==\"string\"||i&&i.addEventListener?f={...PD,srcElement:i}:i&&(f={...PD,...i});let _=c.get(f.srcElement);_||(_=[],c.set(f.srcElement,_));let w={type:t,handler:r,srcElement:f.srcElement,priority:f.priority};s&&(w.once=!0),n&&(w.passive=!0),o.push(w),this._active=this._active||!w.passive;let I=_.length-1;for(;I>=0&&!(_[I].priority>=w.priority);)I--;_.splice(I+1,0,w)}remove(t,r){let{handlers:i,handlersByElement:s}=this;for(let n=i.length-1;n>=0;n--){let o=i[n];if(o.type===t&&o.handler===r){i.splice(n,1);let c=s.get(o.srcElement);c.splice(c.indexOf(o),1),c.length===0&&s.delete(o.srcElement)}}this._active=i.some(n=>!n.passive)}_emit(t,r){let i=this.handlersByElement.get(r);if(i){let s=!1,n=()=>{t.handled=!0},o=()=>{t.handled=!0,s=!0},c=[];for(let f=0;f{t.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:r}}};var vct={events:null,recognizers:null,recognizerOptions:{},Manager:PG,touchAction:\"none\",tabIndex:0},Jy=class{constructor(t=null,r){this._onBasicInput=s=>{let{srcEvent:n}=s,o=LG[n.type];o&&this.manager.emit(o,s)},this._onOtherEvent=s=>{this.manager.emit(s.type,s)},this.options={...vct,...r},this.events=new Map,this.setElement(t);let{events:i}=this.options;i&&this.on(i)}getElement(){return this.element}setElement(t){if(this.element&&this.destroy(),this.element=t,!t)return;let{options:r}=this,i=r.Manager;this.manager=new i(t,{touchAction:r.touchAction,recognizers:r.recognizers||IG}).on(\"hammer.input\",this._onBasicInput),r.recognizers||Object.keys(MD).forEach(s=>{let n=this.manager.get(s);n&&MD[s].forEach(o=>{n.recognizeWith(o)})});for(let s in r.recognizerOptions){let n=this.manager.get(s);if(n){let o=r.recognizerOptions[s];delete o.enable,n.set(o)}}this.wheelInput=new tw(t,this._onOtherEvent,{enable:!1}),this.moveInput=new ew(t,this._onOtherEvent,{enable:!1}),this.keyInput=new rw(t,this._onOtherEvent,{enable:!1,tabIndex:r.tabIndex}),this.contextmenuInput=new iw(t,this._onOtherEvent,{enable:!1});for(let[s,n]of this.events)n.isEmpty()||(this._toggleRecognizer(n.recognizerName,!0),this.manager.on(s,n.handleEvent))}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}on(t,r,i){this._addEventHandler(t,r,i,!1)}once(t,r,i){this._addEventHandler(t,r,i,!0)}watch(t,r,i){this._addEventHandler(t,r,i,!1,!0)}off(t,r){this._removeEventHandler(t,r)}_toggleRecognizer(t,r){let{manager:i}=this;if(!i)return;let s=i.get(t);if(s&&s.options.enable!==r){s.set({enable:r});let n=CG[t];n&&!this.options.recognizers&&n.forEach(o=>{let c=i.get(o);r?(c.requireFailure(t),s.dropRequireFailure(o)):c.dropRequireFailure(t)})}this.wheelInput.enableEventType(t,r),this.moveInput.enableEventType(t,r),this.keyInput.enableEventType(t,r),this.contextmenuInput.enableEventType(t,r)}_addEventHandler(t,r,i,s,n){if(typeof t!=\"string\"){i=r;for(let w in t)this._addEventHandler(w,t[w],i,s,n);return}let{manager:o,events:c}=this,f=ED[t]||t,_=c.get(f);_||(_=new nw(this),c.set(f,_),_.recognizerName=kG[f]||f,o&&o.on(f,_.handleEvent)),_.add(t,r,i,s,n),_.isEmpty()||this._toggleRecognizer(_.recognizerName,!0)}_removeEventHandler(t,r){if(typeof t!=\"string\"){for(let o in t)this._removeEventHandler(o,t[o]);return}let{events:i}=this,s=ED[t]||t,n=i.get(s);if(n&&(n.remove(t,r),n.isEmpty())){let{recognizerName:o}=n,c=!1;for(let f of i.values())if(f.recognizerName===o&&!f.isEmpty()){c=!0;break}c||this._toggleRecognizer(o,!1)}}};function mg(){}var xct=({isDragging:e})=>e?\"grabbing\":\"grab\",qG={id:\"\",width:\"100%\",height:\"100%\",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,glOptions:{},parameters:{},parent:null,gl:null,canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:\"none\",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,onWebGLInitialized:mg,onResize:mg,onViewStateChange:mg,onInteractionStateChange:mg,onBeforeRender:mg,onAfterRender:mg,onLoad:mg,onError:e=>or.error(e.message,e.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:xct,getTooltip:null,debug:!1,drawPickingColors:!1},cp=class{constructor(t){G(this,\"props\",void 0),G(this,\"width\",0),G(this,\"height\",0),G(this,\"userData\",{}),G(this,\"canvas\",null),G(this,\"viewManager\",null),G(this,\"layerManager\",null),G(this,\"effectManager\",null),G(this,\"deckRenderer\",null),G(this,\"deckPicker\",null),G(this,\"eventManager\",null),G(this,\"tooltip\",null),G(this,\"metrics\",void 0),G(this,\"animationLoop\",void 0),G(this,\"stats\",void 0),G(this,\"viewState\",void 0),G(this,\"cursorState\",void 0),G(this,\"_needsRedraw\",void 0),G(this,\"_pickRequest\",void 0),G(this,\"_lastPointerDownInfo\",null),G(this,\"_metricsCounter\",void 0),G(this,\"_onPointerMove\",r=>{let{_pickRequest:i}=this;if(r.type===\"pointerleave\")i.x=-1,i.y=-1,i.radius=0;else{if(r.leftButton||r.rightButton)return;{let s=r.offsetCenter;if(!s)return;i.x=s.x,i.y=s.y,i.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:i.x,y:i.y}),i.event=r}),G(this,\"_onEvent\",r=>{let i=nR[r.type],s=r.offsetCenter;if(!i||!s||!this.layerManager)return;let n=this.layerManager.getLayers(),o=this.deckPicker.getLastPickedObject({x:s.x,y:s.y,layers:n,viewports:this.getViewports(s)},this._lastPointerDownInfo),{layer:c}=o,f=c&&(c[i.handler]||c.props[i.handler]),_=this.props[i.handler],w=!1;f&&(w=f.call(c,o,r)),!w&&_&&_(o,r)}),G(this,\"_onPointerDown\",r=>{let i=r.offsetCenter,s=this._pick(\"pickObject\",\"pickObject Time\",{x:i.x,y:i.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=s.result[0]||s.emptyInfo}),this.props={...qG,...t},t=this.props,this._needsRedraw=\"Initial render\",this._pickRequest={mode:\"hover\",x:-1,y:-1,radius:0,event:null},this.cursorState={isHovering:!1,isDragging:!1},t.viewState&&t.initialViewState&&or.warn(\"View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.\")(),vy()===\"IE\"&&or.warn(\"IE 11 is not supported\")(),this.viewState=t.initialViewState,t.gl||typeof document<\"u\"&&(this.canvas=this._createCanvas(t)),this.animationLoop=this._createAnimationLoop(t),this.stats=new Gf({id:\"deck.gl\"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this.setProps(t),t._typedArrayManagerProps&&Gh.setOptions(t._typedArrayManagerProps),this.animationLoop.start()}finalize(){var t,r,i,s,n,o,c,f;if((t=this.animationLoop)===null||t===void 0||t.stop(),this.animationLoop=null,this._lastPointerDownInfo=null,(r=this.layerManager)===null||r===void 0||r.finalize(),this.layerManager=null,(i=this.viewManager)===null||i===void 0||i.finalize(),this.viewManager=null,(s=this.effectManager)===null||s===void 0||s.finalize(),this.effectManager=null,(n=this.deckRenderer)===null||n===void 0||n.finalize(),this.deckRenderer=null,(o=this.deckPicker)===null||o===void 0||o.finalize(),this.deckPicker=null,(c=this.eventManager)===null||c===void 0||c.destroy(),this.eventManager=null,(f=this.tooltip)===null||f===void 0||f.remove(),this.tooltip=null,!this.props.canvas&&!this.props.gl&&this.canvas){var _;(_=this.canvas.parentElement)===null||_===void 0||_.removeChild(this.canvas),this.canvas=null}}setProps(t){this.stats.get(\"setProps Time\").timeStart(),\"onLayerHover\"in t&&or.removed(\"onLayerHover\",\"onHover\")(),\"onLayerClick\"in t&&or.removed(\"onLayerClick\",\"onClick\")(),t.initialViewState&&!mo(this.props.initialViewState,t.initialViewState,3)&&(this.viewState=t.initialViewState),Object.assign(this.props,t),this._setCanvasSize(this.props);let r=Object.create(this.props);Object.assign(r,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),this.animationLoop.setProps(r),this.layerManager&&(this.viewManager.setProps(r),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(r),this.effectManager.setProps(r),this.deckRenderer.setProps(r),this.deckPicker.setProps(r)),this.stats.get(\"setProps Time\").timeEnd()}needsRedraw(t={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return\"Deck._animate\";let r=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);let i=this.viewManager.needsRedraw(t),s=this.layerManager.needsRedraw(t),n=this.effectManager.needsRedraw(t),o=this.deckRenderer.needsRedraw(t);return r=r||i||s||n||o,r}redraw(t){if(!this.layerManager)return;let r=this.needsRedraw({clearRedrawFlags:!0});r=t||r,r&&(this.stats.get(\"Redraw Count\").incrementCount(),this.props._customRender?this.props._customRender(r):this._drawLayers(r))}get isInitialized(){return this.viewManager!==null}getViews(){return _r(this.viewManager),this.viewManager.views}getViewports(t){return _r(this.viewManager),this.viewManager.getViewports(t)}getCanvas(){return this.canvas}pickObject(t){let r=this._pick(\"pickObject\",\"pickObject Time\",t).result;return r.length?r[0]:null}pickMultipleObjects(t){return t.depth=t.depth||10,this._pick(\"pickObject\",\"pickMultipleObjects Time\",t).result}pickObjects(t){return this._pick(\"pickObjects\",\"pickObjects Time\",t)}_addResources(t,r=!1){for(let i in t)this.layerManager.resourceManager.add({resourceId:i,data:t[i],forceUpdate:r})}_removeResources(t){for(let r of t)this.layerManager.resourceManager.remove(r)}_addDefaultEffect(t){this.effectManager.addDefaultEffect(t)}_pick(t,r,i){_r(this.deckPicker);let{stats:s}=this;s.get(\"Pick Count\").incrementCount(),s.get(r).timeStart();let n=this.deckPicker[t]({layers:this.layerManager.getLayers(i),views:this.viewManager.getViews(),viewports:this.getViewports(i),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...i});return s.get(r).timeEnd(),n}_createCanvas(t){let r=t.canvas;return typeof r==\"string\"&&(r=document.getElementById(r),_r(r)),r||(r=document.createElement(\"canvas\"),r.id=t.id||\"deckgl-overlay\",(t.parent||document.body).appendChild(r)),Object.assign(r.style,t.style),r}_setCanvasSize(t){if(!this.canvas)return;let{width:r,height:i}=t;if(r||r===0){let n=Number.isFinite(r)?\"\".concat(r,\"px\"):r;this.canvas.style.width=n}if(i||i===0){var s;let n=Number.isFinite(i)?\"\".concat(i,\"px\"):i;this.canvas.style.position=((s=t.style)===null||s===void 0?void 0:s.position)||\"absolute\",this.canvas.style.height=n}}_updateCanvasSize(){var t,r;let{canvas:i}=this;if(!i)return;let s=(t=i.clientWidth)!==null&&t!==void 0?t:i.width,n=(r=i.clientHeight)!==null&&r!==void 0?r:i.height;if(s!==this.width||n!==this.height){var o,c;this.width=s,this.height=n,(o=this.viewManager)===null||o===void 0||o.setProps({width:s,height:n}),(c=this.layerManager)===null||c===void 0||c.activateViewport(this.getViewports()[0]),this.props.onResize({width:s,height:n})}}_createAnimationLoop(t){let{width:r,height:i,gl:s,glOptions:n,debug:o,onError:c,onBeforeRender:f,onAfterRender:_,useDevicePixels:w}=t;return new rg({width:r,height:i,useDevicePixels:w,autoResizeDrawingBuffer:!s,autoResizeViewport:!1,gl:s,onCreateContext:I=>Ty({...n,...I,canvas:this.canvas,debug:o,onContextLost:()=>this._onContextLost()}),onInitialize:I=>this._setGLContext(I.gl),onRender:this._onRenderFrame.bind(this),onBeforeRender:f,onAfterRender:_,onError:c})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let t=this.props.views||[new Xy({id:\"default-view\"})];return t=Array.isArray(t)?t:[t],t.length&&this.props.controller&&(t[0].props.controller=this.props.controller),t}_onContextLost(){let{onError:t}=this.props;this.animationLoop&&t&&t(new Error(\"WebGL context is lost\"))}_pickAndCallback(){let{_pickRequest:t}=this;if(t.event){let{result:i,emptyInfo:s}=this._pick(\"pickObject\",\"pickObject Time\",t);this.cursorState.isHovering=i.length>0;let n=s,o=!1;for(let c of i){var r;n=c,o=((r=c.layer)===null||r===void 0?void 0:r.onHover(c,t.event))||o}if(!o&&this.props.onHover&&this.props.onHover(n,t.event),this.props.getTooltip&&this.tooltip){let c=this.props.getTooltip(n);this.tooltip.setTooltip(c,n.x,n.y)}t.event=null}}_updateCursor(){let t=this.props.parent||this.canvas;t&&(t.style.cursor=this.props.getCursor(this.cursorState))}_setGLContext(t){if(this.layerManager)return;this.canvas||(this.canvas=t.canvas,q0(t,{enable:!0,copyState:!0})),this.tooltip=new Jb(this.canvas),Ml(t,{blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onWebGLInitialized(t);let r=new KA;r.play(),this.animationLoop.attachTimeline(r),this.eventManager=new Jy(this.props.parent||t.canvas,{touchAction:this.props.touchAction,recognizerOptions:this.props.eventRecognizerOptions,events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(let s in nR)this.eventManager.on(s,this._onEvent);this.viewManager=new Wb({timeline:r,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});let i=this.viewManager.getViewports()[0];this.layerManager=new Gb(t,{deck:this,stats:this.stats,viewport:i,timeline:r}),this.effectManager=new Qb,this.deckRenderer=new Xb(t),this.deckPicker=new Kb(t),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(t,r){let{gl:i}=this.layerManager.context;Ml(i,this.props.parameters),this.props.onBeforeRender({gl:i}),this.deckRenderer.renderLayers({target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:\"screen\",effects:this.effectManager.getEffects(),...r}),this.props.onAfterRender({gl:i})}_onRenderFrame(t){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),or.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.tooltip.isVisible&&this.viewManager.needsRedraw()&&this.tooltip.setTooltip(null),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(t){let r=this.props.onViewStateChange(t)||t.viewState;this.viewState&&(this.viewState={...this.viewState,[t.viewId]:r},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(t){this.cursorState.isDragging=t.isDragging||!1,this.props.onInteractionStateChange(t)}_getFrameStats(){let{stats:t}=this;t.get(\"frameRate\").timeEnd(),t.get(\"frameRate\").timeStart();let r=this.animationLoop.stats;t.get(\"GPU Time\").addTime(r.get(\"GPU Time\").lastTiming),t.get(\"CPU Time\").addTime(r.get(\"CPU Time\").lastTiming)}_getMetrics(){let{metrics:t,stats:r}=this;t.fps=r.get(\"frameRate\").getHz(),t.setPropsTime=r.get(\"setProps Time\").time,t.updateAttributesTime=r.get(\"Update Attributes\").time,t.framesRedrawn=r.get(\"Redraw Count\").count,t.pickTime=r.get(\"pickObject Time\").time+r.get(\"pickMultipleObjects Time\").time+r.get(\"pickObjects Time\").time,t.pickCount=r.get(\"Pick Count\").count,t.gpuTime=r.get(\"GPU Time\").time,t.cpuTime=r.get(\"CPU Time\").time,t.gpuTimePerFrame=r.get(\"GPU Time\").getAverageTime(),t.cpuTimePerFrame=r.get(\"CPU Time\").getAverageTime();let i=Du.get(\"Memory Usage\");t.bufferMemory=i.get(\"Buffer Memory\").count,t.textureMemory=i.get(\"Texture Memory\").count,t.renderbufferMemory=i.get(\"Renderbuffer Memory\").count,t.gpuMemory=i.get(\"GPU Memory\").count}};G(cp,\"defaultProps\",qG);G(cp,\"VERSION\",xV);var gg=class{constructor(t,r){G(this,\"opts\",void 0),G(this,\"source\",void 0),this.opts=r,this.source=t}get value(){return this.source.value}getValue(){let t=this.source.getBuffer(),r=this.getAccessor();if(t)return[t,r];let{value:i}=this.source,{size:s}=r,n=i;if(i&&i.length!==s){n=new Float32Array(s);let o=r.elementOffset||0;for(let c=0;c=n){let o=new Array(s).fill(1/0),c=new Array(s).fill(-1/0);for(let f=0;fc[_]&&(c[_]=w)}t=[o,c]}}return this.state.bounds=t,t}setData(t){let{state:r}=this,i;ArrayBuffer.isView(t)?i={value:t}:t instanceof Fr?i={buffer:t}:i=t;let s={...this.settings,...i};if(r.bufferAccessor=s,r.bounds=null,i.constant){let n=i.value;if(n=this._normalizeValue(n,[],0),this.settings.normalized&&(n=this.normalizeConstant(n)),!(!r.constant||!this._areValuesEqual(n,this.value)))return!1;r.externalBuffer=null,r.constant=!0,this.value=n}else if(i.buffer){let n=i.buffer;r.externalBuffer=n,r.constant=!1,this.value=i.value||null;let o=i.value instanceof Float64Array;s.type=i.type||n.accessor.type,s.bytesPerElement=n.accessor.BYTES_PER_ELEMENT*(o?2:1),s.stride=lP(s)}else if(i.value){this._checkExternalBuffer(i);let n=i.value;r.externalBuffer=null,r.constant=!1,this.value=n,s.bytesPerElement=n.BYTES_PER_ELEMENT,s.stride=lP(s);let{buffer:o,byteOffset:c}=this;this.doublePrecision&&n instanceof Float64Array&&(n=iP(n,s));let f=n.byteLength+c+s.stride*2;o.byteLength(r+128)/255*2-1);case 5122:return new Float32Array(t).map(r=>(r+32768)/65535*2-1);case 5121:return new Float32Array(t).map(r=>r/255);case 5123:return new Float32Array(t).map(r=>r/65535);default:return t}}_normalizeValue(t,r,i){let{defaultValue:s,size:n}=this.settings;if(Number.isFinite(t))return r[i]=t,r;if(!t){let o=n;for(;--o>=0;)r[i+o]=s[o];return r}switch(n){case 4:r[i+3]=Number.isFinite(t[3])?t[3]:s[3];case 3:r[i+2]=Number.isFinite(t[2])?t[2]:s[2];case 2:r[i+1]=Number.isFinite(t[1])?t[1]:s[1];case 1:r[i+0]=Number.isFinite(t[0])?t[0]:s[0];break;default:let o=n;for(;--o>=0;)r[i+o]=Number.isFinite(t[o])?t[o]:s[o]}return r}_areValuesEqual(t,r){if(!t||!r)return!1;let{size:i}=this;for(let s=0;s0&&($G.length=e.length,i=$G):i=QG,(t>0||Number.isFinite(r))&&(i=(Array.isArray(i)?i:Array.from(i)).slice(t,r),s.index=t-1),{iterable:i,objectInfo:s}}function cP(e){return e&&e[Symbol.asyncIterator]}function uP(e,t){let{size:r,stride:i,offset:s,startIndices:n,nested:o}=t,c=e.BYTES_PER_ELEMENT,f=i?i/c:r,_=s?s/c:0,w=Math.floor((e.length-_)/f);return(I,{index:R,target:N})=>{if(!n){let Y=R*f+_;for(let K=0;K=t[1]))return e;let r=[],i=e.length,s=0;for(let n=0;nt[1]?r.push(o):t=[Math.min(o[0],t[0]),Math.max(o[1],t[1])]}return r.splice(s,0,t),r}function ID(e){let{source:t,target:r,start:i=0,size:s,getData:n}=e,o=e.end||r.length,c=t.length,f=o-i;if(c>f){r.set(t.subarray(0,f),i);return}if(r.set(t,i),!n)return;let _=c;for(;_i(w+c,I)),_=Math.min(s.length,n.length);for(let w=1;w<_;w++){let I=s[w]*r,R=n[w]*r;ID({source:e.subarray(o,I),target:t,start:c,end:R,size:r,getData:f}),o=I,c=R}return ce},spring:{stiffness:.05,damping:.5}};function hP(e,t){if(!e)return null;Number.isFinite(e)&&(e={type:\"interpolation\",duration:e});let r=e.type||\"interpolation\";return{...Sct[r],...t,...e,type:r}}function fP(e,t){let r=t.getBuffer();return r?[r,{divisor:0,size:t.size,normalized:t.settings.normalized}]:t.value}function dP(e){switch(e){case 1:return\"float\";case 2:return\"vec2\";case 3:return\"vec3\";case 4:return\"vec4\";default:throw new Error('No defined attribute type for size \"'.concat(e,'\"'))}}function pP(e){e.push(e.shift())}function aw(e,t){let{doublePrecision:r,settings:i,value:s,size:n}=e,o=r&&s instanceof Float64Array?2:1;return(i.noAlloc?s.length:t*n)*o}function AP({buffer:e,numInstances:t,attribute:r,fromLength:i,fromStartIndices:s,getData:n=o=>o}){let o=r.doublePrecision&&r.value instanceof Float64Array?2:1,c=r.size*o,f=r.byteOffset,_=r.startIndices,w=s&&_,I=aw(r,t),R=r.isConstant;if(!w&&i>=I)return;let N=R?r.value:r.getBuffer().getData({srcByteOffset:f});if(r.settings.normalized&&!R){let Y=n;n=(K,J)=>r.normalizeConstant(Y(K,J))}let j=R?(Y,K)=>n(N,K):(Y,K)=>n(N.subarray(Y,Y+c),K),Q=e.getData({length:i}),et=new Float32Array(I);JG({source:Q,target:et,sourceStartIndices:s,targetStartIndices:_,size:c,getData:j}),e.byteLengtht[n])]:t[r];return hP(s,i)}setNeedsUpdate(t=this.id,r){if(this.state.needsUpdate=this.state.needsUpdate||t,this.setNeedsRedraw(t),r){let{startRow:i=0,endRow:s=1/0}=r;this.state.updateRanges=KG(this.state.updateRanges,[i,s])}else this.state.updateRanges=ow}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=XG}setNeedsRedraw(t=this.id){this.state.needsRedraw=this.state.needsRedraw||t}allocate(t){let{state:r,settings:i}=this;return i.noAlloc?!1:i.update?(super.allocate(t,r.updateRanges!==ow),!0):!1}updateBuffer({numInstances:t,data:r,props:i,context:s}){if(!this.needsUpdate())return!1;let{state:{updateRanges:n},settings:{update:o,noAlloc:c}}=this,f=!0;if(o){for(let[_,w]of n)o.call(s,this,{data:r,startRow:_,endRow:w,props:i,numInstances:t});if(this.value)if(this.constant||this.buffer.byteLengthw?_.set(J,Q):(t._normalizeValue(J,Y.target,0),xD({target:_,source:Y.target,start:Q,count:ut}));Q+=ut*w}else t._normalizeValue(J,_,Q),Q+=w}}_validateAttributeUpdaters(){let{settings:t}=this;if(!(t.noAlloc||typeof t.update==\"function\"))throw new Error(\"Attribute \".concat(this.id,\" missing update or accessor\"))}_checkAttributeArray(){let{value:t}=this,r=Math.min(4,this.size);if(t&&t.length>=r){let i=!0;switch(r){case 4:i=i&&Number.isFinite(t[3]);case 3:i=i&&Number.isFinite(t[2]);case 2:i=i&&Number.isFinite(t[1]);case 1:i=i&&Number.isFinite(t[0]);break;default:i=!1}if(!i)throw new Error(\"Illegal attribute generated for \".concat(this.id))}}};var lw=class{constructor({gl:t,attribute:r,timeline:i}){G(this,\"gl\",void 0),G(this,\"type\",\"interpolation\"),G(this,\"attributeInTransition\",void 0),G(this,\"settings\",void 0),G(this,\"attribute\",void 0),G(this,\"transition\",void 0),G(this,\"currentStartIndices\",void 0),G(this,\"currentLength\",void 0),G(this,\"transform\",void 0),G(this,\"buffers\",void 0),this.gl=t,this.transition=new Kc(i),this.attribute=r,this.attributeInTransition=new up(t,r.settings),this.currentStartIndices=r.startIndices,this.currentLength=0,this.transform=Mct(t,r);let s={byteLength:0,usage:35050};this.buffers=[new Fr(t,s),new Fr(t,s)]}get inProgress(){return this.transition.inProgress}start(t,r){if(t.duration<=0){this.transition.cancel();return}this.settings=t;let{gl:i,buffers:s,attribute:n}=this;pP(s);let o={numInstances:r,attribute:n,fromLength:this.currentLength,fromStartIndices:this.currentStartIndices,getData:t.enter};for(let c of s)AP({buffer:c,...o});this.currentStartIndices=n.startIndices,this.currentLength=aw(n,r),this.attributeInTransition.setData({buffer:s[1],value:n.value}),this.transition.start(t),this.transform.update({elementCount:Math.floor(this.currentLength/n.size),sourceBuffers:{aFrom:s[0],aTo:fP(i,n)},feedbackBuffers:{vCurrent:s[1]}})}update(){let t=this.transition.update();if(t){let{duration:r,easing:i}=this.settings,{time:s}=this.transition,n=s/r;i&&(n=i(n)),this.transform.run({uniforms:{time:n}})}return t}cancel(){this.transition.cancel(),this.transform.delete();for(let t of this.buffers)t.delete();this.buffers.length=0}},Tct=`\n#define SHADER_NAME interpolation-transition-vertex-shader\n\nuniform float time;\nattribute ATTRIBUTE_TYPE aFrom;\nattribute ATTRIBUTE_TYPE aTo;\nvarying ATTRIBUTE_TYPE vCurrent;\n\nvoid main(void) {\n vCurrent = mix(aFrom, aTo, time);\n gl_Position = vec4(0.0);\n}\n`;function Mct(e,t){let r=dP(t.size);return new nc(e,{vs:Tct,defines:{ATTRIBUTE_TYPE:r},varyings:[\"vCurrent\"]})}var cw=class{constructor({gl:t,attribute:r,timeline:i}){G(this,\"gl\",void 0),G(this,\"type\",\"spring\"),G(this,\"attributeInTransition\",void 0),G(this,\"settings\",void 0),G(this,\"attribute\",void 0),G(this,\"transition\",void 0),G(this,\"currentStartIndices\",void 0),G(this,\"currentLength\",void 0),G(this,\"texture\",void 0),G(this,\"framebuffer\",void 0),G(this,\"transform\",void 0),G(this,\"buffers\",void 0),this.gl=t,this.type=\"spring\",this.transition=new Kc(i),this.attribute=r,this.attributeInTransition=new up(t,{...r.settings,normalized:!1}),this.currentStartIndices=r.startIndices,this.currentLength=0,this.texture=Pct(t),this.framebuffer=Ict(t,this.texture),this.transform=Ect(t,r,this.framebuffer);let s={byteLength:0,usage:35050};this.buffers=[new Fr(t,s),new Fr(t,s),new Fr(t,s)]}get inProgress(){return this.transition.inProgress}start(t,r){let{gl:i,buffers:s,attribute:n}=this,o={numInstances:r,attribute:n,fromLength:this.currentLength,fromStartIndices:this.currentStartIndices,getData:t.enter};for(let c of s)AP({buffer:c,...o});this.settings=t,this.currentStartIndices=n.startIndices,this.currentLength=aw(n,r),this.attributeInTransition.setData({buffer:s[1],value:n.value}),this.transition.start({...t,duration:1/0}),this.transform.update({elementCount:Math.floor(this.currentLength/n.size),sourceBuffers:{aTo:fP(i,n)}})}update(){let{buffers:t,transform:r,framebuffer:i,transition:s}=this;if(!s.update())return!1;let o=this.settings;return r.update({sourceBuffers:{aPrev:t[0],aCur:t[1]},feedbackBuffers:{vNext:t[2]}}),r.run({framebuffer:i,discard:!1,clearRenderTarget:!0,uniforms:{stiffness:o.stiffness,damping:o.damping},parameters:{depthTest:!1,blend:!0,viewport:[0,0,1,1],blendFunc:[1,1],blendEquation:[32776,32776]}}),pP(t),this.attributeInTransition.setData({buffer:t[1],value:this.attribute.value}),Dh(i)[0]>0||s.end(),!0}cancel(){this.transition.cancel(),this.transform.delete();for(let t of this.buffers)t.delete();this.buffers.length=0,this.texture.delete(),this.framebuffer.delete()}};function Ect(e,t,r){let i=dP(t.size);return new nc(e,{framebuffer:r,vs:`\n#define SHADER_NAME spring-transition-vertex-shader\n\n#define EPSILON 0.00001\n\nuniform float stiffness;\nuniform float damping;\nattribute ATTRIBUTE_TYPE aPrev;\nattribute ATTRIBUTE_TYPE aCur;\nattribute ATTRIBUTE_TYPE aTo;\nvarying ATTRIBUTE_TYPE vNext;\nvarying float vIsTransitioningFlag;\n\nATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) {\n ATTRIBUTE_TYPE velocity = cur - prev;\n ATTRIBUTE_TYPE delta = dest - cur;\n ATTRIBUTE_TYPE spring = delta * stiffness;\n ATTRIBUTE_TYPE damper = velocity * -1.0 * damping;\n return spring + damper + velocity + cur;\n}\n\nvoid main(void) {\n bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON;\n vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0;\n\n vNext = getNextValue(aCur, aPrev, aTo);\n gl_Position = vec4(0, 0, 0, 1);\n gl_PointSize = 100.0;\n}\n`,fs:`\n#define SHADER_NAME spring-transition-is-transitioning-fragment-shader\n\nvarying float vIsTransitioningFlag;\n\nvoid main(void) {\n if (vIsTransitioningFlag == 0.0) {\n discard;\n }\n gl_FragColor = vec4(1.0);\n}`,defines:{ATTRIBUTE_TYPE:i},varyings:[\"vNext\"]})}function Pct(e){return new pi(e,{data:new Uint8Array(4),format:6408,type:5121,border:0,mipmaps:!1,dataFormat:6408,width:1,height:1})}function Ict(e,t){return new yi(e,{id:\"spring-transition-is-transitioning-framebuffer\",width:1,height:1,attachments:{36064:t}})}var Cct={interpolation:lw,spring:cw},uw=class{constructor(t,{id:r,timeline:i}){G(this,\"id\",void 0),G(this,\"isSupported\",void 0),G(this,\"gl\",void 0),G(this,\"timeline\",void 0),G(this,\"transitions\",void 0),G(this,\"needsRedraw\",void 0),G(this,\"numInstances\",void 0),this.id=r,this.gl=t,this.timeline=i,this.transitions={},this.needsRedraw=!1,this.numInstances=1,this.isSupported=nc.isSupported(t)}finalize(){for(let t in this.transitions)this._removeTransition(t)}update({attributes:t,transitions:r,numInstances:i}){this.numInstances=i||1;for(let s in t){let n=t[s],o=n.getTransitionSetting(r);o&&this._updateAttribute(s,n,o)}for(let s in this.transitions){let n=t[s];(!n||!n.getTransitionSetting(r))&&this._removeTransition(s)}}hasAttribute(t){let r=this.transitions[t];return r&&r.inProgress}getAttributes(){let t={};for(let r in this.transitions){let i=this.transitions[r];i.inProgress&&(t[r]=i.attributeInTransition)}return t}run(){if(!this.isSupported||this.numInstances===0)return!1;for(let r in this.transitions)this.transitions[r].update()&&(this.needsRedraw=!0);let t=this.needsRedraw;return this.needsRedraw=!1,t}_removeTransition(t){this.transitions[t].cancel(),delete this.transitions[t]}_updateAttribute(t,r,i){let s=this.transitions[t],n=!s||s.type!==i.type;if(n){if(!this.isSupported){or.warn(\"WebGL2 not supported by this browser. Transition for \".concat(t,\" is disabled.\"))();return}s&&this._removeTransition(t);let o=Cct[i.type];o?this.transitions[t]=new o({attribute:r,timeline:this.timeline,gl:this.gl}):(or.error(\"unsupported transition type '\".concat(i.type,\"'\"))(),n=!1)}(n||r.needsRedraw())&&(this.needsRedraw=!0,this.transitions[t].start(i,this.numInstances))}};var t9=\"attributeManager.invalidate\",Lct=\"attributeManager.updateStart\",kct=\"attributeManager.updateEnd\",Rct=\"attribute.updateStart\",Dct=\"attribute.allocate\",Oct=\"attribute.updateEnd\",Xf=class{constructor(t,{id:r=\"attribute-manager\",stats:i,timeline:s}={}){G(this,\"id\",void 0),G(this,\"gl\",void 0),G(this,\"attributes\",void 0),G(this,\"updateTriggers\",void 0),G(this,\"needsRedraw\",void 0),G(this,\"userData\",void 0),G(this,\"stats\",void 0),G(this,\"attributeTransitionManager\",void 0),G(this,\"mergeBoundsMemoized\",Yf(dG)),this.id=r,this.gl=t,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=i,this.attributeTransitionManager=new uw(t,{id:\"\".concat(r,\"-transitions\"),timeline:s}),Object.seal(this)}finalize(){for(let t in this.attributes)this.attributes[t].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(t={clearRedrawFlags:!1}){let r=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!t.clearRedrawFlags,r&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(t){this._add(t)}addInstanced(t){this._add(t,{instanced:1})}remove(t){for(let r of t)this.attributes[r]!==void 0&&(this.attributes[r].delete(),delete this.attributes[r])}invalidate(t,r){let i=this._invalidateTrigger(t,r);Ls(t9,this,t,i)}invalidateAll(t){for(let r in this.attributes)this.attributes[r].setNeedsUpdate(r,t);Ls(t9,this,\"all\")}update({data:t,numInstances:r,startIndices:i=null,transitions:s,props:n={},buffers:o={},context:c={}}){let f=!1;Ls(Lct,this),this.stats&&this.stats.get(\"Update Attributes\").timeStart();for(let _ in this.attributes){let w=this.attributes[_],I=w.settings.accessor;w.startIndices=i,w.numInstances=r,n[_]&&or.removed(\"props.\".concat(_),\"data.attributes.\".concat(_))(),w.setExternalBuffer(o[_])||w.setBinaryValue(typeof I==\"string\"?o[I]:void 0,t.startIndices)||typeof I==\"string\"&&!o[I]&&w.setConstantValue(n[I])||w.needsUpdate()&&(f=!0,this._updateAttribute({attribute:w,numInstances:r,data:t,props:n,context:c})),this.needsRedraw=this.needsRedraw||w.needsRedraw()}f&&Ls(kct,this,r),this.stats&&this.stats.get(\"Update Attributes\").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:r,transitions:s})}updateTransition(){let{attributeTransitionManager:t}=this,r=t.run();return this.needsRedraw=this.needsRedraw||r,r}getAttributes(){return this.attributes}getBounds(t){let r=t.map(i=>{var s;return(s=this.attributes[i])===null||s===void 0?void 0:s.getBounds()});return this.mergeBoundsMemoized(r)}getChangedAttributes(t={clearChangedFlags:!1}){let{attributes:r,attributeTransitionManager:i}=this,s={...i.getAttributes()};for(let n in r){let o=r[n];o.needsRedraw(t)&&!i.hasAttribute(n)&&(s[n]=o)}return s}getShaderAttributes(t,r={}){t||(t=this.getAttributes());let i={};for(let s in t)r[s]||Object.assign(i,t[s].getShaderAttributes());return i}_add(t,r={}){for(let i in t){let s=t[i];this.attributes[i]=this._createAttribute(i,s,r)}this._mapUpdateTriggersToAttributes()}_createAttribute(t,r,i){let s={...r,id:t,size:r.isIndexed&&1||r.size||1,divisor:i.instanced?1:r.divisor||0};return new up(this.gl,s)}_mapUpdateTriggersToAttributes(){let t={};for(let r in this.attributes)this.attributes[r].getUpdateTriggers().forEach(s=>{t[s]||(t[s]=[]),t[s].push(r)});this.updateTriggers=t}_invalidateTrigger(t,r){let{attributes:i,updateTriggers:s}=this,n=s[t];return n&&n.forEach(o=>{let c=i[o];c&&c.setNeedsUpdate(c.id,r)}),n}_updateAttribute(t){let{attribute:r,numInstances:i}=t;if(Ls(Rct,r),r.constant){r.setConstantValue(r.value);return}r.allocate(i)&&Ls(Dct,r,i),r.updateBuffer(t)&&(this.needsRedraw=!0,Ls(Oct,r,i))}};var hw=class extends Kc{get value(){return this._value}_onUpdate(){let{time:t,settings:{fromValue:r,toValue:i,duration:s,easing:n}}=this,o=n(t/s);this._value=il(r,i,o)}};var e9=1e-5;function r9(e,t,r,i,s){let n=t-e,c=(r-t)*s,f=-n*i;return c+f+n+t}function Bct(e,t,r,i,s){if(Array.isArray(r)){let n=[];for(let o=0;o0}add(t,r,i,s){let{transitions:n}=this;if(n.has(t)){let f=n.get(t),{value:_=f.settings.fromValue}=f;r=_,this.remove(t)}if(s=hP(s),!s)return;let o=Fct[s.type];if(!o){or.error(\"unsupported transition type '\".concat(s.type,\"'\"))();return}let c=new o(this.timeline);c.start({...s,fromValue:r,toValue:i}),n.set(t,c)}remove(t){let{transitions:r}=this;r.has(t)&&(r.get(t).cancel(),r.delete(t))}update(){let t={};for(let[r,i]of this.transitions)i.update(),t[r]=i.value,i.inProgress||this.remove(r);return t}clear(){for(let t of this.transitions.keys())this.remove(t)}};function s9(e){let t=e[zu];for(let r in t){let i=t[r],{validate:s}=i;if(s&&!s(e[r],i))throw new Error(\"Invalid prop \".concat(r,\": \").concat(e[r]))}}function o9(e,t){let r=pw({newProps:e,oldProps:t,propTypes:e[zu],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),i=Nct(e,t),s=!1;return i||(s=Uct(e,t)),{dataChanged:i,propsChanged:r,updateTriggersChanged:s,extensionsChanged:Vct(e,t),transitionsChanged:zct(e,t)}}function zct(e,t){if(!e.transitions)return!1;let r={},i=e[zu],s=!1;for(let n in e.transitions){let o=i[n],c=o&&o.type;(c===\"number\"||c===\"color\"||c===\"array\")&&CD(e[n],t[n],o)&&(r[n]=!0,s=!0)}return s?r:!1}function pw({newProps:e,oldProps:t,ignoreProps:r={},propTypes:i={},triggerName:s=\"props\"}){if(t===e)return!1;if(typeof e!=\"object\"||e===null||typeof t!=\"object\"||t===null)return\"\".concat(s,\" changed shallowly\");for(let n of Object.keys(e))if(!(n in r)){if(!(n in t))return\"\".concat(s,\".\").concat(n,\" added\");let o=CD(e[n],t[n],i[n]);if(o)return\"\".concat(s,\".\").concat(n,\" \").concat(o)}for(let n of Object.keys(t))if(!(n in r)){if(!(n in e))return\"\".concat(s,\".\").concat(n,\" dropped\");if(!Object.hasOwnProperty.call(e,n)){let o=CD(e[n],t[n],i[n]);if(o)return\"\".concat(s,\".\").concat(n,\" \").concat(o)}}return!1}function CD(e,t,r){let i=r&&r.equal;return i&&!i(e,t,r)||!i&&(i=e&&t&&e.equals,i&&!i.call(e,t))?\"changed deeply\":!i&&t!==e?\"changed shallowly\":null}function Nct(e,t){if(t===null)return\"oldProps is null, initial diff\";let r=!1,{dataComparator:i,_dataDiff:s}=e;return i?i(e.data,t.data)||(r=\"Data comparator detected a change\"):e.data!==t.data&&(r=\"A new data container was supplied\"),r&&s&&(r=s(e.data,t.data)||r),r}function Uct(e,t){if(t===null)return{all:!0};if(\"all\"in e.updateTriggers&&n9(e,t,\"all\"))return{all:!0};let r={},i=!1;for(let s in e.updateTriggers)s!==\"all\"&&n9(e,t,s)&&(r[s]=!0,i=!0);return i?r:!1}function Vct(e,t){if(t===null)return!0;let r=t.extensions,{extensions:i}=e;if(i===r)return!1;if(!r||!i||i.length!==r.length)return!0;for(let s=0;si.name===\"project64\"))){let i=r.modules.findIndex(s=>s.name===\"project32\");i>=0&&r.modules.splice(i,1)}if(\"inject\"in t)if(!e.inject)r.inject=t.inject;else{let i={...e.inject};for(let s in t.inject)i[s]=(i[s]||\"\")+t.inject[s];r.inject=i}return r}var qct={10241:9987,10240:9729,10242:33071,10243:33071},LD={};function l9(e,t,r,i){if(r instanceof pi)return r;r.constructor&&r.constructor.name!==\"Object\"&&(r={data:r});let s=null;r.compressed&&(s={10241:r.data.length>1?9985:9729});let n=new pi(t,{...r,parameters:{...qct,...s,...i}});return LD[n.id]=e,n}function c9(e,t){!t||!(t instanceof pi)||LD[t.id]===e&&(t.delete(),delete LD[t.id])}var Zct={boolean:{validate(e,t){return!0},equal(e,t,r){return!!e==!!t}},number:{validate(e,t){return Number.isFinite(e)&&(!(\"max\"in t)||e<=t.max)&&(!(\"min\"in t)||e>=t.min)}},color:{validate(e,t){return t.optional&&!e||kD(e)&&(e.length===3||e.length===4)},equal(e,t,r){return mo(e,t,1)}},accessor:{validate(e,t){let r=mP(e);return r===\"function\"||r===mP(t.value)},equal(e,t,r){return typeof t==\"function\"?!0:mo(e,t,1)}},array:{validate(e,t){return t.optional&&!e||kD(e)},equal(e,t,r){let{compare:i}=r,s=Number.isInteger(i)?i:i?1:0;return i?mo(e,t,s):e===t}},object:{equal(e,t,r){if(r.ignore)return!0;let{compare:i}=r,s=Number.isInteger(i)?i:i?1:0;return i?mo(e,t,s):e===t}},function:{validate(e,t){return t.optional&&!e||typeof e==\"function\"},equal(e,t,r){return!r.compare&&r.ignore!==!1||e===t}},data:{transform:(e,t,r)=>{let{dataTransform:i}=r.props;return i&&e?i(e):e}},image:{transform:(e,t,r)=>{let i=r.context;return!i||!i.gl?null:l9(r.id,i.gl,e,{...t.parameters,...r.props.textureParameters})},release:(e,t,r)=>{c9(r.id,e)}}};function u9(e){let t={},r={},i={};for(let[s,n]of Object.entries(e)){let o=n?.deprecatedFor;if(o)i[s]=Array.isArray(o)?o:[o];else{let c=Yct(s,n);t[s]=c,r[s]=c.value}}return{propTypes:t,defaultProps:r,deprecatedProps:i}}function Yct(e,t){switch(mP(t)){case\"object\":return Aw(e,t);case\"array\":return Aw(e,{type:\"array\",value:t,compare:!1});case\"boolean\":return Aw(e,{type:\"boolean\",value:t});case\"number\":return Aw(e,{type:\"number\",value:t});case\"function\":return Aw(e,{type:\"function\",value:t,compare:!0});default:return{name:e,type:\"unknown\",value:t}}}function Aw(e,t){return\"type\"in t?{name:e,...Zct[t.type],...t}:\"value\"in t?{name:e,type:mP(t.value),...t}:{name:e,type:\"object\",value:t}}function kD(e){return Array.isArray(e)||ArrayBuffer.isView(e)}function mP(e){return kD(e)?\"array\":e===null?\"null\":typeof e}function h9(e,t){let r;for(let n=t.length-1;n>=0;n--){let o=t[n];\"extensions\"in o&&(r=o.extensions)}let i=RD(e.constructor,r),s=Object.create(i);s[Qy]=e,s[$f]={},s[Wh]={};for(let n=0;n{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(let t in this.asyncProps){let r=this.asyncProps[t];r&&r.type&&r.type.release&&r.type.release(r.resolvedValue,r.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||iut}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(t){return t in this.asyncProps}getAsyncProp(t){let r=this.asyncProps[t];return r&&r.resolvedValue}isAsyncPropLoading(t){if(t){let r=this.asyncProps[t];return!!(r&&r.pendingLoadCount>0&&r.pendingLoadCount!==r.resolvedLoadCount)}for(let r in this.asyncProps)if(this.isAsyncPropLoading(r))return!0;return!1}reloadAsyncProp(t,r){this._watchPromise(t,Promise.resolve(r))}setAsyncProps(t){this.component=t[Qy]||this.component;let r=t[Wh]||{},i=t[$f]||t,s=t[sp]||{};for(let n in r){let o=r[n];this._createAsyncPropData(n,s[n]),this._updateAsyncProp(n,o),r[n]=this.getAsyncProp(n)}for(let n in i){let o=i[n];this._createAsyncPropData(n,s[n]),this._updateAsyncProp(n,o)}}_fetch(t,r){return null}_onResolve(t,r){}_onError(t,r){}_updateAsyncProp(t,r){if(this._didAsyncInputValueChange(t,r)){if(typeof r==\"string\"&&(r=this._fetch(t,r)),r instanceof Promise){this._watchPromise(t,r);return}if(cP(r)){this._resolveAsyncIterable(t,r);return}this._setPropValue(t,r)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(let t in this.asyncProps)Object.defineProperty(this.oldAsyncProps,t,{enumerable:!0,value:this.oldProps[t]})}}_didAsyncInputValueChange(t,r){let i=this.asyncProps[t];return r===i.resolvedValue||r===i.lastValue?!1:(i.lastValue=r,!0)}_setPropValue(t,r){this._freezeAsyncOldProps();let i=this.asyncProps[t];i&&(r=this._postProcessValue(i,r),i.resolvedValue=r,i.pendingLoadCount++,i.resolvedLoadCount=i.pendingLoadCount)}_setAsyncPropValue(t,r,i){let s=this.asyncProps[t];s&&i>=s.resolvedLoadCount&&r!==void 0&&(this._freezeAsyncOldProps(),s.resolvedValue=r,s.resolvedLoadCount=i,this.onAsyncPropUpdated(t,r))}_watchPromise(t,r){let i=this.asyncProps[t];if(i){i.pendingLoadCount++;let s=i.pendingLoadCount;r.then(n=>{this.component&&(n=this._postProcessValue(i,n),this._setAsyncPropValue(t,n,s),this._onResolve(t,n))}).catch(n=>{this._onError(t,n)})}}async _resolveAsyncIterable(t,r){if(t!==\"data\"){this._setPropValue(t,r);return}let i=this.asyncProps[t];if(!i)return;i.pendingLoadCount++;let s=i.pendingLoadCount,n=[],o=0;for await(let c of r){if(!this.component)return;let{dataTransform:f}=this.component.props;f?n=f(c,n):n=n.concat(c),Object.defineProperty(n,\"__diff\",{enumerable:!1,value:[{startRow:o,endRow:n.length}]}),o=n.length,this._setAsyncPropValue(t,n,s)}this._onResolve(t,n)}_postProcessValue(t,r){let i=t.type;return i&&this.component&&(i.release&&i.release(t.resolvedValue,i,this.component),i.transform)?i.transform(r,i,this.component):r}_createAsyncPropData(t,r){if(!this.asyncProps[t]){let s=this.component&&this.component.props[zu];this.asyncProps[t]={type:s&&s[t],lastValue:null,resolvedValue:r,pendingLoadCount:0,resolvedLoadCount:0}}}};var gw=class extends mw{constructor({attributeManager:t,layer:r}){super(r),G(this,\"attributeManager\",void 0),G(this,\"needsRedraw\",void 0),G(this,\"needsUpdate\",void 0),G(this,\"subLayers\",void 0),G(this,\"usesPickingColorCache\",void 0),G(this,\"hasPickingBuffer\",void 0),G(this,\"changeFlags\",void 0),G(this,\"viewport\",void 0),G(this,\"uniformTransitions\",void 0),G(this,\"propsInTransition\",void 0),this.attributeManager=t,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(t,r){let i=this.layer,s=i?.props.fetch;return s?s(r,{propName:t,layer:i}):super._fetch(t,r)}_onResolve(t,r){let i=this.layer;if(i){let s=i.props.onDataLoad;t===\"data\"&&s&&s(r,{propName:t,layer:i})}}_onError(t,r){let i=this.layer;i&&i.raiseError(r,\"loading \".concat(t,\" of \").concat(this.layer))}};var nut=\"layer.changeFlag\",sut=\"layer.initialize\",out=\"layer.update\",aut=\"layer.finalize\",lut=\"layer.matched\",d9=2**24-1,cut=Object.freeze([]),uut=Yf(({oldViewport:e,viewport:t})=>e.equals(t)),Kf=new Uint8ClampedArray(0),hut={data:{type:\"data\",value:cut,async:!0},dataComparator:{type:\"function\",value:null,optional:!0},_dataDiff:{type:\"function\",value:e=>e&&e.__diff,optional:!0},dataTransform:{type:\"function\",value:null,optional:!0},onDataLoad:{type:\"function\",value:null,optional:!0},onError:{type:\"function\",value:null,optional:!0},fetch:{type:\"function\",value:(e,{propName:t,layer:r,loaders:i,loadOptions:s,signal:n})=>{let{resourceManager:o}=r.context;if(s=s||r.getLoadOptions(),i=i||r.props.loaders,n){var c;s={...s,fetch:{...(c=s)===null||c===void 0?void 0:c.fetch,signal:n}}}let f=o.contains(e);return!f&&!s&&(o.add({resourceId:e,data:jA(e,i),persistent:!1}),f=!0),f?o.subscribe({resourceId:e,onChange:_=>{var w;return(w=r.internalState)===null||w===void 0?void 0:w.reloadAsyncProp(t,_)},consumerId:r.id,requestId:t}):jA(e,i,s)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:\"number\",min:0,max:1,value:1},operation:\"draw\",onHover:{type:\"function\",value:null,optional:!0},onClick:{type:\"function\",value:null,optional:!0},onDragStart:{type:\"function\",value:null,optional:!0},onDrag:{type:\"function\",value:null,optional:!0},onDragEnd:{type:\"function\",value:null,optional:!0},coordinateSystem:Yr.DEFAULT,coordinateOrigin:{type:\"array\",value:[0,0,0],compare:!0},modelMatrix:{type:\"array\",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:\"XYZ\",colorFormat:\"RGBA\",parameters:{type:\"object\",value:{},optional:!0,compare:2},loadOptions:{type:\"object\",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:\"array\",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:\"function\",value:({layerIndex:e})=>[0,-e*100]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:\"accessor\",value:[0,0,128,128]}},dn=class extends _g{constructor(...t){super(...t),G(this,\"internalState\",null),G(this,\"lifecycle\",tm.NO_STATE),G(this,\"context\",void 0),G(this,\"state\",void 0),G(this,\"parent\",null)}static get componentName(){return Object.prototype.hasOwnProperty.call(this,\"layerName\")?this.layerName:\"\"}get root(){let t=this;for(;t.parent;)t=t.parent;return t}toString(){let t=this.constructor.layerName||this.constructor.name;return\"\".concat(t,\"({id: '\").concat(this.props.id,\"'})\")}project(t){_r(this.internalState);let r=this.internalState.viewport||this.context.viewport,i=vD(t,{viewport:r,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[s,n,o]=Hy(i,r.pixelProjectionMatrix);return t.length===2?[s,n]:[s,n,o]}unproject(t){return _r(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(t)}projectPosition(t,r){_r(this.internalState);let i=this.internalState.viewport||this.context.viewport;return mG(t,{viewport:i,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...r})}get isComposite(){return!1}setState(t){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,t),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return this.internalState?!this.internalState.isAsyncPropLoading():!1}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){return this.state&&(this.state.models||this.state.model&&[this.state.model])||[]}setModuleParameters(t){for(let r of this.getModels())r.updateModuleSettings(t)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){let{coordinateSystem:t}=this.props;return t===Yr.DEFAULT||t===Yr.LNGLAT||t===Yr.CARTESIAN}onHover(t,r){return this.props.onHover&&this.props.onHover(t,r)||!1}onClick(t,r){return this.props.onClick&&this.props.onClick(t,r)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(t,r=[]){return r[0]=t+1&255,r[1]=t+1>>8&255,r[2]=t+1>>8>>8&255,r}decodePickingColor(t){_r(t instanceof Uint8Array);let[r,i,s]=t;return r+i*256+s*65536-1}getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&this.state.numInstances!==void 0?this.state.numInstances:a9(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){var t;return(t=this.getAttributeManager())===null||t===void 0?void 0:t.getBounds([\"positions\",\"instancePositions\"])}getShaders(t){for(let r of this.props.extensions)t=tv(t,r.getShaders.call(this,r));return t}shouldUpdateState(t){return t.changeFlags.propsOrDataChanged}updateState(t){let r=this.getAttributeManager(),{dataChanged:i}=t.changeFlags;if(i&&r)if(Array.isArray(i))for(let s of i)r.invalidateAll(s);else r.invalidateAll();if(r){let{props:s}=t,n=this.internalState.hasPickingBuffer,o=Number.isInteger(s.highlightedObjectIndex)||s.pickable||s.extensions.some(c=>c.getNeedsPickingBuffer.call(this,c));if(n!==o){this.internalState.hasPickingBuffer=o;let{pickingColors:c,instancePickingColors:f}=r.attributes,_=c||f;_&&(o&&_.constant&&(_.constant=!1,r.invalidate(_.id)),!_.value&&!o&&(_.constant=!0,_.value=[0,0,0]))}}}finalizeState(t){for(let i of this.getModels())i.delete();let r=this.getAttributeManager();r&&r.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(t){for(let r of this.getModels())r.draw(t)}getPickingInfo({info:t,mode:r,sourceLayer:i}){let{index:s}=t;return s>=0&&Array.isArray(this.props.data)&&(t.object=this.props.data[s]),t}raiseError(t,r){var i,s;if(r&&(t=new Error(\"\".concat(r,\": \").concat(t.message),{cause:t})),!((i=(s=this.props).onError)!==null&&i!==void 0&&i.call(s,t))){var n,o;(n=this.context)===null||n===void 0||(o=n.onError)===null||o===void 0||o.call(n,t,this)}}getNeedsRedraw(t={clearRedrawFlags:!1}){return this._getNeedsRedraw(t)}needsUpdate(){return this.internalState?this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()):!1}hasUniformTransition(){var t;return((t=this.internalState)===null||t===void 0?void 0:t.uniformTransitions.active)||!1}activateViewport(t){if(!this.internalState)return;let r=this.internalState.viewport;this.internalState.viewport=t,(!r||!uut({oldViewport:r,viewport:t}))&&(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(t=\"all\"){let r=this.getAttributeManager();r&&(t===\"all\"?r.invalidateAll():r.invalidate(t))}updateAttributes(t){for(let r of this.getModels())this._setModelAttributes(r,t)}_updateAttributes(){let t=this.getAttributeManager();if(!t)return;let r=this.props,i=this.getNumInstances(),s=this.getStartIndices();t.update({data:r.data,numInstances:i,startIndices:s,props:r,transitions:r.transitions,buffers:r.data.attributes,context:this});let n=t.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(n)}_updateAttributeTransition(){let t=this.getAttributeManager();t&&t.updateTransition()}_updateUniformTransition(){let{uniformTransitions:t}=this.internalState;if(t.active){let r=t.update(),i=Object.create(this.props);for(let s in r)Object.defineProperty(i,s,{value:r[s]});return i}return this.props}calculateInstancePickingColors(t,{numInstances:r}){if(t.constant)return;let i=Math.floor(Kf.length/3);if(this.internalState.usesPickingColorCache=!0,id9&&or.warn(\"Layer has too many data objects. Picking might not be able to distinguish all objects.\")(),Kf=Gh.allocate(Kf,r,{size:3,copy:!0,maxCount:Math.max(r,d9)});let s=Math.floor(Kf.length/3),n=[];for(let o=i;o(or.deprecated(\"layer.state.attributeManager\",\"layer.getAttributeManager()\")(),t)}),this.internalState.uniformTransitions=new dw(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(let r of this.props.extensions)r.initializeState.call(this,this.context,r);this.setChangeFlags({dataChanged:\"init\",propsChanged:\"init\",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(t){Ls(lut,this,this===t);let{state:r,internalState:i}=t;this!==t&&(this.internalState=i,this.state=r,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){let t=this.needsUpdate();if(Ls(out,this,t),!t)return;let r=this.props,i=this.context,s=this.internalState,n=i.viewport,o=this._updateUniformTransition();s.propsInTransition=o,i.viewport=s.viewport||n,this.props=o;try{let c=this._getUpdateParams(),f=this.getModels();if(i.gl)this.updateState(c);else try{this.updateState(c)}catch{}for(let w of this.props.extensions)w.updateState.call(this,c,w);let _=this.getModels()[0]!==f[0];this._postUpdate(c,_)}finally{i.viewport=n,this.props=r,this._clearChangeFlags(),s.needsUpdate=!1,s.resetOldProps()}}_finalize(){Ls(aut,this),this.finalizeState(this.context);for(let t of this.props.extensions)t.finalizeState.call(this,this.context,t)}_drawLayer({moduleParameters:t=null,uniforms:r={},parameters:i={}}){this._updateAttributeTransition();let s=this.props,n=this.context;this.props=this.internalState.propsInTransition||s;let o=this.props.opacity;r.opacity=Math.pow(o,1/2.2);try{t&&this.setModuleParameters(t);let{getPolygonOffset:c}=this.props,f=c&&c(r)||[0,0];Ml(n.gl,{polygonOffset:f}),Mn(n.gl,i,()=>{let _={moduleParameters:t,uniforms:r,parameters:i,context:n};for(let w of this.props.extensions)w.draw.call(this,_,w);this.draw(_)})}finally{this.props=s}}getChangeFlags(){var t;return(t=this.internalState)===null||t===void 0?void 0:t.changeFlags}setChangeFlags(t){if(!this.internalState)return;let{changeFlags:r}=this.internalState;for(let s in t)if(t[s]){let n=!1;switch(s){case\"dataChanged\":let o=t[s],c=r[s];o&&Array.isArray(c)&&(r.dataChanged=Array.isArray(o)?c.concat(o):o,n=!0);default:r[s]||(r[s]=t[s],n=!0)}n&&Ls(nut,this,s,t)}let i=!!(r.dataChanged||r.updateTriggersChanged||r.propsChanged||r.extensionsChanged);r.propsOrDataChanged=i,r.somethingChanged=i||r.viewportChanged||r.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(t,r){let i=o9(t,r);if(i.updateTriggersChanged)for(let n in i.updateTriggersChanged)i.updateTriggersChanged[n]&&this.invalidateAttribute(n);if(i.transitionsChanged)for(let n in i.transitionsChanged){var s;this.internalState.uniformTransitions.add(n,r[n],t[n],(s=t.transitions)===null||s===void 0?void 0:s[n])}return this.setChangeFlags(i)}validateProps(){s9(this.props)}updateAutoHighlight(t){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(t)}_updateAutoHighlight(t){let r={pickingSelectedColor:t.picked?t.color:null},{highlightColor:i}=this.props;t.picked&&typeof i==\"function\"&&(r.pickingHighlightColor=i(t)),this.setModuleParameters(r),this.setNeedsRedraw()}_getAttributeManager(){let t=this.context;return new Xf(t.gl,{id:this.props.id,stats:t.stats,timeline:t.timeline})}_postUpdate(t,r){let{props:i,oldProps:s}=t;this.setNeedsRedraw(),this._updateAttributes();let{model:n}=this.state;n?.setInstanceCount(this.getNumInstances());let{autoHighlight:o,highlightedObjectIndex:c,highlightColor:f}=i;if(r||s.autoHighlight!==o||s.highlightedObjectIndex!==c||s.highlightColor!==f){let _={};o||(_.pickingSelectedColor=null),Array.isArray(f)&&(_.pickingHighlightColor=f),(r||c!==s.highlightedObjectIndex)&&(_.pickingSelectedColor=Number.isFinite(c)&&c>=0?this.encodePickingColor(c):null),this.setModuleParameters(_)}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(t){if(!this.internalState)return!1;let r=!1;r=r||this.internalState.needsRedraw&&this.id;let i=this.getAttributeManager(),s=i?i.getNeedsRedraw(t):!1;if(r=r||s,r)for(let n of this.props.extensions)n.onNeedsRedraw.call(this,n);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!t.clearRedrawFlags,r}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}};G(dn,\"defaultProps\",hut);G(dn,\"layerName\",\"Layer\");var fut=\"compositeLayer.renderLayers\",Ni=class extends dn{get isComposite(){return!0}get isLoaded(){return super.isLoaded&&this.getSubLayers().every(t=>t.isLoaded)}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(t){}setState(t){super.setState(t),this.setNeedsUpdate()}getPickingInfo({info:t}){let{object:r}=t;return r&&r.__source&&r.__source.parent&&r.__source.parent.id===this.id&&(t.object=r.__source.object,t.index=r.__source.index),t}filterSubLayer(t){return!0}shouldRenderSubLayer(t,r){return r&&r.length}getSubLayerClass(t,r){let{_subLayerProps:i}=this.props;return i&&i[t]&&i[t].type||r}getSubLayerRow(t,r,i){return t.__source={parent:this,object:r,index:i},t}getSubLayerAccessor(t){if(typeof t==\"function\"){let r={index:-1,data:this.props.data,target:[]};return(i,s)=>i&&i.__source?(r.index=i.__source.index,t(i.__source.object,r)):t(i,s)}return t}getSubLayerProps(t={}){var r;let{opacity:i,pickable:s,visible:n,parameters:o,getPolygonOffset:c,highlightedObjectIndex:f,autoHighlight:_,highlightColor:w,coordinateSystem:I,coordinateOrigin:R,wrapLongitude:N,positionFormat:j,modelMatrix:Q,extensions:et,fetch:Y,operation:K,_subLayerProps:J}=this.props,ut={id:\"\",updateTriggers:{},opacity:i,pickable:s,visible:n,parameters:o,getPolygonOffset:c,highlightedObjectIndex:f,autoHighlight:_,highlightColor:w,coordinateSystem:I,coordinateOrigin:R,wrapLongitude:N,positionFormat:j,modelMatrix:Q,extensions:et,fetch:Y,operation:K},Et=J&&t.id&&J[t.id],kt=Et&&Et.updateTriggers,Xt=t.id||\"sublayer\";if(Et){let qt=this.props[zu],le=t.type?t.type._propTypes:{};for(let ue in Et){let De=le[ue]||qt[ue];De&&De.type===\"accessor\"&&(Et[ue]=this.getSubLayerAccessor(Et[ue]))}}Object.assign(ut,t,Et),ut.id=\"\".concat(this.props.id,\"-\").concat(Xt),ut.updateTriggers={all:(r=this.props.updateTriggers)===null||r===void 0?void 0:r.all,...t.updateTriggers,...kt};for(let qt of et){let le=qt.getSubLayerProps.call(this,qt);le&&Object.assign(ut,le,{updateTriggers:Object.assign(ut.updateTriggers,le.updateTriggers)})}return ut}_updateAutoHighlight(t){for(let r of this.getSubLayers())r.updateAutoHighlight(t)}_getAttributeManager(){return null}_postUpdate(t,r){let i=this.internalState.subLayers,s=!i||this.needsUpdate();if(s){let n=this.renderLayers();i=op(n,Boolean),this.internalState.subLayers=i}Ls(fut,this,s,i);for(let n of i)n.parent=this}};G(Ni,\"layerName\",\"CompositeLayer\");var gP=Math.PI/180,p9=180/Math.PI,_P=6370972,ev=256;function dut(){let e=ev/_P,t=Math.PI/180*ev;return{unitsPerMeter:[e,e,e],unitsPerMeter2:[0,0,0],metersPerUnit:[1/e,1/e,1/e],unitsPerDegree:[t,t,e],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/t,1/t,1/e]}}var rv=class extends ac{constructor(t={}){let{latitude:r=0,longitude:i=0,zoom:s=0,nearZMultiplier:n=.1,farZMultiplier:o=2,resolution:c=10}=t,{height:f,altitude:_=1.5}=t;f=f||1,_=Math.max(.75,_);let w=new En().lookAt({eye:[0,-_,0],up:[0,0,1]}),I=Math.pow(2,s);w.rotateX(r*gP),w.rotateZ(-i*gP),w.scale(I/f);let R=Math.atan(.5/_),N=ev*2*I/f;super({...t,height:f,viewMatrix:w,longitude:i,latitude:r,zoom:s,distanceScales:dut(),fovyRadians:R*2,focalDistance:_,near:n,far:Math.min(2,1/N+1)*_*o}),G(this,\"longitude\",void 0),G(this,\"latitude\",void 0),G(this,\"resolution\",void 0),this.latitude=r,this.longitude=i,this.resolution=c}get projectionMode(){return Ja.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(t={}){let r={targetZ:t.z||0},i=this.unproject([0,this.height/2],r),s=this.unproject([this.width/2,0],r),n=this.unproject([this.width,this.height/2],r),o=this.unproject([this.width/2,this.height],r);return n[0]this.longitude&&(i[0]-=360),[Math.min(i[0],n[0],s[0],o[0]),Math.min(i[1],n[1],s[1],o[1]),Math.max(i[0],n[0],s[0],o[0]),Math.max(i[1],n[1],s[1],o[1])]}unproject(t,{topLeft:r=!0,targetZ:i}={}){let[s,n,o]=t,c=r?n:this.height-n,{pixelUnprojectionMatrix:f}=this,_;if(Number.isFinite(o))_=OD(f,[s,c,o,1]);else{let N=OD(f,[s,c,-1,1]),j=OD(f,[s,c,1,1]),Q=((i||0)/_P+1)*ev,et=NE(FE([],N,j)),Y=NE(N),K=NE(j),ut=4*((4*Y*K-(et-Y-K)**2)/16)/et,Et=Math.sqrt(Y-ut),kt=Math.sqrt(Math.max(0,Q*Q-ut)),Xt=(Et-kt)/Math.sqrt(et);_=Hj([],N,j,Xt)}let[w,I,R]=this.unprojectPosition(_);return Number.isFinite(o)?[w,I,R]:Number.isFinite(i)?[w,I,i]:[w,I]}projectPosition(t){let[r,i,s=0]=t,n=r*gP,o=i*gP,c=Math.cos(o),f=(s/_P+1)*ev;return[Math.sin(n)*c*f,-Math.cos(n)*c*f,Math.sin(o)*f]}unprojectPosition(t){let[r,i,s]=t,n=zE(t),o=Math.asin(s/n),f=Math.atan2(r,-i)*p9,_=o*p9,w=(n/ev-1)*_P;return[f,_,w]}projectFlat(t){return t}unprojectFlat(t){return t}panByPosition(t,r){let i=this.unproject(r);return{longitude:t[0]-i[0]+this.longitude,latitude:t[1]-i[1]+this.latitude}}};function OD(e,t){let r=Nh([],t,e);return Fy(r,r,1/r[3]),r}var put=new En().lookAt({eye:[0,0,1]});function Aut({width:e,height:t,near:r,far:i,padding:s}){let n=-e/2,o=e/2,c=-t/2,f=t/2;if(s){let{left:_=0,right:w=0,top:I=0,bottom:R=0}=s,N=Il((_+e-w)/2,0,e)-e/2,j=Il((I+t-R)/2,0,t)-t/2;n-=N,o-=N,c+=j,f+=j}return new En().ortho({left:n,right:o,bottom:c,top:f,near:r,far:i})}var iv=class extends ac{constructor(t){let{width:r,height:i,near:s=.1,far:n=1e3,zoom:o=0,target:c=[0,0,0],padding:f=null,flipY:_=!0}=t,w=Array.isArray(o)?o[0]:o,I=Array.isArray(o)?o[1]:o,R=Math.min(w,I),N=Math.pow(2,R),j;if(w!==I){let Q=Math.pow(2,w),et=Math.pow(2,I);j={unitsPerMeter:[Q/N,et/N,1],metersPerUnit:[N/Q,N/et,1]}}super({...t,longitude:void 0,position:c,viewMatrix:put.clone().scale([N,N*(_?-1:1),N]),projectionMatrix:Aut({width:r||1,height:i||1,padding:f,near:s,far:n}),zoom:R,distanceScales:j})}projectFlat([t,r]){let{unitsPerMeter:i}=this.distanceScales;return[t*i[0],r*i[1]]}unprojectFlat([t,r]){let{metersPerUnit:i}=this.distanceScales;return[t*i[0],r*i[1]]}panByPosition(t,r){let i=Qf(r,this.pixelUnprojectionMatrix),s=this.projectFlat(t),n=$A([],s,LE([],i)),o=$A([],this.center,n);return{target:this.unprojectFlat(o)}}};var cc=class{static get componentName(){return Object.prototype.hasOwnProperty.call(this,\"extensionName\")?this.extensionName:\"\"}constructor(t){G(this,\"opts\",void 0),t&&(this.opts=t)}equals(t){return this===t?!0:this.constructor===t.constructor&&mo(this.opts,t.opts,1)}getShaders(t){return null}getSubLayerProps(t){let{defaultProps:r}=t.constructor,i={updateTriggers:{}};for(let s in r)if(s in this.props){let n=r[s],o=this.props[s];i[s]=o,n&&n.type===\"accessor\"&&(i.updateTriggers[s]=this.props.updateTriggers[s],typeof o==\"function\"&&(i[s]=this.getSubLayerAccessor(o)))}return i}initializeState(t,r){}updateState(t,r){}onNeedsRedraw(t){}getNeedsPickingBuffer(t){return!1}draw(t,r){}finalizeState(t,r){}};G(cc,\"defaultProps\",{});G(cc,\"extensionName\",\"LayerExtension\");var BD={bearing:0,pitch:0,position:[0,0,0]},mut={speed:1.2,curve:1.414},nv=class extends hg{constructor(t={}){super({compare:[\"longitude\",\"latitude\",\"zoom\",\"bearing\",\"pitch\",\"position\"],extract:[\"width\",\"height\",\"longitude\",\"latitude\",\"zoom\",\"bearing\",\"pitch\",\"position\"],required:[\"width\",\"height\",\"latitude\",\"longitude\",\"zoom\"]}),G(this,\"opts\",void 0),this.opts={...mut,...t}}interpolateProps(t,r,i){let s=rP(t,r,i,this.opts);for(let n in BD)s[n]=il(t[n]||BD[n],r[n]||BD[n],i);return s}getDuration(t,r){let{transitionDuration:i}=r;return i===\"auto\"&&(i=gD(t,r,this.opts)),i}};var rm=class{constructor(t){G(this,\"opts\",void 0),G(this,\"typedArrayManager\",void 0),G(this,\"indexStarts\",[0]),G(this,\"vertexStarts\",[0]),G(this,\"vertexCount\",0),G(this,\"instanceCount\",0),G(this,\"attributes\",void 0),G(this,\"_attributeDefs\",void 0),G(this,\"data\",void 0),G(this,\"getGeometry\",void 0),G(this,\"geometryBuffer\",void 0),G(this,\"buffers\",void 0),G(this,\"positionSize\",void 0),G(this,\"normalize\",void 0);let{attributes:r={}}=t;this.typedArrayManager=Gh,this.attributes={},this._attributeDefs=r,this.opts=t,this.updateGeometry(t)}updateGeometry(t){Object.assign(this.opts,t);let{data:r,buffers:i={},getGeometry:s,geometryBuffer:n,positionFormat:o,dataChanged:c,normalize:f=!0}=this.opts;if(this.data=r,this.getGeometry=s,this.positionSize=n&&n.size||(o===\"XY\"?2:3),this.buffers=i,this.normalize=f,n&&(_r(r.startIndices),this.getGeometry=this.getGeometryFromBuffer(n),f||(i.positions=n)),this.geometryBuffer=i.positions,Array.isArray(c))for(let _ of c)this._rebuildGeometry(_);else this._rebuildGeometry()}updatePartialGeometry({startRow:t,endRow:r}){this._rebuildGeometry({startRow:t,endRow:r})}getGeometryFromBuffer(t){let r=t.value||t;return ArrayBuffer.isView(r)?uP(r,{size:this.positionSize,offset:t.offset,stride:t.stride,startIndices:this.data.startIndices}):null}_allocate(t,r){let{attributes:i,buffers:s,_attributeDefs:n,typedArrayManager:o}=this;for(let c in n)if(c in s)o.release(i[c]),i[c]=null;else{let f=n[c];f.copy=r,i[c]=o.allocate(i[c],t,f)}}_forEachGeometry(t,r,i){let{data:s,getGeometry:n}=this,{iterable:o,objectInfo:c}=Jc(s,r,i);for(let f of o){c.index++;let _=n?n(f,c):null;t(_,c.index)}}_rebuildGeometry(t){if(!this.data)return;let{indexStarts:r,vertexStarts:i,instanceCount:s}=this,{data:n,geometryBuffer:o}=this,{startRow:c=0,endRow:f=1/0}=t||{},_={};if(t||(r=[0],i=[0]),this.normalize||!o)this._forEachGeometry((I,R)=>{let N=I&&this.normalizeGeometry(I);_[R]=N,i[R+1]=i[R]+(N?this.getGeometrySize(N):0)},c,f),s=i[i.length-1];else if(i=n.startIndices,s=i[n.length]||0,ArrayBuffer.isView(o))s=s||o.length/this.positionSize;else if(o instanceof Fr){let I=o.accessor.stride||this.positionSize*4;s=s||o.byteLength/I}else if(o.buffer){let I=o.stride||this.positionSize*4;s=s||o.buffer.byteLength/I}else if(o.value){let I=o.value,R=o.stride/I.BYTES_PER_ELEMENT||this.positionSize;s=s||I.length/R}this._allocate(s,!!t),this.indexStarts=r,this.vertexStarts=i,this.instanceCount=s;let w={};this._forEachGeometry((I,R)=>{let N=_[R]||I;w.vertexStart=i[R],w.indexStart=r[R];let j=RvP(r,t));if(ov(e)){if(yut(e))return t.style=_ut,(0,FD.cloneElement)(e,t);if(vut(e))return(0,FD.cloneElement)(e,t)}return e}function ov(e){return e&&typeof e==\"object\"&&\"type\"in e||!1}function yut(e){var t;return(t=e.props)===null||t===void 0?void 0:t.mapStyle}function vut(e){let t=e.type;return t&&t.deckGLViewProps}function zD(e){if(typeof e==\"function\")return(0,m9.createElement)(Xc,{},e);if(Array.isArray(e))return e.map(zD);if(ov(e)){if(e.type===xP.Fragment)return zD(e.props.children);if(sv(e.type,Xc))return e}return e}function ND({children:e,layers:t=[],views:r=null}){let i=[],s=[],n={};return xP.Children.forEach(zD(e),o=>{if(ov(o)){let c=o.type;if(sv(c,dn)){let f=xut(c,o.props);s.push(f)}else i.push(o);if(sv(c,Xc)&&c!==Xc&&o.props.id){let f=new c(o.props);n[f.id]=f}}else o&&i.push(o)}),Object.keys(n).length>0&&(Array.isArray(r)?r.forEach(o=>{n[o.id]=o}):r&&(n[r.id]=r),r=Object.values(n)),t=s.length>0?[...s,...t]:t,{layers:t,children:i,views:r}}function xut(e,t){let r={},i=e.defaultProps||{};for(let s in t)i[s]!==t[s]&&(r[s]=t[s]);return new e(r)}var UD=Ri(Yi());function VD({children:e,deck:t,ContextProvider:r}){let{viewManager:i}=t||{};if(!i||!i.views.length)return[];let s={},n=i.views[0].id;for(let o of e){let c=n,f=o;ov(o)&&sv(o.type,Xc)&&(c=o.props.id||n,f=o.props.children);let _=i.getViewport(c),w=i.getViewState(c);if(_){w.padding=_.padding;let{x:I,y:R,width:N,height:j}=_;f=vP(f,{x:I,y:R,width:N,height:j,viewport:_,viewState:w}),s[c]||(s[c]={viewport:_,children:[]}),s[c].children.push(f)}}return Object.keys(s).map(o=>{let{viewport:c,children:f}=s[o],{x:_,y:w,width:I,height:R}=c,N={position:\"absolute\",left:_,top:w,width:I,height:R},j=\"view-\".concat(o),Q=(0,UD.createElement)(\"div\",{key:j,id:j,style:N},...f);if(r){let et={viewport:c,container:t.canvas.offsetParent,eventManager:t.eventManager,onViewStateChange:Y=>{Y.viewId=o,t._onViewStateChange(Y)}};return(0,UD.createElement)(r,{key:j,value:et},Q)}return Q})}var but={mixBlendMode:null};function jD({width:e,height:t,style:r}){let i={position:\"absolute\",zIndex:0,left:0,top:0,width:e,height:t},s={left:0,top:0};if(r)for(let n in r)n in but?s[n]=r[n]:i[n]=r[n];return{containerStyle:i,canvasStyle:s}}function wut(e){return{get deck(){return e.deck},pickObject:t=>e.deck.pickObject(t),pickMultipleObjects:t=>e.deck.pickMultipleObjects(t),pickObjects:t=>e.deck.pickObjects(t)}}function g9(e){e.redrawReason&&(e.deck._drawLayers(e.redrawReason),e.redrawReason=null)}function Sut(e,t,r){let i=new t({...r,_customRender:s=>{e.redrawReason=s;let n=i.getViewports();e.lastRenderedViewports!==n?e.forceUpdate():g9(e)}});return i}var _9=(0,Do.forwardRef)((e,t)=>{let[r,i]=(0,Do.useState)(0),n=(0,Do.useRef)({control:null,version:r,forceUpdate:()=>i(Et=>Et+1)}).current,o=(0,Do.useRef)(null),c=(0,Do.useRef)(null),f=(0,Do.useMemo)(()=>ND(e),[e.layers,e.views,e.children]),_=!0,w=Et=>{var kt;return _&&e.viewState?(n.viewStateUpdateRequested=Et,null):(n.viewStateUpdateRequested=null,(kt=e.onViewStateChange)===null||kt===void 0?void 0:kt.call(e,Et))},I=Et=>{if(_)n.interactionStateUpdateRequested=Et;else{var kt;n.interactionStateUpdateRequested=null,(kt=e.onInteractionStateChange)===null||kt===void 0||kt.call(e,Et)}},R=(0,Do.useMemo)(()=>{let Et={...e,style:null,width:\"100%\",height:\"100%\",parent:o.current,canvas:c.current,layers:f.layers,views:f.views,onViewStateChange:w,onInteractionStateChange:I};return delete Et._customRender,n.deck&&n.deck.setProps(Et),Et},[e]);(0,Do.useEffect)(()=>{let Et=e.Deck||cp;return n.deck=Sut(n,Et,{...R,parent:o.current,canvas:c.current}),()=>{var kt;return(kt=n.deck)===null||kt===void 0?void 0:kt.finalize()}},[]),A9(()=>{g9(n);let{viewStateUpdateRequested:Et,interactionStateUpdateRequested:kt}=n;Et&&w(Et),kt&&I(kt)}),(0,Do.useImperativeHandle)(t,()=>wut(n),[]);let N=n.deck&&n.deck.isInitialized?n.deck.getViewports():void 0,{ContextProvider:j,width:Q,height:et,id:Y,style:K}=e,{containerStyle:J,canvasStyle:ut}=(0,Do.useMemo)(()=>jD({width:Q,height:et,style:K}),[Q,et,K]);if(!n.viewStateUpdateRequested&&n.lastRenderedViewports===N||n.version!==r){n.lastRenderedViewports=N,n.version=r;let Et=VD({children:f.children,deck:n.deck,ContextProvider:j}),kt=(0,Do.createElement)(\"canvas\",{key:\"canvas\",id:Y||\"deckgl-overlay\",ref:c,style:ut});n.control=(0,Do.createElement)(\"div\",{id:\"\".concat(Y||\"deckgl\",\"-wrapper\"),ref:o,style:J},[kt,Et])}return _=!1,n.control});_9.defaultProps=cp.defaultProps;var GD=_9;var zt,hp=new Array(128).fill(void 0);hp.push(void 0,null,!0,!1);var ww=hp.length;function qe(e){ww===hp.length&&hp.push(hp.length+1);let t=ww;return ww=hp[t],hp[t]=e,t}function xe(e){return hp[e]}function Tut(e){e<132||(hp[e]=ww,ww=e)}function nn(e){let t=xe(e);return Tut(e),t}var R9=typeof TextDecoder<\"u\"?new TextDecoder(\"utf-8\",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error(\"TextDecoder not available\")}};typeof TextDecoder<\"u\"&&R9.decode();var _w=null;function av(){return(_w===null||_w.byteLength===0)&&(_w=new Uint8Array(zt.memory.buffer)),_w}function tu(e,t){return e=e>>>0,R9.decode(av().subarray(e,e+t))}function uc(e){return e==null}var yw=null;function Mut(){return(yw===null||yw.byteLength===0)&&(yw=new Float64Array(zt.memory.buffer)),yw}var vw=null;function Ue(){return(vw===null||vw.byteLength===0)&&(vw=new Int32Array(zt.memory.buffer)),vw}var hc=0,bP=typeof TextEncoder<\"u\"?new TextEncoder(\"utf-8\"):{encode:()=>{throw Error(\"TextEncoder not available\")}},Eut=typeof bP.encodeInto==\"function\"?function(e,t){return bP.encodeInto(e,t)}:function(e,t){let r=bP.encode(e);return t.set(r),{read:e.length,written:r.length}};function fp(e,t,r){if(r===void 0){let c=bP.encode(e),f=t(c.length,1)>>>0;return av().subarray(f,f+c.length).set(c),hc=c.length,f}let i=e.length,s=t(i,1)>>>0,n=av(),o=0;for(;o127)break;n[s+o]=c}if(o!==i){o!==0&&(e=e.slice(o)),s=r(s,i,i=o+e.length*3,1)>>>0;let c=av().subarray(s+o,s+i),f=Eut(e,c);o+=f.written,s=r(s,i,o,1)>>>0}return hc=o,s}var xw=null;function Put(){return(xw===null||xw.byteLength===0)&&(xw=new BigInt64Array(zt.memory.buffer)),xw}function WD(e){let t=typeof e;if(t==\"number\"||t==\"boolean\"||e==null)return`${e}`;if(t==\"string\")return`\"${e}\"`;if(t==\"symbol\"){let s=e.description;return s==null?\"Symbol\":`Symbol(${s})`}if(t==\"function\"){let s=e.name;return typeof s==\"string\"&&s.length>0?`Function(${s})`:\"Function\"}if(Array.isArray(e)){let s=e.length,n=\"[\";s>0&&(n+=WD(e[0]));for(let o=1;o1)i=r[1];else return toString.call(e);if(i==\"Object\")try{return\"Object(\"+JSON.stringify(e)+\")\"}catch{return\"Object\"}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:i}var y9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>{zt.__wbindgen_export_2.get(e.dtor)(e.a,e.b)});function Iut(e,t,r,i){let s={a:e,b:t,cnt:1,dtor:r},n=(...o)=>{s.cnt++;let c=s.a;s.a=0;try{return i(c,s.b,...o)}finally{--s.cnt===0?(zt.__wbindgen_export_2.get(s.dtor)(c,s.b),y9.unregister(s)):s.a=c}};return n.original=s,y9.register(n,s,s),n}function Cut(e,t,r){zt._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1de40baa0df51db0(e,t,qe(r))}function D9(e,t){let r=t(e.length*1,1)>>>0;return av().set(e,r/1),hc=e.length,r}function O9(e,t){try{let n=zt.__wbindgen_add_to_stack_pointer(-16),o=D9(e,zt.__wbindgen_malloc),c=hc;zt.readParquet(n,o,c,uc(t)?0:qe(t));var r=Ue()[n/4+0],i=Ue()[n/4+1],s=Ue()[n/4+2];if(s)throw nn(i);return IP.__wrap(r)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}function Lut(e,t){if(!(e instanceof t))throw new Error(`expected instance of ${t.name}`);return e.ptr}function XD(e,t){return e=e>>>0,av().subarray(e/1,e/1+t)}var bw=null;function B9(){return(bw===null||bw.byteLength===0)&&(bw=new Uint32Array(zt.memory.buffer)),bw}function wP(e,t){e=e>>>0;let i=B9().subarray(e/4,e/4+t),s=[];for(let n=0;n>>0,B9().subarray(e/4,e/4+t)}function Rut(e,t,r,i){zt.wasm_bindgen__convert__closures__invoke2_mut__h26b6dc7d05b06fdf(e,t,qe(r),qe(i))}var E8t=Object.freeze({V1:0,0:\"V1\",V2:1,1:\"V2\"}),P8t=Object.freeze({None:0,0:\"None\",Chunk:1,1:\"Chunk\",Page:2,2:\"Page\"}),I8t=Object.freeze({PLAIN:0,0:\"PLAIN\",PLAIN_DICTIONARY:1,1:\"PLAIN_DICTIONARY\",RLE:2,2:\"RLE\",BIT_PACKED:3,3:\"BIT_PACKED\",DELTA_BINARY_PACKED:4,4:\"DELTA_BINARY_PACKED\",DELTA_LENGTH_BYTE_ARRAY:5,5:\"DELTA_LENGTH_BYTE_ARRAY\",DELTA_BYTE_ARRAY:6,6:\"DELTA_BYTE_ARRAY\",RLE_DICTIONARY:7,7:\"RLE_DICTIONARY\",BYTE_STREAM_SPLIT:8,8:\"BYTE_STREAM_SPLIT\"}),C8t=Object.freeze({UNCOMPRESSED:0,0:\"UNCOMPRESSED\",SNAPPY:1,1:\"SNAPPY\",GZIP:2,2:\"GZIP\",BROTLI:3,3:\"BROTLI\",LZ4:4,4:\"LZ4\",ZSTD:5,5:\"ZSTD\",LZ4_RAW:6,6:\"LZ4_RAW\",LZO:7,7:\"LZO\"}),v9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_columnchunkmetadata_free(e>>>0)),SP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,v9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,v9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_columnchunkmetadata_free(t)}filePath(){try{let i=zt.__wbindgen_add_to_stack_pointer(-16);zt.columnchunkmetadata_filePath(i,this.__wbg_ptr);var t=Ue()[i/4+0],r=Ue()[i/4+1];let s;return t!==0&&(s=tu(t,r).slice(),zt.__wbindgen_free(t,r*1,1)),s}finally{zt.__wbindgen_add_to_stack_pointer(16)}}fileOffset(){return zt.columnchunkmetadata_fileOffset(this.__wbg_ptr)}columnPath(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.columnchunkmetadata_columnPath(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=wP(t,r).slice();return zt.__wbindgen_free(t,r*4,4),i}finally{zt.__wbindgen_add_to_stack_pointer(16)}}encodings(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.columnchunkmetadata_encodings(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=wP(t,r).slice();return zt.__wbindgen_free(t,r*4,4),i}finally{zt.__wbindgen_add_to_stack_pointer(16)}}numValues(){return zt.columnchunkmetadata_numValues(this.__wbg_ptr)}compression(){return zt.columnchunkmetadata_compression(this.__wbg_ptr)}compressedSize(){return zt.columnchunkmetadata_compressedSize(this.__wbg_ptr)}uncompressedSize(){return zt.columnchunkmetadata_uncompressedSize(this.__wbg_ptr)}},L8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_ffiarrowarray_free(e>>>0));var x9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_ffiarrowschema_free(e>>>0)),TP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,x9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,x9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_ffiarrowschema_free(t)}addr(){return zt.ffiarrowschema_addr(this.__wbg_ptr)>>>0}},k8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_ffidata_free(e>>>0));var b9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_ffirecordbatch_free(e>>>0)),MP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,b9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,b9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_ffirecordbatch_free(t)}arrayAddr(){return zt.ffirecordbatch_arrayAddr(this.__wbg_ptr)>>>0}schemaAddr(){return zt.ffirecordbatch_schemaAddr(this.__wbg_ptr)>>>0}},w9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_ffitable_free(e>>>0)),EP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,w9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,w9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_ffitable_free(t)}numBatches(){return zt.ffitable_numBatches(this.__wbg_ptr)>>>0}schemaAddr(){return zt.ffitable_schemaAddr(this.__wbg_ptr)>>>0}arrayAddr(t){return zt.ffitable_arrayAddr(this.__wbg_ptr,t)>>>0}arrayAddrs(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.ffitable_arrayAddrs(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=kut(t,r).slice();return zt.__wbindgen_free(t,r*4,4),i}finally{zt.__wbindgen_add_to_stack_pointer(16)}}drop(){let t=this.__destroy_into_raw();zt.ffitable_drop(t)}},R8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_ffivector_free(e>>>0));var S9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_filemetadata_free(e>>>0)),HD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,S9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,S9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_filemetadata_free(t)}version(){return zt.filemetadata_version(this.__wbg_ptr)}numRows(){return zt.filemetadata_numRows(this.__wbg_ptr)}createdBy(){try{let i=zt.__wbindgen_add_to_stack_pointer(-16);zt.filemetadata_createdBy(i,this.__wbg_ptr);var t=Ue()[i/4+0],r=Ue()[i/4+1];let s;return t!==0&&(s=tu(t,r).slice(),zt.__wbindgen_free(t,r*1,1)),s}finally{zt.__wbindgen_add_to_stack_pointer(16)}}keyValueMetadata(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.filemetadata_keyValueMetadata(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=Ue()[s/4+2];if(i)throw nn(r);return nn(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}},D8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_intounderlyingbytesource_free(e>>>0));var O8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_intounderlyingsink_free(e>>>0));var T9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_intounderlyingsource_free(e>>>0)),qD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,T9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,T9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_intounderlyingsource_free(t)}pull(t){let r=zt.intounderlyingsource_pull(this.__wbg_ptr,qe(t));return nn(r)}cancel(){let t=this.__destroy_into_raw();zt.intounderlyingsource_cancel(t)}},M9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_parquetfile_free(e>>>0)),ZD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,M9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,M9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_parquetfile_free(t)}static fromUrl(t,r){let i=fp(t,zt.__wbindgen_malloc,zt.__wbindgen_realloc),s=hc,n=zt.parquetfile_fromUrl(i,s,uc(r)?0:qe(r));return nn(n)}static fromFile(t){let r=zt.parquetfile_fromFile(qe(t));return nn(r)}metadata(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.parquetfile_metadata(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=Ue()[s/4+2];if(i)throw nn(r);return YD.__wrap(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}read(t){let r=zt.parquetfile_read(this.__wbg_ptr,uc(t)?0:qe(t));return nn(r)}stream(t){let r=zt.parquetfile_stream(this.__wbg_ptr,uc(t)?0:qe(t));return nn(r)}},E9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_parquetmetadata_free(e>>>0)),YD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,E9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,E9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_parquetmetadata_free(t)}fileMetadata(){let t=zt.parquetmetadata_fileMetadata(this.__wbg_ptr);return HD.__wrap(t)}numRowGroups(){return zt.parquetmetadata_numRowGroups(this.__wbg_ptr)>>>0}rowGroup(t){let r=zt.parquetmetadata_rowGroup(this.__wbg_ptr,t);return PP.__wrap(r)}rowGroups(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.parquetmetadata_rowGroups(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=wP(t,r).slice();return zt.__wbindgen_free(t,r*4,4),i}finally{zt.__wbindgen_add_to_stack_pointer(16)}}},P9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_recordbatch_free(e>>>0)),QD=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,P9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,P9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_recordbatch_free(t)}get numRows(){return zt.recordbatch_numRows(this.__wbg_ptr)>>>0}get numColumns(){return zt.recordbatch_numColumns(this.__wbg_ptr)>>>0}get schema(){let t=zt.recordbatch_schema(this.__wbg_ptr);return Sw.__wrap(t)}toFFI(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.recordbatch_toFFI(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=Ue()[s/4+2];if(i)throw nn(r);return MP.__wrap(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}intoFFI(){try{let s=this.__destroy_into_raw(),n=zt.__wbindgen_add_to_stack_pointer(-16);zt.recordbatch_intoFFI(n,s);var t=Ue()[n/4+0],r=Ue()[n/4+1],i=Ue()[n/4+2];if(i)throw nn(r);return MP.__wrap(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}intoIPCStream(){try{let o=this.__destroy_into_raw(),c=zt.__wbindgen_add_to_stack_pointer(-16);zt.recordbatch_intoIPCStream(c,o);var t=Ue()[c/4+0],r=Ue()[c/4+1],i=Ue()[c/4+2],s=Ue()[c/4+3];if(s)throw nn(i);var n=XD(t,r).slice();return zt.__wbindgen_free(t,r*1,1),n}finally{zt.__wbindgen_add_to_stack_pointer(16)}}withSchema(t){try{let o=zt.__wbindgen_add_to_stack_pointer(-16);Lut(t,Sw);var r=t.__destroy_into_raw();zt.recordbatch_withSchema(o,this.__wbg_ptr,r);var i=Ue()[o/4+0],s=Ue()[o/4+1],n=Ue()[o/4+2];if(n)throw nn(s);return e.__wrap(i)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}slice(t,r){let i=zt.recordbatch_slice(this.__wbg_ptr,t,r);return e.__wrap(i)}getArrayMemorySize(){return zt.recordbatch_getArrayMemorySize(this.__wbg_ptr)>>>0}},I9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_rowgroupmetadata_free(e>>>0)),PP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,I9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,I9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_rowgroupmetadata_free(t)}numColumns(){return zt.rowgroupmetadata_numColumns(this.__wbg_ptr)>>>0}column(t){let r=zt.rowgroupmetadata_column(this.__wbg_ptr,t);return SP.__wrap(r)}columns(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.rowgroupmetadata_columns(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=wP(t,r).slice();return zt.__wbindgen_free(t,r*4,4),i}finally{zt.__wbindgen_add_to_stack_pointer(16)}}numRows(){return zt.rowgroupmetadata_numRows(this.__wbg_ptr)}totalByteSize(){return zt.rowgroupmetadata_totalByteSize(this.__wbg_ptr)}compressedSize(){return zt.rowgroupmetadata_compressedSize(this.__wbg_ptr)}},C9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_schema_free(e>>>0)),Sw=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,C9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,C9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_schema_free(t)}toFFI(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.schema_toFFI(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=Ue()[s/4+2];if(i)throw nn(r);return TP.__wrap(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}intoFFI(){try{let s=this.__destroy_into_raw(),n=zt.__wbindgen_add_to_stack_pointer(-16);zt.schema_intoFFI(n,s);var t=Ue()[n/4+0],r=Ue()[n/4+1],i=Ue()[n/4+2];if(i)throw nn(r);return TP.__wrap(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}intoIPCStream(){try{let o=this.__destroy_into_raw(),c=zt.__wbindgen_add_to_stack_pointer(-16);zt.schema_intoIPCStream(c,o);var t=Ue()[c/4+0],r=Ue()[c/4+1],i=Ue()[c/4+2],s=Ue()[c/4+3];if(s)throw nn(i);var n=XD(t,r).slice();return zt.__wbindgen_free(t,r*1,1),n}finally{zt.__wbindgen_add_to_stack_pointer(16)}}withMetadata(t){try{let n=zt.__wbindgen_add_to_stack_pointer(-16);zt.schema_withMetadata(n,this.__wbg_ptr,qe(t));var r=Ue()[n/4+0],i=Ue()[n/4+1],s=Ue()[n/4+2];if(s)throw nn(i);return e.__wrap(r)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}indexOf(t){try{let n=zt.__wbindgen_add_to_stack_pointer(-16),o=fp(t,zt.__wbindgen_malloc,zt.__wbindgen_realloc),c=hc;zt.schema_indexOf(n,this.__wbg_ptr,o,c);var r=Ue()[n/4+0],i=Ue()[n/4+1],s=Ue()[n/4+2];if(s)throw nn(i);return r>>>0}finally{zt.__wbindgen_add_to_stack_pointer(16)}}metadata(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.schema_metadata(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=Ue()[s/4+2];if(i)throw nn(r);return nn(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}},L9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_table_free(e>>>0)),IP=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,L9.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,L9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_table_free(t)}get schema(){let t=zt.table_schema(this.__wbg_ptr);return Sw.__wrap(t)}get numBatches(){return zt.table_numBatches(this.__wbg_ptr)>>>0}toFFI(){try{let s=zt.__wbindgen_add_to_stack_pointer(-16);zt.table_toFFI(s,this.__wbg_ptr);var t=Ue()[s/4+0],r=Ue()[s/4+1],i=Ue()[s/4+2];if(i)throw nn(r);return EP.__wrap(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}intoFFI(){try{let s=this.__destroy_into_raw(),n=zt.__wbindgen_add_to_stack_pointer(-16);zt.table_intoFFI(n,s);var t=Ue()[n/4+0],r=Ue()[n/4+1],i=Ue()[n/4+2];if(i)throw nn(r);return EP.__wrap(t)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}intoIPCStream(){try{let o=this.__destroy_into_raw(),c=zt.__wbindgen_add_to_stack_pointer(-16);zt.table_intoIPCStream(c,o);var t=Ue()[c/4+0],r=Ue()[c/4+1],i=Ue()[c/4+2],s=Ue()[c/4+3];if(s)throw nn(i);var n=XD(t,r).slice();return zt.__wbindgen_free(t,r*1,1),n}finally{zt.__wbindgen_add_to_stack_pointer(16)}}static fromIPCStream(t){try{let n=zt.__wbindgen_add_to_stack_pointer(-16),o=D9(t,zt.__wbindgen_malloc),c=hc;zt.table_fromIPCStream(n,o,c);var r=Ue()[n/4+0],i=Ue()[n/4+1],s=Ue()[n/4+2];if(s)throw nn(i);return e.__wrap(r)}finally{zt.__wbindgen_add_to_stack_pointer(16)}}getArrayMemorySize(){return zt.table_getArrayMemorySize(this.__wbg_ptr)>>>0}},B8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_wasmgetoptions_free(e>>>0));var k9=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_wasmobjectmeta_free(e>>>0)),$D=class e{static __wrap(t){t=t>>>0;let r=Object.create(e.prototype);return r.__wbg_ptr=t,k9.register(r,r.__wbg_ptr,r),r}toJSON(){return{location:this.location,last_modified:this.last_modified,size:this.size,e_tag:this.e_tag,version:this.version}}toString(){return JSON.stringify(this)}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,k9.unregister(this),t}free(){let t=this.__destroy_into_raw();zt.__wbg_wasmobjectmeta_free(t)}get location(){let t,r;try{let n=zt.__wbindgen_add_to_stack_pointer(-16);zt.__wbg_get_wasmobjectmeta_location(n,this.__wbg_ptr);var i=Ue()[n/4+0],s=Ue()[n/4+1];return t=i,r=s,tu(i,s)}finally{zt.__wbindgen_add_to_stack_pointer(16),zt.__wbindgen_free(t,r,1)}}set location(t){let r=fp(t,zt.__wbindgen_malloc,zt.__wbindgen_realloc),i=hc;zt.__wbg_set_wasmobjectmeta_location(this.__wbg_ptr,r,i)}get last_modified(){let t=zt.__wbg_get_wasmobjectmeta_last_modified(this.__wbg_ptr);return nn(t)}set last_modified(t){zt.__wbg_set_wasmobjectmeta_last_modified(this.__wbg_ptr,qe(t))}get size(){return zt.__wbg_get_wasmobjectmeta_size(this.__wbg_ptr)>>>0}set size(t){zt.__wbg_set_wasmobjectmeta_size(this.__wbg_ptr,t)}get e_tag(){try{let i=zt.__wbindgen_add_to_stack_pointer(-16);zt.__wbg_get_wasmobjectmeta_e_tag(i,this.__wbg_ptr);var t=Ue()[i/4+0],r=Ue()[i/4+1];let s;return t!==0&&(s=tu(t,r).slice(),zt.__wbindgen_free(t,r*1,1)),s}finally{zt.__wbindgen_add_to_stack_pointer(16)}}set e_tag(t){var r=uc(t)?0:fp(t,zt.__wbindgen_malloc,zt.__wbindgen_realloc),i=hc;zt.__wbg_set_wasmobjectmeta_e_tag(this.__wbg_ptr,r,i)}get version(){try{let i=zt.__wbindgen_add_to_stack_pointer(-16);zt.__wbg_get_wasmobjectmeta_version(i,this.__wbg_ptr);var t=Ue()[i/4+0],r=Ue()[i/4+1];let s;return t!==0&&(s=tu(t,r).slice(),zt.__wbindgen_free(t,r*1,1)),s}finally{zt.__wbindgen_add_to_stack_pointer(16)}}set version(t){var r=uc(t)?0:fp(t,zt.__wbindgen_malloc,zt.__wbindgen_realloc),i=hc;zt.__wbg_set_wasmobjectmeta_version(this.__wbg_ptr,r,i)}},F8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_wasmobjectstore_free(e>>>0));var z8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_writerproperties_free(e>>>0));var N8t=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>zt.__wbg_writerpropertiesbuilder_free(e>>>0));async function Dut(e,t){if(typeof Response==\"function\"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==\"function\")try{return await WebAssembly.instantiateStreaming(e,t)}catch(i){if(e.headers.get(\"Content-Type\")!=\"application/wasm\")console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",i);else throw i}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}function Out(){let e={};return e.wbg={},e.wbg.__wbindgen_number_new=function(t){return qe(t)},e.wbg.__wbg_columnchunkmetadata_new=function(t){let r=SP.__wrap(t);return qe(r)},e.wbg.__wbg_rowgroupmetadata_new=function(t){let r=PP.__wrap(t);return qe(r)},e.wbg.__wbg_parquetfile_new=function(t){let r=ZD.__wrap(t);return qe(r)},e.wbg.__wbindgen_object_drop_ref=function(t){nn(t)},e.wbg.__wbindgen_object_clone_ref=function(t){let r=xe(t);return qe(r)},e.wbg.__wbindgen_error_new=function(t,r){let i=new Error(tu(t,r));return qe(i)},e.wbg.__wbindgen_is_undefined=function(t){return xe(t)===void 0},e.wbg.__wbindgen_in=function(t,r){return xe(t)in xe(r)},e.wbg.__wbindgen_is_bigint=function(t){return typeof xe(t)==\"bigint\"},e.wbg.__wbindgen_bigint_from_u64=function(t){let r=BigInt.asUintN(64,t);return qe(r)},e.wbg.__wbindgen_jsval_eq=function(t,r){return xe(t)===xe(r)},e.wbg.__wbindgen_is_object=function(t){let r=xe(t);return typeof r==\"object\"&&r!==null},e.wbg.__wbindgen_string_new=function(t,r){let i=tu(t,r);return qe(i)},e.wbg.__wbindgen_number_get=function(t,r){let i=xe(r),s=typeof i==\"number\"?i:void 0;Mut()[t/8+1]=uc(s)?0:s,Ue()[t/4+0]=!uc(s)},e.wbg.__wbg_fetch_1db5b0ae726d68b5=function(t){let r=fetch(xe(t));return qe(r)},e.wbg.__wbg_wasmobjectmeta_new=function(t){let r=$D.__wrap(t);return qe(r)},e.wbg.__wbindgen_string_get=function(t,r){let i=xe(r),s=typeof i==\"string\"?i:void 0;var n=uc(s)?0:fp(s,zt.__wbindgen_malloc,zt.__wbindgen_realloc),o=hc;Ue()[t/4+1]=o,Ue()[t/4+0]=n},e.wbg.__wbg_fetch_bc7c8e27076a5c84=function(t){let r=fetch(xe(t));return qe(r)},e.wbg.__wbg_done_2ffa852272310e47=function(t){return xe(t).done},e.wbg.__wbg_value_9f6eeb1e2aab8d96=function(t){let r=xe(t).value;return qe(r)},e.wbg.__wbg_newwithintounderlyingsource_a03a82aa1bbbb292=function(t,r){let i=new ReadableStream(qD.__wrap(t),nn(r));return qe(i)},e.wbg.__wbg_getReader_ab94afcb5cb7689a=function(){return Ds(function(t){let r=xe(t).getReader();return qe(r)},arguments)},e.wbg.__wbg_sethighWaterMark_ea50ed3ec2143088=function(t,r){xe(t).highWaterMark=r},e.wbg.__wbg_recordbatch_new=function(t){let r=QD.__wrap(t);return qe(r)},e.wbg.__wbg_table_new=function(t){let r=IP.__wrap(t);return qe(r)},e.wbg.__wbindgen_jsval_loose_eq=function(t,r){return xe(t)==xe(r)},e.wbg.__wbindgen_boolean_get=function(t){let r=xe(t);return typeof r==\"boolean\"?r?1:0:2},e.wbg.__wbindgen_as_number=function(t){return+xe(t)},e.wbg.__wbg_String_b9412f8799faab3e=function(t,r){let i=String(xe(r)),s=fp(i,zt.__wbindgen_malloc,zt.__wbindgen_realloc),n=hc;Ue()[t/4+1]=n,Ue()[t/4+0]=s},e.wbg.__wbg_getwithrefkey_edc2c8960f0f1191=function(t,r){let i=xe(t)[xe(r)];return qe(i)},e.wbg.__wbg_set_f975102236d3c502=function(t,r,i){xe(t)[nn(r)]=nn(i)},e.wbg.__wbindgen_cb_drop=function(t){let r=nn(t).original;return r.cnt--==1?(r.a=0,!0):!1},e.wbg.__wbg_queueMicrotask_481971b0d87f3dd4=function(t){queueMicrotask(xe(t))},e.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6=function(t){let r=xe(t).queueMicrotask;return qe(r)},e.wbg.__wbindgen_is_function=function(t){return typeof xe(t)==\"function\"},e.wbg.__wbg_fetch_921fad6ef9e883dd=function(t,r){let i=xe(t).fetch(xe(r));return qe(i)},e.wbg.__wbg_new_ab6fd82b10560829=function(){return Ds(function(){let t=new Headers;return qe(t)},arguments)},e.wbg.__wbg_append_7bfcb4937d1d5e29=function(){return Ds(function(t,r,i,s,n){xe(t).append(tu(r,i),tu(s,n))},arguments)},e.wbg.__wbg_close_a994f9425dab445c=function(){return Ds(function(t){xe(t).close()},arguments)},e.wbg.__wbg_enqueue_ea194723156c0cc2=function(){return Ds(function(t,r){xe(t).enqueue(xe(r))},arguments)},e.wbg.__wbg_size_9c7e57fbd4f0f4b5=function(t){return xe(t).size},e.wbg.__wbg_arrayBuffer_307ddd1bd1d04e23=function(t){let r=xe(t).arrayBuffer();return qe(r)},e.wbg.__wbg_slice_1991e6e71a6587f3=function(){return Ds(function(t,r,i){let s=xe(t).slice(r,i);return qe(s)},arguments)},e.wbg.__wbg_read_e7d0f8a49be01d86=function(t){let r=xe(t).read();return qe(r)},e.wbg.__wbg_releaseLock_5c49db976c08b864=function(t){xe(t).releaseLock()},e.wbg.__wbg_cancel_6ee33d4006737aef=function(t){let r=xe(t).cancel();return qe(r)},e.wbg.__wbg_byobRequest_72fca99f9c32c193=function(t){let r=xe(t).byobRequest;return uc(r)?0:qe(r)},e.wbg.__wbg_close_184931724d961ccc=function(){return Ds(function(t){xe(t).close()},arguments)},e.wbg.__wbg_instanceof_Response_849eb93e75734b6e=function(t){let r;try{r=xe(t)instanceof Response}catch{r=!1}return r},e.wbg.__wbg_url_5f6dc4009ac5f99d=function(t,r){let i=xe(r).url,s=fp(i,zt.__wbindgen_malloc,zt.__wbindgen_realloc),n=hc;Ue()[t/4+1]=n,Ue()[t/4+0]=s},e.wbg.__wbg_status_61a01141acd3cf74=function(t){return xe(t).status},e.wbg.__wbg_headers_9620bfada380764a=function(t){let r=xe(t).headers;return qe(r)},e.wbg.__wbg_body_9545a94f397829db=function(t){let r=xe(t).body;return uc(r)?0:qe(r)},e.wbg.__wbg_arrayBuffer_29931d52c7206b02=function(){return Ds(function(t){let r=xe(t).arrayBuffer();return qe(r)},arguments)},e.wbg.__wbg_signal_a61f78a3478fd9bc=function(t){let r=xe(t).signal;return qe(r)},e.wbg.__wbg_new_0d76b0581eca6298=function(){return Ds(function(){let t=new AbortController;return qe(t)},arguments)},e.wbg.__wbg_abort_2aa7521d5690750e=function(t){xe(t).abort()},e.wbg.__wbg_view_7f0ce470793a340f=function(t){let r=xe(t).view;return uc(r)?0:qe(r)},e.wbg.__wbg_respond_b1a43b2e3a06d525=function(){return Ds(function(t,r){xe(t).respond(r>>>0)},arguments)},e.wbg.__wbg_newwithstrandinit_3fd6fba4083ff2d0=function(){return Ds(function(t,r,i){let s=new Request(tu(t,r),xe(i));return qe(s)},arguments)},e.wbg.__wbg_get_bd8e338fbd5f5cc8=function(t,r){let i=xe(t)[r>>>0];return qe(i)},e.wbg.__wbg_length_cd7af8117672b8b8=function(t){return xe(t).length},e.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(t,r){let i=new Function(tu(t,r));return qe(i)},e.wbg.__wbg_new_d9bc3a0147634640=function(){return qe(new Map)},e.wbg.__wbg_next_40fc327bfc8770e6=function(t){let r=xe(t).next;return qe(r)},e.wbg.__wbg_next_196c84450b364254=function(){return Ds(function(t){let r=xe(t).next();return qe(r)},arguments)},e.wbg.__wbg_done_298b57d23c0fc80c=function(t){return xe(t).done},e.wbg.__wbg_value_d93c65011f51a456=function(t){let r=xe(t).value;return qe(r)},e.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return qe(Symbol.iterator)},e.wbg.__wbg_get_e3c254076557e348=function(){return Ds(function(t,r){let i=Reflect.get(xe(t),xe(r));return qe(i)},arguments)},e.wbg.__wbg_call_27c0f87801dedf93=function(){return Ds(function(t,r){let i=xe(t).call(xe(r));return qe(i)},arguments)},e.wbg.__wbg_new_72fb9a18b5ae2624=function(){let t=new Object;return qe(t)},e.wbg.__wbindgen_is_string=function(t){return typeof xe(t)==\"string\"},e.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return Ds(function(){let t=self.self;return qe(t)},arguments)},e.wbg.__wbg_window_c6fb939a7f436783=function(){return Ds(function(){let t=window.window;return qe(t)},arguments)},e.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return Ds(function(){let t=globalThis.globalThis;return qe(t)},arguments)},e.wbg.__wbg_global_207b558942527489=function(){return Ds(function(){let t=global.global;return qe(t)},arguments)},e.wbg.__wbg_isArray_2ab64d95e09ea0ae=function(t){return Array.isArray(xe(t))},e.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(t){let r;try{r=xe(t)instanceof ArrayBuffer}catch{r=!1}return r},e.wbg.__wbg_new_28c511d9baebfa89=function(t,r){let i=new Error(tu(t,r));return qe(i)},e.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return Ds(function(t,r,i){let s=xe(t).call(xe(r),xe(i));return qe(s)},arguments)},e.wbg.__wbg_set_8417257aaedc936b=function(t,r,i){let s=xe(t).set(xe(r),xe(i));return qe(s)},e.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2=function(t){return Number.isSafeInteger(xe(t))},e.wbg.__wbg_new_cf3ec55744a78578=function(t){let r=new Date(xe(t));return qe(r)},e.wbg.__wbg_entries_95cc2c823b285a09=function(t){let r=Object.entries(xe(t));return qe(r)},e.wbg.__wbg_new_81740750da40724f=function(t,r){try{var i={a:t,b:r},s=(o,c)=>{let f=i.a;i.a=0;try{return Rut(f,i.b,o,c)}finally{i.a=f}};let n=new Promise(s);return qe(n)}finally{i.a=i.b=0}},e.wbg.__wbg_resolve_b0083a7967828ec8=function(t){let r=Promise.resolve(xe(t));return qe(r)},e.wbg.__wbg_catch_0260e338d10f79ae=function(t,r){let i=xe(t).catch(xe(r));return qe(i)},e.wbg.__wbg_then_0c86a60e8fcfe9f6=function(t,r){let i=xe(t).then(xe(r));return qe(i)},e.wbg.__wbg_then_a73caa9a87991566=function(t,r,i){let s=xe(t).then(xe(r),xe(i));return qe(s)},e.wbg.__wbg_buffer_12d079cc21e14bdb=function(t){let r=xe(t).buffer;return qe(r)},e.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb=function(t,r,i){let s=new Uint8Array(xe(t),r>>>0,i>>>0);return qe(s)},e.wbg.__wbg_new_63b92bc8671ed464=function(t){let r=new Uint8Array(xe(t));return qe(r)},e.wbg.__wbg_set_a47bac70306a19a7=function(t,r,i){xe(t).set(xe(r),i>>>0)},e.wbg.__wbg_length_c20a40f15020d68a=function(t){return xe(t).length},e.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(t){let r;try{r=xe(t)instanceof Uint8Array}catch{r=!1}return r},e.wbg.__wbg_newwithlength_e9b4878cebadb3d3=function(t){let r=new Uint8Array(t>>>0);return qe(r)},e.wbg.__wbg_newwithbyteoffset_27c6424791adc775=function(t,r){let i=new Uint8Array(xe(t),r>>>0);return qe(i)},e.wbg.__wbg_buffer_dd7f74bc60f1faab=function(t){let r=xe(t).buffer;return qe(r)},e.wbg.__wbg_byteLength_58f7b4fab1919d44=function(t){return xe(t).byteLength},e.wbg.__wbg_byteOffset_81d60f7392524f62=function(t){return xe(t).byteOffset},e.wbg.__wbg_stringify_8887fe74e1c50d81=function(){return Ds(function(t){let r=JSON.stringify(xe(t));return qe(r)},arguments)},e.wbg.__wbg_has_0af94d20077affa2=function(){return Ds(function(t,r){return Reflect.has(xe(t),xe(r))},arguments)},e.wbg.__wbg_set_1f9b04f170055d33=function(){return Ds(function(t,r,i){return Reflect.set(xe(t),xe(r),xe(i))},arguments)},e.wbg.__wbindgen_bigint_get_as_i64=function(t,r){let i=xe(r),s=typeof i==\"bigint\"?i:void 0;Put()[t/8+1]=uc(s)?BigInt(0):s,Ue()[t/4+0]=!uc(s)},e.wbg.__wbindgen_debug_string=function(t,r){let i=WD(xe(r)),s=fp(i,zt.__wbindgen_malloc,zt.__wbindgen_realloc),n=hc;Ue()[t/4+1]=n,Ue()[t/4+0]=s},e.wbg.__wbindgen_throw=function(t,r){throw new Error(tu(t,r))},e.wbg.__wbindgen_memory=function(){let t=zt.memory;return qe(t)},e.wbg.__wbindgen_function_table=function(){let t=zt.__wbindgen_export_2;return qe(t)},e.wbg.__wbindgen_closure_wrapper13295=function(t,r,i){let s=Iut(t,r,3248,Cut);return qe(s)},e}function But(e,t){return zt=e.exports,F9.__wbindgen_wasm_module=t,xw=null,yw=null,vw=null,bw=null,_w=null,zt}async function F9(e){if(zt!==void 0)return zt;typeof e>\"u\"&&(e=new URL(\"parquet_wasm_bg.wasm\",import.meta.url));let t=Out();(typeof e==\"string\"||typeof Request==\"function\"&&e instanceof Request||typeof URL==\"function\"&&e instanceof URL)&&(e=fetch(e));let{instance:r,module:i}=await Dut(await e,t);return But(r,i)}var z9=F9;function U9(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols==\"function\")for(var s=0,i=Object.getOwnPropertySymbols(e);s=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?\"Object is not iterable.\":\"Symbol.iterator is not defined.\")}function ii(e){return this instanceof ii?(this.v=e,this):new ii(e)}function eu(e,t,r){if(!Symbol.asyncIterator)throw new TypeError(\"Symbol.asyncIterator is not defined.\");var i=r.apply(e,t||[]),s,n=[];return s={},o(\"next\"),o(\"throw\"),o(\"return\"),s[Symbol.asyncIterator]=function(){return this},s;function o(R){i[R]&&(s[R]=function(N){return new Promise(function(j,Q){n.push([R,N,j,Q])>1||c(R,N)})})}function c(R,N){try{f(i[R](N))}catch(j){I(n[0][3],j)}}function f(R){R.value instanceof ii?Promise.resolve(R.value.v).then(_,w):I(n[0][2],R)}function _(R){c(\"next\",R)}function w(R){c(\"throw\",R)}function I(R,N){R(N),n.shift(),n.length&&c(n[0][0],n[0][1])}}function lv(e){var t,r;return t={},i(\"next\"),i(\"throw\",function(s){throw s}),i(\"return\"),t[Symbol.iterator]=function(){return this},t;function i(s,n){t[s]=e[s]?function(o){return(r=!r)?{value:ii(e[s](o)),done:!1}:n?n(o):o}:n}}function Zh(e){if(!Symbol.asyncIterator)throw new TypeError(\"Symbol.asyncIterator is not defined.\");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof N9==\"function\"?N9(e):e[Symbol.iterator](),r={},i(\"next\"),i(\"throw\"),i(\"return\"),r[Symbol.asyncIterator]=function(){return this},r);function i(n){r[n]=e[n]&&function(o){return new Promise(function(c,f){o=e[n](o),s(c,f,o.done,o.value)})}}function s(n,o,c,f){Promise.resolve(f).then(function(_){n({value:_,done:c})},o)}}var iO={};mA(iO,{compareArrayLike:()=>rO,joinUint8Arrays:()=>iu,memcpy:()=>Ew,rebaseValueOffsets:()=>FP,toArrayBufferView:()=>Ai,toArrayBufferViewAsyncIterator:()=>Qh,toArrayBufferViewIterator:()=>td,toBigInt64Array:()=>BP,toBigUint64Array:()=>Hut,toFloat32Array:()=>qut,toFloat32ArrayAsyncIterator:()=>lht,toFloat32ArrayIterator:()=>tht,toFloat64Array:()=>Zut,toFloat64ArrayAsyncIterator:()=>cht,toFloat64ArrayIterator:()=>eht,toInt16Array:()=>jut,toInt16ArrayAsyncIterator:()=>nht,toInt16ArrayIterator:()=>$ut,toInt32Array:()=>yg,toInt32ArrayAsyncIterator:()=>sht,toInt32ArrayIterator:()=>Xut,toInt8Array:()=>Vut,toInt8ArrayAsyncIterator:()=>iht,toInt8ArrayIterator:()=>Qut,toUint16Array:()=>Gut,toUint16ArrayAsyncIterator:()=>oht,toUint16ArrayIterator:()=>Kut,toUint32Array:()=>Wut,toUint32ArrayAsyncIterator:()=>aht,toUint32ArrayIterator:()=>Jut,toUint8Array:()=>Rr,toUint8ArrayAsyncIterator:()=>eO,toUint8ArrayIterator:()=>tO,toUint8ClampedArray:()=>Yut,toUint8ClampedArrayAsyncIterator:()=>uht,toUint8ClampedArrayIterator:()=>rht});var Fut=new TextDecoder(\"utf-8\"),Tw=e=>Fut.decode(e),zut=new TextEncoder,Jf=e=>zut.encode(e);var Nut=e=>typeof e==\"number\",V9=e=>typeof e==\"boolean\",Oo=e=>typeof e==\"function\",Cl=e=>e!=null&&Object(e)===e,ru=e=>Cl(e)&&Oo(e.then);var Yh=e=>Cl(e)&&Oo(e[Symbol.iterator]),Nu=e=>Cl(e)&&Oo(e[Symbol.asyncIterator]),CP=e=>Cl(e)&&Cl(e.schema);var LP=e=>Cl(e)&&\"done\"in e&&\"value\"in e;var kP=e=>Cl(e)&&Oo(e.stat)&&Nut(e.fd);var RP=e=>Cl(e)&&Mw(e.body),DP=e=>\"_getDOMStream\"in e&&\"_getNodeStream\"in e,j9=e=>Cl(e)&&Oo(e.abort)&&Oo(e.getWriter)&&!DP(e),Mw=e=>Cl(e)&&Oo(e.cancel)&&Oo(e.getReader)&&!DP(e),G9=e=>Cl(e)&&Oo(e.end)&&Oo(e.write)&&V9(e.writable)&&!DP(e),OP=e=>Cl(e)&&Oo(e.read)&&Oo(e.pipe)&&V9(e.readable)&&!DP(e),W9=e=>Cl(e)&&Oo(e.clear)&&Oo(e.bytes)&&Oo(e.position)&&Oo(e.setPosition)&&Oo(e.capacity)&&Oo(e.getBufferIdentifier)&&Oo(e.createLong);var JD=typeof SharedArrayBuffer<\"u\"?SharedArrayBuffer:ArrayBuffer;function Uut(e){let t=e[0]?[e[0]]:[],r,i,s,n;for(let o,c,f=0,_=0,w=e.length;++fw+I.byteLength,0),s,n,o,c=0,f=-1,_=Math.min(t||Number.POSITIVE_INFINITY,i);for(let w=r.length;++fAi(Int8Array,e),jut=e=>Ai(Int16Array,e),yg=e=>Ai(Int32Array,e),BP=e=>Ai(BigInt64Array,e),Rr=e=>Ai(Uint8Array,e),Gut=e=>Ai(Uint16Array,e),Wut=e=>Ai(Uint32Array,e),Hut=e=>Ai(BigUint64Array,e),qut=e=>Ai(Float32Array,e),Zut=e=>Ai(Float64Array,e),Yut=e=>Ai(Uint8ClampedArray,e),KD=e=>(e.next(),e);function*td(e,t){let r=function*(s){yield s},i=typeof t==\"string\"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof JD?r(t):Yh(t)?t:r(t);return yield*KD(function*(s){let n=null;do n=s.next(yield Ai(e,n));while(!n.done)}(i[Symbol.iterator]())),new e}var Qut=e=>td(Int8Array,e),$ut=e=>td(Int16Array,e),Xut=e=>td(Int32Array,e),tO=e=>td(Uint8Array,e),Kut=e=>td(Uint16Array,e),Jut=e=>td(Uint32Array,e),tht=e=>td(Float32Array,e),eht=e=>td(Float64Array,e),rht=e=>td(Uint8ClampedArray,e);function Qh(e,t){return eu(this,arguments,function*(){if(ru(t))return yield ii(yield ii(yield*lv(Zh(Qh(e,yield ii(t))))));let i=function(o){return eu(this,arguments,function*(){yield yield ii(yield ii(o))})},s=function(o){return eu(this,arguments,function*(){yield ii(yield*lv(Zh(KD(function*(c){let f=null;do f=c.next(yield f?.value);while(!f.done)}(o[Symbol.iterator]())))))})},n=typeof t==\"string\"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof JD?i(t):Yh(t)?s(t):Nu(t)?t:i(t);return yield ii(yield*lv(Zh(KD(function(o){return eu(this,arguments,function*(){let c=null;do c=yield ii(o.next(yield yield ii(Ai(e,c))));while(!c.done)})}(n[Symbol.asyncIterator]()))))),yield ii(new e)})}var iht=e=>Qh(Int8Array,e),nht=e=>Qh(Int16Array,e),sht=e=>Qh(Int32Array,e),eO=e=>Qh(Uint8Array,e),oht=e=>Qh(Uint16Array,e),aht=e=>Qh(Uint32Array,e),lht=e=>Qh(Float32Array,e),cht=e=>Qh(Float64Array,e),uht=e=>Qh(Uint8ClampedArray,e);function FP(e,t,r){if(e!==0){r=r.slice(0,t);for(let i=-1,s=r.length;++i0)do if(e[r]!==t[r])return!1;while(++r(e.next(),e);function*hht(e){let t,r=!1,i=[],s,n,o,c=0;function f(){return n===\"peek\"?iu(i,o)[0]:([s,i,c]=iu(i,o),s)}({cmd:n,size:o}=(yield null)||{cmd:\"read\",size:0});let _=tO(e)[Symbol.iterator]();try{do if({done:t,value:s}=Number.isNaN(o-c)?_.next():_.next(o-c),!t&&s.byteLength>0&&(i.push(s),c+=s.byteLength),t||o<=c)do({cmd:n,size:o}=yield f());while(o0&&(s.push(n),f+=n.byteLength),r||c<=f)do({cmd:o,size:c}=yield yield ii(_()));while(c0&&(s.push(Rr(n)),f+=n.byteLength),r||c<=f)do({cmd:o,size:c}=yield yield ii(_()));while(c{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return ar(this,void 0,void 0,function*(){let{reader:r,source:i}=this;r&&(yield r.cancel(t).catch(()=>{})),i&&i.locked&&this.releaseLock()})}read(t){return ar(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=Rr(r)),r})}},nO=(e,t)=>{let r=s=>i([t,s]),i;return[t,r,new Promise(s=>(i=s)&&e.once(t,r))]};function pht(e){return eu(this,arguments,function*(){let r=[],i=\"error\",s=!1,n=null,o,c,f=0,_=[],w;function I(){return o===\"peek\"?iu(_,c)[0]:([w,_,f]=iu(_,c),w)}if({cmd:o,size:c}=(yield yield ii(null))||{cmd:\"read\",size:0},e.isTTY)return yield yield ii(new Uint8Array(0)),yield ii(null);try{r[0]=nO(e,\"end\"),r[1]=nO(e,\"error\");do{if(r[2]=nO(e,\"readable\"),[i,n]=yield ii(Promise.race(r.map(N=>N[2]))),i===\"error\")break;if((s=i===\"end\")||(Number.isFinite(c-f)?(w=Rr(e.read(c-f)),w.byteLength0&&(_.push(w),f+=w.byteLength)),s||c<=f)do({cmd:o,size:c}=yield yield ii(I()));while(c{for(let[Y,K]of N)e.off(Y,K);try{let Y=e.destroy;Y&&Y.call(e,j),j=void 0}catch(Y){j=Y||j}finally{j!=null?et(j):Q()}})}})}var sn;(function(e){e[e.V1=0]=\"V1\",e[e.V2=1]=\"V2\",e[e.V3=2]=\"V3\",e[e.V4=3]=\"V4\",e[e.V5=4]=\"V5\"})(sn||(sn={}));var Pn;(function(e){e[e.Sparse=0]=\"Sparse\",e[e.Dense=1]=\"Dense\"})(Pn||(Pn={}));var $i;(function(e){e[e.HALF=0]=\"HALF\",e[e.SINGLE=1]=\"SINGLE\",e[e.DOUBLE=2]=\"DOUBLE\"})($i||($i={}));var Os;(function(e){e[e.DAY=0]=\"DAY\",e[e.MILLISECOND=1]=\"MILLISECOND\"})(Os||(Os={}));var Ar;(function(e){e[e.SECOND=0]=\"SECOND\",e[e.MILLISECOND=1]=\"MILLISECOND\",e[e.MICROSECOND=2]=\"MICROSECOND\",e[e.NANOSECOND=3]=\"NANOSECOND\"})(Ar||(Ar={}));var Bo;(function(e){e[e.YEAR_MONTH=0]=\"YEAR_MONTH\",e[e.DAY_TIME=1]=\"DAY_TIME\",e[e.MONTH_DAY_NANO=2]=\"MONTH_DAY_NANO\"})(Bo||(Bo={}));var ed=new Int32Array(2),NP=new Float32Array(ed.buffer),UP=new Float64Array(ed.buffer),cv=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Pw;(function(e){e[e.UTF8_BYTES=1]=\"UTF8_BYTES\",e[e.UTF16_STRING=2]=\"UTF16_STRING\"})(Pw||(Pw={}));var nu=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){NP[0]=r,this.writeInt32(t,ed[0])}writeFloat64(t,r){UP[0]=r,this.writeInt32(t,ed[cv?0:1]),this.writeInt32(t+4,ed[cv?1:0])}getBufferIdentifier(){if(this.bytes_.lengththis.minalign&&(this.minalign=t);let i=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space=0&&this.vtable[r]==0;r--);let i=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let s=2;this.addInt16(t-this.object_start);let n=(i+s)*2;this.addInt16(n);let o=0,c=this.space;t:for(r=0;r=0;o--)this.writeInt8(n.charCodeAt(o))}this.prep(this.minalign,4+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let i=this.bb.capacity()-t,s=i-this.bb.readInt32(i);if(!(r=0;i--)t.addInt32(r[i]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,i){return e.startUnion(t),e.addMode(t,r),e.addTypeIds(t,i),e.endUnion(t)}};var Nw=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}};var In;(function(e){e[e.NONE=0]=\"NONE\",e[e.Null=1]=\"Null\",e[e.Int=2]=\"Int\",e[e.FloatingPoint=3]=\"FloatingPoint\",e[e.Binary=4]=\"Binary\",e[e.Utf8=5]=\"Utf8\",e[e.Bool=6]=\"Bool\",e[e.Decimal=7]=\"Decimal\",e[e.Date=8]=\"Date\",e[e.Time=9]=\"Time\",e[e.Timestamp=10]=\"Timestamp\",e[e.Interval=11]=\"Interval\",e[e.List=12]=\"List\",e[e.Struct_=13]=\"Struct_\",e[e.Union=14]=\"Union\",e[e.FixedSizeBinary=15]=\"FixedSizeBinary\",e[e.FixedSizeList=16]=\"FixedSizeList\",e[e.Map=17]=\"Map\",e[e.Duration=18]=\"Duration\",e[e.LargeBinary=19]=\"LargeBinary\",e[e.LargeUtf8=20]=\"LargeUtf8\",e[e.LargeList=21]=\"LargeList\",e[e.RunEndEncoded=22]=\"RunEndEncoded\"})(In||(In={}));var nl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):In.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new rd).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let i=this.bb.__offset(this.bb_pos,14);return i?(r||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,16);return i?(r||new Fo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,In.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}};var fc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):im.Little}fields(t,r){let i=this.bb.__offset(this.bb_pos,6);return i?(r||new nl).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new Fo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,im.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addInt64(r[i]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,r){t.finish(r)}static finishSizePrefixedSchemaBuffer(t,r){t.finish(r,void 0,!0)}static createSchema(t,r,i,s,n){return e.startSchema(t),e.addEndianness(t,r),e.addFields(t,i),e.addCustomMetadata(t,s),e.addFeatures(t,n),e.endSchema(t)}};var wi;(function(e){e[e.NONE=0]=\"NONE\",e[e.Schema=1]=\"Schema\",e[e.DictionaryBatch=2]=\"DictionaryBatch\",e[e.RecordBatch=3]=\"RecordBatch\",e[e.Tensor=4]=\"Tensor\",e[e.SparseTensor=5]=\"SparseTensor\"})(wi||(wi={}));var Ot;(function(e){e[e.NONE=0]=\"NONE\",e[e.Null=1]=\"Null\",e[e.Int=2]=\"Int\",e[e.Float=3]=\"Float\",e[e.Binary=4]=\"Binary\",e[e.Utf8=5]=\"Utf8\",e[e.Bool=6]=\"Bool\",e[e.Decimal=7]=\"Decimal\",e[e.Date=8]=\"Date\",e[e.Time=9]=\"Time\",e[e.Timestamp=10]=\"Timestamp\",e[e.Interval=11]=\"Interval\",e[e.List=12]=\"List\",e[e.Struct=13]=\"Struct\",e[e.Union=14]=\"Union\",e[e.FixedSizeBinary=15]=\"FixedSizeBinary\",e[e.FixedSizeList=16]=\"FixedSizeList\",e[e.Map=17]=\"Map\",e[e.Duration=18]=\"Duration\",e[e.LargeBinary=19]=\"LargeBinary\",e[e.LargeUtf8=20]=\"LargeUtf8\",e[e.Dictionary=-1]=\"Dictionary\",e[e.Int8=-2]=\"Int8\",e[e.Int16=-3]=\"Int16\",e[e.Int32=-4]=\"Int32\",e[e.Int64=-5]=\"Int64\",e[e.Uint8=-6]=\"Uint8\",e[e.Uint16=-7]=\"Uint16\",e[e.Uint32=-8]=\"Uint32\",e[e.Uint64=-9]=\"Uint64\",e[e.Float16=-10]=\"Float16\",e[e.Float32=-11]=\"Float32\",e[e.Float64=-12]=\"Float64\",e[e.DateDay=-13]=\"DateDay\",e[e.DateMillisecond=-14]=\"DateMillisecond\",e[e.TimestampSecond=-15]=\"TimestampSecond\",e[e.TimestampMillisecond=-16]=\"TimestampMillisecond\",e[e.TimestampMicrosecond=-17]=\"TimestampMicrosecond\",e[e.TimestampNanosecond=-18]=\"TimestampNanosecond\",e[e.TimeSecond=-19]=\"TimeSecond\",e[e.TimeMillisecond=-20]=\"TimeMillisecond\",e[e.TimeMicrosecond=-21]=\"TimeMicrosecond\",e[e.TimeNanosecond=-22]=\"TimeNanosecond\",e[e.DenseUnion=-23]=\"DenseUnion\",e[e.SparseUnion=-24]=\"SparseUnion\",e[e.IntervalDayTime=-25]=\"IntervalDayTime\",e[e.IntervalYearMonth=-26]=\"IntervalYearMonth\",e[e.DurationSecond=-27]=\"DurationSecond\",e[e.DurationMillisecond=-28]=\"DurationMillisecond\",e[e.DurationMicrosecond=-29]=\"DurationMicrosecond\",e[e.DurationNanosecond=-30]=\"DurationNanosecond\"})(Ot||(Ot={}));var Oi;(function(e){e[e.OFFSET=0]=\"OFFSET\",e[e.DATA=1]=\"DATA\",e[e.VALIDITY=2]=\"VALIDITY\",e[e.TYPE=3]=\"TYPE\"})(Oi||(Oi={}));var TO={};mA(TO,{clampRange:()=>Kw,createElementComparator:()=>pm,wrapIndex:()=>xg});var oO={};mA(oO,{valueToString:()=>Jh});function Jh(e){if(e===null)return\"null\";if(e===void 0)return\"undefined\";switch(typeof e){case\"number\":return`${e}`;case\"bigint\":return`${e}`;case\"string\":return`\"${e}\"`}return typeof e[Symbol.toPrimitive]==\"function\"?e[Symbol.toPrimitive](\"string\"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>Jh(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r==\"bigint\"?`${r}`:r)}var uO={};mA(uO,{BN:()=>Vw,bigNumToBigInt:()=>q9,bigNumToNumber:()=>cO,bigNumToString:()=>pv,isArrowBigNumSymbol:()=>H9});function Wi(e){if(typeof e==\"bigint\"&&(eNumber.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function aO(e,t){return Wi(e/t)+Wi(e%t)/Wi(t)}var H9=Symbol.for(\"isArrowBigNum\");function tf(e,...t){return t.length===0?Object.setPrototypeOf(Ai(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}tf.prototype[H9]=!0;tf.prototype.toJSON=function(){return`\"${pv(this)}\"`};tf.prototype.valueOf=function(e){return cO(this,e)};tf.prototype.toString=function(){return pv(this)};tf.prototype[Symbol.toPrimitive]=function(e=\"default\"){switch(e){case\"number\":return cO(this);case\"string\":return pv(this);case\"default\":return q9(this)}return pv(this)};function fv(...e){return tf.apply(this,e)}function dv(...e){return tf.apply(this,e)}function Uw(...e){return tf.apply(this,e)}Object.setPrototypeOf(fv.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(dv.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Uw.prototype,Object.create(Uint32Array.prototype));Object.assign(fv.prototype,tf.prototype,{constructor:fv,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(dv.prototype,tf.prototype,{constructor:dv,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Uw.prototype,tf.prototype,{constructor:Uw,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var Aht=BigInt(4294967296)*BigInt(4294967296),mht=Aht-BigInt(1);function cO(e,t){let{buffer:r,byteOffset:i,byteLength:s,signed:n}=e,o=new BigUint64Array(r,i,s/8),c=n&&o.at(-1)&BigInt(1)<=0)return lO(e);t=t.slice();let i=1;for(let n=0;n(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]=\"DataType\"))(ze.prototype);var ea=class extends ze{constructor(){super(Ot.Null)}toString(){return\"Null\"}};Y9=Symbol.toStringTag;ea[Y9]=(e=>e[Symbol.toStringTag]=\"Null\")(ea.prototype);var Bs=class extends ze{constructor(t,r){super(Ot.Int),this.isSigned=t,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?\"I\":\"Ui\"}nt${this.bitWidth}`}};Q9=Symbol.toStringTag;Bs[Q9]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]=\"Int\"))(Bs.prototype);var jw=class extends Bs{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Gw=class extends Bs{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},ef=class extends Bs{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Ww=class extends Bs{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Hw=class extends Bs{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},qw=class extends Bs{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Zw=class extends Bs{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Yw=class extends Bs{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(jw.prototype,\"ArrayType\",{value:Int8Array});Object.defineProperty(Gw.prototype,\"ArrayType\",{value:Int16Array});Object.defineProperty(ef.prototype,\"ArrayType\",{value:Int32Array});Object.defineProperty(Ww.prototype,\"ArrayType\",{value:BigInt64Array});Object.defineProperty(Hw.prototype,\"ArrayType\",{value:Uint8Array});Object.defineProperty(qw.prototype,\"ArrayType\",{value:Uint16Array});Object.defineProperty(Zw.prototype,\"ArrayType\",{value:Uint32Array});Object.defineProperty(Yw.prototype,\"ArrayType\",{value:BigUint64Array});var ra=class extends ze{constructor(t){super(Ot.Float),this.precision=t}get ArrayType(){switch(this.precision){case $i.HALF:return Uint16Array;case $i.SINGLE:return Float32Array;case $i.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};$9=Symbol.toStringTag;ra[$9]=(e=>(e.precision=null,e[Symbol.toStringTag]=\"Float\"))(ra.prototype);var Qw=class extends ra{constructor(){super($i.HALF)}},$w=class extends ra{constructor(){super($i.SINGLE)}},Av=class extends ra{constructor(){super($i.DOUBLE)}};Object.defineProperty(Qw.prototype,\"ArrayType\",{value:Uint16Array});Object.defineProperty($w.prototype,\"ArrayType\",{value:Float32Array});Object.defineProperty(Av.prototype,\"ArrayType\",{value:Float64Array});var Vu=class extends ze{constructor(){super(Ot.Binary)}toString(){return\"Binary\"}};X9=Symbol.toStringTag;Vu[X9]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=\"Binary\"))(Vu.prototype);var nd=class extends ze{constructor(){super(Ot.LargeBinary)}toString(){return\"LargeBinary\"}};K9=Symbol.toStringTag;nd[K9]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=\"LargeBinary\"))(nd.prototype);var ju=class extends ze{constructor(){super(Ot.Utf8)}toString(){return\"Utf8\"}};J9=Symbol.toStringTag;ju[J9]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=\"Utf8\"))(ju.prototype);var sd=class extends ze{constructor(){super(Ot.LargeUtf8)}toString(){return\"LargeUtf8\"}};tW=Symbol.toStringTag;sd[tW]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=\"LargeUtf8\"))(sd.prototype);var dc=class extends ze{constructor(){super(Ot.Bool)}toString(){return\"Bool\"}};eW=Symbol.toStringTag;dc[eW]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=\"Bool\"))(dc.prototype);var Gu=class extends ze{constructor(t,r,i=128){super(Ot.Decimal),this.scale=t,this.precision=r,this.bitWidth=i}toString(){return`Decimal[${this.precision}e${this.scale>0?\"+\":\"\"}${this.scale}]`}};rW=Symbol.toStringTag;Gu[rW]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]=\"Decimal\"))(Gu.prototype);var Wu=class extends ze{constructor(t){super(Ot.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Os[this.unit]}>`}get ArrayType(){return this.unit===Os.DAY?Int32Array:BigInt64Array}};iW=Symbol.toStringTag;Wu[iW]=(e=>(e.unit=null,e[Symbol.toStringTag]=\"Date\"))(Wu.prototype);var Hu=class extends ze{constructor(t,r){super(Ot.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${Ar[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};nW=Symbol.toStringTag;Hu[nW]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]=\"Time\"))(Hu.prototype);var qu=class extends ze{constructor(t,r){super(Ot.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${Ar[this.unit]}${this.timezone?`, ${this.timezone}`:\"\"}>`}};sW=Symbol.toStringTag;qu[sW]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=\"Timestamp\"))(qu.prototype);var Zu=class extends ze{constructor(t){super(Ot.Interval),this.unit=t}toString(){return`Interval<${Bo[this.unit]}>`}};oW=Symbol.toStringTag;Zu[oW]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]=\"Interval\"))(Zu.prototype);var Yu=class extends ze{constructor(t){super(Ot.Duration),this.unit=t}toString(){return`Duration<${Ar[this.unit]}>`}};aW=Symbol.toStringTag;Yu[aW]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=\"Duration\"))(Yu.prototype);var sl=class extends ze{constructor(t){super(Ot.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};lW=Symbol.toStringTag;sl[lW]=(e=>(e.children=null,e[Symbol.toStringTag]=\"List\"))(sl.prototype);var pn=class extends ze{constructor(t){super(Ot.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(\", \")}}>`}};cW=Symbol.toStringTag;pn[cW]=(e=>(e.children=null,e[Symbol.toStringTag]=\"Struct\"))(pn.prototype);var pc=class extends ze{constructor(t,r,i){super(Ot.Union),this.mode=t,this.children=i,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((s,n,o)=>(s[n]=o)&&s||s,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(\" | \")}>`}};uW=Symbol.toStringTag;pc[uW]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]=\"Union\"))(pc.prototype);var Qu=class extends ze{constructor(t){super(Ot.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};hW=Symbol.toStringTag;Qu[hW]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]=\"FixedSizeBinary\"))(Qu.prototype);var Ll=class extends ze{constructor(t,r){super(Ot.FixedSizeList),this.listSize=t,this.children=[r]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};fW=Symbol.toStringTag;Ll[fW]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]=\"FixedSizeList\"))(Ll.prototype);var Ac=class extends ze{constructor(t,r=!1){var i,s,n;if(super(Ot.Map),this.children=[t],this.keysSorted=r,t&&(t.name=\"entries\",!((i=t?.type)===null||i===void 0)&&i.children)){let o=(s=t?.type)===null||s===void 0?void 0:s.children[0];o&&(o.name=\"key\");let c=(n=t?.type)===null||n===void 0?void 0:n.children[1];c&&(c.name=\"value\")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(\", \")}}>`}};dW=Symbol.toStringTag;Ac[dW]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]=\"Map_\"))(Ac.prototype);var ght=(e=>()=>++e)(-1),mc=class extends ze{constructor(t,r,i,s){super(Ot.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=s||!1,this.id=i==null?ght():Wi(i)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};pW=Symbol.toStringTag;mc[pW]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]=\"Dictionary\"))(mc.prototype);function ou(e){let t=e;switch(e.typeId){case Ot.Decimal:return e.bitWidth/32;case Ot.Interval:return 1+t.unit;case Ot.FixedSizeList:return t.listSize;case Ot.FixedSizeBinary:return t.byteWidth;default:return 1}}var Er=class{visitMany(t,...r){return t.map((i,s)=>this.visit(i,...r.map(n=>n[s])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return _ht(this,t,r)}getVisitFnByTypeId(t,r=!0){return mv(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};function _ht(e,t,r=!0){return typeof t==\"number\"?mv(e,t,r):typeof t==\"string\"&&t in Ot?mv(e,Ot[t],r):t&&t instanceof ze?mv(e,AW(t),r):t?.type&&t.type instanceof ze?mv(e,AW(t.type),r):mv(e,Ot.NONE,r)}function mv(e,t,r=!0){let i=null;switch(t){case Ot.Null:i=e.visitNull;break;case Ot.Bool:i=e.visitBool;break;case Ot.Int:i=e.visitInt;break;case Ot.Int8:i=e.visitInt8||e.visitInt;break;case Ot.Int16:i=e.visitInt16||e.visitInt;break;case Ot.Int32:i=e.visitInt32||e.visitInt;break;case Ot.Int64:i=e.visitInt64||e.visitInt;break;case Ot.Uint8:i=e.visitUint8||e.visitInt;break;case Ot.Uint16:i=e.visitUint16||e.visitInt;break;case Ot.Uint32:i=e.visitUint32||e.visitInt;break;case Ot.Uint64:i=e.visitUint64||e.visitInt;break;case Ot.Float:i=e.visitFloat;break;case Ot.Float16:i=e.visitFloat16||e.visitFloat;break;case Ot.Float32:i=e.visitFloat32||e.visitFloat;break;case Ot.Float64:i=e.visitFloat64||e.visitFloat;break;case Ot.Utf8:i=e.visitUtf8;break;case Ot.LargeUtf8:i=e.visitLargeUtf8;break;case Ot.Binary:i=e.visitBinary;break;case Ot.LargeBinary:i=e.visitLargeBinary;break;case Ot.FixedSizeBinary:i=e.visitFixedSizeBinary;break;case Ot.Date:i=e.visitDate;break;case Ot.DateDay:i=e.visitDateDay||e.visitDate;break;case Ot.DateMillisecond:i=e.visitDateMillisecond||e.visitDate;break;case Ot.Timestamp:i=e.visitTimestamp;break;case Ot.TimestampSecond:i=e.visitTimestampSecond||e.visitTimestamp;break;case Ot.TimestampMillisecond:i=e.visitTimestampMillisecond||e.visitTimestamp;break;case Ot.TimestampMicrosecond:i=e.visitTimestampMicrosecond||e.visitTimestamp;break;case Ot.TimestampNanosecond:i=e.visitTimestampNanosecond||e.visitTimestamp;break;case Ot.Time:i=e.visitTime;break;case Ot.TimeSecond:i=e.visitTimeSecond||e.visitTime;break;case Ot.TimeMillisecond:i=e.visitTimeMillisecond||e.visitTime;break;case Ot.TimeMicrosecond:i=e.visitTimeMicrosecond||e.visitTime;break;case Ot.TimeNanosecond:i=e.visitTimeNanosecond||e.visitTime;break;case Ot.Decimal:i=e.visitDecimal;break;case Ot.List:i=e.visitList;break;case Ot.Struct:i=e.visitStruct;break;case Ot.Union:i=e.visitUnion;break;case Ot.DenseUnion:i=e.visitDenseUnion||e.visitUnion;break;case Ot.SparseUnion:i=e.visitSparseUnion||e.visitUnion;break;case Ot.Dictionary:i=e.visitDictionary;break;case Ot.Interval:i=e.visitInterval;break;case Ot.IntervalDayTime:i=e.visitIntervalDayTime||e.visitInterval;break;case Ot.IntervalYearMonth:i=e.visitIntervalYearMonth||e.visitInterval;break;case Ot.Duration:i=e.visitDuration;break;case Ot.DurationSecond:i=e.visitDurationSecond||e.visitDuration;break;case Ot.DurationMillisecond:i=e.visitDurationMillisecond||e.visitDuration;break;case Ot.DurationMicrosecond:i=e.visitDurationMicrosecond||e.visitDuration;break;case Ot.DurationNanosecond:i=e.visitDurationNanosecond||e.visitDuration;break;case Ot.FixedSizeList:i=e.visitFixedSizeList;break;case Ot.Map:i=e.visitMap;break}if(typeof i==\"function\")return i;if(!r)return()=>null;throw new Error(`Unrecognized type '${Ot[t]}'`)}function AW(e){switch(e.typeId){case Ot.Null:return Ot.Null;case Ot.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?Ot.Int8:Ot.Uint8;case 16:return r?Ot.Int16:Ot.Uint16;case 32:return r?Ot.Int32:Ot.Uint32;case 64:return r?Ot.Int64:Ot.Uint64}return Ot.Int}case Ot.Float:switch(e.precision){case $i.HALF:return Ot.Float16;case $i.SINGLE:return Ot.Float32;case $i.DOUBLE:return Ot.Float64}return Ot.Float;case Ot.Binary:return Ot.Binary;case Ot.LargeBinary:return Ot.LargeBinary;case Ot.Utf8:return Ot.Utf8;case Ot.LargeUtf8:return Ot.LargeUtf8;case Ot.Bool:return Ot.Bool;case Ot.Decimal:return Ot.Decimal;case Ot.Time:switch(e.unit){case Ar.SECOND:return Ot.TimeSecond;case Ar.MILLISECOND:return Ot.TimeMillisecond;case Ar.MICROSECOND:return Ot.TimeMicrosecond;case Ar.NANOSECOND:return Ot.TimeNanosecond}return Ot.Time;case Ot.Timestamp:switch(e.unit){case Ar.SECOND:return Ot.TimestampSecond;case Ar.MILLISECOND:return Ot.TimestampMillisecond;case Ar.MICROSECOND:return Ot.TimestampMicrosecond;case Ar.NANOSECOND:return Ot.TimestampNanosecond}return Ot.Timestamp;case Ot.Date:switch(e.unit){case Os.DAY:return Ot.DateDay;case Os.MILLISECOND:return Ot.DateMillisecond}return Ot.Date;case Ot.Interval:switch(e.unit){case Bo.DAY_TIME:return Ot.IntervalDayTime;case Bo.YEAR_MONTH:return Ot.IntervalYearMonth}return Ot.Interval;case Ot.Duration:switch(e.unit){case Ar.SECOND:return Ot.DurationSecond;case Ar.MILLISECOND:return Ot.DurationMillisecond;case Ar.MICROSECOND:return Ot.DurationMicrosecond;case Ar.NANOSECOND:return Ot.DurationNanosecond}return Ot.Duration;case Ot.Map:return Ot.Map;case Ot.List:return Ot.List;case Ot.Struct:return Ot.Struct;case Ot.Union:switch(e.mode){case Pn.Dense:return Ot.DenseUnion;case Pn.Sparse:return Ot.SparseUnion}return Ot.Union;case Ot.FixedSizeBinary:return Ot.FixedSizeBinary;case Ot.FixedSizeList:return Ot.FixedSizeList;case Ot.Dictionary:return Ot.Dictionary}throw new Error(`Unrecognized type '${Ot[e.typeId]}'`)}Er.prototype.visitInt8=null;Er.prototype.visitInt16=null;Er.prototype.visitInt32=null;Er.prototype.visitInt64=null;Er.prototype.visitUint8=null;Er.prototype.visitUint16=null;Er.prototype.visitUint32=null;Er.prototype.visitUint64=null;Er.prototype.visitFloat16=null;Er.prototype.visitFloat32=null;Er.prototype.visitFloat64=null;Er.prototype.visitDateDay=null;Er.prototype.visitDateMillisecond=null;Er.prototype.visitTimestampSecond=null;Er.prototype.visitTimestampMillisecond=null;Er.prototype.visitTimestampMicrosecond=null;Er.prototype.visitTimestampNanosecond=null;Er.prototype.visitTimeSecond=null;Er.prototype.visitTimeMillisecond=null;Er.prototype.visitTimeMicrosecond=null;Er.prototype.visitTimeNanosecond=null;Er.prototype.visitDenseUnion=null;Er.prototype.visitSparseUnion=null;Er.prototype.visitIntervalDayTime=null;Er.prototype.visitIntervalYearMonth=null;Er.prototype.visitDuration=null;Er.prototype.visitDurationSecond=null;Er.prototype.visitDurationMillisecond=null;Er.prototype.visitDurationMicrosecond=null;Er.prototype.visitDurationNanosecond=null;var hO={};mA(hO,{float64ToUint16:()=>Xw,uint16ToFloat64:()=>GP});var mW=new Float64Array(1),gv=new Uint32Array(mW.buffer);function GP(e){let t=(e&31744)>>10,r=(e&1023)/1024,i=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return i*(r?Number.NaN:1/0);case 0:return i*(r?6103515625e-14*r:0)}return i*Math.pow(2,t-15)*(1+r)}function Xw(e){if(e!==e)return 32256;mW[0]=e;let t=(gv[1]&2147483648)>>16&65535,r=gv[1]&2146435072,i=0;return r>=1089470464?gv[0]>0?r=31744:(r=(r&2080374784)>>16,i=(gv[1]&1048575)>>10):r<=1056964608?(i=1048576+(gv[1]&1048575),i=1048576+(i<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,i=(gv[1]&1048575)+512>>10),t|r|i&65535}var kr=class extends Er{};function Wr(e){return(t,r,i)=>{if(t.setValid(r,i!=null))return e(t,r,i)}}var yht=(e,t,r)=>{e[t]=Math.floor(r/864e5)},gW=(e,t,r,i)=>{if(r+1{let s=e+r;i?t[s>>3]|=1<>3]&=~(1<{e[t]=r},fO=({values:e},t,r)=>{e[t]=r},_W=({values:e},t,r)=>{e[t]=Xw(r)},xht=(e,t,r)=>{switch(e.type.precision){case $i.HALF:return _W(e,t,r);case $i.SINGLE:case $i.DOUBLE:return fO(e,t,r)}},WP=({values:e},t,r)=>{yht(e,t,r.valueOf())},HP=({values:e},t,r)=>{e[t]=BigInt(r)},dO=({stride:e,values:t},r,i)=>{t.set(i.subarray(0,e),e*r)},yW=({values:e,valueOffsets:t},r,i)=>gW(e,t,r,i),vW=({values:e,valueOffsets:t},r,i)=>gW(e,t,r,Jf(i)),pO=(e,t,r)=>{e.type.unit===Os.DAY?WP(e,t,r):HP(e,t,r)},qP=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},ZP=({values:e},t,r)=>{e[t]=BigInt(r)},YP=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},QP=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},AO=(e,t,r)=>{switch(e.type.unit){case Ar.SECOND:return qP(e,t,r);case Ar.MILLISECOND:return ZP(e,t,r);case Ar.MICROSECOND:return YP(e,t,r);case Ar.NANOSECOND:return QP(e,t,r)}},$P=({values:e},t,r)=>{e[t]=r},XP=({values:e},t,r)=>{e[t]=r},KP=({values:e},t,r)=>{e[t]=r},JP=({values:e},t,r)=>{e[t]=r},mO=(e,t,r)=>{switch(e.type.unit){case Ar.SECOND:return $P(e,t,r);case Ar.MILLISECOND:return XP(e,t,r);case Ar.MICROSECOND:return KP(e,t,r);case Ar.NANOSECOND:return JP(e,t,r)}},gO=({values:e,stride:t},r,i)=>{e.set(i.subarray(0,t),t*r)},bht=(e,t,r)=>{let i=e.children[0],s=e.valueOffsets,n=ba.getVisitFn(i);if(Array.isArray(r))for(let o=-1,c=s[t],f=s[t+1];c{let i=e.children[0],{valueOffsets:s}=e,n=ba.getVisitFn(i),{[t]:o,[t+1]:c}=s,f=r instanceof Map?r.entries():Object.entries(r);for(let _ of f)if(n(i,o,_),++o>=c)break},Sht=(e,t)=>(r,i,s,n)=>i&&r(i,e,t[n]),Tht=(e,t)=>(r,i,s,n)=>i&&r(i,e,t.get(n)),Mht=(e,t)=>(r,i,s,n)=>i&&r(i,e,t.get(s.name)),Eht=(e,t)=>(r,i,s,n)=>i&&r(i,e,t[s.name]),Pht=(e,t,r)=>{let i=e.type.children.map(n=>ba.getVisitFn(n.type)),s=r instanceof Map?Mht(t,r):r instanceof xr?Tht(t,r):Array.isArray(r)?Sht(t,r):Eht(t,r);e.type.children.forEach((n,o)=>s(i[o],e.children[o],n,o))},Iht=(e,t,r)=>{e.type.mode===Pn.Dense?xW(e,t,r):bW(e,t,r)},xW=(e,t,r)=>{let i=e.type.typeIdToChildIndex[e.typeIds[t]],s=e.children[i];ba.visit(s,e.valueOffsets[t],r)},bW=(e,t,r)=>{let i=e.type.typeIdToChildIndex[e.typeIds[t]],s=e.children[i];ba.visit(s,t,r)},Cht=(e,t,r)=>{var i;(i=e.dictionary)===null||i===void 0||i.set(e.values[t],r)},_O=(e,t,r)=>{e.type.unit===Bo.DAY_TIME?t3(e,t,r):e3(e,t,r)},t3=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},e3=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},r3=({values:e},t,r)=>{e[t]=r},i3=({values:e},t,r)=>{e[t]=r},n3=({values:e},t,r)=>{e[t]=r},s3=({values:e},t,r)=>{e[t]=r},yO=(e,t,r)=>{switch(e.type.unit){case Ar.SECOND:return r3(e,t,r);case Ar.MILLISECOND:return i3(e,t,r);case Ar.MICROSECOND:return n3(e,t,r);case Ar.NANOSECOND:return s3(e,t,r)}},Lht=(e,t,r)=>{let{stride:i}=e,s=e.children[0],n=ba.getVisitFn(s);if(Array.isArray(r))for(let o=-1,c=t*i;++o`${Jh(t)}: ${Jh(r)}`).join(\", \")}}`}[Symbol.for(\"nodejs.util.inspect.custom\")](){return this.toString()}[Symbol.iterator](){return new vO(this[rf],this[_v])}},vO=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return tr.name)}has(t,r){return t[rf].type.children.findIndex(i=>i.name===r)!==-1}getOwnPropertyDescriptor(t,r){if(t[rf].type.children.findIndex(i=>i.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let i=t[rf].type.children.findIndex(s=>s.name===r);if(i!==-1){let s=go.visit(t[rf].children[i],t[_v]);return Reflect.set(t,r,s),s}}set(t,r,i){let s=t[rf].type.children.findIndex(n=>n.name===r);return s!==-1?(ba.visit(t[rf].children[s],t[_v],i),Reflect.set(t,r,i)):Reflect.has(t,r)||typeof r==\"symbol\"?Reflect.set(t,r,i):!1}};var Pr=class extends Er{};function zr(e){return(t,r)=>t.getValid(r)?e(t,r):null}var kht=(e,t)=>864e5*e[t],Rht=(e,t)=>null,wW=(e,t,r)=>{if(r+1>=t.length)return null;let i=Wi(t[r]),s=Wi(t[r+1]);return e.subarray(i,s)},Dht=({offset:e,values:t},r)=>{let i=e+r;return(t[i>>3]&1<kht(e,t),TW=({values:e},t)=>Wi(e[t]),fm=({stride:e,values:t},r)=>t[e*r],Oht=({stride:e,values:t},r)=>GP(t[e*r]),MW=({values:e},t)=>e[t],Bht=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),EW=({values:e,valueOffsets:t},r)=>wW(e,t,r),PW=({values:e,valueOffsets:t},r)=>{let i=wW(e,t,r);return i!==null?Tw(i):null},Fht=({values:e},t)=>e[t],zht=({type:e,values:t},r)=>e.precision!==$i.HALF?t[r]:GP(t[r]),Nht=(e,t)=>e.type.unit===Os.DAY?SW(e,t):TW(e,t),IW=({values:e},t)=>1e3*Wi(e[t]),CW=({values:e},t)=>Wi(e[t]),LW=({values:e},t)=>aO(e[t],BigInt(1e3)),kW=({values:e},t)=>aO(e[t],BigInt(1e6)),Uht=(e,t)=>{switch(e.type.unit){case Ar.SECOND:return IW(e,t);case Ar.MILLISECOND:return CW(e,t);case Ar.MICROSECOND:return LW(e,t);case Ar.NANOSECOND:return kW(e,t)}},RW=({values:e},t)=>e[t],DW=({values:e},t)=>e[t],OW=({values:e},t)=>e[t],BW=({values:e},t)=>e[t],Vht=(e,t)=>{switch(e.type.unit){case Ar.SECOND:return RW(e,t);case Ar.MILLISECOND:return DW(e,t);case Ar.MICROSECOND:return OW(e,t);case Ar.NANOSECOND:return BW(e,t)}},jht=({values:e,stride:t},r)=>Vw.decimal(e.subarray(t*r,t*(r+1))),Ght=(e,t)=>{let{valueOffsets:r,stride:i,children:s}=e,{[t*i]:n,[t*i+1]:o}=r,f=s[0].slice(n,o-n);return new xr([f])},Wht=(e,t)=>{let{valueOffsets:r,children:i}=e,{[t]:s,[t+1]:n}=r,o=i[0];return new od(o.slice(s,n-s))},Hht=(e,t)=>new hm(e,t),qht=(e,t)=>e.type.mode===Pn.Dense?FW(e,t):zW(e,t),FW=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];return go.visit(i,e.valueOffsets[t])},zW=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];return go.visit(i,t)},Zht=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},Yht=(e,t)=>e.type.unit===Bo.DAY_TIME?NW(e,t):UW(e,t),NW=({values:e},t)=>e.subarray(2*t,2*(t+1)),UW=({values:e},t)=>{let r=e[t],i=new Int32Array(2);return i[0]=Math.trunc(r/12),i[1]=Math.trunc(r%12),i},VW=({values:e},t)=>e[t],jW=({values:e},t)=>e[t],GW=({values:e},t)=>e[t],WW=({values:e},t)=>e[t],Qht=(e,t)=>{switch(e.type.unit){case Ar.SECOND:return VW(e,t);case Ar.MILLISECOND:return jW(e,t);case Ar.MICROSECOND:return GW(e,t);case Ar.NANOSECOND:return WW(e,t)}},$ht=(e,t)=>{let{stride:r,children:i}=e,n=i[0].slice(t*r,r);return new xr([n])};Pr.prototype.visitNull=zr(Rht);Pr.prototype.visitBool=zr(Dht);Pr.prototype.visitInt=zr(Fht);Pr.prototype.visitInt8=zr(fm);Pr.prototype.visitInt16=zr(fm);Pr.prototype.visitInt32=zr(fm);Pr.prototype.visitInt64=zr(MW);Pr.prototype.visitUint8=zr(fm);Pr.prototype.visitUint16=zr(fm);Pr.prototype.visitUint32=zr(fm);Pr.prototype.visitUint64=zr(MW);Pr.prototype.visitFloat=zr(zht);Pr.prototype.visitFloat16=zr(Oht);Pr.prototype.visitFloat32=zr(fm);Pr.prototype.visitFloat64=zr(fm);Pr.prototype.visitUtf8=zr(PW);Pr.prototype.visitLargeUtf8=zr(PW);Pr.prototype.visitBinary=zr(EW);Pr.prototype.visitLargeBinary=zr(EW);Pr.prototype.visitFixedSizeBinary=zr(Bht);Pr.prototype.visitDate=zr(Nht);Pr.prototype.visitDateDay=zr(SW);Pr.prototype.visitDateMillisecond=zr(TW);Pr.prototype.visitTimestamp=zr(Uht);Pr.prototype.visitTimestampSecond=zr(IW);Pr.prototype.visitTimestampMillisecond=zr(CW);Pr.prototype.visitTimestampMicrosecond=zr(LW);Pr.prototype.visitTimestampNanosecond=zr(kW);Pr.prototype.visitTime=zr(Vht);Pr.prototype.visitTimeSecond=zr(RW);Pr.prototype.visitTimeMillisecond=zr(DW);Pr.prototype.visitTimeMicrosecond=zr(OW);Pr.prototype.visitTimeNanosecond=zr(BW);Pr.prototype.visitDecimal=zr(jht);Pr.prototype.visitList=zr(Ght);Pr.prototype.visitStruct=zr(Hht);Pr.prototype.visitUnion=zr(qht);Pr.prototype.visitDenseUnion=zr(FW);Pr.prototype.visitSparseUnion=zr(zW);Pr.prototype.visitDictionary=zr(Zht);Pr.prototype.visitInterval=zr(Yht);Pr.prototype.visitIntervalDayTime=zr(NW);Pr.prototype.visitIntervalYearMonth=zr(UW);Pr.prototype.visitDuration=zr(Qht);Pr.prototype.visitDurationSecond=zr(VW);Pr.prototype.visitDurationMillisecond=zr(jW);Pr.prototype.visitDurationMicrosecond=zr(GW);Pr.prototype.visitDurationNanosecond=zr(WW);Pr.prototype.visitFixedSizeList=zr($ht);Pr.prototype.visitMap=zr(Wht);var go=new Pr;var dm=Symbol.for(\"keys\"),vv=Symbol.for(\"vals\"),yv=Symbol.for(\"kKeysAsStrings\"),bO=Symbol.for(\"_kKeysAsStrings\"),od=class{constructor(t){return this[dm]=new xr([t.children[0]]).memoize(),this[vv]=t.children[1],new Proxy(this,new SO)}get[yv](){return this[bO]||(this[bO]=Array.from(this[dm].toArray(),String))}[Symbol.iterator](){return new wO(this[dm],this[vv])}get size(){return this[dm].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[dm],r=this[vv],i={};for(let s=-1,n=t.length;++s`${Jh(t)}: ${Jh(r)}`).join(\", \")}}`}[Symbol.for(\"nodejs.util.inspect.custom\")](){return this.toString()}},wO=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),go.visit(this.vals,t)]})}},SO=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[yv]}has(t,r){return t[yv].includes(r)}getOwnPropertyDescriptor(t,r){if(t[yv].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let i=t[yv].indexOf(r);if(i!==-1){let s=go.visit(Reflect.get(t,vv),i);return Reflect.set(t,r,s),s}}set(t,r,i){let s=t[yv].indexOf(r);return s!==-1?(ba.visit(Reflect.get(t,vv),s,i),Reflect.set(t,r,i)):Reflect.has(t,r)?Reflect.set(t,r,i):!1}};Object.defineProperties(od.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:\"Row\"},[dm]:{writable:!0,enumerable:!1,configurable:!1,value:null},[vv]:{writable:!0,enumerable:!1,configurable:!1,value:null},[bO]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var HW;function Kw(e,t,r,i){let{length:s=0}=e,n=typeof t!=\"number\"?0:t,o=typeof r!=\"number\"?s:r;return n<0&&(n=(n%s+s)%s),o<0&&(o=(o%s+s)%s),os&&(o=s),i?i(e,n,o):[n,o]}var xg=(e,t)=>e<0?t+e:e,qW=e=>e!==e;function pm(e){if(typeof e!==\"object\"||e===null)return qW(e)?qW:r=>r===e;if(e instanceof Date){let r=e.valueOf();return i=>i instanceof Date?i.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?rO(e,r):!1:e instanceof Map?Kht(e):Array.isArray(e)?Xht(e):e instanceof xr?Jht(e):tft(e,!0)}function Xht(e){let t=[];for(let r=-1,i=e.length;++r!1;let i=[];for(let s=-1,n=r.length;++s{if(!r||typeof r!=\"object\")return!1;switch(r.constructor){case Array:return eft(e,r);case Map:return ZW(e,r,r.keys());case od:case hm:case Object:case void 0:return ZW(e,r,t||Object.keys(r))}return r instanceof xr?rft(e,r):!1}}function eft(e,t){let r=e.length;if(t.length!==r)return!1;for(let i=-1;++ibg,getBit:()=>YW,getBool:()=>l3,packBools:()=>Sg,popcnt_array:()=>QW,popcnt_bit_range:()=>Jw,popcnt_uint32:()=>a3,setBool:()=>ift,truncateBitmap:()=>wg});function l3(e,t,r,i){return(r&1<>i}function ift(e,t,r){return r?!!(e[t>>3]|=1<>3]&=~(1<0||r.byteLength>3):Sg(new bg(r,e,t,null,l3)).subarray(0,i)),s}return r}function Sg(e){let t=[],r=0,i=0,s=0;for(let o of e)o&&(s|=1<0)&&(t[r++]=s);let n=new Uint8Array(t.length+7&-8);return n.set(t),n}var bg=class{constructor(t,r,i,s,n){this.bytes=t,this.length=i,this.context=s,this.get=n,this.bit=r%8,this.byteIndex=r>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index>3<<3,s=t+(t%8===0?0:8-t%8);return Jw(e,t,s)+Jw(e,i,r)+QW(e,s>>3,i-s>>3)}function QW(e,t,r){let i=0,s=Math.trunc(t),n=new DataView(e.buffer,e.byteOffset,e.byteLength),o=r===void 0?e.byteLength:s+r;for(;o-s>=4;)i+=a3(n.getUint32(s)),s+=4;for(;o-s>=2;)i+=a3(n.getUint16(s)),s+=2;for(;o-s>=1;)i+=a3(n.getUint8(s)),s+=1;return i}function a3(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var nft=-1,Fi=class e{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return ze.isSparseUnion(t)?this.children.some(r=>r.nullable):ze.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:i,nullBitmap:s,typeIds:n}=this;return r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),n&&(t+=n.byteLength),this.children.reduce((o,c)=>o+c.byteLength,t)}get nullCount(){if(ze.isUnion(this.type))return this.children.reduce((i,s)=>i+s.nullCount,0);let t=this._nullCount,r;return t<=nft&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-Jw(r,this.offset,this.offset+this.length)),t}constructor(t,r,i,s,n,o=[],c){this.type=t,this.children=o,this.dictionary=c,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(i||0,0)),this._nullCount=Math.floor(Math.max(s||0,-1));let f;n instanceof e?(this.stride=n.stride,this.values=n.values,this.typeIds=n.typeIds,this.nullBitmap=n.nullBitmap,this.valueOffsets=n.valueOffsets):(this.stride=ou(t),n&&((f=n[0])&&(this.valueOffsets=f),(f=n[1])&&(this.values=f),(f=n[2])&&(this.nullBitmap=f),(f=n[3])&&(this.typeIds=f)))}getValid(t){let{type:r}=this;if(ze.isUnion(r)){let i=r,s=this.children[i.typeIdToChildIndex[this.typeIds[t]]],n=i.mode===Pn.Dense?this.valueOffsets[t]:t;return s.getValid(n)}if(this.nullable&&this.nullCount>0){let i=this.offset+t;return(this.nullBitmap[i>>3]&1<>3;(!n||n.byteLength<=w)&&(n=new Uint8Array((o+c+63&-64)>>3).fill(255),this.nullCount>0?(n.set(wg(o,c,this.nullBitmap),0),Object.assign(this,{nullBitmap:n})):Object.assign(this,{nullBitmap:n,_nullCount:0}));let I=n[w];i=(I&_)!==0,n[w]=r?I|_:I&~_}return i!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,i=this.length,s=this._nullCount,n=this,o=this.children){return new e(t,r,i,s,n,o,this.dictionary)}slice(t,r){let{stride:i,typeId:s,children:n}=this,o=+(this._nullCount===0)-1,c=s===16?i:1,f=this._sliceBuffers(t,r,i,s);return this.clone(this.type,this.offset+t,r,o,f,n.length===0||this.valueOffsets?n:this._sliceChildren(n,c*t,c*r))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===Ot.Null)return this.clone(this.type,0,t,0);let{length:r,nullCount:i}=this,s=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);s[r>>3]=(1<0&&s.set(wg(this.offset,r,this.nullBitmap),0);let n=this.buffers;return n[Oi.VALIDITY]=s,this.clone(this.type,0,t,i+(t-r),n)}_sliceBuffers(t,r,i,s){let n,{buffers:o}=this;return(n=o[Oi.TYPE])&&(o[Oi.TYPE]=n.subarray(t,t+r)),(n=o[Oi.OFFSET])&&(o[Oi.OFFSET]=n.subarray(t,t+r+1))||(n=o[Oi.DATA])&&(o[Oi.DATA]=s===6?n:n.subarray(i*t,i*(t+r))),o}_sliceChildren(t,r,i){return t.map(s=>s.slice(r,i))}};Fi.prototype.children=Object.freeze([]);var EO=class e extends Er{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"length\"]:s=0}=t;return new Fi(r,i,s,s)}visitBool(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length>>3,[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitInt(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length,[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitFloat(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length,[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitUtf8(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.data),n=Rr(t.nullBitmap),o=yg(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:f=t.nullBitmap?-1:0}=t;return new Fi(r,i,c,f,[o,s,n])}visitLargeUtf8(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.data),n=Rr(t.nullBitmap),o=BP(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:f=t.nullBitmap?-1:0}=t;return new Fi(r,i,c,f,[o,s,n])}visitBinary(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.data),n=Rr(t.nullBitmap),o=yg(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:f=t.nullBitmap?-1:0}=t;return new Fi(r,i,c,f,[o,s,n])}visitLargeBinary(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.data),n=Rr(t.nullBitmap),o=BP(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:f=t.nullBitmap?-1:0}=t;return new Fi(r,i,c,f,[o,s,n])}visitFixedSizeBinary(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length/ou(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitDate(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length/ou(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitTimestamp(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length/ou(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitTime(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length/ou(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitDecimal(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length/ou(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitList(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"child\"]:s}=t,n=Rr(t.nullBitmap),o=yg(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:f=t.nullBitmap?-1:0}=t;return new Fi(r,i,c,f,[o,void 0,n],[s])}visitStruct(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"children\"]:s=[]}=t,n=Rr(t.nullBitmap),{length:o=s.reduce((f,{length:_})=>Math.max(f,_),0),nullCount:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,void 0,n],s)}visitUnion(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"children\"]:s=[]}=t,n=Ai(r.ArrayType,t.typeIds),{[\"length\"]:o=n.length,[\"nullCount\"]:c=-1}=t;if(ze.isSparseUnion(r))return new Fi(r,i,o,c,[void 0,void 0,void 0,n],s);let f=yg(t.valueOffsets);return new Fi(r,i,o,c,[f,void 0,void 0,n],s)}visitDictionary(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.indices.ArrayType,t.data),{[\"dictionary\"]:o=new xr([new e().visit({type:r.dictionary})])}=t,{[\"length\"]:c=n.length,[\"nullCount\"]:f=t.nullBitmap?-1:0}=t;return new Fi(r,i,c,f,[void 0,n,s],[],o)}visitInterval(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length/ou(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitDuration(t){let{[\"type\"]:r,[\"offset\"]:i=0}=t,s=Rr(t.nullBitmap),n=Ai(r.ArrayType,t.data),{[\"length\"]:o=n.length,[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,n,s])}visitFixedSizeList(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"child\"]:s=new e().visit({type:r.valueType})}=t,n=Rr(t.nullBitmap),{[\"length\"]:o=s.length/ou(r),[\"nullCount\"]:c=t.nullBitmap?-1:0}=t;return new Fi(r,i,o,c,[void 0,void 0,n],[s])}visitMap(t){let{[\"type\"]:r,[\"offset\"]:i=0,[\"child\"]:s=new e().visit({type:r.childType})}=t,n=Rr(t.nullBitmap),o=yg(t.valueOffsets),{[\"length\"]:c=o.length-1,[\"nullCount\"]:f=t.nullBitmap?-1:0}=t;return new Fi(r,i,c,f,[o,void 0,n],[s])}},sft=new EO;function yr(e){return sft.visit(e)}var t2=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndext.nullable)}function c3(e){return e.reduce((t,r)=>t+r.nullCount,0)}function u3(e){return e.reduce((t,r,i)=>(t[i+1]=t[i]+r.length,t),new Uint32Array(e.length+1))}function h3(e,t,r,i){let s=[];for(let n=-1,o=e.length;++n=i)break;if(r>=f+_)continue;if(f>=r&&f+_<=i){s.push(c);continue}let w=Math.max(0,r-f),I=Math.min(i-f,_);s.push(c.slice(w,I-w))}return s.length===0&&s.push(e[0].slice(0,0)),s}function PO(e,t,r,i){let s=0,n=0,o=t.length-1;do{if(s>=o-1)return r0?0:-1}function aft(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let i=0;for(let s of new bg(r,e.offset+(t||0),e.length,r,l3)){if(!s)return i;++i}return-1}function Qr(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case Ot.Union:break;case Ot.Dictionary:break;default:return aft(e,r)}let i=go.getVisitFn(e),s=pm(t);for(let n=(r||0)-1,o=e.length;++n{let s=e.data[i];return s.values.subarray(0,s.length)[Symbol.iterator]()});let r=0;return new t2(e.data.length,i=>{let n=e.data[i].length,o=e.slice(r,r+n);return r+=n,new IO(o)})}var IO=class{constructor(t){this.vector=t,this.index=0}next(){return this.indexc.data):t;if(n.length===0||n.some(c=>!(c instanceof Fi)))throw new TypeError(\"Vector constructor expects an Array of Data instances.\");let o=(r=n[0])===null||r===void 0?void 0:r.type;switch(n.length){case 0:this._offsets=[0];break;case 1:{let{get:c,set:f,indexOf:_}=JW[o.typeId],w=n[0];this.isValid=I=>e2(w,I),this.get=I=>c(w,I),this.set=(I,R)=>f(w,I,R),this.indexOf=I=>_(w,I),this._offsets=[0,w.length];break}default:Object.setPrototypeOf(this,tH[o.typeId]),this._offsets=u3(n);break}this.data=n,this.type=o,this.stride=ou(o),this.numChildren=(s=(i=o.children)===null||i===void 0?void 0:i.length)!==null&&s!==void 0?s:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return $W(this.data)}get nullCount(){return c3(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${Ot[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(xg(t,this.length))}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return bv.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new e(Kw(this,t,r,({data:i,_offsets:s},n,o)=>h3(i,s,n,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:i,stride:s,ArrayType:n}=this;switch(t.typeId){case Ot.Int:case Ot.Float:case Ot.Decimal:case Ot.Time:case Ot.Timestamp:switch(r.length){case 0:return new n;case 1:return r[0].values.subarray(0,i*s);default:return r.reduce((o,{values:c,length:f})=>(o.array.set(c.subarray(0,f*s),o.offset),o.offset+=f*s,o),{array:new n(i*s),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(\",\")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&tr[t])):null}get isMemoized(){return ze.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(ze.isDictionary(this.type)){let t=new p3(this.data[0].dictionary),r=this.data.map(i=>{let s=i.clone();return s.dictionary=t,s});return new e(r)}return new p3(this)}unmemoize(){if(ze.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(i=>{let s=i.clone();return s.dictionary=t,s});return new e(r)}return this}};KW=Symbol.toStringTag;xr[KW]=(e=>{e.type=ze.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(Ot).map(r=>Ot[r]).filter(r=>typeof r==\"number\"&&r!==Ot.NONE);for(let r of t){let i=go.getVisitFnByTypeId(r),s=ba.getVisitFnByTypeId(r),n=Tg.getVisitFnByTypeId(r);JW[r]={get:i,set:s,indexOf:n},tH[r]=Object.create(e,{isValid:{value:xv(e2)},get:{value:xv(go.getVisitFnByTypeId(r))},set:{value:f3(ba.getVisitFnByTypeId(r))},indexOf:{value:d3(Tg.getVisitFnByTypeId(r))}})}return\"Vector\"})(xr.prototype);var p3=class e extends xr{constructor(t){super(t.data);let r=this.get,i=this.set,s=this.slice,n=new Array(this.length);Object.defineProperty(this,\"get\",{value(o){let c=n[o];if(c!==void 0)return c;let f=r.call(this,o);return n[o]=f,f}}),Object.defineProperty(this,\"set\",{value(o,c){i.call(this,o,c),n[o]=c}}),Object.defineProperty(this,\"slice\",{value:(o,c)=>new e(s.call(this,o,c))}),Object.defineProperty(this,\"isMemoized\",{value:!0}),Object.defineProperty(this,\"unmemoize\",{value:()=>new xr(this.data)}),Object.defineProperty(this,\"memoize\",{value:()=>this})}};function eH(e){if(!e||e.length<=0)return function(s){return!0};let t=\"\",r=e.filter(i=>i===i);return r.length>0&&(t=`\n switch (x) {${r.map(i=>`\n case ${lft(i)}:`).join(\"\")}\n return false;\n }`),e.length!==r.length&&(t=`if (x !== x) return false;\n${t}`),new Function(\"x\",`${t}\nreturn true;`)}function lft(e){return typeof e!=\"bigint\"?Jh(e):`${Jh(e)}n`}function CO(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function rH(e,t=0){return e.length>=t?e.subarray(0,t):Ew(new e.constructor(t),e,0)}var nf=class{constructor(t,r=0,i=1){this.length=Math.ceil(r/i),this.buffer=new t(this.length),this.stride=i,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,i=this.length*r,s=this.buffer.length;i>=s&&this._resize(s===0?CO(i*1,this.BYTES_PER_ELEMENT):CO(i*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=CO(t*this.stride,this.BYTES_PER_ELEMENT);let r=rH(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=rH(this.buffer,t)}},gp=class extends nf{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},wv=class extends gp{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:i}=this.reserve(t-this.length+1),s=t>>3,n=t%8,o=i[s]>>n&1;return r?o===0&&(i[s]|=1<=0&&s.fill(s[i],i,t),s[t]=s[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var Xn=class{static throughNode(t){throw new Error('\"throughNode\" not available in this environment')}static throughDOM(t){throw new Error('\"throughDOM\" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=ou(t),this._nulls=new wv,r&&r.length>0&&(this._isValid=eH(r))}toVector(){return new xr([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:i,_nulls:s,_typeIds:n,children:o}=this;return r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),n&&(t+=n.byteLength),o.reduce((c,f)=>c+f.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,i)=>r+i.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type \"${this.type}\"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,i,s,{type:n,length:o,nullCount:c,_typeIds:f,_offsets:_,_values:w,_nulls:I}=this;(r=f?.flush(o))?s=_?.flush(o):(s=_?.flush(o))?t=w?.flush(_.last()):t=w?.flush(o),c>0&&(i=I?.flush(o));let R=this.children.map(N=>N.flush());return this.clear(),yr({type:n,length:o,nullCount:c,children:R,child:R[0],data:t,typeIds:r,nullBitmap:i,valueOffsets:s})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,i,s;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(i=this._offsets)===null||i===void 0||i.clear(),(s=this._typeIds)===null||s===void 0||s.clear();for(let n of this.children)n.clear();return this}};Xn.prototype.length=1;Xn.prototype.stride=1;Xn.prototype.children=null;Xn.prototype.finished=!1;Xn.prototype.nullValues=null;Xn.prototype._isValid=()=>!0;var _o=class extends Xn{constructor(t){super(t),this._values=new gp(this.ArrayType,0,this.stride)}setValue(t,r){let i=this._values;return i.reserve(t-i.length+1),super.setValue(t,r)}},gc=class extends Xn{constructor(t){super(t),this._pendingLength=0,this._offsets=new Sv(t.type)}setValue(t,r){let i=this._pending||(this._pending=new Map),s=i.get(t);s&&(this._pendingLength-=s.length),this._pendingLength+=r instanceof od?r[dm].length:r.length,i.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}};var Mg=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,r,i,s){return t.prep(8,24),t.writeInt64(BigInt(s??0)),t.pad(4),t.writeInt32(i),t.writeInt64(BigInt(r??0)),t.offset()}};var au=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):sn.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new fc).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new Mg).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let i=this.bb.__offset(this.bb_pos,10);return i?(r||new Mg).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new Fo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,sn.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}};var an=class e{constructor(t=[],r,i,s=sn.V5){this.fields=t||[],this.metadata=r||new Map,i||(i=LO(t)),this.dictionaries=i,this.metadataVersion=s}get[Symbol.toStringTag](){return\"Schema\"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(\", \")} }>`}select(t){let r=new Set(t),i=this.fields.filter(s=>r.has(s.name));return new e(i,this.metadata)}selectAt(t){let r=t.map(i=>this.fields[i]).filter(Boolean);return new e(r,this.metadata)}assign(...t){let r=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),i=[...this.fields],s=A3(A3(new Map,this.metadata),r.metadata),n=r.fields.filter(c=>{let f=i.findIndex(_=>_.name===c.name);return~f?(i[f]=c.clone({metadata:A3(A3(new Map,i[f].metadata),c.metadata)}))&&!1:!0}),o=LO(n,new Map);return new e([...i,...n],s,new Map([...this.dictionaries,...o]))}};an.prototype.fields=null;an.prototype.metadata=null;an.prototype.dictionaries=null;var si=class e{static new(...t){let[r,i,s,n]=t;return t[0]&&typeof t[0]==\"object\"&&({name:r}=t[0],i===void 0&&(i=t[0].type),s===void 0&&(s=t[0].nullable),n===void 0&&(n=t[0].metadata)),new e(`${r}`,i,s,n)}constructor(t,r,i=!1,s){this.name=t,this.type=r,this.nullable=i,this.metadata=s||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return\"Field\"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,i,s,n]=t;return!t[0]||typeof t[0]!=\"object\"?[r=this.name,i=this.type,s=this.nullable,n=this.metadata]=t:{name:r=this.name,type:i=this.type,nullable:s=this.nullable,metadata:n=this.metadata}=t[0],e.new(r,i,s,n)}};si.prototype.type=null;si.prototype.name=null;si.prototype.nullable=null;si.prototype.metadata=null;function A3(e,t){return new Map([...e||new Map,...t||new Map])}function LO(e,t=new Map){for(let r=-1,i=e.length;++r0&&LO(n.children,t)}return t}var cft=vg,uft=nu,_p=class{static decode(t){t=new uft(Rr(t));let r=au.getRootAsFooter(t),i=an.decode(r.schema(),new Map,r.version());return new kO(i,r)}static encode(t){let r=new cft,i=an.encode(r,t.schema);au.startRecordBatchesVector(r,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())yp.encode(r,o);let s=r.endVector();au.startDictionariesVector(r,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())yp.encode(r,o);let n=r.endVector();return au.startFooter(r),au.addSchema(r,i),au.addVersion(r,sn.V5),au.addRecordBatches(r,s),au.addDictionaries(r,n),au.finishFooterBuffer(r,au.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=sn.V5,i,s){this.schema=t,this.version=r,i&&(this._recordBatches=i),s&&(this._dictionaryBatches=s)}*recordBatches(){for(let t,r=-1,i=this.numRecordBatches;++r=0&&t=0&&t=0&&t=0&&tthis._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return ar(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(Vn);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return xa.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return xa.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return ar(this,void 0,void 0,function*(){return yield this.abort(t),Vn})}return(t){return ar(this,void 0,void 0,function*(){return yield this.close(),Vn})}read(t){return ar(this,void 0,void 0,function*(){return(yield this.next(t,\"read\")).value})}peek(t){return ar(this,void 0,void 0,function*(){return(yield this.next(t,\"peek\")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,i)=>{this.resolvers.push({resolve:r,reject:i})}):Promise.resolve(Vn)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error(\"AsyncQueue is closed\")}};var ad=class extends m3{write(t){if((t=Rr(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Tw(this.toUint8Array(!0)):this.toUint8Array(!1).then(Tw)}toUint8Array(t=!1){return t?iu(this._values)[0]:ar(this,void 0,void 0,function*(){var r,i,s,n;let o=[],c=0;try{for(var f=!0,_=Zh(this),w;w=yield _.next(),r=w.done,!r;f=!0){n=w.value,f=!1;let I=n;o.push(I),c+=I.byteLength}}catch(I){i={error:I}}finally{try{!f&&!r&&(s=_.return)&&(yield s.call(_))}finally{if(i)throw i.error}}return iu(o,c)[0]})}},ld=class{constructor(t){t&&(this.source=new RO(xa.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},$u=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof ad?this.source=new vp(xa.fromAsyncIterable(t)):OP(t)?this.source=new vp(xa.fromNodeStream(t)):Mw(t)?this.source=new vp(xa.fromDOMStream(t)):RP(t)?this.source=new vp(xa.fromDOMStream(t.body)):Yh(t)?this.source=new vp(xa.fromIterable(t)):ru(t)?this.source=new vp(xa.fromAsyncIterable(t)):Nu(t)&&(this.source=new vp(xa.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},RO=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,\"peek\").value}read(t){return this.next(t,\"read\").value}next(t,r=\"read\"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||Vn)}return(t){return Object.create(this.source.return&&this.source.return(t)||Vn)}},vp=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return ar(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return ar(this,void 0,void 0,function*(){return(yield this.next(t,\"read\")).value})}peek(t){return ar(this,void 0,void 0,function*(){return(yield this.next(t,\"peek\")).value})}next(t){return ar(this,arguments,void 0,function*(r,i=\"read\"){return yield this.source.next({cmd:i,size:r})})}throw(t){return ar(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||Vn;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return ar(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||Vn;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}};var i2=class extends ld{constructor(t,r){super(),this.position=0,this.buffer=Rr(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:i}=this.readAt(t,4);return new DataView(r,i).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),tn2,Int128:()=>s2,Int64:()=>xp,Uint64:()=>gs});function Tv(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var Mv=8,DO=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],n2=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),i=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),s=r[3]*i[3];this.buffer[0]=s&65535;let n=s>>>16;return s=r[2]*i[3],n+=s,s=r[3]*i[2]>>>0,n+=s,this.buffer[0]+=n<<16,this.buffer[1]=n>>>0>>16,this.buffer[1]+=r[1]*i[3]+r[2]*i[2]+r[3]*i[1],this.buffer[1]+=r[0]*i[3]+r[1]*i[2]+r[2]*i[1]+r[3]*i[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(t){return this.buffer[1]>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]>>0&&++r[1],r[1]>>0&&++r[2],r[2]>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${Tv(this.buffer[3])} ${Tv(this.buffer[2])} ${Tv(this.buffer[1])} ${Tv(this.buffer[0])}`}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return e.fromString(typeof t==\"string\"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let i=t.startsWith(\"-\"),s=t.length,n=new e(r);for(let o=i?1:0;o0&&this.readData(t,i)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:i}=this.nextBufferRange()){return this.bytes.subarray(i,i+r)}readDictionary(t){return this.dictionaries.get(t.id)}},g3=class extends o2{constructor(t,r,i,s,n){super(new Uint8Array(0),r,i,s,n),this.sources=t}readNullBitmap(t,r,{offset:i}=this.nextBufferRange()){return r<=0?new Uint8Array(0):Sg(this.sources[i])}readOffsets(t,{offset:r}=this.nextBufferRange()){return Ai(Uint8Array,Ai(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return Ai(Uint8Array,Ai(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:i}=this;return ze.isTimestamp(t)?Ai(Uint8Array,xp.convertArray(i[r])):(ze.isInt(t)||ze.isTime(t))&&t.bitWidth===64||ze.isDuration(t)?Ai(Uint8Array,xp.convertArray(i[r])):ze.isDate(t)&&t.unit===Os.MILLISECOND?Ai(Uint8Array,xp.convertArray(i[r])):ze.isDecimal(t)?Ai(Uint8Array,s2.convertArray(i[r])):ze.isBinary(t)||ze.isLargeBinary(t)||ze.isFixedSizeBinary(t)?hft(i[r]):ze.isBool(t)?Sg(i[r]):ze.isUtf8(t)||ze.isLargeUtf8(t)?Jf(i[r].join(\"\")):Ai(Uint8Array,Ai(t.ArrayType,i[r].map(s=>+s)))}};function hft(e){let t=e.join(\"\"),r=new Uint8Array(t.length/2);for(let i=0;i>1]=Number.parseInt(t.slice(i,i+2),16);return r}var Pg=class extends gc{constructor(t){super(t),this._values=new nf(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Rr(r))}_flushPending(t,r){let i=this._offsets,s=this._values.reserve(r).buffer,n=0;for(let[o,c]of t)if(c===void 0)i.set(o,0);else{let f=c.length;s.set(c,n),i.set(o,f),n+=f}}};var Ig=class extends gc{constructor(t){super(t),this._values=new nf(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Rr(r))}_flushPending(t,r){let i=this._offsets,s=this._values.reserve(r).buffer,n=0;for(let[o,c]of t)if(c===void 0)i.set(o,BigInt(0));else{let f=c.length;s.set(c,n),i.set(o,BigInt(f)),n+=f}}};var mm=class extends Xn{constructor(t){super(t),this._values=new wv}setValue(t,r){this._values.set(t,+r)}};var gm=class extends _o{};gm.prototype._setValue=pO;var Ev=class extends gm{};Ev.prototype._setValue=WP;var Pv=class extends gm{};Pv.prototype._setValue=HP;var Iv=class extends _o{};Iv.prototype._setValue=gO;var a2=class extends Xn{constructor({type:t,nullValues:r,dictionaryHashFunction:i}){super({type:new mc(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Cg({type:this.type.indices,nullValues:r}),this.dictionary=Cg({type:this.type.dictionary,nullValues:null}),typeof i==\"function\"&&(this.valueToKey=i)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let i=this.indices;return r=i.setValid(t,r),this.length=i.length,r}setValue(t,r){let i=this._keysToIndices,s=this.valueToKey(r),n=i[s];return n===void 0&&(i[s]=n=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,n)}flush(){let t=this.type,r=this._dictionary,i=this.dictionary.toVector(),s=this.indices.flush().clone(t);return s.dictionary=r?r.concat(i):i,this.finished||(this._dictionaryOffset+=i.length),this._dictionary=s.dictionary,this.clear(),s}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t==\"string\"?t:`${t}`}};var Cv=class extends _o{};Cv.prototype._setValue=dO;var l2=class extends Xn{setValue(t,r){let[i]=this.children,s=t*this.stride;for(let n=-1,o=r.length;++n0)throw new Error(\"FixedSizeListBuilder can only have one child.\");let i=this.children.push(t);return this.type=new Ll(this.type.listSize,new si(r,t.type,!0)),i}};var _m=class extends _o{setValue(t,r){this._values.set(t,r)}},c2=class extends _m{setValue(t,r){super.setValue(t,Xw(r))}},u2=class extends _m{},h2=class extends _m{};var ym=class extends _o{};ym.prototype._setValue=_O;var Lv=class extends ym{};Lv.prototype._setValue=t3;var kv=class extends ym{};kv.prototype._setValue=e3;var cd=class extends _o{};cd.prototype._setValue=yO;var Rv=class extends cd{};Rv.prototype._setValue=r3;var Dv=class extends cd{};Dv.prototype._setValue=i3;var Ov=class extends cd{};Ov.prototype._setValue=n3;var Bv=class extends cd{};Bv.prototype._setValue=s3;var lu=class extends _o{setValue(t,r){this._values.set(t,r)}},f2=class extends lu{},d2=class extends lu{},p2=class extends lu{},A2=class extends lu{},m2=class extends lu{},g2=class extends lu{},_2=class extends lu{},y2=class extends lu{};var v2=class extends gc{constructor(t){super(t),this._offsets=new Sv(t.type)}addChild(t,r=\"0\"){if(this.numChildren>0)throw new Error(\"ListBuilder can only have one child.\");return this.children[this.numChildren]=t,this.type=new sl(new si(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[i]=this.children;for(let[s,n]of t)if(typeof n>\"u\")r.set(s,0);else{let o=n,c=o.length,f=r.set(s,c).buffer[s];for(let _=-1;++_0)throw new Error(\"ListBuilder can only have one child.\");return this.children[this.numChildren]=t,this.type=new Ac(new si(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[i]=this.children;for(let[s,n]of t)if(n===void 0)r.set(s,0);else{let{[s]:o,[s+1]:c}=r.set(s,n.size).buffer;for(let f of n.entries())if(i.set(o,f),++o>=c)break}}};var b2=class extends Xn{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var w2=class extends Xn{setValue(t,r){let{children:i,type:s}=this;switch(Array.isArray(r)||r.constructor){case!0:return s.children.forEach((n,o)=>i[o].set(t,r[o]));case Map:return s.children.forEach((n,o)=>i[o].set(t,r.get(n.name)));default:return s.children.forEach((n,o)=>i[o].set(t,r[n.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(i=>i.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let i=this.children.push(t);return this.type=new pn([...this.type.children,new si(r,t.type,!0)]),i}};var ud=class extends _o{};ud.prototype._setValue=AO;var Fv=class extends ud{};Fv.prototype._setValue=qP;var zv=class extends ud{};zv.prototype._setValue=ZP;var Nv=class extends ud{};Nv.prototype._setValue=YP;var Uv=class extends ud{};Uv.prototype._setValue=QP;var hd=class extends _o{};hd.prototype._setValue=mO;var Vv=class extends hd{};Vv.prototype._setValue=$P;var jv=class extends hd{};jv.prototype._setValue=XP;var Gv=class extends hd{};Gv.prototype._setValue=KP;var Wv=class extends hd{};Wv.prototype._setValue=JP;var Lg=class extends Xn{constructor(t){super(t),this._typeIds=new gp(Int8Array,0,1),typeof t.valueToChildTypeId==\"function\"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,i){return i===void 0&&(i=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,i),this}setValue(t,r,i){this._typeIds.set(t,i);let s=this.type.typeIdToChildIndex[i],n=this.children[s];n?.set(t,r)}addChild(t,r=`${this.children.length}`){let i=this.children.push(t),{type:{children:s,mode:n,typeIds:o}}=this,c=[...s,new si(r,t.type)];return this.type=new pc(n,[...o,i],c),i}_valueToChildTypeId(t,r,i){throw new Error(\"Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.\")}},S2=class extends Lg{},T2=class extends Lg{constructor(t){super(t),this._offsets=new gp(Int32Array)}setValue(t,r,i){let s=this._typeIds.set(t,i).buffer[t],n=this.getChildAt(this.type.typeIdToChildIndex[s]),o=this._offsets.set(t,n.length).buffer[t];n?.set(o,r)}};var Hv=class extends gc{constructor(t){super(t),this._values=new nf(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Jf(r))}_flushPending(t,r){}};Hv.prototype._flushPending=Pg.prototype._flushPending;var qv=class extends gc{constructor(t){super(t),this._values=new nf(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Jf(r))}_flushPending(t,r){}};qv.prototype._flushPending=Ig.prototype._flushPending;var BO=class extends Er{visitNull(){return b2}visitBool(){return mm}visitInt(){return lu}visitInt8(){return f2}visitInt16(){return d2}visitInt32(){return p2}visitInt64(){return A2}visitUint8(){return m2}visitUint16(){return g2}visitUint32(){return _2}visitUint64(){return y2}visitFloat(){return _m}visitFloat16(){return c2}visitFloat32(){return u2}visitFloat64(){return h2}visitUtf8(){return Hv}visitLargeUtf8(){return qv}visitBinary(){return Pg}visitLargeBinary(){return Ig}visitFixedSizeBinary(){return Cv}visitDate(){return gm}visitDateDay(){return Ev}visitDateMillisecond(){return Pv}visitTimestamp(){return ud}visitTimestampSecond(){return Fv}visitTimestampMillisecond(){return zv}visitTimestampMicrosecond(){return Nv}visitTimestampNanosecond(){return Uv}visitTime(){return hd}visitTimeSecond(){return Vv}visitTimeMillisecond(){return jv}visitTimeMicrosecond(){return Gv}visitTimeNanosecond(){return Wv}visitDecimal(){return Iv}visitList(){return v2}visitStruct(){return w2}visitUnion(){return Lg}visitDenseUnion(){return T2}visitSparseUnion(){return S2}visitDictionary(){return a2}visitInterval(){return ym}visitIntervalDayTime(){return Lv}visitIntervalYearMonth(){return kv}visitDuration(){return cd}visitDurationSecond(){return Rv}visitDurationMillisecond(){return Dv}visitDurationMicrosecond(){return Ov}visitDurationNanosecond(){return Bv}visitFixedSizeList(){return l2}visitMap(){return x2}},iH=new BO;var Lr=class extends Er{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((i,s)=>this.compareFields(i,r[s]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};function kl(e,t){return t instanceof e.constructor}function kg(e,t){return e===t||kl(e,t)}function bp(e,t){return e===t||kl(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function _3(e,t){return e===t||kl(e,t)&&e.precision===t.precision}function fft(e,t){return e===t||kl(e,t)&&e.byteWidth===t.byteWidth}function FO(e,t){return e===t||kl(e,t)&&e.unit===t.unit}function M2(e,t){return e===t||kl(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function E2(e,t){return e===t||kl(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function dft(e,t){return e===t||kl(e,t)&&e.children.length===t.children.length&&fd.compareManyFields(e.children,t.children)}function pft(e,t){return e===t||kl(e,t)&&e.children.length===t.children.length&&fd.compareManyFields(e.children,t.children)}function zO(e,t){return e===t||kl(e,t)&&e.mode===t.mode&&e.typeIds.every((r,i)=>r===t.typeIds[i])&&fd.compareManyFields(e.children,t.children)}function Aft(e,t){return e===t||kl(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&fd.visit(e.indices,t.indices)&&fd.visit(e.dictionary,t.dictionary)}function NO(e,t){return e===t||kl(e,t)&&e.unit===t.unit}function P2(e,t){return e===t||kl(e,t)&&e.unit===t.unit}function mft(e,t){return e===t||kl(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&fd.compareManyFields(e.children,t.children)}function gft(e,t){return e===t||kl(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&fd.compareManyFields(e.children,t.children)}Lr.prototype.visitNull=kg;Lr.prototype.visitBool=kg;Lr.prototype.visitInt=bp;Lr.prototype.visitInt8=bp;Lr.prototype.visitInt16=bp;Lr.prototype.visitInt32=bp;Lr.prototype.visitInt64=bp;Lr.prototype.visitUint8=bp;Lr.prototype.visitUint16=bp;Lr.prototype.visitUint32=bp;Lr.prototype.visitUint64=bp;Lr.prototype.visitFloat=_3;Lr.prototype.visitFloat16=_3;Lr.prototype.visitFloat32=_3;Lr.prototype.visitFloat64=_3;Lr.prototype.visitUtf8=kg;Lr.prototype.visitLargeUtf8=kg;Lr.prototype.visitBinary=kg;Lr.prototype.visitLargeBinary=kg;Lr.prototype.visitFixedSizeBinary=fft;Lr.prototype.visitDate=FO;Lr.prototype.visitDateDay=FO;Lr.prototype.visitDateMillisecond=FO;Lr.prototype.visitTimestamp=M2;Lr.prototype.visitTimestampSecond=M2;Lr.prototype.visitTimestampMillisecond=M2;Lr.prototype.visitTimestampMicrosecond=M2;Lr.prototype.visitTimestampNanosecond=M2;Lr.prototype.visitTime=E2;Lr.prototype.visitTimeSecond=E2;Lr.prototype.visitTimeMillisecond=E2;Lr.prototype.visitTimeMicrosecond=E2;Lr.prototype.visitTimeNanosecond=E2;Lr.prototype.visitDecimal=kg;Lr.prototype.visitList=dft;Lr.prototype.visitStruct=pft;Lr.prototype.visitUnion=zO;Lr.prototype.visitDenseUnion=zO;Lr.prototype.visitSparseUnion=zO;Lr.prototype.visitDictionary=Aft;Lr.prototype.visitInterval=NO;Lr.prototype.visitIntervalDayTime=NO;Lr.prototype.visitIntervalYearMonth=NO;Lr.prototype.visitDuration=P2;Lr.prototype.visitDurationSecond=P2;Lr.prototype.visitDurationMillisecond=P2;Lr.prototype.visitDurationMicrosecond=P2;Lr.prototype.visitDurationNanosecond=P2;Lr.prototype.visitFixedSizeList=mft;Lr.prototype.visitMap=gft;var fd=new Lr;function Rg(e,t){return fd.compareSchemas(e,t)}function nH(e,t){return fd.compareFields(e,t)}function sH(e,t){return fd.visit(e,t)}function Cg(e){let t=e.type,r=new(iH.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let i=e.children||[],s={nullValues:e.nullValues},n=Array.isArray(i)?(o,c)=>i[c]||s:({name:o})=>i[o]||s;for(let[o,c]of t.children.entries()){let{type:f}=c,_=n(c,o);r.children.push(Cg(Object.assign(Object.assign({},_),{type:f})))}}return r}function y3(e,t){return _ft(e,t.map(r=>r.data.concat()))}function _ft(e,t){let r=[...e.fields],i=[],s={numBatches:t.reduce((I,R)=>Math.max(I,R.length),0)},n=0,o=0,c=-1,f=t.length,_,w=[];for(;s.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,c=-1;++c0&&(i[n++]=yr({type:new pn(r),length:o,nullCount:0,children:w.slice()})))}return[e=e.assign(r),i.map(I=>new Fs(e,I))]}function yft(e,t,r,i,s){var n;let o=(t+63&-64)>>3;for(let c=-1,f=i.length;++c=t)w===t?r[c]=_:(r[c]=_.slice(0,t),s.numBatches=Math.max(s.numBatches,i[c].unshift(_.slice(t,w-t))));else{let I=e[c];e[c]=I.clone({nullable:!0}),r[c]=(n=_?._changeLengthAndBackfillNullBitmap(t))!==null&&n!==void 0?n:yr({type:I.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return r}var aH,wa=class e{constructor(...t){var r,i;if(t.length===0)return this.batches=[],this.schema=new an([]),this._offsets=[0],this;let s,n;t[0]instanceof an&&(s=t.shift()),t.at(-1)instanceof Uint32Array&&(n=t.pop());let o=f=>{if(f){if(f instanceof Fs)return[f];if(f instanceof e)return f.batches;if(f instanceof Fi){if(f.type instanceof pn)return[new Fs(new an(f.type.children),f)]}else{if(Array.isArray(f))return f.flatMap(_=>o(_));if(typeof f[Symbol.iterator]==\"function\")return[...f].flatMap(_=>o(_));if(typeof f==\"object\"){let _=Object.keys(f),w=_.map(N=>new xr([f[N]])),I=s??new an(_.map((N,j)=>new si(String(N),w[j].type,w[j].nullable))),[,R]=y3(I,w);return R.length===0?[new Fs(f)]:R}}}return[]},c=t.flatMap(f=>o(f));if(s=(i=s??((r=c[0])===null||r===void 0?void 0:r.schema))!==null&&i!==void 0?i:new an([]),!(s instanceof an))throw new TypeError(\"Table constructor expects a [Schema, RecordBatch[]] pair.\");for(let f of c){if(!(f instanceof Fs))throw new TypeError(\"Table constructor expects a [Schema, RecordBatch[]] pair.\");if(!Rg(s,f.schema))throw new TypeError(\"Table and inner RecordBatch schemas must be equivalent.\")}this.schema=s,this.batches=c,this._offsets=n??u3(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=c3(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(xg(t,this.numRows))}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?bv.visit(new xr(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[\n ${this.toArray().join(`,\n `)}\n]`}concat(...t){let r=this.schema,i=this.data.concat(t.flatMap(({data:s})=>s));return new e(r,i.map(s=>new Fs(r,s)))}slice(t,r){let i=this.schema;[t,r]=Kw({length:this.numRows},t,r);let s=h3(this.data,this._offsets,t,r);return new e(i,s.map(n=>new Fs(i,n)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&ti.children[t]);if(r.length===0){let{type:i}=this.schema.fields[t],s=yr({type:i,length:0,nullCount:0});r.push(s._changeLengthAndBackfillNullBitmap(this.numRows))}return new xr(r)}return null}setChild(t,r){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(s=>s.name===t),r)}setChildAt(t,r){let i=this.schema,s=[...this.batches];if(t>-1&&tthis.getChildAt(_));[n[t],c[t]]=[o,r],[i,s]=y3(i,c)}return new e(i,s)}select(t){let r=this.schema.fields.reduce((i,s,n)=>i.set(s.name,n),new Map);return this.selectAt(t.map(i=>r.get(i)).filter(i=>i>-1))}selectAt(t){let r=this.schema.selectAt(t),i=this.batches.map(s=>s.selectAt(t));return new e(r,i)}assign(t){let r=this.schema.fields,[i,s]=t.schema.fields.reduce((c,f,_)=>{let[w,I]=c,R=r.findIndex(N=>N.name===f.name);return~R?I[R]=_:w.push(_),c},[[],[]]),n=this.schema.assign(t.schema),o=[...r.map((c,f)=>[f,s[f]]).map(([c,f])=>f===void 0?this.getChildAt(c):t.getChildAt(f)),...i.map(c=>t.getChildAt(c))].filter(Boolean);return new e(...y3(n,o))}};aH=Symbol.toStringTag;wa[aH]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=xv(e2),e.get=xv(go.getVisitFn(Ot.Struct)),e.set=f3(ba.getVisitFn(Ot.Struct)),e.indexOf=d3(Tg.getVisitFn(Ot.Struct)),\"Table\"))(wa.prototype);var cH,Fs=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof an))throw new TypeError(\"RecordBatch constructor expects a [Schema, Data] pair.\");if([,this.data=yr({nullCount:0,type:new pn(this.schema.fields),children:this.schema.fields.map(r=>yr({type:r.type,nullCount:0}))})]=t,!(this.data instanceof Fi))throw new TypeError(\"RecordBatch constructor expects a [Schema, Data] pair.\");[this.schema,this.data]=lH(this.schema,this.data.children);break}case 1:{let[r]=t,{fields:i,children:s,length:n}=Object.keys(r).reduce((f,_,w)=>(f.children[w]=r[_],f.length=Math.max(f.length,r[_].length),f.fields[w]=si.new({name:_,type:r[_].type,nullable:!0}),f),{length:0,fields:new Array,children:new Array}),o=new an(i),c=yr({type:new pn(i),length:n,children:s,nullCount:0});[this.schema,this.data]=lH(o,c.children,n);break}default:throw new TypeError(\"RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.\")}}get dictionaries(){return this._dictionaries||(this._dictionaries=uH(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return go.visit(this.data,t)}at(t){return this.get(xg(t,this.numRows))}set(t,r){return ba.visit(this.data,t,r)}indexOf(t,r){return Tg.visit(this.data,t,r)}[Symbol.iterator](){return bv.visit(new xr([this.data]))}toArray(){return[...this]}concat(...t){return new wa(this.schema,[this,...t])}slice(t,r){let[i]=new xr([this.data]).slice(t,r).data;return new e(this.schema,i)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&ts.name===t),r)}setChildAt(t,r){let i=this.schema,s=this.data;if(t>-1&&tc.name===n);~o&&(s[o]=this.data.children[o])}return new e(r,yr({type:i,length:this.numRows,children:s}))}selectAt(t){let r=this.schema.selectAt(t),i=t.map(n=>this.data.children[n]).filter(Boolean),s=yr({type:new pn(r.fields),length:this.numRows,children:i});return new e(r,s)}};cH=Symbol.toStringTag;Fs[cH]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,\"RecordBatch\"))(Fs.prototype);function lH(e,t,r=t.reduce((i,s)=>Math.max(i,s.length),0)){var i;let s=[...e.fields],n=[...t],o=(r+63&-64)>>3;for(let[c,f]of e.fields.entries()){let _=t[c];(!_||_.length!==r)&&(s[c]=f.clone({nullable:!0}),n[c]=(i=_?._changeLengthAndBackfillNullBitmap(r))!==null&&i!==void 0?i:yr({type:f.type,length:r,nullCount:r,nullBitmap:new Uint8Array(o)}))}return[e.assign(s),yr({type:new pn(s),length:r,children:n})]}function uH(e,t,r=new Map){var i,s;if(((i=e?.length)!==null&&i!==void 0?i:0)>0&&e?.length===t?.length)for(let n=-1,o=e.length;++nyr({type:s.type})),i=yr({type:new pn(t.fields),nullCount:0,children:r});super(t,i)}};var sf=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):sn.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):wi.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt(\"0\")}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new Fo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,sn.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,wi.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt(\"0\"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,i,s,n,o){return e.startMessage(t),e.addVersion(t,r),e.addHeaderType(t,i),e.addHeader(t,s),e.addBodyLength(t,n),e.addCustomMetadata(t,o),e.endMessage(t)}};var UO=class extends Er{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return Fw.startNull(r),Fw.endNull(r)}visitInt(t,r){return Xh.startInt(r),Xh.addBitWidth(r,t.bitWidth),Xh.addIsSigned(r,t.isSigned),Xh.endInt(r)}visitFloat(t,r){return lm.startFloatingPoint(r),lm.addPrecision(r,t.precision),lm.endFloatingPoint(r)}visitBinary(t,r){return kw.startBinary(r),kw.endBinary(r)}visitLargeBinary(t,r){return Dw.startLargeBinary(r),Dw.endLargeBinary(r)}visitBool(t,r){return Rw.startBool(r),Rw.endBool(r)}visitUtf8(t,r){return Nw.startUtf8(r),Nw.endUtf8(r)}visitLargeUtf8(t,r){return Ow.startLargeUtf8(r),Ow.endLargeUtf8(r)}visitDecimal(t,r){return id.startDecimal(r),id.addScale(r,t.scale),id.addPrecision(r,t.precision),id.addBitWidth(r,t.bitWidth),id.endDecimal(r)}visitDate(t,r){return nm.startDate(r),nm.addUnit(r,t.unit),nm.endDate(r)}visitTime(t,r){return pp.startTime(r),pp.addUnit(r,t.unit),pp.addBitWidth(r,t.bitWidth),pp.endTime(r)}visitTimestamp(t,r){let i=t.timezone&&r.createString(t.timezone)||void 0;return Ap.startTimestamp(r),Ap.addUnit(r,t.unit),i!==void 0&&Ap.addTimezone(r,i),Ap.endTimestamp(r)}visitInterval(t,r){return cm.startInterval(r),cm.addUnit(r,t.unit),cm.endInterval(r)}visitDuration(t,r){return sm.startDuration(r),sm.addUnit(r,t.unit),sm.endDuration(r)}visitList(t,r){return Bw.startList(r),Bw.endList(r)}visitStruct(t,r){return zw.startStruct_(r),zw.endStruct_(r)}visitUnion(t,r){Kh.startTypeIdsVector(r,t.typeIds.length);let i=Kh.createTypeIdsVector(r,t.typeIds);return Kh.startUnion(r),Kh.addMode(r,t.mode),Kh.addTypeIds(r,i),Kh.endUnion(r)}visitDictionary(t,r){let i=this.visit(t.indices,r);return rd.startDictionaryEncoding(r),rd.addId(r,BigInt(t.id)),rd.addIsOrdered(r,t.isOrdered),i!==void 0&&rd.addIndexType(r,i),rd.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return om.startFixedSizeBinary(r),om.addByteWidth(r,t.byteWidth),om.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return am.startFixedSizeList(r),am.addListSize(r,t.listSize),am.endFixedSizeList(r)}visitMap(t,r){return um.startMap(r),um.addKeysSorted(r,t.keysSorted),um.endMap(r)}},v3=new UO;function pH(e,t=new Map){return new an(vft(e,t),x3(e.metadata),t)}function VO(e){return new Sa(e.count,mH(e.columns),gH(e.columns))}function AH(e){return new yc(VO(e.data),e.id,e.isDelta)}function vft(e,t){return(e.fields||[]).filter(Boolean).map(r=>si.fromJSON(r,t))}function hH(e,t){return(e.children||[]).filter(Boolean).map(r=>si.fromJSON(r,t))}function mH(e){return(e||[]).reduce((t,r)=>[...t,new Xu(r.count,xft(r.VALIDITY)),...mH(r.children)],[])}function gH(e,t=[]){for(let r=-1,i=(e||[]).length;++rt+ +(r===0),0)}function _H(e,t){let r,i,s,n,o,c;return!t||!(n=e.dictionary)?(o=dH(e,hH(e,t)),s=new si(e.name,o,e.nullable,x3(e.metadata))):t.has(r=n.id)?(i=(i=n.indexType)?fH(i):new ef,c=new mc(t.get(r),i,r,n.isOrdered),s=new si(e.name,c,e.nullable,x3(e.metadata))):(i=(i=n.indexType)?fH(i):new ef,t.set(r,o=dH(e,hH(e,t))),c=new mc(o,i,r,n.isOrdered),s=new si(e.name,c,e.nullable,x3(e.metadata))),s||null}function x3(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function fH(e){return new Bs(e.isSigned,e.bitWidth)}function dH(e,t){let r=e.type.name;switch(r){case\"NONE\":return new ea;case\"null\":return new ea;case\"binary\":return new Vu;case\"largebinary\":return new nd;case\"utf8\":return new ju;case\"largeutf8\":return new sd;case\"bool\":return new dc;case\"list\":return new sl((t||[])[0]);case\"struct\":return new pn(t||[]);case\"struct_\":return new pn(t||[])}switch(r){case\"int\":{let i=e.type;return new Bs(i.isSigned,i.bitWidth)}case\"floatingpoint\":{let i=e.type;return new ra($i[i.precision])}case\"decimal\":{let i=e.type;return new Gu(i.scale,i.precision,i.bitWidth)}case\"date\":{let i=e.type;return new Wu(Os[i.unit])}case\"time\":{let i=e.type;return new Hu(Ar[i.unit],i.bitWidth)}case\"timestamp\":{let i=e.type;return new qu(Ar[i.unit],i.timezone)}case\"interval\":{let i=e.type;return new Zu(Bo[i.unit])}case\"duration\":{let i=e.type;return new Yu(Ar[i.unit])}case\"union\":{let i=e.type,[s,...n]=(i.mode+\"\").toLowerCase(),o=s.toUpperCase()+n.join(\"\");return new pc(Pn[o],i.typeIds||[],t||[])}case\"fixedsizebinary\":{let i=e.type;return new Qu(i.byteWidth)}case\"fixedsizelist\":{let i=e.type;return new Ll(i.listSize,(t||[])[0])}case\"map\":{let i=e.type;return new Ac((t||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: \"${r}\"`)}var bft=vg,wft=nu,vc=class e{static fromJSON(t,r){let i=new e(0,sn.V5,r);return i._createHeader=Sft(t,r),i}static decode(t){t=new wft(Rr(t));let r=sf.getRootAsMessage(t),i=r.bodyLength(),s=r.version(),n=r.headerType(),o=new e(i,s,n);return o._createHeader=Tft(r,n),o}static encode(t){let r=new bft,i=-1;return t.isSchema()?i=an.encode(r,t.header()):t.isRecordBatch()?i=Sa.encode(r,t.header()):t.isDictionaryBatch()&&(i=yc.encode(r,t.header())),sf.startMessage(r),sf.addVersion(r,sn.V5),sf.addHeader(r,i),sf.addHeaderType(r,t.headerType),sf.addBodyLength(r,BigInt(t.bodyLength)),sf.finishMessageBuffer(r,sf.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof an)return new e(0,sn.V5,wi.Schema,t);if(t instanceof Sa)return new e(r,sn.V5,wi.RecordBatch,t);if(t instanceof yc)return new e(r,sn.V5,wi.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===wi.Schema}isRecordBatch(){return this.headerType===wi.RecordBatch}isDictionaryBatch(){return this.headerType===wi.DictionaryBatch}constructor(t,r,i,s){this._version=r,this._headerType=i,this.body=new Uint8Array(0),s&&(this._createHeader=()=>s),this._bodyLength=Wi(t)}},Sa=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,r,i){this._nodes=r,this._buffers=i,this._length=Wi(t)}},yc=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,i=!1){this._data=t,this._isDelta=i,this._id=Wi(r)}},_c=class{constructor(t,r){this.offset=Wi(t),this.length=Wi(r)}},Xu=class{constructor(t,r){this.length=Wi(t),this.nullCount=Wi(r)}};function Sft(e,t){return()=>{switch(t){case wi.Schema:return an.fromJSON(e);case wi.RecordBatch:return Sa.fromJSON(e);case wi.DictionaryBatch:return yc.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${wi[t]}, type: ${t} }`)}}function Tft(e,t){return()=>{switch(t){case wi.Schema:return an.decode(e.header(new fc),new Map,e.version());case wi.RecordBatch:return Sa.decode(e.header(new su),e.version());case wi.DictionaryBatch:return yc.decode(e.header(new dp),e.version())}throw new Error(`Unrecognized Message type: { name: ${wi[t]}, type: ${t} }`)}}si.encode=Bft;si.decode=Dft;si.fromJSON=_H;an.encode=Oft;an.decode=Mft;an.fromJSON=pH;Sa.encode=Fft;Sa.decode=Eft;Sa.fromJSON=VO;yc.encode=zft;yc.decode=Pft;yc.fromJSON=AH;Xu.encode=Nft;Xu.decode=Cft;_c.encode=Uft;_c.decode=Ift;function Mft(e,t=new Map,r=sn.V5){let i=Rft(e,t);return new an(i,b3(e),t,r)}function Eft(e,t=sn.V5){if(e.compression()!==null)throw new Error(\"Record batch compression not implemented\");return new Sa(e.length(),Lft(e),kft(e,t))}function Pft(e,t=sn.V5){return new yc(Sa.decode(e.data(),t),e.id(),e.isDelta())}function Ift(e){return new _c(e.offset(),e.length())}function Cft(e){return new Xu(e.length(),e.nullCount())}function Lft(e){let t=[];for(let r,i=-1,s=-1,n=e.nodesLength();++isi.encode(e,n));fc.startFieldsVector(e,r.length);let i=fc.createFieldsVector(e,r),s=t.metadata&&t.metadata.size>0?fc.createCustomMetadataVector(e,[...t.metadata].map(([n,o])=>{let c=e.createString(`${n}`),f=e.createString(`${o}`);return Fo.startKeyValue(e),Fo.addKey(e,c),Fo.addValue(e,f),Fo.endKeyValue(e)})):-1;return fc.startSchema(e),fc.addFields(e,i),fc.addEndianness(e,Vft?im.Little:im.Big),s!==-1&&fc.addCustomMetadata(e,s),fc.endSchema(e)}function Bft(e,t){let r=-1,i=-1,s=-1,n=t.type,o=t.typeId;ze.isDictionary(n)?(o=n.dictionary.typeId,s=v3.visit(n,e),i=v3.visit(n.dictionary,e)):i=v3.visit(n,e);let c=(n.children||[]).map(w=>si.encode(e,w)),f=nl.createChildrenVector(e,c),_=t.metadata&&t.metadata.size>0?nl.createCustomMetadataVector(e,[...t.metadata].map(([w,I])=>{let R=e.createString(`${w}`),N=e.createString(`${I}`);return Fo.startKeyValue(e),Fo.addKey(e,R),Fo.addValue(e,N),Fo.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),nl.startField(e),nl.addType(e,i),nl.addTypeType(e,o),nl.addChildren(e,f),nl.addNullable(e,!!t.nullable),r!==-1&&nl.addName(e,r),s!==-1&&nl.addDictionary(e,s),_!==-1&&nl.addCustomMetadata(e,_),nl.endField(e)}function Fft(e,t){let r=t.nodes||[],i=t.buffers||[];su.startNodesVector(e,r.length);for(let o of r.slice().reverse())Xu.encode(e,o);let s=e.endVector();su.startBuffersVector(e,i.length);for(let o of i.slice().reverse())_c.encode(e,o);let n=e.endVector();return su.startRecordBatch(e),su.addLength(e,BigInt(t.length)),su.addNodes(e,s),su.addBuffers(e,n),su.endRecordBatch(e)}function zft(e,t){let r=Sa.encode(e,t.data);return dp.startDictionaryBatch(e),dp.addId(e,BigInt(t.id)),dp.addIsDelta(e,t.isDelta),dp.addData(e,r),dp.endDictionaryBatch(e)}function Nft(e,t){return hv.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Uft(e,t){return uv.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var Vft=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var GO=e=>`Expected ${wi[e]} Message in stream, but was null or length 0.`,WO=e=>`Header pointer of flatbuffer-encoded ${wi[e]} Message is null or length 0.`,bH=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,wH=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,Zv=class{constructor(t){this.source=t instanceof ld?t:new ld(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?Vn:t.value===-1&&(t=this.readMetadataLength()).done?Vn:(t=this.readMetadata(t.value)).done?Vn:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(GO(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=Rr(this.source.read(t));if(r.byteLength[...s,...n.VALIDITY&&[n.VALIDITY]||[],...n.TYPE_ID&&[n.TYPE_ID]||[],...n.OFFSET&&[n.OFFSET]||[],...n.DATA&&[n.DATA]||[],...r(n.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(GO(t));return r.value}readSchema(){let t=wi.Schema,r=this.readMessage(t),i=r?.header();if(!r||!i)throw new Error(WO(t));return i}},w3=4,jO=\"ARROW1\",Yv=new Uint8Array(jO.length);for(let e=0;ethis):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return xa.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return xa.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('\"throughNode\" not available in this environment')}static throughDOM(t,r){throw new Error('\"throughDOM\" not available in this environment')}static from(t){return t instanceof e?t:CP(t)?Gft(t):kP(t)?qft(t):ru(t)?ar(this,void 0,void 0,function*(){return yield e.from(yield t)}):RP(t)||Mw(t)||OP(t)||Nu(t)?Hft(new $u(t)):Wft(new ld(t))}static readAll(t){return t instanceof e?t.isSync()?TH(t):MH(t):CP(t)||ArrayBuffer.isView(t)||Yh(t)||LP(t)?TH(t):MH(t)}},wp=class extends cu{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return eu(this,arguments,function*(){yield ii(yield*lv(Zh(this[Symbol.iterator]())))})}},Og=class extends cu{constructor(t){super(t),this._impl=t}readAll(){return ar(this,void 0,void 0,function*(){var t,r,i,s;let n=new Array;try{for(var o=!0,c=Zh(this),f;f=yield c.next(),t=f.done,!t;o=!0){s=f.value,o=!1;let _=s;n.push(_)}}catch(_){r={error:_}}finally{try{!o&&!t&&(i=c.return)&&(yield i.call(c))}finally{if(r)throw r.error}}return n})}[Symbol.iterator](){throw new Error(\"AsyncRecordBatchStreamReader is not Iterable\")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Bg=class extends wp{constructor(t){super(t),this._impl=t}},T3=class extends Og{constructor(t){super(t),this._impl=t}},M3=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r){let i=this._loadVectors(t,r,this.schema.fields),s=yr({type:new pn(this.schema.fields),length:t.length,children:i});return new Fs(this.schema,s)}_loadDictionaryBatch(t,r){let{id:i,isDelta:s}=t,{dictionaries:n,schema:o}=this,c=n.get(i);if(s||!c){let f=o.dictionaries.get(i),_=this._loadVectors(t.data,r,[f]);return(c&&s?c.concat(new xr(_)):new xr(_)).memoize()}return c.memoize()}_loadVectors(t,r,i){return new o2(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}},$v=class extends M3{constructor(t,r){super(r),this._reader=CP(t)?new C2(this._handle=t):new Zv(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=EH(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):Vn}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Vn}next(){if(this.closed)return Vn;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),s=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),s=r.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,n)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Dg(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Xv=class extends M3{constructor(t,r){super(r),this._reader=new I2(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return ar(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return ar(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=EH(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return ar(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Vn})}return(t){return ar(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Vn})}next(){return ar(this,void 0,void 0,function*(){if(this.closed)return Vn;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),s=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),s=yield r.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,n)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Dg(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return ar(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},E3=class extends $v{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,r){super(t instanceof i2?t:new i2(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(i&&this._handle.seek(i.offset)){let s=this._reader.readMessage(wi.RecordBatch);if(s?.isRecordBatch()){let n=s.header(),o=this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(n,o)}}return null}_readDictionaryBatch(t){var r;let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(i&&this._handle.seek(i.offset)){let s=this._reader.readMessage(wi.DictionaryBatch);if(s?.isDictionaryBatch()){let n=s.header(),o=this._reader.readMessageBody(s.bodyLength),c=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,c)}}}_readFooter(){let{_handle:t}=this,r=t.size-HO,i=t.readInt32(r),s=t.readAt(r-i,i);return _p.decode(s)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return ar(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let i of this._footer.dictionaryBatches())i&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){return ar(this,void 0,void 0,function*(){var r;if(this.closed)return null;this._footer||(yield this.open());let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(i&&(yield this._handle.seek(i.offset))){let s=yield this._reader.readMessage(wi.RecordBatch);if(s?.isRecordBatch()){let n=s.header(),o=yield this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(n,o)}}return null})}_readDictionaryBatch(t){return ar(this,void 0,void 0,function*(){var r;let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(i&&(yield this._handle.seek(i.offset))){let s=yield this._reader.readMessage(wi.DictionaryBatch);if(s?.isDictionaryBatch()){let n=s.header(),o=yield this._reader.readMessageBody(s.bodyLength),c=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,c)}}})}_readFooter(){return ar(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-HO,i=yield t.readInt32(r),s=yield t.readAt(r-i,i);return _p.decode(s)})}_readNextMessageAndValidate(t){return ar(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?S3(t)?new Bg(new E3(e.read())):new wp(new $v(e)):new wp(new $v(function*(){}()))}function Hft(e){return ar(this,void 0,void 0,function*(){let t=yield e.peek(Qv+7&-8);return t&&t.byteLength>=4?S3(t)?new Bg(new E3(yield e.read())):new Og(new Xv(e)):new Og(new Xv(function(){return eu(this,arguments,function*(){})}()))})}function qft(e){return ar(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Am(e,t);return t>=SH&&S3(yield r.readAt(0,Qv+7&-8))?new T3(new qO(r)):new Og(new Xv(r))})}var os=class e extends Er{static assemble(...t){let r=s=>s.flatMap(n=>Array.isArray(n)?r(n):n instanceof Fs?n.data.children:n.data),i=new e;return i.visitMany(r(t)),i}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof xr)return this.visitMany(t.data),this;let{type:r}=t;if(!ze.isDictionary(r)){let{length:i}=t;if(i>2147483647)throw new RangeError(\"Cannot write arrays larger than 2^31 - 1 in length\");if(ze.isUnion(r))this.nodes.push(new Xu(i,0));else{let{nullCount:s}=t;ze.isNull(r)||of.call(this,s<=0?new Uint8Array(0):wg(t.offset,i,t.nullBitmap)),this.nodes.push(new Xu(i,s))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function of(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new _c(this._byteLength,t)),this._byteLength+=t,this}function Zft(e){var t;let{type:r,length:i,typeIds:s,valueOffsets:n}=e;if(of.call(this,s),r.mode===Pn.Sparse)return YO.call(this,e);if(r.mode===Pn.Dense){if(e.offset<=0)return of.call(this,n),YO.call(this,e);{let o=new Int32Array(i),c=Object.create(null),f=Object.create(null);for(let _,w,I=-1;++I{let I=r.typeIds[w],R=c[I],N=f[I];return _.slice(R,Math.min(i,N))}))}}return this}function Yft(e){let t;return e.nullCount>=e.length?of.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?of.call(this,wg(e.offset,e.length,t)):of.call(this,Sg(e.values))}function Sp(e){return of.call(this,e.values.subarray(0,e.length*e.stride))}function P3(e){let{length:t,values:r,valueOffsets:i}=e,s=Wi(i[0]),n=Wi(i[t]),o=Math.min(n-s,r.byteLength-s);return of.call(this,FP(-s,t+1,i)),of.call(this,r.subarray(s,s+o)),this}function QO(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:i,[t]:s}=r;return of.call(this,FP(-i,t+1,r)),this.visit(e.children[0].slice(i,s-i))}return this.visit(e.children[0])}function YO(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}os.prototype.visitBool=Yft;os.prototype.visitInt=Sp;os.prototype.visitFloat=Sp;os.prototype.visitUtf8=P3;os.prototype.visitLargeUtf8=P3;os.prototype.visitBinary=P3;os.prototype.visitLargeBinary=P3;os.prototype.visitFixedSizeBinary=Sp;os.prototype.visitDate=Sp;os.prototype.visitTimestamp=Sp;os.prototype.visitTime=Sp;os.prototype.visitDecimal=Sp;os.prototype.visitList=QO;os.prototype.visitStruct=YO;os.prototype.visitUnion=Zft;os.prototype.visitInterval=Sp;os.prototype.visitDuration=Sp;os.prototype.visitFixedSizeList=QO;os.prototype.visitMap=QO;var Fg=class extends Eg{static throughNode(t){throw new Error('\"throughNode\" not available in this environment')}static throughDOM(t,r){throw new Error('\"throughDOM\" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new ad,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Cl(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy==\"boolean\"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat==\"boolean\"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return ru(t)?t.then(r=>this.writeAll(r)):Nu(t)?XO(this,t):$O(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof ad?this._sink=t:(this._sink=new ad,t&&j9(t)?this.toDOMStream({type:\"bytes\"}).pipeTo(t):t&&G9(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!r||!Rg(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof wa&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof Fs&&!(r=t.schema))return this.finish()&&void 0}else throw new Error(\"RecordBatchWriter is closed\");if(r&&!Rg(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof Fs?t instanceof Dg||this._writeRecordBatch(t):t instanceof wa?this.writeAll(t.batches):Yh(t)&&this.writeAll(t)}_writeMessage(t,r=8){let i=r-1,s=vc.encode(t),n=s.byteLength,o=this._writeLegacyIpcFormat?4:8,c=n+o+i&~i,f=c-n-o;return t.headerType===wi.RecordBatch?this._recordBatchBlocks.push(new yp(c,t.bodyLength,this._position)):t.headerType===wi.DictionaryBatch&&this._dictionaryBlocks.push(new yp(c,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(c-o)),n>0&&this._write(s),this._writePadding(f)}_write(t){if(this._started){let r=Rr(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(vc.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Yv)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:i,bufferRegions:s,buffers:n}=os.assemble(t),o=new Sa(t.numRows,i,s),c=vc.from(o,r);return this._writeDictionaries(t)._writeMessage(c)._writeBodyBuffers(n)}_writeDictionaryBatch(t,r,i=!1){this._dictionaryDeltaOffsets.set(r,t.length+(this._dictionaryDeltaOffsets.get(r)||0));let{byteLength:s,nodes:n,bufferRegions:o,buffers:c}=os.assemble(new xr([t])),f=new Sa(t.length,n,o),_=new yc(f,r,i),w=vc.from(_,s);return this._writeMessage(w)._writeBodyBuffers(c)}_writeBodyBuffers(t){let r,i,s;for(let n=-1,o=t.length;++n0&&(this._write(r),(s=(i+7&-8)-i)>0&&this._writePadding(s));return this}_writeDictionaries(t){for(let[r,i]of t.dictionaries){let s=this._dictionaryDeltaOffsets.get(r)||0;if(s===0||(i=i?.slice(s)).length>0)for(let n of i.data)this._writeDictionaryBatch(n,r,s>0),s+=n.length}return this}},L2=class e extends Fg{static writeAll(t,r){let i=new e(r);return ru(t)?t.then(s=>i.writeAll(s)):Nu(t)?XO(i,t):$O(i,t)}},k2=class e extends Fg{static writeAll(t){let r=new e;return ru(t)?t.then(i=>r.writeAll(i)):Nu(t)?XO(r,t):$O(r,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let r=_p.encode(new _p(t,sn.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function $O(e,t){let r=t;t instanceof wa&&(r=t.batches,e.reset(void 0,t.schema));for(let i of r)e.write(i);return e.finish()}function XO(e,t){return ar(this,void 0,void 0,function*(){var r,i,s,n,o,c,f;try{for(r=!0,i=Zh(t);s=yield i.next(),n=s.done,!n;r=!0){f=s.value,r=!1;let _=f;e.write(_)}}catch(_){o={error:_}}finally{try{!r&&!n&&(c=i.return)&&(yield c.call(i))}finally{if(o)throw o.error}}return e.finish()})}function PH(e,t){if(Nu(e))return $ft(e,t);if(Yh(e))return Qft(e,t);throw new Error(\"toDOMStream() must be called with an Iterable or AsyncIterable\")}function Qft(e,t){let r=null,i=t?.type===\"bytes\"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){n(o,r||(r=e[Symbol.iterator]()))},pull(o){r?n(o,r):o.close()},cancel(){(r?.return&&r.return()||!0)&&(r=null)}}),Object.assign({highWaterMark:i?s:void 0},t));function n(o,c){let f,_=null,w=o.desiredSize||null;for(;!(_=c.next(i?w:null)).done;)if(ArrayBuffer.isView(_.value)&&(f=Rr(_.value))&&(w!=null&&i&&(w=w-f.byteLength+1),_.value=f),o.enqueue(_.value),w!=null&&--w<=0)return;o.close()}}function $ft(e,t){let r=null,i=t?.type===\"bytes\"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){return ar(this,void 0,void 0,function*(){yield n(o,r||(r=e[Symbol.asyncIterator]()))})},pull(o){return ar(this,void 0,void 0,function*(){r?yield n(o,r):o.close()})},cancel(){return ar(this,void 0,void 0,function*(){(r?.return&&(yield r.return())||!0)&&(r=null)})}}),Object.assign({highWaterMark:i?s:void 0},t));function n(o,c){return ar(this,void 0,void 0,function*(){let f,_=null,w=o.desiredSize||null;for(;!(_=yield c.next(i?w:null)).done;)if(ArrayBuffer.isView(_.value)&&(f=Rr(_.value))&&(w!=null&&i&&(w=w-f.byteLength+1),_.value=f),o.enqueue(_.value),w!=null&&--w<=0)return;o.close()})}}function LH(e){return new KO(e)}var KO=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{[\"readableStrategy\"]:r,[\"writableStrategy\"]:i,[\"queueingStrategy\"]:s=\"count\"}=t,n=U9(t,[\"readableStrategy\",\"writableStrategy\",\"queueingStrategy\"]);this._controller=null,this._builder=Cg(n),this._getSize=s!==\"bytes\"?IH:CH;let{[\"highWaterMark\"]:o=s===\"bytes\"?Math.pow(2,14):1e3}=Object.assign({},r),{[\"highWaterMark\"]:c=s===\"bytes\"?Math.pow(2,14):1e3}=Object.assign({},i);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:f=>{this._maybeFlush(this._builder,this._controller=f)},start:f=>{this._maybeFlush(this._builder,this._controller=f)}},{highWaterMark:o,size:s!==\"bytes\"?IH:CH}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:c,size:f=>this._writeValueAndReturnChunkSize(f)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},IH=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},CH=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function I3(e,t){let r=new ad,i=null,s=new ReadableStream({cancel(){return ar(this,void 0,void 0,function*(){yield r.close()})},start(c){return ar(this,void 0,void 0,function*(){yield o(c,i||(i=yield n()))})},pull(c){return ar(this,void 0,void 0,function*(){i?yield o(c,i):c.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:s};function n(){return ar(this,void 0,void 0,function*(){return yield(yield cu.from(r)).open(t)})}function o(c,f){return ar(this,void 0,void 0,function*(){let _=c.desiredSize,w=null;for(;!(w=yield f.next()).done;)if(c.enqueue(w.value),_!=null&&--_<=0)return;c.close()})}}function C3(e,t){let r=new this(e),i=new $u(r),s=new ReadableStream({cancel(){return ar(this,void 0,void 0,function*(){yield i.cancel()})},pull(o){return ar(this,void 0,void 0,function*(){yield n(o)})},start(o){return ar(this,void 0,void 0,function*(){yield n(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:s};function n(o){return ar(this,void 0,void 0,function*(){let c=null,f=o.desiredSize;for(;c=yield i.read(f||null);)if(o.enqueue(c),f!=null&&(f-=c.byteLength)<=0)return;o.close()})}}function R2(e){let t=cu.from(e);return ru(t)?t.then(r=>R2(r)):t.isAsync()?t.readAll().then(r=>new wa(r)):new wa(t.readAll())}var _dt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},uO),OO),MO),hO),iO),TO),oO),{compareSchemas:Rg,compareFields:nH,compareTypes:sH});xa.toDOMStream=PH;Xn.throughDOM=LH;cu.throughDOM=I3;Bg.throughDOM=I3;wp.throughDOM=I3;Fg.throughDOM=C3;k2.throughDOM=C3;L2.throughDOM=C3;var ydt=\"0.6.1\",vdt=`https://cdn.jsdelivr.net/npm/parquet-wasm@${ydt}/esm/parquet_wasm_bg.wasm`,JO=!1;async function kH(){JO||(await z9(vdt),JO=!0)}function xdt(e){if(!JO)throw new Error(\"wasm not ready\");console.time(\"readParquet\");let t=O9(new Uint8Array(e.buffer),{batchSize:Math.pow(2,31)}).intoIPCStream(),r=R2(t);return console.timeEnd(\"readParquet\"),r}function O2(e){let t=[];for(let r of e){let i=xdt(r);i.batches.length!==1&&console.warn(\"Expected one batch\"),t.push(...i.batches)}return new wa(t)}var RH=Ri(Yi(),1);function tB(e){return e instanceof Array&&e?.[0]instanceof DataView?e?.[0].byteLength>0?O2(e).getChildAt(0):null:e}var zg=class{model;callbacks;updateStateCallback;constructor(t,r){this.model=t,this.model.on(\"change\",r),this.updateStateCallback=r,this.callbacks=new Map,this.callbacks.set(\"change\",r)}async loadSubModels(){}initRegularAttribute(t,r){this[r]=this.model.get(t),this.model.off(`change:${t}`);let i=()=>{this[r]=this.model.get(t)};this.model.on(`change:${t}`,i),this.callbacks.set(`change:${t}`,i)}initVectorizedAccessor(t,r){this[r]=tB(this.model.get(t)),this.model.off(`change:${t}`);let i=()=>{this[r]=tB(this.model.get(t))};this.model.on(`change:${t}`,i),this.callbacks.set(`change:${t}`,i)}finalize(){for(let[t,r]of Object.entries(this.callbacks))this.model.off(t,r)}};async function L3(e,t){let r=[];for(let i of t)r.push(e.get_model(i.slice(10)));return await Promise.all(r)}function Jt(e){return e!=null}function DH(e,t=20){let r;return(...s)=>{clearTimeout(r),r=setTimeout(()=>e(...s),t)}}var bdt=`\n uniform bool brushing_enabled;\n uniform int brushing_target;\n uniform vec2 brushing_mousePos;\n uniform float brushing_radius;\n\n #ifdef NON_INSTANCED_MODEL\n attribute vec2 brushingTargets;\n #else\n attribute vec2 instanceBrushingTargets;\n #endif\n\n varying float brushing_isVisible;\n\n bool brushing_isPointInRange(vec2 position) {\n if (!brushing_enabled) {\n return true;\n }\n vec2 source_commonspace = project_position(position);\n vec2 target_commonspace = project_position(brushing_mousePos);\n float distance = length((target_commonspace - source_commonspace) / project_uCommonUnitsPerMeter.xy);\n\n return distance <= brushing_radius;\n }\n\n bool brushing_arePointsInRange(vec2 sourcePos, vec2 targetPos) {\n return brushing_isPointInRange(sourcePos) || brushing_isPointInRange(targetPos);\n }\n\n void brushing_setVisible(bool visible) {\n brushing_isVisible = float(visible);\n }\n`,wdt=`\n uniform bool brushing_enabled;\n varying float brushing_isVisible;\n`,Sdt={source:0,target:1,custom:2,source_target:3},Tdt={\"vs:DECKGL_FILTER_GL_POSITION\":`\n vec2 brushingTarget;\n vec2 brushingSource;\n if (brushing_target == 3) {\n brushingTarget = geometry.worldPositionAlt.xy;\n brushingSource = geometry.worldPosition.xy;\n } else if (brushing_target == 0) {\n brushingTarget = geometry.worldPosition.xy;\n } else if (brushing_target == 1) {\n brushingTarget = geometry.worldPositionAlt.xy;\n } else {\n #ifdef NON_INSTANCED_MODEL\n brushingTarget = brushingTargets;\n #else\n brushingTarget = instanceBrushingTargets;\n #endif\n }\n bool visible;\n if (brushing_target == 3) {\n visible = brushing_arePointsInRange(brushingSource, brushingTarget);\n } else {\n visible = brushing_isPointInRange(brushingTarget);\n }\n brushing_setVisible(visible);\n `,\"fs:DECKGL_FILTER_COLOR\":`\n if (brushing_enabled && brushing_isVisible < 0.5) {\n discard;\n }\n `},OH={name:\"brushing\",dependencies:[Vh],vs:bdt,fs:wdt,inject:Tdt,getUniforms:e=>{if(!e||!(\"viewport\"in e))return{};let{brushingEnabled:t=!0,brushingRadius:r=1e4,brushingTarget:i=\"source\",mousePosition:s,viewport:n}=e;return{brushing_enabled:!!(t&&s&&n.containsPixel(s)),brushing_radius:r,brushing_target:Sdt[i]||0,brushing_mousePos:s?n.unproject([s.x-n.x,s.y-n.y]):[0,0]}}};var Mdt={getBrushingTarget:{type:\"accessor\",value:[0,0]},brushingTarget:\"source\",brushingEnabled:!0,brushingRadius:1e4},vm=class extends cc{getShaders(){return{modules:[OH]}}initializeState(t,r){let i=this.getAttributeManager();i&&i.add({brushingTargets:{size:2,accessor:\"getBrushingTarget\",shaderAttributes:{brushingTargets:{divisor:0},instanceBrushingTargets:{divisor:1}}}}),this.state.onMouseMove=()=>{var s;(s=this.getCurrentLayer())===null||s===void 0||s.setNeedsRedraw()},t.deck&&t.deck.eventManager.on({pointermove:this.state.onMouseMove,pointerleave:this.state.onMouseMove})}finalizeState(t,r){t.deck&&t.deck.eventManager.off({pointermove:this.state.onMouseMove,pointerleave:this.state.onMouseMove})}};G(vm,\"defaultProps\",Mdt);G(vm,\"extensionName\",\"BrushingExtension\");var BH=`\nuniform DATAFILTER_TYPE filter_min;\nuniform DATAFILTER_TYPE filter_softMin;\nuniform DATAFILTER_TYPE filter_softMax;\nuniform DATAFILTER_TYPE filter_max;\nuniform bool filter_useSoftMargin;\nuniform bool filter_enabled;\nuniform bool filter_transformSize;\n\n#ifdef NON_INSTANCED_MODEL\n #define DATAFILTER_ATTRIB filterValues\n #define DATAFILTER_ATTRIB_64LOW filterValues64Low\n#else\n #define DATAFILTER_ATTRIB instanceFilterValues\n #define DATAFILTER_ATTRIB_64LOW instanceFilterValues64Low\n#endif\n\nattribute DATAFILTER_TYPE DATAFILTER_ATTRIB;\n#ifdef DATAFILTER_DOUBLE\n attribute DATAFILTER_TYPE DATAFILTER_ATTRIB_64LOW;\n\n uniform DATAFILTER_TYPE filter_min64High;\n uniform DATAFILTER_TYPE filter_max64High;\n#endif\n\nvarying float dataFilter_value;\n\nfloat dataFilter_reduceValue(float value) {\n return value;\n}\nfloat dataFilter_reduceValue(vec2 value) {\n return min(value.x, value.y);\n}\nfloat dataFilter_reduceValue(vec3 value) {\n return min(min(value.x, value.y), value.z);\n}\nfloat dataFilter_reduceValue(vec4 value) {\n return min(min(value.x, value.y), min(value.z, value.w));\n}\nvoid dataFilter_setValue(DATAFILTER_TYPE valueFromMin, DATAFILTER_TYPE valueFromMax) {\n if (filter_enabled) {\n if (filter_useSoftMargin) {\n dataFilter_value = dataFilter_reduceValue(\n smoothstep(filter_min, filter_softMin, valueFromMin) *\n (1.0 - smoothstep(filter_softMax, filter_max, valueFromMax))\n );\n } else {\n dataFilter_value = dataFilter_reduceValue(\n step(filter_min, valueFromMin) * step(valueFromMax, filter_max)\n );\n }\n } else {\n dataFilter_value = 1.0;\n }\n}\n`,FH=`\nuniform bool filter_transformColor;\nvarying float dataFilter_value;\n`;function zH(e){if(!e||!(\"extensions\"in e))return{};let{filterRange:t=[-1,1],filterEnabled:r=!0,filterTransformSize:i=!0,filterTransformColor:s=!0}=e,n=e.filterSoftRange||t;return{...Number.isFinite(t[0])?{filter_min:t[0],filter_softMin:n[0],filter_softMax:n[1],filter_max:t[1]}:{filter_min:t.map(o=>o[0]),filter_softMin:n.map(o=>o[0]),filter_softMax:n.map(o=>o[1]),filter_max:t.map(o=>o[1])},filter_enabled:r,filter_useSoftMargin:!!e.filterSoftRange,filter_transformSize:r&&i,filter_transformColor:r&&s}}function Edt(e){if(!e||!(\"extensions\"in e))return{};let t=zH(e);if(Number.isFinite(t.filter_min)){let r=Math.fround(t.filter_min);t.filter_min-=r,t.filter_softMin-=r,t.filter_min64High=r;let i=Math.fround(t.filter_max);t.filter_max-=i,t.filter_softMax-=i,t.filter_max64High=i}else{let r=t.filter_min.map(Math.fround);t.filter_min=t.filter_min.map((s,n)=>s-r[n]),t.filter_softMin=t.filter_softMin.map((s,n)=>s-r[n]),t.filter_min64High=r;let i=t.filter_max.map(Math.fround);t.filter_max=t.filter_max.map((s,n)=>s-i[n]),t.filter_softMax=t.filter_softMax.map((s,n)=>s-i[n]),t.filter_max64High=i}return t}var NH={\"vs:#main-start\":`\n #ifdef DATAFILTER_DOUBLE\n dataFilter_setValue(\n DATAFILTER_ATTRIB - filter_min64High + DATAFILTER_ATTRIB_64LOW,\n DATAFILTER_ATTRIB - filter_max64High + DATAFILTER_ATTRIB_64LOW\n );\n #else\n dataFilter_setValue(DATAFILTER_ATTRIB, DATAFILTER_ATTRIB);\n #endif\n `,\"vs:#main-end\":`\n if (dataFilter_value == 0.0) {\n gl_Position = vec4(0.);\n }\n `,\"vs:DECKGL_FILTER_SIZE\":`\n if (filter_transformSize) {\n size = size * dataFilter_value;\n }\n `,\"fs:DECKGL_FILTER_COLOR\":`\n if (dataFilter_value == 0.0) discard;\n if (filter_transformColor) {\n color.a *= dataFilter_value;\n }\n `},UH={name:\"data-filter\",vs:BH,fs:FH,inject:NH,getUniforms:zH},VH={name:\"data-filter-fp64\",vs:BH,fs:FH,inject:NH,getUniforms:Edt};var Pdt=`#define SHADER_NAME data-filter-vertex-shader\n\n#ifdef FLOAT_TARGET\n attribute float filterIndices;\n attribute float filterPrevIndices;\n#else\n attribute vec2 filterIndices;\n attribute vec2 filterPrevIndices;\n#endif\n\nvarying vec4 vColor;\nconst float component = 1.0 / 255.0;\n\nvoid main() {\n #ifdef FLOAT_TARGET\n dataFilter_value *= float(filterIndices != filterPrevIndices);\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n vColor = vec4(0.0, 0.0, 0.0, 1.0);\n #else\n // Float texture is not supported: pack result into 4 channels x 256 px x 64px\n dataFilter_value *= float(filterIndices.x != filterPrevIndices.x);\n float col = filterIndices.x;\n float row = filterIndices.y * 4.0;\n float channel = floor(row);\n row = fract(row);\n vColor = component * vec4(bvec4(channel == 0.0, channel == 1.0, channel == 2.0, channel == 3.0));\n gl_Position = vec4(col * 2.0 - 1.0, row * 2.0 - 1.0, 0.0, 1.0);\n #endif\n gl_PointSize = 1.0;\n}\n`,Idt=`#define SHADER_NAME data-filter-fragment-shader\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main() {\n if (dataFilter_value < 0.5) {\n discard;\n }\n gl_FragColor = vColor;\n}\n`;function jH(e){return!!(e.getExtension(\"EXT_float_blend\")&&(e.getExtension(\"EXT_color_buffer_float\")||e.getExtension(\"WEBGL_color_buffer_float\")))}function GH(e,t){return t?new yi(e,{width:1,height:1,attachments:{36064:new pi(e,{format:fr(e)?34836:6408,type:5126,mipmaps:!1})}}):new yi(e,{width:256,height:64,depth:!1})}function WH(e,t,r){return t.defines.NON_INSTANCED_MODEL=1,r&&(t.defines.FLOAT_TARGET=1),new fn(e,{id:\"data-filter-aggregation-model\",vertexCount:1,isInstanced:!1,drawMode:0,vs:Pdt,fs:Idt,...t})}var HH={blend:!0,blendFunc:[1,1,1,1],blendEquation:[32774,32774],depthTest:!1};var Ldt={getFilterValue:{type:\"accessor\",value:0},onFilteredItemsChange:{type:\"function\",value:null,optional:!0},filterEnabled:!0,filterRange:[-1,1],filterSoftRange:null,filterTransformSize:!0,filterTransformColor:!0},qH={1:\"float\",2:\"vec2\",3:\"vec3\",4:\"vec4\"},xm=class extends cc{constructor({filterSize:t=1,fp64:r=!1,countItems:i=!1}={}){if(!qH[t])throw new Error(\"filterSize out of range\");super({filterSize:t,fp64:r,countItems:i})}getShaders(t){let{filterSize:r,fp64:i}=t.opts;return{modules:[i?VH:UH],defines:{DATAFILTER_TYPE:qH[r],DATAFILTER_DOUBLE:!!i}}}initializeState(t,r){let i=this.getAttributeManager();i&&i.add({filterValues:{size:r.opts.filterSize,type:r.opts.fp64?5130:5126,accessor:\"getFilterValue\",shaderAttributes:{filterValues:{divisor:0},instanceFilterValues:{divisor:1}}}});let{gl:s}=this.context;if(i&&r.opts.countItems){let n=jH(s);i.add({filterIndices:{size:n?1:2,vertexOffset:1,type:5121,normalized:!0,accessor:(f,{index:_})=>{let w=f&&f.__source?f.__source.index:_;return n?(w+1)%255:[(w+1)%255,Math.floor(w/255)%255]},shaderAttributes:{filterPrevIndices:{vertexOffset:0},filterIndices:{vertexOffset:1}}}});let o=GH(s,n),c=WH(s,r.getShaders.call(this,r),n);this.setState({filterFBO:o,filterModel:c})}}updateState({props:t,oldProps:r}){if(this.state.filterModel){let s=this.getAttributeManager().attributes.filterValues.needsUpdate()||t.filterEnabled!==r.filterEnabled||t.filterRange!==r.filterRange||t.filterSoftRange!==r.filterSoftRange;s&&this.setState({filterNeedsUpdate:s})}}draw(t,r){let{filterFBO:i,filterModel:s,filterNeedsUpdate:n}=this.state,{onFilteredItemsChange:o}=this.props;if(n&&o&&s){let{attributes:{filterValues:c,filterIndices:f}}=this.getAttributeManager();s.setVertexCount(this.getNumInstances());let{gl:_}=this.context;Hf(_,{framebuffer:i,color:[0,0,0,0]}),s.updateModuleSettings(t.moduleParameters).setAttributes({...c.getShaderAttributes(),...f&&f.getShaderAttributes()}).draw({framebuffer:i,parameters:{...HH,viewport:[0,0,i.width,i.height]}});let w=Dh(i),I=0;for(let R=0;R 0.0) {\n if (dashAlignMode == 0.0) {\n offset = vDashOffset;\n } else {\n unitLength = vPathLength / round(vPathLength / unitLength);\n offset = solidLength / 2.0;\n }\n\n float unitOffset = mod(vPathPosition.y + offset, unitLength);\n\n if (gapLength > 0.0 && unitOffset > solidLength) {\n if (capType <= 0.5) {\n if (!(dashGapPickable && picking_uActive)) {\n discard;\n }\n } else {\n float distToEnd = length(vec2(\n min(unitOffset - solidLength, unitLength - unitOffset),\n vPathPosition.x\n ));\n if (distToEnd > 1.0) {\n if (!(dashGapPickable && picking_uActive)) {\n discard;\n }\n }\n }\n }\n }\n`}},YH={inject:{\"vs:#decl\":`\nattribute float instanceOffsets;\n`,\"vs:DECKGL_FILTER_SIZE\":`\n float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;\n size *= offsetWidth;\n`,\"vs:#main-end\":`\n float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;\n float offsetDir = sign(instanceOffsets);\n vPathPosition.x = (vPathPosition.x + offsetDir) * offsetWidth - offsetDir;\n vPathPosition.y *= offsetWidth;\n vPathLength *= offsetWidth;\n`,\"fs:#main-start\":`\n float isInside;\n isInside = step(-1.0, vPathPosition.x) * step(vPathPosition.x, 1.0);\n if (isInside == 0.0) {\n discard;\n }\n`}};var kdt={getDashArray:{type:\"accessor\",value:[0,0]},getOffset:{type:\"accessor\",value:0},dashJustified:!1,dashGapPickable:!1},bm=class extends cc{constructor({dash:t=!1,offset:r=!1,highPrecisionDash:i=!1}={}){super({dash:t||i,offset:r,highPrecisionDash:i})}isEnabled(t){return\"pathTesselator\"in t.state}getShaders(t){if(!t.isEnabled(this))return null;let r={};return t.opts.dash&&(r=tv(r,ZH)),t.opts.offset&&(r=tv(r,YH)),r}initializeState(t,r){let i=this.getAttributeManager();!i||!r.isEnabled(this)||(r.opts.dash&&i.addInstanced({instanceDashArrays:{size:2,accessor:\"getDashArray\"}}),r.opts.highPrecisionDash&&i.addInstanced({instanceDashOffsets:{size:1,accessor:\"getPath\",transform:r.getDashOffsets.bind(this)}}),r.opts.offset&&i.addInstanced({instanceOffsets:{size:1,accessor:\"getOffset\"}}))}updateState(t,r){if(!r.isEnabled(this))return;let i={};r.opts.dash&&(i.dashAlignMode=this.props.dashJustified?1:0,i.dashGapPickable=!!this.props.dashGapPickable),this.state.model.setUniforms(i)}getDashOffsets(t){let r=[0],i=this.props.positionFormat===\"XY\"?2:3,s=Array.isArray(t[0]),n=s?t.length:t.length/i,o,c;for(let f=0;f0&&(r[f]=r[f-1]+$j(c,o)),c=o;return r}};G(bm,\"defaultProps\",kdt);G(bm,\"extensionName\",\"PathStyleExtension\");var Rdt=`\n#ifdef NON_INSTANCED_MODEL\nattribute float collisionPriorities;\n#else\nattribute float instanceCollisionPriorities;\n#endif\n\nuniform sampler2D collision_texture;\nuniform bool collision_sort;\nuniform bool collision_enabled;\n\nvec2 collision_getCoords(vec4 position) {\n vec4 collision_clipspace = project_common_position_to_clipspace(position);\n return (1.0 + collision_clipspace.xy / collision_clipspace.w) / 2.0;\n}\n\nfloat collision_match(vec2 tex, vec3 pickingColor) {\n vec4 collision_pickingColor = texture2D(collision_texture, tex);\n float delta = dot(abs(collision_pickingColor.rgb - pickingColor), vec3(1.0));\n float e = 0.001;\n return step(delta, e);\n}\n\nfloat collision_isVisible(vec2 texCoords, vec3 pickingColor) {\n if (!collision_enabled) {\n return 1.0;\n }\n\n // Visibility test, sample area of 5x5 pixels in order to fade in/out.\n // Due to the locality, the lookups will be cached\n // This reduces the flicker present when objects are shown/hidden\n const int N = 2;\n float accumulator = 0.0;\n vec2 step = vec2(1.0 / project_uViewportSize);\n\n const float floatN = float(N);\n vec2 delta = -floatN * step;\n for(int i = -N; i <= N; i++) {\n delta.x = -step.x * floatN;\n for(int j = -N; j <= N; j++) {\n accumulator += collision_match(texCoords + delta, pickingColor);\n delta.x += step.x;\n }\n delta.y += step.y;\n }\n\n float W = 2.0 * floatN + 1.0;\n return pow(accumulator / (W * W), 2.2);\n}\n`,Ddt={\"vs:#decl\":`\n float collision_fade = 1.0;\n`,\"vs:DECKGL_FILTER_GL_POSITION\":`\n if (collision_sort) {\n #ifdef NON_INSTANCED_MODEL\n float collisionPriority = collisionPriorities;\n #else\n float collisionPriority = instanceCollisionPriorities;\n #endif\n position.z = -0.001 * collisionPriority * position.w; // Support range -1000 -> 1000\n }\n\n if (collision_enabled) {\n vec4 collision_common_position = project_position(vec4(geometry.worldPosition, 1.0));\n vec2 collision_texCoords = collision_getCoords(collision_common_position);\n collision_fade = collision_isVisible(collision_texCoords, geometry.pickingColor / 255.0);\n if (collision_fade < 0.0001) {\n // Position outside clip space bounds to discard\n position = vec4(0.0, 0.0, 2.0, 1.0);\n }\n }\n `,\"vs:DECKGL_FILTER_COLOR\":`\n color.a *= collision_fade;\n `},Odt=(e,t)=>{if(!e||!(\"dummyCollisionMap\"in e))return{};let{collisionFBO:r,drawToCollisionMap:i,dummyCollisionMap:s}=e;return{collision_sort:!!i,collision_texture:!i&&r?r:s}},QH={name:\"collision\",dependencies:[Vh],vs:Rdt,inject:Ddt,getUniforms:Odt};var B2=class extends sc{renderCollisionMap(t,r){let i=this.gl,s=1;return Mn(i,{scissorTest:!0,scissor:[s,s,t.width-2*s,t.height-2*s],clearColor:[0,0,0,0],blend:!1,depthTest:!0,depthRange:[0,1]},()=>this.render({...r,target:t,pass:\"collision\"}))}getModuleParameters(){return{drawToCollisionMap:!0,pickingActive:1,pickingAttribute:!1,lightSources:{}}}};var F2=class extends sc{constructor(t,r){super(t,r),G(this,\"maskMap\",void 0),G(this,\"fbo\",void 0);let{mapSize:i=2048}=r;this.maskMap=new pi(t,{width:i,height:i,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.fbo=new yi(t,{id:\"maskmap\",width:i,height:i,attachments:{36064:this.maskMap}})}render(t){let r=this.gl,i=[!1,!1,!1,!1];return i[t.channel]=!0,Mn(r,{clearColor:[255,255,255,255],blend:!0,blendFunc:[0,1],blendEquation:32778,colorMask:i,depthTest:!1},()=>super.render({...t,target:this.fbo,pass:\"mask\"}))}shouldDrawLayer(t){return t.props.operation.includes(\"mask\")}delete(){this.fbo.delete(),this.maskMap.delete()}};function $H(e,t){let r=[1/0,1/0,-1/0,-1/0];for(let i of e){let s=i.getBounds();if(s){let n=i.projectPosition(s[0],{viewport:t,autoOffset:!1}),o=i.projectPosition(s[1],{viewport:t,autoOffset:!1});r[0]=Math.min(r[0],n[0]),r[1]=Math.min(r[1],n[1]),r[2]=Math.max(r[2],o[0]),r[3]=Math.max(r[3],o[1])}}return Number.isFinite(r[0])?r:null}var Bdt=2048;function XH(e){let{bounds:t,viewport:r,border:i=0}=e,{isGeospatial:s}=r;if(t[2]<=t[0]||t[3]<=t[1])return null;let n=r.unprojectPosition([(t[0]+t[2])/2,(t[1]+t[3])/2,0]),{width:o,height:c,zoom:f}=e;if(f===void 0){o=o-i*2,c=c-i*2;let _=Math.min(o/(t[2]-t[0]),c/(t[3]-t[1]));f=Math.min(Math.log2(_),20)}else if(!o||!c){let _=2**f;o=Math.round(Math.abs(t[2]-t[0])*_),c=Math.round(Math.abs(t[3]-t[1])*_);let w=Bdt-i*2;if(o>w||c>w){let I=w/Math.max(o,c);o=Math.round(o*I),c=Math.round(c*I),f+=Math.log2(I)}}return s?new lc({id:r.id,x:i,y:i,width:o,height:c,longitude:n[0],latitude:n[1],zoom:f,orthographic:!0}):new iv({id:r.id,x:i,y:i,width:o,height:c,target:n,zoom:f,flipY:!1})}function Fdt(e,t){let r;if(t&&t.length===2){let[n,o]=t,c=e.getBounds({z:n}),f=e.getBounds({z:o});r=[Math.min(c[0],f[0]),Math.min(c[1],f[1]),Math.max(c[2],f[2]),Math.max(c[3],f[3])]}else r=e.getBounds();let i=e.projectPosition(r.slice(0,2)),s=e.projectPosition(r.slice(2,4));return[i[0],i[1],s[0],s[1]]}function KH(e,t,r){if(!e)return[0,0,1,1];let i=Fdt(t,r),s=zdt(i);return e[2]-e[0]<=s[2]-s[0]&&e[3]-e[1]<=s[3]-s[1]?e:[Math.max(e[0],s[0]),Math.max(e[1],s[1]),Math.min(e[2],s[2]),Math.min(e[3],s[3])]}function zdt(e){let t=e[2]-e[0],r=e[3]-e[1],i=(e[0]+e[2])/2,s=(e[1]+e[3])/2;return[i-t,s-r,i+t,s+r]}var z2=class{constructor(){G(this,\"id\",\"mask-effect\"),G(this,\"props\",null),G(this,\"useInPicking\",!0),G(this,\"order\",0),G(this,\"dummyMaskMap\",void 0),G(this,\"channels\",[]),G(this,\"masks\",null),G(this,\"maskPass\",void 0),G(this,\"maskMap\",void 0),G(this,\"lastViewport\",void 0)}preRender(t,{layers:r,layerFilter:i,viewports:s,onViewportActive:n,views:o,isPicking:c}){let f=!1;if(this.dummyMaskMap||(this.dummyMaskMap=new pi(t,{width:1,height:1})),c)return{didRender:f};let _=r.filter(N=>N.props.visible&&N.props.operation.includes(\"mask\"));if(_.length===0)return this.masks=null,this.channels.length=0,{didRender:f};this.masks={},this.maskPass||(this.maskPass=new F2(t,{id:\"default-mask\"}),this.maskMap=this.maskPass.maskMap);let w=this._sortMaskChannels(_),I=s[0],R=!this.lastViewport||!this.lastViewport.equals(I);if(I.resolution!==void 0)return or.warn(\"MaskExtension is not supported in GlobeView\")(),{didRender:f};for(let N in w){let j=this._renderChannel(w[N],{layerFilter:i,onViewportActive:n,views:o,viewport:I,viewportChanged:R});f||(f=j)}return{didRender:f}}_renderChannel(t,{layerFilter:r,onViewportActive:i,views:s,viewport:n,viewportChanged:o}){let c=!1,f=this.channels[t.index];if(!f)return c;let _=t===f||t.layers.length!==f.layers.length||t.layers.some((w,I)=>w!==f.layers[I]||w.props.transitions)||t.layerBounds.some((w,I)=>w!==f.layerBounds[I]);if(t.bounds=f.bounds,t.maskBounds=f.maskBounds,this.channels[t.index]=t,_||o){this.lastViewport=n;let w=$H(t.layers,n);if(t.bounds=w&&KH(w,n),_||!Ro(t.bounds,f.bounds)){let{maskPass:I,maskMap:R}=this,N=w&&XH({bounds:t.bounds,viewport:n,width:R.width,height:R.height,border:1});t.maskBounds=N?N.getBounds():[0,0,1,1],I.render({pass:\"mask\",channel:t.index,layers:t.layers,layerFilter:r,viewports:N?[N]:[],onViewportActive:i,views:s,moduleParameters:{devicePixelRatio:1}}),c=!0}}return this.masks[t.id]={index:t.index,bounds:t.maskBounds,coordinateOrigin:t.coordinateOrigin,coordinateSystem:t.coordinateSystem},c}_sortMaskChannels(t){let r={},i=0;for(let s of t){let{id:n}=s.root,o=r[n];if(!o){if(++i>4){or.warn(\"Too many mask layers. The max supported is 4\")();continue}o={id:n,index:this.channels.findIndex(c=>c?.id===n),layers:[],layerBounds:[],coordinateOrigin:s.root.props.coordinateOrigin,coordinateSystem:s.root.props.coordinateSystem},r[n]=o}o.layers.push(s),o.layerBounds.push(s.getBounds())}for(let s=0;s<4;s++){let n=this.channels[s];(!n||!(n.id in r))&&(this.channels[s]=null)}for(let s in r){let n=r[s];n.index<0&&(n.index=this.channels.findIndex(o=>!o),this.channels[n.index]=n)}return r}getModuleParameters(){return{maskMap:this.masks?this.maskMap:this.dummyMaskMap,maskChannels:this.masks}}cleanup(){this.dummyMaskMap&&(this.dummyMaskMap.delete(),this.dummyMaskMap=void 0),this.maskPass&&(this.maskPass.delete(),this.maskPass=void 0,this.maskMap=void 0),this.lastViewport=void 0,this.masks=null,this.channels.length=0}};var eB=2,N2=class{constructor(){G(this,\"id\",\"collision-filter-effect\"),G(this,\"props\",null),G(this,\"useInPicking\",!0),G(this,\"order\",1),G(this,\"channels\",{}),G(this,\"collisionFilterPass\",void 0),G(this,\"collisionFBOs\",{}),G(this,\"dummyCollisionMap\",void 0),G(this,\"lastViewport\",void 0)}preRender(t,{effects:r,layers:i,layerFilter:s,viewports:n,onViewportActive:o,views:c,isPicking:f,preRenderStats:_={}}){var w;if(this.dummyCollisionMap||(this.dummyCollisionMap=new pi(t,{width:1,height:1})),f)return;let I=i.filter(({props:{visible:Y,collisionEnabled:K}})=>Y&&K);if(I.length===0){this.channels={};return}this.collisionFilterPass||(this.collisionFilterPass=new B2(t,{id:\"default-collision-filter\"}));let R=r?.filter(Y=>Y.constructor===z2),N=(w=_[\"mask-effect\"])===null||w===void 0?void 0:w.didRender,j=this._groupByCollisionGroup(t,I),Q=n[0],et=!this.lastViewport||!this.lastViewport.equals(Q)||N;for(let Y in j){let K=this.collisionFBOs[Y],J=j[Y];K.resize({width:t.canvas.width/eB,height:t.canvas.height/eB}),this._render(J,{effects:R,layerFilter:s,onViewportActive:o,views:c,viewport:Q,viewportChanged:et})}}_render(t,{effects:r,layerFilter:i,onViewportActive:s,views:n,viewport:o,viewportChanged:c}){let{collisionGroup:f}=t,_=this.channels[f];if(!_)return;let w=c||t===_||!mo(_.layers,t.layers,1)||t.layerBounds.some((I,R)=>!Ro(I,_.layerBounds[R]))||t.allLayersLoaded!==_.allLayersLoaded||t.layers.some(I=>I.props.transitions);if(this.channels[f]=t,w){this.lastViewport=o;let I=this.collisionFBOs[f];this.collisionFilterPass.renderCollisionMap(I,{pass:\"collision-filter\",isPicking:!0,layers:t.layers,effects:r,layerFilter:i,viewports:o?[o]:[],onViewportActive:s,views:n,moduleParameters:{dummyCollisionMap:this.dummyCollisionMap,devicePixelRatio:El(I.gl)/eB}})}}_groupByCollisionGroup(t,r){let i={};for(let s of r){let{collisionGroup:n}=s.props,o=i[n];o||(o={collisionGroup:n,layers:[],layerBounds:[],allLayersLoaded:!0},i[n]=o),o.layers.push(s),o.layerBounds.push(s.getBounds()),s.isLoaded||(o.allLayersLoaded=!1)}for(let s of Object.keys(i))this.collisionFBOs[s]||this.createFBO(t,s),this.channels[s]||(this.channels[s]=i[s]);for(let s of Object.keys(this.collisionFBOs))i[s]||this.destroyFBO(s);return i}getModuleParameters(t){let{collisionGroup:r}=t.props,{collisionFBOs:i,dummyCollisionMap:s}=this;return{collisionFBO:i[r],dummyCollisionMap:s}}cleanup(){this.dummyCollisionMap&&(this.dummyCollisionMap.delete(),this.dummyCollisionMap=void 0),this.channels={};for(let t of Object.keys(this.collisionFBOs))this.destroyFBO(t);this.collisionFBOs={},this.lastViewport=void 0}createFBO(t,r){let{width:i,height:s}=t.canvas,n=new pi(t,{width:i,height:s,parameters:{10241:9728,10240:9728,10242:33071,10243:33071}}),o=new el(t,{format:33189,width:i,height:s});this.collisionFBOs[r]=new yi(t,{id:\"Collision-\".concat(r),width:i,height:s,attachments:{36064:n,36096:o}})}destroyFBO(t){let r=this.collisionFBOs[t];for(let i of Object.values(r.attachments))i.delete();r.delete(),delete this.collisionFBOs[t]}};var Ndt={getCollisionPriority:{type:\"accessor\",value:0},collisionEnabled:!0,collisionGroup:{type:\"string\",value:\"default\"},collisionTestProps:{}},wm=class extends cc{getShaders(){return{modules:[QH]}}draw({uniforms:t,context:r,moduleParameters:i}){let{collisionEnabled:s}=this.props,{collisionFBO:n,drawToCollisionMap:o}=i,c=s&&!!n;t.collision_enabled=c,o&&(this.props=this.clone(this.props.collisionTestProps).props)}initializeState(t,r){var i;if(this.getAttributeManager()===null)return;(i=this.context.deck)===null||i===void 0||i._addDefaultEffect(new N2),this.getAttributeManager().add({collisionPriorities:{size:1,accessor:\"getCollisionPriority\",shaderAttributes:{collisionPriorities:{divisor:0},instanceCollisionPriorities:{divisor:1}}}})}getNeedsPickingBuffer(){return this.props.collisionEnabled}};G(wm,\"defaultProps\",Ndt);G(wm,\"extensionName\",\"CollisionFilterExtension\");var Ng=class extends zg{static extensionType;constructor(t,r){super(t,r)}},U2=class extends Ng{static extensionType=\"brushing\";extensionInstance;constructor(t,r,i){super(t,i),this.extensionInstance=new vm,r.initRegularAttribute(\"brushing_enabled\",\"brushingEnabled\"),r.initRegularAttribute(\"brushing_target\",\"brushingTarget\"),r.initRegularAttribute(\"brushing_radius\",\"brushingRadius\"),r.initVectorizedAccessor(\"get_brushing_target\",\"getBrushingTarget\"),r.extensionLayerPropertyNames=[...r.extensionLayerPropertyNames,\"brushingEnabled\",\"brushingTarget\",\"brushingRadius\",\"getBrushingTarget\"]}},V2=class extends Ng{static extensionType=\"collision-filter\";extensionInstance;constructor(t,r,i){super(t,i),this.extensionInstance=new wm,r.initRegularAttribute(\"collision_enabled\",\"collisionEnabled\"),r.initRegularAttribute(\"collision_group\",\"collisionGroup\"),r.initRegularAttribute(\"collision_test_props\",\"collisionTestProps\"),r.initVectorizedAccessor(\"get_collision_priority\",\"getCollisionPriority\"),r.extensionLayerPropertyNames=[...r.extensionLayerPropertyNames,\"collisionEnabled\",\"collisionGroup\",\"collisionTestProps\",\"getCollisionPriority\"]}},k3=class extends Ng{static extensionType=\"data-filter\";extensionInstance;constructor(t,r,i){super(t,i);let s=this.model.get(\"filter_size\");this.extensionInstance=new xm({filterSize:s}),r.initRegularAttribute(\"filter_enabled\",\"filterEnabled\"),r.initRegularAttribute(\"filter_range\",\"filterRange\"),r.initRegularAttribute(\"filter_soft_range\",\"filterSoftRange\"),r.initRegularAttribute(\"filter_transform_size\",\"filterTransformSize\"),r.initRegularAttribute(\"filter_transform_color\",\"filterTransformColor\"),r.initVectorizedAccessor(\"get_filter_value\",\"getFilterValue\"),r.extensionLayerPropertyNames=[...r.extensionLayerPropertyNames,\"filterEnabled\",\"filterRange\",\"filterSoftRange\",\"filterTransformSize\",\"filterTransformColor\",\"getFilterValue\"]}},j2=class extends Ng{static extensionType=\"path-style\";extensionInstance;constructor(t,r,i){super(t,i);let s=this.model.get(\"dash\"),n=this.model.get(\"high_precision_dash\"),o=this.model.get(\"offset\");this.extensionInstance=new bm({...Jt(s)?{dash:s}:{},...Jt(n)?{highPrecisionDash:n}:{},...Jt(o)?{offset:o}:{}}),r.initRegularAttribute(\"dash_gap_pickable\",\"dashGapPickable\"),r.initRegularAttribute(\"dash_justified\",\"dashJustified\"),r.initVectorizedAccessor(\"get_dash_array\",\"getDashArray\"),r.initVectorizedAccessor(\"get_offset\",\"getOffset\"),r.extensionLayerPropertyNames=[...r.extensionLayerPropertyNames,\"dashGapPickable\",\"dashJustified\",\"getDashArray\",\"getOffset\"]}};async function rB(e,t,r){let i=e.get(\"_extension_type\"),s;switch(i){case U2.extensionType:s=new U2(e,t,r);break;case V2.extensionType:s=new V2(e,t,r);break;case k3.extensionType:s=new k3(e,t,r);break;case j2.extensionType:s=new j2(e,t,r);break;default:throw new Error(`no known model for extension type ${i}`)}return await s.loadSubModels(),s}var Ug=class extends zg{pickable;visible;opacity;autoHighlight;extensions;extensionLayerPropertyNames=[];constructor(t,r){super(t,r),this.initRegularAttribute(\"pickable\",\"pickable\"),this.initRegularAttribute(\"visible\",\"visible\"),this.initRegularAttribute(\"opacity\",\"opacity\"),this.initRegularAttribute(\"auto_highlight\",\"autoHighlight\"),this.extensions=[]}async loadSubModels(){await this.initLayerExtensions()}extensionInstances(){return this.extensions.map(t=>t.extensionInstance)}extensionProps(){let t={};for(let r of this.extensionLayerPropertyNames)Jt(this[r])&&(t[r]=this[r]);return t}onClick(t){t.index&&(this.model.set(\"selected_index\",t.index),this.model.save_changes())}baseLayerProps(){return{extensions:this.extensionInstances(),...this.extensionProps(),id:this.model.model_id,pickable:this.pickable,visible:this.visible,opacity:this.opacity,autoHighlight:this.autoHighlight,onClick:this.onClick.bind(this)}}async initLayerExtensions(){let t=async()=>{let r=this.model.get(\"extensions\");if(!r){this.extensions=[];return}let i=await L3(this.model.widget_manager,r),s=[];for(let n of i){let o=await rB(n,this,this.updateStateCallback);s.push(o)}this.extensions=s};await t(),this.model.off(\"change:extensions\"),this.model.on(\"change:extensions\",t),this.callbacks.set(\"change:extensions\",t)}};var JH=`#define SHADER_NAME arc-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec4 instanceSourceColors;\nattribute vec4 instanceTargetColors;\nattribute vec3 instanceSourcePositions;\nattribute vec3 instanceSourcePositions64Low;\nattribute vec3 instanceTargetPositions;\nattribute vec3 instanceTargetPositions64Low;\nattribute vec3 instancePickingColors;\nattribute float instanceWidths;\nattribute float instanceHeights;\nattribute float instanceTilts;\n\nuniform bool greatCircle;\nuniform bool useShortestPath;\nuniform float numSegments;\nuniform float opacity;\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform int widthUnits;\n\nvarying vec4 vColor;\nvarying vec2 uv;\nvarying float isValid;\n\nfloat paraboloid(float distance, float sourceZ, float targetZ, float ratio) {\n\n float deltaZ = targetZ - sourceZ;\n float dh = distance * instanceHeights;\n if (dh == 0.0) {\n return sourceZ + deltaZ * ratio;\n }\n float unitZ = deltaZ / dh;\n float p2 = unitZ * unitZ + 1.0;\n float dir = step(deltaZ, 0.0);\n float z0 = mix(sourceZ, targetZ, dir);\n float r = mix(ratio, 1.0 - ratio, dir);\n return sqrt(r * (p2 - r)) * dh + z0;\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {\n vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize);\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n return dir_screenspace * offset_direction * width / 2.0;\n}\n\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (numSegments - 1.0));\n}\n\nvec3 interpolateFlat(vec3 source, vec3 target, float segmentRatio) {\n float distance = length(source.xy - target.xy);\n float z = paraboloid(distance, source.z, target.z, segmentRatio);\n\n float tiltAngle = radians(instanceTilts);\n vec2 tiltDirection = normalize(target.xy - source.xy);\n vec2 tilt = vec2(-tiltDirection.y, tiltDirection.x) * z * sin(tiltAngle);\n\n return vec3(\n mix(source.xy, target.xy, segmentRatio) + tilt,\n z * cos(tiltAngle)\n );\n}\nfloat getAngularDist (vec2 source, vec2 target) {\n vec2 sourceRadians = radians(source);\n vec2 targetRadians = radians(target);\n vec2 sin_half_delta = sin((sourceRadians - targetRadians) / 2.0);\n vec2 shd_sq = sin_half_delta * sin_half_delta;\n\n float a = shd_sq.y + cos(sourceRadians.y) * cos(targetRadians.y) * shd_sq.x;\n return 2.0 * asin(sqrt(a));\n}\n\nvec3 interpolateGreatCircle(vec3 source, vec3 target, vec3 source3D, vec3 target3D, float angularDist, float t) {\n vec2 lngLat;\n if(abs(angularDist - PI) < 0.001) {\n lngLat = (1.0 - t) * source.xy + t * target.xy;\n } else {\n float a = sin((1.0 - t) * angularDist);\n float b = sin(t * angularDist);\n vec3 p = source3D.yxz * a + target3D.yxz * b;\n lngLat = degrees(vec2(atan(p.y, -p.x), atan(p.z, length(p.xy))));\n }\n\n float z = paraboloid(angularDist * EARTH_RADIUS, source.z, target.z, t);\n\n return vec3(lngLat, z);\n}\n\nvoid main(void) {\n geometry.worldPosition = instanceSourcePositions;\n geometry.worldPositionAlt = instanceTargetPositions;\n\n float segmentIndex = positions.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n float prevSegmentRatio = getSegmentRatio(max(0.0, segmentIndex - 1.0));\n float nextSegmentRatio = getSegmentRatio(min(numSegments - 1.0, segmentIndex + 1.0));\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n isValid = 1.0;\n\n uv = vec2(segmentRatio, positions.y);\n geometry.uv = uv;\n geometry.pickingColor = instancePickingColors;\n\n vec4 curr;\n vec4 next;\n vec3 source;\n vec3 target;\n\n if ((greatCircle || project_uProjectionMode == PROJECTION_MODE_GLOBE) && project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n source = project_globe_(vec3(instanceSourcePositions.xy, 0.0));\n target = project_globe_(vec3(instanceTargetPositions.xy, 0.0));\n float angularDist = getAngularDist(instanceSourcePositions.xy, instanceTargetPositions.xy);\n\n vec3 prevPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, prevSegmentRatio);\n vec3 currPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, segmentRatio);\n vec3 nextPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, nextSegmentRatio);\n\n if (abs(currPos.x - prevPos.x) > 180.0) {\n indexDir = -1.0;\n isValid = 0.0;\n } else if (abs(currPos.x - nextPos.x) > 180.0) {\n indexDir = 1.0;\n isValid = 0.0;\n }\n nextPos = indexDir < 0.0 ? prevPos : nextPos;\n nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;\n\n if (isValid == 0.0) {\n nextPos.x += nextPos.x > 0.0 ? -360.0 : 360.0;\n float t = ((currPos.x > 0.0 ? 180.0 : -180.0) - currPos.x) / (nextPos.x - currPos.x);\n currPos = mix(currPos, nextPos, t);\n segmentRatio = mix(segmentRatio, nextSegmentRatio, t);\n }\n\n vec3 currPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, segmentRatio);\n vec3 nextPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, nextSegmentRatio);\n \n curr = project_position_to_clipspace(currPos, currPos64Low, vec3(0.0), geometry.position);\n next = project_position_to_clipspace(nextPos, nextPos64Low, vec3(0.0));\n \n } else {\n vec3 source_world = instanceSourcePositions;\n vec3 target_world = instanceTargetPositions;\n if (useShortestPath) {\n source_world.x = mod(source_world.x + 180., 360.0) - 180.;\n target_world.x = mod(target_world.x + 180., 360.0) - 180.;\n\n float deltaLng = target_world.x - source_world.x;\n if (deltaLng > 180.) target_world.x -= 360.;\n if (deltaLng < -180.) source_world.x -= 360.;\n }\n source = project_position(source_world, instanceSourcePositions64Low);\n target = project_position(target_world, instanceTargetPositions64Low);\n float antiMeridianX = 0.0;\n\n if (useShortestPath) {\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\n antiMeridianX = -(project_uCoordinateOrigin.x + 180.) / 360. * TILE_SIZE;\n }\n float thresholdRatio = (antiMeridianX - source.x) / (target.x - source.x);\n\n if (prevSegmentRatio <= thresholdRatio && nextSegmentRatio > thresholdRatio) {\n isValid = 0.0;\n indexDir = sign(segmentRatio - thresholdRatio);\n segmentRatio = thresholdRatio;\n }\n }\n\n nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;\n vec3 currPos = interpolateFlat(source, target, segmentRatio);\n vec3 nextPos = interpolateFlat(source, target, nextSegmentRatio);\n\n if (useShortestPath) {\n if (nextPos.x < antiMeridianX) {\n currPos.x += TILE_SIZE;\n nextPos.x += TILE_SIZE;\n }\n }\n\n curr = project_common_position_to_clipspace(vec4(currPos, 1.0));\n next = project_common_position_to_clipspace(vec4(nextPos, 1.0));\n geometry.position = vec4(currPos, 1.0);\n }\n float widthPixels = clamp(\n project_size_to_pixel(instanceWidths * widthScale, widthUnits),\n widthMinPixels, widthMaxPixels\n );\n vec3 offset = vec3(\n getExtrusionOffset((next.xy - curr.xy) * indexDir, positions.y, widthPixels),\n 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n DECKGL_FILTER_GL_POSITION(curr, geometry);\n gl_Position = curr + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);\n\n vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio);\n vColor = vec4(color.rgb, color.a * opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;var tq=`#define SHADER_NAME arc-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\nvarying vec2 uv;\nvarying float isValid;\n\nvoid main(void) {\n if (isValid == 0.0) {\n discard;\n }\n\n gl_FragColor = vColor;\n geometry.uv = uv;\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var R3=[0,0,0,255],Udt={getSourcePosition:{type:\"accessor\",value:e=>e.sourcePosition},getTargetPosition:{type:\"accessor\",value:e=>e.targetPosition},getSourceColor:{type:\"accessor\",value:R3},getTargetColor:{type:\"accessor\",value:R3},getWidth:{type:\"accessor\",value:1},getHeight:{type:\"accessor\",value:1},getTilt:{type:\"accessor\",value:0},greatCircle:!1,numSegments:{type:\"number\",value:50,min:1},widthUnits:\"pixels\",widthScale:{type:\"number\",value:1,min:0},widthMinPixels:{type:\"number\",value:0,min:0},widthMaxPixels:{type:\"number\",value:Number.MAX_SAFE_INTEGER,min:0}},Tp=class extends dn{constructor(...t){super(...t),G(this,\"state\",void 0)}getBounds(){var t;return(t=this.getAttributeManager())===null||t===void 0?void 0:t.getBounds([\"instanceSourcePositions\",\"instanceTargetPositions\"])}getShaders(){return super.getShaders({vs:JH,fs:tq,modules:[Rs,Ao]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getSourcePosition\"},instanceTargetPositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getTargetPosition\"},instanceSourceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getSourceColor\",defaultValue:R3},instanceTargetColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getTargetColor\",defaultValue:R3},instanceWidths:{size:1,transition:!0,accessor:\"getWidth\",defaultValue:1},instanceHeights:{size:1,transition:!0,accessor:\"getHeight\",defaultValue:1},instanceTilts:{size:1,transition:!0,accessor:\"getTilt\",defaultValue:0}})}updateState(t){super.updateState(t);let{props:r,oldProps:i,changeFlags:s}=t;if(s.extensionsChanged||s.propsChanged&&r.numSegments!==i.numSegments){var n;let{gl:o}=this.context;(n=this.state.model)===null||n===void 0||n.delete(),this.state.model=this._getModel(o),this.getAttributeManager().invalidateAll()}}draw({uniforms:t}){let{widthUnits:r,widthScale:i,widthMinPixels:s,widthMaxPixels:n,greatCircle:o,wrapLongitude:c}=this.props;this.state.model.setUniforms(t).setUniforms({greatCircle:o,widthUnits:po[r],widthScale:i,widthMinPixels:s,widthMaxPixels:n,useShortestPath:c}).draw()}_getModel(t){let{id:r,numSegments:i}=this.props,s=[];for(let o=0;o0&&j>0&&(c[I++]=w-n,c[I++]=w-n-1,c[I++]=w-1,c[I++]=w-n,c[I++]=w-1,c[I++]=w),w++}}return{vertexCount:o,positions:_,indices:c,texCoords:f}}function Gdt(e){let t=new Float64Array(12);for(let r=0;r 0.5) {\n vTexPos = geometry.worldPosition.xy;\n }\n\n vec4 color = vec4(0.0);\n DECKGL_FILTER_COLOR(color, geometry);\n}\n`;var Hdt=`\nvec3 packUVsIntoRGB(vec2 uv) {\n // Extract the top 8 bits. We want values to be truncated down so we can add a fraction\n vec2 uv8bit = floor(uv * 256.);\n\n // Calculate the normalized remainders of u and v parts that do not fit into 8 bits\n // Scale and clamp to 0-1 range\n vec2 uvFraction = fract(uv * 256.);\n vec2 uvFraction4bit = floor(uvFraction * 16.);\n\n // Remainder can be encoded in blue channel, encode as 4 bits for pixel coordinates\n float fractions = uvFraction4bit.x + uvFraction4bit.y * 16.;\n\n return vec3(uv8bit, fractions) / 255.;\n}\n`,rq=`\n#define SHADER_NAME bitmap-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D bitmapTexture;\n\nvarying vec2 vTexCoord;\nvarying vec2 vTexPos;\n\nuniform float desaturate;\nuniform vec4 transparentColor;\nuniform vec3 tintColor;\nuniform float opacity;\n\nuniform float coordinateConversion;\nuniform vec4 bounds;\n\n/* projection utils */\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / PI / 2.0;\n\n// from degrees to Web Mercator\nvec2 lnglat_to_mercator(vec2 lnglat) {\n float x = lnglat.x;\n float y = clamp(lnglat.y, -89.9, 89.9);\n return vec2(\n radians(x) + PI,\n PI + log(tan(PI * 0.25 + radians(y) * 0.5))\n ) * WORLD_SCALE;\n}\n\n// from Web Mercator to degrees\nvec2 mercator_to_lnglat(vec2 xy) {\n xy /= WORLD_SCALE;\n return degrees(vec2(\n xy.x - PI,\n atan(exp(xy.y - PI)) * 2.0 - PI * 0.5\n ));\n}\n/* End projection utils */\n\n// apply desaturation\nvec3 color_desaturate(vec3 color) {\n float luminance = (color.r + color.g + color.b) * 0.333333333;\n return mix(color, vec3(luminance), desaturate);\n}\n\n// apply tint\nvec3 color_tint(vec3 color) {\n return color * tintColor;\n}\n\n// blend with background color\nvec4 apply_opacity(vec3 color, float alpha) {\n if (transparentColor.a == 0.0) {\n return vec4(color, alpha);\n }\n float blendedAlpha = alpha + transparentColor.a * (1.0 - alpha);\n float highLightRatio = alpha / blendedAlpha;\n vec3 blendedRGB = mix(transparentColor.rgb, color, highLightRatio);\n return vec4(blendedRGB, blendedAlpha);\n}\n\nvec2 getUV(vec2 pos) {\n return vec2(\n (pos.x - bounds[0]) / (bounds[2] - bounds[0]),\n (pos.y - bounds[3]) / (bounds[1] - bounds[3])\n );\n}\n\n`.concat(Hdt,`\n\nvoid main(void) {\n vec2 uv = vTexCoord;\n if (coordinateConversion < -0.5) {\n vec2 lnglat = mercator_to_lnglat(vTexPos);\n uv = getUV(lnglat);\n } else if (coordinateConversion > 0.5) {\n vec2 commonPos = lnglat_to_mercator(vTexPos);\n uv = getUV(commonPos);\n }\n vec4 bitmapColor = texture2D(bitmapTexture, uv);\n\n gl_FragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * opacity);\n\n geometry.uv = uv;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n\n if (picking_uActive && !picking_uAttribute) {\n // Since instance information is not used, we can use picking color for pixel index\n gl_FragColor.rgb = packUVsIntoRGB(uv);\n }\n}\n`);var qdt={image:{type:\"image\",value:null,async:!0},bounds:{type:\"array\",value:[1,0,0,1],compare:!0},_imageCoordinateSystem:Yr.DEFAULT,desaturate:{type:\"number\",min:0,max:1,value:0},transparentColor:{type:\"color\",value:[0,0,0,0]},tintColor:{type:\"color\",value:[255,255,255]},textureParameters:{type:\"object\",ignore:!0}},Mp=class extends dn{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(){return super.getShaders({vs:eq,fs:rq,modules:[Rs,Ao]})}initializeState(){let t=this.getAttributeManager();t.remove([\"instancePickingColors\"]);let r=!0;t.add({indices:{size:1,isIndexed:!0,update:i=>i.value=this.state.mesh.indices,noAlloc:r},positions:{size:3,type:5130,fp64:this.use64bitPositions(),update:i=>i.value=this.state.mesh.positions,noAlloc:r},texCoords:{size:2,update:i=>i.value=this.state.mesh.texCoords,noAlloc:r}})}updateState({props:t,oldProps:r,changeFlags:i}){let s=this.getAttributeManager();if(i.extensionsChanged){var n;let{gl:o}=this.context;(n=this.state.model)===null||n===void 0||n.delete(),this.state.model=this._getModel(o),s.invalidateAll()}if(t.bounds!==r.bounds){let o=this.state.mesh,c=this._createMesh();this.state.model.setVertexCount(c.vertexCount);for(let f in c)o&&o[f]!==c[f]&&s.invalidate(f);this.setState({mesh:c,...this._getCoordinateUniforms()})}else t._imageCoordinateSystem!==r._imageCoordinateSystem&&this.setState(this._getCoordinateUniforms())}getPickingInfo(t){let{image:r}=this.props,i=t.info;if(!i.color||!r)return i.bitmap=null,i;let{width:s,height:n}=r;i.index=0;let o=Zdt(i.color),c=[Math.floor(o[0]*s),Math.floor(o[1]*n)];return i.bitmap={size:{width:s,height:n},uv:o,pixel:c},i}disablePickingIndex(){this.setState({disablePicking:!0})}restorePickingColors(){this.setState({disablePicking:!1})}_updateAutoHighlight(t){super._updateAutoHighlight({...t,color:this.encodePickingColor(0)})}_createMesh(){let{bounds:t}=this.props,r=t;return iq(t)&&(r=[[t[0],t[1]],[t[0],t[3]],[t[2],t[3]],[t[2],t[1]]]),iB(r,this.context.viewport.resolution)}_getModel(t){return t?new fn(t,{...this.getShaders(),id:this.props.id,geometry:new $n({drawMode:4,vertexCount:6}),isInstanced:!1}):null}draw(t){let{uniforms:r,moduleParameters:i}=t,{model:s,coordinateConversion:n,bounds:o,disablePicking:c}=this.state,{image:f,desaturate:_,transparentColor:w,tintColor:I}=this.props;i.pickingActive&&c||f&&s&&s.setUniforms(r).setUniforms({bitmapTexture:f,desaturate:_,transparentColor:w.map(R=>R/255),tintColor:I.slice(0,3).map(R=>R/255),coordinateConversion:n,bounds:o}).draw()}_getCoordinateUniforms(){let{LNGLAT:t,CARTESIAN:r,DEFAULT:i}=Yr,{_imageCoordinateSystem:s}=this.props;if(s!==i){let{bounds:n}=this.props;if(!iq(n))throw new Error(\"_imageCoordinateSystem only supports rectangular bounds\");let o=this.context.viewport.resolution?t:r;if(s=s===t?t:r,s===t&&o===r)return{coordinateConversion:-1,bounds:n};if(s===r&&o===t){let c=va([n[0],n[1]]),f=va([n[2],n[3]]);return{coordinateConversion:1,bounds:[c[0],c[1],f[0],f[1]]}}}return{coordinateConversion:0,bounds:[0,0,0,0]}}};G(Mp,\"layerName\",\"BitmapLayer\");G(Mp,\"defaultProps\",qdt);function Zdt(e){let[t,r,i]=e,s=(i&240)/256,n=(i&15)/16;return[(t+n)/256,(r+s)/256]}function iq(e){return Number.isFinite(e[0])}var nq=`#define SHADER_NAME icon-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute float instanceSizes;\nattribute float instanceAngles;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute vec4 instanceIconFrames;\nattribute float instanceColorModes;\nattribute vec2 instanceOffsets;\nattribute vec2 instancePixelOffset;\n\nuniform float sizeScale;\nuniform vec2 iconsTextureDim;\nuniform float sizeMinPixels;\nuniform float sizeMaxPixels;\nuniform bool billboard;\nuniform int sizeUnits;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\nvarying vec2 uv;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n float angle_radian = angle * PI / 180.0;\n float cos_angle = cos(angle_radian);\n float sin_angle = sin(angle_radian);\n mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n geometry.uv = positions;\n geometry.pickingColor = instancePickingColors;\n uv = positions;\n\n vec2 iconSize = instanceIconFrames.zw;\n float sizePixels = clamp(\n project_size_to_pixel(instanceSizes * sizeScale, sizeUnits), \n sizeMinPixels, sizeMaxPixels\n );\n float instanceScale = iconSize.y == 0.0 ? 0.0 : sizePixels / iconSize.y;\n vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;\n pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale;\n pixelOffset += instancePixelOffset;\n pixelOffset.y *= -1.0;\n\n if (billboard) {\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vec3 offset = vec3(pixelOffset, 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n\n } else {\n vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);\n DECKGL_FILTER_SIZE(offset_common, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); \n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n\n vTextureCoords = mix(\n instanceIconFrames.xy,\n instanceIconFrames.xy + iconSize,\n (positions.xy + 1.0) / 2.0\n ) / iconsTextureDim;\n\n vColor = instanceColors;\n DECKGL_FILTER_COLOR(vColor, geometry);\n\n vColorMode = instanceColorModes;\n}\n`;var sq=`#define SHADER_NAME icon-layer-fragment-shader\n\nprecision highp float;\n\nuniform float opacity;\nuniform sampler2D iconsTexture;\nuniform float alphaCutoff;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\nvarying vec2 uv;\n\nvoid main(void) {\n geometry.uv = uv;\n\n vec4 texColor = texture2D(iconsTexture, vTextureCoords);\n vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode);\n float a = texColor.a * opacity * vColor.a;\n\n if (a < alphaCutoff) {\n discard;\n }\n\n gl_FragColor = vec4(color, a);\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var Ydt=1024,Qdt=4,oq=()=>{},aq={10241:9987,10240:9729,10242:33071,10243:33071};function $dt(e){return Math.pow(2,Math.ceil(Math.log2(e)))}function Xdt(e,t,r,i){let s=Math.min(r/t.width,i/t.height),n=Math.floor(t.width*s),o=Math.floor(t.height*s);return s===1?{data:t,width:n,height:o}:(e.canvas.height=o,e.canvas.width=n,e.clearRect(0,0,n,o),e.drawImage(t,0,0,t.width,t.height,0,0,n,o),{data:e.canvas,width:n,height:o})}function G2(e){return e&&(e.id||e.url)}function Kdt(e,t,r,i){let s=e.width,n=e.height,o=new pi(e.gl,{width:t,height:r,parameters:i});return gE(e,o,{targetY:0,width:s,height:n}),e.delete(),o}function lq(e,t,r){for(let i=0;io&&(lq(r,c,s),i=0,s=n+s+t,n=0,c=[]),c.push({icon:_,xOffset:i}),i=i+R+t,n=Math.max(n,I)}}return c.length>0&&lq(r,c,s),{mapping:r,rowHeight:n,xOffset:i,yOffset:s,canvasWidth:o,canvasHeight:$dt(n+s+t)}}function tpt(e,t,r){if(!e||!t)return null;r=r||{};let i={},{iterable:s,objectInfo:n}=Jc(e);for(let o of s){n.index++;let c=t(o,n),f=G2(c);if(!c)throw new Error(\"Icon is missing.\");if(!c.url)throw new Error(\"Icon url is missing.\");!i[f]&&(!r[f]||c.url!==r[f].url)&&(i[f]={...c,source:o,sourceIndex:n.index})}return i}var W2=class{constructor(t,{onUpdate:r=oq,onError:i=oq}){G(this,\"gl\",void 0),G(this,\"onUpdate\",void 0),G(this,\"onError\",void 0),G(this,\"_loadOptions\",null),G(this,\"_texture\",null),G(this,\"_externalTexture\",null),G(this,\"_mapping\",{}),G(this,\"_textureParameters\",null),G(this,\"_pendingCount\",0),G(this,\"_autoPacking\",!1),G(this,\"_xOffset\",0),G(this,\"_yOffset\",0),G(this,\"_rowHeight\",0),G(this,\"_buffer\",Qdt),G(this,\"_canvasWidth\",Ydt),G(this,\"_canvasHeight\",0),G(this,\"_canvas\",null),this.gl=t,this.onUpdate=r,this.onError=i}finalize(){var t;(t=this._texture)===null||t===void 0||t.delete()}getTexture(){return this._texture||this._externalTexture}getIconMapping(t){let r=this._autoPacking?G2(t):t;return this._mapping[r]||{}}setProps({loadOptions:t,autoPacking:r,iconAtlas:i,iconMapping:s,textureParameters:n}){if(t&&(this._loadOptions=t),r!==void 0&&(this._autoPacking=r),s&&(this._mapping=s),i){var o;(o=this._texture)===null||o===void 0||o.delete(),this._texture=null,this._externalTexture=i}n&&(this._textureParameters=n)}get isLoaded(){return this._pendingCount===0}packIcons(t,r){if(!this._autoPacking||typeof document>\"u\")return;let i=Object.values(tpt(t,r,this._mapping)||{});if(i.length>0){let{mapping:s,xOffset:n,yOffset:o,rowHeight:c,canvasHeight:f}=Jdt({icons:i,buffer:this._buffer,canvasWidth:this._canvasWidth,mapping:this._mapping,rowHeight:this._rowHeight,xOffset:this._xOffset,yOffset:this._yOffset});this._rowHeight=c,this._mapping=s,this._xOffset=n,this._yOffset=o,this._canvasHeight=f,this._texture||(this._texture=new pi(this.gl,{width:this._canvasWidth,height:this._canvasHeight,parameters:this._textureParameters||aq})),this._texture.height!==this._canvasHeight&&(this._texture=Kdt(this._texture,this._canvasWidth,this._canvasHeight,this._textureParameters||aq)),this.onUpdate(),this._canvas=this._canvas||document.createElement(\"canvas\"),this._loadIcons(i)}}_loadIcons(t){let r=this._canvas.getContext(\"2d\",{willReadFrequently:!0});for(let i of t)this._pendingCount++,jA(i.url,this._loadOptions).then(s=>{let n=G2(i),o=this._mapping[n],{x:c,y:f,width:_,height:w}=o,{data:I,width:R,height:N}=Xdt(r,s,_,w);this._texture.setSubImageData({data:I,x:c+(_-R)/2,y:f+(w-N)/2,width:R,height:N}),o.width=R,o.height=N,this._texture.generateMipmap(),this.onUpdate()}).catch(s=>{this.onError({url:i.url,source:i.source,sourceIndex:i.sourceIndex,loadOptions:this._loadOptions,error:s})}).finally(()=>{this._pendingCount--})}};var cq=[0,0,0,255],ept={iconAtlas:{type:\"image\",value:null,async:!0},iconMapping:{type:\"object\",value:{},async:!0},sizeScale:{type:\"number\",value:1,min:0},billboard:!0,sizeUnits:\"pixels\",sizeMinPixels:{type:\"number\",min:0,value:0},sizeMaxPixels:{type:\"number\",min:0,value:Number.MAX_SAFE_INTEGER},alphaCutoff:{type:\"number\",value:.05,min:0,max:1},getPosition:{type:\"accessor\",value:e=>e.position},getIcon:{type:\"accessor\",value:e=>e.icon},getColor:{type:\"accessor\",value:cq},getSize:{type:\"accessor\",value:1},getAngle:{type:\"accessor\",value:0},getPixelOffset:{type:\"accessor\",value:[0,0]},onIconError:{type:\"function\",value:null,optional:!0},textureParameters:{type:\"object\",ignore:!0}},Ep=class extends dn{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(){return super.getShaders({vs:nq,fs:sq,modules:[Rs,Ao]})}initializeState(){this.state={iconManager:new W2(this.context.gl,{onUpdate:this._onUpdate.bind(this),onError:this._onError.bind(this)})},this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getPosition\"},instanceSizes:{size:1,transition:!0,accessor:\"getSize\",defaultValue:1},instanceOffsets:{size:2,accessor:\"getIcon\",transform:this.getInstanceOffset},instanceIconFrames:{size:4,accessor:\"getIcon\",transform:this.getInstanceIconFrame},instanceColorModes:{size:1,type:5121,accessor:\"getIcon\",transform:this.getInstanceColorMode},instanceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getColor\",defaultValue:cq},instanceAngles:{size:1,transition:!0,accessor:\"getAngle\"},instancePixelOffset:{size:2,transition:!0,accessor:\"getPixelOffset\"}})}updateState(t){super.updateState(t);let{props:r,oldProps:i,changeFlags:s}=t,n=this.getAttributeManager(),{iconAtlas:o,iconMapping:c,data:f,getIcon:_,textureParameters:w}=r,{iconManager:I}=this.state,R=o||this.internalState.isAsyncPropLoading(\"iconAtlas\");if(I.setProps({loadOptions:r.loadOptions,autoPacking:!R,iconAtlas:o,iconMapping:R?c:null,textureParameters:w}),R?i.iconMapping!==r.iconMapping&&n.invalidate(\"getIcon\"):(s.dataChanged||s.updateTriggersChanged&&(s.updateTriggersChanged.all||s.updateTriggersChanged.getIcon))&&I.packIcons(f,_),s.extensionsChanged){var N;let{gl:j}=this.context;(N=this.state.model)===null||N===void 0||N.delete(),this.state.model=this._getModel(j),n.invalidateAll()}}get isLoaded(){return super.isLoaded&&this.state.iconManager.isLoaded}finalizeState(t){super.finalizeState(t),this.state.iconManager.finalize()}draw({uniforms:t}){let{sizeScale:r,sizeMinPixels:i,sizeMaxPixels:s,sizeUnits:n,billboard:o,alphaCutoff:c}=this.props,{iconManager:f}=this.state,_=f.getTexture();_&&this.state.model.setUniforms(t).setUniforms({iconsTexture:_,iconsTextureDim:[_.width,_.height],sizeUnits:po[n],sizeScale:r,sizeMinPixels:i,sizeMaxPixels:s,billboard:o,alphaCutoff:c}).draw()}_getModel(t){let r=[-1,-1,-1,1,1,1,1,-1];return new fn(t,{...this.getShaders(),id:this.props.id,geometry:new $n({drawMode:6,attributes:{positions:{size:2,value:new Float32Array(r)}}}),isInstanced:!0})}_onUpdate(){this.setNeedsRedraw()}_onError(t){var r;let i=(r=this.getCurrentLayer())===null||r===void 0?void 0:r.props.onIconError;i?i(t):or.error(t.error.message)()}getInstanceOffset(t){let{width:r,height:i,anchorX:s=r/2,anchorY:n=i/2}=this.state.iconManager.getIconMapping(t);return[r/2-s,i/2-n]}getInstanceColorMode(t){return this.state.iconManager.getIconMapping(t).mask?1:0}getInstanceIconFrame(t){let{x:r,y:i,width:s,height:n}=this.state.iconManager.getIconMapping(t);return[r,i,s,n]}};G(Ep,\"defaultProps\",ept);G(Ep,\"layerName\",\"IconLayer\");var uq=`#define SHADER_NAME point-cloud-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 instanceNormals;\nattribute vec4 instanceColors;\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute vec3 instancePickingColors;\n\nuniform float opacity;\nuniform float radiusPixels;\nuniform int sizeUnits;\n\nvarying vec4 vColor;\nvarying vec2 unitPosition;\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n geometry.normal = project_normal(instanceNormals);\n unitPosition = positions.xy;\n geometry.uv = unitPosition;\n geometry.pickingColor = instancePickingColors;\n vec3 offset = vec3(positions.xy * project_size_to_pixel(radiusPixels, sizeUnits), 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n vec3 lightColor = lighting_getLightColor(instanceColors.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal);\n vColor = vec4(lightColor, instanceColors.a * opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;var hq=`#define SHADER_NAME point-cloud-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\nvarying vec2 unitPosition;\n\nvoid main(void) {\n geometry.uv = unitPosition;\n\n float distToCenter = length(unitPosition);\n\n if (distToCenter > 1.0) {\n discard;\n }\n\n gl_FragColor = vColor;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var fq=[0,0,0,255],dq=[0,0,1],rpt={sizeUnits:\"pixels\",pointSize:{type:\"number\",min:0,value:10},getPosition:{type:\"accessor\",value:e=>e.position},getNormal:{type:\"accessor\",value:dq},getColor:{type:\"accessor\",value:fq},material:!0,radiusPixels:{deprecatedFor:\"pointSize\"}};function ipt(e){let{header:t,attributes:r}=e;!t||!r||(e.length=t.vertexCount,r.POSITION&&(r.instancePositions=r.POSITION),r.NORMAL&&(r.instanceNormals=r.NORMAL),r.COLOR_0&&(r.instanceColors=r.COLOR_0))}var Pp=class extends dn{getShaders(){return super.getShaders({vs:uq,fs:hq,modules:[Rs,Zf,Ao]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getPosition\"},instanceNormals:{size:3,transition:!0,accessor:\"getNormal\",defaultValue:dq},instanceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getColor\",defaultValue:fq}})}updateState(t){let{changeFlags:r,props:i}=t;if(super.updateState(t),r.extensionsChanged){var s;let{gl:n}=this.context;(s=this.state.model)===null||s===void 0||s.delete(),this.state.model=this._getModel(n),this.getAttributeManager().invalidateAll()}r.dataChanged&&ipt(i.data)}draw({uniforms:t}){let{pointSize:r,sizeUnits:i}=this.props;this.state.model.setUniforms(t).setUniforms({sizeUnits:po[i],radiusPixels:r}).draw()}_getModel(t){let r=[];for(let i=0;i<3;i++){let s=i/3*Math.PI*2;r.push(Math.cos(s)*2,Math.sin(s)*2,0)}return new fn(t,{...this.getShaders(),id:this.props.id,geometry:new $n({drawMode:4,attributes:{positions:new Float32Array(r)}}),isInstanced:!0})}};G(Pp,\"layerName\",\"PointCloudLayer\");G(Pp,\"defaultProps\",rpt);var pq=`#define SHADER_NAME scatterplot-layer-vertex-shader\n\nattribute vec3 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute float instanceRadius;\nattribute float instanceLineWidths;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\nuniform float opacity;\nuniform float radiusScale;\nuniform float radiusMinPixels;\nuniform float radiusMaxPixels;\nuniform float lineWidthScale;\nuniform float lineWidthMinPixels;\nuniform float lineWidthMaxPixels;\nuniform float stroked;\nuniform bool filled;\nuniform bool antialiasing;\nuniform bool billboard;\nuniform int radiusUnits;\nuniform int lineWidthUnits;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying vec2 unitPosition;\nvarying float innerUnitRadius;\nvarying float outerRadiusPixels;\n\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n outerRadiusPixels = clamp(\n project_size_to_pixel(radiusScale * instanceRadius, radiusUnits),\n radiusMinPixels, radiusMaxPixels\n );\n float lineWidthPixels = clamp(\n project_size_to_pixel(lineWidthScale * instanceLineWidths, lineWidthUnits),\n lineWidthMinPixels, lineWidthMaxPixels\n );\n outerRadiusPixels += stroked * lineWidthPixels / 2.0;\n float edgePadding = antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0;\n unitPosition = edgePadding * positions.xy;\n geometry.uv = unitPosition;\n geometry.pickingColor = instancePickingColors;\n\n innerUnitRadius = 1.0 - stroked * lineWidthPixels / outerRadiusPixels;\n \n if (billboard) {\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vec3 offset = edgePadding * positions * outerRadiusPixels;\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n } else {\n vec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);\n DECKGL_FILTER_COLOR(vFillColor, geometry);\n vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);\n DECKGL_FILTER_COLOR(vLineColor, geometry);\n}\n`;var Aq=`#define SHADER_NAME scatterplot-layer-fragment-shader\n\nprecision highp float;\n\nuniform bool filled;\nuniform float stroked;\nuniform bool antialiasing;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying vec2 unitPosition;\nvarying float innerUnitRadius;\nvarying float outerRadiusPixels;\n\nvoid main(void) {\n geometry.uv = unitPosition;\n\n float distToCenter = length(unitPosition) * outerRadiusPixels;\n float inCircle = antialiasing ? \n smoothedge(distToCenter, outerRadiusPixels) : \n step(distToCenter, outerRadiusPixels);\n\n if (inCircle == 0.0) {\n discard;\n }\n\n if (stroked > 0.5) {\n float isLine = antialiasing ? \n smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) :\n step(innerUnitRadius * outerRadiusPixels, distToCenter);\n\n if (filled) {\n gl_FragColor = mix(vFillColor, vLineColor, isLine);\n } else {\n if (isLine == 0.0) {\n discard;\n }\n gl_FragColor = vec4(vLineColor.rgb, vLineColor.a * isLine);\n }\n } else if (!filled) {\n discard;\n } else {\n gl_FragColor = vFillColor;\n }\n\n gl_FragColor.a *= inCircle;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var mq=[0,0,0,255],npt={radiusUnits:\"meters\",radiusScale:{type:\"number\",min:0,value:1},radiusMinPixels:{type:\"number\",min:0,value:0},radiusMaxPixels:{type:\"number\",min:0,value:Number.MAX_SAFE_INTEGER},lineWidthUnits:\"meters\",lineWidthScale:{type:\"number\",min:0,value:1},lineWidthMinPixels:{type:\"number\",min:0,value:0},lineWidthMaxPixels:{type:\"number\",min:0,value:Number.MAX_SAFE_INTEGER},stroked:!1,filled:!0,billboard:!1,antialiasing:!0,getPosition:{type:\"accessor\",value:e=>e.position},getRadius:{type:\"accessor\",value:1},getFillColor:{type:\"accessor\",value:mq},getLineColor:{type:\"accessor\",value:mq},getLineWidth:{type:\"accessor\",value:1},strokeWidth:{deprecatedFor:\"getLineWidth\"},outline:{deprecatedFor:\"stroked\"},getColor:{deprecatedFor:[\"getFillColor\",\"getLineColor\"]}},Ku=class extends dn{getShaders(){return super.getShaders({vs:pq,fs:Aq,modules:[Rs,Ao]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getPosition\"},instanceRadius:{size:1,transition:!0,accessor:\"getRadius\",defaultValue:1},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,normalized:!0,type:5121,accessor:\"getFillColor\",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,normalized:!0,type:5121,accessor:\"getLineColor\",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:\"getLineWidth\",defaultValue:1}})}updateState(t){if(super.updateState(t),t.changeFlags.extensionsChanged){var r;let{gl:i}=this.context;(r=this.state.model)===null||r===void 0||r.delete(),this.state.model=this._getModel(i),this.getAttributeManager().invalidateAll()}}draw({uniforms:t}){let{radiusUnits:r,radiusScale:i,radiusMinPixels:s,radiusMaxPixels:n,stroked:o,filled:c,billboard:f,antialiasing:_,lineWidthUnits:w,lineWidthScale:I,lineWidthMinPixels:R,lineWidthMaxPixels:N}=this.props;this.state.model.setUniforms(t).setUniforms({stroked:o?1:0,filled:c,billboard:f,antialiasing:_,radiusUnits:po[r],radiusScale:i,radiusMinPixels:s,radiusMaxPixels:n,lineWidthUnits:po[w],lineWidthScale:I,lineWidthMinPixels:R,lineWidthMaxPixels:N}).draw()}_getModel(t){let r=[-1,-1,0,1,-1,0,1,1,0,-1,1,0];return new fn(t,{...this.getShaders(),id:this.props.id,geometry:new $n({drawMode:6,vertexCount:4,attributes:{positions:{size:3,value:new Float32Array(r)}}}),isInstanced:!0})}};G(Ku,\"defaultProps\",npt);G(Ku,\"layerName\",\"ScatterplotLayer\");var Kv={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function Vg(e,t,r={}){return gq(e,r)!==t?(spt(e,r),!0):!1}function gq(e,t={}){return Math.sign(D3(e,t))}function D3(e,t={}){let{start:r=0,end:i=e.length}=t,s=t.size||2,n=0;for(let o=r,c=i-s;o0){let s=!0;for(let n=0;nt[2]&&(r|=2),e[1]t[3]&&(r|=8),r}function Z2(e,t){let{size:r=2,broken:i=!1,gridResolution:s=10,gridOffset:n=[0,0],startIndex:o=0,endIndex:c=e.length}=t||{},f=(c-o)/r,_=[],w=[_],I=Sm(e,0,r,o),R,N,j=vq(I,s,n,[]),Q=[];xc(_,I);for(let et=1;etr&&(_=[],w.push(_),xc(_,I)),N=q2(R,j)}xc(_,R),H2(I,R)}return i?w:w[0]}var _q=0,apt=1;function B3(e,t){for(let r=0;r=0?(xc(_,N)&&I.push(Q),ut+=j):I.length&&(I[I.length-1]=_q),H2(et,N),Y=j,K=Q;return[J?{pos:f,types:t&&w}:null,ut?{pos:_,types:t&&I}:null]}function vq(e,t,r,i){let s=Math.floor((e[0]-r[0])/t)*t+r[0],n=Math.floor((e[1]-r[1])/t)*t+r[1];return i[0]=s,i[1]=n,i[2]=s+t,i[3]=n+t,i}function lpt(e,t,r){r&8?(e[1]+=t,e[3]+=t):r&4?(e[1]-=t,e[3]-=t):r&2?(e[0]+=t,e[2]+=t):r&1&&(e[0]-=t,e[2]-=t)}function cpt(e,t,r,i){let s=1/0,n=-1/0,o=1/0,c=-1/0;for(let f=0;fn?_:n,o=wc?w:c}return i[0][0]=s,i[0][1]=o,i[1][0]=n,i[1][1]=c,i}var upt=85.051129;function nB(e,t){let{size:r=2,startIndex:i=0,endIndex:s=e.length,normalize:n=!0}=t||{},o=e.slice(i,s);xq(o,r,0,s-i);let c=Z2(o,{size:r,broken:!0,gridResolution:360,gridOffset:[-180,-180]});if(n)for(let f of c)bq(f,r);return c}function sB(e,t=null,r){let{size:i=2,normalize:s=!0,edgeTypes:n=!1}=r||{};t=t||[];let o=[],c=[],f=0,_=0;for(let I=0;I<=t.length;I++){let R=t[I]||e.length,N=_,j=hpt(e,i,f,R);for(let Q=j;Qs&&(s=c,n=o-1)}return n}function fpt(e,t,r,i,s=upt){let n=e[r],o=e[i-t];if(Math.abs(n-o)>180){let c=Sm(e,0,t,r);c[0]+=Math.round((o-n)/360)*360,xc(e,c),c[1]=Math.sign(c[1])*s,xc(e,c),c[0]=n,xc(e,c)}}function xq(e,t,r,i){let s=e[0],n;for(let o=r;o180||c<-180)&&(n-=Math.round(c/360)*360),e[o]=s=n}}function bq(e,t){let r,i=e.length/t;for(let n=0;n=i),s=s.flatMap(N=>[N[0],N[1]]),Vg(s,Kv.COUNTER_CLOCKWISE));let n=r>0,o=i+1,c=n?o*3+1:i,f=Math.PI*2/i,_=new Uint16Array(n?i*3*2:0),w=new Float32Array(c*3),I=new Float32Array(c*3),R=0;if(n){for(let N=0;N 0.0 && instanceElevations >= 0.0);\n float dotRadius = radius * coverage * shouldRender;\n\n geometry.pickingColor = instancePickingColors;\n vec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation);\n vec3 centroidPosition64Low = instancePositions64Low;\n vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + offset) * dotRadius;\n if (radiusUnits == UNIT_METERS) {\n offset = project_size(offset);\n }\n vec3 pos = vec3(offset, 0.);\n DECKGL_FILTER_SIZE(pos, geometry);\n\n gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);\n geometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z));\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n if (extruded && !isStroke) {\n#ifdef FLAT_SHADING\n position_commonspace = geometry.position;\n vColor = vec4(color.rgb, color.a * opacity);\n#else\n vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal);\n vColor = vec4(lightColor, color.a * opacity);\n#endif\n } else {\n vColor = vec4(color.rgb, color.a * opacity);\n }\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;var Sq=`#version 300 es\n#define SHADER_NAME column-layer-fragment-shader\n\nprecision highp float;\n\nuniform vec3 project_uCameraPosition;\nuniform bool extruded;\nuniform bool isStroke;\n\nout vec4 fragColor;\n\nin vec4 vColor;\n#ifdef FLAT_SHADING\nin vec4 position_commonspace;\n#endif\n\nvoid main(void) {\n fragColor = vColor;\n#ifdef FLAT_SHADING\n if (extruded && !isStroke && !picking_uActive) {\n vec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n fragColor.rgb = lighting_getLightColor(vColor.rgb, project_uCameraPosition, position_commonspace.xyz, normal);\n }\n#endif\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`;var F3=[0,0,0,255],Apt={diskResolution:{type:\"number\",min:4,value:20},vertices:null,radius:{type:\"number\",min:0,value:1e3},angle:{type:\"number\",value:0},offset:{type:\"array\",value:[0,0]},coverage:{type:\"number\",min:0,max:1,value:1},elevationScale:{type:\"number\",min:0,value:1},radiusUnits:\"meters\",lineWidthUnits:\"meters\",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,extruded:!0,wireframe:!1,filled:!0,stroked:!1,getPosition:{type:\"accessor\",value:e=>e.position},getFillColor:{type:\"accessor\",value:F3},getLineColor:{type:\"accessor\",value:F3},getLineWidth:{type:\"accessor\",value:1},getElevation:{type:\"accessor\",value:1e3},material:!0,getColor:{deprecatedFor:[\"getFillColor\",\"getLineColor\"]}},af=class extends dn{getShaders(){let{gl:t}=this.context,r=!fr(t),i={},s=this.props.flatShading&&$0(t,Ii.GLSL_DERIVATIVES);return s&&(i.FLAT_SHADING=1),super.getShaders({vs:wq,fs:Sq,defines:i,transpileToGLSL100:r,modules:[Rs,s?Ny:Zf,Ao]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getPosition\"},instanceElevations:{size:1,transition:!0,accessor:\"getElevation\"},instanceFillColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getFillColor\",defaultValue:F3},instanceLineColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:\"getLineColor\",defaultValue:F3},instanceStrokeWidths:{size:1,accessor:\"getLineWidth\",transition:!0}})}updateState(t){super.updateState(t);let{props:r,oldProps:i,changeFlags:s}=t,n=s.extensionsChanged||r.flatShading!==i.flatShading;if(n){var o;let{gl:c}=this.context;(o=this.state.model)===null||o===void 0||o.delete(),this.state.model=this._getModel(c),this.getAttributeManager().invalidateAll()}(n||r.diskResolution!==i.diskResolution||r.vertices!==i.vertices||(r.extruded||r.stroked)!==(i.extruded||i.stroked))&&this._updateGeometry(r)}getGeometry(t,r,i){let s=new Q2({radius:1,height:i?2:0,vertices:r,nradial:t}),n=0;if(r)for(let o=0;o=t.length&&(r+=1-t.length/s);let n=r*s;return i[0]=t[n],i[1]=t[n+1],i[2]=s===3&&t[n+2]||0,i}isClosed(t){if(!this.normalize)return!!this.opts.loop;let{positionSize:r}=this,i=t.length-r;return t[0]===t[i]&&t[1]===t[i+1]&&(r===2||t[2]===t[i+2])}};function Mq(e){return Array.isArray(e[0])}var Eq=`#define SHADER_NAME path-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute float instanceTypes;\nattribute vec3 instanceStartPositions;\nattribute vec3 instanceEndPositions;\nattribute vec3 instanceLeftPositions;\nattribute vec3 instanceRightPositions;\nattribute vec3 instanceLeftPositions64Low;\nattribute vec3 instanceStartPositions64Low;\nattribute vec3 instanceEndPositions64Low;\nattribute vec3 instanceRightPositions64Low;\nattribute float instanceStrokeWidths;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform float jointType;\nuniform float capType;\nuniform float miterLimit;\nuniform bool billboard;\nuniform int widthUnits;\n\nuniform float opacity;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vPathPosition;\nvarying float vPathLength;\nvarying float vJointType;\n\nconst float EPSILON = 0.001;\nconst vec3 ZERO_OFFSET = vec3(0.0);\n\nfloat flipIfTrue(bool flag) {\n return -(float(flag) * 2. - 1.);\n}\nvec3 getLineJoinOffset(\n vec3 prevPoint, vec3 currPoint, vec3 nextPoint,\n vec2 width\n) {\n bool isEnd = positions.x > 0.0;\n float sideOfPath = positions.y;\n float isJoint = float(sideOfPath == 0.0);\n\n vec3 deltaA3 = (currPoint - prevPoint);\n vec3 deltaB3 = (nextPoint - currPoint);\n\n mat3 rotationMatrix;\n bool needsRotation = !billboard && project_needs_rotation(currPoint, rotationMatrix);\n if (needsRotation) {\n deltaA3 = deltaA3 * rotationMatrix;\n deltaB3 = deltaB3 * rotationMatrix;\n }\n vec2 deltaA = deltaA3.xy / width;\n vec2 deltaB = deltaB3.xy / width;\n\n float lenA = length(deltaA);\n float lenB = length(deltaB);\n\n vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0);\n vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0);\n\n vec2 perpA = vec2(-dirA.y, dirA.x);\n vec2 perpB = vec2(-dirB.y, dirB.x);\n vec2 tangent = dirA + dirB;\n tangent = length(tangent) > 0. ? normalize(tangent) : perpA;\n vec2 miterVec = vec2(-tangent.y, tangent.x);\n vec2 dir = isEnd ? dirA : dirB;\n vec2 perp = isEnd ? perpA : perpB;\n float L = isEnd ? lenA : lenB;\n float sinHalfA = abs(dot(miterVec, perp));\n float cosHalfA = abs(dot(dirA, miterVec));\n float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x);\n float cornerPosition = sideOfPath * turnDirection;\n\n float miterSize = 1.0 / max(sinHalfA, EPSILON);\n miterSize = mix(\n min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)),\n miterSize,\n step(0.0, cornerPosition)\n );\n\n vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition))\n * (sideOfPath + isJoint * turnDirection);\n bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0));\n bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0));\n bool isCap = isStartCap || isEndCap;\n if (isCap) {\n offsetVec = mix(perp * sideOfPath, dir * capType * 4.0 * flipIfTrue(isStartCap), isJoint);\n vJointType = capType;\n } else {\n vJointType = jointType;\n }\n vPathLength = L;\n vCornerOffset = offsetVec;\n vMiterLength = dot(vCornerOffset, miterVec * turnDirection);\n vMiterLength = isCap ? isJoint : vMiterLength;\n\n vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd);\n vPathPosition = vec2(\n dot(offsetFromStartOfPath, perp),\n dot(offsetFromStartOfPath, dir)\n );\n geometry.uv = vPathPosition;\n\n float isValid = step(instanceTypes, 3.5);\n vec3 offset = vec3(offsetVec * width * isValid, 0.0);\n\n if (needsRotation) {\n offset = rotationMatrix * offset;\n }\n return offset;\n}\nvoid clipLine(inout vec4 position, vec4 refPosition) {\n if (position.w < EPSILON) {\n float r = (EPSILON - refPosition.w) / (position.w - refPosition.w);\n position = refPosition + (position - refPosition) * r;\n }\n}\n\nvoid main() {\n geometry.pickingColor = instancePickingColors;\n\n vColor = vec4(instanceColors.rgb, instanceColors.a * opacity);\n\n float isEnd = positions.x;\n\n vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd);\n vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd);\n\n vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);\n vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd);\n\n vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd);\n vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd);\n\n geometry.worldPosition = currPosition;\n vec2 widthPixels = vec2(clamp(\n project_size_to_pixel(instanceStrokeWidths * widthScale, widthUnits),\n widthMinPixels, widthMaxPixels) / 2.0);\n vec3 width;\n\n if (billboard) {\n vec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET);\n vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position);\n vec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET);\n\n clipLine(prevPositionScreen, currPositionScreen);\n clipLine(nextPositionScreen, currPositionScreen);\n clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd));\n\n width = vec3(widthPixels, 0.0);\n DECKGL_FILTER_SIZE(width, geometry);\n\n vec3 offset = getLineJoinOffset(\n prevPositionScreen.xyz / prevPositionScreen.w,\n currPositionScreen.xyz / currPositionScreen.w,\n nextPositionScreen.xyz / nextPositionScreen.w,\n project_pixel_size_to_clipspace(width.xy)\n );\n\n DECKGL_FILTER_GL_POSITION(currPositionScreen, geometry);\n gl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w);\n } else {\n prevPosition = project_position(prevPosition, prevPosition64Low);\n currPosition = project_position(currPosition, currPosition64Low);\n nextPosition = project_position(nextPosition, nextPosition64Low);\n\n width = vec3(project_pixel_size(widthPixels), 0.0);\n DECKGL_FILTER_SIZE(width, geometry);\n\n vec3 offset = getLineJoinOffset(prevPosition, currPosition, nextPosition, width.xy);\n geometry.position = vec4(currPosition + offset, 1.0);\n gl_Position = project_common_position_to_clipspace(geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;var Pq=`#define SHADER_NAME path-layer-fragment-shader\n\nprecision highp float;\n\nuniform float miterLimit;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vPathPosition;\nvarying float vPathLength;\nvarying float vJointType;\n\nvoid main(void) {\n geometry.uv = vPathPosition;\n\n if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) {\n if (vJointType > 0.5 && length(vCornerOffset) > 1.0) {\n discard;\n }\n if (vJointType < 0.5 && vMiterLength > miterLimit + 1.0) {\n discard;\n }\n }\n gl_FragColor = vColor;\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var Iq=[0,0,0,255],_pt={widthUnits:\"meters\",widthScale:{type:\"number\",min:0,value:1},widthMinPixels:{type:\"number\",min:0,value:0},widthMaxPixels:{type:\"number\",min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:\"number\",min:0,value:4},billboard:!1,_pathType:null,getPath:{type:\"accessor\",value:e=>e.path},getColor:{type:\"accessor\",value:Iq},getWidth:{type:\"accessor\",value:1},rounded:{deprecatedFor:[\"jointRounded\",\"capRounded\"]}},aB={enter:(e,t)=>t.length?t.subarray(t.length-e.length):e},bc=class extends dn{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(){return super.getShaders({vs:Eq,fs:Pq,modules:[Rs,Ao]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({positions:{size:3,vertexOffset:1,type:5130,fp64:this.use64bitPositions(),transition:aB,accessor:\"getPath\",update:this.calculatePositions,noAlloc:!0,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}},instanceTypes:{size:1,type:5121,update:this.calculateSegmentTypes,noAlloc:!0},instanceStrokeWidths:{size:1,accessor:\"getWidth\",transition:aB,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,accessor:\"getColor\",transition:aB,defaultValue:Iq},instancePickingColors:{size:3,type:5121,accessor:(i,{index:s,target:n})=>this.encodePickingColor(i&&i.__source?i.__source.index:s,n)}}),this.setState({pathTesselator:new $2({fp64:this.use64bitPositions()})})}updateState(t){super.updateState(t);let{props:r,changeFlags:i}=t,s=this.getAttributeManager();if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPath)){let{pathTesselator:c}=this.state,f=r.data.attributes||{};c.updateGeometry({data:r.data,geometryBuffer:f.getPath,buffers:f,normalize:!r._pathType,loop:r._pathType===\"loop\",getGeometry:r.getPath,positionFormat:r.positionFormat,wrapLongitude:r.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:i.dataChanged}),this.setState({numInstances:c.instanceCount,startIndices:c.vertexStarts}),i.dataChanged||s.invalidateAll()}if(i.extensionsChanged){var o;let{gl:c}=this.context;(o=this.state.model)===null||o===void 0||o.delete(),this.state.model=this._getModel(c),s.invalidateAll()}}getPickingInfo(t){let r=super.getPickingInfo(t),{index:i}=r,{data:s}=this.props;return s[0]&&s[0].__source&&(r.object=s.find(n=>n.__source.index===i)),r}disablePickingIndex(t){let{data:r}=this.props;if(r[0]&&r[0].__source)for(let i=0;i=1&&e[0].length>=2&&Number.isFinite(e[0][0])}function Fpt(e){let t=e[0],r=e[e.length-1];return t[0]===r[0]&&t[1]===r[1]&&t[2]===r[2]}function zpt(e,t,r,i){for(let s=0;sc/t));let n=tx(e),o=i&&t===3;if(r){let c=n.length;n=n.slice();let f=[];for(let _=0;_f&&c>_||(f>_?(r||(n=n.slice()),zq(n,0,2,1)):(r||(n=n.slice()),zq(n,2,0,1)))}return(0,Nq.default)(n,s,t)}var eS=class extends rm{constructor(t){let{fp64:r,IndexType:i=Uint32Array}=t;super({...t,attributes:{positions:{size:3,type:r?Float64Array:Float32Array},vertexValid:{type:Uint8ClampedArray,size:1},indices:{type:i,size:1}}})}get(t){let{attributes:r}=this;return t===\"indices\"?r.indices&&r.indices.subarray(0,this.vertexCount):r[t]}updateGeometry(t){super.updateGeometry(t);let r=this.buffers.indices;if(r)this.vertexCount=(r.value||r).length;else if(this.data&&!this.getGeometry)throw new Error(\"missing indices buffer\")}normalizeGeometry(t){if(this.normalize){let r=G3(t,this.positionSize);return this.opts.resolution?Y2(tx(r),tS(r),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0}):this.opts.wrapLongitude?sB(tx(r),tS(r),{size:this.positionSize,maxLatitude:86,edgeTypes:!0}):r}return t}getGeometrySize(t){if(jq(t)){let r=0;for(let i of t)r+=this.getGeometrySize(i);return r}return tx(t).length/this.positionSize}getGeometryFromBuffer(t){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(t):null}updateGeometryAttributes(t,r){if(t&&jq(t))for(let i of t){let s=this.getGeometrySize(i);r.geometrySize=s,this.updateGeometryAttributes(i,r),r.vertexStart+=s,r.indexStart=this.indexStarts[r.geometryIndex+1]}else this._updateIndices(t,r),this._updatePositions(t,r),this._updateVertexValid(t,r)}_updateIndices(t,{geometryIndex:r,vertexStart:i,indexStart:s}){let{attributes:n,indexStarts:o,typedArrayManager:c}=this,f=n.indices;if(!f||!t)return;let _=s,w=Uq(t,this.positionSize,this.opts.preproject,this.opts.full3d);f=c.allocate(f,s+w.length,{copy:!0});for(let I=0;I2?o[f*n+2]:0;s[c*3]=_,s[c*3+1]=w,s[c*3+2]=I}}_updateVertexValid(t,{vertexStart:r,geometrySize:i}){let{positionSize:s}=this,n=this.attributes.vertexValid,o=t&&tS(t);if(t&&t.edgeTypes?n.set(t.edgeTypes,r):n.fill(1,r,r+i),o)for(let c=0;c0&&!Number.isFinite(e[0])}var W3=`\nattribute vec2 vertexPositions;\nattribute float vertexValid;\n\nuniform bool extruded;\nuniform bool isWireframe;\nuniform float elevationScale;\nuniform float opacity;\n\nvarying vec4 vColor;\n\nstruct PolygonProps {\n vec4 fillColors;\n vec4 lineColors;\n vec3 positions;\n vec3 nextPositions;\n vec3 pickingColors;\n vec3 positions64Low;\n vec3 nextPositions64Low;\n float elevations;\n};\n\nvec3 project_offset_normal(vec3 vector) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {\n return normalize(vector * project_uCommonUnitsPerWorldUnit);\n }\n return project_normal(vector);\n}\n\nvoid calculatePosition(PolygonProps props) {\n#ifdef IS_SIDE_VERTEX\n if(vertexValid < 0.5){\n gl_Position = vec4(0.);\n return;\n }\n#endif\n\n vec3 pos;\n vec3 pos64Low;\n vec3 normal;\n vec4 colors = isWireframe ? props.lineColors : props.fillColors;\n\n geometry.worldPosition = props.positions;\n geometry.worldPositionAlt = props.nextPositions;\n geometry.pickingColor = props.pickingColors;\n\n#ifdef IS_SIDE_VERTEX\n pos = mix(props.positions, props.nextPositions, vertexPositions.x);\n pos64Low = mix(props.positions64Low, props.nextPositions64Low, vertexPositions.x);\n#else\n pos = props.positions;\n pos64Low = props.positions64Low;\n#endif\n\n if (extruded) {\n pos.z += props.elevations * vertexPositions.y * elevationScale;\n }\n gl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position);\n\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n if (extruded) {\n #ifdef IS_SIDE_VERTEX\n normal = vec3(\n props.positions.y - props.nextPositions.y + (props.positions64Low.y - props.nextPositions64Low.y),\n props.nextPositions.x - props.positions.x + (props.nextPositions64Low.x - props.positions64Low.x),\n 0.0);\n normal = project_offset_normal(normal);\n #else\n normal = project_normal(vec3(0.0, 0.0, 1.0));\n #endif\n geometry.normal = normal;\n vec3 lightColor = lighting_getLightColor(colors.rgb, project_uCameraPosition, geometry.position.xyz, normal);\n vColor = vec4(lightColor, colors.a * opacity);\n } else {\n vColor = vec4(colors.rgb, colors.a * opacity);\n }\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;var Gq=`#define SHADER_NAME solid-polygon-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 positions64Low;\nattribute float elevations;\nattribute vec4 fillColors;\nattribute vec4 lineColors;\nattribute vec3 pickingColors;\n\n`.concat(W3,`\n\nvoid main(void) {\n PolygonProps props;\n\n props.positions = positions;\n props.positions64Low = positions64Low;\n props.elevations = elevations;\n props.fillColors = fillColors;\n props.lineColors = lineColors;\n props.pickingColors = pickingColors;\n\n calculatePosition(props);\n}\n`);var Wq=`#define SHADER_NAME solid-polygon-layer-vertex-shader-side\n#define IS_SIDE_VERTEX\n\n\nattribute vec3 instancePositions;\nattribute vec3 nextPositions;\nattribute vec3 instancePositions64Low;\nattribute vec3 nextPositions64Low;\nattribute float instanceElevations;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\n`.concat(W3,`\n\nvoid main(void) {\n PolygonProps props;\n\n #if RING_WINDING_ORDER_CW == 1\n props.positions = instancePositions;\n props.positions64Low = instancePositions64Low;\n props.nextPositions = nextPositions;\n props.nextPositions64Low = nextPositions64Low;\n #else\n props.positions = nextPositions;\n props.positions64Low = nextPositions64Low;\n props.nextPositions = instancePositions;\n props.nextPositions64Low = instancePositions64Low;\n #endif\n props.elevations = instanceElevations;\n props.fillColors = instanceFillColors;\n props.lineColors = instanceLineColors;\n props.pickingColors = instancePickingColors;\n\n calculatePosition(props);\n}\n`);var Hq=`#define SHADER_NAME solid-polygon-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n gl_FragColor = vColor;\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var q3=[0,0,0,255],Npt={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:\"CW\",_full3d:!1,elevationScale:{type:\"number\",min:0,value:1},getPolygon:{type:\"accessor\",value:e=>e.polygon},getElevation:{type:\"accessor\",value:1e3},getFillColor:{type:\"accessor\",value:q3},getLineColor:{type:\"accessor\",value:q3},material:!0},H3={enter:(e,t)=>t.length?t.subarray(t.length-e.length):e},wc=class extends dn{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(t){return super.getShaders({vs:t===\"top\"?Gq:Wq,fs:Hq,defines:{RING_WINDING_ORDER_CW:!this.props._normalize&&this.props._windingOrder===\"CCW\"?0:1},modules:[Rs,Zf,Ao]})}get wrapLongitude(){return!1}initializeState(){let{gl:t,viewport:r}=this.context,{coordinateSystem:i}=this.props,{_full3d:s}=this.props;r.isGeospatial&&i===Yr.DEFAULT&&(i=Yr.LNGLAT);let n;i===Yr.LNGLAT&&(s?n=r.projectPosition.bind(r):n=r.projectFlat.bind(r)),this.setState({numInstances:0,polygonTesselator:new eS({preproject:n,fp64:this.use64bitPositions(),IndexType:!t||Oh(t,Ii.ELEMENT_INDEX_UINT32)?Uint32Array:Uint16Array})});let o=this.getAttributeManager(),c=!0;o.remove([\"instancePickingColors\"]),o.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:c},positions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:H3,accessor:\"getPolygon\",update:this.calculatePositions,noAlloc:c,shaderAttributes:{positions:{vertexOffset:0,divisor:0},instancePositions:{vertexOffset:0,divisor:1},nextPositions:{vertexOffset:1,divisor:1}}},vertexValid:{size:1,divisor:1,type:5121,update:this.calculateVertexValid,noAlloc:c},elevations:{size:1,transition:H3,accessor:\"getElevation\",shaderAttributes:{elevations:{divisor:0},instanceElevations:{divisor:1}}},fillColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:H3,accessor:\"getFillColor\",defaultValue:q3,shaderAttributes:{fillColors:{divisor:0},instanceFillColors:{divisor:1}}},lineColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:H3,accessor:\"getLineColor\",defaultValue:q3,shaderAttributes:{lineColors:{divisor:0},instanceLineColors:{divisor:1}}},pickingColors:{size:3,type:5121,accessor:(f,{index:_,target:w})=>this.encodePickingColor(f&&f.__source?f.__source.index:_,w),shaderAttributes:{pickingColors:{divisor:0},instancePickingColors:{divisor:1}}}})}getPickingInfo(t){let r=super.getPickingInfo(t),{index:i}=r,{data:s}=this.props;return s[0]&&s[0].__source&&(r.object=s.find(n=>n.__source.index===i)),r}disablePickingIndex(t){let{data:r}=this.props;if(r[0]&&r[0].__source)for(let i=0;if.delete()),this.setState(this._getModels(this.context.gl)),n.invalidateAll()}}updateGeometry({props:t,oldProps:r,changeFlags:i}){if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPolygon)){let{polygonTesselator:n}=this.state,o=t.data.attributes||{};n.updateGeometry({data:t.data,normalize:t._normalize,geometryBuffer:o.getPolygon,buffers:o,getGeometry:t.getPolygon,positionFormat:t.positionFormat,wrapLongitude:t.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:i.dataChanged,full3d:t._full3d}),this.setState({numInstances:n.instanceCount,startIndices:n.vertexStarts}),i.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(t){let{id:r,filled:i,extruded:s}=this.props,n,o;if(i){let c=this.getShaders(\"top\");c.defines.NON_INSTANCED_MODEL=1,n=new fn(t,{...c,id:\"\".concat(r,\"-top\"),drawMode:4,attributes:{vertexPositions:new Float32Array([0,1])},uniforms:{isWireframe:!1,isSideVertex:!1},vertexCount:0,isIndexed:!0})}return s&&(o=new fn(t,{...this.getShaders(\"side\"),id:\"\".concat(r,\"-side\"),geometry:new $n({drawMode:1,vertexCount:4,attributes:{vertexPositions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),instanceCount:0,isInstanced:1}),o.userData.excludeAttributes={indices:!0}),{models:[o,n].filter(Boolean),topModel:n,sideModel:o}}calculateIndices(t){let{polygonTesselator:r}=this.state;t.startIndices=r.indexStarts,t.value=r.get(\"indices\")}calculatePositions(t){let{polygonTesselator:r}=this.state;t.startIndices=r.vertexStarts,t.value=r.get(\"positions\")}calculateVertexValid(t){t.value=this.state.polygonTesselator.get(\"vertexValid\")}};G(wc,\"defaultProps\",Npt);G(wc,\"layerName\",\"SolidPolygonLayer\");function Z3({data:e,getIndex:t,dataRange:r,replace:i}){let{startRow:s=0,endRow:n=1/0}=r,o=e.length,c=o,f=o;for(let R=0;RR&&N>=s&&(c=R),N>=n){f=R;break}}let _=c,I=f-c!==i.length?e.slice(f):void 0;for(let R=0;Re.polygon},getFillColor:{type:\"accessor\",value:Upt},getLineColor:{type:\"accessor\",value:qq},getLineWidth:{type:\"accessor\",value:1},getElevation:{type:\"accessor\",value:1e3},material:!0},lf=class extends Ni{initializeState(){this.state={paths:[]},this.props.getLineDashArray&&or.removed(\"getLineDashArray\",\"PathStyleExtension\")()}updateState({changeFlags:t}){let r=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getPolygon);if(r&&Array.isArray(t.dataChanged)){let i=this.state.paths.slice(),s=t.dataChanged.map(n=>Z3({data:i,getIndex:o=>o.__source.index,dataRange:n,replace:this._getPaths(n)}));this.setState({paths:i,pathsDiff:s})}else r&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(t={}){let{data:r,getPolygon:i,positionFormat:s,_normalize:n}=this.props,o=[],c=s===\"XY\"?2:3,{startRow:f,endRow:_}=t,{iterable:w,objectInfo:I}=Jc(r,f,_);for(let R of w){I.index++;let N=i(R,I);n&&(N=G3(N,c));let{holeIndices:j}=N,Q=N.positions||N;if(j)for(let et=0;et<=j.length;et++){let Y=Q.slice(j[et-1]||0,j[et]||Q.length);o.push(this.getSubLayerRow({path:Y},R,I.index))}else o.push(this.getSubLayerRow({path:Q},R,I.index))}return o}renderLayers(){let{data:t,_dataDiff:r,stroked:i,filled:s,extruded:n,wireframe:o,_normalize:c,_windingOrder:f,elevationScale:_,transitions:w,positionFormat:I}=this.props,{lineWidthUnits:R,lineWidthScale:N,lineWidthMinPixels:j,lineWidthMaxPixels:Q,lineJointRounded:et,lineMiterLimit:Y,lineDashJustified:K}=this.props,{getFillColor:J,getLineColor:ut,getLineWidth:Et,getLineDashArray:kt,getElevation:Xt,getPolygon:qt,updateTriggers:le,material:ue}=this.props,{paths:De,pathsDiff:Ke}=this.state,rr=this.getSubLayerClass(\"fill\",wc),Sr=this.getSubLayerClass(\"stroke\",bc),Li=this.shouldRenderSubLayer(\"fill\",De)&&new rr({_dataDiff:r,extruded:n,elevationScale:_,filled:s,wireframe:o,_normalize:c,_windingOrder:f,getElevation:Xt,getFillColor:J,getLineColor:n&&o?ut:qq,material:ue,transitions:w},this.getSubLayerProps({id:\"fill\",updateTriggers:le&&{getPolygon:le.getPolygon,getElevation:le.getElevation,getFillColor:le.getFillColor,lineColors:n&&o,getLineColor:le.getLineColor}}),{data:t,positionFormat:I,getPolygon:qt}),oo=!n&&i&&this.shouldRenderSubLayer(\"stroke\",De)&&new Sr({_dataDiff:Ke&&(()=>Ke),widthUnits:R,widthScale:N,widthMinPixels:j,widthMaxPixels:Q,jointRounded:et,miterLimit:Y,dashJustified:K,_pathType:\"loop\",transitions:w&&{getWidth:w.getLineWidth,getColor:w.getLineColor,getPath:w.getPolygon},getColor:this.getSubLayerAccessor(ut),getWidth:this.getSubLayerAccessor(Et),getDashArray:this.getSubLayerAccessor(kt)},this.getSubLayerProps({id:\"stroke\",updateTriggers:le&&{getWidth:le.getLineWidth,getColor:le.getLineColor,getDashArray:le.getLineDashArray}}),{data:De,positionFormat:I,getPath:zl=>zl.path});return[!n&&Li,oo,n&&Li]}};G(lf,\"layerName\",\"PolygonLayer\");G(lf,\"defaultProps\",Vpt);function Zq(e,t){if(!e)return null;let r=\"startIndices\"in e?e.startIndices[t]:t,i=e.featureIds.value[r];return r!==-1?jpt(e,i,r):null}function jpt(e,t,r){let i={properties:{...e.properties[t]}};for(let s in e.numericProps)i.properties[s]=e.numericProps[s].value[r];return i}function Yq(e,t){let r={points:null,lines:null,polygons:null};for(let i in r){let s=e[i].globalFeatureIds.value;r[i]=new Uint8ClampedArray(s.length*3);let n=[];for(let o=0;o 0.0) {\n float inFill = alpha;\n float inBorder = smoothstep(outlineBuffer - gamma, outlineBuffer + gamma, distance);\n color = mix(outlineColor, vColor, inFill);\n alpha = inBorder;\n }\n }\n float a = alpha * color.a;\n \n if (a < alphaCutoff) {\n discard;\n }\n\n gl_FragColor = vec4(color.rgb, a * opacity);\n }\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var dB=192/256,$q=[],Gpt={getIconOffsets:{type:\"accessor\",value:e=>e.offsets},alphaCutoff:.001,smoothing:.1,outlineWidth:0,outlineColor:{type:\"color\",value:[0,0,0,255]}},Gg=class extends Ep{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(){return{...super.getShaders(),fs:Qq}}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({instanceOffsets:{size:2,accessor:\"getIconOffsets\"},instancePickingColors:{type:5121,size:3,accessor:(r,{index:i,target:s})=>this.encodePickingColor(i,s)}})}updateState(t){super.updateState(t);let{props:r,oldProps:i}=t,{outlineColor:s}=r;s!==i.outlineColor&&(s=s.map(n=>n/255),s[3]=Number.isFinite(s[3])?s[3]:1,this.setState({outlineColor:s})),!r.sdf&&r.outlineWidth&&or.warn(\"\".concat(this.id,\": fontSettings.sdf is required to render outline\"))()}draw(t){let{sdf:r,smoothing:i,outlineWidth:s}=this.props,{outlineColor:n}=this.state,o=s?Math.max(i,dB*(1-s)):-1;if(t.uniforms={...t.uniforms,sdfBuffer:dB,outlineBuffer:o,gamma:i,sdf:!!r,outlineColor:n},super.draw(t),r&&s){let{iconManager:c}=this.state;c.getTexture()&&this.state.model.draw({uniforms:{outlineBuffer:dB}})}}getInstanceOffset(t){return t?Array.from(t).flatMap(r=>super.getInstanceOffset(r)):$q}getInstanceColorMode(t){return 1}getInstanceIconFrame(t){return t?Array.from(t).flatMap(r=>super.getInstanceIconFrame(r)):$q}};G(Gg,\"defaultProps\",Gpt);G(Gg,\"layerName\",\"MultiIconLayer\");var rS=class{constructor({fontSize:t=24,buffer:r=3,radius:i=8,cutoff:s=.25,fontFamily:n=\"sans-serif\",fontWeight:o=\"normal\",fontStyle:c=\"normal\"}={}){this.buffer=r,this.cutoff=s,this.radius=i;let f=this.size=t+r*4,_=this._createCanvas(f),w=this.ctx=_.getContext(\"2d\",{willReadFrequently:!0});w.font=`${c} ${o} ${t}px ${n}`,w.textBaseline=\"alphabetic\",w.textAlign=\"left\",w.fillStyle=\"black\",this.gridOuter=new Float64Array(f*f),this.gridInner=new Float64Array(f*f),this.f=new Float64Array(f),this.z=new Float64Array(f+1),this.v=new Uint16Array(f)}_createCanvas(t){let r=document.createElement(\"canvas\");return r.width=r.height=t,r}draw(t){let{width:r,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(t),c=Math.ceil(i),f=0,_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),w=Math.min(this.size-this.buffer,c+Math.ceil(s)),I=_+2*this.buffer,R=w+2*this.buffer,N=Math.max(I*R,0),j=new Uint8ClampedArray(N),Q={data:j,width:I,height:R,glyphWidth:_,glyphHeight:w,glyphTop:c,glyphLeft:f,glyphAdvance:r};if(_===0||w===0)return Q;let{ctx:et,buffer:Y,gridInner:K,gridOuter:J}=this;et.clearRect(Y,Y,_,w),et.fillText(t,Y,Y+c);let ut=et.getImageData(Y,Y,_,w);J.fill(1e20,0,N),K.fill(0,0,N);for(let Et=0;Et0?le*le:0,K[qt]=le<0?le*le:0}}Xq(J,0,0,I,R,I,this.f,this.v,this.z),Xq(K,Y,Y,_,w,I,this.f,this.v,this.z);for(let Et=0;Et-1);f++,n[f]=c,o[f]=_,o[f+1]=1e20}for(let c=0,f=0;cs&&(_=0,f++),n[I]={x:_+i,y:c+f*w+i,width:R,height:w,layoutWidth:R,layoutHeight:r},_+=R+i*2}return{mapping:n,xOffset:_,yOffset:c+f*w,canvasHeight:qpt(c+(f+1)*w)}}function tZ(e,t,r,i){let s=0;for(let o=t;oi&&(oc){let I=tZ(e,c,f,s);_+I>i&&(oi&&(I=eZ(e,c,f,i,s,n),o=n[n.length-1])),c=f,_+=I}return _}function Ypt(e,t,r,i,s=0,n){n===void 0&&(n=e.length);let o=[];return t===\"break-all\"?eZ(e,s,n,r,i,o):Zpt(e,s,n,r,i,o),o}function Qpt(e,t,r,i,s,n){let o=0,c=0;for(let f=t;f0,I=[0,0],R=[0,0],N=0,j=0,Q=0;for(let Y=0;Y<=o;Y++){let K=n[Y];if((K===`\n`||Y===o)&&(Q=Y),Q>j){let J=w?Ypt(n,r,i,s,j,Q):Hpt;for(let ut=0;ut<=J.length;ut++){let Et=ut===0?j:J[ut-1],kt=ut1||f>0){let N=e.constructor;R=new N(_);for(let j=0;j<_;j++)R[j]=e[j*c+f]}for(let N=0;N=0&&this._order.splice(r,1)}_appendOrder(t){this._order.push(t)}};function $pt(){let e=[];for(let t=32;t<128;t++)e.push(String.fromCharCode(t));return e}var Wg={fontFamily:\"Monaco, monospace\",fontWeight:\"normal\",characterSet:$pt(),fontSize:64,buffer:4,sdf:!1,cutoff:.25,radius:12,smoothing:.1},nZ=1024,sZ=.9,oZ=1.2,lZ=3,Y3=new ex(lZ);function Xpt(e,t){let r;typeof t==\"string\"?r=new Set(Array.from(t)):r=new Set(t);let i=Y3.get(e);if(!i)return r;for(let s in i.mapping)r.has(s)&&r.delete(s);return r}function Kpt(e,t){for(let r=0;r=lZ,\"Invalid cache limit\"),Y3=new ex(e)}var iS=class{constructor(){G(this,\"props\",{...Wg}),G(this,\"_key\",void 0),G(this,\"_atlas\",void 0)}get texture(){return this._atlas}get mapping(){return this._atlas&&this._atlas.mapping}get scale(){let{fontSize:t,buffer:r}=this.props;return(t*oZ+r*2)/t}setProps(t={}){Object.assign(this.props,t),this._key=this._getKey();let r=Xpt(this._key,this.props.characterSet),i=Y3.get(this._key);if(i&&r.size===0){this._atlas!==i&&(this._atlas=i);return}let s=this._generateFontAtlas(r,i);this._atlas=s,Y3.set(this._key,s)}_generateFontAtlas(t,r){let{fontFamily:i,fontWeight:s,fontSize:n,buffer:o,sdf:c,radius:f,cutoff:_}=this.props,w=r&&r.data;w||(w=document.createElement(\"canvas\"),w.width=nZ);let I=w.getContext(\"2d\",{willReadFrequently:!0});aZ(I,i,n,s);let{mapping:R,canvasHeight:N,xOffset:j,yOffset:Q}=Jq({getFontWidth:et=>I.measureText(et).width,fontHeight:n*oZ,buffer:o,characterSet:t,maxCanvasWidth:nZ,...r&&{mapping:r.mapping,xOffset:r.xOffset,yOffset:r.yOffset}});if(w.height!==N){let et=I.getImageData(0,0,w.width,w.height);w.height=N,I.putImageData(et,0,0)}if(aZ(I,i,n,s),c){let et=new rS({fontSize:n,buffer:o,radius:f,cutoff:_,fontFamily:i,fontWeight:\"\".concat(s)});for(let Y of t){let{data:K,width:J,height:ut,glyphTop:Et}=et.draw(Y);R[Y].width=J,R[Y].layoutOffsetY=n*sZ-Et;let kt=I.createImageData(J,ut);Kpt(K,kt),I.putImageData(kt,R[Y].x,R[Y].y)}}else for(let et of t)I.fillText(et,R[et].x,R[et].y+o+n*sZ);return{xOffset:j,yOffset:Q,mapping:R,data:w,width:w.width,height:w.height}}_getKey(){let{fontFamily:t,fontWeight:r,fontSize:i,buffer:s,sdf:n,radius:o,cutoff:c}=this.props;return n?\"\".concat(t,\" \").concat(r,\" \").concat(i,\" \").concat(s,\" \").concat(o,\" \").concat(c):\"\".concat(t,\" \").concat(r,\" \").concat(i,\" \").concat(s)}};var uZ=`#define SHADER_NAME text-background-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute vec4 instanceRects;\nattribute float instanceSizes;\nattribute float instanceAngles;\nattribute vec2 instancePixelOffsets;\nattribute float instanceLineWidths;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\nuniform bool billboard;\nuniform float opacity;\nuniform float sizeScale;\nuniform float sizeMinPixels;\nuniform float sizeMaxPixels;\nuniform vec4 padding;\nuniform int sizeUnits;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying float vLineWidth;\nvarying vec2 uv;\nvarying vec2 dimensions;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n float angle_radian = radians(angle);\n float cos_angle = cos(angle_radian);\n float sin_angle = sin(angle_radian);\n mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n geometry.uv = positions;\n geometry.pickingColor = instancePickingColors;\n uv = positions;\n vLineWidth = instanceLineWidths;\n float sizePixels = clamp(\n project_size_to_pixel(instanceSizes * sizeScale, sizeUnits),\n sizeMinPixels, sizeMaxPixels\n );\n\n dimensions = instanceRects.zw * sizePixels + padding.xy + padding.zw;\n\n vec2 pixelOffset = (positions * instanceRects.zw + instanceRects.xy) * sizePixels + mix(-padding.xy, padding.zw, positions);\n pixelOffset = rotate_by_angle(pixelOffset, instanceAngles);\n pixelOffset += instancePixelOffsets;\n pixelOffset.y *= -1.0;\n\n if (billboard) {\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vec3 offset = vec3(pixelOffset, 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n } else {\n vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);\n DECKGL_FILTER_SIZE(offset_common, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);\n DECKGL_FILTER_COLOR(vFillColor, geometry);\n vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);\n DECKGL_FILTER_COLOR(vLineColor, geometry);\n}\n`;var hZ=`#define SHADER_NAME text-background-layer-fragment-shader\n\nprecision highp float;\n\nuniform bool stroked;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying float vLineWidth;\nvarying vec2 uv;\nvarying vec2 dimensions;\n\nvoid main(void) {\n geometry.uv = uv;\n\n vec2 pixelPosition = uv * dimensions;\n if (stroked) {\n float distToEdge = min(\n min(pixelPosition.x, dimensions.x - pixelPosition.x),\n min(pixelPosition.y, dimensions.y - pixelPosition.y)\n );\n float isBorder = smoothedge(distToEdge, vLineWidth);\n gl_FragColor = mix(vFillColor, vLineColor, isBorder);\n } else {\n gl_FragColor = vFillColor;\n }\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var Jpt={billboard:!0,sizeScale:1,sizeUnits:\"pixels\",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,padding:{type:\"array\",value:[0,0,0,0]},getPosition:{type:\"accessor\",value:e=>e.position},getSize:{type:\"accessor\",value:1},getAngle:{type:\"accessor\",value:0},getPixelOffset:{type:\"accessor\",value:[0,0]},getBoundingRect:{type:\"accessor\",value:[0,0,0,0]},getFillColor:{type:\"accessor\",value:[0,0,0,255]},getLineColor:{type:\"accessor\",value:[0,0,0,255]},getLineWidth:{type:\"accessor\",value:1}},Hg=class extends dn{constructor(...t){super(...t),G(this,\"state\",void 0)}getShaders(){return super.getShaders({vs:uZ,fs:hZ,modules:[Rs,Ao]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:\"getPosition\"},instanceSizes:{size:1,transition:!0,accessor:\"getSize\",defaultValue:1},instanceAngles:{size:1,transition:!0,accessor:\"getAngle\"},instanceRects:{size:4,accessor:\"getBoundingRect\"},instancePixelOffsets:{size:2,transition:!0,accessor:\"getPixelOffset\"},instanceFillColors:{size:4,transition:!0,normalized:!0,type:5121,accessor:\"getFillColor\",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,normalized:!0,type:5121,accessor:\"getLineColor\",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:\"getLineWidth\",defaultValue:1}})}updateState(t){super.updateState(t);let{changeFlags:r}=t;if(r.extensionsChanged){var i;let{gl:s}=this.context;(i=this.state.model)===null||i===void 0||i.delete(),this.state.model=this._getModel(s),this.getAttributeManager().invalidateAll()}}draw({uniforms:t}){let{billboard:r,sizeScale:i,sizeUnits:s,sizeMinPixels:n,sizeMaxPixels:o,getLineWidth:c}=this.props,{padding:f}=this.props;f.length<4&&(f=[f[0],f[1],f[0],f[1]]),this.state.model.setUniforms(t).setUniforms({billboard:r,stroked:!!c,padding:f,sizeUnits:po[s],sizeScale:i,sizeMinPixels:n,sizeMaxPixels:o}).draw()}_getModel(t){let r=[0,0,1,0,1,1,0,1];return new fn(t,{...this.getShaders(),id:this.props.id,geometry:new $n({drawMode:6,vertexCount:4,attributes:{positions:{size:2,value:new Float32Array(r)}}}),isInstanced:!0})}};G(Hg,\"defaultProps\",Jpt);G(Hg,\"layerName\",\"TextBackgroundLayer\");var fZ={start:1,middle:0,end:-1},dZ={top:1,center:0,bottom:-1},pB=[0,0,0,255],tAt=1,eAt={billboard:!0,sizeScale:1,sizeUnits:\"pixels\",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:\"accessor\",value:[255,255,255,255]},getBorderColor:{type:\"accessor\",value:pB},getBorderWidth:{type:\"accessor\",value:0},backgroundPadding:{type:\"array\",value:[0,0,0,0]},characterSet:{type:\"object\",value:Wg.characterSet},fontFamily:Wg.fontFamily,fontWeight:Wg.fontWeight,lineHeight:tAt,outlineWidth:{type:\"number\",value:0,min:0},outlineColor:{type:\"color\",value:pB},fontSettings:{type:\"object\",value:{},compare:1},wordBreak:\"break-word\",maxWidth:{type:\"number\",value:-1},getText:{type:\"accessor\",value:e=>e.text},getPosition:{type:\"accessor\",value:e=>e.position},getColor:{type:\"accessor\",value:pB},getSize:{type:\"accessor\",value:32},getAngle:{type:\"accessor\",value:0},getTextAnchor:{type:\"accessor\",value:\"middle\"},getAlignmentBaseline:{type:\"accessor\",value:\"center\"},getPixelOffset:{type:\"accessor\",value:[0,0]},backgroundColor:{deprecatedFor:[\"background\",\"getBackgroundColor\"]}},cf=class extends Ni{constructor(...t){super(...t),G(this,\"state\",void 0),G(this,\"getBoundingRect\",(r,i)=>{let{size:[s,n]}=this.transformParagraph(r,i),{fontSize:o}=this.state.fontAtlasManager.props;s/=o,n/=o;let{getTextAnchor:c,getAlignmentBaseline:f}=this.props,_=fZ[typeof c==\"function\"?c(r,i):c],w=dZ[typeof f==\"function\"?f(r,i):f];return[(_-1)*s/2,(w-1)*n/2,s,n]}),G(this,\"getIconOffsets\",(r,i)=>{let{getTextAnchor:s,getAlignmentBaseline:n}=this.props,{x:o,y:c,rowWidth:f,size:[_,w]}=this.transformParagraph(r,i),I=fZ[typeof s==\"function\"?s(r,i):s],R=dZ[typeof n==\"function\"?n(r,i):n],N=o.length,j=new Array(N*2),Q=0;for(let et=0;et0&&or.warn(\"v8.9 breaking change: TextLayer maxWidth is now relative to text size\")()}updateState(t){let{props:r,oldProps:i,changeFlags:s}=t;(s.dataChanged||s.updateTriggersChanged&&(s.updateTriggersChanged.all||s.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||r.lineHeight!==i.lineHeight||r.wordBreak!==i.wordBreak||r.maxWidth!==i.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo({info:t}){return t.object=t.index>=0?this.props.data[t.index]:null,t}_updateFontAtlas(){let{fontSettings:t,fontFamily:r,fontWeight:i}=this.props,{fontAtlasManager:s,characterSet:n}=this.state,o={...t,characterSet:n,fontFamily:r,fontWeight:i};if(!s.mapping)return s.setProps(o),!0;for(let c in o)if(o[c]!==s.props[c])return s.setProps(o),!0;return!1}_updateText(){var t;let{data:r,characterSet:i}=this.props,s=(t=r.attributes)===null||t===void 0?void 0:t.getText,{getText:n}=this.props,o=r.startIndices,c,f=i===\"auto\"&&new Set;if(s&&o){let{texts:_,characterCount:w}=iZ({...ArrayBuffer.isView(s)?{value:s}:s,length:r.length,startIndices:o,characterSet:f});c=w,n=(I,{index:R})=>_[R]}else{let{iterable:_,objectInfo:w}=Jc(r);o=[0],c=0;for(let I of _){w.index++;let R=Array.from(n(I,w)||\"\");f&&R.forEach(f.add,f),c+=R.length,o.push(c)}}this.setState({getText:n,startIndices:o,numInstances:c,characterSet:f||i})}transformParagraph(t,r){let{fontAtlasManager:i}=this.state,s=i.mapping,n=this.state.getText,{wordBreak:o,lineHeight:c,maxWidth:f}=this.props,_=n(t,r)||\"\";return rZ(_,c,o,f*i.props.fontSize,s)}renderLayers(){let{startIndices:t,numInstances:r,getText:i,fontAtlasManager:{scale:s,texture:n,mapping:o},styleVersion:c}=this.state,{data:f,_dataDiff:_,getPosition:w,getColor:I,getSize:R,getAngle:N,getPixelOffset:j,getBackgroundColor:Q,getBorderColor:et,getBorderWidth:Y,backgroundPadding:K,background:J,billboard:ut,fontSettings:Et,outlineWidth:kt,outlineColor:Xt,sizeScale:qt,sizeUnits:le,sizeMinPixels:ue,sizeMaxPixels:De,transitions:Ke,updateTriggers:rr}=this.props,Sr=this.getSubLayerClass(\"characters\",Gg),Li=this.getSubLayerClass(\"background\",Hg);return[J&&new Li({getFillColor:Q,getLineColor:et,getLineWidth:Y,padding:K,getPosition:w,getSize:R,getAngle:N,getPixelOffset:j,billboard:ut,sizeScale:qt,sizeUnits:le,sizeMinPixels:ue,sizeMaxPixels:De,transitions:Ke&&{getPosition:Ke.getPosition,getAngle:Ke.getAngle,getSize:Ke.getSize,getFillColor:Ke.getBackgroundColor,getLineColor:Ke.getBorderColor,getLineWidth:Ke.getBorderWidth,getPixelOffset:Ke.getPixelOffset}},this.getSubLayerProps({id:\"background\",updateTriggers:{getPosition:rr.getPosition,getAngle:rr.getAngle,getSize:rr.getSize,getFillColor:rr.getBackgroundColor,getLineColor:rr.getBorderColor,getLineWidth:rr.getBorderWidth,getPixelOffset:rr.getPixelOffset,getBoundingRect:{getText:rr.getText,getTextAnchor:rr.getTextAnchor,getAlignmentBaseline:rr.getAlignmentBaseline,styleVersion:c}}}),{data:f.attributes&&f.attributes.background?{length:f.length,attributes:f.attributes.background}:f,_dataDiff:_,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new Sr({sdf:Et.sdf,smoothing:Number.isFinite(Et.smoothing)?Et.smoothing:Wg.smoothing,outlineWidth:kt/(Et.radius||Wg.radius),outlineColor:Xt,iconAtlas:n,iconMapping:o,getPosition:w,getColor:I,getSize:R,getAngle:N,getPixelOffset:j,billboard:ut,sizeScale:qt*s,sizeUnits:le,sizeMinPixels:ue*s,sizeMaxPixels:De*s,transitions:Ke&&{getPosition:Ke.getPosition,getAngle:Ke.getAngle,getColor:Ke.getColor,getSize:Ke.getSize,getPixelOffset:Ke.getPixelOffset}},this.getSubLayerProps({id:\"characters\",updateTriggers:{all:rr.getText,getPosition:rr.getPosition,getAngle:rr.getAngle,getColor:rr.getColor,getSize:rr.getSize,getPixelOffset:rr.getPixelOffset,getIconOffsets:{getTextAnchor:rr.getTextAnchor,getAlignmentBaseline:rr.getAlignmentBaseline,styleVersion:c}}}),{data:f,_dataDiff:_,startIndices:t,numInstances:r,getIconOffsets:this.getIconOffsets,getIcon:i})]}static set fontAtlasCacheLimit(t){cZ(t)}};G(cf,\"defaultProps\",eAt);G(cf,\"layerName\",\"TextLayer\");var nS={circle:{type:Ku,props:{filled:\"filled\",stroked:\"stroked\",lineWidthMaxPixels:\"lineWidthMaxPixels\",lineWidthMinPixels:\"lineWidthMinPixels\",lineWidthScale:\"lineWidthScale\",lineWidthUnits:\"lineWidthUnits\",pointRadiusMaxPixels:\"radiusMaxPixels\",pointRadiusMinPixels:\"radiusMinPixels\",pointRadiusScale:\"radiusScale\",pointRadiusUnits:\"radiusUnits\",pointAntialiasing:\"antialiasing\",pointBillboard:\"billboard\",getFillColor:\"getFillColor\",getLineColor:\"getLineColor\",getLineWidth:\"getLineWidth\",getPointRadius:\"getRadius\"}},icon:{type:Ep,props:{iconAtlas:\"iconAtlas\",iconMapping:\"iconMapping\",iconSizeMaxPixels:\"sizeMaxPixels\",iconSizeMinPixels:\"sizeMinPixels\",iconSizeScale:\"sizeScale\",iconSizeUnits:\"sizeUnits\",iconAlphaCutoff:\"alphaCutoff\",iconBillboard:\"billboard\",getIcon:\"getIcon\",getIconAngle:\"getAngle\",getIconColor:\"getColor\",getIconPixelOffset:\"getPixelOffset\",getIconSize:\"getSize\"}},text:{type:cf,props:{textSizeMaxPixels:\"sizeMaxPixels\",textSizeMinPixels:\"sizeMinPixels\",textSizeScale:\"sizeScale\",textSizeUnits:\"sizeUnits\",textBackground:\"background\",textBackgroundPadding:\"backgroundPadding\",textFontFamily:\"fontFamily\",textFontWeight:\"fontWeight\",textLineHeight:\"lineHeight\",textMaxWidth:\"maxWidth\",textOutlineColor:\"outlineColor\",textOutlineWidth:\"outlineWidth\",textWordBreak:\"wordBreak\",textCharacterSet:\"characterSet\",textBillboard:\"billboard\",textFontSettings:\"fontSettings\",getText:\"getText\",getTextAngle:\"getAngle\",getTextColor:\"getColor\",getTextPixelOffset:\"getPixelOffset\",getTextSize:\"getSize\",getTextAnchor:\"getTextAnchor\",getTextAlignmentBaseline:\"getAlignmentBaseline\",getTextBackgroundColor:\"getBackgroundColor\",getTextBorderColor:\"getBorderColor\",getTextBorderWidth:\"getBorderWidth\"}}},sS={type:bc,props:{lineWidthUnits:\"widthUnits\",lineWidthScale:\"widthScale\",lineWidthMinPixels:\"widthMinPixels\",lineWidthMaxPixels:\"widthMaxPixels\",lineJointRounded:\"jointRounded\",lineCapRounded:\"capRounded\",lineMiterLimit:\"miterLimit\",lineBillboard:\"billboard\",getLineColor:\"getColor\",getLineWidth:\"getWidth\"}},Q3={type:wc,props:{extruded:\"extruded\",filled:\"filled\",wireframe:\"wireframe\",elevationScale:\"elevationScale\",material:\"material\",_full3d:\"_full3d\",getElevation:\"getElevation\",getFillColor:\"getFillColor\",getLineColor:\"getLineColor\"}};function rx({type:e,props:t}){let r={};for(let i in t)r[i]=e.defaultProps[t[i]];return r}function $3(e,t){let{transitions:r,updateTriggers:i}=e.props,s={updateTriggers:{},transitions:r&&{getPosition:r.geometry}};for(let n in t){let o=t[n],c=e.props[n];n.startsWith(\"get\")&&(c=e.getSubLayerAccessor(c),s.updateTriggers[o]=i[n],r&&(s.transitions[o]=r[n])),s[o]=c}return s}function AZ(e){if(Array.isArray(e))return e;switch(or.assert(e.type,\"GeoJSON does not have type\"),e.type){case\"Feature\":return[e];case\"FeatureCollection\":return or.assert(Array.isArray(e.features),\"GeoJSON does not have features array\"),e.features;default:return[{geometry:e}]}}function AB(e,t,r={}){let i={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:s=0,endRow:n=e.length}=r;for(let o=s;o{c.push(r({geometry:{type:\"Point\",coordinates:I}},i,s))});break;case\"LineString\":f.push(r({geometry:e},i,s));break;case\"MultiLineString\":o.forEach(I=>{f.push(r({geometry:{type:\"LineString\",coordinates:I}},i,s))});break;case\"Polygon\":_.push(r({geometry:e},i,s)),o.forEach(I=>{w.push(r({geometry:{type:\"LineString\",coordinates:I}},i,s))});break;case\"MultiPolygon\":o.forEach(I=>{_.push(r({geometry:{type:\"Polygon\",coordinates:I}},i,s)),I.forEach(R=>{w.push(r({geometry:{type:\"LineString\",coordinates:R}},i,s))})});break;default:}}var rAt={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function iAt(e,t){let r=rAt[e];for(or.assert(r,\"Unknown GeoJSON type \".concat(e));t&&--r>0;)t=t[0];return t&&Number.isFinite(t[0])}function mZ(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function X3(e){return e.geometry.coordinates}function gZ(e,t){let r=mZ(),{pointFeatures:i,lineFeatures:s,polygonFeatures:n,polygonOutlineFeatures:o}=e;return r.points.data=i,r.points._dataDiff=t.pointFeatures&&(()=>t.pointFeatures),r.points.getPosition=X3,r.lines.data=s,r.lines._dataDiff=t.lineFeatures&&(()=>t.lineFeatures),r.lines.getPath=X3,r.polygons.data=n,r.polygons._dataDiff=t.polygonFeatures&&(()=>t.polygonFeatures),r.polygons.getPolygon=X3,r.polygonsOutline.data=o,r.polygonsOutline._dataDiff=t.polygonOutlineFeatures&&(()=>t.polygonOutlineFeatures),r.polygonsOutline.getPath=X3,r}function _Z(e,t){let r=mZ(),{points:i,lines:s,polygons:n}=e,o=Yq(e,t);return r.points.data={length:i.positions.value.length/i.positions.size,attributes:{...i.attributes,getPosition:i.positions,instancePickingColors:{size:3,value:o.points}},properties:i.properties,numericProps:i.numericProps,featureIds:i.featureIds},r.lines.data={length:s.pathIndices.value.length-1,startIndices:s.pathIndices.value,attributes:{...s.attributes,getPath:s.positions,instancePickingColors:{size:3,value:o.lines}},properties:s.properties,numericProps:s.numericProps,featureIds:s.featureIds},r.lines._pathType=\"open\",r.polygons.data={length:n.polygonIndices.value.length-1,startIndices:n.polygonIndices.value,attributes:{...n.attributes,getPolygon:n.positions,pickingColors:{size:3,value:o.polygons}},properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},r.polygons._normalize=!1,n.triangles&&(r.polygons.data.attributes.indices=n.triangles.value),r.polygonsOutline.data={length:n.primitivePolygonIndices.value.length-1,startIndices:n.primitivePolygonIndices.value,attributes:{...n.attributes,getPath:n.positions,instancePickingColors:{size:3,value:o.polygons}},properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},r.polygonsOutline._pathType=\"open\",r}var nAt=[\"points\",\"linestrings\",\"polygons\"],sAt={...rx(nS.circle),...rx(nS.icon),...rx(nS.text),...rx(sS),...rx(Q3),stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:\"object\",value:null},iconMapping:{type:\"object\",value:{}},getIcon:{type:\"accessor\",value:e=>e.properties.icon},getText:{type:\"accessor\",value:e=>e.properties.text},pointType:\"circle\",getRadius:{deprecatedFor:\"getPointRadius\"}},Mm=class extends Ni{initializeState(){this.state={layerProps:{},features:{}}}updateState({props:t,changeFlags:r}){if(!r.dataChanged)return;let{data:i}=this.props,s=i&&\"points\"in i&&\"polygons\"in i&&\"lines\"in i;this.setState({binary:s}),s?this._updateStateBinary({props:t,changeFlags:r}):this._updateStateJSON({props:t,changeFlags:r})}_updateStateBinary({props:t,changeFlags:r}){let i=_Z(t.data,this.encodePickingColor);this.setState({layerProps:i})}_updateStateJSON({props:t,changeFlags:r}){let i=AZ(t.data),s=this.getSubLayerRow.bind(this),n={},o={};if(Array.isArray(r.dataChanged)){let f=this.state.features;for(let _ in f)n[_]=f[_].slice(),o[_]=[];for(let _ of r.dataChanged){let w=AB(i,s,_);for(let I in f)o[I].push(Z3({data:n[I],getIndex:R=>R.__source.index,dataRange:_,replace:w[I]}))}}else n=AB(i,s);let c=gZ(n,o);this.setState({features:n,featuresDiff:o,layerProps:c})}getPickingInfo(t){let r=super.getPickingInfo(t),{index:i,sourceLayer:s}=r;return r.featureType=nAt.find(n=>s.id.startsWith(\"\".concat(this.id,\"-\").concat(n,\"-\"))),i>=0&&s.id.startsWith(\"\".concat(this.id,\"-points-text\"))&&this.state.binary&&(r.index=this.props.data.points.globalFeatureIds.value[i]),r}_updateAutoHighlight(t){let r=\"\".concat(this.id,\"-points-\"),i=t.featureType===\"points\";for(let s of this.getSubLayers())s.id.startsWith(r)===i&&s.updateAutoHighlight(t)}_renderPolygonLayer(){let{extruded:t,wireframe:r}=this.props,{layerProps:i}=this.state,s=\"polygons-fill\",n=this.shouldRenderSubLayer(s,i.polygons.data)&&this.getSubLayerClass(s,Q3.type);if(n){let o=$3(this,Q3.props),c=t&&r;return c||delete o.getLineColor,o.updateTriggers.lineColors=c,new n(o,this.getSubLayerProps({id:s,updateTriggers:o.updateTriggers}),i.polygons)}return null}_renderLineLayers(){let{extruded:t,stroked:r}=this.props,{layerProps:i}=this.state,s=\"polygons-stroke\",n=\"linestrings\",o=!t&&r&&this.shouldRenderSubLayer(s,i.polygonsOutline.data)&&this.getSubLayerClass(s,sS.type),c=this.shouldRenderSubLayer(n,i.lines.data)&&this.getSubLayerClass(n,sS.type);if(o||c){let f=$3(this,sS.props);return[o&&new o(f,this.getSubLayerProps({id:s,updateTriggers:f.updateTriggers}),i.polygonsOutline),c&&new c(f,this.getSubLayerProps({id:n,updateTriggers:f.updateTriggers}),i.lines)]}return null}_renderPointLayers(){let{pointType:t}=this.props,{layerProps:r,binary:i}=this.state,{highlightedObjectIndex:s}=this.props;!i&&Number.isFinite(s)&&(s=r.points.data.findIndex(c=>c.__source.index===s));let n=new Set(t.split(\"+\")),o=[];for(let c of n){let f=\"points-\".concat(c),_=nS[c],w=_&&this.shouldRenderSubLayer(f,r.points.data)&&this.getSubLayerClass(f,_.type);if(w){let I=$3(this,_.props),R=r.points;if(c===\"text\"&&i){let{instancePickingColors:N,...j}=R.data.attributes;R={...R,data:{...R.data,attributes:j}}}o.push(new w(I,this.getSubLayerProps({id:f,updateTriggers:I.updateTriggers,highlightedObjectIndex:s}),R))}}return o}renderLayers(){let{extruded:t}=this.props,r=this._renderPolygonLayer(),i=this._renderLineLayers(),s=this._renderPointLayers();return[!t&&r,i,s,t&&r]}getSubLayerAccessor(t){let{binary:r}=this.state;return!r||typeof t!=\"function\"?super.getSubLayerAccessor(t):(i,s)=>{let{data:n,index:o}=s,c=Zq(n,o);return t(c,s)}}};G(Mm,\"layerName\",\"GeoJsonLayer\");G(Mm,\"defaultProps\",sAt);var QXt=1/Math.PI*180,$Xt=1/180*Math.PI,oAt={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...oAt}};var oS=globalThis.mathgl.config;function aS(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ix(e,t,r){let i=oS.EPSILON;r&&(oS.EPSILON=r);try{if(e===t)return!0;if(aS(e)&&aS(t)){if(e.length!==t.length)return!1;for(let s=0;s{t([r,i],[s,n],o,c)},this.options):xZ(this.points,t,this.options)}modifyWindingDirection(t){return this.isFlatArray?mB(this.points,t,this.options):vZ(this.points,t,this.options)}};function vB(e,t,r=2,i,s=\"xy\"){let n=t&&t.length,o=n?t[0]*r:e.length,c=wZ(e,0,o,r,!0,i&&i[0],s),f=[];if(!c||c.next===c.prev)return f;let _,w,I,R,N,j,Q;if(n&&(c=dAt(e,t,c,r,i,s)),e.length>80*r){R=w=e[0],N=I=e[1];for(let et=r;etw&&(w=j),Q>I&&(I=Q);_=Math.max(w-R,I-N),_=_!==0?32767/_:0}return lS(c,f,r,R,N,_,0),f}function wZ(e,t,r,i,s,n,o){let c,f;n===void 0&&(n=nx(e,{start:t,end:r,size:i,plane:o}));let _=qg[o[0]],w=qg[o[1]];if(s===n<0)for(c=t;c=t;c-=i)f=bZ(c,e[c+_],e[c+w],f);return f&&eI(f,f.next)&&(uS(f),f=f.next),f}function Zg(e,t){if(!e)return e;t||(t=e);let r=e,i;do if(i=!1,!r.steiner&&(eI(r,r.next)||ys(r.prev,r,r.next)===0)){if(uS(r),r=t=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==t);return t}function lS(e,t,r,i,s,n,o){if(!e)return;!o&&n&&_At(e,i,s,n);let c=e,f,_;for(;e.prev!==e.next;){if(f=e.prev,_=e.next,n?uAt(e,i,s,n):cAt(e)){t.push(f.i/r|0),t.push(e.i/r|0),t.push(_.i/r|0),uS(e),e=_.next,c=_.next;continue}if(e=_,e===c){o?o===1?(e=hAt(Zg(e),t,r),lS(e,t,r,i,s,n,2)):o===2&&fAt(e,t,r,i,s,n):lS(Zg(e),t,r,i,s,n,1);break}}}function cAt(e){let t=e.prev,r=e,i=e.next;if(ys(t,r,i)>=0)return!1;let s=t.x,n=r.x,o=i.x,c=t.y,f=r.y,_=i.y,w=sn?s>o?s:o:n>o?n:o,N=c>f?c>_?c:_:f>_?f:_,j=i.next;for(;j!==t;){if(j.x>=w&&j.x<=R&&j.y>=I&&j.y<=N&&ox(s,c,n,f,o,_,j.x,j.y)&&ys(j.prev,j,j.next)>=0)return!1;j=j.next}return!0}function uAt(e,t,r,i){let s=e.prev,n=e,o=e.next;if(ys(s,n,o)>=0)return!1;let c=s.x,f=n.x,_=o.x,w=s.y,I=n.y,R=o.y,N=cf?c>_?c:_:f>_?f:_,et=w>I?w>R?w:R:I>R?I:R,Y=yB(N,j,t,r,i),K=yB(Q,et,t,r,i),J=e.prevZ,ut=e.nextZ;for(;J&&J.z>=Y&&ut&&ut.z<=K;){if(J.x>=N&&J.x<=Q&&J.y>=j&&J.y<=et&&J!==s&&J!==o&&ox(c,w,f,I,_,R,J.x,J.y)&&ys(J.prev,J,J.next)>=0||(J=J.prevZ,ut.x>=N&&ut.x<=Q&&ut.y>=j&&ut.y<=et&&ut!==s&&ut!==o&&ox(c,w,f,I,_,R,ut.x,ut.y)&&ys(ut.prev,ut,ut.next)>=0))return!1;ut=ut.nextZ}for(;J&&J.z>=Y;){if(J.x>=N&&J.x<=Q&&J.y>=j&&J.y<=et&&J!==s&&J!==o&&ox(c,w,f,I,_,R,J.x,J.y)&&ys(J.prev,J,J.next)>=0)return!1;J=J.prevZ}for(;ut&&ut.z<=K;){if(ut.x>=N&&ut.x<=Q&&ut.y>=j&&ut.y<=et&&ut!==s&&ut!==o&&ox(c,w,f,I,_,R,ut.x,ut.y)&&ys(ut.prev,ut,ut.next)>=0)return!1;ut=ut.nextZ}return!0}function hAt(e,t,r){let i=e;do{let s=i.prev,n=i.next.next;!eI(s,n)&&SZ(s,i,i.next,n)&&cS(s,n)&&cS(n,s)&&(t.push(s.i/r|0),t.push(i.i/r|0),t.push(n.i/r|0),uS(i),uS(i.next),i=e=n),i=i.next}while(i!==e);return Zg(i)}function fAt(e,t,r,i,s,n){let o=e;do{let c=o.next.next;for(;c!==o.prev;){if(o.i!==c.i&&xAt(o,c)){let f=TZ(o,c);o=Zg(o,o.next),f=Zg(f,f.next),lS(o,t,r,i,s,n,0),lS(f,t,r,i,s,n,0);return}c=c.next}o=o.next}while(o!==e)}function dAt(e,t,r,i,s,n){let o=[],c,f,_,w,I;for(c=0,f=t.length;c=r.next.y&&r.next.y!==r.y){let R=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(R<=i&&R>n&&(n=R,o=r.x=r.x&&r.x>=f&&i!==r.x&&ox(s<_?i:n,s,f,_,s<_?n:i,s,r.x,r.y)&&(I=Math.abs(s-r.y)/(i-r.x),cS(r,e)&&(Io.x||r.x===o.x&&gAt(o,r)))&&(o=r,w=I)),r=r.next;while(r!==c);return o}function gAt(e,t){return ys(e.prev,e,t.prev)<0&&ys(t.next,e,e.next)<0}function _At(e,t,r,i){let s=e;do s.z===0&&(s.z=yB(s.x,s.y,t,r,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,yAt(s)}function yAt(e){let t,r,i=1,s,n,o,c,f,_;do{for(n=e,e=null,_=null,s=0;n;){for(s++,c=n,o=0,r=0;r0||f>0&&c;)o!==0&&(f===0||!c||n.z<=c.z)?(t=n,n=n.nextZ,o--):(t=c,c=c.nextZ,f--),_?_.nextZ=t:e=t,t.prevZ=_,_=t;n=c}_.nextZ=null,i*=2}while(s>1);return e}function yB(e,t,r,i,s){return e=(e-r)*s|0,t=(t-i)*s|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function vAt(e){let t=e,r=e;do(t.x=(e-o)*(n-c)&&(e-o)*(i-c)>=(r-o)*(t-c)&&(r-o)*(n-c)>=(s-o)*(i-c)}function xAt(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!bAt(e,t)&&(cS(e,t)&&cS(t,e)&&wAt(e,t)&&(ys(e.prev,e,t.prev)||ys(e,t.prev,t))||eI(e,t)&&ys(e.prev,e,e.next)>0&&ys(t.prev,t,t.next)>0)}function ys(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function eI(e,t){return e.x===t.x&&e.y===t.y}function SZ(e,t,r,i){let s=tI(ys(e,t,r)),n=tI(ys(e,t,i)),o=tI(ys(r,i,e)),c=tI(ys(r,i,t));return!!(s!==n&&o!==c||s===0&&J3(e,r,t)||n===0&&J3(e,i,t)||o===0&&J3(r,e,i)||c===0&&J3(r,t,i))}function J3(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function tI(e){return e>0?1:e<0?-1:0}function bAt(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&SZ(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function cS(e,t){return ys(e.prev,e,e.next)<0?ys(e,t,e.next)>=0&&ys(e,e.prev,t)>=0:ys(e,t,e.prev)<0||ys(e,e.next,t)<0}function wAt(e,t){let r=e,i=!1,s=(e.x+t.x)/2,n=(e.y+t.y)/2;do r.y>n!=r.next.y>n&&r.next.y!==r.y&&s<(r.next.x-r.x)*(n-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==e);return i}function TZ(e,t){let r=new hS(e.i,e.x,e.y),i=new hS(t.i,t.x,t.y),s=e.next,n=t.prev;return e.next=t,t.prev=e,r.next=s,s.prev=r,i.next=r,r.prev=i,n.next=i,i.prev=n,i}function bZ(e,t,r,i){let s=new hS(e,t,r);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function uS(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var hS=class{constructor(t,r,i){G(this,\"i\",void 0),G(this,\"x\",void 0),G(this,\"y\",void 0),G(this,\"prev\",null),G(this,\"next\",null),G(this,\"z\",0),G(this,\"prevZ\",null),G(this,\"nextZ\",null),G(this,\"steiner\",!1),this.i=t,this.x=r,this.y=i}};function PZ(e){e(\"EPSG:4326\",\"+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees\"),e(\"EPSG:4269\",\"+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees\"),e(\"EPSG:3857\",\"+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs\"),e.WGS84=e[\"EPSG:4326\"],e[\"EPSG:3785\"]=e[\"EPSG:3857\"],e.GOOGLE=e[\"EPSG:3857\"],e[\"EPSG:900913\"]=e[\"EPSG:3857\"],e[\"EPSG:102113\"]=e[\"EPSG:3857\"]}var uf=1,hf=2,Ip=3,IZ=4,fS=5,xB=6378137,CZ=6356752314e-3,bB=.0066943799901413165,Yg=484813681109536e-20,de=Math.PI/2,LZ=.16666666666666666,kZ=.04722222222222222,RZ=.022156084656084655,Se=1e-10,vs=.017453292519943295,Sc=57.29577951308232,Ui=Math.PI/4,Em=Math.PI*2,xs=3.14159265359;var Rl={};Rl.greenwich=0;Rl.lisbon=-9.131906111111;Rl.paris=2.337229166667;Rl.bogota=-74.080916666667;Rl.madrid=-3.687938888889;Rl.rome=12.452333333333;Rl.bern=7.439583333333;Rl.jakarta=106.807719444444;Rl.ferro=-17.666666666667;Rl.brussels=4.367975;Rl.stockholm=18.058277777778;Rl.athens=23.7163375;Rl.oslo=10.722916666667;var DZ={ft:{to_meter:.3048},\"us-ft\":{to_meter:1200/3937}};var OZ=/[\\s_\\-\\/\\(\\)]/g;function uu(e,t){if(e[t])return e[t];for(var r=Object.keys(e),i=t.toLowerCase().replace(OZ,\"\"),s=-1,n,o;++s=this.text.length)return;e=this.text[this.place++]}switch(this.state){case pS:return this.neutral(e);case FZ:return this.keyword(e);case rI:return this.quoted(e);case NZ:return this.afterquote(e);case zZ:return this.number(e);case wB:return}};Cp.prototype.afterquote=function(e){if(e==='\"'){this.word+='\"',this.state=rI;return}if(iI.test(e)){this.word=this.word.trim(),this.afterItem(e);return}throw new Error(`havn't handled \"`+e+'\" in afterquote yet, index '+this.place)};Cp.prototype.afterItem=function(e){if(e===\",\"){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=pS;return}if(e===\"]\"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=pS,this.currentObject=this.stack.pop(),this.currentObject||(this.state=wB);return}};Cp.prototype.number=function(e){if(UZ.test(e)){this.word+=e;return}if(iI.test(e)){this.word=parseFloat(this.word),this.afterItem(e);return}throw new Error(`havn't handled \"`+e+'\" in number yet, index '+this.place)};Cp.prototype.quoted=function(e){if(e==='\"'){this.state=NZ;return}this.word+=e};Cp.prototype.keyword=function(e){if(IAt.test(e)){this.word+=e;return}if(e===\"[\"){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=pS;return}if(iI.test(e)){this.afterItem(e);return}throw new Error(`havn't handled \"`+e+'\" in keyword yet, index '+this.place)};Cp.prototype.neutral=function(e){if(PAt.test(e)){this.word=e,this.state=FZ;return}if(e==='\"'){this.word=\"\",this.state=rI;return}if(UZ.test(e)){this.word=e,this.state=zZ;return}if(iI.test(e)){this.afterItem(e);return}throw new Error(`havn't handled \"`+e+'\" in neutral yet, index '+this.place)};Cp.prototype.output=function(){for(;this.place0?90:-90),e.lat_ts=e.lat1):!e.lat_ts&&e.lat0&&e.projName===\"Polar_Stereographic\"&&(e.lat_ts=e.lat0,e.lat0=dd(e.lat0>0?90:-90))}function nI(e){var t=BZ(e),r=t.shift(),i=t.shift();t.unshift([\"name\",i]),t.unshift([\"type\",r]);var s={};return Qg(t,s),RAt(s),s}function Ju(e){var t=this;if(arguments.length===2){var r=arguments[1];typeof r==\"string\"?r.charAt(0)===\"+\"?Ju[e]=dS(arguments[1]):Ju[e]=nI(arguments[1]):Ju[e]=r}else if(arguments.length===1){if(Array.isArray(e))return e.map(function(i){Array.isArray(i)?Ju.apply(t,i):Ju(i)});if(typeof e==\"string\"){if(e in Ju)return Ju[e]}else\"EPSG\"in e?Ju[\"EPSG:\"+e.EPSG]=e:\"ESRI\"in e?Ju[\"ESRI:\"+e.ESRI]=e:\"IAU2000\"in e?Ju[\"IAU2000:\"+e.IAU2000]=e:console.log(e);return}}PZ(Ju);var ax=Ju;function DAt(e){return typeof e==\"string\"}function OAt(e){return e in ax}var BAt=[\"PROJECTEDCRS\",\"PROJCRS\",\"GEOGCS\",\"GEOCCS\",\"PROJCS\",\"LOCAL_CS\",\"GEODCRS\",\"GEODETICCRS\",\"GEODETICDATUM\",\"ENGCRS\",\"ENGINEERINGCRS\"];function FAt(e){return BAt.some(function(t){return e.indexOf(t)>-1})}var zAt=[\"3857\",\"900913\",\"3785\",\"102113\"];function NAt(e){var t=uu(e,\"authority\");if(t){var r=uu(t,\"epsg\");return r&&zAt.indexOf(r)>-1}}function UAt(e){var t=uu(e,\"extension\");if(t)return uu(t,\"proj4\")}function VAt(e){return e[0]===\"+\"}function jAt(e){if(DAt(e)){if(OAt(e))return ax[e];if(FAt(e)){var t=nI(e);if(NAt(t))return ax[\"EPSG:3857\"];var r=UAt(t);return r?dS(r):t}if(VAt(e))return dS(e)}else return e}var jZ=jAt;function SB(e,t){e=e||{};var r,i;if(!t)return e;for(i in t)r=t[i],r!==void 0&&(e[i]=r);return e}function ol(e,t,r){var i=e*t;return r/Math.sqrt(1-i*i)}function pd(e){return e<0?-1:1}function Ce(e){return Math.abs(e)<=xs?e:e-pd(e)*Em}function Dl(e,t,r){var i=e*r,s=.5*e;return i=Math.pow((1-i)/(1+i),s),Math.tan(.5*(de-t))/i}function Lp(e,t){for(var r=.5*e,i,s,n=de-2*Math.atan(t),o=0;o<=15;o++)if(i=e*Math.sin(n),s=de-2*Math.atan(t*Math.pow((1-i)/(1+i),r))-n,n+=s,Math.abs(s)<=1e-10)return n;return-9999}function GAt(){var e=this.b/this.a;this.es=1-e*e,\"x0\"in this||(this.x0=0),\"y0\"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=ol(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function WAt(e){var t=e.x,r=e.y;if(r*Sc>90&&r*Sc<-90&&t*Sc>180&&t*Sc<-180)return null;var i,s;if(Math.abs(Math.abs(r)-de)<=Se)return null;if(this.sphere)i=this.x0+this.a*this.k0*Ce(t-this.long0),s=this.y0+this.a*this.k0*Math.log(Math.tan(Ui+.5*r));else{var n=Math.sin(r),o=Dl(this.e,r,n);i=this.x0+this.a*this.k0*Ce(t-this.long0),s=this.y0-this.a*this.k0*Math.log(o)}return e.x=i,e.y=s,e}function HAt(e){var t=e.x-this.x0,r=e.y-this.y0,i,s;if(this.sphere)s=de-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var n=Math.exp(-r/(this.a*this.k0));if(s=Lp(this.e,n),s===-9999)return null}return i=Ce(this.long0+t/(this.a*this.k0)),e.x=i,e.y=s,e}var qAt=[\"Mercator\",\"Popular Visualisation Pseudo Mercator\",\"Mercator_1SP\",\"Mercator_Auxiliary_Sphere\",\"merc\"],GZ={init:GAt,forward:WAt,inverse:HAt,names:qAt};function ZAt(){}function WZ(e){return e}var YAt=[\"longlat\",\"identity\"],HZ={init:ZAt,forward:WZ,inverse:WZ,names:YAt};var QAt=[GZ,HZ],sI={},oI=[];function qZ(e,t){var r=oI.length;return e.names?(oI[r]=e,e.names.forEach(function(i){sI[i.toLowerCase()]=r}),this):(console.log(t),!0)}function $At(e){if(!e)return!1;var t=e.toLowerCase();if(typeof sI[t]<\"u\"&&oI[sI[t]])return oI[sI[t]]}function XAt(){QAt.forEach(qZ)}var ZZ={start:XAt,add:qZ,get:$At};var Xr={};Xr.MERIT={a:6378137,rf:298.257,ellipseName:\"MERIT 1983\"};Xr.SGS85={a:6378136,rf:298.257,ellipseName:\"Soviet Geodetic System 85\"};Xr.GRS80={a:6378137,rf:298.257222101,ellipseName:\"GRS 1980(IUGG, 1980)\"};Xr.IAU76={a:6378140,rf:298.257,ellipseName:\"IAU 1976\"};Xr.airy={a:6377563396e-3,b:635625691e-2,ellipseName:\"Airy 1830\"};Xr.APL4={a:6378137,rf:298.25,ellipseName:\"Appl. Physics. 1965\"};Xr.NWL9D={a:6378145,rf:298.25,ellipseName:\"Naval Weapons Lab., 1965\"};Xr.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:\"Modified Airy\"};Xr.andrae={a:637710443e-2,rf:300,ellipseName:\"Andrae 1876 (Den., Iclnd.)\"};Xr.aust_SA={a:6378160,rf:298.25,ellipseName:\"Australian Natl & S. Amer. 1969\"};Xr.GRS67={a:6378160,rf:298.247167427,ellipseName:\"GRS 67(IUGG 1967)\"};Xr.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:\"Bessel 1841\"};Xr.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:\"Bessel 1841 (Namibia)\"};Xr.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:\"Clarke 1866\"};Xr.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:\"Clarke 1880 mod.\"};Xr.clrk80ign={a:63782492e-1,b:6356515,rf:293.4660213,ellipseName:\"Clarke 1880 (IGN)\"};Xr.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:\"Clarke 1858\"};Xr.CPM={a:63757387e-1,rf:334.29,ellipseName:\"Comm. des Poids et Mesures 1799\"};Xr.delmbr={a:6376428,rf:311.5,ellipseName:\"Delambre 1810 (Belgium)\"};Xr.engelis={a:637813605e-2,rf:298.2566,ellipseName:\"Engelis 1985\"};Xr.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:\"Everest 1830\"};Xr.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:\"Everest 1948\"};Xr.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:\"Everest 1956\"};Xr.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:\"Everest 1969\"};Xr.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:\"Everest (Sabah & Sarawak)\"};Xr.fschr60={a:6378166,rf:298.3,ellipseName:\"Fischer (Mercury Datum) 1960\"};Xr.fschr60m={a:6378155,rf:298.3,ellipseName:\"Fischer 1960\"};Xr.fschr68={a:6378150,rf:298.3,ellipseName:\"Fischer 1968\"};Xr.helmert={a:6378200,rf:298.3,ellipseName:\"Helmert 1906\"};Xr.hough={a:6378270,rf:297,ellipseName:\"Hough\"};Xr.intl={a:6378388,rf:297,ellipseName:\"International 1909 (Hayford)\"};Xr.kaula={a:6378163,rf:298.24,ellipseName:\"Kaula 1961\"};Xr.lerch={a:6378139,rf:298.257,ellipseName:\"Lerch 1979\"};Xr.mprts={a:6397300,rf:191,ellipseName:\"Maupertius 1738\"};Xr.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:\"New International 1967\"};Xr.plessis={a:6376523,rf:6355863,ellipseName:\"Plessis 1817 (France)\"};Xr.krass={a:6378245,rf:298.3,ellipseName:\"Krassovsky, 1942\"};Xr.SEasia={a:6378155,b:63567733205e-4,ellipseName:\"Southeast Asia\"};Xr.walbeck={a:6376896,b:63558348467e-4,ellipseName:\"Walbeck\"};Xr.WGS60={a:6378165,rf:298.3,ellipseName:\"WGS 60\"};Xr.WGS66={a:6378145,rf:298.25,ellipseName:\"WGS 66\"};Xr.WGS7={a:6378135,rf:298.26,ellipseName:\"WGS 72\"};var YZ=Xr.WGS84={a:6378137,rf:298.257223563,ellipseName:\"WGS 84\"};Xr.sphere={a:6370997,b:6370997,ellipseName:\"Normal Sphere (r=6370997)\"};function QZ(e,t,r,i){var s=e*e,n=t*t,o=(s-n)/s,c=0;i?(e*=1-o*(LZ+o*(kZ+o*RZ)),s=e*e,o=0):c=Math.sqrt(o);var f=(s-n)/n;return{es:o,e:c,ep2:f}}function $Z(e,t,r,i,s){if(!e){var n=uu(Xr,i);n||(n=YZ),e=n.a,t=n.b,r=n.rf}return r&&!t&&(t=(1-1/r)*e),(r===0||Math.abs(e-t)3&&(c.datum_params[3]!==0||c.datum_params[4]!==0||c.datum_params[5]!==0||c.datum_params[6]!==0)&&(c.datum_type=hf,c.datum_params[3]*=Yg,c.datum_params[4]*=Yg,c.datum_params[5]*=Yg,c.datum_params[6]=c.datum_params[6]/1e6+1)),o&&(c.datum_type=Ip,c.grids=o),c.a=r,c.b=i,c.es=s,c.ep2=n,c}var XZ=KAt;var KZ={};function MB(e,t){var r=new DataView(t),i=tmt(r),s=emt(r,i),n=rmt(r,s,i),o={header:s,subgrids:n};return KZ[e]=o,o}function JZ(e){if(e===void 0)return null;var t=e.split(\",\");return t.map(JAt)}function JAt(e){if(e.length===0)return null;var t=e[0]===\"@\";return t&&(e=e.slice(1)),e===\"null\"?{name:\"null\",mandatory:!t,grid:null,isNull:!0}:{name:e,mandatory:!t,grid:KZ[e]||null,isNull:!1}}function lx(e){return e/3600*Math.PI/180}function tmt(e){var t=e.getInt32(8,!1);return t===11?!1:(t=e.getInt32(8,!0),t!==11&&console.warn(\"Failed to detect nadgrid endian-ness, defaulting to little-endian\"),!0)}function emt(e,t){return{nFields:e.getInt32(8,t),nSubgridFields:e.getInt32(24,t),nSubgrids:e.getInt32(40,t),shiftType:TB(e,56,64).trim(),fromSemiMajorAxis:e.getFloat64(120,t),fromSemiMinorAxis:e.getFloat64(136,t),toSemiMajorAxis:e.getFloat64(152,t),toSemiMinorAxis:e.getFloat64(168,t)}}function TB(e,t,r){return String.fromCharCode.apply(null,new Uint8Array(e.buffer.slice(t,r)))}function rmt(e,t,r){for(var i=176,s=[],n=0;n5e-11?!1:e.datum_type===uf?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]:e.datum_type===hf?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]&&e.datum_params[3]===t.datum_params[3]&&e.datum_params[4]===t.datum_params[4]&&e.datum_params[5]===t.datum_params[5]&&e.datum_params[6]===t.datum_params[6]:!0}function aI(e,t,r){var i=e.x,s=e.y,n=e.z?e.z:0,o,c,f,_;if(s<-de&&s>-1.001*de)s=-de;else if(s>de&&s<1.001*de)s=de;else{if(s<-de)return{x:-1/0,y:-1/0,z:e.z};if(s>de)return{x:1/0,y:1/0,z:e.z}}return i>Math.PI&&(i-=2*Math.PI),c=Math.sin(s),_=Math.cos(s),f=c*c,o=r/Math.sqrt(1-t*f),{x:(o+n)*_*Math.cos(i),y:(o+n)*_*Math.sin(i),z:(o*(1-t)+n)*c}}function lI(e,t,r,i){var s=1e-12,n=s*s,o=30,c,f,_,w,I,R,N,j,Q,et,Y,K,J,ut=e.x,Et=e.y,kt=e.z?e.z:0,Xt,qt,le;if(c=Math.sqrt(ut*ut+Et*Et),f=Math.sqrt(ut*ut+Et*Et+kt*kt),c/rn&&Ji.y||j>i.x||Yc&&Math.abs(f.y)>c);if(o<0)return console.log(\"Inverse grid shift iterator failed to converge.\"),i;i.x=Ce(n.x+r.ll[0]),i.y=n.y+r.ll[1]}else isNaN(n.x)||(i.x=e.x+n.x,i.y=e.y+n.y);return i}function nY(e,t){var r={x:e.x/t.del[0],y:e.y/t.del[1]},i={x:Math.floor(r.x),y:Math.floor(r.y)},s={x:r.x-1*i.x,y:r.y-1*i.y},n={x:Number.NaN,y:Number.NaN},o;if(i.x<0||i.x>=t.lim[0]||i.y<0||i.y>=t.lim[1])return n;o=i.y*t.lim[0]+i.x;var c={x:t.cvs[o][0],y:t.cvs[o][1]};o++;var f={x:t.cvs[o][0],y:t.cvs[o][1]};o+=t.lim[0];var _={x:t.cvs[o][0],y:t.cvs[o][1]};o--;var w={x:t.cvs[o][0],y:t.cvs[o][1]},I=s.x*s.y,R=s.x*(1-s.y),N=(1-s.x)*(1-s.y),j=(1-s.x)*s.y;return n.x=N*c.x+R*f.x+j*w.x+I*_.x,n.y=N*c.y+R*f.y+j*w.y+I*_.y,n}function EB(e,t,r){var i=r.x,s=r.y,n=r.z||0,o,c,f,_={};for(f=0;f<3;f++)if(!(t&&f===2&&r.z===void 0))switch(f===0?(o=i,\"ew\".indexOf(e.axis[f])!==-1?c=\"x\":c=\"y\"):f===1?(o=s,\"ns\".indexOf(e.axis[f])!==-1?c=\"y\":c=\"x\"):(o=n,c=\"z\"),e.axis[f]){case\"e\":_[c]=o;break;case\"w\":_[c]=-o;break;case\"n\":_[c]=o;break;case\"s\":_[c]=-o;break;case\"u\":r[c]!==void 0&&(_.z=o);break;case\"d\":r[c]!==void 0&&(_.z=-o);break;default:return null}return _}function uI(e){var t={x:e[0],y:e[1]};return e.length>2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t}function aY(e){oY(e.x),oY(e.y)}function oY(e){if(typeof Number.isFinite==\"function\"){if(Number.isFinite(e))return;throw new TypeError(\"coordinates must be finite numbers\")}if(typeof e!=\"number\"||e!==e||!isFinite(e))throw new TypeError(\"coordinates must be finite numbers\")}function amt(e,t){return(e.datum.datum_type===uf||e.datum.datum_type===hf||e.datum.datum_type===Ip)&&t.datumCode!==\"WGS84\"||(t.datum.datum_type===uf||t.datum.datum_type===hf||t.datum.datum_type===Ip)&&e.datumCode!==\"WGS84\"}function $g(e,t,r,i){var s;Array.isArray(r)?r=uI(r):r={x:r.x,y:r.y,z:r.z,m:r.m};var n=r.z!==void 0;if(aY(r),e.datum&&t.datum&&amt(e,t)&&(s=new Pm(\"WGS84\"),r=$g(e,s,r,i),e=s),i&&e.axis!==\"enu\"&&(r=EB(e,!1,r)),e.projName===\"longlat\")r={x:r.x*vs,y:r.y*vs,z:r.z||0};else if(e.to_meter&&(r={x:r.x*e.to_meter,y:r.y*e.to_meter,z:r.z||0}),r=e.inverse(r),!r)return;if(e.from_greenwich&&(r.x+=e.from_greenwich),r=sY(e.datum,t.datum,r),!!r)return t.from_greenwich&&(r={x:r.x-t.from_greenwich,y:r.y,z:r.z||0}),t.projName===\"longlat\"?r={x:r.x*Sc,y:r.y*Sc,z:r.z||0}:(r=t.forward(r),t.to_meter&&(r={x:r.x/t.to_meter,y:r.y/t.to_meter,z:r.z||0})),i&&t.axis!==\"enu\"?EB(t,!0,r):(r&&!n&&delete r.z,r)}var lY=Pm(\"WGS84\");function PB(e,t,r,i){var s,n,o;return Array.isArray(r)?(s=$g(e,t,r,i)||{x:NaN,y:NaN},r.length>2?typeof e.name<\"u\"&&e.name===\"geocent\"||typeof t.name<\"u\"&&t.name===\"geocent\"?typeof s.z==\"number\"?[s.x,s.y,s.z].concat(r.splice(3)):[s.x,s.y,r[2]].concat(r.splice(3)):[s.x,s.y].concat(r.splice(2)):[s.x,s.y]):(n=$g(e,t,r,i),o=Object.keys(r),o.length===2||o.forEach(function(c){if(typeof e.name<\"u\"&&e.name===\"geocent\"||typeof t.name<\"u\"&&t.name===\"geocent\"){if(c===\"x\"||c===\"y\"||c===\"z\")return}else if(c===\"x\"||c===\"y\")return;n[c]=r[c]}),n)}function cY(e){return e instanceof Pm?e:e.oProj?e.oProj:Pm(e)}function lmt(e,t,r){e=cY(e);var i=!1,s;return typeof t>\"u\"?(t=e,e=lY,i=!0):(typeof t.x<\"u\"||Array.isArray(t))&&(r=t,t=e,e=lY,i=!0),t=cY(t),r?PB(e,t,r):(s={forward:function(n,o){return PB(e,t,n,o)},inverse:function(n,o){return PB(t,e,n,o)}},i&&(s.oProj=t),s)}var Tc=lmt;var uY=6,fY=\"AJSAJS\",dY=\"AFAFAF\",ux=65,Mc=73,th=79,AS=86,mS=90,pY={forward:CB,inverse:cmt,toPoint:LB};function CB(e,t){return t=t||5,fmt(umt({lat:e[1],lon:e[0]}),t)}function cmt(e){var t=kB(mY(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function LB(e){var t=kB(mY(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function IB(e){return e*(Math.PI/180)}function hY(e){return 180*(e/Math.PI)}function umt(e){var t=e.lat,r=e.lon,i=6378137,s=.00669438,n=.9996,o,c,f,_,w,I,R,N=IB(t),j=IB(r),Q,et;et=Math.floor((r+180)/6)+1,r===180&&(et=60),t>=56&&t<64&&r>=3&&r<12&&(et=32),t>=72&&t<84&&(r>=0&&r<9?et=31:r>=9&&r<21?et=33:r>=21&&r<33?et=35:r>=33&&r<42&&(et=37)),o=(et-1)*6-180+3,Q=IB(o),c=s/(1-s),f=i/Math.sqrt(1-s*Math.sin(N)*Math.sin(N)),_=Math.tan(N)*Math.tan(N),w=c*Math.cos(N)*Math.cos(N),I=Math.cos(N)*(j-Q),R=i*((1-s/4-3*s*s/64-5*s*s*s/256)*N-(3*s/8+3*s*s/32+45*s*s*s/1024)*Math.sin(2*N)+(15*s*s/256+45*s*s*s/1024)*Math.sin(4*N)-35*s*s*s/3072*Math.sin(6*N));var Y=n*f*(I+(1-_+w)*I*I*I/6+(5-18*_+_*_+72*w-58*c)*I*I*I*I*I/120)+5e5,K=n*(R+f*Math.tan(N)*(I*I/2+(5-_+9*w+4*w*w)*I*I*I*I/24+(61-58*_+_*_+600*w-330*c)*I*I*I*I*I*I/720));return t<0&&(K+=1e7),{northing:Math.round(K),easting:Math.round(Y),zoneNumber:et,zoneLetter:hmt(t)}}function kB(e){var t=e.northing,r=e.easting,i=e.zoneLetter,s=e.zoneNumber;if(s<0||s>60)return null;var n=.9996,o=6378137,c=.00669438,f,_=(1-Math.sqrt(1-c))/(1+Math.sqrt(1-c)),w,I,R,N,j,Q,et,Y,K,J=r-5e5,ut=t;i<\"N\"&&(ut-=1e7),et=(s-1)*6-180+3,f=c/(1-c),Q=ut/n,Y=Q/(o*(1-c/4-3*c*c/64-5*c*c*c/256)),K=Y+(3*_/2-27*_*_*_/32)*Math.sin(2*Y)+(21*_*_/16-55*_*_*_*_/32)*Math.sin(4*Y)+151*_*_*_/96*Math.sin(6*Y),w=o/Math.sqrt(1-c*Math.sin(K)*Math.sin(K)),I=Math.tan(K)*Math.tan(K),R=f*Math.cos(K)*Math.cos(K),N=o*(1-c)/Math.pow(1-c*Math.sin(K)*Math.sin(K),1.5),j=J/(w*n);var Et=K-w*Math.tan(K)/N*(j*j/2-(5+3*I+10*R-4*R*R-9*f)*j*j*j*j/24+(61+90*I+298*R+45*I*I-252*f-3*R*R)*j*j*j*j*j*j/720);Et=hY(Et);var kt=(j-(1+2*I+R)*j*j*j/6+(5-2*R+28*I-3*R*R+8*f+24*I*I)*j*j*j*j*j/120)/Math.cos(K);kt=et+hY(kt);var Xt;if(e.accuracy){var qt=kB({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});Xt={top:qt.lat,right:qt.lon,bottom:Et,left:kt}}else Xt={lat:Et,lon:kt};return Xt}function hmt(e){var t=\"Z\";return 84>=e&&e>=72?t=\"X\":72>e&&e>=64?t=\"W\":64>e&&e>=56?t=\"V\":56>e&&e>=48?t=\"U\":48>e&&e>=40?t=\"T\":40>e&&e>=32?t=\"S\":32>e&&e>=24?t=\"R\":24>e&&e>=16?t=\"Q\":16>e&&e>=8?t=\"P\":8>e&&e>=0?t=\"N\":0>e&&e>=-8?t=\"M\":-8>e&&e>=-16?t=\"L\":-16>e&&e>=-24?t=\"K\":-24>e&&e>=-32?t=\"J\":-32>e&&e>=-40?t=\"H\":-40>e&&e>=-48?t=\"G\":-48>e&&e>=-56?t=\"F\":-56>e&&e>=-64?t=\"E\":-64>e&&e>=-72?t=\"D\":-72>e&&e>=-80&&(t=\"C\"),t}function fmt(e,t){var r=\"00000\"+e.easting,i=\"00000\"+e.northing;return e.zoneNumber+e.zoneLetter+dmt(e.easting,e.northing,e.zoneNumber)+r.substr(r.length-5,t)+i.substr(i.length-5,t)}function dmt(e,t,r){var i=AY(r),s=Math.floor(e/1e5),n=Math.floor(t/1e5)%20;return pmt(s,n,i)}function AY(e){var t=e%uY;return t===0&&(t=uY),t}function pmt(e,t,r){var i=r-1,s=fY.charCodeAt(i),n=dY.charCodeAt(i),o=s+e-1,c=n+t,f=!1;o>mS&&(o=o-mS+ux-1,f=!0),(o===Mc||sMc||(o>Mc||sth||(o>th||smS&&(o=o-mS+ux-1),c>AS?(c=c-AS+ux-1,f=!0):f=!1,(c===Mc||nMc||(c>Mc||nth||(c>th||nAS&&(c=c-AS+ux-1);var _=String.fromCharCode(o)+String.fromCharCode(c);return _}function mY(e){if(e&&e.length===0)throw\"MGRSPoint coverting from nothing\";for(var t=e.length,r=null,i=\"\",s,n=0;!/[A-Z]/.test(s=e.charAt(n));){if(n>=2)throw\"MGRSPoint bad conversion from: \"+e;i+=s,n++}var o=parseInt(i,10);if(n===0||n+3>t)throw\"MGRSPoint bad conversion from: \"+e;var c=e.charAt(n++);if(c<=\"A\"||c===\"B\"||c===\"Y\"||c>=\"Z\"||c===\"I\"||c===\"O\")throw\"MGRSPoint zone letter \"+c+\" not handled: \"+e;r=e.substring(n,n+=2);for(var f=AY(o),_=Amt(r.charAt(0),f),w=mmt(r.charAt(1),f);w0&&(Q=1e5/Math.pow(10,R),et=e.substring(n,n+R),N=parseFloat(et)*Q,Y=e.substring(n+R),j=parseFloat(Y)*Q),K=N+_,J=j+w,{easting:K,northing:J,zoneLetter:c,zoneNumber:o,accuracy:Q}}function Amt(e,t){for(var r=fY.charCodeAt(t-1),i=1e5,s=!1;r!==e.charCodeAt(0);){if(r++,r===Mc&&r++,r===th&&r++,r>mS){if(s)throw\"Bad character: \"+e;r=ux,s=!0}i+=1e5}return i}function mmt(e,t){if(e>\"V\")throw\"MGRSPoint given invalid Northing \"+e;for(var r=dY.charCodeAt(t-1),i=0,s=!1;r!==e.charCodeAt(0);){if(r++,r===Mc&&r++,r===th&&r++,r>AS){if(s)throw\"Bad character: \"+e;r=ux,s=!0}i+=1e5}return i}function gmt(e){var t;switch(e){case\"C\":t=11e5;break;case\"D\":t=2e6;break;case\"E\":t=28e5;break;case\"F\":t=37e5;break;case\"G\":t=46e5;break;case\"H\":t=55e5;break;case\"J\":t=64e5;break;case\"K\":t=73e5;break;case\"L\":t=82e5;break;case\"M\":t=91e5;break;case\"N\":t=0;break;case\"P\":t=8e5;break;case\"Q\":t=17e5;break;case\"R\":t=26e5;break;case\"S\":t=35e5;break;case\"T\":t=44e5;break;case\"U\":t=53e5;break;case\"V\":t=62e5;break;case\"W\":t=7e6;break;case\"X\":t=79e5;break;default:t=-1}if(t>=0)return t;throw\"Invalid zone letter: \"+e}function hx(e,t,r){if(!(this instanceof hx))return new hx(e,t,r);if(Array.isArray(e))this.x=e[0],this.y=e[1],this.z=e[2]||0;else if(typeof e==\"object\")this.x=e.x,this.y=e.y,this.z=e.z||0;else if(typeof e==\"string\"&&typeof t>\"u\"){var i=e.split(\",\");this.x=parseFloat(i[0],10),this.y=parseFloat(i[1],10),this.z=parseFloat(i[2],10)||0}else this.x=e,this.y=t,this.z=r||0;console.warn(\"proj4.Point will be removed in version 3, use proj4.toPoint\")}hx.fromMGRS=function(e){return new hx(LB(e))};hx.prototype.toMGRS=function(e){return CB([this.x,this.y],e)};var gY=hx;var _mt=1,ymt=.25,_Y=.046875,yY=.01953125,vY=.01068115234375,vmt=.75,xmt=.46875,bmt=.013020833333333334,wmt=.007120768229166667,Smt=.3645833333333333,Tmt=.005696614583333333,Mmt=.3076171875;function hI(e){var t=[];t[0]=_mt-e*(ymt+e*(_Y+e*(yY+e*vY))),t[1]=e*(vmt-e*(_Y+e*(yY+e*vY)));var r=e*e;return t[2]=r*(xmt-e*(bmt+e*wmt)),r*=e,t[3]=r*(Smt-e*Tmt),t[4]=r*e*Mmt,t}function Xg(e,t,r,i){return r*=t,t*=t,i[0]*e-r*(i[1]+t*(i[2]+t*(i[3]+t*i[4])))}var Emt=20;function fI(e,t,r){for(var i=1/(1-t),s=e,n=Emt;n;--n){var o=Math.sin(s),c=1-t*o*o;if(c=(Xg(s,o,Math.cos(s),r)-e)*(c*Math.sqrt(c))*i,s-=c,Math.abs(c)Se?Math.tan(r):0,Q=Math.pow(j,2),et=Math.pow(Q,2);s=1-this.es*Math.pow(c,2),w=w/Math.sqrt(s);var Y=Xg(r,c,f,this.en);n=this.a*(this.k0*w*(1+I/6*(1-Q+R+I/20*(5-18*Q+et+14*R-58*Q*R+I/42*(61+179*et-et*Q-479*Q)))))+this.x0,o=this.a*(this.k0*(Y-this.ml0+c*i*w/2*(1+I/12*(5-Q+9*R+4*N+I/30*(61+et-58*Q+270*R-330*Q*R+I/56*(1385+543*et-et*Q-3111*Q))))))+this.y0}else{var _=f*Math.sin(i);if(Math.abs(Math.abs(_)-1)=1){if(_-1>Se)return 93;o=0}else o=Math.acos(o);r<0&&(o=-o),o=this.a*this.k0*(o-this.lat0)+this.y0}return e.x=n,e.y=o,e}function Cmt(e){var t,r,i,s,n=(e.x-this.x0)*(1/this.a),o=(e.y-this.y0)*(1/this.a);if(this.es)if(t=this.ml0+o/this.k0,r=fI(t,this.es,this.en),Math.abs(r)Se?Math.tan(r):0,j=this.ep2*Math.pow(R,2),Q=Math.pow(j,2),et=Math.pow(N,2),Y=Math.pow(et,2);t=1-this.es*Math.pow(I,2);var K=n*Math.sqrt(t)/this.k0,J=Math.pow(K,2);t=t*N,i=r-t*J/(1-this.es)*.5*(1-J/12*(5+3*et-9*j*et+j-4*Q-J/30*(61+90*et-252*j*et+45*Y+46*j-J/56*(1385+3633*et+4095*Y+1574*Y*et)))),s=Ce(this.long0+K*(1-J/6*(1+2*et+j-J/20*(5+28*et+24*Y+8*j*et+6*j-J/42*(61+662*et+1320*Y+720*Y*et))))/R)}else i=de*pd(o),s=0;else{var c=Math.exp(n/this.k0),f=.5*(c-1/c),_=this.lat0+o/this.k0,w=Math.cos(_);t=Math.sqrt((1-Math.pow(w,2))/(1+Math.pow(f,2))),i=Math.asin(t),o<0&&(i=-i),f===0&&w===0?s=0:s=Ce(Math.atan2(f,w)+this.long0)}return e.x=s,e.y=i,e}var Lmt=[\"Fast_Transverse_Mercator\",\"Fast Transverse Mercator\"],fx={init:Pmt,forward:Imt,inverse:Cmt,names:Lmt};function dI(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function Ta(e,t){e=Math.abs(e),t=Math.abs(t);var r=Math.max(e,t),i=Math.min(e,t)/(r||1);return r*Math.sqrt(1+Math.pow(i,2))}function xY(e){var t=1+e,r=t-1;return r===0?e:e*Math.log(t)/r}function bY(e){var t=Math.abs(e);return t=xY(t*(1+t/(Ta(1,t)+1))),e<0?-t:t}function pI(e,t){for(var r=2*Math.cos(2*t),i=e.length-1,s=e[i],n=0,o;--i>=0;)o=-n+r*s+e[i],n=s,s=o;return t+o*Math.sin(2*t)}function wY(e,t){for(var r=2*Math.cos(t),i=e.length-1,s=e[i],n=0,o;--i>=0;)o=-n+r*s+e[i],n=s,s=o;return Math.sin(t)*o}function SY(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function RB(e,t,r){for(var i=Math.sin(t),s=Math.cos(t),n=dI(r),o=SY(r),c=2*s*o,f=-2*i*n,_=e.length-1,w=e[_],I=0,R=0,N=0,j,Q;--_>=0;)j=R,Q=I,R=w,I=N,w=-j+c*R-f*I+e[_],N=-Q+f*R+c*I;return c=i*o,f=s*n,[c*w-f*N,c*N+f*w]}function kmt(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION[\"Fast_Transverse_Mercator\"] in the WKT.');this.approx&&(fx.init.apply(this),this.forward=fx.forward,this.inverse=fx.inverse),this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var e=this.es/(1+Math.sqrt(1-this.es)),t=e/(2-e),r=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+t*(-2854/675)))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+t*(4642/4725)))))),r=r*t,this.cgb[1]=r*(7/3+t*(-8/5+t*(-227/45+t*(2704/315+t*(2323/945))))),this.cbg[1]=r*(5/3+t*(-16/15+t*(-13/9+t*(904/315+t*(-1522/945))))),r=r*t,this.cgb[2]=r*(56/15+t*(-136/35+t*(-1262/105+t*(73814/2835)))),this.cbg[2]=r*(-26/15+t*(34/21+t*(8/5+t*(-12686/2835)))),r=r*t,this.cgb[3]=r*(4279/630+t*(-332/35+t*(-399572/14175))),this.cbg[3]=r*(1237/630+t*(-12/5+t*(-24832/14175))),r=r*t,this.cgb[4]=r*(4174/315+t*(-144838/6237)),this.cbg[4]=r*(-734/315+t*(109598/31185)),r=r*t,this.cgb[5]=r*(601676/22275),this.cbg[5]=r*(444337/155925),r=Math.pow(t,2),this.Qn=this.k0/(1+t)*(1+r*(1/4+r*(1/64+r/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+t*(-96199/604800)))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+t*(7891/37800)))))),this.utg[1]=r*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+t*(1118711/3870720))))),this.gtu[1]=r*(13/48+t*(-3/5+t*(557/1440+t*(281/630+t*(-1983433/1935360))))),r=r*t,this.utg[2]=r*(-17/480+t*(37/840+t*(209/4480+t*(-5569/90720)))),this.gtu[2]=r*(61/240+t*(-103/140+t*(15061/26880+t*(167603/181440)))),r=r*t,this.utg[3]=r*(-4397/161280+t*(11/504+t*(830251/7257600))),this.gtu[3]=r*(49561/161280+t*(-179/168+t*(6601661/7257600))),r=r*t,this.utg[4]=r*(-4583/161280+t*(108847/3991680)),this.gtu[4]=r*(34729/80640+t*(-3418889/1995840)),r=r*t,this.utg[5]=r*(-20648693/638668800),this.gtu[5]=r*(212378941/319334400);var i=pI(this.cbg,this.lat0);this.Zb=-this.Qn*(i+wY(this.gtu,2*i))}function Rmt(e){var t=Ce(e.x-this.long0),r=e.y;r=pI(this.cbg,r);var i=Math.sin(r),s=Math.cos(r),n=Math.sin(t),o=Math.cos(t);r=Math.atan2(i,o*s),t=Math.atan2(n*s,Ta(i,s*o)),t=bY(Math.tan(t));var c=RB(this.gtu,2*r,2*t);r=r+c[0],t=t+c[1];var f,_;return Math.abs(t)<=2.623395162778?(f=this.a*(this.Qn*t)+this.x0,_=this.a*(this.Qn*r+this.Zb)+this.y0):(f=1/0,_=1/0),e.x=f,e.y=_,e}function Dmt(e){var t=(e.x-this.x0)*(1/this.a),r=(e.y-this.y0)*(1/this.a);r=(r-this.Zb)/this.Qn,t=t/this.Qn;var i,s;if(Math.abs(t)<=2.623395162778){var n=RB(this.utg,2*r,2*t);r=r+n[0],t=t+n[1],t=Math.atan(dI(t));var o=Math.sin(r),c=Math.cos(r),f=Math.sin(t),_=Math.cos(t);r=Math.atan2(o*_,Ta(f,_*c)),t=Math.atan2(f,_*c),i=Ce(t+this.long0),s=pI(this.cgb,r)}else i=1/0,s=1/0;return e.x=i,e.y=s,e}var Omt=[\"Extended_Transverse_Mercator\",\"Extended Transverse Mercator\",\"etmerc\",\"Transverse_Mercator\",\"Transverse Mercator\",\"Gauss Kruger\",\"Gauss_Kruger\",\"tmerc\"],dx={init:kmt,forward:Rmt,inverse:Dmt,names:Omt};function TY(e,t){if(e===void 0){if(e=Math.floor((Ce(t)+Math.PI)*30/Math.PI)+1,e<0)return 0;if(e>60)return 60}return e}var Bmt=\"etmerc\";function Fmt(){var e=TY(this.zone,this.long0);if(e===void 0)throw new Error(\"unknown utm zone\");this.lat0=0,this.long0=(6*Math.abs(e)-183)*vs,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,dx.init.apply(this),this.forward=dx.forward,this.inverse=dx.inverse}var zmt=[\"Universal Transverse Mercator System\",\"utm\"],MY={init:Fmt,names:zmt,dependsOn:Bmt};function AI(e,t){return Math.pow((1-e)/(1+e),t)}var Nmt=20;function Umt(){var e=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*e*e),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(e/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+Ui)/(Math.pow(Math.tan(.5*this.lat0+Ui),this.C)*AI(this.e*e,this.ratexp))}function Vmt(e){var t=e.x,r=e.y;return e.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*r+Ui),this.C)*AI(this.e*Math.sin(r),this.ratexp))-de,e.x=this.C*t,e}function jmt(e){for(var t=1e-14,r=e.x/this.C,i=e.y,s=Math.pow(Math.tan(.5*i+Ui)/this.K,1/this.C),n=Nmt;n>0&&(i=2*Math.atan(s*AI(this.e*Math.sin(e.y),-.5*this.e))-de,!(Math.abs(i-e.y)0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Se&&Math.abs(Math.cos(this.lat_ts))>Se&&(this.k0=.5*this.cons*ol(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Dl(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=ol(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-de,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function $mt(e){var t=e.x,r=e.y,i=Math.sin(r),s=Math.cos(r),n,o,c,f,_,w,I=Ce(t-this.long0);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=Se&&Math.abs(r+this.lat0)<=Se?(e.x=NaN,e.y=NaN,e):this.sphere?(n=2*this.k0/(1+this.sinlat0*i+this.coslat0*s*Math.cos(I)),e.x=this.a*n*s*Math.sin(I)+this.x0,e.y=this.a*n*(this.coslat0*i-this.sinlat0*s*Math.cos(I))+this.y0,e):(o=2*Math.atan(this.ssfn_(r,i,this.e))-de,f=Math.cos(o),c=Math.sin(o),Math.abs(this.coslat0)<=Se?(_=Dl(this.e,r*this.con,this.con*i),w=2*this.a*this.k0*_/this.cons,e.x=this.x0+w*Math.sin(t-this.long0),e.y=this.y0-this.con*w*Math.cos(t-this.long0),e):(Math.abs(this.sinlat0)0?t=Ce(this.long0+Math.atan2(e.x,-1*e.y)):t=Ce(this.long0+Math.atan2(e.x,e.y)):t=Ce(this.long0+Math.atan2(e.x*Math.sin(c),o*this.coslat0*Math.cos(c)-e.y*this.sinlat0*Math.sin(c))),e.x=t,e.y=r,e)}else if(Math.abs(this.coslat0)<=Se){if(o<=Se)return r=this.lat0,t=this.long0,e.x=t,e.y=r,e;e.x*=this.con,e.y*=this.con,i=o*this.cons/(2*this.a*this.k0),r=this.con*Lp(this.e,i),t=this.con*Ce(this.con*this.long0+Math.atan2(e.x,-1*e.y))}else s=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,o<=Se?n=this.X0:(n=Math.asin(Math.cos(s)*this.sinX0+e.y*Math.sin(s)*this.cosX0/o),t=Ce(this.long0+Math.atan2(e.x*Math.sin(s),o*this.cosX0*Math.cos(s)-e.y*this.sinX0*Math.sin(s)))),r=-1*Lp(this.e,Math.tan(.5*(de+n)));return e.x=t,e.y=r,e}var Kmt=[\"stere\",\"Stereographic_South_Pole\",\"Polar Stereographic (variant B)\",\"Polar_Stereographic\"],PY={init:Qmt,forward:$mt,inverse:Xmt,names:Kmt,ssfn_:Ymt};function Jmt(){var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),r=this.a,i=this.rf,s=1/i,n=2*s-Math.pow(s,2),o=this.e=Math.sqrt(n);this.R=this.k0*r*Math.sqrt(1-n)/(1-n*Math.pow(t,2)),this.alpha=Math.sqrt(1+n/(1-n)*Math.pow(Math.cos(e),4)),this.b0=Math.asin(t/this.alpha);var c=Math.log(Math.tan(Math.PI/4+this.b0/2)),f=Math.log(Math.tan(Math.PI/4+e/2)),_=Math.log((1+o*t)/(1-o*t));this.K=c-this.alpha*f+this.alpha*o/2*_}function t0t(e){var t=Math.log(Math.tan(Math.PI/4-e.y/2)),r=this.e/2*Math.log((1+this.e*Math.sin(e.y))/(1-this.e*Math.sin(e.y))),i=-this.alpha*(t+r)+this.K,s=2*(Math.atan(Math.exp(i))-Math.PI/4),n=this.alpha*(e.x-this.lambda0),o=Math.atan(Math.sin(n)/(Math.sin(this.b0)*Math.tan(s)+Math.cos(this.b0)*Math.cos(n))),c=Math.asin(Math.cos(this.b0)*Math.sin(s)-Math.sin(this.b0)*Math.cos(s)*Math.cos(n));return e.y=this.R/2*Math.log((1+Math.sin(c))/(1-Math.sin(c)))+this.y0,e.x=this.R*o+this.x0,e}function e0t(e){for(var t=e.x-this.x0,r=e.y-this.y0,i=t/this.R,s=2*(Math.atan(Math.exp(r/this.R))-Math.PI/4),n=Math.asin(Math.cos(this.b0)*Math.sin(s)+Math.sin(this.b0)*Math.cos(s)*Math.cos(i)),o=Math.atan(Math.sin(i)/(Math.cos(this.b0)*Math.cos(i)-Math.sin(this.b0)*Math.tan(s))),c=this.lambda0+o/this.alpha,f=0,_=n,w=-1e3,I=0;Math.abs(_-w)>1e-7;){if(++I>20)return;f=1/this.alpha*(Math.log(Math.tan(Math.PI/4+n/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(_))/2)),w=_,_=2*Math.atan(Math.exp(f))-Math.PI/2}return e.x=c,e.y=_,e}var r0t=[\"somerc\"],IY={init:Jmt,forward:t0t,inverse:e0t,names:r0t};var px=1e-7;function i0t(e){var t=[\"Hotine_Oblique_Mercator\",\"Hotine_Oblique_Mercator_Azimuth_Natural_Origin\"],r=typeof e.PROJECTION==\"object\"?Object.keys(e.PROJECTION)[0]:e.PROJECTION;return\"no_uoff\"in e||\"no_off\"in e||t.indexOf(r)!==-1}function n0t(){var e,t,r,i,s,n,o,c,f,_,w=0,I,R=0,N=0,j=0,Q=0,et=0,Y=0,K;this.no_off=i0t(this),this.no_rot=\"no_rot\"in this;var J=!1;\"alpha\"in this&&(J=!0);var ut=!1;if(\"rectified_grid_angle\"in this&&(ut=!0),J&&(Y=this.alpha),ut&&(w=this.rectified_grid_angle*vs),J||ut)R=this.longc;else if(N=this.long1,Q=this.lat1,j=this.long2,et=this.lat2,Math.abs(Q-et)<=px||(e=Math.abs(Q))<=px||Math.abs(e-de)<=px||Math.abs(Math.abs(this.lat0)-de)<=px||Math.abs(Math.abs(et)-de)<=px)throw new Error;var Et=1-this.es;t=Math.sqrt(Et),Math.abs(this.lat0)>Se?(c=Math.sin(this.lat0),r=Math.cos(this.lat0),e=1-this.es*c*c,this.B=r*r,this.B=Math.sqrt(1+this.es*this.B*this.B/Et),this.A=this.B*this.k0*t/e,i=this.B*t/(r*Math.sqrt(e)),s=i*i-1,s<=0?s=0:(s=Math.sqrt(s),this.lat0<0&&(s=-s)),this.E=s+=i,this.E*=Math.pow(Dl(this.e,this.lat0,c),this.B)):(this.B=1/t,this.A=this.k0,this.E=i=s=1),J||ut?(J?(I=Math.asin(Math.sin(Y)/i),ut||(w=Y)):(I=w,Y=Math.asin(i*Math.sin(I))),this.lam0=R-Math.asin(.5*(s-1/s)*Math.tan(I))/this.B):(n=Math.pow(Dl(this.e,Q,Math.sin(Q)),this.B),o=Math.pow(Dl(this.e,et,Math.sin(et)),this.B),s=this.E/n,f=(o-n)/(o+n),_=this.E*this.E,_=(_-o*n)/(_+o*n),e=N-j,e<-Math.pi?j-=Em:e>Math.pi&&(j+=Em),this.lam0=Ce(.5*(N+j)-Math.atan(_*Math.tan(.5*this.B*(N-j))/f)/this.B),I=Math.atan(2*Math.sin(this.B*Ce(N-this.lam0))/(s-1/s)),w=Y=Math.asin(i*Math.sin(I))),this.singam=Math.sin(I),this.cosgam=Math.cos(I),this.sinrot=Math.sin(w),this.cosrot=Math.cos(w),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,K=this.A*this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(i*i-1)/Math.cos(Y))),this.lat0<0&&(this.u_0=-this.u_0)),s=.5*I,this.v_pole_n=this.ArB*Math.log(Math.tan(Ui-s)),this.v_pole_s=this.ArB*Math.log(Math.tan(Ui+s))}function s0t(e){var t={},r,i,s,n,o,c,f,_;if(e.x=e.x-this.lam0,Math.abs(Math.abs(e.y)-de)>Se){if(o=this.E/Math.pow(Dl(this.e,e.y,Math.sin(e.y)),this.B),c=1/o,r=.5*(o-c),i=.5*(o+c),n=Math.sin(this.B*e.x),s=(r*this.singam-n*this.cosgam)/i,Math.abs(Math.abs(s)-1)0?this.v_pole_n:this.v_pole_s,f=this.ArB*e.y;return this.no_rot?(t.x=f,t.y=_):(f-=this.u_0,t.x=_*this.cosrot+f*this.sinrot,t.y=f*this.cosrot-_*this.sinrot),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function o0t(e){var t,r,i,s,n,o,c,f={};if(e.x=(e.x-this.x0)*(1/this.a),e.y=(e.y-this.y0)*(1/this.a),this.no_rot?(r=e.y,t=e.x):(r=e.x*this.cosrot-e.y*this.sinrot,t=e.y*this.cosrot+e.x*this.sinrot+this.u_0),i=Math.exp(-this.BrA*r),s=.5*(i-1/i),n=.5*(i+1/i),o=Math.sin(this.BrA*t),c=(o*this.cosgam+s*this.singam)/n,Math.abs(Math.abs(c)-1)Se?this.ns=Math.log(i/c)/Math.log(s/f):this.ns=t,isNaN(this.ns)&&(this.ns=t),this.f0=i/(this.ns*Math.pow(s,this.ns)),this.rh=this.a*this.f0*Math.pow(_,this.ns),this.title||(this.title=\"Lambert Conformal Conic\")}}function c0t(e){var t=e.x,r=e.y;Math.abs(2*Math.abs(r)-Math.PI)<=Se&&(r=pd(r)*(de-2*Se));var i=Math.abs(Math.abs(r)-de),s,n;if(i>Se)s=Dl(this.e,r,Math.sin(r)),n=this.a*this.f0*Math.pow(s,this.ns);else{if(i=r*this.ns,i<=0)return null;n=0}var o=this.ns*Ce(t-this.long0);return e.x=this.k0*(n*Math.sin(o))+this.x0,e.y=this.k0*(this.rh-n*Math.cos(o))+this.y0,e}function u0t(e){var t,r,i,s,n,o=(e.x-this.x0)/this.k0,c=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(o*o+c*c),r=1):(t=-Math.sqrt(o*o+c*c),r=-1);var f=0;if(t!==0&&(f=Math.atan2(r*o,r*c)),t!==0||this.ns>0){if(r=1/this.ns,i=Math.pow(t/(this.a*this.f0),r),s=Lp(this.e,i),s===-9999)return null}else s=-de;return n=Ce(f/this.ns+this.long0),e.x=n,e.y=s,e}var h0t=[\"Lambert Tangential Conformal Conic Projection\",\"Lambert_Conformal_Conic\",\"Lambert_Conformal_Conic_1SP\",\"Lambert_Conformal_Conic_2SP\",\"lcc\",\"Lambert Conic Conformal (1SP)\",\"Lambert Conic Conformal (2SP)\"],LY={init:l0t,forward:c0t,inverse:u0t,names:h0t};function f0t(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function d0t(e){var t,r,i,s,n,o,c,f=e.x,_=e.y,w=Ce(f-this.long0);return t=Math.pow((1+this.e*Math.sin(_))/(1-this.e*Math.sin(_)),this.alfa*this.e/2),r=2*(Math.atan(this.k*Math.pow(Math.tan(_/2+this.s45),this.alfa)/t)-this.s45),i=-w*this.alfa,s=Math.asin(Math.cos(this.ad)*Math.sin(r)+Math.sin(this.ad)*Math.cos(r)*Math.cos(i)),n=Math.asin(Math.cos(r)*Math.sin(i)/Math.cos(s)),o=this.n*n,c=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(s/2+this.s45),this.n),e.y=c*Math.cos(o)/1,e.x=c*Math.sin(o)/1,this.czech||(e.y*=-1,e.x*=-1),e}function p0t(e){var t,r,i,s,n,o,c,f,_=e.x;e.x=e.y,e.y=_,this.czech||(e.y*=-1,e.x*=-1),o=Math.sqrt(e.x*e.x+e.y*e.y),n=Math.atan2(e.y,e.x),s=n/Math.sin(this.s0),i=2*(Math.atan(Math.pow(this.ro0/o,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(i)-Math.sin(this.ad)*Math.cos(i)*Math.cos(s)),r=Math.asin(Math.cos(i)*Math.sin(s)/Math.cos(t)),e.x=this.long0-r/this.alfa,c=t,f=0;var w=0;do e.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(t/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(c))/(1-this.e*Math.sin(c)),this.e/2))-this.s45),Math.abs(c-e.y)<1e-10&&(f=1),c=e.y,w+=1;while(f===0&&w<15);return w>=15?null:e}var A0t=[\"Krovak\",\"krovak\"],kY={init:f0t,forward:d0t,inverse:p0t,names:A0t};function zo(e,t,r,i,s){return e*s-t*Math.sin(2*s)+r*Math.sin(4*s)-i*Math.sin(6*s)}function kp(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function Rp(e){return .375*e*(1+.25*e*(1+.46875*e))}function Dp(e){return .05859375*e*e*(1+.75*e)}function Op(e){return e*e*e*(35/3072)}function Bp(e,t,r){var i=t*r;return e/Math.sqrt(1-i*i)}function ff(e){return Math.abs(e)1e-7?(r=e*t,(1-e*e)*(t/(1-r*r)-.5/e*Math.log((1-r)/(1+r)))):2*t}var v0t=1,x0t=2,b0t=3,w0t=4;function S0t(){var e=Math.abs(this.lat0);if(Math.abs(e-de)0){var t;switch(this.qp=df(this.e,1),this.mmf=.5/(1-this.es),this.apa=R0t(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=df(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function T0t(e){var t,r,i,s,n,o,c,f,_,w,I=e.x,R=e.y;if(I=Ce(I-this.long0),this.sphere){if(n=Math.sin(R),w=Math.cos(R),i=Math.cos(I),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(r=this.mode===this.EQUIT?1+w*i:1+this.sinph0*n+this.cosph0*w*i,r<=Se)return null;r=Math.sqrt(2/r),t=r*w*Math.sin(I),r*=this.mode===this.EQUIT?n:this.cosph0*n-this.sinph0*w*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(R+this.lat0)=0?(t=(_=Math.sqrt(o))*s,r=i*(this.mode===this.S_POLE?_:-_)):t=r=0;break}}return e.x=this.a*t+this.x0,e.y=this.a*r+this.y0,e}function M0t(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,r=e.y/this.a,i,s,n,o,c,f,_;if(this.sphere){var w=0,I,R=0;if(I=Math.sqrt(t*t+r*r),s=I*.5,s>1)return null;switch(s=2*Math.asin(s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(R=Math.sin(s),w=Math.cos(s)),this.mode){case this.EQUIT:s=Math.abs(I)<=Se?0:Math.asin(r*R/I),t*=R,r=w*I;break;case this.OBLIQ:s=Math.abs(I)<=Se?this.lat0:Math.asin(w*this.sinph0+r*R*this.cosph0/I),t*=R*this.cosph0,r=(w-Math.sin(s)*this.sinph0)*I;break;case this.N_POLE:r=-r,s=de-s;break;case this.S_POLE:s-=de;break}i=r===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,r)}else{if(_=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,r*=this.dd,f=Math.sqrt(t*t+r*r),f1&&(e=e>1?1:-1),Math.asin(e)}function B0t(){Math.abs(this.lat1+this.lat2)Se?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function F0t(e){var t=e.x,r=e.y;this.sin_phi=Math.sin(r),this.cos_phi=Math.cos(r);var i=df(this.e3,this.sin_phi),s=this.a*Math.sqrt(this.c-this.ns0*i)/this.ns0,n=this.ns0*Ce(t-this.long0),o=s*Math.sin(n)+this.x0,c=this.rh-s*Math.cos(n)+this.y0;return e.x=o,e.y=c,e}function z0t(e){var t,r,i,s,n,o;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns0>=0?(t=Math.sqrt(e.x*e.x+e.y*e.y),i=1):(t=-Math.sqrt(e.x*e.x+e.y*e.y),i=-1),s=0,t!==0&&(s=Math.atan2(i*e.x,i*e.y)),i=t*this.ns0/this.a,this.sphere?o=Math.asin((this.c-i*i)/(2*this.ns0)):(r=(this.c-i*i)/this.ns0,o=this.phi1z(this.e3,r)),n=Ce(s/this.ns0+this.long0),e.x=n,e.y=o,e}function N0t(e,t){var r,i,s,n,o,c=Ec(.5*t);if(e0||Math.abs(o)<=Se?(c=this.x0+this.a*n*r*Math.sin(i)/o,f=this.y0+this.a*n*(this.cos_p14*t-this.sin_p14*r*s)/o):(c=this.x0+this.infinity_dist*r*Math.sin(i),f=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*r*s)),e.x=c,e.y=f,e}function G0t(e){var t,r,i,s,n,o;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=Math.sqrt(e.x*e.x+e.y*e.y))?(s=Math.atan2(t,this.rc),r=Math.sin(s),i=Math.cos(s),o=Ec(i*this.sin_p14+e.y*r*this.cos_p14/t),n=Math.atan2(e.x*r,t*this.cos_p14*i-e.y*this.sin_p14*r),n=Ce(this.long0+n)):(o=this.phic0,n=0),e.x=n,e.y=o,e}var W0t=[\"gnom\"],BY={init:V0t,forward:j0t,inverse:G0t,names:W0t};function FY(e,t){var r=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));if(Math.abs(Math.abs(t)-r)<1e-6)return t<0?-1*de:de;for(var i=Math.asin(.5*t),s,n,o,c,f=0;f<30;f++)if(n=Math.sin(i),o=Math.cos(i),c=e*n,s=Math.pow(1-c*c,2)/(2*o)*(t/(1-e*e)-n/(1-c*c)+.5/e*Math.log((1-c)/(1+c))),i+=s,Math.abs(s)<=1e-10)return i;return NaN}function H0t(){this.sphere||(this.k0=ol(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function q0t(e){var t=e.x,r=e.y,i,s,n=Ce(t-this.long0);if(this.sphere)i=this.x0+this.a*n*Math.cos(this.lat_ts),s=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var o=df(this.e,Math.sin(r));i=this.x0+this.a*this.k0*n,s=this.y0+this.a*o*.5/this.k0}return e.x=i,e.y=s,e}function Z0t(e){e.x-=this.x0,e.y-=this.y0;var t,r;return this.sphere?(t=Ce(this.long0+e.x/this.a/Math.cos(this.lat_ts)),r=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(r=FY(this.e,2*e.y*this.k0/this.a),t=Ce(this.long0+e.x/(this.a*this.k0))),e.x=t,e.y=r,e}var Y0t=[\"cea\"],zY={init:H0t,forward:q0t,inverse:Z0t,names:Y0t};function Q0t(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||\"Equidistant Cylindrical (Plate Carre)\",this.rc=Math.cos(this.lat_ts)}function $0t(e){var t=e.x,r=e.y,i=Ce(t-this.long0),s=ff(r-this.lat0);return e.x=this.x0+this.a*i*this.rc,e.y=this.y0+this.a*s,e}function X0t(e){var t=e.x,r=e.y;return e.x=Ce(this.long0+(t-this.x0)/(this.a*this.rc)),e.y=ff(this.lat0+(r-this.y0)/this.a),e}var K0t=[\"Equirectangular\",\"Equidistant_Cylindrical\",\"eqc\"],NY={init:Q0t,forward:$0t,inverse:X0t,names:K0t};var UY=20;function J0t(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=kp(this.es),this.e1=Rp(this.es),this.e2=Dp(this.es),this.e3=Op(this.es),this.ml0=this.a*zo(this.e0,this.e1,this.e2,this.e3,this.lat0)}function tgt(e){var t=e.x,r=e.y,i,s,n,o=Ce(t-this.long0);if(n=o*Math.sin(r),this.sphere)Math.abs(r)<=Se?(i=this.a*o,s=-1*this.a*this.lat0):(i=this.a*Math.sin(n)/Math.tan(r),s=this.a*(ff(r-this.lat0)+(1-Math.cos(n))/Math.tan(r)));else if(Math.abs(r)<=Se)i=this.a*o,s=-1*this.ml0;else{var c=Bp(this.a,this.e,Math.sin(r))/Math.tan(r);i=c*Math.sin(n),s=this.a*zo(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+c*(1-Math.cos(n))}return e.x=i+this.x0,e.y=s+this.y0,e}function egt(e){var t,r,i,s,n,o,c,f,_;if(i=e.x-this.x0,s=e.y-this.y0,this.sphere)if(Math.abs(s+this.a*this.lat0)<=Se)t=Ce(i/this.a+this.long0),r=0;else{o=this.lat0+s/this.a,c=i*i/this.a/this.a+o*o,f=o;var w;for(n=UY;n;--n)if(w=Math.tan(f),_=-1*(o*(f*w+1)-f-.5*(f*f+c)*w)/((f-o)/w-1),f+=_,Math.abs(_)<=Se){r=f;break}t=Ce(this.long0+Math.asin(i*Math.tan(f)/this.a)/Math.sin(r))}else if(Math.abs(s+this.ml0)<=Se)r=0,t=Ce(this.long0+i/this.a);else{o=(this.ml0+s)/this.a,c=i*i/this.a/this.a+o*o,f=o;var I,R,N,j,Q;for(n=UY;n;--n)if(Q=this.e*Math.sin(f),I=Math.sqrt(1-Q*Q)*Math.tan(f),R=this.a*zo(this.e0,this.e1,this.e2,this.e3,f),N=this.e0-2*this.e1*Math.cos(2*f)+4*this.e2*Math.cos(4*f)-6*this.e3*Math.cos(6*f),j=R/this.a,_=(o*(I*j+1)-j-.5*I*(j*j+c))/(this.es*Math.sin(2*f)*(j*j+c-2*o*j)/(4*I)+(o-j)*(I*N-2/Math.sin(2*f))-N),f-=_,Math.abs(_)<=Se){r=f;break}I=Math.sqrt(1-this.es*Math.pow(Math.sin(r),2))*Math.tan(r),t=Ce(this.long0+Math.asin(i*I/this.a)/Math.sin(r))}return e.x=t,e.y=r,e}var rgt=[\"Polyconic\",\"poly\"],VY={init:J0t,forward:tgt,inverse:egt,names:rgt};function igt(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function ngt(e){var t,r=e.x,i=e.y,s=i-this.lat0,n=r-this.long0,o=s/Yg*1e-5,c=n,f=1,_=0;for(t=1;t<=10;t++)f=f*o,_=_+this.A[t]*f;var w=_,I=c,R=1,N=0,j,Q,et=0,Y=0;for(t=1;t<=6;t++)j=R*w-N*I,Q=N*w+R*I,R=j,N=Q,et=et+this.B_re[t]*R-this.B_im[t]*N,Y=Y+this.B_im[t]*R+this.B_re[t]*N;return e.x=Y*this.a+this.x0,e.y=et*this.a+this.y0,e}function sgt(e){var t,r=e.x,i=e.y,s=r-this.x0,n=i-this.y0,o=n/this.a,c=s/this.a,f=1,_=0,w,I,R=0,N=0;for(t=1;t<=6;t++)w=f*o-_*c,I=_*o+f*c,f=w,_=I,R=R+this.C_re[t]*f-this.C_im[t]*_,N=N+this.C_im[t]*f+this.C_re[t]*_;for(var j=0;j.999999999999&&(r=.999999999999),t=Math.asin(r);var i=Ce(this.long0+e.x/(.900316316158*this.a*Math.cos(t)));i<-Math.PI&&(i=-Math.PI),i>Math.PI&&(i=Math.PI),r=(2*t+Math.sin(2*t))/Math.PI,Math.abs(r)>1&&(r=1);var s=Math.asin(r);return e.x=i,e.y=s,e}var ygt=[\"Mollweide\",\"moll\"],HY={init:mgt,forward:ggt,inverse:_gt,names:ygt};function vgt(){Math.abs(this.lat1+this.lat2)=0?(r=Math.sqrt(e.x*e.x+e.y*e.y),t=1):(r=-Math.sqrt(e.x*e.x+e.y*e.y),t=-1);var n=0;if(r!==0&&(n=Math.atan2(t*e.x,t*e.y)),this.sphere)return s=Ce(this.long0+n/this.ns),i=ff(this.g-r/this.a),e.x=s,e.y=i,e;var o=this.g-r/this.a;return i=Kg(o,this.e0,this.e1,this.e2,this.e3),s=Ce(this.long0+n/this.ns),e.x=s,e.y=i,e}var wgt=[\"Equidistant_Conic\",\"eqdc\"],qY={init:vgt,forward:xgt,inverse:bgt,names:wgt};function Sgt(){this.R=this.a}function Tgt(e){var t=e.x,r=e.y,i=Ce(t-this.long0),s,n;Math.abs(r)<=Se&&(s=this.x0+this.R*i,n=this.y0);var o=Ec(2*Math.abs(r/Math.PI));(Math.abs(i)<=Se||Math.abs(Math.abs(r)-de)<=Se)&&(s=this.x0,r>=0?n=this.y0+Math.PI*this.R*Math.tan(.5*o):n=this.y0+Math.PI*this.R*-Math.tan(.5*o));var c=.5*Math.abs(Math.PI/i-i/Math.PI),f=c*c,_=Math.sin(o),w=Math.cos(o),I=w/(_+w-1),R=I*I,N=I*(2/_-1),j=N*N,Q=Math.PI*this.R*(c*(I-j)+Math.sqrt(f*(I-j)*(I-j)-(j+f)*(R-j)))/(j+f);i<0&&(Q=-Q),s=this.x0+Q;var et=f+I;return Q=Math.PI*this.R*(N*et-c*Math.sqrt((j+f)*(f+1)-et*et))/(j+f),r>=0?n=this.y0+Q:n=this.y0-Q,e.x=s,e.y=n,e}function Mgt(e){var t,r,i,s,n,o,c,f,_,w,I,R,N;return e.x-=this.x0,e.y-=this.y0,I=Math.PI*this.R,i=e.x/I,s=e.y/I,n=i*i+s*s,o=-Math.abs(s)*(1+n),c=o-2*s*s+i*i,f=-2*o+1+2*s*s+n*n,N=s*s/f+(2*c*c*c/f/f/f-9*o*c/f/f)/27,_=(o-c*c/3/f)/f,w=2*Math.sqrt(-_/3),I=3*N/_/w,Math.abs(I)>1&&(I>=0?I=1:I=-1),R=Math.acos(I)/3,e.y>=0?r=(-w*Math.cos(R+Math.PI/3)-c/3/f)*Math.PI:r=-(-w*Math.cos(R+Math.PI/3)-c/3/f)*Math.PI,Math.abs(i)2*de*this.a?void 0:(r=t/this.a,i=Math.sin(r),s=Math.cos(r),n=this.long0,Math.abs(t)<=Se?o=this.lat0:(o=Ec(s*this.sin_p12+e.y*i*this.cos_p12/t),c=Math.abs(this.lat0)-de,Math.abs(c)<=Se?this.lat0>=0?n=Ce(this.long0+Math.atan2(e.x,-e.y)):n=Ce(this.long0-Math.atan2(-e.x,e.y)):n=Ce(this.long0+Math.atan2(e.x*i,t*this.cos_p12*s-e.y*this.sin_p12*i))),e.x=n,e.y=o,e)):(f=kp(this.es),_=Rp(this.es),w=Dp(this.es),I=Op(this.es),Math.abs(this.sin_p12-1)<=Se?(R=this.a*zo(f,_,w,I,de),t=Math.sqrt(e.x*e.x+e.y*e.y),N=R-t,o=Kg(N/this.a,f,_,w,I),n=Ce(this.long0+Math.atan2(e.x,-1*e.y)),e.x=n,e.y=o,e):Math.abs(this.sin_p12+1)<=Se?(R=this.a*zo(f,_,w,I,de),t=Math.sqrt(e.x*e.x+e.y*e.y),N=t-R,o=Kg(N/this.a,f,_,w,I),n=Ce(this.long0+Math.atan2(e.x,e.y)),e.x=n,e.y=o,e):(t=Math.sqrt(e.x*e.x+e.y*e.y),et=Math.atan2(e.x,e.y),j=Bp(this.a,this.e,this.sin_p12),Y=Math.cos(et),K=this.e*this.cos_p12*Y,J=-K*K/(1-this.es),ut=3*this.es*(1-J)*this.sin_p12*this.cos_p12*Y/(1-this.es),Et=t/j,kt=Et-J*(1+J)*Math.pow(Et,3)/6-ut*(1+3*J)*Math.pow(Et,4)/24,Xt=1-J*kt*kt/2-Et*kt*kt*kt/6,Q=Math.asin(this.sin_p12*Math.cos(kt)+this.cos_p12*Math.sin(kt)*Y),n=Ce(this.long0+Math.asin(Math.sin(et)*Math.sin(kt)/Math.cos(Q))),qt=Math.sin(Q),o=Math.atan2((qt-this.es*Xt*this.sin_p12)*Math.tan(Q),qt*(1-this.es)),e.x=n,e.y=o,e))}var Lgt=[\"Azimuthal_Equidistant\",\"aeqd\"],YY={init:Pgt,forward:Igt,inverse:Cgt,names:Lgt};function kgt(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function Rgt(e){var t,r,i,s,n,o,c,f,_=e.x,w=e.y;return i=Ce(_-this.long0),t=Math.sin(w),r=Math.cos(w),s=Math.cos(i),o=this.sin_p14*t+this.cos_p14*r*s,n=1,(o>0||Math.abs(o)<=Se)&&(c=this.a*n*r*Math.sin(i),f=this.y0+this.a*n*(this.cos_p14*t-this.sin_p14*r*s)),e.x=c,e.y=f,e}function Dgt(e){var t,r,i,s,n,o,c;return e.x-=this.x0,e.y-=this.y0,t=Math.sqrt(e.x*e.x+e.y*e.y),r=Ec(t/this.a),i=Math.sin(r),s=Math.cos(r),o=this.long0,Math.abs(t)<=Se?(c=this.lat0,e.x=o,e.y=c,e):(c=Ec(s*this.sin_p14+e.y*i*this.cos_p14/t),n=Math.abs(this.lat0)-de,Math.abs(n)<=Se?(this.lat0>=0?o=Ce(this.long0+Math.atan2(e.x,-e.y)):o=Ce(this.long0-Math.atan2(-e.x,e.y)),e.x=o,e.y=c,e):(o=Ce(this.long0+Math.atan2(e.x*i,t*this.cos_p14*s-e.y*this.sin_p14*i)),e.x=o,e.y=c,e))}var Ogt=[\"ortho\"],QY={init:kgt,forward:Rgt,inverse:Dgt,names:Ogt};var bs={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},An={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Bgt(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||\"Quadrilateralized Spherical Cube\",this.lat0>=de-Ui/2?this.face=bs.TOP:this.lat0<=-(de-Ui/2)?this.face=bs.BOTTOM:Math.abs(this.long0)<=Ui?this.face=bs.FRONT:Math.abs(this.long0)<=de+Ui?this.face=this.long0>0?bs.RIGHT:bs.LEFT:this.face=bs.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function Fgt(e){var t={x:0,y:0},r,i,s,n,o,c,f={value:0};if(e.x-=this.long0,this.es!==0?r=Math.atan(this.one_minus_f_squared*Math.tan(e.y)):r=e.y,i=e.x,this.face===bs.TOP)n=de-r,i>=Ui&&i<=de+Ui?(f.value=An.AREA_0,s=i-de):i>de+Ui||i<=-(de+Ui)?(f.value=An.AREA_1,s=i>0?i-xs:i+xs):i>-(de+Ui)&&i<=-Ui?(f.value=An.AREA_2,s=i+de):(f.value=An.AREA_3,s=i);else if(this.face===bs.BOTTOM)n=de+r,i>=Ui&&i<=de+Ui?(f.value=An.AREA_0,s=-i+de):i=-Ui?(f.value=An.AREA_1,s=-i):i<-Ui&&i>=-(de+Ui)?(f.value=An.AREA_2,s=-i-de):(f.value=An.AREA_3,s=i>0?-i+xs:-i-xs);else{var _,w,I,R,N,j,Q;this.face===bs.RIGHT?i=Ax(i,+de):this.face===bs.BACK?i=Ax(i,+xs):this.face===bs.LEFT&&(i=Ax(i,-de)),R=Math.sin(r),N=Math.cos(r),j=Math.sin(i),Q=Math.cos(i),_=N*Q,w=N*j,I=R,this.face===bs.FRONT?(n=Math.acos(_),s=gI(n,I,w,f)):this.face===bs.RIGHT?(n=Math.acos(w),s=gI(n,I,-_,f)):this.face===bs.BACK?(n=Math.acos(-_),s=gI(n,I,-w,f)):this.face===bs.LEFT?(n=Math.acos(-w),s=gI(n,I,_,f)):(n=s=0,f.value=An.AREA_0)}return c=Math.atan(12/xs*(s+Math.acos(Math.sin(s)*Math.cos(Ui))-de)),o=Math.sqrt((1-Math.cos(n))/(Math.cos(c)*Math.cos(c))/(1-Math.cos(Math.atan(1/Math.cos(s))))),f.value===An.AREA_1?c+=de:f.value===An.AREA_2?c+=xs:f.value===An.AREA_3&&(c+=1.5*xs),t.x=o*Math.cos(c),t.y=o*Math.sin(c),t.x=t.x*this.a+this.x0,t.y=t.y*this.a+this.y0,e.x=t.x,e.y=t.y,e}function zgt(e){var t={lam:0,phi:0},r,i,s,n,o,c,f,_,w,I={value:0};if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,i=Math.atan(Math.sqrt(e.x*e.x+e.y*e.y)),r=Math.atan2(e.y,e.x),e.x>=0&&e.x>=Math.abs(e.y)?I.value=An.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(I.value=An.AREA_1,r-=de):e.x<0&&-e.x>=Math.abs(e.y)?(I.value=An.AREA_2,r=r<0?r+xs:r-xs):(I.value=An.AREA_3,r+=de),w=xs/12*Math.tan(r),o=Math.sin(w)/(Math.cos(w)-1/Math.sqrt(2)),c=Math.atan(o),s=Math.cos(r),n=Math.tan(i),f=1-s*s*n*n*(1-Math.cos(Math.atan(1/Math.cos(c)))),f<-1?f=-1:f>1&&(f=1),this.face===bs.TOP)_=Math.acos(f),t.phi=de-_,I.value===An.AREA_0?t.lam=c+de:I.value===An.AREA_1?t.lam=c<0?c+xs:c-xs:I.value===An.AREA_2?t.lam=c-de:t.lam=c;else if(this.face===bs.BOTTOM)_=Math.acos(f),t.phi=_-de,I.value===An.AREA_0?t.lam=-c+de:I.value===An.AREA_1?t.lam=-c:I.value===An.AREA_2?t.lam=-c-de:t.lam=c<0?-c-xs:-c+xs;else{var R,N,j;R=f,w=R*R,w>=1?j=0:j=Math.sqrt(1-w)*Math.sin(c),w+=j*j,w>=1?N=0:N=Math.sqrt(1-w),I.value===An.AREA_1?(w=N,N=-j,j=w):I.value===An.AREA_2?(N=-N,j=-j):I.value===An.AREA_3&&(w=N,N=j,j=-w),this.face===bs.RIGHT?(w=R,R=-N,N=w):this.face===bs.BACK?(R=-R,N=-N):this.face===bs.LEFT&&(w=R,R=N,N=-w),t.phi=Math.acos(-j)-de,t.lam=Math.atan2(N,R),this.face===bs.RIGHT?t.lam=Ax(t.lam,-de):this.face===bs.BACK?t.lam=Ax(t.lam,-xs):this.face===bs.LEFT&&(t.lam=Ax(t.lam,+de))}if(this.es!==0){var Q,et,Y;Q=t.phi<0?1:0,et=Math.tan(t.phi),Y=this.b/Math.sqrt(et*et+this.one_minus_f_squared),t.phi=Math.atan(Math.sqrt(this.a*this.a-Y*Y)/(this.one_minus_f*Y)),Q&&(t.phi=-t.phi)}return t.lam+=this.long0,e.x=t.lam,e.y=t.phi,e}function gI(e,t,r,i){var s;return eUi&&s<=de+Ui?(i.value=An.AREA_1,s-=de):s>de+Ui||s<=-(de+Ui)?(i.value=An.AREA_2,s=s>=0?s-xs:s+xs):(i.value=An.AREA_3,s+=de)),s}function Ax(e,t){var r=e+t;return r<-xs?r+=Em:r>+xs&&(r-=Em),r}var Ngt=[\"Quadrilateralized Spherical Cube\",\"Quadrilateralized_Spherical_Cube\",\"qsc\"],$Y={init:Bgt,forward:Fgt,inverse:zgt,names:Ngt};var DB=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],gS=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],XY=.8487,KY=1.3523,JY=Sc/5,Ugt=1/JY,mx=18,_I=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},Vgt=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function jgt(e,t,r,i){for(var s=t;i;--i){var n=e(s);if(s-=n,Math.abs(n)=mx&&(i=mx-1),r=Sc*(r-Ugt*i);var s={x:_I(DB[i],r)*t,y:_I(gS[i],r)};return e.y<0&&(s.y=-s.y),s.x=s.x*this.a*XY+this.x0,s.y=s.y*this.a*KY+this.y0,s}function Hgt(e){var t={x:(e.x-this.x0)/(this.a*XY),y:Math.abs(e.y-this.y0)/(this.a*KY)};if(t.y>=1)t.x/=DB[mx][0],t.y=e.y<0?-de:de;else{var r=Math.floor(t.y*mx);for(r<0?r=0:r>=mx&&(r=mx-1);;)if(gS[r][0]>t.y)--r;else if(gS[r+1][0]<=t.y)++r;else break;var i=gS[r],s=5*(t.y-i[0])/(gS[r+1][0]-i[0]);s=jgt(function(n){return(_I(i,n)-t.y)/Vgt(i,n)},s,Se,100),t.x/=_I(DB[r],s),t.y=(5*r+s)*vs,e.y<0&&(t.y=-t.y)}return t.x=Ce(t.x+this.long0),t}var qgt=[\"Robinson\",\"robin\"],tQ={init:Ggt,forward:Wgt,inverse:Hgt,names:qgt};function Zgt(){this.name=\"geocent\"}function Ygt(e){var t=aI(e,this.es,this.a);return t}function Qgt(e){var t=lI(e,this.es,this.a,this.b);return t}var $gt=[\"Geocentric\",\"geocentric\",\"geocent\",\"Geocent\"],eQ={init:Zgt,forward:Ygt,inverse:Qgt,names:$gt};var al={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},_S={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function Xgt(){if(Object.keys(_S).forEach(function(r){if(typeof this[r]>\"u\")this[r]=_S[r].def;else{if(_S[r].num&&isNaN(this[r]))throw new Error(\"Invalid parameter value, must be numeric \"+r+\" = \"+this[r]);_S[r].num&&(this[r]=parseFloat(this[r]))}_S[r].degrees&&(this[r]=this[r]*vs)}.bind(this)),Math.abs(Math.abs(this.lat0)-de)1e10)throw new Error(\"Invalid height\");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var e=this.tilt,t=this.azi;this.cg=Math.cos(t),this.sg=Math.sin(t),this.cw=Math.cos(e),this.sw=Math.sin(e)}function Kgt(e){e.x-=this.long0;var t=Math.sin(e.y),r=Math.cos(e.y),i=Math.cos(e.x),s,n;switch(this.mode){case al.OBLIQ:n=this.sinph0*t+this.cosph0*r*i;break;case al.EQUIT:n=r*i;break;case al.S_POLE:n=-t;break;case al.N_POLE:n=t;break}switch(n=this.pn1/(this.p-n),s=n*r*Math.sin(e.x),this.mode){case al.OBLIQ:n*=this.cosph0*t-this.sinph0*r*i;break;case al.EQUIT:n*=t;break;case al.N_POLE:n*=-(r*i);break;case al.S_POLE:n*=r*i;break}var o,c;return o=n*this.cg+s*this.sg,c=1/(o*this.sw*this.h1+this.cw),s=(s*this.cg-n*this.sg)*this.cw*c,n=o*c,e.x=s*this.a,e.y=n*this.a,e}function Jgt(e){e.x/=this.a,e.y/=this.a;var t={x:e.x,y:e.y},r,i,s;s=1/(this.pn1-e.y*this.sw),r=this.pn1*e.x*s,i=this.pn1*e.y*this.cw*s,e.x=r*this.cg+i*this.sg,e.y=i*this.cg-r*this.sg;var n=Ta(e.x,e.y);if(Math.abs(n)1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var e=1-this.es,t=1/e;this.radius_p=Math.sqrt(e),this.radius_p2=e,this.radius_p_inv2=t,this.shape=\"ellipse\"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape=\"sphere\";this.title||(this.title=\"Geostationary Satellite View\")}function r_t(e){var t=e.x,r=e.y,i,s,n,o;if(t=t-this.long0,this.shape===\"ellipse\"){r=Math.atan(this.radius_p2*Math.tan(r));var c=this.radius_p/Ta(this.radius_p*Math.cos(r),Math.sin(r));if(s=c*Math.cos(t)*Math.cos(r),n=c*Math.sin(t)*Math.cos(r),o=c*Math.sin(r),(this.radius_g-s)*s-n*n-o*o*this.radius_p_inv2<0)return e.x=Number.NaN,e.y=Number.NaN,e;i=this.radius_g-s,this.flip_axis?(e.x=this.radius_g_1*Math.atan(n/Ta(o,i)),e.y=this.radius_g_1*Math.atan(o/i)):(e.x=this.radius_g_1*Math.atan(n/i),e.y=this.radius_g_1*Math.atan(o/Ta(n,i)))}else this.shape===\"sphere\"&&(i=Math.cos(r),s=Math.cos(t)*i,n=Math.sin(t)*i,o=Math.sin(r),i=this.radius_g-s,this.flip_axis?(e.x=this.radius_g_1*Math.atan(n/Ta(o,i)),e.y=this.radius_g_1*Math.atan(o/i)):(e.x=this.radius_g_1*Math.atan(n/i),e.y=this.radius_g_1*Math.atan(o/Ta(n,i))));return e.x=e.x*this.a,e.y=e.y*this.a,e}function i_t(e){var t=-1,r=0,i=0,s,n,o,c;if(e.x=e.x/this.a,e.y=e.y/this.a,this.shape===\"ellipse\"){this.flip_axis?(i=Math.tan(e.y/this.radius_g_1),r=Math.tan(e.x/this.radius_g_1)*Ta(1,i)):(r=Math.tan(e.x/this.radius_g_1),i=Math.tan(e.y/this.radius_g_1)*Ta(1,r));var f=i/this.radius_p;if(s=r*r+f*f+t*t,n=2*this.radius_g*t,o=n*n-4*s*this.C,o<0)return e.x=Number.NaN,e.y=Number.NaN,e;c=(-n-Math.sqrt(o))/(2*s),t=this.radius_g+c*t,r*=c,i*=c,e.x=Math.atan2(r,t),e.y=Math.atan(i*Math.cos(e.x)/t),e.y=Math.atan(this.radius_p_inv2*Math.tan(e.y))}else if(this.shape===\"sphere\"){if(this.flip_axis?(i=Math.tan(e.y/this.radius_g_1),r=Math.tan(e.x/this.radius_g_1)*Math.sqrt(1+i*i)):(r=Math.tan(e.x/this.radius_g_1),i=Math.tan(e.y/this.radius_g_1)*Math.sqrt(1+r*r)),s=r*r+i*i+t*t,n=2*this.radius_g*t,o=n*n-4*s*this.C,o<0)return e.x=Number.NaN,e.y=Number.NaN,e;c=(-n-Math.sqrt(o))/(2*s),t=this.radius_g+c*t,r*=c,i*=c,e.x=Math.atan2(r,t),e.y=Math.atan(i*Math.cos(e.x)/t)}return e.x=e.x+this.long0,e}var n_t=[\"Geostationary Satellite View\",\"Geostationary_Satellite\",\"geos\"],iQ={init:e_t,forward:r_t,inverse:i_t,names:n_t};function nQ(e){e.Proj.projections.add(fx),e.Proj.projections.add(dx),e.Proj.projections.add(MY),e.Proj.projections.add(EY),e.Proj.projections.add(PY),e.Proj.projections.add(IY),e.Proj.projections.add(CY),e.Proj.projections.add(LY),e.Proj.projections.add(kY),e.Proj.projections.add(RY),e.Proj.projections.add(DY),e.Proj.projections.add(OY),e.Proj.projections.add(BY),e.Proj.projections.add(zY),e.Proj.projections.add(NY),e.Proj.projections.add(VY),e.Proj.projections.add(jY),e.Proj.projections.add(GY),e.Proj.projections.add(WY),e.Proj.projections.add(HY),e.Proj.projections.add(qY),e.Proj.projections.add(ZY),e.Proj.projections.add(YY),e.Proj.projections.add(QY),e.Proj.projections.add($Y),e.Proj.projections.add(tQ),e.Proj.projections.add(eQ),e.Proj.projections.add(rQ),e.Proj.projections.add(iQ)}Tc.defaultDatum=\"WGS84\";Tc.Proj=Pm;Tc.WGS84=new Tc.Proj(\"WGS84\");Tc.Point=gY;Tc.toPoint=uI;Tc.defs=ax;Tc.nadgrid=MB;Tc.transform=$g;Tc.mgrs=pY;Tc.version=\"__VERSION__\";nQ(Tc);var sQ=Tc;function xS(e){return\"data\"in e?e.getChildAt(0):e.children[0]}function bS(e){return\"data\"in e?e.getChildAt(0):e.children[0]}function gx(e){return\"data\"in e?e.getChildAt(0):e.children[0]}function s_t(e){return\"data\"in e?e.getChildAt(0):e.children[0]}function o_t(e){return\"data\"in e?e.getChildAt(0):e.children[0]}function wI(e){return\"data\"in e?e.getChildAt(0):e.children[0]}var vi=Object.freeze({__proto__:null,getLineStringChild:bS,getMultiLineStringChild:o_t,getMultiPointChild:s_t,getMultiPolygonChild:wI,getPointChild:xS,getPolygonChild:gx});function SI(e,t){let r=e.valueOffsets,i=gx(e),s=i.valueOffsets,n=bS(i),o=n.type.listSize,c=xS(n),f=r[t],_=r[t+1],w=s[f],I=s[_],R=c.values.subarray(w*o,I*o);return new sx(R,{size:o,isClosed:!0})}function aQ(e){if(\"data\"in e)return new xr(e.data.map(r=>aQ(r)));let t=new Float64Array(e.length);for(let r=0;rlQ(r)));let t=new Float64Array(e.length);for(let r=0;rcQ(n));let t=[],r=0;for(let n=0;nuQ(t))):gx(e)}function hQ(e){return\"data\"in e?new xr(e.data.map(t=>hQ(t))):wI(e)}function TI(e){return ze.isFixedSizeList(e)?!(![2,3,4].includes(e.listSize)||!ze.isFloat(e.children[0])):ze.isStruct(e)?!(![2,3,4].includes(e.children.length)||!e.children.every(t=>[\"x\",\"y\",\"z\",\"m\"].includes(t.name))||!e.children.every(t=>ze.isFloat(t))):!1}function MI(e){return!(!ze.isList(e)||!TI(e.children[0].type))}function zB(e){return!(!ze.isList(e)||!MI(e.children[0].type))}function fQ(e){return!(!ze.isList(e)||!TI(e.children[0].type))}function dQ(e){return!(!ze.isList(e)||!MI(e.children[0].type))}function pQ(e){return!(!ze.isList(e)||!zB(e.children[0].type))}function l_t(e){return TI(e.type)}function c_t(e){return MI(e.type)}function u_t(e){return zB(e.type)}function h_t(e){return fQ(e.type)}function f_t(e){return dQ(e.type)}function d_t(e){return pQ(e.type)}function p_t(e,t){if(!e)throw new Error(`assertion failed ${t}`)}function A_t(){throw new Error(\"assertion failed\")}function AQ(e,t){if(l_t(e))return mQ(e,t);if(c_t(e))return OB(e,t);if(u_t(e))return BB(e,t);if(h_t(e))return OB(e,t);if(f_t(e))return BB(e,t);if(d_t(e))return m_t(e,t);A_t()}function mQ(e,t){p_t(e.type.listSize===2,\"expected 2D\");let r=xS(e),i=r.values,s=new Float64Array(i.length);for(let o=0;ooQ(s,i))):oQ(e,i)}function oQ(e,t){let r=[0,0];return AQ(e,(s,n)=>(r[0]=s,r[1]=n,t.forward(r)))}var Im;(function(e){e.POINT=\"geoarrow.point\",e.LINESTRING=\"geoarrow.linestring\",e.POLYGON=\"geoarrow.polygon\",e.MULTIPOINT=\"geoarrow.multipoint\",e.MULTILINESTRING=\"geoarrow.multilinestring\",e.MULTIPOLYGON=\"geoarrow.multipolygon\"})(Im||(Im={}));var bI=class{minX;minY;maxX;maxY;constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}updateBbox(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.maxY>this.maxY&&(this.maxY=t.maxY)}updateCoord(t,r){tthis.maxX&&(this.maxX=t),r>this.maxY&&(this.maxY=r)}};function __t(e,t){switch(t.metadata.get(\"ARROW:extension:name\")){case Im.POINT:return gQ(e);case Im.LINESTRING:case Im.MULTIPOINT:return _Q(e);case Im.POLYGON:case Im.MULTILINESTRING:return yQ(e);case Im.MULTIPOLYGON:return v_t(e);default:throw new Error(\"Unknown ext type name\")}}function y_t(e){let r=xS(e).values,i=new bI;for(let s=0;svQ(r)));let t=new mm({type:new dc,nullValues:[null]});t.set(e.length-1,null);for(let r=0;rxQ(r,t));return}for(let r=0;rvS(n,t)));let r=[];for(let n of e.children)r.push(vS(n,t));let i;e.dictionary!==void 0&&(i=vS(e.dictionary,t));let s={[Oi.OFFSET]:yI(e.buffers[Oi.OFFSET],t),[Oi.DATA]:yI(e.buffers[Oi.DATA],t),[Oi.VALIDITY]:yI(e.buffers[Oi.VALIDITY],t),[Oi.TYPE]:yI(e.buffers[Oi.TYPE],t)};return new Fi(e.type,e.offset,e.length,e._nullCount,s,r,i)}function vI(e){if(\"data\"in e)return e.data.some(r=>vI(r));for(let r of e.children)if(vI(r))return!0;if(e.dictionary!==void 0&&vI(e.dictionary))return!0;let t=[Oi.OFFSET,Oi.DATA,Oi.VALIDITY,Oi.TYPE];for(let r of t)if(e.buffers[r]!==void 0&&bQ(e.buffers[r]))return!0;return!1}function bQ(e){return!(e.byteOffset===0&&e.byteLength===e.buffer.byteLength)}function yI(e,t){return e===void 0||!t&&!bQ(e)?e:e.slice()}function xI(e,t=!1){if(\"data\"in e){let i=[],s=[];for(let o of e.data){let[c,f]=xI(o);i.push(c),s.push(...f)}return[new xr(i),s]}e=vS(e,t);let r=[];for(let i=0;i1)throw new Error(\"expected 1 field\");return new sl(t[0])}case Ot.Struct:{let t=e.children.map(yS);return new pn(t)}case Ot.Union:{let t=e.children.map(yS);return new pc(e.mode,e.typeIds,t)}case Ot.FixedSizeBinary:return new Qu(e.byteWidth);case Ot.FixedSizeList:{let t=e.children.map(yS);if(t.length>1)throw new Error(\"expected 1 field\");return new Ll(e.listSize,t[0])}case Ot.Map:{let t=e.children.map(yS);if(t.length>1)throw new Error(\"expected 1 field\");let r=t[0];return new Ac(r,e.keysSorted)}case Ot.Duration:return new Yu(e.unit);default:throw new Error(`unknown type ${e}`)}}function yS(e){let t=wQ(e.type);return new si(e.name,t,e.nullable,e.metadata)}function UB(e){let t=e.children.map(s=>UB(s)),r=e.dictionary?SQ(e.dictionary):void 0,i={[Oi.OFFSET]:e.valueOffsets,[Oi.DATA]:e.values,[Oi.VALIDITY]:e.nullBitmap,[Oi.TYPE]:e.typeIds};return new Fi(wQ(e.type),e.offset,e.length,e._nullCount,i,t,r)}function SQ(e){return new xr(e.data.map(t=>UB(t)))}var VB=Object.freeze({__proto__:null,hardClone:vS,isShared:vI,preparePostMessage:xI,rehydrateData:UB,rehydrateVector:SQ});function E_t(e,t,r){let i=e.fields.findIndex(s=>s.name===r||s.metadata.get(\"ARROW:extension:name\")===t);return i!==-1?i:null}function P_t(e,t){let{index:r,data:i}=e,s=r;i.invertedGeomOffsets!==void 0&&(s=i.invertedGeomOffsets[r]);let n={data:i.data,length:i.length,attributes:i.attributes},o={index:s,data:n,target:e.target};return t(o)}function ro(e){let{props:t,propName:r,propInput:i,chunkIdx:s,geomCoordOffsets:n}=e;if(i!==void 0)if(i instanceof xr){let o=i.data[s];if(ze.isFixedSizeList(o)){_r(o.children.length===1);let c=o.children[0].values;n&&(c=EI(c,o.type.listSize,n)),t.data.attributes[r]={value:c,size:o.type.listSize,normalized:!0}}else if(ze.isFloat(o)){let c=o.values;n&&(c=EI(c,1,n)),t.data.attributes[r]={value:c,size:1}}}else typeof i==\"function\"?t[r]=(o,c)=>r===\"getPolygonOffset\"?i(o,c):P_t(c,i):t[r]=i}function EI(e,t,r){let i=r[r.length-1],s=new e.constructor(i*t);for(let n=0;n(t[i+1]=t[i]+r.length,t),new Uint32Array(e.length+1))}function no(e,t){let r=[],i=[];for(let[s,n]of Object.entries(e))s.startsWith(\"get\")&&n instanceof xr&&(r.push(n),s.endsWith(\"Color\")&&i.push(n));I_t(t,r);for(let s of i)C_t(s)}function I_t(e,t){for(let r of t)_r(e.batches.length===r.data.length);for(let r of t)for(let i=0;ithis.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return!!this._loader&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error(\"byteLength not defined in tile data\"),t}async _loadData({getData:t,requestScheduler:r,onLoad:i,onError:s}){let{index:n,id:o,bbox:c,userData:f,zoom:_}=this,w=this._loaderId;this._abortController=new AbortController;let{signal:I}=this._abortController,R=await r.scheduleRequest(this,Q=>Q.isSelected?1:-1);if(!R){this._isCancelled=!0;return}if(this._isCancelled){R.done();return}let N=null,j;try{N=await t({index:n,id:o,bbox:c,userData:f,zoom:_,signal:I})}catch(Q){j=Q||!0}finally{R.done()}if(w===this._loaderId){if(this._loader=void 0,this.content=N,this._isCancelled&&!N){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,j?s(j,this):i(this)}}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){var t;this.isLoaded||(this._isCancelled=!0,(t=this._abortController)===null||t===void 0||t.abort())}};var so={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var IQ=new Ve,O_t=new Ve,Jg=class e{constructor(t=[0,0,0],r=[0,0,0],i){G(this,\"center\",void 0),G(this,\"halfDiagonal\",void 0),G(this,\"minimum\",void 0),G(this,\"maximum\",void 0),i=i||IQ.copy(t).add(r).scale(.5),this.center=new Ve(i),this.halfDiagonal=new Ve(r).subtract(this.center),this.minimum=new Ve(t),this.maximum=new Ve(r)}clone(){return new e(this.minimum,this.maximum,this.center)}equals(t){return this===t||!!t&&this.minimum.equals(t.minimum)&&this.maximum.equals(t.maximum)}transform(t){return this.center.transformAsPoint(t),this.halfDiagonal.transform(t),this.minimum.transform(t),this.maximum.transform(t),this}intersectPlane(t){let{halfDiagonal:r}=this,i=O_t.from(t.normal),s=r.x*Math.abs(i.x)+r.y*Math.abs(i.y)+r.z*Math.abs(i.z),n=this.center.dot(i)+t.distance;return n-s>0?so.INSIDE:n+s<0?so.OUTSIDE:so.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=IQ.from(t).subtract(this.center),{halfDiagonal:i}=this,s=0,n;return n=Math.abs(r.x)-i.x,n>0&&(s+=n*n),n=Math.abs(r.y)-i.y,n>0&&(s+=n*n),n=Math.abs(r.z)-i.z,n>0&&(s+=n*n),s}};var TS=new Ve,CQ=new Ve,t_=class e{constructor(t=[0,0,0],r=0){G(this,\"center\",void 0),G(this,\"radius\",void 0),this.radius=-0,this.center=new Ve,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=TS.from(r),this.center=new Ve().from(t).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new e(this.center,this.radius)}union(t){let r=this.center,i=this.radius,s=t.center,n=t.radius,o=TS.copy(s).subtract(r),c=o.magnitude();if(i>=c+n)return this.clone();if(n>=c+i)return t.clone();let f=(i+c+n)*.5;return CQ.copy(o).scale((-i+f)/c).add(r),this.center.copy(CQ),this.radius=f,this}expand(t){let i=TS.from(t).subtract(this.center).magnitude();return i>this.radius&&(this.radius=i),this}transform(t){this.center.transform(t);let r=c7(TS,t);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(t){let r=this.distanceTo(t);return r*r}distanceTo(t){let i=TS.from(t).subtract(this.center);return Math.max(0,i.len()-this.radius)}intersectPlane(t){let r=this.center,i=this.radius,n=t.normal.dot(r)+t.distance;return n<-i?so.OUTSIDE:n=f?so.INSIDE:so.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=F_t.from(t).subtract(this.center),i=this.halfAxes,s=i.getColumn(0,II),n=i.getColumn(1,CI),o=i.getColumn(2,LI),c=s.magnitude(),f=n.magnitude(),_=o.magnitude();s.normalize(),n.normalize(),o.normalize();let w=0,I;return I=Math.abs(r.dot(s))-c,I>0&&(w+=I*I),I=Math.abs(r.dot(n))-f,I>0&&(w+=I*I),I=Math.abs(r.dot(o))-_,I>0&&(w+=I*I),w}computePlaneDistances(t,r,i=[-0,-0]){let s=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,o=this.center,c=this.halfAxes,f=c.getColumn(0,II),_=c.getColumn(1,CI),w=c.getColumn(2,LI),I=z_t.copy(f).add(_).add(w).add(o),R=N_t.copy(I).subtract(t),N=r.dot(R);return s=Math.min(N,s),n=Math.max(N,n),I.copy(o).add(f).add(_).subtract(w),R.copy(I).subtract(t),N=r.dot(R),s=Math.min(N,s),n=Math.max(N,n),I.copy(o).add(f).subtract(_).add(w),R.copy(I).subtract(t),N=r.dot(R),s=Math.min(N,s),n=Math.max(N,n),I.copy(o).add(f).subtract(_).subtract(w),R.copy(I).subtract(t),N=r.dot(R),s=Math.min(N,s),n=Math.max(N,n),o.copy(I).subtract(f).add(_).add(w),R.copy(I).subtract(t),N=r.dot(R),s=Math.min(N,s),n=Math.max(N,n),o.copy(I).subtract(f).add(_).subtract(w),R.copy(I).subtract(t),N=r.dot(R),s=Math.min(N,s),n=Math.max(N,n),o.copy(I).subtract(f).subtract(_).add(w),R.copy(I).subtract(t),N=r.dot(R),s=Math.min(N,s),n=Math.max(N,n),o.copy(I).subtract(f).subtract(_).subtract(w),R.copy(I).subtract(t),N=r.dot(R),s=Math.min(N,s),n=Math.max(N,n),i[0]=s,i[1]=n,i}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,II);r.transformAsPoint(t);let i=this.halfAxes.getColumn(1,CI);i.transformAsPoint(t);let s=this.halfAxes.getColumn(2,LI);return s.transformAsPoint(t),this.halfAxes=new ss([...r,...i,...s]),this}getTransform(){throw new Error(\"not implemented\")}};var LQ=new Ve,kQ=new Ve,Af=class e{constructor(t=[0,0,1],r=0){G(this,\"normal\",void 0),G(this,\"distance\",void 0),this.normal=new Ve,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return Bh(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=LQ.from(t),this.normal.from(r).normalize();let i=-this.normal.dot(t);return this.distance=i,this}fromCoefficients(t,r,i,s){return this.normal.set(t,r,i),Bh(Ro(this.normal.len(),1)),this.distance=s,this}clone(){return new e(this.normal,this.distance)}equals(t){return Ro(this.distance,t.distance)&&Ro(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=kQ.copy(this.normal).transformAsVector(t).normalize(),i=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(i,r)}projectPointOntoPlane(t,r=[0,0,0]){t=LQ.from(t);let i=this.getPointDistance(t),s=kQ.copy(this.normal).scale(i);return t.subtract(s).to(r)}};var RQ=[new Ve([1,0,0]),new Ve([0,1,0]),new Ve([0,0,1])],DQ=new Ve,U_t=new Ve,Rse=new Af(new Ve(1,0,0),0),Ad=class e{constructor(t=[]){G(this,\"planes\",void 0),this.planes=t}fromBoundingSphere(t){this.planes.length=2*RQ.length;let r=t.center,i=t.radius,s=0;for(let n of RQ){let o=this.planes[s],c=this.planes[s+1];o||(o=this.planes[s]=new Af),c||(c=this.planes[s+1]=new Af);let f=DQ.copy(n).scale(-i).add(r),_=-n.dot(f);o.fromPointNormal(f,n);let w=DQ.copy(n).scale(i).add(r),I=U_t.copy(n).negate(),R=-I.dot(w);c.fromPointNormal(w,I),s+=2}return this}computeVisibility(t){let r=so.INSIDE;for(let i of this.planes)switch(t.intersectPlane(i)){case so.OUTSIDE:return so.OUTSIDE;case so.INTERSECTING:r=so.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(Bh(Number.isFinite(r),\"parentPlaneMask is required.\"),r===e.MASK_OUTSIDE||r===e.MASK_INSIDE)return r;let i=e.MASK_INSIDE,s=this.planes;for(let n=0;nf;)q_t(c,kI),OQ.copy(kI).transpose(),c.multiplyRight(kI),c.multiplyLeft(OQ),o.multiplyRight(kI),++s>2&&(++n,s=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=c.toTarget(t.diagonal),t}function W_t(e){let t=0;for(let r=0;r<9;++r){let i=e[r];t+=i*i}return Math.sqrt(t)}var GB=[1,0,0],WB=[2,2,1];function H_t(e){let t=0;for(let r=0;r<3;++r){let i=e[md.getElementIndex(WB[r],GB[r])];t+=2*i*i}return Math.sqrt(t)}function q_t(e,t){let r=YE.EPSILON15,i=0,s=1;for(let _=0;_<3;++_){let w=Math.abs(e[md.getElementIndex(WB[_],GB[_])]);w>i&&(s=_,i=w)}let n=GB[s],o=WB[s],c=1,f=0;if(Math.abs(e[md.getElementIndex(o,n)])>r){let _=e[md.getElementIndex(o,o)],w=e[md.getElementIndex(n,n)],I=e[md.getElementIndex(o,n)],R=(_-w)/2/I,N;R<0?N=-1/(-R+Math.sqrt(1+R*R)):N=1/(R+Math.sqrt(1+R*R)),c=1/Math.sqrt(1+N*N),f=N*c}return ss.IDENTITY.to(t),t[md.getElementIndex(n,n)]=t[md.getElementIndex(o,o)]=c,t[md.getElementIndex(o,n)]=f,t[md.getElementIndex(n,o)]=-f,t}var Cm=new Ve,Z_t=new Ve,Y_t=new Ve,Q_t=new Ve,$_t=new Ve,X_t=new ss,K_t={diagonal:new ss,unitary:new ss};function HB(e,t=new yx){if(!e||e.length===0)return t.halfAxes=new ss([0,0,0,0,0,0,0,0,0]),t.center=new Ve,t;let r=e.length,i=new Ve(0,0,0);for(let le of e)i.add(le);let s=1/r;i.multiplyByScalar(s);let n=0,o=0,c=0,f=0,_=0,w=0;for(let le of e){let ue=Cm.copy(le).subtract(i);n+=ue.x*ue.x,o+=ue.x*ue.y,c+=ue.x*ue.z,f+=ue.y*ue.y,_+=ue.y*ue.z,w+=ue.z*ue.z}n*=s,o*=s,c*=s,f*=s,_*=s,w*=s;let I=X_t;I[0]=n,I[1]=o,I[2]=c,I[3]=o,I[4]=f,I[5]=_,I[6]=c,I[7]=_,I[8]=w;let{unitary:R}=RI(I,K_t),N=t.halfAxes.copy(R),j=N.getColumn(0,Y_t),Q=N.getColumn(1,Q_t),et=N.getColumn(2,$_t),Y=-Number.MAX_VALUE,K=-Number.MAX_VALUE,J=-Number.MAX_VALUE,ut=Number.MAX_VALUE,Et=Number.MAX_VALUE,kt=Number.MAX_VALUE;for(let le of e)Cm.copy(le),Y=Math.max(Cm.dot(j),Y),K=Math.max(Cm.dot(Q),K),J=Math.max(Cm.dot(et),J),ut=Math.min(Cm.dot(j),ut),Et=Math.min(Cm.dot(Q),Et),kt=Math.min(Cm.dot(et),kt);j=j.multiplyByScalar(.5*(ut+Y)),Q=Q.multiplyByScalar(.5*(Et+K)),et=et.multiplyByScalar(.5*(kt+J)),t.center.copy(j).add(Q).add(et);let Xt=Z_t.set(Y-ut,K-Et,J-kt).multiplyByScalar(.5),qt=new ss([Xt[0],0,0,0,Xt[1],0,0,0,Xt[2]]);return t.halfAxes.multiplyRight(qt),t}var vx=512,BQ=3,FQ=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],zQ=FQ.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),J_t=zQ.concat([[.25,.5],[.75,.5]]),qB=class e{constructor(t,r,i){G(this,\"x\",void 0),G(this,\"y\",void 0),G(this,\"z\",void 0),G(this,\"childVisible\",void 0),G(this,\"selected\",void 0),G(this,\"_children\",void 0),this.x=t,this.y=r,this.z=i}get children(){if(!this._children){let t=this.x*2,r=this.y*2,i=this.z+1;this._children=[new e(t,r,i),new e(t,r+1,i),new e(t+1,r,i),new e(t+1,r+1,i)]}return this._children}update(t){let{viewport:r,cullingVolume:i,elevationBounds:s,minZ:n,maxZ:o,bounds:c,offset:f,project:_}=t,w=this.getBoundingVolume(s,f,_);if(c&&!this.insideBounds(c)||i.computeVisibility(w)<0)return!1;if(!this.childVisible){let{z:R}=this;if(R=n){let N=w.distanceTo(r.cameraPosition)*r.scale/r.height;R+=Math.floor(Math.log2(N))}if(R>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let R of this.children)R.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let r of this._children)r.getSelected(t);return t}insideBounds([t,r,i,s]){let n=Math.pow(2,this.z),o=vx/n;return this.x*ot&&(this.y+1)*o>r}getBoundingVolume(t,r,i){if(i){let f=this.z<1?J_t:this.z<2?zQ:FQ,_=[];for(let w of f){let I=DI(this.x+w[0],this.y+w[1],this.z);I[2]=t[0],_.push(i(I)),t[0]!==t[1]&&(I[2]=t[1],_.push(i(I)))}return HB(_)}let s=Math.pow(2,this.z),n=vx/s,o=this.x*n+r*vx,c=vx-(this.y+1)*n;return new Jg([o,c,t[0]],[o+n,c+n,t[1]])}};function NQ(e,t,r,i){let s=e instanceof rv&&e.resolution?e.projectPosition:null,n=Object.values(e.getFrustumPlanes()).map(({normal:N,distance:j})=>new Af(N.clone().negate(),j)),o=new Ad(n),c=e.distanceScales.unitsPerMeter[2],f=r&&r[0]*c||0,_=r&&r[1]*c||0,w=e instanceof lc&&e.pitch<=60?t:0;if(i){let[N,j,Q,et]=i,Y=va([N,et]),K=va([Q,j]);i=[Y[0],vx-Y[1],K[0],vx-K[1]]}let I=new qB(0,0,0),R={viewport:e,project:s,cullingVolume:o,elevationBounds:[f,_],minZ:w,maxZ:t,bounds:i,offset:0};if(I.update(R),e instanceof lc&&e.subViewports&&e.subViewports.length>1){for(R.offset=-1;I.update(R)&&!(--R.offset<-BQ););for(R.offset=1;I.update(R)&&!(++R.offset>BQ););}return I.getSelected()}var zp=512,tyt=[-1/0,-1/0,1/0,1/0],YB={type:\"object\",value:null,validate:(e,t)=>t.optional&&e===null||typeof e==\"string\"||Array.isArray(e)&&e.every(r=>typeof r==\"string\"),equal:(e,t)=>{if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;let r=e.length;if(r!==t.length)return!1;for(let i=0;is[0])),Math.min(...r.map(s=>s[1])),Math.max(...r.map(s=>s[0])),Math.max(...r.map(s=>s[1]))]}function eyt(e){return Math.abs(e.split(\"\").reduce((t,r)=>(t<<5)-t+r.charCodeAt(0)|0,0))}function QB(e,t){if(!e||!e.length)return null;let{index:r,id:i}=t;if(Array.isArray(e)){let n=eyt(i)%e.length;e=e[n]}let s=e;for(let n of Object.keys(r)){let o=new RegExp(\"{\".concat(n,\"}\"),\"g\");s=s.replace(o,String(r[n]))}return Number.isInteger(r.y)&&Number.isInteger(r.z)&&(s=s.replace(/\\{-y\\}/g,String(Math.pow(2,r.z)-r.y-1))),s}function ryt(e,t,r){let i;if(t&&t.length===2){let[s,n]=t,o=e.getBounds({z:s}),c=e.getBounds({z:n});i=[Math.min(o[0],c[0]),Math.min(o[1],c[1]),Math.max(o[2],c[2]),Math.max(o[3],c[3])]}else i=e.getBounds();return e.isGeospatial?[Math.max(i[0],r[0]),Math.max(i[1],r[1]),Math.min(i[2],r[2]),Math.min(i[3],r[3])]:[Math.max(Math.min(i[0],r[2]),r[0]),Math.max(Math.min(i[1],r[3]),r[1]),Math.min(Math.max(i[2],r[0]),r[2]),Math.min(Math.max(i[3],r[1]),r[3])]}function jQ({viewport:e,z:t=0,cullRect:r}){return(e.subViewports||[e]).map(s=>ZB(s,t,r))}function ZB(e,t,r){if(!Array.isArray(t)){let n=r.x-e.x,o=r.y-e.y,{width:c,height:f}=r,_={targetZ:t},w=e.unproject([n,o],_),I=e.unproject([n+c,o],_),R=e.unproject([n,o+f],_),N=e.unproject([n+c,o+f],_);return[Math.min(w[0],I[0],R[0],N[0]),Math.min(w[1],I[1],R[1],N[1]),Math.max(w[0],I[0],R[0],N[0]),Math.max(w[1],I[1],R[1],N[1])]}let i=ZB(e,t[0],r),s=ZB(e,t[1],r);return[Math.min(i[0],s[0]),Math.min(i[1],s[1]),Math.max(i[2],s[2]),Math.max(i[3],s[3])]}function iyt(e,t,r){return r?VQ(e,r).map(s=>s*t/zp):e.map(i=>i*t/zp)}function $B(e,t){return Math.pow(2,e)*zp/t}function DI(e,t,r){let i=$B(r,zp),s=e/i*360-180,n=Math.PI-2*Math.PI*t/i,o=180/Math.PI*Math.atan(.5*(Math.exp(n)-Math.exp(-n)));return[s,o]}function UQ(e,t,r,i){let s=$B(r,i);return[e/s*zp,t/s*zp]}function XB(e,t,r,i,s=zp){if(e.isGeospatial){let[_,w]=DI(t,r,i),[I,R]=DI(t+1,r+1,i);return{west:_,north:w,east:I,south:R}}let[n,o]=UQ(t,r,i,s),[c,f]=UQ(t+1,r+1,i,s);return{left:n,top:o,right:c,bottom:f}}function nyt(e,t,r,i,s){let n=ryt(e,null,i),o=$B(t,r),[c,f,_,w]=iyt(n,o,s),I=[];for(let R=Math.floor(c);R<_;R++)for(let N=Math.floor(f);Nt&&(_=t);let w=s;return o&&c&&s&&!e.isGeospatial&&(w=VQ(s,o)),e.isGeospatial?NQ(e,_,i,s):nyt(e,_,n,w||tyt,c)}function GQ(e){let t={},r;return i=>{for(let s in i)if(!syt(i[s],t[s])){r=e(i),t=i;break}return r}}function syt(e,t){if(e===t)return!0;if(Array.isArray(e)){let r=e.length;if(!t||t.length!==r)return!1;for(let i=0;i{}},uyt={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:\"best-available\",zRange:null,maxRequests:6,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},MS=class{constructor(t){G(this,\"opts\",void 0),G(this,\"_requestScheduler\",void 0),G(this,\"_cache\",void 0),G(this,\"_dirty\",void 0),G(this,\"_tiles\",void 0),G(this,\"_cacheByteSize\",void 0),G(this,\"_viewport\",void 0),G(this,\"_zRange\",void 0),G(this,\"_selectedTiles\",void 0),G(this,\"_frameNumber\",void 0),G(this,\"_modelMatrix\",void 0),G(this,\"_modelMatrixInverse\",void 0),G(this,\"_maxZoom\",void 0),G(this,\"_minZoom\",void 0),G(this,\"onTileLoad\",void 0),G(this,\"_getCullBounds\",GQ(jQ)),this.opts={...uyt,...t},this.onTileLoad=r=>{var i,s;(i=(s=this.opts).onTileLoad)===null||i===void 0||i.call(s,r),this.opts.maxCacheByteSize&&(this._cacheByteSize+=r.byteLength,this._resizeCache())},this._requestScheduler=new py({maxRequests:t.maxRequests,throttleRequests:!!(t.maxRequests&&t.maxRequests>0)}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new En,this._modelMatrixInverse=new En,this.setOptions(t)}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(t=>t.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(t=>t.needsReload)}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(let t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let t of this._cache.keys()){let r=this._cache.get(t);!this._selectedTiles||!this._selectedTiles.includes(r)?this._cache.delete(t):r.setNeedsReload()}}update(t,{zRange:r,modelMatrix:i}={}){let s=new En(i),n=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!Ro(this._zRange,r)||n){n&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=t,this._zRange=r;let c=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:r,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=c.map(f=>this._getTile(f,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(c=>this._getTile(c.index,!0)));let o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(t,r){if(!t.isVisible)return!1;if(r&&this._viewport){let i=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:s}=t;for(let[n,o,c,f]of i){let _;if(\"west\"in s)_=s.westn&&s.southo;else{let w=Math.min(s.top,s.bottom),I=Math.max(s.top,s.bottom);_=s.leftn&&wo}if(_)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:r,minZoom:i,zRange:s,modelMatrix:n,modelMatrixInverse:o}){let{tileSize:c,extent:f,zoomOffset:_}=this.opts;return KB({viewport:t,maxZoom:r,minZoom:i,zRange:s,tileSize:c,extent:f,modelMatrix:n,modelMatrixInverse:o,zoomOffset:_})}getTileId(t){return\"\".concat(t.x,\"-\").concat(t.y,\"-\").concat(t.z)}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:r}=this.opts;return{bbox:XB(this._viewport,t.x,t.y,t.z,r)}}getParentIndex(t){let r=Math.floor(t.x/2),i=Math.floor(t.y/2),s=t.z-1;return{x:r,y:i,z:s}}updateTileStates(){let t=this.opts.refinementStrategy||ES,r=new Array(this._cache.size),i=0;for(let s of this._cache.values())r[i++]=s.isVisible,s.isSelected=!1,s.isVisible=!1;for(let s of this._selectedTiles)s.isSelected=!0,s.isVisible=!0;(typeof t==\"function\"?t:cyt[t])(Array.from(this._cache.values())),i=0;for(let s of this._cache.values())if(r[i++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:t=0}=this.opts,r=[],i=0;for(let s of this._cache.values())s.isLoading&&(i++,!s.isSelected&&!s.isVisible&&r.push(s));for(;t>0&&i>t&&r.length>0;)r.shift().abort(),i--}_rebuildTree(){let{_cache:t}=this;for(let r of t.values())r.parent=null,r.children&&(r.children.length=0);for(let r of t.values()){let i=this._getNearestAncestor(r);r.parent=i,i!=null&&i.children&&i.children.push(r)}}_resizeCache(){let{_cache:t,opts:r}=this,i=r.maxCacheSize||(r.maxCacheByteSize?1/0:lyt*this.selectedTiles.length),s=r.maxCacheByteSize||1/0;if(t.size>i||this._cacheByteSize>s){for(let[f,_]of t){if(!_.isVisible&&!_.isSelected){var o,c;this._cacheByteSize-=r.maxCacheByteSize?_.byteLength:0,t.delete(f),(o=(c=this.opts).onTileUnload)===null||o===void 0||o.call(c,_)}if(t.size<=i&&this._cacheByteSize<=s)break}this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((f,_)=>f.zoom-_.zoom),this._dirty=!1)}_getTile(t,r){let i=this.getTileId(t),s=this._cache.get(i),n=!1;return!s&&r?(s=new PI(t),Object.assign(s,this.getTileMetadata(s.index)),Object.assign(s,{id:i,zoom:this.getTileZoom(s.index)}),n=!0,this._cache.set(i,s),this._dirty=!0):s&&s.needsReload&&(n=!0),s&&n&&s.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),s}_getNearestAncestor(t){let{_minZoom:r=0}=this,i=t.index;for(;this.getTileZoom(i)>r;){i=this.getParentIndex(i);let s=this._getTile(i);if(s)return s}return null}};function hyt(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!HQ(t)&&JB(t);for(let t of e)t.isVisible=!!(t.state&OI)}function fyt(e){for(let r of e)r.state=0;for(let r of e)r.isSelected&&HQ(r);let t=Array.from(e).sort((r,i)=>r.zoom-i.zoom);for(let r of t)if(r.isVisible=!!(r.state&OI),r.children&&(r.isVisible||r.state&WQ))for(let i of r.children)i.state=WQ;else r.isSelected&&JB(r)}function HQ(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=OI,!0;t=t.parent}return!1}function JB(e){for(let t of e.children)t.isLoaded||t.content?t.state|=OI:JB(t)}var dyt={TilesetClass:MS,data:{type:\"data\",value:[]},dataComparator:YB.equal,renderSubLayers:{type:\"function\",value:e=>new Mm(e)},getTileData:{type:\"function\",optional:!0,value:null},onViewportLoad:{type:\"function\",optional:!0,value:null},onTileLoad:{type:\"function\",value:e=>{}},onTileUnload:{type:\"function\",value:e=>{}},onTileError:{type:\"function\",value:e=>console.error(e)},extent:{type:\"array\",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:ES,zRange:null,maxRequests:6,zoomOffset:0},Lm=class extends Ni{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){var t,r;(t=this.state)===null||t===void 0||(r=t.tileset)===null||r===void 0||r.finalize()}get isLoaded(){var t,r,i;return(t=this.state)===null||t===void 0||(r=t.tileset)===null||r===void 0||(i=r.selectedTiles)===null||i===void 0?void 0:i.every(s=>s.isLoaded&&s.layers&&s.layers.every(n=>n.isLoaded))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:r}=this.state,i=t.propsOrDataChanged||t.updateTriggersChanged,s=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);r?i&&(r.setOptions(this._getTilesetOptions()),s?r.reloadAll():this.state.tileset.tiles.forEach(n=>{n.layers=null})):(r=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:r})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:r,maxCacheByteSize:i,refinementStrategy:s,extent:n,maxZoom:o,minZoom:c,maxRequests:f,zoomOffset:_}=this.props;return{maxCacheSize:r,maxCacheByteSize:i,maxZoom:o,minZoom:c,tileSize:t,refinementStrategy:s,extent:n,maxRequests:f,zoomOffset:_,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let{tileset:t}=this.state,{zRange:r,modelMatrix:i}=this.props,s=t.update(this.context.viewport,{zRange:r,modelMatrix:i}),{isLoaded:n}=t,o=this.state.isLoaded!==n,c=this.state.frameNumber!==s;n&&(o||c)&&this._onViewportLoad(),c&&this.setState({frameNumber:s}),this.state.isLoaded=n}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:r}=this.props;r&&r(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,r){this.props.onTileError(t),r.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:r,getTileData:i,fetch:s}=this.props,{signal:n}=t;return t.url=typeof r==\"string\"||Array.isArray(r)?QB(r,t):null,i?i(t):s&&t.url?s(t.url,{propName:\"data\",layer:this,signal:n}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}getPickingInfo({info:t,sourceLayer:r}){let i=r.props.tile;return t.picked&&(t.tile=i),t.sourceTile=i,t}_updateAutoHighlight(t){let r=t.sourceTile;if(r&&r.layers)for(let i of r.layers)i.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{let r=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)r&&t.layers[0]&&Object.keys(r).some(i=>t.layers[0].props[i]!==r[i])&&(t.layers=t.layers.map(i=>i.clone(r)));else{let i=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=op(i,Boolean).map(s=>s.clone({tile:t,...r}))}return t.layers})}filterSubLayer({layer:t,cullRect:r}){let{tile:i}=t.props;return this.state.tileset.isTileVisible(i,r)}};G(Lm,\"defaultProps\",dyt);G(Lm,\"layerName\",\"TileLayer\");var Ic=function(e){e=e||{};var t=typeof e<\"u\"?e:{},r={},i;for(i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);var s=[],n=\"\";function o(Zt){return t.locateFile?t.locateFile(Zt,n):n+Zt}var c;document.currentScript&&(n=document.currentScript.src),n.indexOf(\"blob:\")!==0?n=n.substr(0,n.lastIndexOf(\"/\")+1):n=\"\",c=function(fe,Be,br){var g=new XMLHttpRequest;g.open(\"GET\",fe,!0),g.responseType=\"arraybuffer\",g.onload=function(){if(g.status==200||g.status==0&&g.response){Be(g.response);return}var Ti=ht(fe);if(Ti){Be(Ti.buffer);return}br()},g.onerror=br,g.send(null)};var f=t.print||console.log.bind(console),_=t.printErr||console.warn.bind(console);for(i in r)r.hasOwnProperty(i)&&(t[i]=r[i]);r=null,t.arguments&&(s=t.arguments);var w=0,I=function(Zt){w=Zt},R=function(){return w},N=8;function j(Zt,fe,Be,br){switch(Be=Be||\"i8\",Be.charAt(Be.length-1)===\"*\"&&(Be=\"i32\"),Be){case\"i1\":Sr[Zt>>0]=fe;break;case\"i8\":Sr[Zt>>0]=fe;break;case\"i16\":oo[Zt>>1]=fe;break;case\"i32\":No[Zt>>2]=fe;break;case\"i64\":ve=[fe>>>0,(wo=fe,+Nl(wo)>=1?wo>0?(mn(+ls(wo/4294967296),4294967295)|0)>>>0:~~+ee((wo-+(~~wo>>>0))/4294967296)>>>0:0)],No[Zt>>2]=ve[0],No[Zt+4>>2]=ve[1];break;case\"float\":Uo[Zt>>2]=fe;break;case\"double\":Si[Zt>>3]=fe;break;default:oh(\"invalid type for setValue: \"+Be)}}function Q(Zt,fe,Be){switch(fe=fe||\"i8\",fe.charAt(fe.length-1)===\"*\"&&(fe=\"i32\"),fe){case\"i1\":return Sr[Zt>>0];case\"i8\":return Sr[Zt>>0];case\"i16\":return oo[Zt>>1];case\"i32\":return No[Zt>>2];case\"i64\":return No[Zt>>2];case\"float\":return Uo[Zt>>2];case\"double\":return Si[Zt>>3];default:oh(\"invalid type for getValue: \"+fe)}return null}var et=!1;function Y(Zt,fe){Zt||oh(\"Assertion failed: \"+fe)}function K(Zt){var fe=t[\"_\"+Zt];return Y(fe,\"Cannot call unknown function \"+Zt+\", make sure it is exported\"),fe}function J(Zt,fe,Be,br,g){var Vi={string:function(Ur){var hi=0;if(Ur!=null&&Ur!==0){var To=(Ur.length<<2)+1;hi=Hp(To),le(Ur,hi,To)}return hi},array:function(Ur){var hi=Hp(Ur.length);return De(Ur,hi),hi}};function Ti(Ur){return fe===\"string\"?Xt(Ur):fe===\"boolean\"?!!Ur:Ur}var Tt=K(Zt),Ms=[],cs=0;if(br)for(var li=0;li=br);)++g;if(g-fe>16&&Zt.subarray&&Et)return Et.decode(Zt.subarray(fe,g));for(var Vi=\"\";fe>10,56320|cs&1023)}}return Vi}function Xt(Zt,fe){return Zt?kt(Li,Zt,fe):\"\"}function qt(Zt,fe,Be,br){if(!(br>0))return 0;for(var g=Be,Vi=Be+br-1,Ti=0;Ti=55296&&Tt<=57343){var Ms=Zt.charCodeAt(++Ti);Tt=65536+((Tt&1023)<<10)|Ms&1023}if(Tt<=127){if(Be>=Vi)break;fe[Be++]=Tt}else if(Tt<=2047){if(Be+1>=Vi)break;fe[Be++]=192|Tt>>6,fe[Be++]=128|Tt&63}else if(Tt<=65535){if(Be+2>=Vi)break;fe[Be++]=224|Tt>>12,fe[Be++]=128|Tt>>6&63,fe[Be++]=128|Tt&63}else{if(Be+3>=Vi)break;fe[Be++]=240|Tt>>18,fe[Be++]=128|Tt>>12&63,fe[Be++]=128|Tt>>6&63,fe[Be++]=128|Tt&63}}return fe[Be]=0,Be-g}function le(Zt,fe,Be){return qt(Zt,Li,fe,Be)}var ue=typeof TextDecoder<\"u\"?new TextDecoder(\"utf-16le\"):void 0;function De(Zt,fe){Sr.set(Zt,fe)}function Ke(Zt,fe){return Zt%fe>0&&(Zt+=fe-Zt%fe),Zt}var rr,Sr,Li,oo,zl,No,ih,Uo,Si;function Ns(Zt){rr=Zt,t.HEAP8=Sr=new Int8Array(Zt),t.HEAP16=oo=new Int16Array(Zt),t.HEAP32=No=new Int32Array(Zt),t.HEAPU8=Li=new Uint8Array(Zt),t.HEAPU16=zl=new Uint16Array(Zt),t.HEAPU32=ih=new Uint32Array(Zt),t.HEAPF32=Uo=new Float32Array(Zt),t.HEAPF64=Si=new Float64Array(Zt)}var ll=5266928,kc=24016,Rc=t.TOTAL_MEMORY||33554432;t.buffer?rr=t.buffer:rr=new ArrayBuffer(Rc),Rc=rr.byteLength,Ns(rr),No[kc>>2]=ll;function Xi(Zt){for(;Zt.length>0;){var fe=Zt.shift();if(typeof fe==\"function\"){fe();continue}var Be=fe.func;typeof Be==\"number\"?fe.arg===void 0?t.dynCall_v(Be):t.dynCall_vi(Be,fe.arg):Be(fe.arg===void 0?null:fe.arg)}}var Jn=[],ki=[],ts=[],Vo=[];function cl(){if(t.preRun)for(typeof t.preRun==\"function\"&&(t.preRun=[t.preRun]);t.preRun.length;)as(t.preRun.shift());Xi(Jn)}function xo(){Xi(ki)}function Pa(){Xi(ts)}function na(){if(t.postRun)for(typeof t.postRun==\"function\"&&(t.postRun=[t.postRun]);t.postRun.length;)ao(t.postRun.shift());Xi(Vo)}function as(Zt){Jn.unshift(Zt)}function ao(Zt){Vo.unshift(Zt)}var Nl=Math.abs,ee=Math.ceil,ls=Math.floor,mn=Math.min,gi=0,oi=null,lo=null;function du(Zt){gi++,t.monitorRunDependencies&&t.monitorRunDependencies(gi)}function ul(Zt){if(gi--,t.monitorRunDependencies&&t.monitorRunDependencies(gi),gi==0&&(oi!==null&&(clearInterval(oi),oi=null),lo)){var fe=lo;lo=null,fe()}}t.preloadedImages={},t.preloadedAudios={};var bo=null,hl=\"data:application/octet-stream;base64,\";function Ia(Zt){return String.prototype.startsWith?Zt.startsWith(hl):Zt.indexOf(hl)===0}var wo,ve;bo=\"data:application/octet-stream;base64,AAAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAABAAAAAMAAAAGAAAABQAAAAIAAAAAAAAAAgAAAAMAAAABAAAABAAAAAYAAAAAAAAABQAAAAMAAAAGAAAABAAAAAUAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAABAAAABQAAAAIAAAAAAAAAAQAAAAMAAAAGAAAABAAAAAYAAAAAAAAABQAAAAIAAAABAAAABAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAgAAAAMAAAAAAAAAAAAAAAIAAAAAAAAAAQAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABgAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAAAAAAAAAAAAAAAAAIAAAAAAAAABgAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAAAAAACAAAAAwAAAAQAAAAFAAAABgAAAAAAAAABAAAAAwAAAAQAAAAFAAAABgAAAAAAAAABAAAAAgAAAAQAAAAFAAAABgAAAAAAAAABAAAAAgAAAAMAAAAFAAAABgAAAAAAAAABAAAAAgAAAAMAAAAEAAAABgAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAAAAAAABgAAAAAAAAADAAAAAgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAUAAAAEAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAEAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAUAAAACAAAABAAAAAMAAAAIAAAAAQAAAAcAAAAGAAAACQAAAAAAAAADAAAAAgAAAAIAAAAGAAAACgAAAAsAAAAAAAAAAQAAAAUAAAADAAAADQAAAAEAAAAHAAAABAAAAAwAAAAAAAAABAAAAH8AAAAPAAAACAAAAAMAAAAAAAAADAAAAAUAAAACAAAAEgAAAAoAAAAIAAAAAAAAABAAAAAGAAAADgAAAAsAAAARAAAAAQAAAAkAAAACAAAABwAAABUAAAAJAAAAEwAAAAMAAAANAAAAAQAAAAgAAAAFAAAAFgAAABAAAAAEAAAAAAAAAA8AAAAJAAAAEwAAAA4AAAAUAAAAAQAAAAcAAAAGAAAACgAAAAsAAAAYAAAAFwAAAAUAAAACAAAAEgAAAAsAAAARAAAAFwAAABkAAAACAAAABgAAAAoAAAAMAAAAHAAAAA0AAAAaAAAABAAAAA8AAAADAAAADQAAABoAAAAVAAAAHQAAAAMAAAAMAAAABwAAAA4AAAB/AAAAEQAAABsAAAAJAAAAFAAAAAYAAAAPAAAAFgAAABwAAAAfAAAABAAAAAgAAAAMAAAAEAAAABIAAAAhAAAAHgAAAAgAAAAFAAAAFgAAABEAAAALAAAADgAAAAYAAAAjAAAAGQAAABsAAAASAAAAGAAAAB4AAAAgAAAABQAAAAoAAAAQAAAAEwAAACIAAAAUAAAAJAAAAAcAAAAVAAAACQAAABQAAAAOAAAAEwAAAAkAAAAoAAAAGwAAACQAAAAVAAAAJgAAABMAAAAiAAAADQAAAB0AAAAHAAAAFgAAABAAAAApAAAAIQAAAA8AAAAIAAAAHwAAABcAAAAYAAAACwAAAAoAAAAnAAAAJQAAABkAAAAYAAAAfwAAACAAAAAlAAAACgAAABcAAAASAAAAGQAAABcAAAARAAAACwAAAC0AAAAnAAAAIwAAABoAAAAqAAAAHQAAACsAAAAMAAAAHAAAAA0AAAAbAAAAKAAAACMAAAAuAAAADgAAABQAAAARAAAAHAAAAB8AAAAqAAAALAAAAAwAAAAPAAAAGgAAAB0AAAArAAAAJgAAAC8AAAANAAAAGgAAABUAAAAeAAAAIAAAADAAAAAyAAAAEAAAABIAAAAhAAAAHwAAACkAAAAsAAAANQAAAA8AAAAWAAAAHAAAACAAAAAeAAAAGAAAABIAAAA0AAAAMgAAACUAAAAhAAAAHgAAADEAAAAwAAAAFgAAABAAAAApAAAAIgAAABMAAAAmAAAAFQAAADYAAAAkAAAAMwAAACMAAAAuAAAALQAAADgAAAARAAAAGwAAABkAAAAkAAAAFAAAACIAAAATAAAANwAAACgAAAA2AAAAJQAAACcAAAA0AAAAOQAAABgAAAAXAAAAIAAAACYAAAB/AAAAIgAAADMAAAAdAAAALwAAABUAAAAnAAAAJQAAABkAAAAXAAAAOwAAADkAAAAtAAAAKAAAABsAAAAkAAAAFAAAADwAAAAuAAAANwAAACkAAAAxAAAANQAAAD0AAAAWAAAAIQAAAB8AAAAqAAAAOgAAACsAAAA+AAAAHAAAACwAAAAaAAAAKwAAAD4AAAAvAAAAQAAAABoAAAAqAAAAHQAAACwAAAA1AAAAOgAAAEEAAAAcAAAAHwAAACoAAAAtAAAAJwAAACMAAAAZAAAAPwAAADsAAAA4AAAALgAAADwAAAA4AAAARAAAABsAAAAoAAAAIwAAAC8AAAAmAAAAKwAAAB0AAABFAAAAMwAAAEAAAAAwAAAAMQAAAB4AAAAhAAAAQwAAAEIAAAAyAAAAMQAAAH8AAAA9AAAAQgAAACEAAAAwAAAAKQAAADIAAAAwAAAAIAAAAB4AAABGAAAAQwAAADQAAAAzAAAARQAAADYAAABHAAAAJgAAAC8AAAAiAAAANAAAADkAAABGAAAASgAAACAAAAAlAAAAMgAAADUAAAA9AAAAQQAAAEsAAAAfAAAAKQAAACwAAAA2AAAARwAAADcAAABJAAAAIgAAADMAAAAkAAAANwAAACgAAAA2AAAAJAAAAEgAAAA8AAAASQAAADgAAABEAAAAPwAAAE0AAAAjAAAALgAAAC0AAAA5AAAAOwAAAEoAAABOAAAAJQAAACcAAAA0AAAAOgAAAH8AAAA+AAAATAAAACwAAABBAAAAKgAAADsAAAA/AAAATgAAAE8AAAAnAAAALQAAADkAAAA8AAAASAAAAEQAAABQAAAAKAAAADcAAAAuAAAAPQAAADUAAAAxAAAAKQAAAFEAAABLAAAAQgAAAD4AAAArAAAAOgAAACoAAABSAAAAQAAAAEwAAAA/AAAAfwAAADgAAAAtAAAATwAAADsAAABNAAAAQAAAAC8AAAA+AAAAKwAAAFQAAABFAAAAUgAAAEEAAAA6AAAANQAAACwAAABWAAAATAAAAEsAAABCAAAAQwAAAFEAAABVAAAAMQAAADAAAAA9AAAAQwAAAEIAAAAyAAAAMAAAAFcAAABVAAAARgAAAEQAAAA4AAAAPAAAAC4AAABaAAAATQAAAFAAAABFAAAAMwAAAEAAAAAvAAAAWQAAAEcAAABUAAAARgAAAEMAAAA0AAAAMgAAAFMAAABXAAAASgAAAEcAAABZAAAASQAAAFsAAAAzAAAARQAAADYAAABIAAAAfwAAAEkAAAA3AAAAUAAAADwAAABYAAAASQAAAFsAAABIAAAAWAAAADYAAABHAAAANwAAAEoAAABOAAAAUwAAAFwAAAA0AAAAOQAAAEYAAABLAAAAQQAAAD0AAAA1AAAAXgAAAFYAAABRAAAATAAAAFYAAABSAAAAYAAAADoAAABBAAAAPgAAAE0AAAA/AAAARAAAADgAAABdAAAATwAAAFoAAABOAAAASgAAADsAAAA5AAAAXwAAAFwAAABPAAAATwAAAE4AAAA/AAAAOwAAAF0AAABfAAAATQAAAFAAAABEAAAASAAAADwAAABjAAAAWgAAAFgAAABRAAAAVQAAAF4AAABlAAAAPQAAAEIAAABLAAAAUgAAAGAAAABUAAAAYgAAAD4AAABMAAAAQAAAAFMAAAB/AAAASgAAAEYAAABkAAAAVwAAAFwAAABUAAAARQAAAFIAAABAAAAAYQAAAFkAAABiAAAAVQAAAFcAAABlAAAAZgAAAEIAAABDAAAAUQAAAFYAAABMAAAASwAAAEEAAABoAAAAYAAAAF4AAABXAAAAUwAAAGYAAABkAAAAQwAAAEYAAABVAAAAWAAAAEgAAABbAAAASQAAAGMAAABQAAAAaQAAAFkAAABhAAAAWwAAAGcAAABFAAAAVAAAAEcAAABaAAAATQAAAFAAAABEAAAAagAAAF0AAABjAAAAWwAAAEkAAABZAAAARwAAAGkAAABYAAAAZwAAAFwAAABTAAAATgAAAEoAAABsAAAAZAAAAF8AAABdAAAATwAAAFoAAABNAAAAbQAAAF8AAABqAAAAXgAAAFYAAABRAAAASwAAAGsAAABoAAAAZQAAAF8AAABcAAAATwAAAE4AAABtAAAAbAAAAF0AAABgAAAAaAAAAGIAAABuAAAATAAAAFYAAABSAAAAYQAAAH8AAABiAAAAVAAAAGcAAABZAAAAbwAAAGIAAABuAAAAYQAAAG8AAABSAAAAYAAAAFQAAABjAAAAUAAAAGkAAABYAAAAagAAAFoAAABxAAAAZAAAAGYAAABTAAAAVwAAAGwAAAByAAAAXAAAAGUAAABmAAAAawAAAHAAAABRAAAAVQAAAF4AAABmAAAAZQAAAFcAAABVAAAAcgAAAHAAAABkAAAAZwAAAFsAAABhAAAAWQAAAHQAAABpAAAAbwAAAGgAAABrAAAAbgAAAHMAAABWAAAAXgAAAGAAAABpAAAAWAAAAGcAAABbAAAAcQAAAGMAAAB0AAAAagAAAF0AAABjAAAAWgAAAHUAAABtAAAAcQAAAGsAAAB/AAAAZQAAAF4AAABzAAAAaAAAAHAAAABsAAAAZAAAAF8AAABcAAAAdgAAAHIAAABtAAAAbQAAAGwAAABdAAAAXwAAAHUAAAB2AAAAagAAAG4AAABiAAAAaAAAAGAAAAB3AAAAbwAAAHMAAABvAAAAYQAAAG4AAABiAAAAdAAAAGcAAAB3AAAAcAAAAGsAAABmAAAAZQAAAHgAAABzAAAAcgAAAHEAAABjAAAAdAAAAGkAAAB1AAAAagAAAHkAAAByAAAAcAAAAGQAAABmAAAAdgAAAHgAAABsAAAAcwAAAG4AAABrAAAAaAAAAHgAAAB3AAAAcAAAAHQAAABnAAAAdwAAAG8AAABxAAAAaQAAAHkAAAB1AAAAfwAAAG0AAAB2AAAAcQAAAHkAAABqAAAAdgAAAHgAAABsAAAAcgAAAHUAAAB5AAAAbQAAAHcAAABvAAAAcwAAAG4AAAB5AAAAdAAAAHgAAAB4AAAAcwAAAHIAAABwAAAAeQAAAHcAAAB2AAAAeQAAAHQAAAB4AAAAdwAAAHUAAABxAAAAdgAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAEAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAQAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAADAAAABQAAAAEAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAgAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAABQAAAAUAAAAAAAAAAAAAAP////8BAAAAAAAAAAMAAAAEAAAAAgAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAQAAAP//////////AQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAIAAAAAAAAAAAAAAAEAAAACAAAABgAAAAQAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAoAAAACAAAAAAAAAAAAAAABAAAAAQAAAAUAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAAAAAAAAAAAAAEAAAADAAAABwAAAAYAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAHAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAAAAAAAAAAAAQAAAAAAAAAJAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAAAAAAAAAAAAQAAAAQAAAAIAAAACgAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAAAAAAAAAAABAAAACwAAAA8AAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA4AAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAgAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAACAAAAAAAAAAAAAAABAAAADAAAABAAAAAMAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAEAAAAKAAAAEwAAAAgAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAJAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAgAAAAAAAAAAAAAAAQAAAA0AAAARAAAADQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABMAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAAAAAAAAAAAAAEAAAAOAAAAEgAAAA8AAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABMAAAACAAAAAAAAAAAAAAABAAAA//////////8TAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABMAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABIAAAAAAAAAGAAAAAAAAAAhAAAAAAAAAB4AAAAAAAAAIAAAAAMAAAAxAAAAAQAAADAAAAADAAAAMgAAAAMAAAAIAAAAAAAAAAUAAAAFAAAACgAAAAUAAAAWAAAAAAAAABAAAAAAAAAAEgAAAAAAAAApAAAAAQAAACEAAAAAAAAAHgAAAAAAAAAEAAAAAAAAAAAAAAAFAAAAAgAAAAUAAAAPAAAAAQAAAAgAAAAAAAAABQAAAAUAAAAfAAAAAQAAABYAAAAAAAAAEAAAAAAAAAACAAAAAAAAAAYAAAAAAAAADgAAAAAAAAAKAAAAAAAAAAsAAAAAAAAAEQAAAAMAAAAYAAAAAQAAABcAAAADAAAAGQAAAAMAAAAAAAAAAAAAAAEAAAAFAAAACQAAAAUAAAAFAAAAAAAAAAIAAAAAAAAABgAAAAAAAAASAAAAAQAAAAoAAAAAAAAACwAAAAAAAAAEAAAAAQAAAAMAAAAFAAAABwAAAAUAAAAIAAAAAQAAAAAAAAAAAAAAAQAAAAUAAAAQAAAAAQAAAAUAAAAAAAAAAgAAAAAAAAAHAAAAAAAAABUAAAAAAAAAJgAAAAAAAAAJAAAAAAAAABMAAAAAAAAAIgAAAAMAAAAOAAAAAQAAABQAAAADAAAAJAAAAAMAAAADAAAAAAAAAA0AAAAFAAAAHQAAAAUAAAABAAAAAAAAAAcAAAAAAAAAFQAAAAAAAAAGAAAAAQAAAAkAAAAAAAAAEwAAAAAAAAAEAAAAAgAAAAwAAAAFAAAAGgAAAAUAAAAAAAAAAQAAAAMAAAAAAAAADQAAAAUAAAACAAAAAQAAAAEAAAAAAAAABwAAAAAAAAAaAAAAAAAAACoAAAAAAAAAOgAAAAAAAAAdAAAAAAAAACsAAAAAAAAAPgAAAAMAAAAmAAAAAQAAAC8AAAADAAAAQAAAAAMAAAAMAAAAAAAAABwAAAAFAAAALAAAAAUAAAANAAAAAAAAABoAAAAAAAAAKgAAAAAAAAAVAAAAAQAAAB0AAAAAAAAAKwAAAAAAAAAEAAAAAwAAAA8AAAAFAAAAHwAAAAUAAAADAAAAAQAAAAwAAAAAAAAAHAAAAAUAAAAHAAAAAQAAAA0AAAAAAAAAGgAAAAAAAAAfAAAAAAAAACkAAAAAAAAAMQAAAAAAAAAsAAAAAAAAADUAAAAAAAAAPQAAAAMAAAA6AAAAAQAAAEEAAAADAAAASwAAAAMAAAAPAAAAAAAAABYAAAAFAAAAIQAAAAUAAAAcAAAAAAAAAB8AAAAAAAAAKQAAAAAAAAAqAAAAAQAAACwAAAAAAAAANQAAAAAAAAAEAAAABAAAAAgAAAAFAAAAEAAAAAUAAAAMAAAAAQAAAA8AAAAAAAAAFgAAAAUAAAAaAAAAAQAAABwAAAAAAAAAHwAAAAAAAAAyAAAAAAAAADAAAAAAAAAAMQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAIQAAAAMAAAAYAAAAAwAAABIAAAADAAAAEAAAAAMAAABGAAAAAAAAAEMAAAAAAAAAQgAAAAMAAAA0AAAAAwAAADIAAAAAAAAAMAAAAAAAAAAlAAAAAwAAACAAAAAAAAAAHgAAAAMAAABTAAAAAAAAAFcAAAADAAAAVQAAAAMAAABKAAAAAwAAAEYAAAAAAAAAQwAAAAAAAAA5AAAAAQAAADQAAAADAAAAMgAAAAAAAAAZAAAAAAAAABcAAAAAAAAAGAAAAAMAAAARAAAAAAAAAAsAAAADAAAACgAAAAMAAAAOAAAAAwAAAAYAAAADAAAAAgAAAAMAAAAtAAAAAAAAACcAAAAAAAAAJQAAAAMAAAAjAAAAAwAAABkAAAAAAAAAFwAAAAAAAAAbAAAAAwAAABEAAAAAAAAACwAAAAMAAAA/AAAAAAAAADsAAAADAAAAOQAAAAMAAAA4AAAAAwAAAC0AAAAAAAAAJwAAAAAAAAAuAAAAAwAAACMAAAADAAAAGQAAAAAAAAAkAAAAAAAAABQAAAAAAAAADgAAAAMAAAAiAAAAAAAAABMAAAADAAAACQAAAAMAAAAmAAAAAwAAABUAAAADAAAABwAAAAMAAAA3AAAAAAAAACgAAAAAAAAAGwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAFAAAAAAAAAAzAAAAAwAAACIAAAAAAAAAEwAAAAMAAABIAAAAAAAAADwAAAADAAAALgAAAAMAAABJAAAAAwAAADcAAAAAAAAAKAAAAAAAAABHAAAAAwAAADYAAAADAAAAJAAAAAAAAABAAAAAAAAAAC8AAAAAAAAAJgAAAAMAAAA+AAAAAAAAACsAAAADAAAAHQAAAAMAAAA6AAAAAwAAACoAAAADAAAAGgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAMwAAAAMAAABSAAAAAwAAAEAAAAAAAAAALwAAAAAAAABMAAAAAwAAAD4AAAAAAAAAKwAAAAMAAABhAAAAAAAAAFkAAAADAAAARwAAAAMAAABiAAAAAwAAAFQAAAAAAAAARQAAAAAAAABgAAAAAwAAAFIAAAADAAAAQAAAAAAAAABLAAAAAAAAAEEAAAAAAAAAOgAAAAMAAAA9AAAAAAAAADUAAAADAAAALAAAAAMAAAAxAAAAAwAAACkAAAADAAAAHwAAAAMAAABeAAAAAAAAAFYAAAAAAAAATAAAAAMAAABRAAAAAwAAAEsAAAAAAAAAQQAAAAAAAABCAAAAAwAAAD0AAAAAAAAANQAAAAMAAABrAAAAAAAAAGgAAAADAAAAYAAAAAMAAABlAAAAAwAAAF4AAAAAAAAAVgAAAAAAAABVAAAAAwAAAFEAAAADAAAASwAAAAAAAAA5AAAAAAAAADsAAAAAAAAAPwAAAAMAAABKAAAAAAAAAE4AAAADAAAATwAAAAMAAABTAAAAAwAAAFwAAAADAAAAXwAAAAMAAAAlAAAAAAAAACcAAAADAAAALQAAAAMAAAA0AAAAAAAAADkAAAAAAAAAOwAAAAAAAABGAAAAAwAAAEoAAAAAAAAATgAAAAMAAAAYAAAAAAAAABcAAAADAAAAGQAAAAMAAAAgAAAAAwAAACUAAAAAAAAAJwAAAAMAAAAyAAAAAwAAADQAAAAAAAAAOQAAAAAAAAAuAAAAAAAAADwAAAAAAAAASAAAAAMAAAA4AAAAAAAAAEQAAAADAAAAUAAAAAMAAAA/AAAAAwAAAE0AAAADAAAAWgAAAAMAAAAbAAAAAAAAACgAAAADAAAANwAAAAMAAAAjAAAAAAAAAC4AAAAAAAAAPAAAAAAAAAAtAAAAAwAAADgAAAAAAAAARAAAAAMAAAAOAAAAAAAAABQAAAADAAAAJAAAAAMAAAARAAAAAwAAABsAAAAAAAAAKAAAAAMAAAAZAAAAAwAAACMAAAAAAAAALgAAAAAAAABHAAAAAAAAAFkAAAAAAAAAYQAAAAMAAABJAAAAAAAAAFsAAAADAAAAZwAAAAMAAABIAAAAAwAAAFgAAAADAAAAaQAAAAMAAAAzAAAAAAAAAEUAAAADAAAAVAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAWQAAAAAAAAA3AAAAAwAAAEkAAAAAAAAAWwAAAAMAAAAmAAAAAAAAAC8AAAADAAAAQAAAAAMAAAAiAAAAAwAAADMAAAAAAAAARQAAAAMAAAAkAAAAAwAAADYAAAAAAAAARwAAAAAAAABgAAAAAAAAAGgAAAAAAAAAawAAAAMAAABiAAAAAAAAAG4AAAADAAAAcwAAAAMAAABhAAAAAwAAAG8AAAADAAAAdwAAAAMAAABMAAAAAAAAAFYAAAADAAAAXgAAAAMAAABSAAAAAAAAAGAAAAAAAAAAaAAAAAAAAABUAAAAAwAAAGIAAAAAAAAAbgAAAAMAAAA6AAAAAAAAAEEAAAADAAAASwAAAAMAAAA+AAAAAwAAAEwAAAAAAAAAVgAAAAMAAABAAAAAAwAAAFIAAAAAAAAAYAAAAAAAAABVAAAAAAAAAFcAAAAAAAAAUwAAAAMAAABlAAAAAAAAAGYAAAADAAAAZAAAAAMAAABrAAAAAwAAAHAAAAADAAAAcgAAAAMAAABCAAAAAAAAAEMAAAADAAAARgAAAAMAAABRAAAAAAAAAFUAAAAAAAAAVwAAAAAAAABeAAAAAwAAAGUAAAAAAAAAZgAAAAMAAAAxAAAAAAAAADAAAAADAAAAMgAAAAMAAAA9AAAAAwAAAEIAAAAAAAAAQwAAAAMAAABLAAAAAwAAAFEAAAAAAAAAVQAAAAAAAABfAAAAAAAAAFwAAAAAAAAAUwAAAAAAAABPAAAAAAAAAE4AAAAAAAAASgAAAAMAAAA/AAAAAQAAADsAAAADAAAAOQAAAAMAAABtAAAAAAAAAGwAAAAAAAAAZAAAAAUAAABdAAAAAQAAAF8AAAAAAAAAXAAAAAAAAABNAAAAAQAAAE8AAAAAAAAATgAAAAAAAAB1AAAABAAAAHYAAAAFAAAAcgAAAAUAAABqAAAAAQAAAG0AAAAAAAAAbAAAAAAAAABaAAAAAQAAAF0AAAABAAAAXwAAAAAAAABaAAAAAAAAAE0AAAAAAAAAPwAAAAAAAABQAAAAAAAAAEQAAAAAAAAAOAAAAAMAAABIAAAAAQAAADwAAAADAAAALgAAAAMAAABqAAAAAAAAAF0AAAAAAAAATwAAAAUAAABjAAAAAQAAAFoAAAAAAAAATQAAAAAAAABYAAAAAQAAAFAAAAAAAAAARAAAAAAAAAB1AAAAAwAAAG0AAAAFAAAAXwAAAAUAAABxAAAAAQAAAGoAAAAAAAAAXQAAAAAAAABpAAAAAQAAAGMAAAABAAAAWgAAAAAAAABpAAAAAAAAAFgAAAAAAAAASAAAAAAAAABnAAAAAAAAAFsAAAAAAAAASQAAAAMAAABhAAAAAQAAAFkAAAADAAAARwAAAAMAAABxAAAAAAAAAGMAAAAAAAAAUAAAAAUAAAB0AAAAAQAAAGkAAAAAAAAAWAAAAAAAAABvAAAAAQAAAGcAAAAAAAAAWwAAAAAAAAB1AAAAAgAAAGoAAAAFAAAAWgAAAAUAAAB5AAAAAQAAAHEAAAAAAAAAYwAAAAAAAAB3AAAAAQAAAHQAAAABAAAAaQAAAAAAAAB3AAAAAAAAAG8AAAAAAAAAYQAAAAAAAABzAAAAAAAAAG4AAAAAAAAAYgAAAAMAAABrAAAAAQAAAGgAAAADAAAAYAAAAAMAAAB5AAAAAAAAAHQAAAAAAAAAZwAAAAUAAAB4AAAAAQAAAHcAAAAAAAAAbwAAAAAAAABwAAAAAQAAAHMAAAAAAAAAbgAAAAAAAAB1AAAAAQAAAHEAAAAFAAAAaQAAAAUAAAB2AAAAAQAAAHkAAAAAAAAAdAAAAAAAAAByAAAAAQAAAHgAAAABAAAAdwAAAAAAAAByAAAAAAAAAHAAAAAAAAAAawAAAAAAAABkAAAAAAAAAGYAAAAAAAAAZQAAAAMAAABTAAAAAQAAAFcAAAADAAAAVQAAAAMAAAB2AAAAAAAAAHgAAAAAAAAAcwAAAAUAAABsAAAAAQAAAHIAAAAAAAAAcAAAAAAAAABcAAAAAQAAAGQAAAAAAAAAZgAAAAAAAAB1AAAAAAAAAHkAAAAFAAAAdwAAAAUAAABtAAAAAQAAAHYAAAAAAAAAeAAAAAAAAABfAAAAAQAAAGwAAAABAAAAcgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAB+ogX28rbpPxqumpJv+fM/165tC4ns9D+XaEnTqUsEQFrOtNlC4PA/3U+0XG6P9b9TdUUBxTTjP4PUp8ex1ty/B1rD/EN43z+lcDi6LLrZP/a45NWEHMY/oJ5ijLDZ+j/xw3rjxWPjP2B8A46ioQdAotff3wla2z+FMSpA1jj+v6b5Y1mtPbS/cIu8K0F457/2esiyJpDNv98k5Ts2NeA/pvljWa09tD88ClUJ60MDQPZ6yLImkM0/4ONKxa0UBcD2uOTVhBzGv5G7JRxGave/8cN648Vj47+HCwtkjAXIv6LX398JWtu/qyheaCAL9D9TdUUBxTTjv4gyTxslhwVAB1rD/EN4378EH/28teoFwH6iBfbytum/F6ztFYdK/r/Xrm0Liez0vwcS6wNGWeO/Ws602ULg8L9TCtRLiLT8P8pi5RexJsw/BlIKPVwR5T95Wyu0/QjnP5PjoT7YYcu/mBhKZ6zrwj8wRYS7NebuP3qW6geh+Ls/SLrixebL3r+pcyymN9XrPwmkNHp7xec/GWNMZVAA17+82s+x2BLiPwn2ytbJ9ek/LgEH1sMS1j8yp/2LhTfeP+SnWwtQBbu/d38gkp5X7z8ytsuHaADGPzUYObdf1+m/7IauECWhwz+cjSACjzniP76Z+wUhN9K/1+GEKzup67+/GYr/04baPw6idWOvsuc/ZedTWsRa5b/EJQOuRzi0v/OncYhHPes/h49PixY53j+i8wWfC03Nvw2idWOvsue/ZedTWsRa5T/EJQOuRzi0P/KncYhHPeu/iY9PixY53r+i8wWfC03NP9anWwtQBbs/d38gkp5X778ytsuHaADGvzUYObdf1+k/74auECWhw7+cjSACjzniv8CZ+wUhN9I/1uGEKzup6z+/GYr/04bavwmkNHp7xee/F2NMZVAA1z+82s+x2BLivwr2ytbJ9em/KwEH1sMS1r8yp/2LhTfev81i5RexJsy/BlIKPVwR5b95Wyu0/Qjnv5DjoT7YYcs/nBhKZ6zrwr8wRYS7Nebuv3OW6geh+Lu/SLrixebL3j+pcyymN9Xrv8rHIFfWehZAMBwUdlo0DECTUc17EOb2PxpVB1SWChdAzjbhb9pTDUDQhmdvECX5P9FlMKCC9+g/IIAzjELgE0DajDngMv8GQFhWDmDPjNs/y1guLh96EkAxPi8k7DIEQJCc4URlhRhA3eLKKLwkEECqpNAyTBD/P6xpjXcDiwVAFtl//cQm4z+Ibt3XKiYTQM7mCLUb3QdAoM1t8yVv7D8aLZv2Nk8UQEAJPV5nQwxAtSsfTCoE9z9TPjXLXIIWQBVanC5W9AtAYM3d7Adm9j++5mQz1FoWQBUThyaVBghAwH5muQsV7T89Q1qv82MUQJoWGOfNuBdAzrkClkmwDkDQjKq77t37Py+g0dtitsE/ZwAMTwVPEUBojepluNwBQGYbtuW+t9w/HNWIJs6MEkDTNuQUSlgEQKxktPP5TcQ/ixbLB8JjEUCwuWjXMQYCQAS/R09FkRdAowpiZjhhDkB7LmlczD/7P01iQmhhsAVAnrtTwDy84z/Z6jfQ2TgTQChOCXMnWwpAhrW3daoz8z/HYJvVPI4VQLT3ik5FcA5Angi7LOZd+z+NNVzDy5gXQBXdvVTFUA1AYNMgOeYe+T8+qHXGCwkXQKQTOKwa5AJA8gFVoEMW0T+FwzJyttIRQAEAAAD/////BwAAAP////8xAAAA/////1cBAAD/////YQkAAP////+nQQAA/////5HLAQD/////95AMAP/////B9lcAAAAAAAAAAAAAAAAAAgAAAP////8OAAAA/////2IAAAD/////rgIAAP/////CEgAA/////06DAAD/////IpcDAP/////uIRkA/////4LtrwAAAAAAAAAAAAAAAAAAAAAAAgAAAP//////////AQAAAAMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////wIAAAD//////////wEAAAAAAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA/////////////////////wEAAAD///////////////8CAAAA////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD///////////////////////////////8CAAAA////////////////AQAAAP////////////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAAAQAAAP//////////AgAAAP//////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAAEAAAD//////////wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAgAAAAAAAAACAAAAAQAAAAEAAAACAAAAAgAAAAAAAAAFAAAABQAAAAAAAAACAAAAAgAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAABAAAAAgAAAAIAAAACAAAAAAAAAAUAAAAGAAAAAAAAAAIAAAACAAAAAwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAAAAAAAAgAAAAEAAAADAAAAAgAAAAIAAAAAAAAABQAAAAcAAAAAAAAAAgAAAAIAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAACAAAAAQAAAAQAAAACAAAAAgAAAAAAAAAFAAAACAAAAAAAAAACAAAAAgAAAAMAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAUAAAAJAAAAAAAAAAIAAAACAAAAAwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAIAAAACAAAAAAAAAAMAAAAOAAAAAgAAAAAAAAACAAAAAwAAAAAAAAAAAAAAAgAAAAIAAAADAAAABgAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAgAAAAIAAAAAAAAAAwAAAAoAAAACAAAAAAAAAAIAAAADAAAAAQAAAAAAAAACAAAAAgAAAAMAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAgAAAAAAAAADAAAACwAAAAIAAAAAAAAAAgAAAAMAAAACAAAAAAAAAAIAAAACAAAAAwAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAACAAAAAAAAAAMAAAAMAAAAAgAAAAAAAAACAAAAAwAAAAMAAAAAAAAAAgAAAAIAAAADAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAIAAAAAAAAAAwAAAA0AAAACAAAAAAAAAAIAAAADAAAABAAAAAAAAAACAAAAAgAAAAMAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAgAAAAAAAAADAAAABgAAAAIAAAAAAAAAAgAAAAMAAAAPAAAAAAAAAAIAAAACAAAAAwAAAAsAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAIAAAACAAAAAAAAAAMAAAAHAAAAAgAAAAAAAAACAAAAAwAAABAAAAAAAAAAAgAAAAIAAAADAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAIAAAAAAAAAAwAAAAgAAAACAAAAAAAAAAIAAAADAAAAEQAAAAAAAAACAAAAAgAAAAMAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAACAAAAAgAAAAAAAAADAAAACQAAAAIAAAAAAAAAAgAAAAMAAAASAAAAAAAAAAIAAAACAAAAAwAAAA4AAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAACAAAAAAAAAAMAAAAFAAAAAgAAAAAAAAACAAAAAwAAABMAAAAAAAAAAgAAAAIAAAADAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAgAAAAAAAAACAAAAAQAAABMAAAACAAAAAgAAAAAAAAAFAAAACgAAAAAAAAACAAAAAgAAAAMAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABEAAAACAAAAAAAAAAIAAAABAAAADwAAAAIAAAACAAAAAAAAAAUAAAALAAAAAAAAAAIAAAACAAAAAwAAABEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAIAAAAAAAAAAgAAAAEAAAAQAAAAAgAAAAIAAAAAAAAABQAAAAwAAAAAAAAAAgAAAAIAAAADAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAACAAAAAQAAABEAAAACAAAAAgAAAAAAAAAFAAAADQAAAAAAAAACAAAAAgAAAAMAAAATAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAACAAAAAAAAAAIAAAABAAAAEgAAAAIAAAACAAAAAAAAAAUAAAAOAAAAAAAAAAIAAAACAAAAAwAAAAIAAAABAAAAAAAAAAEAAAACAAAAAAAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAEAAAAAAAAAAgAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAgAAAAAAAAABAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAFAAAAAAAAAAEAAAAAAAAAAAAAAMuhRbbsNlBBYqHW9OmHIkF9XBuqnS31QAK37uYhNMhAOSo3UUupm0DC+6pc6JxvQHV9eseEEEJAzURsCyqlFEB8BQ4NMJjnPyy3tBoS97o/xawXQznRjj89J2K2CZxhP6vX43RIIDQ/S8isgygEBz+LvFHQkmzaPjFFFO7wMq4+AADMLkTtjkIAAOgkJqxhQgAAU7B0MjRCAADwpBcVB0IAAACYP2HaQQAAAIn/Ja5BzczM4Eg6gUHNzMxMU7BTQTMzMzNfgCZBAAAAAEi3+UAAAAAAwGPNQDMzMzMzy6BAmpmZmZkxc0AzMzMzM/NFQDMzMzMzMxlAzczMzMzM7D+ygXSx2U6RQKimJOvQKnpA23hmONTHY0A/AGcxyudNQNb3K647mzZA+S56rrwWIUAm4kUQ+9UJQKre9hGzh/M/BLvoy9WG3T+LmqMf8VHGP2m3nYNV37A/gbFHcyeCmT+cBPWBckiDP61tZACjKW0/q2RbYVUYVj8uDypVyLNAP6jGS5cA5zBBwcqhBdCNGUEGEhQ/JVEDQT6WPnRbNO1AB/AWSJgT1kDfUWNCNLDAQNk+5C33OqlAchWL34QSk0DKvtDIrNV8QNF0G3kFzGVASSeWhBl6UED+/0mNGuk4QGjA/dm/1CJALPLPMql6DEDSHoDrwpP1P2jouzWST+A/egAAAAAAAABKAwAAAAAAAPoWAAAAAAAAyqAAAAAAAAB6ZQQAAAAAAErGHgAAAAAA+mvXAAAAAADK8+MFAAAAAHqqOykAAAAASqmhIAEAAAD6oGvkBwAAAMpm8T43AAAAes+ZuIIBAABKrDQMkwoAAPq1cFUFSgAAyvkUViUGAgAAAAAAAwAAAAYAAAACAAAABQAAAAEAAAAEAAAAAAAAAAAAAAAFAAAAAwAAAAEAAAAGAAAABAAAAAIAAAAAAAAAAAAAAP////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAA/////wAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAP////8AAAAAAAAAAAEAAAABAAAAAAAAAAAAAAD/////AAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAA/////wUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAUAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAAAAAAABAAEAAAEBAAAAAAABAAAAAQAAAAEAAQAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAHAAAABwAAAAEAAAACAAAABAAAAAMAAAAAAAAAAAAAAAcAAAADAAAAAQAAAAIAAAAFAAAABAAAAAAAAAAAAAAAYWxnb3MuYwBfcG9seWZpbGxJbnRlcm5hbABhZGphY2VudEZhY2VEaXJbdG1wRmlqay5mYWNlXVtmaWprLmZhY2VdID09IEtJAGZhY2VpamsuYwBfZmFjZUlqa1BlbnRUb0dlb0JvdW5kYXJ5AGFkamFjZW50RmFjZURpcltjZW50ZXJJSksuZmFjZV1bZmFjZTJdID09IEtJAF9mYWNlSWprVG9HZW9Cb3VuZGFyeQBwb2x5Z29uLT5uZXh0ID09IE5VTEwAbGlua2VkR2VvLmMAYWRkTmV3TGlua2VkUG9seWdvbgBuZXh0ICE9IE5VTEwAbG9vcCAhPSBOVUxMAGFkZE5ld0xpbmtlZExvb3AAcG9seWdvbi0+Zmlyc3QgPT0gTlVMTABhZGRMaW5rZWRMb29wAGNvb3JkICE9IE5VTEwAYWRkTGlua2VkQ29vcmQAbG9vcC0+Zmlyc3QgPT0gTlVMTABpbm5lckxvb3BzICE9IE5VTEwAbm9ybWFsaXplTXVsdGlQb2x5Z29uAGJib3hlcyAhPSBOVUxMAGNhbmRpZGF0ZXMgIT0gTlVMTABmaW5kUG9seWdvbkZvckhvbGUAY2FuZGlkYXRlQkJveGVzICE9IE5VTEwAcmV2RGlyICE9IElOVkFMSURfRElHSVQAbG9jYWxpai5jAGgzVG9Mb2NhbElqawBiYXNlQ2VsbCAhPSBvcmlnaW5CYXNlQ2VsbAAhKG9yaWdpbk9uUGVudCAmJiBpbmRleE9uUGVudCkAcGVudGFnb25Sb3RhdGlvbnMgPj0gMABkaXJlY3Rpb25Sb3RhdGlvbnMgPj0gMABiYXNlQ2VsbCA9PSBvcmlnaW5CYXNlQ2VsbABiYXNlQ2VsbCAhPSBJTlZBTElEX0JBU0VfQ0VMTABsb2NhbElqa1RvSDMAIV9pc0Jhc2VDZWxsUGVudGFnb24oYmFzZUNlbGwpAGJhc2VDZWxsUm90YXRpb25zID49IDAAd2l0aGluUGVudGFnb25Sb3RhdGlvbnMgPj0gMABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl\";var jo=24032;function gn(Zt){return Zt}function Ul(Zt){var fe=/\\b__Z[\\w\\d_]+/g;return Zt.replace(fe,function(Be){var br=Be;return Be===br?Be:br+\" [\"+Be+\"]\"})}function Ca(){var Zt=new Error;if(!Zt.stack){try{throw new Error(0)}catch(fe){Zt=fe}if(!Zt.stack)return\"(no stack trace available)\"}return Zt.stack.toString()}function Te(){var Zt=Ca();return t.extraStackTrace&&(Zt+=`\n`+t.extraStackTrace()),Ul(Zt)}function Dr(Zt,fe,Be,br){oh(\"Assertion failed: \"+Xt(Zt)+\", at: \"+[fe?Xt(fe):\"unknown filename\",Be,br?Xt(br):\"unknown function\"])}function gr(){return Sr.length}function Us(Zt,fe,Be){Li.set(Li.subarray(fe,fe+Be),Zt)}function La(Zt){return t.___errno_location&&(No[t.___errno_location()>>2]=Zt),Zt}function Mr(Zt){oh(\"OOM\")}function sa(Zt){try{var fe=new ArrayBuffer(Zt);return fe.byteLength!=Zt?void 0:(new Int8Array(fe).set(Sr),xi(fe),Ns(fe),1)}catch{}}function gt(Zt){var fe=gr(),Be=16777216,br=2147483648-Be;if(Zt>br)return!1;for(var g=16777216,Vi=Math.max(fe,g);Vi>4,g=(Tt&15)<<4|Ms>>2,Vi=(Ms&3)<<6|cs,Be=Be+String.fromCharCode(br),Ms!==64&&(Be=Be+String.fromCharCode(g)),cs!==64&&(Be=Be+String.fromCharCode(Vi));while(li>2]=p,g[k+4>>2]=m,k=(C|0)!=0,k&&(g[C>>2]=0),ji(p,m)|0)return Nt=1,wt=Wt,Nt|0;g[Nt>>2]=0;t:do if((y|0)>=1)if(k)for(it=0,ot=1,Ct=1,L=0,k=p;;){if(!(L|it)){if(k=Wn(k,m,4,Nt)|0,m=It()|0,(k|0)==0&(m|0)==0){k=2;break t}if(ji(k,m)|0){k=1;break t}}if(k=Wn(k,m,g[16+(it<<2)>>2]|0,Nt)|0,m=It()|0,(k|0)==0&(m|0)==0){k=2;break t}if(p=S+(Ct<<3)|0,g[p>>2]=k,g[p+4>>2]=m,g[C+(Ct<<2)>>2]=ot,L=L+1|0,p=(L|0)==(ot|0),z=it+1|0,H=(z|0)==6,ji(k,m)|0){k=1;break t}if(ot=ot+(H&p&1)|0,(ot|0)>(y|0)){k=0;break}else it=p?H?0:z:it,Ct=Ct+1|0,L=p?0:L}else for(it=0,ot=1,Ct=1,L=0,k=p;;){if(!(L|it)){if(k=Wn(k,m,4,Nt)|0,m=It()|0,(k|0)==0&(m|0)==0){k=2;break t}if(ji(k,m)|0){k=1;break t}}if(k=Wn(k,m,g[16+(it<<2)>>2]|0,Nt)|0,m=It()|0,(k|0)==0&(m|0)==0){k=2;break t}if(p=S+(Ct<<3)|0,g[p>>2]=k,g[p+4>>2]=m,L=L+1|0,p=(L|0)==(ot|0),z=it+1|0,H=(z|0)==6,ji(k,m)|0){k=1;break t}if(ot=ot+(H&p&1)|0,(ot|0)>(y|0)){k=0;break}else it=p?H?0:z:it,Ct=Ct+1|0,L=p?0:L}else k=0;while(!1);return Nt=k,wt=Wt,Nt|0}function Ba(p,m,y,S,C,k,L){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0,k=k|0,L=L|0;var z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0;if(Ct=wt,wt=wt+16|0,ot=Ct,(p|0)==0&(m|0)==0){wt=Ct;return}if(z=Yo(p|0,m|0,k|0,((k|0)<0)<<31>>31|0)|0,It()|0,H=S+(z<<3)|0,Nt=H,Wt=g[Nt>>2]|0,Nt=g[Nt+4>>2]|0,it=(Wt|0)==(p|0)&(Nt|0)==(m|0),!((Wt|0)==0&(Nt|0)==0|it))do z=(z+1|0)%(k|0)|0,H=S+(z<<3)|0,Wt=H,Nt=g[Wt>>2]|0,Wt=g[Wt+4>>2]|0,it=(Nt|0)==(p|0)&(Wt|0)==(m|0);while(!((Nt|0)==0&(Wt|0)==0|it));if(z=C+(z<<2)|0,it&&(g[z>>2]|0)<=(L|0)){wt=Ct;return}if(Wt=H,g[Wt>>2]=p,g[Wt+4>>2]=m,g[z>>2]=L,(L|0)>=(y|0)){wt=Ct;return}Wt=L+1|0,g[ot>>2]=0,Nt=Wn(p,m,2,ot)|0,Ba(Nt,It()|0,y,S,C,k,Wt),g[ot>>2]=0,Nt=Wn(p,m,3,ot)|0,Ba(Nt,It()|0,y,S,C,k,Wt),g[ot>>2]=0,Nt=Wn(p,m,1,ot)|0,Ba(Nt,It()|0,y,S,C,k,Wt),g[ot>>2]=0,Nt=Wn(p,m,5,ot)|0,Ba(Nt,It()|0,y,S,C,k,Wt),g[ot>>2]=0,Nt=Wn(p,m,4,ot)|0,Ba(Nt,It()|0,y,S,C,k,Wt),g[ot>>2]=0,Nt=Wn(p,m,6,ot)|0,Ba(Nt,It()|0,y,S,C,k,Wt),wt=Ct}function Wn(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0;if((g[S>>2]|0)>0){C=0;do y=Na(y)|0,C=C+1|0;while((C|0)<(g[S>>2]|0))}z=me(p|0,m|0,45)|0,It()|0,H=z&127,k=Es(p,m)|0,C=me(p|0,m|0,52)|0,It()|0,C=C&15;t:do if(!C)L=6;else for(;;){if(Ct=(15-C|0)*3|0,Nt=me(p|0,m|0,Ct|0)|0,It()|0,Nt=Nt&7,Wt=(Ho(C)|0)==0,C=C+-1|0,ot=ke(7,0,Ct|0)|0,m=m&~(It()|0),Ct=ke(g[(Wt?464:48)+(Nt*28|0)+(y<<2)>>2]|0,0,Ct|0)|0,it=It()|0,y=g[(Wt?672:256)+(Nt*28|0)+(y<<2)>>2]|0,p=Ct|p&~ot,m=it|m,!y){y=0;break t}if(!C){L=6;break}}while(!1);(L|0)==6&&(Wt=g[880+(H*28|0)+(y<<2)>>2]|0,Nt=ke(Wt|0,0,45)|0,p=Nt|p,m=It()|0|m&-1040385,y=g[4304+(H*28|0)+(y<<2)>>2]|0,(Wt&127|0)==127&&(Wt=ke(g[880+(H*28|0)+20>>2]|0,0,45)|0,m=It()|0|m&-1040385,y=g[4304+(H*28|0)+20>>2]|0,p=Wo(Wt|p,m)|0,m=It()|0,g[S>>2]=(g[S>>2]|0)+1)),L=me(p|0,m|0,45)|0,It()|0,L=L&127;t:do if(fi(L)|0){e:do if((Es(p,m)|0)==1){if((H|0)!=(L|0))if(ch(L,g[7728+(H*28|0)>>2]|0)|0){p=Fd(p,m)|0,k=1,m=It()|0;break}else{p=Wo(p,m)|0,k=1,m=It()|0;break}switch(k|0){case 5:{p=Fd(p,m)|0,m=It()|0,g[S>>2]=(g[S>>2]|0)+5,k=0;break e}case 3:{p=Wo(p,m)|0,m=It()|0,g[S>>2]=(g[S>>2]|0)+1,k=0;break e}default:return Nt=0,Wt=0,Je(Nt|0),Wt|0}}else k=0;while(!1);if((y|0)>0){C=0;do p=gh(p,m)|0,m=It()|0,C=C+1|0;while((C|0)!=(y|0))}if((H|0)!=(L|0)){if(!(mu(L)|0)){if((k|0)!=0|(Es(p,m)|0)!=5)break;g[S>>2]=(g[S>>2]|0)+1;break}switch(z&127){case 8:case 118:break t;default:}(Es(p,m)|0)!=3&&(g[S>>2]=(g[S>>2]|0)+1)}}else if((y|0)>0){C=0;do p=Wo(p,m)|0,m=It()|0,C=C+1|0;while((C|0)!=(y|0))}while(!1);return g[S>>2]=((g[S>>2]|0)+y|0)%6|0,Nt=m,Wt=p,Je(Nt|0),Wt|0}function p_(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0;if(Ct=wt,wt=wt+16|0,ot=Ct,!y)return ot=S,g[ot>>2]=p,g[ot+4>>2]=m,ot=0,wt=Ct,ot|0;g[ot>>2]=0;t:do if(ji(p,m)|0)p=1;else{if(k=(y|0)>0,k){C=0,it=p;do{if(it=Wn(it,m,4,ot)|0,m=It()|0,(it|0)==0&(m|0)==0){p=2;break t}if(C=C+1|0,ji(it,m)|0){p=1;break t}}while((C|0)<(y|0));if(H=S,g[H>>2]=it,g[H+4>>2]=m,H=y+-1|0,k){k=0,L=1,C=it,p=m;do{if(C=Wn(C,p,2,ot)|0,p=It()|0,(C|0)==0&(p|0)==0){p=2;break t}if(z=S+(L<<3)|0,g[z>>2]=C,g[z+4>>2]=p,L=L+1|0,ji(C,p)|0){p=1;break t}k=k+1|0}while((k|0)<(y|0));z=0,k=L;do{if(C=Wn(C,p,3,ot)|0,p=It()|0,(C|0)==0&(p|0)==0){p=2;break t}if(L=S+(k<<3)|0,g[L>>2]=C,g[L+4>>2]=p,k=k+1|0,ji(C,p)|0){p=1;break t}z=z+1|0}while((z|0)<(y|0));L=0;do{if(C=Wn(C,p,1,ot)|0,p=It()|0,(C|0)==0&(p|0)==0){p=2;break t}if(z=S+(k<<3)|0,g[z>>2]=C,g[z+4>>2]=p,k=k+1|0,ji(C,p)|0){p=1;break t}L=L+1|0}while((L|0)<(y|0));L=0;do{if(C=Wn(C,p,5,ot)|0,p=It()|0,(C|0)==0&(p|0)==0){p=2;break t}if(z=S+(k<<3)|0,g[z>>2]=C,g[z+4>>2]=p,k=k+1|0,ji(C,p)|0){p=1;break t}L=L+1|0}while((L|0)<(y|0));L=0;do{if(C=Wn(C,p,4,ot)|0,p=It()|0,(C|0)==0&(p|0)==0){p=2;break t}if(z=S+(k<<3)|0,g[z>>2]=C,g[z+4>>2]=p,k=k+1|0,ji(C,p)|0){p=1;break t}L=L+1|0}while((L|0)<(y|0));for(L=0;;){if(C=Wn(C,p,6,ot)|0,p=It()|0,(C|0)==0&(p|0)==0){p=2;break t}if((L|0)!=(H|0))if(z=S+(k<<3)|0,g[z>>2]=C,g[z+4>>2]=p,!(ji(C,p)|0))k=k+1|0;else{p=1;break t}if(L=L+1|0,(L|0)>=(y|0)){L=it,k=m;break}}}else L=it,C=it,k=m,p=m}else L=S,g[L>>2]=p,g[L+4>>2]=m,L=p,C=p,k=m,p=m;p=((L|0)!=(C|0)|(k|0)!=(p|0))&1}while(!1);return ot=p,wt=Ct,ot|0}function Cd(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0;if(k=wt,wt=wt+48|0,C=k+8|0,S=k,z=p,L=g[z+4>>2]|0,y=S,g[y>>2]=g[z>>2],g[y+4>>2]=L,Ee(S,C),C=uh(C,m)|0,m=g[S>>2]|0,S=g[p+8>>2]|0,(S|0)<=0)return z=m,L=(C|0)<(z|0),z=L?z:C,z=z+12|0,wt=k,z|0;y=g[p+12>>2]|0,p=0;do m=(g[y+(p<<3)>>2]|0)+m|0,p=p+1|0;while((p|0)<(S|0));return z=(C|0)<(m|0),z=z?m:C,z=z+12|0,wt=k,z|0}function $p(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0;if(z=wt,wt=wt+48|0,S=z+8|0,C=z,!(Xp(p,m,y)|0)){wt=z;return}if(H=p,k=g[H+4>>2]|0,L=C,g[L>>2]=g[H>>2],g[L+4>>2]=k,Ee(C,S),L=uh(S,m)|0,m=g[C>>2]|0,k=g[p+8>>2]|0,(k|0)>0){C=g[p+12>>2]|0,S=0;do m=(g[C+(S<<3)>>2]|0)+m|0,S=S+1|0;while((S|0)!=(k|0))}if(m=(L|0)<(m|0)?m:L,(m|0)<=-12){wt=z;return}H=m+11|0,Fc(y|0,0,(((H|0)>0?H:0)<<3)+8|0)|0,wt=z}function Xp(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0,we=0,je=0,Zr=0,qi=0,Ei=0,hn=0,Pi=0,Sn=0,yn=0,Or=0;if(Or=wt,wt=wt+112|0,hn=Or+80|0,H=Or+72|0,Pi=Or,Sn=Or+56|0,it=p+8|0,yn=ho((g[it>>2]<<5)+32|0)|0,yn||Mi(22848,22448,800,22456),pr(p,yn),k=p,S=g[k+4>>2]|0,z=H,g[z>>2]=g[k>>2],g[z+4>>2]=S,Ee(H,hn),z=uh(hn,m)|0,S=g[H>>2]|0,k=g[it>>2]|0,(k|0)>0){L=g[p+12>>2]|0,C=0;do S=(g[L+(C<<3)>>2]|0)+S|0,C=C+1|0;while((C|0)!=(k|0))}if(z=(z|0)<(S|0)?S:z,Ei=z+12|0,C=Ua(Ei,8)|0,ot=Ua(Ei,8)|0,g[hn>>2]=0,Zr=p,qi=g[Zr+4>>2]|0,S=H,g[S>>2]=g[Zr>>2],g[S+4>>2]=qi,S=i0(H,Ei,m,hn,C,ot)|0,S|0)return Gr(C),Gr(ot),Gr(yn),yn=S,wt=Or,yn|0;t:do if((g[it>>2]|0)>0){for(k=p+12|0,S=0;L=i0((g[k>>2]|0)+(S<<3)|0,Ei,m,hn,C,ot)|0,S=S+1|0,!(L|0);)if((S|0)>=(g[it>>2]|0))break t;return Gr(C),Gr(ot),Gr(yn),yn=L,wt=Or,yn|0}while(!1);(z|0)>-12&&Fc(ot|0,0,((Ei|0)>1?Ei:1)<<3|0)|0;t:do if((g[hn>>2]|0)>0){qi=((Ei|0)<0)<<31>>31,Ut=C,$e=ot,er=C,we=C,je=ot,Zr=C,S=C,Le=C,We=ot,te=ot,_e=ot,C=ot;e:for(;;){for(ne=g[hn>>2]|0,Wt=0,re=0,k=0;;){L=Pi,z=L+56|0;do g[L>>2]=0,L=L+4|0;while((L|0)<(z|0));if(m=Ut+(Wt<<3)|0,H=g[m>>2]|0,m=g[m+4>>2]|0,yf(H,m,1,Pi,0)|0){L=Pi,z=L+56|0;do g[L>>2]=0,L=L+4|0;while((L|0)<(z|0));L=Ua(7,4)|0,L|0&&(Ba(H,m,1,Pi,L,7,0),Gr(L))}Nt=0;do{Ct=Pi+(Nt<<3)|0,ot=g[Ct>>2]|0,Ct=g[Ct+4>>2]|0;r:do if(!((ot|0)==0&(Ct|0)==0)){if(H=Yo(ot|0,Ct|0,Ei|0,qi|0)|0,It()|0,L=y+(H<<3)|0,z=L,m=g[z>>2]|0,z=g[z+4>>2]|0,!((m|0)==0&(z|0)==0))for(it=0;;){if((it|0)>(Ei|0))break e;if((m|0)==(ot|0)&(z|0)==(Ct|0))break r;if(H=(H+1|0)%(Ei|0)|0,L=y+(H<<3)|0,z=L,m=g[z>>2]|0,z=g[z+4>>2]|0,(m|0)==0&(z|0)==0)break;it=it+1|0}(ot|0)==0&(Ct|0)==0||(l(ot,Ct,Sn),tr(p,yn,Sn)|0&&(it=L,g[it>>2]=ot,g[it+4>>2]=Ct,it=$e+(k<<3)|0,g[it>>2]=ot,g[it+4>>2]=Ct,k=k+1|0))}while(!1);Nt=Nt+1|0}while(Nt>>>0<7);if(re=re+1|0,(re|0)>=(ne|0))break;Wt=Wt+1|0}if((ne|0)>0&&Fc(er|0,0,ne<<3|0)|0,g[hn>>2]=k,(k|0)>0)ot=C,Ct=_e,Nt=Zr,Wt=te,re=We,ne=$e,C=Le,_e=S,te=we,We=er,Le=ot,S=Ct,Zr=je,je=Nt,we=Wt,er=re,$e=Ut,Ut=ne;else break t}return Gr(we),Gr(je),Gr(yn),yn=-1,wt=Or,yn|0}else S=ot;while(!1);return Gr(yn),Gr(C),Gr(S),yn=0,wt=Or,yn|0}function i0(p,m,y,S,C,k){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0,k=k|0;var L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0,we=0,je=0,Zr=0,qi=0,Ei=0,hn=0;if(qi=wt,wt=wt+48|0,er=qi+32|0,we=qi+16|0,je=qi,L=g[p>>2]|0,(L|0)<=0)return Zr=0,wt=qi,Zr|0;We=p+4|0,te=er+8|0,_e=we+8|0,Ut=je+8|0,$e=((m|0)<0)<<31>>31,Le=0;t:for(;;){z=g[We>>2]|0,re=z+(Le<<4)|0,g[er>>2]=g[re>>2],g[er+4>>2]=g[re+4>>2],g[er+8>>2]=g[re+8>>2],g[er+12>>2]=g[re+12>>2],(Le|0)==(L+-1|0)?(g[we>>2]=g[z>>2],g[we+4>>2]=g[z+4>>2],g[we+8>>2]=g[z+8>>2],g[we+12>>2]=g[z+12>>2]):(re=z+(Le+1<<4)|0,g[we>>2]=g[re>>2],g[we+4>>2]=g[re+4>>2],g[we+8>>2]=g[re+8>>2],g[we+12>>2]=g[re+12>>2]),re=la(er,we,y)|0;e:do if((re|0)>0){ne=+(re|0),Wt=0;r:for(;;){hn=+(re-Wt|0),Ei=+(Wt|0),Tt[je>>3]=+Tt[er>>3]*hn/ne+ +Tt[we>>3]*Ei/ne,Tt[Ut>>3]=+Tt[te>>3]*hn/ne+ +Tt[_e>>3]*Ei/ne,Ct=lA(je,y)|0,Nt=It()|0,z=Yo(Ct|0,Nt|0,m|0,$e|0)|0,It()|0,L=k+(z<<3)|0,H=L,it=g[H>>2]|0,H=g[H+4>>2]|0;i:do if((it|0)==0&(H|0)==0)Zr=14;else for(ot=0;;){if((ot|0)>(m|0)){L=1;break i}if((it|0)==(Ct|0)&(H|0)==(Nt|0)){L=7;break i}if(z=(z+1|0)%(m|0)|0,L=k+(z<<3)|0,H=L,it=g[H>>2]|0,H=g[H+4>>2]|0,(it|0)==0&(H|0)==0){Zr=14;break}else ot=ot+1|0}while(!1);switch((Zr|0)==14&&(Zr=0,(Ct|0)==0&(Nt|0)==0?L=7:(g[L>>2]=Ct,g[L+4>>2]=Nt,L=g[S>>2]|0,ot=C+(L<<3)|0,g[ot>>2]=Ct,g[ot+4>>2]=Nt,g[S>>2]=L+1,L=0)),L&7){case 7:case 0:break;default:break r}if(Wt=Wt+1|0,(re|0)<=(Wt|0)){Zr=8;break e}}if(L|0){L=-1,Zr=20;break t}}else Zr=8;while(!1);if((Zr|0)==8&&(Zr=0),Le=Le+1|0,L=g[p>>2]|0,(Le|0)>=(L|0)){L=0,Zr=20;break}}return(Zr|0)==20?(wt=qi,L|0):0}function Cn(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0;if(it=wt,wt=wt+176|0,H=it,(m|0)<1){vu(y,0,0),wt=it;return}L=p,L=me(g[L>>2]|0,g[L+4>>2]|0,52)|0,It()|0,vu(y,(m|0)>6?m:6,L&15),L=0;do{if(S=p+(L<<3)|0,d(g[S>>2]|0,g[S+4>>2]|0,H),S=g[H>>2]|0,(S|0)>0){z=0;do k=H+8+(z<<4)|0,z=z+1|0,S=H+8+(((z|0)%(S|0)|0)<<4)|0,C=yh(y,S,k)|0,C?Ps(y,C)|0:Eo(y,k,S)|0,S=g[H>>2]|0;while((z|0)<(S|0))}L=L+1|0}while((L|0)!=(m|0));wt=it}function ah(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0;if(k=wt,wt=wt+32|0,S=k,C=k+16|0,Cn(p,m,C),g[y>>2]=0,g[y+4>>2]=0,g[y+8>>2]=0,p=Ws(C)|0,!p){Ht(y)|0,_h(C),wt=k;return}do{m=yt(y)|0;do dt(m,p)|0,L=p+16|0,g[S>>2]=g[L>>2],g[S+4>>2]=g[L+4>>2],g[S+8>>2]=g[L+8>>2],g[S+12>>2]=g[L+12>>2],Ps(C,p)|0,p=Fn(C,S)|0;while(p|0);p=Ws(C)|0}while(p|0);Ht(y)|0,_h(C),wt=k}function fi(p){return p=p|0,g[7728+(p*28|0)+16>>2]|0}function mu(p){return p=p|0,(p|0)==4|(p|0)==117|0}function vf(p){return p=p|0,g[11152+((g[p>>2]|0)*216|0)+((g[p+4>>2]|0)*72|0)+((g[p+8>>2]|0)*24|0)+(g[p+12>>2]<<3)>>2]|0}function Kp(p){return p=p|0,g[11152+((g[p>>2]|0)*216|0)+((g[p+4>>2]|0)*72|0)+((g[p+8>>2]|0)*24|0)+(g[p+12>>2]<<3)+4>>2]|0}function lh(p,m){p=p|0,m=m|0,p=7728+(p*28|0)|0,g[m>>2]=g[p>>2],g[m+4>>2]=g[p+4>>2],g[m+8>>2]=g[p+8>>2],g[m+12>>2]=g[p+12>>2]}function Ld(p,m){p=p|0,m=m|0;var y=0,S=0;if(m>>>0>20)return m=-1,m|0;do if((g[11152+(m*216|0)>>2]|0)!=(p|0))if((g[11152+(m*216|0)+8>>2]|0)!=(p|0))if((g[11152+(m*216|0)+16>>2]|0)!=(p|0))if((g[11152+(m*216|0)+24>>2]|0)!=(p|0))if((g[11152+(m*216|0)+32>>2]|0)!=(p|0))if((g[11152+(m*216|0)+40>>2]|0)!=(p|0))if((g[11152+(m*216|0)+48>>2]|0)!=(p|0))if((g[11152+(m*216|0)+56>>2]|0)!=(p|0))if((g[11152+(m*216|0)+64>>2]|0)!=(p|0))if((g[11152+(m*216|0)+72>>2]|0)!=(p|0))if((g[11152+(m*216|0)+80>>2]|0)!=(p|0))if((g[11152+(m*216|0)+88>>2]|0)!=(p|0))if((g[11152+(m*216|0)+96>>2]|0)!=(p|0))if((g[11152+(m*216|0)+104>>2]|0)!=(p|0))if((g[11152+(m*216|0)+112>>2]|0)!=(p|0))if((g[11152+(m*216|0)+120>>2]|0)!=(p|0))if((g[11152+(m*216|0)+128>>2]|0)!=(p|0))if((g[11152+(m*216|0)+136>>2]|0)==(p|0))p=2,y=1,S=2;else{if((g[11152+(m*216|0)+144>>2]|0)==(p|0)){p=0,y=2,S=0;break}if((g[11152+(m*216|0)+152>>2]|0)==(p|0)){p=0,y=2,S=1;break}if((g[11152+(m*216|0)+160>>2]|0)==(p|0)){p=0,y=2,S=2;break}if((g[11152+(m*216|0)+168>>2]|0)==(p|0)){p=1,y=2,S=0;break}if((g[11152+(m*216|0)+176>>2]|0)==(p|0)){p=1,y=2,S=1;break}if((g[11152+(m*216|0)+184>>2]|0)==(p|0)){p=1,y=2,S=2;break}if((g[11152+(m*216|0)+192>>2]|0)==(p|0)){p=2,y=2,S=0;break}if((g[11152+(m*216|0)+200>>2]|0)==(p|0)){p=2,y=2,S=1;break}if((g[11152+(m*216|0)+208>>2]|0)==(p|0)){p=2,y=2,S=2;break}else p=-1;return p|0}else p=2,y=1,S=1;else p=2,y=1,S=0;else p=1,y=1,S=2;else p=1,y=1,S=1;else p=1,y=1,S=0;else p=0,y=1,S=2;else p=0,y=1,S=1;else p=0,y=1,S=0;else p=2,y=0,S=2;else p=2,y=0,S=1;else p=2,y=0,S=0;else p=1,y=0,S=2;else p=1,y=0,S=1;else p=1,y=0,S=0;else p=0,y=0,S=2;else p=0,y=0,S=1;else p=0,y=0,S=0;while(!1);return m=g[11152+(m*216|0)+(y*72|0)+(p*24|0)+(S<<3)+4>>2]|0,m|0}function ch(p,m){return p=p|0,m=m|0,(g[7728+(p*28|0)+20>>2]|0)==(m|0)?(m=1,m|0):(m=(g[7728+(p*28|0)+24>>2]|0)==(m|0),m|0)}function Jp(p,m){return p=p|0,m=m|0,g[880+(p*28|0)+(m<<2)>>2]|0}function tA(p,m){return p=p|0,m=m|0,(g[880+(p*28|0)>>2]|0)==(m|0)?(m=0,m|0):(g[880+(p*28|0)+4>>2]|0)==(m|0)?(m=1,m|0):(g[880+(p*28|0)+8>>2]|0)==(m|0)?(m=2,m|0):(g[880+(p*28|0)+12>>2]|0)==(m|0)?(m=3,m|0):(g[880+(p*28|0)+16>>2]|0)==(m|0)?(m=4,m|0):(g[880+(p*28|0)+20>>2]|0)==(m|0)?(m=5,m|0):((g[880+(p*28|0)+24>>2]|0)==(m|0)?6:7)|0}function A_(){return 122}function m_(p){p=p|0;var m=0,y=0,S=0;m=0;do ke(m|0,0,45)|0,S=It()|0|134225919,y=p+(m<<3)|0,g[y>>2]=-1,g[y+4>>2]=S,m=m+1|0;while((m|0)!=122)}function n0(p){return p=p|0,+Tt[p+16>>3]<+Tt[p+24>>3]|0}function pl(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;return y=+Tt[m>>3],!(y>=+Tt[p+8>>3])||!(y<=+Tt[p>>3])?(m=0,m|0):(S=+Tt[p+16>>3],y=+Tt[p+24>>3],C=+Tt[m+8>>3],m=C>=y,p=C<=S&1,S>2]=0,k=k+4|0;while((k|0)<(z|0));return O(m,C),k=C,z=g[k>>2]|0,k=g[k+4>>2]|0,l(z,k,y),d(z,k,S),H=+Bc(y,S+8|0),Tt[y>>3]=+Tt[p>>3],k=y+8|0,Tt[k>>3]=+Tt[p+16>>3],Tt[S>>3]=+Tt[p+8>>3],z=S+8|0,Tt[z>>3]=+Tt[p+24>>3],it=+Bc(y,S),z=~~+Ji(+(it*it/+ml(+ +li(+((+Tt[k>>3]-+Tt[z>>3])/(+Tt[y>>3]-+Tt[S>>3]))),3)/(H*(H*2.59807621135)*.8))),wt=L,(z|0?z:1)|0}function la(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0;z=wt,wt=wt+288|0,S=z+264|0,C=z+96|0,k=z,L=k,H=L+96|0;do g[L>>2]=0,L=L+4|0;while((L|0)<(H|0));return O(y,k),H=k,L=g[H>>2]|0,H=g[H+4>>2]|0,l(L,H,S),d(L,H,C),it=+Bc(S,C+8|0),H=~~+Ji(+(+Bc(p,m)/(it*2))),wt=z,(H|0?H:1)|0}function kd(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0,g[p>>2]=m,g[p+4>>2]=y,g[p+8>>2]=S}function g_(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0;Ct=m+8|0,g[Ct>>2]=0,H=+Tt[p>>3],L=+li(+H),it=+Tt[p+8>>3],z=+li(+it)/.8660254037844386,L=L+z*.5,y=~~L,p=~~z,L=L-+(y|0),z=z-+(p|0);do if(L<.5)if(L<.3333333333333333)if(g[m>>2]=y,z<(L+1)*.5){g[m+4>>2]=p;break}else{p=p+1|0,g[m+4>>2]=p;break}else if(Nt=1-L,p=(!(z>2]=p,Nt<=z&z>2]=y;break}else{g[m>>2]=y;break}else{if(!(L<.6666666666666666))if(y=y+1|0,g[m>>2]=y,z>2]=p;break}else{p=p+1|0,g[m+4>>2]=p;break}if(z<1-L){if(g[m+4>>2]=p,L*2+-1>2]=y;break}}else p=p+1|0,g[m+4>>2]=p;y=y+1|0,g[m>>2]=y}while(!1);do if(H<0)if(p&1){ot=(p+1|0)/2|0,ot=zd(y|0,((y|0)<0)<<31>>31|0,ot|0,((ot|0)<0)<<31>>31|0)|0,y=~~(+(y|0)-((+(ot>>>0)+4294967296*+(It()|0))*2+1)),g[m>>2]=y;break}else{ot=(p|0)/2|0,ot=zd(y|0,((y|0)<0)<<31>>31|0,ot|0,((ot|0)<0)<<31>>31|0)|0,y=~~(+(y|0)-(+(ot>>>0)+4294967296*+(It()|0))*2),g[m>>2]=y;break}while(!1);ot=m+4|0,it<0&&(y=y-((p<<1|1|0)/2|0)|0,g[m>>2]=y,p=0-p|0,g[ot>>2]=p),S=p-y|0,(y|0)<0?(C=0-y|0,g[ot>>2]=S,g[Ct>>2]=C,g[m>>2]=0,p=S,y=0):C=0,(p|0)<0&&(y=y-p|0,g[m>>2]=y,C=C-p|0,g[Ct>>2]=C,g[ot>>2]=0,p=0),k=y-C|0,S=p-C|0,(C|0)<0&&(g[m>>2]=k,g[ot>>2]=S,g[Ct>>2]=0,p=S,y=k,C=0),S=(p|0)<(y|0)?p:y,S=(C|0)<(S|0)?C:S,!((S|0)<=0)&&(g[m>>2]=y-S,g[ot>>2]=p-S,g[Ct>>2]=C-S)}function js(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0;m=g[p>>2]|0,L=p+4|0,y=g[L>>2]|0,(m|0)<0&&(y=y-m|0,g[L>>2]=y,k=p+8|0,g[k>>2]=(g[k>>2]|0)-m,g[p>>2]=0,m=0),(y|0)<0?(m=m-y|0,g[p>>2]=m,k=p+8|0,C=(g[k>>2]|0)-y|0,g[k>>2]=C,g[L>>2]=0,y=0):(C=p+8|0,k=C,C=g[C>>2]|0),(C|0)<0&&(m=m-C|0,g[p>>2]=m,y=y-C|0,g[L>>2]=y,g[k>>2]=0,C=0),S=(y|0)<(m|0)?y:m,S=(C|0)<(S|0)?C:S,!((S|0)<=0)&&(g[p>>2]=m-S,g[L>>2]=y-S,g[k>>2]=C-S)}function gu(p,m){p=p|0,m=m|0;var y=0,S=0;S=g[p+8>>2]|0,y=+((g[p+4>>2]|0)-S|0),Tt[m>>3]=+((g[p>>2]|0)-S|0)-y*.5,Tt[m+8>>3]=y*.8660254037844386}function Ln(p,m,y){p=p|0,m=m|0,y=y|0,g[y>>2]=(g[m>>2]|0)+(g[p>>2]|0),g[y+4>>2]=(g[m+4>>2]|0)+(g[p+4>>2]|0),g[y+8>>2]=(g[m+8>>2]|0)+(g[p+8>>2]|0)}function eA(p,m,y){p=p|0,m=m|0,y=y|0,g[y>>2]=(g[p>>2]|0)-(g[m>>2]|0),g[y+4>>2]=(g[p+4>>2]|0)-(g[m+4>>2]|0),g[y+8>>2]=(g[p+8>>2]|0)-(g[m+8>>2]|0)}function ca(p,m){p=p|0,m=m|0;var y=0,S=0;y=Oc(g[p>>2]|0,m)|0,g[p>>2]=y,y=p+4|0,S=Oc(g[y>>2]|0,m)|0,g[y>>2]=S,p=p+8|0,m=Oc(g[p>>2]|0,m)|0,g[p>>2]=m}function Fa(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;L=g[p>>2]|0,z=(L|0)<0,S=(g[p+4>>2]|0)-(z?L:0)|0,k=(S|0)<0,C=(k?0-S|0:0)+((g[p+8>>2]|0)-(z?L:0))|0,y=(C|0)<0,p=y?0:C,m=(k?0:S)-(y?C:0)|0,C=(z?0:L)-(k?S:0)-(y?C:0)|0,y=(m|0)<(C|0)?m:C,y=(p|0)<(y|0)?p:y,S=(y|0)>0,p=p-(S?y:0)|0,m=m-(S?y:0)|0;t:do switch(C-(S?y:0)|0){case 0:switch(m|0){case 0:return z=p|0?(p|0)==1?1:7:0,z|0;case 1:return z=p|0?(p|0)==1?3:7:2,z|0;default:break t}case 1:switch(m|0){case 0:return z=p|0?(p|0)==1?5:7:4,z|0;case 1:{if(!p)p=6;else break t;return p|0}default:break t}default:}while(!1);return z=7,z|0}function Rd(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;L=p+8|0,y=g[L>>2]|0,m=(g[p>>2]|0)-y|0,z=p+4|0,y=(g[z>>2]|0)-y|0,S=_n(+((m*3|0)-y|0)/7)|0,g[p>>2]=S,m=_n(+((y<<1)+m|0)/7)|0,g[z>>2]=m,g[L>>2]=0,y=m-S|0,(S|0)<0?(k=0-S|0,g[z>>2]=y,g[L>>2]=k,g[p>>2]=0,m=y,S=0,y=k):y=0,(m|0)<0&&(S=S-m|0,g[p>>2]=S,y=y-m|0,g[L>>2]=y,g[z>>2]=0,m=0),k=S-y|0,C=m-y|0,(y|0)<0?(g[p>>2]=k,g[z>>2]=C,g[L>>2]=0,m=C,C=k,y=0):C=S,S=(m|0)<(C|0)?m:C,S=(y|0)<(S|0)?y:S,!((S|0)<=0)&&(g[p>>2]=C-S,g[z>>2]=m-S,g[L>>2]=y-S)}function Al(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;L=p+8|0,y=g[L>>2]|0,m=(g[p>>2]|0)-y|0,z=p+4|0,y=(g[z>>2]|0)-y|0,S=_n(+((m<<1)+y|0)/7)|0,g[p>>2]=S,m=_n(+((y*3|0)-m|0)/7)|0,g[z>>2]=m,g[L>>2]=0,y=m-S|0,(S|0)<0?(k=0-S|0,g[z>>2]=y,g[L>>2]=k,g[p>>2]=0,m=y,S=0,y=k):y=0,(m|0)<0&&(S=S-m|0,g[p>>2]=S,y=y-m|0,g[L>>2]=y,g[z>>2]=0,m=0),k=S-y|0,C=m-y|0,(y|0)<0?(g[p>>2]=k,g[z>>2]=C,g[L>>2]=0,m=C,C=k,y=0):C=S,S=(m|0)<(C|0)?m:C,S=(y|0)<(S|0)?y:S,!((S|0)<=0)&&(g[p>>2]=C-S,g[z>>2]=m-S,g[L>>2]=y-S)}function za(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;m=g[p>>2]|0,L=p+4|0,y=g[L>>2]|0,z=p+8|0,S=g[z>>2]|0,C=y+(m*3|0)|0,g[p>>2]=C,y=S+(y*3|0)|0,g[L>>2]=y,m=(S*3|0)+m|0,g[z>>2]=m,S=y-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=S,g[z>>2]=m,g[p>>2]=0,y=S,S=0):S=C,(y|0)<0&&(S=S-y|0,g[p>>2]=S,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=S-m|0,C=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=C,g[z>>2]=0,S=k,m=0):C=y,y=(C|0)<(S|0)?C:S,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=S-y,g[L>>2]=C-y,g[z>>2]=m-y)}function hh(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;C=g[p>>2]|0,L=p+4|0,m=g[L>>2]|0,z=p+8|0,y=g[z>>2]|0,S=(m*3|0)+C|0,C=y+(C*3|0)|0,g[p>>2]=C,g[L>>2]=S,m=(y*3|0)+m|0,g[z>>2]=m,y=S-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=y,g[z>>2]=m,g[p>>2]=0,C=0):y=S,(y|0)<0&&(C=C-y|0,g[p>>2]=C,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=C-m|0,S=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=S,g[z>>2]=0,C=k,m=0):S=y,y=(S|0)<(C|0)?S:C,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=C-y,g[L>>2]=S-y,g[z>>2]=m-y)}function rA(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0;(m+-1|0)>>>0>=6||(C=(g[15472+(m*12|0)>>2]|0)+(g[p>>2]|0)|0,g[p>>2]=C,z=p+4|0,S=(g[15472+(m*12|0)+4>>2]|0)+(g[z>>2]|0)|0,g[z>>2]=S,L=p+8|0,m=(g[15472+(m*12|0)+8>>2]|0)+(g[L>>2]|0)|0,g[L>>2]=m,y=S-C|0,(C|0)<0?(m=m-C|0,g[z>>2]=y,g[L>>2]=m,g[p>>2]=0,S=0):(y=S,S=C),(y|0)<0&&(S=S-y|0,g[p>>2]=S,m=m-y|0,g[L>>2]=m,g[z>>2]=0,y=0),k=S-m|0,C=y-m|0,(m|0)<0?(g[p>>2]=k,g[z>>2]=C,g[L>>2]=0,S=k,m=0):C=y,y=(C|0)<(S|0)?C:S,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=S-y,g[z>>2]=C-y,g[L>>2]=m-y))}function s0(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;C=g[p>>2]|0,L=p+4|0,m=g[L>>2]|0,z=p+8|0,y=g[z>>2]|0,S=m+C|0,C=y+C|0,g[p>>2]=C,g[L>>2]=S,m=y+m|0,g[z>>2]=m,y=S-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=y,g[z>>2]=m,g[p>>2]=0,S=0):(y=S,S=C),(y|0)<0&&(S=S-y|0,g[p>>2]=S,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=S-m|0,C=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=C,g[z>>2]=0,S=k,m=0):C=y,y=(C|0)<(S|0)?C:S,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=S-y,g[L>>2]=C-y,g[z>>2]=m-y)}function fh(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;m=g[p>>2]|0,L=p+4|0,S=g[L>>2]|0,z=p+8|0,y=g[z>>2]|0,C=S+m|0,g[p>>2]=C,S=y+S|0,g[L>>2]=S,m=y+m|0,g[z>>2]=m,y=S-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=y,g[z>>2]=m,g[p>>2]=0,S=0):(y=S,S=C),(y|0)<0&&(S=S-y|0,g[p>>2]=S,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=S-m|0,C=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=C,g[z>>2]=0,S=k,m=0):C=y,y=(C|0)<(S|0)?C:S,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=S-y,g[L>>2]=C-y,g[z>>2]=m-y)}function Na(p){switch(p=p|0,p|0){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:}return p|0}function co(p){switch(p=p|0,p|0){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:}return p|0}function Ge(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;m=g[p>>2]|0,L=p+4|0,y=g[L>>2]|0,z=p+8|0,S=g[z>>2]|0,C=y+(m<<1)|0,g[p>>2]=C,y=S+(y<<1)|0,g[L>>2]=y,m=(S<<1)+m|0,g[z>>2]=m,S=y-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=S,g[z>>2]=m,g[p>>2]=0,y=S,S=0):S=C,(y|0)<0&&(S=S-y|0,g[p>>2]=S,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=S-m|0,C=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=C,g[z>>2]=0,S=k,m=0):C=y,y=(C|0)<(S|0)?C:S,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=S-y,g[L>>2]=C-y,g[z>>2]=m-y)}function Dd(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;C=g[p>>2]|0,L=p+4|0,m=g[L>>2]|0,z=p+8|0,y=g[z>>2]|0,S=(m<<1)+C|0,C=y+(C<<1)|0,g[p>>2]=C,g[L>>2]=S,m=(y<<1)+m|0,g[z>>2]=m,y=S-C|0,(C|0)<0?(m=m-C|0,g[L>>2]=y,g[z>>2]=m,g[p>>2]=0,C=0):y=S,(y|0)<0&&(C=C-y|0,g[p>>2]=C,m=m-y|0,g[z>>2]=m,g[L>>2]=0,y=0),k=C-m|0,S=y-m|0,(m|0)<0?(g[p>>2]=k,g[L>>2]=S,g[z>>2]=0,C=k,m=0):S=y,y=(S|0)<(C|0)?S:C,y=(m|0)<(y|0)?m:y,!((y|0)<=0)&&(g[p>>2]=C-y,g[L>>2]=S-y,g[z>>2]=m-y)}function Hl(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0;return L=(g[p>>2]|0)-(g[m>>2]|0)|0,z=(L|0)<0,S=(g[p+4>>2]|0)-(g[m+4>>2]|0)-(z?L:0)|0,k=(S|0)<0,C=(z?0-L|0:0)+(g[p+8>>2]|0)-(g[m+8>>2]|0)+(k?0-S|0:0)|0,p=(C|0)<0,m=p?0:C,y=(k?0:S)-(p?C:0)|0,C=(z?0:L)-(k?S:0)-(p?C:0)|0,p=(y|0)<(C|0)?y:C,p=(m|0)<(p|0)?m:p,S=(p|0)>0,m=m-(S?p:0)|0,y=y-(S?p:0)|0,p=C-(S?p:0)|0,p=(p|0)>-1?p:0-p|0,y=(y|0)>-1?y:0-y|0,m=(m|0)>-1?m:0-m|0,m=(y|0)>(m|0)?y:m,((p|0)>(m|0)?p:m)|0}function xf(p,m){p=p|0,m=m|0;var y=0;y=g[p+8>>2]|0,g[m>>2]=(g[p>>2]|0)-y,g[m+4>>2]=(g[p+4>>2]|0)-y}function __(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0;S=g[p>>2]|0,g[m>>2]=S,p=g[p+4>>2]|0,L=m+4|0,g[L>>2]=p,z=m+8|0,g[z>>2]=0,y=p-S|0,(S|0)<0?(p=0-S|0,g[L>>2]=y,g[z>>2]=p,g[m>>2]=0,S=0):(y=p,p=0),(y|0)<0&&(S=S-y|0,g[m>>2]=S,p=p-y|0,g[z>>2]=p,g[L>>2]=0,y=0),k=S-p|0,C=y-p|0,(p|0)<0?(g[m>>2]=k,g[L>>2]=C,g[z>>2]=0,y=C,C=k,p=0):C=S,S=(y|0)<(C|0)?y:C,S=(p|0)<(S|0)?p:S,!((S|0)<=0)&&(g[m>>2]=C-S,g[L>>2]=y-S,g[z>>2]=p-S)}function Oe(p){p=p|0;var m=0,y=0,S=0,C=0;m=p+8|0,C=g[m>>2]|0,y=C-(g[p>>2]|0)|0,g[p>>2]=y,S=p+4|0,p=(g[S>>2]|0)-C|0,g[S>>2]=p,g[m>>2]=0-(p+y)}function o0(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;y=g[p>>2]|0,m=0-y|0,g[p>>2]=m,L=p+8|0,g[L>>2]=0,z=p+4|0,S=g[z>>2]|0,C=S+y|0,(y|0)>0?(g[z>>2]=C,g[L>>2]=y,g[p>>2]=0,m=0,S=C):y=0,(S|0)<0?(k=m-S|0,g[p>>2]=k,y=y-S|0,g[L>>2]=y,g[z>>2]=0,C=k-y|0,m=0-y|0,(y|0)<0?(g[p>>2]=C,g[z>>2]=m,g[L>>2]=0,S=m,y=0):(S=0,C=k)):C=m,m=(S|0)<(C|0)?S:C,m=(y|0)<(m|0)?y:m,!((m|0)<=0)&&(g[p>>2]=C-m,g[z>>2]=S-m,g[L>>2]=y-m)}function a0(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;S=wt,wt=wt+16|0,C=S,zx(p,m,y,C),g_(C,y+4|0),wt=S}function zx(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0;if(H=wt,wt=wt+32|0,k=H,ql(p,k),g[y>>2]=0,C=+jr(15888,k),L=+jr(15912,k),L>2]=1,C=L),L=+jr(15936,k),L>2]=2,C=L),L=+jr(15960,k),L>2]=3,C=L),L=+jr(15984,k),L>2]=4,C=L),L=+jr(16008,k),L>2]=5,C=L),L=+jr(16032,k),L>2]=6,C=L),L=+jr(16056,k),L>2]=7,C=L),L=+jr(16080,k),L>2]=8,C=L),L=+jr(16104,k),L>2]=9,C=L),L=+jr(16128,k),L>2]=10,C=L),L=+jr(16152,k),L>2]=11,C=L),L=+jr(16176,k),L>2]=12,C=L),L=+jr(16200,k),L>2]=13,C=L),L=+jr(16224,k),L>2]=14,C=L),L=+jr(16248,k),L>2]=15,C=L),L=+jr(16272,k),L>2]=16,C=L),L=+jr(16296,k),L>2]=17,C=L),L=+jr(16320,k),L>2]=18,C=L),L=+jr(16344,k),L>2]=19,C=L),L=+_f(+(1-C*.5)),L<1e-16){g[S>>2]=0,g[S+4>>2]=0,g[S+8>>2]=0,g[S+12>>2]=0,wt=H;return}if(y=g[y>>2]|0,C=+Tt[16368+(y*24|0)>>3],C=+ph(C-+ph(+Od(15568+(y<<4)|0,p))),Ho(m)|0?z=+ph(C+-.3334731722518321):z=C,C=+To(+L)/.381966011250105,(m|0)>0){k=0;do C=C*2.6457513110645907,k=k+1|0;while((k|0)!=(m|0))}L=+Ur(+z)*C,Tt[S>>3]=L,z=+hi(+z)*C,Tt[S+8>>3]=z,wt=H}function dh(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0;if(k=+hs(p),k<1e-16){m=15568+(m<<4)|0,g[C>>2]=g[m>>2],g[C+4>>2]=g[m+4>>2],g[C+8>>2]=g[m+8>>2],g[C+12>>2]=g[m+12>>2];return}if(L=+qr(+ +Tt[p+8>>3],+ +Tt[p>>3]),(y|0)>0){p=0;do k=k/2.6457513110645907,p=p+1|0;while((p|0)!=(y|0))}S?(k=k/3,y=(Ho(y)|0)==0,k=+Md(+((y?k:k/2.6457513110645907)*.381966011250105))):(k=+Md(+(k*.381966011250105)),Ho(y)|0&&(L=+ph(L+.3334731722518321))),f0(15568+(m<<4)|0,+ph(+Tt[16368+(m*24|0)>>3]-L),k,C)}function y_(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;S=wt,wt=wt+16|0,C=S,gu(p+4|0,C),dh(C,g[p>>2]|0,m,0,y),wt=S}function l0(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0,we=0,je=0,Zr=0,qi=0,Ei=0,hn=0,Pi=0,Sn=0,yn=0,Or=0;if(Sn=wt,wt=wt+272|0,k=Sn+256|0,te=Sn+240|0,Ei=Sn,hn=Sn+224|0,Pi=Sn+208|0,_e=Sn+176|0,Ut=Sn+160|0,$e=Sn+192|0,er=Sn+144|0,we=Sn+128|0,je=Sn+112|0,Zr=Sn+96|0,qi=Sn+80|0,g[k>>2]=m,g[te>>2]=g[p>>2],g[te+4>>2]=g[p+4>>2],g[te+8>>2]=g[p+8>>2],g[te+12>>2]=g[p+12>>2],c0(te,k,Ei),g[C>>2]=0,te=S+y+((S|0)==5&1)|0,(te|0)<=(y|0)){wt=Sn;return}H=g[k>>2]|0,it=hn+4|0,ot=_e+4|0,Ct=y+5|0,Nt=16848+(H<<2)|0,Wt=16928+(H<<2)|0,re=we+8|0,ne=je+8|0,Le=Zr+8|0,We=Pi+4|0,z=y;t:for(;;){L=Ei+(((z|0)%5|0)<<4)|0,g[Pi>>2]=g[L>>2],g[Pi+4>>2]=g[L+4>>2],g[Pi+8>>2]=g[L+8>>2],g[Pi+12>>2]=g[L+12>>2];do;while((bf(Pi,H,0,1)|0)==2);if((z|0)>(y|0)&(Ho(m)|0)!=0){if(g[_e>>2]=g[Pi>>2],g[_e+4>>2]=g[Pi+4>>2],g[_e+8>>2]=g[Pi+8>>2],g[_e+12>>2]=g[Pi+12>>2],gu(it,Ut),S=g[_e>>2]|0,k=g[17008+(S*80|0)+(g[hn>>2]<<2)>>2]|0,g[_e>>2]=g[18608+(S*80|0)+(k*20|0)>>2],L=g[18608+(S*80|0)+(k*20|0)+16>>2]|0,(L|0)>0){p=0;do s0(ot),p=p+1|0;while((p|0)<(L|0))}switch(L=18608+(S*80|0)+(k*20|0)+4|0,g[$e>>2]=g[L>>2],g[$e+4>>2]=g[L+4>>2],g[$e+8>>2]=g[L+8>>2],ca($e,(g[Nt>>2]|0)*3|0),Ln(ot,$e,ot),js(ot),gu(ot,er),yn=+(g[Wt>>2]|0),Tt[we>>3]=yn*3,Tt[re>>3]=0,Or=yn*-1.5,Tt[je>>3]=Or,Tt[ne>>3]=yn*2.598076211353316,Tt[Zr>>3]=Or,Tt[Le>>3]=yn*-2.598076211353316,g[17008+((g[_e>>2]|0)*80|0)+(g[Pi>>2]<<2)>>2]|0){case 1:{p=je,S=we;break}case 3:{p=Zr,S=je;break}case 2:{p=we,S=Zr;break}default:{p=12;break t}}Bn(Ut,er,S,p,qi),dh(qi,g[_e>>2]|0,H,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1}if((z|0)<(Ct|0)&&(gu(We,_e),dh(_e,g[Pi>>2]|0,H,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1),g[hn>>2]=g[Pi>>2],g[hn+4>>2]=g[Pi+4>>2],g[hn+8>>2]=g[Pi+8>>2],g[hn+12>>2]=g[Pi+12>>2],z=z+1|0,(z|0)>=(te|0)){p=3;break}}if((p|0)==3){wt=Sn;return}else(p|0)==12&&Mi(22474,22521,581,22531)}function c0(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0;H=wt,wt=wt+128|0,S=H+64|0,C=H,k=S,L=20208,z=k+60|0;do g[k>>2]=g[L>>2],k=k+4|0,L=L+4|0;while((k|0)<(z|0));k=C,L=20272,z=k+60|0;do g[k>>2]=g[L>>2],k=k+4|0,L=L+4|0;while((k|0)<(z|0));z=(Ho(g[m>>2]|0)|0)==0,S=z?S:C,C=p+4|0,Ge(C),Dd(C),Ho(g[m>>2]|0)|0&&(hh(C),g[m>>2]=(g[m>>2]|0)+1),g[y>>2]=g[p>>2],m=y+4|0,Ln(C,S,m),js(m),g[y+16>>2]=g[p>>2],m=y+20|0,Ln(C,S+12|0,m),js(m),g[y+32>>2]=g[p>>2],m=y+36|0,Ln(C,S+24|0,m),js(m),g[y+48>>2]=g[p>>2],m=y+52|0,Ln(C,S+36|0,m),js(m),g[y+64>>2]=g[p>>2],y=y+68|0,Ln(C,S+48|0,y),js(y),wt=H}function bf(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0;if(re=wt,wt=wt+32|0,Nt=re+12|0,z=re,Wt=p+4|0,Ct=g[16928+(m<<2)>>2]|0,ot=(S|0)!=0,Ct=ot?Ct*3|0:Ct,C=g[Wt>>2]|0,it=p+8|0,L=g[it>>2]|0,ot){if(k=p+12|0,S=g[k>>2]|0,C=L+C+S|0,(C|0)==(Ct|0))return Wt=1,wt=re,Wt|0;H=k}else H=p+12|0,S=g[H>>2]|0,C=L+C+S|0;if((C|0)<=(Ct|0))return Wt=0,wt=re,Wt|0;do if((S|0)>0){if(S=g[p>>2]|0,(L|0)>0){k=18608+(S*80|0)+60|0,S=p;break}S=18608+(S*80|0)+40|0,y?(kd(Nt,Ct,0,0),eA(Wt,Nt,z),fh(z),Ln(z,Nt,Wt),k=S,S=p):(k=S,S=p)}else k=18608+((g[p>>2]|0)*80|0)+20|0,S=p;while(!1);if(g[S>>2]=g[k>>2],C=k+16|0,(g[C>>2]|0)>0){S=0;do s0(Wt),S=S+1|0;while((S|0)<(g[C>>2]|0))}return p=k+4|0,g[Nt>>2]=g[p>>2],g[Nt+4>>2]=g[p+4>>2],g[Nt+8>>2]=g[p+8>>2],m=g[16848+(m<<2)>>2]|0,ca(Nt,ot?m*3|0:m),Ln(Wt,Nt,Wt),js(Wt),ot?S=((g[it>>2]|0)+(g[Wt>>2]|0)+(g[H>>2]|0)|0)==(Ct|0)?1:2:S=2,Wt=S,wt=re,Wt|0}function u0(p,m){p=p|0,m=m|0;var y=0;do y=bf(p,m,0,1)|0;while((y|0)==2);return y|0}function iA(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0,we=0,je=0,Zr=0,qi=0,Ei=0;if(Zr=wt,wt=wt+240|0,k=Zr+224|0,$e=Zr+208|0,er=Zr,we=Zr+192|0,je=Zr+176|0,Le=Zr+160|0,We=Zr+144|0,te=Zr+128|0,_e=Zr+112|0,Ut=Zr+96|0,g[k>>2]=m,g[$e>>2]=g[p>>2],g[$e+4>>2]=g[p+4>>2],g[$e+8>>2]=g[p+8>>2],g[$e+12>>2]=g[p+12>>2],nA($e,k,er),g[C>>2]=0,ne=S+y+((S|0)==6&1)|0,(ne|0)<=(y|0)){wt=Zr;return}H=g[k>>2]|0,it=y+6|0,ot=16928+(H<<2)|0,Ct=We+8|0,Nt=te+8|0,Wt=_e+8|0,re=we+4|0,L=0,z=y,S=-1;t:for(;;){if(k=(z|0)%6|0,p=er+(k<<4)|0,g[we>>2]=g[p>>2],g[we+4>>2]=g[p+4>>2],g[we+8>>2]=g[p+8>>2],g[we+12>>2]=g[p+12>>2],p=L,L=bf(we,H,0,1)|0,(z|0)>(y|0)&(Ho(m)|0)!=0&&(p|0)!=1&&(g[we>>2]|0)!=(S|0)){switch(gu(er+(((k+5|0)%6|0)<<4)+4|0,je),gu(er+(k<<4)+4|0,Le),qi=+(g[ot>>2]|0),Tt[We>>3]=qi*3,Tt[Ct>>3]=0,Ei=qi*-1.5,Tt[te>>3]=Ei,Tt[Nt>>3]=qi*2.598076211353316,Tt[_e>>3]=Ei,Tt[Wt>>3]=qi*-2.598076211353316,k=g[$e>>2]|0,g[17008+(k*80|0)+(((S|0)==(k|0)?g[we>>2]|0:S)<<2)>>2]|0){case 1:{p=te,S=We;break}case 3:{p=_e,S=te;break}case 2:{p=We,S=_e;break}default:{p=8;break t}}Bn(je,Le,S,p,Ut),!(qo(je,Ut)|0)&&!(qo(Le,Ut)|0)&&(dh(Ut,g[$e>>2]|0,H,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1)}if((z|0)<(it|0)&&(gu(re,je),dh(je,g[we>>2]|0,H,1,C+8+(g[C>>2]<<4)|0),g[C>>2]=(g[C>>2]|0)+1),z=z+1|0,(z|0)>=(ne|0)){p=3;break}else S=g[we>>2]|0}if((p|0)==3){wt=Zr;return}else(p|0)==8&&Mi(22557,22521,746,22602)}function nA(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0;H=wt,wt=wt+160|0,S=H+80|0,C=H,k=S,L=20336,z=k+72|0;do g[k>>2]=g[L>>2],k=k+4|0,L=L+4|0;while((k|0)<(z|0));k=C,L=20416,z=k+72|0;do g[k>>2]=g[L>>2],k=k+4|0,L=L+4|0;while((k|0)<(z|0));z=(Ho(g[m>>2]|0)|0)==0,S=z?S:C,C=p+4|0,Ge(C),Dd(C),Ho(g[m>>2]|0)|0&&(hh(C),g[m>>2]=(g[m>>2]|0)+1),g[y>>2]=g[p>>2],m=y+4|0,Ln(C,S,m),js(m),g[y+16>>2]=g[p>>2],m=y+20|0,Ln(C,S+12|0,m),js(m),g[y+32>>2]=g[p>>2],m=y+36|0,Ln(C,S+24|0,m),js(m),g[y+48>>2]=g[p>>2],m=y+52|0,Ln(C,S+36|0,m),js(m),g[y+64>>2]=g[p>>2],m=y+68|0,Ln(C,S+48|0,m),js(m),g[y+80>>2]=g[p>>2],y=y+84|0,Ln(C,S+60|0,y),js(y),wt=H}function ph(p){p=+p;var m=0;return m=p<0?p+6.283185307179586:p,+(p>=6.283185307179586?m+-6.283185307179586:m)}function us(p,m){return p=p|0,m=m|0,+li(+(+Tt[p>>3]-+Tt[m>>3]))<17453292519943298e-27?(m=+li(+(+Tt[p+8>>3]-+Tt[m+8>>3]))<17453292519943298e-27,m|0):(m=0,m|0)}function _u(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0;return C=+Tt[m>>3],S=+Tt[p>>3],k=+hi(+((C-S)*.5)),y=+hi(+((+Tt[m+8>>3]-+Tt[p+8>>3])*.5)),y=k*k+y*(+Ur(+C)*+Ur(+S)*y),+(+qr(+ +bn(+y),+ +bn(+(1-y)))*2)}function Bc(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0;return C=+Tt[m>>3],S=+Tt[p>>3],k=+hi(+((C-S)*.5)),y=+hi(+((+Tt[m+8>>3]-+Tt[p+8>>3])*.5)),y=k*k+y*(+Ur(+C)*+Ur(+S)*y),+(+qr(+ +bn(+y),+ +bn(+(1-y)))*2*6371.007180918475)}function h0(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0;return C=+Tt[m>>3],S=+Tt[p>>3],k=+hi(+((C-S)*.5)),y=+hi(+((+Tt[m+8>>3]-+Tt[p+8>>3])*.5)),y=k*k+y*(+Ur(+C)*+Ur(+S)*y),+(+qr(+ +bn(+y),+ +bn(+(1-y)))*2*6371.007180918475*1e3)}function Od(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;return k=+Tt[m>>3],S=+Ur(+k),C=+Tt[m+8>>3]-+Tt[p+8>>3],L=S*+hi(+C),y=+Tt[p>>3],+ +qr(+L,+(+hi(+k)*+Ur(+y)-+Ur(+C)*(S*+hi(+y))))}function f0(p,m,y,S){p=p|0,m=+m,y=+y,S=S|0;var C=0,k=0,L=0,z=0;if(y<1e-16){g[S>>2]=g[p>>2],g[S+4>>2]=g[p+4>>2],g[S+8>>2]=g[p+8>>2],g[S+12>>2]=g[p+12>>2];return}k=m<0?m+6.283185307179586:m,k=m>=6.283185307179586?k+-6.283185307179586:k;do if(k<1e-16)m=+Tt[p>>3]+y,Tt[S>>3]=m,C=S;else{if(C=+li(+(k+-3.141592653589793))<1e-16,m=+Tt[p>>3],C){m=m-y,Tt[S>>3]=m,C=S;break}if(L=+Ur(+y),y=+hi(+y),m=L*+hi(+m)+ +Ur(+k)*(y*+Ur(+m)),m=m>1?1:m,m=+h_(+(m<-1?-1:m)),Tt[S>>3]=m,+li(+(m+-1.5707963267948966))<1e-16){Tt[S>>3]=1.5707963267948966,Tt[S+8>>3]=0;return}if(+li(+(m+1.5707963267948966))<1e-16){Tt[S>>3]=-1.5707963267948966,Tt[S+8>>3]=0;return}if(z=+Ur(+m),k=y*+hi(+k)/z,y=+Tt[p>>3],m=(L-+hi(+m)*+hi(+y))/+Ur(+y)/z,L=k>1?1:k,m=m>1?1:m,m=+Tt[p+8>>3]+ +qr(+(L<-1?-1:L),+(m<-1?-1:m)),m>3.141592653589793)do m=m+-6.283185307179586;while(m>3.141592653589793);if(m<-3.141592653589793)do m=m+6.283185307179586;while(m<-3.141592653589793);Tt[S+8>>3]=m;return}while(!1);if(+li(+(m+-1.5707963267948966))<1e-16){Tt[C>>3]=1.5707963267948966,Tt[S+8>>3]=0;return}if(+li(+(m+1.5707963267948966))<1e-16){Tt[C>>3]=-1.5707963267948966,Tt[S+8>>3]=0;return}if(m=+Tt[p+8>>3],m>3.141592653589793)do m=m+-6.283185307179586;while(m>3.141592653589793);if(m<-3.141592653589793)do m=m+6.283185307179586;while(m<-3.141592653589793);Tt[S+8>>3]=m}function v_(p){return p=p|0,+ +Tt[20496+(p<<3)>>3]}function ua(p){return p=p|0,+ +Tt[20624+(p<<3)>>3]}function un(p){return p=p|0,+ +Tt[20752+(p<<3)>>3]}function sA(p){return p=p|0,+ +Tt[20880+(p<<3)>>3]}function d0(p){p=p|0;var m=0;return m=21008+(p<<3)|0,p=g[m>>2]|0,Je(g[m+4>>2]|0),p|0}function Ah(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0;return Nt=+Tt[m>>3],ot=+Tt[p>>3],H=+hi(+((Nt-ot)*.5)),k=+Tt[m+8>>3],it=+Tt[p+8>>3],L=+hi(+((k-it)*.5)),z=+Ur(+ot),Ct=+Ur(+Nt),L=H*H+L*(Ct*z*L),L=+qr(+ +bn(+L),+ +bn(+(1-L)))*2,H=+Tt[y>>3],Nt=+hi(+((H-Nt)*.5)),S=+Tt[y+8>>3],k=+hi(+((S-k)*.5)),C=+Ur(+H),k=Nt*Nt+k*(Ct*C*k),k=+qr(+ +bn(+k),+ +bn(+(1-k)))*2,H=+hi(+((ot-H)*.5)),S=+hi(+((it-S)*.5)),S=H*H+S*(z*C*S),S=+qr(+ +bn(+S),+ +bn(+(1-S)))*2,C=(L+k+S)*.5,+(+Md(+ +bn(+(+To(+(C*.5))*+To(+((C-L)*.5))*+To(+((C-k)*.5))*+To(+((C-S)*.5)))))*4)}function x_(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;if(k=wt,wt=wt+192|0,S=k+168|0,C=k,l(p,m,S),d(p,m,C),m=g[C>>2]|0,(m|0)<=0)return y=0,wt=k,+y;if(y=+Ah(C+8|0,C+8+(((m|0)!=1&1)<<4)|0,S)+0,(m|0)==1)return wt=k,+y;p=1;do L=p,p=p+1|0,y=y+ +Ah(C+8+(L<<4)|0,C+8+(((p|0)%(m|0)|0)<<4)|0,S);while((p|0)<(m|0));return wt=k,+y}function b_(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;if(k=wt,wt=wt+192|0,S=k+168|0,C=k,l(p,m,S),d(p,m,C),m=g[C>>2]|0,(m|0)>0){if(y=+Ah(C+8|0,C+8+(((m|0)!=1&1)<<4)|0,S)+0,(m|0)!=1){p=1;do L=p,p=p+1|0,y=y+ +Ah(C+8+(L<<4)|0,C+8+(((p|0)%(m|0)|0)<<4)|0,S);while((p|0)<(m|0))}}else y=0;return wt=k,+(y*6371.007180918475*6371.007180918475)}function Nx(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;if(k=wt,wt=wt+192|0,S=k+168|0,C=k,l(p,m,S),d(p,m,C),m=g[C>>2]|0,(m|0)>0){if(y=+Ah(C+8|0,C+8+(((m|0)!=1&1)<<4)|0,S)+0,(m|0)!=1){p=1;do L=p,p=p+1|0,y=y+ +Ah(C+8+(L<<4)|0,C+8+(((p|0)%(m|0)|0)<<4)|0,S);while((p|0)<(m|0))}}else y=0;return wt=k,+(y*6371.007180918475*6371.007180918475*1e3*1e3)}function Mo(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0;if(L=wt,wt=wt+176|0,k=L,pt(p,m,k),p=g[k>>2]|0,(p|0)<=1)return C=0,wt=L,+C;m=p+-1|0,p=0,y=0,S=+Tt[k+8>>3],C=+Tt[k+16>>3];do p=p+1|0,H=S,S=+Tt[k+8+(p<<4)>>3],it=+hi(+((S-H)*.5)),z=C,C=+Tt[k+8+(p<<4)+8>>3],z=+hi(+((C-z)*.5)),z=it*it+z*(+Ur(+S)*+Ur(+H)*z),y=y+ +qr(+ +bn(+z),+ +bn(+(1-z)))*2;while((p|0)<(m|0));return wt=L,+y}function oA(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0;if(L=wt,wt=wt+176|0,k=L,pt(p,m,k),p=g[k>>2]|0,(p|0)<=1)return C=0,wt=L,+C;m=p+-1|0,p=0,y=0,S=+Tt[k+8>>3],C=+Tt[k+16>>3];do p=p+1|0,H=S,S=+Tt[k+8+(p<<4)>>3],it=+hi(+((S-H)*.5)),z=C,C=+Tt[k+8+(p<<4)+8>>3],z=+hi(+((C-z)*.5)),z=it*it+z*(+Ur(+H)*+Ur(+S)*z),y=y+ +qr(+ +bn(+z),+ +bn(+(1-z)))*2;while((p|0)!=(m|0));return it=y*6371.007180918475,wt=L,+it}function nr(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0;if(L=wt,wt=wt+176|0,k=L,pt(p,m,k),p=g[k>>2]|0,(p|0)<=1)return C=0,wt=L,+C;m=p+-1|0,p=0,y=0,S=+Tt[k+8>>3],C=+Tt[k+16>>3];do p=p+1|0,H=S,S=+Tt[k+8+(p<<4)>>3],it=+hi(+((S-H)*.5)),z=C,C=+Tt[k+8+(p<<4)+8>>3],z=+hi(+((C-z)*.5)),z=it*it+z*(+Ur(+H)*+Ur(+S)*z),y=y+ +qr(+ +bn(+z),+ +bn(+(1-z)))*2;while((p|0)!=(m|0));return it=y*6371.007180918475*1e3,wt=L,+it}function dr(p,m){return p=p|0,m=m|0,m=me(p|0,m|0,52)|0,It()|0,m&15|0}function wf(p,m){return p=p|0,m=m|0,m=me(p|0,m|0,45)|0,It()|0,m&127|0}function aA(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0;if(!(!0&(m&-16777216|0)==134217728)||(L=me(p|0,m|0,45)|0,It()|0,L=L&127,L>>>0>121))return m=0,m|0;y=me(p|0,m|0,52)|0,It()|0,y=y&15;do if(y|0){for(C=1,S=0;;){if(k=me(p|0,m|0,(15-C|0)*3|0)|0,It()|0,k=k&7,(k|0)!=0&(S^1))if((k|0)==1&(fi(L)|0)!=0){z=0,S=13;break}else S=1;if((k|0)==7){z=0,S=13;break}if(C>>>0>>0)C=C+1|0;else{S=9;break}}if((S|0)==9){if((y|0)==15)z=1;else break;return z|0}else if((S|0)==13)return z|0}while(!1);for(;;){if(z=me(p|0,m|0,(14-y|0)*3|0)|0,It()|0,!((z&7|0)==7&!0)){z=0,S=13;break}if(y>>>0<14)y=y+1|0;else{z=1,S=13;break}}return(S|0)==13?z|0:0}function Bd(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;if(S=me(p|0,m|0,52)|0,It()|0,S=S&15,(S|0)>=(y|0)){if((S|0)!=(y|0))if(y>>>0<=15){if(C=ke(y|0,0,52)|0,p=C|p,m=It()|0|m&-15728641,(S|0)>(y|0))do C=ke(7,0,(14-y|0)*3|0)|0,y=y+1|0,p=C|p,m=It()|0|m;while((y|0)<(S|0))}else m=0,p=0}else m=0,p=0;return Je(m|0),p|0}function Hn(p,m,y){return p=p|0,m=m|0,y=y|0,p=me(p|0,m|0,52)|0,It()|0,p=p&15,(y|0)<16&(p|0)<=(y|0)?(y=Ze(7,y-p|0)|0,y|0):(y=0,y|0)}function uo(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,it=0,ot=0;if(L=me(p|0,m|0,52)|0,It()|0,L=L&15,!!((y|0)<16&(L|0)<=(y|0))){if((L|0)==(y|0)){y=S,g[y>>2]=p,g[y+4>>2]=m;return}if(H=Ze(7,y-L|0)|0,it=(H|0)/7|0,z=me(p|0,m|0,45)|0,It()|0,!(fi(z&127)|0))k=0;else{t:do if(!L)C=0;else for(k=1;;){if(C=me(p|0,m|0,(15-k|0)*3|0)|0,It()|0,C=C&7,C|0)break t;if(k>>>0>>0)k=k+1|0;else{C=0;break}}while(!1);k=(C|0)==0}if(ot=ke(L+1|0,0,52)|0,C=It()|0|m&-15728641,z=(14-L|0)*3|0,m=ke(7,0,z|0)|0,m=(ot|p)&~m,L=C&~(It()|0),uo(m,L,y,S),C=S+(it<<3)|0,!k){ot=ke(1,0,z|0)|0,uo(ot|m,It()|0|L,y,C),ot=C+(it<<3)|0,H=ke(2,0,z|0)|0,uo(H|m,It()|0|L,y,ot),ot=ot+(it<<3)|0,H=ke(3,0,z|0)|0,uo(H|m,It()|0|L,y,ot),ot=ot+(it<<3)|0,H=ke(4,0,z|0)|0,uo(H|m,It()|0|L,y,ot),ot=ot+(it<<3)|0,H=ke(5,0,z|0)|0,uo(H|m,It()|0|L,y,ot),H=ke(6,0,z|0)|0,uo(H|m,It()|0|L,y,ot+(it<<3)|0);return}k=C+(it<<3)|0,(H|0)>6&&(H=C+8|0,ot=(k>>>0>H>>>0?k:H)+-1+(0-C)|0,Fc(C|0,0,ot+8&-8|0)|0,C=H+(ot>>>3<<3)|0),ot=ke(2,0,z|0)|0,uo(ot|m,It()|0|L,y,C),ot=C+(it<<3)|0,H=ke(3,0,z|0)|0,uo(H|m,It()|0|L,y,ot),ot=ot+(it<<3)|0,H=ke(4,0,z|0)|0,uo(H|m,It()|0|L,y,ot),ot=ot+(it<<3)|0,H=ke(5,0,z|0)|0,uo(H|m,It()|0|L,y,ot),H=ke(6,0,z|0)|0,uo(H|m,It()|0|L,y,ot+(it<<3)|0)}}function ji(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;if(C=me(p|0,m|0,45)|0,It()|0,!(fi(C&127)|0))return C=0,C|0;C=me(p|0,m|0,52)|0,It()|0,C=C&15;t:do if(!C)y=0;else for(S=1;;){if(y=me(p|0,m|0,(15-S|0)*3|0)|0,It()|0,y=y&7,y|0)break t;if(S>>>0>>0)S=S+1|0;else{y=0;break}}while(!1);return C=(y|0)==0&1,C|0}function w_(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;if(S=me(p|0,m|0,52)|0,It()|0,S=S&15,(y|0)<16&(S|0)<=(y|0)){if((S|0)!=(y|0)&&(C=ke(y|0,0,52)|0,p=C|p,m=It()|0|m&-15728641,(S|0)<(y|0)))do C=ke(7,0,(14-S|0)*3|0)|0,S=S+1|0,p=p&~C,m=m&~(It()|0);while((S|0)<(y|0))}else m=0,p=0;return Je(m|0),p|0}function mh(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0,we=0,je=0;if(!y)return we=0,we|0;if(C=p,S=g[C>>2]|0,C=g[C+4>>2]|0,!0&(C&15728640|0)==0){if((y|0)<=0||(we=m,g[we>>2]=S,g[we+4>>2]=C,(y|0)==1))return we=0,we|0;S=1;do $e=p+(S<<3)|0,er=g[$e+4>>2]|0,we=m+(S<<3)|0,g[we>>2]=g[$e>>2],g[we+4>>2]=er,S=S+1|0;while((S|0)!=(y|0));return S=0,S|0}if($e=y<<3,er=ho($e)|0,!er)return we=-3,we|0;if(Va(er|0,p|0,$e|0)|0,Ut=Ua(y,8)|0,!Ut)return Gr(er),we=-3,we|0;S=y;t:for(;;){L=er,ot=g[L>>2]|0,L=g[L+4>>2]|0,te=me(ot|0,L|0,52)|0,It()|0,te=te&15,_e=te+-1|0,We=(S|0)>0;e:do if(We){if(Le=((S|0)<0)<<31>>31,re=ke(_e|0,0,52)|0,ne=It()|0,_e>>>0>15)for(C=0,p=ot,y=L;;){if(!((p|0)==0&(y|0)==0)){if(k=me(p|0,y|0,52)|0,It()|0,k=k&15,z=(k|0)<(_e|0),k=(k|0)==(_e|0),it=z?0:k?p:0,p=z?0:k?y:0,y=Yo(it|0,p|0,S|0,Le|0)|0,It()|0,k=Ut+(y<<3)|0,z=k,H=g[z>>2]|0,z=g[z+4>>2]|0,(H|0)==0&(z|0)==0)y=it;else for(re=0,Wt=y,Nt=z,y=it;;){if((re|0)>(S|0)){we=41;break t}if((H|0)==(y|0)&(Nt&-117440513|0)==(p|0)){it=me(H|0,Nt|0,56)|0,It()|0,it=it&7,Ct=it+1|0,ne=me(H|0,Nt|0,45)|0,It()|0;r:do if(!(fi(ne&127)|0))z=7;else{if(H=me(H|0,Nt|0,52)|0,It()|0,H=H&15,!H){z=6;break}for(z=1;;){if(ne=ke(7,0,(15-z|0)*3|0)|0,!((ne&y|0)==0&((It()|0)&p|0)==0)){z=7;break r}if(z>>>0>>0)z=z+1|0;else{z=6;break}}}while(!1);if((it+2|0)>>>0>z>>>0){we=51;break t}ne=ke(Ct|0,0,56)|0,p=It()|0|p&-117440513,z=k,g[z>>2]=0,g[z+4>>2]=0,z=Wt,y=ne|y}else z=(Wt+1|0)%(S|0)|0;if(k=Ut+(z<<3)|0,Nt=k,H=g[Nt>>2]|0,Nt=g[Nt+4>>2]|0,(H|0)==0&(Nt|0)==0)break;re=re+1|0,Wt=z}ne=k,g[ne>>2]=y,g[ne+4>>2]=p}if(C=C+1|0,(C|0)>=(S|0))break e;y=er+(C<<3)|0,p=g[y>>2]|0,y=g[y+4>>2]|0}for(C=0,p=ot,y=L;;){if(!((p|0)==0&(y|0)==0)){if(z=me(p|0,y|0,52)|0,It()|0,z=z&15,(z|0)>=(_e|0)){if((z|0)!=(_e|0)&&(p=p|re,y=y&-15728641|ne,z>>>0>=te>>>0)){k=_e;do Wt=ke(7,0,(14-k|0)*3|0)|0,k=k+1|0,p=Wt|p,y=It()|0|y;while(k>>>0>>0)}}else p=0,y=0;if(z=Yo(p|0,y|0,S|0,Le|0)|0,It()|0,k=Ut+(z<<3)|0,H=k,it=g[H>>2]|0,H=g[H+4>>2]|0,!((it|0)==0&(H|0)==0))for(Wt=0;;){if((Wt|0)>(S|0)){we=41;break t}if((it|0)==(p|0)&(H&-117440513|0)==(y|0)){Ct=me(it|0,H|0,56)|0,It()|0,Ct=Ct&7,Nt=Ct+1|0,je=me(it|0,H|0,45)|0,It()|0;r:do if(!(fi(je&127)|0))H=7;else{if(it=me(it|0,H|0,52)|0,It()|0,it=it&15,!it){H=6;break}for(H=1;;){if(je=ke(7,0,(15-H|0)*3|0)|0,!((je&p|0)==0&((It()|0)&y|0)==0)){H=7;break r}if(H>>>0>>0)H=H+1|0;else{H=6;break}}}while(!1);if((Ct+2|0)>>>0>H>>>0){we=51;break t}je=ke(Nt|0,0,56)|0,y=It()|0|y&-117440513,Nt=k,g[Nt>>2]=0,g[Nt+4>>2]=0,p=je|p}else z=(z+1|0)%(S|0)|0;if(k=Ut+(z<<3)|0,H=k,it=g[H>>2]|0,H=g[H+4>>2]|0,(it|0)==0&(H|0)==0)break;Wt=Wt+1|0}je=k,g[je>>2]=p,g[je+4>>2]=y}if(C=C+1|0,(C|0)>=(S|0))break e;y=er+(C<<3)|0,p=g[y>>2]|0,y=g[y+4>>2]|0}}while(!1);if((S+5|0)>>>0<11){we=99;break}if(ne=Ua((S|0)/6|0,8)|0,!ne){we=58;break}e:do if(We){Wt=0,Nt=0;do{if(z=Ut+(Wt<<3)|0,p=z,C=g[p>>2]|0,p=g[p+4>>2]|0,!((C|0)==0&(p|0)==0)){H=me(C|0,p|0,56)|0,It()|0,H=H&7,y=H+1|0,it=p&-117440513,je=me(C|0,p|0,45)|0,It()|0;r:do if(fi(je&127)|0){if(Ct=me(C|0,p|0,52)|0,It()|0,Ct=Ct&15,Ct|0)for(k=1;;){if(je=ke(7,0,(15-k|0)*3|0)|0,!((C&je|0)==0&(it&(It()|0)|0)==0))break r;if(k>>>0>>0)k=k+1|0;else break}p=ke(y|0,0,56)|0,C=p|C,p=It()|0|it,y=z,g[y>>2]=C,g[y+4>>2]=p,y=H+2|0}while(!1);(y|0)==7&&(je=ne+(Nt<<3)|0,g[je>>2]=C,g[je+4>>2]=p&-117440513,Nt=Nt+1|0)}Wt=Wt+1|0}while((Wt|0)!=(S|0));if(We){if(re=((S|0)<0)<<31>>31,Ct=ke(_e|0,0,52)|0,Wt=It()|0,_e>>>0>15)for(p=0,C=0;;){do if(!((ot|0)==0&(L|0)==0)){for(H=me(ot|0,L|0,52)|0,It()|0,H=H&15,k=(H|0)<(_e|0),H=(H|0)==(_e|0),z=k?0:H?ot:0,H=k?0:H?L:0,k=Yo(z|0,H|0,S|0,re|0)|0,It()|0,y=0;;){if((y|0)>(S|0)){we=98;break t}if(je=Ut+(k<<3)|0,it=g[je+4>>2]|0,(it&-117440513|0)==(H|0)&&(g[je>>2]|0)==(z|0)){we=70;break}if(k=(k+1|0)%(S|0)|0,je=Ut+(k<<3)|0,(g[je>>2]|0)==(z|0)&&(g[je+4>>2]|0)==(H|0))break;y=y+1|0}if((we|0)==70&&(we=0,!0&(it&117440512|0)==100663296))break;je=m+(C<<3)|0,g[je>>2]=ot,g[je+4>>2]=L,C=C+1|0}while(!1);if(p=p+1|0,(p|0)>=(S|0)){S=Nt;break e}L=er+(p<<3)|0,ot=g[L>>2]|0,L=g[L+4>>2]|0}for(p=0,C=0;;){do if(!((ot|0)==0&(L|0)==0)){if(H=me(ot|0,L|0,52)|0,It()|0,H=H&15,(H|0)>=(_e|0))if((H|0)!=(_e|0))if(y=ot|Ct,k=L&-15728641|Wt,H>>>0>>0)H=k;else{z=_e;do je=ke(7,0,(14-z|0)*3|0)|0,z=z+1|0,y=je|y,k=It()|0|k;while(z>>>0>>0);H=k}else y=ot,H=L;else y=0,H=0;for(z=Yo(y|0,H|0,S|0,re|0)|0,It()|0,k=0;;){if((k|0)>(S|0)){we=98;break t}if(je=Ut+(z<<3)|0,it=g[je+4>>2]|0,(it&-117440513|0)==(H|0)&&(g[je>>2]|0)==(y|0)){we=93;break}if(z=(z+1|0)%(S|0)|0,je=Ut+(z<<3)|0,(g[je>>2]|0)==(y|0)&&(g[je+4>>2]|0)==(H|0))break;k=k+1|0}if((we|0)==93&&(we=0,!0&(it&117440512|0)==100663296))break;je=m+(C<<3)|0,g[je>>2]=ot,g[je+4>>2]=L,C=C+1|0}while(!1);if(p=p+1|0,(p|0)>=(S|0)){S=Nt;break e}L=er+(p<<3)|0,ot=g[L>>2]|0,L=g[L+4>>2]|0}}else C=0,S=Nt}else C=0,S=0;while(!1);if(Fc(Ut|0,0,$e|0)|0,Va(er|0,ne|0,S<<3|0)|0,Gr(ne),S)m=m+(C<<3)|0;else break}return(we|0)==41?(Gr(er),Gr(Ut),je=-1,je|0):(we|0)==51?(Gr(er),Gr(Ut),je=-2,je|0):(we|0)==58?(Gr(er),Gr(Ut),je=-3,je|0):(we|0)==98?(Gr(ne),Gr(er),Gr(Ut),je=-1,je|0):((we|0)==99&&Va(m|0,er|0,S<<3|0)|0,Gr(er),Gr(Ut),je=0,je|0)}function kn(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,it=0,ot=0;if((m|0)<=0)return C=0,C|0;if((C|0)>=16){for(k=0;;){if(ot=p+(k<<3)|0,!((g[ot>>2]|0)==0&(g[ot+4>>2]|0)==0)){k=14;break}if(k=k+1|0,(k|0)>=(m|0)){L=0,k=16;break}}if((k|0)==14)return((S|0)>0?-2:-1)|0;if((k|0)==16)return L|0}k=0,ot=0;t:for(;;){it=p+(ot<<3)|0,z=it,L=g[z>>2]|0,z=g[z+4>>2]|0;do if(!((L|0)==0&(z|0)==0)){if((k|0)>=(S|0)){L=-1,k=16;break t}if(H=me(L|0,z|0,52)|0,It()|0,H=H&15,(H|0)>(C|0)){L=-2,k=16;break t}if((H|0)==(C|0)){it=y+(k<<3)|0,g[it>>2]=L,g[it+4>>2]=z,k=k+1|0;break}if(L=(Ze(7,C-H|0)|0)+k|0,(L|0)>(S|0)){L=-1,k=16;break t}uo(g[it>>2]|0,g[it+4>>2]|0,C,y+(k<<3)|0),k=L}while(!1);if(ot=ot+1|0,(ot|0)>=(m|0)){L=0,k=16;break}}return(k|0)==16?L|0:0}function wn(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0;if((m|0)<=0)return y=0,y|0;if((y|0)>=16){for(S=0;;){if(L=p+(S<<3)|0,!((g[L>>2]|0)==0&(g[L+4>>2]|0)==0)){S=-1,C=13;break}if(S=S+1|0,(S|0)>=(m|0)){S=0,C=13;break}}if((C|0)==13)return S|0}S=0,L=0;t:for(;;){C=p+(L<<3)|0,k=g[C>>2]|0,C=g[C+4>>2]|0;do if(!((k|0)==0&(C|0)==0)){if(C=me(k|0,C|0,52)|0,It()|0,C=C&15,(C|0)>(y|0)){S=-1,C=13;break t}if((C|0)==(y|0)){S=S+1|0;break}else{S=(Ze(7,y-C|0)|0)+S|0;break}}while(!1);if(L=L+1|0,(L|0)>=(m|0)){C=13;break}}return(C|0)==13?S|0:0}function Sf(p,m){return p=p|0,m=m|0,m=me(p|0,m|0,52)|0,It()|0,m&1|0}function Es(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;if(C=me(p|0,m|0,52)|0,It()|0,C=C&15,!C)return C=0,C|0;for(S=1;;){if(y=me(p|0,m|0,(15-S|0)*3|0)|0,It()|0,y=y&7,y|0){S=5;break}if(S>>>0>>0)S=S+1|0;else{y=0,S=5;break}}return(S|0)==5?y|0:0}function gh(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0;if(H=me(p|0,m|0,52)|0,It()|0,H=H&15,!H)return z=m,H=p,Je(z|0),H|0;for(z=1,y=0;;){k=(15-z|0)*3|0,S=ke(7,0,k|0)|0,C=It()|0,L=me(p|0,m|0,k|0)|0,It()|0,k=ke(Na(L&7)|0,0,k|0)|0,L=It()|0,p=k|p&~S,m=L|m&~C;t:do if(!y)if((k&S|0)==0&(L&C|0)==0)y=0;else if(S=me(p|0,m|0,52)|0,It()|0,S=S&15,!S)y=1;else{y=1;e:for(;;){switch(L=me(p|0,m|0,(15-y|0)*3|0)|0,It()|0,L&7){case 1:break e;case 0:break;default:{y=1;break t}}if(y>>>0>>0)y=y+1|0;else{y=1;break t}}for(y=1;;)if(L=(15-y|0)*3|0,C=me(p|0,m|0,L|0)|0,It()|0,k=ke(7,0,L|0)|0,m=m&~(It()|0),L=ke(Na(C&7)|0,0,L|0)|0,p=p&~k|L,m=m|(It()|0),y>>>0>>0)y=y+1|0;else{y=1;break}}while(!1);if(z>>>0>>0)z=z+1|0;else break}return Je(m|0),p|0}function Wo(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;if(S=me(p|0,m|0,52)|0,It()|0,S=S&15,!S)return y=m,S=p,Je(y|0),S|0;for(y=1;k=(15-y|0)*3|0,L=me(p|0,m|0,k|0)|0,It()|0,C=ke(7,0,k|0)|0,m=m&~(It()|0),k=ke(Na(L&7)|0,0,k|0)|0,p=k|p&~C,m=It()|0|m,y>>>0>>0;)y=y+1|0;return Je(m|0),p|0}function p0(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0;if(H=me(p|0,m|0,52)|0,It()|0,H=H&15,!H)return z=m,H=p,Je(z|0),H|0;for(z=1,y=0;;){k=(15-z|0)*3|0,S=ke(7,0,k|0)|0,C=It()|0,L=me(p|0,m|0,k|0)|0,It()|0,k=ke(co(L&7)|0,0,k|0)|0,L=It()|0,p=k|p&~S,m=L|m&~C;t:do if(!y)if((k&S|0)==0&(L&C|0)==0)y=0;else if(S=me(p|0,m|0,52)|0,It()|0,S=S&15,!S)y=1;else{y=1;e:for(;;){switch(L=me(p|0,m|0,(15-y|0)*3|0)|0,It()|0,L&7){case 1:break e;case 0:break;default:{y=1;break t}}if(y>>>0>>0)y=y+1|0;else{y=1;break t}}for(y=1;;)if(C=(15-y|0)*3|0,k=ke(7,0,C|0)|0,L=m&~(It()|0),m=me(p|0,m|0,C|0)|0,It()|0,m=ke(co(m&7)|0,0,C|0)|0,p=p&~k|m,m=L|(It()|0),y>>>0>>0)y=y+1|0;else{y=1;break}}while(!1);if(z>>>0>>0)z=z+1|0;else break}return Je(m|0),p|0}function Fd(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0;if(S=me(p|0,m|0,52)|0,It()|0,S=S&15,!S)return y=m,S=p,Je(y|0),S|0;for(y=1;L=(15-y|0)*3|0,k=ke(7,0,L|0)|0,C=m&~(It()|0),m=me(p|0,m|0,L|0)|0,It()|0,m=ke(co(m&7)|0,0,L|0)|0,p=m|p&~k,m=It()|0|C,y>>>0>>0;)y=y+1|0;return Je(m|0),p|0}function Tf(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0;if(H=wt,wt=wt+64|0,z=H+40|0,S=H+24|0,C=H+12|0,k=H,ke(m|0,0,52)|0,y=It()|0|134225919,!m)return(g[p+4>>2]|0)>2||(g[p+8>>2]|0)>2||(g[p+12>>2]|0)>2?(L=0,z=0,Je(L|0),wt=H,z|0):(ke(vf(p)|0,0,45)|0,L=It()|0|y,z=-1,Je(L|0),wt=H,z|0);if(g[z>>2]=g[p>>2],g[z+4>>2]=g[p+4>>2],g[z+8>>2]=g[p+8>>2],g[z+12>>2]=g[p+12>>2],L=z+4|0,(m|0)>0)for(p=-1;g[S>>2]=g[L>>2],g[S+4>>2]=g[L+4>>2],g[S+8>>2]=g[L+8>>2],m&1?(Rd(L),g[C>>2]=g[L>>2],g[C+4>>2]=g[L+4>>2],g[C+8>>2]=g[L+8>>2],za(C)):(Al(L),g[C>>2]=g[L>>2],g[C+4>>2]=g[L+4>>2],g[C+8>>2]=g[L+8>>2],hh(C)),eA(S,C,k),js(k),ot=(15-m|0)*3|0,it=ke(7,0,ot|0)|0,y=y&~(It()|0),ot=ke(Fa(k)|0,0,ot|0)|0,p=ot|p&~it,y=It()|0|y,(m|0)>1;)m=m+-1|0;else p=-1;t:do if((g[L>>2]|0)<=2&&(g[z+8>>2]|0)<=2&&(g[z+12>>2]|0)<=2){if(S=vf(z)|0,m=ke(S|0,0,45)|0,m=m|p,p=It()|0|y&-1040385,k=Kp(z)|0,!(fi(S)|0)){if((k|0)<=0)break;for(C=0;;){if(S=me(m|0,p|0,52)|0,It()|0,S=S&15,S)for(y=1;ot=(15-y|0)*3|0,z=me(m|0,p|0,ot|0)|0,It()|0,it=ke(7,0,ot|0)|0,p=p&~(It()|0),ot=ke(Na(z&7)|0,0,ot|0)|0,m=m&~it|ot,p=p|(It()|0),y>>>0>>0;)y=y+1|0;if(C=C+1|0,(C|0)==(k|0))break t}}C=me(m|0,p|0,52)|0,It()|0,C=C&15;e:do if(C){y=1;r:for(;;){switch(ot=me(m|0,p|0,(15-y|0)*3|0)|0,It()|0,ot&7){case 1:break r;case 0:break;default:break e}if(y>>>0>>0)y=y+1|0;else break e}if(ch(S,g[z>>2]|0)|0)for(y=1;z=(15-y|0)*3|0,it=ke(7,0,z|0)|0,ot=p&~(It()|0),p=me(m|0,p|0,z|0)|0,It()|0,p=ke(co(p&7)|0,0,z|0)|0,m=m&~it|p,p=ot|(It()|0),y>>>0>>0;)y=y+1|0;else for(y=1;ot=(15-y|0)*3|0,z=me(m|0,p|0,ot|0)|0,It()|0,it=ke(7,0,ot|0)|0,p=p&~(It()|0),ot=ke(Na(z&7)|0,0,ot|0)|0,m=m&~it|ot,p=p|(It()|0),y>>>0>>0;)y=y+1|0}while(!1);if((k|0)>0){y=0;do m=gh(m,p)|0,p=It()|0,y=y+1|0;while((y|0)!=(k|0))}}else m=0,p=0;while(!1);return it=p,ot=m,Je(it|0),wt=H,ot|0}function Ho(p){return p=p|0,(p|0)%2|0|0}function lA(p,m){p=p|0,m=m|0;var y=0,S=0;return S=wt,wt=wt+16|0,y=S,m>>>0<=15&&(g[p+4>>2]&2146435072|0)!=2146435072&&(g[p+8+4>>2]&2146435072|0)!=2146435072?(a0(p,m,y),m=Tf(y,m)|0,p=It()|0):(p=0,m=0),Je(p|0),wt=S,m|0}function bi(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0;if(C=y+4|0,k=me(p|0,m|0,52)|0,It()|0,k=k&15,L=me(p|0,m|0,45)|0,It()|0,S=(k|0)==0,fi(L&127)|0){if(S)return L=1,L|0;S=1}else{if(S)return L=0,L|0;!(g[C>>2]|0)&&!(g[y+8>>2]|0)?S=(g[y+12>>2]|0)!=0&1:S=1}for(y=1;y&1?za(C):hh(C),L=me(p|0,m|0,(15-y|0)*3|0)|0,It()|0,rA(C,L&7),y>>>0>>0;)y=y+1|0;return S|0}function T(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0;ot=wt,wt=wt+16|0,H=ot,it=me(p|0,m|0,45)|0,It()|0,it=it&127;t:do if(fi(it)|0&&(k=me(p|0,m|0,52)|0,It()|0,k=k&15,(k|0)!=0)){S=1;e:for(;;){switch(z=me(p|0,m|0,(15-S|0)*3|0)|0,It()|0,z&7){case 5:break e;case 0:break;default:{S=m;break t}}if(S>>>0>>0)S=S+1|0;else{S=m;break t}}for(C=1,S=m;m=(15-C|0)*3|0,L=ke(7,0,m|0)|0,z=S&~(It()|0),S=me(p|0,S|0,m|0)|0,It()|0,S=ke(co(S&7)|0,0,m|0)|0,p=p&~L|S,S=z|(It()|0),C>>>0>>0;)C=C+1|0}else S=m;while(!1);if(z=7728+(it*28|0)|0,g[y>>2]=g[z>>2],g[y+4>>2]=g[z+4>>2],g[y+8>>2]=g[z+8>>2],g[y+12>>2]=g[z+12>>2],!(bi(p,S,y)|0)){wt=ot;return}if(L=y+4|0,g[H>>2]=g[L>>2],g[H+4>>2]=g[L+4>>2],g[H+8>>2]=g[L+8>>2],k=me(p|0,S|0,52)|0,It()|0,z=k&15,k&1?(hh(L),k=z+1|0):k=z,!(fi(it)|0))S=0;else{t:do if(!z)S=0;else for(m=1;;){if(C=me(p|0,S|0,(15-m|0)*3|0)|0,It()|0,C=C&7,C|0){S=C;break t}if(m>>>0>>0)m=m+1|0;else{S=0;break}}while(!1);S=(S|0)==4&1}if(!(bf(y,k,S,0)|0))(k|0)!=(z|0)&&(g[L>>2]=g[H>>2],g[L+4>>2]=g[H+4>>2],g[L+8>>2]=g[H+8>>2]);else{if(fi(it)|0)do;while(bf(y,k,0,0)|0);(k|0)!=(z|0)&&Al(L)}wt=ot}function l(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;S=wt,wt=wt+16|0,C=S,T(p,m,C),m=me(p|0,m|0,52)|0,It()|0,y_(C,m&15,y),wt=S}function d(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0;L=wt,wt=wt+16|0,k=L,T(p,m,k),S=me(p|0,m|0,45)|0,It()|0,S=(fi(S&127)|0)==0,C=me(p|0,m|0,52)|0,It()|0,C=C&15;t:do if(!S){if(C|0)for(S=1;;){if(z=ke(7,0,(15-S|0)*3|0)|0,!((z&p|0)==0&((It()|0)&m|0)==0))break t;if(S>>>0>>0)S=S+1|0;else break}l0(k,C,0,5,y),wt=L;return}while(!1);iA(k,C,0,6,y),wt=L}function v(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;if(S=me(p|0,m|0,45)|0,It()|0,!(fi(S&127)|0))return S=2,S|0;if(S=me(p|0,m|0,52)|0,It()|0,S=S&15,!S)return S=5,S|0;for(y=1;;){if(C=ke(7,0,(15-y|0)*3|0)|0,!((C&p|0)==0&((It()|0)&m|0)==0)){y=2,p=6;break}if(y>>>0>>0)y=y+1|0;else{y=5,p=6;break}}return(p|0)==6?y|0:0}function b(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0;Ct=wt,wt=wt+128|0,it=Ct+112|0,k=Ct+96|0,ot=Ct,C=me(p|0,m|0,52)|0,It()|0,z=C&15,g[it>>2]=z,L=me(p|0,m|0,45)|0,It()|0,L=L&127;t:do if(fi(L)|0){if(z|0)for(S=1;;){if(H=ke(7,0,(15-S|0)*3|0)|0,!((H&p|0)==0&((It()|0)&m|0)==0)){C=0;break t}if(S>>>0>>0)S=S+1|0;else break}if(C&1)C=1;else{H=ke(z+1|0,0,52)|0,ot=It()|0|m&-15728641,it=ke(7,0,(14-z|0)*3|0)|0,b((H|p)&~it,ot&~(It()|0),y),wt=Ct;return}}else C=0;while(!1);T(p,m,k),C?(c0(k,it,ot),H=5):(nA(k,it,ot),H=6);t:do if(fi(L)|0)if(!z)S=20;else for(S=1;;){if(L=ke(7,0,(15-S|0)*3|0)|0,!((L&p|0)==0&((It()|0)&m|0)==0)){S=8;break t}if(S>>>0>>0)S=S+1|0;else{S=20;break}}else S=8;while(!1);if(Fc(y|0,-1,S|0)|0,C){C=0;do{for(k=ot+(C<<4)|0,u0(k,g[it>>2]|0)|0,k=g[k>>2]|0,S=0;L=y+(S<<2)|0,z=g[L>>2]|0,!((z|0)==-1|(z|0)==(k|0));)S=S+1|0;g[L>>2]=k,C=C+1|0}while((C|0)!=(H|0))}else{C=0;do{for(k=ot+(C<<4)|0,bf(k,g[it>>2]|0,0,1)|0,k=g[k>>2]|0,S=0;L=y+(S<<2)|0,z=g[L>>2]|0,!((z|0)==-1|(z|0)==(k|0));)S=S+1|0;g[L>>2]=k,C=C+1|0}while((C|0)!=(H|0))}wt=Ct}function M(){return 12}function O(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0;if(ke(p|0,0,52)|0,z=It()|0|134225919,(p|0)<1){S=0,y=0;do fi(S)|0&&(ke(S|0,0,45)|0,L=z|(It()|0),p=m+(y<<3)|0,g[p>>2]=-1,g[p+4>>2]=L,y=y+1|0),S=S+1|0;while((S|0)!=122);return}L=0,y=0;do{if(fi(L)|0){for(ke(L|0,0,45)|0,S=1,C=-1,k=z|(It()|0);H=ke(7,0,(15-S|0)*3|0)|0,C=C&~H,k=k&~(It()|0),(S|0)!=(p|0);)S=S+1|0;H=m+(y<<3)|0,g[H>>2]=C,g[H+4>>2]=k,y=y+1|0}L=L+1|0}while((L|0)!=122)}function B(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,it=0;if(z=wt,wt=wt+64|0,L=z,(p|0)==(y|0)&(m|0)==(S|0)|(!1|(m&2013265920|0)!=134217728|(!1|(S&2013265920|0)!=134217728))||(C=me(p|0,m|0,52)|0,It()|0,C=C&15,k=me(y|0,S|0,52)|0,It()|0,(C|0)!=(k&15|0)))return L=0,wt=z,L|0;if(k=C+-1|0,C>>>0>1&&(it=Bd(p,m,k)|0,H=It()|0,k=Bd(y,S,k)|0,(it|0)==(k|0)&(H|0)==(It()|0))&&(k=(C^15)*3|0,C=me(p|0,m|0,k|0)|0,It()|0,C=C&7,k=me(y|0,S|0,k|0)|0,It()|0,k=k&7,(C|0)==0|(k|0)==0||(g[21136+(C<<2)>>2]|0)==(k|0)||(g[21168+(C<<2)>>2]|0)==(k|0)))return it=1,wt=z,it|0;C=L,k=C+56|0;do g[C>>2]=0,C=C+4|0;while((C|0)<(k|0));return f_(p,m,1,L),it=L,!((g[it>>2]|0)==(y|0)&&(g[it+4>>2]|0)==(S|0))&&(it=L+8|0,!((g[it>>2]|0)==(y|0)&&(g[it+4>>2]|0)==(S|0)))&&(it=L+16|0,!((g[it>>2]|0)==(y|0)&&(g[it+4>>2]|0)==(S|0)))&&(it=L+24|0,!((g[it>>2]|0)==(y|0)&&(g[it+4>>2]|0)==(S|0)))&&(it=L+32|0,!((g[it>>2]|0)==(y|0)&&(g[it+4>>2]|0)==(S|0)))&&(it=L+40|0,!((g[it>>2]|0)==(y|0)&&(g[it+4>>2]|0)==(S|0)))?(C=L+48|0,C=((g[C>>2]|0)==(y|0)?(g[C+4>>2]|0)==(S|0):0)&1):C=1,it=C,wt=z,it|0}function U(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,it=0,ot=0;if(it=wt,wt=wt+16|0,L=it,!(B(p,m,y,S)|0))return z=0,H=0,Je(z|0),wt=it,H|0;for(z=m&-2130706433,C=(ji(p,m)|0)==0,C=C?1:2;g[L>>2]=0,ot=Wn(p,m,C,L)|0,k=C+1|0,!((ot|0)==(y|0)&(It()|0)==(S|0));)if(k>>>0<7)C=k;else{C=0,p=0,H=6;break}return(H|0)==6?(Je(C|0),wt=it,p|0):(ot=ke(C|0,0,56)|0,H=z|(It()|0)|268435456,ot=p|ot,Je(H|0),wt=it,ot|0)}function W(p,m){p=p|0,m=m|0;var y=0;return y=!0&(m&2013265920|0)==268435456,Je((y?m&-2130706433|134217728:0)|0),(y?p:0)|0}function Z(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;return S=wt,wt=wt+16|0,y=S,!0&(m&2013265920|0)==268435456?(C=me(p|0,m|0,56)|0,It()|0,g[y>>2]=0,y=Wn(p,m&-2130706433|134217728,C&7,y)|0,m=It()|0,Je(m|0),wt=S,y|0):(m=0,y=0,Je(m|0),wt=S,y|0)}function $(p,m){p=p|0,m=m|0;var y=0;if(!(!0&(m&2013265920|0)==268435456))return y=0,y|0;switch(y=me(p|0,m|0,56)|0,It()|0,y&7){case 0:case 7:return y=0,y|0;default:}return y=m&-2130706433|134217728,!0&(m&117440512|0)==16777216&(ji(p,y)|0)!=0?(y=0,y|0):(y=aA(p,y)|0,y|0)}function st(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0;k=wt,wt=wt+16|0,S=k,L=!0&(m&2013265920|0)==268435456,C=m&-2130706433|134217728,z=y,g[z>>2]=L?p:0,g[z+4>>2]=L?C:0,L?(m=me(p|0,m|0,56)|0,It()|0,g[S>>2]=0,p=Wn(p,C,m&7,S)|0,m=It()|0):(p=0,m=0),z=y+8|0,g[z>>2]=p,g[z+4>>2]=m,wt=k}function At(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;C=(ji(p,m)|0)==0,m=m&-2130706433,S=y,g[S>>2]=C?p:0,g[S+4>>2]=C?m|285212672:0,S=y+8|0,g[S>>2]=p,g[S+4>>2]=m|301989888,S=y+16|0,g[S>>2]=p,g[S+4>>2]=m|318767104,S=y+24|0,g[S>>2]=p,g[S+4>>2]=m|335544320,S=y+32|0,g[S>>2]=p,g[S+4>>2]=m|352321536,y=y+40|0,g[y>>2]=p,g[y+4>>2]=m|369098752}function pt(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0;if(L=wt,wt=wt+16|0,k=L,S=me(p|0,m|0,56)|0,It()|0,z=!0&(m&2013265920|0)==268435456,C=z?p:0,p=z?m&-2130706433|134217728:0,m=yu(C,p,S&7)|0,(m|0)==-1){g[y>>2]=0,wt=L;return}T(C,p,k),S=me(C|0,p|0,52)|0,It()|0,S=S&15,ji(C,p)|0?l0(k,S,m,2,y):iA(k,S,m,2,y),wt=L}function yt(p){p=p|0;var m=0,y=0,S=0;return m=Ua(1,12)|0,m||Mi(22691,22646,49,22704),y=p+4|0,S=g[y>>2]|0,S|0?(S=S+8|0,g[S>>2]=m,g[y>>2]=m,m|0):(g[p>>2]|0&&Mi(22721,22646,61,22744),S=p,g[S>>2]=m,g[y>>2]=m,m|0)}function dt(p,m){p=p|0,m=m|0;var y=0,S=0;return S=ho(24)|0,S||Mi(22758,22646,78,22772),g[S>>2]=g[m>>2],g[S+4>>2]=g[m+4>>2],g[S+8>>2]=g[m+8>>2],g[S+12>>2]=g[m+12>>2],g[S+16>>2]=0,m=p+4|0,y=g[m>>2]|0,y|0?(g[y+16>>2]=S,g[m>>2]=S,S|0):(g[p>>2]|0&&Mi(22787,22646,82,22772),g[p>>2]=S,g[m>>2]=S,S|0)}function Ft(p){p=p|0;var m=0,y=0,S=0,C=0;if(p)for(S=1;;){if(m=g[p>>2]|0,m|0)do{if(y=g[m>>2]|0,y|0)do C=y,y=g[y+16>>2]|0,Gr(C);while(y|0);C=m,m=g[m+8>>2]|0,Gr(C)}while(m|0);if(m=p,p=g[p+8>>2]|0,S||Gr(m),p)S=0;else break}}function Ht(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0,we=0,je=0,Zr=0,qi=0,Ei=0,hn=0,Pi=0,Sn=0,yn=0,Or=0;if(C=p+8|0,g[C>>2]|0)return Or=1,Or|0;if(S=g[p>>2]|0,!S)return Or=0,Or|0;m=S,y=0;do y=y+1|0,m=g[m+8>>2]|0;while(m|0);if(y>>>0<2)return Or=0,Or|0;Sn=ho(y<<2)|0,Sn||Mi(22807,22646,317,22826),Pi=ho(y<<5)|0,Pi||Mi(22848,22646,321,22826),g[p>>2]=0,er=p+4|0,g[er>>2]=0,g[C>>2]=0,y=0,hn=0,$e=0,Ct=0;t:for(;;){if(ot=g[S>>2]|0,ot){k=0,L=ot;do{if(H=+Tt[L+8>>3],m=L,L=g[L+16>>2]|0,it=(L|0)==0,C=it?ot:L,z=+Tt[C+8>>3],+li(+(H-z))>3.141592653589793){Or=14;break}k=k+(z-H)*(+Tt[m>>3]+ +Tt[C>>3])}while(!it);if((Or|0)==14){Or=0,k=0,m=ot;do Ut=+Tt[m+8>>3],Ei=m+16|0,qi=g[Ei>>2]|0,qi=qi|0?qi:ot,_e=+Tt[qi+8>>3],k=k+(+Tt[m>>3]+ +Tt[qi>>3])*((_e<0?_e+6.283185307179586:_e)-(Ut<0?Ut+6.283185307179586:Ut)),m=g[(m|0?Ei:S)>>2]|0;while(m|0)}k>0?(g[Sn+(hn<<2)>>2]=S,hn=hn+1|0,C=$e,m=Ct):Or=19}else Or=19;if((Or|0)==19){Or=0;do if(y){if(m=y+8|0,g[m>>2]|0){Or=21;break t}if(y=Ua(1,12)|0,!y){Or=23;break t}g[m>>2]=y,C=y+4|0,L=y,m=Ct}else if(Ct){C=er,L=Ct+8|0,m=S,y=p;break}else if(g[p>>2]|0){Or=27;break t}else{C=er,L=p,m=S,y=p;break}while(!1);if(g[L>>2]=S,g[C>>2]=S,L=Pi+($e<<5)|0,it=g[S>>2]|0,it){for(ot=Pi+($e<<5)+8|0,Tt[ot>>3]=17976931348623157e292,Ct=Pi+($e<<5)+24|0,Tt[Ct>>3]=17976931348623157e292,Tt[L>>3]=-17976931348623157e292,Nt=Pi+($e<<5)+16|0,Tt[Nt>>3]=-17976931348623157e292,We=17976931348623157e292,te=-17976931348623157e292,C=0,Wt=it,H=17976931348623157e292,ne=17976931348623157e292,Le=-17976931348623157e292,z=-17976931348623157e292;k=+Tt[Wt>>3],Ut=+Tt[Wt+8>>3],Wt=g[Wt+16>>2]|0,re=(Wt|0)==0,_e=+Tt[(re?it:Wt)+8>>3],k>3]=k,H=k),Ut>3]=Ut,ne=Ut),k>Le?Tt[L>>3]=k:k=Le,Ut>z&&(Tt[Nt>>3]=Ut,z=Ut),We=Ut>0&Utte?Ut:te,C=C|+li(+(Ut-_e))>3.141592653589793,!re;)Le=k;C&&(Tt[Nt>>3]=te,Tt[Ct>>3]=We)}else g[L>>2]=0,g[L+4>>2]=0,g[L+8>>2]=0,g[L+12>>2]=0,g[L+16>>2]=0,g[L+20>>2]=0,g[L+24>>2]=0,g[L+28>>2]=0;C=$e+1|0}if(Ei=S+8|0,S=g[Ei>>2]|0,g[Ei>>2]=0,S)$e=C,Ct=m;else{Or=45;break}}if((Or|0)==21)Mi(22624,22646,35,22658);else if((Or|0)==23)Mi(22678,22646,37,22658);else if((Or|0)==27)Mi(22721,22646,61,22744);else if((Or|0)==45){t:do if((hn|0)>0){for(Ei=(C|0)==0,Zr=C<<2,qi=(p|0)==0,je=0,m=0;;){if(we=g[Sn+(je<<2)>>2]|0,Ei)Or=73;else{if($e=ho(Zr)|0,!$e){Or=50;break}if(er=ho(Zr)|0,!er){Or=52;break}e:do if(qi)y=0;else{for(C=0,y=0,L=p;S=Pi+(C<<5)|0,St(g[L>>2]|0,S,g[we>>2]|0)|0?(g[$e+(y<<2)>>2]=L,g[er+(y<<2)>>2]=S,re=y+1|0):re=y,L=g[L+8>>2]|0,L;)C=C+1|0,y=re;if((re|0)>0)if(S=g[$e>>2]|0,(re|0)==1)y=S;else for(Nt=0,Wt=-1,y=S,Ct=S;;){for(it=g[Ct>>2]|0,S=0,L=0;C=g[g[$e+(L<<2)>>2]>>2]|0,(C|0)==(it|0)?ot=S:ot=S+((St(C,g[er+(L<<2)>>2]|0,g[it>>2]|0)|0)&1)|0,L=L+1|0,(L|0)!=(re|0);)S=ot;if(C=(ot|0)>(Wt|0),y=C?Ct:y,S=Nt+1|0,(S|0)==(re|0))break e;Nt=S,Wt=C?ot:Wt,Ct=g[$e+(S<<2)>>2]|0}else y=0}while(!1);if(Gr($e),Gr(er),y){if(C=y+4|0,S=g[C>>2]|0,S)y=S+8|0;else if(g[y>>2]|0){Or=70;break}g[y>>2]=we,g[C>>2]=we}else Or=73}if((Or|0)==73){if(Or=0,m=g[we>>2]|0,m|0)do er=m,m=g[m+16>>2]|0,Gr(er);while(m|0);Gr(we),m=2}if(je=je+1|0,(je|0)>=(hn|0)){yn=m;break t}}(Or|0)==50?Mi(22863,22646,249,22882):(Or|0)==52?Mi(22901,22646,252,22882):(Or|0)==70&&Mi(22721,22646,61,22744)}else yn=0;while(!1);return Gr(Sn),Gr(Pi),Or=yn,Or|0}return 0}function St(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0;if(!(pl(m,y)|0)||(m=n0(m)|0,it=+Tt[y>>3],S=+Tt[y+8>>3],S=m&S<0?S+6.283185307179586:S,p=g[p>>2]|0,!p))return p=0,p|0;if(m){m=0,y=p;t:for(;;){for(;L=+Tt[y>>3],H=+Tt[y+8>>3],y=y+16|0,ot=g[y>>2]|0,ot=ot|0?ot:p,k=+Tt[ot>>3],C=+Tt[ot+8>>3],L>k?(z=L,L=H):(z=k,k=L,L=C,C=H),!!(itz);)if(y=g[y>>2]|0,!y){y=22;break t}if(H=C<0?C+6.283185307179586:C,L=L<0?L+6.283185307179586:L,S=L==S|H==S?S+-2220446049250313e-31:S,H=H+(it-k)/(z-k)*(L-H),(H<0?H+6.283185307179586:H)>S&&(m=m^1),y=g[y>>2]|0,!y){y=22;break}}if((y|0)==22)return m|0}else{m=0,y=p;t:for(;;){for(;L=+Tt[y>>3],H=+Tt[y+8>>3],y=y+16|0,ot=g[y>>2]|0,ot=ot|0?ot:p,k=+Tt[ot>>3],C=+Tt[ot+8>>3],L>k?(z=L,L=H):(z=k,k=L,L=C,C=H),!!(itz);)if(y=g[y>>2]|0,!y){y=22;break t}if(S=L==S|C==S?S+-2220446049250313e-31:S,C+(it-k)/(z-k)*(L-C)>S&&(m=m^1),y=g[y>>2]|0,!y){y=22;break}}if((y|0)==22)return m|0}return 0}function Bt(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0;if(te=wt,wt=wt+32|0,We=te+16|0,Le=te,k=me(p|0,m|0,52)|0,It()|0,k=k&15,Wt=me(y|0,S|0,52)|0,It()|0,(k|0)!=(Wt&15|0))return We=1,wt=te,We|0;if(it=me(p|0,m|0,45)|0,It()|0,it=it&127,ot=me(y|0,S|0,45)|0,It()|0,ot=ot&127,Wt=(it|0)!=(ot|0),Wt){if(z=tA(it,ot)|0,(z|0)==7)return We=2,wt=te,We|0;H=tA(ot,it)|0,(H|0)==7?Mi(22925,22949,151,22959):(re=z,L=H)}else re=0,L=0;Ct=fi(it)|0,Nt=fi(ot)|0,g[We>>2]=0,g[We+4>>2]=0,g[We+8>>2]=0,g[We+12>>2]=0;do if(re){if(ot=g[4304+(it*28|0)+(re<<2)>>2]|0,z=(ot|0)>0,Nt)if(z){it=0,H=y,z=S;do H=p0(H,z)|0,z=It()|0,L=co(L)|0,(L|0)==1&&(L=co(1)|0),it=it+1|0;while((it|0)!=(ot|0));ot=L,it=H,H=z}else ot=L,it=y,H=S;else if(z){it=0,H=y,z=S;do H=Fd(H,z)|0,z=It()|0,L=co(L)|0,it=it+1|0;while((it|0)!=(ot|0));ot=L,it=H,H=z}else ot=L,it=y,H=S;if(bi(it,H,We)|0,Wt||Mi(22972,22949,181,22959),z=(Ct|0)!=0,L=(Nt|0)!=0,z&L&&Mi(22999,22949,182,22959),z){if(L=Es(p,m)|0,br[22032+(L*7|0)+re>>0]|0){k=3;break}H=g[21200+(L*28|0)+(re<<2)>>2]|0,it=H,ne=26}else if(L){if(L=Es(it,H)|0,br[22032+(L*7|0)+ot>>0]|0){k=4;break}it=0,H=g[21200+(ot*28|0)+(L<<2)>>2]|0,ne=26}else L=0;if((ne|0)==26)if((H|0)<=-1&&Mi(23030,22949,212,22959),(it|0)<=-1&&Mi(23053,22949,213,22959),(H|0)>0){z=We+4|0,L=0;do fh(z),L=L+1|0;while((L|0)!=(H|0));L=it}else L=it;if(g[Le>>2]=0,g[Le+4>>2]=0,g[Le+8>>2]=0,rA(Le,re),k|0)for(;Ho(k)|0?za(Le):hh(Le),(k|0)>1;)k=k+-1|0;if((L|0)>0){k=0;do fh(Le),k=k+1|0;while((k|0)!=(L|0))}ne=We+4|0,Ln(ne,Le,ne),js(ne),ne=50}else if(bi(y,S,We)|0,(Ct|0)!=0&(Nt|0)!=0)if((ot|0)!=(it|0)&&Mi(23077,22949,243,22959),L=Es(p,m)|0,k=Es(y,S)|0,br[22032+(L*7|0)+k>>0]|0)k=5;else if(L=g[21200+(L*28|0)+(k<<2)>>2]|0,(L|0)>0){z=We+4|0,k=0;do fh(z),k=k+1|0;while((k|0)!=(L|0));ne=50}else ne=50;else ne=50;while(!1);return(ne|0)==50&&(k=We+4|0,g[C>>2]=g[k>>2],g[C+4>>2]=g[k+4>>2],g[C+8>>2]=g[k+8>>2],k=0),We=k,wt=te,We|0}function Qt(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0;if(re=wt,wt=wt+48|0,L=re+36|0,z=re+24|0,H=re+12|0,it=re,k=me(p|0,m|0,52)|0,It()|0,k=k&15,Nt=me(p|0,m|0,45)|0,It()|0,Nt=Nt&127,ot=fi(Nt)|0,ke(k|0,0,52)|0,Le=It()|0|134225919,ne=S,g[ne>>2]=-1,g[ne+4>>2]=Le,!k)return(g[y>>2]|0)>1||(g[y+4>>2]|0)>1||(g[y+8>>2]|0)>1||(C=Jp(Nt,Fa(y)|0)|0,(C|0)==127)?(Le=1,wt=re,Le|0):(Wt=ke(C|0,0,45)|0,ne=It()|0,Nt=S,ne=g[Nt+4>>2]&-1040385|ne,Le=S,g[Le>>2]=g[Nt>>2]|Wt,g[Le+4>>2]=ne,Le=0,wt=re,Le|0);for(g[L>>2]=g[y>>2],g[L+4>>2]=g[y+4>>2],g[L+8>>2]=g[y+8>>2];g[z>>2]=g[L>>2],g[z+4>>2]=g[L+4>>2],g[z+8>>2]=g[L+8>>2],Ho(k)|0?(Rd(L),g[H>>2]=g[L>>2],g[H+4>>2]=g[L+4>>2],g[H+8>>2]=g[L+8>>2],za(H)):(Al(L),g[H>>2]=g[L>>2],g[H+4>>2]=g[L+4>>2],g[H+8>>2]=g[L+8>>2],hh(H)),eA(z,H,it),js(it),ne=S,We=g[ne>>2]|0,ne=g[ne+4>>2]|0,te=(15-k|0)*3|0,y=ke(7,0,te|0)|0,ne=ne&~(It()|0),te=ke(Fa(it)|0,0,te|0)|0,ne=It()|0|ne,Le=S,g[Le>>2]=te|We&~y,g[Le+4>>2]=ne,(k|0)>1;)k=k+-1|0;t:do if((g[L>>2]|0)<=1&&(g[L+4>>2]|0)<=1&&(g[L+8>>2]|0)<=1){k=Fa(L)|0,z=Jp(Nt,k)|0,(z|0)==127?it=0:it=fi(z)|0;e:do if(k){if(ot){if(L=21408+((Es(p,m)|0)*28|0)+(k<<2)|0,L=g[L>>2]|0,(L|0)>0){y=0;do k=Na(k)|0,y=y+1|0;while((y|0)!=(L|0))}if((k|0)==1){C=3;break t}y=Jp(Nt,k)|0,(y|0)==127&&Mi(23104,22949,376,23134),fi(y)|0?Mi(23147,22949,377,23134):(Wt=L,Ct=k,C=y)}else Wt=0,Ct=k,C=z;if(H=g[4304+(Nt*28|0)+(Ct<<2)>>2]|0,(H|0)<=-1&&Mi(23178,22949,384,23134),!it){if((Wt|0)<=-1&&Mi(23030,22949,417,23134),Wt|0){L=S,k=0,y=g[L>>2]|0,L=g[L+4>>2]|0;do y=Wo(y,L)|0,L=It()|0,te=S,g[te>>2]=y,g[te+4>>2]=L,k=k+1|0;while((k|0)<(Wt|0))}if((H|0)<=0){k=54;break}for(L=S,k=0,y=g[L>>2]|0,L=g[L+4>>2]|0;;)if(y=Wo(y,L)|0,L=It()|0,te=S,g[te>>2]=y,g[te+4>>2]=L,k=k+1|0,(k|0)==(H|0)){k=54;break e}}if(z=tA(C,Nt)|0,(z|0)==7&&Mi(22925,22949,393,23134),k=S,y=g[k>>2]|0,k=g[k+4>>2]|0,(H|0)>0){L=0;do y=Wo(y,k)|0,k=It()|0,te=S,g[te>>2]=y,g[te+4>>2]=k,L=L+1|0;while((L|0)!=(H|0))}if(y=Es(y,k)|0,te=mu(C)|0,y=g[(te?21824:21616)+(z*28|0)+(y<<2)>>2]|0,(y|0)<=-1&&Mi(23030,22949,412,23134),!y)k=54;else{z=S,k=0,L=g[z>>2]|0,z=g[z+4>>2]|0;do L=gh(L,z)|0,z=It()|0,te=S,g[te>>2]=L,g[te+4>>2]=z,k=k+1|0;while((k|0)<(y|0));k=54}}else if((ot|0)!=0&(it|0)!=0)if(te=Es(p,m)|0,k=S,k=21408+(te*28|0)+((Es(g[k>>2]|0,g[k+4>>2]|0)|0)<<2)|0,k=g[k>>2]|0,(k|0)<=-1&&Mi(23201,22949,433,23134),!k)C=z,k=55;else{L=S,C=0,y=g[L>>2]|0,L=g[L+4>>2]|0;do y=Wo(y,L)|0,L=It()|0,te=S,g[te>>2]=y,g[te+4>>2]=L,C=C+1|0;while((C|0)<(k|0));C=z,k=54}else C=z,k=54;while(!1);if((k|0)==54&&it&&(k=55),(k|0)==55&&(te=S,(Es(g[te>>2]|0,g[te+4>>2]|0)|0)==1)){C=4;break}te=S,Le=g[te>>2]|0,te=g[te+4>>2]&-1040385,We=ke(C|0,0,45)|0,te=te|(It()|0),C=S,g[C>>2]=Le|We,g[C+4>>2]=te,C=0}else C=2;while(!1);return te=C,wt=re,te|0}function $t(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0;return L=wt,wt=wt+16|0,k=L,p=Bt(p,m,y,S,k)|0,p||(xf(k,C),p=0),wt=L,p|0}function oe(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0;return C=wt,wt=wt+16|0,k=C,__(y,k),S=Qt(p,m,k,S)|0,wt=C,S|0}function pe(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0;return L=wt,wt=wt+32|0,C=L+12|0,k=L,!(Bt(p,m,p,m,C)|0)&&!(Bt(p,m,y,S,k)|0)?p=Hl(C,k)|0:p=-1,wt=L,p|0}function he(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0,L=0;return L=wt,wt=wt+32|0,C=L+12|0,k=L,!(Bt(p,m,p,m,C)|0)&&!(Bt(p,m,y,S,k)|0)?p=Hl(C,k)|0:p=-1,wt=L,(p>>>31^1)+p|0}function be(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0;if($e=wt,wt=wt+48|0,k=$e+24|0,L=$e+12|0,Ut=$e,!(Bt(p,m,p,m,k)|0)&&!(Bt(p,m,y,S,L)|0)){if(_e=Hl(k,L)|0,(_e|0)<0)return Ut=_e,wt=$e,Ut|0;for(g[k>>2]=0,g[k+4>>2]=0,g[k+8>>2]=0,g[L>>2]=0,g[L+4>>2]=0,g[L+8>>2]=0,Bt(p,m,p,m,k)|0,Bt(p,m,y,S,L)|0,Oe(k),Oe(L),_e?(ot=g[k>>2]|0,Wt=+(_e|0),Le=k+4|0,Ct=g[Le>>2]|0,We=k+8|0,Nt=g[We>>2]|0,te=k,y=ot,S=Ct,k=Nt,re=+((g[L>>2]|0)-ot|0)/Wt,ne=+((g[L+4>>2]|0)-Ct|0)/Wt,Wt=+((g[L+8>>2]|0)-Nt|0)/Wt):(S=k+4|0,Nt=k+8|0,Le=S,We=Nt,te=k,y=g[k>>2]|0,S=g[S>>2]|0,k=g[Nt>>2]|0,re=0,ne=0,Wt=0),g[Ut>>2]=y,Nt=Ut+4|0,g[Nt>>2]=S,Ct=Ut+8|0,g[Ct>>2]=k,ot=0;;){H=+(ot|0),er=re*H+ +(y|0),z=ne*H+ +(g[Le>>2]|0),H=Wt*H+ +(g[We>>2]|0),S=~~+Mf(+er),L=~~+Mf(+z),y=~~+Mf(+H),er=+li(+(+(S|0)-er)),z=+li(+(+(L|0)-z)),H=+li(+(+(y|0)-H));do if(er>z&er>H)S=0-(L+y)|0,k=L;else if(it=0-S|0,z>H){k=it-y|0;break}else{k=L,y=it-L|0;break}while(!1);if(g[Ut>>2]=S,g[Nt>>2]=k,g[Ct>>2]=y,o0(Ut),Qt(p,m,Ut,C+(ot<<3)|0)|0,(ot|0)==(_e|0))break;ot=ot+1|0,y=g[te>>2]|0}return Ut=0,wt=$e,Ut|0}return Ut=-1,wt=$e,Ut|0}function Ze(p,m){p=p|0,m=m|0;var y=0;if(!m)return y=1,y|0;y=p,p=1;do p=Oc(m&1|0?y:1,p)|0,m=m>>1,y=Oc(y,y)|0;while(m|0);return p|0}function Kr(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0;if(!(pl(m,y)|0)||(m=n0(m)|0,Nt=+Tt[y>>3],S=+Tt[y+8>>3],S=m&S<0?S+6.283185307179586:S,Ct=g[p>>2]|0,(Ct|0)<=0))return Ct=0,Ct|0;if(ot=g[p+4>>2]|0,m){m=0,y=-1,p=0;t:for(;;){for(it=p;L=+Tt[ot+(it<<4)>>3],H=+Tt[ot+(it<<4)+8>>3],p=(y+2|0)%(Ct|0)|0,k=+Tt[ot+(p<<4)>>3],C=+Tt[ot+(p<<4)+8>>3],L>k?(z=L,L=H):(z=k,k=L,L=C,C=H),!!(Ntz);)if(y=it+1|0,(y|0)<(Ct|0))p=it,it=y,y=p;else{y=22;break t}if(H=C<0?C+6.283185307179586:C,L=L<0?L+6.283185307179586:L,S=L==S|H==S?S+-2220446049250313e-31:S,H=H+(Nt-k)/(z-k)*(L-H),(H<0?H+6.283185307179586:H)>S&&(m=m^1),p=it+1|0,(p|0)>=(Ct|0)){y=22;break}else y=it}if((y|0)==22)return m|0}else{m=0,y=-1,p=0;t:for(;;){for(it=p;L=+Tt[ot+(it<<4)>>3],H=+Tt[ot+(it<<4)+8>>3],p=(y+2|0)%(Ct|0)|0,k=+Tt[ot+(p<<4)>>3],C=+Tt[ot+(p<<4)+8>>3],L>k?(z=L,L=H):(z=k,k=L,L=C,C=H),!!(Ntz);)if(y=it+1|0,(y|0)<(Ct|0))p=it,it=y,y=p;else{y=22;break t}if(S=L==S|C==S?S+-2220446049250313e-31:S,C+(Nt-k)/(z-k)*(L-C)>S&&(m=m^1),p=it+1|0,(p|0)>=(Ct|0)){y=22;break}else y=it}if((y|0)==22)return m|0}return 0}function Ee(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0;if(re=g[p>>2]|0,!re){g[m>>2]=0,g[m+4>>2]=0,g[m+8>>2]=0,g[m+12>>2]=0,g[m+16>>2]=0,g[m+20>>2]=0,g[m+24>>2]=0,g[m+28>>2]=0;return}if(ne=m+8|0,Tt[ne>>3]=17976931348623157e292,Le=m+24|0,Tt[Le>>3]=17976931348623157e292,Tt[m>>3]=-17976931348623157e292,We=m+16|0,Tt[We>>3]=-17976931348623157e292,!((re|0)<=0)){for(Nt=g[p+4>>2]|0,it=17976931348623157e292,ot=-17976931348623157e292,Ct=0,p=-1,k=17976931348623157e292,L=17976931348623157e292,H=-17976931348623157e292,S=-17976931348623157e292,Wt=0;y=+Tt[Nt+(Wt<<4)>>3],z=+Tt[Nt+(Wt<<4)+8>>3],p=p+2|0,C=+Tt[Nt+(((p|0)==(re|0)?0:p)<<4)+8>>3],y>3]=y,k=y),z>3]=z,L=z),y>H?Tt[m>>3]=y:y=H,z>S&&(Tt[We>>3]=z,S=z),it=z>0&zot?z:ot,Ct=Ct|+li(+(z-C))>3.141592653589793,p=Wt+1|0,(p|0)!=(re|0);)te=Wt,H=y,Wt=p,p=te;Ct&&(Tt[We>>3]=ot,Tt[Le>>3]=it)}}function pr(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0,er=0,we=0;if(re=g[p>>2]|0,re){if(ne=m+8|0,Tt[ne>>3]=17976931348623157e292,Le=m+24|0,Tt[Le>>3]=17976931348623157e292,Tt[m>>3]=-17976931348623157e292,We=m+16|0,Tt[We>>3]=-17976931348623157e292,(re|0)>0){for(C=g[p+4>>2]|0,Nt=17976931348623157e292,Wt=-17976931348623157e292,S=0,y=-1,H=17976931348623157e292,it=17976931348623157e292,Ct=-17976931348623157e292,L=-17976931348623157e292,te=0;k=+Tt[C+(te<<4)>>3],ot=+Tt[C+(te<<4)+8>>3],er=y+2|0,z=+Tt[C+(((er|0)==(re|0)?0:er)<<4)+8>>3],k>3]=k,H=k),ot>3]=ot,it=ot),k>Ct?Tt[m>>3]=k:k=Ct,ot>L&&(Tt[We>>3]=ot,L=ot),Nt=ot>0&otWt?ot:Wt,S=S|+li(+(ot-z))>3.141592653589793,y=te+1|0,(y|0)!=(re|0);)er=te,Ct=k,te=y,y=er;S&&(Tt[We>>3]=Wt,Tt[Le>>3]=Nt)}}else g[m>>2]=0,g[m+4>>2]=0,g[m+8>>2]=0,g[m+12>>2]=0,g[m+16>>2]=0,g[m+20>>2]=0,g[m+24>>2]=0,g[m+28>>2]=0;if(er=p+8|0,y=g[er>>2]|0,!((y|0)<=0)){$e=p+12|0,Ut=0;do if(C=g[$e>>2]|0,S=Ut,Ut=Ut+1|0,Le=m+(Ut<<5)|0,We=g[C+(S<<3)>>2]|0,We){if(te=m+(Ut<<5)+8|0,Tt[te>>3]=17976931348623157e292,p=m+(Ut<<5)+24|0,Tt[p>>3]=17976931348623157e292,Tt[Le>>3]=-17976931348623157e292,_e=m+(Ut<<5)+16|0,Tt[_e>>3]=-17976931348623157e292,(We|0)>0){for(re=g[C+(S<<3)+4>>2]|0,Nt=17976931348623157e292,Wt=-17976931348623157e292,C=0,S=-1,ne=0,H=17976931348623157e292,it=17976931348623157e292,ot=-17976931348623157e292,L=-17976931348623157e292;k=+Tt[re+(ne<<4)>>3],Ct=+Tt[re+(ne<<4)+8>>3],S=S+2|0,z=+Tt[re+(((S|0)==(We|0)?0:S)<<4)+8>>3],k>3]=k,H=k),Ct>3]=Ct,it=Ct),k>ot?Tt[Le>>3]=k:k=ot,Ct>L&&(Tt[_e>>3]=Ct,L=Ct),Nt=Ct>0&CtWt?Ct:Wt,C=C|+li(+(Ct-z))>3.141592653589793,S=ne+1|0,(S|0)!=(We|0);)we=ne,ne=S,ot=k,S=we;C&&(Tt[_e>>3]=Wt,Tt[p>>3]=Nt)}}else g[Le>>2]=0,g[Le+4>>2]=0,g[Le+8>>2]=0,g[Le+12>>2]=0,g[Le+16>>2]=0,g[Le+20>>2]=0,g[Le+24>>2]=0,g[Le+28>>2]=0,y=g[er>>2]|0;while((Ut|0)<(y|0))}}function tr(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0;if(!(Kr(p,m,y)|0))return C=0,C|0;if(C=p+8|0,(g[C>>2]|0)<=0)return C=1,C|0;for(S=p+12|0,p=0;;){if(k=p,p=p+1|0,Kr((g[S>>2]|0)+(k<<3)|0,m+(p<<5)|0,y)|0){p=0,S=6;break}if((p|0)>=(g[C>>2]|0)){p=1,S=6;break}}return(S|0)==6?p|0:0}function Gi(){return 8}function Jr(){return 16}function Vr(){return 168}function ei(){return 8}function On(){return 16}function tn(){return 12}function Gs(){return 8}function hs(p){p=p|0;var m=0,y=0;return y=+Tt[p>>3],m=+Tt[p+8>>3],+ +bn(+(y*y+m*m))}function Bn(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0;it=+Tt[p>>3],H=+Tt[m>>3]-it,z=+Tt[p+8>>3],L=+Tt[m+8>>3]-z,Ct=+Tt[y>>3],k=+Tt[S>>3]-Ct,Nt=+Tt[y+8>>3],ot=+Tt[S+8>>3]-Nt,k=(k*(z-Nt)-(it-Ct)*ot)/(H*ot-L*k),Tt[C>>3]=it+H*k,Tt[C+8>>3]=z+L*k}function qo(p,m){return p=p|0,m=m|0,+Tt[p>>3]!=+Tt[m>>3]?(m=0,m|0):(m=+Tt[p+8>>3]==+Tt[m+8>>3],m|0)}function jr(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;return C=+Tt[p>>3]-+Tt[m>>3],S=+Tt[p+8>>3]-+Tt[m+8>>3],y=+Tt[p+16>>3]-+Tt[m+16>>3],+(C*C+S*S+y*y)}function ql(p,m){p=p|0,m=m|0;var y=0,S=0,C=0;y=+Tt[p>>3],S=+Ur(+y),y=+hi(+y),Tt[m+16>>3]=y,y=+Tt[p+8>>3],C=S*+Ur(+y),Tt[m>>3]=C,y=S*+hi(+y),Tt[m+8>>3]=y}function Zl(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0;if(it=wt,wt=wt+32|0,C=it+16|0,k=it,T(p,m,C),L=wf(p,m)|0,H=Es(p,m)|0,lh(L,k),m=Ld(L,g[C>>2]|0)|0,!(fi(L)|0))return H=m,wt=it,H|0;do switch(L|0){case 4:{p=0,y=14;break}case 14:{p=1,y=14;break}case 24:{p=2,y=14;break}case 38:{p=3,y=14;break}case 49:{p=4,y=14;break}case 58:{p=5,y=14;break}case 63:{p=6,y=14;break}case 72:{p=7,y=14;break}case 83:{p=8,y=14;break}case 97:{p=9,y=14;break}case 107:{p=10,y=14;break}case 117:{p=11,y=14;break}default:z=0,S=0}while(!1);return(y|0)==14&&(z=g[22096+(p*24|0)+8>>2]|0,S=g[22096+(p*24|0)+16>>2]|0),p=g[C>>2]|0,(p|0)!=(g[k>>2]|0)&&(L=mu(L)|0,p=g[C>>2]|0,L|(p|0)==(S|0)&&(m=(m+1|0)%6|0)),(H|0)==3&(p|0)==(S|0)?(H=(m+5|0)%6|0,wt=it,H|0):(H|0)==5&(p|0)==(z|0)?(H=(m+1|0)%6|0,wt=it,H|0):(H=m,wt=it,H|0)}function yu(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;return S=ji(p,m)|0,(y+-1|0)>>>0>5||(C=(S|0)!=0,(y|0)==1&C)?(y=-1,y|0):(S=Zl(p,m)|0,C?(y=(5-S+(g[22384+(y<<2)>>2]|0)|0)%5|0,y|0):(y=(6-S+(g[22416+(y<<2)>>2]|0)|0)%6|0,y|0))}function vu(p,m,y){p=p|0,m=m|0,y=y|0;var S=0;(m|0)>0?(S=Ua(m,4)|0,g[p>>2]=S,S||Mi(23230,23253,40,23267)):g[p>>2]=0,g[p+4>>2]=m,g[p+8>>2]=0,g[p+12>>2]=y}function _h(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0;C=p+4|0,k=p+12|0,L=p+8|0;t:for(;;){for(y=g[C>>2]|0,m=0;;){if((m|0)>=(y|0))break t;if(S=g[p>>2]|0,z=g[S+(m<<2)>>2]|0,!z)m=m+1|0;else break}m=S+(~~(+li(+(+dl(10,+ +(15-(g[k>>2]|0)|0))*(+Tt[z>>3]+ +Tt[z+8>>3])))%+(y|0))>>>0<<2)|0,y=g[m>>2]|0;e:do if(y|0){if(S=z+32|0,(y|0)==(z|0))g[m>>2]=g[S>>2];else{if(y=y+32|0,m=g[y>>2]|0,!m)break;for(;(m|0)!=(z|0);)if(y=m+32|0,m=g[y>>2]|0,!m)break e;g[y>>2]=g[S>>2]}Gr(z),g[L>>2]=(g[L>>2]|0)+-1}while(!1)}Gr(g[p>>2]|0)}function Ws(p){p=p|0;var m=0,y=0,S=0;for(S=g[p+4>>2]|0,y=0;;){if((y|0)>=(S|0)){m=0,y=4;break}if(m=g[(g[p>>2]|0)+(y<<2)>>2]|0,!m)y=y+1|0;else{y=4;break}}return(y|0)==4?m|0:0}function Ps(p,m){p=p|0,m=m|0;var y=0,S=0,C=0,k=0;if(y=~~(+li(+(+dl(10,+ +(15-(g[p+12>>2]|0)|0))*(+Tt[m>>3]+ +Tt[m+8>>3])))%+(g[p+4>>2]|0))>>>0,y=(g[p>>2]|0)+(y<<2)|0,S=g[y>>2]|0,!S)return k=1,k|0;k=m+32|0;do if((S|0)!=(m|0)){if(y=g[S+32>>2]|0,!y)return k=1,k|0;for(C=y;;){if((C|0)==(m|0)){C=8;break}if(y=g[C+32>>2]|0,y)S=C,C=y;else{y=1,C=10;break}}if((C|0)==8){g[S+32>>2]=g[k>>2];break}else if((C|0)==10)return y|0}else g[y>>2]=g[k>>2];while(!1);return Gr(m),k=p+8|0,g[k>>2]=(g[k>>2]|0)+-1,k=0,k|0}function Eo(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0;k=ho(40)|0,k||Mi(23283,23253,98,23296),g[k>>2]=g[m>>2],g[k+4>>2]=g[m+4>>2],g[k+8>>2]=g[m+8>>2],g[k+12>>2]=g[m+12>>2],C=k+16|0,g[C>>2]=g[y>>2],g[C+4>>2]=g[y+4>>2],g[C+8>>2]=g[y+8>>2],g[C+12>>2]=g[y+12>>2],g[k+32>>2]=0,C=~~(+li(+(+dl(10,+ +(15-(g[p+12>>2]|0)|0))*(+Tt[m>>3]+ +Tt[m+8>>3])))%+(g[p+4>>2]|0))>>>0,C=(g[p>>2]|0)+(C<<2)|0,S=g[C>>2]|0;do if(!S)g[C>>2]=k;else{for(;!(us(S,m)|0&&us(S+16|0,y)|0);)if(C=g[S+32>>2]|0,S=C|0?C:S,!(g[S+32>>2]|0)){L=10;break}if((L|0)==10){g[S+32>>2]=k;break}return Gr(k),L=S,L|0}while(!1);return L=p+8|0,g[L>>2]=(g[L>>2]|0)+1,L=k,L|0}function yh(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0;if(C=~~(+li(+(+dl(10,+ +(15-(g[p+12>>2]|0)|0))*(+Tt[m>>3]+ +Tt[m+8>>3])))%+(g[p+4>>2]|0))>>>0,C=g[(g[p>>2]|0)+(C<<2)>>2]|0,!C)return y=0,y|0;if(!y){for(p=C;;){if(us(p,m)|0){S=10;break}if(p=g[p+32>>2]|0,!p){p=0,S=10;break}}if((S|0)==10)return p|0}for(p=C;;){if(us(p,m)|0&&us(p+16|0,y)|0){S=10;break}if(p=g[p+32>>2]|0,!p){p=0,S=10;break}}return(S|0)==10?p|0:0}function Fn(p,m){p=p|0,m=m|0;var y=0;if(y=~~(+li(+(+dl(10,+ +(15-(g[p+12>>2]|0)|0))*(+Tt[m>>3]+ +Tt[m+8>>3])))%+(g[p+4>>2]|0))>>>0,p=g[(g[p>>2]|0)+(y<<2)>>2]|0,!p)return y=0,y|0;for(;;){if(us(p,m)|0){m=5;break}if(p=g[p+32>>2]|0,!p){p=0,m=5;break}}return(m|0)==5?p|0:0}function fs(){return 23312}function Zo(p){return p=+p,+ +Ux(+p)}function _n(p){return p=+p,~~+Zo(p)|0}function ho(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0,ne=0,Le=0,We=0,te=0,_e=0,Ut=0,$e=0;$e=wt,wt=wt+16|0,Nt=$e;do if(p>>>0<245){if(it=p>>>0<11?16:p+11&-8,p=it>>>3,Ct=g[5829]|0,y=Ct>>>p,y&3|0)return m=(y&1^1)+p|0,p=23356+(m<<1<<2)|0,y=p+8|0,S=g[y>>2]|0,C=S+8|0,k=g[C>>2]|0,(k|0)==(p|0)?g[5829]=Ct&~(1<>2]=p,g[y>>2]=k),Ut=m<<3,g[S+4>>2]=Ut|3,Ut=S+Ut+4|0,g[Ut>>2]=g[Ut>>2]|1,Ut=C,wt=$e,Ut|0;if(ot=g[5831]|0,it>>>0>ot>>>0){if(y|0)return m=2<>>12&16,m=m>>>z,y=m>>>5&8,m=m>>>y,k=m>>>2&4,m=m>>>k,p=m>>>1&2,m=m>>>p,S=m>>>1&1,S=(y|z|k|p|S)+(m>>>S)|0,m=23356+(S<<1<<2)|0,p=m+8|0,k=g[p>>2]|0,z=k+8|0,y=g[z>>2]|0,(y|0)==(m|0)?(p=Ct&~(1<>2]=m,g[p>>2]=y,p=Ct),Ut=S<<3,L=Ut-it|0,g[k+4>>2]=it|3,C=k+it|0,g[C+4>>2]=L|1,g[k+Ut>>2]=L,ot|0&&(S=g[5834]|0,m=ot>>>3,y=23356+(m<<1<<2)|0,m=1<>2]|0):(g[5829]=p|m,m=y,p=y+8|0),g[p>>2]=S,g[m+12>>2]=S,g[S+8>>2]=m,g[S+12>>2]=y),g[5831]=L,g[5834]=C,Ut=z,wt=$e,Ut|0;if(k=g[5830]|0,k){for(y=(k&0-k)+-1|0,C=y>>>12&16,y=y>>>C,S=y>>>5&8,y=y>>>S,L=y>>>2&4,y=y>>>L,z=y>>>1&2,y=y>>>z,H=y>>>1&1,H=g[23620+((S|C|L|z|H)+(y>>>H)<<2)>>2]|0,y=H,z=H,H=(g[H+4>>2]&-8)-it|0;p=g[y+16>>2]|0,!(!p&&(p=g[y+20>>2]|0,!p));)L=(g[p+4>>2]&-8)-it|0,C=L>>>0>>0,y=p,z=C?p:z,H=C?L:H;if(L=z+it|0,L>>>0>z>>>0){C=g[z+24>>2]|0,m=g[z+12>>2]|0;do if((m|0)==(z|0)){if(p=z+20|0,m=g[p>>2]|0,!m&&(p=z+16|0,m=g[p>>2]|0,!m)){y=0;break}for(;;)if(S=m+20|0,y=g[S>>2]|0,y)m=y,p=S;else if(S=m+16|0,y=g[S>>2]|0,y)m=y,p=S;else break;g[p>>2]=0,y=m}else y=g[z+8>>2]|0,g[y+12>>2]=m,g[m+8>>2]=y,y=m;while(!1);do if(C|0){if(m=g[z+28>>2]|0,p=23620+(m<<2)|0,(z|0)==(g[p>>2]|0)){if(g[p>>2]=y,!y){g[5830]=k&~(1<>2]|0)==(z|0)?Ut:C+20|0)>>2]=y,!y)break;g[y+24>>2]=C,m=g[z+16>>2]|0,m|0&&(g[y+16>>2]=m,g[m+24>>2]=y),m=g[z+20>>2]|0,m|0&&(g[y+20>>2]=m,g[m+24>>2]=y)}while(!1);return H>>>0<16?(Ut=H+it|0,g[z+4>>2]=Ut|3,Ut=z+Ut+4|0,g[Ut>>2]=g[Ut>>2]|1):(g[z+4>>2]=it|3,g[L+4>>2]=H|1,g[L+H>>2]=H,ot|0&&(S=g[5834]|0,m=ot>>>3,y=23356+(m<<1<<2)|0,m=1<>2]|0):(g[5829]=m|Ct,m=y,p=y+8|0),g[p>>2]=S,g[m+12>>2]=S,g[S+8>>2]=m,g[S+12>>2]=y),g[5831]=H,g[5834]=L),Ut=z+8|0,wt=$e,Ut|0}else Ct=it}else Ct=it}else Ct=it}else if(p>>>0<=4294967231)if(p=p+11|0,it=p&-8,S=g[5830]|0,S){C=0-it|0,p=p>>>8,p?it>>>0>16777215?H=31:(Ct=(p+1048320|0)>>>16&8,ne=p<>>16&4,ne=ne<>>16&2,H=14-(z|Ct|H)+(ne<>>15)|0,H=it>>>(H+7|0)&1|H<<1):H=0,y=g[23620+(H<<2)>>2]|0;t:do if(!y)y=0,p=0,ne=61;else for(p=0,z=it<<((H|0)==31?0:25-(H>>>1)|0),k=0;;){if(L=(g[y+4>>2]&-8)-it|0,L>>>0>>0)if(L)p=y,C=L;else{p=y,C=0,ne=65;break t}if(ne=g[y+20>>2]|0,y=g[y+16+(z>>>31<<2)>>2]|0,k=(ne|0)==0|(ne|0)==(y|0)?k:ne,y)z=z<<1;else{y=k,ne=61;break}}while(!1);if((ne|0)==61){if((y|0)==0&(p|0)==0){if(p=2<>>12&16,Ct=Ct>>>L,k=Ct>>>5&8,Ct=Ct>>>k,z=Ct>>>2&4,Ct=Ct>>>z,H=Ct>>>1&2,Ct=Ct>>>H,y=Ct>>>1&1,p=0,y=g[23620+((k|L|z|H|y)+(Ct>>>y)<<2)>>2]|0}y?ne=65:(z=p,L=C)}if((ne|0)==65)for(k=y;;)if(Ct=(g[k+4>>2]&-8)-it|0,y=Ct>>>0>>0,C=y?Ct:C,p=y?k:p,y=g[k+16>>2]|0,y||(y=g[k+20>>2]|0),y)k=y;else{z=p,L=C;break}if(z|0&&L>>>0<((g[5831]|0)-it|0)>>>0&&(ot=z+it|0,ot>>>0>z>>>0)){k=g[z+24>>2]|0,m=g[z+12>>2]|0;do if((m|0)==(z|0)){if(p=z+20|0,m=g[p>>2]|0,!m&&(p=z+16|0,m=g[p>>2]|0,!m)){m=0;break}for(;;)if(C=m+20|0,y=g[C>>2]|0,y)m=y,p=C;else if(C=m+16|0,y=g[C>>2]|0,y)m=y,p=C;else break;g[p>>2]=0}else Ut=g[z+8>>2]|0,g[Ut+12>>2]=m,g[m+8>>2]=Ut;while(!1);do if(k){if(p=g[z+28>>2]|0,y=23620+(p<<2)|0,(z|0)==(g[y>>2]|0)){if(g[y>>2]=m,!m){S=S&~(1<>2]|0)==(z|0)?Ut:k+20|0)>>2]=m,!m)break;g[m+24>>2]=k,p=g[z+16>>2]|0,p|0&&(g[m+16>>2]=p,g[p+24>>2]=m),p=g[z+20>>2]|0,p&&(g[m+20>>2]=p,g[p+24>>2]=m)}while(!1);t:do if(L>>>0<16)Ut=L+it|0,g[z+4>>2]=Ut|3,Ut=z+Ut+4|0,g[Ut>>2]=g[Ut>>2]|1;else{if(g[z+4>>2]=it|3,g[ot+4>>2]=L|1,g[ot+L>>2]=L,m=L>>>3,L>>>0<256){y=23356+(m<<1<<2)|0,p=g[5829]|0,m=1<>2]|0):(g[5829]=p|m,m=y,p=y+8|0),g[p>>2]=ot,g[m+12>>2]=ot,g[ot+8>>2]=m,g[ot+12>>2]=y;break}if(m=L>>>8,m?L>>>0>16777215?y=31:(_e=(m+1048320|0)>>>16&8,Ut=m<<_e,te=(Ut+520192|0)>>>16&4,Ut=Ut<>>16&2,y=14-(te|_e|y)+(Ut<>>15)|0,y=L>>>(y+7|0)&1|y<<1):y=0,m=23620+(y<<2)|0,g[ot+28>>2]=y,p=ot+16|0,g[p+4>>2]=0,g[p>>2]=0,p=1<>2]=ot,g[ot+24>>2]=m,g[ot+12>>2]=ot,g[ot+8>>2]=ot;break}m=g[m>>2]|0;e:do if((g[m+4>>2]&-8|0)!=(L|0)){for(S=L<<((y|0)==31?0:25-(y>>>1)|0);y=m+16+(S>>>31<<2)|0,p=g[y>>2]|0,!!p;)if((g[p+4>>2]&-8|0)==(L|0)){m=p;break e}else S=S<<1,m=p;g[y>>2]=ot,g[ot+24>>2]=m,g[ot+12>>2]=ot,g[ot+8>>2]=ot;break t}while(!1);_e=m+8|0,Ut=g[_e>>2]|0,g[Ut+12>>2]=ot,g[_e>>2]=ot,g[ot+8>>2]=Ut,g[ot+12>>2]=m,g[ot+24>>2]=0}while(!1);return Ut=z+8|0,wt=$e,Ut|0}else Ct=it}else Ct=it;else Ct=-1;while(!1);if(y=g[5831]|0,y>>>0>=Ct>>>0)return m=y-Ct|0,p=g[5834]|0,m>>>0>15?(Ut=p+Ct|0,g[5834]=Ut,g[5831]=m,g[Ut+4>>2]=m|1,g[p+y>>2]=m,g[p+4>>2]=Ct|3):(g[5831]=0,g[5834]=0,g[p+4>>2]=y|3,Ut=p+y+4|0,g[Ut>>2]=g[Ut>>2]|1),Ut=p+8|0,wt=$e,Ut|0;if(L=g[5832]|0,L>>>0>Ct>>>0)return te=L-Ct|0,g[5832]=te,Ut=g[5835]|0,_e=Ut+Ct|0,g[5835]=_e,g[_e+4>>2]=te|1,g[Ut+4>>2]=Ct|3,Ut=Ut+8|0,wt=$e,Ut|0;if(g[5947]|0?p=g[5949]|0:(g[5949]=4096,g[5948]=4096,g[5950]=-1,g[5951]=-1,g[5952]=0,g[5940]=0,g[5947]=Nt&-16^1431655768,p=4096),z=Ct+48|0,H=Ct+47|0,k=p+H|0,C=0-p|0,it=k&C,it>>>0<=Ct>>>0||(p=g[5939]|0,p|0&&(ot=g[5937]|0,Nt=ot+it|0,Nt>>>0<=ot>>>0|Nt>>>0>p>>>0)))return Ut=0,wt=$e,Ut|0;t:do if(g[5940]&4)m=0,ne=143;else{y=g[5835]|0;e:do if(y){for(S=23764;Nt=g[S>>2]|0,!(Nt>>>0<=y>>>0&&(Nt+(g[S+4>>2]|0)|0)>>>0>y>>>0);)if(p=g[S+8>>2]|0,p)S=p;else{ne=128;break e}if(m=k-L&C,m>>>0<2147483647)if(p=en(m|0)|0,(p|0)==((g[S>>2]|0)+(g[S+4>>2]|0)|0)){if((p|0)!=-1){L=m,k=p,ne=145;break t}}else S=p,ne=136;else m=0}else ne=128;while(!1);do if((ne|0)==128)if(y=en(0)|0,(y|0)!=-1&&(m=y,Wt=g[5948]|0,re=Wt+-1|0,m=(re&m|0?(re+m&0-Wt)-m|0:0)+it|0,Wt=g[5937]|0,re=m+Wt|0,m>>>0>Ct>>>0&m>>>0<2147483647)){if(Nt=g[5939]|0,Nt|0&&re>>>0<=Wt>>>0|re>>>0>Nt>>>0){m=0;break}if(p=en(m|0)|0,(p|0)==(y|0)){L=m,k=y,ne=145;break t}else S=p,ne=136}else m=0;while(!1);do if((ne|0)==136){if(y=0-m|0,!(z>>>0>m>>>0&(m>>>0<2147483647&(S|0)!=-1)))if((S|0)==-1){m=0;break}else{L=m,k=S,ne=145;break t}if(p=g[5949]|0,p=H-m+p&0-p,p>>>0>=2147483647){L=m,k=S,ne=145;break t}if((en(p|0)|0)==-1){en(y|0)|0,m=0;break}else{L=p+m|0,k=S,ne=145;break t}}while(!1);g[5940]=g[5940]|4,ne=143}while(!1);if((ne|0)==143&&it>>>0<2147483647&&(te=en(it|0)|0,re=en(0)|0,Le=re-te|0,We=Le>>>0>(Ct+40|0)>>>0,!((te|0)==-1|We^1|te>>>0>>0&((te|0)!=-1&(re|0)!=-1)^1))&&(L=We?Le:m,k=te,ne=145),(ne|0)==145){m=(g[5937]|0)+L|0,g[5937]=m,m>>>0>(g[5938]|0)>>>0&&(g[5938]=m),H=g[5835]|0;t:do if(H){for(m=23764;;){if(p=g[m>>2]|0,y=g[m+4>>2]|0,(k|0)==(p+y|0)){ne=154;break}if(S=g[m+8>>2]|0,S)m=S;else break}if((ne|0)==154&&(_e=m+4|0,(g[m+12>>2]&8|0)==0)&&k>>>0>H>>>0&p>>>0<=H>>>0){g[_e>>2]=y+L,Ut=(g[5832]|0)+L|0,te=H+8|0,te=te&7|0?0-te&7:0,_e=H+te|0,te=Ut-te|0,g[5835]=_e,g[5832]=te,g[_e+4>>2]=te|1,g[H+Ut+4>>2]=40,g[5836]=g[5951];break}for(k>>>0<(g[5833]|0)>>>0&&(g[5833]=k),y=k+L|0,m=23764;;){if((g[m>>2]|0)==(y|0)){ne=162;break}if(p=g[m+8>>2]|0,p)m=p;else break}if((ne|0)==162&&!(g[m+12>>2]&8|0)){g[m>>2]=k,ot=m+4|0,g[ot>>2]=(g[ot>>2]|0)+L,ot=k+8|0,ot=k+(ot&7|0?0-ot&7:0)|0,m=y+8|0,m=y+(m&7|0?0-m&7:0)|0,it=ot+Ct|0,z=m-ot-Ct|0,g[ot+4>>2]=Ct|3;e:do if((H|0)==(m|0))Ut=(g[5832]|0)+z|0,g[5832]=Ut,g[5835]=it,g[it+4>>2]=Ut|1;else{if((g[5834]|0)==(m|0)){Ut=(g[5831]|0)+z|0,g[5831]=Ut,g[5834]=it,g[it+4>>2]=Ut|1,g[it+Ut>>2]=Ut;break}if(p=g[m+4>>2]|0,(p&3|0)==1){L=p&-8,S=p>>>3;r:do if(p>>>0<256)if(p=g[m+8>>2]|0,y=g[m+12>>2]|0,(y|0)==(p|0)){g[5829]=g[5829]&~(1<>2]=y,g[y+8>>2]=p;break}else{k=g[m+24>>2]|0,p=g[m+12>>2]|0;do if((p|0)==(m|0)){if(y=m+16|0,S=y+4|0,p=g[S>>2]|0,p)y=S;else if(p=g[y>>2]|0,!p){p=0;break}for(;;)if(C=p+20|0,S=g[C>>2]|0,S)p=S,y=C;else if(C=p+16|0,S=g[C>>2]|0,S)p=S,y=C;else break;g[y>>2]=0}else Ut=g[m+8>>2]|0,g[Ut+12>>2]=p,g[p+8>>2]=Ut;while(!1);if(!k)break;y=g[m+28>>2]|0,S=23620+(y<<2)|0;do if((g[S>>2]|0)!=(m|0)){if(Ut=k+16|0,g[((g[Ut>>2]|0)==(m|0)?Ut:k+20|0)>>2]=p,!p)break r}else{if(g[S>>2]=p,p|0)break;g[5830]=g[5830]&~(1<>2]=k,y=m+16|0,S=g[y>>2]|0,S|0&&(g[p+16>>2]=S,g[S+24>>2]=p),y=g[y+4>>2]|0,!y)break;g[p+20>>2]=y,g[y+24>>2]=p}while(!1);m=m+L|0,C=L+z|0}else C=z;if(m=m+4|0,g[m>>2]=g[m>>2]&-2,g[it+4>>2]=C|1,g[it+C>>2]=C,m=C>>>3,C>>>0<256){y=23356+(m<<1<<2)|0,p=g[5829]|0,m=1<>2]|0):(g[5829]=p|m,m=y,p=y+8|0),g[p>>2]=it,g[m+12>>2]=it,g[it+8>>2]=m,g[it+12>>2]=y;break}m=C>>>8;do if(!m)S=0;else{if(C>>>0>16777215){S=31;break}_e=(m+1048320|0)>>>16&8,Ut=m<<_e,te=(Ut+520192|0)>>>16&4,Ut=Ut<>>16&2,S=14-(te|_e|S)+(Ut<>>15)|0,S=C>>>(S+7|0)&1|S<<1}while(!1);if(m=23620+(S<<2)|0,g[it+28>>2]=S,p=it+16|0,g[p+4>>2]=0,g[p>>2]=0,p=g[5830]|0,y=1<>2]=it,g[it+24>>2]=m,g[it+12>>2]=it,g[it+8>>2]=it;break}m=g[m>>2]|0;r:do if((g[m+4>>2]&-8|0)!=(C|0)){for(S=C<<((S|0)==31?0:25-(S>>>1)|0);y=m+16+(S>>>31<<2)|0,p=g[y>>2]|0,!!p;)if((g[p+4>>2]&-8|0)==(C|0)){m=p;break r}else S=S<<1,m=p;g[y>>2]=it,g[it+24>>2]=m,g[it+12>>2]=it,g[it+8>>2]=it;break e}while(!1);_e=m+8|0,Ut=g[_e>>2]|0,g[Ut+12>>2]=it,g[_e>>2]=it,g[it+8>>2]=Ut,g[it+12>>2]=m,g[it+24>>2]=0}while(!1);return Ut=ot+8|0,wt=$e,Ut|0}for(m=23764;p=g[m>>2]|0,!(p>>>0<=H>>>0&&(Ut=p+(g[m+4>>2]|0)|0,Ut>>>0>H>>>0));)m=g[m+8>>2]|0;C=Ut+-47|0,p=C+8|0,p=C+(p&7|0?0-p&7:0)|0,C=H+16|0,p=p>>>0>>0?H:p,m=p+8|0,y=L+-40|0,te=k+8|0,te=te&7|0?0-te&7:0,_e=k+te|0,te=y-te|0,g[5835]=_e,g[5832]=te,g[_e+4>>2]=te|1,g[k+y+4>>2]=40,g[5836]=g[5951],y=p+4|0,g[y>>2]=27,g[m>>2]=g[5941],g[m+4>>2]=g[5942],g[m+8>>2]=g[5943],g[m+12>>2]=g[5944],g[5941]=k,g[5942]=L,g[5944]=0,g[5943]=m,m=p+24|0;do _e=m,m=m+4|0,g[m>>2]=7;while((_e+8|0)>>>0>>0);if((p|0)!=(H|0)){if(k=p-H|0,g[y>>2]=g[y>>2]&-2,g[H+4>>2]=k|1,g[p>>2]=k,m=k>>>3,k>>>0<256){y=23356+(m<<1<<2)|0,p=g[5829]|0,m=1<>2]|0):(g[5829]=p|m,m=y,p=y+8|0),g[p>>2]=H,g[m+12>>2]=H,g[H+8>>2]=m,g[H+12>>2]=y;break}if(m=k>>>8,m?k>>>0>16777215?S=31:(_e=(m+1048320|0)>>>16&8,Ut=m<<_e,te=(Ut+520192|0)>>>16&4,Ut=Ut<>>16&2,S=14-(te|_e|S)+(Ut<>>15)|0,S=k>>>(S+7|0)&1|S<<1):S=0,y=23620+(S<<2)|0,g[H+28>>2]=S,g[H+20>>2]=0,g[C>>2]=0,m=g[5830]|0,p=1<>2]=H,g[H+24>>2]=y,g[H+12>>2]=H,g[H+8>>2]=H;break}m=g[y>>2]|0;e:do if((g[m+4>>2]&-8|0)!=(k|0)){for(S=k<<((S|0)==31?0:25-(S>>>1)|0);y=m+16+(S>>>31<<2)|0,p=g[y>>2]|0,!!p;)if((g[p+4>>2]&-8|0)==(k|0)){m=p;break e}else S=S<<1,m=p;g[y>>2]=H,g[H+24>>2]=m,g[H+12>>2]=H,g[H+8>>2]=H;break t}while(!1);_e=m+8|0,Ut=g[_e>>2]|0,g[Ut+12>>2]=H,g[_e>>2]=H,g[H+8>>2]=Ut,g[H+12>>2]=m,g[H+24>>2]=0}}else Ut=g[5833]|0,(Ut|0)==0|k>>>0>>0&&(g[5833]=k),g[5941]=k,g[5942]=L,g[5944]=0,g[5838]=g[5947],g[5837]=-1,g[5842]=23356,g[5841]=23356,g[5844]=23364,g[5843]=23364,g[5846]=23372,g[5845]=23372,g[5848]=23380,g[5847]=23380,g[5850]=23388,g[5849]=23388,g[5852]=23396,g[5851]=23396,g[5854]=23404,g[5853]=23404,g[5856]=23412,g[5855]=23412,g[5858]=23420,g[5857]=23420,g[5860]=23428,g[5859]=23428,g[5862]=23436,g[5861]=23436,g[5864]=23444,g[5863]=23444,g[5866]=23452,g[5865]=23452,g[5868]=23460,g[5867]=23460,g[5870]=23468,g[5869]=23468,g[5872]=23476,g[5871]=23476,g[5874]=23484,g[5873]=23484,g[5876]=23492,g[5875]=23492,g[5878]=23500,g[5877]=23500,g[5880]=23508,g[5879]=23508,g[5882]=23516,g[5881]=23516,g[5884]=23524,g[5883]=23524,g[5886]=23532,g[5885]=23532,g[5888]=23540,g[5887]=23540,g[5890]=23548,g[5889]=23548,g[5892]=23556,g[5891]=23556,g[5894]=23564,g[5893]=23564,g[5896]=23572,g[5895]=23572,g[5898]=23580,g[5897]=23580,g[5900]=23588,g[5899]=23588,g[5902]=23596,g[5901]=23596,g[5904]=23604,g[5903]=23604,Ut=L+-40|0,te=k+8|0,te=te&7|0?0-te&7:0,_e=k+te|0,te=Ut-te|0,g[5835]=_e,g[5832]=te,g[_e+4>>2]=te|1,g[k+Ut+4>>2]=40,g[5836]=g[5951];while(!1);if(m=g[5832]|0,m>>>0>Ct>>>0)return te=m-Ct|0,g[5832]=te,Ut=g[5835]|0,_e=Ut+Ct|0,g[5835]=_e,g[_e+4>>2]=te|1,g[Ut+4>>2]=Ct|3,Ut=Ut+8|0,wt=$e,Ut|0}return Ut=fs()|0,g[Ut>>2]=12,Ut=0,wt=$e,Ut|0}function Gr(p){p=p|0;var m=0,y=0,S=0,C=0,k=0,L=0,z=0,H=0;if(p){y=p+-8|0,C=g[5833]|0,p=g[p+-4>>2]|0,m=p&-8,H=y+m|0;do if(p&1)z=y,L=y;else{if(S=g[y>>2]|0,!(p&3)||(L=y+(0-S)|0,k=S+m|0,L>>>0>>0))return;if((g[5834]|0)==(L|0)){if(p=H+4|0,m=g[p>>2]|0,(m&3|0)!=3){z=L,m=k;break}g[5831]=k,g[p>>2]=m&-2,g[L+4>>2]=k|1,g[L+k>>2]=k;return}if(y=S>>>3,S>>>0<256)if(p=g[L+8>>2]|0,m=g[L+12>>2]|0,(m|0)==(p|0)){g[5829]=g[5829]&~(1<>2]=m,g[m+8>>2]=p,z=L,m=k;break}C=g[L+24>>2]|0,p=g[L+12>>2]|0;do if((p|0)==(L|0)){if(m=L+16|0,y=m+4|0,p=g[y>>2]|0,p)m=y;else if(p=g[m>>2]|0,!p){p=0;break}for(;;)if(S=p+20|0,y=g[S>>2]|0,y)p=y,m=S;else if(S=p+16|0,y=g[S>>2]|0,y)p=y,m=S;else break;g[m>>2]=0}else z=g[L+8>>2]|0,g[z+12>>2]=p,g[p+8>>2]=z;while(!1);if(C){if(m=g[L+28>>2]|0,y=23620+(m<<2)|0,(g[y>>2]|0)==(L|0)){if(g[y>>2]=p,!p){g[5830]=g[5830]&~(1<>2]|0)==(L|0)?z:C+20|0)>>2]=p,!p){z=L,m=k;break}g[p+24>>2]=C,m=L+16|0,y=g[m>>2]|0,y|0&&(g[p+16>>2]=y,g[y+24>>2]=p),m=g[m+4>>2]|0,m?(g[p+20>>2]=m,g[m+24>>2]=p,z=L,m=k):(z=L,m=k)}else z=L,m=k}while(!1);if(!(L>>>0>=H>>>0)&&(p=H+4|0,S=g[p>>2]|0,!!(S&1))){if(S&2)g[p>>2]=S&-2,g[z+4>>2]=m|1,g[L+m>>2]=m,C=m;else{if((g[5835]|0)==(H|0)){if(H=(g[5832]|0)+m|0,g[5832]=H,g[5835]=z,g[z+4>>2]=H|1,(z|0)!=(g[5834]|0))return;g[5834]=0,g[5831]=0;return}if((g[5834]|0)==(H|0)){H=(g[5831]|0)+m|0,g[5831]=H,g[5834]=L,g[z+4>>2]=H|1,g[L+H>>2]=H;return}C=(S&-8)+m|0,y=S>>>3;do if(S>>>0<256)if(m=g[H+8>>2]|0,p=g[H+12>>2]|0,(p|0)==(m|0)){g[5829]=g[5829]&~(1<>2]=p,g[p+8>>2]=m;break}else{k=g[H+24>>2]|0,p=g[H+12>>2]|0;do if((p|0)==(H|0)){if(m=H+16|0,y=m+4|0,p=g[y>>2]|0,p)m=y;else if(p=g[m>>2]|0,!p){y=0;break}for(;;)if(S=p+20|0,y=g[S>>2]|0,y)p=y,m=S;else if(S=p+16|0,y=g[S>>2]|0,y)p=y,m=S;else break;g[m>>2]=0,y=p}else y=g[H+8>>2]|0,g[y+12>>2]=p,g[p+8>>2]=y,y=p;while(!1);if(k|0){if(p=g[H+28>>2]|0,m=23620+(p<<2)|0,(g[m>>2]|0)==(H|0)){if(g[m>>2]=y,!y){g[5830]=g[5830]&~(1<>2]|0)==(H|0)?S:k+20|0)>>2]=y,!y)break;g[y+24>>2]=k,p=H+16|0,m=g[p>>2]|0,m|0&&(g[y+16>>2]=m,g[m+24>>2]=y),p=g[p+4>>2]|0,p|0&&(g[y+20>>2]=p,g[p+24>>2]=y)}}while(!1);if(g[z+4>>2]=C|1,g[L+C>>2]=C,(z|0)==(g[5834]|0)){g[5831]=C;return}}if(p=C>>>3,C>>>0<256){y=23356+(p<<1<<2)|0,m=g[5829]|0,p=1<>2]|0):(g[5829]=m|p,p=y,m=y+8|0),g[m>>2]=z,g[p+12>>2]=z,g[z+8>>2]=p,g[z+12>>2]=y;return}p=C>>>8,p?C>>>0>16777215?S=31:(L=(p+1048320|0)>>>16&8,H=p<>>16&4,H=H<>>16&2,S=14-(k|L|S)+(H<>>15)|0,S=C>>>(S+7|0)&1|S<<1):S=0,p=23620+(S<<2)|0,g[z+28>>2]=S,g[z+20>>2]=0,g[z+16>>2]=0,m=g[5830]|0,y=1<>2]=z,g[z+24>>2]=p,g[z+12>>2]=z,g[z+8>>2]=z;else{p=g[p>>2]|0;e:do if((g[p+4>>2]&-8|0)!=(C|0)){for(S=C<<((S|0)==31?0:25-(S>>>1)|0);y=p+16+(S>>>31<<2)|0,m=g[y>>2]|0,!!m;)if((g[m+4>>2]&-8|0)==(C|0)){p=m;break e}else S=S<<1,p=m;g[y>>2]=z,g[z+24>>2]=p,g[z+12>>2]=z,g[z+8>>2]=z;break t}while(!1);L=p+8|0,H=g[L>>2]|0,g[H+12>>2]=z,g[L>>2]=z,g[z+8>>2]=H,g[z+12>>2]=p,g[z+24>>2]=0}while(!1);if(H=(g[5837]|0)+-1|0,g[5837]=H,!(H|0)){for(p=23772;p=g[p>>2]|0,p;)p=p+8|0;g[5837]=-1}}}}function Ua(p,m){p=p|0,m=m|0;var y=0;return p?(y=Oc(m,p)|0,(m|p)>>>0>65535&&(y=((y>>>0)/(p>>>0)|0|0)==(m|0)?y:-1)):y=0,p=ho(y)|0,!p||!(g[p+-4>>2]&3)||Fc(p|0,0,y|0)|0,p|0}function S_(p,m,y,S){return p=p|0,m=m|0,y=y|0,S=S|0,y=p+y>>>0,Je(m+S+(y>>>0

>>0|0)>>>0|0),y|0|0}function zd(p,m,y,S){return p=p|0,m=m|0,y=y|0,S=S|0,S=m-S-(y>>>0>p>>>0|0)>>>0,Je(S|0),p-y>>>0|0|0}function cA(p){return p=p|0,(p?31-(aa(p^p-1)|0)|0:32)|0}function Yl(p,m,y,S,C){p=p|0,m=m|0,y=y|0,S=S|0,C=C|0;var k=0,L=0,z=0,H=0,it=0,ot=0,Ct=0,Nt=0,Wt=0,re=0;if(ot=p,H=m,it=H,L=y,Nt=S,z=Nt,!it)return k=(C|0)!=0,z?k?(g[C>>2]=p|0,g[C+4>>2]=m&0,Nt=0,C=0,Je(Nt|0),C|0):(Nt=0,C=0,Je(Nt|0),C|0):(k&&(g[C>>2]=(ot>>>0)%(L>>>0),g[C+4>>2]=0),Nt=0,C=(ot>>>0)/(L>>>0)>>>0,Je(Nt|0),C|0);k=(z|0)==0;do if(L){if(!k){if(k=(aa(z|0)|0)-(aa(it|0)|0)|0,k>>>0<=31){Ct=k+1|0,z=31-k|0,m=k-31>>31,L=Ct,p=ot>>>(Ct>>>0)&m|it<>>(Ct>>>0)&m,k=0,z=ot<>2]=p|0,g[C+4>>2]=H|m&0,Nt=0,C=0,Je(Nt|0),C|0):(Nt=0,C=0,Je(Nt|0),C|0)}if(k=L-1|0,k&L|0){z=(aa(L|0)|0)+33-(aa(it|0)|0)|0,re=64-z|0,Ct=32-z|0,H=Ct>>31,Wt=z-32|0,m=Wt>>31,L=z,p=Ct-1>>31&it>>>(Wt>>>0)|(it<>>(z>>>0))&m,m=m&it>>>(z>>>0),k=ot<>>(Wt>>>0))&H|ot<>31;break}return C|0&&(g[C>>2]=k&ot,g[C+4>>2]=0),(L|0)==1?(Wt=H|m&0,re=p|0|0,Je(Wt|0),re|0):(re=cA(L|0)|0,Wt=it>>>(re>>>0)|0,re=it<<32-re|ot>>>(re>>>0)|0,Je(Wt|0),re|0)}else{if(k)return C|0&&(g[C>>2]=(it>>>0)%(L>>>0),g[C+4>>2]=0),Wt=0,re=(it>>>0)/(L>>>0)>>>0,Je(Wt|0),re|0;if(!ot)return C|0&&(g[C>>2]=0,g[C+4>>2]=(it>>>0)%(z>>>0)),Wt=0,re=(it>>>0)/(z>>>0)>>>0,Je(Wt|0),re|0;if(k=z-1|0,!(k&z))return C|0&&(g[C>>2]=p|0,g[C+4>>2]=k&it|m&0),Wt=0,re=it>>>((cA(z|0)|0)>>>0),Je(Wt|0),re|0;if(k=(aa(z|0)|0)-(aa(it|0)|0)|0,k>>>0<=30){m=k+1|0,z=31-k|0,L=m,p=it<>>(m>>>0),m=it>>>(m>>>0),k=0,z=ot<>2]=p|0,g[C+4>>2]=H|m&0,Wt=0,re=0,Je(Wt|0),re|0):(Wt=0,re=0,Je(Wt|0),re|0)}while(!1);if(!L)it=z,H=0,z=0;else{Ct=y|0|0,ot=Nt|S&0,it=S_(Ct|0,ot|0,-1,-1)|0,y=It()|0,H=z,z=0;do S=H,H=k>>>31|H<<1,k=z|k<<1,S=p<<1|S>>>31|0,Nt=p>>>31|m<<1|0,zd(it|0,y|0,S|0,Nt|0)|0,re=It()|0,Wt=re>>31|((re|0)<0?-1:0)<<1,z=Wt&1,p=zd(S|0,Nt|0,Wt&Ct|0,(((re|0)<0?-1:0)>>31|((re|0)<0?-1:0)<<1)&ot|0)|0,m=It()|0,L=L-1|0;while(L|0);it=H,H=0}return L=0,C|0&&(g[C>>2]=p,g[C+4>>2]=m),Wt=(k|0)>>>31|(it|L)<<1|(L<<1|k>>>31)&0|H,re=(k<<1|0)&-2|z,Je(Wt|0),re|0}function Yo(p,m,y,S){p=p|0,m=m|0,y=y|0,S=S|0;var C=0,k=0;return k=wt,wt=wt+16|0,C=k|0,Yl(p,m,y,S,C)|0,wt=k,Je(g[C+4>>2]|0),g[C>>2]|0|0}function me(p,m,y){return p=p|0,m=m|0,y=y|0,(y|0)<32?(Je(m>>>y|0),p>>>y|(m&(1<>>y-32|0)}function ke(p,m,y){return p=p|0,m=m|0,y=y|0,(y|0)<32?(Je(m<>>32-y|0),p<=0?+cs(p+.5):+Ji(p-.5)}function Va(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0;if((y|0)>=8192)return Yp(p|0,m|0,y|0)|0,p|0;if(k=p|0,C=p+y|0,(p&3)==(m&3)){for(;p&3;){if(!y)return k|0;br[p>>0]=br[m>>0]|0,p=p+1|0,m=m+1|0,y=y-1|0}for(y=C&-4|0,S=y-64|0;(p|0)<=(S|0);)g[p>>2]=g[m>>2],g[p+4>>2]=g[m+4>>2],g[p+8>>2]=g[m+8>>2],g[p+12>>2]=g[m+12>>2],g[p+16>>2]=g[m+16>>2],g[p+20>>2]=g[m+20>>2],g[p+24>>2]=g[m+24>>2],g[p+28>>2]=g[m+28>>2],g[p+32>>2]=g[m+32>>2],g[p+36>>2]=g[m+36>>2],g[p+40>>2]=g[m+40>>2],g[p+44>>2]=g[m+44>>2],g[p+48>>2]=g[m+48>>2],g[p+52>>2]=g[m+52>>2],g[p+56>>2]=g[m+56>>2],g[p+60>>2]=g[m+60>>2],p=p+64|0,m=m+64|0;for(;(p|0)<(y|0);)g[p>>2]=g[m>>2],p=p+4|0,m=m+4|0}else for(y=C-4|0;(p|0)<(y|0);)br[p>>0]=br[m>>0]|0,br[p+1>>0]=br[m+1>>0]|0,br[p+2>>0]=br[m+2>>0]|0,br[p+3>>0]=br[m+3>>0]|0,p=p+4|0,m=m+4|0;for(;(p|0)<(C|0);)br[p>>0]=br[m>>0]|0,p=p+1|0,m=m+1|0;return k|0}function Fc(p,m,y){p=p|0,m=m|0,y=y|0;var S=0,C=0,k=0,L=0;if(k=p+y|0,m=m&255,(y|0)>=67){for(;p&3;)br[p>>0]=m,p=p+1|0;for(S=k&-4|0,L=m|m<<8|m<<16|m<<24,C=S-64|0;(p|0)<=(C|0);)g[p>>2]=L,g[p+4>>2]=L,g[p+8>>2]=L,g[p+12>>2]=L,g[p+16>>2]=L,g[p+20>>2]=L,g[p+24>>2]=L,g[p+28>>2]=L,g[p+32>>2]=L,g[p+36>>2]=L,g[p+40>>2]=L,g[p+44>>2]=L,g[p+48>>2]=L,g[p+52>>2]=L,g[p+56>>2]=L,g[p+60>>2]=L,p=p+64|0;for(;(p|0)<(S|0);)g[p>>2]=L,p=p+4|0}for(;(p|0)<(k|0);)br[p>>0]=m,p=p+1|0;return k-y|0}function Ux(p){return p=+p,p>=0?+cs(p+.5):+Ji(p-.5)}function en(p){p=p|0;var m=0,y=0,S=0;return S=Jm()|0,y=g[Ms>>2]|0,m=y+p|0,(p|0)>0&(m|0)<(y|0)|(m|0)<0?(t0(m|0)|0,Km(12),-1):(m|0)>(S|0)&&!(Qp(m|0)|0)?(Km(12),-1):(g[Ms>>2]=m,y|0)}return{___uremdi3:Yo,_bitshift64Lshr:me,_bitshift64Shl:ke,_calloc:Ua,_cellAreaKm2:b_,_cellAreaM2:Nx,_cellAreaRads2:x_,_compact:mh,_destroyLinkedPolygon:Ft,_edgeLengthKm:un,_edgeLengthM:sA,_emscripten_replace_memory:e0,_exactEdgeLengthKm:oA,_exactEdgeLengthM:nr,_exactEdgeLengthRads:Mo,_experimentalH3ToLocalIj:$t,_experimentalLocalIjToH3:oe,_free:Gr,_geoToH3:lA,_getDestinationH3IndexFromUnidirectionalEdge:Z,_getH3IndexesFromUnidirectionalEdge:st,_getH3UnidirectionalEdge:U,_getH3UnidirectionalEdgeBoundary:pt,_getH3UnidirectionalEdgesFromHexagon:At,_getOriginH3IndexFromUnidirectionalEdge:W,_getPentagonIndexes:O,_getRes0Indexes:m_,_h3Distance:pe,_h3GetBaseCell:wf,_h3GetFaces:b,_h3GetResolution:dr,_h3IndexesAreNeighbors:B,_h3IsPentagon:ji,_h3IsResClassIII:Sf,_h3IsValid:aA,_h3Line:be,_h3LineSize:he,_h3SetToLinkedGeo:ah,_h3ToCenterChild:w_,_h3ToChildren:uo,_h3ToGeo:l,_h3ToGeoBoundary:d,_h3ToParent:Bd,_h3UnidirectionalEdgeIsValid:$,_hexAreaKm2:v_,_hexAreaM2:ua,_hexRing:p_,_i64Subtract:zd,_kRing:f_,_kRingDistances:d_,_llvm_minnum_f64:ml,_llvm_round_f64:Mf,_malloc:ho,_maxFaceCount:v,_maxH3ToChildrenSize:Hn,_maxKringSize:r0,_maxPolyfillSize:Cd,_maxUncompactSize:wn,_memcpy:Va,_memset:Fc,_numHexagons:d0,_pentagonIndexCount:M,_pointDistKm:Bc,_pointDistM:h0,_pointDistRads:_u,_polyfill:$p,_res0IndexCount:A_,_round:Ux,_sbrk:en,_sizeOfCoordIJ:Gs,_sizeOfGeoBoundary:Vr,_sizeOfGeoCoord:Jr,_sizeOfGeoPolygon:On,_sizeOfGeofence:ei,_sizeOfH3Index:Gi,_sizeOfLinkedGeoPolygon:tn,_uncompact:kn,establishStackSpace:Fx,stackAlloc:Ed,stackRestore:Id,stackSave:Pd}}(vt,xt,rr),Dt=t.___uremdi3=_t.___uremdi3,Mt=t._bitshift64Lshr=_t._bitshift64Lshr,Vt=t._bitshift64Shl=_t._bitshift64Shl,ie=t._calloc=_t._calloc,se=t._cellAreaKm2=_t._cellAreaKm2,ae=t._cellAreaM2=_t._cellAreaM2,lr=t._cellAreaRads2=_t._cellAreaRads2,vr=t._compact=_t._compact,Xe=t._destroyLinkedPolygon=_t._destroyLinkedPolygon,cr=t._edgeLengthKm=_t._edgeLengthKm,wr=t._edgeLengthM=_t._edgeLengthM,xi=t._emscripten_replace_memory=_t._emscripten_replace_memory,zi=t._exactEdgeLengthKm=_t._exactEdgeLengthKm,ni=t._exactEdgeLengthM=_t._exactEdgeLengthM,Hr=t._exactEdgeLengthRads=_t._exactEdgeLengthRads,jn=t._experimentalH3ToLocalIj=_t._experimentalH3ToLocalIj,Bi=t._experimentalLocalIjToH3=_t._experimentalLocalIjToH3,xn=t._free=_t._free,es=t._geoToH3=_t._geoToH3,oa=t._getDestinationH3IndexFromUnidirectionalEdge=_t._getDestinationH3IndexFromUnidirectionalEdge,Um=t._getH3IndexesFromUnidirectionalEdge=_t._getH3IndexesFromUnidirectionalEdge,Vl=t._getH3UnidirectionalEdge=_t._getH3UnidirectionalEdge,Ss=t._getH3UnidirectionalEdgeBoundary=_t._getH3UnidirectionalEdgeBoundary,nh=t._getH3UnidirectionalEdgesFromHexagon=_t._getH3UnidirectionalEdgesFromHexagon,ai=t._getOriginH3IndexFromUnidirectionalEdge=_t._getOriginH3IndexFromUnidirectionalEdge,ka=t._getPentagonIndexes=_t._getPentagonIndexes,Dc=t._getRes0Indexes=_t._getRes0Indexes,ln=t._h3Distance=_t._h3Distance,Dn=t._h3GetBaseCell=_t._h3GetBaseCell,Vm=t._h3GetFaces=_t._h3GetFaces,Go=t._h3GetResolution=_t._h3GetResolution,Gn=t._h3IndexesAreNeighbors=_t._h3IndexesAreNeighbors,So=t._h3IsPentagon=_t._h3IsPentagon,jl=t._h3IsResClassIII=_t._h3IsResClassIII,Ki=t._h3IsValid=_t._h3IsValid,_i=t._h3Line=_t._h3Line,Gl=t._h3LineSize=_t._h3LineSize,cn=t._h3SetToLinkedGeo=_t._h3SetToLinkedGeo,pu=t._h3ToCenterChild=_t._h3ToCenterChild,rs=t._h3ToChildren=_t._h3ToChildren,Gp=t._h3ToGeo=_t._h3ToGeo,Wl=t._h3ToGeoBoundary=_t._h3ToGeoBoundary,_d=t._h3ToParent=_t._h3ToParent,yd=t._h3UnidirectionalEdgeIsValid=_t._h3UnidirectionalEdgeIsValid,vd=t._hexAreaKm2=_t._hexAreaKm2,xd=t._hexAreaM2=_t._hexAreaM2,lt=t._hexRing=_t._hexRing,ft=t._i64Subtract=_t._i64Subtract,Lt=t._kRing=_t._kRing,Kt=t._kRingDistances=_t._kRingDistances,ge=t._llvm_minnum_f64=_t._llvm_minnum_f64,Qe=t._llvm_round_f64=_t._llvm_round_f64,ti=t._malloc=_t._malloc,is=t._maxFaceCount=_t._maxFaceCount,Ts=t._maxH3ToChildrenSize=_t._maxH3ToChildrenSize,Vs=t._maxKringSize=_t._maxKringSize,Ra=t._maxPolyfillSize=_t._maxPolyfillSize,jm=t._maxUncompactSize=_t._maxUncompactSize,Ox=t._memcpy=_t._memcpy,Bx=t._memset=_t._memset,l_=t._numHexagons=_t._numHexagons,c_=t._pentagonIndexCount=_t._pentagonIndexCount,gf=t._pointDistKm=_t._pointDistKm,Gm=t._pointDistM=_t._pointDistM,fl=t._pointDistRads=_t._pointDistRads,Wm=t._polyfill=_t._polyfill,Hm=t._res0IndexCount=_t._res0IndexCount,Wp=t._round=_t._round,qm=t._sbrk=_t._sbrk,bd=t._sizeOfCoordIJ=_t._sizeOfCoordIJ,sh=t._sizeOfGeoBoundary=_t._sizeOfGeoBoundary,ui=t._sizeOfGeoCoord=_t._sizeOfGeoCoord,Zm=t._sizeOfGeoPolygon=_t._sizeOfGeoPolygon,Da=t._sizeOfGeofence=_t._sizeOfGeofence,Oa=t._sizeOfH3Index=_t._sizeOfH3Index,u_=t._sizeOfLinkedGeoPolygon=_t._sizeOfLinkedGeoPolygon,Ym=t._uncompact=_t._uncompact,Qm=t.establishStackSpace=_t.establishStackSpace,Hp=t.stackAlloc=_t.stackAlloc,$m=t.stackRestore=_t.stackRestore,qp=t.stackSave=_t.stackSave;if(t.asm=_t,t.cwrap=ut,t.setValue=j,t.getValue=Q,t.getTempRet0=R,bo){Ia(bo)||(bo=o(bo));{du(\"memory initializer\");var wd=function(Zt){Zt.byteLength&&(Zt=new Uint8Array(Zt)),Li.set(Zt,N),t.memoryInitializerRequest&&delete t.memoryInitializerRequest.response,ul(\"memory initializer\")},Zp=function(){c(bo,wd,function(){throw\"could not load memory initializer \"+bo})},Sd=ht(bo);if(Sd)wd(Sd.buffer);else if(t.memoryInitializerRequest){var Xm=function(){var Zt=t.memoryInitializerRequest,fe=Zt.response;if(Zt.status!==200&&Zt.status!==0){var Be=ht(t.memoryInitializerRequestURL);if(Be)fe=Be.buffer;else{console.warn(\"a problem seems to have happened with Module.memoryInitializerRequest, status: \"+Zt.status+\", retrying \"+bo),Zp();return}}wd(fe)};t.memoryInitializerRequest.response?setTimeout(Xm,0):t.memoryInitializerRequest.addEventListener(\"load\",Xm)}else Zp()}}var Td;lo=function Zt(){Td||Au(),Td||(lo=Zt)};function Au(Zt){if(Zt=Zt||s,gi>0||(cl(),gi>0))return;function fe(){Td||(Td=!0,!et&&(xo(),Pa(),t.onRuntimeInitialized&&t.onRuntimeInitialized(),na()))}t.setStatus?(t.setStatus(\"Running...\"),setTimeout(function(){setTimeout(function(){t.setStatus(\"\")},1),fe()},1)):fe()}t.run=Au;function oh(Zt){throw t.onAbort&&t.onAbort(Zt),Zt+=\"\",f(Zt),_(Zt),et=!0,\"abort(\"+Zt+\"). Build with -s ASSERTIONS=1 for more info.\"}if(t.abort=oh,t.preInit)for(typeof t.preInit==\"function\"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return Au(),e}(typeof Ic==\"object\"?Ic:{}),Tr=\"number\",PS=Tr,$r=Tr,mi=Tr,Pc=Tr,Hi=Tr,pyt=[[\"sizeOfH3Index\",Tr],[\"sizeOfGeoCoord\",Tr],[\"sizeOfGeoBoundary\",Tr],[\"sizeOfGeoPolygon\",Tr],[\"sizeOfGeofence\",Tr],[\"sizeOfLinkedGeoPolygon\",Tr],[\"sizeOfCoordIJ\",Tr],[\"h3IsValid\",PS,[$r,mi]],[\"geoToH3\",$r,[Tr,Tr,Pc]],[\"h3ToGeo\",null,[$r,mi,Hi]],[\"h3ToGeoBoundary\",null,[$r,mi,Hi]],[\"maxKringSize\",Tr,[Tr]],[\"kRing\",null,[$r,mi,Tr,Hi]],[\"kRingDistances\",null,[$r,mi,Tr,Hi,Hi]],[\"hexRing\",null,[$r,mi,Tr,Hi]],[\"maxPolyfillSize\",Tr,[Hi,Pc]],[\"polyfill\",null,[Hi,Pc,Hi]],[\"h3SetToLinkedGeo\",null,[Hi,Tr,Hi]],[\"destroyLinkedPolygon\",null,[Hi]],[\"compact\",Tr,[Hi,Hi,Tr]],[\"uncompact\",Tr,[Hi,Tr,Hi,Tr,Pc]],[\"maxUncompactSize\",Tr,[Hi,Tr,Pc]],[\"h3IsPentagon\",PS,[$r,mi]],[\"h3IsResClassIII\",PS,[$r,mi]],[\"h3GetBaseCell\",Tr,[$r,mi]],[\"h3GetResolution\",Tr,[$r,mi]],[\"maxFaceCount\",Tr,[$r,mi]],[\"h3GetFaces\",null,[$r,mi,Hi]],[\"h3ToParent\",$r,[$r,mi,Pc]],[\"h3ToChildren\",null,[$r,mi,Pc,Hi]],[\"h3ToCenterChild\",$r,[$r,mi,Pc]],[\"maxH3ToChildrenSize\",Tr,[$r,mi,Pc]],[\"h3IndexesAreNeighbors\",PS,[$r,mi,$r,mi]],[\"getH3UnidirectionalEdge\",$r,[$r,mi,$r,mi]],[\"getOriginH3IndexFromUnidirectionalEdge\",$r,[$r,mi]],[\"getDestinationH3IndexFromUnidirectionalEdge\",$r,[$r,mi]],[\"h3UnidirectionalEdgeIsValid\",PS,[$r,mi]],[\"getH3IndexesFromUnidirectionalEdge\",null,[$r,mi,Hi]],[\"getH3UnidirectionalEdgesFromHexagon\",null,[$r,mi,Hi]],[\"getH3UnidirectionalEdgeBoundary\",null,[$r,mi,Hi]],[\"h3Distance\",Tr,[$r,mi,$r,mi]],[\"h3Line\",Tr,[$r,mi,$r,mi,Hi]],[\"h3LineSize\",Tr,[$r,mi,$r,mi]],[\"experimentalH3ToLocalIj\",Tr,[$r,mi,$r,mi,Hi]],[\"experimentalLocalIjToH3\",Tr,[$r,mi,Hi,Hi]],[\"hexAreaM2\",Tr,[Pc]],[\"hexAreaKm2\",Tr,[Pc]],[\"edgeLengthM\",Tr,[Pc]],[\"edgeLengthKm\",Tr,[Pc]],[\"pointDistM\",Tr,[Hi,Hi]],[\"pointDistKm\",Tr,[Hi,Hi]],[\"pointDistRads\",Tr,[Hi,Hi]],[\"cellAreaM2\",Tr,[$r,mi]],[\"cellAreaKm2\",Tr,[$r,mi]],[\"cellAreaRads2\",Tr,[$r,mi]],[\"exactEdgeLengthM\",Tr,[$r,mi]],[\"exactEdgeLengthKm\",Tr,[$r,mi]],[\"exactEdgeLengthRads\",Tr,[$r,mi]],[\"numHexagons\",Tr,[Pc]],[\"getRes0Indexes\",null,[Hi]],[\"res0IndexCount\",Tr],[\"getPentagonIndexes\",null,[Tr,Hi]],[\"pentagonIndexCount\",Tr]],Ma={};pyt.forEach(function(t){Ma[t[0]]=Ic.cwrap.apply(Ic,t)});var xx=16;var IS=8,sae=Ma.sizeOfH3Index(),YQ=Ma.sizeOfGeoCoord(),Ayt=Ma.sizeOfGeoBoundary(),oae=Ma.sizeOfGeoPolygon(),aae=Ma.sizeOfGeofence(),lae=Ma.sizeOfLinkedGeoPolygon(),cae=Ma.sizeOfCoordIJ(),qQ={m:\"m\",m2:\"m2\",km:\"km\",km2:\"km2\",rads:\"rads\",rads2:\"rads2\"};function myt(e){if(typeof e!=\"number\"||e<0||e>15||Math.floor(e)!==e)throw new Error(\"Invalid resolution: \"+e)}var gyt=/[^0-9a-fA-F]/;function bx(e){if(Array.isArray(e)&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1]))return e;if(typeof e!=\"string\"||gyt.test(e))return[0,0];var t=parseInt(e.substring(0,e.length-8),xx),r=parseInt(e.substring(e.length-8),xx);return[r,t]}function ZQ(e){if(e>=0)return e.toString(xx);e=e&2147483647;var t=QQ(8,e.toString(xx)),r=(parseInt(t[0],xx)+8).toString(xx);return t=r+t.substring(1),t}function _yt(e,t){return ZQ(t)+QQ(8,ZQ(e))}function QQ(e,t){for(var r=e-t.length,i=\"\",s=0;s180?r[0]-=360:i<-180&&(r[0]+=360)}}function Myt(e,t,r){let[i,s]=FI(e),n=t.length;n$(t,s);let o=t[0]===t[n-1]?n-1:n;for(let c=0;ce.hexagon},extruded:!0},Np=class e extends Ni{constructor(...t){super(...t),G(this,\"state\",void 0)}initializeState(){e._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}}shouldUpdateState({changeFlags:t}){return this._shouldUseHighPrecision()?t.propsOrDataChanged:t.somethingChanged}updateState({props:t,changeFlags:r}){if(t.highPrecision!==!0&&(r.dataChanged||r.updateTriggersChanged&&r.updateTriggersChanged.getHexagon)){let i=this._calculateH3DataProps();this.setState(i)}this._updateVertices(this.context.viewport)}_calculateH3DataProps(){let t=-1,r=!1,i=!1,{iterable:s,objectInfo:n}=Jc(this.props.data);for(let o of s){n.index++;let c=this.props.getHexagon(o,n),f=KQ(c);if(t<0){if(t=f,!this.props.highPrecision)break}else if(t!==f){i=!0;break}if(XQ(c)){r=!0;break}}return{resolution:t,edgeLengthKM:t>=0?r$(t,\"km\"):0,hasMultipleRes:i,hasPentagon:r}}_shouldUseHighPrecision(){if(this.props.highPrecision===\"auto\"){let{resolution:t,hasPentagon:r,hasMultipleRes:i}=this.state,{viewport:s}=this.context;return!!s?.resolution||i||r||t>=0&&t<=5}return this.props.highPrecision}_updateVertices(t){if(this._shouldUseHighPrecision())return;let{resolution:r,edgeLengthKM:i,centerHex:s}=this.state;if(r<0)return;let n=this.props.centerHexagon||JQ(t.latitude,t.longitude,r);if(s===n)return;if(s){let R=e$(s,n);if(R>=0&&R*i{let N=t.projectFlat(R);return[(N[0]-w)/o[0],(N[1]-I)/o[1]]}),this.setState({centerHex:n,vertices:c})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:t,material:r,coverage:i,extruded:s,wireframe:n,stroked:o,filled:c,lineWidthUnits:f,lineWidthScale:_,lineWidthMinPixels:w,lineWidthMaxPixels:I,getFillColor:R,getElevation:N,getLineColor:j,getLineWidth:Q,transitions:et,updateTriggers:Y}=this.props;return{elevationScale:t,extruded:s,coverage:i,wireframe:n,stroked:o,filled:c,lineWidthUnits:f,lineWidthScale:_,lineWidthMinPixels:w,lineWidthMaxPixels:I,material:r,getElevation:N,getFillColor:R,getLineColor:j,getLineWidth:Q,transitions:et,updateTriggers:{getFillColor:Y.getFillColor,getElevation:Y.getElevation,getLineColor:Y.getLineColor,getLineWidth:Y.getLineWidth}}}_renderPolygonLayer(){let{data:t,getHexagon:r,updateTriggers:i,coverage:s}=this.props,n=this.getSubLayerClass(\"hexagon-cell-hifi\",lf),o=this._getForwardProps();return o.updateTriggers.getPolygon=Iyt(i.getHexagon,s),new n(o,this.getSubLayerProps({id:\"hexagon-cell-hifi\",updateTriggers:o.updateTriggers}),{data:t,_normalize:!1,_windingOrder:\"CCW\",positionFormat:\"XY\",getPolygon:(c,f)=>{let _=r(c,f);return Pyt(i$(_,s))}})}_renderColumnLayer(){let{data:t,getHexagon:r,updateTriggers:i}=this.props,s=this.getSubLayerClass(\"hexagon-cell\",af),n=this._getForwardProps();return n.updateTriggers.getPosition=i.getHexagon,new s(n,this.getSubLayerProps({id:\"hexagon-cell\",flatShading:!0,updateTriggers:n.updateTriggers}),{data:t,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:Eyt.bind(null,r)})}};G(Np,\"defaultProps\",Cyt);G(Np,\"layerName\",\"H3HexagonLayer\");G(Np,\"_checkH3Lib\",()=>{});var{data:Sae,getHexagon:Tae,...Lyt}=Np.defaultProps,kyt={_validate:!0},Mae={...Lyt,...kyt};var s$=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function o$(e,t=!1,r=Float32Array){let i;if(Number.isFinite(e[0]))i=new r(e);else{i=new r(e.length*4);let s=0;for(let n=0;nc[0]),r=e.map(c=>c[1]),i=Math.min.apply(null,t),s=Math.max.apply(null,t),n=Math.min.apply(null,r),o=Math.max.apply(null,r);return[i,n,s,o]}function u$(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}var l$=new Float32Array(12);function tF(e,t=2){let r=0;for(let i of e)for(let s=0;s 0.) {\n maxValue = colorDomain[1];\n minValue = colorDomain[0];\n }\n vIntensityMax = intensity / maxValue;\n vIntensityMin = intensity / minValue;\n}\n`;var A$=`#define SHADER_NAME triangle-layer-fragment-shader\n\nprecision highp float;\n\nuniform float opacity;\nuniform sampler2D texture;\nuniform sampler2D colorTexture;\nuniform float aggregationMode;\n\nvarying vec2 vTexCoords;\nvarying float vIntensityMin;\nvarying float vIntensityMax;\n\nvec4 getLinearColor(float value) {\n float factor = clamp(value * vIntensityMax, 0., 1.);\n vec4 color = texture2D(colorTexture, vec2(factor, 0.5));\n color.a *= min(value * vIntensityMin, 1.0);\n return color;\n}\n\nvoid main(void) {\n vec4 weights = texture2D(texture, vTexCoords);\n float weight = weights.r;\n\n if (aggregationMode > 0.5) {\n weight /= max(1.0, weights.a);\n }\n if (weight <= 0.) {\n discard;\n }\n\n vec4 linearColor = getLinearColor(weight);\n linearColor.a *= opacity;\n gl_FragColor =linearColor;\n}\n`;var Sx=class extends dn{getShaders(){return{vs:p$,fs:A$,modules:[Rs]}}initializeState({gl:t}){this.getAttributeManager().add({positions:{size:3,noAlloc:!0},texCoords:{size:2,noAlloc:!0}}),this.setState({model:this._getModel(t)})}_getModel(t){let{vertexCount:r}=this.props;return new fn(t,{...this.getShaders(),id:this.props.id,geometry:new $n({drawMode:6,vertexCount:r})})}draw({uniforms:t}){let{model:r}=this.state,{texture:i,maxTexture:s,colorTexture:n,intensity:o,threshold:c,aggregationMode:f,colorDomain:_}=this.props;r.setUniforms({...t,texture:i,maxTexture:s,colorTexture:n,intensity:o,threshold:c,aggregationMode:f,colorDomain:_}).draw()}};G(Sx,\"layerName\",\"TriangleLayer\");var m$=`attribute vec3 positions;\nattribute vec3 positions64Low;\nattribute float weights;\nvarying vec4 weightsTexture;\nuniform float radiusPixels;\nuniform float textureWidth;\nuniform vec4 commonBounds;\nuniform float weightsScale;\nvoid main()\n{\n weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);\n\n float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);\n gl_PointSize = radiusTexels * 2.;\n\n vec3 commonPosition = project_position(positions, positions64Low);\n gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;\n gl_Position.xy = (gl_Position.xy * 2.) - (1.);\n}\n`;var g$=`varying vec4 weightsTexture;\nfloat gaussianKDE(float u){\n return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);\n}\nvoid main()\n{\n float dist = length(gl_PointCoord - vec2(0.5, 0.5));\n if (dist > 0.5) {\n discard;\n }\n gl_FragColor = weightsTexture * gaussianKDE(2. * dist);\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;var _$=`attribute vec4 inTexture;\nvarying vec4 outTexture;\n\nvoid main()\n{\noutTexture = inTexture;\ngl_Position = vec4(0, 0, 0, 1.);\ngl_PointSize = 1.0;\n}\n`;var y$=`varying vec4 outTexture;\nvoid main() {\n gl_FragColor = outTexture;\n gl_FragColor.g = outTexture.r / max(1.0, outTexture.a);\n}\n`;var Dyt=2,eF={mipmaps:!1,parameters:{10240:9729,10241:9729,10242:33071,10243:33071},dataFormat:6408},v$=[0,0],Oyt={SUM:0,MEAN:1},Byt={getPosition:{type:\"accessor\",value:e=>e.position},getWeight:{type:\"accessor\",value:1},intensity:{type:\"number\",min:0,value:1},radiusPixels:{type:\"number\",min:1,max:100,value:50},colorRange:s$,threshold:{type:\"number\",min:0,max:1,value:.05},colorDomain:{type:\"array\",value:null,optional:!0},aggregation:\"SUM\",weightsTextureSize:{type:\"number\",min:128,max:2048,value:2048},debounceTimeout:{type:\"number\",min:0,max:1e3,value:500}},Fyt=[Ii.BLEND_EQUATION_MINMAX,Ii.TEXTURE_FLOAT],zyt=[Ii.COLOR_ATTACHMENT_RGBA32F,Ii.FLOAT_BLEND],Nyt={data:{props:[\"radiusPixels\"]}},Up=class extends wx{constructor(...t){super(...t),G(this,\"state\",void 0)}initializeState(){let{gl:t}=this.context;if(!Oh(t,Fyt)){this.setState({supported:!1}),or.error(\"HeatmapLayer: \".concat(this.id,\" is not supported on this browser\"))();return}super.initializeAggregationLayer(Nyt),this.setState({supported:!0,colorDomain:v$}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState(t){this.state.supported&&(super.updateState(t),this._updateHeatmapState(t))}_updateHeatmapState(t){let{props:r,oldProps:i}=t,s=this._getChangeFlags(t);(s.dataChanged||s.viewportChanged)&&(s.boundsChanged=this._updateBounds(s.dataChanged),this._updateTextureRenderingBounds()),s.dataChanged||s.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):s.viewportZoomChanged&&this._debouncedUpdateWeightmap(),r.colorRange!==i.colorRange&&this._updateColorTexture(t),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:t.context.viewport.zoom})}renderLayers(){if(!this.state.supported)return[];let{weightsTexture:t,triPositionBuffer:r,triTexCoordBuffer:i,maxWeightsTexture:s,colorTexture:n,colorDomain:o}=this.state,{updateTriggers:c,intensity:f,threshold:_,aggregation:w}=this.props,I=this.getSubLayerClass(\"triangle\",Sx);return new I(this.getSubLayerProps({id:\"triangle-layer\",updateTriggers:c}),{coordinateSystem:Yr.DEFAULT,data:{attributes:{positions:r,texCoords:i}},vertexCount:4,maxTexture:s,colorTexture:n,aggregationMode:Oyt[w]||0,texture:t,intensity:f,threshold:_,colorDomain:o})}finalizeState(t){super.finalizeState(t);let{weightsTransform:r,weightsTexture:i,maxWeightTransform:s,maxWeightsTexture:n,triPositionBuffer:o,triTexCoordBuffer:c,colorTexture:f,updateTimer:_}=this.state;r?.delete(),i?.delete(),s?.delete(),n?.delete(),o?.delete(),c?.delete(),f?.delete(),_&&clearTimeout(_)}_getAttributeManager(){return new Xf(this.context.gl,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(t){let r={},{dimensions:i}=this.state;r.dataChanged=this.isAttributeChanged()||this.isAggregationDirty(t,{compareAll:!0,dimension:i.data}),r.viewportChanged=t.changeFlags.viewportChanged;let{zoom:s}=this.state;return(!t.context.viewport||t.context.viewport.zoom!==s)&&(r.viewportZoomChanged=!0),r}_createTextures(){let{gl:t}=this.context,{textureSize:r,format:i,type:s}=this.state;this.setState({weightsTexture:new pi(t,{width:r,height:r,format:i,type:s,...eF}),maxWeightsTexture:new pi(t,{format:i,type:s,...eF})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:5130,accessor:\"getPosition\"},weights:{size:1,accessor:\"getWeight\"}}),this.setState({positionAttributeName:\"positions\"})}_setupTextureParams(){let{gl:t}=this.context,{weightsTextureSize:r}=this.props,i=Math.min(r,wy(t,3379)),s=Oh(t,zyt),{format:n,type:o}=d$({gl:t,floatTargetSupport:s}),c=s?1:1/255;this.setState({textureSize:i,format:n,type:o,weightsScale:c}),s||or.warn(\"HeatmapLayer: \".concat(this.id,\" rendering to float texture not supported, fallingback to low precession format\"))()}getShaders(t){return super.getShaders(t===\"max-weights-transform\"?{vs:_$,_fs:y$}:{vs:m$,_fs:g$})}_createWeightsTransform(t={}){var r;let{gl:i}=this.context,{weightsTransform:s}=this.state,{weightsTexture:n}=this.state;(r=s)===null||r===void 0||r.delete(),s=new nc(i,{id:\"\".concat(this.id,\"-weights-transform\"),elementCount:1,_targetTexture:n,_targetTextureVarying:\"weightsTexture\",...t}),this.setState({weightsTransform:s})}_setupResources(){let{gl:t}=this.context;this._createTextures();let{textureSize:r,weightsTexture:i,maxWeightsTexture:s}=this.state,n=this.getShaders(\"weights-transform\");this._createWeightsTransform(n);let o=this.getShaders(\"max-weights-transform\"),c=new nc(t,{id:\"\".concat(this.id,\"-max-weights-transform\"),_sourceTextures:{inTexture:i},_targetTexture:s,_targetTextureVarying:\"outTexture\",...o,elementCount:r*r});this.setState({weightsTexture:i,maxWeightsTexture:s,maxWeightTransform:c,zoom:null,triPositionBuffer:new Fr(t,{byteLength:48,accessor:{size:3}}),triTexCoordBuffer:new Fr(t,{byteLength:48,accessor:{size:2}})})}updateShaders(t){this._createWeightsTransform(t)}_updateMaxWeightValue(){let{maxWeightTransform:t}=this.state;t.run({parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32776}})}_updateBounds(t=!1){let{viewport:r}=this.context,i=[r.unproject([0,0]),r.unproject([r.width,0]),r.unproject([r.width,r.height]),r.unproject([0,r.height])].map(c=>c.map(Math.fround)),s=c$(i),n={visibleWorldBounds:s,viewportCorners:i},o=!1;if(t||!this.state.worldBounds||!u$(this.state.worldBounds,s)){let c=this._worldToCommonBounds(s),f=this._commonToWorldBounds(c);this.props.coordinateSystem===Yr.LNGLAT&&(f[1]=Math.max(f[1],-85.051129),f[3]=Math.min(f[3],85.051129),f[0]=Math.max(f[0],-360),f[2]=Math.min(f[2],360));let _=this._worldToCommonBounds(f);n.worldBounds=f,n.normalizedCommonBounds=_,o=!0}return this.setState(n),o}_updateTextureRenderingBounds(){let{triPositionBuffer:t,triTexCoordBuffer:r,normalizedCommonBounds:i,viewportCorners:s}=this.state,{viewport:n}=this.context;t.subData(tF(s,3));let o=s.map(c=>f$(n.projectPosition(c),i));r.subData(tF(o,2))}_updateColorTexture(t){let{colorRange:r}=t.props,{colorTexture:i}=this.state,s=o$(r,!1,Uint8Array);i?i.setImageData({data:s,width:r.length}):i=new pi(this.context.gl,{data:s,width:r.length,height:1,...eF}),this.setState({colorTexture:i})}_updateWeightmap(){let{radiusPixels:t,colorDomain:r,aggregation:i}=this.props,{weightsTransform:s,worldBounds:n,textureSize:o,weightsTexture:c,weightsScale:f}=this.state;this.state.isWeightMapDirty=!1;let _=this._worldToCommonBounds(n,{useLayerCoordinateSystem:!0});if(r&&i===\"SUM\"){let{viewport:I}=this.context,R=I.distanceScales.metersPerUnit[2]*(_[2]-_[0])/o;this.state.colorDomain=r.map(N=>N*R*f)}else this.state.colorDomain=r||v$;let w={radiusPixels:t,commonBounds:_,textureWidth:o,weightsScale:f};s.update({elementCount:this.getNumInstances()}),Mn(this.context.gl,{clearColor:[0,0,0,0]},()=>{s.run({uniforms:w,parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32774},clearRenderTarget:!0,attributes:this.getAttributes(),moduleSettings:this.getModuleSettings()})}),this._updateMaxWeightValue(),c.setParameters({10240:9729,10241:9729})}_debouncedUpdateWeightmap(t=!1){let{updateTimer:r}=this.state,{debounceTimeout:i}=this.props;t?(r=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(r),r=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),i)),this.setState({updateTimer:r})}_worldToCommonBounds(t,r={}){let{useLayerCoordinateSystem:i=!1}=r,[s,n,o,c]=t,{viewport:f}=this.context,{textureSize:_}=this.state,{coordinateSystem:w}=this.props,I=i&&(w===Yr.LNGLAT_OFFSETS||w===Yr.METER_OFFSETS),R=I?f.projectPosition(this.props.coordinateOrigin):[0,0],N=_*Dyt/f.scale,j,Q;return i&&!I?(j=this.projectPosition([s,n,0]),Q=this.projectPosition([o,c,0])):(j=f.projectPosition([s,n,0]),Q=f.projectPosition([o,c,0])),h$([j[0]-R[0],j[1]-R[1],Q[0]-R[0],Q[1]-R[1]],N,N)}_commonToWorldBounds(t){let[r,i,s,n]=t,{viewport:o}=this.context,c=o.unprojectPosition([r,i]),f=o.unprojectPosition([s,n]);return c.slice(0,2).concat(f.slice(0,2))}};G(Up,\"layerName\",\"HeatmapLayer\");G(Up,\"defaultProps\",Byt);var{data:Ale,getPosition:mle,...Uyt}=Up.defaultProps,x$={_validate:!0},Vyt={...Uyt,...x$},CS=class extends Ni{static defaultProps=Vyt;static layerName=\"GeoArrowHeatmapLayer\";renderLayers(){let{data:t}=this.props,r=ws(t,Kn.POINT);if(r!==null)return this._renderLayersPoint(r);let i=this.props.getPosition;if(i!==void 0&&Ci.isPointVector(i))return this._renderLayersPoint(i);throw new Error(\"getPosition not GeoArrow point\")}_renderLayersPoint(t){let{data:r}=this.props;this.props._validate&&(_r(Ci.isPointVector(t)),no(this.props,r));let[i,s]=io(this.props,[\"getPosition\"]),n=vo(r.data),o=[];for(let c=0;cr.text()),earcutWorkerPool:null}}async initEarcutPool(){if(this.state.earcutWorkerPool)return this.state.earcutWorkerPool;let t=await this.state.earcutWorkerRequest;if(!t||window?.location?.href.startsWith(\"file://\"))return null;try{let r=RX(()=>LX(kX.fromText(t)),8);return this.state.earcutWorkerPool=r,this.state.earcutWorkerPool}catch{return null}}async finalizeState(t){await this.state?.earcutWorkerPool?.terminate(),console.log(\"terminated\")}async updateData(){let{data:t}=this.props,r=await this._updateEarcut(t),i=vo(t.data);this.setState({table:this.props.data,triangles:r,tableOffsets:i})}async _updateEarcut(t){let r=ws(t,Kn.POLYGON);if(r!==null)return this._earcutPolygonVector(r);let i=ws(t,Kn.MULTIPOLYGON);if(i!==null)return this._earcutMultiPolygonVector(i);let s=this.props.getPolygon;if(s!==void 0&&Ci.isPolygonVector(s))return this._earcutPolygonVector(s);if(s!==void 0&&Ci.isMultiPolygonVector(s))return this._earcutMultiPolygonVector(s);throw new Error(\"geometryColumn not Polygon or MultiPolygon\")}async _earcutPolygonVector(t){let r=await this.initEarcutPool();if(!r)return this._earcutPolygonVectorMainThread(t);let i=new Array(t.data.length);console.time(\"earcut\");for(let s=0;s{let _=await f(LF(o,c));i[s]=_})}return await r.completed(),console.timeEnd(\"earcut\"),i}_earcutPolygonVectorMainThread(t){let r=new Array(t.data.length);for(let i=0;i{let w=await _(LF(c,f));i[s]=w})}return await r.completed(),console.timeEnd(\"earcut\"),i}_earcutMultiPolygonVectorMainThread(t){let r=new Array(t.data.length);for(let i=0;iDX(t))):e}function OX(e){if(\"data\"in e)return new xr(e.data.map(o=>OX(o)));let t=e.valueOffsets,r=vi.getMultiPolygonChild(e),i=r.valueOffsets,s=vi.getPolygonChild(r),n=new Int32Array(t.length);for(let o=0;o{this.table=O2(this.model.get(t))};this.model.on(`change:${t}`,r),this.callbacks.set(`change:${t}`,r)}},tC=class extends mf{static layerType=\"arc\";greatCircle;numSegments;widthUnits;widthScale;widthMinPixels;widthMaxPixels;getSourcePosition;getTargetPosition;getSourceColor;getTargetColor;getWidth;getHeight;getTilt;constructor(t,r){super(t,r),this.initRegularAttribute(\"great_circle\",\"greatCircle\"),this.initRegularAttribute(\"num_segments\",\"numSegments\"),this.initRegularAttribute(\"width_units\",\"widthUnits\"),this.initRegularAttribute(\"width_scale\",\"widthScale\"),this.initRegularAttribute(\"width_min_pixels\",\"widthMinPixels\"),this.initRegularAttribute(\"width_max_pixels\",\"widthMaxPixels\"),this.initVectorizedAccessor(\"get_source_position\",\"getSourcePosition\"),this.initVectorizedAccessor(\"get_target_position\",\"getTargetPosition\"),this.initVectorizedAccessor(\"get_source_color\",\"getSourceColor\"),this.initVectorizedAccessor(\"get_target_color\",\"getTargetColor\"),this.initVectorizedAccessor(\"get_width\",\"getWidth\"),this.initVectorizedAccessor(\"get_height\",\"getHeight\"),this.initVectorizedAccessor(\"get_tilt\",\"getTilt\")}layerProps(){return{data:this.table,getSourcePosition:this.getSourcePosition,getTargetPosition:this.getTargetPosition,...Jt(this.greatCircle)&&{greatCircle:this.greatCircle},...Jt(this.numSegments)&&{numSegments:this.numSegments},...Jt(this.widthUnits)&&{widthUnits:this.widthUnits},...Jt(this.widthScale)&&{widthScale:this.widthScale},...Jt(this.widthMinPixels)&&{widthMinPixels:this.widthMinPixels},...Jt(this.widthMaxPixels)&&{widthMaxPixels:this.widthMaxPixels},...Jt(this.getSourceColor)&&{getSourceColor:this.getSourceColor},...Jt(this.getTargetColor)&&{getTargetColor:this.getTargetColor},...Jt(this.getWidth)&&{getWidth:this.getWidth},...Jt(this.getHeight)&&{getHeight:this.getHeight},...Jt(this.getTilt)&&{getTilt:this.getTilt}}}render(){return new wS({...this.baseLayerProps(),...this.layerProps()})}},eC=class extends Ug{static layerType=\"bitmap\";image;bounds;desaturate;transparentColor;tintColor;constructor(t,r){super(t,r),this.initRegularAttribute(\"image\",\"image\"),this.initRegularAttribute(\"bounds\",\"bounds\"),this.initRegularAttribute(\"desaturate\",\"desaturate\"),this.initRegularAttribute(\"transparent_color\",\"transparentColor\"),this.initRegularAttribute(\"tint_color\",\"tintColor\")}layerProps(){return{...Jt(this.image)&&{image:this.image},...Jt(this.bounds)&&{bounds:this.bounds},...Jt(this.desaturate)&&{desaturate:this.desaturate},...Jt(this.transparentColor)&&{transparentColor:this.transparentColor},...Jt(this.tintColor)&&{tintColor:this.tintColor}}}render(){return new Mp({...this.baseLayerProps(),...this.layerProps(),data:void 0,pickable:!1})}},rC=class extends Ug{static layerType=\"bitmap-tile\";data;tileSize;zoomOffset;maxZoom;minZoom;extent;maxCacheSize;maxCacheByteSize;refinementStrategy;maxRequests;desaturate;transparentColor;tintColor;constructor(t,r){super(t,r),this.initRegularAttribute(\"data\",\"data\"),this.initRegularAttribute(\"tile_size\",\"tileSize\"),this.initRegularAttribute(\"zoom_offset\",\"zoomOffset\"),this.initRegularAttribute(\"max_zoom\",\"maxZoom\"),this.initRegularAttribute(\"min_zoom\",\"minZoom\"),this.initRegularAttribute(\"extent\",\"extent\"),this.initRegularAttribute(\"max_cache_size\",\"maxCacheSize\"),this.initRegularAttribute(\"max_cache_byte_size\",\"maxCacheByteSize\"),this.initRegularAttribute(\"refinement_strategy\",\"refinementStrategy\"),this.initRegularAttribute(\"max_requests\",\"maxRequests\"),this.initRegularAttribute(\"desaturate\",\"desaturate\"),this.initRegularAttribute(\"transparent_color\",\"transparentColor\"),this.initRegularAttribute(\"tint_color\",\"tintColor\")}bitmapLayerProps(){return{...Jt(this.desaturate)&&{desaturate:this.desaturate},...Jt(this.transparentColor)&&{transparentColor:this.transparentColor},...Jt(this.tintColor)&&{tintColor:this.tintColor}}}layerProps(){return{data:this.data,...Jt(this.tileSize)&&{tileSize:this.tileSize},...Jt(this.zoomOffset)&&{zoomOffset:this.zoomOffset},...Jt(this.maxZoom)&&{maxZoom:this.maxZoom},...Jt(this.minZoom)&&{minZoom:this.minZoom},...Jt(this.extent)&&{extent:this.extent},...Jt(this.maxCacheSize)&&{maxCacheSize:this.maxCacheSize},...Jt(this.maxCacheByteSize)&&{maxCacheByteSize:this.maxCacheByteSize},...Jt(this.refinementStrategy)&&{refinementStrategy:this.refinementStrategy},...Jt(this.maxRequests)&&{maxRequests:this.maxRequests}}}render(){return new Lm({...this.baseLayerProps(),...this.layerProps(),renderSubLayers:t=>{let[r,i]=t.tile.boundingBox;return new Mp(t,{...this.bitmapLayerProps(),data:void 0,image:t.data,bounds:[r[0],r[1],i[0],i[1]]})}})}},iC=class extends mf{static layerType=\"column\";diskResolution;radius;angle;vertices;offset;coverage;elevationScale;filled;stroked;extruded;wireframe;flatShading;radiusUnits;lineWidthUnits;lineWidthScale;lineWidthMinPixels;lineWidthMaxPixels;material;getPosition;getFillColor;getLineColor;getElevation;getLineWidth;constructor(t,r){super(t,r),this.initRegularAttribute(\"disk_resolution\",\"diskResolution\"),this.initRegularAttribute(\"radius\",\"radius\"),this.initRegularAttribute(\"angle\",\"angle\"),this.initRegularAttribute(\"vertices\",\"vertices\"),this.initRegularAttribute(\"offset\",\"offset\"),this.initRegularAttribute(\"coverage\",\"coverage\"),this.initRegularAttribute(\"elevation_scale\",\"elevationScale\"),this.initRegularAttribute(\"filled\",\"filled\"),this.initRegularAttribute(\"stroked\",\"stroked\"),this.initRegularAttribute(\"extruded\",\"extruded\"),this.initRegularAttribute(\"wireframe\",\"wireframe\"),this.initRegularAttribute(\"flat_shading\",\"flatShading\"),this.initRegularAttribute(\"radius_units\",\"radiusUnits\"),this.initRegularAttribute(\"line_width_units\",\"lineWidthUnits\"),this.initRegularAttribute(\"line_width_scale\",\"lineWidthScale\"),this.initRegularAttribute(\"line_width_min_pixels\",\"lineWidthMinPixels\"),this.initRegularAttribute(\"line_width_max_pixels\",\"lineWidthMaxPixels\"),this.initRegularAttribute(\"material\",\"material\"),this.initVectorizedAccessor(\"get_position\",\"getPosition\"),this.initVectorizedAccessor(\"get_fill_color\",\"getFillColor\"),this.initVectorizedAccessor(\"get_line_color\",\"getLineColor\"),this.initVectorizedAccessor(\"get_elevation\",\"getElevation\"),this.initVectorizedAccessor(\"get_line_width\",\"getLineWidth\")}layerProps(){return{data:this.table,...Jt(this.diskResolution)&&{diskResolution:this.diskResolution},...Jt(this.radius)&&{radius:this.radius},...Jt(this.angle)&&{angle:this.angle},...Jt(this.vertices)&&this.vertices!==void 0&&{vertices:this.vertices},...Jt(this.offset)&&{offset:this.offset},...Jt(this.coverage)&&{coverage:this.coverage},...Jt(this.elevationScale)&&{elevationScale:this.elevationScale},...Jt(this.filled)&&{filled:this.filled},...Jt(this.stroked)&&{stroked:this.stroked},...Jt(this.extruded)&&{extruded:this.extruded},...Jt(this.wireframe)&&{wireframe:this.wireframe},...Jt(this.flatShading)&&{flatShading:this.flatShading},...Jt(this.radiusUnits)&&{radiusUnits:this.radiusUnits},...Jt(this.lineWidthUnits)&&{lineWidthUnits:this.lineWidthUnits},...Jt(this.lineWidthScale)&&{lineWidthScale:this.lineWidthScale},...Jt(this.lineWidthMinPixels)&&{lineWidthMinPixels:this.lineWidthMinPixels},...Jt(this.lineWidthMaxPixels)&&{lineWidthMaxPixels:this.lineWidthMaxPixels},...Jt(this.material)&&{material:this.material},...Jt(this.getPosition)&&{getPosition:this.getPosition},...Jt(this.getFillColor)&&{getFillColor:this.getFillColor},...Jt(this.getLineColor)&&{getLineColor:this.getLineColor},...Jt(this.getElevation)&&{getElevation:this.getElevation},...Jt(this.getLineWidth)&&{getLineWidth:this.getLineWidth}}}render(){return new SS({...this.baseLayerProps(),...this.layerProps()})}},nC=class extends mf{static layerType=\"heatmap\";radiusPixels;colorRange;intensity;threshold;colorDomain;aggregation;weightsTextureSize;debounceTimeout;getPosition;getWeight;constructor(t,r){super(t,r),this.initRegularAttribute(\"radius_pixels\",\"radiusPixels\"),this.initRegularAttribute(\"color_range\",\"colorRange\"),this.initRegularAttribute(\"intensity\",\"intensity\"),this.initRegularAttribute(\"threshold\",\"threshold\"),this.initRegularAttribute(\"color_domain\",\"colorDomain\"),this.initRegularAttribute(\"aggregation\",\"aggregation\"),this.initRegularAttribute(\"weights_texture_size\",\"weightsTextureSize\"),this.initRegularAttribute(\"debounce_timeout\",\"debounceTimeout\"),this.initVectorizedAccessor(\"get_position\",\"getPosition\"),this.initVectorizedAccessor(\"get_weight\",\"getWeight\")}layerProps(){return{data:this.table,...Jt(this.radiusPixels)&&{radiusPixels:this.radiusPixels},...Jt(this.colorRange)&&{colorRange:this.colorRange},...Jt(this.intensity)&&{intensity:this.intensity},...Jt(this.threshold)&&{threshold:this.threshold},...Jt(this.colorDomain)&&{colorDomain:this.colorDomain},...Jt(this.aggregation)&&{aggregation:this.aggregation},...Jt(this.weightsTextureSize)&&{weightsTextureSize:this.weightsTextureSize},...Jt(this.debounceTimeout)&&{debounceTimeout:this.debounceTimeout},...Jt(this.getPosition)&&{getPosition:this.getPosition},...Jt(this.getWeight)&&{getWeight:this.getWeight}}}render(){return new CS({...this.baseLayerProps(),...this.layerProps()})}},QS=class extends mf{static layerType=\"path\";widthUnits;widthScale;widthMinPixels;widthMaxPixels;jointRounded;capRounded;miterLimit;billboard;getColor;getWidth;constructor(t,r){super(t,r),this.initRegularAttribute(\"width_units\",\"widthUnits\"),this.initRegularAttribute(\"width_scale\",\"widthScale\"),this.initRegularAttribute(\"width_min_pixels\",\"widthMinPixels\"),this.initRegularAttribute(\"width_max_pixels\",\"widthMaxPixels\"),this.initRegularAttribute(\"joint_rounded\",\"jointRounded\"),this.initRegularAttribute(\"cap_rounded\",\"capRounded\"),this.initRegularAttribute(\"miter_limit\",\"miterLimit\"),this.initRegularAttribute(\"billboard\",\"billboard\"),this.initVectorizedAccessor(\"get_color\",\"getColor\"),this.initVectorizedAccessor(\"get_width\",\"getWidth\")}layerProps(){return{data:this.table,...Jt(this.widthUnits)&&{widthUnits:this.widthUnits},...Jt(this.widthScale)&&{widthScale:this.widthScale},...Jt(this.widthMinPixels)&&{widthMinPixels:this.widthMinPixels},...Jt(this.widthMaxPixels)&&{widthMaxPixels:this.widthMaxPixels},...Jt(this.jointRounded)&&{jointRounded:this.jointRounded},...Jt(this.capRounded)&&{capRounded:this.capRounded},...Jt(this.miterLimit)&&{miterLimit:this.miterLimit},...Jt(this.billboard)&&{billboard:this.billboard},...Jt(this.getColor)&&{getColor:this.getColor},...Jt(this.getWidth)&&{getWidth:this.getWidth}}}render(){return new e_({...this.baseLayerProps(),...this.layerProps()})}},sC=class extends mf{static layerType=\"point-cloud\";sizeUnits;pointSize;getColor;getNormal;constructor(t,r){super(t,r),this.initRegularAttribute(\"size_units\",\"sizeUnits\"),this.initRegularAttribute(\"point_size\",\"pointSize\"),this.initVectorizedAccessor(\"get_color\",\"getColor\"),this.initVectorizedAccessor(\"get_normal\",\"getNormal\")}layerProps(){return{data:this.table,...Jt(this.sizeUnits)&&{sizeUnits:this.sizeUnits},...Jt(this.pointSize)&&{pointSize:this.pointSize},...Jt(this.getColor)&&{getColor:this.getColor},...Jt(this.getNormal)&&{getNormal:this.getNormal}}}render(){return new LS({...this.baseLayerProps(),...this.layerProps()})}},oC=class extends mf{static layerType=\"polygon\";stroked;filled;extruded;wireframe;elevationScale;lineWidthUnits;lineWidthScale;lineWidthMinPixels;lineWidthMaxPixels;lineJointRounded;lineMiterLimit;getFillColor;getLineColor;getLineWidth;getElevation;constructor(t,r){super(t,r),this.initRegularAttribute(\"stroked\",\"stroked\"),this.initRegularAttribute(\"filled\",\"filled\"),this.initRegularAttribute(\"extruded\",\"extruded\"),this.initRegularAttribute(\"wireframe\",\"wireframe\"),this.initRegularAttribute(\"elevation_scale\",\"elevationScale\"),this.initRegularAttribute(\"line_width_units\",\"lineWidthUnits\"),this.initRegularAttribute(\"line_width_scale\",\"lineWidthScale\"),this.initRegularAttribute(\"line_width_min_pixels\",\"lineWidthMinPixels\"),this.initRegularAttribute(\"line_width_max_pixels\",\"lineWidthMaxPixels\"),this.initRegularAttribute(\"line_joint_rounded\",\"lineJointRounded\"),this.initRegularAttribute(\"line_miter_limit\",\"lineMiterLimit\"),this.initVectorizedAccessor(\"get_fill_color\",\"getFillColor\"),this.initVectorizedAccessor(\"get_line_color\",\"getLineColor\"),this.initVectorizedAccessor(\"get_line_width\",\"getLineWidth\"),this.initVectorizedAccessor(\"get_elevation\",\"getElevation\")}layerProps(){return{data:this.table,...Jt(this.stroked)&&{stroked:this.stroked},...Jt(this.filled)&&{filled:this.filled},...Jt(this.extruded)&&{extruded:this.extruded},...Jt(this.wireframe)&&{wireframe:this.wireframe},...Jt(this.elevationScale)&&{elevationScale:this.elevationScale},...Jt(this.lineWidthUnits)&&{lineWidthUnits:this.lineWidthUnits},...Jt(this.lineWidthScale)&&{lineWidthScale:this.lineWidthScale},...Jt(this.lineWidthMinPixels)&&{lineWidthMinPixels:this.lineWidthMinPixels},...Jt(this.lineWidthMaxPixels)&&{lineWidthMaxPixels:this.lineWidthMaxPixels},...Jt(this.lineJointRounded)&&{lineJointRounded:this.lineJointRounded},...Jt(this.lineMiterLimit)&&{lineMiterLimit:this.lineMiterLimit},...Jt(this.getFillColor)&&{getFillColor:this.getFillColor},...Jt(this.getLineColor)&&{getLineColor:this.getLineColor},...Jt(this.getLineWidth)&&{getLineWidth:this.getLineWidth},...Jt(this.getElevation)&&{getElevation:this.getElevation}}}render(){return new qS({...this.baseLayerProps(),...this.layerProps()})}},$S=class extends mf{static layerType=\"scatterplot\";radiusUnits;radiusScale;radiusMinPixels;radiusMaxPixels;lineWidthUnits;lineWidthScale;lineWidthMinPixels;lineWidthMaxPixels;stroked;filled;billboard;antialiasing;getRadius;getFillColor;getLineColor;getLineWidth;constructor(t,r){super(t,r),this.initRegularAttribute(\"radius_units\",\"radiusUnits\"),this.initRegularAttribute(\"radius_scale\",\"radiusScale\"),this.initRegularAttribute(\"radius_min_pixels\",\"radiusMinPixels\"),this.initRegularAttribute(\"radius_max_pixels\",\"radiusMaxPixels\"),this.initRegularAttribute(\"line_width_units\",\"lineWidthUnits\"),this.initRegularAttribute(\"line_width_scale\",\"lineWidthScale\"),this.initRegularAttribute(\"line_width_min_pixels\",\"lineWidthMinPixels\"),this.initRegularAttribute(\"line_width_max_pixels\",\"lineWidthMaxPixels\"),this.initRegularAttribute(\"stroked\",\"stroked\"),this.initRegularAttribute(\"filled\",\"filled\"),this.initRegularAttribute(\"billboard\",\"billboard\"),this.initRegularAttribute(\"antialiasing\",\"antialiasing\"),this.initVectorizedAccessor(\"get_radius\",\"getRadius\"),this.initVectorizedAccessor(\"get_fill_color\",\"getFillColor\"),this.initVectorizedAccessor(\"get_line_color\",\"getLineColor\"),this.initVectorizedAccessor(\"get_line_width\",\"getLineWidth\")}layerProps(){return{data:this.table,...Jt(this.radiusUnits)&&{radiusUnits:this.radiusUnits},...Jt(this.radiusScale)&&{radiusScale:this.radiusScale},...Jt(this.radiusMinPixels)&&{radiusMinPixels:this.radiusMinPixels},...Jt(this.radiusMaxPixels)&&{radiusMaxPixels:this.radiusMaxPixels},...Jt(this.lineWidthUnits)&&{lineWidthUnits:this.lineWidthUnits},...Jt(this.lineWidthScale)&&{lineWidthScale:this.lineWidthScale},...Jt(this.lineWidthMinPixels)&&{lineWidthMinPixels:this.lineWidthMinPixels},...Jt(this.lineWidthMaxPixels)&&{lineWidthMaxPixels:this.lineWidthMaxPixels},...Jt(this.stroked)&&{stroked:this.stroked},...Jt(this.filled)&&{filled:this.filled},...Jt(this.billboard)&&{billboard:this.billboard},...Jt(this.antialiasing)&&{antialiasing:this.antialiasing},...Jt(this.getRadius)&&{getRadius:this.getRadius},...Jt(this.getFillColor)&&{getFillColor:this.getFillColor},...Jt(this.getLineColor)&&{getLineColor:this.getLineColor},...Jt(this.getLineWidth)&&{getLineWidth:this.getLineWidth}}}render(){return new ZS({...this.baseLayerProps(),...this.layerProps()})}},XS=class extends mf{static layerType=\"solid-polygon\";filled;extruded;wireframe;elevationScale;getElevation;getFillColor;getLineColor;constructor(t,r){super(t,r),this.initRegularAttribute(\"filled\",\"filled\"),this.initRegularAttribute(\"extruded\",\"extruded\"),this.initRegularAttribute(\"wireframe\",\"wireframe\"),this.initRegularAttribute(\"elevation_scale\",\"elevationScale\"),this.initVectorizedAccessor(\"get_elevation\",\"getElevation\"),this.initVectorizedAccessor(\"get_fill_color\",\"getFillColor\"),this.initVectorizedAccessor(\"get_line_color\",\"getLineColor\")}layerProps(){return{data:this.table,...Jt(this.filled)&&{filled:this.filled},...Jt(this.extruded)&&{extruded:this.extruded},...Jt(this.wireframe)&&{wireframe:this.wireframe},...Jt(this.elevationScale)&&{elevationScale:this.elevationScale},...Jt(this.getElevation)&&{getElevation:this.getElevation},...Jt(this.getFillColor)&&{getFillColor:this.getFillColor},...Jt(this.getLineColor)&&{getLineColor:this.getLineColor}}}render(){return new o_({...this.baseLayerProps(),...this.layerProps()})}},aC=class extends mf{static layerType=\"text\";billboard;sizeScale;sizeUnits;sizeMinPixels;sizeMaxPixels;getBackgroundColor;getBorderColor;getBorderWidth;backgroundPadding;characterSet;fontFamily;fontWeight;lineHeight;outlineWidth;outlineColor;fontSettings;wordBreak;maxWidth;getText;getPosition;getColor;getSize;getAngle;getTextAnchor;getAlignmentBaseline;getPixelOffset;constructor(t,r){super(t,r),this.initRegularAttribute(\"billboard\",\"billboard\"),this.initRegularAttribute(\"size_scale\",\"sizeScale\"),this.initRegularAttribute(\"size_units\",\"sizeUnits\"),this.initRegularAttribute(\"size_min_pixels\",\"sizeMinPixels\"),this.initRegularAttribute(\"size_max_pixels\",\"sizeMaxPixels\"),this.initRegularAttribute(\"background_padding\",\"backgroundPadding\"),this.initRegularAttribute(\"character_set\",\"characterSet\"),this.initRegularAttribute(\"font_family\",\"fontFamily\"),this.initRegularAttribute(\"font_weight\",\"fontWeight\"),this.initRegularAttribute(\"line_height\",\"lineHeight\"),this.initRegularAttribute(\"outline_width\",\"outlineWidth\"),this.initRegularAttribute(\"outline_color\",\"outlineColor\"),this.initRegularAttribute(\"font_settings\",\"fontSettings\"),this.initRegularAttribute(\"word_break\",\"wordBreak\"),this.initRegularAttribute(\"max_width\",\"maxWidth\"),this.initVectorizedAccessor(\"get_background_color\",\"getBackgroundColor\"),this.initVectorizedAccessor(\"get_border_color\",\"getBorderColor\"),this.initVectorizedAccessor(\"get_border_width\",\"getBorderWidth\"),this.initVectorizedAccessor(\"get_text\",\"getText\"),this.initVectorizedAccessor(\"get_position\",\"getPosition\"),this.initVectorizedAccessor(\"get_color\",\"getColor\"),this.initVectorizedAccessor(\"get_size\",\"getSize\"),this.initVectorizedAccessor(\"get_angle\",\"getAngle\"),this.initVectorizedAccessor(\"get_text_anchor\",\"getTextAnchor\"),this.initVectorizedAccessor(\"get_alignment_baseline\",\"getAlignmentBaseline\"),this.initVectorizedAccessor(\"get_pixel_offset\",\"getPixelOffset\")}layerProps(){return{data:this.table,getText:this.getText,...Jt(this.billboard)&&{billboard:this.billboard},...Jt(this.sizeScale)&&{sizeScale:this.sizeScale},...Jt(this.sizeUnits)&&{sizeUnits:this.sizeUnits},...Jt(this.sizeMinPixels)&&{sizeMinPixels:this.sizeMinPixels},...Jt(this.sizeMaxPixels)&&{sizeMaxPixels:this.sizeMaxPixels},...Jt(this.backgroundPadding)&&{backgroundPadding:this.backgroundPadding},...Jt(this.characterSet)&&{characterSet:this.characterSet},...Jt(this.fontFamily)&&{fontFamily:this.fontFamily},...Jt(this.fontWeight)&&{fontWeight:this.fontWeight},...Jt(this.lineHeight)&&{lineHeight:this.lineHeight},...Jt(this.outlineWidth)&&{outlineWidth:this.outlineWidth},...Jt(this.outlineColor)&&{outlineColor:this.outlineColor},...Jt(this.fontSettings)&&{fontSettings:this.fontSettings},...Jt(this.wordBreak)&&{wordBreak:this.wordBreak},...Jt(this.maxWidth)&&{maxWidth:this.maxWidth},...Jt(this.getBackgroundColor)&&{getBackgroundColor:this.getBackgroundColor},...Jt(this.getBorderColor)&&{getBorderColor:this.getBorderColor},...Jt(this.getBorderWidth)&&{getBorderWidth:this.getBorderWidth},...Jt(this.getPosition)&&{getPosition:this.getPosition},...Jt(this.getColor)&&{getColor:this.getColor},...Jt(this.getSize)&&{getSize:this.getSize},...Jt(this.getAngle)&&{getAngle:this.getAngle},...Jt(this.getTextAnchor)&&{getTextAnchor:this.getTextAnchor},...Jt(this.getAlignmentBaseline)&&{getAlignmentBaseline:this.getAlignmentBaseline},...Jt(this.getPixelOffset)&&{getPixelOffset:this.getPixelOffset}}}render(){return new YS({...this.baseLayerProps(),...this.layerProps()})}};async function DF(e,t){let r=e.get(\"_layer_type\"),i;switch(r){case tC.layerType:i=new tC(e,t);break;case eC.layerType:i=new eC(e,t);break;case rC.layerType:i=new rC(e,t);break;case iC.layerType:i=new iC(e,t);break;case nC.layerType:i=new nC(e,t);break;case QS.layerType:i=new QS(e,t);break;case sC.layerType:i=new sC(e,t);break;case oC.layerType:i=new oC(e,t);break;case $S.layerType:i=new $S(e,t);break;case XS.layerType:i=new XS(e,t);break;case aC.layerType:i=new aC(e,t);break;default:throw new Error(`no layer supported for ${r}`)}return await i.loadSubModels(),i}var lC=Symbol.for(\"rowIndex\");function U1t(e){return`\n \n ${Object.keys(e).map(t=>{let r=e[t];return`\n \n \n `}).join(\"\")}\n \n
${t}${r}
`}function FX({object:e}){if(e){if(e[lC]===null||e[lC]===void 0||e[lC]&&e[lC]<0)return null;let t=e.toJSON();return!t||(delete t.geometry,Object.keys(t).length===0)?null:{className:\"lonboard-tooltip\",html:U1t(t),style:{backgroundColor:\"#fff\",boxShadow:\"0 0 15px rgba(0, 0, 0, 0.1)\",color:\"#000\",padding:\"6px\"}}}return null}var cC,V1t=new Uint8Array(16);function OF(){if(!cC&&(cC=typeof crypto<\"u\"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!cC))throw new Error(\"crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported\");return cC(V1t)}var Ea=[];for(let e=0;e<256;++e)Ea.push((e+256).toString(16).slice(1));function zX(e,t=0){return Ea[e[t+0]]+Ea[e[t+1]]+Ea[e[t+2]]+Ea[e[t+3]]+\"-\"+Ea[e[t+4]]+Ea[e[t+5]]+\"-\"+Ea[e[t+6]]+Ea[e[t+7]]+\"-\"+Ea[e[t+8]]+Ea[e[t+9]]+\"-\"+Ea[e[t+10]]+Ea[e[t+11]]+Ea[e[t+12]]+Ea[e[t+13]]+Ea[e[t+14]]+Ea[e[t+15]]}var j1t=typeof crypto<\"u\"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),BF={randomUUID:j1t};function G1t(e,t,r){if(BF.randomUUID&&!t&&!e)return BF.randomUUID();e=e||{};let i=e.random||(e.rng||OF)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let s=0;s<16;++s)t[r+s]=i[s];return t}return zX(i)}var FF=G1t;function NX(e,t){let{longitude:r,latitude:i,zoom:s,pitch:n,bearing:o,transitionDuration:c,curve:f,speed:_,screenSpeed:w}=e,I=new nv({...Jt(f)&&{curve:f},...Jt(_)&&{speed:_},...Jt(w)&&{screenSpeed:w}});t({longitude:r,latitude:i,zoom:s,pitch:n,bearing:o,transitionDuration:c,transitionInterpolator:I})}var uC=Ri(Yi(),1);var W1t=DH(e=>{let t=e.get(\"view_state\");\"transitionInterpolator\"in t&&(console.debug(\"Deleting transitionInterpolator!\"),delete t.transitionInterpolator,e.set(\"view_state\",t)),e.save_changes()},300);function UX(e){let t=Y1(),[r,i]=uC.useState(t.get(e));return uC.useEffect(()=>{let s=()=>{i(t.get(e))};return t.on(`change:${e}`,s),()=>t.off(`change:${e}`,s)},[t,e]),[r,s=>{t.set(e,s),W1t(t)}]}await kH();var H1t={latitude:10,longitude:0,zoom:.5,bearing:0,pitch:0},q1t=\"https://basemaps.cartocdn.com/gl/positron-nolabels-gl-style/style.json\";async function Z1t(e,t,r,i){let s={},n=()=>i(new Date);for(let o=0;o{switch(et.type){case\"fly-to\":NX(et,f);break;default:break}});let[_]=(0,a_.useState)(FF()),[w,I]=(0,a_.useState)({}),[R]=zA(\"layers\"),[N,j]=(0,a_.useState)(new Date);(0,a_.useEffect)(()=>{(async()=>{let Y=await L3(e.widget_manager,R),K=await Z1t(Y,R,w,j);I(K)})().catch(console.error)},[R]);let Q=[];for(let et of Object.values(w))Q.push(et.render());return(0,a_.useEffect)(()=>{if(r)return;let Y=document.getElementById(`map-${_}`)?.parentElement;if(Y){let K=window.getComputedStyle(Y);(!K.height||K.height===\"0px\")&&(Y.style.height=\"100%\",Y.style.minHeight=\"500px\")}},[]),hC.createElement(\"div\",{id:`map-${_}`,style:{height:r||\"100%\"}},hC.createElement(GD,{initialViewState:[\"longitude\",\"latitude\",\"zoom\"].every(et=>Object.keys(c).includes(et))?c:H1t,controller:!0,layers:Q,getTooltip:i&&FX,pickingRadius:s,useDevicePixels:Jt(n)?n:!0,_typedArrayManagerProps:{overAlloc:1,poolSize:0},onViewStateChange:et=>{let{viewState:Y}=et,{longitude:K,latitude:J,zoom:ut,pitch:Et,bearing:kt}=Y;f({longitude:K,latitude:J,zoom:ut,pitch:Et,bearing:kt})},parameters:o||{}},hC.createElement(iU,{mapStyle:t||q1t})))}var Q1t={render:j8(Y1t)},Che=Q1t;export{Che as default};\n/*! Bundled license information:\n\nreact/cjs/react.production.min.js:\n (**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nscheduler/cjs/scheduler.production.min.js:\n (**\n * @license React\n * scheduler.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nreact-dom/cjs/react-dom.production.min.js:\n (**\n * @license React\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *)\n\nhammerjs/hammer.js:\n (*! Hammer.JS - v2.0.7 - 2016-04-22\n * http://hammerjs.github.io/\n *\n * Copyright (c) 2016 Jorik Tangelder;\n * Licensed under the MIT license *)\n*/\n", + "_height": null, + "_model_module": "anywidget", + "_model_module_version": "~0.9.*", + "_model_name": "AnyModel", + "_view_module": "anywidget", + "_view_module_version": "~0.9.*", + "_view_name": "AnyView", + "basemap_style": "https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json", + "layers": [ + "IPY_MODEL_f35d431a1af04182b71f6cc283daa37d" + ], + "layout": "IPY_MODEL_02e60fd2e9d9497491411eab9aa8b3b5", + "parameters": null, + "picking_radius": 5, + "show_tooltip": true, + "use_device_pixels": null, + "view_state": { + "bearing": 0, + "latitude": 42.69977153131509, + "longitude": -77.4686856541848, + "pitch": 0, + "zoom": 8.18609790965645 + } + } + }, + "f35d431a1af04182b71f6cc283daa37d": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "WidgetModel", + "state": { + "_layer_type": "polygon", + "_view_module": null, + "_view_module_version": "", + "auto_highlight": false, + "elevation_scale": null, + "extensions": [], + "extruded": null, + "filled": null, + "get_elevation": null, + "get_fill_color": [ + 0, + 255, + 255, + 255 + ], + "get_line_color": [ + 0, + 0, + 0, + 200 + ], + "get_line_width": null, + "line_joint_rounded": null, + "line_miter_limit": null, + "line_width_max_pixels": null, + "line_width_min_pixels": 0.4, + "line_width_scale": null, + "line_width_units": null, + "opacity": 0.5, + "pickable": true, + "selected_index": null, + "stroked": null, + "table": [ + {} + ], + "visible": true, + "wireframe": null + } + } + }, + "version_major": 2, + "version_minor": 0 + } + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/docs/overrides/main.html b/docs/overrides/main.html new file mode 100644 index 0000000..9c0c9b8 --- /dev/null +++ b/docs/overrides/main.html @@ -0,0 +1,14 @@ +{% extends "base.html" %} {% block content %} {% if page.nb_url %} +
+ {% include ".icons/material/download.svg" %} + +{% endif %} {{ super() }} {% endblock content %} {% block outdated %} You're not +viewing the latest version. + + Click here to go to latest. + +{% endblock %} diff --git a/mkdocs.yml b/mkdocs.yml index 0d253da..30a00a5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -18,6 +18,8 @@ nav: - index.md - usage.md - schema.md + - Examples: + - examples/naip.ipynb - Specification: spec/stac-geoparquet-spec.md - API Reference: - api/arrow.md @@ -31,6 +33,7 @@ watch: theme: name: material + custom_dir: docs/overrides palette: # Palette toggle for automatic mode - media: "(prefers-color-scheme)" @@ -74,6 +77,9 @@ plugins: - mike: alias_type: "copy" canonical_version: "latest" + - mkdocs-jupyter: + include_source: true + ignore: ["**/.ipynb_checkpoints/*.ipynb"] - mkdocstrings: enable_inventory: true handlers: diff --git a/pyproject.toml b/pyproject.toml index 99ee7d5..c759a16 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,7 @@ docs = [ "black", "griffe-inherited-docstrings", "mike>=2", + "mkdocs-jupyter", "mkdocs-material[imaging]>=9.5", "mkdocs", "mkdocstrings[python]>=0.25.1",