chunk-UE4KC4K5.js 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. import {
  2. r as r3
  3. } from "./chunk-6FXLJAMI.js";
  4. import {
  5. f,
  6. m
  7. } from "./chunk-4ONPMX2F.js";
  8. import {
  9. l as l2
  10. } from "./chunk-X4SA4ELJ.js";
  11. import {
  12. o
  13. } from "./chunk-6T6G6LCQ.js";
  14. import {
  15. r as r2
  16. } from "./chunk-PQFTYGF5.js";
  17. import {
  18. e,
  19. l3 as l,
  20. n5 as n,
  21. y3 as y
  22. } from "./chunk-2Z2TG5CU.js";
  23. import {
  24. v
  25. } from "./chunk-SQOPWYIT.js";
  26. import {
  27. r
  28. } from "./chunk-YXWMMD76.js";
  29. // node_modules/@arcgis/core/geometry/support/MeshTexture.js
  30. var p;
  31. var d = /* @__PURE__ */ new WeakMap();
  32. var h = 0;
  33. var u = p = class extends l {
  34. constructor(t) {
  35. super(t), this.wrap = "repeat";
  36. }
  37. get url() {
  38. return this._get("url") || null;
  39. }
  40. set url(t) {
  41. this._set("url", t), t && this._set("data", null);
  42. }
  43. get data() {
  44. return this._get("data") || null;
  45. }
  46. set data(t) {
  47. this._set("data", t), t && this._set("url", null);
  48. }
  49. writeData(t, e2, a2, r4) {
  50. if (t instanceof HTMLImageElement) {
  51. const s = { type: "image-element", src: m(t.src, r4), crossOrigin: t.crossOrigin };
  52. e2[a2] = s;
  53. } else if (t instanceof HTMLCanvasElement) {
  54. const r5 = t.getContext("2d").getImageData(0, 0, t.width, t.height), s = { type: "canvas-element", imageData: this._encodeImageData(r5) };
  55. e2[a2] = s;
  56. } else if (t instanceof HTMLVideoElement) {
  57. const s = { type: "video-element", src: m(t.src, r4), autoplay: t.autoplay, loop: t.loop, muted: t.muted, crossOrigin: t.crossOrigin, preload: t.preload };
  58. e2[a2] = s;
  59. } else {
  60. const r5 = { type: "image-data", imageData: this._encodeImageData(t) };
  61. e2[a2] = r5;
  62. }
  63. }
  64. readData(t) {
  65. switch (t.type) {
  66. case "image-element": {
  67. const e2 = new Image();
  68. return e2.src = t.src, e2.crossOrigin = t.crossOrigin, e2;
  69. }
  70. case "canvas-element": {
  71. const e2 = this._decodeImageData(t.imageData), a2 = document.createElement("canvas");
  72. return a2.width = e2.width, a2.height = e2.height, a2.getContext("2d").putImageData(e2, 0, 0), a2;
  73. }
  74. case "image-data":
  75. return this._decodeImageData(t.imageData);
  76. case "video-element": {
  77. const e2 = document.createElement("video");
  78. return e2.src = t.src, e2.crossOrigin = t.crossOrigin, e2.autoplay = t.autoplay, e2.loop = t.loop, e2.muted = t.muted, e2.preload = t.preload, e2;
  79. }
  80. default:
  81. return;
  82. }
  83. }
  84. get transparent() {
  85. const t = this.data, e2 = this.url;
  86. if (t instanceof HTMLCanvasElement)
  87. return this._imageDataContainsTransparent(t.getContext("2d").getImageData(0, 0, t.width, t.height));
  88. if (t instanceof ImageData)
  89. return this._imageDataContainsTransparent(t);
  90. if (e2) {
  91. const t2 = e2.substr(e2.length - 4, 4).toLowerCase(), a2 = e2.substr(0, 15).toLocaleLowerCase();
  92. if (".png" === t2 || "data:image/png;" === a2)
  93. return true;
  94. }
  95. return false;
  96. }
  97. set transparent(t) {
  98. this._overrideIfSome("transparent", t);
  99. }
  100. get contentHash() {
  101. const t = "string" == typeof this.wrap ? this.wrap : "object" == typeof this.wrap ? `${this.wrap.horizontal}/${this.wrap.vertical}` : "", e2 = (e3 = "") => `d:${e3},t:${this.transparent},w:${t}`;
  102. return null != this.url ? e2(this.url) : null != this.data ? this.data instanceof HTMLImageElement || this.data instanceof HTMLVideoElement ? e2(this.data.src) : (d.has(this.data) || d.set(this.data, ++h), e2(d.get(this.data))) : e2();
  103. }
  104. clone() {
  105. const t = { url: this.url, data: this.data, wrap: this._cloneWrap() };
  106. return new p(t);
  107. }
  108. cloneWithDeduplication(t) {
  109. const e2 = t.get(this);
  110. if (e2)
  111. return e2;
  112. const a2 = this.clone();
  113. return t.set(this, a2), a2;
  114. }
  115. _cloneWrap() {
  116. return "string" == typeof this.wrap ? this.wrap : { horizontal: this.wrap.horizontal, vertical: this.wrap.vertical };
  117. }
  118. _encodeImageData(t) {
  119. let e2 = "";
  120. for (let a2 = 0; a2 < t.data.length; a2++)
  121. e2 += String.fromCharCode(t.data[a2]);
  122. return { data: btoa(e2), width: t.width, height: t.height };
  123. }
  124. _decodeImageData(t) {
  125. const a2 = atob(t.data), r4 = new Uint8ClampedArray(a2.length);
  126. for (let e2 = 0; e2 < a2.length; e2++)
  127. r4[e2] = a2.charCodeAt(e2);
  128. return r3(r4, t.width, t.height);
  129. }
  130. _imageDataContainsTransparent(t) {
  131. for (let e2 = 3; e2 < t.data.length; e2 += 4)
  132. if (255 !== t.data[e2])
  133. return true;
  134. return false;
  135. }
  136. static from(t) {
  137. return "string" == typeof t ? new p({ url: t }) : t instanceof HTMLImageElement || t instanceof HTMLCanvasElement || t instanceof ImageData || t instanceof HTMLVideoElement ? new p({ data: t }) : v(p, t);
  138. }
  139. };
  140. e([y({ type: String, json: { write: f } })], u.prototype, "url", null), e([y({ json: { write: { overridePolicy() {
  141. return { enabled: !this.url };
  142. } } } }), y()], u.prototype, "data", null), e([r2("data")], u.prototype, "writeData", null), e([o("data")], u.prototype, "readData", null), e([y({ type: Boolean, json: { write: { overridePolicy() {
  143. return { enabled: this._isOverridden("transparent") };
  144. } } } })], u.prototype, "transparent", null), e([y({ json: { write: true } })], u.prototype, "wrap", void 0), e([y({ readOnly: true })], u.prototype, "contentHash", null), u = p = e([n("esri.geometry.support.MeshTexture")], u);
  145. var m2 = u;
  146. // node_modules/@arcgis/core/geometry/support/MeshMaterial.js
  147. var n2;
  148. var u2 = n2 = class extends l {
  149. constructor(o2) {
  150. super(o2), this.color = null, this.colorTexture = null, this.normalTexture = null, this.alphaMode = "auto", this.alphaCutoff = 0.5, this.doubleSided = true;
  151. }
  152. clone() {
  153. return this.cloneWithDeduplication(null, /* @__PURE__ */ new Map());
  154. }
  155. cloneWithDeduplication(o2, r4) {
  156. const e2 = r(o2) ? o2.get(this) : null;
  157. if (e2)
  158. return e2;
  159. const l3 = new n2(this.clonePropertiesWithDeduplication(r4));
  160. return r(o2) && o2.set(this, l3), l3;
  161. }
  162. clonePropertiesWithDeduplication(o2) {
  163. return { color: r(this.color) ? this.color.clone() : null, colorTexture: r(this.colorTexture) ? this.colorTexture.cloneWithDeduplication(o2) : null, normalTexture: r(this.normalTexture) ? this.normalTexture.cloneWithDeduplication(o2) : null, alphaMode: this.alphaMode, alphaCutoff: this.alphaCutoff, doubleSided: this.doubleSided, colorTextureTransform: r(this.colorTextureTransform) ? this.colorTextureTransform : null, normalTextureTransform: r(this.normalTextureTransform) ? this.normalTextureTransform : null };
  164. }
  165. };
  166. e([y({ type: l2, json: { write: true } })], u2.prototype, "color", void 0), e([y({ type: m2, json: { write: true } })], u2.prototype, "colorTexture", void 0), e([y({ type: m2, json: { write: true } })], u2.prototype, "normalTexture", void 0), e([y({ nonNullable: true, json: { write: true } })], u2.prototype, "alphaMode", void 0), e([y({ nonNullable: true, json: { write: true } })], u2.prototype, "alphaCutoff", void 0), e([y({ nonNullable: true, json: { write: true } })], u2.prototype, "doubleSided", void 0), e([y()], u2.prototype, "colorTextureTransform", void 0), e([y()], u2.prototype, "normalTextureTransform", void 0), u2 = n2 = e([n("esri.geometry.support.MeshMaterial")], u2);
  167. var a = u2;
  168. // node_modules/@arcgis/core/geometry/support/MeshMaterialMetallicRoughness.js
  169. var n3;
  170. var u3 = n3 = class extends a {
  171. constructor(e2) {
  172. super(e2), this.emissiveColor = null, this.emissiveTexture = null, this.occlusionTexture = null, this.metallic = 1, this.roughness = 1, this.metallicRoughnessTexture = null;
  173. }
  174. clone() {
  175. return this.cloneWithDeduplication(null, /* @__PURE__ */ new Map());
  176. }
  177. cloneWithDeduplication(e2, s) {
  178. const o2 = r(e2) ? e2.get(this) : null;
  179. if (o2)
  180. return o2;
  181. const r4 = new n3(this.clonePropertiesWithDeduplication(s));
  182. return r(e2) && e2.set(this, r4), r4;
  183. }
  184. clonePropertiesWithDeduplication(e2) {
  185. return { ...super.clonePropertiesWithDeduplication(e2), emissiveColor: r(this.emissiveColor) ? this.emissiveColor.clone() : null, emissiveTexture: r(this.emissiveTexture) ? this.emissiveTexture.cloneWithDeduplication(e2) : null, occlusionTexture: r(this.occlusionTexture) ? this.occlusionTexture.cloneWithDeduplication(e2) : null, metallic: this.metallic, roughness: this.roughness, metallicRoughnessTexture: r(this.metallicRoughnessTexture) ? this.metallicRoughnessTexture.cloneWithDeduplication(e2) : null, occlusionTextureTransform: r(this.occlusionTextureTransform) ? this.occlusionTextureTransform : null, emissiveTextureTransform: r(this.emissiveTextureTransform) ? this.emissiveTextureTransform : null, metallicRoughnessTextureTransform: r(this.metallicRoughnessTextureTransform) ? this.metallicRoughnessTextureTransform : null };
  186. }
  187. };
  188. e([y({ type: l2, json: { write: true } })], u3.prototype, "emissiveColor", void 0), e([y({ type: m2, json: { write: true } })], u3.prototype, "emissiveTexture", void 0), e([y({ type: m2, json: { write: true } })], u3.prototype, "occlusionTexture", void 0), e([y({ type: Number, nonNullable: true, json: { write: true }, range: { min: 0, max: 1 } })], u3.prototype, "metallic", void 0), e([y({ type: Number, nonNullable: true, json: { write: true }, range: { min: 0, max: 1 } })], u3.prototype, "roughness", void 0), e([y({ type: m2, json: { write: true } })], u3.prototype, "metallicRoughnessTexture", void 0), e([y()], u3.prototype, "occlusionTextureTransform", void 0), e([y()], u3.prototype, "emissiveTextureTransform", void 0), e([y()], u3.prototype, "metallicRoughnessTextureTransform", void 0), u3 = n3 = e([n("esri.geometry.support.MeshMaterialMetallicRoughness")], u3);
  189. var c = u3;
  190. export {
  191. m2 as m,
  192. a,
  193. c
  194. };
  195. //# sourceMappingURL=chunk-UE4KC4K5.js.map