@case-framework/survey-ui 0.5.1 → 0.6.1

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 (94) hide show
  1. package/dist/default-item-cores-C6VK2LFe.js +10 -0
  2. package/dist/default-item-cores-C6VK2LFe.js.map +1 -0
  3. package/dist/default-item-cores-gdu37TFX.mjs +3988 -0
  4. package/dist/default-item-cores-gdu37TFX.mjs.map +1 -0
  5. package/dist/item-core-registry.cjs.js +2 -0
  6. package/dist/item-core-registry.cjs.js.map +1 -0
  7. package/dist/item-core-registry.es.js +11 -0
  8. package/dist/item-core-registry.es.js.map +1 -0
  9. package/dist/src/components/common/sortable-tree.d.ts +59 -0
  10. package/dist/src/components/rich-text/rich-text-content-view.d.ts +6 -2
  11. package/dist/src/components/ui/dialog.d.ts +2 -1
  12. package/dist/src/components/ui/resizable.d.ts +7 -0
  13. package/dist/src/components/ui/toggle.d.ts +1 -1
  14. package/dist/src/dev/localizations/de.d.ts +2 -2
  15. package/dist/src/index.d.ts +7 -4
  16. package/dist/src/item-core-registry.d.ts +4 -0
  17. package/dist/src/modules/default-item-registry/item-authoring-state.d.ts +15 -0
  18. package/dist/src/modules/default-item-registry/items/choice/editor/option-edit-dialog.d.ts +10 -3
  19. package/dist/src/modules/default-item-registry/items/form/model.d.ts +4 -1
  20. package/dist/src/modules/survey-editor/ai/create-provider.d.ts +22 -0
  21. package/dist/src/modules/survey-editor/ai/types.d.ts +6 -83
  22. package/dist/src/modules/survey-editor/ai/use-survey-assistant-integration.d.ts +16 -0
  23. package/dist/src/modules/survey-editor/assistant/apply.d.ts +24 -0
  24. package/dist/src/modules/survey-editor/assistant/index.d.ts +2 -0
  25. package/dist/src/modules/survey-editor/assistant/snapshot.d.ts +39 -0
  26. package/dist/src/modules/survey-editor/editor-card/add-items/constants.d.ts +2 -0
  27. package/dist/src/modules/survey-editor/editor-card/add-items/hooks/use-add-item-actions.d.ts +4 -5
  28. package/dist/src/modules/survey-editor/editor-card/add-items/hooks/use-option-group-navigation.d.ts +2 -1
  29. package/dist/src/modules/survey-editor/editor-card/add-items/types.d.ts +1 -1
  30. package/dist/src/modules/survey-editor/editor-card/add-items/views/item-type-grid-view.d.ts +30 -0
  31. package/dist/src/modules/survey-editor/editor-card/delete-item-dropdown-menu.d.ts +3 -1
  32. package/dist/src/modules/survey-editor/editor-card/expression-pseudo-code.d.ts +8 -0
  33. package/dist/src/modules/survey-editor/editor-card/hooks/use-group-list-keyboard.d.ts +1 -1
  34. package/dist/src/modules/survey-editor/editor-card/item-authoring-state-preview.d.ts +16 -0
  35. package/dist/src/modules/survey-editor/editor-card/item-editor-card.d.ts +1 -6
  36. package/dist/src/modules/survey-editor/editor-card/item-editor-context.d.ts +5 -2
  37. package/dist/src/modules/survey-editor/editor-card/item-expression-overview.d.ts +33 -0
  38. package/dist/src/modules/survey-editor/editor-instance-provider.d.ts +2 -0
  39. package/dist/src/modules/survey-editor/hooks/useDeleteItem.d.ts +2 -0
  40. package/dist/src/modules/survey-editor/index.d.ts +5 -2
  41. package/dist/src/modules/survey-editor/localization/date-fns.d.ts +1 -1
  42. package/dist/src/modules/survey-editor/localization/default-all.d.ts +2 -2
  43. package/dist/src/modules/survey-editor/localization/default-en.d.ts +2 -2
  44. package/dist/src/modules/survey-editor/localization/default-nl.d.ts +2 -2
  45. package/dist/src/modules/survey-editor/localization/index.d.ts +0 -2
  46. package/dist/src/modules/survey-editor/localization/runtime.d.ts +4 -4
  47. package/dist/src/modules/survey-editor/navigation/location.d.ts +6 -0
  48. package/dist/src/modules/survey-editor/navigation/navigation-provider.d.ts +2 -1
  49. package/dist/src/modules/survey-editor/navigation/navigation.d.ts +10 -1
  50. package/dist/src/modules/survey-editor/navigation/types.d.ts +6 -1
  51. package/dist/src/modules/survey-editor/primitives/input-with-ai-popover.d.ts +2 -2
  52. package/dist/src/modules/survey-editor/registry/authoring-state.d.ts +17 -0
  53. package/dist/src/modules/survey-editor/registry/index.d.ts +1 -0
  54. package/dist/src/modules/survey-editor/registry/registry-mappers.d.ts +3 -3
  55. package/dist/src/modules/survey-editor/registry/types.d.ts +40 -4
  56. package/dist/src/modules/survey-editor/routes/editor/_components/assistant-authoring-lock.d.ts +7 -0
  57. package/dist/src/modules/survey-editor/routes/editor/_components/editor-assistant-slot-context.d.ts +6 -0
  58. package/dist/src/modules/survey-editor/routes/editor/_components/editor-assistant-slot.d.ts +8 -0
  59. package/dist/src/modules/survey-editor/routes/editor/_components/editor-mode-switch.d.ts +7 -0
  60. package/dist/src/modules/survey-editor/routes/editor/_components/editor-workspace.d.ts +30 -0
  61. package/dist/src/modules/survey-editor/routes/editor/_components/footer.d.ts +1 -1
  62. package/dist/src/modules/survey-editor/routes/editor/_components/main.d.ts +1 -1
  63. package/dist/src/modules/survey-editor/routes/editor/_components/workspace-presets.d.ts +75 -0
  64. package/dist/src/modules/survey-editor/routes/editor/index.d.ts +1 -1
  65. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/item-editor-toolbar/item-editor-toolbar.d.ts +0 -1
  66. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/survey-outline.d.ts +3 -0
  67. package/dist/src/modules/survey-editor/routes/editor/item-editor/_components/survey-workspace.d.ts +12 -0
  68. package/dist/src/modules/survey-editor/routes/editor/item-editor/index.d.ts +0 -1
  69. package/dist/src/modules/survey-editor/routes/editor/preview-mode/index.d.ts +7 -0
  70. package/dist/src/modules/survey-editor/routes/editor/preview-mode/page-break-divider.d.ts +6 -0
  71. package/dist/src/modules/survey-editor/routes/editor/preview-mode/preview-controls.d.ts +15 -0
  72. package/dist/src/modules/survey-editor/routes/editor/preview-mode/preview-tree.d.ts +26 -0
  73. package/dist/src/modules/survey-editor/routes/editor/preview-mode/survey-preview-canvas.d.ts +16 -0
  74. package/dist/src/modules/survey-editor/routes/editor/preview-mode/survey-preview-item.d.ts +13 -0
  75. package/dist/src/modules/survey-editor/routes/editor/preview-mode/use-preview-preferences.d.ts +14 -0
  76. package/dist/src/modules/survey-editor/store/editor-store.d.ts +7 -1
  77. package/dist/src/modules/survey-editor/survey-editor-config.d.ts +14 -5
  78. package/dist/src/modules/survey-editor/survey-editor.d.ts +14 -2
  79. package/dist/src/modules/survey-editor/workspace.d.ts +17 -0
  80. package/dist/src/modules/survey-player/index.d.ts +0 -1
  81. package/dist/src/modules/survey-player/localization/default-en.d.ts +2 -2
  82. package/dist/src/modules/survey-player/localization/runtime.d.ts +5 -4
  83. package/dist/src/modules/survey-player/survey-context.d.ts +9 -4
  84. package/dist/src/modules/survey-player/survey-player.d.ts +2 -2
  85. package/dist/survey-ui.cjs.js +101 -76
  86. package/dist/survey-ui.cjs.js.map +1 -1
  87. package/dist/survey-ui.css +2 -2
  88. package/dist/survey-ui.es.js +29059 -23481
  89. package/dist/survey-ui.es.js.map +1 -1
  90. package/package.json +26 -17
  91. package/dist/src/modules/default-item-registry/items/choice/editor/option-embedded-form-dialog.d.ts +0 -15
  92. package/dist/src/modules/survey-editor/editor-card/add-items/views/ai-item-view.d.ts +0 -10
  93. package/dist/src/modules/survey-editor/localization/types.d.ts +0 -7
  94. package/dist/src/modules/survey-player/localization/types.d.ts +0 -7
@@ -0,0 +1,3988 @@
1
+ //#region ../survey-core/build/survey-Dxt6iolo.mjs
2
+ function e(e) {
3
+ let t = 2166136261;
4
+ for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
5
+ return t >>> 0;
6
+ }
7
+ function t(t) {
8
+ let n = e(t);
9
+ return () => {
10
+ n = n + 1831565813 >>> 0;
11
+ let e = n;
12
+ return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
13
+ };
14
+ }
15
+ function n(e, t = Math.random) {
16
+ let n = [...e];
17
+ for (let e = n.length - 1; e > 0; e--) {
18
+ let r = Math.floor(t() * (e + 1));
19
+ [n[e], n[r]] = [n[r], n[e]];
20
+ }
21
+ return n;
22
+ }
23
+ function r(e, t = Math.random) {
24
+ return n(Array.from({ length: e }, (e, t) => t), t);
25
+ }
26
+ function i(e) {
27
+ return typeof structuredClone < "u" ? structuredClone(e) : JSON.parse(JSON.stringify(e));
28
+ }
29
+ var a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
30
+ function o() {
31
+ let e = Date.now(), t = "", n = e;
32
+ for (; n > 0;) t = a.charAt(n % 62) + t, n = Math.floor(n / 62);
33
+ let r = "";
34
+ for (let e = 0; e < 10; e++) r += a.charAt(Math.floor(Math.random() * 62));
35
+ return r + t;
36
+ }
37
+ var s = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
38
+ function c(e = 4) {
39
+ let t = "";
40
+ for (let n = 0; n < e; n++) t += s.charAt(Math.floor(Math.random() * 32));
41
+ return t;
42
+ }
43
+ var l = "...", ee = /* @__PURE__ */ function(e) {
44
+ return e.get = "get", e.isDefined = "isDefined", e;
45
+ }({}), u = class e {
46
+ _itemId;
47
+ _name;
48
+ _slotId;
49
+ constructor(e) {
50
+ let t = e.split(l);
51
+ if (t.length !== 3) throw Error("Invalid value reference: " + e);
52
+ this._itemId = t[0], this._name = t[1], this._slotId = t[2];
53
+ }
54
+ get itemId() {
55
+ return this._itemId;
56
+ }
57
+ get name() {
58
+ return this._name;
59
+ }
60
+ get slotId() {
61
+ return this._slotId;
62
+ }
63
+ set itemId(e) {
64
+ this._itemId = e;
65
+ }
66
+ toString() {
67
+ return `${this._itemId}${l}${this._name}${this._slotId ? l + this._slotId : ""}`;
68
+ }
69
+ static fromParts(t, n, r) {
70
+ return new e(`${t}${l}${n}${l}${r}`);
71
+ }
72
+ }, d = {
73
+ Const: "const",
74
+ ResponseVariable: "responseVariable",
75
+ ContextVariable: "contextVariable",
76
+ Function: "function"
77
+ }, f = {
78
+ Locale: "locale",
79
+ ParticipantFlag: "participantFlag",
80
+ CustomValue: "customValue",
81
+ CustomExpression: "customExpression"
82
+ }, p = class e {
83
+ type;
84
+ editorConfig;
85
+ constructor(e, t) {
86
+ this.type = e, this.editorConfig = t;
87
+ }
88
+ static deserialize(e) {
89
+ if (e) switch (e.type) {
90
+ case d.Const: return te.deserialize(e);
91
+ case d.ResponseVariable: return ne.deserialize(e);
92
+ case d.ContextVariable: return re.deserialize(e);
93
+ case d.Function: return ae.deserialize(e);
94
+ }
95
+ }
96
+ clone() {
97
+ return e.deserialize(this.serialize()) ?? (() => {
98
+ throw Error("Failed to clone expression");
99
+ })();
100
+ }
101
+ }, te = class e extends p {
102
+ value;
103
+ constructor(e, t) {
104
+ super(d.Const, t), this.value = e, this.type = d.Const;
105
+ }
106
+ static deserialize(t) {
107
+ if (t.type !== d.Const) throw Error("Invalid expression type: " + t.type);
108
+ return new e(t.value, t.editorConfig);
109
+ }
110
+ get responseVariableRefs() {
111
+ return [];
112
+ }
113
+ serialize() {
114
+ return {
115
+ type: this.type,
116
+ value: this.value,
117
+ editorConfig: this.editorConfig
118
+ };
119
+ }
120
+ updateItemKeyReferences(e, t) {
121
+ return !1;
122
+ }
123
+ }, ne = class e extends p {
124
+ variableRef;
125
+ constructor(e, t) {
126
+ super(d.ResponseVariable, t), this.variableRef = e, this.type = d.ResponseVariable;
127
+ }
128
+ static deserialize(t) {
129
+ if (t.type !== d.ResponseVariable) throw Error("Invalid expression type: " + t.type);
130
+ return new e(t.variableRef, t.editorConfig);
131
+ }
132
+ get responseVariableRefs() {
133
+ return [new u(this.variableRef)];
134
+ }
135
+ get responseVariableRef() {
136
+ return new u(this.variableRef);
137
+ }
138
+ serialize() {
139
+ return {
140
+ type: this.type,
141
+ variableRef: this.variableRef,
142
+ editorConfig: this.editorConfig
143
+ };
144
+ }
145
+ }, re = class e extends p {
146
+ contextType;
147
+ key;
148
+ arguments;
149
+ asType;
150
+ constructor(e, t, n, r, i) {
151
+ super(d.ContextVariable, i), this.type = d.ContextVariable, this.contextType = e, this.key = t, this.arguments = n, this.asType = r;
152
+ }
153
+ static deserialize(t) {
154
+ if (t.type !== d.ContextVariable) throw Error("Invalid expression type: " + t.type);
155
+ return new e(t.contextType, p.deserialize(t.key), t.arguments?.map((e) => p.deserialize(e)), t.asType, t.editorConfig);
156
+ }
157
+ get responseVariableRefs() {
158
+ return this.arguments?.flatMap((e) => e?.responseVariableRefs).filter((e) => e !== void 0) ?? [];
159
+ }
160
+ serialize() {
161
+ return {
162
+ type: this.type,
163
+ contextType: this.contextType,
164
+ key: this.key?.serialize(),
165
+ arguments: this.arguments?.map((e) => e?.serialize()),
166
+ asType: this.asType,
167
+ editorConfig: this.editorConfig
168
+ };
169
+ }
170
+ }, ie = /* @__PURE__ */ function(e) {
171
+ return e.and = "and", e.or = "or", e.not = "not", e.list_contains = "list_contains", e.eq = "eq", e.gt = "gt", e.gte = "gte", e.lt = "lt", e.lte = "lte", e.in_range = "in_range", e.sum = "sum", e.min = "min", e.max = "max", e.str_eq = "str_eq", e.date_eq = "date_eq", e;
172
+ }({}), ae = class e extends p {
173
+ functionName;
174
+ arguments;
175
+ constructor(e, t, n) {
176
+ super(d.Function), this.type = d.Function, this.functionName = e, this.arguments = t, this.editorConfig = n;
177
+ }
178
+ static deserialize(t) {
179
+ if (t.type !== d.Function) throw Error("Invalid expression type: " + t.type);
180
+ let n = t.functionName;
181
+ if (!Object.values(ie).includes(n)) throw Error("Invalid function name: " + n);
182
+ let r = new e(n, t.arguments.map((e) => p.deserialize(e)));
183
+ return r.editorConfig = t.editorConfig, r;
184
+ }
185
+ get responseVariableRefs() {
186
+ let e = this.arguments.flatMap((e) => e?.responseVariableRefs).filter((e) => e !== void 0).map((e) => e.toString());
187
+ return [...new Set(e)].map((e) => new u(e));
188
+ }
189
+ serialize() {
190
+ return {
191
+ type: this.type,
192
+ functionName: this.functionName,
193
+ arguments: this.arguments.map((e) => e?.serialize()),
194
+ editorConfig: this.editorConfig
195
+ };
196
+ }
197
+ }, oe = (e) => {
198
+ let t = {
199
+ type: e.type,
200
+ returnType: e.returnType,
201
+ expression: e.expression?.serialize()
202
+ };
203
+ return e.type === "date2string" && (t.dateFormat = e.dateFormat), t;
204
+ }, se = (e) => {
205
+ let t = {};
206
+ for (let [n, r] of e.entries()) t[n] = oe(r);
207
+ return t;
208
+ }, ce = (e) => ({
209
+ type: e.type,
210
+ expression: e.expression ? p.deserialize(e.expression) : void 0,
211
+ returnType: e.returnType,
212
+ dateFormat: e.dateFormat
213
+ }), le = (e) => new Map(Object.entries(e).map(([e, t]) => [e, ce(t)])), m = {
214
+ string: "string",
215
+ duration: "duration",
216
+ reference: "reference",
217
+ number: "number",
218
+ boolean: "boolean",
219
+ date: "date",
220
+ stringArray: "string[]",
221
+ durationArray: "duration[]",
222
+ referenceArray: "reference[]",
223
+ numberArray: "number[]",
224
+ dateArray: "date[]"
225
+ }, ue = {
226
+ seconds: "seconds",
227
+ minutes: "minutes",
228
+ hours: "hours",
229
+ days: "days",
230
+ weeks: "weeks",
231
+ months: "months",
232
+ years: "years"
233
+ }, de = {
234
+ int: "int",
235
+ float: "float"
236
+ };
237
+ function fe(e) {
238
+ return typeof e == "object" && !!e && !Array.isArray(e);
239
+ }
240
+ function h(e) {
241
+ return typeof e == "number" && Number.isFinite(e);
242
+ }
243
+ function pe(e) {
244
+ return Array.isArray(e) && e.every((e) => typeof e == "string");
245
+ }
246
+ function me(e) {
247
+ return Array.isArray(e) && e.every((e) => h(e));
248
+ }
249
+ function g(e) {
250
+ return e === void 0 || e === de.int || e === de.float;
251
+ }
252
+ function he(e) {
253
+ return typeof e == "string" && Object.values(ue).includes(e);
254
+ }
255
+ function ge(e) {
256
+ if (!fe(e) || typeof e.type != "string") return !1;
257
+ switch (e.type) {
258
+ case m.string:
259
+ case m.reference: return typeof e.value == "string";
260
+ case m.number: return h(e.value) && g(e.precision);
261
+ case m.boolean: return typeof e.value == "boolean";
262
+ case m.date: return h(e.value);
263
+ case m.duration: return h(e.value) && he(e.unit) && g(e.precision);
264
+ case m.stringArray:
265
+ case m.referenceArray: return pe(e.value);
266
+ case m.numberArray:
267
+ case m.dateArray: return me(e.value) && (e.type !== m.numberArray || g(e.precision));
268
+ case m.durationArray: return me(e.value) && he(e.unit) && g(e.precision);
269
+ default: return !1;
270
+ }
271
+ }
272
+ function _e(e, t) {
273
+ if (!ge(e)) throw Error(`Invalid response value at '${t}'`);
274
+ }
275
+ var ve = (e) => ({
276
+ root: e.root ? p.deserialize(e.root) : void 0,
277
+ components: e.components ? Object.fromEntries(Object.entries(e.components).map(([e, t]) => [e, p.deserialize(t)])) : void 0
278
+ }), ye = (e) => ({ components: e.components ? Object.fromEntries(Object.entries(e.components).map(([e, t]) => [e, p.deserialize(t)])) : void 0 }), be = { ifEmpty: "ifEmpty" }, _ = {
279
+ itemResponse: "itemResponse",
280
+ field: "field",
281
+ embeddedField: "embeddedField"
282
+ };
283
+ function xe(e) {
284
+ switch (e.source.type) {
285
+ case "static": return {
286
+ id: e.id,
287
+ target: e.target,
288
+ when: p.deserialize(e.when),
289
+ apply: e.apply,
290
+ source: {
291
+ type: "static",
292
+ value: e.source.value
293
+ }
294
+ };
295
+ case "expression": return {
296
+ id: e.id,
297
+ target: e.target,
298
+ when: p.deserialize(e.when),
299
+ apply: e.apply,
300
+ source: {
301
+ type: "expression",
302
+ expression: p.deserialize(e.source.expression) ?? (() => {
303
+ throw Error(`Prefill '${e.id}' is missing a valid expression source`);
304
+ })()
305
+ }
306
+ };
307
+ case "templateValue": return {
308
+ id: e.id,
309
+ target: e.target,
310
+ when: p.deserialize(e.when),
311
+ apply: e.apply,
312
+ source: {
313
+ type: "templateValue",
314
+ key: e.source.key
315
+ }
316
+ };
317
+ case "previousResponse": return {
318
+ id: e.id,
319
+ target: e.target,
320
+ when: p.deserialize(e.when),
321
+ apply: e.apply,
322
+ source: {
323
+ type: "previousResponse",
324
+ ref: e.source.ref,
325
+ ifUnsupported: e.source.ifUnsupported
326
+ }
327
+ };
328
+ default: throw Error(`Unsupported prefill source type: ${e.source.type}`);
329
+ }
330
+ }
331
+ function Se(e, t) {
332
+ if (e.type !== t.type) return !1;
333
+ switch (e.type) {
334
+ case _.itemResponse: return !0;
335
+ case _.field: return e.fieldId === t.fieldId;
336
+ case _.embeddedField: return e.optionId === t.optionId && e.fieldId === t.fieldId;
337
+ default: return !1;
338
+ }
339
+ }
340
+ var v = class {
341
+ id;
342
+ key;
343
+ config;
344
+ _rawItem;
345
+ displayConditions;
346
+ disabledConditions;
347
+ validations;
348
+ prefills;
349
+ constructor(e) {
350
+ this._rawItem = e, this.updateExpressions(), this.id = this._rawItem.id, this.key = this._rawItem.key, this.config = this.parseConfig(this._rawItem.config);
351
+ }
352
+ getAdditionalResponseValueSlots() {
353
+ return {};
354
+ }
355
+ getAvailableResponseValueSlots(e) {
356
+ let t = {};
357
+ for (let e of this.getResponseSlotDefinitions()) t[`${this.id}...get...${e.slotId}`] = e.valueType, t[`${this.id}...isDefined...${e.slotId}`] = m.boolean;
358
+ return Object.assign(t, this.getAdditionalResponseValueSlots()), e ? Object.fromEntries(Object.entries(t).filter(([, t]) => t === e)) : t;
359
+ }
360
+ get rawItem() {
361
+ return this._rawItem;
362
+ }
363
+ get metadata() {
364
+ return this._rawItem.metadata ?? {};
365
+ }
366
+ set metadata(e) {
367
+ this.updateRawItem({
368
+ ...this._rawItem,
369
+ metadata: e
370
+ });
371
+ }
372
+ get editorMetadata() {
373
+ return this._rawItem.editorMetadata ?? {};
374
+ }
375
+ setCreatedAt(e) {
376
+ this.updateRawItem({
377
+ ...this._rawItem,
378
+ editorMetadata: {
379
+ ...this._rawItem.editorMetadata,
380
+ createdAt: e
381
+ }
382
+ });
383
+ }
384
+ setModifiedAt(e) {
385
+ this.updateRawItem({
386
+ ...this._rawItem,
387
+ editorMetadata: {
388
+ ...this._rawItem.editorMetadata,
389
+ createdAt: this._rawItem.editorMetadata?.createdAt ?? e,
390
+ updatedAt: e
391
+ }
392
+ });
393
+ }
394
+ updateRawItem(e) {
395
+ if (e.id !== this.id) throw Error("Cannot update raw item with a different id");
396
+ this._rawItem = e, this.updateExpressions(), this.key = e.key, this.config = this.parseConfig(e.config);
397
+ }
398
+ updateExpressions() {
399
+ this.displayConditions = this._rawItem.displayConditions ? ve(this._rawItem.displayConditions) : void 0, this.disabledConditions = this._rawItem.disabledConditions ? ye(this._rawItem.disabledConditions) : void 0, this.validations = this._rawItem.validations ? Object.fromEntries(Object.entries(this._rawItem.validations).map(([e, t]) => [e, p.deserialize(t)])) : void 0, this.prefills = this._rawItem.prefills?.map((e) => xe(e));
400
+ }
401
+ getReferenceUsages() {
402
+ let e = [];
403
+ if (this.displayConditions) {
404
+ for (let t of this.displayConditions.root?.responseVariableRefs || []) e.push({
405
+ itemId: this.id,
406
+ usageType: "displayConditions",
407
+ valueReference: t
408
+ });
409
+ for (let [t, n] of Object.entries(this.displayConditions.components || {})) for (let r of n?.responseVariableRefs || []) e.push({
410
+ itemId: this.id,
411
+ fullComponentKey: t,
412
+ usageType: "displayConditions",
413
+ valueReference: r
414
+ });
415
+ }
416
+ if (this.disabledConditions) for (let [t, n] of Object.entries(this.disabledConditions.components || {})) for (let r of n?.responseVariableRefs || []) e.push({
417
+ itemId: this.id,
418
+ fullComponentKey: t,
419
+ usageType: "disabledConditions",
420
+ valueReference: r
421
+ });
422
+ if (this.validations) for (let [t, n] of Object.entries(this.validations)) for (let r of n?.responseVariableRefs || []) e.push({
423
+ itemId: this.id,
424
+ fullComponentKey: t,
425
+ usageType: "validations",
426
+ valueReference: r
427
+ });
428
+ if (this.prefills) for (let t of this.prefills) {
429
+ for (let n of t.when?.responseVariableRefs || []) e.push({
430
+ itemId: this.id,
431
+ fullComponentKey: t.id,
432
+ usageType: "prefills",
433
+ valueReference: n
434
+ });
435
+ if (t.source.type === "expression") for (let n of t.source.expression.responseVariableRefs || []) e.push({
436
+ itemId: this.id,
437
+ fullComponentKey: t.id,
438
+ usageType: "prefills",
439
+ valueReference: n
440
+ });
441
+ }
442
+ return e;
443
+ }
444
+ resolvePrefillTarget(e) {
445
+ let t = this.getResponseSlotDefinitions(), n = t.find((t) => t.prefillTarget !== void 0 && Se(t.prefillTarget, e));
446
+ if (n) return n;
447
+ if (e.type === _.itemResponse && t.length === 1) return t[0];
448
+ }
449
+ normalizePrefillValue(e, t, n) {
450
+ return n.type === t.valueType ? n : void 0;
451
+ }
452
+ }, Ce = /* @__PURE__ */ function(e) {
453
+ return e.Group = "group", e.PageBreak = "page-break", e;
454
+ }({}), we = class {
455
+ _itemKey;
456
+ _path;
457
+ _keySeparator;
458
+ constructor(e, t, n = ".") {
459
+ this._itemKey = e, this._path = t ?? [], this._keySeparator = n;
460
+ }
461
+ get itemKey() {
462
+ return this._itemKey;
463
+ }
464
+ get path() {
465
+ return this._path;
466
+ }
467
+ get parentFullKey() {
468
+ return this._path.join(this._keySeparator);
469
+ }
470
+ get fullKey() {
471
+ return [...this._path, this._itemKey].join(this._keySeparator);
472
+ }
473
+ get isRoot() {
474
+ return this._path.length === 0;
475
+ }
476
+ get keySeparator() {
477
+ return this._keySeparator;
478
+ }
479
+ set keySeparator(e) {
480
+ this._keySeparator = e;
481
+ }
482
+ };
483
+ function Te(e, t, n) {
484
+ let r = [...e];
485
+ return [r[t], r[n]] = [r[n], r[t]], r;
486
+ }
487
+ function Ee(e, t, n) {
488
+ let r = [...e], [i] = r.splice(t, 1);
489
+ return r.splice(n, 0, i), r;
490
+ }
491
+ var y = class extends v {
492
+ type = "group";
493
+ parseConfig(e) {
494
+ let t = e ?? {};
495
+ return {
496
+ items: t.items,
497
+ shuffleItems: t.shuffleItems,
498
+ isRoot: t.isRoot
499
+ };
500
+ }
501
+ serializeConfig() {
502
+ return this.config;
503
+ }
504
+ isInteractive() {
505
+ return !1;
506
+ }
507
+ getResponseSlotDefinitions() {
508
+ return [];
509
+ }
510
+ isRoot() {
511
+ return this.config.isRoot ?? !1;
512
+ }
513
+ get items() {
514
+ return this.config.items ?? [];
515
+ }
516
+ addChild(e, t) {
517
+ let n = this.config.items ??= [], r = t === void 0 ? n.length : Math.min(t, n.length);
518
+ n.splice(r, 0, e), this.updateRawItem({
519
+ ...this.rawItem,
520
+ config: { ...this.config }
521
+ });
522
+ }
523
+ removeChild(e) {
524
+ let t = this.config.items ??= [], n = t.indexOf(e);
525
+ n !== -1 && (t.splice(n, 1), this.updateRawItem({
526
+ ...this.rawItem,
527
+ config: { ...this.config }
528
+ }));
529
+ }
530
+ hasChild(e) {
531
+ return this.items.includes(e);
532
+ }
533
+ get shuffleItems() {
534
+ return this.config.shuffleItems ?? !1;
535
+ }
536
+ set shuffleItems(e) {
537
+ this.config.shuffleItems = e, this.updateRawItem({
538
+ ...this.rawItem,
539
+ config: { ...this.config }
540
+ });
541
+ }
542
+ getChildrenIds() {
543
+ return [...this.items];
544
+ }
545
+ swapItemsByIndex(e, t) {
546
+ let n = this.items;
547
+ if (e < 0 || e >= n.length || t < 0 || t >= n.length) throw Error(`Index out of bounds. Valid range is 0-${n.length - 1}`);
548
+ e !== t && (this.config.items = Te(n, e, t), this.updateRawItem({
549
+ ...this.rawItem,
550
+ config: { ...this.config }
551
+ }));
552
+ }
553
+ swapItemsById(e, t) {
554
+ let n = this.items, r = n.indexOf(e), i = n.indexOf(t);
555
+ if (r === -1) throw Error(`Item '${e}' not found in group '${this.key}'`);
556
+ if (i === -1) throw Error(`Item '${t}' not found in group '${this.key}'`);
557
+ this.swapItemsByIndex(r, i);
558
+ }
559
+ moveItemToIndex(e, t) {
560
+ let n = this.items, r = n.indexOf(e);
561
+ if (r === -1) throw Error(`Item '${e}' not found in group '${this.key}'`);
562
+ if (t < 0 || t >= n.length) throw Error(`Index out of bounds. Valid range is 0-${n.length - 1}`);
563
+ r !== t && (this.config.items = Ee(n, r, t), this.updateRawItem({
564
+ ...this.rawItem,
565
+ config: { ...this.config }
566
+ }));
567
+ }
568
+ }, De = class extends v {
569
+ type = "page-break";
570
+ parseConfig(e) {
571
+ return {};
572
+ }
573
+ serializeConfig() {}
574
+ isInteractive() {
575
+ return !1;
576
+ }
577
+ getResponseSlotDefinitions() {
578
+ return [];
579
+ }
580
+ }, Oe = {
581
+ group: y,
582
+ "page-break": De
583
+ }, ke = (e) => e in Oe;
584
+ function Ae(e, t) {
585
+ if (ke(e.itemType)) {
586
+ let t = Oe[e.itemType];
587
+ return new t(e);
588
+ }
589
+ if (t && e.itemType in t) {
590
+ let n = t[e.itemType];
591
+ return new n(e);
592
+ }
593
+ throw Error(`Unknown item type: ${e.itemType}`);
594
+ }
595
+ function je(e) {
596
+ return {
597
+ ...Oe,
598
+ ...e
599
+ };
600
+ }
601
+ var Me = "https://github.com/case-framework/case-survey-toolkit/packages/survey-core/schemas/survey-schema.json", b = (e) => {
602
+ if (e.trim() === "") throw Error("Locale cannot be empty");
603
+ }, Ne = class e {
604
+ _translations;
605
+ constructor() {
606
+ this._translations = {};
607
+ }
608
+ setContent(e, t, n) {
609
+ if (b(e), !this._translations?.[e]) {
610
+ if (!n) return;
611
+ this._translations[e] = {};
612
+ }
613
+ n ? this._translations[e][t] = n : delete this._translations[e][t];
614
+ }
615
+ setAllForLocale(e, t) {
616
+ if (b(e), !this._translations?.[e]) {
617
+ if (!t) return;
618
+ this._translations[e] = {};
619
+ }
620
+ this._translations[e] = t || {};
621
+ }
622
+ get locales() {
623
+ return Object.keys(this._translations || {});
624
+ }
625
+ getAllForLocale(e) {
626
+ return this._translations?.[e];
627
+ }
628
+ getContent(e, t, n) {
629
+ let r = this._translations?.[e]?.[t];
630
+ if (r) return r;
631
+ if (n) return this._translations?.[n]?.[t];
632
+ }
633
+ clone() {
634
+ let t = new e();
635
+ for (let e of this.locales) {
636
+ let n = this.getAllForLocale(e);
637
+ n && t.setAllForLocale(e, i(n));
638
+ }
639
+ return t;
640
+ }
641
+ removeContentKey(e) {
642
+ for (let t of this.locales) delete this._translations?.[t]?.[e];
643
+ }
644
+ removeContentKeysWithPrefix(e) {
645
+ for (let t of this.locales) {
646
+ let n = this._translations?.[t];
647
+ if (n) for (let t of Object.keys(n)) (t === e || t.startsWith(e + ".")) && delete n[t];
648
+ }
649
+ }
650
+ compact() {
651
+ for (let e of this.locales) {
652
+ let t = this._translations?.[e];
653
+ t && Object.keys(t).length === 0 && delete this._translations?.[e];
654
+ }
655
+ return this.locales.length > 0 ? this : void 0;
656
+ }
657
+ }, x = class {
658
+ _translations;
659
+ constructor(e) {
660
+ this._translations = e || {};
661
+ }
662
+ serialize() {
663
+ if (this.locales.length !== 0) return this._translations;
664
+ }
665
+ get locales() {
666
+ return Object.keys(this._translations);
667
+ }
668
+ removeLocale(e) {
669
+ b(e), delete this._translations[e];
670
+ }
671
+ renameLocale(e, t) {
672
+ b(e), b(t), this._translations[e] && (this._translations[t] = this._translations[e], delete this._translations[e]);
673
+ }
674
+ cloneLocaleAs(e, t) {
675
+ b(e), b(t), this._translations[e] && (this._translations[t] = i(this._translations[e]));
676
+ }
677
+ get surveyCardContent() {
678
+ let e = {};
679
+ for (let t of this.locales) {
680
+ let n = this._translations?.[t]?.surveyCardContent;
681
+ n && (e[t] = n);
682
+ }
683
+ return e;
684
+ }
685
+ get navigationContent() {
686
+ let e = {};
687
+ for (let t of this.locales) {
688
+ let n = this._translations?.[t]?.navigationContent;
689
+ n && (e[t] = n);
690
+ }
691
+ return e;
692
+ }
693
+ get validationMessages() {
694
+ let e = {};
695
+ for (let t of this.locales) {
696
+ let n = this._translations?.[t]?.validationMessages;
697
+ n && (e[t] = n);
698
+ }
699
+ return e;
700
+ }
701
+ setSurveyCardContent(e, t) {
702
+ if (b(e), !this._translations[e]) {
703
+ if (!t) return;
704
+ this._translations[e] = {};
705
+ }
706
+ this._translations[e].surveyCardContent = t;
707
+ }
708
+ setNavigationContent(e, t) {
709
+ if (b(e), !this._translations[e]) {
710
+ if (!t) return;
711
+ this._translations[e] = {};
712
+ }
713
+ this._translations[e].navigationContent = t;
714
+ }
715
+ setValidationMessages(e, t) {
716
+ if (b(e), !this._translations[e]) {
717
+ if (!t) return;
718
+ this._translations[e] = {};
719
+ }
720
+ this._translations[e].validationMessages = t;
721
+ }
722
+ getItemTranslations(e) {
723
+ let t = new Ne();
724
+ for (let n of this.locales) {
725
+ let r = this._translations?.[n].itemTranslations?.[e];
726
+ t.setAllForLocale(n, r);
727
+ }
728
+ return t.locales.length > 0 ? t : void 0;
729
+ }
730
+ setItemTranslations(e, t) {
731
+ let n = t?.clone().compact();
732
+ if (n?.locales.forEach((e) => b(e)), n) {
733
+ let t = n.locales;
734
+ for (let e of t) this.locales.includes(e) || (this._translations[e] = {});
735
+ for (let r of this.locales) t.includes(r) ? (this._translations[r] || (this._translations[r] = {}), this._translations[r].itemTranslations || (this._translations[r].itemTranslations = {}), this._translations[r].itemTranslations[e] = n.getAllForLocale(r)) : delete this._translations[r].itemTranslations?.[e];
736
+ } else for (let t of this.locales) this._translations[t].itemTranslations?.[e] && delete this._translations[t].itemTranslations?.[e];
737
+ }
738
+ onComponentKeyChanged(e, t, n) {
739
+ for (let r of this.locales) {
740
+ let i = this._translations?.[r].itemTranslations?.[e];
741
+ if (i) for (let e of Object.keys(i)) (e.startsWith(t + ".") || e === t) && (i[e.replace(t, n)] = { ...i[e] }, delete i[e]);
742
+ }
743
+ }
744
+ onComponentDeleted(e, t) {
745
+ for (let n of this.locales) {
746
+ let r = this._translations?.[n].itemTranslations?.[e];
747
+ if (r) for (let e of Object.keys(r)) (e.startsWith(t + ".") || e === t) && delete r[e];
748
+ }
749
+ }
750
+ onItemDeleted(e) {
751
+ for (let t of this.locales) delete this._translations[t].itemTranslations?.[e];
752
+ }
753
+ }, Pe = /* @__PURE__ */ function(e) {
754
+ return e.richText = "richText", e.plain = "plain", e.md = "md", e;
755
+ }({});
756
+ function Fe(e) {
757
+ switch (e.type) {
758
+ case "paragraph": return e.children.length > 0;
759
+ case "heading": return e.children.length > 0;
760
+ case "bulletList": return e.items.some((e) => e.children.some((e) => e.children.length > 0));
761
+ case "image": return !0;
762
+ case "infoBox": return !0;
763
+ case "separator": return !0;
764
+ case "blockExtension": return !0;
765
+ }
766
+ }
767
+ function Ie(e) {
768
+ return e.doc.blocks.some((e) => Fe(e));
769
+ }
770
+ function Le(e = "") {
771
+ return {
772
+ type: "richText",
773
+ version: 1,
774
+ doc: {
775
+ type: "doc",
776
+ blocks: [{
777
+ type: "paragraph",
778
+ children: e.length > 0 ? e.split("\n").flatMap((e, t) => {
779
+ let n = [];
780
+ return t > 0 && n.push({ type: "lineBreak" }), e.length > 0 && n.push({
781
+ type: "text",
782
+ text: e
783
+ }), n;
784
+ }) : []
785
+ }]
786
+ }
787
+ };
788
+ }
789
+ function Re(e) {
790
+ return e.map((e) => {
791
+ switch (e.type) {
792
+ case "text": return e.text;
793
+ case "template": return `{${e.key}}`;
794
+ case "lineBreak": return "\n";
795
+ }
796
+ }).join("");
797
+ }
798
+ function S(e) {
799
+ return e.map((e) => {
800
+ switch (e.type) {
801
+ case "text": return e.text;
802
+ case "template": return `{${e.key}}`;
803
+ case "link": return Re(e.children);
804
+ case "lineBreak": return "\n";
805
+ case "inlineExtension": return "";
806
+ }
807
+ }).join("");
808
+ }
809
+ function ze(e) {
810
+ return e.map((e) => S(e.children)).join("\n");
811
+ }
812
+ function Be(e) {
813
+ switch (e.type) {
814
+ case "paragraph": return S(e.children);
815
+ case "heading": return S(e.children);
816
+ case "bulletList": return e.items.map((e) => ze(e.children)).join("\n");
817
+ case "image": {
818
+ let t = e.caption ? ze(e.caption) : "";
819
+ return [e.alt ?? "", t].filter(Boolean).join("\n");
820
+ }
821
+ case "infoBox": return [e.title ? S(e.title) : "", ze(e.children)].filter(Boolean).join("\n");
822
+ case "separator": return "";
823
+ case "blockExtension": return "";
824
+ }
825
+ }
826
+ function Ve(e) {
827
+ return e.doc.blocks.map((e) => Be(e)).filter((e) => e.length > 0).join("\n").trim();
828
+ }
829
+ function He(e) {
830
+ return e ? e.type === "richText" ? Ve(e) : e.content ?? "" : "";
831
+ }
832
+ function Ue(e) {
833
+ return e ? e.type === "richText" ? !Ie(e) : e.content.trim().length === 0 : !0;
834
+ }
835
+ function We(e) {
836
+ if (!e || e.type !== "richText") return [];
837
+ let t = [];
838
+ return e.doc.blocks.forEach((e, n) => {
839
+ e.type === "image" && e.source.type === "asset" && t.push({
840
+ assetId: e.source.assetId,
841
+ blockIndex: n
842
+ });
843
+ }), t;
844
+ }
845
+ var Ge = class e {
846
+ maxItemsPerPage;
847
+ metadata;
848
+ surveyItems = /* @__PURE__ */ new Map();
849
+ _templateValues = /* @__PURE__ */ new Map();
850
+ _assets = /* @__PURE__ */ new Map();
851
+ _translations;
852
+ constructor(e) {
853
+ this.pluginRegistry = e, this._translations = new x();
854
+ }
855
+ getPluginRegistry() {
856
+ return this.pluginRegistry;
857
+ }
858
+ createItemFromRaw(e) {
859
+ return Ae(e, this.pluginRegistry);
860
+ }
861
+ static createBlankSurvey(t, n) {
862
+ let r = n ?? "survey", i = {
863
+ $schema: Me,
864
+ surveyItems: [{
865
+ id: o(),
866
+ key: r,
867
+ itemType: "group",
868
+ config: {
869
+ isRoot: !0,
870
+ items: [],
871
+ shuffleItems: !1
872
+ }
873
+ }]
874
+ };
875
+ return e.fromJson(i, t);
876
+ }
877
+ static fromJson(t, n) {
878
+ let r = new e(n), i = t;
879
+ if (i.$schema !== "https://github.com/case-framework/case-survey-toolkit/packages/survey-core/schemas/survey-schema.json") throw Error(`Unsupported survey schema: ${i.$schema}`);
880
+ if (r.surveyItems = /* @__PURE__ */ new Map(), !i.surveyItems || i.surveyItems.length === 0) throw Error("surveyItems is required");
881
+ return i.surveyItems.forEach((e) => {
882
+ let t = Ae(e, n);
883
+ r.surveyItems.set(t.id, t);
884
+ }), i.templateValues && (r._templateValues = le(i.templateValues)), i.assets && (r._assets = new Map(Object.entries(i.assets))), r._translations = new x(i.translations), i.maxItemsPerPage && (r.maxItemsPerPage = i.maxItemsPerPage), i.metadata && (r.metadata = i.metadata), r;
885
+ }
886
+ serialize() {
887
+ let e = {
888
+ $schema: Me,
889
+ surveyItems: Array.from(this.surveyItems.values()).map((e) => e.rawItem)
890
+ };
891
+ return e.translations = this._translations?.serialize(), this._templateValues && (e.templateValues = se(this._templateValues)), this._assets && this._assets.size > 0 && (e.assets = Object.fromEntries(this._assets.entries())), this.maxItemsPerPage && (e.maxItemsPerPage = this.maxItemsPerPage), this.metadata && (e.metadata = this.metadata), e;
892
+ }
893
+ get surveyKey() {
894
+ if (this.rootItem) return this.rootItem.key;
895
+ }
896
+ get locales() {
897
+ return this._translations?.locales || [];
898
+ }
899
+ get rootItem() {
900
+ return Array.from(this.surveyItems.values()).find((e) => e instanceof y && e.isRoot);
901
+ }
902
+ get keyIndex() {
903
+ let e = [];
904
+ for (let t of this.surveyItems.values()) {
905
+ let n = this.getItemPath(t.id);
906
+ e.push({
907
+ itemId: t.id,
908
+ key: t.key,
909
+ keyPath: n.map((e) => this.surveyItems.get(e)?.key ?? ""),
910
+ path: n
911
+ });
912
+ }
913
+ return e;
914
+ }
915
+ getItemPath(e) {
916
+ let t = this.surveyItems.get(e);
917
+ if (!t) throw Error(`Item ${e} not found`);
918
+ if (t instanceof y && t.isRoot()) return [];
919
+ let n = this.getParentItem(e);
920
+ if (!n) throw Error(`Parent item for ${e} not found`);
921
+ return [...this.getItemPath(n.id), n.id];
922
+ }
923
+ getItemKey(e) {
924
+ let t = this.surveyItems.get(e);
925
+ if (!t) return;
926
+ let n = this.getItemPath(e).map((e) => this.surveyItems.get(e)?.key ?? "");
927
+ return new we(t.key, n);
928
+ }
929
+ getParentItem(e) {
930
+ let t = this.surveyItems.get(e);
931
+ if (!t) throw Error(`Item ${e} not found`);
932
+ if (t instanceof y && t.isRoot()) return;
933
+ let n = Array.from(this.surveyItems.values()).find((t) => t instanceof y && t.config.items?.includes(e));
934
+ if (n) return n;
935
+ }
936
+ getChildrenItems(e) {
937
+ let t = this.surveyItems.get(e);
938
+ return !t || !(t instanceof y) ? [] : t.config.items?.map((e) => this.surveyItems.get(e))?.filter((e) => e !== void 0) || [];
939
+ }
940
+ getSiblings(e) {
941
+ return this.surveyItems.get(e) && this.getParentItem(e)?.items?.map((e) => this.surveyItems.get(e))?.filter((e) => e !== void 0) || [];
942
+ }
943
+ get translations() {
944
+ return this._translations ||= new x(), this._translations;
945
+ }
946
+ getItemTranslations(e) {
947
+ if (!this.surveyItems.get(e)) throw Error(`Item ${e} not found`);
948
+ return this._translations?.getItemTranslations(e);
949
+ }
950
+ getTemplateValue(e) {
951
+ return this._templateValues?.get(e);
952
+ }
953
+ setTemplateValue(e, t) {
954
+ this._templateValues ||= /* @__PURE__ */ new Map(), this._templateValues?.set(e, t);
955
+ }
956
+ deleteTemplateValue(e) {
957
+ this._templateValues?.delete(e);
958
+ }
959
+ getTemplateValueKeys() {
960
+ return Array.from(this._templateValues?.keys() || []);
961
+ }
962
+ getAsset(e) {
963
+ let t = this._assets?.get(e);
964
+ return t ? i(t) : void 0;
965
+ }
966
+ setAsset(e, t) {
967
+ this._assets ||= /* @__PURE__ */ new Map(), this._assets.set(e, i(t));
968
+ }
969
+ deleteAsset(e) {
970
+ this._assets?.delete(e);
971
+ }
972
+ hasAsset(e) {
973
+ return this._assets?.has(e) ?? !1;
974
+ }
975
+ getAssetIds() {
976
+ return Array.from(this._assets?.keys() || []);
977
+ }
978
+ getAssets() {
979
+ return new Map(Array.from(this._assets?.entries() || []).map(([e, t]) => [e, i(t)]));
980
+ }
981
+ getAssetUsages(e) {
982
+ let t = [], n = (n, r, i, a, o) => {
983
+ for (let s of We(n)) e && s.assetId !== e || t.push({
984
+ assetId: s.assetId,
985
+ itemId: o,
986
+ locale: a,
987
+ contentKey: i,
988
+ usageScope: r,
989
+ blockIndex: s.blockIndex
990
+ });
991
+ }, r = this._translations?.serialize(), i = this.rootItem?.id;
992
+ if (!r) return t;
993
+ for (let [e, t] of Object.entries(r)) {
994
+ for (let [r, a] of Object.entries(t.surveyCardContent || {})) n(a, "surveyCard", r, e, i);
995
+ for (let [r, a] of Object.entries(t.navigationContent || {})) n(a, "navigation", r, e, i);
996
+ for (let [r, a] of Object.entries(t.validationMessages || {})) n(a, "validationMessages", r, e, i);
997
+ for (let [r, i] of Object.entries(t.itemTranslations || {})) for (let [t, a] of Object.entries(i || {})) n(a, "itemTranslation", t, e, r);
998
+ }
999
+ return t;
1000
+ }
1001
+ getAvailableResponseValueSlots(e) {
1002
+ let t = {};
1003
+ for (let n of this.surveyItems.values()) t = {
1004
+ ...t,
1005
+ ...n.getAvailableResponseValueSlots(e)
1006
+ };
1007
+ return t;
1008
+ }
1009
+ getResponseSlotDefinitions() {
1010
+ return Array.from(this.surveyItems.values()).map((e) => ({
1011
+ itemId: e.id,
1012
+ slots: e.getResponseSlotDefinitions()
1013
+ }));
1014
+ }
1015
+ getReferenceUsages(e) {
1016
+ let t = [];
1017
+ for (let n of this.surveyItems.values()) e && n.id !== e && !this.isDescendantOf(n.id, e) || t.push(...n.getReferenceUsages());
1018
+ if (this._templateValues) for (let [e, n] of this._templateValues.entries()) for (let r of n.expression?.responseVariableRefs || []) t.push({
1019
+ itemId: e,
1020
+ usageType: "templateValues",
1021
+ valueReference: r
1022
+ });
1023
+ return t;
1024
+ }
1025
+ isDescendantOf(e, t) {
1026
+ return e === t ? !0 : this.getItemPath(e).includes(t);
1027
+ }
1028
+ }, Ke = 365.2425, qe = 6048e5, Je = 864e5, Ye = 43200, Xe = 1440, Ze = 3600 * 24;
1029
+ Ze * 7, Ze * Ke / 12 * 3;
1030
+ var Qe = Symbol.for("constructDateFrom");
1031
+ //#endregion
1032
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/constructFrom.js
1033
+ function C(e, t) {
1034
+ return typeof e == "function" ? e(t) : e && typeof e == "object" && Qe in e ? e[Qe](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
1035
+ }
1036
+ //#endregion
1037
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/toDate.js
1038
+ function w(e, t) {
1039
+ return C(t || e, e);
1040
+ }
1041
+ //#endregion
1042
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/defaultOptions.js
1043
+ var $e = {};
1044
+ function T() {
1045
+ return $e;
1046
+ }
1047
+ //#endregion
1048
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeek.js
1049
+ function E(e, t) {
1050
+ let n = T(), r = t?.weekStartsOn ?? t?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, i = w(e, t?.in), a = i.getDay(), o = (a < r ? 7 : 0) + a - r;
1051
+ return i.setDate(i.getDate() - o), i.setHours(0, 0, 0, 0), i;
1052
+ }
1053
+ //#endregion
1054
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeek.js
1055
+ function D(e, t) {
1056
+ return E(e, {
1057
+ ...t,
1058
+ weekStartsOn: 1
1059
+ });
1060
+ }
1061
+ //#endregion
1062
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeekYear.js
1063
+ function et(e, t) {
1064
+ let n = w(e, t?.in), r = n.getFullYear(), i = C(n, 0);
1065
+ i.setFullYear(r + 1, 0, 4), i.setHours(0, 0, 0, 0);
1066
+ let a = D(i), o = C(n, 0);
1067
+ o.setFullYear(r, 0, 4), o.setHours(0, 0, 0, 0);
1068
+ let s = D(o);
1069
+ return n.getTime() >= a.getTime() ? r + 1 : n.getTime() >= s.getTime() ? r : r - 1;
1070
+ }
1071
+ //#endregion
1072
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
1073
+ function tt(e) {
1074
+ let t = w(e), n = new Date(Date.UTC(t.getFullYear(), t.getMonth(), t.getDate(), t.getHours(), t.getMinutes(), t.getSeconds(), t.getMilliseconds()));
1075
+ return n.setUTCFullYear(t.getFullYear()), e - +n;
1076
+ }
1077
+ //#endregion
1078
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeDates.js
1079
+ function nt(e, ...t) {
1080
+ let n = C.bind(null, e || t.find((e) => typeof e == "object"));
1081
+ return t.map(n);
1082
+ }
1083
+ //#endregion
1084
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfDay.js
1085
+ function rt(e, t) {
1086
+ let n = w(e, t?.in);
1087
+ return n.setHours(0, 0, 0, 0), n;
1088
+ }
1089
+ //#endregion
1090
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarDays.js
1091
+ function it(e, t, n) {
1092
+ let [r, i] = nt(n?.in, e, t), a = rt(r), o = rt(i), s = +a - tt(a), c = +o - tt(o);
1093
+ return Math.round((s - c) / Je);
1094
+ }
1095
+ //#endregion
1096
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfISOWeekYear.js
1097
+ function at(e, t) {
1098
+ let n = et(e, t), r = C(t?.in || e, 0);
1099
+ return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0), D(r);
1100
+ }
1101
+ //#endregion
1102
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isDate.js
1103
+ function ot(e) {
1104
+ return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
1105
+ }
1106
+ //#endregion
1107
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/isValid.js
1108
+ function st(e) {
1109
+ return !(!ot(e) && typeof e != "number" || isNaN(+w(e)));
1110
+ }
1111
+ //#endregion
1112
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfYear.js
1113
+ function ct(e, t) {
1114
+ let n = w(e, t?.in);
1115
+ return n.setFullYear(n.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
1116
+ }
1117
+ //#endregion
1118
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatDistance.js
1119
+ var lt = {
1120
+ lessThanXSeconds: {
1121
+ one: "less than a second",
1122
+ other: "less than {{count}} seconds"
1123
+ },
1124
+ xSeconds: {
1125
+ one: "1 second",
1126
+ other: "{{count}} seconds"
1127
+ },
1128
+ halfAMinute: "half a minute",
1129
+ lessThanXMinutes: {
1130
+ one: "less than a minute",
1131
+ other: "less than {{count}} minutes"
1132
+ },
1133
+ xMinutes: {
1134
+ one: "1 minute",
1135
+ other: "{{count}} minutes"
1136
+ },
1137
+ aboutXHours: {
1138
+ one: "about 1 hour",
1139
+ other: "about {{count}} hours"
1140
+ },
1141
+ xHours: {
1142
+ one: "1 hour",
1143
+ other: "{{count}} hours"
1144
+ },
1145
+ xDays: {
1146
+ one: "1 day",
1147
+ other: "{{count}} days"
1148
+ },
1149
+ aboutXWeeks: {
1150
+ one: "about 1 week",
1151
+ other: "about {{count}} weeks"
1152
+ },
1153
+ xWeeks: {
1154
+ one: "1 week",
1155
+ other: "{{count}} weeks"
1156
+ },
1157
+ aboutXMonths: {
1158
+ one: "about 1 month",
1159
+ other: "about {{count}} months"
1160
+ },
1161
+ xMonths: {
1162
+ one: "1 month",
1163
+ other: "{{count}} months"
1164
+ },
1165
+ aboutXYears: {
1166
+ one: "about 1 year",
1167
+ other: "about {{count}} years"
1168
+ },
1169
+ xYears: {
1170
+ one: "1 year",
1171
+ other: "{{count}} years"
1172
+ },
1173
+ overXYears: {
1174
+ one: "over 1 year",
1175
+ other: "over {{count}} years"
1176
+ },
1177
+ almostXYears: {
1178
+ one: "almost 1 year",
1179
+ other: "almost {{count}} years"
1180
+ }
1181
+ }, ut = (e, t, n) => {
1182
+ let r, i = lt[e];
1183
+ return r = typeof i == "string" ? i : t === 1 ? i.one : i.other.replace("{{count}}", t.toString()), n?.addSuffix ? n.comparison && n.comparison > 0 ? "in " + r : r + " ago" : r;
1184
+ };
1185
+ //#endregion
1186
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildFormatLongFn.js
1187
+ function O(e) {
1188
+ return (t = {}) => {
1189
+ let n = t.width ? String(t.width) : e.defaultWidth;
1190
+ return e.formats[n] || e.formats[e.defaultWidth];
1191
+ };
1192
+ }
1193
+ var dt = {
1194
+ date: O({
1195
+ formats: {
1196
+ full: "EEEE, MMMM do, y",
1197
+ long: "MMMM do, y",
1198
+ medium: "MMM d, y",
1199
+ short: "MM/dd/yyyy"
1200
+ },
1201
+ defaultWidth: "full"
1202
+ }),
1203
+ time: O({
1204
+ formats: {
1205
+ full: "h:mm:ss a zzzz",
1206
+ long: "h:mm:ss a z",
1207
+ medium: "h:mm:ss a",
1208
+ short: "h:mm a"
1209
+ },
1210
+ defaultWidth: "full"
1211
+ }),
1212
+ dateTime: O({
1213
+ formats: {
1214
+ full: "{{date}} 'at' {{time}}",
1215
+ long: "{{date}} 'at' {{time}}",
1216
+ medium: "{{date}}, {{time}}",
1217
+ short: "{{date}}, {{time}}"
1218
+ },
1219
+ defaultWidth: "full"
1220
+ })
1221
+ }, ft = {
1222
+ lastWeek: "'last' eeee 'at' p",
1223
+ yesterday: "'yesterday at' p",
1224
+ today: "'today at' p",
1225
+ tomorrow: "'tomorrow at' p",
1226
+ nextWeek: "eeee 'at' p",
1227
+ other: "P"
1228
+ }, pt = (e, t, n, r) => ft[e];
1229
+ //#endregion
1230
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildLocalizeFn.js
1231
+ function k(e) {
1232
+ return (t, n) => {
1233
+ let r = n?.context ? String(n.context) : "standalone", i;
1234
+ if (r === "formatting" && e.formattingValues) {
1235
+ let t = e.defaultFormattingWidth || e.defaultWidth, r = n?.width ? String(n.width) : t;
1236
+ i = e.formattingValues[r] || e.formattingValues[t];
1237
+ } else {
1238
+ let t = e.defaultWidth, r = n?.width ? String(n.width) : e.defaultWidth;
1239
+ i = e.values[r] || e.values[t];
1240
+ }
1241
+ let a = e.argumentCallback ? e.argumentCallback(t) : t;
1242
+ return i[a];
1243
+ };
1244
+ }
1245
+ var mt = {
1246
+ ordinalNumber: (e, t) => {
1247
+ let n = Number(e), r = n % 100;
1248
+ if (r > 20 || r < 10) switch (r % 10) {
1249
+ case 1: return n + "st";
1250
+ case 2: return n + "nd";
1251
+ case 3: return n + "rd";
1252
+ }
1253
+ return n + "th";
1254
+ },
1255
+ era: k({
1256
+ values: {
1257
+ narrow: ["B", "A"],
1258
+ abbreviated: ["BC", "AD"],
1259
+ wide: ["Before Christ", "Anno Domini"]
1260
+ },
1261
+ defaultWidth: "wide"
1262
+ }),
1263
+ quarter: k({
1264
+ values: {
1265
+ narrow: [
1266
+ "1",
1267
+ "2",
1268
+ "3",
1269
+ "4"
1270
+ ],
1271
+ abbreviated: [
1272
+ "Q1",
1273
+ "Q2",
1274
+ "Q3",
1275
+ "Q4"
1276
+ ],
1277
+ wide: [
1278
+ "1st quarter",
1279
+ "2nd quarter",
1280
+ "3rd quarter",
1281
+ "4th quarter"
1282
+ ]
1283
+ },
1284
+ defaultWidth: "wide",
1285
+ argumentCallback: (e) => e - 1
1286
+ }),
1287
+ month: k({
1288
+ values: {
1289
+ narrow: [
1290
+ "J",
1291
+ "F",
1292
+ "M",
1293
+ "A",
1294
+ "M",
1295
+ "J",
1296
+ "J",
1297
+ "A",
1298
+ "S",
1299
+ "O",
1300
+ "N",
1301
+ "D"
1302
+ ],
1303
+ abbreviated: [
1304
+ "Jan",
1305
+ "Feb",
1306
+ "Mar",
1307
+ "Apr",
1308
+ "May",
1309
+ "Jun",
1310
+ "Jul",
1311
+ "Aug",
1312
+ "Sep",
1313
+ "Oct",
1314
+ "Nov",
1315
+ "Dec"
1316
+ ],
1317
+ wide: [
1318
+ "January",
1319
+ "February",
1320
+ "March",
1321
+ "April",
1322
+ "May",
1323
+ "June",
1324
+ "July",
1325
+ "August",
1326
+ "September",
1327
+ "October",
1328
+ "November",
1329
+ "December"
1330
+ ]
1331
+ },
1332
+ defaultWidth: "wide"
1333
+ }),
1334
+ day: k({
1335
+ values: {
1336
+ narrow: [
1337
+ "S",
1338
+ "M",
1339
+ "T",
1340
+ "W",
1341
+ "T",
1342
+ "F",
1343
+ "S"
1344
+ ],
1345
+ short: [
1346
+ "Su",
1347
+ "Mo",
1348
+ "Tu",
1349
+ "We",
1350
+ "Th",
1351
+ "Fr",
1352
+ "Sa"
1353
+ ],
1354
+ abbreviated: [
1355
+ "Sun",
1356
+ "Mon",
1357
+ "Tue",
1358
+ "Wed",
1359
+ "Thu",
1360
+ "Fri",
1361
+ "Sat"
1362
+ ],
1363
+ wide: [
1364
+ "Sunday",
1365
+ "Monday",
1366
+ "Tuesday",
1367
+ "Wednesday",
1368
+ "Thursday",
1369
+ "Friday",
1370
+ "Saturday"
1371
+ ]
1372
+ },
1373
+ defaultWidth: "wide"
1374
+ }),
1375
+ dayPeriod: k({
1376
+ values: {
1377
+ narrow: {
1378
+ am: "a",
1379
+ pm: "p",
1380
+ midnight: "mi",
1381
+ noon: "n",
1382
+ morning: "morning",
1383
+ afternoon: "afternoon",
1384
+ evening: "evening",
1385
+ night: "night"
1386
+ },
1387
+ abbreviated: {
1388
+ am: "AM",
1389
+ pm: "PM",
1390
+ midnight: "midnight",
1391
+ noon: "noon",
1392
+ morning: "morning",
1393
+ afternoon: "afternoon",
1394
+ evening: "evening",
1395
+ night: "night"
1396
+ },
1397
+ wide: {
1398
+ am: "a.m.",
1399
+ pm: "p.m.",
1400
+ midnight: "midnight",
1401
+ noon: "noon",
1402
+ morning: "morning",
1403
+ afternoon: "afternoon",
1404
+ evening: "evening",
1405
+ night: "night"
1406
+ }
1407
+ },
1408
+ defaultWidth: "wide",
1409
+ formattingValues: {
1410
+ narrow: {
1411
+ am: "a",
1412
+ pm: "p",
1413
+ midnight: "mi",
1414
+ noon: "n",
1415
+ morning: "in the morning",
1416
+ afternoon: "in the afternoon",
1417
+ evening: "in the evening",
1418
+ night: "at night"
1419
+ },
1420
+ abbreviated: {
1421
+ am: "AM",
1422
+ pm: "PM",
1423
+ midnight: "midnight",
1424
+ noon: "noon",
1425
+ morning: "in the morning",
1426
+ afternoon: "in the afternoon",
1427
+ evening: "in the evening",
1428
+ night: "at night"
1429
+ },
1430
+ wide: {
1431
+ am: "a.m.",
1432
+ pm: "p.m.",
1433
+ midnight: "midnight",
1434
+ noon: "noon",
1435
+ morning: "in the morning",
1436
+ afternoon: "in the afternoon",
1437
+ evening: "in the evening",
1438
+ night: "at night"
1439
+ }
1440
+ },
1441
+ defaultFormattingWidth: "wide"
1442
+ })
1443
+ };
1444
+ //#endregion
1445
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchFn.js
1446
+ function A(e) {
1447
+ return (t, n = {}) => {
1448
+ let r = n.width, i = r && e.matchPatterns[r] || e.matchPatterns[e.defaultMatchWidth], a = t.match(i);
1449
+ if (!a) return null;
1450
+ let o = a[0], s = r && e.parsePatterns[r] || e.parsePatterns[e.defaultParseWidth], c = Array.isArray(s) ? gt(s, (e) => e.test(o)) : ht(s, (e) => e.test(o)), l;
1451
+ l = e.valueCallback ? e.valueCallback(c) : c, l = n.valueCallback ? n.valueCallback(l) : l;
1452
+ let ee = t.slice(o.length);
1453
+ return {
1454
+ value: l,
1455
+ rest: ee
1456
+ };
1457
+ };
1458
+ }
1459
+ function ht(e, t) {
1460
+ for (let n in e) if (Object.prototype.hasOwnProperty.call(e, n) && t(e[n])) return n;
1461
+ }
1462
+ function gt(e, t) {
1463
+ for (let n = 0; n < e.length; n++) if (t(e[n])) return n;
1464
+ }
1465
+ //#endregion
1466
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
1467
+ function _t(e) {
1468
+ return (t, n = {}) => {
1469
+ let r = t.match(e.matchPattern);
1470
+ if (!r) return null;
1471
+ let i = r[0], a = t.match(e.parsePattern);
1472
+ if (!a) return null;
1473
+ let o = e.valueCallback ? e.valueCallback(a[0]) : a[0];
1474
+ o = n.valueCallback ? n.valueCallback(o) : o;
1475
+ let s = t.slice(i.length);
1476
+ return {
1477
+ value: o,
1478
+ rest: s
1479
+ };
1480
+ };
1481
+ }
1482
+ //#endregion
1483
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/locale/en-US.js
1484
+ var j = {
1485
+ code: "en-US",
1486
+ formatDistance: ut,
1487
+ formatLong: dt,
1488
+ formatRelative: pt,
1489
+ localize: mt,
1490
+ match: {
1491
+ ordinalNumber: _t({
1492
+ matchPattern: /^(\d+)(th|st|nd|rd)?/i,
1493
+ parsePattern: /\d+/i,
1494
+ valueCallback: (e) => parseInt(e, 10)
1495
+ }),
1496
+ era: A({
1497
+ matchPatterns: {
1498
+ narrow: /^(b|a)/i,
1499
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1500
+ wide: /^(before christ|before common era|anno domini|common era)/i
1501
+ },
1502
+ defaultMatchWidth: "wide",
1503
+ parsePatterns: { any: [/^b/i, /^(a|c)/i] },
1504
+ defaultParseWidth: "any"
1505
+ }),
1506
+ quarter: A({
1507
+ matchPatterns: {
1508
+ narrow: /^[1234]/i,
1509
+ abbreviated: /^q[1234]/i,
1510
+ wide: /^[1234](th|st|nd|rd)? quarter/i
1511
+ },
1512
+ defaultMatchWidth: "wide",
1513
+ parsePatterns: { any: [
1514
+ /1/i,
1515
+ /2/i,
1516
+ /3/i,
1517
+ /4/i
1518
+ ] },
1519
+ defaultParseWidth: "any",
1520
+ valueCallback: (e) => e + 1
1521
+ }),
1522
+ month: A({
1523
+ matchPatterns: {
1524
+ narrow: /^[jfmasond]/i,
1525
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1526
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
1527
+ },
1528
+ defaultMatchWidth: "wide",
1529
+ parsePatterns: {
1530
+ narrow: [
1531
+ /^j/i,
1532
+ /^f/i,
1533
+ /^m/i,
1534
+ /^a/i,
1535
+ /^m/i,
1536
+ /^j/i,
1537
+ /^j/i,
1538
+ /^a/i,
1539
+ /^s/i,
1540
+ /^o/i,
1541
+ /^n/i,
1542
+ /^d/i
1543
+ ],
1544
+ any: [
1545
+ /^ja/i,
1546
+ /^f/i,
1547
+ /^mar/i,
1548
+ /^ap/i,
1549
+ /^may/i,
1550
+ /^jun/i,
1551
+ /^jul/i,
1552
+ /^au/i,
1553
+ /^s/i,
1554
+ /^o/i,
1555
+ /^n/i,
1556
+ /^d/i
1557
+ ]
1558
+ },
1559
+ defaultParseWidth: "any"
1560
+ }),
1561
+ day: A({
1562
+ matchPatterns: {
1563
+ narrow: /^[smtwf]/i,
1564
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
1565
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1566
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
1567
+ },
1568
+ defaultMatchWidth: "wide",
1569
+ parsePatterns: {
1570
+ narrow: [
1571
+ /^s/i,
1572
+ /^m/i,
1573
+ /^t/i,
1574
+ /^w/i,
1575
+ /^t/i,
1576
+ /^f/i,
1577
+ /^s/i
1578
+ ],
1579
+ any: [
1580
+ /^su/i,
1581
+ /^m/i,
1582
+ /^tu/i,
1583
+ /^w/i,
1584
+ /^th/i,
1585
+ /^f/i,
1586
+ /^sa/i
1587
+ ]
1588
+ },
1589
+ defaultParseWidth: "any"
1590
+ }),
1591
+ dayPeriod: A({
1592
+ matchPatterns: {
1593
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1594
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
1595
+ },
1596
+ defaultMatchWidth: "any",
1597
+ parsePatterns: { any: {
1598
+ am: /^a/i,
1599
+ pm: /^p/i,
1600
+ midnight: /^mi/i,
1601
+ noon: /^no/i,
1602
+ morning: /morning/i,
1603
+ afternoon: /afternoon/i,
1604
+ evening: /evening/i,
1605
+ night: /night/i
1606
+ } },
1607
+ defaultParseWidth: "any"
1608
+ })
1609
+ },
1610
+ options: {
1611
+ weekStartsOn: 0,
1612
+ firstWeekContainsDate: 1
1613
+ }
1614
+ };
1615
+ //#endregion
1616
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getDayOfYear.js
1617
+ function vt(e, t) {
1618
+ let n = w(e, t?.in);
1619
+ return it(n, ct(n)) + 1;
1620
+ }
1621
+ //#endregion
1622
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISOWeek.js
1623
+ function yt(e, t) {
1624
+ let n = w(e, t?.in), r = D(n) - +at(n);
1625
+ return Math.round(r / qe) + 1;
1626
+ }
1627
+ //#endregion
1628
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getWeekYear.js
1629
+ function bt(e, t) {
1630
+ let n = w(e, t?.in), r = n.getFullYear(), i = T(), a = t?.firstWeekContainsDate ?? t?.locale?.options?.firstWeekContainsDate ?? i.firstWeekContainsDate ?? i.locale?.options?.firstWeekContainsDate ?? 1, o = C(t?.in || e, 0);
1631
+ o.setFullYear(r + 1, 0, a), o.setHours(0, 0, 0, 0);
1632
+ let s = E(o, t), c = C(t?.in || e, 0);
1633
+ c.setFullYear(r, 0, a), c.setHours(0, 0, 0, 0);
1634
+ let l = E(c, t);
1635
+ return +n >= +s ? r + 1 : +n >= +l ? r : r - 1;
1636
+ }
1637
+ //#endregion
1638
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/startOfWeekYear.js
1639
+ function xt(e, t) {
1640
+ let n = T(), r = t?.firstWeekContainsDate ?? t?.locale?.options?.firstWeekContainsDate ?? n.firstWeekContainsDate ?? n.locale?.options?.firstWeekContainsDate ?? 1, i = bt(e, t), a = C(t?.in || e, 0);
1641
+ return a.setFullYear(i, 0, r), a.setHours(0, 0, 0, 0), E(a, t);
1642
+ }
1643
+ //#endregion
1644
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getWeek.js
1645
+ function St(e, t) {
1646
+ let n = w(e, t?.in), r = E(n, t) - +xt(n, t);
1647
+ return Math.round(r / qe) + 1;
1648
+ }
1649
+ //#endregion
1650
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/addLeadingZeros.js
1651
+ function M(e, t) {
1652
+ return (e < 0 ? "-" : "") + Math.abs(e).toString().padStart(t, "0");
1653
+ }
1654
+ //#endregion
1655
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/lightFormatters.js
1656
+ var N = {
1657
+ y(e, t) {
1658
+ let n = e.getFullYear(), r = n > 0 ? n : 1 - n;
1659
+ return M(t === "yy" ? r % 100 : r, t.length);
1660
+ },
1661
+ M(e, t) {
1662
+ let n = e.getMonth();
1663
+ return t === "M" ? String(n + 1) : M(n + 1, 2);
1664
+ },
1665
+ d(e, t) {
1666
+ return M(e.getDate(), t.length);
1667
+ },
1668
+ a(e, t) {
1669
+ let n = e.getHours() / 12 >= 1 ? "pm" : "am";
1670
+ switch (t) {
1671
+ case "a":
1672
+ case "aa": return n.toUpperCase();
1673
+ case "aaa": return n;
1674
+ case "aaaaa": return n[0];
1675
+ default: return n === "am" ? "a.m." : "p.m.";
1676
+ }
1677
+ },
1678
+ h(e, t) {
1679
+ return M(e.getHours() % 12 || 12, t.length);
1680
+ },
1681
+ H(e, t) {
1682
+ return M(e.getHours(), t.length);
1683
+ },
1684
+ m(e, t) {
1685
+ return M(e.getMinutes(), t.length);
1686
+ },
1687
+ s(e, t) {
1688
+ return M(e.getSeconds(), t.length);
1689
+ },
1690
+ S(e, t) {
1691
+ let n = t.length, r = e.getMilliseconds();
1692
+ return M(Math.trunc(r * 10 ** (n - 3)), t.length);
1693
+ }
1694
+ }, P = {
1695
+ am: "am",
1696
+ pm: "pm",
1697
+ midnight: "midnight",
1698
+ noon: "noon",
1699
+ morning: "morning",
1700
+ afternoon: "afternoon",
1701
+ evening: "evening",
1702
+ night: "night"
1703
+ }, Ct = {
1704
+ G: function(e, t, n) {
1705
+ let r = +(e.getFullYear() > 0);
1706
+ switch (t) {
1707
+ case "G":
1708
+ case "GG":
1709
+ case "GGG": return n.era(r, { width: "abbreviated" });
1710
+ case "GGGGG": return n.era(r, { width: "narrow" });
1711
+ default: return n.era(r, { width: "wide" });
1712
+ }
1713
+ },
1714
+ y: function(e, t, n) {
1715
+ if (t === "yo") {
1716
+ let t = e.getFullYear(), r = t > 0 ? t : 1 - t;
1717
+ return n.ordinalNumber(r, { unit: "year" });
1718
+ }
1719
+ return N.y(e, t);
1720
+ },
1721
+ Y: function(e, t, n, r) {
1722
+ let i = bt(e, r), a = i > 0 ? i : 1 - i;
1723
+ return t === "YY" ? M(a % 100, 2) : t === "Yo" ? n.ordinalNumber(a, { unit: "year" }) : M(a, t.length);
1724
+ },
1725
+ R: function(e, t) {
1726
+ return M(et(e), t.length);
1727
+ },
1728
+ u: function(e, t) {
1729
+ return M(e.getFullYear(), t.length);
1730
+ },
1731
+ Q: function(e, t, n) {
1732
+ let r = Math.ceil((e.getMonth() + 1) / 3);
1733
+ switch (t) {
1734
+ case "Q": return String(r);
1735
+ case "QQ": return M(r, 2);
1736
+ case "Qo": return n.ordinalNumber(r, { unit: "quarter" });
1737
+ case "QQQ": return n.quarter(r, {
1738
+ width: "abbreviated",
1739
+ context: "formatting"
1740
+ });
1741
+ case "QQQQQ": return n.quarter(r, {
1742
+ width: "narrow",
1743
+ context: "formatting"
1744
+ });
1745
+ default: return n.quarter(r, {
1746
+ width: "wide",
1747
+ context: "formatting"
1748
+ });
1749
+ }
1750
+ },
1751
+ q: function(e, t, n) {
1752
+ let r = Math.ceil((e.getMonth() + 1) / 3);
1753
+ switch (t) {
1754
+ case "q": return String(r);
1755
+ case "qq": return M(r, 2);
1756
+ case "qo": return n.ordinalNumber(r, { unit: "quarter" });
1757
+ case "qqq": return n.quarter(r, {
1758
+ width: "abbreviated",
1759
+ context: "standalone"
1760
+ });
1761
+ case "qqqqq": return n.quarter(r, {
1762
+ width: "narrow",
1763
+ context: "standalone"
1764
+ });
1765
+ default: return n.quarter(r, {
1766
+ width: "wide",
1767
+ context: "standalone"
1768
+ });
1769
+ }
1770
+ },
1771
+ M: function(e, t, n) {
1772
+ let r = e.getMonth();
1773
+ switch (t) {
1774
+ case "M":
1775
+ case "MM": return N.M(e, t);
1776
+ case "Mo": return n.ordinalNumber(r + 1, { unit: "month" });
1777
+ case "MMM": return n.month(r, {
1778
+ width: "abbreviated",
1779
+ context: "formatting"
1780
+ });
1781
+ case "MMMMM": return n.month(r, {
1782
+ width: "narrow",
1783
+ context: "formatting"
1784
+ });
1785
+ default: return n.month(r, {
1786
+ width: "wide",
1787
+ context: "formatting"
1788
+ });
1789
+ }
1790
+ },
1791
+ L: function(e, t, n) {
1792
+ let r = e.getMonth();
1793
+ switch (t) {
1794
+ case "L": return String(r + 1);
1795
+ case "LL": return M(r + 1, 2);
1796
+ case "Lo": return n.ordinalNumber(r + 1, { unit: "month" });
1797
+ case "LLL": return n.month(r, {
1798
+ width: "abbreviated",
1799
+ context: "standalone"
1800
+ });
1801
+ case "LLLLL": return n.month(r, {
1802
+ width: "narrow",
1803
+ context: "standalone"
1804
+ });
1805
+ default: return n.month(r, {
1806
+ width: "wide",
1807
+ context: "standalone"
1808
+ });
1809
+ }
1810
+ },
1811
+ w: function(e, t, n, r) {
1812
+ let i = St(e, r);
1813
+ return t === "wo" ? n.ordinalNumber(i, { unit: "week" }) : M(i, t.length);
1814
+ },
1815
+ I: function(e, t, n) {
1816
+ let r = yt(e);
1817
+ return t === "Io" ? n.ordinalNumber(r, { unit: "week" }) : M(r, t.length);
1818
+ },
1819
+ d: function(e, t, n) {
1820
+ return t === "do" ? n.ordinalNumber(e.getDate(), { unit: "date" }) : N.d(e, t);
1821
+ },
1822
+ D: function(e, t, n) {
1823
+ let r = vt(e);
1824
+ return t === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) : M(r, t.length);
1825
+ },
1826
+ E: function(e, t, n) {
1827
+ let r = e.getDay();
1828
+ switch (t) {
1829
+ case "E":
1830
+ case "EE":
1831
+ case "EEE": return n.day(r, {
1832
+ width: "abbreviated",
1833
+ context: "formatting"
1834
+ });
1835
+ case "EEEEE": return n.day(r, {
1836
+ width: "narrow",
1837
+ context: "formatting"
1838
+ });
1839
+ case "EEEEEE": return n.day(r, {
1840
+ width: "short",
1841
+ context: "formatting"
1842
+ });
1843
+ default: return n.day(r, {
1844
+ width: "wide",
1845
+ context: "formatting"
1846
+ });
1847
+ }
1848
+ },
1849
+ e: function(e, t, n, r) {
1850
+ let i = e.getDay(), a = (i - r.weekStartsOn + 8) % 7 || 7;
1851
+ switch (t) {
1852
+ case "e": return String(a);
1853
+ case "ee": return M(a, 2);
1854
+ case "eo": return n.ordinalNumber(a, { unit: "day" });
1855
+ case "eee": return n.day(i, {
1856
+ width: "abbreviated",
1857
+ context: "formatting"
1858
+ });
1859
+ case "eeeee": return n.day(i, {
1860
+ width: "narrow",
1861
+ context: "formatting"
1862
+ });
1863
+ case "eeeeee": return n.day(i, {
1864
+ width: "short",
1865
+ context: "formatting"
1866
+ });
1867
+ default: return n.day(i, {
1868
+ width: "wide",
1869
+ context: "formatting"
1870
+ });
1871
+ }
1872
+ },
1873
+ c: function(e, t, n, r) {
1874
+ let i = e.getDay(), a = (i - r.weekStartsOn + 8) % 7 || 7;
1875
+ switch (t) {
1876
+ case "c": return String(a);
1877
+ case "cc": return M(a, t.length);
1878
+ case "co": return n.ordinalNumber(a, { unit: "day" });
1879
+ case "ccc": return n.day(i, {
1880
+ width: "abbreviated",
1881
+ context: "standalone"
1882
+ });
1883
+ case "ccccc": return n.day(i, {
1884
+ width: "narrow",
1885
+ context: "standalone"
1886
+ });
1887
+ case "cccccc": return n.day(i, {
1888
+ width: "short",
1889
+ context: "standalone"
1890
+ });
1891
+ default: return n.day(i, {
1892
+ width: "wide",
1893
+ context: "standalone"
1894
+ });
1895
+ }
1896
+ },
1897
+ i: function(e, t, n) {
1898
+ let r = e.getDay(), i = r === 0 ? 7 : r;
1899
+ switch (t) {
1900
+ case "i": return String(i);
1901
+ case "ii": return M(i, t.length);
1902
+ case "io": return n.ordinalNumber(i, { unit: "day" });
1903
+ case "iii": return n.day(r, {
1904
+ width: "abbreviated",
1905
+ context: "formatting"
1906
+ });
1907
+ case "iiiii": return n.day(r, {
1908
+ width: "narrow",
1909
+ context: "formatting"
1910
+ });
1911
+ case "iiiiii": return n.day(r, {
1912
+ width: "short",
1913
+ context: "formatting"
1914
+ });
1915
+ default: return n.day(r, {
1916
+ width: "wide",
1917
+ context: "formatting"
1918
+ });
1919
+ }
1920
+ },
1921
+ a: function(e, t, n) {
1922
+ let r = e.getHours() / 12 >= 1 ? "pm" : "am";
1923
+ switch (t) {
1924
+ case "a":
1925
+ case "aa": return n.dayPeriod(r, {
1926
+ width: "abbreviated",
1927
+ context: "formatting"
1928
+ });
1929
+ case "aaa": return n.dayPeriod(r, {
1930
+ width: "abbreviated",
1931
+ context: "formatting"
1932
+ }).toLowerCase();
1933
+ case "aaaaa": return n.dayPeriod(r, {
1934
+ width: "narrow",
1935
+ context: "formatting"
1936
+ });
1937
+ default: return n.dayPeriod(r, {
1938
+ width: "wide",
1939
+ context: "formatting"
1940
+ });
1941
+ }
1942
+ },
1943
+ b: function(e, t, n) {
1944
+ let r = e.getHours(), i;
1945
+ switch (i = r === 12 ? P.noon : r === 0 ? P.midnight : r / 12 >= 1 ? "pm" : "am", t) {
1946
+ case "b":
1947
+ case "bb": return n.dayPeriod(i, {
1948
+ width: "abbreviated",
1949
+ context: "formatting"
1950
+ });
1951
+ case "bbb": return n.dayPeriod(i, {
1952
+ width: "abbreviated",
1953
+ context: "formatting"
1954
+ }).toLowerCase();
1955
+ case "bbbbb": return n.dayPeriod(i, {
1956
+ width: "narrow",
1957
+ context: "formatting"
1958
+ });
1959
+ default: return n.dayPeriod(i, {
1960
+ width: "wide",
1961
+ context: "formatting"
1962
+ });
1963
+ }
1964
+ },
1965
+ B: function(e, t, n) {
1966
+ let r = e.getHours(), i;
1967
+ switch (i = r >= 17 ? P.evening : r >= 12 ? P.afternoon : r >= 4 ? P.morning : P.night, t) {
1968
+ case "B":
1969
+ case "BB":
1970
+ case "BBB": return n.dayPeriod(i, {
1971
+ width: "abbreviated",
1972
+ context: "formatting"
1973
+ });
1974
+ case "BBBBB": return n.dayPeriod(i, {
1975
+ width: "narrow",
1976
+ context: "formatting"
1977
+ });
1978
+ default: return n.dayPeriod(i, {
1979
+ width: "wide",
1980
+ context: "formatting"
1981
+ });
1982
+ }
1983
+ },
1984
+ h: function(e, t, n) {
1985
+ if (t === "ho") {
1986
+ let t = e.getHours() % 12;
1987
+ return t === 0 && (t = 12), n.ordinalNumber(t, { unit: "hour" });
1988
+ }
1989
+ return N.h(e, t);
1990
+ },
1991
+ H: function(e, t, n) {
1992
+ return t === "Ho" ? n.ordinalNumber(e.getHours(), { unit: "hour" }) : N.H(e, t);
1993
+ },
1994
+ K: function(e, t, n) {
1995
+ let r = e.getHours() % 12;
1996
+ return t === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) : M(r, t.length);
1997
+ },
1998
+ k: function(e, t, n) {
1999
+ let r = e.getHours();
2000
+ return r === 0 && (r = 24), t === "ko" ? n.ordinalNumber(r, { unit: "hour" }) : M(r, t.length);
2001
+ },
2002
+ m: function(e, t, n) {
2003
+ return t === "mo" ? n.ordinalNumber(e.getMinutes(), { unit: "minute" }) : N.m(e, t);
2004
+ },
2005
+ s: function(e, t, n) {
2006
+ return t === "so" ? n.ordinalNumber(e.getSeconds(), { unit: "second" }) : N.s(e, t);
2007
+ },
2008
+ S: function(e, t) {
2009
+ return N.S(e, t);
2010
+ },
2011
+ X: function(e, t, n) {
2012
+ let r = e.getTimezoneOffset();
2013
+ if (r === 0) return "Z";
2014
+ switch (t) {
2015
+ case "X": return Tt(r);
2016
+ case "XXXX":
2017
+ case "XX": return F(r);
2018
+ default: return F(r, ":");
2019
+ }
2020
+ },
2021
+ x: function(e, t, n) {
2022
+ let r = e.getTimezoneOffset();
2023
+ switch (t) {
2024
+ case "x": return Tt(r);
2025
+ case "xxxx":
2026
+ case "xx": return F(r);
2027
+ default: return F(r, ":");
2028
+ }
2029
+ },
2030
+ O: function(e, t, n) {
2031
+ let r = e.getTimezoneOffset();
2032
+ switch (t) {
2033
+ case "O":
2034
+ case "OO":
2035
+ case "OOO": return "GMT" + wt(r, ":");
2036
+ default: return "GMT" + F(r, ":");
2037
+ }
2038
+ },
2039
+ z: function(e, t, n) {
2040
+ let r = e.getTimezoneOffset();
2041
+ switch (t) {
2042
+ case "z":
2043
+ case "zz":
2044
+ case "zzz": return "GMT" + wt(r, ":");
2045
+ default: return "GMT" + F(r, ":");
2046
+ }
2047
+ },
2048
+ t: function(e, t, n) {
2049
+ return M(Math.trunc(e / 1e3), t.length);
2050
+ },
2051
+ T: function(e, t, n) {
2052
+ return M(+e, t.length);
2053
+ }
2054
+ };
2055
+ function wt(e, t = "") {
2056
+ let n = e > 0 ? "-" : "+", r = Math.abs(e), i = Math.trunc(r / 60), a = r % 60;
2057
+ return a === 0 ? n + String(i) : n + String(i) + t + M(a, 2);
2058
+ }
2059
+ function Tt(e, t) {
2060
+ return e % 60 == 0 ? (e > 0 ? "-" : "+") + M(Math.abs(e) / 60, 2) : F(e, t);
2061
+ }
2062
+ function F(e, t = "") {
2063
+ let n = e > 0 ? "-" : "+", r = Math.abs(e), i = M(Math.trunc(r / 60), 2), a = M(r % 60, 2);
2064
+ return n + i + t + a;
2065
+ }
2066
+ //#endregion
2067
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/_lib/format/longFormatters.js
2068
+ var Et = (e, t) => {
2069
+ switch (e) {
2070
+ case "P": return t.date({ width: "short" });
2071
+ case "PP": return t.date({ width: "medium" });
2072
+ case "PPP": return t.date({ width: "long" });
2073
+ default: return t.date({ width: "full" });
2074
+ }
2075
+ }, Dt = (e, t) => {
2076
+ switch (e) {
2077
+ case "p": return t.time({ width: "short" });
2078
+ case "pp": return t.time({ width: "medium" });
2079
+ case "ppp": return t.time({ width: "long" });
2080
+ default: return t.time({ width: "full" });
2081
+ }
2082
+ }, Ot = {
2083
+ p: Dt,
2084
+ P: (e, t) => {
2085
+ let n = e.match(/(P+)(p+)?/) || [], r = n[1], i = n[2];
2086
+ if (!i) return Et(e, t);
2087
+ let a;
2088
+ switch (r) {
2089
+ case "P":
2090
+ a = t.dateTime({ width: "short" });
2091
+ break;
2092
+ case "PP":
2093
+ a = t.dateTime({ width: "medium" });
2094
+ break;
2095
+ case "PPP":
2096
+ a = t.dateTime({ width: "long" });
2097
+ break;
2098
+ default:
2099
+ a = t.dateTime({ width: "full" });
2100
+ break;
2101
+ }
2102
+ return a.replace("{{date}}", Et(r, t)).replace("{{time}}", Dt(i, t));
2103
+ }
2104
+ }, kt = /^D+$/, At = /^Y+$/, jt = [
2105
+ "D",
2106
+ "DD",
2107
+ "YY",
2108
+ "YYYY"
2109
+ ];
2110
+ function Mt(e) {
2111
+ return kt.test(e);
2112
+ }
2113
+ function Nt(e) {
2114
+ return At.test(e);
2115
+ }
2116
+ function Pt(e, t, n) {
2117
+ let r = Ft(e, t, n);
2118
+ if (console.warn(r), jt.includes(e)) throw RangeError(r);
2119
+ }
2120
+ function Ft(e, t, n) {
2121
+ let r = e[0] === "Y" ? "years" : "days of the month";
2122
+ return `Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
2123
+ }
2124
+ //#endregion
2125
+ //#region ../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/format.js
2126
+ var It = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Lt = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Rt = /^'([^]*?)'?$/, zt = /''/g, Bt = /[a-zA-Z]/;
2127
+ function Vt(e, t, n) {
2128
+ let r = T(), i = n?.locale ?? r.locale ?? j, a = n?.firstWeekContainsDate ?? n?.locale?.options?.firstWeekContainsDate ?? r.firstWeekContainsDate ?? r.locale?.options?.firstWeekContainsDate ?? 1, o = n?.weekStartsOn ?? n?.locale?.options?.weekStartsOn ?? r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, s = w(e, n?.in);
2129
+ if (!st(s)) throw RangeError("Invalid time value");
2130
+ let c = t.match(Lt).map((e) => {
2131
+ let t = e[0];
2132
+ if (t === "p" || t === "P") {
2133
+ let n = Ot[t];
2134
+ return n(e, i.formatLong);
2135
+ }
2136
+ return e;
2137
+ }).join("").match(It).map((e) => {
2138
+ if (e === "''") return {
2139
+ isToken: !1,
2140
+ value: "'"
2141
+ };
2142
+ let t = e[0];
2143
+ if (t === "'") return {
2144
+ isToken: !1,
2145
+ value: Ht(e)
2146
+ };
2147
+ if (Ct[t]) return {
2148
+ isToken: !0,
2149
+ value: e
2150
+ };
2151
+ if (t.match(Bt)) throw RangeError("Format string contains an unescaped latin alphabet character `" + t + "`");
2152
+ return {
2153
+ isToken: !1,
2154
+ value: e
2155
+ };
2156
+ });
2157
+ i.localize.preprocessor && (c = i.localize.preprocessor(s, c));
2158
+ let l = {
2159
+ firstWeekContainsDate: a,
2160
+ weekStartsOn: o,
2161
+ locale: i
2162
+ };
2163
+ return c.map((r) => {
2164
+ if (!r.isToken) return r.value;
2165
+ let a = r.value;
2166
+ (!n?.useAdditionalWeekYearTokens && Nt(a) || !n?.useAdditionalDayOfYearTokens && Mt(a)) && Pt(a, t, String(e));
2167
+ let o = Ct[a[0]];
2168
+ return o(s, a, i.localize, l);
2169
+ }).join("");
2170
+ }
2171
+ function Ht(e) {
2172
+ let t = e.match(Rt);
2173
+ return t ? t[1].replace(zt, "'") : e;
2174
+ }
2175
+ //#endregion
2176
+ //#region ../survey-core/build/index.mjs
2177
+ var Ut = class e {
2178
+ itemId;
2179
+ meta;
2180
+ response;
2181
+ itemType;
2182
+ constructor(e, t) {
2183
+ this.itemId = e.itemId, this.response = t, this.itemType = e.itemType;
2184
+ }
2185
+ serialize() {
2186
+ return {
2187
+ itemId: this.itemId,
2188
+ itemType: this.itemType,
2189
+ meta: this.meta,
2190
+ response: this.response?.serialize()
2191
+ };
2192
+ }
2193
+ static deserialize(t) {
2194
+ if (!t || typeof t != "object" || Array.isArray(t)) throw Error("Invalid survey item response payload");
2195
+ if (typeof t.itemId != "string" || t.itemId.trim().length === 0) throw Error("Survey item response is missing a valid itemId");
2196
+ if (typeof t.itemType != "string" || t.itemType.trim().length === 0) throw Error("Survey item response is missing a valid itemType");
2197
+ let n = new e({
2198
+ itemId: t.itemId,
2199
+ itemType: t.itemType
2200
+ }, t.response ? Wt.deserialize(t.response) : void 0);
2201
+ return n.meta = t.meta, n;
2202
+ }
2203
+ }, Wt = class e {
2204
+ _slots;
2205
+ constructor(e) {
2206
+ this._slots = new Map(e ?? []);
2207
+ }
2208
+ get(e) {
2209
+ return this._slots.get(e);
2210
+ }
2211
+ setSlotValue(e, t) {
2212
+ t ? this._slots.set(e, t) : this._slots.delete(e);
2213
+ }
2214
+ serialize() {
2215
+ if (this._slots.size !== 0) return { slots: Object.fromEntries(this._slots.entries()) };
2216
+ }
2217
+ isEmpty() {
2218
+ return this._slots.size === 0;
2219
+ }
2220
+ clone() {
2221
+ return new e(Array.from(this._slots.entries()));
2222
+ }
2223
+ static deserialize(t) {
2224
+ if (!t || typeof t != "object" || Array.isArray(t)) throw Error("Invalid response item payload");
2225
+ let { slots: n } = t;
2226
+ if (!n || typeof n != "object" || Array.isArray(n)) throw Error("Invalid response slots payload");
2227
+ return new e(Object.entries(n).map(([e, t]) => {
2228
+ if (e.trim().length === 0) throw Error("Response slot id cannot be empty");
2229
+ return _e(t, `response.slots.${e}`), [e, t];
2230
+ }));
2231
+ }
2232
+ }, I = {
2233
+ openSurvey: "openSurvey",
2234
+ pageChanged: "pageChanged",
2235
+ responeChanged: "responeChanged",
2236
+ languageChanged: "languageChanged"
2237
+ }, Gt = class {
2238
+ context;
2239
+ constructor(e) {
2240
+ this.context = e;
2241
+ }
2242
+ eval(e) {
2243
+ if (e !== void 0) switch (e.type) {
2244
+ case d.Const: return this.evaluateConst(e);
2245
+ case d.Function: return this.evaluateFunction(e);
2246
+ case d.ResponseVariable: return this.evaluateResponseVariable(e);
2247
+ case d.ContextVariable: return this.evaluateContextVariable(e);
2248
+ default: throw Error(`Unsupported expression type: ${e.type}`);
2249
+ }
2250
+ }
2251
+ setContext(e) {
2252
+ this.context = e;
2253
+ }
2254
+ evaluateConst(e) {
2255
+ return e.value;
2256
+ }
2257
+ evaluateResponseVariable(e) {
2258
+ let t = e.responseVariableRef;
2259
+ switch (t.name) {
2260
+ case "get": return this.context?.responses[t.itemId]?.response?.get(t.slotId);
2261
+ case "isDefined": return {
2262
+ type: m.boolean,
2263
+ value: this.context?.responses[t.itemId]?.response?.get(t.slotId) !== void 0
2264
+ };
2265
+ default: throw Error(`Unsupported value reference method: ${t.name}`);
2266
+ }
2267
+ }
2268
+ evaluateFunction(e) {
2269
+ switch (e.functionName) {
2270
+ case "and": return this.evaluateAnd(e);
2271
+ case "or": return this.evaluateOr(e);
2272
+ case "not": return this.evaluateNot(e);
2273
+ case "str_eq": return this.evaluateStrEq(e);
2274
+ case "eq": return this.evaluateEq(e);
2275
+ case "gt": return this.evaluateGt(e);
2276
+ case "gte": return this.evaluateGte(e);
2277
+ case "lt": return this.evaluateLt(e);
2278
+ case "lte": return this.evaluateLte(e);
2279
+ case "in_range": return this.evaluateInRange(e);
2280
+ case "sum": return this.evaluateSum(e);
2281
+ case "min": return this.evaluateMin(e);
2282
+ case "max": return this.evaluateMax(e);
2283
+ case "list_contains": return this.evaluateListContains(e);
2284
+ default: throw Error(`Unsupported function: ${e.functionName}`);
2285
+ }
2286
+ }
2287
+ evaluateContextVariable(e) {
2288
+ if (!this.context?.surveyContext) return;
2289
+ let t = this.context.surveyContext;
2290
+ switch (e.contextType) {
2291
+ case f.Locale: return {
2292
+ type: m.string,
2293
+ value: t.locale
2294
+ };
2295
+ case f.ParticipantFlag: {
2296
+ if (!e.key) return;
2297
+ let n = this.eval(e.key);
2298
+ if (n?.type !== m.string || n.value === void 0) return;
2299
+ let r = t.participantFlags?.[n.value];
2300
+ switch (e.asType) {
2301
+ case m.boolean: return {
2302
+ type: m.boolean,
2303
+ value: r !== void 0
2304
+ };
2305
+ case m.string: return r === void 0 ? void 0 : {
2306
+ type: m.string,
2307
+ value: r
2308
+ };
2309
+ case m.number: {
2310
+ if (r === void 0) return;
2311
+ let e = parseFloat(r);
2312
+ return isNaN(e) ? void 0 : {
2313
+ type: m.number,
2314
+ value: e
2315
+ };
2316
+ }
2317
+ case m.date: {
2318
+ if (r === void 0) return;
2319
+ let e = parseFloat(r);
2320
+ return isNaN(e) ? void 0 : {
2321
+ type: m.date,
2322
+ value: e
2323
+ };
2324
+ }
2325
+ default: return r === void 0 ? void 0 : {
2326
+ type: m.string,
2327
+ value: r
2328
+ };
2329
+ }
2330
+ }
2331
+ case f.CustomValue: {
2332
+ if (!e.key) return;
2333
+ let n = this.eval(e.key);
2334
+ if (n?.type !== m.string || n.value === void 0) return;
2335
+ let r = t.customValues?.[n.value];
2336
+ if (r === void 0) return;
2337
+ if (e.asType !== void 0 && r?.type !== e.asType) throw Error(`Custom value type does not match expected type, got ${r?.type} and expected ${e.asType}`);
2338
+ return r;
2339
+ }
2340
+ case f.CustomExpression: {
2341
+ if (!e.key) return;
2342
+ let n = this.eval(e.key);
2343
+ if (n?.type !== m.string || n.value === void 0) return;
2344
+ let r = t.customExpressions?.[n.value];
2345
+ if (typeof r !== d.Function || r === void 0) return;
2346
+ try {
2347
+ let t = e.arguments, n = r(t);
2348
+ if (e.asType !== void 0 && n?.type !== e.asType) throw Error(`Custom expression result type does not match expected type, got ${n?.type} and expected ${e.asType}`);
2349
+ return n;
2350
+ } catch (e) {
2351
+ throw Error(`Error evaluating custom expression: ${e}`);
2352
+ }
2353
+ }
2354
+ }
2355
+ }
2356
+ evaluateAnd(e) {
2357
+ return {
2358
+ type: m.boolean,
2359
+ value: e.arguments.every((e) => this.eval(e)?.value === !0)
2360
+ };
2361
+ }
2362
+ evaluateOr(e) {
2363
+ return {
2364
+ type: m.boolean,
2365
+ value: e.arguments.some((e) => this.eval(e)?.value === !0)
2366
+ };
2367
+ }
2368
+ evaluateNot(e) {
2369
+ if (e.arguments.length !== 1 || e.arguments[0] === void 0) throw Error(`Not function expects 1 argument, got ${e.arguments.length}`);
2370
+ let t = this.eval(e.arguments[0]);
2371
+ if (t?.type !== m.boolean) throw Error(`Not function expects a boolean argument, got ${t?.type}`);
2372
+ return t === void 0 ? {
2373
+ type: m.boolean,
2374
+ value: !1
2375
+ } : {
2376
+ type: m.boolean,
2377
+ value: !t.value
2378
+ };
2379
+ }
2380
+ evaluateListContains(e) {
2381
+ if (e.arguments.length !== 2) throw Error(`List contains function expects 2 arguments, got ${e.arguments.length}`);
2382
+ let t = this.eval(e.arguments[0]), n = this.eval(e.arguments[1]);
2383
+ if (t === void 0 || n === void 0) return {
2384
+ type: m.boolean,
2385
+ value: !1
2386
+ };
2387
+ let r = [m.stringArray, m.referenceArray], i = [m.string, m.reference], a = t.type, o = n.type;
2388
+ if (!r.includes(a) || !i.includes(o)) throw Error(`List contains function expects a string array list and a string item, got ${t?.type} and ${n?.type}`);
2389
+ let s = t.value, c = n.value;
2390
+ return {
2391
+ type: m.boolean,
2392
+ value: s.includes(c)
2393
+ };
2394
+ }
2395
+ evaluateStrEq(e) {
2396
+ if (e.arguments.length !== 2) throw Error(`String equals function expects 2 arguments, got ${e.arguments.length}`);
2397
+ let t = this.eval(e.arguments[0]), n = this.eval(e.arguments[1]);
2398
+ if (t === void 0 || n === void 0) return {
2399
+ type: m.boolean,
2400
+ value: !1
2401
+ };
2402
+ if (t?.type !== m.string || n?.type !== m.string) throw Error(`String equals function expects strings for all arguments, got ${t?.type} and ${n?.type}`);
2403
+ return {
2404
+ type: m.boolean,
2405
+ value: t.value === n.value
2406
+ };
2407
+ }
2408
+ evaluateEq(e) {
2409
+ if (e.arguments.length !== 2) throw Error(`Equals function expects 2 arguments, got ${e.arguments.length}`);
2410
+ let t = this.eval(e.arguments[0]), n = this.eval(e.arguments[1]);
2411
+ if (t === void 0 || n === void 0) return {
2412
+ type: m.boolean,
2413
+ value: !1
2414
+ };
2415
+ if (t?.type !== n?.type) throw Error(`Equals function expects the same type for all arguments, got ${t?.type} and ${n?.type}`);
2416
+ return {
2417
+ type: m.boolean,
2418
+ value: t.value === n.value
2419
+ };
2420
+ }
2421
+ evaluateGt(e) {
2422
+ if (e.arguments.length !== 2) throw Error(`Greater than function expects 2 arguments, got ${e.arguments.length}`);
2423
+ let t = this.eval(e.arguments[0]), n = this.eval(e.arguments[1]);
2424
+ if (t === void 0 || n === void 0) return {
2425
+ type: m.boolean,
2426
+ value: !1
2427
+ };
2428
+ if (t?.type !== n?.type) throw Error(`Greater than function expects the same type for all arguments, got ${t?.type} and ${n?.type}`);
2429
+ return {
2430
+ type: m.boolean,
2431
+ value: t.value > n.value
2432
+ };
2433
+ }
2434
+ evaluateGte(e) {
2435
+ if (e.arguments.length !== 2) throw Error(`Greater than or equal to function expects 2 arguments, got ${e.arguments.length}`);
2436
+ let t = this.eval(e.arguments[0]), n = this.eval(e.arguments[1]);
2437
+ if (t === void 0 || n === void 0) return {
2438
+ type: m.boolean,
2439
+ value: !1
2440
+ };
2441
+ if (t?.type !== n?.type) throw Error(`Greater than or equal to function expects the same type for all arguments, got ${t?.type} and ${n?.type}`);
2442
+ return {
2443
+ type: m.boolean,
2444
+ value: t.value >= n.value
2445
+ };
2446
+ }
2447
+ evaluateLt(e) {
2448
+ if (e.arguments.length !== 2) throw Error(`Less than function expects 2 arguments, got ${e.arguments.length}`);
2449
+ let t = this.eval(e.arguments[0]), n = this.eval(e.arguments[1]);
2450
+ if (t === void 0 || n === void 0) return {
2451
+ type: m.boolean,
2452
+ value: !1
2453
+ };
2454
+ if (t?.type !== n?.type) throw Error(`Less than function expects the same type for all arguments, got ${t?.type} and ${n?.type}`);
2455
+ return {
2456
+ type: m.boolean,
2457
+ value: t.value < n.value
2458
+ };
2459
+ }
2460
+ evaluateLte(e) {
2461
+ if (e.arguments.length !== 2) throw Error(`Less than or equal to function expects 2 arguments, got ${e.arguments.length}`);
2462
+ let t = this.eval(e.arguments[0]), n = this.eval(e.arguments[1]);
2463
+ if (t === void 0 || n === void 0) return {
2464
+ type: m.boolean,
2465
+ value: !1
2466
+ };
2467
+ if (t?.type !== n?.type) throw Error(`Less than or equal to function expects the same type for all arguments, got ${t?.type} and ${n?.type}`);
2468
+ return {
2469
+ type: m.boolean,
2470
+ value: t.value <= n.value
2471
+ };
2472
+ }
2473
+ evaluateInRange(e) {
2474
+ if (e.arguments.length !== 4) throw Error(`In range function expects 4 arguments, got ${e.arguments.length}`);
2475
+ let t = this.eval(e.arguments[0]), n = this.eval(e.arguments[1]), r = this.eval(e.arguments[2]), i = this.eval(e.arguments[3])?.value === !0;
2476
+ if (t === void 0 || n === void 0 || r === void 0) return {
2477
+ type: m.boolean,
2478
+ value: !1
2479
+ };
2480
+ if (t?.type !== m.number || n?.type !== m.number || r?.type !== m.number) throw Error(`In range function expects numbers for all arguments, got ${t?.type} and ${n?.type} and ${r?.type}`);
2481
+ return i ? {
2482
+ type: m.boolean,
2483
+ value: t.value >= n.value && t.value <= r.value
2484
+ } : {
2485
+ type: m.boolean,
2486
+ value: t.value > n.value && t.value < r.value
2487
+ };
2488
+ }
2489
+ evaluateSum(e) {
2490
+ if (e.arguments.length < 1) throw Error(`Sum function expects at least 1 argument, got ${e.arguments.length}`);
2491
+ return e.arguments.reduce((e, t) => {
2492
+ if (t === void 0) return e;
2493
+ let n = this.eval(t);
2494
+ if (n === void 0) return e;
2495
+ if (n?.type === m.number) return {
2496
+ type: m.number,
2497
+ value: e.value + n.value
2498
+ };
2499
+ throw Error(`Sum function expects all arguments to be numbers, got ${n?.type}`);
2500
+ }, {
2501
+ type: m.number,
2502
+ value: 0
2503
+ });
2504
+ }
2505
+ evaluateMin(e) {
2506
+ if (e.arguments.length < 1) throw Error(`Min function expects at least 1 argument, got ${e.arguments.length}`);
2507
+ return e.arguments.reduce((e, t) => {
2508
+ if (t === void 0) return e;
2509
+ let n = this.eval(t);
2510
+ if (n === void 0) return e;
2511
+ if (n?.type === m.number) return {
2512
+ type: m.number,
2513
+ value: Math.min(e.value, n.value)
2514
+ };
2515
+ throw Error(`Min function expects all arguments to be numbers, got ${typeof n}`);
2516
+ }, {
2517
+ type: m.number,
2518
+ value: Infinity
2519
+ });
2520
+ }
2521
+ evaluateMax(e) {
2522
+ if (e.arguments.length < 1) throw Error(`Max function expects at least 1 argument, got ${e.arguments.length}`);
2523
+ return e.arguments.reduce((e, t) => {
2524
+ if (t === void 0) return e;
2525
+ let n = this.eval(t);
2526
+ if (n === void 0) return e;
2527
+ if (n?.type === m.number) return {
2528
+ type: m.number,
2529
+ value: Math.max(e.value, n.value)
2530
+ };
2531
+ throw Error(`Max function expects all arguments to be numbers, got ${typeof n}`);
2532
+ }, {
2533
+ type: m.number,
2534
+ value: -Infinity
2535
+ });
2536
+ }
2537
+ }, Kt = class {
2538
+ surveyDef;
2539
+ renderedSurveyTree;
2540
+ context;
2541
+ locale;
2542
+ sessionSeedValue;
2543
+ responses;
2544
+ prefills;
2545
+ _events;
2546
+ _openedAt;
2547
+ dateLocales;
2548
+ prefillEnvironment;
2549
+ cache;
2550
+ constructor(e, t, n, r, i) {
2551
+ if (this._openedAt = this._getTimestamp(), this.sessionSeedValue = o(), this.surveyDef = e, this.context = t || { locale: "en" }, this.locale = this.context.locale, this.prefills = n ? n.reduce((e, t) => (e[t.itemId] = Ut.deserialize(t), e), {}) : void 0, this.prefillEnvironment = i?.prefillEnvironment, this.dateLocales = r || [{
2552
+ code: "en",
2553
+ locale: j
2554
+ }], this.responses = this.initResponseObject(this.surveyDef.surveyItems), this.initCache(), this.applyConfiguredPrefills(), this.evalExpressions(), !e.rootItem) throw Error("constructor: root item not found");
2555
+ this.renderedSurveyTree = this.renderGroup(e.rootItem), this._events = [{
2556
+ type: I.openSurvey,
2557
+ timestamp: this._getTimestamp(),
2558
+ value: this.context.locale
2559
+ }];
2560
+ }
2561
+ setContext(e) {
2562
+ this.context = e;
2563
+ }
2564
+ getDateLocales() {
2565
+ return this.dateLocales.slice();
2566
+ }
2567
+ getCurrentDateLocale() {
2568
+ let e = this.dateLocales.find((e) => e.code === this.locale);
2569
+ return e ? e?.locale : (console.warn(`Locale '${this.locale}' is not available. Using default locale.`), this.dateLocales.length > 0 ? this.dateLocales[0].locale : j);
2570
+ }
2571
+ updateContext(e) {
2572
+ this.context = e, this.locale = e.locale, this._registerSurveyEvent({
2573
+ type: I.languageChanged,
2574
+ timestamp: this._getTimestamp(),
2575
+ value: e.locale
2576
+ }), this.evalExpressions(), this.reRenderSurveyTree();
2577
+ }
2578
+ setResponse(e, t) {
2579
+ let n = this.getResponseItem(e);
2580
+ if (!n) throw Error("setResponse: target not found for key: " + e);
2581
+ n.response = t, this._registerSurveyEvent({
2582
+ type: I.responeChanged,
2583
+ timestamp: this._getTimestamp(),
2584
+ itemId: e
2585
+ }), this.evalExpressions(), this.reRenderSurveyTree();
2586
+ }
2587
+ get openedAt() {
2588
+ return this._openedAt;
2589
+ }
2590
+ get sessionSeed() {
2591
+ return this.sessionSeedValue;
2592
+ }
2593
+ get survey() {
2594
+ return this.surveyDef;
2595
+ }
2596
+ getSurveyPages(e) {
2597
+ let t = L(this.renderedSurveyTree), n = [];
2598
+ e ||= "large";
2599
+ let r = [];
2600
+ return t.forEach((t) => {
2601
+ if (t.type === "page-break") {
2602
+ r.length > 0 && (n.push([...r]), r = []);
2603
+ return;
2604
+ }
2605
+ if (r.push(t), !this.surveyDef.maxItemsPerPage) return;
2606
+ let i = 0;
2607
+ switch (e) {
2608
+ case "large":
2609
+ i = this.surveyDef.maxItemsPerPage.large;
2610
+ break;
2611
+ case "small":
2612
+ i = this.surveyDef.maxItemsPerPage.small;
2613
+ break;
2614
+ }
2615
+ r.length >= i && (n.push([...r]), r = []);
2616
+ }), r.length > 0 && n.push([...r]), n;
2617
+ }
2618
+ getRenderedSurveyItem(e) {
2619
+ return L(this.renderedSurveyTree).find((t) => t.id === e);
2620
+ }
2621
+ onPageChanged(e) {
2622
+ this._registerSurveyEvent({
2623
+ type: I.pageChanged,
2624
+ timestamp: this._getTimestamp(),
2625
+ value: e
2626
+ });
2627
+ }
2628
+ getEvents() {
2629
+ return this._events.slice();
2630
+ }
2631
+ getResponses() {
2632
+ let e = /* @__PURE__ */ new Map();
2633
+ L(this.renderedSurveyTree).filter((e) => e.type !== "page-break").forEach((t, n) => {
2634
+ this.responses[t.id] && e.set(t.id, n);
2635
+ });
2636
+ let t = [];
2637
+ return this.surveyDef.surveyItems.forEach((n, r) => {
2638
+ if (!n.isInteractive()) return;
2639
+ let i = this.getResponseItem(r);
2640
+ if (!i) return;
2641
+ let a = e.get(r);
2642
+ i.meta = a === void 0 ? void 0 : { position: a }, t.push(i);
2643
+ }), t;
2644
+ }
2645
+ getDisplayConditionValue(e, t) {
2646
+ return t ? this.cache.displayConditions[e]?.components?.[t]?.result : this.cache.displayConditions[e]?.root?.result;
2647
+ }
2648
+ getDisabledConditionValue(e, t) {
2649
+ return this.cache.disabledConditions[e]?.components?.[t]?.result;
2650
+ }
2651
+ getTemplateValue(e) {
2652
+ return this.cache.templateValues[e]?.value;
2653
+ }
2654
+ getValidationValues(e) {
2655
+ let t = this.cache.validations[e];
2656
+ if (t) return Object.keys(t).reduce((e, n) => (e[n] = t[n].result, e), {});
2657
+ }
2658
+ initCache() {
2659
+ this.cache = {
2660
+ validations: {},
2661
+ displayConditions: {},
2662
+ templateValues: {},
2663
+ disabledConditions: {}
2664
+ }, this.surveyDef.getTemplateValueKeys().forEach((e) => {
2665
+ this.cache.templateValues[e] = {
2666
+ value: void 0,
2667
+ templateDef: this.surveyDef.getTemplateValue(e)
2668
+ };
2669
+ }), this.surveyDef.surveyItems.forEach((e, t) => {
2670
+ e.validations && Object.keys(e.validations).length > 0 && (this.cache.validations[t] = {}, Object.keys(e.validations).forEach((n) => {
2671
+ let r = e.validations[n];
2672
+ if (!r) {
2673
+ console.warn("initCache: validation expression not found: " + t + " " + n);
2674
+ return;
2675
+ }
2676
+ this.cache.validations[t][n] = {
2677
+ expression: r,
2678
+ result: !1
2679
+ };
2680
+ })), e.displayConditions !== void 0 && (e.displayConditions.root || e.displayConditions.components) && (this.cache.displayConditions[t] = {}, e.displayConditions.root && (this.cache.displayConditions[t].root = {
2681
+ expression: e.displayConditions.root,
2682
+ result: !1
2683
+ }), e.displayConditions.components && (this.cache.displayConditions[t].components = {}, Object.keys(e.displayConditions.components).forEach((n) => {
2684
+ let r = e.displayConditions?.components?.[n];
2685
+ if (!r) {
2686
+ console.warn("initCache: display condition component expression not found: " + t + " " + n);
2687
+ return;
2688
+ }
2689
+ this.cache.displayConditions[t].components[n] = {
2690
+ expression: r,
2691
+ result: !1
2692
+ };
2693
+ }))), e.disabledConditions !== void 0 && e.disabledConditions.components !== void 0 && (this.cache.disabledConditions[t] = { components: {} }, Object.keys(e.disabledConditions.components).forEach((n) => {
2694
+ let r = e.disabledConditions?.components?.[n];
2695
+ if (!r) {
2696
+ console.warn("initCache: disabled condition component expression not found: " + t + " " + n);
2697
+ return;
2698
+ }
2699
+ this.cache.disabledConditions[t].components[n] = {
2700
+ expression: r,
2701
+ result: !1
2702
+ };
2703
+ }));
2704
+ });
2705
+ }
2706
+ initResponseObject(e) {
2707
+ let t = {};
2708
+ return e.forEach((e, n) => {
2709
+ if (e.isInteractive) {
2710
+ let r = this.prefills?.[n], i = r && r.itemType === e.type;
2711
+ t[n] = new Ut({
2712
+ itemId: n,
2713
+ itemType: e.type
2714
+ }, i ? r.response : void 0);
2715
+ } else return;
2716
+ }), t;
2717
+ }
2718
+ applyConfiguredPrefills() {
2719
+ let e = new Gt({
2720
+ responses: this.responses,
2721
+ surveyContext: this.context
2722
+ }), t = Math.max(this.surveyDef.surveyItems.size, 1);
2723
+ for (let n = 0; n < t; n++) {
2724
+ this.evalTemplateValues(e);
2725
+ let t = !1;
2726
+ if (this.surveyDef.surveyItems.forEach((n) => {
2727
+ n.isInteractive() && (t = this.applyConfiguredPrefillsForItem(n, e) || t);
2728
+ }), !t) break;
2729
+ }
2730
+ this.evalTemplateValues(e);
2731
+ }
2732
+ applyConfiguredPrefillsForItem(e, t) {
2733
+ let n = this.responses[e.id];
2734
+ if (!n) return !1;
2735
+ let r = !1;
2736
+ for (let i of e.prefills ?? []) {
2737
+ let a = e.resolvePrefillTarget(i.target);
2738
+ if (!a || (i.apply ?? be.ifEmpty) === be.ifEmpty && n.response?.get(a.slotId) !== void 0 || !this.shouldApplyConfiguredPrefill(i, t)) continue;
2739
+ let o = this.resolveConfiguredPrefillValue(i, a, t);
2740
+ if (!o) continue;
2741
+ let s = e.normalizePrefillValue(i, a, o);
2742
+ if (!s) continue;
2743
+ let c = n.response?.clone() ?? new Wt();
2744
+ c.setSlotValue(a.slotId, s), n.response = c.isEmpty() ? void 0 : c, r = !0;
2745
+ }
2746
+ return r;
2747
+ }
2748
+ shouldApplyConfiguredPrefill(e, t) {
2749
+ if (!e.when) return !0;
2750
+ let n = t.eval(e.when);
2751
+ return n?.type === m.boolean && n.value === !0;
2752
+ }
2753
+ resolveConfiguredPrefillValue(e, t, n) {
2754
+ switch (e.source.type) {
2755
+ case "static": return e.source.value;
2756
+ case "expression": return n.eval(e.source.expression);
2757
+ case "templateValue": return this.getTemplateValue(e.source.key);
2758
+ case "previousResponse": {
2759
+ if (!this.prefillEnvironment?.getPreviousResponse) return;
2760
+ let t = e.source.ref.target ?? e.target;
2761
+ return this.prefillEnvironment.getPreviousResponse({
2762
+ surveyKey: e.source.ref.surveyKey,
2763
+ itemId: e.source.ref.itemId,
2764
+ target: t
2765
+ }) || void 0;
2766
+ }
2767
+ default: return;
2768
+ }
2769
+ }
2770
+ shouldRender(e, t) {
2771
+ let n = this.getDisplayConditionValue(e, t);
2772
+ return n === void 0 ? !0 : n;
2773
+ }
2774
+ sequentialRender(e) {
2775
+ let t = [];
2776
+ for (let n of e.items || []) {
2777
+ if (!this.shouldRender(n)) continue;
2778
+ let e = this.surveyDef.surveyItems.get(n);
2779
+ if (!e) {
2780
+ console.warn("sequentialRender: item not found: " + n);
2781
+ continue;
2782
+ }
2783
+ if (e.type === "group") {
2784
+ t.push(this.renderGroup(e));
2785
+ continue;
2786
+ }
2787
+ t.push({
2788
+ id: n,
2789
+ type: e.type
2790
+ });
2791
+ }
2792
+ return {
2793
+ id: e.id,
2794
+ type: "group",
2795
+ items: t
2796
+ };
2797
+ }
2798
+ randomizedItemRender(e, t) {
2799
+ let n = t.items?.filter((e) => this.shouldRender(e.id)) || [], i = e.items || [], a = r(i.length);
2800
+ for (let e of a) {
2801
+ let r = i[e];
2802
+ if (t.items?.find((e) => e.id === r) || !this.shouldRender(r)) continue;
2803
+ let a = this.surveyDef.surveyItems.get(r);
2804
+ if (!a) {
2805
+ console.warn("randomizedItemRender: item not found: " + r);
2806
+ continue;
2807
+ }
2808
+ if (a.type === "group") {
2809
+ n.push(this.renderGroup(a, t));
2810
+ continue;
2811
+ }
2812
+ n.push({
2813
+ id: r,
2814
+ type: a.type
2815
+ });
2816
+ }
2817
+ return {
2818
+ id: e.id,
2819
+ type: "group",
2820
+ items: n
2821
+ };
2822
+ }
2823
+ renderGroup(e, t) {
2824
+ return t ||= {
2825
+ id: e.id,
2826
+ type: "group",
2827
+ items: []
2828
+ }, e.config.shuffleItems ? this.randomizedItemRender(e, t) : this.sequentialRender(e);
2829
+ }
2830
+ reRenderSurveyTree() {
2831
+ if (!this.surveyDef.rootItem) throw Error("reRenderSurveyTree: root item not found");
2832
+ this.renderedSurveyTree = this.renderGroup(this.surveyDef.rootItem);
2833
+ }
2834
+ _registerSurveyEvent(e) {
2835
+ this._events.push(e);
2836
+ }
2837
+ _getTimestamp() {
2838
+ return Math.floor(Date.now() / 1e3);
2839
+ }
2840
+ getResponseItem(e) {
2841
+ return this.responses[e];
2842
+ }
2843
+ evalExpressions() {
2844
+ let e = new Gt({
2845
+ responses: this.responses,
2846
+ surveyContext: this.context
2847
+ });
2848
+ this.evalTemplateValues(e), this.evalDisplayConditions(e), this.evalDisableConditions(e), this.evalValidations(e);
2849
+ }
2850
+ evalTemplateValues(e) {
2851
+ Object.keys(this.cache.templateValues).forEach((t) => {
2852
+ let n = this.cache.templateValues[t];
2853
+ if (this.cache.templateValues[t].value = void 0, !n.templateDef?.expression) {
2854
+ console.warn("evalTemplateValues: template value expression not found: " + t);
2855
+ return;
2856
+ }
2857
+ let r = e.eval(n.templateDef.expression);
2858
+ if (r === void 0) {
2859
+ console.warn("evalTemplateValues: template value expression returned undefined: " + t);
2860
+ return;
2861
+ }
2862
+ switch (n.templateDef.type) {
2863
+ case "date2string":
2864
+ if (r.type !== m.date) {
2865
+ console.warn("evalTemplateValues: template value expression returned non-date value: " + t);
2866
+ return;
2867
+ }
2868
+ r = {
2869
+ type: m.string,
2870
+ value: Vt(/* @__PURE__ */ new Date(r.value * 1e3), n.templateDef.dateFormat)
2871
+ };
2872
+ break;
2873
+ default: break;
2874
+ }
2875
+ this.cache.templateValues[t].value = r;
2876
+ });
2877
+ }
2878
+ evalDisplayConditions(e) {
2879
+ Object.keys(this.cache.displayConditions).forEach((t) => {
2880
+ let n = this.cache.displayConditions[t];
2881
+ if (n.root) {
2882
+ let r = e.eval(n.root.expression);
2883
+ if (r === void 0 || r.type !== m.boolean) {
2884
+ console.warn("evalDisplayConditions: display condition expression returned undefined: " + t);
2885
+ return;
2886
+ }
2887
+ this.cache.displayConditions[t].root.result = r.value;
2888
+ }
2889
+ n.components && Object.keys(n.components).forEach((r) => {
2890
+ let i = e.eval(n.components[r].expression);
2891
+ if (i === void 0 || i.type !== m.boolean) {
2892
+ console.warn("evalDisplayConditions: display condition component expression returned undefined: " + t + "." + r);
2893
+ return;
2894
+ }
2895
+ this.cache.displayConditions[t].components[r].result = i.value;
2896
+ });
2897
+ });
2898
+ }
2899
+ evalDisableConditions(e) {
2900
+ Object.keys(this.cache.disabledConditions).forEach((t) => {
2901
+ let n = this.cache.disabledConditions[t];
2902
+ n.components && Object.keys(n.components).forEach((r) => {
2903
+ let i = e.eval(n.components[r].expression);
2904
+ if (i === void 0 || i.type !== m.boolean) {
2905
+ console.warn("evalDisableConditions: disable condition component expression returned undefined: " + t + "." + r);
2906
+ return;
2907
+ }
2908
+ this.cache.disabledConditions[t].components[r].result = i.value;
2909
+ });
2910
+ });
2911
+ }
2912
+ evalValidations(e) {
2913
+ Object.keys(this.cache.validations).forEach((t) => {
2914
+ let n = this.cache.validations[t];
2915
+ Object.keys(n).forEach((r) => {
2916
+ let i = e.eval(n[r].expression);
2917
+ if (i === void 0 || i.type !== m.boolean) {
2918
+ console.warn("evalValidations: validation expression returned undefined: " + t + "." + r);
2919
+ return;
2920
+ }
2921
+ this.cache.validations[t][r].result = i.value;
2922
+ });
2923
+ });
2924
+ }
2925
+ }, L = (e) => {
2926
+ let t = [];
2927
+ return e.items?.forEach((e) => {
2928
+ e.type === "group" ? t.push(...L(e)) : t.push({ ...e });
2929
+ }), t;
2930
+ }, R = class extends Error {
2931
+ constructor(e, t, n, r) {
2932
+ super(e), this.code = t, this.path = n, this.operationIndex = r, this.name = "JsonPatchError";
2933
+ }
2934
+ }, qt = (e, t) => Object.prototype.hasOwnProperty.call(e, t), z = (e) => typeof e == "object" && !!e && !Array.isArray(e), Jt = (e, t) => {
2935
+ if (/~(?![01])/.test(e)) throw new R(`Invalid JSON pointer segment "${e}" in "${t}". Only "~0" and "~1" escapes are allowed.`, "invalid-json-pointer", t);
2936
+ }, B = (e) => {
2937
+ if (e === "") return [];
2938
+ if (!e.startsWith("/")) throw new R(`Invalid JSON pointer "${e}". It must be empty or start with "/".`, "invalid-json-pointer", e);
2939
+ return e.slice(1).split("/").map((t) => (Jt(t, e), t.replace(/~1/g, "/").replace(/~0/g, "~")));
2940
+ }, Yt = ({ segment: e, arrayLength: t, allowAppend: n, allowEnd: r, path: i }) => {
2941
+ if (e === "-") {
2942
+ if (n) return t;
2943
+ throw new R(`JSON pointer "${i}" uses "-" where an existing array index is required.`, "invalid-array-index", i);
2944
+ }
2945
+ if (!/^(0|[1-9][0-9]*)$/.test(e)) throw new R(`JSON pointer "${i}" uses invalid array index "${e}".`, "invalid-array-index", i);
2946
+ let a = Number(e), o = r ? t : t - 1;
2947
+ if (a < 0 || a > o) throw new R(`JSON pointer "${i}" array index ${a} is out of bounds.`, "array-index-out-of-bounds", i);
2948
+ return a;
2949
+ }, V = (e, t, n) => {
2950
+ let r = e;
2951
+ for (let e of t) {
2952
+ if (Array.isArray(r)) {
2953
+ let t = Yt({
2954
+ segment: e,
2955
+ arrayLength: r.length,
2956
+ allowAppend: !1,
2957
+ allowEnd: !1,
2958
+ path: n
2959
+ });
2960
+ r = r[t];
2961
+ continue;
2962
+ }
2963
+ if (!z(r) || !qt(r, e)) throw new R(`JSON pointer "${n}" does not exist.`, "path-not-found", n);
2964
+ r = r[e];
2965
+ }
2966
+ return r;
2967
+ }, Xt = (e, t) => V(e, B(t), t), Zt = (e, t) => {
2968
+ if (e === t) return !0;
2969
+ if (Array.isArray(e) || Array.isArray(t)) return !Array.isArray(e) || !Array.isArray(t) || e.length !== t.length ? !1 : e.every((e, n) => Zt(e, t[n]));
2970
+ if (z(e) || z(t)) {
2971
+ if (!z(e) || !z(t)) return !1;
2972
+ let n = Object.keys(e).sort(), r = Object.keys(t).sort();
2973
+ return n.length === r.length ? n.every((n, i) => n === r[i] && Zt(e[n], t[n])) : !1;
2974
+ }
2975
+ return !1;
2976
+ }, H = (e, t, n) => {
2977
+ let r = B(t);
2978
+ if (r.length === 0) return i(n);
2979
+ let a = r.slice(0, -1), o = r[r.length - 1], s = V(e, a, t);
2980
+ if (Array.isArray(s)) {
2981
+ let r = Yt({
2982
+ segment: o,
2983
+ arrayLength: s.length,
2984
+ allowAppend: !0,
2985
+ allowEnd: !0,
2986
+ path: t
2987
+ });
2988
+ return s.splice(r, 0, i(n)), e;
2989
+ }
2990
+ if (!z(s)) throw new R(`JSON pointer "${t}" parent is not an object or array.`, "invalid-target-parent", t);
2991
+ return s[o] = i(n), e;
2992
+ }, Qt = (e, t) => {
2993
+ let n = B(t);
2994
+ if (n.length === 0) throw new R("Removing the document root is not supported.", "remove-root", t);
2995
+ let r = n.slice(0, -1), i = n[n.length - 1], a = V(e, r, t);
2996
+ if (Array.isArray(a)) {
2997
+ let n = Yt({
2998
+ segment: i,
2999
+ arrayLength: a.length,
3000
+ allowAppend: !1,
3001
+ allowEnd: !1,
3002
+ path: t
3003
+ }), [r] = a.splice(n, 1);
3004
+ return {
3005
+ document: e,
3006
+ removedValue: r
3007
+ };
3008
+ }
3009
+ if (!z(a) || !qt(a, i)) throw new R(`JSON pointer "${t}" does not exist.`, "path-not-found", t);
3010
+ let o = a[i];
3011
+ return delete a[i], {
3012
+ document: e,
3013
+ removedValue: o
3014
+ };
3015
+ }, $t = (e, t, n) => {
3016
+ let r = B(t);
3017
+ return r.length === 0 ? i(n) : (V(e, r, t), Qt(e, t), H(e, t, n));
3018
+ }, en = (e, t) => {
3019
+ if (!(e === "" || t === e || !t.startsWith(`${e}/`))) throw new R(`JSON Patch cannot move "${e}" into its own descendant "${t}".`, "move-into-descendant", t);
3020
+ }, tn = (e, t) => {
3021
+ let n = i(e);
3022
+ return t.forEach((e, t) => {
3023
+ try {
3024
+ switch (e.op) {
3025
+ case "add":
3026
+ n = H(n, e.path, e.value);
3027
+ break;
3028
+ case "remove":
3029
+ n = Qt(n, e.path).document;
3030
+ break;
3031
+ case "replace":
3032
+ n = $t(n, e.path, e.value);
3033
+ break;
3034
+ case "move": {
3035
+ if (en(e.from, e.path), e.from === e.path) break;
3036
+ let { document: t, removedValue: r } = Qt(n, e.from);
3037
+ n = H(t, e.path, r);
3038
+ break;
3039
+ }
3040
+ case "copy": {
3041
+ let t = Xt(n, e.from);
3042
+ n = H(n, e.path, t);
3043
+ break;
3044
+ }
3045
+ case "test":
3046
+ if (!Zt(Xt(n, e.path), e.value)) throw new R(`JSON Patch test failed at "${e.path}".`, "test-failed", e.path);
3047
+ break;
3048
+ }
3049
+ } catch (e) {
3050
+ throw e instanceof R ? new R(e.message, e.code, e.path, t) : e;
3051
+ }
3052
+ }), n;
3053
+ };
3054
+ ({
3055
+ default: "default",
3056
+ mask: "mask",
3057
+ dateFormat: "dateFormat"
3058
+ }).default;
3059
+ //#endregion
3060
+ //#region src/modules/default-item-registry/items/form/model.ts
3061
+ var nn = [
3062
+ "year",
3063
+ "year-month",
3064
+ "year-month-day"
3065
+ ];
3066
+ function rn(e) {
3067
+ let t = e.validations.map((e) => ({
3068
+ ...e,
3069
+ source: "validation"
3070
+ }));
3071
+ return e.required !== !0 || t.some((e) => e.type === "required") ? t : [{
3072
+ id: `${e.id}-required`,
3073
+ type: "required",
3074
+ source: "required"
3075
+ }, ...t];
3076
+ }
3077
+ function U(e) {
3078
+ let t = Y(e);
3079
+ return t ? {
3080
+ type: Pe.plain,
3081
+ content: t
3082
+ } : void 0;
3083
+ }
3084
+ function W(e, t, n, r) {
3085
+ let i = e?.getContent(t, n, r);
3086
+ return He(i).trim() || void 0;
3087
+ }
3088
+ var an = "fields", on = "fieldGroups";
3089
+ function sn(e, t) {
3090
+ return t?.trim() ? `${t}.${e}` : e;
3091
+ }
3092
+ function cn(e, t) {
3093
+ return sn(`${on}.${e}`, t);
3094
+ }
3095
+ function ln(e, t) {
3096
+ return `${cn(e, t)}.title`;
3097
+ }
3098
+ function un(e, t) {
3099
+ return `${cn(e, t)}.description`;
3100
+ }
3101
+ function G(e, t) {
3102
+ return sn(`${an}.${e}`, t);
3103
+ }
3104
+ function dn(e, t) {
3105
+ return `${G(e, t)}.label`;
3106
+ }
3107
+ function fn(e, t) {
3108
+ return `${G(e, t)}.description`;
3109
+ }
3110
+ function pn(e, t) {
3111
+ return `${G(e, t)}.error`;
3112
+ }
3113
+ function K(e, t) {
3114
+ return `${G(e, t)}.placeholder`;
3115
+ }
3116
+ function q(e, t) {
3117
+ return `${G(e, t)}.unit`;
3118
+ }
3119
+ function mn(e, t) {
3120
+ return `${G(e, t)}.checkedLabel`;
3121
+ }
3122
+ function hn(e, t) {
3123
+ return `${G(e, t)}.uncheckedLabel`;
3124
+ }
3125
+ function gn(e, t, n) {
3126
+ return `${G(e, n)}.options.${t}.label`;
3127
+ }
3128
+ function _n(e, t, n) {
3129
+ return `${G(e, n)}.validations.${t}.message`;
3130
+ }
3131
+ function vn(e, t) {
3132
+ let n = [
3133
+ dn(e.id, t),
3134
+ fn(e.id, t),
3135
+ pn(e.id, t),
3136
+ ...e.validations.map((n) => _n(e.id, n.id, t))
3137
+ ];
3138
+ switch (e.type) {
3139
+ case "textarea":
3140
+ case "datepicker":
3141
+ case "input":
3142
+ n.push(K(e.id, t));
3143
+ break;
3144
+ case "number":
3145
+ n.push(K(e.id, t)), n.push(q(e.id, t));
3146
+ break;
3147
+ case "switch":
3148
+ n.push(mn(e.id, t)), n.push(hn(e.id, t));
3149
+ break;
3150
+ case "select": {
3151
+ n.push(K(e.id, t));
3152
+ let r = e.controller;
3153
+ n.push(...r.options.map((n) => gn(e.id, n.id, t)));
3154
+ break;
3155
+ }
3156
+ case "slider": break;
3157
+ }
3158
+ return n;
3159
+ }
3160
+ function yn(e, t) {
3161
+ return [ln(e.id, t), un(e.id, t)];
3162
+ }
3163
+ function bn(e, t, n, r) {
3164
+ e.setContent(t, ln(n.id, r), U(n.title)), e.setContent(t, un(n.id, r), U(n.description));
3165
+ }
3166
+ function xn(e, t, n, r) {
3167
+ e.setContent(t, dn(n.id, r), U(n.label)), e.setContent(t, fn(n.id, r), U(n.description)), e.setContent(t, pn(n.id, r), U(n.errorMessage));
3168
+ for (let i of n.validations) e.setContent(t, _n(n.id, i.id, r), U(i.message));
3169
+ switch (n.type) {
3170
+ case "textarea":
3171
+ case "datepicker":
3172
+ case "input": {
3173
+ let i = n.controller;
3174
+ e.setContent(t, K(n.id, r), U(i.placeholder));
3175
+ break;
3176
+ }
3177
+ case "number": {
3178
+ let i = n.controller;
3179
+ e.setContent(t, K(n.id, r), U(i.placeholder)), e.setContent(t, q(n.id, r), U(i.unit));
3180
+ break;
3181
+ }
3182
+ case "switch": {
3183
+ let i = n.controller;
3184
+ e.setContent(t, mn(n.id, r), U(i.checkedLabel)), e.setContent(t, hn(n.id, r), U(i.uncheckedLabel));
3185
+ break;
3186
+ }
3187
+ case "select": {
3188
+ let i = n.controller;
3189
+ e.setContent(t, K(n.id, r), U(i.placeholder));
3190
+ for (let a of i.options) e.setContent(t, gn(n.id, a.id, r), U(a.label));
3191
+ break;
3192
+ }
3193
+ case "slider": break;
3194
+ }
3195
+ }
3196
+ function Sn(e, t, n, r, i) {
3197
+ let a = {
3198
+ ...e,
3199
+ label: W(t, n, dn(e.id, i), r) ?? e.label,
3200
+ description: W(t, n, fn(e.id, i), r) ?? e.description,
3201
+ errorMessage: W(t, n, pn(e.id, i), r) ?? e.errorMessage,
3202
+ validations: e.validations.map((a) => ({
3203
+ ...a,
3204
+ message: W(t, n, _n(e.id, a.id, i), r) ?? a.message
3205
+ }))
3206
+ };
3207
+ switch (e.type) {
3208
+ case "textarea": {
3209
+ let o = e.controller;
3210
+ a.controller = {
3211
+ ...o,
3212
+ placeholder: W(t, n, K(e.id, i), r) ?? o.placeholder
3213
+ };
3214
+ break;
3215
+ }
3216
+ case "number": {
3217
+ let o = e.controller;
3218
+ a.controller = {
3219
+ ...o,
3220
+ placeholder: W(t, n, K(e.id, i), r) ?? o.placeholder,
3221
+ unit: W(t, n, q(e.id, i), r) ?? o.unit
3222
+ };
3223
+ break;
3224
+ }
3225
+ case "datepicker": {
3226
+ let o = e.controller;
3227
+ a.controller = {
3228
+ ...o,
3229
+ placeholder: W(t, n, K(e.id, i), r) ?? o.placeholder
3230
+ };
3231
+ break;
3232
+ }
3233
+ case "switch": {
3234
+ let o = e.controller;
3235
+ a.controller = {
3236
+ ...o,
3237
+ checkedLabel: W(t, n, mn(e.id, i), r) ?? o.checkedLabel,
3238
+ uncheckedLabel: W(t, n, hn(e.id, i), r) ?? o.uncheckedLabel
3239
+ };
3240
+ break;
3241
+ }
3242
+ case "select": {
3243
+ let o = e.controller;
3244
+ a.controller = {
3245
+ ...o,
3246
+ placeholder: W(t, n, K(e.id, i), r) ?? o.placeholder,
3247
+ options: o.options.map((a) => ({
3248
+ ...a,
3249
+ label: W(t, n, gn(e.id, a.id, i), r) ?? a.label
3250
+ }))
3251
+ };
3252
+ break;
3253
+ }
3254
+ case "slider": break;
3255
+ default: {
3256
+ let o = e.controller;
3257
+ a.controller = {
3258
+ ...o,
3259
+ placeholder: W(t, n, K(e.id, i), r) ?? o.placeholder
3260
+ };
3261
+ break;
3262
+ }
3263
+ }
3264
+ return a;
3265
+ }
3266
+ function Cn(e, t, n, r, i) {
3267
+ return {
3268
+ ...e,
3269
+ title: W(t, n, ln(e.id, i), r) ?? e.title,
3270
+ description: W(t, n, un(e.id, i), r) ?? e.description,
3271
+ fields: e.fields.map((e) => Sn(e, t, n, r, i))
3272
+ };
3273
+ }
3274
+ function wn(e, t, n, r = {}) {
3275
+ let { fallbackLocale: i, translationNamespace: a } = r;
3276
+ return {
3277
+ ...e,
3278
+ fieldGroups: e.fieldGroups.map((e) => Cn(e, t, n, i, a))
3279
+ };
3280
+ }
3281
+ function Tn(e) {
3282
+ let t = {
3283
+ ...e,
3284
+ label: void 0,
3285
+ description: void 0,
3286
+ errorMessage: void 0,
3287
+ required: void 0,
3288
+ hasValidations: void 0,
3289
+ isInvalid: void 0,
3290
+ validations: e.validations.map((e) => ({
3291
+ ...e,
3292
+ message: void 0
3293
+ }))
3294
+ };
3295
+ switch (e.type) {
3296
+ case "textarea":
3297
+ t.controller = {
3298
+ ...e.controller,
3299
+ placeholder: void 0
3300
+ };
3301
+ break;
3302
+ case "number":
3303
+ t.controller = {
3304
+ ...e.controller,
3305
+ placeholder: void 0,
3306
+ unit: void 0
3307
+ };
3308
+ break;
3309
+ case "datepicker":
3310
+ t.controller = {
3311
+ ...e.controller,
3312
+ placeholder: void 0
3313
+ };
3314
+ break;
3315
+ case "switch":
3316
+ t.controller = {
3317
+ ...e.controller,
3318
+ checkedLabel: void 0,
3319
+ uncheckedLabel: void 0
3320
+ };
3321
+ break;
3322
+ case "select": {
3323
+ let n = e.controller;
3324
+ t.controller = {
3325
+ ...n,
3326
+ placeholder: void 0,
3327
+ options: n.options.map((e) => ({
3328
+ ...e,
3329
+ label: void 0
3330
+ }))
3331
+ };
3332
+ break;
3333
+ }
3334
+ case "slider": break;
3335
+ default:
3336
+ t.controller = {
3337
+ ...e.controller,
3338
+ placeholder: void 0
3339
+ };
3340
+ break;
3341
+ }
3342
+ return t;
3343
+ }
3344
+ function En(e) {
3345
+ return {
3346
+ ...e,
3347
+ title: void 0,
3348
+ description: void 0,
3349
+ fields: e.fields.map((e) => Tn(e))
3350
+ };
3351
+ }
3352
+ function Dn(e) {
3353
+ return {
3354
+ ...e,
3355
+ fieldGroups: e.fieldGroups.map((e) => En(e))
3356
+ };
3357
+ }
3358
+ function J(e) {
3359
+ return typeof e != "number" || !Number.isFinite(e) ? 1 : Math.min(4, Math.max(1, Math.round(e)));
3360
+ }
3361
+ function On(e) {
3362
+ let t = e && typeof e == "object" ? e : {}, n = Object.prototype.hasOwnProperty.call(t, "base"), r = Object.prototype.hasOwnProperty.call(t, "xs");
3363
+ if (!n && !r && (t.sm !== void 0 || t.md !== void 0 || t.lg !== void 0)) {
3364
+ let e = J(t.sm);
3365
+ return {
3366
+ base: e,
3367
+ xs: e,
3368
+ sm: J(t.md ?? t.sm),
3369
+ md: J(t.lg ?? t.md ?? t.sm),
3370
+ xl: J(t.lg ?? t.md ?? t.sm)
3371
+ };
3372
+ }
3373
+ let i = J(t.xs ?? t.sm ?? 1), a = J(t.sm ?? 1), o = J(t.md ?? 1), s = J(t.xl ?? t.lg ?? 1);
3374
+ return {
3375
+ base: J(n ? t.base : i),
3376
+ xs: i,
3377
+ sm: a,
3378
+ md: o,
3379
+ xl: s
3380
+ };
3381
+ }
3382
+ function kn(e) {
3383
+ return {
3384
+ "--form-group-cols-base": String(e.base),
3385
+ "--form-group-cols-xs": String(e.xs),
3386
+ "--form-group-cols-sm": String(e.sm),
3387
+ "--form-group-cols-md": String(e.md),
3388
+ "--form-group-cols-xl": String(e.xl)
3389
+ };
3390
+ }
3391
+ function Y(e) {
3392
+ if (typeof e == "string") return e.trim() || void 0;
3393
+ }
3394
+ function X(e) {
3395
+ if (!(typeof e != "number" || !Number.isFinite(e))) return e;
3396
+ }
3397
+ function An(e) {
3398
+ return e === !0 ? !0 : e === !1 ? !1 : void 0;
3399
+ }
3400
+ function jn(e, t) {
3401
+ return t?.trim() || e.replace(/[^a-zA-Z0-9]/g, "").slice(0, 4).toUpperCase() || c(4);
3402
+ }
3403
+ function Z(e) {
3404
+ switch (e) {
3405
+ case "textarea": return {
3406
+ type: e,
3407
+ rows: 3
3408
+ };
3409
+ case "number": return {
3410
+ type: e,
3411
+ step: 1
3412
+ };
3413
+ case "datepicker": return {
3414
+ type: e,
3415
+ mode: "year-month-day"
3416
+ };
3417
+ case "switch": return {
3418
+ type: e,
3419
+ defaultChecked: !1
3420
+ };
3421
+ case "select": return {
3422
+ type: e,
3423
+ options: []
3424
+ };
3425
+ case "slider": return {
3426
+ type: e,
3427
+ min: 0,
3428
+ max: 100,
3429
+ step: 1,
3430
+ defaultValue: 50,
3431
+ showValue: !0
3432
+ };
3433
+ default: return {
3434
+ type: "input",
3435
+ inputMode: "text"
3436
+ };
3437
+ }
3438
+ }
3439
+ function Mn(e) {
3440
+ switch (e) {
3441
+ case "textarea": return [
3442
+ {
3443
+ type: "required",
3444
+ label: "Required",
3445
+ description: "Respondents must provide a value.",
3446
+ valueKind: "none"
3447
+ },
3448
+ {
3449
+ type: "minLength",
3450
+ label: "Minimum length",
3451
+ description: "Require a longer free-text answer.",
3452
+ valueKind: "number",
3453
+ defaultValue: 10
3454
+ },
3455
+ {
3456
+ type: "maxLength",
3457
+ label: "Maximum length",
3458
+ description: "Cap the response length.",
3459
+ valueKind: "number",
3460
+ defaultValue: 500
3461
+ }
3462
+ ];
3463
+ case "number": return [
3464
+ {
3465
+ type: "required",
3466
+ label: "Required",
3467
+ description: "Respondents must provide a value.",
3468
+ valueKind: "none"
3469
+ },
3470
+ {
3471
+ type: "min",
3472
+ label: "Minimum value",
3473
+ description: "Reject values below the threshold.",
3474
+ valueKind: "number",
3475
+ defaultValue: 0
3476
+ },
3477
+ {
3478
+ type: "max",
3479
+ label: "Maximum value",
3480
+ description: "Reject values above the threshold.",
3481
+ valueKind: "number",
3482
+ defaultValue: 100
3483
+ },
3484
+ {
3485
+ type: "integer",
3486
+ label: "Integer only",
3487
+ description: "Allow whole numbers only.",
3488
+ valueKind: "none"
3489
+ }
3490
+ ];
3491
+ case "datepicker": return [
3492
+ {
3493
+ type: "required",
3494
+ label: "Required",
3495
+ description: "Respondents must provide a value.",
3496
+ valueKind: "none"
3497
+ },
3498
+ {
3499
+ type: "minDate",
3500
+ label: "Earliest date",
3501
+ description: "Reject dates before the minimum.",
3502
+ valueKind: "date"
3503
+ },
3504
+ {
3505
+ type: "maxDate",
3506
+ label: "Latest date",
3507
+ description: "Reject dates after the maximum.",
3508
+ valueKind: "date"
3509
+ }
3510
+ ];
3511
+ case "switch": return [{
3512
+ type: "mustBeTrue",
3513
+ label: "Must be enabled",
3514
+ description: "Useful for consent or confirmation switches.",
3515
+ valueKind: "none"
3516
+ }];
3517
+ case "select": return [{
3518
+ type: "required",
3519
+ label: "Required",
3520
+ description: "Respondents must choose an option.",
3521
+ valueKind: "none"
3522
+ }];
3523
+ case "slider": return [{
3524
+ type: "min",
3525
+ label: "Minimum value",
3526
+ description: "Reject slider values below the threshold.",
3527
+ valueKind: "number",
3528
+ defaultValue: 0
3529
+ }, {
3530
+ type: "max",
3531
+ label: "Maximum value",
3532
+ description: "Reject slider values above the threshold.",
3533
+ valueKind: "number",
3534
+ defaultValue: 100
3535
+ }];
3536
+ case "input": return [
3537
+ {
3538
+ type: "required",
3539
+ label: "Required",
3540
+ description: "Respondents must provide a value.",
3541
+ valueKind: "none"
3542
+ },
3543
+ {
3544
+ type: "minLength",
3545
+ label: "Minimum length",
3546
+ description: "Require a minimum number of characters.",
3547
+ valueKind: "number",
3548
+ defaultValue: 2
3549
+ },
3550
+ {
3551
+ type: "maxLength",
3552
+ label: "Maximum length",
3553
+ description: "Limit the number of characters.",
3554
+ valueKind: "number",
3555
+ defaultValue: 120
3556
+ },
3557
+ {
3558
+ type: "pattern",
3559
+ label: "Pattern",
3560
+ description: "Validate against a regular expression.",
3561
+ valueKind: "text"
3562
+ },
3563
+ {
3564
+ type: "email",
3565
+ label: "Email format",
3566
+ description: "Require a valid email address.",
3567
+ valueKind: "none"
3568
+ },
3569
+ {
3570
+ type: "url",
3571
+ label: "URL format",
3572
+ description: "Require a valid URL.",
3573
+ valueKind: "none"
3574
+ }
3575
+ ];
3576
+ }
3577
+ }
3578
+ function Nn(e) {
3579
+ if (!e || typeof e != "object") return null;
3580
+ let t = e, n = Y(t.id) ?? o(), r = Y(t.value), i = Y(t.label);
3581
+ return !r && !i ? null : {
3582
+ id: n,
3583
+ value: r ?? i ?? n,
3584
+ label: i
3585
+ };
3586
+ }
3587
+ function Pn(e) {
3588
+ let t = /* @__PURE__ */ new Set();
3589
+ for (let n of e) {
3590
+ let e = n.value.trim().toLowerCase();
3591
+ if (e) {
3592
+ if (t.has(e)) return !0;
3593
+ t.add(e);
3594
+ }
3595
+ }
3596
+ return !1;
3597
+ }
3598
+ function Fn(e) {
3599
+ if (!e || typeof e != "object") return null;
3600
+ let t = e, n = Y(t.id) ?? o(), r = Y(t.message);
3601
+ switch (t.type) {
3602
+ case "minLength":
3603
+ case "maxLength":
3604
+ case "min":
3605
+ case "max": {
3606
+ let e = X(t.value);
3607
+ return e === void 0 ? null : {
3608
+ id: n,
3609
+ type: t.type,
3610
+ value: e,
3611
+ message: r
3612
+ };
3613
+ }
3614
+ case "pattern": {
3615
+ let e = Y(t.value);
3616
+ return e ? {
3617
+ id: n,
3618
+ type: "pattern",
3619
+ value: e,
3620
+ message: r
3621
+ } : null;
3622
+ }
3623
+ case "minDate":
3624
+ case "maxDate": {
3625
+ let e = Y(t.value);
3626
+ return e ? {
3627
+ id: n,
3628
+ type: t.type,
3629
+ value: e,
3630
+ message: r
3631
+ } : null;
3632
+ }
3633
+ case "email":
3634
+ case "url":
3635
+ case "integer":
3636
+ case "required":
3637
+ case "mustBeTrue": return {
3638
+ id: n,
3639
+ type: t.type,
3640
+ message: r
3641
+ };
3642
+ default: return null;
3643
+ }
3644
+ }
3645
+ function In(e, t) {
3646
+ let n = e && typeof e == "object" ? e : {};
3647
+ switch (t) {
3648
+ case "textarea": {
3649
+ let e = Z(t);
3650
+ return {
3651
+ type: t,
3652
+ placeholder: Y(n.placeholder),
3653
+ rows: Math.min(12, Math.max(2, Math.round(X(n.rows) ?? e.rows ?? 3)))
3654
+ };
3655
+ }
3656
+ case "number": {
3657
+ let e = Z(t);
3658
+ return {
3659
+ type: t,
3660
+ placeholder: Y(n.placeholder),
3661
+ step: X(n.step) ?? e.step,
3662
+ unit: Y(n.unit),
3663
+ defaultValue: X(n.defaultValue)
3664
+ };
3665
+ }
3666
+ case "datepicker": {
3667
+ let e = Z(t);
3668
+ return {
3669
+ type: t,
3670
+ placeholder: Y(n.placeholder),
3671
+ mode: n.mode === "year" || n.mode === "year-month" ? n.mode : e.mode
3672
+ };
3673
+ }
3674
+ case "switch": return {
3675
+ type: t,
3676
+ checkedLabel: Y(n.checkedLabel),
3677
+ uncheckedLabel: Y(n.uncheckedLabel),
3678
+ defaultChecked: An(n.defaultChecked) ?? !1
3679
+ };
3680
+ case "select": {
3681
+ let e = Z(t);
3682
+ return {
3683
+ type: t,
3684
+ placeholder: Y(n.placeholder),
3685
+ allowClear: An(n.allowClear),
3686
+ options: Array.isArray(n.options) ? n.options.map((e) => Nn(e)).filter((e) => e !== null) : e.options
3687
+ };
3688
+ }
3689
+ case "slider": {
3690
+ let e = Z(t);
3691
+ return {
3692
+ type: t,
3693
+ min: X(n.min) ?? e.min,
3694
+ max: X(n.max) ?? e.max,
3695
+ step: X(n.step) ?? e.step,
3696
+ defaultValue: X(n.defaultValue) ?? e.defaultValue,
3697
+ showValue: An(n.showValue) ?? e.showValue ?? !0
3698
+ };
3699
+ }
3700
+ default: return {
3701
+ type: "input",
3702
+ placeholder: Y(n.placeholder),
3703
+ inputMode: n.inputMode === "email" || n.inputMode === "tel" || n.inputMode === "url" || n.inputMode === "password" ? n.inputMode : "text",
3704
+ autocomplete: Y(n.autocomplete)
3705
+ };
3706
+ }
3707
+ }
3708
+ function Ln(e) {
3709
+ let t = /* @__PURE__ */ new Set();
3710
+ for (let n of e) {
3711
+ if (t.has(n.type)) return !0;
3712
+ t.add(n.type);
3713
+ }
3714
+ return !1;
3715
+ }
3716
+ function Rn(e) {
3717
+ if (!e.key.trim() || Ln(e.validations)) return !0;
3718
+ switch (e.type) {
3719
+ case "number": {
3720
+ let t = e.controller;
3721
+ return t.step !== void 0 && t.step <= 0;
3722
+ }
3723
+ case "datepicker": {
3724
+ let t = e.validations.find((e) => e.type === "minDate")?.value, n = e.validations.find((e) => e.type === "maxDate")?.value;
3725
+ return typeof t == "string" && typeof n == "string" && t > n;
3726
+ }
3727
+ case "select": {
3728
+ let t = e.controller;
3729
+ return t.options.length === 0 || t.options.some((e) => !e.value.trim()) || Pn(t.options);
3730
+ }
3731
+ case "slider": {
3732
+ let t = e.controller;
3733
+ return t.min === void 0 || t.max === void 0 || t.step === void 0 || t.defaultValue === void 0 ? !0 : t.min >= t.max || t.step <= 0 || t.defaultValue < t.min || t.defaultValue > t.max;
3734
+ }
3735
+ default: return e.validations.some((e) => (e.type === "minLength" || e.type === "maxLength" || e.type === "min" || e.type === "max") && typeof e.value == "number" ? e.value < 0 : (e.type === "pattern" || e.type === "minDate" || e.type === "maxDate") && typeof e.value == "string" ? e.value.trim().length === 0 : !1);
3736
+ }
3737
+ }
3738
+ function zn(e) {
3739
+ if (!e || typeof e != "object") return null;
3740
+ let t = e, n = typeof t.id == "string" ? t.id.trim() : "", r = typeof t.key == "string" ? t.key.trim() : "";
3741
+ if (!n) return null;
3742
+ let i = jn(n, r), a = t.type === "textarea" || t.type === "number" || t.type === "datepicker" || t.type === "switch" || t.type === "select" || t.type === "slider" ? t.type : "input", o = Array.isArray(t.validations) ? t.validations.map((e) => Fn(e)).filter((e) => e !== null) : [], s = rn({
3743
+ id: n,
3744
+ required: t.required === !0 ? !0 : void 0,
3745
+ validations: o
3746
+ }).map((e) => ({
3747
+ id: e.id,
3748
+ type: e.type,
3749
+ value: e.value,
3750
+ message: e.message
3751
+ })), c = In(t.controller, a), l = rn({
3752
+ id: n,
3753
+ validations: s
3754
+ }).length > 0;
3755
+ return {
3756
+ id: n,
3757
+ key: i,
3758
+ type: a,
3759
+ label: Y(t.label),
3760
+ description: Y(t.description),
3761
+ errorMessage: Y(t.errorMessage),
3762
+ required: s.some((e) => e.type === "required") ? !0 : void 0,
3763
+ controller: c,
3764
+ validations: s,
3765
+ hasValidations: l ? !0 : void 0,
3766
+ isInvalid: Rn({
3767
+ key: i,
3768
+ type: a,
3769
+ controller: c,
3770
+ validations: s
3771
+ }) ? !0 : void 0
3772
+ };
3773
+ }
3774
+ function Bn(e) {
3775
+ if (!e || typeof e != "object") return null;
3776
+ let t = e, n = typeof t.id == "string" ? t.id.trim() : "", r = typeof t.title == "string" ? t.title.trim() : "", i = typeof t.description == "string" ? t.description.trim() : "";
3777
+ return n ? {
3778
+ id: n,
3779
+ title: r || void 0,
3780
+ description: i || void 0,
3781
+ hasDisplayCondition: t.hasDisplayCondition === !0 ? !0 : void 0,
3782
+ layout: On(t.layout),
3783
+ fields: Array.isArray(t.fields) ? t.fields.map((e) => zn(e)).filter((e) => e !== null) : []
3784
+ } : null;
3785
+ }
3786
+ function Q(e, t) {
3787
+ let n = e ?? {};
3788
+ return {
3789
+ id: typeof n.id == "string" && n.id.trim() ? n.id : t,
3790
+ fieldGroups: Array.isArray(n.fieldGroups) ? n.fieldGroups.map((e) => Bn(e)).filter((e) => e !== null) : []
3791
+ };
3792
+ }
3793
+ function Vn() {
3794
+ return {
3795
+ id: o(),
3796
+ layout: {
3797
+ base: 1,
3798
+ xs: 1,
3799
+ sm: 1,
3800
+ md: 1,
3801
+ xl: 1
3802
+ },
3803
+ fields: []
3804
+ };
3805
+ }
3806
+ function Hn(e) {
3807
+ let t = new Set(e.map((e) => e.key.trim().toLowerCase()).filter(Boolean)), n = 1;
3808
+ for (; t.has(`f${n}`);) n += 1;
3809
+ return `F${n}`;
3810
+ }
3811
+ function Un(e, t = c(4)) {
3812
+ return {
3813
+ id: o(),
3814
+ key: t,
3815
+ type: e,
3816
+ controller: Z(e),
3817
+ validations: []
3818
+ };
3819
+ }
3820
+ //#endregion
3821
+ //#region src/modules/default-item-registry/items/choice/model.ts
3822
+ function Wn(e) {
3823
+ return e === 1;
3824
+ }
3825
+ function Gn(e) {
3826
+ return {
3827
+ id: e,
3828
+ maxSelection: 1,
3829
+ shuffleOptions: !1,
3830
+ options: []
3831
+ };
3832
+ }
3833
+ function Kn(e) {
3834
+ return `options.${e}.label`;
3835
+ }
3836
+ function qn(e) {
3837
+ return `embeddedForms.${e}`;
3838
+ }
3839
+ function Jn(e) {
3840
+ return `embedded.${e}`;
3841
+ }
3842
+ function Yn(e, t) {
3843
+ return `${Jn(e)}.${t}`;
3844
+ }
3845
+ function Xn(e) {
3846
+ return $(e.key ?? "") || e.id;
3847
+ }
3848
+ function Zn(e) {
3849
+ return !!(e.embeddedFormItemId || e.embeddedForm?.fieldGroups.length);
3850
+ }
3851
+ function $(e) {
3852
+ return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
3853
+ }
3854
+ function Qn(e) {
3855
+ if (!e || typeof e != "object") return null;
3856
+ let t = e, n = typeof t.id == "string" ? t.id.trim() : "";
3857
+ if (!n) return null;
3858
+ let r = typeof t.key == "string" ? t.key.trim() : "", i = typeof t.embeddedFormItemId == "string" ? t.embeddedFormItemId.trim() : "";
3859
+ return {
3860
+ id: n,
3861
+ key: r || void 0,
3862
+ hasDisplayCondition: t.hasDisplayCondition === !0 ? !0 : void 0,
3863
+ embeddedFormItemId: i || void 0,
3864
+ embeddedForm: t.embeddedForm ? Q(t.embeddedForm, n) : void 0
3865
+ };
3866
+ }
3867
+ function $n(e) {
3868
+ let t = "maxSelection" in e && e.maxSelection !== void 0, n = e.maxSelection;
3869
+ if (n === null) return null;
3870
+ if (typeof n == "number" && Number.isFinite(n)) {
3871
+ let e = Math.floor(n);
3872
+ return e >= 1 ? e : 1;
3873
+ }
3874
+ if (typeof n == "string") {
3875
+ let e = Number.parseInt(n.trim(), 10);
3876
+ if (Number.isFinite(e) && e >= 1) return e;
3877
+ }
3878
+ return !t && e.mode === "multiple" ? null : 1;
3879
+ }
3880
+ function er(e, t) {
3881
+ let n = e ?? {};
3882
+ return {
3883
+ id: typeof n.id == "string" && n.id.trim() ? n.id : t,
3884
+ maxSelection: $n(n),
3885
+ shuffleOptions: n.shuffleOptions === !0,
3886
+ options: Array.isArray(n.options) ? n.options.map((e) => Qn(e)).filter((e) => e !== null) : []
3887
+ };
3888
+ }
3889
+ function tr(e) {
3890
+ let t = new Set(e.map((e) => $(e.key ?? "").match(/^opt_(\d+)$/)?.[1]).filter((e) => e !== void 0).map((e) => Number.parseInt(e, 10)).filter((e) => Number.isFinite(e))), n = 1;
3891
+ for (; t.has(n);) n += 1;
3892
+ return {
3893
+ id: o(),
3894
+ key: `opt_${n}`
3895
+ };
3896
+ }
3897
+ function nr(e, t) {
3898
+ let n = tr(t);
3899
+ return {
3900
+ ...e,
3901
+ id: n.id,
3902
+ key: n.key,
3903
+ embeddedForm: e.embeddedForm ? i(e.embeddedForm) : void 0
3904
+ };
3905
+ }
3906
+ //#endregion
3907
+ //#region src/modules/default-item-registry/default-item-cores.ts
3908
+ function rr(e) {
3909
+ return e.type === "number" || e.type === "slider" ? m.number : e.type === "datepicker" ? m.date : e.type === "switch" ? m.boolean : m.string;
3910
+ }
3911
+ var ir = class extends v {
3912
+ type = "infoItem";
3913
+ parseConfig(e) {
3914
+ return e ?? {};
3915
+ }
3916
+ isInteractive() {
3917
+ return !1;
3918
+ }
3919
+ getResponseSlotDefinitions() {
3920
+ return [];
3921
+ }
3922
+ }, ar = class extends v {
3923
+ type = "formItem";
3924
+ parseConfig(e) {
3925
+ return Q(e, this.id);
3926
+ }
3927
+ isInteractive() {
3928
+ return !0;
3929
+ }
3930
+ getResponseSlotDefinitions() {
3931
+ return this.config.fieldGroups.flatMap((e) => e.fields.map((e) => ({
3932
+ slotId: e.key,
3933
+ key: e.key,
3934
+ keyPath: ["response"],
3935
+ valueType: rr(e),
3936
+ prefillTarget: {
3937
+ type: _.field,
3938
+ fieldId: e.id
3939
+ }
3940
+ })));
3941
+ }
3942
+ }, or = class extends v {
3943
+ type = "choiceItem";
3944
+ parseConfig(e) {
3945
+ return er(e, this.id);
3946
+ }
3947
+ isInteractive() {
3948
+ return !0;
3949
+ }
3950
+ getResponseSlotDefinitions() {
3951
+ let e = this.config.id ?? this.id, t = this.config.maxSelection === 1 ? m.reference : m.referenceArray, n = this.config.options.flatMap((e) => {
3952
+ let t = e.embeddedForm ? Q(e.embeddedForm, e.id) : void 0;
3953
+ return t ? t.fieldGroups.flatMap((t) => t.fields.map((t) => ({
3954
+ slotId: Yn(e.id, t.key),
3955
+ key: t.key,
3956
+ keyPath: ["embedded", Xn(e)],
3957
+ valueType: rr(t),
3958
+ prefillTarget: {
3959
+ type: _.embeddedField,
3960
+ optionId: e.id,
3961
+ fieldId: t.id
3962
+ }
3963
+ }))) : [];
3964
+ });
3965
+ return [{
3966
+ slotId: e,
3967
+ key: "response",
3968
+ keyPath: [],
3969
+ valueType: t,
3970
+ prefillTarget: { type: _.itemResponse }
3971
+ }, ...n];
3972
+ }
3973
+ normalizePrefillValue(e, t, n) {
3974
+ if (t.prefillTarget?.type !== _.itemResponse) return super.normalizePrefillValue(e, t, n);
3975
+ let r = new Set(this.config.options.map((e) => e.id));
3976
+ if (this.config.maxSelection === 1) return n.type !== m.reference || !r.has(n.value) ? void 0 : n;
3977
+ if (n.type !== m.referenceArray) return;
3978
+ let i = n.value.filter((e) => r.has(e));
3979
+ if (i.length !== 0) return i.length === n.value.length ? n : {
3980
+ ...n,
3981
+ value: i
3982
+ };
3983
+ }
3984
+ };
3985
+ //#endregion
3986
+ export { Ye as $, Kt as A, O as B, Hn as C, Fe as Ct, bn as D, Dn as E, i as Et, yt as F, nt as G, ot as H, j as I, E as J, tt as K, _t as L, B as M, Vt as N, xn as O, St as P, Xe as Q, A as R, Mn as S, Ve as St, wn as T, n as Tt, it as U, ct as V, rt as W, w as X, T as Y, C as Z, kn as _, je as _t, Zn as a, ae as at, vn as b, o as bt, nr as c, De as ct, Kn as d, Ge as dt, te as et, er as f, Ne as ft, Vn as g, m as gt, Un as h, ee as ht, Wn as i, d as it, tn as j, Wt as k, Yn as l, Ce as lt, nn as m, u as mt, ar as n, re as nt, Gn as o, ie as ot, $ as p, x as pt, D as q, ir as r, f as rt, tr as s, y as st, or as t, Pe as tt, qn as u, ne as ut, yn as v, Le as vt, Q as w, Ue as wt, G as x, He as xt, cn as y, t as yt, k as z };
3987
+
3988
+ //# sourceMappingURL=default-item-cores-gdu37TFX.mjs.map