VectorTileLayer-LHJ7JQ2Z.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. import {
  2. l
  3. } from "./chunk-LC47RING.js";
  4. import "./chunk-L553EHL3.js";
  5. import "./chunk-2GP5D74I.js";
  6. import "./chunk-R24MO4IV.js";
  7. import "./chunk-YQBYWPBD.js";
  8. import "./chunk-QISOH77W.js";
  9. import {
  10. e as e4
  11. } from "./chunk-MYF5A5DJ.js";
  12. import "./chunk-XO5VJRK4.js";
  13. import "./chunk-4OM3EX6P.js";
  14. import "./chunk-3OFVLRSL.js";
  15. import {
  16. l as l2
  17. } from "./chunk-YFDOPEEZ.js";
  18. import "./chunk-5FHRTN6L.js";
  19. import "./chunk-NDUYF7XW.js";
  20. import "./chunk-RWQH5X3O.js";
  21. import {
  22. e as e3
  23. } from "./chunk-TFHLTN6F.js";
  24. import {
  25. s as s4
  26. } from "./chunk-F4V56GSN.js";
  27. import {
  28. n as n3,
  29. z
  30. } from "./chunk-KTSVAGSV.js";
  31. import "./chunk-OJ2HHY2O.js";
  32. import {
  33. i
  34. } from "./chunk-WWXZOC2Y.js";
  35. import {
  36. p
  37. } from "./chunk-ZOKNWEG3.js";
  38. import {
  39. o as o3
  40. } from "./chunk-W6U6FKJ3.js";
  41. import "./chunk-SZFMKPVM.js";
  42. import "./chunk-YZVAB3DF.js";
  43. import "./chunk-CRHRHOXH.js";
  44. import "./chunk-PT62335L.js";
  45. import "./chunk-TJV6ODRM.js";
  46. import {
  47. j as j4
  48. } from "./chunk-YLEVJ6UV.js";
  49. import "./chunk-U2WD23Z5.js";
  50. import {
  51. v
  52. } from "./chunk-JUWKPBLS.js";
  53. import {
  54. c
  55. } from "./chunk-WLSB4F4I.js";
  56. import "./chunk-GLSWDDR3.js";
  57. import {
  58. O
  59. } from "./chunk-MIQGEDET.js";
  60. import "./chunk-DUEMJ5XS.js";
  61. import "./chunk-VRLXUHP2.js";
  62. import "./chunk-3LVSQLWJ.js";
  63. import {
  64. y as y3
  65. } from "./chunk-4ONPMX2F.js";
  66. import "./chunk-CRGY2SDS.js";
  67. import "./chunk-4T5ZGMEN.js";
  68. import {
  69. n as n2
  70. } from "./chunk-XTVKPAWY.js";
  71. import "./chunk-3OSQ6GXO.js";
  72. import "./chunk-3WQOA5CB.js";
  73. import {
  74. t
  75. } from "./chunk-PLWDAYK7.js";
  76. import "./chunk-FZQZIM7U.js";
  77. import "./chunk-CZBRZ6SU.js";
  78. import "./chunk-VGWC3IKZ.js";
  79. import "./chunk-2H5MD622.js";
  80. import "./chunk-3RSFVUKZ.js";
  81. import "./chunk-UVVU4UUO.js";
  82. import "./chunk-X4SA4ELJ.js";
  83. import "./chunk-P3XKUGLS.js";
  84. import {
  85. j as j2
  86. } from "./chunk-2ZSOO377.js";
  87. import "./chunk-YUA3AHKR.js";
  88. import "./chunk-LU5IJZB4.js";
  89. import "./chunk-7IBV2TRE.js";
  90. import "./chunk-ZLNEXZAN.js";
  91. import "./chunk-5UVJ64RB.js";
  92. import "./chunk-SFEFRQCL.js";
  93. import {
  94. b
  95. } from "./chunk-DXVOOCG4.js";
  96. import "./chunk-3GZSQU56.js";
  97. import "./chunk-ZYRIJWLX.js";
  98. import "./chunk-RYY6632W.js";
  99. import "./chunk-DW42UVIT.js";
  100. import "./chunk-YAEIHDJH.js";
  101. import "./chunk-TJNOJH33.js";
  102. import "./chunk-OSHI574D.js";
  103. import "./chunk-ETGAZ7LF.js";
  104. import "./chunk-75U5LM2V.js";
  105. import "./chunk-RMDDCMKS.js";
  106. import "./chunk-VCH45Q2I.js";
  107. import "./chunk-YFSLJIO4.js";
  108. import "./chunk-IM3LVQXV.js";
  109. import "./chunk-55RWC67C.js";
  110. import "./chunk-HZRKBTHJ.js";
  111. import {
  112. U,
  113. a as a2
  114. } from "./chunk-DVUG3KID.js";
  115. import "./chunk-FWSQEIAR.js";
  116. import {
  117. Bt,
  118. C,
  119. Ct,
  120. F,
  121. G,
  122. H,
  123. I,
  124. K,
  125. Ot,
  126. ft,
  127. j as j3
  128. } from "./chunk-VEGAOVMY.js";
  129. import {
  130. o as o2,
  131. w2
  132. } from "./chunk-6T6G6LCQ.js";
  133. import "./chunk-YEJL5NEF.js";
  134. import {
  135. k2 as k,
  136. r
  137. } from "./chunk-PQFTYGF5.js";
  138. import {
  139. e,
  140. n5 as n,
  141. y3 as y2
  142. } from "./chunk-2Z2TG5CU.js";
  143. import "./chunk-6KZ2LTDA.js";
  144. import "./chunk-U2XHEJM7.js";
  145. import "./chunk-SQOPWYIT.js";
  146. import {
  147. f,
  148. j,
  149. w
  150. } from "./chunk-V6P2MAQQ.js";
  151. import {
  152. s,
  153. s2,
  154. s3
  155. } from "./chunk-E5O6P5I2.js";
  156. import {
  157. y
  158. } from "./chunk-SPWQ3AWG.js";
  159. import {
  160. a2 as a,
  161. o
  162. } from "./chunk-2TIUKVZN.js";
  163. import {
  164. e as e2
  165. } from "./chunk-YXWMMD76.js";
  166. import "./chunk-S5KM4IGW.js";
  167. // node_modules/@arcgis/core/layers/support/imageUtils.js
  168. var A = null;
  169. function o4(o6) {
  170. if (A)
  171. return A;
  172. const l4 = { lossy: "UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", lossless: "UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==", alpha: "UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==", animation: "UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA" };
  173. return A = new Promise((A2) => {
  174. const n7 = new Image();
  175. n7.onload = () => {
  176. n7.onload = n7.onerror = null, A2(n7.width > 0 && n7.height > 0);
  177. }, n7.onerror = () => {
  178. n7.onload = n7.onerror = null, A2(false);
  179. }, n7.src = "data:image/webp;base64," + l4[o6];
  180. }), A;
  181. }
  182. // node_modules/@arcgis/core/layers/support/SpriteSource.js
  183. var h = 1.15;
  184. var n4 = class {
  185. constructor(t2, e6) {
  186. this._spriteSource = t2, this._maxTextureSize = e6, this.devicePixelRatio = 1, this._spriteImageFormat = "png", this._isRetina = false, this._spritesData = {}, this.image = null, this.width = null, this.height = null, this.loadStatus = "not-loaded", "url" === t2.type && t2.spriteFormat && (this._spriteImageFormat = t2.spriteFormat), t2.pixelRatio && (this.devicePixelRatio = t2.pixelRatio), this.baseURL = t2.spriteUrl;
  187. }
  188. get spriteNames() {
  189. const t2 = [];
  190. for (const e6 in this._spritesData)
  191. t2.push(e6);
  192. return t2.sort(), t2;
  193. }
  194. getSpriteInfo(t2) {
  195. return this._spritesData ? this._spritesData[t2] : null;
  196. }
  197. async load(t2) {
  198. if (this.baseURL) {
  199. this.loadStatus = "loading";
  200. try {
  201. await this._loadSprites(t2), this.loadStatus = "loaded";
  202. } catch {
  203. this.loadStatus = "failed";
  204. }
  205. } else
  206. this.loadStatus = "failed";
  207. }
  208. async _loadSprites(t2) {
  209. this._isRetina = this.devicePixelRatio > h;
  210. const { width: s6, height: r4, data: a3, json: o6 } = await this._getSpriteData(this._spriteSource, t2), n7 = Object.keys(o6);
  211. if (!n7 || 0 === n7.length || !a3)
  212. return this._spritesData = this.image = null, void (this.width = this.height = 0);
  213. this._spritesData = o6, this.width = s6, this.height = r4;
  214. const d3 = Math.max(this._maxTextureSize, 4096);
  215. if (s6 > d3 || r4 > d3) {
  216. const t3 = `Sprite resource for style ${this.baseURL} is bigger than the maximum allowed of ${d3} pixels}`;
  217. throw s2.getLogger("esri.layers.support.SpriteSource").error(t3), new s3("SpriteSource", t3);
  218. }
  219. let p2;
  220. for (let e6 = 0; e6 < a3.length; e6 += 4)
  221. p2 = a3[e6 + 3] / 255, a3[e6] = a3[e6] * p2, a3[e6 + 1] = a3[e6 + 1] * p2, a3[e6 + 2] = a3[e6 + 2] * p2;
  222. this.image = a3;
  223. }
  224. async _getSpriteData(i2, n7) {
  225. if ("image" === i2.type) {
  226. let t2, a3;
  227. if (this.devicePixelRatio < h) {
  228. if (!i2.spriteSource1x)
  229. throw new s3("SpriteSource", "no image data provided for low resolution sprites!");
  230. t2 = i2.spriteSource1x.image, a3 = i2.spriteSource1x.json;
  231. } else {
  232. if (!i2.spriteSource2x)
  233. throw new s3("SpriteSource", "no image data provided for high resolution sprites!");
  234. t2 = i2.spriteSource2x.image, a3 = i2.spriteSource2x.json;
  235. }
  236. return "width" in t2 && "height" in t2 && "data" in t2 && (o(t2.data) || a(t2.data)) ? { width: t2.width, height: t2.height, data: new Uint8Array(t2.data), json: a3 } : { ...d(t2), json: a3 };
  237. }
  238. const p2 = j3(this.baseURL), l4 = p2.query ? "?" + I(p2.query) : "", g2 = this._isRetina ? "@2x" : "", u = `${p2.path}${g2}.${this._spriteImageFormat}${l4}`, c2 = `${p2.path}${g2}.json${l4}`, [m2, S2] = await Promise.all([U(c2, n7), U(u, { responseType: "image", ...n7 })]);
  239. return { ...d(S2.data), json: m2.data };
  240. }
  241. };
  242. function d(t2) {
  243. const e6 = document.createElement("canvas"), i2 = e6.getContext("2d");
  244. e6.width = t2.width, e6.height = t2.height, i2.drawImage(t2, 0, 0, t2.width, t2.height);
  245. const s6 = i2.getImageData(0, 0, t2.width, t2.height);
  246. return { width: t2.width, height: t2.height, data: new Uint8Array(s6.data) };
  247. }
  248. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/TilemapIndex.js
  249. var l3 = class {
  250. constructor(e6) {
  251. this.url = e6;
  252. }
  253. async fetchTileIndex() {
  254. return this._tileIndexPromise || (this._tileIndexPromise = U(this.url).then((e6) => e6.data.index)), this._tileIndexPromise;
  255. }
  256. async dataKey(e6, r4) {
  257. const l4 = await this.fetchTileIndex();
  258. return f(r4), this._getIndexedDataKey(l4, e6);
  259. }
  260. _getIndexedDataKey(e6, t2) {
  261. const l4 = [t2];
  262. if (t2.level < 0 || t2.row < 0 || t2.col < 0 || t2.row >> t2.level > 0 || t2.col >> t2.level > 0)
  263. return null;
  264. let i2 = t2;
  265. for (; 0 !== i2.level; )
  266. i2 = new e3(i2.level - 1, i2.row >> 1, i2.col >> 1, i2.world), l4.push(i2);
  267. let o6, s6, n7 = e6, a3 = l4.pop();
  268. if (1 === n7)
  269. return a3;
  270. for (; l4.length; )
  271. if (o6 = l4.pop(), s6 = (1 & o6.col) + ((1 & o6.row) << 1), n7) {
  272. if (0 === n7[s6]) {
  273. a3 = null;
  274. break;
  275. }
  276. if (1 === n7[s6]) {
  277. a3 = o6;
  278. break;
  279. }
  280. a3 = o6, n7 = n7[s6];
  281. }
  282. return a3;
  283. }
  284. };
  285. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/TilemapRequest.js
  286. var r2 = class {
  287. constructor(e6, t2) {
  288. this._tilemap = e6, this._tileIndexUrl = t2;
  289. }
  290. async fetchTileIndex(t2) {
  291. return this._tileIndexPromise || (this._tileIndexPromise = U(this._tileIndexUrl, { query: { ...t2 == null ? void 0 : t2.query } }).then((e6) => e6.data.index)), this._tileIndexPromise;
  292. }
  293. dataKey(e6, r4) {
  294. const { level: l4, row: s6, col: o6 } = e6, n7 = new e3(e6);
  295. return this._tilemap.fetchAvailabilityUpsample(l4, s6, o6, n7, r4).then(() => (n7.world = e6.world, n7)).catch((e7) => {
  296. if (j(e7))
  297. throw e7;
  298. return null;
  299. });
  300. }
  301. };
  302. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/style/VectorTilesRequestManager.js
  303. var r3 = /* @__PURE__ */ new Map();
  304. function n5(e6, t2, r4, n7, c2) {
  305. return o5(e6.replace(/\{z\}/gi, t2.toString()).replace(/\{y\}/gi, r4.toString()).replace(/\{x\}/gi, n7.toString()), c2);
  306. }
  307. function o5(n7, o6) {
  308. const c2 = r3.get(n7);
  309. if (c2)
  310. return c2.then((e6) => y(e6));
  311. const i2 = U(n7, { responseType: "array-buffer", ...o6 }).then(({ data: e6 }) => (r3.delete(n7), e6)).catch((e6) => {
  312. throw r3.delete(n7), e6;
  313. });
  314. return r3.set(n7, i2), i2;
  315. }
  316. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/style/VectorTileSource.js
  317. var h2 = class {
  318. constructor(u, h4, m2) {
  319. this.tilemap = null, this.tileInfo = null, this.capabilities = null, this.fullExtent = null, this.name = u, this.sourceUrl = h4;
  320. const f2 = j3(this.sourceUrl), c2 = y(m2), x2 = c2.tiles;
  321. if (f2)
  322. for (let t2 = 0; t2 < x2.length; t2++) {
  323. const s6 = j3(x2[t2]);
  324. s6 && (K(s6.path) || (s6.path = G(f2.path, s6.path)), x2[t2] = Bt(s6.path, { ...f2.query, ...s6.query }));
  325. }
  326. this.tileServers = x2;
  327. const d3 = m2.capabilities && m2.capabilities.split(",").map((t2) => t2.toLowerCase().trim()), y5 = true === (m2 == null ? void 0 : m2.exportTilesAllowed), T = true === (d3 == null ? void 0 : d3.includes("tilemap")), g2 = y5 && m2.hasOwnProperty("maxExportTilesCount") ? m2.maxExportTilesCount : 0;
  328. this.capabilities = { operations: { supportsExportTiles: y5, supportsTileMap: T }, exportTiles: y5 ? { maxExportTilesCount: +g2 } : null }, this.tileInfo = n3(c2.tileInfo, c2, null, { ignoreMinMaxLOD: true });
  329. const M = m2.tileMap ? Bt(G(f2.path, m2.tileMap), f2.query) : null;
  330. T ? (this.type = "vector-tile", this.tilemap = new r2(new z({ layer: { parsedUrl: f2, tileInfo: this.tileInfo, type: "vector-tile", tileServers: this.tileServers } }), M)) : M && (this.tilemap = new l3(M)), this.fullExtent = w2.fromJSON(m2.fullExtent);
  331. }
  332. destroy() {
  333. }
  334. async getRefKey(t2, e6) {
  335. var _a, _b;
  336. return (_b = (_a = this.tilemap) == null ? void 0 : _a.dataKey(t2, e6)) != null ? _b : t2;
  337. }
  338. requestTile(t2, e6, i2, r4) {
  339. const l4 = this.tileServers[e6 % this.tileServers.length];
  340. return n5(l4, t2, e6, i2, r4);
  341. }
  342. isCompatibleWith(t2) {
  343. const e6 = this.tileInfo, i2 = t2.tileInfo;
  344. if (!e6.spatialReference.equals(i2.spatialReference))
  345. return false;
  346. if (!e6.origin.equals(i2.origin))
  347. return false;
  348. if (Math.round(e6.dpi) !== Math.round(i2.dpi))
  349. return false;
  350. const r4 = e6.lods, l4 = i2.lods, s6 = Math.min(r4.length, l4.length);
  351. for (let o6 = 0; o6 < s6; o6++) {
  352. const t3 = r4[o6], e7 = l4[o6];
  353. if (t3.level !== e7.level || Math.round(t3.scale) !== Math.round(e7.scale))
  354. return false;
  355. }
  356. return true;
  357. }
  358. };
  359. // node_modules/@arcgis/core/layers/support/vectorTileLayerLoader.js
  360. var y4 = s.defaults && s.defaults.io.corsEnabledServers;
  361. async function m(e6, r4) {
  362. const t2 = { source: null, sourceBase: null, sourceUrl: null, validatedSource: null, style: null, styleBase: null, styleUrl: null, sourceNameToSource: {}, primarySourceName: "", spriteFormat: "png" }, [s6, o6] = "string" == typeof e6 ? [e6, null] : [null, e6.jsonUrl];
  363. await S(t2, "esri", e6, o6, r4);
  364. const l4 = { layerDefinition: t2.validatedSource, url: s6, serviceUrl: t2.sourceUrl, style: t2.style, styleUrl: t2.styleUrl, spriteUrl: t2.style.sprite && h3(t2.styleBase, t2.style.sprite), spriteFormat: t2.spriteFormat, glyphsUrl: t2.style.glyphs && h3(t2.styleBase, t2.style.glyphs), sourceNameToSource: t2.sourceNameToSource, primarySourceName: t2.primarySourceName };
  365. return d2(l4.spriteUrl), d2(l4.glyphsUrl), l4;
  366. }
  367. function d2(e6) {
  368. if (!e6)
  369. return;
  370. const r4 = H(e6);
  371. y4 && !y4.includes(r4) && y4.push(r4);
  372. }
  373. function h3(...e6) {
  374. let r4;
  375. for (let t2 = 0; t2 < e6.length; ++t2)
  376. if (ft(e6[t2])) {
  377. if (r4) {
  378. const s6 = r4.split("://")[0];
  379. r4 = s6 + ":" + e6[t2].trim();
  380. }
  381. } else
  382. r4 = K(e6[t2]) ? e6[t2] : G(r4, e6[t2]);
  383. return Ct(r4);
  384. }
  385. async function S(e6, s6, o6, l4, n7) {
  386. let i2, c2, a3;
  387. if (f(n7), "string" == typeof o6) {
  388. const e7 = F(o6);
  389. d2(e7), a3 = await U(e7, { ...n7, responseType: "json", query: { f: "json", ...n7 == null ? void 0 : n7.query } }), a3.ssl && (i2 && (i2 = i2.replace(/^http:/i, "https:")), c2 && (c2 = c2.replace(/^http:/i, "https:"))), i2 = e7, c2 = e7;
  390. } else
  391. a3 = { data: o6 }, i2 = o6.jsonUrl || null, c2 = l4;
  392. const f2 = a3.data;
  393. if (U2(f2))
  394. return e6.styleUrl = i2 || null, x(e6, f2, c2, n7);
  395. if (w3(f2))
  396. return e6.sourceUrl ? g(e6, f2, c2, false, s6, n7) : (e6.sourceUrl = i2 || null, g(e6, f2, c2, true, s6, n7));
  397. throw new Error("You must specify the URL or the JSON for a service or for a style.");
  398. }
  399. function U2(e6) {
  400. return !!e6.sources;
  401. }
  402. function w3(e6) {
  403. return !U2(e6);
  404. }
  405. async function x(e6, r4, t2, s6) {
  406. const o6 = t2 ? Ot(t2) : C();
  407. e6.styleBase = o6, e6.style = r4, e6.styleUrl && d2(e6.styleUrl), r4["sprite-format"] && "webp" === r4["sprite-format"].toLowerCase() && (e6.spriteFormat = "webp");
  408. const l4 = [];
  409. if (r4.sources && r4.sources.esri) {
  410. const t3 = r4.sources.esri;
  411. t3.url ? await S(e6, "esri", h3(o6, t3.url), void 0, s6) : l4.push(S(e6, "esri", t3, o6, s6));
  412. }
  413. for (const n7 of Object.keys(r4.sources))
  414. "esri" !== n7 && "vector" === r4.sources[n7].type && (r4.sources[n7].url ? l4.push(S(e6, n7, h3(o6, r4.sources[n7].url), void 0, s6)) : r4.sources[n7].tiles && l4.push(S(e6, n7, r4.sources[n7], o6, s6)));
  415. await Promise.all(l4);
  416. }
  417. async function g(e6, r4, t2, s6, o6, l4) {
  418. const n7 = t2 ? Ct(t2) + "/" : C(), u = v2(r4, n7), c2 = new h2(o6, Bt(n7, l4 == null ? void 0 : l4.query), u);
  419. if (!s6 && e6.primarySourceName in e6.sourceNameToSource) {
  420. const r5 = e6.sourceNameToSource[e6.primarySourceName];
  421. if (!r5.isCompatibleWith(c2))
  422. return;
  423. null != c2.fullExtent && (null != r5.fullExtent ? r5.fullExtent.union(c2.fullExtent) : r5.fullExtent = c2.fullExtent.clone()), r5.tileInfo.lods.length < c2.tileInfo.lods.length && (r5.tileInfo = c2.tileInfo);
  424. }
  425. if (s6 ? (e6.sourceBase = n7, e6.source = r4, e6.validatedSource = u, e6.primarySourceName = o6, e6.sourceUrl && d2(e6.sourceUrl)) : d2(n7), e6.sourceNameToSource[o6] = c2, !e6.style) {
  426. if (null == r4.defaultStyles)
  427. throw new Error();
  428. return "string" == typeof r4.defaultStyles ? S(e6, "", h3(n7, r4.defaultStyles, "root.json"), void 0, l4) : S(e6, "", r4.defaultStyles, h3(n7, "root.json"), l4);
  429. }
  430. }
  431. function v2(e6, r4) {
  432. if (e6.hasOwnProperty("tileInfo"))
  433. return e6;
  434. const t2 = { xmin: -20037507067161843e-9, ymin: -20037507067161843e-9, xmax: 20037507067161843e-9, ymax: 20037507067161843e-9, spatialReference: { wkid: 102100 } }, s6 = 512;
  435. let o6 = 78271.51696400007, l4 = 2958287637957775e-7;
  436. const n7 = [], i2 = e6.hasOwnProperty("minzoom") ? +e6.minzoom : 0, u = e6.hasOwnProperty("maxzoom") ? +e6.maxzoom : 22;
  437. for (let c2 = 0; c2 <= u; c2++)
  438. c2 >= i2 && n7.push({ level: c2, scale: l4, resolution: o6 }), o6 /= 2, l4 /= 2;
  439. for (const c2 of e6.tiles)
  440. d2(h3(r4, c2));
  441. return { capabilities: "TilesOnly", initialExtent: t2, fullExtent: t2, minScale: 0, maxScale: 0, tiles: e6.tiles, tileInfo: { rows: s6, cols: s6, dpi: 96, format: "pbf", origin: { x: -20037508342787e-6, y: 20037508342787e-6 }, lods: n7, spatialReference: { wkid: 102100 } } };
  442. }
  443. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/tileInfoUtils.js
  444. var e5 = 1e-6;
  445. function n6(l4, n7) {
  446. if (l4 === n7)
  447. return true;
  448. if (null == l4 && null != n7)
  449. return false;
  450. if (null != l4 && null == n7)
  451. return false;
  452. if (null == l4 || null == n7)
  453. return false;
  454. if (!l4.spatialReference.equals(n7.spatialReference) || l4.dpi !== n7.dpi)
  455. return false;
  456. const s6 = l4.origin, r4 = n7.origin;
  457. if (Math.abs(s6.x - r4.x) >= e5 || Math.abs(s6.y - r4.y) >= e5)
  458. return false;
  459. let o6, t2;
  460. l4.lods[0].scale > n7.lods[0].scale ? (o6 = l4, t2 = n7) : (t2 = l4, o6 = n7);
  461. for (let i2 = o6.lods[0].scale; i2 >= t2.lods[t2.lods.length - 1].scale - e5; i2 /= 2)
  462. if (Math.abs(i2 - t2.lods[0].scale) < e5)
  463. return true;
  464. return false;
  465. }
  466. function s5(e6, n7) {
  467. if (e6 === n7)
  468. return e6;
  469. if (null == e6 && null != n7)
  470. return n7;
  471. if (null != e6 && null == n7)
  472. return e6;
  473. if (null == e6 || null == n7)
  474. return null;
  475. const s6 = e6.size[0], r4 = e6.format, o6 = e6.dpi, t2 = { x: e6.origin.x, y: e6.origin.y }, i2 = e6.spatialReference.toJSON(), u = e6.lods[0].scale > n7.lods[0].scale ? e6.lods[0] : n7.lods[0], a3 = e6.lods[e6.lods.length - 1].scale <= n7.lods[n7.lods.length - 1].scale ? e6.lods[e6.lods.length - 1] : n7.lods[n7.lods.length - 1], f2 = u.scale, d3 = u.resolution, c2 = a3.scale, p2 = [];
  476. let g2 = f2, h4 = d3, x2 = 0;
  477. for (; g2 > c2; )
  478. p2.push({ level: x2, resolution: h4, scale: g2 }), x2++, g2 /= 2, h4 /= 2;
  479. return new j4({ size: [s6, s6], dpi: o6, format: r4 || "pbf", origin: t2, lods: p2, spatialReference: i2 });
  480. }
  481. // node_modules/@arcgis/core/layers/VectorTileLayer.js
  482. var B = class extends n2(t(s4(p(c(v(o3(i(O(b))))))))) {
  483. constructor(...e6) {
  484. super(...e6), this._spriteSourceMap = /* @__PURE__ */ new Map(), this.currentStyleInfo = null, this.style = null, this.isReference = null, this.operationalLayerType = "VectorTileLayer", this.type = "vector-tile", this.url = null, this.showCollisionBoxes = "none", this.path = null;
  485. }
  486. normalizeCtorArgs(e6, t2) {
  487. return "string" == typeof e6 ? { url: e6, ...t2 } : e6;
  488. }
  489. destroy() {
  490. if (this.sourceNameToSource)
  491. for (const e6 of Object.values(this.sourceNameToSource))
  492. e6 == null ? void 0 : e6.destroy();
  493. this._spriteSourceMap.clear();
  494. }
  495. async prefetchResources(e6) {
  496. await this.loadSpriteSource(globalThis.devicePixelRatio || 1, e6);
  497. }
  498. load(e6) {
  499. const r4 = this.loadFromPortal({ supportedTypes: ["Vector Tile Service"], supportsData: false }, e6).catch(w).then(async () => {
  500. if (!this.portalItem || !this.portalItem.id)
  501. return;
  502. const r5 = `${this.portalItem.itemUrl}/resources/styles/root.json`;
  503. (await U(r5, { ...e6, query: { f: "json", ...this.customParameters, token: this.apiKey } })).data && this.read({ url: r5 }, e4(this.portalItem));
  504. }).catch(w).then(() => this._loadStyle(e6));
  505. return this.addResolvingPromise(r4), Promise.resolve(this);
  506. }
  507. get attributionDataUrl() {
  508. const e6 = this.currentStyleInfo, t2 = e6 && e6.serviceUrl && j3(e6.serviceUrl);
  509. if (!t2)
  510. return null;
  511. const r4 = this._getDefaultAttribution(t2.path);
  512. return r4 ? Bt(r4, { ...this.customParameters, token: this.apiKey }) : null;
  513. }
  514. get capabilities() {
  515. const e6 = this.primarySource;
  516. return e6 ? e6.capabilities : { operations: { supportsExportTiles: false, supportsTileMap: false }, exportTiles: null };
  517. }
  518. get fullExtent() {
  519. var _a;
  520. return ((_a = this.primarySource) == null ? void 0 : _a.fullExtent) || null;
  521. }
  522. get parsedUrl() {
  523. return this.serviceUrl ? j3(this.serviceUrl) : null;
  524. }
  525. get serviceUrl() {
  526. return this.currentStyleInfo && this.currentStyleInfo.serviceUrl || null;
  527. }
  528. get spatialReference() {
  529. return this.tileInfo && this.tileInfo.spatialReference || null;
  530. }
  531. get styleUrl() {
  532. return this.currentStyleInfo && this.currentStyleInfo.styleUrl || null;
  533. }
  534. writeStyleUrl(e6, t2) {
  535. e6 && ft(e6) && (e6 = `https:${e6}`);
  536. const r4 = e2(a2(e6));
  537. t2.styleUrl = y3(e6, r4);
  538. }
  539. get tileInfo() {
  540. var _a;
  541. const e6 = [];
  542. for (const r4 in this.sourceNameToSource)
  543. e6.push(this.sourceNameToSource[r4]);
  544. let t2 = ((_a = this.primarySource) == null ? void 0 : _a.tileInfo) || new j4();
  545. if (e6.length > 1)
  546. for (let r4 = 0; r4 < e6.length; r4++)
  547. n6(t2, e6[r4].tileInfo) && (t2 = s5(t2, e6[r4].tileInfo));
  548. return t2;
  549. }
  550. readVersion(e6, t2) {
  551. return t2.version ? parseFloat(t2.version) : parseFloat(t2.currentVersion);
  552. }
  553. async loadSpriteSource(e6 = 1, t2) {
  554. var _a, _b;
  555. if (!this._spriteSourceMap.has(e6)) {
  556. const r4 = l2("2d").maxTextureSize, o6 = ((_a = this.currentStyleInfo) == null ? void 0 : _a.spriteUrl) ? Bt(this.currentStyleInfo.spriteUrl, { ...this.customParameters, token: this.apiKey }) : null, s6 = new n4({ type: "url", spriteUrl: o6, pixelRatio: e6, spriteFormat: (_b = this.currentStyleInfo) == null ? void 0 : _b.spriteFormat }, r4);
  557. await s6.load(t2), this._spriteSourceMap.set(e6, s6);
  558. }
  559. return this._spriteSourceMap.get(e6);
  560. }
  561. async setSpriteSource(e6, t2) {
  562. if (!e6)
  563. return null;
  564. const r4 = l2("2d").maxTextureSize, o6 = e6.spriteUrl, s6 = o6 ? Bt(o6, { ...this.customParameters, token: this.apiKey }) : null;
  565. if (!s6 && "url" === e6.type)
  566. return null;
  567. const i2 = new n4(e6, r4);
  568. try {
  569. await i2.load(t2);
  570. const r5 = e6.pixelRatio || 1;
  571. return this._spriteSourceMap.clear(), this._spriteSourceMap.set(r5, i2), s6 && this.currentStyleInfo && (this.currentStyleInfo.spriteUrl = s6), this.emit("spriteSource-change", { spriteSource: i2 }), i2;
  572. } catch (l4) {
  573. w(l4);
  574. }
  575. return null;
  576. }
  577. async loadStyle(e6, t2) {
  578. var _a;
  579. const o6 = e6 || this.style || this.url;
  580. return this._loadingTask && "string" == typeof o6 && this.url === o6 || ((_a = this._loadingTask) == null ? void 0 : _a.abort(), this._loadingTask = j2((e7) => (this._spriteSourceMap.clear(), this._getSourceAndStyle(o6, { signal: e7 })), t2)), this._loadingTask.promise;
  581. }
  582. getStyleLayerId(e6) {
  583. return this.styleRepository.getStyleLayerId(e6);
  584. }
  585. getStyleLayerIndex(e6) {
  586. return this.styleRepository.getStyleLayerIndex(e6);
  587. }
  588. getPaintProperties(e6) {
  589. return y(this.styleRepository.getPaintProperties(e6));
  590. }
  591. setPaintProperties(e6, t2) {
  592. const r4 = this.styleRepository.isPainterDataDriven(e6);
  593. this.styleRepository.setPaintProperties(e6, t2);
  594. const o6 = this.styleRepository.isPainterDataDriven(e6);
  595. this.emit("paint-change", { layer: e6, paint: t2, isDataDriven: r4 || o6 });
  596. }
  597. getStyleLayer(e6) {
  598. return y(this.styleRepository.getStyleLayer(e6));
  599. }
  600. setStyleLayer(e6, t2) {
  601. this.styleRepository.setStyleLayer(e6, t2), this.emit("style-layer-change", { layer: e6, index: t2 });
  602. }
  603. deleteStyleLayer(e6) {
  604. this.styleRepository.deleteStyleLayer(e6), this.emit("delete-style-layer", { layer: e6 });
  605. }
  606. getLayoutProperties(e6) {
  607. return y(this.styleRepository.getLayoutProperties(e6));
  608. }
  609. setLayoutProperties(e6, t2) {
  610. this.styleRepository.setLayoutProperties(e6, t2), this.emit("layout-change", { layer: e6, layout: t2 });
  611. }
  612. setStyleLayerVisibility(e6, t2) {
  613. this.styleRepository.setStyleLayerVisibility(e6, t2), this.emit("style-layer-visibility-change", { layer: e6, visibility: t2 });
  614. }
  615. getStyleLayerVisibility(e6) {
  616. return this.styleRepository.getStyleLayerVisibility(e6);
  617. }
  618. write(e6, t2) {
  619. return (t2 == null ? void 0 : t2.origin) && !this.styleUrl ? (t2.messages && t2.messages.push(new s3("vectortilelayer:unsupported", `VectorTileLayer (${this.title}, ${this.id}) with style defined by JSON only are not supported`, { layer: this })), null) : super.write(e6, t2);
  620. }
  621. getTileUrl(e6, t2, r4) {
  622. return null;
  623. }
  624. async _getSourceAndStyle(e6, t2) {
  625. if (!e6)
  626. throw new Error("invalid style!");
  627. const r4 = await m(e6, { ...t2, query: { ...this.customParameters, token: this.apiKey } });
  628. if ("webp" === r4.spriteFormat) {
  629. await o4("lossy") || (r4.spriteFormat = "png");
  630. }
  631. this._set("currentStyleInfo", { ...r4 }), "string" == typeof e6 ? (this.url = e6, this.style = null) : (this.url = null, this.style = e6), this._set("sourceNameToSource", r4.sourceNameToSource), this._set("primarySource", r4.sourceNameToSource[r4.primarySourceName]), this._set("styleRepository", new l(r4.style)), this.read(r4.layerDefinition, { origin: "service" }), this.emit("load-style");
  632. }
  633. _getDefaultAttribution(e6) {
  634. const t2 = e6.match(/^https?:\/\/(?:basemaps|basemapsbeta|basemapsdev)(?:-api)?\.arcgis\.com(\/[^\/]+)?\/arcgis\/rest\/services\/([^\/]+(\/[^\/]+)*)\/vectortileserver/i), r4 = ["OpenStreetMap_v2", "OpenStreetMap_Daylight_v2", "OpenStreetMap_Export_v2", "OpenStreetMap_FTS_v2", "OpenStreetMap_GCS_v2", "World_Basemap", "World_Basemap_v2", "World_Basemap_Export_v2", "World_Basemap_GCS_v2", "World_Basemap_WGS84", "World_Contours_v2"];
  635. if (!t2)
  636. return;
  637. const o6 = t2[2] && t2[2].toLowerCase();
  638. if (!o6)
  639. return;
  640. const s6 = t2[1] || "";
  641. for (const i2 of r4)
  642. if (i2.toLowerCase().includes(o6))
  643. return F(`//static.arcgis.com/attribution/Vector${s6}/${i2}`);
  644. }
  645. async _loadStyle(e6) {
  646. var _a, _b;
  647. return (_b = (_a = this._loadingTask) == null ? void 0 : _a.promise) != null ? _b : this.loadStyle(null, e6);
  648. }
  649. };
  650. e([y2({ readOnly: true })], B.prototype, "attributionDataUrl", null), e([y2({ type: ["show", "hide"] })], B.prototype, "listMode", void 0), e([y2({ json: { read: true, write: true } })], B.prototype, "blendMode", void 0), e([y2({ readOnly: true, json: { read: false } })], B.prototype, "capabilities", null), e([y2({ readOnly: true })], B.prototype, "currentStyleInfo", void 0), e([y2({ json: { read: false }, readOnly: true, type: w2 })], B.prototype, "fullExtent", null), e([y2()], B.prototype, "style", void 0), e([y2({ type: Boolean, json: { read: false, write: { enabled: true, overridePolicy: () => ({ enabled: false }) } } })], B.prototype, "isReference", void 0), e([y2({ type: ["VectorTileLayer"] })], B.prototype, "operationalLayerType", void 0), e([y2({ readOnly: true })], B.prototype, "parsedUrl", null), e([y2({ readOnly: true })], B.prototype, "serviceUrl", null), e([y2({ type: k, readOnly: true })], B.prototype, "spatialReference", null), e([y2({ readOnly: true })], B.prototype, "styleRepository", void 0), e([y2({ readOnly: true })], B.prototype, "sourceNameToSource", void 0), e([y2({ readOnly: true })], B.prototype, "primarySource", void 0), e([y2({ type: String, readOnly: true, json: { write: { ignoreOrigin: true }, origins: { "web-document": { write: { ignoreOrigin: true, isRequired: true } } } } })], B.prototype, "styleUrl", null), e([r(["portal-item", "web-document"], "styleUrl")], B.prototype, "writeStyleUrl", null), e([y2({ json: { read: false, origins: { service: { read: false } } }, readOnly: true, type: j4 })], B.prototype, "tileInfo", null), e([y2({ json: { read: false }, readOnly: true, value: "vector-tile" })], B.prototype, "type", void 0), e([y2({ json: { origins: { "web-document": { read: { source: "styleUrl" } }, "portal-item": { read: { source: "url" } } }, write: false, read: false } })], B.prototype, "url", void 0), e([y2({ readOnly: true })], B.prototype, "version", void 0), e([o2("version", ["version", "currentVersion"])], B.prototype, "readVersion", null), e([y2({ type: String })], B.prototype, "showCollisionBoxes", void 0), e([y2({ type: String, json: { origins: { "web-scene": { read: true, write: true } }, read: false } })], B.prototype, "path", void 0), B = e([n("esri.layers.VectorTileLayer")], B);
  651. var E = B;
  652. export {
  653. E as default
  654. };
  655. //# sourceMappingURL=VectorTileLayer-LHJ7JQ2Z.js.map