@npm9912/v-map 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -5
- package/dist/cjs/{cesium-provider-BiFFyAl9.js → cesium-provider-CTtu9eTD.js} +6 -5
- package/dist/cjs/{deck-provider-Ctq3Q8a1.js → deck-provider-fNa818HH.js} +9 -9
- package/dist/cjs/events-BMG7RKne.js +11 -0
- package/dist/cjs/{geotiff-source-RaNzzWkC.js → geotiff-source-B9ARUE9z.js} +1 -1
- package/dist/cjs/{index-ISOEpMC3.js → index-9APmzoa2.js} +6 -6
- package/dist/cjs/{index-CbVT-Con.js → index-BJg0ncfC.js} +4 -4
- package/dist/cjs/{index-CJvvX4yx.js → index-C1ubapwF.js} +4 -4
- package/dist/cjs/{index-B8LHqjyg.js → index-ChrKyU6i.js} +4 -4
- package/dist/cjs/{index-JSwBbvGA.js → index-DmGHwivM.js} +1 -0
- package/dist/cjs/{layer-extension-B_olS0rc.js → layer-extension-D3a-1DFI.js} +1 -1
- package/dist/cjs/{leaflet-provider-DOqfs7g5.js → leaflet-provider-7Nw-AdV_.js} +6 -5
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{messages-D7h4m8Tx.js → messages-CFCxeG8p.js} +0 -9
- package/dist/cjs/{openlayers-provider-Dfeg6L4n.js → openlayers-provider-DMxYtFkS.js} +5 -4
- package/dist/cjs/{polygon-layer-B9PrN7vr.js → polygon-layer-Dx1ZWZP0.js} +1 -1
- package/dist/cjs/{scenegraph-layer-DwNoxQdi.js → scenegraph-layer-ctLehP0q.js} +1 -1
- package/dist/cjs/v-map-builder.cjs.entry.js +4 -3
- package/dist/cjs/v-map-error.cjs.entry.js +121 -0
- package/dist/cjs/v-map-layer-geojson_12.cjs.entry.js +11 -10
- package/dist/cjs/{v-map-layer-helper-iAzxAg9I.js → v-map-layer-helper-DnWpjZ_Q.js} +7 -6
- package/dist/cjs/v-map-layer-terrain-geotiff.cjs.entry.js +5 -4
- package/dist/cjs/v-map-layercontrol.cjs.entry.js +1 -1
- package/dist/cjs/v-map.cjs.js +2 -2
- package/dist/cjs/{v-map.v-map-layer-osm.v-map-layergroup-BsXp3BoL.js → v-map.v-map-layer-osm.v-map-layergroup-BJ3_NqAj.js} +16 -15
- package/dist/cjs/v-map_3.cjs.entry.js +5 -4
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/v-map/v-map.css +3 -0
- package/dist/collection/components/v-map-error/v-map-error.css +136 -0
- package/dist/collection/components/v-map-error/v-map-error.js +277 -0
- package/dist/collection/components/v-map-error/v-map-error.test.js +131 -0
- package/dist/collection/components/v-map-layer-geojson/v-map-layer-geojson.js +1 -1
- package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.js +1 -1
- package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.js +1 -1
- package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.js +1 -1
- package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.js +1 -1
- package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.js +1 -1
- package/dist/collection/components/v-map-layergroup/v-map-layergroup.js +1 -1
- package/dist/collection/components/v-map-style/v-map-style.js +1 -1
- package/dist/components/cesium-provider.js +1 -1
- package/dist/components/deck-provider.js +1 -1
- package/dist/components/events.js +1 -1
- package/dist/components/geotiff-source.js +1 -1
- package/dist/components/leaflet-provider.js +1 -1
- package/dist/components/logger.js +1 -0
- package/dist/components/openlayers-provider.js +1 -1
- package/dist/components/v-map-builder.js +2 -2
- package/dist/components/v-map-error.d.ts +11 -0
- package/dist/components/v-map-error.js +1 -0
- package/dist/components/v-map-layer-geojson2.js +1 -1
- package/dist/components/v-map-layer-geotiff2.js +1 -1
- package/dist/components/v-map-layer-google2.js +1 -1
- package/dist/components/v-map-layer-helper.js +1 -1
- package/dist/components/v-map-layer-osm2.js +1 -1
- package/dist/components/v-map-layer-scatterplot2.js +1 -1
- package/dist/components/v-map-layer-terrain-geotiff.js +1 -1
- package/dist/components/v-map-layer-terrain2.js +1 -1
- package/dist/components/v-map-layer-tile3d2.js +1 -1
- package/dist/components/v-map-layer-wcs2.js +1 -1
- package/dist/components/v-map-layer-wfs2.js +1 -1
- package/dist/components/v-map-layer-wkt2.js +1 -1
- package/dist/components/v-map-layer-wms2.js +1 -1
- package/dist/components/v-map-layer-xyz2.js +1 -1
- package/dist/components/v-map-layergroup2.js +1 -1
- package/dist/components/v-map-style2.js +2 -2
- package/dist/components/v-map2.js +1 -1
- package/dist/esm/{cesium-provider-BJfAup3w.js → cesium-provider-Bh__cBGf.js} +6 -5
- package/dist/esm/{deck-provider-C7U9VDEq.js → deck-provider-DxIpS4lY.js} +9 -9
- package/dist/esm/events-CrV_misM.js +9 -0
- package/dist/esm/{geotiff-source-esnDnC-u.js → geotiff-source-BRjO-Dvr.js} +1 -1
- package/dist/esm/{index-BIEmlzCf.js → index-Bh2gBu9u.js} +5 -5
- package/dist/esm/{index-jzneDarq.js → index-BoNyIrdq.js} +1 -1
- package/dist/esm/{index-jN06TXUp.js → index-C3mnOs0I.js} +4 -4
- package/dist/esm/{index-B1zwA4IC.js → index-C63kfbil.js} +6 -6
- package/dist/esm/{index-DbSdn93t.js → index-DxbztwCv.js} +7 -7
- package/dist/esm/{layer-extension-CZXK5goK.js → layer-extension-C5Y2UES3.js} +1 -1
- package/dist/esm/{leaflet-provider-Q41TB6ku.js → leaflet-provider-k6JSYiYX.js} +6 -5
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{messages-CMKJzsgL.js → messages-QJHuuz0g.js} +1 -9
- package/dist/esm/{openlayers-provider-CMsDsQTQ.js → openlayers-provider-DIquf3Tx.js} +5 -4
- package/dist/esm/{polygon-layer-ByhxGhWC.js → polygon-layer-ZIT5mJy5.js} +1 -1
- package/dist/esm/{scenegraph-layer-09K_B6DT.js → scenegraph-layer-CNIRd2uu.js} +1 -1
- package/dist/esm/v-map-builder.entry.js +3 -2
- package/dist/esm/v-map-error.entry.js +119 -0
- package/dist/esm/v-map-layer-geojson_12.entry.js +10 -9
- package/dist/esm/{v-map-layer-helper-Dys44Cgo.js → v-map-layer-helper-CuHYsU9f.js} +2 -1
- package/dist/esm/v-map-layer-terrain-geotiff.entry.js +5 -4
- package/dist/esm/v-map-layercontrol.entry.js +1 -1
- package/dist/esm/v-map.js +3 -3
- package/dist/esm/{v-map.v-map-layer-osm.v-map-layergroup-B4pFHuSf.js → v-map.v-map-layer-osm.v-map-layergroup-Zwdvm9PG.js} +10 -9
- package/dist/esm/v-map_3.entry.js +5 -4
- package/dist/types/components/v-map-error/v-map-error.d.ts +79 -0
- package/dist/types/components/v-map-error/v-map-error.test.d.ts +1 -0
- package/dist/types/components.d.ts +128 -0
- package/dist/v-map/p-05ee633f.entry.js +1 -0
- package/dist/v-map/p-08ad1392.entry.js +1 -0
- package/dist/v-map/p-2-mR3oVa.js +1 -0
- package/dist/v-map/{p-c21c93fe.entry.js → p-3a57b64a.entry.js} +1 -1
- package/dist/v-map/p-58dda864.entry.js +1 -0
- package/dist/v-map/p-915314c0.entry.js +10 -0
- package/dist/v-map/{p-MyTSFnEk.js → p-9Rt23jlQ.js} +1 -1
- package/dist/v-map/p-BSsFEMZP.js +1 -0
- package/dist/v-map/{p-jzneDarq.js → p-BoNyIrdq.js} +2 -2
- package/dist/v-map/p-BpE6L1g0.js +1 -0
- package/dist/v-map/{p-DvHXtWUg.js → p-C0M0-Kvt.js} +1 -1
- package/dist/v-map/p-CbiLpFhO.js +1 -0
- package/dist/v-map/p-Ci70E1EM.js +1 -0
- package/dist/v-map/p-CrV_misM.js +1 -0
- package/dist/v-map/{p-DrOQ9V4h.js → p-DAf4itFZ.js} +1 -1
- package/dist/v-map/p-DVBtCUtQ.js +1 -0
- package/dist/v-map/{p-CZqY0yW4.js → p-DuJ_mTaq.js} +1 -1
- package/dist/v-map/p-G6iftXUC.js +1 -0
- package/dist/v-map/{p-CMKJzsgL.js → p-QJHuuz0g.js} +1 -1
- package/dist/v-map/{p-aa410e64.entry.js → p-e21ea0ce.entry.js} +2 -2
- package/dist/v-map/{p-DmICdG34.js → p-rCyRSFJb.js} +2 -2
- package/dist/v-map/{p-CafTHT9i.js → p-vhbi5XXi.js} +1 -1
- package/dist/v-map/{p-Dckgonw8.js → p-yXLNXXx-.js} +1 -1
- package/dist/v-map/v-map.esm.js +1 -1
- package/package.json +1 -1
- package/dist/v-map/p--vVleK-M.js +0 -1
- package/dist/v-map/p-09d10db0.entry.js +0 -1
- package/dist/v-map/p-5eba6058.entry.js +0 -10
- package/dist/v-map/p-6b102336.entry.js +0 -1
- package/dist/v-map/p-BdijL4Av.js +0 -1
- package/dist/v-map/p-BeFu0ap4.js +0 -1
- package/dist/v-map/p-BxFJezdK.js +0 -1
- package/dist/v-map/p-DCTHyf58.js +0 -1
- package/dist/v-map/p-WaMDUuAz.js +0 -1
- package/dist/v-map/p-uiIP-taz.js +0 -1
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{r as t,g as e,h as n,c as r}from"./p-jzneDarq.js";import{V as i}from"./p-BdijL4Av.js";import{l as s,M as o,V as a}from"./p-CMKJzsgL.js";import{c as u,g as c,a as l}from"./p-E-ZsRS8r.js";function h(t){return"object"==typeof t&&null!==t&&("string"==typeof t.name&&null!=(e=t.rules)&&"number"==typeof e.length&&(Array.isArray(e)||void 0!==e[0]));var e}const f="v-map-layer-geojson - ",d=class{constructor(e){t(this,e)}get el(){return e(this)}loadState="idle";geojson;url=null;visible=!0;zIndex=1e3;opacity=1;fillColor;fillOpacity;strokeColor;strokeWidth;strokeOpacity;pointRadius;pointColor;iconUrl;iconSize;textProperty;textColor;textSize;geoSlot;mo;lastString;layerId=null;didLoad=!1;hasLoadedOnce=!1;helper;appliedGeostylerStyle;async getLayerId(){return this.layerId}setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}async connectedCallback(){s(f+o.COMPONENT_CONNECTED_CALLBACK),this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id))}async componentWillLoad(){s(f+o.COMPONENT_WILL_LOAD),this.helper=new i(this.el,this)}async componentDidLoad(){s(f+o.COMPONENT_DID_LOAD),this.geoSlot=this.el.shadowRoot.querySelector('slot[name="geojson"]'),this.geoSlot&&(this.geoSlot.addEventListener("slotchange",this.onSlotChange),this.observeAssignedNodes(),this.readGeoJsonFromSlot()),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),await this.applyExistingStyles(),this.didLoad=!0,this.hasLoadedOnce=!0}async disconnectedCallback(){s(f+o.COMPONENT_DISCONNECTED_CALLBACK),this.mo?.disconnect(),this.geoSlot?.removeEventListener("slotchange",this.onSlotChange),await(this.helper?.dispose())}isReady(){return this.didLoad}async onGeoJsonChanged(t,e){if(s(f+"onGeoJsonChanged"),t!==e){let t=null;"object"==typeof this.geojson?t=JSON.stringify(this.geojson):"string"==typeof this.geojson&&(t=this.geojson),await(this.helper?.updateLayer({type:"geojson",data:{geojson:t}}))}}async onUrlChanged(t,e){s(f+"onUrlChanged"),t!==e&&await(this.helper?.updateLayer({type:"geojson",data:{url:this.url}}))}async onVisibleChanged(){s(f+"onVisibleChanged"),await(this.helper?.setVisible(this.visible))}async onOpacityChanged(){s(f+"onOpacityChanged"),await(this.helper?.setOpacity(this.opacity))}async onZIndexChanged(){s(f+"onZIndexChanged"),await(this.helper?.setZIndex(this.zIndex))}async onStyleChanged(){s(f+"onStyleChanged"),await(this.helper?.updateLayer({type:"geojson",data:{geojson:this.geojson,url:this.url}}))}async onStyleReady(t){h(t.detail.style)&&this.isTargetedByStyle(t.detail.layerIds)&&(s(f+"Applying geostyler style"),this.appliedGeostylerStyle=t.detail.style,await this.updateLayerWithGeostylerStyle())}isTargetedByStyle(t){return!!t&&(t.includes(this.el.id)||0===t.length)}async applyExistingStyles(){const t=Array.from(document.querySelectorAll("v-map-style"));for(const e of t){const t=e.getStyle?await e.getStyle():void 0;if(!t)continue;if(!h(t))continue;const n=e.getLayerTargetIds?await e.getLayerTargetIds():void 0;n&&this.isTargetedByStyle(n)&&(s(f+"Applying existing geostyler style"),this.appliedGeostylerStyle=t,await this.updateLayerWithGeostylerStyle())}}async updateLayerWithGeostylerStyle(){this.appliedGeostylerStyle&&this.helper&&await this.helper.updateLayer({type:"geojson",data:{geojson:this.geojson,url:this.url,geostylerStyle:this.appliedGeostylerStyle}})}onSlotChange=()=>{s(f+"onSlotChange"),this.observeAssignedNodes(),this.readGeoJsonFromSlot()};observeAssignedNodes(){if(s(f+"observeAssignedNodes"),this.mo?.disconnect(),!this.geoSlot)return;const t=this.geoSlot.assignedNodes({flatten:!0});this.mo=new MutationObserver((()=>this.readGeoJsonFromSlot()));for(const e of t)this.mo.observe(e,{characterData:!0,childList:!0,subtree:!0})}readGeoJsonFromSlot(){if(s(f+"readGeoJsonFromSlot"),!this.geoSlot)return void s(f+"readGeoJsonFromSlot - geoSlot: false");const t=this.geoSlot.assignedNodes({flatten:!0}).map((t=>t.textContent||"")).join("").trim();if(t)if(t!==this.lastString){this.lastString=t;try{const e=JSON.parse(t);s(f+"readGeoJsonFromSlot: ",e),this.geojson=e}catch(t){this.helper?.setError({type:"parse",message:"Ungültiges JSON im Slot",attribute:"geojson",cause:t})}}else s(f+"readGeoJsonFromSlot - raw === this.lastString");else s(f+"readGeoJsonFromSlot - raw: false")}createLayerConfig(){const t=this.iconSize?this.iconSize.split(",").map((t=>parseInt(t.trim(),10))):void 0;let e=null;"object"==typeof this.geojson?e=JSON.stringify(this.geojson):"string"==typeof this.geojson&&(e=this.geojson);const n={type:"geojson",opacity:this.opacity,visible:this.visible,zIndex:this.zIndex,url:this.url,geojson:e,style:{fillColor:this.fillColor,fillOpacity:this.fillOpacity,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeOpacity:this.strokeOpacity,pointRadius:this.pointRadius,pointColor:this.pointColor,iconUrl:this.iconUrl,iconSize:t,textProperty:this.textProperty,textColor:this.textColor,textSize:this.textSize}};return this.appliedGeostylerStyle&&(n.geostylerStyle=this.appliedGeostylerStyle),n}render(){return n("slot",{key:"093a5de19ea7090df1883b15e379b604dfabc1a1",name:"geojson",onSlotchange:this.onSlotChange})}static get watchers(){return{geojson:[{onGeoJsonChanged:0}],url:[{onUrlChanged:0}],visible:[{onVisibleChanged:0}],opacity:[{onOpacityChanged:0}],zIndex:[{onZIndexChanged:0}],fillColor:[{onStyleChanged:0}],fillOpacity:[{onStyleChanged:0}],strokeColor:[{onStyleChanged:0}],strokeWidth:[{onStyleChanged:0}],strokeOpacity:[{onStyleChanged:0}],pointRadius:[{onStyleChanged:0}],pointColor:[{onStyleChanged:0}],iconUrl:[{onStyleChanged:0}],iconSize:[{onStyleChanged:0}],textProperty:[{onStyleChanged:0}],textColor:[{onStyleChanged:0}],textSize:[{onStyleChanged:0}]}}},p="v-map-layer-geotiff - ",y=class{constructor(e){t(this,e),this.ready=r(this,"ready",7)}get el(){return e(this)}loadState="idle";url=null;visible=!0;opacity=1;zIndex=100;nodata=null;colorMap=null;valueRange=null;ready;didLoad=!1;hasLoadedOnce=!1;helper;setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}async onUrlChanged(){s(p+"onUrlChanged"),await(this.helper?.updateLayer({type:"geotiff",data:{url:this.url,nodata:this.nodata,colorMap:this.colorMap,valueRange:this.valueRange}}))}async onVisibleChanged(){s(p+"onVisibleChanged"),await(this.helper?.setVisible(this.visible))}async onOpacityChanged(){s(p+"onOpacityChanged"),await(this.helper?.setOpacity(this.opacity))}async onZIndexChanged(){s(p+"onZIndexChanged"),await(this.helper?.setZIndex(this.zIndex))}async onNodataChanged(){s(p+"onNodataChanged"),isNaN(this.nodata)&&(this.nodata=null),await(this.helper?.updateLayer({type:"geotiff",data:{url:this.url,nodata:this.nodata,colorMap:this.colorMap,valueRange:this.valueRange}}))}async onColorMapChanged(){s(p+"onColorMapChanged"),await(this.helper?.updateLayer({type:"geotiff",data:{url:this.url,nodata:this.nodata,colorMap:this.colorMap,valueRange:this.valueRange}}))}async onValueRangeChanged(){s(p+"onValueRangeChanged"),await(this.helper?.updateLayer({type:"geotiff",data:{url:this.url,nodata:this.nodata,colorMap:this.colorMap,valueRange:this.valueRange}}))}isReady(){return this.didLoad}async getLayerId(){return this.helper.getLayerId()}createLayerConfig(){return{type:"geotiff",visible:this.visible,zIndex:this.zIndex,opacity:this.opacity,url:this.url,nodata:this.nodata,colorMap:this.colorMap,valueRange:this.valueRange}}async connectedCallback(){s(p+o.COMPONENT_CONNECTED_CALLBACK),this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id)),document.addEventListener("styleReady",this.handleStyleReady.bind(this))}async disconnectedCallback(){document.removeEventListener("styleReady",this.handleStyleReady.bind(this)),await(this.helper?.dispose())}async handleStyleReady(t){s(p+"handleStyleReady");const e=t.detail;if(e.layerIds&&e.layerIds.length>0){const t=this.helper?.getLayerId(),n=e.layerIds;if(t&&!n.includes(t)&&!n.includes(this.el.id))return void s(p+"style not targeted for this layer")}if(!h(e.style))return void s(p+"not a GeoStyler style");const n=this.extractRasterSymbolizer(e.style);n&&(s(p+"applying RasterSymbolizer from style"),n.colorMap&&(this.colorMap=n.colorMap),void 0!==n.opacity&&"number"==typeof n.opacity&&(this.opacity=n.opacity),void 0!==n.visibility&&"boolean"==typeof n.visibility&&(this.visible=n.visibility))}extractRasterSymbolizer(t){for(const e of t.rules)for(const t of e.symbolizers)if("Raster"===t.kind)return t;return null}async componentWillLoad(){s(p+o.COMPONENT_WILL_LOAD),this.helper=new i(this.el,this)}async componentDidLoad(){s(p+o.COMPONENT_DID_LOAD),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),this.hasLoadedOnce=!0,this.didLoad=!0,this.ready.emit()}async componentWillRender(){s(p+o.COMPONENT_WILL_RENDER)}render(){}static get watchers(){return{url:[{onUrlChanged:0}],visible:[{onVisibleChanged:0}],opacity:[{onOpacityChanged:0}],zIndex:[{onZIndexChanged:0}],nodata:[{onNodataChanged:0}],colorMap:[{onColorMapChanged:0}],valueRange:[{onValueRangeChanged:0}]}}};y.style=":host{display:none;}";const m="v-map-layer-google - ",g=class{constructor(e){t(this,e),this.ready=r(this,"ready",7)}get el(){return e(this)}loadState="idle";mapType="roadmap";apiKey;language;region;visible=!0;opacity=1;scale;maxZoom;styles;libraries;ready;hasLoadedOnce=!1;helper;setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}parseStyles(t){if("string"==typeof t)try{const e=JSON.parse(t);this.styles=e}catch(t){this.helper?.setError({type:"parse",message:"Invalid JSON in styles attribute",attribute:"styles",cause:t})}}createLayerConfig(){return{type:"google",apiKey:this.apiKey??"",mapType:this.mapType,language:this.language,region:this.region,visible:this.visible,opacity:this.opacity,scale:this.scale,maxZoom:this.maxZoom,styles:this.styles,libraries:this.libraries?this.libraries.split(",").map((t=>t.trim())):void 0}}async connectedCallback(){s(m+o.COMPONENT_CONNECTED_CALLBACK),"string"==typeof this.styles&&this.parseStyles(this.styles),this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id))}async componentWillLoad(){s(m+o.COMPONENT_WILL_LOAD),this.helper=new i(this.el,this)}async componentDidLoad(){s(m+o.COMPONENT_DID_LOAD),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),this.hasLoadedOnce=!0,this.ready.emit()}async disconnectedCallback(){s(m+o.COMPONENT_DISCONNECTED_CALLBACK),await(this.helper?.dispose())}render(){}static get watchers(){return{styles:[{parseStyles:0}]}}};g.style="";const b="v-map-layer-scatterplot - ",v=class{constructor(e){t(this,e),this.ready=r(this,"ready",7)}get el(){return e(this)}loadState="idle";data;url;getFillColor="#3388ff";getRadius=1e3;opacity=1;visible=!0;ready;hasLoadedOnce=!1;helper;setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}createLayerConfig(){return{type:"scatterplot",data:this.data,getFillColor:this.getFillColor,getRadius:this.getRadius,opacity:this.opacity,visible:this.visible}}async connectedCallback(){s(b+o.COMPONENT_CONNECTED_CALLBACK),this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id))}async componentWillLoad(){s(b+o.COMPONENT_WILL_LOAD),this.helper=new i(this.el,this)}async componentDidLoad(){s(b+o.COMPONENT_DID_LOAD),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),this.hasLoadedOnce=!0,this.ready.emit()}async disconnectedCallback(){s(b+o.COMPONENT_DISCONNECTED_CALLBACK),await(this.helper?.dispose())}render(){}};v.style="";const w="v-map-layer-terrain - ",x=class{constructor(e){t(this,e)}get el(){return e(this)}loadState="idle";elevationData;texture;elevationDecoder;wireframe;color;minZoom;maxZoom;meshMaxError;visible=!0;opacity=1;zIndex=1e3;didLoad=!1;hasLoadedOnce=!1;helper;setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}componentWillLoad(){s(w+"componentWillLoad"),this.helper=new i(this.el,this)}async componentDidLoad(){s(w+"componentDidLoad"),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),this.didLoad=!0,this.hasLoadedOnce=!0}async connectedCallback(){this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id))}async disconnectedCallback(){s(w+"disconnectedCallback"),await(this.helper?.dispose())}async isReady(){return this.didLoad}async onVisibleChanged(){this.didLoad&&await(this.helper?.setVisible(this.visible))}async onOpacityChanged(){this.didLoad&&await(this.helper?.setOpacity(this.opacity))}async onZIndexChanged(){this.didLoad&&await(this.helper?.setZIndex(this.zIndex))}async onTerrainConfigChanged(){this.didLoad&&await this.pushTerrainUpdate()}async pushTerrainUpdate(){await(this.helper?.updateLayer({type:"terrain",data:{type:"terrain",elevationData:this.elevationData,texture:this.texture,elevationDecoder:this.getElevationDecoder(),wireframe:this.wireframe,color:this.getColorArray(),minZoom:this.minZoom,maxZoom:this.maxZoom,meshMaxError:this.meshMaxError,opacity:this.opacity,visible:this.visible,zIndex:this.zIndex}}))}getElevationDecoder(){if(this.elevationDecoder)try{const t=JSON.parse(this.elevationDecoder);if("object"==typeof t&&null!==t&&["r","g","b","offset"].every((e=>e in t)))return t;this.helper?.setError({type:"parse",message:"Invalid elevationDecoder JSON",attribute:"elevationDecoder",cause:void 0})}catch(t){this.helper?.setError({type:"parse",message:"Invalid elevationDecoder JSON",attribute:"elevationDecoder",cause:t})}}getColorArray(){if(!this.color)return;const t=this.color.trim();if(t){if(t.startsWith("[")&&t.endsWith("]"))try{const e=JSON.parse(t);if(Array.isArray(e)&&3===e.length&&e.every((t=>"number"==typeof t)))return e}catch(t){this.helper?.setError({type:"parse",message:"Failed to parse color JSON array",attribute:"color",cause:t})}if(t.includes(",")){const e=t.split(",").map((t=>parseFloat(t.trim())));if(3===e.length&&e.every((t=>!Number.isNaN(t))))return e}if(t.startsWith("#")){const e=t.replace("#","");if(3===e.length||6===e.length){const t=3===e.length?e.split("").map((t=>t+t)).join(""):e,n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);if(![n,r,i].some(Number.isNaN))return[n,r,i]}}this.helper?.setError({type:"parse",message:`Unsupported color format: ${t}`,attribute:"color"})}}createLayerConfig(){return{type:"terrain",elevationData:this.elevationData,texture:this.texture,elevationDecoder:this.getElevationDecoder(),wireframe:this.wireframe,color:this.getColorArray(),minZoom:this.minZoom,maxZoom:this.maxZoom,meshMaxError:this.meshMaxError,opacity:this.opacity,visible:this.visible,zIndex:this.zIndex}}render(){return n("slot",{key:"c199c1789ddbfdf0c9327a154d82d2ffac090b33"})}static get watchers(){return{visible:[{onVisibleChanged:0}],opacity:[{onOpacityChanged:0}],zIndex:[{onZIndexChanged:0}],elevationData:[{onTerrainConfigChanged:0}],texture:[{onTerrainConfigChanged:0}],elevationDecoder:[{onTerrainConfigChanged:0}],wireframe:[{onTerrainConfigChanged:0}],color:[{onTerrainConfigChanged:0}],minZoom:[{onTerrainConfigChanged:0}],maxZoom:[{onTerrainConfigChanged:0}],meshMaxError:[{onTerrainConfigChanged:0}]}}};x.style=":host{display:none}";const S="v-map-layer-tile3d - ",E=class{constructor(e){t(this,e),this.ready=r(this,"ready",7)}get el(){return e(this)}loadState="idle";url;tilesetOptions;visible=!0;opacity=1;zIndex=1e3;ready;didLoad=!1;hasLoadedOnce=!1;helper;appliedCesiumStyle;async connectedCallback(){this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id))}async componentWillLoad(){s(S+o.COMPONENT_WILL_LOAD),this.helper=new i(this.el,this)}async componentDidLoad(){s(S+o.COMPONENT_DID_LOAD),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),await this.applyExistingStyles(),this.didLoad=!0,this.hasLoadedOnce=!0,this.ready.emit()}async disconnectedCallback(){s(S+o.COMPONENT_DISCONNECTED_CALLBACK),await(this.helper?.dispose())}async isReady(){return this.didLoad}setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}async onUrlChanged(t,e){t!==e&&this.helper&&await this.helper.updateLayer({type:"tile3d",data:{url:e,tilesetOptions:this.parseTilesetOptions(),cesiumStyle:this.appliedCesiumStyle}})}async onTilesetOptionsChanged(){this.helper&&await this.helper.updateLayer({type:"tile3d",data:{url:this.url,tilesetOptions:this.parseTilesetOptions(),cesiumStyle:this.appliedCesiumStyle}})}async onVisibleChanged(){await(this.helper?.setVisible(this.visible))}async onOpacityChanged(){await(this.helper?.setOpacity(this.opacity))}async onZIndexChanged(){await(this.helper?.setZIndex(this.zIndex))}async onStyleReady(t){const{style:e,layerIds:n}=t.detail;e&&!h(e)&&this.isTargetedByStyle(n)&&(s(S+"Applying Cesium 3D Tiles style"),this.appliedCesiumStyle=e,await this.updateLayerWithCesiumStyle())}async applyExistingStyles(){const t=Array.from(document.querySelectorAll("v-map-style"));for(const e of t){const t=e.getStyle?await e.getStyle():void 0;if(!t)continue;if(h(t))continue;const n=e.getLayerTargetIds?await e.getLayerTargetIds():void 0;n&&this.isTargetedByStyle(n)&&(s(S+"Applying existing Cesium 3D Tiles style"),this.appliedCesiumStyle=t,await this.updateLayerWithCesiumStyle())}}isTargetedByStyle(t){return!!t&&(t.includes(this.el.id)||0===t.length)}async updateLayerWithCesiumStyle(){this.helper&&this.appliedCesiumStyle&&await this.helper.updateLayer({type:"tile3d-style",data:{style:this.appliedCesiumStyle}})}parseTilesetOptions(){if(this.tilesetOptions){if("object"==typeof this.tilesetOptions)return this.tilesetOptions;try{return JSON.parse(this.tilesetOptions)}catch(t){return void this.helper?.setError({type:"parse",message:"Invalid tilesetOptions JSON",attribute:"tilesetOptions",cause:t})}}}createLayerConfig(){return{type:"tile3d",url:this.url,visible:this.visible,opacity:this.opacity,zIndex:this.zIndex,tilesetOptions:this.parseTilesetOptions(),cesiumStyle:this.appliedCesiumStyle}}render(){return n("slot",{key:"39223347c38080929d4865fa5ee2de4f3b1f87b1"})}static get watchers(){return{url:[{onUrlChanged:0}],tilesetOptions:[{onTilesetOptionsChanged:0}],visible:[{onVisibleChanged:0}],opacity:[{onOpacityChanged:0}],zIndex:[{onZIndexChanged:0}]}}};E.style=":host{display:none}";const O="v-map-layer-wcs - ",C=class{constructor(e){t(this,e)}get el(){return e(this)}loadState="idle";url;coverageName;format="image/tiff";version="1.1.0";projection;resolutions;params;visible=!0;opacity=1;zIndex=1e3;didLoad=!1;hasLoadedOnce=!1;helper;setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}componentWillLoad(){s(O+"componentWillLoad"),this.helper=new i(this.el,this)}async componentDidLoad(){s(O+"componentDidLoad"),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),this.didLoad=!0,this.hasLoadedOnce=!0}async connectedCallback(){this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id))}async disconnectedCallback(){s(O+"disconnectedCallback"),await(this.helper?.dispose())}async isReady(){return this.didLoad}async onVisibleChanged(){this.didLoad&&await(this.helper?.setVisible(this.visible))}async onOpacityChanged(){this.didLoad&&await(this.helper?.setOpacity(this.opacity))}async onZIndexChanged(){this.didLoad&&await(this.helper?.setZIndex(this.zIndex))}async onSourceChanged(){this.didLoad&&await(this.helper?.updateLayer({type:"wcs",data:this.createLayerConfig()}))}parseParams(){if(this.params)try{const t=JSON.parse(this.params);if(t&&"object"==typeof t)return t}catch(t){this.helper?.setError({type:"parse",message:"Invalid params JSON",attribute:"params",cause:t})}}parseResolutions(){if(this.resolutions)try{const t=JSON.parse(this.resolutions);if(Array.isArray(t)&&t.every((t=>"number"==typeof t)))return t}catch(t){this.helper?.setError({type:"parse",message:"Invalid resolutions JSON",attribute:"resolutions",cause:t})}}createLayerConfig(){return{type:"wcs",url:this.url,coverageName:this.coverageName,format:this.format,version:this.version,projection:this.projection,resolutions:this.parseResolutions(),params:this.parseParams(),visible:this.visible,opacity:this.opacity,zIndex:this.zIndex}}render(){return n("slot",{key:"b42cc02537db832f69250cb4545f7c15ce1e5a93"})}static get watchers(){return{visible:[{onVisibleChanged:0}],opacity:[{onOpacityChanged:0}],zIndex:[{onZIndexChanged:0}],url:[{onSourceChanged:0}],coverageName:[{onSourceChanged:0}],format:[{onSourceChanged:0}],version:[{onSourceChanged:0}],projection:[{onSourceChanged:0}],resolutions:[{onSourceChanged:0}],params:[{onSourceChanged:0}]}}};C.style=":host{display:none}";const F="v-map-layer-wfs - ",k=class{constructor(e){t(this,e)}get el(){return e(this)}loadState="idle";url;typeName;version="1.1.0";outputFormat="application/json";srsName="EPSG:3857";params;visible=!0;opacity=1;zIndex=1e3;didLoad=!1;hasLoadedOnce=!1;helper;appliedGeostylerStyle;setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}componentWillLoad(){s(F+"componentWillLoad"),this.helper=new i(this.el,this)}async componentDidLoad(){s(F+"componentDidLoad"),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),await this.applyExistingStyles(),this.didLoad=!0,this.hasLoadedOnce=!0}async connectedCallback(){this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id))}async disconnectedCallback(){s(F+"disconnectedCallback"),await(this.helper?.dispose())}async isReady(){return this.didLoad}async onVisibleChanged(){this.didLoad&&await(this.helper?.setVisible(this.visible))}async onOpacityChanged(){this.didLoad&&await(this.helper?.setOpacity(this.opacity))}async onZIndexChanged(){this.didLoad&&await(this.helper?.setZIndex(this.zIndex))}async onSourceChanged(){this.didLoad&&await(this.helper?.updateLayer({type:"wfs",data:this.createLayerConfig()}))}parseParams(){if(this.params)try{const t=JSON.parse(this.params);if(t&&"object"==typeof t)return t}catch(t){this.helper?.setError({type:"parse",message:"Invalid params JSON",attribute:"params",cause:t})}}async onStyleReady(t){h(t.detail.style)&&this.isTargetedByStyle(t.detail.layerIds)&&(s(F+"Applying geostyler style"),this.appliedGeostylerStyle=t.detail.style,await this.updateLayerWithGeostylerStyle())}isTargetedByStyle(t){return!!t&&(t.includes(this.el.id)||0===t.length)}async applyExistingStyles(){const t=Array.from(document.querySelectorAll("v-map-style"));this.appliedGeostylerStyle=void 0;for(const e of t){const t=e.getStyle?await e.getStyle():void 0;if(!t)continue;if(!h(t))continue;const n=e.getLayerTargetIds?await e.getLayerTargetIds():void 0;if(n&&this.isTargetedByStyle(n)){s(F+"Applying existing geostyler style"),this.appliedGeostylerStyle=t;break}}await this.updateLayerWithGeostylerStyle()}async updateLayerWithGeostylerStyle(){this.appliedGeostylerStyle&&this.helper&&await this.helper.updateLayer({type:"wfs",data:{url:this.url,typeName:this.typeName,version:this.version,outputFormat:this.outputFormat,srsName:this.srsName,params:this.parseParams(),geostylerStyle:this.appliedGeostylerStyle}})}createLayerConfig(){const t={type:"wfs",url:this.url,typeName:this.typeName,version:this.version,outputFormat:this.outputFormat,srsName:this.srsName,params:this.parseParams(),visible:this.visible,opacity:this.opacity,zIndex:this.zIndex};return this.appliedGeostylerStyle&&(t.geostylerStyle=this.appliedGeostylerStyle),t}render(){return n("slot",{key:"347b5c4d982518a9f9c0ed25b1701d06d3f45134"})}static get watchers(){return{visible:[{onVisibleChanged:0}],opacity:[{onOpacityChanged:0}],zIndex:[{onZIndexChanged:0}],url:[{onSourceChanged:0}],typeName:[{onSourceChanged:0}],version:[{onSourceChanged:0}],outputFormat:[{onSourceChanged:0}],srsName:[{onSourceChanged:0}],params:[{onSourceChanged:0}]}}};k.style=":host{display:none}";const T="v-map-layer-wkt - ",M=class{constructor(e){t(this,e),this.ready=r(this,"ready",7)}get el(){return e(this)}loadState="idle";wkt;url;visible=!0;opacity=1;zIndex=1e3;fillColor;fillOpacity;strokeColor;strokeWidth;strokeOpacity;pointRadius;pointColor;iconUrl;iconSize;textProperty;textColor;textSize;ready;didLoad=!1;hasLoadedOnce=!1;helper;setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}appliedGeostylerStyle;async onWktChanged(t,e){s(T+"onWktChanged"),t!==e&&await(this.helper?.updateLayer({type:"wkt",data:{wkt:this.wkt,url:this.url}}))}async onUrlChanged(t,e){s(T+"onUrlChanged"),t!==e&&await(this.helper?.updateLayer({type:"wkt",data:{wkt:this.wkt,url:this.url}}))}async onVisibleChanged(){s(T+"onVisibleChanged"),await(this.helper?.setVisible(this.visible))}async onOpacityChanged(){s(T+"onOpacityChanged"),await(this.helper?.setOpacity(this.opacity))}async onZIndexChanged(){s(T+"onZIndexChanged"),await(this.helper?.setZIndex(this.zIndex))}async onStyleChanged(){s(T+"onStyleChanged"),await(this.helper?.updateLayer({type:"wkt",data:{wkt:this.wkt,url:this.url}}))}async onStyleReady(t){h(t.detail.style)&&this.isTargetedByStyle(t.detail.layerIds)&&(s(T+"Applying geostyler style"),this.appliedGeostylerStyle=t.detail.style,await this.updateLayerWithGeostylerStyle())}isTargetedByStyle(t){return!!t&&(t.includes(this.el.id)||0===t.length)}async applyExistingStyles(){const t=Array.from(document.querySelectorAll("v-map-style"));this.appliedGeostylerStyle=void 0;for(const e of t){const t=e.getStyle?await e.getStyle():void 0;if(!t)continue;if(!h(t))continue;const n=e.getLayerTargetIds?await e.getLayerTargetIds():void 0;if(n&&this.isTargetedByStyle(n)){s(T+"Applying existing geostyler style"),this.appliedGeostylerStyle=t;break}}await this.updateLayerWithGeostylerStyle()}async updateLayerWithGeostylerStyle(){this.appliedGeostylerStyle&&this.helper&&await this.helper.updateLayer({type:"wkt",data:{wkt:this.wkt,url:this.url,geostylerStyle:this.appliedGeostylerStyle}})}isReady(){return this.didLoad}async getLayerId(){return this.helper.getLayerId()}async connectedCallback(){s(T+o.COMPONENT_CONNECTED_CALLBACK),this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id))}createLayerConfig(){const t=this.iconSize?this.iconSize.split(",").map((t=>parseInt(t.trim(),10))):void 0,e={type:"wkt",wkt:this.wkt,url:this.url,visible:this.visible,zIndex:this.zIndex,opacity:this.opacity,style:{fillColor:this.fillColor,fillOpacity:this.fillOpacity,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeOpacity:this.strokeOpacity,pointRadius:this.pointRadius,pointColor:this.pointColor,iconUrl:this.iconUrl,iconSize:t,textProperty:this.textProperty,textColor:this.textColor,textSize:this.textSize}};return this.appliedGeostylerStyle&&(e.geostylerStyle=this.appliedGeostylerStyle),e}async componentWillLoad(){s(T+o.COMPONENT_WILL_LOAD),this.helper=new i(this.el,this)}async componentDidLoad(){s(T+o.COMPONENT_DID_LOAD),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),await this.applyExistingStyles(),this.hasLoadedOnce=!0,this.didLoad=!0,this.ready.emit()}async disconnectedCallback(){s(T+o.COMPONENT_DISCONNECTED_CALLBACK),await(this.helper?.dispose())}render(){}static get watchers(){return{wkt:[{onWktChanged:0}],url:[{onUrlChanged:0}],visible:[{onVisibleChanged:0}],opacity:[{onOpacityChanged:0}],zIndex:[{onZIndexChanged:0}],fillColor:[{onStyleChanged:0}],fillOpacity:[{onStyleChanged:0}],strokeColor:[{onStyleChanged:0}],strokeWidth:[{onStyleChanged:0}],strokeOpacity:[{onStyleChanged:0}],pointRadius:[{onStyleChanged:0}],pointColor:[{onStyleChanged:0}],iconUrl:[{onStyleChanged:0}],iconSize:[{onStyleChanged:0}],textProperty:[{onStyleChanged:0}],textColor:[{onStyleChanged:0}],textSize:[{onStyleChanged:0}]}}};M.style="";const I="v-map-layer-wms - ",_=class{constructor(e){t(this,e),this.ready=r(this,"ready",7)}get el(){return e(this)}loadState="idle";url;layers;styles;format="image/png";transparent=!0;tiled=!0;visible=!0;opacity=1;zIndex=10;ready;hasLoadedOnce=!1;helper;setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}async onVisibleChanged(){s(I+"onVisibleChanged"),await(this.helper?.setVisible(this.visible))}async onOpacityChanged(){s(I+"onOpacityChanged"),await(this.helper?.setOpacity(this.opacity))}async onZIndexChanged(){s(I+"onZIndexChanged"),await(this.helper?.setZIndex(this.zIndex))}async onUrlChanged(t,e){s(I+"onUrlChanged"),t!==e&&await this.updateLayer()}async onLayersChanged(t,e){s(I+"onLayersChanged"),t!==e&&await this.updateLayer()}async onStylesChanged(t,e){s(I+"onStylesChanged"),t!==e&&await this.updateLayer()}async updateLayer(){await(this.helper?.updateLayer({type:"wms",data:{url:this.url,layers:this.layers,styles:this.styles,format:this.format,transparent:String(this.transparent)}}))}async connectedCallback(){s(I+o.COMPONENT_CONNECTED_CALLBACK),this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id))}async componentWillLoad(){s(I+o.COMPONENT_WILL_LOAD),this.helper=new i(this.el,this)}async componentDidLoad(){s(I+o.COMPONENT_DID_LOAD),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),this.hasLoadedOnce=!0,this.ready.emit()}async disconnectedCallback(){s(I+o.COMPONENT_DISCONNECTED_CALLBACK),await(this.helper?.dispose())}createLayerConfig(){return{type:"wms",url:this.url,layers:this.layers,transparent:String(this.transparent),styles:this.styles,format:this.format,extraParams:{tiled:String(this.tiled)},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex}}render(){}static get watchers(){return{visible:[{onVisibleChanged:0}],opacity:[{onOpacityChanged:0}],zIndex:[{onZIndexChanged:0}],url:[{onUrlChanged:0}],layers:[{onLayersChanged:0}],styles:[{onStylesChanged:0}]}}};_.style="";const N="v-map-layer-xyz - ",A=class{constructor(e){t(this,e),this.ready=r(this,"ready",7)}get el(){return e(this)}loadState="idle";url;attributions;maxZoom;tileSize;subdomains;visible=!0;opacity=1;ready;hasLoadedOnce=!1;helper;setLoadState(t){this.loadState=t}async getError(){return this.helper?.getError()}createLayerConfig(){const t={};return null!=this.tileSize&&(t.tileSize=this.tileSize),null!=this.subdomains&&(t.subdomains=this.subdomains),{type:"xyz",url:this.url,attributions:this.attributions,maxZoom:this.maxZoom,visible:this.visible,opacity:this.opacity,...Object.keys(t).length>0?{options:t}:{}}}async connectedCallback(){s(N+o.COMPONENT_CONNECTED_CALLBACK),this.hasLoadedOnce&&(this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id))}async componentWillLoad(){s(N+o.COMPONENT_WILL_LOAD),this.helper=new i(this.el,this)}async componentDidLoad(){s(N+o.COMPONENT_DID_LOAD),this.helper.startLoading(),await this.helper.initLayer((()=>this.createLayerConfig()),this.el.id),this.hasLoadedOnce=!0,this.ready.emit()}async disconnectedCallback(){s(N+o.COMPONENT_DISCONNECTED_CALLBACK),await(this.helper?.dispose())}render(){}};function D(t){return null!=t&&"number"==typeof t.valueOf()}function L(t){return null!=t&&"boolean"==typeof t.valueOf()}A.style="";const j=t=>W(t)||R(t),R=t=>function(t){return null!=t&&"string"==typeof t.valueOf()}(t)||D(t)||L(t)||null===t,P=t=>z(t)||$(t)||B(t)||U(t)||B(t)||L(t),z=t=>{const e=t&&"<=x<="===t[0]?4:3;return Array.isArray(t)&&t.length===e&&(t=>["==","*=","!=","<","<=",">",">=","<=x<="].includes(t))(t[0])&&j(t[1])&&j(t[2])&&("<=x<="!==t[0]||D(t[3]))},$=t=>Array.isArray(t)&&t.length>=3&&(t=>["&&","||"].includes(t))(t[0])&&t.every(((t,e)=>0===e||P(t))),U=t=>Array.isArray(t)&&2===t.length&&(t=>"!"===t)(t[0])&&P(t[1]),G=t=>["abs","acos","add","asin","atan","atan2","ceil","cos","div","exp","floor","interpolate","log","max","min","modulo","mul","pi","pow","random","rint","round","sin","sqrt","strIndexOf","strLastIndexOf","strLength","sub","tan","toDegrees","toNumber","toRadians"].includes(t?.name),B=t=>["all","any","between","double2bool","equalTo","greaterThan","greaterThanOrEqualTo","in","lessThan","lessThanOrEqualTo","not","notEqualTo","parseBoolean","strEndsWith","strEqualsIgnoreCase","strMatches","strStartsWith"].includes(t?.name),W=t=>B(t)||G(t)||(t=>["numberFormat","strAbbreviate","strCapitalize","strConcat","strDefaultIfBlank","strReplace","strStripAccents","strSubstring","strSubstringStart","strToLowerCase","strToString","strToUpperCase","strTrim"].includes(t?.name))(t)||(t=>["case","property","step"].includes(t?.name))(t),q=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",V=new RegExp("^["+q+"]["+q+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function Y(t,e){const n=[];let r=e.exec(t);for(;r;){const i=[];i.startIndex=e.lastIndex-r[0].length;const s=r.length;for(let t=0;t<s;t++)i.push(r[t]);n.push(i),r=e.exec(t)}return n}const Z=function(t){return!(null==V.exec(t))},J=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],H=["__proto__","constructor","prototype"],K={allowBooleanAttributes:!1,unpairedTags:[]};function X(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function Q(t,e){const n=e;for(;e<t.length;e++)if("?"!=t[e]&&" "!=t[e]);else{const r=t.substr(n,e-n);if(e>5&&"xml"===r)return st("InvalidXml","XML declaration allowed only at the start of the document.",at(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}}return e}function tt(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let n=1;for(e+=8;e<t.length;e++)if("<"===t[e])n++;else if(">"===t[e]&&(n--,0===n))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}return e}function et(t,e){let n="",r="",i=!1;for(;e<t.length;e++){if('"'===t[e]||"'"===t[e])""===r?r=t[e]:r!==t[e]||(r="");else if(">"===t[e]&&""===r){i=!0;break}n+=t[e]}return""===r&&{value:n,index:e,tagClosed:i}}const nt=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function rt(t,e){const n=Y(t,nt),r={};for(let t=0;t<n.length;t++){if(0===n[t][1].length)return st("InvalidAttr","Attribute '"+n[t][2]+"' has no space in starting.",ut(n[t]));if(void 0!==n[t][3]&&void 0===n[t][4])return st("InvalidAttr","Attribute '"+n[t][2]+"' is without value.",ut(n[t]));if(void 0===n[t][3]&&!e.allowBooleanAttributes)return st("InvalidAttr","boolean attribute '"+n[t][2]+"' is not allowed.",ut(n[t]));const i=n[t][2];if(!ot(i))return st("InvalidAttr","Attribute '"+i+"' is an invalid name.",ut(n[t]));if(Object.prototype.hasOwnProperty.call(r,i))return st("InvalidAttr","Attribute '"+i+"' is repeated.",ut(n[t]));r[i]=1}return!0}function it(t,e){if(";"===t[++e])return-1;if("#"===t[e])return function(t,e){let n=/\d/;for("x"===t[e]&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(";"===t[e])return e;if(!t[e].match(n))break}return-1}(t,++e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(";"===t[e])break;return-1}return e}function st(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function ot(t){return Z(t)}function at(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function ut(t){return t.startIndex+t[1].length}const ct=t=>J.includes(t)?"__"+t:t,lt={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:ct};function ht(t,e){if("string"!=typeof t)return;const n=t.toLowerCase();if(J.some((t=>n===t.toLowerCase())))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(H.some((t=>n===t.toLowerCase())))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function ft(t){return"boolean"==typeof t?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,maxEntityCount:100,allowedTags:null,tagFilter:null}:"object"==typeof t&&null!==t?{enabled:!1!==t.enabled,maxEntitySize:Math.max(1,t.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,t.maxExpansionDepth??10),maxTotalExpansions:Math.max(1,t.maxTotalExpansions??1e3),maxExpandedLength:Math.max(1,t.maxExpandedLength??1e5),maxEntityCount:Math.max(1,t.maxEntityCount??100),allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:ft(!0)}const dt=function(t){const e=Object.assign({},lt,t),n=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(const{value:t,name:e}of n)t&&ht(t,e);return null===e.onDangerousProperty&&(e.onDangerousProperty=ct),e.processEntities=ft(e.processEntities),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map((t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t))),e};let pt;pt="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");class yt{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t,e){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),void 0!==e&&(this.child[this.child.length-1][pt]={startIndex:e})}static getMetaDataSymbol(){return pt}}class mt{constructor(t){this.suppressValidationErr=!t,this.options=t}readDocType(t,e){const n=Object.create(null);let r=0;if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");{e+=9;let i=1,s=!1,o=!1;for(;e<t.length;e++)if("<"!==t[e]||o)if(">"===t[e]){if(o?"-"===t[e-1]&&"-"===t[e-2]&&(o=!1,i--):i--,0===i)break}else"["===t[e]&&(s=!0);else{if(s&&bt(t,"!ENTITY",e)){let i,s;if(e+=7,[i,s,e]=this.readEntityExp(t,e+1,this.suppressValidationErr),-1===s.indexOf("&")){if(!1!==this.options.enabled&&null!=this.options.maxEntityCount&&r>=this.options.maxEntityCount)throw new Error(`Entity count (${r+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);const t=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n[i]={regx:RegExp(`&${t};`,"g"),val:s},r++}}else if(s&&bt(t,"!ELEMENT",e)){e+=8;const{index:n}=this.readElementExp(t,e+1);e=n}else if(s&&bt(t,"!ATTLIST",e))e+=8;else if(s&&bt(t,"!NOTATION",e)){e+=9;const{index:n}=this.readNotationExp(t,e+1,this.suppressValidationErr);e=n}else{if(!bt(t,"!--",e))throw new Error("Invalid DOCTYPE");o=!0}i++}if(0!==i)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:e}}readEntityExp(t,e){const n=e=gt(t,e);for(;e<t.length&&!/\s/.test(t[e])&&'"'!==t[e]&&"'"!==t[e];)e++;let r=t.substring(n,e);if(vt(r),e=gt(t,e),!this.suppressValidationErr){if("SYSTEM"===t.substring(e,e+6).toUpperCase())throw new Error("External entities are not supported");if("%"===t[e])throw new Error("Parameter entities are not supported")}let i="";if([e,i]=this.readIdentifierVal(t,e,"entity"),!1!==this.options.enabled&&null!=this.options.maxEntitySize&&i.length>this.options.maxEntitySize)throw new Error(`Entity "${r}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[r,i,--e]}readNotationExp(t,e){const n=e=gt(t,e);for(;e<t.length&&!/\s/.test(t[e]);)e++;let r=t.substring(n,e);!this.suppressValidationErr&&vt(r),e=gt(t,e);const i=t.substring(e,e+6).toUpperCase();if(!this.suppressValidationErr&&"SYSTEM"!==i&&"PUBLIC"!==i)throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);e=gt(t,e+=i.length);let s=null,o=null;if("PUBLIC"===i)[e,s]=this.readIdentifierVal(t,e,"publicIdentifier"),'"'!==t[e=gt(t,e)]&&"'"!==t[e]||([e,o]=this.readIdentifierVal(t,e,"systemIdentifier"));else if("SYSTEM"===i&&([e,o]=this.readIdentifierVal(t,e,"systemIdentifier"),!this.suppressValidationErr&&!o))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:s,systemIdentifier:o,index:--e}}readIdentifierVal(t,e,n){let r="";const i=t[e];if('"'!==i&&"'"!==i)throw new Error(`Expected quoted string, found "${i}"`);const s=++e;for(;e<t.length&&t[e]!==i;)e++;if(r=t.substring(s,e),t[e]!==i)throw new Error(`Unterminated ${n} value`);return[++e,r]}readElementExp(t,e){const n=e=gt(t,e);for(;e<t.length&&!/\s/.test(t[e]);)e++;let r=t.substring(n,e);if(!this.suppressValidationErr&&!Z(r))throw new Error(`Invalid element name: "${r}"`);let i="";if("E"===t[e=gt(t,e)]&&bt(t,"MPTY",e))e+=4;else if("A"===t[e]&&bt(t,"NY",e))e+=2;else if("("===t[e]){const n=++e;for(;e<t.length&&")"!==t[e];)e++;if(i=t.substring(n,e),")"!==t[e])throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[e]}"`);return{elementName:r,contentModel:i.trim(),index:e}}readAttlistExp(t,e){let n=e=gt(t,e);for(;e<t.length&&!/\s/.test(t[e]);)e++;let r=t.substring(n,e);for(vt(r),n=e=gt(t,e);e<t.length&&!/\s/.test(t[e]);)e++;let i=t.substring(n,e);if(!vt(i))throw new Error(`Invalid attribute name: "${i}"`);e=gt(t,e);let s="";if("NOTATION"===t.substring(e,e+8).toUpperCase()){if(s="NOTATION","("!==t[e=gt(t,e+=8)])throw new Error(`Expected '(', found "${t[e]}"`);e++;let n=[];for(;e<t.length&&")"!==t[e];){const r=e;for(;e<t.length&&"|"!==t[e]&&")"!==t[e];)e++;let i=t.substring(r,e);if(i=i.trim(),!vt(i))throw new Error(`Invalid notation name: "${i}"`);n.push(i),"|"===t[e]&&(e++,e=gt(t,e))}if(")"!==t[e])throw new Error("Unterminated list of notations");e++,s+=" ("+n.join("|")+")"}else{const n=e;for(;e<t.length&&!/\s/.test(t[e]);)e++;if(s+=t.substring(n,e),!this.suppressValidationErr&&!["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"].includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}e=gt(t,e);let o="";return"#REQUIRED"===t.substring(e,e+8).toUpperCase()?(o="#REQUIRED",e+=8):"#IMPLIED"===t.substring(e,e+7).toUpperCase()?(o="#IMPLIED",e+=7):[e,o]=this.readIdentifierVal(t,e,"ATTLIST"),{elementName:r,attributeName:i,attributeType:s,defaultValue:o,index:e}}}const gt=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function bt(t,e,n){for(let r=0;r<e.length;r++)if(e[r]!==t[n+r+1])return!1;return!0}function vt(t){if(Z(t))return t;throw new Error(`Invalid entity name ${t}`)}const wt=/^[-+]?0x[a-fA-F0-9]+$/,xt=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,St={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"};const Et=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;class Ot{constructor(t,e={}){this.pattern=t,this.separator=e.separator||".",this.segments=this._parse(t),this._hasDeepWildcard=this.segments.some((t=>"deep-wildcard"===t.type)),this._hasAttributeCondition=this.segments.some((t=>void 0!==t.attrName)),this._hasPositionSelector=this.segments.some((t=>void 0!==t.position))}_parse(t){const e=[];let n=0,r="";for(;n<t.length;)t[n]===this.separator?n+1<t.length&&t[n+1]===this.separator?(r.trim()&&(e.push(this._parseSegment(r.trim())),r=""),e.push({type:"deep-wildcard"}),n+=2):(r.trim()&&e.push(this._parseSegment(r.trim())),r="",n++):(r+=t[n],n++);return r.trim()&&e.push(this._parseSegment(r.trim())),e}_parseSegment(t){const e={type:"tag"};let n=null,r=t;const i=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(i&&(r=i[1]+i[3],i[2])){const t=i[2].slice(1,-1);t&&(n=t)}let s,o,a=r;if(r.includes("::")){const e=r.indexOf("::");if(s=r.substring(0,e).trim(),a=r.substring(e+2).trim(),!s)throw new Error(`Invalid namespace in pattern: ${t}`)}let u=null;if(a.includes(":")){const t=a.lastIndexOf(":"),e=a.substring(0,t).trim(),n=a.substring(t+1).trim();["first","last","odd","even"].includes(n)||/^nth\(\d+\)$/.test(n)?(o=e,u=n):o=a}else o=a;if(!o)throw new Error(`Invalid segment pattern: ${t}`);if(e.tag=o,s&&(e.namespace=s),n)if(n.includes("=")){const t=n.indexOf("=");e.attrName=n.substring(0,t).trim(),e.attrValue=n.substring(t+1).trim()}else e.attrName=n.trim();if(u){const t=u.match(/^nth\((\d+)\)$/);t?(e.position="nth",e.positionValue=parseInt(t[1],10)):e.position=u}return e}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}const Ct=new Set(["push","pop","reset","updateCurrent","restore"]);class Ft{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[]}push(t,e=null,n=null){this.path.length>0&&(this.path[this.path.length-1].values=void 0);const r=this.path.length;this.siblingStacks[r]||(this.siblingStacks[r]=new Map);const i=this.siblingStacks[r],s=n?`${n}:${t}`:t,o=i.get(s)||0;let a=0;for(const t of i.values())a+=t;i.set(s,o+1);const u={tag:t,position:a,counter:o};null!=n&&(u.namespace=n),null!=e&&(u.values=e),this.path.push(u)}pop(){if(0===this.path.length)return;const t=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),t}updateCurrent(t){this.path.length>0&&null!=t&&(this.path[this.path.length-1].values=t)}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0===this.path.length)return;const e=this.path[this.path.length-1];return e.values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const e=this.path[this.path.length-1];return void 0!==e.values&&t in e.values}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,e=!0){const n=t||this.separator;return this.path.map((t=>e&&t.namespace?`${t.namespace}:${t.tag}`:t.tag)).join(n)}toArray(){return this.path.map((t=>t.tag))}reset(){this.path=[],this.siblingStacks=[]}matches(t){const e=t.segments;return 0!==e.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(e):this._matchSimple(e))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let e=0;e<t.length;e++)if(!this._matchSegment(t[e],this.path[e],e===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(t){let e=this.path.length-1,n=t.length-1;for(;n>=0&&e>=0;){const r=t[n];if("deep-wildcard"===r.type){if(n--,n<0)return!0;const r=t[n];let i=!1;for(let t=e;t>=0;t--)if(this._matchSegment(r,this.path[t],t===this.path.length-1)){e=t-1,n--,i=!0;break}if(!i)return!1}else{if(!this._matchSegment(r,this.path[e],e===this.path.length-1))return!1;e--,n--}}return n<0}_matchSegment(t,e,n){if("*"!==t.tag&&t.tag!==e.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==e.namespace)return!1;if(void 0!==t.attrName){if(!n)return!1;if(!e.values||!(t.attrName in e.values))return!1;if(void 0!==t.attrValue&&String(e.values[t.attrName])!==String(t.attrValue))return!1}if(void 0!==t.position){if(!n)return!1;const r=e.counter??0;if("first"===t.position&&0!==r)return!1;if("odd"===t.position&&r%2!=1)return!1;if("even"===t.position&&r%2!=0)return!1;if("nth"===t.position&&r!==t.positionValue)return!1}return!0}snapshot(){return{path:this.path.map((t=>({...t}))),siblingStacks:this.siblingStacks.map((t=>new Map(t)))}}restore(t){this.path=t.path.map((t=>({...t}))),this.siblingStacks=t.siblingStacks.map((t=>new Map(t)))}readOnly(){return new Proxy(this,{get(t,e,n){if(Ct.has(e))return()=>{throw new TypeError(`Cannot call '${e}' on a read-only Matcher. Obtain a writable instance to mutate state.`)};const r=Reflect.get(t,e,n);return"path"===e||"siblingStacks"===e?Object.freeze(Array.isArray(r)?r.map((t=>t instanceof Map?Object.freeze(new Map(t)):Object.freeze({...t}))):r):"function"==typeof r?r.bind(t):r},set(t,e){throw new TypeError(`Cannot set property '${String(e)}' on a read-only Matcher.`)},deleteProperty(t,e){throw new TypeError(`Cannot delete property '${String(e)}' from a read-only Matcher.`)}})}}function kt(t,e){if(!t)return{};const n=e.attributesGroupName?t[e.attributesGroupName]:t;if(!n)return{};const r={};for(const t in n)t.startsWith(e.attributeNamePrefix)?r[t.substring(e.attributeNamePrefix.length)]=n[t]:r[t]=n[t];return r}function Tt(t){if(!t||"string"!=typeof t)return;const e=t.indexOf(":");if(-1!==e&&e>0){const n=t.substring(0,e);if("xmlns"!==n)return n}}class Mt{constructor(t){var e;if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,e)=>Wt(e,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,e)=>Wt(e,16,"&#x")}},this.addExternalEntities=It,this.parseXml=Lt,this.parseTextData=_t,this.resolveNameSpace=Nt,this.buildAttributesMap=Dt,this.isItStopNode=zt,this.replaceEntitiesValue=Rt,this.readStopNodeData=Gt,this.saveTextToParentTag=Pt,this.addChild=jt,this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const n of e){if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:()=>!1,this.entityExpansionCount=0,this.currentExpandedLength=0,this.matcher=new Ft,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodeExpressions=[];for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new Ot(e)):e instanceof Ot&&this.stopNodeExpressions.push(e)}}}}function It(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n],i=r.replace(/[.\-+*:]/g,"\\.");this.lastEntities[r]={regex:new RegExp("&"+i+";","g"),val:t[r]}}}function _t(t,e,n,r,i,s,o){if(void 0!==t&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){o||(t=this.replaceEntitiesValue(t,e,n));const r=this.options.jPath?n.toString():n,a=this.options.tagValueProcessor(e,t,r,i,s);return null==a?t:typeof a!=typeof t||a!==t?a:this.options.trimValues||t.trim()===t?Bt(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function Nt(t){if(this.options.removeNSPrefix){const e=t.split(":"),n="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=n+e[1])}return t}const At=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function Dt(t,e,n){if(!0!==this.options.ignoreAttributes&&"string"==typeof t){const r=Y(t,At),i=r.length,s={},o={};for(let t=0;t<i;t++){const e=this.resolveNameSpace(r[t][1]),i=r[t][4];if(e.length&&void 0!==i){let t=i;this.options.trimValues&&(t=t.trim()),t=this.replaceEntitiesValue(t,n,this.readonlyMatcher),o[e]=t}}Object.keys(o).length>0&&"object"==typeof e&&e.updateCurrent&&e.updateCurrent(o);for(let t=0;t<i;t++){const i=this.resolveNameSpace(r[t][1]),o=this.options.jPath?e.toString():this.readonlyMatcher;if(this.ignoreAttributesFn(i,o))continue;let a=r[t][4],u=this.options.attributeNamePrefix+i;if(i.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u=Vt(u,this.options),void 0!==a){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a,n,this.readonlyMatcher);const t=this.options.jPath?e.toString():this.readonlyMatcher,r=this.options.attributeValueProcessor(i,a,t);s[u]=null==r?a:typeof r!=typeof a||r!==a?r:Bt(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[u]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const t={};return t[this.options.attributesGroupName]=s,t}return s}}const Lt=function(t){t=t.replace(/\r\n?/g,"\n");const e=new yt("!xml");let n=e,r="";this.matcher.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;const i=new mt(this.options.processEntities);for(let s=0;s<t.length;s++)if("<"===t[s])if("/"===t[s+1]){const e=$t(t,">",s,"Closing Tag is not closed.");let i=t.substring(s+2,e).trim();if(this.options.removeNSPrefix){const t=i.indexOf(":");-1!==t&&(i=i.substr(t+1))}i=qt(this.options.transformTagName,i,"",this.options).tagName,n&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher));const o=this.matcher.getCurrentTag();if(i&&-1!==this.options.unpairedTags.indexOf(i))throw new Error(`Unpaired tag can not be used as closing tag: </${i}>`);o&&-1!==this.options.unpairedTags.indexOf(o)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,n=this.tagsNodeStack.pop(),r="",s=e}else if("?"===t[s+1]){let e=Ut(t,s,!1,"?>");if(!e)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,this.readonlyMatcher),this.options.ignoreDeclaration&&"?xml"===e.tagName||this.options.ignorePiTags);else{const t=new yt(e.tagName);t.add(this.options.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&(t[":@"]=this.buildAttributesMap(e.tagExp,this.matcher,e.tagName)),this.addChild(n,t,this.readonlyMatcher,s)}s=e.closeIndex+1}else if("!--"===t.substr(s+1,3)){const e=$t(t,"--\x3e",s+4,"Comment is not closed.");if(this.options.commentPropName){const i=t.substring(s+4,e-2);r=this.saveTextToParentTag(r,n,this.readonlyMatcher),n.add(this.options.commentPropName,[{[this.options.textNodeName]:i}])}s=e}else if("!D"===t.substr(s+1,2)){const e=i.readDocType(t,s);this.docTypeEntities=e.entities,s=e.i}else if("!["===t.substr(s+1,2)){const e=$t(t,"]]>",s,"CDATA is not closed.")-2,i=t.substring(s+9,e);r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let o=this.parseTextData(i,n.tagname,this.readonlyMatcher,!0,!1,!0,!0);null==o&&(o=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:i}]):n.add(this.options.textNodeName,o),s=e+2}else{let i=Ut(t,s,this.options.removeNSPrefix);if(!i){const e=t.substring(Math.max(0,s-50),Math.min(t.length,s+50));throw new Error(`readTagExp returned undefined at position ${s}. Context: "${e}"`)}let o=i.tagName;const a=i.rawTagName;let u=i.tagExp,c=i.attrExpPresent,l=i.closeIndex;if(({tagName:o,tagExp:u}=qt(this.options.transformTagName,o,u,this.options)),this.options.strictReservedNames&&(o===this.options.commentPropName||o===this.options.cdataPropName||o===this.options.textNodeName||o===this.options.attributesGroupName))throw new Error(`Invalid tag name: ${o}`);n&&r&&"!xml"!==n.tagname&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher,!1)),n&&-1!==this.options.unpairedTags.indexOf(n.tagname)&&(n=this.tagsNodeStack.pop(),this.matcher.pop());let h=!1;u.length>0&&u.lastIndexOf("/")===u.length-1&&(h=!0,"/"===o[o.length-1]?(o=o.substr(0,o.length-1),u=o):u=u.substr(0,u.length-1),c=o!==u);let f,d=null;f=Tt(a),o!==e.tagname&&this.matcher.push(o,{},f),o!==u&&c&&(d=this.buildAttributesMap(u,this.matcher,o),d&&kt(d,this.options)),o!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode(this.stopNodeExpressions,this.matcher));const p=s;if(this.isCurrentNodeStopNode){let e="";if(h)s=i.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(o))s=i.closeIndex;else{const n=this.readStopNodeData(t,a,l+1);if(!n)throw new Error(`Unexpected end of ${a}`);s=n.i,e=n.tagContent}const r=new yt(o);d&&(r[":@"]=d),r.add(this.options.textNodeName,e),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(n,r,this.readonlyMatcher,p)}else{if(h){({tagName:o,tagExp:u}=qt(this.options.transformTagName,o,u,this.options));const t=new yt(o);d&&(t[":@"]=d),this.addChild(n,t,this.readonlyMatcher,p),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else{if(-1!==this.options.unpairedTags.indexOf(o)){const t=new yt(o);d&&(t[":@"]=d),this.addChild(n,t,this.readonlyMatcher,p),this.matcher.pop(),this.isCurrentNodeStopNode=!1,s=i.closeIndex;continue}{const t=new yt(o);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),d&&(t[":@"]=d),this.addChild(n,t,this.readonlyMatcher,p),n=t}}r="",s=l}}else r+=t[s];return e.child};function jt(t,e,n,r){this.options.captureMetaData||(r=void 0);const i=this.options.jPath?n.toString():n,s=this.options.updateTag(e.tagname,i,e[":@"]);!1===s||("string"==typeof s?(e.tagname=s,t.addChild(e,r)):t.addChild(e,r))}function Rt(t,e,n){const r=this.options.processEntities;if(!r||!r.enabled)return t;if(r.allowedTags){const i=this.options.jPath?n.toString():n;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(e):r.allowedTags(e,i)))return t}if(r.tagFilter){const i=this.options.jPath?n.toString():n;if(!r.tagFilter(e,i))return t}for(const e of Object.keys(this.docTypeEntities)){const n=this.docTypeEntities[e],i=t.match(n.regx);if(i){if(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);const e=t.length;if(t=t.replace(n.regx,n.val),r.maxExpandedLength&&(this.currentExpandedLength+=t.length-e,this.currentExpandedLength>r.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${r.maxExpandedLength}`)}}for(const e of Object.keys(this.lastEntities)){const n=this.lastEntities[e],i=t.match(n.regex);if(i&&(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);t=t.replace(n.regex,n.val)}if(-1===t.indexOf("&"))return t;if(this.options.htmlEntities)for(const e of Object.keys(this.htmlEntities)){const n=this.htmlEntities[e],i=t.match(n.regex);if(i&&(this.entityExpansionCount+=i.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);t=t.replace(n.regex,n.val)}return t.replace(this.ampEntity.regex,this.ampEntity.val)}function Pt(t,e,n,r){return t&&(void 0===r&&(r=0===e.child.length),void 0!==(t=this.parseTextData(t,e.tagname,n,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,r))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function zt(t,e){if(!t||0===t.length)return!1;for(let n=0;n<t.length;n++)if(e.matches(t[n]))return!0;return!1}function $t(t,e,n,r){const i=t.indexOf(e,n);if(-1===i)throw new Error(r);return i+e.length-1}function Ut(t,e,n,r=">"){const i=function(t,e,n=">"){let r,i="";for(let s=e;s<t.length;s++){let e=t[s];if(r)e===r&&(r="");else if('"'===e||"'"===e)r=e;else if(e===n[0]){if(!n[1])return{data:i,index:s};if(t[s+1]===n[1])return{data:i,index:s}}else"\t"===e&&(e=" ");i+=e}}(t,e+1,r);if(!i)return;let s=i.data;const o=i.index,a=s.search(/\s/);let u=s,c=!0;-1!==a&&(u=s.substring(0,a),s=s.substring(a+1).trimStart());const l=u;if(n){const t=u.indexOf(":");-1!==t&&(u=u.substr(t+1),c=u!==i.data.substr(t+1))}return{tagName:u,tagExp:s,closeIndex:o,attrExpPresent:c,rawTagName:l}}function Gt(t,e,n){const r=n;let i=1;for(;n<t.length;n++)if("<"===t[n])if("/"===t[n+1]){const s=$t(t,">",n,`${e} is not closed`);if(t.substring(n+2,s).trim()===e&&(i--,0===i))return{tagContent:t.substring(r,n),i:s};n=s}else if("?"===t[n+1])n=$t(t,"?>",n+1,"StopNode is not closed.");else if("!--"===t.substr(n+1,3))n=$t(t,"--\x3e",n+3,"StopNode is not closed.");else if("!["===t.substr(n+1,2))n=$t(t,"]]>",n,"StopNode is not closed.")-2;else{const r=Ut(t,n,">");r&&((r&&r.tagName)===e&&"/"!==r.tagExp[r.tagExp.length-1]&&i++,n=r.closeIndex)}}function Bt(t,e,n){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&function(t,e={}){if(e=Object.assign({},St,e),!t||"string"!=typeof t)return t;let n=t.trim();if(0===n.length)return t;if(void 0!==e.skipLike&&e.skipLike.test(n))return t;if("0"===n)return 0;if(e.hex&&wt.test(n))return function(t){if(parseInt)return parseInt(t,16);if(Number.parseInt)return Number.parseInt(t,16);if(window&&window.parseInt)return window.parseInt(t,16);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}(n);if(isFinite(n)){if(n.includes("e")||n.includes("E"))return function(t,e,n){if(!n.eNotation)return t;const r=e.match(Et);if(r){let i=r[1]||"";const s=-1===r[3].indexOf("e")?"E":"e",o=r[2],a=i?t[o.length+1]===s:t[o.length]===s;return o.length>1&&a?t:(1!==o.length||!r[3].startsWith(`.${s}`)&&r[3][0]!==s)&&o.length>0?n.leadingZeros&&!a?(e=(r[1]||"")+r[3],Number(e)):t:Number(e)}return t}(t,n,e);{const i=xt.exec(n);if(i){const s=i[1]||"",o=i[2];let a=(r=i[3])&&-1!==r.indexOf(".")?("."===(r=r.replace(/0+$/,""))?r="0":"."===r[0]?r="0"+r:"."===r[r.length-1]&&(r=r.substring(0,r.length-1)),r):r;if(!e.leadingZeros&&(o.length>1||1===o.length&&!(s?"."===t[o.length+1]:"."===t[o.length])))return t;{const r=Number(n),i=String(r);if(0===r)return r;if(-1!==i.search(/[eE]/))return e.eNotation?r:t;if(-1!==n.indexOf("."))return"0"===i||i===a||i===`${s}${a}`?r:t;let u=o?a:n;return o?u===i||s+u===i?r:t:u===i||u===s+i?r:t}}return t}}var r;return function(t,e,n){const r=e===1/0;switch(n.infinity.toLowerCase()){case"null":return null;case"infinity":return e;case"string":return r?"Infinity":"-Infinity";default:return t}}(t,Number(n),e)}(t,n)}return function(t){return void 0!==t}(t)?t:""}function Wt(t,e,n){const r=Number.parseInt(t,e);return r>=0&&r<=1114111?String.fromCodePoint(r):n+t+";"}function qt(t,e,n,r){if(t){const r=t(e);n===e&&(n=r),e=r}return{tagName:e=Vt(e,r),tagExp:n}}function Vt(t,e){if(H.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return J.includes(t)?e.onDangerousProperty(t):t}const Yt=yt.getMetaDataSymbol();function Zt(t,e){if(!t||"object"!=typeof t)return{};if(!e)return t;const n={};for(const r in t)r.startsWith(e)?n[r.substring(e.length)]=t[r]:n[r]=t[r];return n}function Jt(t,e,n,r){return Ht(t,e,n,r)}function Ht(t,e,n,r){let i;const s={};for(let o=0;o<t.length;o++){const a=t[o],u=Kt(a);if(void 0!==u&&u!==e.textNodeName){const t=Zt(a[":@"]||{},e.attributeNamePrefix);n.push(u,t)}if(u===e.textNodeName)void 0===i?i=a[u]:i+=""+a[u];else{if(void 0===u)continue;if(a[u]){let t=Ht(a[u],e,n,r);const i=Qt(t,e);if(a[":@"]?Xt(t,a[":@"],r,e):1!==Object.keys(t).length||void 0===t[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(t).length&&(e.alwaysCreateTextNode?t[e.textNodeName]="":t=""):t=t[e.textNodeName],void 0!==a[Yt]&&"object"==typeof t&&null!==t&&(t[Yt]=a[Yt]),void 0!==s[u]&&Object.prototype.hasOwnProperty.call(s,u))Array.isArray(s[u])||(s[u]=[s[u]]),s[u].push(t);else{const n=e.jPath?r.toString():r;s[u]=e.isArray(u,n,i)?[t]:t}void 0!==u&&u!==e.textNodeName&&n.pop()}}}return"string"==typeof i?i.length>0&&(s[e.textNodeName]=i):void 0!==i&&(s[e.textNodeName]=i),s}function Kt(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const n=e[t];if(":@"!==n)return n}}function Xt(t,e,n,r){if(e){const i=Object.keys(e),s=i.length;for(let o=0;o<s;o++){const s=i[o],a=s.startsWith(r.attributeNamePrefix)?s.substring(r.attributeNamePrefix.length):s,u=r.jPath?n.toString()+"."+a:n;t[s]=r.isArray(s,u,!0,!0)?[e[s]]:e[s]}}}function Qt(t,e){const{textNodeName:n}=e,r=Object.keys(t).length;return 0===r||!(1!==r||!t[n]&&"boolean"!=typeof t[n]&&0!==t[n])}class te{constructor(t){this.externalEntities={},this.options=dt(t)}parse(t,e){if("string"!=typeof t&&t.toString)t=t.toString();else if("string"!=typeof t)throw new Error("XML data is accepted in String or Bytes[] form.");if(e){!0===e&&(e={});const n=function(t,e){e=Object.assign({},K,e);const n=[];let r=!1,i=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let s=0;s<t.length;s++)if("<"===t[s]&&"?"===t[s+1]){if(s+=2,s=Q(t,s),s.err)return s}else{if("<"!==t[s]){if(X(t[s]))continue;return st("InvalidChar","char '"+t[s]+"' is not expected.",at(t,s))}{let o=s;if(s++,"!"===t[s]){s=tt(t,s);continue}{let a=!1;"/"===t[s]&&(a=!0,s++);let u="";for(;s<t.length&&">"!==t[s]&&" "!==t[s]&&"\t"!==t[s]&&"\n"!==t[s]&&"\r"!==t[s];s++)u+=t[s];if(u=u.trim(),"/"===u[u.length-1]&&(u=u.substring(0,u.length-1),s--),!Z(u)){let e;return e=0===u.trim().length?"Invalid space after '<'.":"Tag '"+u+"' is an invalid name.",st("InvalidTag",e,at(t,s))}const c=et(t,s);if(!1===c)return st("InvalidAttr","Attributes for '"+u+"' have open quote.",at(t,s));let l=c.value;if(s=c.index,"/"===l[l.length-1]){const n=s-l.length;l=l.substring(0,l.length-1);const i=rt(l,e);if(!0!==i)return st(i.err.code,i.err.msg,at(t,n+i.err.line));r=!0}else if(a){if(!c.tagClosed)return st("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",at(t,s));if(l.trim().length>0)return st("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",at(t,o));if(0===n.length)return st("InvalidTag","Closing tag '"+u+"' has not been opened.",at(t,o));{const e=n.pop();if(u!==e.tagName){let n=at(t,e.tagStartPos);return st("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+u+"'.",at(t,o))}0==n.length&&(i=!0)}}else{const a=rt(l,e);if(!0!==a)return st(a.err.code,a.err.msg,at(t,s-l.length+a.err.line));if(!0===i)return st("InvalidXml","Multiple possible root nodes found.",at(t,s));-1!==e.unpairedTags.indexOf(u)||n.push({tagName:u,tagStartPos:o}),r=!0}for(s++;s<t.length;s++)if("<"===t[s]){if("!"===t[s+1]){s++,s=tt(t,s);continue}if("?"!==t[s+1])break;if(s=Q(t,++s),s.err)return s}else if("&"===t[s]){const e=it(t,s);if(-1==e)return st("InvalidChar","char '&' is not expected.",at(t,s));s=e}else if(!0===i&&!X(t[s]))return st("InvalidXml","Extra text at the end",at(t,s));"<"===t[s]&&s--}}}return r?1==n.length?st("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",at(t,n[0].tagStartPos)):!(n.length>0)||st("InvalidXml","Invalid '"+JSON.stringify(n.map((t=>t.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):st("InvalidXml","Start tag expected.",1)}(t,e);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new Mt(this.options);n.addExternalEntities(this.externalEntities);const r=n.parseXml(t);return this.options.preserveOrder||void 0===r?r:Jt(r,this.options,n.matcher,n.readonlyMatcher)}addEntity(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}static getMetaDataSymbol(){return yt.getMetaDataSymbol()}}function ee(t,e){let n="";e.format&&e.indentBy.length>0&&(n="\n");const r=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let t=0;t<e.stopNodes.length;t++){const n=e.stopNodes[t];"string"==typeof n?r.push(new Ot(n)):n instanceof Ot&&r.push(n)}return ne(t,e,n,new Ft,r)}function ne(t,e,n,r,i){let s="",o=!1;if(e.maxNestedTags&&r.getDepth()>e.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(null!=t){let n=t.toString();return n=ce(n,e),n}return""}for(let a=0;a<t.length;a++){const u=t[a],c=oe(u);if(void 0===c)continue;const l=re(u[":@"],e);r.push(c,l);const h=ue(r,i);if(c===e.textNodeName){let t=u[c];h||(t=e.tagValueProcessor(c,t),t=ce(t,e)),o&&(s+=n),s+=t,o=!1,r.pop();continue}if(c===e.cdataPropName){o&&(s+=n),s+=`<![CDATA[${u[c][0][e.textNodeName]}]]>`,o=!1,r.pop();continue}if(c===e.commentPropName){s+=n+`\x3c!--${u[c][0][e.textNodeName]}--\x3e`,o=!0,r.pop();continue}if("?"===c[0]){const t=ae(u[":@"],e,h);let i=u[c][0][e.textNodeName];i=0!==i.length?" "+i:"",s+=("?xml"===c?"":n)+`<${c}${i}${t}?>`,o=!0,r.pop();continue}let f=n;""!==f&&(f+=e.indentBy);const d=n+`<${c}${ae(u[":@"],e,h)}`;let p;p=h?ie(u[c],e):ne(u[c],e,f,r,i),-1!==e.unpairedTags.indexOf(c)?s+=e.suppressUnpairedNode?d+">":d+"/>":p&&0!==p.length||!e.suppressEmptyNode?p&&p.endsWith(">")?s+=d+`>${p}${n}</${c}>`:(s+=d+">",p&&""!==n&&(p.includes("/>")||p.includes("</"))?s+=n+e.indentBy+p+n:s+=p,s+=`</${c}>`):s+=d+"/>",o=!0,r.pop()}return s}function re(t,e){if(!t||e.ignoreAttributes)return null;const n={};let r=!1;for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i.startsWith(e.attributeNamePrefix)?i.substr(e.attributeNamePrefix.length):i]=t[i],r=!0);return r?n:null}function ie(t,e){if(!Array.isArray(t))return null!=t?t.toString():"";let n="";for(let r=0;r<t.length;r++){const i=t[r],s=oe(i);if(s===e.textNodeName)n+=i[s];else if(s===e.cdataPropName)n+=i[s][0][e.textNodeName];else if(s===e.commentPropName)n+=i[s][0][e.textNodeName];else{if(s&&"?"===s[0])continue;if(s){const t=se(i[":@"],e),r=ie(i[s],e);n+=r&&0!==r.length?`<${s}${t}>${r}</${s}>`:`<${s}${t}/>`}}}return n}function se(t,e){let n="";if(t&&!e.ignoreAttributes)for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;let i=t[r];n+=!0===i&&e.suppressBooleanAttributes?` ${r.substr(e.attributeNamePrefix.length)}`:` ${r.substr(e.attributeNamePrefix.length)}="${i}"`}return n}function oe(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(Object.prototype.hasOwnProperty.call(t,r)&&":@"!==r)return r}}function ae(t,e,n){let r="";if(t&&!e.ignoreAttributes)for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let s;n?s=t[i]:(s=e.attributeValueProcessor(i,t[i]),s=ce(s,e)),r+=!0===s&&e.suppressBooleanAttributes?` ${i.substr(e.attributeNamePrefix.length)}`:` ${i.substr(e.attributeNamePrefix.length)}="${s}"`}return r}function ue(t,e){if(!e||0===e.length)return!1;for(let n=0;n<e.length;n++)if(t.matches(e[n]))return!0;return!1}function ce(t,e){if(t&&t.length>0&&e.processEntities)for(let n=0;n<e.entities.length;n++){const r=e.entities[n];t=t.replace(r.regex,r.val)}return t}const le={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0};function he(t){if(this.options=Object.assign({},le,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map((t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t))),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new Ot(e)):e instanceof Ot&&this.stopNodeExpressions.push(e)}var e;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const n of e){if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=pe),this.processTextOrObjNode=fe,this.options.format?(this.indentate=de,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function fe(t,e,n,r){const i=this.extractAttributes(t);if(r.push(e,i),this.checkStopNode(r)){const i=this.buildRawContent(t),s=this.buildAttributesForStopNode(t);return r.pop(),this.buildObjectNode(i,e,s,n)}const s=this.j2x(t,n+1,r);return r.pop(),void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,s.attrStr,n,r):this.buildObjectNode(s.val,e,s.attrStr,n)}function de(t){return this.options.indentBy.repeat(t)}function pe(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}function ye(t){return G(t)?t:Number(t)}function me(t){const{name:e}=t;return"pi"===e||"random"===e?[{Function:[],":@":{"@_name":e}}]:"property"===e?{PropertyName:[{"#text":t.args[0]}]}:[{Function:t.args.map((t=>{if(W(t)){const e=me(t);return Array.isArray(e)?e[0]:e}return{Literal:[{"#text":t}]}})),":@":{"@_name":e}}]}function ge(t){var e,n;const r=null==(n=null==(e=null==t?void 0:t[0])?void 0:e[":@"])?void 0:n["@_name"],i=null==t?void 0:t[0].Function.map((t=>{var e,n,r,i;return t.Function?ge([t]):t.PropertyName?{name:"property",args:[null==(n=null==(e=null==t?void 0:t.PropertyName)?void 0:e[0])?void 0:n["#text"]]}:null==(i=null==(r=null==t?void 0:t.Literal)?void 0:r[0])?void 0:i["#text"]})),s={name:r};return i.length>0&&(s.args=i),s}function be(t,e){return null==t?void 0:t.filter((t=>Object.keys(t).includes(e)))}function ve(t,e,n){var r,i,s,o,a,u,c,l,h,f;if(!t)return;const d=t.filter((t=>{var e;return null==(e=Object.keys(t))?void 0:e.includes(n)})).find((t=>{var n;return(null==(n=null==t?void 0:t[":@"])?void 0:n["@_name"])===e}));return null!=(i=null==(r=null==d?void 0:d[n])?void 0:r[0])&&i.Function?ge(null==d?void 0:d[n]):null!=(o=null==(s=null==d?void 0:d[n])?void 0:s[0])&&o.Literal?null==(l=null==(c=null==(u=null==(a=null==d?void 0:d[n])?void 0:a[0])?void 0:u.Literal)?void 0:c[0])?void 0:l["#text"]:null==(f=null==(h=null==d?void 0:d[n])?void 0:h[0])?void 0:f["#text"]}function we(t,e,n){return ve(t,e,"1.0.0"===n?"CssParameter":"SvgParameter")}function xe(t,e){var n;return null==(n=null==t?void 0:t[":@"])?void 0:n[`@_${e}`]}function Se(t){return Object.keys(t).some((t=>t.endsWith("Symbolizer")))}function Ee(t,e,n){var r,i,s,o,a,u;const c=e.split(/\.(.*)/s);let l=c[0];const h=c[1];let f=t,d=0;if(null!=h&&h.startsWith("@"))return f=be(t,l)[d],xe(f,h.substring(1));if(Array.isArray(t)){if("#text"===l){if(null!=(r=f[0])&&r.Function)return ge(f);if(null!=(i=f[0])&&i.Literal)return null==(a=null==(o=null==(s=f[0])?void 0:s.Literal)?void 0:o[0])?void 0:a["#text"]}if("#text"===l&&null!=(u=f[0])&&u.Function)return ge(f);if(l.startsWith("$")&&n)return we(f,l.substring(1),n);l.endsWith("]")&&(d=Number(l.split("[")[1].split("]")[0]),l=l.split("[")[0]),f=be(t,l)[d]}return f?h?Ee(f[l],h,n):f[l]:void 0}function Oe(t,e){return Object.keys(t).filter((n=>t[n]===e))}function Ce(t){return"number"==typeof t&&!isNaN(t)}function Fe(t,e){for(const n in e)e[n]instanceof Object&&Object.assign(e[n],Fe(t[n]??{},e[n]));return Object.assign(t||{},e),t}he.prototype.build=function(t){if(this.options.preserveOrder)return ee(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new Ft;return this.j2x(t,0,e).val}},he.prototype.j2x=function(t,e,n){let r="",i="";if(this.options.maxNestedTags&&n.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const s=this.options.jPath?n.toString():n,o=this.checkStopNode(n);for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a))if(void 0===t[a])this.isAttribute(a)&&(i+="");else if(null===t[a])this.isAttribute(a)?i+="":i+=a===this.options.cdataPropName?"":"?"===a[0]?this.indentate(e)+"<"+a+"?"+this.tagEndChar:this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(t[a]instanceof Date)i+=this.buildTextValNode(t[a],a,"",e,n);else if("object"!=typeof t[a]){const u=this.isAttribute(a);if(u&&!this.ignoreAttributesFn(u,s))r+=this.buildAttrPairStr(u,""+t[a],o);else if(!u)if(a===this.options.textNodeName){let e=this.options.tagValueProcessor(a,""+t[a]);i+=this.replaceEntitiesValue(e)}else{n.push(a);const r=this.checkStopNode(n);if(n.pop(),r){const n=""+t[a];i+=""===n?this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:this.indentate(e)+"<"+a+">"+n+"</"+a+this.tagEndChar}else i+=this.buildTextValNode(t[a],a,"",e,n)}}else if(Array.isArray(t[a])){const r=t[a].length;let s="",o="";for(let u=0;u<r;u++){const r=t[a][u];if(void 0===r);else if(null===r)i+="?"===a[0]?this.indentate(e)+"<"+a+"?"+this.tagEndChar:this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if("object"==typeof r)if(this.options.oneListGroup){n.push(a);const t=this.j2x(r,e+1,n);n.pop(),s+=t.val,this.options.attributesGroupName&&r.hasOwnProperty(this.options.attributesGroupName)&&(o+=t.attrStr)}else s+=this.processTextOrObjNode(r,a,e,n);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(a,r);t=this.replaceEntitiesValue(t),s+=t}else{n.push(a);const t=this.checkStopNode(n);if(n.pop(),t){const t=""+r;s+=""===t?this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:this.indentate(e)+"<"+a+">"+t+"</"+a+this.tagEndChar}else s+=this.buildTextValNode(r,a,"",e,n)}}this.options.oneListGroup&&(s=this.buildObjectNode(s,a,o,e)),i+=s}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const e=Object.keys(t[a]),n=e.length;for(let i=0;i<n;i++)r+=this.buildAttrPairStr(e[i],""+t[a][e[i]],o)}else i+=this.processTextOrObjNode(t[a],a,e,n);return{attrStr:r,val:i}},he.prototype.buildAttrPairStr=function(t,e,n){return n||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},he.prototype.extractAttributes=function(t){if(!t||"object"!=typeof t)return null;const e={};let n=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const r=t[this.options.attributesGroupName];for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t]=r[t],n=!0)}else for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const i=this.isAttribute(r);i&&(e[i]=t[r],n=!0)}return n?e:null},he.prototype.buildRawContent=function(t){if("string"==typeof t)return t;if("object"!=typeof t||null===t)return String(t);if(void 0!==t[this.options.textNodeName])return t[this.options.textNodeName];let e="";for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;if(this.isAttribute(n))continue;if(this.options.attributesGroupName&&n===this.options.attributesGroupName)continue;const r=t[n];if(n===this.options.textNodeName)e+=r;else if(Array.isArray(r)){for(let t of r)if("string"==typeof t||"number"==typeof t)e+=`<${n}>${t}</${n}>`;else if("object"==typeof t&&null!==t){const r=this.buildRawContent(t),i=this.buildAttributesForStopNode(t);e+=""===r?`<${n}${i}/>`:`<${n}${i}>${r}</${n}>`}}else if("object"==typeof r&&null!==r){const t=this.buildRawContent(r),i=this.buildAttributesForStopNode(r);e+=""===t?`<${n}${i}/>`:`<${n}${i}>${t}</${n}>`}else e+=`<${n}>${r}</${n}>`}return e},he.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const n=t[this.options.attributesGroupName];for(let t in n){if(!Object.prototype.hasOwnProperty.call(n,t))continue;const r=t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t,i=n[t];e+=!0===i&&this.options.suppressBooleanAttributes?" "+r:" "+r+'="'+i+'"'}}else for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const r=this.isAttribute(n);if(r){const i=t[n];e+=!0===i&&this.options.suppressBooleanAttributes?" "+r:" "+r+'="'+i+'"'}}return e},he.prototype.buildObjectNode=function(t,e,n,r){if(""===t)return"?"===e[0]?this.indentate(r)+"<"+e+n+"?"+this.tagEndChar:this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar;{let i="</"+e+this.tagEndChar,s="";return"?"===e[0]&&(s="?",i=""),!n&&""!==n||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===s.length?this.indentate(r)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(r)+"<"+e+n+s+this.tagEndChar+t+this.indentate(r)+i:this.indentate(r)+"<"+e+n+s+">"+t+i}},he.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},he.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||0===this.stopNodeExpressions.length)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1},he.prototype.buildTextValNode=function(t,e,n,r){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(r)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,t);return i=this.replaceEntitiesValue(i),""===i?this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+n+">"+i+"</"+e+this.tagEndChar}},he.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const n=this.options.entities[e];t=t.replace(n.regex,n.val)}return t};var ke=Object.defineProperty,Te=(t,e,n)=>((t,e,n)=>e in t?ke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);const Me=["1.0.0","1.1.0"],Ie="GeoServer",_e=/^ttf:\/\/(.+)#(.+)$/,Ne={PropertyIsEqualTo:"==",PropertyIsNotEqualTo:"!=",PropertyIsLike:"*=",PropertyIsLessThan:"<",PropertyIsLessThanOrEqualTo:"<=",PropertyIsGreaterThan:">",PropertyIsGreaterThanOrEqualTo:">=",PropertyIsNull:"==",PropertyIsBetween:"<=x<="},Ae={Not:"!"},De={And:"&&",Or:"||",PropertyIsBetween:"&&"},Le="http://www.opengeospatial.org/se/units/metre",je="http://www.opengeospatial.org/se/units/pixel",Re=["add","sub","mul","div"],Pe={en:{marksymbolizerParseFailedUnknownWellknownName:({wellKnownName:t})=>`MarkSymbolizer cannot be parsed. WellKnownName ${t} is not supported.`,noFilterDetected:"No Filter detected.",symbolizerKindParseFailed:({sldSymbolizerName:t})=>`Failed to parse SymbolizerKind ${t} from SldRule.`,colorMapEntriesParseFailedColorUndefined:"Cannot parse ColorMapEntries. color is undefined.",contrastEnhancParseFailedHistoAndNormalizeMutuallyExclusive:"Cannot parse ContrastEnhancement. Histogram and Normalize are mutually exclusive.",channelSelectionParseFailedRGBAndGrayscaleMutuallyExclusive:"Cannot parse ChannelSelection. RGB and Grayscale are mutually exclusive.",channelSelectionParseFailedRGBChannelsUndefined:"Cannot parse ChannelSelection. Red, Green and Blue channels must be defined."},de:{},fr:{marksymbolizerParseFailedUnknownWellknownName:({wellKnownName:t})=>`Échec de lecture du symbole de type MarkSymbolizer. Le WellKnownName ${t} n'est pas supporté.`,noFilterDetected:"Aucun filtre détecté.",symbolizerKindParseFailed:({sldSymbolizerName:t})=>`Échec de lecture du type de symbole ${t} à partir de SldRule.`,colorMapEntriesParseFailedColorUndefined:"Lecture de ColorMapEntries échoué. color n'est pas défini.",contrastEnhancParseFailedHistoAndNormalizeMutuallyExclusive:"Échec de lecture des propriétés de contraste ContrastEnhancement échoué. Histogram et Normalize sont mutuellement exclusifs.",channelSelectionParseFailedRGBAndGrayscaleMutuallyExclusive:"Échec de lecture de la sélection de canaux ChannelSelection. RGB et Grayscale sont mutuellement exclusifs.",channelSelectionParseFailedRGBChannelsUndefined:"Échec de lecture de la sélection de canaux ChannelSelection. Les canaux Rouge, Vert et Bleu doivent être définis."}},ze=t=>null==t;class $e{constructor(t){Te(this,"title","SLD Style Parser"),Te(this,"unsupportedProperties",{Symbolizer:{MarkSymbolizer:{avoidEdges:"none",blur:"none",offset:{support:"partial",info:"Only supported for SLD Version 1.1.0"},offsetAnchor:"none",pitchAlignment:"none",pitchScale:"none",visibility:"none"},FillSymbolizer:{antialias:"none",opacity:{support:"none",info:"General opacity is not supported. Use fillOpacity and strokeOpacity instead."},visibility:"none"},IconSymbolizer:{allowOverlap:"none",anchor:"none",avoidEdges:"none",color:"none",haloBlur:"none",haloColor:"none",haloOpacity:"none",haloWidth:"none",keepUpright:"none",offset:{support:"partial",info:"Only supported for SLD Version 1.1.0"},offsetAnchor:"none",optional:"none",padding:"none",pitchAlignment:"none",rotationAlignment:"none",textFit:"none",image:{support:"partial",info:"Sprites are not supported"},textFitPadding:"none",visibility:"none"},LineSymbolizer:{blur:"none",gapWidth:"none",gradient:"none",miterLimit:"none",roundLimit:"none",spacing:"none",visibility:"none"},RasterSymbolizer:{brightnessMax:"none",brightnessMin:"none",contrast:"none",fadeDuration:"none",hueRotate:"none",resampling:"none",saturation:"none",visibility:"none"},TextSymbolizer:{placement:{support:"partial",info:'Only "line" and "point" are currently supported'}}}}),Te(this,"translations",Pe),Te(this,"locale","en"),Te(this,"_parser"),Te(this,"_builder"),Te(this,"_numericFilterFields",[]),Te(this,"_boolFilterFields",[]),Te(this,"_sldVersion","1.0.0"),Te(this,"_sldEnvironment",null),Te(this,"_readingSldVersion","1.0.0"),Te(this,"_symbolizerUnits","pixel"),Te(this,"getTextSymbolizerLabelFromSldSymbolizer",(t=>{var e;if(Array.isArray(t)&&t[0]&&"object"==typeof t[0]&&(t[0].Function||t[0]["ogc:Function"])){const n=t[0],r=t=>{var e,n,r,i,s,o,a,u;return t.PropertyName||t["ogc:PropertyName"]?{name:"property",args:[(null==(n=null==(e=t.PropertyName)?void 0:e[0])?void 0:n["#text"])??(null==(i=null==(r=t["ogc:PropertyName"])?void 0:r[0])?void 0:i["#text"])]}:t.Literal||t["ogc:Literal"]?void 0!==(null==(o=null==(s=t.Literal)?void 0:s[0])?void 0:o["#text"])?t.Literal[0]["#text"]:(null==(u=null==(a=t["ogc:Literal"])?void 0:a[0])?void 0:u["#text"])??"":t.Function||t["ogc:Function"]?this.getTextSymbolizerLabelFromSldSymbolizer([t]):t};return{name:null==(e=n[":@"])?void 0:e["@_name"],args:(n.Function||n["ogc:Function"]).map(r)}}return t.map((t=>{var e,n,r,i,s,o;const a=Object.keys(t)[0];switch(a.replace("ogc:","")){case"#text":return t["#text"];case"Literal":return(null==(n=null==(e=null==t?void 0:t[a])?void 0:e[0])?void 0:n["#text"])||(null==(o=null==(s=null==(i=null==(r=null==t?void 0:t[a])?void 0:r[0])?void 0:i["#cdata"])?void 0:s[0])?void 0:o["#text"]);case"PropertyName":return`{{${t[a][0]["#text"]}}}`;default:return""}})).join("")})),Te(this,"getSldLabelFromTextSymbolizer",(t=>{if(function(t){return null!=t&&"string"==typeof t.valueOf()}(t)){const e="{{",n="}}",r=[];let i=t;for(;i.length;){let t,s=i;const o=s.indexOf(e);if(-1===o){i.includes(" ")||i.includes("\n")?r.push({"ogc:Literal":[{"#cdata":[{"#text":i}]}]}):r.push({"ogc:Literal":[{"#text":i}]});break}o>0&&(t=s.slice(0,o)),s=s.slice(o+e.length);const a=s.indexOf(n);if(-1===a){i.includes(" ")||i.includes("\n")?r.push({"ogc:Literal":[{"#cdata":[{"#text":i}]}]}):r.push({"ogc:Literal":[{"#text":i}]});break}const u=s.slice(0,a);s=s.slice(a+n.length),t&&(t.includes(" ")||t.includes("\n")?r.push({"ogc:Literal":[{"#cdata":[{"#text":t}]}]}):r.push({"ogc:Literal":[{"#text":t}]})),r.push({"ogc:PropertyName":[{"#text":u}]}),i=s}return r}return this.geoStylerFunctionToSldFunctionRecursive(t)})),this.parser=new te({...null==t?void 0:t.parserOptions,ignoreDeclaration:!0,removeNSPrefix:!0,ignoreAttributes:!1,preserveOrder:!0,trimValues:!0}),this.builder=new he({...null==t?void 0:t.builderOptions,cdataPropName:"#cdata",ignoreAttributes:!1,suppressEmptyNode:!0,preserveOrder:!0}),null!=t&&t.sldVersion&&(this.sldVersion=null==t?void 0:t.sldVersion),void 0!==(null==t?void 0:t.sldEnvironment)&&(this.sldEnvironment=t.sldEnvironment),null!=t&&t.locale&&(this.locale=t.locale),null!=t&&t.translations&&(this.translations=Fe(this.translations,t.translations)),Object.assign(this,t)}translate(t,e){var n,r;const i=(null==(r=null==(n=this.translations)?void 0:n[this.locale])?void 0:r[t])??t;return"function"==typeof i?i(e):i}get parser(){return this._parser}set parser(t){this._parser=t}get builder(){return this._builder}set builder(t){this._builder=t}get numericFilterFields(){return this._numericFilterFields}set numericFilterFields(t){this._numericFilterFields=t}get boolFilterFields(){return this._boolFilterFields}set boolFilterFields(t){this._boolFilterFields=t}get sldVersion(){return this._sldVersion}set sldVersion(t){this._sldVersion=t}get sldEnvironment(){return this._sldEnvironment}set sldEnvironment(t){this._sldEnvironment=t}isSldEnv(t){return this.sldEnvironment===t}get readingSldVersion(){return this._readingSldVersion}set readingSldVersion(t){this._readingSldVersion=t}get symbolizerUnits(){return this._symbolizerUnits}set symbolizerUnits(t){this._symbolizerUnits=t}readStyle(t){return new Promise((e=>{try{const n=this.parser.parse(t),r=xe(n[0],"version");if(!Me.includes(r))throw new Error(`SLD version must be ${Me.toString()}`);this._readingSldVersion=r,e({output:this.sldObjectToGeoStylerStyle(n)})}catch(t){e({errors:[t]})}}))}sldObjectToGeoStylerStyle(t){const e=this.getRulesFromSldObject(t);return{name:this.getStyleNameFromSldObject(t),rules:e}}getRulesFromSldObject(t){const e=be(t[0].StyledLayerDescriptor,"NamedLayer"),n=[];return e.forEach((({NamedLayer:t})=>{be(t,"UserStyle").forEach((({UserStyle:t})=>{be(t,"FeatureTypeStyle").forEach((({FeatureTypeStyle:t})=>{be(t,"Rule").forEach((({Rule:t})=>{const e=this.getFilterFromRule(t),r=this.getScaleDenominatorFromRule(t),i=this.getSymbolizersFromRule(t),s=Ee(t,"Title.#text"),o=Ee(t,"Name.#text"),a={name:void 0!==s?s:void 0!==o?o:""};e&&(a.filter=e),r&&(a.scaleDenominator=r),i&&(a.symbolizers=i),n.push(a)}))}))}))})),n}getStyleNameFromSldObject(t){const e=Ee(t,"StyledLayerDescriptor.NamedLayer[0].UserStyle.Name.#text"),n=Ee(t,"StyledLayerDescriptor.NamedLayer.Name.#text");return e||n||""}getFilterFromRule(t){var e;const n=Ee(t,"Filter");if(!n||0===n.length)return;const r=null==(e=Object.keys(n[0]))?void 0:e[0];return r?this.getFilterFromOperatorAndComparison(r,n):void 0}getScaleDenominatorFromRule(t){const e={},n=Ee(t,"MinScaleDenominator.#text");n&&(e.min=Number(n));const r=Ee(t,"MaxScaleDenominator.#text");return r&&(e.max=Number(r)),Number.isFinite(e.min)||Number.isFinite(e.max)?e:void 0}getSymbolizersFromRule(t){return t.filter(Se).map((t=>{const e=Object.keys(t)[0];switch(e){case"PointSymbolizer":return this.getPointSymbolizerFromSldSymbolizer(t);case"LineSymbolizer":return this.getLineSymbolizerFromSldSymbolizer(t);case"TextSymbolizer":return this.getTextSymbolizerFromSldSymbolizer(t);case"PolygonSymbolizer":return this.getFillSymbolizerFromSldSymbolizer(t);case"RasterSymbolizer":return this.getRasterSymbolizerFromSldSymbolizer(t);default:throw new Error(this.translate("symbolizerKindParseFailed",{sldSymbolizerName:e}))}}))}getFilterFromOperatorAndComparison(t,e){var n;let r;if("Function"===t){const n=Array.isArray(e)?e[0][":@"]["@_name"]:e[":@"]["@_name"];t=`PropertyIs${n.charAt(0).toUpperCase()+n.slice(1)}`}if("PropertyIsBetween"===t)r=["<=x<=",Ee(e,"PropertyIsBetween.PropertyName.#text"),Number(Ee(e,"PropertyIsBetween.LowerBoundary.Literal.#text")),Number(Ee(e,"PropertyIsBetween.UpperBoundary.Literal.#text"))];else if(Object.keys(Ne).includes(t))r=this.getFilterFromComparisonOperator(t,e);else if(Object.keys(De).includes(t)){const i=De[t],s=null==(n=Ee(e,t))?void 0:n.map((t=>{var e;const n=null==(e=Object.keys(t))?void 0:e[0];return this.getFilterFromOperatorAndComparison(n,t)}));r=[i,...s]}else{if(!Object.keys(Ae).includes(t))throw new Error(this.translate("noFilterDetected"));{const n=Ae[t],i=Object.keys(e[t][0])[0];r=[n,this.getFilterFromOperatorAndComparison(i,e[t][0])]}}return r}getFilterFromComparisonOperator(t,e){if("Function"===t){const n=Array.isArray(e)?e[0][":@"]["@_name"]:e[":@"]["@_name"];t=`PropertyIs${n.charAt(0).toUpperCase()+n.slice(1)}`}const n=Ne[t],r=!!Ee(e,"Function");let i=[];const s=Ee(e,r?"Function":t)||[];return i=s.map(((t,e)=>{var n;const r=null==(n=Object.keys(t))?void 0:n[0];return Re.includes(r.toLowerCase())?this.getFilterArgsFromArithmeticOperators(r,t[r]):this.getFilterArgsFromPropertyName(t,s,e)})),"PropertyIsNull"===t&&(i[1]=null),[n,...i]}getFilterArgsFromArithmeticOperators(t,e){const[n,r]=e;return{name:t.toLowerCase(),args:[this.processArithmeticOperand(n,e),this.processArithmeticOperand(r,e)]}}processArithmeticOperand(t,e){var n;const r=null==(n=Object.keys(t))?void 0:n[0];return r&&Re.includes(r.toLowerCase())?this.getFilterArgsFromArithmeticOperators(r,t[r]):this.getFilterArgsFromPropertyName(t,e,0)}getFilterArgsFromPropertyName(t,e,n){const r=Ee([t],"PropertyName.#text");return void 0!==r?1===e.length||0===n&&void 0===Ee([e[1]],"PropertyName.#text")?r:{name:"property",args:[r]}:Ee([t],"#text")}getOffsetFromDisplacement(t){if(ze(t))return;const e=Number(Ee(t,"DisplacementX.#text")),n=Number(Ee(t,"DisplacementY.#text"));return[Number.isFinite(e)?ye(e):0,Number.isFinite(n)&&0!==n?-ye(n):0]}getPointSymbolizerFromSldSymbolizer(t,e){const n=t.PointSymbolizer;let r;return Ee(n,"Graphic.Mark.WellKnownName.#text"),r=Ee(n,"Graphic.ExternalGraphic")?this.getIconSymbolizerFromSldSymbolizer(t):this.getMarkSymbolizerFromSldSymbolizer(t),r}getLineSymbolizerFromSldSymbolizer(t){const e=t.LineSymbolizer,n=this.getDistanceUnit(t),r={kind:"Line"},i=Ee(e,"Stroke",this.readingSldVersion),s=we(i,"stroke",this.readingSldVersion),o=we(i,"stroke-width",this.readingSldVersion),a=we(i,"stroke-opacity",this.readingSldVersion),u=we(i,"stroke-linejoin",this.readingSldVersion),c=we(i,"stroke-linecap",this.readingSldVersion),l=we(i,"stroke-dasharray",this.readingSldVersion),h=we(i,"stroke-dashoffset",this.readingSldVersion);if(ze(s)||(r.color=s),ze(o)||(r.width=ye(o)),ze(n)||(r.widthUnit=n),ze(a)||(r.opacity=ye(a)),ze(u)||(r.join="mitre"===u?"miter":u),ze(c)||(r.cap=c),!ze(l)){const t=l.split(" ").map(ye);r.dasharray=t}ze(h)||(r.dashOffset=ye(h));const f=Ee(i,"GraphicStroke");ze(f)||(r.graphicStroke=this.getPointSymbolizerFromSldSymbolizer({PointSymbolizer:f},n));const d=Ee(i,"GraphicFill");ze(d)||(r.graphicFill=this.getPointSymbolizerFromSldSymbolizer({PointSymbolizer:d},n));const p=Ee(e,"PerpendicularOffset.#text");return ze(p)||(r.perpendicularOffset=ye(p)),r}getTextSymbolizerFromSldSymbolizer(t){const e=t.TextSymbolizer,n=this.getDistanceUnit(t),r={kind:"Text"},i=Ee(e,"Font"),s=Ee(e,"Fill"),o=Ee(e,"Label"),a=Ee(e,"Halo"),u=Ee(a,"Fill"),c=we(s,"fill",this.readingSldVersion),l=we(s,"fill-opacity",this.readingSldVersion),h=we(i,"font-family",this.readingSldVersion),f=we(i,"font-style",this.readingSldVersion),d=we(i,"font-size",this.readingSldVersion),p=we(i,"font-weight",this.readingSldVersion),y=we(u,"fill",this.readingSldVersion);ze(o)||(r.label=this.getTextSymbolizerLabelFromSldSymbolizer(o)),r.color=c||"#000000",ze(l)||(r.opacity=ye(l));const m=Ee(e,"Halo.Radius.#text");ze(m)||(r.haloWidth=ye(m)),ze(n)||(r.haloWidthUnit=n);const g=we(u,"fill-opacity",this.readingSldVersion);ze(g)||(r.haloOpacity=ye(g)),ze(y)||(r.haloColor=y);const b=Ee(e,"LabelPlacement");if(!ze(b)){const t=Ee(b,"PointPlacement"),e=Ee(b,"LinePlacement");if(ze(t)){if(!ze(e)&&(r.placement="line","1.1.0"===this.readingSldVersion)){const t=Ee(e,"IsRepeated.#text"),n=Ee(e,"Gap.#text");t&&!ze(n)&&(r.repeat=ye(n))}}else{r.placement="point";const e=Ee(t,"AnchorPoint");if(!ze(e)){const t=Ee(e,"AnchorPointX.#text"),n=Ee(e,"AnchorPointY.#text");r.anchor=this.getAnchorFromSldAnchorPoint(t,n)}const n=Ee(t,"Displacement"),i=this.getOffsetFromDisplacement(n);ze(i)||(r.offset=i);const s=Ee(t,"Rotation.#text");ze(s)||(r.rotate=ye(s))}}return ze(h)||(r.font=[h]),ze(f)||(r.fontStyle=f.toLowerCase()),ze(p)||(r.fontWeight=p.toLowerCase()),ze(d)||(r.size=ye(d)),ze(n)||(r.sizeUnit=n),r}getFillSymbolizerFromSldSymbolizer(t){const e=t.PolygonSymbolizer,n=this.getDistanceUnit(t),r={kind:"Fill"},i=Ee(e,"Stroke"),s=Ee(e,"Fill"),o=we(s,"fill-opacity",this.readingSldVersion),a=we(s,"fill",this.readingSldVersion),u=we(i,"stroke",this.readingSldVersion),c=we(i,"stroke-width",this.readingSldVersion),l=we(i,"stroke-opacity",this.readingSldVersion),h=we(i,"stroke-dasharray",this.readingSldVersion),f=we(i,"stroke-linecap",this.readingSldVersion),d=we(i,"stroke-linejoin",this.readingSldVersion),p=Ee(e,"Fill.GraphicFill");if(ze(p)||(r.graphicFill=this.getPointSymbolizerFromSldSymbolizer({PointSymbolizer:p})),this.isSldEnv(Ie)){const t=function(t){return ve(t,"graphic-margin","VendorOption")}(e);ze(t)||(r.graphicFillPadding=t.split(/\s/).map(ye))}return ze(a)||(r.color=a),ze(o)||(r.fillOpacity=ye(o)),ze(u)||(r.outlineColor=u),ze(c)||(r.outlineWidth=ye(c)),ze(n)||(r.outlineWidthUnit=n),ze(l)||(r.outlineOpacity=ye(l)),ze(h)||(r.outlineDasharray=h.split(" ").map(ye)),ze(f)||(r.outlineCap=f),ze(d)||(r.outlineJoin=d),r}getRasterSymbolizerFromSldSymbolizer(t){const e=t.RasterSymbolizer,n={kind:"Raster"};let r=Ee(e,"Opacity.#text");ze(r)||(r=ye(r),n.opacity=r);const i=Ee(e,"ColorMap"),s=Ee(e,"ColorMap.@type"),o=Ee(e,"ColorMap.@extended");if(!ze(i)){const t=this.getColorMapFromSldColorMap(i,s,o);n.colorMap=t}const a=Ee(e,"ChannelSelection");if(!ze(a)){const t=this.getChannelSelectionFromSldChannelSelection(a);n.channelSelection=t}const u=Ee(e,"ContrastEnhancement");if(!ze(u)){const t=this.getContrastEnhancementFromSldContrastEnhancement(u);n.contrastEnhancement=t}return n}getMarkSymbolizerFromSldSymbolizer(t){const e=t.PointSymbolizer,n=this.getDistanceUnit(t),r=Ee(e,"Graphic.Mark.WellKnownName.#text"),i=Ee(e,"Graphic.Mark.Stroke"),s=Ee(e,"Graphic.Mark.Fill"),o=Ee(e,"Graphic.Opacity.#text"),a=Ee(e,"Graphic.Size.#text"),u=Ee(e,"Graphic.Rotation.#text"),c=we(s,"fill-opacity",this.readingSldVersion),l=we(s,"fill",this.readingSldVersion),h=Ee(e,"Graphic.Displacement"),f={kind:"Mark",wellKnownName:"circle"};ze(o)||(f.opacity=ye(o)),ze(c)||(f.fillOpacity=ye(c)),ze(l)||(f.color=l),ze(u)||(f.rotate=ye(u)),ze(a)||(f.radius=G(a)?a:Number(a)/2),ze(n)||(f.radiusUnit=n);const d=this.getOffsetFromDisplacement(h);switch(ze(d)||(f.offset=d),r){case"arrow":case"arrowhead":case"asterisk_fill":case"backslash":case"circle":case"cross":case"cross2":case"cross_fill":case"decagon":case"diagonal_half_square":case"diamond":case"equilateral_triangle":case"filled_arrowhead":case"half_arc":case"half_square":case"heart":case"hexagon":case"horline":case"left_half_triangle":case"line":case"octagon":case"parallelogram_left":case"parallelogram_right":case"pentagon":case"quarter_arc":case"quarter_circle":case"quarter_square":case"right_half_triangle":case"rounded_square":case"semi_circle":case"shield":case"slash":case"square":case"square_with_corners":case"star":case"star_diamond":case"third_arc":case"third_circle":case"trapezoid":case"triangle":case"x":case"shape://vertline":case"shape://horline":case"shape://slash":case"shape://backslash":case"shape://dot":case"shape://plus":case"shape://times":case"shape://oarrow":case"shape://carrow":case"brush://dense1":case"brush://dense2":case"brush://dense3":case"brush://dense4":case"brush://dense5":case"brush://dense6":case"brush://dense7":f.wellKnownName=r;break;default:if(_e.test(r)){f.wellKnownName=r;break}throw new Error(this.translate("marksymbolizerParseFailedUnknownWellknownName",{wellKnownName:r}))}const p=we(i,"stroke",this.readingSldVersion);ze(p)||(f.strokeColor=p);const y=we(i,"stroke-width",this.readingSldVersion);ze(y)||(f.strokeWidth=ye(y)),ze(n)||(f.strokeWidthUnit=n);const m=we(i,"stroke-opacity",this.readingSldVersion);ze(m)||(f.strokeOpacity=ye(m));const g=we(i,"stroke-dasharray",this.readingSldVersion);if(!ze(g)){const t=g.split(" ").map(ye);f.strokeDasharray=t}return f}getIconSymbolizerFromSldSymbolizer(t,e){const n=t.PointSymbolizer,r=e||this.getDistanceUnit(t);let i=Ee(n,"Graphic.ExternalGraphic.OnlineResource.@href");i||"1.1.0"!==this.sldVersion||"base64"!==Ee(n,"Graphic.ExternalGraphic.InlineContent.@encoding")||(i=`data:${Ee(n,"Graphic.ExternalGraphic.Format.#text")};base64,${Ee(n,"Graphic.ExternalGraphic.InlineContent.#text")}`);const s={kind:"Icon",image:i},o=Ee(n,"Graphic.Opacity.#text"),a=Ee(n,"Graphic.Size.#text"),u=Ee(n,"Graphic.Rotation.#text"),c=Ee(n,"Graphic.Displacement");ze(o)||(s.opacity=ye(o)),ze(a)||(s.size=ye(a)),ze(r)||(s.sizeUnit=r),ze(u)||(s.rotate=ye(u));const l=this.getOffsetFromDisplacement(c);return ze(l)||(s.offset=l),s}getColorMapFromSldColorMap(t,e="ramp",n){const r={type:e};n&&(r.extended="true"===n);const i=be(t,"ColorMapEntry");if(Array.isArray(i)){const t=i.map((t=>{const e=xe(t,"color");if(!e)throw new Error(this.translate("colorMapEntriesParseFailedColorUndefined"));let n=xe(t,"quantity");n&&(n=ye(n));const r=xe(t,"label");let i=xe(t,"opacity");return ze(i)||(i=ye(i)),{color:e,quantity:n,label:r,opacity:i}}));r.colorMapEntries=t}return r}getContrastEnhancementFromSldContrastEnhancement(t){const e={},n=!!Ee(t,"Histogram"),r=!!Ee(t,"Normalize");if(n&&r)throw new Error(this.translate("contrastEnhancParseFailedHistoAndNormalizeMutuallyExclusive"));n?e.enhancementType="histogram":r&&(e.enhancementType="normalize");let i=Ee(t,"GammaValue.#text");return i&&(i=ye(i)),e.gammaValue=i,e}getChannelFromSldChannel(t){var e;const n={sourceChannelName:null==(e=Ee(t,"SourceChannelName.#text"))?void 0:e.toString()},r=Ee(t,"ContrastEnhancement");return r&&(n.contrastEnhancement=this.getContrastEnhancementFromSldContrastEnhancement(r)),n}getChannelSelectionFromSldChannelSelection(t){let e;const n=Ee(t,"RedChannel"),r=Ee(t,"BlueChannel"),i=Ee(t,"GreenChannel"),s=Ee(t,"GrayChannel");if(s&&n&&r&&i)throw new Error(this.translate("channelSelectionParseFailedRGBAndGrayscaleMutuallyExclusive"));if(s)e={grayChannel:this.getChannelFromSldChannel(s)};else{if(!(n&&i&&r))throw new Error(this.translate("channelSelectionParseFailedRGBChannelsUndefined"));e={redChannel:this.getChannelFromSldChannel(n),blueChannel:this.getChannelFromSldChannel(r),greenChannel:this.getChannelFromSldChannel(i)}}return e}writeStyle(t){return new Promise((e=>{const n=this.checkForUnsupportedProperties(t);try{const r=this.geoStylerStyleToSldObject(t);e({output:this.builder.build(r),unsupportedProperties:n,warnings:n&&["Your style contains unsupportedProperties!"]})}catch(t){e({errors:[t]})}}))}getTagName(t){return["Filter"].includes(t)?t:"CssParameter"===t?"1.1.0"===this.sldVersion?"se:SvgParameter":"CssParameter":"1.1.0"===this.sldVersion?`se:${t}`:t}geoStylerStyleToSldObject(t){const e=this.getSldRulesFromRules(t.rules);e.forEach((t=>{const e=be(Ee(t,this.getTagName("Rule")),"Filter").at(0);e&&(e[":@"]={"@_xmlns":"http://www.opengis.net/ogc"})}));const n=[...e],r=this.getTagName("Name"),i=this.getTagName("Title"),s=this.getTagName("FeatureTypeStyle"),o={"@_version":this.sldVersion,"@_xsi:schemaLocation":"http://www.opengis.net/sld StyledLayerDescriptor.xsd","@_xmlns":"http://www.opengis.net/sld","@_xmlns:ogc":"http://www.opengis.net/ogc","@_xmlns:xlink":"http://www.w3.org/1999/xlink","@_xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@_xmlns:se":"http://www.opengis.net/se"},a=[];return a.push({[r]:[{"#text":t.name||""}]}),"1.0.0"===this.sldVersion&&a.push({[i]:[{"#text":t.name||""}]}),a.push({[s]:n}),[{"?xml":[{"#text":""}],":@":{"@_version":"1.0","@_encoding":"UTF-8","@_standalone":"yes"}},{StyledLayerDescriptor:[{NamedLayer:[{[r]:[{"#text":t.name||""}]},{UserStyle:a}]}],":@":o}]}getSldRulesFromRules(t){const e=this.getTagName("Name"),n=this.getTagName("Filter"),r=this.getTagName("Rule"),i=this.getTagName("MinScaleDenominator"),s=this.getTagName("MaxScaleDenominator");return t.map((t=>{const o={[r]:[]};if(t.name&&o[r].push({[e]:[{"#text":t.name}]}),t.filter){const e=this.getSldFilterFromFilter(t.filter);o[r].push({[n]:e})}if(t.scaleDenominator){const{min:e,max:n}=t.scaleDenominator;e&&Number.isFinite(e)&&o[r].push({[i]:[{"#text":e}]}),n&&Number.isFinite(n)&&o[r].push({[s]:[{"#text":n}]})}const a=this.getSldSymbolizersFromSymbolizers(t.symbolizers);let u=[];return a.length>0&&(u=Object.keys(a[0])),u.forEach((t=>{0===a[0][t].length&&delete a[0][t]})),a.length>0&&0!==u.length&&(o[r]=[...o[r],...a]),o}))}getSldComparisonFilterFromComparisonFilter(t){const e=[],n=t[1],r=t[2],i=Oe(Ne,t[0]),s=i.length>1&&null===r?i[1]:i[0],o="PropertyName";if(W(n)||W(r)){const t=s.replace("PropertyIs",""),e=t.charAt(0).toLowerCase()+t.slice(1),i=W(n)?me(n):n,o=W(r)?me(r):r,a=[];return W(n)?a.unshift(Array.isArray(i)?null==i?void 0:i[0]:i):a.unshift({Literal:[{"#text":i}]}),W(r)?a.push(Array.isArray(o)?null==o?void 0:o[0]:o):a.push({Literal:[{"#text":o}]}),[{Function:a,":@":{"@_name":e}}]}if("PropertyIsNull"===s)e.push({[s]:[{[o]:[{"#text":n}]}]});else if("PropertyIsLike"===s)e.push({[s]:[{[o]:[{"#text":n}]},{Literal:[{"#text":r}]}],":@":{"@_wildCard":"*","@_singleChar":".","@_escape":"!"}});else if("PropertyIsBetween"===s){const r=t;e.push({[s]:[{[o]:[{"#text":n}]},{LowerBoundary:[{Literal:[{"#text":r[2]}]}]},{UpperBoundary:[{Literal:[{"#text":r[3]}]}]}]})}else e.push({[s]:[{[o]:[{"#text":n}]},{Literal:[{"#text":r}]}]});return e}getSldFilterFromFilter(t){let e=[];if(z(t))e=this.getSldComparisonFilterFromComparisonFilter(t);else if(U(t))e.push({Not:this.getSldFilterFromFilter(t[1])});else if($(t)){const[n,...r]=t,i=Oe(De,n)[0],s=r.map((t=>this.getSldFilterFromFilter(t)[0]));e.push({[i]:s})}return e}moveUomEntryToAttributes(t,e){const n=e[e.length-1].uom;n&&("1.1.0"===this.sldVersion&&(t[":@"]={"@_uom":n}),e.pop())}addUomEntry(t,e){"m"===e&&t.push({uom:Le}),"px"===e&&t.push({uom:je})}getDistanceUnit(t){if(!t)return;const e=xe(t,"uom");if(e){if(e===Le)return"m";if(e===je)return"px"}}getSldSymbolizersFromSymbolizers(t){const e=[],n=this.getTagName("PointSymbolizer"),r=this.getTagName("TextSymbolizer"),i=this.getTagName("LineSymbolizer"),s=this.getTagName("PolygonSymbolizer"),o=this.getTagName("RasterSymbolizer");return t.forEach((t=>{const a={};let u;switch(t.kind){case"Mark":u=this.getSldPointSymbolizerFromMarkSymbolizer(t),a[n]=u;break;case"Icon":u=this.getSldPointSymbolizerFromIconSymbolizer(t),a[n]=u;break;case"Text":u=this.getSldTextSymbolizerFromTextSymbolizer(t),a[r]=u;break;case"Line":u=this.getSldLineSymbolizerFromLineSymbolizer(t),a[i]=u;break;case"Fill":u=this.getSldPolygonSymbolizerFromFillSymbolizer(t),a[s]=u;break;case"Raster":u=this.getSldRasterSymbolizerFromRasterSymbolizer(t),a[o]=u}a&&u&&this.moveUomEntryToAttributes(a,u),e.push(a)})),e}getDisplacementFromOffset(t){const e=this.getTagName("Displacement"),n=this.getTagName("DisplacementX"),r=this.getTagName("DisplacementY"),i=W(t[0])?me(t[0]):[{"#text":t[0].toString()}],s=W(t[1])?me(t[1]):[{"#text":(-1*t[1]).toString()}];return{[e]:[{[n]:i},{[r]:s}]}}getSldPointSymbolizerFromMarkSymbolizer(t){var e;const n=this.getTagName("WellKnownName"),r=this.getTagName("CssParameter"),i=this.getTagName("Fill"),s=this.getTagName("Mark"),o=this.getTagName("Stroke"),a=this.getTagName("Opacity"),u=this.getTagName("Rotation"),c=this.getTagName("Size"),l=this.getTagName("Graphic"),h=_e.test(t.wellKnownName),f=[{[n]:[{"#text":h?t.wellKnownName:t.wellKnownName.toLowerCase()}]}];if(t.color||!ze(t.fillOpacity)){const e=[];if(t.color)if(W(t.color)){const n=me(t.color);e.push({[r]:n,":@":{"@_name":"fill"}})}else e.push({[r]:[{"#text":t.color}],":@":{"@_name":"fill"}});if(!ze(t.fillOpacity))if(W(t.fillOpacity)){const n=me(t.fillOpacity);e.push({[r]:n,":@":{"@_name":"fill-opacity"}})}else e.push({[r]:[{"#text":t.fillOpacity}],":@":{"@_name":"fill-opacity"}});f.push({[i]:e})}if(t.strokeColor||Number.isFinite(t.strokeWidth)||Number.isFinite(t.strokeOpacity)){const n=[];if(t.strokeColor)if(W(t.strokeColor)){const e=me(t.strokeColor);n.push({[r]:e,":@":{"@_name":"stroke"}})}else n.push({[r]:[{"#text":t.strokeColor}],":@":{"@_name":"stroke"}});if(!ze(t.strokeWidth))if(W(t.strokeWidth)){const e=me(t.strokeWidth);n.push({[r]:e,":@":{"@_name":"stroke-width"}})}else n.push({[r]:[{"#text":t.strokeWidth}],":@":{"@_name":"stroke-width"}});if(!ze(t.strokeOpacity))if(W(t.strokeOpacity)){const e=me(t.strokeOpacity);n.push({[r]:e,":@":{"@_name":"stroke-opacity"}})}else n.push({[r]:[{"#text":t.strokeOpacity}],":@":{"@_name":"stroke-opacity"}});if(!ze(t.strokeDasharray))if(W(t.strokeDasharray)){const e=me(t.strokeDasharray);n.push({[r]:e,":@":{"@_name":"stroke-dasharray"}})}else n.push({[r]:[{"#text":null==(e=t.strokeDasharray)?void 0:e.join(" ")}],":@":{"@_name":"stroke-dasharray"}});f.push({[o]:n})}const d=[{[s]:f}];ze(t.opacity)||d.push({[a]:[{"#text":t.opacity.toString()}]}),void 0!==t.radius&&(W(t.radius)?d.push({[c]:me(t.radius)}):d.push({[c]:[{"#text":(2*t.radius).toString()}]})),t.rotate&&d.push({[u]:[{"#text":t.rotate.toString()}]}),t.offset&&("1.1.0"===this.sldVersion||this.isSldEnv(Ie))&&d.push(this.getDisplacementFromOffset(t.offset));const p=[{[l]:d}];return this.addUomEntry(p,t.radiusUnit),p}pushGeoServerVendorOption(t,e,n){this.isSldEnv(Ie)&&t.push(this.createGeoServerVendorOption(e,n))}createGeoServerVendorOption(t,e){return{[this.getTagName("VendorOption")]:[{"#text":e}],":@":{"@_name":t}}}getSldPointSymbolizerFromIconSymbolizer(t){const e=this.getTagName("Opacity"),n=this.getTagName("Rotation"),r=this.getTagName("Size"),i=this.getTagName("Graphic"),s=this.getTagName("Displacement"),o=this.getTagName("DisplacementX"),a=this.getTagName("DisplacementY"),u=[];if("string"==typeof t.image||t.image instanceof String){const e=function(t){const e=t.split(",");if(2!==e.length||!e[0].startsWith("data:image/")||!e[0].endsWith(";base64"))return;const n=e[0].split(";");if(2!==n.length)return;const r=n[0].split("/").pop();return r?{data:e[1],extension:r}:void 0}(t.image);u.push(e?this.getSldExternalResourceInlineContent(e):this.getSldExternalResourceOnlineResource(t.image))}return ze(t.opacity)||u.push({[e]:[{"#text":t.opacity}]}),t.size&&u.push({[r]:[{"#text":t.size}]}),t.rotate&&u.push({[n]:[{"#text":t.rotate}]}),t.offset&&"1.1.0"===this.sldVersion&&u.push({[s]:[{[o]:[{"#text":t.offset[0].toString()}]},{[a]:[{"#text":t.offset[1].toString()}]}]}),[{[i]:u}]}getSldExternalResourceInlineContent(t){const e=this.getTagName("ExternalGraphic"),n=this.getTagName("Format"),r=this.getTagName("InlineContent");return{[e]:[{[r]:[{"#text":t.data}],":@":{"@_encoding":"base64"}},{[n]:[{"#text":`image/${t.extension}`}]}]}}getSldExternalResourceOnlineResource(t){const e=this.getTagName("ExternalGraphic"),n=this.getTagName("Format"),r=this.getTagName("OnlineResource"),i={[e]:[{[r]:[],":@":{"@_xlink:type":"simple","@_xmlns:xlink":"http://www.w3.org/1999/xlink","@_xlink:href":t}},{[n]:[]}]},s=t.split(".").pop();switch(s){case"png":case"jpeg":case"gif":i[e][1][n]=[{"#text":`image/${s}`}];break;case"jpg":i[e][1][n]=[{"#text":"image/jpeg"}];break;case"svg":i[e][1][n]=[{"#text":"image/svg+xml"}]}return i}getSldAnchorPointFromAnchor(t,e){return!t||W(t)?0:"x"===e?t.indexOf("left")>=0?0:t.indexOf("right")>=0?1:.5:t.indexOf("bottom")>=0?0:t.indexOf("top")>=0?1:.5}getAnchorFromSldAnchorPoint(t,e){if(!Ce(t)||!Ce(e))return;const n=t<.25?"left":t>.75?"right":"",r=e<.25?"bottom":e>.75?"top":"";return(n&&r?r+"-"+n:r+n)||void 0}getSldTextSymbolizerFromTextSymbolizer(t){const e=this.getTagName("CssParameter"),n=this.getTagName("Fill"),r=this.getTagName("Halo"),i=this.getTagName("Font"),s=this.getTagName("Displacement"),o=this.getTagName("DisplacementX"),a=this.getTagName("DisplacementY"),u=this.getTagName("AnchorPoint"),c=this.getTagName("AnchorPointX"),l=this.getTagName("AnchorPointY"),h=this.getTagName("LabelPlacement"),f=this.getTagName("PointPlacement"),d=this.getTagName("LinePlacement"),p=this.getTagName("Rotation"),y=this.getTagName("Radius"),m=this.getTagName("Label"),g=this.getTagName("PerpendicularOffset"),b=this.getTagName("IsRepeated"),v=this.getTagName("Gap"),w=[{[m]:t.label?this.getSldLabelFromTextSymbolizer(t.label):void 0}],x={font:"font-family",size:"font-size",fontStyle:"font-style",fontWeight:"font-weight"},S=Object.keys(t).filter((t=>"kind"!==t&&x[t])).map((n=>{var r;if(W(t[n])){const r=me(t[n]);return{[e]:r,":@":{"@_name":x[n]}}}return{[e]:[{"#text":"font"===n?null==(r=t[n])?void 0:r[0]:t[n]}],":@":{"@_name":x[n]}}}));if(S.length>0&&w.push({[i]:S}),"line"===t.placement){const e=[];if(void 0!==t.perpendicularOffset)if(W(t.perpendicularOffset)){const n=me(t.perpendicularOffset);e.push({[g]:n})}else e.push({[g]:[{"#text":t.perpendicularOffset.toString()}]});if("1.1.0"===this.sldVersion&&void 0!==t.repeat)if(e.push({[b]:[{"#text":!0}]}),W(t.repeat)){const n=me(t.repeat);e.push({[v]:n})}else e.push({[v]:[{"#text":t.repeat.toString()}]});w.push({[h]:[{[d]:e}]})}else if(Number.isFinite(t.offset)||t.anchor||void 0!==t.rotate||"point"===t.placement){const e=[];t.offset&&e.push({[s]:[{[o]:[{"#text":t.offset[0].toString()}]},{[a]:[{"#text":(-t.offset[1]).toString()}]}]}),t.anchor&&e.push({[u]:[{[c]:[{"#text":this.getSldAnchorPointFromAnchor(t.anchor,"x").toString()}]},{[l]:[{"#text":this.getSldAnchorPointFromAnchor(t.anchor,"y").toString()}]}]}),void 0!==t.rotate&&e.push({[p]:[{"#text":t.rotate.toString()}]}),w.push({[h]:[{[f]:e}]})}if(Number.isFinite(t.haloWidth)||t.haloColor){const i=[],s=[];t.haloWidth&&i.push({[y]:[{"#text":t.haloWidth.toString()}]}),t.haloColor&&s.push({[e]:[{"#text":t.haloColor}],":@":{"@_name":"fill"}}),t.haloOpacity&&s.push({[e]:[{"#text":t.haloOpacity}],":@":{"@_name":"fill-opacity"}}),s.length>0&&i.push({[n]:s}),w.push({[r]:i})}if(t.color||Number.isFinite(t.opacity)){const r=[{[e]:[{"#text":t.color||"#000000"}],":@":{"@_name":"fill"}}];Number.isFinite(t.opacity)&&r.push({[e]:[{"#text":`${t.opacity}`}],":@":{"@_name":"fill-opacity"}}),w.push({[n]:r})}return this.addUomEntry(w,t.sizeUnit),w}geoStylerFunctionToSldFunctionRecursive(t){if(null===t)return t;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return{"ogc:Literal":[{"#text":t}]};if("object"==typeof t){if("string"==typeof t.name||Array.isArray(t.args))return[{"ogc:Function":t.args.map((t=>"object"==typeof t&&null!==t&&"property"===t.name&&Array.isArray(t.args)?{"ogc:PropertyName":[{"#text":t.args[0]}]}:"object"==typeof t&&null!==t&&"string"==typeof t.name&&Array.isArray(t.args)?this.geoStylerFunctionToSldFunctionRecursive(t)[0]:"string"==typeof t||"number"==typeof t||"boolean"==typeof t?{"ogc:Literal":[{"#text":t}]}:t)),":@":{"@_name":t.name}}];if("property"===t.name&&Array.isArray(t.args))return{"ogc:PropertyName":[{"#text":t.args[0]}]}}return t}getSldLineSymbolizerFromLineSymbolizer(t){var e,n,r,i,s,o,a;const u=this.getTagName("CssParameter"),c=this.getTagName("Stroke"),l=this.getTagName("GraphicStroke"),h=this.getTagName("GraphicFill"),f=this.getTagName("PerpendicularOffset"),d={color:"stroke",width:"stroke-width",opacity:"stroke-opacity",join:"stroke-linejoin",cap:"stroke-linecap",dasharray:"stroke-dasharray",dashOffset:"stroke-dashoffset"},p=[],y=Object.keys(t).filter((e=>"kind"!==e&&d[e]&&null!=t[e])).map((e=>{let n=t[e];if("dasharray"===e)return n=t.dasharray?t.dasharray.join(" "):void 0,{[u]:[{"#text":n}],":@":{"@_name":d[e]}};if("join"===e&&"miter"===n&&(n="mitre"),W(t[e])){const n=me(t[e]);return{[u]:n,":@":{"@_name":d[e]}}}return{[u]:[{"#text":t[e]}],":@":{"@_name":d[e]}}}));if(null!=t&&t.graphicStroke)if(Array.isArray(null==(e=null==p?void 0:p[0])?void 0:e[c])||(p[0]={[c]:[]}),"Mark"===(null==(n=null==t?void 0:t.graphicStroke)?void 0:n.kind)){const e=this.getSldPointSymbolizerFromMarkSymbolizer(t.graphicStroke);p[0][c].push({[l]:e})}else if("Icon"===(null==(r=null==t?void 0:t.graphicStroke)?void 0:r.kind)){const e=this.getSldPointSymbolizerFromIconSymbolizer(t.graphicStroke);p[0][c].push({[l]:e})}if(null!=t&&t.graphicFill)if(Array.isArray(null==(i=null==p?void 0:p[0])?void 0:i[c])||(p[0]={[c]:[]}),"Mark"===(null==(s=null==t?void 0:t.graphicFill)?void 0:s.kind)){const e=this.getSldPointSymbolizerFromMarkSymbolizer(t.graphicFill);p[0][c].push({[h]:e})}else if("Icon"===(null==(o=null==t?void 0:t.graphicFill)?void 0:o.kind)){const e=this.getSldPointSymbolizerFromIconSymbolizer(t.graphicFill);p[0][c].push({[h]:e})}return 0!==y.length&&(Array.isArray(null==(a=null==p?void 0:p[0])?void 0:a[c])||(p[0]={[c]:[]}),p[0][c].push(...y)),t.perpendicularOffset&&p.push({[f]:[{"#text":t.perpendicularOffset}]}),0===p.length&&p.push({[c]:{}}),this.addUomEntry(p,t.widthUnit),p}getSldPolygonSymbolizerFromFillSymbolizer(t){const e=this.getTagName("CssParameter"),n=this.getTagName("Stroke"),r=this.getTagName("Fill"),i={outlineColor:"stroke",outlineWidth:"stroke-width",outlineOpacity:"stroke-opacity",outlineDasharray:"stroke-dasharray",outlineCap:"stroke-linecap",outlineJoin:"stroke-linejoin"},s={color:"fill",fillOpacity:"fill-opacity"},o=[],a=[];let u;null!=t&&t.graphicFill&&("Mark"===(null==t?void 0:t.graphicFill.kind)?u=this.getSldPointSymbolizerFromMarkSymbolizer(t.graphicFill):"Icon"===(null==t?void 0:t.graphicFill.kind)&&(u=this.getSldPointSymbolizerFromIconSymbolizer(t.graphicFill))),Object.keys(t).filter((t=>"kind"!==t)).filter((e=>null!=t[e])).forEach((n=>{if(Object.keys(s).includes(n))if(W(t[n])){const r=me(t[n]);a.push({[e]:r,":@":{"@_name":s[n]}})}else a.push({[e]:[{"#text":t[n]}],":@":{"@_name":s[n]}});else if(Object.keys(i).includes(n)){let r="";if("outlineDasharray"===n){const e=t[n];r="",e.forEach(((t,n)=>{r+=t,n<e.length-1&&(r+=" ")}))}else r="outlineWidth"===n||"outlineOpacity"===n?t[n]+"":t[n];if(W(t[n])){const r=me(t[n]);o.push({[e]:r,":@":{"@_name":i[n]}})}else o.push({[e]:[{"#text":r}],":@":{"@_name":i[n]}})}}));const c=[];if(a.length>0||u){const e=[],n=t.graphicFillPadding;n&&this.pushGeoServerVendorOption(c,"graphic-margin",n.join(" ")),c.push({[r]:e}),u&&e.push({[this.getTagName("GraphicFill")]:u}),a.length>0&&e.push(...a)}return o.length>0&&c.push({[n]:o}),this.addUomEntry(c,t.outlineWidthUnit),c}getSldRasterSymbolizerFromRasterSymbolizer(t){const e=[];let n,r,i;return void 0!==t.opacity&&(e.push({}),e[0].Opacity=[{"#text":t.opacity}]),t.colorMap&&(n=this.getSldColorMapFromColorMap(t.colorMap),null!=n&&n[0]&&e.push({ColorMap:n})),t.channelSelection&&(r=this.getSldChannelSelectionFromChannelSelection(t.channelSelection),null!=r&&r[0]&&e.push({ChannelSelection:r})),t.contrastEnhancement&&(i=this.getSldContrastEnhancementFromContrastEnhancement(t.contrastEnhancement),null!=i&&i[0]&&e.push({ContrastEnhancement:i})),e}getSldColorMapFromColorMap(t){const e=[];if(t.type&&(e[":@"]={"@_type":t.type}),void 0!==t.extended){const n=t.extended.toString();e[":@"]||(e[":@"]={}),e[":@"]["@_extended"]=n}if(t.colorMapEntries&&t.colorMapEntries.length>0){const n=t.colorMapEntries.map((t=>{const e={ColorMapEntry:[],":@":{}};return t.color&&(e[":@"]["@_color"]=t.color),typeof t.quantity<"u"&&(e[":@"]["@_quantity"]=t.quantity.toString()),t.label&&(e[":@"]["@_label"]=t.label),typeof t.opacity<"u"&&(e[":@"]["@_opacity"]=t.opacity.toString()),e})).filter((t=>Object.keys(t).length>0));e.push(...n)}return e}getSldChannelSelectionFromChannelSelection(t){const e={redChannel:"RedChannel",blueChannel:"BlueChannel",greenChannel:"GreenChannel",grayChannel:"GrayChannel"},n=Object.keys(t),r=[];return n.forEach((n=>{var i,s;const o=[],a=null==(i=null==t?void 0:t[n])?void 0:i.sourceChannelName,u=e[n],c=null==(s=null==t?void 0:t[n])?void 0:s.contrastEnhancement;(a||c)&&(a&&o.push({SourceChannelName:[{"#text":a}]}),c&&o.push({ContrastEnhancement:this.getSldContrastEnhancementFromContrastEnhancement(c)}),r.push({[u]:o}))})),r}getSldContrastEnhancementFromContrastEnhancement(t){const e=[],n=null==t?void 0:t.enhancementType;return"normalize"===n?e.push({Normalize:[]}):"histogram"===n&&e.push({Histogram:[]}),void 0!==t.gammaValue&&e.push({GammaValue:[{"#text":t.gammaValue}]}),e}checkForUnsupportedProperties(t){const e={};if(t.rules.forEach((t=>{t.symbolizers.forEach((t=>{var n,r;const i=(t=>t[0].toUpperCase()+t.slice(1))(`${t.kind}Symbolizer`),s=null==(r=null==(n=this.unsupportedProperties)?void 0:n.Symbolizer)?void 0:r[i];s&&("string"==typeof s||s instanceof String?(e.Symbolizer||(e.Symbolizer={}),e.Symbolizer[i]=s):Object.keys(t).forEach((n=>{if(s[n]){const r=String(t[n]).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`["']${r}["']`);if("partial"===s[n].support&&o.test(s[n].info))return;e.Symbolizer||(e.Symbolizer={}),e.Symbolizer[i]||(e.Symbolizer[i]={}),e.Symbolizer[i][n]=s[n]}})))}))})),Object.keys(e).length>0)return e}}function Ue(t){return null!=t&&"number"==typeof t.valueOf()}function Ge(t){return null!=t&&"boolean"==typeof t.valueOf()}Te($e,"title","SLD Style Parser");const Be=t=>nn(t)||We(t),We=t=>function(t){return null!=t&&"string"==typeof t.valueOf()}(t)||Ue(t)||Ge(t)||null===t,qe=t=>["==","*=","!=","<","<=",">",">=","<=x<="].includes(t),Ve=t=>["&&","||"].includes(t),Ye=t=>"!"===t,Ze=t=>Je(t)||He(t)||en(t)||Ke(t)||en(t)||Ge(t),Je=t=>{const e=t&&"<=x<="===t[0]?4:3;return Array.isArray(t)&&t.length===e&&qe(t[0])&&Be(t[1])&&Be(t[2])&&("<=x<="!==t[0]||Ue(t[3]))},He=t=>Array.isArray(t)&&t.length>=3&&Ve(t[0])&&t.every(((t,e)=>0===e||Ze(t))),Ke=t=>Array.isArray(t)&&2===t.length&&Ye(t[0])&&Ze(t[1]),Xe=t=>"Fill"===(null==t?void 0:t.kind),Qe=t=>["abs","acos","add","asin","atan","atan2","ceil","cos","div","exp","floor","interpolate","log","max","min","modulo","mul","pi","pow","random","rint","round","sin","sqrt","strIndexOf","strLastIndexOf","strLength","sub","tan","toDegrees","toNumber","toRadians"].includes(null==t?void 0:t.name),tn=t=>["numberFormat","strAbbreviate","strCapitalize","strConcat","strDefaultIfBlank","strReplace","strStripAccents","strSubstring","strSubstringStart","strToLowerCase","strToString","strToUpperCase","strTrim"].includes(null==t?void 0:t.name),en=t=>["all","any","between","double2bool","equalTo","greaterThan","greaterThanOrEqualTo","in","lessThan","lessThanOrEqualTo","not","notEqualTo","parseBoolean","strEndsWith","strEqualsIgnoreCase","strMatches","strStartsWith"].includes(null==t?void 0:t.name),nn=t=>en(t)||Qe(t)||tn(t)||(t=>["case","property","step"].includes(null==t?void 0:t.name))(t);class rn{static getResolutions(){const t=[];let e=78271.51696402048;for(t.push(2*e);t.length<=24;e/=2)t.push(e);return t}static getScaleForResolution(t){return 1*t*39.37008*(25.4/.28)}static getZoomForResolution(t){let e=0;const n=rn.getResolutions(),r=n.length;for(;e<r;++e)if(n[e]<t&&e+1<r){const r=n[e]/n[e+1];return e+Math.log(n[e]/t)/Math.log(r)}return r-1}static getResolutionForScale(t){return t/3571.428685714285}static zoomToScale(t){const e=rn.getResolutions();if(t>=e.length)throw new Error("Cannot parse scaleDenominator. ZoomLevel does not exist.");let n;if(Number.isInteger(t))n=e[t];else{const r=Math.floor(t),i=e[r];n=Math.pow(2,r)*i/Math.pow(2,t)}return this.getScaleForResolution(n)}static allUndefined(t){return!t||!Object.keys(t).some((e=>void 0!==t[e]))}static symbolizerAllUndefined(t){return!Object.keys(t).filter((t=>"kind"!==t&&"visibility"!==t)).some((e=>void 0!==t[e]))}static getUrlForMbPlaceholder(t){const e="mapbox://";return t&&t.startsWith(e)?t.replace(e,"https://api.mapbox.com/"):t}static getMbPlaceholderForUrl(t){const e="https://api.mapbox.com/";return t&&t.startsWith(e)?t.replace(e,"mapbox://"):t}static resolveMbTextPlaceholder(t){let e=new RegExp("\\{.*?\\}","g");return t.replace(e,(t=>`{${t}}`))}static getSpriteName(t,e){if(!e?.sprite||!t)throw new Error("Cannot retrieve sprite name. Sprite or metadata missing.");const n=Object.keys(e.sprite).find((n=>{const r=e.sprite[n];return r.position[0]===t.position[0]&&r.position[1]===t.position[1]&&r.size[0]===t.size[0]&&r.size[1]===t.size[1]}));if(!n)throw new Error("Cannot retrieve sprite name. No matching sprite in metadata.");return n||""}static splitRgbaColor(t){const e=t.substring(t.indexOf("(")+1,t.lastIndexOf(")")).split(/,\s*/);return[parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10),parseFloat(e[3])]}static getHexCodeFromRgbArray(t){return"#"+t.map(((t,e)=>{const n=t.toString(16);return e<3?1===n.length?"0"+n:n:""})).join("")}static getHexColor(t){if(t.startsWith("#"))return t;if(t.startsWith("rgb")){const e=this.splitRgbaColor(t);return this.getHexCodeFromRgbArray(e)}}}var sn,on,an,un={exports:{}},cn=(sn||(sn=1,on=un,an=un.exports,function(){var t,e="Expected a function",n="__lodash_hash_undefined__",r="__lodash_placeholder__",i=32,s=128,o=1/0,a=9007199254740991,c=NaN,l=4294967295,h=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",i],["partialRight",64],["rearg",256]],f="[object Arguments]",d="[object Array]",p="[object Boolean]",y="[object Date]",m="[object Error]",g="[object Function]",b="[object GeneratorFunction]",v="[object Map]",w="[object Number]",x="[object Object]",S="[object Promise]",E="[object RegExp]",O="[object Set]",C="[object String]",F="[object Symbol]",k="[object WeakMap]",T="[object ArrayBuffer]",M="[object DataView]",I="[object Float32Array]",_="[object Float64Array]",N="[object Int8Array]",A="[object Int16Array]",D="[object Int32Array]",L="[object Uint8Array]",j="[object Uint8ClampedArray]",R="[object Uint16Array]",P="[object Uint32Array]",z=/\b__p \+= '';/g,$=/\b(__p \+=) '' \+/g,U=/(__e\(.*?\)|\b__t\)) \+\n'';/g,G=/&(?:amp|lt|gt|quot|#39);/g,B=/[&<>"']/g,W=RegExp(G.source),q=RegExp(B.source),V=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,H=/^\w*$/,K=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,X=/[\\^$.*+?()[\]{}|]/g,Q=RegExp(X.source),tt=/^\s+/,et=/\s/,nt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,rt=/\{\n\/\* \[wrapped with (.+)\] \*/,it=/,? & /,st=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ot=/[()=,{}\[\]\/\s]/,at=/\\(\\)?/g,ut=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ct=/\w*$/,lt=/^[-+]0x[0-9a-f]+$/i,ht=/^0b[01]+$/i,ft=/^\[object .+?Constructor\]$/,dt=/^0o[0-7]+$/i,pt=/^(?:0|[1-9]\d*)$/,yt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,mt=/($^)/,gt=/['\n\r\u2028\u2029\\]/g,bt="\\ud800-\\udfff",vt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",wt="\\u2700-\\u27bf",xt="a-z\\xdf-\\xf6\\xf8-\\xff",St="A-Z\\xc0-\\xd6\\xd8-\\xde",Et="\\ufe0e\\ufe0f",Ot="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ct="["+bt+"]",Ft="["+Ot+"]",kt="["+vt+"]",Tt="\\d+",Mt="["+wt+"]",It="["+xt+"]",_t="[^"+bt+Ot+Tt+wt+xt+St+"]",Nt="\\ud83c[\\udffb-\\udfff]",At="[^"+bt+"]",Dt="(?:\\ud83c[\\udde6-\\uddff]){2}",Lt="[\\ud800-\\udbff][\\udc00-\\udfff]",jt="["+St+"]",Rt="\\u200d",Pt="(?:"+It+"|"+_t+")",zt="(?:"+jt+"|"+_t+")",$t="(?:['’](?:d|ll|m|re|s|t|ve))?",Ut="(?:['’](?:D|LL|M|RE|S|T|VE))?",Gt="(?:"+kt+"|"+Nt+")?",Bt="["+Et+"]?",Wt=Bt+Gt+"(?:"+Rt+"(?:"+[At,Dt,Lt].join("|")+")"+Bt+Gt+")*",qt="(?:"+[Mt,Dt,Lt].join("|")+")"+Wt,Vt="(?:"+[At+kt+"?",kt,Dt,Lt,Ct].join("|")+")",Yt=RegExp("['’]","g"),Zt=RegExp(kt,"g"),Jt=RegExp(Nt+"(?="+Nt+")|"+Vt+Wt,"g"),Ht=RegExp([jt+"?"+It+"+"+$t+"(?="+[Ft,jt,"$"].join("|")+")",zt+"+"+Ut+"(?="+[Ft,jt+Pt,"$"].join("|")+")",jt+"?"+Pt+"+"+$t,jt+"+"+Ut,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Tt,qt].join("|"),"g"),Kt=RegExp("["+Rt+bt+vt+Et+"]"),Xt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Qt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],te=-1,ee={};ee[I]=ee[_]=ee[N]=ee[A]=ee[D]=ee[L]=ee[j]=ee[R]=ee[P]=!0,ee[f]=ee[d]=ee[T]=ee[p]=ee[M]=ee[y]=ee[m]=ee[g]=ee[v]=ee[w]=ee[x]=ee[E]=ee[O]=ee[C]=ee[k]=!1;var ne={};ne[f]=ne[d]=ne[T]=ne[M]=ne[p]=ne[y]=ne[I]=ne[_]=ne[N]=ne[A]=ne[D]=ne[v]=ne[w]=ne[x]=ne[E]=ne[O]=ne[C]=ne[F]=ne[L]=ne[j]=ne[R]=ne[P]=!0,ne[m]=ne[g]=ne[k]=!1;var re={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ie=parseFloat,se=parseInt,oe="object"==typeof u&&u&&u.Object===Object&&u,ae="object"==typeof self&&self&&self.Object===Object&&self,ue=oe||ae||Function("return this")(),ce=an&&!an.nodeType&&an,le=ce&&on&&!on.nodeType&&on,he=le&&le.exports===ce,fe=he&&oe.process,de=function(){try{return le&&le.require&&le.require("util").types||fe&&fe.binding&&fe.binding("util")}catch(t){}}(),pe=de&&de.isArrayBuffer,ye=de&&de.isDate,me=de&&de.isMap,ge=de&&de.isRegExp,be=de&&de.isSet,ve=de&&de.isTypedArray;function we(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function xe(t,e,n,r){for(var i=-1,s=null==t?0:t.length;++i<s;){var o=t[i];e(r,o,n(o),t)}return r}function Se(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Ee(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Oe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ce(t,e){for(var n=-1,r=null==t?0:t.length,i=0,s=[];++n<r;){var o=t[n];e(o,n,t)&&(s[i++]=o)}return s}function Fe(t,e){return!(null==t||!t.length)&&je(t,e,0)>-1}function ke(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function Te(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function Me(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function Ie(t,e,n,r){var i=-1,s=null==t?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}function _e(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function Ne(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Ae=$e("length");function De(t,e,n){var r;return n(t,(function(t,n,i){if(e(t,n,i))return r=n,!1})),r}function Le(t,e,n,r){for(var i=t.length,s=n+(r?1:-1);r?s--:++s<i;)if(e(t[s],s,t))return s;return-1}function je(t,e,n){return e==e?function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):Le(t,Pe,n)}function Re(t,e,n,r){for(var i=n-1,s=t.length;++i<s;)if(r(t[i],e))return i;return-1}function Pe(t){return t!=t}function ze(t,e){var n=null==t?0:t.length;return n?Be(t,e)/n:c}function $e(e){return function(n){return null==n?t:n[e]}}function Ue(e){return function(n){return null==e?t:e[n]}}function Ge(t,e,n,r,i){return i(t,(function(t,i,s){n=r?(r=!1,t):e(n,t,i,s)})),n}function Be(e,n){for(var r,i=-1,s=e.length;++i<s;){var o=n(e[i]);o!==t&&(r=r===t?o:r+o)}return r}function We(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function qe(t){return t?t.slice(0,hn(t)+1).replace(tt,""):t}function Ve(t){return function(e){return t(e)}}function Ye(t,e){return Te(e,(function(e){return t[e]}))}function Ze(t,e){return t.has(e)}function Je(t,e){for(var n=-1,r=t.length;++n<r&&je(e,t[n],0)>-1;);return n}function He(t,e){for(var n=t.length;n--&&je(e,t[n],0)>-1;);return n}var Ke=Ue({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),Xe=Ue({"&":"&","<":"<",">":">",'"':""","'":"'"});function Qe(t){return"\\"+re[t]}function tn(t){return Kt.test(t)}function en(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function nn(t,e){return function(n){return t(e(n))}}function rn(t,e){for(var n=-1,i=t.length,s=0,o=[];++n<i;){var a=t[n];a!==e&&a!==r||(t[n]=r,o[s++]=n)}return o}function sn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function un(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function cn(t){return tn(t)?function(t){for(var e=Jt.lastIndex=0;Jt.test(t);)++e;return e}(t):Ae(t)}function ln(t){return tn(t)?function(t){return t.match(Jt)||[]}(t):function(t){return t.split("")}(t)}function hn(t){for(var e=t.length;e--&&et.test(t.charAt(e)););return e}var fn=Ue({"&":"&","<":"<",">":">",""":'"',"'":"'"}),dn=function u(et){var bt,vt=(et=null==et?ue:dn.defaults(ue.Object(),et,dn.pick(ue,Qt))).Array,wt=et.Date,xt=et.Error,St=et.Function,Et=et.Math,Ot=et.Object,Ct=et.RegExp,Ft=et.String,kt=et.TypeError,Tt=vt.prototype,Mt=Ot.prototype,It=et["__core-js_shared__"],_t=St.prototype.toString,Nt=Mt.hasOwnProperty,At=0,Dt=(bt=/[^.]+$/.exec(It&&It.keys&&It.keys.IE_PROTO||""))?"Symbol(src)_1."+bt:"",Lt=Mt.toString,jt=_t.call(Ot),Rt=ue._,Pt=Ct("^"+_t.call(Nt).replace(X,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),zt=he?et.Buffer:t,$t=et.Symbol,Ut=et.Uint8Array,Gt=zt?zt.allocUnsafe:t,Bt=nn(Ot.getPrototypeOf,Ot),Wt=Ot.create,qt=Mt.propertyIsEnumerable,Vt=Tt.splice,Jt=$t?$t.isConcatSpreadable:t,Kt=$t?$t.iterator:t,re=$t?$t.toStringTag:t,oe=function(){try{var t=as(Ot,"defineProperty");return t({},"",{}),t}catch(t){}}(),ae=et.clearTimeout!==ue.clearTimeout&&et.clearTimeout,ce=wt&&wt.now!==ue.Date.now&&wt.now,le=et.setTimeout!==ue.setTimeout&&et.setTimeout,fe=Et.ceil,de=Et.floor,Ae=Ot.getOwnPropertySymbols,Ue=zt?zt.isBuffer:t,on=et.isFinite,an=Tt.join,pn=nn(Ot.keys,Ot),yn=Et.max,mn=Et.min,gn=wt.now,bn=et.parseInt,vn=Et.random,wn=Tt.reverse,xn=as(et,"DataView"),Sn=as(et,"Map"),En=as(et,"Promise"),On=as(et,"Set"),Cn=as(et,"WeakMap"),Fn=as(Ot,"create"),kn=Cn&&new Cn,Tn={},Mn=Ls(xn),In=Ls(Sn),_n=Ls(En),Nn=Ls(On),An=Ls(Cn),Dn=$t?$t.prototype:t,Ln=Dn?Dn.valueOf:t,jn=Dn?Dn.toString:t;function Rn(t){if(Qo(t)&&!Go(t)&&!(t instanceof Un)){if(t instanceof $n)return t;if(Nt.call(t,"__wrapped__"))return js(t)}return new $n(t)}var Pn=function(){function e(){}return function(n){if(!Xo(n))return{};if(Wt)return Wt(n);e.prototype=n;var r=new e;return e.prototype=t,r}}();function zn(){}function $n(e,n){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!n,this.__index__=0,this.__values__=t}function Un(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=l,this.__views__=[]}function Gn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Bn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Wn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function qn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Wn;++e<n;)this.add(t[e])}function Vn(t){var e=this.__data__=new Bn(t);this.size=e.size}function Yn(t,e){var n=Go(t),r=!n&&Uo(t),i=!n&&!r&&Vo(t),s=!n&&!r&&!i&&aa(t),o=n||r||i||s,a=o?We(t.length,Ft):[],u=a.length;for(var c in t)!e&&!Nt.call(t,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ps(c,u))||a.push(c);return a}function Zn(e){var n=e.length;return n?e[Wr(0,n-1)]:t}function Jn(t,e){return Is(Ci(t),ir(e,0,t.length))}function Hn(t){return Is(Ci(t))}function Kn(e,n,r){(r!==t&&!Po(e[n],r)||r===t&&!(n in e))&&nr(e,n,r)}function Xn(e,n,r){var i=e[n];Nt.call(e,n)&&Po(i,r)&&(r!==t||n in e)||nr(e,n,r)}function Qn(t,e){for(var n=t.length;n--;)if(Po(t[n][0],e))return n;return-1}function tr(t,e,n,r){return cr(t,(function(t,i,s){e(r,t,n(t),s)})),r}function er(t,e){return t&&Fi(e,Ma(e),t)}function nr(t,e,n){"__proto__"==e&&oe?oe(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function rr(e,n){for(var r=-1,i=n.length,s=vt(i),o=null==e;++r<i;)s[r]=o?t:Oa(e,n[r]);return s}function ir(e,n,r){return e==e&&(r!==t&&(e=e<=r?e:r),n!==t&&(e=e>=n?e:n)),e}function sr(e,n,r,i,s,o){var a,u=1&n,c=2&n,l=4&n;if(r&&(a=s?r(e,i,s,o):r(e)),a!==t)return a;if(!Xo(e))return e;var h=Go(e);if(h){if(a=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Nt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(e),!u)return Ci(e,a)}else{var d=ls(e),m=d==g||d==b;if(Vo(e))return vi(e,u);if(d==x||d==f||m&&!s){if(a=c||m?{}:fs(e),!u)return c?function(t,e){return Fi(t,cs(t),e)}(e,function(t,e){return t&&Fi(e,Ia(e),t)}(a,e)):function(t,e){return Fi(t,us(t),e)}(e,er(a,e))}else{if(!ne[d])return s?e:{};a=function(t,e,n){var r=t.constructor;switch(e){case T:return wi(t);case p:case y:return new r(+t);case M:return function(t,e){var n=e?wi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case I:case _:case N:case A:case D:case L:case j:case R:case P:return xi(t,n);case v:return new r;case w:case C:return new r(t);case E:return function(t){var e=new t.constructor(t.source,ct.exec(t));return e.lastIndex=t.lastIndex,e}(t);case O:return new r;case F:return Ln?Ot(Ln.call(t)):{}}}(e,d,u)}}o||(o=new Vn);var S=o.get(e);if(S)return S;o.set(e,a),ia(e)?e.forEach((function(t){a.add(sr(t,n,r,t,e,o))})):ta(e)&&e.forEach((function(t,i){a.set(i,sr(t,n,r,i,e,o))}));var k=h?t:(l?c?ts:Qi:c?Ia:Ma)(e);return Se(k||e,(function(t,i){k&&(t=e[i=t]),Xn(a,i,sr(t,n,r,i,e,o))})),a}function or(e,n,r){var i=r.length;if(null==e)return!i;for(e=Ot(e);i--;){var s=r[i],o=e[s];if(o===t&&!(s in e)||!(0,n[s])(o))return!1}return!0}function ar(n,r,i){if("function"!=typeof n)throw new kt(e);return Fs((function(){n.apply(t,i)}),r)}function ur(t,e,n,r){var i=-1,s=Fe,o=!0,a=t.length,u=[],c=e.length;if(!a)return u;n&&(e=Te(e,Ve(n))),r?(s=ke,o=!1):e.length>=200&&(s=Ze,o=!1,e=new qn(e));t:for(;++i<a;){var l=t[i],h=null==n?l:n(l);if(l=r||0!==l?l:0,o&&h==h){for(var f=c;f--;)if(e[f]===h)continue t;u.push(l)}else s(e,h,r)||u.push(l)}return u}Rn.templateSettings={escape:V,evaluate:Y,interpolate:Z,variable:"",imports:{_:Rn}},(Rn.prototype=zn.prototype).constructor=Rn,($n.prototype=Pn(zn.prototype)).constructor=$n,(Un.prototype=Pn(zn.prototype)).constructor=Un,Gn.prototype.clear=function(){this.__data__=Fn?Fn(null):{},this.size=0},Gn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Gn.prototype.get=function(e){var r=this.__data__;if(Fn){var i=r[e];return i===n?t:i}return Nt.call(r,e)?r[e]:t},Gn.prototype.has=function(e){var n=this.__data__;return Fn?n[e]!==t:Nt.call(n,e)},Gn.prototype.set=function(e,r){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Fn&&r===t?n:r,this},Bn.prototype.clear=function(){this.__data__=[],this.size=0},Bn.prototype.delete=function(t){var e=this.__data__,n=Qn(e,t);return!(n<0||(n==e.length-1?e.pop():Vt.call(e,n,1),--this.size,0))},Bn.prototype.get=function(e){var n=this.__data__,r=Qn(n,e);return r<0?t:n[r][1]},Bn.prototype.has=function(t){return Qn(this.__data__,t)>-1},Bn.prototype.set=function(t,e){var n=this.__data__,r=Qn(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Wn.prototype.clear=function(){this.size=0,this.__data__={hash:new Gn,map:new(Sn||Bn),string:new Gn}},Wn.prototype.delete=function(t){var e=ss(this,t).delete(t);return this.size-=e?1:0,e},Wn.prototype.get=function(t){return ss(this,t).get(t)},Wn.prototype.has=function(t){return ss(this,t).has(t)},Wn.prototype.set=function(t,e){var n=ss(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},qn.prototype.add=qn.prototype.push=function(t){return this.__data__.set(t,n),this},qn.prototype.has=function(t){return this.__data__.has(t)},Vn.prototype.clear=function(){this.__data__=new Bn,this.size=0},Vn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Vn.prototype.get=function(t){return this.__data__.get(t)},Vn.prototype.has=function(t){return this.__data__.has(t)},Vn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Bn){var r=n.__data__;if(!Sn||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Wn(r)}return n.set(t,e),this.size=n.size,this};var cr=Mi(gr),lr=Mi(br,!0);function hr(t,e){var n=!0;return cr(t,(function(t,r,i){return n=!!e(t,r,i)})),n}function fr(e,n,r){for(var i=-1,s=e.length;++i<s;){var o=e[i],a=n(o);if(null!=a&&(u===t?a==a&&!oa(a):r(a,u)))var u=a,c=o}return c}function dr(t,e){var n=[];return cr(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n}function pr(t,e,n,r,i){var s=-1,o=t.length;for(n||(n=ds),i||(i=[]);++s<o;){var a=t[s];e>0&&n(a)?e>1?pr(a,e-1,n,r,i):Me(i,a):r||(i[i.length]=a)}return i}var yr=Ii(),mr=Ii(!0);function gr(t,e){return t&&yr(t,e,Ma)}function br(t,e){return t&&mr(t,e,Ma)}function vr(t,e){return Ce(e,(function(e){return Jo(t[e])}))}function wr(e,n){for(var r=0,i=(n=yi(n,e)).length;null!=e&&r<i;)e=e[Ds(n[r++])];return r&&r==i?e:t}function xr(t,e,n){var r=e(t);return Go(t)?r:Me(r,n(t))}function Sr(e){return null==e?e===t?"[object Undefined]":"[object Null]":re&&re in Ot(e)?function(e){var n=Nt.call(e,re),r=e[re];try{e[re]=t;var i=!0}catch(t){}var s=Lt.call(e);return i&&(n?e[re]=r:delete e[re]),s}(e):function(t){return Lt.call(t)}(e)}function Er(t,e){return t>e}function Or(t,e){return null!=t&&Nt.call(t,e)}function Cr(t,e){return null!=t&&e in Ot(t)}function Fr(e,n,r){for(var i=r?ke:Fe,s=e[0].length,o=e.length,a=o,u=vt(o),c=1/0,l=[];a--;){var h=e[a];a&&n&&(h=Te(h,Ve(n))),c=mn(h.length,c),u[a]=!r&&(n||s>=120&&h.length>=120)?new qn(a&&h):t}h=e[0];var f=-1,d=u[0];t:for(;++f<s&&l.length<c;){var p=h[f],y=n?n(p):p;if(p=r||0!==p?p:0,!(d?Ze(d,y):i(l,y,r))){for(a=o;--a;){var m=u[a];if(!(m?Ze(m,y):i(e[a],y,r)))continue t}d&&d.push(y),l.push(p)}}return l}function kr(e,n,r){var i=null==(e=Es(e,n=yi(n,e)))?e:e[Ds(Ys(n))];return null==i?t:we(i,e,r)}function Tr(t){return Qo(t)&&Sr(t)==f}function Mr(e,n,r,i,s){return e===n||(null==e||null==n||!Qo(e)&&!Qo(n)?e!=e&&n!=n:function(e,n,r,i,s,o){var a=Go(e),u=Go(n),c=a?d:ls(e),l=u?d:ls(n),h=(c=c==f?x:c)==x,g=(l=l==f?x:l)==x,b=c==l;if(b&&Vo(e)){if(!Vo(n))return!1;a=!0,h=!1}if(b&&!h)return o||(o=new Vn),a||aa(e)?Ki(e,n,r,i,s,o):function(t,e,n,r,i,s,o){switch(n){case M:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case T:return!(t.byteLength!=e.byteLength||!s(new Ut(t),new Ut(e)));case p:case y:case w:return Po(+t,+e);case m:return t.name==e.name&&t.message==e.message;case E:case C:return t==e+"";case v:var a=en;case O:if(a||(a=sn),t.size!=e.size&&!(1&r))return!1;var u=o.get(t);if(u)return u==e;r|=2,o.set(t,e);var c=Ki(a(t),a(e),r,i,s,o);return o.delete(t),c;case F:if(Ln)return Ln.call(t)==Ln.call(e)}return!1}(e,n,c,r,i,s,o);if(!(1&r)){var S=h&&Nt.call(e,"__wrapped__"),k=g&&Nt.call(n,"__wrapped__");if(S||k){var I=S?e.value():e,_=k?n.value():n;return o||(o=new Vn),s(I,_,r,i,o)}}return!!b&&(o||(o=new Vn),function(e,n,r,i,s,o){var a=1&r,u=Qi(e),c=u.length;if(c!=Qi(n).length&&!a)return!1;for(var l=c;l--;){var h=u[l];if(!(a?h in n:Nt.call(n,h)))return!1}var f=o.get(e),d=o.get(n);if(f&&d)return f==n&&d==e;var p=!0;o.set(e,n),o.set(n,e);for(var y=a;++l<c;){var m=e[h=u[l]],g=n[h];if(i)var b=a?i(g,m,h,n,e,o):i(m,g,h,e,n,o);if(!(b===t?m===g||s(m,g,r,i,o):b)){p=!1;break}y||(y="constructor"==h)}if(p&&!y){var v=e.constructor,w=n.constructor;v==w||!("constructor"in e)||!("constructor"in n)||"function"==typeof v&&v instanceof v&&"function"==typeof w&&w instanceof w||(p=!1)}return o.delete(e),o.delete(n),p}(e,n,r,i,s,o))}(e,n,r,i,Mr,s))}function Ir(e,n,r,i){var s=r.length,o=s,a=!i;if(null==e)return!o;for(e=Ot(e);s--;){var u=r[s];if(a&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++s<o;){var c=(u=r[s])[0],l=e[c],h=u[1];if(a&&u[2]){if(l===t&&!(c in e))return!1}else{var f=new Vn;if(i)var d=i(l,h,c,e,n,f);if(!(d===t?Mr(h,l,3,i,f):d))return!1}}return!0}function _r(t){return!(!Xo(t)||(e=t,Dt&&Dt in e))&&(Jo(t)?Pt:ft).test(Ls(t));var e}function Nr(t){return"function"==typeof t?t:null==t?eu:"object"==typeof t?Go(t)?Rr(t[0],t[1]):jr(t):lu(t)}function Ar(t){if(!vs(t))return pn(t);var e=[];for(var n in Ot(t))Nt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Dr(t,e){return t<e}function Lr(t,e){var n=-1,r=Wo(t)?vt(t.length):[];return cr(t,(function(t,i,s){r[++n]=e(t,i,s)})),r}function jr(t){var e=os(t);return 1==e.length&&e[0][2]?xs(e[0][0],e[0][1]):function(n){return n===t||Ir(n,t,e)}}function Rr(e,n){return ms(e)&&ws(n)?xs(Ds(e),n):function(r){var i=Oa(r,e);return i===t&&i===n?Ca(r,e):Mr(n,i,3)}}function Pr(e,n,r,i,s){e!==n&&yr(n,(function(o,a){if(s||(s=new Vn),Xo(o))!function(e,n,r,i,s,o,a){var u=Os(e,r),c=Os(n,r),l=a.get(c);if(l)Kn(e,r,l);else{var h=o?o(u,c,r+"",e,n,a):t,f=h===t;if(f){var d=Go(c),p=!d&&Vo(c),y=!d&&!p&&aa(c);h=c,d||p||y?Go(u)?h=u:qo(u)?h=Ci(u):p?(f=!1,h=vi(c,!0)):y?(f=!1,h=xi(c,!0)):h=[]:na(c)||Uo(c)?(h=u,Uo(u)?h=ya(u):Xo(u)&&!Jo(u)||(h=fs(c))):f=!1}f&&(a.set(c,h),s(h,c,i,o,a),a.delete(c)),Kn(e,r,h)}}(e,n,a,r,Pr,i,s);else{var u=i?i(Os(e,a),o,a+"",e,n,s):t;u===t&&(u=o),Kn(e,a,u)}}),Ia)}function zr(e,n){var r=e.length;if(r)return ps(n+=n<0?r:0,r)?e[n]:t}function $r(t,e,n){e=e.length?Te(e,(function(t){return Go(t)?function(e){return wr(e,1===t.length?t[0]:t)}:t})):[eu];var r=-1;e=Te(e,Ve(is()));var i=Lr(t,(function(t){var n=Te(e,(function(e){return e(t)}));return{criteria:n,index:++r,value:t}}));return function(t){var e=t.length;for(t.sort((function(t,e){return function(t,e,n){for(var r=-1,i=t.criteria,s=e.criteria,o=i.length,a=n.length;++r<o;){var u=Si(i[r],s[r]);if(u)return r>=a?u:u*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)}));e--;)t[e]=t[e].value;return t}(i)}function Ur(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var o=e[r],a=wr(t,o);n(a,o)&&Jr(s,yi(o,t),a)}return s}function Gr(t,e,n,r){var i=r?Re:je,s=-1,o=e.length,a=t;for(t===e&&(e=Ci(e)),n&&(a=Te(t,Ve(n)));++s<o;)for(var u=0,c=e[s],l=n?n(c):c;(u=i(a,l,u,r))>-1;)a!==t&&Vt.call(a,u,1),Vt.call(t,u,1);return t}function Br(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==s){var s=i;ps(i)?Vt.call(t,i,1):ai(t,i)}}return t}function Wr(t,e){return t+de(vn()*(e-t+1))}function qr(t,e){var n="";if(!t||e<1||e>a)return n;do{e%2&&(n+=t),(e=de(e/2))&&(t+=t)}while(e);return n}function Vr(t,e){return ks(Ss(t,e,eu),t+"")}function Yr(t){return Zn(Pa(t))}function Zr(t,e){var n=Pa(t);return Is(n,ir(e,0,n.length))}function Jr(e,n,r,i){if(!Xo(e))return e;for(var s=-1,o=(n=yi(n,e)).length,a=o-1,u=e;null!=u&&++s<o;){var c=Ds(n[s]),l=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(s!=a){var h=u[c];(l=i?i(h,c,u):t)===t&&(l=Xo(h)?h:ps(n[s+1])?[]:{})}Xn(u,c,l),u=u[c]}return e}var Hr=kn?function(t,e){return kn.set(t,e),t}:eu,Kr=oe?function(t,e){return oe(t,"toString",{configurable:!0,enumerable:!1,value:Xa(e),writable:!0})}:eu;function Xr(t){return Is(Pa(t))}function Qr(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=vt(i);++r<i;)s[r]=t[r+e];return s}function ti(t,e){var n;return cr(t,(function(t,r,i){return!(n=e(t,r,i))})),!!n}function ei(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var s=r+i>>>1,o=t[s];null!==o&&!oa(o)&&(n?o<=e:o<e)?r=s+1:i=s}return i}return ni(t,e,eu,n)}function ni(e,n,r,i){var s=0,o=null==e?0:e.length;if(0===o)return 0;for(var a=(n=r(n))!=n,u=null===n,c=oa(n),l=n===t;s<o;){var h=de((s+o)/2),f=r(e[h]),d=f!==t,p=null===f,y=f==f,m=oa(f);if(a)var g=i||y;else g=l?y&&(i||d):u?y&&d&&(i||!p):c?y&&d&&!p&&(i||!m):!p&&!m&&(i?f<=n:f<n);g?s=h+1:o=h}return mn(o,4294967294)}function ri(t,e){for(var n=-1,r=t.length,i=0,s=[];++n<r;){var o=t[n],a=e?e(o):o;if(!n||!Po(a,u)){var u=a;s[i++]=0===o?0:o}}return s}function ii(t){return"number"==typeof t?t:oa(t)?c:+t}function si(t){if("string"==typeof t)return t;if(Go(t))return Te(t,si)+"";if(oa(t))return jn?jn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function oi(t,e,n){var r=-1,i=Fe,s=t.length,o=!0,a=[],u=a;if(n)o=!1,i=ke;else if(s>=200){var c=e?null:qi(t);if(c)return sn(c);o=!1,i=Ze,u=new qn}else u=e?[]:a;t:for(;++r<s;){var l=t[r],h=e?e(l):l;if(l=n||0!==l?l:0,o&&h==h){for(var f=u.length;f--;)if(u[f]===h)continue t;e&&u.push(h),a.push(l)}else i(u,h,n)||(u!==a&&u.push(h),a.push(l))}return a}function ai(t,e){return null==(t=Es(t,e=yi(e,t)))||delete t[Ds(Ys(e))]}function ui(t,e,n,r){return Jr(t,e,n(wr(t,e)),r)}function ci(t,e,n,r){for(var i=t.length,s=r?i:-1;(r?s--:++s<i)&&e(t[s],s,t););return n?Qr(t,r?0:s,r?s+1:i):Qr(t,r?s+1:0,r?i:s)}function li(t,e){var n=t;return n instanceof Un&&(n=n.value()),Ie(e,(function(t,e){return e.func.apply(e.thisArg,Me([t],e.args))}),n)}function hi(t,e,n){var r=t.length;if(r<2)return r?oi(t[0]):[];for(var i=-1,s=vt(r);++i<r;)for(var o=t[i],a=-1;++a<r;)a!=i&&(s[i]=ur(s[i]||o,t[a],e,n));return oi(pr(s,1),e,n)}function fi(e,n,r){for(var i=-1,s=e.length,o=n.length,a={};++i<s;)r(a,e[i],i<o?n[i]:t);return a}function di(t){return qo(t)?t:[]}function pi(t){return"function"==typeof t?t:eu}function yi(t,e){return Go(t)?t:ms(t,e)?[t]:As(ma(t))}var mi=Vr;function gi(e,n,r){var i=e.length;return r=r===t?i:r,!n&&r>=i?e:Qr(e,n,r)}var bi=ae||function(t){return ue.clearTimeout(t)};function vi(t,e){if(e)return t.slice();var n=t.length,r=Gt?Gt(n):new t.constructor(n);return t.copy(r),r}function wi(t){var e=new t.constructor(t.byteLength);return new Ut(e).set(new Ut(t)),e}function xi(t,e){var n=e?wi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Si(e,n){if(e!==n){var r=e!==t,i=null===e,s=e==e,o=oa(e),a=n!==t,u=null===n,c=n==n,l=oa(n);if(!u&&!l&&!o&&e>n||o&&a&&c&&!u&&!l||i&&a&&c||!r&&c||!s)return 1;if(!i&&!o&&!l&&e<n||l&&r&&s&&!i&&!o||u&&r&&s||!a&&s||!c)return-1}return 0}function Ei(t,e,n,r){for(var i=-1,s=t.length,o=n.length,a=-1,u=e.length,c=yn(s-o,0),l=vt(u+c),h=!r;++a<u;)l[a]=e[a];for(;++i<o;)(h||i<s)&&(l[n[i]]=t[i]);for(;c--;)l[a++]=t[i++];return l}function Oi(t,e,n,r){for(var i=-1,s=t.length,o=-1,a=n.length,u=-1,c=e.length,l=yn(s-a,0),h=vt(l+c),f=!r;++i<l;)h[i]=t[i];for(var d=i;++u<c;)h[d+u]=e[u];for(;++o<a;)(f||i<s)&&(h[d+n[o]]=t[i++]);return h}function Ci(t,e){var n=-1,r=t.length;for(e||(e=vt(r));++n<r;)e[n]=t[n];return e}function Fi(e,n,r,i){var s=!r;r||(r={});for(var o=-1,a=n.length;++o<a;){var u=n[o],c=i?i(r[u],e[u],u,r,e):t;c===t&&(c=e[u]),s?nr(r,u,c):Xn(r,u,c)}return r}function ki(t,e){return function(n,r){var i=Go(n)?xe:tr,s=e?e():{};return i(n,t,is(r,2),s)}}function Ti(e){return Vr((function(n,r){var i=-1,s=r.length,o=s>1?r[s-1]:t,a=s>2?r[2]:t;for(o=e.length>3&&"function"==typeof o?(s--,o):t,a&&ys(r[0],r[1],a)&&(o=s<3?t:o,s=1),n=Ot(n);++i<s;){var u=r[i];u&&e(n,u,i,o)}return n}))}function Mi(t,e){return function(n,r){if(null==n)return n;if(!Wo(n))return t(n,r);for(var i=n.length,s=e?i:-1,o=Ot(n);(e?s--:++s<i)&&!1!==r(o[s],s,o););return n}}function Ii(t){return function(e,n,r){for(var i=-1,s=Ot(e),o=r(e),a=o.length;a--;){var u=o[t?a:++i];if(!1===n(s[u],u,s))break}return e}}function _i(e){return function(n){var r=tn(n=ma(n))?ln(n):t,i=r?r[0]:n.charAt(0),s=r?gi(r,1).join(""):n.slice(1);return i[e]()+s}}function Ni(t){return function(e){return Ie(Ja(Ua(e).replace(Yt,"")),t,"")}}function Ai(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Pn(t.prototype),r=t.apply(n,e);return Xo(r)?r:n}}function Di(e){return function(n,r,i){var s=Ot(n);if(!Wo(n)){var o=is(r,3);n=Ma(n),r=function(t){return o(s[t],t,s)}}var a=e(n,r,i);return a>-1?s[o?n[a]:a]:t}}function Li(n){return Xi((function(r){var i=r.length,s=i,o=$n.prototype.thru;for(n&&r.reverse();s--;){var a=r[s];if("function"!=typeof a)throw new kt(e);if(o&&!u&&"wrapper"==ns(a))var u=new $n([],!0)}for(s=u?s:i;++s<i;){var c=ns(a=r[s]),l="wrapper"==c?es(a):t;u=l&&gs(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ns(l[0])].apply(u,l[3]):1==a.length&&gs(a)?u[c]():u.thru(a)}return function(){var t=arguments,e=t[0];if(u&&1==t.length&&Go(e))return u.plant(e).value();for(var n=0,s=i?r[n].apply(this,t):e;++n<i;)s=r[n].call(this,s);return s}}))}function ji(e,n,r,i,o,a,u,c,l,h){var f=n&s,d=1&n,p=2&n,y=24&n,m=512&n,g=p?t:Ai(e);return function s(){for(var b=arguments.length,v=vt(b),w=b;w--;)v[w]=arguments[w];if(y)var x=rs(s),S=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(v,x);if(i&&(v=Ei(v,i,o,y)),a&&(v=Oi(v,a,u,y)),b-=S,y&&b<h){var E=rn(v,x);return Bi(e,n,ji,s.placeholder,r,v,E,c,l,h-b)}var O=d?r:this,C=p?O[e]:e;return b=v.length,c?v=function(e,n){for(var r=e.length,i=mn(n.length,r),s=Ci(e);i--;){var o=n[i];e[i]=ps(o,r)?s[o]:t}return e}(v,c):m&&b>1&&v.reverse(),f&&l<b&&(v.length=l),this&&this!==ue&&this instanceof s&&(C=g||Ai(C)),C.apply(O,v)}}function Ri(t,e){return function(n,r){return function(t,e,n,r){return gr(t,(function(t,i,s){e(r,n(t),i,s)})),r}(n,t,e(r),{})}}function Pi(e,n){return function(r,i){var s;if(r===t&&i===t)return n;if(r!==t&&(s=r),i!==t){if(s===t)return i;"string"==typeof r||"string"==typeof i?(r=si(r),i=si(i)):(r=ii(r),i=ii(i)),s=e(r,i)}return s}}function zi(t){return Xi((function(e){return e=Te(e,Ve(is())),Vr((function(n){var r=this;return t(e,(function(t){return we(t,r,n)}))}))}))}function $i(e,n){var r=(n=n===t?" ":si(n)).length;if(r<2)return r?qr(n,e):n;var i=qr(n,fe(e/cn(n)));return tn(n)?gi(ln(i),0,e).join(""):i.slice(0,e)}function Ui(e){return function(n,r,i){return i&&"number"!=typeof i&&ys(n,r,i)&&(r=i=t),n=ha(n),r===t?(r=n,n=0):r=ha(r),function(t,e,n,r){for(var i=-1,s=yn(fe((e-t)/(n||1)),0),o=vt(s);s--;)o[r?s:++i]=t,t+=n;return o}(n,r,i=i===t?n<r?1:-1:ha(i),e)}}function Gi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=pa(e),n=pa(n)),t(e,n)}}function Bi(e,n,r,s,o,a,u,c,l,h){var f=8&n;n|=f?i:64,4&(n&=~(f?64:i))||(n&=-4);var d=[e,n,o,f?a:t,f?u:t,f?t:a,f?t:u,c,l,h],p=r.apply(t,d);return gs(e)&&Cs(p,d),p.placeholder=s,Ts(p,e,n)}function Wi(t){var e=Et[t];return function(t,n){if(t=pa(t),(n=null==n?0:mn(fa(n),292))&&on(t)){var r=(ma(t)+"e").split("e");return+((r=(ma(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var qi=On&&1/sn(new On([,-0]))[1]==o?function(t){return new On(t)}:ou;function Vi(t){return function(e){var n=ls(e);return n==v?en(e):n==O?un(e):function(t,e){return Te(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Yi(n,o,a,u,c,l,h,f){var d=2&o;if(!d&&"function"!=typeof n)throw new kt(e);var p=u?u.length:0;if(p||(o&=-97,u=c=t),h=h===t?h:yn(fa(h),0),f=f===t?f:fa(f),p-=c?c.length:0,64&o){var y=u,m=c;u=c=t}var g=d?t:es(n),b=[n,o,a,u,c,y,m,l,h,f];if(g&&function(t,e){var n=t[1],i=e[1],o=n|i;if(!(o<131||(i==s&&8==n||i==s&&256==n&&t[7].length<=e[8]||384==i&&e[7].length<=e[8]&&8==n)))return t;1&i&&(t[2]=e[2],o|=1&n?0:4);var a=e[3];if(a){var u=t[3];t[3]=u?Ei(u,a,e[4]):a,t[4]=u?rn(t[3],r):e[4]}(a=e[5])&&(t[5]=(u=t[5])?Oi(u,a,e[6]):a,t[6]=u?rn(t[5],r):e[6]),(a=e[7])&&(t[7]=a),i&s&&(t[8]=null==t[8]?e[8]:mn(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=o}(b,g),n=b[0],o=b[1],a=b[2],u=b[3],c=b[4],!(f=b[9]=b[9]===t?d?0:n.length:yn(b[9]-p,0))&&24&o&&(o&=-25),o&&1!=o)v=8==o||16==o?function(e,n,r){var i=Ai(e);return function s(){for(var o=arguments.length,a=vt(o),u=o,c=rs(s);u--;)a[u]=arguments[u];var l=o<3&&a[0]!==c&&a[o-1]!==c?[]:rn(a,c);return(o-=l.length)<r?Bi(e,n,ji,s.placeholder,t,a,l,t,t,r-o):we(this&&this!==ue&&this instanceof s?i:e,this,a)}}(n,o,f):o!=i&&33!=o||c.length?ji.apply(t,b):function(t,e,n,r){var i=1&e,s=Ai(t);return function e(){for(var o=-1,a=arguments.length,u=-1,c=r.length,l=vt(c+a),h=this&&this!==ue&&this instanceof e?s:t;++u<c;)l[u]=r[u];for(;a--;)l[u++]=arguments[++o];return we(h,i?n:this,l)}}(n,o,a,u);else var v=function(t,e,n){var r=1&e,i=Ai(t);return function e(){return(this&&this!==ue&&this instanceof e?i:t).apply(r?n:this,arguments)}}(n,o,a);return Ts((g?Hr:Cs)(v,b),n,o)}function Zi(e,n,r,i){return e===t||Po(e,Mt[r])&&!Nt.call(i,r)?n:e}function Ji(e,n,r,i,s,o){return Xo(e)&&Xo(n)&&(o.set(n,e),Pr(e,n,t,Ji,o),o.delete(n)),e}function Hi(e){return na(e)?t:e}function Ki(e,n,r,i,s,o){var a=1&r,u=e.length,c=n.length;if(u!=c&&!(a&&c>u))return!1;var l=o.get(e),h=o.get(n);if(l&&h)return l==n&&h==e;var f=-1,d=!0,p=2&r?new qn:t;for(o.set(e,n),o.set(n,e);++f<u;){var y=e[f],m=n[f];if(i)var g=a?i(m,y,f,n,e,o):i(y,m,f,e,n,o);if(g!==t){if(g)continue;d=!1;break}if(p){if(!Ne(n,(function(t,e){if(!Ze(p,e)&&(y===t||s(y,t,r,i,o)))return p.push(e)}))){d=!1;break}}else if(y!==m&&!s(y,m,r,i,o)){d=!1;break}}return o.delete(e),o.delete(n),d}function Xi(e){return ks(Ss(e,t,Gs),e+"")}function Qi(t){return xr(t,Ma,us)}function ts(t){return xr(t,Ia,cs)}var es=kn?function(t){return kn.get(t)}:ou;function ns(t){for(var e=t.name+"",n=Tn[e],r=Nt.call(Tn,e)?n.length:0;r--;){var i=n[r],s=i.func;if(null==s||s==t)return i.name}return e}function rs(t){return(Nt.call(Rn,"placeholder")?Rn:t).placeholder}function is(){var t=Rn.iteratee||nu;return t=t===nu?Nr:t,arguments.length?t(arguments[0],arguments[1]):t}function ss(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function os(t){for(var e=Ma(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,ws(i)]}return e}function as(e,n){var r=function(e,n){return null==e?t:e[n]}(e,n);return _r(r)?r:t}var us=Ae?function(t){return null==t?[]:(t=Ot(t),Ce(Ae(t),(function(e){return qt.call(t,e)})))}:du,cs=Ae?function(t){for(var e=[];t;)Me(e,us(t)),t=Bt(t);return e}:du,ls=Sr;function hs(t,e,n){for(var r=-1,i=(e=yi(e,t)).length,s=!1;++r<i;){var o=Ds(e[r]);if(!(s=null!=t&&n(t,o)))break;t=t[o]}return s||++r!=i?s:!!(i=null==t?0:t.length)&&Ko(i)&&ps(o,i)&&(Go(t)||Uo(t))}function fs(t){return"function"!=typeof t.constructor||vs(t)?{}:Pn(Bt(t))}function ds(t){return Go(t)||Uo(t)||!!(Jt&&t&&t[Jt])}function ps(t,e){var n=typeof t;return!!(e=null==e?a:e)&&("number"==n||"symbol"!=n&&pt.test(t))&&t>-1&&t%1==0&&t<e}function ys(t,e,n){if(!Xo(n))return!1;var r=typeof e;return!!("number"==r?Wo(n)&&ps(e,n.length):"string"==r&&e in n)&&Po(n[e],t)}function ms(t,e){if(Go(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!oa(t))||H.test(t)||!J.test(t)||null!=e&&t in Ot(e)}function gs(t){var e=ns(t),n=Rn[e];if("function"!=typeof n||!(e in Un.prototype))return!1;if(t===n)return!0;var r=es(n);return!!r&&t===r[0]}(xn&&ls(new xn(new ArrayBuffer(1)))!=M||Sn&&ls(new Sn)!=v||En&&ls(En.resolve())!=S||On&&ls(new On)!=O||Cn&&ls(new Cn)!=k)&&(ls=function(e){var n=Sr(e),r=n==x?e.constructor:t,i=r?Ls(r):"";if(i)switch(i){case Mn:return M;case In:return v;case _n:return S;case Nn:return O;case An:return k}return n});var bs=It?Jo:pu;function vs(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Mt)}function ws(t){return t==t&&!Xo(t)}function xs(e,n){return function(r){return null!=r&&r[e]===n&&(n!==t||e in Ot(r))}}function Ss(e,n,r){return n=yn(n===t?e.length-1:n,0),function(){for(var t=arguments,i=-1,s=yn(t.length-n,0),o=vt(s);++i<s;)o[i]=t[n+i];i=-1;for(var a=vt(n+1);++i<n;)a[i]=t[i];return a[n]=r(o),we(e,this,a)}}function Es(t,e){return e.length<2?t:wr(t,Qr(e,0,-1))}function Os(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Cs=Ms(Hr),Fs=le||function(t,e){return ue.setTimeout(t,e)},ks=Ms(Kr);function Ts(t,e,n){var r=e+"";return ks(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(nt,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Se(h,(function(n){var r="_."+n[0];e&n[1]&&!Fe(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(rt);return e?e[1].split(it):[]}(r),n)))}function Ms(e){var n=0,r=0;return function(){var i=gn(),s=16-(i-r);if(r=i,s>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(t,arguments)}}function Is(e,n){var r=-1,i=e.length,s=i-1;for(n=n===t?i:n;++r<n;){var o=Wr(r,s),a=e[o];e[o]=e[r],e[r]=a}return e.length=n,e}var _s,Ns,As=(_s=No((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(K,(function(t,n,r,i){e.push(r?i.replace(at,"$1"):n||t)})),e}),(function(t){return 500===Ns.size&&Ns.clear(),t})),Ns=_s.cache,_s);function Ds(t){if("string"==typeof t||oa(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Ls(t){if(null!=t){try{return _t.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function js(t){if(t instanceof Un)return t.clone();var e=new $n(t.__wrapped__,t.__chain__);return e.__actions__=Ci(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Rs=Vr((function(t,e){return qo(t)?ur(t,pr(e,1,qo,!0)):[]})),Ps=Vr((function(e,n){var r=Ys(n);return qo(r)&&(r=t),qo(e)?ur(e,pr(n,1,qo,!0),is(r,2)):[]})),zs=Vr((function(e,n){var r=Ys(n);return qo(r)&&(r=t),qo(e)?ur(e,pr(n,1,qo,!0),t,r):[]}));function $s(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:fa(n);return i<0&&(i=yn(r+i,0)),Le(t,is(e,3),i)}function Us(e,n,r){var i=null==e?0:e.length;if(!i)return-1;var s=i-1;return r!==t&&(s=fa(r),s=r<0?yn(i+s,0):mn(s,i-1)),Le(e,is(n,3),s,!0)}function Gs(t){return null!=t&&t.length?pr(t,1):[]}function Bs(e){return e&&e.length?e[0]:t}var Ws=Vr((function(t){var e=Te(t,di);return e.length&&e[0]===t[0]?Fr(e):[]})),qs=Vr((function(e){var n=Ys(e),r=Te(e,di);return n===Ys(r)?n=t:r.pop(),r.length&&r[0]===e[0]?Fr(r,is(n,2)):[]})),Vs=Vr((function(e){var n=Ys(e),r=Te(e,di);return(n="function"==typeof n?n:t)&&r.pop(),r.length&&r[0]===e[0]?Fr(r,t,n):[]}));function Ys(e){var n=null==e?0:e.length;return n?e[n-1]:t}var Zs=Vr(Js);function Js(t,e){return t&&t.length&&e&&e.length?Gr(t,e):t}var Hs=Xi((function(t,e){var n=null==t?0:t.length,r=rr(t,e);return Br(t,Te(e,(function(t){return ps(t,n)?+t:t})).sort(Si)),r}));function Ks(t){return null==t?t:wn.call(t)}var Xs=Vr((function(t){return oi(pr(t,1,qo,!0))})),Qs=Vr((function(e){var n=Ys(e);return qo(n)&&(n=t),oi(pr(e,1,qo,!0),is(n,2))})),to=Vr((function(e){var n=Ys(e);return n="function"==typeof n?n:t,oi(pr(e,1,qo,!0),t,n)}));function eo(t){if(!t||!t.length)return[];var e=0;return t=Ce(t,(function(t){if(qo(t))return e=yn(t.length,e),!0})),We(e,(function(e){return Te(t,$e(e))}))}function no(e,n){if(!e||!e.length)return[];var r=eo(e);return null==n?r:Te(r,(function(e){return we(n,t,e)}))}var ro=Vr((function(t,e){return qo(t)?ur(t,e):[]})),io=Vr((function(t){return hi(Ce(t,qo))})),so=Vr((function(e){var n=Ys(e);return qo(n)&&(n=t),hi(Ce(e,qo),is(n,2))})),oo=Vr((function(e){var n=Ys(e);return n="function"==typeof n?n:t,hi(Ce(e,qo),t,n)})),ao=Vr(eo),uo=Vr((function(e){var n=e.length,r=n>1?e[n-1]:t;return r="function"==typeof r?(e.pop(),r):t,no(e,r)}));function co(t){var e=Rn(t);return e.__chain__=!0,e}function lo(t,e){return e(t)}var ho=Xi((function(e){var n=e.length,r=n?e[0]:0,i=this.__wrapped__,s=function(t){return rr(t,e)};return!(n>1||this.__actions__.length)&&i instanceof Un&&ps(r)?((i=i.slice(r,+r+(n?1:0))).__actions__.push({func:lo,args:[s],thisArg:t}),new $n(i,this.__chain__).thru((function(e){return n&&!e.length&&e.push(t),e}))):this.thru(s)})),fo=ki((function(t,e,n){Nt.call(t,n)?++t[n]:nr(t,n,1)})),po=Di($s),yo=Di(Us);function mo(t,e){return(Go(t)?Se:cr)(t,is(e,3))}function go(t,e){return(Go(t)?Ee:lr)(t,is(e,3))}var bo=ki((function(t,e,n){Nt.call(t,n)?t[n].push(e):nr(t,n,[e])})),vo=Vr((function(t,e,n){var r=-1,i="function"==typeof e,s=Wo(t)?vt(t.length):[];return cr(t,(function(t){s[++r]=i?we(e,t,n):kr(t,e,n)})),s})),wo=ki((function(t,e,n){nr(t,n,e)}));function xo(t,e){return(Go(t)?Te:Lr)(t,is(e,3))}var So=ki((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]})),Eo=Vr((function(t,e){if(null==t)return[];var n=e.length;return n>1&&ys(t,e[0],e[1])?e=[]:n>2&&ys(e[0],e[1],e[2])&&(e=[e[0]]),$r(t,pr(e,1),[])})),Oo=ce||function(){return ue.Date.now()};function Co(e,n,r){return n=r?t:n,Yi(e,s,t,t,t,t,n=e&&null==n?e.length:n)}function Fo(n,r){var i;if("function"!=typeof r)throw new kt(e);return n=fa(n),function(){return--n>0&&(i=r.apply(this,arguments)),n<=1&&(r=t),i}}var ko=Vr((function(t,e,n){var r=1;if(n.length){var s=rn(n,rs(ko));r|=i}return Yi(t,r,e,n,s)})),To=Vr((function(t,e,n){var r=3;if(n.length){var s=rn(n,rs(To));r|=i}return Yi(e,r,t,n,s)}));function Mo(n,r,i){var s,o,a,u,c,l,h=0,f=!1,d=!1,p=!0;if("function"!=typeof n)throw new kt(e);function y(e){var r=s,i=o;return s=o=t,h=e,u=n.apply(i,r)}function m(e){var n=e-l;return l===t||n>=r||n<0||d&&e-h>=a}function g(){var t=Oo();if(m(t))return b(t);c=Fs(g,function(t){var e=r-(t-l);return d?mn(e,a-(t-h)):e}(t))}function b(e){return c=t,p&&s?y(e):(s=o=t,u)}function v(){var e=Oo(),n=m(e);if(s=arguments,o=this,l=e,n){if(c===t)return function(t){return h=t,c=Fs(g,r),f?y(t):u}(l);if(d)return bi(c),c=Fs(g,r),y(l)}return c===t&&(c=Fs(g,r)),u}return r=pa(r)||0,Xo(i)&&(f=!!i.leading,a=(d="maxWait"in i)?yn(pa(i.maxWait)||0,r):a,p="trailing"in i?!!i.trailing:p),v.cancel=function(){c!==t&&bi(c),h=0,s=l=o=c=t},v.flush=function(){return c===t?u:b(Oo())},v}var Io=Vr((function(t,e){return ar(t,1,e)})),_o=Vr((function(t,e,n){return ar(t,pa(e)||0,n)}));function No(t,n){if("function"!=typeof t||null!=n&&"function"!=typeof n)throw new kt(e);var r=function(){var e=arguments,i=n?n.apply(this,e):e[0],s=r.cache;if(s.has(i))return s.get(i);var o=t.apply(this,e);return r.cache=s.set(i,o)||s,o};return r.cache=new(No.Cache||Wn),r}function Ao(t){if("function"!=typeof t)throw new kt(e);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}No.Cache=Wn;var Do=mi((function(t,e){var n=(e=1==e.length&&Go(e[0])?Te(e[0],Ve(is())):Te(pr(e,1),Ve(is()))).length;return Vr((function(r){for(var i=-1,s=mn(r.length,n);++i<s;)r[i]=e[i].call(this,r[i]);return we(t,this,r)}))})),Lo=Vr((function(e,n){var r=rn(n,rs(Lo));return Yi(e,i,t,n,r)})),jo=Vr((function(e,n){var r=rn(n,rs(jo));return Yi(e,64,t,n,r)})),Ro=Xi((function(e,n){return Yi(e,256,t,t,t,n)}));function Po(t,e){return t===e||t!=t&&e!=e}var zo=Gi(Er),$o=Gi((function(t,e){return t>=e})),Uo=Tr(function(){return arguments}())?Tr:function(t){return Qo(t)&&Nt.call(t,"callee")&&!qt.call(t,"callee")},Go=vt.isArray,Bo=pe?Ve(pe):function(t){return Qo(t)&&Sr(t)==T};function Wo(t){return null!=t&&Ko(t.length)&&!Jo(t)}function qo(t){return Qo(t)&&Wo(t)}var Vo=Ue||pu,Yo=ye?Ve(ye):function(t){return Qo(t)&&Sr(t)==y};function Zo(t){if(!Qo(t))return!1;var e=Sr(t);return e==m||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!na(t)}function Jo(t){if(!Xo(t))return!1;var e=Sr(t);return e==g||e==b||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ho(t){return"number"==typeof t&&t==fa(t)}function Ko(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=a}function Xo(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Qo(t){return null!=t&&"object"==typeof t}var ta=me?Ve(me):function(t){return Qo(t)&&ls(t)==v};function ea(t){return"number"==typeof t||Qo(t)&&Sr(t)==w}function na(t){if(!Qo(t)||Sr(t)!=x)return!1;var e=Bt(t);if(null===e)return!0;var n=Nt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&_t.call(n)==jt}var ra=ge?Ve(ge):function(t){return Qo(t)&&Sr(t)==E},ia=be?Ve(be):function(t){return Qo(t)&&ls(t)==O};function sa(t){return"string"==typeof t||!Go(t)&&Qo(t)&&Sr(t)==C}function oa(t){return"symbol"==typeof t||Qo(t)&&Sr(t)==F}var aa=ve?Ve(ve):function(t){return Qo(t)&&Ko(t.length)&&!!ee[Sr(t)]},ua=Gi(Dr),ca=Gi((function(t,e){return t<=e}));function la(t){if(!t)return[];if(Wo(t))return sa(t)?ln(t):Ci(t);if(Kt&&t[Kt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Kt]());var e=ls(t);return(e==v?en:e==O?sn:Pa)(t)}function ha(t){return t?(t=pa(t))===o||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function fa(t){var e=ha(t),n=e%1;return e==e?n?e-n:e:0}function da(t){return t?ir(fa(t),0,l):0}function pa(t){if("number"==typeof t)return t;if(oa(t))return c;if(Xo(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Xo(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=qe(t);var n=ht.test(t);return n||dt.test(t)?se(t.slice(2),n?2:8):lt.test(t)?c:+t}function ya(t){return Fi(t,Ia(t))}function ma(t){return null==t?"":si(t)}var ga=Ti((function(t,e){if(vs(e)||Wo(e))Fi(e,Ma(e),t);else for(var n in e)Nt.call(e,n)&&Xn(t,n,e[n])})),ba=Ti((function(t,e){Fi(e,Ia(e),t)})),va=Ti((function(t,e,n,r){Fi(e,Ia(e),t,r)})),wa=Ti((function(t,e,n,r){Fi(e,Ma(e),t,r)})),xa=Xi(rr),Sa=Vr((function(e,n){e=Ot(e);var r=-1,i=n.length,s=i>2?n[2]:t;for(s&&ys(n[0],n[1],s)&&(i=1);++r<i;)for(var o=n[r],a=Ia(o),u=-1,c=a.length;++u<c;){var l=a[u],h=e[l];(h===t||Po(h,Mt[l])&&!Nt.call(e,l))&&(e[l]=o[l])}return e})),Ea=Vr((function(e){return e.push(t,Ji),we(Na,t,e)}));function Oa(e,n,r){var i=null==e?t:wr(e,n);return i===t?r:i}function Ca(t,e){return null!=t&&hs(t,e,Cr)}var Fa=Ri((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Lt.call(e)),t[e]=n}),Xa(eu)),ka=Ri((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Lt.call(e)),Nt.call(t,e)?t[e].push(n):t[e]=[n]}),is),Ta=Vr(kr);function Ma(t){return Wo(t)?Yn(t):Ar(t)}function Ia(t){return Wo(t)?Yn(t,!0):function(t){if(!Xo(t))return function(t){var e=[];if(null!=t)for(var n in Ot(t))e.push(n);return e}(t);var e=vs(t),n=[];for(var r in t)("constructor"!=r||!e&&Nt.call(t,r))&&n.push(r);return n}(t)}var _a=Ti((function(t,e,n){Pr(t,e,n)})),Na=Ti((function(t,e,n,r){Pr(t,e,n,r)})),Aa=Xi((function(t,e){var n={};if(null==t)return n;var r=!1;e=Te(e,(function(e){return e=yi(e,t),r||(r=e.length>1),e})),Fi(t,ts(t),n),r&&(n=sr(n,7,Hi));for(var i=e.length;i--;)ai(n,e[i]);return n})),Da=Xi((function(t,e){return null==t?{}:function(t,e){return Ur(t,e,(function(e,n){return Ca(t,n)}))}(t,e)}));function La(t,e){if(null==t)return{};var n=Te(ts(t),(function(t){return[t]}));return e=is(e),Ur(t,n,(function(t,n){return e(t,n[0])}))}var ja=Vi(Ma),Ra=Vi(Ia);function Pa(t){return null==t?[]:Ye(t,Ma(t))}var za=Ni((function(t,e,n){return e=e.toLowerCase(),t+(n?$a(e):e)}));function $a(t){return Za(ma(t).toLowerCase())}function Ua(t){return(t=ma(t))&&t.replace(yt,Ke).replace(Zt,"")}var Ga=Ni((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),Ba=Ni((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Wa=_i("toLowerCase"),qa=Ni((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()})),Va=Ni((function(t,e,n){return t+(n?" ":"")+Za(e)})),Ya=Ni((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Za=_i("toUpperCase");function Ja(e,n,r){return e=ma(e),(n=r?t:n)===t?function(t){return Xt.test(t)}(e)?function(t){return t.match(Ht)||[]}(e):function(t){return t.match(st)||[]}(e):e.match(n)||[]}var Ha=Vr((function(e,n){try{return we(e,t,n)}catch(t){return Zo(t)?t:new xt(t)}})),Ka=Xi((function(t,e){return Se(e,(function(e){e=Ds(e),nr(t,e,ko(t[e],t))})),t}));function Xa(t){return function(){return t}}var Qa=Li(),tu=Li(!0);function eu(t){return t}function nu(t){return Nr("function"==typeof t?t:sr(t,1))}var ru=Vr((function(t,e){return function(n){return kr(n,t,e)}})),iu=Vr((function(t,e){return function(n){return kr(t,n,e)}}));function su(t,e,n){var r=Ma(e),i=vr(e,r);null!=n||Xo(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=vr(e,Ma(e)));var s=!(Xo(n)&&"chain"in n&&!n.chain),o=Jo(t);return Se(i,(function(n){var r=e[n];t[n]=r,o&&(t.prototype[n]=function(){var e=this.__chain__;if(s||e){var n=t(this.__wrapped__);return(n.__actions__=Ci(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,Me([this.value()],arguments))})})),t}function ou(){}var au=zi(Te),uu=zi(Oe),cu=zi(Ne);function lu(t){return ms(t)?$e(Ds(t)):function(t){return function(e){return wr(e,t)}}(t)}var hu=Ui(),fu=Ui(!0);function du(){return[]}function pu(){return!1}var yu,mu=Pi((function(t,e){return t+e}),0),gu=Wi("ceil"),bu=Pi((function(t,e){return t/e}),1),vu=Wi("floor"),wu=Pi((function(t,e){return t*e}),1),xu=Wi("round"),Su=Pi((function(t,e){return t-e}),0);return Rn.after=function(t,n){if("function"!=typeof n)throw new kt(e);return t=fa(t),function(){if(--t<1)return n.apply(this,arguments)}},Rn.ary=Co,Rn.assign=ga,Rn.assignIn=ba,Rn.assignInWith=va,Rn.assignWith=wa,Rn.at=xa,Rn.before=Fo,Rn.bind=ko,Rn.bindAll=Ka,Rn.bindKey=To,Rn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Go(t)?t:[t]},Rn.chain=co,Rn.chunk=function(e,n,r){n=(r?ys(e,n,r):n===t)?1:yn(fa(n),0);var i=null==e?0:e.length;if(!i||n<1)return[];for(var s=0,o=0,a=vt(fe(i/n));s<i;)a[o++]=Qr(e,s,s+=n);return a},Rn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var s=t[e];s&&(i[r++]=s)}return i},Rn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=vt(t-1),n=arguments[0],r=t;r--;)e[r-1]=arguments[r];return Me(Go(n)?Ci(n):[n],pr(e,1))},Rn.cond=function(t){var n=null==t?0:t.length,r=is();return t=n?Te(t,(function(t){if("function"!=typeof t[1])throw new kt(e);return[r(t[0]),t[1]]})):[],Vr((function(e){for(var r=-1;++r<n;){var i=t[r];if(we(i[0],this,e))return we(i[1],this,e)}}))},Rn.conforms=function(t){return function(t){var e=Ma(t);return function(n){return or(n,t,e)}}(sr(t,1))},Rn.constant=Xa,Rn.countBy=fo,Rn.create=function(t,e){var n=Pn(t);return null==e?n:er(n,e)},Rn.curry=function e(n,r,i){var s=Yi(n,8,t,t,t,t,t,r=i?t:r);return s.placeholder=e.placeholder,s},Rn.curryRight=function e(n,r,i){var s=Yi(n,16,t,t,t,t,t,r=i?t:r);return s.placeholder=e.placeholder,s},Rn.debounce=Mo,Rn.defaults=Sa,Rn.defaultsDeep=Ea,Rn.defer=Io,Rn.delay=_o,Rn.difference=Rs,Rn.differenceBy=Ps,Rn.differenceWith=zs,Rn.drop=function(e,n,r){var i=null==e?0:e.length;return i?Qr(e,(n=r||n===t?1:fa(n))<0?0:n,i):[]},Rn.dropRight=function(e,n,r){var i=null==e?0:e.length;return i?Qr(e,0,(n=i-(n=r||n===t?1:fa(n)))<0?0:n):[]},Rn.dropRightWhile=function(t,e){return t&&t.length?ci(t,is(e,3),!0,!0):[]},Rn.dropWhile=function(t,e){return t&&t.length?ci(t,is(e,3),!0):[]},Rn.fill=function(e,n,r,i){var s=null==e?0:e.length;return s?(r&&"number"!=typeof r&&ys(e,n,r)&&(r=0,i=s),function(e,n,r,i){var s=e.length;for((r=fa(r))<0&&(r=-r>s?0:s+r),(i=i===t||i>s?s:fa(i))<0&&(i+=s),i=r>i?0:da(i);r<i;)e[r++]=n;return e}(e,n,r,i)):[]},Rn.filter=function(t,e){return(Go(t)?Ce:dr)(t,is(e,3))},Rn.flatMap=function(t,e){return pr(xo(t,e),1)},Rn.flatMapDeep=function(t,e){return pr(xo(t,e),o)},Rn.flatMapDepth=function(e,n,r){return r=r===t?1:fa(r),pr(xo(e,n),r)},Rn.flatten=Gs,Rn.flattenDeep=function(t){return null!=t&&t.length?pr(t,o):[]},Rn.flattenDepth=function(e,n){return null!=e&&e.length?pr(e,n=n===t?1:fa(n)):[]},Rn.flip=function(t){return Yi(t,512)},Rn.flow=Qa,Rn.flowRight=tu,Rn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},Rn.functions=function(t){return null==t?[]:vr(t,Ma(t))},Rn.functionsIn=function(t){return null==t?[]:vr(t,Ia(t))},Rn.groupBy=bo,Rn.initial=function(t){return null!=t&&t.length?Qr(t,0,-1):[]},Rn.intersection=Ws,Rn.intersectionBy=qs,Rn.intersectionWith=Vs,Rn.invert=Fa,Rn.invertBy=ka,Rn.invokeMap=vo,Rn.iteratee=nu,Rn.keyBy=wo,Rn.keys=Ma,Rn.keysIn=Ia,Rn.map=xo,Rn.mapKeys=function(t,e){var n={};return e=is(e,3),gr(t,(function(t,r,i){nr(n,e(t,r,i),t)})),n},Rn.mapValues=function(t,e){var n={};return e=is(e,3),gr(t,(function(t,r,i){nr(n,r,e(t,r,i))})),n},Rn.matches=function(t){return jr(sr(t,1))},Rn.matchesProperty=function(t,e){return Rr(t,sr(e,1))},Rn.memoize=No,Rn.merge=_a,Rn.mergeWith=Na,Rn.method=ru,Rn.methodOf=iu,Rn.mixin=su,Rn.negate=Ao,Rn.nthArg=function(t){return t=fa(t),Vr((function(e){return zr(e,t)}))},Rn.omit=Aa,Rn.omitBy=function(t,e){return La(t,Ao(is(e)))},Rn.once=function(t){return Fo(2,t)},Rn.orderBy=function(e,n,r,i){return null==e?[]:(Go(n)||(n=null==n?[]:[n]),Go(r=i?t:r)||(r=null==r?[]:[r]),$r(e,n,r))},Rn.over=au,Rn.overArgs=Do,Rn.overEvery=uu,Rn.overSome=cu,Rn.partial=Lo,Rn.partialRight=jo,Rn.partition=So,Rn.pick=Da,Rn.pickBy=La,Rn.property=lu,Rn.propertyOf=function(e){return function(n){return null==e?t:wr(e,n)}},Rn.pull=Zs,Rn.pullAll=Js,Rn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Gr(t,e,is(n,2)):t},Rn.pullAllWith=function(e,n,r){return e&&e.length&&n&&n.length?Gr(e,n,t,r):e},Rn.pullAt=Hs,Rn.range=hu,Rn.rangeRight=fu,Rn.rearg=Ro,Rn.reject=function(t,e){return(Go(t)?Ce:dr)(t,Ao(is(e,3)))},Rn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],s=t.length;for(e=is(e,3);++r<s;){var o=t[r];e(o,r,t)&&(n.push(o),i.push(r))}return Br(t,i),n},Rn.rest=function(n,r){if("function"!=typeof n)throw new kt(e);return Vr(n,r=r===t?r:fa(r))},Rn.reverse=Ks,Rn.sampleSize=function(e,n,r){return n=(r?ys(e,n,r):n===t)?1:fa(n),(Go(e)?Jn:Zr)(e,n)},Rn.set=function(t,e,n){return null==t?t:Jr(t,e,n)},Rn.setWith=function(e,n,r,i){return i="function"==typeof i?i:t,null==e?e:Jr(e,n,r,i)},Rn.shuffle=function(t){return(Go(t)?Hn:Xr)(t)},Rn.slice=function(e,n,r){var i=null==e?0:e.length;return i?(r&&"number"!=typeof r&&ys(e,n,r)?(n=0,r=i):(n=null==n?0:fa(n),r=r===t?i:fa(r)),Qr(e,n,r)):[]},Rn.sortBy=Eo,Rn.sortedUniq=function(t){return t&&t.length?ri(t):[]},Rn.sortedUniqBy=function(t,e){return t&&t.length?ri(t,is(e,2)):[]},Rn.split=function(e,n,r){return r&&"number"!=typeof r&&ys(e,n,r)&&(n=r=t),(r=r===t?l:r>>>0)?(e=ma(e))&&("string"==typeof n||null!=n&&!ra(n))&&!(n=si(n))&&tn(e)?gi(ln(e),0,r):e.split(n,r):[]},Rn.spread=function(t,n){if("function"!=typeof t)throw new kt(e);return n=null==n?0:yn(fa(n),0),Vr((function(e){var r=e[n],i=gi(e,0,n);return r&&Me(i,r),we(t,this,i)}))},Rn.tail=function(t){var e=null==t?0:t.length;return e?Qr(t,1,e):[]},Rn.take=function(e,n,r){return e&&e.length?Qr(e,0,(n=r||n===t?1:fa(n))<0?0:n):[]},Rn.takeRight=function(e,n,r){var i=null==e?0:e.length;return i?Qr(e,(n=i-(n=r||n===t?1:fa(n)))<0?0:n,i):[]},Rn.takeRightWhile=function(t,e){return t&&t.length?ci(t,is(e,3),!1,!0):[]},Rn.takeWhile=function(t,e){return t&&t.length?ci(t,is(e,3)):[]},Rn.tap=function(t,e){return e(t),t},Rn.throttle=function(t,n,r){var i=!0,s=!0;if("function"!=typeof t)throw new kt(e);return Xo(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),Mo(t,n,{leading:i,maxWait:n,trailing:s})},Rn.thru=lo,Rn.toArray=la,Rn.toPairs=ja,Rn.toPairsIn=Ra,Rn.toPath=function(t){return Go(t)?Te(t,Ds):oa(t)?[t]:Ci(As(ma(t)))},Rn.toPlainObject=ya,Rn.transform=function(t,e,n){var r=Go(t),i=r||Vo(t)||aa(t);if(e=is(e,4),null==n){var s=t&&t.constructor;n=i?r?new s:[]:Xo(t)&&Jo(s)?Pn(Bt(t)):{}}return(i?Se:gr)(t,(function(t,r,i){return e(n,t,r,i)})),n},Rn.unary=function(t){return Co(t,1)},Rn.union=Xs,Rn.unionBy=Qs,Rn.unionWith=to,Rn.uniq=function(t){return t&&t.length?oi(t):[]},Rn.uniqBy=function(t,e){return t&&t.length?oi(t,is(e,2)):[]},Rn.uniqWith=function(e,n){return n="function"==typeof n?n:t,e&&e.length?oi(e,t,n):[]},Rn.unset=function(t,e){return null==t||ai(t,e)},Rn.unzip=eo,Rn.unzipWith=no,Rn.update=function(t,e,n){return null==t?t:ui(t,e,pi(n))},Rn.updateWith=function(e,n,r,i){return i="function"==typeof i?i:t,null==e?e:ui(e,n,pi(r),i)},Rn.values=Pa,Rn.valuesIn=function(t){return null==t?[]:Ye(t,Ia(t))},Rn.without=ro,Rn.words=Ja,Rn.wrap=function(t,e){return Lo(pi(e),t)},Rn.xor=io,Rn.xorBy=so,Rn.xorWith=oo,Rn.zip=ao,Rn.zipObject=function(t,e){return fi(t||[],e||[],Xn)},Rn.zipObjectDeep=function(t,e){return fi(t||[],e||[],Jr)},Rn.zipWith=uo,Rn.entries=ja,Rn.entriesIn=Ra,Rn.extend=ba,Rn.extendWith=va,su(Rn,Rn),Rn.add=mu,Rn.attempt=Ha,Rn.camelCase=za,Rn.capitalize=$a,Rn.ceil=gu,Rn.clamp=function(e,n,r){return r===t&&(r=n,n=t),r!==t&&(r=(r=pa(r))==r?r:0),n!==t&&(n=(n=pa(n))==n?n:0),ir(pa(e),n,r)},Rn.clone=function(t){return sr(t,4)},Rn.cloneDeep=function(t){return sr(t,5)},Rn.cloneDeepWith=function(e,n){return sr(e,5,n="function"==typeof n?n:t)},Rn.cloneWith=function(e,n){return sr(e,4,n="function"==typeof n?n:t)},Rn.conformsTo=function(t,e){return null==e||or(t,e,Ma(e))},Rn.deburr=Ua,Rn.defaultTo=function(t,e){return null==t||t!=t?e:t},Rn.divide=bu,Rn.endsWith=function(e,n,r){e=ma(e),n=si(n);var i=e.length,s=r=r===t?i:ir(fa(r),0,i);return(r-=n.length)>=0&&e.slice(r,s)==n},Rn.eq=Po,Rn.escape=function(t){return(t=ma(t))&&q.test(t)?t.replace(B,Xe):t},Rn.escapeRegExp=function(t){return(t=ma(t))&&Q.test(t)?t.replace(X,"\\$&"):t},Rn.every=function(e,n,r){var i=Go(e)?Oe:hr;return r&&ys(e,n,r)&&(n=t),i(e,is(n,3))},Rn.find=po,Rn.findIndex=$s,Rn.findKey=function(t,e){return De(t,is(e,3),gr)},Rn.findLast=yo,Rn.findLastIndex=Us,Rn.findLastKey=function(t,e){return De(t,is(e,3),br)},Rn.floor=vu,Rn.forEach=mo,Rn.forEachRight=go,Rn.forIn=function(t,e){return null==t?t:yr(t,is(e,3),Ia)},Rn.forInRight=function(t,e){return null==t?t:mr(t,is(e,3),Ia)},Rn.forOwn=function(t,e){return t&&gr(t,is(e,3))},Rn.forOwnRight=function(t,e){return t&&br(t,is(e,3))},Rn.get=Oa,Rn.gt=zo,Rn.gte=$o,Rn.has=function(t,e){return null!=t&&hs(t,e,Or)},Rn.hasIn=Ca,Rn.head=Bs,Rn.identity=eu,Rn.includes=function(t,e,n,r){t=Wo(t)?t:Pa(t),n=n&&!r?fa(n):0;var i=t.length;return n<0&&(n=yn(i+n,0)),sa(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&je(t,e,n)>-1},Rn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:fa(n);return i<0&&(i=yn(r+i,0)),je(t,e,i)},Rn.inRange=function(e,n,r){return n=ha(n),r===t?(r=n,n=0):r=ha(r),function(t,e,n){return t>=mn(e,n)&&t<yn(e,n)}(e=pa(e),n,r)},Rn.invoke=Ta,Rn.isArguments=Uo,Rn.isArray=Go,Rn.isArrayBuffer=Bo,Rn.isArrayLike=Wo,Rn.isArrayLikeObject=qo,Rn.isBoolean=function(t){return!0===t||!1===t||Qo(t)&&Sr(t)==p},Rn.isBuffer=Vo,Rn.isDate=Yo,Rn.isElement=function(t){return Qo(t)&&1===t.nodeType&&!na(t)},Rn.isEmpty=function(t){if(null==t)return!0;if(Wo(t)&&(Go(t)||"string"==typeof t||"function"==typeof t.splice||Vo(t)||aa(t)||Uo(t)))return!t.length;var e=ls(t);if(e==v||e==O)return!t.size;if(vs(t))return!Ar(t).length;for(var n in t)if(Nt.call(t,n))return!1;return!0},Rn.isEqual=function(t,e){return Mr(t,e)},Rn.isEqualWith=function(e,n,r){var i=(r="function"==typeof r?r:t)?r(e,n):t;return i===t?Mr(e,n,t,r):!!i},Rn.isError=Zo,Rn.isFinite=function(t){return"number"==typeof t&&on(t)},Rn.isFunction=Jo,Rn.isInteger=Ho,Rn.isLength=Ko,Rn.isMap=ta,Rn.isMatch=function(t,e){return t===e||Ir(t,e,os(e))},Rn.isMatchWith=function(e,n,r){return r="function"==typeof r?r:t,Ir(e,n,os(n),r)},Rn.isNaN=function(t){return ea(t)&&t!=+t},Rn.isNative=function(t){if(bs(t))throw new xt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return _r(t)},Rn.isNil=function(t){return null==t},Rn.isNull=function(t){return null===t},Rn.isNumber=ea,Rn.isObject=Xo,Rn.isObjectLike=Qo,Rn.isPlainObject=na,Rn.isRegExp=ra,Rn.isSafeInteger=function(t){return Ho(t)&&t>=-9007199254740991&&t<=a},Rn.isSet=ia,Rn.isString=sa,Rn.isSymbol=oa,Rn.isTypedArray=aa,Rn.isUndefined=function(e){return e===t},Rn.isWeakMap=function(t){return Qo(t)&&ls(t)==k},Rn.isWeakSet=function(t){return Qo(t)&&"[object WeakSet]"==Sr(t)},Rn.join=function(t,e){return null==t?"":an.call(t,e)},Rn.kebabCase=Ga,Rn.last=Ys,Rn.lastIndexOf=function(e,n,r){var i=null==e?0:e.length;if(!i)return-1;var s=i;return r!==t&&(s=(s=fa(r))<0?yn(i+s,0):mn(s,i-1)),n==n?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(e,n,s):Le(e,Pe,s,!0)},Rn.lowerCase=Ba,Rn.lowerFirst=Wa,Rn.lt=ua,Rn.lte=ca,Rn.max=function(e){return e&&e.length?fr(e,eu,Er):t},Rn.maxBy=function(e,n){return e&&e.length?fr(e,is(n,2),Er):t},Rn.mean=function(t){return ze(t,eu)},Rn.meanBy=function(t,e){return ze(t,is(e,2))},Rn.min=function(e){return e&&e.length?fr(e,eu,Dr):t},Rn.minBy=function(e,n){return e&&e.length?fr(e,is(n,2),Dr):t},Rn.stubArray=du,Rn.stubFalse=pu,Rn.stubObject=function(){return{}},Rn.stubString=function(){return""},Rn.stubTrue=function(){return!0},Rn.multiply=wu,Rn.nth=function(e,n){return e&&e.length?zr(e,fa(n)):t},Rn.noConflict=function(){return ue._===this&&(ue._=Rt),this},Rn.noop=ou,Rn.now=Oo,Rn.pad=function(t,e,n){t=ma(t);var r=(e=fa(e))?cn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return $i(de(i),n)+t+$i(fe(i),n)},Rn.padEnd=function(t,e,n){t=ma(t);var r=(e=fa(e))?cn(t):0;return e&&r<e?t+$i(e-r,n):t},Rn.padStart=function(t,e,n){t=ma(t);var r=(e=fa(e))?cn(t):0;return e&&r<e?$i(e-r,n)+t:t},Rn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),bn(ma(t).replace(tt,""),e||0)},Rn.random=function(e,n,r){if(r&&"boolean"!=typeof r&&ys(e,n,r)&&(n=r=t),r===t&&("boolean"==typeof n?(r=n,n=t):"boolean"==typeof e&&(r=e,e=t)),e===t&&n===t?(e=0,n=1):(e=ha(e),n===t?(n=e,e=0):n=ha(n)),e>n){var i=e;e=n,n=i}if(r||e%1||n%1){var s=vn();return mn(e+s*(n-e+ie("1e-"+((s+"").length-1))),n)}return Wr(e,n)},Rn.reduce=function(t,e,n){var r=Go(t)?Ie:Ge,i=arguments.length<3;return r(t,is(e,4),n,i,cr)},Rn.reduceRight=function(t,e,n){var r=Go(t)?_e:Ge,i=arguments.length<3;return r(t,is(e,4),n,i,lr)},Rn.repeat=function(e,n,r){return n=(r?ys(e,n,r):n===t)?1:fa(n),qr(ma(e),n)},Rn.replace=function(){var t=arguments,e=ma(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Rn.result=function(e,n,r){var i=-1,s=(n=yi(n,e)).length;for(s||(s=1,e=t);++i<s;){var o=null==e?t:e[Ds(n[i])];o===t&&(i=s,o=r),e=Jo(o)?o.call(e):o}return e},Rn.round=xu,Rn.runInContext=u,Rn.sample=function(t){return(Go(t)?Zn:Yr)(t)},Rn.size=function(t){if(null==t)return 0;if(Wo(t))return sa(t)?cn(t):t.length;var e=ls(t);return e==v||e==O?t.size:Ar(t).length},Rn.snakeCase=qa,Rn.some=function(e,n,r){var i=Go(e)?Ne:ti;return r&&ys(e,n,r)&&(n=t),i(e,is(n,3))},Rn.sortedIndex=function(t,e){return ei(t,e)},Rn.sortedIndexBy=function(t,e,n){return ni(t,e,is(n,2))},Rn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=ei(t,e);if(r<n&&Po(t[r],e))return r}return-1},Rn.sortedLastIndex=function(t,e){return ei(t,e,!0)},Rn.sortedLastIndexBy=function(t,e,n){return ni(t,e,is(n,2),!0)},Rn.sortedLastIndexOf=function(t,e){if(null!=t&&t.length){var n=ei(t,e,!0)-1;if(Po(t[n],e))return n}return-1},Rn.startCase=Va,Rn.startsWith=function(t,e,n){return t=ma(t),n=null==n?0:ir(fa(n),0,t.length),e=si(e),t.slice(n,n+e.length)==e},Rn.subtract=Su,Rn.sum=function(t){return t&&t.length?Be(t,eu):0},Rn.sumBy=function(t,e){return t&&t.length?Be(t,is(e,2)):0},Rn.template=function(e,n,r){var i=Rn.templateSettings;r&&ys(e,n,r)&&(n=t),e=ma(e),n=va({},n,i,Zi);var s,o,a=va({},n.imports,i.imports,Zi),u=Ma(a),c=Ye(a,u),l=0,h=n.interpolate||mt,f="__p += '",d=Ct((n.escape||mt).source+"|"+h.source+"|"+(h===Z?ut:mt).source+"|"+(n.evaluate||mt).source+"|$","g"),p="//# sourceURL="+(Nt.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++te+"]")+"\n";e.replace(d,(function(t,n,r,i,a,u){return r||(r=i),f+=e.slice(l,u).replace(gt,Qe),n&&(s=!0,f+="' +\n__e("+n+") +\n'"),a&&(o=!0,f+="';\n"+a+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+t.length,t})),f+="';\n";var y=Nt.call(n,"variable")&&n.variable;if(y){if(ot.test(y))throw new xt("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(o?f.replace(z,""):f).replace($,"$1").replace(U,"$1;"),f="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(s?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var m=Ha((function(){return St(u,p+"return "+f).apply(t,c)}));if(m.source=f,Zo(m))throw m;return m},Rn.times=function(t,e){if((t=fa(t))<1||t>a)return[];var n=l,r=mn(t,l);e=is(e),t-=l;for(var i=We(r,e);++n<t;)e(n);return i},Rn.toFinite=ha,Rn.toInteger=fa,Rn.toLength=da,Rn.toLower=function(t){return ma(t).toLowerCase()},Rn.toNumber=pa,Rn.toSafeInteger=function(t){return t?ir(fa(t),-9007199254740991,a):0===t?t:0},Rn.toString=ma,Rn.toUpper=function(t){return ma(t).toUpperCase()},Rn.trim=function(e,n,r){if((e=ma(e))&&(r||n===t))return qe(e);if(!e||!(n=si(n)))return e;var i=ln(e),s=ln(n);return gi(i,Je(i,s),He(i,s)+1).join("")},Rn.trimEnd=function(e,n,r){if((e=ma(e))&&(r||n===t))return e.slice(0,hn(e)+1);if(!e||!(n=si(n)))return e;var i=ln(e);return gi(i,0,He(i,ln(n))+1).join("")},Rn.trimStart=function(e,n,r){if((e=ma(e))&&(r||n===t))return e.replace(tt,"");if(!e||!(n=si(n)))return e;var i=ln(e);return gi(i,Je(i,ln(n))).join("")},Rn.truncate=function(e,n){var r=30,i="...";if(Xo(n)){var s="separator"in n?n.separator:s;r="length"in n?fa(n.length):r,i="omission"in n?si(n.omission):i}var o=(e=ma(e)).length;if(tn(e)){var a=ln(e);o=a.length}if(r>=o)return e;var u=r-cn(i);if(u<1)return i;var c=a?gi(a,0,u).join(""):e.slice(0,u);if(s===t)return c+i;if(a&&(u+=c.length-u),ra(s)){if(e.slice(u).search(s)){var l,h=c;for(s.global||(s=Ct(s.source,ma(ct.exec(s))+"g")),s.lastIndex=0;l=s.exec(h);)var f=l.index;c=c.slice(0,f===t?u:f)}}else if(e.indexOf(si(s),u)!=u){var d=c.lastIndexOf(s);d>-1&&(c=c.slice(0,d))}return c+i},Rn.unescape=function(t){return(t=ma(t))&&W.test(t)?t.replace(G,fn):t},Rn.uniqueId=function(t){var e=++At;return ma(t)+e},Rn.upperCase=Ya,Rn.upperFirst=Za,Rn.each=mo,Rn.eachRight=go,Rn.first=Bs,su(Rn,(yu={},gr(Rn,(function(t,e){Nt.call(Rn.prototype,e)||(yu[e]=t)})),yu),{chain:!1}),Rn.VERSION="4.17.21",Se(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Rn[t].placeholder=Rn})),Se(["drop","take"],(function(e,n){Un.prototype[e]=function(r){r=r===t?1:yn(fa(r),0);var i=this.__filtered__&&!n?new Un(this):this.clone();return i.__filtered__?i.__takeCount__=mn(r,i.__takeCount__):i.__views__.push({size:mn(r,l),type:e+(i.__dir__<0?"Right":"")}),i},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Se(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;Un.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:is(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),Se(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Un.prototype[t]=function(){return this[n](1).value()[0]}})),Se(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Un.prototype[t]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(eu)},Un.prototype.find=function(t){return this.filter(t).head()},Un.prototype.findLast=function(t){return this.reverse().find(t)},Un.prototype.invokeMap=Vr((function(t,e){return"function"==typeof t?new Un(this):this.map((function(n){return kr(n,t,e)}))})),Un.prototype.reject=function(t){return this.filter(Ao(is(t)))},Un.prototype.slice=function(e,n){e=fa(e);var r=this;return r.__filtered__&&(e>0||n<0)?new Un(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),n!==t&&(r=(n=fa(n))<0?r.dropRight(-n):r.take(n-e)),r)},Un.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Un.prototype.toArray=function(){return this.take(l)},gr(Un.prototype,(function(e,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),i=/^(?:head|last)$/.test(n),s=Rn[i?"take"+("last"==n?"Right":""):n],o=i||/^find/.test(n);s&&(Rn.prototype[n]=function(){var n=this.__wrapped__,a=i?[1]:arguments,u=n instanceof Un,c=a[0],l=u||Go(n),h=function(t){var e=s.apply(Rn,Me([t],a));return i&&f?e[0]:e};l&&r&&"function"==typeof c&&1!=c.length&&(u=l=!1);var f=this.__chain__,d=o&&!f,p=u&&!this.__actions__.length;if(!o&&l){n=p?n:new Un(this);var y=e.apply(n,a);return y.__actions__.push({func:lo,args:[h],thisArg:t}),new $n(y,f)}return d&&p?e.apply(this,a):(y=this.thru(h),d?i?y.value()[0]:y.value():y)})})),Se(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Tt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Rn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(Go(i)?i:[],t)}return this[n]((function(n){return e.apply(Go(n)?n:[],t)}))}})),gr(Un.prototype,(function(t,e){var n=Rn[e];if(n){var r=n.name+"";Nt.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:e,func:n})}})),Tn[ji(t,2).name]=[{name:"wrapper",func:t}],Un.prototype.clone=function(){var t=new Un(this.__wrapped__);return t.__actions__=Ci(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ci(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ci(this.__views__),t},Un.prototype.reverse=function(){if(this.__filtered__){var t=new Un(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Un.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=Go(t),r=e<0,i=n?t.length:0,s=function(t,e,n){for(var r=-1,i=n.length;++r<i;){var s=n[r],o=s.size;switch(s.type){case"drop":t+=o;break;case"dropRight":e-=o;break;case"take":e=mn(e,t+o);break;case"takeRight":t=yn(t,e-o)}}return{start:t,end:e}}(0,i,this.__views__),o=s.start,a=s.end,u=a-o,c=r?a:o-1,l=this.__iteratees__,h=l.length,f=0,d=mn(u,this.__takeCount__);if(!n||!r&&i==u&&d==u)return li(t,this.__actions__);var p=[];t:for(;u--&&f<d;){for(var y=-1,m=t[c+=e];++y<h;){var g=l[y],b=g.type,v=(0,g.iteratee)(m);if(2==b)m=v;else if(!v){if(1==b)continue t;break t}}p[f++]=m}return p},Rn.prototype.at=ho,Rn.prototype.chain=function(){return co(this)},Rn.prototype.commit=function(){return new $n(this.value(),this.__chain__)},Rn.prototype.next=function(){this.__values__===t&&(this.__values__=la(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?t:this.__values__[this.__index__++]}},Rn.prototype.plant=function(e){for(var n,r=this;r instanceof zn;){var i=js(r);i.__index__=0,i.__values__=t,n?s.__wrapped__=i:n=i;var s=i;r=r.__wrapped__}return s.__wrapped__=e,n},Rn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var n=e;return this.__actions__.length&&(n=new Un(this)),(n=n.reverse()).__actions__.push({func:lo,args:[Ks],thisArg:t}),new $n(n,this.__chain__)}return this.thru(Ks)},Rn.prototype.toJSON=Rn.prototype.valueOf=Rn.prototype.value=function(){return li(this.__wrapped__,this.__actions__)},Rn.prototype.first=Rn.prototype.head,Kt&&(Rn.prototype[Kt]=function(){return this}),Rn}();le?((le.exports=dn)._=dn,ce._=dn):ue._=dn}.call(un.exports)),un.exports);
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Lodash <https://lodash.com/>
|
|
5
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
6
|
-
* Released under MIT license <https://lodash.com/license>
|
|
7
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
8
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
9
|
-
*/const ln=["array","boolean","collator","format","literal","number","number-format","object","string","image","to-boolean","to-color","to-number","to-string","typeof","feature-state","geometry-type","id","line-progress","properties","at","get","has","in","index-of","length","slice","!","!=","<","<=","==",">",">=","all","any","case","match","coalesce","within","interpolate","interpolate-hcl","interpolate-lab","step","let","var","concat","downcase","is-supported-script","resolved-locale","upcase","rgb","rgba","to-rgba","-","*","/","%","^","+","abs","acos","asin","atan","ceil","cos","e","floor","ln","ln2","log10","log2","max","min","pi","round","sin","sqrt","tan","zoom","heatmap-density"],hn={numberFormat:null,strAbbreviate:null,strCapitalize:null,strConcat:"concat",strDefaultIfBlank:null,strEndsWith:null,strEqualsIgnoreCase:null,strIndexOf:null,strLastIndexOf:null,strLength:"length",strMatches:null,strReplace:null,strStartsWith:null,strStripAccents:null,strSubstring:"slice",strSubstringStart:null,strToLowerCase:"downcase",strToUpperCase:"upcase",strToString:null,strTrim:null,add:"+",abs:"abs",acos:"acos",asin:"asin",atan:"atan",atan2:null,ceil:"ceil",cos:"cos",div:"/",exp:"e",floor:"floor",interpolate:"interpolate",log:"ln",max:"max",min:"min",modulo:"%",mul:"*",pi:"pi",pow:"^",random:null,rint:null,round:"round",sin:"sin",sqrt:"sqrt",sub:"-",tan:"tan",toDegrees:null,toNumber:null,toRadians:null,all:"all",any:"any",between:"within",double2bool:null,equalTo:"==",greaterThan:">",greaterThanOrEqualTo:">=",in:"in",lessThan:"<",lessThanOrEqualTo:"<=",not:"!",notEqualTo:"!=",parseBoolean:"to-boolean",case:"case",property:"get",step:null},fn=cn.invert(hn);function dn(t){if(!nn(t))return t;const e="args"in t?t.args:[];switch(t.name){case"case":{const n=[];let r;return e.forEach(((e,i)=>{if(0!==i){if(null==e.case||null==e.value)throw new Error("Could not translate GeoStyler Expression: "+t);n.push(dn(e.case)),n.push(dn(e.value))}else r=dn(e)})),["case",...n,r]}case"interpolate":{const n=[];return e.forEach(((e,r)=>{if(0!==r)if(1!==r){if(null==e.stop||null==e.value)throw new Error("Could not translate GeoStyler Expression: "+t);n.push(dn(e.stop)),n.push(dn(e.value))}else n.push(dn(e));else n.push([e.name])})),["interpolate",...n]}case"exp":if(1===e[0])return["e"];break;case"pi":return["pi"];default:const n=hn[t.name];if(!n)throw new Error("Could not translate GeoStyler Expression: "+t);return[n,...e.map((t=>dn(t)))]}throw new Error("Could not translate GeoStyler Expression: "+t)}function pn(t,e){if(!Array.isArray(t)||!ln.includes(t[0]))return"string"==typeof t&&e?rn.getHexColor(t):t;const n=t[0],r=t.slice(1);let i;switch(n){case"e":i={name:"exp",args:[1]};break;case"case":{const t=[],n=pn(r.pop(),e);r.forEach(((n,r)=>{var i=Math.floor(r/2);t[i]=r%2==0?{case:pn(n)}:{...t[i],value:pn(n,e)}})),t.unshift(n),i={name:"case",args:t};break}case"interpolate":{const t=r.shift()[0],e=pn(r.shift()),n=[];r.forEach(((t,e)=>{const r=Math.floor(e/2);n[r]=e%2==0?{stop:pn(t)}:{...n[r],value:pn(t)}})),n.unshift({name:t},e),i={name:"interpolate",args:n};break}case"pi":i={name:"pi"};break;default:const s=fn[n];if(!s)throw new Error("Could not translate Mapbox Expression: "+t);i={name:s,args:r.map((t=>pn(t)))}}return i}class yn{static title="Mapbox";static fillSymbolizerStrokeProperties=["outlineOpacity","outlineWidth","outlineCap","outlineJoin","outlineDasharray"];title="Mapbox";unsupportedProperties={Symbolizer:{FillSymbolizer:{fillOpacity:{support:"none",info:"Use opacity instead."},outlineWidthUnit:"none",graphicFill:{support:"partial",info:"Only Sprite is supported."}},LineSymbolizer:{dashOffset:"none",graphicStroke:"none",gapWidthUnit:"none",spacing:"none",spacingUnit:"none",widthUnit:"none",graphicFill:{support:"partial",info:"Only Sprite is supported."}},MarkSymbolizer:{support:"partial",wellKnownName:{support:"partial",info:"Only circle symbolizers are supported for the moment."},opacity:{support:"none",info:"General opacity is not supported. Use fillOpacity and strokeOpacity instead."}},IconSymbolizer:{haloOpacity:"none",haloWidthUnit:"none",sizeUnit:"none",image:{support:"partial",info:"Only Sprite is supported."}},RasterSymbolizer:"none",TextSymbolizer:{fontStyle:"none",fontWeight:"none",haloOpacity:"none",haloWidthUnit:"none",letterSpacingUnit:"none",lineHeightUnit:"none"}},Function:{numberFormat:"none",strAbbreviate:"none",strCapitalize:"none",strDefaultIfBlank:"none",strEndsWith:"none",strEqualsIgnoreCase:"none",strIndexOf:"none",strLastIndexOf:"none",strMatches:"none",strReplace:"none",strStartsWith:"none",strStripAccents:"none",strSubstringStart:"none",strSubstring:{support:"partial",info:"end index is mandatory"},strTrim:"none",exp:{support:"partial",info:"only for x = 1"},atan2:"none",random:"none",rint:"none",toDegrees:"none",toRadians:"none",double2bool:"none"}};ignoreConversionErrors=!1;replaceGraphicFillWithColor=!1;pretty=!1;mbMetadata;gsMetadata;spriteBaseUrl;spriteCache;constructor(t){this.ignoreConversionErrors=!!t?.ignoreConversionErrors,this.pretty=!!t?.pretty,this.replaceGraphicFillWithColor=!!t?.replaceGraphicFillWithColor}isSymbolType(t){return!!t.iconSymbolizer||!!t.textSymbolizer}getSymbolizerKindFromMapboxLayerType(t){switch(t){case"fill":return"Fill";case"line":return"Line";case"symbol":return"Symbol";case"circle":return"Circle";default:if(this.ignoreConversionErrors)return"Circle";throw new Error("Could not parse mapbox style. Unsupported layer type.\n We support types 'fill', 'line', 'circle' and 'symbol' only.")}}getLabelFromTextField(t){if(void 0===t)return;if("string"==typeof t)return rn.resolveMbTextPlaceholder(t);if("format"!==t[0])return pn(t);let e="";for(let n=1;n<t.length;n+=2)if("string"==typeof t[n])e+=t[n];else{if("get"!==t[n][0]&&!this.ignoreConversionErrors)throw new Error("Cannot parse mapbox style. Unsupported lookup type.");e+="{{"+t[n][1]+"}}"}return e}async getSpriteData(t){if(this.spriteCache?.[t])return this.spriteCache[t];{const e=await fetch(this.spriteBaseUrl+".json"),n=await e.json();return this.spriteCache=n,n[t]}}async getIconImage(t){if(!t)return;if(!this.spriteBaseUrl)throw new Error(`Could not resolve sprite ${t}. No base url found.`);if(!cn.isString(t))throw new Error("Cannot handle mapbox expressions for sprite names (e.g. icon-image).");const e=await this.getSpriteData(t),n=[e.x,e.y],r=[e.width,e.height];return cn.set(this.gsMetadata["mapbox:ref"],`sprite.${t}`,{position:n,size:r}),{source:this.spriteBaseUrl+".png",position:n,size:r}}getMarkSymbolizerFromMapboxCircleLayer(t,e){const n={kind:"Mark",blur:pn(t?.["circle-blur"]),color:pn(t?.["circle-color"],!0),offset:t?.["circle-translate"],offsetAnchor:t?.["circle-translate-anchor"],fillOpacity:pn(t?.["circle-opacity"]),pitchAlignment:t?.["circle-pitch-alignment"],pitchScale:t?.["circle-pitch-scale"],radius:pn(t?.["circle-radius"]),strokeColor:pn(t?.["circle-stroke-color"],!0),strokeOpacity:pn(t?.["circle-stroke-opacity"]),strokeWidth:pn(t?.["circle-stroke-width"]),visibility:e?.visibility&&"none"!==e?.visibility,wellKnownName:"circle"};if(!rn.symbolizerAllUndefined(n))return cn.omitBy(n,cn.isUndefined)}async getIconSymbolizerFromMapboxSymbolLayer(t,e){const n=await this.getIconImage(e?.["icon-image"]),r={kind:"Icon",allowOverlap:pn(e?.["icon-allow-overlap"]),anchor:e?.["icon-anchor"],avoidEdges:e?.["symbol-avoid-edges"],color:pn(t?.["icon-color"],!0),haloBlur:pn(t?.["icon-halo-blur"]),haloColor:pn(t?.["icon-halo-color"],!0),haloWidth:pn(t?.["icon-halo-width"]),image:n,keepUpright:pn(e?.["icon-keep-upright"]),offset:e?.["icon-offset"],offsetAnchor:t?.["icon-translate-anchor"],opacity:pn(t?.["icon-opacity"]),optional:pn(e?.["icon-optional"]),padding:pn(e?.["icon-padding"]),pitchAlignment:e?.["icon-pitch-alignment"],rotate:pn(e?.["icon-rotate"]),rotationAlignment:e?.["icon-rotation-alignment"],textFit:e?.["icon-text-fit"],textFitPadding:e?.["icon-text-fit-padding"],visibility:e?.visibility&&"none"!==e?.visibility};if(e?.["icon-size"]&&n){const t=pn(e["icon-size"]);nn(t)?r.size={name:"mul",args:[t,n.size[0]]}:t&&(r.size=t*n.size[0]),cn.set(this.gsMetadata["mapbox:ref"],`sprite.${e?.["icon-image"]}.icon-size`,e["icon-size"])}if(!rn.symbolizerAllUndefined(r))return r}getTextSymbolizerFromMapboxLayer(t,e){const n={kind:"Text",allowOverlap:pn(e?.["text-allow-overlap"]),anchor:e?.["text-anchor"],avoidEdges:pn(e?.["symbol-avoid-edges"]),color:pn(t?.["text-color"],!0),font:e?.["text-font"],haloBlur:pn(t?.["text-halo-blur"]),haloColor:pn(t?.["text-halo-color"],!0),haloWidth:pn(t?.["text-halo-width"]),justify:e?.["text-justify"],keepUpright:pn(e?.["text-keep-upright"]),label:this.getLabelFromTextField(e?.["text-field"]),letterSpacing:pn(e?.["text-letter-spacing"]),lineHeight:pn(e?.["text-line-height"]),maxAngle:pn(e?.["text-max-angle"]),maxWidth:pn(e?.["text-max-width"]),offset:e?.["text-offset"],offsetAnchor:t?.["text-translate-anchor"],opacity:pn(t?.["text-opacity"]),optional:pn(e?.["text-optional"]),padding:pn(e?.["text-padding"]),pitchAlignment:e?.["text-pitch-alignment"],rotate:pn(e?.["text-rotate"]),rotationAlignment:e?.["text-rotation-alignment"],size:pn(e?.["text-size"]),transform:e?.["text-transform"],visibility:e?.visibility&&"none"!==e?.visibility,placement:pn(e?.["symbol-placement"])};if(!rn.symbolizerAllUndefined(n))return cn.omitBy(n,cn.isUndefined)}async getFillSymbolizerFromMapboxFillLayer(t,e){const n=await this.getPatternOrGradientFromMapboxLayer(t?.["fill-pattern"]),r={kind:"Fill",visibility:e?.visibility&&"none"!==e?.visibility,antialias:pn(t?.["fill-antialias"]),opacity:pn(t?.["fill-opacity"]),color:pn(t?.["fill-color"],!0),outlineColor:pn(t?.["fill-outline-color"],!0),graphicFill:n};return cn.omitBy(r,cn.isUndefined)}async getPatternOrGradientFromMapboxLayer(t){if(Array.isArray(t)&&!this.ignoreConversionErrors)throw new Error("Cannot parse pattern or gradient. No Mapbox expressions allowed");if(t)return await this.getIconSymbolizerFromMapboxSymbolLayer({},{"icon-image":t})}async getLineSymbolizerFromMapboxLineLayer(t,e){const n=await this.getPatternOrGradientFromMapboxLayer(t?.["line-pattern"]),r={kind:"Line",visibility:e?.visibility&&"none"!==e?.visibility,cap:e?.["line-cap"],join:e?.["line-join"],miterLimit:pn(e?.["line-miter-limit"]),roundLimit:pn(e?.["line-round-limit"]),opacity:pn(t?.["line-opacity"]),color:pn(t?.["line-color"],!0),width:pn(t?.["line-width"]),gapWidth:pn(t?.["line-gap-width"]),perpendicularOffset:pn(t?.["line-offset"]),blur:pn(t?.["line-blur"]),dasharray:t?.["line-dasharray"],gradient:t?.["line-gradient"],graphicFill:n};return cn.omitBy(r,cn.isUndefined)}async getIconTextSymbolizersFromMapboxSymbolLayer(t,e){return[this.getTextSymbolizerFromMapboxLayer(t,e),await this.getIconSymbolizerFromMapboxSymbolLayer(t,e)].filter((t=>!!t))}async getSymbolizersFromMapboxLayer({paint:t,layout:e,type:n}){let r={};switch(this.getSymbolizerKindFromMapboxLayerType(n)){case"Fill":r=await this.getFillSymbolizerFromMapboxFillLayer(t,e);break;case"Line":r=await this.getLineSymbolizerFromMapboxLineLayer(t,e);break;case"Symbol":return await this.getIconTextSymbolizersFromMapboxSymbolLayer(t,e);case"Circle":const n=this.getMarkSymbolizerFromMapboxCircleLayer(t,e);return n?[n]:[];default:if(this.ignoreConversionErrors)return[];throw new Error("Cannot parse mapbox style. Unsupported Symbolizer kind.")}return[cn.omitBy(r,cn.isUndefined)]}getFilterFromMapboxFilter(t){if(!t)return;let e=!1;if(t[0]in{all:!0,any:!0,"!":!0}&&(e=!0),e){switch(t[0]){case"all":t[0]="&&";break;case"any":t[0]="||"}t.slice(1).forEach((t=>{this.getFilterFromMapboxFilter(t)}))}return t}getScaleDenominatorFromMapboxZoom(t,e){let n={};if(void 0!==t&&(n.max=rn.zoomToScale(t)),void 0!==e&&(n.min=rn.zoomToScale(e)),void 0!==n.min||void 0!==n.max)return n}mergeSymbolizers(t){return 1===t.length?t[0]:t.reduce(((t,e,n)=>{if(0===n)return t;let r=Object.assign({},t,e);if(t.kind!==e.kind){const n=Xe(t),s=Xe(e);if(!n&&!s)throw new Error(`Trying to merge two symbolizers of different kinds: ${t.kind}, ${e.kind}`);{const s="Line"===(null==(i=t)?void 0:i.kind)?t:e;r=n?t:e,r.outlineColor=s.color,r.outlineOpacity=s.opacity,r.outlineCap=s.cap,r.outlineJoin=s.join,r.outlineWidth=s.width,r.outlineDasharray=s.dasharray}}var i;return r}),t[0])}async mapboxLayersToGeoStylerRules(t){const e=this.mbMetadata?.["geostyler:ref"],n=[],r=[],i={},s={};if(e){const o=async()=>Promise.all(e.rules.map((async(e,o)=>{const a=e?.name||"";let u,c,l,h,f=[];Array.isArray(e.symbolizers)&&(await Promise.all(e.symbolizers.map((async(e,n)=>{const a=t.filter((t=>e.includes(t.id))),d=a.map((async t=>{const e=await this.getSymbolizersFromMapboxLayer(t);return e.length>1&&r.push({rule:o,symbolizers:e.map(((t,e)=>e))}),e})),p=(await Promise.all(d)).flat();f[n]=this.mergeSymbolizers(p),a?.[0]&&(u=this.getFilterFromMapboxFilter(a[0].filter),c=this.getScaleDenominatorFromMapboxZoom(a[0].minzoom,a[0].maxzoom),l=a[0].source,h=a[0]["source-layer"],l&&"string"==typeof l&&(i[l]||(i[l]=[]),i[l].push(o)),h&&(s[h]||(s[h]=[]),s[h].push(o)))}))),n[o]=cn.omitBy({filter:u,name:a,scaleDenominator:c,symbolizers:f},cn.isUndefined))})));await o()}else{const e=async()=>Promise.all(t.map((async t=>{const e=await this.getSymbolizersFromMapboxLayer(t);if(e.length<1)return;const o=this.getFilterFromMapboxFilter(t.filter),a=this.getScaleDenominatorFromMapboxZoom(t.minzoom,t.maxzoom);n.push({filter:o,name:t.id,scaleDenominator:a,symbolizers:e}),t.source&&"string"==typeof t.source&&(i[t.source]||(i[t.source]=[]),i[t.source].push(n.length-1)),t["source-layer"]&&(s[t["source-layer"]]||(s[t["source-layer"]]=[]),s[t["source-layer"]].push(n.length-1)),e.length>1&&r.push({rule:n.length-1,symbolizers:e.map(((t,e)=>e))})})));await e()}return r.length>0&&cn.set(this.gsMetadata["mapbox:ref"],"splitSymbolizers",r),Object.keys(i).length&&cn.set(this.gsMetadata["mapbox:ref"],"sourceMapping",i),Object.keys(s).length&&cn.set(this.gsMetadata["mapbox:ref"],"sourceLayerMapping",s),{rules:n}}async mapboxStyleToGeoStylerStyle(t){let e={};if(e.name=t.name||"",e.rules=[],this.mbMetadata=t.metadata,this.gsMetadata={"mapbox:ref":{sources:t.sources||{}}},t.sprite&&(this.spriteBaseUrl=rn.getUrlForMbPlaceholder(t.sprite)),t.layers){const n=t.layers.filter((t=>!("custom"===t.type))),r=await this.mapboxLayersToGeoStylerRules(n);e.rules=e.rules.concat(r.rules)}return e.metadata=this.gsMetadata,e}readStyle(t){return new Promise((async e=>{try{const n=structuredClone(t);e({output:await this.mapboxStyleToGeoStylerStyle(n)})}catch(t){e({errors:[t]})}}))}writeStyle(t){return new Promise((e=>{const n=this.checkForUnsupportedProperties(t);try{const r=structuredClone(t);e({output:this.geoStylerStyleToMapboxObject(r),unsupportedProperties:n,warnings:n&&["Your style contains unsupportedProperties!"]})}catch(t){e({errors:[t]})}}))}geoStylerStyleToMapboxObject(t){const e=t.name;this.gsMetadata={"mapbox:ref":t.metadata?.["mapbox:ref"]};const{layers:n,geoStylerRef:r}=this.getMapboxLayersFromRules(t.rules),i=rn.getMbPlaceholderForUrl(this.spriteBaseUrl);let s=cn.omitBy({version:8,name:e,layers:n,sprite:i,sources:this.gsMetadata["mapbox:ref"]?.sources||{}},cn.isUndefined);return r&&(s={...s,metadata:{"geostyler:ref":r}}),s}getMapboxLayersFromRules(t){const e=[],n={rules:[]};return t.forEach(((t,r)=>{let i={};if(Ze(t.filter)){const e=structuredClone(t.filter);i.filter=this.getMapboxFilterFromFilter(e)}var s;!(null!=(s=t.scaleDenominator)&&s.min||null!=s&&s.max)||s.min&&!Qe(s.min)&&!Ue(s.min)||s.max&&!Qe(s.max)&&!Ue(s.max)||(void 0!==t.scaleDenominator.min&&(nn(t.scaleDenominator.min)||(i.maxzoom=this.getMapboxZoomFromScaleDenominator(t.scaleDenominator.min))),void 0!==t.scaleDenominator.max&&(nn(t.scaleDenominator.max)||(i.minzoom=this.getMapboxZoomFromScaleDenominator(t.scaleDenominator.max)))),n.rules[r]={name:t.name,symbolizers:[]},t.symbolizers.forEach(((t,s)=>{let o={};o.filter=i.filter,o.minzoom=i.minzoom,o.maxzoom=i.maxzoom;const a=this.getStyleFromSymbolizer(t),u=this.gsMetadata["mapbox:ref"]?.splitSymbolizers?.some((t=>t.rule===r&&t.symbolizers.length>1&&t.symbolizers.slice(1).includes(s)));a.forEach(((t,i)=>{const{type:a,paint:c,layout:l}=t;let h=structuredClone(o);if(u)return h=e.at(-1),h.paint={...h.paint,...c},void(h.layout={...h.layout,...l});h.type=a,rn.allUndefined(c)||(h.paint=c),rn.allUndefined(l)||(h.layout=l),h.id=`r${r}_sy${s}_st${i}`;const f=this.gsMetadata["mapbox:ref"]?.sourceMapping;if(f){const t=Object.keys(f).filter((t=>f[t].includes(r))).pop();void 0!==t&&(h.source=t)}const d=this.gsMetadata["mapbox:ref"]?.sourceLayerMapping;if(d){const t=Object.keys(d).filter((t=>d[t].includes(r))).pop();void 0!==t&&(h["source-layer"]=t)}e.push(cn.omitBy(h,cn.isUndefined));let p=n.rules[r].symbolizers;p||(p=[]),p[s]||(p[s]=[]),p[s].push(h.id),n.rules[r].symbolizers=p}))}))})),{layers:e,geoStylerRef:n}}getMapboxZoomFromScaleDenominator(t){const e=rn.getResolutionForScale(t);let n;return n=rn.getResolutions().indexOf(e),-1===n&&(n=rn.getZoomForResolution(e)),n}getMapboxFilterFromFilter(t){if(en(t)||cn.isBoolean(t))return dn(t);let e=[...t];const n=e[0];if(["&&","||","!"].includes(n)){switch(n){case"&&":e[0]="all";break;case"||":e[0]="any"}e=e.map(((t,e)=>e>1?this.getMapboxFilterFromFilter(t):t))}return e}getStyleFromSymbolizer(t){const e=structuredClone(t);let n,r,i,s=[];switch(t.kind){case"Fill":n="fill",yn.fillSymbolizerStrokeProperties.filter((e=>Object.keys(t).includes(e))).length>0?s=this.getSplitStyleFromFillSymbolizer(t):(r=this.getPaintFromFillSymbolizer(e),i=this.getLayoutFromFillSymbolizer(e));break;case"Line":n="line",r=this.getPaintFromLineSymbolizer(e),i=this.getLayoutFromLineSymbolizer(e);break;case"Icon":n="symbol",r=this.getPaintFromIconSymbolizer(e),i=this.getLayoutFromIconSymbolizer(e);break;case"Text":n="symbol",r=this.getPaintFromTextSymbolizer(e),i=this.getLayoutFromTextSymbolizer(e);break;case"Mark":if("circle"===t.wellKnownName){n="circle",r=this.getCirclePaintFromMarkSymbolizer(e),i=this.getCircleLayoutFromMarkSymbolizer(e);break}if(!this.ignoreConversionErrors)throw new Error("Cannot get Style. Unsupported MarkSymbolizer");n="symbol";break;default:if(!this.ignoreConversionErrors)throw new Error("Cannot get Style. Unsupported kind.");n="symbol"}return 2===s.length?s:[{type:n,paint:r,layout:i}]}getSplitStyleFromFillSymbolizer(t){let e=structuredClone(t);delete e?.outlineColor;const n={type:"fill",paint:this.getPaintFromFillSymbolizer(e),layout:this.getLayoutFromFillSymbolizer(e)};e=structuredClone(t);const r={kind:"Line",visibility:e?.visibility,color:e?.outlineColor,opacity:e?.outlineOpacity,width:e?.outlineWidth,join:e?.outlineJoin,cap:e?.outlineCap,dasharray:e?.outlineDasharray};return[n,{type:"line",paint:this.getPaintFromLineSymbolizer(r),layout:this.getLayoutFromLineSymbolizer(r)}]}getPaintFromFillSymbolizer(t){const{opacity:e,color:n,outlineColor:r,graphicFill:i,antialias:s}=t,o={"fill-antialias":dn(s),"fill-opacity":dn(e),"fill-color":dn(n),"fill-outline-color":dn(r),"fill-pattern":this.getPatternOrGradientFromPointSymbolizer(i)};return i&&this.replaceGraphicFillWithColor&&!o["fill-color"]&&"Mark"===i.kind&&(o["fill-color"]=this.getColorFromMarkSymbolizer(i),o["fill-color"]&&!o["fill-opacity"]&&(o["fill-opacity"]=.5)),cn.omitBy(o,cn.isUndefined)}getColorFromMarkSymbolizer(t){const e=t.color??t.strokeColor;if(!e){if(this.ignoreConversionErrors)return;throw new Error("Encountered a colorless mark symbolizer.")}if("string"!=typeof e){if(this.ignoreConversionErrors)return;throw new Error("Mark fill color expressions not supported.")}return e}getLayoutFromFillSymbolizer(t){const{visibility:e}=t,n={visibility:this.getVisibility(e)};return cn.omitBy(n,cn.isUndefined)}getPatternOrGradientFromPointSymbolizer(t){if(t){if("Icon"!==t.kind){if(this.replaceGraphicFillWithColor)return;if(this.ignoreConversionErrors)return;throw new Error("Cannot parse pattern or gradient. Mapbox only supports Icons.")}if(t.image)return this.handleSprite(t.image)}}handleSprite(t){if("string"!=typeof t&&!nn(t)&&!tn(t.source))return this.spriteBaseUrl=t.source.replace(/\.[^/.]+$/,""),rn.getSpriteName(t,this.gsMetadata["mapbox:ref"])}getVisibility(t){return!0===t?"visible":!1===t?"none":void 0}getPaintFromLineSymbolizer(t){const{opacity:e,color:n,perpendicularOffset:r,width:i,blur:s,dasharray:o,graphicFill:a,gapWidth:u,gradient:c}=t,l={"line-opacity":dn(e),"line-color":n,"line-width":dn(i),"line-gap-width":dn(u),"line-offset":dn(r),"line-blur":dn(s),"line-dasharray":o,"line-pattern":this.getPatternOrGradientFromPointSymbolizer(a),"line-gradient":c};return a&&this.replaceGraphicFillWithColor&&!l["line-color"]&&"Mark"===a.kind&&(l["line-color"]=this.getColorFromMarkSymbolizer(a)),cn.omitBy(l,cn.isUndefined)}getLayoutFromLineSymbolizer(t){const{cap:e,join:n,miterLimit:r,roundLimit:i,visibility:s}=t,o={"line-cap":dn(e),"line-join":dn(n),"line-miter-limit":dn(r),"line-round-limit":dn(i),visibility:this.getVisibility(s)};return cn.omitBy(o,cn.isUndefined)}getPaintFromIconSymbolizer(t){const{haloBlur:e,haloColor:n,haloWidth:r,color:i,opacity:s}=t,o={"icon-opacity":dn(s),"icon-color":dn(i),"icon-halo-color":dn(n),"icon-halo-width":dn(r),"icon-halo-blur":dn(e)};return cn.omitBy(o,cn.isUndefined)}getLayoutFromIconSymbolizer(t){const{avoidEdges:e,allowOverlap:n,optional:r,rotationAlignment:i,size:s,textFit:o,textFitPadding:a,image:u,rotate:c,padding:l,keepUpright:h,offset:f,anchor:d,pitchAlignment:p,visibility:y}=t,m=u?this.handleSprite(u):void 0,g=m?this.gsMetadata["mapbox:ref"].sprite?.[m]["icon-size"]:dn(s),b={"symbol-avoid-edges":e,"icon-allow-overlap":dn(n),"icon-optional":r,"icon-rotation-alignment":dn(i),"icon-size":g,"icon-text-fit":dn(o),"icon-text-fit-padding":a,"icon-image":m,"icon-rotate":dn(c),"icon-padding":dn(l),"icon-keep-upright":h,"icon-offset":f,"icon-anchor":dn(d),"icon-pitch-alignment":dn(p),visibility:this.getVisibility(y)};return cn.omitBy(b,cn.isUndefined)}getPaintFromTextSymbolizer(t){const{haloBlur:e,haloColor:n,haloWidth:r,color:i,opacity:s}=t,o={"text-opacity":dn(s),"text-color":dn(i),"text-halo-color":dn(n),"text-halo-width":dn(r),"text-halo-blur":dn(e)};return cn.omitBy(o,cn.isUndefined)}getLayoutFromTextSymbolizer(t){const{allowOverlap:e,anchor:n,label:r,font:i,justify:s,keepUpright:o,letterSpacing:a,lineHeight:u,maxAngle:c,maxWidth:l,offset:h,optional:f,padding:d,pitchAlignment:p,rotate:y,rotationAlignment:m,size:g,transform:b,avoidEdges:v,placement:w,visibility:x}=t,S={"symbol-avoid-edges":v,"text-pitch-alignment":dn(p),"text-rotation-alignment":dn(m),"text-field":this.getTextFieldFromLabel(r),"text-font":i,"text-size":dn(g),"text-max-width":dn(l),"text-line-height":dn(u),"text-letter-spacing":dn(a),"text-justify":dn(s),"text-anchor":dn(n),"text-max-angle":dn(c),"text-rotate":dn(y),"text-padding":dn(d),"text-keep-upright":o,"text-transform":dn(b),"text-offset":h,"text-allow-overlap":e,"text-optional":f,"symbol-placement":w,visibility:this.getVisibility(x)};return cn.omitBy(S,cn.isUndefined)}getTextFieldFromLabel(t){if(!t)return;if(nn(t))return dn(t);let e=new RegExp("\\{\\{.*?\\}\\}","g");return t.replace(e,(t=>t.slice(1,-1)))}getCirclePaintFromMarkSymbolizer(t){const{radius:e,color:n,fillOpacity:r,blur:i,offset:s,offsetAnchor:o,pitchScale:a,pitchAlignment:u,strokeWidth:c,strokeColor:l,strokeOpacity:h}=t,f={"circle-radius":dn(e),"circle-color":dn(n),"circle-blur":dn(i),"circle-opacity":dn(r),"circle-translate":s,"circle-translate-anchor":dn(o),"circle-pitch-scale":dn(a),"circle-pitch-alignment":dn(u),"circle-stroke-width":dn(c),"circle-stroke-color":dn(l),"circle-stroke-opacity":dn(h)};return cn.omitBy(f,cn.isUndefined)}getCircleLayoutFromMarkSymbolizer(t){const{visibility:e}=t,n={visibility:this.getVisibility(e)};return cn.omitBy(n,cn.isUndefined)}checkForUnsupportedProperties(t){const e={};if(t.rules.forEach((t=>{t.symbolizers.forEach((t=>{const n=`${t.kind}Symbolizer`;if(n in this.unsupportedProperties.Symbolizer){const r=this.unsupportedProperties.Symbolizer[n];r&&(cn.isString(r)?cn.set(e,`Symbolizer.${n}`,r):Object.keys(t).forEach((t=>{r[t]&&cn.set(e,`Symbolizer.${n}.${t}`,r)})))}}))})),Object.keys(e).length>0)return e}}var mn;mn||(mn=1,("undefined"!=typeof window?window:u).cqlParser=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,29],n=[1,30],r=[1,31],i=[1,32],s=[1,33],o=[1,34],a=[1,21],u=[1,22],c=[1,13],l=[1,28],h=[1,23],f=[1,24],d=[1,25],p=[1,26],y=[1,27],m=[1,14],g=[1,15],b=[1,5],v=[1,39],w=[1,36],x=[1,37],S=[1,38],E=[5,24,25,33,34,36,39,50,70,86,87,88],O=[5,24,25,33,34,36,39,50,70,75,76,77,78,79,80,81,83,86,87,88],C=[1,56],F=[1,57],k=[1,52],T=[1,53],M=[1,54],I=[1,55],_=[1,58],N=[1,59],A=[1,60],D=[1,61],L=[1,62],j=[1,63],R=[1,64],P=[2,57],z=[5,24,25,33,34,36,39,41,43,50,52,53,54,55,56,57,58,59,60,61,63,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],$=[5,24,25,33,34,36,39,41,43,50,52,53,54,55,56,57,58,59,60,61,63,65,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],U=[1,65],G=[2,20],B=[9,11,12,14,15,17,19,21,22,38,41,43,44,45,46,48,49],W=[1,104],q=[24,25],V=[2,18],Y=[5,24,25,33,34,36,39,50,87,88],Z=[5,24,25,33,34,36,39,50,52,53,54,55,61,63,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],J=[5,24,25,33,34,36,39,41,43,50,52,53,54,55,61,63,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],H=[33,36,39],K={trace:function(){},yy:{},symbols_:{error:2,main:3,where_opt:4,EOF:5,semicolonOpt:6,";":7,string:8,STRING:9,number:10,NUMERIC:11,EXPONENT_NUMERIC:12,boolean:13,TRUE:14,FALSE:15,null:16,NULL:17,literal:18,place_holder:19,function_call:20,IDENTIFIER:21,"(":22,function_call_param_list:23,")":24,",":25,function_call_param:26,expr:27,identifier:28,DOT:29,identifier_list:30,case_expr_opt:31,when_then_list:32,WHEN:33,THEN:34,case_when_else:35,ELSE:36,case_when:37,CASE:38,END:39,simple_expr_prefix:40,"+":41,simple_expr:42,"-":43,"~":44,"!":45,BINARY:46,expr_list:47,ROW:48,"{":49,"}":50,bit_expr:51,"|":52,"&":53,"<<":54,">>":55,"*":56,"/":57,DIV:58,MOD:59,"%":60,"^":61,not_opt:62,NOT:63,escape_opt:64,ESCAPE:65,predicate:66,IN:67,selectClause:68,BETWEEN:69,AND:70,SOUNDS:71,LIKE:72,REGEXP:73,comparison_operator:74,"=":75,">=":76,">":77,"<=":78,"<":79,"<>":80,"!=":81,boolean_primary:82,IS:83,boolean_extra:84,UNKNOWN:85,"&&":86,"||":87,OR:88,group_by_opt:89,group_by:90,roll_up_opt:91,WITH:92,ROLLUP:93,order_by_opt:94,order_by:95,ORDER_BY:96,group_by_order_by_item_list:97,group_by_order_by_item:98,sort_opt:99,ASC:100,DESC:101,limit:102,LIMIT:103,OFFSET:104,limit_opt:105,procedure_opt:106,procedure:107,PROCEDURE:108,for_update_lock_in_share_mode_opt:109,FOR:110,UPDATE:111,LOCK:112,SHARE:113,MODE:114,left_right:115,LEFT:116,RIGHT:117,out_opt:118,OUTER:119,left_right_out_opt:120,table_reference:121,table_factor:122,join_table:123,identifier_list_opt:124,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",7:";",9:"STRING",11:"NUMERIC",12:"EXPONENT_NUMERIC",14:"TRUE",15:"FALSE",17:"NULL",19:"place_holder",21:"IDENTIFIER",22:"(",24:")",25:",",29:"DOT",33:"WHEN",34:"THEN",36:"ELSE",38:"CASE",39:"END",41:"+",43:"-",44:"~",45:"!",46:"BINARY",48:"ROW",49:"{",50:"}",52:"|",53:"&",54:"<<",55:">>",56:"*",57:"/",58:"DIV",59:"MOD",60:"%",61:"^",63:"NOT",65:"ESCAPE",67:"IN",68:"selectClause",69:"BETWEEN",70:"AND",71:"SOUNDS",72:"LIKE",73:"REGEXP",75:"=",76:">=",77:">",78:"<=",79:"<",80:"<>",81:"!=",83:"IS",85:"UNKNOWN",86:"&&",87:"||",88:"OR",90:"group_by",92:"WITH",93:"ROLLUP",96:"ORDER_BY",98:"group_by_order_by_item",100:"ASC",101:"DESC",103:"LIMIT",104:"OFFSET",108:"PROCEDURE",110:"FOR",111:"UPDATE",112:"LOCK",113:"SHARE",114:"MODE",116:"LEFT",117:"RIGHT",119:"OUTER",122:"table_factor",123:"join_table"},productions_:[0,[3,2],[6,1],[6,0],[8,1],[10,1],[10,1],[13,1],[13,1],[16,1],[18,1],[18,1],[18,1],[18,1],[18,1],[20,4],[23,3],[23,1],[26,0],[26,1],[28,1],[28,3],[30,1],[30,3],[31,0],[31,1],[32,4],[32,5],[35,0],[35,2],[37,5],[40,2],[40,2],[40,2],[40,2],[40,2],[42,1],[42,1],[42,1],[42,1],[42,3],[42,4],[42,4],[42,1],[51,1],[51,3],[51,3],[51,3],[51,3],[51,3],[51,3],[51,3],[51,3],[51,3],[51,3],[51,3],[51,3],[62,0],[62,1],[64,0],[64,2],[66,1],[66,6],[66,6],[66,6],[66,4],[66,5],[66,4],[74,1],[74,1],[74,1],[74,1],[74,1],[74,1],[74,1],[82,1],[82,4],[82,3],[84,1],[84,1],[27,1],[27,2],[27,3],[27,3],[27,3],[27,3],[47,1],[47,3],[4,1],[89,0],[89,1],[91,0],[91,2],[94,0],[94,1],[95,3],[97,1],[97,3],[99,0],[99,1],[99,1],[102,2],[102,4],[102,4],[105,0],[105,1],[106,0],[106,1],[107,2],[109,0],[109,2],[109,4],[115,1],[115,1],[118,0],[118,1],[120,0],[120,2],[121,1],[121,1],[124,0],[124,1]],performAction:function(t,e,n,r,i,s){var o=s.length-1;switch(i){case 1:return this.$=s[o-1];case 2:case 7:case 92:this.$=!0;break;case 3:case 8:this.$=!1;break;case 4:this.$=s[o].startsWith("'")||s[o].startsWith('"')?s[o].substring(1,s[o].length-1):s[o];break;case 5:case 6:this.$=Number(s[o]);break;case 9:case 18:case 24:case 28:case 57:case 59:case 89:case 91:case 93:case 98:case 104:case 106:case 109:case 114:case 120:this.$=null;break;case 10:case 11:case 12:case 13:case 14:case 19:case 20:case 25:case 29:case 36:case 37:case 38:case 39:case 43:case 44:case 58:case 60:case 61:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 78:case 80:case 88:case 90:case 94:case 99:case 100:case 105:case 107:case 108:case 112:case 113:case 115:case 118:case 119:case 121:this.$=s[o];break;case 15:this.$={name:s[o-3],args:s[o-1]};break;case 16:s[o-2].push(s[o]),this.$=s[o-2];break;case 17:case 86:case 96:this.$=[s[o]];break;case 21:this.$=s[o-2],s[o-2].value+="."+s[o];break;case 22:this.$={type:"IdentifierList",value:[s[o]]};break;case 23:this.$=s[o-2],s[o-2].value.push(s[o]);break;case 26:this.$={type:"WhenThenList",value:[{when:s[o-2],then:s[o]}]};break;case 27:this.$=s[o-4],this.$.value.push({when:s[o-2],then:s[o]});break;case 30:this.$={type:"CaseWhen",caseExprOpt:s[o-3],whenThenList:s[o-2],else:s[o-1]};break;case 31:case 32:case 33:case 34:case 35:this.$={type:"Prefix",prefix:s[o-1],value:s[o]};break;case 40:this.$=1===s[o-1].length?s[o-1][0]:s[o-1];break;case 41:this.$=s[o-2];break;case 42:this.$={type:"IdentifierExpr",identifier:s[o-2],value:s[o-1]};break;case 45:this.$={type:"BitExpression",operator:"|",left:s[o-2],right:s[o]};break;case 46:this.$={type:"BitExpression",operator:"&",left:s[o-2],right:s[o]};break;case 47:this.$={type:"BitExpression",operator:"<<",left:s[o-2],right:s[o]};break;case 48:this.$={type:"BitExpression",operator:">>",left:s[o-2],right:s[o]};break;case 49:this.$={type:"BitExpression",operator:"+",left:s[o-2],right:s[o]};break;case 50:this.$={type:"BitExpression",operator:"-",left:s[o-2],right:s[o]};break;case 51:this.$={type:"BitExpression",operator:"*",left:s[o-2],right:s[o]};break;case 52:this.$={type:"BitExpression",operator:"/",left:s[o-2],right:s[o]};break;case 53:this.$={type:"BitExpression",operator:"DIV",left:s[o-2],right:s[o]};break;case 54:this.$={type:"BitExpression",operator:"MOD",left:s[o-2],right:s[o]};break;case 55:this.$={type:"BitExpression",operator:"%",left:s[o-2],right:s[o]};break;case 56:this.$={type:"BitExpression",operator:"^",left:s[o-2],right:s[o]};break;case 62:this.$={type:"InSubQueryPredicate",hasNot:s[o-4],left:s[o-5],right:s[o-1]};break;case 63:this.$={type:"InExpressionListPredicate",hasNot:s[o-4],left:s[o-5],right:s[o-1]};break;case 64:this.$=["<=x<=",s[o-5],s[o-2],s[o]];break;case 65:this.$={type:"SoundsLikePredicate",hasNot:!1,left:s[o-3],right:s[o]};break;case 66:this.$={type:"LikePredicate",hasNot:s[o-3],left:s[o-4],right:s[o-1],escape:s[o]};break;case 67:this.$={type:"RegexpPredicate",hasNot:s[o-2],left:s[o-3],right:s[o]};break;case 68:this.$="==";break;case 76:this.$=["==",s[o-3],null];break;case 77:this.$=[s[o-1],s[o-2],s[o]];break;case 79:this.$={type:"BooleanExtra",value:s[o]};break;case 81:this.$=["!",s[o]];break;case 82:case 85:this.$=["&&",s[o-2],s[o]];break;case 83:case 84:this.$=["||",s[o-2],s[o]];break;case 87:this.$=s[o-2],this.$.push(s[o]);break;case 95:this.$={type:"OrderBy",value:s[o-1],rollUp:s[o]};break;case 97:this.$=s[o-2],s[o-2].push(s[o]);break;case 101:this.$={type:"Limit",value:[s[o]]};break;case 102:this.$={type:"Limit",value:[s[o-2],s[o]]};break;case 103:this.$={type:"Limit",value:[s[o],s[o-2]],offsetMode:!0};break;case 110:this.$=s[o-1]+" "+s[o];break;case 111:this.$=s[o-3]+" "+s[o-2]+" "+s[o-1]+" "+s[o];break;case 116:this.$={leftRight:null,outOpt:null};break;case 117:this.$={leftRight:s[o-1],outOpt:s[o]}}},table:[{3:1,4:2,8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:3,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,63:b,66:6,82:4},{1:[3]},{5:[1,35]},{5:[2,88],70:v,86:w,87:x,88:S},t(E,[2,80],{74:41,75:[1,42],76:[1,43],77:[1,44],78:[1,45],79:[1,46],80:[1,47],81:[1,48],83:[1,40]}),{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:49,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,63:b,66:6,82:4},t(O,[2,75]),t(O,[2,61],{62:50,41:C,43:F,52:k,53:T,54:M,55:I,56:_,57:N,58:A,59:D,60:L,61:j,63:R,67:P,69:P,72:P,73:P,71:[1,51]}),t(z,[2,44]),t($,[2,36]),t($,[2,37],{29:U}),t($,[2,38]),t($,[2,39]),{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:67,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,47:66,48:m,49:g,51:7,63:b,66:6,82:4},{22:[1,68]},{21:[1,70],28:69},t($,[2,43]),t($,[2,10]),t($,[2,11]),t($,[2,12]),t($,[2,13]),t($,[2,14]),t([5,24,25,29,33,34,36,39,41,43,50,52,53,54,55,56,57,58,59,60,61,63,65,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],G,{22:[1,71]}),{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:72,43:f,44:d,45:p,46:y,48:m,49:g},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:73,43:f,44:d,45:p,46:y,48:m,49:g},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:74,43:f,44:d,45:p,46:y,48:m,49:g},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:75,43:f,44:d,45:p,46:y,48:m,49:g},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:76,43:f,44:d,45:p,46:y,48:m,49:g},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:78,28:10,31:77,33:[2,24],37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,63:b,66:6,82:4},t($,[2,4]),t($,[2,5]),t($,[2,6]),t($,[2,7]),t($,[2,8]),t($,[2,9]),{1:[2,1]},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:79,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,63:b,66:6,82:4},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:80,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,63:b,66:6,82:4},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:81,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,63:b,66:6,82:4},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:82,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,63:b,66:6,82:4},{17:P,62:83,63:R},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,66:84},t(B,[2,68]),t(B,[2,69]),t(B,[2,70]),t(B,[2,71]),t(B,[2,72]),t(B,[2,73]),t(B,[2,74]),t(E,[2,81]),{67:[1,85],69:[1,86],72:[1,87],73:[1,88]},{72:[1,89]},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:90},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:91},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:92},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:93},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:94},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:95},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:96},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:97},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:98},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:99},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:100},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:101},t([17,67,69,72,73],[2,58]),{21:[1,102]},{24:[1,103],25:W},t(q,[2,86],{70:v,86:w,87:x,88:S}),{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:67,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,47:105,48:m,49:g,51:7,63:b,66:6,82:4},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:106,28:10,29:U,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,63:b,66:6,82:4},t([9,11,12,14,15,17,19,21,22,29,38,41,43,44,45,46,48,49,63],G),t(q,V,{82:4,66:6,51:7,42:8,18:9,28:10,20:11,40:12,37:16,8:17,10:18,13:19,16:20,23:107,26:108,27:109,9:e,11:n,12:r,14:i,15:s,17:o,19:a,21:u,22:c,38:l,41:h,43:f,44:d,45:p,46:y,48:m,49:g,63:b}),t($,[2,31]),t($,[2,32]),t($,[2,33]),t($,[2,34]),t($,[2,35]),{32:110,33:[1,111]},{33:[2,25],70:v,86:w,87:x,88:S},t(E,[2,82]),t(Y,[2,83],{70:v,86:w}),t(Y,[2,84],{70:v,86:w}),t(E,[2,85]),{17:[1,112]},t(O,[2,77]),{22:[1,113]},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:114},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:115,43:f,44:d,45:p,46:y,48:m,49:g},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:116},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:117},t([5,24,25,33,34,36,39,50,52,63,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],[2,45],{41:C,43:F,53:T,54:M,55:I,56:_,57:N,58:A,59:D,60:L,61:j}),t([5,24,25,33,34,36,39,50,52,53,61,63,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],[2,46],{41:C,43:F,54:M,55:I,56:_,57:N,58:A,59:D,60:L}),t(Z,[2,47],{41:C,43:F,56:_,57:N,58:A,59:D,60:L}),t(Z,[2,48],{41:C,43:F,56:_,57:N,58:A,59:D,60:L}),t(J,[2,49],{56:_,57:N,58:A,59:D,60:L}),t(J,[2,50],{56:_,57:N,58:A,59:D,60:L}),t(z,[2,51]),t(z,[2,52]),t(z,[2,53]),t(z,[2,54]),t(z,[2,55]),t([5,24,25,33,34,36,39,50,52,61,63,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],[2,56],{41:C,43:F,53:T,54:M,55:I,56:_,57:N,58:A,59:D,60:L}),t([5,9,11,12,14,15,17,19,21,22,24,25,29,33,34,36,38,39,41,43,44,45,46,48,49,50,52,53,54,55,56,57,58,59,60,61,63,65,67,69,70,71,72,73,75,76,77,78,79,80,81,83,86,87,88],[2,21]),t($,[2,40]),{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:118,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,63:b,66:6,82:4},{24:[1,119],25:W},{50:[1,120],70:v,86:w,87:x,88:S},{24:[1,121],25:[1,122]},t(q,[2,17]),t(q,[2,19],{70:v,86:w,87:x,88:S}),{33:[1,124],35:123,36:[1,125],39:[2,28]},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:126,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,63:b,66:6,82:4},t(O,[2,76]),{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:67,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,47:128,48:m,49:g,51:7,63:b,66:6,68:[1,127],82:4},{41:C,43:F,52:k,53:T,54:M,55:I,56:_,57:N,58:A,59:D,60:L,61:j,70:[1,129]},t(O,[2,59],{64:130,65:[1,131]}),t(O,[2,67],{41:C,43:F,52:k,53:T,54:M,55:I,56:_,57:N,58:A,59:D,60:L,61:j}),t(O,[2,65],{41:C,43:F,52:k,53:T,54:M,55:I,56:_,57:N,58:A,59:D,60:L,61:j}),t(q,[2,87],{70:v,86:w,87:x,88:S}),t($,[2,41]),t($,[2,42]),t($,[2,15]),t(q,V,{82:4,66:6,51:7,42:8,18:9,28:10,20:11,40:12,37:16,8:17,10:18,13:19,16:20,27:109,26:132,9:e,11:n,12:r,14:i,15:s,17:o,19:a,21:u,22:c,38:l,41:h,43:f,44:d,45:p,46:y,48:m,49:g,63:b}),{39:[1,133]},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:134,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,63:b,66:6,82:4},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:135,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,63:b,66:6,82:4},{34:[1,136],70:v,86:w,87:x,88:S},{24:[1,137]},{24:[1,138],25:W},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,66:139},t(O,[2,66]),{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,28:10,37:16,38:l,40:12,41:h,42:140,43:f,44:d,45:p,46:y,48:m,49:g},t(q,[2,16]),t($,[2,30]),{34:[1,141],70:v,86:w,87:x,88:S},{39:[2,29],70:v,86:w,87:x,88:S},{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:142,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,63:b,66:6,82:4},t(O,[2,62]),t(O,[2,63]),t(O,[2,64]),t(O,[2,60]),{8:17,9:e,10:18,11:n,12:r,13:19,14:i,15:s,16:20,17:o,18:9,19:a,20:11,21:u,22:c,27:143,28:10,37:16,38:l,40:12,41:h,42:8,43:f,44:d,45:p,46:y,48:m,49:g,51:7,63:b,66:6,82:4},t(H,[2,26],{70:v,86:w,87:x,88:S}),t(H,[2,27],{70:v,86:w,87:x,88:S})],defaultActions:{35:[2,1]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=[0],n=[null],r=[],i=this.table,s="",o=0,a=0,u=r.slice.call(arguments,1),c=Object.create(this.lexer),l={yy:{}};for(var h in this.yy)Object.prototype.hasOwnProperty.call(this.yy,h)&&(l.yy[h]=this.yy[h]);c.setInput(t,l.yy),l.yy.lexer=c,l.yy.parser=this,void 0===c.yylloc&&(c.yylloc={});var f=c.yylloc;r.push(f);var d=c.options&&c.options.ranges;this.parseError="function"==typeof l.yy.parseError?l.yy.parseError:Object.getPrototypeOf(this).parseError;for(var p,y,m,g,b,v,w,x,S={};;){if(this.defaultActions[y=e[e.length-1]]?m=this.defaultActions[y]:(null==p&&(x=void 0,"number"!=typeof(x=c.lex()||1)&&(x=this.symbols_[x]||x),p=x),m=i[y]&&i[y][p]),void 0===m||!m.length||!m[0]){var E;for(b in w=[],i[y])this.terminals_[b]&&b>2&&w.push("'"+this.terminals_[b]+"'");E=c.showPosition?"Parse error on line "+(o+1)+":\n"+c.showPosition()+"\nExpecting "+w.join(", ")+", got '"+(this.terminals_[p]||p)+"'":"Parse error on line "+(o+1)+": Unexpected "+(1==p?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(E,{text:c.match,token:this.terminals_[p]||p,line:c.yylineno,loc:f,expected:w})}if(m[0]instanceof Array&&m.length>1)throw new Error("Parse Error: multiple actions possible at state: "+y+", token: "+p);switch(m[0]){case 1:e.push(p),n.push(c.yytext),r.push(c.yylloc),e.push(m[1]),p=null,a=c.yyleng,s=c.yytext,o=c.yylineno,f=c.yylloc;break;case 2:if(S.$=n[n.length-(v=this.productions_[m[1]][1])],S._$={first_line:r[r.length-(v||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(v||1)].first_column,last_column:r[r.length-1].last_column},d&&(S._$.range=[r[r.length-(v||1)].range[0],r[r.length-1].range[1]]),void 0!==(g=this.performAction.apply(S,[s,a,o,l.yy,m[1],n,r].concat(u))))return g;v&&(e=e.slice(0,-1*v*2),n=n.slice(0,-1*v),r=r.slice(0,-1*v)),e.push(this.productions_[m[1]][0]),n.push(S.$),r.push(S._$),e.push(i[e[e.length-2]][e[e.length-1]]);break;case 3:return!0}}return!0}},X=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var s in i)this[s]=i[s];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),s=0;s<i.length;s++)if((n=this._input.match(this.rules[i[s]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=s,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[s])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(t,e,n){switch(n){case 0:case 1:case 2:case 3:break;case 4:case 5:case 124:case 128:return 21;case 6:return 14;case 7:return 15;case 8:case 66:return 17;case 9:return 38;case 10:return 33;case 11:return 34;case 12:return 36;case 13:return 39;case 14:return 58;case 15:return 59;case 16:case 61:return 63;case 17:return 69;case 18:case 72:return 67;case 19:return 71;case 20:case 64:return 72;case 21:return 65;case 22:return 73;case 23:case 65:return 83;case 24:return 85;case 25:case 62:return 70;case 26:case 63:return 88;case 27:return"XOR";case 28:return"FROM";case 29:return"PARTITION";case 30:return"USE";case 31:return"INDEX";case 32:return"KEY";case 33:return 110;case 34:return"JOIN";case 35:return 96;case 36:return"GROUP_BY";case 37:return"IGNORE";case 38:return"FORCE";case 39:return"CROSS";case 40:return"ON";case 41:return"USING";case 42:return 116;case 43:return 117;case 44:return 119;case 45:return"NATURAL";case 46:return"WHERE";case 47:return 100;case 48:return 101;case 49:return 92;case 50:return 93;case 51:return"HAVING";case 52:return 104;case 53:return 108;case 54:return 111;case 55:return 112;case 56:return 113;case 57:return 114;case 58:return"OJ";case 59:return 103;case 60:return"UNION";case 67:return"EXISTS";case 68:return"DOES-NOT-EXIST";case 69:return"DURING";case 70:return"AFTER";case 71:return"BEFORE";case 73:return"INCLUDE";case 74:return"EXCLUDE";case 75:return"EQUALS";case 76:return"DISJOINT";case 77:return"INTERSECTS";case 78:return"TOUCHES";case 79:return"CROSSES";case 80:return"WITHIN";case 81:return"CONTAINS";case 82:return"OVERLAPS";case 83:return"RELATE";case 84:return"DWITHIN";case 85:return"BEYOND";case 86:return"POINT";case 87:return"LINESTRING";case 88:return"POLYGON";case 89:return"MULTIPOINT";case 90:return"MULTILINESTRING";case 91:return"MULTIPOLYGON";case 92:return"GEOMETRYCOLLECTION";case 93:return 25;case 94:return 75;case 95:return 22;case 96:return 24;case 97:return 44;case 98:return 81;case 99:return 45;case 100:return 52;case 101:return 53;case 102:return 41;case 103:return 43;case 104:return 56;case 105:return 57;case 106:return 60;case 107:return 61;case 108:return 55;case 109:return 76;case 110:return 77;case 111:return 54;case 112:return"<=>";case 113:return 78;case 114:return 80;case 115:return 79;case 116:return 49;case 117:return 50;case 118:return 7;case 119:case 120:case 126:case 127:return 9;case 121:return"HEX_NUMERIC";case 122:return 11;case 123:return 12;case 125:return 29;case 129:return 5;case 130:return"INVALID"}},rules:[/^(?:[/][*](.|\n)*?[*][/])/i,/^(?:[-][-]\s.*\n)/i,/^(?:[#]\s.*\n)/i,/^(?:\s+)/i,/^(?:[\w]+[\u4e00-\u9fa5]+[0-9a-zA-Z_\u4e00-\u9fa5]*)/i,/^(?:[\u4e00-\u9fa5][0-9a-zA-Z_\u4e00-\u9fa5]*)/i,/^(?:TRUE\b)/i,/^(?:FALSE\b)/i,/^(?:NULL\b)/i,/^(?:CASE\b)/i,/^(?:WHEN\b)/i,/^(?:THEN\b)/i,/^(?:ELSE\b)/i,/^(?:END\b)/i,/^(?:DIV\b)/i,/^(?:MOD\b)/i,/^(?:NOT\b)/i,/^(?:BETWEEN\b)/i,/^(?:IN\b)/i,/^(?:SOUNDS\b)/i,/^(?:LIKE\b)/i,/^(?:ESCAPE\b)/i,/^(?:REGEXP\b)/i,/^(?:IS\b)/i,/^(?:UNKNOWN\b)/i,/^(?:AND\b)/i,/^(?:OR\b)/i,/^(?:XOR\b)/i,/^(?:FROM\b)/i,/^(?:PARTITION\b)/i,/^(?:USE\b)/i,/^(?:INDEX\b)/i,/^(?:KEY\b)/i,/^(?:FOR\b)/i,/^(?:JOIN\b)/i,/^(?:ORDER\s+BY\b)/i,/^(?:GROUP\s+BY\b)/i,/^(?:IGNORE\b)/i,/^(?:FORCE\b)/i,/^(?:CROSS\b)/i,/^(?:ON\b)/i,/^(?:USING\b)/i,/^(?:LEFT\b)/i,/^(?:RIGHT\b)/i,/^(?:OUTER\b)/i,/^(?:NATURAL\b)/i,/^(?:WHERE\b)/i,/^(?:ASC\b)/i,/^(?:DESC\b)/i,/^(?:WITH\b)/i,/^(?:ROLLUP\b)/i,/^(?:HAVING\b)/i,/^(?:OFFSET\b)/i,/^(?:PROCEDURE\b)/i,/^(?:UPDATE\b)/i,/^(?:LOCK\b)/i,/^(?:SHARE\b)/i,/^(?:MODE\b)/i,/^(?:OJ\b)/i,/^(?:LIMIT\b)/i,/^(?:UNION\b)/i,/^(?:NOT\b)/i,/^(?:AND\b)/i,/^(?:OR\b)/i,/^(?:LIKE\b)/i,/^(?:IS\b)/i,/^(?:NULL\b)/i,/^(?:EXISTS\b)/i,/^(?:DOESNOTEXIST\b)/i,/^(?:DURING\b)/i,/^(?:AFTER\b)/i,/^(?:BEFORE\b)/i,/^(?:IN\b)/i,/^(?:INCLUDE\b)/i,/^(?:EXCLUDE\b)/i,/^(?:EQUALS\b)/i,/^(?:DISJOINT\b)/i,/^(?:INTERSECTS\b)/i,/^(?:TOUCHES\b)/i,/^(?:CROSSES\b)/i,/^(?:WITHIN\b)/i,/^(?:CONTAINS\b)/i,/^(?:OVERLAPS\b)/i,/^(?:RELATE\b)/i,/^(?:DWITHIN\b)/i,/^(?:BEYOND\b)/i,/^(?:POINT\b)/i,/^(?:LINESTRING\b)/i,/^(?:POLYGON\b)/i,/^(?:MULTIPOINT\b)/i,/^(?:MULTILINESTRING\b)/i,/^(?:MULTIPOLYGON\b)/i,/^(?:GEOMETRYCOLLECTION\b)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\()/i,/^(?:\))/i,/^(?:~)/i,/^(?:!=)/i,/^(?:!)/i,/^(?:\|)/i,/^(?:&)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:\*)/i,/^(?:\/)/i,/^(?:%)/i,/^(?:\^)/i,/^(?:>>)/i,/^(?:>=)/i,/^(?:>)/i,/^(?:<<)/i,/^(?:<=>)/i,/^(?:<=)/i,/^(?:<>)/i,/^(?:<)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:;)/i,/^(?:['](\\.|[^'])*['])/i,/^(?:["](\\.|[^"])*["])/i,/^(?:[0][x][0-9a-fA-F]+)/i,/^(?:[-]?[0-9]+(\.[0-9]+)?)/i,/^(?:[-]?[0-9]+(\.[0-9]+)?[eE][-][0-9]+(\.[0-9]+)?)/i,/^(?:[a-zA-Z_\u4e00-\u9fa5][a-zA-Z0-9_\u4e00-\u9fa5]*)/i,/^(?:\.)/i,/^(?:["]([a-zA-Z_\u4e00-\u9fa5][a-zA-Z0-9_\u4e00-\u9fa5]*)["])/i,/^(?:[']([a-zA-Z_\u4e00-\u9fa5][a-zA-Z0-9_\u4e00-\u9fa5]*)['])/i,/^(?:([`])(?:(?=(\\?))\2.)*?\1)/i,/^(?:$)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130],inclusive:!0}}};return t}();function Q(){this.yy={}}return K.lexer=X,Q.prototype=K,K.Parser=Q,new Q}());class gn{tokens=["PROPERTY","COMPARISON","VALUE","LOGICAL"];operatorsMap={"=":"==","<>":"!=","<":"<","<=":"<=",">":">",">=":">=",LIKE:"*=",BETWEEN:"<=x<="};operatorReverseMap={};combinationOperatorsMap={AND:"&&",OR:"||"};combinationOperatorsReverseMap={};precedence={RPAREN:3,LOGICAL:2,COMPARISON:1};constructor(){const{combinationOperatorsMap:t,combinationOperatorsReverseMap:e,operatorsMap:n,operatorReverseMap:r}=this;Object.keys(n).forEach((t=>{r[n[t]]=t})),Object.keys(t).forEach((n=>{e[t[n]]=n})),this.read=this.read.bind(this),this.write=this.write.bind(this)}read(t){try{return("undefined"!=typeof window?window:global).cqlParser.parse(t)}catch(t){return}}write(t,e){const{operatorReverseMap:n,combinationOperatorsReverseMap:r,write:i}=this;if(t&&nn(t)){if("pi"===t.name||"random"===t.name)return t.name;{const e=t.args.map((t=>this.write(t))).join(", ");return`${t.name}(${e})`}}if(Array.isArray(t)){if(t.length<2)return;if(!(qe(s=t[0])||Ve(s)||Ye(s)))throw new Error(`Can't encode: ${t}`)}var s;if(Ze(t)){const s=t,o=s[0],a=n[o];switch(o){case"!":return`NOT ( ${i(s[1])} )`;case"&&":case"||":let t="";const n=r[o];return t+=s.slice(1).map((t=>i(t,!0))).join(` ${n} `),e?`(${t})`:t;case"==":case"*=":case"!=":case"<":case"<=":case">":case">=":const u=(t=>"string"==typeof t)(s[2]);let c=s[2];return u&&(c=`'${c}'`),`${s[1]} ${a} ${c}`;case"<=x<=":return`${s[1]} ${a} ${this.write(s[2])} AND ${this.write(s[3])}`}}return t}}var bn,vn,wn={exports:{}};function xn(){return vn?bn:(vn=1,bn={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]})}var Sn,En,On,Cn,Fn,kn,Tn,Mn,In,_n,Nn,An,Dn={exports:{}};function Ln(){return En?Sn:(En=1,Sn=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))})}function jn(){if(Cn)return wn.exports;Cn=1;var t=xn(),e=function(){if(On)return Dn.exports;On=1;var t=Ln(),e=Array.prototype.concat,n=Array.prototype.slice,r=Dn.exports=function(r){for(var i=[],s=0,o=r.length;s<o;s++){var a=r[s];t(a)?i=e.call(i,n.call(a)):i.push(a)}return i};return r.wrap=function(t){return function(){return t(r(arguments))}},Dn.exports}(),n=Object.hasOwnProperty,r=Object.create(null);for(var i in t)n.call(t,i)&&(r[t[i]]=i);var s=wn.exports={to:{},get:{}};function o(t,e,n){return Math.min(Math.max(e,t),n)}function a(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}return s.get=function(t){var e,n;switch(t.substring(0,3).toLowerCase()){case"hsl":e=s.get.hsl(t),n="hsl";break;case"hwb":e=s.get.hwb(t),n="hwb";break;default:e=s.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},s.get.rgb=function(e){if(!e)return null;var r,i,s,a=[0,0,0,1];if(r=e.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=r[2],r=r[1],i=0;i<3;i++){var u=2*i;a[i]=parseInt(r.slice(u,u+2),16)}s&&(a[3]=parseInt(s,16)/255)}else if(r=e.match(/^#([a-f0-9]{3,4})$/i)){for(s=(r=r[1])[3],i=0;i<3;i++)a[i]=parseInt(r[i]+r[i],16);s&&(a[3]=parseInt(s+s,16)/255)}else if(r=e.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(i=0;i<3;i++)a[i]=parseInt(r[i+1],0);r[4]&&(a[3]=r[5]?.01*parseFloat(r[4]):parseFloat(r[4]))}else{if(!(r=e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(r=e.match(/^(\w+)$/))?"transparent"===r[1]?[0,0,0,0]:n.call(t,r[1])?((a=t[r[1]])[3]=1,a):null:null;for(i=0;i<3;i++)a[i]=Math.round(2.55*parseFloat(r[i+1]));r[4]&&(a[3]=r[5]?.01*parseFloat(r[4]):parseFloat(r[4]))}for(i=0;i<3;i++)a[i]=o(a[i],0,255);return a[3]=o(a[3],0,1),a},s.get.hsl=function(t){if(!t)return null;var e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,o(parseFloat(e[2]),0,100),o(parseFloat(e[3]),0,100),o(isNaN(n)?1:n,0,1)]}return null},s.get.hwb=function(t){if(!t)return null;var e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,o(parseFloat(e[2]),0,100),o(parseFloat(e[3]),0,100),o(isNaN(n)?1:n,0,1)]}return null},s.to.hex=function(){var t=e(arguments);return"#"+a(t[0])+a(t[1])+a(t[2])+(t[3]<1?a(Math.round(255*t[3])):"")},s.to.rgb=function(){var t=e(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},s.to.rgb.percent=function(){var t=e(arguments),n=Math.round(t[0]/255*100),r=Math.round(t[1]/255*100),i=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+n+"%, "+r+"%, "+i+"%)":"rgba("+n+"%, "+r+"%, "+i+"%, "+t[3]+")"},s.to.hsl=function(){var t=e(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},s.to.hwb=function(){var t=e(arguments),n="";return t.length>=4&&1!==t[3]&&(n=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+n+")"},s.to.keyword=function(t){return r[t.slice(0,3)]},wn.exports}function Rn(){if(kn)return Fn;kn=1;const t=xn(),e={};for(const n of Object.keys(t))e[t[n]]=n;const n={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Fn=n;for(const t of Object.keys(n)){if(!("channels"in n[t]))throw new Error("missing channels property: "+t);if(!("labels"in n[t]))throw new Error("missing channel labels property: "+t);if(n[t].labels.length!==n[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:e,labels:r}=n[t];delete n[t].channels,delete n[t].labels,Object.defineProperty(n[t],"channels",{value:e}),Object.defineProperty(n[t],"labels",{value:r})}function r(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}return n.rgb.hsl=function(t){const e=t[0]/255,n=t[1]/255,r=t[2]/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=s-i;let a,u;s===i?a=0:e===s?a=(n-r)/o:n===s?a=2+(r-e)/o:r===s&&(a=4+(e-n)/o),a=Math.min(60*a,360),a<0&&(a+=360);const c=(i+s)/2;return u=s===i?0:c<=.5?o/(s+i):o/(2-s-i),[a,100*u,100*c]},n.rgb.hsv=function(t){let e,n,r,i,s;const o=t[0]/255,a=t[1]/255,u=t[2]/255,c=Math.max(o,a,u),l=c-Math.min(o,a,u),h=function(t){return(c-t)/6/l+.5};return 0===l?(i=0,s=0):(s=l/c,e=h(o),n=h(a),r=h(u),o===c?i=r-n:a===c?i=1/3+e-r:u===c&&(i=2/3+n-e),i<0?i+=1:i>1&&(i-=1)),[360*i,100*s,100*c]},n.rgb.hwb=function(t){const e=t[0],r=t[1];let i=t[2];const s=n.rgb.hsl(t)[0],o=1/255*Math.min(e,Math.min(r,i));return i=1-1/255*Math.max(e,Math.max(r,i)),[s,100*o,100*i]},n.rgb.cmyk=function(t){const e=t[0]/255,n=t[1]/255,r=t[2]/255,i=Math.min(1-e,1-n,1-r);return[100*((1-e-i)/(1-i)||0),100*((1-n-i)/(1-i)||0),100*((1-r-i)/(1-i)||0),100*i]},n.rgb.keyword=function(n){const i=e[n];if(i)return i;let s,o=1/0;for(const e of Object.keys(t)){const i=r(n,t[e]);i<o&&(o=i,s=e)}return s},n.keyword.rgb=function(e){return t[e]},n.rgb.xyz=function(t){let e=t[0]/255,n=t[1]/255,r=t[2]/255;return e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,[100*(.4124*e+.3576*n+.1805*r),100*(.2126*e+.7152*n+.0722*r),100*(.0193*e+.1192*n+.9505*r)]},n.rgb.lab=function(t){const e=n.rgb.xyz(t);let r=e[0],i=e[1],s=e[2];return r/=95.047,i/=100,s/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,[116*i-16,500*(r-i),200*(i-s)]},n.hsl.rgb=function(t){const e=t[0]/360,n=t[1]/100,r=t[2]/100;let i,s,o;if(0===n)return o=255*r,[o,o,o];i=r<.5?r*(1+n):r+n-r*n;const a=2*r-i,u=[0,0,0];for(let t=0;t<3;t++)s=e+1/3*-(t-1),s<0&&s++,s>1&&s--,o=6*s<1?a+6*(i-a)*s:2*s<1?i:3*s<2?a+(i-a)*(2/3-s)*6:a,u[t]=255*o;return u},n.hsl.hsv=function(t){const e=t[0];let n=t[1]/100,r=t[2]/100,i=n;const s=Math.max(r,.01);return r*=2,n*=r<=1?r:2-r,i*=s<=1?s:2-s,[e,100*(0===r?2*i/(s+i):2*n/(r+n)),(r+n)/2*100]},n.hsv.rgb=function(t){const e=t[0]/60,n=t[1]/100;let r=t[2]/100;const i=Math.floor(e)%6,s=e-Math.floor(e),o=255*r*(1-n),a=255*r*(1-n*s),u=255*r*(1-n*(1-s));switch(r*=255,i){case 0:return[r,u,o];case 1:return[a,r,o];case 2:return[o,r,u];case 3:return[o,a,r];case 4:return[u,o,r];case 5:return[r,o,a]}},n.hsv.hsl=function(t){const e=t[0],n=t[1]/100,r=t[2]/100,i=Math.max(r,.01);let s,o;o=(2-n)*r;const a=(2-n)*i;return s=n*i,s/=a<=1?a:2-a,s=s||0,o/=2,[e,100*s,100*o]},n.hwb.rgb=function(t){const e=t[0]/360;let n=t[1]/100,r=t[2]/100;const i=n+r;let s;i>1&&(n/=i,r/=i);const o=Math.floor(6*e),a=1-r;s=6*e-o,1&o&&(s=1-s);const u=n+s*(a-n);let c,l,h;switch(o){default:case 6:case 0:c=a,l=u,h=n;break;case 1:c=u,l=a,h=n;break;case 2:c=n,l=a,h=u;break;case 3:c=n,l=u,h=a;break;case 4:c=u,l=n,h=a;break;case 5:c=a,l=n,h=u}return[255*c,255*l,255*h]},n.cmyk.rgb=function(t){const e=t[1]/100,n=t[2]/100,r=t[3]/100;return[255*(1-Math.min(1,t[0]/100*(1-r)+r)),255*(1-Math.min(1,e*(1-r)+r)),255*(1-Math.min(1,n*(1-r)+r))]},n.xyz.rgb=function(t){const e=t[0]/100,n=t[1]/100,r=t[2]/100;let i,s,o;return i=3.2406*e+-1.5372*n+-.4986*r,s=-.9689*e+1.8758*n+.0415*r,o=.0557*e+-.204*n+1.057*r,i=i>.0031308?1.055*i**(1/2.4)-.055:12.92*i,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),[255*i,255*s,255*o]},n.xyz.lab=function(t){let e=t[0],n=t[1],r=t[2];return e/=95.047,n/=100,r/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,[116*n-16,500*(e-n),200*(n-r)]},n.lab.xyz=function(t){let e,n,r;n=(t[0]+16)/116,e=t[1]/500+n,r=n-t[2]/200;const i=n**3,s=e**3,o=r**3;return n=i>.008856?i:(n-16/116)/7.787,e=s>.008856?s:(e-16/116)/7.787,r=o>.008856?o:(r-16/116)/7.787,e*=95.047,n*=100,r*=108.883,[e,n,r]},n.lab.lch=function(t){const e=t[0],n=t[1],r=t[2];let i;return i=360*Math.atan2(r,n)/2/Math.PI,i<0&&(i+=360),[e,Math.sqrt(n*n+r*r),i]},n.lch.lab=function(t){const e=t[1],n=t[2]/360*2*Math.PI;return[t[0],e*Math.cos(n),e*Math.sin(n)]},n.rgb.ansi16=function(t,e=null){const[r,i,s]=t;let o=null===e?n.rgb.hsv(t)[2]:e;if(o=Math.round(o/50),0===o)return 30;let a=30+(Math.round(s/255)<<2|Math.round(i/255)<<1|Math.round(r/255));return 2===o&&(a+=60),a},n.hsv.ansi16=function(t){return n.rgb.ansi16(n.hsv.rgb(t),t[2])},n.rgb.ansi256=function(t){const e=t[0],n=t[1],r=t[2];return e===n&&n===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},n.ansi16.rgb=function(t){let e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},n.ansi256.rgb=function(t){if(t>=232){const e=10*(t-232)+8;return[e,e,e]}let e;return t-=16,[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},n.rgb.hex=function(t){const e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},n.hex.rgb=function(t){const e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let n=e[0];3===e[0].length&&(n=n.split("").map((t=>t+t)).join(""));const r=parseInt(n,16);return[r>>16&255,r>>8&255,255&r]},n.rgb.hcg=function(t){const e=t[0]/255,n=t[1]/255,r=t[2]/255,i=Math.max(Math.max(e,n),r),s=Math.min(Math.min(e,n),r),o=i-s;let a,u;return a=o<1?s/(1-o):0,u=o<=0?0:i===e?(n-r)/o%6:i===n?2+(r-e)/o:4+(e-n)/o,u/=6,u%=1,[360*u,100*o,100*a]},n.hsl.hcg=function(t){const e=t[1]/100,n=t[2]/100,r=n<.5?2*e*n:2*e*(1-n);let i=0;return r<1&&(i=(n-.5*r)/(1-r)),[t[0],100*r,100*i]},n.hsv.hcg=function(t){const e=t[2]/100,n=t[1]/100*e;let r=0;return n<1&&(r=(e-n)/(1-n)),[t[0],100*n,100*r]},n.hcg.rgb=function(t){const e=t[1]/100,n=t[2]/100;if(0===e)return[255*n,255*n,255*n];const r=[0,0,0],i=t[0]/360%1*6,s=i%1,o=1-s;let a=0;switch(Math.floor(i)){case 0:r[0]=1,r[1]=s,r[2]=0;break;case 1:r[0]=o,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=s;break;case 3:r[0]=0,r[1]=o,r[2]=1;break;case 4:r[0]=s,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=o}return a=(1-e)*n,[255*(e*r[0]+a),255*(e*r[1]+a),255*(e*r[2]+a)]},n.hcg.hsv=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);let r=0;return n>0&&(r=e/n),[t[0],100*r,100*n]},n.hcg.hsl=function(t){const e=t[1]/100,n=t[2]/100*(1-e)+.5*e;let r=0;return n>0&&n<.5?r=e/(2*n):n>=.5&&n<1&&(r=e/(2*(1-n))),[t[0],100*r,100*n]},n.hcg.hwb=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);return[t[0],100*(n-e),100*(1-n)]},n.hwb.hcg=function(t){const e=1-t[2]/100,n=e-t[1]/100;let r=0;return n<1&&(r=(e-n)/(1-n)),[t[0],100*n,100*r]},n.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},n.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},n.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},n.gray.hsl=function(t){return[0,0,t[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(t){return[0,100,t[0]]},n.gray.cmyk=function(t){return[0,0,0,t[0]]},n.gray.lab=function(t){return[t[0],0,0]},n.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n},n.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]},Fn}function Pn(){if(Mn)return Tn;Mn=1;const t=Rn();function e(t,e){return function(n){return e(t(n))}}function n(n,r){const i=[r[n].parent,n];let s=t[r[n].parent][n],o=r[n].parent;for(;r[o].parent;)i.unshift(r[o].parent),s=e(t[r[o].parent][o],s),o=r[o].parent;return s.conversion=i,s}return Tn=function(e){const r=function(e){const n=function(){const e={},n=Object.keys(t);for(let t=n.length,r=0;r<t;r++)e[n[r]]={distance:-1,parent:null};return e}(),r=[e];for(n[e].distance=0;r.length;){const e=r.pop(),i=Object.keys(t[e]);for(let t=i.length,s=0;s<t;s++){const t=i[s],o=n[t];-1===o.distance&&(o.distance=n[e].distance+1,o.parent=e,r.unshift(t))}}return n}(e),i={},s=Object.keys(r);for(let t=s.length,e=0;e<t;e++){const t=s[e];null!==r[t].parent&&(i[t]=n(t,r))}return i},Tn}function zn(){if(An)return Nn;An=1;const t=jn(),e=function(){if(_n)return In;_n=1;const t=Rn(),e=Pn(),n={};return Object.keys(t).forEach((r=>{n[r]={},Object.defineProperty(n[r],"channels",{value:t[r].channels}),Object.defineProperty(n[r],"labels",{value:t[r].labels});const i=e(r);Object.keys(i).forEach((t=>{const e=i[t];n[r][t]=function(t){const e=function(...e){const n=e[0];if(null==n)return n;n.length>1&&(e=n);const r=t(e);if("object"==typeof r)for(let t=r.length,e=0;e<t;e++)r[e]=Math.round(r[e]);return r};return"conversion"in t&&(e.conversion=t.conversion),e}(e),n[r][t].raw=function(t){const e=function(...e){const n=e[0];return null==n?n:(n.length>1&&(e=n),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(e)}))})),In=n}(),n=["keyword","gray","hex"],r={};for(const t of Object.keys(e))r[[...e[t].labels].sort().join("")]=t;const i={};function s(o,a){if(!(this instanceof s))return new s(o,a);if(a&&a in n&&(a=null),a&&!(a in e))throw new Error("Unknown model: "+a);let u,l;if(null==o)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(o instanceof s)this.model=o.model,this.color=[...o.color],this.valpha=o.valpha;else if("string"==typeof o){const n=t.get(o);if(null===n)throw new Error("Unable to parse color from string: "+o);this.model=n.model,l=e[this.model].channels,this.color=n.value.slice(0,l),this.valpha="number"==typeof n.value[l]?n.value[l]:1}else if(o.length>0){this.model=a||"rgb",l=e[this.model].channels;const t=Array.prototype.slice.call(o,0,l);this.color=c(t,l),this.valpha="number"==typeof o[l]?o[l]:1}else if("number"==typeof o)this.model="rgb",this.color=[o>>16&255,o>>8&255,255&o],this.valpha=1;else{this.valpha=1;const t=Object.keys(o);"alpha"in o&&(t.splice(t.indexOf("alpha"),1),this.valpha="number"==typeof o.alpha?o.alpha:0);const n=t.sort().join("");if(!(n in r))throw new Error("Unable to parse color from object: "+JSON.stringify(o));this.model=r[n];const{labels:i}=e[this.model],s=[];for(u=0;u<i.length;u++)s.push(o[i[u]]);this.color=c(s)}if(i[this.model])for(l=e[this.model].channels,u=0;u<l;u++){const t=i[this.model][u];t&&(this.color[u]=t(this.color[u]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}s.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let n=this.model in t.to?this:this.rgb();n=n.round("number"==typeof e?e:1);const r=1===n.valpha?n.color:[...n.color,this.valpha];return t.to[n.model](r)},percentString(e){const n=this.rgb().round("number"==typeof e?e:1),r=1===n.valpha?n.color:[...n.color,this.valpha];return t.to.rgb.percent(r)},array(){return 1===this.valpha?[...this.color]:[...this.color,this.valpha]},object(){const t={},{channels:n}=e[this.model],{labels:r}=e[this.model];for(let e=0;e<n;e++)t[r[e]]=this.color[e];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray(){const t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject(){const t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round(t){return t=Math.max(t||0,0),new s([...this.color.map(o(t)),this.valpha],this.model)},alpha(t){return void 0!==t?new s([...this.color,Math.max(0,Math.min(1,t))],this.model):this.valpha},red:a("rgb",0,u(255)),green:a("rgb",1,u(255)),blue:a("rgb",2,u(255)),hue:a(["hsl","hsv","hsl","hwb","hcg"],0,(t=>(t%360+360)%360)),saturationl:a("hsl",1,u(100)),lightness:a("hsl",2,u(100)),saturationv:a("hsv",1,u(100)),value:a("hsv",2,u(100)),chroma:a("hcg",1,u(100)),gray:a("hcg",2,u(100)),white:a("hwb",1,u(100)),wblack:a("hwb",2,u(100)),cyan:a("cmyk",0,u(100)),magenta:a("cmyk",1,u(100)),yellow:a("cmyk",2,u(100)),black:a("cmyk",3,u(100)),x:a("xyz",0,u(95.047)),y:a("xyz",1,u(100)),z:a("xyz",2,u(108.833)),l:a("lab",0,u(100)),a:a("lab",1),b:a("lab",2),keyword(t){return void 0!==t?new s(t):e[this.model].keyword(this.color)},hex(e){return void 0!==e?new s(e):t.to.hex(this.rgb().round().color)},hexa(e){if(void 0!==e)return new s(e);const n=this.rgb().round().color;let r=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===r.length&&(r="0"+r),t.to.hex(n)+r},rgbNumber(){const t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity(){const t=this.rgb().color,e=[];for(const[n,r]of t.entries()){const t=r/255;e[n]=t<=.04045?t/12.92:((t+.055)/1.055)**2.4}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast(t){const e=this.luminosity(),n=t.luminosity();return e>n?(e+.05)/(n+.05):(n+.05)/(e+.05)},level(t){const e=this.contrast(t);return e>=7?"AAA":e>=4.5?"AA":""},isDark(){const t=this.rgb().color;return(2126*t[0]+7152*t[1]+722*t[2])/1e4<128},isLight(){return!this.isDark()},negate(){const t=this.rgb();for(let e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten(t){const e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken(t){const e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate(t){const e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate(t){const e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten(t){const e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken(t){const e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale(){const t=this.rgb().color,e=.3*t[0]+.59*t[1]+.11*t[2];return s.rgb(e,e,e)},fade(t){return this.alpha(this.valpha-this.valpha*t)},opaquer(t){return this.alpha(this.valpha+this.valpha*t)},rotate(t){const e=this.hsl();let n=e.color[0];return n=(n+t)%360,n=n<0?360+n:n,e.color[0]=n,e},mix(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);const n=t.rgb(),r=this.rgb(),i=void 0===e?.5:e,o=2*i-1,a=n.alpha()-r.alpha(),u=((o*a==-1?o:(o+a)/(1+o*a))+1)/2,c=1-u;return s.rgb(u*n.red()+c*r.red(),u*n.green()+c*r.green(),u*n.blue()+c*r.blue(),n.alpha()*i+r.alpha()*(1-i))}};for(const t of Object.keys(e)){if(n.includes(t))continue;const{channels:r}=e[t];s.prototype[t]=function(...n){return this.model===t?new s(this):new s(n.length>0?n:[...(r=e[this.model][t].raw(this.color),Array.isArray(r)?r:[r]),this.valpha],t);var r},s[t]=function(...e){let n=e[0];return"number"==typeof n&&(n=c(e,r)),new s(n,t)}}function o(t){return function(e){return function(t,e){return Number(t.toFixed(e))}(e,t)}}function a(t,e,n){t=Array.isArray(t)?t:[t];for(const r of t)(i[r]||(i[r]=[]))[e]=n;return t=t[0],function(r){let i;return void 0!==r?(n&&(r=n(r)),i=this[t](),i.color[e]=r,i):(i=this[t]().color[e],n&&(i=n(i)),i)}}function u(t){return function(e){return Math.max(0,Math.min(t,e))}}function c(t,e){for(let n=0;n<e;n++)"number"!=typeof t[n]&&(t[n]=0);return t}return Nn=s}var $n,Un=c(zn()),Gn={},Bn={};function Wn(){return $n||($n=1,function(){Bn.defaults={.1:{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},.2:{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:"\n"},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}.call(Bn)),Bn}var qn,Vn={},Yn={},Zn={};function Jn(){return qn||(qn=1,function(){var t,e,n,r,i,s,o,a=[].slice,u={}.hasOwnProperty;t=function(){var t,e,n,r,s,o;if(o=arguments[0],s=2<=arguments.length?a.call(arguments,1):[],i(Object.assign))Object.assign.apply(null,arguments);else for(t=0,n=s.length;t<n;t++)if(null!=(r=s[t]))for(e in r)u.call(r,e)&&(o[e]=r[e]);return o},i=function(t){return!!t&&"[object Function]"===Object.prototype.toString.call(t)},s=function(t){var e;return!!t&&("function"==(e=typeof t)||"object"===e)},n=function(t){return i(Array.isArray)?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)},r=function(t){var e;if(n(t))return!t.length;for(e in t)if(u.call(t,e))return!1;return!0},o=function(t){var e,n;return s(t)&&(n=Object.getPrototypeOf(t))&&(e=n.constructor)&&"function"==typeof e&&e instanceof e&&Function.prototype.toString.call(e)===Function.prototype.toString.call(Object)},e=function(t){return i(t.valueOf)?t.valueOf():t},Zn.assign=t,Zn.isFunction=i,Zn.isObject=s,Zn.isArray=n,Zn.isEmpty=r,Zn.isPlainObject=o,Zn.getValue=e}.call(Zn)),Zn}var Hn,Kn={exports:{}},Xn=Kn.exports;function Qn(){return Hn||(Hn=1,function(){Kn.exports=function(){function t(){}return t.prototype.hasFeature=function(){return!0},t.prototype.createDocumentType=function(){throw new Error("This DOM method is not implemented.")},t.prototype.createDocument=function(){throw new Error("This DOM method is not implemented.")},t.prototype.createHTMLDocument=function(){throw new Error("This DOM method is not implemented.")},t.prototype.getFeature=function(){throw new Error("This DOM method is not implemented.")},t}()}.call(Xn)),Kn.exports}var tr,er={exports:{}},nr={exports:{}},rr={exports:{}},ir=rr.exports;function sr(){return tr||(tr=1,function(){rr.exports=function(){function t(){}return t.prototype.handleError=function(t){throw new Error(t)},t}()}.call(ir)),rr.exports}var or,ar={exports:{}},ur=ar.exports;function cr(){return or||(or=1,function(){ar.exports=function(){function t(t){this.arr=t||[]}return Object.defineProperty(t.prototype,"length",{get:function(){return this.arr.length}}),t.prototype.item=function(t){return this.arr[t]||null},t.prototype.contains=function(t){return-1!==this.arr.indexOf(t)},t}()}.call(ur)),ar.exports}var lr,hr=nr.exports;function fr(){return lr||(lr=1,function(){var t,e;t=sr(),e=cr(),nr.exports=function(){function n(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new t,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=Object.create(this.defaultParams)}return Object.defineProperty(n.prototype,"parameterNames",{get:function(){return new e(Object.keys(this.defaultParams))}}),n.prototype.getParameter=function(t){return this.params.hasOwnProperty(t)?this.params[t]:null},n.prototype.canSetParameter=function(){return!0},n.prototype.setParameter=function(t,e){return null!=e?this.params[t]=e:delete this.params[t]},n}()}.call(hr)),nr.exports}var dr,pr={exports:{}},yr={exports:{}},mr={exports:{}},gr=mr.exports;function br(){return dr||(dr=1,function(){mr.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}.call(gr)),mr.exports}var vr,wr={exports:{}},xr=wr.exports;function Sr(){return vr||(vr=1,function(){var t;t=br(),Pi(),wr.exports=function(){function e(e,n,r){if(this.parent=e,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),null==n)throw new Error("Missing attribute name. "+this.debugInfo(n));this.name=this.stringify.name(n),this.value=this.stringify.attValue(r),this.type=t.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(e.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(e.prototype,"textContent",{get:function(){return this.value},set:function(t){return this.value=t||""}}),Object.defineProperty(e.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(e.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(e.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(e.prototype,"specified",{get:function(){return!0}}),e.prototype.clone=function(){return Object.create(this)},e.prototype.toString=function(t){return this.options.writer.attribute(this,this.options.writer.filterOptions(t))},e.prototype.debugInfo=function(t){return null==(t=t||this.name)?"parent: <"+this.parent.name+">":"attribute: {"+t+"}, parent: <"+this.parent.name+">"},e.prototype.isEqualNode=function(t){return t.namespaceURI===this.namespaceURI&&t.prefix===this.prefix&&t.localName===this.localName&&t.value===this.value},e}()}.call(xr)),wr.exports}var Er,Or={exports:{}},Cr=Or.exports;function Fr(){return Er||(Er=1,function(){Or.exports=function(){function t(t){this.nodes=t}return Object.defineProperty(t.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),t.prototype.clone=function(){return this.nodes=null},t.prototype.getNamedItem=function(t){return this.nodes[t]},t.prototype.setNamedItem=function(t){var e;return e=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,e||null},t.prototype.removeNamedItem=function(t){var e;return e=this.nodes[t],delete this.nodes[t],e||null},t.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},t.prototype.getNamedItemNS=function(){throw new Error("This DOM method is not implemented.")},t.prototype.setNamedItemNS=function(){throw new Error("This DOM method is not implemented.")},t.prototype.removeNamedItemNS=function(){throw new Error("This DOM method is not implemented.")},t}()}.call(Cr)),Or.exports}var kr,Tr=yr.exports;function Mr(){return kr||(kr=1,function(){var t,e,n,r,i,s,o,a,u={}.hasOwnProperty;a=Jn(),o=a.isObject,s=a.isFunction,i=a.getValue,r=Pi(),t=br(),e=Sr(),n=Fr(),yr.exports=function(r){function a(e,n,r){var i,s,o,u;if(a.__super__.constructor.call(this,e),null==n)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(n),this.type=t.Element,this.attribs={},this.schemaTypeInfo=null,null!=r&&this.attribute(r),e.type===t.Document&&(this.isRoot=!0,this.documentObject=e,e.rootObject=this,e.children))for(s=0,o=(u=e.children).length;s<o;s++)if((i=u[s]).type===t.DocType){i.name=this.name;break}}return function(t,e){for(var n in e)u.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(a,r),Object.defineProperty(a.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(a.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(a.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(a.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(a.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(a.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(a.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(a.prototype,"attributes",{get:function(){return this.attributeMap&&this.attributeMap.nodes||(this.attributeMap=new n(this.attribs)),this.attributeMap}}),a.prototype.clone=function(){var t,e,n;for(t in(e=Object.create(this)).isRoot&&(e.documentObject=null),e.attribs={},n=this.attribs)u.call(n,t)&&(e.attribs[t]=n[t].clone());return e.children=[],this.children.forEach((function(t){var n;return(n=t.clone()).parent=e,e.children.push(n)})),e},a.prototype.attribute=function(t,n){var r;if(null!=t&&(t=i(t)),o(t))for(r in t)u.call(t,r)&&this.attribute(r,t[r]);else s(n)&&(n=n.apply()),this.options.keepNullAttributes&&null==n?this.attribs[t]=new e(this,t,""):null!=n&&(this.attribs[t]=new e(this,t,n));return this},a.prototype.removeAttribute=function(t){var e,n;if(null==t)throw new Error("Missing attribute name. "+this.debugInfo());if(t=i(t),Array.isArray(t))for(e=0,n=t.length;e<n;e++)delete this.attribs[t[e]];else delete this.attribs[t];return this},a.prototype.toString=function(t){return this.options.writer.element(this,this.options.writer.filterOptions(t))},a.prototype.att=function(t,e){return this.attribute(t,e)},a.prototype.a=function(t,e){return this.attribute(t,e)},a.prototype.getAttribute=function(t){return this.attribs.hasOwnProperty(t)?this.attribs[t].value:null},a.prototype.setAttribute=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.getAttributeNode=function(t){return this.attribs.hasOwnProperty(t)?this.attribs[t]:null},a.prototype.setAttributeNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.removeAttributeNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.getElementsByTagName=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.getAttributeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.setAttributeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.removeAttributeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.getAttributeNodeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.setAttributeNodeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.getElementsByTagNameNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.hasAttribute=function(t){return this.attribs.hasOwnProperty(t)},a.prototype.hasAttributeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.setIdAttribute=function(t,e){return this.attribs.hasOwnProperty(t)?this.attribs[t].isId:e},a.prototype.setIdAttributeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.setIdAttributeNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.getElementsByTagName=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.getElementsByTagNameNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.getElementsByClassName=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.isEqualNode=function(t){var e,n,r;if(!a.__super__.isEqualNode.apply(this,arguments).isEqualNode(t))return!1;if(t.namespaceURI!==this.namespaceURI)return!1;if(t.prefix!==this.prefix)return!1;if(t.localName!==this.localName)return!1;if(t.attribs.length!==this.attribs.length)return!1;for(e=n=0,r=this.attribs.length-1;0<=r?n<=r:n>=r;e=0<=r?++n:--n)if(!this.attribs[e].isEqualNode(t.attribs[e]))return!1;return!0},a}(r)}.call(Tr)),yr.exports}var Ir,_r={exports:{}},Nr={exports:{}},Ar=Nr.exports;function Dr(){return Ir||(Ir=1,function(){var t,e={}.hasOwnProperty;t=Pi(),Nr.exports=function(t){function n(t){n.__super__.constructor.call(this,t),this.value=""}return function(t,n){for(var r in n)e.call(n,r)&&(t[r]=n[r]);function i(){this.constructor=t}i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype}(n,t),Object.defineProperty(n.prototype,"data",{get:function(){return this.value},set:function(t){return this.value=t||""}}),Object.defineProperty(n.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(n.prototype,"textContent",{get:function(){return this.value},set:function(t){return this.value=t||""}}),n.prototype.clone=function(){return Object.create(this)},n.prototype.substringData=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},n.prototype.appendData=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},n.prototype.insertData=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},n.prototype.deleteData=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},n.prototype.replaceData=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},n.prototype.isEqualNode=function(t){return!!n.__super__.isEqualNode.apply(this,arguments).isEqualNode(t)&&t.data===this.data},n}(t)}.call(Ar)),Nr.exports}var Lr,jr=_r.exports;function Rr(){return Lr||(Lr=1,function(){var t,e,n={}.hasOwnProperty;t=br(),e=Dr(),_r.exports=function(e){function r(e,n){if(r.__super__.constructor.call(this,e),null==n)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=t.CData,this.value=this.stringify.cdata(n)}return function(t,e){for(var r in e)n.call(e,r)&&(t[r]=e[r]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(r,e),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(t){return this.options.writer.cdata(this,this.options.writer.filterOptions(t))},r}(e)}.call(jr)),_r.exports}var Pr,zr={exports:{}},$r=zr.exports;function Ur(){return Pr||(Pr=1,function(){var t,e,n={}.hasOwnProperty;t=br(),e=Dr(),zr.exports=function(e){function r(e,n){if(r.__super__.constructor.call(this,e),null==n)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=t.Comment,this.value=this.stringify.comment(n)}return function(t,e){for(var r in e)n.call(e,r)&&(t[r]=e[r]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(r,e),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(t){return this.options.writer.comment(this,this.options.writer.filterOptions(t))},r}(e)}.call($r)),zr.exports}var Gr,Br={exports:{}},Wr=Br.exports;function qr(){return Gr||(Gr=1,function(){var t,e,n,r={}.hasOwnProperty;n=Jn().isObject,e=Pi(),t=br(),Br.exports=function(e){function i(e,r,s,o){var a;i.__super__.constructor.call(this,e),n(r)&&(r=(a=r).version,s=a.encoding,o=a.standalone),r||(r="1.0"),this.type=t.Declaration,this.version=this.stringify.xmlVersion(r),null!=s&&(this.encoding=this.stringify.xmlEncoding(s)),null!=o&&(this.standalone=this.stringify.xmlStandalone(o))}return function(t,e){for(var n in e)r.call(e,n)&&(t[n]=e[n]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(i,e),i.prototype.toString=function(t){return this.options.writer.declaration(this,this.options.writer.filterOptions(t))},i}(e)}.call(Wr)),Br.exports}var Vr,Yr={exports:{}},Zr={exports:{}},Jr=Zr.exports;function Hr(){return Vr||(Vr=1,function(){var t,e,n={}.hasOwnProperty;e=Pi(),t=br(),Zr.exports=function(e){function r(e,n,i,s,o,a){if(r.__super__.constructor.call(this,e),null==n)throw new Error("Missing DTD element name. "+this.debugInfo());if(null==i)throw new Error("Missing DTD attribute name. "+this.debugInfo(n));if(!s)throw new Error("Missing DTD attribute type. "+this.debugInfo(n));if(!o)throw new Error("Missing DTD attribute default. "+this.debugInfo(n));if(0!==o.indexOf("#")&&(o="#"+o),!o.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(n));if(a&&!o.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(n));this.elementName=this.stringify.name(n),this.type=t.AttributeDeclaration,this.attributeName=this.stringify.name(i),this.attributeType=this.stringify.dtdAttType(s),a&&(this.defaultValue=this.stringify.dtdAttDefault(a)),this.defaultValueType=o}return function(t,e){for(var r in e)n.call(e,r)&&(t[r]=e[r]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(r,e),r.prototype.toString=function(t){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(t))},r}(e)}.call(Jr)),Zr.exports}var Kr,Xr={exports:{}},Qr=Xr.exports;function ti(){return Kr||(Kr=1,function(){var t,e,n,r={}.hasOwnProperty;n=Jn().isObject,e=Pi(),t=br(),Xr.exports=function(e){function i(e,r,s,o){if(i.__super__.constructor.call(this,e),null==s)throw new Error("Missing DTD entity name. "+this.debugInfo(s));if(null==o)throw new Error("Missing DTD entity value. "+this.debugInfo(s));if(this.pe=!!r,this.name=this.stringify.name(s),this.type=t.EntityDeclaration,n(o)){if(!o.pubID&&!o.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(s));if(o.pubID&&!o.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(s));if(this.internal=!1,null!=o.pubID&&(this.pubID=this.stringify.dtdPubID(o.pubID)),null!=o.sysID&&(this.sysID=this.stringify.dtdSysID(o.sysID)),null!=o.nData&&(this.nData=this.stringify.dtdNData(o.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(s))}else this.value=this.stringify.dtdEntityValue(o),this.internal=!0}return function(t,e){for(var n in e)r.call(e,n)&&(t[n]=e[n]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(i,e),Object.defineProperty(i.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(i.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(i.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(i.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(i.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(i.prototype,"xmlVersion",{get:function(){return null}}),i.prototype.toString=function(t){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(t))},i}(e)}.call(Qr)),Xr.exports}var ei,ni={exports:{}},ri=ni.exports;function ii(){return ei||(ei=1,function(){var t,e,n={}.hasOwnProperty;e=Pi(),t=br(),ni.exports=function(e){function r(e,n,i){if(r.__super__.constructor.call(this,e),null==n)throw new Error("Missing DTD element name. "+this.debugInfo());i||(i="(#PCDATA)"),Array.isArray(i)&&(i="("+i.join(",")+")"),this.name=this.stringify.name(n),this.type=t.ElementDeclaration,this.value=this.stringify.dtdElementValue(i)}return function(t,e){for(var r in e)n.call(e,r)&&(t[r]=e[r]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(r,e),r.prototype.toString=function(t){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(t))},r}(e)}.call(ri)),ni.exports}var si,oi={exports:{}},ai=oi.exports;function ui(){return si||(si=1,function(){var t,e,n={}.hasOwnProperty;e=Pi(),t=br(),oi.exports=function(e){function r(e,n,i){if(r.__super__.constructor.call(this,e),null==n)throw new Error("Missing DTD notation name. "+this.debugInfo(n));if(!i.pubID&&!i.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(n));this.name=this.stringify.name(n),this.type=t.NotationDeclaration,null!=i.pubID&&(this.pubID=this.stringify.dtdPubID(i.pubID)),null!=i.sysID&&(this.sysID=this.stringify.dtdSysID(i.sysID))}return function(t,e){for(var r in e)n.call(e,r)&&(t[r]=e[r]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(r,e),Object.defineProperty(r.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(r.prototype,"systemId",{get:function(){return this.sysID}}),r.prototype.toString=function(t){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(t))},r}(e)}.call(ai)),oi.exports}var ci,li=Yr.exports;function hi(){return ci||(ci=1,function(){var t,e,n,r,i,s,o,a,u={}.hasOwnProperty;a=Jn().isObject,o=Pi(),t=br(),e=Hr(),r=ti(),n=ii(),i=ui(),s=Fr(),Yr.exports=function(o){function c(e,n,r){var i,s,o,u,l,h;if(c.__super__.constructor.call(this,e),this.type=t.DocType,e.children)for(s=0,o=(u=e.children).length;s<o;s++)if((i=u[s]).type===t.Element){this.name=i.name;break}this.documentObject=e,a(n)&&(n=(l=n).pubID,r=l.sysID),null==r&&(r=(h=[n,r])[0],n=h[1]),null!=n&&(this.pubID=this.stringify.dtdPubID(n)),null!=r&&(this.sysID=this.stringify.dtdSysID(r))}return function(t,e){for(var n in e)u.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(c,o),Object.defineProperty(c.prototype,"entities",{get:function(){var e,n,r,i,o;for(i={},n=0,r=(o=this.children).length;n<r;n++)(e=o[n]).type!==t.EntityDeclaration||e.pe||(i[e.name]=e);return new s(i)}}),Object.defineProperty(c.prototype,"notations",{get:function(){var e,n,r,i,o;for(i={},n=0,r=(o=this.children).length;n<r;n++)(e=o[n]).type===t.NotationDeclaration&&(i[e.name]=e);return new s(i)}}),Object.defineProperty(c.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(c.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(c.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),c.prototype.element=function(t,e){var r;return r=new n(this,t,e),this.children.push(r),this},c.prototype.attList=function(t,n,r,i,s){var o;return o=new e(this,t,n,r,i,s),this.children.push(o),this},c.prototype.entity=function(t,e){var n;return n=new r(this,!1,t,e),this.children.push(n),this},c.prototype.pEntity=function(t,e){var n;return n=new r(this,!0,t,e),this.children.push(n),this},c.prototype.notation=function(t,e){var n;return n=new i(this,t,e),this.children.push(n),this},c.prototype.toString=function(t){return this.options.writer.docType(this,this.options.writer.filterOptions(t))},c.prototype.ele=function(t,e){return this.element(t,e)},c.prototype.att=function(t,e,n,r,i){return this.attList(t,e,n,r,i)},c.prototype.ent=function(t,e){return this.entity(t,e)},c.prototype.pent=function(t,e){return this.pEntity(t,e)},c.prototype.not=function(t,e){return this.notation(t,e)},c.prototype.up=function(){return this.root()||this.documentObject},c.prototype.isEqualNode=function(t){return!!c.__super__.isEqualNode.apply(this,arguments).isEqualNode(t)&&t.name===this.name&&t.publicId===this.publicId&&t.systemId===this.systemId},c}(o)}.call(li)),Yr.exports}var fi,di={exports:{}},pi=di.exports;function yi(){return fi||(fi=1,function(){var t,e,n={}.hasOwnProperty;t=br(),e=Pi(),di.exports=function(e){function r(e,n){if(r.__super__.constructor.call(this,e),null==n)throw new Error("Missing raw text. "+this.debugInfo());this.type=t.Raw,this.value=this.stringify.raw(n)}return function(t,e){for(var r in e)n.call(e,r)&&(t[r]=e[r]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(r,e),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(t){return this.options.writer.raw(this,this.options.writer.filterOptions(t))},r}(e)}.call(pi)),di.exports}var mi,gi={exports:{}},bi=gi.exports;function vi(){return mi||(mi=1,function(){var t,e,n={}.hasOwnProperty;t=br(),e=Dr(),gi.exports=function(e){function r(e,n){if(r.__super__.constructor.call(this,e),null==n)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=t.Text,this.value=this.stringify.text(n)}return function(t,e){for(var r in e)n.call(e,r)&&(t[r]=e[r]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(r,e),Object.defineProperty(r.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(r.prototype,"wholeText",{get:function(){var t,e,n;for(n="",e=this.previousSibling;e;)n=e.data+n,e=e.previousSibling;for(n+=this.data,t=this.nextSibling;t;)n+=t.data,t=t.nextSibling;return n}}),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(t){return this.options.writer.text(this,this.options.writer.filterOptions(t))},r.prototype.splitText=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},r.prototype.replaceWholeText=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},r}(e)}.call(bi)),gi.exports}var wi,xi={exports:{}},Si=xi.exports;function Ei(){return wi||(wi=1,function(){var t,e,n={}.hasOwnProperty;t=br(),e=Dr(),xi.exports=function(e){function r(e,n,i){if(r.__super__.constructor.call(this,e),null==n)throw new Error("Missing instruction target. "+this.debugInfo());this.type=t.ProcessingInstruction,this.target=this.stringify.insTarget(n),this.name=this.target,i&&(this.value=this.stringify.insValue(i))}return function(t,e){for(var r in e)n.call(e,r)&&(t[r]=e[r]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(r,e),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(t){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(t))},r.prototype.isEqualNode=function(t){return!!r.__super__.isEqualNode.apply(this,arguments).isEqualNode(t)&&t.target===this.target},r}(e)}.call(Si)),xi.exports}var Oi,Ci={exports:{}},Fi=Ci.exports;function ki(){return Oi||(Oi=1,function(){var t,e,n={}.hasOwnProperty;e=Pi(),t=br(),Ci.exports=function(e){function r(e){r.__super__.constructor.call(this,e),this.type=t.Dummy}return function(t,e){for(var r in e)n.call(e,r)&&(t[r]=e[r]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(r,e),r.prototype.clone=function(){return Object.create(this)},r.prototype.toString=function(){return""},r}(e)}.call(Fi)),Ci.exports}var Ti,Mi={exports:{}},Ii=Mi.exports;function _i(){return Ti||(Ti=1,function(){Mi.exports=function(){function t(t){this.nodes=t}return Object.defineProperty(t.prototype,"length",{get:function(){return this.nodes.length||0}}),t.prototype.clone=function(){return this.nodes=null},t.prototype.item=function(t){return this.nodes[t]||null},t}()}.call(Ii)),Mi.exports}var Ni,Ai={exports:{}},Di=Ai.exports;function Li(){return Ni||(Ni=1,function(){Ai.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(Di)),Ai.exports}var ji,Ri=pr.exports;function Pi(){return ji||(ji=1,function(){var t,e,n,r,i,s,o,a,u,c,l,h,f,d,p,y,m,g={}.hasOwnProperty;m=Jn(),y=m.isObject,p=m.isFunction,d=m.isEmpty,f=m.getValue,a=null,n=null,r=null,i=null,s=null,l=null,h=null,c=null,o=null,e=null,u=null,t=null,pr.exports=function(){function m(f){this.parent=f,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=Mr(),n=Rr(),r=Ur(),i=qr(),s=hi(),l=yi(),h=vi(),c=Ei(),o=ki(),e=br(),u=_i(),Fr(),t=Li())}return Object.defineProperty(m.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(m.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(m.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(m.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(m.prototype,"childNodes",{get:function(){return this.childNodeList&&this.childNodeList.nodes||(this.childNodeList=new u(this.children)),this.childNodeList}}),Object.defineProperty(m.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(m.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(m.prototype,"previousSibling",{get:function(){var t;return t=this.parent.children.indexOf(this),this.parent.children[t-1]||null}}),Object.defineProperty(m.prototype,"nextSibling",{get:function(){var t;return t=this.parent.children.indexOf(this),this.parent.children[t+1]||null}}),Object.defineProperty(m.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(m.prototype,"textContent",{get:function(){var t,n,r,i,s;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(s="",n=0,r=(i=this.children).length;n<r;n++)(t=i[n]).textContent&&(s+=t.textContent);return s}return null},set:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),m.prototype.setParent=function(t){var e,n,r,i;for(this.parent=t,t&&(this.options=t.options,this.stringify=t.stringify),i=[],e=0,n=(r=this.children).length;e<n;e++)i.push(r[e].setParent(this));return i},m.prototype.element=function(t,e,n){var r,i,s,o,a,u,c,l,h,m;if(a=null,null===e&&null==n&&(e=(l=[{},null])[0],n=l[1]),null==e&&(e={}),e=f(e),y(e)||(n=(h=[e,n])[0],e=h[1]),null!=t&&(t=f(t)),Array.isArray(t))for(i=0,u=t.length;i<u;i++)a=this.element(t[i]);else if(p(t))a=this.element(t.apply());else if(y(t)){for(o in t)if(g.call(t,o))if(p(m=t[o])&&(m=m.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&0===o.indexOf(this.stringify.convertAttKey))a=this.attribute(o.substr(this.stringify.convertAttKey.length),m);else if(!this.options.separateArrayItems&&Array.isArray(m)&&d(m))a=this.dummy();else if(y(m)&&d(m))a=this.element(o);else if(this.options.keepNullNodes||null!=m)if(!this.options.separateArrayItems&&Array.isArray(m))for(s=0,c=m.length;s<c;s++)(r={})[o]=m[s],a=this.element(r);else y(m)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&0===o.indexOf(this.stringify.convertTextKey)?a=this.element(m):(a=this.element(o)).element(m):a=this.element(o,m);else a=this.dummy()}else a=this.options.keepNullNodes||null!==n?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&0===t.indexOf(this.stringify.convertTextKey)?this.text(n):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&0===t.indexOf(this.stringify.convertCDataKey)?this.cdata(n):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&0===t.indexOf(this.stringify.convertCommentKey)?this.comment(n):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&0===t.indexOf(this.stringify.convertRawKey)?this.raw(n):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&0===t.indexOf(this.stringify.convertPIKey)?this.instruction(t.substr(this.stringify.convertPIKey.length),n):this.node(t,e,n):this.dummy();if(null==a)throw new Error("Could not create any elements with: "+t+". "+this.debugInfo());return a},m.prototype.insertBefore=function(t,e,n){var r,i,s,o,a;if(null!=t?t.type:void 0)return o=e,(s=t).setParent(this),o?(i=children.indexOf(o),a=children.splice(i),children.push(s),Array.prototype.push.apply(children,a)):children.push(s),s;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(t));return i=this.parent.children.indexOf(this),a=this.parent.children.splice(i),r=this.parent.element(t,e,n),Array.prototype.push.apply(this.parent.children,a),r},m.prototype.insertAfter=function(t,e,n){var r,i,s;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(t));return i=this.parent.children.indexOf(this),s=this.parent.children.splice(i+1),r=this.parent.element(t,e,n),Array.prototype.push.apply(this.parent.children,s),r},m.prototype.remove=function(){var t;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return t=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[t,t-t+1].concat([])),this.parent},m.prototype.node=function(t,e,n){var r,i;return null!=t&&(t=f(t)),e||(e={}),e=f(e),y(e)||(n=(i=[e,n])[0],e=i[1]),r=new a(this,t,e),null!=n&&r.text(n),this.children.push(r),r},m.prototype.text=function(t){var e;return y(t)&&this.element(t),e=new h(this,t),this.children.push(e),this},m.prototype.cdata=function(t){var e;return e=new n(this,t),this.children.push(e),this},m.prototype.comment=function(t){var e;return e=new r(this,t),this.children.push(e),this},m.prototype.commentBefore=function(t){var e,n;return e=this.parent.children.indexOf(this),n=this.parent.children.splice(e),this.parent.comment(t),Array.prototype.push.apply(this.parent.children,n),this},m.prototype.commentAfter=function(t){var e,n;return e=this.parent.children.indexOf(this),n=this.parent.children.splice(e+1),this.parent.comment(t),Array.prototype.push.apply(this.parent.children,n),this},m.prototype.raw=function(t){var e;return e=new l(this,t),this.children.push(e),this},m.prototype.dummy=function(){return new o(this)},m.prototype.instruction=function(t,e){var n,r,i,s;if(null!=t&&(t=f(t)),null!=e&&(e=f(e)),Array.isArray(t))for(i=0,s=t.length;i<s;i++)this.instruction(n=t[i]);else if(y(t))for(n in t)g.call(t,n)&&this.instruction(n,t[n]);else p(e)&&(e=e.apply()),r=new c(this,t,e),this.children.push(r);return this},m.prototype.instructionBefore=function(t,e){var n,r;return n=this.parent.children.indexOf(this),r=this.parent.children.splice(n),this.parent.instruction(t,e),Array.prototype.push.apply(this.parent.children,r),this},m.prototype.instructionAfter=function(t,e){var n,r;return n=this.parent.children.indexOf(this),r=this.parent.children.splice(n+1),this.parent.instruction(t,e),Array.prototype.push.apply(this.parent.children,r),this},m.prototype.declaration=function(t,n,r){var s,o;return s=this.document(),o=new i(s,t,n,r),0===s.children.length?s.children.unshift(o):s.children[0].type===e.Declaration?s.children[0]=o:s.children.unshift(o),s.root()||s},m.prototype.dtd=function(t,n){var r,i,o,a,u,c,l,h,f;for(r=this.document(),i=new s(r,t,n),o=a=0,c=(h=r.children).length;a<c;o=++a)if(h[o].type===e.DocType)return r.children[o]=i,i;for(o=u=0,l=(f=r.children).length;u<l;o=++u)if(f[o].isRoot)return r.children.splice(o,0,i),i;return r.children.push(i),i},m.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},m.prototype.root=function(){var t;for(t=this;t;){if(t.type===e.Document)return t.rootObject;if(t.isRoot)return t;t=t.parent}},m.prototype.document=function(){var t;for(t=this;t;){if(t.type===e.Document)return t;t=t.parent}},m.prototype.end=function(t){return this.document().end(t)},m.prototype.prev=function(){var t;if((t=this.parent.children.indexOf(this))<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[t-1]},m.prototype.next=function(){var t;if(-1===(t=this.parent.children.indexOf(this))||t===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[t+1]},m.prototype.importDocument=function(t){var e;return(e=t.root().clone()).parent=this,e.isRoot=!1,this.children.push(e),this},m.prototype.debugInfo=function(t){var e,n;return null!=(t=t||this.name)||(null!=(e=this.parent)?e.name:void 0)?null==t?"parent: <"+this.parent.name+">":(null!=(n=this.parent)?n.name:void 0)?"node: <"+t+">, parent: <"+this.parent.name+">":"node: <"+t+">":""},m.prototype.ele=function(t,e,n){return this.element(t,e,n)},m.prototype.nod=function(t,e,n){return this.node(t,e,n)},m.prototype.txt=function(t){return this.text(t)},m.prototype.dat=function(t){return this.cdata(t)},m.prototype.com=function(t){return this.comment(t)},m.prototype.ins=function(t,e){return this.instruction(t,e)},m.prototype.doc=function(){return this.document()},m.prototype.dec=function(t,e,n){return this.declaration(t,e,n)},m.prototype.e=function(t,e,n){return this.element(t,e,n)},m.prototype.n=function(t,e,n){return this.node(t,e,n)},m.prototype.t=function(t){return this.text(t)},m.prototype.d=function(t){return this.cdata(t)},m.prototype.c=function(t){return this.comment(t)},m.prototype.r=function(t){return this.raw(t)},m.prototype.i=function(t,e){return this.instruction(t,e)},m.prototype.u=function(){return this.up()},m.prototype.importXMLBuilder=function(t){return this.importDocument(t)},m.prototype.replaceChild=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.removeChild=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.appendChild=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.hasChildNodes=function(){return 0!==this.children.length},m.prototype.cloneNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.isSupported=function(){return!0},m.prototype.hasAttributes=function(){return 0!==this.attribs.length},m.prototype.compareDocumentPosition=function(e){var n,r;return(n=this)===e?0:this.document()!==e.document()?(r=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?r|=t.Preceding:r|=t.Following,r):n.isAncestor(e)?t.Contains|t.Preceding:n.isDescendant(e)?t.Contains|t.Following:n.isPreceding(e)?t.Preceding:t.Following},m.prototype.isSameNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.lookupPrefix=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.isDefaultNamespace=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.lookupNamespaceURI=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.isEqualNode=function(t){var e,n,r;if(t.nodeType!==this.nodeType)return!1;if(t.children.length!==this.children.length)return!1;for(e=n=0,r=this.children.length-1;0<=r?n<=r:n>=r;e=0<=r?++n:--n)if(!this.children[e].isEqualNode(t.children[e]))return!1;return!0},m.prototype.getFeature=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.setUserData=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getUserData=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.contains=function(t){return!!t&&(t===this||this.isDescendant(t))},m.prototype.isDescendant=function(t){var e,n,r,i;for(n=0,r=(i=this.children).length;n<r;n++){if(t===(e=i[n]))return!0;if(e.isDescendant(t))return!0}return!1},m.prototype.isAncestor=function(t){return t.isDescendant(this)},m.prototype.isPreceding=function(t){var e,n;return e=this.treePosition(t),n=this.treePosition(this),-1!==e&&-1!==n&&e<n},m.prototype.isFollowing=function(t){var e,n;return e=this.treePosition(t),n=this.treePosition(this),-1!==e&&-1!==n&&e>n},m.prototype.treePosition=function(t){var e,n;return n=0,e=!1,this.foreachTreeNode(this.document(),(function(r){if(n++,!e&&r===t)return e=!0})),e?n:-1},m.prototype.foreachTreeNode=function(t,e){var n,r,i,s,o;for(t||(t=this.document()),r=0,i=(s=t.children).length;r<i;r++){if(o=e(n=s[r]))return o;if(o=this.foreachTreeNode(n,e))return o}},m}()}.call(Ri)),pr.exports}var zi,$i={exports:{}},Ui=$i.exports;function Gi(){return zi||(zi=1,function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},e={}.hasOwnProperty;$i.exports=function(){function n(n){var r,i;for(r in this.assertLegalName=t(this.assertLegalName,this),this.assertLegalChar=t(this.assertLegalChar,this),n||(n={}),this.options=n,this.options.version||(this.options.version="1.0"),i=n.stringify||{})e.call(i,r)&&(this[r]=i[r])}return n.prototype.name=function(t){return this.options.noValidation?t:this.assertLegalName(""+t||"")},n.prototype.text=function(t){return this.options.noValidation?t:this.assertLegalChar(this.textEscape(""+t||""))},n.prototype.cdata=function(t){return this.options.noValidation?t:(t=(t=""+t||"").replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(t))},n.prototype.comment=function(t){if(this.options.noValidation)return t;if((t=""+t||"").match(/--/))throw new Error("Comment text cannot contain double-hypen: "+t);return this.assertLegalChar(t)},n.prototype.raw=function(t){return this.options.noValidation?t:""+t||""},n.prototype.attValue=function(t){return this.options.noValidation?t:this.assertLegalChar(this.attEscape(t=""+t||""))},n.prototype.insTarget=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},n.prototype.insValue=function(t){if(this.options.noValidation)return t;if((t=""+t||"").match(/\?>/))throw new Error("Invalid processing instruction value: "+t);return this.assertLegalChar(t)},n.prototype.xmlVersion=function(t){if(this.options.noValidation)return t;if(!(t=""+t||"").match(/1\.[0-9]+/))throw new Error("Invalid version number: "+t);return t},n.prototype.xmlEncoding=function(t){if(this.options.noValidation)return t;if(!(t=""+t||"").match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+t);return this.assertLegalChar(t)},n.prototype.xmlStandalone=function(t){return this.options.noValidation?t:t?"yes":"no"},n.prototype.dtdPubID=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},n.prototype.dtdSysID=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},n.prototype.dtdElementValue=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},n.prototype.dtdAttType=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},n.prototype.dtdAttDefault=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},n.prototype.dtdEntityValue=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},n.prototype.dtdNData=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},n.prototype.convertAttKey="@",n.prototype.convertPIKey="?",n.prototype.convertTextKey="#text",n.prototype.convertCDataKey="#cdata",n.prototype.convertCommentKey="#comment",n.prototype.convertRawKey="#raw",n.prototype.assertLegalChar=function(t){var e;if(this.options.noValidation)return t;if("1.0"===this.options.version){if(e=t.match(/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/))throw new Error("Invalid character in string: "+t+" at index "+e.index)}else if("1.1"===this.options.version&&(e=t.match(/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/)))throw new Error("Invalid character in string: "+t+" at index "+e.index);return t},n.prototype.assertLegalName=function(t){if(this.options.noValidation)return t;if(this.assertLegalChar(t),!t.match(/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/))throw new Error("Invalid character in name");return t},n.prototype.textEscape=function(t){return this.options.noValidation?t:t.replace(this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
")},n.prototype.attEscape=function(t){return this.options.noValidation?t:t.replace(this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
")},n}()}.call(Ui)),$i.exports}var Bi,Wi={exports:{}},qi={exports:{}},Vi={exports:{}},Yi=Vi.exports;function Zi(){return Bi||(Bi=1,function(){Vi.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(Yi)),Vi.exports}var Ji,Hi=qi.exports;function Ki(){return Ji||(Ji=1,function(){var t,e,n,r={}.hasOwnProperty;n=Jn().assign,t=br(),qr(),hi(),Rr(),Ur(),Mr(),yi(),vi(),Ei(),ki(),Hr(),ii(),ti(),ui(),e=Zi(),qi.exports=function(){function i(t){var e,n,i;for(e in t||(t={}),this.options=t,n=t.writer||{})r.call(n,e)&&(i=n[e],this["_"+e]=this[e],this[e]=i)}return i.prototype.filterOptions=function(t){var r,i,s,o,a,u,c,l;return t||(t={}),t=n({},this.options,t),(r={writer:this}).pretty=t.pretty||!1,r.allowEmpty=t.allowEmpty||!1,r.indent=null!=(i=t.indent)?i:" ",r.newline=null!=(s=t.newline)?s:"\n",r.offset=null!=(o=t.offset)?o:0,r.dontPrettyTextNodes=null!=(a=null!=(u=t.dontPrettyTextNodes)?u:t.dontprettytextnodes)?a:0,r.spaceBeforeSlash=null!=(c=null!=(l=t.spaceBeforeSlash)?l:t.spacebeforeslash)?c:"",!0===r.spaceBeforeSlash&&(r.spaceBeforeSlash=" "),r.suppressPrettyCount=0,r.user={},r.state=e.None,r},i.prototype.indent=function(t,e,n){var r;return!e.pretty||e.suppressPrettyCount?"":e.pretty&&(r=(n||0)+e.offset+1)>0?new Array(r).join(e.indent):""},i.prototype.endline=function(t,e){return!e.pretty||e.suppressPrettyCount?"":e.newline},i.prototype.attribute=function(t,e,n){var r;return this.openAttribute(t,e,n),r=" "+t.name+'="'+t.value+'"',this.closeAttribute(t,e,n),r},i.prototype.cdata=function(t,n,r){var i;return this.openNode(t,n,r),n.state=e.OpenTag,i=this.indent(t,n,r)+"<![CDATA[",n.state=e.InsideTag,i+=t.value,n.state=e.CloseTag,i+="]]>"+this.endline(t,n,r),n.state=e.None,this.closeNode(t,n,r),i},i.prototype.comment=function(t,n,r){var i;return this.openNode(t,n,r),n.state=e.OpenTag,i=this.indent(t,n,r)+"\x3c!-- ",n.state=e.InsideTag,i+=t.value,n.state=e.CloseTag,i+=" --\x3e"+this.endline(t,n,r),n.state=e.None,this.closeNode(t,n,r),i},i.prototype.declaration=function(t,n,r){var i;return this.openNode(t,n,r),n.state=e.OpenTag,i=this.indent(t,n,r)+"<?xml",n.state=e.InsideTag,i+=' version="'+t.version+'"',null!=t.encoding&&(i+=' encoding="'+t.encoding+'"'),null!=t.standalone&&(i+=' standalone="'+t.standalone+'"'),n.state=e.CloseTag,i+=n.spaceBeforeSlash+"?>",i+=this.endline(t,n,r),n.state=e.None,this.closeNode(t,n,r),i},i.prototype.docType=function(t,n,r){var i,s,o,a;if(r||(r=0),this.openNode(t,n,r),n.state=e.OpenTag,o=this.indent(t,n,r),o+="<!DOCTYPE "+t.root().name,t.pubID&&t.sysID?o+=' PUBLIC "'+t.pubID+'" "'+t.sysID+'"':t.sysID&&(o+=' SYSTEM "'+t.sysID+'"'),t.children.length>0){for(o+=" [",o+=this.endline(t,n,r),n.state=e.InsideTag,i=0,s=(a=t.children).length;i<s;i++)o+=this.writeChildNode(a[i],n,r+1);n.state=e.CloseTag,o+="]"}return n.state=e.CloseTag,o+=n.spaceBeforeSlash+">",o+=this.endline(t,n,r),n.state=e.None,this.closeNode(t,n,r),o},i.prototype.element=function(n,i,s){var o,a,u,c,l,h,f,d,p,y,m,g,b;for(d in s||(s=0),p=!1,y="",this.openNode(n,i,s),i.state=e.OpenTag,y+=this.indent(n,i,s)+"<"+n.name,m=n.attribs)r.call(m,d)&&(y+=this.attribute(m[d],i,s));if(u=0===(a=n.children.length)?null:n.children[0],0===a||n.children.every((function(e){return(e.type===t.Text||e.type===t.Raw)&&""===e.value})))i.allowEmpty?(y+=">",i.state=e.CloseTag,y+="</"+n.name+">"+this.endline(n,i,s)):(i.state=e.CloseTag,y+=i.spaceBeforeSlash+"/>"+this.endline(n,i,s));else if(!i.pretty||1!==a||u.type!==t.Text&&u.type!==t.Raw||null==u.value){if(i.dontPrettyTextNodes)for(c=0,h=(g=n.children).length;c<h;c++)if(((o=g[c]).type===t.Text||o.type===t.Raw)&&null!=o.value){i.suppressPrettyCount++,p=!0;break}for(y+=">"+this.endline(n,i,s),i.state=e.InsideTag,l=0,f=(b=n.children).length;l<f;l++)y+=this.writeChildNode(o=b[l],i,s+1);i.state=e.CloseTag,y+=this.indent(n,i,s)+"</"+n.name+">",p&&i.suppressPrettyCount--,y+=this.endline(n,i,s),i.state=e.None}else y+=">",i.state=e.InsideTag,i.suppressPrettyCount++,p=!0,y+=this.writeChildNode(u,i,s+1),i.suppressPrettyCount--,p=!1,i.state=e.CloseTag,y+="</"+n.name+">"+this.endline(n,i,s);return this.closeNode(n,i,s),y},i.prototype.writeChildNode=function(e,n,r){switch(e.type){case t.CData:return this.cdata(e,n,r);case t.Comment:return this.comment(e,n,r);case t.Element:return this.element(e,n,r);case t.Raw:return this.raw(e,n,r);case t.Text:return this.text(e,n,r);case t.ProcessingInstruction:return this.processingInstruction(e,n,r);case t.Dummy:return"";case t.Declaration:return this.declaration(e,n,r);case t.DocType:return this.docType(e,n,r);case t.AttributeDeclaration:return this.dtdAttList(e,n,r);case t.ElementDeclaration:return this.dtdElement(e,n,r);case t.EntityDeclaration:return this.dtdEntity(e,n,r);case t.NotationDeclaration:return this.dtdNotation(e,n,r);default:throw new Error("Unknown XML node type: "+e.constructor.name)}},i.prototype.processingInstruction=function(t,n,r){var i;return this.openNode(t,n,r),n.state=e.OpenTag,i=this.indent(t,n,r)+"<?",n.state=e.InsideTag,i+=t.target,t.value&&(i+=" "+t.value),n.state=e.CloseTag,i+=n.spaceBeforeSlash+"?>",i+=this.endline(t,n,r),n.state=e.None,this.closeNode(t,n,r),i},i.prototype.raw=function(t,n,r){var i;return this.openNode(t,n,r),n.state=e.OpenTag,i=this.indent(t,n,r),n.state=e.InsideTag,i+=t.value,n.state=e.CloseTag,i+=this.endline(t,n,r),n.state=e.None,this.closeNode(t,n,r),i},i.prototype.text=function(t,n,r){var i;return this.openNode(t,n,r),n.state=e.OpenTag,i=this.indent(t,n,r),n.state=e.InsideTag,i+=t.value,n.state=e.CloseTag,i+=this.endline(t,n,r),n.state=e.None,this.closeNode(t,n,r),i},i.prototype.dtdAttList=function(t,n,r){var i;return this.openNode(t,n,r),n.state=e.OpenTag,i=this.indent(t,n,r)+"<!ATTLIST",n.state=e.InsideTag,i+=" "+t.elementName+" "+t.attributeName+" "+t.attributeType,"#DEFAULT"!==t.defaultValueType&&(i+=" "+t.defaultValueType),t.defaultValue&&(i+=' "'+t.defaultValue+'"'),n.state=e.CloseTag,i+=n.spaceBeforeSlash+">"+this.endline(t,n,r),n.state=e.None,this.closeNode(t,n,r),i},i.prototype.dtdElement=function(t,n,r){var i;return this.openNode(t,n,r),n.state=e.OpenTag,i=this.indent(t,n,r)+"<!ELEMENT",n.state=e.InsideTag,i+=" "+t.name+" "+t.value,n.state=e.CloseTag,i+=n.spaceBeforeSlash+">"+this.endline(t,n,r),n.state=e.None,this.closeNode(t,n,r),i},i.prototype.dtdEntity=function(t,n,r){var i;return this.openNode(t,n,r),n.state=e.OpenTag,i=this.indent(t,n,r)+"<!ENTITY",n.state=e.InsideTag,t.pe&&(i+=" %"),i+=" "+t.name,t.value?i+=' "'+t.value+'"':(t.pubID&&t.sysID?i+=' PUBLIC "'+t.pubID+'" "'+t.sysID+'"':t.sysID&&(i+=' SYSTEM "'+t.sysID+'"'),t.nData&&(i+=" NDATA "+t.nData)),n.state=e.CloseTag,i+=n.spaceBeforeSlash+">"+this.endline(t,n,r),n.state=e.None,this.closeNode(t,n,r),i},i.prototype.dtdNotation=function(t,n,r){var i;return this.openNode(t,n,r),n.state=e.OpenTag,i=this.indent(t,n,r)+"<!NOTATION",n.state=e.InsideTag,i+=" "+t.name,t.pubID&&t.sysID?i+=' PUBLIC "'+t.pubID+'" "'+t.sysID+'"':t.pubID?i+=' PUBLIC "'+t.pubID+'"':t.sysID&&(i+=' SYSTEM "'+t.sysID+'"'),n.state=e.CloseTag,i+=n.spaceBeforeSlash+">"+this.endline(t,n,r),n.state=e.None,this.closeNode(t,n,r),i},i.prototype.openNode=function(){},i.prototype.closeNode=function(){},i.prototype.openAttribute=function(){},i.prototype.closeAttribute=function(){},i}()}.call(Hi)),qi.exports}var Xi,Qi=Wi.exports;function ts(){return Xi||(Xi=1,function(){var t,e={}.hasOwnProperty;t=Ki(),Wi.exports=function(t){function n(t){n.__super__.constructor.call(this,t)}return function(t,n){for(var r in n)e.call(n,r)&&(t[r]=n[r]);function i(){this.constructor=t}i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype}(n,t),n.prototype.document=function(t,e){var n,r,i,s;for(e=this.filterOptions(e),i="",n=0,r=(s=t.children).length;n<r;n++)i+=this.writeChildNode(s[n],e,0);return e.pretty&&i.slice(-e.newline.length)===e.newline&&(i=i.slice(0,-e.newline.length)),i},n}(t)}.call(Qi)),Wi.exports}var es,ns=er.exports;function rs(){return es||(es=1,function(){var t,e,n,r,i,s,o,a={}.hasOwnProperty;o=Jn().isPlainObject,n=Qn(),e=fr(),r=Pi(),t=br(),s=Gi(),i=ts(),er.exports=function(r){function u(n){u.__super__.constructor.call(this,null),this.name="#document",this.type=t.Document,this.documentURI=null,this.domConfig=new e,n||(n={}),n.writer||(n.writer=new i),this.options=n,this.stringify=new s(n)}return function(t,e){for(var n in e)a.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(u,r),Object.defineProperty(u.prototype,"implementation",{value:new n}),Object.defineProperty(u.prototype,"doctype",{get:function(){var e,n,r,i;for(n=0,r=(i=this.children).length;n<r;n++)if((e=i[n]).type===t.DocType)return e;return null}}),Object.defineProperty(u.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(u.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(u.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(u.prototype,"xmlEncoding",{get:function(){return 0!==this.children.length&&this.children[0].type===t.Declaration?this.children[0].encoding:null}}),Object.defineProperty(u.prototype,"xmlStandalone",{get:function(){return 0!==this.children.length&&this.children[0].type===t.Declaration&&"yes"===this.children[0].standalone}}),Object.defineProperty(u.prototype,"xmlVersion",{get:function(){return 0!==this.children.length&&this.children[0].type===t.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(u.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(u.prototype,"origin",{get:function(){return null}}),Object.defineProperty(u.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(u.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(u.prototype,"contentType",{get:function(){return null}}),u.prototype.end=function(t){var e;return e={},t?o(t)&&(e=t,t=this.options.writer):t=this.options.writer,t.document(this,t.filterOptions(e))},u.prototype.toString=function(t){return this.options.writer.document(this,this.options.writer.filterOptions(t))},u.prototype.createElement=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.createTextNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.createComment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.createCDATASection=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.createProcessingInstruction=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.createAttribute=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.createEntityReference=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.getElementsByTagName=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.importNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.createElementNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.createAttributeNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.getElementsByTagNameNS=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.getElementById=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.adoptNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.renameNode=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.getElementsByClassName=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.createEvent=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.createNodeIterator=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u.prototype.createTreeWalker=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},u}(r)}.call(ns)),er.exports}var is,ss={exports:{}},os=ss.exports;function as(){return is||(is=1,function(){var t,e,n,r,i,s,o,a,u,c,l,h,f,d,p,y,m,g,b,v,w,x,S,E={}.hasOwnProperty;S=Jn(),w=S.isObject,v=S.isFunction,x=S.isPlainObject,b=S.getValue,t=br(),h=rs(),f=Mr(),r=Rr(),i=Ur(),p=yi(),g=vi(),d=Ei(),c=qr(),l=hi(),s=Hr(),a=ti(),o=ii(),u=ui(),n=Sr(),m=Gi(),y=ts(),e=Zi(),ss.exports=function(){function S(e,n,r){var i;this.name="?xml",this.type=t.Document,e||(e={}),i={},e.writer?x(e.writer)&&(i=e.writer,e.writer=new y):e.writer=new y,this.options=e,this.writer=e.writer,this.writerOptions=this.writer.filterOptions(i),this.stringify=new m(e),this.onDataCallback=n||function(){},this.onEndCallback=r||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return S.prototype.createChildNode=function(e){var n,r,i,s,o,a,u;switch(e.type){case t.CData:this.cdata(e.value);break;case t.Comment:this.comment(e.value);break;case t.Element:for(n in r={},a=e.attribs)E.call(a,n)&&(r[n]=a[n].value);this.node(e.name,r);break;case t.Dummy:this.dummy();break;case t.Raw:this.raw(e.value);break;case t.Text:this.text(e.value);break;case t.ProcessingInstruction:this.instruction(e.target,e.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+e.constructor.name)}for(s=0,o=(u=e.children).length;s<o;s++)this.createChildNode(i=u[s]),i.type===t.Element&&this.up();return this},S.prototype.dummy=function(){return this},S.prototype.node=function(t,e,n){var r;if(null==t)throw new Error("Missing node name.");if(this.root&&-1===this.currentLevel)throw new Error("Document can only have one root node. "+this.debugInfo(t));return this.openCurrent(),t=b(t),null==e&&(e={}),e=b(e),w(e)||(n=(r=[e,n])[0],e=r[1]),this.currentNode=new f(this,t,e),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,null!=n&&this.text(n),this},S.prototype.element=function(e,n,r){var i,s,o,a,u,c;if(this.currentNode&&this.currentNode.type===t.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(e)||w(e)||v(e))for(a=this.options.noValidation,this.options.noValidation=!0,(c=new h(this.options).element("TEMP_ROOT")).element(e),this.options.noValidation=a,s=0,o=(u=c.children).length;s<o;s++)this.createChildNode(i=u[s]),i.type===t.Element&&this.up();else this.node(e,n,r);return this},S.prototype.attribute=function(t,e){var r;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(t));if(null!=t&&(t=b(t)),w(t))for(r in t)E.call(t,r)&&this.attribute(r,t[r]);else v(e)&&(e=e.apply()),this.options.keepNullAttributes&&null==e?this.currentNode.attribs[t]=new n(this,t,""):null!=e&&(this.currentNode.attribs[t]=new n(this,t,e));return this},S.prototype.text=function(t){var e;return this.openCurrent(),e=new g(this,t),this.onData(this.writer.text(e,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.cdata=function(t){var e;return this.openCurrent(),e=new r(this,t),this.onData(this.writer.cdata(e,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.comment=function(t){var e;return this.openCurrent(),e=new i(this,t),this.onData(this.writer.comment(e,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.raw=function(t){var e;return this.openCurrent(),e=new p(this,t),this.onData(this.writer.raw(e,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.instruction=function(t,e){var n,r,i,s;if(this.openCurrent(),null!=t&&(t=b(t)),null!=e&&(e=b(e)),Array.isArray(t))for(n=0,i=t.length;n<i;n++)this.instruction(r=t[n]);else if(w(t))for(r in t)E.call(t,r)&&this.instruction(r,t[r]);else v(e)&&(e=e.apply()),s=new d(this,t,e),this.onData(this.writer.processingInstruction(s,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},S.prototype.declaration=function(t,e,n){var r;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return r=new c(this,t,e,n),this.onData(this.writer.declaration(r,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.doctype=function(t,e,n){if(this.openCurrent(),null==t)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new l(this,e,n),this.currentNode.rootNodeName=t,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},S.prototype.dtdElement=function(t,e){var n;return this.openCurrent(),n=new o(this,t,e),this.onData(this.writer.dtdElement(n,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.attList=function(t,e,n,r,i){var o;return this.openCurrent(),o=new s(this,t,e,n,r,i),this.onData(this.writer.dtdAttList(o,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.entity=function(t,e){var n;return this.openCurrent(),n=new a(this,!1,t,e),this.onData(this.writer.dtdEntity(n,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.pEntity=function(t,e){var n;return this.openCurrent(),n=new a(this,!0,t,e),this.onData(this.writer.dtdEntity(n,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.notation=function(t,e){var n;return this.openCurrent(),n=new u(this,t,e),this.onData(this.writer.dtdNotation(n,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},S.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},S.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},S.prototype.openNode=function(n){var r,i,s;if(!n.isOpen){if(this.root||0!==this.currentLevel||n.type!==t.Element||(this.root=n),r="",n.type===t.Element){for(i in this.writerOptions.state=e.OpenTag,r=this.writer.indent(n,this.writerOptions,this.currentLevel)+"<"+n.name,s=n.attribs)E.call(s,i)&&(r+=this.writer.attribute(s[i],this.writerOptions,this.currentLevel));r+=(n.children?">":"/>")+this.writer.endline(n,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,r=this.writer.indent(n,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+n.rootNodeName,n.pubID&&n.sysID?r+=' PUBLIC "'+n.pubID+'" "'+n.sysID+'"':n.sysID&&(r+=' SYSTEM "'+n.sysID+'"'),n.children?(r+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,r+=">"),r+=this.writer.endline(n,this.writerOptions,this.currentLevel);return this.onData(r,this.currentLevel),n.isOpen=!0}},S.prototype.closeNode=function(n){var r;if(!n.isClosed)return"",this.writerOptions.state=e.CloseTag,r=n.type===t.Element?this.writer.indent(n,this.writerOptions,this.currentLevel)+"</"+n.name+">"+this.writer.endline(n,this.writerOptions,this.currentLevel):this.writer.indent(n,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(n,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(r,this.currentLevel),n.isClosed=!0},S.prototype.onData=function(t,e){return this.documentStarted=!0,this.onDataCallback(t,e+1)},S.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},S.prototype.debugInfo=function(t){return null==t?"":"node: <"+t+">"},S.prototype.ele=function(){return this.element.apply(this,arguments)},S.prototype.nod=function(t,e,n){return this.node(t,e,n)},S.prototype.txt=function(t){return this.text(t)},S.prototype.dat=function(t){return this.cdata(t)},S.prototype.com=function(t){return this.comment(t)},S.prototype.ins=function(t,e){return this.instruction(t,e)},S.prototype.dec=function(t,e,n){return this.declaration(t,e,n)},S.prototype.dtd=function(t,e,n){return this.doctype(t,e,n)},S.prototype.e=function(t,e,n){return this.element(t,e,n)},S.prototype.n=function(t,e,n){return this.node(t,e,n)},S.prototype.t=function(t){return this.text(t)},S.prototype.d=function(t){return this.cdata(t)},S.prototype.c=function(t){return this.comment(t)},S.prototype.r=function(t){return this.raw(t)},S.prototype.i=function(t,e){return this.instruction(t,e)},S.prototype.att=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},S.prototype.a=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},S.prototype.ent=function(t,e){return this.entity(t,e)},S.prototype.pent=function(t,e){return this.pEntity(t,e)},S.prototype.not=function(t,e){return this.notation(t,e)},S}()}.call(os)),ss.exports}var us,cs,ls,hs={exports:{}},fs=hs.exports;function ds(){return us||(us=1,function(){var t,e,n,r={}.hasOwnProperty;t=br(),n=Ki(),e=Zi(),hs.exports=function(n){function i(t,e){this.stream=t,i.__super__.constructor.call(this,e)}return function(t,e){for(var n in e)r.call(e,n)&&(t[n]=e[n]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(i,n),i.prototype.endline=function(t,n,r){return t.isLastRootNode&&n.state===e.CloseTag?"":i.__super__.endline.call(this,t,n,r)},i.prototype.document=function(t,e){var n,r,i,s,o,a,u,c;for(n=r=0,s=(a=t.children).length;r<s;n=++r)a[n].isLastRootNode=n===t.children.length-1;for(e=this.filterOptions(e),c=[],i=0,o=(u=t.children).length;i<o;i++)c.push(this.writeChildNode(u[i],e,0));return c},i.prototype.attribute=function(t,e,n){return this.stream.write(i.__super__.attribute.call(this,t,e,n))},i.prototype.cdata=function(t,e,n){return this.stream.write(i.__super__.cdata.call(this,t,e,n))},i.prototype.comment=function(t,e,n){return this.stream.write(i.__super__.comment.call(this,t,e,n))},i.prototype.declaration=function(t,e,n){return this.stream.write(i.__super__.declaration.call(this,t,e,n))},i.prototype.docType=function(t,n,r){var i,s,o;if(r||(r=0),this.openNode(t,n,r),n.state=e.OpenTag,this.stream.write(this.indent(t,n,r)),this.stream.write("<!DOCTYPE "+t.root().name),t.pubID&&t.sysID?this.stream.write(' PUBLIC "'+t.pubID+'" "'+t.sysID+'"'):t.sysID&&this.stream.write(' SYSTEM "'+t.sysID+'"'),t.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(t,n,r)),n.state=e.InsideTag,i=0,s=(o=t.children).length;i<s;i++)this.writeChildNode(o[i],n,r+1);n.state=e.CloseTag,this.stream.write("]")}return n.state=e.CloseTag,this.stream.write(n.spaceBeforeSlash+">"),this.stream.write(this.endline(t,n,r)),n.state=e.None,this.closeNode(t,n,r)},i.prototype.element=function(n,i,s){var o,a,u,c,l,h,f;for(l in s||(s=0),this.openNode(n,i,s),i.state=e.OpenTag,this.stream.write(this.indent(n,i,s)+"<"+n.name),h=n.attribs)r.call(h,l)&&this.attribute(h[l],i,s);if(a=0===(o=n.children.length)?null:n.children[0],0===o||n.children.every((function(e){return(e.type===t.Text||e.type===t.Raw)&&""===e.value})))i.allowEmpty?(this.stream.write(">"),i.state=e.CloseTag,this.stream.write("</"+n.name+">")):(i.state=e.CloseTag,this.stream.write(i.spaceBeforeSlash+"/>"));else if(!i.pretty||1!==o||a.type!==t.Text&&a.type!==t.Raw||null==a.value){for(this.stream.write(">"+this.endline(n,i,s)),i.state=e.InsideTag,u=0,c=(f=n.children).length;u<c;u++)this.writeChildNode(f[u],i,s+1);i.state=e.CloseTag,this.stream.write(this.indent(n,i,s)+"</"+n.name+">")}else this.stream.write(">"),i.state=e.InsideTag,i.suppressPrettyCount++,this.writeChildNode(a,i,s+1),i.suppressPrettyCount--,i.state=e.CloseTag,this.stream.write("</"+n.name+">");return this.stream.write(this.endline(n,i,s)),i.state=e.None,this.closeNode(n,i,s)},i.prototype.processingInstruction=function(t,e,n){return this.stream.write(i.__super__.processingInstruction.call(this,t,e,n))},i.prototype.raw=function(t,e,n){return this.stream.write(i.__super__.raw.call(this,t,e,n))},i.prototype.text=function(t,e,n){return this.stream.write(i.__super__.text.call(this,t,e,n))},i.prototype.dtdAttList=function(t,e,n){return this.stream.write(i.__super__.dtdAttList.call(this,t,e,n))},i.prototype.dtdElement=function(t,e,n){return this.stream.write(i.__super__.dtdElement.call(this,t,e,n))},i.prototype.dtdEntity=function(t,e,n){return this.stream.write(i.__super__.dtdEntity.call(this,t,e,n))},i.prototype.dtdNotation=function(t,e,n){return this.stream.write(i.__super__.dtdNotation.call(this,t,e,n))},i}(n)}.call(fs)),hs.exports}function ps(){return ls||(ls=1,function(){var t,e,n,r,i,s={}.hasOwnProperty;cs||(cs=1,function(){var t,e,n,r,i,s,o,a,u,c;c=Jn(),a=c.assign,u=c.isFunction,n=Qn(),r=rs(),i=as(),o=ts(),s=ds(),t=br(),e=Zi(),Yn.create=function(t,e,n,i){var s,o;if(null==t)throw new Error("Root element needs a name.");return i=a({},e,n,i),o=(s=new r(i)).element(t),i.headless||(s.declaration(i),null==i.pubID&&null==i.sysID||s.dtd(i)),o},Yn.begin=function(t,e,n){var s;return u(t)&&(e=(s=[t,e])[0],n=s[1],t={}),e?new i(t,e,n):new r(t)},Yn.stringWriter=function(t){return new o(t)},Yn.streamWriter=function(t,e){return new s(t,e)},Yn.implementation=new n,Yn.nodeType=t,Yn.writerState=e}.call(Yn)),t=Yn,e=Wn().defaults,r=function(t){return"string"==typeof t&&(t.indexOf("&")>=0||t.indexOf(">")>=0||t.indexOf("<")>=0)},i=function(t){return"<![CDATA["+n(t)+"]]>"},n=function(t){return t.replace("]]>","]]]]><![CDATA[>")},Vn.Builder=function(){function n(t){var n,r;for(n in this.options={},r=e[.2])s.call(r,n)&&(this.options[n]=r[n]);for(n in t)s.call(t,n)&&(this.options[n]=t[n])}return n.prototype.buildObject=function(n){var o,a,u,c,l,h;return o=this.options.attrkey,a=this.options.charkey,1===Object.keys(n).length&&this.options.rootName===e[.2].rootName?n=n[l=Object.keys(n)[0]]:l=this.options.rootName,h=this,u=function(t,e){var n,c,l,f,d;if("object"!=typeof e)h.options.cdata&&r(e)?t.raw(i(e)):t.txt(e);else if(Array.isArray(e)){for(f in e)if(s.call(e,f))for(d in c=e[f])l=c[d],t=u(t.ele(d),l).up()}else for(d in e)if(s.call(e,d))if(c=e[d],d===o){if("object"==typeof c)for(n in c)t=t.att(n,c[n])}else if(d===a)t=h.options.cdata&&r(c)?t.raw(i(c)):t.txt(c);else if(Array.isArray(c))for(f in c)s.call(c,f)&&(t="string"==typeof(l=c[f])?h.options.cdata&&r(l)?t.ele(d).raw(i(l)).up():t.ele(d,l).up():u(t.ele(d),l).up());else"object"==typeof c?t=u(t.ele(d),c).up():"string"==typeof c&&h.options.cdata&&r(c)?t=t.ele(d).raw(i(c)).up():(null==c&&(c=""),t=t.ele(d,c.toString()).up());return t},c=t.create(l,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),u(c,n).end(this.options.renderOpts)},n}()}.call(Vn)),Vn}var ys={},ms={};class gs{constructor(t="utf8"){this.encoding=(t=>{if(!t)return"utf8";const e=String(t).toLowerCase();switch(e){case"utf-8":return"utf8";case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";default:return e}})(t),this._decoder="undefined"!=typeof TextDecoder?new TextDecoder("utf8"===this.encoding?"utf-8":this.encoding):null}write(t){if(null==t)return"";if("string"==typeof t)return t;const e=(t=>t instanceof Uint8Array?t:t&&void 0!==t.buffer?new Uint8Array(t.buffer,t.byteOffset||0,t.byteLength||t.buffer.byteLength||0):t instanceof ArrayBuffer?new Uint8Array(t):Array.isArray(t)?Uint8Array.from(t):"number"==typeof t?Uint8Array.of(255&t):new Uint8Array)(t);if(0===e.length)return"";if(this._decoder)try{return this._decoder.decode(e,{stream:!0})}catch(t){"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("[string_decoder polyfill] Falling back to charCode decoding",t)}return(t=>{let e="";for(let n=0;n<t.length;n+=1)e+=String.fromCharCode(t[n]);return e})(e)}end(t){return null==t?"":this.write(t)}}var bs,vs=l(Object.freeze({__proto__:null,StringDecoder:gs,default:{StringDecoder:gs}}));function ws(){return bs||(bs=1,function(t){t.parser=function(t,e){return new r(t,e)},t.SAXParser=r,t.SAXStream=s,t.createStream=function(t,e){return new s(t,e)},t.MAX_BUFFER_LENGTH=65536;var e,n=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function r(e,i){if(!(this instanceof r))return new r(e,i);var s=this;!function(t){for(var e=0,r=n.length;e<r;e++)t[n[e]]=""}(s),s.q=s.c="",s.bufferCheckPosition=t.MAX_BUFFER_LENGTH,s.opt=i||{},s.opt.lowercase=s.opt.lowercase||s.opt.lowercasetags,s.looseCase=s.opt.lowercase?"toLowerCase":"toUpperCase",s.tags=[],s.closed=s.closedRoot=s.sawRoot=!1,s.tag=s.error=null,s.strict=!!e,s.noscript=!(!e&&!s.opt.noscript),s.state=w.BEGIN,s.strictEntities=s.opt.strictEntities,s.ENTITIES=Object.create(s.strictEntities?t.XML_ENTITIES:t.ENTITIES),s.attribList=[],s.opt.xmlns&&(s.ns=Object.create(l)),void 0===s.opt.unquotedAttributeValues&&(s.opt.unquotedAttributeValues=!e),s.trackPosition=!1!==s.opt.position,s.trackPosition&&(s.position=s.line=s.column=0),S(s,"onready")}t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(t){function e(){}return e.prototype=t,new e}),Object.keys||(Object.keys=function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e}),r.prototype={end:function(){k(this)},write:function(e){var r=this;if(this.error)throw this.error;if(r.closed)return F(r,"Cannot write after close. Assign an onready handler.");if(null===e)return k(r);"object"==typeof e&&(e=e.toString());for(var i=0,s="";s=j(e,i++),r.c=s,s;)switch(r.trackPosition&&(r.position++,"\n"===s?(r.line++,r.column=0):r.column++),r.state){case w.BEGIN:if(r.state=w.BEGIN_WHITESPACE,"\ufeff"===s)continue;L(r,s);continue;case w.BEGIN_WHITESPACE:L(r,s);continue;case w.TEXT:if(r.sawRoot&&!r.closedRoot){for(var u=i-1;s&&"<"!==s&&"&"!==s;)(s=j(e,i++))&&r.trackPosition&&(r.position++,"\n"===s?(r.line++,r.column=0):r.column++);r.textNode+=e.substring(u,i-1)}"<"!==s||r.sawRoot&&r.closedRoot&&!r.strict?(y(s)||r.sawRoot&&!r.closedRoot||T(r,"Text data outside of root node."),"&"===s?r.state=w.TEXT_ENTITY:r.textNode+=s):(r.state=w.OPEN_WAKA,r.startTagPosition=r.position);continue;case w.SCRIPT:"<"===s?r.state=w.SCRIPT_ENDING:r.script+=s;continue;case w.SCRIPT_ENDING:"/"===s?r.state=w.CLOSE_TAG:(r.script+="<"+s,r.state=w.SCRIPT);continue;case w.OPEN_WAKA:"!"===s?(r.state=w.SGML_DECL,r.sgmlDecl=""):y(s)||(b(h,s)?(r.state=w.OPEN_TAG,r.tagName=s):"/"===s?(r.state=w.CLOSE_TAG,r.tagName=""):"?"===s?(r.state=w.PROC_INST,r.procInstName=r.procInstBody=""):(T(r,"Unencoded <"),r.startTagPosition+1<r.position&&(s=new Array(r.position-r.startTagPosition).join(" ")+s),r.textNode+="<"+s,r.state=w.TEXT));continue;case w.SGML_DECL:if(r.sgmlDecl+s==="--"){r.state=w.COMMENT,r.comment="",r.sgmlDecl="";continue}r.doctype&&!0!==r.doctype&&r.sgmlDecl?(r.state=w.DOCTYPE_DTD,r.doctype+="<!"+r.sgmlDecl+s,r.sgmlDecl=""):(r.sgmlDecl+s).toUpperCase()===o?(E(r,"onopencdata"),r.state=w.CDATA,r.sgmlDecl="",r.cdata=""):(r.sgmlDecl+s).toUpperCase()===a?(r.state=w.DOCTYPE,(r.doctype||r.sawRoot)&&T(r,"Inappropriately located doctype declaration"),r.doctype="",r.sgmlDecl=""):">"===s?(E(r,"onsgmldeclaration",r.sgmlDecl),r.sgmlDecl="",r.state=w.TEXT):m(s)?(r.state=w.SGML_DECL_QUOTED,r.sgmlDecl+=s):r.sgmlDecl+=s;continue;case w.SGML_DECL_QUOTED:s===r.q&&(r.state=w.SGML_DECL,r.q=""),r.sgmlDecl+=s;continue;case w.DOCTYPE:">"===s?(r.state=w.TEXT,E(r,"ondoctype",r.doctype),r.doctype=!0):(r.doctype+=s,"["===s?r.state=w.DOCTYPE_DTD:m(s)&&(r.state=w.DOCTYPE_QUOTED,r.q=s));continue;case w.DOCTYPE_QUOTED:r.doctype+=s,s===r.q&&(r.q="",r.state=w.DOCTYPE);continue;case w.DOCTYPE_DTD:"]"===s?(r.doctype+=s,r.state=w.DOCTYPE):"<"===s?(r.state=w.OPEN_WAKA,r.startTagPosition=r.position):m(s)?(r.doctype+=s,r.state=w.DOCTYPE_DTD_QUOTED,r.q=s):r.doctype+=s;continue;case w.DOCTYPE_DTD_QUOTED:r.doctype+=s,s===r.q&&(r.state=w.DOCTYPE_DTD,r.q="");continue;case w.COMMENT:"-"===s?r.state=w.COMMENT_ENDING:r.comment+=s;continue;case w.COMMENT_ENDING:"-"===s?(r.state=w.COMMENT_ENDED,r.comment=C(r.opt,r.comment),r.comment&&E(r,"oncomment",r.comment),r.comment=""):(r.comment+="-"+s,r.state=w.COMMENT);continue;case w.COMMENT_ENDED:">"!==s?(T(r,"Malformed comment"),r.comment+="--"+s,r.state=w.COMMENT):r.state=r.doctype&&!0!==r.doctype?w.DOCTYPE_DTD:w.TEXT;continue;case w.CDATA:"]"===s?r.state=w.CDATA_ENDING:r.cdata+=s;continue;case w.CDATA_ENDING:"]"===s?r.state=w.CDATA_ENDING_2:(r.cdata+="]"+s,r.state=w.CDATA);continue;case w.CDATA_ENDING_2:">"===s?(r.cdata&&E(r,"oncdata",r.cdata),E(r,"onclosecdata"),r.cdata="",r.state=w.TEXT):"]"===s?r.cdata+="]":(r.cdata+="]]"+s,r.state=w.CDATA);continue;case w.PROC_INST:"?"===s?r.state=w.PROC_INST_ENDING:y(s)?r.state=w.PROC_INST_BODY:r.procInstName+=s;continue;case w.PROC_INST_BODY:if(!r.procInstBody&&y(s))continue;"?"===s?r.state=w.PROC_INST_ENDING:r.procInstBody+=s;continue;case w.PROC_INST_ENDING:">"===s?(E(r,"onprocessinginstruction",{name:r.procInstName,body:r.procInstBody}),r.procInstName=r.procInstBody="",r.state=w.TEXT):(r.procInstBody+="?"+s,r.state=w.PROC_INST_BODY);continue;case w.OPEN_TAG:b(f,s)?r.tagName+=s:(M(r),">"===s?N(r):"/"===s?r.state=w.OPEN_TAG_SLASH:(y(s)||T(r,"Invalid character in tag name"),r.state=w.ATTRIB));continue;case w.OPEN_TAG_SLASH:">"===s?(N(r,!0),A(r)):(T(r,"Forward-slash in opening tag not followed by >"),r.state=w.ATTRIB);continue;case w.ATTRIB:if(y(s))continue;">"===s?N(r):"/"===s?r.state=w.OPEN_TAG_SLASH:b(h,s)?(r.attribName=s,r.attribValue="",r.state=w.ATTRIB_NAME):T(r,"Invalid attribute name");continue;case w.ATTRIB_NAME:"="===s?r.state=w.ATTRIB_VALUE:">"===s?(T(r,"Attribute without value"),r.attribValue=r.attribName,_(r),N(r)):y(s)?r.state=w.ATTRIB_NAME_SAW_WHITE:b(f,s)?r.attribName+=s:T(r,"Invalid attribute name");continue;case w.ATTRIB_NAME_SAW_WHITE:if("="===s)r.state=w.ATTRIB_VALUE;else{if(y(s))continue;T(r,"Attribute without value"),r.tag.attributes[r.attribName]="",r.attribValue="",E(r,"onattribute",{name:r.attribName,value:""}),r.attribName="",">"===s?N(r):b(h,s)?(r.attribName=s,r.state=w.ATTRIB_NAME):(T(r,"Invalid attribute name"),r.state=w.ATTRIB)}continue;case w.ATTRIB_VALUE:if(y(s))continue;m(s)?(r.q=s,r.state=w.ATTRIB_VALUE_QUOTED):(r.opt.unquotedAttributeValues||F(r,"Unquoted attribute value"),r.state=w.ATTRIB_VALUE_UNQUOTED,r.attribValue=s);continue;case w.ATTRIB_VALUE_QUOTED:if(s!==r.q){"&"===s?r.state=w.ATTRIB_VALUE_ENTITY_Q:r.attribValue+=s;continue}_(r),r.q="",r.state=w.ATTRIB_VALUE_CLOSED;continue;case w.ATTRIB_VALUE_CLOSED:y(s)?r.state=w.ATTRIB:">"===s?N(r):"/"===s?r.state=w.OPEN_TAG_SLASH:b(h,s)?(T(r,"No whitespace between attributes"),r.attribName=s,r.attribValue="",r.state=w.ATTRIB_NAME):T(r,"Invalid attribute name");continue;case w.ATTRIB_VALUE_UNQUOTED:if(!g(s)){"&"===s?r.state=w.ATTRIB_VALUE_ENTITY_U:r.attribValue+=s;continue}_(r),">"===s?N(r):r.state=w.ATTRIB;continue;case w.CLOSE_TAG:if(r.tagName)">"===s?A(r):b(f,s)?r.tagName+=s:r.script?(r.script+="</"+r.tagName,r.tagName="",r.state=w.SCRIPT):(y(s)||T(r,"Invalid tagname in closing tag"),r.state=w.CLOSE_TAG_SAW_WHITE);else{if(y(s))continue;v(h,s)?r.script?(r.script+="</"+s,r.state=w.SCRIPT):T(r,"Invalid tagname in closing tag."):r.tagName=s}continue;case w.CLOSE_TAG_SAW_WHITE:if(y(s))continue;">"===s?A(r):T(r,"Invalid characters in closing tag");continue;case w.TEXT_ENTITY:case w.ATTRIB_VALUE_ENTITY_Q:case w.ATTRIB_VALUE_ENTITY_U:var c,l;switch(r.state){case w.TEXT_ENTITY:c=w.TEXT,l="textNode";break;case w.ATTRIB_VALUE_ENTITY_Q:c=w.ATTRIB_VALUE_QUOTED,l="attribValue";break;case w.ATTRIB_VALUE_ENTITY_U:c=w.ATTRIB_VALUE_UNQUOTED,l="attribValue"}if(";"===s){var x=D(r);r.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(x)?(r.entity="",r.state=c,r.write(x)):(r[l]+=x,r.entity="",r.state=c)}else b(r.entity.length?p:d,s)?r.entity+=s:(T(r,"Invalid character in entity name"),r[l]+="&"+r.entity+s,r.entity="",r.state=c);continue;default:throw new Error(r,"Unknown state: "+r.state)}return r.position>=r.bufferCheckPosition&&function(e){for(var r=Math.max(t.MAX_BUFFER_LENGTH,10),i=0,s=0,o=n.length;s<o;s++){var a=e[n[s]].length;if(a>r)switch(n[s]){case"textNode":O(e);break;case"cdata":E(e,"oncdata",e.cdata),e.cdata="";break;case"script":E(e,"onscript",e.script),e.script="";break;default:F(e,"Max buffer length exceeded: "+n[s])}i=Math.max(i,a)}e.bufferCheckPosition=t.MAX_BUFFER_LENGTH-i+e.position}(r),r}
|
|
10
|
-
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){!function(t){O(t),""!==t.cdata&&(E(t,"oncdata",t.cdata),t.cdata=""),""!==t.script&&(E(t,"onscript",t.script),t.script="")}(this)}};try{e=require("stream").Stream}catch(t){e=function(){}}e||(e=function(){});var i=t.EVENTS.filter((function(t){return"error"!==t&&"end"!==t}));function s(t,n){if(!(this instanceof s))return new s(t,n);e.apply(this),this._parser=new r(t,n),this.writable=!0,this.readable=!0;var o=this;this._parser.onend=function(){o.emit("end")},this._parser.onerror=function(t){o.emit("error",t),o._parser.error=null},this._decoder=null,i.forEach((function(t){Object.defineProperty(o,"on"+t,{get:function(){return o._parser["on"+t]},set:function(e){if(!e)return o.removeAllListeners(t),o._parser["on"+t]=e,e;o.on(t,e)},enumerable:!0,configurable:!1})}))}(s.prototype=Object.create(e.prototype,{constructor:{value:s}})).write=function(t){return"function"==typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(t)&&(this._decoder||(this._decoder=new(0,vs.StringDecoder)("utf8")),t=this._decoder.write(t)),this._parser.write(t.toString()),this.emit("data",t),!0},s.prototype.end=function(t){return t&&t.length&&this.write(t),this._parser.end(),!0},s.prototype.on=function(t,n){var r=this;return r._parser["on"+t]||-1===i.indexOf(t)||(r._parser["on"+t]=function(){var e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);e.splice(0,0,t),r.emit.apply(r,e)}),e.prototype.on.call(r,t,n)};var o="[CDATA[",a="DOCTYPE",u="http://www.w3.org/XML/1998/namespace",c="http://www.w3.org/2000/xmlns/",l={xml:u,xmlns:c},h=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,f=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,d=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,p=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function y(t){return" "===t||"\n"===t||"\r"===t||"\t"===t}function m(t){return'"'===t||"'"===t}function g(t){return">"===t||y(t)}function b(t,e){return t.test(e)}function v(t,e){return!b(t,e)}var w=0;for(var x in t.STATE={BEGIN:w++,BEGIN_WHITESPACE:w++,TEXT:w++,TEXT_ENTITY:w++,OPEN_WAKA:w++,SGML_DECL:w++,SGML_DECL_QUOTED:w++,DOCTYPE:w++,DOCTYPE_QUOTED:w++,DOCTYPE_DTD:w++,DOCTYPE_DTD_QUOTED:w++,COMMENT_STARTING:w++,COMMENT:w++,COMMENT_ENDING:w++,COMMENT_ENDED:w++,CDATA:w++,CDATA_ENDING:w++,CDATA_ENDING_2:w++,PROC_INST:w++,PROC_INST_BODY:w++,PROC_INST_ENDING:w++,OPEN_TAG:w++,OPEN_TAG_SLASH:w++,ATTRIB:w++,ATTRIB_NAME:w++,ATTRIB_NAME_SAW_WHITE:w++,ATTRIB_VALUE:w++,ATTRIB_VALUE_QUOTED:w++,ATTRIB_VALUE_CLOSED:w++,ATTRIB_VALUE_UNQUOTED:w++,ATTRIB_VALUE_ENTITY_Q:w++,ATTRIB_VALUE_ENTITY_U:w++,CLOSE_TAG:w++,CLOSE_TAG_SAW_WHITE:w++,SCRIPT:w++,SCRIPT_ENDING:w++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach((function(e){var n=t.ENTITIES[e],r="number"==typeof n?String.fromCharCode(n):n;t.ENTITIES[e]=r})),t.STATE)t.STATE[t.STATE[x]]=x;function S(t,e,n){t[e]&&t[e](n)}function E(t,e,n){t.textNode&&O(t),S(t,e,n)}function O(t){t.textNode=C(t.opt,t.textNode),t.textNode&&S(t,"ontext",t.textNode),t.textNode=""}function C(t,e){return t.trim&&(e=e.trim()),t.normalize&&(e=e.replace(/\s+/g," ")),e}function F(t,e){return O(t),t.trackPosition&&(e+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c),e=new Error(e),t.error=e,S(t,"onerror",e),t}function k(t){return t.sawRoot&&!t.closedRoot&&T(t,"Unclosed root tag"),t.state!==w.BEGIN&&t.state!==w.BEGIN_WHITESPACE&&t.state!==w.TEXT&&F(t,"Unexpected end"),O(t),t.c="",t.closed=!0,S(t,"onend"),r.call(t,t.strict,t.opt),t}function T(t,e){if("object"!=typeof t||!(t instanceof r))throw new Error("bad call to strictFail");t.strict&&F(t,e)}function M(t){t.strict||(t.tagName=t.tagName[t.looseCase]());var e=t.tags[t.tags.length-1]||t,n=t.tag={name:t.tagName,attributes:{}};t.opt.xmlns&&(n.ns=e.ns),t.attribList.length=0,E(t,"onopentagstart",n)}function I(t,e){var n=t.indexOf(":")<0?["",t]:t.split(":"),r=n[0],i=n[1];return e&&"xmlns"===t&&(r="xmlns",i=""),{prefix:r,local:i}}function _(t){if(t.strict||(t.attribName=t.attribName[t.looseCase]()),-1!==t.attribList.indexOf(t.attribName)||t.tag.attributes.hasOwnProperty(t.attribName))t.attribName=t.attribValue="";else{if(t.opt.xmlns){var e=I(t.attribName,!0),n=e.local;if("xmlns"===e.prefix)if("xml"===n&&t.attribValue!==u)T(t,"xml: prefix must be bound to "+u+"\nActual: "+t.attribValue);else if("xmlns"===n&&t.attribValue!==c)T(t,"xmlns: prefix must be bound to "+c+"\nActual: "+t.attribValue);else{var r=t.tag,i=t.tags[t.tags.length-1]||t;r.ns===i.ns&&(r.ns=Object.create(i.ns)),r.ns[n]=t.attribValue}t.attribList.push([t.attribName,t.attribValue])}else t.tag.attributes[t.attribName]=t.attribValue,E(t,"onattribute",{name:t.attribName,value:t.attribValue});t.attribName=t.attribValue=""}}function N(t,e){if(t.opt.xmlns){var n=t.tag,r=I(t.tagName);n.prefix=r.prefix,n.local=r.local,n.uri=n.ns[r.prefix]||"",n.prefix&&!n.uri&&(T(t,"Unbound namespace prefix: "+JSON.stringify(t.tagName)),n.uri=r.prefix),n.ns&&(t.tags[t.tags.length-1]||t).ns!==n.ns&&Object.keys(n.ns).forEach((function(e){E(t,"onopennamespace",{prefix:e,uri:n.ns[e]})}));for(var i=0,s=t.attribList.length;i<s;i++){var o=t.attribList[i],a=o[0],u=o[1],c=I(a,!0),l=c.prefix,h=""===l?"":n.ns[l]||"",f={name:a,value:u,prefix:l,local:c.local,uri:h};l&&"xmlns"!==l&&!h&&(T(t,"Unbound namespace prefix: "+JSON.stringify(l)),f.uri=l),t.tag.attributes[a]=f,E(t,"onattribute",f)}t.attribList.length=0}t.tag.isSelfClosing=!!e,t.sawRoot=!0,t.tags.push(t.tag),E(t,"onopentag",t.tag),e||(t.state=t.noscript||"script"!==t.tagName.toLowerCase()?w.TEXT:w.SCRIPT,t.tag=null,t.tagName=""),t.attribName=t.attribValue="",t.attribList.length=0}function A(t){if(!t.tagName)return T(t,"Weird empty close tag."),t.textNode+="</>",void(t.state=w.TEXT);if(t.script){if("script"!==t.tagName)return t.script+="</"+t.tagName+">",t.tagName="",void(t.state=w.SCRIPT);E(t,"onscript",t.script),t.script=""}var e=t.tags.length,n=t.tagName;t.strict||(n=n[t.looseCase]());for(var r=n;e--&&t.tags[e].name!==r;)T(t,"Unexpected close tag");if(e<0)return T(t,"Unmatched closing tag: "+t.tagName),t.textNode+="</"+t.tagName+">",void(t.state=w.TEXT);t.tagName=n;for(var i=t.tags.length;i-- >e;){var s=t.tag=t.tags.pop();t.tagName=t.tag.name,E(t,"onclosetag",t.tagName);var o={};for(var a in s.ns)o[a]=s.ns[a];t.opt.xmlns&&s.ns!==(t.tags[t.tags.length-1]||t).ns&&Object.keys(s.ns).forEach((function(e){E(t,"onclosenamespace",{prefix:e,uri:s.ns[e]})}))}0===e&&(t.closedRoot=!0),t.tagName=t.attribValue=t.attribName="",t.attribList.length=0,t.state=w.TEXT}function D(t){var e,n=t.entity,r=n.toLowerCase(),i="";return t.ENTITIES[n]?t.ENTITIES[n]:t.ENTITIES[r]?t.ENTITIES[r]:("#"===(n=r).charAt(0)&&("x"===n.charAt(1)?(n=n.slice(2),i=(e=parseInt(n,16)).toString(16)):(n=n.slice(1),i=(e=parseInt(n,10)).toString(10))),n=n.replace(/^0+/,""),isNaN(e)||i.toLowerCase()!==n?(T(t,"Invalid character entity"),"&"+t.entity+";"):String.fromCodePoint(e))}function L(t,e){"<"===e?(t.state=w.OPEN_WAKA,t.startTagPosition=t.position):y(e)||(T(t,"Non-whitespace before first tag."),t.textNode=e,t.state=w.TEXT)}function j(t,e){var n="";return e<t.length&&(n=t.charAt(e)),n}w=t.STATE,String.fromCodePoint||function(){var t=String.fromCharCode,e=Math.floor,n=function(){var n=[],r=-1,i=arguments.length;if(!i)return"";for(var s="";++r<i;){var o=Number(arguments[r]);if(!isFinite(o)||o<0||o>1114111||e(o)!==o)throw RangeError("Invalid code point: "+o);o<=65535?n.push(o):n.push(55296+((o-=65536)>>10),o%1024+56320),(r+1===i||n.length>16384)&&(s+=t.apply(null,n),n.length=0)}return s};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:n,configurable:!0,writable:!0}):String.fromCodePoint=n}()}(ms)),ms}const xs=Symbol("listenersMap");class Ss{constructor(){this[xs]=new Map}addListener(t,e){return this.on(t,e)}on(t,e){if("function"!=typeof e)throw new TypeError("listener must be a function");const n=this[xs],r=n.get(t);return r?r.push(e):n.set(t,[e]),this}once(t,e){if("function"!=typeof e)throw new TypeError("listener must be a function");const n=(...r)=>{this.off(t,n),e.apply(this,r)};return n.listener=e,this.on(t,n)}removeListener(t,e){if(!e)return this;const n=this[xs],r=n.get(t);if(!r)return this;for(let t=r.length-1;t>=0;t-=1){const n=r[t];n!==e&&n.listener!==e||r.splice(t,1)}return 0===r.length&&n.delete(t),this}off(t,e){return this.removeListener(t,e)}removeAllListeners(t){const e=this[xs];return void 0===t?e.clear():e.delete(t),this}emit(t,...e){const n=this[xs].get(t);return!(!n||0===n.length||(n.slice().forEach((t=>t.apply(this,e))),0))}listeners(t){const e=this[xs].get(t);return e?e.slice():[]}listenerCount(t){return this.listeners(t).length}}Ss.prototype.addListener=Ss.prototype.on;var Es,Os=l(Object.freeze({__proto__:null,EventEmitter:Ss,default:{EventEmitter:Ss,defaultMaxListeners:10},defaultMaxListeners:10})),Cs={};function Fs(){return Es||(Es=1,function(){Cs.stripBOM=function(t){return"\ufeff"===t[0]?t.substring(1):t}}.call(Cs)),Cs}var ks,Ts={};function Ms(){return ks||(ks=1,function(){var t;t=new RegExp(/(?!xmlns)^.*:/),Ts.normalize=function(t){return t.toLowerCase()},Ts.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},Ts.stripPrefix=function(e){return e.replace(t,"")},Ts.parseNumbers=function(t){return isNaN(t)||(t=t%1==0?parseInt(t,10):parseFloat(t)),t},Ts.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t="true"===t.toLowerCase()),t}}.call(Ts)),Ts}var Is,_s,Ns,As={};function Ds(){return _s||(_s=1,function(t){(function(){var e,n,r,i,s,o,a,u,c,l=function(t,e){return function(){return t.apply(e,arguments)}},h={}.hasOwnProperty;u=ws(),i=Os,e=Fs(),a=Ms(),c=function(){if(Is)return As;Is=1,As.every=function(t){return new n(t)};var t={millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5};for(var e in t)"millisecond"===e?t.ms=t[e]:t[e.charAt(0)]=t[e],t[e+"s"]=t[e];function n(e){this.count=0;var n=function(e){var n=e.match(r);return n&&t[n[2]]?n.slice(1):null}(e);n&&(this.time=Number(n[0])*t[n[1]],this.type=n[1])}n.prototype.do=function(t){this.time&&(this.interval=setInterval((function(){e.count++,t.call(e)}),this.time));var e=this;return this},n.prototype.stop=function(){return this.interval&&(clearInterval(this.interval),delete this.interval),this};var r=/^\s*(\d+(?:\.\d+)?)\s*([a-z]+)\s*$/;return As}().setImmediate,n=Wn().defaults,s=function(t){return"object"==typeof t&&null!=t&&0===Object.keys(t).length},o=function(t,e,n){var r,i;for(r=0,i=t.length;r<i;r++)e=(0,t[r])(e,n);return e},r=function(t,e,n){var r;return(r=Object.create(null)).value=n,r.writable=!0,r.enumerable=!0,r.configurable=!0,Object.defineProperty(t,e,r)},t.Parser=function(i){function f(e){var r,i;if(this.parseStringPromise=l(this.parseStringPromise,this),this.parseString=l(this.parseString,this),this.reset=l(this.reset,this),this.assignOrPush=l(this.assignOrPush,this),this.processAsync=l(this.processAsync,this),!(this instanceof t.Parser))return new t.Parser(e);for(r in this.options={},i=n[.2])h.call(i,r)&&(this.options[r]=i[r]);for(r in e)h.call(e,r)&&(this.options[r]=e[r]);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(a.normalize)),this.reset()}return function(t,e){for(var n in e)h.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(f,i),f.prototype.processAsync=function(){var t,e;try{return this.remaining.length<=this.options.chunkSize?(t=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(t),this.saxParser.close()):(t=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(t),c(this.processAsync))}catch(t){if(e=t,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(e)}},f.prototype.assignOrPush=function(t,e,n){return e in t?(t[e]instanceof Array||r(t,e,[t[e]]),t[e].push(n)):r(t,e,this.options.explicitArray?[n]:n)},f.prototype.reset=function(){var t,e,n,i,a;return this.removeAllListeners(),this.saxParser=u.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(a=this,function(t){if(a.saxParser.resume(),!a.saxParser.errThrown)return a.saxParser.errThrown=!0,a.emit("error",t)}),this.saxParser.onend=function(t){return function(){if(!t.saxParser.ended)return t.saxParser.ended=!0,t.emit("end",t.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,i=[],t=this.options.attrkey,e=this.options.charkey,this.saxParser.onopentag=function(n){return function(s){var a,u,c,l,f;if((c={})[e]="",!n.options.ignoreAttrs)for(a in f=s.attributes)h.call(f,a)&&(t in c||n.options.mergeAttrs||(c[t]={}),u=n.options.attrValueProcessors?o(n.options.attrValueProcessors,s.attributes[a],a):s.attributes[a],l=n.options.attrNameProcessors?o(n.options.attrNameProcessors,a):a,n.options.mergeAttrs?n.assignOrPush(c,l,u):r(c[t],l,u));return c["#name"]=n.options.tagNameProcessors?o(n.options.tagNameProcessors,s.name):s.name,n.options.xmlns&&(c[n.options.xmlnskey]={uri:s.uri,local:s.local}),i.push(c)}}(this),this.saxParser.onclosetag=function(t){return function(){var n,a,u,c,l,f,d,p,y,m;if(f=i.pop(),l=f["#name"],t.options.explicitChildren&&t.options.preserveChildrenOrder||delete f["#name"],!0===f.cdata&&(n=f.cdata,delete f.cdata),y=i[i.length-1],f[e].match(/^\s*$/)&&!n?(a=f[e],delete f[e]):(t.options.trim&&(f[e]=f[e].trim()),t.options.normalize&&(f[e]=f[e].replace(/\s{2,}/g," ").trim()),f[e]=t.options.valueProcessors?o(t.options.valueProcessors,f[e],l):f[e],1===Object.keys(f).length&&e in f&&!t.EXPLICIT_CHARKEY&&(f=f[e])),s(f)&&(f="function"==typeof t.options.emptyTag?t.options.emptyTag():""!==t.options.emptyTag?t.options.emptyTag:a),null!=t.options.validator&&(m="/"+function(){var t,e,n;for(n=[],t=0,e=i.length;t<e;t++)n.push((c=i[t])["#name"]);return n}().concat(l).join("/"),function(){try{return f=t.options.validator(m,y&&y[l],f)}catch(e){return t.emit("error",e)}}()),t.options.explicitChildren&&!t.options.mergeAttrs&&"object"==typeof f)if(t.options.preserveChildrenOrder){if(y){for(u in y[t.options.childkey]=y[t.options.childkey]||[],d={},f)h.call(f,u)&&r(d,u,f[u]);y[t.options.childkey].push(d),delete f["#name"],1===Object.keys(f).length&&e in f&&!t.EXPLICIT_CHARKEY&&(f=f[e])}}else c={},t.options.attrkey in f&&(c[t.options.attrkey]=f[t.options.attrkey],delete f[t.options.attrkey]),!t.options.charsAsChildren&&t.options.charkey in f&&(c[t.options.charkey]=f[t.options.charkey],delete f[t.options.charkey]),Object.getOwnPropertyNames(f).length>0&&(c[t.options.childkey]=f),f=c;return i.length>0?t.assignOrPush(y,l,f):(t.options.explicitRoot&&(p=f,r(f={},l,p)),t.resultObject=f,t.saxParser.ended=!0,t.emit("end",t.resultObject))}}(this),n=function(t){return function(n){var r,s;if(s=i[i.length-1])return s[e]+=n,t.options.explicitChildren&&t.options.preserveChildrenOrder&&t.options.charsAsChildren&&(t.options.includeWhiteChars||""!==n.replace(/\\n/g,"").trim())&&(s[t.options.childkey]=s[t.options.childkey]||[],(r={"#name":"__text__"})[e]=n,t.options.normalize&&(r[e]=r[e].replace(/\s{2,}/g," ").trim()),s[t.options.childkey].push(r)),s}}(this),this.saxParser.ontext=n,this.saxParser.oncdata=function(t){var e;if(e=n(t))return e.cdata=!0}},f.prototype.parseString=function(t,n){var r;null!=n&&"function"==typeof n&&(this.on("end",(function(t){return this.reset(),n(null,t)})),this.on("error",(function(t){return this.reset(),n(t)})));try{return""===(t=t.toString()).trim()?(this.emit("end",null),!0):(t=e.stripBOM(t),this.options.async?(this.remaining=t,c(this.processAsync),this.saxParser):this.saxParser.write(t).close())}catch(t){if(r=t,!this.saxParser.errThrown&&!this.saxParser.ended)return this.emit("error",r),this.saxParser.errThrown=!0;if(this.saxParser.ended)throw r}},f.prototype.parseStringPromise=function(t){return new Promise((e=this,function(n,r){return e.parseString(t,(function(t,e){return t?r(t):n(e)}))}));var e},f}(i),t.parseString=function(e,n,r){var i,s;return null!=r?("function"==typeof r&&(i=r),"object"==typeof n&&(s=n)):("function"==typeof n&&(i=n),s={}),new t.Parser(s).parseString(e,i)},t.parseStringPromise=function(e,n){var r;return"object"==typeof n&&(r=n),new t.Parser(r).parseStringPromise(e)}}).call(ys)}(ys)),ys}var Ls=(Ns||(Ns=1,function(){var t,e,n,r,i={}.hasOwnProperty;e=Wn(),t=ps(),n=Ds(),r=Ms(),Gn.defaults=e.defaults,Gn.processors=r,Gn.ValidationError=function(){function t(t){this.message=t}return function(t,e){for(var n in e)i.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(t,Error),t}(),Gn.Builder=t.Builder,Gn.Parser=n.Parser,Gn.parseString=n.parseString,Gn.parseStringPromise=n.parseStringPromise}.call(Gn)),Gn);const js=(t,e,n)=>{const r=n=>String.prototype.split.call(e,n).filter(Boolean).reduce(((t,e)=>null!=t?t[e]:t),t),i=r(/[,[\]]+?/)||r(/[,[\].]+?/);return void 0===i||i===t?n:i},Rs=[2,2],Ps=[10,2],zs={solid:void 0,dot:Rs,dash:Ps,"dash dot":[...Ps,...Rs],"dash dot dot":[...Ps,...Rs,...Rs]},$s={left:"L",right:"R",top:"T",bottom:"B","top-left":"TL","top-right":"TR","bottom-left":"BL","bottom-right":"BR"};class Us{cqlParser=new gn;static title="QGIS Style Parser";title="QGIS Style Parser";qgisVersion;writePropsAsOptions;constructor(t={}){this.qgisVersion=t.qgisVersion??"3.28.0-Firenze",this.writePropsAsOptions=this.compareVersions("3.28.0-Firenze",this.qgisVersion)>=0}compareVersions(t,e){try{const n=t=>t.split("-")[0].split(".").map(Number),[r,i,s]=n(t),[o,a,u]=n(e);return Math.sign(o-r)||Math.sign(a-i)||Math.sign(u-s)}catch(t){return 0}}readStyle=async t=>{const e={};try{let n;return Ls.parseString(t,e,((t,e)=>{if(t)return void(n={errors:[t]});const r=this.qmlObjectToGeoStylerStyle(e);n={output:r}})),n||{errors:[]}}catch(t){return{errors:[t]}}};parseLabelTemplates(t){let e="";return t.split("||").forEach((t=>{const n=t.match(/[']([^']+)[']/);e+=n?n[1]:`{{${t.trim()}}}`})),e}qmlSymbolizerLayerPropsToObject(t){const e={};return t.prop&&t.prop.forEach((t=>{e[t.$.k]=t.$.v})),t.Option&&t.Option[0].Option&&t.Option[0].Option.forEach((t=>{e[t.$.name]=t.$.value})),e}qmlObjectToGeoStylerStyle(t){return{name:"QGIS Style",rules:this.getRulesFromQmlObject(t)}}qmlColorFromHexAndOpacity(t,e){e=Number.isNaN(Number(e))?1:e;const n=Un(t).alpha(e||1).rgb().array(),r=void 0===n[3]||isNaN(n[3])?255:0===n[3]?0:255*n[3];return`${n[0]},${n[1]},${n[2]},${Math.round(r)}`}qmlColorToOpacity(t){const e=t.split(","),n=parseFloat(e[3])/255;return Math.round(100*n)/100}qmlColorToHex(t){const e=t.split(",");return Un(`rgb(${e[0]},${e[1]},${e[2]})`).hex()}getRulesFromQmlObject(t){const e=js(t,"qgis.renderer-v2.[0]"),n=js(e,"rules[0].rule"),r=js(e,"categories[0].category"),i=js(e,"ranges[0].range"),s=js(e,"symbols[0].symbol"),o=js(t,"qgis.labeling.[0]");let a=[],u={},c={};if(Array.isArray(s)&&(u=this.parseQmlSymbolizers(s)),o&&(c=this.parseQmlLabeling(o)),Array.isArray(n)&&n.length>0)n.forEach((t=>{const e=this.getFilterFromQmlRule(t),n=this.getScaleDenominatorFromRule(t);let r={name:t.$.label||t.$.filter};e&&(r.filter=e),n&&(r.scaleDenominator=n),Object.keys(u).length>0&&u[t.$.symbol]&&(r.symbolizers=u[t.$.symbol]),a.push(r)}));else if(Array.isArray(r)&&r.length>0){const e=js(t,"qgis.renderer-v2.[0].$.attr");r.forEach((t=>{const n=t.$.value;let r={name:`${e} = ${n}`,filter:["==",e,n]};u&&u[t.$.symbol]&&(r.symbolizers=u[t.$.symbol]),a.push(r)}))}else if(Array.isArray(i)&&i.length>0){const e=js(t,"qgis.renderer-v2.[0].$.attr");i.forEach((t=>{let n={name:t.$.label,filter:["&&",[">=",e,t.$.lower],["<=",e,t.$.upper]]};u&&u[t.$.symbol]&&(n.symbolizers=u[t.$.symbol]),a.push(n)}))}else{const t={name:"QGIS Simple Symbol",symbolizers:[...u[Object.keys(u)[0]]||[],...c[Object.keys(c)[0]]||[]]};try{const e=this.cqlParser.read(Object.keys(c)[0]);e&&(t.filter=e)}catch(t){}a.push(t)}return a}getFilterFromQmlRule(t){const e=js(t,"$.filter");if(e)return this.cqlParser.read(e)}getScaleDenominatorFromRule(t){const e=js(t,"$.scalemaxdenom"),n=js(t,"$.scalemindenom");let r={};return n&&(r.min=Number(n)),e&&(r.max=Number(e)),r.min||r.max?r:void 0}parseQmlLabeling(t){const e=t.$.type,n={};if("rule-based"===e&&js(t,"rules[0].rule").forEach(((t,e)=>{const r=js(t,"settings[0]"),i=this.getTextSymbolizerFromLabelSettings(r);n[t.$.filter||e]=[i]})),"simple"===e){const e=js(t,"settings[0]"),r=this.getTextSymbolizerFromLabelSettings(e);n.a=[r]}return n}getTextSymbolizerFromLabelSettings(t){let e={kind:"Text"};const n=js(t,"text-style[0].$"),r=js(t,"placement[0].$");return n.textColor&&(e.color=this.qmlColorToHex(n.textColor)),n.fieldName&&(e.label=this.parseLabelTemplates(n.fieldName)),n.fontSize&&(e.size=parseFloat(n.fontSize)),n.fontFamily&&(e.font=[n.fontFamily]),n.fontWeight&&n.fontWeight>=70&&(e.fontWeight="bold"),n.fontItalic&&parseFloat(n.fontItalic)>0&&(e.fontStyle="italic"),n.fontLetterSpacing&&parseFloat(n.fontLetterSpacing)>0&&(e.letterSpacing=parseFloat(n.fontLetterSpacing)),n.multilineHeight&&parseFloat(n.multilineHeight)>0&&(e.lineHeight=parseFloat(n.multilineHeight)),(parseFloat(r.xOffset)>0||parseFloat(r.yOffset)>0)&&(e.offset=[parseFloat(r.xOffset),parseFloat(r.yOffset)]),e}parseQmlSymbolizers(t){const e={};return t.forEach((t=>{const n=js(t,"$.name");let r;switch(js(t,"$.type")){case"marker":r=this.getPointSymbolizersFromQmlSymbolizer(t);break;case"line":r=this.getLineSymbolizersFromQmlSymbolizer(t);break;case"fill":r=this.getFillSymbolizerFromQmlSymbolizer(t);break;default:throw new Error("Failed to parse SymbolizerKind from qmlSymbolizer")}e[n]=r})),e}getPointSymbolizersFromQmlSymbolizer(t){return t.layer.map((t=>{const e=t.$.class;switch(e){case"SimpleMarker":return this.getPointSymbolizerFromMarkLayer(t);case"SvgMarker":return this.getPointSymbolizerFromSvgLayer(t);default:throw new Error(`Failed to parse MarkerClass ${e} from qmlSymbolizer`)}}))}getPointSymbolizerFromMarkLayer(t){let e={kind:"Mark"};const n=this.qmlSymbolizerLayerPropsToObject(t);return e.wellKnownName=n.name,n.color&&(e.opacity=this.qmlColorToOpacity(n.color),e.color=this.qmlColorToHex(n.color)),n.angle&&(e.rotate=parseFloat(n.angle)),n.size&&(e.radius=parseFloat(n.size)/2),n.outline_color&&(e.strokeOpacity=this.qmlColorToOpacity(n.outline_color),e.strokeColor=this.qmlColorToHex(n.outline_color)),n.outline_width&&(e.strokeWidth=parseFloat(n.outline_width)),e}getLineSymbolizersFromQmlSymbolizer(t){const{qmlSymbolizerLayerPropsToObject:e}=this;return t.layer.map((t=>{let n={kind:"Line"};const r=e(t);if(r.line_color&&(n.opacity=this.qmlColorToOpacity(r.line_color),n.color=this.qmlColorToHex(r.line_color)),r.capstyle&&(n.cap=r.capstyle),r.joinstyle&&(n.join=r.joinstyle),r.use_custom_dash&&"0"!==r.use_custom_dash)r.customdash&&(n.dasharray=r.customdash.split(";").map(parseFloat));else{const t=zs[r?.line_style||"solid"];t&&(n.dasharray=t)}return r.offset&&(n.perpendicularOffset=parseFloat(r.offset)),r.line_width&&(n.width=parseFloat(r.line_width)),n}))}getFillSymbolizerFromQmlSymbolizer(t){const{qmlSymbolizerLayerPropsToObject:e}=this;return t.layer.flatMap((t=>{let n={kind:"Fill"};const r=e(t);let i=r?.outline_style||"solid";r.outline_color&&"no"!==i&&(n.outlineColor=this.qmlColorToHex(r.outline_color));const s=r?.line_style;!n.outlineColor&&s&&"no"!==s&&(i=s,n.outlineColor=this.qmlColorToHex(r.line_color));let o=r?.style||"solid";r.color&&"solid"===o&&(n.opacity=this.qmlColorToOpacity(r.color),n.color=this.qmlColorToHex(r.color));const a=zs[i];if(a&&(n.outlineDasharray=a),r.outline_width&&"no"!==i&&(n.outlineWidth=parseFloat(r.outline_width)),n.outlineColor&&!n.color&&"no"!==o&&(n.color="transparent"),"PointPatternFill"===t.$.class){const e=t.symbol.flatMap((t=>this.getPointSymbolizersFromQmlSymbolizer(t)));if(e.length>1)return e.map((t=>({...n,graphicFill:t})));1===e.length&&(n.graphicFill=e[0])}return[n]}))}getPointSymbolizerFromSvgLayer(t){let e={kind:"Icon"};const n=this.qmlSymbolizerLayerPropsToObject(t);if(n.color){const t=n.color.split(",");e.opacity=parseFloat(t[3])/255;const r=Un(`rgb(${t[0]},${t[1]},${t[2]})`);e.color=r.hex()}if(n.angle&&(e.rotate=parseFloat(n.angle)),n.size&&(e.size=parseFloat(n.size)),n.offset){const t=n.offset.split(",").map(parseFloat);(t[0]>0||t[1]>0)&&(e.offset=n.offset.split(",").map(parseFloat))}return n.name&&(e.image=n.name),e}writeStyle(t){return new Promise((e=>{try{const n=new Ls.Builder,r=this.geoStylerStyleToQmlObject(t);this.convertTextSymbolizers(r,t),e({output:n.buildObject(r).replace('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',"<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>")})}catch(t){e({errors:[t]})}}))}getQmlFilterFromFilter(t){return this.cqlParser.write(t)}getQmlRuleFromRule(t,e){const n=t.filter,r={$:{key:`renderer_rule_${e}`,symbol:`${e}`,label:t.name}};return t.scaleDenominator&&(t.scaleDenominator.min&&(r.$.scalemindenom=t.scaleDenominator.min),t.scaleDenominator.max&&(r.$.scalemaxdenom=t.scaleDenominator.max)),n&&this.getQmlFilterFromFilter(n)&&(r.$.filter=this.getQmlFilterFromFilter(n)),r}getQmlSymbolsFromStyle(t,e){return t.rules.map(((t,n)=>{const r=this.getQmlSymbolFromRule(t,n);return r&&e.push(this.getQmlRuleFromRule(t,n)),r})).filter((t=>t))}getQmlSymbolFromRule(t,e){const n=this.getQmlLayersFromRule(t);let r;if(t.symbolizers.length){switch(t.symbolizers[0].kind){case"Line":r="line";break;case"Fill":r="fill";break;default:r="marker"}return n&&n[0]?{$:{type:r,name:e.toString()},layer:n}:void 0}}getQmlLineSymbolFromSymbolizer(t){let e;nn(t.color)||nn(t.opacity)||(e=this.qmlColorFromHexAndOpacity(t.color,t.opacity));const n={line_color:e,offset:t.perpendicularOffset,offset_map_unit_scale:"3x:0,0,0,0,0,0",offset_unit:"Pixel",joinstyle:t.join,capstyle:t.cap,line_width:t.width,line_width_unit:"Pixel"};return t.dasharray&&(n.customdash=t.dasharray.join(";"),n.use_custom_dash="1"),{$:{class:"SimpleLine"},...this.propsObjectToQmlSymbolOptions(n)}}getQmlFillSymbolFromSymbolizer(t){const e=void 0!==t.fillOpacity?t.fillOpacity:t.opacity,n=void 0!==t.outlineOpacity?t.outlineOpacity:t.opacity;let r,i;nn(t.color)||nn(e)||(r=this.qmlColorFromHexAndOpacity(t.color,e)),nn(t.outlineColor)||nn(n)||(i=this.qmlColorFromHexAndOpacity(t.outlineColor,n));const s={color:r,offset_map_unit_scale:"3x:0,0,0,0,0,0",offset_unit:"Pixel",outline_style:t.outlineDasharray?"dash":"solid",outline_width:t.outlineWidth||"0",outline_width_map_unit_scale:"3x:0,0,0,0,0,0",outline_width_unit:"Pixel",customdash:t.outlineDasharray?t.outlineDasharray.join(";"):void 0,outline_color:i};return{$:{class:"SimpleFill"},...this.propsObjectToQmlSymbolOptions(s)}}getQmlLayersFromRule(t){const e=t.symbolizers.map(this.getQmlLayerFromSymbolizer.bind(this)).filter((t=>t));return e.length?e:void 0}getQmlLayerFromSymbolizer(t){switch(t.kind){case"Fill":return this.getQmlFillSymbolFromSymbolizer(t);case"Icon":return this.getQmlMarkSymbolFromIconSymbolizer(t);case"Line":return this.getQmlLineSymbolFromSymbolizer(t);case"Mark":return this.getQmlMarkSymbolFromSymbolizer(t)}}getQmlMarkSymbolFromIconSymbolizer(t){let e;return nn(t.color)||nn(t.opacity)||(e=this.qmlColorFromHexAndOpacity(t.color,t.opacity)),{$:{class:"SvgMarker"},...this.propsObjectToQmlSymbolOptions({angle:t.rotate||0,color:e,name:t.image,size:t.size,size_map_unit_scale:"3x:0,0,0,0,0,0",size_unit:"Pixel"})}}getQmlMarkSymbolFromSymbolizer(t){let e,n,r;nn(t.color)||nn(t.opacity)||(e=this.qmlColorFromHexAndOpacity(t.color,t.opacity)),nn(t.strokeColor)||nn(t.strokeOpacity)||(n=this.qmlColorFromHexAndOpacity(t.strokeColor,t.strokeOpacity)),nn(t.radius)||(r=t.radius?2*t.radius:void 0);const i={angle:t.rotate||0,color:e,name:t.wellKnownName.toLowerCase(),outline_color:n,outline_style:"solid",outline_width:t.strokeWidth||0,outline_width_map_unit_scale:"3x:0,0,0,0,0,0",outline_width_unit:"Pixel",size:r,size_map_unit_scale:"3x:0,0,0,0,0,0",size_unit:"Pixel"};return{$:{class:"SimpleMarker"},...this.propsObjectToQmlSymbolOptions(i)}}propsObjectToQmlSymbolOptions(t){return this.writePropsAsOptions?this.propsObjectToQmlSymbol_NewerOptions(t):this.propsObjectToQmlSymbol_OlderProps(t)}propsObjectToQmlSymbol_NewerOptions(t){const e=Object.keys(t).map((e=>({$:{name:e,value:t[e],type:"QString"}}))).filter((t=>void 0!==t.$.value));return{Option:{$:{type:"Map"},Option:e}}}propsObjectToQmlSymbol_OlderProps(t){const e=Object.keys(t).map((e=>({$:{k:e,v:t[e]}}))).filter((t=>void 0!==t.$.v));return{prop:e}}geoStylerStyleToQmlObject(t){const e=[],n=this.getQmlSymbolsFromStyle(t,e);return e.length>0||n.length>0?{qgis:{$:{version:this.qgisVersion},"renderer-v2":[{$:{type:"RuleRenderer"},rules:[{$:{key:"renderer_rules"},rule:e}],symbols:[{symbol:n}]}]}}:{qgis:{$:{version:this.qgisVersion},"renderer-v2":[{$:{type:"nullSymbol"}}]}}}convertTextSymbolizerRule(t,e){let n;e.symbolizers.forEach((r=>{if("Text"===r.kind){let i,s;n=r,n.color&&!nn(n.color)&&(i=this.qmlColorFromHexAndOpacity(n.color,1));const o={fontSize:n.size||12,fontLetterSpacing:n.letterSpacing||0,multilineHeight:void 0!==n.lineHeight?n.lineHeight:1,textColor:n.color?i:"0,0,0,255"};n.font&&(o.fontFamily=n.font[0]),n.label&&!nn(n.label)&&(o.fieldName=n.label.replace("{{","").replace("}}","")),s=n.anchor&&!nn(n.anchor)&&"center"!==n.anchor?$s[n.anchor]:"TR,TL,BR,BL,R,L,TSR,BSR";const a={$:{key:`labeling_rule_${t.length}`},settings:[{"text-style":[{$:o}],placement:[{$:{predefinedPositionOrder:s,xOffset:n.offset?`${n.offset[0]}`:"0",yOffset:n.offset?`${n.offset[1]}`:"0",rotationAngle:n.rotate?n.rotate:"0"}}]}]};if(n.haloColor){let t;nn(n.haloColor)||nn(n.haloOpacity)||(t=this.qmlColorFromHexAndOpacity(n.haloColor,n.haloOpacity)),a.settings[0]["text-buffer"]=[{$:{bufferSize:n.haloWidth||"0",bufferColor:t,bufferDraw:1,bufferSizeUnits:"Pixel",bufferSizeMapUnitScale:"3x:0,0,0,0,0,0"}}]}e.filter&&(a.$.filter=this.cqlParser.write(e.filter)),t.push(a)}}))}convertTextSymbolizers(t,e){const n=[];e.rules.forEach((t=>{t.symbolizers.forEach((e=>{"Text"!==e.kind||n.includes(t)||n.push(t)}))})),n.length>0&&(t.qgis.labeling=[{$:{type:"rule-based"},rules:[{$:{key:"labeling_rules"},rule:[]}]}],n.forEach((e=>this.convertTextSymbolizerRule(t.qgis.labeling[0].rules[0].rule,e))))}}let Gs=function(t){return t.VBScript="VBScript",t.JScript="JScript",t.Python="Python",t.Arcade="Arcade",t}({}),Bs=function(t){return t.Point="Point",t.Line="Line",t.Polygon="Polygon",t}({});const Ws="ESRI Default Marker",qs=2/3,Vs=["ttf://ESRI SDS 2.00","ttf://ESRI SDS 1.95"],Ys=t=>t*(4/3),Zs=t=>null!==t&&t.values?t.values[t.values.length-1]/100:0,Js=t=>{if(null===t)return"#000000";let e=t.values??[0,0,0];return"CIMRGBColor"===t.type?Hs(e):"CIMCMYKColor"===t.type?Hs(Ks(e)):"CIMHSVColor"===t.type?Hs(Xs(e)):"CIMGrayColor"===t.type?Hs(Qs(e)):"#000000"},Hs=t=>`#${((1<<24)+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1).split(".")[0]}`,Ks=t=>{let e=t[1],n=t[2],r=t[3];return[Math.floor(255*(1-t[0]/100)*(1-r/100)),Math.floor(255*(1-e/100)*(1-r/100)),Math.floor(255*(1-n/100)*(1-r/100))]},Xs=t=>{let e=t[0]/360,n=t[1]/100,r=t[2]/100;if(0===n)return r*=255,[r,r,r];let i=Math.floor(6*e),s=6*e-i,o=r*(1-n)*255,a=r*(1-n*s)*255,u=r*(1-n*(1-s))*255;return r*=255,i%=6,0===i?[r,u,o]:1===i?[a,r,o]:2===i?[o,r,u]:3===i?[o,a,r]:4===i?[u,o,r]:5===i?[r,o,a]:[-1,-1,-1]},Qs=t=>{const e=t[0],n=e>1?e:255*e;return[n,n,n]},to=[],eo=t=>`0x${t.toString(16)}`,no=t=>{const e={33:"circle",34:"square",35:"triangle",40:"circle",41:"square",42:"triangle",94:"star",95:"star",203:"cross",204:"cross"};return e.hasOwnProperty(t)?e[t]:(to.push(`Unsupported symbol from ESRI font (character index ${t}) replaced by default marker`),"circle")},ro=(t,e,n,r=!0)=>{if(null===t||"object"!=typeof t||!t.hasOwnProperty(e))return n;const i=parseFloat(t[e]);if(isNaN(i))return n;const s=Ys(i);return r?s:Math.round(s)},io=t=>{for(let e of t)if("CIMSolidStroke"===e.type)return[Js(e.color??""),ro(e,"width",0),Zs(e.color??"")];return["#000000",0,0]},so=t=>{let e="#ffffff";return t.some((t=>{if(!t.type)return!1;if("CIMSolidFill"===t.type)return e=Js(t.color??""),!0;if("CIMCharacterMarker"===t.type){if(t.symbol.symbolLayers)return e=so(t.symbol.symbolLayers),!0}else if("CIMVectorMarker"===t.type){if(t.markerGraphics?.length>0){const n=t.markerGraphics[0];if(n.symbol?.symbolLayers){const t=n.symbol.symbolLayers.filter((t=>t.enable));return e=so(t),!0}}return!1}return!1})),e},oo=t=>{const e=t.find((t=>"CIMSolidFill"===t.type));return e?Zs(e.color):1},ao=(t,e)=>({args:[e?t.toLowerCase():t],name:"property"}),uo=t=>["&&",...t],co=t=>["||",...t],lo=(t,e,n)=>ho("==",t,e,n),ho=(t,e,n,r=!0)=>[t,wo(e,r),wo(n,!1)],fo=(t,e,n)=>{let r=t;e===Gs.Arcade&&(r=vo(t)),n&&(r=r.toLowerCase());const i=r.match(/\[\s*if\s*\(([^)]+)\)\s*{([^}]*)}\s*\]/is);if(i){const t=i[1],s=i[2],o=4===i.length?vo(i[3]):"",a=mo(t,n);return a?{name:"if_then_else",args:[a,fo(s,e,n),o]}:bo(r)}return/round\s*\(.*\)/i.test(r)?yo(r,n,""):r.includes("+")||r.includes("&")?(r.includes("+")?r.split("+"):r.split("&")).map((t=>{if((t=t.trimStart().trimEnd()).includes("["))return bo(t);{const n=t.replaceAll('"',"");return go(n,e)}})).join(""):go(bo(r),e)},po=(t,e)=>{if((t=t.replace("(","").replace(")","")).includes(" AND ")){const n=t.split(" AND ").map((t=>t.trim()));return uo(n.map((t=>po(t,e))))}if(t.includes("=")){const n=t.split("=").map((t=>t.trim()));return ho("==",n[0],n[1],e)}if(t.includes("<>")){const n=t.split("<>").map((t=>t.trim()));return ho("!=",n[0],n[1],e)}if(t.includes(">")){const n=t.split(">").map((t=>t.trim()));return ho(">",n[0],n[1],e)}if(t.toLowerCase().includes(" in ")){const n=(t=t.replace(" IN "," in ")).split(" in "),r=n[0];let i=[];n[1].startsWith("() ")&&(i=n[1].substring(3).split(","));const s=[];if(i.forEach((t=>{s.push(ho("==",`${wo(r,e)}`,`${wo(t,e)}`))})),1===i.length)return s[0];let o=co([s[0],s[1]]);for(let t of s.slice(2))o=co([o,t]);return o}return to.push(`Clause skipped because it is not supported as filter: ${t}}`),["==",0,0]},yo=(t,e,n)=>{const r=t.match(/round\s*\(\s*(?:\[(\w+)\]|{{(\w+)}})\s*,\s*(\d+)\s*\)/i);if(r){const t=r[1]||r[2],i=Number(r[3]),s=ao(t,e);let o;return o=0===i?"#":"#."+"#".repeat(i),{args:[o,s,n],name:"numberFormat"}}return t},mo=(t,e)=>{const n=po(t,e);if(Array.isArray(n)&&3===n.length){let t=String(n[1]);t=t.replace(/^\[(.+)\]$/,"$1").replace(/^{{(.+)}}$/,"$1");const r=ao(t,e),i=Number(n[2]);if(">"===n[0])return{name:"greaterThan",args:[r,i]};if("=="===n[0])return{name:"equalTo",args:[r,i]};if("<"===n[0])return{name:"lessThan",args:[r,i]};if("!="===n[0])return{name:"notEqualTo",args:[r,i]}}return null},go=(t,e)=>{let n=t;return n=n.replace(e===Gs.Arcade?/TextFormatting\.NewLine/gi:/vbNewLine/gi,"\n"),n=n.replace(/ /g," "),n},bo=t=>t.replace("[","{{").replace("]","}}").trim(),vo=t=>t.replace(/\$feature\.(\w+)/g,"[$1]"),wo=(t,e)=>t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"')?t.substring(1).substring(0,t.length-2):"<Null>"===t?null:(e&&t.match(/^[A-zÀ-ú_-][[A-zÀ-ú0-9-_]*$/)&&(t=t.toLowerCase()),t),xo=t=>{const e=Math.min(...t.map((t=>t[0]))),n=Math.max(...t.map((t=>t[0]))),r=Math.min(...t.map((t=>t[1]))),i=Math.max(...t.map((t=>t[1]))),s=i-r,o=(e+n)/2,a=(r+i)/2;return t.map((t=>[(t[0]-o)/s,(t[1]-a)/s]))},So=(t,e)=>Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2),Eo=(t,e,n,r)=>{const i=[],s=Math.atan2(t[1]-n[1],t[0]-n[0]),o=Math.atan2(e[1]-n[1],e[0]-n[0]),a=So(t,n);let u=o-s;u>Math.PI&&(u-=2*Math.PI),u<-Math.PI&&(u+=2*Math.PI);for(let t=1;t<=r;t++){const e=s+u*(t/r),o=n[0]+a*Math.cos(e),c=n[1]+a*Math.sin(e);i.push([o,c])}return i},Oo=(t,e,n,r,i)=>{const s=[];for(let o=1;o<=i;o++){const a=o/i,u=a*a,c=u*a,l=1-a,h=l*l,f=h*l;s.push([f*t[0]+3*h*a*e[0]+3*l*u*n[0]+c*r[0],f*t[1]+3*h*a*e[1]+3*l*u*n[1]+c*r[1]])}return s},Co=t=>Math.max((t=>Math.abs(t.xmax-t.xmin))(t),(t=>Math.abs(t.ymax-t.ymin))(t)),Fo={},ko=async(t,e,n,r,i)=>{switch(t.type){case"CIMSolidStroke":return Lo(t,e.type);case"CIMSolidFill":return jo(t);case"CIMCharacterMarker":return Ro(t,e,n);case"CIMVectorMarker":return Po(t,e,n,r,i);case"CIMHatchFill":return zo(t);case"CIMPictureFill":case"CIMPictureMarker":return await $o(t,e,n);default:return}},To=(t,e,n,r,i=null,s=null,o=!0)=>{const a=[];if("CIMPolygonSymbol"===t.type){const t=_o(n,e.markerPlacement||{},o);return t&&a.push(t),a}if("CIMLineSymbol"===t.type){if("CIMCharacterMarker"===e.type){const t=Do(e.markerPlacement);if(t){const n=t=>{const n=No(e,t,r);n&&a.push(n)};"start"!==t&&"both"!==t||n("start"),"end"!==t&&"both"!==t||n("end")}else{const t=Mo(n,e);a.push(t)}return a}const t=Mo(n,e);return a.push(t),a}return a},Mo=(t,e)=>{const n={kind:"Line",opacity:1,graphicStroke:t},r=e.markerPlacement;if("CIMMarkerPlacementAlongLineSameSize"===e.markerPlacement.type){const i=ro(e,"size",10),s=Io(r,i);return"Mark"===t.kind&&(t.wellKnownName.startsWith("wkt://")||0!==t.strokeWidth||(delete t.strokeWidth,delete t.strokeColor,delete t.strokeOpacity)),n.width=i,n.perpendicularOffset=ro(t,"perpendicularOffset",0),n.dasharray=s,n}return n.perpendicularOffset=0,n.graphicStrokeInterval=2*ro(t,"size",0),n.graphicStrokeOffset=0,n},Io=(t,e)=>{const n=t?.placementTemplate;if(!n||!n.length)return[];if(1===n.length){const t=Ys(n[0]);return t>=e+1?[t,1]:[e+1,1]}{const t=n.length*e;let r=t=>Math.ceil(Ys(t));return[t,(n?.map(r)||[]).reduce(((t,e)=>t+e),0)-t]}},_o=(t,e,n)=>{const r=e.type;return"CIMMarkerPlacementInsidePolygon"===r?{kind:"Fill",fillOpacity:1,graphicFill:t,graphicFillPadding:Ao(t,e,n)}:"CIMMarkerPlacementAlongLineSameSize"===r?{kind:"Line",opacity:1,width:ro(t,"size",10),perpendicularOffset:ro(t,"perpendicularOffset",0),graphicStroke:t}:null},No=(t,e,n)=>{let r;if("start"===e)r=t?.rotation??180;else if("end"===e)r=t?.rotation??0;else{if("both"!==e)return;r=t?.rotation??90}const i=!!n?.replaceesri,s=t.fontFamilyName,o=t.characterIndex,a=eo(o);let u,c,l,h,f,d,p;u=s===Ws&&i?no(o):`ttf://${s}#${a}`;try{c=t.symbol.symbolLayers??[],l=so(c),h=oo(c),[f,d,p]=io(c)}catch(t){l="#000000",h=1,p=0,f="#000000",d=0}return{opacity:1,fillOpacity:h,strokeColor:f,strokeOpacity:p,strokeWidth:d,rotate:{args:[ao("shape",!0),r],name:"add"},kind:"Mark",color:l,wellKnownName:u,radius:ro(t,"size",10)/2,geometry:[null,["PropertyName","shape"]],inclusion:"mapOnly"}},Ao=(t,e,n=!0)=>{const r=Vs.some((e=>t?.wellKnownName?.startsWith(e)));let i;i=n?r?1:qs:r?1.8:1;let s=ro(e,"stepX",0),o=ro(e,"stepY",0);const a=Math.round(2*("number"==typeof t.radius?t.radius:0)*i)||1;t.radius=a/2,s<a&&(s=a),o<a&&(o=a);const u=Math.round(s/2-a/2),c=Math.round(s/2-a/2);return[Math.round(o/2-a/2),u,Math.round(o/2-a/2),c]},Do=t=>{if(t?.angleToLine)if("CIMMarkerPlacementAtRatioPositions"===t.type){if(0===t.positionArray[0]&&t.flipFirst)return"start";if(1===t.positionArray[0])return"end"}else if("CIMMarkerPlacementAtExtremities"===t.type){if("Both"===t.extremityPlacement)return"both";if("JustBegin"===t.extremityPlacement)return"start";if("JustEnd"===t.extremityPlacement)return"end"}},Lo=(t,e)=>{const n=Uo(t);if("CIMPolygonSymbol"===e){const e={kind:"Fill",outlineColor:Js(t.color),outlineOpacity:Zs(t.color),outlineWidth:ro(t,"width",0)};return"dasharray"in n&&(e.outlineDasharray=n.dasharray),[e]}const r=t.capStyle.toLowerCase(),i=t.joinStyle.toLowerCase(),s={kind:"Line",color:Js(t.color),opacity:Zs(t.color),width:ro(t,"width",0),perpendicularOffset:0,cap:["butt","round","square"].includes(r)?r:void 0,join:["round","bevel","miter"].includes(i)?i:void 0};return"dasharray"in n&&(s.dasharray=n.dasharray),"offset"in n&&(s.perpendicularOffset=n.offset),[s]},jo=t=>{let e=t.color;if(void 0!==e)return[{kind:"Fill",color:Js(e),fillOpacity:Zs(e)}]},Ro=(t,e,n)=>{const r=!!n.replaceesri,i=t.fontFamilyName,s=t.characterIndex,o=eo(s),a=ro(t,"size",12);let u;u=i===Ws&&r?no(s):`ttf://${i}#${o}`;let c=void 0===t.rotation?0:t.rotation;void 0!==t.rotateClockwise&&t.rotateClockwise||0===c||(c*=-1);let l="#000000",h=1,f="#000000",d=0,p=0,y=t.respectFrame;const m=t.symbol.symbolLayers;m&&(l=so(m),h=oo(m),[f,d,p]=io(m));const g={opacity:1,offset:qo(t,a),fillOpacity:h,strokeColor:f,strokeOpacity:p,strokeWidth:d,rotate:c,kind:"Mark",color:l,wellKnownName:u,radius:a/2,respectFrame:y},b=To(e,t,g,n,void 0,void 0,y);return b.length?b:[g]},Po=async(t,e,n,r,i)=>{const s=t.size??10,o=t.frame;let a="#ff0000",u="#000000",c=1,l=Ys(s),h=1,f="circle",d=null,p=null;const y=t.markerGraphics||[];if(0===y.length)return[{opacity:1,rotate:0,kind:"Mark",color:a,wellKnownName:f,radius:l/2,strokeColor:u,strokeWidth:c,strokeOpacity:h,fillOpacity:1,offset:qo(t,l)}];const m=y[0];if(!m.symbol||!m.symbol.symbolLayers)return[{opacity:1,rotate:0,kind:"Mark",color:a,wellKnownName:f,radius:l/2,strokeColor:u,strokeWidth:c,strokeOpacity:h,fillOpacity:1,offset:qo(t,l)}];const g=o?Co(o):void 0,b=(await Vo(m,{},Ys(s),g))[0],v=m.symbol.symbolLayers.filter((t=>t.enable));if(a=so(v),[u,c,h]=io(v),"CIMPointSymbol"===m.symbol.type)f=b.wellKnownName??f,"number"==typeof b.radius&&f?.startsWith("wkt://")&&(l=2*b.radius);else if(["CIMLineSymbol","CIMPolygonSymbol"].includes(m.symbol.type)){const t=m.geometry;if(t){const e=(t=>{const e={wellKnownName:"circle"};if(t.rings){let[e]=t.rings;e=xo(e);let n=e.map((t=>t.join(" "))).join(", ");return{wellKnownName:`wkt://POLYGON((${n}))`,maxX:Math.max(...e.map((t=>t[0]))),maxY:Math.max(...e.map((t=>t[1])))}}const n=t?.paths?.[0];if(n&&2===n[0][0]&&0===n[0][1]&&n[1][0]-2&&0===n[1][1])return{wellKnownName:"wkt://MULTILINESTRING((0 2, 0 0))"};if(t.curveRings){const[n]=t.curveRings,r=n[0],i=n[1];if(i&&2===n.length&&Array.isArray(r)){const t=i?.a||i?.b||i?.c;if(t){const e=t[1];if(JSON.stringify(t[0])===JSON.stringify(r)){const t=So(r,e),n=((t,e,n=32)=>{const r=[];for(let i=0;i<n;i++){const s=2*Math.PI*i/n,o=t[0]+e*Math.cos(s),a=t[1]+e*Math.sin(s);r.push([o,a])}return r.push(r[0]),r})(e,t,32),i=xo(n).map((t=>t.join(" "))).join(", ");return{wellKnownName:`wkt://POLYGON((${i}))`,maxX:t,maxY:t}}}}const s=(t=>{const e=[];for(let n=0;n<t.length;n++){const r=t[n];if(Array.isArray(r)&&"number"==typeof r[0])e.push(r);else if(!Array.isArray(r)&&"object"==typeof r&&null!==r){const t=e[e.length-1]||[0,0];if(r.a&&Array.isArray(r.a)){const n=r.a,i=Eo(t,n[0],n[1],16);e.push(...i)}else if(r.b&&Array.isArray(r.b)){const n=r.b,i=Oo(t,n[1],n[2],n[0],16);e.push(...i)}else if(r.c&&Array.isArray(r.c)){const n=r.c,i=Eo(t,n[0],n[1],16);e.push(...i)}}}return e})(n);if(s.length>0){const t=xo(s),e=t.map((t=>t.join(" "))).join(", ");return{wellKnownName:`wkt://POLYGON((${e}))`,maxX:Math.max(...t.map((t=>t[0]))),maxY:Math.max(...t.map((t=>t[1])))}}return e}return e})(t);if(f=e.wellKnownName,d=ro(e,"maxX",0),p=ro(e,"maxY",0),2===t.curveRings?.[0]?.length)l=1.5*Ys(s);else if(f?.startsWith("wkt://")&&(t.curveRings||r)){const t=r?r/(4/3):s,e=i??(o?Co(o):t);l=Ys(t*(t/e))}}}const w={opacity:1,rotate:0,kind:"Mark",color:a,wellKnownName:f,radius:l/2,strokeColor:u,strokeWidth:c,strokeOpacity:h,fillOpacity:1,offset:qo(t,l)},x=To(e,t,w,n,d,p);return x.length?x:[w]},zo=t=>{const e=t.rotation||0,n=t.lineSymbol.symbolLayers;let r="#000000",i=0,s=0;n&&([r,i,s]=io(n));let o=Wo(e);e%45&&to.push("Rotation value different than a multiple of 45° is not possible. The nearest value is taken instead.");let a=t.separation||0,u=Bo().includes(o)?Ys(a)/2:a;const c={kind:"Mark",color:r,wellKnownName:o,radius:u,strokeColor:r,strokeWidth:i,strokeOpacity:s,rotate:0},l={kind:"Fill",fillOpacity:1,graphicFill:c};if(!n)return[l];let h=Uo(n[0]);if("dasharray"in h&&(c.strokeDasharray=h.dasharray,u>0)){let t=h.dasharrayValues.reduce(((t,e)=>t+e),0);if(Bo().includes(o)){t/=2;let e=-1*(t-u);l.graphicFillPadding=o===Bo()[0]?[e,0,e,0]:[0,e,0,e]}else t=u,to.push("Unable to keep the original size of CIMHatchFill for line with rotation");c.radius=t}return[l]},$o=async(t,e,n)=>{const r=ro(t,"height",ro(t,"size",0)),i=await(async(t,e)=>{if(!t)return;const n=(t=>{const e=t.split(";");if(2!==e.length)return;const n=e[0].split("/").pop();return n?{data:e[1].substring(7),extension:n}:void 0})(t);if(!n)return t;const r=`image/${n.extension}`,i=Buffer.from(n.data,"base64");let s;try{const t=await Fo.read(i),n=((t,e,n)=>{const r=t/Math.max(e,n)*Math.min(e,n);return[e>n?t:r,n>e?t:r]})(e,t.bitmap.height,t.bitmap.width),o=t.resize({h:n[0],w:n[1]});s=await o.getBase64(r)}catch(t){to.push(`Could not resize image: ${t}`)}return s||t})(t.url,r)??"",s={opacity:1,rotate:0,kind:"Icon",image:i,size:r},o=To(e,t,s,n);return o.length?o:[s]},Uo=t=>{let e={};return"effects"in t&&t.effects.forEach((t=>{e={...e,...Go(t)}})),e},Go=t=>{let e=t=>Math.ceil(Ys(t));if("CIMGeometricEffectDashes"===t.type){let n=t.dashTemplate?.map(e)||[];if(n.length>1)return{dasharrayValues:n,dasharray:n}}else if("CIMGeometricEffectOffset"===t.type)return{offset:-1*e(t.offset||0)};return{}},Bo=()=>["shape://horline","shape://vertline"],Wo=t=>{const e=(t=>(t%360+360)%360)(t),n=Bo(),r=["shape://slash","shape://backslash"],i=Math.floor((e+22.5)%180/45);return[n[0],r[0],n[1],r[1]][i]},qo=(t,e)=>{let n=0,r=0;if(t.anchorPoint&&(0!==t.anchorPoint.x||0!==t.anchorPoint.y)){const{x:i,y:s}=t.anchorPoint;"Relative"===(t.anchorPointUnits||"Relative")&&void 0!==e?(n=i*e,r=s*e):(n=Ys(i),r=Ys(s))}if(0!==n||0!==r||void 0===t.offsetX&&void 0===t.offsetY||(n=(t.offsetX||0)*Ys(1)*1.5,r=(t.offsetY||0)*Ys(1)*1.5*-1),0!==n||0!==r)return[n,r]},Vo=async(t,e,n,r)=>{const i=t.symbol,s=[];if(!i||!i.symbolLayers)return s;const o=i.symbolLayers.slice().reverse();for await(const t of o){if(!t.enable)continue;const o=await ko(t,i,e,n,r);o&&s.push(...o)}return s},Yo=[],Zo=async(t,e)=>{const n={name:t.name,rules:[]};return e={toLowerCase:!0,replaceesri:!1,...e},"CIMFeatureLayer"===t.type?n.rules=await Jo(t,e):"CIMRasterLayer"===t.type&&(n.rules=Ko()),n},Jo=async(t,e={})=>{const n=!!e.toLowerCase,r=t.renderer;if(!r)return to.push(`No renderer on layer: ${t.name}`),[];const i=await Ho(r,e);if(t.labelVisibility)for(const e of t.labelClasses||[])i.push(Qo(e,n));return na(r,n),i},Ho=async(t,e)=>{const n=[];if("CIMSimpleRenderer"===t.type)return n.push(await ta(t,e)),n;if("CIMUniqueValueRenderer"===t.type){const r=t;if(r.groups)for await(const t of r.groups)n.push(...await ea(r.fields,t,e));else if(r.defaultSymbol){const t={name:"",symbolizers:await Vo(r.defaultSymbol,e)};n.push(t)}return n}if("CIMClassBreaksRenderer"===t.type){const r=t;if(["GraduatedColor","GraduatedSymbol"].includes(r.classBreakType))return n.push(...await Xo(r,e)),n}return to.push(`Unsupported renderer type: ${t}`),n},Ko=()=>(to.push("CIMRasterLayer are not supported yet."),[]),Xo=async(t,e={})=>{const n=[],r=[],i=t.field;let s=null;const o=!!e.toLowerCase;na(t,o);const a=t.breaks||[];for await(const t of a){const a=await Vo(t.symbol,e),u=t.upperBound||0;let c;c=null!==s?["&&",[">",o?i.toLowerCase():i,s],["<=",o?i.toLowerCase():i,u]]:["<=",o?i.toLowerCase():i,u],s=u;const l={filter:c,symbolizers:a,name:t.label||"classbreak"};r.push(a),n.push(l)}if(!t.showInAscendingOrder){n.reverse();for(const[t,e]of n.entries())e.symbolizers=r[t]}return n},Qo=(t,e)=>{if("CIMTextSymbol"!==t.textSymbol?.symbol?.type)return{name:"",symbolizers:[]};const n=t.textSymbol?.symbol,r=fo(t?.expression??"",t.expressionEngine??Gs.Arcade,e),i=n?.fontFamilyName||"Arial",s=ro(n,"height",12,!0),o=so(n?.symbol?.symbolLayers??[]),a=(t=>"Bold"===t.fontStyleName?"bold":"normal")(n),u=(t.maplexLabelPlacementProperties?.rotationProperties||{}).rotationField,c={kind:"Text",anchor:"right",rotate:0,color:o,font:[i],label:r,size:s,fontWeight:a},l=t.standardLabelPlacementProperties,h=l?.featureType,f=l?.pointPlacementMethod,d=t.maplexLabelPlacementProperties,p=d?.featureType,y=ro(d??{},"primaryOffset",0),m=d?.pointPlacementMethod;if(h===Bs.Line&&p===Bs.Line){c.placement="line";const t=y??ro(n,"primaryOffset",0);c.perpendicularOffset=0!==t?t+s/2:0}else if(p===Bs.Point&&"AroundPoint"===m){const t=y+s/2;c.offset=[t,-1*t]}else if(h===Bs.Point&&"AroundPoint"===f){const t=y+s/2;c.offset=[t,-1*t]}else c.offset=[0,0];if(u){const t=ao(u,e);c.rotate={args:[t,-1],name:"mul"}}else c.rotate=0;const g=ro(n,"haloSize",0);if(g&&n.haloSymbol){const t=so(n?.haloSymbol?.symbolLayers??[]);Object.assign(c,{haloColor:t,haloWidth:g,haloOpacity:1})}c.group=t.maplexLabelPlacementProperties?.thinDuplicateLabels||p===Bs.Polygon&&"OneLabelPerName"===t.standardLabelPlacementProperties?.numLabelsOption;const b={name:"",symbolizers:[c]},v=ra(t.minimumScale,t.maximumScale);return v&&(b.scaleDenominator=v),t.whereClause&&(b.filter=po(t.whereClause,e)),b},ta=async(t,e)=>({name:t.label||"",symbolizers:await Vo(t.symbol,e)}),ea=async(t,e,n)=>{const r=n.toLowerCase||!1,i=[];e.classes=e.classes||[];for await(const s of e.classes){const e=s.label||"label",o=[];s.values.filter((t=>"fieldValues"in t)).forEach((e=>{const n=e.fieldValues;let i=lo(t[0],n[0],r);for(const[e,s]of n.slice(1).map(((e,n)=>[e,t[n+1]])))i=uo([i,lo(`${s}`,`${e}`,r)]);o.push(i)}));let a=null;if(o.length){a=1===o.length?o[0]:co(o);const t={name:e,filter:a,symbolizers:await Vo(s.symbol,n)},r=ra(s.symbol.minScale,s.symbol.maxScale);r&&(t.scaleDenominator=r),i.push(t)}const u=s.alternateSymbols||[];for await(const t of u){const r={name:e,symbolizers:await Vo(t,n)};a&&(r.filter=a);const s=ra(t.minScale,t.maxScale);s&&(r.scaleDenominator=s),i.push(r)}}return i},na=(t,e)=>((t?.visualVariables??[]).find((t=>{if("CIMRotationVisualVariable"!==t.type)return!1;const n=t.visualVariableInfoZ?.valueExpressionInfo?.expression||t.visualVariableInfoZ?.expression;return n?((t,e,n)=>{const r=t.includes("$feature")?vo(t):bo(t),i=ao(r,n);return"Arithmetic"===e?{args:[i,-1],name:"mul"}:"Geographic"===e?{args:[i,90],name:"sub"}:null})(n,t.rotationTypeZ,e):null})),null),ra=(t,e)=>{if(void 0===t&&void 0===e)return null;const n={};return void 0!==t&&(n.max=t),void 0!==e&&(n.min=e),n};class ia{static title="ArcGIS Pro lyrx parser";title="ArcGIS Pro lyrx parser";unsupportedProperties={};constructor(t){this.options=t||{}}async readStyle(t){const e=await(async(t,e={})=>[await Zo(t?.layerDefinitions?.[0],e),Yo,to])(t);return Promise.resolve({output:{name:e[0].name,rules:e[0].rules},warnings:to,errors:[]})}writeStyle(t){return console.log(t),Promise.resolve({output:{stylingRules:[]},errors:[],warnings:[]})}}const sa="v-map-style",oa=class{constructor(e){t(this,e),this.styleReady=r(this,"styleReady",7),this.styleError=r(this,"styleError",7)}get el(){return e(this)}format="sld";src;content;layerTargets;autoApply=!0;styleReady;styleError;parsedStyle;isLoading=!1;error;sldParser=new $e;mapboxParser=new yn;qgisParser=new Us;lyrxParser=new ia;async connectedCallback(){s(sa+" - "+o.COMPONENT_CONNECTED_CALLBACK),this.autoApply&&(this.src||this.content)&&await this.loadAndParseStyle()}async onStyleSourceChanged(){this.autoApply&&(this.src||this.content)&&await this.loadAndParseStyle()}async loadAndParseStyle(){this.isLoading=!0,this.error=void 0;try{let t;if(this.src){const e=await fetch(this.src);if(!e.ok)throw new Error(`Failed to fetch style from ${this.src}: ${e.statusText}`);t=await e.text()}else{if(!this.content)throw new Error("Either src or content must be provided");t=this.content}const e=await this.parseStyle(t);this.parsedStyle=e;const n={style:e,layerIds:this.getLayerTargets()};return this.styleReady.emit(n),s(sa+" - Style successfully parsed",e),e}catch(t){this.error=t,this.styleError.emit(this.error);const e=function(t){return t.message.startsWith("Failed to fetch style from")}(this.error)?"network":"parse";return this.el.dispatchEvent(new CustomEvent(a.Error,{detail:{type:e,message:this.error.message,cause:this.error},bubbles:!0,composed:!0})),void console.error(sa+" - Style parsing failed:",t)}finally{this.isLoading=!1}}async parseStyle(t){switch(this.format){case"sld":return this.parseSLD(t);case"mapbox-gl":return this.parseMapboxGL(t);case"qgis":return this.parseQGIS(t);case"lyrx":return this.parseLyrx(t);case"cesium-3d-tiles":return this.parseCesium3DTiles(t);case"geostyler":return this.parseGeoStyler(t);default:throw new Error(`Unsupported style format: ${this.format}`)}}async parseSLD(t){try{const{output:e}=await this.sldParser.readStyle(t);if(!e)throw new Error("Failed to parse SLD - no style output");return e}catch(t){throw new Error(`SLD parsing failed: ${t?.message||t}`)}}async parseMapboxGL(t){try{const e="string"==typeof t?JSON.parse(t):t;if("object"!=typeof e||null===e)throw new Error("Parsed Mapbox GL style is not a valid object");const{output:n}=await this.mapboxParser.readStyle(e);if(!n)throw new Error("Failed to parse Mapbox GL Style - no style output");return n}catch(t){throw new Error(`Mapbox GL Style parsing failed: ${t?.message||t}`)}}async parseQGIS(t){try{const{output:e}=await this.qgisParser.readStyle(t);if(!e)throw new Error("Failed to parse QGIS Style - no style output");return e}catch(t){throw new Error(`QGIS Style parsing failed: ${t?.message||t}`)}}async parseLyrx(t){try{const e="string"==typeof t?JSON.parse(t):t;if("object"!=typeof e||null===e)throw new Error("Parsed LYRX style is not a valid object");const{output:n}=await this.lyrxParser.readStyle(e);if(!n)throw new Error("Failed to parse LYRX (ArcGIS Pro) Style - no style output");return n}catch(t){throw new Error(`LYRX (ArcGIS Pro) Style parsing failed: ${t?.message||t}`)}}async getStyle(){return this.parsedStyle}async parseCesium3DTiles(t){try{const e=JSON.parse(t);if("object"!=typeof e||null===e)throw new Error("Parsed Cesium 3D Tiles style is not a valid object");return e}catch(t){throw new Error(`Cesium 3D Tiles style parsing failed: ${t?.message||t}`)}}async parseGeoStyler(t){try{const e=JSON.parse(t);if("object"!=typeof e||null===e)throw new Error("Parsed GeoStyler style is not a valid object");if("string"!=typeof e.name||!Array.isArray(e.rules))throw new Error('GeoStyler style must have "name" (string) and "rules" (array)');return e}catch(t){throw new Error(`GeoStyler style parsing failed: ${t?.message||t}`)}}async getLayerTargetIds(){return this.getLayerTargets()}getLayerTargets(){return this.layerTargets?this.layerTargets.split(",").map((t=>t.trim())):[]}isStyleLoading(){return this.isLoading}getError(){return this.error}render(){return n("div",{key:"a913bf37c39b0dc70522bb813809c38e5e099ebe",class:"style-container"},this.isLoading&&n("div",{key:"b8a28051b8ff2ae1d80b1a0af110f9e8342e2260",class:"loading"},"Loading style..."),this.error&&n("div",{key:"b7db13abadd3f11f5916296d3e0278ce9044fafc",class:"error"},"Style Error: ",this.error.message),this.parsedStyle&&n("div",{key:"56e9327b9794d3eb09c520a17cc1103538f42453",class:"success"},"Style loaded (",this.format.toUpperCase(),")",this.getLayerTargets().length>0&&n("div",{key:"b08e604f7fbec96aede1112538b0d785e9b3d226",class:"targets"},"Targets: ",this.getLayerTargets().join(", "))),n("slot",{key:"609e6131f414425f639cc81104cbb20da61bc1de"}))}static get watchers(){return{src:[{onStyleSourceChanged:0}],content:[{onStyleSourceChanged:0}],format:[{onStyleSourceChanged:0}]}}};oa.style=":host{display:block;position:relative}.style-container{min-height:20px}.loading{padding:8px;background-color:#f0f0f0;border-left:4px solid #2196f3;font-size:14px;color:#666}.error{padding:8px;background-color:#ffebee;border-left:4px solid #f44336;color:#c62828;font-size:14px}.success{padding:8px;background-color:#e8f5e8;border-left:4px solid #4caf50;color:#2e7d32;font-size:14px}.targets{margin-top:4px;font-size:12px;color:#666}";export{d as v_map_layer_geojson,y as v_map_layer_geotiff,g as v_map_layer_google,v as v_map_layer_scatterplot,x as v_map_layer_terrain,E as v_map_layer_tile3d,C as v_map_layer_wcs,k as v_map_layer_wfs,M as v_map_layer_wkt,_ as v_map_layer_wms,A as v_map_layer_xyz,oa as v_map_style}
|