chunk-NBRP7CWO.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846
  1. import {
  2. v
  3. } from "./chunk-GXVMJ7RN.js";
  4. import {
  5. s as s4
  6. } from "./chunk-6BRTRIDE.js";
  7. import {
  8. c as c3,
  9. e as e3,
  10. r as r3,
  11. u as u4
  12. } from "./chunk-2QVXRTVA.js";
  13. import {
  14. C,
  15. D,
  16. E as E2,
  17. L as L2
  18. } from "./chunk-MI7HWWFL.js";
  19. import {
  20. e as e6
  21. } from "./chunk-4KFEVYXL.js";
  22. import {
  23. x as x2
  24. } from "./chunk-5W6F4NR5.js";
  25. import {
  26. e as e5
  27. } from "./chunk-YZUP3MAF.js";
  28. import {
  29. e as e4,
  30. r as r4
  31. } from "./chunk-E3HOL2XO.js";
  32. import {
  33. A,
  34. B,
  35. E,
  36. F,
  37. L,
  38. O,
  39. V,
  40. c as c2,
  41. d,
  42. g as g2,
  43. i as i3,
  44. q as q2,
  45. u as u3,
  46. w as w2,
  47. x
  48. } from "./chunk-H4JLO5B2.js";
  49. import {
  50. r as r5
  51. } from "./chunk-LPQPD3EP.js";
  52. import {
  53. n as n2
  54. } from "./chunk-H2KDMZTR.js";
  55. import {
  56. c,
  57. f as f2,
  58. g,
  59. i as i2,
  60. u as u2
  61. } from "./chunk-TERAW6FT.js";
  62. import {
  63. _,
  64. e as e2,
  65. o,
  66. q,
  67. s as s3,
  68. u
  69. } from "./chunk-XNLG7T2T.js";
  70. import {
  71. n
  72. } from "./chunk-IR4PV7VK.js";
  73. import {
  74. a
  75. } from "./chunk-WJ3OEUD3.js";
  76. import {
  77. U
  78. } from "./chunk-VNFRAYHO.js";
  79. import {
  80. Q,
  81. X,
  82. Y,
  83. nt
  84. } from "./chunk-VBRY5KJM.js";
  85. import {
  86. r as r2
  87. } from "./chunk-IHXECKQQ.js";
  88. import {
  89. f,
  90. w
  91. } from "./chunk-ULGDPLM2.js";
  92. import {
  93. s,
  94. s3 as s2
  95. } from "./chunk-EMJ4ZSM2.js";
  96. import {
  97. e2 as e,
  98. i3 as i,
  99. r,
  100. t
  101. } from "./chunk-GZT4BVFP.js";
  102. // node_modules/@arcgis/core/chunks/vec42.js
  103. function t2(t12, r11, f9) {
  104. if (t12.count !== r11.count)
  105. return void e6.error("source and destination buffers need to have the same number of elements");
  106. const o7 = t12.count, n8 = f9[0], u8 = f9[1], d4 = f9[2], s7 = f9[3], c9 = f9[4], i6 = f9[5], a4 = f9[6], p2 = f9[7], y2 = f9[8], B2 = f9[9], m3 = f9[10], l4 = f9[11], S = f9[12], h2 = f9[13], b2 = f9[14], M3 = f9[15], v2 = t12.typedBuffer, g4 = t12.typedBufferStride, _2 = r11.typedBuffer, j = r11.typedBufferStride;
  107. for (let e11 = 0; e11 < o7; e11++) {
  108. const t13 = e11 * g4, r12 = e11 * j, f10 = _2[r12], o8 = _2[r12 + 1], z2 = _2[r12 + 2], O3 = _2[r12 + 3];
  109. v2[t13] = n8 * f10 + c9 * o8 + y2 * z2 + S * O3, v2[t13 + 1] = u8 * f10 + i6 * o8 + B2 * z2 + h2 * O3, v2[t13 + 2] = d4 * f10 + a4 * o8 + m3 * z2 + b2 * O3, v2[t13 + 3] = s7 * f10 + p2 * o8 + l4 * z2 + M3 * O3;
  110. }
  111. }
  112. function r6(t12, r11, f9) {
  113. if (t12.count !== r11.count)
  114. return void e6.error("source and destination buffers need to have the same number of elements");
  115. const o7 = t12.count, n8 = f9[0], u8 = f9[1], d4 = f9[2], s7 = f9[3], c9 = f9[4], i6 = f9[5], a4 = f9[6], p2 = f9[7], y2 = f9[8], B2 = t12.typedBuffer, m3 = t12.typedBufferStride, l4 = r11.typedBuffer, S = r11.typedBufferStride;
  116. for (let e11 = 0; e11 < o7; e11++) {
  117. const t13 = e11 * m3, r12 = e11 * S, f10 = l4[r12], o8 = l4[r12 + 1], h2 = l4[r12 + 2], b2 = l4[r12 + 3];
  118. B2[t13] = n8 * f10 + s7 * o8 + a4 * h2, B2[t13 + 1] = u8 * f10 + c9 * o8 + p2 * h2, B2[t13 + 2] = d4 * f10 + i6 * o8 + y2 * h2, B2[t13 + 3] = b2;
  119. }
  120. }
  121. function f3(e11, t12) {
  122. const r11 = Math.min(e11.count, t12.count), f9 = e11.typedBuffer, o7 = e11.typedBufferStride, n8 = t12.typedBuffer, u8 = t12.typedBufferStride;
  123. for (let d4 = 0; d4 < r11; d4++) {
  124. const e12 = d4 * o7, t13 = d4 * u8, r12 = n8[t13], s7 = n8[t13 + 1], c9 = n8[t13 + 2], i6 = r12 * r12 + s7 * s7 + c9 * c9;
  125. if (i6 > 0) {
  126. const t14 = 1 / Math.sqrt(i6);
  127. f9[e12] = t14 * r12, f9[e12 + 1] = t14 * s7, f9[e12 + 2] = t14 * c9;
  128. }
  129. }
  130. }
  131. function o2(e11, t12, r11) {
  132. const f9 = Math.min(e11.count, t12.count), o7 = e11.typedBuffer, n8 = e11.typedBufferStride, u8 = t12.typedBuffer, d4 = t12.typedBufferStride;
  133. for (let s7 = 0; s7 < f9; s7++) {
  134. const e12 = s7 * n8, t13 = s7 * d4;
  135. o7[e12] = r11 * u8[t13], o7[e12 + 1] = r11 * u8[t13 + 1], o7[e12 + 2] = r11 * u8[t13 + 2], o7[e12 + 3] = r11 * u8[t13 + 3];
  136. }
  137. }
  138. function n3(e11, t12, r11) {
  139. const f9 = Math.min(e11.count, t12.count), o7 = e11.typedBuffer, n8 = e11.typedBufferStride, u8 = t12.typedBuffer, d4 = t12.typedBufferStride;
  140. for (let s7 = 0; s7 < f9; s7++) {
  141. const e12 = s7 * n8, t13 = s7 * d4;
  142. o7[e12] = u8[t13] >> r11, o7[e12 + 1] = u8[t13 + 1] >> r11, o7[e12 + 2] = u8[t13 + 2] >> r11, o7[e12 + 3] = u8[t13 + 3] >> r11;
  143. }
  144. }
  145. var u5 = Object.freeze(Object.defineProperty({ __proto__: null, transformMat4: t2, transformMat3: r6, normalize: f3, scale: o2, shiftRight: n3 }, Symbol.toStringTag, { value: "Module" }));
  146. // node_modules/@arcgis/core/chunks/vec22.js
  147. function f4(e11, t12, r11) {
  148. const f9 = e11.typedBuffer, n8 = e11.typedBufferStride, d4 = t12.typedBuffer, o7 = t12.typedBufferStride, u8 = r11 ? r11.count : t12.count;
  149. let s7 = (r11 && r11.dstIndex ? r11.dstIndex : 0) * n8, c9 = (r11 && r11.srcIndex ? r11.srcIndex : 0) * o7;
  150. for (let p2 = 0; p2 < u8; ++p2)
  151. f9[s7] = d4[c9], f9[s7 + 1] = d4[c9 + 1], s7 += n8, c9 += o7;
  152. }
  153. function n4(n8, d4, o7) {
  154. const u8 = n8.typedBuffer, s7 = n8.typedBufferStride, c9 = d4.typedBuffer, p2 = d4.typedBufferStride, l4 = o7 ? o7.count : d4.count;
  155. let y2 = (o7 && o7.dstIndex ? o7.dstIndex : 0) * s7, i6 = (o7 && o7.srcIndex ? o7.srcIndex : 0) * p2;
  156. if (c3(d4.elementType)) {
  157. const e11 = u4(d4.elementType);
  158. if (r3(d4.elementType))
  159. for (let t12 = 0; t12 < l4; ++t12)
  160. u8[y2] = Math.max(c9[i6] / e11, -1), u8[y2 + 1] = Math.max(c9[i6 + 1] / e11, -1), y2 += s7, i6 += p2;
  161. else
  162. for (let t12 = 0; t12 < l4; ++t12)
  163. u8[y2] = c9[i6] / e11, u8[y2 + 1] = c9[i6 + 1] / e11, y2 += s7, i6 += p2;
  164. } else
  165. f4(n8, d4, o7);
  166. return n8;
  167. }
  168. function d2(e11, t12, r11, f9) {
  169. const n8 = e11.typedBuffer, d4 = e11.typedBufferStride, o7 = f9?.count ?? e11.count;
  170. let u8 = (f9?.dstIndex ?? 0) * d4;
  171. for (let s7 = 0; s7 < o7; ++s7)
  172. n8[u8] = t12, n8[u8 + 1] = r11, u8 += d4;
  173. }
  174. var o3 = Object.freeze(Object.defineProperty({ __proto__: null, copy: f4, normalizeIntegerBuffer: n4, fill: d2 }, Symbol.toStringTag, { value: "Module" }));
  175. // node_modules/@arcgis/core/chunks/vec43.js
  176. function e7(e11, t12, f9) {
  177. const d4 = e11.typedBuffer, n8 = e11.typedBufferStride, o7 = t12.typedBuffer, r11 = t12.typedBufferStride, c9 = f9 ? f9.count : t12.count;
  178. let u8 = (f9 && f9.dstIndex ? f9.dstIndex : 0) * n8, l4 = (f9 && f9.srcIndex ? f9.srcIndex : 0) * r11;
  179. for (let s7 = 0; s7 < c9; ++s7)
  180. d4[u8] = o7[l4], d4[u8 + 1] = o7[l4 + 1], d4[u8 + 2] = o7[l4 + 2], d4[u8 + 3] = o7[l4 + 3], u8 += n8, l4 += r11;
  181. }
  182. function t3(e11, t12, f9, d4, n8, o7) {
  183. const r11 = e11.typedBuffer, c9 = e11.typedBufferStride, u8 = o7?.count ?? e11.count;
  184. let l4 = (o7?.dstIndex ?? 0) * c9;
  185. for (let s7 = 0; s7 < u8; ++s7)
  186. r11[l4] = t12, r11[l4 + 1] = f9, r11[l4 + 2] = d4, r11[l4 + 3] = n8, l4 += c9;
  187. }
  188. var f5 = Object.freeze(Object.defineProperty({ __proto__: null, copy: e7, fill: t3 }, Symbol.toStringTag, { value: "Module" }));
  189. // node_modules/@arcgis/core/chunks/mat32.js
  190. function e8(e11, t12, r11) {
  191. const o7 = e11.typedBuffer, d4 = e11.typedBufferStride, f9 = t12.typedBuffer, n8 = t12.typedBufferStride, c9 = r11 ? r11.count : t12.count;
  192. let u8 = (r11 && r11.dstIndex ? r11.dstIndex : 0) * d4, l4 = (r11 && r11.srcIndex ? r11.srcIndex : 0) * n8;
  193. for (let p2 = 0; p2 < c9; ++p2) {
  194. for (let e12 = 0; e12 < 9; ++e12)
  195. o7[u8 + e12] = f9[l4 + e12];
  196. u8 += d4, l4 += n8;
  197. }
  198. }
  199. var t4 = Object.freeze(Object.defineProperty({ __proto__: null, copy: e8 }, Symbol.toStringTag, { value: "Module" }));
  200. // node_modules/@arcgis/core/chunks/mat42.js
  201. function e9(e11, t12, r11) {
  202. const o7 = e11.typedBuffer, d4 = e11.typedBufferStride, f9 = t12.typedBuffer, n8 = t12.typedBufferStride, c9 = r11 ? r11.count : t12.count;
  203. let u8 = (r11 && r11.dstIndex ? r11.dstIndex : 0) * d4, l4 = (r11 && r11.srcIndex ? r11.srcIndex : 0) * n8;
  204. for (let p2 = 0; p2 < c9; ++p2) {
  205. for (let e12 = 0; e12 < 16; ++e12)
  206. o7[u8 + e12] = f9[l4 + e12];
  207. u8 += d4, l4 += n8;
  208. }
  209. }
  210. var t5 = Object.freeze(Object.defineProperty({ __proto__: null, copy: e9 }, Symbol.toStringTag, { value: "Module" }));
  211. // node_modules/@arcgis/core/chunks/scalar.js
  212. function e10(e11, t12, r11) {
  213. const n8 = e11.typedBuffer, o7 = e11.typedBufferStride, c9 = t12.typedBuffer, d4 = t12.typedBufferStride, f9 = r11 ? r11.count : t12.count;
  214. let u8 = (r11 && r11.dstIndex ? r11.dstIndex : 0) * o7, s7 = (r11 && r11.srcIndex ? r11.srcIndex : 0) * d4;
  215. for (let p2 = 0; p2 < f9; ++p2)
  216. n8[u8] = c9[s7], u8 += o7, s7 += d4;
  217. }
  218. function t6(e11, t12) {
  219. const r11 = e11.count;
  220. t12 || (t12 = new e11.TypedArrayConstructor(r11));
  221. for (let n8 = 0; n8 < r11; n8++)
  222. t12[n8] = e11.get(n8);
  223. return t12;
  224. }
  225. var r7 = Object.freeze(Object.defineProperty({ __proto__: null, copy: e10, makeDense: t6 }, Symbol.toStringTag, { value: "Module" }));
  226. // node_modules/@arcgis/core/geometry/support/buffer/utils.js
  227. function r8(s7, r11) {
  228. return new s7(new ArrayBuffer(r11 * s7.ElementCount * e3(s7.ElementType)));
  229. }
  230. // node_modules/@arcgis/core/views/3d/glTF/DefaultLoadingContext.js
  231. var n5 = class {
  232. constructor(r11) {
  233. this.streamDataRequester = r11;
  234. }
  235. async loadJSON(r11, e11) {
  236. return this._load("json", r11, e11);
  237. }
  238. async loadBinary(r11, e11) {
  239. return X(r11) ? (f(e11), Y(r11)) : this._load("binary", r11, e11);
  240. }
  241. async loadImage(r11, e11) {
  242. return this._load("image", r11, e11);
  243. }
  244. async _load(t12, i6, m3) {
  245. if (t(this.streamDataRequester))
  246. return (await U(i6, { responseType: c4[t12] })).data;
  247. const n8 = await a(this.streamDataRequester.request(i6, t12, m3));
  248. if (n8.ok === true)
  249. return n8.value;
  250. throw w(n8.error), new s2("", `Request for resource failed: ${n8.error}`);
  251. }
  252. };
  253. var c4 = { image: "image", binary: "array-buffer", json: "json" };
  254. // node_modules/@arcgis/core/views/3d/glTF/DefaultErrorContext.js
  255. var o4 = s.getLogger("esri.views.3d.glTF");
  256. var t7 = class {
  257. error(e11) {
  258. throw new s2("gltf-loader-error", e11);
  259. }
  260. errorUnsupported(e11) {
  261. throw new s2("gltf-loader-unsupported-feature", e11);
  262. }
  263. errorUnsupportedIf(r11, e11) {
  264. r11 && this.errorUnsupported(e11);
  265. }
  266. assert(r11, e11) {
  267. r11 || this.error(e11);
  268. }
  269. warn(r11) {
  270. o4.warn(r11);
  271. }
  272. warnUnsupported(r11) {
  273. this.warn("[Unsupported Feature] " + r11);
  274. }
  275. warnUnsupportedIf(r11, e11) {
  276. r11 && this.warnUnsupported(e11);
  277. }
  278. };
  279. // node_modules/@arcgis/core/views/3d/glTF/LoaderResult.js
  280. function t8(e11 = {}) {
  281. 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, emissiveFactor: [0, 0, 0], metallicFactor: 1, roughnessFactor: 1, colorMixMode: "multiply", ...e11 };
  282. }
  283. function l(t12, l4 = {}) {
  284. return { data: t12, parameters: { wrap: { s: D.REPEAT, t: D.REPEAT, ...l4.wrap }, noUnpackFlip: true, mipmap: false, ...l4 } };
  285. }
  286. // node_modules/@arcgis/core/views/3d/glTF/internal/BinaryStreamReader.js
  287. var t9 = class {
  288. constructor(t12) {
  289. this.data = t12, this.offset4 = 0, this.dataUint32 = new Uint32Array(this.data, 0, Math.floor(this.data.byteLength / 4));
  290. }
  291. readUint32() {
  292. const t12 = this.offset4;
  293. return this.offset4 += 1, this.dataUint32[t12];
  294. }
  295. readUint8Array(t12) {
  296. const s7 = 4 * this.offset4;
  297. return this.offset4 += t12 / 4, new Uint8Array(this.data, s7, t12);
  298. }
  299. remainingBytes() {
  300. return this.data.byteLength - 4 * this.offset4;
  301. }
  302. };
  303. // node_modules/@arcgis/core/views/3d/glTF/internal/enums.js
  304. var A2;
  305. var E3;
  306. !function(A4) {
  307. A4.SCALAR = "SCALAR", A4.VEC2 = "VEC2", A4.VEC3 = "VEC3", A4.VEC4 = "VEC4", A4.MAT2 = "MAT2", A4.MAT3 = "MAT3", A4.MAT4 = "MAT4";
  308. }(A2 || (A2 = {})), function(A4) {
  309. A4[A4.ARRAY_BUFFER = 34962] = "ARRAY_BUFFER", A4[A4.ELEMENT_ARRAY_BUFFER = 34963] = "ELEMENT_ARRAY_BUFFER";
  310. }(E3 || (E3 = {}));
  311. // node_modules/@arcgis/core/views/3d/glTF/internal/fillDefaults.js
  312. var t10 = { baseColorFactor: [1, 1, 1, 1], metallicFactor: 1, roughnessFactor: 1 };
  313. var a2 = { pbrMetallicRoughness: t10, emissiveFactor: [0, 0, 0], alphaMode: "OPAQUE", alphaCutoff: 0.5, doubleSided: false };
  314. var l2 = { ESRI_externalColorMixMode: "tint" };
  315. var i4 = (e11 = {}) => {
  316. const o7 = { ...t10, ...e11.pbrMetallicRoughness }, r11 = s5({ ...l2, ...e11.extras });
  317. return { ...a2, ...e11, pbrMetallicRoughness: o7, extras: r11 };
  318. };
  319. function s5(o7) {
  320. switch (o7.ESRI_externalColorMixMode) {
  321. case "multiply":
  322. case "tint":
  323. case "ignore":
  324. case "replace":
  325. break;
  326. default:
  327. n2(o7.ESRI_externalColorMixMode), o7.ESRI_externalColorMixMode = "tint";
  328. }
  329. return o7;
  330. }
  331. var n6 = { magFilter: L2.LINEAR, minFilter: L2.LINEAR_MIPMAP_LINEAR, wrapS: D.REPEAT, wrapT: D.REPEAT };
  332. var c5 = (e11) => ({ ...n6, ...e11 });
  333. // node_modules/@arcgis/core/views/3d/glTF/internal/pathUtils.js
  334. function r9(r11) {
  335. let e11, t12;
  336. return r11.replace(/^(.*\/)?([^/]*)$/, (r12, a4, i6) => (e11 = a4 || "", t12 = i6 || "", "")), { dirPart: e11, filePart: t12 };
  337. }
  338. // node_modules/@arcgis/core/views/3d/glTF/internal/Resource.js
  339. var M = { MAGIC: 1179937895, CHUNK_TYPE_JSON: 1313821514, CHUNK_TYPE_BIN: 5130562, MIN_HEADER_LENGTH: 20 };
  340. var F2 = class {
  341. constructor(e11, t12, r11, s7, n8) {
  342. this.context = e11, this.errorContext = t12, this.uri = r11, this.json = s7, this.glbBuffer = n8, this.bufferLoaders = new Map(), this.textureLoaders = new Map(), this.textureCache = new Map(), this.materialCache = new Map(), this.nodeParentMap = new Map(), this.nodeTransformCache = new Map(), this.baseUri = r9(this.uri).dirPart, this._checkVersionSupported(), this._checkRequiredExtensionsSupported(), t12.errorUnsupportedIf(s7.scenes == null, "Scenes must be defined."), t12.errorUnsupportedIf(s7.meshes == null, "Meshes must be defined"), t12.errorUnsupportedIf(s7.nodes == null, "Nodes must be defined."), this._computeNodeParents();
  343. }
  344. static async load(e11, t12, o7, a4) {
  345. if (X(o7)) {
  346. const r11 = nt(o7);
  347. if (r11.mediaType !== "model/gltf-binary")
  348. try {
  349. const s7 = JSON.parse(r11.isBase64 ? atob(r11.data) : r11.data);
  350. return new F2(e11, t12, o7, s7);
  351. } catch {
  352. }
  353. const a5 = Y(o7);
  354. if (F2._isGLBData(a5))
  355. return this._fromGLBData(e11, t12, o7, a5);
  356. }
  357. if (o7.endsWith(".gltf")) {
  358. const r11 = await e11.loadJSON(o7, a4);
  359. return new F2(e11, t12, o7, r11);
  360. }
  361. const i6 = await e11.loadBinary(o7, a4);
  362. if (F2._isGLBData(i6))
  363. return this._fromGLBData(e11, t12, o7, i6);
  364. const u8 = await e11.loadJSON(o7, a4);
  365. return new F2(e11, t12, o7, u8);
  366. }
  367. static _isGLBData(e11) {
  368. const t12 = new t9(e11);
  369. return t12.remainingBytes() >= 4 && t12.readUint32() === M.MAGIC;
  370. }
  371. static async _fromGLBData(e11, t12, r11, s7) {
  372. const n8 = await F2._parseGLBData(t12, s7);
  373. return new F2(e11, t12, r11, n8.json, n8.binaryData);
  374. }
  375. static async _parseGLBData(e11, t12) {
  376. const r11 = new t9(t12);
  377. e11.assert(r11.remainingBytes() >= 12, "GLB binary data is insufficiently large.");
  378. const s7 = r11.readUint32(), n8 = r11.readUint32(), o7 = r11.readUint32();
  379. e11.assert(s7 === M.MAGIC, "Magic first 4 bytes do not fit to expected GLB value."), e11.assert(t12.byteLength >= o7, "GLB binary data is smaller than header specifies."), e11.errorUnsupportedIf(n8 !== 2, "An unsupported GLB container version was detected. Only version 2 is supported.");
  380. let a4, i6, u8 = 0;
  381. for (; r11.remainingBytes() >= 8; ) {
  382. const t13 = r11.readUint32(), s8 = r11.readUint32();
  383. u8 === 0 ? (e11.assert(s8 === M.CHUNK_TYPE_JSON, "First GLB chunk must be JSON."), e11.assert(t13 >= 0, "No JSON data found."), a4 = await q3(r11.readUint8Array(t13))) : u8 === 1 ? (e11.errorUnsupportedIf(s8 !== M.CHUNK_TYPE_BIN, "Second GLB chunk expected to be BIN."), i6 = r11.readUint8Array(t13)) : e11.warnUnsupported("More than 2 GLB chunks detected. Skipping."), u8 += 1;
  384. }
  385. return a4 || e11.error("No GLB JSON chunk detected."), { json: a4, binaryData: i6 };
  386. }
  387. async getBuffer(e11, t12) {
  388. const r11 = this.json.buffers[e11], s7 = this.errorContext;
  389. if (r11.uri == null)
  390. return s7.assert(this.glbBuffer != null, "GLB buffer not present"), this.glbBuffer;
  391. const n8 = await this._getBufferLoader(e11, t12);
  392. return s7.assert(n8.byteLength === r11.byteLength, "Buffer byte lengths should match."), n8;
  393. }
  394. async _getBufferLoader(e11, t12) {
  395. const r11 = this.bufferLoaders.get(e11);
  396. if (r11)
  397. return r11;
  398. const s7 = this.json.buffers[e11], n8 = this.context.loadBinary(this._resolveUri(s7.uri), t12).then((e12) => new Uint8Array(e12));
  399. return this.bufferLoaders.set(e11, n8), n8;
  400. }
  401. async getAccessor(e11, t12) {
  402. const r11 = this.errorContext;
  403. r11.errorUnsupportedIf(!this.json.accessors, "Accessors missing.");
  404. const s7 = this.json.accessors[e11];
  405. r11.errorUnsupportedIf(s7?.bufferView == null, "Some accessor does not specify a bufferView."), r11.errorUnsupportedIf(s7.type in [A2.MAT2, A2.MAT3, A2.MAT4], `AttributeType ${s7.type} is not supported`);
  406. const n8 = this.json.bufferViews[s7.bufferView], o7 = await this.getBuffer(n8.buffer, t12), a4 = H[s7.type], i6 = Y2[s7.componentType], u8 = a4 * i6, c9 = n8.byteStride || u8;
  407. return { raw: o7.buffer, byteStride: c9, byteOffset: o7.byteOffset + (n8.byteOffset || 0) + (s7.byteOffset || 0), entryCount: s7.count, isDenselyPacked: c9 === u8, componentCount: a4, componentByteSize: i6, componentType: s7.componentType, min: s7.min, max: s7.max, normalized: !!s7.normalized };
  408. }
  409. async getIndexData(e11, t12) {
  410. if (e11.indices == null)
  411. return null;
  412. const r11 = await this.getAccessor(e11.indices, t12);
  413. if (r11.isDenselyPacked)
  414. switch (r11.componentType) {
  415. case C.UNSIGNED_BYTE:
  416. return new Uint8Array(r11.raw, r11.byteOffset, r11.entryCount);
  417. case C.UNSIGNED_SHORT:
  418. return new Uint16Array(r11.raw, r11.byteOffset, r11.entryCount);
  419. case C.UNSIGNED_INT:
  420. return new Uint32Array(r11.raw, r11.byteOffset, r11.entryCount);
  421. }
  422. else
  423. switch (r11.componentType) {
  424. case C.UNSIGNED_BYTE:
  425. return t6(this._wrapAccessor(d, r11));
  426. case C.UNSIGNED_SHORT:
  427. return t6(this._wrapAccessor(g2, r11));
  428. case C.UNSIGNED_INT:
  429. return t6(this._wrapAccessor(B, r11));
  430. }
  431. }
  432. async getPositionData(e11, t12) {
  433. const r11 = this.errorContext;
  434. r11.errorUnsupportedIf(e11.attributes.POSITION == null, "No POSITION vertex data found.");
  435. const s7 = await this.getAccessor(e11.attributes.POSITION, t12);
  436. return r11.errorUnsupportedIf(s7.componentType !== C.FLOAT, "Expected type FLOAT for POSITION vertex attribute, but found " + X2[s7.componentType]), r11.errorUnsupportedIf(s7.componentCount !== 3, "POSITION vertex attribute must have 3 components, but found " + s7.componentCount.toFixed()), this._wrapAccessor(i3, s7);
  437. }
  438. async getNormalData(e11, t12) {
  439. const r11 = this.errorContext;
  440. r11.assert(e11.attributes.NORMAL != null, "No NORMAL vertex data found.");
  441. const s7 = await this.getAccessor(e11.attributes.NORMAL, t12);
  442. return r11.errorUnsupportedIf(s7.componentType !== C.FLOAT, "Expected type FLOAT for NORMAL vertex attribute, but found " + X2[s7.componentType]), r11.errorUnsupportedIf(s7.componentCount !== 3, "NORMAL vertex attribute must have 3 components, but found " + s7.componentCount.toFixed()), this._wrapAccessor(i3, s7);
  443. }
  444. async getTangentData(e11, t12) {
  445. const r11 = this.errorContext;
  446. r11.assert(e11.attributes.TANGENT != null, "No TANGENT vertex data found.");
  447. const s7 = await this.getAccessor(e11.attributes.TANGENT, t12);
  448. return r11.errorUnsupportedIf(s7.componentType !== C.FLOAT, "Expected type FLOAT for TANGENT vertex attribute, but found " + X2[s7.componentType]), r11.errorUnsupportedIf(s7.componentCount !== 4, "TANGENT vertex attribute must have 4 components, but found " + s7.componentCount.toFixed()), new c2(s7.raw, s7.byteOffset, s7.byteStride, s7.byteOffset + s7.byteStride * s7.entryCount);
  449. }
  450. async getTextureCoordinates(e11, t12) {
  451. const r11 = this.errorContext;
  452. r11.assert(e11.attributes.TEXCOORD_0 != null, "No TEXCOORD_0 vertex data found.");
  453. const s7 = await this.getAccessor(e11.attributes.TEXCOORD_0, t12);
  454. return r11.errorUnsupportedIf(s7.componentCount !== 2, "TEXCOORD_0 vertex attribute must have 2 components, but found " + s7.componentCount.toFixed()), s7.componentType === C.FLOAT ? this._wrapAccessor(u3, s7) : (r11.errorUnsupportedIf(!s7.normalized, "Integer component types are only supported for a normalized accessor for TEXCOORD_0."), J(s7));
  455. }
  456. async getVertexColors(e11, t12) {
  457. const r11 = this.errorContext;
  458. r11.assert(e11.attributes.COLOR_0 != null, "No COLOR_0 vertex data found.");
  459. const s7 = await this.getAccessor(e11.attributes.COLOR_0, t12);
  460. if (r11.errorUnsupportedIf(s7.componentCount !== 4 && s7.componentCount !== 3, "COLOR_0 attribute must have 3 or 4 components, but found " + s7.componentCount.toFixed()), s7.componentCount === 4) {
  461. if (s7.componentType === C.FLOAT)
  462. return this._wrapAccessor(c2, s7);
  463. if (s7.componentType === C.UNSIGNED_BYTE)
  464. return this._wrapAccessor(x, s7);
  465. if (s7.componentType === C.UNSIGNED_SHORT)
  466. return this._wrapAccessor(L, s7);
  467. } else if (s7.componentCount === 3) {
  468. if (s7.componentType === C.FLOAT)
  469. return this._wrapAccessor(i3, s7);
  470. if (s7.componentType === C.UNSIGNED_BYTE)
  471. return this._wrapAccessor(O, s7);
  472. if (s7.componentType === C.UNSIGNED_SHORT)
  473. return this._wrapAccessor(E, s7);
  474. }
  475. r11.errorUnsupported("Unsupported component type for COLOR_0 attribute: " + X2[s7.componentType]);
  476. }
  477. hasPositions(e11) {
  478. return e11.attributes.POSITION !== void 0;
  479. }
  480. hasNormals(e11) {
  481. return e11.attributes.NORMAL !== void 0;
  482. }
  483. hasVertexColors(e11) {
  484. return e11.attributes.COLOR_0 !== void 0;
  485. }
  486. hasTextureCoordinates(e11) {
  487. return e11.attributes.TEXCOORD_0 !== void 0;
  488. }
  489. hasTangents(e11) {
  490. return e11.attributes.TANGENT !== void 0;
  491. }
  492. async getMaterial(e11, t12, r11) {
  493. let s7 = this.materialCache.get(e11.material);
  494. if (!s7) {
  495. const n8 = e11.material != null ? i4(this.json.materials[e11.material]) : i4(), o7 = n8.pbrMetallicRoughness, a4 = this.hasVertexColors(e11), i6 = this.getTexture(o7.baseColorTexture, t12), u8 = this.getTexture(n8.normalTexture, t12), c9 = r11 ? this.getTexture(n8.occlusionTexture, t12) : null, p2 = r11 ? this.getTexture(n8.emissiveTexture, t12) : null, f9 = r11 ? this.getTexture(o7.metallicRoughnessTexture, t12) : null, d4 = e11.material != null ? e11.material : -1;
  496. s7 = { alphaMode: n8.alphaMode, alphaCutoff: n8.alphaCutoff, color: o7.baseColorFactor, doubleSided: !!n8.doubleSided, colorTexture: await i6, normalTexture: await u8, name: n8.name, id: d4, occlusionTexture: await c9, emissiveTexture: await p2, emissiveFactor: n8.emissiveFactor, metallicFactor: o7.metallicFactor, roughnessFactor: o7.roughnessFactor, metallicRoughnessTexture: await f9, hasVertexColors: a4, ESRI_externalColorMixMode: n8.extras.ESRI_externalColorMixMode };
  497. }
  498. return s7;
  499. }
  500. async getTexture(e11, r11) {
  501. if (!e11)
  502. return null;
  503. this.errorContext.errorUnsupportedIf((e11.texCoord || 0) !== 0, "Only TEXCOORD with index 0 is supported.");
  504. const s7 = e11.index, n8 = this.errorContext, o7 = this.json.textures[s7], a4 = c5(o7.sampler != null ? this.json.samplers[o7.sampler] : {});
  505. n8.errorUnsupportedIf(o7.source == null, "Source is expected to be defined for a texture.");
  506. const i6 = this.json.images[o7.source], u8 = await this._loadTextureImageData(s7, o7, r11);
  507. return r2(this.textureCache, s7, () => {
  508. const e12 = (e13) => e13 === 33071 || e13 === 33648 || e13 === 10497, t12 = (e13) => (n8.error(`Unexpected TextureSampler WrapMode: ${e13}. Using default REPEAT(10497).`), 10497);
  509. return { data: u8, wrapS: e12(a4.wrapS) ? a4.wrapS : t12(a4.wrapS), wrapT: e12(a4.wrapT) ? a4.wrapT : t12(a4.wrapT), minFilter: a4.minFilter, name: i6.name, id: s7 };
  510. });
  511. }
  512. getNodeTransform(e11) {
  513. if (e11 === void 0)
  514. return V2;
  515. let t12 = this.nodeTransformCache.get(e11);
  516. if (!t12) {
  517. const r11 = this.getNodeTransform(this._getNodeParent(e11)), s7 = this.json.nodes[e11];
  518. s7.matrix ? t12 = u2(e4(), r11, s7.matrix) : s7.translation || s7.rotation || s7.scale ? (t12 = r4(r11), s7.translation && c(t12, t12, s7.translation), s7.rotation && (k[3] = x2(k, s7.rotation), f2(t12, t12, k[3], k)), s7.scale && i2(t12, t12, s7.scale)) : t12 = r11, this.nodeTransformCache.set(e11, t12);
  519. }
  520. return t12;
  521. }
  522. _wrapAccessor(e11, t12) {
  523. return new e11(t12.raw, t12.byteOffset, t12.byteStride, t12.byteOffset + t12.byteStride * (t12.entryCount - 1) + t12.componentByteSize * t12.componentCount);
  524. }
  525. _resolveUri(e11) {
  526. return Q(e11, this.baseUri);
  527. }
  528. _getNodeParent(e11) {
  529. return this.nodeParentMap.get(e11);
  530. }
  531. _checkVersionSupported() {
  532. const e11 = r5.parse(this.json.asset.version, "glTF");
  533. P.validate(e11);
  534. }
  535. _checkRequiredExtensionsSupported() {
  536. const e11 = this.json, t12 = this.errorContext;
  537. e11.extensionsRequired && e11.extensionsRequired.length !== 0 && t12.errorUnsupported("gltf loader was not able to load unsupported feature. Required extensions: " + e11.extensionsRequired.join(", "));
  538. }
  539. _computeNodeParents() {
  540. this.json.nodes.forEach((e11, t12) => {
  541. e11.children && e11.children.forEach((e12) => {
  542. this.nodeParentMap.set(e12, t12);
  543. });
  544. });
  545. }
  546. async _loadTextureImageData(e11, t12, r11) {
  547. const s7 = this.textureLoaders.get(e11);
  548. if (s7)
  549. return s7;
  550. const n8 = this._createTextureLoader(t12, r11);
  551. return this.textureLoaders.set(e11, n8), n8;
  552. }
  553. async _createTextureLoader(e11, t12) {
  554. const r11 = this.json.images[e11.source];
  555. if (r11.uri)
  556. return this.context.loadImage(this._resolveUri(r11.uri), t12);
  557. const s7 = this.errorContext;
  558. s7.errorUnsupportedIf(r11.bufferView == null, "Image bufferView must be defined."), s7.errorUnsupportedIf(r11.mimeType == null, "Image mimeType must be defined.");
  559. const n8 = this.json.bufferViews[r11.bufferView], o7 = await this.getBuffer(n8.buffer, t12);
  560. return s7.errorUnsupportedIf(n8.byteStride != null, "byteStride not supported for image buffer"), z(new Uint8Array(o7.buffer, o7.byteOffset + (n8.byteOffset || 0), n8.byteLength), r11.mimeType);
  561. }
  562. };
  563. var P = new r5(2, 0, "glTF");
  564. var V2 = g(e4(), Math.PI / 2);
  565. var k = e5();
  566. var H = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4 };
  567. var Y2 = { [C.BYTE]: 1, [C.UNSIGNED_BYTE]: 1, [C.SHORT]: 2, [C.UNSIGNED_SHORT]: 2, [C.FLOAT]: 4, [C.UNSIGNED_INT]: 4 };
  568. function J(t12) {
  569. switch (t12.componentType) {
  570. case C.BYTE:
  571. return new V(t12.raw, t12.byteOffset, t12.byteStride, t12.byteOffset + t12.byteStride * t12.entryCount);
  572. case C.UNSIGNED_BYTE:
  573. return new A(t12.raw, t12.byteOffset, t12.byteStride, t12.byteOffset + t12.byteStride * t12.entryCount);
  574. case C.SHORT:
  575. return new q2(t12.raw, t12.byteOffset, t12.byteStride, t12.byteOffset + t12.byteStride * t12.entryCount);
  576. case C.UNSIGNED_SHORT:
  577. return new w2(t12.raw, t12.byteOffset, t12.byteStride, t12.byteOffset + t12.byteStride * t12.entryCount);
  578. case C.UNSIGNED_INT:
  579. return new F(t12.raw, t12.byteOffset, t12.byteStride, t12.byteOffset + t12.byteStride * t12.entryCount);
  580. case C.FLOAT:
  581. return new u3(t12.raw, t12.byteOffset, t12.byteStride, t12.byteOffset + t12.byteStride * t12.entryCount);
  582. default:
  583. return void n2(t12.componentType);
  584. }
  585. }
  586. async function q3(e11) {
  587. return new Promise((t12, r11) => {
  588. const s7 = new Blob([e11]), n8 = new FileReader();
  589. n8.onload = () => {
  590. const e12 = n8.result;
  591. t12(JSON.parse(e12));
  592. }, n8.onerror = (e12) => {
  593. r11(e12);
  594. }, n8.readAsText(s7);
  595. });
  596. }
  597. async function z(e11, t12) {
  598. return new Promise((r11, s7) => {
  599. const n8 = new Blob([e11], { type: t12 }), o7 = URL.createObjectURL(n8), a4 = new Image();
  600. a4.addEventListener("load", () => {
  601. URL.revokeObjectURL(o7), "decode" in a4 ? a4.decode().then(() => r11(a4), () => r11(a4)) : r11(a4);
  602. }), a4.addEventListener("error", (e12) => {
  603. URL.revokeObjectURL(o7), s7(e12);
  604. }), a4.src = o7;
  605. });
  606. }
  607. var X2 = { 5120: "BYTE", 5121: "UNSIGNED_BYTE", 5122: "SHORT", 5123: "UNSIGNED_SHORT", 5125: "UNSIGNED_INT", 5126: "FLOAT" };
  608. // node_modules/@arcgis/core/views/3d/glTF/loader.js
  609. var u6 = 0;
  610. async function c6(s7, r11, a4 = {}, i6 = true) {
  611. const c9 = await F2.load(s7, x3, r11, a4), p2 = "gltf_" + u6++, h2 = { lods: [], materials: new Map(), textures: new Map(), meta: m(c9) }, I = !(!c9.json.asset.extras || c9.json.asset.extras.ESRI_type !== "symbolResource"), R = new Map();
  612. await d3(c9, async (s8, r12, n8, u8) => {
  613. const m3 = R.get(n8) ?? 0;
  614. R.set(n8, m3 + 1);
  615. const d4 = s8.mode !== void 0 ? s8.mode : E2.TRIANGLES, I2 = d4 === E2.TRIANGLES || d4 === E2.TRIANGLE_STRIP || d4 === E2.TRIANGLE_FAN ? d4 : null;
  616. if (t(I2))
  617. return void x3.warnUnsupported("Unsupported primitive mode (" + T[d4] + "). Skipping primitive.");
  618. if (!c9.hasPositions(s8))
  619. return void x3.warn("Skipping primitive without POSITION vertex attribute.");
  620. const E4 = c9.getPositionData(s8, a4), S = c9.getMaterial(s8, a4, i6), _2 = c9.hasNormals(s8) ? c9.getNormalData(s8, a4) : null, g4 = c9.hasTangents(s8) ? c9.getTangentData(s8, a4) : null, w5 = c9.hasTextureCoordinates(s8) ? c9.getTextureCoordinates(s8, a4) : null, N = c9.hasVertexColors(s8) ? c9.getVertexColors(s8, a4) : null, v2 = c9.getIndexData(s8, a4), M3 = { transform: r4(r12), attributes: { position: await E4, normal: _2 ? await _2 : null, texCoord0: w5 ? await w5 : null, color: N ? await N : null, tangent: g4 ? await g4 : null }, indices: await v2, primitiveType: I2, material: f7(h2, await S, p2) };
  621. let A4 = null;
  622. r(h2.meta) && r(h2.meta.ESRI_lod) && h2.meta.ESRI_lod.metric === "screenSpaceRadius" && (A4 = h2.meta.ESRI_lod.thresholds[n8]), h2.lods[n8] = h2.lods[n8] || { parts: [], name: u8, lodThreshold: A4 }, h2.lods[n8].parts[m3] = M3;
  623. });
  624. for (const e11 of h2.lods)
  625. e11.parts = e11.parts.filter((e12) => !!e12);
  626. return { model: h2, meta: { isEsriSymbolResource: I, uri: c9.uri }, customMeta: {} };
  627. }
  628. function m(t12) {
  629. const o7 = t12.json;
  630. let s7 = null;
  631. return o7.nodes.forEach((t13) => {
  632. const o8 = t13.extras;
  633. r(o8) && (o8.ESRI_proxyEllipsoid || o8.ESRI_lod) && (s7 = o8);
  634. }), s7;
  635. }
  636. async function d3(e11, t12) {
  637. const o7 = e11.json, s7 = o7.scenes[o7.scene || 0].nodes, r11 = s7.length > 1, a4 = [];
  638. for (const i6 of s7) {
  639. const e12 = o7.nodes[i6];
  640. if (a4.push(n8(i6, 0)), p(e12) && !r11) {
  641. e12.extensions.MSFT_lod.ids.forEach((e13, t13) => n8(e13, t13 + 1));
  642. }
  643. }
  644. async function n8(s8, r12) {
  645. const i6 = o7.nodes[s8], l4 = e11.getNodeTransform(s8);
  646. if (x3.warnUnsupportedIf(i6.weights != null, "Morph targets are not supported."), i6.mesh != null) {
  647. const e12 = o7.meshes[i6.mesh];
  648. for (const o8 of e12.primitives)
  649. a4.push(t12(o8, l4, r12, e12.name));
  650. }
  651. for (const e12 of i6.children || [])
  652. a4.push(n8(e12, r12));
  653. }
  654. await Promise.all(a4);
  655. }
  656. function p(e11) {
  657. return e11.extensions && e11.extensions.MSFT_lod && Array.isArray(e11.extensions.MSFT_lod.ids);
  658. }
  659. function f7(e11, t12, o7) {
  660. const s7 = (t13) => {
  661. const s8 = `${o7}_tex_${t13 && t13.id}${t13 && t13.name ? "_" + t13.name : ""}`;
  662. if (t13 && !e11.textures.has(s8)) {
  663. const o8 = l(t13.data, { wrap: { s: t13.wrapS, t: t13.wrapT }, mipmap: h.includes(t13.minFilter), noUnpackFlip: true });
  664. e11.textures.set(s8, o8);
  665. }
  666. return s8;
  667. }, n8 = `${o7}_mat_${t12.id}_${t12.name}`;
  668. if (!e11.materials.has(n8)) {
  669. const o8 = t8({ color: [t12.color[0], t12.color[1], t12.color[2]], opacity: t12.color[3], alphaMode: t12.alphaMode, alphaCutoff: t12.alphaCutoff, doubleSided: t12.doubleSided, colorMixMode: t12.ESRI_externalColorMixMode, textureColor: t12.colorTexture ? s7(t12.colorTexture) : void 0, textureNormal: t12.normalTexture ? s7(t12.normalTexture) : void 0, textureOcclusion: t12.occlusionTexture ? s7(t12.occlusionTexture) : void 0, textureEmissive: t12.emissiveTexture ? s7(t12.emissiveTexture) : void 0, textureMetallicRoughness: t12.metallicRoughnessTexture ? s7(t12.metallicRoughnessTexture) : void 0, emissiveFactor: [t12.emissiveFactor[0], t12.emissiveFactor[1], t12.emissiveFactor[2]], metallicFactor: t12.metallicFactor, roughnessFactor: t12.roughnessFactor });
  670. e11.materials.set(n8, o8);
  671. }
  672. return n8;
  673. }
  674. var x3 = new t7();
  675. var h = [L2.LINEAR_MIPMAP_LINEAR, L2.LINEAR_MIPMAP_NEAREST];
  676. var T = ["POINTS", "LINES", "LINE_LOOP", "LINE_STRIP", "TRIANGLES", "TRIANGLE_STRIP", "TRIANGLE_FAN"];
  677. // node_modules/@arcgis/core/geometry/support/triangle.js
  678. function w3(t12, n8, p2) {
  679. return e2(O2, n8, t12), e2(V3, p2, t12), s3(_(O2, O2, V3)) / 2;
  680. }
  681. var M2 = new s4(v);
  682. var x4 = new s4(() => ({ p0: null, p1: null, p2: null }));
  683. var O2 = n();
  684. var V3 = n();
  685. // node_modules/@arcgis/core/views/3d/webgl-engine/lib/geometryDataUtils.js
  686. var s6 = (() => {
  687. const t12 = new Uint32Array(131072);
  688. for (let n8 = 0; n8 < t12.length; ++n8)
  689. t12[n8] = n8;
  690. return t12;
  691. })();
  692. var f8 = new Uint16Array([0]);
  693. var c8 = (() => {
  694. const t12 = new Uint16Array(65536);
  695. for (let n8 = 0; n8 < t12.length; ++n8)
  696. t12[n8] = n8;
  697. return t12;
  698. })();
  699. function l3(t12) {
  700. if (t12 === 1)
  701. return f8;
  702. if (t12 < c8.length)
  703. return new Uint16Array(c8.buffer, 0, t12);
  704. if (t12 > s6.length) {
  705. const n8 = Math.max(2 * s6.length, t12);
  706. s6 = new Uint32Array(n8);
  707. for (let t13 = 0; t13 < s6.length; t13++)
  708. s6[t13] = t13;
  709. }
  710. return new Uint32Array(s6.buffer, 0, t12);
  711. }
  712. function a3(t12) {
  713. if (t12 === 1)
  714. return new Uint16Array(f8);
  715. if (t12 < c8.length)
  716. return new Uint16Array(c8.slice(0, t12));
  717. if (t12 > s6.length) {
  718. const n8 = new Uint32Array(t12);
  719. for (let t13 = 0; t13 < n8.length; t13++)
  720. n8[t13] = t13;
  721. return n8;
  722. }
  723. return new Uint32Array(s6.slice(0, t12));
  724. }
  725. function u7(e11, o7, s7) {
  726. if (!e11)
  727. return false;
  728. const { size: f9, data: c9 } = e11;
  729. o(s7, 0, 0, 0), o(U3, 0, 0, 0);
  730. let l4 = 0, a4 = 0;
  731. for (let u8 = 0; u8 < o7.length - 2; u8 += 3) {
  732. const e12 = o7[u8 + 0] * f9, g4 = o7[u8 + 1] * f9, h2 = o7[u8 + 2] * f9;
  733. o(y, c9[e12 + 0], c9[e12 + 1], c9[e12 + 2]), o(w4, c9[g4 + 0], c9[g4 + 1], c9[g4 + 2]), o(A3, c9[h2 + 0], c9[h2 + 1], c9[h2 + 2]);
  734. const m3 = w3(y, w4, A3);
  735. m3 ? (u(y, y, w4), u(y, y, A3), q(y, y, 1 / 3 * m3), u(s7, s7, y), l4 += m3) : (u(U3, U3, y), u(U3, U3, w4), u(U3, U3, A3), a4 += 3);
  736. }
  737. return (a4 !== 0 || l4 !== 0) && (l4 !== 0 ? (q(s7, s7, 1 / l4), true) : a4 !== 0 && (q(s7, U3, 1 / a4), true));
  738. }
  739. function g3(n8, e11, o7) {
  740. if (!n8 || !e11)
  741. return false;
  742. const { size: i6, data: s7 } = n8;
  743. o(o7, 0, 0, 0);
  744. let f9 = -1, c9 = 0;
  745. for (let t12 = 0; t12 < e11.length; t12++) {
  746. const n9 = e11[t12] * i6;
  747. f9 !== n9 && (o7[0] += s7[n9 + 0], o7[1] += s7[n9 + 1], o7[2] += s7[n9 + 2], c9++), f9 = n9;
  748. }
  749. return c9 > 1 && q(o7, o7, 1 / c9), c9 > 0;
  750. }
  751. var y = n();
  752. var w4 = n();
  753. var A3 = n();
  754. var U3 = n();
  755. // node_modules/@arcgis/core/views/3d/glTF/internal/indexUtils.js
  756. function n7(n8, o7 = l3) {
  757. return typeof n8 == "number" ? o7(n8) : i(n8) || e(n8) ? new Uint32Array(n8) : n8;
  758. }
  759. function o5(t12) {
  760. const e11 = typeof t12 == "number" ? t12 : t12.length;
  761. if (e11 < 3)
  762. return new Uint16Array(0);
  763. const r11 = e11 - 2, n8 = r11 <= 65536 ? new Uint16Array(3 * r11) : new Uint32Array(3 * r11);
  764. if (typeof t12 == "number") {
  765. let t13 = 0;
  766. for (let e12 = 0; e12 < r11; e12 += 1)
  767. e12 % 2 == 0 ? (n8[t13++] = e12, n8[t13++] = e12 + 1, n8[t13++] = e12 + 2) : (n8[t13++] = e12 + 1, n8[t13++] = e12, n8[t13++] = e12 + 2);
  768. } else {
  769. let e12 = 0;
  770. for (let o7 = 0; o7 < r11; o7 += 1)
  771. if (o7 % 2 == 0) {
  772. const r12 = t12[o7], i6 = t12[o7 + 1], f9 = t12[o7 + 2];
  773. n8[e12++] = r12, n8[e12++] = i6, n8[e12++] = f9;
  774. } else {
  775. const r12 = t12[o7 + 1], i6 = t12[o7], f9 = t12[o7 + 2];
  776. n8[e12++] = r12, n8[e12++] = i6, n8[e12++] = f9;
  777. }
  778. }
  779. return n8;
  780. }
  781. function i5(t12) {
  782. const e11 = typeof t12 == "number" ? t12 : t12.length;
  783. if (e11 < 3)
  784. return new Uint16Array(0);
  785. const r11 = e11 - 2, n8 = r11 <= 65536 ? new Uint16Array(3 * r11) : new Uint32Array(3 * r11);
  786. if (typeof t12 == "number") {
  787. let t13 = 0;
  788. for (let e12 = 0; e12 < r11; ++e12)
  789. n8[t13++] = 0, n8[t13++] = e12 + 1, n8[t13++] = e12 + 2;
  790. return n8;
  791. }
  792. {
  793. const e12 = t12[0];
  794. let o7 = t12[1], i6 = 0;
  795. for (let f9 = 0; f9 < r11; ++f9) {
  796. const r12 = t12[f9 + 2];
  797. n8[i6++] = e12, n8[i6++] = o7, n8[i6++] = r12, o7 = r12;
  798. }
  799. return n8;
  800. }
  801. }
  802. // node_modules/@arcgis/core/views/3d/webgl-engine/materials/DefaultMaterial_COLOR_GAMMA.js
  803. var o6 = 2.1;
  804. export {
  805. r6 as r,
  806. f3 as f,
  807. o2 as o,
  808. n3 as n,
  809. n4 as n2,
  810. d2 as d,
  811. e7 as e,
  812. t3 as t,
  813. r8 as r2,
  814. n5 as n3,
  815. c6 as c,
  816. l3 as l,
  817. a3 as a,
  818. u7 as u,
  819. g3 as g,
  820. n7 as n4,
  821. o5 as o2,
  822. i5 as i,
  823. o6 as o3
  824. };
  825. //# sourceMappingURL=chunk-NBRP7CWO.js.map