import { c as c2 } from "./chunk-TD4DLRQ7.js"; import { r as r4 } from "./chunk-56H3JM63.js"; import { e as e2 } from "./chunk-OSNKP4CI.js"; import { a as a3 } from "./chunk-435DJNTD.js"; import { n as n2 } from "./chunk-5MVUZO4F.js"; import { E, X, y as y2 } from "./chunk-4VRSV2TU.js"; import { n as n4 } from "./chunk-MD4XYAEQ.js"; import { i } from "./chunk-FMKGHOGD.js"; import { p } from "./chunk-6URTNEGN.js"; import { o as o2 } from "./chunk-6B2LQBKM.js"; import { a } from "./chunk-RMX2AZ4P.js"; import { v } from "./chunk-KHA63LLS.js"; import { c } from "./chunk-FGKNEJKJ.js"; import { f } from "./chunk-PSV473TI.js"; import { O } from "./chunk-I3OBGWNS.js"; import { y } from "./chunk-EG5OI4V4.js"; import { n as n3 } from "./chunk-CYI7KFYB.js"; import { a as a2 } from "./chunk-5LXROFTA.js"; import { t as t2 } from "./chunk-W72F6AS3.js"; import { b } from "./chunk-4DDBH2K5.js"; import { U } from "./chunk-VNFRAYHO.js"; import { M2 as M, o } from "./chunk-ECW2QABR.js"; import { r as r3 } from "./chunk-MRJEICT6.js"; import { d, e, n2 as n, r2, t3 as t } from "./chunk-Y3WMVFTW.js"; import { S } from "./chunk-IHXECKQQ.js"; import { g, w } from "./chunk-ULGDPLM2.js"; import { s3 as s } from "./chunk-EMJ4ZSM2.js"; import { r } from "./chunk-GZT4BVFP.js"; // node_modules/@arcgis/core/layers/MapImageLayer.js var q = class extends a2(a3(t2(E(y2(p(c(v(O(n3(i(o2(a(b))))))))))))) { constructor(...e3) { super(...e3), this.datesInUnknownTimezone = false, this.dpi = 96, this.gdbVersion = null, this.imageFormat = "png24", this.imageMaxHeight = 2048, this.imageMaxWidth = 2048, this.imageTransparency = true, this.isReference = null, this.labelsVisible = false, this.operationalLayerType = "ArcGISMapServiceLayer", this.sourceJSON = null, this.sublayers = null, this.type = "map-image", this.url = null; } normalizeCtorArgs(e3, r5) { return typeof e3 == "string" ? { url: e3, ...r5 } : e3; } load(e3) { const r5 = r(e3) ? e3.signal : null; return this.addResolvingPromise(this.loadFromPortal({ supportedTypes: ["Map Service"] }, e3).catch(w).then(() => this._fetchService(r5))), Promise.resolve(this); } readImageFormat(e3, r5) { const t3 = r5.supportedImageFormatTypes; return t3 && t3.includes("PNG32") ? "png32" : "png24"; } writeSublayers(e3, r5, t3, o3) { if (!this.loaded || !e3) return; const i2 = e3.slice().reverse().flatten(({ sublayers: e4 }) => e4 && e4.toArray().reverse()).toArray(); let s2 = false; if (this.capabilities && this.capabilities.operations.supportsExportMap && this.capabilities.exportMap.supportsDynamicLayers) { const e4 = t(o3.origin); if (e4 === r2.PORTAL_ITEM) { const e5 = this.createSublayersForOrigin("service").sublayers; s2 = n4(i2, e5, r2.SERVICE); } else if (e4 > r2.PORTAL_ITEM) { const e5 = this.createSublayersForOrigin("portal-item"); s2 = n4(i2, e5.sublayers, t(e5.origin)); } } const a4 = [], p2 = { writeSublayerStructure: s2, ...o3 }; let n5 = s2; i2.forEach((e4) => { const r6 = e4.write({}, p2); a4.push(r6), n5 = n5 || e4.originOf("visible") === "user"; }); a4.some((e4) => Object.keys(e4).length > 1) && (r5.layers = a4), n5 && (r5.visibleLayers = i2.filter((e4) => e4.visible).map((e4) => e4.id)); } createExportImageParameters(e3, r5, t3, o3) { const i2 = o3 && o3.pixelRatio || 1; e3 && this.version >= 10 && (e3 = e3.clone().shiftCentralMeridian()); const s2 = new c2({ layer: this, floors: o3?.floors, scale: r4({ extent: e3, width: r5 }) * i2 }), a4 = s2.toJSON(); s2.destroy(); const p2 = !o3 || !o3.rotation || this.version < 10.3 ? {} : { rotation: -o3.rotation }, n5 = e3 && e3.spatialReference, m = n5.wkid || JSON.stringify(n5.toJSON()); a4.dpi *= i2; const l = {}; if (o3?.timeExtent) { const { start: e4, end: r6 } = o3.timeExtent.toJSON(); l.time = e4 && r6 && e4 === r6 ? "" + e4 : `${e4 == null ? "null" : e4},${r6 == null ? "null" : r6}`; } else this.timeInfo && !this.timeInfo.hasLiveData && (l.time = "null,null"); return { bbox: e3 && e3.xmin + "," + e3.ymin + "," + e3.xmax + "," + e3.ymax, bboxSR: m, imageSR: m, size: r5 + "," + t3, ...a4, ...p2, ...l }; } async fetchImage(e3, t3, i2, s2) { const a4 = { responseType: "image", signal: s2?.signal ?? null, query: { ...this.parsedUrl.query, ...this.createExportImageParameters(e3, t3, i2, s2), f: "image", ...this.refreshParameters, ...this.customParameters, token: this.apiKey } }, p2 = this.parsedUrl.path + "/export"; if (a4.query.dynamicLayers != null && !this.capabilities.exportMap.supportsDynamicLayers) throw new s("mapimagelayer:dynamiclayer-not-supported", `service ${this.url} doesn't support dynamic layers, which is required to be able to change the sublayer's order, rendering, labeling or source.`, { query: a4.query }); return U(p2, a4).then((e4) => e4.data).catch((e4) => { if (g(e4)) throw e4; throw new s("mapimagelayer:image-fetch-error", `Unable to load image: ${p2}`, { error: e4 }); }); } async fetchRecomputedExtents(e3 = {}) { const o3 = { ...e3, query: { returnUpdates: true, f: "json", ...this.customParameters, token: this.apiKey } }, { data: i2 } = await U(this.url, o3), { extent: s2, fullExtent: a4, timeExtent: p2 } = i2, n5 = s2 || a4; return { fullExtent: n5 && M.fromJSON(n5), timeExtent: p2 && y.fromJSON({ start: p2[0], end: p2[1] }) }; } loadAll() { return n2(this, (e3) => { e3(this.allSublayers); }); } serviceSupportsSpatialReference(e3) { return e2(this, e3); } async _fetchService(e3) { if (this.sourceJSON) return void this.read(this.sourceJSON, { origin: "service", url: this.parsedUrl }); const { data: t3, ssl: o3 } = await U(this.parsedUrl.path, { query: { f: "json", ...this.parsedUrl.query, ...this.customParameters, token: this.apiKey }, signal: e3 }); o3 && (this.url = this.url.replace(/^http:/i, "https:")), this.sourceJSON = t3, this.read(t3, { origin: "service", url: this.parsedUrl }); } }; e([d({ type: Boolean })], q.prototype, "datesInUnknownTimezone", void 0), e([d()], q.prototype, "dpi", void 0), e([d()], q.prototype, "gdbVersion", void 0), e([d()], q.prototype, "imageFormat", void 0), e([o("imageFormat", ["supportedImageFormatTypes"])], q.prototype, "readImageFormat", null), e([d({ json: { origins: { service: { read: { source: "maxImageHeight" } } } } })], q.prototype, "imageMaxHeight", void 0), e([d({ json: { origins: { service: { read: { source: "maxImageWidth" } } } } })], q.prototype, "imageMaxWidth", void 0), e([d()], q.prototype, "imageTransparency", void 0), e([d({ type: Boolean, json: { read: false, write: { enabled: true, overridePolicy: () => ({ enabled: false }) } } })], q.prototype, "isReference", void 0), e([d({ json: { read: false, write: false } })], q.prototype, "labelsVisible", void 0), e([d({ type: ["ArcGISMapServiceLayer"] })], q.prototype, "operationalLayerType", void 0), e([d({ json: { read: false, write: false } })], q.prototype, "popupEnabled", void 0), e([d()], q.prototype, "sourceJSON", void 0), e([d({ json: { write: { ignoreOrigin: true } } })], q.prototype, "sublayers", void 0), e([r3("sublayers", { layers: { type: [X] }, visibleLayers: { type: [S] } })], q.prototype, "writeSublayers", null), e([d({ type: ["show", "hide", "hide-children"] })], q.prototype, "listMode", void 0), e([d({ json: { read: false }, readOnly: true, value: "map-image" })], q.prototype, "type", void 0), e([d(f)], q.prototype, "url", void 0), q = e([n("esri.layers.MapImageLayer")], q); var F = q; export { F }; //# sourceMappingURL=chunk-QHH4NYIZ.js.map