import { c as c2 } from "./chunk-PT5TF6KZ.js"; import { i as i2 } from "./chunk-3YTO5A3F.js"; import { e as e2 } from "./chunk-2RHPWGZL.js"; import { a as a2 } from "./chunk-XEQ4FTFC.js"; import { E, y as y2, z } from "./chunk-BQSLUIIU.js"; import { n as n4 } from "./chunk-XO7O5UZJ.js"; import { i } from "./chunk-WWXZOC2Y.js"; import { p as p2 } from "./chunk-ZOKNWEG3.js"; import { o as o2 } from "./chunk-W6U6FKJ3.js"; import { a } from "./chunk-YZVAB3DF.js"; import { v } from "./chunk-JUWKPBLS.js"; import { c } from "./chunk-WLSB4F4I.js"; import { f } from "./chunk-GLSWDDR3.js"; import { O } from "./chunk-MIQGEDET.js"; import { T as T2 } from "./chunk-VRLXUHP2.js"; import { p } from "./chunk-GN35O2ZO.js"; import { n as n3 } from "./chunk-XTVKPAWY.js"; import { t as t2 } from "./chunk-PLWDAYK7.js"; import { n as n2 } from "./chunk-FAOWJMTO.js"; import { b } from "./chunk-DXVOOCG4.js"; import { U } from "./chunk-DVUG3KID.js"; import { o, w2 } from "./chunk-6T6G6LCQ.js"; import { r as r3 } from "./chunk-PQFTYGF5.js"; import { e, n5 as n, r2, t3 as t, y3 as y } from "./chunk-2Z2TG5CU.js"; import { T } from "./chunk-SQOPWYIT.js"; import { j, w } from "./chunk-V6P2MAQQ.js"; import { s3 as s } from "./chunk-E5O6P5I2.js"; import { r } from "./chunk-YXWMMD76.js"; // node_modules/@arcgis/core/layers/MapImageLayer.js var q = class extends n3(a2(t2(E(y2(p2(c(v(O(p(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, r4) { return "string" == typeof e3 ? { url: e3, ...r4 } : e3; } load(e3) { const r4 = r(e3) ? e3.signal : null; return this.addResolvingPromise(this.loadFromPortal({ supportedTypes: ["Map Service"] }, e3).catch(w).then(() => this._fetchService(r4))), Promise.resolve(this); } readImageFormat(e3, r4) { const t3 = r4.supportedImageFormatTypes; return t3 && t3.includes("PNG32") ? "png32" : "png24"; } writeSublayers(e3, r4, t3, o3) { if (!this.loaded || !e3) return; const i3 = 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(i3, e5, r2.SERVICE); } else if (e4 > r2.PORTAL_ITEM) { const e5 = this.createSublayersForOrigin("portal-item"); s2 = n4(i3, e5.sublayers, t(e5.origin)); } } const a3 = [], p3 = { writeSublayerStructure: s2, ...o3 }; let n5 = s2; i3.forEach((e4) => { const r5 = e4.write({}, p3); a3.push(r5), n5 = n5 || "user" === e4.originOf("visible"); }); a3.some((e4) => Object.keys(e4).length > 1) && (r4.layers = a3), n5 && (r4.visibleLayers = i3.filter((e4) => e4.visible).map((e4) => e4.id)); } createExportImageParameters(e3, r4, t3, o3) { const i3 = o3 && o3.pixelRatio || 1; e3 && this.version >= 10 && (e3 = e3.clone().shiftCentralMeridian()); const s2 = new c2({ layer: this, floors: o3 == null ? void 0 : o3.floors, scale: i2({ extent: e3, width: r4 }) * i3 }), a3 = s2.toJSON(); s2.destroy(); const p3 = !o3 || !o3.rotation || this.version < 10.3 ? {} : { rotation: -o3.rotation }, n5 = e3 && e3.spatialReference, m = n5.wkid || JSON.stringify(n5.toJSON()); a3.dpi *= i3; const l = {}; if (o3 == null ? void 0 : o3.timeExtent) { const { start: e4, end: r5 } = o3.timeExtent.toJSON(); l.time = e4 && r5 && e4 === r5 ? "" + e4 : `${e4 != null ? e4 : "null"},${r5 != null ? r5 : "null"}`; } 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: r4 + "," + t3, ...a3, ...p3, ...l }; } async fetchImage(e3, r4, t3, o3) { return this._fetchImage("image", e3, r4, t3, o3); } async fetchImageBitmap(e3, r4, t3, o3) { const i3 = await this._fetchImage("blob", e3, r4, t3, o3); return createImageBitmap(i3); } async fetchRecomputedExtents(e3 = {}) { const o3 = { ...e3, query: { returnUpdates: true, f: "json", ...this.customParameters, token: this.apiKey } }, { data: i3 } = await U(this.url, o3), { extent: s2, fullExtent: a3, timeExtent: p3 } = i3, n5 = s2 || a3; return { fullExtent: n5 && w2.fromJSON(n5), timeExtent: p3 && T2.fromJSON({ start: p3[0], end: p3[1] }) }; } loadAll() { return n2(this, (e3) => { e3(this.allSublayers); }); } serviceSupportsSpatialReference(e3) { return e2(this, e3); } async _fetchImage(e3, t3, i3, s2, a3) { var _a; const p3 = { responseType: e3, signal: (_a = a3 == null ? void 0 : a3.signal) != null ? _a : null, query: { ...this.parsedUrl.query, ...this.createExportImageParameters(t3, i3, s2, a3), f: "image", ...this.refreshParameters, ...this.customParameters, token: this.apiKey } }, n5 = this.parsedUrl.path + "/export"; if (null != p3.query.dynamicLayers && !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: p3.query }); try { const { data: e4 } = await U(n5, p3); return e4; } catch (l) { if (j(l)) throw l; throw new s("mapimagelayer:image-fetch-error", `Unable to load image: ${n5}`, { error: l }); } } 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([y({ type: Boolean })], q.prototype, "datesInUnknownTimezone", void 0), e([y()], q.prototype, "dpi", void 0), e([y()], q.prototype, "gdbVersion", void 0), e([y()], q.prototype, "imageFormat", void 0), e([o("imageFormat", ["supportedImageFormatTypes"])], q.prototype, "readImageFormat", null), e([y({ json: { origins: { service: { read: { source: "maxImageHeight" } } } } })], q.prototype, "imageMaxHeight", void 0), e([y({ json: { origins: { service: { read: { source: "maxImageWidth" } } } } })], q.prototype, "imageMaxWidth", void 0), e([y()], q.prototype, "imageTransparency", void 0), e([y({ type: Boolean, json: { read: false, write: { enabled: true, overridePolicy: () => ({ enabled: false }) } } })], q.prototype, "isReference", void 0), e([y({ json: { read: false, write: false } })], q.prototype, "labelsVisible", void 0), e([y({ type: ["ArcGISMapServiceLayer"] })], q.prototype, "operationalLayerType", void 0), e([y({ json: { read: false, write: false } })], q.prototype, "popupEnabled", void 0), e([y()], q.prototype, "sourceJSON", void 0), e([y({ json: { write: { ignoreOrigin: true } } })], q.prototype, "sublayers", void 0), e([r3("sublayers", { layers: { type: [z] }, visibleLayers: { type: [T] } })], q.prototype, "writeSublayers", null), e([y({ type: ["show", "hide", "hide-children"] })], q.prototype, "listMode", void 0), e([y({ json: { read: false }, readOnly: true, value: "map-image" })], q.prototype, "type", void 0), e([y(f)], q.prototype, "url", void 0), q = e([n("esri.layers.MapImageLayer")], q); var F = q; export { F }; //# sourceMappingURL=chunk-35HO4E7G.js.map