/** * @license * Cesium - https://github.com/CesiumGS/cesium * Version 1.95 * * Copyright 2011-2022 Cesium Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Columbus View (Pat. Pend.) * * Portions licensed separately. * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details. */ !function (e, t) { "object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).Cesium = {}) }(this, (function (exports) { "use strict"; function appendForwardSlash(e) { return 0 !== e.length && "/" === e[e.length - 1] || (e = `${e}/`), e } function defined(e) { return null != e } function DeveloperError(e) { let t; this.name = "DeveloperError", this.message = e; try { throw new Error } catch (e) { t = e.stack } this.stack = t } defined(Object.create) && (DeveloperError.prototype = Object.create(Error.prototype), DeveloperError.prototype.constructor = DeveloperError), DeveloperError.prototype.toString = function () { let e = `${this.name}: ${this.message}`; return defined(this.stack) && (e += `\n${this.stack.toString()}`), e }, DeveloperError.throwInstantiationError = function () { throw new DeveloperError("This function defines an interface and should not be called directly.") }; const Check = {}; function getUndefinedErrorMessage(e) { return `${e} is required, actual value was undefined` } function getFailedTypeErrorMessage(e, t, n) { return `Expected ${n} to be typeof ${t}, actual typeof was ${e}` } function defaultValue(e, t) { return null != e ? e : t } Check.typeOf = {}, Check.defined = function (e, t) { if (!defined(t)) throw new DeveloperError(getUndefinedErrorMessage(e)) }, Check.typeOf.func = function (e, t) { if ("function" != typeof t) throw new DeveloperError(getFailedTypeErrorMessage(typeof t, "function", e)) }, Check.typeOf.string = function (e, t) { if ("string" != typeof t) throw new DeveloperError(getFailedTypeErrorMessage(typeof t, "string", e)) }, Check.typeOf.number = function (e, t) { if ("number" != typeof t) throw new DeveloperError(getFailedTypeErrorMessage(typeof t, "number", e)) }, Check.typeOf.number.lessThan = function (e, t, n) { if (Check.typeOf.number(e, t), t >= n) throw new DeveloperError(`Expected ${e} to be less than ${n}, actual value was ${t}`) }, Check.typeOf.number.lessThanOrEquals = function (e, t, n) { if (Check.typeOf.number(e, t), t > n) throw new DeveloperError(`Expected ${e} to be less than or equal to ${n}, actual value was ${t}`) }, Check.typeOf.number.greaterThan = function (e, t, n) { if (Check.typeOf.number(e, t), t <= n) throw new DeveloperError(`Expected ${e} to be greater than ${n}, actual value was ${t}`) }, Check.typeOf.number.greaterThanOrEquals = function (e, t, n) { if (Check.typeOf.number(e, t), t < n) throw new DeveloperError(`Expected ${e} to be greater than or equal to ${n}, actual value was ${t}`) }, Check.typeOf.object = function (e, t) { if ("object" != typeof t) throw new DeveloperError(getFailedTypeErrorMessage(typeof t, "object", e)) }, Check.typeOf.bool = function (e, t) { if ("boolean" != typeof t) throw new DeveloperError(getFailedTypeErrorMessage(typeof t, "boolean", e)) }, Check.typeOf.bigint = function (e, t) { if ("bigint" != typeof t) throw new DeveloperError(getFailedTypeErrorMessage(typeof t, "bigint", e)) }, Check.typeOf.number.equals = function (e, t, n, i) { if (Check.typeOf.number(e, n), Check.typeOf.number(t, i), n !== i) throw new DeveloperError(`${e} must be equal to ${t}, the actual values are ${n} and ${i}`) }, defaultValue.EMPTY_OBJECT = Object.freeze({}); var MersenneTwister = function (e) { null == e && (e = (new Date).getTime()), this.N = 624, this.M = 397, this.MATRIX_A = 2567483615, this.UPPER_MASK = 2147483648, this.LOWER_MASK = 2147483647, this.mt = new Array(this.N), this.mti = this.N + 1, e.constructor == Array ? this.init_by_array(e, e.length) : this.init_seed(e) }; MersenneTwister.prototype.init_seed = function (e) { for (this.mt[0] = e >>> 0, this.mti = 1; this.mti < this.N; this.mti++) { e = this.mt[this.mti - 1] ^ this.mt[this.mti - 1] >>> 30; this.mt[this.mti] = (1812433253 * ((4294901760 & e) >>> 16) << 16) + 1812433253 * (65535 & e) + this.mti, this.mt[this.mti] >>>= 0 } }, MersenneTwister.prototype.init_by_array = function (e, t) { var n, i, r; for (this.init_seed(19650218), n = 1, i = 0, r = this.N > t ? this.N : t; r; r--) { var o = this.mt[n - 1] ^ this.mt[n - 1] >>> 30; this.mt[n] = (this.mt[n] ^ (1664525 * ((4294901760 & o) >>> 16) << 16) + 1664525 * (65535 & o)) + e[i] + i, this.mt[n] >>>= 0, i++, ++n >= this.N && (this.mt[0] = this.mt[this.N - 1], n = 1), i >= t && (i = 0) } for (r = this.N - 1; r; r--) { o = this.mt[n - 1] ^ this.mt[n - 1] >>> 30; this.mt[n] = (this.mt[n] ^ (1566083941 * ((4294901760 & o) >>> 16) << 16) + 1566083941 * (65535 & o)) - n, this.mt[n] >>>= 0, ++n >= this.N && (this.mt[0] = this.mt[this.N - 1], n = 1) } this.mt[0] = 2147483648 }, MersenneTwister.prototype.random_int = function () { var e, t = new Array(0, this.MATRIX_A); if (this.mti >= this.N) { var n; for (this.mti == this.N + 1 && this.init_seed(5489), n = 0; n < this.N - this.M; n++) e = this.mt[n] & this.UPPER_MASK | this.mt[n + 1] & this.LOWER_MASK, this.mt[n] = this.mt[n + this.M] ^ e >>> 1 ^ t[1 & e]; for (; n < this.N - 1; n++) e = this.mt[n] & this.UPPER_MASK | this.mt[n + 1] & this.LOWER_MASK, this.mt[n] = this.mt[n + (this.M - this.N)] ^ e >>> 1 ^ t[1 & e]; e = this.mt[this.N - 1] & this.UPPER_MASK | this.mt[0] & this.LOWER_MASK, this.mt[this.N - 1] = this.mt[this.M - 1] ^ e >>> 1 ^ t[1 & e], this.mti = 0 } return e = this.mt[this.mti++], e ^= e >>> 11, e ^= e << 7 & 2636928640, e ^= e << 15 & 4022730752, (e ^= e >>> 18) >>> 0 }, MersenneTwister.prototype.random_int31 = function () { return this.random_int() >>> 1 }, MersenneTwister.prototype.random_incl = function () { return this.random_int() * (1 / 4294967295) }, MersenneTwister.prototype.random = function () { return this.random_int() * (1 / 4294967296) }, MersenneTwister.prototype.random_excl = function () { return (this.random_int() + .5) * (1 / 4294967296) }, MersenneTwister.prototype.random_long = function () { return (67108864 * (this.random_int() >>> 5) + (this.random_int() >>> 6)) * (1 / 9007199254740992) }; var mersenneTwister = MersenneTwister; const CesiumMath = { EPSILON1: .1, EPSILON2: .01, EPSILON3: .001, EPSILON4: 1e-4, EPSILON5: 1e-5, EPSILON6: 1e-6, EPSILON7: 1e-7, EPSILON8: 1e-8, EPSILON9: 1e-9, EPSILON10: 1e-10, EPSILON11: 1e-11, EPSILON12: 1e-12, EPSILON13: 1e-13, EPSILON14: 1e-14, EPSILON15: 1e-15, EPSILON16: 1e-16, EPSILON17: 1e-17, EPSILON18: 1e-18, EPSILON19: 1e-19, EPSILON20: 1e-20, EPSILON21: 1e-21, GRAVITATIONALPARAMETER: 3986004418e5, SOLAR_RADIUS: 6955e5, LUNAR_RADIUS: 1737400, SIXTY_FOUR_KILOBYTES: 65536, FOUR_GIGABYTES: 4294967296 }; CesiumMath.sign = defaultValue(Math.sign, (function (e) { return 0 === (e = +e) || e != e ? e : e > 0 ? 1 : -1 })), CesiumMath.signNotZero = function (e) { return e < 0 ? -1 : 1 }, CesiumMath.toSNorm = function (e, t) { return t = defaultValue(t, 255), Math.round((.5 * CesiumMath.clamp(e, -1, 1) + .5) * t) }, CesiumMath.fromSNorm = function (e, t) { return t = defaultValue(t, 255), CesiumMath.clamp(e, 0, t) / t * 2 - 1 }, CesiumMath.normalize = function (e, t, n) { return 0 === (n = Math.max(n - t, 0)) ? 0 : CesiumMath.clamp((e - t) / n, 0, 1) }, CesiumMath.sinh = defaultValue(Math.sinh, (function (e) { return (Math.exp(e) - Math.exp(-e)) / 2 })), CesiumMath.cosh = defaultValue(Math.cosh, (function (e) { return (Math.exp(e) + Math.exp(-e)) / 2 })), CesiumMath.lerp = function (e, t, n) { return (1 - n) * e + n * t }, CesiumMath.PI = Math.PI, CesiumMath.ONE_OVER_PI = 1 / Math.PI, CesiumMath.PI_OVER_TWO = Math.PI / 2, CesiumMath.PI_OVER_THREE = Math.PI / 3, CesiumMath.PI_OVER_FOUR = Math.PI / 4, CesiumMath.PI_OVER_SIX = Math.PI / 6, CesiumMath.THREE_PI_OVER_TWO = 3 * Math.PI / 2, CesiumMath.TWO_PI = 2 * Math.PI, CesiumMath.ONE_OVER_TWO_PI = 1 / (2 * Math.PI), CesiumMath.RADIANS_PER_DEGREE = Math.PI / 180, CesiumMath.DEGREES_PER_RADIAN = 180 / Math.PI, CesiumMath.RADIANS_PER_ARCSECOND = CesiumMath.RADIANS_PER_DEGREE / 3600, CesiumMath.toRadians = function (e) { return e * CesiumMath.RADIANS_PER_DEGREE }, CesiumMath.toDegrees = function (e) { return e * CesiumMath.DEGREES_PER_RADIAN }, CesiumMath.convertLongitudeRange = function (e) { const t = CesiumMath.TWO_PI, n = e - Math.floor(e / t) * t; return n < -Math.PI ? n + t : n >= Math.PI ? n - t : n }, CesiumMath.clampToLatitudeRange = function (e) { return CesiumMath.clamp(e, -1 * CesiumMath.PI_OVER_TWO, CesiumMath.PI_OVER_TWO) }, CesiumMath.negativePiToPi = function (e) { return e >= -CesiumMath.PI && e <= CesiumMath.PI ? e : CesiumMath.zeroToTwoPi(e + CesiumMath.PI) - CesiumMath.PI }, CesiumMath.zeroToTwoPi = function (e) { if (e >= 0 && e <= CesiumMath.TWO_PI) return e; const t = CesiumMath.mod(e, CesiumMath.TWO_PI); return Math.abs(t) < CesiumMath.EPSILON14 && Math.abs(e) > CesiumMath.EPSILON14 ? CesiumMath.TWO_PI : t }, CesiumMath.mod = function (e, t) { return CesiumMath.sign(e) === CesiumMath.sign(t) && Math.abs(e) < Math.abs(t) ? e : (e % t + t) % t }, CesiumMath.equalsEpsilon = function (e, t, n, i) { n = defaultValue(n, 0), i = defaultValue(i, n); const r = Math.abs(e - t); return r <= i || r <= n * Math.max(Math.abs(e), Math.abs(t)) }, CesiumMath.lessThan = function (e, t, n) { return e - t < -n }, CesiumMath.lessThanOrEquals = function (e, t, n) { return e - t < n }, CesiumMath.greaterThan = function (e, t, n) { return e - t > n }, CesiumMath.greaterThanOrEquals = function (e, t, n) { return e - t > -n }; const factorials = [1]; CesiumMath.factorial = function (e) { const t = factorials.length; if (e >= t) { let n = factorials[t - 1]; for (let i = t; i <= e; i++) { const e = n * i; factorials.push(e), n = e } } return factorials[e] }, CesiumMath.incrementWrap = function (e, t, n) { return n = defaultValue(n, 0), ++e > t && (e = n), e }, CesiumMath.isPowerOfTwo = function (e) { return 0 !== e && 0 == (e & e - 1) }, CesiumMath.nextPowerOfTwo = function (e) { return --e, e |= e >> 1, e |= e >> 2, e |= e >> 4, e |= e >> 8, e |= e >> 16, ++e }, CesiumMath.previousPowerOfTwo = function (e) { return e |= e >> 1, e |= e >> 2, e |= e >> 4, e |= e >> 8, e |= e >> 16, e = ((e |= e >> 32) >>> 0) - (e >>> 1) }, CesiumMath.clamp = function (e, t, n) { return e < t ? t : e > n ? n : e }; let randomNumberGenerator$2 = new mersenneTwister; function Cartesian3(e, t, n) { this.x = defaultValue(e, 0), this.y = defaultValue(t, 0), this.z = defaultValue(n, 0) } CesiumMath.setRandomNumberSeed = function (e) { randomNumberGenerator$2 = new mersenneTwister(e) }, CesiumMath.nextRandomNumber = function () { return randomNumberGenerator$2.random() }, CesiumMath.randomBetween = function (e, t) { return CesiumMath.nextRandomNumber() * (t - e) + e }, CesiumMath.acosClamped = function (e) { return Math.acos(CesiumMath.clamp(e, -1, 1)) }, CesiumMath.asinClamped = function (e) { return Math.asin(CesiumMath.clamp(e, -1, 1)) }, CesiumMath.chordLength = function (e, t) { return 2 * t * Math.sin(.5 * e) }, CesiumMath.logBase = function (e, t) { return Math.log(e) / Math.log(t) }, CesiumMath.cbrt = defaultValue(Math.cbrt, (function (e) { const t = Math.pow(Math.abs(e), 1 / 3); return e < 0 ? -t : t })), CesiumMath.log2 = defaultValue(Math.log2, (function (e) { return Math.log(e) * Math.LOG2E })), CesiumMath.fog = function (e, t) { const n = e * t; return 1 - Math.exp(-n * n) }, CesiumMath.fastApproximateAtan = function (e) { return e * (-.1784 * Math.abs(e) - .0663 * e * e + 1.0301) }, CesiumMath.fastApproximateAtan2 = function (e, t) { let n, i = Math.abs(e); n = Math.abs(t); const r = Math.max(i, n); n = Math.min(i, n); const o = n / r; return i = CesiumMath.fastApproximateAtan(o), i = Math.abs(t) > Math.abs(e) ? CesiumMath.PI_OVER_TWO - i : i, i = e < 0 ? CesiumMath.PI - i : i, i = t < 0 ? -i : i, i }, Cartesian3.fromSpherical = function (e, t) { defined(t) || (t = new Cartesian3); const n = e.clock, i = e.cone, r = defaultValue(e.magnitude, 1), o = r * Math.sin(i); return t.x = o * Math.cos(n), t.y = o * Math.sin(n), t.z = r * Math.cos(i), t }, Cartesian3.fromElements = function (e, t, n, i) { return defined(i) ? (i.x = e, i.y = t, i.z = n, i) : new Cartesian3(e, t, n) }, Cartesian3.clone = function (e, t) { if (defined(e)) return defined(t) ? (t.x = e.x, t.y = e.y, t.z = e.z, t) : new Cartesian3(e.x, e.y, e.z) }, Cartesian3.fromCartesian4 = Cartesian3.clone, Cartesian3.packedLength = 3, Cartesian3.pack = function (e, t, n) { return n = defaultValue(n, 0), t[n++] = e.x, t[n++] = e.y, t[n] = e.z, t }, Cartesian3.unpack = function (e, t, n) { return t = defaultValue(t, 0), defined(n) || (n = new Cartesian3), n.x = e[t++], n.y = e[t++], n.z = e[t], n }, Cartesian3.packArray = function (e, t) { const n = e.length, i = 3 * n; defined(t) ? (Array.isArray(t) || t.length === i) && t.length !== i && (t.length = i) : t = new Array(i); for (let i = 0; i < n; ++i) Cartesian3.pack(e[i], t, 3 * i); return t }, Cartesian3.unpackArray = function (e, t) { const n = e.length; defined(t) ? t.length = n / 3 : t = new Array(n / 3); for (let i = 0; i < n; i += 3) { const n = i / 3; t[n] = Cartesian3.unpack(e, i, t[n]) } return t }, Cartesian3.fromArray = Cartesian3.unpack, Cartesian3.maximumComponent = function (e) { return Math.max(e.x, e.y, e.z) }, Cartesian3.minimumComponent = function (e) { return Math.min(e.x, e.y, e.z) }, Cartesian3.minimumByComponent = function (e, t, n) { return n.x = Math.min(e.x, t.x), n.y = Math.min(e.y, t.y), n.z = Math.min(e.z, t.z), n }, Cartesian3.maximumByComponent = function (e, t, n) { return n.x = Math.max(e.x, t.x), n.y = Math.max(e.y, t.y), n.z = Math.max(e.z, t.z), n }, Cartesian3.clamp = function (e, t, n, i) { const r = CesiumMath.clamp(e.x, t.x, n.x), o = CesiumMath.clamp(e.y, t.y, n.y), a = CesiumMath.clamp(e.z, t.z, n.z); return i.x = r, i.y = o, i.z = a, i }, Cartesian3.magnitudeSquared = function (e) { return e.x * e.x + e.y * e.y + e.z * e.z }, Cartesian3.magnitude = function (e) { return Math.sqrt(Cartesian3.magnitudeSquared(e)) }; const distanceScratch$3 = new Cartesian3; Cartesian3.distance = function (e, t) { return Cartesian3.subtract(e, t, distanceScratch$3), Cartesian3.magnitude(distanceScratch$3) }, Cartesian3.distanceSquared = function (e, t) { return Cartesian3.subtract(e, t, distanceScratch$3), Cartesian3.magnitudeSquared(distanceScratch$3) }, Cartesian3.normalize = function (e, t) { const n = Cartesian3.magnitude(e); return t.x = e.x / n, t.y = e.y / n, t.z = e.z / n, t }, Cartesian3.dot = function (e, t) { return e.x * t.x + e.y * t.y + e.z * t.z }, Cartesian3.multiplyComponents = function (e, t, n) { return n.x = e.x * t.x, n.y = e.y * t.y, n.z = e.z * t.z, n }, Cartesian3.divideComponents = function (e, t, n) { return n.x = e.x / t.x, n.y = e.y / t.y, n.z = e.z / t.z, n }, Cartesian3.add = function (e, t, n) { return n.x = e.x + t.x, n.y = e.y + t.y, n.z = e.z + t.z, n }, Cartesian3.subtract = function (e, t, n) { return n.x = e.x - t.x, n.y = e.y - t.y, n.z = e.z - t.z, n }, Cartesian3.multiplyByScalar = function (e, t, n) { return n.x = e.x * t, n.y = e.y * t, n.z = e.z * t, n }, Cartesian3.divideByScalar = function (e, t, n) { return n.x = e.x / t, n.y = e.y / t, n.z = e.z / t, n }, Cartesian3.negate = function (e, t) { return t.x = -e.x, t.y = -e.y, t.z = -e.z, t }, Cartesian3.abs = function (e, t) { return t.x = Math.abs(e.x), t.y = Math.abs(e.y), t.z = Math.abs(e.z), t }; const lerpScratch$3 = new Cartesian3; Cartesian3.lerp = function (e, t, n, i) { return Cartesian3.multiplyByScalar(t, n, lerpScratch$3), i = Cartesian3.multiplyByScalar(e, 1 - n, i), Cartesian3.add(lerpScratch$3, i, i) }; const angleBetweenScratch$1 = new Cartesian3, angleBetweenScratch2$1 = new Cartesian3; Cartesian3.angleBetween = function (e, t) { Cartesian3.normalize(e, angleBetweenScratch$1), Cartesian3.normalize(t, angleBetweenScratch2$1); const n = Cartesian3.dot(angleBetweenScratch$1, angleBetweenScratch2$1), i = Cartesian3.magnitude(Cartesian3.cross(angleBetweenScratch$1, angleBetweenScratch2$1, angleBetweenScratch$1)); return Math.atan2(i, n) }; const mostOrthogonalAxisScratch$2 = new Cartesian3; Cartesian3.mostOrthogonalAxis = function (e, t) { const n = Cartesian3.normalize(e, mostOrthogonalAxisScratch$2); return Cartesian3.abs(n, n), t = n.x <= n.y ? n.x <= n.z ? Cartesian3.clone(Cartesian3.UNIT_X, t) : Cartesian3.clone(Cartesian3.UNIT_Z, t) : n.y <= n.z ? Cartesian3.clone(Cartesian3.UNIT_Y, t) : Cartesian3.clone(Cartesian3.UNIT_Z, t) }, Cartesian3.projectVector = function (e, t, n) { const i = Cartesian3.dot(e, t) / Cartesian3.dot(t, t); return Cartesian3.multiplyByScalar(t, i, n) }, Cartesian3.equals = function (e, t) { return e === t || defined(e) && defined(t) && e.x === t.x && e.y === t.y && e.z === t.z }, Cartesian3.equalsArray = function (e, t, n) { return e.x === t[n] && e.y === t[n + 1] && e.z === t[n + 2] }, Cartesian3.equalsEpsilon = function (e, t, n, i) { return e === t || defined(e) && defined(t) && CesiumMath.equalsEpsilon(e.x, t.x, n, i) && CesiumMath.equalsEpsilon(e.y, t.y, n, i) && CesiumMath.equalsEpsilon(e.z, t.z, n, i) }, Cartesian3.cross = function (e, t, n) { const i = e.x, r = e.y, o = e.z, a = t.x, s = t.y, c = t.z, l = r * c - o * s, u = o * a - i * c, d = i * s - r * a; return n.x = l, n.y = u, n.z = d, n }, Cartesian3.midpoint = function (e, t, n) { return n.x = .5 * (e.x + t.x), n.y = .5 * (e.y + t.y), n.z = .5 * (e.z + t.z), n }, Cartesian3.fromDegrees = function (e, t, n, i, r) { return e = CesiumMath.toRadians(e), t = CesiumMath.toRadians(t), Cartesian3.fromRadians(e, t, n, i, r) }; let scratchN = new Cartesian3, scratchK = new Cartesian3; const wgs84RadiiSquared = new Cartesian3(40680631590769, 40680631590769, 40408299984661.445); Cartesian3.fromRadians = function (e, t, n, i, r) { n = defaultValue(n, 0); const o = defined(i) ? i.radiiSquared : wgs84RadiiSquared, a = Math.cos(t); scratchN.x = a * Math.cos(e), scratchN.y = a * Math.sin(e), scratchN.z = Math.sin(t), scratchN = Cartesian3.normalize(scratchN, scratchN), Cartesian3.multiplyComponents(o, scratchN, scratchK); const s = Math.sqrt(Cartesian3.dot(scratchN, scratchK)); return scratchK = Cartesian3.divideByScalar(scratchK, s, scratchK), scratchN = Cartesian3.multiplyByScalar(scratchN, n, scratchN), defined(r) || (r = new Cartesian3), Cartesian3.add(scratchK, scratchN, r) }, Cartesian3.fromDegreesArray = function (e, t, n) { const i = e.length; defined(n) ? n.length = i / 2 : n = new Array(i / 2); for (let r = 0; r < i; r += 2) { const i = e[r], o = e[r + 1], a = r / 2; n[a] = Cartesian3.fromDegrees(i, o, 0, t, n[a]) } return n }, Cartesian3.fromRadiansArray = function (e, t, n) { const i = e.length; defined(n) ? n.length = i / 2 : n = new Array(i / 2); for (let r = 0; r < i; r += 2) { const i = e[r], o = e[r + 1], a = r / 2; n[a] = Cartesian3.fromRadians(i, o, 0, t, n[a]) } return n }, Cartesian3.fromDegreesArrayHeights = function (e, t, n) { const i = e.length; defined(n) ? n.length = i / 3 : n = new Array(i / 3); for (let r = 0; r < i; r += 3) { const i = e[r], o = e[r + 1], a = e[r + 2], s = r / 3; n[s] = Cartesian3.fromDegrees(i, o, a, t, n[s]) } return n }, Cartesian3.fromRadiansArrayHeights = function (e, t, n) { const i = e.length; defined(n) ? n.length = i / 3 : n = new Array(i / 3); for (let r = 0; r < i; r += 3) { const i = e[r], o = e[r + 1], a = e[r + 2], s = r / 3; n[s] = Cartesian3.fromRadians(i, o, a, t, n[s]) } return n }, Cartesian3.ZERO = Object.freeze(new Cartesian3(0, 0, 0)), Cartesian3.ONE = Object.freeze(new Cartesian3(1, 1, 1)), Cartesian3.UNIT_X = Object.freeze(new Cartesian3(1, 0, 0)), Cartesian3.UNIT_Y = Object.freeze(new Cartesian3(0, 1, 0)), Cartesian3.UNIT_Z = Object.freeze(new Cartesian3(0, 0, 1)), Cartesian3.prototype.clone = function (e) { return Cartesian3.clone(this, e) }, Cartesian3.prototype.equals = function (e) { return Cartesian3.equals(this, e) }, Cartesian3.prototype.equalsEpsilon = function (e, t, n) { return Cartesian3.equalsEpsilon(this, e, t, n) }, Cartesian3.prototype.toString = function () { return `(${this.x}, ${this.y}, ${this.z})` }; const scaleToGeodeticSurfaceIntersection = new Cartesian3, scaleToGeodeticSurfaceGradient = new Cartesian3; function scaleToGeodeticSurface(e, t, n, i, r) { const o = e.x, a = e.y, s = e.z, c = t.x, l = t.y, u = t.z, d = o * o * c * c, h = a * a * l * l, p = s * s * u * u, f = d + h + p, m = Math.sqrt(1 / f), g = Cartesian3.multiplyByScalar(e, m, scaleToGeodeticSurfaceIntersection); if (f < i) return isFinite(m) ? Cartesian3.clone(g, r) : void 0; const _ = n.x, y = n.y, C = n.z, T = scaleToGeodeticSurfaceGradient; T.x = g.x * _ * 2, T.y = g.y * y * 2, T.z = g.z * C * 2; let S, A, v, x, b, E, P, D, M, w, I, R = (1 - m) * Cartesian3.magnitude(e) / (.5 * Cartesian3.magnitude(T)), O = 0; do { R -= O, v = 1 / (1 + R * _), x = 1 / (1 + R * y), b = 1 / (1 + R * C), E = v * v, P = x * x, D = b * b, M = E * v, w = P * x, I = D * b, S = d * E + h * P + p * D - 1, A = d * M * _ + h * w * y + p * I * C; O = S / (-2 * A) } while (Math.abs(S) > CesiumMath.EPSILON12); return defined(r) ? (r.x = o * v, r.y = a * x, r.z = s * b, r) : new Cartesian3(o * v, a * x, s * b) } function Cartographic(e, t, n) { this.longitude = defaultValue(e, 0), this.latitude = defaultValue(t, 0), this.height = defaultValue(n, 0) } Cartographic.fromRadians = function (e, t, n, i) { return n = defaultValue(n, 0), defined(i) ? (i.longitude = e, i.latitude = t, i.height = n, i) : new Cartographic(e, t, n) }, Cartographic.fromDegrees = function (e, t, n, i) { return e = CesiumMath.toRadians(e), t = CesiumMath.toRadians(t), Cartographic.fromRadians(e, t, n, i) }; const cartesianToCartographicN$1 = new Cartesian3, cartesianToCartographicP$1 = new Cartesian3, cartesianToCartographicH$1 = new Cartesian3, wgs84OneOverRadii = new Cartesian3(1 / 6378137, 1 / 6378137, 1 / 6356752.314245179), wgs84OneOverRadiiSquared = new Cartesian3(1 / 40680631590769, 1 / 40680631590769, 1 / 40408299984661.445), wgs84CenterToleranceSquared = CesiumMath.EPSILON1; function initialize$p(e, t, n, i) { t = defaultValue(t, 0), n = defaultValue(n, 0), i = defaultValue(i, 0), e._radii = new Cartesian3(t, n, i), e._radiiSquared = new Cartesian3(t * t, n * n, i * i), e._radiiToTheFourth = new Cartesian3(t * t * t * t, n * n * n * n, i * i * i * i), e._oneOverRadii = new Cartesian3(0 === t ? 0 : 1 / t, 0 === n ? 0 : 1 / n, 0 === i ? 0 : 1 / i), e._oneOverRadiiSquared = new Cartesian3(0 === t ? 0 : 1 / (t * t), 0 === n ? 0 : 1 / (n * n), 0 === i ? 0 : 1 / (i * i)), e._minimumRadius = Math.min(t, n, i), e._maximumRadius = Math.max(t, n, i), e._centerToleranceSquared = CesiumMath.EPSILON1, 0 !== e._radiiSquared.z && (e._squaredXOverSquaredZ = e._radiiSquared.x / e._radiiSquared.z) } function Ellipsoid(e, t, n) { this._radii = void 0, this._radiiSquared = void 0, this._radiiToTheFourth = void 0, this._oneOverRadii = void 0, this._oneOverRadiiSquared = void 0, this._minimumRadius = void 0, this._maximumRadius = void 0, this._centerToleranceSquared = void 0, this._squaredXOverSquaredZ = void 0, initialize$p(this, e, t, n) } Cartographic.fromCartesian = function (e, t, n) { const i = defined(t) ? t.oneOverRadii : wgs84OneOverRadii, r = defined(t) ? t.oneOverRadiiSquared : wgs84OneOverRadiiSquared, o = scaleToGeodeticSurface(e, i, r, defined(t) ? t._centerToleranceSquared : wgs84CenterToleranceSquared, cartesianToCartographicP$1); if (!defined(o)) return; let a = Cartesian3.multiplyComponents(o, r, cartesianToCartographicN$1); a = Cartesian3.normalize(a, a); const s = Cartesian3.subtract(e, o, cartesianToCartographicH$1), c = Math.atan2(a.y, a.x), l = Math.asin(a.z), u = CesiumMath.sign(Cartesian3.dot(s, e)) * Cartesian3.magnitude(s); return defined(n) ? (n.longitude = c, n.latitude = l, n.height = u, n) : new Cartographic(c, l, u) }, Cartographic.toCartesian = function (e, t, n) { return Cartesian3.fromRadians(e.longitude, e.latitude, e.height, t, n) }, Cartographic.clone = function (e, t) { if (defined(e)) return defined(t) ? (t.longitude = e.longitude, t.latitude = e.latitude, t.height = e.height, t) : new Cartographic(e.longitude, e.latitude, e.height) }, Cartographic.equals = function (e, t) { return e === t || defined(e) && defined(t) && e.longitude === t.longitude && e.latitude === t.latitude && e.height === t.height }, Cartographic.equalsEpsilon = function (e, t, n) { return n = defaultValue(n, 0), e === t || defined(e) && defined(t) && Math.abs(e.longitude - t.longitude) <= n && Math.abs(e.latitude - t.latitude) <= n && Math.abs(e.height - t.height) <= n }, Cartographic.ZERO = Object.freeze(new Cartographic(0, 0, 0)), Cartographic.prototype.clone = function (e) { return Cartographic.clone(this, e) }, Cartographic.prototype.equals = function (e) { return Cartographic.equals(this, e) }, Cartographic.prototype.equalsEpsilon = function (e, t) { return Cartographic.equalsEpsilon(this, e, t) }, Cartographic.prototype.toString = function () { return `(${this.longitude}, ${this.latitude}, ${this.height})` }, Object.defineProperties(Ellipsoid.prototype, { radii: { get: function () { return this._radii } }, radiiSquared: { get: function () { return this._radiiSquared } }, radiiToTheFourth: { get: function () { return this._radiiToTheFourth } }, oneOverRadii: { get: function () { return this._oneOverRadii } }, oneOverRadiiSquared: { get: function () { return this._oneOverRadiiSquared } }, minimumRadius: { get: function () { return this._minimumRadius } }, maximumRadius: { get: function () { return this._maximumRadius } } }), Ellipsoid.clone = function (e, t) { if (!defined(e)) return; const n = e._radii; return defined(t) ? (Cartesian3.clone(n, t._radii), Cartesian3.clone(e._radiiSquared, t._radiiSquared), Cartesian3.clone(e._radiiToTheFourth, t._radiiToTheFourth), Cartesian3.clone(e._oneOverRadii, t._oneOverRadii), Cartesian3.clone(e._oneOverRadiiSquared, t._oneOverRadiiSquared), t._minimumRadius = e._minimumRadius, t._maximumRadius = e._maximumRadius, t._centerToleranceSquared = e._centerToleranceSquared, t) : new Ellipsoid(n.x, n.y, n.z) }, Ellipsoid.fromCartesian3 = function (e, t) { return defined(t) || (t = new Ellipsoid), defined(e) ? (initialize$p(t, e.x, e.y, e.z), t) : t }, Ellipsoid.WGS84 = Object.freeze(new Ellipsoid(6378137, 6378137, 6356752.314245179)), Ellipsoid.UNIT_SPHERE = Object.freeze(new Ellipsoid(1, 1, 1)), Ellipsoid.MOON = Object.freeze(new Ellipsoid(CesiumMath.LUNAR_RADIUS, CesiumMath.LUNAR_RADIUS, CesiumMath.LUNAR_RADIUS)), Ellipsoid.prototype.clone = function (e) { return Ellipsoid.clone(this, e) }, Ellipsoid.packedLength = Cartesian3.packedLength, Ellipsoid.pack = function (e, t, n) { return n = defaultValue(n, 0), Cartesian3.pack(e._radii, t, n), t }, Ellipsoid.unpack = function (e, t, n) { t = defaultValue(t, 0); const i = Cartesian3.unpack(e, t); return Ellipsoid.fromCartesian3(i, n) }, Ellipsoid.prototype.geocentricSurfaceNormal = Cartesian3.normalize, Ellipsoid.prototype.geodeticSurfaceNormalCartographic = function (e, t) { const n = e.longitude, i = e.latitude, r = Math.cos(i), o = r * Math.cos(n), a = r * Math.sin(n), s = Math.sin(i); return defined(t) || (t = new Cartesian3), t.x = o, t.y = a, t.z = s, Cartesian3.normalize(t, t) }, Ellipsoid.prototype.geodeticSurfaceNormal = function (e, t) { if (!Cartesian3.equalsEpsilon(e, Cartesian3.ZERO, CesiumMath.EPSILON14)) return defined(t) || (t = new Cartesian3), t = Cartesian3.multiplyComponents(e, this._oneOverRadiiSquared, t), Cartesian3.normalize(t, t) }; const cartographicToCartesianNormal = new Cartesian3, cartographicToCartesianK = new Cartesian3; Ellipsoid.prototype.cartographicToCartesian = function (e, t) { const n = cartographicToCartesianNormal, i = cartographicToCartesianK; this.geodeticSurfaceNormalCartographic(e, n), Cartesian3.multiplyComponents(this._radiiSquared, n, i); const r = Math.sqrt(Cartesian3.dot(n, i)); return Cartesian3.divideByScalar(i, r, i), Cartesian3.multiplyByScalar(n, e.height, n), defined(t) || (t = new Cartesian3), Cartesian3.add(i, n, t) }, Ellipsoid.prototype.cartographicArrayToCartesianArray = function (e, t) { const n = e.length; defined(t) ? t.length = n : t = new Array(n); for (let i = 0; i < n; i++) t[i] = this.cartographicToCartesian(e[i], t[i]); return t }; const cartesianToCartographicN = new Cartesian3, cartesianToCartographicP = new Cartesian3, cartesianToCartographicH = new Cartesian3; Ellipsoid.prototype.cartesianToCartographic = function (e, t) { const n = this.scaleToGeodeticSurface(e, cartesianToCartographicP); if (!defined(n)) return; const i = this.geodeticSurfaceNormal(n, cartesianToCartographicN), r = Cartesian3.subtract(e, n, cartesianToCartographicH), o = Math.atan2(i.y, i.x), a = Math.asin(i.z), s = CesiumMath.sign(Cartesian3.dot(r, e)) * Cartesian3.magnitude(r); return defined(t) ? (t.longitude = o, t.latitude = a, t.height = s, t) : new Cartographic(o, a, s) }, Ellipsoid.prototype.cartesianArrayToCartographicArray = function (e, t) { const n = e.length; defined(t) ? t.length = n : t = new Array(n); for (let i = 0; i < n; ++i) t[i] = this.cartesianToCartographic(e[i], t[i]); return t }, Ellipsoid.prototype.scaleToGeodeticSurface = function (e, t) { return scaleToGeodeticSurface(e, this._oneOverRadii, this._oneOverRadiiSquared, this._centerToleranceSquared, t) }, Ellipsoid.prototype.scaleToGeocentricSurface = function (e, t) { defined(t) || (t = new Cartesian3); const n = e.x, i = e.y, r = e.z, o = this._oneOverRadiiSquared, a = 1 / Math.sqrt(n * n * o.x + i * i * o.y + r * r * o.z); return Cartesian3.multiplyByScalar(e, a, t) }, Ellipsoid.prototype.transformPositionToScaledSpace = function (e, t) { return defined(t) || (t = new Cartesian3), Cartesian3.multiplyComponents(e, this._oneOverRadii, t) }, Ellipsoid.prototype.transformPositionFromScaledSpace = function (e, t) { return defined(t) || (t = new Cartesian3), Cartesian3.multiplyComponents(e, this._radii, t) }, Ellipsoid.prototype.equals = function (e) { return this === e || defined(e) && Cartesian3.equals(this._radii, e._radii) }, Ellipsoid.prototype.toString = function () { return this._radii.toString() }, Ellipsoid.prototype.getSurfaceNormalIntersectionWithZAxis = function (e, t, n) { t = defaultValue(t, 0); const i = this._squaredXOverSquaredZ; if (defined(n) || (n = new Cartesian3), n.x = 0, n.y = 0, n.z = e.z * (1 - i), !(Math.abs(n.z) >= this._radii.z - t)) return n }; const abscissas = [.14887433898163, .43339539412925, .67940956829902, .86506336668898, .97390652851717, 0], weights = [.29552422471475, .26926671930999, .21908636251598, .14945134915058, .066671344308684, 0]; function gaussLegendreQuadrature(e, t, n) { const i = .5 * (t + e), r = .5 * (t - e); let o = 0; for (let e = 0; e < 5; e++) { const t = r * abscissas[e]; o += weights[e] * (n(i + t) + n(i - t)) } return o *= r, o } function GeographicProjection(e) { this._ellipsoid = defaultValue(e, Ellipsoid.WGS84), this._semimajorAxis = this._ellipsoid.maximumRadius, this._oneOverSemimajorAxis = 1 / this._semimajorAxis } Ellipsoid.prototype.surfaceArea = function (e) { const t = e.west; let n = e.east; const i = e.south, r = e.north; for (; n < t;) n += CesiumMath.TWO_PI; const o = this._radiiSquared, a = o.x, s = o.y, c = o.z, l = a * s; return gaussLegendreQuadrature(i, r, (function (e) { const i = Math.cos(e), r = Math.sin(e); return Math.cos(e) * gaussLegendreQuadrature(t, n, (function (e) { const t = Math.cos(e), n = Math.sin(e); return Math.sqrt(l * r * r + c * (s * t * t + a * n * n) * i * i) })) })) }, Object.defineProperties(GeographicProjection.prototype, { ellipsoid: { get: function () { return this._ellipsoid } } }), GeographicProjection.prototype.project = function (e, t) { const n = this._semimajorAxis, i = e.longitude * n, r = e.latitude * n, o = e.height; return defined(t) ? (t.x = i, t.y = r, t.z = o, t) : new Cartesian3(i, r, o) }, GeographicProjection.prototype.unproject = function (e, t) { const n = this._oneOverSemimajorAxis, i = e.x * n, r = e.y * n, o = e.z; return defined(t) ? (t.longitude = i, t.latitude = r, t.height = o, t) : new Cartographic(i, r, o) }; const Intersect = {OUTSIDE: -1, INTERSECTING: 0, INSIDE: 1}; var Intersect$1 = Object.freeze(Intersect); function Interval(e, t) { this.start = defaultValue(e, 0), this.stop = defaultValue(t, 0) } function Matrix3(e, t, n, i, r, o, a, s, c) { this[0] = defaultValue(e, 0), this[1] = defaultValue(i, 0), this[2] = defaultValue(a, 0), this[3] = defaultValue(t, 0), this[4] = defaultValue(r, 0), this[5] = defaultValue(s, 0), this[6] = defaultValue(n, 0), this[7] = defaultValue(o, 0), this[8] = defaultValue(c, 0) } Matrix3.packedLength = 9, Matrix3.pack = function (e, t, n) { return n = defaultValue(n, 0), t[n++] = e[0], t[n++] = e[1], t[n++] = e[2], t[n++] = e[3], t[n++] = e[4], t[n++] = e[5], t[n++] = e[6], t[n++] = e[7], t[n++] = e[8], t }, Matrix3.unpack = function (e, t, n) { return t = defaultValue(t, 0), defined(n) || (n = new Matrix3), n[0] = e[t++], n[1] = e[t++], n[2] = e[t++], n[3] = e[t++], n[4] = e[t++], n[5] = e[t++], n[6] = e[t++], n[7] = e[t++], n[8] = e[t++], n }, Matrix3.packArray = function (e, t) { const n = e.length, i = 9 * n; defined(t) ? (Array.isArray(t) || t.length === i) && t.length !== i && (t.length = i) : t = new Array(i); for (let i = 0; i < n; ++i) Matrix3.pack(e[i], t, 9 * i); return t }, Matrix3.unpackArray = function (e, t) { const n = e.length; defined(t) ? t.length = n / 9 : t = new Array(n / 9); for (let i = 0; i < n; i += 9) { const n = i / 9; t[n] = Matrix3.unpack(e, i, t[n]) } return t }, Matrix3.clone = function (e, t) { if (defined(e)) return defined(t) ? (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t) : new Matrix3(e[0], e[3], e[6], e[1], e[4], e[7], e[2], e[5], e[8]) }, Matrix3.fromArray = Matrix3.unpack, Matrix3.fromColumnMajorArray = function (e, t) { return Matrix3.clone(e, t) }, Matrix3.fromRowMajorArray = function (e, t) { return defined(t) ? (t[0] = e[0], t[1] = e[3], t[2] = e[6], t[3] = e[1], t[4] = e[4], t[5] = e[7], t[6] = e[2], t[7] = e[5], t[8] = e[8], t) : new Matrix3(e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8]) }, Matrix3.fromQuaternion = function (e, t) { const n = e.x * e.x, i = e.x * e.y, r = e.x * e.z, o = e.x * e.w, a = e.y * e.y, s = e.y * e.z, c = e.y * e.w, l = e.z * e.z, u = e.z * e.w, d = e.w * e.w, h = n - a - l + d, p = 2 * (i - u), f = 2 * (r + c), m = 2 * (i + u), g = -n + a - l + d, _ = 2 * (s - o), y = 2 * (r - c), C = 2 * (s + o), T = -n - a + l + d; return defined(t) ? (t[0] = h, t[1] = m, t[2] = y, t[3] = p, t[4] = g, t[5] = C, t[6] = f, t[7] = _, t[8] = T, t) : new Matrix3(h, p, f, m, g, _, y, C, T) }, Matrix3.fromHeadingPitchRoll = function (e, t) { const n = Math.cos(-e.pitch), i = Math.cos(-e.heading), r = Math.cos(e.roll), o = Math.sin(-e.pitch), a = Math.sin(-e.heading), s = Math.sin(e.roll), c = n * i, l = -r * a + s * o * i, u = s * a + r * o * i, d = n * a, h = r * i + s * o * a, p = -s * i + r * o * a, f = -o, m = s * n, g = r * n; return defined(t) ? (t[0] = c, t[1] = d, t[2] = f, t[3] = l, t[4] = h, t[5] = m, t[6] = u, t[7] = p, t[8] = g, t) : new Matrix3(c, l, u, d, h, p, f, m, g) }, Matrix3.fromScale = function (e, t) { return defined(t) ? (t[0] = e.x, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = e.y, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = e.z, t) : new Matrix3(e.x, 0, 0, 0, e.y, 0, 0, 0, e.z) }, Matrix3.fromUniformScale = function (e, t) { return defined(t) ? (t[0] = e, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = e, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = e, t) : new Matrix3(e, 0, 0, 0, e, 0, 0, 0, e) }, Matrix3.fromCrossProduct = function (e, t) { return defined(t) ? (t[0] = 0, t[1] = e.z, t[2] = -e.y, t[3] = -e.z, t[4] = 0, t[5] = e.x, t[6] = e.y, t[7] = -e.x, t[8] = 0, t) : new Matrix3(0, -e.z, e.y, e.z, 0, -e.x, -e.y, e.x, 0) }, Matrix3.fromRotationX = function (e, t) { const n = Math.cos(e), i = Math.sin(e); return defined(t) ? (t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = n, t[5] = i, t[6] = 0, t[7] = -i, t[8] = n, t) : new Matrix3(1, 0, 0, 0, n, -i, 0, i, n) }, Matrix3.fromRotationY = function (e, t) { const n = Math.cos(e), i = Math.sin(e); return defined(t) ? (t[0] = n, t[1] = 0, t[2] = -i, t[3] = 0, t[4] = 1, t[5] = 0, t[6] = i, t[7] = 0, t[8] = n, t) : new Matrix3(n, 0, i, 0, 1, 0, -i, 0, n) }, Matrix3.fromRotationZ = function (e, t) { const n = Math.cos(e), i = Math.sin(e); return defined(t) ? (t[0] = n, t[1] = i, t[2] = 0, t[3] = -i, t[4] = n, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = 1, t) : new Matrix3(n, -i, 0, i, n, 0, 0, 0, 1) }, Matrix3.toArray = function (e, t) { return defined(t) ? (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t) : [e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8]] }, Matrix3.getElementIndex = function (e, t) { return 3 * e + t }, Matrix3.getColumn = function (e, t, n) { const i = 3 * t, r = e[i], o = e[i + 1], a = e[i + 2]; return n.x = r, n.y = o, n.z = a, n }, Matrix3.setColumn = function (e, t, n, i) { const r = 3 * t; return (i = Matrix3.clone(e, i))[r] = n.x, i[r + 1] = n.y, i[r + 2] = n.z, i }, Matrix3.getRow = function (e, t, n) { const i = e[t], r = e[t + 3], o = e[t + 6]; return n.x = i, n.y = r, n.z = o, n }, Matrix3.setRow = function (e, t, n, i) { return (i = Matrix3.clone(e, i))[t] = n.x, i[t + 3] = n.y, i[t + 6] = n.z, i }; const scaleScratch1$2 = new Cartesian3; Matrix3.setScale = function (e, t, n) { const i = Matrix3.getScale(e, scaleScratch1$2), r = t.x / i.x, o = t.y / i.y, a = t.z / i.z; return n[0] = e[0] * r, n[1] = e[1] * r, n[2] = e[2] * r, n[3] = e[3] * o, n[4] = e[4] * o, n[5] = e[5] * o, n[6] = e[6] * a, n[7] = e[7] * a, n[8] = e[8] * a, n }; const scaleScratch2$2 = new Cartesian3; Matrix3.setUniformScale = function (e, t, n) { const i = Matrix3.getScale(e, scaleScratch2$2), r = t / i.x, o = t / i.y, a = t / i.z; return n[0] = e[0] * r, n[1] = e[1] * r, n[2] = e[2] * r, n[3] = e[3] * o, n[4] = e[4] * o, n[5] = e[5] * o, n[6] = e[6] * a, n[7] = e[7] * a, n[8] = e[8] * a, n }; const scratchColumn$2 = new Cartesian3; Matrix3.getScale = function (e, t) { return t.x = Cartesian3.magnitude(Cartesian3.fromElements(e[0], e[1], e[2], scratchColumn$2)), t.y = Cartesian3.magnitude(Cartesian3.fromElements(e[3], e[4], e[5], scratchColumn$2)), t.z = Cartesian3.magnitude(Cartesian3.fromElements(e[6], e[7], e[8], scratchColumn$2)), t }; const scaleScratch3$2 = new Cartesian3; Matrix3.getMaximumScale = function (e) { return Matrix3.getScale(e, scaleScratch3$2), Cartesian3.maximumComponent(scaleScratch3$2) }; const scaleScratch4$2 = new Cartesian3; Matrix3.setRotation = function (e, t, n) { const i = Matrix3.getScale(e, scaleScratch4$2); return n[0] = t[0] * i.x, n[1] = t[1] * i.x, n[2] = t[2] * i.x, n[3] = t[3] * i.y, n[4] = t[4] * i.y, n[5] = t[5] * i.y, n[6] = t[6] * i.z, n[7] = t[7] * i.z, n[8] = t[8] * i.z, n }; const scaleScratch5$2 = new Cartesian3; function computeFrobeniusNorm(e) { let t = 0; for (let n = 0; n < 9; ++n) { const i = e[n]; t += i * i } return Math.sqrt(t) } Matrix3.getRotation = function (e, t) { const n = Matrix3.getScale(e, scaleScratch5$2); return t[0] = e[0] / n.x, t[1] = e[1] / n.x, t[2] = e[2] / n.x, t[3] = e[3] / n.y, t[4] = e[4] / n.y, t[5] = e[5] / n.y, t[6] = e[6] / n.z, t[7] = e[7] / n.z, t[8] = e[8] / n.z, t }, Matrix3.multiply = function (e, t, n) { const i = e[0] * t[0] + e[3] * t[1] + e[6] * t[2], r = e[1] * t[0] + e[4] * t[1] + e[7] * t[2], o = e[2] * t[0] + e[5] * t[1] + e[8] * t[2], a = e[0] * t[3] + e[3] * t[4] + e[6] * t[5], s = e[1] * t[3] + e[4] * t[4] + e[7] * t[5], c = e[2] * t[3] + e[5] * t[4] + e[8] * t[5], l = e[0] * t[6] + e[3] * t[7] + e[6] * t[8], u = e[1] * t[6] + e[4] * t[7] + e[7] * t[8], d = e[2] * t[6] + e[5] * t[7] + e[8] * t[8]; return n[0] = i, n[1] = r, n[2] = o, n[3] = a, n[4] = s, n[5] = c, n[6] = l, n[7] = u, n[8] = d, n }, Matrix3.add = function (e, t, n) { return n[0] = e[0] + t[0], n[1] = e[1] + t[1], n[2] = e[2] + t[2], n[3] = e[3] + t[3], n[4] = e[4] + t[4], n[5] = e[5] + t[5], n[6] = e[6] + t[6], n[7] = e[7] + t[7], n[8] = e[8] + t[8], n }, Matrix3.subtract = function (e, t, n) { return n[0] = e[0] - t[0], n[1] = e[1] - t[1], n[2] = e[2] - t[2], n[3] = e[3] - t[3], n[4] = e[4] - t[4], n[5] = e[5] - t[5], n[6] = e[6] - t[6], n[7] = e[7] - t[7], n[8] = e[8] - t[8], n }, Matrix3.multiplyByVector = function (e, t, n) { const i = t.x, r = t.y, o = t.z, a = e[0] * i + e[3] * r + e[6] * o, s = e[1] * i + e[4] * r + e[7] * o, c = e[2] * i + e[5] * r + e[8] * o; return n.x = a, n.y = s, n.z = c, n }, Matrix3.multiplyByScalar = function (e, t, n) { return n[0] = e[0] * t, n[1] = e[1] * t, n[2] = e[2] * t, n[3] = e[3] * t, n[4] = e[4] * t, n[5] = e[5] * t, n[6] = e[6] * t, n[7] = e[7] * t, n[8] = e[8] * t, n }, Matrix3.multiplyByScale = function (e, t, n) { return n[0] = e[0] * t.x, n[1] = e[1] * t.x, n[2] = e[2] * t.x, n[3] = e[3] * t.y, n[4] = e[4] * t.y, n[5] = e[5] * t.y, n[6] = e[6] * t.z, n[7] = e[7] * t.z, n[8] = e[8] * t.z, n }, Matrix3.multiplyByUniformScale = function (e, t, n) { return n[0] = e[0] * t, n[1] = e[1] * t, n[2] = e[2] * t, n[3] = e[3] * t, n[4] = e[4] * t, n[5] = e[5] * t, n[6] = e[6] * t, n[7] = e[7] * t, n[8] = e[8] * t, n }, Matrix3.negate = function (e, t) { return t[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t[3] = -e[3], t[4] = -e[4], t[5] = -e[5], t[6] = -e[6], t[7] = -e[7], t[8] = -e[8], t }, Matrix3.transpose = function (e, t) { const n = e[0], i = e[3], r = e[6], o = e[1], a = e[4], s = e[7], c = e[2], l = e[5], u = e[8]; return t[0] = n, t[1] = i, t[2] = r, t[3] = o, t[4] = a, t[5] = s, t[6] = c, t[7] = l, t[8] = u, t }; const rowVal = [1, 0, 0], colVal = [2, 2, 1]; function offDiagonalFrobeniusNorm(e) { let t = 0; for (let n = 0; n < 3; ++n) { const i = e[Matrix3.getElementIndex(colVal[n], rowVal[n])]; t += 2 * i * i } return Math.sqrt(t) } function shurDecomposition(e, t) { const n = CesiumMath.EPSILON15; let i = 0, r = 1; for (let t = 0; t < 3; ++t) { const n = Math.abs(e[Matrix3.getElementIndex(colVal[t], rowVal[t])]); n > i && (r = t, i = n) } let o = 1, a = 0; const s = rowVal[r], c = colVal[r]; if (Math.abs(e[Matrix3.getElementIndex(c, s)]) > n) { const t = (e[Matrix3.getElementIndex(c, c)] - e[Matrix3.getElementIndex(s, s)]) / 2 / e[Matrix3.getElementIndex(c, s)]; let n; n = t < 0 ? -1 / (-t + Math.sqrt(1 + t * t)) : 1 / (t + Math.sqrt(1 + t * t)), o = 1 / Math.sqrt(1 + n * n), a = n * o } return (t = Matrix3.clone(Matrix3.IDENTITY, t))[Matrix3.getElementIndex(s, s)] = t[Matrix3.getElementIndex(c, c)] = o, t[Matrix3.getElementIndex(c, s)] = a, t[Matrix3.getElementIndex(s, c)] = -a, t } const jMatrix = new Matrix3, jMatrixTranspose = new Matrix3; Matrix3.computeEigenDecomposition = function (e, t) { const n = CesiumMath.EPSILON20; let i = 0, r = 0; defined(t) || (t = {}); const o = t.unitary = Matrix3.clone(Matrix3.IDENTITY, t.unitary), a = t.diagonal = Matrix3.clone(e, t.diagonal), s = n * computeFrobeniusNorm(a); for (; r < 10 && offDiagonalFrobeniusNorm(a) > s;) shurDecomposition(a, jMatrix), Matrix3.transpose(jMatrix, jMatrixTranspose), Matrix3.multiply(a, jMatrix, a), Matrix3.multiply(jMatrixTranspose, a, a), Matrix3.multiply(o, jMatrix, o), ++i > 2 && (++r, i = 0); return t }, Matrix3.abs = function (e, t) { return t[0] = Math.abs(e[0]), t[1] = Math.abs(e[1]), t[2] = Math.abs(e[2]), t[3] = Math.abs(e[3]), t[4] = Math.abs(e[4]), t[5] = Math.abs(e[5]), t[6] = Math.abs(e[6]), t[7] = Math.abs(e[7]), t[8] = Math.abs(e[8]), t }, Matrix3.determinant = function (e) { const t = e[0], n = e[3], i = e[6], r = e[1], o = e[4], a = e[7], s = e[2], c = e[5], l = e[8]; return t * (o * l - c * a) + r * (c * i - n * l) + s * (n * a - o * i) }, Matrix3.inverse = function (e, t) { const n = e[0], i = e[1], r = e[2], o = e[3], a = e[4], s = e[5], c = e[6], l = e[7], u = e[8], d = Matrix3.determinant(e); t[0] = a * u - l * s, t[1] = l * r - i * u, t[2] = i * s - a * r, t[3] = c * s - o * u, t[4] = n * u - c * r, t[5] = o * r - n * s, t[6] = o * l - c * a, t[7] = c * i - n * l, t[8] = n * a - o * i; const h = 1 / d; return Matrix3.multiplyByScalar(t, h, t) }; const scratchTransposeMatrix$1 = new Matrix3; function Cartesian4(e, t, n, i) { this.x = defaultValue(e, 0), this.y = defaultValue(t, 0), this.z = defaultValue(n, 0), this.w = defaultValue(i, 0) } Matrix3.inverseTranspose = function (e, t) { return Matrix3.inverse(Matrix3.transpose(e, scratchTransposeMatrix$1), t) }, Matrix3.equals = function (e, t) { return e === t || defined(e) && defined(t) && e[0] === t[0] && e[1] === t[1] && e[2] === t[2] && e[3] === t[3] && e[4] === t[4] && e[5] === t[5] && e[6] === t[6] && e[7] === t[7] && e[8] === t[8] }, Matrix3.equalsEpsilon = function (e, t, n) { return n = defaultValue(n, 0), e === t || defined(e) && defined(t) && Math.abs(e[0] - t[0]) <= n && Math.abs(e[1] - t[1]) <= n && Math.abs(e[2] - t[2]) <= n && Math.abs(e[3] - t[3]) <= n && Math.abs(e[4] - t[4]) <= n && Math.abs(e[5] - t[5]) <= n && Math.abs(e[6] - t[6]) <= n && Math.abs(e[7] - t[7]) <= n && Math.abs(e[8] - t[8]) <= n }, Matrix3.IDENTITY = Object.freeze(new Matrix3(1, 0, 0, 0, 1, 0, 0, 0, 1)), Matrix3.ZERO = Object.freeze(new Matrix3(0, 0, 0, 0, 0, 0, 0, 0, 0)), Matrix3.COLUMN0ROW0 = 0, Matrix3.COLUMN0ROW1 = 1, Matrix3.COLUMN0ROW2 = 2, Matrix3.COLUMN1ROW0 = 3, Matrix3.COLUMN1ROW1 = 4, Matrix3.COLUMN1ROW2 = 5, Matrix3.COLUMN2ROW0 = 6, Matrix3.COLUMN2ROW1 = 7, Matrix3.COLUMN2ROW2 = 8, Object.defineProperties(Matrix3.prototype, { length: { get: function () { return Matrix3.packedLength } } }), Matrix3.prototype.clone = function (e) { return Matrix3.clone(this, e) }, Matrix3.prototype.equals = function (e) { return Matrix3.equals(this, e) }, Matrix3.equalsArray = function (e, t, n) { return e[0] === t[n] && e[1] === t[n + 1] && e[2] === t[n + 2] && e[3] === t[n + 3] && e[4] === t[n + 4] && e[5] === t[n + 5] && e[6] === t[n + 6] && e[7] === t[n + 7] && e[8] === t[n + 8] }, Matrix3.prototype.equalsEpsilon = function (e, t) { return Matrix3.equalsEpsilon(this, e, t) }, Matrix3.prototype.toString = function () { return `(${this[0]}, ${this[3]}, ${this[6]})\n(${this[1]}, ${this[4]}, ${this[7]})\n(${this[2]}, ${this[5]}, ${this[8]})` }, Cartesian4.fromElements = function (e, t, n, i, r) { return defined(r) ? (r.x = e, r.y = t, r.z = n, r.w = i, r) : new Cartesian4(e, t, n, i) }, Cartesian4.fromColor = function (e, t) { return defined(t) ? (t.x = e.red, t.y = e.green, t.z = e.blue, t.w = e.alpha, t) : new Cartesian4(e.red, e.green, e.blue, e.alpha) }, Cartesian4.clone = function (e, t) { if (defined(e)) return defined(t) ? (t.x = e.x, t.y = e.y, t.z = e.z, t.w = e.w, t) : new Cartesian4(e.x, e.y, e.z, e.w) }, Cartesian4.packedLength = 4, Cartesian4.pack = function (e, t, n) { return n = defaultValue(n, 0), t[n++] = e.x, t[n++] = e.y, t[n++] = e.z, t[n] = e.w, t }, Cartesian4.unpack = function (e, t, n) { return t = defaultValue(t, 0), defined(n) || (n = new Cartesian4), n.x = e[t++], n.y = e[t++], n.z = e[t++], n.w = e[t], n }, Cartesian4.packArray = function (e, t) { const n = e.length, i = 4 * n; defined(t) ? (Array.isArray(t) || t.length === i) && t.length !== i && (t.length = i) : t = new Array(i); for (let i = 0; i < n; ++i) Cartesian4.pack(e[i], t, 4 * i); return t }, Cartesian4.unpackArray = function (e, t) { const n = e.length; defined(t) ? t.length = n / 4 : t = new Array(n / 4); for (let i = 0; i < n; i += 4) { const n = i / 4; t[n] = Cartesian4.unpack(e, i, t[n]) } return t }, Cartesian4.fromArray = Cartesian4.unpack, Cartesian4.maximumComponent = function (e) { return Math.max(e.x, e.y, e.z, e.w) }, Cartesian4.minimumComponent = function (e) { return Math.min(e.x, e.y, e.z, e.w) }, Cartesian4.minimumByComponent = function (e, t, n) { return n.x = Math.min(e.x, t.x), n.y = Math.min(e.y, t.y), n.z = Math.min(e.z, t.z), n.w = Math.min(e.w, t.w), n }, Cartesian4.maximumByComponent = function (e, t, n) { return n.x = Math.max(e.x, t.x), n.y = Math.max(e.y, t.y), n.z = Math.max(e.z, t.z), n.w = Math.max(e.w, t.w), n }, Cartesian4.clamp = function (e, t, n, i) { const r = CesiumMath.clamp(e.x, t.x, n.x), o = CesiumMath.clamp(e.y, t.y, n.y), a = CesiumMath.clamp(e.z, t.z, n.z), s = CesiumMath.clamp(e.w, t.w, n.w); return i.x = r, i.y = o, i.z = a, i.w = s, i }, Cartesian4.magnitudeSquared = function (e) { return e.x * e.x + e.y * e.y + e.z * e.z + e.w * e.w }, Cartesian4.magnitude = function (e) { return Math.sqrt(Cartesian4.magnitudeSquared(e)) }; const distanceScratch$2 = new Cartesian4; Cartesian4.distance = function (e, t) { return Cartesian4.subtract(e, t, distanceScratch$2), Cartesian4.magnitude(distanceScratch$2) }, Cartesian4.distanceSquared = function (e, t) { return Cartesian4.subtract(e, t, distanceScratch$2), Cartesian4.magnitudeSquared(distanceScratch$2) }, Cartesian4.normalize = function (e, t) { const n = Cartesian4.magnitude(e); return t.x = e.x / n, t.y = e.y / n, t.z = e.z / n, t.w = e.w / n, t }, Cartesian4.dot = function (e, t) { return e.x * t.x + e.y * t.y + e.z * t.z + e.w * t.w }, Cartesian4.multiplyComponents = function (e, t, n) { return n.x = e.x * t.x, n.y = e.y * t.y, n.z = e.z * t.z, n.w = e.w * t.w, n }, Cartesian4.divideComponents = function (e, t, n) { return n.x = e.x / t.x, n.y = e.y / t.y, n.z = e.z / t.z, n.w = e.w / t.w, n }, Cartesian4.add = function (e, t, n) { return n.x = e.x + t.x, n.y = e.y + t.y, n.z = e.z + t.z, n.w = e.w + t.w, n }, Cartesian4.subtract = function (e, t, n) { return n.x = e.x - t.x, n.y = e.y - t.y, n.z = e.z - t.z, n.w = e.w - t.w, n }, Cartesian4.multiplyByScalar = function (e, t, n) { return n.x = e.x * t, n.y = e.y * t, n.z = e.z * t, n.w = e.w * t, n }, Cartesian4.divideByScalar = function (e, t, n) { return n.x = e.x / t, n.y = e.y / t, n.z = e.z / t, n.w = e.w / t, n }, Cartesian4.negate = function (e, t) { return t.x = -e.x, t.y = -e.y, t.z = -e.z, t.w = -e.w, t }, Cartesian4.abs = function (e, t) { return t.x = Math.abs(e.x), t.y = Math.abs(e.y), t.z = Math.abs(e.z), t.w = Math.abs(e.w), t }; const lerpScratch$2 = new Cartesian4; Cartesian4.lerp = function (e, t, n, i) { return Cartesian4.multiplyByScalar(t, n, lerpScratch$2), i = Cartesian4.multiplyByScalar(e, 1 - n, i), Cartesian4.add(lerpScratch$2, i, i) }; const mostOrthogonalAxisScratch$1 = new Cartesian4; Cartesian4.mostOrthogonalAxis = function (e, t) { const n = Cartesian4.normalize(e, mostOrthogonalAxisScratch$1); return Cartesian4.abs(n, n), t = n.x <= n.y ? n.x <= n.z ? n.x <= n.w ? Cartesian4.clone(Cartesian4.UNIT_X, t) : Cartesian4.clone(Cartesian4.UNIT_W, t) : n.z <= n.w ? Cartesian4.clone(Cartesian4.UNIT_Z, t) : Cartesian4.clone(Cartesian4.UNIT_W, t) : n.y <= n.z ? n.y <= n.w ? Cartesian4.clone(Cartesian4.UNIT_Y, t) : Cartesian4.clone(Cartesian4.UNIT_W, t) : n.z <= n.w ? Cartesian4.clone(Cartesian4.UNIT_Z, t) : Cartesian4.clone(Cartesian4.UNIT_W, t) }, Cartesian4.equals = function (e, t) { return e === t || defined(e) && defined(t) && e.x === t.x && e.y === t.y && e.z === t.z && e.w === t.w }, Cartesian4.equalsArray = function (e, t, n) { return e.x === t[n] && e.y === t[n + 1] && e.z === t[n + 2] && e.w === t[n + 3] }, Cartesian4.equalsEpsilon = function (e, t, n, i) { return e === t || defined(e) && defined(t) && CesiumMath.equalsEpsilon(e.x, t.x, n, i) && CesiumMath.equalsEpsilon(e.y, t.y, n, i) && CesiumMath.equalsEpsilon(e.z, t.z, n, i) && CesiumMath.equalsEpsilon(e.w, t.w, n, i) }, Cartesian4.ZERO = Object.freeze(new Cartesian4(0, 0, 0, 0)), Cartesian4.ONE = Object.freeze(new Cartesian4(1, 1, 1, 1)), Cartesian4.UNIT_X = Object.freeze(new Cartesian4(1, 0, 0, 0)), Cartesian4.UNIT_Y = Object.freeze(new Cartesian4(0, 1, 0, 0)), Cartesian4.UNIT_Z = Object.freeze(new Cartesian4(0, 0, 1, 0)), Cartesian4.UNIT_W = Object.freeze(new Cartesian4(0, 0, 0, 1)), Cartesian4.prototype.clone = function (e) { return Cartesian4.clone(this, e) }, Cartesian4.prototype.equals = function (e) { return Cartesian4.equals(this, e) }, Cartesian4.prototype.equalsEpsilon = function (e, t, n) { return Cartesian4.equalsEpsilon(this, e, t, n) }, Cartesian4.prototype.toString = function () { return `(${this.x}, ${this.y}, ${this.z}, ${this.w})` }; const scratchF32Array = new Float32Array(1), scratchU8Array = new Uint8Array(scratchF32Array.buffer), testU32 = new Uint32Array([287454020]), testU8 = new Uint8Array(testU32.buffer), littleEndian = 68 === testU8[0]; function RuntimeError(e) { let t; this.name = "RuntimeError", this.message = e; try { throw new Error } catch (e) { t = e.stack } this.stack = t } function Matrix4(e, t, n, i, r, o, a, s, c, l, u, d, h, p, f, m) { this[0] = defaultValue(e, 0), this[1] = defaultValue(r, 0), this[2] = defaultValue(c, 0), this[3] = defaultValue(h, 0), this[4] = defaultValue(t, 0), this[5] = defaultValue(o, 0), this[6] = defaultValue(l, 0), this[7] = defaultValue(p, 0), this[8] = defaultValue(n, 0), this[9] = defaultValue(a, 0), this[10] = defaultValue(u, 0), this[11] = defaultValue(f, 0), this[12] = defaultValue(i, 0), this[13] = defaultValue(s, 0), this[14] = defaultValue(d, 0), this[15] = defaultValue(m, 0) } Cartesian4.packFloat = function (e, t) { return defined(t) || (t = new Cartesian4), scratchF32Array[0] = e, littleEndian ? (t.x = scratchU8Array[0], t.y = scratchU8Array[1], t.z = scratchU8Array[2], t.w = scratchU8Array[3]) : (t.x = scratchU8Array[3], t.y = scratchU8Array[2], t.z = scratchU8Array[1], t.w = scratchU8Array[0]), t }, Cartesian4.unpackFloat = function (e) { return littleEndian ? (scratchU8Array[0] = e.x, scratchU8Array[1] = e.y, scratchU8Array[2] = e.z, scratchU8Array[3] = e.w) : (scratchU8Array[0] = e.w, scratchU8Array[1] = e.z, scratchU8Array[2] = e.y, scratchU8Array[3] = e.x), scratchF32Array[0] }, defined(Object.create) && (RuntimeError.prototype = Object.create(Error.prototype), RuntimeError.prototype.constructor = RuntimeError), RuntimeError.prototype.toString = function () { let e = `${this.name}: ${this.message}`; return defined(this.stack) && (e += `\n${this.stack.toString()}`), e }, Matrix4.packedLength = 16, Matrix4.pack = function (e, t, n) { return n = defaultValue(n, 0), t[n++] = e[0], t[n++] = e[1], t[n++] = e[2], t[n++] = e[3], t[n++] = e[4], t[n++] = e[5], t[n++] = e[6], t[n++] = e[7], t[n++] = e[8], t[n++] = e[9], t[n++] = e[10], t[n++] = e[11], t[n++] = e[12], t[n++] = e[13], t[n++] = e[14], t[n] = e[15], t }, Matrix4.unpack = function (e, t, n) { return t = defaultValue(t, 0), defined(n) || (n = new Matrix4), n[0] = e[t++], n[1] = e[t++], n[2] = e[t++], n[3] = e[t++], n[4] = e[t++], n[5] = e[t++], n[6] = e[t++], n[7] = e[t++], n[8] = e[t++], n[9] = e[t++], n[10] = e[t++], n[11] = e[t++], n[12] = e[t++], n[13] = e[t++], n[14] = e[t++], n[15] = e[t], n }, Matrix4.packArray = function (e, t) { const n = e.length, i = 16 * n; defined(t) ? (Array.isArray(t) || t.length === i) && t.length !== i && (t.length = i) : t = new Array(i); for (let i = 0; i < n; ++i) Matrix4.pack(e[i], t, 16 * i); return t }, Matrix4.unpackArray = function (e, t) { const n = e.length; defined(t) ? t.length = n / 16 : t = new Array(n / 16); for (let i = 0; i < n; i += 16) { const n = i / 16; t[n] = Matrix4.unpack(e, i, t[n]) } return t }, Matrix4.clone = function (e, t) { if (defined(e)) return defined(t) ? (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t[9] = e[9], t[10] = e[10], t[11] = e[11], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15], t) : new Matrix4(e[0], e[4], e[8], e[12], e[1], e[5], e[9], e[13], e[2], e[6], e[10], e[14], e[3], e[7], e[11], e[15]) }, Matrix4.fromArray = Matrix4.unpack, Matrix4.fromColumnMajorArray = function (e, t) { return Matrix4.clone(e, t) }, Matrix4.fromRowMajorArray = function (e, t) { return defined(t) ? (t[0] = e[0], t[1] = e[4], t[2] = e[8], t[3] = e[12], t[4] = e[1], t[5] = e[5], t[6] = e[9], t[7] = e[13], t[8] = e[2], t[9] = e[6], t[10] = e[10], t[11] = e[14], t[12] = e[3], t[13] = e[7], t[14] = e[11], t[15] = e[15], t) : new Matrix4(e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15]) }, Matrix4.fromRotationTranslation = function (e, t, n) { return t = defaultValue(t, Cartesian3.ZERO), defined(n) ? (n[0] = e[0], n[1] = e[1], n[2] = e[2], n[3] = 0, n[4] = e[3], n[5] = e[4], n[6] = e[5], n[7] = 0, n[8] = e[6], n[9] = e[7], n[10] = e[8], n[11] = 0, n[12] = t.x, n[13] = t.y, n[14] = t.z, n[15] = 1, n) : new Matrix4(e[0], e[3], e[6], t.x, e[1], e[4], e[7], t.y, e[2], e[5], e[8], t.z, 0, 0, 0, 1) }, Matrix4.fromTranslationQuaternionRotationScale = function (e, t, n, i) { defined(i) || (i = new Matrix4); const r = n.x, o = n.y, a = n.z, s = t.x * t.x, c = t.x * t.y, l = t.x * t.z, u = t.x * t.w, d = t.y * t.y, h = t.y * t.z, p = t.y * t.w, f = t.z * t.z, m = t.z * t.w, g = t.w * t.w, _ = s - d - f + g, y = 2 * (c - m), C = 2 * (l + p), T = 2 * (c + m), S = -s + d - f + g, A = 2 * (h - u), v = 2 * (l - p), x = 2 * (h + u), b = -s - d + f + g; return i[0] = _ * r, i[1] = T * r, i[2] = v * r, i[3] = 0, i[4] = y * o, i[5] = S * o, i[6] = x * o, i[7] = 0, i[8] = C * a, i[9] = A * a, i[10] = b * a, i[11] = 0, i[12] = e.x, i[13] = e.y, i[14] = e.z, i[15] = 1, i }, Matrix4.fromTranslationRotationScale = function (e, t) { return Matrix4.fromTranslationQuaternionRotationScale(e.translation, e.rotation, e.scale, t) }, Matrix4.fromTranslation = function (e, t) { return Matrix4.fromRotationTranslation(Matrix3.IDENTITY, e, t) }, Matrix4.fromScale = function (e, t) { return defined(t) ? (t[0] = e.x, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = e.y, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = e.z, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t) : new Matrix4(e.x, 0, 0, 0, 0, e.y, 0, 0, 0, 0, e.z, 0, 0, 0, 0, 1) }, Matrix4.fromUniformScale = function (e, t) { return defined(t) ? (t[0] = e, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = e, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = e, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t) : new Matrix4(e, 0, 0, 0, 0, e, 0, 0, 0, 0, e, 0, 0, 0, 0, 1) }, Matrix4.fromRotation = function (e, t) { return defined(t) || (t = new Matrix4), t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = 0, t[4] = e[3], t[5] = e[4], t[6] = e[5], t[7] = 0, t[8] = e[6], t[9] = e[7], t[10] = e[8], t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t }; const fromCameraF = new Cartesian3, fromCameraR = new Cartesian3, fromCameraU = new Cartesian3; Matrix4.fromCamera = function (e, t) { const n = e.position, i = e.direction, r = e.up; Cartesian3.normalize(i, fromCameraF), Cartesian3.normalize(Cartesian3.cross(fromCameraF, r, fromCameraR), fromCameraR), Cartesian3.normalize(Cartesian3.cross(fromCameraR, fromCameraF, fromCameraU), fromCameraU); const o = fromCameraR.x, a = fromCameraR.y, s = fromCameraR.z, c = fromCameraF.x, l = fromCameraF.y, u = fromCameraF.z, d = fromCameraU.x, h = fromCameraU.y, p = fromCameraU.z, f = n.x, m = n.y, g = n.z, _ = o * -f + a * -m + s * -g, y = d * -f + h * -m + p * -g, C = c * f + l * m + u * g; return defined(t) ? (t[0] = o, t[1] = d, t[2] = -c, t[3] = 0, t[4] = a, t[5] = h, t[6] = -l, t[7] = 0, t[8] = s, t[9] = p, t[10] = -u, t[11] = 0, t[12] = _, t[13] = y, t[14] = C, t[15] = 1, t) : new Matrix4(o, a, s, _, d, h, p, y, -c, -l, -u, C, 0, 0, 0, 1) }, Matrix4.computePerspectiveFieldOfView = function (e, t, n, i, r) { const o = 1 / Math.tan(.5 * e), a = o / t, s = (i + n) / (n - i), c = 2 * i * n / (n - i); return r[0] = a, r[1] = 0, r[2] = 0, r[3] = 0, r[4] = 0, r[5] = o, r[6] = 0, r[7] = 0, r[8] = 0, r[9] = 0, r[10] = s, r[11] = -1, r[12] = 0, r[13] = 0, r[14] = c, r[15] = 0, r }, Matrix4.computeOrthographicOffCenter = function (e, t, n, i, r, o, a) { let s = 1 / (t - e), c = 1 / (i - n), l = 1 / (o - r); const u = -(t + e) * s, d = -(i + n) * c, h = -(o + r) * l; return s *= 2, c *= 2, l *= -2, a[0] = s, a[1] = 0, a[2] = 0, a[3] = 0, a[4] = 0, a[5] = c, a[6] = 0, a[7] = 0, a[8] = 0, a[9] = 0, a[10] = l, a[11] = 0, a[12] = u, a[13] = d, a[14] = h, a[15] = 1, a }, Matrix4.computePerspectiveOffCenter = function (e, t, n, i, r, o, a) { const s = 2 * r / (t - e), c = 2 * r / (i - n), l = (t + e) / (t - e), u = (i + n) / (i - n), d = -(o + r) / (o - r), h = -2 * o * r / (o - r); return a[0] = s, a[1] = 0, a[2] = 0, a[3] = 0, a[4] = 0, a[5] = c, a[6] = 0, a[7] = 0, a[8] = l, a[9] = u, a[10] = d, a[11] = -1, a[12] = 0, a[13] = 0, a[14] = h, a[15] = 0, a }, Matrix4.computeInfinitePerspectiveOffCenter = function (e, t, n, i, r, o) { const a = 2 * r / (t - e), s = 2 * r / (i - n), c = (t + e) / (t - e), l = (i + n) / (i - n), u = -2 * r; return o[0] = a, o[1] = 0, o[2] = 0, o[3] = 0, o[4] = 0, o[5] = s, o[6] = 0, o[7] = 0, o[8] = c, o[9] = l, o[10] = -1, o[11] = -1, o[12] = 0, o[13] = 0, o[14] = u, o[15] = 0, o }, Matrix4.computeViewportTransformation = function (e, t, n, i) { defined(i) || (i = new Matrix4), e = defaultValue(e, defaultValue.EMPTY_OBJECT); const r = defaultValue(e.x, 0), o = defaultValue(e.y, 0), a = defaultValue(e.width, 0), s = defaultValue(e.height, 0); t = defaultValue(t, 0); const c = .5 * a, l = .5 * s, u = .5 * ((n = defaultValue(n, 1)) - t), d = c, h = l, p = u, f = r + c, m = o + l, g = t + u; return i[0] = d, i[1] = 0, i[2] = 0, i[3] = 0, i[4] = 0, i[5] = h, i[6] = 0, i[7] = 0, i[8] = 0, i[9] = 0, i[10] = p, i[11] = 0, i[12] = f, i[13] = m, i[14] = g, i[15] = 1, i }, Matrix4.computeView = function (e, t, n, i, r) { return r[0] = i.x, r[1] = n.x, r[2] = -t.x, r[3] = 0, r[4] = i.y, r[5] = n.y, r[6] = -t.y, r[7] = 0, r[8] = i.z, r[9] = n.z, r[10] = -t.z, r[11] = 0, r[12] = -Cartesian3.dot(i, e), r[13] = -Cartesian3.dot(n, e), r[14] = Cartesian3.dot(t, e), r[15] = 1, r }, Matrix4.toArray = function (e, t) { return defined(t) ? (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t[9] = e[9], t[10] = e[10], t[11] = e[11], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15], t) : [e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15]] }, Matrix4.getElementIndex = function (e, t) { return 4 * e + t }, Matrix4.getColumn = function (e, t, n) { const i = 4 * t, r = e[i], o = e[i + 1], a = e[i + 2], s = e[i + 3]; return n.x = r, n.y = o, n.z = a, n.w = s, n }, Matrix4.setColumn = function (e, t, n, i) { const r = 4 * t; return (i = Matrix4.clone(e, i))[r] = n.x, i[r + 1] = n.y, i[r + 2] = n.z, i[r + 3] = n.w, i }, Matrix4.getRow = function (e, t, n) { const i = e[t], r = e[t + 4], o = e[t + 8], a = e[t + 12]; return n.x = i, n.y = r, n.z = o, n.w = a, n }, Matrix4.setRow = function (e, t, n, i) { return (i = Matrix4.clone(e, i))[t] = n.x, i[t + 4] = n.y, i[t + 8] = n.z, i[t + 12] = n.w, i }, Matrix4.setTranslation = function (e, t, n) { return n[0] = e[0], n[1] = e[1], n[2] = e[2], n[3] = e[3], n[4] = e[4], n[5] = e[5], n[6] = e[6], n[7] = e[7], n[8] = e[8], n[9] = e[9], n[10] = e[10], n[11] = e[11], n[12] = t.x, n[13] = t.y, n[14] = t.z, n[15] = e[15], n }; const scaleScratch1$1 = new Cartesian3; Matrix4.setScale = function (e, t, n) { const i = Matrix4.getScale(e, scaleScratch1$1), r = t.x / i.x, o = t.y / i.y, a = t.z / i.z; return n[0] = e[0] * r, n[1] = e[1] * r, n[2] = e[2] * r, n[3] = e[3], n[4] = e[4] * o, n[5] = e[5] * o, n[6] = e[6] * o, n[7] = e[7], n[8] = e[8] * a, n[9] = e[9] * a, n[10] = e[10] * a, n[11] = e[11], n[12] = e[12], n[13] = e[13], n[14] = e[14], n[15] = e[15], n }; const scaleScratch2$1 = new Cartesian3; Matrix4.setUniformScale = function (e, t, n) { const i = Matrix4.getScale(e, scaleScratch2$1), r = t / i.x, o = t / i.y, a = t / i.z; return n[0] = e[0] * r, n[1] = e[1] * r, n[2] = e[2] * r, n[3] = e[3], n[4] = e[4] * o, n[5] = e[5] * o, n[6] = e[6] * o, n[7] = e[7], n[8] = e[8] * a, n[9] = e[9] * a, n[10] = e[10] * a, n[11] = e[11], n[12] = e[12], n[13] = e[13], n[14] = e[14], n[15] = e[15], n }; const scratchColumn$1 = new Cartesian3; Matrix4.getScale = function (e, t) { return t.x = Cartesian3.magnitude(Cartesian3.fromElements(e[0], e[1], e[2], scratchColumn$1)), t.y = Cartesian3.magnitude(Cartesian3.fromElements(e[4], e[5], e[6], scratchColumn$1)), t.z = Cartesian3.magnitude(Cartesian3.fromElements(e[8], e[9], e[10], scratchColumn$1)), t }; const scaleScratch3$1 = new Cartesian3; Matrix4.getMaximumScale = function (e) { return Matrix4.getScale(e, scaleScratch3$1), Cartesian3.maximumComponent(scaleScratch3$1) }; const scaleScratch4$1 = new Cartesian3; Matrix4.setRotation = function (e, t, n) { const i = Matrix4.getScale(e, scaleScratch4$1); return n[0] = t[0] * i.x, n[1] = t[1] * i.x, n[2] = t[2] * i.x, n[3] = e[3], n[4] = t[3] * i.y, n[5] = t[4] * i.y, n[6] = t[5] * i.y, n[7] = e[7], n[8] = t[6] * i.z, n[9] = t[7] * i.z, n[10] = t[8] * i.z, n[11] = e[11], n[12] = e[12], n[13] = e[13], n[14] = e[14], n[15] = e[15], n }; const scaleScratch5$1 = new Cartesian3; Matrix4.getRotation = function (e, t) { const n = Matrix4.getScale(e, scaleScratch5$1); return t[0] = e[0] / n.x, t[1] = e[1] / n.x, t[2] = e[2] / n.x, t[3] = e[4] / n.y, t[4] = e[5] / n.y, t[5] = e[6] / n.y, t[6] = e[8] / n.z, t[7] = e[9] / n.z, t[8] = e[10] / n.z, t }, Matrix4.multiply = function (e, t, n) { const i = e[0], r = e[1], o = e[2], a = e[3], s = e[4], c = e[5], l = e[6], u = e[7], d = e[8], h = e[9], p = e[10], f = e[11], m = e[12], g = e[13], _ = e[14], y = e[15], C = t[0], T = t[1], S = t[2], A = t[3], v = t[4], x = t[5], b = t[6], E = t[7], P = t[8], D = t[9], M = t[10], w = t[11], I = t[12], R = t[13], O = t[14], B = t[15], L = i * C + s * T + d * S + m * A, F = r * C + c * T + h * S + g * A, N = o * C + l * T + p * S + _ * A, V = a * C + u * T + f * S + y * A, $ = i * v + s * x + d * b + m * E, k = r * v + c * x + h * b + g * E, U = o * v + l * x + p * b + _ * E, G = a * v + u * x + f * b + y * E, z = i * P + s * D + d * M + m * w, H = r * P + c * D + h * M + g * w, W = o * P + l * D + p * M + _ * w, q = a * P + u * D + f * M + y * w, j = i * I + s * R + d * O + m * B, X = r * I + c * R + h * O + g * B, Y = o * I + l * R + p * O + _ * B, K = a * I + u * R + f * O + y * B; return n[0] = L, n[1] = F, n[2] = N, n[3] = V, n[4] = $, n[5] = k, n[6] = U, n[7] = G, n[8] = z, n[9] = H, n[10] = W, n[11] = q, n[12] = j, n[13] = X, n[14] = Y, n[15] = K, n }, Matrix4.add = function (e, t, n) { return n[0] = e[0] + t[0], n[1] = e[1] + t[1], n[2] = e[2] + t[2], n[3] = e[3] + t[3], n[4] = e[4] + t[4], n[5] = e[5] + t[5], n[6] = e[6] + t[6], n[7] = e[7] + t[7], n[8] = e[8] + t[8], n[9] = e[9] + t[9], n[10] = e[10] + t[10], n[11] = e[11] + t[11], n[12] = e[12] + t[12], n[13] = e[13] + t[13], n[14] = e[14] + t[14], n[15] = e[15] + t[15], n }, Matrix4.subtract = function (e, t, n) { return n[0] = e[0] - t[0], n[1] = e[1] - t[1], n[2] = e[2] - t[2], n[3] = e[3] - t[3], n[4] = e[4] - t[4], n[5] = e[5] - t[5], n[6] = e[6] - t[6], n[7] = e[7] - t[7], n[8] = e[8] - t[8], n[9] = e[9] - t[9], n[10] = e[10] - t[10], n[11] = e[11] - t[11], n[12] = e[12] - t[12], n[13] = e[13] - t[13], n[14] = e[14] - t[14], n[15] = e[15] - t[15], n }, Matrix4.multiplyTransformation = function (e, t, n) { const i = e[0], r = e[1], o = e[2], a = e[4], s = e[5], c = e[6], l = e[8], u = e[9], d = e[10], h = e[12], p = e[13], f = e[14], m = t[0], g = t[1], _ = t[2], y = t[4], C = t[5], T = t[6], S = t[8], A = t[9], v = t[10], x = t[12], b = t[13], E = t[14], P = i * m + a * g + l * _, D = r * m + s * g + u * _, M = o * m + c * g + d * _, w = i * y + a * C + l * T, I = r * y + s * C + u * T, R = o * y + c * C + d * T, O = i * S + a * A + l * v, B = r * S + s * A + u * v, L = o * S + c * A + d * v, F = i * x + a * b + l * E + h, N = r * x + s * b + u * E + p, V = o * x + c * b + d * E + f; return n[0] = P, n[1] = D, n[2] = M, n[3] = 0, n[4] = w, n[5] = I, n[6] = R, n[7] = 0, n[8] = O, n[9] = B, n[10] = L, n[11] = 0, n[12] = F, n[13] = N, n[14] = V, n[15] = 1, n }, Matrix4.multiplyByMatrix3 = function (e, t, n) { const i = e[0], r = e[1], o = e[2], a = e[4], s = e[5], c = e[6], l = e[8], u = e[9], d = e[10], h = t[0], p = t[1], f = t[2], m = t[3], g = t[4], _ = t[5], y = t[6], C = t[7], T = t[8], S = i * h + a * p + l * f, A = r * h + s * p + u * f, v = o * h + c * p + d * f, x = i * m + a * g + l * _, b = r * m + s * g + u * _, E = o * m + c * g + d * _, P = i * y + a * C + l * T, D = r * y + s * C + u * T, M = o * y + c * C + d * T; return n[0] = S, n[1] = A, n[2] = v, n[3] = 0, n[4] = x, n[5] = b, n[6] = E, n[7] = 0, n[8] = P, n[9] = D, n[10] = M, n[11] = 0, n[12] = e[12], n[13] = e[13], n[14] = e[14], n[15] = e[15], n }, Matrix4.multiplyByTranslation = function (e, t, n) { const i = t.x, r = t.y, o = t.z, a = i * e[0] + r * e[4] + o * e[8] + e[12], s = i * e[1] + r * e[5] + o * e[9] + e[13], c = i * e[2] + r * e[6] + o * e[10] + e[14]; return n[0] = e[0], n[1] = e[1], n[2] = e[2], n[3] = e[3], n[4] = e[4], n[5] = e[5], n[6] = e[6], n[7] = e[7], n[8] = e[8], n[9] = e[9], n[10] = e[10], n[11] = e[11], n[12] = a, n[13] = s, n[14] = c, n[15] = e[15], n }, Matrix4.multiplyByScale = function (e, t, n) { const i = t.x, r = t.y, o = t.z; return 1 === i && 1 === r && 1 === o ? Matrix4.clone(e, n) : (n[0] = i * e[0], n[1] = i * e[1], n[2] = i * e[2], n[3] = e[3], n[4] = r * e[4], n[5] = r * e[5], n[6] = r * e[6], n[7] = e[7], n[8] = o * e[8], n[9] = o * e[9], n[10] = o * e[10], n[11] = e[11], n[12] = e[12], n[13] = e[13], n[14] = e[14], n[15] = e[15], n) }, Matrix4.multiplyByUniformScale = function (e, t, n) { return n[0] = e[0] * t, n[1] = e[1] * t, n[2] = e[2] * t, n[3] = e[3], n[4] = e[4] * t, n[5] = e[5] * t, n[6] = e[6] * t, n[7] = e[7], n[8] = e[8] * t, n[9] = e[9] * t, n[10] = e[10] * t, n[11] = e[11], n[12] = e[12], n[13] = e[13], n[14] = e[14], n[15] = e[15], n }, Matrix4.multiplyByVector = function (e, t, n) { const i = t.x, r = t.y, o = t.z, a = t.w, s = e[0] * i + e[4] * r + e[8] * o + e[12] * a, c = e[1] * i + e[5] * r + e[9] * o + e[13] * a, l = e[2] * i + e[6] * r + e[10] * o + e[14] * a, u = e[3] * i + e[7] * r + e[11] * o + e[15] * a; return n.x = s, n.y = c, n.z = l, n.w = u, n }, Matrix4.multiplyByPointAsVector = function (e, t, n) { const i = t.x, r = t.y, o = t.z, a = e[0] * i + e[4] * r + e[8] * o, s = e[1] * i + e[5] * r + e[9] * o, c = e[2] * i + e[6] * r + e[10] * o; return n.x = a, n.y = s, n.z = c, n }, Matrix4.multiplyByPoint = function (e, t, n) { const i = t.x, r = t.y, o = t.z, a = e[0] * i + e[4] * r + e[8] * o + e[12], s = e[1] * i + e[5] * r + e[9] * o + e[13], c = e[2] * i + e[6] * r + e[10] * o + e[14]; return n.x = a, n.y = s, n.z = c, n }, Matrix4.multiplyByScalar = function (e, t, n) { return n[0] = e[0] * t, n[1] = e[1] * t, n[2] = e[2] * t, n[3] = e[3] * t, n[4] = e[4] * t, n[5] = e[5] * t, n[6] = e[6] * t, n[7] = e[7] * t, n[8] = e[8] * t, n[9] = e[9] * t, n[10] = e[10] * t, n[11] = e[11] * t, n[12] = e[12] * t, n[13] = e[13] * t, n[14] = e[14] * t, n[15] = e[15] * t, n }, Matrix4.negate = function (e, t) { return t[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t[3] = -e[3], t[4] = -e[4], t[5] = -e[5], t[6] = -e[6], t[7] = -e[7], t[8] = -e[8], t[9] = -e[9], t[10] = -e[10], t[11] = -e[11], t[12] = -e[12], t[13] = -e[13], t[14] = -e[14], t[15] = -e[15], t }, Matrix4.transpose = function (e, t) { const n = e[1], i = e[2], r = e[3], o = e[6], a = e[7], s = e[11]; return t[0] = e[0], t[1] = e[4], t[2] = e[8], t[3] = e[12], t[4] = n, t[5] = e[5], t[6] = e[9], t[7] = e[13], t[8] = i, t[9] = o, t[10] = e[10], t[11] = e[14], t[12] = r, t[13] = a, t[14] = s, t[15] = e[15], t }, Matrix4.abs = function (e, t) { return t[0] = Math.abs(e[0]), t[1] = Math.abs(e[1]), t[2] = Math.abs(e[2]), t[3] = Math.abs(e[3]), t[4] = Math.abs(e[4]), t[5] = Math.abs(e[5]), t[6] = Math.abs(e[6]), t[7] = Math.abs(e[7]), t[8] = Math.abs(e[8]), t[9] = Math.abs(e[9]), t[10] = Math.abs(e[10]), t[11] = Math.abs(e[11]), t[12] = Math.abs(e[12]), t[13] = Math.abs(e[13]), t[14] = Math.abs(e[14]), t[15] = Math.abs(e[15]), t }, Matrix4.equals = function (e, t) { return e === t || defined(e) && defined(t) && e[12] === t[12] && e[13] === t[13] && e[14] === t[14] && e[0] === t[0] && e[1] === t[1] && e[2] === t[2] && e[4] === t[4] && e[5] === t[5] && e[6] === t[6] && e[8] === t[8] && e[9] === t[9] && e[10] === t[10] && e[3] === t[3] && e[7] === t[7] && e[11] === t[11] && e[15] === t[15] }, Matrix4.equalsEpsilon = function (e, t, n) { return n = defaultValue(n, 0), e === t || defined(e) && defined(t) && Math.abs(e[0] - t[0]) <= n && Math.abs(e[1] - t[1]) <= n && Math.abs(e[2] - t[2]) <= n && Math.abs(e[3] - t[3]) <= n && Math.abs(e[4] - t[4]) <= n && Math.abs(e[5] - t[5]) <= n && Math.abs(e[6] - t[6]) <= n && Math.abs(e[7] - t[7]) <= n && Math.abs(e[8] - t[8]) <= n && Math.abs(e[9] - t[9]) <= n && Math.abs(e[10] - t[10]) <= n && Math.abs(e[11] - t[11]) <= n && Math.abs(e[12] - t[12]) <= n && Math.abs(e[13] - t[13]) <= n && Math.abs(e[14] - t[14]) <= n && Math.abs(e[15] - t[15]) <= n }, Matrix4.getTranslation = function (e, t) { return t.x = e[12], t.y = e[13], t.z = e[14], t }, Matrix4.getMatrix3 = function (e, t) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[4], t[4] = e[5], t[5] = e[6], t[6] = e[8], t[7] = e[9], t[8] = e[10], t }; const scratchInverseRotation = new Matrix3, scratchMatrix3Zero = new Matrix3, scratchBottomRow = new Cartesian4, scratchExpectedBottomRow = new Cartesian4(0, 0, 0, 1); Matrix4.inverse = function (e, t) { const n = e[0], i = e[4], r = e[8], o = e[12], a = e[1], s = e[5], c = e[9], l = e[13], u = e[2], d = e[6], h = e[10], p = e[14], f = e[3], m = e[7], g = e[11], _ = e[15]; let y = h * _, C = p * g, T = d * _, S = p * m, A = d * g, v = h * m, x = u * _, b = p * f, E = u * g, P = h * f, D = u * m, M = d * f; const w = y * s + S * c + A * l - (C * s + T * c + v * l), I = C * a + x * c + P * l - (y * a + b * c + E * l), R = T * a + b * s + D * l - (S * a + x * s + M * l), O = v * a + E * s + M * c - (A * a + P * s + D * c), B = C * i + T * r + v * o - (y * i + S * r + A * o), L = y * n + b * r + E * o - (C * n + x * r + P * o), F = S * n + x * i + M * o - (T * n + b * i + D * o), N = A * n + P * i + D * r - (v * n + E * i + M * r); y = r * l, C = o * c, T = i * l, S = o * s, A = i * c, v = r * s, x = n * l, b = o * a, E = n * c, P = r * a, D = n * s, M = i * a; const V = y * m + S * g + A * _ - (C * m + T * g + v * _), $ = C * f + x * g + P * _ - (y * f + b * g + E * _), k = T * f + b * m + D * _ - (S * f + x * m + M * _), U = v * f + E * m + M * g - (A * f + P * m + D * g), G = T * h + v * p + C * d - (A * p + y * d + S * h), z = E * p + y * u + b * h - (x * h + P * p + C * u), H = x * d + M * p + S * u - (D * p + T * u + b * d), W = D * h + A * u + P * d - (E * d + M * h + v * u); let q = n * w + i * I + r * R + o * O; if (Math.abs(q) < CesiumMath.EPSILON21) { if (Matrix3.equalsEpsilon(Matrix4.getMatrix3(e, scratchInverseRotation), scratchMatrix3Zero, CesiumMath.EPSILON7) && Cartesian4.equals(Matrix4.getRow(e, 3, scratchBottomRow), scratchExpectedBottomRow)) return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 0, t[11] = 0, t[12] = -e[12], t[13] = -e[13], t[14] = -e[14], t[15] = 1, t; throw new RuntimeError("matrix is not invertible because its determinate is zero.") } return q = 1 / q, t[0] = w * q, t[1] = I * q, t[2] = R * q, t[3] = O * q, t[4] = B * q, t[5] = L * q, t[6] = F * q, t[7] = N * q, t[8] = V * q, t[9] = $ * q, t[10] = k * q, t[11] = U * q, t[12] = G * q, t[13] = z * q, t[14] = H * q, t[15] = W * q, t }, Matrix4.inverseTransformation = function (e, t) { const n = e[0], i = e[1], r = e[2], o = e[4], a = e[5], s = e[6], c = e[8], l = e[9], u = e[10], d = e[12], h = e[13], p = e[14], f = -n * d - i * h - r * p, m = -o * d - a * h - s * p, g = -c * d - l * h - u * p; return t[0] = n, t[1] = o, t[2] = c, t[3] = 0, t[4] = i, t[5] = a, t[6] = l, t[7] = 0, t[8] = r, t[9] = s, t[10] = u, t[11] = 0, t[12] = f, t[13] = m, t[14] = g, t[15] = 1, t }; const scratchTransposeMatrix = new Matrix4; function Rectangle(e, t, n, i) { this.west = defaultValue(e, 0), this.south = defaultValue(t, 0), this.east = defaultValue(n, 0), this.north = defaultValue(i, 0) } Matrix4.inverseTranspose = function (e, t) { return Matrix4.inverse(Matrix4.transpose(e, scratchTransposeMatrix), t) }, Matrix4.IDENTITY = Object.freeze(new Matrix4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)), Matrix4.ZERO = Object.freeze(new Matrix4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), Matrix4.COLUMN0ROW0 = 0, Matrix4.COLUMN0ROW1 = 1, Matrix4.COLUMN0ROW2 = 2, Matrix4.COLUMN0ROW3 = 3, Matrix4.COLUMN1ROW0 = 4, Matrix4.COLUMN1ROW1 = 5, Matrix4.COLUMN1ROW2 = 6, Matrix4.COLUMN1ROW3 = 7, Matrix4.COLUMN2ROW0 = 8, Matrix4.COLUMN2ROW1 = 9, Matrix4.COLUMN2ROW2 = 10, Matrix4.COLUMN2ROW3 = 11, Matrix4.COLUMN3ROW0 = 12, Matrix4.COLUMN3ROW1 = 13, Matrix4.COLUMN3ROW2 = 14, Matrix4.COLUMN3ROW3 = 15, Object.defineProperties(Matrix4.prototype, { length: { get: function () { return Matrix4.packedLength } } }), Matrix4.prototype.clone = function (e) { return Matrix4.clone(this, e) }, Matrix4.prototype.equals = function (e) { return Matrix4.equals(this, e) }, Matrix4.equalsArray = function (e, t, n) { return e[0] === t[n] && e[1] === t[n + 1] && e[2] === t[n + 2] && e[3] === t[n + 3] && e[4] === t[n + 4] && e[5] === t[n + 5] && e[6] === t[n + 6] && e[7] === t[n + 7] && e[8] === t[n + 8] && e[9] === t[n + 9] && e[10] === t[n + 10] && e[11] === t[n + 11] && e[12] === t[n + 12] && e[13] === t[n + 13] && e[14] === t[n + 14] && e[15] === t[n + 15] }, Matrix4.prototype.equalsEpsilon = function (e, t) { return Matrix4.equalsEpsilon(this, e, t) }, Matrix4.prototype.toString = function () { return `(${this[0]}, ${this[4]}, ${this[8]}, ${this[12]})\n(${this[1]}, ${this[5]}, ${this[9]}, ${this[13]})\n(${this[2]}, ${this[6]}, ${this[10]}, ${this[14]})\n(${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})` }, Object.defineProperties(Rectangle.prototype, { width: { get: function () { return Rectangle.computeWidth(this) } }, height: { get: function () { return Rectangle.computeHeight(this) } } }), Rectangle.packedLength = 4, Rectangle.pack = function (e, t, n) { return n = defaultValue(n, 0), t[n++] = e.west, t[n++] = e.south, t[n++] = e.east, t[n] = e.north, t }, Rectangle.unpack = function (e, t, n) { return t = defaultValue(t, 0), defined(n) || (n = new Rectangle), n.west = e[t++], n.south = e[t++], n.east = e[t++], n.north = e[t], n }, Rectangle.computeWidth = function (e) { let t = e.east; const n = e.west; return t < n && (t += CesiumMath.TWO_PI), t - n }, Rectangle.computeHeight = function (e) { return e.north - e.south }, Rectangle.fromDegrees = function (e, t, n, i, r) { return e = CesiumMath.toRadians(defaultValue(e, 0)), t = CesiumMath.toRadians(defaultValue(t, 0)), n = CesiumMath.toRadians(defaultValue(n, 0)), i = CesiumMath.toRadians(defaultValue(i, 0)), defined(r) ? (r.west = e, r.south = t, r.east = n, r.north = i, r) : new Rectangle(e, t, n, i) }, Rectangle.fromRadians = function (e, t, n, i, r) { return defined(r) ? (r.west = defaultValue(e, 0), r.south = defaultValue(t, 0), r.east = defaultValue(n, 0), r.north = defaultValue(i, 0), r) : new Rectangle(e, t, n, i) }, Rectangle.fromCartographicArray = function (e, t) { let n = Number.MAX_VALUE, i = -Number.MAX_VALUE, r = Number.MAX_VALUE, o = -Number.MAX_VALUE, a = Number.MAX_VALUE, s = -Number.MAX_VALUE; for (let t = 0, c = e.length; t < c; t++) { const c = e[t]; n = Math.min(n, c.longitude), i = Math.max(i, c.longitude), a = Math.min(a, c.latitude), s = Math.max(s, c.latitude); const l = c.longitude >= 0 ? c.longitude : c.longitude + CesiumMath.TWO_PI; r = Math.min(r, l), o = Math.max(o, l) } return i - n > o - r && (n = r, i = o, i > CesiumMath.PI && (i -= CesiumMath.TWO_PI), n > CesiumMath.PI && (n -= CesiumMath.TWO_PI)), defined(t) ? (t.west = n, t.south = a, t.east = i, t.north = s, t) : new Rectangle(n, a, i, s) }, Rectangle.fromCartesianArray = function (e, t, n) { t = defaultValue(t, Ellipsoid.WGS84); let i = Number.MAX_VALUE, r = -Number.MAX_VALUE, o = Number.MAX_VALUE, a = -Number.MAX_VALUE, s = Number.MAX_VALUE, c = -Number.MAX_VALUE; for (let n = 0, l = e.length; n < l; n++) { const l = t.cartesianToCartographic(e[n]); i = Math.min(i, l.longitude), r = Math.max(r, l.longitude), s = Math.min(s, l.latitude), c = Math.max(c, l.latitude); const u = l.longitude >= 0 ? l.longitude : l.longitude + CesiumMath.TWO_PI; o = Math.min(o, u), a = Math.max(a, u) } return r - i > a - o && (i = o, r = a, r > CesiumMath.PI && (r -= CesiumMath.TWO_PI), i > CesiumMath.PI && (i -= CesiumMath.TWO_PI)), defined(n) ? (n.west = i, n.south = s, n.east = r, n.north = c, n) : new Rectangle(i, s, r, c) }, Rectangle.clone = function (e, t) { if (defined(e)) return defined(t) ? (t.west = e.west, t.south = e.south, t.east = e.east, t.north = e.north, t) : new Rectangle(e.west, e.south, e.east, e.north) }, Rectangle.equalsEpsilon = function (e, t, n) { return n = defaultValue(n, 0), e === t || defined(e) && defined(t) && Math.abs(e.west - t.west) <= n && Math.abs(e.south - t.south) <= n && Math.abs(e.east - t.east) <= n && Math.abs(e.north - t.north) <= n }, Rectangle.prototype.clone = function (e) { return Rectangle.clone(this, e) }, Rectangle.prototype.equals = function (e) { return Rectangle.equals(this, e) }, Rectangle.equals = function (e, t) { return e === t || defined(e) && defined(t) && e.west === t.west && e.south === t.south && e.east === t.east && e.north === t.north }, Rectangle.prototype.equalsEpsilon = function (e, t) { return Rectangle.equalsEpsilon(this, e, t) }, Rectangle.validate = function (e) { }, Rectangle.southwest = function (e, t) { return defined(t) ? (t.longitude = e.west, t.latitude = e.south, t.height = 0, t) : new Cartographic(e.west, e.south) }, Rectangle.northwest = function (e, t) { return defined(t) ? (t.longitude = e.west, t.latitude = e.north, t.height = 0, t) : new Cartographic(e.west, e.north) }, Rectangle.northeast = function (e, t) { return defined(t) ? (t.longitude = e.east, t.latitude = e.north, t.height = 0, t) : new Cartographic(e.east, e.north) }, Rectangle.southeast = function (e, t) { return defined(t) ? (t.longitude = e.east, t.latitude = e.south, t.height = 0, t) : new Cartographic(e.east, e.south) }, Rectangle.center = function (e, t) { let n = e.east; const i = e.west; n < i && (n += CesiumMath.TWO_PI); const r = CesiumMath.negativePiToPi(.5 * (i + n)), o = .5 * (e.south + e.north); return defined(t) ? (t.longitude = r, t.latitude = o, t.height = 0, t) : new Cartographic(r, o) }, Rectangle.intersection = function (e, t, n) { let i = e.east, r = e.west, o = t.east, a = t.west; i < r && o > 0 ? i += CesiumMath.TWO_PI : o < a && i > 0 && (o += CesiumMath.TWO_PI), i < r && a < 0 ? a += CesiumMath.TWO_PI : o < a && r < 0 && (r += CesiumMath.TWO_PI); const s = CesiumMath.negativePiToPi(Math.max(r, a)), c = CesiumMath.negativePiToPi(Math.min(i, o)); if ((e.west < e.east || t.west < t.east) && c <= s) return; const l = Math.max(e.south, t.south), u = Math.min(e.north, t.north); return l >= u ? void 0 : defined(n) ? (n.west = s, n.south = l, n.east = c, n.north = u, n) : new Rectangle(s, l, c, u) }, Rectangle.simpleIntersection = function (e, t, n) { const i = Math.max(e.west, t.west), r = Math.max(e.south, t.south), o = Math.min(e.east, t.east), a = Math.min(e.north, t.north); if (!(r >= a || i >= o)) return defined(n) ? (n.west = i, n.south = r, n.east = o, n.north = a, n) : new Rectangle(i, r, o, a) }, Rectangle.union = function (e, t, n) { defined(n) || (n = new Rectangle); let i = e.east, r = e.west, o = t.east, a = t.west; i < r && o > 0 ? i += CesiumMath.TWO_PI : o < a && i > 0 && (o += CesiumMath.TWO_PI), i < r && a < 0 ? a += CesiumMath.TWO_PI : o < a && r < 0 && (r += CesiumMath.TWO_PI); const s = CesiumMath.negativePiToPi(Math.min(r, a)), c = CesiumMath.negativePiToPi(Math.max(i, o)); return n.west = s, n.south = Math.min(e.south, t.south), n.east = c, n.north = Math.max(e.north, t.north), n }, Rectangle.expand = function (e, t, n) { return defined(n) || (n = new Rectangle), n.west = Math.min(e.west, t.longitude), n.south = Math.min(e.south, t.latitude), n.east = Math.max(e.east, t.longitude), n.north = Math.max(e.north, t.latitude), n }, Rectangle.contains = function (e, t) { let n = t.longitude; const i = t.latitude, r = e.west; let o = e.east; return o < r && (o += CesiumMath.TWO_PI, n < 0 && (n += CesiumMath.TWO_PI)), (n > r || CesiumMath.equalsEpsilon(n, r, CesiumMath.EPSILON14)) && (n < o || CesiumMath.equalsEpsilon(n, o, CesiumMath.EPSILON14)) && i >= e.south && i <= e.north }; const subsampleLlaScratch = new Cartographic; function BoundingSphere(e, t) { this.center = Cartesian3.clone(defaultValue(e, Cartesian3.ZERO)), this.radius = defaultValue(t, 0) } Rectangle.subsample = function (e, t, n, i) { t = defaultValue(t, Ellipsoid.WGS84), n = defaultValue(n, 0), defined(i) || (i = []); let r = 0; const o = e.north, a = e.south, s = e.east, c = e.west, l = subsampleLlaScratch; l.height = n, l.longitude = c, l.latitude = o, i[r] = t.cartographicToCartesian(l, i[r]), r++, l.longitude = s, i[r] = t.cartographicToCartesian(l, i[r]), r++, l.latitude = a, i[r] = t.cartographicToCartesian(l, i[r]), r++, l.longitude = c, i[r] = t.cartographicToCartesian(l, i[r]), r++, l.latitude = o < 0 ? o : a > 0 ? a : 0; for (let n = 1; n < 8; ++n) l.longitude = -Math.PI + n * CesiumMath.PI_OVER_TWO, Rectangle.contains(e, l) && (i[r] = t.cartographicToCartesian(l, i[r]), r++); return 0 === l.latitude && (l.longitude = c, i[r] = t.cartographicToCartesian(l, i[r]), r++, l.longitude = s, i[r] = t.cartographicToCartesian(l, i[r]), r++), i.length = r, i }, Rectangle.subsection = function (e, t, n, i, r, o) { if (defined(o) || (o = new Rectangle), e.west <= e.east) { const n = e.east - e.west; o.west = e.west + t * n, o.east = e.west + i * n } else { const n = CesiumMath.TWO_PI + e.east - e.west; o.west = CesiumMath.negativePiToPi(e.west + t * n), o.east = CesiumMath.negativePiToPi(e.west + i * n) } const a = e.north - e.south; return o.south = e.south + n * a, o.north = e.south + r * a, 1 === t && (o.west = e.east), 1 === i && (o.east = e.east), 1 === n && (o.south = e.north), 1 === r && (o.north = e.north), o }, Rectangle.MAX_VALUE = Object.freeze(new Rectangle(-Math.PI, -CesiumMath.PI_OVER_TWO, Math.PI, CesiumMath.PI_OVER_TWO)); const fromPointsXMin = new Cartesian3, fromPointsYMin = new Cartesian3, fromPointsZMin = new Cartesian3, fromPointsXMax = new Cartesian3, fromPointsYMax = new Cartesian3, fromPointsZMax = new Cartesian3, fromPointsCurrentPos = new Cartesian3, fromPointsScratch = new Cartesian3, fromPointsRitterCenter = new Cartesian3, fromPointsMinBoxPt = new Cartesian3, fromPointsMaxBoxPt = new Cartesian3, fromPointsNaiveCenterScratch = new Cartesian3, volumeConstant = 4 / 3 * CesiumMath.PI; BoundingSphere.fromPoints = function (e, t) { if (defined(t) || (t = new BoundingSphere), !defined(e) || 0 === e.length) return t.center = Cartesian3.clone(Cartesian3.ZERO, t.center), t.radius = 0, t; const n = Cartesian3.clone(e[0], fromPointsCurrentPos), i = Cartesian3.clone(n, fromPointsXMin), r = Cartesian3.clone(n, fromPointsYMin), o = Cartesian3.clone(n, fromPointsZMin), a = Cartesian3.clone(n, fromPointsXMax), s = Cartesian3.clone(n, fromPointsYMax), c = Cartesian3.clone(n, fromPointsZMax), l = e.length; let u; for (u = 1; u < l; u++) { Cartesian3.clone(e[u], n); const t = n.x, l = n.y, d = n.z; t < i.x && Cartesian3.clone(n, i), t > a.x && Cartesian3.clone(n, a), l < r.y && Cartesian3.clone(n, r), l > s.y && Cartesian3.clone(n, s), d < o.z && Cartesian3.clone(n, o), d > c.z && Cartesian3.clone(n, c) } const d = Cartesian3.magnitudeSquared(Cartesian3.subtract(a, i, fromPointsScratch)), h = Cartesian3.magnitudeSquared(Cartesian3.subtract(s, r, fromPointsScratch)), p = Cartesian3.magnitudeSquared(Cartesian3.subtract(c, o, fromPointsScratch)); let f = i, m = a, g = d; h > g && (g = h, f = r, m = s), p > g && (g = p, f = o, m = c); const _ = fromPointsRitterCenter; _.x = .5 * (f.x + m.x), _.y = .5 * (f.y + m.y), _.z = .5 * (f.z + m.z); let y = Cartesian3.magnitudeSquared(Cartesian3.subtract(m, _, fromPointsScratch)), C = Math.sqrt(y); const T = fromPointsMinBoxPt; T.x = i.x, T.y = r.y, T.z = o.z; const S = fromPointsMaxBoxPt; S.x = a.x, S.y = s.y, S.z = c.z; const A = Cartesian3.midpoint(T, S, fromPointsNaiveCenterScratch); let v = 0; for (u = 0; u < l; u++) { Cartesian3.clone(e[u], n); const t = Cartesian3.magnitude(Cartesian3.subtract(n, A, fromPointsScratch)); t > v && (v = t); const i = Cartesian3.magnitudeSquared(Cartesian3.subtract(n, _, fromPointsScratch)); if (i > y) { const e = Math.sqrt(i); C = .5 * (C + e), y = C * C; const t = e - C; _.x = (C * _.x + t * n.x) / e, _.y = (C * _.y + t * n.y) / e, _.z = (C * _.z + t * n.z) / e } } return C < v ? (Cartesian3.clone(_, t.center), t.radius = C) : (Cartesian3.clone(A, t.center), t.radius = v), t }; const defaultProjection$1 = new GeographicProjection, fromRectangle2DLowerLeft = new Cartesian3, fromRectangle2DUpperRight = new Cartesian3, fromRectangle2DSouthwest = new Cartographic, fromRectangle2DNortheast = new Cartographic; BoundingSphere.fromRectangle2D = function (e, t, n) { return BoundingSphere.fromRectangleWithHeights2D(e, t, 0, 0, n) }, BoundingSphere.fromRectangleWithHeights2D = function (e, t, n, i, r) { if (defined(r) || (r = new BoundingSphere), !defined(e)) return r.center = Cartesian3.clone(Cartesian3.ZERO, r.center), r.radius = 0, r; t = defaultValue(t, defaultProjection$1), Rectangle.southwest(e, fromRectangle2DSouthwest), fromRectangle2DSouthwest.height = n, Rectangle.northeast(e, fromRectangle2DNortheast), fromRectangle2DNortheast.height = i; const o = t.project(fromRectangle2DSouthwest, fromRectangle2DLowerLeft), a = t.project(fromRectangle2DNortheast, fromRectangle2DUpperRight), s = a.x - o.x, c = a.y - o.y, l = a.z - o.z; r.radius = .5 * Math.sqrt(s * s + c * c + l * l); const u = r.center; return u.x = o.x + .5 * s, u.y = o.y + .5 * c, u.z = o.z + .5 * l, r }; const fromRectangle3DScratch = []; BoundingSphere.fromRectangle3D = function (e, t, n, i) { if (t = defaultValue(t, Ellipsoid.WGS84), n = defaultValue(n, 0), defined(i) || (i = new BoundingSphere), !defined(e)) return i.center = Cartesian3.clone(Cartesian3.ZERO, i.center), i.radius = 0, i; const r = Rectangle.subsample(e, t, n, fromRectangle3DScratch); return BoundingSphere.fromPoints(r, i) }, BoundingSphere.fromVertices = function (e, t, n, i) { if (defined(i) || (i = new BoundingSphere), !defined(e) || 0 === e.length) return i.center = Cartesian3.clone(Cartesian3.ZERO, i.center), i.radius = 0, i; t = defaultValue(t, Cartesian3.ZERO), n = defaultValue(n, 3); const r = fromPointsCurrentPos; r.x = e[0] + t.x, r.y = e[1] + t.y, r.z = e[2] + t.z; const o = Cartesian3.clone(r, fromPointsXMin), a = Cartesian3.clone(r, fromPointsYMin), s = Cartesian3.clone(r, fromPointsZMin), c = Cartesian3.clone(r, fromPointsXMax), l = Cartesian3.clone(r, fromPointsYMax), u = Cartesian3.clone(r, fromPointsZMax), d = e.length; let h; for (h = 0; h < d; h += n) { const n = e[h] + t.x, i = e[h + 1] + t.y, d = e[h + 2] + t.z; r.x = n, r.y = i, r.z = d, n < o.x && Cartesian3.clone(r, o), n > c.x && Cartesian3.clone(r, c), i < a.y && Cartesian3.clone(r, a), i > l.y && Cartesian3.clone(r, l), d < s.z && Cartesian3.clone(r, s), d > u.z && Cartesian3.clone(r, u) } const p = Cartesian3.magnitudeSquared(Cartesian3.subtract(c, o, fromPointsScratch)), f = Cartesian3.magnitudeSquared(Cartesian3.subtract(l, a, fromPointsScratch)), m = Cartesian3.magnitudeSquared(Cartesian3.subtract(u, s, fromPointsScratch)); let g = o, _ = c, y = p; f > y && (y = f, g = a, _ = l), m > y && (y = m, g = s, _ = u); const C = fromPointsRitterCenter; C.x = .5 * (g.x + _.x), C.y = .5 * (g.y + _.y), C.z = .5 * (g.z + _.z); let T = Cartesian3.magnitudeSquared(Cartesian3.subtract(_, C, fromPointsScratch)), S = Math.sqrt(T); const A = fromPointsMinBoxPt; A.x = o.x, A.y = a.y, A.z = s.z; const v = fromPointsMaxBoxPt; v.x = c.x, v.y = l.y, v.z = u.z; const x = Cartesian3.midpoint(A, v, fromPointsNaiveCenterScratch); let b = 0; for (h = 0; h < d; h += n) { r.x = e[h] + t.x, r.y = e[h + 1] + t.y, r.z = e[h + 2] + t.z; const n = Cartesian3.magnitude(Cartesian3.subtract(r, x, fromPointsScratch)); n > b && (b = n); const i = Cartesian3.magnitudeSquared(Cartesian3.subtract(r, C, fromPointsScratch)); if (i > T) { const e = Math.sqrt(i); S = .5 * (S + e), T = S * S; const t = e - S; C.x = (S * C.x + t * r.x) / e, C.y = (S * C.y + t * r.y) / e, C.z = (S * C.z + t * r.z) / e } } return S < b ? (Cartesian3.clone(C, i.center), i.radius = S) : (Cartesian3.clone(x, i.center), i.radius = b), i }, BoundingSphere.fromEncodedCartesianVertices = function (e, t, n) { if (defined(n) || (n = new BoundingSphere), !defined(e) || !defined(t) || e.length !== t.length || 0 === e.length) return n.center = Cartesian3.clone(Cartesian3.ZERO, n.center), n.radius = 0, n; const i = fromPointsCurrentPos; i.x = e[0] + t[0], i.y = e[1] + t[1], i.z = e[2] + t[2]; const r = Cartesian3.clone(i, fromPointsXMin), o = Cartesian3.clone(i, fromPointsYMin), a = Cartesian3.clone(i, fromPointsZMin), s = Cartesian3.clone(i, fromPointsXMax), c = Cartesian3.clone(i, fromPointsYMax), l = Cartesian3.clone(i, fromPointsZMax), u = e.length; let d; for (d = 0; d < u; d += 3) { const n = e[d] + t[d], u = e[d + 1] + t[d + 1], h = e[d + 2] + t[d + 2]; i.x = n, i.y = u, i.z = h, n < r.x && Cartesian3.clone(i, r), n > s.x && Cartesian3.clone(i, s), u < o.y && Cartesian3.clone(i, o), u > c.y && Cartesian3.clone(i, c), h < a.z && Cartesian3.clone(i, a), h > l.z && Cartesian3.clone(i, l) } const h = Cartesian3.magnitudeSquared(Cartesian3.subtract(s, r, fromPointsScratch)), p = Cartesian3.magnitudeSquared(Cartesian3.subtract(c, o, fromPointsScratch)), f = Cartesian3.magnitudeSquared(Cartesian3.subtract(l, a, fromPointsScratch)); let m = r, g = s, _ = h; p > _ && (_ = p, m = o, g = c), f > _ && (_ = f, m = a, g = l); const y = fromPointsRitterCenter; y.x = .5 * (m.x + g.x), y.y = .5 * (m.y + g.y), y.z = .5 * (m.z + g.z); let C = Cartesian3.magnitudeSquared(Cartesian3.subtract(g, y, fromPointsScratch)), T = Math.sqrt(C); const S = fromPointsMinBoxPt; S.x = r.x, S.y = o.y, S.z = a.z; const A = fromPointsMaxBoxPt; A.x = s.x, A.y = c.y, A.z = l.z; const v = Cartesian3.midpoint(S, A, fromPointsNaiveCenterScratch); let x = 0; for (d = 0; d < u; d += 3) { i.x = e[d] + t[d], i.y = e[d + 1] + t[d + 1], i.z = e[d + 2] + t[d + 2]; const n = Cartesian3.magnitude(Cartesian3.subtract(i, v, fromPointsScratch)); n > x && (x = n); const r = Cartesian3.magnitudeSquared(Cartesian3.subtract(i, y, fromPointsScratch)); if (r > C) { const e = Math.sqrt(r); T = .5 * (T + e), C = T * T; const t = e - T; y.x = (T * y.x + t * i.x) / e, y.y = (T * y.y + t * i.y) / e, y.z = (T * y.z + t * i.z) / e } } return T < x ? (Cartesian3.clone(y, n.center), n.radius = T) : (Cartesian3.clone(v, n.center), n.radius = x), n }, BoundingSphere.fromCornerPoints = function (e, t, n) { defined(n) || (n = new BoundingSphere); const i = Cartesian3.midpoint(e, t, n.center); return n.radius = Cartesian3.distance(i, t), n }, BoundingSphere.fromEllipsoid = function (e, t) { return defined(t) || (t = new BoundingSphere), Cartesian3.clone(Cartesian3.ZERO, t.center), t.radius = e.maximumRadius, t }; const fromBoundingSpheresScratch = new Cartesian3; BoundingSphere.fromBoundingSpheres = function (e, t) { if (defined(t) || (t = new BoundingSphere), !defined(e) || 0 === e.length) return t.center = Cartesian3.clone(Cartesian3.ZERO, t.center), t.radius = 0, t; const n = e.length; if (1 === n) return BoundingSphere.clone(e[0], t); if (2 === n) return BoundingSphere.union(e[0], e[1], t); const i = []; let r; for (r = 0; r < n; r++) i.push(e[r].center); const o = (t = BoundingSphere.fromPoints(i, t)).center; let a = t.radius; for (r = 0; r < n; r++) { const t = e[r]; a = Math.max(a, Cartesian3.distance(o, t.center, fromBoundingSpheresScratch) + t.radius) } return t.radius = a, t }; const fromOrientedBoundingBoxScratchU = new Cartesian3, fromOrientedBoundingBoxScratchV = new Cartesian3, fromOrientedBoundingBoxScratchW = new Cartesian3; BoundingSphere.fromOrientedBoundingBox = function (e, t) { defined(t) || (t = new BoundingSphere); const n = e.halfAxes, i = Matrix3.getColumn(n, 0, fromOrientedBoundingBoxScratchU), r = Matrix3.getColumn(n, 1, fromOrientedBoundingBoxScratchV), o = Matrix3.getColumn(n, 2, fromOrientedBoundingBoxScratchW); return Cartesian3.add(i, r, i), Cartesian3.add(i, o, i), t.center = Cartesian3.clone(e.center, t.center), t.radius = Cartesian3.magnitude(i), t }; const scratchFromTransformationCenter = new Cartesian3, scratchFromTransformationScale = new Cartesian3; BoundingSphere.fromTransformation = function (e, t) { defined(t) || (t = new BoundingSphere); const n = Matrix4.getTranslation(e, scratchFromTransformationCenter), i = Matrix4.getScale(e, scratchFromTransformationScale), r = .5 * Cartesian3.magnitude(i); return t.center = Cartesian3.clone(n, t.center), t.radius = r, t }, BoundingSphere.clone = function (e, t) { if (defined(e)) return defined(t) ? (t.center = Cartesian3.clone(e.center, t.center), t.radius = e.radius, t) : new BoundingSphere(e.center, e.radius) }, BoundingSphere.packedLength = 4, BoundingSphere.pack = function (e, t, n) { n = defaultValue(n, 0); const i = e.center; return t[n++] = i.x, t[n++] = i.y, t[n++] = i.z, t[n] = e.radius, t }, BoundingSphere.unpack = function (e, t, n) { t = defaultValue(t, 0), defined(n) || (n = new BoundingSphere); const i = n.center; return i.x = e[t++], i.y = e[t++], i.z = e[t++], n.radius = e[t], n }; const unionScratch = new Cartesian3, unionScratchCenter = new Cartesian3; BoundingSphere.union = function (e, t, n) { defined(n) || (n = new BoundingSphere); const i = e.center, r = e.radius, o = t.center, a = t.radius, s = Cartesian3.subtract(o, i, unionScratch), c = Cartesian3.magnitude(s); if (r >= c + a) return e.clone(n), n; if (a >= c + r) return t.clone(n), n; const l = .5 * (r + c + a), u = Cartesian3.multiplyByScalar(s, (-r + l) / c, unionScratchCenter); return Cartesian3.add(u, i, u), Cartesian3.clone(u, n.center), n.radius = l, n }; const expandScratch = new Cartesian3; BoundingSphere.expand = function (e, t, n) { n = BoundingSphere.clone(e, n); const i = Cartesian3.magnitude(Cartesian3.subtract(t, n.center, expandScratch)); return i > n.radius && (n.radius = i), n }, BoundingSphere.intersectPlane = function (e, t) { const n = e.center, i = e.radius, r = t.normal, o = Cartesian3.dot(r, n) + t.distance; return o < -i ? Intersect$1.OUTSIDE : o < i ? Intersect$1.INTERSECTING : Intersect$1.INSIDE }, BoundingSphere.transform = function (e, t, n) { return defined(n) || (n = new BoundingSphere), n.center = Matrix4.multiplyByPoint(t, e.center, n.center), n.radius = Matrix4.getMaximumScale(t) * e.radius, n }; const distanceSquaredToScratch = new Cartesian3; BoundingSphere.distanceSquaredTo = function (e, t) { const n = Cartesian3.subtract(e.center, t, distanceSquaredToScratch), i = Cartesian3.magnitude(n) - e.radius; return i <= 0 ? 0 : i * i }, BoundingSphere.transformWithoutScale = function (e, t, n) { return defined(n) || (n = new BoundingSphere), n.center = Matrix4.multiplyByPoint(t, e.center, n.center), n.radius = e.radius, n }; const scratchCartesian3$d = new Cartesian3; BoundingSphere.computePlaneDistances = function (e, t, n, i) { defined(i) || (i = new Interval); const r = Cartesian3.subtract(e.center, t, scratchCartesian3$d), o = Cartesian3.dot(n, r); return i.start = o - e.radius, i.stop = o + e.radius, i }; const projectTo2DNormalScratch = new Cartesian3, projectTo2DEastScratch = new Cartesian3, projectTo2DNorthScratch = new Cartesian3, projectTo2DWestScratch = new Cartesian3, projectTo2DSouthScratch = new Cartesian3, projectTo2DCartographicScratch = new Cartographic, projectTo2DPositionsScratch = new Array(8); for (let e = 0; e < 8; ++e) projectTo2DPositionsScratch[e] = new Cartesian3; const projectTo2DProjection = new GeographicProjection; BoundingSphere.projectTo2D = function (e, t, n) { const i = (t = defaultValue(t, projectTo2DProjection)).ellipsoid; let r = e.center; const o = e.radius; let a; a = Cartesian3.equals(r, Cartesian3.ZERO) ? Cartesian3.clone(Cartesian3.UNIT_X, projectTo2DNormalScratch) : i.geodeticSurfaceNormal(r, projectTo2DNormalScratch); const s = Cartesian3.cross(Cartesian3.UNIT_Z, a, projectTo2DEastScratch); Cartesian3.normalize(s, s); const c = Cartesian3.cross(a, s, projectTo2DNorthScratch); Cartesian3.normalize(c, c), Cartesian3.multiplyByScalar(a, o, a), Cartesian3.multiplyByScalar(c, o, c), Cartesian3.multiplyByScalar(s, o, s); const l = Cartesian3.negate(c, projectTo2DSouthScratch), u = Cartesian3.negate(s, projectTo2DWestScratch), d = projectTo2DPositionsScratch; let h = d[0]; Cartesian3.add(a, c, h), Cartesian3.add(h, s, h), h = d[1], Cartesian3.add(a, c, h), Cartesian3.add(h, u, h), h = d[2], Cartesian3.add(a, l, h), Cartesian3.add(h, u, h), h = d[3], Cartesian3.add(a, l, h), Cartesian3.add(h, s, h), Cartesian3.negate(a, a), h = d[4], Cartesian3.add(a, c, h), Cartesian3.add(h, s, h), h = d[5], Cartesian3.add(a, c, h), Cartesian3.add(h, u, h), h = d[6], Cartesian3.add(a, l, h), Cartesian3.add(h, u, h), h = d[7], Cartesian3.add(a, l, h), Cartesian3.add(h, s, h); const p = d.length; for (let e = 0; e < p; ++e) { const n = d[e]; Cartesian3.add(r, n, n); const o = i.cartesianToCartographic(n, projectTo2DCartographicScratch); t.project(o, n) } r = (n = BoundingSphere.fromPoints(d, n)).center; const f = r.x, m = r.y, g = r.z; return r.x = g, r.y = f, r.z = m, n }, BoundingSphere.isOccluded = function (e, t) { return !t.isBoundingSphereVisible(e) }, BoundingSphere.equals = function (e, t) { return e === t || defined(e) && defined(t) && Cartesian3.equals(e.center, t.center) && e.radius === t.radius }, BoundingSphere.prototype.intersectPlane = function (e) { return BoundingSphere.intersectPlane(this, e) }, BoundingSphere.prototype.distanceSquaredTo = function (e) { return BoundingSphere.distanceSquaredTo(this, e) }, BoundingSphere.prototype.computePlaneDistances = function (e, t, n) { return BoundingSphere.computePlaneDistances(this, e, t, n) }, BoundingSphere.prototype.isOccluded = function (e) { return BoundingSphere.isOccluded(this, e) }, BoundingSphere.prototype.equals = function (e) { return BoundingSphere.equals(this, e) }, BoundingSphere.prototype.clone = function (e) { return BoundingSphere.clone(this, e) }, BoundingSphere.prototype.volume = function () { const e = this.radius; return volumeConstant * e * e * e }; var commonjsGlobal = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}; function createCommonjsModule(e, t, n) { return e(n = { path: t, exports: {}, require: function (e, t) { return commonjsRequire(e, null == t ? n.path : t) } }, n.exports), n.exports } function commonjsRequire() { throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs") } var punycode = createCommonjsModule((function (e, t) { !function (n) { var i = t && !t.nodeType && t, r = e && !e.nodeType && e, o = "object" == typeof commonjsGlobal && commonjsGlobal; o.global !== o && o.window !== o && o.self !== o || (n = o); var a, s, c = 2147483647, l = 36, u = /^xn--/, d = /[^\x20-\x7E]/, h = /[\x2E\u3002\uFF0E\uFF61]/g, p = { overflow: "Overflow: input needs wider integers to process", "not-basic": "Illegal input >= 0x80 (not a basic code point)", "invalid-input": "Invalid input" }, f = Math.floor, m = String.fromCharCode; function g(e) { throw new RangeError(p[e]) } function _(e, t) { for (var n = e.length, i = []; n--;) i[n] = t(e[n]); return i } function y(e, t) { var n = e.split("@"), i = ""; return n.length > 1 && (i = n[0] + "@", e = n[1]), i + _((e = e.replace(h, ".")).split("."), t).join(".") } function C(e) { for (var t, n, i = [], r = 0, o = e.length; r < o;) (t = e.charCodeAt(r++)) >= 55296 && t <= 56319 && r < o ? 56320 == (64512 & (n = e.charCodeAt(r++))) ? i.push(((1023 & t) << 10) + (1023 & n) + 65536) : (i.push(t), r--) : i.push(t); return i } function T(e) { return _(e, (function (e) { var t = ""; return e > 65535 && (t += m((e -= 65536) >>> 10 & 1023 | 55296), e = 56320 | 1023 & e), t += m(e) })).join("") } function S(e, t) { return e + 22 + 75 * (e < 26) - ((0 != t) << 5) } function A(e, t, n) { var i = 0; for (e = n ? f(e / 700) : e >> 1, e += f(e / t); e > 455; i += l) e = f(e / 35); return f(i + 36 * e / (e + 38)) } function v(e) { var t, n, i, r, o, a, s, u, d, h, p, m = [], _ = e.length, y = 0, C = 128, S = 72; for ((n = e.lastIndexOf("-")) < 0 && (n = 0), i = 0; i < n; ++i) e.charCodeAt(i) >= 128 && g("not-basic"), m.push(e.charCodeAt(i)); for (r = n > 0 ? n + 1 : 0; r < _;) { for (o = y, a = 1, s = l; r >= _ && g("invalid-input"), ((u = (p = e.charCodeAt(r++)) - 48 < 10 ? p - 22 : p - 65 < 26 ? p - 65 : p - 97 < 26 ? p - 97 : l) >= l || u > f((c - y) / a)) && g("overflow"), y += u * a, !(u < (d = s <= S ? 1 : s >= S + 26 ? 26 : s - S)); s += l) a > f(c / (h = l - d)) && g("overflow"), a *= h; S = A(y - o, t = m.length + 1, 0 == o), f(y / t) > c - C && g("overflow"), C += f(y / t), y %= t, m.splice(y++, 0, C) } return T(m) } function x(e) { var t, n, i, r, o, a, s, u, d, h, p, _, y, T, v, x = []; for (_ = (e = C(e)).length, t = 128, n = 0, o = 72, a = 0; a < _; ++a) (p = e[a]) < 128 && x.push(m(p)); for (i = r = x.length, r && x.push("-"); i < _;) { for (s = c, a = 0; a < _; ++a) (p = e[a]) >= t && p < s && (s = p); for (s - t > f((c - n) / (y = i + 1)) && g("overflow"), n += (s - t) * y, t = s, a = 0; a < _; ++a) if ((p = e[a]) < t && ++n > c && g("overflow"), p == t) { for (u = n, d = l; !(u < (h = d <= o ? 1 : d >= o + 26 ? 26 : d - o)); d += l) v = u - h, T = l - h, x.push(m(S(h + v % T, 0))), u = f(v / T); x.push(m(S(u, 0))), o = A(n, y, i == r), n = 0, ++i } ++n, ++t } return x.join("") } if (a = { version: "1.3.2", ucs2: {decode: C, encode: T}, decode: v, encode: x, toASCII: function (e) { return y(e, (function (e) { return d.test(e) ? "xn--" + x(e) : e })) }, toUnicode: function (e) { return y(e, (function (e) { return u.test(e) ? v(e.slice(4).toLowerCase()) : e })) } }, i && r) if (e.exports == i) r.exports = a; else for (s in a) a.hasOwnProperty(s) && (i[s] = a[s]); else n.punycode = a }(commonjsGlobal) })), IPv6 = createCommonjsModule((function (e) { /*! * URI.js - Mutating URLs * IPv6 Support * * Version: 1.19.7 * * Author: Rodney Rehm * Web: http://medialize.github.io/URI.js/ * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * */ var t, n; t = commonjsGlobal, n = function (e) { var t = e && e.IPv6; return { best: function (e) { var t, n, i = e.toLowerCase().split(":"), r = i.length, o = 8; for ("" === i[0] && "" === i[1] && "" === i[2] ? (i.shift(), i.shift()) : "" === i[0] && "" === i[1] ? i.shift() : "" === i[r - 1] && "" === i[r - 2] && i.pop(), -1 !== i[(r = i.length) - 1].indexOf(".") && (o = 7), t = 0; t < r && "" !== i[t]; t++) ; if (t < o) for (i.splice(t, 1, "0000"); i.length < o;) i.splice(t, 0, "0000"); for (var a = 0; a < o; a++) { n = i[a].split(""); for (var s = 0; s < 3 && "0" === n[0] && n.length > 1; s++) n.splice(0, 1); i[a] = n.join("") } var c = -1, l = 0, u = 0, d = -1, h = !1; for (a = 0; a < o; a++) h ? "0" === i[a] ? u += 1 : (h = !1, u > l && (c = d, l = u)) : "0" === i[a] && (h = !0, d = a, u = 1); u > l && (c = d, l = u), l > 1 && i.splice(c, l, ""), r = i.length; var p = ""; for ("" === i[0] && (p = ":"), a = 0; a < r && (p += i[a], a !== r - 1); a++) p += ":"; return "" === i[r - 1] && (p += ":"), p }, noConflict: function () { return e.IPv6 === this && (e.IPv6 = t), this } } }, e.exports ? e.exports = n() : t.IPv6 = n(t) })), SecondLevelDomains = createCommonjsModule((function (e) { /*! * URI.js - Mutating URLs * Second Level Domain (SLD) Support * * Version: 1.19.7 * * Author: Rodney Rehm * Web: http://medialize.github.io/URI.js/ * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * */ var t, n; t = commonjsGlobal, n = function (e) { var t = e && e.SecondLevelDomains, n = { list: { ac: " com gov mil net org ", ae: " ac co gov mil name net org pro sch ", af: " com edu gov net org ", al: " com edu gov mil net org ", ao: " co ed gv it og pb ", ar: " com edu gob gov int mil net org tur ", at: " ac co gv or ", au: " asn com csiro edu gov id net org ", ba: " co com edu gov mil net org rs unbi unmo unsa untz unze ", bb: " biz co com edu gov info net org store tv ", bh: " biz cc com edu gov info net org ", bn: " com edu gov net org ", bo: " com edu gob gov int mil net org tv ", br: " adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ", bs: " com edu gov net org ", bz: " du et om ov rg ", ca: " ab bc mb nb nf nl ns nt nu on pe qc sk yk ", ck: " biz co edu gen gov info net org ", cn: " ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ", co: " com edu gov mil net nom org ", cr: " ac c co ed fi go or sa ", cy: " ac biz com ekloges gov ltd name net org parliament press pro tm ", do: " art com edu gob gov mil net org sld web ", dz: " art asso com edu gov net org pol ", ec: " com edu fin gov info med mil net org pro ", eg: " com edu eun gov mil name net org sci ", er: " com edu gov ind mil net org rochest w ", es: " com edu gob nom org ", et: " biz com edu gov info name net org ", fj: " ac biz com info mil name net org pro ", fk: " ac co gov net nom org ", fr: " asso com f gouv nom prd presse tm ", gg: " co net org ", gh: " com edu gov mil org ", gn: " ac com gov net org ", gr: " com edu gov mil net org ", gt: " com edu gob ind mil net org ", gu: " com edu gov net org ", hk: " com edu gov idv net org ", hu: " 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ", id: " ac co go mil net or sch web ", il: " ac co gov idf k12 muni net org ", in: " ac co edu ernet firm gen gov i ind mil net nic org res ", iq: " com edu gov i mil net org ", ir: " ac co dnssec gov i id net org sch ", it: " edu gov ", je: " co net org ", jo: " com edu gov mil name net org sch ", jp: " ac ad co ed go gr lg ne or ", ke: " ac co go info me mobi ne or sc ", kh: " com edu gov mil net org per ", ki: " biz com de edu gov info mob net org tel ", km: " asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ", kn: " edu gov net org ", kr: " ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ", kw: " com edu gov net org ", ky: " com edu gov net org ", kz: " com edu gov mil net org ", lb: " com edu gov net org ", lk: " assn com edu gov grp hotel int ltd net ngo org sch soc web ", lr: " com edu gov net org ", lv: " asn com conf edu gov id mil net org ", ly: " com edu gov id med net org plc sch ", ma: " ac co gov m net org press ", mc: " asso tm ", me: " ac co edu gov its net org priv ", mg: " com edu gov mil nom org prd tm ", mk: " com edu gov inf name net org pro ", ml: " com edu gov net org presse ", mn: " edu gov org ", mo: " com edu gov net org ", mt: " com edu gov net org ", mv: " aero biz com coop edu gov info int mil museum name net org pro ", mw: " ac co com coop edu gov int museum net org ", mx: " com edu gob net org ", my: " com edu gov mil name net org sch ", nf: " arts com firm info net other per rec store web ", ng: " biz com edu gov mil mobi name net org sch ", ni: " ac co com edu gob mil net nom org ", np: " com edu gov mil net org ", nr: " biz com edu gov info net org ", om: " ac biz co com edu gov med mil museum net org pro sch ", pe: " com edu gob mil net nom org sld ", ph: " com edu gov i mil net ngo org ", pk: " biz com edu fam gob gok gon gop gos gov net org web ", pl: " art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ", pr: " ac biz com edu est gov info isla name net org pro prof ", ps: " com edu gov net org plo sec ", pw: " belau co ed go ne or ", ro: " arts com firm info nom nt org rec store tm www ", rs: " ac co edu gov in org ", sb: " com edu gov net org ", sc: " com edu gov net org ", sh: " co com edu gov net nom org ", sl: " com edu gov net org ", st: " co com consulado edu embaixada gov mil net org principe saotome store ", sv: " com edu gob org red ", sz: " ac co org ", tr: " av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ", tt: " aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ", tw: " club com ebiz edu game gov idv mil net org ", mu: " ac co com gov net or org ", mz: " ac co edu gov org ", na: " co com ", nz: " ac co cri geek gen govt health iwi maori mil net org parliament school ", pa: " abo ac com edu gob ing med net nom org sld ", pt: " com edu gov int net nome org publ ", py: " com edu gov mil net org ", qa: " com edu gov mil net org ", re: " asso com nom ", ru: " ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ", rw: " ac co com edu gouv gov int mil net ", sa: " com edu gov med net org pub sch ", sd: " com edu gov info med net org tv ", se: " a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ", sg: " com edu gov idn net org per ", sn: " art com edu gouv org perso univ ", sy: " com edu gov mil net news org ", th: " ac co go in mi net or ", tj: " ac biz co com edu go gov info int mil name net nic org test web ", tn: " agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ", tz: " ac co go ne or ", ua: " biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ", ug: " ac co go ne or org sc ", uk: " ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ", us: " dni fed isa kids nsn ", uy: " com edu gub mil net org ", ve: " co com edu gob info mil net org web ", vi: " co com k12 net org ", vn: " ac biz com edu gov health info int name net org pro ", ye: " co com gov ltd me net org plc ", yu: " ac co edu gov org ", za: " ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ", zm: " ac co com edu gov net org sch ", com: "ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ", net: "gb jp se uk ", org: "ae", de: "com " }, has: function (e) { var t = e.lastIndexOf("."); if (t <= 0 || t >= e.length - 1) return !1; var i = e.lastIndexOf(".", t - 1); if (i <= 0 || i >= t - 1) return !1; var r = n.list[e.slice(t + 1)]; return !!r && r.indexOf(" " + e.slice(i + 1, t) + " ") >= 0 }, is: function (e) { var t = e.lastIndexOf("."); if (t <= 0 || t >= e.length - 1) return !1; if (e.lastIndexOf(".", t - 1) >= 0) return !1; var i = n.list[e.slice(t + 1)]; return !!i && i.indexOf(" " + e.slice(0, t) + " ") >= 0 }, get: function (e) { var t = e.lastIndexOf("."); if (t <= 0 || t >= e.length - 1) return null; var i = e.lastIndexOf(".", t - 1); if (i <= 0 || i >= t - 1) return null; var r = n.list[e.slice(t + 1)]; return r ? r.indexOf(" " + e.slice(i + 1, t) + " ") < 0 ? null : e.slice(i + 1) : null }, noConflict: function () { return e.SecondLevelDomains === this && (e.SecondLevelDomains = t), this } }; return n }, e.exports ? e.exports = n() : t.SecondLevelDomains = n(t) })), URI = createCommonjsModule((function (e) { /*! * URI.js - Mutating URLs * * Version: 1.19.7 * * Author: Rodney Rehm * Web: http://medialize.github.io/URI.js/ * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * */ var t, n; t = commonjsGlobal, n = function (e, t, n, i) { var r = i && i.URI; function o(e, t) { var n = arguments.length >= 1, i = arguments.length >= 2; if (!(this instanceof o)) return n ? i ? new o(e, t) : new o(e) : new o; if (void 0 === e) { if (n) throw new TypeError("undefined is not a valid argument for URI"); e = "undefined" != typeof location ? location.href + "" : "" } if (null === e && n) throw new TypeError("null is not a valid argument for URI"); return this.href(e), void 0 !== t ? this.absoluteTo(t) : this } o.version = "1.19.7"; var a = o.prototype, s = Object.prototype.hasOwnProperty; function c(e) { return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1") } function l(e) { return void 0 === e ? "Undefined" : String(Object.prototype.toString.call(e)).slice(8, -1) } function u(e) { return "Array" === l(e) } function d(e, t) { var n, i, r = {}; if ("RegExp" === l(t)) r = null; else if (u(t)) for (n = 0, i = t.length; n < i; n++) r[t[n]] = !0; else r[t] = !0; for (n = 0, i = e.length; n < i; n++) (r && void 0 !== r[e[n]] || !r && t.test(e[n])) && (e.splice(n, 1), i--, n--); return e } function h(e, t) { var n, i; if (u(t)) { for (n = 0, i = t.length; n < i; n++) if (!h(e, t[n])) return !1; return !0 } var r = l(t); for (n = 0, i = e.length; n < i; n++) if ("RegExp" === r) { if ("string" == typeof e[n] && e[n].match(t)) return !0 } else if (e[n] === t) return !0; return !1 } function p(e, t) { if (!u(e) || !u(t)) return !1; if (e.length !== t.length) return !1; e.sort(), t.sort(); for (var n = 0, i = e.length; n < i; n++) if (e[n] !== t[n]) return !1; return !0 } function f(e) { return e.replace(/^\/+|\/+$/g, "") } function m(e) { return escape(e) } function g(e) { return encodeURIComponent(e).replace(/[!'()*]/g, m).replace(/\*/g, "%2A") } o._parts = function () { return { protocol: null, username: null, password: null, hostname: null, urn: null, port: null, path: null, query: null, fragment: null, preventInvalidHostname: o.preventInvalidHostname, duplicateQueryParameters: o.duplicateQueryParameters, escapeQuerySpace: o.escapeQuerySpace } }, o.preventInvalidHostname = !1, o.duplicateQueryParameters = !1, o.escapeQuerySpace = !0, o.protocol_expression = /^[a-z][a-z0-9.+-]*$/i, o.idn_expression = /[^a-z0-9\._-]/i, o.punycode_expression = /(xn--)/i, o.ip4_expression = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/, o.ip6_expression = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/, o.find_uri_expression = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi, o.findUri = { start: /\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi, end: /[\s\r\n]|$/, trim: /[`!()\[\]{};:'".,<>?«»“”„‘’]+$/, parens: /(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g }, o.defaultPorts = { http: "80", https: "443", ftp: "21", gopher: "70", ws: "80", wss: "443" }, o.hostProtocols = ["http", "https"], o.invalid_hostname_characters = /[^a-zA-Z0-9\.\-:_]/, o.domAttributes = { a: "href", blockquote: "cite", link: "href", base: "href", script: "src", form: "action", img: "src", area: "href", iframe: "src", embed: "src", source: "src", track: "src", input: "src", audio: "src", video: "src" }, o.getDomAttribute = function (e) { if (e && e.nodeName) { var t = e.nodeName.toLowerCase(); if ("input" !== t || "image" === e.type) return o.domAttributes[t] } }, o.encode = g, o.decode = decodeURIComponent, o.iso8859 = function () { o.encode = escape, o.decode = unescape }, o.unicode = function () { o.encode = g, o.decode = decodeURIComponent }, o.characters = { pathname: { encode: { expression: /%(24|26|2B|2C|3B|3D|3A|40)/gi, map: { "%24": "$", "%26": "&", "%2B": "+", "%2C": ",", "%3B": ";", "%3D": "=", "%3A": ":", "%40": "@" } }, decode: {expression: /[\/\?#]/g, map: {"/": "%2F", "?": "%3F", "#": "%23"}} }, reserved: { encode: { expression: /%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi, map: { "%3A": ":", "%2F": "/", "%3F": "?", "%23": "#", "%5B": "[", "%5D": "]", "%40": "@", "%21": "!", "%24": "$", "%26": "&", "%27": "'", "%28": "(", "%29": ")", "%2A": "*", "%2B": "+", "%2C": ",", "%3B": ";", "%3D": "=" } } }, urnpath: { encode: { expression: /%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/gi, map: { "%21": "!", "%24": "$", "%27": "'", "%28": "(", "%29": ")", "%2A": "*", "%2B": "+", "%2C": ",", "%3B": ";", "%3D": "=", "%40": "@" } }, decode: {expression: /[\/\?#:]/g, map: {"/": "%2F", "?": "%3F", "#": "%23", ":": "%3A"}} } }, o.encodeQuery = function (e, t) { var n = o.encode(e + ""); return void 0 === t && (t = o.escapeQuerySpace), t ? n.replace(/%20/g, "+") : n }, o.decodeQuery = function (e, t) { e += "", void 0 === t && (t = o.escapeQuerySpace); try { return o.decode(t ? e.replace(/\+/g, "%20") : e) } catch (t) { return e } }; var _, y = {encode: "encode", decode: "decode"}, C = function (e, t) { return function (n) { try { return o[t](n + "").replace(o.characters[e][t].expression, (function (n) { return o.characters[e][t].map[n] })) } catch (e) { return n } } }; for (_ in y) o[_ + "PathSegment"] = C("pathname", y[_]), o[_ + "UrnPathSegment"] = C("urnpath", y[_]); var T = function (e, t, n) { return function (i) { var r; r = n ? function (e) { return o[t](o[n](e)) } : o[t]; for (var a = (i + "").split(e), s = 0, c = a.length; s < c; s++) a[s] = r(a[s]); return a.join(e) } }; function S(e) { return function (t, n) { return void 0 === t ? this._parts[e] || "" : (this._parts[e] = t || null, this.build(!n), this) } } function A(e, t) { return function (n, i) { return void 0 === n ? this._parts[e] || "" : (null !== n && (n += "").charAt(0) === t && (n = n.substring(1)), this._parts[e] = n, this.build(!i), this) } } o.decodePath = T("/", "decodePathSegment"), o.decodeUrnPath = T(":", "decodeUrnPathSegment"), o.recodePath = T("/", "encodePathSegment", "decode"), o.recodeUrnPath = T(":", "encodeUrnPathSegment", "decode"), o.encodeReserved = C("reserved", "encode"), o.parse = function (e, t) { var n; return t || (t = {preventInvalidHostname: o.preventInvalidHostname}), (n = e.indexOf("#")) > -1 && (t.fragment = e.substring(n + 1) || null, e = e.substring(0, n)), (n = e.indexOf("?")) > -1 && (t.query = e.substring(n + 1) || null, e = e.substring(0, n)), "//" === (e = e.replace(/^(https?|ftp|wss?)?:[/\\]*/, "$1://")).substring(0, 2) ? (t.protocol = null, e = e.substring(2), e = o.parseAuthority(e, t)) : (n = e.indexOf(":")) > -1 && (t.protocol = e.substring(0, n) || null, t.protocol && !t.protocol.match(o.protocol_expression) ? t.protocol = void 0 : "//" === e.substring(n + 1, n + 3).replace(/\\/g, "/") ? (e = e.substring(n + 3), e = o.parseAuthority(e, t)) : (e = e.substring(n + 1), t.urn = !0)), t.path = e, t }, o.parseHost = function (e, t) { e || (e = ""); var n, i, r = (e = e.replace(/\\/g, "/")).indexOf("/"); if (-1 === r && (r = e.length), "[" === e.charAt(0)) n = e.indexOf("]"), t.hostname = e.substring(1, n) || null, t.port = e.substring(n + 2, r) || null, "/" === t.port && (t.port = null); else { var a = e.indexOf(":"), s = e.indexOf("/"), c = e.indexOf(":", a + 1); -1 !== c && (-1 === s || c < s) ? (t.hostname = e.substring(0, r) || null, t.port = null) : (i = e.substring(0, r).split(":"), t.hostname = i[0] || null, t.port = i[1] || null) } return t.hostname && "/" !== e.substring(r).charAt(0) && (r++, e = "/" + e), t.preventInvalidHostname && o.ensureValidHostname(t.hostname, t.protocol), t.port && o.ensureValidPort(t.port), e.substring(r) || "/" }, o.parseAuthority = function (e, t) { return e = o.parseUserinfo(e, t), o.parseHost(e, t) }, o.parseUserinfo = function (e, t) { var n = e; -1 !== e.indexOf("\\") && (e = e.replace(/\\/g, "/")); var i, r = e.indexOf("/"), a = e.lastIndexOf("@", r > -1 ? r : e.length - 1); return a > -1 && (-1 === r || a < r) ? (i = e.substring(0, a).split(":"), t.username = i[0] ? o.decode(i[0]) : null, i.shift(), t.password = i[0] ? o.decode(i.join(":")) : null, e = n.substring(a + 1)) : (t.username = null, t.password = null), e }, o.parseQuery = function (e, t) { if (!e) return {}; if (!(e = e.replace(/&+/g, "&").replace(/^\?*&*|&+$/g, ""))) return {}; for (var n, i, r, a = {}, c = e.split("&"), l = c.length, u = 0; u < l; u++) n = c[u].split("="), i = o.decodeQuery(n.shift(), t), r = n.length ? o.decodeQuery(n.join("="), t) : null, "__proto__" !== i && (s.call(a, i) ? ("string" != typeof a[i] && null !== a[i] || (a[i] = [a[i]]), a[i].push(r)) : a[i] = r); return a }, o.build = function (e) { var t = "", n = !1; return e.protocol && (t += e.protocol + ":"), e.urn || !t && !e.hostname || (t += "//", n = !0), t += o.buildAuthority(e) || "", "string" == typeof e.path && ("/" !== e.path.charAt(0) && n && (t += "/"), t += e.path), "string" == typeof e.query && e.query && (t += "?" + e.query), "string" == typeof e.fragment && e.fragment && (t += "#" + e.fragment), t }, o.buildHost = function (e) { var t = ""; return e.hostname ? (o.ip6_expression.test(e.hostname) ? t += "[" + e.hostname + "]" : t += e.hostname, e.port && (t += ":" + e.port), t) : "" }, o.buildAuthority = function (e) { return o.buildUserinfo(e) + o.buildHost(e) }, o.buildUserinfo = function (e) { var t = ""; return e.username && (t += o.encode(e.username)), e.password && (t += ":" + o.encode(e.password)), t && (t += "@"), t }, o.buildQuery = function (e, t, n) { var i, r, a, c, l = ""; for (r in e) if ("__proto__" !== r && s.call(e, r)) if (u(e[r])) for (i = {}, a = 0, c = e[r].length; a < c; a++) void 0 !== e[r][a] && void 0 === i[e[r][a] + ""] && (l += "&" + o.buildQueryParameter(r, e[r][a], n), !0 !== t && (i[e[r][a] + ""] = !0)); else void 0 !== e[r] && (l += "&" + o.buildQueryParameter(r, e[r], n)); return l.substring(1) }, o.buildQueryParameter = function (e, t, n) { return o.encodeQuery(e, n) + (null !== t ? "=" + o.encodeQuery(t, n) : "") }, o.addQuery = function (e, t, n) { if ("object" == typeof t) for (var i in t) s.call(t, i) && o.addQuery(e, i, t[i]); else { if ("string" != typeof t) throw new TypeError("URI.addQuery() accepts an object, string as the name parameter"); if (void 0 === e[t]) return void (e[t] = n); "string" == typeof e[t] && (e[t] = [e[t]]), u(n) || (n = [n]), e[t] = (e[t] || []).concat(n) } }, o.setQuery = function (e, t, n) { if ("object" == typeof t) for (var i in t) s.call(t, i) && o.setQuery(e, i, t[i]); else { if ("string" != typeof t) throw new TypeError("URI.setQuery() accepts an object, string as the name parameter"); e[t] = void 0 === n ? null : n } }, o.removeQuery = function (e, t, n) { var i, r, a; if (u(t)) for (i = 0, r = t.length; i < r; i++) e[t[i]] = void 0; else if ("RegExp" === l(t)) for (a in e) t.test(a) && (e[a] = void 0); else if ("object" == typeof t) for (a in t) s.call(t, a) && o.removeQuery(e, a, t[a]); else { if ("string" != typeof t) throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter"); void 0 !== n ? "RegExp" === l(n) ? !u(e[t]) && n.test(e[t]) ? e[t] = void 0 : e[t] = d(e[t], n) : e[t] !== String(n) || u(n) && 1 !== n.length ? u(e[t]) && (e[t] = d(e[t], n)) : e[t] = void 0 : e[t] = void 0 } }, o.hasQuery = function (e, t, n, i) { switch (l(t)) { case"String": break; case"RegExp": for (var r in e) if (s.call(e, r) && t.test(r) && (void 0 === n || o.hasQuery(e, r, n))) return !0; return !1; case"Object": for (var a in t) if (s.call(t, a) && !o.hasQuery(e, a, t[a])) return !1; return !0; default: throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter") } switch (l(n)) { case"Undefined": return t in e; case"Boolean": return n === Boolean(u(e[t]) ? e[t].length : e[t]); case"Function": return !!n(e[t], t, e); case"Array": return !!u(e[t]) && (i ? h : p)(e[t], n); case"RegExp": return u(e[t]) ? !!i && h(e[t], n) : Boolean(e[t] && e[t].match(n)); case"Number": n = String(n); case"String": return u(e[t]) ? !!i && h(e[t], n) : e[t] === n; default: throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter") } }, o.joinPaths = function () { for (var e = [], t = [], n = 0, i = 0; i < arguments.length; i++) { var r = new o(arguments[i]); e.push(r); for (var a = r.segment(), s = 0; s < a.length; s++) "string" == typeof a[s] && t.push(a[s]), a[s] && n++ } if (!t.length || !n) return new o(""); var c = new o("").segment(t); return "" !== e[0].path() && "/" !== e[0].path().slice(0, 1) || c.path("/" + c.path()), c.normalize() }, o.commonPath = function (e, t) { var n, i = Math.min(e.length, t.length); for (n = 0; n < i; n++) if (e.charAt(n) !== t.charAt(n)) { n--; break } return n < 1 ? e.charAt(0) === t.charAt(0) && "/" === e.charAt(0) ? "/" : "" : ("/" === e.charAt(n) && "/" === t.charAt(n) || (n = e.substring(0, n).lastIndexOf("/")), e.substring(0, n + 1)) }, o.withinString = function (e, t, n) { n || (n = {}); var i = n.start || o.findUri.start, r = n.end || o.findUri.end, a = n.trim || o.findUri.trim, s = n.parens || o.findUri.parens, c = /[a-z0-9-]=["']?$/i; for (i.lastIndex = 0; ;) { var l = i.exec(e); if (!l) break; var u = l.index; if (n.ignoreHtml) { var d = e.slice(Math.max(u - 3, 0), u); if (d && c.test(d)) continue } for (var h = u + e.slice(u).search(r), p = e.slice(u, h), f = -1; ;) { var m = s.exec(p); if (!m) break; var g = m.index + m[0].length; f = Math.max(f, g) } if (!((p = f > -1 ? p.slice(0, f) + p.slice(f).replace(a, "") : p.replace(a, "")).length <= l[0].length || n.ignore && n.ignore.test(p))) { var _ = t(p, u, h = u + p.length, e); void 0 !== _ ? (_ = String(_), e = e.slice(0, u) + _ + e.slice(h), i.lastIndex = u + _.length) : i.lastIndex = h } } return i.lastIndex = 0, e }, o.ensureValidHostname = function (t, n) { var i = !!t, r = !1; if (!!n && (r = h(o.hostProtocols, n)), r && !i) throw new TypeError("Hostname cannot be empty, if protocol is " + n); if (t && t.match(o.invalid_hostname_characters)) { if (!e) throw new TypeError('Hostname "' + t + '" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available'); if (e.toASCII(t).match(o.invalid_hostname_characters)) throw new TypeError('Hostname "' + t + '" contains characters other than [A-Z0-9.-:_]') } }, o.ensureValidPort = function (e) { if (e) { var t = Number(e); if (!(/^[0-9]+$/.test(t) && t > 0 && t < 65536)) throw new TypeError('Port "' + e + '" is not a valid port') } }, o.noConflict = function (e) { if (e) { var t = {URI: this.noConflict()}; return i.URITemplate && "function" == typeof i.URITemplate.noConflict && (t.URITemplate = i.URITemplate.noConflict()), i.IPv6 && "function" == typeof i.IPv6.noConflict && (t.IPv6 = i.IPv6.noConflict()), i.SecondLevelDomains && "function" == typeof i.SecondLevelDomains.noConflict && (t.SecondLevelDomains = i.SecondLevelDomains.noConflict()), t } return i.URI === this && (i.URI = r), this }, a.build = function (e) { return !0 === e ? this._deferred_build = !0 : (void 0 === e || this._deferred_build) && (this._string = o.build(this._parts), this._deferred_build = !1), this }, a.clone = function () { return new o(this) }, a.valueOf = a.toString = function () { return this.build(!1)._string }, a.protocol = S("protocol"), a.username = S("username"), a.password = S("password"), a.hostname = S("hostname"), a.port = S("port"), a.query = A("query", "?"), a.fragment = A("fragment", "#"), a.search = function (e, t) { var n = this.query(e, t); return "string" == typeof n && n.length ? "?" + n : n }, a.hash = function (e, t) { var n = this.fragment(e, t); return "string" == typeof n && n.length ? "#" + n : n }, a.pathname = function (e, t) { if (void 0 === e || !0 === e) { var n = this._parts.path || (this._parts.hostname ? "/" : ""); return e ? (this._parts.urn ? o.decodeUrnPath : o.decodePath)(n) : n } return this._parts.urn ? this._parts.path = e ? o.recodeUrnPath(e) : "" : this._parts.path = e ? o.recodePath(e) : "/", this.build(!t), this }, a.path = a.pathname, a.href = function (e, t) { var n; if (void 0 === e) return this.toString(); this._string = "", this._parts = o._parts(); var i = e instanceof o, r = "object" == typeof e && (e.hostname || e.path || e.pathname); if (e.nodeName && (e = e[o.getDomAttribute(e)] || "", r = !1), !i && r && void 0 !== e.pathname && (e = e.toString()), "string" == typeof e || e instanceof String) this._parts = o.parse(String(e), this._parts); else { if (!i && !r) throw new TypeError("invalid input"); var a = i ? e._parts : e; for (n in a) "query" !== n && s.call(this._parts, n) && (this._parts[n] = a[n]); a.query && this.query(a.query, !1) } return this.build(!t), this }, a.is = function (e) { var t = !1, i = !1, r = !1, a = !1, s = !1, c = !1, l = !1, u = !this._parts.urn; switch (this._parts.hostname && (u = !1, i = o.ip4_expression.test(this._parts.hostname), r = o.ip6_expression.test(this._parts.hostname), s = (a = !(t = i || r)) && n && n.has(this._parts.hostname), c = a && o.idn_expression.test(this._parts.hostname), l = a && o.punycode_expression.test(this._parts.hostname)), e.toLowerCase()) { case"relative": return u; case"absolute": return !u; case"domain": case"name": return a; case"sld": return s; case"ip": return t; case"ip4": case"ipv4": case"inet4": return i; case"ip6": case"ipv6": case"inet6": return r; case"idn": return c; case"url": return !this._parts.urn; case"urn": return !!this._parts.urn; case"punycode": return l } return null }; var v = a.protocol, x = a.port, b = a.hostname; a.protocol = function (e, t) { if (e && !(e = e.replace(/:(\/\/)?$/, "")).match(o.protocol_expression)) throw new TypeError('Protocol "' + e + "\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]"); return v.call(this, e, t) }, a.scheme = a.protocol, a.port = function (e, t) { return this._parts.urn ? void 0 === e ? "" : this : (void 0 !== e && (0 === e && (e = null), e && (":" === (e += "").charAt(0) && (e = e.substring(1)), o.ensureValidPort(e))), x.call(this, e, t)) }, a.hostname = function (e, t) { if (this._parts.urn) return void 0 === e ? "" : this; if (void 0 !== e) { var n = {preventInvalidHostname: this._parts.preventInvalidHostname}; if ("/" !== o.parseHost(e, n)) throw new TypeError('Hostname "' + e + '" contains characters other than [A-Z0-9.-]'); e = n.hostname, this._parts.preventInvalidHostname && o.ensureValidHostname(e, this._parts.protocol) } return b.call(this, e, t) }, a.origin = function (e, t) { if (this._parts.urn) return void 0 === e ? "" : this; if (void 0 === e) { var n = this.protocol(); return this.authority() ? (n ? n + "://" : "") + this.authority() : "" } var i = o(e); return this.protocol(i.protocol()).authority(i.authority()).build(!t), this }, a.host = function (e, t) { if (this._parts.urn) return void 0 === e ? "" : this; if (void 0 === e) return this._parts.hostname ? o.buildHost(this._parts) : ""; if ("/" !== o.parseHost(e, this._parts)) throw new TypeError('Hostname "' + e + '" contains characters other than [A-Z0-9.-]'); return this.build(!t), this }, a.authority = function (e, t) { if (this._parts.urn) return void 0 === e ? "" : this; if (void 0 === e) return this._parts.hostname ? o.buildAuthority(this._parts) : ""; if ("/" !== o.parseAuthority(e, this._parts)) throw new TypeError('Hostname "' + e + '" contains characters other than [A-Z0-9.-]'); return this.build(!t), this }, a.userinfo = function (e, t) { if (this._parts.urn) return void 0 === e ? "" : this; if (void 0 === e) { var n = o.buildUserinfo(this._parts); return n ? n.substring(0, n.length - 1) : n } return "@" !== e[e.length - 1] && (e += "@"), o.parseUserinfo(e, this._parts), this.build(!t), this }, a.resource = function (e, t) { var n; return void 0 === e ? this.path() + this.search() + this.hash() : (n = o.parse(e), this._parts.path = n.path, this._parts.query = n.query, this._parts.fragment = n.fragment, this.build(!t), this) }, a.subdomain = function (e, t) { if (this._parts.urn) return void 0 === e ? "" : this; if (void 0 === e) { if (!this._parts.hostname || this.is("IP")) return ""; var n = this._parts.hostname.length - this.domain().length - 1; return this._parts.hostname.substring(0, n) || "" } var i = this._parts.hostname.length - this.domain().length, r = this._parts.hostname.substring(0, i), a = new RegExp("^" + c(r)); if (e && "." !== e.charAt(e.length - 1) && (e += "."), -1 !== e.indexOf(":")) throw new TypeError("Domains cannot contain colons"); return e && o.ensureValidHostname(e, this._parts.protocol), this._parts.hostname = this._parts.hostname.replace(a, e), this.build(!t), this }, a.domain = function (e, t) { if (this._parts.urn) return void 0 === e ? "" : this; if ("boolean" == typeof e && (t = e, e = void 0), void 0 === e) { if (!this._parts.hostname || this.is("IP")) return ""; var n = this._parts.hostname.match(/\./g); if (n && n.length < 2) return this._parts.hostname; var i = this._parts.hostname.length - this.tld(t).length - 1; return i = this._parts.hostname.lastIndexOf(".", i - 1) + 1, this._parts.hostname.substring(i) || "" } if (!e) throw new TypeError("cannot set domain empty"); if (-1 !== e.indexOf(":")) throw new TypeError("Domains cannot contain colons"); if (o.ensureValidHostname(e, this._parts.protocol), !this._parts.hostname || this.is("IP")) this._parts.hostname = e; else { var r = new RegExp(c(this.domain()) + "$"); this._parts.hostname = this._parts.hostname.replace(r, e) } return this.build(!t), this }, a.tld = function (e, t) { if (this._parts.urn) return void 0 === e ? "" : this; if ("boolean" == typeof e && (t = e, e = void 0), void 0 === e) { if (!this._parts.hostname || this.is("IP")) return ""; var i = this._parts.hostname.lastIndexOf("."), r = this._parts.hostname.substring(i + 1); return !0 !== t && n && n.list[r.toLowerCase()] && n.get(this._parts.hostname) || r } var o; if (!e) throw new TypeError("cannot set TLD empty"); if (e.match(/[^a-zA-Z0-9-]/)) { if (!n || !n.is(e)) throw new TypeError('TLD "' + e + '" contains characters other than [A-Z0-9]'); o = new RegExp(c(this.tld()) + "$"), this._parts.hostname = this._parts.hostname.replace(o, e) } else { if (!this._parts.hostname || this.is("IP")) throw new ReferenceError("cannot set TLD on non-domain host"); o = new RegExp(c(this.tld()) + "$"), this._parts.hostname = this._parts.hostname.replace(o, e) } return this.build(!t), this }, a.directory = function (e, t) { if (this._parts.urn) return void 0 === e ? "" : this; if (void 0 === e || !0 === e) { if (!this._parts.path && !this._parts.hostname) return ""; if ("/" === this._parts.path) return "/"; var n = this._parts.path.length - this.filename().length - 1, i = this._parts.path.substring(0, n) || (this._parts.hostname ? "/" : ""); return e ? o.decodePath(i) : i } var r = this._parts.path.length - this.filename().length, a = this._parts.path.substring(0, r), s = new RegExp("^" + c(a)); return this.is("relative") || (e || (e = "/"), "/" !== e.charAt(0) && (e = "/" + e)), e && "/" !== e.charAt(e.length - 1) && (e += "/"), e = o.recodePath(e), this._parts.path = this._parts.path.replace(s, e), this.build(!t), this }, a.filename = function (e, t) { if (this._parts.urn) return void 0 === e ? "" : this; if ("string" != typeof e) { if (!this._parts.path || "/" === this._parts.path) return ""; var n = this._parts.path.lastIndexOf("/"), i = this._parts.path.substring(n + 1); return e ? o.decodePathSegment(i) : i } var r = !1; "/" === e.charAt(0) && (e = e.substring(1)), e.match(/\.?\//) && (r = !0); var a = new RegExp(c(this.filename()) + "$"); return e = o.recodePath(e), this._parts.path = this._parts.path.replace(a, e), r ? this.normalizePath(t) : this.build(!t), this }, a.suffix = function (e, t) { if (this._parts.urn) return void 0 === e ? "" : this; if (void 0 === e || !0 === e) { if (!this._parts.path || "/" === this._parts.path) return ""; var n, i, r = this.filename(), a = r.lastIndexOf("."); return -1 === a ? "" : (n = r.substring(a + 1), i = /^[a-z0-9%]+$/i.test(n) ? n : "", e ? o.decodePathSegment(i) : i) } "." === e.charAt(0) && (e = e.substring(1)); var s, l = this.suffix(); if (l) s = e ? new RegExp(c(l) + "$") : new RegExp(c("." + l) + "$"); else { if (!e) return this; this._parts.path += "." + o.recodePath(e) } return s && (e = o.recodePath(e), this._parts.path = this._parts.path.replace(s, e)), this.build(!t), this }, a.segment = function (e, t, n) { var i = this._parts.urn ? ":" : "/", r = this.path(), o = "/" === r.substring(0, 1), a = r.split(i); if (void 0 !== e && "number" != typeof e && (n = t, t = e, e = void 0), void 0 !== e && "number" != typeof e) throw new Error('Bad segment "' + e + '", must be 0-based integer'); if (o && a.shift(), e < 0 && (e = Math.max(a.length + e, 0)), void 0 === t) return void 0 === e ? a : a[e]; if (null === e || void 0 === a[e]) if (u(t)) { a = []; for (var s = 0, c = t.length; s < c; s++) (t[s].length || a.length && a[a.length - 1].length) && (a.length && !a[a.length - 1].length && a.pop(), a.push(f(t[s]))) } else (t || "string" == typeof t) && (t = f(t), "" === a[a.length - 1] ? a[a.length - 1] = t : a.push(t)); else t ? a[e] = f(t) : a.splice(e, 1); return o && a.unshift(""), this.path(a.join(i), n) }, a.segmentCoded = function (e, t, n) { var i, r, a; if ("number" != typeof e && (n = t, t = e, e = void 0), void 0 === t) { if (u(i = this.segment(e, t, n))) for (r = 0, a = i.length; r < a; r++) i[r] = o.decode(i[r]); else i = void 0 !== i ? o.decode(i) : void 0; return i } if (u(t)) for (r = 0, a = t.length; r < a; r++) t[r] = o.encode(t[r]); else t = "string" == typeof t || t instanceof String ? o.encode(t) : t; return this.segment(e, t, n) }; var E = a.query; return a.query = function (e, t) { if (!0 === e) return o.parseQuery(this._parts.query, this._parts.escapeQuerySpace); if ("function" == typeof e) { var n = o.parseQuery(this._parts.query, this._parts.escapeQuerySpace), i = e.call(this, n); return this._parts.query = o.buildQuery(i || n, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), this.build(!t), this } return void 0 !== e && "string" != typeof e ? (this._parts.query = o.buildQuery(e, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), this.build(!t), this) : E.call(this, e, t) }, a.setQuery = function (e, t, n) { var i = o.parseQuery(this._parts.query, this._parts.escapeQuerySpace); if ("string" == typeof e || e instanceof String) i[e] = void 0 !== t ? t : null; else { if ("object" != typeof e) throw new TypeError("URI.addQuery() accepts an object, string as the name parameter"); for (var r in e) s.call(e, r) && (i[r] = e[r]) } return this._parts.query = o.buildQuery(i, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), "string" != typeof e && (n = t), this.build(!n), this }, a.addQuery = function (e, t, n) { var i = o.parseQuery(this._parts.query, this._parts.escapeQuerySpace); return o.addQuery(i, e, void 0 === t ? null : t), this._parts.query = o.buildQuery(i, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), "string" != typeof e && (n = t), this.build(!n), this }, a.removeQuery = function (e, t, n) { var i = o.parseQuery(this._parts.query, this._parts.escapeQuerySpace); return o.removeQuery(i, e, t), this._parts.query = o.buildQuery(i, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), "string" != typeof e && (n = t), this.build(!n), this }, a.hasQuery = function (e, t, n) { var i = o.parseQuery(this._parts.query, this._parts.escapeQuerySpace); return o.hasQuery(i, e, t, n) }, a.setSearch = a.setQuery, a.addSearch = a.addQuery, a.removeSearch = a.removeQuery, a.hasSearch = a.hasQuery, a.normalize = function () { return this._parts.urn ? this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build() : this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build() }, a.normalizeProtocol = function (e) { return "string" == typeof this._parts.protocol && (this._parts.protocol = this._parts.protocol.toLowerCase(), this.build(!e)), this }, a.normalizeHostname = function (n) { return this._parts.hostname && (this.is("IDN") && e ? this._parts.hostname = e.toASCII(this._parts.hostname) : this.is("IPv6") && t && (this._parts.hostname = t.best(this._parts.hostname)), this._parts.hostname = this._parts.hostname.toLowerCase(), this.build(!n)), this }, a.normalizePort = function (e) { return "string" == typeof this._parts.protocol && this._parts.port === o.defaultPorts[this._parts.protocol] && (this._parts.port = null, this.build(!e)), this }, a.normalizePath = function (e) { var t, n = this._parts.path; if (!n) return this; if (this._parts.urn) return this._parts.path = o.recodeUrnPath(this._parts.path), this.build(!e), this; if ("/" === this._parts.path) return this; var i, r, a = ""; for ("/" !== (n = o.recodePath(n)).charAt(0) && (t = !0, n = "/" + n), "/.." !== n.slice(-3) && "/." !== n.slice(-2) || (n += "/"), n = n.replace(/(\/(\.\/)+)|(\/\.$)/g, "/").replace(/\/{2,}/g, "/"), t && (a = n.substring(1).match(/^(\.\.\/)+/) || "") && (a = a[0]); -1 !== (i = n.search(/\/\.\.(\/|$)/));) 0 !== i ? (-1 === (r = n.substring(0, i).lastIndexOf("/")) && (r = i), n = n.substring(0, r) + n.substring(i + 3)) : n = n.substring(3); return t && this.is("relative") && (n = a + n.substring(1)), this._parts.path = n, this.build(!e), this }, a.normalizePathname = a.normalizePath, a.normalizeQuery = function (e) { return "string" == typeof this._parts.query && (this._parts.query.length ? this.query(o.parseQuery(this._parts.query, this._parts.escapeQuerySpace)) : this._parts.query = null, this.build(!e)), this }, a.normalizeFragment = function (e) { return this._parts.fragment || (this._parts.fragment = null, this.build(!e)), this }, a.normalizeSearch = a.normalizeQuery, a.normalizeHash = a.normalizeFragment, a.iso8859 = function () { var e = o.encode, t = o.decode; o.encode = escape, o.decode = decodeURIComponent; try { this.normalize() } finally { o.encode = e, o.decode = t } return this }, a.unicode = function () { var e = o.encode, t = o.decode; o.encode = g, o.decode = unescape; try { this.normalize() } finally { o.encode = e, o.decode = t } return this }, a.readable = function () { var t = this.clone(); t.username("").password("").normalize(); var n = ""; if (t._parts.protocol && (n += t._parts.protocol + "://"), t._parts.hostname && (t.is("punycode") && e ? (n += e.toUnicode(t._parts.hostname), t._parts.port && (n += ":" + t._parts.port)) : n += t.host()), t._parts.hostname && t._parts.path && "/" !== t._parts.path.charAt(0) && (n += "/"), n += t.path(!0), t._parts.query) { for (var i = "", r = 0, a = t._parts.query.split("&"), s = a.length; r < s; r++) { var c = (a[r] || "").split("="); i += "&" + o.decodeQuery(c[0], this._parts.escapeQuerySpace).replace(/&/g, "%26"), void 0 !== c[1] && (i += "=" + o.decodeQuery(c[1], this._parts.escapeQuerySpace).replace(/&/g, "%26")) } n += "?" + i.substring(1) } return n += o.decodeQuery(t.hash(), !0) }, a.absoluteTo = function (e) { var t, n, i, r = this.clone(), a = ["protocol", "username", "password", "hostname", "port"]; if (this._parts.urn) throw new Error("URNs do not have any generally defined hierarchical components"); if (e instanceof o || (e = new o(e)), r._parts.protocol) return r; if (r._parts.protocol = e._parts.protocol, this._parts.hostname) return r; for (n = 0; i = a[n]; n++) r._parts[i] = e._parts[i]; return r._parts.path ? (".." === r._parts.path.substring(-2) && (r._parts.path += "/"), "/" !== r.path().charAt(0) && (t = (t = e.directory()) || (0 === e.path().indexOf("/") ? "/" : ""), r._parts.path = (t ? t + "/" : "") + r._parts.path, r.normalizePath())) : (r._parts.path = e._parts.path, r._parts.query || (r._parts.query = e._parts.query)), r.build(), r }, a.relativeTo = function (e) { var t, n, i, r, a, s = this.clone().normalize(); if (s._parts.urn) throw new Error("URNs do not have any generally defined hierarchical components"); if (e = new o(e).normalize(), t = s._parts, n = e._parts, r = s.path(), a = e.path(), "/" !== r.charAt(0)) throw new Error("URI is already relative"); if ("/" !== a.charAt(0)) throw new Error("Cannot calculate a URI relative to another relative URI"); if (t.protocol === n.protocol && (t.protocol = null), t.username !== n.username || t.password !== n.password) return s.build(); if (null !== t.protocol || null !== t.username || null !== t.password) return s.build(); if (t.hostname !== n.hostname || t.port !== n.port) return s.build(); if (t.hostname = null, t.port = null, r === a) return t.path = "", s.build(); if (!(i = o.commonPath(r, a))) return s.build(); var c = n.path.substring(i.length).replace(/[^\/]*$/, "").replace(/.*?\//g, "../"); return t.path = c + t.path.substring(i.length) || "./", s.build() }, a.equals = function (e) { var t, n, i, r, a, c = this.clone(), l = new o(e), d = {}; if (c.normalize(), l.normalize(), c.toString() === l.toString()) return !0; if (i = c.query(), r = l.query(), c.query(""), l.query(""), c.toString() !== l.toString()) return !1; if (i.length !== r.length) return !1; for (a in t = o.parseQuery(i, this._parts.escapeQuerySpace), n = o.parseQuery(r, this._parts.escapeQuerySpace), t) if (s.call(t, a)) { if (u(t[a])) { if (!p(t[a], n[a])) return !1 } else if (t[a] !== n[a]) return !1; d[a] = !0 } for (a in n) if (s.call(n, a) && !d[a]) return !1; return !0 }, a.preventInvalidHostname = function (e) { return this._parts.preventInvalidHostname = !!e, this }, a.duplicateQueryParameters = function (e) { return this._parts.duplicateQueryParameters = !!e, this }, a.escapeQuerySpace = function (e) { return this._parts.escapeQuerySpace = !!e, this }, o }, e.exports ? e.exports = n(punycode, IPv6, SecondLevelDomains) : t.URI = n(t.punycode, t.IPv6, t.SecondLevelDomains, t) })); function getAbsoluteUri(e, t) { let n; return "undefined" != typeof document && (n = document), getAbsoluteUri._implementation(e, t, n) } function clone$1(e, t) { if (null === e || "object" != typeof e) return e; t = defaultValue(t, !1); const n = new e.constructor; for (const i in e) if (e.hasOwnProperty(i)) { let r = e[i]; t && (r = clone$1(r, t)), n[i] = r } return n } function combine$2(e, t, n) { n = defaultValue(n, !1); const i = {}, r = defined(e), o = defined(t); let a, s, c; if (r) for (a in e) e.hasOwnProperty(a) && (s = e[a], o && n && "object" == typeof s && t.hasOwnProperty(a) ? (c = t[a], i[a] = "object" == typeof c ? combine$2(s, c, n) : s) : i[a] = s); if (o) for (a in t) t.hasOwnProperty(a) && !i.hasOwnProperty(a) && (c = t[a], i[a] = c); return i } function defer() { let e, t; const n = new Promise((function (n, i) { e = n, t = i })); return {resolve: e, reject: t, promise: n} } function getBaseUri(e, t) { let n = ""; const i = e.lastIndexOf("/"); return -1 !== i && (n = e.substring(0, i + 1)), t ? (0 !== (e = new URI(e)).query().length && (n += `?${e.query()}`), 0 !== e.fragment().length && (n += `#${e.fragment()}`), n) : n } function getExtensionFromUri(e) { const t = new URI(e); t.normalize(); let n = t.path(), i = n.lastIndexOf("/"); return -1 !== i && (n = n.substr(i + 1)), i = n.lastIndexOf("."), n = -1 === i ? "" : n.substr(i + 1), n } getAbsoluteUri._implementation = function (e, t, n) { if (!defined(t)) { if (void 0 === n) return e; t = defaultValue(n.baseURI, n.location.href) } const i = new URI(e); return "" !== i.scheme() ? i.toString() : i.absoluteTo(t).toString() }; const context2DsByWidthAndHeight = {}; function getImagePixels(e, t, n) { defined(t) || (t = e.width), defined(n) || (n = e.height); let i = context2DsByWidthAndHeight[t]; defined(i) || (i = {}, context2DsByWidthAndHeight[t] = i); let r = i[n]; if (!defined(r)) { const e = document.createElement("canvas"); e.width = t, e.height = n, r = e.getContext("2d"), r.globalCompositeOperation = "copy", i[n] = r } return r.drawImage(e, 0, 0, t, n), r.getImageData(0, 0, t, n).data } const blobUriRegex = /^blob:/i; function isBlobUri(e) { return blobUriRegex.test(e) } let a$2; function isCrossOriginUrl(e) { defined(a$2) || (a$2 = document.createElement("a")), a$2.href = window.location.href; const t = a$2.host, n = a$2.protocol; return a$2.href = e, a$2.href = a$2.href, n !== a$2.protocol || t !== a$2.host } const dataUriRegex$2 = /^data:/i; function isDataUri(e) { return dataUriRegex$2.test(e) } function loadAndExecuteScript(e) { const t = defer(), n = document.createElement("script"); n.async = !0, n.src = e; const i = document.getElementsByTagName("head")[0]; return n.onload = function () { n.onload = void 0, i.removeChild(n), t.resolve() }, n.onerror = function (e) { t.reject(e) }, i.appendChild(n), t.promise } function objectToQuery(e) { let t = ""; for (const n in e) if (e.hasOwnProperty(n)) { const i = e[n], r = `${encodeURIComponent(n)}=`; if (Array.isArray(i)) for (let e = 0, n = i.length; e < n; ++e) t += `${r + encodeURIComponent(i[e])}&`; else t += `${r + encodeURIComponent(i)}&` } return t = t.slice(0, -1), t } function queryToObject(e) { const t = {}; if ("" === e) return t; const n = e.replace(/\+/g, "%20").split(/[&;]/); for (let e = 0, i = n.length; e < i; ++e) { const i = n[e].split("="), r = decodeURIComponent(i[0]); let o = i[1]; o = defined(o) ? decodeURIComponent(o) : ""; const a = t[r]; "string" == typeof a ? t[r] = [a, o] : Array.isArray(a) ? a.push(o) : t[r] = o } return t } const RequestState = {UNISSUED: 0, ISSUED: 1, ACTIVE: 2, RECEIVED: 3, CANCELLED: 4, FAILED: 5}; var RequestState$1 = Object.freeze(RequestState); const RequestType = {TERRAIN: 0, IMAGERY: 1, TILES3D: 2, OTHER: 3}; var RequestType$1 = Object.freeze(RequestType); function Request(e) { e = defaultValue(e, defaultValue.EMPTY_OBJECT); const t = defaultValue(e.throttleByServer, !1), n = defaultValue(e.throttle, !1); this.url = e.url, this.requestFunction = e.requestFunction, this.cancelFunction = e.cancelFunction, this.priorityFunction = e.priorityFunction, this.priority = defaultValue(e.priority, 0), this.throttle = n, this.throttleByServer = t, this.type = defaultValue(e.type, RequestType$1.OTHER), this.serverKey = void 0, this.state = RequestState$1.UNISSUED, this.deferred = void 0, this.cancelled = !1 } function parseResponseHeaders(e) { const t = {}; if (!e) return t; const n = e.split("\r\n"); for (let e = 0; e < n.length; ++e) { const i = n[e], r = i.indexOf(": "); if (r > 0) { const e = i.substring(0, r), n = i.substring(r + 2); t[e] = n } } return t } function RequestErrorEvent(e, t, n) { this.statusCode = e, this.response = t, this.responseHeaders = n, "string" == typeof this.responseHeaders && (this.responseHeaders = parseResponseHeaders(this.responseHeaders)) } function Event() { this._listeners = [], this._scopes = [], this._toRemove = [], this._insideRaiseEvent = !1 } function compareNumber(e, t) { return t - e } function Heap(e) { this._comparator = e.comparator, this._array = [], this._length = 0, this._maximumLength = void 0 } function swap$3(e, t, n) { const i = e[t]; e[t] = e[n], e[n] = i } function sortRequests(e, t) { return e.priority - t.priority } Request.prototype.cancel = function () { this.cancelled = !0 }, Request.prototype.clone = function (e) { return defined(e) ? (e.url = this.url, e.requestFunction = this.requestFunction, e.cancelFunction = this.cancelFunction, e.priorityFunction = this.priorityFunction, e.priority = this.priority, e.throttle = this.throttle, e.throttleByServer = this.throttleByServer, e.type = this.type, e.serverKey = this.serverKey, e.state = this.RequestState.UNISSUED, e.deferred = void 0, e.cancelled = !1, e) : new Request(this) }, RequestErrorEvent.prototype.toString = function () { let e = "Request has failed."; return defined(this.statusCode) && (e += ` Status Code: ${this.statusCode}`), e }, Object.defineProperties(Event.prototype, { numberOfListeners: { get: function () { return this._listeners.length - this._toRemove.length } } }), Event.prototype.addEventListener = function (e, t) { this._listeners.push(e), this._scopes.push(t); const n = this; return function () { n.removeEventListener(e, t) } }, Event.prototype.removeEventListener = function (e, t) { const n = this._listeners, i = this._scopes; let r = -1; for (let o = 0; o < n.length; o++) if (n[o] === e && i[o] === t) { r = o; break } return -1 !== r && (this._insideRaiseEvent ? (this._toRemove.push(r), n[r] = void 0, i[r] = void 0) : (n.splice(r, 1), i.splice(r, 1)), !0) }, Event.prototype.raiseEvent = function () { let e; this._insideRaiseEvent = !0; const t = this._listeners, n = this._scopes; let i = t.length; for (e = 0; e < i; e++) { defined(t[e]) && t[e].apply(n[e], arguments) } const r = this._toRemove; if (i = r.length, i > 0) { for (r.sort(compareNumber), e = 0; e < i; e++) { const i = r[e]; t.splice(i, 1), n.splice(i, 1) } r.length = 0 } this._insideRaiseEvent = !1 }, Object.defineProperties(Heap.prototype, { length: { get: function () { return this._length } }, internalArray: { get: function () { return this._array } }, maximumLength: { get: function () { return this._maximumLength }, set: function (e) { const t = this._length; if (e < t) { const n = this._array; for (let i = e; i < t; ++i) n[i] = void 0; this._length = e, n.length = e } this._maximumLength = e } }, comparator: { get: function () { return this._comparator } } }), Heap.prototype.reserve = function (e) { e = defaultValue(e, this._length), this._array.length = e }, Heap.prototype.heapify = function (e) { e = defaultValue(e, 0); const t = this._length, n = this._comparator, i = this._array; let r = -1, o = !0; for (; o;) { const a = 2 * (e + 1), s = a - 1; r = s < t && n(i[s], i[e]) < 0 ? s : e, a < t && n(i[a], i[r]) < 0 && (r = a), r !== e ? (swap$3(i, r, e), e = r) : o = !1 } }, Heap.prototype.resort = function () { const e = this._length; for (let t = Math.ceil(e / 2); t >= 0; --t) this.heapify(t) }, Heap.prototype.insert = function (e) { const t = this._array, n = this._comparator, i = this._maximumLength; let r, o = this._length++; for (o < t.length ? t[o] = e : t.push(e); 0 !== o;) { const e = Math.floor((o - 1) / 2); if (!(n(t[o], t[e]) < 0)) break; swap$3(t, o, e), o = e } return defined(i) && this._length > i && (r = t[i], this._length = i), r }, Heap.prototype.pop = function (e) { if (e = defaultValue(e, 0), 0 === this._length) return; const t = this._array, n = t[e]; return swap$3(t, e, --this._length), this.heapify(e), t[this._length] = void 0, n }; const statistics = { numberOfAttemptedRequests: 0, numberOfActiveRequests: 0, numberOfCancelledRequests: 0, numberOfCancelledActiveRequests: 0, numberOfFailedRequests: 0, numberOfActiveRequestsEver: 0, lastNumberOfActiveRequests: 0 }; let priorityHeapLength = 20; const requestHeap = new Heap({comparator: sortRequests}); requestHeap.maximumLength = priorityHeapLength, requestHeap.reserve(priorityHeapLength); const activeRequests = []; let numberOfActiveRequestsByServer = {}; const pageUri = "undefined" != typeof document ? new URI(document.location.href) : new URI, requestCompletedEvent = new Event; function RequestScheduler() { } function updatePriority(e) { defined(e.priorityFunction) && (e.priority = e.priorityFunction()) } function issueRequest(e) { return e.state === RequestState$1.UNISSUED && (e.state = RequestState$1.ISSUED, e.deferred = defer()), e.deferred.promise } function getRequestReceivedFunction(e) { return function (t) { if (e.state === RequestState$1.CANCELLED) return; const n = e.deferred; --statistics.numberOfActiveRequests, --numberOfActiveRequestsByServer[e.serverKey], requestCompletedEvent.raiseEvent(), e.state = RequestState$1.RECEIVED, e.deferred = void 0, n.resolve(t) } } function getRequestFailedFunction(e) { return function (t) { e.state !== RequestState$1.CANCELLED && (++statistics.numberOfFailedRequests, --statistics.numberOfActiveRequests, --numberOfActiveRequestsByServer[e.serverKey], requestCompletedEvent.raiseEvent(t), e.state = RequestState$1.FAILED, e.deferred.reject(t)) } } function startRequest(e) { const t = issueRequest(e); return e.state = RequestState$1.ACTIVE, activeRequests.push(e), ++statistics.numberOfActiveRequests, ++statistics.numberOfActiveRequestsEver, ++numberOfActiveRequestsByServer[e.serverKey], e.requestFunction().then(getRequestReceivedFunction(e)).catch(getRequestFailedFunction(e)), t } function cancelRequest(e) { const t = e.state === RequestState$1.ACTIVE; if (e.state = RequestState$1.CANCELLED, ++statistics.numberOfCancelledRequests, defined(e.deferred)) { const t = e.deferred; e.deferred = void 0, t.reject() } t && (--statistics.numberOfActiveRequests, --numberOfActiveRequestsByServer[e.serverKey], ++statistics.numberOfCancelledActiveRequests), defined(e.cancelFunction) && e.cancelFunction() } function updateStatistics() { RequestScheduler.debugShowStatistics && (0 === statistics.numberOfActiveRequests && statistics.lastNumberOfActiveRequests > 0 && (statistics.numberOfAttemptedRequests > 0 && (console.log(`Number of attempted requests: ${statistics.numberOfAttemptedRequests}`), statistics.numberOfAttemptedRequests = 0), statistics.numberOfCancelledRequests > 0 && (console.log(`Number of cancelled requests: ${statistics.numberOfCancelledRequests}`), statistics.numberOfCancelledRequests = 0), statistics.numberOfCancelledActiveRequests > 0 && (console.log(`Number of cancelled active requests: ${statistics.numberOfCancelledActiveRequests}`), statistics.numberOfCancelledActiveRequests = 0), statistics.numberOfFailedRequests > 0 && (console.log(`Number of failed requests: ${statistics.numberOfFailedRequests}`), statistics.numberOfFailedRequests = 0)), statistics.lastNumberOfActiveRequests = statistics.numberOfActiveRequests) } RequestScheduler.maximumRequests = 50, RequestScheduler.maximumRequestsPerServer = 6, RequestScheduler.requestsByServer = { "api.cesium.com:443": 18, "assets.cesium.com:443": 18 }, RequestScheduler.throttleRequests = !0, RequestScheduler.debugShowStatistics = !1, RequestScheduler.requestCompletedEvent = requestCompletedEvent, Object.defineProperties(RequestScheduler, { statistics: { get: function () { return statistics } }, priorityHeapLength: { get: function () { return priorityHeapLength }, set: function (e) { if (e < priorityHeapLength) for (; requestHeap.length > e;) { cancelRequest(requestHeap.pop()) } priorityHeapLength = e, requestHeap.maximumLength = e, requestHeap.reserve(e) } } }), RequestScheduler.serverHasOpenSlots = function (e, t) { t = defaultValue(t, 1); const n = defaultValue(RequestScheduler.requestsByServer[e], RequestScheduler.maximumRequestsPerServer); return numberOfActiveRequestsByServer[e] + t <= n }, RequestScheduler.heapHasOpenSlots = function (e) { return requestHeap.length + e <= priorityHeapLength }, RequestScheduler.update = function () { let e, t, n = 0; const i = activeRequests.length; for (e = 0; e < i; ++e) t = activeRequests[e], t.cancelled && cancelRequest(t), t.state === RequestState$1.ACTIVE ? n > 0 && (activeRequests[e - n] = t) : ++n; activeRequests.length -= n; const r = requestHeap.internalArray, o = requestHeap.length; for (e = 0; e < o; ++e) updatePriority(r[e]); requestHeap.resort(); const a = Math.max(RequestScheduler.maximumRequests - activeRequests.length, 0); let s = 0; for (; s < a && requestHeap.length > 0;) t = requestHeap.pop(), t.cancelled ? cancelRequest(t) : !t.throttleByServer || RequestScheduler.serverHasOpenSlots(t.serverKey) ? (startRequest(t), ++s) : cancelRequest(t); updateStatistics() }, RequestScheduler.getServerKey = function (e) { let t = new URI(e); "" === t.scheme() && (t = new URI(e).absoluteTo(pageUri), t.normalize()); let n = t.authority(); /:/.test(n) || (n = `${n}:${"https" === t.scheme() ? "443" : "80"}`); return defined(numberOfActiveRequestsByServer[n]) || (numberOfActiveRequestsByServer[n] = 0), n }, RequestScheduler.request = function (e) { if (isDataUri(e.url) || isBlobUri(e.url)) return requestCompletedEvent.raiseEvent(), e.state = RequestState$1.RECEIVED, e.requestFunction(); if (++statistics.numberOfAttemptedRequests, defined(e.serverKey) || (e.serverKey = RequestScheduler.getServerKey(e.url)), RequestScheduler.throttleRequests && e.throttleByServer && !RequestScheduler.serverHasOpenSlots(e.serverKey)) return; if (!RequestScheduler.throttleRequests || !e.throttle) return startRequest(e); if (activeRequests.length >= RequestScheduler.maximumRequests) return; updatePriority(e); const t = requestHeap.insert(e); if (defined(t)) { if (t === e) return; cancelRequest(t) } return issueRequest(e) }, RequestScheduler.clearForSpecs = function () { for (; requestHeap.length > 0;) { cancelRequest(requestHeap.pop()) } const e = activeRequests.length; for (let t = 0; t < e; ++t) cancelRequest(activeRequests[t]); activeRequests.length = 0, numberOfActiveRequestsByServer = {}, statistics.numberOfAttemptedRequests = 0, statistics.numberOfActiveRequests = 0, statistics.numberOfCancelledRequests = 0, statistics.numberOfCancelledActiveRequests = 0, statistics.numberOfFailedRequests = 0, statistics.numberOfActiveRequestsEver = 0, statistics.lastNumberOfActiveRequests = 0 }, RequestScheduler.numberOfActiveRequestsByServer = function (e) { return numberOfActiveRequestsByServer[e] }, RequestScheduler.requestHeap = requestHeap; const TrustedServers = {}; let _servers = {}; function getAuthority(e) { const t = new URI(e); t.normalize(); let n = t.authority(); if (0 !== n.length) { if (t.authority(n), -1 !== n.indexOf("@")) { const e = n.split("@"); n = e[1] } if (-1 === n.indexOf(":")) { let e = t.scheme(); if (0 === e.length && (e = window.location.protocol, e = e.substring(0, e.length - 1)), "http" === e) n += ":80"; else { if ("https" !== e) return; n += ":443" } } return n } } TrustedServers.add = function (e, t) { const n = `${e.toLowerCase()}:${t}`; defined(_servers[n]) || (_servers[n] = !0) }, TrustedServers.remove = function (e, t) { const n = `${e.toLowerCase()}:${t}`; defined(_servers[n]) && delete _servers[n] }, TrustedServers.contains = function (e) { const t = getAuthority(e); return !(!defined(t) || !defined(_servers[t])) }, TrustedServers.clear = function () { _servers = {} }; const xhrBlobSupported = function () { try { const e = new XMLHttpRequest; return e.open("GET", "#", !0), e.responseType = "blob", "blob" === e.responseType } catch (e) { return !1 } }(); function parseQuery(e, t, n, i) { const r = e.query(); if (0 === r.length) return {}; let o; if (-1 === r.indexOf("=")) { const e = {}; e[r] = void 0, o = e } else o = queryToObject(r); t._queryParameters = n ? combineQueryParameters(o, t._queryParameters, i) : o, e.search("") } function stringifyQuery(e, t) { const n = t._queryParameters, i = Object.keys(n); 1 !== i.length || defined(n[i[0]]) ? e.search(objectToQuery(n)) : e.search(i[0]) } function defaultClone(e, t) { return defined(e) ? defined(e.clone) ? e.clone() : clone$1(e) : t } function checkAndResetRequest(e) { if (e.state === RequestState$1.ISSUED || e.state === RequestState$1.ACTIVE) throw new RuntimeError("The Resource is already being fetched."); e.state = RequestState$1.UNISSUED, e.deferred = void 0 } function combineQueryParameters(e, t, n) { if (!n) return combine$2(e, t); const i = clone$1(e, !0); for (const e in t) if (t.hasOwnProperty(e)) { let n = i[e]; const r = t[e]; defined(n) ? (Array.isArray(n) || (n = i[e] = [n]), i[e] = n.concat(r)) : i[e] = Array.isArray(r) ? r.slice() : r } return i } function Resource(e) { "string" == typeof (e = defaultValue(e, defaultValue.EMPTY_OBJECT)) && (e = {url: e}), this._url = void 0, this._templateValues = defaultClone(e.templateValues, {}), this._queryParameters = defaultClone(e.queryParameters, {}), this.headers = defaultClone(e.headers, {}), this.request = defaultValue(e.request, new Request), this.proxy = e.proxy, this.retryCallback = e.retryCallback, this.retryAttempts = defaultValue(e.retryAttempts, 0), this._retryCount = 0; const t = new URI(e.url); parseQuery(t, this, !0, !0), t.fragment(""), this._url = t.toString() } let supportsImageBitmapOptionsPromise; function fetchImage(e) { const t = e.resource, n = e.flipY, i = e.skipColorSpaceConversion, r = e.preferImageBitmap, o = t.request; o.url = t.url, o.requestFunction = function () { let e = !1; t.isDataUri || t.isBlobUri || (e = t.isCrossOriginUrl); const a = defer(); return Resource._Implementations.createImage(o, e, a, n, i, r), a.promise }; const a = RequestScheduler.request(o); if (defined(a)) return a.catch((function (e) { return o.state !== RequestState$1.FAILED ? Promise.reject(e) : t.retryOnError(e).then((function (a) { return a ? (o.state = RequestState$1.UNISSUED, o.deferred = void 0, fetchImage({ resource: t, flipY: n, skipColorSpaceConversion: i, preferImageBitmap: r })) : Promise.reject(e) })) })) } function fetchJsonp(e, t, n) { const i = {}; i[t] = n, e.setQueryParameters(i); const r = e.request; r.url = e.url, r.requestFunction = function () { const t = defer(); return window[n] = function (e) { t.resolve(e); try { delete window[n] } catch (e) { window[n] = void 0 } }, Resource._Implementations.loadAndExecuteScript(e.url, n, t), t.promise }; const o = RequestScheduler.request(r); if (defined(o)) return o.catch((function (i) { return r.state !== RequestState$1.FAILED ? Promise.reject(i) : e.retryOnError(i).then((function (o) { return o ? (r.state = RequestState$1.UNISSUED, r.deferred = void 0, fetchJsonp(e, t, n)) : Promise.reject(i) })) })) } Resource.createIfNeeded = function (e) { return e instanceof Resource ? e.getDerivedResource({request: e.request}) : "string" != typeof e ? e : new Resource({url: e}) }, Resource.supportsImageBitmapOptions = function () { if (defined(supportsImageBitmapOptionsPromise)) return supportsImageBitmapOptionsPromise; if ("function" != typeof createImageBitmap) return supportsImageBitmapOptionsPromise = Promise.resolve(!1), supportsImageBitmapOptionsPromise; return supportsImageBitmapOptionsPromise = Resource.fetchBlob({url: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAABGdBTUEAAE4g3rEiDgAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADElEQVQI12Ng6GAAAAEUAIngE3ZiAAAAAElFTkSuQmCC"}).then((function (e) { return Promise.all([createImageBitmap(e, { imageOrientation: "flipY", premultiplyAlpha: "none", colorSpaceConversion: "none" }), createImageBitmap(e)]) })).then((function (e) { const t = getImagePixels(e[0]), n = getImagePixels(e[1]); return t[1] !== n[1] })).catch((function () { return !1 })), supportsImageBitmapOptionsPromise }, Object.defineProperties(Resource, { isBlobSupported: { get: function () { return xhrBlobSupported } } }), Object.defineProperties(Resource.prototype, { queryParameters: { get: function () { return this._queryParameters } }, templateValues: { get: function () { return this._templateValues } }, url: { get: function () { return this.getUrlComponent(!0, !0) }, set: function (e) { const t = new URI(e); parseQuery(t, this, !1), t.fragment(""), this._url = t.toString() } }, extension: { get: function () { return getExtensionFromUri(this._url) } }, isDataUri: { get: function () { return isDataUri(this._url) } }, isBlobUri: { get: function () { return isBlobUri(this._url) } }, isCrossOriginUrl: { get: function () { return isCrossOriginUrl(this._url) } }, hasHeaders: { get: function () { return Object.keys(this.headers).length > 0 } } }), Resource.prototype.toString = function () { return this.getUrlComponent(!0, !0) }, Resource.prototype.getUrlComponent = function (e, t) { if (this.isDataUri) return this._url; const n = new URI(this._url); e && stringifyQuery(n, this); let i = n.toString().replace(/%7B/g, "{").replace(/%7D/g, "}"); const r = this._templateValues; return i = i.replace(/{(.*?)}/g, (function (e, t) { const n = r[t]; return defined(n) ? encodeURIComponent(n) : e })), t && defined(this.proxy) && (i = this.proxy.getURL(i)), i }, Resource.prototype.setQueryParameters = function (e, t) { this._queryParameters = t ? combineQueryParameters(this._queryParameters, e, !1) : combineQueryParameters(e, this._queryParameters, !1) }, Resource.prototype.appendQueryParameters = function (e) { this._queryParameters = combineQueryParameters(e, this._queryParameters, !0) }, Resource.prototype.setTemplateValues = function (e, t) { this._templateValues = t ? combine$2(this._templateValues, e) : combine$2(e, this._templateValues) }, Resource.prototype.getDerivedResource = function (e) { const t = this.clone(); if (t._retryCount = 0, defined(e.url)) { const n = new URI(e.url); parseQuery(n, t, !0, defaultValue(e.preserveQueryParameters, !1)), n.fragment(""), "" !== n.scheme() ? t._url = n.toString() : t._url = n.absoluteTo(new URI(getAbsoluteUri(this._url))).toString() } return defined(e.queryParameters) && (t._queryParameters = combine$2(e.queryParameters, t._queryParameters)), defined(e.templateValues) && (t._templateValues = combine$2(e.templateValues, t.templateValues)), defined(e.headers) && (t.headers = combine$2(e.headers, t.headers)), defined(e.proxy) && (t.proxy = e.proxy), defined(e.request) && (t.request = e.request), defined(e.retryCallback) && (t.retryCallback = e.retryCallback), defined(e.retryAttempts) && (t.retryAttempts = e.retryAttempts), t }, Resource.prototype.retryOnError = function (e) { const t = this.retryCallback; if ("function" != typeof t || this._retryCount >= this.retryAttempts) return Promise.resolve(!1); const n = this; return Promise.resolve(t(this, e)).then((function (e) { return ++n._retryCount, e })) }, Resource.prototype.clone = function (e) { return defined(e) || (e = new Resource({url: this._url})), e._url = this._url, e._queryParameters = clone$1(this._queryParameters), e._templateValues = clone$1(this._templateValues), e.headers = clone$1(this.headers), e.proxy = this.proxy, e.retryCallback = this.retryCallback, e.retryAttempts = this.retryAttempts, e._retryCount = 0, e.request = this.request.clone(), e }, Resource.prototype.getBaseUri = function (e) { return getBaseUri(this.getUrlComponent(e), e) }, Resource.prototype.appendForwardSlash = function () { this._url = appendForwardSlash(this._url) }, Resource.prototype.fetchArrayBuffer = function () { return this.fetch({responseType: "arraybuffer"}) }, Resource.fetchArrayBuffer = function (e) { return new Resource(e).fetchArrayBuffer() }, Resource.prototype.fetchBlob = function () { return this.fetch({responseType: "blob"}) }, Resource.fetchBlob = function (e) { return new Resource(e).fetchBlob() }, Resource.prototype.fetchImage = function (e) { e = defaultValue(e, defaultValue.EMPTY_OBJECT); const t = defaultValue(e.preferImageBitmap, !1), n = defaultValue(e.preferBlob, !1), i = defaultValue(e.flipY, !1), r = defaultValue(e.skipColorSpaceConversion, !1); if (checkAndResetRequest(this.request), !xhrBlobSupported || this.isDataUri || this.isBlobUri || !this.hasHeaders && !n) return fetchImage({ resource: this, flipY: i, skipColorSpaceConversion: r, preferImageBitmap: t }); const o = this.fetchBlob(); if (!defined(o)) return; let a, s, c, l; return Resource.supportsImageBitmapOptions().then((function (e) { return a = e, s = a && t, o })).then((function (e) { if (!defined(e)) return; if (l = e, s) return Resource.createImageBitmapFromBlob(e, { flipY: i, premultiplyAlpha: !1, skipColorSpaceConversion: r }); const t = window.URL.createObjectURL(e); return c = new Resource({url: t}), fetchImage({ resource: c, flipY: i, skipColorSpaceConversion: r, preferImageBitmap: !1 }) })).then((function (e) { if (defined(e)) return e.blob = l, s || window.URL.revokeObjectURL(c.url), e })).catch((function (e) { return defined(c) && window.URL.revokeObjectURL(c.url), e.blob = l, Promise.reject(e) })) }, Resource.fetchImage = function (e) { return new Resource(e).fetchImage({ flipY: e.flipY, skipColorSpaceConversion: e.skipColorSpaceConversion, preferBlob: e.preferBlob, preferImageBitmap: e.preferImageBitmap }) }, Resource.prototype.fetchText = function () { return this.fetch({responseType: "text"}) }, Resource.fetchText = function (e) { return new Resource(e).fetchText() }, Resource.prototype.fetchJson = function () { const e = this.fetch({responseType: "text", headers: {Accept: "application/json,*/*;q=0.01"}}); if (defined(e)) return e.then((function (e) { if (defined(e)) return JSON.parse(e) })) }, Resource.fetchJson = function (e) { return new Resource(e).fetchJson() }, Resource.prototype.fetchXML = function () { return this.fetch({responseType: "document", overrideMimeType: "text/xml"}) }, Resource.fetchXML = function (e) { return new Resource(e).fetchXML() }, Resource.prototype.fetchJsonp = function (e) { let t; e = defaultValue(e, "callback"), checkAndResetRequest(this.request); do { t = `loadJsonp${CesiumMath.nextRandomNumber().toString().substring(2, 8)}` } while (defined(window[t])); return fetchJsonp(this, e, t) }, Resource.fetchJsonp = function (e) { return new Resource(e).fetchJsonp(e.callbackParameterName) }, Resource.prototype._makeRequest = function (e) { const t = this; checkAndResetRequest(t.request); const n = t.request; n.url = t.url, n.requestFunction = function () { const i = e.responseType, r = combine$2(e.headers, t.headers), o = e.overrideMimeType, a = e.method, s = e.data, c = defer(), l = Resource._Implementations.loadWithXhr(t.url, i, a, s, r, c, o); return defined(l) && defined(l.abort) && (n.cancelFunction = function () { l.abort() }), c.promise }; const i = RequestScheduler.request(n); if (defined(i)) return i.then((function (e) { return n.cancelFunction = void 0, e })).catch((function (i) { return n.cancelFunction = void 0, n.state !== RequestState$1.FAILED ? Promise.reject(i) : t.retryOnError(i).then((function (r) { return r ? (n.state = RequestState$1.UNISSUED, n.deferred = void 0, t.fetch(e)) : Promise.reject(i) })) })) }; const dataUriRegex$1 = /^data:(.*?)(;base64)?,(.*)$/; function decodeDataUriText(e, t) { const n = decodeURIComponent(t); return e ? atob(n) : n } function decodeDataUriArrayBuffer(e, t) { const n = decodeDataUriText(e, t), i = new ArrayBuffer(n.length), r = new Uint8Array(i); for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e); return i } function decodeDataUri(e, t) { t = defaultValue(t, ""); const n = e[1], i = !!e[2], r = e[3]; let o, a; switch (t) { case"": case"text": return decodeDataUriText(i, r); case"arraybuffer": return decodeDataUriArrayBuffer(i, r); case"blob": return o = decodeDataUriArrayBuffer(i, r), new Blob([o], {type: n}); case"document": return a = new DOMParser, a.parseFromString(decodeDataUriText(i, r), n); case"json": return JSON.parse(decodeDataUriText(i, r)) } } function decodeResponse(e, t) { switch (t) { case"text": return e.toString("utf8"); case"json": return JSON.parse(e.toString("utf8")); default: return new Uint8Array(e).buffer } } function loadWithHttpRequest(e, t, n, i, r, o, a) { const s = require("url").parse(e), c = "https:" === s.protocol ? require("https") : require("http"), l = require("zlib"), u = { protocol: s.protocol, hostname: s.hostname, port: s.port, path: s.path, query: s.query, method: n, headers: r }; c.request(u).on("response", (function (e) { if (e.statusCode < 200 || e.statusCode >= 300) return void o.reject(new RequestErrorEvent(e.statusCode, e, e.headers)); const n = []; e.on("data", (function (e) { n.push(e) })), e.on("end", (function () { const i = Buffer.concat(n); "gzip" === e.headers["content-encoding"] ? l.gunzip(i, (function (e, n) { e ? o.reject(new RuntimeError("Error decompressing response.")) : o.resolve(decodeResponse(n, t)) })) : o.resolve(decodeResponse(i, t)) })) })).on("error", (function (e) { o.reject(new RequestErrorEvent) })).end() } Resource.prototype.fetch = function (e) { return (e = defaultClone(e, {})).method = "GET", this._makeRequest(e) }, Resource.fetch = function (e) { return new Resource(e).fetch({responseType: e.responseType, overrideMimeType: e.overrideMimeType}) }, Resource.prototype.delete = function (e) { return (e = defaultClone(e, {})).method = "DELETE", this._makeRequest(e) }, Resource.delete = function (e) { return new Resource(e).delete({ responseType: e.responseType, overrideMimeType: e.overrideMimeType, data: e.data }) }, Resource.prototype.head = function (e) { return (e = defaultClone(e, {})).method = "HEAD", this._makeRequest(e) }, Resource.head = function (e) { return new Resource(e).head({responseType: e.responseType, overrideMimeType: e.overrideMimeType}) }, Resource.prototype.options = function (e) { return (e = defaultClone(e, {})).method = "OPTIONS", this._makeRequest(e) }, Resource.options = function (e) { return new Resource(e).options({responseType: e.responseType, overrideMimeType: e.overrideMimeType}) }, Resource.prototype.post = function (e, t) { return Check.defined("data", e), (t = defaultClone(t, {})).method = "POST", t.data = e, this._makeRequest(t) }, Resource.post = function (e) { return new Resource(e).post(e.data, {responseType: e.responseType, overrideMimeType: e.overrideMimeType}) }, Resource.prototype.put = function (e, t) { return Check.defined("data", e), (t = defaultClone(t, {})).method = "PUT", t.data = e, this._makeRequest(t) }, Resource.put = function (e) { return new Resource(e).put(e.data, {responseType: e.responseType, overrideMimeType: e.overrideMimeType}) }, Resource.prototype.patch = function (e, t) { return Check.defined("data", e), (t = defaultClone(t, {})).method = "PATCH", t.data = e, this._makeRequest(t) }, Resource.patch = function (e) { return new Resource(e).patch(e.data, {responseType: e.responseType, overrideMimeType: e.overrideMimeType}) }, Resource._Implementations = {}, Resource._Implementations.loadImageElement = function (e, t, n) { const i = new Image; i.onload = function () { 0 === i.naturalWidth && 0 === i.naturalHeight && 0 === i.width && 0 === i.height && (i.width = 300, i.height = 150), n.resolve(i) }, i.onerror = function (e) { n.reject(e) }, t && (TrustedServers.contains(e) ? i.crossOrigin = "use-credentials" : i.crossOrigin = ""), i.src = e }, Resource._Implementations.createImage = function (e, t, n, i, r, o) { const a = e.url; Resource.supportsImageBitmapOptions().then((function (s) { if (!s || !o) return void Resource._Implementations.loadImageElement(a, t, n); const c = defer(), l = Resource._Implementations.loadWithXhr(a, "blob", "GET", void 0, void 0, c, void 0, void 0, void 0); return defined(l) && defined(l.abort) && (e.cancelFunction = function () { l.abort() }), c.promise.then((function (e) { if (defined(e)) return Resource.createImageBitmapFromBlob(e, { flipY: i, premultiplyAlpha: !1, skipColorSpaceConversion: r }); n.reject(new RuntimeError(`Successfully retrieved ${a} but it contained no content.`)) })).then((function (e) { n.resolve(e) })) })).catch((function (e) { n.reject(e) })) }, Resource.createImageBitmapFromBlob = function (e, t) { return Check.defined("options", t), Check.typeOf.bool("options.flipY", t.flipY), Check.typeOf.bool("options.premultiplyAlpha", t.premultiplyAlpha), Check.typeOf.bool("options.skipColorSpaceConversion", t.skipColorSpaceConversion), createImageBitmap(e, { imageOrientation: t.flipY ? "flipY" : "none", premultiplyAlpha: t.premultiplyAlpha ? "premultiply" : "none", colorSpaceConversion: t.skipColorSpaceConversion ? "none" : "default" }) }; const noXMLHttpRequest = "undefined" == typeof XMLHttpRequest; Resource._Implementations.loadWithXhr = function (e, t, n, i, r, o, a) { const s = dataUriRegex$1.exec(e); if (null !== s) return void o.resolve(decodeDataUri(s, t)); if (noXMLHttpRequest) return void loadWithHttpRequest(e, t, n, i, r, o); const c = new XMLHttpRequest; if (TrustedServers.contains(e) && (c.withCredentials = !0), c.open(n, e, !0), defined(a) && defined(c.overrideMimeType) && c.overrideMimeType(a), defined(r)) for (const e in r) r.hasOwnProperty(e) && c.setRequestHeader(e, r[e]); defined(t) && (c.responseType = t); let l = !1; return "string" == typeof e && (l = 0 === e.indexOf("file://") || "undefined" != typeof window && "file://" === window.location.origin), c.onload = function () { if ((c.status < 200 || c.status >= 300) && (!l || 0 !== c.status)) return void o.reject(new RequestErrorEvent(c.status, c.response, c.getAllResponseHeaders())); const e = c.response, i = c.responseType; if ("HEAD" === n || "OPTIONS" === n) { const e = c.getAllResponseHeaders().trim().split(/[\r\n]+/), t = {}; return e.forEach((function (e) { const n = e.split(": "), i = n.shift(); t[i] = n.join(": ") })), void o.resolve(t) } if (204 === c.status) o.resolve(); else if (!defined(e) || defined(t) && i !== t) if ("json" === t && "string" == typeof e) try { o.resolve(JSON.parse(e)) } catch (e) { o.reject(e) } else ("" === i || "document" === i) && defined(c.responseXML) && c.responseXML.hasChildNodes() ? o.resolve(c.responseXML) : "" !== i && "text" !== i || !defined(c.responseText) ? o.reject(new RuntimeError("Invalid XMLHttpRequest response type.")) : o.resolve(c.responseText); else o.resolve(e) }, c.onerror = function (e) { o.reject(new RequestErrorEvent) }, c.send(i), c }, Resource._Implementations.loadAndExecuteScript = function (e, t, n) { return loadAndExecuteScript(e).catch((function (e) { n.reject(e) })) }, Resource._DefaultImplementations = {}, Resource._DefaultImplementations.createImage = Resource._Implementations.createImage, Resource._DefaultImplementations.loadWithXhr = Resource._Implementations.loadWithXhr, Resource._DefaultImplementations.loadAndExecuteScript = Resource._Implementations.loadAndExecuteScript, Resource.DEFAULT = Object.freeze(new Resource({url: "undefined" == typeof document ? "" : document.location.href.split("?")[0]})); const cesiumScriptRegex = /((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/; function getBaseUrlFromCesiumScript() { const e = document.getElementsByTagName("script"); for (let t = 0, n = e.length; t < n; ++t) { const n = e[t].getAttribute("src"), i = cesiumScriptRegex.exec(n); if (null !== i) return i[1] } } let a$1, baseResource, implementation$2; function tryMakeAbsolute(e) { return "undefined" == typeof document ? e : (defined(a$1) || (a$1 = document.createElement("a")), a$1.href = e, a$1.href = a$1.href, a$1.href) } function getCesiumBaseUrl() { if (defined(baseResource)) return baseResource; let e; return e = "undefined" != typeof CESIUM_BASE_URL ? CESIUM_BASE_URL : "object" == typeof define && defined(define.amd) && !define.amd.toUrlUndefined && defined(require.toUrl) ? getAbsoluteUri("..", buildModuleUrl("Core/buildModuleUrl.js")) : getBaseUrlFromCesiumScript(), baseResource = new Resource({url: tryMakeAbsolute(e)}), baseResource.appendForwardSlash(), baseResource } function buildModuleUrlFromRequireToUrl(e) { return tryMakeAbsolute(require.toUrl(`../${e}`)) } function buildModuleUrlFromBaseUrl(e) { return getCesiumBaseUrl().getDerivedResource({url: e}).url } function buildModuleUrl(e) { defined(implementation$2) || (implementation$2 = "object" == typeof define && defined(define.amd) && !define.amd.toUrlUndefined && defined(require.toUrl) ? buildModuleUrlFromRequireToUrl : buildModuleUrlFromBaseUrl); return implementation$2(e) } function Cartesian2(e, t) { this.x = defaultValue(e, 0), this.y = defaultValue(t, 0) } buildModuleUrl._cesiumScriptRegex = cesiumScriptRegex, buildModuleUrl._buildModuleUrlFromBaseUrl = buildModuleUrlFromBaseUrl, buildModuleUrl._clearBaseResource = function () { baseResource = void 0 }, buildModuleUrl.setBaseUrl = function (e) { baseResource = Resource.DEFAULT.getDerivedResource({url: e}) }, buildModuleUrl.getCesiumBaseUrl = getCesiumBaseUrl, Cartesian2.fromElements = function (e, t, n) { return defined(n) ? (n.x = e, n.y = t, n) : new Cartesian2(e, t) }, Cartesian2.clone = function (e, t) { if (defined(e)) return defined(t) ? (t.x = e.x, t.y = e.y, t) : new Cartesian2(e.x, e.y) }, Cartesian2.fromCartesian3 = Cartesian2.clone, Cartesian2.fromCartesian4 = Cartesian2.clone, Cartesian2.packedLength = 2, Cartesian2.pack = function (e, t, n) { return n = defaultValue(n, 0), t[n++] = e.x, t[n] = e.y, t }, Cartesian2.unpack = function (e, t, n) { return t = defaultValue(t, 0), defined(n) || (n = new Cartesian2), n.x = e[t++], n.y = e[t], n }, Cartesian2.packArray = function (e, t) { const n = e.length, i = 2 * n; defined(t) ? (Array.isArray(t) || t.length === i) && t.length !== i && (t.length = i) : t = new Array(i); for (let i = 0; i < n; ++i) Cartesian2.pack(e[i], t, 2 * i); return t }, Cartesian2.unpackArray = function (e, t) { const n = e.length; defined(t) ? t.length = n / 2 : t = new Array(n / 2); for (let i = 0; i < n; i += 2) { const n = i / 2; t[n] = Cartesian2.unpack(e, i, t[n]) } return t }, Cartesian2.fromArray = Cartesian2.unpack, Cartesian2.maximumComponent = function (e) { return Math.max(e.x, e.y) }, Cartesian2.minimumComponent = function (e) { return Math.min(e.x, e.y) }, Cartesian2.minimumByComponent = function (e, t, n) { return n.x = Math.min(e.x, t.x), n.y = Math.min(e.y, t.y), n }, Cartesian2.maximumByComponent = function (e, t, n) { return n.x = Math.max(e.x, t.x), n.y = Math.max(e.y, t.y), n }, Cartesian2.clamp = function (e, t, n, i) { const r = CesiumMath.clamp(e.x, t.x, n.x), o = CesiumMath.clamp(e.y, t.y, n.y); return i.x = r, i.y = o, i }, Cartesian2.magnitudeSquared = function (e) { return e.x * e.x + e.y * e.y }, Cartesian2.magnitude = function (e) { return Math.sqrt(Cartesian2.magnitudeSquared(e)) }; const distanceScratch$1 = new Cartesian2; Cartesian2.distance = function (e, t) { return Cartesian2.subtract(e, t, distanceScratch$1), Cartesian2.magnitude(distanceScratch$1) }, Cartesian2.distanceSquared = function (e, t) { return Cartesian2.subtract(e, t, distanceScratch$1), Cartesian2.magnitudeSquared(distanceScratch$1) }, Cartesian2.normalize = function (e, t) { const n = Cartesian2.magnitude(e); return t.x = e.x / n, t.y = e.y / n, t }, Cartesian2.dot = function (e, t) { return e.x * t.x + e.y * t.y }, Cartesian2.cross = function (e, t) { return e.x * t.y - e.y * t.x }, Cartesian2.multiplyComponents = function (e, t, n) { return n.x = e.x * t.x, n.y = e.y * t.y, n }, Cartesian2.divideComponents = function (e, t, n) { return n.x = e.x / t.x, n.y = e.y / t.y, n }, Cartesian2.add = function (e, t, n) { return n.x = e.x + t.x, n.y = e.y + t.y, n }, Cartesian2.subtract = function (e, t, n) { return n.x = e.x - t.x, n.y = e.y - t.y, n }, Cartesian2.multiplyByScalar = function (e, t, n) { return n.x = e.x * t, n.y = e.y * t, n }, Cartesian2.divideByScalar = function (e, t, n) { return n.x = e.x / t, n.y = e.y / t, n }, Cartesian2.negate = function (e, t) { return t.x = -e.x, t.y = -e.y, t }, Cartesian2.abs = function (e, t) { return t.x = Math.abs(e.x), t.y = Math.abs(e.y), t }; const lerpScratch$1 = new Cartesian2; Cartesian2.lerp = function (e, t, n, i) { return Cartesian2.multiplyByScalar(t, n, lerpScratch$1), i = Cartesian2.multiplyByScalar(e, 1 - n, i), Cartesian2.add(lerpScratch$1, i, i) }; const angleBetweenScratch = new Cartesian2, angleBetweenScratch2 = new Cartesian2; Cartesian2.angleBetween = function (e, t) { return Cartesian2.normalize(e, angleBetweenScratch), Cartesian2.normalize(t, angleBetweenScratch2), CesiumMath.acosClamped(Cartesian2.dot(angleBetweenScratch, angleBetweenScratch2)) }; const mostOrthogonalAxisScratch = new Cartesian2; function GeographicTilingScheme(e) { e = defaultValue(e, defaultValue.EMPTY_OBJECT), this._ellipsoid = defaultValue(e.ellipsoid, Ellipsoid.WGS84), this._rectangle = defaultValue(e.rectangle, Rectangle.MAX_VALUE), this._projection = new GeographicProjection(this._ellipsoid), this._numberOfLevelZeroTilesX = defaultValue(e.numberOfLevelZeroTilesX, 2), this._numberOfLevelZeroTilesY = defaultValue(e.numberOfLevelZeroTilesY, 1) } Cartesian2.mostOrthogonalAxis = function (e, t) { const n = Cartesian2.normalize(e, mostOrthogonalAxisScratch); return Cartesian2.abs(n, n), t = n.x <= n.y ? Cartesian2.clone(Cartesian2.UNIT_X, t) : Cartesian2.clone(Cartesian2.UNIT_Y, t) }, Cartesian2.equals = function (e, t) { return e === t || defined(e) && defined(t) && e.x === t.x && e.y === t.y }, Cartesian2.equalsArray = function (e, t, n) { return e.x === t[n] && e.y === t[n + 1] }, Cartesian2.equalsEpsilon = function (e, t, n, i) { return e === t || defined(e) && defined(t) && CesiumMath.equalsEpsilon(e.x, t.x, n, i) && CesiumMath.equalsEpsilon(e.y, t.y, n, i) }, Cartesian2.ZERO = Object.freeze(new Cartesian2(0, 0)), Cartesian2.ONE = Object.freeze(new Cartesian2(1, 1)), Cartesian2.UNIT_X = Object.freeze(new Cartesian2(1, 0)), Cartesian2.UNIT_Y = Object.freeze(new Cartesian2(0, 1)), Cartesian2.prototype.clone = function (e) { return Cartesian2.clone(this, e) }, Cartesian2.prototype.equals = function (e) { return Cartesian2.equals(this, e) }, Cartesian2.prototype.equalsEpsilon = function (e, t, n) { return Cartesian2.equalsEpsilon(this, e, t, n) }, Cartesian2.prototype.toString = function () { return `(${this.x}, ${this.y})` }, Object.defineProperties(GeographicTilingScheme.prototype, { ellipsoid: { get: function () { return this._ellipsoid } }, rectangle: { get: function () { return this._rectangle } }, projection: { get: function () { return this._projection } } }), GeographicTilingScheme.prototype.getNumberOfXTilesAtLevel = function (e) { return this._numberOfLevelZeroTilesX << e }, GeographicTilingScheme.prototype.getNumberOfYTilesAtLevel = function (e) { return this._numberOfLevelZeroTilesY << e }, GeographicTilingScheme.prototype.rectangleToNativeRectangle = function (e, t) { const n = CesiumMath.toDegrees(e.west), i = CesiumMath.toDegrees(e.south), r = CesiumMath.toDegrees(e.east), o = CesiumMath.toDegrees(e.north); return defined(t) ? (t.west = n, t.south = i, t.east = r, t.north = o, t) : new Rectangle(n, i, r, o) }, GeographicTilingScheme.prototype.tileXYToNativeRectangle = function (e, t, n, i) { const r = this.tileXYToRectangle(e, t, n, i); return r.west = CesiumMath.toDegrees(r.west), r.south = CesiumMath.toDegrees(r.south), r.east = CesiumMath.toDegrees(r.east), r.north = CesiumMath.toDegrees(r.north), r }, GeographicTilingScheme.prototype.tileXYToRectangle = function (e, t, n, i) { const r = this._rectangle, o = this.getNumberOfXTilesAtLevel(n), a = this.getNumberOfYTilesAtLevel(n), s = r.width / o, c = e * s + r.west, l = (e + 1) * s + r.west, u = r.height / a, d = r.north - t * u, h = r.north - (t + 1) * u; return defined(i) || (i = new Rectangle(c, h, l, d)), i.west = c, i.south = h, i.east = l, i.north = d, i }, GeographicTilingScheme.prototype.positionToTileXY = function (e, t, n) { const i = this._rectangle; if (!Rectangle.contains(i, e)) return; const r = this.getNumberOfXTilesAtLevel(t), o = this.getNumberOfYTilesAtLevel(t), a = i.width / r, s = i.height / o; let c = e.longitude; i.east < i.west && (c += CesiumMath.TWO_PI); let l = (c - i.west) / a | 0; l >= r && (l = r - 1); let u = (i.north - e.latitude) / s | 0; return u >= o && (u = o - 1), defined(n) ? (n.x = l, n.y = u, n) : new Cartesian2(l, u) }; const scratchDiagonalCartesianNE = new Cartesian3, scratchDiagonalCartesianSW = new Cartesian3, scratchDiagonalCartographic = new Cartographic, scratchCenterCartesian = new Cartesian3, scratchSurfaceCartesian = new Cartesian3, scratchBoundingSphere$5 = new BoundingSphere, tilingScheme = new GeographicTilingScheme, scratchCorners = [new Cartographic, new Cartographic, new Cartographic, new Cartographic], scratchTileXY = new Cartesian2, ApproximateTerrainHeights = {}; function getTileXYLevel(e) { Cartographic.fromRadians(e.east, e.north, 0, scratchCorners[0]), Cartographic.fromRadians(e.west, e.north, 0, scratchCorners[1]), Cartographic.fromRadians(e.east, e.south, 0, scratchCorners[2]), Cartographic.fromRadians(e.west, e.south, 0, scratchCorners[3]); let t = 0, n = 0, i = 0, r = 0; const o = ApproximateTerrainHeights._terrainHeightsMaxLevel; let a; for (a = 0; a <= o; ++a) { let e = !1; for (let t = 0; t < 4; ++t) { const n = scratchCorners[t]; if (tilingScheme.positionToTileXY(n, a, scratchTileXY), 0 === t) i = scratchTileXY.x, r = scratchTileXY.y; else if (i !== scratchTileXY.x || r !== scratchTileXY.y) { e = !0; break } } if (e) break; t = i, n = r } if (0 !== a) return {x: t, y: n, level: a > o ? o : a - 1} } /*! @license DOMPurify 2.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.3/LICENSE */ function _toConsumableArray(e) { if (Array.isArray(e)) { for (var t = 0, n = Array(e.length); t < e.length; t++) n[t] = e[t]; return n } return Array.from(e) } ApproximateTerrainHeights.initialize = function () { let e = ApproximateTerrainHeights._initPromise; return defined(e) || (e = Resource.fetchJson(buildModuleUrl("Assets/approximateTerrainHeights.json")).then((function (e) { ApproximateTerrainHeights._terrainHeights = e })), ApproximateTerrainHeights._initPromise = e), e }, ApproximateTerrainHeights.getMinimumMaximumHeights = function (e, t) { t = defaultValue(t, Ellipsoid.WGS84); const n = getTileXYLevel(e); let i = ApproximateTerrainHeights._defaultMinTerrainHeight, r = ApproximateTerrainHeights._defaultMaxTerrainHeight; if (defined(n)) { const o = `${n.level}-${n.x}-${n.y}`, a = ApproximateTerrainHeights._terrainHeights[o]; defined(a) && (i = a[0], r = a[1]), t.cartographicToCartesian(Rectangle.northeast(e, scratchDiagonalCartographic), scratchDiagonalCartesianNE), t.cartographicToCartesian(Rectangle.southwest(e, scratchDiagonalCartographic), scratchDiagonalCartesianSW), Cartesian3.midpoint(scratchDiagonalCartesianSW, scratchDiagonalCartesianNE, scratchCenterCartesian); const s = t.scaleToGeodeticSurface(scratchCenterCartesian, scratchSurfaceCartesian); if (defined(s)) { const e = Cartesian3.distance(scratchCenterCartesian, s); i = Math.min(i, -e) } else i = ApproximateTerrainHeights._defaultMinTerrainHeight } return i = Math.max(ApproximateTerrainHeights._defaultMinTerrainHeight, i), { minimumTerrainHeight: i, maximumTerrainHeight: r } }, ApproximateTerrainHeights.getBoundingSphere = function (e, t) { t = defaultValue(t, Ellipsoid.WGS84); const n = getTileXYLevel(e); let i = ApproximateTerrainHeights._defaultMaxTerrainHeight; if (defined(n)) { const e = `${n.level}-${n.x}-${n.y}`, t = ApproximateTerrainHeights._terrainHeights[e]; defined(t) && (i = t[1]) } const r = BoundingSphere.fromRectangle3D(e, t, 0); return BoundingSphere.fromRectangle3D(e, t, i, scratchBoundingSphere$5), BoundingSphere.union(r, scratchBoundingSphere$5, r) }, ApproximateTerrainHeights._terrainHeightsMaxLevel = 6, ApproximateTerrainHeights._defaultMaxTerrainHeight = 9e3, ApproximateTerrainHeights._defaultMinTerrainHeight = -1e5, ApproximateTerrainHeights._terrainHeights = void 0, ApproximateTerrainHeights._initPromise = void 0, Object.defineProperties(ApproximateTerrainHeights, { initialized: { get: function () { return defined(ApproximateTerrainHeights._terrainHeights) } } }); var hasOwnProperty = Object.hasOwnProperty, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, freeze = Object.freeze, seal = Object.seal, create = Object.create, _ref = "undefined" != typeof Reflect && Reflect, apply = _ref.apply, construct = _ref.construct; apply || (apply = function (e, t, n) { return e.apply(t, n) }), freeze || (freeze = function (e) { return e }), seal || (seal = function (e) { return e }), construct || (construct = function (e, t) { return new (Function.prototype.bind.apply(e, [null].concat(_toConsumableArray(t)))) }); var arrayForEach = unapply(Array.prototype.forEach), arrayPop = unapply(Array.prototype.pop), arrayPush = unapply(Array.prototype.push), stringToLowerCase = unapply(String.prototype.toLowerCase), stringMatch = unapply(String.prototype.match), stringReplace = unapply(String.prototype.replace), stringIndexOf = unapply(String.prototype.indexOf), stringTrim = unapply(String.prototype.trim), regExpTest = unapply(RegExp.prototype.test), typeErrorCreate = unconstruct(TypeError); function unapply(e) { return function (t) { for (var n = arguments.length, i = Array(n > 1 ? n - 1 : 0), r = 1; r < n; r++) i[r - 1] = arguments[r]; return apply(e, t, i) } } function unconstruct(e) { return function () { for (var t = arguments.length, n = Array(t), i = 0; i < t; i++) n[i] = arguments[i]; return construct(e, n) } } function addToSet(e, t) { setPrototypeOf && setPrototypeOf(e, null); for (var n = t.length; n--;) { var i = t[n]; if ("string" == typeof i) { var r = stringToLowerCase(i); r !== i && (isFrozen(t) || (t[n] = r), i = r) } e[i] = !0 } return e } function clone(e) { var t = create(null), n = void 0; for (n in e) apply(hasOwnProperty, e, [n]) && (t[n] = e[n]); return t } function lookupGetter(e, t) { for (; null !== e;) { var n = getOwnPropertyDescriptor(e, t); if (n) { if (n.get) return unapply(n.get); if ("function" == typeof n.value) return unapply(n.value) } e = getPrototypeOf(e) } return function (e) { return console.warn("fallback value for", e), null } } var html = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), svg = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "fedropshadow", "feimage", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), mathMl = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover"]), mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), text = freeze(["#text"]), html$1 = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]), svg$1 = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), mathMl$1 = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), MUSTACHE_EXPR = seal(/\{\{[\s\S]*|[\s\S]*\}\}/gm), ERB_EXPR = seal(/<%[\s\S]*|[\s\S]*%>/gm), DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/), ARIA_ATTR = seal(/^aria-[\-\w]+$/), IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i), ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e }; function _toConsumableArray$1(e) { if (Array.isArray(e)) { for (var t = 0, n = Array(e.length); t < e.length; t++) n[t] = e[t]; return n } return Array.from(e) } var getGlobal = function () { return "undefined" == typeof window ? null : window }, _createTrustedTypesPolicy = function (e, t) { if ("object" !== (void 0 === e ? "undefined" : _typeof(e)) || "function" != typeof e.createPolicy) return null; var n = null, i = "data-tt-policy-suffix"; t.currentScript && t.currentScript.hasAttribute(i) && (n = t.currentScript.getAttribute(i)); var r = "dompurify" + (n ? "#" + n : ""); try { return e.createPolicy(r, { createHTML: function (e) { return e } }) } catch (e) { return console.warn("TrustedTypes policy " + r + " could not be created."), null } }; function createDOMPurify() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : getGlobal(), t = function (e) { return createDOMPurify(e) }; if (t.version = "2.3.3", t.removed = [], !e || !e.document || 9 !== e.document.nodeType) return t.isSupported = !1, t; var n = e.document, i = e.document, r = e.DocumentFragment, o = e.HTMLTemplateElement, a = e.Node, s = e.Element, c = e.NodeFilter, l = e.NamedNodeMap, u = void 0 === l ? e.NamedNodeMap || e.MozNamedAttrMap : l, d = e.Text, h = e.Comment, p = e.DOMParser, f = e.trustedTypes, m = s.prototype, g = lookupGetter(m, "cloneNode"), _ = lookupGetter(m, "nextSibling"), y = lookupGetter(m, "childNodes"), C = lookupGetter(m, "parentNode"); if ("function" == typeof o) { var T = i.createElement("template"); T.content && T.content.ownerDocument && (i = T.content.ownerDocument) } var S = _createTrustedTypesPolicy(f, n), A = S && ee ? S.createHTML("") : "", v = i, x = v.implementation, b = v.createNodeIterator, E = v.createDocumentFragment, P = v.getElementsByTagName, D = n.importNode, M = {}; try { M = clone(i).documentMode ? i.documentMode : {} } catch (e) { } var w = {}; t.isSupported = "function" == typeof C && x && void 0 !== x.createHTMLDocument && 9 !== M; var I = MUSTACHE_EXPR, R = ERB_EXPR, O = DATA_ATTR, B = ARIA_ATTR, L = IS_SCRIPT_OR_DATA, F = ATTR_WHITESPACE, N = IS_ALLOWED_URI, V = null, $ = addToSet({}, [].concat(_toConsumableArray$1(html), _toConsumableArray$1(svg), _toConsumableArray$1(svgFilters), _toConsumableArray$1(mathMl), _toConsumableArray$1(text))), k = null, U = addToSet({}, [].concat(_toConsumableArray$1(html$1), _toConsumableArray$1(svg$1), _toConsumableArray$1(mathMl$1), _toConsumableArray$1(xml))), G = null, z = null, H = !0, W = !0, q = !1, j = !1, X = !1, Y = !1, K = !1, J = !1, Q = !1, Z = !0, ee = !1, te = !0, ne = !0, ie = !1, re = {}, oe = null, ae = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]), se = null, ce = addToSet({}, ["audio", "video", "img", "source", "image", "track"]), le = null, ue = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), de = "http://www.w3.org/1998/Math/MathML", he = "http://www.w3.org/2000/svg", pe = "http://www.w3.org/1999/xhtml", fe = pe, me = !1, ge = void 0, _e = ["application/xhtml+xml", "text/html"], ye = "text/html", Ce = void 0, Te = null, Se = i.createElement("form"), Ae = function (e) { Te && Te === e || (e && "object" === (void 0 === e ? "undefined" : _typeof(e)) || (e = {}), e = clone(e), V = "ALLOWED_TAGS" in e ? addToSet({}, e.ALLOWED_TAGS) : $, k = "ALLOWED_ATTR" in e ? addToSet({}, e.ALLOWED_ATTR) : U, le = "ADD_URI_SAFE_ATTR" in e ? addToSet(clone(ue), e.ADD_URI_SAFE_ATTR) : ue, se = "ADD_DATA_URI_TAGS" in e ? addToSet(clone(ce), e.ADD_DATA_URI_TAGS) : ce, oe = "FORBID_CONTENTS" in e ? addToSet({}, e.FORBID_CONTENTS) : ae, G = "FORBID_TAGS" in e ? addToSet({}, e.FORBID_TAGS) : {}, z = "FORBID_ATTR" in e ? addToSet({}, e.FORBID_ATTR) : {}, re = "USE_PROFILES" in e && e.USE_PROFILES, H = !1 !== e.ALLOW_ARIA_ATTR, W = !1 !== e.ALLOW_DATA_ATTR, q = e.ALLOW_UNKNOWN_PROTOCOLS || !1, j = e.SAFE_FOR_TEMPLATES || !1, X = e.WHOLE_DOCUMENT || !1, J = e.RETURN_DOM || !1, Q = e.RETURN_DOM_FRAGMENT || !1, Z = !1 !== e.RETURN_DOM_IMPORT, ee = e.RETURN_TRUSTED_TYPE || !1, K = e.FORCE_BODY || !1, te = !1 !== e.SANITIZE_DOM, ne = !1 !== e.KEEP_CONTENT, ie = e.IN_PLACE || !1, N = e.ALLOWED_URI_REGEXP || N, fe = e.NAMESPACE || pe, ge = ge = -1 === _e.indexOf(e.PARSER_MEDIA_TYPE) ? ye : e.PARSER_MEDIA_TYPE, Ce = "application/xhtml+xml" === ge ? function (e) { return e } : stringToLowerCase, j && (W = !1), Q && (J = !0), re && (V = addToSet({}, [].concat(_toConsumableArray$1(text))), k = [], !0 === re.html && (addToSet(V, html), addToSet(k, html$1)), !0 === re.svg && (addToSet(V, svg), addToSet(k, svg$1), addToSet(k, xml)), !0 === re.svgFilters && (addToSet(V, svgFilters), addToSet(k, svg$1), addToSet(k, xml)), !0 === re.mathMl && (addToSet(V, mathMl), addToSet(k, mathMl$1), addToSet(k, xml))), e.ADD_TAGS && (V === $ && (V = clone(V)), addToSet(V, e.ADD_TAGS)), e.ADD_ATTR && (k === U && (k = clone(k)), addToSet(k, e.ADD_ATTR)), e.ADD_URI_SAFE_ATTR && addToSet(le, e.ADD_URI_SAFE_ATTR), e.FORBID_CONTENTS && (oe === ae && (oe = clone(oe)), addToSet(oe, e.FORBID_CONTENTS)), ne && (V["#text"] = !0), X && addToSet(V, ["html", "head", "body"]), V.table && (addToSet(V, ["tbody"]), delete G.tbody), freeze && freeze(e), Te = e) }, ve = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]), xe = addToSet({}, ["foreignobject", "desc", "title", "annotation-xml"]), be = addToSet({}, svg); addToSet(be, svgFilters), addToSet(be, svgDisallowed); var Ee = addToSet({}, mathMl); addToSet(Ee, mathMlDisallowed); var Pe = function (e) { var t = C(e); t && t.tagName || (t = {namespaceURI: pe, tagName: "template"}); var n = stringToLowerCase(e.tagName), i = stringToLowerCase(t.tagName); if (e.namespaceURI === he) return t.namespaceURI === pe ? "svg" === n : t.namespaceURI === de ? "svg" === n && ("annotation-xml" === i || ve[i]) : Boolean(be[n]); if (e.namespaceURI === de) return t.namespaceURI === pe ? "math" === n : t.namespaceURI === he ? "math" === n && xe[i] : Boolean(Ee[n]); if (e.namespaceURI === pe) { if (t.namespaceURI === he && !xe[i]) return !1; if (t.namespaceURI === de && !ve[i]) return !1; var r = addToSet({}, ["title", "style", "font", "a", "script"]); return !Ee[n] && (r[n] || !be[n]) } return !1 }, De = function (e) { arrayPush(t.removed, {element: e}); try { e.parentNode.removeChild(e) } catch (t) { try { e.outerHTML = A } catch (t) { e.remove() } } }, Me = function (e, n) { try { arrayPush(t.removed, {attribute: n.getAttributeNode(e), from: n}) } catch (e) { arrayPush(t.removed, {attribute: null, from: n}) } if (n.removeAttribute(e), "is" === e && !k[e]) if (J || Q) try { De(n) } catch (e) { } else try { n.setAttribute(e, "") } catch (e) { } }, we = function (e) { var t = void 0, n = void 0; if (K) e = "" + e; else { var r = stringMatch(e, /^[\r\n\t ]+/); n = r && r[0] } "application/xhtml+xml" === ge && (e = '' + e + ""); var o = S ? S.createHTML(e) : e; if (fe === pe) try { t = (new p).parseFromString(o, ge) } catch (e) { } if (!t || !t.documentElement) { t = x.createDocument(fe, "template", null); try { t.documentElement.innerHTML = me ? "" : o } catch (e) { } } var a = t.body || t.documentElement; return e && n && a.insertBefore(i.createTextNode(n), a.childNodes[0] || null), fe === pe ? P.call(t, X ? "html" : "body")[0] : X ? t.documentElement : a }, Ie = function (e) { return b.call(e.ownerDocument || e, e, c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT, null, !1) }, Re = function (e) { return !(e instanceof d || e instanceof h) && !("string" == typeof e.nodeName && "string" == typeof e.textContent && "function" == typeof e.removeChild && e.attributes instanceof u && "function" == typeof e.removeAttribute && "function" == typeof e.setAttribute && "string" == typeof e.namespaceURI && "function" == typeof e.insertBefore) }, Oe = function (e) { return "object" === (void 0 === a ? "undefined" : _typeof(a)) ? e instanceof a : e && "object" === (void 0 === e ? "undefined" : _typeof(e)) && "number" == typeof e.nodeType && "string" == typeof e.nodeName }, Be = function (e, n, i) { w[e] && arrayForEach(w[e], (function (e) { e.call(t, n, i, Te) })) }, Le = function (e) { var n = void 0; if (Be("beforeSanitizeElements", e, null), Re(e)) return De(e), !0; if (stringMatch(e.nodeName, /[\u0080-\uFFFF]/)) return De(e), !0; var i = Ce(e.nodeName); if (Be("uponSanitizeElement", e, { tagName: i, allowedTags: V }), !Oe(e.firstElementChild) && (!Oe(e.content) || !Oe(e.content.firstElementChild)) && regExpTest(/<[/\w]/g, e.innerHTML) && regExpTest(/<[/\w]/g, e.textContent)) return De(e), !0; if ("select" === i && regExpTest(/