@case-framework/survey-core 0.4.0 → 0.4.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.
@@ -1,22 +1,41 @@
1
1
  {
2
2
  "name": "@case-framework/survey-core",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Implementation of the survey core to use in typescript/javascript projects.",
5
- "type": "module",
5
+ "keywords": [
6
+ "survey engine"
7
+ ],
8
+ "license": "ISC",
9
+ "author": "phev8",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/case-framework/case-survey-toolkit"
13
+ },
6
14
  "files": [
7
15
  "build"
8
16
  ],
17
+ "type": "module",
18
+ "main": "./build/index.mjs",
19
+ "types": "./build/index.d.mts",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./build/index.d.mts",
23
+ "import": "./build/index.mjs"
24
+ },
25
+ "./editor": {
26
+ "types": "./build/editor.d.mts",
27
+ "import": "./build/editor.mjs"
28
+ }
29
+ },
9
30
  "scripts": {
10
31
  "test": "jest --config jestconfig.json",
11
32
  "build": "tsdown",
12
33
  "lint": "eslint src",
13
34
  "lint:fix": "eslint src --fix"
14
35
  },
15
- "keywords": [
16
- "survey engine"
17
- ],
18
- "author": "phev8",
19
- "license": "ISC",
36
+ "dependencies": {
37
+ "date-fns": "^4.1.0"
38
+ },
20
39
  "devDependencies": {
21
40
  "@eslint/js": "^9.39.4",
22
41
  "@types/jest": "^30.0.0",
@@ -26,24 +45,5 @@
26
45
  "tsdown": "^0.21.10",
27
46
  "typescript": "^6.0.3",
28
47
  "typescript-eslint": "^8.59.1"
29
- },
30
- "dependencies": {
31
- "date-fns": "^4.1.0"
32
- },
33
- "main": "./build/index.mjs",
34
- "types": "./build/index.d.mts",
35
- "exports": {
36
- ".": {
37
- "types": "./build/index.d.mts",
38
- "import": "./build/index.mjs"
39
- },
40
- "./editor": {
41
- "types": "./build/editor.d.mts",
42
- "import": "./build/editor.mjs"
43
- }
44
- },
45
- "repository": {
46
- "type": "git",
47
- "url": "https://github.com/case-framework/case-survey-toolkit"
48
48
  }
49
49
  }
@@ -475,33 +475,33 @@ declare enum ContentType {
475
475
  md = "md"
476
476
  }
477
477
  type ContentAttributes = Record<string, unknown>;
478
- type TextAlignment = 'left' | 'center' | 'right' | 'justify';
478
+ type TextAlignment = "left" | "center" | "right" | "justify";
479
479
  type RichTextStyle = {
480
- weight?: 'strong' | 'normal';
481
- italic?: 'italic' | 'normal';
482
- underline?: 'underline' | 'none';
483
- color?: 'primary' | 'accent' | 'default';
480
+ weight?: "strong" | "normal";
481
+ italic?: "italic" | "normal";
482
+ underline?: "underline" | "none";
483
+ color?: "primary" | "accent" | "default";
484
484
  };
485
485
  type RichTextTextInline = {
486
- type: 'text';
486
+ type: "text";
487
487
  text: string;
488
488
  style?: RichTextStyle;
489
489
  attrs?: ContentAttributes;
490
490
  };
491
491
  type RichTextTemplateInline = {
492
- type: 'template';
492
+ type: "template";
493
493
  key: string;
494
494
  style?: RichTextStyle;
495
495
  attrs?: ContentAttributes;
496
496
  };
497
497
  type RichTextLineBreakInline = {
498
- type: 'lineBreak';
498
+ type: "lineBreak";
499
499
  attrs?: ContentAttributes;
500
500
  };
501
501
  /** Inline nodes allowed inside a {@link RichTextLinkInline} (no nested links). */
502
502
  type RichTextLinkChildInline = RichTextTextInline | RichTextTemplateInline | RichTextLineBreakInline;
503
503
  type RichTextLinkInline = {
504
- type: 'link';
504
+ type: "link";
505
505
  href: string;
506
506
  target?: string | null;
507
507
  rel?: string | null;
@@ -510,46 +510,46 @@ type RichTextLinkInline = {
510
510
  children: RichTextLinkChildInline[];
511
511
  };
512
512
  type RichTextInlineExtension = {
513
- type: 'inlineExtension';
513
+ type: "inlineExtension";
514
514
  name: string;
515
515
  attrs?: ContentAttributes;
516
516
  };
517
517
  type RichTextInlineNode = RichTextTextInline | RichTextTemplateInline | RichTextLinkInline | RichTextLineBreakInline | RichTextInlineExtension;
518
518
  type RichTextParagraphBlock = {
519
- type: 'paragraph';
519
+ type: "paragraph";
520
520
  children: RichTextInlineNode[];
521
521
  alignment?: TextAlignment;
522
522
  attrs?: ContentAttributes;
523
523
  };
524
524
  type RichTextHeadingBlock = {
525
- type: 'heading';
525
+ type: "heading";
526
526
  level: 1 | 2 | 3 | 4 | 5 | 6;
527
527
  children: RichTextInlineNode[];
528
528
  alignment?: TextAlignment;
529
529
  attrs?: ContentAttributes;
530
530
  };
531
531
  type RichTextListItemBlock = {
532
- type: 'listItem';
532
+ type: "listItem";
533
533
  children: RichTextParagraphBlock[];
534
534
  attrs?: ContentAttributes;
535
535
  };
536
536
  type RichTextBulletListBlock = {
537
- type: 'bulletList';
537
+ type: "bulletList";
538
538
  items: RichTextListItemBlock[];
539
539
  attrs?: ContentAttributes;
540
540
  };
541
541
  type SurveyContentImageSource = {
542
- type: 'external';
542
+ type: "external";
543
543
  url: string;
544
544
  } | {
545
- type: 'asset';
545
+ type: "asset";
546
546
  assetId: string;
547
547
  };
548
548
  type RichTextImageDimension = {
549
- unit: 'px';
549
+ unit: "px";
550
550
  value: number;
551
551
  } | {
552
- unit: '%';
552
+ unit: "%";
553
553
  value: number;
554
554
  };
555
555
  type RichTextImageSize = {
@@ -557,7 +557,7 @@ type RichTextImageSize = {
557
557
  maxWidth?: RichTextImageDimension;
558
558
  };
559
559
  type RichTextImageBlock = {
560
- type: 'image';
560
+ type: "image";
561
561
  source: SurveyContentImageSource;
562
562
  alt?: string;
563
563
  caption?: RichTextParagraphBlock[];
@@ -566,8 +566,8 @@ type RichTextImageBlock = {
566
566
  attrs?: ContentAttributes;
567
567
  };
568
568
  type RichTextInfoBoxBlock = {
569
- type: 'infoBox';
570
- tone?: 'info' | 'warning';
569
+ type: "infoBox";
570
+ tone?: "info" | "warning";
571
571
  title?: RichTextInlineNode[];
572
572
  collapsible?: boolean;
573
573
  defaultOpen?: boolean;
@@ -575,17 +575,17 @@ type RichTextInfoBoxBlock = {
575
575
  attrs?: ContentAttributes;
576
576
  };
577
577
  type RichTextSeparatorBlock = {
578
- type: 'separator';
578
+ type: "separator";
579
579
  attrs?: ContentAttributes;
580
580
  };
581
581
  type RichTextBlockExtension = {
582
- type: 'blockExtension';
582
+ type: "blockExtension";
583
583
  name: string;
584
584
  attrs?: ContentAttributes;
585
585
  };
586
586
  type RichTextBlockNode = RichTextParagraphBlock | RichTextHeadingBlock | RichTextBulletListBlock | RichTextImageBlock | RichTextInfoBoxBlock | RichTextSeparatorBlock | RichTextBlockExtension;
587
587
  type RichTextDocument = {
588
- type: 'doc';
588
+ type: "doc";
589
589
  blocks: RichTextBlockNode[];
590
590
  };
591
591
  type RichTextContent = {
@@ -738,11 +738,11 @@ interface SurveyVersion {
738
738
  survey: RawSurvey;
739
739
  }
740
740
  type RawSurveyAsset = {
741
- kind: 'image';
741
+ kind: "image";
742
742
  source: {
743
- type: 'embedded';
743
+ type: "embedded";
744
744
  mediaType: string;
745
- encoding: 'base64';
745
+ encoding: "base64";
746
746
  data: string;
747
747
  };
748
748
  metadata?: {
@@ -906,7 +906,7 @@ interface SurveyAssetUsage {
906
906
  itemId?: string;
907
907
  locale?: string;
908
908
  contentKey: string;
909
- usageScope: 'itemTranslation' | 'surveyCard' | 'navigation' | 'validationMessages';
909
+ usageScope: "itemTranslation" | "surveyCard" | "navigation" | "validationMessages";
910
910
  blockIndex: number;
911
911
  }
912
912
  declare class Survey {
@@ -978,4 +978,4 @@ declare class Survey {
978
978
  }
979
979
  //#endregion
980
980
  export { RichTextLinkInline as $, ExpressionEditorConfig as $t, SurveyTranslations as A, ValueType as An, SurveyItemPrefillSource as At, RichTextBulletListBlock as B, ItemExpressionParameterInput as Bt, SurveyVersion as C, ReferenceArrayResponse as Cn, serializeTemplateValues as Ct, SurveyCardContent as D, StringArrayResponse as Dn, JsonSurveyItemPrefillTarget as Dt, NavigationContent as E, SlotResponseBase as En, JsonSurveyItemPrefillSource as Et, ContentType as F, prefillTargetsEqual as Ft, RichTextImageDimension as G, SurveyItemCore as Gt, RichTextDocument as H, buildItemExpression as Ht, MDContent as I, serializeSurveyItemPrefill as It, RichTextInline as J, RawSurveyItem as Jt, RichTextImageSize as K, SurveyItemCoreType as Kt, PlainTextContent as L, AnyItemExpressionDefinition as Lt, Content as M, isResponseValue as Mn, SurveyItemPrefillTargetType as Mt, ContentAssetUsage as N, SurveyItemPreviousResponseRef as Nt, SurveyCardTranslations as O, StringResponse as On, SurveyItemPrefill as Ot, ContentAttributes as P, deserializeSurveyItemPrefill as Pt, RichTextLinkChildInline as Q, Expression as Qt, RichTextBlockExtension as R, ItemExpressionDefinition as Rt, RawSurveyAsset as S, NumberResponse as Sn, serializeTemplateValue as St, JsonSurveyTranslations as T, ResponseValue as Tn, JsonSurveyItemPrefill as Tt, RichTextHeadingBlock as U, getItemExpressionDefinition as Ut, RichTextContent as V, ItemExpressionParameterOption as Vt, RichTextImageBlock as W, ItemCoreConstructor as Wt, RichTextInlineNode as X, ContextVariableExpression as Xt, RichTextInlineExtension as Y, ConstExpression as Yt, RichTextLineBreakInline as Z, ContextVariableType as Zt, createItemTypeDefinitionRegistry as _, DurationResponse as _n, TemplateValueBase as _t, GroupItemCore as a, JsonExpression as an, RichTextTextInline as at, CURRENT_SURVEY_SCHEMA as b, NumberArrayResponse as bn, deserializeTemplateValue as bt, builtInItemCoreRegistry as c, ResponseVariableExpression as cn, createRichTextContent as ct, ItemTypeDefinition as d, ValueReference as dn, getPlainTextFromRichTextContent as dt, ExpressionType as en, RichTextListItemBlock as et, ItemTypeDefinitionRegistry as f, ValueReferenceMethod as fn, hasRenderableRichTextBlock as ft, createItemCore as g, DurationArrayResponse as gn, TemplateDefTypes as gt, createFullRegistry as h, DateResponse as hn, JsonTemplateValue as ht, GroupConfig as i, JsonContextVariableExpression as in, RichTextTemplateInline as it, validateLocale as j, assertResponseValue as jn, SurveyItemPrefillTarget as jt, SurveyItemTranslations as k, ValueRefTypeLookup as kn, SurveyItemPrefillApplyMode as kt, isBuiltInItemType as l, ReferenceUsage as ln, getAssetUsagesFromContent as lt, ItemTypeRegistry as m, DateArrayResponse as mn, isContentEmpty as mt, SurveyAssetUsage as n, FunctionExpressionNames as nn, RichTextSeparatorBlock as nt, PageBreakConfig as o, JsonFunctionExpression as on, SurveyContentImageSource as ot, ItemTypeName as p, BooleanResponse as pn, hasRenderableRichTextContent as pt, RichTextInfoBoxBlock as q, ReservedSurveyItemTypes as qt, BuiltInItemType as r, JsonConstExpression as rn, RichTextStyle as rt, PageBreakItemCore as s, JsonResponseVariableExpression as sn, TextAlignment as st, Survey as t, FunctionExpression as tn, RichTextParagraphBlock as tt, ItemTypeCapabilities as u, ReferenceUsageType as un, getContentPlainText as ut, toItemTypeDefinitionRegistry as v, DurationUnit as vn, TemplateValueDefinition as vt, JsonComponentContent as w, ReferenceResponse as wn, ResponseSlotDefinition as wt, RawSurvey as x, NumberPrecision as xn, deserializeTemplateValues as xt, SurveyItemKey as y, DurationUnits as yn, TemplateValueFormatDate as yt, RichTextBlockNode as z, ItemExpressionParameterDefinition as zt };
981
- //# sourceMappingURL=survey-DShEOjyz.d.mts.map
981
+ //# sourceMappingURL=survey-BV8YHc3J.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"survey-BV8YHc3J.d.mts","names":[],"sources":["../src/survey/responses/value-types.ts","../src/survey/utils/value-reference.ts","../src/expressions/expression.ts","../src/survey/items/survey-item-json.ts","../src/survey/items/types.ts","../src/survey/items/utils.ts","../src/survey/items/survey-item.ts","../src/expressions/item-expression-registry.ts","../src/survey/items/prefill.ts","../src/survey/responses/slot-definition.ts","../src/expressions/template-value.ts","../src/survey/utils/content.ts","../src/survey/utils/translations.ts","../src/survey/survey-file-schema.ts","../src/survey/item-key.ts","../src/survey/registry/item-registry.ts","../src/survey/registry/built-in-items.ts","../src/survey/survey.ts"],"mappings":";cAAa,SAAA;EAAA;;;;;;;;;;;;KAcD,SAAA,WAAoB,SAAA,eAAwB,SAAA;AAAA,cAE3C,aAAA;EAAA;;;;;;;;KAUD,YAAA,WAAuB,aA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,CAAA;EAAA,IAQA,OAAA,CAAA;EAAA,IAIA,QAAA,CAAA,GAAY,aAAA;EAAA,IAOZ,QAAA,CAAA,GAAY,KAAA;IAAQ,MAAA;IAAgB,GAAA;IAAa,OAAA;IAAmB,IAAA;EAAA;EAcxE,WAAA,CAAY,MAAA;EAkBZ,UAAA,CAAW,MAAA,WAAiB,aAAA;EAU5B,aAAA,CAAc,MAAA,WAAiB,aAAA;EAiB/B,gBAAA,CAAiB,QAAA,WAAmB,cAAA;EAYpC,WAAA,CAAY,MAAA,WAAiB,cAAA;EAAA,IAazB,YAAA,CAAA,GAAgB,kBAAA;EAOpB,mBAAA,CAAoB,EAAA,WAAa,sBAAA;EASjC,gBAAA,CAAiB,gBAAA,WAA2B,uBAAA;EAI5C,gBAAA,CAAiB,gBAAA,UAA0B,aAAA,EAAe,uBAAA;EAO1D,mBAAA,CAAoB,gBAAA;EAIpB,oBAAA,CAAA;EAIA,QAAA,CAAS,OAAA,WAAkB,cAAA;EAK3B,QAAA,CAAS,OAAA,UAAiB,KAAA,EAAO,cAAA;EAQjC,WAAA,CAAY,OAAA;EAIZ,QAAA,CAAS,OAAA;EAIT,WAAA,CAAA;EAIA,SAAA,CAAA,GAAa,GAAA,SAAY,cAAA;EASzB,cAAA,CAAe,aAAA,YAAyB,gBAAA;EA+DxC,8BAAA,CAA+B,MAAA,GAAS,SAAA,GAAY,kBAAA;EAQpD,0BAAA,CAAA,GAA8B,KAAA;IAAQ,MAAA;IAAgB,KAAA,EAAO,sBAAA;EAAA;EjBnVrB;;;;;EiB+VxC,kBAAA,CAAmB,SAAA,YAAqB,cAAA;EAyBxC,cAAA,CAAe,QAAA,UAAkB,UAAA;AAAA"}
@@ -1219,7 +1219,7 @@ var Survey = class Survey {
1219
1219
  * Create a minimal blank survey with a root group and one empty page.
1220
1220
  */
1221
1221
  static createBlankSurvey(pluginRegistry, surveyKey) {
1222
- const newKey = surveyKey ?? generateCodingKey();
1222
+ const newKey = surveyKey ?? "survey";
1223
1223
  const rawSurvey = {
1224
1224
  $schema: CURRENT_SURVEY_SCHEMA,
1225
1225
  surveyItems: [{
@@ -1425,4 +1425,4 @@ var Survey = class Survey {
1425
1425
  //#endregion
1426
1426
  export { generateId as $, DurationUnits as A, ConstExpression as B, ReservedSurveyItemTypes as C, deserializeSurveyItemPrefill as D, SurveyItemPrefillTargetType as E, TemplateDefTypes as F, FunctionExpression as G, ContextVariableType as H, deserializeTemplateValue as I, ReferenceUsageType as J, FunctionExpressionNames as K, deserializeTemplateValues as L, ValueType as M, assertResponseValue as N, prefillTargetsEqual as O, isResponseValue as P, generateCodingKey as Q, serializeTemplateValue as R, SurveyItemKey as S, SurveyItemPrefillApplyMode as T, Expression as U, ContextVariableExpression as V, ExpressionType as W, ValueReferenceMethod as X, ValueReference as Y, createSeededRandom as Z, toItemTypeDefinitionRegistry as _, getContentPlainText as a, builtInItemCoreRegistry as b, hasRenderableRichTextContent as c, SurveyTranslations as d, shuffleArray as et, validateLocale as f, createItemTypeDefinitionRegistry as g, createItemCore as h, getAssetUsagesFromContent as i, NumberPrecision as j, serializeSurveyItemPrefill as k, isContentEmpty as l, createFullRegistry as m, ContentType as n, structuredCloneMethod as nt, getPlainTextFromRichTextContent as o, CURRENT_SURVEY_SCHEMA as p, ResponseVariableExpression as q, createRichTextContent as r, hasRenderableRichTextBlock as s, Survey as t, shuffleIndices as tt, SurveyItemTranslations as u, GroupItemCore as v, SurveyItemCore as w, isBuiltInItemType as x, PageBreakItemCore as y, serializeTemplateValues as z };
1427
1427
 
1428
- //# sourceMappingURL=survey-yXdl8xkf.mjs.map
1428
+ //# sourceMappingURL=survey-DnLtf19j.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"survey-DnLtf19j.mjs","names":[],"sources":["../src/utils.ts","../src/survey/utils/value-reference.ts","../src/expressions/expression.ts","../src/expressions/template-value.ts","../src/survey/responses/value-types.ts","../src/survey/items/utils.ts","../src/survey/items/prefill.ts","../src/survey/items/survey-item.ts","../src/survey/items/types.ts","../src/survey/item-key.ts","../src/survey/utils/group-utils.ts","../src/survey/registry/built-in-items.ts","../src/survey/registry/item-registry.ts","../src/survey/survey-file-schema.ts","../src/survey/utils/translations.ts","../src/survey/utils/content.ts","../src/survey/survey.ts"],"sourcesContent":["function hashString(seed: string): number {\n let hash = 2166136261;\n\n for (let i = 0; i < seed.length; i++) {\n hash ^= seed.charCodeAt(i);\n hash = Math.imul(hash, 16777619);\n }\n\n return hash >>> 0;\n}\n\nexport function createSeededRandom(seed: string): () => number {\n let state = hashString(seed);\n\n return () => {\n state = (state + 0x6d2b79f5) >>> 0;\n let next = state;\n next = Math.imul(next ^ (next >>> 15), next | 1);\n next ^= next + Math.imul(next ^ (next >>> 7), next | 61);\n return ((next ^ (next >>> 14)) >>> 0) / 4294967296;\n };\n}\n\nexport function shuffleArray<T>(values: readonly T[], random: () => number = Math.random): T[] {\n const shuffledValues = [...values];\n\n for (let i = shuffledValues.length - 1; i > 0; i--) {\n const j = Math.floor(random() * (i + 1));\n [shuffledValues[i], shuffledValues[j]] = [shuffledValues[j], shuffledValues[i]];\n }\n\n return shuffledValues;\n}\n\n/**\n * Shuffles an array of indices using the Fisher-Yates shuffle algorithm\n * @param length - The length of the array to create indices for\n * @returns A shuffled array of indices from 0 to length-1\n */\nexport function shuffleIndices(length: number, random: () => number = Math.random): number[] {\n return shuffleArray(\n Array.from({ length }, (_, i) => i),\n random,\n );\n}\n\nexport function structuredCloneMethod<T>(obj: T): T {\n if (typeof structuredClone !== \"undefined\") {\n return structuredClone(obj);\n }\n // Fallback to JSON method\n return JSON.parse(JSON.stringify(obj));\n}\n\nconst ALPHABET = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\n\nexport function generateId(): string {\n const length = 10;\n const timestamp = Date.now();\n let encodedTimestamp = \"\";\n let t = timestamp;\n const base = ALPHABET.length;\n\n while (t > 0) {\n encodedTimestamp = ALPHABET.charAt(t % base) + encodedTimestamp;\n t = Math.floor(t / base);\n }\n\n let randomPart = \"\";\n for (let i = 0; i < length; i++) {\n randomPart += ALPHABET.charAt(Math.floor(Math.random() * base));\n }\n return randomPart + encodedTimestamp;\n}\n\n/** Alphanumeric chars without ambiguous ones (0/O, 1/I) for human-readable coding keys. */\nconst CODING_KEY_ALPHABET = \"23456789ABCDEFGHJKLMNPQRSTUVWXYZ\";\n\n/**\n * Generates a short random coding key suitable for item keys in exports/codebooks.\n * @param length - Key length (default 4)\n * @returns A random string of the specified length.\n */\nexport function generateCodingKey(length: number = 4): string {\n const base = CODING_KEY_ALPHABET.length;\n let key = \"\";\n for (let i = 0; i < length; i++) {\n key += CODING_KEY_ALPHABET.charAt(Math.floor(Math.random() * base));\n }\n return key;\n}\n","const SEPARATOR = \"...\";\n\nexport enum ValueReferenceMethod {\n get = \"get\",\n isDefined = \"isDefined\",\n}\n\nexport class ValueReference {\n _itemId: string;\n _name: ValueReferenceMethod;\n _slotId: string;\n\n constructor(str: string) {\n const parts = str.split(SEPARATOR);\n if (parts.length !== 3) {\n throw new Error(\"Invalid value reference: \" + str);\n }\n this._itemId = parts[0];\n this._name = parts[1] as ValueReferenceMethod;\n this._slotId = parts[2];\n }\n\n get itemId(): string {\n return this._itemId;\n }\n\n get name(): ValueReferenceMethod {\n return this._name;\n }\n\n get slotId(): string {\n return this._slotId;\n }\n\n set itemId(itemId: string) {\n this._itemId = itemId;\n }\n\n toString(): string {\n return `${this._itemId}${SEPARATOR}${this._name}${this._slotId ? SEPARATOR + this._slotId : \"\"}`;\n }\n\n static fromParts(itemId: string, name: ValueReferenceMethod, slotId: string): ValueReference {\n return new ValueReference(`${itemId}${SEPARATOR}${name}${SEPARATOR}${slotId}`);\n }\n}\n\nexport enum ReferenceUsageType {\n displayConditions = \"displayConditions\",\n templateValues = \"templateValues\",\n validations = \"validations\",\n disabledConditions = \"disabledConditions\",\n prefills = \"prefills\",\n}\n\nexport interface ReferenceUsage {\n itemId: string;\n fullComponentKey?: string;\n usageType?: ReferenceUsageType;\n valueReference: ValueReference;\n}\n","import { ResponseValue, ValueType } from \"../survey/responses\";\nimport { ValueReference } from \"../survey/utils/value-reference\";\n\nexport const ExpressionType = {\n Const: \"const\",\n ResponseVariable: \"responseVariable\",\n ContextVariable: \"contextVariable\",\n Function: \"function\",\n} as const;\n\nexport type ExpressionType = (typeof ExpressionType)[keyof typeof ExpressionType];\n\nexport const ContextVariableType = {\n Locale: \"locale\",\n ParticipantFlag: \"participantFlag\",\n CustomValue: \"customValue\",\n CustomExpression: \"customExpression\",\n} as const;\n\nexport type ContextVariableType = (typeof ContextVariableType)[keyof typeof ContextVariableType];\n\nexport interface ExpressionEditorConfig {\n usedTemplate?: string;\n label?: string;\n description?: string;\n}\n\nexport interface JsonConstExpression {\n type: typeof ExpressionType.Const;\n value?: ResponseValue;\n\n editorConfig?: ExpressionEditorConfig;\n}\n\nexport interface JsonResponseVariableExpression {\n type: typeof ExpressionType.ResponseVariable;\n variableRef: string;\n\n editorConfig?: ExpressionEditorConfig;\n}\n\nexport interface JsonContextVariableExpression {\n type: typeof ExpressionType.ContextVariable;\n\n contextType: ContextVariableType;\n key?: JsonExpression;\n arguments?: Array<JsonExpression | undefined>;\n asType?: ValueType;\n\n editorConfig?: ExpressionEditorConfig;\n}\n\nexport interface JsonFunctionExpression {\n type: typeof ExpressionType.Function;\n functionName: string;\n arguments: Array<JsonExpression | undefined>;\n\n editorConfig?: ExpressionEditorConfig;\n}\n\nexport type JsonExpression =\n | JsonConstExpression\n | JsonResponseVariableExpression\n | JsonContextVariableExpression\n | JsonFunctionExpression;\n\n/**\n * Base class for all expressions.\n */\nexport abstract class Expression {\n type: ExpressionType;\n editorConfig?: ExpressionEditorConfig;\n\n constructor(type: ExpressionType, editorConfig?: ExpressionEditorConfig) {\n this.type = type;\n this.editorConfig = editorConfig;\n }\n\n static deserialize(json: JsonExpression | undefined): Expression | undefined {\n if (!json) {\n return undefined;\n }\n\n switch (json.type) {\n case ExpressionType.Const:\n return ConstExpression.deserialize(json);\n case ExpressionType.ResponseVariable:\n return ResponseVariableExpression.deserialize(json);\n case ExpressionType.ContextVariable:\n return ContextVariableExpression.deserialize(json);\n case ExpressionType.Function:\n return FunctionExpression.deserialize(json);\n }\n }\n\n /**\n * Returns all unique response variable references in the expression.\n * @returns A list of ValueReference objects.\n */\n abstract get responseVariableRefs(): ValueReference[];\n abstract serialize(): JsonExpression | undefined;\n\n clone(): Expression {\n return (\n Expression.deserialize(this.serialize()) ??\n (() => {\n throw new Error(\"Failed to clone expression\");\n })()\n );\n }\n}\n\nexport class ConstExpression extends Expression {\n declare type: typeof ExpressionType.Const;\n value?: ResponseValue;\n\n constructor(value?: ResponseValue, editorConfig?: ExpressionEditorConfig) {\n super(ExpressionType.Const, editorConfig);\n this.value = value;\n this.type = ExpressionType.Const;\n }\n\n static deserialize(json: JsonExpression): ConstExpression {\n if (json.type !== ExpressionType.Const) {\n throw new Error(\"Invalid expression type: \" + json.type);\n }\n\n return new ConstExpression(json.value, json.editorConfig);\n }\n\n get responseVariableRefs(): ValueReference[] {\n return [];\n }\n\n serialize(): JsonExpression {\n return {\n type: this.type,\n value: this.value,\n editorConfig: this.editorConfig,\n };\n }\n\n updateItemKeyReferences(_oldItemKey: string, _newItemKey: string): boolean {\n // Const expressions don't have item references\n return false;\n }\n}\n\nexport class ResponseVariableExpression extends Expression {\n declare type: typeof ExpressionType.ResponseVariable;\n variableRef: string;\n\n constructor(variableRef: string, editorConfig?: ExpressionEditorConfig) {\n super(ExpressionType.ResponseVariable, editorConfig);\n this.variableRef = variableRef;\n this.type = ExpressionType.ResponseVariable;\n }\n\n static deserialize(json: JsonExpression): ResponseVariableExpression {\n if (json.type !== ExpressionType.ResponseVariable) {\n throw new Error(\"Invalid expression type: \" + json.type);\n }\n\n return new ResponseVariableExpression(json.variableRef, json.editorConfig);\n }\n\n get responseVariableRefs(): ValueReference[] {\n return [new ValueReference(this.variableRef)];\n }\n\n get responseVariableRef(): ValueReference {\n return new ValueReference(this.variableRef);\n }\n\n serialize(): JsonExpression {\n return {\n type: this.type,\n variableRef: this.variableRef,\n editorConfig: this.editorConfig,\n };\n }\n}\n\nexport class ContextVariableExpression extends Expression {\n declare type: typeof ExpressionType.ContextVariable;\n\n contextType: ContextVariableType;\n key?: Expression;\n arguments?: Array<Expression | undefined>;\n asType?: ValueType;\n\n constructor(\n contextType: ContextVariableType,\n key?: Expression,\n args?: Array<Expression | undefined>,\n asType?: ValueType,\n editorConfig?: ExpressionEditorConfig,\n ) {\n super(ExpressionType.ContextVariable, editorConfig);\n this.type = ExpressionType.ContextVariable;\n this.contextType = contextType;\n this.key = key;\n this.arguments = args;\n this.asType = asType;\n }\n\n static deserialize(json: JsonExpression): ContextVariableExpression {\n if (json.type !== ExpressionType.ContextVariable) {\n throw new Error(\"Invalid expression type: \" + json.type);\n }\n\n return new ContextVariableExpression(\n json.contextType,\n Expression.deserialize(json.key),\n json.arguments?.map((arg) => Expression.deserialize(arg)),\n json.asType,\n json.editorConfig,\n );\n }\n\n get responseVariableRefs(): ValueReference[] {\n return (\n this.arguments\n ?.flatMap((arg) => arg?.responseVariableRefs)\n .filter((ref) => ref !== undefined) ?? []\n );\n }\n\n serialize(): JsonExpression {\n return {\n type: this.type,\n contextType: this.contextType,\n key: this.key?.serialize(),\n arguments: this.arguments?.map((arg) => arg?.serialize()),\n asType: this.asType,\n editorConfig: this.editorConfig,\n };\n }\n}\n\nexport enum FunctionExpressionNames {\n and = \"and\",\n or = \"or\",\n not = \"not\",\n\n list_contains = \"list_contains\",\n\n // numeric functions\n eq = \"eq\",\n gt = \"gt\",\n gte = \"gte\",\n lt = \"lt\",\n lte = \"lte\",\n in_range = \"in_range\",\n\n sum = \"sum\",\n min = \"min\",\n max = \"max\",\n\n // string functions\n str_eq = \"str_eq\",\n\n // date functions\n date_eq = \"date_eq\",\n}\n\nexport class FunctionExpression extends Expression {\n declare type: typeof ExpressionType.Function;\n functionName: FunctionExpressionNames;\n arguments: Array<Expression | undefined>;\n\n constructor(\n functionName: FunctionExpressionNames,\n args: Array<Expression | undefined>,\n editorConfig?: ExpressionEditorConfig,\n ) {\n super(ExpressionType.Function);\n this.type = ExpressionType.Function;\n this.functionName = functionName;\n this.arguments = args;\n this.editorConfig = editorConfig;\n }\n\n static deserialize(json: JsonExpression): FunctionExpression {\n if (json.type !== ExpressionType.Function) {\n throw new Error(\"Invalid expression type: \" + json.type);\n }\n\n const functionName = json.functionName as FunctionExpressionNames;\n if (!Object.values(FunctionExpressionNames).includes(functionName)) {\n throw new Error(\"Invalid function name: \" + functionName);\n }\n\n const expr = new FunctionExpression(\n functionName,\n json.arguments.map((arg) => Expression.deserialize(arg)),\n );\n expr.editorConfig = json.editorConfig;\n return expr;\n }\n\n get responseVariableRefs(): ValueReference[] {\n const refs = this.arguments\n .flatMap((arg) => arg?.responseVariableRefs)\n .filter((ref) => ref !== undefined);\n const refStrings = refs.map((ref) => ref.toString());\n return [...new Set(refStrings)].map((ref) => new ValueReference(ref));\n }\n\n serialize(): JsonExpression | undefined {\n return {\n type: this.type,\n functionName: this.functionName,\n arguments: this.arguments.map((arg) => arg?.serialize()),\n editorConfig: this.editorConfig,\n };\n }\n}\n","import { ValueType } from \"../survey/responses\";\nimport { Expression, JsonExpression } from \"./expression\";\n\nexport enum TemplateDefTypes {\n Default = \"default\",\n Date2String = \"date2string\",\n}\n\nexport type TemplateValueBase = {\n type: TemplateDefTypes;\n returnType: ValueType;\n expression?: Expression;\n};\n\nexport type TemplateValueFormatDate = TemplateValueBase & {\n type: TemplateDefTypes.Date2String;\n returnType: typeof ValueType.string;\n dateFormat: string;\n};\n\nexport type TemplateValueDefinition = TemplateValueBase | TemplateValueFormatDate;\n\nexport const serializeTemplateValue = (\n templateValue: TemplateValueDefinition,\n): JsonTemplateValue => {\n const json: JsonTemplateValue = {\n type: templateValue.type,\n returnType: templateValue.returnType,\n expression: templateValue.expression?.serialize(),\n };\n if (templateValue.type === TemplateDefTypes.Date2String) {\n json.dateFormat = (templateValue as TemplateValueFormatDate).dateFormat;\n }\n return json;\n};\n\nexport const serializeTemplateValues = (\n templateValues: Map<string, TemplateValueDefinition>,\n): { [templateValueKey: string]: JsonTemplateValue } => {\n const json: { [templateValueKey: string]: JsonTemplateValue } = {};\n for (const [key, value] of templateValues.entries()) {\n json[key] = serializeTemplateValue(value);\n }\n return json;\n};\n\nexport const deserializeTemplateValue = (json: JsonTemplateValue): TemplateValueDefinition => {\n return {\n type: json.type,\n expression: json.expression ? Expression.deserialize(json.expression) : undefined,\n returnType: json.returnType,\n dateFormat: json.dateFormat,\n };\n};\n\nexport const deserializeTemplateValues = (json: {\n [templateValueKey: string]: JsonTemplateValue;\n}): Map<string, TemplateValueDefinition> => {\n return new Map(\n Object.entries(json).map(([key, value]) => [key, deserializeTemplateValue(value)]),\n );\n};\n\nexport interface JsonTemplateValue {\n type: TemplateDefTypes;\n expression?: JsonExpression;\n returnType: ValueType;\n dateFormat?: string;\n}\n","export const ValueType = {\n string: \"string\",\n duration: \"duration\",\n reference: \"reference\",\n number: \"number\",\n boolean: \"boolean\",\n date: \"date\",\n stringArray: \"string[]\",\n durationArray: \"duration[]\",\n referenceArray: \"reference[]\",\n numberArray: \"number[]\",\n dateArray: \"date[]\",\n} as const;\n\nexport type ValueType = (typeof ValueType)[keyof typeof ValueType];\n\nexport const DurationUnits = {\n seconds: \"seconds\",\n minutes: \"minutes\",\n hours: \"hours\",\n days: \"days\",\n weeks: \"weeks\",\n months: \"months\",\n years: \"years\",\n} as const;\n\nexport type DurationUnit = (typeof DurationUnits)[keyof typeof DurationUnits];\n\nexport const NumberPrecision = {\n int: \"int\",\n float: \"float\",\n} as const;\n\nexport type NumberPrecision = (typeof NumberPrecision)[keyof typeof NumberPrecision];\n\nexport interface SlotResponseBase<TValueType extends ValueType> {\n type: TValueType;\n}\n\nexport interface StringResponse extends SlotResponseBase<typeof ValueType.string> {\n value: string;\n}\n\nexport interface DurationResponse extends SlotResponseBase<typeof ValueType.duration> {\n value: number;\n unit: DurationUnit;\n precision?: NumberPrecision;\n}\n\nexport interface NumberResponse extends SlotResponseBase<typeof ValueType.number> {\n value: number;\n precision?: NumberPrecision;\n}\n\nexport interface BooleanResponse extends SlotResponseBase<typeof ValueType.boolean> {\n value: boolean;\n}\n\nexport interface ReferenceResponse extends SlotResponseBase<typeof ValueType.reference> {\n value: string;\n}\n\nexport interface DateResponse extends SlotResponseBase<typeof ValueType.date> {\n value: number;\n}\n\nexport interface StringArrayResponse extends SlotResponseBase<typeof ValueType.stringArray> {\n value: string[];\n}\n\nexport interface DurationArrayResponse extends SlotResponseBase<typeof ValueType.durationArray> {\n value: number[];\n unit: DurationUnit;\n precision?: NumberPrecision;\n}\n\nexport interface NumberArrayResponse extends SlotResponseBase<typeof ValueType.numberArray> {\n value: number[];\n precision?: NumberPrecision;\n}\n\nexport interface DateArrayResponse extends SlotResponseBase<typeof ValueType.dateArray> {\n value: number[];\n}\n\nexport interface ReferenceArrayResponse extends SlotResponseBase<typeof ValueType.referenceArray> {\n value: string[];\n}\n\nexport type ResponseValue =\n | StringResponse\n | DurationResponse\n | ReferenceResponse\n | NumberResponse\n | BooleanResponse\n | DateResponse\n | StringArrayResponse\n | DurationArrayResponse\n | NumberArrayResponse\n | DateArrayResponse\n | ReferenceArrayResponse;\n\nexport type ValueRefTypeLookup = {\n [valueRefString: string]: ValueType;\n};\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction isFiniteNumber(value: unknown): value is number {\n return typeof value === \"number\" && Number.isFinite(value);\n}\n\nfunction isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every((item) => typeof item === \"string\");\n}\n\nfunction isNumberArray(value: unknown): value is number[] {\n return Array.isArray(value) && value.every((item) => isFiniteNumber(item));\n}\n\nfunction isOptionalNumberPrecision(value: unknown): value is NumberPrecision | undefined {\n return value === undefined || value === NumberPrecision.int || value === NumberPrecision.float;\n}\n\nfunction isDurationUnit(value: unknown): value is DurationUnit {\n return typeof value === \"string\" && Object.values(DurationUnits).includes(value as DurationUnit);\n}\n\nexport function isResponseValue(value: unknown): value is ResponseValue {\n if (!isPlainObject(value) || typeof value.type !== \"string\") {\n return false;\n }\n\n switch (value.type) {\n case ValueType.string:\n case ValueType.reference:\n return typeof value.value === \"string\";\n case ValueType.number:\n return isFiniteNumber(value.value) && isOptionalNumberPrecision(value.precision);\n case ValueType.boolean:\n return typeof value.value === \"boolean\";\n case ValueType.date:\n return isFiniteNumber(value.value);\n case ValueType.duration:\n return (\n isFiniteNumber(value.value) &&\n isDurationUnit(value.unit) &&\n isOptionalNumberPrecision(value.precision)\n );\n case ValueType.stringArray:\n case ValueType.referenceArray:\n return isStringArray(value.value);\n case ValueType.numberArray:\n case ValueType.dateArray:\n return (\n isNumberArray(value.value) &&\n (value.type !== ValueType.numberArray || isOptionalNumberPrecision(value.precision))\n );\n case ValueType.durationArray:\n return (\n isNumberArray(value.value) &&\n isDurationUnit(value.unit) &&\n isOptionalNumberPrecision(value.precision)\n );\n default:\n return false;\n }\n}\n\nexport function assertResponseValue(value: unknown, path: string): asserts value is ResponseValue {\n if (!isResponseValue(value)) {\n throw new Error(`Invalid response value at '${path}'`);\n }\n}\n","import { Expression, JsonExpression } from \"../../expressions\";\n\nexport interface DisplayConditions {\n root?: Expression;\n components?: {\n [componentKey: string]: Expression | undefined;\n };\n}\n\nexport interface JsonDisplayConditions {\n root?: JsonExpression;\n components?: {\n [componentKey: string]: JsonExpression | undefined;\n };\n}\n\nexport interface JsonDisabledConditions {\n components?: {\n [componentKey: string]: JsonExpression | undefined;\n };\n}\n\nexport interface DisabledConditions {\n components?: {\n [componentKey: string]: Expression | undefined;\n };\n}\n\nexport const displayConditionsFromJson = (json: JsonDisplayConditions): DisplayConditions => {\n return {\n root: json.root ? Expression.deserialize(json.root) : undefined,\n components: json.components\n ? Object.fromEntries(\n Object.entries(json.components).map(([key, value]) => [\n key,\n Expression.deserialize(value),\n ]),\n )\n : undefined,\n };\n};\n\nexport const displayConditionsToJson = (\n displayConditions: DisplayConditions,\n): JsonDisplayConditions => {\n return {\n root: displayConditions.root ? displayConditions.root.serialize() : undefined,\n components: displayConditions.components\n ? Object.fromEntries(\n Object.entries(displayConditions.components).map(([key, value]) => [\n key,\n value?.serialize(),\n ]),\n )\n : undefined,\n };\n};\n\nexport const disabledConditionsFromJson = (json: JsonDisabledConditions): DisabledConditions => {\n return {\n components: json.components\n ? Object.fromEntries(\n Object.entries(json.components).map(([key, value]) => [\n key,\n Expression.deserialize(value),\n ]),\n )\n : undefined,\n };\n};\n\nexport const disabledConditionsToJson = (\n disabledConditions: DisabledConditions,\n): JsonDisabledConditions => {\n return {\n components: disabledConditions.components\n ? Object.fromEntries(\n Object.entries(disabledConditions.components).map(([key, value]) => [\n key,\n value?.serialize(),\n ]),\n )\n : undefined,\n };\n};\n","import { Expression, type JsonExpression } from \"../../expressions\";\nimport type { ResponseValue } from \"../responses\";\n\nexport const SurveyItemPrefillApplyMode = {\n ifEmpty: \"ifEmpty\",\n} as const;\n\nexport type SurveyItemPrefillApplyMode =\n (typeof SurveyItemPrefillApplyMode)[keyof typeof SurveyItemPrefillApplyMode];\n\nexport const SurveyItemPrefillTargetType = {\n itemResponse: \"itemResponse\",\n field: \"field\",\n embeddedField: \"embeddedField\",\n} as const;\n\nexport type SurveyItemPrefillTargetType =\n (typeof SurveyItemPrefillTargetType)[keyof typeof SurveyItemPrefillTargetType];\n\nexport type JsonSurveyItemPrefillTarget =\n | {\n type: typeof SurveyItemPrefillTargetType.itemResponse;\n }\n | {\n type: typeof SurveyItemPrefillTargetType.field;\n fieldId: string;\n }\n | {\n type: typeof SurveyItemPrefillTargetType.embeddedField;\n optionId: string;\n fieldId: string;\n };\n\nexport type SurveyItemPrefillTarget = JsonSurveyItemPrefillTarget;\n\nexport interface SurveyItemPreviousResponseRef {\n surveyKey?: string;\n itemId: string;\n target?: SurveyItemPrefillTarget;\n}\n\nexport type JsonSurveyItemPrefillSource =\n | {\n type: \"static\";\n value: ResponseValue;\n }\n | {\n type: \"expression\";\n expression: JsonExpression;\n }\n | {\n type: \"templateValue\";\n key: string;\n }\n | {\n type: \"previousResponse\";\n ref: SurveyItemPreviousResponseRef;\n ifUnsupported?: \"skip\";\n };\n\nexport type SurveyItemPrefillSource =\n | {\n type: \"static\";\n value: ResponseValue;\n }\n | {\n type: \"expression\";\n expression: Expression;\n }\n | {\n type: \"templateValue\";\n key: string;\n }\n | {\n type: \"previousResponse\";\n ref: SurveyItemPreviousResponseRef;\n ifUnsupported?: \"skip\";\n };\n\nexport interface JsonSurveyItemPrefill {\n id: string;\n target: JsonSurveyItemPrefillTarget;\n when?: JsonExpression;\n apply?: SurveyItemPrefillApplyMode;\n source: JsonSurveyItemPrefillSource;\n}\n\nexport interface SurveyItemPrefill {\n id: string;\n target: SurveyItemPrefillTarget;\n when?: Expression;\n apply?: SurveyItemPrefillApplyMode;\n source: SurveyItemPrefillSource;\n}\n\nexport function deserializeSurveyItemPrefill(json: JsonSurveyItemPrefill): SurveyItemPrefill {\n switch (json.source.type) {\n case \"static\":\n return {\n id: json.id,\n target: json.target,\n when: Expression.deserialize(json.when),\n apply: json.apply,\n source: {\n type: \"static\",\n value: json.source.value,\n },\n };\n case \"expression\":\n return {\n id: json.id,\n target: json.target,\n when: Expression.deserialize(json.when),\n apply: json.apply,\n source: {\n type: \"expression\",\n expression:\n Expression.deserialize(json.source.expression) ??\n (() => {\n throw new Error(`Prefill '${json.id}' is missing a valid expression source`);\n })(),\n },\n };\n case \"templateValue\":\n return {\n id: json.id,\n target: json.target,\n when: Expression.deserialize(json.when),\n apply: json.apply,\n source: {\n type: \"templateValue\",\n key: json.source.key,\n },\n };\n case \"previousResponse\":\n return {\n id: json.id,\n target: json.target,\n when: Expression.deserialize(json.when),\n apply: json.apply,\n source: {\n type: \"previousResponse\",\n ref: json.source.ref,\n ifUnsupported: json.source.ifUnsupported,\n },\n };\n default:\n throw new Error(\n `Unsupported prefill source type: ${(json.source as { type?: string }).type}`,\n );\n }\n}\n\nexport function serializeSurveyItemPrefill(prefill: SurveyItemPrefill): JsonSurveyItemPrefill {\n switch (prefill.source.type) {\n case \"static\":\n return {\n id: prefill.id,\n target: prefill.target,\n when: prefill.when?.serialize(),\n apply: prefill.apply,\n source: {\n type: \"static\",\n value: prefill.source.value,\n },\n };\n case \"expression\":\n return {\n id: prefill.id,\n target: prefill.target,\n when: prefill.when?.serialize(),\n apply: prefill.apply,\n source: {\n type: \"expression\",\n expression:\n prefill.source.expression.serialize() ??\n (() => {\n throw new Error(\n `Prefill '${prefill.id}' cannot serialize an empty expression source`,\n );\n })(),\n },\n };\n case \"templateValue\":\n return {\n id: prefill.id,\n target: prefill.target,\n when: prefill.when?.serialize(),\n apply: prefill.apply,\n source: {\n type: \"templateValue\",\n key: prefill.source.key,\n },\n };\n case \"previousResponse\":\n return {\n id: prefill.id,\n target: prefill.target,\n when: prefill.when?.serialize(),\n apply: prefill.apply,\n source: {\n type: \"previousResponse\",\n ref: prefill.source.ref,\n ifUnsupported: prefill.source.ifUnsupported,\n },\n };\n default:\n throw new Error(\n `Unsupported prefill source type: ${(prefill.source as { type?: string }).type}`,\n );\n }\n}\n\nexport function prefillTargetsEqual(\n left: SurveyItemPrefillTarget,\n right: SurveyItemPrefillTarget,\n): boolean {\n if (left.type !== right.type) {\n return false;\n }\n\n switch (left.type) {\n case SurveyItemPrefillTargetType.itemResponse:\n return true;\n case SurveyItemPrefillTargetType.field:\n return (\n left.fieldId === (right as Extract<SurveyItemPrefillTarget, { type: \"field\" }>).fieldId\n );\n case SurveyItemPrefillTargetType.embeddedField:\n return (\n left.optionId ===\n (right as Extract<SurveyItemPrefillTarget, { type: \"embeddedField\" }>).optionId &&\n left.fieldId ===\n (right as Extract<SurveyItemPrefillTarget, { type: \"embeddedField\" }>).fieldId\n );\n default:\n return false;\n }\n}\n","import { Expression } from \"../../expressions\";\nimport { RawSurveyItem } from \"../items\";\nimport { ResponseSlotDefinition } from \"../responses/slot-definition\";\nimport { ResponseValue, ValueRefTypeLookup, ValueType } from \"../responses/value-types\";\nimport { ReferenceUsage, ReferenceUsageType, ValueReferenceMethod } from \"../utils/value-reference\";\nimport {\n DisabledConditions,\n disabledConditionsFromJson,\n DisplayConditions,\n displayConditionsFromJson,\n} from \"./utils\";\nimport {\n deserializeSurveyItemPrefill,\n prefillTargetsEqual,\n SurveyItemPrefill,\n SurveyItemPrefillTarget,\n SurveyItemPrefillTargetType,\n} from \"./prefill\";\n\n/**\n * Core contract for survey item handlers.\n * Every item type (built-in and plugin) is represented by a handler class implementing this interface.\n * The core uses these methods without any casting.\n */\nexport interface SurveyItemCoreType<TConfig = unknown> {\n readonly type: string;\n readonly id: string;\n readonly key: string;\n readonly config: TConfig;\n\n isInteractive(): boolean;\n getResponseSlotDefinitions(): ResponseSlotDefinition[];\n getAvailableResponseValueSlots(byType?: ValueType): ValueRefTypeLookup;\n}\n\n/**\n * Base class for survey item handlers.\n * Each handler holds type, id, key, and config (properly typed) and implements core methods.\n * Subclass for each item type; the core works with SurveyItemHandler only—no casting needed.\n */\nexport abstract class SurveyItemCore<\n TType extends string = string,\n TConfig = unknown,\n> implements SurveyItemCoreType<TConfig> {\n abstract readonly type: TType;\n readonly id: string;\n key: string;\n config: TConfig;\n\n private _rawItem: RawSurveyItem;\n\n displayConditions?: DisplayConditions;\n disabledConditions?: DisabledConditions;\n validations?: {\n [validationKey: string]: Expression | undefined;\n };\n prefills?: SurveyItemPrefill[];\n\n constructor(rawItem: RawSurveyItem) {\n this._rawItem = rawItem;\n this.updateExpressions();\n this.id = this._rawItem.id;\n this.key = this._rawItem.key;\n this.config = this.parseConfig(this._rawItem.config);\n }\n\n /** Parse raw config from JSON into typed config. Override in subclasses. */\n abstract parseConfig(rawConfig: unknown): TConfig;\n abstract isInteractive(): boolean;\n abstract getResponseSlotDefinitions(): ResponseSlotDefinition[];\n\n protected getAdditionalResponseValueSlots(): ValueRefTypeLookup {\n return {};\n }\n\n getAvailableResponseValueSlots(byType?: ValueType): ValueRefTypeLookup {\n const valueRefs: ValueRefTypeLookup = {};\n\n for (const slot of this.getResponseSlotDefinitions()) {\n valueRefs[`${this.id}...${ValueReferenceMethod.get}...${slot.slotId}`] = slot.valueType;\n valueRefs[`${this.id}...${ValueReferenceMethod.isDefined}...${slot.slotId}`] =\n ValueType.boolean;\n }\n\n Object.assign(valueRefs, this.getAdditionalResponseValueSlots());\n\n if (!byType) {\n return valueRefs;\n }\n\n return Object.fromEntries(\n Object.entries(valueRefs).filter(([, valueType]) => valueType === byType),\n );\n }\n\n get rawItem(): RawSurveyItem {\n return this._rawItem;\n }\n\n get metadata(): { [key: string]: string } {\n return this._rawItem.metadata ?? {};\n }\n\n set metadata(metadata: { [key: string]: string }) {\n this.updateRawItem({\n ...this._rawItem,\n metadata: metadata,\n });\n }\n\n updateRawItem(rawItem: RawSurveyItem) {\n if (rawItem.id !== this.id) {\n throw new Error(\"Cannot update raw item with a different id\");\n }\n this._rawItem = rawItem;\n this.updateExpressions();\n this.key = rawItem.key;\n this.config = this.parseConfig(rawItem.config);\n }\n\n private updateExpressions() {\n this.displayConditions = this._rawItem.displayConditions\n ? displayConditionsFromJson(this._rawItem.displayConditions)\n : undefined;\n this.disabledConditions = this._rawItem.disabledConditions\n ? disabledConditionsFromJson(this._rawItem.disabledConditions)\n : undefined;\n this.validations = this._rawItem.validations\n ? Object.fromEntries(\n Object.entries(this._rawItem.validations).map(([key, value]) => [\n key,\n Expression.deserialize(value),\n ]),\n )\n : undefined;\n this.prefills = this._rawItem.prefills?.map((prefill) => deserializeSurveyItemPrefill(prefill));\n }\n\n getReferenceUsages(): ReferenceUsage[] {\n const usages: ReferenceUsage[] = [];\n\n if (this.displayConditions) {\n // root\n for (const ref of this.displayConditions.root?.responseVariableRefs || []) {\n usages.push({\n itemId: this.id,\n usageType: ReferenceUsageType.displayConditions,\n valueReference: ref,\n });\n }\n\n // components\n for (const [componentKey, expression] of Object.entries(\n this.displayConditions.components || {},\n )) {\n for (const ref of expression?.responseVariableRefs || []) {\n usages.push({\n itemId: this.id,\n fullComponentKey: componentKey,\n usageType: ReferenceUsageType.displayConditions,\n valueReference: ref,\n });\n }\n }\n }\n\n if (this.disabledConditions) {\n for (const [componentKey, expression] of Object.entries(\n this.disabledConditions.components || {},\n )) {\n for (const ref of expression?.responseVariableRefs || []) {\n usages.push({\n itemId: this.id,\n fullComponentKey: componentKey,\n usageType: ReferenceUsageType.disabledConditions,\n valueReference: ref,\n });\n }\n }\n }\n\n if (this.validations) {\n for (const [validationKey, expression] of Object.entries(this.validations)) {\n for (const ref of expression?.responseVariableRefs || []) {\n usages.push({\n itemId: this.id,\n fullComponentKey: validationKey,\n usageType: ReferenceUsageType.validations,\n valueReference: ref,\n });\n }\n }\n }\n\n if (this.prefills) {\n for (const prefill of this.prefills) {\n for (const ref of prefill.when?.responseVariableRefs || []) {\n usages.push({\n itemId: this.id,\n fullComponentKey: prefill.id,\n usageType: ReferenceUsageType.prefills,\n valueReference: ref,\n });\n }\n\n if (prefill.source.type === \"expression\") {\n for (const ref of prefill.source.expression.responseVariableRefs || []) {\n usages.push({\n itemId: this.id,\n fullComponentKey: prefill.id,\n usageType: ReferenceUsageType.prefills,\n valueReference: ref,\n });\n }\n }\n }\n }\n\n return usages;\n }\n\n resolvePrefillTarget(target: SurveyItemPrefillTarget): ResponseSlotDefinition | undefined {\n const slotDefinitions = this.getResponseSlotDefinitions();\n const explicitMatch = slotDefinitions.find(\n (slot) => slot.prefillTarget !== undefined && prefillTargetsEqual(slot.prefillTarget, target),\n );\n if (explicitMatch) {\n return explicitMatch;\n }\n\n if (target.type === SurveyItemPrefillTargetType.itemResponse && slotDefinitions.length === 1) {\n return slotDefinitions[0];\n }\n\n return undefined;\n }\n\n normalizePrefillValue(\n _prefill: SurveyItemPrefill,\n targetSlot: ResponseSlotDefinition,\n value: ResponseValue,\n ): ResponseValue | undefined {\n return value.type === targetSlot.valueType ? value : undefined;\n }\n}\n\n/**\n * Constructor type for handler classes. Used by the registry to instantiate handlers.\n */\nexport type ItemCoreConstructor<TType extends string = string, TConfig = unknown> = new (\n rawItem: RawSurveyItem,\n) => SurveyItemCore<TType, TConfig>;\n","export enum ReservedSurveyItemTypes {\n Group = \"group\",\n PageBreak = \"page-break\",\n}\n","/**\n * SurveyItemKey stores the key of the item and the path to the item.\n */\n\nexport class SurveyItemKey {\n private _itemKey: string;\n private _path: Array<string>;\n private _keySeparator: string;\n\n constructor(itemKey: string, path: string[] | undefined, keySeparator: string = \".\") {\n this._itemKey = itemKey;\n this._path = path ?? [];\n this._keySeparator = keySeparator;\n }\n\n get itemKey(): string {\n return this._itemKey;\n }\n\n get path(): Array<string> {\n return this._path;\n }\n\n get parentFullKey(): string {\n return this._path.join(this._keySeparator);\n }\n\n get fullKey(): string {\n return [...this._path, this._itemKey].join(this._keySeparator);\n }\n\n get isRoot(): boolean {\n return this._path.length === 0;\n }\n\n get keySeparator(): string {\n return this._keySeparator;\n }\n\n set keySeparator(keySeparator: string) {\n this._keySeparator = keySeparator;\n }\n}\n","/**\n * Shared utilities for array operations.\n */\n\n/**\n * Swap two elements in an array by index.\n * @returns A new array with the elements swapped\n */\nexport function swapArrayElements<T>(arr: T[], fromIndex: number, toIndex: number): T[] {\n const result = [...arr];\n [result[fromIndex], result[toIndex]] = [result[toIndex], result[fromIndex]];\n return result;\n}\n\n/**\n * Move an element from one index to another.\n * @returns A new array with the element moved\n */\nexport function moveArrayElement<T>(arr: T[], fromIndex: number, toIndex: number): T[] {\n const result = [...arr];\n const [moved] = result.splice(fromIndex, 1);\n result.splice(toIndex, 0, moved);\n return result;\n}\n","import { ReservedSurveyItemTypes } from \"../items/types\";\nimport { ItemCoreConstructor, SurveyItemCore } from \"../items/survey-item\";\nimport { moveArrayElement, swapArrayElements } from \"../utils/group-utils\";\n\n/**\n * Group item core.\n */\nexport type GroupConfig = {\n items?: string[];\n shuffleItems?: boolean;\n isRoot?: boolean;\n};\n\nexport class GroupItemCore extends SurveyItemCore<\n typeof ReservedSurveyItemTypes.Group,\n GroupConfig\n> {\n readonly type = ReservedSurveyItemTypes.Group;\n\n parseConfig(rawConfig: unknown): GroupConfig {\n const cfg = (rawConfig ?? {}) as Partial<GroupConfig>;\n return {\n items: cfg.items,\n shuffleItems: cfg.shuffleItems,\n isRoot: cfg.isRoot,\n };\n }\n\n serializeConfig(): unknown {\n return this.config;\n }\n\n isInteractive(): boolean {\n return false;\n }\n\n getResponseSlotDefinitions() {\n return [];\n }\n\n isRoot(): boolean {\n return this.config.isRoot ?? false;\n }\n\n get items(): string[] {\n return this.config.items ?? [];\n }\n\n /**\n * Add a child item id to this group at the given index.\n * @param itemId The id of the item to add to this group.\n * @param index The index at which to add the item. If not provided, the item is added to the end of the group.\n */\n addChild(itemId: string, index?: number): void {\n const items = (this.config.items ??= []);\n const insertIndex = index !== undefined ? Math.min(index, items.length) : items.length;\n items.splice(insertIndex, 0, itemId);\n this.updateRawItem({\n ...this.rawItem,\n config: { ...this.config },\n });\n }\n\n /**\n * Remove a child item id from this group.\n * @param itemId The id of the item to remove from this group.\n */\n removeChild(itemId: string): void {\n const items = (this.config.items ??= []);\n const index = items.indexOf(itemId);\n if (index !== -1) {\n items.splice(index, 1);\n this.updateRawItem({\n ...this.rawItem,\n config: { ...this.config },\n });\n }\n }\n\n /**\n * Check if an item is a direct child of this group.\n */\n hasChild(itemId: string): boolean {\n return this.items.includes(itemId);\n }\n\n /** Whether items in this group should be shuffled. */\n get shuffleItems(): boolean {\n return this.config.shuffleItems ?? false;\n }\n\n set shuffleItems(value: boolean) {\n this.config.shuffleItems = value;\n this.updateRawItem({\n ...this.rawItem,\n config: { ...this.config },\n });\n }\n\n /**\n * Get the ordered list of child item ids.\n */\n getChildrenIds(): string[] {\n return [...this.items];\n }\n\n /**\n * Swap two items by their positions in the group.\n * @throws Error if indices are out of bounds\n */\n swapItemsByIndex(from: number, to: number): void {\n const items = this.items;\n if (from < 0 || from >= items.length || to < 0 || to >= items.length) {\n throw new Error(`Index out of bounds. Valid range is 0-${items.length - 1}`);\n }\n if (from === to) return;\n this.config.items = swapArrayElements(items, from, to);\n this.updateRawItem({\n ...this.rawItem,\n config: { ...this.config },\n });\n }\n\n /**\n * Swap two items by their ids.\n * @throws Error if either id is not found in this group\n */\n swapItemsById(id: string, withId: string): void {\n const items = this.items;\n const index1 = items.indexOf(id);\n const index2 = items.indexOf(withId);\n if (index1 === -1) {\n throw new Error(`Item '${id}' not found in group '${this.key}'`);\n }\n if (index2 === -1) {\n throw new Error(`Item '${withId}' not found in group '${this.key}'`);\n }\n this.swapItemsByIndex(index1, index2);\n }\n\n /**\n * Move an item by id to a specific index.\n * @throws Error if the item is not found or index is out of bounds\n */\n moveItemToIndex(id: string, index: number): void {\n const items = this.items;\n const fromIndex = items.indexOf(id);\n if (fromIndex === -1) {\n throw new Error(`Item '${id}' not found in group '${this.key}'`);\n }\n if (index < 0 || index >= items.length) {\n throw new Error(`Index out of bounds. Valid range is 0-${items.length - 1}`);\n }\n if (fromIndex === index) return;\n this.config.items = moveArrayElement(items, fromIndex, index);\n this.updateRawItem({\n ...this.rawItem,\n config: { ...this.config },\n });\n }\n}\n\n/**\n * Page break item core.\n */\nexport type PageBreakConfig = Record<string, never>;\n\nexport class PageBreakItemCore extends SurveyItemCore<\n typeof ReservedSurveyItemTypes.PageBreak,\n PageBreakConfig\n> {\n readonly type = ReservedSurveyItemTypes.PageBreak;\n\n parseConfig(_rawConfig: unknown): PageBreakConfig {\n return {};\n }\n\n serializeConfig(): unknown {\n return undefined;\n }\n\n isInteractive(): boolean {\n return false;\n }\n\n getResponseSlotDefinitions() {\n return [];\n }\n}\n\n/**\n * Built-in item type.\n */\nexport type BuiltInItemType =\n | typeof ReservedSurveyItemTypes.Group\n | typeof ReservedSurveyItemTypes.PageBreak;\n\nexport const builtInItemCoreRegistry: Record<BuiltInItemType, ItemCoreConstructor> = {\n [ReservedSurveyItemTypes.Group]: GroupItemCore,\n [ReservedSurveyItemTypes.PageBreak]: PageBreakItemCore,\n};\n\nexport const isBuiltInItemType = (itemType: string): itemType is BuiltInItemType =>\n itemType in builtInItemCoreRegistry;\n","import { ItemCoreConstructor, SurveyItemCore } from \"../items/survey-item\";\nimport { RawSurveyItem } from \"../items/survey-item-json\";\nimport { builtInItemCoreRegistry, isBuiltInItemType } from \"./built-in-items\";\nimport type { AnyItemExpressionDefinition } from \"../../expressions/item-expression-registry\";\n\n/**\n * Registry maps item type name → handler constructor.\n * Plugins extend this with their own handler classes.\n */\nexport type ItemTypeRegistry = Record<string, new (rawItem: RawSurveyItem) => SurveyItemCore>;\n\n/** Item type identifier (e.g. \"singleChoiceQuestion\", \"display\"). */\nexport type ItemTypeName = string;\n\n/** Capabilities of an item type (interactive, supports children). */\nexport interface ItemTypeCapabilities {\n interactive?: boolean;\n supportsChildren?: boolean;\n}\n\n/**\n * Definition of an item type: its name, constructor, and optional capabilities.\n * Used by editor/UI layers to compose registries.\n */\nexport interface ItemTypeDefinition {\n itemType: ItemTypeName;\n constructor: ItemCoreConstructor;\n capabilities?: ItemTypeCapabilities;\n expressions?: AnyItemExpressionDefinition[];\n}\n\n/** Registry mapping item type name → definition. */\nexport type ItemTypeDefinitionRegistry = Record<ItemTypeName, ItemTypeDefinition>;\n\n/** Convert constructor registry to explicit definitions for higher-layer composition. */\nexport function toItemTypeDefinitionRegistry(\n registry: ItemTypeRegistry,\n): ItemTypeDefinitionRegistry {\n return Object.fromEntries(\n Object.entries(registry).map(([itemType, constructor]) => [\n itemType,\n { itemType, constructor },\n ]),\n );\n}\n\n/**\n * Creates a handler instance for a raw survey item.\n * Uses built-in registry for group/page-break, otherwise the provided plugin registry.\n */\nexport function createItemCore(\n rawItem: RawSurveyItem,\n pluginRegistry?: ItemTypeRegistry,\n): SurveyItemCore {\n if (isBuiltInItemType(rawItem.itemType)) {\n const HandlerClass = builtInItemCoreRegistry[rawItem.itemType];\n return new HandlerClass(rawItem);\n }\n\n if (pluginRegistry && rawItem.itemType in pluginRegistry) {\n const HandlerClass = pluginRegistry[rawItem.itemType];\n return new HandlerClass(rawItem);\n }\n\n throw new Error(`Unknown item type: ${rawItem.itemType}`);\n}\n\n/**\n * Merge built-in handlers with plugin registry for a complete registry.\n */\nexport function createFullRegistry(pluginRegistry?: ItemTypeRegistry): ItemTypeRegistry {\n return {\n ...builtInItemCoreRegistry,\n ...pluginRegistry,\n };\n}\n\n/** Build full registry as explicit definitions for editor/ui composition. */\nexport function createItemTypeDefinitionRegistry(\n pluginRegistry?: ItemTypeRegistry,\n): ItemTypeDefinitionRegistry {\n return toItemTypeDefinitionRegistry(createFullRegistry(pluginRegistry));\n}\n","import { JsonTemplateValue } from \"../expressions/template-value\";\nimport { RawSurveyItem } from \"./items\";\nimport { JsonSurveyTranslations } from \"./utils/translations\";\n\nexport const CURRENT_SURVEY_SCHEMA =\n \"https://github.com/case-framework/case-survey-toolkit/packages/survey-core/schemas/survey-schema.json\";\n// TODO: generate schema from survey-core.ts\n\nexport interface SurveyVersion {\n id?: string;\n surveyKey: string;\n published?: number;\n unpublished?: number;\n versionId?: string;\n survey: RawSurvey;\n}\n\nexport type RawSurveyAsset = {\n kind: \"image\";\n source: {\n type: \"embedded\";\n mediaType: string;\n encoding: \"base64\";\n data: string;\n };\n metadata?: {\n name?: string;\n filename?: string;\n alt?: string;\n width?: number;\n height?: number;\n };\n};\n\nexport type RawSurvey = {\n $schema: string;\n maxItemsPerPage?: { large: number; small: number };\n\n surveyItems: Array<RawSurveyItem>;\n assets?: Record<string, RawSurveyAsset>;\n\n metadata?: {\n [key: string]: string;\n };\n templateValues?: {\n [templateValueKey: string]: JsonTemplateValue;\n };\n translations?: JsonSurveyTranslations;\n};\n","import { structuredCloneMethod } from \"../../utils\";\nimport { Content } from \"./content\";\n\nexport const validateLocale = (locale: string): void => {\n if (locale.trim() === \"\") {\n throw new Error(\"Locale cannot be empty\");\n }\n};\n\nexport class SurveyItemTranslations {\n private _translations?: {\n [locale: string]: JsonComponentContent;\n };\n\n constructor() {\n this._translations = {};\n }\n\n setContent(locale: string, contentKey: string, content?: Content): void {\n validateLocale(locale);\n if (!this._translations?.[locale]) {\n if (!content) {\n // No need to do anything if content is undefined\n return;\n }\n this._translations![locale] = {};\n }\n if (!content) {\n delete this._translations![locale][contentKey];\n } else {\n this._translations![locale][contentKey] = content;\n }\n }\n\n setAllForLocale(locale: string, content?: JsonComponentContent): void {\n validateLocale(locale);\n if (!this._translations?.[locale]) {\n if (!content) {\n // No need to do anything if content is undefined\n return;\n }\n this._translations![locale] = {};\n }\n this._translations![locale] = content || {};\n }\n\n get locales(): string[] {\n return Object.keys(this._translations || {});\n }\n\n getAllForLocale(locale: string): JsonComponentContent | undefined {\n return this._translations?.[locale];\n }\n\n getContent(locale: string, contentKey: string, fallbackLocale?: string): Content | undefined {\n const content = this._translations?.[locale]?.[contentKey];\n if (content) {\n return content;\n }\n if (fallbackLocale) {\n return this._translations?.[fallbackLocale]?.[contentKey];\n }\n return undefined;\n }\n\n /**\n * Create a deep clone that can be safely mutated before persisting with\n * `setItemTranslations` or `updateItemTranslations`.\n */\n clone(): SurveyItemTranslations {\n const cloned = new SurveyItemTranslations();\n\n for (const locale of this.locales) {\n const localeContent = this.getAllForLocale(locale);\n if (!localeContent) {\n continue;\n }\n\n cloned.setAllForLocale(locale, structuredCloneMethod(localeContent));\n }\n\n return cloned;\n }\n\n /**\n * Remove a single content key from every locale in this translation set.\n */\n removeContentKey(contentKey: string): void {\n for (const locale of this.locales) {\n delete this._translations?.[locale]?.[contentKey];\n }\n }\n\n /**\n * Remove every content key that is exactly the prefix or nested beneath it.\n */\n removeContentKeysWithPrefix(prefix: string): void {\n for (const locale of this.locales) {\n const localeContent = this._translations?.[locale];\n if (!localeContent) {\n continue;\n }\n\n for (const contentKey of Object.keys(localeContent)) {\n if (contentKey === prefix || contentKey.startsWith(prefix + \".\")) {\n delete localeContent[contentKey];\n }\n }\n }\n }\n\n /**\n * Remove empty locales in place.\n * Returns `undefined` when no translations remain so callers can pass the\n * result directly into `setItemTranslations` / `updateItemTranslations`.\n */\n compact(): SurveyItemTranslations | undefined {\n for (const locale of this.locales) {\n const localeContent = this._translations?.[locale];\n if (!localeContent) {\n continue;\n }\n\n if (Object.keys(localeContent).length === 0) {\n delete this._translations?.[locale];\n }\n }\n\n return this.locales.length > 0 ? this : undefined;\n }\n}\n\nexport interface SurveyCardTranslations {\n [locale: string]: SurveyCardContent;\n}\n\nexport class SurveyTranslations {\n private _translations: JsonSurveyTranslations;\n\n constructor(translations?: JsonSurveyTranslations) {\n this._translations = translations || {};\n }\n\n serialize(): JsonSurveyTranslations | undefined {\n if (this.locales.length === 0) {\n return undefined;\n }\n return this._translations;\n }\n\n get locales(): string[] {\n return Object.keys(this._translations);\n }\n\n removeLocale(locale: string): void {\n validateLocale(locale);\n delete this._translations[locale];\n }\n\n renameLocale(oldLocale: string, newLocale: string): void {\n validateLocale(oldLocale);\n validateLocale(newLocale);\n if (this._translations[oldLocale]) {\n this._translations[newLocale] = this._translations[oldLocale];\n delete this._translations[oldLocale];\n }\n }\n\n cloneLocaleAs(locale: string, newLocale: string): void {\n validateLocale(locale);\n validateLocale(newLocale);\n if (this._translations[locale]) {\n this._translations[newLocale] = structuredCloneMethod(this._translations[locale]);\n }\n }\n\n get surveyCardContent(): SurveyCardTranslations | undefined {\n const translations: SurveyCardTranslations = {};\n for (const locale of this.locales) {\n const contentForLocale = this._translations?.[locale]?.surveyCardContent;\n if (contentForLocale) {\n translations[locale] = contentForLocale as SurveyCardContent;\n }\n }\n return translations;\n }\n\n get navigationContent(): { [locale: string]: NavigationContent } | undefined {\n const translations: { [locale: string]: NavigationContent } = {};\n for (const locale of this.locales) {\n const contentForLocale = this._translations?.[locale]?.navigationContent;\n if (contentForLocale) {\n translations[locale] = contentForLocale as NavigationContent;\n }\n }\n return translations;\n }\n\n get validationMessages(): { [locale: string]: { invalidResponse?: Content } } | undefined {\n const translations: { [locale: string]: { invalidResponse?: Content } } = {};\n for (const locale of this.locales) {\n const contentForLocale = this._translations?.[locale]?.validationMessages;\n if (contentForLocale) {\n translations[locale] = contentForLocale as { invalidResponse?: Content };\n }\n }\n return translations;\n }\n\n setSurveyCardContent(locale: string, content?: SurveyCardContent): void {\n validateLocale(locale);\n if (!this._translations[locale]) {\n if (!content) {\n // No need to do anything if content is undefined\n return;\n }\n this._translations[locale] = {};\n }\n this._translations[locale].surveyCardContent = content;\n }\n\n setNavigationContent(locale: string, content?: NavigationContent): void {\n validateLocale(locale);\n if (!this._translations[locale]) {\n if (!content) {\n // No need to do anything if content is undefined\n return;\n }\n this._translations[locale] = {};\n }\n this._translations[locale].navigationContent = content;\n }\n\n setValidationMessages(locale: string, content?: { invalidResponse?: Content }): void {\n validateLocale(locale);\n if (!this._translations[locale]) {\n if (!content) {\n // No need to do anything if content is undefined\n return;\n }\n this._translations[locale] = {};\n }\n this._translations[locale].validationMessages = content;\n }\n\n getItemTranslations(itemId: string): SurveyItemTranslations | undefined {\n const itemTranslations: SurveyItemTranslations = new SurveyItemTranslations();\n for (const locale of this.locales) {\n const contentForLocale = this._translations?.[locale].itemTranslations?.[itemId];\n itemTranslations.setAllForLocale(locale, contentForLocale as JsonComponentContent);\n }\n return itemTranslations.locales.length > 0 ? itemTranslations : undefined;\n }\n\n /**\n * Persist item translations after normalizing them:\n * empty keys/locales are removed automatically, and an empty translation set\n * clears the item's stored translations entirely.\n */\n setItemTranslations(itemId: string, itemContent?: SurveyItemTranslations): void {\n const normalizedItemContent = itemContent?.clone().compact();\n\n normalizedItemContent?.locales.forEach((locale) => validateLocale(locale));\n if (!normalizedItemContent) {\n for (const locale of this.locales) {\n if (this._translations[locale].itemTranslations?.[itemId]) {\n delete this._translations[locale].itemTranslations?.[itemId];\n }\n }\n } else {\n const localesInUpdate = normalizedItemContent.locales;\n // Add new locales to the translations\n for (const locale of localesInUpdate) {\n if (!this.locales.includes(locale)) {\n this._translations[locale] = {};\n }\n }\n for (const locale of this.locales) {\n if (localesInUpdate.includes(locale)) {\n if (!this._translations[locale]) {\n this._translations[locale] = {};\n }\n if (!this._translations[locale].itemTranslations) {\n this._translations[locale].itemTranslations = {};\n }\n this._translations[locale].itemTranslations![itemId] =\n normalizedItemContent.getAllForLocale(locale)!;\n } else {\n delete this._translations[locale].itemTranslations?.[itemId];\n }\n }\n }\n }\n\n /**\n * Rename a component key (within an item) - update key in all translations and remove old key\n * @param itemKey - The key of the item\n * @param oldKey - The old key of the component\n * @param newKey - The new key of the component\n */\n onComponentKeyChanged(itemKey: string, oldKey: string, newKey: string): void {\n for (const locale of this.locales) {\n const itemTranslations = this._translations?.[locale].itemTranslations?.[\n itemKey\n ] as JsonComponentContent;\n if (itemTranslations) {\n for (const key of Object.keys(itemTranslations)) {\n if (key.startsWith(oldKey + \".\") || key === oldKey) {\n itemTranslations[key.replace(oldKey, newKey)] = { ...itemTranslations[key] };\n delete itemTranslations[key];\n }\n }\n }\n }\n }\n\n /**\n * Remove all translations for a component\n * @param itemId - The id of the item\n * @param componentKey - The key of the component\n */\n onComponentDeleted(itemId: string, componentKey: string): void {\n for (const locale of this.locales) {\n const itemTranslations = this._translations?.[locale].itemTranslations?.[itemId];\n if (itemTranslations) {\n for (const key of Object.keys(itemTranslations)) {\n if (key.startsWith(componentKey + \".\") || key === componentKey) {\n delete itemTranslations[key as keyof typeof itemTranslations];\n }\n }\n }\n }\n }\n\n /**\n * Remove all translations for an item\n * @param id - The id of the item\n */\n onItemDeleted(id: string): void {\n for (const locale of this.locales) {\n delete this._translations![locale].itemTranslations?.[id];\n }\n }\n}\n\n/**\n * Json Schemas for translations\n */\nexport type JsonComponentContent = {\n [contentKey: string]: Content;\n};\n\nexport interface SurveyCardContent {\n name?: Content;\n description?: Content;\n typicalDuration?: Content;\n}\n\nexport interface NavigationContent {\n previousButtonText?: Content;\n nextButtonText?: Content;\n submitButtonText?: Content;\n pageIndicatorText?: Content;\n submitBoxMessage?: Content;\n}\n\nexport interface JsonSurveyTranslations {\n [locale: string]: {\n surveyCardContent?: SurveyCardContent;\n navigationContent?: NavigationContent;\n validationMessages?: {\n invalidResponse?: Content;\n };\n itemTranslations?: {\n [itemId: string]: JsonComponentContent;\n };\n };\n}\n","export enum ContentType {\n richText = \"richText\",\n plain = \"plain\",\n md = \"md\",\n}\n\nexport type ContentAttributes = Record<string, unknown>;\n\nexport type TextAlignment = \"left\" | \"center\" | \"right\" | \"justify\";\n\nexport type RichTextStyle = {\n weight?: \"strong\" | \"normal\";\n italic?: \"italic\" | \"normal\";\n underline?: \"underline\" | \"none\";\n color?: \"primary\" | \"accent\" | \"default\";\n};\n\nexport type RichTextTextInline = {\n type: \"text\";\n text: string;\n style?: RichTextStyle;\n attrs?: ContentAttributes;\n};\n\nexport type RichTextTemplateInline = {\n type: \"template\";\n key: string;\n style?: RichTextStyle;\n attrs?: ContentAttributes;\n};\n\nexport type RichTextLineBreakInline = {\n type: \"lineBreak\";\n attrs?: ContentAttributes;\n};\n\n/** Inline nodes allowed inside a {@link RichTextLinkInline} (no nested links). */\nexport type RichTextLinkChildInline =\n | RichTextTextInline\n | RichTextTemplateInline\n | RichTextLineBreakInline;\n\nexport type RichTextLinkInline = {\n type: \"link\";\n href: string;\n target?: string | null;\n rel?: string | null;\n title?: string | null;\n attrs?: ContentAttributes;\n children: RichTextLinkChildInline[];\n};\n\nexport type RichTextInlineExtension = {\n type: \"inlineExtension\";\n name: string;\n attrs?: ContentAttributes;\n};\n\nexport type RichTextInlineNode =\n | RichTextTextInline\n | RichTextTemplateInline\n | RichTextLinkInline\n | RichTextLineBreakInline\n | RichTextInlineExtension;\n\nexport type RichTextParagraphBlock = {\n type: \"paragraph\";\n children: RichTextInlineNode[];\n alignment?: TextAlignment;\n attrs?: ContentAttributes;\n};\n\nexport type RichTextHeadingBlock = {\n type: \"heading\";\n level: 1 | 2 | 3 | 4 | 5 | 6;\n children: RichTextInlineNode[];\n alignment?: TextAlignment;\n attrs?: ContentAttributes;\n};\n\nexport type RichTextListItemBlock = {\n type: \"listItem\";\n children: RichTextParagraphBlock[];\n attrs?: ContentAttributes;\n};\n\nexport type RichTextBulletListBlock = {\n type: \"bulletList\";\n items: RichTextListItemBlock[];\n attrs?: ContentAttributes;\n};\n\nexport type SurveyContentImageSource =\n | {\n type: \"external\";\n url: string;\n }\n | {\n type: \"asset\";\n assetId: string;\n };\n\nexport type RichTextImageDimension = { unit: \"px\"; value: number } | { unit: \"%\"; value: number };\n\nexport type RichTextImageSize = {\n width?: RichTextImageDimension;\n maxWidth?: RichTextImageDimension;\n};\n\nexport type RichTextImageBlock = {\n type: \"image\";\n source: SurveyContentImageSource;\n alt?: string;\n caption?: RichTextParagraphBlock[];\n size?: RichTextImageSize;\n alignment?: TextAlignment;\n attrs?: ContentAttributes;\n};\n\nexport type RichTextInfoBoxBlock = {\n type: \"infoBox\";\n tone?: \"info\" | \"warning\";\n title?: RichTextInlineNode[];\n collapsible?: boolean;\n defaultOpen?: boolean;\n children: RichTextParagraphBlock[];\n attrs?: ContentAttributes;\n};\n\nexport type RichTextSeparatorBlock = {\n type: \"separator\";\n attrs?: ContentAttributes;\n};\n\nexport type RichTextBlockExtension = {\n type: \"blockExtension\";\n name: string;\n attrs?: ContentAttributes;\n};\n\nexport type RichTextBlockNode =\n | RichTextParagraphBlock\n | RichTextHeadingBlock\n | RichTextBulletListBlock\n | RichTextImageBlock\n | RichTextInfoBoxBlock\n | RichTextSeparatorBlock\n | RichTextBlockExtension;\n\nexport type RichTextDocument = {\n type: \"doc\";\n blocks: RichTextBlockNode[];\n};\n\nexport type RichTextContent = {\n type: ContentType.richText;\n version: 1;\n doc: RichTextDocument;\n};\n\nexport type MDContent = {\n type: ContentType.md;\n content: string;\n};\n\nexport type PlainTextContent = {\n type: ContentType.plain;\n content: string;\n};\n\nexport type Content = RichTextContent | MDContent | PlainTextContent;\nexport type RichTextInline = RichTextInlineNode;\n\nexport interface ContentAssetUsage {\n assetId: string;\n blockIndex: number;\n}\n\nexport function hasRenderableRichTextBlock(block: RichTextBlockNode): boolean {\n switch (block.type) {\n case \"paragraph\":\n return block.children.length > 0;\n case \"heading\":\n return block.children.length > 0;\n case \"bulletList\":\n return block.items.some((item) =>\n item.children.some((paragraph) => paragraph.children.length > 0),\n );\n case \"image\":\n return true;\n case \"infoBox\":\n // Empty callouts are still intentional blocks (editor inserts title/body later).\n return true;\n case \"separator\":\n return true;\n case \"blockExtension\":\n return true;\n }\n}\n\nexport function hasRenderableRichTextContent(content: RichTextContent): boolean {\n return content.doc.blocks.some((block) => hasRenderableRichTextBlock(block));\n}\n\nexport function createRichTextContent(text = \"\"): RichTextContent {\n return {\n type: ContentType.richText,\n version: 1,\n doc: {\n type: \"doc\",\n blocks: [\n {\n type: \"paragraph\",\n children:\n text.length > 0\n ? text.split(\"\\n\").flatMap<RichTextInlineNode>((line, index) => {\n const parts: RichTextInlineNode[] = [];\n if (index > 0) {\n parts.push({ type: \"lineBreak\" });\n }\n if (line.length > 0) {\n parts.push({ type: \"text\", text: line });\n }\n return parts;\n })\n : [],\n },\n ],\n },\n };\n}\n\nfunction getPlainTextFromLinkChildren(children: RichTextLinkChildInline[]): string {\n return children\n .map((inline) => {\n switch (inline.type) {\n case \"text\":\n return inline.text;\n case \"template\":\n return `{${inline.key}}`;\n case \"lineBreak\":\n return \"\\n\";\n }\n })\n .join(\"\");\n}\n\nfunction getPlainTextFromInlineNodes(inlines: RichTextInlineNode[]): string {\n return inlines\n .map((inline) => {\n switch (inline.type) {\n case \"text\":\n return inline.text;\n case \"template\":\n return `{${inline.key}}`;\n case \"link\":\n return getPlainTextFromLinkChildren(inline.children);\n case \"lineBreak\":\n return \"\\n\";\n case \"inlineExtension\":\n return \"\";\n }\n })\n .join(\"\");\n}\n\nfunction getPlainTextFromParagraphs(paragraphs: RichTextParagraphBlock[]): string {\n return paragraphs.map((paragraph) => getPlainTextFromInlineNodes(paragraph.children)).join(\"\\n\");\n}\n\nfunction getPlainTextFromBlock(block: RichTextBlockNode): string {\n switch (block.type) {\n case \"paragraph\":\n return getPlainTextFromInlineNodes(block.children);\n case \"heading\":\n return getPlainTextFromInlineNodes(block.children);\n case \"bulletList\":\n return block.items.map((item) => getPlainTextFromParagraphs(item.children)).join(\"\\n\");\n case \"image\": {\n const captionText = block.caption ? getPlainTextFromParagraphs(block.caption) : \"\";\n return [block.alt ?? \"\", captionText].filter(Boolean).join(\"\\n\");\n }\n case \"infoBox\": {\n const titleText = block.title ? getPlainTextFromInlineNodes(block.title) : \"\";\n const bodyText = getPlainTextFromParagraphs(block.children);\n return [titleText, bodyText].filter(Boolean).join(\"\\n\");\n }\n case \"separator\":\n return \"\";\n case \"blockExtension\":\n return \"\";\n }\n}\n\nexport function getPlainTextFromRichTextContent(content: RichTextContent): string {\n return content.doc.blocks\n .map((block) => getPlainTextFromBlock(block))\n .filter((text) => text.length > 0)\n .join(\"\\n\")\n .trim();\n}\n\nexport function getContentPlainText(content?: Content): string {\n if (!content) {\n return \"\";\n }\n\n if (content.type !== ContentType.richText) {\n return content.content ?? \"\";\n }\n\n return getPlainTextFromRichTextContent(content);\n}\n\nexport function isContentEmpty(content?: Content): boolean {\n if (!content) {\n return true;\n }\n\n if (content.type !== ContentType.richText) {\n return content.content.trim().length === 0;\n }\n\n return !hasRenderableRichTextContent(content);\n}\n\nexport function getAssetUsagesFromContent(content?: Content): ContentAssetUsage[] {\n if (!content || content.type !== ContentType.richText) {\n return [];\n }\n\n const usages: ContentAssetUsage[] = [];\n\n content.doc.blocks.forEach((block, blockIndex) => {\n if (block.type === \"image\" && block.source.type === \"asset\") {\n usages.push({\n assetId: block.source.assetId,\n blockIndex,\n });\n }\n });\n\n return usages;\n}\n","import { CURRENT_SURVEY_SCHEMA, RawSurvey, RawSurveyAsset } from \"./survey-file-schema\";\nimport { SurveyItemTranslations, SurveyTranslations } from \"./utils/translations\";\nimport { SurveyItemCore, RawSurveyItem, ReservedSurveyItemTypes } from \"./items\";\nimport { ReferenceUsage, ReferenceUsageType } from \"./utils/value-reference\";\nimport { Content, getAssetUsagesFromContent } from \"./utils/content\";\nimport { SurveyItemKey } from \"./item-key\";\nimport {\n deserializeTemplateValues,\n serializeTemplateValues,\n TemplateValueDefinition,\n} from \"../expressions/template-value\";\nimport { ValueRefTypeLookup, ValueType } from \"./responses/value-types\";\nimport { ResponseSlotDefinition } from \"./responses/slot-definition\";\nimport { createItemCore, ItemTypeRegistry } from \"./registry/item-registry\";\nimport { GroupItemCore } from \"./registry/built-in-items\";\nimport { generateId, structuredCloneMethod } from \"../utils\";\n\nexport interface SurveyAssetUsage {\n assetId: string;\n itemId?: string;\n locale?: string;\n contentKey: string;\n usageScope: \"itemTranslation\" | \"surveyCard\" | \"navigation\" | \"validationMessages\";\n blockIndex: number;\n}\n\nexport class Survey {\n maxItemsPerPage?: { large: number; small: number };\n metadata?: {\n [key: string]: string;\n };\n surveyItems: Map<string, SurveyItemCore> = new Map();\n private _templateValues?: Map<string, TemplateValueDefinition> = new Map();\n private _assets?: Map<string, RawSurveyAsset> = new Map();\n\n private _translations?: SurveyTranslations;\n\n constructor(private readonly pluginRegistry?: ItemTypeRegistry) {\n this._translations = new SurveyTranslations();\n }\n\n /** Plugin registry used when parsing items. Exposed for editors that re-parse without their own registry. */\n getPluginRegistry(): ItemTypeRegistry | undefined {\n return this.pluginRegistry;\n }\n\n /**\n * Create a survey item from raw JSON data.\n * Uses the survey's plugin registry when available.\n */\n createItemFromRaw(rawItem: RawSurveyItem): SurveyItemCore {\n return createItemCore(rawItem, this.pluginRegistry);\n }\n\n /**\n * Create a minimal blank survey with a root group and one empty page.\n */\n static createBlankSurvey(pluginRegistry?: ItemTypeRegistry, surveyKey?: string): Survey {\n const newKey = surveyKey ?? \"survey\";\n const rawSurvey: RawSurvey = {\n $schema: CURRENT_SURVEY_SCHEMA,\n surveyItems: [\n {\n id: generateId(),\n key: newKey,\n itemType: ReservedSurveyItemTypes.Group,\n config: { isRoot: true, items: [], shuffleItems: false },\n },\n ],\n };\n\n return Survey.fromJson(rawSurvey, pluginRegistry);\n }\n\n static fromJson(json: RawSurvey, pluginRegistry?: ItemTypeRegistry): Survey {\n const survey = new Survey(pluginRegistry);\n const rawSurvey = json as RawSurvey;\n if (rawSurvey.$schema !== CURRENT_SURVEY_SCHEMA) {\n throw new Error(`Unsupported survey schema: ${rawSurvey.$schema}`);\n }\n\n survey.surveyItems = new Map();\n if (!rawSurvey.surveyItems || rawSurvey.surveyItems.length === 0) {\n throw new Error(\"surveyItems is required\");\n }\n rawSurvey.surveyItems.forEach((item) => {\n const surveyItem = createItemCore(item, pluginRegistry);\n survey.surveyItems.set(surveyItem.id, surveyItem);\n });\n\n // Parse other fields\n if (rawSurvey.templateValues) {\n survey._templateValues = deserializeTemplateValues(rawSurvey.templateValues);\n }\n\n if (rawSurvey.assets) {\n survey._assets = new Map(Object.entries(rawSurvey.assets));\n }\n\n survey._translations = new SurveyTranslations(rawSurvey.translations);\n\n if (rawSurvey.maxItemsPerPage) {\n survey.maxItemsPerPage = rawSurvey.maxItemsPerPage;\n }\n\n if (rawSurvey.metadata) {\n survey.metadata = rawSurvey.metadata;\n }\n\n return survey;\n }\n\n serialize(): RawSurvey {\n const json: RawSurvey = {\n $schema: CURRENT_SURVEY_SCHEMA,\n surveyItems: Array.from(this.surveyItems.values()).map((item) => item.rawItem),\n };\n\n // Export other fields\n json.translations = this._translations?.serialize();\n\n if (this._templateValues) {\n json.templateValues = serializeTemplateValues(this._templateValues);\n }\n\n if (this._assets && this._assets.size > 0) {\n json.assets = Object.fromEntries(this._assets.entries());\n }\n\n if (this.maxItemsPerPage) {\n json.maxItemsPerPage = this.maxItemsPerPage;\n }\n if (this.metadata) {\n json.metadata = this.metadata;\n }\n\n return json;\n }\n\n get surveyKey(): string | undefined {\n const rootItem = this.rootItem;\n if (!rootItem) {\n return undefined;\n }\n return this.rootItem.key;\n }\n\n get locales(): string[] {\n return this._translations?.locales || [];\n }\n\n get rootItem(): GroupItemCore | undefined {\n const rootItem = Array.from(this.surveyItems.values()).find(\n (item) => item instanceof GroupItemCore && item.isRoot,\n ) as GroupItemCore | undefined;\n return rootItem;\n }\n\n get keyIndex(): Array<{ itemId: string; key: string; keyPath: string[]; path: string[] }> {\n const index: Array<{ itemId: string; key: string; keyPath: string[]; path: string[] }> = [];\n for (const item of this.surveyItems.values()) {\n const path = this.getItemPath(item.id);\n index.push({\n itemId: item.id,\n key: item.key,\n keyPath: path.map((id) => this.surveyItems.get(id)?.key ?? \"\"),\n path: path,\n });\n }\n return index;\n }\n\n getItemPath(itemId: string): string[] {\n const item = this.surveyItems.get(itemId);\n if (!item) {\n throw new Error(`Item ${itemId} not found`);\n }\n\n if (item instanceof GroupItemCore && item.isRoot()) {\n return [];\n }\n\n // find parent item for the given item id\n const parentItem = this.getParentItem(itemId);\n if (!parentItem) {\n throw new Error(`Parent item for ${itemId} not found`);\n }\n return [...this.getItemPath(parentItem.id), parentItem.id];\n }\n\n getItemKey(itemId: string): SurveyItemKey | undefined {\n const item = this.surveyItems.get(itemId);\n if (!item) {\n return undefined;\n }\n const idPath = this.getItemPath(itemId);\n const keyPath = idPath.map((id) => this.surveyItems.get(id)?.key ?? \"\");\n return new SurveyItemKey(item.key, keyPath);\n }\n\n getParentItem(itemId: string): GroupItemCore | undefined {\n const item = this.surveyItems.get(itemId);\n if (!item) {\n throw new Error(`Item ${itemId} not found`);\n }\n if (item instanceof GroupItemCore && item.isRoot()) {\n return undefined;\n }\n const parentItem = Array.from(this.surveyItems.values()).find(\n (item) => item instanceof GroupItemCore && item.config.items?.includes(itemId),\n ) as GroupItemCore | undefined;\n if (!parentItem) {\n return undefined;\n }\n return parentItem;\n }\n\n getChildrenItems(parentId: string): SurveyItemCore[] {\n const parentItem = this.surveyItems.get(parentId);\n if (!parentItem || !(parentItem instanceof GroupItemCore)) {\n return [];\n }\n return (\n ((parentItem as GroupItemCore).config.items\n ?.map((id) => this.surveyItems.get(id))\n ?.filter((item) => item !== undefined) as SurveyItemCore[]) || []\n );\n }\n\n getSiblings(itemId: string): SurveyItemCore[] {\n const item = this.surveyItems.get(itemId);\n if (!item) {\n return [];\n }\n const parentItem = this.getParentItem(itemId);\n return (\n (parentItem?.items\n ?.map((id) => this.surveyItems.get(id))\n ?.filter((item) => item !== undefined) as SurveyItemCore[]) || []\n );\n }\n\n get translations(): SurveyTranslations {\n if (!this._translations) {\n this._translations = new SurveyTranslations();\n }\n return this._translations;\n }\n\n getItemTranslations(id: string): SurveyItemTranslations | undefined {\n const item = this.surveyItems.get(id);\n if (!item) {\n throw new Error(`Item ${id} not found`);\n }\n\n return this._translations?.getItemTranslations(id);\n }\n\n getTemplateValue(templateValueKey: string): TemplateValueDefinition | undefined {\n return this._templateValues?.get(templateValueKey);\n }\n\n setTemplateValue(templateValueKey: string, templateValue: TemplateValueDefinition) {\n if (!this._templateValues) {\n this._templateValues = new Map();\n }\n this._templateValues?.set(templateValueKey, templateValue);\n }\n\n deleteTemplateValue(templateValueKey: string) {\n this._templateValues?.delete(templateValueKey);\n }\n\n getTemplateValueKeys(): string[] {\n return Array.from(this._templateValues?.keys() || []);\n }\n\n getAsset(assetId: string): RawSurveyAsset | undefined {\n const asset = this._assets?.get(assetId);\n return asset ? structuredCloneMethod(asset) : undefined;\n }\n\n setAsset(assetId: string, asset: RawSurveyAsset): void {\n if (!this._assets) {\n this._assets = new Map();\n }\n\n this._assets.set(assetId, structuredCloneMethod(asset));\n }\n\n deleteAsset(assetId: string): void {\n this._assets?.delete(assetId);\n }\n\n hasAsset(assetId: string): boolean {\n return this._assets?.has(assetId) ?? false;\n }\n\n getAssetIds(): string[] {\n return Array.from(this._assets?.keys() || []);\n }\n\n getAssets(): Map<string, RawSurveyAsset> {\n return new Map(\n Array.from(this._assets?.entries() || []).map(([assetId, asset]) => [\n assetId,\n structuredCloneMethod(asset),\n ]),\n );\n }\n\n getAssetUsages(filterAssetId?: string): SurveyAssetUsage[] {\n const usages: SurveyAssetUsage[] = [];\n const pushContentUsages = (\n content: Content | undefined,\n usageScope: SurveyAssetUsage[\"usageScope\"],\n contentKey: string,\n locale?: string,\n itemId?: string,\n ) => {\n for (const usage of getAssetUsagesFromContent(content)) {\n if (filterAssetId && usage.assetId !== filterAssetId) {\n continue;\n }\n\n usages.push({\n assetId: usage.assetId,\n itemId,\n locale,\n contentKey,\n usageScope,\n blockIndex: usage.blockIndex,\n });\n }\n };\n\n const serializedTranslations = this._translations?.serialize();\n const rootItemId = this.rootItem?.id;\n\n if (!serializedTranslations) {\n return usages;\n }\n\n for (const [locale, localeTranslations] of Object.entries(serializedTranslations)) {\n for (const [contentKey, content] of Object.entries(\n localeTranslations.surveyCardContent || {},\n )) {\n pushContentUsages(content, \"surveyCard\", contentKey, locale, rootItemId);\n }\n\n for (const [contentKey, content] of Object.entries(\n localeTranslations.navigationContent || {},\n )) {\n pushContentUsages(content, \"navigation\", contentKey, locale, rootItemId);\n }\n\n for (const [contentKey, content] of Object.entries(\n localeTranslations.validationMessages || {},\n )) {\n pushContentUsages(content, \"validationMessages\", contentKey, locale, rootItemId);\n }\n\n for (const [itemId, itemTranslations] of Object.entries(\n localeTranslations.itemTranslations || {},\n )) {\n for (const [contentKey, content] of Object.entries(itemTranslations || {})) {\n pushContentUsages(content, \"itemTranslation\", contentKey, locale, itemId);\n }\n }\n }\n\n return usages;\n }\n\n getAvailableResponseValueSlots(byType?: ValueType): ValueRefTypeLookup {\n let valueRefs: ValueRefTypeLookup = {};\n for (const item of this.surveyItems.values()) {\n valueRefs = { ...valueRefs, ...item.getAvailableResponseValueSlots(byType) };\n }\n return valueRefs;\n }\n\n getResponseSlotDefinitions(): Array<{ itemId: string; slots: ResponseSlotDefinition[] }> {\n return Array.from(this.surveyItems.values()).map((item) => ({\n itemId: item.id,\n slots: item.getResponseSlotDefinitions(),\n }));\n }\n\n /**\n * Get all reference usages for the survey\n * @param forItemId - optional item id to filter usages for a specific item and its children (if not provided, all usages are returned)\n * @returns all reference usages for the survey (or for a specific item and its children)\n */\n getReferenceUsages(forItemId?: string): ReferenceUsage[] {\n const usages: ReferenceUsage[] = [];\n for (const item of this.surveyItems.values()) {\n if (forItemId && item.id !== forItemId && !this.isDescendantOf(item.id, forItemId)) {\n continue;\n }\n usages.push(...item.getReferenceUsages());\n }\n\n if (this._templateValues) {\n for (const [templateValueKey, templateValue] of this._templateValues.entries()) {\n for (const ref of templateValue.expression?.responseVariableRefs || []) {\n usages.push({\n itemId: templateValueKey,\n usageType: ReferenceUsageType.templateValues,\n valueReference: ref,\n });\n }\n }\n }\n\n return usages;\n }\n\n // Helper method to check if targetId is a descendant of ancestorId\n isDescendantOf(targetId: string, ancestorId: string): boolean {\n if (targetId === ancestorId) {\n return true;\n }\n const targetPath = this.getItemPath(targetId);\n return targetPath.includes(ancestorId);\n }\n}\n"],"mappings":";AAAA,SAAS,WAAW,MAAsB;CACxC,IAAI,OAAO;AAEX,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,UAAQ,KAAK,WAAW,EAAE;AAC1B,SAAO,KAAK,KAAK,MAAM,SAAS;;AAGlC,QAAO,SAAS;;AAGlB,SAAgB,mBAAmB,MAA4B;CAC7D,IAAI,QAAQ,WAAW,KAAK;AAE5B,cAAa;AACX,UAAS,QAAQ,eAAgB;EACjC,IAAI,OAAO;AACX,SAAO,KAAK,KAAK,OAAQ,SAAS,IAAK,OAAO,EAAE;AAChD,UAAQ,OAAO,KAAK,KAAK,OAAQ,SAAS,GAAI,OAAO,GAAG;AACxD,WAAS,OAAQ,SAAS,QAAS,KAAK;;;AAI5C,SAAgB,aAAgB,QAAsB,SAAuB,KAAK,QAAa;CAC7F,MAAM,iBAAiB,CAAC,GAAG,OAAO;AAElC,MAAK,IAAI,IAAI,eAAe,SAAS,GAAG,IAAI,GAAG,KAAK;EAClD,MAAM,IAAI,KAAK,MAAM,QAAQ,IAAI,IAAI,GAAG;AACxC,GAAC,eAAe,IAAI,eAAe,MAAM,CAAC,eAAe,IAAI,eAAe,GAAG;;AAGjF,QAAO;;;;;;;AAQT,SAAgB,eAAe,QAAgB,SAAuB,KAAK,QAAkB;AAC3F,QAAO,aACL,MAAM,KAAK,EAAE,QAAQ,GAAG,GAAG,MAAM,EAAE,EACnC,OACD;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