import { c as c3, e as e2, r as r3, s as s3 } from "./chunk-X6GHUY4U.js"; import { C, D, E as E2, L as L3 } from "./chunk-3OFVLRSL.js"; import { e as e5 } from "./chunk-IRQMHCT3.js"; import { x as x2 } from "./chunk-MP62QTGD.js"; import { e as e3, r as r4 } from "./chunk-44FMXGSC.js"; import { e as e4 } from "./chunk-XFDO4CMR.js"; import { A, B, E, F, L as L2, O, V, c as c2, d, g, i as i3, q, u as u2, w as w2, x } from "./chunk-HIELTLML.js"; import { r as r5 } from "./chunk-GGGVIS2U.js"; import { c, f as f2, i as i2, p, u } from "./chunk-VGWC3IKZ.js"; import { n } from "./chunk-O6VYMEIX.js"; import { b } from "./chunk-PIFOHNWC.js"; import { U } from "./chunk-5DMBXPN2.js"; import { Q, X, Y, nt } from "./chunk-VEGAOVMY.js"; import { r as r2 } from "./chunk-SQOPWYIT.js"; import { L, f, w } from "./chunk-V6P2MAQQ.js"; import { s2 as s, s3 as s2 } from "./chunk-E5O6P5I2.js"; import { e, i2 as i } from "./chunk-2TIUKVZN.js"; import { r, t } from "./chunk-YXWMMD76.js"; // node_modules/@arcgis/core/chunks/vec42.js function t2(t10, r12, f10) { if (t10.count !== r12.count) return void e5.error("source and destination buffers need to have the same number of elements"); const o7 = t10.count, n7 = f10[0], u6 = f10[1], d4 = f10[2], s5 = f10[3], c7 = f10[4], i7 = f10[5], a2 = f10[6], p3 = f10[7], y = f10[8], B2 = f10[9], m2 = f10[10], l3 = f10[11], S = f10[12], h = f10[13], b2 = f10[14], M2 = f10[15], v = t10.typedBuffer, g2 = t10.typedBufferStride, _ = r12.typedBuffer, j = r12.typedBufferStride; for (let e11 = 0; e11 < o7; e11++) { const t11 = e11 * g2, r13 = e11 * j, f11 = _[r13], o8 = _[r13 + 1], z = _[r13 + 2], O2 = _[r13 + 3]; v[t11] = n7 * f11 + c7 * o8 + y * z + S * O2, v[t11 + 1] = u6 * f11 + i7 * o8 + B2 * z + h * O2, v[t11 + 2] = d4 * f11 + a2 * o8 + m2 * z + b2 * O2, v[t11 + 3] = s5 * f11 + p3 * o8 + l3 * z + M2 * O2; } } function r6(t10, r12, f10) { if (t10.count !== r12.count) return void e5.error("source and destination buffers need to have the same number of elements"); const o7 = t10.count, n7 = f10[0], u6 = f10[1], d4 = f10[2], s5 = f10[3], c7 = f10[4], i7 = f10[5], a2 = f10[6], p3 = f10[7], y = f10[8], B2 = t10.typedBuffer, m2 = t10.typedBufferStride, l3 = r12.typedBuffer, S = r12.typedBufferStride; for (let e11 = 0; e11 < o7; e11++) { const t11 = e11 * m2, r13 = e11 * S, f11 = l3[r13], o8 = l3[r13 + 1], h = l3[r13 + 2], b2 = l3[r13 + 3]; B2[t11] = n7 * f11 + s5 * o8 + a2 * h, B2[t11 + 1] = u6 * f11 + c7 * o8 + p3 * h, B2[t11 + 2] = d4 * f11 + i7 * o8 + y * h, B2[t11 + 3] = b2; } } function f3(e11, t10) { const r12 = Math.min(e11.count, t10.count), f10 = e11.typedBuffer, o7 = e11.typedBufferStride, n7 = t10.typedBuffer, u6 = t10.typedBufferStride; for (let d4 = 0; d4 < r12; d4++) { const e12 = d4 * o7, t11 = d4 * u6, r13 = n7[t11], s5 = n7[t11 + 1], c7 = n7[t11 + 2], i7 = r13 * r13 + s5 * s5 + c7 * c7; if (i7 > 0) { const t12 = 1 / Math.sqrt(i7); f10[e12] = t12 * r13, f10[e12 + 1] = t12 * s5, f10[e12 + 2] = t12 * c7; } } } function o(e11, t10, r12) { const f10 = Math.min(e11.count, t10.count), o7 = e11.typedBuffer, n7 = e11.typedBufferStride, u6 = t10.typedBuffer, d4 = t10.typedBufferStride; for (let s5 = 0; s5 < f10; s5++) { const e12 = s5 * n7, t11 = s5 * d4; o7[e12] = r12 * u6[t11], o7[e12 + 1] = r12 * u6[t11 + 1], o7[e12 + 2] = r12 * u6[t11 + 2], o7[e12 + 3] = r12 * u6[t11 + 3]; } } function n2(e11, t10, r12) { const f10 = Math.min(e11.count, t10.count), o7 = e11.typedBuffer, n7 = e11.typedBufferStride, u6 = t10.typedBuffer, d4 = t10.typedBufferStride; for (let s5 = 0; s5 < f10; s5++) { const e12 = s5 * n7, t11 = s5 * d4; o7[e12] = u6[t11] >> r12, o7[e12 + 1] = u6[t11 + 1] >> r12, o7[e12 + 2] = u6[t11 + 2] >> r12, o7[e12 + 3] = u6[t11 + 3] >> r12; } } var u3 = Object.freeze(Object.defineProperty({ __proto__: null, transformMat4: t2, transformMat3: r6, normalize: f3, scale: o, shiftRight: n2 }, Symbol.toStringTag, { value: "Module" })); // node_modules/@arcgis/core/chunks/vec22.js function f4(e11, t10, r12) { const f10 = e11.typedBuffer, n7 = e11.typedBufferStride, d4 = t10.typedBuffer, o7 = t10.typedBufferStride, u6 = r12 ? r12.count : t10.count; let s5 = (r12 && r12.dstIndex ? r12.dstIndex : 0) * n7, c7 = (r12 && r12.srcIndex ? r12.srcIndex : 0) * o7; for (let p3 = 0; p3 < u6; ++p3) f10[s5] = d4[c7], f10[s5 + 1] = d4[c7 + 1], s5 += n7, c7 += o7; } function n3(n7, d4, o7) { const u6 = n7.typedBuffer, s5 = n7.typedBufferStride, c7 = d4.typedBuffer, p3 = d4.typedBufferStride, l3 = o7 ? o7.count : d4.count; let y = (o7 && o7.dstIndex ? o7.dstIndex : 0) * s5, i7 = (o7 && o7.srcIndex ? o7.srcIndex : 0) * p3; if (s3(d4.elementType)) { const e11 = r3(d4.elementType); if (c3(d4.elementType)) for (let t10 = 0; t10 < l3; ++t10) u6[y] = Math.max(c7[i7] / e11, -1), u6[y + 1] = Math.max(c7[i7 + 1] / e11, -1), y += s5, i7 += p3; else for (let t10 = 0; t10 < l3; ++t10) u6[y] = c7[i7] / e11, u6[y + 1] = c7[i7 + 1] / e11, y += s5, i7 += p3; } else f4(n7, d4, o7); return n7; } function d2(e11, t10, r12, f10) { var _a, _b; const n7 = e11.typedBuffer, d4 = e11.typedBufferStride, o7 = (_a = f10 == null ? void 0 : f10.count) != null ? _a : e11.count; let u6 = ((_b = f10 == null ? void 0 : f10.dstIndex) != null ? _b : 0) * d4; for (let s5 = 0; s5 < o7; ++s5) n7[u6] = t10, n7[u6 + 1] = r12, u6 += d4; } var o2 = Object.freeze(Object.defineProperty({ __proto__: null, copy: f4, normalizeIntegerBuffer: n3, fill: d2 }, Symbol.toStringTag, { value: "Module" })); // node_modules/@arcgis/core/chunks/vec43.js function e6(e11, t10, f10) { const d4 = e11.typedBuffer, n7 = e11.typedBufferStride, o7 = t10.typedBuffer, r12 = t10.typedBufferStride, c7 = f10 ? f10.count : t10.count; let u6 = (f10 && f10.dstIndex ? f10.dstIndex : 0) * n7, l3 = (f10 && f10.srcIndex ? f10.srcIndex : 0) * r12; for (let s5 = 0; s5 < c7; ++s5) d4[u6] = o7[l3], d4[u6 + 1] = o7[l3 + 1], d4[u6 + 2] = o7[l3 + 2], d4[u6 + 3] = o7[l3 + 3], u6 += n7, l3 += r12; } function t3(e11, t10, f10, d4, n7, o7) { var _a, _b; const r12 = e11.typedBuffer, c7 = e11.typedBufferStride, u6 = (_a = o7 == null ? void 0 : o7.count) != null ? _a : e11.count; let l3 = ((_b = o7 == null ? void 0 : o7.dstIndex) != null ? _b : 0) * c7; for (let s5 = 0; s5 < u6; ++s5) r12[l3] = t10, r12[l3 + 1] = f10, r12[l3 + 2] = d4, r12[l3 + 3] = n7, l3 += c7; } var f5 = Object.freeze(Object.defineProperty({ __proto__: null, copy: e6, fill: t3 }, Symbol.toStringTag, { value: "Module" })); // node_modules/@arcgis/core/chunks/mat32.js function e7(e11, t10, r12) { const o7 = e11.typedBuffer, d4 = e11.typedBufferStride, f10 = t10.typedBuffer, n7 = t10.typedBufferStride, c7 = r12 ? r12.count : t10.count; let u6 = (r12 && r12.dstIndex ? r12.dstIndex : 0) * d4, l3 = (r12 && r12.srcIndex ? r12.srcIndex : 0) * n7; for (let p3 = 0; p3 < c7; ++p3) { for (let e12 = 0; e12 < 9; ++e12) o7[u6 + e12] = f10[l3 + e12]; u6 += d4, l3 += n7; } } var t4 = Object.freeze(Object.defineProperty({ __proto__: null, copy: e7 }, Symbol.toStringTag, { value: "Module" })); // node_modules/@arcgis/core/chunks/mat42.js function e8(e11, t10, r12) { const o7 = e11.typedBuffer, d4 = e11.typedBufferStride, f10 = t10.typedBuffer, n7 = t10.typedBufferStride, c7 = r12 ? r12.count : t10.count; let u6 = (r12 && r12.dstIndex ? r12.dstIndex : 0) * d4, l3 = (r12 && r12.srcIndex ? r12.srcIndex : 0) * n7; for (let p3 = 0; p3 < c7; ++p3) { for (let e12 = 0; e12 < 16; ++e12) o7[u6 + e12] = f10[l3 + e12]; u6 += d4, l3 += n7; } } var t5 = Object.freeze(Object.defineProperty({ __proto__: null, copy: e8 }, Symbol.toStringTag, { value: "Module" })); // node_modules/@arcgis/core/chunks/scalar.js function e9(e11, t10, r12) { const n7 = e11.typedBuffer, o7 = e11.typedBufferStride, c7 = t10.typedBuffer, d4 = t10.typedBufferStride, f10 = r12 ? r12.count : t10.count; let u6 = (r12 && r12.dstIndex ? r12.dstIndex : 0) * o7, s5 = (r12 && r12.srcIndex ? r12.srcIndex : 0) * d4; for (let p3 = 0; p3 < f10; ++p3) n7[u6] = c7[s5], u6 += o7, s5 += d4; } function t6(e11, t10) { const r12 = e11.count; t10 || (t10 = new e11.TypedArrayConstructor(r12)); for (let n7 = 0; n7 < r12; n7++) t10[n7] = e11.get(n7); return t10; } var r7 = Object.freeze(Object.defineProperty({ __proto__: null, copy: e9, makeDense: t6 }, Symbol.toStringTag, { value: "Module" })); // node_modules/@arcgis/core/geometry/support/buffer/utils.js function r8(s5, r12) { return new s5(new ArrayBuffer(r12 * s5.ElementCount * e2(s5.ElementType))); } // node_modules/@arcgis/core/views/3d/glTF/DefaultLoadingContext.js var n4 = class { constructor(r12) { this._streamDataRequester = r12; } async loadJSON(r12, e11) { return this._load("json", r12, e11); } async loadBinary(r12, e11) { return X(r12) ? (f(e11), Y(r12)) : this._load("binary", r12, e11); } async loadImage(r12, e11) { return this._load("image", r12, e11); } async _load(t10, i7, m2) { if (t(this._streamDataRequester)) return (await U(i7, { responseType: c4[t10] })).data; const n7 = await b(this._streamDataRequester.request(i7, t10, m2)); if (true === n7.ok) return n7.value; throw w(n7.error), new s2("", `Request for resource failed: ${n7.error}`); } }; var c4 = { image: "image", binary: "array-buffer", json: "json" }; // node_modules/@arcgis/core/views/3d/glTF/DefaultErrorContext.js var o3 = class { error(e11) { throw new s2("gltf-loader-error", e11); } errorUnsupported(e11) { throw new s2("gltf-loader-unsupported-feature", e11); } errorUnsupportedIf(r12, e11) { r12 && this.errorUnsupported(e11); } assert(r12, e11) { r12 || this.error(e11); } warn(r12) { s.getLogger("esri.views.3d.glTF").warn(r12); } warnUnsupported(r12) { this.warn("[Unsupported Feature] " + r12); } warnUnsupportedIf(r12, e11) { r12 && this.warnUnsupported(e11); } }; // node_modules/@arcgis/core/views/3d/glTF/LoaderResult.js function r9(e11 = {}) { return { color: [1, 1, 1], opacity: 1, alphaMode: "OPAQUE", alphaCutoff: 0.5, doubleSided: false, castShadows: true, receiveShadows: true, receiveAmbientOcclustion: true, textureColor: null, textureNormal: null, textureOcclusion: null, textureEmissive: null, textureMetallicRoughness: null, colorTextureTransform: null, normalTextureTransform: null, occlusionTextureTransform: null, emissiveTextureTransform: null, metallicRoughnessTextureTransform: null, emissiveFactor: [0, 0, 0], metallicFactor: 1, roughnessFactor: 1, colorMixMode: "multiply", ...e11 }; } function l(r12, l3 = {}) { return { data: r12, parameters: { wrap: { s: D.REPEAT, t: D.REPEAT, ...l3.wrap }, noUnpackFlip: true, mipmap: false, ...l3 } }; } // node_modules/@arcgis/core/views/3d/glTF/internal/BinaryStreamReader.js var t7 = class { constructor(t10) { this._data = t10, this._offset4 = 0, this._dataUint32 = new Uint32Array(this._data, 0, Math.floor(this._data.byteLength / 4)); } readUint32() { const t10 = this._offset4; return this._offset4 += 1, this._dataUint32[t10]; } readUint8Array(t10) { const s5 = 4 * this._offset4; return this._offset4 += t10 / 4, new Uint8Array(this._data, s5, t10); } remainingBytes() { return this._data.byteLength - 4 * this._offset4; } }; // node_modules/@arcgis/core/views/3d/glTF/internal/enums.js var A2; var E3; !function(A3) { A3.SCALAR = "SCALAR", A3.VEC2 = "VEC2", A3.VEC3 = "VEC3", A3.VEC4 = "VEC4", A3.MAT2 = "MAT2", A3.MAT3 = "MAT3", A3.MAT4 = "MAT4"; }(A2 || (A2 = {})), function(A3) { A3[A3.ARRAY_BUFFER = 34962] = "ARRAY_BUFFER", A3[A3.ELEMENT_ARRAY_BUFFER = 34963] = "ELEMENT_ARRAY_BUFFER"; }(E3 || (E3 = {})); // node_modules/@arcgis/core/views/3d/glTF/internal/fillDefaults.js var t8 = { baseColorFactor: [1, 1, 1, 1], metallicFactor: 1, roughnessFactor: 1 }; var a = { pbrMetallicRoughness: t8, emissiveFactor: [0, 0, 0], alphaMode: "OPAQUE", alphaCutoff: 0.5, doubleSided: false }; var l2 = { ESRI_externalColorMixMode: "tint" }; var i4 = (e11 = {}) => { const o7 = { ...t8, ...e11.pbrMetallicRoughness }, r12 = s4({ ...l2, ...e11.extras }); return { ...a, ...e11, pbrMetallicRoughness: o7, extras: r12 }; }; function s4(o7) { switch (o7.ESRI_externalColorMixMode) { case "multiply": case "tint": case "ignore": case "replace": break; default: n(o7.ESRI_externalColorMixMode), o7.ESRI_externalColorMixMode = "tint"; } return o7; } var n5 = { magFilter: L3.LINEAR, minFilter: L3.LINEAR_MIPMAP_LINEAR, wrapS: D.REPEAT, wrapT: D.REPEAT }; var c5 = (e11) => ({ ...n5, ...e11 }); // node_modules/@arcgis/core/views/3d/glTF/internal/pathUtils.js function r10(r12) { let e11, t10; return r12.replace(/^(.*\/)?([^/]*)$/, (r13, a2, i7) => (e11 = a2 || "", t10 = i7 || "", "")), { dirPart: e11, filePart: t10 }; } // node_modules/@arcgis/core/views/3d/glTF/internal/Resource.js var M = { MAGIC: 1179937895, CHUNK_TYPE_JSON: 1313821514, CHUNK_TYPE_BIN: 5130562, MIN_HEADER_LENGTH: 20 }; var F2 = class { constructor(e11, t10, r12, s5, n7) { this._context = e11, this._errorContext = t10, this.uri = r12, this.json = s5, this._glbBuffer = n7, this._bufferLoaders = /* @__PURE__ */ new Map(), this._textureLoaders = /* @__PURE__ */ new Map(), this._textureCache = /* @__PURE__ */ new Map(), this._materialCache = /* @__PURE__ */ new Map(), this._nodeParentMap = /* @__PURE__ */ new Map(), this._nodeTransformCache = /* @__PURE__ */ new Map(), this._baseUri = r10(this.uri).dirPart, this._checkVersionSupported(), this._checkRequiredExtensionsSupported(), t10.errorUnsupportedIf(null == s5.scenes, "Scenes must be defined."), t10.errorUnsupportedIf(null == s5.meshes, "Meshes must be defined"), t10.errorUnsupportedIf(null == s5.nodes, "Nodes must be defined."), this._computeNodeParents(); } static async load(e11, t10, o7, a2) { if (X(o7)) { const r12 = nt(o7); if (r12 && "model/gltf-binary" !== r12.mediaType) try { const s5 = JSON.parse(r12.isBase64 ? atob(r12.data) : r12.data); return new F2(e11, t10, o7, s5); } catch { } const a3 = Y(o7); if (F2._isGLBData(a3)) return this._fromGLBData(e11, t10, o7, a3); } if (o7.endsWith(".gltf")) { const r12 = await e11.loadJSON(o7, a2); return new F2(e11, t10, o7, r12); } const i7 = await e11.loadBinary(o7, a2); if (F2._isGLBData(i7)) return this._fromGLBData(e11, t10, o7, i7); const u6 = await e11.loadJSON(o7, a2); return new F2(e11, t10, o7, u6); } static _isGLBData(e11) { if (null == e11) return false; const t10 = new t7(e11); return t10.remainingBytes() >= 4 && t10.readUint32() === M.MAGIC; } static async _fromGLBData(e11, t10, r12, s5) { const n7 = await F2._parseGLBData(t10, s5); return new F2(e11, t10, r12, n7.json, n7.binaryData); } static async _parseGLBData(e11, t10) { const r12 = new t7(t10); e11.assert(r12.remainingBytes() >= 12, "GLB binary data is insufficiently large."); const s5 = r12.readUint32(), n7 = r12.readUint32(), o7 = r12.readUint32(); e11.assert(s5 === M.MAGIC, "Magic first 4 bytes do not fit to expected GLB value."), e11.assert(t10.byteLength >= o7, "GLB binary data is smaller than header specifies."), e11.errorUnsupportedIf(2 !== n7, "An unsupported GLB container version was detected. Only version 2 is supported."); let a2, i7, u6 = 0; for (; r12.remainingBytes() >= 8; ) { const t11 = r12.readUint32(), s6 = r12.readUint32(); 0 === u6 ? (e11.assert(s6 === M.CHUNK_TYPE_JSON, "First GLB chunk must be JSON."), e11.assert(t11 >= 0, "No JSON data found."), a2 = await K(r12.readUint8Array(t11))) : 1 === u6 ? (e11.errorUnsupportedIf(s6 !== M.CHUNK_TYPE_BIN, "Second GLB chunk expected to be BIN."), i7 = r12.readUint8Array(t11)) : e11.warnUnsupported("More than 2 GLB chunks detected. Skipping."), u6 += 1; } return a2 || e11.error("No GLB JSON chunk detected."), { json: a2, binaryData: i7 }; } async getBuffer(e11, t10) { const r12 = this.json.buffers[e11], s5 = this._errorContext; if (null == r12.uri) return s5.assert(null != this._glbBuffer, "GLB buffer not present"), this._glbBuffer; const n7 = await this._getBufferLoader(e11, t10); return s5.assert(n7.byteLength === r12.byteLength, "Buffer byte lengths should match."), n7; } async _getBufferLoader(e11, t10) { const r12 = this._bufferLoaders.get(e11); if (r12) return r12; const s5 = this.json.buffers[e11].uri, n7 = this._context.loadBinary(this._resolveUri(s5), t10).then((e12) => new Uint8Array(e12)); return this._bufferLoaders.set(e11, n7), n7; } async getAccessor(e11, t10) { const r12 = this._errorContext; r12.errorUnsupportedIf(!this.json.accessors, "Accessors missing."); const s5 = this.json.accessors[e11]; r12.errorUnsupportedIf(null == (s5 == null ? void 0 : s5.bufferView), "Some accessor does not specify a bufferView."), r12.errorUnsupportedIf(s5.type in [A2.MAT2, A2.MAT3, A2.MAT4], `AttributeType ${s5.type} is not supported`); const n7 = this.json.bufferViews[s5.bufferView], o7 = await this.getBuffer(n7.buffer, t10), a2 = V2[s5.type], i7 = Y2[s5.componentType], u6 = a2 * i7, c7 = n7.byteStride || u6; return { raw: o7.buffer, byteStride: c7, byteOffset: o7.byteOffset + (n7.byteOffset || 0) + (s5.byteOffset || 0), entryCount: s5.count, isDenselyPacked: c7 === u6, componentCount: a2, componentByteSize: i7, componentType: s5.componentType, min: s5.min, max: s5.max, normalized: !!s5.normalized }; } async getIndexData(e11, t10) { if (null == e11.indices) return; const r12 = await this.getAccessor(e11.indices, t10); if (r12.isDenselyPacked) switch (r12.componentType) { case C.UNSIGNED_BYTE: return new Uint8Array(r12.raw, r12.byteOffset, r12.entryCount); case C.UNSIGNED_SHORT: return new Uint16Array(r12.raw, r12.byteOffset, r12.entryCount); case C.UNSIGNED_INT: return new Uint32Array(r12.raw, r12.byteOffset, r12.entryCount); } else switch (r12.componentType) { case C.UNSIGNED_BYTE: return t6(this._wrapAccessor(d, r12)); case C.UNSIGNED_SHORT: return t6(this._wrapAccessor(g, r12)); case C.UNSIGNED_INT: return t6(this._wrapAccessor(B, r12)); } } async getPositionData(e11, t10) { const r12 = this._errorContext; r12.errorUnsupportedIf(null == e11.attributes.POSITION, "No POSITION vertex data found."); const s5 = await this.getAccessor(e11.attributes.POSITION, t10); return r12.errorUnsupportedIf(s5.componentType !== C.FLOAT, "Expected type FLOAT for POSITION vertex attribute, but found " + C[s5.componentType]), r12.errorUnsupportedIf(3 !== s5.componentCount, "POSITION vertex attribute must have 3 components, but found " + s5.componentCount.toFixed()), this._wrapAccessor(i3, s5); } async getNormalData(e11, t10) { const r12 = this._errorContext; r12.assert(null != e11.attributes.NORMAL, "No NORMAL vertex data found."); const s5 = await this.getAccessor(e11.attributes.NORMAL, t10); return r12.errorUnsupportedIf(s5.componentType !== C.FLOAT, "Expected type FLOAT for NORMAL vertex attribute, but found " + C[s5.componentType]), r12.errorUnsupportedIf(3 !== s5.componentCount, "NORMAL vertex attribute must have 3 components, but found " + s5.componentCount.toFixed()), this._wrapAccessor(i3, s5); } async getTangentData(e11, t10) { const r12 = this._errorContext; r12.assert(null != e11.attributes.TANGENT, "No TANGENT vertex data found."); const s5 = await this.getAccessor(e11.attributes.TANGENT, t10); return r12.errorUnsupportedIf(s5.componentType !== C.FLOAT, "Expected type FLOAT for TANGENT vertex attribute, but found " + C[s5.componentType]), r12.errorUnsupportedIf(4 !== s5.componentCount, "TANGENT vertex attribute must have 4 components, but found " + s5.componentCount.toFixed()), new c2(s5.raw, s5.byteOffset, s5.byteStride, s5.byteOffset + s5.byteStride * s5.entryCount); } async getTextureCoordinates(e11, t10) { const r12 = this._errorContext; r12.assert(null != e11.attributes.TEXCOORD_0, "No TEXCOORD_0 vertex data found."); const s5 = await this.getAccessor(e11.attributes.TEXCOORD_0, t10); return r12.errorUnsupportedIf(2 !== s5.componentCount, "TEXCOORD_0 vertex attribute must have 2 components, but found " + s5.componentCount.toFixed()), s5.componentType === C.FLOAT ? this._wrapAccessor(u2, s5) : (r12.errorUnsupportedIf(!s5.normalized, "Integer component types are only supported for a normalized accessor for TEXCOORD_0."), J(s5)); } async getVertexColors(e11, t10) { const r12 = this._errorContext; r12.assert(null != e11.attributes.COLOR_0, "No COLOR_0 vertex data found."); const s5 = await this.getAccessor(e11.attributes.COLOR_0, t10); if (r12.errorUnsupportedIf(4 !== s5.componentCount && 3 !== s5.componentCount, "COLOR_0 attribute must have 3 or 4 components, but found " + s5.componentCount.toFixed()), 4 === s5.componentCount) { if (s5.componentType === C.FLOAT) return this._wrapAccessor(c2, s5); if (s5.componentType === C.UNSIGNED_BYTE) return this._wrapAccessor(x, s5); if (s5.componentType === C.UNSIGNED_SHORT) return this._wrapAccessor(L2, s5); } else if (3 === s5.componentCount) { if (s5.componentType === C.FLOAT) return this._wrapAccessor(i3, s5); if (s5.componentType === C.UNSIGNED_BYTE) return this._wrapAccessor(O, s5); if (s5.componentType === C.UNSIGNED_SHORT) return this._wrapAccessor(E, s5); } r12.errorUnsupported("Unsupported component type for COLOR_0 attribute: " + C[s5.componentType]); } hasPositions(e11) { return void 0 !== e11.attributes.POSITION; } hasNormals(e11) { return void 0 !== e11.attributes.NORMAL; } hasVertexColors(e11) { return void 0 !== e11.attributes.COLOR_0; } hasTextureCoordinates(e11) { return void 0 !== e11.attributes.TEXCOORD_0; } hasTangents(e11) { return void 0 !== e11.attributes.TANGENT; } async getMaterial(e11, t10, r12) { var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j; let s5 = e11.material ? this._materialCache.get(e11.material) : void 0; if (!s5) { const n7 = null != e11.material ? i4(this.json.materials[e11.material]) : i4(), o7 = n7.pbrMetallicRoughness, a2 = this.hasVertexColors(e11), i7 = this.getTexture(o7.baseColorTexture, t10), u6 = this.getTexture(n7.normalTexture, t10), c7 = r12 ? this.getTexture(n7.occlusionTexture, t10) : void 0, f10 = r12 ? this.getTexture(n7.emissiveTexture, t10) : void 0, d4 = r12 ? this.getTexture(o7.metallicRoughnessTexture, t10) : void 0, p3 = null != e11.material ? e11.material : -1; s5 = { alphaMode: n7.alphaMode, alphaCutoff: n7.alphaCutoff, color: o7.baseColorFactor, doubleSided: !!n7.doubleSided, colorTexture: await i7, normalTexture: await u6, name: n7.name, id: p3, occlusionTexture: await c7, emissiveTexture: await f10, emissiveFactor: n7.emissiveFactor, metallicFactor: o7.metallicFactor, roughnessFactor: o7.roughnessFactor, metallicRoughnessTexture: await d4, hasVertexColors: a2, ESRI_externalColorMixMode: n7.extras.ESRI_externalColorMixMode, colorTextureTransform: (_b = (_a = o7 == null ? void 0 : o7.baseColorTexture) == null ? void 0 : _a.extensions) == null ? void 0 : _b.KHR_texture_transform, normalTextureTransform: (_d = (_c = n7.normalTexture) == null ? void 0 : _c.extensions) == null ? void 0 : _d.KHR_texture_transform, occlusionTextureTransform: (_f = (_e = n7.occlusionTexture) == null ? void 0 : _e.extensions) == null ? void 0 : _f.KHR_texture_transform, emissiveTextureTransform: (_h = (_g = n7.emissiveTexture) == null ? void 0 : _g.extensions) == null ? void 0 : _h.KHR_texture_transform, metallicRoughnessTextureTransform: (_j = (_i = o7 == null ? void 0 : o7.metallicRoughnessTexture) == null ? void 0 : _i.extensions) == null ? void 0 : _j.KHR_texture_transform }; } return s5; } async getTexture(t10, r12) { if (!t10) return; this._errorContext.errorUnsupportedIf(0 !== (t10.texCoord || 0), "Only TEXCOORD with index 0 is supported."); const s5 = t10.index, n7 = this._errorContext, o7 = this.json.textures[s5], a2 = c5(null != o7.sampler ? this.json.samplers[o7.sampler] : {}); n7.errorUnsupportedIf(null == o7.source, "Source is expected to be defined for a texture."); const i7 = this.json.images[o7.source], u6 = await this._loadTextureImageData(s5, o7, r12); return r2(this._textureCache, s5, () => { const e11 = (e12) => 33071 === e12 || 33648 === e12 || 10497 === e12, t11 = (e12) => (n7.error(`Unexpected TextureSampler WrapMode: ${e12}. Using default REPEAT(10497).`), 10497); return { data: u6, wrapS: e11(a2.wrapS) ? a2.wrapS : t11(a2.wrapS), wrapT: e11(a2.wrapT) ? a2.wrapT : t11(a2.wrapT), minFilter: a2.minFilter, name: i7.name, id: s5 }; }); } getNodeTransform(e11) { if (void 0 === e11) return k; let t10 = this._nodeTransformCache.get(e11); if (!t10) { const r12 = this.getNodeTransform(this._getNodeParent(e11)), s5 = this.json.nodes[e11]; s5.matrix ? t10 = u(e3(), r12, s5.matrix) : s5.translation || s5.rotation || s5.scale ? (t10 = r4(r12), s5.translation && c(t10, t10, s5.translation), s5.rotation && (H[3] = x2(H, s5.rotation), f2(t10, t10, H[3], H)), s5.scale && i2(t10, t10, s5.scale)) : t10 = r12, this._nodeTransformCache.set(e11, t10); } return t10; } _wrapAccessor(e11, t10) { return new e11(t10.raw, t10.byteOffset, t10.byteStride, t10.byteOffset + t10.byteStride * (t10.entryCount - 1) + t10.componentByteSize * t10.componentCount); } _resolveUri(e11) { return Q(e11, this._baseUri); } _getNodeParent(e11) { return this._nodeParentMap.get(e11); } _checkVersionSupported() { const e11 = r5.parse(this.json.asset.version, "glTF"); P.validate(e11); } _checkRequiredExtensionsSupported() { const e11 = this.json, t10 = this._errorContext; e11.extensionsRequired && 0 !== e11.extensionsRequired.length && t10.errorUnsupported("gltf loader was not able to load unsupported feature. Required extensions: " + e11.extensionsRequired.join(", ")); } _computeNodeParents() { this.json.nodes.forEach((e11, t10) => { e11.children && e11.children.forEach((e12) => { this._nodeParentMap.set(e12, t10); }); }); } async _loadTextureImageData(e11, t10, r12) { const s5 = this._textureLoaders.get(e11); if (s5) return s5; const n7 = this._createTextureLoader(t10, r12); return this._textureLoaders.set(e11, n7), n7; } async _createTextureLoader(e11, t10) { const r12 = this.json.images[e11.source]; if (r12.uri) return this._context.loadImage(this._resolveUri(r12.uri), t10); const s5 = this._errorContext; s5.errorUnsupportedIf(null == r12.bufferView, "Image bufferView must be defined."), s5.errorUnsupportedIf(null == r12.mimeType, "Image mimeType must be defined."); const n7 = this.json.bufferViews[r12.bufferView], o7 = await this.getBuffer(n7.buffer, t10); return s5.errorUnsupportedIf(null != n7.byteStride, "byteStride not supported for image buffer"), q2(new Uint8Array(o7.buffer, o7.byteOffset + (n7.byteOffset || 0), n7.byteLength), r12.mimeType); } async getLoadedBuffersSize() { if (this._glbBuffer) return this._glbBuffer.byteLength; const e11 = await L(Array.from(this._bufferLoaders.values())), r12 = await L(Array.from(this._textureLoaders.values())); return e11.reduce((e12, t10) => { var _a; return e12 + ((_a = t10 == null ? void 0 : t10.byteLength) != null ? _a : 0); }, 0) + r12.reduce((e12, t10) => e12 + (t10 ? t10.width * t10.height * 4 : 0), 0); } }; var P = new r5(2, 0, "glTF"); var k = p(e3(), Math.PI / 2); var H = e4(); var V2 = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4 }; var Y2 = { [C.BYTE]: 1, [C.UNSIGNED_BYTE]: 1, [C.SHORT]: 2, [C.UNSIGNED_SHORT]: 2, [C.FLOAT]: 4, [C.UNSIGNED_INT]: 4 }; function J(e11) { switch (e11.componentType) { case C.BYTE: return new V(e11.raw, e11.byteOffset, e11.byteStride, e11.byteOffset + e11.byteStride * e11.entryCount); case C.UNSIGNED_BYTE: return new A(e11.raw, e11.byteOffset, e11.byteStride, e11.byteOffset + e11.byteStride * e11.entryCount); case C.SHORT: return new q(e11.raw, e11.byteOffset, e11.byteStride, e11.byteOffset + e11.byteStride * e11.entryCount); case C.UNSIGNED_SHORT: return new w2(e11.raw, e11.byteOffset, e11.byteStride, e11.byteOffset + e11.byteStride * e11.entryCount); case C.UNSIGNED_INT: return new F(e11.raw, e11.byteOffset, e11.byteStride, e11.byteOffset + e11.byteStride * e11.entryCount); case C.FLOAT: return new u2(e11.raw, e11.byteOffset, e11.byteStride, e11.byteOffset + e11.byteStride * e11.entryCount); } } async function K(e11) { return new Promise((t10, r12) => { const s5 = new Blob([e11]), n7 = new FileReader(); n7.onload = () => { const e12 = n7.result; t10(JSON.parse(e12)); }, n7.onerror = (e12) => { r12(e12); }, n7.readAsText(s5); }); } async function q2(e11, t10) { return new Promise((r12, s5) => { const n7 = new Blob([e11], { type: t10 }), o7 = URL.createObjectURL(n7), a2 = new Image(), i7 = () => { URL.revokeObjectURL(o7), "decode" in a2 ? a2.decode().then(() => r12(a2), () => r12(a2)).then(c7) : (r12(a2), c7()); }, u6 = (e12) => { URL.revokeObjectURL(o7), s5(e12), c7(); }, c7 = () => { a2.removeEventListener("load", i7), a2.removeEventListener("error", u6); }; a2.addEventListener("load", i7), a2.addEventListener("error", u6), a2.src = o7; }); } // node_modules/@arcgis/core/views/3d/glTF/loader.js var u4 = 0; async function m(r12, s5, a2 = {}, i7 = true) { const m2 = await F2.load(r12, x3, s5, a2), p3 = "gltf_" + u4++, T2 = { lods: [], materials: /* @__PURE__ */ new Map(), textures: /* @__PURE__ */ new Map(), meta: c6(m2) }, h = !(!m2.json.asset.extras || "symbolResource" !== m2.json.asset.extras.ESRI_type), g2 = /* @__PURE__ */ new Map(); await d3(m2, async (r13, s6, n7, u6) => { var _a; const c7 = (_a = g2.get(n7)) != null ? _a : 0; g2.set(n7, c7 + 1); const d4 = void 0 !== r13.mode ? r13.mode : E2.TRIANGLES, h2 = d4 === E2.TRIANGLES || d4 === E2.TRIANGLE_STRIP || d4 === E2.TRIANGLE_FAN ? d4 : null; if (t(h2)) return void x3.warnUnsupported("Unsupported primitive mode (" + E2[d4] + "). Skipping primitive."); if (!m2.hasPositions(r13)) return void x3.warn("Skipping primitive without POSITION vertex attribute."); const R2 = m2.getPositionData(r13, a2), w3 = m2.getMaterial(r13, a2, i7), v = m2.hasNormals(r13) ? m2.getNormalData(r13, a2) : null, S = m2.hasTangents(r13) ? m2.getTangentData(r13, a2) : null, _ = m2.hasTextureCoordinates(r13) ? m2.getTextureCoordinates(r13, a2) : null, E4 = m2.hasVertexColors(r13) ? m2.getVertexColors(r13, a2) : null, I = m2.getIndexData(r13, a2), M2 = { transform: r4(s6), attributes: { position: await R2, normal: v ? await v : null, texCoord0: _ ? await _ : null, color: E4 ? await E4 : null, tangent: S ? await S : null }, indices: await I, primitiveType: h2, material: f7(T2, await w3, p3) }; let F3 = null; r(T2.meta) && r(T2.meta.ESRI_lod) && "screenSpaceRadius" === T2.meta.ESRI_lod.metric && (F3 = T2.meta.ESRI_lod.thresholds[n7]), T2.lods[n7] = T2.lods[n7] || { parts: [], name: u6, lodThreshold: F3 }, T2.lods[n7].parts[c7] = M2; }); for (const e11 of T2.lods) e11.parts = e11.parts.filter((e12) => !!e12); const R = await m2.getLoadedBuffersSize(); return { model: T2, meta: { isEsriSymbolResource: h, uri: m2.uri }, customMeta: {}, size: R }; } function c6(o7) { const t10 = o7.json; let r12 = null; return t10.nodes.forEach((o8) => { const t11 = o8.extras; r(t11) && (t11.ESRI_proxyEllipsoid || t11.ESRI_lod) && (r12 = t11); }), r12; } async function d3(e11, o7) { const t10 = e11.json, r12 = t10.scenes[t10.scene || 0].nodes, s5 = r12.length > 1, a2 = []; for (const i7 of r12) { const e12 = t10.nodes[i7]; if (a2.push(n7(i7, 0)), p2(e12) && !s5) { e12.extensions.MSFT_lod.ids.forEach((e13, o8) => n7(e13, o8 + 1)); } } async function n7(r13, s6) { const i7 = t10.nodes[r13], l3 = e11.getNodeTransform(r13); if (x3.warnUnsupportedIf(null != i7.weights, "Morph targets are not supported."), null != i7.mesh) { const e12 = t10.meshes[i7.mesh]; for (const t11 of e12.primitives) a2.push(o7(t11, l3, s6, e12.name)); } for (const e12 of i7.children || []) a2.push(n7(e12, s6)); } await Promise.all(a2); } function p2(e11) { return e11.extensions && e11.extensions.MSFT_lod && Array.isArray(e11.extensions.MSFT_lod.ids); } function f7(e11, o7, t10) { const r12 = (o8) => { const r13 = `${t10}_tex_${o8 && o8.id}${o8 && o8.name ? "_" + o8.name : ""}`; if (o8 && !e11.textures.has(r13)) { const t11 = l(o8.data, { wrap: { s: o8.wrapS, t: o8.wrapT }, mipmap: T.includes(o8.minFilter), noUnpackFlip: true }); e11.textures.set(r13, t11); } return r13; }, n7 = `${t10}_mat_${o7.id}_${o7.name}`; if (!e11.materials.has(n7)) { const t11 = r9({ color: [o7.color[0], o7.color[1], o7.color[2]], opacity: o7.color[3], alphaMode: o7.alphaMode, alphaCutoff: o7.alphaCutoff, doubleSided: o7.doubleSided, colorMixMode: o7.ESRI_externalColorMixMode, textureColor: o7.colorTexture ? r12(o7.colorTexture) : void 0, textureNormal: o7.normalTexture ? r12(o7.normalTexture) : void 0, textureOcclusion: o7.occlusionTexture ? r12(o7.occlusionTexture) : void 0, textureEmissive: o7.emissiveTexture ? r12(o7.emissiveTexture) : void 0, textureMetallicRoughness: o7.metallicRoughnessTexture ? r12(o7.metallicRoughnessTexture) : void 0, emissiveFactor: [o7.emissiveFactor[0], o7.emissiveFactor[1], o7.emissiveFactor[2]], colorTextureTransform: o7.colorTextureTransform, normalTextureTransform: o7.normalTextureTransform, occlusionTextureTransform: o7.occlusionTextureTransform, emissiveTextureTransform: o7.emissiveTextureTransform, metallicRoughnessTextureTransform: o7.metallicRoughnessTextureTransform, metallicFactor: o7.metallicFactor, roughnessFactor: o7.roughnessFactor }); e11.materials.set(n7, t11); } return n7; } var x3 = new o3(); var T = [L3.LINEAR_MIPMAP_LINEAR, L3.LINEAR_MIPMAP_NEAREST]; // node_modules/@arcgis/core/views/3d/webgl-engine/lib/Indices.js var r11 = 1024; function n6(n7) { if (Array.isArray(n7)) { if (n7.length < r11) return n7; for (const r12 of n7) if (r12 >= 65536) return new Uint32Array(n7); return new Uint16Array(n7); } if (n7.BYTES_PER_ELEMENT === Uint16Array.BYTES_PER_ELEMENT) return n7; for (const r12 of n7) if (r12 >= 65536) return n7; return new Uint16Array(n7); } function t9(n7) { const t10 = 3 * n7; return t10 <= r11 ? new Array(t10) : t10 <= 65536 ? new Uint16Array(t10) : new Uint32Array(t10); } var e10 = (() => { const r12 = new Uint32Array(131072); for (let n7 = 0; n7 < r12.length; ++n7) r12[n7] = n7; return r12; })(); var i5 = [0]; var f8 = (() => { const r12 = new Uint16Array(65536); for (let n7 = 0; n7 < r12.length; ++n7) r12[n7] = n7; return r12; })(); function u5(n7) { if (1 === n7) return i5; if (n7 < r11) return Array.from(new Uint16Array(f8.buffer, 0, n7)); if (n7 < f8.length) return new Uint16Array(f8.buffer, 0, n7); if (n7 > e10.length) { const r12 = Math.max(2 * e10.length, n7); e10 = new Uint32Array(r12); for (let n8 = 0; n8 < e10.length; n8++) e10[n8] = n8; } return new Uint32Array(e10.buffer, 0, n7); } function o4(n7) { if (1 === n7) return i5; if (n7 < r11) return Array.from(new Uint16Array(f8.buffer, 0, n7)); if (n7 < f8.length) return new Uint16Array(f8.slice(0, n7)); if (n7 > e10.length) { const r12 = new Uint32Array(n7); for (let n8 = 0; n8 < r12.length; n8++) r12[n8] = n8; return r12; } return new Uint32Array(e10.slice(0, n7)); } // node_modules/@arcgis/core/views/3d/glTF/internal/indexUtils.js function o5(r12, o7 = u5) { return "number" == typeof r12 ? o7(r12) : i(r12) || e(r12) ? new Uint32Array(r12) : r12; } function f9(e11) { const t10 = "number" == typeof e11 ? e11 : e11.length; if (t10 < 3) return []; const n7 = t10 - 2, o7 = t9(n7); if ("number" == typeof e11) { let e12 = 0; for (let t11 = 0; t11 < n7; t11 += 1) t11 % 2 == 0 ? (o7[e12++] = t11, o7[e12++] = t11 + 1, o7[e12++] = t11 + 2) : (o7[e12++] = t11 + 1, o7[e12++] = t11, o7[e12++] = t11 + 2); } else { let t11 = 0; for (let r12 = 0; r12 < n7; r12 += 1) if (r12 % 2 == 0) { const n8 = e11[r12], f10 = e11[r12 + 1], i7 = e11[r12 + 2]; o7[t11++] = n8, o7[t11++] = f10, o7[t11++] = i7; } else { const n8 = e11[r12 + 1], f10 = e11[r12], i7 = e11[r12 + 2]; o7[t11++] = n8, o7[t11++] = f10, o7[t11++] = i7; } } return o7; } function i6(e11) { const t10 = "number" == typeof e11 ? e11 : e11.length; if (t10 < 3) return new Uint16Array(0); const n7 = t10 - 2, r12 = n7 <= 65536 ? new Uint16Array(3 * n7) : new Uint32Array(3 * n7); if ("number" == typeof e11) { let e12 = 0; for (let t11 = 0; t11 < n7; ++t11) r12[e12++] = 0, r12[e12++] = t11 + 1, r12[e12++] = t11 + 2; return r12; } { const t11 = e11[0]; let o7 = e11[1], f10 = 0; for (let i7 = 0; i7 < n7; ++i7) { const n8 = e11[i7 + 2]; r12[f10++] = t11, r12[f10++] = o7, r12[f10++] = n8, o7 = n8; } return r12; } } // node_modules/@arcgis/core/views/3d/webgl-engine/materials/DefaultMaterial_COLOR_GAMMA.js var o6 = 2.1; export { r6 as r, f3 as f, o, n2 as n, n3 as n2, d2 as d, e6 as e, t3 as t, r8 as r2, n4 as n3, m, n6 as n4, u5 as u, o4 as o2, o5 as o3, f9 as f2, i6 as i, o6 as o4 }; //# sourceMappingURL=chunk-3AFXMP6W.js.map