import { l as l3 } from "./chunk-XBNW6PXM.js"; import { o as o2 } from "./chunk-ELA7HWPA.js"; import { i } from "./chunk-3YTO5A3F.js"; import { a as a2 } from "./chunk-XEQ4FTFC.js"; import "./chunk-JM5OVQAD.js"; import { g as g2 } from "./chunk-7C23ILQ4.js"; import { k as k2 } from "./chunk-P6VVVEX6.js"; import "./chunk-3Z755LKF.js"; import "./chunk-LTZ5XXDV.js"; import "./chunk-DLMAGHHC.js"; import "./chunk-JOYXMSKE.js"; import { I } from "./chunk-SZFMKPVM.js"; import "./chunk-YZVAB3DF.js"; import "./chunk-ECY35CJI.js"; import "./chunk-MCWCB5IY.js"; import "./chunk-TV3CFJQR.js"; import { U, a, l } from "./chunk-TJV6ODRM.js"; import { v } from "./chunk-JUWKPBLS.js"; import { c as c2 } from "./chunk-WLSB4F4I.js"; import { c, f } from "./chunk-GLSWDDR3.js"; import { O, S as S2 } from "./chunk-MIQGEDET.js"; import "./chunk-DUEMJ5XS.js"; import "./chunk-VRLXUHP2.js"; import "./chunk-3LVSQLWJ.js"; import "./chunk-4ONPMX2F.js"; import "./chunk-CRGY2SDS.js"; import "./chunk-4T5ZGMEN.js"; import { p } from "./chunk-GN35O2ZO.js"; import { n as n2 } from "./chunk-XTVKPAWY.js"; import "./chunk-3OSQ6GXO.js"; import "./chunk-3WQOA5CB.js"; import { t as t2 } from "./chunk-PLWDAYK7.js"; import "./chunk-FZQZIM7U.js"; import "./chunk-CZBRZ6SU.js"; import "./chunk-VGWC3IKZ.js"; import "./chunk-2H5MD622.js"; import "./chunk-3RSFVUKZ.js"; import "./chunk-UVVU4UUO.js"; import { l as l2 } from "./chunk-CDZENOCQ.js"; import "./chunk-X4SA4ELJ.js"; import "./chunk-5N7JLUJJ.js"; import "./chunk-ZAY3CMAZ.js"; import "./chunk-P3XKUGLS.js"; import "./chunk-2ZSOO377.js"; import "./chunk-YUA3AHKR.js"; import "./chunk-LU5IJZB4.js"; import "./chunk-7IBV2TRE.js"; import "./chunk-ZLNEXZAN.js"; import "./chunk-5UVJ64RB.js"; import "./chunk-SFEFRQCL.js"; import { b as b2 } from "./chunk-DXVOOCG4.js"; import { s as s5 } from "./chunk-3GZSQU56.js"; import "./chunk-ZYRIJWLX.js"; import "./chunk-RYY6632W.js"; import "./chunk-DW42UVIT.js"; import "./chunk-YAEIHDJH.js"; import "./chunk-TJNOJH33.js"; import "./chunk-OSHI574D.js"; import "./chunk-ETGAZ7LF.js"; import "./chunk-75U5LM2V.js"; import "./chunk-RMDDCMKS.js"; import "./chunk-VCH45Q2I.js"; import { j } from "./chunk-LBW34VZ2.js"; import "./chunk-GSSTTHIT.js"; import "./chunk-YFSLJIO4.js"; import "./chunk-IM3LVQXV.js"; import "./chunk-55RWC67C.js"; import { s as s3 } from "./chunk-HZRKBTHJ.js"; import { U as U2 } from "./chunk-DVUG3KID.js"; import "./chunk-FWSQEIAR.js"; import { Bt, S, j as j2, y as y3 } from "./chunk-VEGAOVMY.js"; import { o, w2 } from "./chunk-6T6G6LCQ.js"; import { s as s4 } from "./chunk-YEJL5NEF.js"; import { E, k2 as k, r as r2 } from "./chunk-PQFTYGF5.js"; import { e, g, n5 as n, y3 as y2 } from "./chunk-2Z2TG5CU.js"; import "./chunk-6KZ2LTDA.js"; import "./chunk-U2XHEJM7.js"; import { T, b } from "./chunk-SQOPWYIT.js"; import { w } from "./chunk-V6P2MAQQ.js"; import { s, s3 as s2 } from "./chunk-E5O6P5I2.js"; import { y } from "./chunk-SPWQ3AWG.js"; import "./chunk-2TIUKVZN.js"; import { r, t } from "./chunk-YXWMMD76.js"; import "./chunk-S5KM4IGW.js"; // node_modules/@arcgis/core/layers/support/WMSSublayer.js var c3; var h = 0; var g3 = c3 = class extends s5(S2) { constructor(e2) { super(e2), this.dimensions = null, this.fullExtents = null, this.legendUrl = null, this.legendEnabled = true, this.layer = null, this.maxScale = 0, this.minScale = 0, this.parent = null, this.popupEnabled = false, this.queryable = false, this.sublayers = null, this.spatialReferences = null, this.addHandles([a(() => this.sublayers, "after-add", ({ item: e3 }) => { e3.parent = this, e3.layer = this.layer; }, U), a(() => this.sublayers, "after-remove", ({ item: e3 }) => { e3.layer = e3.parent = null; }, U), l(() => this.sublayers, (e3, t3) => { if (t3) for (const r3 of t3) r3.layer = r3.parent = null; if (e3) for (const r3 of e3) r3.parent = this, r3.layer = this.layer; }, U)]); } get description() { return this._get("description"); } set description(e2) { this._set("description", e2); } get fullExtent() { return this._get("fullExtent"); } set fullExtent(e2) { this._set("fullExtent", e2); } readExtent(e2, t3) { return (e2 = t3.extent) ? w2.fromJSON(e2) : null; } get id() { const e2 = this._get("id"); return e2 != null ? e2 : h++; } set id(e2) { this._set("id", e2); } readLegendUrl(e2, t3) { var _a, _b; return (_b = (_a = t3 == null ? void 0 : t3.legendUrl) != null ? _a : t3 == null ? void 0 : t3.legendURL) != null ? _b : null; } get effectiveScaleRange() { const { minScale: e2, maxScale: t3 } = this; return { minScale: e2, maxScale: t3 }; } get name() { return this._get("name"); } set name(e2) { this._set("name", e2); } castSublayers(e2) { return b(j.ofType(c3), e2); } get title() { return this._get("title"); } set title(e2) { this._set("title", e2); } get visible() { return this._get("visible"); } set visible(e2) { this._setAndNotifyLayer("visible", e2); } clone() { var _a, _b, _c; const e2 = new c3(); return this.hasOwnProperty("description") && (e2.description = this.description), this.hasOwnProperty("fullExtent") && (e2.fullExtent = this.fullExtent.clone()), this.hasOwnProperty("fullExtents") && (e2.fullExtents = (_b = (_a = this.fullExtents) == null ? void 0 : _a.map((e3) => e3.clone())) != null ? _b : null), this.hasOwnProperty("legendUrl") && (e2.legendUrl = this.legendUrl), this.hasOwnProperty("legendEnabled") && (e2.legendEnabled = this.legendEnabled), this.hasOwnProperty("layer") && (e2.layer = this.layer), this.hasOwnProperty("name") && (e2.name = this.name), this.hasOwnProperty("parent") && (e2.parent = this.parent), this.hasOwnProperty("queryable") && (e2.queryable = this.queryable), this.hasOwnProperty("sublayers") && (e2.sublayers = this.sublayers && this.sublayers.map((e3) => e3.clone())), this.hasOwnProperty("spatialReferences") && (e2.spatialReferences = (_c = this.spatialReferences) == null ? void 0 : _c.map((e3) => e3)), this.hasOwnProperty("visible") && (e2.visible = this.visible), this.hasOwnProperty("title") && (e2.title = this.title), e2; } _setAndNotifyLayer(e2, t3) { const r3 = this.layer; this._get(e2) !== t3 && (this._set(e2, t3), r3 && r3.emit("wms-sublayer-update", { propertyName: e2, id: this.id })); } }; e([y2()], g3.prototype, "description", null), e([y2({ readOnly: true })], g3.prototype, "dimensions", void 0), e([y2({ value: null })], g3.prototype, "fullExtent", null), e([o("fullExtent", ["extent"])], g3.prototype, "readExtent", null), e([y2()], g3.prototype, "fullExtents", void 0), e([y2({ type: Number, json: { write: { enabled: false, overridePolicy: () => ({ ignoreOrigin: true, enabled: true }) } } })], g3.prototype, "id", null), e([y2({ type: String, json: { origins: { "web-document": { read: { source: ["legendUrl", "legendURL"] }, write: { target: "legendUrl", ignoreOrigin: true } } }, read: { source: "legendURL" }, write: { ignoreOrigin: true } } })], g3.prototype, "legendUrl", void 0), e([o(["web-document"], "legendUrl")], g3.prototype, "readLegendUrl", null), e([y2({ value: true, type: Boolean, json: { read: { source: "showLegend" }, write: { target: "showLegend" }, origins: { "web-map": { read: false, write: false }, "web-scene": { read: false, write: false } } } })], g3.prototype, "legendEnabled", void 0), e([y2()], g3.prototype, "layer", void 0), e([y2()], g3.prototype, "maxScale", void 0), e([y2()], g3.prototype, "minScale", void 0), e([y2({ readOnly: true })], g3.prototype, "effectiveScaleRange", null), e([y2({ type: String, value: null, json: { read: { source: "name" }, write: { ignoreOrigin: true } } })], g3.prototype, "name", null), e([y2()], g3.prototype, "parent", void 0), e([y2({ type: Boolean, json: { read: { source: "showPopup" }, write: { ignoreOrigin: true, target: "showPopup" } } })], g3.prototype, "popupEnabled", void 0), e([y2({ type: Boolean, json: { write: { ignoreOrigin: true } } })], g3.prototype, "queryable", void 0), e([y2()], g3.prototype, "sublayers", void 0), e([s4("sublayers")], g3.prototype, "castSublayers", null), e([y2({ type: [Number], json: { read: { source: "spatialReferences" } } })], g3.prototype, "spatialReferences", void 0), e([y2({ type: String, value: null, json: { write: { ignoreOrigin: true } } })], g3.prototype, "title", null), e([y2({ type: Boolean, value: true, json: { read: { source: "defaultVisibility" } } })], g3.prototype, "visible", null), g3 = c3 = e([n("esri.layers.support.WMSSublayer")], g3); var m = g3; // node_modules/@arcgis/core/layers/support/wmsUtils.js var o3 = { 84: 4326, 83: 4269, 27: 4267 }; function a3(t3) { if (!t3) return null; const n3 = { idCounter: -1 }; if ("string" == typeof t3) { t3 = new DOMParser().parseFromString(t3, "text/xml"); } const i2 = t3.documentElement; if ("ServiceExceptionReport" === i2.nodeName) { const t4 = Array.prototype.slice.call(i2.childNodes).map((e2) => e2.textContent).join("\r\n"); throw new s2("wmslayer:wms-capabilities-xml-is-not-valid", "The server returned errors when the WMS capabilities were requested.", t4); } const s6 = d("Capability", i2), o4 = d("Service", i2), a4 = d("Request", s6); if (!s6 || !o4 || !a4) return null; const l5 = d("Layer", s6); if (!l5) return null; const m3 = "WMS_Capabilities" === i2.nodeName || "WMT_MS_Capabilities" === i2.nodeName ? i2.getAttribute("version") : "1.3.0", f3 = h2("Title", o4, "") || h2("Name", o4, ""), p3 = h2("AccessConstraints", o4, ""), x2 = /^none$/i.test(p3) ? "" : p3, y5 = h2("Abstract", o4, ""), S4 = parseInt(h2("MaxWidth", o4, "5000"), 10), E2 = parseInt(h2("MaxHeight", o4, "5000"), 10), w4 = N(a4, "GetMap"), L = g4(a4, "GetMap"), M2 = b3(l5, m3, n3); let C2, R2 = 0; if (Array.prototype.slice.call(s6.childNodes).forEach((e2) => { "Layer" === e2.nodeName && (0 === R2 ? C2 = e2 : 1 === R2 ? (M2.name && (M2.name = "", M2.sublayers.push(b3(C2, m3, n3))), M2.sublayers.push(b3(e2, m3, n3))) : M2.sublayers.push(b3(e2, m3, n3)), R2++); }), !M2) return null; let I3, T3; const U4 = M2.fullExtents; if (I3 = M2.sublayers, I3 || (I3 = []), 0 === I3.length && I3.push(M2), T3 = M2.extent, !T3) { const e2 = new w2(I3[0].extent); M2.extent = e2.toJSON(), T3 = M2.extent; } const V3 = M2.spatialReferences.length > 0 ? M2.spatialReferences : u(M2), v3 = g4(a4, "GetFeatureInfo"), O3 = v3 ? N(a4, "GetFeatureInfo") : null, _2 = c4(I3), B = M2.minScale || 0, D = M2.maxScale || 0, j3 = M2.dimensions, k3 = _2.reduce((e2, t4) => e2.concat(t4.dimensions), []), q = j3.concat(k3).filter(F); let X2 = null; if (q.length) { const e2 = q.map((e3) => { const { extent: t4 } = e3; return A(t4) ? t4.map((e4) => e4.getTime()) : t4.map((e4) => [e4.min.getTime(), e4.max.getTime()]); }).flat(2); X2 = { startTimeField: null, endTimeField: null, trackIdField: null, timeExtent: [Math.min(...e2), Math.max(...e2)] }; } return { copyright: x2, description: y5, dimensions: j3, extent: T3, fullExtents: U4, featureInfoFormats: O3, featureInfoUrl: v3, mapUrl: L, maxWidth: S4, maxHeight: E2, maxScale: D, minScale: B, layers: _2, spatialReferences: V3, supportedImageFormatTypes: w4, timeInfo: X2, title: f3, version: m3 }; } function l4(e2) { const t3 = e2.filter((e3) => e3.popupEnabled && e3.name && e3.queryable); return t3.length ? t3.map(({ name: e3 }) => e3).join() : null; } function u(e2) { if (e2.spatialReferences.length > 0) return e2.spatialReferences; if (e2.sublayers) for (const t3 of e2.sublayers) { const e3 = u(t3); if (e3.length > 0) return e3; } return []; } function c4(e2) { var _a; let t3 = []; for (const n3 of e2) t3.push(n3), ((_a = n3.sublayers) == null ? void 0 : _a.length) && (t3 = t3.concat(c4(n3.sublayers)), delete n3.sublayers); return t3; } function m2(e2, t3, n3) { var _a; return (_a = t3.getAttribute(e2)) != null ? _a : n3; } function f2(e2, t3, n3, r3) { const i2 = d(e2, n3); return i2 ? m2(t3, i2, r3) : r3; } function d(e2, t3) { for (let n3 = 0; n3 < t3.childNodes.length; n3++) { const r3 = t3.childNodes[n3]; if (S3(r3) && r3.nodeName === e2) return r3; } return null; } function p2(e2, t3) { const n3 = []; for (let r3 = 0; r3 < t3.childNodes.length; r3++) { const i2 = t3.childNodes[r3]; S3(i2) && i2.nodeName === e2 && n3.push(i2); } return n3; } function h2(e2, t3, n3) { const r3 = d(e2, t3); return r3 ? r3.textContent : n3; } function x(e2, t3, n3) { if (!e2) return null; const s6 = parseFloat(e2.getAttribute("minx")), o4 = parseFloat(e2.getAttribute("miny")), a4 = parseFloat(e2.getAttribute("maxx")), l5 = parseFloat(e2.getAttribute("maxy")); let u2, c5, m3, f3; n3 ? (u2 = isNaN(o4) ? -Number.MAX_VALUE : o4, c5 = isNaN(s6) ? -Number.MAX_VALUE : s6, m3 = isNaN(l5) ? Number.MAX_VALUE : l5, f3 = isNaN(a4) ? Number.MAX_VALUE : a4) : (u2 = isNaN(s6) ? -Number.MAX_VALUE : s6, c5 = isNaN(o4) ? -Number.MAX_VALUE : o4, m3 = isNaN(a4) ? Number.MAX_VALUE : a4, f3 = isNaN(l5) ? Number.MAX_VALUE : l5); const d2 = new k({ wkid: t3 }); return new w2({ xmin: u2, ymin: c5, xmax: m3, ymax: f3, spatialReference: d2 }); } function g4(e2, t3) { const n3 = d(t3, e2); if (n3) { const e3 = d("DCPType", n3); if (e3) { const t4 = d("HTTP", e3); if (t4) { const e4 = d("Get", t4); if (e4) { let t5 = f2("OnlineResource", "xlink:href", e4, null); if (t5) return t5.indexOf("&") === t5.length - 1 && (t5 = t5.substring(0, t5.length - 1)), M(t5, ["service", "request"]); } } } } return null; } function N(e2, t3) { const n3 = p2("Operation", e2); if (!n3.length) { return p2("Format", d(t3, e2)).map(({ textContent: e3 }) => e3); } const r3 = []; for (const i2 of n3) if (i2.getAttribute("name") === t3) { const e3 = p2("Format", i2); for (const { textContent: t4 } of e3) r3.push(t4); } return r3; } function y4(e2, t3, n3) { const r3 = d(t3, e2); if (!r3) return n3; const { textContent: i2 } = r3; if (null == i2 || "" === i2) return n3; const s6 = Number(i2); return isNaN(s6) ? n3 : s6; } function b3(e2, t3, n3) { if (!e2) return null; const a4 = { id: n3.idCounter++, fullExtents: [], parentLayerId: null, queryable: "1" === e2.getAttribute("queryable"), spatialReferences: [], sublayers: null }, l5 = d("LatLonBoundingBox", e2), u2 = d("EX_GeographicBoundingBox", e2); let c5 = null; l5 && (c5 = x(l5, 4326)), u2 && (c5 = new w2(0, 0, 0, 0, new k({ wkid: 4326 })), c5.xmin = parseFloat(h2("westBoundLongitude", u2, "0")), c5.ymin = parseFloat(h2("southBoundLatitude", u2, "0")), c5.xmax = parseFloat(h2("eastBoundLongitude", u2, "0")), c5.ymax = parseFloat(h2("northBoundLatitude", u2, "0"))), l5 || u2 || (c5 = new w2(-180, -90, 180, 90, new k({ wkid: 4326 }))), a4.minScale = y4(e2, "MaxScaleDenominator", 0), a4.maxScale = y4(e2, "MinScaleDenominator", 0); const f3 = ["1.0.0", "1.1.0", "1.1.1"].includes(t3) ? "SRS" : "CRS"; return Array.prototype.slice.call(e2.childNodes).forEach((e3) => { if ("Name" === e3.nodeName) a4.name = e3.textContent || ""; else if ("Title" === e3.nodeName) a4.title = e3.textContent || ""; else if ("Abstract" === e3.nodeName) a4.description = e3.textContent || ""; else if ("BoundingBox" === e3.nodeName) { const n4 = e3.getAttribute(f3); if (n4 && 0 === n4.indexOf("EPSG:")) { const r4 = parseInt(n4.substring(5), 10); 0 === r4 || isNaN(r4) || c5 || (c5 = "1.3.0" === t3 ? x(e3, r4, o2(r4)) : x(e3, r4)); } const r3 = n4 && n4.indexOf(":"); if (r3 && r3 > -1) { let i2 = parseInt(n4.substring(r3 + 1, n4.length), 10); 0 === i2 || isNaN(i2) || (i2 = o3[i2] ? o3[i2] : i2); const l6 = "1.3.0" === t3 ? x(e3, i2, o2(i2)) : x(e3, i2); a4.fullExtents.push(l6); } } else if (e3.nodeName === f3) { e3.textContent.split(" ").forEach((e4) => { const t4 = e4.includes(":") ? parseInt(e4.split(":")[1], 10) : parseInt(e4, 10); if (0 !== t4 && !isNaN(t4)) { const e5 = o3[t4] ? o3[t4] : t4; a4.spatialReferences.includes(e5) || a4.spatialReferences.push(e5); } }); } else if ("Style" !== e3.nodeName || a4.legendURL) { if ("Layer" === e3.nodeName) { const r3 = b3(e3, t3, n3); r3 && (r3.parentLayerId = a4.id, a4.sublayers || (a4.sublayers = []), a4.sublayers.push(r3)); } } else { const t4 = d("LegendURL", e3); if (t4) { const e4 = d("OnlineResource", t4); e4 && (a4.legendURL = e4.getAttribute("xlink:href")); } } }), a4.extent = c5 == null ? void 0 : c5.toJSON(), a4.dimensions = p2("Dimension", e2).filter((e3) => e3.getAttribute("name") && e3.getAttribute("units") && e3.textContent).map((e3) => { const t4 = e3.getAttribute("name"), n4 = e3.getAttribute("units"), r3 = e3.textContent, i2 = e3.getAttribute("unitSymbol"), s6 = e3.getAttribute("default"), o4 = "0" !== m2("default", e3, "0"), a5 = "0" !== m2("nearestValue", e3, "0"), l6 = "0" !== m2("current", e3, "0"); if (F({ name: t4, units: n4 })) { return { name: "time", units: "ISO8601", extent: I2(r3), default: I2(s6), multipleValues: o4, nearestValue: a5, current: l6 }; } if (w3({ name: t4, units: n4 })) { return { name: "elevation", units: n4, extent: C(r3), unitSymbol: i2, default: C(s6), multipleValues: o4, nearestValue: a5 }; } return { name: t4, units: n4, extent: R(r3), unitSymbol: i2, default: R(s6), multipleValues: o4, nearestValue: a5 }; }), a4; } function A(e2) { return Array.isArray(e2) && e2.length > 0 && e2[0] instanceof Date; } function S3(e2) { return e2.nodeType === Node.ELEMENT_NODE; } function w3(e2) { return /^elevation$/i.test(e2.name) && /^(epsg|crs):\d+$/i.test(e2.units); } function F(e2) { return /^time$/i.test(e2.name) && /^iso8601$/i.test(e2.units); } function M(e2, t3) { const r3 = [], i2 = j2(e2); for (const n3 in i2.query) i2.query.hasOwnProperty(n3) && (t3.includes(n3.toLowerCase()) || r3.push(n3 + "=" + i2.query[n3])); return i2.path + (r3.length ? "?" + r3.join("&") : ""); } function C(e2) { if (!e2) return null; const t3 = e2.includes("/"), n3 = e2.split(","); return t3 ? n3.map((e3) => { const t4 = e3.split("/"); if (t4.length < 2) return null; return { min: parseFloat(t4[0]), max: parseFloat(t4[1]), resolution: t4.length >= 3 && "0" !== t4[2] ? parseFloat(t4[2]) : void 0 }; }).filter((e3) => e3) : n3.map((e3) => parseFloat(e3)); } function R(e2) { if (!e2) return null; const t3 = e2.includes("/"), n3 = e2.split(","); return t3 ? n3.map((e3) => { const t4 = e3.split("/"); if (t4.length < 2) return null; return { min: t4[0], max: t4[1], resolution: t4.length >= 3 && "0" !== t4[2] ? t4[2] : void 0 }; }).filter((e3) => e3) : n3; } function I2(e2) { if (!e2) return null; const t3 = e2.includes("/"), n3 = e2.split(","); return t3 ? n3.map((e3) => { const t4 = e3.split("/"); if (t4.length < 2) return null; return { min: new Date(t4[0]), max: new Date(t4[1]), resolution: t4.length >= 3 && "0" !== t4[2] ? T2(t4[2]) : void 0 }; }).filter((e3) => e3) : n3.map((e3) => new Date(e3)); } function T2(e2) { const t3 = /(?:p(\d+y|\d+(?:.|,)\d+y)?(\d+m|\d+(?:.|,)\d+m)?(\d+d|\d+(?:.|,)\d+d)?)?(?:t(\d+h|\d+(?:.|,)\d+h)?(\d+m|\d+(?:.|,)\d+m)?(\d+s|\d+(?:.|,)\d+s)?)?/i, n3 = e2.match(t3); if (!n3) return null; return { years: U3(n3[1]), months: U3(n3[2]), days: U3(n3[3]), hours: U3(n3[4]), minutes: U3(n3[5]), seconds: U3(n3[6]) }; } function U3(e2) { if (!e2) return 0; const t3 = /(?:\d+(?:.|,)\d+|\d+)/, n3 = e2.match(t3); if (!n3) return 0; const r3 = n3[0].replace(",", "."); return Number(r3); } function V(e2) { return e2.toISOString().replace(/\.[0-9]{3}/, ""); } var v2 = /* @__PURE__ */ new Set([102100, 3857, 102113, 900913]); var O2 = /* @__PURE__ */ new Set([3395, 54004]); function _(e2, n3) { let r3 = e2.wkid; return t(n3) ? r3 : (!n3.includes(r3) && e2.latestWkid && (r3 = e2.latestWkid), v2.has(r3) ? n3.find((e3) => v2.has(e3)) || n3.find((e3) => O2.has(e3)) || 102100 : r3); } // node_modules/@arcgis/core/layers/WMSLayer.js var J = new s3({ bmp: "image/bmp", gif: "image/gif", jpg: "image/jpeg", png: "image/png", svg: "image/svg+xml" }, { ignoreUnknown: false }); function V2(e2) { return "text/html" === e2; } function Q(e2) { return "text/plain" === e2; } var z = class extends n2(a2(p(t2(c2(v(O(b2))))))) { constructor(...e2) { super(...e2), this.allSublayers = new l2({ getCollections: () => [this.sublayers], getChildrenFunction: (e3) => e3.sublayers }), this.customParameters = null, this.customLayerParameters = null, this.copyright = null, this.description = null, this.dimensions = null, this.fullExtent = null, this.fullExtents = null, this.featureInfoFormats = null, this.featureInfoUrl = null, this.fetchFeatureInfoFunction = null, this.imageFormat = null, this.imageMaxHeight = 2048, this.imageMaxWidth = 2048, this.imageTransparency = true, this.legendEnabled = true, this.mapUrl = null, this.isReference = null, this.operationalLayerType = "WMS", this.spatialReference = null, this.spatialReferences = null, this.sublayers = null, this.type = "wms", this.url = null, this.version = null, this.addHandles([a(() => this.sublayers, "after-add", ({ item: e3 }) => { e3.parent = e3.layer = this; }, U), a(() => this.sublayers, "after-remove", ({ item: e3 }) => { e3.layer = e3.parent = null; }, U), l(() => this.sublayers, (e3, t3) => { if (t3) for (const r3 of t3) r3.layer = r3.parent = null; if (e3) for (const r3 of e3) r3.parent = r3.layer = this; }, U)]); } normalizeCtorArgs(e2, t3) { return "string" == typeof e2 ? { url: e2, ...t3 } : e2; } load(e2) { const t3 = r(e2) ? e2.signal : null; return this.addResolvingPromise(this.loadFromPortal({ supportedTypes: ["WMS"] }, e2).catch(w).then(() => this._fetchService(t3))), Promise.resolve(this); } readFullExtentFromItemOrMap(e2, t3) { const r3 = t3.extent; return r3 ? new w2({ xmin: r3[0][0], ymin: r3[0][1], xmax: r3[1][0], ymax: r3[1][1] }) : null; } writeFullExtent(e2, t3) { t3.extent = [[e2.xmin, e2.ymin], [e2.xmax, e2.ymax]]; } get featureInfoFormat() { var _a, _b; return t(this.featureInfoFormats) ? null : (_b = (_a = this.featureInfoFormats.find(V2)) != null ? _a : this.featureInfoFormats.find(Q)) != null ? _b : null; } set featureInfoFormat(e2) { r(e2) ? (V2(e2) || Q(e2)) && this._override("featureInfoFormat", e2) : (this.revert("featureInfoFormat", "service"), this._clearOverride("featureInfoFormat")); } readImageFormat(e2, t3) { const r3 = t3.supportedImageFormatTypes; return r3 && r3.includes("image/png") ? "image/png" : r3 && r3[0]; } readSpatialReferenceFromItemOrDocument(e2, t3) { return new k(t3.spatialReferences[0]); } writeSpatialReferences(e2, t3) { var _a; const r3 = (_a = this.spatialReference) == null ? void 0 : _a.wkid; e2 && r3 ? (t3.spatialReferences = e2.filter((e3) => e3 !== r3), t3.spatialReferences.unshift(r3)) : t3.spatialReferences = e2; } readSublayersFromItemOrMap(e2, t3, r3) { return X(t3.layers, r3, t3.visibleLayers); } readSublayers(e2, t3, r3) { return X(t3.layers, r3); } writeSublayers(e2, t3, r3, o4) { var _a, _b; t3.layers = []; const s6 = /* @__PURE__ */ new Map(), i2 = e2.flatten(({ sublayers: e3 }) => e3); for (const a4 of i2) if ("number" == typeof ((_a = a4.parent) == null ? void 0 : _a.id)) { const e3 = s6.get(a4.parent.id); null != e3 ? e3.push(a4.id) : s6.set(a4.parent.id, [a4.id]); } for (const a4 of i2) { const e3 = { sublayer: a4, ...o4 }, r4 = a4.write({ parentLayerId: "number" == typeof ((_b = a4.parent) == null ? void 0 : _b.id) ? a4.parent.id : -1 }, e3); if (s6.has(a4.id) && (r4.sublayerIds = s6.get(a4.id)), !a4.sublayers && a4.name) { const r5 = a4.write({}, e3); delete r5.id, t3.layers.push(r5); } } t3.visibleLayers = i2.filter(({ visible: e3, sublayers: t4 }) => e3 && !t4).map(({ name: e3 }) => e3).toArray(); } createExportImageParameters(e2, t3, r3, o4) { var _a; const s6 = (_a = o4 == null ? void 0 : o4.pixelRatio) != null ? _a : 1, i2 = i({ extent: e2, width: t3 }) * s6, a4 = new l3({ layer: this, scale: i2 }), { xmin: n3, ymin: l5, xmax: p3, ymax: m3, spatialReference: u2 } = e2, c5 = _(u2, this.spatialReferences), f3 = "1.3.0" === this.version && o2(c5) ? `${l5},${n3},${m3},${p3}` : `${n3},${l5},${p3},${m3}`, y5 = a4.toJSON(); return { bbox: f3, ["1.3.0" === this.version ? "crs" : "srs"]: isNaN(c5) ? void 0 : "EPSG:" + c5, ...y5 }; } async fetchImage(e2, t3, r3, o4) { var _a, _b; const i2 = this.mapUrl, a4 = this.createExportImageParameters(e2, t3, r3, o4); if (!a4.layers) { const e3 = document.createElement("canvas"); return e3.width = t3, e3.height = r3, e3; } const n3 = (_a = o4 == null ? void 0 : o4.timeExtent) == null ? void 0 : _a.start, l5 = (_b = o4 == null ? void 0 : o4.timeExtent) == null ? void 0 : _b.end, m3 = r(n3) && r(l5) ? n3.getTime() === l5.getTime() ? V(n3) : `${V(n3)}/${V(l5)}` : void 0, u2 = { responseType: "image", query: this._mixCustomParameters({ width: t3, height: r3, ...a4, time: m3, ...this.refreshParameters }), signal: o4 == null ? void 0 : o4.signal }; return U2(i2 != null ? i2 : "", u2).then((e3) => e3.data); } async fetchImageBitmap(e2, t3, r3, o4) { var _a, _b; const i2 = this.mapUrl, a4 = this.createExportImageParameters(e2, t3, r3, o4); if (!a4.layers) { const e3 = document.createElement("canvas"); return e3.width = t3, e3.height = r3, e3; } const n3 = (_a = o4 == null ? void 0 : o4.timeExtent) == null ? void 0 : _a.start, l5 = (_b = o4 == null ? void 0 : o4.timeExtent) == null ? void 0 : _b.end, m3 = r(n3) && r(l5) ? n3.getTime() === l5.getTime() ? V(n3) : `${V(n3)}/${V(l5)}` : void 0, u2 = { responseType: "blob", query: this._mixCustomParameters({ width: t3, height: r3, ...a4, time: m3, ...this.refreshParameters }), signal: o4 == null ? void 0 : o4.signal }, c5 = await U2(i2 != null ? i2 : "", u2).then((e3) => e3.data); return createImageBitmap(c5); } fetchFeatureInfo(e2, t3, r3, o4, s6) { const i2 = i({ extent: e2, width: t3 }), a4 = new l3({ layer: this, scale: i2 }), n3 = l4(a4.visibleSublayers); if (t(this.featureInfoUrl) || t(n3)) return Promise.resolve([]); if (t(this.fetchFeatureInfoFunction) && t(this.featureInfoFormat)) return Promise.resolve([]); const l5 = "1.3.0" === this.version ? { I: o4, J: s6 } : { x: o4, y: s6 }, u2 = { query_layers: n3, request: "GetFeatureInfo", info_format: this.featureInfoFormat, feature_count: 25, width: t3, height: r3, ...l5 }, c5 = { ...this.createExportImageParameters(e2, t3, r3), ...u2 }, f3 = this._mixCustomParameters(c5); return r(this.fetchFeatureInfoFunction) ? this.fetchFeatureInfoFunction(f3) : this._defaultFetchFeatureInfoFunction(Bt(this.featureInfoUrl, f3)); } findSublayerById(e2) { return this.allSublayers.find((t3) => t3.id === e2); } findSublayerByName(e2) { return this.allSublayers.find((t3) => t3.name === e2); } serviceSupportsSpatialReference(e2) { return I(this.url) || null != this.spatialReferences && this.spatialReferences.some((t3) => { const r3 = 900913 === t3 ? k.WebMercator : new k({ wkid: t3 }); return E(r3, e2); }); } _defaultFetchFeatureInfoFunction(e2) { const t3 = document.createElement("iframe"); t3.src = S(e2), t3.style.border = "none", t3.style.margin = "0", t3.style.width = "100%", t3.setAttribute("sandbox", ""); const s6 = new k2({ title: this.title, content: t3 }), i2 = new g2({ sourceLayer: this, popupTemplate: s6 }); return Promise.resolve([i2]); } async _fetchService(e2) { var _a; if (!this.resourceInfo) { const { path: t3, query: r3 } = (_a = this.parsedUrl) != null ? _a : {}; (r3 == null ? void 0 : r3.service) && (r3.SERVICE = r3.service, delete r3.service), (r3 == null ? void 0 : r3.request) && (r3.REQUEST = r3.request, delete r3.request); const { data: o4 } = await U2(t3 != null ? t3 : "", { query: { SERVICE: "WMS", REQUEST: "GetCapabilities", ...r3, ...this.customParameters }, responseType: "xml", signal: e2 }); this.resourceInfo = a3(o4); } if (this.parsedUrl) { const e3 = new y3(this.parsedUrl.path), { httpsDomains: r3 } = s.request; "https" !== e3.scheme || e3.port && "443" !== e3.port || !e3.host || r3.includes(e3.host) || r3.push(e3.host); } this.read(this.resourceInfo, { origin: "service" }); } _mixCustomParameters(e2) { if (!this.customLayerParameters && !this.customParameters) return e2; const t3 = { ...this.customParameters, ...this.customLayerParameters }; for (const r3 in t3) e2[r3.toLowerCase()] = t3[r3]; return e2; } }; function K(e2, t3) { return e2.some((e3) => { for (const r3 in e3) if (g(e3, r3, null, t3)) return true; return false; }); } function X(e2, t3, r3) { e2 = e2 != null ? e2 : []; const o4 = /* @__PURE__ */ new Map(); e2.every((e3) => null == e3.id) && (e2 = y(e2)).forEach((e3, t4) => e3.id = t4); for (const i2 of e2) { const e3 = new m(); e3.read(i2, t3), r3 && !r3.includes(e3.name) && (e3.visible = false), o4.set(e3.id, e3); } const s6 = []; for (const a4 of e2) { const e3 = null != a4.id ? o4.get(a4.id) : null; if (e3) if (null != a4.parentLayerId && a4.parentLayerId >= 0) { const t4 = o4.get(a4.parentLayerId); if (!t4) continue; t4.sublayers || (t4.sublayers = new j()), t4.sublayers.push(e3); } else s6.push(e3); } return s6; } e([y2({ readOnly: true })], z.prototype, "allSublayers", void 0), e([y2({ json: { type: Object, write: true } })], z.prototype, "customParameters", void 0), e([y2({ json: { type: Object, write: true } })], z.prototype, "customLayerParameters", void 0), e([y2({ type: String, json: { write: true } })], z.prototype, "copyright", void 0), e([y2()], z.prototype, "description", void 0), e([y2({ readOnly: true })], z.prototype, "dimensions", void 0), e([y2({ json: { type: [[Number]], read: { source: "extent" }, write: { target: "extent" }, origins: { "web-document": { write: { ignoreOrigin: true } }, "portal-item": { write: { ignoreOrigin: true } } } } })], z.prototype, "fullExtent", void 0), e([o(["web-document", "portal-item"], "fullExtent", ["extent"])], z.prototype, "readFullExtentFromItemOrMap", null), e([r2(["web-document", "portal-item"], "fullExtent", { extent: { type: [[Number]] } })], z.prototype, "writeFullExtent", null), e([y2()], z.prototype, "fullExtents", void 0), e([y2({ type: String, json: { write: { ignoreOrigin: true } } })], z.prototype, "featureInfoFormat", null), e([y2({ type: [String], readOnly: true })], z.prototype, "featureInfoFormats", void 0), e([y2({ type: String, json: { write: { ignoreOrigin: true } } })], z.prototype, "featureInfoUrl", void 0), e([y2()], z.prototype, "fetchFeatureInfoFunction", void 0), e([y2({ type: String, json: { origins: { "web-document": { default: "image/png", type: J.jsonValues, read: { reader: J.read, source: "format" }, write: { writer: J.write, target: "format" } } } } })], z.prototype, "imageFormat", void 0), e([o("imageFormat", ["supportedImageFormatTypes"])], z.prototype, "readImageFormat", null), e([y2({ type: Number, json: { read: { source: "maxHeight" }, write: { target: "maxHeight" } } })], z.prototype, "imageMaxHeight", void 0), e([y2({ type: Number, json: { read: { source: "maxWidth" }, write: { target: "maxWidth" } } })], z.prototype, "imageMaxWidth", void 0), e([y2()], z.prototype, "imageTransparency", void 0), e([y2(c)], z.prototype, "legendEnabled", void 0), e([y2({ type: ["show", "hide", "hide-children"] })], z.prototype, "listMode", void 0), e([y2({ type: String, json: { write: { ignoreOrigin: true } } })], z.prototype, "mapUrl", void 0), e([y2({ type: Boolean, json: { read: false, write: { enabled: true, overridePolicy: () => ({ enabled: false }) } } })], z.prototype, "isReference", void 0), e([y2({ type: ["WMS"] })], z.prototype, "operationalLayerType", void 0), e([y2()], z.prototype, "resourceInfo", void 0), e([y2({ type: k, json: { origins: { service: { read: { source: "extent.spatialReference" } } }, write: false } })], z.prototype, "spatialReference", void 0), e([o(["web-document", "portal-item"], "spatialReference", ["spatialReferences"])], z.prototype, "readSpatialReferenceFromItemOrDocument", null), e([y2({ type: [T], json: { read: false, origins: { service: { read: true }, "web-document": { read: false, write: { ignoreOrigin: true } }, "portal-item": { read: false, write: { ignoreOrigin: true } } } } })], z.prototype, "spatialReferences", void 0), e([r2(["web-document", "portal-item"], "spatialReferences")], z.prototype, "writeSpatialReferences", null), e([y2({ type: j.ofType(m), json: { write: { target: "layers", overridePolicy(e2, t3, r3) { if (K(this.allSublayers, r3)) return { ignoreOrigin: true }; } } } })], z.prototype, "sublayers", void 0), e([o(["web-document", "portal-item"], "sublayers", ["layers", "visibleLayers"])], z.prototype, "readSublayersFromItemOrMap", null), e([o("service", "sublayers", ["layers"])], z.prototype, "readSublayers", null), e([r2("sublayers", { layers: { type: [m] }, visibleLayers: { type: [String] } })], z.prototype, "writeSublayers", null), e([y2({ json: { read: false }, readOnly: true, value: "wms" })], z.prototype, "type", void 0), e([y2(f)], z.prototype, "url", void 0), e([y2({ type: String, json: { write: { ignoreOrigin: true } } })], z.prototype, "version", void 0), z = e([n("esri.layers.WMSLayer")], z); var Y = z; export { Y as default }; //# sourceMappingURL=WMSLayer-TMD46NQL.js.map