import { d as d2 } from "./chunk-MWBB6M6Y.js"; import { c } from "./chunk-FGKNEJKJ.js"; import "./chunk-PSV473TI.js"; import { O } from "./chunk-I3OBGWNS.js"; import "./chunk-FONIFA5N.js"; import "./chunk-EG5OI4V4.js"; import "./chunk-65BYCSII.js"; import "./chunk-WZQZRKNH.js"; import "./chunk-LRDX4TO7.js"; import "./chunk-6A4U74YA.js"; import { S } from "./chunk-RBZL6SRZ.js"; import "./chunk-CYI7KFYB.js"; import { a } from "./chunk-5LXROFTA.js"; import "./chunk-GJXW4HL5.js"; import "./chunk-WJW5DUN6.js"; import "./chunk-W72F6AS3.js"; import "./chunk-PJ7ZQ4VD.js"; import "./chunk-WDLTDV2L.js"; import "./chunk-TERAW6FT.js"; import "./chunk-N2663GRX.js"; import "./chunk-O4FY3ITT.js"; import "./chunk-WEMIK25H.js"; import "./chunk-4DDBH2K5.js"; import "./chunk-7N4X6GF3.js"; import "./chunk-JXW4QTJA.js"; import "./chunk-UXF37FQ4.js"; import "./chunk-ZOEK6QHJ.js"; import "./chunk-XNLG7T2T.js"; import "./chunk-IR4PV7VK.js"; import "./chunk-2Z6LERTI.js"; import "./chunk-OWVBLVP3.js"; import "./chunk-TBBTRX4O.js"; import "./chunk-YBSUITLL.js"; import "./chunk-ALDCDSPV.js"; import "./chunk-DT6EAZQ5.js"; import "./chunk-HNOZUNJ4.js"; import { U } from "./chunk-VNFRAYHO.js"; import "./chunk-R5IG2D6H.js"; import "./chunk-VBRY5KJM.js"; import { s as s2 } from "./chunk-PDKDCAAD.js"; import "./chunk-ECW2QABR.js"; import "./chunk-GCDJLKH4.js"; import { k2 as k } from "./chunk-MRJEICT6.js"; import { d, e, n2 as n } from "./chunk-Y3WMVFTW.js"; import "./chunk-SAS7RONY.js"; import "./chunk-WSRBH7BF.js"; import "./chunk-IHXECKQQ.js"; import "./chunk-ULGDPLM2.js"; import { s3 as s } from "./chunk-EMJ4ZSM2.js"; import "./chunk-IKP3YN53.js"; import { r, t } from "./chunk-GZT4BVFP.js"; import "./chunk-A5ICIBVI.js"; // node_modules/@arcgis/core/layers/BingMapsLayer.js var y = new s2({ BingMapsAerial: "aerial", BingMapsRoad: "road", BingMapsHybrid: "hybrid" }); var h = "https://dev.virtualearth.net"; var m = class extends a(c(O(d2))) { constructor(e2) { super(e2), this.type = "bing-maps", this.tileInfo = new S({ size: [256, 256], dpi: 96, origin: { x: -20037508342787e-6, y: 20037508342787e-6, spatialReference: k.WebMercator }, spatialReference: k.WebMercator, lods: [{ level: 1, resolution: 78271.5169639999, scale: 295828763795777e-6 }, { level: 2, resolution: 39135.7584820001, scale: 147914381897889e-6 }, { level: 3, resolution: 19567.8792409999, scale: 73957190948944e-6 }, { level: 4, resolution: 9783.93962049996, scale: 36978595474472e-6 }, { level: 5, resolution: 4891.96981024998, scale: 18489297737236e-6 }, { level: 6, resolution: 2445.98490512499, scale: 9244648868618e-6 }, { level: 7, resolution: 1222.99245256249, scale: 4622324434309e-6 }, { level: 8, resolution: 611.49622628138, scale: 2311162217155e-6 }, { level: 9, resolution: 305.748113140558, scale: 1155581108577e-6 }, { level: 10, resolution: 152.874056570411, scale: 577790.554289 }, { level: 11, resolution: 76.4370282850732, scale: 288895.277144 }, { level: 12, resolution: 38.2185141425366, scale: 144447.638572 }, { level: 13, resolution: 19.1092570712683, scale: 72223.819286 }, { level: 14, resolution: 9.55462853563415, scale: 36111.909643 }, { level: 15, resolution: 4.77731426794937, scale: 18055.954822 }, { level: 16, resolution: 2.38865713397468, scale: 9027.977411 }, { level: 17, resolution: 1.19432856685505, scale: 4513.988705 }, { level: 18, resolution: 0.597164283559817, scale: 2256.994353 }, { level: 19, resolution: 0.298582141647617, scale: 1128.497176 }, { level: 20, resolution: 0.1492910708238085, scale: 564.248588 }] }), this.key = null, this.style = "road", this.culture = "en-US", this.region = null, this.portalUrl = null, this.hasAttributionData = true; } get bingMetadata() { return this._get("bingMetadata"); } set bingMetadata(e2) { this._set("bingMetadata", e2); } get copyright() { return r(this.bingMetadata) ? this.bingMetadata.copyright : null; } get operationalLayerType() { return y.toJSON(this.style); } get bingLogo() { return r(this.bingMetadata) ? this.bingMetadata.brandLogoUri : null; } load(e2) { return this.key ? this.addResolvingPromise(this._getMetadata()) : this.portalUrl ? this.addResolvingPromise(this._getPortalBingKey().then(() => this._getMetadata())) : this.addResolvingPromise(Promise.reject(new s("bingmapslayer:load", "Bing layer must have bing key."))), Promise.resolve(this); } getTileUrl(e2, t2, r2) { if (!this.loaded || t(this.bingMetadata)) return null; const o = this.bingMetadata.resourceSets[0].resources[0], a2 = o.imageUrlSubdomains[t2 % o.imageUrlSubdomains.length], i = this._getQuadKey(e2, t2, r2); return o.imageUrl.replace("{subdomain}", a2).replace("{quadkey}", i); } async fetchAttributionData() { return this.load().then(() => { if (t(this.bingMetadata)) return null; return { contributors: this.bingMetadata.resourceSets[0].resources[0].imageryProviders.map((e2) => ({ attribution: e2.attribution, coverageAreas: e2.coverageAreas.map((e3) => ({ zoomMin: e3.zoomMin, zoomMax: e3.zoomMax, score: 1, bbox: [e3.bbox[0], e3.bbox[1], e3.bbox[2], e3.bbox[3]] })) })) }; }); } _getMetadata() { const e2 = { road: "roadOnDemand", aerial: "aerial", hybrid: "aerialWithLabelsOnDemand" }[this.style]; return U(`${h}/REST/v1/Imagery/Metadata/${e2}`, { responseType: "json", query: { include: "ImageryProviders", uriScheme: "https", key: this.key, suppressStatus: true, output: "json", culture: this.culture, userRegion: this.region } }).then((e3) => { const t2 = e3.data; if (t2.statusCode !== 200) throw new s("bingmapslayer:getmetadata", t2.statusDescription); if (this.bingMetadata = t2, this.bingMetadata.resourceSets.length === 0) throw new s("bingmapslayer:getmetadata", "no bing resourcesets"); if (this.bingMetadata.resourceSets[0].resources.length === 0) throw new s("bingmapslayer:getmetadata", "no bing resources"); }).catch((e3) => { throw new s("bingmapslayer:getmetadata", e3.message); }); } _getPortalBingKey() { return U(this.portalUrl, { responseType: "json", authMode: "no-prompt", query: { f: "json" } }).then((e2) => { if (!e2.data.bingKey) throw new s("bingmapslayer:getportalbingkey", "The referenced Portal does not contain a valid bing key"); this.key = e2.data.bingKey; }).catch((e2) => { throw new s("bingmapslayer:getportalbingkey", e2.message); }); } _getQuadKey(e2, t2, r2) { let o = ""; for (let a2 = e2; a2 > 0; a2--) { let e3 = 0; const s3 = 1 << a2 - 1; (r2 & s3) != 0 && (e3 += 1), (t2 & s3) != 0 && (e3 += 2), o += e3.toString(); } return o; } }; e([d({ json: { read: false, write: false }, value: null })], m.prototype, "bingMetadata", null), e([d({ json: { read: false, write: false }, value: "bing-maps", readOnly: true })], m.prototype, "type", void 0), e([d({ type: S })], m.prototype, "tileInfo", void 0), e([d({ type: String, readOnly: true, json: { read: false, write: false } })], m.prototype, "copyright", null), e([d({ type: String, json: { write: false, read: false } })], m.prototype, "key", void 0), e([d({ type: y.apiValues, nonNullable: true, json: { read: { source: "layerType", reader: y.read } } })], m.prototype, "style", void 0), e([d({ type: ["BingMapsAerial", "BingMapsHybrid", "BingMapsRoad"] })], m.prototype, "operationalLayerType", null), e([d({ type: String, json: { write: false, read: false } })], m.prototype, "culture", void 0), e([d({ type: String, json: { write: false, read: false } })], m.prototype, "region", void 0), e([d({ type: String, json: { write: true, read: true } })], m.prototype, "portalUrl", void 0), e([d({ type: Boolean, json: { write: false, read: false } })], m.prototype, "hasAttributionData", void 0), e([d({ type: String, readOnly: true })], m.prototype, "bingLogo", null), m = e([n("esri.layers.BingMapsLayer")], m); var b = m; export { b as default }; //# sourceMappingURL=BingMapsLayer-ONE4BTEV.js.map