chunk-4DDBH2K5.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import {
  2. s as s3
  3. } from "./chunk-7N4X6GF3.js";
  4. import {
  5. m
  6. } from "./chunk-TBBTRX4O.js";
  7. import {
  8. n as n2
  9. } from "./chunk-DT6EAZQ5.js";
  10. import {
  11. U
  12. } from "./chunk-VNFRAYHO.js";
  13. import {
  14. j
  15. } from "./chunk-VBRY5KJM.js";
  16. import {
  17. M2 as M
  18. } from "./chunk-ECW2QABR.js";
  19. import {
  20. k2 as k
  21. } from "./chunk-MRJEICT6.js";
  22. import {
  23. d,
  24. e,
  25. n2 as n
  26. } from "./chunk-Y3WMVFTW.js";
  27. import {
  28. g
  29. } from "./chunk-ULGDPLM2.js";
  30. import {
  31. r,
  32. s,
  33. s3 as s2
  34. } from "./chunk-EMJ4ZSM2.js";
  35. // node_modules/@arcgis/core/layers/support/fromPortalItem.js
  36. var o = s.getLogger("esri.layers.support.fromPortalItem");
  37. async function a(t) {
  38. const a2 = "portalItem" in t ? t : { portalItem: t }, e2 = await import("./portalLayers-42DONF4R.js");
  39. try {
  40. return await e2.fromItem(a2);
  41. } catch (p) {
  42. const t2 = a2 && a2.portalItem, e3 = t2 && t2.id || "unset", l = t2 && t2.portal && t2.portal.url || r.portalUrl;
  43. throw o.error("#fromPortalItem()", "Failed to create layer from portal item (portal: '" + l + "', id: '" + e3 + "')", p), p;
  44. }
  45. }
  46. // node_modules/@arcgis/core/layers/Layer.js
  47. var m2 = 0;
  48. var h = class extends n2.EventedMixin(s3(m)) {
  49. constructor() {
  50. super(...arguments), this.attributionDataUrl = null, this.fullExtent = new M(-180, -90, 180, 90, k.WGS84), this.id = Date.now().toString(16) + "-layer-" + m2++, this.legendEnabled = true, this.listMode = "show", this.opacity = 1, this.parent = null, this.popupEnabled = true, this.attributionVisible = true, this.spatialReference = k.WGS84, this.title = null, this.type = null, this.url = null, this.visible = true;
  51. }
  52. static async fromArcGISServerUrl(t) {
  53. const e2 = typeof t == "string" ? { url: t } : t;
  54. return (await import("./arcgisLayers-HASRMKEU.js")).fromUrl(e2);
  55. }
  56. static fromPortalItem(t) {
  57. return a(t);
  58. }
  59. initialize() {
  60. this.when().catch((t) => {
  61. g(t) || s.getLogger(this.declaredClass).error("#load()", `Failed to load layer (title: '${this.title ?? "no title"}', id: '${this.id ?? "no id"}')`, { error: t });
  62. });
  63. }
  64. destroy() {
  65. if (this.parent) {
  66. const t = this, e2 = this.parent;
  67. "layers" in e2 && e2.layers.includes(t) ? e2.layers.remove(t) : "tables" in e2 && e2.tables.includes(t) ? e2.tables.remove(t) : "baseLayers" in e2 && e2.baseLayers.includes(t) ? e2.baseLayers.remove(t) : "baseLayers" in e2 && e2.referenceLayers.includes(t) && e2.referenceLayers.remove(t);
  68. }
  69. }
  70. get hasAttributionData() {
  71. return this.attributionDataUrl != null;
  72. }
  73. get parsedUrl() {
  74. const t = this.url;
  75. return t ? j(t) : null;
  76. }
  77. async fetchAttributionData() {
  78. const t = this.attributionDataUrl;
  79. if (this.hasAttributionData && t) {
  80. return (await U(t, { query: { f: "json" }, responseType: "json" })).data;
  81. }
  82. throw new s2("layer:no-attribution-data", "Layer does not have attribution data");
  83. }
  84. };
  85. e([d({ type: String })], h.prototype, "attributionDataUrl", void 0), e([d({ type: M })], h.prototype, "fullExtent", void 0), e([d({ readOnly: true })], h.prototype, "hasAttributionData", null), e([d({ type: String, clonable: false })], h.prototype, "id", void 0), e([d({ type: Boolean, nonNullable: true })], h.prototype, "legendEnabled", void 0), e([d({ type: ["show", "hide", "hide-children"] })], h.prototype, "listMode", void 0), e([d({ type: Number, range: { min: 0, max: 1 }, nonNullable: true })], h.prototype, "opacity", void 0), e([d({ clonable: false })], h.prototype, "parent", void 0), e([d({ readOnly: true })], h.prototype, "parsedUrl", null), e([d({ type: Boolean })], h.prototype, "popupEnabled", void 0), e([d({ type: Boolean })], h.prototype, "attributionVisible", void 0), e([d({ type: k })], h.prototype, "spatialReference", void 0), e([d({ type: String })], h.prototype, "title", void 0), e([d({ readOnly: true, json: { read: false } })], h.prototype, "type", void 0), e([d()], h.prototype, "url", void 0), e([d({ type: Boolean, nonNullable: true })], h.prototype, "visible", void 0), h = e([n("esri.layers.Layer")], h);
  86. var b = h;
  87. export {
  88. b
  89. };
  90. //# sourceMappingURL=chunk-4DDBH2K5.js.map