@player-lang/json-language-service 0.0.2-next.0

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 (59) hide show
  1. package/dist/cjs/index.cjs +2314 -0
  2. package/dist/cjs/index.cjs.map +1 -0
  3. package/dist/index.legacy-esm.js +2249 -0
  4. package/dist/index.mjs +2249 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/package.json +40 -0
  7. package/src/__tests__/__snapshots__/service.test.ts.snap +213 -0
  8. package/src/__tests__/service.test.ts +298 -0
  9. package/src/constants.ts +38 -0
  10. package/src/index.ts +490 -0
  11. package/src/parser/__tests__/parse.test.ts +18 -0
  12. package/src/parser/document.ts +456 -0
  13. package/src/parser/edits.ts +31 -0
  14. package/src/parser/index.ts +38 -0
  15. package/src/parser/jsonParseErrors.ts +69 -0
  16. package/src/parser/types.ts +314 -0
  17. package/src/parser/utils.ts +94 -0
  18. package/src/plugins/__tests__/asset-wrapper-array-plugin.test.ts +112 -0
  19. package/src/plugins/__tests__/binding-schema-plugin.test.ts +62 -0
  20. package/src/plugins/__tests__/duplicate-id-plugin.test.ts +195 -0
  21. package/src/plugins/__tests__/missing-asset-wrapper-plugin.test.ts +190 -0
  22. package/src/plugins/__tests__/nav-state-plugin.test.ts +136 -0
  23. package/src/plugins/__tests__/view-node-plugin.test.ts +154 -0
  24. package/src/plugins/asset-wrapper-array-plugin.ts +123 -0
  25. package/src/plugins/binding-schema-plugin.ts +289 -0
  26. package/src/plugins/duplicate-id-plugin.ts +158 -0
  27. package/src/plugins/missing-asset-wrapper-plugin.ts +96 -0
  28. package/src/plugins/nav-state-plugin.ts +139 -0
  29. package/src/plugins/view-node-plugin.ts +225 -0
  30. package/src/plugins/xlr-plugin.ts +371 -0
  31. package/src/types.ts +119 -0
  32. package/src/utils.ts +143 -0
  33. package/src/xlr/__tests__/__snapshots__/transform.test.ts.snap +390 -0
  34. package/src/xlr/__tests__/transform.test.ts +108 -0
  35. package/src/xlr/index.ts +3 -0
  36. package/src/xlr/registry.ts +99 -0
  37. package/src/xlr/service.ts +190 -0
  38. package/src/xlr/transforms.ts +169 -0
  39. package/types/constants.d.ts +7 -0
  40. package/types/index.d.ts +69 -0
  41. package/types/parser/document.d.ts +25 -0
  42. package/types/parser/edits.d.ts +10 -0
  43. package/types/parser/index.d.ts +16 -0
  44. package/types/parser/jsonParseErrors.d.ts +27 -0
  45. package/types/parser/types.d.ts +188 -0
  46. package/types/parser/utils.d.ts +26 -0
  47. package/types/plugins/asset-wrapper-array-plugin.d.ts +9 -0
  48. package/types/plugins/binding-schema-plugin.d.ts +15 -0
  49. package/types/plugins/duplicate-id-plugin.d.ts +7 -0
  50. package/types/plugins/missing-asset-wrapper-plugin.d.ts +9 -0
  51. package/types/plugins/nav-state-plugin.d.ts +9 -0
  52. package/types/plugins/view-node-plugin.d.ts +9 -0
  53. package/types/plugins/xlr-plugin.d.ts +7 -0
  54. package/types/types.d.ts +81 -0
  55. package/types/utils.d.ts +24 -0
  56. package/types/xlr/index.d.ts +4 -0
  57. package/types/xlr/registry.d.ts +17 -0
  58. package/types/xlr/service.d.ts +22 -0
  59. package/types/xlr/transforms.d.ts +18 -0
@@ -0,0 +1,2314 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ ASTNodeImpl: () => ASTNodeImpl,
34
+ ArrayASTNodeImpl: () => ArrayASTNodeImpl,
35
+ AssetASTNodeImpl: () => AssetASTNodeImpl,
36
+ BooleanASTNodeImpl: () => BooleanASTNodeImpl,
37
+ ContentASTNodeImpl: () => ContentASTNodeImpl,
38
+ DEFAULT_FILTERS: () => DEFAULT_FILTERS,
39
+ FlowASTNodeImpl: () => FlowASTNodeImpl,
40
+ FlowStateASTNodeImpl: () => FlowStateASTNodeImpl,
41
+ LOG_TYPES: () => LOG_TYPES,
42
+ NavigationASTNodeImpl: () => NavigationASTNodeImpl,
43
+ NullASTNodeImpl: () => NullASTNodeImpl,
44
+ NumberASTNodeImpl: () => NumberASTNodeImpl,
45
+ ObjType: () => ObjType,
46
+ ObjectASTNodeImpl: () => ObjectASTNodeImpl,
47
+ PLUGINS: () => PLUGINS,
48
+ PlayerContent: () => PlayerContent,
49
+ PlayerLanguageService: () => PlayerLanguageService,
50
+ PlayerXLRRegistry: () => PlayerXLRRegistry,
51
+ PropertyASTNodeImpl: () => PropertyASTNodeImpl,
52
+ StringASTNodeImpl: () => StringASTNodeImpl,
53
+ TRANSFORM_FUNCTIONS: () => TRANSFORM_FUNCTIONS,
54
+ ViewASTNodeImpl: () => ViewASTNodeImpl,
55
+ XLRService: () => XLRService,
56
+ applyAssetWrapperOrSwitch: () => applyAssetWrapperOrSwitch,
57
+ applyCommonProps: () => applyCommonProps,
58
+ applyTemplateProperty: () => applyTemplateProperty,
59
+ applyValueRefs: () => applyValueRefs,
60
+ containsRange: () => containsRange,
61
+ formatLikeNode: () => formatLikeNode,
62
+ getContentNode: () => getContentNode,
63
+ getLSLocationOfNode: () => getLSLocationOfNode,
64
+ getNodeValue: () => getNodeValue,
65
+ getPropForValNode: () => getPropForValNode,
66
+ getProperty: () => getProperty,
67
+ getValForKey: () => getValForKey,
68
+ getViewNode: () => getViewNode,
69
+ isFlowNode: () => isFlowNode,
70
+ isKeyNode: () => isKeyNode,
71
+ isKnownRootType: () => isKnownRootType,
72
+ isNavigationNode: () => isNavigationNode,
73
+ isObjectNode: () => isObjectNode,
74
+ isPropertyCompletion: () => isPropertyCompletion,
75
+ isPropertyNode: () => isPropertyNode,
76
+ isStateNode: () => isStateNode,
77
+ isValueCompletion: () => isValueCompletion,
78
+ isValueNode: () => isValueNode,
79
+ isViewNode: () => isViewNode,
80
+ mapFlowStateToType: () => mapFlowStateToType,
81
+ parse: () => parse,
82
+ replaceString: () => replaceString,
83
+ toRange: () => toRange,
84
+ toTextDocument: () => toTextDocument,
85
+ toTextEdit: () => toTextEdit,
86
+ typeToVisitorMap: () => typeToVisitorMap,
87
+ walk: () => walk
88
+ });
89
+ module.exports = __toCommonJS(src_exports);
90
+ var import_jsonc_parser4 = require("jsonc-parser");
91
+ var import_tapable_ts = require("tapable-ts");
92
+ var import_vscode_languageserver_types11 = require("vscode-languageserver-types");
93
+
94
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/plugins/asset-wrapper-array-plugin.ts
95
+ var import_vscode_languageserver_types4 = require("vscode-languageserver-types");
96
+
97
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/parser/index.ts
98
+ var import_jsonc_parser3 = require("jsonc-parser");
99
+
100
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/parser/utils.ts
101
+ function isPropertyNode(node) {
102
+ return node?.type === "property";
103
+ }
104
+ function isObjectNode(node) {
105
+ return node?.type === "object";
106
+ }
107
+ function isKeyNode(node) {
108
+ return isPropertyNode(node?.parent) && node?.parent.keyNode === node;
109
+ }
110
+ function isValueNode(node) {
111
+ return isPropertyNode(node?.parent) && node?.parent.valueNode === node;
112
+ }
113
+ function isViewNode(node) {
114
+ return node?.type === "view";
115
+ }
116
+ function isStateNode(node) {
117
+ return node?.type === "state";
118
+ }
119
+ function isFlowNode(node) {
120
+ return node?.type === "flow";
121
+ }
122
+ function isNavigationNode(node) {
123
+ return node?.type === "navigation";
124
+ }
125
+ function getValForKey(node, key) {
126
+ const prop = node.properties.find((k) => k.keyNode.value === key);
127
+ return prop?.valueNode?.jsonNode.value;
128
+ }
129
+ function getPropForValNode(node) {
130
+ if (isValueNode(node) && isPropertyNode(node?.parent)) {
131
+ return node?.parent.keyNode.value;
132
+ }
133
+ }
134
+ function getViewNode(node) {
135
+ if (node.parent) {
136
+ if (node.parent.type === "view") {
137
+ return node.parent;
138
+ }
139
+ return getViewNode(node.parent);
140
+ }
141
+ if (node.type === "asset") {
142
+ return node;
143
+ }
144
+ }
145
+ function getContentNode(node) {
146
+ if (node.type === "content") {
147
+ return node;
148
+ }
149
+ return node.parent ? getContentNode(node.parent) : void 0;
150
+ }
151
+
152
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/parser/document.ts
153
+ var import_jsonc_parser2 = require("jsonc-parser");
154
+
155
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/parser/types.ts
156
+ var ASTNodeImpl = class {
157
+ parent;
158
+ jsonNode;
159
+ constructor(jsonNode, parent) {
160
+ this.jsonNode = jsonNode;
161
+ this.parent = parent;
162
+ }
163
+ };
164
+ var StringASTNodeImpl = class extends ASTNodeImpl {
165
+ type = "string";
166
+ value;
167
+ constructor(jsonNode, parent) {
168
+ super(jsonNode, parent);
169
+ this.value = jsonNode.value;
170
+ }
171
+ };
172
+ var NumberASTNodeImpl = class extends ASTNodeImpl {
173
+ type = "number";
174
+ value;
175
+ constructor(jsonNode, parent) {
176
+ super(jsonNode, parent);
177
+ this.value = jsonNode.value;
178
+ }
179
+ };
180
+ var BooleanASTNodeImpl = class extends ASTNodeImpl {
181
+ type = "boolean";
182
+ value;
183
+ constructor(jsonNode, parent) {
184
+ super(jsonNode, parent);
185
+ this.value = jsonNode.value;
186
+ }
187
+ };
188
+ var NullASTNodeImpl = class extends ASTNodeImpl {
189
+ type = "null";
190
+ value = null;
191
+ };
192
+ var PropertyASTNodeImpl = class extends ASTNodeImpl {
193
+ type = "property";
194
+ keyNode;
195
+ valueNode;
196
+ constructor(jsonNode, parent, keyNode) {
197
+ super(jsonNode, parent);
198
+ this.keyNode = keyNode;
199
+ }
200
+ get children() {
201
+ return this.valueNode ? [this.keyNode, this.valueNode] : [this.keyNode];
202
+ }
203
+ };
204
+ var ViewASTNodeImpl = class extends ASTNodeImpl {
205
+ type = "view";
206
+ properties = [];
207
+ id = void 0;
208
+ viewType = void 0;
209
+ get children() {
210
+ return this.properties;
211
+ }
212
+ };
213
+ var ContentASTNodeImpl = class extends ASTNodeImpl {
214
+ type = "content";
215
+ properties = [];
216
+ views = void 0;
217
+ navigation = void 0;
218
+ get children() {
219
+ return this.properties;
220
+ }
221
+ };
222
+ var NavigationASTNodeImpl = class extends ASTNodeImpl {
223
+ type = "navigation";
224
+ properties = [];
225
+ begin = void 0;
226
+ flows = [];
227
+ get children() {
228
+ return this.properties;
229
+ }
230
+ };
231
+ var FlowASTNodeImpl = class extends ASTNodeImpl {
232
+ type = "flow";
233
+ properties = [];
234
+ start = void 0;
235
+ states = [];
236
+ get children() {
237
+ return this.properties;
238
+ }
239
+ };
240
+ var FlowStateASTNodeImpl = class extends ASTNodeImpl {
241
+ type = "state";
242
+ properties = [];
243
+ stateType = void 0;
244
+ get children() {
245
+ return this.properties;
246
+ }
247
+ };
248
+ var AssetASTNodeImpl = class extends ASTNodeImpl {
249
+ type = "asset";
250
+ properties = [];
251
+ id = void 0;
252
+ assetType = void 0;
253
+ get children() {
254
+ return this.properties;
255
+ }
256
+ };
257
+ var ArrayASTNodeImpl = class extends ASTNodeImpl {
258
+ type = "array";
259
+ items = [];
260
+ get children() {
261
+ return this.items;
262
+ }
263
+ };
264
+ var ObjectASTNodeImpl = class extends ASTNodeImpl {
265
+ type = "object";
266
+ properties = [];
267
+ get children() {
268
+ return this.properties;
269
+ }
270
+ };
271
+
272
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/parser/jsonParseErrors.ts
273
+ var import_jsonc_parser = require("jsonc-parser");
274
+ var import_vscode_languageserver_types = require("vscode-languageserver-types");
275
+ function prettyPrintParseErrorCode(code) {
276
+ switch (code) {
277
+ case 6 /* CommaExpected */:
278
+ return `Expected comma`;
279
+ case 5 /* ColonExpected */:
280
+ return `Expected colon`;
281
+ case 3 /* PropertyNameExpected */:
282
+ return `Expected property name`;
283
+ case 4 /* ValueExpected */:
284
+ return `Expected value`;
285
+ case 7 /* CloseBraceExpected */:
286
+ return `Expected }`;
287
+ case 9 /* EndOfFileExpected */:
288
+ return `Expected end of file`;
289
+ case 8 /* CloseBracketExpected */:
290
+ return `Expected ]`;
291
+ case 12 /* UnexpectedEndOfString */:
292
+ return `Expected "`;
293
+ default:
294
+ return (0, import_jsonc_parser.printParseErrorCode)(code);
295
+ }
296
+ }
297
+ function convertErrorsToDiags(document, errors) {
298
+ return errors.map((parseError) => {
299
+ return import_vscode_languageserver_types.Diagnostic.create(
300
+ import_vscode_languageserver_types.Range.create(
301
+ document.positionAt(parseError.offset),
302
+ document.positionAt(parseError.offset + parseError.length)
303
+ ),
304
+ prettyPrintParseErrorCode(parseError.error),
305
+ import_vscode_languageserver_types.DiagnosticSeverity.Error
306
+ );
307
+ });
308
+ }
309
+
310
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/parser/document.ts
311
+ function isStringProperty(node) {
312
+ return node.valueNode?.type === "string";
313
+ }
314
+ var PlayerContent = class {
315
+ root;
316
+ syntaxErrors;
317
+ jsonNodeToNode;
318
+ constructor(root, errors, jsonToNodeMap) {
319
+ this.root = root;
320
+ this.jsonNodeToNode = jsonToNodeMap;
321
+ this.syntaxErrors = errors;
322
+ }
323
+ getNodeFromOffset(offset) {
324
+ const jsonNode = (0, import_jsonc_parser2.findNodeAtOffset)(this.root.jsonNode, offset);
325
+ if (!jsonNode) {
326
+ return;
327
+ }
328
+ if (this.jsonNodeToNode.has(jsonNode)) {
329
+ return this.jsonNodeToNode.get(jsonNode);
330
+ }
331
+ const parentNode = jsonNode.parent;
332
+ if (this.jsonNodeToNode.has(parentNode)) {
333
+ return this.jsonNodeToNode.get(parentNode);
334
+ }
335
+ const grandparentNode = parentNode.parent;
336
+ if (this.jsonNodeToNode.has(grandparentNode)) {
337
+ return this.jsonNodeToNode.get(grandparentNode);
338
+ }
339
+ const greatGrandparentNode = grandparentNode.parent;
340
+ if (this.jsonNodeToNode.has(greatGrandparentNode)) {
341
+ return this.jsonNodeToNode.get(greatGrandparentNode);
342
+ }
343
+ }
344
+ };
345
+ var ObjType = /* @__PURE__ */ ((ObjType2) => {
346
+ ObjType2[ObjType2["FLOW"] = 0] = "FLOW";
347
+ ObjType2[ObjType2["ASSET"] = 1] = "ASSET";
348
+ ObjType2[ObjType2["ASSET_WRAPPER"] = 2] = "ASSET_WRAPPER";
349
+ ObjType2[ObjType2["UNKNOWN"] = 3] = "UNKNOWN";
350
+ return ObjType2;
351
+ })(ObjType || {});
352
+ function identify(node) {
353
+ if (node === void 0 || node.type !== "object") {
354
+ return 3 /* UNKNOWN */;
355
+ }
356
+ const knownProps = node.children?.reduce((props, childNode) => {
357
+ if (childNode.type === "property" && childNode.children) {
358
+ const [key] = childNode.children;
359
+ props.add(key.value);
360
+ }
361
+ return props;
362
+ }, /* @__PURE__ */ new Set());
363
+ if (knownProps?.has("type")) {
364
+ return 1 /* ASSET */;
365
+ }
366
+ return 0 /* FLOW */;
367
+ }
368
+ function parse(document) {
369
+ const errors = [];
370
+ const jsonToNode = /* @__PURE__ */ new Map();
371
+ const root = (0, import_jsonc_parser2.parseTree)(document.getText(), errors, {
372
+ disallowComments: true
373
+ });
374
+ const diags = convertErrorsToDiags(document, errors);
375
+ function parseAsset(node, parent) {
376
+ const assetNode = new AssetASTNodeImpl(node, parent);
377
+ node.children?.forEach((prop) => {
378
+ if (prop.type === "property" && prop.children?.length) {
379
+ const [key, val] = prop.children;
380
+ const keyNode = new StringASTNodeImpl(key);
381
+ const property = new PropertyASTNodeImpl(prop, assetNode, keyNode);
382
+ property.keyNode = new StringASTNodeImpl(key, property);
383
+ property.valueNode = parseUnknownNode(val, property);
384
+ if (key.value === "id" && isStringProperty(property)) {
385
+ assetNode.id = property;
386
+ } else if (key.value === "type" && isStringProperty(property)) {
387
+ assetNode.assetType = property;
388
+ }
389
+ assetNode.properties.push(property);
390
+ jsonToNode.set(prop, property);
391
+ jsonToNode.set(key, property.keyNode);
392
+ if (property.valueNode) {
393
+ jsonToNode.set(val, property.valueNode);
394
+ }
395
+ }
396
+ });
397
+ return assetNode;
398
+ }
399
+ function parseUnknownNode(node, parent) {
400
+ switch (node?.type) {
401
+ case "string": {
402
+ const newNode = new StringASTNodeImpl(node, parent);
403
+ jsonToNode.set(node, newNode);
404
+ return newNode;
405
+ }
406
+ case "null": {
407
+ const newNode = new NullASTNodeImpl(node, parent);
408
+ jsonToNode.set(node, newNode);
409
+ return newNode;
410
+ }
411
+ case "boolean": {
412
+ const newNode = new BooleanASTNodeImpl(node, parent);
413
+ jsonToNode.set(node, newNode);
414
+ return newNode;
415
+ }
416
+ case "number": {
417
+ const newNode = new NumberASTNodeImpl(node, parent);
418
+ jsonToNode.set(node, newNode);
419
+ return newNode;
420
+ }
421
+ case "array": {
422
+ const arr = new ArrayASTNodeImpl(node, parent);
423
+ node.children?.forEach((arrChild) => {
424
+ const child = parseUnknownNode(arrChild, arr);
425
+ if (child) {
426
+ jsonToNode.set(arrChild, child);
427
+ arr.items.push(child);
428
+ }
429
+ });
430
+ jsonToNode.set(node, arr);
431
+ return arr;
432
+ }
433
+ case "object": {
434
+ const obj = new ObjectASTNodeImpl(node, parent);
435
+ jsonToNode.set(node, obj);
436
+ node.children?.forEach((prop) => {
437
+ if (prop.type === "property" && prop.children?.length) {
438
+ const [key, val] = prop.children;
439
+ const keyNode = new StringASTNodeImpl(key);
440
+ const propNode = new PropertyASTNodeImpl(prop, obj, keyNode);
441
+ propNode.keyNode = new StringASTNodeImpl(key, propNode);
442
+ if (val) {
443
+ if (keyNode.value === "asset") {
444
+ propNode.valueNode = parseAsset(val, propNode);
445
+ } else {
446
+ propNode.valueNode = parseUnknownNode(val, propNode);
447
+ }
448
+ }
449
+ jsonToNode.set(prop, propNode);
450
+ jsonToNode.set(key, propNode.keyNode);
451
+ if (propNode.valueNode) {
452
+ jsonToNode.set(val, propNode.valueNode);
453
+ }
454
+ obj.properties.push(propNode);
455
+ }
456
+ });
457
+ return obj;
458
+ }
459
+ default:
460
+ }
461
+ }
462
+ function parseView(node, parent) {
463
+ const viewNode = new ViewASTNodeImpl(node, parent);
464
+ node.children?.forEach((prop) => {
465
+ if (prop.type === "property" && (prop.children?.length ?? 0) > 0) {
466
+ const [key, val] = prop.children ?? [];
467
+ const keyNode = new StringASTNodeImpl(key);
468
+ const property = new PropertyASTNodeImpl(prop, viewNode, keyNode);
469
+ property.keyNode = new StringASTNodeImpl(key, property);
470
+ if (val) {
471
+ property.valueNode = parseUnknownNode(val, property);
472
+ if (key.value === "id" && isStringProperty(property)) {
473
+ viewNode.id = property;
474
+ } else if (key.value === "type" && isStringProperty(property)) {
475
+ viewNode.viewType = property;
476
+ }
477
+ }
478
+ jsonToNode.set(prop, property);
479
+ jsonToNode.set(key, property.keyNode);
480
+ if (property.valueNode) {
481
+ jsonToNode.set(val, property.valueNode);
482
+ }
483
+ viewNode.properties.push(property);
484
+ }
485
+ });
486
+ jsonToNode.set(node, viewNode);
487
+ return viewNode;
488
+ }
489
+ function parseFlowState(node, parent) {
490
+ const state = new FlowStateASTNodeImpl(node, parent);
491
+ jsonToNode.set(node, state);
492
+ if (node.type === "object") {
493
+ node.children?.forEach((prop) => {
494
+ if (prop.type === "property" && prop.children?.length) {
495
+ const [key, val] = prop.children;
496
+ const keyNode = new StringASTNodeImpl(key);
497
+ const property = new PropertyASTNodeImpl(prop, state, keyNode);
498
+ property.keyNode = new StringASTNodeImpl(key, property);
499
+ if (key.value === "state_type" && val?.type === "string") {
500
+ property.valueNode = parseUnknownNode(val, property);
501
+ state.stateType = property;
502
+ } else {
503
+ property.valueNode = parseUnknownNode(val, property);
504
+ }
505
+ jsonToNode.set(prop, property);
506
+ jsonToNode.set(key, property.keyNode);
507
+ if (property.valueNode) {
508
+ jsonToNode.set(val, property.valueNode);
509
+ }
510
+ state.properties.push(property);
511
+ }
512
+ });
513
+ }
514
+ return state;
515
+ }
516
+ function parseFlow(node, parent) {
517
+ const flow = new FlowASTNodeImpl(node, parent);
518
+ jsonToNode.set(node, flow);
519
+ if (node.type === "object") {
520
+ node.children?.forEach((prop) => {
521
+ if (prop.type === "property" && prop.children?.length) {
522
+ const [key, val] = prop.children;
523
+ const keyNode = new StringASTNodeImpl(key);
524
+ const property = new PropertyASTNodeImpl(prop, flow, keyNode);
525
+ property.keyNode = new StringASTNodeImpl(key, property);
526
+ if (key.value === "startState" && val?.type === "string") {
527
+ property.valueNode = parseUnknownNode(val, property);
528
+ flow.start = property;
529
+ } else if (val?.type === "object" && property.keyNode.value !== "onStart" && property.keyNode.value !== "onEnd") {
530
+ property.valueNode = parseFlowState(val, property);
531
+ flow.states.push(property);
532
+ } else {
533
+ property.valueNode = parseUnknownNode(val, property);
534
+ }
535
+ jsonToNode.set(prop, property);
536
+ jsonToNode.set(key, property.keyNode);
537
+ if (property.valueNode) {
538
+ jsonToNode.set(val, property.valueNode);
539
+ }
540
+ flow.properties.push(property);
541
+ }
542
+ });
543
+ }
544
+ return flow;
545
+ }
546
+ function parseNavigation(node, parent) {
547
+ const navNode = new NavigationASTNodeImpl(node, parent);
548
+ jsonToNode.set(node, navNode);
549
+ if (node.type === "object") {
550
+ node.children?.forEach((prop) => {
551
+ if (prop.type === "property" && prop.children?.length) {
552
+ const [key, val] = prop.children;
553
+ const keyNode = new StringASTNodeImpl(key);
554
+ const property = new PropertyASTNodeImpl(prop, navNode, keyNode);
555
+ property.keyNode = new StringASTNodeImpl(key, property);
556
+ if (key.value === "BEGIN" && val?.type === "string") {
557
+ property.valueNode = parseUnknownNode(val, property);
558
+ navNode.begin = property;
559
+ } else if (val?.type === "object") {
560
+ property.valueNode = parseFlow(val, property);
561
+ navNode.flows.push(property);
562
+ }
563
+ jsonToNode.set(prop, property);
564
+ jsonToNode.set(key, property.keyNode);
565
+ if (property.valueNode) {
566
+ jsonToNode.set(val, property.valueNode);
567
+ }
568
+ navNode.properties.push(property);
569
+ }
570
+ });
571
+ }
572
+ return navNode;
573
+ }
574
+ function parseContent(node) {
575
+ const contentNode = new ContentASTNodeImpl(node, void 0);
576
+ if (node.type === "object") {
577
+ node.children?.forEach((childProp) => {
578
+ if (childProp.type === "property" && childProp.children?.length) {
579
+ const [key, val] = childProp.children;
580
+ const keyNode = new StringASTNodeImpl(key);
581
+ const property = new PropertyASTNodeImpl(
582
+ childProp,
583
+ contentNode,
584
+ keyNode
585
+ );
586
+ property.keyNode = new StringASTNodeImpl(key, property);
587
+ if (key.value === "views" && val?.type === "array") {
588
+ const views = new ArrayASTNodeImpl(val, property);
589
+ val.children?.forEach((view) => {
590
+ const parsedV = parseView(view, views);
591
+ jsonToNode.set(view, parsedV);
592
+ views.items.push(parsedV);
593
+ });
594
+ property.valueNode = views;
595
+ contentNode.views = property;
596
+ } else if (key.value === "navigation" && val) {
597
+ const nav = parseNavigation(val, property);
598
+ contentNode.navigation = property;
599
+ property.valueNode = nav;
600
+ } else if (val) {
601
+ property.valueNode = parseUnknownNode(val, property);
602
+ }
603
+ jsonToNode.set(childProp, property);
604
+ jsonToNode.set(key, property.keyNode);
605
+ if (property.valueNode) {
606
+ jsonToNode.set(val, property.valueNode);
607
+ }
608
+ contentNode.properties.push(property);
609
+ }
610
+ });
611
+ }
612
+ jsonToNode.set(node, contentNode);
613
+ return contentNode;
614
+ }
615
+ let rootASTNode = {
616
+ type: "empty",
617
+ value: void 0,
618
+ jsonNode: root
619
+ };
620
+ const objType = identify(root);
621
+ switch (objType) {
622
+ case 1 /* ASSET */:
623
+ rootASTNode = parseAsset(root);
624
+ break;
625
+ case 0 /* FLOW */:
626
+ rootASTNode = parseContent(root);
627
+ break;
628
+ default:
629
+ break;
630
+ }
631
+ return new PlayerContent(rootASTNode, diags, jsonToNode);
632
+ }
633
+
634
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/parser/edits.ts
635
+ var import_vscode_languageserver_types2 = require("vscode-languageserver-types");
636
+ function replaceString(node, newText) {
637
+ return {
638
+ type: "replace",
639
+ node,
640
+ value: newText
641
+ };
642
+ }
643
+ function toRange(document, node) {
644
+ return import_vscode_languageserver_types2.Range.create(
645
+ document.positionAt(node.jsonNode.offset),
646
+ document.positionAt(node.jsonNode.offset + node.jsonNode.length)
647
+ );
648
+ }
649
+ function toTextEdit(document, edit) {
650
+ switch (edit.type) {
651
+ case "replace":
652
+ return import_vscode_languageserver_types2.TextEdit.replace(toRange(document, edit.node), edit.value);
653
+ default:
654
+ throw new Error("Dont know how to convert this to a TextEdit");
655
+ }
656
+ }
657
+
658
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/parser/index.ts
659
+ async function walk(node, visitor) {
660
+ const queue = [node];
661
+ let stop = false;
662
+ while (queue.length > 0 && !stop) {
663
+ const nodeToVisit = queue.shift();
664
+ if (nodeToVisit?.children) {
665
+ queue.push(...nodeToVisit.children);
666
+ }
667
+ stop = nodeToVisit ? await visitor(nodeToVisit) : true;
668
+ }
669
+ }
670
+ function getNodeValue(node) {
671
+ return (0, import_jsonc_parser3.getNodeValue)(node.jsonNode);
672
+ }
673
+
674
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/utils.ts
675
+ var import_vscode_languageserver_types3 = require("vscode-languageserver-types");
676
+ var import_vscode_languageserver_textdocument = require("vscode-languageserver-textdocument");
677
+ var import_detect_indent = __toESM(require("detect-indent"));
678
+ var typeToVisitorMap = {
679
+ string: "StringNode",
680
+ number: "NumberNode",
681
+ boolean: "BooleanNode",
682
+ array: "ArrayNode",
683
+ null: "NullNode",
684
+ empty: "EmptyNode",
685
+ property: "PropertyNode",
686
+ object: "ObjectNode",
687
+ asset: "AssetNode",
688
+ view: "ViewNode",
689
+ content: "ContentNode",
690
+ navigation: "NavigationNode",
691
+ flow: "FlowNode",
692
+ state: "FlowStateNode"
693
+ };
694
+ function containsRange(source, range) {
695
+ const { start, end } = range;
696
+ const { start: srcStart, end: srcEnd } = source;
697
+ return start.line === srcStart.line && end.line === srcEnd.line && start.character >= srcStart.character && end.character <= srcEnd.character;
698
+ }
699
+ function toTextDocument(str) {
700
+ return import_vscode_languageserver_textdocument.TextDocument.create("foo", "json", 1, str);
701
+ }
702
+ function isKnownRootType(document) {
703
+ const { type } = document.root;
704
+ return type === "view" || type === "asset" || type === "content";
705
+ }
706
+ function isValueCompletion(node) {
707
+ return node.parent?.type === "property" && node.parent.valueNode === node;
708
+ }
709
+ function isPropertyCompletion(node) {
710
+ return node.parent?.type === "property" && node.parent.keyNode === node;
711
+ }
712
+ function getProperty(obj, name) {
713
+ if ("properties" in obj) {
714
+ return obj.properties.find(
715
+ (p) => p.keyNode.value === name
716
+ );
717
+ }
718
+ }
719
+ function getLSLocationOfNode(document, node) {
720
+ const nodeRange = import_vscode_languageserver_types3.Range.create(
721
+ document.positionAt(node.jsonNode.offset),
722
+ document.positionAt(node.jsonNode.offset + node.jsonNode.length)
723
+ );
724
+ return import_vscode_languageserver_types3.Location.create(document.uri, nodeRange);
725
+ }
726
+ function getDepth(node) {
727
+ if (!node.parent) {
728
+ return 0;
729
+ }
730
+ if (node.type === "property") {
731
+ return getDepth(node.parent);
732
+ }
733
+ return 1 + getDepth(node.parent);
734
+ }
735
+ function formatLikeNode(document, originalNode, replacement) {
736
+ const { indent } = (0, import_detect_indent.default)(document.getText());
737
+ const depth = getDepth(originalNode);
738
+ return JSON.stringify(replacement, null, indent).split("\n").map((l, index) => index === 0 ? l : `${indent.repeat(depth)}${l}`).join("\n");
739
+ }
740
+ function mapFlowStateToType(flowType) {
741
+ let flowXLR;
742
+ switch (flowType) {
743
+ case "VIEW":
744
+ flowXLR = "NavigationFlowViewState";
745
+ break;
746
+ case "END":
747
+ flowXLR = "NavigationFlowEndState";
748
+ break;
749
+ case "ACTION":
750
+ flowXLR = "NavigationFlowActionState";
751
+ break;
752
+ case "EXTERNAL":
753
+ flowXLR = "NavigationFlowExternalState";
754
+ break;
755
+ case "FLOW":
756
+ flowXLR = "NavigationFlowFlowState";
757
+ break;
758
+ default:
759
+ break;
760
+ }
761
+ return flowXLR;
762
+ }
763
+
764
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/plugins/asset-wrapper-array-plugin.ts
765
+ var isInView = (node) => {
766
+ if (node.type === "view") {
767
+ return true;
768
+ }
769
+ if (!node.parent) {
770
+ return false;
771
+ }
772
+ return isInView(node.parent);
773
+ };
774
+ var checkTypesForAssetWrapper = (nodes) => {
775
+ for (let i = 0; i < nodes.length; i++) {
776
+ const node = nodes[i];
777
+ if (node.type === "object" && node.title?.includes("AssetWrapper")) {
778
+ return true;
779
+ } else if (node.type === "or") {
780
+ return checkTypesForAssetWrapper(node.or);
781
+ } else if (node.type === "and") {
782
+ return checkTypesForAssetWrapper(node.and);
783
+ }
784
+ }
785
+ return false;
786
+ };
787
+ var checkSwitchCase = (node) => {
788
+ return node.value === "staticSwitch" || node.value === "dynamicSwitch";
789
+ };
790
+ var AssetWrapperArrayPlugin = class {
791
+ name = "asset-wrapper-to-array";
792
+ apply(service) {
793
+ service.hooks.validate.tap(
794
+ this.name,
795
+ async (documentInfo, validationContext) => {
796
+ validationContext.useASTVisitor({
797
+ ArrayNode: async (arrayNode) => {
798
+ if (!isInView(arrayNode)) {
799
+ return;
800
+ }
801
+ const xlrInfo = service.XLRService.getTypeInfoAtPosition(arrayNode);
802
+ if (!xlrInfo) return;
803
+ const isAssetWrapper = checkTypesForAssetWrapper(xlrInfo.nodes);
804
+ const parentNode = arrayNode.parent;
805
+ if (parentNode?.type !== "property") {
806
+ return;
807
+ }
808
+ const targetLabel = parentNode.keyNode;
809
+ const isSwitchCase = checkSwitchCase(targetLabel);
810
+ if (isAssetWrapper && !isSwitchCase) {
811
+ let newAsset = {
812
+ asset: {
813
+ id: "",
814
+ type: "collection",
815
+ values: getNodeValue(arrayNode)
816
+ }
817
+ };
818
+ if (arrayNode.children.length === 1) {
819
+ newAsset = getNodeValue(arrayNode.children[0]);
820
+ }
821
+ validationContext.addViolation({
822
+ node: targetLabel,
823
+ severity: import_vscode_languageserver_types4.DiagnosticSeverity.Error,
824
+ message: `Implicit Array -> "collection" assets is not supported.`,
825
+ fix: () => {
826
+ return {
827
+ name: `Convert to ${arrayNode.children.length > 0 ? "collection" : "asset"}`,
828
+ edit: {
829
+ type: "replace",
830
+ node: arrayNode,
831
+ value: formatLikeNode(
832
+ documentInfo.document,
833
+ arrayNode,
834
+ newAsset
835
+ )
836
+ }
837
+ };
838
+ }
839
+ });
840
+ }
841
+ }
842
+ });
843
+ }
844
+ );
845
+ }
846
+ };
847
+
848
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/plugins/binding-schema-plugin.ts
849
+ var import_vscode_languageserver_types5 = require("vscode-languageserver-types");
850
+ function getBindingInfo(ctx) {
851
+ const info = {
852
+ bindingToSchemaType: /* @__PURE__ */ new Map(),
853
+ typeToNode: /* @__PURE__ */ new Map()
854
+ };
855
+ if (ctx.PlayerContent.root.type !== "content") {
856
+ return info;
857
+ }
858
+ const schemaRoot = ctx.PlayerContent.root.properties?.find(
859
+ (child) => child.keyNode.value === "schema"
860
+ );
861
+ if (!schemaRoot || schemaRoot.valueNode?.type !== "object") {
862
+ return info;
863
+ }
864
+ const schemaTypeQueue = [
865
+ {
866
+ currentPath: "",
867
+ typeToVisit: "ROOT",
868
+ visited: /* @__PURE__ */ new Set()
869
+ }
870
+ ];
871
+ while (schemaTypeQueue.length > 0) {
872
+ const next = schemaTypeQueue.shift();
873
+ if (!next) {
874
+ break;
875
+ }
876
+ if (next.visited.has(next.typeToVisit)) {
877
+ continue;
878
+ }
879
+ const visited = new Set(...next.visited, next.typeToVisit);
880
+ const { currentPath, typeToVisit } = next;
881
+ const typeNode = schemaRoot.valueNode.properties.find(
882
+ (child) => child.keyNode.value === typeToVisit
883
+ );
884
+ if (!typeNode || typeNode.valueNode?.type !== "object") {
885
+ continue;
886
+ }
887
+ info.typeToNode.set(typeToVisit, { type: typeToVisit, typeNode });
888
+ typeNode.valueNode.properties.forEach((prop) => {
889
+ const nextPath = [currentPath, prop.keyNode.value].join(
890
+ currentPath === "" ? "" : "."
891
+ );
892
+ info.bindingToSchemaType.set(nextPath, {
893
+ binding: nextPath,
894
+ typeName: typeToVisit,
895
+ key: prop.keyNode.value
896
+ });
897
+ if (prop.valueNode?.type === "object") {
898
+ const nestedTypeName = prop.valueNode.properties.find(
899
+ (c) => c.keyNode.value === "type"
900
+ );
901
+ if (nestedTypeName && nestedTypeName.valueNode?.type === "string") {
902
+ schemaTypeQueue.push({
903
+ currentPath: nextPath,
904
+ typeToVisit: nestedTypeName.valueNode.value,
905
+ visited
906
+ });
907
+ }
908
+ }
909
+ });
910
+ }
911
+ return info;
912
+ }
913
+ var checkTypesForBinding = (nodes) => {
914
+ for (let i = 0; i < nodes.length; i++) {
915
+ const node = nodes[i];
916
+ if (node.type === "string" && node.name === "Binding") return true;
917
+ if (node.type === "or") return checkTypesForBinding(node.or);
918
+ if (node.type === "and") return checkTypesForBinding(node.and);
919
+ }
920
+ return false;
921
+ };
922
+ function isBindingPropertyAssignment(ctx) {
923
+ if (ctx.node.type !== "string" || ctx.node.parent?.type !== "property") {
924
+ return false;
925
+ }
926
+ if (checkTypesForBinding(ctx.XLR?.nodes ?? [])) {
927
+ return true;
928
+ }
929
+ return false;
930
+ }
931
+ function getLocationForBindingTypeDefinition(ctx, schemaInfo) {
932
+ if (!isBindingPropertyAssignment(ctx)) {
933
+ return;
934
+ }
935
+ const existingBindingValue = ctx.node.value;
936
+ const info = schemaInfo.bindingToSchemaType.get(existingBindingValue);
937
+ if (!info) {
938
+ return;
939
+ }
940
+ const nodeLocation = schemaInfo.typeToNode.get(info.typeName);
941
+ if (!nodeLocation || nodeLocation.typeNode.valueNode?.type !== "object") {
942
+ return;
943
+ }
944
+ const prop = getProperty(nodeLocation.typeNode.valueNode, info.key);
945
+ if (!prop) {
946
+ return;
947
+ }
948
+ return getLSLocationOfNode(ctx.document, prop);
949
+ }
950
+ function getLocationForSchemaType(ctx, schemaInfo) {
951
+ if (isValueCompletion(ctx.node)) {
952
+ if (ctx.node.parent?.type === "property" && ctx.node.type === "string" && ctx.node.parent.keyNode.value === "type") {
953
+ const typeName = ctx.node.value;
954
+ const node = schemaInfo.typeToNode.get(typeName);
955
+ if (!node) {
956
+ return;
957
+ }
958
+ const schemaPropNode = getContentNode(ctx.node)?.properties.find(
959
+ (p) => p.keyNode.value === "schema"
960
+ );
961
+ if (schemaPropNode?.valueNode?.type !== "object") {
962
+ return;
963
+ }
964
+ const schemaTypeNode = schemaPropNode.valueNode.properties.find(
965
+ (p) => p.keyNode.value === typeName
966
+ );
967
+ if (schemaTypeNode !== node.typeNode) {
968
+ return;
969
+ }
970
+ return getLSLocationOfNode(ctx.document, node.typeNode);
971
+ }
972
+ }
973
+ }
974
+ var SchemaInfoPlugin = class {
975
+ name = "view-node";
976
+ apply(service) {
977
+ let schemaInfo;
978
+ service.hooks.onDocumentUpdate.tap(this.name, (ctx) => {
979
+ schemaInfo = getBindingInfo(ctx);
980
+ });
981
+ service.hooks.complete.tap(this.name, async (ctx, completionCtx) => {
982
+ if (!isBindingPropertyAssignment(ctx)) {
983
+ return;
984
+ }
985
+ const existingBindingValue = ctx.node.value;
986
+ const bindings = Array.from(
987
+ schemaInfo?.bindingToSchemaType.keys() ?? []
988
+ ).filter((k) => k.startsWith(existingBindingValue));
989
+ bindings.forEach((b) => {
990
+ completionCtx.addCompletionItem({
991
+ kind: import_vscode_languageserver_types5.CompletionItemKind.Value,
992
+ label: b.substring(existingBindingValue.length)
993
+ });
994
+ });
995
+ });
996
+ service.hooks.definition.tap(this.name, (ctx) => {
997
+ if (!schemaInfo) {
998
+ return;
999
+ }
1000
+ return getLocationForSchemaType(ctx, schemaInfo) || getLocationForBindingTypeDefinition(ctx, schemaInfo);
1001
+ });
1002
+ }
1003
+ };
1004
+
1005
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/plugins/xlr-plugin.ts
1006
+ var import_vscode_languageserver_types6 = require("vscode-languageserver-types");
1007
+ function isError(issue) {
1008
+ return issue.severity === import_vscode_languageserver_types6.DiagnosticSeverity.Error;
1009
+ }
1010
+ var findErrorNode = (rootNode, nodeToFind) => {
1011
+ const children = [rootNode];
1012
+ while (children.length > 0) {
1013
+ const child = children.pop();
1014
+ if (child.jsonNode === nodeToFind) {
1015
+ return child;
1016
+ }
1017
+ if (child.children) {
1018
+ children.push(...child.children);
1019
+ }
1020
+ }
1021
+ return rootNode;
1022
+ };
1023
+ var translateSeverity = (severity) => {
1024
+ return severity;
1025
+ };
1026
+ function createValidationVisitor(ctx, sdk) {
1027
+ const nodesWithErrors = /* @__PURE__ */ new Set();
1028
+ return {
1029
+ AssetNode: (assetNode) => {
1030
+ let expectedType = assetNode.assetType?.valueNode?.value;
1031
+ if (!sdk.hasType(expectedType)) {
1032
+ ctx.addViolation({
1033
+ node: assetNode,
1034
+ message: `Warning - Asset Type ${assetNode.assetType?.valueNode?.value} was not loaded into Validator definitions`,
1035
+ severity: import_vscode_languageserver_types6.DiagnosticSeverity.Error
1036
+ });
1037
+ expectedType = "Asset";
1038
+ }
1039
+ const validationIssues = sdk.validateByName(
1040
+ expectedType,
1041
+ assetNode.jsonNode
1042
+ );
1043
+ validationIssues.forEach((issue) => {
1044
+ if (!(nodesWithErrors.has(issue.node) && isError(issue))) {
1045
+ ctx.addViolation({
1046
+ node: findErrorNode(assetNode, issue.node),
1047
+ message: isError(issue) ? `Asset Validation Error - ${issue.type}: ${issue.message}` : issue.message,
1048
+ severity: translateSeverity(issue.severity)
1049
+ });
1050
+ if (isError(issue)) {
1051
+ nodesWithErrors.add(issue.node);
1052
+ }
1053
+ }
1054
+ });
1055
+ },
1056
+ ViewNode: (viewNode) => {
1057
+ let expectedType = viewNode.viewType?.valueNode?.value;
1058
+ if (!sdk.hasType(expectedType)) {
1059
+ ctx.addViolation({
1060
+ node: viewNode,
1061
+ message: `Warning - View Type ${viewNode.viewType?.valueNode?.value} was not loaded into Validator definitions`,
1062
+ severity: import_vscode_languageserver_types6.DiagnosticSeverity.Error
1063
+ });
1064
+ expectedType = "View";
1065
+ }
1066
+ const validationIssues = sdk.validateByName(
1067
+ expectedType,
1068
+ viewNode.jsonNode
1069
+ );
1070
+ validationIssues.forEach((issue) => {
1071
+ if (!(nodesWithErrors.has(issue.node) && isError(issue))) {
1072
+ ctx.addViolation({
1073
+ node: findErrorNode(viewNode, issue.node),
1074
+ message: isError(issue) ? `View Validation Error - ${issue.type}: ${issue.message}` : issue.message,
1075
+ severity: translateSeverity(issue.severity)
1076
+ });
1077
+ if (isError(issue)) {
1078
+ nodesWithErrors.add(issue.node);
1079
+ }
1080
+ }
1081
+ });
1082
+ },
1083
+ ContentNode: (contentNode) => {
1084
+ const flowType = sdk.getType("Flow");
1085
+ if (!flowType) {
1086
+ throw new Error(
1087
+ "Flow is not a registered type, can't validate content. Did you load a version of the base Player types?"
1088
+ );
1089
+ }
1090
+ const assetType = sdk.getType("Asset");
1091
+ if (!assetType) {
1092
+ throw new Error(
1093
+ "Asset is not a registered type, can't validate content. Did you load a version of the base Player types?"
1094
+ );
1095
+ }
1096
+ if (flowType.type === "object" && flowType.properties.views?.node.type === "array") {
1097
+ flowType.properties.views.node.elementType = assetType;
1098
+ }
1099
+ const validationIssues = sdk.validateByType(
1100
+ flowType,
1101
+ contentNode.jsonNode
1102
+ );
1103
+ validationIssues.forEach((issue) => {
1104
+ if (!nodesWithErrors.has(issue.node) || issue.type === "missing") {
1105
+ nodesWithErrors.add(issue.node);
1106
+ ctx.addViolation({
1107
+ node: findErrorNode(contentNode, issue.node),
1108
+ message: `Content Validation Error - ${issue.type}: ${issue.message}`,
1109
+ severity: import_vscode_languageserver_types6.DiagnosticSeverity.Error
1110
+ });
1111
+ }
1112
+ });
1113
+ },
1114
+ NavigationNode: (navigationNode) => {
1115
+ const expectedType = "Navigation";
1116
+ const validationIssues = sdk.validateByName(
1117
+ expectedType,
1118
+ navigationNode.jsonNode
1119
+ );
1120
+ validationIssues.forEach((issue) => {
1121
+ if (!nodesWithErrors.has(issue.node) || issue.type === "missing") {
1122
+ nodesWithErrors.add(issue.node);
1123
+ ctx.addViolation({
1124
+ node: findErrorNode(navigationNode, issue.node),
1125
+ message: `Navigation Validation Error - ${issue.type}: ${issue.message}`,
1126
+ severity: import_vscode_languageserver_types6.DiagnosticSeverity.Error
1127
+ });
1128
+ }
1129
+ });
1130
+ },
1131
+ FlowNode: (flowNode) => {
1132
+ const expectedType = "NavigationFlow";
1133
+ const validationIssues = sdk.validateByName(
1134
+ expectedType,
1135
+ flowNode.jsonNode
1136
+ );
1137
+ validationIssues.forEach((issue) => {
1138
+ if (!nodesWithErrors.has(issue.node) || issue.type === "missing") {
1139
+ nodesWithErrors.add(issue.node);
1140
+ ctx.addViolation({
1141
+ node: findErrorNode(flowNode, issue.node),
1142
+ message: `Navigation Flow Validation Error - ${issue.type}: ${issue.message}`,
1143
+ severity: import_vscode_languageserver_types6.DiagnosticSeverity.Error
1144
+ });
1145
+ }
1146
+ });
1147
+ },
1148
+ FlowStateNode: (flowStateNode) => {
1149
+ const flowxlr = mapFlowStateToType(
1150
+ flowStateNode.stateType?.valueNode?.value
1151
+ );
1152
+ if (flowxlr) {
1153
+ const validationIssues = sdk.validateByName(
1154
+ flowxlr,
1155
+ flowStateNode.jsonNode
1156
+ );
1157
+ validationIssues.forEach((issue) => {
1158
+ if (!nodesWithErrors.has(issue.node) || issue.type === "missing") {
1159
+ nodesWithErrors.add(issue.node);
1160
+ ctx.addViolation({
1161
+ node: findErrorNode(flowStateNode, issue.node),
1162
+ message: `Navigation Node Validation Error - ${issue.type}: ${issue.message}`,
1163
+ severity: import_vscode_languageserver_types6.DiagnosticSeverity.Error
1164
+ });
1165
+ }
1166
+ });
1167
+ } else {
1168
+ ctx.addViolation({
1169
+ node: flowStateNode,
1170
+ message: "Unknown Flow Type, valid options are: VIEW, END, ACTION, EXTERNAL, FLOW",
1171
+ severity: import_vscode_languageserver_types6.DiagnosticSeverity.Error
1172
+ });
1173
+ }
1174
+ }
1175
+ };
1176
+ }
1177
+ function getObjectCompletions(authoredNode, potentialTypes) {
1178
+ const completions = [];
1179
+ const presentKeys = /* @__PURE__ */ new Set();
1180
+ if (authoredNode.properties) {
1181
+ authoredNode.properties.forEach(
1182
+ (propertyNode) => presentKeys.add(propertyNode.keyNode.value)
1183
+ );
1184
+ }
1185
+ potentialTypes.forEach((node) => {
1186
+ if (node.type === "object") {
1187
+ Object.keys(node.properties).forEach((prop) => {
1188
+ if (!presentKeys.has(prop)) {
1189
+ completions.push({
1190
+ label: prop,
1191
+ documentation: node.properties[prop].node.description ?? node.properties[prop].node.title,
1192
+ kind: import_vscode_languageserver_types6.CompletionItemKind.Property
1193
+ });
1194
+ }
1195
+ });
1196
+ } else if (node.type === "and") {
1197
+ completions.push(...getObjectCompletions(authoredNode, node.and));
1198
+ } else if (node.type === "or") {
1199
+ completions.push(...getObjectCompletions(authoredNode, node.or));
1200
+ }
1201
+ });
1202
+ return completions;
1203
+ }
1204
+ function getPropertyCompletions(propertyName, potentialTypes) {
1205
+ const completions = [];
1206
+ potentialTypes.forEach((nodeType) => {
1207
+ if (nodeType.type === "object") {
1208
+ const propertyNode = nodeType.properties[propertyName]?.node;
1209
+ if (propertyNode && propertyNode.type === "string" && propertyNode.const) {
1210
+ completions.push({
1211
+ label: propertyNode.const,
1212
+ kind: import_vscode_languageserver_types6.CompletionItemKind.Value
1213
+ });
1214
+ }
1215
+ }
1216
+ });
1217
+ return completions;
1218
+ }
1219
+ function complete(ctx) {
1220
+ if (ctx.XLR?.nearestObjects) {
1221
+ if (ctx.node.type === "string" && ctx.node?.parent?.type === "property") {
1222
+ return getPropertyCompletions(
1223
+ ctx.node.parent.keyNode.value,
1224
+ ctx.XLR.nearestObjects
1225
+ );
1226
+ }
1227
+ return getObjectCompletions(ctx.node, ctx.XLR.nearestObjects);
1228
+ }
1229
+ return [];
1230
+ }
1231
+ function hover(ctx) {
1232
+ if (ctx.XLR && ctx.node.type === "string") {
1233
+ const docStrings = [];
1234
+ const prop = ctx.node.value;
1235
+ ctx.XLR.nearestObjects.forEach((typeNode) => {
1236
+ const docString = typeNode.properties[prop]?.node?.description ?? typeNode.properties[prop]?.node?.title ?? void 0;
1237
+ if (docString) {
1238
+ docStrings.push(docString);
1239
+ }
1240
+ });
1241
+ if (docStrings.length > 1) {
1242
+ return {
1243
+ contents: {
1244
+ kind: import_vscode_languageserver_types6.MarkupKind.PlainText,
1245
+ value: "Docs unavailable - More than one type could exist at this location"
1246
+ }
1247
+ };
1248
+ }
1249
+ return {
1250
+ contents: {
1251
+ kind: import_vscode_languageserver_types6.MarkupKind.PlainText,
1252
+ value: docStrings[0] ?? "Error getting docs"
1253
+ }
1254
+ };
1255
+ }
1256
+ }
1257
+ var XLRPlugin = class {
1258
+ name = "xlr-plugin";
1259
+ apply(service) {
1260
+ service.hooks.validate.tap(this.name, async (ctx, validation) => {
1261
+ validation.useASTVisitor(
1262
+ createValidationVisitor(validation, service.XLRService.XLRSDK)
1263
+ );
1264
+ });
1265
+ service.hooks.complete.tap(this.name, async (ctx, completion) => {
1266
+ complete(ctx).map((i) => completion.addCompletionItem(i));
1267
+ });
1268
+ service.hooks.hover.tap(this.name, (ctx) => {
1269
+ return hover(ctx);
1270
+ });
1271
+ }
1272
+ };
1273
+
1274
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/plugins/duplicate-id-plugin.ts
1275
+ var import_vscode_languageserver_types7 = require("vscode-languageserver-types");
1276
+ var checkParentTemplate = (node, depth = 0) => {
1277
+ if (node.parent) {
1278
+ if (isPropertyNode(node.parent) && node.parent.keyNode.value === "template") {
1279
+ depth += 1;
1280
+ return checkParentTemplate(node.parent, depth);
1281
+ }
1282
+ return checkParentTemplate(node.parent, depth);
1283
+ }
1284
+ return depth;
1285
+ };
1286
+ var generateID = (node) => {
1287
+ if (!node || node.type === "view") {
1288
+ return "";
1289
+ }
1290
+ const prefix = generateID(node.parent);
1291
+ let current = "";
1292
+ if (node.type === "property") {
1293
+ current = node.keyNode.value;
1294
+ } else if (node.type === "asset" && node.assetType?.valueNode?.value) {
1295
+ current = node.assetType.valueNode?.value;
1296
+ }
1297
+ return [prefix, current].filter(Boolean).join("-");
1298
+ };
1299
+ var createViolation = (node) => {
1300
+ const valueNode = node.id?.valueNode;
1301
+ if (!valueNode) {
1302
+ return;
1303
+ }
1304
+ return {
1305
+ node: valueNode,
1306
+ severity: import_vscode_languageserver_types7.DiagnosticSeverity.Error,
1307
+ message: `The id "${node.id?.valueNode?.value}" is already in use in this view.`,
1308
+ fix: () => {
1309
+ return {
1310
+ name: "Generate new ID",
1311
+ edit: replaceString(valueNode, `"${generateID(node)}"`)
1312
+ };
1313
+ }
1314
+ };
1315
+ };
1316
+ var createValidationVisitor2 = (ctx) => {
1317
+ const viewInfo = /* @__PURE__ */ new Map();
1318
+ return {
1319
+ AssetNode: (assetNode) => {
1320
+ const view = getViewNode(assetNode);
1321
+ if (!view) {
1322
+ throw new Error(
1323
+ "Asset found but not within a view. Something is wrong"
1324
+ );
1325
+ }
1326
+ const assetID = assetNode.id;
1327
+ if (!assetID || !assetID.valueNode?.value) {
1328
+ return;
1329
+ }
1330
+ const id = assetID.valueNode?.value;
1331
+ if (!viewInfo.has(view)) {
1332
+ viewInfo.set(view, /* @__PURE__ */ new Map());
1333
+ }
1334
+ const assetIDMap = viewInfo.get(view);
1335
+ const idInfo = assetIDMap?.get(id);
1336
+ const templateDepth = checkParentTemplate(assetNode);
1337
+ if (templateDepth > 0) {
1338
+ const expectedIndexElements = [];
1339
+ for (let i = 0; i < templateDepth; i++) {
1340
+ expectedIndexElements.push(`_index${i === 0 ? "" : i}_`);
1341
+ }
1342
+ const missingIndexSegments = expectedIndexElements.filter(
1343
+ (e) => !id.includes(e)
1344
+ );
1345
+ if (missingIndexSegments.length !== 0) {
1346
+ ctx.addViolation({
1347
+ node: assetNode,
1348
+ severity: import_vscode_languageserver_types7.DiagnosticSeverity.Error,
1349
+ message: `The id for this templated elements is missing the following index segments: ${missingIndexSegments.join(
1350
+ ", "
1351
+ )}`
1352
+ });
1353
+ }
1354
+ }
1355
+ if (idInfo) {
1356
+ if (!idInfo.handled) {
1357
+ const origViolation = createViolation(idInfo.original);
1358
+ if (origViolation) {
1359
+ ctx.addViolation(origViolation);
1360
+ }
1361
+ idInfo.handled = true;
1362
+ }
1363
+ const assetViolation = createViolation(assetNode);
1364
+ if (assetViolation) {
1365
+ ctx.addViolation(assetViolation);
1366
+ }
1367
+ } else {
1368
+ assetIDMap?.set(id, { original: assetNode, handled: false });
1369
+ }
1370
+ }
1371
+ };
1372
+ };
1373
+ var DuplicateIDPlugin = class {
1374
+ name = "duplicate-id";
1375
+ apply(service) {
1376
+ service.hooks.validate.tap(this.name, async (ctx, validation) => {
1377
+ validation.useASTVisitor(createValidationVisitor2(validation));
1378
+ });
1379
+ }
1380
+ };
1381
+
1382
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/plugins/missing-asset-wrapper-plugin.ts
1383
+ var import_vscode_languageserver_types8 = require("vscode-languageserver-types");
1384
+ var getObjectTarget = (node) => {
1385
+ if (isObjectNode(node)) {
1386
+ return node;
1387
+ }
1388
+ if (isKeyNode(node) && isPropertyNode(node.parent) && isObjectNode(node.parent.valueNode)) {
1389
+ return node.parent.valueNode;
1390
+ }
1391
+ };
1392
+ var MissingAssetWrapperPlugin = class {
1393
+ name = "missing-asset-wrapper";
1394
+ apply(languageService) {
1395
+ languageService.hooks.onValidateEnd.tap(
1396
+ this.name,
1397
+ (diagnostics, { addFixableViolation, documentContext }) => {
1398
+ let filteredDiags = diagnostics;
1399
+ const expectedAssetDiags = diagnostics.filter(
1400
+ (d) => d.message.includes(
1401
+ `Does not match any of the expected types for type: 'AssetWrapperOrSwitch'`
1402
+ ) || d.message.startsWith("Expected property: asset")
1403
+ );
1404
+ expectedAssetDiags.forEach((d) => {
1405
+ const originalNode = documentContext.PlayerContent.getNodeFromOffset(
1406
+ documentContext.document.offsetAt(d.range.start)
1407
+ );
1408
+ const objectNode = getObjectTarget(originalNode);
1409
+ if (objectNode && originalNode) {
1410
+ const associatedDiags = filteredDiags.filter((nestedDiag) => {
1411
+ const diagNode = documentContext.PlayerContent.getNodeFromOffset(
1412
+ documentContext.document.offsetAt(nestedDiag.range.start)
1413
+ );
1414
+ return objectNode.properties.some((p) => p.keyNode === diagNode);
1415
+ });
1416
+ addFixableViolation(d, {
1417
+ node: originalNode,
1418
+ message: d.message,
1419
+ severity: d.severity ?? import_vscode_languageserver_types8.DiagnosticSeverity.Error,
1420
+ fix: () => ({
1421
+ name: `Wrap in "asset"`,
1422
+ edit: {
1423
+ type: "replace",
1424
+ node: objectNode,
1425
+ value: formatLikeNode(documentContext.document, objectNode, {
1426
+ asset: getNodeValue(objectNode)
1427
+ })
1428
+ }
1429
+ })
1430
+ });
1431
+ filteredDiags = filteredDiags.filter(
1432
+ (filteredD) => !associatedDiags.includes(filteredD)
1433
+ );
1434
+ }
1435
+ });
1436
+ return filteredDiags;
1437
+ }
1438
+ );
1439
+ }
1440
+ };
1441
+
1442
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/plugins/nav-state-plugin.ts
1443
+ var import_vscode_languageserver_types9 = require("vscode-languageserver-types");
1444
+ var createValidationVisitor3 = (ctx) => {
1445
+ const validTransitions = /* @__PURE__ */ new Map();
1446
+ return {
1447
+ FlowNode: (flowNode) => {
1448
+ const flowNodeId = flowNode.parent?.keyNode.value;
1449
+ flowNode.states.forEach((p) => {
1450
+ if (!validTransitions.has(flowNodeId)) {
1451
+ validTransitions.set(flowNodeId, /* @__PURE__ */ new Set());
1452
+ }
1453
+ validTransitions.get(flowNodeId)?.add(p.keyNode.value);
1454
+ });
1455
+ },
1456
+ FlowStateNode: (flowState) => {
1457
+ const transitions = flowState.properties.find(
1458
+ (p) => p.keyNode.value === "transitions"
1459
+ );
1460
+ let flowNode = flowState.parent;
1461
+ while (flowNode && !isFlowNode(flowNode)) {
1462
+ flowNode = flowNode?.parent;
1463
+ }
1464
+ const flowNodeId = flowNode?.parent?.keyNode.value;
1465
+ transitions?.valueNode?.children?.forEach((transitionObjects) => {
1466
+ if (transitionObjects.type === "property" && transitionObjects.valueNode?.type === "string") {
1467
+ if (!validTransitions.get(flowNodeId)?.has(transitionObjects.valueNode.value)) {
1468
+ ctx.addViolation({
1469
+ node: transitionObjects.valueNode,
1470
+ severity: import_vscode_languageserver_types9.DiagnosticSeverity.Error,
1471
+ message: `Node "${transitionObjects.valueNode.value}" not found`
1472
+ });
1473
+ }
1474
+ }
1475
+ });
1476
+ }
1477
+ };
1478
+ };
1479
+ var isTransitionValue = (node) => {
1480
+ return node.type === "string" && isPropertyNode(node.parent) && node.parent.parent?.type === "object" && isPropertyNode(node.parent.parent.parent) && node.parent.parent.parent.keyNode.value === "transitions" && isStateNode(node.parent.parent.parent.parent) && isPropertyNode(node.parent.parent.parent.parent.parent) && isFlowNode(node.parent.parent.parent.parent.parent.parent);
1481
+ };
1482
+ var getFlowNode = (node) => {
1483
+ if (isFlowNode(node)) {
1484
+ return node;
1485
+ }
1486
+ if (node.parent) {
1487
+ return getFlowNode(node.parent);
1488
+ }
1489
+ };
1490
+ var NavStatePlugin = class {
1491
+ name = "nav-state";
1492
+ apply(service) {
1493
+ service.hooks.validate.tap(this.name, async (ctx, validation) => {
1494
+ validation.useASTVisitor(createValidationVisitor3(validation));
1495
+ });
1496
+ service.hooks.complete.tap(this.name, async (ctx, completionCtx) => {
1497
+ if (!isValueCompletion(ctx.node)) {
1498
+ return;
1499
+ }
1500
+ if (isTransitionValue(ctx.node)) {
1501
+ const flowNode = getFlowNode(ctx.node);
1502
+ flowNode?.states.forEach((p) => {
1503
+ completionCtx.addCompletionItem({
1504
+ kind: import_vscode_languageserver_types9.CompletionItemKind.Value,
1505
+ label: p.keyNode.value
1506
+ });
1507
+ });
1508
+ }
1509
+ });
1510
+ service.hooks.definition.tap(this.name, (ctx) => {
1511
+ if (!isValueCompletion(ctx.node)) {
1512
+ return;
1513
+ }
1514
+ if (ctx.node.type === "string" && isTransitionValue(ctx.node)) {
1515
+ const flowNode = getFlowNode(ctx.node);
1516
+ const { value } = ctx.node;
1517
+ const flowProp = flowNode?.states.find(
1518
+ (n) => n.keyNode.value === value
1519
+ );
1520
+ if (flowProp) {
1521
+ return getLSLocationOfNode(ctx.document, flowProp.keyNode);
1522
+ }
1523
+ }
1524
+ });
1525
+ }
1526
+ };
1527
+
1528
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/plugins/view-node-plugin.ts
1529
+ var import_vscode_languageserver_types10 = require("vscode-languageserver-types");
1530
+ var createValidationVisitor4 = (ctx, viewInfo) => {
1531
+ return {
1532
+ FlowStateNode: (flowState) => {
1533
+ if (flowState.stateType?.valueNode?.value === "VIEW") {
1534
+ const refNode = getProperty(flowState, "ref");
1535
+ if (!refNode || refNode.valueNode?.type !== "string") {
1536
+ return;
1537
+ }
1538
+ const refID = refNode.valueNode.value;
1539
+ if (viewInfo.views.has(refID)) {
1540
+ return;
1541
+ }
1542
+ ctx.addViolation({
1543
+ node: refNode.valueNode,
1544
+ message: `View with id: ${refID} does not exist.`,
1545
+ severity: import_vscode_languageserver_types10.DiagnosticSeverity.Error
1546
+ });
1547
+ }
1548
+ },
1549
+ ViewNode: (viewNode) => {
1550
+ if (viewNode.id && viewNode.id.valueNode?.value !== void 0) {
1551
+ if (!viewInfo.nodes.get(viewNode.id.valueNode?.value)) {
1552
+ ctx.addViolation({
1553
+ node: viewNode.id.valueNode,
1554
+ message: `View is not reachable`,
1555
+ severity: import_vscode_languageserver_types10.DiagnosticSeverity.Warning
1556
+ });
1557
+ }
1558
+ }
1559
+ }
1560
+ };
1561
+ };
1562
+ var getViewInfo = (ctx) => {
1563
+ const views = /* @__PURE__ */ new Map();
1564
+ const nodes = /* @__PURE__ */ new Map();
1565
+ const { root } = ctx.PlayerContent;
1566
+ if (root.type === "content") {
1567
+ root.views?.valueNode?.children.forEach((c) => {
1568
+ if (isViewNode(c) && c.id?.valueNode) {
1569
+ views.set(c.id.valueNode.value, {
1570
+ id: c.id.valueNode.value,
1571
+ idProp: c.id
1572
+ });
1573
+ }
1574
+ });
1575
+ root.navigation?.valueNode?.flows.forEach((flow) => {
1576
+ flow.valueNode?.states?.forEach((state) => {
1577
+ if (state.valueNode?.stateType?.valueNode?.value === "VIEW") {
1578
+ const ref = state.valueNode.properties.find(
1579
+ (p) => p.keyNode.value === "ref"
1580
+ );
1581
+ if (ref?.valueNode?.type === "string") {
1582
+ const refVal = ref.valueNode.value;
1583
+ nodes.set(refVal, {
1584
+ id: refVal,
1585
+ refProp: ref
1586
+ });
1587
+ }
1588
+ }
1589
+ });
1590
+ });
1591
+ }
1592
+ return {
1593
+ views,
1594
+ nodes
1595
+ };
1596
+ };
1597
+ var ViewNodePlugin = class {
1598
+ name = "view-node";
1599
+ apply(service) {
1600
+ let viewInfo;
1601
+ service.hooks.validate.tap(this.name, async (ctx, validation) => {
1602
+ if (!viewInfo) {
1603
+ return;
1604
+ }
1605
+ validation.useASTVisitor(createValidationVisitor4(validation, viewInfo));
1606
+ });
1607
+ service.hooks.onDocumentUpdate.tap(this.name, (ctx) => {
1608
+ viewInfo = getViewInfo(ctx);
1609
+ });
1610
+ service.hooks.complete.tap(this.name, async (ctx, completionCtx) => {
1611
+ if (!isValueCompletion(ctx.node)) {
1612
+ return;
1613
+ }
1614
+ if (ctx.node.type === "string" && isPropertyNode(ctx.node.parent) && isStateNode(ctx.node.parent.parent) && ctx.node.parent.keyNode.value === "ref") {
1615
+ Array.from(viewInfo?.views.keys() ?? []).forEach((vID) => {
1616
+ completionCtx.addCompletionItem({
1617
+ kind: import_vscode_languageserver_types10.CompletionItemKind.Value,
1618
+ label: vID
1619
+ });
1620
+ });
1621
+ } else if (ctx.node.type === "string" && isPropertyNode(ctx.node.parent) && isViewNode(ctx.node.parent.parent) && ctx.node.parent.keyNode.value === "id") {
1622
+ Array.from(viewInfo?.nodes.keys() ?? []).forEach((vID) => {
1623
+ completionCtx.addCompletionItem({
1624
+ kind: import_vscode_languageserver_types10.CompletionItemKind.Value,
1625
+ label: vID
1626
+ });
1627
+ });
1628
+ }
1629
+ });
1630
+ service.hooks.definition.tap(this.name, (ctx) => {
1631
+ if (!isValueCompletion(ctx.node)) {
1632
+ return;
1633
+ }
1634
+ if (ctx.node.type === "string" && isPropertyNode(ctx.node.parent)) {
1635
+ if (isViewNode(ctx.node.parent.parent) && ctx.node.parent.keyNode.value === "id") {
1636
+ const { value } = ctx.node;
1637
+ const stateNode = viewInfo?.nodes.get(value);
1638
+ if (stateNode) {
1639
+ return getLSLocationOfNode(ctx.document, stateNode.refProp);
1640
+ }
1641
+ } else if (isStateNode(ctx.node.parent.parent) && ctx.node.parent.keyNode.value === "ref") {
1642
+ const { value } = ctx.node;
1643
+ const viewNode = viewInfo?.views.get(value);
1644
+ if (viewNode) {
1645
+ return getLSLocationOfNode(ctx.document, viewNode.idProp);
1646
+ }
1647
+ }
1648
+ }
1649
+ });
1650
+ }
1651
+ };
1652
+
1653
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/xlr/transforms.ts
1654
+ var import_xlr_sdk = require("@xlr-lib/xlr-sdk");
1655
+ var import_xlr_utils = require("@xlr-lib/xlr-utils");
1656
+ var applyCommonProps = (node, capability) => {
1657
+ return (0, import_xlr_sdk.simpleTransformGenerator)("object", ["Assets", "Views"], (xlrNode) => {
1658
+ if (!xlrNode.properties.applicability) {
1659
+ xlrNode.properties.applicability = {
1660
+ required: false,
1661
+ node: {
1662
+ type: "or",
1663
+ name: "Applicability",
1664
+ description: "Evaluate the given expression (or boolean) and if falsy, remove this node from the tree. This is re-computed for each change in the data-model",
1665
+ or: [
1666
+ {
1667
+ type: "boolean"
1668
+ },
1669
+ {
1670
+ type: "ref",
1671
+ ref: "Expression"
1672
+ }
1673
+ ]
1674
+ }
1675
+ };
1676
+ }
1677
+ if (!xlrNode.properties._comment) {
1678
+ xlrNode.properties._comment = {
1679
+ required: false,
1680
+ node: {
1681
+ description: "Adds a comment for the given node",
1682
+ type: "string"
1683
+ }
1684
+ };
1685
+ }
1686
+ return xlrNode;
1687
+ })(node, capability);
1688
+ };
1689
+ var applyAssetWrapperOrSwitch = (node, capability) => {
1690
+ return (0, import_xlr_sdk.simpleTransformGenerator)("ref", ["Assets", "Views"], (xlrNode) => {
1691
+ if (xlrNode.ref.includes("AssetWrapper")) {
1692
+ return {
1693
+ ...xlrNode,
1694
+ ref: xlrNode.ref.replace("AssetWrapper", "AssetWrapperOrSwitch")
1695
+ };
1696
+ }
1697
+ return xlrNode;
1698
+ })(node, capability);
1699
+ };
1700
+ var applyValueRefs = (node, capability) => {
1701
+ return (0, import_xlr_sdk.simpleTransformGenerator)(
1702
+ "object",
1703
+ ["Assets", "Views"],
1704
+ (inputNode) => {
1705
+ const xlrNode = { ...inputNode };
1706
+ for (const key in xlrNode.properties) {
1707
+ if (key === "id") {
1708
+ continue;
1709
+ }
1710
+ const value = xlrNode.properties[key];
1711
+ if (value.node.type === "or") {
1712
+ value.node.or.push({
1713
+ type: "ref",
1714
+ ref: "ExpressionRef"
1715
+ });
1716
+ value.node.or.push({
1717
+ type: "ref",
1718
+ ref: "BindingRef"
1719
+ });
1720
+ } else if ((0, import_xlr_utils.isPrimitiveTypeNode)(value.node)) {
1721
+ const newUnionType = {
1722
+ type: "or",
1723
+ description: value.node.description,
1724
+ or: [
1725
+ value.node,
1726
+ {
1727
+ type: "ref",
1728
+ ref: "ExpressionRef"
1729
+ },
1730
+ {
1731
+ type: "ref",
1732
+ ref: "BindingRef"
1733
+ }
1734
+ ]
1735
+ };
1736
+ value.node = newUnionType;
1737
+ }
1738
+ }
1739
+ return xlrNode;
1740
+ }
1741
+ )(node, capability);
1742
+ };
1743
+ var applyTemplateProperty = (node, capability) => {
1744
+ return (0, import_xlr_sdk.simpleTransformGenerator)(
1745
+ "object",
1746
+ ["Assets", "Views"],
1747
+ (inputNode) => {
1748
+ const templateTypes = [];
1749
+ const xlrNode = { ...inputNode };
1750
+ for (const key in xlrNode.properties) {
1751
+ const value = xlrNode.properties[key];
1752
+ if (value.node.type === "array") {
1753
+ value.required = false;
1754
+ templateTypes.push({
1755
+ type: "ref",
1756
+ ref: `Template<${value.node.elementType.type === "ref" ? value.node.elementType.ref : value.node.elementType.name}, "${key}">`,
1757
+ genericArguments: [
1758
+ value.node.elementType,
1759
+ {
1760
+ type: "string",
1761
+ const: key
1762
+ }
1763
+ ]
1764
+ });
1765
+ }
1766
+ }
1767
+ if (templateTypes.length > 0) {
1768
+ const templateType = {
1769
+ type: "array",
1770
+ elementType: templateTypes.length > 1 ? { type: "or", or: templateTypes } : templateTypes[0],
1771
+ description: "A list of templates to process for this node"
1772
+ };
1773
+ xlrNode.properties.template = {
1774
+ required: false,
1775
+ node: templateType
1776
+ };
1777
+ }
1778
+ return xlrNode;
1779
+ }
1780
+ )(node, capability);
1781
+ };
1782
+
1783
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/constants.ts
1784
+ var PLUGINS = [
1785
+ new DuplicateIDPlugin(),
1786
+ new ViewNodePlugin(),
1787
+ new SchemaInfoPlugin(),
1788
+ new AssetWrapperArrayPlugin(),
1789
+ new NavStatePlugin(),
1790
+ new MissingAssetWrapperPlugin(),
1791
+ new XLRPlugin()
1792
+ ];
1793
+ var DEFAULT_FILTERS = {
1794
+ typeFilter: "Transformed"
1795
+ };
1796
+ var TRANSFORM_FUNCTIONS = [
1797
+ applyAssetWrapperOrSwitch,
1798
+ applyValueRefs,
1799
+ applyCommonProps,
1800
+ applyTemplateProperty
1801
+ ];
1802
+
1803
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/xlr/registry.ts
1804
+ var import_xlr_sdk2 = require("@xlr-lib/xlr-sdk");
1805
+ var PlayerXLRRegistry = class extends import_xlr_sdk2.BasicXLRRegistry {
1806
+ /** Keeps the mapping of how a type is referenced by Player to the underlying XLR */
1807
+ registrationMap;
1808
+ constructor() {
1809
+ super();
1810
+ this.registrationMap = /* @__PURE__ */ new Map();
1811
+ }
1812
+ get(id) {
1813
+ const realNames = this.registrationMap.get(id);
1814
+ if (realNames === void 0) {
1815
+ return void 0;
1816
+ }
1817
+ if (Array.isArray(realNames)) {
1818
+ return {
1819
+ name: `${id}PartialMatchType`,
1820
+ source: "registry.ts",
1821
+ type: "or",
1822
+ or: realNames.map(
1823
+ (partialMatchID) => super.get(partialMatchID)
1824
+ )
1825
+ };
1826
+ }
1827
+ return super.get(realNames);
1828
+ }
1829
+ add(type, plugin, capability) {
1830
+ let registeredName = type.name;
1831
+ if ((capability === "Assets" || capability === "Views") && type.type === "object" && type.extends?.genericArguments?.[0]?.type === "string" && type.extends?.genericArguments?.[0]?.const) {
1832
+ this.registrationMap.set(registeredName, type.name);
1833
+ registeredName = type.extends.genericArguments[0].const;
1834
+ }
1835
+ if (this.registrationMap.has(registeredName)) {
1836
+ const current = this.registrationMap.get(registeredName);
1837
+ if (Array.isArray(current)) {
1838
+ current.push(registeredName);
1839
+ } else {
1840
+ this.registrationMap.set(registeredName, [current, type.name]);
1841
+ }
1842
+ } else {
1843
+ this.registrationMap.set(registeredName, type.name);
1844
+ }
1845
+ super.add(type, plugin, capability);
1846
+ }
1847
+ has(id) {
1848
+ return this.registrationMap.has(id);
1849
+ }
1850
+ list(filterArgs) {
1851
+ return super.list(filterArgs);
1852
+ }
1853
+ info(id) {
1854
+ const realNames = this.registrationMap.get(id);
1855
+ if (realNames === void 0) {
1856
+ return void 0;
1857
+ }
1858
+ if (Array.isArray(realNames)) {
1859
+ const metaDataArrays = realNames.map((name) => super.info(name));
1860
+ const firstElement = metaDataArrays[0];
1861
+ const equal = metaDataArrays.every(
1862
+ (metaData) => metaData?.plugin === firstElement?.plugin && metaData?.capability === firstElement?.capability
1863
+ );
1864
+ if (equal) {
1865
+ return firstElement;
1866
+ }
1867
+ throw Error(
1868
+ `Error: can't determine accurate info for type ${id} as it is provided by multiple plugins/capabilities`
1869
+ );
1870
+ }
1871
+ return super.info(realNames);
1872
+ }
1873
+ };
1874
+
1875
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/xlr/service.ts
1876
+ var import_xlr_sdk3 = require("@xlr-lib/xlr-sdk");
1877
+ var XLRService = class {
1878
+ baseTypes = [
1879
+ "asset",
1880
+ "view",
1881
+ "flow",
1882
+ "content",
1883
+ "navigation",
1884
+ "state"
1885
+ ];
1886
+ XLRSDK;
1887
+ constructor() {
1888
+ this.XLRSDK = new import_xlr_sdk3.XLRSDK(new PlayerXLRRegistry());
1889
+ }
1890
+ walker(n, path) {
1891
+ if (this.baseTypes.indexOf(n.type) > -1) {
1892
+ if (n.type === "asset") {
1893
+ const name = this.XLRSDK.hasType(n.assetType?.valueNode?.value ?? "") ? n.assetType?.valueNode?.value : "Asset";
1894
+ return {
1895
+ name,
1896
+ path
1897
+ };
1898
+ }
1899
+ if (n.type === "view") {
1900
+ const name = this.XLRSDK.hasType(n.viewType?.valueNode?.value ?? "") ? n.viewType?.valueNode?.value : "View";
1901
+ return { name, path };
1902
+ }
1903
+ if (n.type === "state") {
1904
+ if (n.stateType?.valueNode?.value) {
1905
+ const flowStateType = mapFlowStateToType(
1906
+ n.stateType?.valueNode?.value
1907
+ );
1908
+ if (flowStateType) {
1909
+ return { name: flowStateType, path };
1910
+ }
1911
+ }
1912
+ }
1913
+ if (n.type === "content") {
1914
+ return { name: "Flow", path };
1915
+ }
1916
+ if (n.type === "flow") {
1917
+ return { name: "NavigationFlow", path };
1918
+ }
1919
+ if (n.type === "navigation") {
1920
+ return { name: "Navigation", path };
1921
+ }
1922
+ }
1923
+ if (n.parent) {
1924
+ path.push(n.parent);
1925
+ return this.walker(n.parent, path);
1926
+ }
1927
+ return void 0;
1928
+ }
1929
+ getTypeInfoAtPosition(node) {
1930
+ if (!node) return;
1931
+ const pointer = node;
1932
+ const xlrInfo = this.walker(pointer, []);
1933
+ if (!xlrInfo) return;
1934
+ const activeNode = this.XLRSDK.getType(xlrInfo.name);
1935
+ if (!activeNode) return;
1936
+ let nearestObjectTypes = [activeNode];
1937
+ let pointers = [];
1938
+ if (activeNode.type === "and") {
1939
+ pointers = activeNode.and;
1940
+ } else if (activeNode.type === "or") {
1941
+ pointers = activeNode.or;
1942
+ } else {
1943
+ pointers = [activeNode];
1944
+ }
1945
+ for (const pathSegment of xlrInfo.path.reverse()) {
1946
+ const newPointers = [];
1947
+ for (let nodePointer of pointers) {
1948
+ let newNode;
1949
+ if (nodePointer.type === "ref") {
1950
+ if (this.XLRSDK.hasType(nodePointer.ref)) {
1951
+ nodePointer = this.XLRSDK.getType(nodePointer.ref);
1952
+ } else {
1953
+ continue;
1954
+ }
1955
+ }
1956
+ if (pathSegment.type === "property" && nodePointer.type === "object") {
1957
+ if (nodePointer?.properties[pathSegment.keyNode.value]) {
1958
+ newNode = nodePointer?.properties[pathSegment.keyNode.value]?.node;
1959
+ } else if (nodePointer?.additionalProperties) {
1960
+ const adNode = nodePointer?.additionalProperties;
1961
+ if (typeof adNode !== "boolean") {
1962
+ newNode = adNode;
1963
+ }
1964
+ }
1965
+ } else if (pathSegment.type === "object" || this.baseTypes.indexOf(pathSegment.type) !== -1) {
1966
+ newNode = nodePointer;
1967
+ } else if (pathSegment.type === "array") {
1968
+ newNode = nodePointer.elementType;
1969
+ }
1970
+ if (!newNode) {
1971
+ continue;
1972
+ } else if (newNode.type === "or") {
1973
+ newPointers.push(...newNode.or);
1974
+ } else if (newNode.type === "and") {
1975
+ newPointers.push(...newNode.and);
1976
+ } else if (newNode.type === "ref" && this.XLRSDK.hasType(newNode.ref)) {
1977
+ newPointers.push(this.XLRSDK.getType(newNode.ref));
1978
+ } else {
1979
+ newPointers.push(newNode);
1980
+ }
1981
+ }
1982
+ if (newPointers.filter((n) => n).length === 0) {
1983
+ break;
1984
+ }
1985
+ const newObjectTypes = newPointers.filter(
1986
+ (n) => n.type === "object"
1987
+ );
1988
+ if (newObjectTypes.length > 0) {
1989
+ nearestObjectTypes = newObjectTypes;
1990
+ }
1991
+ pointers = newPointers;
1992
+ }
1993
+ return {
1994
+ name: xlrInfo.name,
1995
+ nodes: pointers,
1996
+ nearestObjects: nearestObjectTypes
1997
+ };
1998
+ }
1999
+ };
2000
+
2001
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/types.ts
2002
+ var LOG_TYPES = ["debug", "info", "warn", "error"];
2003
+
2004
+ // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/lsp/json-language-service/src/index.ts
2005
+ var PlayerLanguageService = class {
2006
+ XLRService;
2007
+ parseCache = /* @__PURE__ */ new Map();
2008
+ fixableViolationsForDocument = /* @__PURE__ */ new Map();
2009
+ hooks = {
2010
+ onDocumentUpdate: new import_tapable_ts.SyncHook(),
2011
+ validate: new import_tapable_ts.AsyncParallelHook(),
2012
+ onValidateEnd: new import_tapable_ts.SyncWaterfallHook(),
2013
+ complete: new import_tapable_ts.AsyncParallelHook(),
2014
+ hover: new import_tapable_ts.SyncBailHook(),
2015
+ definition: new import_tapable_ts.SyncBailHook()
2016
+ };
2017
+ constructor(config) {
2018
+ this.XLRService = new XLRService();
2019
+ PLUGINS.forEach((p) => p.apply(this));
2020
+ config?.plugins?.forEach((p) => p.apply(this));
2021
+ }
2022
+ parseTextDocument(document) {
2023
+ if (!this.parseCache.has(document.uri)) {
2024
+ const parsed = parse(document);
2025
+ this.parseCache.set(document.uri, { version: document.version, parsed });
2026
+ return parsed;
2027
+ }
2028
+ const cached = this.parseCache.get(document.uri);
2029
+ if (!cached || cached.version < document.version) {
2030
+ this.parseCache.delete(document.uri);
2031
+ return this.parseTextDocument(document);
2032
+ }
2033
+ return cached.parsed;
2034
+ }
2035
+ async updateSource(document) {
2036
+ const parsed = this.parseTextDocument(document);
2037
+ const documentContext = {
2038
+ log: {
2039
+ debug: console.log,
2040
+ info: console.log,
2041
+ warn: console.warn,
2042
+ error: console.error
2043
+ },
2044
+ document,
2045
+ PlayerContent: parsed
2046
+ };
2047
+ const ctx = {
2048
+ ...documentContext
2049
+ };
2050
+ this.hooks.onDocumentUpdate.call(ctx);
2051
+ return ctx;
2052
+ }
2053
+ async getJSONPositionInfo(ctx, position) {
2054
+ const { document, PlayerContent: PlayerContent2 } = ctx;
2055
+ const node = PlayerContent2.getNodeFromOffset(document.offsetAt(position));
2056
+ return {
2057
+ node
2058
+ };
2059
+ }
2060
+ async updateSourceWithPosition(document, position) {
2061
+ const ctx = await this.updateSource(document);
2062
+ const { node } = await this.getJSONPositionInfo(ctx, position);
2063
+ const XLRInfo = this.XLRService.getTypeInfoAtPosition(node);
2064
+ if (!node || !XLRInfo) {
2065
+ return void 0;
2066
+ }
2067
+ return {
2068
+ ...ctx,
2069
+ node,
2070
+ position,
2071
+ XLR: XLRInfo
2072
+ };
2073
+ }
2074
+ onClose(document) {
2075
+ this.fixableViolationsForDocument.delete(document.uri);
2076
+ this.parseCache.delete(document.uri);
2077
+ }
2078
+ async formatTextDocument(document, options, range) {
2079
+ const formattingOptions = {
2080
+ tabSize: options.tabSize,
2081
+ insertSpaces: options.insertSpaces
2082
+ };
2083
+ let formatRange;
2084
+ if (range) {
2085
+ const startOffset = document.offsetAt(range.start);
2086
+ formatRange = {
2087
+ offset: startOffset,
2088
+ length: document.offsetAt(range.end) - startOffset
2089
+ };
2090
+ }
2091
+ return (0, import_jsonc_parser4.format)(document.getText(), formatRange, formattingOptions).map(
2092
+ (edit) => {
2093
+ return import_vscode_languageserver_types11.TextEdit.replace(
2094
+ import_vscode_languageserver_types11.Range.create(
2095
+ document.positionAt(edit.offset),
2096
+ document.positionAt(edit.offset + edit.length)
2097
+ ),
2098
+ edit.content
2099
+ );
2100
+ }
2101
+ );
2102
+ }
2103
+ async validateTextDocument(document) {
2104
+ const ctx = await this.updateSource(document);
2105
+ this.fixableViolationsForDocument.delete(document.uri);
2106
+ if (!isKnownRootType(ctx.PlayerContent)) {
2107
+ return;
2108
+ }
2109
+ const diagnostics = [...ctx.PlayerContent.syntaxErrors];
2110
+ const astVisitors = [];
2111
+ const addFixableViolation = (diagnostic, violation) => {
2112
+ if (!this.fixableViolationsForDocument.has(document.uri)) {
2113
+ this.fixableViolationsForDocument.set(document.uri, /* @__PURE__ */ new Map());
2114
+ }
2115
+ const fixableDiags = this.fixableViolationsForDocument.get(document.uri);
2116
+ fixableDiags?.set(diagnostic, violation);
2117
+ };
2118
+ if (ctx.PlayerContent.root) {
2119
+ const validationContext = {
2120
+ addViolation: (violation) => {
2121
+ const { message, node, severity, fix } = violation;
2122
+ const range = toRange(document, node);
2123
+ const diagnostic = {
2124
+ message,
2125
+ severity,
2126
+ range
2127
+ };
2128
+ if (fix) {
2129
+ addFixableViolation(diagnostic, violation);
2130
+ }
2131
+ diagnostics.push(diagnostic);
2132
+ },
2133
+ useASTVisitor: (visitor) => {
2134
+ astVisitors.push(visitor);
2135
+ },
2136
+ addDiagnostic(d) {
2137
+ diagnostics.push(d);
2138
+ }
2139
+ };
2140
+ await this.hooks.validate.call(ctx, validationContext);
2141
+ await walk(ctx.PlayerContent.root, async (node) => {
2142
+ const visitorProp = typeToVisitorMap[node.type];
2143
+ astVisitors.forEach(async (visitor) => {
2144
+ try {
2145
+ await visitor[visitorProp]?.(node);
2146
+ } catch (e) {
2147
+ ctx.log?.error(
2148
+ `Error running rules for ${visitorProp}: ${e.message}, Stack ${e.stack}`
2149
+ );
2150
+ }
2151
+ });
2152
+ return false;
2153
+ });
2154
+ }
2155
+ return this.hooks.onValidateEnd.call(diagnostics, {
2156
+ documentContext: ctx,
2157
+ addFixableViolation
2158
+ });
2159
+ }
2160
+ async getCompletionsAtPosition(document, position) {
2161
+ const ctxWithPos = await this.updateSourceWithPosition(document, position);
2162
+ if (!ctxWithPos) {
2163
+ return import_vscode_languageserver_types11.CompletionList.create();
2164
+ }
2165
+ const completionItems = [];
2166
+ const completionContext = {
2167
+ addCompletionItem: (i) => {
2168
+ completionItems.push(i);
2169
+ }
2170
+ };
2171
+ await this.hooks.complete.call(ctxWithPos, completionContext);
2172
+ return import_vscode_languageserver_types11.CompletionList.create(completionItems);
2173
+ }
2174
+ async resolveCompletionItem(completionItem) {
2175
+ return completionItem;
2176
+ }
2177
+ async getHoverInfoAtPosition(document, position) {
2178
+ const context = await this.updateSourceWithPosition(document, position);
2179
+ if (!context) {
2180
+ return void 0;
2181
+ }
2182
+ return this.hooks.hover.call(context);
2183
+ }
2184
+ async getCodeActionsInRange(document, context) {
2185
+ const diagsForDocument = this.fixableViolationsForDocument.get(
2186
+ document.uri
2187
+ );
2188
+ if (!diagsForDocument || diagsForDocument.size === 0 || context.diagnostics.length === 0) {
2189
+ return [];
2190
+ }
2191
+ const actions = [];
2192
+ diagsForDocument.forEach((violation, diagnostic) => {
2193
+ const matching = context.diagnostics.find(
2194
+ (diag) => containsRange(diagnostic.range, diag.range)
2195
+ );
2196
+ const fixedAction = violation.fix?.();
2197
+ if (!matching || !fixedAction) {
2198
+ return;
2199
+ }
2200
+ actions.push({
2201
+ title: fixedAction.name,
2202
+ kind: import_vscode_languageserver_types11.CodeActionKind.QuickFix,
2203
+ edit: {
2204
+ changes: {
2205
+ [document.uri]: [toTextEdit(document, fixedAction.edit)]
2206
+ }
2207
+ }
2208
+ });
2209
+ });
2210
+ return actions;
2211
+ }
2212
+ async getDefinitionAtPosition(document, position) {
2213
+ const context = await this.updateSourceWithPosition(document, position);
2214
+ if (!context) {
2215
+ return void 0;
2216
+ }
2217
+ return this.hooks.definition.call(context);
2218
+ }
2219
+ addXLRTransforms(transforms) {
2220
+ Object.entries(transforms).forEach(
2221
+ ([name, fn]) => this.XLRService.XLRSDK.addTransformFunction(name, fn)
2222
+ );
2223
+ }
2224
+ addLSPPlugin(plugin) {
2225
+ plugin.apply(this);
2226
+ }
2227
+ async setAssetTypes(typeFiles) {
2228
+ typeFiles.forEach((file) => {
2229
+ if (file.includes("types")) {
2230
+ this.XLRService.XLRSDK.loadDefinitionsFromDisk(file, {});
2231
+ } else {
2232
+ this.XLRService.XLRSDK.loadDefinitionsFromDisk(
2233
+ file,
2234
+ DEFAULT_FILTERS,
2235
+ TRANSFORM_FUNCTIONS
2236
+ );
2237
+ }
2238
+ });
2239
+ }
2240
+ async setAssetTypesFromModule(manifest) {
2241
+ await Promise.allSettled(
2242
+ manifest.map((m) => {
2243
+ if (m.capabilities["Types"]?.length) {
2244
+ return this.XLRService.XLRSDK.loadDefinitionsFromModule(m);
2245
+ } else {
2246
+ return this.XLRService.XLRSDK.loadDefinitionsFromModule(
2247
+ m,
2248
+ DEFAULT_FILTERS,
2249
+ TRANSFORM_FUNCTIONS
2250
+ );
2251
+ }
2252
+ })
2253
+ );
2254
+ }
2255
+ };
2256
+ // Annotate the CommonJS export names for ESM import in node:
2257
+ 0 && (module.exports = {
2258
+ ASTNodeImpl,
2259
+ ArrayASTNodeImpl,
2260
+ AssetASTNodeImpl,
2261
+ BooleanASTNodeImpl,
2262
+ ContentASTNodeImpl,
2263
+ DEFAULT_FILTERS,
2264
+ FlowASTNodeImpl,
2265
+ FlowStateASTNodeImpl,
2266
+ LOG_TYPES,
2267
+ NavigationASTNodeImpl,
2268
+ NullASTNodeImpl,
2269
+ NumberASTNodeImpl,
2270
+ ObjType,
2271
+ ObjectASTNodeImpl,
2272
+ PLUGINS,
2273
+ PlayerContent,
2274
+ PlayerLanguageService,
2275
+ PlayerXLRRegistry,
2276
+ PropertyASTNodeImpl,
2277
+ StringASTNodeImpl,
2278
+ TRANSFORM_FUNCTIONS,
2279
+ ViewASTNodeImpl,
2280
+ XLRService,
2281
+ applyAssetWrapperOrSwitch,
2282
+ applyCommonProps,
2283
+ applyTemplateProperty,
2284
+ applyValueRefs,
2285
+ containsRange,
2286
+ formatLikeNode,
2287
+ getContentNode,
2288
+ getLSLocationOfNode,
2289
+ getNodeValue,
2290
+ getPropForValNode,
2291
+ getProperty,
2292
+ getValForKey,
2293
+ getViewNode,
2294
+ isFlowNode,
2295
+ isKeyNode,
2296
+ isKnownRootType,
2297
+ isNavigationNode,
2298
+ isObjectNode,
2299
+ isPropertyCompletion,
2300
+ isPropertyNode,
2301
+ isStateNode,
2302
+ isValueCompletion,
2303
+ isValueNode,
2304
+ isViewNode,
2305
+ mapFlowStateToType,
2306
+ parse,
2307
+ replaceString,
2308
+ toRange,
2309
+ toTextDocument,
2310
+ toTextEdit,
2311
+ typeToVisitorMap,
2312
+ walk
2313
+ });
2314
+ //# sourceMappingURL=index.cjs.map