chunk-HKJ7X3BD.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import {
  2. j
  3. } from "./chunk-LU5IJZB4.js";
  4. import {
  5. d
  6. } from "./chunk-SFEFRQCL.js";
  7. import {
  8. U
  9. } from "./chunk-DVUG3KID.js";
  10. import {
  11. F,
  12. Ot
  13. } from "./chunk-VEGAOVMY.js";
  14. import {
  15. w
  16. } from "./chunk-V6P2MAQQ.js";
  17. import {
  18. s3 as s
  19. } from "./chunk-E5O6P5I2.js";
  20. import {
  21. has
  22. } from "./chunk-SPWQ3AWG.js";
  23. import {
  24. r
  25. } from "./chunk-YXWMMD76.js";
  26. // node_modules/@arcgis/core/support/featureFlags.js
  27. var e = () => !!has("enable-feature:force-wosr");
  28. var t = () => !!has("enable-feature:SceneLayer-editing");
  29. // node_modules/@arcgis/core/symbols/support/styleUtils.js
  30. var u = {};
  31. async function f(e2, r2) {
  32. try {
  33. return { data: (await b(e2, r2)).data, baseUrl: Ot(e2), styleUrl: e2 };
  34. } catch (t2) {
  35. return w(t2), null;
  36. }
  37. }
  38. function i(e2, r2, o) {
  39. const s2 = r(r2.portal) ? r2.portal : j.getDefault();
  40. let n;
  41. const a = `${s2.url} - ${s2.user && s2.user.username} - ${e2}`;
  42. return u[a] || (u[a] = y(e2, s2, o).then((e3) => (n = e3, e3.fetchData())).then((r3) => {
  43. var _a;
  44. return { data: r3, baseUrl: (_a = n.itemUrl) != null ? _a : "", styleName: e2 };
  45. })), u[a];
  46. }
  47. function y(e2, t2, o) {
  48. return t2.load(o).then(() => {
  49. const r2 = new d({ disableExtraQuery: true, query: `owner:${j2} AND type:${h} AND typekeywords:"${e2}"` });
  50. return t2.queryItems(r2, o);
  51. }).then(({ results: t3 }) => {
  52. var _a;
  53. let s2 = null;
  54. const n = e2.toLowerCase();
  55. if (t3 && Array.isArray(t3))
  56. for (const e3 of t3) {
  57. const r2 = (_a = e3.typeKeywords) == null ? void 0 : _a.some((e4) => e4.toLowerCase() === n);
  58. if (r2 && e3.type === h && e3.owner === j2) {
  59. s2 = e3;
  60. break;
  61. }
  62. }
  63. if (!s2)
  64. throw new s("symbolstyleutils:style-not-found", `The style '${e2}' could not be found`, { styleName: e2 });
  65. return s2.load(o);
  66. });
  67. }
  68. function c(e2, o, s2) {
  69. return e2 && r(e2.styleUrl) ? f(e2.styleUrl, s2) : e2 && r(e2.styleName) ? i(e2.styleName, o, s2) : Promise.reject(new s("symbolstyleutils:style-url-and-name-missing", "Either styleUrl or styleName is required to resolve a style"));
  70. }
  71. function p(e2) {
  72. return null === e2 || "CIMSymbolReference" === e2.type ? e2 : { type: "CIMSymbolReference", symbol: e2 };
  73. }
  74. function d2(e2, r2) {
  75. if ("cimRef" === r2)
  76. return e2.cimRef;
  77. if (e2.formatInfos && !e()) {
  78. for (const t2 of e2.formatInfos)
  79. if ("gltf" === t2.type)
  80. return t2.href;
  81. }
  82. return e2.webRef;
  83. }
  84. function b(r2, t2) {
  85. const o = { responseType: "json", query: { f: "json" }, ...t2 };
  86. return U(F(r2), o);
  87. }
  88. var j2 = "esri_en";
  89. var h = "Style";
  90. var w2 = "https://cdn.arcgis.com/sharing/rest/content/items/220936cc6ed342c9937abd8f180e7d1e/resources/styles/cim/{SymbolName}.json?f=json";
  91. export {
  92. t,
  93. c,
  94. p,
  95. d2 as d,
  96. b,
  97. w2 as w
  98. };
  99. //# sourceMappingURL=chunk-HKJ7X3BD.js.map