@arcgis/coding-components 4.31.0-next.2 → 4.31.0-next.21

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 (205) 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/css.worker.js +1 -1
  43. package/dist/arcgis-coding-components/assets/code-editor/html.worker.js +1 -1
  44. package/dist/arcgis-coding-components/assets/code-editor/json.worker.js +1 -1
  45. package/dist/arcgis-coding-components/assets/code-editor/sql-expr.worker.js +33 -0
  46. package/dist/arcgis-coding-components/assets/code-editor/ts.worker.js +1 -1
  47. package/dist/arcgis-coding-components/assets/language-api-panel/t9n/language-api-panel.t9n.ca.json +1 -1
  48. package/dist/arcgis-coding-components/assets/sql-expression-editor/api/sql-expression-api.t9n.en.json +735 -0
  49. package/dist/arcgis-coding-components/index.esm.js +2 -2
  50. package/dist/arcgis-coding-components/{p-7984ea8e.js → p-1b799777.js} +2 -2
  51. package/dist/arcgis-coding-components/p-4d5cf512.entry.js +6 -0
  52. package/dist/arcgis-coding-components/{p-60c2a820.js → p-56266a64.js} +2 -2
  53. package/dist/arcgis-coding-components/{p-e8211ffe.js → p-57b8bcd7.js} +1 -1
  54. package/dist/arcgis-coding-components/{p-9eced6fc.js → p-5b67b62b.js} +2 -2
  55. package/dist/arcgis-coding-components/{p-93a97573.js → p-64137fec.js} +3 -3
  56. package/dist/arcgis-coding-components/{p-e7ee4d64.js → p-6621a80f.js} +3 -3
  57. package/dist/arcgis-coding-components/p-77dd5521.js +6 -0
  58. package/dist/arcgis-coding-components/p-8eb7e694.js +6 -0
  59. package/dist/arcgis-coding-components/p-a2341e0c.js +6 -0
  60. package/dist/arcgis-coding-components/{p-bb7e832e.js → p-b715834b.js} +3 -3
  61. package/dist/arcgis-coding-components/p-cbee273f.js +6 -0
  62. package/dist/arcgis-coding-components/{p-5ef7cce5.js → p-cdc52d2f.js} +1 -1
  63. package/dist/arcgis-coding-components/{p-36fedc23.js → p-d7d1f130.js} +12 -12
  64. package/dist/arcgis-coding-components/p-e1f9b463.entry.js +6 -0
  65. package/dist/arcgis-coding-components/{p-62ee6251.js → p-e5a924a1.js} +1 -1
  66. package/dist/arcgis-coding-components/p-f2d64a9d.js +6 -0
  67. package/dist/arcgis-coding-components/{p-03ea6cd7.js → p-ff62d134.js} +3 -3
  68. package/dist/arcgis-coding-components/p-ffce0588.entry.js +6 -0
  69. package/dist/cjs/{app-globals-aee5f4b5.js → app-globals-a9ef3ca8.js} +1 -1
  70. package/dist/cjs/arcade-defaults-f5241680.js +349 -0
  71. package/dist/cjs/arcade-language-features-0b9f3947.js +274 -0
  72. package/dist/cjs/arcade-mode-cc08d9cd.js +335 -0
  73. package/dist/cjs/arcgis-arcade-editor_6.cjs.entry.js +181 -1501
  74. package/dist/cjs/arcgis-coding-components.cjs.js +4 -4
  75. package/dist/cjs/arcgis-sql-expression-editor.cjs.entry.js +81 -0
  76. package/dist/cjs/arcgis-sql-expression-fields.cjs.entry.js +80 -0
  77. package/dist/cjs/{css-7cc05f76.js → css-bb6a49ec.js} +1 -1
  78. package/dist/cjs/{cssMode-2b0daeae.js → cssMode-e7fac7d7.js} +3 -4
  79. package/dist/cjs/{html-f56911e1.js → html-7ff4071d.js} +3 -4
  80. package/dist/cjs/{htmlMode-43eed674.js → htmlMode-c89193ec.js} +3 -4
  81. package/dist/cjs/{index-b34238a6.js → index-4b7880ab.js} +9 -1
  82. package/dist/cjs/index.cjs.js +4 -3
  83. package/dist/cjs/{javascript-5115cb76.js → javascript-864c0220.js} +3 -4
  84. package/dist/cjs/{jsonMode-550dda36.js → jsonMode-ac4a7be7.js} +3 -4
  85. package/dist/cjs/{arcade-defaults-a8d8f8e2.js → language-defaults-base-57b37f9f.js} +842 -1183
  86. package/dist/cjs/loader.cjs.js +4 -4
  87. package/dist/cjs/sql-expr-defaults-245b036d.js +1347 -0
  88. package/dist/cjs/sql-expr-mode-304f5ce2.js +20844 -0
  89. package/dist/cjs/{tsMode-336306a9.js → tsMode-d30d4ab1.js} +4 -5
  90. package/dist/cjs/{typescript-b395242f.js → typescript-6c87ddb3.js} +3 -4
  91. package/dist/components/arcade-defaults.js +54 -1369
  92. package/dist/components/arcade-language-features.js +271 -0
  93. package/dist/components/arcade-mode.js +4 -264
  94. package/dist/components/arcade-results.js +7 -5
  95. package/dist/components/arcade-suggestions.js +7 -5
  96. package/dist/components/arcade-variables.js +8 -6
  97. package/dist/components/arcgis-arcade-editor.js +37 -35
  98. package/dist/components/arcgis-arcade-results.js +1 -1
  99. package/dist/components/arcgis-arcade-suggestions.js +1 -1
  100. package/dist/components/arcgis-arcade-variables.js +1 -1
  101. package/dist/components/arcgis-assets.d.ts +1 -1
  102. package/dist/components/arcgis-assets.js +1 -1
  103. package/dist/components/arcgis-code-editor.js +1 -1
  104. package/dist/components/arcgis-language-api-panel.js +1 -1
  105. package/dist/components/arcgis-sql-expression-editor.d.ts +11 -0
  106. package/dist/components/arcgis-sql-expression-editor.js +120 -0
  107. package/dist/components/arcgis-sql-expression-fields.d.ts +11 -0
  108. package/dist/components/arcgis-sql-expression-fields.js +11 -0
  109. package/dist/components/chunk-2JTWBRMN.js +1154 -0
  110. package/dist/components/code-editor.js +40 -13
  111. package/dist/components/fields.js +5 -5
  112. package/dist/components/index.js +1 -1
  113. package/dist/components/index2.js +30 -22
  114. package/dist/components/language-api-panel.js +13 -40
  115. package/dist/components/language-defaults-base.js +1309 -0
  116. package/dist/components/markdown.js +1 -1
  117. package/dist/components/sql-expr-defaults.js +196 -0
  118. package/dist/components/sql-expr-mode.js +20842 -0
  119. package/dist/components/sql-expression-fields.js +102 -0
  120. package/dist/components/useT9n.js +45 -8
  121. package/dist/components/utilities.js +1 -1
  122. package/dist/esm/{app-globals-59faaf33.js → app-globals-6d0ca11d.js} +1 -1
  123. package/dist/esm/arcade-defaults-066445c4.js +344 -0
  124. package/dist/esm/arcade-language-features-0e00c199.js +269 -0
  125. package/dist/esm/{arcade-mode-5d46035e.js → arcade-mode-abf1e1cf.js} +3 -263
  126. package/dist/esm/arcgis-arcade-editor_6.entry.js +127 -1447
  127. package/dist/esm/arcgis-coding-components.js +5 -5
  128. package/dist/esm/arcgis-sql-expression-editor.entry.js +77 -0
  129. package/dist/esm/arcgis-sql-expression-fields.entry.js +76 -0
  130. package/dist/esm/{css-e257dc49.js → css-c6dae12d.js} +1 -1
  131. package/dist/esm/{cssMode-c11f7f40.js → cssMode-052bb603.js} +2 -3
  132. package/dist/esm/{html-a6c37a99.js → html-572696a1.js} +2 -3
  133. package/dist/esm/{htmlMode-1270bc7d.js → htmlMode-fc184f2d.js} +2 -3
  134. package/dist/esm/{index-a970952c.js → index-0edd9846.js} +9 -1
  135. package/dist/esm/index.js +4 -3
  136. package/dist/esm/{javascript-ee179624.js → javascript-8bfc0096.js} +3 -4
  137. package/dist/esm/{jsonMode-07502ccb.js → jsonMode-7adf94ff.js} +2 -3
  138. package/dist/esm/{arcade-defaults-9eb28407.js → language-defaults-base-85a7f476.js} +833 -1179
  139. package/dist/esm/loader.js +5 -5
  140. package/dist/esm/sql-expr-defaults-be84ec7f.js +1339 -0
  141. package/dist/esm/sql-expr-mode-a4413e5c.js +20840 -0
  142. package/dist/esm/{tsMode-96749a12.js → tsMode-d10773c8.js} +2 -3
  143. package/dist/esm/{typescript-a3cf9881.js → typescript-9491f23e.js} +2 -3
  144. package/dist/loader/cdn.js +1 -1
  145. package/dist/loader/index.cjs.js +1 -1
  146. package/dist/loader/index.es2017.js +1 -1
  147. package/dist/loader/index.js +1 -1
  148. package/dist/types/components/arcade-editor/arcade-editor.d.ts +45 -10
  149. package/dist/types/components/arcade-results/arcade-results.d.ts +43 -1
  150. package/dist/types/components/arcade-suggestions/arcade-suggestions.d.ts +22 -1
  151. package/dist/types/components/arcade-variables/arcade-variables.d.ts +28 -1
  152. package/dist/types/components/code-editor/code-editor.d.ts +16 -5
  153. package/dist/types/components/language-api-panel/language-api-panel.d.ts +34 -8
  154. package/dist/types/components/sql-expression-editor/sql-expression-editor.d.ts +24 -0
  155. package/dist/types/components/sql-expression-fields/sql-expression-fields.d.ts +32 -0
  156. package/dist/types/components.d.ts +98 -24
  157. 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
  158. 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
  159. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/sql-expression-editor/sql-expression-editor.stories.d.ts +13 -0
  160. package/dist/types/dependencies.d.ts +6 -10
  161. package/dist/types/utils/arcade-monaco/arcade-language-features.d.ts +1 -0
  162. package/dist/types/utils/arcade-monaco/arcade-profile-strategy.d.ts +9 -0
  163. package/dist/types/utils/fields.d.ts +2 -2
  164. package/dist/types/utils/language-defaults-base.d.ts +2 -9
  165. package/dist/types/utils/profile/editor-profile.d.ts +7 -6
  166. package/dist/types/utils/profile/types.d.ts +53 -65
  167. package/dist/types/utils/profile/utils.d.ts +9 -8
  168. package/dist/types/utils/sql-expr-monaco/DependentFiles/DateOnly.d.ts +41 -0
  169. package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlInterval.d.ts +16 -0
  170. package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlTimestampOffset.d.ts +26 -0
  171. package/dist/types/utils/sql-expr-monaco/DependentFiles/TimeOnly.d.ts +37 -0
  172. package/dist/types/utils/sql-expr-monaco/DependentFiles/UnknownTimeZone.d.ts +11 -0
  173. package/dist/types/utils/sql-expr-monaco/DependentFiles/WhereGrammar.d.ts +122 -0
  174. package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlCompareUtils.d.ts +5 -0
  175. package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlDateParsingUtils.d.ts +18 -0
  176. package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlUtils.d.ts +6 -0
  177. package/dist/types/utils/sql-expr-monaco/DependentFiles/standardizedFunctions.d.ts +156 -0
  178. package/dist/types/utils/sql-expr-monaco/DependentFiles/support.d.ts +150 -0
  179. package/dist/types/utils/sql-expr-monaco/PeggyGrammar/sql92grammar.d.ts +1397 -0
  180. package/dist/types/utils/sql-expr-monaco/sql-expr-completion.d.ts +6 -0
  181. package/dist/types/utils/sql-expr-monaco/sql-expr-constants.d.ts +45 -0
  182. package/dist/types/utils/sql-expr-monaco/sql-expr-contribution.d.ts +1 -0
  183. package/dist/types/utils/sql-expr-monaco/sql-expr-defaults.d.ts +21 -0
  184. package/dist/types/utils/sql-expr-monaco/sql-expr-language-features.d.ts +39 -0
  185. package/dist/types/utils/sql-expr-monaco/sql-expr-language-syntax.d.ts +8 -0
  186. package/dist/types/utils/sql-expr-monaco/sql-expr-mode.d.ts +43 -0
  187. package/dist/types/utils/sql-expr-monaco/sql-expr-service-accessors.d.ts +19 -0
  188. package/dist/types/utils/sql-expr-monaco/sql-expr-validation-diagnostic-adapter.d.ts +34 -0
  189. package/dist/types/utils/sql-expr-monaco/sql-expr-validation-utils.d.ts +100 -0
  190. package/dist/types/utils/sql-expr-monaco/sql-expr-validation.d.ts +41 -0
  191. package/dist/types/utils/sql-expr-monaco/sql-expr-worker-manager.d.ts +17 -0
  192. package/dist/types/utils/sql-expr-monaco/sql-expr.worker.d.ts +24 -0
  193. package/dist/types/utils/sql-expr-monaco/sql-expression-profile-strategy.d.ts +13 -0
  194. package/dist/types/utils/sql-expr-monaco/types.d.ts +89 -0
  195. package/package.json +27 -21
  196. package/dist/arcgis-coding-components/p-0c6de9b3.js +0 -6
  197. package/dist/arcgis-coding-components/p-81c37dab.entry.js +0 -6
  198. package/dist/cjs/arcade-mode-b85ae7d4.js +0 -595
  199. package/dist/components/chunk-IHYYRFLQ.js +0 -1363
  200. package/dist/types/components/arcade-editor/t9n-types.d.ts +0 -8
  201. package/dist/types/components/arcade-results/t9n-types.d.ts +0 -13
  202. package/dist/types/components/arcade-suggestions/t9n-types.d.ts +0 -6
  203. package/dist/types/components/arcade-variables/t9n-types.d.ts +0 -8
  204. package/dist/types/components/language-api-panel/t9n-types.d.ts +0 -8
  205. package/dist/types/utils/profile/predefined-profile.d.ts +0 -2
@@ -0,0 +1,1347 @@
1
+ /*!
2
+ * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
+ * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
+ * v4.31.0-next.21
5
+ */
6
+ 'use strict';
7
+
8
+ const languageDefaultsBase = require('./language-defaults-base-57b37f9f.js');
9
+ const index = require('./index-4b7880ab.js');
10
+
11
+ // src/framework.ts
12
+ function retrieveComponentMembers(component, isLit) {
13
+ if (isLit) {
14
+ const elementProperties = component.constructor.elementProperties;
15
+ component.manager.internals.members = Object.fromEntries(
16
+ Array.from(
17
+ elementProperties,
18
+ ([name, descriptor]) => descriptor.noAccessor ? void 0 : [
19
+ name,
20
+ [
21
+ (descriptor.readOnly ? 2048 /* ReadOnly */ : 0) | (descriptor.state ? 32 /* State */ : descriptor.type === Number ? 2 /* Number */ : descriptor.type === Boolean ? 4 /* Boolean */ : 1 /* String */)
22
+ ]
23
+ ]
24
+ ).filter(languageDefaultsBase.isNotUndefined)
25
+ );
26
+ } else {
27
+ const constructor = component.constructor;
28
+ const members = constructor.__registerControllers?.(component) ?? void 0;
29
+ constructor.__registerControllers = void 0;
30
+ if (typeof members !== "object") {
31
+ throw new Error(
32
+ "Failed to retrieve component meta"
33
+ );
34
+ }
35
+ component.manager.internals.members = Object.fromEntries(
36
+ Object.entries(members).filter(([_name, [propType]]) => (propType & 63 /* PropLike */) !== 0)
37
+ );
38
+ }
39
+ }
40
+ function parsePropertyValue(value, type = 8 /* Any */) {
41
+ const isComplex = value == null || typeof value === "object" || typeof value === "function";
42
+ if (isComplex) {
43
+ return value;
44
+ }
45
+ if ((type & 4 /* Boolean */) !== 0) {
46
+ return value === "false" ? false : value === "" || !!value;
47
+ } else if ((type & 2 /* Number */) !== 0) {
48
+ return Number.parseFloat(value);
49
+ } else if ((type & 1 /* String */) !== 0) {
50
+ return String(value);
51
+ } else {
52
+ return value;
53
+ }
54
+ }
55
+ var getMemberType = (component, name) => component.manager.internals.members?.[name]?.[0];
56
+
57
+ // src/types.ts
58
+ var controllerSymbol = Symbol.for("controller");
59
+
60
+ // src/utils.ts
61
+ var isController = (value) => typeof value === "object" && value !== null && (controllerSymbol in value || "hostConnected" in value || "hostDisconnected" in value || "hostUpdate" in value || "hostUpdated" in value);
62
+
63
+ // src/ControllerInternals.ts
64
+ var ambientComponent;
65
+ function setAmbientComponent(component) {
66
+ if (ambientComponent === component) {
67
+ return;
68
+ }
69
+ ambientComponent = component;
70
+ queueMicrotask(() => {
71
+ if (ambientComponent === component) {
72
+ ambientComponent = void 0;
73
+ }
74
+ });
75
+ }
76
+ function retrieveComponent(name2) {
77
+ return ambientComponent;
78
+ }
79
+ var ambientControllers = [];
80
+ function setParentController(controller) {
81
+ if (controller === void 0) {
82
+ ambientControllers = [];
83
+ return;
84
+ }
85
+ const index = ambientControllers.indexOf(controller);
86
+ ambientControllers = index === -1 ? [...ambientControllers, controller] : ambientControllers.slice(0, index + 1);
87
+ queueMicrotask(() => {
88
+ ambientControllers = [];
89
+ });
90
+ }
91
+ function retrieveParentControllers() {
92
+ return ambientControllers;
93
+ }
94
+ var ambientChildController;
95
+ function setAmbientChildController(controller) {
96
+ if (ambientChildController === controller) {
97
+ return;
98
+ }
99
+ ambientChildController = controller;
100
+ queueMicrotask(() => {
101
+ if (ambientChildController === controller) {
102
+ ambientChildController = void 0;
103
+ }
104
+ });
105
+ }
106
+ function retrieveAmbientChildController() {
107
+ const controller = ambientChildController;
108
+ ambientChildController = void 0;
109
+ return controller;
110
+ }
111
+ var use = async (value, watchExports) => {
112
+ const controller = useRefSync(value);
113
+ if (controller === void 0) {
114
+ return value;
115
+ }
116
+ await controller.ready;
117
+ if (typeof watchExports === "function") {
118
+ const unsubscribe = controller.watchExports(
119
+ (exports) => watchExports(exports, unsubscribe)
120
+ );
121
+ }
122
+ return controller.exports;
123
+ };
124
+ var useRef = async (value) => {
125
+ const controller = useRefSync(value);
126
+ await controller.ready;
127
+ return controller;
128
+ };
129
+ var useRefSync = (value) => {
130
+ const ambientChildController2 = retrieveAmbientChildController();
131
+ if (ambientChildController2 !== void 0) {
132
+ return ambientChildController2;
133
+ }
134
+ const component = retrieveComponent();
135
+ const controller = component.manager.internals.resolveExports(value);
136
+ if (controller !== void 0) {
137
+ return controller;
138
+ }
139
+ if (isController(value)) {
140
+ return value;
141
+ }
142
+ return void 0;
143
+ };
144
+ var shouldBypass = {
145
+ setter: false,
146
+ getter: false,
147
+ readOnly: false
148
+ };
149
+ var elementToInstance = /* @__PURE__ */ new WeakMap();
150
+ var _a;
151
+ _a = controllerSymbol;
152
+ var Controller = class {
153
+ constructor(component) {
154
+ this._callbacks = {
155
+ hostConnected: [],
156
+ hostDisconnected: [],
157
+ hostLoad: [],
158
+ hostLoaded: [],
159
+ hostUpdate: [],
160
+ hostUpdated: [],
161
+ hostDestroy: [],
162
+ hostLifecycle: []
163
+ };
164
+ this._ready = new languageDefaultsBase.Deferred();
165
+ this._lifecycleCleanups = [];
166
+ this.connectedCalled = false;
167
+ this.willLoadCalled = false;
168
+ this.didLoadCalled = false;
169
+ this[_a] = true;
170
+ this.ready = this._ready.promise;
171
+ /*
172
+ * Setting default exports to "this" so that controllers that don't use
173
+ * exports/proxyExports(), could still be used as if they did
174
+ * (i.e with controller.use)
175
+ */
176
+ this._exports = makeProvisionalValue(this);
177
+ this._exportWatchers = /* @__PURE__ */ new Set();
178
+ const resolvedComponent = toControllerHost(component ?? retrieveComponent());
179
+ {
180
+ this.component = resolvedComponent;
181
+ }
182
+ this.component.addController(this);
183
+ setParentController(this);
184
+ const manager = this.component.manager;
185
+ const isInControllerManager = manager === void 0;
186
+ if (!isInControllerManager) {
187
+ queueMicrotask(() => this.catchUpLifecycle());
188
+ }
189
+ }
190
+ /**
191
+ * If controller is being added dynamically, after the component
192
+ * construction, then trigger connected and load right away
193
+ */
194
+ catchUpLifecycle() {
195
+ const { manager } = this.component;
196
+ const connectedWillStillHappen = !manager.connectedCalled;
197
+ if (!connectedWillStillHappen && !this.connectedCalled) {
198
+ this.triggerConnected();
199
+ }
200
+ const loadWillStillHappen = !manager.willLoadCalled;
201
+ if (loadWillStillHappen) {
202
+ return;
203
+ }
204
+ this.triggerLoad().then(() => {
205
+ const loadedWillStillHappen = !manager.didLoadCalled;
206
+ if (loadedWillStillHappen) {
207
+ return;
208
+ }
209
+ this.triggerLoaded();
210
+ }).catch(console.error);
211
+ }
212
+ get exports() {
213
+ return this._exports;
214
+ }
215
+ /**
216
+ * Set controller's exports property (for usage with proxyExports()) and mark
217
+ * controller as ready (for usage in other controllers). Also, triggers
218
+ * re-render of the component
219
+ */
220
+ set exports(exports) {
221
+ const oldExports = this._exports;
222
+ if (oldExports !== exports) {
223
+ this._exports = exports;
224
+ this._exportWatchers.forEach(languageDefaultsBase.safeCall);
225
+ if (this.connectedCalled && this.assignedProperty !== false) {
226
+ this.component.requestUpdate(this.assignedProperty, oldExports);
227
+ }
228
+ }
229
+ this._ready.resolve(exports);
230
+ }
231
+ setProvisionalExports(exports) {
232
+ this._exports = makeProvisionalValue(exports);
233
+ this._exportWatchers.forEach(languageDefaultsBase.safeCall);
234
+ }
235
+ watchExports(callback) {
236
+ const safeCallback = () => callback(this._exports);
237
+ this._exportWatchers.add(safeCallback);
238
+ return () => void this._exportWatchers.delete(safeCallback);
239
+ }
240
+ /**
241
+ * A flexible utility for making sure a controller is loaded before it's used,
242
+ * regardless of how or where a controller was defined:
243
+ *
244
+ * @example
245
+ * makeGenericController(async (component, controller) => {
246
+ * // Await some controller from the component:
247
+ * await controller.use(component.someController);
248
+ * // Initialize new controllers
249
+ * await controller.use(load(importCoreReactiveUtils));
250
+ * await controller.use(new ViewModelController(component,newWidgetsHomeHomeViewModel));
251
+ * await controller.use(someController(component));
252
+ * });
253
+ *
254
+ * @remarks
255
+ * If your controller is not async, and you are not creating it async, then
256
+ * you are not required to use controller.use - you can use it directly.
257
+ * Similarly, accessing controllers after componentWillLoad callback does not
258
+ * require awaiting them as they are guaranteed to be loaded by then.
259
+ */
260
+ get use() {
261
+ setAmbientComponent(this.component);
262
+ return use;
263
+ }
264
+ /**
265
+ * Just like controller.use, but returns the controller itself, rather than it's
266
+ * exports
267
+ *
268
+ * Use cases:
269
+ * - You have a controller and you want to make sure it's loaded before you
270
+ * try to use it
271
+ * - Your controller is not using exports, so you wish to access some props on
272
+ * it directly
273
+ * - You have a controller exports only, and you want to retrieve the
274
+ * controller itself. This is useful if you wish to call .watchExports() or
275
+ * some other method on the controller
276
+ */
277
+ get useRef() {
278
+ setAmbientComponent(this.component);
279
+ return useRef;
280
+ }
281
+ /**
282
+ * Like useRef, but doesn't wait for the controller to get ready
283
+ *
284
+ * @internal
285
+ */
286
+ get useRefSync() {
287
+ setAmbientComponent(this.component);
288
+ return useRefSync;
289
+ }
290
+ controllerRemoved() {
291
+ if (this.component.el.isConnected) {
292
+ this.triggerDisconnected();
293
+ }
294
+ this.triggerDestroy();
295
+ }
296
+ // Register a lifecycle callback
297
+ onConnected(callback) {
298
+ this._callbacks.hostConnected.push(callback);
299
+ }
300
+ onDisconnected(callback) {
301
+ this._callbacks.hostDisconnected.push(callback);
302
+ }
303
+ onLoad(callback) {
304
+ this._callbacks.hostLoad.push(callback);
305
+ }
306
+ onLoaded(callback) {
307
+ this._callbacks.hostLoaded.push(callback);
308
+ }
309
+ onUpdate(callback) {
310
+ this._callbacks.hostUpdate.push(callback);
311
+ }
312
+ onUpdated(callback) {
313
+ this._callbacks.hostUpdated.push(callback);
314
+ }
315
+ onDestroy(callback) {
316
+ this._callbacks.hostDestroy.push(callback);
317
+ }
318
+ onLifecycle(callback) {
319
+ this._callbacks.hostLifecycle.push(callback);
320
+ if (this.connectedCalled && this.component.el.isConnected) {
321
+ this._callLifecycle(callback);
322
+ }
323
+ }
324
+ // Call each lifecycle hook
325
+ /** @internal */
326
+ triggerConnected() {
327
+ const genericController = this;
328
+ if (genericController.hostConnected) {
329
+ languageDefaultsBase.safeCall(genericController.hostConnected, genericController);
330
+ }
331
+ this._callbacks.hostConnected.forEach(languageDefaultsBase.safeCall);
332
+ this.triggerLifecycle();
333
+ this.connectedCalled = true;
334
+ }
335
+ /** @internal */
336
+ triggerDisconnected() {
337
+ const genericController = this;
338
+ if (genericController.hostDisconnected) {
339
+ languageDefaultsBase.safeCall(genericController.hostDisconnected, genericController);
340
+ }
341
+ this._callbacks.hostDisconnected.forEach(languageDefaultsBase.safeCall);
342
+ this._lifecycleCleanups.forEach(languageDefaultsBase.safeCall);
343
+ this._lifecycleCleanups = [];
344
+ }
345
+ /** @internal */
346
+ async triggerLoad() {
347
+ if (this.willLoadCalled) {
348
+ return;
349
+ }
350
+ this.willLoadCalled = true;
351
+ const genericController = this;
352
+ if (genericController.hostLoad) {
353
+ await languageDefaultsBase.safeAsyncCall(genericController.hostLoad, genericController);
354
+ }
355
+ if (this._callbacks.hostLoad.length > 0) {
356
+ await Promise.allSettled(this._callbacks.hostLoad.map(languageDefaultsBase.safeAsyncCall));
357
+ }
358
+ this._ready.resolve(this._exports);
359
+ }
360
+ /** @internal */
361
+ triggerLoaded() {
362
+ if (this.didLoadCalled) {
363
+ return;
364
+ }
365
+ const genericController = this;
366
+ if (genericController.hostLoaded) {
367
+ languageDefaultsBase.safeCall(genericController.hostLoaded, genericController);
368
+ }
369
+ this._callbacks.hostLoaded.forEach(languageDefaultsBase.safeCall);
370
+ this.didLoadCalled = true;
371
+ }
372
+ /** @internal */
373
+ triggerUpdate(changedProperties) {
374
+ const genericController = this;
375
+ if (genericController.hostUpdate) {
376
+ languageDefaultsBase.safeCall(genericController.hostUpdate, genericController, changedProperties);
377
+ }
378
+ this._callbacks.hostUpdate.forEach(callUpdate, changedProperties);
379
+ }
380
+ /** @internal */
381
+ triggerUpdated(changedProperties) {
382
+ const genericController = this;
383
+ if (genericController.hostUpdated) {
384
+ languageDefaultsBase.safeCall(genericController.hostUpdated, genericController, changedProperties);
385
+ }
386
+ this._callbacks.hostUpdated.forEach(callUpdate, changedProperties);
387
+ }
388
+ /** @internal */
389
+ triggerDestroy() {
390
+ const genericController = this;
391
+ if (genericController.hostDestroy) {
392
+ languageDefaultsBase.safeCall(genericController.hostDestroy, genericController);
393
+ }
394
+ this._callbacks.hostDestroy.forEach(languageDefaultsBase.safeCall);
395
+ }
396
+ /** @internal */
397
+ triggerLifecycle() {
398
+ const genericController = this;
399
+ if (genericController.hostLifecycle) {
400
+ this._callLifecycle(() => genericController.hostLifecycle());
401
+ }
402
+ this._callbacks.hostLifecycle.forEach(this._callLifecycle, this);
403
+ }
404
+ _callLifecycle(callback) {
405
+ setAmbientComponent(this.component);
406
+ const cleanupRaw = languageDefaultsBase.safeCall(callback);
407
+ const cleanup = Array.isArray(cleanupRaw) ? cleanupRaw : [cleanupRaw];
408
+ cleanup.forEach((cleanup2) => {
409
+ if (typeof cleanup2 === "function") {
410
+ this._lifecycleCleanups.push(cleanup2);
411
+ } else if (typeof cleanup2 === "object" && typeof cleanup2.remove === "function") {
412
+ this._lifecycleCleanups.push(cleanup2.remove);
413
+ }
414
+ });
415
+ }
416
+ };
417
+ function callUpdate(callback) {
418
+ languageDefaultsBase.safeCall(callback, void 0, this);
419
+ }
420
+ var GenericController = Controller;
421
+ function makeProvisionalValue(base) {
422
+ if (typeof base !== "object" && typeof base !== "function" || base === null) {
423
+ return base;
424
+ }
425
+ const proxy2 = new Proxy(base, {
426
+ get(target, prop, receiver) {
427
+ if (cyclical.has(prop) && prop in target && target[prop] === proxy2) {
428
+ return void 0;
429
+ }
430
+ if (prop in target || prop in Promise.prototype || typeof prop === "symbol") {
431
+ return typeof target === "function" ? target[prop] : Reflect.get(target, prop, receiver);
432
+ }
433
+ return void 0;
434
+ },
435
+ set: (target, prop, newValue, receiver) => {
436
+ return Reflect.set(target, prop, newValue, receiver);
437
+ }
438
+ });
439
+ return proxy2;
440
+ }
441
+ var cyclical = /* @__PURE__ */ new Set(["exports", "_exports"]);
442
+ function toControllerHost(component) {
443
+ {
444
+ return component;
445
+ }
446
+ }
447
+ function trackPropertyKey(object, onResolved, defaultValue) {
448
+ const keys = Object.keys(object);
449
+ const keyCount = keys.length;
450
+ if (keyTrackMap === void 0) {
451
+ queueMicrotask(keyTrackResolve);
452
+ }
453
+ keyTrackMap ?? (keyTrackMap = /* @__PURE__ */ new Map());
454
+ let pendingTrackers = keyTrackMap.get(object);
455
+ if (pendingTrackers === void 0) {
456
+ pendingTrackers = { callbacks: [], keyCount };
457
+ keyTrackMap.set(object, pendingTrackers);
458
+ }
459
+ if (pendingTrackers.keyCount !== keyCount) {
460
+ pendingTrackers.callbacks.forEach((resolve) => resolve(keys));
461
+ pendingTrackers.callbacks = [];
462
+ pendingTrackers.keyCount = keyCount;
463
+ }
464
+ pendingTrackers.callbacks.push((keys2) => {
465
+ const callback = (key2) => languageDefaultsBase.safeCall(onResolved, null, key2);
466
+ const key = keys2[keyCount];
467
+ if (key === void 0) {
468
+ callback(void 0);
469
+ } else if (object[key] === defaultValue) {
470
+ callback(key);
471
+ } else {
472
+ callback(void 0);
473
+ }
474
+ });
475
+ return defaultValue;
476
+ }
477
+ var keyTrackMap = void 0;
478
+ function keyTrackResolve() {
479
+ Array.from(keyTrackMap?.entries() ?? []).forEach(([object, { callbacks }]) => {
480
+ const keys = Object.keys(object);
481
+ callbacks.forEach((commit) => commit(keys));
482
+ });
483
+ keyTrackMap = void 0;
484
+ }
485
+ function watch(component, property, callback) {
486
+ var _a2;
487
+ const genericProperty = property;
488
+ const internals = component.manager.internals;
489
+ (_a2 = internals.allWatchers)[genericProperty] ?? (_a2[genericProperty] = []);
490
+ const watchers = internals.allWatchers[genericProperty];
491
+ const genericCallback = callback;
492
+ const safeCallback = (newValue, oldValue, propertyName) => languageDefaultsBase.safeCall(genericCallback, null, newValue, oldValue, propertyName);
493
+ watchers.push(safeCallback);
494
+ return () => {
495
+ const index = watchers.indexOf(safeCallback);
496
+ if (index !== -1) {
497
+ watchers.splice(index, 1);
498
+ }
499
+ };
500
+ }
501
+
502
+ // src/ComponentInternals.ts
503
+ var ComponentInternals = class {
504
+ constructor(component) {
505
+ /**
506
+ * When watchers are set, set then into `allWatchers`. When watchers are read
507
+ * in the setter, read from `enabledWatchers`.
508
+ * On connectedCallback(), controller manager does `enabledWatchers=allWatchers`.
509
+ * Reasoning:
510
+ * - This disables watchers until connected callback (matches behavior of
511
+ * Stencil's watchers)
512
+ * - This removes in the setter to check if watchers were enabled already or
513
+ * not (as getters/setters are hot path, and should be streamlined)
514
+ */
515
+ this.enabledWatchers = {};
516
+ this.allWatchers = {};
517
+ /**
518
+ * "readOnly" is not enabled initially since we need to allow to set property
519
+ * default values in the constructor.
520
+ * For Stencil, readonly is enabled by the `readonly()` controller.
521
+ * For Lit, we have the following logic:
522
+ */
523
+ this.enableReadonly = () => {
524
+ this.enableReadonly = void 0;
525
+ if (!this.component.manager.isLit) {
526
+ return;
527
+ }
528
+ const internals = this.component.manager.internals;
529
+ Object.entries(internals.members).forEach(([name2, [type]]) => {
530
+ var _a2;
531
+ const isReadOnly = type & 2048 /* ReadOnly */;
532
+ if (isReadOnly) {
533
+ (_a2 = internals.setters)[name2] ?? (_a2[name2] = []);
534
+ internals.setters[name2].push(internals.readonlySetter);
535
+ }
536
+ });
537
+ };
538
+ this.trackedValue = nothing;
539
+ this.keyTrackers = [];
540
+ this.getters = {};
541
+ this.setters = {};
542
+ this.accessorGetter = {};
543
+ this.accessorSetter = {};
544
+ this.reactiveUtilsIntegrations = /* @__PURE__ */ new Set();
545
+ this._exports = /* @__PURE__ */ new WeakMap();
546
+ this.readonlySetter = (newValue, _oldValue, property) => {
547
+ if (shouldBypass.readOnly) {
548
+ return newValue;
549
+ }
550
+ throw new Error(
551
+ `Cannot assign to read-only property "${property}" of ${this.component.el.tagName.toLowerCase()}. Trying to assign "${String(
552
+ newValue
553
+ )}"`
554
+ );
555
+ };
556
+ {
557
+ this.component = component;
558
+ }
559
+ }
560
+ firePropTrackers(key, value) {
561
+ const trackers = this.keyTrackers;
562
+ this.trackedValue = nothing;
563
+ this.keyTrackers = [];
564
+ trackers.forEach((tracker) => tracker(key, value));
565
+ }
566
+ // REFACTOR: once Stencil is no longer supported, simplify this with Lit's getPropertyDescriptor(), or https://github.com/shoelace-style/shoelace/issues/1990
567
+ /**
568
+ * Configure a getter or setter for a given \@Prop/\@State
569
+ *
570
+ * Note, since props are defined on the prototype, they are shared between all
571
+ * instances of a component. Thus, instead of passing a reference to the
572
+ * getter/setter function, you should update the
573
+ * ComponentInternals.getters/setters properties, and then call getSetProxy
574
+ * to apply the changes to the prototype
575
+ */
576
+ getSetProxy(property) {
577
+ const component = this.component;
578
+ const classPrototype = component.constructor.prototype;
579
+ this._getSetProxy(classPrototype, property, "class");
580
+ if (component.manager.isLit) {
581
+ return;
582
+ }
583
+ const htmlPrototype = component.el.constructor.prototype;
584
+ if (classPrototype !== htmlPrototype) {
585
+ this._getSetProxy(htmlPrototype, property, "html");
586
+ }
587
+ }
588
+ _getSetProxy(prototype, name2, type) {
589
+ const component = this.component;
590
+ const propType = getMemberType(component, name2);
591
+ const descriptor = Object.getOwnPropertyDescriptor(prototype, name2);
592
+ if (!descriptor) {
593
+ return void 0;
594
+ }
595
+ const originalGet = descriptor.get;
596
+ const originalSet = descriptor.set;
597
+ const isGetterAlreadyOverwritten = customAccessor in originalGet;
598
+ const isSetterAlreadyOverwritten = customAccessor in originalSet;
599
+ const shouldOverwriteGet = !isGetterAlreadyOverwritten;
600
+ const shouldOverwriteSet = !isSetterAlreadyOverwritten;
601
+ if (!shouldOverwriteGet && !shouldOverwriteSet) {
602
+ return;
603
+ }
604
+ const finalGetter = shouldOverwriteGet ? function getter() {
605
+ let value = originalGet.call(this);
606
+ const component2 = elementToInstance.get(this);
607
+ if (component2 === void 0) {
608
+ return value;
609
+ }
610
+ const internals = component2.manager.internals;
611
+ value = internals.accessorGetter[name2](value, name2);
612
+ const getters = internals.getters[name2] ?? emptyArray;
613
+ for (let i = 0; i < getters.length; i++) {
614
+ value = getters[i](value, name2);
615
+ }
616
+ return value;
617
+ } : originalGet;
618
+ const finalSetter = shouldOverwriteSet ? function setter(rawNewValue) {
619
+ const oldValue = originalGet.call(this);
620
+ const component2 = elementToInstance.get(this);
621
+ if (component2 === void 0) {
622
+ originalSet.call(this, rawNewValue);
623
+ return;
624
+ }
625
+ let newValue = component2.manager.isLit ? rawNewValue : parsePropertyValue(rawNewValue, propType);
626
+ const internals = component2.manager.internals;
627
+ if (newValue === oldValue) {
628
+ originalSet.call(this, rawNewValue);
629
+ } else {
630
+ const setters = shouldBypass.setter ? emptyArray : internals.setters[name2] ?? emptyArray;
631
+ for (let i = 0; i < setters.length; i++) {
632
+ newValue = setters[i](newValue, oldValue, name2);
633
+ if (newValue === oldValue) {
634
+ break;
635
+ }
636
+ }
637
+ newValue = internals.accessorSetter[name2](newValue, oldValue, name2);
638
+ originalSet.call(this, newValue);
639
+ if (newValue !== oldValue) {
640
+ internals.enabledWatchers[name2]?.forEach((watcher) => watcher(newValue, oldValue, name2));
641
+ }
642
+ }
643
+ if (internals.keyTrackers.length > 0) {
644
+ internals?.firePropTrackers(name2, rawNewValue);
645
+ }
646
+ } : originalSet;
647
+ if (shouldOverwriteGet) {
648
+ finalGetter[customAccessor] = true;
649
+ }
650
+ if (shouldOverwriteSet) {
651
+ finalSetter[customAccessor] = true;
652
+ }
653
+ Object.defineProperty(prototype, name2, {
654
+ ...descriptor,
655
+ get: finalGetter,
656
+ set: finalSetter
657
+ });
658
+ }
659
+ /**
660
+ * Associate an exports object with a controller for reverse lookup in
661
+ * controller.use
662
+ */
663
+ markExports(controller, exports) {
664
+ if (typeof exports === "object" && exports !== null || typeof exports === "function") {
665
+ this._exports.set(exports, controller);
666
+ }
667
+ }
668
+ resolveExports(exports) {
669
+ if (typeof exports === "object" && exports !== null || typeof exports === "function") {
670
+ return this._exports.get(exports);
671
+ } else {
672
+ return void 0;
673
+ }
674
+ }
675
+ };
676
+ var emptyArray = [];
677
+ var customAccessor = Symbol();
678
+ var nothing = (
679
+ // eslint-disable-next-line symbol-description
680
+ Symbol()
681
+ ) ;
682
+ var useControllerManager = (component, forceUpdate) => new ControllerManager(component, forceUpdate);
683
+ var ControllerManager = class extends GenericController {
684
+ constructor(component, forceUpdate) {
685
+ const isLit = "addController" in component;
686
+ const controllers = /* @__PURE__ */ new Set();
687
+ function addController(controller) {
688
+ controllers.add(controller);
689
+ if (isLit && !(controllerSymbol in controller) && component.el.isConnected) {
690
+ controller.hostConnected?.();
691
+ }
692
+ }
693
+ function removeController(controller) {
694
+ void controllers.delete(controller);
695
+ controller.controllerRemoved?.();
696
+ }
697
+ const controllerHost = component;
698
+ controllerHost.addController = addController;
699
+ controllerHost.removeController = removeController;
700
+ if (!isLit) {
701
+ const update = forceUpdate ?? component.constructor.__forceUpdate;
702
+ controllerHost.requestUpdate = () => update(component);
703
+ }
704
+ super(component);
705
+ /** @internal */
706
+ this.internals = new ComponentInternals(this.component);
707
+ this.destroyed = false;
708
+ this._updatePromise = new languageDefaultsBase.Deferred();
709
+ this._originalLifecycles = {};
710
+ this.isLit = isLit;
711
+ this.component.manager = this;
712
+ retrieveComponentMembers(component, isLit);
713
+ this._controllers = controllers;
714
+ this.exports = void 0;
715
+ this.hasDestroy = autoDestroyDisabledPropName in this.component && typeof this.component.destroy === "function";
716
+ if (this.hasDestroy) {
717
+ watch(component, autoDestroyDisabledPropName, () => this._setAutoDestroyTimeout());
718
+ }
719
+ this._bindLifecycleMethods();
720
+ const internals = this.internals;
721
+ Object.keys(internals.members).forEach((name2) => {
722
+ internals.accessorGetter[name2] = defaultGetterSetter;
723
+ internals.accessorSetter[name2] = defaultGetterSetter;
724
+ internals.getSetProxy(name2);
725
+ });
726
+ if (!isLit) {
727
+ Object.defineProperty(component, "updateComplete", {
728
+ get: async () => await this._updatePromise.promise
729
+ });
730
+ }
731
+ queueMicrotask(internals.enableReadonly);
732
+ setParentController(void 0);
733
+ setAmbientComponent(component);
734
+ elementToInstance.set(component.el, component);
735
+ elementToInstance.set(component, component);
736
+ }
737
+ _bindLifecycleMethods() {
738
+ const component = this.component;
739
+ const isLit = this.isLit;
740
+ const isStencilDistBuild = component.el === component;
741
+ this._originalLifecycles = {
742
+ // These component's callbacks will be called by Lit, so we don't have to
743
+ connectedCallback: isLit || isStencilDistBuild ? void 0 : component.connectedCallback,
744
+ disconnectedCallback: isLit || isStencilDistBuild ? void 0 : component.disconnectedCallback,
745
+ componentWillLoad: isLit ? void 0 : component.componentWillLoad,
746
+ componentDidLoad: isLit ? void 0 : component.componentDidLoad,
747
+ componentWillUpdate: isLit ? void 0 : component.componentWillUpdate,
748
+ componentDidUpdate: isLit ? void 0 : component.componentDidUpdate,
749
+ destroy: component.destroy
750
+ };
751
+ const hostConnected = this._connectedCallback.bind(this);
752
+ const hostDisconnected = this._disconnectedCallback.bind(this);
753
+ const hostUpdate = this._update.bind(this);
754
+ const hostUpdated = this._updated.bind(this);
755
+ if (isLit) {
756
+ component.constructor.prototype.addController.call(component, {
757
+ // Lit will call these callbacks
758
+ hostConnected,
759
+ hostDisconnected,
760
+ hostUpdate,
761
+ hostUpdated
762
+ });
763
+ } else {
764
+ component.connectedCallback = hostConnected;
765
+ component.disconnectedCallback = hostDisconnected;
766
+ component.componentWillLoad = this._load.bind(this);
767
+ component.componentDidLoad = this._loaded.bind(this);
768
+ component.componentWillUpdate = hostUpdate;
769
+ component.componentDidUpdate = hostUpdated;
770
+ }
771
+ if (this.hasDestroy) {
772
+ component.destroy = this.destroy.bind(this);
773
+ }
774
+ }
775
+ /**
776
+ * Private because this is not supposed to be called by Component directly.
777
+ * Instead, _bindLifecycleMethods will take care of that. Otherwise, you risk
778
+ * calling lifecycle methods twice.
779
+ *
780
+ * @internal
781
+ */
782
+ _connectedCallback() {
783
+ if (this.destroyed) {
784
+ const tagName = this.component.el.tagName.toLowerCase();
785
+ this.component.el.remove();
786
+ throw new Error(
787
+ `The ${tagName} component has already been destroyed. It can not be used again. If you meant to disconnect and reconnect a component without automatic destroy, set the ${autoDestroyDisabledPropName} prop.`
788
+ );
789
+ }
790
+ if (this._autoDestroyTimeout !== void 0) {
791
+ clearTimeout(this._autoDestroyTimeout);
792
+ }
793
+ const internals = this.internals;
794
+ internals.enabledWatchers = internals.allWatchers;
795
+ keyTrackResolve();
796
+ internals.enableReadonly?.();
797
+ this._controllers.forEach(callConnected);
798
+ this._originalLifecycles.connectedCallback?.call(this.component);
799
+ }
800
+ /** @internal */
801
+ _disconnectedCallback() {
802
+ if (this.destroyed) {
803
+ return;
804
+ }
805
+ this._controllers.forEach(callDisconnected);
806
+ this._originalLifecycles.disconnectedCallback?.call(this.component);
807
+ if (this.hasDestroy) {
808
+ this._setAutoDestroyTimeout();
809
+ }
810
+ }
811
+ /** @internal */
812
+ async _load() {
813
+ const integrations = this.internals.reactiveUtilsIntegrations;
814
+ if (integrations.size > 0) {
815
+ for (const controller of integrations) {
816
+ if ("triggerLoad" in controller) {
817
+ await controller.triggerLoad();
818
+ } else {
819
+ await languageDefaultsBase.safeAsyncCall(controller.hostLoad, controller);
820
+ }
821
+ }
822
+ }
823
+ await Promise.allSettled(Array.from(this._controllers, callLoad, integrations));
824
+ await this._originalLifecycles.componentWillLoad?.call(this.component);
825
+ }
826
+ /** @internal */
827
+ _loaded() {
828
+ this._controllers.forEach(callLoaded);
829
+ this._originalLifecycles.componentDidLoad?.call(this.component);
830
+ }
831
+ _update() {
832
+ const changedProperties = this.component.changedProperties;
833
+ this._controllers.forEach(callUpdate2, changedProperties);
834
+ void this._originalLifecycles.componentWillUpdate?.call(this.component);
835
+ }
836
+ _updated() {
837
+ const maybeLitComponent = this.component;
838
+ this._controllers.forEach(callUpdated, maybeLitComponent.changedProperties);
839
+ this._originalLifecycles.componentDidUpdate?.call(this.component);
840
+ if (this.isLit) {
841
+ maybeLitComponent.changedProperties = /* @__PURE__ */ new Map();
842
+ } else {
843
+ const updatePromise = this._updatePromise;
844
+ this._updatePromise = new languageDefaultsBase.Deferred();
845
+ updatePromise.resolve(true);
846
+ }
847
+ }
848
+ async destroy() {
849
+ if (this.destroyed) {
850
+ return;
851
+ }
852
+ if (this.component.el.isConnected) {
853
+ this.hasDestroy = false;
854
+ try {
855
+ this.component.el.remove();
856
+ } finally {
857
+ this.hasDestroy = true;
858
+ }
859
+ }
860
+ this._autoDestroyTimeout = void 0;
861
+ this.destroyed = true;
862
+ this._controllers.forEach(callDestroy);
863
+ this._controllers.clear();
864
+ await this._originalLifecycles.destroy?.call(this.component);
865
+ }
866
+ _setAutoDestroyTimeout() {
867
+ if (!this.component.el.isConnected && !this.component.autoDestroyDisabled) {
868
+ if (this._autoDestroyTimeout !== void 0) {
869
+ clearTimeout(this._autoDestroyTimeout);
870
+ }
871
+ const destroy = () => void this.destroy().catch(console.error);
872
+ {
873
+ this._autoDestroyTimeout = languageDefaultsBase.devToolsAwareTimeout(destroy, autoDestroyOnDisconnectTimeout);
874
+ }
875
+ }
876
+ }
877
+ };
878
+ var autoDestroyDisabledPropName = "autoDestroyDisabled";
879
+ var autoDestroyOnDisconnectTimeout = 1e3;
880
+ var defaultGetterSetter = (value) => value;
881
+ function callConnected(controller) {
882
+ if ("triggerConnected" in controller) {
883
+ controller.triggerConnected();
884
+ } else {
885
+ languageDefaultsBase.safeCall(controller.hostConnected, controller);
886
+ }
887
+ }
888
+ function callDisconnected(controller) {
889
+ if ("triggerDisconnected" in controller) {
890
+ controller.triggerDisconnected();
891
+ } else {
892
+ languageDefaultsBase.safeCall(controller.hostDisconnected, controller);
893
+ }
894
+ }
895
+ async function callLoad(controller) {
896
+ if (!this.has(controller)) {
897
+ if ("triggerLoad" in controller) {
898
+ await controller.triggerLoad();
899
+ } else {
900
+ await languageDefaultsBase.safeAsyncCall(controller.hostLoad, controller);
901
+ }
902
+ }
903
+ }
904
+ function callLoaded(controller) {
905
+ if ("triggerLoaded" in controller) {
906
+ controller.triggerLoaded();
907
+ } else {
908
+ languageDefaultsBase.safeCall(controller.hostLoaded, controller);
909
+ }
910
+ }
911
+ function callUpdate2(controller) {
912
+ if ("triggerUpdate" in controller) {
913
+ controller.triggerUpdate(this);
914
+ } else {
915
+ languageDefaultsBase.safeCall(controller.hostUpdate, controller, this);
916
+ }
917
+ }
918
+ function callUpdated(controller) {
919
+ if ("triggerUpdated" in controller) {
920
+ controller.triggerUpdated(this);
921
+ } else {
922
+ languageDefaultsBase.safeCall(controller.hostUpdated, controller, this);
923
+ }
924
+ }
925
+ function callDestroy(controller) {
926
+ if ("triggerDestroy" in controller) {
927
+ controller.triggerDestroy();
928
+ } else {
929
+ languageDefaultsBase.safeCall(controller.hostDestroy, controller);
930
+ }
931
+ }
932
+ function trackPropKey(component, onResolved, defaultValue) {
933
+ const internals = component.manager.internals;
934
+ if (internals.trackedValue !== nothing && internals.trackedValue !== defaultValue) {
935
+ internals.firePropTrackers(void 0, void 0);
936
+ }
937
+ if (internals.keyTrackers.length === 0) {
938
+ queueMicrotask(() => internals.firePropTrackers(void 0, void 0));
939
+ }
940
+ internals.trackedValue = defaultValue;
941
+ internals.keyTrackers.push((key, value) => languageDefaultsBase.safeCall(onResolved, void 0, defaultValue === value ? key : void 0));
942
+ return defaultValue;
943
+ }
944
+
945
+ // src/trackKey.ts
946
+ function trackKey(hostsCandidates, onResolved, defaultValue) {
947
+ const candidateHosts = Array.isArray(hostsCandidates) ? hostsCandidates : [hostsCandidates];
948
+ let leftToResolve = candidateHosts.length + 1;
949
+ const resolved = (resolution) => {
950
+ leftToResolve -= 1;
951
+ if (resolution !== void 0) {
952
+ leftToResolve = 0;
953
+ }
954
+ if (leftToResolve === 0) {
955
+ onResolved(resolution);
956
+ }
957
+ };
958
+ candidateHosts.forEach(
959
+ (host) => trackPropertyKey(
960
+ host,
961
+ (key) => resolved(
962
+ key === void 0 ? void 0 : {
963
+ key,
964
+ host,
965
+ isReactive: false
966
+ }
967
+ ),
968
+ defaultValue
969
+ )
970
+ );
971
+ const component = candidateHosts.find(
972
+ (host) => "manager" in host && typeof host.manager === "object" && host.manager.component === host
973
+ );
974
+ if (component) {
975
+ trackPropKey(
976
+ component,
977
+ (key) => resolved(
978
+ key === void 0 ? void 0 : {
979
+ key,
980
+ host: component,
981
+ isReactive: getMemberType(component, key) !== void 0
982
+ }
983
+ ),
984
+ defaultValue
985
+ );
986
+ }
987
+ return defaultValue;
988
+ }
989
+
990
+ // src/getSet.ts
991
+ function getSet(defaultValue, getSet2) {
992
+ const component = retrieveComponent();
993
+ return trackPropKey(
994
+ component,
995
+ (rawName) => {
996
+ const name2 = rawName;
997
+ const manager = component.manager;
998
+ const genericComponent = component;
999
+ const value = genericComponent[name2];
1000
+ const isStencilHotReload = "production" !== "production" ;
1001
+ const initialSet = getSet2.initialSet ?? true;
1002
+ if (value != null && value !== defaultValue && typeof getSet2.set === "function" && initialSet && !isStencilHotReload) {
1003
+ const newValue = getSet2.set(value, defaultValue, name2);
1004
+ if (newValue !== value) {
1005
+ if (manager.isLit) {
1006
+ genericComponent[name2] = newValue;
1007
+ } else {
1008
+ let firstConnected = true;
1009
+ manager.onConnected(() => {
1010
+ if (!firstConnected) {
1011
+ return;
1012
+ }
1013
+ firstConnected = true;
1014
+ bypassSetter(() => {
1015
+ genericComponent[name2] = newValue;
1016
+ });
1017
+ });
1018
+ }
1019
+ }
1020
+ }
1021
+ genericGetSet(component, name2, getSet2);
1022
+ },
1023
+ defaultValue
1024
+ );
1025
+ }
1026
+ function bypassSetter(callback) {
1027
+ shouldBypass.setter = true;
1028
+ try {
1029
+ return callback();
1030
+ } finally {
1031
+ shouldBypass.setter = false;
1032
+ }
1033
+ }
1034
+ function genericGetSet(component, property, getSet2) {
1035
+ var _a2, _b;
1036
+ const genericGetSet2 = getSet2;
1037
+ const internals = component.manager.internals;
1038
+ const get = typeof genericGetSet2.get === "function" ? genericGetSet2.get : void 0;
1039
+ if (get) {
1040
+ (_a2 = internals.getters)[property] ?? (_a2[property] = []);
1041
+ internals.getters[property].unshift(get);
1042
+ }
1043
+ const set = genericGetSet2.set === "ignore" ? ignoreSet : genericGetSet2.set;
1044
+ if (set) {
1045
+ (_b = internals.setters)[property] ?? (_b[property] = []);
1046
+ internals.setters[property].unshift(
1047
+ set
1048
+ );
1049
+ }
1050
+ }
1051
+ var ignoreSet = (_, value) => value;
1052
+ function bypassReadOnly(callback) {
1053
+ shouldBypass.readOnly = true;
1054
+ try {
1055
+ return callback();
1056
+ } finally {
1057
+ shouldBypass.readOnly = false;
1058
+ }
1059
+ }
1060
+
1061
+ // src/proxyExports.ts
1062
+ var proxyExports = (Class) => (...args) => {
1063
+ const ambientControllers2 = retrieveParentControllers();
1064
+ const instance = new Class(...args);
1065
+ const initialExports = instance.exports;
1066
+ setParentController(ambientControllers2.at(-1));
1067
+ const internals = instance.component.manager.internals;
1068
+ internals.markExports(instance, initialExports);
1069
+ instance.watchExports((exports) => internals.markExports(instance, exports));
1070
+ setAmbientChildController(instance);
1071
+ const hostCandidates = [instance.component, ...ambientControllers2].reverse();
1072
+ return trackKey(
1073
+ hostCandidates,
1074
+ (resolution) => resolution === void 0 ? void 0 : setProxy(instance, resolution, initialExports),
1075
+ initialExports
1076
+ );
1077
+ };
1078
+ function setProxy(controller, { host, key, isReactive: assignedToProp }, initialExports) {
1079
+ const genericHost = host;
1080
+ const controllerValueChanged = genericHost[key] !== controller.exports;
1081
+ const hostValueChanged = genericHost[key] !== initialExports;
1082
+ const controllerUpdatedExports = initialExports !== controller.exports;
1083
+ if (controllerValueChanged && !hostValueChanged && controllerUpdatedExports) {
1084
+ genericHost[key] = controller.exports;
1085
+ }
1086
+ const isProxyExportsOnComponent = host === controller.component;
1087
+ if (isProxyExportsOnComponent) {
1088
+ if (assignedToProp) {
1089
+ const internals = controller.component.manager.internals;
1090
+ if (hostValueChanged) {
1091
+ internals.markExports(controller, genericHost[key]);
1092
+ }
1093
+ watch(controller.component, key, (value) => {
1094
+ if (value !== controller.exports) {
1095
+ internals.markExports(controller, value);
1096
+ }
1097
+ });
1098
+ }
1099
+ controller.assignedProperty = assignedToProp ? void 0 : key;
1100
+ }
1101
+ controller.watchExports(() => {
1102
+ if (genericHost[key] === controller.exports) {
1103
+ return;
1104
+ }
1105
+ const manager = controller.component.manager;
1106
+ const isReadOnly = manager.internals.setters[key]?.includes(manager.internals.readonlySetter);
1107
+ if (isReadOnly) {
1108
+ bypassReadOnly(() => {
1109
+ genericHost[key] = controller.exports;
1110
+ });
1111
+ } else {
1112
+ genericHost[key] = controller.exports;
1113
+ }
1114
+ });
1115
+ }
1116
+
1117
+ // src/functional.ts
1118
+ var makeController = (constructor) => proxy(void 0, constructor);
1119
+ var FunctionalController = class extends Controller {
1120
+ constructor(component, constructor) {
1121
+ super(component);
1122
+ const originalExports = this.exports;
1123
+ try {
1124
+ setAmbientComponent(this.component);
1125
+ const value = constructor(this.component, this);
1126
+ const constructorChangedExports = this.exports !== originalExports;
1127
+ if (value instanceof Promise) {
1128
+ if (!constructorChangedExports) {
1129
+ this.setProvisionalExports(value);
1130
+ }
1131
+ const resolved = value.then((result) => {
1132
+ this.exports = result;
1133
+ super.catchUpLifecycle();
1134
+ }).catch((error) => {
1135
+ this._ready.reject(error);
1136
+ console.error(error);
1137
+ });
1138
+ this.onLoad(async () => await resolved);
1139
+ } else {
1140
+ if (!constructorChangedExports || value !== void 0) {
1141
+ this.exports = value;
1142
+ }
1143
+ queueMicrotask(() => super.catchUpLifecycle());
1144
+ }
1145
+ } catch (error) {
1146
+ this._ready.reject(error);
1147
+ console.error(error);
1148
+ }
1149
+ }
1150
+ /** Noop - will be called in the constructor instead */
1151
+ catchUpLifecycle() {
1152
+ return;
1153
+ }
1154
+ };
1155
+ var proxy = proxyExports(FunctionalController);
1156
+
1157
+ // #region convert editor profile to apiProfile
1158
+ /**
1159
+ * Converts an editor profile to an api profile.
1160
+ * The api profile is an optimized version of the editor profile designed for minimal data transfer between the main thread and the worker.
1161
+ */
1162
+ const sqlExprEditorToApiProfile = (editorProfile) => {
1163
+ const { apiVersion, bundles, hiddenApiItems } = editorProfile.toEditorProfileDefinition();
1164
+ const variable = editorProfile.variables[0];
1165
+ if (!variable || !(variable.type === "featureSet")) {
1166
+ throw Error("No variable found in the editor profile");
1167
+ }
1168
+ const hydratedVariable = variableToApiProfile(variable);
1169
+ return {
1170
+ apiVersion,
1171
+ bundles,
1172
+ variables: [hydratedVariable],
1173
+ hiddenApiItems: hiddenApiItems?.map((s) => s.toLowerCase()),
1174
+ };
1175
+ };
1176
+ function variableToApiProfile(variable) {
1177
+ const { name } = variable;
1178
+ const description = variable.getDescription();
1179
+ const { definition } = variable.toProfileVariableDefinition();
1180
+ const resultCompletion = {
1181
+ label: name,
1182
+ detail: name,
1183
+ insertText: name,
1184
+ insertTextMode: languageDefaultsBase.main.exports.InsertTextMode.asIs,
1185
+ insertTextFormat: languageDefaultsBase.main.exports.InsertTextFormat.PlainText,
1186
+ kind: languageDefaultsBase.main.exports.CompletionItemKind.Field,
1187
+ };
1188
+ const result = {
1189
+ name,
1190
+ description,
1191
+ type: "dictionary",
1192
+ properties: [],
1193
+ completion: resultCompletion,
1194
+ };
1195
+ // No fields or definition, then it will be a feature without any known fields
1196
+ if (!definition || !("fields" in definition)) {
1197
+ return result;
1198
+ }
1199
+ // Create properties for the fields
1200
+ // Also improve the feature completion documentation
1201
+ // TODO: should we add aliases to completion? what about domains?
1202
+ const [properties, featureCompletionDescription] = languageDefaultsBase.fieldsToProfileValues(definition.fields, description);
1203
+ result.properties = properties;
1204
+ resultCompletion.documentation = { kind: "markdown", value: featureCompletionDescription };
1205
+ return result;
1206
+ }
1207
+ const tempHardcodedProfile = {
1208
+ en: {
1209
+ id: "field-calculation",
1210
+ variables: [
1211
+ {
1212
+ name: "$layer",
1213
+ type: "featureSet",
1214
+ description: "The layer being calculated.",
1215
+ },
1216
+ ],
1217
+ },
1218
+ };
1219
+ async function getSdkPredefinedProfile(locale = "en") {
1220
+ return await Promise.resolve(tempHardcodedProfile[locale]);
1221
+ }
1222
+ async function convertToEditorProfileDefinition(predefinedProfile, locale = "en") {
1223
+ if (!languageDefaultsBase.isPredefinedProfile(predefinedProfile)) {
1224
+ return undefined;
1225
+ }
1226
+ const sdkPredefinedProfile = await getSdkPredefinedProfile(locale);
1227
+ if (!sdkPredefinedProfile) {
1228
+ return undefined;
1229
+ }
1230
+ //
1231
+ const editorProfile = {
1232
+ variables: [],
1233
+ hiddenApiItems: predefinedProfile.hiddenApiItems?.map((s) => s.toLowerCase()),
1234
+ };
1235
+ // Merge the SDK variables' definitions/properties with the predefined profile definitions.
1236
+ sdkPredefinedProfile.variables.forEach((sdkVariable) => {
1237
+ // Don't include disabled variables
1238
+ if (predefinedProfile.disabledVariables?.includes(sdkVariable.name)) {
1239
+ return;
1240
+ }
1241
+ // Try to get a definition from the predefined profile.
1242
+ const definition = predefinedProfile.definitions[sdkVariable.name];
1243
+ switch (sdkVariable.type) {
1244
+ case "featureSet":
1245
+ if (languageDefaultsBase.isFeatureSetDefinition(definition)) {
1246
+ return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type, definition });
1247
+ }
1248
+ return;
1249
+ default:
1250
+ throw Error(`sdkVariable type not supported (yet) type: ${sdkVariable.type}`);
1251
+ }
1252
+ });
1253
+ return editorProfile;
1254
+ }
1255
+ // #endregion
1256
+ // #region profile utils
1257
+ /**
1258
+ * util to retrieve fields from the $layer variable in the api context.
1259
+ */
1260
+ const getFieldsFromLayerVariable = (profile) => {
1261
+ if (profile.variables) {
1262
+ const layerVar = profile.variables.find((variable) => variable.name === "$layer" && variable.type === "dictionary");
1263
+ return layerVar.properties ?? [];
1264
+ }
1265
+ return [];
1266
+ };
1267
+ // #endregion
1268
+
1269
+ /**
1270
+ * Returns the sql-expression worker for the model.
1271
+ * Example:
1272
+ * ```ts
1273
+ * const sqlExpressionWorker = await getSqlExpressionWorker(model.uri);
1274
+ * ```
1275
+ * @returns sql-expression worker
1276
+ */
1277
+ async function getSqlExprWorker(uri) {
1278
+ const mode = await getMode();
1279
+ return await mode.getSqlExprWorker(uri);
1280
+ }
1281
+ /**
1282
+ * Request the sql-expression mode
1283
+ * @returns sql-expression mode module
1284
+ */
1285
+ async function getMode() {
1286
+ return await Promise.resolve().then(function () { return require('./sql-expr-mode-304f5ce2.js'); });
1287
+ }
1288
+
1289
+ const languageId = "arcgis-sql-expression";
1290
+ class SqlExprDefaults extends languageDefaultsBase.LanguageDefaultsBase {
1291
+ constructor() {
1292
+ super(...arguments);
1293
+ this._languageId = languageId;
1294
+ this._languageOptions = {};
1295
+ this._layerMap = new Map();
1296
+ }
1297
+ // TODO: try to rely on editor profile instance instead of storing a feature layer
1298
+ updateFeatureLayerForModel(modelId, layer) {
1299
+ const key = this._getApiKey(modelId);
1300
+ this._layerMap.set(key, layer);
1301
+ }
1302
+ setLanguageOptions(languageOptions) {
1303
+ this._languageOptions = languageOptions;
1304
+ }
1305
+ getFeatureLayerForModel(modelId) {
1306
+ const key = this._getApiKey(modelId);
1307
+ return this._layerMap.get(key);
1308
+ }
1309
+ async setProfileForModel(modelId, definition, apiContext = { locale: "en" }) {
1310
+ // for now, it can ONLY be a predefined profile
1311
+ if (languageDefaultsBase.isPredefinedProfile(definition)) {
1312
+ definition = await convertToEditorProfileDefinition(definition, apiContext.locale);
1313
+ }
1314
+ // FIXME: using arcades intlStrings for now...
1315
+ const intlStrings = await languageDefaultsBase.fetchT9nStringsBundle(apiContext.locale, index.getAssetPath("./assets/arcade-language/t9n"), "profile.t9n.");
1316
+ if (!intlStrings) {
1317
+ throw new Error(`Failed to load the language bundle for ${apiContext.locale}`);
1318
+ }
1319
+ this.disposeForModel(modelId);
1320
+ const key = this._getApiKey(modelId);
1321
+ const editorProfile = new languageDefaultsBase.EditorProfile(definition, intlStrings);
1322
+ this._profileMap.set(key, editorProfile);
1323
+ const apiProfile = sqlExprEditorToApiProfile(editorProfile);
1324
+ this.updateApiContextForModel(modelId, {
1325
+ locale: apiContext.locale,
1326
+ profile: apiProfile,
1327
+ });
1328
+ const layer = definition?.variables?.find((variable) => variable.name === "$layer");
1329
+ if (layer) {
1330
+ this.updateFeatureLayerForModel(modelId, layer.definition);
1331
+ }
1332
+ }
1333
+ async getApiLibrary(modelId) {
1334
+ const uri = languageDefaultsBase.Uri.parse(modelId);
1335
+ const worker = await getSqlExprWorker(uri);
1336
+ return await worker.getApiLibrary(this.getApiContextForModel(uri));
1337
+ }
1338
+ }
1339
+ const sqlExprDefaults = new SqlExprDefaults();
1340
+
1341
+ exports.getFieldsFromLayerVariable = getFieldsFromLayerVariable;
1342
+ exports.getMode = getMode;
1343
+ exports.getSet = getSet;
1344
+ exports.makeController = makeController;
1345
+ exports.sqlExprDefaults = sqlExprDefaults;
1346
+ exports.useControllerManager = useControllerManager;
1347
+ exports.watch = watch;