@vcmap/ui 5.0.0-rc.7 → 5.0.0-rc.8

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.
@@ -1,4 +1,4 @@
1
- var ad=Object.defineProperty,od=Object.defineProperties;var ld=Object.getOwnPropertyDescriptors;var Ro=Object.getOwnPropertySymbols;var hd=Object.prototype.hasOwnProperty,cd=Object.prototype.propertyIsEnumerable;var Ao=(i,t,e)=>t in i?ad(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,_=(i,t)=>{for(var e in t||(t={}))hd.call(t,e)&&Ao(i,e,t[e]);if(Ro)for(var e of Ro(t))cd.call(t,e)&&Ao(i,e,t[e]);return i},O=(i,t)=>od(i,ld(t));import{ol$geom$Circle as le,ol$geom$GeometryCollection as ps,ol$geom$GeometryLayout as wn,ol$Feature as Z,ol$proj$getTransform as dt,ol$proj$get as ud,ol$proj$equivalent as dd,ol$proj$proj4$register as Go,ol$style$Style as ft,ol$style$Fill as he,ol$style$Stroke as ee,ol$style$Text as xn,ol$has$DEVICE_PIXEL_RATIO as fd,ol$style$RegularShape as bn,ol$style$Circle as ys,ol$style$Icon as vs,ol$style$Image as gd,ol$Map as md,ol$interaction$defaults as pd,ol$Observable$unByKey as yt,ol$View as On,ol$easing$inAndOut as yd,ol$extent$containsXY as ko,ol$extent$boundingExtent as _s,ol$extent$getBottomLeft as Pn,ol$geom$Point as bi,ol$geom$LineString as En,ol$geom$MultiPoint as zo,ol$geom$MultiLineString as jo,ol$geom$MultiPolygon as fr,ol$sphere$offset as gr,ol$geom$GeometryType as Re,ol$layer$Vector as $o,ol$geom$Polygon$circular as vd,ol$ImageState as mr,ol$geom$Polygon as In,ol$extent$getBottomRight as Ho,ol$extent$getTopRight as Vo,ol$extent$getTopLeft as pr,ol$proj$transform as Xe,ol$geom$Polygon$fromCircle as _d,ol$source$Vector as Ss,ol$tilegrid$createXYZ as Bo,ol$proj$Projection as Sd,ol$tilegrid$TileGrid as Uo,ol$source$TileImage as Md,ol$layer$Tile as Oi,ol$extent$containsCoordinate as Cd,ol$extent$buffer as qo,ol$extent$getCenter as Ln,ol$proj$transformExtent as Wo,ol$sphere$getDistance as wd,ol$format$GeoJSON as Yo,Feature as xd,ol$extent$getWidth as Tn,ol$source$TileWMS as bd,ol$format$GML2 as Nn,ol$format$WFS as Xo,ol$format$GML3 as Dn,ol$extent$createEmpty as Zo,ol$structs$LRUCache as Od,ol$extent$createOrUpdateFromCoordinate as Pd,ol$render$canvas$Immediate as Ed,ol$geom$flat$transform$transform2D as Id,ol$extent$intersects as Ld,ol$geom$SimpleGeometry$transformGeom2D as Td,ol$transform$scale as Nd,ol$transform$create as Dd,ol$transform$compose as Fd,ol$extent$extend as Jo,ol$source$OSM as Rd,ol$layer$Image as Ad,ol$source$ImageStatic as Gd,ol$source$TileDebug as kd,ol$source$XYZ as zd,ol$source$VectorTile as jd,ol$TileState as $d,ol$layer$VectorTile as Hd,ol$tilegrid$WMTS as Vd,ol$source$WMTS as Bd,ol$format$MVT as Ud}from"./ol.5c9201.js";import{Cartesian3 as C,Math as P,Material as Pi,Cartesian2 as Ht,Cesium3DTilePointFeature as Ae,Cesium3DTileFeature as Ge,Matrix3 as Vt,Quaternion as qd,Color as Ot,EasingFunction as Wd,Cesium3DTileStyle as Fn,Cesium3DTileColorBlendMode as yr,VerticalOrigin as Bt,Entity as Rn,ConditionsExpression as Yd,Expression as Xd,HeightReference as Yt,ClassificationType as Ei,NearFarScalar as Ms,SceneTransforms as Zd,MaterialAppearance as Jd,GeometryInstance as vr,ColorGeometryInstanceAttribute as Ko,PerInstanceColorAppearance as An,ShadowMode as Cs,ClassificationPrimitive as Qo,GroundPrimitive as tl,Primitive as Gn,PolylineMaterialAppearance as Kd,GroundPolylinePrimitive as el,PolygonGeometry as Qd,PolygonOutlineGeometry as tf,GroundPolylineGeometry as kn,PolylineGeometry as zn,PolygonHierarchy as il,CircleGeometry as ef,CircleOutlineGeometry as sf,Cartographic as et,WallGeometry as rf,WallOutlineGeometry as nf,HeadingPitchRoll as af,Matrix4 as A,Transforms as sl,Model as of,sampleTerrainMostDetailed as _r,ModelAnimationLoop as lf,LabelStyle as jn,HorizontalOrigin as $n,PrimitiveCollection as Hn,BillboardCollection as hf,LabelCollection as cf,CesiumTerrainProvider as rl,Cartesian4 as nl,sampleTerrain as uf,Ellipsoid as Vn,ExperimentalFeatures as df,Clock as ff,DataSourceClock as gf,JulianDate as al,KeyboardEventModifier as Bn,ScreenSpaceEventType as Ze,CesiumWidget as mf,DataSourceDisplay as ol,DataSourceCollection as ll,RequestScheduler as pf,ScreenSpaceEventHandler as yf,Ray as vf,Camera as _f,ImageryLayer as Je,CustomDataSource as hl,Cesium3DTileset as ws,BoundingSphere as cl,Intersect as Sf,CesiumInspector as Mf,Cesium3DTilesInspector as Cf,BillboardVisualizer as wf,LabelVisualizer as xf,PointVisualizer as bf,Rectangle as Ut,Composite3DTileContent as Of,HeadingPitchRange as Pf,BoundingSphereState as ul,OpenStreetMapImageryProvider as Ef,SingleTileImageryProvider as If,WebMercatorTilingScheme as Un,GeographicTilingScheme as dl,SplitDirection as X,TileMapServiceImageryProvider as Lf,Event as Tf,WebMapServiceImageryProvider as Nf,WebMapTileServiceImageryProvider as Df,EntityCollection as Ff,CzmlDataSource as Rf,Plane as Ke,ClippingPlaneCollection as Qe,ClippingPlane as ti,ConstantProperty as Af,Globe as Gf}from"./cesium.2a963a.js";const xs=[[String,"string"],[Number,"number"],[Boolean,"boolean"],[Function,"function"],[void 0,"undefined"],[Symbol,"symbol"]];function Sr(i){const t={};if(!i||t.toString(i)!=="[object Object]")return!1;const e=Object.getPrototypeOf(i);if(!e)return!0;const s=t.hasOwnProperty,r=s.call(e,"constructor")&&e.constructor;return typeof r=="function"&&s.toString.call(r)===s.toString.call(Object)}function ie(i,t){if(i===null)return"null";if(typeof i=="undefined")return"undefined";if(t)return typeof i;let e;if(Array.isArray(i))e=`[${i.map(r=>ie(r,t)).join(",")}]`;else try{e=JSON.stringify(i)}catch{e=typeof i}return e=e||typeof i,e.length>20?`${e.substr(0,20)}...`:e}function kf(i,t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"?i===t?!1:`Expected ${ie(i)} to equal ${t.toString()}`:null}function zf(i,t,e){if(Array.isArray(t)){if(t.length!==1)throw new Error("Array patterns may only have on type");if(Array.isArray(i)){let s=!1;return i.findIndex(n=>{try{v(n,t[0],e)}catch(a){s=a.message.replace(/Match failed:\s/,"")}return s})>-1?`${s} in ${ie(i)}`:!1}return`Expected ${ie(i)} to be an Array`}return null}function qn(i,t,e){const s=e?`${e}.`:"";if(!Sr(i))return`Expected ${ie(i)} to be a plain Object`;let n=!1;const a=Object.keys(t).find(o=>{const l=i[o];if(Sr(t[o]))n=qn(l,t[o],s+o);else try{v(l,t[o])}catch(h){n=h.message.replace(/Match failed:\s/,"")}return n});return a?`${n} in object.${s}${a}`:!1}function jf(i,t){if(t===Number)return Number.isFinite(i)?!1:`expected ${ie(i)} to be a number, excluding NaN`;for(let e=xs.length;e--;)if(t===xs[e][0])return typeof i===xs[e][1]?!1:`expected ${ie(i)} to be a ${xs[e][1]}`;return null}function Wn(i){if(i===null)return"null";const t=xs.find(r=>r[0]===i);if(t)return t[1];let e=i.toString();if(i.className)return i.className;const s=e.match(/function (.*)\(/);if(s&&s.length>1)return s[1];if(Sr(i)){const r={};Object.keys(i).forEach(n=>{r[n]=Wn(i[n])});try{e=`Object of ${JSON.stringify(r)}`}catch{e="Object"}}return e}function fl(i,t,e){const s=e?`${e}.`:"";let r=!1;return Object.keys(i).find(a=>{if(Sr(t[a])){const o=i[a];r=fl(o,t[a],s+a)}else t[a]||(r=`Found additional key ${s}${a}`);return r=r?r.replace(/\sin.*/,""):!1,r})?`${r} in ${ie(i)}`:!1}function gl(i,t,e){const s=function(a,o){if(o==null)return a===o?!1:`Expected ${ie(a)} to be ${o}`;const l=jf(a,o);if(l!==null)return l;const h=kf(a,o);if(h!==null)return h;if(Array.isArray(o))return zf(a,o,e);if(o instanceof Function)return a instanceof o?!1:`Expected ${ie(a,!0)} to be of Type ${Wn(o)}`;if(o===Object)return qn(a,{});if(typeof o!="object")throw new Error(`Cannot handler pattern ${o}`);const c=qn(a,o);return c||(e?fl(a,o):!1)};let r;return Array.isArray(t)&&t.length>1?t.every(a=>s(i,a))&&(r=`Expected ${ie(i)} to be a ${t.map(a=>Wn(a)).join(" or ")}`):r=s(i,t),r}function Yn(i,t,e){return!gl(i,t,e)}function v(i,t,e){const s=gl(i,t,e);if(s)throw new Error(`Match failed: ${s}`);return!1}function it(i,t,e){const s=[null,void 0];return Array.isArray(t)&&t.length>1?t.forEach(r=>{s.push(r)}):s.push(t),v(i,s.reverse(),e)}function $f(i,t,e){const r=P.toRadians(e),n=P.toRadians(i[1]),a=P.toRadians(i[0]),o=Math.asin(Math.sin(n)*Math.cos(t/6371e3)+Math.cos(n)*Math.sin(t/6371e3)*Math.cos(r)),l=a+Math.atan2(Math.sin(r)*Math.sin(t/6371e3)*Math.cos(n),Math.cos(t/6371e3)-Math.sin(n)*Math.sin(o));return[parseFloat(P.toDegrees(l).toFixed(5)),parseFloat(P.toDegrees(o).toFixed(5))]}function Hf(i,t){const e=P.toRadians(i[0]),s=P.toRadians(i[1]),r=P.toRadians(t[0]),n=P.toRadians(t[1]),a=Math.sin(r-e)*Math.cos(n),o=Math.cos(s)*Math.sin(n)-Math.sin(s)*Math.cos(n)*Math.cos(r-e);let l=P.toDegrees(Math.atan2(a,o));return l=(l+360)%360,l}function ke(i,t){const e=i[0]-t[0],s=i[1]-t[1];return Math.sqrt(e**2+s**2)}function ml(i,t){const e=C.fromElements(i[0],i[1],i[2]),s=C.fromElements(t[0],t[1],t[2]);return C.distance(e,s)}le.prototype.getCoordinates=function(){return[this.getCenter(),this.getLastCoordinate()]},le.prototype.setCoordinates=function(t,e){v(t,[[Number]]),v(t.length,2);const s=e||this.getLayout(),r=/XYM?/.test(s)?ke:ml;this.setCenterAndRadius(t[0],r(t[0],t[1]),e)},ps.prototype.getCoordinates=function(){return this.getGeometries().map(t=>t.getCoordinates())},ps.prototype.setCoordinates=function(t,e){v(t,Array),v(t.length,this.getGeometries().length),this.setGeometries(this.getGeometries().map((s,r)=>(s.setCoordinates(t[r],e),s)))},ps.prototype.getLayout=function(){const t=this.getGeometries()[0];return t?t.getLayout():wn.XYZ},Z.prototype.getProperty=function(t){if(t==="attributes"){const e=this.getProperties();return this.getGeometryName()&&delete e[this.getGeometryName()],e}else if(t==="olcs_geometryType"){const e=this.getGeometry().getType();return e==="Polygon"?1:e==="LineString"?2:e==="Point"?3:e==="Circle"||e==="MultiPolygon"?1:e==="MultiLineString"?2:e==="MultiPoint"?3:void 0}return this.get(t)},Z.prototype.getPropertyInherited=function(t){return this.getProperty(t)},Pi._materialCache.addMaterial("Wallpaper",{fabric:{type:"Wallpaper",uniforms:{image:Pi.DefaultImageId,anchor:new Ht(0,0)},components:{diffuse:"texture2D(image, fract((gl_FragCoord.xy - anchor.xy) / vec2(imageDimensions.xy))).rgb",alpha:"texture2D(image, fract((gl_FragCoord.xy - anchor.xy) / vec2(imageDimensions.xy))).a"}},translucent:!1}),Ae.prototype.getId=function(){return this.getProperty("id")||`${this.content.url}${this._batchId}`},Ge.prototype.getId=function(){return this.getProperty("id")||`${this.content.url}${this._batchId}`},new C,new Vt,new qd,new Ot;var Mr,Vf=new Uint8Array(16);function Bf(){if(!Mr&&(Mr=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Mr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Mr(Vf)}var Uf=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function pl(i){return typeof i=="string"&&Uf.test(i)}for(var vt=[],Xn=0;Xn<256;++Xn)vt.push((Xn+256).toString(16).substr(1));function yl(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(vt[i[t+0]]+vt[i[t+1]]+vt[i[t+2]]+vt[i[t+3]]+"-"+vt[i[t+4]]+vt[i[t+5]]+"-"+vt[i[t+6]]+vt[i[t+7]]+"-"+vt[i[t+8]]+vt[i[t+9]]+"-"+vt[i[t+10]]+vt[i[t+11]]+vt[i[t+12]]+vt[i[t+13]]+vt[i[t+14]]+vt[i[t+15]]).toLowerCase();if(!pl(e))throw TypeError("Stringified UUID is invalid");return e}function qf(i){if(!pl(i))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(i.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=t&255,e[4]=(t=parseInt(i.slice(9,13),16))>>>8,e[5]=t&255,e[6]=(t=parseInt(i.slice(14,18),16))>>>8,e[7]=t&255,e[8]=(t=parseInt(i.slice(19,23),16))>>>8,e[9]=t&255,e[10]=(t=parseInt(i.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=t&255,e}function Wf(i){i=unescape(encodeURIComponent(i));for(var t=[],e=0;e<i.length;++e)t.push(i.charCodeAt(e));return t}var Yf="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Xf="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Zf(i,t,e){function s(r,n,a,o){if(typeof r=="string"&&(r=Wf(r)),typeof n=="string"&&(n=qf(n)),n.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var l=new Uint8Array(16+r.length);if(l.set(n),l.set(r,n.length),l=e(l),l[6]=l[6]&15|t,l[8]=l[8]&63|128,a){o=o||0;for(var h=0;h<16;++h)a[o+h]=l[h];return a}return yl(l)}try{s.name=i}catch{}return s.DNS=Yf,s.URL=Xf,s}function Xt(i,t,e){i=i||{};var s=i.random||(i.rng||Bf)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,t){e=e||0;for(var r=0;r<16;++r)t[e+r]=s[r];return t}return yl(s)}function Jf(i,t,e,s){switch(i){case 0:return t&e^~t&s;case 1:return t^e^s;case 2:return t&e^t&s^e&s;case 3:return t^e^s}}function Zn(i,t){return i<<t|i>>>32-t}function Kf(i){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof i=="string"){var s=unescape(encodeURIComponent(i));i=[];for(var r=0;r<s.length;++r)i.push(s.charCodeAt(r))}else Array.isArray(i)||(i=Array.prototype.slice.call(i));i.push(128);for(var n=i.length/4+2,a=Math.ceil(n/16),o=new Array(a),l=0;l<a;++l){for(var h=new Uint32Array(16),c=0;c<16;++c)h[c]=i[l*64+c*4]<<24|i[l*64+c*4+1]<<16|i[l*64+c*4+2]<<8|i[l*64+c*4+3];o[l]=h}o[a-1][14]=(i.length-1)*8/Math.pow(2,32),o[a-1][14]=Math.floor(o[a-1][14]),o[a-1][15]=(i.length-1)*8&4294967295;for(var u=0;u<a;++u){for(var d=new Uint32Array(80),f=0;f<16;++f)d[f]=o[u][f];for(var g=16;g<80;++g)d[g]=Zn(d[g-3]^d[g-8]^d[g-14]^d[g-16],1);for(var m=e[0],p=e[1],y=e[2],M=e[3],x=e[4],L=0;L<80;++L){var I=Math.floor(L/20),D=Zn(m,5)+Jf(I,p,y,M)+x+t[I]+d[L]>>>0;x=M,M=y,y=Zn(p,30)>>>0,p=m,m=D}e[0]=e[0]+m>>>0,e[1]=e[1]+p>>>0,e[2]=e[2]+y>>>0,e[3]=e[3]+M>>>0,e[4]=e[4]+x>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,e[0]&255,e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,e[1]&255,e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,e[2]&255,e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,e[3]&255,e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,e[4]&255]}var Qf=Zf("v5",80,Kf),tg=Qf;const st={OFF:1,ERROR:2,WARN:4,INFO:8,DEBUG:16},Ce={ERROR:0,WARN:0,INFO:0,DEBUG:0};Ce.ERROR=st.ERROR|st.WARN|st.INFO|st.DEBUG,Ce.WARN=st.WARN|st.INFO|st.DEBUG,Ce.INFO=st.INFO|st.DEBUG,Ce.DEBUG=st.DEBUG;const bs={useTimestamp:!1,logLevel:st.INFO},Os=new Map;Os.set(st.ERROR,"error"),Os.set(st.WARN,"warn"),Os.set(st.INFO,"info"),Os.set(st.DEBUG,"log");class vl{constructor(t){this.className=t,this.deprecations=new Map}error(t,...e){bs.logLevel&Ce.ERROR&&this._log(String(t),st.ERROR,e)}warning(t,...e){bs.logLevel&Ce.WARN&&this._log(String(t),st.WARN,e)}deprecate(t,e){const s=String(t),r=e?String(e):null;if(!this.deprecations.has(s)){this.deprecations.set(s,r||null);let n=`${s} has been deprecated and will be removed`;r&&(n=`${n}. ${r}`),this.warning(n)}}info(t,...e){bs.logLevel&Ce.INFO&&this._log(String(t),st.INFO,e)}debug(t,...e){bs.logLevel&Ce.DEBUG&&this._log(String(t),st.DEBUG,e)}log(t,...e){bs.logLevel&Ce.DEBUG&&this._log(String(t),st.DEBUG,e)}_log(t,e,s){let r=t;this.className&&(r=`[${this.className}] ${r}`),console[Os.get(e)](r,...s),e&st.ERROR&&(console.group(),console.trace(),console.groupEnd())}}const Jn=new Map;let Kn;function eg(){return Kn||(Kn=new vl),Kn}function ig(i){const t=new vl(i);return Jn.set(i,t),t}function Pt(i){return i?Jn.has(i)?Jn.get(i):ig(i):eg()}function V(i,t){if(i!=null){const e=Number.parseInt(String(i),10);if(e!=null&&!Number.isNaN(e))return e}return t}function E(i,t){if(i!=null){const e=Number.parseFloat(String(i));if(e!=null&&!Number.isNaN(e))return e}return t}function Cr(i,t,e,s){const r=E(i,t);return r<e?e:r>s?s:r}function rt(i,t){return i==null?t:typeof i=="boolean"?i:i===1?!0:i===0?!1:typeof i=="string"&&(i.toLowerCase()==="true"||i.toLowerCase()==="1")?!0:typeof i=="string"&&(i.toLowerCase()==="false"||i.toLowerCase()==="0")?!1:t}function Qn(i,t,e){if(i!=null){const s=Object.values(t).find(r=>r==i);if(s!=null)return s}return e}function ze(i,t,e){if(i!=null){const s=Object.keys(t).find(r=>r==i);if(s!=null)return t[s]}return e}function sg(i){i("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),i("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),i("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),i.WGS84=i["EPSG:4326"],i["EPSG:3785"]=i["EPSG:3857"],i.GOOGLE=i["EPSG:3857"],i["EPSG:900913"]=i["EPSG:3857"],i["EPSG:102113"]=i["EPSG:3857"]}var ei=1,ii=2,wr=3,rg=4,ta=5,_l=6378137,ng=6356752314e-3,Sl=.0066943799901413165,Ps=484813681109536e-20,S=Math.PI/2,ag=.16666666666666666,og=.04722222222222222,lg=.022156084656084655,w=1e-10,_t=.017453292519943295,ce=57.29577951308232,j=Math.PI/4,Es=Math.PI*2,nt=3.14159265359,Dt={};Dt.greenwich=0,Dt.lisbon=-9.131906111111,Dt.paris=2.337229166667,Dt.bogota=-74.080916666667,Dt.madrid=-3.687938888889,Dt.rome=12.452333333333,Dt.bern=7.439583333333,Dt.jakarta=106.807719444444,Dt.ferro=-17.666666666667,Dt.brussels=4.367975,Dt.stockholm=18.058277777778,Dt.athens=23.7163375,Dt.oslo=10.722916666667;var hg={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},Ml=/[\s_\-\/\(\)]/g;function je(i,t){if(i[t])return i[t];for(var e=Object.keys(i),s=t.toLowerCase().replace(Ml,""),r=-1,n,a;++r<e.length;)if(n=e[r],a=n.toLowerCase().replace(Ml,""),a===s)return i[n]}function ea(i){var t={},e=i.split("+").map(function(o){return o.trim()}).filter(function(o){return o}).reduce(function(o,l){var h=l.split("=");return h.push(!0),o[h[0].toLowerCase()]=h[1],o},{}),s,r,n,a={proj:"projName",datum:"datumCode",rf:function(o){t.rf=parseFloat(o)},lat_0:function(o){t.lat0=o*_t},lat_1:function(o){t.lat1=o*_t},lat_2:function(o){t.lat2=o*_t},lat_ts:function(o){t.lat_ts=o*_t},lon_0:function(o){t.long0=o*_t},lon_1:function(o){t.long1=o*_t},lon_2:function(o){t.long2=o*_t},alpha:function(o){t.alpha=parseFloat(o)*_t},gamma:function(o){t.rectified_grid_angle=parseFloat(o)},lonc:function(o){t.longc=o*_t},x_0:function(o){t.x0=parseFloat(o)},y_0:function(o){t.y0=parseFloat(o)},k_0:function(o){t.k0=parseFloat(o)},k:function(o){t.k0=parseFloat(o)},a:function(o){t.a=parseFloat(o)},b:function(o){t.b=parseFloat(o)},r_a:function(){t.R_A=!0},zone:function(o){t.zone=parseInt(o,10)},south:function(){t.utmSouth=!0},towgs84:function(o){t.datum_params=o.split(",").map(function(l){return parseFloat(l)})},to_meter:function(o){t.to_meter=parseFloat(o)},units:function(o){t.units=o;var l=je(hg,o);l&&(t.to_meter=l.to_meter)},from_greenwich:function(o){t.from_greenwich=o*_t},pm:function(o){var l=je(Dt,o);t.from_greenwich=(l||parseFloat(o))*_t},nadgrids:function(o){o==="@null"?t.datumCode="none":t.nadgrids=o},axis:function(o){var l="ewnsud";o.length===3&&l.indexOf(o.substr(0,1))!==-1&&l.indexOf(o.substr(1,1))!==-1&&l.indexOf(o.substr(2,1))!==-1&&(t.axis=o)},approx:function(){t.approx=!0}};for(s in e)r=e[s],s in a?(n=a[s],typeof n=="function"?n(r):t[n]=r):t[s]=r;return typeof t.datumCode=="string"&&t.datumCode!=="WGS84"&&(t.datumCode=t.datumCode.toLowerCase()),t}var Is=1,Cl=2,wl=3,xr=4,xl=5,ia=-1,cg=/\s/,ug=/[A-Za-z]/,dg=/[A-Za-z84]/,br=/[,\]]/,bl=/[\d\.E\-\+]/;function we(i){if(typeof i!="string")throw new Error("not a string");this.text=i.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Is}we.prototype.readCharicter=function(){var i=this.text[this.place++];if(this.state!==xr)for(;cg.test(i);){if(this.place>=this.text.length)return;i=this.text[this.place++]}switch(this.state){case Is:return this.neutral(i);case Cl:return this.keyword(i);case xr:return this.quoted(i);case xl:return this.afterquote(i);case wl:return this.number(i);case ia:return}},we.prototype.afterquote=function(i){if(i==='"'){this.word+='"',this.state=xr;return}if(br.test(i)){this.word=this.word.trim(),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in afterquote yet, index '+this.place)},we.prototype.afterItem=function(i){if(i===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Is;return}if(i==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Is,this.currentObject=this.stack.pop(),this.currentObject||(this.state=ia);return}},we.prototype.number=function(i){if(bl.test(i)){this.word+=i;return}if(br.test(i)){this.word=parseFloat(this.word),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in number yet, index '+this.place)},we.prototype.quoted=function(i){if(i==='"'){this.state=xl;return}this.word+=i},we.prototype.keyword=function(i){if(dg.test(i)){this.word+=i;return}if(i==="["){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=Is;return}if(br.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in keyword yet, index '+this.place)},we.prototype.neutral=function(i){if(ug.test(i)){this.word=i,this.state=Cl;return}if(i==='"'){this.word="",this.state=xr;return}if(bl.test(i)){this.word=i,this.state=wl;return}if(br.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in neutral yet, index '+this.place)},we.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===ia)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function fg(i){var t=new we(i);return t.output()}function Ol(i,t,e){Array.isArray(t)&&(e.unshift(t),t=null);var s=t?{}:i,r=e.reduce(function(n,a){return Ii(a,n),n},s);t&&(i[t]=r)}function Ii(i,t){if(!Array.isArray(i)){t[i]=!0;return}var e=i.shift();if(e==="PARAMETER"&&(e=i.shift()),i.length===1){if(Array.isArray(i[0])){t[e]={},Ii(i[0],t[e]);return}t[e]=i[0];return}if(!i.length){t[e]=!0;return}if(e==="TOWGS84"){t[e]=i;return}if(e==="AXIS"){e in t||(t[e]=[]),t[e].push(i);return}Array.isArray(e)||(t[e]={});var s;switch(e){case"UNIT":case"PRIMEM":case"VERT_DATUM":t[e]={name:i[0].toLowerCase(),convert:i[1]},i.length===3&&Ii(i[2],t[e]);return;case"SPHEROID":case"ELLIPSOID":t[e]={name:i[0],a:i[1],rf:i[2]},i.length===4&&Ii(i[3],t[e]);return;case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":i[0]=["name",i[0]],Ol(t,e,i);return;default:for(s=-1;++s<i.length;)if(!Array.isArray(i[s]))return Ii(i,t[e]);return Ol(t,e,i)}}var gg=.017453292519943295;function mg(i,t){var e=t[0],s=t[1];!(e in i)&&s in i&&(i[e]=i[s],t.length===3&&(i[e]=t[2](i[e])))}function xe(i){return i*gg}function pg(i){if(i.type==="GEOGCS"?i.projName="longlat":i.type==="LOCAL_CS"?(i.projName="identity",i.local=!0):typeof i.PROJECTION=="object"?i.projName=Object.keys(i.PROJECTION)[0]:i.projName=i.PROJECTION,i.AXIS){for(var t="",e=0,s=i.AXIS.length;e<s;++e){var r=[i.AXIS[e][0].toLowerCase(),i.AXIS[e][1].toLowerCase()];r[0].indexOf("north")!==-1||(r[0]==="y"||r[0]==="lat")&&r[1]==="north"?t+="n":r[0].indexOf("south")!==-1||(r[0]==="y"||r[0]==="lat")&&r[1]==="south"?t+="s":r[0].indexOf("east")!==-1||(r[0]==="x"||r[0]==="lon")&&r[1]==="east"?t+="e":(r[0].indexOf("west")!==-1||(r[0]==="x"||r[0]==="lon")&&r[1]==="west")&&(t+="w")}t.length===2&&(t+="u"),t.length===3&&(i.axis=t)}i.UNIT&&(i.units=i.UNIT.name.toLowerCase(),i.units==="metre"&&(i.units="meter"),i.UNIT.convert&&(i.type==="GEOGCS"?i.DATUM&&i.DATUM.SPHEROID&&(i.to_meter=i.UNIT.convert*i.DATUM.SPHEROID.a):i.to_meter=i.UNIT.convert));var n=i.GEOGCS;i.type==="GEOGCS"&&(n=i),n&&(n.DATUM?i.datumCode=n.DATUM.name.toLowerCase():i.datumCode=n.name.toLowerCase(),i.datumCode.slice(0,2)==="d_"&&(i.datumCode=i.datumCode.slice(2)),(i.datumCode==="new_zealand_geodetic_datum_1949"||i.datumCode==="new_zealand_1949")&&(i.datumCode="nzgd49"),(i.datumCode==="wgs_1984"||i.datumCode==="world_geodetic_system_1984")&&(i.PROJECTION==="Mercator_Auxiliary_Sphere"&&(i.sphere=!0),i.datumCode="wgs84"),i.datumCode.slice(-6)==="_ferro"&&(i.datumCode=i.datumCode.slice(0,-6)),i.datumCode.slice(-8)==="_jakarta"&&(i.datumCode=i.datumCode.slice(0,-8)),~i.datumCode.indexOf("belge")&&(i.datumCode="rnb72"),n.DATUM&&n.DATUM.SPHEROID&&(i.ellps=n.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),i.ellps.toLowerCase().slice(0,13)==="international"&&(i.ellps="intl"),i.a=n.DATUM.SPHEROID.a,i.rf=parseFloat(n.DATUM.SPHEROID.rf,10)),n.DATUM&&n.DATUM.TOWGS84&&(i.datum_params=n.DATUM.TOWGS84),~i.datumCode.indexOf("osgb_1936")&&(i.datumCode="osgb36"),~i.datumCode.indexOf("osni_1952")&&(i.datumCode="osni52"),(~i.datumCode.indexOf("tm65")||~i.datumCode.indexOf("geodetic_datum_of_1965"))&&(i.datumCode="ire65"),i.datumCode==="ch1903+"&&(i.datumCode="ch1903"),~i.datumCode.indexOf("israel")&&(i.datumCode="isr93")),i.b&&!isFinite(i.b)&&(i.b=i.a);function a(h){var c=i.to_meter||1;return h*c}var o=function(h){return mg(i,h)},l=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",xe],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",xe],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",xe],["lat0","latitude_of_origin",xe],["lat0","standard_parallel_1",xe],["lat1","standard_parallel_1",xe],["lat2","standard_parallel_2",xe],["azimuth","Azimuth"],["alpha","azimuth",xe],["srsCode","name"]];l.forEach(o),!i.long0&&i.longc&&(i.projName==="Albers_Conic_Equal_Area"||i.projName==="Lambert_Azimuthal_Equal_Area")&&(i.long0=i.longc),!i.lat_ts&&i.lat1&&(i.projName==="Stereographic_South_Pole"||i.projName==="Polar Stereographic (variant B)")&&(i.lat0=xe(i.lat1>0?90:-90),i.lat_ts=i.lat1)}function Pl(i){var t=fg(i),e=t.shift(),s=t.shift();t.unshift(["name",s]),t.unshift(["type",e]);var r={};return Ii(t,r),pg(r),r}function Et(i){var t=this;if(arguments.length===2){var e=arguments[1];typeof e=="string"?e.charAt(0)==="+"?Et[i]=ea(arguments[1]):Et[i]=Pl(arguments[1]):Et[i]=e}else if(arguments.length===1){if(Array.isArray(i))return i.map(function(s){Array.isArray(s)?Et.apply(t,s):Et(s)});if(typeof i=="string"){if(i in Et)return Et[i]}else"EPSG"in i?Et["EPSG:"+i.EPSG]=i:"ESRI"in i?Et["ESRI:"+i.ESRI]=i:"IAU2000"in i?Et["IAU2000:"+i.IAU2000]=i:console.log(i);return}}sg(Et);function yg(i){return typeof i=="string"}function vg(i){return i in Et}var _g=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Sg(i){return _g.some(function(t){return i.indexOf(t)>-1})}var Mg=["3857","900913","3785","102113"];function Cg(i){var t=je(i,"authority");if(!!t){var e=je(t,"epsg");return e&&Mg.indexOf(e)>-1}}function wg(i){var t=je(i,"extension");if(!!t)return je(t,"proj4")}function xg(i){return i[0]==="+"}function bg(i){if(yg(i)){if(vg(i))return Et[i];if(Sg(i)){var t=Pl(i);if(Cg(t))return Et["EPSG:3857"];var e=wg(t);return e?ea(e):t}if(xg(i))return ea(i)}else return i}function El(i,t){i=i||{};var e,s;if(!t)return i;for(s in t)e=t[s],e!==void 0&&(i[s]=e);return i}function ue(i,t,e){var s=i*t;return e/Math.sqrt(1-s*s)}function Ls(i){return i<0?-1:1}function b(i){return Math.abs(i)<=nt?i:i-Ls(i)*Es}function se(i,t,e){var s=i*e,r=.5*i;return s=Math.pow((1-s)/(1+s),r),Math.tan(.5*(S-t))/s}function Ts(i,t){for(var e=.5*i,s,r,n=S-2*Math.atan(t),a=0;a<=15;a++)if(s=i*Math.sin(n),r=S-2*Math.atan(t*Math.pow((1-s)/(1+s),e))-n,n+=r,Math.abs(r)<=1e-10)return n;return-9999}function Og(){var i=this.b/this.a;this.es=1-i*i,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=ue(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function Pg(i){var t=i.x,e=i.y;if(e*ce>90&&e*ce<-90&&t*ce>180&&t*ce<-180)return null;var s,r;if(Math.abs(Math.abs(e)-S)<=w)return null;if(this.sphere)s=this.x0+this.a*this.k0*b(t-this.long0),r=this.y0+this.a*this.k0*Math.log(Math.tan(j+.5*e));else{var n=Math.sin(e),a=se(this.e,e,n);s=this.x0+this.a*this.k0*b(t-this.long0),r=this.y0-this.a*this.k0*Math.log(a)}return i.x=s,i.y=r,i}function Eg(i){var t=i.x-this.x0,e=i.y-this.y0,s,r;if(this.sphere)r=S-2*Math.atan(Math.exp(-e/(this.a*this.k0)));else{var n=Math.exp(-e/(this.a*this.k0));if(r=Ts(this.e,n),r===-9999)return null}return s=b(this.long0+t/(this.a*this.k0)),i.x=s,i.y=r,i}var Ig=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],Lg={init:Og,forward:Pg,inverse:Eg,names:Ig};function Tg(){}function Il(i){return i}var Ng=["longlat","identity"],Dg={init:Tg,forward:Il,inverse:Il,names:Ng},Fg=[Lg,Dg],Or={},Pr=[];function Ll(i,t){var e=Pr.length;return i.names?(Pr[e]=i,i.names.forEach(function(s){Or[s.toLowerCase()]=e}),this):(console.log(t),!0)}function Rg(i){if(!i)return!1;var t=i.toLowerCase();if(typeof Or[t]!="undefined"&&Pr[Or[t]])return Pr[Or[t]]}function Ag(){Fg.forEach(Ll)}var Gg={start:Ag,add:Ll,get:Rg},N={};N.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"},N.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},N.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},N.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"},N.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},N.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},N.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},N.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},N.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},N.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},N.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},N.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},N.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},N.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},N.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},N.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},N.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},N.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},N.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},N.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},N.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},N.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},N.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},N.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},N.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},N.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"},N.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"},N.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"},N.hough={a:6378270,rf:297,ellipseName:"Hough"},N.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},N.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"},N.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"},N.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"},N.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},N.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},N.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},N.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},N.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},N.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"},N.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"},N.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var kg=N.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};N.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function zg(i,t,e,s){var r=i*i,n=t*t,a=(r-n)/r,o=0;s?(i*=1-a*(ag+a*(og+a*lg)),r=i*i,a=0):o=Math.sqrt(a);var l=(r-n)/n;return{es:a,e:o,ep2:l}}function jg(i,t,e,s,r){if(!i){var n=je(N,s);n||(n=kg),i=n.a,t=n.b,e=n.rf}return e&&!t&&(t=(1-1/e)*i),(e===0||Math.abs(i-t)<w)&&(r=!0,t=i),{a:i,b:t,rf:e,sphere:r}}var gt={};gt.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},gt.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},gt.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},gt.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},gt.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},gt.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},gt.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},gt.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},gt.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},gt.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},gt.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},gt.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},gt.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},gt.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},gt.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gt.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},gt.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function $g(i,t,e,s,r,n,a){var o={};return i===void 0||i==="none"?o.datum_type=ta:o.datum_type=rg,t&&(o.datum_params=t.map(parseFloat),(o.datum_params[0]!==0||o.datum_params[1]!==0||o.datum_params[2]!==0)&&(o.datum_type=ei),o.datum_params.length>3&&(o.datum_params[3]!==0||o.datum_params[4]!==0||o.datum_params[5]!==0||o.datum_params[6]!==0)&&(o.datum_type=ii,o.datum_params[3]*=Ps,o.datum_params[4]*=Ps,o.datum_params[5]*=Ps,o.datum_params[6]=o.datum_params[6]/1e6+1)),a&&(o.datum_type=wr,o.grids=a),o.a=e,o.b=s,o.es=r,o.ep2=n,o}var Tl={};function Hg(i,t){var e=new DataView(t),s=Ug(e),r=qg(e,s);r.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var n=Wg(e,r,s),a={header:r,subgrids:n};return Tl[i]=a,a}function Vg(i){if(i===void 0)return null;var t=i.split(",");return t.map(Bg)}function Bg(i){if(i.length===0)return null;var t=i[0]==="@";return t&&(i=i.slice(1)),i==="null"?{name:"null",mandatory:!t,grid:null,isNull:!0}:{name:i,mandatory:!t,grid:Tl[i]||null,isNull:!1}}function Li(i){return i/3600*Math.PI/180}function Ug(i){var t=i.getInt32(8,!1);return t===11?!1:(t=i.getInt32(8,!0),t!==11&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function qg(i,t){return{nFields:i.getInt32(8,t),nSubgridFields:i.getInt32(24,t),nSubgrids:i.getInt32(40,t),shiftType:sa(i,56,56+8).trim(),fromSemiMajorAxis:i.getFloat64(120,t),fromSemiMinorAxis:i.getFloat64(136,t),toSemiMajorAxis:i.getFloat64(152,t),toSemiMinorAxis:i.getFloat64(168,t)}}function sa(i,t,e){return String.fromCharCode.apply(null,new Uint8Array(i.buffer.slice(t,e)))}function Wg(i,t,e){for(var s=176,r=[],n=0;n<t.nSubgrids;n++){var a=Xg(i,s,e),o=Zg(i,s,a,e),l=Math.round(1+(a.upperLongitude-a.lowerLongitude)/a.longitudeInterval),h=Math.round(1+(a.upperLatitude-a.lowerLatitude)/a.latitudeInterval);r.push({ll:[Li(a.lowerLongitude),Li(a.lowerLatitude)],del:[Li(a.longitudeInterval),Li(a.latitudeInterval)],lim:[l,h],count:a.gridNodeCount,cvs:Yg(o)})}return r}function Yg(i){return i.map(function(t){return[Li(t.longitudeShift),Li(t.latitudeShift)]})}function Xg(i,t,e){return{name:sa(i,t+8,t+16).trim(),parent:sa(i,t+24,t+24+8).trim(),lowerLatitude:i.getFloat64(t+72,e),upperLatitude:i.getFloat64(t+88,e),lowerLongitude:i.getFloat64(t+104,e),upperLongitude:i.getFloat64(t+120,e),latitudeInterval:i.getFloat64(t+136,e),longitudeInterval:i.getFloat64(t+152,e),gridNodeCount:i.getInt32(t+168,e)}}function Zg(i,t,e,s){for(var r=t+176,n=16,a=[],o=0;o<e.gridNodeCount;o++){var l={latitudeShift:i.getFloat32(r+o*n,s),longitudeShift:i.getFloat32(r+o*n+4,s),latitudeAccuracy:i.getFloat32(r+o*n+8,s),longitudeAccuracy:i.getFloat32(r+o*n+12,s)};a.push(l)}return a}function de(i,t){if(!(this instanceof de))return new de(i);t=t||function(h){if(h)throw h};var e=bg(i);if(typeof e!="object"){t(i);return}var s=de.projections.get(e.projName);if(!s){t(i);return}if(e.datumCode&&e.datumCode!=="none"){var r=je(gt,e.datumCode);r&&(e.datum_params=e.datum_params||(r.towgs84?r.towgs84.split(","):null),e.ellps=r.ellipse,e.datumName=r.datumName?r.datumName:e.datumCode)}e.k0=e.k0||1,e.axis=e.axis||"enu",e.ellps=e.ellps||"wgs84",e.lat1=e.lat1||e.lat0;var n=jg(e.a,e.b,e.rf,e.ellps,e.sphere),a=zg(n.a,n.b,n.rf,e.R_A),o=Vg(e.nadgrids),l=e.datum||$g(e.datumCode,e.datum_params,n.a,n.b,a.es,a.ep2,o);El(this,e),El(this,s),this.a=n.a,this.b=n.b,this.rf=n.rf,this.sphere=n.sphere,this.es=a.es,this.e=a.e,this.ep2=a.ep2,this.datum=l,this.init(),t(null,this)}de.projections=Gg,de.projections.start();function Jg(i,t){return i.datum_type!==t.datum_type||i.a!==t.a||Math.abs(i.es-t.es)>5e-11?!1:i.datum_type===ei?i.datum_params[0]===t.datum_params[0]&&i.datum_params[1]===t.datum_params[1]&&i.datum_params[2]===t.datum_params[2]:i.datum_type===ii?i.datum_params[0]===t.datum_params[0]&&i.datum_params[1]===t.datum_params[1]&&i.datum_params[2]===t.datum_params[2]&&i.datum_params[3]===t.datum_params[3]&&i.datum_params[4]===t.datum_params[4]&&i.datum_params[5]===t.datum_params[5]&&i.datum_params[6]===t.datum_params[6]:!0}function Nl(i,t,e){var s=i.x,r=i.y,n=i.z?i.z:0,a,o,l,h;if(r<-S&&r>-1.001*S)r=-S;else if(r>S&&r<1.001*S)r=S;else{if(r<-S)return{x:-1/0,y:-1/0,z:i.z};if(r>S)return{x:1/0,y:1/0,z:i.z}}return s>Math.PI&&(s-=2*Math.PI),o=Math.sin(r),h=Math.cos(r),l=o*o,a=e/Math.sqrt(1-t*l),{x:(a+n)*h*Math.cos(s),y:(a+n)*h*Math.sin(s),z:(a*(1-t)+n)*o}}function Dl(i,t,e,s){var r=1e-12,n=r*r,a=30,o,l,h,c,u,d,f,g,m,p,y,M,x,L=i.x,I=i.y,D=i.z?i.z:0,Y,H,wt;if(o=Math.sqrt(L*L+I*I),l=Math.sqrt(L*L+I*I+D*D),o/e<r){if(Y=0,l/e<r)return H=S,wt=-s,{x:i.x,y:i.y,z:i.z}}else Y=Math.atan2(I,L);h=D/l,c=o/l,u=1/Math.sqrt(1-t*(2-t)*c*c),g=c*(1-t)*u,m=h*u,x=0;do x++,f=e/Math.sqrt(1-t*m*m),wt=o*g+D*m-f*(1-t*m*m),d=t*f/(f+wt),u=1/Math.sqrt(1-d*(2-d)*c*c),p=c*(1-d)*u,y=h*u,M=y*g-p*m,g=p,m=y;while(M*M>n&&x<a);return H=Math.atan(y/Math.abs(p)),{x:Y,y:H,z:wt}}function Kg(i,t,e){if(t===ei)return{x:i.x+e[0],y:i.y+e[1],z:i.z+e[2]};if(t===ii){var s=e[0],r=e[1],n=e[2],a=e[3],o=e[4],l=e[5],h=e[6];return{x:h*(i.x-l*i.y+o*i.z)+s,y:h*(l*i.x+i.y-a*i.z)+r,z:h*(-o*i.x+a*i.y+i.z)+n}}}function Qg(i,t,e){if(t===ei)return{x:i.x-e[0],y:i.y-e[1],z:i.z-e[2]};if(t===ii){var s=e[0],r=e[1],n=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=(i.x-s)/h,u=(i.y-r)/h,d=(i.z-n)/h;return{x:c+l*u-o*d,y:-l*c+u+a*d,z:o*c-a*u+d}}}function Er(i){return i===ei||i===ii}function tm(i,t,e){if(Jg(i,t)||i.datum_type===ta||t.datum_type===ta)return e;var s=i.a,r=i.es;if(i.datum_type===wr){var n=Fl(i,!1,e);if(n!==0)return;s=_l,r=Sl}var a=t.a,o=t.b,l=t.es;if(t.datum_type===wr&&(a=_l,o=ng,l=Sl),r===l&&s===a&&!Er(i.datum_type)&&!Er(t.datum_type))return e;if(e=Nl(e,r,s),Er(i.datum_type)&&(e=Kg(e,i.datum_type,i.datum_params)),Er(t.datum_type)&&(e=Qg(e,t.datum_type,t.datum_params)),e=Dl(e,l,a,o),t.datum_type===wr){var h=Fl(t,!0,e);if(h!==0)return}return e}function Fl(i,t,e){if(i.grids===null||i.grids.length===0)return console.log("Grid shift grids not found"),-1;for(var s={x:-e.x,y:e.y},r={x:Number.NaN,y:Number.NaN},n=[],a=0;a<i.grids.length;a++){var o=i.grids[a];if(n.push(o.name),o.isNull){r=s;break}if(o.grid===null){if(o.mandatory)return console.log("Unable to find mandatory grid '"+o.name+"'"),-1;continue}var l=o.grid.subgrids[0],h=(Math.abs(l.del[1])+Math.abs(l.del[0]))/1e4,c=l.ll[0]-h,u=l.ll[1]-h,d=l.ll[0]+(l.lim[0]-1)*l.del[0]+h,f=l.ll[1]+(l.lim[1]-1)*l.del[1]+h;if(!(u>s.y||c>s.x||f<s.y||d<s.x)&&(r=em(s,t,l),!isNaN(r.x)))break}return isNaN(r.x)?(console.log("Failed to find a grid shift table for location '"+-s.x*ce+" "+s.y*ce+" tried: '"+n+"'"),-1):(e.x=-r.x,e.y=r.y,0)}function em(i,t,e){var s={x:Number.NaN,y:Number.NaN};if(isNaN(i.x))return s;var r={x:i.x,y:i.y};r.x-=e.ll[0],r.y-=e.ll[1],r.x=b(r.x-Math.PI)+Math.PI;var n=Rl(r,e);if(t){if(isNaN(n.x))return s;n.x=r.x-n.x,n.y=r.y-n.y;var a=9,o=1e-12,l,h;do{if(h=Rl(n,e),isNaN(h.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}l={x:r.x-(h.x+n.x),y:r.y-(h.y+n.y)},n.x+=l.x,n.y+=l.y}while(a--&&Math.abs(l.x)>o&&Math.abs(l.y)>o);if(a<0)return console.log("Inverse grid shift iterator failed to converge."),s;s.x=b(n.x+e.ll[0]),s.y=n.y+e.ll[1]}else isNaN(n.x)||(s.x=i.x+n.x,s.y=i.y+n.y);return s}function Rl(i,t){var e={x:i.x/t.del[0],y:i.y/t.del[1]},s={x:Math.floor(e.x),y:Math.floor(e.y)},r={x:e.x-1*s.x,y:e.y-1*s.y},n={x:Number.NaN,y:Number.NaN},a;if(s.x<0||s.x>=t.lim[0]||s.y<0||s.y>=t.lim[1])return n;a=s.y*t.lim[0]+s.x;var o={x:t.cvs[a][0],y:t.cvs[a][1]};a++;var l={x:t.cvs[a][0],y:t.cvs[a][1]};a+=t.lim[0];var h={x:t.cvs[a][0],y:t.cvs[a][1]};a--;var c={x:t.cvs[a][0],y:t.cvs[a][1]},u=r.x*r.y,d=r.x*(1-r.y),f=(1-r.x)*(1-r.y),g=(1-r.x)*r.y;return n.x=f*o.x+d*l.x+g*c.x+u*h.x,n.y=f*o.y+d*l.y+g*c.y+u*h.y,n}function Al(i,t,e){var s=e.x,r=e.y,n=e.z||0,a,o,l,h={};for(l=0;l<3;l++)if(!(t&&l===2&&e.z===void 0))switch(l===0?(a=s,"ew".indexOf(i.axis[l])!==-1?o="x":o="y"):l===1?(a=r,"ns".indexOf(i.axis[l])!==-1?o="y":o="x"):(a=n,o="z"),i.axis[l]){case"e":h[o]=a;break;case"w":h[o]=-a;break;case"n":h[o]=a;break;case"s":h[o]=-a;break;case"u":e[o]!==void 0&&(h.z=a);break;case"d":e[o]!==void 0&&(h.z=-a);break;default:return null}return h}function Gl(i){var t={x:i[0],y:i[1]};return i.length>2&&(t.z=i[2]),i.length>3&&(t.m=i[3]),t}function im(i){kl(i.x),kl(i.y)}function kl(i){if(typeof Number.isFinite=="function"){if(Number.isFinite(i))return;throw new TypeError("coordinates must be finite numbers")}if(typeof i!="number"||i!==i||!isFinite(i))throw new TypeError("coordinates must be finite numbers")}function sm(i,t){return(i.datum.datum_type===ei||i.datum.datum_type===ii)&&t.datumCode!=="WGS84"||(t.datum.datum_type===ei||t.datum.datum_type===ii)&&i.datumCode!=="WGS84"}function Ir(i,t,e,s){var r;if(Array.isArray(e)&&(e=Gl(e)),im(e),i.datum&&t.datum&&sm(i,t)&&(r=new de("WGS84"),e=Ir(i,r,e,s),i=r),s&&i.axis!=="enu"&&(e=Al(i,!1,e)),i.projName==="longlat")e={x:e.x*_t,y:e.y*_t,z:e.z||0};else if(i.to_meter&&(e={x:e.x*i.to_meter,y:e.y*i.to_meter,z:e.z||0}),e=i.inverse(e),!e)return;if(i.from_greenwich&&(e.x+=i.from_greenwich),e=tm(i.datum,t.datum,e),!!e)return t.from_greenwich&&(e={x:e.x-t.from_greenwich,y:e.y,z:e.z||0}),t.projName==="longlat"?e={x:e.x*ce,y:e.y*ce,z:e.z||0}:(e=t.forward(e),t.to_meter&&(e={x:e.x/t.to_meter,y:e.y/t.to_meter,z:e.z||0})),s&&t.axis!=="enu"?Al(t,!0,e):e}var zl=de("WGS84");function ra(i,t,e,s){var r,n,a;return Array.isArray(e)?(r=Ir(i,t,e,s)||{x:NaN,y:NaN},e.length>2?typeof i.name!="undefined"&&i.name==="geocent"||typeof t.name!="undefined"&&t.name==="geocent"?typeof r.z=="number"?[r.x,r.y,r.z].concat(e.splice(3)):[r.x,r.y,e[2]].concat(e.splice(3)):[r.x,r.y].concat(e.splice(2)):[r.x,r.y]):(n=Ir(i,t,e,s),a=Object.keys(e),a.length===2||a.forEach(function(o){if(typeof i.name!="undefined"&&i.name==="geocent"||typeof t.name!="undefined"&&t.name==="geocent"){if(o==="x"||o==="y"||o==="z")return}else if(o==="x"||o==="y")return;n[o]=e[o]}),n)}function jl(i){return i instanceof de?i:i.oProj?i.oProj:de(i)}function ct(i,t,e){i=jl(i);var s=!1,r;return typeof t=="undefined"?(t=i,i=zl,s=!0):(typeof t.x!="undefined"||Array.isArray(t))&&(e=t,t=i,i=zl,s=!0),t=jl(t),e?ra(i,t,e):(r={forward:function(n,a){return ra(i,t,n,a)},inverse:function(n,a){return ra(t,i,n,a)}},s&&(r.oProj=t),r)}var $l=6,Hl="AJSAJS",Vl="AFAFAF",Ti=65,Ft=73,Zt=79,Ns=86,Ds=90,rm={forward:Bl,inverse:nm,toPoint:Ul};function Bl(i,t){return t=t||5,lm(am({lat:i[1],lon:i[0]}),t)}function nm(i){var t=aa(Yl(i.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function Ul(i){var t=aa(Yl(i.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function na(i){return i*(Math.PI/180)}function ql(i){return 180*(i/Math.PI)}function am(i){var t=i.lat,e=i.lon,s=6378137,r=.00669438,n=.9996,a,o,l,h,c,u,d,f=na(t),g=na(e),m,p;p=Math.floor((e+180)/6)+1,e===180&&(p=60),t>=56&&t<64&&e>=3&&e<12&&(p=32),t>=72&&t<84&&(e>=0&&e<9?p=31:e>=9&&e<21?p=33:e>=21&&e<33?p=35:e>=33&&e<42&&(p=37)),a=(p-1)*6-180+3,m=na(a),o=r/(1-r),l=s/Math.sqrt(1-r*Math.sin(f)*Math.sin(f)),h=Math.tan(f)*Math.tan(f),c=o*Math.cos(f)*Math.cos(f),u=Math.cos(f)*(g-m),d=s*((1-r/4-3*r*r/64-5*r*r*r/256)*f-(3*r/8+3*r*r/32+45*r*r*r/1024)*Math.sin(2*f)+(15*r*r/256+45*r*r*r/1024)*Math.sin(4*f)-35*r*r*r/3072*Math.sin(6*f));var y=n*l*(u+(1-h+c)*u*u*u/6+(5-18*h+h*h+72*c-58*o)*u*u*u*u*u/120)+5e5,M=n*(d+l*Math.tan(f)*(u*u/2+(5-h+9*c+4*c*c)*u*u*u*u/24+(61-58*h+h*h+600*c-330*o)*u*u*u*u*u*u/720));return t<0&&(M+=1e7),{northing:Math.round(M),easting:Math.round(y),zoneNumber:p,zoneLetter:om(t)}}function aa(i){var t=i.northing,e=i.easting,s=i.zoneLetter,r=i.zoneNumber;if(r<0||r>60)return null;var n=.9996,a=6378137,o=.00669438,l,h=(1-Math.sqrt(1-o))/(1+Math.sqrt(1-o)),c,u,d,f,g,m,p,y,M,x=e-5e5,L=t;s<"N"&&(L-=1e7),p=(r-1)*6-180+3,l=o/(1-o),m=L/n,y=m/(a*(1-o/4-3*o*o/64-5*o*o*o/256)),M=y+(3*h/2-27*h*h*h/32)*Math.sin(2*y)+(21*h*h/16-55*h*h*h*h/32)*Math.sin(4*y)+151*h*h*h/96*Math.sin(6*y),c=a/Math.sqrt(1-o*Math.sin(M)*Math.sin(M)),u=Math.tan(M)*Math.tan(M),d=l*Math.cos(M)*Math.cos(M),f=a*(1-o)/Math.pow(1-o*Math.sin(M)*Math.sin(M),1.5),g=x/(c*n);var I=M-c*Math.tan(M)/f*(g*g/2-(5+3*u+10*d-4*d*d-9*l)*g*g*g*g/24+(61+90*u+298*d+45*u*u-252*l-3*d*d)*g*g*g*g*g*g/720);I=ql(I);var D=(g-(1+2*u+d)*g*g*g/6+(5-2*d+28*u-3*d*d+8*l+24*u*u)*g*g*g*g*g/120)/Math.cos(M);D=p+ql(D);var Y;if(i.accuracy){var H=aa({northing:i.northing+i.accuracy,easting:i.easting+i.accuracy,zoneLetter:i.zoneLetter,zoneNumber:i.zoneNumber});Y={top:H.lat,right:H.lon,bottom:I,left:D}}else Y={lat:I,lon:D};return Y}function om(i){var t="Z";return 84>=i&&i>=72?t="X":72>i&&i>=64?t="W":64>i&&i>=56?t="V":56>i&&i>=48?t="U":48>i&&i>=40?t="T":40>i&&i>=32?t="S":32>i&&i>=24?t="R":24>i&&i>=16?t="Q":16>i&&i>=8?t="P":8>i&&i>=0?t="N":0>i&&i>=-8?t="M":-8>i&&i>=-16?t="L":-16>i&&i>=-24?t="K":-24>i&&i>=-32?t="J":-32>i&&i>=-40?t="H":-40>i&&i>=-48?t="G":-48>i&&i>=-56?t="F":-56>i&&i>=-64?t="E":-64>i&&i>=-72?t="D":-72>i&&i>=-80&&(t="C"),t}function lm(i,t){var e="00000"+i.easting,s="00000"+i.northing;return i.zoneNumber+i.zoneLetter+hm(i.easting,i.northing,i.zoneNumber)+e.substr(e.length-5,t)+s.substr(s.length-5,t)}function hm(i,t,e){var s=Wl(e),r=Math.floor(i/1e5),n=Math.floor(t/1e5)%20;return cm(r,n,s)}function Wl(i){var t=i%$l;return t===0&&(t=$l),t}function cm(i,t,e){var s=e-1,r=Hl.charCodeAt(s),n=Vl.charCodeAt(s),a=r+i-1,o=n+t,l=!1;a>Ds&&(a=a-Ds+Ti-1,l=!0),(a===Ft||r<Ft&&a>Ft||(a>Ft||r<Ft)&&l)&&a++,(a===Zt||r<Zt&&a>Zt||(a>Zt||r<Zt)&&l)&&(a++,a===Ft&&a++),a>Ds&&(a=a-Ds+Ti-1),o>Ns?(o=o-Ns+Ti-1,l=!0):l=!1,(o===Ft||n<Ft&&o>Ft||(o>Ft||n<Ft)&&l)&&o++,(o===Zt||n<Zt&&o>Zt||(o>Zt||n<Zt)&&l)&&(o++,o===Ft&&o++),o>Ns&&(o=o-Ns+Ti-1);var h=String.fromCharCode(a)+String.fromCharCode(o);return h}function Yl(i){if(i&&i.length===0)throw"MGRSPoint coverting from nothing";for(var t=i.length,e=null,s="",r,n=0;!/[A-Z]/.test(r=i.charAt(n));){if(n>=2)throw"MGRSPoint bad conversion from: "+i;s+=r,n++}var a=parseInt(s,10);if(n===0||n+3>t)throw"MGRSPoint bad conversion from: "+i;var o=i.charAt(n++);if(o<="A"||o==="B"||o==="Y"||o>="Z"||o==="I"||o==="O")throw"MGRSPoint zone letter "+o+" not handled: "+i;e=i.substring(n,n+=2);for(var l=Wl(a),h=um(e.charAt(0),l),c=dm(e.charAt(1),l);c<fm(o);)c+=2e6;var u=t-n;if(u%2!==0)throw`MGRSPoint has to have an even number
1
+ var ad=Object.defineProperty,od=Object.defineProperties;var ld=Object.getOwnPropertyDescriptors;var Ro=Object.getOwnPropertySymbols;var hd=Object.prototype.hasOwnProperty,cd=Object.prototype.propertyIsEnumerable;var Ao=(i,t,e)=>t in i?ad(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,_=(i,t)=>{for(var e in t||(t={}))hd.call(t,e)&&Ao(i,e,t[e]);if(Ro)for(var e of Ro(t))cd.call(t,e)&&Ao(i,e,t[e]);return i},O=(i,t)=>od(i,ld(t));import{ol$geom$Circle as le,ol$geom$GeometryCollection as ps,ol$geom$GeometryLayout as wn,ol$Feature as Z,ol$proj$getTransform as dt,ol$proj$get as ud,ol$proj$equivalent as dd,ol$proj$proj4$register as Go,ol$style$Style as ft,ol$style$Fill as he,ol$style$Stroke as ee,ol$style$Text as xn,ol$has$DEVICE_PIXEL_RATIO as fd,ol$style$RegularShape as bn,ol$style$Circle as ys,ol$style$Icon as vs,ol$style$Image as gd,ol$Map as md,ol$interaction$defaults as pd,ol$Observable$unByKey as yt,ol$View as On,ol$easing$inAndOut as yd,ol$extent$containsXY as ko,ol$extent$boundingExtent as _s,ol$extent$getBottomLeft as Pn,ol$geom$Point as bi,ol$geom$LineString as En,ol$geom$MultiPoint as zo,ol$geom$MultiLineString as jo,ol$geom$MultiPolygon as fr,ol$sphere$offset as gr,ol$geom$GeometryType as Re,ol$layer$Vector as $o,ol$geom$Polygon$circular as vd,ol$ImageState as mr,ol$geom$Polygon as In,ol$extent$getBottomRight as Ho,ol$extent$getTopRight as Vo,ol$extent$getTopLeft as pr,ol$proj$transform as Xe,ol$geom$Polygon$fromCircle as _d,ol$source$Vector as Ss,ol$tilegrid$createXYZ as Bo,ol$proj$Projection as Sd,ol$tilegrid$TileGrid as Uo,ol$source$TileImage as Md,ol$layer$Tile as Oi,ol$extent$containsCoordinate as Cd,ol$extent$buffer as qo,ol$extent$getCenter as Ln,ol$proj$transformExtent as Wo,ol$sphere$getDistance as wd,ol$format$GeoJSON as Yo,Feature as xd,ol$extent$getWidth as Tn,ol$source$TileWMS as bd,ol$format$GML2 as Nn,ol$format$WFS as Xo,ol$format$GML3 as Dn,ol$extent$createEmpty as Zo,ol$structs$LRUCache as Od,ol$extent$createOrUpdateFromCoordinate as Pd,ol$render$canvas$Immediate as Ed,ol$geom$flat$transform$transform2D as Id,ol$extent$intersects as Ld,ol$geom$SimpleGeometry$transformGeom2D as Td,ol$transform$scale as Nd,ol$transform$create as Dd,ol$transform$compose as Fd,ol$extent$extend as Jo,ol$source$OSM as Rd,ol$layer$Image as Ad,ol$source$ImageStatic as Gd,ol$source$TileDebug as kd,ol$source$XYZ as zd,ol$source$VectorTile as jd,ol$TileState as $d,ol$layer$VectorTile as Hd,ol$tilegrid$WMTS as Vd,ol$source$WMTS as Bd,ol$format$MVT as Ud}from"./ol.0561aa.js";import{Cartesian3 as C,Math as P,Material as Pi,Cartesian2 as Ht,Cesium3DTilePointFeature as Ae,Cesium3DTileFeature as Ge,Matrix3 as Vt,Quaternion as qd,Color as Ot,EasingFunction as Wd,Cesium3DTileStyle as Fn,Cesium3DTileColorBlendMode as yr,VerticalOrigin as Bt,Entity as Rn,ConditionsExpression as Yd,Expression as Xd,HeightReference as Yt,ClassificationType as Ei,NearFarScalar as Ms,SceneTransforms as Zd,MaterialAppearance as Jd,GeometryInstance as vr,ColorGeometryInstanceAttribute as Ko,PerInstanceColorAppearance as An,ShadowMode as Cs,ClassificationPrimitive as Qo,GroundPrimitive as tl,Primitive as Gn,PolylineMaterialAppearance as Kd,GroundPolylinePrimitive as el,PolygonGeometry as Qd,PolygonOutlineGeometry as tf,GroundPolylineGeometry as kn,PolylineGeometry as zn,PolygonHierarchy as il,CircleGeometry as ef,CircleOutlineGeometry as sf,Cartographic as et,WallGeometry as rf,WallOutlineGeometry as nf,HeadingPitchRoll as af,Matrix4 as A,Transforms as sl,Model as of,sampleTerrainMostDetailed as _r,ModelAnimationLoop as lf,LabelStyle as jn,HorizontalOrigin as $n,PrimitiveCollection as Hn,BillboardCollection as hf,LabelCollection as cf,CesiumTerrainProvider as rl,Cartesian4 as nl,sampleTerrain as uf,Ellipsoid as Vn,ExperimentalFeatures as df,Clock as ff,DataSourceClock as gf,JulianDate as al,KeyboardEventModifier as Bn,ScreenSpaceEventType as Ze,CesiumWidget as mf,DataSourceDisplay as ol,DataSourceCollection as ll,RequestScheduler as pf,ScreenSpaceEventHandler as yf,Ray as vf,Camera as _f,ImageryLayer as Je,CustomDataSource as hl,Cesium3DTileset as ws,BoundingSphere as cl,Intersect as Sf,CesiumInspector as Mf,Cesium3DTilesInspector as Cf,BillboardVisualizer as wf,LabelVisualizer as xf,PointVisualizer as bf,Rectangle as Ut,Composite3DTileContent as Of,HeadingPitchRange as Pf,BoundingSphereState as ul,OpenStreetMapImageryProvider as Ef,SingleTileImageryProvider as If,WebMercatorTilingScheme as Un,GeographicTilingScheme as dl,SplitDirection as X,TileMapServiceImageryProvider as Lf,Event as Tf,WebMapServiceImageryProvider as Nf,WebMapTileServiceImageryProvider as Df,EntityCollection as Ff,CzmlDataSource as Rf,Plane as Ke,ClippingPlaneCollection as Qe,ClippingPlane as ti,ConstantProperty as Af,Globe as Gf}from"./cesium.6b5bb6.js";const xs=[[String,"string"],[Number,"number"],[Boolean,"boolean"],[Function,"function"],[void 0,"undefined"],[Symbol,"symbol"]];function Sr(i){const t={};if(!i||t.toString(i)!=="[object Object]")return!1;const e=Object.getPrototypeOf(i);if(!e)return!0;const s=t.hasOwnProperty,r=s.call(e,"constructor")&&e.constructor;return typeof r=="function"&&s.toString.call(r)===s.toString.call(Object)}function ie(i,t){if(i===null)return"null";if(typeof i=="undefined")return"undefined";if(t)return typeof i;let e;if(Array.isArray(i))e=`[${i.map(r=>ie(r,t)).join(",")}]`;else try{e=JSON.stringify(i)}catch{e=typeof i}return e=e||typeof i,e.length>20?`${e.substr(0,20)}...`:e}function kf(i,t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"?i===t?!1:`Expected ${ie(i)} to equal ${t.toString()}`:null}function zf(i,t,e){if(Array.isArray(t)){if(t.length!==1)throw new Error("Array patterns may only have on type");if(Array.isArray(i)){let s=!1;return i.findIndex(n=>{try{v(n,t[0],e)}catch(a){s=a.message.replace(/Match failed:\s/,"")}return s})>-1?`${s} in ${ie(i)}`:!1}return`Expected ${ie(i)} to be an Array`}return null}function qn(i,t,e){const s=e?`${e}.`:"";if(!Sr(i))return`Expected ${ie(i)} to be a plain Object`;let n=!1;const a=Object.keys(t).find(o=>{const l=i[o];if(Sr(t[o]))n=qn(l,t[o],s+o);else try{v(l,t[o])}catch(h){n=h.message.replace(/Match failed:\s/,"")}return n});return a?`${n} in object.${s}${a}`:!1}function jf(i,t){if(t===Number)return Number.isFinite(i)?!1:`expected ${ie(i)} to be a number, excluding NaN`;for(let e=xs.length;e--;)if(t===xs[e][0])return typeof i===xs[e][1]?!1:`expected ${ie(i)} to be a ${xs[e][1]}`;return null}function Wn(i){if(i===null)return"null";const t=xs.find(r=>r[0]===i);if(t)return t[1];let e=i.toString();if(i.className)return i.className;const s=e.match(/function (.*)\(/);if(s&&s.length>1)return s[1];if(Sr(i)){const r={};Object.keys(i).forEach(n=>{r[n]=Wn(i[n])});try{e=`Object of ${JSON.stringify(r)}`}catch{e="Object"}}return e}function fl(i,t,e){const s=e?`${e}.`:"";let r=!1;return Object.keys(i).find(a=>{if(Sr(t[a])){const o=i[a];r=fl(o,t[a],s+a)}else t[a]||(r=`Found additional key ${s}${a}`);return r=r?r.replace(/\sin.*/,""):!1,r})?`${r} in ${ie(i)}`:!1}function gl(i,t,e){const s=function(a,o){if(o==null)return a===o?!1:`Expected ${ie(a)} to be ${o}`;const l=jf(a,o);if(l!==null)return l;const h=kf(a,o);if(h!==null)return h;if(Array.isArray(o))return zf(a,o,e);if(o instanceof Function)return a instanceof o?!1:`Expected ${ie(a,!0)} to be of Type ${Wn(o)}`;if(o===Object)return qn(a,{});if(typeof o!="object")throw new Error(`Cannot handler pattern ${o}`);const c=qn(a,o);return c||(e?fl(a,o):!1)};let r;return Array.isArray(t)&&t.length>1?t.every(a=>s(i,a))&&(r=`Expected ${ie(i)} to be a ${t.map(a=>Wn(a)).join(" or ")}`):r=s(i,t),r}function Yn(i,t,e){return!gl(i,t,e)}function v(i,t,e){const s=gl(i,t,e);if(s)throw new Error(`Match failed: ${s}`);return!1}function it(i,t,e){const s=[null,void 0];return Array.isArray(t)&&t.length>1?t.forEach(r=>{s.push(r)}):s.push(t),v(i,s.reverse(),e)}function $f(i,t,e){const r=P.toRadians(e),n=P.toRadians(i[1]),a=P.toRadians(i[0]),o=Math.asin(Math.sin(n)*Math.cos(t/6371e3)+Math.cos(n)*Math.sin(t/6371e3)*Math.cos(r)),l=a+Math.atan2(Math.sin(r)*Math.sin(t/6371e3)*Math.cos(n),Math.cos(t/6371e3)-Math.sin(n)*Math.sin(o));return[parseFloat(P.toDegrees(l).toFixed(5)),parseFloat(P.toDegrees(o).toFixed(5))]}function Hf(i,t){const e=P.toRadians(i[0]),s=P.toRadians(i[1]),r=P.toRadians(t[0]),n=P.toRadians(t[1]),a=Math.sin(r-e)*Math.cos(n),o=Math.cos(s)*Math.sin(n)-Math.sin(s)*Math.cos(n)*Math.cos(r-e);let l=P.toDegrees(Math.atan2(a,o));return l=(l+360)%360,l}function ke(i,t){const e=i[0]-t[0],s=i[1]-t[1];return Math.sqrt(e**2+s**2)}function ml(i,t){const e=C.fromElements(i[0],i[1],i[2]),s=C.fromElements(t[0],t[1],t[2]);return C.distance(e,s)}le.prototype.getCoordinates=function(){return[this.getCenter(),this.getLastCoordinate()]},le.prototype.setCoordinates=function(t,e){v(t,[[Number]]),v(t.length,2);const s=e||this.getLayout(),r=/XYM?/.test(s)?ke:ml;this.setCenterAndRadius(t[0],r(t[0],t[1]),e)},ps.prototype.getCoordinates=function(){return this.getGeometries().map(t=>t.getCoordinates())},ps.prototype.setCoordinates=function(t,e){v(t,Array),v(t.length,this.getGeometries().length),this.setGeometries(this.getGeometries().map((s,r)=>(s.setCoordinates(t[r],e),s)))},ps.prototype.getLayout=function(){const t=this.getGeometries()[0];return t?t.getLayout():wn.XYZ},Z.prototype.getProperty=function(t){if(t==="attributes"){const e=this.getProperties();return this.getGeometryName()&&delete e[this.getGeometryName()],e}else if(t==="olcs_geometryType"){const e=this.getGeometry().getType();return e==="Polygon"?1:e==="LineString"?2:e==="Point"?3:e==="Circle"||e==="MultiPolygon"?1:e==="MultiLineString"?2:e==="MultiPoint"?3:void 0}return this.get(t)},Z.prototype.getPropertyInherited=function(t){return this.getProperty(t)},Pi._materialCache.addMaterial("Wallpaper",{fabric:{type:"Wallpaper",uniforms:{image:Pi.DefaultImageId,anchor:new Ht(0,0)},components:{diffuse:"texture2D(image, fract((gl_FragCoord.xy - anchor.xy) / vec2(imageDimensions.xy))).rgb",alpha:"texture2D(image, fract((gl_FragCoord.xy - anchor.xy) / vec2(imageDimensions.xy))).a"}},translucent:!1}),Ae.prototype.getId=function(){return this.getProperty("id")||`${this.content.url}${this._batchId}`},Ge.prototype.getId=function(){return this.getProperty("id")||`${this.content.url}${this._batchId}`},new C,new Vt,new qd,new Ot;var Mr,Vf=new Uint8Array(16);function Bf(){if(!Mr&&(Mr=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Mr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Mr(Vf)}var Uf=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function pl(i){return typeof i=="string"&&Uf.test(i)}for(var vt=[],Xn=0;Xn<256;++Xn)vt.push((Xn+256).toString(16).substr(1));function yl(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(vt[i[t+0]]+vt[i[t+1]]+vt[i[t+2]]+vt[i[t+3]]+"-"+vt[i[t+4]]+vt[i[t+5]]+"-"+vt[i[t+6]]+vt[i[t+7]]+"-"+vt[i[t+8]]+vt[i[t+9]]+"-"+vt[i[t+10]]+vt[i[t+11]]+vt[i[t+12]]+vt[i[t+13]]+vt[i[t+14]]+vt[i[t+15]]).toLowerCase();if(!pl(e))throw TypeError("Stringified UUID is invalid");return e}function qf(i){if(!pl(i))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(i.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=t&255,e[4]=(t=parseInt(i.slice(9,13),16))>>>8,e[5]=t&255,e[6]=(t=parseInt(i.slice(14,18),16))>>>8,e[7]=t&255,e[8]=(t=parseInt(i.slice(19,23),16))>>>8,e[9]=t&255,e[10]=(t=parseInt(i.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=t&255,e}function Wf(i){i=unescape(encodeURIComponent(i));for(var t=[],e=0;e<i.length;++e)t.push(i.charCodeAt(e));return t}var Yf="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Xf="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Zf(i,t,e){function s(r,n,a,o){if(typeof r=="string"&&(r=Wf(r)),typeof n=="string"&&(n=qf(n)),n.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var l=new Uint8Array(16+r.length);if(l.set(n),l.set(r,n.length),l=e(l),l[6]=l[6]&15|t,l[8]=l[8]&63|128,a){o=o||0;for(var h=0;h<16;++h)a[o+h]=l[h];return a}return yl(l)}try{s.name=i}catch{}return s.DNS=Yf,s.URL=Xf,s}function Xt(i,t,e){i=i||{};var s=i.random||(i.rng||Bf)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,t){e=e||0;for(var r=0;r<16;++r)t[e+r]=s[r];return t}return yl(s)}function Jf(i,t,e,s){switch(i){case 0:return t&e^~t&s;case 1:return t^e^s;case 2:return t&e^t&s^e&s;case 3:return t^e^s}}function Zn(i,t){return i<<t|i>>>32-t}function Kf(i){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof i=="string"){var s=unescape(encodeURIComponent(i));i=[];for(var r=0;r<s.length;++r)i.push(s.charCodeAt(r))}else Array.isArray(i)||(i=Array.prototype.slice.call(i));i.push(128);for(var n=i.length/4+2,a=Math.ceil(n/16),o=new Array(a),l=0;l<a;++l){for(var h=new Uint32Array(16),c=0;c<16;++c)h[c]=i[l*64+c*4]<<24|i[l*64+c*4+1]<<16|i[l*64+c*4+2]<<8|i[l*64+c*4+3];o[l]=h}o[a-1][14]=(i.length-1)*8/Math.pow(2,32),o[a-1][14]=Math.floor(o[a-1][14]),o[a-1][15]=(i.length-1)*8&4294967295;for(var u=0;u<a;++u){for(var d=new Uint32Array(80),f=0;f<16;++f)d[f]=o[u][f];for(var g=16;g<80;++g)d[g]=Zn(d[g-3]^d[g-8]^d[g-14]^d[g-16],1);for(var m=e[0],p=e[1],y=e[2],M=e[3],x=e[4],L=0;L<80;++L){var I=Math.floor(L/20),D=Zn(m,5)+Jf(I,p,y,M)+x+t[I]+d[L]>>>0;x=M,M=y,y=Zn(p,30)>>>0,p=m,m=D}e[0]=e[0]+m>>>0,e[1]=e[1]+p>>>0,e[2]=e[2]+y>>>0,e[3]=e[3]+M>>>0,e[4]=e[4]+x>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,e[0]&255,e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,e[1]&255,e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,e[2]&255,e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,e[3]&255,e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,e[4]&255]}var Qf=Zf("v5",80,Kf),tg=Qf;const st={OFF:1,ERROR:2,WARN:4,INFO:8,DEBUG:16},Ce={ERROR:0,WARN:0,INFO:0,DEBUG:0};Ce.ERROR=st.ERROR|st.WARN|st.INFO|st.DEBUG,Ce.WARN=st.WARN|st.INFO|st.DEBUG,Ce.INFO=st.INFO|st.DEBUG,Ce.DEBUG=st.DEBUG;const bs={useTimestamp:!1,logLevel:st.INFO},Os=new Map;Os.set(st.ERROR,"error"),Os.set(st.WARN,"warn"),Os.set(st.INFO,"info"),Os.set(st.DEBUG,"log");class vl{constructor(t){this.className=t,this.deprecations=new Map}error(t,...e){bs.logLevel&Ce.ERROR&&this._log(String(t),st.ERROR,e)}warning(t,...e){bs.logLevel&Ce.WARN&&this._log(String(t),st.WARN,e)}deprecate(t,e){const s=String(t),r=e?String(e):null;if(!this.deprecations.has(s)){this.deprecations.set(s,r||null);let n=`${s} has been deprecated and will be removed`;r&&(n=`${n}. ${r}`),this.warning(n)}}info(t,...e){bs.logLevel&Ce.INFO&&this._log(String(t),st.INFO,e)}debug(t,...e){bs.logLevel&Ce.DEBUG&&this._log(String(t),st.DEBUG,e)}log(t,...e){bs.logLevel&Ce.DEBUG&&this._log(String(t),st.DEBUG,e)}_log(t,e,s){let r=t;this.className&&(r=`[${this.className}] ${r}`),console[Os.get(e)](r,...s),e&st.ERROR&&(console.group(),console.trace(),console.groupEnd())}}const Jn=new Map;let Kn;function eg(){return Kn||(Kn=new vl),Kn}function ig(i){const t=new vl(i);return Jn.set(i,t),t}function Pt(i){return i?Jn.has(i)?Jn.get(i):ig(i):eg()}function V(i,t){if(i!=null){const e=Number.parseInt(String(i),10);if(e!=null&&!Number.isNaN(e))return e}return t}function E(i,t){if(i!=null){const e=Number.parseFloat(String(i));if(e!=null&&!Number.isNaN(e))return e}return t}function Cr(i,t,e,s){const r=E(i,t);return r<e?e:r>s?s:r}function rt(i,t){return i==null?t:typeof i=="boolean"?i:i===1?!0:i===0?!1:typeof i=="string"&&(i.toLowerCase()==="true"||i.toLowerCase()==="1")?!0:typeof i=="string"&&(i.toLowerCase()==="false"||i.toLowerCase()==="0")?!1:t}function Qn(i,t,e){if(i!=null){const s=Object.values(t).find(r=>r==i);if(s!=null)return s}return e}function ze(i,t,e){if(i!=null){const s=Object.keys(t).find(r=>r==i);if(s!=null)return t[s]}return e}function sg(i){i("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),i("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),i("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),i.WGS84=i["EPSG:4326"],i["EPSG:3785"]=i["EPSG:3857"],i.GOOGLE=i["EPSG:3857"],i["EPSG:900913"]=i["EPSG:3857"],i["EPSG:102113"]=i["EPSG:3857"]}var ei=1,ii=2,wr=3,rg=4,ta=5,_l=6378137,ng=6356752314e-3,Sl=.0066943799901413165,Ps=484813681109536e-20,S=Math.PI/2,ag=.16666666666666666,og=.04722222222222222,lg=.022156084656084655,w=1e-10,_t=.017453292519943295,ce=57.29577951308232,j=Math.PI/4,Es=Math.PI*2,nt=3.14159265359,Dt={};Dt.greenwich=0,Dt.lisbon=-9.131906111111,Dt.paris=2.337229166667,Dt.bogota=-74.080916666667,Dt.madrid=-3.687938888889,Dt.rome=12.452333333333,Dt.bern=7.439583333333,Dt.jakarta=106.807719444444,Dt.ferro=-17.666666666667,Dt.brussels=4.367975,Dt.stockholm=18.058277777778,Dt.athens=23.7163375,Dt.oslo=10.722916666667;var hg={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},Ml=/[\s_\-\/\(\)]/g;function je(i,t){if(i[t])return i[t];for(var e=Object.keys(i),s=t.toLowerCase().replace(Ml,""),r=-1,n,a;++r<e.length;)if(n=e[r],a=n.toLowerCase().replace(Ml,""),a===s)return i[n]}function ea(i){var t={},e=i.split("+").map(function(o){return o.trim()}).filter(function(o){return o}).reduce(function(o,l){var h=l.split("=");return h.push(!0),o[h[0].toLowerCase()]=h[1],o},{}),s,r,n,a={proj:"projName",datum:"datumCode",rf:function(o){t.rf=parseFloat(o)},lat_0:function(o){t.lat0=o*_t},lat_1:function(o){t.lat1=o*_t},lat_2:function(o){t.lat2=o*_t},lat_ts:function(o){t.lat_ts=o*_t},lon_0:function(o){t.long0=o*_t},lon_1:function(o){t.long1=o*_t},lon_2:function(o){t.long2=o*_t},alpha:function(o){t.alpha=parseFloat(o)*_t},gamma:function(o){t.rectified_grid_angle=parseFloat(o)},lonc:function(o){t.longc=o*_t},x_0:function(o){t.x0=parseFloat(o)},y_0:function(o){t.y0=parseFloat(o)},k_0:function(o){t.k0=parseFloat(o)},k:function(o){t.k0=parseFloat(o)},a:function(o){t.a=parseFloat(o)},b:function(o){t.b=parseFloat(o)},r_a:function(){t.R_A=!0},zone:function(o){t.zone=parseInt(o,10)},south:function(){t.utmSouth=!0},towgs84:function(o){t.datum_params=o.split(",").map(function(l){return parseFloat(l)})},to_meter:function(o){t.to_meter=parseFloat(o)},units:function(o){t.units=o;var l=je(hg,o);l&&(t.to_meter=l.to_meter)},from_greenwich:function(o){t.from_greenwich=o*_t},pm:function(o){var l=je(Dt,o);t.from_greenwich=(l||parseFloat(o))*_t},nadgrids:function(o){o==="@null"?t.datumCode="none":t.nadgrids=o},axis:function(o){var l="ewnsud";o.length===3&&l.indexOf(o.substr(0,1))!==-1&&l.indexOf(o.substr(1,1))!==-1&&l.indexOf(o.substr(2,1))!==-1&&(t.axis=o)},approx:function(){t.approx=!0}};for(s in e)r=e[s],s in a?(n=a[s],typeof n=="function"?n(r):t[n]=r):t[s]=r;return typeof t.datumCode=="string"&&t.datumCode!=="WGS84"&&(t.datumCode=t.datumCode.toLowerCase()),t}var Is=1,Cl=2,wl=3,xr=4,xl=5,ia=-1,cg=/\s/,ug=/[A-Za-z]/,dg=/[A-Za-z84]/,br=/[,\]]/,bl=/[\d\.E\-\+]/;function we(i){if(typeof i!="string")throw new Error("not a string");this.text=i.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Is}we.prototype.readCharicter=function(){var i=this.text[this.place++];if(this.state!==xr)for(;cg.test(i);){if(this.place>=this.text.length)return;i=this.text[this.place++]}switch(this.state){case Is:return this.neutral(i);case Cl:return this.keyword(i);case xr:return this.quoted(i);case xl:return this.afterquote(i);case wl:return this.number(i);case ia:return}},we.prototype.afterquote=function(i){if(i==='"'){this.word+='"',this.state=xr;return}if(br.test(i)){this.word=this.word.trim(),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in afterquote yet, index '+this.place)},we.prototype.afterItem=function(i){if(i===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Is;return}if(i==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Is,this.currentObject=this.stack.pop(),this.currentObject||(this.state=ia);return}},we.prototype.number=function(i){if(bl.test(i)){this.word+=i;return}if(br.test(i)){this.word=parseFloat(this.word),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in number yet, index '+this.place)},we.prototype.quoted=function(i){if(i==='"'){this.state=xl;return}this.word+=i},we.prototype.keyword=function(i){if(dg.test(i)){this.word+=i;return}if(i==="["){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=Is;return}if(br.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in keyword yet, index '+this.place)},we.prototype.neutral=function(i){if(ug.test(i)){this.word=i,this.state=Cl;return}if(i==='"'){this.word="",this.state=xr;return}if(bl.test(i)){this.word=i,this.state=wl;return}if(br.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in neutral yet, index '+this.place)},we.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===ia)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function fg(i){var t=new we(i);return t.output()}function Ol(i,t,e){Array.isArray(t)&&(e.unshift(t),t=null);var s=t?{}:i,r=e.reduce(function(n,a){return Ii(a,n),n},s);t&&(i[t]=r)}function Ii(i,t){if(!Array.isArray(i)){t[i]=!0;return}var e=i.shift();if(e==="PARAMETER"&&(e=i.shift()),i.length===1){if(Array.isArray(i[0])){t[e]={},Ii(i[0],t[e]);return}t[e]=i[0];return}if(!i.length){t[e]=!0;return}if(e==="TOWGS84"){t[e]=i;return}if(e==="AXIS"){e in t||(t[e]=[]),t[e].push(i);return}Array.isArray(e)||(t[e]={});var s;switch(e){case"UNIT":case"PRIMEM":case"VERT_DATUM":t[e]={name:i[0].toLowerCase(),convert:i[1]},i.length===3&&Ii(i[2],t[e]);return;case"SPHEROID":case"ELLIPSOID":t[e]={name:i[0],a:i[1],rf:i[2]},i.length===4&&Ii(i[3],t[e]);return;case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":i[0]=["name",i[0]],Ol(t,e,i);return;default:for(s=-1;++s<i.length;)if(!Array.isArray(i[s]))return Ii(i,t[e]);return Ol(t,e,i)}}var gg=.017453292519943295;function mg(i,t){var e=t[0],s=t[1];!(e in i)&&s in i&&(i[e]=i[s],t.length===3&&(i[e]=t[2](i[e])))}function xe(i){return i*gg}function pg(i){if(i.type==="GEOGCS"?i.projName="longlat":i.type==="LOCAL_CS"?(i.projName="identity",i.local=!0):typeof i.PROJECTION=="object"?i.projName=Object.keys(i.PROJECTION)[0]:i.projName=i.PROJECTION,i.AXIS){for(var t="",e=0,s=i.AXIS.length;e<s;++e){var r=[i.AXIS[e][0].toLowerCase(),i.AXIS[e][1].toLowerCase()];r[0].indexOf("north")!==-1||(r[0]==="y"||r[0]==="lat")&&r[1]==="north"?t+="n":r[0].indexOf("south")!==-1||(r[0]==="y"||r[0]==="lat")&&r[1]==="south"?t+="s":r[0].indexOf("east")!==-1||(r[0]==="x"||r[0]==="lon")&&r[1]==="east"?t+="e":(r[0].indexOf("west")!==-1||(r[0]==="x"||r[0]==="lon")&&r[1]==="west")&&(t+="w")}t.length===2&&(t+="u"),t.length===3&&(i.axis=t)}i.UNIT&&(i.units=i.UNIT.name.toLowerCase(),i.units==="metre"&&(i.units="meter"),i.UNIT.convert&&(i.type==="GEOGCS"?i.DATUM&&i.DATUM.SPHEROID&&(i.to_meter=i.UNIT.convert*i.DATUM.SPHEROID.a):i.to_meter=i.UNIT.convert));var n=i.GEOGCS;i.type==="GEOGCS"&&(n=i),n&&(n.DATUM?i.datumCode=n.DATUM.name.toLowerCase():i.datumCode=n.name.toLowerCase(),i.datumCode.slice(0,2)==="d_"&&(i.datumCode=i.datumCode.slice(2)),(i.datumCode==="new_zealand_geodetic_datum_1949"||i.datumCode==="new_zealand_1949")&&(i.datumCode="nzgd49"),(i.datumCode==="wgs_1984"||i.datumCode==="world_geodetic_system_1984")&&(i.PROJECTION==="Mercator_Auxiliary_Sphere"&&(i.sphere=!0),i.datumCode="wgs84"),i.datumCode.slice(-6)==="_ferro"&&(i.datumCode=i.datumCode.slice(0,-6)),i.datumCode.slice(-8)==="_jakarta"&&(i.datumCode=i.datumCode.slice(0,-8)),~i.datumCode.indexOf("belge")&&(i.datumCode="rnb72"),n.DATUM&&n.DATUM.SPHEROID&&(i.ellps=n.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),i.ellps.toLowerCase().slice(0,13)==="international"&&(i.ellps="intl"),i.a=n.DATUM.SPHEROID.a,i.rf=parseFloat(n.DATUM.SPHEROID.rf,10)),n.DATUM&&n.DATUM.TOWGS84&&(i.datum_params=n.DATUM.TOWGS84),~i.datumCode.indexOf("osgb_1936")&&(i.datumCode="osgb36"),~i.datumCode.indexOf("osni_1952")&&(i.datumCode="osni52"),(~i.datumCode.indexOf("tm65")||~i.datumCode.indexOf("geodetic_datum_of_1965"))&&(i.datumCode="ire65"),i.datumCode==="ch1903+"&&(i.datumCode="ch1903"),~i.datumCode.indexOf("israel")&&(i.datumCode="isr93")),i.b&&!isFinite(i.b)&&(i.b=i.a);function a(h){var c=i.to_meter||1;return h*c}var o=function(h){return mg(i,h)},l=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",xe],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",xe],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",xe],["lat0","latitude_of_origin",xe],["lat0","standard_parallel_1",xe],["lat1","standard_parallel_1",xe],["lat2","standard_parallel_2",xe],["azimuth","Azimuth"],["alpha","azimuth",xe],["srsCode","name"]];l.forEach(o),!i.long0&&i.longc&&(i.projName==="Albers_Conic_Equal_Area"||i.projName==="Lambert_Azimuthal_Equal_Area")&&(i.long0=i.longc),!i.lat_ts&&i.lat1&&(i.projName==="Stereographic_South_Pole"||i.projName==="Polar Stereographic (variant B)")&&(i.lat0=xe(i.lat1>0?90:-90),i.lat_ts=i.lat1)}function Pl(i){var t=fg(i),e=t.shift(),s=t.shift();t.unshift(["name",s]),t.unshift(["type",e]);var r={};return Ii(t,r),pg(r),r}function Et(i){var t=this;if(arguments.length===2){var e=arguments[1];typeof e=="string"?e.charAt(0)==="+"?Et[i]=ea(arguments[1]):Et[i]=Pl(arguments[1]):Et[i]=e}else if(arguments.length===1){if(Array.isArray(i))return i.map(function(s){Array.isArray(s)?Et.apply(t,s):Et(s)});if(typeof i=="string"){if(i in Et)return Et[i]}else"EPSG"in i?Et["EPSG:"+i.EPSG]=i:"ESRI"in i?Et["ESRI:"+i.ESRI]=i:"IAU2000"in i?Et["IAU2000:"+i.IAU2000]=i:console.log(i);return}}sg(Et);function yg(i){return typeof i=="string"}function vg(i){return i in Et}var _g=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Sg(i){return _g.some(function(t){return i.indexOf(t)>-1})}var Mg=["3857","900913","3785","102113"];function Cg(i){var t=je(i,"authority");if(!!t){var e=je(t,"epsg");return e&&Mg.indexOf(e)>-1}}function wg(i){var t=je(i,"extension");if(!!t)return je(t,"proj4")}function xg(i){return i[0]==="+"}function bg(i){if(yg(i)){if(vg(i))return Et[i];if(Sg(i)){var t=Pl(i);if(Cg(t))return Et["EPSG:3857"];var e=wg(t);return e?ea(e):t}if(xg(i))return ea(i)}else return i}function El(i,t){i=i||{};var e,s;if(!t)return i;for(s in t)e=t[s],e!==void 0&&(i[s]=e);return i}function ue(i,t,e){var s=i*t;return e/Math.sqrt(1-s*s)}function Ls(i){return i<0?-1:1}function b(i){return Math.abs(i)<=nt?i:i-Ls(i)*Es}function se(i,t,e){var s=i*e,r=.5*i;return s=Math.pow((1-s)/(1+s),r),Math.tan(.5*(S-t))/s}function Ts(i,t){for(var e=.5*i,s,r,n=S-2*Math.atan(t),a=0;a<=15;a++)if(s=i*Math.sin(n),r=S-2*Math.atan(t*Math.pow((1-s)/(1+s),e))-n,n+=r,Math.abs(r)<=1e-10)return n;return-9999}function Og(){var i=this.b/this.a;this.es=1-i*i,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=ue(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function Pg(i){var t=i.x,e=i.y;if(e*ce>90&&e*ce<-90&&t*ce>180&&t*ce<-180)return null;var s,r;if(Math.abs(Math.abs(e)-S)<=w)return null;if(this.sphere)s=this.x0+this.a*this.k0*b(t-this.long0),r=this.y0+this.a*this.k0*Math.log(Math.tan(j+.5*e));else{var n=Math.sin(e),a=se(this.e,e,n);s=this.x0+this.a*this.k0*b(t-this.long0),r=this.y0-this.a*this.k0*Math.log(a)}return i.x=s,i.y=r,i}function Eg(i){var t=i.x-this.x0,e=i.y-this.y0,s,r;if(this.sphere)r=S-2*Math.atan(Math.exp(-e/(this.a*this.k0)));else{var n=Math.exp(-e/(this.a*this.k0));if(r=Ts(this.e,n),r===-9999)return null}return s=b(this.long0+t/(this.a*this.k0)),i.x=s,i.y=r,i}var Ig=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],Lg={init:Og,forward:Pg,inverse:Eg,names:Ig};function Tg(){}function Il(i){return i}var Ng=["longlat","identity"],Dg={init:Tg,forward:Il,inverse:Il,names:Ng},Fg=[Lg,Dg],Or={},Pr=[];function Ll(i,t){var e=Pr.length;return i.names?(Pr[e]=i,i.names.forEach(function(s){Or[s.toLowerCase()]=e}),this):(console.log(t),!0)}function Rg(i){if(!i)return!1;var t=i.toLowerCase();if(typeof Or[t]!="undefined"&&Pr[Or[t]])return Pr[Or[t]]}function Ag(){Fg.forEach(Ll)}var Gg={start:Ag,add:Ll,get:Rg},N={};N.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"},N.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},N.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},N.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"},N.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},N.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},N.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},N.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},N.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},N.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},N.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},N.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},N.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},N.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},N.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},N.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},N.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},N.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},N.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},N.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},N.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},N.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},N.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},N.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},N.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},N.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"},N.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"},N.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"},N.hough={a:6378270,rf:297,ellipseName:"Hough"},N.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},N.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"},N.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"},N.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"},N.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},N.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},N.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},N.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},N.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},N.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"},N.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"},N.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var kg=N.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};N.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function zg(i,t,e,s){var r=i*i,n=t*t,a=(r-n)/r,o=0;s?(i*=1-a*(ag+a*(og+a*lg)),r=i*i,a=0):o=Math.sqrt(a);var l=(r-n)/n;return{es:a,e:o,ep2:l}}function jg(i,t,e,s,r){if(!i){var n=je(N,s);n||(n=kg),i=n.a,t=n.b,e=n.rf}return e&&!t&&(t=(1-1/e)*i),(e===0||Math.abs(i-t)<w)&&(r=!0,t=i),{a:i,b:t,rf:e,sphere:r}}var gt={};gt.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},gt.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},gt.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},gt.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},gt.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},gt.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},gt.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},gt.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},gt.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},gt.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},gt.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},gt.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},gt.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},gt.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},gt.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gt.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},gt.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function $g(i,t,e,s,r,n,a){var o={};return i===void 0||i==="none"?o.datum_type=ta:o.datum_type=rg,t&&(o.datum_params=t.map(parseFloat),(o.datum_params[0]!==0||o.datum_params[1]!==0||o.datum_params[2]!==0)&&(o.datum_type=ei),o.datum_params.length>3&&(o.datum_params[3]!==0||o.datum_params[4]!==0||o.datum_params[5]!==0||o.datum_params[6]!==0)&&(o.datum_type=ii,o.datum_params[3]*=Ps,o.datum_params[4]*=Ps,o.datum_params[5]*=Ps,o.datum_params[6]=o.datum_params[6]/1e6+1)),a&&(o.datum_type=wr,o.grids=a),o.a=e,o.b=s,o.es=r,o.ep2=n,o}var Tl={};function Hg(i,t){var e=new DataView(t),s=Ug(e),r=qg(e,s);r.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var n=Wg(e,r,s),a={header:r,subgrids:n};return Tl[i]=a,a}function Vg(i){if(i===void 0)return null;var t=i.split(",");return t.map(Bg)}function Bg(i){if(i.length===0)return null;var t=i[0]==="@";return t&&(i=i.slice(1)),i==="null"?{name:"null",mandatory:!t,grid:null,isNull:!0}:{name:i,mandatory:!t,grid:Tl[i]||null,isNull:!1}}function Li(i){return i/3600*Math.PI/180}function Ug(i){var t=i.getInt32(8,!1);return t===11?!1:(t=i.getInt32(8,!0),t!==11&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function qg(i,t){return{nFields:i.getInt32(8,t),nSubgridFields:i.getInt32(24,t),nSubgrids:i.getInt32(40,t),shiftType:sa(i,56,56+8).trim(),fromSemiMajorAxis:i.getFloat64(120,t),fromSemiMinorAxis:i.getFloat64(136,t),toSemiMajorAxis:i.getFloat64(152,t),toSemiMinorAxis:i.getFloat64(168,t)}}function sa(i,t,e){return String.fromCharCode.apply(null,new Uint8Array(i.buffer.slice(t,e)))}function Wg(i,t,e){for(var s=176,r=[],n=0;n<t.nSubgrids;n++){var a=Xg(i,s,e),o=Zg(i,s,a,e),l=Math.round(1+(a.upperLongitude-a.lowerLongitude)/a.longitudeInterval),h=Math.round(1+(a.upperLatitude-a.lowerLatitude)/a.latitudeInterval);r.push({ll:[Li(a.lowerLongitude),Li(a.lowerLatitude)],del:[Li(a.longitudeInterval),Li(a.latitudeInterval)],lim:[l,h],count:a.gridNodeCount,cvs:Yg(o)})}return r}function Yg(i){return i.map(function(t){return[Li(t.longitudeShift),Li(t.latitudeShift)]})}function Xg(i,t,e){return{name:sa(i,t+8,t+16).trim(),parent:sa(i,t+24,t+24+8).trim(),lowerLatitude:i.getFloat64(t+72,e),upperLatitude:i.getFloat64(t+88,e),lowerLongitude:i.getFloat64(t+104,e),upperLongitude:i.getFloat64(t+120,e),latitudeInterval:i.getFloat64(t+136,e),longitudeInterval:i.getFloat64(t+152,e),gridNodeCount:i.getInt32(t+168,e)}}function Zg(i,t,e,s){for(var r=t+176,n=16,a=[],o=0;o<e.gridNodeCount;o++){var l={latitudeShift:i.getFloat32(r+o*n,s),longitudeShift:i.getFloat32(r+o*n+4,s),latitudeAccuracy:i.getFloat32(r+o*n+8,s),longitudeAccuracy:i.getFloat32(r+o*n+12,s)};a.push(l)}return a}function de(i,t){if(!(this instanceof de))return new de(i);t=t||function(h){if(h)throw h};var e=bg(i);if(typeof e!="object"){t(i);return}var s=de.projections.get(e.projName);if(!s){t(i);return}if(e.datumCode&&e.datumCode!=="none"){var r=je(gt,e.datumCode);r&&(e.datum_params=e.datum_params||(r.towgs84?r.towgs84.split(","):null),e.ellps=r.ellipse,e.datumName=r.datumName?r.datumName:e.datumCode)}e.k0=e.k0||1,e.axis=e.axis||"enu",e.ellps=e.ellps||"wgs84",e.lat1=e.lat1||e.lat0;var n=jg(e.a,e.b,e.rf,e.ellps,e.sphere),a=zg(n.a,n.b,n.rf,e.R_A),o=Vg(e.nadgrids),l=e.datum||$g(e.datumCode,e.datum_params,n.a,n.b,a.es,a.ep2,o);El(this,e),El(this,s),this.a=n.a,this.b=n.b,this.rf=n.rf,this.sphere=n.sphere,this.es=a.es,this.e=a.e,this.ep2=a.ep2,this.datum=l,this.init(),t(null,this)}de.projections=Gg,de.projections.start();function Jg(i,t){return i.datum_type!==t.datum_type||i.a!==t.a||Math.abs(i.es-t.es)>5e-11?!1:i.datum_type===ei?i.datum_params[0]===t.datum_params[0]&&i.datum_params[1]===t.datum_params[1]&&i.datum_params[2]===t.datum_params[2]:i.datum_type===ii?i.datum_params[0]===t.datum_params[0]&&i.datum_params[1]===t.datum_params[1]&&i.datum_params[2]===t.datum_params[2]&&i.datum_params[3]===t.datum_params[3]&&i.datum_params[4]===t.datum_params[4]&&i.datum_params[5]===t.datum_params[5]&&i.datum_params[6]===t.datum_params[6]:!0}function Nl(i,t,e){var s=i.x,r=i.y,n=i.z?i.z:0,a,o,l,h;if(r<-S&&r>-1.001*S)r=-S;else if(r>S&&r<1.001*S)r=S;else{if(r<-S)return{x:-1/0,y:-1/0,z:i.z};if(r>S)return{x:1/0,y:1/0,z:i.z}}return s>Math.PI&&(s-=2*Math.PI),o=Math.sin(r),h=Math.cos(r),l=o*o,a=e/Math.sqrt(1-t*l),{x:(a+n)*h*Math.cos(s),y:(a+n)*h*Math.sin(s),z:(a*(1-t)+n)*o}}function Dl(i,t,e,s){var r=1e-12,n=r*r,a=30,o,l,h,c,u,d,f,g,m,p,y,M,x,L=i.x,I=i.y,D=i.z?i.z:0,Y,H,wt;if(o=Math.sqrt(L*L+I*I),l=Math.sqrt(L*L+I*I+D*D),o/e<r){if(Y=0,l/e<r)return H=S,wt=-s,{x:i.x,y:i.y,z:i.z}}else Y=Math.atan2(I,L);h=D/l,c=o/l,u=1/Math.sqrt(1-t*(2-t)*c*c),g=c*(1-t)*u,m=h*u,x=0;do x++,f=e/Math.sqrt(1-t*m*m),wt=o*g+D*m-f*(1-t*m*m),d=t*f/(f+wt),u=1/Math.sqrt(1-d*(2-d)*c*c),p=c*(1-d)*u,y=h*u,M=y*g-p*m,g=p,m=y;while(M*M>n&&x<a);return H=Math.atan(y/Math.abs(p)),{x:Y,y:H,z:wt}}function Kg(i,t,e){if(t===ei)return{x:i.x+e[0],y:i.y+e[1],z:i.z+e[2]};if(t===ii){var s=e[0],r=e[1],n=e[2],a=e[3],o=e[4],l=e[5],h=e[6];return{x:h*(i.x-l*i.y+o*i.z)+s,y:h*(l*i.x+i.y-a*i.z)+r,z:h*(-o*i.x+a*i.y+i.z)+n}}}function Qg(i,t,e){if(t===ei)return{x:i.x-e[0],y:i.y-e[1],z:i.z-e[2]};if(t===ii){var s=e[0],r=e[1],n=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=(i.x-s)/h,u=(i.y-r)/h,d=(i.z-n)/h;return{x:c+l*u-o*d,y:-l*c+u+a*d,z:o*c-a*u+d}}}function Er(i){return i===ei||i===ii}function tm(i,t,e){if(Jg(i,t)||i.datum_type===ta||t.datum_type===ta)return e;var s=i.a,r=i.es;if(i.datum_type===wr){var n=Fl(i,!1,e);if(n!==0)return;s=_l,r=Sl}var a=t.a,o=t.b,l=t.es;if(t.datum_type===wr&&(a=_l,o=ng,l=Sl),r===l&&s===a&&!Er(i.datum_type)&&!Er(t.datum_type))return e;if(e=Nl(e,r,s),Er(i.datum_type)&&(e=Kg(e,i.datum_type,i.datum_params)),Er(t.datum_type)&&(e=Qg(e,t.datum_type,t.datum_params)),e=Dl(e,l,a,o),t.datum_type===wr){var h=Fl(t,!0,e);if(h!==0)return}return e}function Fl(i,t,e){if(i.grids===null||i.grids.length===0)return console.log("Grid shift grids not found"),-1;for(var s={x:-e.x,y:e.y},r={x:Number.NaN,y:Number.NaN},n=[],a=0;a<i.grids.length;a++){var o=i.grids[a];if(n.push(o.name),o.isNull){r=s;break}if(o.grid===null){if(o.mandatory)return console.log("Unable to find mandatory grid '"+o.name+"'"),-1;continue}var l=o.grid.subgrids[0],h=(Math.abs(l.del[1])+Math.abs(l.del[0]))/1e4,c=l.ll[0]-h,u=l.ll[1]-h,d=l.ll[0]+(l.lim[0]-1)*l.del[0]+h,f=l.ll[1]+(l.lim[1]-1)*l.del[1]+h;if(!(u>s.y||c>s.x||f<s.y||d<s.x)&&(r=em(s,t,l),!isNaN(r.x)))break}return isNaN(r.x)?(console.log("Failed to find a grid shift table for location '"+-s.x*ce+" "+s.y*ce+" tried: '"+n+"'"),-1):(e.x=-r.x,e.y=r.y,0)}function em(i,t,e){var s={x:Number.NaN,y:Number.NaN};if(isNaN(i.x))return s;var r={x:i.x,y:i.y};r.x-=e.ll[0],r.y-=e.ll[1],r.x=b(r.x-Math.PI)+Math.PI;var n=Rl(r,e);if(t){if(isNaN(n.x))return s;n.x=r.x-n.x,n.y=r.y-n.y;var a=9,o=1e-12,l,h;do{if(h=Rl(n,e),isNaN(h.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}l={x:r.x-(h.x+n.x),y:r.y-(h.y+n.y)},n.x+=l.x,n.y+=l.y}while(a--&&Math.abs(l.x)>o&&Math.abs(l.y)>o);if(a<0)return console.log("Inverse grid shift iterator failed to converge."),s;s.x=b(n.x+e.ll[0]),s.y=n.y+e.ll[1]}else isNaN(n.x)||(s.x=i.x+n.x,s.y=i.y+n.y);return s}function Rl(i,t){var e={x:i.x/t.del[0],y:i.y/t.del[1]},s={x:Math.floor(e.x),y:Math.floor(e.y)},r={x:e.x-1*s.x,y:e.y-1*s.y},n={x:Number.NaN,y:Number.NaN},a;if(s.x<0||s.x>=t.lim[0]||s.y<0||s.y>=t.lim[1])return n;a=s.y*t.lim[0]+s.x;var o={x:t.cvs[a][0],y:t.cvs[a][1]};a++;var l={x:t.cvs[a][0],y:t.cvs[a][1]};a+=t.lim[0];var h={x:t.cvs[a][0],y:t.cvs[a][1]};a--;var c={x:t.cvs[a][0],y:t.cvs[a][1]},u=r.x*r.y,d=r.x*(1-r.y),f=(1-r.x)*(1-r.y),g=(1-r.x)*r.y;return n.x=f*o.x+d*l.x+g*c.x+u*h.x,n.y=f*o.y+d*l.y+g*c.y+u*h.y,n}function Al(i,t,e){var s=e.x,r=e.y,n=e.z||0,a,o,l,h={};for(l=0;l<3;l++)if(!(t&&l===2&&e.z===void 0))switch(l===0?(a=s,"ew".indexOf(i.axis[l])!==-1?o="x":o="y"):l===1?(a=r,"ns".indexOf(i.axis[l])!==-1?o="y":o="x"):(a=n,o="z"),i.axis[l]){case"e":h[o]=a;break;case"w":h[o]=-a;break;case"n":h[o]=a;break;case"s":h[o]=-a;break;case"u":e[o]!==void 0&&(h.z=a);break;case"d":e[o]!==void 0&&(h.z=-a);break;default:return null}return h}function Gl(i){var t={x:i[0],y:i[1]};return i.length>2&&(t.z=i[2]),i.length>3&&(t.m=i[3]),t}function im(i){kl(i.x),kl(i.y)}function kl(i){if(typeof Number.isFinite=="function"){if(Number.isFinite(i))return;throw new TypeError("coordinates must be finite numbers")}if(typeof i!="number"||i!==i||!isFinite(i))throw new TypeError("coordinates must be finite numbers")}function sm(i,t){return(i.datum.datum_type===ei||i.datum.datum_type===ii)&&t.datumCode!=="WGS84"||(t.datum.datum_type===ei||t.datum.datum_type===ii)&&i.datumCode!=="WGS84"}function Ir(i,t,e,s){var r;if(Array.isArray(e)&&(e=Gl(e)),im(e),i.datum&&t.datum&&sm(i,t)&&(r=new de("WGS84"),e=Ir(i,r,e,s),i=r),s&&i.axis!=="enu"&&(e=Al(i,!1,e)),i.projName==="longlat")e={x:e.x*_t,y:e.y*_t,z:e.z||0};else if(i.to_meter&&(e={x:e.x*i.to_meter,y:e.y*i.to_meter,z:e.z||0}),e=i.inverse(e),!e)return;if(i.from_greenwich&&(e.x+=i.from_greenwich),e=tm(i.datum,t.datum,e),!!e)return t.from_greenwich&&(e={x:e.x-t.from_greenwich,y:e.y,z:e.z||0}),t.projName==="longlat"?e={x:e.x*ce,y:e.y*ce,z:e.z||0}:(e=t.forward(e),t.to_meter&&(e={x:e.x/t.to_meter,y:e.y/t.to_meter,z:e.z||0})),s&&t.axis!=="enu"?Al(t,!0,e):e}var zl=de("WGS84");function ra(i,t,e,s){var r,n,a;return Array.isArray(e)?(r=Ir(i,t,e,s)||{x:NaN,y:NaN},e.length>2?typeof i.name!="undefined"&&i.name==="geocent"||typeof t.name!="undefined"&&t.name==="geocent"?typeof r.z=="number"?[r.x,r.y,r.z].concat(e.splice(3)):[r.x,r.y,e[2]].concat(e.splice(3)):[r.x,r.y].concat(e.splice(2)):[r.x,r.y]):(n=Ir(i,t,e,s),a=Object.keys(e),a.length===2||a.forEach(function(o){if(typeof i.name!="undefined"&&i.name==="geocent"||typeof t.name!="undefined"&&t.name==="geocent"){if(o==="x"||o==="y"||o==="z")return}else if(o==="x"||o==="y")return;n[o]=e[o]}),n)}function jl(i){return i instanceof de?i:i.oProj?i.oProj:de(i)}function ct(i,t,e){i=jl(i);var s=!1,r;return typeof t=="undefined"?(t=i,i=zl,s=!0):(typeof t.x!="undefined"||Array.isArray(t))&&(e=t,t=i,i=zl,s=!0),t=jl(t),e?ra(i,t,e):(r={forward:function(n,a){return ra(i,t,n,a)},inverse:function(n,a){return ra(t,i,n,a)}},s&&(r.oProj=t),r)}var $l=6,Hl="AJSAJS",Vl="AFAFAF",Ti=65,Ft=73,Zt=79,Ns=86,Ds=90,rm={forward:Bl,inverse:nm,toPoint:Ul};function Bl(i,t){return t=t||5,lm(am({lat:i[1],lon:i[0]}),t)}function nm(i){var t=aa(Yl(i.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function Ul(i){var t=aa(Yl(i.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function na(i){return i*(Math.PI/180)}function ql(i){return 180*(i/Math.PI)}function am(i){var t=i.lat,e=i.lon,s=6378137,r=.00669438,n=.9996,a,o,l,h,c,u,d,f=na(t),g=na(e),m,p;p=Math.floor((e+180)/6)+1,e===180&&(p=60),t>=56&&t<64&&e>=3&&e<12&&(p=32),t>=72&&t<84&&(e>=0&&e<9?p=31:e>=9&&e<21?p=33:e>=21&&e<33?p=35:e>=33&&e<42&&(p=37)),a=(p-1)*6-180+3,m=na(a),o=r/(1-r),l=s/Math.sqrt(1-r*Math.sin(f)*Math.sin(f)),h=Math.tan(f)*Math.tan(f),c=o*Math.cos(f)*Math.cos(f),u=Math.cos(f)*(g-m),d=s*((1-r/4-3*r*r/64-5*r*r*r/256)*f-(3*r/8+3*r*r/32+45*r*r*r/1024)*Math.sin(2*f)+(15*r*r/256+45*r*r*r/1024)*Math.sin(4*f)-35*r*r*r/3072*Math.sin(6*f));var y=n*l*(u+(1-h+c)*u*u*u/6+(5-18*h+h*h+72*c-58*o)*u*u*u*u*u/120)+5e5,M=n*(d+l*Math.tan(f)*(u*u/2+(5-h+9*c+4*c*c)*u*u*u*u/24+(61-58*h+h*h+600*c-330*o)*u*u*u*u*u*u/720));return t<0&&(M+=1e7),{northing:Math.round(M),easting:Math.round(y),zoneNumber:p,zoneLetter:om(t)}}function aa(i){var t=i.northing,e=i.easting,s=i.zoneLetter,r=i.zoneNumber;if(r<0||r>60)return null;var n=.9996,a=6378137,o=.00669438,l,h=(1-Math.sqrt(1-o))/(1+Math.sqrt(1-o)),c,u,d,f,g,m,p,y,M,x=e-5e5,L=t;s<"N"&&(L-=1e7),p=(r-1)*6-180+3,l=o/(1-o),m=L/n,y=m/(a*(1-o/4-3*o*o/64-5*o*o*o/256)),M=y+(3*h/2-27*h*h*h/32)*Math.sin(2*y)+(21*h*h/16-55*h*h*h*h/32)*Math.sin(4*y)+151*h*h*h/96*Math.sin(6*y),c=a/Math.sqrt(1-o*Math.sin(M)*Math.sin(M)),u=Math.tan(M)*Math.tan(M),d=l*Math.cos(M)*Math.cos(M),f=a*(1-o)/Math.pow(1-o*Math.sin(M)*Math.sin(M),1.5),g=x/(c*n);var I=M-c*Math.tan(M)/f*(g*g/2-(5+3*u+10*d-4*d*d-9*l)*g*g*g*g/24+(61+90*u+298*d+45*u*u-252*l-3*d*d)*g*g*g*g*g*g/720);I=ql(I);var D=(g-(1+2*u+d)*g*g*g/6+(5-2*d+28*u-3*d*d+8*l+24*u*u)*g*g*g*g*g/120)/Math.cos(M);D=p+ql(D);var Y;if(i.accuracy){var H=aa({northing:i.northing+i.accuracy,easting:i.easting+i.accuracy,zoneLetter:i.zoneLetter,zoneNumber:i.zoneNumber});Y={top:H.lat,right:H.lon,bottom:I,left:D}}else Y={lat:I,lon:D};return Y}function om(i){var t="Z";return 84>=i&&i>=72?t="X":72>i&&i>=64?t="W":64>i&&i>=56?t="V":56>i&&i>=48?t="U":48>i&&i>=40?t="T":40>i&&i>=32?t="S":32>i&&i>=24?t="R":24>i&&i>=16?t="Q":16>i&&i>=8?t="P":8>i&&i>=0?t="N":0>i&&i>=-8?t="M":-8>i&&i>=-16?t="L":-16>i&&i>=-24?t="K":-24>i&&i>=-32?t="J":-32>i&&i>=-40?t="H":-40>i&&i>=-48?t="G":-48>i&&i>=-56?t="F":-56>i&&i>=-64?t="E":-64>i&&i>=-72?t="D":-72>i&&i>=-80&&(t="C"),t}function lm(i,t){var e="00000"+i.easting,s="00000"+i.northing;return i.zoneNumber+i.zoneLetter+hm(i.easting,i.northing,i.zoneNumber)+e.substr(e.length-5,t)+s.substr(s.length-5,t)}function hm(i,t,e){var s=Wl(e),r=Math.floor(i/1e5),n=Math.floor(t/1e5)%20;return cm(r,n,s)}function Wl(i){var t=i%$l;return t===0&&(t=$l),t}function cm(i,t,e){var s=e-1,r=Hl.charCodeAt(s),n=Vl.charCodeAt(s),a=r+i-1,o=n+t,l=!1;a>Ds&&(a=a-Ds+Ti-1,l=!0),(a===Ft||r<Ft&&a>Ft||(a>Ft||r<Ft)&&l)&&a++,(a===Zt||r<Zt&&a>Zt||(a>Zt||r<Zt)&&l)&&(a++,a===Ft&&a++),a>Ds&&(a=a-Ds+Ti-1),o>Ns?(o=o-Ns+Ti-1,l=!0):l=!1,(o===Ft||n<Ft&&o>Ft||(o>Ft||n<Ft)&&l)&&o++,(o===Zt||n<Zt&&o>Zt||(o>Zt||n<Zt)&&l)&&(o++,o===Ft&&o++),o>Ns&&(o=o-Ns+Ti-1);var h=String.fromCharCode(a)+String.fromCharCode(o);return h}function Yl(i){if(i&&i.length===0)throw"MGRSPoint coverting from nothing";for(var t=i.length,e=null,s="",r,n=0;!/[A-Z]/.test(r=i.charAt(n));){if(n>=2)throw"MGRSPoint bad conversion from: "+i;s+=r,n++}var a=parseInt(s,10);if(n===0||n+3>t)throw"MGRSPoint bad conversion from: "+i;var o=i.charAt(n++);if(o<="A"||o==="B"||o==="Y"||o>="Z"||o==="I"||o==="O")throw"MGRSPoint zone letter "+o+" not handled: "+i;e=i.substring(n,n+=2);for(var l=Wl(a),h=um(e.charAt(0),l),c=dm(e.charAt(1),l);c<fm(o);)c+=2e6;var u=t-n;if(u%2!==0)throw`MGRSPoint has to have an even number
2
2
  of digits after the zone letter and two 100km letters - front
3
3
  half for easting meters, second half for
4
4
  northing meters`+i;var d=u/2,f=0,g=0,m,p,y,M,x;return d>0&&(m=1e5/Math.pow(10,d),p=i.substring(n,n+d),f=parseFloat(p)*m,y=i.substring(n+d),g=parseFloat(y)*m),M=f+h,x=g+c,{easting:M,northing:x,zoneLetter:o,zoneNumber:a,accuracy:m}}function um(i,t){for(var e=Hl.charCodeAt(t-1),s=1e5,r=!1;e!==i.charCodeAt(0);){if(e++,e===Ft&&e++,e===Zt&&e++,e>Ds){if(r)throw"Bad character: "+i;e=Ti,r=!0}s+=1e5}return s}function dm(i,t){if(i>"V")throw"MGRSPoint given invalid Northing "+i;for(var e=Vl.charCodeAt(t-1),s=0,r=!1;e!==i.charCodeAt(0);){if(e++,e===Ft&&e++,e===Zt&&e++,e>Ns){if(r)throw"Bad character: "+i;e=Ti,r=!0}s+=1e5}return s}function fm(i){var t;switch(i){case"C":t=11e5;break;case"D":t=2e6;break;case"E":t=28e5;break;case"F":t=37e5;break;case"G":t=46e5;break;case"H":t=55e5;break;case"J":t=64e5;break;case"K":t=73e5;break;case"L":t=82e5;break;case"M":t=91e5;break;case"N":t=0;break;case"P":t=8e5;break;case"Q":t=17e5;break;case"R":t=26e5;break;case"S":t=35e5;break;case"T":t=44e5;break;case"U":t=53e5;break;case"V":t=62e5;break;case"W":t=7e6;break;case"X":t=79e5;break;default:t=-1}if(t>=0)return t;throw"Invalid zone letter: "+i}function Ni(i,t,e){if(!(this instanceof Ni))return new Ni(i,t,e);if(Array.isArray(i))this.x=i[0],this.y=i[1],this.z=i[2]||0;else if(typeof i=="object")this.x=i.x,this.y=i.y,this.z=i.z||0;else if(typeof i=="string"&&typeof t=="undefined"){var s=i.split(",");this.x=parseFloat(s[0],10),this.y=parseFloat(s[1],10),this.z=parseFloat(s[2],10)||0}else this.x=i,this.y=t,this.z=e||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Ni.fromMGRS=function(i){return new Ni(Ul(i))},Ni.prototype.toMGRS=function(i){return Bl([this.x,this.y],i)};var gm=1,mm=.25,Xl=.046875,Zl=.01953125,Jl=.01068115234375,pm=.75,ym=.46875,vm=.013020833333333334,_m=.007120768229166667,Sm=.3645833333333333,Mm=.005696614583333333,Cm=.3076171875;function Kl(i){var t=[];t[0]=gm-i*(mm+i*(Xl+i*(Zl+i*Jl))),t[1]=i*(pm-i*(Xl+i*(Zl+i*Jl)));var e=i*i;return t[2]=e*(ym-i*(vm+i*_m)),e*=i,t[3]=e*(Sm-i*Mm),t[4]=e*i*Cm,t}function Lr(i,t,e,s){return e*=t,t*=t,s[0]*i-e*(s[1]+t*(s[2]+t*(s[3]+t*s[4])))}var wm=20;function Ql(i,t,e){for(var s=1/(1-t),r=i,n=wm;n;--n){var a=Math.sin(r),o=1-t*a*a;if(o=(Lr(r,a,Math.cos(r),e)-i)*(o*Math.sqrt(o))*s,r-=o,Math.abs(o)<w)return r}return r}function xm(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=Kl(this.es),this.ml0=Lr(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function bm(i){var t=i.x,e=i.y,s=b(t-this.long0),r,n,a,o=Math.sin(e),l=Math.cos(e);if(this.es){var c=l*s,u=Math.pow(c,2),d=this.ep2*Math.pow(l,2),f=Math.pow(d,2),g=Math.abs(l)>w?Math.tan(e):0,m=Math.pow(g,2),p=Math.pow(m,2);r=1-this.es*Math.pow(o,2),c=c/Math.sqrt(r);var y=Lr(e,o,l,this.en);n=this.a*(this.k0*c*(1+u/6*(1-m+d+u/20*(5-18*m+p+14*d-58*m*d+u/42*(61+179*p-p*m-479*m)))))+this.x0,a=this.a*(this.k0*(y-this.ml0+o*s*c/2*(1+u/12*(5-m+9*d+4*f+u/30*(61+p-58*m+270*d-330*m*d+u/56*(1385+543*p-p*m-3111*m))))))+this.y0}else{var h=l*Math.sin(s);if(Math.abs(Math.abs(h)-1)<w)return 93;if(n=.5*this.a*this.k0*Math.log((1+h)/(1-h))+this.x0,a=l*Math.cos(s)/Math.sqrt(1-Math.pow(h,2)),h=Math.abs(a),h>=1){if(h-1>w)return 93;a=0}else a=Math.acos(a);e<0&&(a=-a),a=this.a*this.k0*(a-this.lat0)+this.y0}return i.x=n,i.y=a,i}function Om(i){var t,e,s,r,n=(i.x-this.x0)*(1/this.a),a=(i.y-this.y0)*(1/this.a);if(this.es)if(t=this.ml0+a/this.k0,e=Ql(t,this.es,this.en),Math.abs(e)<S){var u=Math.sin(e),d=Math.cos(e),f=Math.abs(d)>w?Math.tan(e):0,g=this.ep2*Math.pow(d,2),m=Math.pow(g,2),p=Math.pow(f,2),y=Math.pow(p,2);t=1-this.es*Math.pow(u,2);var M=n*Math.sqrt(t)/this.k0,x=Math.pow(M,2);t=t*f,s=e-t*x/(1-this.es)*.5*(1-x/12*(5+3*p-9*g*p+g-4*m-x/30*(61+90*p-252*g*p+45*y+46*g-x/56*(1385+3633*p+4095*y+1574*y*p)))),r=b(this.long0+M*(1-x/6*(1+2*p+g-x/20*(5+28*p+24*y+8*g*p+6*g-x/42*(61+662*p+1320*y+720*y*p))))/d)}else s=S*Ls(a),r=0;else{var o=Math.exp(n/this.k0),l=.5*(o-1/o),h=this.lat0+a/this.k0,c=Math.cos(h);t=Math.sqrt((1-Math.pow(c,2))/(1+Math.pow(l,2))),s=Math.asin(t),a<0&&(s=-s),l===0&&c===0?r=0:r=b(Math.atan2(l,c)+this.long0)}return i.x=r,i.y=s,i}var Pm=["Fast_Transverse_Mercator","Fast Transverse Mercator"],Tr={init:xm,forward:bm,inverse:Om,names:Pm};function th(i){var t=Math.exp(i);return t=(t-1/t)/2,t}function Nr(i,t){i=Math.abs(i),t=Math.abs(t);var e=Math.max(i,t),s=Math.min(i,t)/(e||1);return e*Math.sqrt(1+Math.pow(s,2))}function Em(i){var t=1+i,e=t-1;return e===0?i:i*Math.log(t)/e}function Im(i){var t=Math.abs(i);return t=Em(t*(1+t/(Nr(1,t)+1))),i<0?-t:t}function oa(i,t){for(var e=2*Math.cos(2*t),s=i.length-1,r=i[s],n=0,a;--s>=0;)a=-n+e*r+i[s],n=r,r=a;return t+a*Math.sin(2*t)}function Lm(i,t){for(var e=2*Math.cos(t),s=i.length-1,r=i[s],n=0,a;--s>=0;)a=-n+e*r+i[s],n=r,r=a;return Math.sin(t)*a}function Tm(i){var t=Math.exp(i);return t=(t+1/t)/2,t}function eh(i,t,e){for(var s=Math.sin(t),r=Math.cos(t),n=th(e),a=Tm(e),o=2*r*a,l=-2*s*n,h=i.length-1,c=i[h],u=0,d=0,f=0,g,m;--h>=0;)g=d,m=u,d=c,u=f,c=-g+o*d-l*u+i[h],f=-m+l*d+o*u;return o=s*a,l=r*n,[o*c-l*f,o*f+l*c]}function Nm(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(Tr.init.apply(this),this.forward=Tr.forward,this.inverse=Tr.inverse),this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var i=this.es/(1+Math.sqrt(1-this.es)),t=i/(2-i),e=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+t*(-2854/675)))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+t*(4642/4725)))))),e=e*t,this.cgb[1]=e*(7/3+t*(-8/5+t*(-227/45+t*(2704/315+t*(2323/945))))),this.cbg[1]=e*(5/3+t*(-16/15+t*(-13/9+t*(904/315+t*(-1522/945))))),e=e*t,this.cgb[2]=e*(56/15+t*(-136/35+t*(-1262/105+t*(73814/2835)))),this.cbg[2]=e*(-26/15+t*(34/21+t*(8/5+t*(-12686/2835)))),e=e*t,this.cgb[3]=e*(4279/630+t*(-332/35+t*(-399572/14175))),this.cbg[3]=e*(1237/630+t*(-12/5+t*(-24832/14175))),e=e*t,this.cgb[4]=e*(4174/315+t*(-144838/6237)),this.cbg[4]=e*(-734/315+t*(109598/31185)),e=e*t,this.cgb[5]=e*(601676/22275),this.cbg[5]=e*(444337/155925),e=Math.pow(t,2),this.Qn=this.k0/(1+t)*(1+e*(1/4+e*(1/64+e/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+t*(-96199/604800)))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+t*(7891/37800)))))),this.utg[1]=e*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+t*(1118711/3870720))))),this.gtu[1]=e*(13/48+t*(-3/5+t*(557/1440+t*(281/630+t*(-1983433/1935360))))),e=e*t,this.utg[2]=e*(-17/480+t*(37/840+t*(209/4480+t*(-5569/90720)))),this.gtu[2]=e*(61/240+t*(-103/140+t*(15061/26880+t*(167603/181440)))),e=e*t,this.utg[3]=e*(-4397/161280+t*(11/504+t*(830251/7257600))),this.gtu[3]=e*(49561/161280+t*(-179/168+t*(6601661/7257600))),e=e*t,this.utg[4]=e*(-4583/161280+t*(108847/3991680)),this.gtu[4]=e*(34729/80640+t*(-3418889/1995840)),e=e*t,this.utg[5]=e*(-20648693/638668800),this.gtu[5]=e*(212378941/319334400);var s=oa(this.cbg,this.lat0);this.Zb=-this.Qn*(s+Lm(this.gtu,2*s))}function Dm(i){var t=b(i.x-this.long0),e=i.y;e=oa(this.cbg,e);var s=Math.sin(e),r=Math.cos(e),n=Math.sin(t),a=Math.cos(t);e=Math.atan2(s,a*r),t=Math.atan2(n*r,Nr(s,r*a)),t=Im(Math.tan(t));var o=eh(this.gtu,2*e,2*t);e=e+o[0],t=t+o[1];var l,h;return Math.abs(t)<=2.623395162778?(l=this.a*(this.Qn*t)+this.x0,h=this.a*(this.Qn*e+this.Zb)+this.y0):(l=1/0,h=1/0),i.x=l,i.y=h,i}function Fm(i){var t=(i.x-this.x0)*(1/this.a),e=(i.y-this.y0)*(1/this.a);e=(e-this.Zb)/this.Qn,t=t/this.Qn;var s,r;if(Math.abs(t)<=2.623395162778){var n=eh(this.utg,2*e,2*t);e=e+n[0],t=t+n[1],t=Math.atan(th(t));var a=Math.sin(e),o=Math.cos(e),l=Math.sin(t),h=Math.cos(t);e=Math.atan2(a*h,Nr(l,h*o)),t=Math.atan2(l,h*o),s=b(t+this.long0),r=oa(this.cgb,e)}else s=1/0,r=1/0;return i.x=s,i.y=r,i}var Rm=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"],Dr={init:Nm,forward:Dm,inverse:Fm,names:Rm};function Am(i,t){if(i===void 0){if(i=Math.floor((b(t)+Math.PI)*30/Math.PI)+1,i<0)return 0;if(i>60)return 60}return i}var Gm="etmerc";function km(){var i=Am(this.zone,this.long0);if(i===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(i)-183)*_t,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Dr.init.apply(this),this.forward=Dr.forward,this.inverse=Dr.inverse}var zm=["Universal Transverse Mercator System","utm"],jm={init:km,names:zm,dependsOn:Gm};function la(i,t){return Math.pow((1-i)/(1+i),t)}var $m=20;function Hm(){var i=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*i*i),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(i/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+j)/(Math.pow(Math.tan(.5*this.lat0+j),this.C)*la(this.e*i,this.ratexp))}function Vm(i){var t=i.x,e=i.y;return i.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*e+j),this.C)*la(this.e*Math.sin(e),this.ratexp))-S,i.x=this.C*t,i}function Bm(i){for(var t=1e-14,e=i.x/this.C,s=i.y,r=Math.pow(Math.tan(.5*s+j)/this.K,1/this.C),n=$m;n>0&&(s=2*Math.atan(r*la(this.e*Math.sin(i.y),-.5*this.e))-S,!(Math.abs(s-i.y)<t));--n)i.y=s;return n?(i.x=e,i.y=s,i):null}var Um=["gauss"],ha={init:Hm,forward:Vm,inverse:Bm,names:Um};function qm(){ha.init.apply(this),!!this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function Wm(i){var t,e,s,r;return i.x=b(i.x-this.long0),ha.forward.apply(this,[i]),t=Math.sin(i.y),e=Math.cos(i.y),s=Math.cos(i.x),r=this.k0*this.R2/(1+this.sinc0*t+this.cosc0*e*s),i.x=r*e*Math.sin(i.x),i.y=r*(this.cosc0*t-this.sinc0*e*s),i.x=this.a*i.x+this.x0,i.y=this.a*i.y+this.y0,i}function Ym(i){var t,e,s,r,n;if(i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,i.x/=this.k0,i.y/=this.k0,n=Math.sqrt(i.x*i.x+i.y*i.y)){var a=2*Math.atan2(n,this.R2);t=Math.sin(a),e=Math.cos(a),r=Math.asin(e*this.sinc0+i.y*t*this.cosc0/n),s=Math.atan2(i.x*t,n*this.cosc0*e-i.y*this.sinc0*t)}else r=this.phic0,s=0;return i.x=s,i.y=r,ha.inverse.apply(this,[i]),i.x=b(i.x+this.long0),i}var Xm=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],Zm={init:qm,forward:Wm,inverse:Ym,names:Xm};function Jm(i,t,e){return t*=e,Math.tan(.5*(S+i))*Math.pow((1-t)/(1+t),.5*e)}function Km(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=w&&(this.k0=.5*(1+Ls(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=w&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=w&&(this.k0=.5*this.cons*ue(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/se(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=ue(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-S,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function Qm(i){var t=i.x,e=i.y,s=Math.sin(e),r=Math.cos(e),n,a,o,l,h,c,u=b(t-this.long0);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=w&&Math.abs(e+this.lat0)<=w?(i.x=NaN,i.y=NaN,i):this.sphere?(n=2*this.k0/(1+this.sinlat0*s+this.coslat0*r*Math.cos(u)),i.x=this.a*n*r*Math.sin(u)+this.x0,i.y=this.a*n*(this.coslat0*s-this.sinlat0*r*Math.cos(u))+this.y0,i):(a=2*Math.atan(this.ssfn_(e,s,this.e))-S,l=Math.cos(a),o=Math.sin(a),Math.abs(this.coslat0)<=w?(h=se(this.e,e*this.con,this.con*s),c=2*this.a*this.k0*h/this.cons,i.x=this.x0+c*Math.sin(t-this.long0),i.y=this.y0-this.con*c*Math.cos(t-this.long0),i):(Math.abs(this.sinlat0)<w?(n=2*this.a*this.k0/(1+l*Math.cos(u)),i.y=n*o):(n=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*o+this.cosX0*l*Math.cos(u))),i.y=n*(this.cosX0*o-this.sinX0*l*Math.cos(u))+this.y0),i.x=n*l*Math.sin(u)+this.x0,i))}function tp(i){i.x-=this.x0,i.y-=this.y0;var t,e,s,r,n,a=Math.sqrt(i.x*i.x+i.y*i.y);if(this.sphere){var o=2*Math.atan(a/(2*this.a*this.k0));return t=this.long0,e=this.lat0,a<=w?(i.x=t,i.y=e,i):(e=Math.asin(Math.cos(o)*this.sinlat0+i.y*Math.sin(o)*this.coslat0/a),Math.abs(this.coslat0)<w?this.lat0>0?t=b(this.long0+Math.atan2(i.x,-1*i.y)):t=b(this.long0+Math.atan2(i.x,i.y)):t=b(this.long0+Math.atan2(i.x*Math.sin(o),a*this.coslat0*Math.cos(o)-i.y*this.sinlat0*Math.sin(o))),i.x=t,i.y=e,i)}else if(Math.abs(this.coslat0)<=w){if(a<=w)return e=this.lat0,t=this.long0,i.x=t,i.y=e,i;i.x*=this.con,i.y*=this.con,s=a*this.cons/(2*this.a*this.k0),e=this.con*Ts(this.e,s),t=this.con*b(this.con*this.long0+Math.atan2(i.x,-1*i.y))}else r=2*Math.atan(a*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,a<=w?n=this.X0:(n=Math.asin(Math.cos(r)*this.sinX0+i.y*Math.sin(r)*this.cosX0/a),t=b(this.long0+Math.atan2(i.x*Math.sin(r),a*this.cosX0*Math.cos(r)-i.y*this.sinX0*Math.sin(r)))),e=-1*Ts(this.e,Math.tan(.5*(S+n)));return i.x=t,i.y=e,i}var ep=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],ip={init:Km,forward:Qm,inverse:tp,names:ep,ssfn_:Jm};function sp(){var i=this.lat0;this.lambda0=this.long0;var t=Math.sin(i),e=this.a,s=this.rf,r=1/s,n=2*r-Math.pow(r,2),a=this.e=Math.sqrt(n);this.R=this.k0*e*Math.sqrt(1-n)/(1-n*Math.pow(t,2)),this.alpha=Math.sqrt(1+n/(1-n)*Math.pow(Math.cos(i),4)),this.b0=Math.asin(t/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),l=Math.log(Math.tan(Math.PI/4+i/2)),h=Math.log((1+a*t)/(1-a*t));this.K=o-this.alpha*l+this.alpha*a/2*h}function rp(i){var t=Math.log(Math.tan(Math.PI/4-i.y/2)),e=this.e/2*Math.log((1+this.e*Math.sin(i.y))/(1-this.e*Math.sin(i.y))),s=-this.alpha*(t+e)+this.K,r=2*(Math.atan(Math.exp(s))-Math.PI/4),n=this.alpha*(i.x-this.lambda0),a=Math.atan(Math.sin(n)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(n))),o=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(n));return i.y=this.R/2*Math.log((1+Math.sin(o))/(1-Math.sin(o)))+this.y0,i.x=this.R*a+this.x0,i}function np(i){for(var t=i.x-this.x0,e=i.y-this.y0,s=t/this.R,r=2*(Math.atan(Math.exp(e/this.R))-Math.PI/4),n=Math.asin(Math.cos(this.b0)*Math.sin(r)+Math.sin(this.b0)*Math.cos(r)*Math.cos(s)),a=Math.atan(Math.sin(s)/(Math.cos(this.b0)*Math.cos(s)-Math.sin(this.b0)*Math.tan(r))),o=this.lambda0+a/this.alpha,l=0,h=n,c=-1e3,u=0;Math.abs(h-c)>1e-7;){if(++u>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+n/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(h))/2)),c=h,h=2*Math.atan(Math.exp(l))-Math.PI/2}return i.x=o,i.y=h,i}var ap=["somerc"],op={init:sp,forward:rp,inverse:np,names:ap},Di=1e-7;function lp(i){var t=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],e=typeof i.PROJECTION=="object"?Object.keys(i.PROJECTION)[0]:i.PROJECTION;return"no_uoff"in i||"no_off"in i||t.indexOf(e)!==-1}function hp(){var i,t,e,s,r,n,a,o,l,h,c=0,u,d=0,f=0,g=0,m=0,p=0,y=0;this.no_off=lp(this),this.no_rot="no_rot"in this;var M=!1;"alpha"in this&&(M=!0);var x=!1;if("rectified_grid_angle"in this&&(x=!0),M&&(y=this.alpha),x&&(c=this.rectified_grid_angle*_t),M||x)d=this.longc;else if(f=this.long1,m=this.lat1,g=this.long2,p=this.lat2,Math.abs(m-p)<=Di||(i=Math.abs(m))<=Di||Math.abs(i-S)<=Di||Math.abs(Math.abs(this.lat0)-S)<=Di||Math.abs(Math.abs(p)-S)<=Di)throw new Error;var L=1-this.es;t=Math.sqrt(L),Math.abs(this.lat0)>w?(o=Math.sin(this.lat0),e=Math.cos(this.lat0),i=1-this.es*o*o,this.B=e*e,this.B=Math.sqrt(1+this.es*this.B*this.B/L),this.A=this.B*this.k0*t/i,s=this.B*t/(e*Math.sqrt(i)),r=s*s-1,r<=0?r=0:(r=Math.sqrt(r),this.lat0<0&&(r=-r)),this.E=r+=s,this.E*=Math.pow(se(this.e,this.lat0,o),this.B)):(this.B=1/t,this.A=this.k0,this.E=s=r=1),M||x?(M?(u=Math.asin(Math.sin(y)/s),x||(c=y)):(u=c,y=Math.asin(s*Math.sin(u))),this.lam0=d-Math.asin(.5*(r-1/r)*Math.tan(u))/this.B):(n=Math.pow(se(this.e,m,Math.sin(m)),this.B),a=Math.pow(se(this.e,p,Math.sin(p)),this.B),r=this.E/n,l=(a-n)/(a+n),h=this.E*this.E,h=(h-a*n)/(h+a*n),i=f-g,i<-Math.pi?g-=Es:i>Math.pi&&(g+=Es),this.lam0=b(.5*(f+g)-Math.atan(h*Math.tan(.5*this.B*(f-g))/l)/this.B),u=Math.atan(2*Math.sin(this.B*b(f-this.lam0))/(r-1/r)),c=y=Math.asin(s*Math.sin(u))),this.singam=Math.sin(u),this.cosgam=Math.cos(u),this.sinrot=Math.sin(c),this.cosrot=Math.cos(c),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.A*this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(s*s-1)/Math.cos(y))),this.lat0<0&&(this.u_0=-this.u_0)),r=.5*u,this.v_pole_n=this.ArB*Math.log(Math.tan(j-r)),this.v_pole_s=this.ArB*Math.log(Math.tan(j+r))}function cp(i){var t={},e,s,r,n,a,o,l,h;if(i.x=i.x-this.lam0,Math.abs(Math.abs(i.y)-S)>w){if(a=this.E/Math.pow(se(this.e,i.y,Math.sin(i.y)),this.B),o=1/a,e=.5*(a-o),s=.5*(a+o),n=Math.sin(this.B*i.x),r=(e*this.singam-n*this.cosgam)/s,Math.abs(Math.abs(r)-1)<w)throw new Error;h=.5*this.ArB*Math.log((1-r)/(1+r)),o=Math.cos(this.B*i.x),Math.abs(o)<Di?l=this.A*i.x:l=this.ArB*Math.atan2(e*this.cosgam+n*this.singam,o)}else h=i.y>0?this.v_pole_n:this.v_pole_s,l=this.ArB*i.y;return this.no_rot?(t.x=l,t.y=h):(l-=this.u_0,t.x=h*this.cosrot+l*this.sinrot,t.y=l*this.cosrot-h*this.sinrot),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function up(i){var t,e,s,r,n,a,o,l={};if(i.x=(i.x-this.x0)*(1/this.a),i.y=(i.y-this.y0)*(1/this.a),this.no_rot?(e=i.y,t=i.x):(e=i.x*this.cosrot-i.y*this.sinrot,t=i.y*this.cosrot+i.x*this.sinrot+this.u_0),s=Math.exp(-this.BrA*e),r=.5*(s-1/s),n=.5*(s+1/s),a=Math.sin(this.BrA*t),o=(a*this.cosgam+r*this.singam)/n,Math.abs(Math.abs(o)-1)<w)l.x=0,l.y=o<0?-S:S;else{if(l.y=this.E/Math.sqrt((1+o)/(1-o)),l.y=Ts(this.e,Math.pow(l.y,1/this.B)),l.y===1/0)throw new Error;l.x=-this.rB*Math.atan2(r*this.cosgam-a*this.singam,Math.cos(this.BrA*t))}return l.x+=this.lam0,l}var dp=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"],fp={init:hp,forward:cp,inverse:up,names:dp};function gp(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<w)){var i=this.b/this.a;this.e=Math.sqrt(1-i*i);var t=Math.sin(this.lat1),e=Math.cos(this.lat1),s=ue(this.e,t,e),r=se(this.e,this.lat1,t),n=Math.sin(this.lat2),a=Math.cos(this.lat2),o=ue(this.e,n,a),l=se(this.e,this.lat2,n),h=se(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>w?this.ns=Math.log(s/o)/Math.log(r/l):this.ns=t,isNaN(this.ns)&&(this.ns=t),this.f0=s/(this.ns*Math.pow(r,this.ns)),this.rh=this.a*this.f0*Math.pow(h,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function mp(i){var t=i.x,e=i.y;Math.abs(2*Math.abs(e)-Math.PI)<=w&&(e=Ls(e)*(S-2*w));var s=Math.abs(Math.abs(e)-S),r,n;if(s>w)r=se(this.e,e,Math.sin(e)),n=this.a*this.f0*Math.pow(r,this.ns);else{if(s=e*this.ns,s<=0)return null;n=0}var a=this.ns*b(t-this.long0);return i.x=this.k0*(n*Math.sin(a))+this.x0,i.y=this.k0*(this.rh-n*Math.cos(a))+this.y0,i}function pp(i){var t,e,s,r,n,a=(i.x-this.x0)/this.k0,o=this.rh-(i.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(a*a+o*o),e=1):(t=-Math.sqrt(a*a+o*o),e=-1);var l=0;if(t!==0&&(l=Math.atan2(e*a,e*o)),t!==0||this.ns>0){if(e=1/this.ns,s=Math.pow(t/(this.a*this.f0),e),r=Ts(this.e,s),r===-9999)return null}else r=-S;return n=b(l/this.ns+this.long0),i.x=n,i.y=r,i}var yp=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc"],vp={init:gp,forward:mp,inverse:pp,names:yp};function _p(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function Sp(i){var t,e,s,r,n,a,o,l=i.x,h=i.y,c=b(l-this.long0);return t=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),e=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/t)-this.s45),s=-c*this.alfa,r=Math.asin(Math.cos(this.ad)*Math.sin(e)+Math.sin(this.ad)*Math.cos(e)*Math.cos(s)),n=Math.asin(Math.cos(e)*Math.sin(s)/Math.cos(r)),a=this.n*n,o=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(r/2+this.s45),this.n),i.y=o*Math.cos(a)/1,i.x=o*Math.sin(a)/1,this.czech||(i.y*=-1,i.x*=-1),i}function Mp(i){var t,e,s,r,n,a,o,l,h=i.x;i.x=i.y,i.y=h,this.czech||(i.y*=-1,i.x*=-1),a=Math.sqrt(i.x*i.x+i.y*i.y),n=Math.atan2(i.y,i.x),r=n/Math.sin(this.s0),s=2*(Math.atan(Math.pow(this.ro0/a,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(s)-Math.sin(this.ad)*Math.cos(s)*Math.cos(r)),e=Math.asin(Math.cos(s)*Math.sin(r)/Math.cos(t)),i.x=this.long0-e/this.alfa,o=t,l=0;var c=0;do i.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(t/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-i.y)<1e-10&&(l=1),o=i.y,c+=1;while(l===0&&c<15);return c>=15?null:i}var Cp=["Krovak","krovak"],wp={init:_p,forward:Sp,inverse:Mp,names:Cp};function It(i,t,e,s,r){return i*r-t*Math.sin(2*r)+e*Math.sin(4*r)-s*Math.sin(6*r)}function Fs(i){return 1-.25*i*(1+i/16*(3+1.25*i))}function Rs(i){return .375*i*(1+.25*i*(1+.46875*i))}function As(i){return .05859375*i*i*(1+.75*i)}function Gs(i){return i*i*i*(35/3072)}function Fi(i,t,e){var s=t*e;return i/Math.sqrt(1-s*s)}function Ri(i){return Math.abs(i)<S?i:i-Ls(i)*Math.PI}function Fr(i,t,e,s,r){var n,a;n=i/t;for(var o=0;o<15;o++)if(a=(i-(t*n-e*Math.sin(2*n)+s*Math.sin(4*n)-r*Math.sin(6*n)))/(t-2*e*Math.cos(2*n)+4*s*Math.cos(4*n)-6*r*Math.cos(6*n)),n+=a,Math.abs(a)<=1e-10)return n;return NaN}function xp(){this.sphere||(this.e0=Fs(this.es),this.e1=Rs(this.es),this.e2=As(this.es),this.e3=Gs(this.es),this.ml0=this.a*It(this.e0,this.e1,this.e2,this.e3,this.lat0))}function bp(i){var t,e,s=i.x,r=i.y;if(s=b(s-this.long0),this.sphere)t=this.a*Math.asin(Math.cos(r)*Math.sin(s)),e=this.a*(Math.atan2(Math.tan(r),Math.cos(s))-this.lat0);else{var n=Math.sin(r),a=Math.cos(r),o=Fi(this.a,this.e,n),l=Math.tan(r)*Math.tan(r),h=s*Math.cos(r),c=h*h,u=this.es*a*a/(1-this.es),d=this.a*It(this.e0,this.e1,this.e2,this.e3,r);t=o*h*(1-c*l*(1/6-(8-l+8*u)*c/120)),e=d-this.ml0+o*n/a*c*(.5+(5-l+6*u)*c/24)}return i.x=t+this.x0,i.y=e+this.y0,i}function Op(i){i.x-=this.x0,i.y-=this.y0;var t=i.x/this.a,e=i.y/this.a,s,r;if(this.sphere){var n=e+this.lat0;s=Math.asin(Math.sin(n)*Math.cos(t)),r=Math.atan2(Math.tan(t),Math.cos(n))}else{var a=this.ml0/this.a+e,o=Fr(a,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-S)<=w)return i.x=this.long0,i.y=S,e<0&&(i.y*=-1),i;var l=Fi(this.a,this.e,Math.sin(o)),h=l*l*l/this.a/this.a*(1-this.es),c=Math.pow(Math.tan(o),2),u=t*this.a/l,d=u*u;s=o-l*Math.tan(o)/h*u*u*(.5-(1+3*c)*u*u/24),r=u*(1-d*(c/3+(1+3*c)*c*d/15))/Math.cos(o)}return i.x=b(r+this.long0),i.y=Ri(s),i}var Pp=["Cassini","Cassini_Soldner","cass"],Ep={init:xp,forward:bp,inverse:Op,names:Pp};function $e(i,t){var e;return i>1e-7?(e=i*t,(1-i*i)*(t/(1-e*e)-.5/i*Math.log((1-e)/(1+e)))):2*t}var Ip=1,Lp=2,Tp=3,Np=4;function Dp(){var i=Math.abs(this.lat0);if(Math.abs(i-S)<w?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(i)<w?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var t;switch(this.qp=$e(this.e,1),this.mmf=.5/(1-this.es),this.apa=Hp(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=$e(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Fp(i){var t,e,s,r,n,a,o,l,h,c,u=i.x,d=i.y;if(u=b(u-this.long0),this.sphere){if(n=Math.sin(d),c=Math.cos(d),s=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(e=this.mode===this.EQUIT?1+c*s:1+this.sinph0*n+this.cosph0*c*s,e<=w)return null;e=Math.sqrt(2/e),t=e*c*Math.sin(u),e*=this.mode===this.EQUIT?n:this.cosph0*n-this.sinph0*c*s}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(s=-s),Math.abs(d+this.lat0)<w)return null;e=j-d*.5,e=2*(this.mode===this.S_POLE?Math.cos(e):Math.sin(e)),t=e*Math.sin(u),e*=s}}else{switch(o=0,l=0,h=0,s=Math.cos(u),r=Math.sin(u),n=Math.sin(d),a=$e(this.e,n),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(o=a/this.qp,l=Math.sqrt(1-o*o)),this.mode){case this.OBLIQ:h=1+this.sinb1*o+this.cosb1*l*s;break;case this.EQUIT:h=1+l*s;break;case this.N_POLE:h=S+d,a=this.qp-a;break;case this.S_POLE:h=d-S,a=this.qp+a;break}if(Math.abs(h)<w)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:h=Math.sqrt(2/h),this.mode===this.OBLIQ?e=this.ymf*h*(this.cosb1*o-this.sinb1*l*s):e=(h=Math.sqrt(2/(1+l*s)))*o*this.ymf,t=this.xmf*h*l*r;break;case this.N_POLE:case this.S_POLE:a>=0?(t=(h=Math.sqrt(a))*r,e=s*(this.mode===this.S_POLE?h:-h)):t=e=0;break}}return i.x=this.a*t+this.x0,i.y=this.a*e+this.y0,i}function Rp(i){i.x-=this.x0,i.y-=this.y0;var t=i.x/this.a,e=i.y/this.a,s,r,n,a,o,l,h;if(this.sphere){var c=0,u,d=0;if(u=Math.sqrt(t*t+e*e),r=u*.5,r>1)return null;switch(r=2*Math.asin(r),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(d=Math.sin(r),c=Math.cos(r)),this.mode){case this.EQUIT:r=Math.abs(u)<=w?0:Math.asin(e*d/u),t*=d,e=c*u;break;case this.OBLIQ:r=Math.abs(u)<=w?this.lat0:Math.asin(c*this.sinph0+e*d*this.cosph0/u),t*=d*this.cosph0,e=(c-Math.sin(r)*this.sinph0)*u;break;case this.N_POLE:e=-e,r=S-r;break;case this.S_POLE:r-=S;break}s=e===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,e)}else{if(h=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,e*=this.dd,l=Math.sqrt(t*t+e*e),l<w)return i.x=this.long0,i.y=this.lat0,i;a=2*Math.asin(.5*l/this.rq),n=Math.cos(a),t*=a=Math.sin(a),this.mode===this.OBLIQ?(h=n*this.sinb1+e*a*this.cosb1/l,o=this.qp*h,e=l*this.cosb1*n-e*this.sinb1*a):(h=e*a/l,o=this.qp*h,e=l*n)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(e=-e),o=t*t+e*e,!o)return i.x=this.long0,i.y=this.lat0,i;h=1-o/this.qp,this.mode===this.S_POLE&&(h=-h)}s=Math.atan2(t,e),r=Vp(Math.asin(h),this.apa)}return i.x=b(this.long0+s),i.y=r,i}var Ap=.3333333333333333,Gp=.17222222222222222,kp=.10257936507936508,zp=.06388888888888888,jp=.0664021164021164,$p=.016415012942191543;function Hp(i){var t,e=[];return e[0]=i*Ap,t=i*i,e[0]+=t*Gp,e[1]=t*zp,t*=i,e[0]+=t*kp,e[1]+=t*jp,e[2]=t*$p,e}function Vp(i,t){var e=i+i;return i+t[0]*Math.sin(e)+t[1]*Math.sin(e+e)+t[2]*Math.sin(e+e+e)}var Bp=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Up={init:Dp,forward:Fp,inverse:Rp,names:Bp,S_POLE:Ip,N_POLE:Lp,EQUIT:Tp,OBLIQ:Np};function He(i){return Math.abs(i)>1&&(i=i>1?1:-1),Math.asin(i)}function qp(){Math.abs(this.lat1+this.lat2)<w||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=ue(this.e3,this.sin_po,this.cos_po),this.qs1=$e(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=ue(this.e3,this.sin_po,this.cos_po),this.qs2=$e(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=$e(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>w?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Wp(i){var t=i.x,e=i.y;this.sin_phi=Math.sin(e),this.cos_phi=Math.cos(e);var s=$e(this.e3,this.sin_phi,this.cos_phi),r=this.a*Math.sqrt(this.c-this.ns0*s)/this.ns0,n=this.ns0*b(t-this.long0),a=r*Math.sin(n)+this.x0,o=this.rh-r*Math.cos(n)+this.y0;return i.x=a,i.y=o,i}function Yp(i){var t,e,s,r,n,a;return i.x-=this.x0,i.y=this.rh-i.y+this.y0,this.ns0>=0?(t=Math.sqrt(i.x*i.x+i.y*i.y),s=1):(t=-Math.sqrt(i.x*i.x+i.y*i.y),s=-1),r=0,t!==0&&(r=Math.atan2(s*i.x,s*i.y)),s=t*this.ns0/this.a,this.sphere?a=Math.asin((this.c-s*s)/(2*this.ns0)):(e=(this.c-s*s)/this.ns0,a=this.phi1z(this.e3,e)),n=b(r/this.ns0+this.long0),i.x=n,i.y=a,i}function Xp(i,t){var e,s,r,n,a,o=He(.5*t);if(i<w)return o;for(var l=i*i,h=1;h<=25;h++)if(e=Math.sin(o),s=Math.cos(o),r=i*e,n=1-r*r,a=.5*n*n/s*(t/(1-l)-e/n+.5/i*Math.log((1-r)/(1+r))),o=o+a,Math.abs(a)<=1e-7)return o;return null}var Zp=["Albers_Conic_Equal_Area","Albers","aea"],Jp={init:qp,forward:Wp,inverse:Yp,names:Zp,phi1z:Xp};function Kp(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function Qp(i){var t,e,s,r,n,a,o,l,h=i.x,c=i.y;return s=b(h-this.long0),t=Math.sin(c),e=Math.cos(c),r=Math.cos(s),a=this.sin_p14*t+this.cos_p14*e*r,n=1,a>0||Math.abs(a)<=w?(o=this.x0+this.a*n*e*Math.sin(s)/a,l=this.y0+this.a*n*(this.cos_p14*t-this.sin_p14*e*r)/a):(o=this.x0+this.infinity_dist*e*Math.sin(s),l=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*e*r)),i.x=o,i.y=l,i}function ty(i){var t,e,s,r,n,a;return i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,i.x/=this.k0,i.y/=this.k0,(t=Math.sqrt(i.x*i.x+i.y*i.y))?(r=Math.atan2(t,this.rc),e=Math.sin(r),s=Math.cos(r),a=He(s*this.sin_p14+i.y*e*this.cos_p14/t),n=Math.atan2(i.x*e,t*this.cos_p14*s-i.y*this.sin_p14*e),n=b(this.long0+n)):(a=this.phic0,n=0),i.x=n,i.y=a,i}var ey=["gnom"],iy={init:Kp,forward:Qp,inverse:ty,names:ey};function sy(i,t){var e=1-(1-i*i)/(2*i)*Math.log((1-i)/(1+i));if(Math.abs(Math.abs(t)-e)<1e-6)return t<0?-1*S:S;for(var s=Math.asin(.5*t),r,n,a,o,l=0;l<30;l++)if(n=Math.sin(s),a=Math.cos(s),o=i*n,r=Math.pow(1-o*o,2)/(2*a)*(t/(1-i*i)-n/(1-o*o)+.5/i*Math.log((1-o)/(1+o))),s+=r,Math.abs(r)<=1e-10)return s;return NaN}function ry(){this.sphere||(this.k0=ue(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function ny(i){var t=i.x,e=i.y,s,r,n=b(t-this.long0);if(this.sphere)s=this.x0+this.a*n*Math.cos(this.lat_ts),r=this.y0+this.a*Math.sin(e)/Math.cos(this.lat_ts);else{var a=$e(this.e,Math.sin(e));s=this.x0+this.a*this.k0*n,r=this.y0+this.a*a*.5/this.k0}return i.x=s,i.y=r,i}function ay(i){i.x-=this.x0,i.y-=this.y0;var t,e;return this.sphere?(t=b(this.long0+i.x/this.a/Math.cos(this.lat_ts)),e=Math.asin(i.y/this.a*Math.cos(this.lat_ts))):(e=sy(this.e,2*i.y*this.k0/this.a),t=b(this.long0+i.x/(this.a*this.k0))),i.x=t,i.y=e,i}var oy=["cea"],ly={init:ry,forward:ny,inverse:ay,names:oy};function hy(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function cy(i){var t=i.x,e=i.y,s=b(t-this.long0),r=Ri(e-this.lat0);return i.x=this.x0+this.a*s*this.rc,i.y=this.y0+this.a*r,i}function uy(i){var t=i.x,e=i.y;return i.x=b(this.long0+(t-this.x0)/(this.a*this.rc)),i.y=Ri(this.lat0+(e-this.y0)/this.a),i}var dy=["Equirectangular","Equidistant_Cylindrical","eqc"],fy={init:hy,forward:cy,inverse:uy,names:dy},ih=20;function gy(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Fs(this.es),this.e1=Rs(this.es),this.e2=As(this.es),this.e3=Gs(this.es),this.ml0=this.a*It(this.e0,this.e1,this.e2,this.e3,this.lat0)}function my(i){var t=i.x,e=i.y,s,r,n,a=b(t-this.long0);if(n=a*Math.sin(e),this.sphere)Math.abs(e)<=w?(s=this.a*a,r=-1*this.a*this.lat0):(s=this.a*Math.sin(n)/Math.tan(e),r=this.a*(Ri(e-this.lat0)+(1-Math.cos(n))/Math.tan(e)));else if(Math.abs(e)<=w)s=this.a*a,r=-1*this.ml0;else{var o=Fi(this.a,this.e,Math.sin(e))/Math.tan(e);s=o*Math.sin(n),r=this.a*It(this.e0,this.e1,this.e2,this.e3,e)-this.ml0+o*(1-Math.cos(n))}return i.x=s+this.x0,i.y=r+this.y0,i}function py(i){var t,e,s,r,n,a,o,l,h;if(s=i.x-this.x0,r=i.y-this.y0,this.sphere)if(Math.abs(r+this.a*this.lat0)<=w)t=b(s/this.a+this.long0),e=0;else{a=this.lat0+r/this.a,o=s*s/this.a/this.a+a*a,l=a;var c;for(n=ih;n;--n)if(c=Math.tan(l),h=-1*(a*(l*c+1)-l-.5*(l*l+o)*c)/((l-a)/c-1),l+=h,Math.abs(h)<=w){e=l;break}t=b(this.long0+Math.asin(s*Math.tan(l)/this.a)/Math.sin(e))}else if(Math.abs(r+this.ml0)<=w)e=0,t=b(this.long0+s/this.a);else{a=(this.ml0+r)/this.a,o=s*s/this.a/this.a+a*a,l=a;var u,d,f,g,m;for(n=ih;n;--n)if(m=this.e*Math.sin(l),u=Math.sqrt(1-m*m)*Math.tan(l),d=this.a*It(this.e0,this.e1,this.e2,this.e3,l),f=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),g=d/this.a,h=(a*(u*g+1)-g-.5*u*(g*g+o))/(this.es*Math.sin(2*l)*(g*g+o-2*a*g)/(4*u)+(a-g)*(u*f-2/Math.sin(2*l))-f),l-=h,Math.abs(h)<=w){e=l;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(e),2))*Math.tan(e),t=b(this.long0+Math.asin(s*u/this.a)/Math.sin(e))}return i.x=t,i.y=e,i}var yy=["Polyconic","poly"],vy={init:gy,forward:my,inverse:py,names:yy};function _y(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function Sy(i){var t,e=i.x,s=i.y,r=s-this.lat0,n=e-this.long0,a=r/Ps*1e-5,o=n,l=1,h=0;for(t=1;t<=10;t++)l=l*a,h=h+this.A[t]*l;var c=h,u=o,d=1,f=0,g,m,p=0,y=0;for(t=1;t<=6;t++)g=d*c-f*u,m=f*c+d*u,d=g,f=m,p=p+this.B_re[t]*d-this.B_im[t]*f,y=y+this.B_im[t]*d+this.B_re[t]*f;return i.x=y*this.a+this.x0,i.y=p*this.a+this.y0,i}function My(i){var t,e=i.x,s=i.y,r=e-this.x0,n=s-this.y0,a=n/this.a,o=r/this.a,l=1,h=0,c,u,d=0,f=0;for(t=1;t<=6;t++)c=l*a-h*o,u=h*a+l*o,l=c,h=u,d=d+this.C_re[t]*l-this.C_im[t]*h,f=f+this.C_im[t]*l+this.C_re[t]*h;for(var g=0;g<this.iterations;g++){var m=d,p=f,y,M,x=a,L=o;for(t=2;t<=6;t++)y=m*d-p*f,M=p*d+m*f,m=y,p=M,x=x+(t-1)*(this.B_re[t]*m-this.B_im[t]*p),L=L+(t-1)*(this.B_im[t]*m+this.B_re[t]*p);m=1,p=0;var I=this.B_re[1],D=this.B_im[1];for(t=2;t<=6;t++)y=m*d-p*f,M=p*d+m*f,m=y,p=M,I=I+t*(this.B_re[t]*m-this.B_im[t]*p),D=D+t*(this.B_im[t]*m+this.B_re[t]*p);var Y=I*I+D*D;d=(x*I+L*D)/Y,f=(L*I-x*D)/Y}var H=d,wt=f,$t=1,Me=0;for(t=1;t<=9;t++)$t=$t*H,Me=Me+this.D[t]*$t;var dr=this.lat0+Me*Ps*1e5,nd=this.long0+wt;return i.x=nd,i.y=dr,i}var Cy=["New_Zealand_Map_Grid","nzmg"],wy={init:_y,forward:Sy,inverse:My,names:Cy};function xy(){}function by(i){var t=i.x,e=i.y,s=b(t-this.long0),r=this.x0+this.a*s,n=this.y0+this.a*Math.log(Math.tan(Math.PI/4+e/2.5))*1.25;return i.x=r,i.y=n,i}function Oy(i){i.x-=this.x0,i.y-=this.y0;var t=b(this.long0+i.x/this.a),e=2.5*(Math.atan(Math.exp(.8*i.y/this.a))-Math.PI/4);return i.x=t,i.y=e,i}var Py=["Miller_Cylindrical","mill"],Ey={init:xy,forward:by,inverse:Oy,names:Py},Iy=20;function Ly(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Kl(this.es)}function Ty(i){var t,e,s=i.x,r=i.y;if(s=b(s-this.long0),this.sphere){if(!this.m)r=this.n!==1?Math.asin(this.n*Math.sin(r)):r;else for(var n=this.n*Math.sin(r),a=Iy;a;--a){var o=(this.m*r+Math.sin(r)-n)/(this.m+Math.cos(r));if(r-=o,Math.abs(o)<w)break}t=this.a*this.C_x*s*(this.m+Math.cos(r)),e=this.a*this.C_y*r}else{var l=Math.sin(r),h=Math.cos(r);e=this.a*Lr(r,l,h,this.en),t=this.a*s*h/Math.sqrt(1-this.es*l*l)}return i.x=t,i.y=e,i}function Ny(i){var t,e,s,r;return i.x-=this.x0,s=i.x/this.a,i.y-=this.y0,t=i.y/this.a,this.sphere?(t/=this.C_y,s=s/(this.C_x*(this.m+Math.cos(t))),this.m?t=He((this.m*t+Math.sin(t))/this.n):this.n!==1&&(t=He(Math.sin(t)/this.n)),s=b(s+this.long0),t=Ri(t)):(t=Ql(i.y/this.a,this.es,this.en),r=Math.abs(t),r<S?(r=Math.sin(t),e=this.long0+i.x*Math.sqrt(1-this.es*r*r)/(this.a*Math.cos(t)),s=b(e)):r-w<S&&(s=this.long0)),i.x=s,i.y=t,i}var Dy=["Sinusoidal","sinu"],Fy={init:Ly,forward:Ty,inverse:Ny,names:Dy};function Ry(){}function Ay(i){for(var t=i.x,e=i.y,s=b(t-this.long0),r=e,n=Math.PI*Math.sin(e);;){var a=-(r+Math.sin(r)-n)/(1+Math.cos(r));if(r+=a,Math.abs(a)<w)break}r/=2,Math.PI/2-Math.abs(e)<w&&(s=0);var o=.900316316158*this.a*s*Math.cos(r)+this.x0,l=1.4142135623731*this.a*Math.sin(r)+this.y0;return i.x=o,i.y=l,i}function Gy(i){var t,e;i.x-=this.x0,i.y-=this.y0,e=i.y/(1.4142135623731*this.a),Math.abs(e)>.999999999999&&(e=.999999999999),t=Math.asin(e);var s=b(this.long0+i.x/(.900316316158*this.a*Math.cos(t)));s<-Math.PI&&(s=-Math.PI),s>Math.PI&&(s=Math.PI),e=(2*t+Math.sin(2*t))/Math.PI,Math.abs(e)>1&&(e=1);var r=Math.asin(e);return i.x=s,i.y=r,i}var ky=["Mollweide","moll"],zy={init:Ry,forward:Ay,inverse:Gy,names:ky};function jy(){Math.abs(this.lat1+this.lat2)<w||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Fs(this.es),this.e1=Rs(this.es),this.e2=As(this.es),this.e3=Gs(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=ue(this.e,this.sinphi,this.cosphi),this.ml1=It(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<w?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=ue(this.e,this.sinphi,this.cosphi),this.ml2=It(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=It(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function $y(i){var t=i.x,e=i.y,s;if(this.sphere)s=this.a*(this.g-e);else{var r=It(this.e0,this.e1,this.e2,this.e3,e);s=this.a*(this.g-r)}var n=this.ns*b(t-this.long0),a=this.x0+s*Math.sin(n),o=this.y0+this.rh-s*Math.cos(n);return i.x=a,i.y=o,i}function Hy(i){i.x-=this.x0,i.y=this.rh-i.y+this.y0;var t,e,s,r;this.ns>=0?(e=Math.sqrt(i.x*i.x+i.y*i.y),t=1):(e=-Math.sqrt(i.x*i.x+i.y*i.y),t=-1);var n=0;if(e!==0&&(n=Math.atan2(t*i.x,t*i.y)),this.sphere)return r=b(this.long0+n/this.ns),s=Ri(this.g-e/this.a),i.x=r,i.y=s,i;var a=this.g-e/this.a;return s=Fr(a,this.e0,this.e1,this.e2,this.e3),r=b(this.long0+n/this.ns),i.x=r,i.y=s,i}var Vy=["Equidistant_Conic","eqdc"],By={init:jy,forward:$y,inverse:Hy,names:Vy};function Uy(){this.R=this.a}function qy(i){var t=i.x,e=i.y,s=b(t-this.long0),r,n;Math.abs(e)<=w&&(r=this.x0+this.R*s,n=this.y0);var a=He(2*Math.abs(e/Math.PI));(Math.abs(s)<=w||Math.abs(Math.abs(e)-S)<=w)&&(r=this.x0,e>=0?n=this.y0+Math.PI*this.R*Math.tan(.5*a):n=this.y0+Math.PI*this.R*-Math.tan(.5*a));var o=.5*Math.abs(Math.PI/s-s/Math.PI),l=o*o,h=Math.sin(a),c=Math.cos(a),u=c/(h+c-1),d=u*u,f=u*(2/h-1),g=f*f,m=Math.PI*this.R*(o*(u-g)+Math.sqrt(l*(u-g)*(u-g)-(g+l)*(d-g)))/(g+l);s<0&&(m=-m),r=this.x0+m;var p=l+u;return m=Math.PI*this.R*(f*p-o*Math.sqrt((g+l)*(l+1)-p*p))/(g+l),e>=0?n=this.y0+m:n=this.y0-m,i.x=r,i.y=n,i}function Wy(i){var t,e,s,r,n,a,o,l,h,c,u,d,f;return i.x-=this.x0,i.y-=this.y0,u=Math.PI*this.R,s=i.x/u,r=i.y/u,n=s*s+r*r,a=-Math.abs(r)*(1+n),o=a-2*r*r+s*s,l=-2*a+1+2*r*r+n*n,f=r*r/l+(2*o*o*o/l/l/l-9*a*o/l/l)/27,h=(a-o*o/3/l)/l,c=2*Math.sqrt(-h/3),u=3*f/h/c,Math.abs(u)>1&&(u>=0?u=1:u=-1),d=Math.acos(u)/3,i.y>=0?e=(-c*Math.cos(d+Math.PI/3)-o/3/l)*Math.PI:e=-(-c*Math.cos(d+Math.PI/3)-o/3/l)*Math.PI,Math.abs(s)<w?t=this.long0:t=b(this.long0+Math.PI*(n-1+Math.sqrt(1+2*(s*s-r*r)+n*n))/2/s),i.x=t,i.y=e,i}var Yy=["Van_der_Grinten_I","VanDerGrinten","vandg"],Xy={init:Uy,forward:qy,inverse:Wy,names:Yy};function Zy(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function Jy(i){var t=i.x,e=i.y,s=Math.sin(i.y),r=Math.cos(i.y),n=b(t-this.long0),a,o,l,h,c,u,d,f,g,m,p,y,M,x,L,I,D,Y,H,wt,$t,Me,dr;return this.sphere?Math.abs(this.sin_p12-1)<=w?(i.x=this.x0+this.a*(S-e)*Math.sin(n),i.y=this.y0-this.a*(S-e)*Math.cos(n),i):Math.abs(this.sin_p12+1)<=w?(i.x=this.x0+this.a*(S+e)*Math.sin(n),i.y=this.y0+this.a*(S+e)*Math.cos(n),i):(Y=this.sin_p12*s+this.cos_p12*r*Math.cos(n),I=Math.acos(Y),D=I?I/Math.sin(I):1,i.x=this.x0+this.a*D*r*Math.sin(n),i.y=this.y0+this.a*D*(this.cos_p12*s-this.sin_p12*r*Math.cos(n)),i):(a=Fs(this.es),o=Rs(this.es),l=As(this.es),h=Gs(this.es),Math.abs(this.sin_p12-1)<=w?(c=this.a*It(a,o,l,h,S),u=this.a*It(a,o,l,h,e),i.x=this.x0+(c-u)*Math.sin(n),i.y=this.y0-(c-u)*Math.cos(n),i):Math.abs(this.sin_p12+1)<=w?(c=this.a*It(a,o,l,h,S),u=this.a*It(a,o,l,h,e),i.x=this.x0+(c+u)*Math.sin(n),i.y=this.y0+(c+u)*Math.cos(n),i):(d=s/r,f=Fi(this.a,this.e,this.sin_p12),g=Fi(this.a,this.e,s),m=Math.atan((1-this.es)*d+this.es*f*this.sin_p12/(g*r)),p=Math.atan2(Math.sin(n),this.cos_p12*Math.tan(m)-this.sin_p12*Math.cos(n)),p===0?H=Math.asin(this.cos_p12*Math.sin(m)-this.sin_p12*Math.cos(m)):Math.abs(Math.abs(p)-Math.PI)<=w?H=-Math.asin(this.cos_p12*Math.sin(m)-this.sin_p12*Math.cos(m)):H=Math.asin(Math.sin(n)*Math.cos(m)/Math.sin(p)),y=this.e*this.sin_p12/Math.sqrt(1-this.es),M=this.e*this.cos_p12*Math.cos(p)/Math.sqrt(1-this.es),x=y*M,L=M*M,wt=H*H,$t=wt*H,Me=$t*H,dr=Me*H,I=f*H*(1-wt*L*(1-L)/6+$t/8*x*(1-2*L)+Me/120*(L*(4-7*L)-3*y*y*(1-7*L))-dr/48*x),i.x=this.x0+I*Math.sin(p),i.y=this.y0+I*Math.cos(p),i))}function Ky(i){i.x-=this.x0,i.y-=this.y0;var t,e,s,r,n,a,o,l,h,c,u,d,f,g,m,p,y,M,x,L,I,D,Y,H;return this.sphere?(t=Math.sqrt(i.x*i.x+i.y*i.y),t>2*S*this.a?void 0:(e=t/this.a,s=Math.sin(e),r=Math.cos(e),n=this.long0,Math.abs(t)<=w?a=this.lat0:(a=He(r*this.sin_p12+i.y*s*this.cos_p12/t),o=Math.abs(this.lat0)-S,Math.abs(o)<=w?this.lat0>=0?n=b(this.long0+Math.atan2(i.x,-i.y)):n=b(this.long0-Math.atan2(-i.x,i.y)):n=b(this.long0+Math.atan2(i.x*s,t*this.cos_p12*r-i.y*this.sin_p12*s))),i.x=n,i.y=a,i)):(l=Fs(this.es),h=Rs(this.es),c=As(this.es),u=Gs(this.es),Math.abs(this.sin_p12-1)<=w?(d=this.a*It(l,h,c,u,S),t=Math.sqrt(i.x*i.x+i.y*i.y),f=d-t,a=Fr(f/this.a,l,h,c,u),n=b(this.long0+Math.atan2(i.x,-1*i.y)),i.x=n,i.y=a,i):Math.abs(this.sin_p12+1)<=w?(d=this.a*It(l,h,c,u,S),t=Math.sqrt(i.x*i.x+i.y*i.y),f=t-d,a=Fr(f/this.a,l,h,c,u),n=b(this.long0+Math.atan2(i.x,i.y)),i.x=n,i.y=a,i):(t=Math.sqrt(i.x*i.x+i.y*i.y),p=Math.atan2(i.x,i.y),g=Fi(this.a,this.e,this.sin_p12),y=Math.cos(p),M=this.e*this.cos_p12*y,x=-M*M/(1-this.es),L=3*this.es*(1-x)*this.sin_p12*this.cos_p12*y/(1-this.es),I=t/g,D=I-x*(1+x)*Math.pow(I,3)/6-L*(1+3*x)*Math.pow(I,4)/24,Y=1-x*D*D/2-I*D*D*D/6,m=Math.asin(this.sin_p12*Math.cos(D)+this.cos_p12*Math.sin(D)*y),n=b(this.long0+Math.asin(Math.sin(p)*Math.sin(D)/Math.cos(m))),H=Math.sin(m),a=Math.atan2((H-this.es*Y*this.sin_p12)*Math.tan(m),H*(1-this.es)),i.x=n,i.y=a,i))}var Qy=["Azimuthal_Equidistant","aeqd"],t0={init:Zy,forward:Jy,inverse:Ky,names:Qy};function e0(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function i0(i){var t,e,s,r,n,a,o,l,h=i.x,c=i.y;return s=b(h-this.long0),t=Math.sin(c),e=Math.cos(c),r=Math.cos(s),a=this.sin_p14*t+this.cos_p14*e*r,n=1,(a>0||Math.abs(a)<=w)&&(o=this.a*n*e*Math.sin(s),l=this.y0+this.a*n*(this.cos_p14*t-this.sin_p14*e*r)),i.x=o,i.y=l,i}function s0(i){var t,e,s,r,n,a,o;return i.x-=this.x0,i.y-=this.y0,t=Math.sqrt(i.x*i.x+i.y*i.y),e=He(t/this.a),s=Math.sin(e),r=Math.cos(e),a=this.long0,Math.abs(t)<=w?(o=this.lat0,i.x=a,i.y=o,i):(o=He(r*this.sin_p14+i.y*s*this.cos_p14/t),n=Math.abs(this.lat0)-S,Math.abs(n)<=w?(this.lat0>=0?a=b(this.long0+Math.atan2(i.x,-i.y)):a=b(this.long0-Math.atan2(-i.x,i.y)),i.x=a,i.y=o,i):(a=b(this.long0+Math.atan2(i.x*s,t*this.cos_p14*r-i.y*this.sin_p14*s)),i.x=a,i.y=o,i))}var r0=["ortho"],n0={init:e0,forward:i0,inverse:s0,names:r0},J={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},$={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function a0(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=S-j/2?this.face=J.TOP:this.lat0<=-(S-j/2)?this.face=J.BOTTOM:Math.abs(this.long0)<=j?this.face=J.FRONT:Math.abs(this.long0)<=S+j?this.face=this.long0>0?J.RIGHT:J.LEFT:this.face=J.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function o0(i){var t={x:0,y:0},e,s,r,n,a,o,l={value:0};if(i.x-=this.long0,this.es!==0?e=Math.atan(this.one_minus_f_squared*Math.tan(i.y)):e=i.y,s=i.x,this.face===J.TOP)n=S-e,s>=j&&s<=S+j?(l.value=$.AREA_0,r=s-S):s>S+j||s<=-(S+j)?(l.value=$.AREA_1,r=s>0?s-nt:s+nt):s>-(S+j)&&s<=-j?(l.value=$.AREA_2,r=s+S):(l.value=$.AREA_3,r=s);else if(this.face===J.BOTTOM)n=S+e,s>=j&&s<=S+j?(l.value=$.AREA_0,r=-s+S):s<j&&s>=-j?(l.value=$.AREA_1,r=-s):s<-j&&s>=-(S+j)?(l.value=$.AREA_2,r=-s-S):(l.value=$.AREA_3,r=s>0?-s+nt:-s-nt);else{var h,c,u,d,f,g,m;this.face===J.RIGHT?s=Ai(s,+S):this.face===J.BACK?s=Ai(s,+nt):this.face===J.LEFT&&(s=Ai(s,-S)),d=Math.sin(e),f=Math.cos(e),g=Math.sin(s),m=Math.cos(s),h=f*m,c=f*g,u=d,this.face===J.FRONT?(n=Math.acos(h),r=Rr(n,u,c,l)):this.face===J.RIGHT?(n=Math.acos(c),r=Rr(n,u,-h,l)):this.face===J.BACK?(n=Math.acos(-h),r=Rr(n,u,-c,l)):this.face===J.LEFT?(n=Math.acos(-c),r=Rr(n,u,h,l)):(n=r=0,l.value=$.AREA_0)}return o=Math.atan(12/nt*(r+Math.acos(Math.sin(r)*Math.cos(j))-S)),a=Math.sqrt((1-Math.cos(n))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(r))))),l.value===$.AREA_1?o+=S:l.value===$.AREA_2?o+=nt:l.value===$.AREA_3&&(o+=1.5*nt),t.x=a*Math.cos(o),t.y=a*Math.sin(o),t.x=t.x*this.a+this.x0,t.y=t.y*this.a+this.y0,i.x=t.x,i.y=t.y,i}function l0(i){var t={lam:0,phi:0},e,s,r,n,a,o,l,h,c,u={value:0};if(i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,s=Math.atan(Math.sqrt(i.x*i.x+i.y*i.y)),e=Math.atan2(i.y,i.x),i.x>=0&&i.x>=Math.abs(i.y)?u.value=$.AREA_0:i.y>=0&&i.y>=Math.abs(i.x)?(u.value=$.AREA_1,e-=S):i.x<0&&-i.x>=Math.abs(i.y)?(u.value=$.AREA_2,e=e<0?e+nt:e-nt):(u.value=$.AREA_3,e+=S),c=nt/12*Math.tan(e),a=Math.sin(c)/(Math.cos(c)-1/Math.sqrt(2)),o=Math.atan(a),r=Math.cos(e),n=Math.tan(s),l=1-r*r*n*n*(1-Math.cos(Math.atan(1/Math.cos(o)))),l<-1?l=-1:l>1&&(l=1),this.face===J.TOP)h=Math.acos(l),t.phi=S-h,u.value===$.AREA_0?t.lam=o+S:u.value===$.AREA_1?t.lam=o<0?o+nt:o-nt:u.value===$.AREA_2?t.lam=o-S:t.lam=o;else if(this.face===J.BOTTOM)h=Math.acos(l),t.phi=h-S,u.value===$.AREA_0?t.lam=-o+S:u.value===$.AREA_1?t.lam=-o:u.value===$.AREA_2?t.lam=-o-S:t.lam=o<0?-o-nt:-o+nt;else{var d,f,g;d=l,c=d*d,c>=1?g=0:g=Math.sqrt(1-c)*Math.sin(o),c+=g*g,c>=1?f=0:f=Math.sqrt(1-c),u.value===$.AREA_1?(c=f,f=-g,g=c):u.value===$.AREA_2?(f=-f,g=-g):u.value===$.AREA_3&&(c=f,f=g,g=-c),this.face===J.RIGHT?(c=d,d=-f,f=c):this.face===J.BACK?(d=-d,f=-f):this.face===J.LEFT&&(c=d,d=f,f=-c),t.phi=Math.acos(-g)-S,t.lam=Math.atan2(f,d),this.face===J.RIGHT?t.lam=Ai(t.lam,-S):this.face===J.BACK?t.lam=Ai(t.lam,-nt):this.face===J.LEFT&&(t.lam=Ai(t.lam,+S))}if(this.es!==0){var m,p,y;m=t.phi<0?1:0,p=Math.tan(t.phi),y=this.b/Math.sqrt(p*p+this.one_minus_f_squared),t.phi=Math.atan(Math.sqrt(this.a*this.a-y*y)/(this.one_minus_f*y)),m&&(t.phi=-t.phi)}return t.lam+=this.long0,i.x=t.lam,i.y=t.phi,i}function Rr(i,t,e,s){var r;return i<w?(s.value=$.AREA_0,r=0):(r=Math.atan2(t,e),Math.abs(r)<=j?s.value=$.AREA_0:r>j&&r<=S+j?(s.value=$.AREA_1,r-=S):r>S+j||r<=-(S+j)?(s.value=$.AREA_2,r=r>=0?r-nt:r+nt):(s.value=$.AREA_3,r+=S)),r}function Ai(i,t){var e=i+t;return e<-nt?e+=Es:e>+nt&&(e-=Es),e}var h0=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],c0={init:a0,forward:o0,inverse:l0,names:h0},ca=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],ks=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],sh=.8487,rh=1.3523,nh=ce/5,u0=1/nh,Gi=18,Ar=function(i,t){return i[0]+t*(i[1]+t*(i[2]+t*i[3]))},d0=function(i,t){return i[1]+t*(2*i[2]+t*3*i[3])};function f0(i,t,e,s){for(var r=t;s;--s){var n=i(r);if(r-=n,Math.abs(n)<e)break}return r}function g0(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function m0(i){var t=b(i.x-this.long0),e=Math.abs(i.y),s=Math.floor(e*nh);s<0?s=0:s>=Gi&&(s=Gi-1),e=ce*(e-u0*s);var r={x:Ar(ca[s],e)*t,y:Ar(ks[s],e)};return i.y<0&&(r.y=-r.y),r.x=r.x*this.a*sh+this.x0,r.y=r.y*this.a*rh+this.y0,r}function p0(i){var t={x:(i.x-this.x0)/(this.a*sh),y:Math.abs(i.y-this.y0)/(this.a*rh)};if(t.y>=1)t.x/=ca[Gi][0],t.y=i.y<0?-S:S;else{var e=Math.floor(t.y*Gi);for(e<0?e=0:e>=Gi&&(e=Gi-1);;)if(ks[e][0]>t.y)--e;else if(ks[e+1][0]<=t.y)++e;else break;var s=ks[e],r=5*(t.y-s[0])/(ks[e+1][0]-s[0]);r=f0(function(n){return(Ar(s,n)-t.y)/d0(s,n)},r,w,100),t.x/=Ar(ca[e],r),t.y=(5*e+r)*_t,i.y<0&&(t.y=-t.y)}return t.x=b(t.x+this.long0),t}var y0=["Robinson","robin"],v0={init:g0,forward:m0,inverse:p0,names:y0};function _0(){this.name="geocent"}function S0(i){var t=Nl(i,this.es,this.a);return t}function M0(i){var t=Dl(i,this.es,this.a,this.b);return t}var C0=["Geocentric","geocentric","geocent","Geocent"],w0={init:_0,forward:S0,inverse:M0,names:C0},xt={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},zs={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function x0(){if(Object.keys(zs).forEach(function(e){if(typeof this[e]=="undefined")this[e]=zs[e].def;else{if(zs[e].num&&isNaN(this[e]))throw new Error("Invalid parameter value, must be numeric "+e+" = "+this[e]);zs[e].num&&(this[e]=parseFloat(this[e]))}zs[e].degrees&&(this[e]=this[e]*_t)}.bind(this)),Math.abs(Math.abs(this.lat0)-S)<w?this.mode=this.lat0<0?xt.S_POLE:xt.N_POLE:Math.abs(this.lat0)<w?this.mode=xt.EQUIT:(this.mode=xt.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var i=this.tilt,t=this.azi;this.cg=Math.cos(t),this.sg=Math.sin(t),this.cw=Math.cos(i),this.sw=Math.sin(i)}function b0(i){i.x-=this.long0;var t=Math.sin(i.y),e=Math.cos(i.y),s=Math.cos(i.x),r,n;switch(this.mode){case xt.OBLIQ:n=this.sinph0*t+this.cosph0*e*s;break;case xt.EQUIT:n=e*s;break;case xt.S_POLE:n=-t;break;case xt.N_POLE:n=t;break}switch(n=this.pn1/(this.p-n),r=n*e*Math.sin(i.x),this.mode){case xt.OBLIQ:n*=this.cosph0*t-this.sinph0*e*s;break;case xt.EQUIT:n*=t;break;case xt.N_POLE:n*=-(e*s);break;case xt.S_POLE:n*=e*s;break}var a,o;return a=n*this.cg+r*this.sg,o=1/(a*this.sw*this.h1+this.cw),r=(r*this.cg-n*this.sg)*this.cw*o,n=a*o,i.x=r*this.a,i.y=n*this.a,i}function O0(i){i.x/=this.a,i.y/=this.a;var t={x:i.x,y:i.y},e,s,r;r=1/(this.pn1-i.y*this.sw),e=this.pn1*i.x*r,s=this.pn1*i.y*this.cw*r,i.x=e*this.cg+s*this.sg,i.y=s*this.cg-e*this.sg;var n=Nr(i.x,i.y);if(Math.abs(n)<w)t.x=0,t.y=i.y;else{var a,o;switch(o=1-n*n*this.pfact,o=(this.p-Math.sqrt(o))/(this.pn1/n+n/this.pn1),a=Math.sqrt(1-o*o),this.mode){case xt.OBLIQ:t.y=Math.asin(a*this.sinph0+i.y*o*this.cosph0/n),i.y=(a-this.sinph0*Math.sin(t.y))*n,i.x*=o*this.cosph0;break;case xt.EQUIT:t.y=Math.asin(i.y*o/n),i.y=a*n,i.x*=o;break;case xt.N_POLE:t.y=Math.asin(a),i.y=-i.y;break;case xt.S_POLE:t.y=-Math.asin(a);break}t.x=Math.atan2(i.x,i.y)}return i.x=t.x+this.long0,i.y=t.y,i}var P0=["Tilted_Perspective","tpers"],E0={init:x0,forward:b0,inverse:O0,names:P0};function I0(i){i.Proj.projections.add(Tr),i.Proj.projections.add(Dr),i.Proj.projections.add(jm),i.Proj.projections.add(Zm),i.Proj.projections.add(ip),i.Proj.projections.add(op),i.Proj.projections.add(fp),i.Proj.projections.add(vp),i.Proj.projections.add(wp),i.Proj.projections.add(Ep),i.Proj.projections.add(Up),i.Proj.projections.add(Jp),i.Proj.projections.add(iy),i.Proj.projections.add(ly),i.Proj.projections.add(fy),i.Proj.projections.add(vy),i.Proj.projections.add(wy),i.Proj.projections.add(Ey),i.Proj.projections.add(Fy),i.Proj.projections.add(zy),i.Proj.projections.add(By),i.Proj.projections.add(Xy),i.Proj.projections.add(t0),i.Proj.projections.add(n0),i.Proj.projections.add(c0),i.Proj.projections.add(v0),i.Proj.projections.add(w0),i.Proj.projections.add(E0)}ct.defaultDatum="WGS84",ct.Proj=de,ct.WGS84=new ct.Proj("WGS84"),ct.Point=Ni,ct.toPoint=Gl,ct.defs=Et,ct.nadgrid=Hg,ct.transform=Ir,ct.mgrs=rm,ct.version="__VERSION__",I0(ct);const js=dt("EPSG:4326","EPSG:3857"),ua=dt("EPSG:3857","EPSG:4326");let da={epsg:"EPSG:4326"};function fa(i,t="EPSG:"){const e=new RegExp(`^(?:${t})?(\\d+)`,"i"),s=`${i}`.match(e);return s&&s[1]?`${t}${s[1]}`:""}function ah(i){let t=null;if(i.epsg)try{t=ct(fa(i.epsg))}catch{t=null}if(i.proj4)try{t=ct(i.proj4)}catch{t=null}return t!=null}function oh(i){const t={prefix:i.prefix};return i.epsg&&(t.epsg=fa(i.epsg,i.prefix),t.epsg&&(i.proj4&&(t.proj4=i.proj4,ct.defs(t.epsg,i.proj4),Go(ct)),i.alias&&Array.isArray(i.alias)&&(t.alias=i.alias,t.alias.forEach(e=>{ct.defs(e,ct.defs(t.epsg)),Go(ct)})))),t}function lh(i){if(v(i,{epsg:[String,Number],proj4:[String,void 0,null]}),!ah(i))throw new Error("Cannot set invalid projection options as default options");da=oh(i)}class T{static get className(){return"Projection"}constructor(t={epsg:""}){const e=oh(t);this._proj4=e.proj4,this._epsg=e.epsg,this.proj||(this._epsg=T.parseEPSGCode(da.epsg)),this._alias=e.alias,this._prefix=e.prefix}get epsg(){return this._epsg}get proj4(){return this._proj4}get proj(){return ud(this.epsg)}equals(t){return dd(this.proj,t.proj)}static transform(t,e,s){const r=dt(e.proj,t.proj),n=new Array(2);return r([s[0],s[1]],n,2),s.length>2&&n.push(s[2]),n}transformTo(t,e){return T.transform(t,this,e)}static transformCoordinates(t,e,s){const r=[];for(let n=0;n<s.length;n++)r.push(T.transform(t,e,s[n]));return r}static getTransformer(t,e){return dt(e.proj,t.proj)}transformFrom(t,e){return T.transform(this,t,e)}toJSON(){const t={type:T.className,epsg:this.epsg};return this.proj4&&(t.proj4=this.proj4),Array.isArray(this._alias)&&this._alias.length>0&&(t.alias=this._alias.slice()),this._prefix&&(t.prefix=this._prefix),t}static mercatorToWgs84(t,e){return ua(t,e?t:void 0,t.length)}static wgs84ToMercator(t,e){return js(t,e?t:void 0,t.length)}static validateOptions(t){return ah(t)}static parseEPSGCode(t,e="EPSG:"){return fa(t,e)}}function hh(){return new T(da)}const B=new T({epsg:4326}),F=new T({epsg:3857});class re{static get className(){return"VcsObject"}constructor(t){this.name=t.name||Xt(),this.properties=t.properties||{}}get className(){return this.constructor.className}getLogger(){return Pt(this.className)}toJSON(){const t={type:this.className,name:this.name};return Object.keys(this.properties).length>0&&(t.properties=_({},this.properties)),t}destroy(){this.isDestroyed=!0,this.properties={}}}function ch(i){return!i||!Array.isArray(i)||i.length!==4||!Number.isFinite(i[0])||!Number.isFinite(i[1])||!Number.isFinite(i[2])||!Number.isFinite(i[3])?!1:i[0]<=i[2]&&i[1]<=i[3]}class pt{static get className(){return"Extent"}constructor(t={}){this.projection=new T(t.projection),this.extent=t.coordinates||this.projection.proj.getExtent()}getCoordinatesInProjection(t,e){if(t.epsg===this.projection.epsg)return e?e.splice(0,4,...this.extent):this.extent.slice();const s=T.getTransformer(t,this.projection),r=e||[];return s(this.extent,r,2),r}isValid(){return ch(this.extent)}toJSON(){return{coordinates:this.extent.slice(),projection:this.projection.toJSON(),type:pt.className}}clone(){return new pt(this.toJSON())}equals(t){return this===t?!0:this.isValid()&&t.isValid()&&this.extent.every((e,s)=>e===t.extent[s])&&this.projection.equals(t.projection)}static validateOptions(t){return T.validateOptions(t.projection||{})&&ch(t.coordinates)}static get WGS_84_EXTENT(){return[-180,-90,180,90]}}function ga(i,t,e){return Math.abs(i-t)<=e}function Gr(i,t,e){const s=i-t-Math.trunc((i-t)/360)*360;return Math.abs(s)<=e}function ma(i,t,e){return i!==null&&t!==null&&i.every((s,r)=>ga(s,t[r],e))}class oe extends re{static get className(){return"ViewPoint"}constructor(t){super(t);this.cameraPosition=null,Array.isArray(t.cameraPosition)&&t.cameraPosition.length===3&&(this.cameraPosition=t.cameraPosition.map(e=>Number(e))),this.groundPosition=null,Array.isArray(t.groundPosition)&&(this.groundPosition=t.groundPosition.map(e=>Number(e))),this.distance=E(t.distance,this.cameraPosition?this.cameraPosition[2]:1e3),this.heading=E(t.heading,0),this.pitch=E(t.pitch,-90),this.roll=E(t.roll,0),this.animate=rt(t.animate,!1),this.duration=t.duration||null,this.easingFunctionName=t.easingFunctionName||null}get easingFunction(){return this.easingFunctionName?Wd[this.easingFunctionName]:null}toJSON(){return O(_({},super.toJSON()),{distance:this.distance,cameraPosition:this.cameraPosition?this.cameraPosition.slice():null,groundPosition:this.groundPosition?this.groundPosition.slice():null,heading:this.heading,pitch:this.pitch,roll:this.roll,animate:this.animate,duration:this.duration,easingFunctionName:this.easingFunctionName})}clone(){return new oe(this.toJSON())}toString(){return`ViewPoint: [Ground:${String(this.groundPosition?this.groundPosition:null)}][Camera:${String(this.cameraPosition?this.cameraPosition:null)}][Distance:${this.distance}][heading:${this.distance}][pitch:${this.distance}][roll:${this.distance}]`}static createViewPointFromExtent(t){const e=t instanceof pt?t.getCoordinatesInProjection(B):t;if(e&&e.length===4){const s=e[0],r=e[1],n=e[2],a=e[3],o=[(n-s)/2+s,(a-r)/2+r];let l=0;const h=Math.max(n-s,a-r);return h<.001?l=400:l=h*3e5,new oe({name:"viewpointFromExtend",distance:l,groundPosition:o,heading:360,pitch:-90,roll:0,animate:!0})}return null}static parseURLparameter(t){let{cameraPosition:e,groundPosition:s}=t;if(e!=null&&(e=e.split(",").map(n=>Number(n))),s!=null&&(s=s.split(",").map(n=>Number(n))),t.epsg!=null){const{epsg:n,proj4:a}=t,o=new T({epsg:n,proj4:a}),l=B;s&&(s=T.transform(l,o,s)),e&&(e=T.transform(l,o,e))}const r={cameraPosition:e,groundPosition:s,distance:Number(t.distance),pitch:Number(t.pitch),heading:Number(t.heading),roll:Number(t.roll)};return new oe(r)}isValid(){const t=this.cameraPosition&&Array.isArray(this.cameraPosition)&&this.cameraPosition.length===3&&this.cameraPosition.every(s=>Number.isFinite(s));return!(!(this.groundPosition&&Array.isArray(this.groundPosition)&&this.groundPosition.length>1&&this.groundPosition.length<4&&this.groundPosition.every(s=>Number.isFinite(s)))&&!t||!t&&!Number.isFinite(this.distance)||!Number.isFinite(this.heading)||!Number.isFinite(this.pitch)||!Number.isFinite(this.roll))}equals(t,e=0){return t===this||t!==null&&ga(t.distance,this.distance,e)&&Gr(t.heading,this.heading,e)&&Gr(t.pitch,this.pitch,e)&&Gr(t.roll,this.roll,e)&&(ma(t.cameraPosition,this.cameraPosition,e)||ma(t.groundPosition,this.groundPosition,e))}}class R{constructor(){this._listeners=new Set}get numberOfListeners(){return this._listeners.size}addEventListener(t){return this._listeners.add(t),()=>{this.removeEventListener(t)}}removeEventListener(t){return this._listeners.has(t)?(this._listeners.delete(t),!0):!1}raiseEvent(t){[...this._listeners].forEach(e=>{e(t)})}async awaitRaisedEvent(t){const e=new Array(this._listeners.size);let s=0;[...this._listeners].forEach(r=>{e[s]=r(t),s+=1}),await Promise.all(e)}destroy(){this._listeners.clear()}}function L0(){return Pt("OverrideClassRegistry")}class fe{constructor(t){this._coreClassRegistry=t,this._classMap=new Map,this._classShadows=new Map,this.replaced=new R,this.removed=new R}getClassNames(){return[...new Set([...this._classMap.keys(),...this._coreClassRegistry.getClassNames()])]}registerClass(t,e,s){v(t,String),v(e,String),v(s,Function);const r={contextId:t,ctor:s},n=this.hasClass(e);this._classMap.has(e)&&(this._classShadows.has(e)||this._classShadows.set(e,[]),this._classShadows.get(e).push(this._classMap.get(e))),this._classMap.set(e,r),n&&this.replaced.raiseEvent(e)}unregisterClass(t,e){if(v(t,String),v(e,String),this._classShadows.has(e)){const s=this._classShadows.get(e),r=s.filter(n=>n.contextId!==t);r.length===0?this._classShadows.delete(e):r.length!==s.length&&this._classShadows.set(e,r)}this._classMap.has(e)&&this._classMap.get(e).contextId===t&&(this._classMap.delete(e),this._classShadows.has(e)?(this._classMap.set(e,this._classShadows.get(e).pop()),this._classShadows.get(e).length===0&&this._classShadows.delete(e),this.replaced.raiseEvent(e)):this._coreClassRegistry.hasClass(e)?this.replaced.raiseEvent(e):this.removed.raiseEvent(e))}getClass(t){return v(t,String),this._classMap.has(t)?this._classMap.get(t).ctor:this._coreClassRegistry.getClass(t)}hasClass(t){return v(t,String),this._classMap.has(t)||this._coreClassRegistry.hasClass(t)}create(t,...e){v(t,String);const s=this.getClass(t);if(!s){L0().error(`could not find constructor ${t}`);return}return new s(...e)}createFromTypeOptions(t,...e){return v(t,{type:String}),this.create(t.type,t,...e)}removeContext(t){v(t,String),this._classMap.forEach((e,s)=>{this.unregisterClass(t,s)})}destroy(){this._coreClassRegistry=null,this._classMap.clear(),this._classShadows.clear(),this.replaced.destroy(),this.removed.destroy()}}function $s(){return Pt("ClassRegistry")}class be{constructor(){this._classMap=new Map}getClassNames(){return[...this._classMap.keys()]}registerClass(t,e){if(v(t,String),v(e,Function),this._classMap.has(t))throw new Error("a constructor with this className has already been registered");this._classMap.set(t,e)}getClass(t){if(v(t,String),this._classMap.has(t))return this._classMap.get(t)}hasClass(t){return v(t,String),this._classMap.has(t)}create(t,...e){v(t,String);const s=this.getClass(t);if(!s){$s().error(`could not find constructor ${t}`);return}return new s(...e)}createFromTypeOptions(t,...e){return v(t,{type:String}),this.create(t.type,t,...e)}}const ot=new be,si=new be,kr=new be,ri=new be,ki=new be,zr=new be;function ge(i,t,...e){if(!Yn(i,[be,fe]))return $s().error(`ObjectCreation failed: no class registry provided for ${t}`),null;if(!(t==null?void 0:t.type))return $s().warning(`ObjectCreation failed: could not find type in options ${t}`),null;let s;try{s=i.createFromTypeOptions(t,...e)}catch(r){$s().warning(`Error: ${r}`)}return s||($s().warning("ObjectCreation failed: could not create new Object"),null)}function T0(){return Pt("init")}const Lt=Symbol("contextId");function pa(i,t){const e=ge(i.mapClassRegistry,t);return e&&(e.layerCollection=i.layers),e}function uh(i){const t=new oe(i);return t&&t.isValid()?t:(T0().warning(`Viewpoint ${i.name} is not valid`),null)}function ya(i,t){let e;t.style&&(typeof t.style=="string"?e=i.styles.getByKey(t.style):e=ge(i.styleClassRegistry,t.style));let s;t.tileProvider&&(s=ge(i.tileProviderClassRegistry,t.tileProvider));let r;return t.featureProvider&&(r=ge(i.featureProviderClassRegistry,t.featureProvider)),ge(i.layerClassRegistry,O(_({},t),{style:e,tileProvider:s,featureProvider:r}))}function dh(i,t){var s;const e=t.toJSON();return e.zIndex=t[i.layers.zIndexSymbol],((s=e==null?void 0:e.style)==null?void 0:s.name)&&i.styles.hasKey(e.style.name)&&(e.style=e.style.name),e}function fh(i,t,e){return i.zIndex!==t.zIndex?null:e}function me(i){[...i].forEach(t=>{t.destroy&&!t.isDestroyed&&t.destroy()}),i.destroy()}class ve{static from(t,e){const s=new ve(e);if(t)for(const r of t)s.add(r);return s}constructor(t){this._array=[],this._uniqueKey="name",typeof t=="string"||typeof t=="symbol"?this._uniqueKey=t:t===!1&&(this._uniqueKey=void 0),this.added=new R,this.removed=new R}*[Symbol.iterator](){const t=this._array.length;for(let e=0;e<t;e++)yield this._array[e]}get uniqueKey(){return this._uniqueKey}get size(){return this._array.length}getByKey(t){if(!!this._uniqueKey)return this._array.find(e=>e[this._uniqueKey]===t)}_checkUniqueness(t){if(this._uniqueKey){if(t==null||typeof t!="object")return!1;const e=t[this._uniqueKey];if(e==null||this.getByKey(e)!=null)return!1}return!0}add(t){return this._checkUniqueness(t)?(this._array.push(t),this.added.raiseEvent(t),this._array.length-1):null}_remove(t){const e=this._array.indexOf(t);return e>-1&&this._array.splice(e,1),e}remove(t){this._remove(t)>-1&&this.removed.raiseEvent(t)}has(t){return this._array.includes(t)}hasKey(t){if(!!this._uniqueKey)return this._array.some(e=>e[this._uniqueKey]===t)}clear(){this._array.forEach(t=>{this.removed.raiseEvent(t)}),this._array.splice(0)}destroy(){this._array=[],this.added.destroy(),this.removed.destroy()}}function N0(){return Pt("OverrideCollection")}const jr=Symbol("OverrideCollection");function ni(i,t,e,s,r,n){v(i,ve);const a=i;if(a[jr])throw new Error("Cannot transform collection, collection already is an OverrideCollection");a[jr]=!0;const o=s||(u=>u),l=e||(u=>u.toJSON?u.toJSON():u),h=n||((u,d,f)=>f);a.shadowMap=new Map,a.override=function(d){let f,g;const m=d[a.uniqueKey];if(a.hasKey(m)){f=a.getByKey(m),g=a._remove(f),a.shadowMap.has(m)||a.shadowMap.set(m,[]);const y=a.shadowMap.get(m),M=l(f);f.destroy&&f.destroy(),M[Lt]=f[Lt],y.push(M)}const p=f?h(f,d,g):null;return f&&a.replaced.raiseEvent(d),a.add(d,p)>=0?d:null},a.parseItems=async function(d,f){Array.isArray(d)&&(await Promise.all(d.map(async m=>{const p=await o(m);return!p||r&&!(p instanceof r)?(N0().warning(`Could not load item ${m[a.uniqueKey]} of type ${m.type}`),null):(p[Lt]=f,p)}))).filter(m=>m).forEach(m=>{a.override(m)})},a.removed.addEventListener(async u=>{const d=u[a.uniqueKey];if(a.shadowMap.has(d)){const f=a.shadowMap.get(d).pop();if(f){const g=await o(f);g[Lt]=f[Lt];const m=h(g,u,u[a.previousIndexSymbol]);a.add(g,m)}a.shadowMap.get(d).length===0&&a.shadowMap.delete(d)}}),a.added.addEventListener(u=>{u[Lt]||(u[Lt]=t())}),a.removeContext=async function(d){a.shadowMap.forEach((f,g)=>{const m=f.filter(p=>p[Lt]!==d);m.length===0?a.shadowMap.delete(g):m.length!==f.length&&a.shadowMap.set(g,m)}),await Promise.all([...a].filter(f=>f[Lt]===d).map(async f=>{a.remove(f),f.destroy&&f.destroy()}))},a.replaced=new R,a.serializeContext=function(d){return[...a].map(f=>f[Lt]===d?l(f):a.shadowMap.has(f[a.uniqueKey])?a.shadowMap.get(f[a.uniqueKey]).find(g=>g[Lt]===d):null).filter(f=>f)};const c=a.destroy.bind(a);return a.destroy=function(){c(),a.shadowMap.clear(),a.replaced.destroy()},a}var D0=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Oe=function i(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var s,r,n;if(Array.isArray(t)){if(s=t.length,s!=e.length)return!1;for(r=s;r--!==0;)if(!i(t[r],e[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(n=Object.keys(t),s=n.length,s!==Object.keys(e).length)return!1;for(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,n[r]))return!1;for(r=s;r--!==0;){var a=n[r];if(!i(t[a],e[a]))return!1}return!0}return t!==t&&e!==e};class ne extends re{static get className(){return"StyleItem"}constructor(t){super(t);this.supportedLayers=[],this.cesiumStyle=new Fn({show:!0}),this.styleChanged=new R,this.colorBlendMode=Qn(t.colorBlendMode,yr,yr.HIGHLIGHT),this._style=null}get style(){return this._style}set style(t){this._style=t}isSupported(t){return this.supportedLayers.length===0||this.supportedLayers.indexOf(t)>-1}toJSON(){const t=super.toJSON();return this.colorBlendMode!==yr.HIGHLIGHT&&(t.colorBlendMode=this.colorBlendMode),t}clone(t){return t}assign(t){return this.properties=JSON.parse(JSON.stringify(t.properties)),this}equals(t){if(this!==t){const e=this.toJSON();delete e.name;const s=t.toJSON();return delete s.name,Oe(e,s)}return!0}_styleChanged(){this.styleChanged.raiseEvent()}destroy(){this.cesiumStyle=null,this.styleChanged.destroy(),super.destroy()}}ki.registerClass(ne.className,ne);function gh(){return Pt("StyleHelpers")}const va={NWSE:1,SWNE:2,DIAGONALCROSS:3,NS:4,WE:5,CROSS:6};function mh(i,t){let e=i.substring(1);return e.length===3&&(e=e.replace(/([\w\d])/g,"$1$1")),[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16),t!=null?t:1]}function Pe(i){const t=i.toBytes();return t[3]/=255,t}function F0(i){return Ot.fromBytes(i[0],i[1],i[2],i[3]*255)}function bt(i,t){if(Array.isArray(i))return i.length===3&&i.push(1),i;if(typeof i=="string"){if(/^#/.test(i))return mh(i);if(/^rgba?\((\d+(,\s?)?){3}((0|1)(\.\d+)?)?\)/.test(i)){const e=i.replace(/^rgba?\(([\s\S]+?)\)/,"$1").replace(/\s/,"").split(",").map(s=>Number(s));return e.length===3&&e.push(1),e}}if(i instanceof CanvasPattern)return[255,255,255,.4];if(t)return t;throw new Error(`Cannot parse color ${i}`)}function ai(i,t){const e=bt(i,t);return Ot.fromBytes(e[0],e[1],e[2],e[3]*255)}function Rt(i){return`rgba(${bt(i).join(",")})`}function ph(i,t){const e=fd,s=t||document.createElement("canvas");(!t||!s.width)&&(s.width=(i.pattern.size||10)*e,s.height=(i.pattern.size||10)*e);const r=s.getContext("2d"),n=s.width;r.fillStyle=Rt(i.color),r.fillRect(0,0,n,n);function a(o,l){r.strokeStyle=Rt(i.pattern.color),r.lineWidth=i.pattern.width,r.lineCap="square",r.beginPath(),r.moveTo(o[0],o[1]),r.lineTo(l[0],l[1]),r.stroke()}switch(i.pattern.type){case 1:a([n/2,n],[n,n/2]),a([0,n/2],[n/2,0]);break;case 2:a([n/2,n],[0,n/2]),a([n,n/2],[n/2,0]);break;case 3:a([n/2,n],[n,n/2]),a([0,n/2],[n/2,0]),a([n/2,n],[0,n/2]),a([n,n/2],[n/2,0]);break;case 4:a([n/2,0],[n/2,n]);break;case 5:a([0,n/2],[n,n/2]);break;case 6:a([n/2,0],[n/2,n]),a([0,n/2],[n,n/2]);break;default:return null}return r.createPattern(s,"repeat")}function _a(i){function t(e){const s=e.toString(16);return s.length===1?`0${s}`:s}return i.slice(0,3).reduce((e,s)=>`${e}${t(s)}`,"#")}function R0(i){return/^#[0-9a-f]{6}$/.test(i)}function A0(i){if(typeof i!="string")return i;let t=null,e=null,s="normal",r="normal",n="normal",a="normal";return i.split(/\s+/).forEach(o=>{switch(o){case"normal":break;case"italic":case"oblique":s=o;break;case"small-caps":n=o;break;case"bold":case"bolder":case"lighter":case"100":case"200":case"300":case"400":case"500":case"600":case"700":case"800":case"900":r=o;break;default:if(!e){const l=o.split("/");e=l[0],l.length>1&&(a=l[1]);break}t?t=`${t} ${o}`:t=o;break}}),{fontStyle:s,fontVariant:n,fontWeight:r,fontSize:e,lineHeight:a,fontFamily:t}}function yh(i){const t=["fontStyle","fontVariant","fontWeight","fontSize","fontFamily"];let e=null;return Object.entries(i).filter(s=>s[1]!=="normal"&&s[0]!=="lineWeight").sort((s,r)=>{const n=t.indexOf(s[0]),a=t.indexOf(r[0]);return n<a?-1:n>a?1:0}).forEach(s=>{e?e=`${e} ${s[1]}`:e=s[1]}),e||""}function G0(i,t,e,s){const r=s||[0,0],n=i.getImageData(r[0],r[1],e[0],e[1]),{data:a}=n,[o,l,h]=t,c=a.length;for(let u=0;u<c;u+=4)a[u]=o,a[u+1]=l,a[u+2]=h;i.putImageData(n,r[0],r[1])}function $r(i){if(i.getFill()){let t=i.getFill().getColor();try{t=bt(t).slice()}catch(e){gh().warning(e.message)}return{color:t}}}function Hs(i){let t=i.getColor();if(t)try{t=bt(t).slice()}catch(e){gh().warning(e.message)}return{color:t,width:i.getWidth(),lineDash:i.getLineDash()}}function vh(i){return{font:i.getFont(),fill:$r(i),stroke:i.getStroke()?Hs(i.getStroke()):void 0,textBaseline:i.getTextBaseline(),offsetY:i.getOffsetY(),offsetX:i.getOffsetX()}}function _h(i){const t=_({},i);return t.fill&&!(t.fill instanceof he)&&(t.fill=new he(t.fill)),t.stroke&&!(t.stroke instanceof ee)&&(t.stroke=new ee(t.stroke)),t.font&&typeof t.font!="string"&&(t.font=yh(t.font)),new xn(t)}function k0(i){const t={font:i.getFont(),textShadow:void 0,color:void 0};if(i.getStroke()){let e=i.getStroke().getWidth();e=e>1?1:e;const s=_a(bt(i.getStroke().getColor()));t.textShadow=`-${e}px ${e}px 0 ${s},${e}px ${e}px 0 ${s},${e}px -${e}px 0 ${s},-${e}px -${e}px 0 ${s}`}return i.getFill()&&(t.color=_a(bt(i.getFill().getColor()))),t}const Hr=new ft({}),z0=[0,0,0,0],Vs=[255,255,255,1],Vr=[0,0,0,1];function Sa(){return{image:{fill:{color:[255,255,255,.4]},stroke:{color:Vr,width:1},radius:5},stroke:{color:[51,153,204,1],width:1.25},fill:{color:[255,255,255,.4]},text:{font:"bold 18px sans-serif",textBaseline:"bottom",offsetY:-15,offsetX:0}}}const j0={olcs_color:Rt(Vs),olcs_scale:"1.0",olcs_outlineWidth:"0.0",olcs_outlineColor:Rt(Vr),olcs_pointSize:"8.0",olcs_image:null,olcs_font:`'${Sa().text.font}'`,olcs_fontColor:Rt(Vr),olcs_fontOutlineWidth:"1.0",olcs_fontOutlineColor:Rt(Vs),olcs_labelText:null,olcs_anchorLineColor:Rt(Vs)};function K(i,t){const e=`Boolean(\${${i}})===true`,s=t?`color(\${${i}})`:`\${${i}}`;return[[e,s],["true",j0[i]]]}const $0="${attributes} !== undefined && ${attributes} !== null && ${attributes.olcs_extrudedHeight} !== undefined && ${attributes.olcs_extrudedHeight}!==null";function Ma(i){return i.fill&&!(i.fill instanceof he)&&(i.fill=new he(i.fill)),i.stroke&&!(i.stroke instanceof ee)&&(i.stroke=new ee(i.stroke)),i.points?new bn(i):new ys(i)}class H0{constructor(){this.shapes=[]}addImage(t){const s=Ma(_({},t)).getImage(1);t.src=s.toDataURL(),this.shapes.push(t)}}const Sh=new H0,Mh={fill:new he({color:[255,255,255,1]}),stroke:new ee({color:[0,0,0,1],width:1}),radius:16};[null,{points:3},{points:3,angle:Math.PI},{points:4,angle:Math.PI/4},{points:6}].forEach(i=>{const t=i?Object.assign(i,Mh):Mh;Sh.addImage(t)});const Ca={POLYGON:1,POLYLINE:2,POINT:3},Tt=Symbol("VcsVectorStyleItem");class q extends ne{static get className(){return"VectorStyleItem"}constructor(t){super(t);this.validateOptions(t),this.exclude={fill:t.fill===!1,stroke:t.stroke===!1,image:t.image===!1},this._fillOptions=null,this._fill=void 0,this._stroke=t.stroke?new ee(t.stroke):void 0,this._text=void 0,t.text&&(this._text=_h(t.text)),this._label=t.label,this.label=this._label,this._cesiumColor=new Ot,this._image=void 0,t.image&&(this._image=t.image.radius?Ma(_({},t.image)):new vs(t.image)),this._style=new ft({image:this._image,stroke:this._stroke,text:this._text}),t.fill?(this._fillOptions=t.fill,this._setFill()):this.updateCesiumStyle()}validateOptions(t){const e=r=>{try{r.color=bt(r.color),v(r.color,[Number]),v(r.color.length,[3,4])}catch(n){this.getLogger().error(n.message),r.color=[255,255,255,.4]}},s=r=>{e(r),r.width||(this.getLogger().error("missing width for stroke, setting to 1.5"),r.width=1.5)};t.fill&&(e(t.fill),t.fill.pattern&&(s(t.fill.pattern),t.fill.pattern.type&&Object.values(va).includes(t.fill.pattern.type)||(this.getLogger().error(`Cannot find pattern ${t.fill.pattern.type}`),t.fill.pattern.type=va.NWSE))),t.stroke&&s(t.stroke),t.image&&(t.image.icon?t.image=t.image.icon:t.image.circle&&(t.image=t.image.circle),t.image.src||t.image.radius||(this.getLogger().error("missing source or label in style, setting default circle"),t.image={fill:{color:"rgba(255,255,255,0.4)"},stroke:{color:"#3399CC",width:1},radius:5}),t.image.radius&&(t.image.radius=Number(t.image.radius),Number.isFinite(t.image.radius)||(this.getLogger().error("radius must be a number"),t.image.radius=5),t.image.fill&&e(t.image.fill),t.image.stroke&&s(t.image.stroke)))}get fillColor(){return this._fillOptions?this._fillOptions.color:null}get cesiumFillColor(){const t=this.fillColor?this.fillColor.slice():null;return t?(t[3]=t[3]||1,t[3]*=255,Ot.fromBytes(...t,this._cesiumColor)):Ot.RED.clone(this._cesiumColor)}set fillColor(t){this.exclude.fill=!1,this._style instanceof ft?t?(this._fillOptions?this._fillOptions.color=bt(t):this._fillOptions={color:bt(t)},this._setFill()):(this._fillOptions=null,this._fill=void 0,this._style.setFill(this._fill),this.updateCesiumStyleColor(!0)):this.getLogger().info("trying to set fill on a style function")}get pattern(){return this._fillOptions&&this._fillOptions.pattern?this._fillOptions.pattern:null}set pattern(t){if(!this._fillOptions){this.getLogger().error("Missing fill color");return}t?(it(t,{color:[String,[Number]],width:Number,type:Number,size:[Number,void 0,null]},!0),this._fillOptions.pattern=t):this._fillOptions.pattern=void 0,this._setFill()}get stroke(){return this._stroke}set stroke(t){this.exclude.stroke=!1,this._style instanceof ft?(it(t,ee),this._style.setStroke(t),this._stroke=t,this.updateCesiumStyleColor(!0)):this.getLogger().info("trying to set stroke on a style function")}get label(){return this._label}set label(t){it(t,String),t?this._label=t:this._label=void 0,this._text&&this._text.setText(t)}get text(){return this._text}set text(t){this._style instanceof ft?(it(t,xn),this._text=t,this._text.setText(this._label),this._style.setText(this._text)):this.getLogger().info("trying to set text on a style function")}get image(){return this._image}set image(t){this.exclude.image=!1,this._style instanceof ft?(it(t,gd),this._image=t,this._style.setImage(this._image),this.updateCesiumStyle()):this.getLogger().info("trying to set text on a style function")}get style(){return this._style}set style(t){it(t,[ft,Function]),t instanceof ft?(this._stroke=t.getStroke(),this._fill=t.getFill(),this._text=t.getText(),this._image=t.getImage()):(this._stroke=void 0,this._fill=void 0,this._text=void 0,this._image=void 0),this._style=t,this._fill&&this._fill.getColor()&&(this._fillOptions={color:bt(this._fill.getColor())}),this._text&&this._text.setText(this._label),this.updateCesiumStyle()}_setFill(){if(this._style instanceof ft){const t=this._fillOptions.pattern?ph(this._fillOptions):this._fillOptions.color;this._fill?this._fill.setColor(t):(this._fill=new he({color:t}),this._style.setFill(this._fill)),this._fillOptions.pattern&&(this._fill.fallBackColor=this._fillOptions.color),this.updateCesiumStyle()}}updateCesiumStyle(){this.updateCesiumStyleColor(!0),this.updateCesiumStyleImage(!0),this.updateCesiumStyleText(!0),this._styleChanged()}updateCesiumStyleColor(t){const e=K("olcs_color",!0);this.stroke&&this.stroke.getColor()&&e.splice(1,0,[`\${olcs_geometryType}===${Ca.POLYLINE}`,Rt(this.stroke.getColor())]),this._image instanceof ys&&this._image.getFill()&&e.splice(1,0,[`\${olcs_geometryType}===${Ca.POINT}`,Rt(this._image.getFill().getColor())]),this.fillColor&&e.splice(-1,1,["true",Rt(this.fillColor)]),this.cesiumStyle.color={conditions:e},t||this._styleChanged()}updateCesiumStyleImage(t){const e=K("olcs_scale"),s=K("olcs_outlineWidth"),r=K("olcs_outlineColor",!0),n=K("olcs_pointSize"),a=K("olcs_image");if(this._image)if(this._image.getScale()!=null&&e.splice(1,1,["true",`${this._image.getScale()}`]),this._image instanceof ys){const o=this._image.getStroke();let l=this._image.getRadius()*2;if(o){this._image.getStroke().getColor()&&r.splice(1,1,["true",Rt(this._image.getStroke().getColor())]);const h=this._image.getStroke().getWidth();s.splice(1,1,["true",`${h}`]),l-=h}n.splice(1,1,["true",`${l}`])}else if(this._image instanceof bn){const o=this._image.getImage(1).toDataURL();a.splice(1,1,["true",`"${o}"`])}else this._image instanceof vs&&a.splice(1,1,["true",`"${this._image.getSrc()}"`]);this.cesiumStyle.scale={conditions:e},this.cesiumStyle.pointOutlineWidth={conditions:s},this.cesiumStyle.pointOutlineColor={conditions:r},this.cesiumStyle.pointSize={conditions:n},this.cesiumStyle.image={conditions:a},this.cesiumStyle.verticalOrigin="1",this.cesiumStyle.horizontalOrigin="0",t||this._styleChanged()}updateCesiumStyleText(t){const e=K("olcs_font"),s=K("olcs_labelText"),r=K("olcs_fontColor",!0),n=K("olcs_fontOutlineWidth"),a=K("olcs_fontOutlineColor",!0);this._text&&(this._text.getFont()&&e.splice(1,1,["true",`'${this._text.getFont()}'`]),this._text.getText()&&s.splice(1,1,["true",`'${this._text.getText()}'`]),this._text.getFill()&&this._text.getFill().getColor()&&r.splice(1,1,["true",Rt(this._text.getFill().getColor())]),this._text.getStroke()&&this._text.getStroke().getColor()&&(a.splice(1,1,["true",Rt(this._text.getStroke().getColor())]),n.splice(1,1,["true",`${this._text.getStroke().getWidth()||1.25}`]))),this.cesiumStyle.font={conditions:e},this.cesiumStyle.labelText={conditions:s},this.cesiumStyle.labelColor={conditions:r},this.cesiumStyle.labelOutlineWidth={conditions:n},this.cesiumStyle.labelOutlineColor={conditions:a},this.cesiumStyle.labelStyle="Boolean(${olcs_fontOutlineWidth}) === true ? 2 : 0",this.cesiumStyle.labelHorizontalOrigin="0";let o=Bt.CENTER;if(this._text)switch(this._text.getTextBaseline()){case"top":o=Bt.TOP;break;case"middle":o=Bt.CENTER;break;case"bottom":o=Bt.BOTTOM;break;case"alphabetic":o=Bt.TOP;break;case"hanging":o=Bt.BOTTOM;break}this.cesiumStyle.labelVerticalOrigin=o,t||this._styleChanged()}clone(t){if(t)return t.style=this._style instanceof ft?this._style.clone():this._style,this._fillOptions&&this._fillOptions.color&&(t.fillColor=this._fillOptions.color.slice(),this._fillOptions.pattern&&(t.pattern=_({},this._fillOptions.pattern))),Object.keys(this.exclude).forEach(s=>{this.exclude[s]&&t.unset(s)}),t;const e=this.toJSON();return delete e.name,new q(e)}assign(t){return super.assign(t),t.fillColor&&(this.fillColor=t.fillColor.slice()),t.pattern?this.pattern=_({},t.pattern):this.pattern=void 0,t.stroke&&(this.stroke=t.stroke.clone()),t.image&&(this.image=t.image.clone()),t.text&&(this.text=t.text.clone()),t.label&&(this.label=t.label),Object.keys(t.exclude).forEach(e=>{t.exclude[e]&&this.unset(e)}),this}toJSON(){const t=super.toJSON();return this._fillOptions?(t.fill={color:bt(this._fillOptions.color).slice()},this._fillOptions.pattern&&(t.fill.pattern=_({},this._fillOptions.pattern))):this.exclude.fill&&(t.fill=!1),this._stroke?t.stroke=Hs(this._stroke):this.exclude.stroke&&(t.stroke=!1),this._text&&(t.text=vh(this._text)),this._label&&(t.label=this._label),this._image instanceof vs?t.image={src:this._image.getSrc(),scale:this._image.getScale(),opacity:this._image.getOpacity()}:this._image instanceof ys?t.image={scale:this._image.getScale(),fill:$r(this._image),radius:this._image.getRadius(),stroke:this._image.getStroke()?Hs(this._image.getStroke()):void 0}:this._image instanceof bn?t.image={scale:this._image.getScale(),fill:$r(this._image),points:this._image.getPoints(),angle:this._image.getAngle(),radius:this._image.getRadius(),stroke:this._image.getStroke()?Hs(this._image.getStroke()):void 0}:this.exclude.image&&(t.image=!1),t}getOptionsForFeature(t){const e=t.getGeometry().getType(),s=t.get("olcs_extrudedHeight")||t.get("olcs_storeyHeight")&&t.get("olcs_storeyNumber"),r=new Set;e==="Point"||e==="MultiPoint"?(t[Tt].label!=null&&(r.add("text"),r.add("label")),r.add("image"),s&&r.add("stroke")):e==="LineString"||e==="MultiLineString"?(r.add("stroke"),s&&r.add("fill")):e==="Polygon"||e==="MultiPolygon"||e==="Circle"?(r.add("stroke"),r.add("fill")):e==="GeometryCollection"&&(r.add("stroke"),r.add("fill"),r.add("image"),r.add("text"));const n=this.toJSON(),a={};return r.forEach(o=>{a[o]=n[o]}),a}unset(t){v(t,Object.keys(this.exclude)),t==="fill"?this.fillColor=void 0:this[t]=void 0,this.exclude[t]=!0}destroy(){this._image=null,this._stroke=null,this._fill=null,this._label=null,this._text=null,this._style=null,super.destroy()}}const oi=new q(Sa());ki.registerClass(q.className,q);function Ch(i){const t=i.toBytes();return t[3]/=255,new q({fill:{color:t},stroke:{color:t,width:oi.stroke.getWidth()}})}const pe=Symbol("originalStyle"),Nt=Symbol("highlighted"),At=Symbol("hidden"),Gt=Symbol("globalHidden");function zi(i){return i&&i.content&&!i.content.isDestroyed()&&!i.content.batchTable.isDestroyed()}function wa(i){(i instanceof Ge||i instanceof Ae)&&zi(i)||i instanceof Rn?i.show=!1:i instanceof Z&&i.setStyle(Hr.clone())}function Br(i){Reflect.has(i,pe)||((i instanceof Ge||i instanceof Ae)&&zi(i)?i[pe]=i.color.clone():i instanceof Z&&(i[pe]=i.getStyle()))}function wh(i){if(!(i[Gt]||i[At]||i[Nt])){const t=i[pe];(i instanceof Ge||i instanceof Ae)&&zi(i)?i.color=t:i instanceof Z&&i.setStyle(t),delete i[pe]}}function Ur(i){if(!(i[Gt]||i[At])){const t=i[Nt];(i instanceof Ge||i instanceof Ae)&&zi(i)?i.color=t.cesiumFillColor:i instanceof Z&&i.setStyle(t.style)}}function xa(i){delete i[pe],Br(i),i[At]||i[Gt]?wa(i):i[Nt]&&Ur(i)}function V0(i){delete i[Nt],wh(i)}function xh(i,t){delete i[t],i[At]||i[Gt]||(((i instanceof Ge||i instanceof Ae)&&zi(i)||i instanceof Rn)&&(i.show=!0),i[Nt]?Ur(i):wh(i))}const W={HIGHLIGHT:1,UNHIGHLIGHT:2,HIDE:3,SHOW:4};function bh(i,t){function e({action:n,ids:a}){if(n===W.HIGHLIGHT){const o={};a.forEach(l=>{o[l]=i.highlightedObjects[l].style}),t.highlight(o)}else n===W.UNHIGHLIGHT?t.unHighlight(a):n===W.HIDE?t.hideObjects(a):n===W.SHOW&&t.showObjects(a)}const s=Object.keys(i.highlightedObjects);s.length>0&&e({action:W.HIGHLIGHT,ids:s});const r=Object.keys(i.hiddenObjects);return r.length>0&&e({action:W.HIDE,ids:r}),i.changed.addEventListener(e)}class qr{constructor(){this.hiddenObjects={},this.highlightedObjects={},this.lastUpdated=Date.now(),this.changed=new R}highlight(t){const e=[];Object.entries(t).forEach(([s,r])=>{let n=r;r instanceof Ot?n=Ch(r):r instanceof ft&&(n=new q({}),r.getText()&&r.getText().getText()&&!Array.isArray(r.getText().getText())&&(n.label=String(r.getText().getText())),n.style=r),n=n,this.highlightedObjects[s]?this.highlightedObjects[s].style!==n&&(this.highlightedObjects[s].style=n,this.highlightedObjects[s].features.forEach((a,o)=>{o[Nt]=n,Ur(o)})):(this.highlightedObjects[s]={style:n,features:new Set},e.push(s))}),e.length>0&&(this.lastUpdated=Date.now(),this.changed.raiseEvent({action:W.HIGHLIGHT,ids:e}))}unHighlight(t){const e=[];t.forEach(s=>{this.highlightedObjects[s]&&(this.highlightedObjects[s].features.forEach(r=>{V0(r)}),delete this.highlightedObjects[s],e.push(s))}),e.length>0&&this.changed.raiseEvent({action:W.UNHIGHLIGHT,ids:e})}clearHighlighting(){this.unHighlight(Object.keys(this.highlightedObjects))}hasHighlightFeature(t,e){return this.highlightedObjects[t]&&this.highlightedObjects[t].features.has(e)}addHighlightFeature(t,e){this.highlightedObjects[t]&&(Br(e),this.highlightedObjects[t].features.add(e),e[Nt]=this.highlightedObjects[t].style,Ur(e))}hideObjects(t){const e=[];t.forEach(s=>{this.hiddenObjects[s]||(this.hiddenObjects[s]=new Set,e.push(s))}),e.length>0&&(this.lastUpdated=Date.now(),this.changed.raiseEvent({action:W.HIDE,ids:e}))}showObjects(t){const e=[];t.forEach(s=>{this.hiddenObjects[s]&&(this.hiddenObjects[s].forEach(r=>{xh(r,At)}),delete this.hiddenObjects[s],e.push(s))}),e.length>0&&this.changed.raiseEvent({action:W.SHOW,ids:e})}clearHiddenObjects(){this.showObjects(Object.keys(this.hiddenObjects))}hasHiddenFeature(t,e){return this.hiddenObjects[t]&&this.hiddenObjects[t].has(e)}addHiddenFeature(t,e){this.hiddenObjects[t]&&(Br(e),this.hiddenObjects[t].add(e),e[At]=!0,wa(e))}destroy(){Object.values(this.hiddenObjects).forEach(t=>{t.clear()}),this.hiddenObjects={},Object.values(this.highlightedObjects).forEach(({features:t})=>{t.clear()}),this.highlightedObjects={},this.changed.destroy()}}let ji;class Oh{constructor(){this.hiddenObjects={},this._hiddenObjectFeatures={},this.lastUpdated=Date.now(),this.changed=new R}hideObjects(t){v(t,[String]);const e=[];t.forEach(s=>{this.hiddenObjects[s]||(e.push(s),this.hiddenObjects[s]=0),this.hiddenObjects[s]+=1}),e.length>0&&(this.lastUpdated=Date.now(),this.changed.raiseEvent({action:W.HIDE,ids:e}))}showObjects(t){v(t,[String]);const e=[];t.forEach(s=>{this.hiddenObjects[s]&&(this.hiddenObjects[s]-=1,this.hiddenObjects[s]===0&&(this._hiddenObjectFeatures[s]&&(this._hiddenObjectFeatures[s].forEach(r=>{xh(r,Gt)}),this._hiddenObjectFeatures[s].clear()),delete this.hiddenObjects[s],e.push(s)))}),e.length>0&&this.changed.raiseEvent({action:W.SHOW,ids:e})}addFeature(t,e){this._hiddenObjectFeatures[t]||(this._hiddenObjectFeatures[t]=new Set),Br(e),this._hiddenObjectFeatures[t].add(e),e[Gt]=!0,wa(e)}hasFeature(t,e){return this._hiddenObjectFeatures[t]?this._hiddenObjectFeatures[t].has(e):!1}destroy(){this.hiddenObjects={},Object.values(this._hiddenObjectFeatures).forEach(t=>{t.clear()}),this._hiddenObjectFeatures={},this.changed.destroy()}static destroy(){ji&&ji.destroy(),ji=void 0}}function li(){return ji||(ji=new Oh),ji}const z=Symbol("vcsLayerName"),Q={INACTIVE:1,ACTIVE:2,LOADING:4};let ba;function Oa(){return ba||(ba=new R),ba}function Ph(){return navigator.language?navigator.language.substring(0,2):"en"}let Wr;function Pa(){return Wr||(Wr=Ph()),Wr}function B0(i){typeof i=="string"&&(Wr=i,Oa().raiseEvent(i))}const Ea="2.0";class ht extends re{static get className(){return"Layer"}static get vcsLayerNameSymbol(){return z}static getDefaultOptions(){return{name:void 0,extent:void 0,activeOnStartup:!1,allowPicking:!0,exclusiveGroups:[],mapNames:[],url:void 0,hiddenObjectIds:[],copyright:void 0}}constructor(t){super(t);const e=ht.getDefaultOptions();this.extent=t.extent?new pt(t.extent):null,this.activeOnStartup=rt(t.activeOnStartup,e.activeOnStartup),this._allowPicking=rt(t.allowPicking,e.allowPicking),this._state=Q.INACTIVE,this._loadingPromise=null,this._initialized=!1,this.mapNames=t.mapNames||e.mapNames,this._supportedMaps=[],this._url=t.url,this._localeChangedListener=null,this._zIndex=V(t.zIndex,0),this.zIndexChanged=new R,this.hiddenObjectIds=Array.isArray(t.hiddenObjectIds)?t.hiddenObjectIds:e.hiddenObjectIds,this._exclusiveGroups=Array.isArray(t.exclusiveGroups)?t.exclusiveGroups.slice():e.exclusiveGroups,this.exclusiveGroupsChanged=new R,this.globalHider=li(),this.copyright=t.copyright||e.copyright,this._implementations=new Map,this._activeMaps=new Set,this.stateChanged=new R,this.featureProvider=void 0}get initialized(){return this._initialized}get active(){return this._state===Q.ACTIVE}get loading(){return!!(this._state&Q.LOADING)}get state(){return this._state}get allowPicking(){return this._allowPicking}set allowPicking(t){this._allowPicking=t}get url(){if(this._url){if(typeof this._url=="string")return this._url;const t=Pa();return this._url[t]?this._url[t]:Object.values(this._url)[0]}return""}set url(t){v(t,[String,Object]),this._url!==t&&(this._url=t,this.reload())}get exclusive(){return this._exclusiveGroups.length>0}get exclusiveGroups(){return this._exclusiveGroups.slice()}set exclusiveGroups(t){v(t,[[String,Symbol]]),(t.length!==this._exclusiveGroups.length||!t.every(e=>this._exclusiveGroups.includes(e)))&&(this._exclusiveGroups=t.slice(),this.exclusiveGroupsChanged.raiseEvent(t))}get zIndex(){return this._zIndex}set zIndex(t){v(t,Number),this._zIndex!==t&&(this._zIndex=t,this.zIndexChanged.raiseEvent(t))}createImplementationsForMap(t){return[]}getImplementationsForMap(t){return this._implementations.has(t)||(this.isSupported(t)?this._implementations.set(t,this.createImplementationsForMap(t)):this._implementations.set(t,[])),this._implementations.get(t)}getImplementations(){return[...this._implementations.values()].flat()}getImplementationOptions(){return{name:this.name,url:this.url}}reload(){return this.forceRedraw()}async forceRedraw(){const e=[...this._implementations.keys()].map(s=>(this.removedFromMap(s),s.active?this.mapActivated(s):Promise.resolve()));await Promise.all(e)}getExtent(){return this.extent}getZoomToExtent(){return this.extent&&this.extent.isValid()?this.extent:null}_handleLocaleChange(t){this._url&&typeof this._url=="object"&&this._url[t]&&this.reload()}initialize(){return this.initialized||(this._localeChangedListener=Oa().addEventListener(this._handleLocaleChange.bind(this))),this._initialized=!0,Promise.resolve()}async mapActivated(t){this.getLogger().debug(`Layer: ${this.name} mapActivated is called from Map: ${t.name}`),this._activeMaps.add(t),(this.active||this.loading&&this.initialized)&&await this._activateImplsForMap(t)}mapDeactivated(t){this.getLogger().debug(`Layer: ${this.name} mapDeactivated is called from Map: ${t.name}`),this._activeMaps.delete(t),(this.active||this.loading)&&this.getImplementationsForMap(t).forEach(e=>{e.deactivate()})}removedFromMap(t){this._activeMaps.delete(t),this.getImplementationsForMap(t).forEach(e=>{e.destroy()}),this._implementations.delete(t)}isSupported(t){return t&&this._supportedMaps.includes(t.className)&&(this.mapNames.length===0||this.mapNames.indexOf(t.name)>=0)}async _activateImplsForMap(t){const e=this.getImplementationsForMap(t);try{await Promise.all(e.map(s=>s.activate()))}catch(s){this.getLogger().error(`Layer ${this.name} could not activate impl for map ${t.name}`),this.getLogger().error(s),this._implementations.set(t,[]),e.forEach(r=>{r.destroy()})}}async _activate(){this._state=Q.LOADING;try{this.stateChanged.raiseEvent(Q.LOADING)}catch(t){this.getLogger().debug(`Error on raising LayerState.LOADING event for layer ${this.name} : ${t.message}`)}if(await this.initialize(),this._state===Q.LOADING&&(await Promise.all([...this._activeMaps].map(t=>this._activateImplsForMap(t))),this._state===Q.LOADING)){this.globalHider.hideObjects(this.hiddenObjectIds),this._state=Q.ACTIVE;try{this.stateChanged.raiseEvent(Q.ACTIVE)}catch(t){this.getLogger().debug(`Error on raising LayerState.ACTIVE event for layer ${this.name} : ${t.message}`)}this._loadingPromise=null}}activate(){return this._loadingPromise?this._loadingPromise:this._state===Q.INACTIVE?(this._loadingPromise=this._activate().catch(t=>(this._state=Q.INACTIVE,Promise.reject(t))),this._loadingPromise):Promise.resolve()}deactivate(){if(this._loadingPromise&&(this._loadingPromise=null),this._state!==Q.INACTIVE){this.getImplementations().forEach(t=>{(t.loading||t.active)&&t.deactivate()}),this.globalHider.showObjects(this.hiddenObjectIds),this._state=Q.INACTIVE;try{this.stateChanged.raiseEvent(Q.INACTIVE)}catch(t){this.getLogger().debug(`Error on raising LayerState.INACTIVE event for layer ${this.name} : ${t.message}`)}}}toJSON(){const t=super.toJSON(),e=ht.getDefaultOptions();return this.activeOnStartup!==e.activeOnStartup&&(t.activeOnStartup=this.activeOnStartup),this.allowPicking!==e.allowPicking&&(t.allowPicking=this.allowPicking),this.mapNames.length>0&&(t.mapNames=this.mapNames.slice()),this.hiddenObjectIds.length>0&&(t.hiddenObjectIds=this.hiddenObjectIds.slice()),this._url&&(t.url=this._url),this.extent&&this.extent.isValid()&&(t.extent=this.extent.toJSON()),this._exclusiveGroups.length>0&&(t.exclusiveGroups=this._exclusiveGroups.slice()),this.copyright!==e.copyright&&(t.copyright=_({},this.copyright)),t}destroy(){super.destroy(),this.featureProvider&&this.featureProvider.destroy(),this._activeMaps.clear(),this.getImplementations().forEach(t=>{t.destroy()}),this._localeChangedListener&&(this._localeChangedListener(),this._localeChangedListener=null),this._initialized=!1,this._implementations.clear(),this.stateChanged.destroy(),this.zIndexChanged.destroy(),this.exclusiveGroupsChanged.destroy()}}ot.registerClass(ht.className,ht);const Eh=Symbol("alreadyTransformedToMercator"),Ve=Symbol("alreadyTransformedToImage"),Yr=Symbol("obliqueGeometry"),Ia=Symbol("doNotTransform"),Be=Symbol("OriginalFeature"),Bs=Symbol("ActuallyIsCircle"),hi=new Ot,U0=new xn({font:"30px sans-serif",fill:new he({color:Vs}),textAlign:"left",offsetY:-15});function Ih(i,t,e){e[t].conditions?i[t]=new Yd(e[t],e.defines):i[t]=new Xd(e[t],e.defines)}class Mt extends ne{static get className(){return"DeclarativeStyleItem"}constructor(t){super(t);const e=t.declarativeStyle||{};e.show=e.show!=null?e.show:!0,this.cesiumStyle=new Fn(e),this._style=this._styleFunction.bind(this),e.strokeColor&&Ih(this.cesiumStyle,"strokeColor",e),e.strokeWidth&&Ih(this.cesiumStyle,"strokeWidth",e),this._styleOptions=e,this._circleCache=new Map}get styleOptions(){return JSON.parse(JSON.stringify(this._styleOptions))}toJSON(){const t=super.toJSON(),e=this.cesiumStyle.ready?this.cesiumStyle.style:this.styleOptions;return t.declarativeStyle=Object.fromEntries(Object.entries(e).filter(([,s])=>s!=null).map(([s,r])=>Yn(r,Boolean)?[s,r.toString()]:[s,r])),t}clone(t){if(t)return t.assign(this);const e=this.toJSON();return delete e.name,new Mt(e)}assign(t){return super.assign(t),this._styleOptions=t.cesiumStyle.ready?t.cesiumStyle.style:t.styleOptions,this.cesiumStyle=new Fn(this._styleOptions),this}_styleFunction(t){const e=t[Be]||t;if(!this.cesiumStyle.show.evaluate(e))return Hr;const s=e.getGeometry().getType();return s==="Point"?this._stylePoint(e):s==="Polygon"?this._stylePolygon(e):s==="LineString"?this._styleLineString(e):s==="Circle"?this._stylePolygon(e):s==="MultiPoint"?this._stylePoint(e):s==="MultiPolygon"?this._stylePolygon(e):s==="MultiLineString"?this._styleLineString(e):(this.getLogger().warning(`could not style geometry type: ${s}`),Hr)}_stylePolygon(t){const e=new ft({}),s=this.cesiumStyle.color?this.cesiumStyle.color.evaluate(t,hi):Ot.WHITE;return s&&e.setFill(new he({color:Pe(s)})),this._evaluateStroke(t,e),e}_styleLineString(t){const e=new ft({}),s=t.get("olcs_extrudedHeight")||t.get("olcs_storeyHeight")&&t.get("olcs_storeyNumber"),r=this.cesiumStyle.color?this.cesiumStyle.color.evaluate(t,hi):Ot.WHITE;if(r)if(s)e.setFill(new he({color:Pe(r)}));else{const n=this.cesiumStyle.strokeWidth?this.cesiumStyle.strokeWidth.evaluate(t):1;e.setStroke(new ee({width:Number.isFinite(n)?n:1,color:Pe(r)}))}return s&&this._evaluateStroke(t,e),e}_stylePoint(t){const e=new ft({});if(this.cesiumStyle.labelText){const s=this.cesiumStyle.labelText.evaluate(t);if(s){const r=U0.clone();if(r.setText(s.toString()),this.cesiumStyle.font){const n=this.cesiumStyle.font.evaluate(t);n&&r.setFont(n)}if(this.cesiumStyle.labelColor){const n=this.cesiumStyle.labelColor.evaluateColor(t,hi);n&&r.getFill().setColor(Pe(n))}if(this.cesiumStyle.labelOutlineColor){const n=this.cesiumStyle.labelOutlineColor.evaluate(t,hi);if(n){const a=this.cesiumStyle.labelOutlineWidth?this.cesiumStyle.labelOutlineWidth.evaluate(t):1;r.setStroke(new ee({color:Pe(n),width:a}))}}e.setText(r)}}if(this.cesiumStyle.image){const s=this.cesiumStyle.image.evaluate(t);s&&e.setImage(new vs({src:s}))}else{const s=this.cesiumStyle.color?this.cesiumStyle.color.evaluate(t,hi):Ot.WHITE;let r=4;this.cesiumStyle.pointSize&&(r=this.cesiumStyle.pointSize.evaluate(t)/2);const n=this.cesiumStyle.pointOutlineWidth?this.cesiumStyle.pointOutlineWidth.evaluate(t):0;let a=Ot.BLACK;n&&(this.cesiumStyle.pointOutlineColor&&(a=this.cesiumStyle.pointOutlineColor.evaluateColor(t,hi)),r+=n/2);const o=`${r}${s}${n}${a}`;if(!this._circleCache.has(o)){const l={radius:r,fill:new he({color:Pe(s)})};n&&(l.stroke=new ee({color:Pe(a),width:n})),this._circleCache.set(o,new ys(l))}e.setImage(this._circleCache.get(o))}if(this.cesiumStyle.scale&&e.getImage()){const s=this.cesiumStyle.scale.evaluate(t);Number.isFinite(s)&&e.getImage().setScale(s)}return this._evaluateStroke(t,e),e}_evaluateStroke(t,e){if(this.cesiumStyle.strokeColor){const s=this.cesiumStyle.strokeColor.evaluateColor(t,hi);if(s){const r=this.cesiumStyle.strokeWidth?this.cesiumStyle.strokeWidth.evaluate(t):1;e.setStroke(new ee({width:Number.isFinite(r)?r:1,color:Pe(s)}))}}}get show(){return this._styleOptions.show}set show(t){this._styleOptions.show=t,this.cesiumStyle.show=t,this._styleChanged()}get color(){return this._styleOptions.color}set color(t){this._styleOptions.color=t,this.cesiumStyle.color=t,this._styleChanged()}get strokeColor(){return this._styleOptions.strokeColor}set strokeColor(t){this._styleOptions.strokeColor=t,this.cesiumStyle.strokeColor=t,this._styleChanged()}get strokeWidth(){return this._styleOptions.strokeWidth}set strokeWidth(t){this._styleOptions.strokeWidth=t,this.cesiumStyle.strokeWidth=t,this._styleChanged()}get image(){return this._styleOptions.image}set image(t){this._styleOptions.image=t,this.cesiumStyle.image=t,this._styleChanged()}get labelText(){return this._styleOptions.labelText}set labelText(t){this._styleOptions.labelText=t,this.cesiumStyle.labelText=t,this._styleChanged()}get labelColor(){return this._styleOptions.labelColor}set labelColor(t){this._styleOptions.labelColor=t,this.cesiumStyle.labelColor=t,this._styleChanged()}get font(){return this._styleOptions.font}set font(t){this._styleOptions.font=t,this.cesiumStyle.font=t,this._styleChanged()}get pointSize(){return this._styleOptions.pointSize}set pointSize(t){this._styleOptions.pointSize=t,this.cesiumStyle.pointSize=t,this._styleChanged()}destroy(){this._circleCache.clear(),super.destroy()}}ki.registerClass(Mt.className,Mt);const Lh=new Mt({declarativeStyle:{show:!0,color:{conditions:K("olcs_color",!0)},scale:{conditions:K("olcs_scale")},pointOutlineWidth:{conditions:K("olcs_outlineWidth")},pointOutlineColor:{conditions:K("olcs_outlineColor",!0)},pointSize:{conditions:K("olcs_pointSize")},image:{conditions:K("olcs_image")},font:{conditions:K("olcs_font")},labelStyle:"2",labelText:{conditions:K("olcs_labelText")},labelColor:{conditions:K("olcs_fontColor",!0)},labelOutlineWidth:{conditions:K("olcs_fontOutlineWidth")},labelOutlineColor:{conditions:K("olcs_fontOutlineColor",!0)},verticalOrigin:"1",horizontalOrigin:"0",labelHorizontalOrigin:"0",labelVerticalOrigin:"1"}});function La(i,t){if(i.image&&i.image.src&&/^data:/.test(i.image.src))if(t){let e=t.indexOf(i.image.src);e===-1&&(t.push(i.image.src),e=t.length-1),i.image.src=`:${e}`}else i.image={radius:5};return i}function Th(i,t={}){return i instanceof q?t.style=La(i.toJSON(),t.embeddedIcons):i instanceof Mt&&(t.style=i.toJSON()),t}function Ta(){return Pt("VectorProperties")}const ci={clampToGround:Yt.CLAMP_TO_GROUND,absolute:Yt.NONE,relativeToGround:Yt.RELATIVE_TO_GROUND},ui={both:Ei.BOTH,cesium3DTile:Ei.CESIUM_3D_TILE,terrain:Ei.TERRAIN};function Xr(i,t){if(Array.isArray(i)){const e=i.map(s=>E(s,null)).filter(s=>s!=null);if(e.length===4)return new Ms(e[0],e[1],e[2],e[3])}return t}function Zr(i,t){if(Array.isArray(i)){const e=i.map(s=>E(s,null)).filter(s=>s!=null);if(e.length===3)return new C(e[0],e[1],e[2])}return t}function di(i,t){if(Array.isArray(i))return i.map(e=>E(e,null)).filter(e=>e!==null&&e>0);{const e=E(i,null);if(e&&e>0)return[e]}return Array.isArray(t)?t:[t]}function Us(i){return Object.keys(ci).find(t=>ci[t]===i)}function Jr(i){return Object.keys(ui).find(t=>ui[t]===i)}function Kr(i){return i?Ms.pack(i,[]):void 0}function Qr(i){return i?C.pack(i,[]):void 0}class te{static getDefaultOptions(){return{altitudeMode:"clampToGround",allowPicking:!0,classificationType:void 0,scaleByDistance:void 0,eyeOffset:void 0,heightAboveGround:0,skirt:0,groundLevel:void 0,extrudedHeight:0,storeysAboveGround:0,storeysBelowGround:0,storeyHeightsAboveGround:[],storeyHeightsBelowGround:[],storeyHeight:void 0,modelUrl:void 0,modelScaleX:1,modelScaleY:1,modelScaleZ:1,modelHeading:0,modelPitch:0,modelRoll:0,modelOptions:void 0,baseUrl:void 0}}constructor(t){const e=te.getDefaultOptions();this._altitudeMode=ze(t.altitudeMode,ci,Yt.CLAMP_TO_GROUND),this._allowPicking=rt(t.allowPicking,e.allowPicking),this._classificationType=ze(t.classificationType,ui,void 0),this._scaleByDistance=Xr(t.scaleByDistance,void 0),this._eyeOffset=Zr(t.eyeOffset,void 0),this._heightAboveGround=E(t.heightAboveGround,e.heightAboveGround),this._skirt=E(t.skirt,e.skirt),this._groundLevel=E(t.groundLevel,e.groundLevel),this._extrudedHeight=E(t.extrudedHeight,e.extrudedHeight),this._storeysAboveGround=V(t.storeysAboveGround,e.storeysAboveGround),this._storeysBelowGround=V(t.storeysBelowGround,e.storeysBelowGround),this._storeyHeightsAboveGround=di(t.storeyHeightsAboveGround,e.storeyHeightsAboveGround),this._storeyHeightsBelowGround=di(t.storeyHeightsBelowGround,e.storeyHeightsBelowGround),this._storeyHeight=E(t.storeyHeight,e.storeyHeight),this._modelUrl=t.modelUrl||e.modelUrl,this._modelScaleX=E(t.modelScaleX,e.modelScaleX),this._modelScaleY=E(t.modelScaleY,e.modelScaleY),this._modelScaleZ=E(t.modelScaleZ,e.modelScaleZ),this._modelHeading=E(t.modelHeading,e.modelHeading),this._modelPitch=E(t.modelPitch,e.modelPitch),this._modelRoll=E(t.modelRoll,e.modelRoll),this._baseUrl=t.baseUrl||e.baseUrl,this._modelOptions=t.modelOptions||e.modelOptions,this.propertyChanged=new R}get altitudeMode(){return this._altitudeMode}set altitudeMode(t){t!==this._altitudeMode&&(v(t,Object.values(Yt)),this._altitudeMode=t,this.propertyChanged.raiseEvent(["altitudeMode"]))}getAltitudeMode(t){const e=t.get("olcs_altitudeMode");return ze(e,ci,this._altitudeMode)}get allowPicking(){return this._allowPicking}set allowPicking(t){t!==this._allowPicking&&(v(t,Boolean),this._allowPicking=t,this.propertyChanged.raiseEvent(["allowPicking"]))}getAllowPicking(t){const e=t.get("olcs_allowPicking");return rt(e,this._allowPicking)}get classificationType(){return this._classificationType}set classificationType(t){t!==this._classificationType&&(it(t,Object.values(Ei)),this._classificationType=t,this.propertyChanged.raiseEvent(["classificationType"]))}getClassificationType(t){const e=t.get("olcs_classificationType");return ze(e,ui,this.classificationType)}get scaleByDistance(){return this._scaleByDistance}set scaleByDistance(t){Ms.equals(t,this._scaleByDistance)||(it(t,Ms),this._scaleByDistance=t,this.propertyChanged.raiseEvent(["scaleByDistance"]))}getScaleByDistance(t){const e=t.get("olcs_scaleByDistance");return Xr(e,this.scaleByDistance)}get eyeOffset(){return this._eyeOffset}set eyeOffset(t){C.equals(this.eyeOffset,t)||(it(t,C),this._eyeOffset=t,this.propertyChanged.raiseEvent(["eyeOffset"]))}getEyeOffset(t){const e=t.get("olcs_eyeOffset");if(!e){const s=t.get("olcs_zCoordinateEyeOffset");if(s)return Ta().deprecate("zCoordinateEyeOffset","use eyeOffset and provide [0,0,value]"),new C(0,0,E(s,0))}return Zr(e,this.eyeOffset)}get heightAboveGround(){return this._heightAboveGround}set heightAboveGround(t){t!==this._heightAboveGround&&(v(t,Number),this._heightAboveGround=t,this.propertyChanged.raiseEvent(["heightAboveGround"]))}getHeightAboveGround(t){const e=t.get("olcs_heightAboveGround");return E(e,this.heightAboveGround)}get skirt(){return this._skirt}set skirt(t){t!==this._skirt&&(v(t,Number),this._skirt=t,this.propertyChanged.raiseEvent(["skirt"]))}getSkirt(t){const e=t.get("olcs_skirt");return E(e,this.skirt)}get groundLevel(){return this._groundLevel}set groundLevel(t){t!==this._groundLevel&&(it(t,Number),this._groundLevel=t,this.propertyChanged.raiseEvent(["groundLevel"]))}getGroundLevel(t){const e=t.get("olcs_groundLevel");return E(e,this.groundLevel)}get extrudedHeight(){return this._extrudedHeight}set extrudedHeight(t){t!==this._extrudedHeight&&(v(t,Number),this._extrudedHeight=t,this.propertyChanged.raiseEvent(["extrudedHeight"]))}getExtrudedHeight(t){const e=t.get("olcs_extrudedHeight");return E(e,this.extrudedHeight)}get storeysAboveGround(){return this._storeysAboveGround}set storeysAboveGround(t){t!==this._storeysAboveGround&&(v(t,Number),this._storeysAboveGround=Math.trunc(t),this.propertyChanged.raiseEvent(["storeysAboveGround"]))}getStoreysAboveGround(t){const e=t.get("olcs_storeysAboveGround");return V(e,this.storeysAboveGround)}get storeysBelowGround(){return this._storeysBelowGround}set storeysBelowGround(t){t!==this._storeysBelowGround&&(v(t,Number),this._storeysBelowGround=Math.trunc(t),this.propertyChanged.raiseEvent(["storeysBelowGround"]))}getStoreysBelowGround(t){const e=t.get("olcs_storeysBelowGround");return V(e,this.storeysBelowGround)}get storeyHeightsAboveGround(){return this._storeyHeightsAboveGround.slice()}set storeyHeightsAboveGround(t){Oe(t,this._storeyHeightsAboveGround)||(v(t,[Number]),this._storeyHeightsAboveGround=t,this.propertyChanged.raiseEvent(["storeyHeightsAboveGround"]))}getStoreyHeightsAboveGround(t){const e=t.get("olcs_storeyHeightsAboveGround");return di(e,this.storeyHeightsAboveGround)}get storeyHeightsBelowGround(){return this._storeyHeightsBelowGround.slice()}set storeyHeightsBelowGround(t){Oe(t,this._storeyHeightsBelowGround)||(v(t,[Number]),this._storeyHeightsBelowGround=t,this.propertyChanged.raiseEvent(["storeyHeightsBelowGround"]))}getStoreyHeightsBelowGround(t){const e=t.get("olcs_storeyHeightsBelowGround");return di(e,this.storeyHeightsBelowGround)}get storeyHeight(){return this._storeyHeight}set storeyHeight(t){t!==this._storeyHeight&&(Ta().deprecate("storeyHeight","use storeyHeightAboveGround"),v(t,Number),this._storeyHeight=t,this.propertyChanged.raiseEvent(["storeyHeight"]))}get modelUrl(){return this._modelUrl}set modelUrl(t){v(t,String),this._modelUrl!==t&&(this._modelUrl=t,this.propertyChanged.raiseEvent(["modelUrl"]))}getModelUrl(t){const e=t.get("olcs_modelUrl");return e!==void 0?e:this.modelUrl}get modelScaleX(){return this._modelScaleX}set modelScaleX(t){v(t,Number),this._modelScaleX!==t&&(this._modelScaleX=t,this.propertyChanged.raiseEvent(["modelScaleX"]))}getModelScaleX(t){const e=t.get("olcs_modelScaleX");return E(e,this.modelScaleX)}get modelScaleY(){return this._modelScaleY}set modelScaleY(t){v(t,Number),this._modelScaleY!==t&&(this._modelScaleY=t,this.propertyChanged.raiseEvent(["modelScaleY"]))}getModelScaleY(t){const e=t.get("olcs_modelScaleY");return E(e,this.modelScaleY)}get modelScaleZ(){return this._modelScaleZ}set modelScaleZ(t){v(t,Number),this._modelScaleZ!==t&&(this._modelScaleZ=t,this.propertyChanged.raiseEvent(["modelScaleZ"]))}getModelScaleZ(t){const e=t.get("olcs_modelScaleZ");return E(e,this.modelScaleZ)}get modelHeading(){return this._modelHeading}set modelHeading(t){v(t,Number),this._modelHeading!==t&&(this._modelHeading=t,this.propertyChanged.raiseEvent(["modelHeading"]))}getModelHeading(t){const e=t.get("olcs_modelHeading");return E(e,this.modelHeading)}get modelPitch(){return this._modelPitch}set modelPitch(t){v(t,Number),this._modelPitch!==t&&(this._modelPitch=t,this.propertyChanged.raiseEvent(["modelPitch"]))}getModelPitch(t){const e=t.get("olcs_modelPitch");return E(e,this.modelPitch)}get modelRoll(){return this._modelRoll}set modelRoll(t){v(t,Number),this._modelRoll!==t&&(this._modelRoll=t,this.propertyChanged.raiseEvent(["modelRoll"]))}getModelRoll(t){const e=t.get("olcs_modelRoll");return E(e,this.modelRoll)}get modelOptions(){return this._modelOptions}set modelOptions(t){it(t,Object),this._modelOptions!==t&&(this._modelOptions=t,this.propertyChanged.raiseEvent(["modelOptions"]))}getModelOptions(t){const e=t.get("olcs_modelOptions");return e||(this.modelOptions?this.modelOptions:{})}get baseUrl(){return this._baseUrl}set baseUrl(t){v(t,String),this._baseUrl!==t&&(this._baseUrl=t,this.propertyChanged.raiseEvent(["baseUrl"]))}getBaseUrl(t){const e=t.get("olcs_baseUrl");return e!==void 0?e:this.baseUrl}getModel(t){let e=this.getModelUrl(t);if(!e)return null;const s=this.getBaseUrl(t);return s&&(e=new URL(e,s).toString()),{url:e,scale:[this.getModelScaleX(t),this.getModelScaleY(t),this.getModelScaleZ(t)],heading:this.getModelHeading(t),pitch:this.getModelPitch(t),roll:this.getModelRoll(t)}}setVcsMeta(t){const e=te.getDefaultOptions();t.altitudeMode||(t.altitudeMode=Us(this.altitudeMode)),Object.assign(e,t),this.setValues(e)}setValues(t){const e=te.getDefaultOptions(),s=[];if("altitudeMode"in t){const r=ze(e.altitudeMode,ci,void 0),n=ze(t.altitudeMode,ci,r);this._altitudeMode!==n&&(this._altitudeMode=n,s.push("altitudeMode"))}if("allowPicking"in t){const r=rt(t.allowPicking,e.allowPicking);this._allowPicking!==r&&(this._allowPicking=r,s.push("allowPicking"))}if("classificationType"in t){const r=ze(e.classificationType,ui,void 0),n=ze(t.classificationType,ui,r);this._classificationType!==n&&(this._classificationType=n,s.push("classificationType"))}if("scaleByDistance"in t){const r=Xr(t.scaleByDistance,void 0);Ms.equals(r,this._scaleByDistance)||(this._scaleByDistance=r,s.push("scaleByDistance"))}if("eyeOffset"in t){const r=Zr(t.eyeOffset,void 0);C.equals(r,this._eyeOffset)||(this._eyeOffset=r,s.push("eyeOffset"))}if("heightAboveGround"in t){const r=E(t.heightAboveGround,e.heightAboveGround);r!==this._heightAboveGround&&(this._heightAboveGround=r,s.push("heightAboveGround"))}if("skirt"in t){const r=E(t.skirt,e.skirt);r!==this._skirt&&(this._skirt=r,s.push("skirt"))}if("groundLevel"in t){const r=E(t.groundLevel,e.groundLevel);r!==this._groundLevel&&(this._groundLevel=r,s.push("groundLevel"))}if("extrudedHeight"in t){const r=E(t.extrudedHeight,e.extrudedHeight);r!==this._extrudedHeight&&(this._extrudedHeight=r,s.push("extrudedHeight"))}if("storeysAboveGround"in t){const r=V(t.storeysAboveGround,e.storeysAboveGround);r!==this._storeysAboveGround&&(this._storeysAboveGround=r,s.push("storeysAboveGround"))}if("storeysBelowGround"in t){const r=V(t.storeysBelowGround,e.storeysBelowGround);r!==this._storeysBelowGround&&(this._storeysBelowGround=r,s.push("storeysBelowGround"))}if("storeyHeightsAboveGround"in t){const r=di(t.storeyHeightsAboveGround,e.storeyHeightsAboveGround);Oe(r,this._storeyHeightsAboveGround)||(this._storeyHeightsAboveGround=r,s.push("storeyHeightsAboveGround"))}if("storeyHeightsBelowGround"in t){const r=di(t.storeyHeightsBelowGround,e.storeyHeightsBelowGround);Oe(r,this._storeyHeightsBelowGround)||(this._storeyHeightsBelowGround=r,s.push("storeyHeightsBelowGround"))}if("storeyHeight"in t){const r=E(t.storeyHeight,e.storeyHeight);r!==this._storeyHeight&&(Ta().deprecate("storeyHeight","use storeyHeightAboveGround"),this._storeyHeight=r,s.push("storeyHeight"))}if("modelUrl"in t&&t.modelUrl!==this._modelUrl&&(this._modelUrl=t.modelUrl,s.push("modelUrl")),"modelScaleX"in t){const r=E(t.modelScaleX,e.modelScaleX);r!==this._modelScaleX&&(this._modelScaleX=r,s.push("modelScaleX"))}if("modelScaleY"in t){const r=E(t.modelScaleY,e.modelScaleY);r!==this._modelScaleY&&(this._modelScaleY=r,s.push("modelScaleY"))}if("modelScaleZ"in t){const r=E(t.modelScaleZ,e.modelScaleZ);r!==this._modelScaleZ&&(this._modelScaleZ=r,s.push("modelScaleZ"))}if("modelHeading"in t){const r=E(t.modelHeading,e.modelHeading);r!==this._modelHeading&&(this._modelHeading=r,s.push("modelHeading"))}if("modelPitch"in t){const r=E(t.modelPitch,e.modelPitch);r!==this._modelPitch&&(this._modelPitch=r,s.push("modelPitch"))}if("modelRoll"in t){const r=E(t.modelRoll,e.modelRoll);r!==this._modelRoll&&(this._modelRoll=r,s.push("modelRoll"))}"baseUrl"in t&&t.baseUrl!==this._baseUrl&&(this._baseUrl=t.baseUrl,s.push("baseUrl")),s.length&&this.propertyChanged.raiseEvent(s)}getValues(){return{altitudeMode:Us(this.altitudeMode),allowPicking:this.allowPicking,classificationType:Jr(this.classificationType),scaleByDistance:Kr(this.scaleByDistance),eyeOffset:Qr(this.eyeOffset),heightAboveGround:this.heightAboveGround,skirt:this.skirt,groundLevel:this.groundLevel,extrudedHeight:this.extrudedHeight,storeysAboveGround:this.storeysAboveGround,storeysBelowGround:this.storeysBelowGround,storeyHeightsAboveGround:this.storeyHeightsAboveGround,storeyHeightsBelowGround:this.storeyHeightsBelowGround,storeyHeight:this.storeyHeight,modelUrl:this.modelUrl,modelScaleX:this.modelScaleX,modelScaleY:this.modelScaleY,modelScaleZ:this.modelScaleZ,modelHeading:this.modelHeading,modelPitch:this.modelPitch,modelRoll:this.modelRoll,baseUrl:this.baseUrl}}getVcsMeta(t){const e=t||te.getDefaultOptions(),s={};return Us(this.altitudeMode)!==e.altitudeMode&&(s.altitudeMode=Us(this.altitudeMode)),this.allowPicking!==e.allowPicking&&(s.allowPicking=this.allowPicking),Jr(this.classificationType)!==e.classificationType&&(s.classificationType=Jr(this.classificationType)),Oe(Kr(this.scaleByDistance),e.scaleByDistance)||(s.scaleByDistance=Kr(this.scaleByDistance)),Oe(Qr(this.eyeOffset),e.eyeOffset)||(s.eyeOffset=Qr(this.eyeOffset)),this.heightAboveGround!==e.heightAboveGround&&(s.heightAboveGround=this.heightAboveGround),this.skirt!==e.skirt&&(s.skirt=this.skirt),this.groundLevel!==e.groundLevel&&(s.groundLevel=this.groundLevel),this.extrudedHeight!==e.extrudedHeight&&(s.extrudedHeight=this.extrudedHeight),this.storeysAboveGround!==e.storeysAboveGround&&(s.storeysAboveGround=this.storeysAboveGround),this.storeysBelowGround!==e.storeysBelowGround&&(s.storeysBelowGround=this.storeysBelowGround),Oe(this.storeyHeightsAboveGround,e.storeyHeightsAboveGround)||(s.storeyHeightsAboveGround=this.storeyHeightsAboveGround),Oe(this.storeyHeightsBelowGround,e.storeyHeightsBelowGround)||(s.storeyHeightsBelowGround=this.storeyHeightsBelowGround),this.storeyHeight!==e.storeyHeight&&(s.storeyHeight=this.storeyHeight),this.modelUrl!==e.modelUrl&&(s.modelUrl=this.modelUrl),this.modelScaleX!==e.modelScaleX&&(s.modelScaleX=this.modelScaleX),this.modelScaleY!==e.modelScaleY&&(s.modelScaleY=this.modelScaleY),this.modelScaleZ!==e.modelScaleZ&&(s.modelScaleZ=this.modelScaleZ),this.modelHeading!==e.modelHeading&&(s.modelHeading=this.modelHeading),this.modelPitch!==e.modelPitch&&(s.modelPitch=this.modelPitch),this.modelRoll!==e.modelRoll&&(s.modelRoll=this.modelRoll),this.baseUrl!==e.baseUrl&&(s.baseUrl=this.baseUrl),s}destroy(){this.propertyChanged.destroy()}}function qs(i,t){if(Yn(i,[ne,{type:String}])){if(i instanceof ne)return i;{const e=ki.createFromTypeOptions(i);if(e)return e instanceof q&&t instanceof q?t.assign(e):e}}return t||Lh.clone()}class _e extends ht{static get className(){return"FeatureLayer"}static getDefaultOptions(){return O(_({},ht.getDefaultOptions()),{style:void 0,balloonHeightOffset:10,genericFeatureProperties:{}})}constructor(t){super(t);const e=_e.getDefaultOptions();this._style=this.getStyleOrDefaultStyle(t.style),this._defaultStyle=this._style,this.styleChanged=new R,this._genericFeatureProperties=t.genericFeatureProperties||e.genericFeatureProperties,this.balloonHeightOffset=V(t.balloonHeightOffset,e.balloonHeightOffset),this.featureVisibility=t.featureVisibility||new qr}get defaultStyle(){return this._defaultStyle}get style(){return this._style}get genericFeatureProperties(){return this._genericFeatureProperties}getImplementationOptions(){return O(_({},super.getImplementationOptions()),{featureVisibility:this.featureVisibility,style:this.style})}objectClickedHandler(t){return null}getGenericFeatureFromClickedObject(t){return this.getLogger().warning("This method should be implemented by any specific layers"),null}assignGenericFeatureProperties(t){v(t,Object),Object.assign(this._genericFeatureProperties,t)}getStyleOrDefaultStyle(t,e){return qs(t,e)}setStyle(t,e){v(t,[ft,ne,Function]),t instanceof ne?this._style=t:(this._style=new q({}),this._style.style=t),this.getImplementations().forEach(s=>{s.updateStyle(this._style,e)}),this.styleChanged.raiseEvent(this._style)}clearStyle(){this.setStyle(this.defaultStyle)}toJSON(){const t=super.toJSON();return this.getStyleOrDefaultStyle().equals(this._style)||(t.style=this.style.toJSON()),Object.keys(this._genericFeatureProperties).length>0&&(t.genericFeatureProperties=_({},this._genericFeatureProperties)),t}destroy(){this.featureVisibility&&this.featureVisibility.destroy(),this.styleChanged.destroy(),super.destroy()}}ot.registerClass(_e.className,_e);class Ci extends ve{static from(t,e){const s=new Ci(e);if(t)for(const r of t)s.add(r);return s}constructor(t){super(t);this.moved=new R,this._previousIndexSymbol=Symbol("previousIndex")}get previousIndexSymbol(){return this._previousIndexSymbol}get(t){return this._array[t]}add(t,e){if(this._checkUniqueness(t)){let s=this._array.length;return e!=null&&e<this._array.length?(s=e>=0?e:0,this._array.splice(s,0,t)):this._array.push(t),this.added.raiseEvent(t),s}return null}remove(t){t[this._previousIndexSymbol]=this._array.indexOf(t),super.remove(t)}_move(t,e,s){let r=s;return r=r>=0?r:0,r=r<this._array.length?r:this._array.length-1,this._array.splice(e,1),this._array.splice(r,0,t),this.moved.raiseEvent(t),r}lower(t,e=1){const s=this._array.indexOf(t);return s>-1?this._move(t,s,s-Math.ceil(e)):null}raise(t,e=1){const s=this._array.indexOf(t);return s>-1?this._move(t,s,s+Math.ceil(e)):null}indexOf(t){return this._array.indexOf(t)}indexOfKey(t){if(!!this.uniqueKey)return this._array.findIndex(e=>e[this.uniqueKey]===t)}destroy(){super.destroy(),this.moved.destroy()}}class Nh{constructor(){this.layers=new Map}registerLayer(t){const{exclusiveGroups:e}=t;e.length>0&&(e.forEach(s=>{this.layers.has(s)||this.layers.set(s,new Set),this.layers.get(s).add(t)}),t.active&&this.handleLayerActivated(t))}unregisterLayer(t){const{exclusiveGroups:e}=t;e.length>0&&e.forEach(s=>{this.layers.get(s).delete(t)})}handleSplitDirectionChanged(t){t.active&&this.handleLayerActivated(t)}handleLayerActivated(t){const{exclusiveGroups:e}=t;if(e.length>0){const s=t.splitDirection||0;e.forEach(r=>{this.layers.has(r)&&this.layers.get(r).forEach(n=>{n!==t&&!(s&&n.splitDirection&&n.splitDirection!==s)&&n.deactivate()})})}}handleExclusiveGroupsChanged(t){[...this.layers.values()].forEach(e=>{e.delete(t)}),this.registerLayer(t)}getActiveLayersForGroup(t){const e=this.layers.get(t);if(e){const s=[];return e.forEach(r=>{r.active&&s.push(r)}),s}return[]}clear(){this.layers.clear()}destroy(){this.clear()}}class Te extends Ci{static from(t){const e=new Te;if(t)for(const s of t)e.add(s);return e}constructor(){super();this._layerEventListeners={},this._zIndexSymbol=Symbol("zIndex"),this.stateChanged=new R,this.exclusiveManager=new Nh}get zIndexSymbol(){return this._zIndexSymbol}_listenToLayerEvents(t){const e=t.stateChanged.addEventListener(a=>{a===Q.ACTIVE&&this.exclusiveManager.handleLayerActivated(t),this.stateChanged.raiseEvent(t)}),s=t.zIndexChanged.addEventListener(()=>{this._zIndexChanged(t)}),r=t.exclusiveGroupsChanged.addEventListener(()=>{this.exclusiveManager.handleExclusiveGroupsChanged(t)}),n=[e,s,r];t.splitDirectionChanged&&n.push(t.splitDirectionChanged.addEventListener(()=>{this.exclusiveManager.handleSplitDirectionChanged(t)})),this._layerEventListeners[t.name]=n}_findZIndexPosition(t){const e=this._array.findIndex(s=>s[this._zIndexSymbol]>t);return e>-1?e:null}_zIndexChanged(t){const e=this.indexOf(t);if(e>-1){t[this._zIndexSymbol]=t.zIndex;let s=this._findZIndexPosition(t.zIndex);s>0&&s>e&&(s-=1),s=s!=null?s:this._array.length-1,this._move(t,e,s),this._ensureLocalZIndex(t)}}_ensureLocalZIndex(t){const e=this.indexOf(t);if(e>0){const s=this._array[e-1][this._zIndexSymbol];s>t[this._zIndexSymbol]&&(t[this._zIndexSymbol]=s)}if(e<this._array.length-1){const s=this._array[e+1][this._zIndexSymbol];s<t[this._zIndexSymbol]&&(t[this._zIndexSymbol]=s)}}add(t,e){let s=e;e==null&&(s=this._findZIndexPosition(t.zIndex));const r=super.add(t,s);return r!=null&&(t[this._zIndexSymbol]=t.zIndex,this._ensureLocalZIndex(t),this._listenToLayerEvents(t),this.exclusiveManager.registerLayer(t)),r}_remove(t){return this._layerEventListeners[t.name]&&(this._layerEventListeners[t.name].forEach(e=>{e()}),delete this._layerEventListeners[t.name]),delete t[this._zIndexSymbol],this.exclusiveManager.unregisterLayer(t),super._remove(t)}clear(){Object.values(this._layerEventListeners).flat().forEach(t=>{t()}),this._array.forEach(t=>{delete t[this._zIndexSymbol]}),this.exclusiveManager.clear(),this._layerEventListeners={},super.clear()}destroy(){Object.values(this._layerEventListeners).flat().forEach(t=>{t()}),this._layerEventListeners={},this.exclusiveManager.destroy(),super.destroy()}}const Jt={INACTIVE:1,ACTIVE:2,LOADING:4},q0={};class Ee extends re{static get className(){return"VcsMap"}static get specificLayerImpl(){return q0}static getDefaultOptions(){return{fallbackMap:void 0}}constructor(t){super(t);this.mapElement=document.createElement("div"),this.mapElement.setAttribute("id",Xt()),this.mapElement.classList.add("mapElement"),this.mapElement.style.display="none",this._target=null,t.target&&this.setTarget(t.target),this._layerCollection=t.layerCollection||new Te,this.destroyLayerCollection=!t.layerCollection,this._collectionListeners=[],this._setLayerCollectionListeners(),this.initialized=!1,this.movementDisabled=!1,this.fallbackMap=t.fallbackMap||null,this._visualizations=new Map,this._state=Jt.INACTIVE,this.stateChanged=new R,this.pointerInteractionEvent=new R,this.splitScreen=null}get active(){return this._state===Jt.ACTIVE}get loading(){return this._state===Jt.LOADING}get target(){return this._target}get layerCollection(){return this._layerCollection}set layerCollection(t){v(t,Te),this.destroyLayerCollection=!1,[...this._layerCollection].forEach(e=>{e.removedFromMap(this)}),this._layerCollection=t,this.active&&[...this._layerCollection].forEach(e=>{e.mapActivated(this)}),this._setLayerCollectionListeners()}_setLayerCollectionListeners(){this._collectionListeners.forEach(t=>{t()}),this._collectionListeners=[this.layerCollection.moved.addEventListener(t=>{this.indexChanged(t)}),this.layerCollection.added.addEventListener(t=>{this._layerAdded(t)}),this.layerCollection.removed.addEventListener(t=>{this._layerRemoved(t)})]}canShowViewpoint(t){return Promise.resolve(!0)}setTarget(t){it(t,[String,HTMLElement]),this._target&&this._target.removeChild(this.mapElement),this._target=typeof t=="string"?document.getElementById(t):t,this._target&&this._target.appendChild(this.mapElement)}async initialize(){}indexChanged(t){}_layerAdded(t){this.active&&t.mapActivated(this)}_layerRemoved(t){t.removedFromMap(this)}validateVisualization(t){const e=t[z];return e==null?(this.getLogger().warning("item is missing vcsLayerName symbol"),!1):this.layerCollection.hasKey(e)}addVisualization(t){if(!this.validateVisualization(t))throw new Error("Visualization item is not valid, validate before adding");const e=t[z];this._visualizations.has(e)||this._visualizations.set(e,new Set),this._visualizations.get(e).add(t)}removeVisualization(t){const e=t[z],s=this._visualizations.get(e);s&&(s.delete(t),s.size===0&&this._visualizations.delete(e))}getVisualizationsForLayer(t){return this._visualizations.get(t.name)}getVisualizations(){return[...this._visualizations.values()].map(t=>[...t]).flat()}async activate(){if(this._state===Jt.INACTIVE){if(this._state=Jt.LOADING,this.stateChanged.raiseEvent(Jt.LOADING),this.mapElement.style.display="",await this.initialize(),this._state!==Jt.LOADING||(this._state=Jt.ACTIVE,await Promise.all([...this.layerCollection].map(t=>t.mapActivated(this))),this._state!==Jt.ACTIVE))return;this.stateChanged.raiseEvent(this._state)}}deactivate(){this._state!==Jt.INACTIVE&&(this.mapElement.style.display="none",this._state=Jt.INACTIVE,[...this.layerCollection].forEach(t=>{t.mapDeactivated(this)}),this.stateChanged.raiseEvent(this._state))}disableMovement(t){this.movementDisabled=t}gotoViewPoint(t,e){return Promise.resolve()}async getViewPoint(){return null}getViewPointSync(){return null}getCurrentResolution(t){return 1}pointIsVisible(t){return!1}requestRender(){}toJSON(){const t=super.toJSON();return this.fallbackMap&&(t.fallbackMap=this.fallbackMap),t}destroy(){super.destroy(),this.mapElement&&(this.mapElement.parentElement&&this.mapElement.parentElement.removeChild(this.mapElement),this.mapElement=null),this._target=null,this._collectionListeners.forEach(t=>{t()}),this._collectionListeners=[],this.layerCollection&&[...this.layerCollection].forEach(t=>{t.removedFromMap(this)}),this.stateChanged&&(this.stateChanged.destroy(),this.stateChanged=null),this.destroyLayerCollection&&this.layerCollection&&this.layerCollection.destroy(),this.pointerInteractionEvent&&(this.pointerInteractionEvent.destroy(),this.pointerInteractionEvent=null),this._layerCollection=null}}ri.registerClass(Ee.className,Ee);let U=1;class kt{static get interactionTypeCounter(){return U}static getNextBit(t){return t<<1}}const lt={NONE:U=kt.getNextBit(U),ALT:U=kt.getNextBit(U),CTRL:U=kt.getNextBit(U),SHIFT:U=kt.getNextBit(U),ALL:0};lt.ALL=lt.NONE|lt.ALT|lt.CTRL|lt.SHIFT;const k={NONE:0,CLICK:U=kt.getNextBit(U),DBLCLICK:U=kt.getNextBit(U),DRAG:U=kt.getNextBit(U),DRAGSTART:U=kt.getNextBit(U),DRAGEND:U=kt.getNextBit(U),MOVE:U=kt.getNextBit(U),DRAGEVENTS:0,CLICKMOVE:0,ALL:0};k.DRAGEVENTS=k.DRAG|k.DRAGEND|k.DRAGSTART,k.CLICKMOVE=k.CLICK|k.MOVE,k.ALL=Object.values(k).reduce((i,t)=>i|t,0);const mt={LEFT:U=kt.getNextBit(U),RIGHT:U=kt.getNextBit(U),MIDDLE:U=kt.getNextBit(U),ALL:0};mt.ALL=mt.LEFT|mt.RIGHT|mt.MIDDLE;const zt={DOWN:1,UP:2,MOVE:3};function Dh(i,t,e){const s=e.indexOfKey(t[z]);if(s>-1){const r=i.getArray();if(!r.includes(t)){let n=r.findIndex(a=>e.indexOfKey(a[z])>s);n===-1&&(n=r.length),i.insertAt(n,t)}}}class Ws extends Ee{static get className(){return"BaseOLMap"}constructor(t){super(t);this._olMap=null,this._olListeners=[]}get olMap(){return this._olMap}_raisePointerInteraction(t,e){const s={"-1":mt.ALL,0:mt.LEFT,1:mt.MIDDLE,2:mt.RIGHT};let r=t.originalEvent.shiftKey?lt.SHIFT:lt.NONE;r=t.originalEvent.ctrlKey?lt.CTRL:r,r=t.originalEvent.altKey?lt.ALT:r,r!==lt.NONE&&t.preventDefault(),t.originalEvent.preventDefault();const n=[t.coordinate[0],t.coordinate[1],0];this.pointerInteractionEvent.raiseEvent({map:this,position:n,positionOrPixel:n,windowPosition:Ht.fromArray(t.pixel,0,new Ht),key:r,pointer:s[t.originalEvent.button||0],pointerEvent:e})}setTarget(t){super.setTarget(t),this._olMap&&this.target&&this._olMap.updateSize()}async initialize(){if(!this._olMap){this._olMap=new md({layers:[],controls:[],interactions:pd({altShiftDragRotate:!1,pinchRotate:!1,shiftDragZoom:!1,doubleClickZoom:!1}),target:this.mapElement});const t=this.olMap.on("pointerdown",r=>{this._raisePointerInteraction(r,zt.DOWN)}),e=this.olMap.on("pointerup",r=>{this._raisePointerInteraction(r,zt.UP)}),s=this.olMap.on("pointermove",r=>{this._raisePointerInteraction(r,zt.MOVE)});this._olListeners.push(t,e,s)}}async activate(){await super.activate(),this.active&&this._olMap.updateSize()}indexChanged(t){const e=this.getVisualizationsForLayer(t);e&&e.forEach(s=>{const r=this._olMap.getLayers();r.remove(s),Dh(r,s,this.layerCollection)})}addOLLayer(t){this.validateVisualization(t)&&(this.addVisualization(t),Dh(this._olMap.getLayers(),t,this.layerCollection))}removeOLLayer(t){this.removeVisualization(t),this._olMap.getLayers().remove(t)}disableMovement(t){super.disableMovement(t),this._olMap&&this._olMap.getInteractions().forEach(e=>{e.setActive(!t)})}getCurrentResolution(t){const e=this.olMap?this.olMap.getView():null;return e?e.getResolution():1}requestRender(){this._olMap&&this._olMap.render()}destroy(){this._olMap&&this._olMap.setTarget(null),yt(this._olListeners),super.destroy()}}ri.registerClass(Ws.className,Ws);class tt extends Ws{static get className(){return"OpenlayersMap"}static getDefaultOptions(){return O(_({},Ee.getDefaultOptions()),{fixedNorthOrientation:!0})}constructor(t){super(t);const e=tt.getDefaultOptions();this.fixedNorthOrientation=rt(t.fixedNorthOrientation,e.fixedNorthOrientation)}async initialize(){this.initialized||(await super.initialize(),this.olMap.setView(new On({center:[1.2309226203948376e6,6350766117974091e-9],zoom:13})),this.initialized=!0)}async getViewPoint(){return this.getViewPointSync()}getViewPointSync(){const t=this.olMap.getView(),e=t.getCenter(),s=dt(t.getProjection(),"EPSG:4326"),r=Math.PI/3,n=this.olMap.getViewport(),a={};a.height=n.offsetHeight||1,a.width=n.offsetWidth||1;const o=a.width/a.height,l=Math.atan(Math.tan(r*.5)/o)*2,h=s(e.slice(0,2),void 0,void 0),c=t.getProjection().getMetersPerUnit(),d=t.getResolution()*a.height,f=Math.cos(Math.abs(P.toRadians(h[1]))),g=d*c*f,m=Math.abs(g/2/Math.tan(l/2)),p=-P.toDegrees(t.getRotation()),y=h,M=-90;return new oe({groundPosition:y,pitch:M,heading:p,distance:m})}gotoViewPoint(t){if(this.movementDisabled||!t.isValid())return Promise.resolve();this.fixedNorthOrientation&&(t.heading=0);const e=this.olMap.getView(),s=dt("EPSG:4326",e.getProjection());let r=[];t.groundPosition?r=t.groundPosition.slice(0,2):r=t.cameraPosition.slice(0,2);const{distance:n}=t,a=s(r,void 0,void 0),o=Math.PI/3,l=this.olMap.getViewport(),h={};h.height=l.offsetHeight?l.offsetHeight:1,h.width=l.offsetWidth?l.offsetWidth:1;const c=h.width/h.height,u=Math.atan(Math.tan(o*.5)/c)*2,d=2*n*Math.tan(u/2),f=e.getProjection().getMetersPerUnit(),g=Math.cos(Math.abs(P.toRadians(r[1]))),p=d/f/g/h.height;if(t.animate){let y=0;return!this.fixedNorthOrientation&&t.heading!=null&&(y=-P.toRadians(t.heading)),new Promise(M=>{e.animate({duration:t.duration?t.duration*1e3:100,center:a,easing:yd,resolution:p,rotation:y},()=>{M()})})}else e.setCenter(a),e.setResolution(p),!this.fixedNorthOrientation&&t.heading!=null&&e.setRotation(-P.toRadians(t.heading));return Promise.resolve()}pointIsVisible(t){const e=this.olMap.getView(),s=e.calculateExtent(this.olMap.getSize()),r=dt(e.getProjection(),"EPSG:4326"),n=[s[0],s[3]],a=[s[2],s[1]],o=[r(n,void 0,void 0),r(a,void 0,void 0)];return ko(_s(o),t[0],t[1])}toJSON(){const t=super.toJSON(),e=tt.getDefaultOptions();return this.fixedNorthOrientation!==e.fixedNorthOrientation&&(t.fixedNorthOrientation=this.fixedNorthOrientation),t}}ri.registerClass(tt.className,tt);class Ue extends re{static get className(){return"LayerImplementation"}constructor(t,e){super(e);this.map=t,this.url=e.url,this._state=Q.INACTIVE,this._initialized=!1}get initialized(){return this._initialized}get active(){return this._state===Q.ACTIVE}get loading(){return this._state===Q.LOADING}async initialize(){this._initialized=!0}async activate(){this.map.active&&!this.active&&(this._state=Q.LOADING,await this.initialize(),this.loading&&(this._state=Q.ACTIVE))}deactivate(){this._state=Q.INACTIVE}destroy(){this._initialized=!1,this._state=Q.INACTIVE,this.map=null,super.destroy()}}class Ys extends Ue{static get className(){return"LayerOpenlayersImpl"}constructor(t,e){super(t,e);this.olLayer=null}initialize(){return this.initialized||(this.olLayer=this.getOLLayer(),this.olLayer[z]=this.name,this.map.addOLLayer(this.olLayer)),super.initialize()}async activate(){await super.activate(),this.active&&this.olLayer.setVisible(!0)}deactivate(){super.deactivate(),this.olLayer&&this.olLayer.setVisible(!1)}getOLLayer(){throw new Error}destroy(){this.olLayer&&this.map.removeOLLayer(this.olLayer),this.olLayer=null,super.destroy()}}function Fh(i,t,e){const s={flat:!0,renderState:{depthTest:{enabled:!0}}},r=t.getColor();if(r instanceof CanvasPattern){const n=document.createElement("canvas"),a=n.getContext("2d");a.fillStyle=r,a.fillRect(0,0,300,300),s.material=Pi.fromType("Wallpaper",{image:n,anchor:Zd.wgs84ToDrawingBufferCoordinates(i,C.fromDegreesArray(Pn(e.getGeometry().getExtent()))[0])})}else{const n=ai(r,[0,0,0,1]);s.material=Pi.fromType("Color",{color:n}),s.translucent=n.alpha!==1}return new Jd(s)}function Rh(i,t,e,s){const r=t.map(o=>new vr({geometry:o,attributes:{color:Ko.fromColor(e)}})),n=new An({flat:!1,renderState:{depthTest:{enabled:!0},lineWidth:1},translucent:e.alpha!==1}),a=O(_({},i),{geometryInstances:r,appearance:n,shadows:Cs.ENABLED,classificationType:s});return new Qo(a)}function Ah(i,t,e,s,r,n,a){const o=t.getClassificationType(s),l={shadows:Cs.ENABLED,allowPicking:e};let h;if(o!==void 0&&!a){if(!Qo.isSupported(i))return null;const c=ai(n.getFill().getColor(),[0,0,0,1]);h=Rh(l,r,c,o)}else{const c=r.map(d=>new vr({geometry:d}));l.geometryInstances=c;const u=Fh(i,n.getFill(),s);if(l.appearance=u,a){if(!tl.isSupported(i))return null;l.classificationType=o||Ei.TERRAIN,h=new tl(l)}else h=new Gn(l)}return h}function Gh(i,t,e,s,r,n){const a=ai(n.getStroke().getColor(),[0,0,0,1]),o=r.map(u=>new vr({geometry:u,attributes:{color:Ko.fromColor(a)}})),l=new An({flat:!0,renderState:{depthTest:{enabled:!0},lineWidth:1},translucent:a.alpha!==1}),h={geometryInstances:o,appearance:l,shadows:Cs.ENABLED,allowPicking:e};return new Gn(h)}function Na(i,t,e,s,r,n,a){const o=t.getClassificationType(s),l=r.map(g=>new vr({geometry:g})),h=ai(n.getStroke().getColor(),[0,0,0,1]);let c;n.getStroke().getLineDash()?c=Pi.fromType("Stripe",{horizontal:!1,repeat:500,evenColor:h,oddColor:new Ot(0,0,0,0)}):c=Pi.fromType("Color",{color:h});const u=new Kd({renderState:{depthTest:{enabled:!0},lineWidth:1},translucent:h.alpha!==1,material:c}),d={geometryInstances:l,appearance:u,shadows:Cs.ENABLED,allowPicking:e};let f;if(a){if(!el.isSupported(i))return null;d.classificationType=o||Ei.TERRAIN,f=new el(d)}else f=new Gn(d);return f}function kh(i,t){if(i!=null&&Number.isFinite(Number(i)))return i;if(t){let e=1/0;for(let s=0;s<t.length;s++)e=t[s][2]<e?t[s][2]:e;if(Number.isFinite(e))return e}return 0}function Da(i,t,e){const s=Math.abs(i),r=[];if(t.length){let n=0;for(let o=0;o<t.length;o++)if(n+=t[o],n<s)r.push(t[o]);else return r.push(t[o]-(n-s)),r;const a=t[t.length-1];for(;n<s;)if(n+=a,n<s)r.push(a);else return r.push(a-(n-s)),r}else if(e)return new Array(e).fill(s/e);return[s]}function Fa(i,t){if(i&&t.length){const e=i-t.length;e>0?t.push(...new Array(e).fill(t[t.length-1])):e<0&&t.splice(t.length+e),i>100&&t.splice(100)}else t.splice(0)}function zh(i,t,e){return t===Yt.RELATIVE_TO_GROUND?e.getHeightAboveGround(i):0}function tn(i,t,e){const s=t.getExtrudedHeight(i),r=Math.abs(V(i.get("olcs_storeyNumber"),0)),n=Math.abs(E(i.get("olcs_storeyHeight"),0));let a=0,o=0,l=[],h=[];if(n||r)if(s&&s>0&&n)a=Math.ceil(s/n),l=new Array(a-1).fill(n),l.push(s-(a-1)*n);else if(s&&s<0&&n)o=Math.ceil(Math.abs(s/n)),h=new Array(o-1).fill(n),h.push(Math.abs(s)-(o-1)*n);else if(s&&s>0&&r){a=r;const M=Math.abs(s/r);l=new Array(r).fill(M)}else if(s&&s<0&&r){o=r;const M=Math.abs(s/r);h=new Array(r).fill(M)}else r&&n?(a=r,l=new Array(r).fill(n)):r&&t.storeyHeight&&(a=r,l=new Array(r).fill(t.storeyHeight));!(a&&l.length)&&!(o&&h.length)&&(a=t.getStoreysAboveGround(i),o=t.getStoreysBelowGround(i),l=t.getStoreyHeightsAboveGround(i),h=t.getStoreyHeightsBelowGround(i),s&&(s>0?(l=Da(s,l,a),a=l.length,h=[],o=0):s<0&&(h=Da(s,h,o),o=h.length,l=[],a=0))),Fa(a,l),Fa(o,h);const c=t.getSkirt(i),u=t.getGroundLevel(i),d=t.getAltitudeMode(i),f=zh(i,d,t),g=kh(u,e)+f,m=!!e.find(M=>M[2]),p=!!(l.length||h.length||c),y=m&&(!p||p&&l.length+h.length===1);return{extruded:p,storeyHeightsAboveGround:l,storeyHeightsBelowGround:h,skirt:c,groundLevel:g,perPositionHeight:y,heightReference:d,heightAboveGroundAdjustment:f}}function Ra(i,t,e,s){const r=e?-1:1;let n=t;const a=i.length,o=new Array(a);for(let l=0;l<a;l++){const h=n+r*i[l];o[l]={currentHeight:n,extrudedHeight:h},n=h}return s?(s.push(...o),s):o}function en(i,t,e,s,r,n,a){if(!e.length)return;const o=[],l=[],h=[],c=tn(i,s,n.getCoordinates(e)),u=!!t.getFill(),d=!!t.getStroke();let f=!1;e.forEach(p=>{const y=n.getGeometryOptions(p,c.heightAboveGroundAdjustment),M=Ra(c.storeyHeightsAboveGround,c.groundLevel);if(Ra(c.storeyHeightsBelowGround,c.groundLevel,!0,M),u&&M.forEach(x=>{o.push(...n.createSolidGeometries(y,x.currentHeight,c.perPositionHeight,x.extrudedHeight))}),d&&M.forEach(x=>{l.push(...n.createOutlineGeometries(y,x.currentHeight,c.perPositionHeight,x.extrudedHeight))}),c.skirt){const x=c.groundLevel-c.storeyHeightsBelowGround.reduce((D,Y)=>D+Y,0),L=x-c.skirt,I=c.storeyHeightsBelowGround.length?!1:c.perPositionHeight;u&&o.push(...n.createSolidGeometries(y,x,I,L)),d&&l.push(...n.createOutlineGeometries(y,x,I,L))}c.extruded||(c.heightReference===Yt.CLAMP_TO_GROUND&&(f=!0),u&&o.push(...n.createFillGeometries(y,c.groundLevel,c.perPositionHeight)),d&&(c.heightReference===Yt.CLAMP_TO_GROUND?h.push(...n.createGroundLineGeometries(y,t)):h.push(...n.createLineGeometries(y,t))))});const g=s.getAllowPicking(i),m=[];if(h.length){const p=Na(r,s,g,i,h,t,f);p&&m.push(p)}if(o.length){const p=Ah(r,s,g,i,o,t,f);p&&m.push(p)}if(l.length){const p=Gh(r,s,g,i,l,t);p&&m.push(p)}a.addPrimitives(m,i,g)}var qt={XY:"XY",XYZ:"XYZ",XYM:"XYM",XYZM:"XYZM"},Aa={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"},W0=function(){function i(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}return i.prototype.preventDefault=function(){this.defaultPrevented=!0},i.prototype.stopPropagation=function(){this.propagationStopped=!0},i}(),jh=W0,Y0={PROPERTYCHANGE:"propertychange"},X0=function(){function i(){this.disposed=!1}return i.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},i.prototype.disposeInternal=function(){},i}(),Z0=X0;function J0(i,t){return i>t?1:i<t?-1:0}function K0(i,t){for(var e=Array.isArray(t)?t:[t],s=e.length,r=0;r<s;r++)i[i.length]=e[r]}function Q0(i,t){var e=i.length;if(e!==t.length)return!1;for(var s=0;s<e;s++)if(i[s]!==t[s])return!1;return!0}function $h(){}function tv(i){var t=!1,e,s,r;return function(){var n=Array.prototype.slice.call(arguments);return(!t||this!==r||!Q0(n,s))&&(t=!0,r=this,s=n,e=i.apply(this,arguments)),e}}var Hh=typeof Object.assign=="function"?Object.assign:function(i,t){if(i==null)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(i),s=1,r=arguments.length;s<r;++s){var n=arguments[s];if(n!=null)for(var a in n)n.hasOwnProperty(a)&&(e[a]=n[a])}return e};function Vh(i){for(var t in i)delete i[t]}function ev(i){var t;for(t in i)return!1;return!t}var iv=globalThis&&globalThis.__extends||function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[n]=r[n])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function s(){this.constructor=t}t.prototype=e===null?Object.create(e):(s.prototype=e.prototype,new s)}}(),sv=function(i){iv(t,i);function t(e){var s=i.call(this)||this;return s.eventTarget_=e,s.pendingRemovals_=null,s.dispatching_=null,s.listeners_=null,s}return t.prototype.addEventListener=function(e,s){if(!(!e||!s)){var r=this.listeners_||(this.listeners_={}),n=r[e]||(r[e]=[]);n.indexOf(s)===-1&&n.push(s)}},t.prototype.dispatchEvent=function(e){var s=typeof e=="string",r=s?e:e.type,n=this.listeners_&&this.listeners_[r];if(!!n){var a=s?new jh(e):e;a.target||(a.target=this.eventTarget_||this);var o=this.dispatching_||(this.dispatching_={}),l=this.pendingRemovals_||(this.pendingRemovals_={});r in o||(o[r]=0,l[r]=0),++o[r];for(var h,c=0,u=n.length;c<u;++c)if("handleEvent"in n[c]?h=n[c].handleEvent(a):h=n[c].call(this,a),h===!1||a.propagationStopped){h=!1;break}if(--o[r]===0){var d=l[r];for(delete l[r];d--;)this.removeEventListener(r,$h);delete o[r]}return h}},t.prototype.disposeInternal=function(){this.listeners_&&Vh(this.listeners_)},t.prototype.getListeners=function(e){return this.listeners_&&this.listeners_[e]||void 0},t.prototype.hasListener=function(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1},t.prototype.removeEventListener=function(e,s){var r=this.listeners_&&this.listeners_[e];if(r){var n=r.indexOf(s);n!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(r[n]=$h,++this.pendingRemovals_[e]):(r.splice(n,1),r.length===0&&delete this.listeners_[e]))}},t}(Z0),rv=sv,nv={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function Ga(i,t,e,s,r){if(s&&s!==i&&(e=e.bind(s)),r){var n=e;e=function(){i.removeEventListener(t,e),n.apply(this,arguments)}}var a={target:i,type:t,listener:e};return i.addEventListener(t,e),a}function Bh(i,t,e,s){return Ga(i,t,e,s,!0)}function Uh(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),Vh(i))}var av=globalThis&&globalThis.__extends||function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[n]=r[n])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function s(){this.constructor=t}t.prototype=e===null?Object.create(e):(s.prototype=e.prototype,new s)}}(),sn=function(i){av(t,i);function t(){var e=i.call(this)||this;return e.on=e.onInternal,e.once=e.onceInternal,e.un=e.unInternal,e.revision_=0,e}return t.prototype.changed=function(){++this.revision_,this.dispatchEvent(nv.CHANGE)},t.prototype.getRevision=function(){return this.revision_},t.prototype.onInternal=function(e,s){if(Array.isArray(e)){for(var r=e.length,n=new Array(r),a=0;a<r;++a)n[a]=Ga(this,e[a],s);return n}else return Ga(this,e,s)},t.prototype.onceInternal=function(e,s){var r;if(Array.isArray(e)){var n=e.length;r=new Array(n);for(var a=0;a<n;++a)r[a]=Bh(this,e[a],s)}else r=Bh(this,e,s);return s.ol_key=r,r},t.prototype.unInternal=function(e,s){var r=s.ol_key;if(r)ov(r);else if(Array.isArray(e))for(var n=0,a=e.length;n<a;++n)this.removeEventListener(e[n],s);else this.removeEventListener(e,s)},t}(rv);sn.prototype.on,sn.prototype.once,sn.prototype.un;function ov(i){if(Array.isArray(i))for(var t=0,e=i.length;t<e;++t)Uh(i[t]);else Uh(i)}var lv=sn;function Kt(){return function(){throw new Error("Unimplemented abstract method.")}()}var hv=0;function cv(i){return i.ol_uid||(i.ol_uid=String(++hv))}var qh=globalThis&&globalThis.__extends||function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[n]=r[n])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function s(){this.constructor=t}t.prototype=e===null?Object.create(e):(s.prototype=e.prototype,new s)}}(),Wh=function(i){qh(t,i);function t(e,s,r){var n=i.call(this,e)||this;return n.key=s,n.oldValue=r,n}return t}(jh),uv=function(i){qh(t,i);function t(e){var s=i.call(this)||this;return s.on,s.once,s.un,cv(s),s.values_=null,e!==void 0&&s.setProperties(e),s}return t.prototype.get=function(e){var s;return this.values_&&this.values_.hasOwnProperty(e)&&(s=this.values_[e]),s},t.prototype.getKeys=function(){return this.values_&&Object.keys(this.values_)||[]},t.prototype.getProperties=function(){return this.values_&&Hh({},this.values_)||{}},t.prototype.hasProperties=function(){return!!this.values_},t.prototype.notify=function(e,s){var r;r="change:".concat(e),this.hasListener(r)&&this.dispatchEvent(new Wh(r,e,s)),r=Y0.PROPERTYCHANGE,this.hasListener(r)&&this.dispatchEvent(new Wh(r,e,s))},t.prototype.addChangeListener=function(e,s){this.addEventListener("change:".concat(e),s)},t.prototype.removeChangeListener=function(e,s){this.removeEventListener("change:".concat(e),s)},t.prototype.set=function(e,s,r){var n=this.values_||(this.values_={});if(r)n[e]=s;else{var a=n[e];n[e]=s,a!==s&&this.notify(e,a)}},t.prototype.setProperties=function(e,s){for(var r in e)this.set(r,e[r],s)},t.prototype.applyProperties=function(e){!e.values_||Hh(this.values_||(this.values_={}),e.values_)},t.prototype.unset=function(e,s){if(this.values_&&e in this.values_){var r=this.values_[e];delete this.values_[e],ev(this.values_)&&(this.values_=null),s||this.notify(e,r)}},t}(lv),dv=uv,$i={RADIANS:"radians",DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"},Hi={};Hi[$i.RADIANS]=6370997/(2*Math.PI),Hi[$i.DEGREES]=2*Math.PI*6370997/360,Hi[$i.FEET]=.3048,Hi[$i.METERS]=1,Hi[$i.USFEET]=1200/3937;var ka=$i;new Array(6);function fv(){return[1,0,0,1,0,0]}function gv(i,t,e,s,r,n,a,o){var l=Math.sin(n),h=Math.cos(n);return i[0]=s*h,i[1]=r*l,i[2]=-s*l,i[3]=r*h,i[4]=a*s*h-o*s*l+t,i[5]=a*r*l+o*r*h+e,i}var St={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Yh(i,t,e){var s,r;return t<i[0]?s=i[0]-t:i[2]<t?s=t-i[2]:s=0,e<i[1]?r=i[1]-e:i[3]<e?r=e-i[3]:r=0,s*s+r*r}function mv(i,t){return i[0]<=t[0]&&t[2]<=i[2]&&i[1]<=t[1]&&t[3]<=i[3]}function pv(i,t,e){return i[0]<=t&&t<=i[2]&&i[1]<=e&&e<=i[3]}function Xh(i,t){var e=i[0],s=i[1],r=i[2],n=i[3],a=t[0],o=t[1],l=St.UNKNOWN;return a<e?l=l|St.LEFT:a>r&&(l=l|St.RIGHT),o<s?l=l|St.BELOW:o>n&&(l=l|St.ABOVE),l===St.UNKNOWN&&(l=St.INTERSECTING),l}function Zh(){return[1/0,1/0,-1/0,-1/0]}function Jh(i,t,e,s,r){return r?(r[0]=i,r[1]=t,r[2]=e,r[3]=s,r):[i,t,e,s]}function Kh(i){return Jh(1/0,1/0,-1/0,-1/0,i)}function yv(i,t){var e=i[0],s=i[1];return Jh(e,s,e,s,t)}function vv(i,t,e,s,r){var n=Kh(r);return Qh(n,i,t,e,s)}function Qh(i,t,e,s,r){for(;e<s;e+=r)_v(i,t[e],t[e+1]);return i}function _v(i,t,e){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}function Sv(i,t){var e;return e=t(Mv(i)),e||(e=t(Cv(i)),e)||(e=t(xv(i)),e)||(e=t(wv(i)),e)?e:!1}function Mv(i){return[i[0],i[1]]}function Cv(i){return[i[2],i[1]]}function tc(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function ec(i){return i[3]-i[1]}function wv(i){return[i[0],i[3]]}function xv(i){return[i[2],i[3]]}function bv(i,t){return i[0]<=t[2]&&i[2]>=t[0]&&i[1]<=t[3]&&i[3]>=t[1]}function Ov(i,t){return t?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t):i}function Pv(i,t,e){var s=!1,r=Xh(i,t),n=Xh(i,e);if(r===St.INTERSECTING||n===St.INTERSECTING)s=!0;else{var a=i[0],o=i[1],l=i[2],h=i[3],c=t[0],u=t[1],d=e[0],f=e[1],g=(f-u)/(d-c),m=void 0,p=void 0;!!(n&St.ABOVE)&&!(r&St.ABOVE)&&(m=d-(f-h)/g,s=m>=a&&m<=l),!s&&!!(n&St.RIGHT)&&!(r&St.RIGHT)&&(p=f-(d-l)*g,s=p>=o&&p<=h),!s&&!!(n&St.BELOW)&&!(r&St.BELOW)&&(m=d-(f-o)/g,s=m>=a&&m<=l),!s&&!!(n&St.LEFT)&&!(r&St.LEFT)&&(p=f-(d-a)*g,s=p>=o&&p<=h)}return s}var Ev=function(){function i(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}return i.prototype.canWrapX=function(){return this.canWrapX_},i.prototype.getCode=function(){return this.code_},i.prototype.getExtent=function(){return this.extent_},i.prototype.getUnits=function(){return this.units_},i.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||Hi[this.units_]},i.prototype.getWorldExtent=function(){return this.worldExtent_},i.prototype.getAxisOrientation=function(){return this.axisOrientation_},i.prototype.isGlobal=function(){return this.global_},i.prototype.setGlobal=function(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)},i.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},i.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t},i.prototype.setExtent=function(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)},i.prototype.setWorldExtent=function(t){this.worldExtent_=t},i.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t},i.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},i}(),ic=Ev,Iv=function(){var i;return"cosh"in Math?i=Math.cosh:i=function(t){var e=Math.exp(t);return(e+1/e)/2},i}();function Lv(i,t,e,s,r,n){var a=r-e,o=n-s;if(a!==0||o!==0){var l=((i-e)*a+(t-s)*o)/(a*a+o*o);l>1?(e=r,s=n):l>0&&(e+=a*l,s+=o*l)}return Vi(i,t,e,s)}function Vi(i,t,e,s){var r=e-i,n=s-t;return r*r+n*n}function Tv(i,t){var e=i%t;return e*t<0?e+t:e}function Nv(i,t,e){return i+e*(t-i)}var Dv=globalThis&&globalThis.__extends||function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[n]=r[n])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function s(){this.constructor=t}t.prototype=e===null?Object.create(e):(s.prototype=e.prototype,new s)}}(),Xs=6378137,Bi=Math.PI*Xs,Fv=[-Bi,-Bi,Bi,Bi],Rv=[-180,-85,180,85],rn=Xs*Math.log(Math.tan(Math.PI/2)),Ui=function(i){Dv(t,i);function t(e){return i.call(this,{code:e,units:ka.METERS,extent:Fv,global:!0,worldExtent:Rv,getPointResolution:function(s,r){return s/Iv(r[1]/Xs)}})||this}return t}(ic),sc=[new Ui("EPSG:3857"),new Ui("EPSG:102100"),new Ui("EPSG:102113"),new Ui("EPSG:900913"),new Ui("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ui("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Av(i,t,e){var s=i.length,r=e>1?e:2,n=t;n===void 0&&(r>2?n=i.slice():n=new Array(s));for(var a=0;a<s;a+=r){n[a]=Bi*i[a]/180;var o=Xs*Math.log(Math.tan(Math.PI*(+i[a+1]+90)/360));o>rn?o=rn:o<-rn&&(o=-rn),n[a+1]=o}return n}function Gv(i,t,e){var s=i.length,r=e>1?e:2,n=t;n===void 0&&(r>2?n=i.slice():n=new Array(s));for(var a=0;a<s;a+=r)n[a]=180*i[a]/Bi,n[a+1]=360*Math.atan(Math.exp(i[a+1]/Xs))/Math.PI-90;return n}var kv=globalThis&&globalThis.__extends||function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[n]=r[n])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function s(){this.constructor=t}t.prototype=e===null?Object.create(e):(s.prototype=e.prototype,new s)}}(),zv=6378137,rc=[-180,-90,180,90],jv=Math.PI*zv/180,fi=function(i){kv(t,i);function t(e,s){return i.call(this,{code:e,units:ka.DEGREES,extent:rc,axisOrientation:s,global:!0,metersPerUnit:jv,worldExtent:rc})||this}return t}(ic),nc=[new fi("CRS:84"),new fi("EPSG:4326","neu"),new fi("urn:ogc:def:crs:OGC:1.3:CRS84"),new fi("urn:ogc:def:crs:OGC:2:84"),new fi("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new fi("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new fi("http://www.opengis.net/def/crs/EPSG/0/4326","neu")],za={};function $v(i){return za[i]||za[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Hv(i,t){za[i]=t}var qi={};function nn(i,t,e){var s=i.getCode(),r=t.getCode();s in qi||(qi[s]={}),qi[s][r]=e}function Vv(i,t){var e;return i in qi&&t in qi[i]&&(e=qi[i][t]),e}function ac(i,t,e){var s;if(t!==void 0){for(var r=0,n=i.length;r<n;++r)t[r]=i[r];s=t}else s=i.slice();return s}function Bv(i,t,e){if(t!==void 0&&i!==t){for(var s=0,r=i.length;s<r;++s)t[s]=i[s];i=t}return i}function Uv(i){Hv(i.getCode(),i),nn(i,i,ac)}function qv(i){i.forEach(Uv)}function ja(i){return typeof i=="string"?$v(i):i||null}function oc(i){qv(i),i.forEach(function(t){i.forEach(function(e){t!==e&&nn(t,e,ac)})})}function Wv(i,t,e,s){i.forEach(function(r){t.forEach(function(n){nn(r,n,e),nn(n,r,s)})})}function Yv(i,t){var e=i.getCode(),s=t.getCode(),r=Vv(e,s);return r||(r=Bv),r}function lc(i,t){var e=ja(i),s=ja(t);return Yv(e,s)}function Xv(){oc(sc),oc(nc),Wv(nc,sc,Av,Gv)}Xv();function Zv(i,t,e,s,r,n){for(var a=n||[],o=0,l=t;l<e;l+=s){var h=i[l],c=i[l+1];a[o++]=r[0]*h+r[2]*c+r[4],a[o++]=r[1]*h+r[3]*c+r[5]}return n&&a.length!=o&&(a.length=o),a}function Jv(i,t,e,s,r,n,a){for(var o=a||[],l=Math.cos(r),h=Math.sin(r),c=n[0],u=n[1],d=0,f=t;f<e;f+=s){var g=i[f]-c,m=i[f+1]-u;o[d++]=c+g*l-m*h,o[d++]=u+g*h+m*l;for(var p=f+2;p<f+s;++p)o[d++]=i[p]}return a&&o.length!=d&&(o.length=d),o}function Kv(i,t,e,s,r,n,a,o){for(var l=o||[],h=a[0],c=a[1],u=0,d=t;d<e;d+=s){var f=i[d]-h,g=i[d+1]-c;l[u++]=h+r*f,l[u++]=c+n*g;for(var m=d+2;m<d+s;++m)l[u++]=i[m]}return o&&l.length!=u&&(l.length=u),l}function Qv(i,t,e,s,r,n,a){for(var o=a||[],l=0,h=t;h<e;h+=s){o[l++]=i[h]+r,o[l++]=i[h+1]+n;for(var c=h+2;c<h+s;++c)o[l++]=i[c]}return a&&o.length!=l&&(o.length=l),o}var t_=globalThis&&globalThis.__extends||function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[n]=r[n])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function s(){this.constructor=t}t.prototype=e===null?Object.create(e):(s.prototype=e.prototype,new s)}}(),hc=fv(),e_=function(i){t_(t,i);function t(){var e=i.call(this)||this;return e.extent_=Zh(),e.extentRevision_=-1,e.simplifiedGeometryMaxMinSquaredTolerance=0,e.simplifiedGeometryRevision=0,e.simplifyTransformedInternal=tv(function(s,r,n){if(!n)return this.getSimplifiedGeometry(r);var a=this.clone();return a.applyTransform(n),a.getSimplifiedGeometry(r)}),e}return t.prototype.simplifyTransformed=function(e,s){return this.simplifyTransformedInternal(this.getRevision(),e,s)},t.prototype.clone=function(){return Kt()},t.prototype.closestPointXY=function(e,s,r,n){return Kt()},t.prototype.containsXY=function(e,s){var r=this.getClosestPoint([e,s]);return r[0]===e&&r[1]===s},t.prototype.getClosestPoint=function(e,s){var r=s||[NaN,NaN];return this.closestPointXY(e[0],e[1],r,1/0),r},t.prototype.intersectsCoordinate=function(e){return this.containsXY(e[0],e[1])},t.prototype.computeExtent=function(e){return Kt()},t.prototype.getExtent=function(e){if(this.extentRevision_!=this.getRevision()){var s=this.computeExtent(this.extent_);(isNaN(s[0])||isNaN(s[1]))&&Kh(s),this.extentRevision_=this.getRevision()}return Ov(this.extent_,e)},t.prototype.rotate=function(e,s){Kt()},t.prototype.scale=function(e,s,r){Kt()},t.prototype.simplify=function(e){return this.getSimplifiedGeometry(e*e)},t.prototype.getSimplifiedGeometry=function(e){return Kt()},t.prototype.getType=function(){return Kt()},t.prototype.applyTransform=function(e){Kt()},t.prototype.intersectsExtent=function(e){return Kt()},t.prototype.translate=function(e,s){Kt()},t.prototype.transform=function(e,s){var r=ja(e),n=r.getUnits()==ka.TILE_PIXELS?function(a,o,l){var h=r.getExtent(),c=r.getWorldExtent(),u=ec(c)/ec(h);return gv(hc,c[0],c[3],u,-u,0,0,0),Zv(a,0,a.length,l,hc,o),lc(r,s)(a,o,l)}:lc(r,s);return this.applyTransform(n),this},t}(dv),i_=e_,s_=globalThis&&globalThis.__extends||function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[n]=r[n])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function s(){this.constructor=t}t.prototype=e===null?Object.create(e):(s.prototype=e.prototype,new s)}}(),r_=function(i){s_(t,i);function t(){var e=i.call(this)||this;return e.layout=qt.XY,e.stride=2,e.flatCoordinates=null,e}return t.prototype.computeExtent=function(e){return vv(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)},t.prototype.getCoordinates=function(){return Kt()},t.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)},t.prototype.getFlatCoordinates=function(){return this.flatCoordinates},t.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)},t.prototype.getLayout=function(){return this.layout},t.prototype.getSimplifiedGeometry=function(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;var s=this.getSimplifiedGeometryInternal(e),r=s.getFlatCoordinates();return r.length<this.flatCoordinates.length?s:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)},t.prototype.getSimplifiedGeometryInternal=function(e){return this},t.prototype.getStride=function(){return this.stride},t.prototype.setFlatCoordinates=function(e,s){this.stride=cc(e),this.layout=e,this.flatCoordinates=s},t.prototype.setCoordinates=function(e,s){Kt()},t.prototype.setLayout=function(e,s,r){var n;if(e)n=cc(e);else{for(var a=0;a<r;++a)if(s.length===0){this.layout=qt.XY,this.stride=2;return}else s=s[0];n=s.length,e=n_(n)}this.layout=e,this.stride=n},t.prototype.applyTransform=function(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())},t.prototype.rotate=function(e,s){var r=this.getFlatCoordinates();if(r){var n=this.getStride();Jv(r,0,r.length,n,e,s,r),this.changed()}},t.prototype.scale=function(e,s,r){var n=s;n===void 0&&(n=e);var a=r;a||(a=tc(this.getExtent()));var o=this.getFlatCoordinates();if(o){var l=this.getStride();Kv(o,0,o.length,l,e,n,a,o),this.changed()}},t.prototype.translate=function(e,s){var r=this.getFlatCoordinates();if(r){var n=this.getStride();Qv(r,0,r.length,n,e,s,r),this.changed()}},t}(i_);function n_(i){var t;return i==2?t=qt.XY:i==3?t=qt.XYZ:i==4&&(t=qt.XYZM),t}function cc(i){var t;return i==qt.XY?t=2:i==qt.XYZ||i==qt.XYM?t=3:i==qt.XYZM&&(t=4),t}var $a=r_;function uc(i,t,e,s,r,n,a){var o=i[t],l=i[t+1],h=i[e]-o,c=i[e+1]-l,u;if(h===0&&c===0)u=t;else{var d=((r-o)*h+(n-l)*c)/(h*h+c*c);if(d>1)u=e;else if(d>0){for(var f=0;f<s;++f)a[f]=Nv(i[t+f],i[e+f],d);a.length=s;return}else u=t}for(var f=0;f<s;++f)a[f]=i[u+f];a.length=s}function dc(i,t,e,s,r){var n=i[t],a=i[t+1];for(t+=s;t<e;t+=s){var o=i[t],l=i[t+1],h=Vi(n,a,o,l);h>r&&(r=h),n=o,a=l}return r}function a_(i,t,e,s,r){for(var n=0,a=e.length;n<a;++n){var o=e[n];r=dc(i,t,o,s,r),t=o}return r}function fc(i,t,e,s,r,n,a,o,l,h,c){if(t==e)return h;var u,d;if(r===0)if(d=Vi(a,o,i[t],i[t+1]),d<h){for(u=0;u<s;++u)l[u]=i[t+u];return l.length=s,d}else return h;for(var f=c||[NaN,NaN],g=t+s;g<e;)if(uc(i,g-s,g,s,a,o,f),d=Vi(a,o,f[0],f[1]),d<h){for(h=d,u=0;u<s;++u)l[u]=f[u];l.length=s,g+=s}else g+=s*Math.max((Math.sqrt(d)-Math.sqrt(h))/r|0,1);if(n&&(uc(i,e-s,t,s,a,o,f),d=Vi(a,o,f[0],f[1]),d<h)){for(h=d,u=0;u<s;++u)l[u]=f[u];l.length=s}return h}function o_(i,t,e,s,r,n,a,o,l,h,c){for(var u=c||[NaN,NaN],d=0,f=e.length;d<f;++d){var g=e[d];h=fc(i,t,g,s,r,n,a,o,l,h,u),t=g}return h}function l_(i,t,e,s){for(var r=0,n=e.length;r<n;++r)i[t++]=e[r];return t}function gc(i,t,e,s){for(var r=0,n=e.length;r<n;++r)for(var a=e[r],o=0;o<s;++o)i[t++]=a[o];return t}function h_(i,t,e,s,r){for(var n=r||[],a=0,o=0,l=e.length;o<l;++o){var h=gc(i,t,e[o],s);n[a++]=h,t=h}return n.length=a,n}function c_(i,t,e,s,r,n,a){var o=(e-t)/s;if(o<3){for(;t<e;t+=s)n[a++]=i[t],n[a++]=i[t+1];return a}var l=new Array(o);l[0]=1,l[o-1]=1;for(var h=[t,e-s],c=0;h.length>0;){for(var u=h.pop(),d=h.pop(),f=0,g=i[d],m=i[d+1],p=i[u],y=i[u+1],M=d+s;M<u;M+=s){var x=i[M],L=i[M+1],I=Lv(x,L,g,m,p,y);I>f&&(c=M,f=I)}f>r&&(l[(c-t)/s]=1,d+s<c&&h.push(d,c),c+s<u&&h.push(c,u))}for(var M=0;M<o;++M)l[M]&&(n[a++]=i[t+M*s],n[a++]=i[t+M*s+1]);return a}function Wi(i,t){return t*Math.round(i/t)}function u_(i,t,e,s,r,n,a){if(t==e)return a;var o=Wi(i[t],r),l=Wi(i[t+1],r);t+=s,n[a++]=o,n[a++]=l;var h,c;do if(h=Wi(i[t],r),c=Wi(i[t+1],r),t+=s,t==e)return n[a++]=h,n[a++]=c,a;while(h==o&&c==l);for(;t<e;){var u=Wi(i[t],r),d=Wi(i[t+1],r);if(t+=s,!(u==h&&d==c)){var f=h-o,g=c-l,m=u-o,p=d-l;if(f*p==g*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(g<0&&p<g||g==p||g>0&&p>g)){h=u,c=d;continue}n[a++]=h,n[a++]=c,o=h,l=c,h=u,c=d}}return n[a++]=h,n[a++]=c,a}function d_(i,t,e,s,r,n,a,o){for(var l=0,h=e.length;l<h;++l){var c=e[l];a=u_(i,t,c,s,r,n,a),o.push(a),t=c}return a}function mc(i,t,e,s,r){for(var n=r!==void 0?r:[],a=0,o=t;o<e;o+=s)n[a++]=i.slice(o,o+s);return n.length=a,n}function f_(i,t,e,s,r){for(var n=r!==void 0?r:[],a=0,o=0,l=e.length;o<l;++o){var h=e[o];n[a++]=mc(i,t,h,s,n[a]),t=h}return n.length=a,n}function pc(i,t,e,s){for(var r=0,n=i[e-s],a=i[e-s+1];t<e;t+=s){var o=i[t],l=i[t+1];r+=a*o-n*l,n=o,a=l}return r/2}function g_(i,t,e,s){for(var r=0,n=0,a=e.length;n<a;++n){var o=e[n];r+=pc(i,t,o,s),t=o}return r}var m_=globalThis&&globalThis.__extends||function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[n]=r[n])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function s(){this.constructor=t}t.prototype=e===null?Object.create(e):(s.prototype=e.prototype,new s)}}(),p_=function(i){m_(t,i);function t(e,s){var r=i.call(this)||this;return r.maxDelta_=-1,r.maxDeltaRevision_=-1,s!==void 0&&!Array.isArray(e[0])?r.setFlatCoordinates(s,e):r.setCoordinates(e,s),r}return t.prototype.clone=function(){return new t(this.flatCoordinates.slice(),this.layout)},t.prototype.closestPointXY=function(e,s,r,n){return n<Yh(this.getExtent(),e,s)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(dc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),fc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,s,r,n))},t.prototype.getArea=function(){return pc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},t.prototype.getCoordinates=function(){return mc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},t.prototype.getSimplifiedGeometryInternal=function(e){var s=[];return s.length=c_(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,s,0),new t(s,qt.XY)},t.prototype.getType=function(){return Aa.LINEAR_RING},t.prototype.intersectsExtent=function(e){return!1},t.prototype.setCoordinates=function(e,s){this.setLayout(s,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=gc(this.flatCoordinates,0,e,this.stride),this.changed()},t}($a),yc=p_,y_=globalThis&&globalThis.__extends||function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[n]=r[n])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function s(){this.constructor=t}t.prototype=e===null?Object.create(e):(s.prototype=e.prototype,new s)}}(),v_=function(i){y_(t,i);function t(e,s){var r=i.call(this)||this;return r.setCoordinates(e,s),r}return t.prototype.clone=function(){var e=new t(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e},t.prototype.closestPointXY=function(e,s,r,n){var a=this.flatCoordinates,o=Vi(e,s,a[0],a[1]);if(o<n){for(var l=this.stride,h=0;h<l;++h)r[h]=a[h];return r.length=l,o}else return n},t.prototype.getCoordinates=function(){return this.flatCoordinates?this.flatCoordinates.slice():[]},t.prototype.computeExtent=function(e){return yv(this.flatCoordinates,e)},t.prototype.getType=function(){return Aa.POINT},t.prototype.intersectsExtent=function(e){return pv(e,this.flatCoordinates[0],this.flatCoordinates[1])},t.prototype.setCoordinates=function(e,s){this.setLayout(s,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=l_(this.flatCoordinates,0,e,this.stride),this.changed()},t}($a),__=v_;function S_(i,t,e,s,r){var n=Sv(r,function(a){return!gi(i,t,e,s,a[0],a[1])});return!n}function gi(i,t,e,s,r,n){for(var a=0,o=i[e-s],l=i[e-s+1];t<e;t+=s){var h=i[t],c=i[t+1];l<=n?c>n&&(h-o)*(n-l)-(r-o)*(c-l)>0&&a++:c<=n&&(h-o)*(n-l)-(r-o)*(c-l)<0&&a--,o=h,l=c}return a!==0}function vc(i,t,e,s,r,n){if(e.length===0||!gi(i,t,e[0],s,r,n))return!1;for(var a=1,o=e.length;a<o;++a)if(gi(i,e[a-1],e[a],s,r,n))return!1;return!0}function M_(i,t,e,s,r,n,a){for(var o,l,h,c,u,d,f,g=r[n+1],m=[],p=0,y=e.length;p<y;++p){var M=e[p];for(c=i[M-s],d=i[M-s+1],o=t;o<M;o+=s)u=i[o],f=i[o+1],(g<=d&&f<=g||d<=g&&g<=f)&&(h=(g-d)/(f-d)*(u-c)+c,m.push(h)),c=u,d=f}var x=NaN,L=-1/0;for(m.sort(J0),c=m[0],o=1,l=m.length;o<l;++o){u=m[o];var I=Math.abs(u-c);I>L&&(h=(c+u)/2,vc(i,t,e,s,h,g)&&(x=h,L=I)),c=u}return isNaN(x)&&(x=r[n]),a?(a.push(x,g,L),a):[x,g,L]}function C_(i,t,e,s,r){var n;for(t+=s;t<e;t+=s)if(n=r(i.slice(t-s,t),i.slice(t,t+s)),n)return n;return!1}function _c(i,t,e,s,r){var n=Qh(Zh(),i,t,e,s);return bv(r,n)?mv(r,n)||n[0]>=r[0]&&n[2]<=r[2]||n[1]>=r[1]&&n[3]<=r[3]?!0:C_(i,t,e,s,function(a,o){return Pv(r,a,o)}):!1}function w_(i,t,e,s,r){return!!(_c(i,t,e,s,r)||gi(i,t,e,s,r[0],r[1])||gi(i,t,e,s,r[0],r[3])||gi(i,t,e,s,r[2],r[1])||gi(i,t,e,s,r[2],r[3]))}function x_(i,t,e,s,r){if(!w_(i,t,e[0],s,r))return!1;if(e.length===1)return!0;for(var n=1,a=e.length;n<a;++n)if(S_(i,e[n-1],e[n],s,r)&&!_c(i,e[n-1],e[n],s,r))return!1;return!0}function b_(i,t,e,s){for(;t<e-s;){for(var r=0;r<s;++r){var n=i[t+r];i[t+r]=i[e-s+r],i[e-s+r]=n}t+=s,e-=s}}function Sc(i,t,e,s){for(var r=0,n=i[e-s],a=i[e-s+1];t<e;t+=s){var o=i[t],l=i[t+1];r+=(o-n)*(l+a),n=o,a=l}return r===0?void 0:r>0}function O_(i,t,e,s,r){for(var n=r!==void 0?r:!1,a=0,o=e.length;a<o;++a){var l=e[a],h=Sc(i,t,l,s);if(a===0){if(n&&h||!n&&!h)return!1}else if(n&&!h||!n&&h)return!1;t=l}return!0}function Mc(i,t,e,s,r){for(var n=r!==void 0?r:!1,a=0,o=e.length;a<o;++a){var l=e[a],h=Sc(i,t,l,s),c=a===0?n&&h||!n&&!h:n&&!h||!n&&h;c&&b_(i,t,l,s),t=l}return t}var P_=globalThis&&globalThis.__extends||function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[n]=r[n])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function s(){this.constructor=t}t.prototype=e===null?Object.create(e):(s.prototype=e.prototype,new s)}}(),Ha=function(i){P_(t,i);function t(e,s,r){var n=i.call(this)||this;return n.ends_=[],n.flatInteriorPointRevision_=-1,n.flatInteriorPoint_=null,n.maxDelta_=-1,n.maxDeltaRevision_=-1,n.orientedRevision_=-1,n.orientedFlatCoordinates_=null,s!==void 0&&r?(n.setFlatCoordinates(s,e),n.ends_=r):n.setCoordinates(e,s),n}return t.prototype.appendLinearRing=function(e){this.flatCoordinates?K0(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},t.prototype.clone=function(){var e=new t(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e},t.prototype.closestPointXY=function(e,s,r,n){return n<Yh(this.getExtent(),e,s)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(a_(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),o_(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,s,r,n))},t.prototype.containsXY=function(e,s){return vc(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,s)},t.prototype.getArea=function(){return g_(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)},t.prototype.getCoordinates=function(e){var s;return e!==void 0?(s=this.getOrientedFlatCoordinates().slice(),Mc(s,0,this.ends_,this.stride,e)):s=this.flatCoordinates,f_(s,0,this.ends_,this.stride)},t.prototype.getEnds=function(){return this.ends_},t.prototype.getFlatInteriorPoint=function(){if(this.flatInteriorPointRevision_!=this.getRevision()){var e=tc(this.getExtent());this.flatInteriorPoint_=M_(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_},t.prototype.getInteriorPoint=function(){return new __(this.getFlatInteriorPoint(),qt.XYM)},t.prototype.getLinearRingCount=function(){return this.ends_.length},t.prototype.getLinearRing=function(e){return e<0||this.ends_.length<=e?null:new yc(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)},t.prototype.getLinearRings=function(){for(var e=this.layout,s=this.flatCoordinates,r=this.ends_,n=[],a=0,o=0,l=r.length;o<l;++o){var h=r[o],c=new yc(s.slice(a,h),e);n.push(c),a=h}return n},t.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var e=this.flatCoordinates;O_(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Mc(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},t.prototype.getSimplifiedGeometryInternal=function(e){var s=[],r=[];return s.length=d_(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),s,0,r),new t(s,qt.XY,r)},t.prototype.getType=function(){return Aa.POLYGON},t.prototype.intersectsExtent=function(e){return x_(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)},t.prototype.setCoordinates=function(e,s){this.setLayout(s,e,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=h_(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},t}($a),an=Ha;function E_(i){var t=i[0],e=i[1],s=i[2],r=i[3],n=[t,e,t,r,s,r,s,e,t,e];return new Ha(n,qt.XY,[n.length])}function I_(i,t,e){for(var s=t||32,r=i.getStride(),n=i.getLayout(),a=i.getCenter(),o=r*(s+1),l=new Array(o),h=0;h<o;h+=r){l[h]=0,l[h+1]=0;for(var c=2;c<r;c++)l[h+c]=a[c]}var u=[l.length],d=new Ha(l,n,u);return L_(d,a,i.getRadius(),e),d}function L_(i,t,e,s){for(var r=i.getFlatCoordinates(),n=i.getStride(),a=r.length/n-1,o=s||0,l=0;l<=a;++l){var h=l*n,c=o+Tv(l,a)*2*Math.PI/a;r[h]=t[0]+e*Math.cos(c),r[h+1]=t[1]+e*Math.sin(c)}i.changed()}function Va(i){const t=i.getStride(),e=i.getFlatCoordinates();if(e.length){const s=Math.floor(e.length/t),r=new Array(s);for(let n=0;n<s;n++){const a=n*t,o=new Array(t);for(let l=0;l<t;l++)o[l]=e[a+l];r[n]=o}return r}return[]}function Yi(i,t){const e=t||i.getCoordinates();let s=null;return i instanceof bi?s=[e]:i instanceof En?s=e:i instanceof an?s=e.reduce((r,n)=>r.concat(n)):i instanceof zo?s=e:i instanceof jo?s=e.reduce((r,n)=>r.concat(n)):i instanceof fr?s=e.reduce((r,n)=>r.concat(n)).reduce((r,n)=>r.concat(n)):i instanceof le?s=e:i instanceof ps&&(s=i.getGeometries().map((r,n)=>Yi(r,e[n])).reduce((r,n)=>r.concat(n))),s}function Ba(i,t){const e=gr(T.mercatorToWgs84(i),t,Math.PI/2),s=T.wgs84ToMercator(e),r=i[0]-s[0],n=i[1]-s[1],a=r*r,o=n*n,l=Math.sqrt(a+o);return new le(i,l,"XYZ")}function Ua(i){return i instanceof le?I_(i):(i instanceof an&&i.unset("_vcsGeomType"),i)}function on(i){const[t,e]=i[i.length-1];i[0][0]===t&&i[0][1]===e||i.push(i[0].slice())}function qa(i){const[t,e]=i[i.length-1];i[0][0]===t&&i[0][1]===e&&i.pop()}function Wa(i){if(i instanceof an){const t=i.getCoordinates();t.forEach(e=>{qa(e)}),i.setCoordinates(t)}else if(i instanceof fr){const t=i.getCoordinates();t.forEach(e=>{e.forEach(s=>{qa(s)})}),i.setCoordinates(t)}}function T_(i){let t=0;const e=i.length;for(let s=0;s<=e-2;s++){const r=i[s],n=i[s+1];t+=r[0]*n[1]-r[1]*n[0]}return t/=2,t}function Cc(i){return T_(i)<0&&i.reverse(),i}class Fe{static fromArray(t){return v(t,[Number]),v(t.length,6),new Fe(t[0],t[1],t[2],t[3],t[4],t[5])}static fromGeometry(t){const e=new Fe;return e.extendWithGeometry(t),e}static fromHeightInfo(t){const e=new Fe;return e.extendWithHeightInfo(t),e}constructor(t=1/0,e=1/0,s=1/0,r=-1/0,n=-1/0,a=-1/0){this.minX=t,this.minY=e,this.minZ=s,this.maxX=r,this.maxY=n,this.maxZ=a}extendWithGeometry(t){if(t.getType()===Re.GEOMETRY_COLLECTION)t.getGeometriesArray().forEach(e=>{this.extendWithGeometry(e)});else if(t.getType()===Re.CIRCLE){const e=t.getFlatCoordinates(),s=t.getStride(),r=e[s]-e[0];this.extendXY(e[0]-r,e[1]-r),this.extendXY(e[0]+r,e[1]+r),s>2&&this.extendZ(e[2])}else{const e=t.getFlatCoordinates(),s=t.getStride();this.extendFlatCoordinates(e,s)}}extendWithHeightInfo(t){if(t.extruded){const e=t.groundLevel+t.storeyHeightsAboveGround.reduce((r,n)=>r+n,0);this.extendZ(e);const s=t.groundLevel-t.storeyHeightsBelowGround.reduce((r,n)=>r+n,0);this.extendZ(s)}}extendXYZ(t,e,s){this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,e),this.minZ=Math.min(this.minZ,s),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,e),this.maxZ=Math.max(this.maxZ,s)}extendXY(t,e){this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,e),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,e)}extendZ(t){this.minZ=Math.min(this.minZ,t),this.maxZ=Math.max(this.maxZ,t)}extendFlatCoordinates(t,e){const{length:s}=t;for(let r=0;r<s;r+=e)e>2?this.extendXYZ(t[r],t[r+1],t[r+2]):this.extendXY(t[r],t[r+1])}to2D(){return[this.minX,this.minY,this.maxX,this.maxY]}toArray(){return[this.minX,this.minY,this.minZ,this.maxX,this.maxY,this.maxZ]}}const mi=Symbol("FVlastUpdated"),Xi=Symbol("GlobalHiderLastUpdated");function wc(i,t){Object.keys(i.highlightedObjects).forEach(e=>{const s=t.getFeatureById(e);s&&!i.hasHighlightFeature(e,s)&&i.addHighlightFeature(e,s)}),Object.keys(i.hiddenObjects).forEach(e=>{const s=t.getFeatureById(e);s&&!i.hasHiddenFeature(e,s)&&i.addHiddenFeature(e,s)}),t[mi]=Date.now()}function xc(i,t){Object.keys(i.hiddenObjects).forEach(e=>{const s=t.getFeatureById(e);s&&!i.hasFeature(e,s)&&i.addFeature(e,s)}),t[Xi]=Date.now()}function ln(i,t,e){const s=t.on("addfeature",({feature:r})=>{const n=r.getId();i.highlightedObjects[n]&&i.addHighlightFeature(n,r),i.hiddenObjects[n]&&i.addHiddenFeature(n,r),e.hiddenObjects[n]&&e.addFeature(n,r);const a=Date.now();t[mi]=a,t[Xi]=a});return(!t[mi]||t[mi]<i.lastUpdated)&&wc(i,t),(!t[Xi]||t[Xi]<i.lastUpdated)&&xc(e,t),[i.changed.addEventListener(({action:r,ids:n})=>{r===W.HIGHLIGHT?(n.forEach(a=>{const o=t.getFeatureById(a);o&&i.addHighlightFeature(a,o)}),t[mi]=Date.now()):r===W.HIDE&&(n.forEach(a=>{const o=t.getFeatureById(a);o&&i.addHiddenFeature(a,o)}),t[mi]=Date.now())}),e.changed.addEventListener(({action:r,ids:n})=>{r===W.HIDE&&(n.forEach(a=>{const o=t.getFeatureById(a);o&&e.addFeature(a,o)}),t[Xi]=Date.now())}),()=>{yt(s)}]}function Ya(i,t){if(!(i instanceof Z))return null;const e=i.getProperties();delete e[i.getGeometryName()];const{clickedPosition:s}=i;if(!s)return null;let{latitude:r,longitude:n}=s;const a=i.getGeometry();let o=s.height,l=!o;a||(l=!1);let h=!o;const c=T.wgs84ToMercator([s.longitude,s.latitude,s.height]);if(a&&!a.intersectsCoordinate(c)){const u=a.getClosestPoint(c);[n,r]=T.mercatorToWgs84(u),l=!0}if(l){const u=Yi(a),d=tn(i,t.vectorProperties,u);if(d.perPositionHeight||d.extruded){const f=Fe.fromGeometry(a);f.extendWithHeightInfo(d),o=f.maxZ}!d.extruded&&(a.getType()===Re.POINT||a.getType()===Re.MULTI_POINT)&&(d.heightReference===Yt.RELATIVE_TO_GROUND||d.heightReference===Yt.CLAMP_TO_GROUND)?(o=d.heightAboveGroundAdjustment,h=!0):o+=d.heightAboveGroundAdjustment}return delete e.clickedPosition,o=Number.isFinite(o)?o:0,{layerName:t.name,layerClass:t.className,attributes:_(_({},t.genericFeatureProperties),e),longitude:n,latitude:r,height:o+t.balloonHeightOffset,relativeToGround:h}}class Xa extends Ys{static get className(){return"VectorOpenlayersImpl"}constructor(t,e){super(t,e);this.source=e.source,this.style=e.style,this.maxResolution=e.maxResolution,this.minResolution=e.minResolution,this.featureVisibility=e.featureVisibility,this._featureVisibilityListeners=[],this.olLayer=null,this.globalHider=li()}updateStyle(t,e){this.style=t,this.initialized&&this.olLayer.setStyle(this.style.style)}getOLLayer(){const t=new $o({visible:!1,source:this.source,style:this.style.style});return this.minResolution&&t.setMinResolution(this.minResolution),this.maxResolution&&t.setMaxResolution(this.maxResolution),t}async activate(){this.active||(await super.activate(),this.active&&this._featureVisibilityListeners.length===0&&(this._featureVisibilityListeners=ln(this.featureVisibility,this.source,this.globalHider)))}deactivate(){super.deactivate(),this._featureVisibilityListeners.forEach(t=>{t()}),this._featureVisibilityListeners=[]}setVisibility(t){this.initialized&&this.olLayer.setVisible(t)}destroy(){this._featureVisibilityListeners.forEach(t=>{t()}),this._featureVisibilityListeners=[],super.destroy()}}function bc(i,t,e,s){const r=O(_({},i),{perPositionHeight:e,extrudedHeight:s});return e||(r.height=t),[new Qd(r)]}function N_(i,t,e,s){return[new tf(O(_({},i),{height:e?void 0:t,extrudedHeight:s,perPositionHeight:e,vertexFormat:An.FLAT_VERTEX_FORMAT}))]}function D_(i,t,e){return bc(i,t,e,void 0)}function Oc(i,t){const e=E(t.getStroke().getWidth(),1),s=[];return s.push({positions:i.polygonHierarchy.positions,width:e}),i.polygonHierarchy.holes.forEach(r=>{s.push({positions:r.positions,width:e})}),s}function F_(i,t){return Oc(i,t).map(e=>new kn(e))}function R_(i,t){return Oc(i,t).map(e=>new zn(e))}function A_(i,t){let e;const s=[],r=i.getLinearRings();for(let n=0;n<r.length;n++){const o=r[n].getCoordinates().map(l=>{const h=T.mercatorToWgs84(l);return h[2]!=null&&(h[2]+=t),C.fromDegrees(h[0],h[1],h[2])});C.equals(o[0],o[o.length-1])||o.push(o[0]),n===0?e=o:s.push(new il(o))}return{polygonHierarchy:new il(e,s)}}function G_(i){const t=[];return i.forEach(e=>{t.push(...Va(e))}),t}let Za=null;function k_(){return Za||(Za={getCoordinates:G_,getGeometryOptions:A_,createSolidGeometries:bc,createOutlineGeometries:N_,createFillGeometries:D_,createGroundLineGeometries:F_,createLineGeometries:R_}),Za}function Pc(i){if(i.getType()!==Re.POLYGON)return!1;const t=i.getFlatCoordinates(),e=i.getEnds(),s=i.getStride();if(!e.every((a,o)=>{const l=o?e[o-1]:0;return a-l>=s*3}))return!1;const n=s*3*i.getLinearRingCount();return t&&t.length>=n&&i.getLinearRingCount()?t.every(a=>Number.isFinite(a)):!1}function Ja(i,t,e,s,r,n){if(!t.getFill()&&!t.getStroke())return;const a=k_(),o=e.filter(l=>Pc(l));en(i,t,o,s,r,a,n)}function Ec(i,t,e,s){return[new ef(O(_({},i),{height:t,granularity:.02,extrudedHeight:s}))]}function z_(i,t,e,s){return[new sf(O(_({},i),{height:t,extrudedHeight:s,granularity:.02}))]}function j_(i,t,e){return Ec(i,t,e,void 0)}function Ic(i,t){const e=E(t.getStroke().getWidth(),1),{center:s,radius:r}=i,n=et.fromCartesian(s),a=[P.toDegrees(n.longitude),P.toDegrees(n.latitude)];return{positions:vd(a,r,40).getLinearRing(0).getCoordinates().map(c=>C.fromDegrees(c[0],c[1],n.height)),width:e}}function $_(i,t){const e=Ic(i,t);return[new kn(e)]}function H_(i,t){const e=Ic(i,t);return[new zn(e)]}function V_(i,t){const e=i.getCenter(),s=e.slice();s[0]+=i.getRadius();const r=T.mercatorToWgs84(e,!0);r[2]!=null&&(r[2]+=t);const n=T.mercatorToWgs84(s,!0),a=C.fromDegrees(r[0],r[1],r[2]),o=C.fromDegrees(n[0],n[1],r[2]);return{radius:C.distance(a,o),center:a}}function B_(i){return i.map(t=>t.getCenter())}let Ka=null;function U_(){return Ka||(Ka={getCoordinates:B_,getGeometryOptions:V_,createSolidGeometries:Ec,createOutlineGeometries:z_,createFillGeometries:j_,createGroundLineGeometries:$_,createLineGeometries:H_}),Ka}function Lc(i){if(i.getType()!==Re.CIRCLE)return!1;const t=i.getFlatCoordinates(),e=i.getStride();return t&&t.length>=e+1&&t[e]!==t[0]?t.every(s=>Number.isFinite(s)):!1}function Tc(i,t,e,s,r,n){if(!t.getFill()&&!t.getStroke())return;const a=U_(),o=e.filter(l=>Lc(l));en(i,t,o,s,r,a,n)}function q_(i,t,e,s){return[rf.fromConstantHeights(O(_({},i),{maximumHeight:e?void 0:t,minimumHeight:s}))]}function W_(i,t,e,s){return[nf.fromConstantHeights(O(_({},i),{maximumHeight:e?void 0:t,minimumHeight:s}))]}function Y_(i,t,e){return[]}function X_(i,t){const e=E(t.getStroke().getWidth(),1);return[new kn(O(_({},i),{width:e}))]}function Nc(i,t){const e=E(t.getStroke().getWidth(),1);return[new zn(O(_({},i),{width:e}))]}function Z_(i,t){return{positions:i.getCoordinates().map(r=>{const n=T.mercatorToWgs84(r);return n[2]!=null&&(n[2]+=t),C.fromDegrees(n[0],n[1],n[2])})}}function J_(i){const t=[];return i.forEach(e=>{t.push(...Va(e))}),t}let Qa=null;function K_(){return Qa||(Qa={getCoordinates:J_,getGeometryOptions:Z_,createSolidGeometries:q_,createOutlineGeometries:W_,createFillGeometries:Y_,createGroundLineGeometries:X_,createLineGeometries:Nc}),Qa}function Dc(i){if(i.getType()!==Re.LINE_STRING)return!1;const t=i.getFlatCoordinates(),e=i.getStride()*2;return t&&t.length>=e?t.every(s=>Number.isFinite(s)):!1}function to(i,t,e,s,r,n){if(!t.getFill()&&!t.getStroke())return;const a=K_(),o=e.filter(l=>Dc(l));en(i,t,o,s,r,a,n)}function Q_(i){return i.map(t=>t.getCoordinates())}function Fc(i,t,e,s){const r=t.getImage();if(r){const n=new Ot(1,1,1,r.getOpacity());let a=null;r instanceof vs&&(r.load(),r.getImageState()===mr.LOADING&&(a=new Promise((l,h)=>{const c=()=>{r.getImageState()===mr.LOADED||r.getImageState()===mr.EMPTY?(l(r.getImage(1)),r.unlistenImageChange(c)):r.getImageState()===mr.ERROR&&(h(),r.unlistenImageChange(c))};r.listenImageChange(c)}))),a||(a=r.getImage(1));const o={image:a,color:n,scale:r.getScale(),heightReference:e,verticalOrigin:Bt.BOTTOM,id:i.getId()};return o.eyeOffset=s.getEyeOffset(i),o.scaleByDistance=s.getScaleByDistance(i),o}return null}function Rc(i,t,e,s){const r=t.getText(),n=r?r.getText():null;if(n){const a={};a.text=n,a.heightReference=e;const o=r.getOffsetX()||0,l=r.getOffsetY()||0;a.pixelOffset=new Ht(o,l);const h=r.getFont();h&&(a.font=h);const c=r.getFill(),u=r.getStroke();let d;c&&(a.fillColor=ai(c.getColor(),[0,0,0,1]),d=jn.FILL),u&&(a.outlineWidth=E(u.getWidth(),1),a.outlineColor=ai(u.getColor(),[0,0,0,1]),d=jn.OUTLINE),c&&u&&(d=jn.FILL_AND_OUTLINE),a.style=d;let f;switch(r.getTextAlign()){case"left":f=$n.LEFT;break;case"right":f=$n.RIGHT;break;case"center":default:f=$n.CENTER}a.horizontalOrigin=f;let g;switch(r.getTextBaseline()){case"top":g=Bt.TOP;break;case"middle":g=Bt.CENTER;break;case"bottom":g=Bt.BOTTOM;break;case"alphabetic":g=Bt.TOP;break;case"hanging":g=Bt.BOTTOM;break;default:g=Bt.BASELINE}return a.verticalOrigin=g,a.eyeOffset=s.getEyeOffset(i),a.scaleByDistance=s.getScaleByDistance(i),a}return null}function Ac(i,t,e,s,r){const n=s.getModel(i);if(n){const a=C.fromArray(n.scale),o=af.fromDegrees(n.heading,n.pitch,n.roll);return e.map((l,h)=>{const c=A.multiply(sl.headingPitchRollToFixedFrame(l,o),A.fromScale(a),new A),u=s.getModelOptions(i),d=of.fromGltf(_({url:n.url,modelMatrix:c},u));return t[h][2]||_r(r.globe.terrainProvider,[et.fromCartesian(l)]).then(([f])=>{d.isDestroyed()||(d.modelMatrix=A.multiply(sl.headingPitchRollToFixedFrame(et.toCartesian(f),o),A.fromScale(a),new A))}).catch(()=>{}),d.readyPromise.then(()=>{d.activeAnimations.addAll({loop:lf.REPEAT})}),d})}return null}function Gc(i){if(i.getType()!==Re.POINT)return!1;const t=i.getFlatCoordinates();return t&&t.length>=2?t.every(e=>Number.isFinite(e)):!1}function kc(i,t){const e=new Array(i.length),s=new Array(i.length),r=t.groundLevel+t.storeyHeightsAboveGround.reduce((n,a)=>n+a,0);return i.forEach((n,a)=>{e[a]=T.mercatorToWgs84(n,!0);let o=null;t.heightReference===Yt.RELATIVE_TO_GROUND?o=t.heightAboveGroundAdjustment:o=r,s[a]=C.fromDegrees(n[0],n[1],o)}),{positions:s,wgs84Positions:e}}function t1(i,t,e,s){const r=[],n=t.skirt+t.storeyHeightsBelowGround.reduce((a,o)=>a+o,0);for(let a=0;a<i.length;a++){const o=i[a];let l=o[2]!=null?o[2]:t.groundLevel;l-=n;const h=C.fromDegrees(o[0],o[1],l),c=[e[a],h];r.push(...Nc({positions:c},s))}return r}function eo(i,t,e,s,r,n){if(!t.getImage()&&!(t.getText()&&t.getText().getText()))return;const a=e.filter(g=>Gc(g));if(!a.length)return;const o=Q_(a),l=tn(i,s,o);let{heightReference:h}=l;const c=s.getAllowPicking(i),{positions:u,wgs84Positions:d}=kc(o,l),f=Ac(i,d,u,s,r);if(f)n.addPrimitives(f,i,c);else{if(l.extruded&&t.getStroke()){const p=t1(d,l,u,t);if(p.length){h=Yt.NONE;const y=Na(r,s,c,i,p,t,!1);y&&n.addPrimitives([y],i,c)}}const g=Fc(i,t,h,s);if(g){const p=u.map(y=>O(_({},g),{position:y}));n.addBillboards(p,i,c)}const m=Rc(i,t,h,s);if(m){const p=u.map(y=>O(_({},m),{position:y}));n.addLabels(p,i,c)}}}function zc(i,t,e,s,r,n){t instanceof bi?eo(i,e,[t],s,r,n):t instanceof In?Ja(i,e,[t],s,r,n):t instanceof En?to(i,e,[t],s,r,n):t instanceof le?Tc(i,e,[t],s,r,n):t instanceof zo?eo(i,e,t.getPoints(),s,r,n):t instanceof fr?Ja(i,e,t.getPolygons(),s,r,n):t instanceof jo?to(i,e,t.getLineStrings(),s,r,n):t instanceof ps&&t.getGeometries().forEach(a=>{zc(i,a,e,s,r,n)})}function Zs(i,t,e=1){const s=[];return typeof i=="function"?s.push(...Zs(i(t,e),t,e)):Array.isArray(i)?i.forEach(r=>{s.push(...Zs(r,t,e))}):i instanceof ft&&s.push(i),s}function jc(i,t,e,s,r){Zs(i.getStyle()||t,i,0).forEach(a=>{const o=a.getGeometryFunction()(i);o&&zc(i,o,a,e,r,s)})}function $c(i,t){t.olFeature=i}function pi(i,t){t&&t.forEach(e=>{i.remove(e)})}function Zi(i,t,e){pi(e,t.get(i)),t.delete(i)}function Ji(i,t,e,s,r){if(i.length){const n=i.map(a=>{const o=s.add(a);return e&&$c(t,o),o});r.has(t)?r.get(t).push(...n):r.set(t,n)}}class Hc{constructor(t,e){this.primitives=new Hn,this.billboards=new hf({scene:t}),this.labels=new cf({scene:t}),this.featureToPrimitiveMap=new Map,this.featureToBillboardMap=new Map,this.featureToLabelMap=new Map,e.add(this.primitives),e.add(this.billboards),e.add(this.labels)}addPrimitives(t,e,s){Ji(t,e,s,this.primitives,this.featureToPrimitiveMap)}addBillboards(t,e,s){Ji(t,e,s,this.billboards,this.featureToBillboardMap)}addLabels(t,e,s){Ji(t,e,s,this.labels,this.featureToLabelMap)}removeFeature(t){Zi(t,this.featureToPrimitiveMap,this.primitives),Zi(t,this.featureToBillboardMap,this.billboards),Zi(t,this.featureToLabelMap,this.labels)}createFeatureCache(t){const e={};return e.primitives=this.featureToPrimitiveMap.get(t),this.featureToPrimitiveMap.delete(t),e.billboards=this.featureToBillboardMap.get(t),this.featureToBillboardMap.delete(t),e.labels=this.featureToLabelMap.get(t),this.featureToLabelMap.delete(t),e}clearFeatureCache(t){pi(this.primitives,t.primitives),pi(this.billboards,t.billboards),pi(this.labels,t.labels)}clear(){this.primitives.removeAll(),this.billboards.removeAll(),this.labels.removeAll(),this.featureToBillboardMap.clear(),this.featureToLabelMap.clear(),this.featureToPrimitiveMap.clear()}}class Vc extends Ue{static get className(){return"VectorCesiumImpl"}constructor(t,e){super(t,e);this.vectorProperties=e.vectorProperties,this.source=e.source,this.style=e.style,this.featureVisibility=e.featureVisibility,this._featureVisibilityListeners=[],this._removeVectorPropertiesChangeHandler=()=>{},this._rootCollection=new Hn,this._rootCollection[z]=e.name,this._olListeners=[],this._featureToAdd=new Set,this._context=null,this._scene=null,this.globalHider=li()}_addListeners(){this._olListeners.push(this.source.on("addfeature",t=>{this._addFeature(t.feature)})),this._olListeners.push(this.source.on("removefeature",t=>{this._removeFeature(t.feature)})),this._olListeners.push(this.source.on("changefeature",t=>{this._featureChanged(t.feature)})),this._removeVectorPropertiesChangeHandler=this.vectorProperties.propertyChanged.addEventListener(this.refresh.bind(this))}async _setupContext(t){const e=this._rootCollection;this._context=new Hc(this._scene,e),t.addPrimitiveCollection(e)}async initialize(){this.initialized||(this._scene=this.map.getScene(),await this._setupContext(this.map),this._addListeners(),this._addFeatures(this.source.getFeatures())),await super.initialize()}_addFeatures(t){t.forEach(e=>{this._addFeature(e)})}_addFeature(t){this.active?jc(t,this.style.style,this.vectorProperties,this._context,this._scene):this._featureToAdd.add(t)}refresh(){this._context.clear(),this._addFeatures(this.source.getFeatures())}_removeFeature(t){this._context.removeFeature(t),this._featureToAdd.delete(t)}_featureChanged(t){const e=this._context.createFeatureCache(t);this._featureToAdd.delete(t),this._addFeature(t),this._context.clearFeatureCache(e)}async activate(){this.active||(await super.activate(),this.active&&(this._addFeatures([...this._featureToAdd]),this._featureToAdd.clear(),this._rootCollection.show=!0,this._featureVisibilityListeners.length===0&&(this._featureVisibilityListeners=ln(this.featureVisibility,this.source,this.globalHider))))}deactivate(){super.deactivate(),this._rootCollection.show=!1,this._featureVisibilityListeners.forEach(t=>{t()}),this._featureVisibilityListeners=[]}updateStyle(t,e){this.style=t,this.initialized&&!e&&this.source.getFeatures().filter(r=>!r.getStyle()).forEach(r=>{this._featureChanged(r)})}_destroyCollection(){this.map.removePrimitiveCollection(this._rootCollection)}destroy(){this.initialized&&(this._context.clear(),this._destroyCollection()),this._context=null,this._scene=null,this._removeVectorPropertiesChangeHandler(),this._olListeners.forEach(t=>{yt(t)}),this._olListeners=[],this._featureToAdd.clear(),this._featureVisibilityListeners.forEach(t=>{t()}),this._featureVisibilityListeners=[],this.source=null,this.vectorProperties=null,this.featureVisibility=null,this.style=null,this.globalHider=null,this._rootCollection=null,super.destroy()}}const ut={NORTH:1,EAST:2,SOUTH:3,WEST:4,NADIR:5},hn={north:ut.NORTH,east:ut.EAST,south:ut.SOUTH,west:ut.WEST,nadir:ut.NADIR};function e1(i){return Object.keys(hn).find(t=>hn[t]===i)}const Ki={};function Qi(i){if(!Ki[i.url])return Ki[i.url]=new rl(i),Ki[i.url];let t=Ki[i.url];return(i.requestVertexNormals!==void 0&&t.requestVertexNormals!==i.requestVertexNormals||i.requestWaterMask!==void 0&&t.requestWaterMask!==i.requestWaterMask)&&(Ki[i.url]=new rl(i),t=Ki[i.url]),t}function yi(i,t,e,s){const r=e?dt(e.proj,B.proj):null,n=t.map(o=>{const l=r?r(o,o.slice(),o.length):o;return et.fromDegrees(l[0],l[1])}),a=s||t.map(o=>o.slice());return _r(i,n).then(o=>(o.forEach((l,h)=>{a[h][2]=l.height||0}),a))}function Bc(i,t,e){if(!i.ready)return!1;const s=i.tilingScheme.positionToTileXY(e,t,new Ht);return i.getTileDataAvailable(s.x,s.y,t)}let io=new Ht,so=new Ht;function ro(i,t=!1){const e=i.slice(),s=_s(e);let n=[Pn(s),Ho(s),Vo(s),pr(s)].map(a=>{let o=0,l=1/0;return e.forEach((h,c)=>{const u=ke(a,h);u<l&&(l=u,o=c)}),e.splice(o,1)[0]});return t===ut.EAST?n=[n[3],n[0],n[1],n[2]]:t===ut.SOUTH?n=[n[2],n[3],n[0],n[1]]:t===ut.WEST&&(n=[n[1],n[2],n[3],n[0]]),n}function Js(i,t){return io=Ht.fromElements(i[0],i[1],io),so=Ht.fromElements(t[0],t[1],so),Ht.angleBetween(io,so)}function no(i,t){const[[e,s],[r,n]]=i,[[a,o],[l,h]]=t;let c,u;const d={x:null,y:null,onLine1:!1,onLine2:!1},f=(h-o)*(r-e)-(l-a)*(n-s);if(f===0)return d;c=s-o,u=e-a;const g=(l-a)*c-(h-o)*u,m=(r-e)*c-(n-s)*u;return c=g/f,u=m/f,d.x=e+c*(r-e),d.y=s+c*(n-s),c>0&&c<1&&(d.onLine1=!0),u>0&&u<1&&(d.onLine2=!0),d}function Uc(i,t,e,s,r){const n=ro(i,e?!1:r),a=ro(t,e?r:!1),o=[];for(let c=0;c<n.length;++c){const u=[];for(let g=0;g<n.length;++g){const m=g===n.length-1?0:g+1;if(c===g||c===m||g===3&&m===0||g===1&&m===2)continue;const p=no([n[c],s],[n[g],n[m]]);if(p.x==null||p.y==null)continue;const y=[s[0]-n[c][0],s[1]-n[c][1]],M=[p.x-n[c][0],p.y-n[c][1]],x=Js(y,M);if(x==null||x/(Math.PI*180)>5)continue;const L=[n[g][0]-n[m][0],n[g][1]-n[m][1]],I=[n[m][0]-n[g][0],n[m][1]-n[g][1]],D=Js(y,L);if(D==null)continue;const Y=Js(y,I);if(Y==null)continue;const H=ke(n[g],n[m]);if(H===0)continue;const wt=ke(n[g],[p.x,p.y])/H;let $t=0;wt!==0&&($t=Js(I,[p.x-n[g][0],p.y-n[g][1]]),$t==null)||u.push({cornerPoint:c,intrX:p.x,intrY:p.y,angle:D<=Y?D:Y,edgeStart:g,edgeEnd:m,ratioStart2End:$t/Math.PI*180>5?wt*-1:wt})}let d=-1,f=-1;for(let g=0;g<u.length;++g)u[g].angle>d&&(d=u[g].angle,f=g);f!==-1&&o.push(u[f])}if(o.length<2)return null;const l=[];for(let c=0;c<o.length;++c)for(let u=c+1;u<o.length;++u)l.push([o[c].angle+o[u].angle,c,u]);let h=null;return l.sort().reverse().find(c=>{const u=[o[c[1]],o[c[2]]],d=a[u[0].edgeEnd],f=a[u[0].edgeStart],g=[d[0]-f[0],d[1]-f[1]],m=[f[0]+g[0]*u[0].ratioStart2End,f[1]+g[1]*u[0].ratioStart2End],p=a[u[1].edgeEnd],y=a[u[1].edgeStart],M=[p[0]-y[0],p[1]-y[1]],x=[y[0]+M[0]*u[1].ratioStart2End,y[1]+M[1]*u[1].ratioStart2End],L=[m[0]-a[u[0].cornerPoint][0],m[1]-a[u[0].cornerPoint][1]],I=[x[0]-a[u[1].cornerPoint][0],x[1]-a[u[1].cornerPoint][1]];return!(Js(L,I)==null||(h=no([a[u[0].cornerPoint],m],[a[u[1].cornerPoint],x]),h.x==null||h.y==null))}),h}function i1(i,t,e={}){let s;e.dataProjection&&e.dataProjection===i.meta.projection?s=t:s=e.dataProjection?Xe(t,e.dataProjection.proj,i.meta.projection.proj):Xe(t,F.proj,i.meta.projection.proj);function r(){return{coords:i.transformRealWorld2Image(s),height:i.averageHeight,estimate:!0}}if(t[2]){const n=i.transformRealWorld2Image(s,t[2]);return Promise.resolve({coords:n,height:t[2],estimate:!1})}return!e.dontUseTerrain&&i.meta.terrainProvider?yi(i.meta.terrainProvider,[s],i.meta.projection).then(([n])=>n[2]?{coords:i.transformRealWorld2Image(s,n[2]),height:s[2],estimate:!1}:(console.warn("The configured terrain on the oblique layer could not be queried, position might be inaccurate"),r())).catch(()=>r()):Promise.resolve(r())}function qc(i){i.count+=1;const{image:t,worldCoordinate:e,imageCoordinate:s,terrainErrorThreshold:r,terrainErrorCountThreshold:n,count:a,height:o}=i;return yi(t.meta.terrainProvider,[e]).then(([l])=>{if(l[2]!=null){const h=Xe(t.transformImage2RealWorld(s,l[2]),t.meta.projection.proj,B.proj);return h[2]=l[2],Math.abs(o-l[2])<r||a>n?{coords:h,estimate:!1}:(i.height=h[2],i.worldCoordinate=l,qc(i))}return console.log("The configured terrain on the oblique layer could not be queried, position might be inaccurate"),{coords:l,estimate:!0}}).catch(()=>({coords:e,estimate:!0}))}async function ts(i,t,e={}){const s=Xe(i.transformImage2RealWorld(t,i.averageHeight),i.meta.projection.proj,B.proj),r=e.terrainErrorThreshold||1,n=e.terrainErrorCountThreshold||3;let a={coords:s,estimate:!0};return!e.dontUseTerrain&&i.meta.terrainProvider&&(a=await qc({worldCoordinate:s,imageCoordinate:t,image:i,count:0,height:i.averageHeight,terrainErrorThreshold:r,terrainErrorCountThreshold:n})),a.coords=e.dataProjection?Xe(a.coords,B.proj,e.dataProjection.proj):Xe(a.coords,B.proj,F.proj),a}function Wc(i){if(!/^[a-z][a-z0-9+.-]*:/.test(i)||/^data:/.test(i))return!0;const t=new URL(window.location.href),e=new URL(i);return t.host.toLowerCase()===e.host.toLocaleLowerCase()}function Yc(i){let t=0;for(let e=0;e<i.length;e++){let s=e+1;s>=i.length&&(s=0);const r=i[e],n=i[s],a=ke(r,n);a>t&&(t=a)}return t}function ao(i,t){const e=Yc(t.groundCoordinates),s=Math.PI/3,r=i.getViewport(),n={height:r.offsetHeight||1,width:r.offsetWidth||1},a=n.width/n.height,o=Math.atan(Math.tan(s*.5)/a)*2,[l,h]=t.meta.size,c=l>h?l:h,u=e/c;return{size:n,fovy:o,metersPerUnit:u}}function Xc(i,t,e){const{size:s,fovy:r,metersPerUnit:n}=ao(i,t),l=2*e*Math.tan(r/2)/n/s.height;return i.getView().getZoomForResolution(l)}async function Zc(i,t,e){const s=i instanceof le?_d(i):i,r=s.getCoordinates(),n=Yi(s,r);let a=dt(F.proj,e.meta.projection.proj),o=[];if(e.meta.terrainProvider){const l=n.map(h=>(T.mercatorToWgs84(h,!0),et.fromDegrees(h[0],h[1])));a=dt(B.proj,e.meta.projection.proj),o=await _r(e.meta.terrainProvider,l)}return n.forEach((l,h)=>{a(l,l,3);const c=o[h]?o[h].height:null,u=e.transformRealWorld2Image(l,c||l[2]||e.averageHeight);n[h][0]=u[0],n[h][1]=u[1]}),t.setCoordinates(r),t}function Jc(i,t,e){const s=i.getCoordinates(),n=Yi(i,s).map(a=>ts(e,a).then(o=>{a[0]=o.coords[0],a[1]=o.coords[1],a[2]=o.coords[2]}));return Promise.all(n).then(()=>(t.setCoordinates(s),t))}function oo(i,t=!1){const e=i.getGeometry();if((e.get("_vcsGeomType")==="bbox"||e.get("_vcsGeomType")==="rectangle")&&t)return e;const r=e instanceof le,n=Ua(e);return n[Bs]=r,n}function lo(i,t){const e=i.getGeometry(),s=i.getGeometry().clone();t.setGeometry(e[Ve]?s:Ua(s)),e[Ve]&&t.getGeometry().setProperties(i.getGeometry().getProperties(),!1),i[Yr]=t.getGeometry()}class Kc extends Ue{constructor(t,e){super(t,e);this.olLayer=null}initialize(){return this.initialized||(this.olLayer=this.getOLLayer(),this.olLayer[z]=this.name,this.map.addOLLayer(this.olLayer)),super.initialize()}async activate(){await super.activate(),this.active&&this.olLayer.setVisible(!0)}deactivate(){super.deactivate(),this.olLayer&&this.olLayer.setVisible(!1)}getOLLayer(){throw new Error}destroy(){this.olLayer&&this.map.removeOLLayer(this.olLayer),this.olLayer=null,super.destroy()}}class ho extends Kc{static get className(){return"VectorObliqueImpl"}constructor(t,e){super(t,e);this.obliqueSource=new Ss({}),this._featureListeners={},this._sourceListener=[],this.currentExtent=null,this.fetchedFeaturesForImageName=null,this._updatingMercator={},this._updatingOblique={},this._featureVisibilityListeners=[],this.globalHider=li(),this.source=e.source,this.style=e.style,this.featureVisibility=e.featureVisibility,this.olLayer=null}getOLLayer(){return new $o({visible:!1,source:this.obliqueSource,style:this.style.style})}updateStyle(t,e){this.style=t,this.initialized&&this.olLayer.setStyle(this.style.style)}_onObliqueImageChanged(){this._clearCurrentImage(),this._fetchFeaturesInView()}_featureInExtent(t){if(this.currentExtent){const e=t.getGeometry();if(e)return e[Ve]||e.intersectsExtent(this.currentExtent)}return!1}_addSourceListeners(){this._sourceListener.push(this.source.on("addfeature",t=>{const{feature:e}=t;this._featureInExtent(e)&&this.addFeature(t.feature)})),this._sourceListener.push(this.source.on("removefeature",t=>{this.removeFeature(t.feature)})),this._sourceListener.push(this.source.on("changefeature",t=>{const{feature:e}=t,s=e.getId();!this._featureListeners[s]&&this._featureInExtent(e)&&this.addFeature(e)}))}async activate(){this.active||(await super.activate(),this.active&&(this.olLayer.setVisible(!0),this._featureVisibilityListeners.length===0&&(this._featureVisibilityListeners=ln(this.featureVisibility,this.source,this.globalHider)),this._addSourceListeners(),this._imageChangedListener=this.map.imageChanged.addEventListener(this._onObliqueImageChanged.bind(this)),await this._fetchFeaturesInView()))}addFeature(t){if(this.active||(this.fetchedFeaturesForImageName=null),this.active&&this.currentExtent){const e=t.getId(),s=t.getGeometry();if(t[Ia])return s&&!this.obliqueSource.getFeatureById(e)&&this.obliqueSource.addFeature(t),Promise.resolve();if(this.obliqueSource.getFeatureById(e))return Promise.resolve();const r=new Z({});return r.setId(e),r[Be]=t,lo(t,r),r.setStyle(t.getStyle()),this._setFeatureListeners(t,r),this._convertToOblique(t,r).then(()=>{this.obliqueSource.addFeature(r)})}return Promise.resolve()}_originalGeometryChanged(t,e,s){yt(t.originalGeometryChanged),yt(t.obliqueGeometryChanged),lo(e,s),this.updateObliqueGeometry(e,s),t.originalGeometryChanged=e.getGeometry().on("change",this.updateObliqueGeometry.bind(this,e,s)),t.obliqueGeometryChanged=s.getGeometry().on("change",this.updateMercatorGeometry.bind(this,e,s))}_setFeatureListeners(t,e){const s=e.getId(),r={originalFeatureGeometryChanged:t.on("change:geometry",()=>{const n=t.getGeometry();if(n[Bs]){yt(r.originalGeometryChanged),r.originalGeometryChanged=t.getGeometry().on("change",()=>{this._updatingMercator[s]||(delete n[Bs],this._originalGeometryChanged(r,t,e))});return}this._originalGeometryChanged(r,t,e)}),originalFeatureChanged:t.on("change",()=>{e.setStyle(t.getStyle())}),originalGeometryChanged:t.getGeometry().on("change",this.updateObliqueGeometry.bind(this,t,e)),obliqueGeometryChanged:e.getGeometry().on("change",this.updateMercatorGeometry.bind(this,t,e))};this._featureListeners[s]=r}async _convertToOblique(t,e){const s=t.getId(),r=t.getGeometry(),n=e.getGeometry();this._updatingOblique[s]=!0,r[Ve]?e.getGeometry().setCoordinates(r.getCoordinates()):await Zc(r,n,this.map.currentImage),this._updatingOblique[s]=null}updateObliqueGeometry(t,e){const s=t.getId();this._updatingMercator[s]||(this._updatingOblique[s]!=null&&clearTimeout(this._updatingOblique[s]),this._updatingOblique[s]=setTimeout(()=>{this._convertToOblique(t,e)},200))}updateMercatorGeometry(t,e){const s=t.getId();if(this._updatingOblique[s])return;this._updatingMercator[s]!=null&&clearTimeout(this._updatingMercator[s]);const r=this.fetchedFeaturesForImageName;this._updatingMercator[s]=setTimeout(async()=>{const n=oo(t,!1);n[Bs]&&t.setGeometry(n);const a=oo(e,!0);this._updatingMercator[s]=!0,await Jc(a,n,this.map.collection.getImageByName(r)),this._updatingMercator[s]=null},200)}_clearCurrentImage(){Object.values(this._featureListeners).forEach(t=>{yt(Object.values(t))}),this._featureListeners={},this._updatingOblique={},this._updatingMercator={},this.obliqueSource.getFeatures().forEach(t=>{const e=t[Be];e&&(delete e[Yr],delete e.getGeometry()[Ve])}),this.obliqueSource.clear(!0),this.fetchedFeaturesForImageName=null}_fetchFeaturesInView(){this.active&&this.map.currentImage&&this.fetchedFeaturesForImageName!==this.map.currentImage.name&&(this.currentExtent=this.map.getExtentOfCurrentImage().getCoordinatesInProjection(F),this.source.forEachFeatureInExtent(this.currentExtent,t=>{this.addFeature(t)}),this.source.forEachFeature(t=>{t.getGeometry()[Ve]&&this.addFeature(t)}),this.fetchedFeaturesForImageName=this.map.currentImage.name)}removeFeature(t){const e=this.obliqueSource.getFeatureById(t.getId());if(e){const s=e.getId(),r=this._featureListeners[s];r&&(yt(Object.values(r)),delete this._featureListeners[s]),this.obliqueSource.removeFeature(e)}}deactivate(){super.deactivate(),this.olLayer&&this.olLayer.setVisible(!1),this._featureVisibilityListeners.forEach(t=>{t()}),this._featureVisibilityListeners=[],yt(this._sourceListener),this._sourceListener=[],this._imageChangedListener&&(this._imageChangedListener(),this._imageChangedListener=null),this._clearCurrentImage()}destroy(){this.olLayer&&this.map.removeOLLayer(this.olLayer),this.olLayer=null,yt(this._sourceListener),this._sourceListener=[],this._imageChangedListener&&(this._imageChangedListener(),this._imageChangedListener=null),this.obliqueSource.clear(!0),Object.values(this._updatingOblique).forEach(t=>{t!=null&&clearTimeout(t)}),Object.values(this._updatingMercator).forEach(t=>{t!=null&&clearTimeout(t)}),this._clearCurrentImage(),super.destroy()}}class cn{constructor(t){this.name=t.name,this.meta=t.meta,this.viewDirection=t.viewDirection,this.viewDirectionAngle=t.viewDirectionAngle,this.groundCoordinates=t.groundCoordinates,this.centerPointOnGround=t.centerPointOnGround,this.pToRealworld=t.pToRealworld||null,this.pToImage=t.pToImage||null,this.projectionCenter=t.projectionCenter||null,this._averageHeight=null}get averageHeight(){return this._averageHeight!=null?this._averageHeight:0}get hasCamera(){return!!this.meta.principalPoint}transformImage2RealWorld(t,e){let s=t;if(this.meta.principalPoint)this.meta.hasRadial&&(s=this.meta.radialDistortionCoordinate(s,!0));else return this._transformNoCamera(s,!0,e);const r=new C(s[0],this.meta.size[1]-s[1],1),n=Vt.multiplyByVector(this.pToRealworld,r,new C),a=e||this.averageHeight,o=new C(this.centerPointOnGround[0],this.centerPointOnGround[1],a),l=C.subtract(this.projectionCenter,o,new C),h=C.dot(C.UNIT_Z,l)*-1,c=C.dot(C.UNIT_Z,n),u=h/c,d=C.add(this.projectionCenter,C.multiplyByScalar(n,u,new C),new C);return[d.x,d.y,a]}transformRealWorld2Image(t,e){if(!this.meta.principalPoint)return this._transformNoCamera(t,!1,e);const s=e||this.averageHeight,r=new nl(t[0],t[1],s,1),n=A.multiplyByVector(this.pToImage,r,new nl),a=[n.x/n.z,n.y/n.z],o=[a[0],this.meta.size[1]-a[1]];return this.meta.radialDistortionCoordinate(o,!1)}_transformNoCamera(t,e,s){const r=[[0,0],[this.meta.size[0],0],this.meta.size,[0,this.meta.size[1]]],n=Uc(e?r:this.groundCoordinates,e?this.groundCoordinates:r,e,t,this.viewDirection),a=s||this.averageHeight;if(n===null||n.x==null||n.y==null){console.error("Real world coordinate could not be determined from footprint data, center will be returned");const l=[this.centerPointOnGround[0],this.centerPointOnGround[1]];return e&&l.push(a),l}const o=[n.x,n.y];return e&&o.push(a),o}calculateImageAverageHeight(){if(this._averageHeight===null){const t=(this.groundCoordinates[0][2]+this.groundCoordinates[1][2]+this.groundCoordinates[2][2]+this.groundCoordinates[3][2])/4;if(t===0&&this.meta.terrainProvider)return yi(this.meta.terrainProvider,[this.centerPointOnGround.slice()],this.meta.projection).then(e=>{e[0]&&e[0][2]!=null&&(this._averageHeight=e[0][2])}).catch(()=>{this._averageHeight=t});this._averageHeight=t}return Promise.resolve()}}class Ks{constructor(t){this.name=t.name,this.principalPoint=t["principal-point"],this.pixelSize=t["pixel-size"],this.radialE2F=t["radial-distorsion-expected-2-found"],this.radialF2E=t["radial-distorsion-found-2-expected"],this.hasRadial=!!(this.pixelSize&&this.radialE2F&&this.radialF2E),this.size=t.size,this.tileSize=t.tileSize,this.tileResolution=t.tileResolution,this.projection=t.projection,this.url=t.url,this.terrainProvider=t.terrainProvider,this.format=t.format||"jpg"}radialDistortionCoordinate(t,e){if(this.hasRadial&&this.principalPoint){const s=e?this.radialF2E:this.radialE2F,r=ke(this.principalPoint,t)*this.pixelSize[0];if(r===0)return t.slice();const n=t[0]-this.principalPoint[0],a=t[1]-this.principalPoint[1];let o=0;for(let c=0;c<s.length;++c)o+=s[c]*r**c;const l=(r+o)/this.pixelSize[0],h=Math.atan2(a,n);return[this.principalPoint[0]+l*Math.cos(h),this.principalPoint[1]+l*Math.sin(h)]}return t.slice()}}let Qc=0;function s1(){return Qc+=1,Qc}function co(i){const t={version:null,buildNumber:null};if(i.version){const e=i.version.match(/\d+\.\d+/);e&&(t.version=Number(e[0]));const s=i.version.match(/-\d+-/);s&&(t.buildNumber=Number(s[0].match(/\d+/)[0]))}return t}function tu(i,t,e,s){let r;i.generalImageInfo.width&&i.generalImageInfo.height&&(r=[i.generalImageInfo.width,i.generalImageInfo.height]);const n=i.generalImageInfo["tile-resolution"],a=[i.generalImageInfo["tile-width"],i.generalImageInfo["tile-height"]];let o=e;const l=[];!o&&i.generalImageInfo.crs&&(o=new T({epsg:s1(),prefix:"OBLIQUE:",proj4:i.generalImageInfo.crs}));const h={size:r,tileResolution:n,tileSize:a,projection:o,url:t,terrainProvider:s};return i.generalImageInfo.cameraParameter&&(Array.isArray(i.generalImageInfo.cameraParameter)?i.generalImageInfo.cameraParameter.forEach(c=>{l.push(new Ks(_(_({},h),c)))}):typeof i.generalImageInfo.cameraParameter=="object"&&Object.entries(i.generalImageInfo.cameraParameter).forEach(([c,u])=>{l.push(new Ks(_(_({name:c},h),u)))})),l.length===0&&l.push(new Ks(_({name:"default"},h))),l}function uo(i,t){const e=i.images[0],s={name:e.indexOf("name"),width:e.indexOf("width"),height:e.indexOf("height"),tileResolution:e.indexOf("tile-resolution"),viewDirection:e.indexOf("view-direction"),viewDirectionAngle:e.indexOf("view-direction-angle"),groundCoordinates:e.indexOf("groundCoordinates"),centerPointOnGround:e.indexOf("centerPointOnGround"),cameraIndex:e.indexOf("camera-index"),projectionCenter:e.indexOf("projection-center"),pToRealworld:e.indexOf("p-to-realworld"),pToImage:e.indexOf("p-to-image")},r=new Array(i.images.length-1);return i.images.forEach((n,a)=>{if(a===0)return;const o=[];n[s.pToRealworld]&&n[s.pToRealworld].forEach(f=>{o.push(...f)});const l=n[s.pToRealworld]?new Vt(...o):null,h=[];n[s.pToImage]&&(n[s.pToImage].forEach(f=>{h.push(...f)}),h.push(0,0,0,1));const c=n[s.projectionCenter]?C.fromArray(n[s.projectionCenter]):null,u=n[s.pToImage]?new A(...h):null,d=t[n[s.cameraIndex]||0];d.size||(n[s.height]&&n[s.width]?d.size=[n[s.width],n[s.height]]:console.error("missing image meta size")),d.tileResolution||(n[s.tileResolution]?d.tileResolution=n[s.tileResolution]:console.error("missing image meta tileResolution")),r[a-1]=new cn({name:n[s.name],viewDirection:n[s.viewDirection],viewDirectionAngle:n[s.viewDirectionAngle],groundCoordinates:n[s.groundCoordinates],centerPointOnGround:n[s.centerPointOnGround],meta:d,projectionCenter:c,pToRealworld:l,pToImage:u})}),r}function eu(i,t){const{cameraParameter:e}=i.generalImageInfo,{version:s,buildNumber:r}=co(i);return i.images.map(n=>{const a=hn[n["view-direction"]],o=s>=3.4&&r>=18?n["view-directionAngle"]:void 0,l=n["projection-center"],{name:h,groundCoordinates:c,centerPointOnGround:u}=n,d=n["camera-name"],f=t.find(p=>p.name===d),g=f||t[0];g.size||(n.height&&n.width?g.size=[n.width,n.height]:console.error("missing image meta size")),g.tileResolution||(n.tileResolution?g.tileResolution=n.tileResolution:console.error("missing image meta tileResolution"));const m={name:h,meta:g,viewDirection:a,viewDirectionAngle:o,groundCoordinates:c,centerPointOnGround:u};if(f&&d){const p=e[d],y=Vt.fromRowMajorArray([].concat(...p["camera-matrix"])),M=Vt.inverse(y,new Vt),x=Vt.fromRowMajorArray([].concat(...n["rotation-matrix"])),L=Vt.transpose(x,new Vt),I=p["focal-length"]*-1;Vt.multiplyByScalar(M,I,M);const D=Vt.multiply(L,M,new Vt),Y=A.fromRotationTranslation(y,C.ZERO,new A),H=C.fromArray(l),wt=A.fromTranslation(C.multiplyByScalar(H,-1,new C),new A),$t=A.fromRotationTranslation(x,C.ZERO,new A),Me=A.multiply(Y,A.multiply($t,wt,new A),new A);m.projectionCenter=H,m.pToRealworld=D,m.pToImage=Me}return new cn(m)})}async function fo(i,t){const e=await fetch(i,t);if(!e.ok)throw new Error(`Failed fetching url ${i} with status: ${e.status}`);return e}async function ye(i,t){return(await fo(i,t)).json()}async function iu(i,t){return(await fo(i,t)).arrayBuffer()}const at={PENDING:1,LOADING:2,READY:3};function Qs(i){return i.some(t=>t===at.PENDING)?at.PENDING:i.some(t=>t===at.LOADING)?at.LOADING:at.READY}class go{constructor(t,e,s){this.url=t,/\.json$/.test(this.url)||(this.url=this.url.replace(/\/?$/,"/image.json")),this.baseUrl=this.url.replace(/\/?([^/]+\.json)?$/,"");let r=e;r&&!(r instanceof T)&&(r=new T(r)),this.projection=r,this._terrainProviderOptions=s?_({},s):void 0,this._terrainProvider=this._terrainProviderOptions?Qi(this._terrainProviderOptions):void 0,this._imageMetas=[],this.imagesLoaded=new R,this._tiles=new Map,this._loadingPromises=new Map,this._state=at.PENDING,this._tileLevel=null,this._tileGrid=Bo(),this._images=[],this.copyright=void 0}get images(){return this._images.slice()}get state(){return this._state}get terrainProvider(){return this._terrainProvider}load(){return this._loadingPromise||(this._state=at.LOADING,this._loadingPromise=ye(this.url).then(t=>this._initialize(t)).catch(t=>Promise.reject(t))),this._loadingPromise}getTiles(){const t={};return this._tiles.forEach((e,s)=>{t[s]=e}),t}initialize(t){if(this._state!==at.PENDING)throw new Error("DataSet has already been loaded");this._loadingPromise=Promise.resolve(),this._initialize(t)}_initialize(t){this._parseMetaData(t),this._state=at.READY}_parseMetaData(t){this._imageMetas=tu(t,this.baseUrl,this.projection,this.terrainProvider);const{version:e,buildNumber:s}=co(t);if(t.tileLevel)this._tileLevel=t.tileLevel,t.availableTiles.forEach(r=>{this._tiles.set(r,at.PENDING)});else{let r=[];e>=3.5||e===3.4&&s>36?r=uo(t,this._imageMetas):(e>=3.1||e===null)&&(r=eu(t,this._imageMetas)),r.length>0&&(this._images=r,this.imagesLoaded.raiseEvent({images:r}))}}_getClosestTileCoordinate(t){if(!this._tileLevel)return null;const e=this._tileGrid.getTileCoordForCoordAndZ(t,this._tileLevel);if(this._tiles.has(e.join("/")))return e;let s=1/0,r=null;return[...this._tiles.keys()].forEach(n=>{const a=n.split("/").map(Number),o=ke([e[1],e[2]],[a[1],a[2]]);o<s&&(s=o,r=a)}),r||e}_getTileCoordinatesForExtent(t){const e=this._tileGrid.getTileCoordForCoordAndZ([t[0],t[3]],this._tileLevel),s=this._tileGrid.getTileCoordForCoordAndZ([t[2],t[1]],this._tileLevel),r=[];for(let n=e[1];n<=s[1];n++)for(let a=e[2];a<=s[2];a++)r.push([this._tileLevel,n,a]);return r.map(n=>n.join("/")).filter(n=>{const a=this._tiles.get(n);return a&&a!==at.READY})}getDataStateForCoordinate(t){if(this._state!==at.READY||this._tiles.size===0)return this._state;const e=this._getClosestTileCoordinate(t).join("/");return this._tiles.has(e)?this._tiles.get(e):at.READY}getDataStateForExtent(t){if(this._state!==at.READY||this._tiles.size===0)return this._state;const s=this._getTileCoordinatesForExtent(t).map(r=>this._tiles.get(r)).filter(r=>r);return Qs(s)}_loadTile(t){if(this._loadingPromises.has(t))return this._loadingPromises.get(t);if(this._tiles.get(t)!==at.PENDING)return Promise.resolve();this._tiles.set(t,at.LOADING);const e=ye(`${this.baseUrl}/${t}.json`).then(s=>{const r=uo(s,this._imageMetas);r.length>0&&(this._images=this._images.concat(r),this.imagesLoaded.raiseEvent({images:r,tileCoordinate:t}))}).catch(s=>{console.error(s)}).finally(()=>{this._tiles.set(t,at.READY),this._loadingPromises.delete(t)});return this._loadingPromises.set(t,e),e}async loadDataForCoordinate(t){const e=this._getClosestTileCoordinate(t);e&&await this._loadTile(e.join("/"))}async loadDataForExtent(t){const e=this._getTileCoordinatesForExtent(t);await Promise.all(e.map(s=>this._loadTile(s)))}destroy(){this.imagesLoaded.destroy(),this._images=[],this._imageMetas=[],this._tiles.clear(),this._loadingPromises.clear(),this._tileGrid=null,this._terrainProvider=null}toJSON(){const t={url:this.url};return this.projection&&(t.projection=this.projection.toJSON()),this._terrainProviderOptions&&(t.terrainProvider=_({},this._terrainProviderOptions)),t}}let mo="";function r1(){if(!mo){const i=document.createElement("canvas");i.height=512,i.width=512;const t=i.getContext("2d");t.fillStyle="#409D76",t.fillRect(0,0,512,512),t.font="bold 46px Monospace, Courier New",t.fillStyle="#424242",t.textAlign="center",t.fillText("No Image",256,256),mo=i.toDataURL("png")}return mo}class su{constructor(t,e){this.id=Xt(),this.size=t.size,this.url=t.url,this.tileSize=t.tileSize,this.format=t.format,this.minZoom=e.minZoom,this.maxZoom=e.maxZoom,this.scaleFactor=e.scaleFactor;const{tileResolution:s}=t;this.tileResolution=s.slice(0,s.length-e.hideLevels),this._createViewAndLayer()}_createViewAndLayer(){const t=[0,0,...this.size],e=new Sd({code:"ZOOMIFY",units:"pixels",extent:t}),s=this.maxZoom>0?this.maxZoom:this.tileResolution.length+4,r=Math.log(2)/Math.log(this.scaleFactor);this.view=new On({projection:e,center:[this.size[0]/2,this.size[1]/2],constrainOnlyCenter:!0,minZoom:this.minZoom*r,maxZoom:s*r,extent:[-2e3,-2e3,this.size[0]+2e3,this.size[1]+2e3],zoom:this.minZoom*r,zoomFactor:this.scaleFactor});const n={projection:e,tileGrid:new Uo({origin:[0,0],extent:t,resolutions:this.tileResolution,tileSize:this.tileSize})};Wc(this.url)||(n.crossOrigin="anonymous"),this.tileImageSource=new Md(n),this.layer=new Oi({source:this.tileImageSource,extent:t})}setImageName(t,e=!1){e&&this.tileImageSource.setTileLoadFunction(s=>{s.getImage().src=r1(),s.load()}),this.tileImageSource.setTileUrlFunction(s=>{const[r,n,a]=s,o=-a-1;return`${this.url}/${t}/${r}/${n}/${o}.${this.format}`}),this.tileImageSource.refresh()}destroy(){this.view=null,this.layer=null,this.tileImageSource.clear(),this.tileImageSource=null}}function n1(i,t,e,s,r){ru(i,t,e||0,s||i.length-1,r||a1)}function ru(i,t,e,s,r){for(;s>e;){if(s-e>600){var n=s-e+1,a=t-e+1,o=Math.log(n),l=.5*Math.exp(2*o/3),h=.5*Math.sqrt(o*l*(n-l)/n)*(a-n/2<0?-1:1),c=Math.max(e,Math.floor(t-a*l/n+h)),u=Math.min(s,Math.floor(t+(n-a)*l/n+h));ru(i,t,c,u,r)}var d=i[t],f=e,g=s;for(tr(i,e,t),r(i[s],d)>0&&tr(i,e,s);f<g;){for(tr(i,f,g),f++,g--;r(i[f],d)<0;)f++;for(;r(i[g],d)>0;)g--}r(i[e],d)===0?tr(i,e,g):(g++,tr(i,g,s)),g<=t&&(e=g+1),t<=g&&(s=g-1)}}function tr(i,t,e){var s=i[t];i[t]=i[e],i[e]=s}function a1(i,t){return i<t?-1:i>t?1:0}class po{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const s=[];if(!dn(t,e))return s;const r=this.toBBox,n=[];for(;e;){for(let a=0;a<e.children.length;a++){const o=e.children[a],l=e.leaf?r(o):o;dn(t,l)&&(e.leaf?s.push(o):vo(t,l)?this._all(o,s):n.push(o))}e=n.pop()}return s}collides(t){let e=this.data;if(!dn(t,e))return!1;const s=[];for(;e;){for(let r=0;r<e.children.length;r++){const n=e.children[r],a=e.leaf?this.toBBox(n):n;if(dn(t,a)){if(e.leaf||vo(t,a))return!0;s.push(n)}}e=s.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let s=0;s<t.length;s++)this.insert(t[s]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const s=this.data;this.data=e,e=s}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=is([]),this}remove(t,e){if(!t)return this;let s=this.data;const r=this.toBBox(t),n=[],a=[];let o,l,h;for(;s||n.length;){if(s||(s=n.pop(),l=n[n.length-1],o=a.pop(),h=!0),s.leaf){const c=o1(t,s.children,e);if(c!==-1)return s.children.splice(c,1),n.push(s),this._condense(n),this}!h&&!s.leaf&&vo(s,r)?(n.push(s),a.push(o),o=0,l=s,s=s.children[0]):l?(o++,s=l.children[o],h=!1):s=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const s=[];for(;t;)t.leaf?e.push(...t.children):s.push(...t.children),t=s.pop();return e}_build(t,e,s,r){const n=s-e+1;let a=this._maxEntries,o;if(n<=a)return o=is(t.slice(e,s+1)),es(o,this.toBBox),o;r||(r=Math.ceil(Math.log(n)/Math.log(a)),a=Math.ceil(n/Math.pow(a,r-1))),o=is([]),o.leaf=!1,o.height=r;const l=Math.ceil(n/a),h=l*Math.ceil(Math.sqrt(a));nu(t,e,s,h,this.compareMinX);for(let c=e;c<=s;c+=h){const u=Math.min(c+h-1,s);nu(t,c,u,l,this.compareMinY);for(let d=c;d<=u;d+=l){const f=Math.min(d+l-1,u);o.children.push(this._build(t,d,f,r-1))}}return es(o,this.toBBox),o}_chooseSubtree(t,e,s,r){for(;r.push(e),!(e.leaf||r.length-1===s);){let n=1/0,a=1/0,o;for(let l=0;l<e.children.length;l++){const h=e.children[l],c=yo(h),u=c1(t,h)-c;u<a?(a=u,n=c<n?c:n,o=h):u===a&&c<n&&(n=c,o=h)}e=o||e.children[0]}return e}_insert(t,e,s){const r=s?t:this.toBBox(t),n=[],a=this._chooseSubtree(r,this.data,e,n);for(a.children.push(t),ir(a,r);e>=0&&n[e].children.length>this._maxEntries;)this._split(n,e),e--;this._adjustParentBBoxes(r,n,e)}_split(t,e){const s=t[e],r=s.children.length,n=this._minEntries;this._chooseSplitAxis(s,n,r);const a=this._chooseSplitIndex(s,n,r),o=is(s.children.splice(a,s.children.length-a));o.height=s.height,o.leaf=s.leaf,es(s,this.toBBox),es(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(s,o)}_splitRoot(t,e){this.data=is([t,e]),this.data.height=t.height+1,this.data.leaf=!1,es(this.data,this.toBBox)}_chooseSplitIndex(t,e,s){let r,n=1/0,a=1/0;for(let o=e;o<=s-e;o++){const l=er(t,0,o,this.toBBox),h=er(t,o,s,this.toBBox),c=u1(l,h),u=yo(l)+yo(h);c<n?(n=c,r=o,a=u<a?u:a):c===n&&u<a&&(a=u,r=o)}return r||s-e}_chooseSplitAxis(t,e,s){const r=t.leaf?this.compareMinX:l1,n=t.leaf?this.compareMinY:h1,a=this._allDistMargin(t,e,s,r),o=this._allDistMargin(t,e,s,n);a<o&&t.children.sort(r)}_allDistMargin(t,e,s,r){t.children.sort(r);const n=this.toBBox,a=er(t,0,e,n),o=er(t,s-e,s,n);let l=un(a)+un(o);for(let h=e;h<s-e;h++){const c=t.children[h];ir(a,t.leaf?n(c):c),l+=un(a)}for(let h=s-e-1;h>=e;h--){const c=t.children[h];ir(o,t.leaf?n(c):c),l+=un(o)}return l}_adjustParentBBoxes(t,e,s){for(let r=s;r>=0;r--)ir(e[r],t)}_condense(t){for(let e=t.length-1,s;e>=0;e--)t[e].children.length===0?e>0?(s=t[e-1].children,s.splice(s.indexOf(t[e]),1)):this.clear():es(t[e],this.toBBox)}}function o1(i,t,e){if(!e)return t.indexOf(i);for(let s=0;s<t.length;s++)if(e(i,t[s]))return s;return-1}function es(i,t){er(i,0,i.children.length,t,i)}function er(i,t,e,s,r){r||(r=is(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let n=t;n<e;n++){const a=i.children[n];ir(r,i.leaf?s(a):a)}return r}function ir(i,t){return i.minX=Math.min(i.minX,t.minX),i.minY=Math.min(i.minY,t.minY),i.maxX=Math.max(i.maxX,t.maxX),i.maxY=Math.max(i.maxY,t.maxY),i}function l1(i,t){return i.minX-t.minX}function h1(i,t){return i.minY-t.minY}function yo(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function un(i){return i.maxX-i.minX+(i.maxY-i.minY)}function c1(i,t){return(Math.max(t.maxX,i.maxX)-Math.min(t.minX,i.minX))*(Math.max(t.maxY,i.maxY)-Math.min(t.minY,i.minY))}function u1(i,t){const e=Math.max(i.minX,t.minX),s=Math.max(i.minY,t.minY),r=Math.min(i.maxX,t.maxX),n=Math.min(i.maxY,t.maxY);return Math.max(0,r-e)*Math.max(0,n-s)}function vo(i,t){return i.minX<=t.minX&&i.minY<=t.minY&&t.maxX<=i.maxX&&t.maxY<=i.maxY}function dn(i,t){return t.minX<=i.maxX&&t.minY<=i.maxY&&t.maxX>=i.minX&&t.maxY>=i.minY}function is(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function nu(i,t,e,s,r){const n=[t,e];for(;n.length;){if(e=n.pop(),t=n.pop(),e-t<=s)continue;const a=t+Math.ceil((e-t)/s/2)*s;n1(i,a,t,e,r),n.push(t,a,a,e)}}var _o={exports:{}},au={exports:{}};(function(i,t){(function(e,s){i.exports=s()})(D0,function(){var e=function(n,a){if(n===void 0&&(n=[]),a===void 0&&(a=s),this.data=n,this.length=this.data.length,this.compare=a,this.length>0)for(var o=(this.length>>1)-1;o>=0;o--)this._down(o)};e.prototype.push=function(n){this.data.push(n),this.length++,this._up(this.length-1)},e.prototype.pop=function(){if(this.length!==0){var n=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),n}},e.prototype.peek=function(){return this.data[0]},e.prototype._up=function(n){for(var a=this,o=a.data,l=a.compare,h=o[n];n>0;){var c=n-1>>1,u=o[c];if(l(h,u)>=0)break;o[n]=u,n=c}o[n]=h},e.prototype._down=function(n){for(var a=this,o=a.data,l=a.compare,h=this.length>>1,c=o[n];n<h;){var u=(n<<1)+1,d=o[u],f=u+1;if(f<this.length&&l(o[f],d)<0&&(u=f,d=o[f]),l(d,c)>=0)break;o[n]=d,n=u}o[n]=c};function s(r,n){return r<n?-1:r>n?1:0}return e})})(au);var d1=au.exports;_o.exports=ou,_o.exports.default=ou;function ou(i,t,e,s,r,n){for(var a=i.data,o=[],l=i.toBBox,h,c,u,d,f=new d1(void 0,f1);a;){for(h=0;h<a.children.length;h++)c=a.children[h],u=g1(t,e,a.leaf?l(c):c),(!n||u<=n*n)&&f.push({node:c,isItem:a.leaf,dist:u});for(;f.length&&f.peek().isItem;)if(d=f.pop().node,(!r||r(d))&&o.push(d),s&&o.length===s)return o;a=f.pop(),a&&(a=a.node)}return o}function f1(i,t){return i.dist-t.dist}function g1(i,t,e){var s=lu(i,e.minX,e.maxX),r=lu(t,e.minY,e.maxY);return s*s+r*r}function lu(i,t,e){return i<t?t-i:i<=e?0:i-e}var hu=_o.exports;function cu(i){return i.map(t=>{const e=dt(t.meta.projection.proj,F.proj),s=new Z({geometry:new an([t.groundCoordinates.map(r=>e(r.slice(0,2),void 0,void 0))]),viewDirection:t.viewDirection});return s.setId(t.name),s})}function uu(i){const t=Bo();return Object.entries(i).map(([e,s])=>{const r=e.split("/").map(o=>Number.parseInt(o,10)),n=t.getTileCoordExtent(r),a=new Z({geometry:E_(n),state:s});return a.setId(e),a})}class Ne extends re{static get className(){return"ObliqueCollection"}static getDefaultOptions(){return{maxZoom:0,minZoom:0,scaleFactor:4,dataSets:void 0,hideLevels:0,activeOnStartup:!1}}constructor(t){super(t);const e=Ne.getDefaultOptions();this._directionTrees=new Map,this._images=new Map,this._dataSets=[],this.viewOptions={maxZoom:V(t.maxZoom,e.maxZoom),minZoom:V(t.minZoom,e.minZoom),scaleFactor:E(t.scaleFactor,e.scaleFactor),hideLevels:V(t.hideLevels,e.hideLevels)},this._loaded=!1,this.imagesLoaded=new R,this._tileFeatureSource=null,this._imageFeatureSource=null,Array.isArray(t.dataSets)&&t.dataSets.forEach(s=>{this._addDataSet(s)}),this._destroyed=new R,this.activeOnStartup=rt(t.activeOnStartup,e.activeOnStartup)}get dataSets(){return this._dataSets.slice()}get loaded(){return this._loaded}get destroyed(){return this._destroyed}get tileFeatureSource(){return this._tileFeatureSource||(this._tileFeatureSource=this._createTileFeatureSource()),this._tileFeatureSource}get imageFeatureSource(){return this._imageFeatureSource||(this._imageFeatureSource=this._createImageFeatureSource()),this._imageFeatureSource}get images(){return[...this._images.values()]}_createTileFeatureSource(){const t=uu(this.getTiles()),e=new Ss;return e.addFeatures(t),e}_createImageFeatureSource(){const t=cu([...this._images.values()]),e=new Ss;return e.addFeatures(t),e}async _loadDataSet(t){if(await t.load(),this._tileFeatureSource){const e=uu(t.getTiles());this._tileFeatureSource.addFeatures(e)}}_addDataSet(t){let e;t instanceof go?e=t:e=new go(t.url,t.projection,t.terrainProvider),e.imagesLoaded.addEventListener(({images:s,tileCoordinate:r})=>{this._loadImages(s,r)}),this._loadImages(e.images),this._dataSets.push(e)}async addDataSet(t){this._loadingPromise&&(await this._loadingPromise,await this._loadDataSet(t)),this._addDataSet(t)}async load(){this._loadingPromise||(this._loadingPromise=Promise.all(this._dataSets.map(t=>this._loadDataSet(t))),await this._loadingPromise,this._loaded=!0),await this._loadingPromise}_loadImages(t,e){if(e&&this._tileFeatureSource){const r=this._tileFeatureSource.getFeatureById(e);r&&r.set("state",at.READY)}const s=new Map;if(t.forEach(r=>{this._images.set(r.name,r),s.has(r.viewDirection)||s.set(r.viewDirection,[]);const n=dt(r.meta.projection.proj,F.proj),a=r.centerPointOnGround.slice(0,2);n(a,a,void 0),s.get(r.viewDirection).push({minX:a[0],minY:a[1],maxX:a[0],maxY:a[1],name:r.name})}),s.forEach((r,n)=>{this._directionTrees.get(n)||this._directionTrees.set(n,new po),this._directionTrees.get(n).load(r)}),this._imageFeatureSource){const r=cu(t);this._imageFeatureSource.addFeatures(r)}this.imagesLoaded.raiseEvent(t)}getTiles(){const t={};return this._dataSets.forEach(e=>{Object.entries(e.getTiles()).forEach(([s,r])=>{t[s]?t[s]=Qs([r,t[s]]):t[s]=r})}),t}getImageByName(t){return this._images.get(t)}getAvailableViewDirections(){return[...this._directionTrees.keys()]}getDataStateForCoordinate(t){const e=this._dataSets.map(s=>s.getDataStateForCoordinate(t));return Qs(e)}getDataStateForExtent(t){const e=this._dataSets.map(s=>s.getDataStateForExtent(t));return Qs(e)}async loadDataForCoordinate(t){await Promise.all(this._dataSets.map(e=>e.loadDataForCoordinate(t)))}async loadDataForExtent(t){await Promise.all(this._dataSets.map(e=>e.loadDataForExtent(t)))}_getNextImageForCoordinate(t,e){const s=this._directionTrees.get(e);if(s){const r=hu(s,t[0],t[1],1);if(r.length===1&&r[0].name)return this.getImageByName(r[0].name)}}getImageForCoordinate(t,e){const s=[e,...Object.values(ut).filter(r=>r!==e)];for(let r=0;r<s.length;r++){const n=this._getNextImageForCoordinate(t,s[r]);if(n)return n}}async loadImageForCoordinate(t,e){return await this.loadDataForCoordinate(t),this.getImageForCoordinate(t,e)}async hasImageAtCoordinate(t,e){const s=await this.loadImageForCoordinate(t,e);if(s){const r=dt(F.proj,s.meta.projection.proj),n=t.slice(0,2);r(n,n,void 0);const a=_s(s.groundCoordinates);return Cd(a,n)}return!1}async loadAdjacentImage(t,e,s=Math.PI/4){const r=this._directionTrees.get(t.viewDirection);if(r){const n=dt(t.meta.projection.proj,F.proj),a=t.groundCoordinates.map(u=>n(u.slice(0,2),void 0,void 0)),o=_s(a);await this.loadDataForExtent(qo(o,200));const l=Ln(o),c=hu(r,l[0],l[1],20).find(u=>{if(u.name!==t.name){let d=Math.atan2(u.minY-l[1],u.minX-l[0]);d<=0&&(d+=Math.PI*2);let f=d-e;if(f>Math.PI?f-=Math.PI*2:f<-Math.PI&&(f+=Math.PI*2),f<=s&&f>=-s)return u}return!1});if(c)return this.getImageByName(c.name)}}destroy(){this._dataSets.forEach(t=>{t.destroy()}),this._dataSets=[],[...this._directionTrees.values()].forEach(t=>{t.clear()}),this._directionTrees.clear(),this._images.clear(),this._tileFeatureSource&&(this._tileFeatureSource.clear(!0),this._tileFeatureSource=null),this._imageFeatureSource&&(this._imageFeatureSource.clear(!0),this._imageFeatureSource=null),this.imagesLoaded.destroy(),super.destroy(),this.destroyed.raiseEvent(),this._destroyed.destroy()}toJSON(){const t=super.toJSON(),e=Ne.getDefaultOptions();return this.viewOptions.maxZoom!==e.maxZoom&&(t.maxZoom=this.viewOptions.maxZoom),this.viewOptions.minZoom!==e.minZoom&&(t.minZoom=this.viewOptions.minZoom),this.viewOptions.scaleFactor!==e.scaleFactor&&(t.scaleFactor=this.viewOptions.scaleFactor),this.viewOptions.hideLevels!==e.hideLevels&&(t.hideLevels=this.viewOptions.hideLevels),this.dataSets.length>0&&(t.dataSets=this.dataSets.map(s=>s.toJSON())),t}}const m1=new Ks({name:"defaultObliqueMeta",size:[512,512],tileSize:[512,512],tileResolution:[1],projection:F,format:"png",url:""}),du=Symbol("isDefaultImage");class fu extends Ne{constructor(){super({})}getImageForCoordinate(t,e){const s=[[t[0]-100,t[1]-100,0],[t[0]+100,t[1]-100,0],[t[0]+100,t[1]+100,0],[t[0]-100,t[1]+100,0]],r=new cn({meta:m1,viewDirection:ut.NORTH,viewDirectionAngle:0,name:this.name,groundCoordinates:s,centerPointOnGround:t});return r[du]=!0,r}}function gu(i,t){return i<0?0:i>t?t:i}class mu{constructor(t){this._active=!1,this._loadingImage=null,this._olMap=t,this._viewCache=new Map,this._currentImage=null,this._currentView=null,this._collection=null,this._mapChangeEvent="postrender",this.imageChanged=new R,this.switchEnabled=!0,this.switchThreshold=0}get mapChangeEvent(){return this._mapChangeEvent}set mapChangeEvent(t){this._mapChangeEvent=t,this._active&&(this._postRenderListener&&yt(this._postRenderListener),this._postRenderListener=this._olMap.on(this._mapChangeEvent,this._postRenderHandler.bind(this)))}get loading(){return!!this._loadingImage}get active(){return this._active}get currentImage(){return this._currentImage}get collection(){return this._collection}setCollection(t){if(this._loadingImage=null,!t.loaded){console.error("cannot set an unloaded collection");return}this._collection=t,this._removeCurrentView(),this._currentView=null,this._currentImage=null}activate(){if(!this._collection)throw new Error("cannot activate provider without an oblique collection.");this._active||(this._active=!0,this._setCurrentView(),this._postRenderListener||(this._postRenderListener=this._olMap.on(this._mapChangeEvent,this._postRenderHandler.bind(this))))}deactivate(){this._currentView&&this._removeCurrentView(),this._postRenderListener&&(yt(this._postRenderListener),this._postRenderListener=null),this._active=!1}_pullCoordinateToImageCenter(t){if(this.currentImage){const e=[this.currentImage.meta.size[0]/2,this.currentImage.meta.size[1]/2];t[0]<e[0]?t[0]+=50:t[0]-=50,t[1]<e[1]?t[1]+=50:t[1]-=50}return t}_postRenderHandler(){if(this._active&&!this.loading&&this.switchEnabled){const t=this._currentImage?this._currentImage.meta.size:null,e=this._olMap.getView().getCenter(),s=this.switchThreshold,r=1-s;if(!this._currentImage||e[0]/t[0]>s&&e[0]/t[0]<r&&e[1]/t[1]>s&&e[1]/t[1]<r)return;const n=this._pullCoordinateToImageCenter(e.slice()),a=this._currentImage.transformImage2RealWorld(n).slice(0,2),l=dt(this._currentImage.meta.projection.proj,F.proj)(a,void 0,void 0),h=200,c=[l[0]-h,l[1]-h,l[0]+h,l[1]+h],u=this._collection.getDataStateForExtent(c);if(u===at.READY){const d=this._collection.getImageForCoordinate(l,this._currentImage.viewDirection);d&&d.name!==this._currentImage.name&&this._changeImage(d,e)}else u===at.PENDING&&this._collection.loadDataForExtent(c)}}async _changeImage(t,e){this._loadingImage=t;const{coords:s}=await ts(this._currentImage,e);this._loadingImage===t&&await this.setImage(t,s)}async setImage(t,e){if(!this._collection)throw new Error("cannot set an image without an oblique collection.");this._loadingImage=t;const s=!this._currentImage||this._currentImage.name!==t.name;if(this._currentImage=t,s&&await t.calculateImageAverageHeight(),t!==this._loadingImage)return!1;let r;this._viewCache.has(t.meta)?r=this._viewCache.get(t.meta):(r=new su(t.meta,this._collection.viewOptions),this._viewCache.set(t.meta,r));const n=this._currentView;this._currentView=r,s&&this._currentView.setImageName(this._currentImage.name,this._currentImage[du]);const[a,o]=this._currentImage.meta.size;let l=[a/2,o/2];if(e){const h=dt(F.proj,this._currentImage.meta.projection.proj)(e.slice(0,2),void 0,void 0),c=this._currentImage.transformRealWorld2Image(h,e[2]);c[0]=gu(c[0],a),c[1]=gu(c[1],o),l=c}return this._currentView.view.setCenter(l),this._active&&this._setCurrentView(n),this._loadingImage=null,s&&this.imageChanged.raiseEvent(t),!0}_setCurrentView(t){this._currentView&&(t&&t===this._currentView||(t&&this._olMap.removeLayer(t.layer),this._olMap.getView()&&this._olMap.getView().getResolution()&&this._currentView.view.setResolution(this._olMap.getView().getResolution()),this._olMap.setView(this._currentView.view),this._olMap.getLayers().insertAt(0,this._currentView.layer)))}_removeCurrentView(){this._currentView&&(this._olMap.getView()===this._currentView.view&&this._olMap.setView(new On),this._olMap.removeLayer(this._currentView.layer))}async setView(t,e,s=2){if(!this._collection)throw new Error("cannot set the view without an oblique collection.");const r=t.slice(),n=`${t.join("")}${e}${s}`;this._loadingImage=n;const a=await this._collection.loadImageForCoordinate(t,e);if(a){if(this._loadingImage!==n)return;if(this._loadingImage=a,!r[2]&&a.meta.terrainProvider){const l=[r];await yi(a.meta.terrainProvider,l,F,l)}if(this._loadingImage!==a)return;await this.setImage(a,r)&&this._currentView.view.setZoom(s)}else throw new Error("could not find an image for this direction")}async getView(){if(this._currentView&&this._currentImage){const t=this._currentView.view.getCenter(),{coords:e}=await ts(this._currentImage,t);return{center:e,direction:this._currentImage.viewDirection,zoom:this._currentView.view.getZoom()}}return null}destroy(){this._removeCurrentView(),[...this._viewCache.values()].forEach(t=>{t.destroy()}),this._viewCache.clear(),this._loadingImage=null,this._postRenderListener&&(yt(this._postRenderListener),this._postRenderListener=null),this.imageChanged.destroy(),this._collection=null,this._olMap=null}}const p1={[ut.NORTH]:0,[ut.EAST]:90,[ut.SOUTH]:180,[ut.WEST]:270},pu=new fu;function So(i){const{heading:t}=i;let e=ut.NORTH;return t>=45&&t<135?e=ut.EAST:t>=135&&t<225?e=ut.SOUTH:t>=225&&t<315&&(e=ut.WEST),e}function yu(i){const t=i.groundPosition||i.cameraPosition;return Xe(t,B.proj,F.proj)}class ae extends Ws{static get className(){return"ObliqueMap"}static getDefaultOptions(){return O(_({},Ee.getDefaultOptions()),{changeOnMoveEnd:!1,switchThreshold:0,switchOnEdge:!0})}constructor(t){super(t);const e=ae.getDefaultOptions();this._loadingCollection=null,this._mapChangeEvent=t.changeOnMoveEnd?"moveend":"postrender",this._switchThreshold=E(t.switchThreshold,e.switchThreshold),this._switchThreshold>1?this._switchThreshold=.2:this._switchThreshold<0&&(this._switchThreshold=0),this._switchEnabled=rt(t.switchOnEdge,e.switchOnEdge),this.collectionChanged=new R,this._activeCollectionDestroyedListener=()=>{}}get switchEnabled(){return this._switchEnabled}set switchEnabled(t){this._switchEnabled=t,this._obliqueProvider&&(this._obliqueProvider.switchEnabled=t)}get switchThreshold(){return this._switchThreshold}set switchThreshold(t){v(t,Number),this._switchThreshold=t,this._switchThreshold>1?this._switchThreshold=.2:this._switchThreshold<0&&(this._switchThreshold=0),this._obliqueProvider&&(this._obliqueProvider.switchThreshold=this._switchThreshold)}get mapChangeEvent(){return this._mapChangeEvent}async initialize(){this.initializedPromise||(this.initializedPromise=super.initialize().then(async()=>{this._obliqueProvider=new mu(this.olMap),this.mapChangeEvent=this._mapChangeEvent,this.switchThreshold=this._switchThreshold,this.switchEnabled=this._switchEnabled;let t=this._loadingCollection;t||(t=pu),t&&await this._setCollection(t)}).then(()=>{this.initialized=!0})),await this.initializedPromise}set mapChangeEvent(t){v(t,String),this._mapChangeEvent=t,this._obliqueProvider&&(this._obliqueProvider.mapChangeEvent=t)}get collection(){return this._obliqueProvider.collection}get imageChanged(){return this._obliqueProvider?this._obliqueProvider.imageChanged:null}get currentImage(){return this._obliqueProvider?this._obliqueProvider.currentImage:null}async canShowViewpoint(t){if(await this.initialize(),this.collection){const e=So(t),s=yu(t);return this.collection.hasImageAtCoordinate(s,e)}return!1}async activate(){await super.activate(),this.active&&this._obliqueProvider.activate()}getExtentOfCurrentImage(){const t=this.currentImage;if(t){const e=_s(t.groundCoordinates);return new pt({coordinates:Wo(e,t.meta.projection.proj,F.proj),projection:F.toJSON()})}return new pt({coordinates:[-189243134349e-4,-155387110963e-4,189243134349e-4,155387110963e-4],projection:F.toJSON()})}deactivate(){super.deactivate(),this._obliqueProvider.deactivate()}async setCollection(t,e){v(t,Ne),!this.movementDisabled&&(this._loadingCollection=t,!!this.initializedPromise&&(await this.initializedPromise,this._loadingCollection===t&&await this._setCollection(t,e)))}async _setCollection(t,e){this._loadingCollection=t,this._activeCollectionDestroyedListener(),this._activeCollectionDestroyedListener=t.destroyed.addEventListener(()=>{this._setCollection(pu)}),await t.load();const s=e||await this.getViewPoint();this._loadingCollection===t&&(this._obliqueProvider.setCollection(t),this.collectionChanged.raiseEvent(t),s&&await this.gotoViewPoint(s))}async setImageByName(t,e){if(this.movementDisabled||!this.initializedPromise)return;await this.initializedPromise;const s=this._obliqueProvider.collection.getImageByName(t);s&&await this._obliqueProvider.setImage(s,e)}async getViewPoint(){const t=this.currentImage;if(!t)return null;const e=this.olMap.getView().getCenter();if(!e)return null;const s={dataProjection:B},{coords:r}=await ts(t,e,s);return this._computeViewpointInternal(r)}getViewPointSync(){const t=this.currentImage;if(!t)return null;const e=this.olMap.getView().getCenter();if(!e)return null;const s=t.transformImage2RealWorld(e,t.averageHeight),n=dt(t.meta.projection.proj,B.proj)(s.slice(0,2),void 0,void 0);return this._computeViewpointInternal(n)}_computeViewpointInternal(t){const e=this.currentImage,{size:s,fovy:r,metersPerUnit:n}=ao(this.olMap,e),h=(this.olMap.getView().getResolution()||1)*s.height*n,c=Math.abs(h/2/Math.tan(r/2)),u=t[2]||e.averageHeight,d=c+u;return new oe({cameraPosition:[t[0],t[1],d],groundPosition:t,heading:p1[e.viewDirection],pitch:-90,roll:0,distance:c})}async gotoViewPoint(t){if(this.movementDisabled||!this._obliqueProvider||!t.isValid())return;const e=So(t),s=yu(t),{distance:r}=t;if(await this._obliqueProvider.setView(s,e),this._obliqueProvider.currentImage){const n=Xc(this.olMap,this._obliqueProvider.currentImage,r);this.olMap.getView().setZoom(n)}}pointIsVisible(t){const e=this.currentImage;if(!e||!this.active)return!1;const r=this.olMap.getView().calculateExtent(this.olMap.getSize()),n=e.transformImage2RealWorld([r[0],r[1]]),a=e.transformImage2RealWorld([r[2],r[3]]),o=[n[0],n[1],a[0],a[1]],l=Wo(o,e.meta.projection.proj,B.proj);return ko(l,t[0],t[1])}toJSON(){const t=super.toJSON(),e=ae.getDefaultOptions();return this.mapChangeEvent==="movened"&&(t.changeOnMoveEnd=!0),this.switchThreshold!==e.switchThreshold&&(t.switchThreshold=this.switchThreshold),this.switchEnabled!==e.switchOnEdge&&(t.switchOnEdge=this.switchEnabled),t}destroy(){this._obliqueProvider&&this._obliqueProvider.destroy(),this.collectionChanged.destroy(),this._activeCollectionDestroyedListener(),super.destroy()}}ri.registerClass(ae.className,ae);const fn={HEIGHT:"height",DISTANCE:"distance"};class as{static get className(){return"CameraLimiter"}static getDefaultOptions(){return{mode:fn.HEIGHT,terrainUrl:void 0,limit:200,level:12}}constructor(t){const e=as.getDefaultOptions();this.mode=Qn(t.mode,fn,e.mode),this._terrainUrl=t.terrainUrl||e.terrainUrl,this._terrainProvider=this._terrainUrl?Qi({url:this._terrainUrl}):null,this.limit=E(t.limit,e.limit),this.level=t.level===null?null:V(t.level,e.level),this.lastCheckedPosition=new et,this._terrainHeight=null,this._updatingTerrainHeight=!1}get terrainUrl(){return this._terrainUrl}set terrainUrl(t){it(t,String),this._terrainUrl!==t&&(this._terrainUrl=t,this._terrainProvider=this._terrainUrl?Qi({url:this._terrainUrl}):null)}_limitWithLevel(t){return Bc(this._terrainProvider,this.level,t)?uf(this._terrainProvider,this.level,[t]):this._limitMostDetailed(t)}_limitMostDetailed(t){return _r(this._terrainProvider,[t])}async _updateTerrainHeight(t){if(!this._updatingTerrainHeight&&!t.equalsEpsilon(this.lastCheckedPosition,P.EPSILON5)){this._updatingTerrainHeight=!0;const[e]=this.level!=null?await this._limitWithLevel(t.clone()):await this._limitMostDetailed(t.clone());this._terrainHeight=e.height,this.lastCheckedPosition=t,this._updatingTerrainHeight=!1}}limitCamera(t){let e=Promise.resolve();const s=et.fromCartesian(t.position);if(s)if(this.mode===fn.DISTANCE&&this._terrainProvider){if(e=this._updateTerrainHeight(s),this._terrainHeight&&s.height-this._terrainHeight<this.limit){const r=this._terrainHeight+this.limit;et.toCartesian(new et(s.longitude,s.latitude,r),Vn.WGS84,t.position)}}else s.height<this.limit&&et.toCartesian(new et(s.longitude,s.latitude,this.limit),Vn.WGS84,t.position);return e}toJSON(){const t={},e=as.getDefaultOptions();return this.terrainUrl&&(t.terrainUrl=this.terrainUrl),this.limit!==e.limit&&(t.limit=this.limit),this.mode!==e.mode&&(t.mode=this.mode),this.level!==e.level&&(t.level=this.level),t}}function gn(i,t,e){const s=e.indexOfKey(t[z]);if(s>-1&&!i.contains(t)){const r=i.length;let n=r;for(let a=0;a<r;a++){const o=i.get(a);if(e.indexOfKey(o[z])>s){n=a;break}}i.add(t,n)}}async function vu(i,t,e){const s=e.indexOfKey(t[z]);if(s>-1){i.contains(t)||await i.add(t);const r=i.length;let n=r;for(let o=0;o<r;o++){const l=i.get(o);if(e.indexOfKey(l[z])>s){n=o;break}}let a=i.indexOf(t);if(n>a&&(n-=1),a<n)for(;a<n;)i.raise(t),a=i.indexOf(t);else if(a>n)for(;a>n;)i.lower(t),a=i.indexOf(t)}}function y1(i,t,e){const{destroyPrimitives:s}=i;i.destroyPrimitives=!1,i.remove(t),gn(i,t,e),i.destroyPrimitives=s}function v1(i,t,e){i.remove(t,!1),gn(i,t,e)}function _1(i,t,e){vu(i,t,e)}function _u(i,t){return t.clockRange=i.clockRange,t.clockStep=i.clockStep,t.multiplier=i.multiplier,(!t.startTime||!t.startTime.equals(i.startTime)||!t.stopTime||!t.stopTime.equals(i.stopTime))&&(t.startTime=i.startTime,t.stopTime=i.stopTime,t.currentTime=i.currentTime),i.definitionChanged.addEventListener((e,s,r)=>{t[s]=r})}function Su(i,t){i.debugShowRenderingStatistics=t,i.debugShowBoundingVolume=t,i.debugShowContentBoundingVolume=t}function S1(i,t){i.filter(e=>e instanceof ws).forEach(e=>{Su(e,t)})}df.enableModelExperimental=!1;class G extends Ee{static get className(){return"CesiumMap"}static getDefaultOptions(){return O(_({},Ee.getDefaultOptions()),{enableLightning:!0,tileCacheSize:1,webGLaa:!1,cameraLimiter:void 0,globeColor:"#3f47cc"})}constructor(t){super(t);const e=G.getDefaultOptions();this._cesiumWidget=null,this.dataSourceDisplayClock=new ff({shouldAnimate:!0});const s=new gf;s.currentTime=this.dataSourceDisplayClock.currentTime,this._defaultClock=s,this._dataSourceClocks=[],this.debugMode=!1,this.enableLightning=rt(t.enableLightning,e.enableLightning),this.tileCacheSize=V(t.tileCacheSize,e.tileCacheSize),this.screenSpaceEventHandler=null,this._screenSpaceListeners=[],this.defaultJDate=al.fromDate(new Date(2014,6,20,13,0,0,0)),this.webGLaa=rt(t.webGLaa,e.webGLaa),this.globeColor=Ot.fromCssColorString(t.globeColor||e.globeColor),this._clusterDataSourceDisplay=null,this._terrainProvider=null,this.defaultTerrainProvider=null,this._cameraLimiter=null,this._cameraLimiterOptions=t.cameraLimiter||e.cameraLimiter,this._terrainProviderChangedListener=null,this._preUpdateListener=null,this._clockTickListener=null,this._clockSyncListener=null,this._removeClusterClockTickListener=null,this._debug=!1}get terrainProvider(){return this._terrainProvider}get cameraLimiter(){return this._cameraLimiter}set cameraLimiter(t){it(t,as),this._cameraLimiter!==t&&(this._cameraLimiter=t,this._cameraLimiter&&!this._preUpdateListener&&this._cesiumWidget?this._setupPreUpdateListener():!this._cameraLimiter&&this._preUpdateListener&&(this._preUpdateListener(),this._preUpdateListener=null))}get debug(){return this._debug}set debug(t){v(t,Boolean),this._debug!==t&&(this._debug=t,this.initialized&&this._setDebug())}_setupPreUpdateListener(){this._preUpdateListener=this._cesiumWidget.scene.preUpdate.addEventListener(()=>{this._cameraLimiter&&this._cameraLimiter.limitCamera(this._cesiumWidget.scene.camera)})}_raisePointerInteraction(t,e,s,r){const n=this.screenSpaceEventHandler._positions.length>1;this.pointerInteractionEvent.raiseEvent({map:this,windowPosition:r.position||r.endPosition,key:t,pointer:e,multipleTouch:n,pointerEvent:s})}_setupInteractions(){const t=[{csModifier:Bn.ALT,vcsModifier:lt.ALT},{csModifier:Bn.CTRL,vcsModifier:lt.CTRL},{csModifier:Bn.SHIFT,vcsModifier:lt.SHIFT},{csModifier:void 0,vcsModifier:lt.NONE}],e=[{type:Ze.LEFT_DOWN,pointerEvent:zt.DOWN,pointer:mt.LEFT},{type:Ze.LEFT_UP,pointerEvent:zt.UP,pointer:mt.LEFT},{type:Ze.RIGHT_DOWN,pointerEvent:zt.DOWN,pointer:mt.RIGHT},{type:Ze.RIGHT_UP,pointerEvent:zt.UP,pointer:mt.RIGHT},{type:Ze.MIDDLE_DOWN,pointerEvent:zt.DOWN,pointer:mt.MIDDLE},{type:Ze.MIDDLE_UP,pointerEvent:zt.UP,pointer:mt.MIDDLE},{type:Ze.MOUSE_MOVE,pointerEvent:zt.MOVE,pointer:mt.ALL}];this._screenSpaceListeners=e.map(({pointerEvent:s,pointer:r,type:n})=>t.map(({csModifier:a,vcsModifier:o})=>(this.screenSpaceEventHandler.setInputAction(l=>{this._raisePointerInteraction(o,r,s,l)},n,a),()=>{this.screenSpaceEventHandler.removeInputAction(n,a)}))).flat()}async initialize(){if(!this.initialized){this._cesiumWidget=new mf(this.mapElement,{requestRenderMode:!1,scene3DOnly:!0,imageryProvider:!1,shadows:!1,terrainShadows:Cs.ENABLED,contextOptions:{webgl:{failIfMajorPerformanceCaveat:!1,antialias:this.webGLaa}}}),this._cesiumWidget.scene.globe.tileCacheSize=this.tileCacheSize,this._cesiumWidget.scene.globe.baseColor=this.globeColor,this.dataSourceDisplay=new ol({scene:this._cesiumWidget.scene,dataSourceCollection:new ll}),this._cesiumWidget.scene.frameState.creditDisplay.update=()=>{},this._cesiumWidget.scene.frameState.creditDisplay.beginFrame=()=>{},this._cesiumWidget.scene.frameState.creditDisplay.endFrame=()=>{};const{clock:t}=this._cesiumWidget;t.shouldAnimate=!0,this._clockTickListener=t.onTick.addEventListener(()=>{this.dataSourceDisplayClock.tick();const s=this.dataSourceDisplayClock.currentTime;this.dataSourceDisplay.update(s)}),pf.maximumRequestsPerServer=12,this._cesiumWidget.scene.shadowMap.maximumDistance=5e3,this._cesiumWidget.scene.shadowMap.darkness=.6,this._cesiumWidget.scene.globe.depthTestAgainstTerrain=!0,this._cesiumWidget.scene.highDynamicRange=!1,this._cesiumWidget.scene.imagerySplitPosition=.5,this._cesiumWidget.scene.globe.enableLighting=this.enableLightning,this.setDay(this.defaultJDate);const e=document.getElementsByClassName("cesium-widget-credits");if(e)for(let s=0;s<e.length;s++){const r=e[s];r.style.display="none"}this._cameraLimiterOptions&&!this._cameraLimiter&&(this._cameraLimiter=new as(this._cameraLimiterOptions)),this._cameraLimiter&&this._setupPreUpdateListener(),this.screenSpaceEventHandler=new yf(this._cesiumWidget.scene.canvas),this._setupInteractions(),this.initialized=!0,this.defaultTerrainProvider=this._cesiumWidget.scene.terrainProvider,this._terrainProvider=this.defaultTerrainProvider,this._terrainProviderChangedListener=this._cesiumWidget.scene.terrainProviderChanged.addEventListener(this._terrainProviderChanged.bind(this)),this._debug&&this._setDebug()}}async activate(){await super.activate(),this.active&&(this._cesiumWidget.useDefaultRenderLoop=!0,this._cesiumWidget.resize())}deactivate(){super.deactivate(),this._cesiumWidget&&(this._cesiumWidget.useDefaultRenderLoop=!1)}getHeightFromTerrain(t){const{terrainProvider:e}=this._cesiumWidget.scene;return e.readyPromise.then(()=>e.availability?yi(e,t,F,t):Promise.resolve(t))}async getViewPoint(){return this.getViewPointSync()}getViewPointSync(){if(!this._cesiumWidget||!this._cesiumWidget.scene||!this.target)return null;const t=this._cesiumWidget.scene.camera,e=t.position;let s=null,r=null;const n=new vf(t.position,t.direction),a=this._cesiumWidget.scene.globe.pick(n,this._cesiumWidget.scene);if(a){r=C.distance(a,e);const h=Vn.WGS84.cartesianToCartographic(a);s=[P.toDegrees(h.longitude),P.toDegrees(h.latitude),h.height]}const o=t.positionCartographic,l=[P.toDegrees(o.longitude),P.toDegrees(o.latitude),o.height];return new oe({groundPosition:s,cameraPosition:l,distance:r,heading:P.toDegrees(t.heading),pitch:P.toDegrees(t.pitch),roll:P.toDegrees(t.roll)})}async gotoViewPoint(t,e){if(this.movementDisabled||!t.isValid())return;let s=null;const{distance:r}=t,n=P.toRadians(t.heading),a=P.toRadians(t.pitch),o=P.toRadians(t.roll);if(t.cameraPosition){const c=t.cameraPosition;s=C.fromDegrees(c[0],c[1],c[2])}else{if(!t.groundPosition)return;const c=t.groundPosition;if(!c[2]){const g=await this.getHeightFromTerrain([T.wgs84ToMercator(c)]);c[2]=g[0][2]}const u=C.fromDegrees(c[0],c[1],c[2]),d=new _f(this._cesiumWidget.scene),f={destination:u,orientation:{heading:n,pitch:a,roll:o}};d.setView(f),d.moveBackward(r),s=d.position}const l=this._cesiumWidget.scene.camera,h={heading:n,pitch:a,roll:o};s=s||null,l.cancelFlight(),t.animate?await new Promise(c=>{const u={destination:s,orientation:h,complete:()=>{c()},cancel:()=>{c()}};t.duration&&(u.duration=t.duration),t.easingFunction&&(u.easingFunction=t.easingFunction),e&&(u.maximumHeight=e),l.flyTo(u)}):l.setView({destination:s,orientation:h})}getCurrentResolution(t){const e=this._cesiumWidget.scene.camera,s=T.mercatorToWgs84(t),r=C.distance(C.fromDegrees(s[0],s[1],s[2]),e.position),n=Math.PI/3,a=this.mapElement.offsetWidth,o=this.mapElement.offsetHeight,l=a/o,h=Math.atan(Math.tan(n*.5)/l)*2,c=2*r*Math.tan(h/2),u=Math.cos(Math.abs(P.toRadians(s[1])));return c/u/o}disableMovement(t){super.disableMovement(t),this._cesiumWidget.scene.screenSpaceCameraController.enableInputs=!t}setDataSourceDisplayClock(t){const e=this._dataSourceClocks[this._dataSourceClocks.length-1];t!==e&&(this._clockSyncListener&&(this._clockSyncListener(),this._clockSyncListener=null),this._clockSyncListener=_u(t,this.dataSourceDisplayClock)),this._dataSourceClocks.push(t)}unsetDataSourceDisplayClock(t){const e=this._dataSourceClocks.lastIndexOf(t);if(e>-1&&(this._dataSourceClocks.splice(e,1),e===this._dataSourceClocks.length)){const s=this._dataSourceClocks[this._dataSourceClocks.length-1]||this._defaultClock;this._clockSyncListener&&(this._clockSyncListener(),this._clockSyncListener=null),this._clockSyncListener=_u(s,this.dataSourceDisplayClock)}}setDay(t){this._cesiumWidget.clock.currentTime=t,this._cesiumWidget.clock.multiplier=1}setLightning(t){this.enableLightning=t,this._cesiumWidget.scene.globe.enableLighting=t}getCesiumWidget(){return this._cesiumWidget}getEntities(){return this.dataSourceDisplay.defaultDataSource.entities}getDatasources(){return this.dataSourceDisplay.dataSources}getClusterDatasources(){if(this._clusterDataSourceDisplay)return this._clusterDataSourceDisplay.dataSources;const t=new ll;function e(s,r,n){const{entities:a}=n;return[new wf(r,a),new xf(r,a),new bf(r,a)]}return this._clusterDataSourceDisplay=new ol({scene:this._cesiumWidget.scene,dataSourceCollection:t,visualizersCallback:e}),this._removeClusterClockTickListener=this._cesiumWidget.clock.onTick.addEventListener(s=>{this._clusterDataSourceDisplay.update(s.currentTime)}),t}indexChanged(t){const e=this.getVisualizationsForLayer(t);e&&e.forEach(s=>{s instanceof Hn?y1(this.getScene().primitives,s,this.layerCollection):s instanceof Je?v1(this.getScene().imageryLayers,s,this.layerCollection):s instanceof hl&&_1(this.dataSourceDisplay.dataSources,s,this.layerCollection)})}addPrimitiveCollection(t){this.validateVisualization(t)&&(this.addVisualization(t),this._debug&&t instanceof ws&&Su(t,this._debug),gn(this.getScene().primitives,t,this.layerCollection))}removePrimitiveCollection(t){var e;this.removeVisualization(t),(e=this.getScene())==null||e.primitives.remove(t)}addImageryLayer(t){this.validateVisualization(t)&&(this.addVisualization(t),gn(this.getScene().imageryLayers,t,this.layerCollection))}removeImageryLayer(t){var e;this.removeVisualization(t),(e=this.getScene())==null||e.imageryLayers.remove(t)}async addDataSource(t){this.validateVisualization(t)&&(this.addVisualization(t),await vu(this.dataSourceDisplay.dataSources,t,this.layerCollection))}removeDataSource(t){this.removeVisualization(t),!this.dataSourceDisplay.isDestroyed()&&!this.dataSourceDisplay.dataSources.isDestroyed()&&this.dataSourceDisplay.dataSources.remove(t)}setTerrainProvider(t){this.terrainProvider!==t&&(this._cesiumWidget.scene.terrainProvider=t)}unsetTerrainProvider(t){this.terrainProvider===t&&(this._terrainProvider=this.defaultTerrainProvider,this._cesiumWidget.scene.terrainProvider=this.defaultTerrainProvider)}getDataSourceDisplay(){return this.dataSourceDisplay}getScene(){var t;return(t=this._cesiumWidget)==null?void 0:t.scene}pointIsVisible(t){const{camera:e}=this._cesiumWidget.scene,s=C.fromDegrees(t[0],t[1],0);return e.frustum.computeCullingVolume(e.positionWC,e.directionWC,e.upWC).computeVisibility(new cl(s))===Sf.INSIDE}_setDebug(){this._debug&&this.initialized&&!this._cesiumInspectorContainer&&(this._cesiumInspectorContainer=document.createElement("div"),this._cesiumInspectorContainer.className="vcm-cesium-inspector",this.mapElement.appendChild(this._cesiumInspectorContainer),this._cesiumInspector=new Mf(this._cesiumInspectorContainer,this.getScene()),this._cesium3DTilesInspector=new Cf(this._cesiumInspectorContainer,this.getScene()),this._cesium3DTilesInspector.viewModel.picking=!1),this._cesiumInspectorContainer&&(this._cesiumInspectorContainer.style.display=this.active&&this._debug?"":"none"),S1(this.getVisualizations(),this._debug)}_terrainProviderChanged(t){if(this.terrainProvider!==t){const e=this.layerCollection.getByKey(this.terrainProvider[z]);this._terrainProvider=t,e&&e.deactivate()}}pickPositionSupported(){return this.initialized?this._cesiumWidget.scene.pickPositionSupported:!1}isGroundPrimitiveSupported(){return this.initialized?this._cesiumWidget.scene.context.fragmentDepth:!1}toJSON(){const t=super.toJSON(),e=G.getDefaultOptions();return this.enableLightning!==e.enableLightning&&(t.enableLightning=this.enableLightning),this.tileCacheSize!==e.tileCacheSize&&(t.tileCacheSize=this.tileCacheSize),this.webGLaa!==e.webGLaa&&(t.webGLaa=this.webGLaa),this.globeColor.toCssHexString()!==e.globeColor&&(t.globeColor=this.globeColor.toCssHexString()),this._cameraLimiter?t.cameraLimiter=this._cameraLimiter.toJSON():this._cameraLimiterOptions&&!this.initialized&&(t.cameraLimiter=this._cameraLimiterOptions),t}destroy(){this.dataSourceDisplay&&!this.dataSourceDisplay.isDestroyed()&&this.dataSourceDisplay.destroy(),this._screenSpaceListeners.forEach(t=>{t()}),this.screenSpaceEventHandler&&(this.screenSpaceEventHandler.destroy(),this.screenSpaceEventHandler=null),this._terrainProviderChangedListener&&(this._terrainProviderChangedListener(),this._terrainProviderChangedListener=null),this._terrainProvider=null,this.defaultTerrainProvider=null,this._clockTickListener&&(this._clockTickListener(),this._clockTickListener=null),this._clockSyncListener&&(this._clockSyncListener(),this._clockSyncListener=null),this._preUpdateListener&&(this._preUpdateListener(),this._preUpdateListener=null),this._cameraLimiter&&(this._cameraLimiter=null),this._removeClusterClockTickListener&&this._removeClusterClockTickListener(),[...this.layerCollection].forEach(t=>{t.removedFromMap(this)}),this._clusterDataSourceDisplay&&this._clusterDataSourceDisplay.destroy(),this._cesiumWidget&&(this._cesiumWidget.destroy(),this._cesiumWidget=null),this._cesium3DTilesInspector&&(this._cesium3DTilesInspector.destroy(),this._cesium3DTilesInspector=null),this._cesiumInspector&&(this._cesiumInspector.destroy(),this._cesiumInspector=null),this._cesiumInspectorContainer&&(this._cesiumInspectorContainer.parentElement.removeChild(this._cesiumInspectorContainer),this._cesiumInspectorContainer=null),super.destroy()}}ri.registerClass(G.className,G);class Ct extends _e{static get className(){return"VectorLayer"}static get alreadyTransformedToMercator(){return Eh}static get alreadyTransformedToImage(){return Ve}static get obliqueGeometry(){return Yr}static get doNotTransform(){return Ia}static get originalFeatureSymbol(){return Be}static getDefaultOptions(){return O(_({},ht.getDefaultOptions()),{projection:void 0,maxResolution:void 0,minResolution:void 0,dontUseTerrainForOblique:!1,zIndex:50,highlightStyle:void 0,isDynamic:!1,vectorProperties:{}})}constructor(t){super(t);this._supportedMaps=[G.className,ae.className,tt.className];const e=Ct.getDefaultOptions();this.source=new Ss({}),this.projection=new T(t.projection),this.maxResolution=t.maxResolution!=null?t.maxResolution:e.maxResolution,this.minResolution=t.minResolution!=null?t.minResolution:e.minResolution,this.dontUseTerrainForOblique=rt(t.dontUseTerrainForOblique,e.dontUseTerrainForOblique),this.highlightStyle=e.highlightStyle,t.highlightStyle&&(this.highlightStyle=t.highlightStyle instanceof q?t.highlightStyle:new q(t.highlightStyle)),this.hasFeatureUUID=!1,this._visibility=!0,this.isDynamic=rt(t.isDynamic,e.isDynamic),this._onStyleChangeRemover=null,this.vectorProperties=new te(_({allowPicking:this.allowPicking},t.vectorProperties));let s=t.style;t.style instanceof ne&&(s=t.style.toJSON()),this._initialStyle=s}get allowPicking(){return super.allowPicking}set allowPicking(t){super.allowPicking=t,this.vectorProperties.allowPicking=t}get visibility(){return this._visibility}set visibility(t){this._visibility!==t&&(this._visibility=t,this.forceRedraw())}initialize(){return super.initialize().then(()=>{this._trackStyleChanges()})}getVcsMeta(t={}){const e=this.vectorProperties.getVcsMeta();if(e.version=Ea,t.embedIcons&&(e.embeddedIcons=[]),t.writeStyle){const s=this.getStyleOrDefaultStyle(this._initialStyle);(t.writeDefaultStyle||!s.equals(this.style))&&Th(this.style,e)}return e}setVcsMeta(t){this.vectorProperties.setVcsMeta(t)}getImplementationOptions(){return O(_({},super.getImplementationOptions()),{source:this.source,maxResolution:this.maxResolution,minResolution:this.minResolution,vectorProperties:this.vectorProperties})}createImplementationsForMap(t){return this.visibility?t instanceof tt?[new Xa(t,this.getImplementationOptions())]:t instanceof G?[new Vc(t,this.getImplementationOptions())]:t instanceof ae?[new ho(t,this.getImplementationOptions())]:[]:[]}getStyleOrDefaultStyle(t,e){return super.getStyleOrDefaultStyle(t,e||oi.clone())}setStyle(t,e){super.setStyle(t,e),this._trackStyleChanges();const s=this.style instanceof Mt;this.getFeatures().forEach(r=>{if(r[Tt]){let n;s?(n=!0,r.setStyle(void 0)):r.getStyle()!==r[Tt].style&&(n=!0,r.setStyle(r[Tt].style)),n&&Reflect.has(r,pe)&&xa(r)}})}_trackStyleChanges(){this._onStyleChangeRemover&&(this._onStyleChangeRemover(),this._onStyleChangeRemover=null);const t=this.style instanceof Mt;this._onStyleChangeRemover=this.style.styleChanged.addEventListener(()=>{this.getFeatures().forEach(e=>{(t||!e[Tt])&&e.changed()})})}setHighlightStyle(t){v(t,[ft,q,Function]),t instanceof q?this.highlightStyle=t:(this.highlightStyle||(this.highlightStyle=new q({})),this.highlightStyle.style=t)}getSource(){return this.source}addFeatures(t){v(t,[Z]);const e=this.style instanceof Mt,s=t.map(r=>{const n=r.getId();if(n==null)r.setId(Xt());else if(this.hasFeatureUUID=!0,n&&this.getFeatureById(n))return!1;if(this.projection.epsg!==F.epsg){const a=r.getGeometry();a&&(a[Ct.alreadyTransformedToMercator]||(a.transform(this.projection.proj,F.proj),a[Ct.alreadyTransformedToMercator]=!0))}return r[ht.vcsLayerNameSymbol]=this.name,e&&r[Tt]&&r.setStyle(),r}).filter(r=>r);return this.source.addFeatures(s),t.map(r=>r.getId())}removeFeaturesById(t){const e=this.getFeaturesById(t);for(let s=0;s<e.length;s++)this.source.removeFeature(e[s])}removeAllFeatures(){this.source.clear()}getFeaturesById(t){return v(t,[[String,Number]]),t.map(e=>this.getFeatureById(e)).filter(e=>e!=null)}getFeatureById(t){return this.source.getFeatureById(t)}getFeatures(){return this.source.getFeatures()}getZoomToExtent(){const t=super.getZoomToExtent();if(t)return t;const e=new pt({projection:F.toJSON(),coordinates:this.source.getExtent()});return e.isValid()?e:null}objectClickedHandler(t){const e=t[Be]||t;return this.vectorProperties.getAllowPicking(e)?{id:e.getId(),feature:e}:null}getGenericFeatureFromClickedObject(t){return Ya(t,this)}toJSON(){const t=super.toJSON(),e=Ct.getDefaultOptions();this.projection.epsg!==hh().epsg&&(t.projection=this.projection.toJSON()),this.maxResolution!==e.maxResolution&&(t.maxResolution=this.maxResolution),this.minResolution!==e.minResolution&&(t.minResolution=this.minResolution),this.dontUseTerrainForOblique!==e.dontUseTerrainForOblique&&(t.dontUseTerrainForOblique=this.dontUseTerrainForOblique),this.highlightStyle&&(t.highlightStyle=this.highlightStyle.toJSON()),this.isDynamic!==e.isDynamic&&(t.isDynamic=this.isDynamic);const s=this.vectorProperties.getVcsMeta();return Object.keys(s).length>0&&(t.vectorProperties=s),t}destroy(){this.source&&this.source.clear(!0),this._onStyleChangeRemover&&this._onStyleChangeRemover(),this.vectorProperties.destroy(),super.destroy()}}ot.registerClass(Ct.className,Ct);const Qt=Symbol("vcsFeatureType"),vi={DYNAMIC:"dynamic",STATIC:"static",EDITED:"edited"},M1="EPSG:3857";let Mo;function Co(){return Mo||(Mo=new Yo),Mo}function Mu(i){const{crs:t}=i;if(t){if(t.type==="name")return t.properties.name;if(t.type==="EPSG")return`EPSG:${t.properties.code}`}return null}function Cu(i){if(i.get("altitudeMode")&&(i.set("olcs_altitudeMode",i.get("altitudeMode"),!0),i.unset("altitudeMode",!0)),i.get("extrudedHeight")){if(i.get("drawingType"))i.set("olcs_extrudedHeight",i.get("extrudedHeight"),!0);else{const t=Fe.fromGeometry(i.getGeometry()),e=Number.isFinite(t.minZ)?t.minZ:0;i.set("olcs_extrudedHeight",i.get("extrudedHeight")-e,!0)}i.unset("extrudedHeight",!0)}i.get("skirt")&&(i.set("olcs_skirt",i.get("skirt"),!0),i.unset("skirt",!0)),i.get("radius")&&i.unset("radius",!0)}function C1(i,t){const e=Co().readGeometry(i,t.formatOptions);return String(t.formatOptions.featureProjection)==="EPSG:3857"&&(e[Ct.alreadyTransformedToMercator]=!0),Wa(e),new Z({geometry:e})}function wu(i,t){return i.image&&i.image.src&&/^:\d+$/.test(i.image.src)&&(t.embeddedIcons?i.image.src=t.embeddedIcons[i.image.src.substring(1)]:delete i.image.src),i}function w1(i,t){const e=i.color?bt(i.color):!1,s=i.width||1.25,r=i.pointRadius||5,n=i.opacity||.8;if(delete i.color,delete i.width,delete i.pointRadius,delete i.opacity,t==="Polygon"||t==="Circle"){const a=e?e.slice():[255,255,255,.4];return a[3]=n,{fill:{color:a},stroke:{color:e||bt("#3399CC"),width:s}}}if(t==="LineString")return{stroke:{color:e||bt("#3399CC"),width:s}};if(t==="Point")return{image:{fill:{color:[255,255,255,.4]},radius:r,stroke:{color:e||bt("#3399CC"),width:1}}}}function xu(i,t){if(!i.geometry)return null;const e=i.geometry.olcs_radius;let s=Co().readGeometry(i.geometry,t.formatOptions);if(i.radius&&s instanceof bi){const a=s.getCoordinates();a.length===2&&a.push(0),s=new le(a,i.radius,"XYZ")}if(e&&s instanceof bi){const a=s.getCoordinates();a.length===2&&a.push(0),s=Ba(a,e)}String(t.formatOptions.featureProjection)==="EPSG:3857"&&(s[Ct.alreadyTransformedToMercator]=!0),i.vcsMeta=i.vcsMeta||{},i.vcsStyle&&(i.vcsMeta.style=i.vcsMeta.style||i.vcsStyle);const{properties:r}=i;t.readLegacyStyleOptions&&!i.vcsMeta.style&&(i.vcsMeta.style=w1(r,s.getType())),Wa(s);const n=new Z(O(_({},r),{geometry:s}));if(i.id&&n.setId(i.id),i.state&&(n[Qt]=i.state),i.vcsMeta.style&&!t.dontReadStyle){i.vcsMeta.style=wu(i.vcsMeta.style,t);let a;t.defaultStyle?(a=t.defaultStyle.clone().assign(new q(i.vcsMeta.style)),a.label!=null&&s.set("_vcsGeomType","Label")):a=new q(i.vcsMeta.style),n[Tt]=a,n.setStyle(a.style)}return Cu(n),n}function Ie(i,t={}){const e=typeof i=="string"?JSON.parse(i):i,s=Mu(e),r=s?{epsg:s}:t.dataProjection,n={formatOptions:{dataProjection:r?r.epsg:B.epsg,featureProjection:t.targetProjection?t.targetProjection.epsg:F.epsg},dontReadStyle:t.dontReadStyle,readLegacyStyleOptions:t.readLegacyStyleOptions,defaultStyle:t.defaultStyle};if(t.dynamicStyle&&!n.defaultStyle&&(n.defaultStyle=oi),e.type==="FeatureCollection"){e.vcsMeta=e.vcsMeta||{embeddedIcons:e.vcsEmbeddedIcons,style:e.vcsStyle};let a;return e.vcsMeta.embeddedIcons&&(n.embeddedIcons=e.vcsMeta.embeddedIcons),e.vcsMeta.style&&t.dynamicStyle&&(e.vcsMeta.style.type===Mt.className?a=new Mt(e.vcsMeta.style):(e.vcsMeta.style=wu(e.vcsMeta.style,n),n.defaultStyle=n.defaultStyle.clone().assign(new q(e.vcsMeta.style)),a=n.defaultStyle)),{features:e.features.map(o=>xu(o,n)).filter(o=>o),style:e.vcsMeta.style?a:void 0,vcsMeta:e.vcsMeta?e.vcsMeta:void 0}}else if(e.type==="Feature"){const a=xu(e,n);return{features:a?[a]:[],vcsMeta:e.vcsMeta?e.vcsMeta:void 0}}else if(e.type!=null)return{features:[C1(e,n)]};return{features:[]}}function ss(i,t={},e){const s={type:"Feature",properties:i.getProperties()};t.writeId&&(s.id=i.getId()),delete s.properties[i.getGeometryName()],delete s.properties.style,delete s.properties.olcs_allowPicking;let r=i.getGeometry(),n=null;if(r instanceof le){const a=r.getCoordinates();n=wd(T.mercatorToWgs84(a[0],!0),T.mercatorToWgs84(a[1],!0)),r=new bi(r.getCenter())}else if(r instanceof In){const a=r.getCoordinates();a.forEach(o=>{on(o)}),r.setCoordinates(a)}else if(r instanceof fr){const a=r.getCoordinates();a.forEach(o=>{o.forEach(l=>{on(l)})}),r.setCoordinates(a)}return s.geometry=Co().writeGeometryObject(r,{featureProjection:M1,rightHanded:!0}),n&&(s.geometry.olcs_radius=n),s.vcsMeta={},t.writeStyle&&i[Tt]&&(s.vcsMeta.style=La(i[Tt].getOptionsForFeature(i),e)),s}function x1(i,t={}){const e=i.vcsMeta||{};e.version=Ea;const s=i.features.map(n=>ss(n,t,e.embeddedIcons)),r={type:"FeatureCollection",features:s,vcsMeta:e};return t.asObject?r:JSON.stringify(r,null,t.prettyPrint?2:null)}const b1=Xt();function O1(i,t){if(t.style&&i.setStyle(qs(t.style,i.defaultStyle)),t.highlightStyle){const e=qs(t.highlightStyle,i.highlightStyle);i.setHighlightStyle(e)}t.vectorProperties&&i.vectorProperties.setValues(t.vectorProperties),t.zIndex!=null&&(i.zIndex=t.zIndex)}function wo(i,t,e,s){if(s==null?t!==e:s!==t)throw new Error(`Cannot merge options, values of ${i} do not match`)}class De extends re{static get className(){return"Category"}static getDefaultConfig(){return{title:"",featureProperty:void 0,classRegistryName:void 0,layerOptions:{},keyProperty:"name",items:[]}}constructor(t){super(t);const e=De.getDefaultConfig();this.title=t.title||this.name,this._app=null,this._featureProperty=t.featureProperty||e.featureProperty,this._classRegistryName=t.classRegistryName,this._layerOptions=t.layerOptions||e.layerOptions,this._layer=null,this._featureProperty&&(this._layer=new Ct(this._layerOptions),this._layer[Lt]=b1),this._keyProperty=t.keyProperty||e.keyProperty,this._collectionListeners=[],this._collection=null,this.setCollection(new Ci(this._keyProperty)),this._contextRemovedListener=()=>{}}get classRegistryName(){return this._classRegistryName}get collection(){return this._collection}get layer(){return this._layer}_itemAdded(t){if(this._featureProperty){const e=t[this._keyProperty];this._layer.removeFeaturesById([e]);const s=t[this._featureProperty];let r;if(s instanceof xd)r=s;else if(typeof s=="object"){const{features:n}=Ie(s);n[0]&&(r=n[0])}r&&(r.setId(e),setTimeout(()=>{this._layer.addFeatures([r])},0))}}_itemRemoved(t){this._featureProperty&&this._layer.removeFeaturesById([t[this._keyProperty]])}_itemReplaced(t){}_itemMoved(t){}_getDynamicContextId(){if(!this._app)throw new Error("Cannot get dynamic context id, before setting the vcApp");return this._app.dynamicContextId}mergeOptions(t){const e=De.getDefaultConfig();wo("classRegistryName",this._classRegistryName,e.classRegistryName,t.classRegistryName),wo("featureProperty",this._featureProperty,e.featureProperty,t.featureProperty),wo("keyProperty",this._keyProperty,e.keyProperty,t.keyProperty),this.title=t.title||this.title,t.layerOptions&&this._layer&&O1(this._layer,t.layerOptions)}setCollection(t){if(v(t,ve),this._keyProperty!==t.uniqueKey)throw new Error("The collections key property does not match the categories key property");this._collectionListeners.forEach(e=>{e()}),this._collection&&me(this._collection),this._layer&&this._layer.removeAllFeatures(),this._collection=t[jr]?t:ni(t,this._getDynamicContextId.bind(this),this._serializeItem.bind(this),this._deserializeItem.bind(this)),[...this.collection].forEach(e=>{this._itemAdded(e)}),this._collectionListeners=[this._collection.added.addEventListener(this._itemAdded.bind(this)),this._collection.removed.addEventListener(this._itemRemoved.bind(this)),this._collection.replaced.addEventListener(this._itemReplaced.bind(this))],this._collection.moved&&this._collectionListeners.push(this._collection.moved.addEventListener(this._itemMoved.bind(this)))}setApp(t){if(this._app)throw new Error("Cannot switch apps");this._app=t,this._contextRemovedListener=this._app.contextRemoved.addEventListener(e=>{this._collection.removeContext(e.id)}),this._layer&&this._app.layers.add(this._layer)}async _deserializeItem(t){if(!this._app)throw new Error("Cannot deserialize item before setting the vcApp");const e=this._classRegistryName?this._app[this._classRegistryName]:null;return e&&e instanceof fe?ge(e,t):t}_serializeItem(t){const e=JSON.parse(JSON.stringify(t));if(this._featureProperty){const s=this._layer.getFeatureById(t[this._keyProperty]);s&&(e[this._featureProperty]=ss(s))}return e}serializeForContext(t){return this._collection.size===0?null:{name:this.name,items:this.collection.serializeContext(t)}}destroy(){super.destroy(),this._app&&this._layer&&this._app.layers.remove(this._layer),this._layer&&this._layer.destroy(),this._collectionListeners.forEach(t=>{t()}),this._collectionListeners.splice(0),this._contextRemovedListener(),this._contextRemovedListener=()=>{},me(this._collection),this._app=null}}zr.registerClass(De.className,De);const P1={layers:"layerClassRegistry",styles:"styleClassRegistry",maps:"mapClassRegistry",categories:"categoryClassRegistry"};class xo extends De{static get className(){return"AppBackedCategory"}constructor(t){t.classRegistryName=P1[t.collectionName];super(t);this._collectionName=t.collectionName}async _deserializeItem(t){if(!this._app)throw new Error("Cannot deserialize item before setting the vcApp");return this._collectionName==="viewPoints"?new oe(t):this._collectionName==="obliqueCollections"?new Ne(t):this._collectionName==="layers"?ya(this._app,t):this._collectionName==="maps"?pa(this._app,t):super._deserializeItem(t)}setApp(t){super.setApp(t),this.setCollection(this._app[this._collectionName])}serializeForContext(t){return null}}zr.registerClass(xo.className,xo);function bu(){return Pt("CategoryCollection")}class Ou extends Ci{constructor(t){super();this._app=t,this._cache=new Map,this._contextRemovedListener=this._app.contextRemoved.addEventListener(e=>{this._cache.forEach((s,r)=>{s.delete(e.id),s.size===0&&this._cache.delete(r)})})}add(t){if(this.hasKey(t.name))return null;t.setApp(this._app);const e=super.add(t);return e!=null&&this._cache.has(t.name)&&(this._cache.get(t.name).forEach((s,r)=>{this.parseCategoryItems(t.name,s,r)}),this._cache.delete(t.name)),e}remove(t){super.remove(t),this._cache.delete(t.name)}async parseCategoryItems(t,e,s){const r=this.getByKey(t);r?await r.collection.parseItems(e,s):this._cache.has(t)?this._cache.get(t).set(s,e):this._cache.set(t,new Map([[s,e]]))}async requestCategory(t){if(!t.name)return bu().error("Cannot request a category without a name"),null;t.type||(bu().warning(`Implicitly typing category ${t.name} as ${De.className}`),t.type=De.className);let e;if(this.hasKey(t.name))e=this.getByKey(t.name),e.mergeOptions(t);else if(e=await ge(this._app.categoryClassRegistry,t),e&&this.add(e)==null)return null;if(!e)throw new Error(`Category ${t.name} with type ${t.type} could not be created`);return e}destroy(){super.destroy(),this._contextRemovedListener(),this._cache.clear(),this._app=null}}const E1=Xt();class bo{constructor(t){this._config=t,this._checkSum=tg(JSON.stringify(t),E1),this._id=t.id||this._checkSum}get id(){return this._id}get checkSum(){return this._checkSum}get config(){return JSON.parse(JSON.stringify(this._config))}}const Pu=Symbol("isProvidedFeature"),Eu=Symbol("showProvidedFeature");class xi extends re{static get className(){return"AbstractFeatureProvider"}static getDefaultOptions(){return{vectorProperties:{allowPicking:!1},genericFeatureProperties:void 0,showGeometry:!1,mapTypes:[]}}constructor(t,e){super(e);const s=xi.getDefaultOptions();this.layerName=t,this.style=e.style?qs(e.style,oi.clone()):void 0,this.showGeometry=rt(e.showGeometry,s.showGeometry),this.vectorProperties=e.vectorProperties instanceof te?e.vectorProperties:new te(_(_({},s.vectorProperties),e.vectorProperties)),this.genericFeatureProperties=e.genericFeatureProperties||s.genericFeatureProperties,this.mapTypes=Array.isArray(e.mapTypes)?e.mapTypes:s.mapTypes}isSupported(t){return t&&(this.mapTypes.length===0||this.mapTypes.includes(t.className))}getProviderFeature(t){return t.getId()||t.setId(Xt()),this.style&&t.setStyle(this.style.style),this.genericFeatureProperties&&t.setProperties(this.genericFeatureProperties),t[z]=this.layerName,t[Pu]=!0,t[Eu]=this.showGeometry,Object.entries(this.vectorProperties.getValues()).forEach(([e,s])=>{const r=`olcs_${e}`;t.get(r)===void 0&&s!==void 0&&t.set(r,s)}),t}async getFeaturesByCoordinate(t,e){return[]}toJSON(){const t=super.toJSON(),e=xi.getDefaultOptions();delete t.name,this.showGeometry!==e.showGeometry&&(t.showGeometry=this.showGeometry),this.genericFeatureProperties&&(t.genericFeatureProperties=_({},this.genericFeatureProperties)),this.style&&(t.style=this.style.toJSON());const s=this.vectorProperties.getVcsMeta(_(_({},te.getDefaultOptions()),e.vectorProperties));return Object.keys(s).length>0&&(t.vectorProperties=s),t}destroy(){this.style=null,this.vectorProperties.destroy(),this.genericFeatureProperties=void 0,super.destroy()}}function I1(i,t){const e=i.getProperties();delete e[i.getGeometryName()];let{clickedPosition:s}=i;const r=i.getGeometry(),n=i.get("olcs_modelUrl");if(r&&(r.getType()==="Point"&&!n||s&&!s.exactPosition||!s&&r)){const l=Ln(r.getExtent());l&&(T.mercatorToWgs84(l,!0),s={longitude:l[0],latitude:l[1]})}let a=s.height;if(!n){const l=Fe.fromGeometry(r);a=Number.isFinite(l.maxZ)?l.maxZ:0}const o=!n&&i.get("olcs_altitudeMode")==="relativeToGround";return delete e.clickedPosition,{layerName:t.name,layerClass:t.className,attributes:e,longitude:s.longitude,latitude:s.latitude,height:a,relativeToGround:o}}class mn extends xi{static get className(){return"TileProviderFeatureProvider"}constructor(t,e){super(t,e);this.mapTypes=["CesiumMap"],this.tileProvider=e.tileProvider}async getFeaturesByCoordinate(t,e){return(await this.tileProvider.getFeaturesByCoordinate(t,e)).filter(r=>this.vectorProperties.getAllowPicking(r))}destroy(){this.tileProvider=void 0,super.destroy()}}kr.registerClass(mn.className,mn);function sr(i){const{location:t}=window,e=new URL(i,`${t.protocol}//${t.host}${t.pathname}`);return e.host?e.protocol===t.protocol&&e.host===t.host:!0}function Oo(i){const t=i.tilingSchema==="geographic"?B:F,e=t.proj.getExtent(),s=Tn(e),r=i.tilingSchema==="geographic"?s/(i.tileSize[0]*2):s/i.tileSize[0],n=i.maxLevel+1,a=[];for(let h=0;h<n;++h)a.push(r/2**h);const o={origin:pr(e),resolutions:a,tileSize:i.tileSize,minZoom:i.minLevel};i.extent&&i.extent.isValid()&&(o.extent=i.extent.getCoordinatesInProjection(t));const l={url:i.url,tileGrid:new Uo(o),params:i.parameters};return sr(i.url)||(l.crossOrigin="anonymous"),i.tilingSchema==="geographic"&&(i.version==="1.3.0"?l.projection="CRS:84":l.projection="EPSG:4326"),new bd(l)}const L1={GML:Dn,GML2:Nn,GML3:Dn},T1=["application/geojson","application/json","application/vnd.geo+json"];function Iu(i,t={}){return i==="text/xml"?(t.gmlFormat=t.gmlFormat?new L1[t.gmlFormat]:new Nn,new Xo(t)):T1.includes(i)?new Yo(t):i==="application/vnd.ogc.gml"?new Nn(t):i==="application/vnd.ogc.gml/3.1.1"?new Dn(t):null}class Ye extends xi{static get className(){return"WMSFeatureProvider"}static getDefaultOptions(){return O(_({},xi.getDefaultOptions()),{responseType:"text/xml",style:void 0,formatOptions:void 0,projection:void 0,url:"",tilingSchema:"geographic",version:"1.1.1",maxLevel:0,minLevel:0,tileSize:[256,256],parameters:{},extent:void 0})}constructor(t,e){super(t,e);const s=Ye.getDefaultOptions();this.extent=null,e.extent&&(e.extent instanceof pt?this.extent=e.extent:this.extent=new pt(e.extent)),this._wmsSourceOptions={url:e.url,tilingSchema:e.tilingSchema||s.tilingSchema,maxLevel:V(e.maxLevel,s.maxLevel),minLevel:V(e.minLevel,s.minLevel),tileSize:e.tileSize||s.tileSize,parameters:e.parameters,version:e.version||s.version},this.wmsSource=Oo(this._wmsSourceOptions),this.featureInfoResponseType=e.responseType||s.responseType,this._formatOptions=e.formatOptions||s.formatOptions,this.featureFormat=Iu(this.featureInfoResponseType,e.formatOptions),this.projection=e.projection?new T(e.projection):void 0}featureResponseCallback(t,e){let s;try{s=this.featureFormat.readFeatures(t,{dataProjection:this.projection?this.projection.proj:void 0,featureProjection:F.proj})}catch{return this.getLogger().warning("Features could not be read, please verify the featureInfoResponseType with the capabilities from the server"),[]}return Array.isArray(s)?(s.forEach(r=>{r.getGeometry()||r.setGeometry(new bi(e))}),s):[]}async getFeaturesByCoordinate(t,e){const s=this.wmsSource.getProjection();let r=t;s&&(r=dt(F.proj,s)(t.slice(),void 0,void 0));const n=111194.87428468118,a=this.wmsSource.getFeatureInfoUrl(r,e/n,s,{INFO_FORMAT:this.featureInfoResponseType});if(a){let o;try{o=await ye(a)}catch{return this.getLogger().error(`Failed fetching WMS FeatureInfo ${a}`),[]}return this.featureResponseCallback(o,t).map(l=>this.getProviderFeature(l))}return[]}toJSON(){const t=super.toJSON(),e=Ye.getDefaultOptions();return this.featureInfoResponseType!==e.responseType&&(t.responseType=this.featureInfoResponseType),this._formatOptions!==e.formatOptions&&(t.formatOptions=_({},this._formatOptions)),this.projection!==e.projection&&(t.projection=this.projection.toJSON()),t.url=this._wmsSourceOptions.url,t.parameters=_({},this._wmsSourceOptions.parameters),this._wmsSourceOptions.tilingSchema!==e.tilingSchema&&(t.tilingSchema=this._wmsSourceOptions.tilingSchema),this._wmsSourceOptions.maxLevel!==e.maxLevel&&(t.maxLevel=this._wmsSourceOptions.maxLevel),this._wmsSourceOptions.minLevel!==e.minLevel&&(t.minLevel=this._wmsSourceOptions.minLevel),this._wmsSourceOptions.version!==e.version&&(t.version=this._wmsSourceOptions.version),(this._wmsSourceOptions.tileSize[0]!==e.tileSize[0]||this._wmsSourceOptions.tileSize[1]!==e.tileSize[1])&&(t.tileSize=this._wmsSourceOptions.tileSize.slice()),this.extent&&(t.extent=this.extent.toJSON()),t}destroy(){this.wmsSource=void 0,this.featureFormat=void 0,this.projection=void 0,this._formatOptions=void 0,super.destroy()}}kr.registerClass(Ye.className,Ye);class _i{constructor(t=k.NONE,e=lt.NONE,s=mt.LEFT){this.id=Xt(),this._defaultActive=t,this.active=this._defaultActive,this._defaultModificationKey=e,this.modificationKey=this._defaultModificationKey,this._defaultPointerKey=s,this.pointerKey=this._defaultPointerKey}async pipe(t){return t}setActive(t){typeof t=="undefined"?(this.active=this._defaultActive,this.modificationKey=this._defaultModificationKey,this.pointerKey=this._defaultPointerKey):typeof t=="boolean"?this.active=t?this._defaultActive:k.NONE:this.active=t}setModification(t){t?this.modificationKey=t:this.modificationKey=this._defaultModificationKey}setPointer(t){t?this.pointerKey=t:this.pointerKey=this._defaultPointerKey}destroy(){}}class Mn extends _i{constructor(){super(k.ALL,lt.ALL);this._scratchCartographic=new et,this._scratchCartesian=new C,this.setActive()}async pipe(t){return t.map.className==="CesiumMap"?this._cesiumHandler(t):t.map.className==="ObliqueMap"?Mn.obliqueHandler(t):t}_cesiumHandler(t){const s=t.map.getScene();t.ray=s.camera.getPickRay(t.windowPosition);const r=s.globe.pick(t.ray,s,this._scratchCartesian);return r?(this._scratchCartographic=et.fromCartesian(r,s.globe.ellipsoid,this._scratchCartographic),t.position=T.wgs84ToMercator([P.toDegrees(this._scratchCartographic.longitude),P.toDegrees(this._scratchCartographic.latitude),this._scratchCartographic.height],!0)):t.position=[0,0,0],t.positionOrPixel=t.position,Promise.resolve(t)}static obliqueHandler(t){const s=t.map.currentImage;if(s){const r=t.type&(k.MOVE^k.DRAGEVENTS),n=t.position.slice(0,2);if(Number.isFinite(n[0])&&Number.isFinite(n[1]))return ts(s,n,{dontUseTerrain:!!r,dataProjection:F}).then(a=>(t.obliqueParameters={pixel:n},t.position=a.coords,t.obliqueParameters.estimate=a.estimate,t))}return t.stopPropagation=!0,Promise.resolve(t)}}class Lu extends _i{constructor(t){super(k.ALL,lt.ALL,mt.ALL);this.chain=t||[],this.setActive()}addInteraction(t,e){e!=null?this.chain.splice(e,0,t):this.chain.push(t)}removeInteraction(t){const e=this.chain.findIndex(s=>s.id===t.id);return e>-1&&this.chain.splice(e,1),e}async pipe(t){let e=t;const s=this.chain.length;for(let r=0;r<s;r++){const n=this.chain[r];if(n.active&t.type&&n.modificationKey&t.key&&n.pointerKey&t.pointer&&(e=await n.pipe(e),e.stopPropagation))break}return e}setModification(){super.setModification()}setPointer(){super.setPointer()}destroy(){this.chain.forEach(t=>{t.destroy()}),this.chain=[],super.destroy()}}class Tu extends _i{constructor(){super(k.ALL^k.MOVE,lt.ALL);this._pickPosition=k.CLICK,this._pickPositionMask=-1,this.pickTranslucent=!0,this.pullPickedPosition=0,this.hitTolerance=10,this._draggingFeature=null,this.setActive()}get pickPosition(){return this._pickPosition}set pickPosition(t){this._pickPosition=t&this._pickPositionMask}get excludedPickPositionEvents(){return~this._pickPositionMask}set excludedPickPositionEvents(t){this._pickPositionMask=~t}async pipe(t){return t.type&k.DRAG&&!(this._pickPosition&k.DRAG)?(this._draggingFeature&&(t.feature=this._draggingFeature),t):(t.type&k.DRAGEND&&(this._draggingFeature=null),t.map.className==="OpenlayersMap"?await this._openlayersHandler(t):t.map.className==="ObliqueMap"?await this._obliqueHandler(t):t.map.className==="CesiumMap"&&await this._cesiumHandler(t),t.type&k.DRAGSTART&&t.feature&&(this._draggingFeature=t.feature),t.type&k.DRAG&&this._draggingFeature&&(t.feature=this._draggingFeature),t)}setActive(t){typeof t=="undefined"&&(this.pickPosition=k.CLICK,this.pullPickedPosition=0),super.setActive(t)}_openlayersHandler(t){let e=null,s=null;return t.map.olMap.forEachFeatureAtPixel([t.windowPosition.x,t.windowPosition.y],(r,n)=>(r&&(r.get("olcs_allowPicking")==null||r.get("olcs_allowPicking")===!0)&&(e=r,s=n),!0),{hitTolerance:this.hitTolerance}),e&&s&&(t.feature=e,e.get("features")&&(t.feature[z]=s[z]),t.exactPosition=!0),Promise.resolve(t)}_obliqueHandler(t){let e=null,s=null;return t.map.olMap.forEachFeatureAtPixel([t.windowPosition.x,t.windowPosition.y],(r,n)=>(r&&(e=r[Be]||r),s=n,!0),{hitTolerance:this.hitTolerance}),e&&s&&(t.feature=e,e.get("features")&&(t.feature[z]=s[z]),t.exactPosition=!0),Promise.resolve(t)}_cesiumHandler(t){const e=t.map,s=e.getScene(),r=s.pick(t.windowPosition,this.hitTolerance,this.hitTolerance);let n=new et,a=new C,o=new C;const{pickTranslucentDepth:l}=s,h=()=>a?(this.pullPickedPosition&&t.ray&&(o=C.multiplyByScalar(t.ray.direction,this.pullPickedPosition,o),a=C.subtract(a,o,a)),n=et.fromCartesian(a,s.globe.ellipsoid,n),t.position=T.wgs84ToMercator([P.toDegrees(n.longitude),P.toDegrees(n.latitude),n.height],!0),t.positionOrPixel=t.position,s.pickTranslucentDepth=l,Promise.resolve(t)):(a=new C,Promise.resolve(t));if(r){if(r.primitive&&r.primitive.olFeature)t.feature=r.primitive.olFeature;else if(r.primitive&&r.primitive[z]&&(r instanceof Ge||r instanceof Ae)){t.feature=r;const c=Object.getOwnPropertySymbols(r.primitive),u=c.length;for(let d=0;d<u;d++)t.feature[c[d]]=r.primitive[c[d]]}else r.id&&r.id.olFeature?t.feature=r.id.olFeature:r.id&&r.id[z]?(t.feature=r,t.feature[z]=r.id[z]):t.feature=r;if(!(t.type&this.pickPosition))return Promise.resolve(t);if(s.pickPositionSupported)return r.primitive&&this.pickTranslucent&&!(r.primitive.pointCloudShading&&r.primitive.pointCloudShading.attenuation)&&(s.pickTranslucentDepth=!0,s.render(e.getCesiumWidget().clock.currentTime),t.exactPosition=!0),a=s.pickPosition(t.windowPosition,a),h()}return Promise.resolve(t)}}class Nu extends _i{constructor(){super(k.CLICK,lt.ALL);this.setActive()}async pipe(t){if(!t.feature){const e=[...t.map.layerCollection].filter(s=>s.featureProvider&&s.active&&s.isSupported(t.map)&&s.featureProvider.isSupported(t.map));if(e.length>0){const s=t.map.getCurrentResolution(t.position),r=(await Promise.all(e.map(n=>n.featureProvider.getFeaturesByCoordinate(t.position,s)))).flat();r.length>0&&(t.feature=r[0])}}return t}}function N1(){return Pt("EventHandler")}class Du{constructor(){this._positionInteraction=new Mn,this._featureInteraction=new Tu,this._featureProviderInteraction=new Nu,this._interactionChain=new Lu([this._positionInteraction,this._featureInteraction,this._featureProviderInteraction]),this.clickDuration=400,this.dragDuration=100,this._lastDown=null,this._lastClick={time:null,windowPosition:new Ht},this._dragging=null,this._running=!1,this._eventQueue=[],this._exclusiveInteraction=null,this._multiples=!1,this.exclusiveRemoved=new R,this.exclusiveAdded=new R}get positionInteraction(){return this._positionInteraction}get featureInteraction(){return this._featureInteraction}get featureProviderInteraction(){return this._featureProviderInteraction}get interactions(){return this._interactionChain.chain.slice()}addExclusiveInteraction(t,e,s=3,r){return v(t,_i),v(e,Function),v(s,Number),it(r,String),this._exclusiveInteraction&&this._exclusiveInteraction.id!==r&&this.removeExclusive(),this._interactionChain.addInteraction(t,s),this._exclusiveInteraction?(this._exclusiveInteraction.interactions.push(t),this._exclusiveInteraction.cb.push(e)):this._exclusiveInteraction={id:r||Xt(),cb:[e],interactions:[t]},this.exclusiveAdded.raiseEvent(),this._exclusiveUnListen.bind(this,t,this._exclusiveInteraction.id)}removeExclusive(){this._exclusiveInteraction&&(this._exclusiveInteraction.interactions.filter(t=>t).forEach(t=>{this._interactionChain.removeInteraction(t)}),this._exclusiveInteraction.cb.filter(t=>t).forEach(t=>{t()}),this._exclusiveInteraction=null,this.exclusiveRemoved.raiseEvent())}_exclusiveUnListen(t,e){if(!this._exclusiveInteraction||this._exclusiveInteraction&&this._exclusiveInteraction.id!==e)return 0;const s=this._interactionChain.removeInteraction(t),r=this._exclusiveInteraction.interactions.findIndex(n=>n&&n.id===t.id);return r>-1&&(this._exclusiveInteraction.interactions.splice(r,1,void 0),this._exclusiveInteraction.cb.splice(r,1,void 0)),this._exclusiveInteraction.interactions.every(n=>n===void 0)&&(this._exclusiveInteraction=null),s>-1&&this.exclusiveRemoved.raiseEvent(),s!==-1?1:0}addPersistentInteraction(t,e=3){return v(t,_i),v(e,Number),this._interactionChain.addInteraction(t,e),()=>this._interactionChain.removeInteraction(t)!==-1?1:0}handleMapEvent(t){t.pointerEvent===zt.MOVE?this._mouseMove(t):t.pointerEvent===zt.DOWN?this._mouseDown(t):t.pointerEvent===zt.UP&&this._mouseUp(t)}_mouseDown(t){if(this._lastDown){this._multiples=!0;return}t.windowPosition.x===0&&t.windowPosition.y===0||(this._lastDown=t,this._lastDown.time=Date.now())}_mouseUp(t){if(t.multipleTouch){this._multiples=!0,this._lastDown=null;return}if(this._multiples){this._lastDown=null,this._multiples=!1;return}const e=t;this._dragging?(e.type=k.DRAGEND,e.key=this._dragging.key,e.pointer=this._dragging.pointer,this._startChain(e)):this._lastDown&&(this._lastClick.time&&Date.now()-this._lastClick.time<this.clickDuration&&Ht.distanceSquared(this._lastClick.windowPosition,e.windowPosition)<12?(this._lastClick.time=null,e.type=k.DBLCLICK):(this._lastClick.time=Date.now(),Ht.clone(e.windowPosition,this._lastClick.windowPosition),e.type=k.CLICK),this._startChain(e)),this._dragging=null,this._lastDown=null}_mouseMove(t){let e=t;this._lastDown?this._dragging?(e.type=k.DRAG,e.key=this._dragging.key,e.pointer=this._dragging.pointer,this._startChain(e,!0)):!this._dragging&&Date.now()-this._lastDown.time>this.dragDuration&&(e=_({type:k.DRAGSTART},this._lastDown),this._dragging=e,this._startChain(e,!0)):(e.type=k.MOVE,this._startChain(e,!0))}_startChain(t,e){this._running&&e||(this._running?this._eventQueue.push(t):(this._running=!0,this._interactionChain.pipe(t).then(this._endChain.bind(this)).catch(s=>{N1().error(s.message),this._endChain()})))}_endChain(){this._running=!1,this._eventQueue.length>0&&this._startChain(this._eventQueue.shift())}destroy(){this.removeExclusive(),this.exclusiveAdded.destroy(),this.exclusiveRemoved.destroy(),this._interactionChain.destroy(),this._interactionChain=null,this._positionInteraction.destroy(),this._positionInteraction=null,this._featureInteraction.destroy(),this._featureInteraction=null,this._eventQueue=[]}}const qe=Symbol("cesiumTilesetLastUpdated");function Po(i){if(!i.ready)return Zo();const{rectangle:t}=i.root.boundingVolume;if(t){const o=Ut.southwest(t),l=Ut.northeast(t),h=T.wgs84ToMercator([P.toDegrees(o.longitude),P.toDegrees(o.latitude)]),c=T.wgs84ToMercator([P.toDegrees(l.longitude),P.toDegrees(l.latitude)]);return[h[0],h[1],c[0],c[1]]}const{center:e,radius:s}=i.boundingSphere,r=et.fromCartesian(e),n=T.wgs84ToMercator([P.toDegrees(r.longitude),P.toDegrees(r.latitude),r.height]);return Ba(n,s).getExtent()}class We extends Ue{static get className(){return"CesiumTilesetCesiumImpl"}constructor(t,e){super(t,e);this.cesium3DTileset=null,this.tilesetOptions=e.tilesetOptions,this.splitDirection=e.splitDirection,this.style=e.style,this.featureVisibility=e.featureVisibility,this.tilesetProperties=e.tilesetProperties,this.modelMatrix=e.modelMatrix,this.offset=e.offset,this._initializedPromise=null,this._originalOrigin=null,this._styleLastUpdated=Date.now(),this.globalHider=li()}async initialize(){this._initializedPromise||(this.cesium3DTileset=new ws(this.tilesetOptions),this.tilesetProperties&&this.tilesetProperties.forEach(({key:t,value:e})=>{this.cesium3DTileset[t]=e}),this.cesium3DTileset[z]=this.name,this.cesium3DTileset.tileVisible.addEventListener(this.applyStyle.bind(this)),this.cesium3DTileset.tileUnload.addEventListener(t=>{delete t[qe]}),this._initializedPromise=this.cesium3DTileset.readyPromise,await this._initializedPromise,this._originalOrigin=C.clone(this.cesium3DTileset.boundingSphere.center),this.modelMatrix?this.cesium3DTileset.modelMatrix=this.modelMatrix:this.offset&&this._calculateOffset(),this.map.addPrimitiveCollection(this.cesium3DTileset),await super.initialize(),this.splitDirection&&this.updateSplitDirection(this.splitDirection),this.updateStyle(this.style)),await this._initializedPromise}_calculateOffset(){if(this.cesium3DTileset&&!this.modelMatrix)if(!this.offset)this.cesium3DTileset.modelMatrix=A.IDENTITY;else{const t=et.fromCartesian(this._originalOrigin);t.longitude+=P.toRadians(this.offset[0]),t.latitude+=P.toRadians(this.offset[1]),t.height+=this.offset[2];const e=et.toCartesian(t),s=C.subtract(e,this._originalOrigin,e);this.cesium3DTileset.modelMatrix=A.fromTranslation(s)}}updateModelMatrix(t){this.modelMatrix=t,this.cesium3DTileset&&(this.modelMatrix?this.cesium3DTileset.modelMatrix=t:this.offset?this._calculateOffset():this.cesium3DTileset.modelMatrix=A.IDENTITY)}updateOffset(t){this.offset=t,this._calculateOffset()}async activate(){await super.activate(),this.active&&(this.cesium3DTileset.show=!0)}deactivate(){super.deactivate(),this.cesium3DTileset&&(this.cesium3DTileset.show=!1)}updateStyle(t,e){this.style=t,this.initialized&&(this.cesium3DTileset.style=this.style.cesiumStyle,this._onStyleChangeRemover&&this._onStyleChangeRemover(),this._onStyleChangeRemover=this.style.styleChanged.addEventListener(()=>{this.cesium3DTileset.makeStyleDirty(),this._styleLastUpdated=Date.now()}),this._styleLastUpdated=Date.now(),this.cesium3DTileset.readyPromise.then(()=>{this.cesium3DTileset.colorBlendMode!==this.style.colorBlendMode&&(this.style.colorBlendMode!==yr.HIGHLIGHT?this.cesium3DTileset.extras&&this.cesium3DTileset.extras._3DTILESDIFFUSE&&(this.cesium3DTileset.colorBlendMode=this.style.colorBlendMode):this.cesium3DTileset.colorBlendMode=this.style.colorBlendMode)}))}updateSplitDirection(t){const{splitScreen:e}=this.map;if(e){const s=e.getClippingObjectForDirection(this.splitDirection);s&&s.removeLayer(this.name),this.splitDirection=t;const r=e.getClippingObjectForDirection(this.splitDirection);r&&r.addLayer(this.name)}}applyStyle(t){if(t.content instanceof Of)for(let e=0;e<t.content.innerContents.length;e++)this.styleContent(t.content.innerContents[e]);else this.styleContent(t.content)}styleContent(t){if(!t[qe]||t[qe]<this.featureVisibility.lastUpdated||t[qe]<this.globalHider.lastUpdated||t[qe]<this._styleLastUpdated){const e=t.featuresLength;for(let s=0;s<e;s++){const r=t.getFeature(s);if(r){let n=r.getProperty("id");n||(n=`${t.url}${s}`),this.featureVisibility.highlightedObjects[n]&&!this.featureVisibility.hasHighlightFeature(n,r)&&this.featureVisibility.addHighlightFeature(n,r),this.featureVisibility.hiddenObjects[n]&&!this.featureVisibility.hasHiddenFeature(n,r)&&this.featureVisibility.addHiddenFeature(n,r),this.globalHider.hiddenObjects[n]&&!this.globalHider.hasFeature(n,r)&&this.globalHider.addFeature(n,r),this._styleLastUpdated>t[qe]&&r[pe]&&xa(r)}}t[qe]=Date.now()}}destroy(){if(this.cesium3DTileset){if(this.map.initialized){const t=this.cesium3DTileset;this.map.removePrimitiveCollection(t)}else this.cesium3DTileset.destroy();this.cesium3DTileset=null}if(this._onStyleChangeRemover&&this._onStyleChangeRemover(),this.splitDirection&&this.map.splitScreen){const t=this.map.splitScreen.getClippingObjectForDirection(this.splitDirection);t&&t.removeLayer(this.name)}super.destroy()}}class D1{constructor(t){this.entities=t.entities,this.featureToBillboardMap=new Map,this.featureToLabelMap=new Map}addPrimitives(t,e,s){}addBillboards(t,e,s){Ji(t.map(r=>({billboard:r,position:r.position})),e,s,this.entities,this.featureToBillboardMap)}addLabels(t,e,s){Ji(t.map(r=>({label:r,position:r.position})),e,s,this.entities,this.featureToLabelMap)}removeFeature(t){Zi(t,this.featureToBillboardMap,this.entities),Zi(t,this.featureToLabelMap,this.entities)}createFeatureCache(t){const e={};return e.billboards=this.featureToBillboardMap.get(t),this.featureToBillboardMap.delete(t),e.labels=this.featureToLabelMap.get(t),this.featureToLabelMap.delete(t),e}clearFeatureCache(t){pi(this.entities,t.billboards),pi(this.entities,t.labels)}clear(){this.entities.removeAll(),this.featureToBillboardMap.clear(),this.featureToLabelMap.clear()}}function F1(i,t){return i.values.forEach(e=>{t.add(e)}),i.collectionChanged.addEventListener((e,s,r)=>{s.forEach(n=>{t.add(n)}),r.forEach(n=>{t.remove(n)})})}class Fu extends Ue{static get className(){return"DataSourceCesiumImpl"}constructor(t,e){super(t,e);this.dataSource=new hl(this.name),this.dataSource[z]=this.name,this.entities=e.entities,this.clock=e.clock,this._collectionListener=()=>{}}async initialize(){this.initialized||(this._collectionListener=F1(this.entities,this.dataSource.entities),await this.map.addDataSource(this.dataSource)),await super.initialize()}async activate(){await super.activate(),this.active&&(this.dataSource.show=!0),this.clock&&this.map.setDataSourceDisplayClock(this.clock)}deactivate(){super.deactivate(),this.dataSource.show=!1,this.clock&&this.map.unsetDataSourceDisplayClock(this.clock)}flyToEntity(t){if(this.active){const e=this.dataSource.entities.getById(t);if(!e){this.getLogger().warning("could not find entity on this layer");return}const s=this.map.getDataSourceDisplay(),r=this.map.getScene(),{camera:n}=r,a=new cl,o=this.map.getViewPointSync(),{heading:l,pitch:h}=o,c=new Pf(P.toRadians(l),P.toRadians(h<-45?h:-45),void 0);let u,d=0;const f=()=>{const m=s.getBoundingSphere(e,!0,a);if(m!==ul.PENDING){if(m===ul.FAILED){d+=1,d>3&&u();return}n.flyToBoundingSphere(a,{duration:1,offset:c}),u()}},g=s.defaultDataSource;if(g.isLoading){const m=g.loadingEvent.addEventListener(()=>{u=r.postRender.addEventListener(f),m()})}else u=r.postRender.addEventListener(f)}}destroy(){this.map.initialized&&!this.isDestroyed&&this.map.removeDataSource(this.dataSource),this._collectionListener(),this.dataSource.entities.removeAll(),this.clock&&this.map.unsetDataSourceDisplayClock(this.clock),super.destroy()}}class Si extends Ue{static get className(){return"RasterLayerCesiumImpl"}constructor(t,e){super(t,e);this.cesiumLayer=null,this.splitDirection=e.splitDirection,this.minLevel=e.minLevel,this.maxLevel=e.maxLevel,this.tilingSchema=e.tilingSchema,this.extent=e.extent,this.opacity=e.opacity}initialize(){return this.initialized||(this.cesiumLayer=this.getCesiumLayer(),this.cesiumLayer[z]=this.name,this.cesiumLayer.show=!1,this.map.addImageryLayer(this.cesiumLayer)),super.initialize()}updateSplitDirection(t){this.splitDirection=t,this.initialized&&(this.cesiumLayer.splitDirection=t)}getCesiumLayer(){throw new Error("implementation error")}async activate(){await super.activate(),this.active&&(this.cesiumLayer.show=!0)}deactivate(){super.deactivate(),this.cesiumLayer&&(this.cesiumLayer.show=!1)}updateOpacity(t){this.opacity=t,this.initialized&&this.cesiumLayer&&(this.cesiumLayer.alpha=t)}destroy(){this.cesiumLayer&&this.map.removeImageryLayer(this.cesiumLayer),this.cesiumLayer=null,super.destroy()}}class Ru extends Si{static get className(){return"OpenStreetMapCesiumImpl"}getCesiumLayer(){return new Je(new Ef({maximumLevel:this.maxLevel}),{alpha:this.opacity,splitDirection:this.splitDirection})}}class Au extends Si{static get className(){return"SingleImageCesiumImpl"}constructor(t,e){super(t,e);this.credit=e.credit}getCesiumLayer(){const t={url:this.url,credit:this.credit},e=this.extent.getCoordinatesInProjection(B);e&&(t.rectangle=Ut.fromDegrees(e[0],e[1],e[2],e[3]));const s=new If(t),r={rectangle:t.rectangle,alpha:this.opacity,defaultAlpha:1,splitDirection:this.splitDirection};return new Je(s,r)}}class Gu extends Ue{static get className(){return"TerrainCesiumImpl"}constructor(t,e){super(t,e);this.requestVertexNormals=e.requestVertexNormals,this.requestWaterMask=e.requestWaterMask}initialize(){return this.initialized||(this.terrainProvider=Qi({url:this.url,requestVertexNormals:this.requestVertexNormals,requestWaterMask:this.requestWaterMask}),this.terrainProvider[z]=this.name),super.initialize()}async activate(){await super.activate(),this.active&&this.map.setTerrainProvider(this.terrainProvider)}deactivate(){super.deactivate(),this.terrainProvider&&this.map.unsetTerrainProvider(this.terrainProvider)}destroy(){this.terrainProvider=null,super.destroy()}}const Le={GEOGRAPHIC:"geographic",MERCATOR:"mercator"};function Eo(i){const t={};return i.numberOfLevelZeroTilesX&&i.numberOfLevelZeroTilesX>1&&(t.numberOfLevelZeroTilesX=i.numberOfLevelZeroTilesX),i.numberOfLevelZeroTilesY&&i.numberOfLevelZeroTilesY>1&&(t.numberOfLevelZeroTilesY=i.numberOfLevelZeroTilesY),i.tilingSchema===Le.MERCATOR?new Un(t):new dl(t)}function ku(i,t,e,s=0){if(!i.isValid())return s;const r=i.getCoordinatesInProjection(B);r[1]<-85&&(r[1]=-85),r[3]>85&&(r[3]=85);const a=[Pn(r),Ho(r),Vo(r),pr(r)].map(l=>et.fromDegrees(l[0],l[1]));let o=s;for(;o<e;){const l=a.map(c=>t.positionToTileXY(c,o)),h=[];if(h.push(Math.abs(l[0].x-l[1].x)),h.push(Math.abs(l[0].y-l[3].y)),h[0]>1||h[1]>1){o-=1;break}o+=1}return o}class jt extends ht{static get className(){return"RasterLayer"}static getDefaultOptions(){return O(_({},ht.getDefaultOptions()),{minLevel:0,maxLevel:18,tilingSchema:Le.GEOGRAPHIC,opacity:1,splitDirection:void 0})}constructor(t){t.url=t.url||"";super(t);const e=jt.getDefaultOptions();this.extent=this.extent||new pt,this.tilingSchema=Qn(t.tilingSchema,Le,e.tilingSchema),this.maxLevel=V(t.maxLevel,e.maxLevel),this._minLevel=V(t.minLevel,e.minLevel);const s=Eo(t);this.minLevel=ku(this.extent,s,this.maxLevel,this._minLevel),this._opacity=Cr(t.opacity,e.opacity,0,1),this._splitDirection=X.NONE,t.splitDirection&&(this._splitDirection=t.splitDirection==="left"?X.LEFT:X.RIGHT),this.splitDirectionChanged=new R}get splitDirection(){return this._splitDirection}set splitDirection(t){t!==this._splitDirection&&(this._splitDirection=t,this.getImplementations().forEach(e=>{e.updateSplitDirection(t)}),this.splitDirectionChanged.raiseEvent(this._splitDirection))}get opacity(){return this._opacity}set opacity(t){const e=Cr(t,this._opacity,0,1);this._opacity!==e&&(this._opacity=e,this.getImplementations().forEach(s=>{s.updateOpacity(e)}))}getImplementationOptions(){const t=O(_({},super.getImplementationOptions()),{minLevel:this.minLevel,maxLevel:this.maxLevel,tilingSchema:this.tilingSchema,opacity:this.opacity,splitDirection:this._splitDirection});return this.extent.isValid()&&(t.extent=this.extent),t}toJSON(){const t=super.toJSON(),e=jt.getDefaultOptions();return this.extent.equals(new pt)&&delete t.extent,this._minLevel!==e.minLevel&&(t.minLevel=this._minLevel),this.maxLevel!==e.maxLevel&&(t.maxLevel=this.maxLevel),this.tilingSchema!==e.tilingSchema&&(t.tilingSchema=this.tilingSchema),this.opacity!==e.opacity&&(t.opacity=this.opacity),this._splitDirection!==X.NONE&&(t.splitDirection=this._splitDirection===X.RIGHT?"right":"left"),t}destroy(){this.splitDirectionChanged.destroy(),super.destroy()}}ot.registerClass(jt.className,jt);class zu extends Si{static get className(){return"TmsCesiumImpl"}constructor(t,e){super(t,e);this.format=e.format}getCesiumLayer(){const t={url:this.url,fileExtension:this.format,maximumLevel:this.maxLevel,minimumLevel:this.minLevel,show:!1};if(this.extent&&this.extent.isValid()){const r=this.extent.getCoordinatesInProjection(B);t.rectangle=Ut.fromDegrees(r[0],r[1],r[2],r[3])}this.tilingSchema===Le.GEOGRAPHIC&&(t.tilingScheme=new dl);const e=new Lf(t),s={alpha:this.opacity,splitDirection:this.splitDirection};return new Je(e,s)}}const rr=new Array(25);for(let i=0;i<rr.length;i++)rr[i]=200375083427892e-7*2/256/2**(i+1);function pn(i){const t=Ut.southwest(i),e=Ut.northeast(i),s=[P.toDegrees(t.longitude),P.toDegrees(t.latitude)],r=[P.toDegrees(e.longitude),P.toDegrees(e.latitude)],n=js(s),a=js(r);return[...n,...a]}class Wt extends re{static get className(){return"TileProvider"}static getDefaultOptions(){return{tileCacheSize:50,baseLevels:[15],trackFeaturesToTiles:!0,allowTileAggregation:!0}}constructor(t){super(t);const e=Wt.getDefaultOptions();this.tilingScheme=new Un,this._tileCacheSize=V(t.tileCacheSize,e.tileCacheSize);const s=Array.isArray(t.baseLevels)?t.baseLevels.slice():e.baseLevels.slice();s.sort((r,n)=>n-r),this.baseLevels=[...new Set(s)],this.cache=new Map,this.baseLevels.forEach(r=>{this.cache.set(r,new Od(this.tileCacheSize))}),this.rtreeCache=new Map,this.trackFeaturesToTiles=rt(t.trackFeaturesToTiles,e.trackFeaturesToTiles),this.allowTileAggregation=rt(t.allowTileAggregation,e.allowTileAggregation),this.featureIdToTileIds=new Map,this.tileLoadedEvent=new R}get tileCacheSize(){return this._tileCacheSize}setTileCacheSize(t){const e=[];return this._tileCacheSize=t,this.cache.forEach((s,r)=>{for(s.setSize(this._tileCacheSize);s.canExpireCache();)e.push(this._removeLastTileFromCache(r))}),Promise.all(e)}_trackFeatures(t,e){this.trackFeaturesToTiles&&t.forEach(s=>{const r=s.getId();r&&(this.featureIdToTileIds.has(String(r))||this.featureIdToTileIds.set(String(r),new Set),this.featureIdToTileIds.get(String(r)).add(e))})}_unTrackFeatures(t,e){this.trackFeaturesToTiles&&t.forEach(s=>{const r=s.getId();if(r&&this.featureIdToTileIds.has(String(r))){const n=this.featureIdToTileIds.get(String(r));n.delete(e),n.size===0&&this.featureIdToTileIds.delete(String(r))}})}_addTilePromiseToCache(t,e,s){const r=t.then(n=>{n.forEach(o=>{o.getId()||o.setId(Xt())});const a=new po(n.length);return a.load(n.map(o=>{const l=o.getGeometry();if(l){const h=l.getExtent();return{minX:h[0],minY:h[1],maxX:h[2],maxY:h[3],value:o}}return null}).filter(o=>o)),this.tileLoadedEvent.raiseEvent({tileId:s,rtree:a}),this._trackFeatures(n,s),this.rtreeCache.set(s,a),a}).catch(()=>{this.getLogger().warning(`Could not load Tile ${s}`);const n=new po;return this.rtreeCache.set(s,n),n});return this.cache.get(e).set(s,r),this.cache.get(e).canExpireCache()?Promise.all([r,this._removeLastTileFromCache(e)]):r}_removeLastTileFromCache(t){const e=this.cache.get(t).peekLastKey(),s=this.cache.get(t).pop();if(s)return s.then(r=>{r&&(this.rtreeCache.delete(e),setTimeout(()=>{this._unTrackFeatures(r.all().map(n=>n.value),e),r.clear()},0))})}getBaseLevelForResolution(t,e){const s=t/Math.cos(e);let r=0;for(let a=0;a<rr.length&&(r=a,!(s>=rr[a]));a++);const n=this.getBaseLevel(r);return n===void 0?this.baseLevels[this.baseLevels.length-1]:n}getBaseLevel(t){return this.baseLevels.find(e=>t>=e)}getCacheKey(t,e,s){return`${s}/${t}/${e}`}async _getRtreeForBaseTile(t,e){const s=this.tilingScheme.positionToTileXY(e,t),r=this.getCacheKey(s.x,s.y,t);if(this.cache.has(t)){if(!this.cache.get(t).containsKey(r)){const n=this.loader(s.x,s.y,t);this._addTilePromiseToCache(n,t,r)}return this.cache.get(t).get(r)}return null}async getFeaturesByCoordinate(t,e){const s=Pd(t);qo(s,e,s);const r=ua(t),n=et.fromDegrees(r[0],r[1]),a=this.getBaseLevelForResolution(e,n.latitude),o=await this._getRtreeForBaseTile(a,n);return o?o.search({minX:s[0],minY:s[1],maxX:s[2],maxY:s[3]}).map(h=>h.value):[]}async getFeaturesForTile(t,e,s){const r=this.tilingScheme.tileXYToRectangle(t,e,s),n=Ut.center(r),a=this.getBaseLevel(s);if(a!=null){const o=await this._getRtreeForBaseTile(a,n);if(o){if(s===a)return o.all().map(l=>l.value);{const l=pn(r);return o.search({minX:l[0],minY:l[1],maxX:l[2],maxY:l[3]}).map(c=>c.value)}}}else if(this.allowTileAggregation&&this.baseLevels[this.baseLevels.length-1]-s<=2){const o=s+1,l=t*2,h=e*2;return[...await this.getFeaturesForTile(l,h,o),...await this.getFeaturesForTile(l+1,h,o),...await this.getFeaturesForTile(l+1,h+1,o),...await this.getFeaturesForTile(l,h+1,o)]}return[]}async getFeaturesForExtent(t,e){let s=e!=null?e:this.baseLevels[0];s=this.getBaseLevel(s);const[r,n,a,o]=t.getCoordinatesInProjection(B),l=this.tilingScheme.positionToTileXY(et.fromDegrees(r,o),s),h=this.tilingScheme.positionToTileXY(et.fromDegrees(a,n),s),c=[];for(let{x:f}=l;f<=h.x;f++)for(let{y:g}=l;g<=h.y;g++)c.push([f,g]);const u=await Promise.all(c.map(([f,g])=>this.getFeaturesForTile(f,g,s))),d=t.getCoordinatesInProjection(F);return u.flat().filter(f=>{const g=f.getGeometry();return g&&g.intersectsExtent(d)})}forEachFeature(t){this.rtreeCache.forEach(e=>{e.all().map(s=>s.value).forEach(t)})}async loader(t,e,s){return[]}toJSON(){const t=super.toJSON(),e=Wt.getDefaultOptions();return e.tileCacheSize!==this.tileCacheSize&&(t.tileCacheSize=this.tileCacheSize),this.baseLevels.length===e.baseLevels.length&&this.baseLevels.every(s=>e.baseLevels.includes(s))||(t.baseLevels=this.baseLevels.slice()),e.trackFeaturesToTiles!==this.trackFeaturesToTiles&&(t.trackFeaturesToTiles=this.trackFeaturesToTiles),e.allowTileAggregation!==this.allowTileAggregation&&(t.allowTileAggregation=this.allowTileAggregation),t}async clearCache(){const t=[];this.cache.forEach(e=>{e.forEach(s=>{t.push(s)}),e.clear()}),await Promise.all(t),this.rtreeCache.forEach(e=>{e.clear()}),this.rtreeCache.clear(),this.featureIdToTileIds.clear()}destroy(){super.destroy(),this.clearCache(),this.cache.clear(),this.isDestroyed=!0,this.tileLoadedEvent.destroy()}}si.registerClass(Wt.className,Wt);class R1 extends Ed{constructor(t,e,s,r,n,a,o,l=1){super(t,e,s,r,n,a,o);this.scaleY=l,this.scaledImageScale_=[0,0],this.scaledTextScale_=[0,0]}get imageScale_(){return this.scaledImageScale_}set imageScale_(t){const e=t||[1,1];this.scaledImageScale_=[e[0],e[1]*this.scaleY]}get textScale_(){return this.scaledTextScale_}set textScale_(t){const e=t||[1,1];this.scaledTextScale_=[e[0],e[1]*this.scaleY]}moveToLineTo_(t,e,s,r,n){const a=this.context_,o=Id(t,e,s,r,this.transform_,this.pixelCoordinates_);a.moveTo(o[0],o[1]);const{length:l}=o;for(let h=2;h<l;h+=2)a.lineTo(o[h],o[h+1]);return n&&a.closePath(),s}drawCircle(t){if(!!Ld(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Td(t,this.transform_,this.pixelCoordinates_),s=e[2]-e[0],r=e[3]-e[1],n=Math.sqrt(s*s+r*r),a=this.context_;a.beginPath(),a.ellipse(e[0],e[1],n,n*this.scaleY,0,0,2*Math.PI),this.fillState_&&a.fill(),this.strokeState_&&a.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}}function ju(i,t,e,s){const{canvas:r}=e;r.width=s[0],r.height=s[1],r.style.width=`${s[0]}px`,r.style.height=`${s[1]}px`;const n=(i[2]-i[0])/(i[3]-i[1]),a=1/((i[2]-i[0])/256),o=-1/((i[3]-i[1])/256),l=Nd(Dd(),1,1),h=Fd(l,128,128,a,o,0,-t[0],-t[1]);return new R1(e,1,i,h,0,null,null,n)}function $u(i,t,e,s){const r=document.createElement("canvas");r.width=s[0],r.height=s[0];const n=js([P.toDegrees(e.longitude),P.toDegrees(e.latitude)]),a=ju(t,n,r.getContext("2d"),s);return i.forEach(o=>{o.getStyleFunction()(o,1).forEach(c=>{a.drawFeature(o,c)})}),r}class Hu{constructor(t){this.tileProvider=t.tileProvider,this._tilingScheme=this.tileProvider.tilingScheme,this._tileSize=t.tileSize,this._errorEvent=new Tf,this._readyPromise=Promise.resolve(!0),this.emptyCanvas=document.createElement("canvas"),this.emptyCanvas.width=this.tileWidth,this.emptyCanvas.height=this.tileHeight,this.minLevel=0,this.maxLevel=26,this._reload=void 0,this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0}get ready(){return!0}get readyPromise(){return this._readyPromise}get rectangle(){return this._tilingScheme.rectangle}get tileWidth(){return this._tileSize[0]}get tileHeight(){return this._tileSize[1]}get maximumLevel(){return this.maxLevel}get minimumLevel(){return this.minLevel}get tilingScheme(){return this._tilingScheme}get tileDiscardPolicy(){}get errorEvent(){return this._errorEvent}get credit(){}get proxy(){}get hasAlphaChannel(){return!0}async requestImage(t,e,s){const r=await this.tileProvider.getFeaturesForTile(t,e,s);if(r.length===0)return this.emptyCanvas;const n=this.tileProvider.tilingScheme.tileXYToRectangle(t,e,s),a=pn(n),o=Ut.center(n);return $u(r,a,o,this._tileSize)}}class Vu extends Si{static get className(){return"VectorRasterTileCesiumImpl"}constructor(t,e){const s=O(_({},e),{tilingSchema:"mercator",splitDirection:void 0,opacity:void 0});super(t,s);this.tileProvider=e.tileProvider,this.tileSize=e.tileSize,this._reloadTimeout=null,this.imageryProvider=null}getCesiumLayer(){this.imageryProvider=new Hu({tileProvider:this.tileProvider,tileSize:this.tileSize});const t={alpha:this.opacity,splitDirection:this.splitDirection,minimumTerrainLevel:this.minLevel,maximumTerrainLevel:this.maxLevel};if(this.extent&&this.extent.isValid()){const s=this.extent.getCoordinatesInProjection(B);t.rectangle=Ut.fromDegrees(s[0],s[1],s[2],s[3])}return new Je(this.imageryProvider,t)}_reloadTiles(){window.clearTimeout(this._reloadTimeout),this.imageryProvider&&this.imageryProvider._reload&&(this._reloadTimeout=window.setTimeout(()=>{this.imageryProvider._reload(),this._reloadTimeout=null}))}updateTiles(t){t.length>0&&this._reloadTiles()}updateStyle(t,e){this._reloadTiles()}}class Bu extends Si{static get className(){return"WmsCesiumImpl"}constructor(t,e){super(t,e);this.parameters=e.parameters,this.highResolution=e.highResolution,this.tileSize=e.tileSize}getCesiumLayer(){const t=_({},this.parameters);this.highResolution&&(t.width=this.tileSize[0]*2,t.height=this.tileSize[1]*2);const e={url:this.url,layers:t.LAYERS,minimumLevel:this.minLevel,maximumLevel:this.maxLevel,show:!1,parameters:t,tileWidth:this.tileSize[0],tileHeight:this.tileSize[1]};if(this.extent&&this.extent.isValid()){const n=this.extent.getCoordinatesInProjection(B);n&&(e.rectangle=Ut.fromDegrees(n[0],n[1],n[2],n[3]))}this.tilingSchema==="mercator"&&(e.tilingScheme=new Un);const s=new Nf(e),r={alpha:this.opacity,splitDirection:this.splitDirection};return new Je(s,r)}}class Uu extends Si{static get className(){return"WmtsCesiumImpl"}constructor(t,e){super(t,e);this.layer=e.layer,this.style=e.style,this.format=e.format,this.tileMatrixSetID=e.tileMatrixSetID,this.tileSize=e.tileSize,this.numberOfLevelZeroTilesX=e.numberOfLevelZeroTilesX,this.numberOfLevelZeroTilesY=e.numberOfLevelZeroTilesY,this.matrixIds=e.matrixIds}getCesiumLayer(){const t=this.url.indexOf("{Layer}")!==-1?this.url.replace("{Layer}",this.layer):this.url,e=this.extent.getCoordinatesInProjection(B),s={url:t,layer:this.layer,style:this.style,format:this.format,tileMatrixSetID:this.tileMatrixSetID,maximumLevel:this.maxLevel,rectangle:Ut.fromDegrees(e[0],e[1],e[2],e[3]),tileWidth:this.tileSize[0],tileHeight:this.tileSize[1]};s.tilingScheme=Eo({tilingSchema:this.tilingSchema,numberOfLevelZeroTilesX:this.numberOfLevelZeroTilesX,numberOfLevelZeroTilesY:this.numberOfLevelZeroTilesY}),s.tileMatrixLabels=this.matrixIds;const r=new Df(s),n={alpha:this.opacity,splitDirection:this.splitDirection};return new Je(r,n)}}function qu(i){const t=i.getPropertyNames(),e={};for(let s=0;s<t.length;s++)e[t[s]]=i.getProperty(t[s]);return e.id==null&&(e.id=`${i.content.url}${i._batchId}`),e.attributes?e.attributes.gmlId=e.id:e.gmlId==null&&(e.gmlId=e.id),e.clickedPosition=i.clickedPosition?i.clickedPosition:{},e}function nr(){const i=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(i)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(i.substr(0,4))}class Se extends _e{static get className(){return"CesiumTilesetLayer"}static getDefaultOptions(){return O(_({},_e.getDefaultOptions()),{highlightStyle:void 0,screenSpaceError:16,screenSpaceErrorMobile:32,maximumMemoryUsage:16,tilesetOptions:{},splitDirection:void 0,offset:void 0})}constructor(t){super(t);this._supportedMaps=[G.className];const e=Se.getDefaultOptions();this.url&&!/\.json$/.test(this.url)&&(this.url=`${this.url.replace(/\/$/,"")}/tileset.json`),this.highlightStyle=null,t.highlightStyle&&(this.highlightStyle=t.highlightStyle instanceof q?t.highlightStyle:new q(t.highlightStyle)),this.screenSpaceError=V(t.screenSpaceError,e.screenSpaceError),this.screenSpaceErrorMobile=V(t.screenSpaceErrorMobile,e.screenSpaceErrorMobile),this.maximumMemoryUsage=V(t.maximumMemoryUsage,e.maximumMemoryUsage);const s=t.tilesetOptions||e.tilesetOptions;this.tilesetOptions=_({url:this.url,maximumScreenSpaceError:nr()?this.screenSpaceErrorMobile:this.screenSpaceError,maximumMemoryUsage:this.maximumMemoryUsage},s),this._splitDirection=X.NONE,t.splitDirection&&(this._splitDirection=t.splitDirection==="left"?X.LEFT:X.RIGHT),this.splitDirectionChanged=new R,this._modelMatrix=void 0,this._offset=t.offset||e.offset}get modelMatrix(){return this._modelMatrix}set modelMatrix(t){it(t,A),this._modelMatrix=t,this.getImplementations().forEach(e=>{e.updateModelMatrix(t)})}get offset(){return this._offset}set offset(t){it(t,[Number]),this._offset=t,this.getImplementations().forEach(e=>{e.updateOffset(t)})}get splitDirection(){return this._splitDirection}set splitDirection(t){t!==this._splitDirection&&(this.getImplementations().forEach(e=>{e.updateSplitDirection(t)}),this._splitDirection=t,this.splitDirectionChanged.raiseEvent(this._splitDirection))}async initialize(){return await this.style.cesiumStyle.readyPromise,super.initialize()}getImplementationOptions(){return O(_({},super.getImplementationOptions()),{tilesetOptions:this.tilesetOptions,splitDirection:this.splitDirection,modelMatrix:this.modelMatrix,offset:this.offset})}createImplementationsForMap(t){return t instanceof G?[new We(t,this.getImplementationOptions())]:[]}objectClickedHandler(t){if(this.allowPicking){const e=qu(t);if(e)return{id:e.id,feature:e}}return null}getZoomToExtent(){const t=super.getZoomToExtent();if(t)return t;const e=this.getImplementations()[0];if(e){const s=Po(e.cesium3DTileset),r=new pt({projection:F.toJSON(),coordinates:s});if(r.isValid())return r}return null}getGenericFeatureFromClickedObject(t){const e=_(_({},this.genericFeatureProperties),t.attributes||t);return{layerName:this.name,layerClass:this.className,attributes:e,longitude:t.clickedPosition.longitude,latitude:t.clickedPosition.latitude,height:t.clickedPosition.height+this.balloonHeightOffset,relativeToGround:!1}}setMaximumScreenSpaceError(t){this.getImplementations().forEach(e=>{e.cesium3DTileset&&(e.cesium3DTileset.maximumScreenSpaceError=t)})}toJSON(){const t=super.toJSON(),e=Se.getDefaultOptions();this.highlightStyle&&(t.highlightStyle=this.highlightStyle.toJSON()),this.screenSpaceError!==e.screenSpaceError&&(t.screenSpaceError=this.screenSpaceError),this.screenSpaceErrorMobile!==e.screenSpaceErrorMobile&&(t.screenSpaceErrorMobile=this.screenSpaceErrorMobile),this.maximumMemoryUsage!==e.maximumMemoryUsage&&(t.maximumMemoryUsage=this.maximumMemoryUsage);const s=_({},this.tilesetOptions);s.url===this.url&&delete s.url;const r=nr()?this.screenSpaceErrorMobile:this.screenSpaceError;return s.maximumScreenSpaceError===r&&delete s.maximumScreenSpaceError,s.maximumMemoryUsage===this.maximumMemoryUsage&&delete s.maximumMemoryUsage,Object.keys(s).length>0&&(t.tilesetOptions=s),this._splitDirection!==X.NONE&&(t.splitDirection=this._splitDirection===X.RIGHT?"right":"left"),Array.isArray(this.offset)&&(t.offset=this.offset.slice()),t}destroy(){super.destroy(),this.splitDirectionChanged.destroy()}}ot.registerClass(Se.className,Se);class wi extends ht{static get className(){return"DataSourceLayer"}static getDefaultOptions(){return O(_({},ht.getDefaultOptions()),{genericFeatureProperties:{}})}constructor(t){super(t);const e=wi.getDefaultOptions();this.entities=new Ff,this.clock=void 0,this._genericFeatureProperties=t.genericFeatureProperties||e.genericFeatureProperties,this.featureVisibility=new qr,this._featureVisibilityListeners=[],this._supportedMaps=[G.className]}_setUpFeatureVisibility(){const t=li();this._featureVisibilityListeners=[this.featureVisibility.changed.addEventListener(({action:e,ids:s})=>{e===W.HIDE&&s.forEach(r=>{const n=this.entities.getById(r);n&&this.featureVisibility.addHiddenFeature(r,n)})}),t.changed.addEventListener(({action:e,ids:s})=>{e===W.HIDE&&s.forEach(r=>{const n=this.entities.getById(r);n&&t.addFeature(r,n)})}),this.entities.collectionChanged.addEventListener((e,s)=>{s.forEach(r=>{this.featureVisibility.hiddenObjects[r.id]&&this.featureVisibility.addHiddenFeature(r.id,r),t.hiddenObjects[r.id]&&t.addFeature(r.id,r)})})]}initialize(){return this.initialized||this._setUpFeatureVisibility(),super.initialize()}getImplementationOptions(){return O(_({},super.getImplementationOptions()),{entities:this.entities,clock:this.clock})}createImplementationsForMap(t){return t instanceof G?[new Fu(t,this.getImplementationOptions())]:[]}addEntity(t,e,s){const r=this.entities.add(t);return r[z]=this.name,r.attributes=e,r.allowPicking=s,r.id}flyToEntity(t){this.getImplementations().forEach(e=>{e.flyToEntity(t)})}removeEntityById(t){this.entities.removeById(t)}objectClickedHandler(t){if(this.allowPicking&&t.id.allowPicking!==!1){const e=t.id,{id:s}=e;return e.clickedPosition=t.clickedPosition,{id:s,feature:t}}return null}getGenericFeatureFromClickedObject(t){const e=_(_({},this._genericFeatureProperties),t.attributes||{});return{layerName:this.name,layerClass:this.className,attributes:e,longitude:t.clickedPosition.longitude,latitude:t.clickedPosition.latitude,height:t.clickedPosition.height,relativeToGround:!1}}toJSON(){const t=super.toJSON();return Object.keys(this._genericFeatureProperties).length>0&&(t.genericFeatureProperties=_({},this._genericFeatureProperties)),t}destroy(){this.entities.removeAll(),this._featureVisibilityListeners.forEach(t=>{t()}),this._featureVisibilityListeners=[],this.featureVisibility.destroy(),super.destroy()}}ot.registerClass(wi.className,wi);class or extends wi{static get className(){return"CzmlLayer"}static getDefaultOptions(){return O(_({},wi.getDefaultOptions()),{sourceUri:void 0})}constructor(t){super(t);this.dataSource=new Rf,this.entities=this.dataSource.entities;const e=or.getDefaultOptions();this.sourceUri=t.sourceUri||e.sourceUri,this._loadedResolve=()=>{},this._loadedReject=()=>{},this.loaded=new Promise((s,r)=>{this._loadedResolve=s,this._loadedReject=r})}initialize(){return this._initializedPromise||(this._initializedPromise=this._loadData().then(()=>super.initialize()).then(()=>{this._loadedResolve()}).catch(t=>{this._loadedReject(t)})),this._initializedPromise}async _loadData(){await this.dataSource.load(this.url,this.sourceUri?{sourceUri:this.sourceUri}:void 0),this.entities.values.forEach(t=>{t[z]=this.name}),this.clock=this.dataSource.clock}async reload(){this.entities.removeAll(),await this._loadData(),await this.forceRedraw()}toJSON(){const t=super.toJSON();return this.sourceUri&&(t.sourceUri=this.sourceUri),t}destroy(){super.destroy(),this.dataSource._entityCluster.destroy(),this.dataSource._entityCluster=null,this.dataSource._entityCollection=null,this.dataSource._changed=null,this.dataSource._error=null,this.dataSource._loading=null,this.dataSource=null}}ot.registerClass(or.className,or);function A1(i,t,e){const s=[];return i.forEach(r=>{const n=ss(r,{writeStyle:!0});s.push({action:"add",feature:n,original:r,success(a){r.setId(a),r[Qt]=vi.DYNAMIC}})}),t.forEach(r=>{const n=ss(r,{writeStyle:!0});n._id=r.getId(),n.geomety="test",s.push({action:"edit",original:r,feature:n,success(){r[Qt]===vi.STATIC&&(r[Qt]=vi.EDITED)}})}),e.forEach(r=>{const n=r.getId();s.push({original:r,action:"remove",feature:{_id:n},success(){}})}),s}class Wu extends re{static get className(){return"FeatureStoreLayerChanges"}constructor(t){super({});this.layer=t,this._changesListeners={addfeature:null,changefeature:null,removefeature:null},this._addedFeatures=new Set,this._editedFeatures=new Set,this._removedFeatures=new Set,this._convertedFeatures=new Set,this.values={changed:!1}}get active(){return Object.values(this._changesListeners).some(t=>t!==null)}track(){this._changesListeners.addfeature===null&&(this._changesListeners.addfeature=this.layer.source.on("addfeature",this._featureAdded.bind(this))),this._changesListeners.changefeature===null&&(this._changesListeners.changefeature=this.layer.source.on("changefeature",this._featureChanged.bind(this))),this._changesListeners.removefeature===null&&(this._changesListeners.removefeature=this.layer.source.on("removefeature",this._featureRemoved.bind(this)))}getChanges(){return{add:[...this._addedFeatures],edit:[...this._editedFeatures],remove:[...this._removedFeatures]}}async commitChanges(t){const e=A1(this._addedFeatures,this._editedFeatures,this._removedFeatures);if(e.length>0){const s=await ye(t.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e.map(n=>({action:n.action,feature:n.feature})))}),r=s.failedActions.map(({index:n,error:a})=>{const o=e[n];return this.getLogger().log(`failed action ${o.action}: ${a}`),e[n]=null,this._resetFeature(o.original)});e.filter(n=>n).forEach(({action:n,success:a})=>{n==="add"?a(s.insertedIds.shift()._id):a()}),await Promise.all(r)}else{try{await Promise.all([...this._convertedFeatures].map(async s=>{await this._resetFeature(s)}))}catch(s){this.getLogger().error(s.message)}this._resetValues()}}async reset(){const t=[];return this._addedFeatures.forEach(e=>{t.push(this._resetFeature(e))}),this._editedFeatures.forEach(e=>{t.push(this._resetFeature(e))}),this._removedFeatures.forEach(e=>{t.push(this._resetFeature(e))}),this._convertedFeatures.forEach(e=>{t.push(this._resetFeature(e))}),Promise.all(t).then(()=>{this._resetValues()}).catch(e=>{this.getLogger().error(e),this._resetValues()})}_resetFeature(t){const e=t.getId(),s=[e];return t[Qt]?t[Qt]===vi.STATIC?(this.layer.resetStaticFeature(e),Promise.resolve()):this.layer.injectedFetchDynamicFeatureFunc(e).then(r=>{const{features:n}=Ie(r);this.layer.removeFeaturesById(s),this.layer.addFeatures(n)}).catch(r=>{this.getLogger().error("failed to reset feature, giving up",r.message)}):(this.layer.removeFeaturesById(s),Promise.resolve())}_resetValues(){this._addedFeatures.clear(),this._editedFeatures.clear(),this._removedFeatures.clear(),this._convertedFeatures.clear(),this.values.changed=!1}unTrack(){yt(Object.values(this._changesListeners)),this._changesListeners.addfeature=null,this._changesListeners.changefeature=null,this._changesListeners.removefeature=null,this._resetValues()}pauseTracking(t){this._changesListeners[t]&&(yt(this._changesListeners[t]),this._changesListeners[t]=null)}_featureAdded(t){const{feature:e}=t;e[Qt]?e[Qt]===vi.STATIC&&(this._convertedFeatures.add(e),this.values.changed=!0):(this._addedFeatures.add(e),this.values.changed=!0)}_featureChanged(t){const{feature:e}=t;e[Qt]&&(this._convertedFeatures.delete(e),this._editedFeatures.add(e),this.values.changed=!0)}_featureRemoved(t){const{feature:e}=t;e[Qt]?(this._removedFeatures.add(e),this._editedFeatures.delete(e),this._convertedFeatures.delete(e),this.values.changed=!0):this._addedFeatures.delete(e)}removeFeature(t){v(t,Z),this._featureRemoved({feature:t})}addFeature(t){v(t,Z),this._featureAdded({feature:t})}editFeature(t){v(t,Z),this._featureChanged({feature:t})}destroy(){this.unTrack(),this.layer=null,super.destroy()}}const Io=Symbol("isTiledFeature");class os extends Ct{static get className(){return"FeatureStoreLayer"}static getDefaultOptions(){return O(_({id:"",type:"FeatureStoreLayer",featureType:"simple",features:[]},Ct.getDefaultOptions()),{projection:F.toJSON(),staticRepresentation:{},hiddenStaticFeatureIds:[],vcsMeta:{screenSpaceError:4,altitudeMode:"clampToGround"}})}constructor(t){const e=os.getDefaultOptions(),s=_({projection:e.projection},t);super(s);this._supportedMaps=[G.className,tt.className,ae.className],this.hasFeatureUUID=!0,this.layerId=t.id,this.staticRepresentation=t.staticRepresentation||e.staticRepresentation,this.hiddenStaticFeatureIds=new Set(t.hiddenStaticFeatureIds||e.hiddenStaticFeatureIds),this.changeTracker=new Wu(this);const{vcsMeta:r}=e;if(t.vcsMeta&&Object.assign(r,t.vcsMeta),this.vcsMeta=r,this.setVcsMeta(this.vcsMeta),this.screenSpaceErrorMobile=this.vcsMeta.screenSpaceError,this.screenSpaceError=this.vcsMeta.screenSpaceError,this._removeVectorPropertiesChangeHandler=this.vectorProperties.propertyChanged.addEventListener(()=>{this.changeTracker.values.changed=!0}),this.injectedFetchDynamicFeatureFunc=t.injectedFetchDynamicFeatureFunc,this._staticFeatureVisibility=new qr,this._featureVisibilitySyncListeners=[bh(this.featureVisibility,this._staticFeatureVisibility),this._staticFeatureVisibility.changed.addEventListener(({action:n})=>{n===W.SHOW&&this._staticFeatureVisibility.hideObjects([...this.hiddenStaticFeatureIds])})],this._setEditing=null,this._twoDimLoaded=null,this._twoDimStyleChanged=null,this._twoDimStaticSource=new Ss,t.features){const n={type:"FeatureCollection",features:t.features,vcsMeta:t.vcsMeta},{style:a,features:o}=Ie(n,{targetProjection:F,dynamicStyle:!0});a&&(this._defaultStyle=a,this.setStyle(a)),this.addFeatures(o)}}initialize(){return this.initialized?super.initialize():super.initialize().then(()=>{this._staticFeatureVisibility.hideObjects([...this.hiddenStaticFeatureIds])})}_loadTwoDim(){return this._twoDimLoaded||(this._twoDimLoaded=(async()=>{const t=await ye(this.staticRepresentation.twoDim),{features:e}=Ie(t,{targetProjection:F,dynamicStyle:!0}),s=this.style instanceof Mt;e.forEach(r=>{r[ht.vcsLayerNameSymbol]=this.name,r[Io]=!0,s&&r[Tt]&&r.setStyle(),this._setEditing&&this._setEditing.featureType!=null&&(r[this._setEditing.symbol]=this._setEditing.featureType)}),this._twoDimStaticSource.addFeatures(e)})()),this._twoDimLoaded}_getTwoDimStaticImplOptions(){return O(_({},super.getImplementationOptions()),{source:this._twoDimStaticSource,featureVisibility:this._staticFeatureVisibility})}createImplementationsForMap(t){const e=super.createImplementationsForMap(t);return t instanceof G&&this.staticRepresentation&&this.staticRepresentation.threeDim?e.push(new We(t,{url:this.staticRepresentation.threeDim,tilesetOptions:{maximumScreenSpaceError:nr()?this.screenSpaceErrorMobile:this.screenSpaceError,url:this.staticRepresentation.threeDim},tilesetProperties:[{key:Io,value:!0}],name:this.name,style:this.style,featureVisibility:this._staticFeatureVisibility,splitDirection:X.NONE,jumpToLocation:!1})):this.staticRepresentation&&this.staticRepresentation.twoDim&&(this._loadTwoDim(),t instanceof tt?e.push(new Xa(t,this._getTwoDimStaticImplOptions())):t instanceof ae&&e.push(new ho(t,this._getTwoDimStaticImplOptions()))),e}reload(){return this._twoDimLoaded=null,this._twoDimStaticSource.clear(),super.reload()}async activate(){await super.activate(),this.active&&this._setEditing&&this.setEditing(this._setEditing.symbol,this._setEditing.featureType)}_trackStyleChanges(){if(super._trackStyleChanges(),this.staticRepresentation.twoDim){this._twoDimStyleChanged&&(this._twoDimStyleChanged(),this._twoDimStyleChanged=null);const t=this.style instanceof Mt;this._twoDimStyleChanged=this.style.styleChanged.addEventListener(()=>{this._twoDimStaticSource.getFeatures().forEach(e=>{(t||!e[Tt])&&e.changed()})})}}setStyle(t,e){const s=this.changeTracker.active;s&&this.changeTracker.pauseTracking("changefeature"),super.setStyle(t,e);const r=this.style instanceof Mt;this._twoDimStaticSource.getFeatures().forEach(n=>{if(n[Tt]){let a;r?(a=!0,n.setStyle(void 0)):n.getStyle()!==n[Tt].style&&(a=!0,n.setStyle(n[Tt].style)),a&&Reflect.has(n,pe)&&xa(n)}}),s&&(this.changeTracker.track(),this.changeTracker.values.changed=!0)}setEditing(t,e){this.getImplementations().forEach(s=>{s instanceof We&&(s.initialized?(e!=null?s.cesium3DTileset[t]=e:delete s.cesium3DTileset[t],this._setEditing=null):this._setEditing={symbol:t,featureType:e})}),this.staticRepresentation.twoDim&&(this._twoDimLoaded?this._twoDimLoaded.then(()=>{this._twoDimStaticSource.getFeatures().forEach(s=>{e!=null?s[t]=e:delete s[t]})}):this._setEditing={symbol:t,featureType:e})}objectClickedHandler(t){return t instanceof Ge||t instanceof Ae?Se.prototype.objectClickedHandler.call(this,t):t instanceof Z?super.objectClickedHandler(t):null}getGenericFeatureFromClickedObject(t){if(t instanceof Z)return super.getGenericFeatureFromClickedObject(t);const e=Se.prototype.getGenericFeatureFromClickedObject.call(this,t);return e.layerName=this.name,e.layerClass=this.className,e}getZoomToExtent(){if(this.extent&&this.extent.isValid())return this.extent;const t=super.getZoomToExtent(),e=t?t.getCoordinatesInProjection(F):Zo();if(this.staticRepresentation.threeDim){const r=this.getImplementations().find(n=>n instanceof We&&n.cesium3DTileset);if(r){const n=Po(r.cesium3DTileset);Jo(e,n)}}this.staticRepresentation.twoDim&&this._twoDimLoaded&&Jo(e,this._twoDimStaticSource.getExtent());const s=new pt({projection:F.toJSON(),coordinates:e});return s.isValid()?s:null}setMaximumScreenSpaceError(t){nr()?this.screenSpaceErrorMobile=t:this.screenSpaceError=t,this.getImplementations().forEach(e=>{e instanceof We&&e.cesium3DTileset&&(e.cesium3DTileset.maximumScreenSpaceError=t)})}switchStaticFeatureToDynamic(t){return this.hiddenStaticFeatureIds.has(t)?Promise.resolve(this.getFeatureById(t)):this.injectedFetchDynamicFeatureFunc?this.injectedFetchDynamicFeatureFunc(t).then(e=>{const{features:s}=Ie(e,{targetProjection:F,defaultStyle:this.defaultStyle instanceof q?this.defaultStyle:oi});return this._staticFeatureVisibility.hideObjects([t]),this.hiddenStaticFeatureIds.add(t),this.addFeatures(s),s[0]}).catch(e=>{this.getLogger().error(e.message)}):Promise.reject(new Error("no injected fetching function"))}removeStaticFeature(t){this._staticFeatureVisibility.hideObjects([t]),this.hiddenStaticFeatureIds.add(t);const e=new Z;e.setId(t),e[Qt]=vi.STATIC,this.changeTracker.removeFeature(e)}resetStaticFeature(t){if(this.hiddenStaticFeatureIds.has(t)){const e=[t];this.removeFeaturesById(e),this.hiddenStaticFeatureIds.delete(t),this.featureVisibility.hiddenObjects[t]||this._staticFeatureVisibility.showObjects(e)}}toJSON(){const t=super.toJSON(),e=os.getDefaultOptions();return delete t.projection,t.vcsMeta=this.vectorProperties.getVcsMeta(_(_({},te.getDefaultOptions()),e.vcsMeta)),Object.keys(t.vcsMeta).length===0&&delete t.vcsMeta,this.vcsMeta.screenSpaceError!==e.vcsMeta.screenSpaceError&&(t.vcsMeta=t.vcsMeta||{},t.vcsMeta.screenSpaceError=this.vcsMeta.screenSpaceError),Object.keys(this.staticRepresentation).length>0&&(t.staticRepresentation=_({},this.staticRepresentation)),this.hiddenStaticFeatureIds.size>0&&(t.hiddenStaticFeatureIds=[...this.hiddenStaticFeatureIds]),t}destroy(){this.removeAllFeatures(),this._twoDimStaticSource.clear(),this._twoDimStyleChanged&&(this._twoDimStyleChanged(),this._twoDimStyleChanged=null),this._featureVisibilitySyncListeners.forEach(t=>{t()}),this._featureVisibilitySyncListeners=[],this._staticFeatureVisibility.destroy(),this.changeTracker.destroy(),this._removeVectorPropertiesChangeHandler&&this._removeVectorPropertiesChangeHandler(),super.destroy()}}ot.registerClass(os.className,os);const yn=Symbol("featureFromOptions");class ls extends Ct{static get className(){return"GeoJSONLayer"}static getDefaultOptions(){return O(_({},Ct.getDefaultOptions()),{projection:B.toJSON(),features:void 0})}constructor(t){const e=ls.getDefaultOptions();t.projection=t.projection||e.projection;super(t);this._dataFetchedPromise=null,this._featuresToLoad=t.features||e.features}async initialize(){return this.initialized||await this.fetchData(),super.initialize()}async reload(){if(this._dataFetchedPromise){const t=this.getFeatures().filter(e=>e[yn]);this.removeAllFeatures(),this.source.addFeatures(t),this._dataFetchedPromise=null,await this.fetchData()}return super.reload()}fetchData(){return this._dataFetchedPromise?this._dataFetchedPromise:(Array.isArray(this._featuresToLoad)&&(this._parseGeojsonData({type:"FeatureCollection",features:this._featuresToLoad}),this.getFeatures().forEach(t=>{t[yn]=!0}),this._featuresToLoad.splice(0),this._featuresToLoad=void 0),this.url?this._dataFetchedPromise=ye(this.url).then(t=>this._parseGeojsonData(t)).catch(t=>(this.getLogger().warning(`Could not send request for loading layer content (${t.message})`),Promise.reject(t))):this._dataFetchedPromise=Promise.resolve(),this._dataFetchedPromise)}_parseGeojsonData(t){const e=Ie(t,{dataProjection:this.projection,dynamicStyle:!0});if(this.addFeatures(e.features),e.style&&this.setStyle(e.style),e.vcsMeta){const s=_(_({},e.vcsMeta),this.vectorProperties.getVcsMeta());this.setVcsMeta(s)}}toJSON(){const t=super.toJSON(),e=ls.getDefaultOptions(),s=new T(e.projection);if(this.projection.equals(s)?delete t.projection:t.projection=this.projection.toJSON(),Array.isArray(this._featuresToLoad))t.features=this._featuresToLoad.slice();else{const r=this.getFeatures().filter(n=>n[yn]);r.length>0&&(t.features=r.map(n=>ss(n,{writeStyle:!0,writeId:!0})))}return t}destroy(){super.destroy(),this._featuresToLoad=void 0}}ot.registerClass(ls.className,ls);class rs extends Ys{static get className(){return"RasterLayerOpenlayersImpl"}constructor(t,e){super(t,e);this.splitDirection=e.splitDirection,this.minLevel=e.minLevel,this.maxLevel=e.maxLevel,this.tilingSchema=e.tilingSchema,this.extent=e.extent,this.opacity=e.opacity,this._splitDirectionRenderListeners=null}initialize(){return super.initialize().then(()=>{this.updateSplitDirection(this.splitDirection)})}updateOpacity(t){this.opacity=t,this.initialized&&this.olLayer.setOpacity(this.opacity)}updateSplitDirection(t){this.splitDirection=t,this.initialized&&(this.splitDirection===X.NONE&&this._splitDirectionRenderListeners?(yt(this._splitDirectionRenderListeners),this._splitDirectionRenderListeners=null,this.olLayer.changed()):t!==X.NONE&&!this._splitDirectionRenderListeners&&(this._splitDirectionRenderListeners=[],this._splitDirectionRenderListeners.push(this.olLayer.on("prerender",this._splitPreCompose.bind(this))),this._splitDirectionRenderListeners.push(this.olLayer.on("postrender",e=>{e.context.restore()})),this.olLayer.changed()))}_splitPreCompose(t){if(!this.map.splitScreen)return;const e=t.context,s=e.canvas.width*this.map.splitScreen.position;e.save(),e.beginPath(),this.splitDirection===X.LEFT?e.rect(0,0,s,e.canvas.height):e.rect(s,0,e.canvas.width-s,e.canvas.height),e.clip()}destroy(){this._splitDirectionRenderListeners&&(yt(this._splitDirectionRenderListeners),this._splitDirectionRenderListeners=null),super.destroy()}}class Yu extends rs{static get className(){return"OpenStreetMapOpenlayersImpl"}getOLLayer(){return new Oi({opacity:this.opacity,source:new Rd({maxZoom:this.maxLevel})})}}class hs extends ht{static get className(){return"OpenStreetMapLayer"}static getDefaultOptions(){return O(_({},ht.getDefaultOptions),{splitDirection:void 0,opacity:1,maxLevel:19})}constructor(t){super(t);const e=hs.getDefaultOptions();this._splitDirection=X.NONE,t.splitDirection&&(this._splitDirection=t.splitDirection==="left"?X.LEFT:X.RIGHT),this._supportedMaps=[G.className,tt.className],this._opacity=Cr(t.opacity,e.opacity,0,1),this.splitDirectionChanged=new R,this.maxLevel=V(t.maxLevel,e.maxLevel)}get splitDirection(){return this._splitDirection}set splitDirection(t){t!==this._splitDirection&&(this._splitDirection=t,this.getImplementations().forEach(e=>{e.updateSplitDirection(this._splitDirection)}),this.splitDirectionChanged.raiseEvent(this._splitDirection))}get opacity(){return this._opacity}set opacity(t){const e=Cr(t,this._opacity,0,1);this._opacity!==e&&(this._opacity=e,this.getImplementations().forEach(s=>{s.updateOpacity(e)}))}getImplementationOptions(){return O(_({},super.getImplementationOptions()),{opacity:this.opacity,splitDirection:this.splitDirection,minLevel:0,maxLevel:this.maxLevel,tilingSchema:""})}createImplementationsForMap(t){return t instanceof tt?[new Yu(t,this.getImplementationOptions())]:t instanceof G?[new Ru(t,this.getImplementationOptions())]:[]}toJSON(){const t=super.toJSON(),e=hs.getDefaultOptions();return this._splitDirection!==X.NONE&&(t.splitDirection=this._splitDirection===X.RIGHT?"right":"left"),this.opacity!==e.opacity&&(t.opacity=this.opacity),this.maxLevel!==e.maxLevel&&(t.maxLevel=this.maxLevel),t}destroy(){this.splitDirectionChanged.destroy(),super.destroy()}}ot.registerClass(hs.className,hs);class Xu extends rs{static get className(){return"SingleImageOpenlayersImpl"}constructor(t,e){super(t,e);this.credit=e.credit}getOLLayer(){const t={attributions:this.credit,url:this.url,projection:"EPSG:4326",imageExtent:this.extent.getCoordinatesInProjection(B)};return sr(this.url)||(t.crossOrigin="anonymous"),new Ad({source:new Gd(t),opacity:this.opacity})}}class G1 extends Ys{static get className(){return"TileDebugOpenlayersImpl"}getOLLayer(){return new Oi({source:new kd})}updateStyle(t,e){}updateTiles(t){}}class Zu extends rs{static get className(){return"TmsOpenlayersImpl"}constructor(t,e){super(t,e);this.format=e.format,this.tileSize=e.tileSize}getOLLayer(){const t={tileUrlFunction:s=>{const r=this.url.replace(/\/$/,""),n=(1<<s[0])-s[2]-1;return`${r}/${s[0]}/${s[1]}/${n}.${this.format}`},tileSize:this.tileSize,minZoom:this.minLevel,maxZoom:this.maxLevel,wrapX:!1};sr(this.url)||(t.crossOrigin="anonymous"),this.tilingSchema===Le.GEOGRAPHIC&&(t.projection="EPSG:4326");const e={source:new zd(t),opacity:this.opacity};return this.extent&&this.extent.isValid()&&(e.extent=this.extent.getCoordinatesInProjection(F)),new Oi(e)}}class Ju extends Ys{static get className(){return"VectorTileOpenlayersImpl"}constructor(t,e){super(t,e);this.tileProvider=e.tileProvider,this.source=null,this.tileSize=e.tileSize,this._tilesToUpdate=new Set,this._reloadTimeout=null,this.minLevel=e.minLevel,this.maxLevel=e.maxLevel,this.extent=e.extent}getOLLayer(){this.source=new jd({minZoom:0,maxZoom:26,tileSize:this.tileSize,tileLoadFunction:async n=>{const a=await this.tileProvider.getFeaturesForTile(n.tileCoord[1],n.tileCoord[2],n.tileCoord[0]);a.length>0?n.setFeatures(a):(n.setFeatures([]),n.setState($d.EMPTY))},url:"/{z}/{x}/{y}"});const t=this.extent&&this.extent.isValid()?this.extent.getCoordinatesInProjection(F):void 0,e=this.minLevel?this.minLevel:void 0,s=this.maxLevel?this.maxLevel+1:void 0;return new Hd({visible:!1,source:this.source,renderBuffer:200,renderMode:"image",declutter:!0,extent:t,minZoom:e,maxZoom:s})}updateTiles(t){t.length>0&&(t.forEach(e=>{this._tilesToUpdate.add(e)}),this.source&&(this._reloadTimeout||(this._reloadTimeout=window.setTimeout(()=>{this._tilesToUpdate.forEach(e=>{const{tileCache:s}=this.source;if(s.containsKey(e)){const r=s.get(e);r.key=!1}}),this.source.changed(),this._tilesToUpdate.clear(),this._reloadTimeout=null},0))))}updateStyle(t,e){this.initialized&&(window.clearTimeout(this._reloadTimeout),this._reloadTimeout=null,this._tilesToUpdate.clear(),this.source.refresh())}setVisibility(t){this.initialized&&this.olLayer.setVisible(t)}destroy(){this.source&&(this.source.clear(),this.source=null),this.tileProvider=null,super.destroy()}}class Ku extends rs{static get className(){return"WmsOpenlayersImpl"}constructor(t,e){super(t,e);this.parameters=e.parameters,this.version=e.version,this.tileSize=e.tileSize}getOLLayer(){return new Oi({visible:!1,source:Oo({url:this.url,parameters:this.parameters,version:this.version,extent:this.extent,tileSize:this.tileSize,minLevel:this.minLevel,maxLevel:this.maxLevel,tilingSchema:this.tilingSchema}),opacity:this.opacity})}}class Qu extends rs{static get className(){return"WmtsOpenlayersImpl"}constructor(t,e){super(t,e);this.layer=e.layer,this.style=e.style,this.format=e.format,this.tileMatrixSetID=e.tileMatrixSetID,this.tileSize=e.tileSize,this.numberOfLevelZeroTilesX=e.numberOfLevelZeroTilesX,this.numberOfLevelZeroTilesY=e.numberOfLevelZeroTilesY,this.matrixIds=e.matrixIds,this.openlayersOptions=e.openlayersOptions}getOLLayer(){const t=this.tilingSchema===Le.GEOGRAPHIC?B:F,e=t.proj.getExtent();let s=Tn(e)/this.tileSize[0];this.numberOfLevelZeroTilesX>1&&(s/=this.numberOfLevelZeroTilesX),this.tilingSchema===Le.GEOGRAPHIC&&(s=Tn(e)/(this.tileSize[0]*2));const r=this.maxLevel+1,n=new Array(r).fill(void 0).map((u,d)=>s/2**d),a=this.extent.getCoordinatesInProjection(t),o={origin:pr(e),extent:a,resolutions:n,matrixIds:this.matrixIds,minZoom:this.minLevel,tileSize:this.tileSize};if(this.numberOfLevelZeroTilesX>1||this.numberOfLevelZeroTilesY>1){const u=[];let d=this.numberOfLevelZeroTilesX,f=this.numberOfLevelZeroTilesY;for(let g=0;g<=r;g++)u.push([d,f]),d*=2,f*=2;o.sizes=u}const l=new Vd(o),h=this.url.indexOf("{")>=0?"REST":"KVP",c={tileGrid:l,requestEncoding:h,layer:this.layer,style:this.style,format:this.format,matrixSet:this.tileMatrixSetID,url:this.url};return sr(this.url)||(c.crossOrigin="anonymous"),this.tilingSchema===Le.GEOGRAPHIC&&(c.projection="EPSG:4326"),Object.assign(c,this.openlayersOptions),new Oi({opacity:this.opacity,source:new Bd(c)})}}const td=new Mt({});class cs extends Se{static get className(){return"PointCloudLayer"}static getDefaultOptions(){return O(_({},Se.getDefaultOptions()),{pointSize:null})}constructor(t){super(t);const e=cs.getDefaultOptions();this.defaultPointSize=t.pointSize!=null?t.pointSize:e.pointSize,this._pointSize=this.defaultPointSize,this._supportedMaps=[G.className]}getStyleOrDefaultStyle(t,e){return super.getStyleOrDefaultStyle(t,e||td)}get pointSize(){return this._pointSize}set pointSize(t){it(t,[Number,String]),this._pointSize=t,this.style.pointSize=t==null?void 0:t.toString()}async initialize(){await super.initialize(),this.pointSize=this._pointSize}createImplementationsForMap(t){return t instanceof G?[new We(t,this.getImplementationOptions())]:[]}clearStyle(){super.clearStyle(),this.pointSize=this.defaultPointSize}setStyle(t,e){t instanceof q?this.getLogger().warning("trying to apply vector style to point cloud layer."):super.setStyle(t,e)}toJSON(){const t=super.toJSON(),e=cs.getDefaultOptions();return this.defaultPointSize!==e.pointSize&&(t.pointSize=this.defaultPointSize),t}}ot.registerClass(cs.className,cs);class lr extends jt{static get className(){return"SingleImageLayer"}static getDefaultOptions(){return O(_({},jt.getDefaultOptions()),{credit:void 0})}constructor(t){super(t);const e=lr.getDefaultOptions();this.credit=t.credit||e.credit,this.extent.isValid()||(this.getLogger().warning(`layer ${this.name} was constructed with an invalid extent, defaulting to global extent`),this.extent=new pt({projection:B.toJSON(),coordinates:[-180,-90,180,90]})),this._supportedMaps=[G.className,tt.className]}getImplementationOptions(){return O(_({},super.getImplementationOptions()),{credit:this.credit})}createImplementationsForMap(t){return t instanceof G?[new Au(t,this.getImplementationOptions())]:t instanceof tt?[new Xu(t,this.getImplementationOptions())]:[]}setExtent(t){if(v(t,pt),!t.isValid())throw new Error("Cannot set invalid extent");this.extent=t,this.forceRedraw()}toJSON(){const t=super.toJSON();return delete t.tilingSchema,this.credit&&(t.credit=this.credit),t}}ot.registerClass(lr.className,lr);class us extends ht{static get className(){return"TerrainLayer"}static getDefaultOptions(){return O(_({},ht.getDefaultOptions()),{requestVertexNormals:!0,requestWaterMask:!1})}constructor(t){super(t);const e=us.getDefaultOptions();this._supportedMaps=[G.className],this.requestVertexNormals=rt(t.requestVertexNormals,e.requestVertexNormals),this.requestWaterMask=rt(t.requestWaterMask,e.requestWaterMask)}getImplementationOptions(){return O(_({},super.getImplementationOptions()),{requestVertexNormals:this.requestVertexNormals,requestWaterMask:this.requestWaterMask})}createImplementationsForMap(t){return t instanceof G?[new Gu(t,this.getImplementationOptions())]:[]}getHeightForWGS84Coordinates(t){const e=Qi({url:this.url,requestVertexNormals:this.requestVertexNormals,requestWaterMask:this.requestWaterMask});return yi(e,t,null,t)}toJSON(){const t=super.toJSON(),e=us.getDefaultOptions();return this.requestVertexNormals!==e.requestVertexNormals&&(t.requestVertexNormals=this.requestVertexNormals),this.requestWaterMask!==e.requestWaterMask&&(t.requestWaterMask=this.requestWaterMask),t}}ot.registerClass(us.className,us);function k1(i,t){return new Promise(e=>{let s;const r=i.cesium3DTileset.allTilesLoaded.addEventListener(()=>{s&&clearTimeout(s),r(),e()});t!=null&&(s=setTimeout(()=>{r(),e()},t))})}async function z1(i,t){const e=i.getImplementations().filter(s=>s instanceof We);!i.active||e.every(s=>s.cesium3DTileset.tilesLoaded)||await Promise.all(e.map(s=>k1(s,t)))}function j1(i,t){return i.tilesLoaded?Promise.resolve():new Promise(e=>{let s;const r=i.tileLoadProgressEvent.addEventListener(n=>{n<1&&(s&&clearTimeout(s),r(),e())});t!=null&&(s=setTimeout(()=>{r(),e()},t))})}function Lo(i,t,e,s,r){let n=i;if(r){const a=Ut.southwest(r),o=Ut.northeast(r),l=P.toDegrees(a.longitude),h=P.toDegrees(a.latitude),c=P.toDegrees(o.longitude),u=P.toDegrees(o.latitude);n=n.replace(/\{minx\}/,String(l)).replace(/\{miny\}/,String(h)).replace(/\{maxx\}/,String(c)).replace(/\{maxy\}/,String(u))}return n=n.replace(/\{x\}/,String(t)).replace(/\{y\}/,String(e)).replace(/\{z\}/,String(s)).replace(/\{locale\}/,Pa()),n}class hr extends Wt{static get className(){return"URLTemplateTileProvider"}static getDefaultOptions(){return O(_({},Wt.getDefaultOptions()),{url:void 0})}constructor(t){const e=hr.getDefaultOptions();super(t);this.url=t.url||e.url}async loader(t,e,s){const r=this.tilingScheme.tileXYToRectangle(t,e,s),n=Lo(this.url,t,e,s,r),a=await ye(n),{features:o}=Ie(a,{dynamicStyle:!0});return o}toJSON(){const t=super.toJSON();return this.url&&(t.url=this.url),t}}si.registerClass(hr.className,hr);class cr extends Wt{static get className(){return"MVTTileProvider"}static getDefaultOptions(){return O(_({},Wt.getDefaultOptions()),{url:void 0,idProperty:void 0})}constructor(t){const e=cr.getDefaultOptions();super(t);this.url=t.url||e.url,this.idProperty=t.idProperty||e.idProperty,this._MVTFormat=new Ud({featureClass:Z})}async loader(t,e,s){const r=this.tilingScheme.tileXYToRectangle(t,e,s),n=Lo(this.url,t,e,s,r),a=pn(r),o=Ln(a),l=await iu(n),h=this._MVTFormat.readFeatures(l),c=(a[2]-a[0])/4096,u=-((a[3]-a[1])/4096);return h.forEach(d=>{const f=d.get(this.idProperty);f!=null&&d.setId(String(f));const m=d.getGeometry().getFlatCoordinates(),p=m.length;for(let y=0;y<p;y++)y%2?(m[y]=(m[y]-2048)*u,m[y]+=o[1]):(m[y]=(m[y]-2048)*c,m[y]+=o[0])}),h}toJSON(){const t=super.toJSON();return this.url&&(t.url=this.url),this.idProperty&&(t.idProperty=this.idProperty),t}}si.registerClass(cr.className,cr);class ur extends Wt{static get className(){return"StaticGeoJSONTileProvider"}static getDefaultOptions(){return O(_({},Wt.getDefaultOptions()),{url:void 0,baseLevels:[0]})}constructor(t){const e=ur.getDefaultOptions();t.baseLevels=e.baseLevels;super(t);this.url=t.url||e.url}async loader(t,e,s){const r=await ye(this.url),{features:n}=Ie(r,{dynamicStyle:!0});return n}toJSON(){const t=super.toJSON();return delete t.baseLevels,this.url&&(t.url=this.url),t}}si.registerClass(ur.className,ur);class ds extends jt{static get className(){return"TMSLayer"}static getDefaultOptions(){return O(_({},jt.getDefaultOptions()),{tilingSchema:"mercator",format:"jpeg",tileSize:[256,256]})}constructor(t){const e=ds.getDefaultOptions();t.tilingSchema=t.tilingSchema||e.tilingSchema;super(t);this._supportedMaps=[tt.className,G.className],this.format=t.format||e.format,this.tileSize=Array.isArray(t.tileSize)?t.tileSize.slice():e.tileSize}getImplementationOptions(){return O(_({},super.getImplementationOptions()),{format:this.format,tileSize:this.tileSize})}createImplementationsForMap(t){return t instanceof tt?[new Zu(t,this.getImplementationOptions())]:t instanceof G?[new zu(t,this.getImplementationOptions())]:[]}toJSON(){const t=super.toJSON(),e=ds.getDefaultOptions();return this.tilingSchema!==e.tilingSchema?t.tilingSchema=this.tilingSchema:delete t.tilingSchema,this.format!==e.format&&(t.format=this.format),(this.tileSize[0]!==e.tileSize[0]||this.tileSize[1]!==e.tileSize[1])&&(t.tileSize=this.tileSize.slice()),t}}ot.registerClass(ds.className,ds);function ed(i,t,e){const s=e.getId();i.hiddenObjects[s]?e[At]=!0:e[At]&&delete e[At],i.highlightedObjects[s]?e[Nt]=i.highlightedObjects[s].style:e[Nt]&&delete e[Nt],t.hiddenObjects[s]?e[Gt]=!0:e[Gt]&&delete e[Gt]}class fs extends _e{static get className(){return"VectorTileLayer"}static getDefaultOptions(){return O(_({},_e.getDefaultOptions()),{tileProvider:void 0,highlightStyle:void 0,vectorProperties:{},minLevel:void 0,maxLevel:void 0})}constructor(t){super(t);this._supportedMaps=[G.className,tt.className];const e=fs.getDefaultOptions();this.highlightStyle=e.highlightStyle,t.highlightStyle&&(this.highlightStyle=t.highlightStyle instanceof q?t.highlightStyle:new q(t.highlightStyle)),this._tileSize=[256,256],this.vectorProperties=new te(_({allowPicking:this.allowPicking},t.vectorProperties)),this.tileProvider=t.tileProvider instanceof Wt?t.tileProvider:ge(si,t.tileProvider),this._maxLevel=V(t.maxLevel,e.maxLevel),this._minLevel=V(t.minLevel,e.minLevel),this._featureVisibilityListener=[],this._tileLoadEventListener=()=>{},this._vectorPropertiesChangedListener=()=>{},this._styleZIndex=0}async initialize(){this.initialized||(this._tileLoadEventListener=this.tileProvider.tileLoadedEvent.addEventListener(t=>this._handleTileLoaded(t)),this._vectorPropertiesChangedListener=this.vectorProperties.propertyChanged.addEventListener(()=>{this.reload()}),this.featureProvider=new mn(this.name,{tileProvider:this.tileProvider,vectorProperties:this.vectorProperties})),await super.initialize()}objectClickedHandler(t){const e=t[Be]||t;return this.vectorProperties.getAllowPicking(e)?t[At]||t[Gt]?null:{id:e.getId(),feature:e}:null}getGenericFeatureFromClickedObject(t){return Ya(t,this)}_getNextStyleZIndex(){return this._styleZIndex+=1,this._styleZIndex}_handleTileLoaded({rtree:t}){t.all().map(e=>e.value).forEach(e=>{const s=e.getStyle();s&&s instanceof ft&&s.setZIndex(this._getNextStyleZIndex()),e[z]=this.name,e.getStyleFunction=()=>this._featureStyle.bind(this),this.tileProvider.trackFeaturesToTiles&&ed(this.featureVisibility,this.globalHider,e)})}_setupFeatureVisibilityHandlers(){return this.tileProvider.trackFeaturesToTiles?[this.featureVisibility.changed.addEventListener(({action:t,ids:e})=>{const s=new Set;e.forEach(r=>{const n=this.tileProvider.featureIdToTileIds.get(r);n&&n.forEach(a=>{const l=this.tileProvider.rtreeCache.get(a).all().find(h=>h.value.getId()===r);if(l){const h=l.value;s.add(a),t===W.HIGHLIGHT?h[Nt]=this.featureVisibility.highlightedObjects[r].style:t===W.UNHIGHLIGHT?delete h[Nt]:t===W.HIDE?h[At]=!0:t===W.SHOW&&delete h[At]}})}),this.updateTiles([...s])}),this.globalHider.changed.addEventListener(({action:t,ids:e})=>{const s=new Set;e.forEach(r=>{const n=this.tileProvider.featureIdToTileIds.get(r);n&&n.forEach(a=>{const l=this.tileProvider.rtreeCache.get(a).all().find(h=>h.value.getId()===r);if(l){const h=l.value;s.add(a),t===W.HIDE?h[Gt]=!0:t===W.SHOW&&delete h[Gt]}})}),this.updateTiles([...s])})]:[]}updateTiles(t){this.getImplementations().forEach(e=>{e.updateTiles(t)})}_featureStyle(t,e){let s;return t[At]||t[Gt]?[]:(t[Nt]?{style:s}=t[Nt]:this.style instanceof Mt?{style:s}=this.style:s=t.getStyle()||this.style.style,Zs(s,t,e))}getImplementationOptions(){return O(_({},super.getImplementationOptions()),{tileProvider:this.tileProvider,tileSize:this._tileSize,minLevel:this._minLevel,maxLevel:this._maxLevel,extent:this.extent})}createImplementationsForMap(t){return t instanceof G?[new Vu(t,this.getImplementationOptions())]:t instanceof tt?[new Ju(t,this.getImplementationOptions())]:[]}getStyleOrDefaultStyle(t,e){return super.getStyleOrDefaultStyle(t,e||oi.clone())}async activate(){await super.activate(),this._featureVisibilityListener=this._setupFeatureVisibilityHandlers(),this.tileProvider.trackFeaturesToTiles&&this.tileProvider.forEachFeature(t=>{ed(this.featureVisibility,this.globalHider,t)})}deactivate(){super.deactivate(),this._featureVisibilityListener.forEach(t=>{t()})}destroy(){this._featureVisibilityListener.forEach(t=>{t()}),super.destroy(),this._tileLoadEventListener(),this.featureProvider&&this.featureProvider.destroy(),this.tileProvider&&this.tileProvider.destroy(),this._vectorPropertiesChangedListener(),this.vectorProperties&&this.vectorProperties.destroy()}toJSON(){const t=super.toJSON(),e=fs.getDefaultOptions();this._maxLevel!==e.maxLevel&&(t.maxLevel=this._maxLevel),this._minLevel!==e.minLevel&&(t.minLevel=this._minLevel);const s=this.vectorProperties.getVcsMeta();return Object.keys(s).length>0&&(t.vectorProperties=s),this.tileProvider&&(t.tileProvider=this.tileProvider.toJSON()),t}}ot.registerClass(fs.className,fs);class To extends Ct{static get className(){return"WFSLayer"}static getDefaultOptions(){return O(_({},Ct.getDefaultOptions()),{featureType:[],featureNS:"",featurePrefix:"",getFeatureOptions:{}})}constructor(t){const e=new T(t.projection).toJSON();e.alias=[`http://www.opengis.net/gml/srs/epsg.xml#${e.epsg.match(/\d+/)[0]}`],t.projection=e;super(t);this.featureType=Array.isArray(t.featureType)?t.featureType:[t.featureType],this.featureNS=t.featureNS,this.featurePrefix=t.featurePrefix,this.getFeaturesOptions=t.getFeatureOptions||{},this.wfsFormat=new Xo({featureNS:this.featureNS,featureType:this.featureType}),this._dataFetchedPromise=null}async initialize(){return this.initialized||await this.fetchData(),super.initialize()}async reload(){return this._dataFetchedPromise&&(this.removeAllFeatures(),this._dataFetchedPromise=null,await this.fetchData()),super.reload()}fetchData(){if(this._dataFetchedPromise)return this._dataFetchedPromise;if(this.url!=null){const t=this.wfsFormat.writeGetFeature(_({featureNS:this.featureNS,featurePrefix:this.featurePrefix,featureTypes:this.featureType,srsName:this.projection.epsg},this.getFeaturesOptions)),e=new XMLSerializer().serializeToString(t);return this._dataFetchedPromise=ye(this.url,{method:"POST",headers:{"Content-Type":"application/text+xml"},body:JSON.stringify(e)}).then(s=>this._parseWFSData(s)).catch(s=>(this.getLogger().info(`Could not send request for loading layer content (${s.message})`),Promise.reject(s))),this._dataFetchedPromise}return this.getLogger().warning("Could not load WFSLayer layer, no url is set"),Promise.reject(new Error("missing url in WFSLayer layer"))}_parseWFSData(t){const e=this.wfsFormat.readFeatures(t);this.addFeatures(e)}toJSON(){const t=super.toJSON();return t.featureType=this.featureType.slice(),t.featureNS=this.featureNS,t.featurePrefix=this.featurePrefix,Object.keys(this.getFeaturesOptions).length>0&&(t.getFeatureOptions=this.getFeaturesOptions),t}}ot.registerClass(To.className,To);class gs extends jt{static get className(){return"WMSLayer"}static getDefaultOptions(){return O(_({},jt.getDefaultOptions()),{version:"1.1.1",parameters:void 0,featureInfo:void 0,tileSize:[256,256],highResolution:!1,layers:""})}constructor(t){super(t);const e=gs.getDefaultOptions();if(this.version=t.version||e.version,this.parameters={},t.parameters){let s;typeof t.parameters=="string"?s=Object.fromEntries(new URLSearchParams(t.parameters)):t.parameters instanceof Object&&(s=t.parameters),Object.keys(s).forEach(r=>{this.parameters[r.toUpperCase()]=s[r]})}this.parameters.TRANSPARENT==null&&(this.parameters.TRANSPARENT=!1),this.version&&(this.parameters.VERSION=this.version),this.parameters.LAYERS=t.layers||e.layers,this.tileSize=t.tileSize||e.tileSize,this.highResolution=rt(t.highResolution,e.highResolution),this._featureInfoOptions=t.featureInfo||e.featureInfo,this._supportedMaps=[G.className,tt.className]}initialize(){return this.initialized||this._setFeatureProvider(),super.initialize()}_setFeatureProvider(){if(this._featureInfoOptions){const t=_({url:this.url,tilingSchema:this.tilingSchema,maxLevel:this.maxLevel,minLevel:this.minLevel,tileSize:this.tileSize,extent:this.extent,parameters:this.parameters,version:this.version},this._featureInfoOptions);this.featureProvider=new Ye(this.name,t)}}async reload(){return this.featureProvider&&this._featureInfoOptions&&(this.featureProvider.destroy(),this._setFeatureProvider()),super.reload()}getImplementationOptions(){return O(_({},super.getImplementationOptions()),{version:this.version,parameters:this.parameters,highResolution:this.highResolution,tileSize:this.tileSize})}createImplementationsForMap(t){return t instanceof G?[new Bu(t,this.getImplementationOptions())]:t instanceof tt?[new Ku(t,this.getImplementationOptions())]:[]}async setLayers(t){v(t,[String,[String]]);const e=Array.isArray(t)?t:[t];this.parameters.LAYERS=e.join(","),await this.forceRedraw()}getLayers(){return this.parameters.LAYERS?this.parameters.LAYERS.split(","):[]}toJSON(){const t=super.toJSON(),e=gs.getDefaultOptions();this.parameters.LAYERS&&(t.layers=this.parameters.LAYERS),this.version!==e.version&&(t.version=this.version);const s=_({},this.parameters);if(delete s.VERSION,delete s.LAYERS,s.TRANSPARENT===!1&&delete s.TRANSPARENT,Object.keys(s).length>0&&(t.parameters=s),this.version!==e.version&&(t.version=this.version),this.highResolution!==e.highResolution&&(t.highResolution=this.highResolution),(this.tileSize[0]!==e.tileSize[0]||this.tileSize[1]!==e.tileSize[1])&&(t.tileSize=this.tileSize.slice()),this.featureProvider&&this.featureProvider instanceof Ye){const r=this.featureProvider.toJSON();(this.tileSize[0]===r.tileSize[0]||this.tileSize[1]===r.tileSize[1])&&delete r.tileSize,Object.entries(this.parameters).every(([n,a])=>r.parameters[n]===a)&&delete r.parameters,r.extent&&new pt(r.extent).equals(this.extent)&&delete r.extent,this.url===r.url&&delete r.url,this.tilingSchema===r.tilingSchema&&delete r.tilingSchema,this.version===r.version&&delete r.version,this.minLevel===r.minLevel&&delete r.minLevel,this.maxLevel===r.maxLevel&&delete r.maxLevel,t.featureInfo=r}else this._featureInfoOptions&&(t.featureInfo=this._featureInfoOptions);return t}}ot.registerClass(gs.className,gs);function $1(i,t,e){if(i.length>0){if(i.length===t+1)return i;Pt("WmtsCesiumImpl").log("matrixIds must have the same length as maxLevel")}return new Array(t+1).fill(void 0).map((s,r)=>`${e}${r}`)}class ms extends jt{static get className(){return"WMTSLayer"}static getDefaultOptions(){return O(_({},jt.getDefaultOptions()),{tilingSchema:"mercator",numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,layer:"",style:"",format:"",tileMatrixPrefix:"",tileMatrixSetID:"",openlayersOptions:{},matrixIds:[],tileSize:[256,256]})}constructor(t){const e=ms.getDefaultOptions();t.tilingSchema=t.tilingSchema||e.tilingSchema;super(t);this._supportedMaps=[tt.className,G.className],this.numberOfLevelZeroTilesX=V(t.numberOfLevelZeroTilesX,e.numberOfLevelZeroTilesX),this.numberOfLevelZeroTilesY=V(t.numberOfLevelZeroTilesY,e.numberOfLevelZeroTilesY),this.layer=t.layer||e.layer,this.style=t.style||e.style,this.format=t.format||e.format,this.tileMatrixPrefix=t.tileMatrixPrefix||e.tileMatrixPrefix,this.tileMatrixSetID=t.tileMatrixSetID||e.tileMatrixSetID,this.openlayersOptions=t.openlayersOptions||e.openlayersOptions,this.matrixIds=Array.isArray(t.matrixIds)?t.matrixIds:e.matrixIds,this.tileSize=t.tileSize||e.tileSize}getImplementationOptions(){return O(_({},super.getImplementationOptions()),{layer:this.layer,style:this.style,format:this.format,tileMatrixSetID:this.tileMatrixSetID,tileSize:this.tileSize,numberOfLevelZeroTilesX:this.numberOfLevelZeroTilesX,numberOfLevelZeroTilesY:this.numberOfLevelZeroTilesY,matrixIds:$1(this.matrixIds,this.maxLevel,this.tileMatrixPrefix),openlayersOptions:this.openlayersOptions})}createImplementationsForMap(t){return t instanceof tt?[new Qu(t,this.getImplementationOptions())]:t instanceof G?[new Uu(t,this.getImplementationOptions())]:[]}toJSON(){const t=super.toJSON(),e=ms.getDefaultOptions();return this.tilingSchema!==e.tilingSchema?t.tilingSchema=this.tilingSchema:delete t.tilingSchema,this.numberOfLevelZeroTilesX!==e.numberOfLevelZeroTilesX&&(t.numberOfLevelZeroTilesX=this.numberOfLevelZeroTilesX),this.numberOfLevelZeroTilesY!==e.numberOfLevelZeroTilesY&&(t.numberOfLevelZeroTilesY=this.numberOfLevelZeroTilesY),this.layer!==e.layer&&(t.layer=this.layer),this.style!==e.style&&(t.style=this.style),this.format!==e.format&&(t.format=this.format),this.tileMatrixPrefix!==e.tileMatrixPrefix&&(t.tileMatrixPrefix=this.tileMatrixPrefix),this.tileMatrixSetID!==e.tileMatrixSetID&&(t.tileMatrixSetID=this.tileMatrixSetID),Object.keys(this.openlayersOptions).length>0&&(t.openlayersOptions=_({},this.openlayersOptions)),this.matrixIds.length>0&&(t.matrixIds=this.matrixIds.slice()),(this.tileSize[0]!==e.tileSize[0]||this.tileSize[1]!==e.tileSize[1])&&(t.tileSize=this.tileSize.slice()),t}}ot.registerClass(ms.className,ms);function No(){return Pt("ClippingObject")}const vn=Symbol("ClippingObjectGlobe");class Mi{constructor(t={}){this.id=Xt(),this.layerNames=t.layerNames||[],this.entities=t.entities||[],this.targets=new Map,this._clippingPlaneCollection=t.clippingPlaneCollection||null,this._terrain=rt(t.terrain,!1),this._local=rt(t.local,!1),this.targetsUpdated=new R,this.clippingPlaneUpdated=new R,this._cachedFeatureStoreLayers=new Set,this._activeMap=null,this._layerCollection=null}get clippingPlaneCollection(){return this._clippingPlaneCollection}set clippingPlaneCollection(t){this._clippingPlaneCollection=t,this.clippingPlaneUpdated.raiseEvent()}get terrain(){return this._terrain}set terrain(t){v(t,Boolean),this._terrain!==t&&(this._terrain=t,this.handleMapChanged(this._activeMap))}get local(){return this._local}set local(t){v(t,Boolean),this._local!==t&&(this._local=t,this.clippingPlaneUpdated.raiseEvent())}setLayerCollection(t){if(v(t,Te),this._layerCollection&&this._layerCollection!==t)throw new Error("layerCollection has already been set");this._layerCollection=t,[...this._layerCollection].forEach(e=>{this.handleLayerChanged(e)})}handleLayerChanged(t){const e=this._activeMap;if(e instanceof G){if(this.layerNames.includes(t.name))if(t.active){const s=e.getVisualizationsForLayer(t),r=s?[...s].filter(n=>n instanceof ws):[];if(r.length>0)r.forEach(n=>{n.readyPromise.then(a=>{this.layerNames.includes(t.name)&&t.active&&(this.targets.set(t.name,a),this.targetsUpdated.raiseEvent())})});else{const n=this.layerNames.indexOf(t.name);No().warning(`layer ${t.name} cannot have a ClippingObject applied`),this.layerNames.splice(n,1)}}else this.targets.has(t.name)&&(this.targets.delete(t.name),this.targetsUpdated.raiseEvent());else if(this.entities.find(s=>s.layerName===t.name)){let s=!1;const r=e.getVisualizationsForLayer(t),n=r?[...r][0]:null;if(!n){const a=this.layerNames.indexOf(t.name);No().warning(`layer ${t.name} cannot have a ClippingObject applied`),this.layerNames.splice(a,1);return}this.entities.filter(a=>a.layerName===t.name).forEach(a=>{const o=`${a.layerName}-${a.entityId}`;if(t.active){const l=n.entities.getById(a.entityId);if(l)this.targets.set(o,l),s=!0;else{const h=this.entities.indexOf(a);No().warning(`could not find entity with id ${a.entityId} in layer ${a.layerName}`),this.entities.splice(h,1)}}else this.targets.has(o)&&(this.targets.delete(o),s=!0)}),s&&this.targetsUpdated.raiseEvent()}}else this.layerNames.includes(t.name)&&t.className==="FeatureStoreLayer"&&(t.active?this._cachedFeatureStoreLayers.add(t):this._cachedFeatureStoreLayers.has(t)&&this._cachedFeatureStoreLayers.delete(t))}handleMapChanged(t){if(t instanceof G){const{globe:e}=t.getScene();let s=!1;this._terrain&&!this.targets.has(vn)?(this.targets.set(vn,e),s=!0):!this._terrain&&this.targets.has(vn)&&(this.targets.delete(vn),s=!0),s&&this.targetsUpdated.raiseEvent(),this._cachedFeatureStoreLayers.size>0&&(this._cachedFeatureStoreLayers.forEach(r=>{this.handleLayerChanged(r)}),this._cachedFeatureStoreLayers.clear())}this._activeMap=t}addLayer(t){if(v(t,String),!this.layerNames.includes(t)){this.layerNames.push(t);const e=this._layerCollection?this._layerCollection.getByKey(t):null;e&&e.active&&this.handleLayerChanged(e)}}removeLayer(t){v(t,String);const e=this.layerNames.indexOf(t);e>-1&&this.layerNames.splice(e,1),this.targets.has(t)&&(this.targets.delete(t),this.targetsUpdated.raiseEvent())}addEntity(t,e){if(v(t,String),v(e,String),!this.entities.find(s=>s.layerName===t&&s.entityId===e)){this.entities.push({layerName:t,entityId:e});const s=this._layerCollection?this._layerCollection.getByKey(t):null;s&&s.active&&this.handleLayerChanged(s)}}removeEntity(t,e){v(t,String),v(e,String);const s=this.entities.findIndex(n=>n.layerName===t&&n.entityId===e);s>-1&&this.entities.splice(s,1);const r=`${t}-${e}`;this.targets.has(r)&&(this.targets.delete(r),this.targetsUpdated.raiseEvent())}}function id(i,t){const e=C.subtract(i,t,new C);C.normalize(e,e);const s=Ke.fromPointNormal(i,e);return ti.fromPlane(s)}function H1(i){const t=[],e=i.map(s=>C.fromDegrees(...T.mercatorToWgs84(s)));for(let s=0;s<e.length-1;s++){const r=s+1,n=new C;C.cross(e[r],e[s],n),C.normalize(n,n);const a=new Ke(n,0);Number.isNaN(a.distance)||t.push(ti.fromPlane(a))}return t}function sd(i,t,e){const s=[],r=Fe.fromGeometry(i.getGeometry());let n=Number.isFinite(r.minZ)?r.minZ:0,a=Number.isFinite(r.maxZ)?r.maxZ:0;const o=i.get("olcs_extrudedHeight");o&&(a+=o,i.get("olcs_skirt")&&(n-=i.get("olcs_skirt"))),n===a&&(a+=1);const[l,h]=T.mercatorToWgs84(t[0]),c=C.fromDegrees(l,h,n),u=C.fromDegrees(l,h,a);return e.createBottomPlane&&s.push(id(c,u)),o&&e.createTopPlane&&s.push(id(u,c)),s}function V1(i){const t=[],e=i.map(n=>C.fromDegrees(...T.mercatorToWgs84(n))),s=new C;C.cross(e[0],e[1],s),C.normalize(s,s);function r(n){const a=C.add(n,s,new C),o=new C;C.cross(n,a,o),C.normalize(o,o);const l=new Ke(o,0);t.push(ti.fromPlane(l))}return r(e[0]),C.negate(s,s),r(e[1]),t}function B1(i,t={},e){v(i,Z),v(t,Object),it(e,A);const s=[],r=i.getGeometry(),n=r.getType();if(n==="Point")s.push(...sd(i,[r.getCoordinates()],t));else{const a=Yi(r);if(a.length<2||a[0][0]===a[1][0]&&a[0][1]===a[1][1])return null;n==="Polygon"?(on(a),Cc(a)):n==="LineString"&&a.length===2&&t.createEndingPlanes&&s.push(...V1(a)),t.createVerticalPlanes&&s.push(...H1(a)),i.get("olcs_altitudeMode")==="absolute"&&(t.createBottomPlane||t.createTopPlane)&&s.push(...sd(i,a,t))}return e&&s.forEach(a=>{const o=Ke.transform(a,e);a.normal=o.normal,a.distance=o.distance}),t.reverse&&s.forEach(a=>{C.negate(a.normal,a.normal),a.distance*=-1}),new Qe({planes:s,unionClippingRegions:t.reverse})}function ns(i,t,e,s){v(i,Qe),v(t,Qe),t.length>0&&t.removeAll();for(let r=0;r<i.length;r++){const n=i.get(r);if(e&&s){const a=Ke.getPointDistance(n,s),o=Ke.transform(n,e);o.distance=a,t.add(ti.fromPlane(o))}else t.add(ti.clone(n))}return t.modelMatrix=i.modelMatrix.clone(),t.unionClippingRegions=i.unionClippingRegions,t.edgeColor=i.edgeColor.clone(),t.edgeWidth=i.edgeWidth,t}function ar(i){i instanceof Rn?i.model&&(i.model.clippingPlanes?i.model.clippingPlanes.getValue().removeAll():i.model.clippingPlanes=new Af(new Qe)):i.clippingPlanes?i.clippingPlanes.removeAll():i.clippingPlanes=new Qe}function U1(i,t,e){if(ar(i),e)ns(t,i.clippingPlanes);else if(!t.modelMatrix.equals(A.IDENTITY))ns(t,i.clippingPlanes),i.clippingPlanes.modelMatrix=A.multiply(A.inverse(i.clippingPlanesOriginMatrix,i.clippingPlanes.modelMatrix),t.modelMatrix,i.clippingPlanes.modelMatrix);else{const s=A.getMatrix3(A.inverse(i.clippingPlanesOriginMatrix,new A),new Vt),r=A.fromRotationTranslation(s,new C);ns(t,i.clippingPlanes,r,i.boundingSphere.center)}}function q1(i,t){ar(i),ns(t,i.clippingPlanes)}function W1(i,t,e){if(i.model){ar(i);const s=i.model.clippingPlanes.getValue();if(ns(t,s),!e){const r=i.computeModelMatrix(al.now());A.inverseTransformation(r,s.modelMatrix),t.modelMatrix.equals(A.IDENTITY)||A.multiply(s.modelMatrix,t.modelMatrix,s.modelMatrix)}}}function Do(i,t,e){i instanceof ws?U1(i,t,e):i instanceof Gf?q1(i,t):W1(i,t,e)}function Y1(i,t,e=!1,s=25){v(i,[Number]),v(e,Boolean),v(s,Number);let r;if(e){const a=gr(i,-s,t.heading),o=gr(i,s,t.heading);r=new En([[a[0],a[1],i[2]],[o[0],o[1],i[2]]],wn.XYZ)}else{r=new In([[]],wn.XYZ);let a=2*Math.PI-Math.PI/4;const o=[...new Array(4)].map(()=>{const l=gr(i,s,a);return a-=Math.PI/2,[l[0],l[1],i[2]]});r.setCoordinates([o])}const n=new Z({geometry:r});return n.set("olcs_altitudeMode","absolute"),e&&n.set("olcs_extrudedHeight",s*2),r.transform(B.proj,F.proj),n}function X1(i,t=!1){return it(i,Z),v(t,Boolean),(i?i.getGeometry().getType()==="LineString":!1)?{createBottomPlane:!t,createTopPlane:!t,createEndingPlanes:!t,createVerticalPlanes:!0}:{createVerticalPlanes:!t,createBottomPlane:!0}}class rd{static get className(){return"ClippingObjectManager"}constructor(t){this._defaultClippingObjects=new Set,this._exclusiveClippingObjects=null,this._targetsMap=new Map,this._listenersMap=new Map,this._exclusiveRemovedCb=null,this.initialized=!1,this._updateSuspended=!1,this._dirty=!1,this._layerCollection=t,this._activeMap=null,this._layerChangedListener=this._layerCollection.stateChanged.addEventListener(e=>{this._layerChanged(e)})}get suspendUpdate(){return this._updateSuspended}set suspendUpdate(t){v(t,Boolean),this._updateSuspended=t,!this._updateSuspended&&this._dirty&&(this._dirty=!1,this._update())}_layerChanged(t){this.suspendUpdate=!0,this._defaultClippingObjects.forEach(e=>{e.handleLayerChanged(t)}),this._exclusiveClippingObjects&&this._exclusiveClippingObjects.forEach(e=>{e.handleLayerChanged(t)}),this.suspendUpdate=!1}mapActivated(t){this.suspendUpdate=!0,this._defaultClippingObjects.forEach(e=>{e.handleMapChanged(t)}),this._exclusiveClippingObjects&&this._exclusiveClippingObjects.forEach(e=>{e.handleMapChanged(t)}),this.suspendUpdate=!1,this._activeMap=t}addClippingObject(t){if(v(t,Mi),this.hasClippingObject(t))throw new Error("ClippingObject already managed, remove it first");t.setLayerCollection(this._layerCollection),this._defaultClippingObjects.add(t),this._activeMap instanceof G&&t.handleMapChanged(this._activeMap),this._listenersMap.set(t,[t.targetsUpdated.addEventListener(this._update.bind(this)),t.clippingPlaneUpdated.addEventListener(this._clippingPlaneUpdated.bind(this,t))]),this._update()}removeClippingObject(t){v(t,Mi),this._defaultClippingObjects.has(t)&&(this._defaultClippingObjects.delete(t),this._listenersMap.get(t).forEach(e=>{e()}),this._listenersMap.delete(t),this._update())}hasClippingObject(t){return v(t,Mi),this._defaultClippingObjects.has(t)||!!(this._exclusiveClippingObjects&&this._exclusiveClippingObjects.includes(t))}setExclusiveClippingObjects(t,e){if(v(t,[Mi]),v(e,Function),t.find(s=>this._defaultClippingObjects.has(s)))throw new Error("Some ClippingObjects are already managed, remove them first");this._clearExclusiveClippingObjects(),this._exclusiveRemovedCb=e,this._exclusiveClippingObjects=t,this._exclusiveClippingObjects.forEach(s=>{s.setLayerCollection(this._layerCollection),this._activeMap instanceof G&&s.handleMapChanged(this._activeMap),this._listenersMap.set(s,[s.targetsUpdated.addEventListener(this._update.bind(this)),s.clippingPlaneUpdated.addEventListener(this._clippingPlaneUpdated.bind(this,s))])}),this._update()}_clearExclusiveClippingObjects(t){this._exclusiveClippingObjects&&(this._exclusiveClippingObjects.forEach(e=>{this._listenersMap.get(e).forEach(s=>{s()}),this._listenersMap.delete(e)}),this._exclusiveClippingObjects=null),!t&&this._exclusiveRemovedCb&&this._exclusiveRemovedCb(),this._exclusiveRemovedCb=null}clearExclusiveClippingObjects(t){this._clearExclusiveClippingObjects(t),this._update()}_update(){if(this._updateSuspended){this._dirty=!0;return}const t=new Set(this._targetsMap.keys()),e=s=>{s.targets.forEach(r=>{this._targetsMap.set(r,s),t.delete(r)})};this._targetsMap.clear(),this._defaultClippingObjects.forEach(e),this._exclusiveClippingObjects&&this._exclusiveClippingObjects.forEach(e),t.forEach(s=>{ar(s)}),this._targetsMap.forEach((s,r)=>{s.clippingPlaneCollection&&Do(r,s.clippingPlaneCollection,s.local)})}_clippingPlaneUpdated(t){this._targetsMap.forEach((e,s)=>{e===t&&t.clippingPlaneCollection&&Do(s,t.clippingPlaneCollection)})}destroy(){this._listenersMap.forEach(t=>{t.forEach(e=>{e()})}),this._layerChangedListener(),this._listenersMap.clear(),this._targetsMap.clear(),this._defaultClippingObjects.clear(),this._exclusiveClippingObjects=null}}function Z1(i,t){return new Intl.DateTimeFormat(t,{dateStyle:"short"}).format(i)}function J1(i,t){return new Intl.DateTimeFormat(t,{timeStyle:"short"}).format(i)}function K1(i){const t=i.getMonth()+1,e=i.getDate();return`${i.getFullYear()}-${t>9?"":0}${t}-${e>9?"":0}${e}`}function Q1(i){const t=new Date(i.getFullYear(),0,0),e=i-t+(t.getTimezoneOffset()-i.getTimezoneOffset())*60*1e3,s=1e3*60*60*24;return Math.floor(e/s)}function tS(i){const t=i.getFullYear();return t%4!==0?!1:t%100!==0?!0:t%400===0}class Fo{constructor(t){this._position=.5,this.scene=null,this.olMap=null,this.initialized=!1,this.leftScreenClippingObject=new Mi,this.rightScreenClippingObject=new Mi,this._cameraListener=null,this.originalCameraPercentageChanged=null,this._targetsChangedListeners=[],this._targetsChangedListeners=[this.rightScreenClippingObject.targetsUpdated.addEventListener(()=>{this._targetsChanged()}),this.leftScreenClippingObject.targetsUpdated.addEventListener(()=>{this._targetsChanged()})],this._clippingObjectManager=t,this._clippingObjectManager.addClippingObject(this.rightScreenClippingObject),this._clippingObjectManager.addClippingObject(this.leftScreenClippingObject)}get position(){return this._position}set position(t){if(v(t,Number),t<0||t>1)throw new Error("Position must be between 0 and 1");Math.abs(this._position-t)>1e-4&&this._updatePosition(t)}_targetsChanged(){if(this.scene){const t=this.rightScreenClippingObject.targets.size+this.leftScreenClippingObject.targets.size,{camera:e}=this.scene;this._cameraListener&&t===0?(this._cameraListener(),this._cameraListener=null,e.percentageChanged=this.originalCameraPercentageChanged):!this._cameraListener&&t>0&&(this.originalCameraPercentageChanged=e.percentageChanged,e.percentageChanged=0,this._cameraListener=e.changed.addEventListener(this._updateClippingPlanes.bind(this)),this._updateClippingPlanes())}}_updatePosition(t){this._position=t,this.scene?(this.scene.imagerySplitPosition=t,this._updateClippingPlanes()):this.olMap&&this.olMap.render()}mapActivated(t){t instanceof G?(this.scene=t.getScene(),this.olMap=null,this._targetsChanged()):t instanceof tt&&(this.scene=null,this.olMap=t.olMap),this._updatePosition(this.position)}_calcClippingPlane(){const{camera:t}=this.scene,{fov:e,near:s}=t.frustum,r=this.scene.canvas.width||1,n=this.scene.canvas.height||1;let a;n>r?a=s*Math.tan(.5*e)*2/n:a=s*Math.tan(.5*e)*2/r;const o=r*this.position-r/2,l=n/2,h=new C(a*o,a*l,-1*s),c=new C(a*o,-1*a*l,-1*s);A.multiplyByPoint(t.inverseViewMatrix,h,h),A.multiplyByPoint(t.inverseViewMatrix,c,c);const u=t.positionWC;C.subtract(u,h,h),C.subtract(u,c,c);const d=C.cross(h,c,new C);C.normalize(d,d);const f=Ke.fromPointNormal(u,d);return ti.fromPlane(f)}_updateClippingPlanes(){const t=this._calcClippingPlane();this.leftScreenClippingObject.clippingPlaneCollection=new Qe({planes:[t]});const e=ti.clone(t);e.normal=C.negate(e.normal,e.normal),e.distance*=-1,this.rightScreenClippingObject.clippingPlaneCollection=new Qe({planes:[e]})}getClippingObjectForDirection(t){return v(t,[X.LEFT,X.RIGHT,X.NONE]),t===X.LEFT?this.leftScreenClippingObject:t===X.RIGHT?this.rightScreenClippingObject:null}destroy(){this._clippingObjectManager&&(this._clippingObjectManager.removeClippingObject(this.rightScreenClippingObject),this._clippingObjectManager.removeClippingObject(this.leftScreenClippingObject)),this._targetsChangedListeners.forEach(t=>{t()}),this._targetsChangedListeners=[],this._clippingObjectManager=null,this._cameraListener&&(this._cameraListener(),this._cameraListener=null)}}async function eS(i,t){const e=i.getViewPointSync(),s=e.clone();s.heading=0,s.pitch=-90,e&&!e.equals(s)&&(t.fixedNorthOrientation&&(e.heading=0),e.pitch=-90,e.animate=!0,e.duration=1,e.groundPosition&&(e.cameraPosition=null),await i.gotoViewPoint(e))}class Cn extends ve{static from(t){const e=new Cn;if(t)for(const s of t)e.add(s);return e}constructor(){super();this._activeMap=null,this._target=null,this._cachedViewpoint=null,this.eventHandler=new Du,this._layerCollection=new Te,this.initializeError=new R,this.fallbackMapActivated=new R,this.mapActivated=new R,this.clippingObjectManager=new rd(this._layerCollection),this._splitScreen=new Fo(this.clippingObjectManager),this._mapPointerListeners=[]}get activeMap(){return this._activeMap}get target(){return this._target}get layerCollection(){return this._layerCollection}set layerCollection(t){v(t,Te),this._layerCollection=t,this._array.forEach(e=>{e.layerCollection=this._layerCollection})}get splitScreen(){return this._splitScreen}set splitScreen(t){v(t,Fo),this._splitScreen=t,this._array.forEach(e=>{e.splitScreen=this._splitScreen})}add(t){const e=super.add(t);return e!==null&&(this._mapPointerListeners.push(t.pointerInteractionEvent.addEventListener(this.eventHandler.handleMapEvent.bind(this.eventHandler))),t.layerCollection=this._layerCollection,t.splitScreen=this._splitScreen,t.setTarget(this._target)),e}_remove(t){if(this._activeMap===t){if(this._cachedViewpoint=t.getViewPointSync(),this._target){const e=this._activeMap.className.split(".").pop();this._target.classList.remove(e)}this._activeMap=null}return this.has(t)&&(t.setTarget(null),t.splitScreen=null,t.layerCollection=new Te),super._remove(t)}_setActiveMapCSSClass(){if(this._target&&this._activeMap){const t=this._activeMap.className.split(".").pop();this._target.classList.add(t)}}setTarget(t){it(t,[String,HTMLElement]),this._target=typeof t=="string"?document.getElementById(t):t,this._array.forEach(e=>{e.setTarget(this._target)}),this._setActiveMapCSSClass()}_getFallbackMap(t){const{fallbackMap:e}=t;if(e){const s=this.getByKey(e);if(s&&s!==t)return s;Pt().warning(`the fallback map with the name: ${e} is missconfigured`)}return null}_getFallbackMapOrDefault(t){return this._getFallbackMap(t)||this.getByType("OpenlayersMap")[0]||this._array[0]}async setActiveMap(t){const e=this.getByKey(t);if(!e)return Pt("MapCollection").warning(`could not find map with name ${t}`),Promise.resolve();this._activeMap&&this._activeMap.className==="CesiumMap"&&e.className==="OpenlayersMap"&&await eS(this._activeMap,e);try{await e.initialize()}catch(r){Pt("MapCollection").error(r),this.remove(e);const n=this._getFallbackMapOrDefault(e);if(this.initializeError.raiseEvent({map:e,error:r}),n)return this.fallbackMapActivated.raiseEvent(e),this.setActiveMap(n.name);throw new Error("cannot activate a single map")}let s;if(this._activeMap||this._cachedViewpoint){if(this._activeMap===e)return e.activate();if(s=this._activeMap?await this._activeMap.getViewPoint():this._cachedViewpoint,!await e.canShowViewpoint(s)){const n=this._getFallbackMap(e);if(n)return this.fallbackMapActivated.raiseEvent(e),this.setActiveMap(n.name)}if(this._cachedViewpoint=null,this._activeMap&&(this._activeMap.deactivate(),this._target)){const n=this._activeMap.className.split(".").pop();this._target.classList.remove(n)}}return this._activeMap=e,await this._activeMap.activate(),this._setActiveMapCSSClass(),s&&await this._activeMap.gotoViewPoint(s),this.clippingObjectManager.mapActivated(e),this._splitScreen.mapActivated(e),this.mapActivated.raiseEvent(e),Promise.resolve()}getByType(t){return this._array.filter(e=>e.className===t)}destroy(){super.destroy(),[...this._layerCollection].forEach(t=>{t.destroy()}),this._layerCollection.destroy(),this.eventHandler.destroy(),this.mapActivated.destroy(),this.clippingObjectManager.destroy(),this.clippingObjectManager=null,this._splitScreen.destroy(),this._splitScreen=null,this.fallbackMapActivated.destroy(),this.initializeError.destroy(),this._mapPointerListeners.forEach(t=>{t()}),this._mapPointerListeners=[],this._target=null}}function _n(){return Pt("init")}const Sn=new Map;class iS{constructor(){this._id=Xt(),this._defaultDynamicContext=new bo({id:"_defaultDynamicContext"}),this._dynamicContext=this._defaultDynamicContext;const t=()=>this._dynamicContext.id;this._mapClassRegistry=new fe(ri),this._maps=ni(new Cn,t,null,pa.bind(null,this),Ee),this._layerClassRegistry=new fe(ot),this._layers=ni(this._maps.layerCollection,t,dh.bind(null,this),ya.bind(null,this),ht,fh),this._obliqueCollections=ni(new ve,t,null,e=>new Ne(e),Ne),this._viewPoints=ni(new ve,t,null,uh,oe),this._styleClassRegistry=new fe(ki),this._styles=ni(new ve,t,null,ge.bind(null,this._styleClassRegistry),ne),this._contexts=new Ci("id"),this._contexts.add(this._dynamicContext),this._categoryClassRegisty=new fe(zr),this._categories=new Ou(this),this._destroyed=new R,this._contextMutationPromise=Promise.resolve(),this._categoryItemClassRegistry=new fe(new be),this._tileProviderClassRegsitry=new fe(si),this._featureProviderClassRegsitry=new fe(kr),Sn.set(this._id,this)}get id(){return this._id}get maps(){return this._maps}get layers(){return this._layers}get obliqueCollections(){return this._obliqueCollections}get viewPoints(){return this._viewPoints}get styles(){return this._styles}get categories(){return this._categories}get destroyed(){return this._destroyed}get contextAdded(){return this._contexts.added}get contextRemoved(){return this._contexts.removed}get dynamicContextId(){return this._dynamicContext.id}get mapClassRegistry(){return this._mapClassRegistry}get layerClassRegistry(){return this._layerClassRegistry}get styleClassRegistry(){return this._styleClassRegistry}get categoryClassRegistry(){return this._categoryClassRegisty}get categoryItemClassRegistry(){return this._categoryItemClassRegistry}get tileProviderClassRegistry(){return this._tileProviderClassRegsitry}get featureProviderClassRegistry(){return this._featureProviderClassRegsitry}getContextById(t){return this._contexts.getByKey(t)}async _parseContext(t){const{config:e}=t;e.projection&&lh(e.projection),await this._styles.parseItems(e.styles,t.id),await this._layers.parseItems(e.layers,t.id),await this._obliqueCollections.parseItems(e.obliqueCollections,t.id),await this._viewPoints.parseItems(e.viewpoints,t.id),await this._maps.parseItems(e.maps,t.id),Array.isArray(e.categories)&&await Promise.all(e.categories.map(async({name:s,items:r})=>{await this._categories.parseCategoryItems(s,r,t.id)}))}async _setContextState(t){const{config:e}=t;[...this._layers].filter(r=>r[Lt]===t.id).forEach(r=>{r.activeOnStartup&&r.activate().catch(n=>{_n().error(`Failed to activate active on startup layer ${r.name}`),_n().error(n),this._layers.remove(r),r.destroy()})});const s=[...this._obliqueCollections].find(r=>r[Lt]===t.id&&r.activeOnStartup);if(s&&[...this._maps].filter(r=>r instanceof ae).forEach(r=>{r.setCollection(s)}),e.startingMapName?await this._maps.setActiveMap(e.startingMapName):!this._maps.activeMap&&this._maps.size>0&&await this._maps.setActiveMap([...this._maps][0].name),e.startingViewPointName&&this._maps.activeMap){const r=this._viewPoints.getByKey(e.startingViewPointName);r&&await this._maps.activeMap.gotoViewPoint(r)}}addContext(t){return v(t,bo),this._contextMutationPromise=this._contextMutationPromise.then(async()=>{if(this._contexts.has(t)){_n().info(`context with id ${t.id} already loaded`);return}await this._parseContext(t),await this._setContextState(t),this._contexts.add(t)}),this._contextMutationPromise}async _removeContext(t){await Promise.all([this._maps.removeContext(t),this._layers.removeContext(t),this._viewPoints.removeContext(t),this._styles.removeContext(t),this._obliqueCollections.removeContext(t)])}removeContext(t){return this._contextMutationPromise=this._contextMutationPromise.then(async()=>{const e=this._contexts.getByKey(t);if(!e){_n().info(`context with id ${t} has alread been removed`);return}await this._removeContext(t),this._contexts.remove(e)}),this._contextMutationPromise}destroy(){Object.defineProperty(this,"_contextMutationPromise",{get(){throw new Error("VcsApp was destroyed")}}),Sn.delete(this._id),me(this._maps),me(this._layers),me(this._obliqueCollections),me(this._viewPoints),me(this._styles),me(this._contexts),me(this._categories),this._mapClassRegistry.destroy(),this._layerClassRegistry.destroy(),this._styleClassRegistry.destroy(),this._categoryClassRegisty.destroy(),this._categoryItemClassRegistry.destroy(),this._tileProviderClassRegsitry.destroy(),this._featureProviderClassRegsitry.destroy(),this.destroyed.raiseEvent(),this.destroyed.destroy()}}function sS(i){return Sn.get(i)}window.vcs=window.vcs||{},window.vcs.apps=Sn;export{xi as AbstractFeatureProvider,_i as AbstractInteraction,ci as AltitudeModeCesium,xo as AppBackedCategory,Ws as BaseOLMap,kt as BitCounter,as as CameraLimiter,fn as CameraLimiterMode,De as Category,Ou as CategoryCollection,G as CesiumMap,We as CesiumTilesetCesiumImpl,Se as CesiumTilesetLayer,be as ClassRegistry,ui as ClassificationTypeCesium,Mi as ClippingObject,rd as ClippingObjectManager,D1 as ClusterContext,ve as Collection,bo as Context,Mn as CoordinateAtPixel,or as CzmlLayer,Fu as DataSourceCesiumImpl,wi as DataSourceLayer,at as DataState,Mt as DeclarativeStyleItem,fu as DefaultObliqueCollection,Du as EventHandler,k as EventType,Nh as ExclusiveManager,pt as Extent,Fe as Extent3D,Tu as FeatureAtPixelInteraction,_e as FeatureLayer,Nu as FeatureProviderInteraction,os as FeatureStoreLayer,Wu as FeatureStoreLayerChanges,vi as FeatureStoreLayerState,qr as FeatureVisibility,W as FeatureVisibilityAction,ls as GeoJSONLayer,Oh as GlobalHider,Ci as IndexedCollection,Lu as InteractionChain,ht as Layer,Te as LayerCollection,Ue as LayerImplementation,Kc as LayerObliqueImpl,Ys as LayerOpenlayersImpl,Q as LayerState,cr as MVTTileProvider,Cn as MapCollection,Jt as MapState,lt as ModificationKeyType,Ne as ObliqueCollection,go as ObliqueDataSet,cn as ObliqueImage,Ks as ObliqueImageMeta,ae as ObliqueMap,mu as ObliqueProvider,su as ObliqueView,ut as ObliqueViewDirection,Ca as OlcsGeometryType,Ru as OpenStreetMapCesiumImpl,hs as OpenStreetMapLayer,Yu as OpenStreetMapOpenlayersImpl,tt as OpenlayersMap,fe as OverrideClassRegistry,va as PatternType,cs as PointCloudLayer,zt as PointerEventType,mt as PointerKeyType,T as Projection,jt as RasterLayer,Si as RasterLayerCesiumImpl,rs as RasterLayerOpenlayersImpl,Au as SingleImageCesiumImpl,lr as SingleImageLayer,Xu as SingleImageOpenlayersImpl,Fo as SplitScreen,ur as StaticGeoJSONTileProvider,ne as StyleItem,ds as TMSLayer,Gu as TerrainCesiumImpl,us as TerrainLayer,G1 as TileDebugOpenlayersImpl,Wt as TileProvider,mn as TileProviderFeatureProvider,Le as TilingScheme,zu as TmsCesiumImpl,Zu as TmsOpenlayersImpl,hr as URLTemplateTileProvider,iS as VcsApp,R as VcsEvent,Ee as VcsMap,re as VcsObject,Vc as VectorCesiumImpl,Hc as VectorContext,Ct as VectorLayer,ho as VectorObliqueImpl,Xa as VectorOpenlayersImpl,te as VectorProperties,Vu as VectorRasterTileCesiumImpl,q as VectorStyleItem,Hu as VectorTileImageryProvider,fs as VectorTileLayer,Ju as VectorTileOpenlayersImpl,oe as ViewPoint,To as WFSLayer,Ye as WMSFeatureProvider,gs as WMSLayer,ms as WMTSLayer,Bu as WmsCesiumImpl,Ku as WmsOpenlayersImpl,Uu as WmtsCesiumImpl,Qu as WmtsOpenlayersImpl,Bs as actuallyIsCircle,Ji as addPrimitiveToContext,en as addPrimitivesToContext,Ve as alreadyTransformedToImage,Eh as alreadyTransformedToMercator,Gr as angleEqualsEpsilon,Vr as blackColor,ku as calculateMinLevel,ke as cartesian2DDistance,ml as cartesian3DDistance,zr as categoryClassRegistry,Pe as cesiumColorToColor,qe as cesiumTilesetLastUpdated,no as checkLineIntersection,Ba as circleFromCenterRadius,Tc as circleToCesium,ar as clearClippingPlanes,G0 as colorInCanvas,yh as combineFont,Lt as contextIdSymbol,jc as convert,Ua as convertGeometryToPolygon,$f as coordinateAtDistance,ma as coordinateEqualsEpsilon,ns as copyClippingPlanesToCollection,Rh as createClassificationPrimitive,Y1 as createClippingFeature,B1 as createClippingPlaneCollection,Na as createLinePrimitive,Gh as createOutlinePrimitive,ph as createPattern,Ah as createPrimitive,Lh as defaultDeclarativeStyle,$0 as defaultExtrudedHeightCondition,td as defaultPointCloudStyle,oi as defaultVectorStyle,ya as deserializeLayer,pa as deserializeMap,uh as deserializeViewPoint,me as destroyCollection,Ph as detectBrowserLocale,Ia as doNotTransform,La as embedIconsInStyle,z0 as emptyColor,Hr as emptyStyle,on as enforceEndingVertex,Cc as enforceRightHand,zi as featureExists,yn as featureFromOptions,kr as featureProviderClassRegistry,Qt as featureStoreStateSymbol,Ch as fromCesiumColor,mi as fvLastUpdated,Us as getAltitudeModeOptions,Fc as getBillboardOptions,$u as getCanvasFromFeatures,kc as getCartesian3AndWGS84FromCoordinates,Qr as getCartesian3Options,ai as getCesiumColor,Jr as getClassificationTypeOptions,X1 as getClippingOptions,k0 as getCssStyleFromTextStyle,Pa as getCurrentLocale,Q1 as getDayOfYear,K as getDefaultCondition,hh as getDefaultProjection,Sa as getDefaultVectorStyleItemOptions,e1 as getDirectionName,Mu as getEPSGCodeFromGeojson,Po as getExtentFromTileset,$r as getFillOptions,Yi as getFlatCoordinatesFromGeometry,Va as getFlatCoordinatesFromSimpleGeometry,Iu as getFormat,Ya as getGenericFeatureFromClickedObject,I1 as getGenericFeatureFromProvidedFeature,li as getGlobalHider,zh as getHeightAboveGround,yi as getHeightFromTerrainProvider,tn as getHeightInfo,K1 as getISODateString,qu as getJSONObjectFromObject,Rc as getLabelOptions,fh as getLayerIndex,Oa as getLocaleChangedEvent,Yc as getLongestSide,Fh as getMaterialAppearance,kh as getMinHeightOrGroundLevel,Ac as getModelOptions,Kr as getNearFarValueOptions,ge as getObjectFromClassRegistry,oo as getPolygonizedGeometry,ao as getResolutionOptions,Ma as getShapeFromOptions,Z1 as getShortLocaleDate,J1 as getShortLocaleTime,Qs as getStateFromStatesArray,Da as getStoreyHeights,Ra as getStoreyOptions,Rt as getStringColor,Hs as getStrokeOptions,qs as getStyleOrDefaultStyle,Zs as getStylesArray,Qi as getTerrainProviderForUrl,_h as getTextFromOptions,vh as getTextOptions,Eo as getTilingScheme,Lo as getURL,sS as getVcsAppById,co as getVersionFromImageJson,So as getViewDirectionFromViewPoint,Oo as getWMSSource,Xc as getZoom,Gt as globalHidden,Xi as globalHiderLastUpdated,j1 as globeLoaded,Wc as hasSameOrigin,mh as hexToOlColor,At as hidden,Nt as highlighted,Jc as imageGeometryToMercatorGeometry,Hf as initialBearingBetweenCoords,tS as isLeapYear,nr as isMobile,jr as isOverrideCollection,Pu as isProvidedFeature,sr as isSameOrigin,Bc as isTerrainTileAvailable,Io as isTiledFeature,ot as layerClassRegistry,to as lineStringToCesium,ni as makeOverrideCollection,ri as mapClassRegistry,Zc as mercatorGeometryToImageGeometry,F as mercatorProjection,rr as mercatorResolutionsToLevel,ua as mercatorToWgs84Transformer,Yr as obliqueGeometry,hn as obliqueViewDirectionNames,F0 as olColorToCesiumColor,_a as olColorToHex,Be as originalFeatureSymbol,pe as originalStyle,Zr as parseCartesian3,bt as parseColor,A0 as parseFont,Ie as parseGeoJSON,uo as parseImageData,tu as parseImageMeta,eu as parseLegacyImageData,Xr as parseNearFarScalar,di as parseStoreyHeights,eo as pointToCesium,Ja as polygonToCesium,ga as propertyEqualsEpsilon,pn as rectangleToExtent,pi as removeArrayFromCollection,qa as removeEndingVertex,Wa as removeEndingVertexFromGeometry,Zi as removeFeatureFromMap,iu as requestArrayBuffer,ye as requestJson,fo as requestUrl,dh as serializeLayer,Do as setClippingPlanes,B0 as setCurrentLocale,lh as setDefaultProjectionOptions,lo as setNewGeometry,$c as setReferenceForPicking,Sh as shapeCategory,Eu as showProvidedFeature,ro as sortRealWordEdgeCoordinates,ki as styleClassRegistry,bh as synchronizeFeatureVisibility,ln as synchronizeFeatureVisibilityWithSource,si as tileProviderClassRegistry,z1 as tiledLayerLoaded,ju as toContext,Uc as transformCWIFC,ts as transformFromImage,i1 as transformToImage,wc as updateFeatureVisibility,xc as updateGlobalHider,Cu as updateLegacyFeature,Lc as validateCircle,R0 as validateHexColor,Dc as validateLineString,Gc as validatePoint,Pc as validatePolygon,Fa as validateStoreys,z as vcsLayerName,Ea as vcsMetaVersion,Tt as vectorStyleSymbol,B as wgs84Projection,js as wgs84ToMercatorTransformer,Vs as whiteColor,x1 as writeGeoJSON,ss as writeGeoJSONFeature,Th as writeStyle};