@arcgis/coding-components 4.31.0-next.4 → 4.31.0-next.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/README.md +22 -3
  2. package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
  3. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ar.json +1 -1
  4. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.bg.json +1 -1
  5. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.bs.json +1 -1
  6. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ca.json +6 -6
  7. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.cs.json +1 -1
  8. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.da.json +1 -1
  9. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.de.json +1 -1
  10. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.el.json +1 -1
  11. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.es.json +1 -1
  12. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.et.json +1 -1
  13. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.fi.json +1 -1
  14. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.fr.json +1 -1
  15. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.he.json +1 -1
  16. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.hr.json +1 -1
  17. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.id.json +1 -1
  18. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.it.json +1 -1
  19. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ko.json +1 -1
  20. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.nb.json +1 -1
  21. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.nl.json +1 -1
  22. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pl.json +1 -1
  23. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pt-BR.json +1 -1
  24. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pt-PT.json +1 -1
  25. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ru.json +1 -1
  26. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sk.json +1 -1
  27. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sl.json +1 -1
  28. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sr.json +1 -1
  29. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sv.json +1 -1
  30. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.th.json +1 -1
  31. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.tr.json +1 -1
  32. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.uk.json +5 -5
  33. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.vi.json +1 -1
  34. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-CN.json +1 -1
  35. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-HK.json +1 -1
  36. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-TW.json +1 -1
  37. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ca.json +2 -2
  38. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.de.json +1 -1
  39. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.he.json +1 -1
  40. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ca.json +1 -1
  41. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.it.json +1 -1
  42. package/dist/arcgis-coding-components/assets/code-editor/sql-expr.worker.js +446 -7
  43. package/dist/arcgis-coding-components/assets/language-api-panel/t9n/language-api-panel.t9n.ca.json +1 -1
  44. package/dist/arcgis-coding-components/index.esm.js +2 -2
  45. package/dist/arcgis-coding-components/{p-b23a3f4e.entry.js → p-1da63080.entry.js} +2 -2
  46. package/dist/arcgis-coding-components/p-1e1caadf.js +7 -0
  47. package/dist/arcgis-coding-components/{p-736d890c.js → p-4cc71357.js} +3 -3
  48. package/dist/arcgis-coding-components/p-51b2fc72.js +6 -0
  49. package/dist/arcgis-coding-components/{p-4e56f8ae.js → p-5c89b15d.js} +1 -1
  50. package/dist/arcgis-coding-components/{p-5e173b51.entry.js → p-5f567b03.entry.js} +2 -2
  51. package/dist/arcgis-coding-components/{p-a256ee9c.js → p-64bbd36c.js} +12 -12
  52. package/dist/arcgis-coding-components/{p-8d67b196.js → p-71191013.js} +3 -3
  53. package/dist/arcgis-coding-components/{p-86625411.js → p-83b29033.js} +2 -2
  54. package/dist/arcgis-coding-components/p-909bbd87.entry.js +6 -0
  55. package/dist/arcgis-coding-components/p-9413c464.js +6 -0
  56. package/dist/arcgis-coding-components/p-9bb6dd26.js +6 -0
  57. package/dist/arcgis-coding-components/{p-ab0f6db7.js → p-ba1ec66d.js} +3 -3
  58. package/dist/arcgis-coding-components/p-bb851fa6.js +6 -0
  59. package/dist/arcgis-coding-components/{p-b570d7af.js → p-bd267380.js} +2 -2
  60. package/dist/arcgis-coding-components/{p-5da03560.js → p-d597b9ea.js} +1 -1
  61. package/dist/arcgis-coding-components/{p-26c67f7c.js → p-e1c8570a.js} +2 -2
  62. package/dist/arcgis-coding-components/{p-8e93417c.js → p-f4af9e3a.js} +2 -2
  63. package/dist/cjs/{app-globals-209c2310.js → app-globals-5b428a6f.js} +1 -1
  64. package/dist/cjs/arcade-defaults-c88dcbd9.js +349 -0
  65. package/dist/cjs/{arcade-mode-f2c3951e.js → arcade-mode-a369164c.js} +3 -3
  66. package/dist/cjs/arcgis-arcade-editor_6.cjs.entry.js +20 -26
  67. package/dist/cjs/arcgis-coding-components.cjs.js +5 -5
  68. package/dist/cjs/arcgis-sql-expression-editor.cjs.entry.js +4 -4
  69. package/dist/cjs/arcgis-sql-expression-fields.cjs.entry.js +4 -4
  70. package/dist/cjs/{css-bbd000cd.js → css-db73fa85.js} +1 -1
  71. package/dist/cjs/{cssMode-ad163e66.js → cssMode-714f53d0.js} +2 -3
  72. package/dist/cjs/{html-5c67b9d0.js → html-881afd14.js} +2 -3
  73. package/dist/cjs/{htmlMode-e32a97bd.js → htmlMode-d513ae10.js} +2 -3
  74. package/dist/cjs/{index-8b891c40.js → index-fd58ccf1.js} +43 -15
  75. package/dist/cjs/index.cjs.js +4 -4
  76. package/dist/cjs/{javascript-e159fa2f.js → javascript-8ea0cace.js} +3 -4
  77. package/dist/cjs/{jsonMode-5c107443.js → jsonMode-345b67b0.js} +2 -3
  78. package/dist/cjs/{language-defaults-base-4300e691.js → language-defaults-base-cd5a367b.js} +822 -1062
  79. package/dist/cjs/loader.cjs.js +4 -4
  80. package/dist/cjs/{sql-expr-defaults-783d9c24.js → sql-expr-defaults-5ab67e9d.js} +114 -52
  81. package/dist/cjs/sql-expr-mode-aaf5cadf.js +467 -0
  82. package/dist/cjs/{tsMode-83c4587f.js → tsMode-085f051d.js} +2 -3
  83. package/dist/cjs/{typescript-f6ca5d84.js → typescript-3adfcc8d.js} +2 -3
  84. package/dist/components/arcade-defaults.js +238 -4
  85. package/dist/components/arcade-mode.js +2 -1
  86. package/dist/components/arcade-results.js +3 -3
  87. package/dist/components/arcade-suggestions.js +2 -2
  88. package/dist/components/arcade-variables.js +2 -2
  89. package/dist/components/arcgis-arcade-editor.js +7 -6
  90. package/dist/components/arcgis-arcade-results.js +1 -1
  91. package/dist/components/arcgis-arcade-suggestions.js +1 -1
  92. package/dist/components/arcgis-arcade-variables.js +1 -1
  93. package/dist/components/arcgis-assets.d.ts +26 -26
  94. package/dist/components/arcgis-assets.js +2 -2
  95. package/dist/components/arcgis-code-editor.js +1 -1
  96. package/dist/components/arcgis-language-api-panel.js +1 -1
  97. package/dist/components/arcgis-sql-expression-editor.js +2 -2
  98. package/dist/components/arcgis-sql-expression-fields.js +1 -1
  99. package/dist/components/{chunk-6TARY3NN.js → chunk-ZZIYM65N.js} +38 -30
  100. package/dist/components/code-editor.js +16 -23
  101. package/dist/components/fields.js +4 -4
  102. package/dist/components/index.js +1 -1
  103. package/dist/components/index2.js +2 -2
  104. package/dist/components/language-api-panel.js +2 -2
  105. package/dist/components/language-defaults-base.js +81 -323
  106. package/dist/components/markdown.js +1 -1
  107. package/dist/components/sql-expr-defaults.js +77 -24
  108. package/dist/components/sql-expr-mode.js +282 -24951
  109. package/dist/components/sql-expression-fields.js +2 -2
  110. package/dist/components/useT9n.js +2 -2
  111. package/dist/components/utilities.js +1 -1
  112. package/dist/esm/{app-globals-60a61d0d.js → app-globals-9b5f37f3.js} +1 -1
  113. package/dist/esm/arcade-defaults-23d01109.js +344 -0
  114. package/dist/esm/{arcade-mode-7e6764ac.js → arcade-mode-30a9597a.js} +3 -3
  115. package/dist/esm/arcgis-arcade-editor_6.entry.js +21 -27
  116. package/dist/esm/arcgis-coding-components.js +6 -6
  117. package/dist/esm/arcgis-sql-expression-editor.entry.js +4 -4
  118. package/dist/esm/arcgis-sql-expression-fields.entry.js +4 -4
  119. package/dist/esm/{css-7d75b7ca.js → css-442d4a5a.js} +1 -1
  120. package/dist/esm/{cssMode-95305ae2.js → cssMode-8833e7da.js} +2 -3
  121. package/dist/esm/{html-84fc596c.js → html-1adb92d5.js} +2 -3
  122. package/dist/esm/{htmlMode-c961f619.js → htmlMode-d45f4634.js} +2 -3
  123. package/dist/esm/{index-1c1754c0.js → index-d9b2b45b.js} +43 -15
  124. package/dist/esm/index.js +4 -4
  125. package/dist/esm/{javascript-0aa4505f.js → javascript-5bf60fbf.js} +3 -4
  126. package/dist/esm/{jsonMode-86b234eb.js → jsonMode-cba63cda.js} +2 -3
  127. package/dist/esm/{language-defaults-base-949fa7fb.js → language-defaults-base-49508cc9.js} +819 -1062
  128. package/dist/esm/loader.js +5 -5
  129. package/dist/esm/{sql-expr-defaults-f2f50289.js → sql-expr-defaults-ba682a85.js} +114 -53
  130. package/dist/esm/sql-expr-mode-5da1d4c8.js +463 -0
  131. package/dist/esm/{tsMode-ee945c40.js → tsMode-23360d7b.js} +2 -3
  132. package/dist/esm/{typescript-8bd2bb48.js → typescript-d1e4a590.js} +2 -3
  133. package/dist/loader/cdn.js +2 -3
  134. package/dist/loader/index.cjs.js +2 -3
  135. package/dist/loader/index.es2017.js +2 -3
  136. package/dist/loader/index.js +2 -3
  137. package/dist/types/components/arcade-editor/arcade-editor.d.ts +13 -3
  138. package/dist/types/components/arcade-results/arcade-results.d.ts +1 -1
  139. package/dist/types/components/arcade-suggestions/arcade-suggestions.d.ts +1 -1
  140. package/dist/types/components/arcade-variables/arcade-variables.d.ts +1 -1
  141. package/dist/types/components/code-editor/code-editor.d.ts +14 -4
  142. package/dist/types/components/language-api-panel/language-api-panel.d.ts +1 -1
  143. package/dist/types/components.d.ts +13 -13
  144. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/arcade-editor/arcade-editor.stories.d.ts +8 -1
  145. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/arcade-editor/editorContext.d.ts +5 -1
  146. package/dist/types/stencil-public-runtime.d.ts +3 -8
  147. package/dist/types/utils/arcade-monaco/arcade-language-features.d.ts +1 -0
  148. package/dist/types/utils/arcade-monaco/arcade-profile-strategy.d.ts +9 -0
  149. package/dist/types/utils/fields.d.ts +2 -2
  150. package/dist/types/utils/profile/editor-profile.d.ts +7 -6
  151. package/dist/types/utils/profile/types.d.ts +53 -65
  152. package/dist/types/utils/profile/utils.d.ts +9 -8
  153. package/dist/types/utils/sql-expr-monaco/sql-expr-completion.d.ts +56 -5
  154. package/dist/types/utils/sql-expr-monaco/sql-expr-constants.d.ts +61 -0
  155. package/dist/types/utils/sql-expr-monaco/sql-expr-contribution.d.ts +1 -11
  156. package/dist/types/utils/sql-expr-monaco/sql-expr-defaults.d.ts +0 -1
  157. package/dist/types/utils/sql-expr-monaco/sql-expr-language-features.d.ts +18 -534
  158. package/dist/types/utils/sql-expr-monaco/sql-expr-mode.d.ts +34 -1
  159. package/dist/types/utils/sql-expr-monaco/sql-expr-parser-utils.d.ts +30 -0
  160. package/dist/types/utils/sql-expr-monaco/sql-expr-service-accessors.d.ts +19 -0
  161. package/dist/types/utils/sql-expr-monaco/sql-expr-validation-diagnostic-adapter.d.ts +0 -7
  162. package/dist/types/utils/sql-expr-monaco/sql-expr-validation-utils.d.ts +73 -77
  163. package/dist/types/utils/sql-expr-monaco/sql-expr-validation.d.ts +5 -6
  164. package/dist/types/utils/sql-expr-monaco/sql-expr-worker-manager.d.ts +2 -0
  165. package/dist/types/utils/sql-expr-monaco/sql-expr.worker.d.ts +11 -8
  166. package/dist/types/utils/sql-expr-monaco/sql-expression-profile-strategy.d.ts +13 -0
  167. package/dist/types/utils/sql-expr-monaco/types.d.ts +30 -28
  168. package/package.json +19 -19
  169. package/dist/arcgis-coding-components/p-103bdac3.js +0 -6
  170. package/dist/arcgis-coding-components/p-2d14950e.js +0 -7
  171. package/dist/arcgis-coding-components/p-374b59c1.js +0 -6
  172. package/dist/arcgis-coding-components/p-a36c357f.js +0 -6
  173. package/dist/arcgis-coding-components/p-de5cabbb.js +0 -6
  174. package/dist/arcgis-coding-components/p-e6cac921.entry.js +0 -6
  175. package/dist/cjs/arcade-defaults-ee308e3a.js +0 -116
  176. package/dist/cjs/sql-expr-mode-6cac37ed.js +0 -25135
  177. package/dist/esm/arcade-defaults-b1a5f013.js +0 -111
  178. package/dist/esm/polyfills/core-js.js +0 -11
  179. package/dist/esm/polyfills/dom.js +0 -79
  180. package/dist/esm/polyfills/es5-html-element.js +0 -1
  181. package/dist/esm/polyfills/index.js +0 -34
  182. package/dist/esm/polyfills/system.js +0 -6
  183. package/dist/esm/sql-expr-mode-14c94be3.js +0 -25132
  184. package/dist/types/utils/profile/predefined-profile.d.ts +0 -4
  185. package/dist/types/utils/sql-expr-monaco/DependentFiles/DateOnly.d.ts +0 -41
  186. package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlInterval.d.ts +0 -16
  187. package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlTimestampOffset.d.ts +0 -26
  188. package/dist/types/utils/sql-expr-monaco/DependentFiles/TimeOnly.d.ts +0 -37
  189. package/dist/types/utils/sql-expr-monaco/DependentFiles/UnknownTimeZone.d.ts +0 -11
  190. package/dist/types/utils/sql-expr-monaco/DependentFiles/WhereGrammar.d.ts +0 -122
  191. package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlCompareUtils.d.ts +0 -5
  192. package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlDateParsingUtils.d.ts +0 -18
  193. package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlUtils.d.ts +0 -6
  194. package/dist/types/utils/sql-expr-monaco/DependentFiles/standardizedFunctions.d.ts +0 -156
  195. package/dist/types/utils/sql-expr-monaco/DependentFiles/support.d.ts +0 -150
  196. package/dist/types/utils/sql-expr-monaco/PeggyGrammar/sql92grammar.d.ts +0 -1397
  197. package/dist/types/utils/sql-expr-monaco/libraries/date/properties/index.d.ts +0 -59
  198. package/dist/types/utils/sql-expr-monaco/libraries/numeric/properties/index.d.ts +0 -295
  199. package/dist/types/utils/sql-expr-monaco/libraries/string/properties/index.d.ts +0 -135
  200. package/dist/types/utils/sql-expr-monaco/sql-expr-validation-adapter.d.ts +0 -3
  201. package/dist/types/utils/sql-expr-profile/predefined-profile.d.ts +0 -2
@@ -1,12 +1,10 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
- * v4.31.0-next.4
4
+ * v4.31.0-next.41
5
5
  */
6
6
  'use strict';
7
7
 
8
- const index = require('./index-8b891c40.js');
9
-
10
8
  function _interopNamespace(e) {
11
9
  if (e && e.__esModule) return e;
12
10
  var n = Object.create(null);
@@ -120616,7 +120614,7 @@ registerLanguage({
120616
120614
  mimetypes: ["text/css"],
120617
120615
  loader: () => {
120618
120616
  {
120619
- return Promise.resolve().then(function () { return require('./css-bbd000cd.js'); });
120617
+ return Promise.resolve().then(function () { return require('./css-db73fa85.js'); });
120620
120618
  }
120621
120619
  }
120622
120620
  });
@@ -120634,7 +120632,7 @@ registerLanguage({
120634
120632
  mimetypes: ["text/html", "text/x-jshtm", "text/template", "text/ng-template"],
120635
120633
  loader: () => {
120636
120634
  {
120637
- return Promise.resolve().then(function () { return require('./html-5c67b9d0.js'); });
120635
+ return Promise.resolve().then(function () { return require('./html-881afd14.js'); });
120638
120636
  }
120639
120637
  }
120640
120638
  });
@@ -120654,7 +120652,7 @@ registerLanguage({
120654
120652
  mimetypes: ["text/javascript"],
120655
120653
  loader: () => {
120656
120654
  {
120657
- return Promise.resolve().then(function () { return require('./javascript-e159fa2f.js'); });
120655
+ return Promise.resolve().then(function () { return require('./javascript-8ea0cace.js'); });
120658
120656
  }
120659
120657
  }
120660
120658
  });
@@ -120672,7 +120670,7 @@ registerLanguage({
120672
120670
  mimetypes: ["text/typescript"],
120673
120671
  loader: () => {
120674
120672
  {
120675
- return Promise.resolve().then(function () { return require('./typescript-f6ca5d84.js'); });
120673
+ return Promise.resolve().then(function () { return require('./typescript-3adfcc8d.js'); });
120676
120674
  }
120677
120675
  }
120678
120676
  });
@@ -120793,7 +120791,7 @@ var lessDefaults = new LanguageServiceDefaultsImpl$3("less", optionsDefault$1, m
120793
120791
  monaco_editor_core_exports$3.languages.css = { cssDefaults, lessDefaults, scssDefaults };
120794
120792
  function getMode$3() {
120795
120793
  {
120796
- return Promise.resolve().then(function () { return require('./cssMode-ad163e66.js'); });
120794
+ return Promise.resolve().then(function () { return require('./cssMode-714f53d0.js'); });
120797
120795
  }
120798
120796
  }
120799
120797
  monaco_editor_core_exports$3.languages.onLanguage("less", () => {
@@ -120918,7 +120916,7 @@ monaco_editor_core_exports$2.languages.html = {
120918
120916
  };
120919
120917
  function getMode$2() {
120920
120918
  {
120921
- return Promise.resolve().then(function () { return require('./htmlMode-e32a97bd.js'); });
120919
+ return Promise.resolve().then(function () { return require('./htmlMode-d513ae10.js'); });
120922
120920
  }
120923
120921
  }
120924
120922
  function registerHTMLLanguageService(languageId, options = optionsDefault, modeConfiguration = getConfigurationDefault(languageId)) {
@@ -121020,7 +121018,7 @@ var jsonDefaults = new LanguageServiceDefaultsImpl$1("json", diagnosticDefault,
121020
121018
  monaco_editor_core_exports$1.languages.json = { jsonDefaults };
121021
121019
  function getMode$1() {
121022
121020
  {
121023
- return Promise.resolve().then(function () { return require('./jsonMode-5c107443.js'); });
121021
+ return Promise.resolve().then(function () { return require('./jsonMode-345b67b0.js'); });
121024
121022
  }
121025
121023
  }
121026
121024
  monaco_editor_core_exports$1.languages.register({
@@ -121289,7 +121287,7 @@ monaco_editor_core_exports.languages.typescript = {
121289
121287
  };
121290
121288
  function getMode() {
121291
121289
  {
121292
- return Promise.resolve().then(function () { return require('./tsMode-83c4587f.js'); });
121290
+ return Promise.resolve().then(function () { return require('./tsMode-085f051d.js'); });
121293
121291
  }
121294
121292
  }
121295
121293
  monaco_editor_core_exports.languages.onLanguage("typescript", () => {
@@ -166736,6 +166734,760 @@ class ToggleHighContrast extends EditorAction {
166736
166734
  }
166737
166735
  registerEditorAction(ToggleHighContrast);
166738
166736
 
166737
+ // src/index.ts
166738
+ var isAMD = typeof window !== "undefined" && "$arcgis" in window && typeof window.$arcgis === "object" && "import" in window.$arcgis && !("forceESM" in window.$arcgis);
166739
+ function isDefaultModule(module) {
166740
+ return module.default !== void 0;
166741
+ }
166742
+ async function importLayersFeatureLayer() {
166743
+ if (isAMD) {
166744
+ return await window.$arcgis.import("esri/layers/FeatureLayer");
166745
+ }
166746
+ const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/layers/FeatureLayer.js')); });
166747
+ return isDefaultModule(module) ? module.default : module;
166748
+ }
166749
+ async function newLayersFeatureLayer(properties) {
166750
+ const ModConstructor = await importLayersFeatureLayer();
166751
+ return new ModConstructor(properties);
166752
+ }
166753
+ async function importPortalPortalItem() {
166754
+ if (isAMD) {
166755
+ return await window.$arcgis.import("esri/portal/PortalItem");
166756
+ }
166757
+ const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/portal/PortalItem.js')); });
166758
+ return isDefaultModule(module) ? module.default : module;
166759
+ }
166760
+ async function newPortalPortalItem(properties) {
166761
+ const ModConstructor = await importPortalPortalItem();
166762
+ return new ModConstructor(properties);
166763
+ }
166764
+ async function importWebMap() {
166765
+ if (isAMD) {
166766
+ return await window.$arcgis.import("esri/WebMap");
166767
+ }
166768
+ const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/WebMap.js')); });
166769
+ return isDefaultModule(module) ? module.default : module;
166770
+ }
166771
+ async function newWebMap(properties) {
166772
+ const ModConstructor = await importWebMap();
166773
+ return new ModConstructor(properties);
166774
+ }
166775
+ async function importWebScene() {
166776
+ if (isAMD) {
166777
+ return await window.$arcgis.import("esri/WebScene");
166778
+ }
166779
+ const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/WebScene.js')); });
166780
+ return isDefaultModule(module) ? module.default : module;
166781
+ }
166782
+ async function newWebScene(properties) {
166783
+ const ModConstructor = await importWebScene();
166784
+ return new ModConstructor(properties);
166785
+ }
166786
+ async function importArcade() {
166787
+ if (isAMD) {
166788
+ return await window.$arcgis.import("esri/arcade");
166789
+ }
166790
+ const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/arcade.js')); });
166791
+ return isDefaultModule(module) ? module.default : module;
166792
+ }
166793
+ async function importRequest() {
166794
+ if (isAMD) {
166795
+ return await window.$arcgis.import("esri/request");
166796
+ }
166797
+ const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/request.js')); });
166798
+ return isDefaultModule(module) ? module.default : module;
166799
+ }
166800
+
166801
+ //#region Type Guards
166802
+ function isFeatureLayerLikeInstance(item) {
166803
+ return (!!item &&
166804
+ typeof item === "object" &&
166805
+ "declaredClass" in item &&
166806
+ typeof item.declaredClass === "string" &&
166807
+ item.declaredClass.startsWith("esri.layers.") &&
166808
+ isFieldsDefinition(item) &&
166809
+ "queryFeatures" in item &&
166810
+ typeof item.queryFeatures === "function");
166811
+ }
166812
+ function isGroupLayerCapable(item) {
166813
+ return (!!item &&
166814
+ typeof item === "object" &&
166815
+ "allLayers" in item &&
166816
+ "allTables" in item &&
166817
+ typeof item.allLayers === "object" &&
166818
+ typeof item.allTables === "object");
166819
+ }
166820
+ function isMapInstance(item) {
166821
+ return (!!item &&
166822
+ typeof item === "object" &&
166823
+ "declaredClass" in item &&
166824
+ typeof item.declaredClass === "string" &&
166825
+ (item.declaredClass === "esri.Map" ||
166826
+ item.declaredClass === "esri.WebMap" ||
166827
+ item.declaredClass === "esri.WebScene"));
166828
+ }
166829
+ function isLoadAllCapable(item) {
166830
+ return !!item && typeof item === "object" && "loadAll" in item && typeof item.loadAll === "function";
166831
+ }
166832
+ function isPortalItemDefinition(item) {
166833
+ return !!item && typeof item === "object" && "portalItem" in item && item.portalItem != null;
166834
+ }
166835
+ function isFeatureLayerItemDefinition(item) {
166836
+ return !!item && typeof item === "object" && "portalItem" in item && item.portalItem != null;
166837
+ }
166838
+ function isFieldsDefinition(item) {
166839
+ return !!item && typeof item === "object" && "fields" in item && Array.isArray(item.fields);
166840
+ }
166841
+ function isUrlDefinition(item) {
166842
+ return !!item && typeof item === "object" && "url" in item && typeof item.url === "string";
166843
+ }
166844
+ function isSupportedServiceUrlDefinition(item) {
166845
+ return isUrlDefinition(item) && /\/(?:featureserver|mapserver)(?:\/|$)/iu.test(item.url);
166846
+ }
166847
+ function isFeatureDefinition(item) {
166848
+ return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
166849
+ }
166850
+ function isFeatureSetDefinition(item) {
166851
+ return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
166852
+ }
166853
+ function isFeatureSetCollectionDefinition(item) {
166854
+ return isPortalItemDefinition(item) || isMapInstance(item) || isSupportedServiceUrlDefinition(item);
166855
+ }
166856
+ function isSubtypeInstance(item) {
166857
+ return (!!item &&
166858
+ typeof item === "object" &&
166859
+ "declaredClass" in item &&
166860
+ item.declaredClass === "esri.layers.support.Subtype");
166861
+ }
166862
+ function isCodedValueDomainInstance(item) {
166863
+ return (!!item &&
166864
+ typeof item === "object" &&
166865
+ "declaredClass" in item &&
166866
+ item.declaredClass === "esri.layers.support.CodedValueDomain");
166867
+ }
166868
+ function isInheritedDomainInstance(item) {
166869
+ return (!!item &&
166870
+ typeof item === "object" &&
166871
+ "declaredClass" in item &&
166872
+ item.declaredClass === "esri.layers.support.InheritedDomain");
166873
+ }
166874
+ function isPredefinedProfile(item) {
166875
+ return (!!item &&
166876
+ typeof item === "object" &&
166877
+ "id" in item &&
166878
+ typeof item.id === "string" &&
166879
+ "definitions" in item &&
166880
+ typeof item.definitions === "object" &&
166881
+ !Array.isArray(item.definitions));
166882
+ }
166883
+ function isTitleCapableSource(item) {
166884
+ return !!item && typeof item === "object" && "title" in item && typeof item.title === "string";
166885
+ }
166886
+ function isUrlCapableSource(item) {
166887
+ return !!item && typeof item === "object" && "url" in item && typeof item.url === "string";
166888
+ }
166889
+ function isLayerIdCapableSource(item) {
166890
+ return !!item && typeof item === "object" && "layerId" in item && typeof item.layerId === "number";
166891
+ }
166892
+ function isFeatureTypesCapableLayer(item) {
166893
+ return !!item && typeof item === "object" && "typeIdField" in item && "types" in item;
166894
+ }
166895
+ function isDomainsCapableLayer(item) {
166896
+ return !!item && typeof item === "object" && "getFieldDomain" in item && typeof item.getFieldDomain === "function";
166897
+ }
166898
+ function isSubtypeFieldCapableLayer(item) {
166899
+ return !!item && typeof item === "object" && "subtypeField" in item;
166900
+ }
166901
+ function isSubtypesCapableLayer(item) {
166902
+ return isSubtypeFieldCapableLayer(item) && "subtypes" in item;
166903
+ }
166904
+ function isPortalItemCapable(item) {
166905
+ return !!item && typeof item === "object" && "portalItem" in item;
166906
+ }
166907
+ function isRelationshipsCapableLayer(item) {
166908
+ return (isLayerIdCapableSource(item) &&
166909
+ "relationships" in item &&
166910
+ "url" in item &&
166911
+ Array.isArray(item.relationships) &&
166912
+ typeof item.url === "string");
166913
+ }
166914
+ function isTableCapableLayer(item) {
166915
+ return !!item && typeof item === "object" && "isTable" in item && typeof item.isTable === "boolean";
166916
+ }
166917
+ function isLoadableSource(item) {
166918
+ return !!item && typeof item === "object" && "load" in item && typeof item.load === "function";
166919
+ }
166920
+ //#endregion
166921
+ //#region Service Metadata
166922
+ async function supportedSourceFromDefinition(definition) {
166923
+ if (!definition) {
166924
+ return null;
166925
+ }
166926
+ let source = null;
166927
+ if (isFieldsDefinition(definition)) {
166928
+ source = definition;
166929
+ }
166930
+ else {
166931
+ source = await newLayersFeatureLayer(definition);
166932
+ }
166933
+ if (isLoadableSource(source)) {
166934
+ await source.load();
166935
+ }
166936
+ return source;
166937
+ }
166938
+ async function serviceMetaData(url) {
166939
+ url += "/layers";
166940
+ const request = await importRequest();
166941
+ const response = await request(url, { responseType: "json", query: { f: "json" } });
166942
+ const queryCapability = url.endsWith("MapServer/layers") ? "data" : "query";
166943
+ const layers = getSupportedLayerInfos(response.data?.layers, queryCapability);
166944
+ const tables = getSupportedLayerInfos(response.data?.tables, queryCapability);
166945
+ return { layers, tables };
166946
+ }
166947
+ function getSupportedLayerInfos(layers, queryCapability) {
166948
+ if (!layers) {
166949
+ return [];
166950
+ }
166951
+ return layers.filter((layer) => {
166952
+ switch (layer.type) {
166953
+ case "Feature Layer":
166954
+ case "Oriented Imagery Layer":
166955
+ case "Catalog Layer":
166956
+ case "Table": {
166957
+ const capabilities = layer.capabilities
166958
+ ? layer.capabilities
166959
+ .toLowerCase()
166960
+ .split(",")
166961
+ .map((value) => value.trim())
166962
+ : [];
166963
+ return capabilities.includes(queryCapability);
166964
+ }
166965
+ default:
166966
+ return false;
166967
+ }
166968
+ });
166969
+ }
166970
+ //#endregion
166971
+
166972
+ // src/array-utils.ts
166973
+
166974
+ // src/deferred.ts
166975
+ var Deferred = class {
166976
+ /**
166977
+ * Resolves the promise.
166978
+ * @param value The value to resolve the promise with.
166979
+ */
166980
+ resolve(_value) {
166981
+ }
166982
+ /**
166983
+ * Rejects the promise.
166984
+ */
166985
+ reject(_error) {
166986
+ }
166987
+ /**
166988
+ * Creates a new deferred promise.
166989
+ */
166990
+ constructor() {
166991
+ this.promise = new Promise((resolve, reject) => {
166992
+ this.resolve = resolve;
166993
+ this.reject = reject;
166994
+ });
166995
+ }
166996
+ };
166997
+
166998
+ // src/dom.ts
166999
+ function inTargetElement(element, targetElement) {
167000
+ let currentElement = element;
167001
+ while (currentElement) {
167002
+ if (currentElement === targetElement) {
167003
+ return true;
167004
+ }
167005
+ if (!currentElement.parentNode) {
167006
+ return false;
167007
+ }
167008
+ if (currentElement.parentNode instanceof ShadowRoot) {
167009
+ currentElement = currentElement.parentNode.host;
167010
+ } else {
167011
+ currentElement = currentElement.parentNode;
167012
+ }
167013
+ }
167014
+ return false;
167015
+ }
167016
+ function observeAncestorsMutation(element, attributeFilter, callback) {
167017
+ const { subscribe } = observe(attributeFilter);
167018
+ return subscribe((mutations) => {
167019
+ const matched = mutations.some((mutation) => inTargetElement(element, mutation.target));
167020
+ if (matched) {
167021
+ callback();
167022
+ }
167023
+ });
167024
+ }
167025
+ var observers = {};
167026
+ function observe(attributeFilter) {
167027
+ const attributes = attributeFilter.join(",");
167028
+ const previousObserver = observers[attributes];
167029
+ if (previousObserver !== void 0) {
167030
+ return previousObserver;
167031
+ }
167032
+ const subscribers = /* @__PURE__ */ new Set();
167033
+ const mutationObserver = new MutationObserver((mutations) => subscribers.forEach((callback) => callback(mutations)));
167034
+ mutationObserver.observe(document.documentElement, {
167035
+ attributes: true,
167036
+ attributeFilter,
167037
+ subtree: true
167038
+ });
167039
+ const observer = {
167040
+ subscribe(callback) {
167041
+ subscribers.add(callback);
167042
+ return {
167043
+ remove: () => {
167044
+ subscribers.delete(callback);
167045
+ if (subscribers.size === 0) {
167046
+ mutationObserver.disconnect();
167047
+ observers[attributes] = void 0;
167048
+ }
167049
+ }
167050
+ };
167051
+ }
167052
+ };
167053
+ observers[attributes] = observer;
167054
+ return observer;
167055
+ }
167056
+ function closestElement(base, selector) {
167057
+ let currentElement = base;
167058
+ while (currentElement) {
167059
+ const element = currentElement.closest(selector);
167060
+ if (element) {
167061
+ return element;
167062
+ }
167063
+ const rootElement = currentElement.getRootNode();
167064
+ if (rootElement === document) {
167065
+ return null;
167066
+ }
167067
+ currentElement = rootElement.host;
167068
+ }
167069
+ return null;
167070
+ }
167071
+ function getElementTheme(base) {
167072
+ const themeElt = closestElement(base, ":is(.calcite-mode-light, .calcite-mode-dark)");
167073
+ return themeElt && themeElt.classList.contains("calcite-mode-dark") ? "dark" : "light";
167074
+ }
167075
+ function getElementAttribute(el, prop, fallbackValue) {
167076
+ const closest = closestElement(el, `[${prop}]`);
167077
+ return closest?.getAttribute(prop) ?? fallbackValue;
167078
+ }
167079
+ function isElement(ref) {
167080
+ return ref.nodeType === Node.ELEMENT_NODE;
167081
+ }
167082
+ function isHTMLWithSetFocus(ref) {
167083
+ return "setFocus" in ref && typeof ref.setFocus === "function";
167084
+ }
167085
+ function setFocus(ref, selector = "") {
167086
+ if (!isElement(ref)) {
167087
+ return false;
167088
+ }
167089
+ if (ref.matches(selector)) {
167090
+ if (isHTMLWithSetFocus(ref)) {
167091
+ setTimeout(() => ref.setFocus(), 0);
167092
+ }
167093
+ return true;
167094
+ }
167095
+ for (const child of ref.children) {
167096
+ if (setFocus(child, selector)) {
167097
+ return true;
167098
+ }
167099
+ }
167100
+ const shadowRoot = ref.shadowRoot;
167101
+ if (shadowRoot) {
167102
+ for (const child of shadowRoot.children) {
167103
+ if (setFocus(child, selector)) {
167104
+ return true;
167105
+ }
167106
+ }
167107
+ }
167108
+ return false;
167109
+ }
167110
+ function setFocusOnElement(ref, selector) {
167111
+ if (!ref?.shadowRoot) {
167112
+ return;
167113
+ }
167114
+ if (ref.hasAttribute("hydrated") || ref.hasAttribute("calcite-hydrated")) {
167115
+ setFocus(ref, selector);
167116
+ return;
167117
+ }
167118
+ const mutationObserver = new MutationObserver(() => {
167119
+ mutationObserver.disconnect();
167120
+ setFocus(ref, selector);
167121
+ });
167122
+ mutationObserver.observe(ref, {
167123
+ attributes: true,
167124
+ attributeFilter: ["hydrated", "calcite-hydrated"]
167125
+ });
167126
+ }
167127
+
167128
+ // src/errors.ts
167129
+ function safeCall(callback, thisContext, ...rest) {
167130
+ try {
167131
+ return callback?.call(thisContext, ...rest);
167132
+ } catch (error) {
167133
+ console.error(error, callback);
167134
+ }
167135
+ return void 0;
167136
+ }
167137
+ async function safeAsyncCall(callback, thisContext, ...rest) {
167138
+ try {
167139
+ const result = callback?.call(thisContext, ...rest);
167140
+ return result instanceof Promise ? await result : result;
167141
+ } catch (error) {
167142
+ console.error(error, callback);
167143
+ }
167144
+ return void 0;
167145
+ }
167146
+
167147
+ // src/guid.ts
167148
+ function gen(count) {
167149
+ let out = "";
167150
+ for (let i = 0; i < count; i++) {
167151
+ out += ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
167152
+ }
167153
+ return out;
167154
+ }
167155
+ function generateGuid() {
167156
+ return [gen(2), gen(1), gen(1), gen(1), gen(3)].join("-");
167157
+ }
167158
+
167159
+ // src/intl.ts
167160
+ var supportedLocalesArray = [
167161
+ "ar",
167162
+ "bg",
167163
+ "bs",
167164
+ "ca",
167165
+ "cs",
167166
+ "da",
167167
+ "de",
167168
+ "el",
167169
+ "en",
167170
+ "es",
167171
+ "et",
167172
+ "fi",
167173
+ "fr",
167174
+ "he",
167175
+ "hr",
167176
+ "hu",
167177
+ "id",
167178
+ "it",
167179
+ "ja",
167180
+ "ko",
167181
+ "lt",
167182
+ "lv",
167183
+ "nl",
167184
+ "nb",
167185
+ "pl",
167186
+ "pt-BR",
167187
+ "pt-PT",
167188
+ "ro",
167189
+ "ru",
167190
+ "sk",
167191
+ "sl",
167192
+ "sr",
167193
+ "sv",
167194
+ "th",
167195
+ "tr",
167196
+ "uk",
167197
+ "vi",
167198
+ "zh-CN",
167199
+ "zh-HK",
167200
+ "zh-TW"
167201
+ ];
167202
+ var supportedLocales = new Set(supportedLocalesArray);
167203
+ var defaultLocale = "en";
167204
+ var localeEquivalencies = {
167205
+ // We use `pt-BR` as it will have the same translations as `pt`, which has no corresponding bundle
167206
+ pt: "pt-PT",
167207
+ // We support both 'nb' and 'no' (BCP 47) for Norwegian but only `nb` has corresponding bundle
167208
+ no: "nb",
167209
+ // We can `zh-CN` as base translation for chinese locales which has no corresponding bundle.
167210
+ zh: "zh-CN"
167211
+ };
167212
+ async function fetchT9nStringsBundle(locale, assetsPath, prefix = "") {
167213
+ const path = `${assetsPath}/${prefix}`;
167214
+ const filePath = `${path}${locale}.json`;
167215
+ t9nStringsCache[filePath] ?? (t9nStringsCache[filePath] = fetchBundle(locale, path));
167216
+ return await t9nStringsCache[filePath];
167217
+ }
167218
+ var t9nStringsCache = {};
167219
+ async function fetchBundle(locale, path) {
167220
+ const filePath = `${path}${locale}.json`;
167221
+ try {
167222
+ const response = await fetch(filePath);
167223
+ if (response.ok) {
167224
+ return await response.json();
167225
+ }
167226
+ } catch (error) {
167227
+ console.error(error);
167228
+ return {};
167229
+ }
167230
+ if (locale === defaultLocale) {
167231
+ return {};
167232
+ }
167233
+ return await fetchBundle(defaultLocale, path);
167234
+ }
167235
+ function getElementLocales(element) {
167236
+ const lang = getElementAttribute(element, "lang", navigator.language || defaultLocale);
167237
+ return { lang, t9nLocale: langToLocale(lang) };
167238
+ }
167239
+ function langToLocale(lang) {
167240
+ const parts = lang.split("-");
167241
+ const normalized = `${parts[0].toLowerCase()}${parts.slice(1).join("-").toUpperCase()}`;
167242
+ if (supportedLocales.has(normalized)) {
167243
+ return normalized;
167244
+ }
167245
+ const languageCode = normalized.slice(0, 2).toLowerCase();
167246
+ const locale = localeEquivalencies[languageCode] ?? languageCode;
167247
+ if (supportedLocales.has(locale)) {
167248
+ return locale;
167249
+ }
167250
+ return defaultLocale;
167251
+ }
167252
+ function startLocaleObserver(element, assetsPath, onUpdated, assetName) {
167253
+ let result = void 0;
167254
+ const callback = () => void updateComponentLocateState(element, assetsPath, assetName).then((newResult) => {
167255
+ if (result?.lang !== newResult.lang || result.t9nLocale !== newResult.t9nLocale || result.t9nStrings !== newResult.t9nStrings) {
167256
+ onUpdated(newResult);
167257
+ }
167258
+ result = newResult;
167259
+ }).catch(console.error);
167260
+ callback();
167261
+ return observeAncestorsMutation(element, ["lang"], callback);
167262
+ }
167263
+ async function updateComponentLocateState(element, assetsPath, assetName = element.tagName.toLowerCase().replace("arcgis-", "")) {
167264
+ const { lang, t9nLocale } = getElementLocales(element);
167265
+ const t9nAssetsPath = `${assetsPath}/${assetName}/t9n`;
167266
+ const prefix = `${assetName}.t9n.`;
167267
+ const t9nStrings = await fetchT9nStringsBundle(t9nLocale, t9nAssetsPath, prefix);
167268
+ return { lang, t9nLocale, t9nStrings };
167269
+ }
167270
+
167271
+ // src/strings.ts
167272
+ var doubleQuote = '"';
167273
+ var singleQuote = "'";
167274
+ function repeatString(value, n) {
167275
+ return new Array(n + 1).join(value);
167276
+ }
167277
+ function quoteString(value) {
167278
+ let quote = doubleQuote;
167279
+ let alternateQuote = singleQuote;
167280
+ const avoidEscape = value.includes(quote) && !value.includes(alternateQuote);
167281
+ if (avoidEscape) {
167282
+ alternateQuote = doubleQuote;
167283
+ quote = singleQuote;
167284
+ }
167285
+ const alternateEscape = new RegExp(`(^|[^\\\\])((?:\\\\{2})*)((?:\\\\${alternateQuote})+)`, "gu");
167286
+ value = value.replace(
167287
+ alternateEscape,
167288
+ (_, boundaryChar, leadingEscapedSlashes, escapedQuoteChars) => (
167289
+ // We divide the escapedQuoteChars by 2 since there are 2 characters in each escaped part ('\\"'.length === 2)
167290
+ boundaryChar + leadingEscapedSlashes + repeatString(alternateQuote, escapedQuoteChars.length / 2)
167291
+ )
167292
+ );
167293
+ const quoteEscape = new RegExp(`(^|[^\\\\])((?:\\\\{2})*)(${quote}+)`, "gu");
167294
+ value = value.replace(
167295
+ quoteEscape,
167296
+ (_, boundaryChar, leadingEscapedSlashes, quoteChars) => boundaryChar + leadingEscapedSlashes + repeatString(`\\${quote}`, quoteChars.length)
167297
+ );
167298
+ return quote + value + quote;
167299
+ }
167300
+ function createFilterExpression(filterWord) {
167301
+ const sanitizedWord = filterWord ? filterWord.replaceAll(/[-[\]/{}()*+?.\\^$|]/gu, "\\$&") : "^.*$";
167302
+ return new RegExp(sanitizedWord, "i");
167303
+ }
167304
+ function setValuesInString(message, values = {}) {
167305
+ return (message ?? "").replace(/\{(?<valueName>.*?)\}/gu, (match, valueName) => values[valueName] ?? match);
167306
+ }
167307
+ function addLTRMark(value) {
167308
+ return `\u200E${value ?? ""}\u200E`;
167309
+ }
167310
+
167311
+ // src/timeouts.ts
167312
+ function devToolsAwareTimeout(callback, timeout) {
167313
+ const interval = timeout > longTimeoutThreshold ? longTimeoutInterval : timeout / shortTimeoutIntervals;
167314
+ let elapsed = 0;
167315
+ const reference = setInterval(() => {
167316
+ elapsed += interval;
167317
+ if (elapsed >= timeout) {
167318
+ clearInterval(reference);
167319
+ callback();
167320
+ }
167321
+ }, interval);
167322
+ return reference;
167323
+ }
167324
+ var longTimeoutThreshold = 4e3;
167325
+ var longTimeoutInterval = 2e3;
167326
+ var shortTimeoutIntervals = 4;
167327
+
167328
+ // src/type-guards.ts
167329
+ function isNotNull(item) {
167330
+ return item !== null;
167331
+ }
167332
+ function isNotUndefined(item) {
167333
+ return item !== void 0;
167334
+ }
167335
+
167336
+ // src/ui.ts
167337
+ function debounce(func, waitFor = 100) {
167338
+ let timeout;
167339
+ return (...args) => {
167340
+ const later = () => {
167341
+ clearTimeout(timeout);
167342
+ func(...args);
167343
+ };
167344
+ clearTimeout(timeout);
167345
+ timeout = setTimeout(later, waitFor);
167346
+ };
167347
+ }
167348
+
167349
+ // src/url.ts
167350
+ function hasSameOrigin(url1, url2, ignoreProtocol = false) {
167351
+ if (!url1 || !url2) {
167352
+ return false;
167353
+ }
167354
+ const url1Obj = new URL(url1);
167355
+ const url2Obj = new URL(url2);
167356
+ if (!ignoreProtocol && url1Obj.protocol !== url2Obj.protocol) {
167357
+ return false;
167358
+ }
167359
+ if (url1Obj.host == null || url2Obj.host == null) {
167360
+ return false;
167361
+ }
167362
+ return url1Obj.host.toLowerCase() === url2Obj.host.toLowerCase() && url1Obj.port === url2Obj.port;
167363
+ }
167364
+ function isURL(url) {
167365
+ try {
167366
+ new URL(url);
167367
+ return true;
167368
+ } catch (e) {
167369
+ return false;
167370
+ }
167371
+ }
167372
+
167373
+ /**
167374
+ * Filters a collection of items by the given keys and filter word.
167375
+ */
167376
+ function filterCollection(collection, keys, filterWord, beforeFilteringFn) {
167377
+ if (!keys) {
167378
+ return [];
167379
+ }
167380
+ const _keys = !Array.isArray(keys) ? [keys] : keys;
167381
+ if (!_keys.length) {
167382
+ return [];
167383
+ }
167384
+ const filterExpression = createFilterExpression(filterWord);
167385
+ return collection.filter((item) => {
167386
+ if (beforeFilteringFn) {
167387
+ const res = beforeFilteringFn(item);
167388
+ if (res !== null || res !== undefined) {
167389
+ return res;
167390
+ }
167391
+ }
167392
+ return _keys.some((key) => filterExpression.test(String(item[key] ?? "")));
167393
+ });
167394
+ }
167395
+ /**
167396
+ * Returns the url to the portal item.
167397
+ */
167398
+ function portalItemPageUrl(portalItem) {
167399
+ if (!portalItem) {
167400
+ return "";
167401
+ }
167402
+ return `${portalItem.portal.url}/home/item.html?id=${portalItem.id}`;
167403
+ }
167404
+ //#endregion
167405
+
167406
+ /**
167407
+ * Returns an icon name for the field type
167408
+ */
167409
+ function fieldTypeToIconName(field) {
167410
+ switch (field.type) {
167411
+ case "oid":
167412
+ return "key";
167413
+ case "small-integer":
167414
+ case "big-integer":
167415
+ case "integer":
167416
+ case "single":
167417
+ case "double":
167418
+ case "long":
167419
+ return "number";
167420
+ case "global-id":
167421
+ case "guid":
167422
+ return "key";
167423
+ case "string":
167424
+ return "string";
167425
+ case "date":
167426
+ return "date-time";
167427
+ case "date-only":
167428
+ return "calendar";
167429
+ case "time-only":
167430
+ return "clock";
167431
+ case "timestamp-offset":
167432
+ return "time-zone";
167433
+ default:
167434
+ return "cube";
167435
+ }
167436
+ }
167437
+ /**
167438
+ * Returns the ApiValueVariable type for the given field.
167439
+ */
167440
+ function fieldTypeToApiValueVarType(field) {
167441
+ switch (field.type) {
167442
+ case "small-integer":
167443
+ case "integer":
167444
+ case "big-integer":
167445
+ case "single":
167446
+ case "double":
167447
+ case "long":
167448
+ case "oid":
167449
+ return "number";
167450
+ case "global-id":
167451
+ case "guid":
167452
+ case "string":
167453
+ return "text";
167454
+ case "date":
167455
+ return "date";
167456
+ case "date-only":
167457
+ return "dateOnly";
167458
+ case "time-only":
167459
+ return "time";
167460
+ default:
167461
+ return "text";
167462
+ }
167463
+ }
167464
+ function supportedFields(fields) {
167465
+ return (fields ?? []).filter((field) => {
167466
+ switch (field.type) {
167467
+ case "string":
167468
+ case "small-integer":
167469
+ case "integer":
167470
+ case "big-integer":
167471
+ case "single":
167472
+ case "double":
167473
+ case "long":
167474
+ case "date":
167475
+ case "date-only":
167476
+ case "time-only":
167477
+ case "timestamp-offset":
167478
+ case "oid":
167479
+ case "guid":
167480
+ case "global-id":
167481
+ return true;
167482
+ default:
167483
+ return false;
167484
+ }
167485
+ });
167486
+ }
167487
+ function fieldAlias(field) {
167488
+ return field.alias || field.name;
167489
+ }
167490
+
166739
167491
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
166740
167492
 
166741
167493
  function commonjsRequire (path) {
@@ -169011,760 +169763,6 @@ var main = {exports: {}};
169011
169763
  });
169012
169764
  }(main, main.exports));
169013
169765
 
169014
- // src/index.ts
169015
- var isAMD = typeof window !== "undefined" && "$arcgis" in window && typeof window.$arcgis === "object" && "import" in window.$arcgis && !("forceESM" in window.$arcgis);
169016
- function isDefaultModule(module) {
169017
- return module.default !== void 0;
169018
- }
169019
- async function importLayersFeatureLayer() {
169020
- if (isAMD) {
169021
- return await window.$arcgis.import("esri/layers/FeatureLayer");
169022
- }
169023
- const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/layers/FeatureLayer.js')); });
169024
- return isDefaultModule(module) ? module.default : module;
169025
- }
169026
- async function newLayersFeatureLayer(properties) {
169027
- const ModConstructor = await importLayersFeatureLayer();
169028
- return new ModConstructor(properties);
169029
- }
169030
- async function importPortalPortalItem() {
169031
- if (isAMD) {
169032
- return await window.$arcgis.import("esri/portal/PortalItem");
169033
- }
169034
- const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/portal/PortalItem.js')); });
169035
- return isDefaultModule(module) ? module.default : module;
169036
- }
169037
- async function newPortalPortalItem(properties) {
169038
- const ModConstructor = await importPortalPortalItem();
169039
- return new ModConstructor(properties);
169040
- }
169041
- async function importWebMap() {
169042
- if (isAMD) {
169043
- return await window.$arcgis.import("esri/WebMap");
169044
- }
169045
- const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/WebMap.js')); });
169046
- return isDefaultModule(module) ? module.default : module;
169047
- }
169048
- async function newWebMap(properties) {
169049
- const ModConstructor = await importWebMap();
169050
- return new ModConstructor(properties);
169051
- }
169052
- async function importWebScene() {
169053
- if (isAMD) {
169054
- return await window.$arcgis.import("esri/WebScene");
169055
- }
169056
- const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/WebScene.js')); });
169057
- return isDefaultModule(module) ? module.default : module;
169058
- }
169059
- async function newWebScene(properties) {
169060
- const ModConstructor = await importWebScene();
169061
- return new ModConstructor(properties);
169062
- }
169063
- async function importArcade() {
169064
- if (isAMD) {
169065
- return await window.$arcgis.import("esri/arcade");
169066
- }
169067
- const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/arcade.js')); });
169068
- return isDefaultModule(module) ? module.default : module;
169069
- }
169070
- async function importRequest() {
169071
- if (isAMD) {
169072
- return await window.$arcgis.import("esri/request");
169073
- }
169074
- const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/request.js')); });
169075
- return isDefaultModule(module) ? module.default : module;
169076
- }
169077
-
169078
- //#region Type Guards
169079
- function isQueryableLayerInstance(item) {
169080
- return (!!item &&
169081
- typeof item === "object" &&
169082
- "declaredClass" in item &&
169083
- typeof item.declaredClass === "string" &&
169084
- item.declaredClass.startsWith("esri.layers.") &&
169085
- "fields" in item &&
169086
- "queryFeatures" in item &&
169087
- typeof item.queryFeatures === "function");
169088
- }
169089
- function isSubtypeSublayerInstance(item) {
169090
- return (!!item &&
169091
- typeof item === "object" &&
169092
- "declaredClass" in item &&
169093
- typeof item.declaredClass === "string" &&
169094
- item.declaredClass === "esri.layers.support.SubtypeSublayer");
169095
- }
169096
- function isGroupLayerInstance(item) {
169097
- return (!!item &&
169098
- typeof item === "object" &&
169099
- "declaredClass" in item &&
169100
- typeof item.declaredClass === "string" &&
169101
- item.declaredClass === "esri.layers.GroupLayer");
169102
- }
169103
- function isMapInstance(item) {
169104
- return (!!item &&
169105
- typeof item === "object" &&
169106
- "declaredClass" in item &&
169107
- typeof item.declaredClass === "string" &&
169108
- (item.declaredClass === "esri.Map" ||
169109
- item.declaredClass === "esri.WebMap" ||
169110
- item.declaredClass === "esri.WebScene"));
169111
- }
169112
- function isWebMapInstance(item) {
169113
- return item.declaredClass === "esri.WebMap";
169114
- }
169115
- function isWebSceneInstance(item) {
169116
- return item.declaredClass === "esri.WebScene";
169117
- }
169118
- function isLoadableMapInstance(item) {
169119
- return item.declaredClass === "esri.WebMap" || item.declaredClass === "esri.WebScene";
169120
- }
169121
- function isPortalItemDefinition(item) {
169122
- return !!item && typeof item === "object" && "portalItem" in item && item.portalItem != null;
169123
- }
169124
- function isFeatureLayerItemDefinition(item) {
169125
- return !!item && typeof item === "object" && "portalItem" in item && item.portalItem != null;
169126
- }
169127
- function isFieldsDefinition(item) {
169128
- return !!item && typeof item === "object" && "fields" in item && Array.isArray(item.fields);
169129
- }
169130
- function isUrlDefinition(item) {
169131
- return !!item && typeof item === "object" && "url" in item && typeof item.url === "string";
169132
- }
169133
- function isSupportedServiceUrlDefinition(item) {
169134
- return isUrlDefinition(item) && /\/(?:featureserver|mapserver)(?:\/|$)/iu.test(item.url);
169135
- }
169136
- function isSubtypeInstance(item) {
169137
- return (!!item &&
169138
- typeof item === "object" &&
169139
- "declaredClass" in item &&
169140
- item.declaredClass === "esri.layers.support.Subtype");
169141
- }
169142
- function isCodedValueDomainInstance(item) {
169143
- return (!!item &&
169144
- typeof item === "object" &&
169145
- "declaredClass" in item &&
169146
- item.declaredClass === "esri.layers.support.CodedValueDomain");
169147
- }
169148
- function isInheritedDomainInstance(item) {
169149
- return (!!item &&
169150
- typeof item === "object" &&
169151
- "declaredClass" in item &&
169152
- item.declaredClass === "esri.layers.support.InheritedDomain");
169153
- }
169154
- function isPredefinedProfile(item) {
169155
- return (!!item &&
169156
- typeof item === "object" &&
169157
- "id" in item &&
169158
- typeof item.id === "string" &&
169159
- "definitions" in item &&
169160
- typeof item.definitions === "object" &&
169161
- !Array.isArray(item.definitions));
169162
- }
169163
- function isTitleCapableSource(item) {
169164
- return !!item && typeof item === "object" && "title" in item && typeof item.title === "string";
169165
- }
169166
- function isUrlCapableSource(item) {
169167
- return !!item && typeof item === "object" && "url" in item && typeof item.url === "string";
169168
- }
169169
- function isLayerIdCapableSource(item) {
169170
- return !!item && typeof item === "object" && "layerId" in item && typeof item.layerId === "number";
169171
- }
169172
- function isFeatureTypesCapableLayer(item) {
169173
- return !!item && typeof item === "object" && "typeIdField" in item && "types" in item;
169174
- }
169175
- function isDomainsCapableLayer(item) {
169176
- return !!item && typeof item === "object" && "getFieldDomain" in item && typeof item.getFieldDomain === "function";
169177
- }
169178
- function isSubtypeFieldCapableLayer(item) {
169179
- return !!item && typeof item === "object" && "subtypeField" in item;
169180
- }
169181
- function isSubtypesCapableLayer(item) {
169182
- return isSubtypeFieldCapableLayer(item) && "subtypes" in item;
169183
- }
169184
- function isRelationshipsCapableLayer(item) {
169185
- return (isLayerIdCapableSource(item) &&
169186
- "relationships" in item &&
169187
- "url" in item &&
169188
- Array.isArray(item.relationships) &&
169189
- typeof item.url === "string");
169190
- }
169191
- function isTableCapableLayer(item) {
169192
- return !!item && typeof item === "object" && "isTable" in item && typeof item.isTable === "boolean";
169193
- }
169194
- function isLoadableSource(item) {
169195
- return !!item && typeof item === "object" && "load" in item && typeof item.load === "function";
169196
- }
169197
- //#endregion
169198
- //#region Service Metadata
169199
- async function supportedSourceFromDefinition(definition) {
169200
- if (!definition) {
169201
- return null;
169202
- }
169203
- let source = null;
169204
- if (isFieldsDefinition(definition)) {
169205
- source = definition;
169206
- }
169207
- else {
169208
- source = await newLayersFeatureLayer(definition);
169209
- }
169210
- if (isLoadableSource(source)) {
169211
- await source.load();
169212
- }
169213
- return source;
169214
- }
169215
- async function serviceMetaData(url) {
169216
- url += "/layers";
169217
- const request = await importRequest();
169218
- const response = await request(url, { responseType: "json", query: { f: "json" } });
169219
- const queryCapability = url.endsWith("MapServer/layers") ? "data" : "query";
169220
- const layers = getSupportedLayerInfos(response.data?.layers, queryCapability);
169221
- const tables = getSupportedLayerInfos(response.data?.tables, queryCapability);
169222
- return { layers, tables };
169223
- }
169224
- function getSupportedLayerInfos(layers, queryCapability) {
169225
- if (!layers) {
169226
- return [];
169227
- }
169228
- return layers.filter((layer) => {
169229
- switch (layer.type) {
169230
- case "Feature Layer":
169231
- case "Oriented Imagery Layer":
169232
- case "Catalog Layer":
169233
- case "Table": {
169234
- const capabilities = layer.capabilities
169235
- ? layer.capabilities
169236
- .toLowerCase()
169237
- .split(",")
169238
- .map((value) => value.trim())
169239
- : [];
169240
- return capabilities.includes(queryCapability);
169241
- }
169242
- default:
169243
- return false;
169244
- }
169245
- });
169246
- }
169247
- //#endregion
169248
-
169249
- // src/array-utils.ts
169250
-
169251
- // src/deferred.ts
169252
- var Deferred = class {
169253
- /**
169254
- * Resolves the promise.
169255
- * @param value The value to resolve the promise with.
169256
- */
169257
- resolve(_value) {
169258
- }
169259
- /**
169260
- * Rejects the promise.
169261
- */
169262
- reject(_error) {
169263
- }
169264
- /**
169265
- * Creates a new deferred promise.
169266
- */
169267
- constructor() {
169268
- this.promise = new Promise((resolve, reject) => {
169269
- this.resolve = resolve;
169270
- this.reject = reject;
169271
- });
169272
- }
169273
- };
169274
-
169275
- // src/dom.ts
169276
- function inTargetElement(element, targetElement) {
169277
- let currentElement = element;
169278
- while (currentElement) {
169279
- if (currentElement === targetElement) {
169280
- return true;
169281
- }
169282
- if (!currentElement.parentNode) {
169283
- return false;
169284
- }
169285
- if (currentElement.parentNode instanceof ShadowRoot) {
169286
- currentElement = currentElement.parentNode.host;
169287
- } else {
169288
- currentElement = currentElement.parentNode;
169289
- }
169290
- }
169291
- return false;
169292
- }
169293
- function observeAncestorsMutation(element, attributeFilter, callback) {
169294
- const { subscribe } = observe(attributeFilter);
169295
- return subscribe((mutations) => {
169296
- const matched = mutations.some((mutation) => inTargetElement(element, mutation.target));
169297
- if (matched) {
169298
- callback();
169299
- }
169300
- });
169301
- }
169302
- var observers = {};
169303
- function observe(attributeFilter) {
169304
- const attributes = attributeFilter.join(",");
169305
- const previousObserver = observers[attributes];
169306
- if (previousObserver !== void 0) {
169307
- return previousObserver;
169308
- }
169309
- const subscribers = /* @__PURE__ */ new Set();
169310
- const mutationObserver = new MutationObserver((mutations) => subscribers.forEach((callback) => callback(mutations)));
169311
- mutationObserver.observe(document.documentElement, {
169312
- attributes: true,
169313
- attributeFilter,
169314
- subtree: true
169315
- });
169316
- const observer = {
169317
- subscribe(callback) {
169318
- subscribers.add(callback);
169319
- return {
169320
- remove: () => {
169321
- subscribers.delete(callback);
169322
- if (subscribers.size === 0) {
169323
- mutationObserver.disconnect();
169324
- observers[attributes] = void 0;
169325
- }
169326
- }
169327
- };
169328
- }
169329
- };
169330
- observers[attributes] = observer;
169331
- return observer;
169332
- }
169333
- function closestElement(base, selector) {
169334
- let currentElement = base;
169335
- while (currentElement) {
169336
- const element = currentElement.closest(selector);
169337
- if (element) {
169338
- return element;
169339
- }
169340
- const rootElement = currentElement.getRootNode();
169341
- if (rootElement === document) {
169342
- return null;
169343
- }
169344
- currentElement = rootElement.host;
169345
- }
169346
- return null;
169347
- }
169348
- function getElementTheme(base) {
169349
- const themeElt = closestElement(base, ":is(.calcite-mode-light, .calcite-mode-dark)");
169350
- return themeElt && themeElt.classList.contains("calcite-mode-dark") ? "dark" : "light";
169351
- }
169352
- function getElementAttribute(el, prop, fallbackValue) {
169353
- const closest = closestElement(el, `[${prop}]`);
169354
- return closest?.getAttribute(prop) ?? fallbackValue;
169355
- }
169356
- function isElement(ref) {
169357
- return ref.nodeType === Node.ELEMENT_NODE;
169358
- }
169359
- function isHTMLWithSetFocus(ref) {
169360
- return "setFocus" in ref && typeof ref.setFocus === "function";
169361
- }
169362
- function setFocus(ref, selector = "") {
169363
- if (!isElement(ref)) {
169364
- return false;
169365
- }
169366
- if (ref.matches(selector)) {
169367
- if (isHTMLWithSetFocus(ref)) {
169368
- setTimeout(() => ref.setFocus(), 0);
169369
- }
169370
- return true;
169371
- }
169372
- for (const child of ref.children) {
169373
- if (setFocus(child, selector)) {
169374
- return true;
169375
- }
169376
- }
169377
- const shadowRoot = ref.shadowRoot;
169378
- if (shadowRoot) {
169379
- for (const child of shadowRoot.children) {
169380
- if (setFocus(child, selector)) {
169381
- return true;
169382
- }
169383
- }
169384
- }
169385
- return false;
169386
- }
169387
- function setFocusOnElement(ref, selector) {
169388
- if (!ref?.shadowRoot) {
169389
- return;
169390
- }
169391
- if (ref.hasAttribute("hydrated") || ref.hasAttribute("calcite-hydrated")) {
169392
- setFocus(ref, selector);
169393
- return;
169394
- }
169395
- const mutationObserver = new MutationObserver(() => {
169396
- mutationObserver.disconnect();
169397
- setFocus(ref, selector);
169398
- });
169399
- mutationObserver.observe(ref, {
169400
- attributes: true,
169401
- attributeFilter: ["hydrated", "calcite-hydrated"]
169402
- });
169403
- }
169404
-
169405
- // src/errors.ts
169406
- function safeCall(callback, thisContext, ...rest) {
169407
- try {
169408
- return callback?.call(thisContext, ...rest);
169409
- } catch (error) {
169410
- console.error(error, callback);
169411
- }
169412
- return void 0;
169413
- }
169414
- async function safeAsyncCall(callback, thisContext, ...rest) {
169415
- try {
169416
- const result = callback?.call(thisContext, ...rest);
169417
- return result instanceof Promise ? await result : result;
169418
- } catch (error) {
169419
- console.error(error, callback);
169420
- }
169421
- return void 0;
169422
- }
169423
-
169424
- // src/guid.ts
169425
- function gen(count) {
169426
- let out = "";
169427
- for (let i = 0; i < count; i++) {
169428
- out += ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
169429
- }
169430
- return out;
169431
- }
169432
- function generateGuid() {
169433
- return [gen(2), gen(1), gen(1), gen(1), gen(3)].join("-");
169434
- }
169435
-
169436
- // src/intl.ts
169437
- var supportedLocalesArray = [
169438
- "ar",
169439
- "bg",
169440
- "bs",
169441
- "ca",
169442
- "cs",
169443
- "da",
169444
- "de",
169445
- "el",
169446
- "en",
169447
- "es",
169448
- "et",
169449
- "fi",
169450
- "fr",
169451
- "he",
169452
- "hr",
169453
- "hu",
169454
- "id",
169455
- "it",
169456
- "ja",
169457
- "ko",
169458
- "lt",
169459
- "lv",
169460
- "nl",
169461
- "nb",
169462
- "pl",
169463
- "pt-BR",
169464
- "pt-PT",
169465
- "ro",
169466
- "ru",
169467
- "sk",
169468
- "sl",
169469
- "sr",
169470
- "sv",
169471
- "th",
169472
- "tr",
169473
- "uk",
169474
- "vi",
169475
- "zh-CN",
169476
- "zh-HK",
169477
- "zh-TW"
169478
- ];
169479
- var supportedLocales = new Set(supportedLocalesArray);
169480
- var defaultLocale = "en";
169481
- var localeEquivalencies = {
169482
- // We use `pt-BR` as it will have the same translations as `pt`, which has no corresponding bundle
169483
- pt: "pt-PT",
169484
- // We support both 'nb' and 'no' (BCP 47) for Norwegian but only `nb` has corresponding bundle
169485
- no: "nb",
169486
- // We can `zh-CN` as base translation for chinese locales which has no corresponding bundle.
169487
- zh: "zh-CN"
169488
- };
169489
- async function fetchT9nStringsBundle(locale, assetsPath, prefix = "") {
169490
- const path = `${assetsPath}/${prefix}`;
169491
- const filePath = `${path}${locale}.json`;
169492
- t9nStringsCache[filePath] ?? (t9nStringsCache[filePath] = fetchBundle(locale, path));
169493
- return await t9nStringsCache[filePath];
169494
- }
169495
- var t9nStringsCache = {};
169496
- async function fetchBundle(locale, path) {
169497
- const filePath = `${path}${locale}.json`;
169498
- try {
169499
- const response = await fetch(filePath);
169500
- if (response.ok) {
169501
- return await response.json();
169502
- }
169503
- } catch (error) {
169504
- console.error(error);
169505
- return {};
169506
- }
169507
- if (locale === defaultLocale) {
169508
- return {};
169509
- }
169510
- return await fetchBundle(defaultLocale, path);
169511
- }
169512
- function getElementLocales(element) {
169513
- const lang = getElementAttribute(element, "lang", navigator.language || defaultLocale);
169514
- return { lang, t9nLocale: langToLocale(lang) };
169515
- }
169516
- function langToLocale(lang) {
169517
- const parts = lang.split("-");
169518
- const normalized = `${parts[0].toLowerCase()}${parts.slice(1).join("-").toUpperCase()}`;
169519
- if (supportedLocales.has(normalized)) {
169520
- return normalized;
169521
- }
169522
- const languageCode = normalized.slice(0, 2).toLowerCase();
169523
- const locale = localeEquivalencies[languageCode] ?? languageCode;
169524
- if (supportedLocales.has(locale)) {
169525
- return locale;
169526
- }
169527
- return defaultLocale;
169528
- }
169529
- function startLocaleObserver(element, assetsPath, onUpdated, assetName) {
169530
- let result = void 0;
169531
- const callback = () => void updateComponentLocateState(element, assetsPath, assetName).then((newResult) => {
169532
- if (result?.lang !== newResult.lang || result.t9nLocale !== newResult.t9nLocale || result.t9nStrings !== newResult.t9nStrings) {
169533
- onUpdated(newResult);
169534
- }
169535
- result = newResult;
169536
- }).catch(console.error);
169537
- callback();
169538
- return observeAncestorsMutation(element, ["lang"], callback);
169539
- }
169540
- async function updateComponentLocateState(element, assetsPath, assetName = element.tagName.toLowerCase().replace("arcgis-", "")) {
169541
- const { lang, t9nLocale } = getElementLocales(element);
169542
- const t9nAssetsPath = `${assetsPath}/${assetName}/t9n`;
169543
- const prefix = `${assetName}.t9n.`;
169544
- const t9nStrings = await fetchT9nStringsBundle(t9nLocale, t9nAssetsPath, prefix);
169545
- return { lang, t9nLocale, t9nStrings };
169546
- }
169547
-
169548
- // src/strings.ts
169549
- var doubleQuote = '"';
169550
- var singleQuote = "'";
169551
- function repeatString(value, n) {
169552
- return new Array(n + 1).join(value);
169553
- }
169554
- function quoteString(value) {
169555
- let quote = doubleQuote;
169556
- let alternateQuote = singleQuote;
169557
- const avoidEscape = value.includes(quote) && !value.includes(alternateQuote);
169558
- if (avoidEscape) {
169559
- alternateQuote = doubleQuote;
169560
- quote = singleQuote;
169561
- }
169562
- const alternateEscape = new RegExp(`(^|[^\\\\])((?:\\\\{2})*)((?:\\\\${alternateQuote})+)`, "gu");
169563
- value = value.replace(
169564
- alternateEscape,
169565
- (_, boundaryChar, leadingEscapedSlashes, escapedQuoteChars) => (
169566
- // We divide the escapedQuoteChars by 2 since there are 2 characters in each escaped part ('\\"'.length === 2)
169567
- boundaryChar + leadingEscapedSlashes + repeatString(alternateQuote, escapedQuoteChars.length / 2)
169568
- )
169569
- );
169570
- const quoteEscape = new RegExp(`(^|[^\\\\])((?:\\\\{2})*)(${quote}+)`, "gu");
169571
- value = value.replace(
169572
- quoteEscape,
169573
- (_, boundaryChar, leadingEscapedSlashes, quoteChars) => boundaryChar + leadingEscapedSlashes + repeatString(`\\${quote}`, quoteChars.length)
169574
- );
169575
- return quote + value + quote;
169576
- }
169577
- function createFilterExpression(filterWord) {
169578
- const sanitizedWord = filterWord ? filterWord.replaceAll(/[-[\]/{}()*+?.\\^$|]/gu, "\\$&") : "^.*$";
169579
- return new RegExp(sanitizedWord, "i");
169580
- }
169581
- function setValuesInString(message, values = {}) {
169582
- return (message ?? "").replace(/\{(?<valueName>.*?)\}/gu, (match, valueName) => values[valueName] ?? match);
169583
- }
169584
- function addLTRMark(value) {
169585
- return `\u200E${value ?? ""}\u200E`;
169586
- }
169587
-
169588
- // src/timeouts.ts
169589
- function devToolsAwareTimeout(callback, timeout) {
169590
- const interval = timeout > longTimeoutThreshold ? longTimeoutInterval : timeout / shortTimeoutIntervals;
169591
- let elapsed = 0;
169592
- const reference = setInterval(() => {
169593
- elapsed += interval;
169594
- if (elapsed >= timeout) {
169595
- clearInterval(reference);
169596
- callback();
169597
- }
169598
- }, interval);
169599
- return reference;
169600
- }
169601
- var longTimeoutThreshold = 4e3;
169602
- var longTimeoutInterval = 2e3;
169603
- var shortTimeoutIntervals = 4;
169604
-
169605
- // src/type-guards.ts
169606
- function isNotNull(item) {
169607
- return item !== null;
169608
- }
169609
- function isNotUndefined(item) {
169610
- return item !== void 0;
169611
- }
169612
-
169613
- // src/ui.ts
169614
- function debounce(func, waitFor = 100) {
169615
- let timeout;
169616
- return (...args) => {
169617
- const later = () => {
169618
- clearTimeout(timeout);
169619
- func(...args);
169620
- };
169621
- clearTimeout(timeout);
169622
- timeout = setTimeout(later, waitFor);
169623
- };
169624
- }
169625
-
169626
- // src/url.ts
169627
- function hasSameOrigin(url1, url2, ignoreProtocol = false) {
169628
- if (!url1 || !url2) {
169629
- return false;
169630
- }
169631
- const url1Obj = new URL(url1);
169632
- const url2Obj = new URL(url2);
169633
- if (!ignoreProtocol && url1Obj.protocol !== url2Obj.protocol) {
169634
- return false;
169635
- }
169636
- if (url1Obj.host == null || url2Obj.host == null) {
169637
- return false;
169638
- }
169639
- return url1Obj.host.toLowerCase() === url2Obj.host.toLowerCase() && url1Obj.port === url2Obj.port;
169640
- }
169641
- function isURL(url) {
169642
- try {
169643
- new URL(url);
169644
- return true;
169645
- } catch (e) {
169646
- return false;
169647
- }
169648
- }
169649
-
169650
- /**
169651
- * Filters a collection of items by the given keys and filter word.
169652
- */
169653
- function filterCollection(collection, keys, filterWord, beforeFilteringFn) {
169654
- if (!keys) {
169655
- return [];
169656
- }
169657
- const _keys = !Array.isArray(keys) ? [keys] : keys;
169658
- if (!_keys.length) {
169659
- return [];
169660
- }
169661
- const filterExpression = createFilterExpression(filterWord);
169662
- return collection.filter((item) => {
169663
- if (beforeFilteringFn) {
169664
- const res = beforeFilteringFn(item);
169665
- if (res !== null || res !== undefined) {
169666
- return res;
169667
- }
169668
- }
169669
- return _keys.some((key) => filterExpression.test(String(item[key] ?? "")));
169670
- });
169671
- }
169672
- /**
169673
- * Returns the url to the portal item.
169674
- */
169675
- function portalItemPageUrl(portalItem) {
169676
- if (!portalItem) {
169677
- return "";
169678
- }
169679
- return `${portalItem.portal.url}/home/item.html?id=${portalItem.id}`;
169680
- }
169681
- //#endregion
169682
-
169683
- /**
169684
- * Returns an icon name for the field type
169685
- */
169686
- function fieldTypeToIconName(field) {
169687
- switch (field.type) {
169688
- case "oid":
169689
- return "key";
169690
- case "small-integer":
169691
- case "big-integer":
169692
- case "integer":
169693
- case "single":
169694
- case "double":
169695
- case "long":
169696
- return "number";
169697
- case "global-id":
169698
- case "guid":
169699
- return "key";
169700
- case "string":
169701
- return "string";
169702
- case "date":
169703
- return "date-time";
169704
- case "date-only":
169705
- return "calendar";
169706
- case "time-only":
169707
- return "clock";
169708
- case "timestamp-offset":
169709
- return "time-zone";
169710
- default:
169711
- return "cube";
169712
- }
169713
- }
169714
- /**
169715
- * Returns the Arcade type for the given field.
169716
- */
169717
- function fieldTypeToArcadeType(field) {
169718
- switch (field.type) {
169719
- case "small-integer":
169720
- case "integer":
169721
- case "big-integer":
169722
- case "single":
169723
- case "double":
169724
- case "long":
169725
- case "oid":
169726
- return "number";
169727
- case "global-id":
169728
- case "guid":
169729
- case "string":
169730
- return "text";
169731
- case "date":
169732
- return "date";
169733
- case "date-only":
169734
- return "dateOnly";
169735
- case "time-only":
169736
- return "time";
169737
- default:
169738
- return "text";
169739
- }
169740
- }
169741
- function supportedFields(fields) {
169742
- return (fields ?? []).filter((field) => {
169743
- switch (field.type) {
169744
- case "string":
169745
- case "small-integer":
169746
- case "integer":
169747
- case "big-integer":
169748
- case "single":
169749
- case "double":
169750
- case "long":
169751
- case "date":
169752
- case "date-only":
169753
- case "time-only":
169754
- case "timestamp-offset":
169755
- case "oid":
169756
- case "guid":
169757
- case "global-id":
169758
- return true;
169759
- default:
169760
- return false;
169761
- }
169762
- });
169763
- }
169764
- function fieldAlias(field) {
169765
- return field.alias || field.name;
169766
- }
169767
-
169768
169766
  //#endregion
169769
169767
  //#region Support functions
169770
169768
  async function getRelatedFeatureLayer(layer, relationship) {
@@ -169780,14 +169778,6 @@ function sortFields(layer) {
169780
169778
  if (secondField.type === "oid") {
169781
169779
  return 1;
169782
169780
  }
169783
- if (isSubtypeSublayerInstance(layer)) {
169784
- if (firstField.name === layer.parent.subtypeField) {
169785
- return -1;
169786
- }
169787
- if (secondField.name === layer.parent.subtypeField) {
169788
- return 1;
169789
- }
169790
- }
169791
169781
  if (isSubtypeFieldCapableLayer(layer)) {
169792
169782
  if (firstField.name === layer.subtypeField) {
169793
169783
  return -1;
@@ -169825,86 +169815,28 @@ function assembleMemberExpression(obj, prop) {
169825
169815
  return `${obj}${getMemberExpressionProperty(prop)}`;
169826
169816
  }
169827
169817
  function getMapPortalItem(map) {
169828
- if (isWebMapInstance(map) || isWebSceneInstance(map)) {
169818
+ if (isPortalItemCapable(map)) {
169829
169819
  return map.portalItem;
169830
169820
  }
169831
169821
  return null;
169832
169822
  }
169833
- //#endregion
169834
- //#region Editor Profile to Language Service Profile functions
169835
- async function variablesToLSVariable(editorVariables, kind = main.exports.CompletionItemKind.Variable) {
169836
- return await Promise.all(editorVariables.map(async (editorVariable) => {
169837
- switch (editorVariable.type) {
169838
- case "dictionary":
169839
- return await dictionaryToLSDictionary(editorVariable, kind);
169840
- case "feature":
169841
- return await featureToLSFeature(editorVariable, kind);
169842
- default:
169843
- return variableToLSVariable(editorVariable, kind);
169844
- }
169845
- }));
169846
- }
169847
- function variableToLSVariable(editorVariable, kind) {
169848
- const { name, type } = editorVariable;
169849
- const description = editorVariable.getDescription();
169850
- return {
169851
- name,
169852
- description,
169853
- type,
169854
- completion: {
169855
- label: name,
169856
- detail: name,
169857
- insertText: name,
169858
- insertTextMode: main.exports.InsertTextMode.asIs,
169859
- insertTextFormat: main.exports.InsertTextFormat.PlainText,
169860
- kind,
169861
- documentation: { kind: "markdown", value: description },
169862
- },
169863
- };
169864
- }
169865
- async function featureToLSFeature(editorFeature, kind) {
169866
- // Get the source for the definition
169867
- const source = await editorFeature.loadSource();
169868
- const { name } = editorFeature;
169869
- const description = editorFeature.getDescription();
169870
- const resultCompletion = {
169871
- label: name,
169872
- detail: name,
169873
- insertText: name,
169874
- insertTextMode: main.exports.InsertTextMode.asIs,
169875
- insertTextFormat: main.exports.InsertTextFormat.PlainText,
169876
- kind,
169877
- };
169878
- const result = {
169879
- name,
169880
- description,
169881
- type: "dictionary",
169882
- properties: [],
169883
- completion: resultCompletion,
169884
- };
169885
- // No source definition, then it will be a feature without any known fields
169886
- if (!source) {
169887
- return result;
169888
- }
169889
- // Create properties for the fields and the aliases
169890
- // Also improve the feature completion documentation
169891
- let featureCompletionDescription = description;
169823
+ /**
169824
+ * converts fields to profile values and calculates the feature completion description all in one iteration
169825
+ */
169826
+ function fieldsToProfileValues(fields, initialFeatureCompletionDescription, includeAliases = false) {
169827
+ let featureCompletionDescription = initialFeatureCompletionDescription;
169892
169828
  const fieldProfileValues = [];
169893
169829
  const aliasProfileValues = [];
169894
- supportedFields(source.fields).forEach((field) => {
169895
- let fieldCompletionDescription = `**${field.name}** \n${field.type}`;
169896
- if (field.description) {
169897
- fieldCompletionDescription += ` \n'${field.description}`;
169898
- }
169830
+ supportedFields(fields).forEach((field) => {
169899
169831
  if (featureCompletionDescription) {
169900
169832
  featureCompletionDescription += " \n \n";
169901
169833
  }
169902
- featureCompletionDescription += `**${field.name}** (${fieldAlias(field)}) \n${field.type}`;
169834
+ featureCompletionDescription += `**${field.name}** (${field.alias}) \n${field.type}`;
169903
169835
  if (field.description) {
169904
169836
  featureCompletionDescription += ` \n'${field.description}`;
169905
169837
  }
169906
169838
  // The property for the field
169907
- const type = fieldTypeToArcadeType(field);
169839
+ const type = fieldTypeToApiValueVarType(field);
169908
169840
  const insertText = getMemberExpressionProperty(field.name, false);
169909
169841
  const description = fieldAlias(field);
169910
169842
  fieldProfileValues.push({
@@ -169918,65 +169850,35 @@ async function featureToLSFeature(editorFeature, kind) {
169918
169850
  insertTextMode: main.exports.InsertTextMode.asIs,
169919
169851
  insertTextFormat: main.exports.InsertTextFormat.PlainText,
169920
169852
  kind: main.exports.CompletionItemKind.Field,
169921
- documentation: { kind: "markdown", value: fieldCompletionDescription },
169922
169853
  },
169923
169854
  });
169924
- if (!field.alias || field.alias.toLowerCase() === field.name.toLowerCase()) {
169925
- return;
169926
- }
169927
- // The property for the alias if different than the field name
169928
- let aliasCompletionDescription = `**${field.alias}** \n${field.type}`;
169929
- if (field.description) {
169930
- aliasCompletionDescription += ` \n'${field.description}`;
169855
+ if (includeAliases) {
169856
+ if (!field.alias || field.alias.toLowerCase() === field.name.toLowerCase()) {
169857
+ return;
169858
+ }
169859
+ // The property for the alias if different than the field name
169860
+ let aliasCompletionDescription = `**${field.alias}** \n${field.type}`;
169861
+ if (field.description) {
169862
+ aliasCompletionDescription += ` \n'${field.description}`;
169863
+ }
169864
+ aliasProfileValues.push({
169865
+ name: field.alias,
169866
+ description: field.name,
169867
+ type,
169868
+ completion: {
169869
+ label: field.alias,
169870
+ detail: field.name,
169871
+ insertText,
169872
+ insertTextMode: main.exports.InsertTextMode.asIs,
169873
+ insertTextFormat: main.exports.InsertTextFormat.PlainText,
169874
+ kind: main.exports.CompletionItemKind.Field,
169875
+ documentation: { kind: "markdown", value: aliasCompletionDescription },
169876
+ },
169877
+ });
169931
169878
  }
169932
- aliasProfileValues.push({
169933
- name: field.alias,
169934
- description: field.name,
169935
- type,
169936
- completion: {
169937
- label: field.alias,
169938
- detail: field.name,
169939
- insertText,
169940
- insertTextMode: main.exports.InsertTextMode.asIs,
169941
- insertTextFormat: main.exports.InsertTextFormat.PlainText,
169942
- kind: main.exports.CompletionItemKind.Field,
169943
- documentation: { kind: "markdown", value: aliasCompletionDescription },
169944
- },
169945
- });
169946
169879
  });
169947
- result.properties = [...fieldProfileValues, ...aliasProfileValues];
169948
- resultCompletion.documentation = { kind: "markdown", value: featureCompletionDescription };
169949
- return result;
169950
- }
169951
- async function dictionaryToLSDictionary(editorDictionary, kind) {
169952
- const { name, dictionaryVariables: variables } = editorDictionary;
169953
- const description = editorDictionary.getDescription();
169954
- const completionDescription = variables.reduce((previous, p) => {
169955
- if (previous !== "") {
169956
- previous += " \n \n";
169957
- }
169958
- previous += `**${p.name}** \n${p.type}`;
169959
- const description = p.getDescription();
169960
- if (description) {
169961
- previous += ` \n${description}`;
169962
- }
169963
- return previous;
169964
- }, description);
169965
- return {
169966
- name,
169967
- description,
169968
- type: "dictionary",
169969
- properties: await variablesToLSVariable(variables, main.exports.CompletionItemKind.Field),
169970
- completion: {
169971
- label: name,
169972
- detail: name,
169973
- insertText: name,
169974
- insertTextMode: main.exports.InsertTextMode.asIs,
169975
- insertTextFormat: main.exports.InsertTextFormat.PlainText,
169976
- kind,
169977
- documentation: { kind: "markdown", value: completionDescription },
169978
- },
169979
- };
169880
+ const properties = [...fieldProfileValues, ...aliasProfileValues];
169881
+ return [properties, featureCompletionDescription];
169980
169882
  }
169981
169883
  /**
169982
169884
  * Represents a item in the EditorProfile. The profile is converted into an optimized way for
@@ -170510,7 +170412,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
170510
170412
  const relationshipsGroup = new GroupOfVariables(this._profile, { code: "relationships" });
170511
170413
  const relationshipItems = await Promise.all(source.relationships.map(async (relationship) => {
170512
170414
  const relatedLayer = await getRelatedFeatureLayer(source, relationship);
170513
- if (!isQueryableLayerInstance(relatedLayer)) {
170415
+ if (!isFeatureLayerLikeInstance(relatedLayer)) {
170514
170416
  return null;
170515
170417
  }
170516
170418
  if (relationship.relatedTableId === this.relationshipsProperties?.sourceTableId) {
@@ -170554,7 +170456,7 @@ class FeatureVariable extends SourceBasedVariable {
170554
170456
  throw new Error("Invalid definition");
170555
170457
  }
170556
170458
  // The title group and snippet
170557
- const title = isTitleCapableSource(this._source) ? this._source.title ?? "" : "";
170459
+ const title = isTitleCapableSource(this._source) ? (this._source.title ?? "") : "";
170558
170460
  this.variables.push(new GroupOfVariables(this._profile, title, [
170559
170461
  new ValueVariable({
170560
170462
  profile: this._profile,
@@ -170681,13 +170583,14 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
170681
170583
  if (typeof this._featureSetCollections.source === "string") {
170682
170584
  return this._profile?.intlStrings.featureservice ?? "featureservice";
170683
170585
  }
170684
- if (isWebSceneInstance(this._featureSetCollections.source)) {
170685
- return this._profile?.intlStrings.webscene ?? "webscene";
170686
- }
170687
- if (isWebMapInstance(this._featureSetCollections.source)) {
170688
- return this._profile?.intlStrings.webmap ?? "webmap";
170586
+ switch (this._featureSetCollections.source.declaredClass) {
170587
+ case "esri.WebMap":
170588
+ return this._profile?.intlStrings.webmap ?? "webmap";
170589
+ case "esri.WebScene":
170590
+ return this._profile?.intlStrings.webscene ?? "webscene";
170591
+ default:
170592
+ return this._profile?.intlStrings.map ?? "map";
170689
170593
  }
170690
- return this._profile?.intlStrings.map ?? "map";
170691
170594
  }
170692
170595
  async loadSource() {
170693
170596
  if (isNotNull(this._loadPromise) && isNotUndefined(this._loadPromise)) {
@@ -170754,7 +170657,7 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
170754
170657
  return null;
170755
170658
  }
170756
170659
  async _featureSetCollectionFromMap(map) {
170757
- if (isLoadableMapInstance(map)) {
170660
+ if (isLoadAllCapable(map)) {
170758
170661
  // Make sure the map is loaded
170759
170662
  await map.loadAll();
170760
170663
  }
@@ -170812,11 +170715,11 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
170812
170715
  .toArray()
170813
170716
  .reverse()
170814
170717
  .forEach((layer) => {
170815
- if (isQueryableLayerInstance(layer)) {
170718
+ if (isFeatureLayerLikeInstance(layer)) {
170816
170719
  layerVariables.push(this._createFeatureSetVariable(layer, true));
170817
170720
  return;
170818
170721
  }
170819
- if (isGroupLayerInstance(layer)) {
170722
+ if (isGroupLayerCapable(layer)) {
170820
170723
  const groupLayerVariables = filteringTables
170821
170724
  ? this._convertWebMapLayersToVariables(layer.allTables, true)
170822
170725
  : this._convertWebMapLayersToVariables(layer.allLayers);
@@ -170825,31 +170728,31 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
170825
170728
  });
170826
170729
  return layerVariables;
170827
170730
  }
170828
- _createFeatureSetVariable(featureLayer, isFromWebMap = false) {
170731
+ _createFeatureSetVariable(featureLayerLike, isFromWebMap = false) {
170829
170732
  return new FeatureSetVariable(this, {
170830
170733
  profile: this._profile,
170831
- declaration: { name: featureLayer.title, definition: featureLayer },
170734
+ declaration: { name: featureLayerLike.title, definition: featureLayerLike },
170832
170735
  label: isFromWebMap
170833
- ? featureLayer.title
170834
- : featureLayer.sourceJSON.name ?? featureLayer.title,
170736
+ ? featureLayerLike.title
170737
+ : (featureLayerLike.sourceJSON.name ?? featureLayerLike.title),
170835
170738
  description: "",
170836
170739
  nonInteractive: true,
170837
- }, this._makeFeatureSetSnippets(featureLayer, isFromWebMap));
170740
+ }, this._makeFeatureSetSnippets(featureLayerLike, isFromWebMap));
170838
170741
  }
170839
- _makeFeatureSetSnippets(featureLayer, isFromWebMap = false) {
170742
+ _makeFeatureSetSnippets(featureLayerLike, isFromWebMap = false) {
170840
170743
  if (!this._profile?.supportFeatureSetFunctions) {
170841
170744
  return [];
170842
170745
  }
170843
170746
  if (isFromWebMap) {
170844
- const snippetById = `FeatureSetById(${this.snippet}, "${featureLayer.id}")`;
170845
- const snippetByName = `FeatureSetByName(${this.snippet}, "${featureLayer.title}")`;
170747
+ const snippetById = `FeatureSetById(${this.snippet}, "${featureLayerLike.id}")`;
170748
+ const snippetByName = `FeatureSetByName(${this.snippet}, "${featureLayerLike.title}")`;
170846
170749
  return [
170847
170750
  new ValueVariable({ profile: this._profile, label: snippetById, description: "", snippet: snippetById }),
170848
170751
  new ValueVariable({ profile: this._profile, label: snippetByName, description: "", snippet: snippetByName }),
170849
170752
  ];
170850
170753
  }
170851
170754
  else {
170852
- const snippetById = `FeatureSetById(${this.snippet}, "${featureLayer.layerId}")`;
170755
+ const snippetById = `FeatureSetById(${this.snippet}, "${featureLayerLike.layerId}")`;
170853
170756
  return [new ValueVariable({ profile: this._profile, label: snippetById, description: "", snippet: snippetById })];
170854
170757
  }
170855
170758
  }
@@ -170887,14 +170790,6 @@ class EditorProfile extends DictionaryVariable {
170887
170790
  get supportFeatureSetFunctions() {
170888
170791
  return this.definition?.bundles?.includes("data-access") ?? false;
170889
170792
  }
170890
- /**
170891
- * Returns the language service profile. It is different than the editor profile as it is optimized for Monaco.
170892
- */
170893
- async toLSProfile() {
170894
- const { apiVersion, bundles, hiddenApiItems } = this.definition ?? {};
170895
- const variables = await variablesToLSVariable(this.dictionaryVariables);
170896
- return { apiVersion, bundles, variables, hiddenApiItems: hiddenApiItems?.map((s) => s.toLowerCase()) };
170897
- }
170898
170793
  /**
170899
170794
  * Returns the EditorProfile as a json. The EditorProfile may have been updated. This function allows to
170900
170795
  * get the new json representing mutations.
@@ -170908,144 +170803,6 @@ class EditorProfile extends DictionaryVariable {
170908
170803
  }
170909
170804
  //#endregion
170910
170805
 
170911
- function isFeatureDefinition(item) {
170912
- return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
170913
- }
170914
- function isFeatureSetDefinition(item) {
170915
- return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
170916
- }
170917
- function isFeatureSetCollectionDefinition(item) {
170918
- return isPortalItemDefinition(item) || isMapInstance(item) || isSupportedServiceUrlDefinition(item);
170919
- }
170920
- /**
170921
- * Get a PredefinedProfile for a locale. If not already loaded then fetch it.
170922
- * If the locale doesn't exist or the locale profile file doesn't exist then returns
170923
- * the english version of the profile.
170924
- */
170925
- async function getSdkPredefinedProfiles(locale = "en") {
170926
- const profiles = sdkPredefinedProfilesMap.get(locale);
170927
- if (profiles) {
170928
- return profiles;
170929
- }
170930
- if (!supportedLocales.has(locale)) {
170931
- return await getSdkPredefinedProfiles("en");
170932
- }
170933
- try {
170934
- const response = await fetch(index.getAssetPath(`./assets/arcade-language/profiles/arcade-profiles.t9n.${locale}.json`));
170935
- if (response.ok) {
170936
- return cacheSdkPredefinedProfiles(locale, (await response.json()));
170937
- }
170938
- if (locale === "en") {
170939
- return null;
170940
- }
170941
- return await getSdkPredefinedProfiles("en");
170942
- }
170943
- catch {
170944
- return null;
170945
- }
170946
- }
170947
- const sdkPredefinedProfilesMap = new Map();
170948
- /**
170949
- * Convert a stored profile into a PredefinedProfile and add it to the in-memory
170950
- * Map of profiles per locale.
170951
- */
170952
- function cacheSdkPredefinedProfiles(locale, profiles) {
170953
- const map = new Map();
170954
- profiles.forEach((profile) => {
170955
- map.set(profile.id, profile);
170956
- });
170957
- sdkPredefinedProfilesMap.set(locale, map);
170958
- return map;
170959
- }
170960
- async function getSdkPredefinedProfile(id, locale = "en") {
170961
- const profiles = await getSdkPredefinedProfiles(locale);
170962
- return profiles?.get(id) ?? null;
170963
- }
170964
- function isExtendedPredefinedProfileDefinition(item) {
170965
- return !!item && typeof item === "object" && "additionalVariables" in item && Array.isArray(item.additionalVariables);
170966
- }
170967
- function convertApiVariables(variables) {
170968
- return variables?.map(convertApiVariable);
170969
- }
170970
- function convertApiVariable(variable) {
170971
- switch (variable.type) {
170972
- case "dictionary":
170973
- return {
170974
- ...variable,
170975
- type: variable.type,
170976
- properties: convertApiVariables(variable.properties),
170977
- };
170978
- case "array": {
170979
- return {
170980
- ...variable,
170981
- type: variable.type,
170982
- elementType: { type: "number", name: "number" },
170983
- };
170984
- }
170985
- default:
170986
- return { ...variable, type: variable.type };
170987
- }
170988
- }
170989
- async function convertToEditorProfileDefinition(predefinedProfile, locale = "en") {
170990
- if (!isPredefinedProfile(predefinedProfile)) {
170991
- return undefined;
170992
- }
170993
- const sdkPredefinedProfile = await getSdkPredefinedProfile(predefinedProfile.id, locale);
170994
- if (!sdkPredefinedProfile) {
170995
- return undefined;
170996
- }
170997
- const editorProfile = {
170998
- bundles: [...sdkPredefinedProfile.bundles],
170999
- variables: [],
171000
- hiddenApiItems: predefinedProfile.hiddenApiItems?.map((s) => s.toLowerCase()),
171001
- };
171002
- // Merge the SDK variables' definitions/properties with the predefined profile definitions.
171003
- sdkPredefinedProfile.variables.forEach((predefinedVariable) => {
171004
- // Don't include disabled variables
171005
- if (predefinedProfile.disabledVariables?.includes(predefinedVariable.name)) {
171006
- return;
171007
- }
171008
- // Try to get a definition from the predefined profile, for the variable that needs one.
171009
- const definition = predefinedProfile.definitions[predefinedVariable.name];
171010
- // Note: Something is weird with TS. The sdkVariables are being casted to the wrong type
171011
- // despite the type checking from the switch statement.
171012
- switch (predefinedVariable.type) {
171013
- case "dictionary": {
171014
- // For dictionary, we support properties overrride
171015
- return editorProfile.variables.push(convertApiVariable({
171016
- ...predefinedVariable,
171017
- type: predefinedVariable.type,
171018
- properties: Array.isArray(definition) ? [...definition] : predefinedVariable.properties,
171019
- }));
171020
- }
171021
- case "feature":
171022
- // If the definition is not valid, then we don't include it.
171023
- if (!isFeatureDefinition(definition)) {
171024
- return;
171025
- }
171026
- return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
171027
- case "featureSet":
171028
- // If the definition is not valid, then we don't include it.
171029
- if (!isFeatureSetDefinition(definition)) {
171030
- return;
171031
- }
171032
- return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
171033
- case "featureSetCollection":
171034
- // If the definition is not valid, then we don't include it.
171035
- if (!isFeatureSetCollectionDefinition(definition)) {
171036
- return;
171037
- }
171038
- return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
171039
- default:
171040
- return editorProfile.variables.push(convertApiVariable(predefinedVariable));
171041
- }
171042
- });
171043
- if (isExtendedPredefinedProfileDefinition(predefinedProfile)) {
171044
- editorProfile.variables.push(...(predefinedProfile.additionalVariables ?? []));
171045
- }
171046
- return editorProfile;
171047
- }
171048
-
171049
170806
  // this file contains the building blocks for a language default provider
171050
170807
  const defaultContext = {
171051
170808
  locale: "en",
@@ -171144,12 +170901,12 @@ exports.Range = Range;
171144
170901
  exports.Uri = Uri;
171145
170902
  exports.addLTRMark = addLTRMark;
171146
170903
  exports.commonjsGlobal = commonjsGlobal;
171147
- exports.convertToEditorProfileDefinition = convertToEditorProfileDefinition;
171148
170904
  exports.createFilterExpression = createFilterExpression;
171149
170905
  exports.debounce = debounce;
171150
170906
  exports.devToolsAwareTimeout = devToolsAwareTimeout;
171151
170907
  exports.editor = editor;
171152
170908
  exports.fetchT9nStringsBundle = fetchT9nStringsBundle;
170909
+ exports.fieldsToProfileValues = fieldsToProfileValues;
171153
170910
  exports.filterCollection = filterCollection;
171154
170911
  exports.generateGuid = generateGuid;
171155
170912
  exports.generateTokensCSSForColorMap = generateTokensCSSForColorMap;
@@ -171158,6 +170915,8 @@ exports.getElementTheme = getElementTheme;
171158
170915
  exports.hasSameOrigin = hasSameOrigin;
171159
170916
  exports.importArcade = importArcade;
171160
170917
  exports.importRequest = importRequest;
170918
+ exports.isFeatureDefinition = isFeatureDefinition;
170919
+ exports.isFeatureSetCollectionDefinition = isFeatureSetCollectionDefinition;
171161
170920
  exports.isFeatureSetDefinition = isFeatureSetDefinition;
171162
170921
  exports.isNotUndefined = isNotUndefined;
171163
170922
  exports.isPredefinedProfile = isPredefinedProfile;
@@ -171173,4 +170932,5 @@ exports.setFocusOnElement = setFocusOnElement;
171173
170932
  exports.setValuesInString = setValuesInString;
171174
170933
  exports.startLocaleObserver = startLocaleObserver;
171175
170934
  exports.supportedFields = supportedFields;
170935
+ exports.supportedLocales = supportedLocales;
171176
170936
  exports.typescriptDefaults = typescriptDefaults;