@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.
- package/README.md +31 -34
- package/build/editor.d.mts +31 -12
- package/build/editor.d.mts.map +1 -1
- package/build/editor.mjs +26 -1
- package/build/editor.mjs.map +1 -1
- package/build/index.d.mts +10 -10
- package/build/index.d.mts.map +1 -1
- package/build/index.mjs +1 -1
- package/build/index.mjs.map +1 -1
- package/build/package.json +26 -26
- package/build/{survey-DShEOjyz.d.mts → survey-BV8YHc3J.d.mts} +29 -29
- package/build/survey-BV8YHc3J.d.mts.map +1 -0
- package/build/{survey-yXdl8xkf.mjs → survey-DnLtf19j.mjs} +2 -2
- package/build/survey-DnLtf19j.mjs.map +1 -0
- package/package.json +21 -21
- package/build/survey-DShEOjyz.d.mts.map +0 -1
- package/build/survey-yXdl8xkf.mjs.map +0 -1
package/build/editor.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.mjs","names":[],"sources":["../src/editor/ai-context.ts","../src/editor/item-copy-paste.ts","../src/editor/undo-redo.ts","../src/editor/survey-editor.ts"],"sourcesContent":["import { GroupItemCore } from \"../survey/registry/built-in-items\";\nimport type { RawSurvey } from \"../survey/survey-file-schema\";\nimport { Survey } from \"../survey/survey\";\nimport { getContentPlainText, type Content } from \"../survey/utils/content\";\n\nexport type SurveyAIContextScope = \"tiny\" | \"focused\" | \"full\";\nexport type SurveyAIContextPurpose =\n | \"generic\"\n | \"key-suggestion\"\n | \"label-suggestion\"\n | \"item-generation\"\n | \"translation\"\n | \"condition-management\";\n\nexport interface SurveyAIOutlineNode {\n itemId: string;\n parentId?: string;\n depth: number;\n itemType: string;\n key: string;\n fullKey: string;\n itemLabel?: string;\n childCount: number;\n}\n\nexport interface SurveyAIFocus {\n focusItemId: string;\n parentItemId?: string;\n pathItemIds: string[];\n siblingItemIds: string[];\n childItemIds: string[];\n}\n\nexport interface SurveyAITranslationSnippet {\n locale: string;\n contentKey: string;\n text: string;\n}\n\nexport interface SurveyAIItemContextNode {\n itemId: string;\n itemType: string;\n itemKey: string;\n fullKey: string;\n itemLabel?: string;\n siblingKeys: string[];\n translations: SurveyAITranslationSnippet[];\n descendants: SurveyAIItemContextNode[];\n}\n\nexport interface SurveyAIKeyIndexEntry {\n itemId: string;\n itemType: string;\n key: string;\n fullKey: string;\n itemLabel?: string;\n path: string[];\n}\n\nexport interface SurveyAIContextIndexes {\n keyIndex: SurveyAIKeyIndexEntry[];\n responseSlots?: string[];\n}\n\nexport interface SurveyAIContextPack {\n purpose: SurveyAIContextPurpose;\n scope: SurveyAIContextScope;\n surveyKey?: string;\n locales: string[];\n itemCount: number;\n outline: SurveyAIOutlineNode[];\n focus?: SurveyAIFocus;\n focusItem?: SurveyAIItemContextNode;\n indexes?: SurveyAIContextIndexes;\n flags: {\n outlineTruncated: boolean;\n rawSurveyIncluded: boolean;\n focusItemTreeTruncated: boolean;\n };\n rawSurvey?: RawSurvey;\n}\n\nexport interface BuildSurveyAIContextPackOptions {\n purpose?: SurveyAIContextPurpose;\n scope?: SurveyAIContextScope;\n focusItemId?: string;\n includeRawSurvey?: boolean;\n outlineLimit?: number;\n includeIndexes?: boolean;\n includeFocusItemTree?: boolean;\n focusItemTreeLimit?: number;\n translationSnippetsPerItemLimit?: number;\n translationSnippetTextLimit?: number;\n}\n\nconst DEFAULT_SCOPE_LIMITS: Record<SurveyAIContextScope, number> = {\n tiny: 40,\n focused: 150,\n full: 500,\n};\n\nconst DEFAULT_FOCUS_TREE_LIMIT = 120;\nconst DEFAULT_TRANSLATION_SNIPPETS_PER_ITEM = 8;\nconst DEFAULT_TRANSLATION_SNIPPET_TEXT_LIMIT = 120;\n\nconst PURPOSE_DEFAULTS: Record<\n SurveyAIContextPurpose,\n {\n scope: SurveyAIContextScope;\n includeRawSurvey: boolean;\n includeIndexes: boolean;\n includeFocusItemTree: boolean;\n }\n> = {\n generic: {\n scope: \"tiny\",\n includeRawSurvey: false,\n includeIndexes: false,\n includeFocusItemTree: false,\n },\n \"key-suggestion\": {\n scope: \"tiny\",\n includeRawSurvey: false,\n includeIndexes: false,\n includeFocusItemTree: true,\n },\n \"label-suggestion\": {\n scope: \"tiny\",\n includeRawSurvey: false,\n includeIndexes: false,\n includeFocusItemTree: true,\n },\n \"item-generation\": {\n scope: \"focused\",\n includeRawSurvey: false,\n includeIndexes: true,\n includeFocusItemTree: true,\n },\n translation: {\n scope: \"focused\",\n includeRawSurvey: false,\n includeIndexes: true,\n includeFocusItemTree: true,\n },\n \"condition-management\": {\n scope: \"full\",\n includeRawSurvey: true,\n includeIndexes: true,\n includeFocusItemTree: true,\n },\n};\n\nconst sortByItemId = <T extends { itemId: string }>(items: T[]): T[] =>\n [...items].sort((a, b) => a.itemId.localeCompare(b.itemId));\n\nfunction getChildIds(survey: Survey, itemId: string): string[] {\n const item = survey.surveyItems.get(itemId);\n if (!(item instanceof GroupItemCore)) {\n return [];\n }\n return [...(item.items ?? [])];\n}\n\nfunction buildParentLookup(survey: Survey): Map<string, string> {\n const lookup = new Map<string, string>();\n for (const item of survey.surveyItems.values()) {\n if (!(item instanceof GroupItemCore)) {\n continue;\n }\n for (const childId of item.items ?? []) {\n lookup.set(childId, item.id);\n }\n }\n return lookup;\n}\n\nfunction createFullKeyGetter(survey: Survey, parentLookup: Map<string, string>) {\n const fullKeyCache = new Map<string, string>();\n\n const getFullKey = (itemId: string, stack = new Set<string>()): string => {\n const cached = fullKeyCache.get(itemId);\n if (cached) {\n return cached;\n }\n\n const item = survey.surveyItems.get(itemId);\n if (!item) {\n return itemId;\n }\n\n if (stack.has(itemId)) {\n return item.key;\n }\n\n const parentId = parentLookup.get(itemId);\n if (!parentId) {\n fullKeyCache.set(itemId, item.key);\n return item.key;\n }\n\n stack.add(itemId);\n const parentFullKey = getFullKey(parentId, stack);\n stack.delete(itemId);\n const fullKey = `${parentFullKey}.${item.key}`;\n fullKeyCache.set(itemId, fullKey);\n return fullKey;\n };\n\n return getFullKey;\n}\n\nfunction buildFullOutline(\n survey: Survey,\n parentLookup: Map<string, string>,\n getFullKey: (itemId: string) => string,\n): SurveyAIOutlineNode[] {\n const outline: SurveyAIOutlineNode[] = [];\n const visited = new Set<string>();\n\n const toNode = (itemId: string, depth: number): SurveyAIOutlineNode | undefined => {\n const item = survey.surveyItems.get(itemId);\n if (!item) {\n return undefined;\n }\n const childCount = item instanceof GroupItemCore ? item.items.length : 0;\n return {\n itemId,\n parentId: parentLookup.get(itemId),\n depth,\n itemType: item.type,\n key: item.key,\n fullKey: getFullKey(itemId),\n itemLabel: item.metadata?.itemLabel,\n childCount,\n };\n };\n\n const visit = (itemId: string, depth: number) => {\n if (visited.has(itemId)) {\n return;\n }\n visited.add(itemId);\n const node = toNode(itemId, depth);\n if (node) {\n outline.push(node);\n }\n for (const childId of getChildIds(survey, itemId)) {\n visit(childId, depth + 1);\n }\n };\n\n const root = survey.rootItem;\n if (root) {\n visit(root.id, 0);\n }\n\n const remaining = sortByItemId(\n Array.from(survey.surveyItems.values())\n .filter((item) => !visited.has(item.id))\n .map((item) => ({ itemId: item.id })),\n );\n for (const item of remaining) {\n visit(item.itemId, 0);\n }\n\n return outline;\n}\n\nfunction collectTinyScopeIds(survey: Survey, focusItemId: string): Set<string> {\n const ids = new Set<string>();\n const rootItem = survey.rootItem;\n if (rootItem) {\n ids.add(rootItem.id);\n }\n\n ids.add(focusItemId);\n for (const id of survey.getItemPath(focusItemId)) {\n ids.add(id);\n }\n\n for (const sibling of survey.getSiblings(focusItemId)) {\n ids.add(sibling.id);\n }\n\n for (const childId of getChildIds(survey, focusItemId)) {\n ids.add(childId);\n }\n\n return ids;\n}\n\nfunction addDescendants(\n survey: Survey,\n itemId: string,\n set: Set<string>,\n maxDepth: number,\n): void {\n const queue: Array<{ id: string; depth: number }> = [{ id: itemId, depth: 0 }];\n while (queue.length > 0) {\n const current = queue.shift();\n if (!current) {\n continue;\n }\n if (current.depth >= maxDepth) {\n continue;\n }\n for (const childId of getChildIds(survey, current.id)) {\n set.add(childId);\n queue.push({ id: childId, depth: current.depth + 1 });\n }\n }\n}\n\nfunction collectFocusedScopeIds(survey: Survey, focusItemId: string): Set<string> {\n const ids = collectTinyScopeIds(survey, focusItemId);\n const ancestors = survey.getItemPath(focusItemId);\n\n addDescendants(survey, focusItemId, ids, 2);\n for (const sibling of survey.getSiblings(focusItemId)) {\n if (sibling.id === focusItemId) {\n continue;\n }\n ids.add(sibling.id);\n addDescendants(survey, sibling.id, ids, 1);\n }\n\n for (const ancestorId of ancestors) {\n const parent = survey.getParentItem(ancestorId);\n const siblingIds = (parent?.items ?? []).filter((id) => id !== ancestorId);\n for (const siblingId of siblingIds) {\n ids.add(siblingId);\n addDescendants(survey, siblingId, ids, 1);\n }\n }\n\n return ids;\n}\n\nfunction buildFocusInfo(survey: Survey, focusItemId: string): SurveyAIFocus | undefined {\n if (!survey.surveyItems.has(focusItemId)) {\n return undefined;\n }\n\n const pathItemIds = [...survey.getItemPath(focusItemId), focusItemId];\n const parentItemId = survey.getParentItem(focusItemId)?.id;\n const siblingItemIds = survey\n .getSiblings(focusItemId)\n .filter((item) => item.id !== focusItemId)\n .map((item) => item.id);\n const childItemIds = getChildIds(survey, focusItemId);\n\n return {\n focusItemId,\n parentItemId,\n pathItemIds,\n siblingItemIds,\n childItemIds,\n };\n}\n\nconst normalizeSnippetText = (text: string, maxChars: number): string => {\n return text.trim().replace(/\\s+/g, \" \").slice(0, maxChars);\n};\n\nconst getContentText = (content: Content | undefined, maxChars: number): string | null => {\n const normalized = normalizeSnippetText(getContentPlainText(content), maxChars);\n return normalized.length > 0 ? normalized : null;\n};\n\nfunction getItemTranslationSnippets(\n survey: Survey,\n itemId: string,\n maxSnippets: number,\n textLimit: number,\n): SurveyAITranslationSnippet[] {\n const snippets: SurveyAITranslationSnippet[] = [];\n const translations = survey.getItemTranslations(itemId);\n if (!translations) {\n return snippets;\n }\n\n for (const locale of translations.locales) {\n const localeContent = translations.getAllForLocale(locale);\n if (!localeContent) {\n continue;\n }\n\n for (const [contentKey, content] of Object.entries(localeContent)) {\n const text = getContentText(content, textLimit);\n if (!text) {\n continue;\n }\n snippets.push({ locale, contentKey, text });\n if (snippets.length >= maxSnippets) {\n return snippets;\n }\n }\n }\n\n return snippets;\n}\n\nfunction buildFocusItemTree(\n survey: Survey,\n focusItemId: string,\n getFullKey: (itemId: string) => string,\n options: {\n treeLimit: number;\n snippetsPerItem: number;\n snippetTextLimit: number;\n },\n): { focusItem?: SurveyAIItemContextNode; truncated: boolean } {\n if (!survey.surveyItems.has(focusItemId)) {\n return { truncated: false };\n }\n\n let remainingBudget = options.treeLimit;\n let truncated = false;\n\n const visit = (itemId: string): SurveyAIItemContextNode | undefined => {\n if (remainingBudget <= 0) {\n truncated = true;\n return undefined;\n }\n const item = survey.surveyItems.get(itemId);\n if (!item) {\n return undefined;\n }\n remainingBudget -= 1;\n\n const siblingKeys = survey\n .getSiblings(itemId)\n .filter((sibling) => sibling.id !== itemId)\n .map((sibling) => sibling.key);\n\n const descendants: SurveyAIItemContextNode[] = [];\n if (item instanceof GroupItemCore) {\n for (const childId of item.items) {\n const childNode = visit(childId);\n if (childNode) {\n descendants.push(childNode);\n }\n }\n }\n\n return {\n itemId: item.id,\n itemType: item.type,\n itemKey: item.key,\n fullKey: getFullKey(item.id),\n itemLabel: item.metadata?.itemLabel,\n siblingKeys,\n translations: getItemTranslationSnippets(\n survey,\n item.id,\n options.snippetsPerItem,\n options.snippetTextLimit,\n ),\n descendants,\n };\n };\n\n return {\n focusItem: visit(focusItemId),\n truncated,\n };\n}\n\nfunction buildContextIndexes(\n survey: Survey,\n fullOutline: SurveyAIOutlineNode[],\n purpose: SurveyAIContextPurpose,\n): SurveyAIContextIndexes {\n const keyIndex: SurveyAIKeyIndexEntry[] = fullOutline.map((node) => ({\n itemId: node.itemId,\n itemType: node.itemType,\n key: node.key,\n fullKey: node.fullKey,\n itemLabel: node.itemLabel,\n path: node.fullKey.split(\".\").slice(0, -1),\n }));\n\n const indexes: SurveyAIContextIndexes = {\n keyIndex,\n };\n\n if (purpose === \"condition-management\") {\n indexes.responseSlots = Object.keys(survey.getAvailableResponseValueSlots());\n }\n\n return indexes;\n}\n\nexport function buildSurveyAIContextPack(\n survey: Survey,\n options: BuildSurveyAIContextPackOptions = {},\n): SurveyAIContextPack {\n const purpose = options.purpose ?? \"generic\";\n const purposeDefaults = PURPOSE_DEFAULTS[purpose];\n const scope = options.scope ?? purposeDefaults.scope;\n const defaultLimit = DEFAULT_SCOPE_LIMITS[scope];\n const outlineLimit = Math.max(1, options.outlineLimit ?? defaultLimit);\n const includeRawSurvey = options.includeRawSurvey ?? purposeDefaults.includeRawSurvey;\n const includeIndexes = options.includeIndexes ?? purposeDefaults.includeIndexes;\n const includeFocusItemTree = options.includeFocusItemTree ?? purposeDefaults.includeFocusItemTree;\n const focusItemId = options.focusItemId;\n const focusExists = Boolean(focusItemId && survey.surveyItems.has(focusItemId));\n\n const parentLookup = buildParentLookup(survey);\n const getFullKey = createFullKeyGetter(survey, parentLookup);\n const fullOutline = buildFullOutline(survey, parentLookup, getFullKey);\n\n let scopedOutline = fullOutline;\n if (scope === \"tiny\" && focusItemId && focusExists) {\n const includedIds = collectTinyScopeIds(survey, focusItemId);\n scopedOutline = fullOutline.filter((node) => includedIds.has(node.itemId));\n } else if (scope === \"focused\" && focusItemId && focusExists) {\n const includedIds = collectFocusedScopeIds(survey, focusItemId);\n scopedOutline = fullOutline.filter((node) => includedIds.has(node.itemId));\n }\n\n const outlineTruncated = scopedOutline.length > outlineLimit;\n const outline = outlineTruncated\n ? scopedOutline.slice(0, outlineLimit)\n : scopedOutline;\n\n let focusItemTreeTruncated = false;\n let focusItem: SurveyAIItemContextNode | undefined;\n if (includeFocusItemTree && focusItemId && focusExists) {\n const focusTreeResult = buildFocusItemTree(survey, focusItemId, getFullKey, {\n treeLimit: Math.max(1, options.focusItemTreeLimit ?? DEFAULT_FOCUS_TREE_LIMIT),\n snippetsPerItem: Math.max(1, options.translationSnippetsPerItemLimit ?? DEFAULT_TRANSLATION_SNIPPETS_PER_ITEM),\n snippetTextLimit: Math.max(1, options.translationSnippetTextLimit ?? DEFAULT_TRANSLATION_SNIPPET_TEXT_LIMIT),\n });\n focusItemTreeTruncated = focusTreeResult.truncated;\n focusItem = focusTreeResult.focusItem;\n }\n\n return {\n purpose,\n scope,\n surveyKey: survey.surveyKey,\n locales: [...survey.locales],\n itemCount: survey.surveyItems.size,\n outline,\n focus: focusItemId ? buildFocusInfo(survey, focusItemId) : undefined,\n focusItem,\n indexes: includeIndexes ? buildContextIndexes(survey, fullOutline, purpose) : undefined,\n flags: {\n outlineTruncated,\n rawSurveyIncluded: includeRawSurvey,\n focusItemTreeTruncated,\n },\n rawSurvey: includeRawSurvey ? survey.serialize() : undefined,\n };\n}\n","import { Survey } from \"../survey/survey\";\nimport { SurveyItemCore } from \"../survey/items\";\nimport { GroupItemCore } from \"../survey/registry/built-in-items\";\nimport { ReservedSurveyItemTypes } from \"../survey/items/types\";\nimport { SurveyItemTranslations, JsonComponentContent } from \"../survey/utils\";\nimport { RawSurveyItem } from \"../survey/items/survey-item-json\";\nimport { Target } from \"./types\";\nimport { generateId } from \"../utils\";\n\n\n// Serialized translation data format for clipboard\nexport type SerializedTranslations = {\n [locale: string]: JsonComponentContent;\n};\n\n// Clipboard data structure for copy-paste functionality\nexport interface SurveyItemClipboardData {\n type: 'survey-item';\n version: string;\n items: Array<{\n itemId: string;\n itemData: RawSurveyItem;\n }>;\n translations: { [itemId: string]: SerializedTranslations };\n rootItemId: string; // The id of the main item being copied\n timestamp: number;\n}\n\n\nexport class ItemCopyPaste {\n private survey: Survey;\n\n constructor(survey: Survey) {\n this.survey = survey;\n }\n\n /**\n * Copy a survey item and all its data to clipboard format\n * When copying a group, automatically includes all items in the subtree\n * @param itemId - The id of the item to copy\n * @returns Clipboard data that can be serialized to JSON for clipboard\n */\n copyItem(itemId: string): SurveyItemClipboardData {\n const item = this.survey.surveyItems.get(itemId);\n if (!item) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n\n // Collect all items to copy (including subtree for groups)\n const itemsToCopy = this.collectItemsForCopy(itemId);\n\n // Create items array with their data\n const items = itemsToCopy.map(id => {\n const item = this.survey.surveyItems.get(id);\n if (!item) throw new Error(`Item with id '${id}' not found during copy`);\n return { itemId: id, itemData: item.rawItem };\n });\n\n // Collect translations for all items\n const translations: { [itemId: string]: SerializedTranslations } = {};\n itemsToCopy.forEach(id => {\n try {\n const itemTranslations = this.survey.getItemTranslations(id);\n if (itemTranslations?.locales?.length) {\n const serializedTranslations: SerializedTranslations = {};\n itemTranslations.locales.forEach(locale => {\n const localeContent = itemTranslations.getAllForLocale(locale);\n if (localeContent) {\n serializedTranslations[locale] = localeContent;\n }\n });\n translations[id] = serializedTranslations;\n } else {\n translations[id] = {};\n }\n } catch {\n translations[id] = {};\n }\n });\n\n // Create clipboard data\n const clipboardData: SurveyItemClipboardData = {\n type: 'survey-item',\n version: '1.0.0',\n items: items,\n translations: translations,\n rootItemId: itemId,\n timestamp: Date.now()\n };\n\n return clipboardData;\n }\n\n /**\n * Collect all items that should be copied, including subtree for groups\n * @param itemId - The root item id\n * @returns Array of item keys to copy\n */\n private collectItemsForCopy(itemId: string): string[] {\n const itemsToCopy: string[] = [itemId];\n const item = this.survey.surveyItems.get(itemId);\n\n if (!item) {\n return [];\n }\n\n // If this is a group item, collect all child items recursively\n if (item instanceof GroupItemCore) {\n const childIds = item.items;\n if (childIds.length > 0) {\n childIds.forEach(childId => {\n const childItems = this.collectItemsForCopy(childId);\n itemsToCopy.push(...childItems);\n });\n }\n }\n\n return itemsToCopy;\n }\n\n /**\n * Add an item to its parent group.\n * Ensures key uniqueness among siblings.\n * @param target - Target location information\n * @param item - The item to add (may have key adjusted for uniqueness)\n */\n private addItemToParentGroup(target: Target, item: SurveyItemCore): void {\n const parentGroup = this.survey.surveyItems.get(target.parentId);\n\n if (!parentGroup) {\n throw new Error(`Parent item with id '${target.parentId}' not found`);\n }\n\n if (!(parentGroup instanceof GroupItemCore)) {\n throw new Error(`Parent item '${target.parentId}' is not a group item`);\n }\n\n const siblingIds = parentGroup.items;\n const siblings = siblingIds\n .map(id => this.survey.surveyItems.get(id))\n .filter((s): s is SurveyItemCore => s !== undefined);\n const siblingKeys = new Set(siblings.map(s => s.key));\n\n let uniqueKey = item.key;\n if (siblingKeys.has(uniqueKey)) {\n let counter = 1;\n const originalKey = item.key;\n while (siblingKeys.has(uniqueKey)) {\n uniqueKey = originalKey + `_${counter}`;\n counter++;\n }\n if (uniqueKey !== item.key) {\n const updatedRawItem = { ...item.rawItem, key: uniqueKey };\n const newItem = this.survey.createItemFromRaw(updatedRawItem);\n this.survey.surveyItems.delete(item.id);\n this.survey.surveyItems.set(newItem.id, newItem);\n item = newItem;\n }\n }\n\n const insertIndex =\n target.index !== undefined\n ? Math.min(target.index, parentGroup.items.length)\n : parentGroup.items.length;\n\n parentGroup.addChild(item.id, insertIndex);\n }\n\n /**\n * Paste a survey item from clipboard data to a target location\n * Handles multiple items and subtrees from the clipboard data\n * @param clipboardData - The clipboard data containing the item(s) to paste\n * @param target - Target location where to paste the item\n * @returns The id of the pasted root item\n */\n pasteItem(clipboardData: SurveyItemClipboardData, target: Target): string {\n // Validate clipboard data\n if (!ItemCopyPaste.isValidClipboardData(clipboardData)) {\n throw new Error('Invalid clipboard data format');\n }\n\n // Create id mapping for all items in the subtree\n const idMapping: { [oldId: string]: string } = {};\n clipboardData.items.forEach(({ itemId }) => {\n idMapping[itemId] = generateId();\n });\n\n // Create all items with updated ids\n clipboardData.items.forEach(({ itemId, itemData }) => {\n const newId = idMapping[itemId];\n if (newId) {\n const updatedItemData = this.updateItemIdsInData(itemData, idMapping);\n updatedItemData.id = newId;\n\n const newItem = this.survey.createItemFromRaw(updatedItemData);\n this.survey.surveyItems.set(newItem.id, newItem);\n\n if (itemId === clipboardData.rootItemId) {\n this.addItemToParentGroup(target, newItem);\n }\n }\n });\n\n // Update translations with new IDs\n const updatedTranslations = this.updateTranslations(clipboardData.translations, idMapping);\n Object.keys(updatedTranslations).forEach(itemId => {\n // Convert serialized translations back to SurveyItemTranslations instance\n const itemTranslations = new SurveyItemTranslations();\n const serializedData = updatedTranslations[itemId];\n Object.keys(serializedData).forEach(locale => {\n itemTranslations.setAllForLocale(locale, serializedData[locale]);\n });\n this.survey.translations.setItemTranslations(itemId, itemTranslations);\n });\n\n return idMapping[clipboardData.rootItemId];\n }\n\n // PRIVATE HELPER METHODS\n /**\n * Update all item ids in the raw item data recursively\n */\n private updateItemIdsInData(itemData: RawSurveyItem, idMapping: { [oldId: string]: string }): RawSurveyItem {\n const updatedData = JSON.parse(JSON.stringify(itemData));\n\n if (updatedData.itemType === ReservedSurveyItemTypes.Group && updatedData.config) {\n const config = updatedData.config as { items?: string[] };\n if (config.items) {\n config.items = config.items.map((childId: string) => idMapping[childId] ?? childId);\n }\n }\n\n this.updateExpressionsInItemData(updatedData, idMapping);\n return updatedData;\n }\n\n /**\n * Update expressions in item data that reference the old ids\n */\n private updateExpressionsInItemData(itemData: RawSurveyItem, idMapping: { [oldId: string]: string }): void {\n\n // Update display conditions\n if (itemData.displayConditions?.root) {\n this.updateExpressionReferences(itemData.displayConditions.root, idMapping);\n }\n if (itemData.displayConditions?.components) {\n Object.values(itemData.displayConditions.components).forEach(expr => {\n if (expr) this.updateExpressionReferences(expr, idMapping);\n });\n }\n\n // Update disabled conditions\n if (itemData.disabledConditions?.components) {\n Object.values(itemData.disabledConditions.components).forEach(expr => {\n if (expr) this.updateExpressionReferences(expr, idMapping);\n });\n }\n\n // Update validations\n if (itemData.validations) {\n Object.values(itemData.validations).forEach(expr => {\n if (expr) this.updateExpressionReferences(expr, idMapping);\n });\n }\n\n if (itemData.prefills) {\n itemData.prefills.forEach(prefill => {\n if (prefill.when) {\n this.updateExpressionReferences(prefill.when, idMapping);\n }\n\n if (prefill.source.type === 'expression') {\n this.updateExpressionReferences(prefill.source.expression, idMapping);\n }\n\n if (prefill.source.type === 'previousResponse') {\n prefill.source.ref.itemId = idMapping[prefill.source.ref.itemId] ?? prefill.source.ref.itemId;\n }\n });\n }\n }\n\n /**\n * Update references in a single expression (recursive)\n */\n private updateExpressionReferences(\n expression: unknown,\n idMapping: { [oldId: string]: string }\n ): void {\n if (!expression || typeof expression !== 'object') {\n return;\n }\n\n const expr = expression as Record<string, unknown>;\n if (Array.isArray(expr.data)) {\n expr.data.forEach((arg: unknown) => {\n if (arg && typeof arg === 'object' && arg !== null && 'str' in arg) {\n const argObj = arg as { str?: string };\n if (\n typeof argObj.str === 'string' &&\n Object.prototype.hasOwnProperty.call(idMapping, argObj.str)\n ) {\n argObj.str = idMapping[argObj.str];\n }\n this.updateExpressionReferences(arg, idMapping);\n }\n });\n }\n\n Object.keys(expr).forEach(key => {\n const val = expr[key];\n if (val && typeof val === 'object') {\n this.updateExpressionReferences(val, idMapping);\n }\n });\n }\n\n /**\n* Update translation keys for the pasted item\n*/\n private updateTranslations(translations: { [itemId: string]: SerializedTranslations }, idMapping: { [oldId: string]: string }): { [itemId: string]: SerializedTranslations } {\n const newTranslations: { [itemId: string]: SerializedTranslations } = {};\n\n // Update ids for all items in the translation data\n Object.keys(translations).forEach(itemId => {\n const itemTranslations = translations[itemId];\n\n // Determine the new key for this item (update the key mapping)\n const newItemId = idMapping[itemId];\n\n // Copy the serialized translations as-is (content is preserved, only keys change)\n newTranslations[newItemId] = itemTranslations;\n });\n\n return newTranslations;\n }\n\n\n /**\n * Validate clipboard data format\n */\n static isValidClipboardData(data: unknown): data is SurveyItemClipboardData {\n if (typeof data !== 'object' || data === null || data === undefined) return false;\n const clipboardData = data as SurveyItemClipboardData;\n return (\n clipboardData.type === 'survey-item' &&\n clipboardData.version === '1.0.0' &&\n clipboardData.rootItemId !== undefined\n );\n }\n}\n","import { RawSurvey, RawSurveyAsset } from \"../survey/survey-file-schema\";\nimport { structuredCloneMethod } from \"../utils\";\n\nexport interface UndoRedoConfig {\n maxTotalMemoryMB: number;\n minHistorySize: number;\n maxHistorySize: number;\n}\n\nexport const CommitSource = {\n USER: \"user\",\n SYSTEM: \"system\",\n} as const;\nexport type CommitSource = typeof CommitSource[keyof typeof CommitSource];\n\nexport interface CommitMeta {\n label: string;\n source?: CommitSource;\n}\n\nexport interface AssetPatch {\n assetId: string;\n prev?: RawSurveyAsset;\n next?: RawSurveyAsset;\n}\n\ninterface BaseHistoryEntry {\n timestamp: number;\n meta: CommitMeta;\n memorySize: number;\n}\n\ninterface SurveySnapshotHistoryEntry extends BaseHistoryEntry {\n kind: 'survey-snapshot';\n survey: RawSurvey;\n}\n\ninterface AssetChangeHistoryEntry extends BaseHistoryEntry {\n kind: 'asset-change';\n changes: AssetPatch[];\n}\n\ntype HistoryEntry = SurveySnapshotHistoryEntry | AssetChangeHistoryEntry;\ntype PendingHistoryEntry =\n | Omit<SurveySnapshotHistoryEntry, 'timestamp' | 'memorySize'>\n | Omit<AssetChangeHistoryEntry, 'timestamp' | 'memorySize'>;\n\ntype SerializedHistoryEntry =\n | SurveySnapshotHistoryEntry\n | AssetChangeHistoryEntry\n | (BaseHistoryEntry & { survey: RawSurvey });\n\n// Memory calculation utilities\nclass MemoryCalculator {\n private static encoder = new TextEncoder();\n\n static calculateSize(obj: object): number {\n const jsonString = JSON.stringify(obj);\n return this.encoder.encode(jsonString).length;\n }\n\n static formatBytes(bytes: number): string {\n const units = ['B', 'KB', 'MB', 'GB'];\n let size = bytes;\n let unitIndex = 0;\n\n while (size >= 1024 && unitIndex < units.length - 1) {\n size /= 1024;\n unitIndex++;\n }\n\n return `${size.toFixed(1)} ${units[unitIndex]}`;\n }\n}\n\nfunction cloneAssets(\n assets?: Record<string, RawSurveyAsset>,\n): Record<string, RawSurveyAsset> | undefined {\n if (!assets || Object.keys(assets).length === 0) {\n return undefined;\n }\n return structuredCloneMethod(assets);\n}\n\nfunction normalizeHistoryEntry(entry: SerializedHistoryEntry): HistoryEntry {\n if ('kind' in entry) {\n if (entry.kind === 'survey-snapshot') {\n return {\n kind: 'survey-snapshot',\n survey: structuredCloneMethod(entry.survey),\n timestamp: entry.timestamp,\n meta: entry.meta,\n memorySize: entry.memorySize,\n };\n }\n\n return {\n kind: 'asset-change',\n changes: structuredCloneMethod(entry.changes),\n timestamp: entry.timestamp,\n meta: entry.meta,\n memorySize: entry.memorySize,\n };\n }\n\n return {\n kind: 'survey-snapshot',\n survey: structuredCloneMethod(entry.survey),\n timestamp: entry.timestamp,\n meta: entry.meta,\n memorySize: entry.memorySize,\n };\n}\n\nexport class SurveyEditorUndoRedo {\n private history: HistoryEntry[] = [];\n private currentIndex: number = -1;\n private _config: UndoRedoConfig;\n private _initialAssets?: Record<string, RawSurveyAsset>;\n\n constructor(\n initialSurvey: RawSurvey,\n config: Partial<UndoRedoConfig> = {},\n meta: CommitMeta = { label: 'Initial state', source: CommitSource.SYSTEM },\n initialAssets?: Record<string, RawSurveyAsset>,\n ) {\n this._config = {\n maxTotalMemoryMB: 50,\n minHistorySize: 10,\n maxHistorySize: 200,\n ...config\n };\n this._initialAssets = cloneAssets(initialAssets);\n\n this.saveSnapshot(initialSurvey, meta);\n }\n\n private saveEntry(entry: PendingHistoryEntry): void {\n const payload = entry.kind === 'survey-snapshot'\n ? { kind: entry.kind, survey: entry.survey }\n : { kind: entry.kind, changes: entry.changes };\n\n const memorySize = MemoryCalculator.calculateSize(payload);\n\n // Remove any history after current index\n this.history = this.history.slice(0, this.currentIndex + 1);\n\n this.history.push({\n ...structuredCloneMethod(entry),\n timestamp: Date.now(),\n memorySize,\n } as HistoryEntry);\n\n this.currentIndex++;\n\n // Clean up history based on memory usage\n this.cleanupHistory();\n }\n\n private saveSnapshot(survey: RawSurvey, meta: CommitMeta): void {\n this.saveEntry({\n kind: 'survey-snapshot',\n survey: structuredCloneMethod(survey),\n meta,\n });\n }\n\n private getBaseAssetsSize(): number {\n return this._initialAssets ? MemoryCalculator.calculateSize(this._initialAssets) : 0;\n }\n\n private cleanupHistory(): void {\n const maxMemoryBytes = this._config.maxTotalMemoryMB * 1024 * 1024;\n\n // Remove oldest states while preserving minimum.\n while (this.history.length > this._config.minHistorySize &&\n (this.getTotalMemoryUsage() > maxMemoryBytes || this.history.length > this._config.maxHistorySize)) {\n if (this.dropOldestState() <= 0) {\n break;\n }\n }\n }\n\n private dropOldestState(): number {\n if (this.history.length <= 1) {\n return 0;\n }\n\n const nextStateIndex = 1;\n const nextStateSurvey = this.getStateAtIndex(nextStateIndex);\n const nextStateAssets = this.getAssetsAtIndex(nextStateIndex);\n const nextEntry = this.history[nextStateIndex];\n\n const newFirstEntry: SurveySnapshotHistoryEntry = {\n kind: 'survey-snapshot',\n survey: nextStateSurvey,\n meta: nextEntry.meta,\n timestamp: nextEntry.timestamp,\n memorySize: MemoryCalculator.calculateSize({\n kind: 'survey-snapshot',\n survey: nextStateSurvey,\n }),\n };\n\n const removedBytes = this.history[0].memorySize;\n\n this._initialAssets = cloneAssets(nextStateAssets);\n this.history = [newFirstEntry, ...this.history.slice(nextStateIndex + 1)];\n this.currentIndex--;\n\n return removedBytes;\n }\n\n private getTotalMemoryUsage(): number {\n return this.getBaseAssetsSize() + this.history.reduce((total, entry) => total + entry.memorySize, 0);\n }\n\n private getStateAtIndex(index: number): RawSurvey {\n if (index < 0 || index >= this.history.length) {\n throw new Error('Invalid history state');\n }\n\n for (let i = index; i >= 0; i--) {\n const entry = this.history[i];\n if (entry.kind === 'survey-snapshot') {\n return structuredCloneMethod(entry.survey);\n }\n }\n\n throw new Error('Invalid history state');\n }\n\n private applyAssetPatch(\n assets: Record<string, RawSurveyAsset>,\n patch: AssetPatch,\n ): Record<string, RawSurveyAsset> {\n const nextAssets = structuredCloneMethod(assets);\n if (patch.next) {\n nextAssets[patch.assetId] = structuredCloneMethod(patch.next);\n } else {\n delete nextAssets[patch.assetId];\n }\n return nextAssets;\n }\n\n private getAssetsAtIndex(index: number): Record<string, RawSurveyAsset> | undefined {\n if (index < 0 || index >= this.history.length) {\n throw new Error('Invalid history state');\n }\n\n let assets = cloneAssets(this._initialAssets) ?? {};\n\n for (let i = 1; i <= index; i++) {\n const entry = this.history[i];\n if (entry.kind !== 'asset-change') {\n continue;\n }\n\n for (const patch of entry.changes) {\n assets = this.applyAssetPatch(assets, patch);\n }\n }\n\n return Object.keys(assets).length > 0 ? assets : undefined;\n }\n\n // Commit a change to history\n commit(survey: RawSurvey, meta: CommitMeta): void {\n this.saveSnapshot(survey, meta);\n }\n\n commitAssetChange(changes: AssetPatch[], meta: CommitMeta): void {\n if (changes.length === 0) {\n return;\n }\n\n this.saveEntry({\n kind: 'asset-change',\n changes: structuredCloneMethod(changes),\n meta,\n });\n }\n\n // Get current committed state\n getCurrentState(): RawSurvey {\n if (this.currentIndex < 0 || this.currentIndex >= this.history.length) {\n throw new Error('Invalid history state');\n }\n return this.getStateAtIndex(this.currentIndex);\n }\n\n getCurrentAssets(): Record<string, RawSurveyAsset> | undefined {\n if (this.currentIndex < 0 || this.currentIndex >= this.history.length) {\n throw new Error('Invalid history state');\n }\n return this.getAssetsAtIndex(this.currentIndex);\n }\n\n undo(): RawSurvey | null {\n if (!this.canUndo()) return null;\n\n this.currentIndex--;\n return this.getCurrentState();\n }\n\n redo(): RawSurvey | null {\n if (!this.canRedo()) return null;\n\n this.currentIndex++;\n return this.getCurrentState();\n }\n\n canUndo(): boolean {\n return this.currentIndex > 0;\n }\n\n canRedo(): boolean {\n return this.currentIndex < this.history.length - 1;\n }\n\n getUndoMeta(): CommitMeta | null {\n if (!this.canUndo()) return null;\n return this.history[this.currentIndex].meta;\n }\n\n getRedoMeta(): CommitMeta | null {\n if (!this.canRedo()) return null;\n return this.history[this.currentIndex + 1].meta;\n }\n\n getMemoryUsage(): { totalMB: number; entries: number } {\n return {\n totalMB: this.getTotalMemoryUsage() / (1024 * 1024),\n entries: this.history.length\n };\n }\n\n getConfig(): UndoRedoConfig {\n return { ...this._config };\n }\n\n /**\n * Get the full history list with metadata\n */\n getHistory(): Array<{\n index: number;\n kind: HistoryEntry['kind'];\n meta: CommitMeta;\n timestamp: number;\n memorySize: number;\n isCurrent: boolean;\n }> {\n return this.history.map((entry, index) => ({\n index,\n kind: entry.kind,\n meta: entry.meta,\n timestamp: entry.timestamp,\n memorySize: entry.memorySize,\n isCurrent: index === this.currentIndex\n }));\n }\n\n /**\n * Get the current index in the history\n */\n getCurrentIndex(): number {\n return this.currentIndex;\n }\n\n /**\n * Get the total number of history entries\n */\n getHistoryLength(): number {\n return this.history.length;\n }\n\n /**\n * Jump to a specific index in the history (can go forward or backward)\n * @param targetIndex The index to jump to\n * @returns The survey state at the target index, or null if invalid\n */\n jumpToIndex(targetIndex: number): RawSurvey | null {\n if (targetIndex < 0 || targetIndex >= this.history.length || targetIndex === this.currentIndex) {\n return null;\n }\n\n this.currentIndex = targetIndex;\n return this.getCurrentState();\n }\n\n /**\n * Check if we can jump to a specific index\n */\n canJumpToIndex(targetIndex: number): boolean {\n return targetIndex >= 0 && targetIndex < this.history.length && targetIndex !== this.currentIndex;\n }\n\n /**\n * Serialize the undo/redo state to JSON\n * @returns A JSON-serializable object containing the complete state\n */\n serialize(): {\n history: Array<HistoryEntry>;\n currentIndex: number;\n config: UndoRedoConfig;\n initialAssets?: Record<string, RawSurveyAsset>;\n } {\n return {\n history: this.history.map(entry => {\n if (entry.kind === 'survey-snapshot') {\n return {\n kind: 'survey-snapshot',\n survey: entry.survey,\n timestamp: entry.timestamp,\n meta: entry.meta,\n memorySize: entry.memorySize\n };\n }\n\n return {\n kind: 'asset-change',\n changes: entry.changes,\n timestamp: entry.timestamp,\n meta: entry.meta,\n memorySize: entry.memorySize\n };\n }),\n currentIndex: this.currentIndex,\n config: { ...this._config },\n initialAssets: cloneAssets(this._initialAssets),\n };\n }\n\n /**\n * Create a new SurveyEditorUndoRedo instance from JSON data\n * @param jsonData The serialized undo/redo state\n * @returns A new SurveyEditorUndoRedo instance with the restored state\n */\n static deserialize(jsonData: {\n history: Array<SerializedHistoryEntry>;\n currentIndex: number;\n config: UndoRedoConfig;\n initialAssets?: Record<string, RawSurveyAsset>;\n }, initialAssetsOverride?: Record<string, RawSurveyAsset>): SurveyEditorUndoRedo {\n if (!jsonData.history || !Array.isArray(jsonData.history) || jsonData.history.length === 0) {\n throw new Error('Invalid object: history must be an array and must not be empty');\n }\n\n if (typeof jsonData.currentIndex !== 'number' ||\n jsonData.currentIndex < 0 ||\n jsonData.currentIndex >= jsonData.history.length) {\n throw new Error('Invalid object: currentIndex must be a valid index within the history array');\n }\n\n if (!jsonData.config) {\n throw new Error('Invalid object: config is required');\n }\n\n const normalizedHistory = jsonData.history.map(normalizeHistoryEntry);\n\n // Create a new instance with the first survey and config\n const firstEntry = normalizedHistory[0];\n const firstSurvey = firstEntry.kind === 'survey-snapshot'\n ? firstEntry.survey\n : (() => { throw new Error('Invalid object: first history entry must resolve to a survey snapshot'); })();\n\n const instance = new SurveyEditorUndoRedo(\n firstSurvey,\n jsonData.config,\n firstEntry.meta,\n initialAssetsOverride ?? jsonData.initialAssets,\n );\n\n // Clear the default initial state and restore the full history\n instance.history = normalizedHistory;\n instance.currentIndex = jsonData.currentIndex;\n instance._initialAssets = cloneAssets(initialAssetsOverride ?? jsonData.initialAssets);\n\n return instance;\n }\n}\n","import { Survey } from \"../survey/survey\";\nimport { CommitMeta, CommitSource, SurveyEditorUndoRedo, type UndoRedoConfig } from \"./undo-redo\";\nimport {\n SurveyItemTranslations,\n SurveyCardContent,\n NavigationContent,\n Content,\n} from \"../survey/utils\";\nimport { RawSurvey, RawSurveyAsset } from \"../survey/survey-file-schema\";\nimport { ItemCopyPaste, SurveyItemClipboardData } from \"./item-copy-paste\";\nimport { Target } from \"./types\";\nimport { SurveyItemCore, RawSurveyItem } from \"../survey/items\";\nimport { GroupItemCore } from \"../survey/registry/built-in-items\";\nimport type { ItemTypeRegistry } from \"../survey/registry/item-registry\";\nimport type { TemplateValueDefinition } from \"../expressions/template-value\";\nimport { structuredCloneMethod } from \"../utils\";\n\n\n// Interface for serializing SurveyEditor state\nexport interface SerializedSurveyEditor {\n version: string;\n survey: RawSurvey;\n undoRedo: ReturnType<SurveyEditorUndoRedo['serialize']>;\n hasUncommittedChanges: boolean;\n}\n\n\nexport interface SurveyEditorConfig extends Partial<UndoRedoConfig> {\n /** Plugin registry for deserializing survey state during undo/redo. Required when survey contains custom item types. */\n pluginRegistry?: ItemTypeRegistry;\n}\n\nfunction stripAssetsFromSurveySnapshot(survey: RawSurvey): RawSurvey {\n const snapshot = structuredCloneMethod(survey);\n delete snapshot.assets;\n return snapshot;\n}\n\nfunction mergeSurveySnapshotWithAssets(snapshot: RawSurvey, assets?: RawSurvey[\"assets\"]): RawSurvey {\n const merged = structuredCloneMethod(snapshot);\n\n if (assets && Object.keys(assets).length > 0) {\n merged.assets = structuredCloneMethod(assets);\n } else {\n delete merged.assets;\n }\n\n return merged;\n}\n\nexport class SurveyEditor {\n private _survey: Survey;\n private _undoRedo: SurveyEditorUndoRedo;\n private _hasUncommittedChanges: boolean = false;\n private _pluginRegistry?: ItemTypeRegistry;\n\n constructor(\n survey: Survey,\n config: SurveyEditorConfig = {},\n meta?: CommitMeta,\n ) {\n this._survey = survey;\n const { pluginRegistry, ...undoRedoConfig } = config;\n this._pluginRegistry = pluginRegistry;\n const serialized = survey.serialize();\n this._undoRedo = new SurveyEditorUndoRedo(\n stripAssetsFromSurveySnapshot(serialized),\n undoRedoConfig,\n meta,\n serialized.assets,\n );\n }\n\n /** Returns an immutable copy of the current survey state. */\n get survey(): Survey {\n const serialized = this._survey.serialize();\n const registry = this._pluginRegistry ?? this._survey.getPluginRegistry();\n return Survey.fromJson(serialized, registry);\n }\n\n get hasUncommittedChanges(): boolean {\n return this._hasUncommittedChanges;\n }\n\n // Expose the undo-redo instance directly\n get undoRedo(): SurveyEditorUndoRedo {\n return this._undoRedo;\n }\n\n // Commit current changes to undo/redo history\n commit(meta: CommitMeta): void {\n if (!this._hasUncommittedChanges) {\n return;\n }\n\n this._undoRedo.commit(stripAssetsFromSurveySnapshot(this._survey.serialize()), meta);\n this._hasUncommittedChanges = false;\n }\n\n private restoreHistoryState(snapshot: RawSurvey, assets?: RawSurvey[\"assets\"]): void {\n this._survey = Survey.fromJson(\n mergeSurveySnapshotWithAssets(snapshot, assets),\n this._pluginRegistry,\n );\n }\n\n commitIfNeeded(): void {\n if (this._hasUncommittedChanges) {\n this.commit({\n label: 'Latest content changes',\n source: CommitSource.SYSTEM\n });\n }\n }\n\n // Undo to previous state\n undo(): boolean {\n if (this._hasUncommittedChanges) {\n // If there are uncommitted changes, revert to last committed state\n this.restoreHistoryState(this._undoRedo.getCurrentState(), this._undoRedo.getCurrentAssets());\n this._hasUncommittedChanges = false;\n return true;\n } else {\n // Normal undo operation\n const previousState = this._undoRedo.undo();\n if (previousState) {\n this.restoreHistoryState(previousState, this._undoRedo.getCurrentAssets());\n this._hasUncommittedChanges = false;\n return true;\n }\n return false;\n }\n }\n\n // Redo to next state\n redo(): boolean {\n if (this._hasUncommittedChanges) {\n // Cannot redo when there are uncommitted changes\n return false;\n }\n\n const nextState = this._undoRedo.redo();\n if (nextState) {\n this.restoreHistoryState(nextState, this._undoRedo.getCurrentAssets());\n this._hasUncommittedChanges = false;\n return true;\n }\n return false;\n }\n\n // Enhanced undo/redo methods that use the exposed instance\n /**\n * Jump to a specific index in the history (can go forward or backward)\n */\n jumpToIndex(targetIndex: number): boolean {\n if (this._hasUncommittedChanges) {\n // Cannot jump to specific index with uncommitted changes\n return false;\n }\n\n const targetState = this._undoRedo.jumpToIndex(targetIndex);\n if (targetState) {\n this.restoreHistoryState(targetState, this._undoRedo.getCurrentAssets());\n this._hasUncommittedChanges = false;\n return true;\n }\n return false;\n }\n\n canUndo(): boolean {\n return this._hasUncommittedChanges || this._undoRedo.canUndo();\n }\n\n canRedo(): boolean {\n return !this._hasUncommittedChanges && this._undoRedo.canRedo();\n }\n\n getUndoMeta(): CommitMeta | null {\n if (this._hasUncommittedChanges) {\n return {\n label: 'Latest content changes',\n source: CommitSource.SYSTEM\n };\n }\n return this._undoRedo.getUndoMeta();\n }\n\n getRedoMeta(): CommitMeta | null {\n if (this._hasUncommittedChanges) {\n return null;\n }\n return this._undoRedo.getRedoMeta();\n }\n\n // Get memory usage statistics\n getMemoryUsage(): { totalMB: number; entries: number } {\n return this._undoRedo.getMemoryUsage();\n }\n\n // Get undo/redo configuration\n getUndoRedoConfig(): UndoRedoConfig {\n return this._undoRedo.getConfig();\n }\n\n /**\n * Serialize the SurveyEditor state to JSON\n * @returns A JSON-serializable object containing the complete editor state\n */\n toJson(): SerializedSurveyEditor {\n return {\n version: '1.0.0',\n survey: this._survey.serialize(),\n undoRedo: this._undoRedo.serialize(),\n hasUncommittedChanges: this._hasUncommittedChanges,\n };\n }\n\n /**\n * Create a new SurveyEditor instance from JSON data\n * @param jsonData The serialized editor state\n * @param pluginRegistry Optional plugin registry for deserializing survey state (required when survey contains custom item types)\n * @returns A new SurveyEditor instance with the restored state\n */\n static fromJson(jsonData: SerializedSurveyEditor, pluginRegistry?: ItemTypeRegistry): SurveyEditor {\n if (!jsonData.survey) {\n throw new Error('Invalid object: survey is required');\n }\n\n if (!jsonData.undoRedo) {\n throw new Error('Invalid object: undoRedo is required');\n }\n\n if (typeof jsonData.hasUncommittedChanges !== 'boolean') {\n throw new Error('Invalid object: hasUncommittedChanges must be a boolean');\n }\n\n // Validate version (for future compatibility)\n if (jsonData.version && !jsonData.version.startsWith('1.')) {\n console.warn(`Warning: Loading SurveyEditor with version ${jsonData.version}, current version is 1.0.0`);\n }\n\n // Create survey from JSON\n const survey = Survey.fromJson(jsonData.survey, pluginRegistry);\n\n // Create a new editor instance\n const editor = new SurveyEditor(survey, { pluginRegistry });\n\n // Restore undo/redo state\n editor._undoRedo = SurveyEditorUndoRedo.deserialize({\n ...jsonData.undoRedo,\n history: jsonData.undoRedo.history.map((entry) => (\n 'survey' in entry\n ? {\n ...entry,\n survey: stripAssetsFromSurveySnapshot(entry.survey),\n }\n : entry\n )),\n }, jsonData.survey.assets);\n\n // Infer whether the live survey contains uncommitted survey changes by comparing\n // the current survey content to the current history entry, ignoring assets.\n editor._hasUncommittedChanges = JSON.stringify(\n stripAssetsFromSurveySnapshot(jsonData.survey),\n ) !== JSON.stringify(editor._undoRedo.getCurrentState());\n\n return editor;\n }\n\n private markAsModified(): void {\n this._hasUncommittedChanges = true;\n }\n\n addItem(\n target: Target,\n item: SurveyItemCore,\n content?: SurveyItemTranslations,\n ): void {\n // Mark as modified (uncommitted change)\n this.markAsModified();\n\n // Find the parent group item\n let parentGroup: GroupItemCore;\n\n if (!target) {\n // If no target provided, add to root\n\n const rootItem = this._survey.rootItem;\n if (!rootItem) {\n throw new Error('No root group found in survey');\n }\n if (!(rootItem instanceof GroupItemCore)) {\n throw new Error('Root item is not a group item');\n }\n parentGroup = rootItem;\n } else {\n // Find the target parent group\n const targetItem = this._survey.surveyItems.get(target.parentId);\n\n if (!targetItem) {\n throw new Error(`Parent item with id '${target.parentId}' not found`);\n }\n\n if (!(targetItem instanceof GroupItemCore)) {\n throw new Error(`Parent item '${target.parentId}' is not a group item (${targetItem.type})`);\n }\n\n parentGroup = targetItem;\n }\n\n if (parentGroup.hasChild(item.id)) {\n throw new Error(`Item ${item.id} already in this group`);\n }\n\n // ensure that item's key not already used within the group\n const siblings = Array.from(this._survey.surveyItems.values()).filter(sItem => parentGroup.items?.includes(sItem.id));\n let counter = 1;\n while (siblings.some(sibling => sibling.key === item.key)) {\n item.key += `_${counter}`;\n counter++;\n }\n\n\n // Determine insertion index\n let insertIndex: number;\n if (target?.index !== undefined) {\n // Insert at specified index, or at end if index is larger than array length\n insertIndex = Math.min(target.index, parentGroup.items.length);\n } else {\n // Insert at the end\n insertIndex = parentGroup.items.length;\n }\n\n // Add the item to the survey items collection\n this._survey.surveyItems.set(item.id, item);\n\n // Add the item to the parent group (uses addChild for proper persistence)\n parentGroup.addChild(item.id, insertIndex);\n\n // Update translations in the survey\n if (content) {\n this._survey.translations.setItemTranslations(item.id, content);\n }\n }\n\n // Remove an item from the survey\n removeItem(itemId: string, nested: boolean = false): boolean {\n this.markAsModified();\n const item = this._survey.surveyItems.get(itemId);\n if (!item) {\n return false;\n }\n\n // Find parent group and remove from its items array\n const parentItem = this._survey.getParentItem(itemId);\n if (!parentItem) {\n throw new Error(`Item with id '${itemId}' is the root item`);\n }\n\n\n if (item instanceof GroupItemCore) {\n for (const childId of item.getChildrenIds()) {\n this.removeItem(childId, true);\n }\n }\n\n // Remove from survey items\n this._survey.surveyItems.delete(itemId);\n\n // Remove translations\n this._survey.translations?.onItemDeleted(itemId);\n\n if (!nested) {\n parentItem.removeChild(itemId);\n }\n return true;\n }\n\n // Move an item to a different position\n moveItem(itemId: string, newTarget: Target): boolean {\n this.markAsModified();\n // Check if item exists\n const item = this._survey.surveyItems.get(itemId);\n if (!item) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n\n // Check if new target exists and is a group\n const targetItem = this._survey.surveyItems.get(newTarget.parentId);\n if (!targetItem) {\n throw new Error(`Target parent with id '${newTarget.parentId}' not found`);\n }\n\n if (!(targetItem instanceof GroupItemCore)) {\n throw new Error(`Target parent '${newTarget.parentId}' is not a group item (${targetItem.type})`);\n }\n\n // Check if new target is not a child of the current item (prevent circular reference)\n if (this._survey.isDescendantOf(newTarget.parentId, itemId)) {\n throw new Error(`Cannot move item '${itemId}' to its descendant '${newTarget.parentId}'`);\n }\n\n // If the item is already in the target parent\n const currentParentItem = this._survey.getParentItem(itemId);\n if (currentParentItem?.id === newTarget.parentId) {\n throw new Error(`Item '${itemId}' is already in the target parent '${newTarget.parentId}'`);\n }\n\n // Remove item from current parent's items array\n if (currentParentItem) {\n const currentParentGroup = currentParentItem as GroupItemCore;\n currentParentGroup.removeChild(itemId);\n }\n\n // Add item to new parent's items array\n const targetGroup = targetItem as GroupItemCore;\n\n // ensure that item's key not already used within the group\n const siblings = Array.from(this._survey.surveyItems.values()).filter(sItem => targetGroup.hasChild(sItem.id));\n let counter = 1;\n while (siblings.some(sibling => sibling.key === item.key)) {\n item.key += `_${counter}`;\n counter++;\n }\n\n const insertIndex = newTarget.index !== undefined ?\n Math.min(newTarget.index, targetGroup.items.length) :\n targetGroup.items.length;\n\n targetGroup.items.splice(insertIndex, 0, itemId);\n\n return true;\n }\n\n /**\n * Get a deep copy of an item's raw data.\n * The returned object is independent of the survey—mutating it will not affect the survey.\n * Use this when you need to edit an item in a form or pass it to updateItem after modifications.\n *\n * @param itemId - The ID of the item to copy\n * @returns A deep copy of the item's RawSurveyItem data\n * @throws Error if the item is not found\n */\n getItemDataCopy(itemId: string): RawSurveyItem {\n const item = this._survey.surveyItems.get(itemId);\n if (!item) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n return JSON.parse(JSON.stringify(item.rawItem)) as RawSurveyItem;\n }\n\n /**\n * Update an item's data in the survey.\n * Can update common attributes (displayConditions, disabledConditions, validations, etc.)\n * as well as type-specific config.\n *\n * Use getItemDataCopy to obtain an editable copy, modify it, then pass it here.\n * Alternatively, pass a Partial to merge specific fields (top-level keys only;\n * e.g. config replaces the entire config object).\n *\n * @param itemId - The ID of the item to update (must match data.id if provided)\n * @param rawItemData - Full RawSurveyItem or Partial to merge. The id cannot be changed.\n */\n updateItem(itemId: string, rawItemData: RawSurveyItem | Partial<RawSurveyItem>): void {\n const existingItem = this._survey.surveyItems.get(itemId);\n if (!existingItem) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n\n if ('id' in rawItemData && rawItemData.id !== undefined && rawItemData.id !== itemId) {\n throw new Error(`Cannot change item id from '${itemId}' to '${rawItemData.id}'`);\n }\n\n const currentRaw = existingItem.rawItem;\n const merged: RawSurveyItem = {\n ...currentRaw,\n ...rawItemData,\n id: itemId, // Ensure id is never changed\n };\n\n // Reject key change if it would collide with a sibling\n const newKey = merged.key ?? existingItem.key;\n const parentGroup = this._survey.getParentItem(itemId);\n if (parentGroup) {\n const siblingWithSameKey = (parentGroup.items ?? [])\n .filter(id => id !== itemId)\n .map(id => this._survey.surveyItems.get(id))\n .find(s => s !== undefined && s.key === newKey);\n if (siblingWithSameKey) {\n throw new Error(`Key '${newKey}' is already in use by sibling item '${siblingWithSameKey.id}'`);\n }\n }\n\n const newItem = this._survey.createItemFromRaw(merged);\n this._survey.surveyItems.set(itemId, newItem);\n this.markAsModified();\n }\n\n // TODO: add also to update component translations (updating part of the item)\n // Update item translations\n updateItemTranslations(itemId: string, updatedContent?: SurveyItemTranslations): boolean {\n const item = this._survey.surveyItems.get(itemId);\n if (!item) {\n return false;\n }\n\n this.markAsModified();\n this._survey.translations.setItemTranslations(itemId, updatedContent);\n\n return true;\n }\n\n /**\n * Update survey-level translations that are not tied to specific items.\n * Use these for survey card, navigation, validation messages, etc.\n */\n updateSurveyTranslations(updates: {\n surveyCard?: { locale: string; content?: SurveyCardContent };\n navigation?: { locale: string; content?: NavigationContent };\n validationMessages?: { locale: string; content?: { invalidResponse?: Content } };\n }): void {\n this.markAsModified();\n if (updates.surveyCard) {\n this._survey.translations.setSurveyCardContent(updates.surveyCard.locale, updates.surveyCard.content);\n }\n if (updates.navigation) {\n this._survey.translations.setNavigationContent(updates.navigation.locale, updates.navigation.content);\n }\n if (updates.validationMessages) {\n this._survey.translations.setValidationMessages(updates.validationMessages.locale, updates.validationMessages.content);\n }\n }\n\n /**\n * Get maxItemsPerPage immutably (returns a copy).\n */\n getMaxItemsPerPage(): { large: number; small: number } | undefined {\n const val = this._survey.maxItemsPerPage;\n return val ? { ...val } : undefined;\n }\n\n /**\n * Update maxItemsPerPage.\n */\n updateMaxItemsPerPage(value: { large: number; small: number } | undefined): void {\n this.markAsModified();\n this._survey.maxItemsPerPage = value ? { ...value } : undefined;\n }\n\n /**\n * Get metadata immutably (returns a copy).\n */\n getMetadata(): { [key: string]: string } | undefined {\n const val = this._survey.metadata;\n return val ? { ...val } : undefined;\n }\n\n /**\n * Update metadata.\n */\n updateMetadata(metadata: { [key: string]: string } | undefined): void {\n this.markAsModified();\n this._survey.metadata = metadata ? { ...metadata } : undefined;\n }\n\n /**\n * Get a template value immutably (returns a deep copy).\n */\n getTemplateValue(key: string): TemplateValueDefinition | undefined {\n const val = this._survey.getTemplateValue(key);\n return val ? structuredCloneMethod(val) : undefined;\n }\n\n /**\n * Get all template values immutably (returns a new Map with deep-copied values).\n */\n getTemplateValues(): Map<string, TemplateValueDefinition> {\n const keys = this._survey.getTemplateValueKeys();\n const result = new Map<string, TemplateValueDefinition>();\n for (const key of keys) {\n const val = this._survey.getTemplateValue(key);\n if (val) {\n result.set(key, structuredCloneMethod(val));\n }\n }\n return result;\n }\n\n /**\n * Add or replace a template value.\n */\n setTemplateValue(key: string, templateValue: TemplateValueDefinition): void {\n this.markAsModified();\n this._survey.setTemplateValue(key, structuredCloneMethod(templateValue));\n }\n\n /**\n * Remove a template value.\n */\n removeTemplateValue(key: string): void {\n this.markAsModified();\n this._survey.deleteTemplateValue(key);\n }\n\n /**\n * Get a survey asset immutably.\n */\n getAsset(assetId: string): RawSurveyAsset | undefined {\n const asset = this._survey.getAsset(assetId);\n return asset ? structuredCloneMethod(asset) : undefined;\n }\n\n /**\n * Get all survey assets immutably.\n */\n getAssets(): Map<string, RawSurveyAsset> {\n return this._survey.getAssets();\n }\n\n /**\n * Add or replace a survey asset.\n */\n setAsset(assetId: string, asset: RawSurveyAsset): void {\n const previousAsset = this._survey.getAsset(assetId);\n this._survey.setAsset(assetId, structuredCloneMethod(asset));\n this._undoRedo.commitAssetChange([{\n assetId,\n prev: previousAsset,\n next: structuredCloneMethod(asset),\n }], {\n label: `Update asset: ${assetId}`,\n source: CommitSource.USER,\n });\n }\n\n /**\n * Remove a survey asset.\n */\n removeAsset(assetId: string): void {\n const previousAsset = this._survey.getAsset(assetId);\n if (!previousAsset) {\n return;\n }\n this._survey.deleteAsset(assetId);\n this._undoRedo.commitAssetChange([{\n assetId,\n prev: previousAsset,\n }], {\n label: `Remove asset: ${assetId}`,\n source: CommitSource.USER,\n });\n }\n\n /**\n * Copy a survey item and all its data to clipboard format\n * @param itemId - The ID of the item to copy\n * @returns Clipboard data that can be serialized to JSON for clipboard\n */\n copyItem(itemId: string): SurveyItemClipboardData {\n const copyPaste = new ItemCopyPaste(this._survey);\n return copyPaste.copyItem(itemId);\n }\n\n /**\n * Paste a survey item from clipboard data to a target location\n * @param clipboardData - The clipboard data containing the item to paste\n * @param target - Target location where to paste the item\n * @returns The ID of the pasted item\n */\n pasteItem(clipboardData: SurveyItemClipboardData, target: Target): string {\n this.markAsModified();\n const copyPaste = new ItemCopyPaste(this._survey);\n const newItemId = copyPaste.pasteItem(clipboardData, target);\n\n\n return newItemId;\n }\n}\n"],"mappings":";;AA+FA,MAAM,uBAA6D;CACjE,MAAM;CACN,SAAS;CACT,MAAM;CACP;AAED,MAAM,2BAA2B;AACjC,MAAM,wCAAwC;AAC9C,MAAM,yCAAyC;AAE/C,MAAM,mBAQF;CACF,SAAS;EACP,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAsB;EACvB;CACD,kBAAkB;EAChB,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAsB;EACvB;CACD,oBAAoB;EAClB,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAsB;EACvB;CACD,mBAAmB;EACjB,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAsB;EACvB;CACD,aAAa;EACX,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAsB;EACvB;CACD,wBAAwB;EACtB,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAsB;EACvB;CACF;AAED,MAAM,gBAA8C,UAClD,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,cAAc,EAAE,OAAO,CAAC;AAE7D,SAAS,YAAY,QAAgB,QAA0B;CAC7D,MAAM,OAAO,OAAO,YAAY,IAAI,OAAO;AAC3C,KAAI,EAAE,gBAAgB,eACpB,QAAO,EAAE;AAEX,QAAO,CAAC,GAAI,KAAK,SAAS,EAAE,CAAE;;AAGhC,SAAS,kBAAkB,QAAqC;CAC9D,MAAM,yBAAS,IAAI,K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AAC,EAAE;GACF,OAAO,iBAAiB;GACxB,QAAQ,aAAa;GACtB,CAAC;;;;;;;CAQJ,SAAS,QAAyC;AAEhD,SAAO,IADe,cAAc,KAAK,QACzB,CAAC,SAAS,OAAO;;;;;;;;CASnC,UAAU,eAAwC,QAAwB;AACxE,OAAK,gBAAgB;AAKrB,SAHkB,IADI,cAAc,KAAK,QACd,CAAC,UAAU,eAAe,OAGrC"}
|
|
1
|
+
{"version":3,"file":"editor.mjs","names":[],"sources":["../src/editor/ai-context.ts","../src/editor/item-copy-paste.ts","../src/editor/undo-redo.ts","../src/editor/survey-editor.ts"],"sourcesContent":["import { GroupItemCore } from \"../survey/registry/built-in-items\";\nimport type { RawSurvey } from \"../survey/survey-file-schema\";\nimport { Survey } from \"../survey/survey\";\nimport { getContentPlainText, type Content } from \"../survey/utils/content\";\n\nexport type SurveyAIContextScope = \"tiny\" | \"focused\" | \"full\";\nexport type SurveyAIContextPurpose =\n | \"generic\"\n | \"key-suggestion\"\n | \"label-suggestion\"\n | \"item-generation\"\n | \"translation\"\n | \"condition-management\";\n\nexport interface SurveyAIOutlineNode {\n itemId: string;\n parentId?: string;\n depth: number;\n itemType: string;\n key: string;\n fullKey: string;\n itemLabel?: string;\n childCount: number;\n}\n\nexport interface SurveyAIFocus {\n focusItemId: string;\n parentItemId?: string;\n pathItemIds: string[];\n siblingItemIds: string[];\n childItemIds: string[];\n}\n\nexport interface SurveyAITranslationSnippet {\n locale: string;\n contentKey: string;\n text: string;\n}\n\nexport interface SurveyAIItemContextNode {\n itemId: string;\n itemType: string;\n itemKey: string;\n fullKey: string;\n itemLabel?: string;\n siblingKeys: string[];\n translations: SurveyAITranslationSnippet[];\n descendants: SurveyAIItemContextNode[];\n}\n\nexport interface SurveyAIKeyIndexEntry {\n itemId: string;\n itemType: string;\n key: string;\n fullKey: string;\n itemLabel?: string;\n path: string[];\n}\n\nexport interface SurveyAIContextIndexes {\n keyIndex: SurveyAIKeyIndexEntry[];\n responseSlots?: string[];\n}\n\nexport interface SurveyAIContextPack {\n purpose: SurveyAIContextPurpose;\n scope: SurveyAIContextScope;\n surveyKey?: string;\n locales: string[];\n itemCount: number;\n outline: SurveyAIOutlineNode[];\n focus?: SurveyAIFocus;\n focusItem?: SurveyAIItemContextNode;\n indexes?: SurveyAIContextIndexes;\n flags: {\n outlineTruncated: boolean;\n rawSurveyIncluded: boolean;\n focusItemTreeTruncated: boolean;\n };\n rawSurvey?: RawSurvey;\n}\n\nexport interface BuildSurveyAIContextPackOptions {\n purpose?: SurveyAIContextPurpose;\n scope?: SurveyAIContextScope;\n focusItemId?: string;\n includeRawSurvey?: boolean;\n outlineLimit?: number;\n includeIndexes?: boolean;\n includeFocusItemTree?: boolean;\n focusItemTreeLimit?: number;\n translationSnippetsPerItemLimit?: number;\n translationSnippetTextLimit?: number;\n}\n\nconst DEFAULT_SCOPE_LIMITS: Record<SurveyAIContextScope, number> = {\n tiny: 40,\n focused: 150,\n full: 500,\n};\n\nconst DEFAULT_FOCUS_TREE_LIMIT = 120;\nconst DEFAULT_TRANSLATION_SNIPPETS_PER_ITEM = 8;\nconst DEFAULT_TRANSLATION_SNIPPET_TEXT_LIMIT = 120;\n\nconst PURPOSE_DEFAULTS: Record<\n SurveyAIContextPurpose,\n {\n scope: SurveyAIContextScope;\n includeRawSurvey: boolean;\n includeIndexes: boolean;\n includeFocusItemTree: boolean;\n }\n> = {\n generic: {\n scope: \"tiny\",\n includeRawSurvey: false,\n includeIndexes: false,\n includeFocusItemTree: false,\n },\n \"key-suggestion\": {\n scope: \"tiny\",\n includeRawSurvey: false,\n includeIndexes: false,\n includeFocusItemTree: true,\n },\n \"label-suggestion\": {\n scope: \"tiny\",\n includeRawSurvey: false,\n includeIndexes: false,\n includeFocusItemTree: true,\n },\n \"item-generation\": {\n scope: \"focused\",\n includeRawSurvey: false,\n includeIndexes: true,\n includeFocusItemTree: true,\n },\n translation: {\n scope: \"focused\",\n includeRawSurvey: false,\n includeIndexes: true,\n includeFocusItemTree: true,\n },\n \"condition-management\": {\n scope: \"full\",\n includeRawSurvey: true,\n includeIndexes: true,\n includeFocusItemTree: true,\n },\n};\n\nconst sortByItemId = <T extends { itemId: string }>(items: T[]): T[] =>\n [...items].sort((a, b) => a.itemId.localeCompare(b.itemId));\n\nfunction getChildIds(survey: Survey, itemId: string): string[] {\n const item = survey.surveyItems.get(itemId);\n if (!(item instanceof GroupItemCore)) {\n return [];\n }\n return [...(item.items ?? [])];\n}\n\nfunction buildParentLookup(survey: Survey): Map<string, string> {\n const lookup = new Map<string, string>();\n for (const item of survey.surveyItems.values()) {\n if (!(item instanceof GroupItemCore)) {\n continue;\n }\n for (const childId of item.items ?? []) {\n lookup.set(childId, item.id);\n }\n }\n return lookup;\n}\n\nfunction createFullKeyGetter(survey: Survey, parentLookup: Map<string, string>) {\n const fullKeyCache = new Map<string, string>();\n\n const getFullKey = (itemId: string, stack = new Set<string>()): string => {\n const cached = fullKeyCache.get(itemId);\n if (cached) {\n return cached;\n }\n\n const item = survey.surveyItems.get(itemId);\n if (!item) {\n return itemId;\n }\n\n if (stack.has(itemId)) {\n return item.key;\n }\n\n const parentId = parentLookup.get(itemId);\n if (!parentId) {\n fullKeyCache.set(itemId, item.key);\n return item.key;\n }\n\n stack.add(itemId);\n const parentFullKey = getFullKey(parentId, stack);\n stack.delete(itemId);\n const fullKey = `${parentFullKey}.${item.key}`;\n fullKeyCache.set(itemId, fullKey);\n return fullKey;\n };\n\n return getFullKey;\n}\n\nfunction buildFullOutline(\n survey: Survey,\n parentLookup: Map<string, string>,\n getFullKey: (itemId: string) => string,\n): SurveyAIOutlineNode[] {\n const outline: SurveyAIOutlineNode[] = [];\n const visited = new Set<string>();\n\n const toNode = (itemId: string, depth: number): SurveyAIOutlineNode | undefined => {\n const item = survey.surveyItems.get(itemId);\n if (!item) {\n return undefined;\n }\n const childCount = item instanceof GroupItemCore ? item.items.length : 0;\n return {\n itemId,\n parentId: parentLookup.get(itemId),\n depth,\n itemType: item.type,\n key: item.key,\n fullKey: getFullKey(itemId),\n itemLabel: item.metadata?.itemLabel,\n childCount,\n };\n };\n\n const visit = (itemId: string, depth: number) => {\n if (visited.has(itemId)) {\n return;\n }\n visited.add(itemId);\n const node = toNode(itemId, depth);\n if (node) {\n outline.push(node);\n }\n for (const childId of getChildIds(survey, itemId)) {\n visit(childId, depth + 1);\n }\n };\n\n const root = survey.rootItem;\n if (root) {\n visit(root.id, 0);\n }\n\n const remaining = sortByItemId(\n Array.from(survey.surveyItems.values())\n .filter((item) => !visited.has(item.id))\n .map((item) => ({ itemId: item.id })),\n );\n for (const item of remaining) {\n visit(item.itemId, 0);\n }\n\n return outline;\n}\n\nfunction collectTinyScopeIds(survey: Survey, focusItemId: string): Set<string> {\n const ids = new Set<string>();\n const rootItem = survey.rootItem;\n if (rootItem) {\n ids.add(rootItem.id);\n }\n\n ids.add(focusItemId);\n for (const id of survey.getItemPath(focusItemId)) {\n ids.add(id);\n }\n\n for (const sibling of survey.getSiblings(focusItemId)) {\n ids.add(sibling.id);\n }\n\n for (const childId of getChildIds(survey, focusItemId)) {\n ids.add(childId);\n }\n\n return ids;\n}\n\nfunction addDescendants(survey: Survey, itemId: string, set: Set<string>, maxDepth: number): void {\n const queue: Array<{ id: string; depth: number }> = [{ id: itemId, depth: 0 }];\n while (queue.length > 0) {\n const current = queue.shift();\n if (!current) {\n continue;\n }\n if (current.depth >= maxDepth) {\n continue;\n }\n for (const childId of getChildIds(survey, current.id)) {\n set.add(childId);\n queue.push({ id: childId, depth: current.depth + 1 });\n }\n }\n}\n\nfunction collectFocusedScopeIds(survey: Survey, focusItemId: string): Set<string> {\n const ids = collectTinyScopeIds(survey, focusItemId);\n const ancestors = survey.getItemPath(focusItemId);\n\n addDescendants(survey, focusItemId, ids, 2);\n for (const sibling of survey.getSiblings(focusItemId)) {\n if (sibling.id === focusItemId) {\n continue;\n }\n ids.add(sibling.id);\n addDescendants(survey, sibling.id, ids, 1);\n }\n\n for (const ancestorId of ancestors) {\n const parent = survey.getParentItem(ancestorId);\n const siblingIds = (parent?.items ?? []).filter((id) => id !== ancestorId);\n for (const siblingId of siblingIds) {\n ids.add(siblingId);\n addDescendants(survey, siblingId, ids, 1);\n }\n }\n\n return ids;\n}\n\nfunction buildFocusInfo(survey: Survey, focusItemId: string): SurveyAIFocus | undefined {\n if (!survey.surveyItems.has(focusItemId)) {\n return undefined;\n }\n\n const pathItemIds = [...survey.getItemPath(focusItemId), focusItemId];\n const parentItemId = survey.getParentItem(focusItemId)?.id;\n const siblingItemIds = survey\n .getSiblings(focusItemId)\n .filter((item) => item.id !== focusItemId)\n .map((item) => item.id);\n const childItemIds = getChildIds(survey, focusItemId);\n\n return {\n focusItemId,\n parentItemId,\n pathItemIds,\n siblingItemIds,\n childItemIds,\n };\n}\n\nconst normalizeSnippetText = (text: string, maxChars: number): string => {\n return text.trim().replace(/\\s+/g, \" \").slice(0, maxChars);\n};\n\nconst getContentText = (content: Content | undefined, maxChars: number): string | null => {\n const normalized = normalizeSnippetText(getContentPlainText(content), maxChars);\n return normalized.length > 0 ? normalized : null;\n};\n\nfunction getItemTranslationSnippets(\n survey: Survey,\n itemId: string,\n maxSnippets: number,\n textLimit: number,\n): SurveyAITranslationSnippet[] {\n const snippets: SurveyAITranslationSnippet[] = [];\n const translations = survey.getItemTranslations(itemId);\n if (!translations) {\n return snippets;\n }\n\n for (const locale of translations.locales) {\n const localeContent = translations.getAllForLocale(locale);\n if (!localeContent) {\n continue;\n }\n\n for (const [contentKey, content] of Object.entries(localeContent)) {\n const text = getContentText(content, textLimit);\n if (!text) {\n continue;\n }\n snippets.push({ locale, contentKey, text });\n if (snippets.length >= maxSnippets) {\n return snippets;\n }\n }\n }\n\n return snippets;\n}\n\nfunction buildFocusItemTree(\n survey: Survey,\n focusItemId: string,\n getFullKey: (itemId: string) => string,\n options: {\n treeLimit: number;\n snippetsPerItem: number;\n snippetTextLimit: number;\n },\n): { focusItem?: SurveyAIItemContextNode; truncated: boolean } {\n if (!survey.surveyItems.has(focusItemId)) {\n return { truncated: false };\n }\n\n let remainingBudget = options.treeLimit;\n let truncated = false;\n\n const visit = (itemId: string): SurveyAIItemContextNode | undefined => {\n if (remainingBudget <= 0) {\n truncated = true;\n return undefined;\n }\n const item = survey.surveyItems.get(itemId);\n if (!item) {\n return undefined;\n }\n remainingBudget -= 1;\n\n const siblingKeys = survey\n .getSiblings(itemId)\n .filter((sibling) => sibling.id !== itemId)\n .map((sibling) => sibling.key);\n\n const descendants: SurveyAIItemContextNode[] = [];\n if (item instanceof GroupItemCore) {\n for (const childId of item.items) {\n const childNode = visit(childId);\n if (childNode) {\n descendants.push(childNode);\n }\n }\n }\n\n return {\n itemId: item.id,\n itemType: item.type,\n itemKey: item.key,\n fullKey: getFullKey(item.id),\n itemLabel: item.metadata?.itemLabel,\n siblingKeys,\n translations: getItemTranslationSnippets(\n survey,\n item.id,\n options.snippetsPerItem,\n options.snippetTextLimit,\n ),\n descendants,\n };\n };\n\n return {\n focusItem: visit(focusItemId),\n truncated,\n };\n}\n\nfunction buildContextIndexes(\n survey: Survey,\n fullOutline: SurveyAIOutlineNode[],\n purpose: SurveyAIContextPurpose,\n): SurveyAIContextIndexes {\n const keyIndex: SurveyAIKeyIndexEntry[] = fullOutline.map((node) => ({\n itemId: node.itemId,\n itemType: node.itemType,\n key: node.key,\n fullKey: node.fullKey,\n itemLabel: node.itemLabel,\n path: node.fullKey.split(\".\").slice(0, -1),\n }));\n\n const indexes: SurveyAIContextIndexes = {\n keyIndex,\n };\n\n if (purpose === \"condition-management\") {\n indexes.responseSlots = Object.keys(survey.getAvailableResponseValueSlots());\n }\n\n return indexes;\n}\n\nexport function buildSurveyAIContextPack(\n survey: Survey,\n options: BuildSurveyAIContextPackOptions = {},\n): SurveyAIContextPack {\n const purpose = options.purpose ?? \"generic\";\n const purposeDefaults = PURPOSE_DEFAULTS[purpose];\n const scope = options.scope ?? purposeDefaults.scope;\n const defaultLimit = DEFAULT_SCOPE_LIMITS[scope];\n const outlineLimit = Math.max(1, options.outlineLimit ?? defaultLimit);\n const includeRawSurvey = options.includeRawSurvey ?? purposeDefaults.includeRawSurvey;\n const includeIndexes = options.includeIndexes ?? purposeDefaults.includeIndexes;\n const includeFocusItemTree = options.includeFocusItemTree ?? purposeDefaults.includeFocusItemTree;\n const focusItemId = options.focusItemId;\n const focusExists = Boolean(focusItemId && survey.surveyItems.has(focusItemId));\n\n const parentLookup = buildParentLookup(survey);\n const getFullKey = createFullKeyGetter(survey, parentLookup);\n const fullOutline = buildFullOutline(survey, parentLookup, getFullKey);\n\n let scopedOutline = fullOutline;\n if (scope === \"tiny\" && focusItemId && focusExists) {\n const includedIds = collectTinyScopeIds(survey, focusItemId);\n scopedOutline = fullOutline.filter((node) => includedIds.has(node.itemId));\n } else if (scope === \"focused\" && focusItemId && focusExists) {\n const includedIds = collectFocusedScopeIds(survey, focusItemId);\n scopedOutline = fullOutline.filter((node) => includedIds.has(node.itemId));\n }\n\n const outlineTruncated = scopedOutline.length > outlineLimit;\n const outline = outlineTruncated ? scopedOutline.slice(0, outlineLimit) : scopedOutline;\n\n let focusItemTreeTruncated = false;\n let focusItem: SurveyAIItemContextNode | undefined;\n if (includeFocusItemTree && focusItemId && focusExists) {\n const focusTreeResult = buildFocusItemTree(survey, focusItemId, getFullKey, {\n treeLimit: Math.max(1, options.focusItemTreeLimit ?? DEFAULT_FOCUS_TREE_LIMIT),\n snippetsPerItem: Math.max(\n 1,\n options.translationSnippetsPerItemLimit ?? DEFAULT_TRANSLATION_SNIPPETS_PER_ITEM,\n ),\n snippetTextLimit: Math.max(\n 1,\n options.translationSnippetTextLimit ?? DEFAULT_TRANSLATION_SNIPPET_TEXT_LIMIT,\n ),\n });\n focusItemTreeTruncated = focusTreeResult.truncated;\n focusItem = focusTreeResult.focusItem;\n }\n\n return {\n purpose,\n scope,\n surveyKey: survey.surveyKey,\n locales: [...survey.locales],\n itemCount: survey.surveyItems.size,\n outline,\n focus: focusItemId ? buildFocusInfo(survey, focusItemId) : undefined,\n focusItem,\n indexes: includeIndexes ? buildContextIndexes(survey, fullOutline, purpose) : undefined,\n flags: {\n outlineTruncated,\n rawSurveyIncluded: includeRawSurvey,\n focusItemTreeTruncated,\n },\n rawSurvey: includeRawSurvey ? survey.serialize() : undefined,\n };\n}\n","import { Survey } from \"../survey/survey\";\nimport { SurveyItemCore } from \"../survey/items\";\nimport { GroupItemCore } from \"../survey/registry/built-in-items\";\nimport { ReservedSurveyItemTypes } from \"../survey/items/types\";\nimport { SurveyItemTranslations, JsonComponentContent } from \"../survey/utils\";\nimport { RawSurveyItem } from \"../survey/items/survey-item-json\";\nimport { Target } from \"./types\";\nimport { generateId } from \"../utils\";\n\n// Serialized translation data format for clipboard\nexport type SerializedTranslations = {\n [locale: string]: JsonComponentContent;\n};\n\n// Clipboard data structure for copy-paste functionality\nexport interface SurveyItemClipboardData {\n type: \"survey-item\";\n version: string;\n items: Array<{\n itemId: string;\n itemData: RawSurveyItem;\n }>;\n translations: { [itemId: string]: SerializedTranslations };\n rootItemId: string; // The id of the main item being copied\n timestamp: number;\n}\n\nexport class ItemCopyPaste {\n private survey: Survey;\n\n constructor(survey: Survey) {\n this.survey = survey;\n }\n\n /**\n * Copy a survey item and all its data to clipboard format\n * When copying a group, automatically includes all items in the subtree\n * @param itemId - The id of the item to copy\n * @returns Clipboard data that can be serialized to JSON for clipboard\n */\n copyItem(itemId: string): SurveyItemClipboardData {\n const item = this.survey.surveyItems.get(itemId);\n if (!item) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n\n // Collect all items to copy (including subtree for groups)\n const itemsToCopy = this.collectItemsForCopy(itemId);\n\n // Create items array with their data\n const items = itemsToCopy.map((id) => {\n const item = this.survey.surveyItems.get(id);\n if (!item) throw new Error(`Item with id '${id}' not found during copy`);\n return { itemId: id, itemData: item.rawItem };\n });\n\n // Collect translations for all items\n const translations: { [itemId: string]: SerializedTranslations } = {};\n itemsToCopy.forEach((id) => {\n try {\n const itemTranslations = this.survey.getItemTranslations(id);\n if (itemTranslations?.locales?.length) {\n const serializedTranslations: SerializedTranslations = {};\n itemTranslations.locales.forEach((locale) => {\n const localeContent = itemTranslations.getAllForLocale(locale);\n if (localeContent) {\n serializedTranslations[locale] = localeContent;\n }\n });\n translations[id] = serializedTranslations;\n } else {\n translations[id] = {};\n }\n } catch {\n translations[id] = {};\n }\n });\n\n // Create clipboard data\n const clipboardData: SurveyItemClipboardData = {\n type: \"survey-item\",\n version: \"1.0.0\",\n items: items,\n translations: translations,\n rootItemId: itemId,\n timestamp: Date.now(),\n };\n\n return clipboardData;\n }\n\n /**\n * Collect all items that should be copied, including subtree for groups\n * @param itemId - The root item id\n * @returns Array of item keys to copy\n */\n private collectItemsForCopy(itemId: string): string[] {\n const itemsToCopy: string[] = [itemId];\n const item = this.survey.surveyItems.get(itemId);\n\n if (!item) {\n return [];\n }\n\n // If this is a group item, collect all child items recursively\n if (item instanceof GroupItemCore) {\n const childIds = item.items;\n if (childIds.length > 0) {\n childIds.forEach((childId) => {\n const childItems = this.collectItemsForCopy(childId);\n itemsToCopy.push(...childItems);\n });\n }\n }\n\n return itemsToCopy;\n }\n\n /**\n * Add an item to its parent group.\n * Ensures key uniqueness among siblings.\n * @param target - Target location information\n * @param item - The item to add (may have key adjusted for uniqueness)\n */\n private addItemToParentGroup(target: Target, item: SurveyItemCore): void {\n const parentGroup = this.survey.surveyItems.get(target.parentId);\n\n if (!parentGroup) {\n throw new Error(`Parent item with id '${target.parentId}' not found`);\n }\n\n if (!(parentGroup instanceof GroupItemCore)) {\n throw new Error(`Parent item '${target.parentId}' is not a group item`);\n }\n\n const siblingIds = parentGroup.items;\n const siblings = siblingIds\n .map((id) => this.survey.surveyItems.get(id))\n .filter((s): s is SurveyItemCore => s !== undefined);\n const siblingKeys = new Set(siblings.map((s) => s.key));\n\n let uniqueKey = item.key;\n if (siblingKeys.has(uniqueKey)) {\n let counter = 1;\n const originalKey = item.key;\n while (siblingKeys.has(uniqueKey)) {\n uniqueKey = originalKey + `_${counter}`;\n counter++;\n }\n if (uniqueKey !== item.key) {\n const updatedRawItem = { ...item.rawItem, key: uniqueKey };\n const newItem = this.survey.createItemFromRaw(updatedRawItem);\n this.survey.surveyItems.delete(item.id);\n this.survey.surveyItems.set(newItem.id, newItem);\n item = newItem;\n }\n }\n\n const insertIndex =\n target.index !== undefined\n ? Math.min(target.index, parentGroup.items.length)\n : parentGroup.items.length;\n\n parentGroup.addChild(item.id, insertIndex);\n }\n\n /**\n * Paste a survey item from clipboard data to a target location\n * Handles multiple items and subtrees from the clipboard data\n * @param clipboardData - The clipboard data containing the item(s) to paste\n * @param target - Target location where to paste the item\n * @returns The id of the pasted root item\n */\n pasteItem(clipboardData: SurveyItemClipboardData, target: Target): string {\n // Validate clipboard data\n if (!ItemCopyPaste.isValidClipboardData(clipboardData)) {\n throw new Error(\"Invalid clipboard data format\");\n }\n\n // Create id mapping for all items in the subtree\n const idMapping: { [oldId: string]: string } = {};\n clipboardData.items.forEach(({ itemId }) => {\n idMapping[itemId] = generateId();\n });\n\n // Create all items with updated ids\n clipboardData.items.forEach(({ itemId, itemData }) => {\n const newId = idMapping[itemId];\n if (newId) {\n const updatedItemData = this.updateItemIdsInData(itemData, idMapping);\n updatedItemData.id = newId;\n\n const newItem = this.survey.createItemFromRaw(updatedItemData);\n this.survey.surveyItems.set(newItem.id, newItem);\n\n if (itemId === clipboardData.rootItemId) {\n this.addItemToParentGroup(target, newItem);\n }\n }\n });\n\n // Update translations with new IDs\n const updatedTranslations = this.updateTranslations(clipboardData.translations, idMapping);\n Object.keys(updatedTranslations).forEach((itemId) => {\n // Convert serialized translations back to SurveyItemTranslations instance\n const itemTranslations = new SurveyItemTranslations();\n const serializedData = updatedTranslations[itemId];\n Object.keys(serializedData).forEach((locale) => {\n itemTranslations.setAllForLocale(locale, serializedData[locale]);\n });\n this.survey.translations.setItemTranslations(itemId, itemTranslations);\n });\n\n return idMapping[clipboardData.rootItemId];\n }\n\n // PRIVATE HELPER METHODS\n /**\n * Update all item ids in the raw item data recursively\n */\n private updateItemIdsInData(\n itemData: RawSurveyItem,\n idMapping: { [oldId: string]: string },\n ): RawSurveyItem {\n const updatedData = JSON.parse(JSON.stringify(itemData));\n\n if (updatedData.itemType === ReservedSurveyItemTypes.Group && updatedData.config) {\n const config = updatedData.config as { items?: string[] };\n if (config.items) {\n config.items = config.items.map((childId: string) => idMapping[childId] ?? childId);\n }\n }\n\n this.updateExpressionsInItemData(updatedData, idMapping);\n return updatedData;\n }\n\n /**\n * Update expressions in item data that reference the old ids\n */\n private updateExpressionsInItemData(\n itemData: RawSurveyItem,\n idMapping: { [oldId: string]: string },\n ): void {\n // Update display conditions\n if (itemData.displayConditions?.root) {\n this.updateExpressionReferences(itemData.displayConditions.root, idMapping);\n }\n if (itemData.displayConditions?.components) {\n Object.values(itemData.displayConditions.components).forEach((expr) => {\n if (expr) this.updateExpressionReferences(expr, idMapping);\n });\n }\n\n // Update disabled conditions\n if (itemData.disabledConditions?.components) {\n Object.values(itemData.disabledConditions.components).forEach((expr) => {\n if (expr) this.updateExpressionReferences(expr, idMapping);\n });\n }\n\n // Update validations\n if (itemData.validations) {\n Object.values(itemData.validations).forEach((expr) => {\n if (expr) this.updateExpressionReferences(expr, idMapping);\n });\n }\n\n if (itemData.prefills) {\n itemData.prefills.forEach((prefill) => {\n if (prefill.when) {\n this.updateExpressionReferences(prefill.when, idMapping);\n }\n\n if (prefill.source.type === \"expression\") {\n this.updateExpressionReferences(prefill.source.expression, idMapping);\n }\n\n if (prefill.source.type === \"previousResponse\") {\n prefill.source.ref.itemId =\n idMapping[prefill.source.ref.itemId] ?? prefill.source.ref.itemId;\n }\n });\n }\n }\n\n /**\n * Update references in a single expression (recursive)\n */\n private updateExpressionReferences(\n expression: unknown,\n idMapping: { [oldId: string]: string },\n ): void {\n if (!expression || typeof expression !== \"object\") {\n return;\n }\n\n const expr = expression as Record<string, unknown>;\n if (Array.isArray(expr.data)) {\n expr.data.forEach((arg: unknown) => {\n if (arg && typeof arg === \"object\" && arg !== null && \"str\" in arg) {\n const argObj = arg as { str?: string };\n if (\n typeof argObj.str === \"string\" &&\n Object.prototype.hasOwnProperty.call(idMapping, argObj.str)\n ) {\n argObj.str = idMapping[argObj.str];\n }\n this.updateExpressionReferences(arg, idMapping);\n }\n });\n }\n\n Object.keys(expr).forEach((key) => {\n const val = expr[key];\n if (val && typeof val === \"object\") {\n this.updateExpressionReferences(val, idMapping);\n }\n });\n }\n\n /**\n * Update translation keys for the pasted item\n */\n private updateTranslations(\n translations: { [itemId: string]: SerializedTranslations },\n idMapping: { [oldId: string]: string },\n ): { [itemId: string]: SerializedTranslations } {\n const newTranslations: { [itemId: string]: SerializedTranslations } = {};\n\n // Update ids for all items in the translation data\n Object.keys(translations).forEach((itemId) => {\n const itemTranslations = translations[itemId];\n\n // Determine the new key for this item (update the key mapping)\n const newItemId = idMapping[itemId];\n\n // Copy the serialized translations as-is (content is preserved, only keys change)\n newTranslations[newItemId] = itemTranslations;\n });\n\n return newTranslations;\n }\n\n /**\n * Validate clipboard data format\n */\n static isValidClipboardData(data: unknown): data is SurveyItemClipboardData {\n if (typeof data !== \"object\" || data === null || data === undefined) return false;\n const clipboardData = data as SurveyItemClipboardData;\n return (\n clipboardData.type === \"survey-item\" &&\n clipboardData.version === \"1.0.0\" &&\n clipboardData.rootItemId !== undefined\n );\n }\n}\n","import { RawSurvey, RawSurveyAsset } from \"../survey/survey-file-schema\";\nimport { structuredCloneMethod } from \"../utils\";\n\nexport interface UndoRedoConfig {\n maxTotalMemoryMB: number;\n minHistorySize: number;\n maxHistorySize: number;\n}\n\nexport const CommitSource = {\n USER: \"user\",\n SYSTEM: \"system\",\n} as const;\nexport type CommitSource = (typeof CommitSource)[keyof typeof CommitSource];\n\nexport interface CommitMeta {\n label: string;\n source?: CommitSource;\n}\n\nexport interface AssetPatch {\n assetId: string;\n prev?: RawSurveyAsset;\n next?: RawSurveyAsset;\n}\n\ninterface BaseHistoryEntry {\n timestamp: number;\n meta: CommitMeta;\n memorySize: number;\n}\n\ninterface SurveySnapshotHistoryEntry extends BaseHistoryEntry {\n kind: \"survey-snapshot\";\n survey: RawSurvey;\n}\n\ninterface AssetChangeHistoryEntry extends BaseHistoryEntry {\n kind: \"asset-change\";\n changes: AssetPatch[];\n}\n\ntype HistoryEntry = SurveySnapshotHistoryEntry | AssetChangeHistoryEntry;\ntype PendingHistoryEntry =\n | Omit<SurveySnapshotHistoryEntry, \"timestamp\" | \"memorySize\">\n | Omit<AssetChangeHistoryEntry, \"timestamp\" | \"memorySize\">;\n\nexport interface SurveyEditorHistoryCommit {\n index: number;\n kind: HistoryEntry[\"kind\"];\n meta: CommitMeta;\n timestamp: number;\n memorySize: number;\n isCurrent: boolean;\n}\n\ntype SerializedHistoryEntry =\n | SurveySnapshotHistoryEntry\n | AssetChangeHistoryEntry\n | (BaseHistoryEntry & { survey: RawSurvey });\n\n// Memory calculation utilities\nclass MemoryCalculator {\n private static encoder = new TextEncoder();\n\n static calculateSize(obj: object): number {\n const jsonString = JSON.stringify(obj);\n return this.encoder.encode(jsonString).length;\n }\n\n static formatBytes(bytes: number): string {\n const units = [\"B\", \"KB\", \"MB\", \"GB\"];\n let size = bytes;\n let unitIndex = 0;\n\n while (size >= 1024 && unitIndex < units.length - 1) {\n size /= 1024;\n unitIndex++;\n }\n\n return `${size.toFixed(1)} ${units[unitIndex]}`;\n }\n}\n\nfunction cloneAssets(\n assets?: Record<string, RawSurveyAsset>,\n): Record<string, RawSurveyAsset> | undefined {\n if (!assets || Object.keys(assets).length === 0) {\n return undefined;\n }\n return structuredCloneMethod(assets);\n}\n\nfunction normalizeHistoryEntry(entry: SerializedHistoryEntry): HistoryEntry {\n if (\"kind\" in entry) {\n if (entry.kind === \"survey-snapshot\") {\n return {\n kind: \"survey-snapshot\",\n survey: structuredCloneMethod(entry.survey),\n timestamp: entry.timestamp,\n meta: entry.meta,\n memorySize: entry.memorySize,\n };\n }\n\n return {\n kind: \"asset-change\",\n changes: structuredCloneMethod(entry.changes),\n timestamp: entry.timestamp,\n meta: entry.meta,\n memorySize: entry.memorySize,\n };\n }\n\n return {\n kind: \"survey-snapshot\",\n survey: structuredCloneMethod(entry.survey),\n timestamp: entry.timestamp,\n meta: entry.meta,\n memorySize: entry.memorySize,\n };\n}\n\nexport class SurveyEditorUndoRedo {\n private history: HistoryEntry[] = [];\n private currentIndex: number = -1;\n private _config: UndoRedoConfig;\n private _initialAssets?: Record<string, RawSurveyAsset>;\n\n constructor(\n initialSurvey: RawSurvey,\n config: Partial<UndoRedoConfig> = {},\n meta: CommitMeta = { label: \"Initial state\", source: CommitSource.SYSTEM },\n initialAssets?: Record<string, RawSurveyAsset>,\n ) {\n this._config = {\n maxTotalMemoryMB: 50,\n minHistorySize: 10,\n maxHistorySize: 200,\n ...config,\n };\n this._initialAssets = cloneAssets(initialAssets);\n\n this.saveSnapshot(initialSurvey, meta);\n }\n\n private saveEntry(entry: PendingHistoryEntry): void {\n const payload =\n entry.kind === \"survey-snapshot\"\n ? { kind: entry.kind, survey: entry.survey }\n : { kind: entry.kind, changes: entry.changes };\n\n const memorySize = MemoryCalculator.calculateSize(payload);\n\n // Remove any history after current index\n this.history = this.history.slice(0, this.currentIndex + 1);\n\n this.history.push({\n ...structuredCloneMethod(entry),\n timestamp: Date.now(),\n memorySize,\n } as HistoryEntry);\n\n this.currentIndex++;\n\n // Clean up history based on memory usage\n this.cleanupHistory();\n }\n\n private saveSnapshot(survey: RawSurvey, meta: CommitMeta): void {\n this.saveEntry({\n kind: \"survey-snapshot\",\n survey: structuredCloneMethod(survey),\n meta,\n });\n }\n\n private getBaseAssetsSize(): number {\n return this._initialAssets ? MemoryCalculator.calculateSize(this._initialAssets) : 0;\n }\n\n private cleanupHistory(): void {\n const maxMemoryBytes = this._config.maxTotalMemoryMB * 1024 * 1024;\n\n // Remove oldest states while preserving minimum.\n while (\n this.history.length > this._config.minHistorySize &&\n (this.getTotalMemoryUsage() > maxMemoryBytes ||\n this.history.length > this._config.maxHistorySize)\n ) {\n if (this.dropOldestState() <= 0) {\n break;\n }\n }\n }\n\n private dropOldestState(): number {\n if (this.history.length <= 1) {\n return 0;\n }\n\n const nextStateIndex = 1;\n const nextStateSurvey = this.getStateAtIndex(nextStateIndex);\n const nextStateAssets = this.getAssetsAtIndex(nextStateIndex);\n const nextEntry = this.history[nextStateIndex];\n\n const newFirstEntry: SurveySnapshotHistoryEntry = {\n kind: \"survey-snapshot\",\n survey: nextStateSurvey,\n meta: nextEntry.meta,\n timestamp: nextEntry.timestamp,\n memorySize: MemoryCalculator.calculateSize({\n kind: \"survey-snapshot\",\n survey: nextStateSurvey,\n }),\n };\n\n const removedBytes = this.history[0].memorySize;\n\n this._initialAssets = cloneAssets(nextStateAssets);\n this.history = [newFirstEntry, ...this.history.slice(nextStateIndex + 1)];\n this.currentIndex--;\n\n return removedBytes;\n }\n\n private getTotalMemoryUsage(): number {\n return (\n this.getBaseAssetsSize() + this.history.reduce((total, entry) => total + entry.memorySize, 0)\n );\n }\n\n private getStateAtIndex(index: number): RawSurvey {\n if (index < 0 || index >= this.history.length) {\n throw new Error(\"Invalid history state\");\n }\n\n for (let i = index; i >= 0; i--) {\n const entry = this.history[i];\n if (entry.kind === \"survey-snapshot\") {\n return structuredCloneMethod(entry.survey);\n }\n }\n\n throw new Error(\"Invalid history state\");\n }\n\n private applyAssetPatch(\n assets: Record<string, RawSurveyAsset>,\n patch: AssetPatch,\n ): Record<string, RawSurveyAsset> {\n const nextAssets = structuredCloneMethod(assets);\n if (patch.next) {\n nextAssets[patch.assetId] = structuredCloneMethod(patch.next);\n } else {\n delete nextAssets[patch.assetId];\n }\n return nextAssets;\n }\n\n private getAssetsAtIndex(index: number): Record<string, RawSurveyAsset> | undefined {\n if (index < 0 || index >= this.history.length) {\n throw new Error(\"Invalid history state\");\n }\n\n let assets = cloneAssets(this._initialAssets) ?? {};\n\n for (let i = 1; i <= index; i++) {\n const entry = this.history[i];\n if (entry.kind !== \"asset-change\") {\n continue;\n }\n\n for (const patch of entry.changes) {\n assets = this.applyAssetPatch(assets, patch);\n }\n }\n\n return Object.keys(assets).length > 0 ? assets : undefined;\n }\n\n // Commit a change to history\n commit(survey: RawSurvey, meta: CommitMeta): void {\n this.saveSnapshot(survey, meta);\n }\n\n commitAssetChange(changes: AssetPatch[], meta: CommitMeta): void {\n if (changes.length === 0) {\n return;\n }\n\n this.saveEntry({\n kind: \"asset-change\",\n changes: structuredCloneMethod(changes),\n meta,\n });\n }\n\n // Get current committed state\n getCurrentState(): RawSurvey {\n if (this.currentIndex < 0 || this.currentIndex >= this.history.length) {\n throw new Error(\"Invalid history state\");\n }\n return this.getStateAtIndex(this.currentIndex);\n }\n\n getCurrentAssets(): Record<string, RawSurveyAsset> | undefined {\n if (this.currentIndex < 0 || this.currentIndex >= this.history.length) {\n throw new Error(\"Invalid history state\");\n }\n return this.getAssetsAtIndex(this.currentIndex);\n }\n\n undo(): RawSurvey | null {\n if (!this.canUndo()) return null;\n\n this.currentIndex--;\n return this.getCurrentState();\n }\n\n redo(): RawSurvey | null {\n if (!this.canRedo()) return null;\n\n this.currentIndex++;\n return this.getCurrentState();\n }\n\n canUndo(): boolean {\n return this.currentIndex > 0;\n }\n\n canRedo(): boolean {\n return this.currentIndex < this.history.length - 1;\n }\n\n getUndoMeta(): CommitMeta | null {\n if (!this.canUndo()) return null;\n return this.history[this.currentIndex].meta;\n }\n\n getRedoMeta(): CommitMeta | null {\n if (!this.canRedo()) return null;\n return this.history[this.currentIndex + 1].meta;\n }\n\n getMemoryUsage(): { totalMB: number; entries: number } {\n return {\n totalMB: this.getTotalMemoryUsage() / (1024 * 1024),\n entries: this.history.length,\n };\n }\n\n getConfig(): UndoRedoConfig {\n return { ...this._config };\n }\n\n /**\n * Get the full history list with metadata\n */\n getHistory(): Array<{\n index: number;\n kind: HistoryEntry[\"kind\"];\n meta: CommitMeta;\n timestamp: number;\n memorySize: number;\n isCurrent: boolean;\n }> {\n return this.history.map((entry, index) => ({\n index,\n kind: entry.kind,\n meta: entry.meta,\n timestamp: entry.timestamp,\n memorySize: entry.memorySize,\n isCurrent: index === this.currentIndex,\n }));\n }\n\n /**\n * Get committed history entries after the initial state up to the current index.\n *\n * Redo-only future entries are intentionally omitted so the returned list describes the active\n * change chain from the initial state to the current editor state.\n */\n getCommitsSinceInitial(): SurveyEditorHistoryCommit[] {\n return this.history.slice(1, this.currentIndex + 1).map((entry, offset) => {\n const index = offset + 1;\n return {\n index,\n kind: entry.kind,\n meta: entry.meta,\n timestamp: entry.timestamp,\n memorySize: entry.memorySize,\n isCurrent: index === this.currentIndex,\n };\n });\n }\n\n /**\n * Get the current index in the history\n */\n getCurrentIndex(): number {\n return this.currentIndex;\n }\n\n /**\n * Get the total number of history entries\n */\n getHistoryLength(): number {\n return this.history.length;\n }\n\n /**\n * Jump to a specific index in the history (can go forward or backward)\n * @param targetIndex The index to jump to\n * @returns The survey state at the target index, or null if invalid\n */\n jumpToIndex(targetIndex: number): RawSurvey | null {\n if (\n targetIndex < 0 ||\n targetIndex >= this.history.length ||\n targetIndex === this.currentIndex\n ) {\n return null;\n }\n\n this.currentIndex = targetIndex;\n return this.getCurrentState();\n }\n\n /**\n * Check if we can jump to a specific index\n */\n canJumpToIndex(targetIndex: number): boolean {\n return (\n targetIndex >= 0 && targetIndex < this.history.length && targetIndex !== this.currentIndex\n );\n }\n\n /**\n * Serialize the undo/redo state to JSON\n * @returns A JSON-serializable object containing the complete state\n */\n serialize(): {\n history: Array<HistoryEntry>;\n currentIndex: number;\n config: UndoRedoConfig;\n initialAssets?: Record<string, RawSurveyAsset>;\n } {\n return {\n history: this.history.map((entry) => {\n if (entry.kind === \"survey-snapshot\") {\n return {\n kind: \"survey-snapshot\",\n survey: entry.survey,\n timestamp: entry.timestamp,\n meta: entry.meta,\n memorySize: entry.memorySize,\n };\n }\n\n return {\n kind: \"asset-change\",\n changes: entry.changes,\n timestamp: entry.timestamp,\n meta: entry.meta,\n memorySize: entry.memorySize,\n };\n }),\n currentIndex: this.currentIndex,\n config: { ...this._config },\n initialAssets: cloneAssets(this._initialAssets),\n };\n }\n\n /**\n * Create a new SurveyEditorUndoRedo instance from JSON data\n * @param jsonData The serialized undo/redo state\n * @returns A new SurveyEditorUndoRedo instance with the restored state\n */\n static deserialize(\n jsonData: {\n history: Array<SerializedHistoryEntry>;\n currentIndex: number;\n config: UndoRedoConfig;\n initialAssets?: Record<string, RawSurveyAsset>;\n },\n initialAssetsOverride?: Record<string, RawSurveyAsset>,\n ): SurveyEditorUndoRedo {\n if (!jsonData.history || !Array.isArray(jsonData.history) || jsonData.history.length === 0) {\n throw new Error(\"Invalid object: history must be an array and must not be empty\");\n }\n\n if (\n typeof jsonData.currentIndex !== \"number\" ||\n jsonData.currentIndex < 0 ||\n jsonData.currentIndex >= jsonData.history.length\n ) {\n throw new Error(\n \"Invalid object: currentIndex must be a valid index within the history array\",\n );\n }\n\n if (!jsonData.config) {\n throw new Error(\"Invalid object: config is required\");\n }\n\n const normalizedHistory = jsonData.history.map(normalizeHistoryEntry);\n\n // Create a new instance with the first survey and config\n const firstEntry = normalizedHistory[0];\n const firstSurvey =\n firstEntry.kind === \"survey-snapshot\"\n ? firstEntry.survey\n : (() => {\n throw new Error(\n \"Invalid object: first history entry must resolve to a survey snapshot\",\n );\n })();\n\n const instance = new SurveyEditorUndoRedo(\n firstSurvey,\n jsonData.config,\n firstEntry.meta,\n initialAssetsOverride ?? jsonData.initialAssets,\n );\n\n // Clear the default initial state and restore the full history\n instance.history = normalizedHistory;\n instance.currentIndex = jsonData.currentIndex;\n instance._initialAssets = cloneAssets(initialAssetsOverride ?? jsonData.initialAssets);\n\n return instance;\n }\n}\n","import { Survey } from \"../survey/survey\";\nimport { CommitMeta, CommitSource, SurveyEditorUndoRedo, type UndoRedoConfig } from \"./undo-redo\";\nimport {\n SurveyItemTranslations,\n SurveyCardContent,\n NavigationContent,\n Content,\n} from \"../survey/utils\";\nimport { RawSurvey, RawSurveyAsset } from \"../survey/survey-file-schema\";\nimport { ItemCopyPaste, SurveyItemClipboardData } from \"./item-copy-paste\";\nimport { Target } from \"./types\";\nimport { SurveyItemCore, RawSurveyItem } from \"../survey/items\";\nimport { GroupItemCore } from \"../survey/registry/built-in-items\";\nimport type { ItemTypeRegistry } from \"../survey/registry/item-registry\";\nimport type { TemplateValueDefinition } from \"../expressions/template-value\";\nimport { structuredCloneMethod } from \"../utils\";\n\n// Interface for serializing SurveyEditor state\nexport interface SerializedSurveyEditor {\n version: string;\n survey: RawSurvey;\n undoRedo: ReturnType<SurveyEditorUndoRedo[\"serialize\"]>;\n hasUncommittedChanges: boolean;\n}\n\nexport interface SurveyEditorConfig extends Partial<UndoRedoConfig> {\n /** Plugin registry for deserializing survey state during undo/redo. Required when survey contains custom item types. */\n pluginRegistry?: ItemTypeRegistry;\n}\n\nfunction stripAssetsFromSurveySnapshot(survey: RawSurvey): RawSurvey {\n const snapshot = structuredCloneMethod(survey);\n delete snapshot.assets;\n return snapshot;\n}\n\nfunction mergeSurveySnapshotWithAssets(\n snapshot: RawSurvey,\n assets?: RawSurvey[\"assets\"],\n): RawSurvey {\n const merged = structuredCloneMethod(snapshot);\n\n if (assets && Object.keys(assets).length > 0) {\n merged.assets = structuredCloneMethod(assets);\n } else {\n delete merged.assets;\n }\n\n return merged;\n}\n\nexport class SurveyEditor {\n private _survey: Survey;\n private _undoRedo: SurveyEditorUndoRedo;\n private _hasUncommittedChanges: boolean = false;\n private _pluginRegistry?: ItemTypeRegistry;\n\n constructor(survey: Survey, config: SurveyEditorConfig = {}, meta?: CommitMeta) {\n this._survey = survey;\n const { pluginRegistry, ...undoRedoConfig } = config;\n this._pluginRegistry = pluginRegistry;\n const serialized = survey.serialize();\n this._undoRedo = new SurveyEditorUndoRedo(\n stripAssetsFromSurveySnapshot(serialized),\n undoRedoConfig,\n meta,\n serialized.assets,\n );\n }\n\n /** Returns an immutable copy of the current survey state. */\n get survey(): Survey {\n const serialized = this._survey.serialize();\n const registry = this._pluginRegistry ?? this._survey.getPluginRegistry();\n return Survey.fromJson(serialized, registry);\n }\n\n get hasUncommittedChanges(): boolean {\n return this._hasUncommittedChanges;\n }\n\n // Expose the undo-redo instance directly\n get undoRedo(): SurveyEditorUndoRedo {\n return this._undoRedo;\n }\n\n // Commit current changes to undo/redo history\n commit(meta: CommitMeta): void {\n if (!this._hasUncommittedChanges) {\n return;\n }\n\n this._undoRedo.commit(stripAssetsFromSurveySnapshot(this._survey.serialize()), meta);\n this._hasUncommittedChanges = false;\n }\n\n private restoreHistoryState(snapshot: RawSurvey, assets?: RawSurvey[\"assets\"]): void {\n this._survey = Survey.fromJson(\n mergeSurveySnapshotWithAssets(snapshot, assets),\n this._pluginRegistry,\n );\n }\n\n commitIfNeeded(): void {\n if (this._hasUncommittedChanges) {\n this.commit({\n label: \"Latest content changes\",\n source: CommitSource.SYSTEM,\n });\n }\n }\n\n // Undo to previous state\n undo(): boolean {\n if (this._hasUncommittedChanges) {\n // If there are uncommitted changes, revert to last committed state\n this.restoreHistoryState(this._undoRedo.getCurrentState(), this._undoRedo.getCurrentAssets());\n this._hasUncommittedChanges = false;\n return true;\n } else {\n // Normal undo operation\n const previousState = this._undoRedo.undo();\n if (previousState) {\n this.restoreHistoryState(previousState, this._undoRedo.getCurrentAssets());\n this._hasUncommittedChanges = false;\n return true;\n }\n return false;\n }\n }\n\n // Redo to next state\n redo(): boolean {\n if (this._hasUncommittedChanges) {\n // Cannot redo when there are uncommitted changes\n return false;\n }\n\n const nextState = this._undoRedo.redo();\n if (nextState) {\n this.restoreHistoryState(nextState, this._undoRedo.getCurrentAssets());\n this._hasUncommittedChanges = false;\n return true;\n }\n return false;\n }\n\n // Enhanced undo/redo methods that use the exposed instance\n /**\n * Jump to a specific index in the history (can go forward or backward)\n */\n jumpToIndex(targetIndex: number): boolean {\n if (this._hasUncommittedChanges) {\n // Cannot jump to specific index with uncommitted changes\n return false;\n }\n\n const targetState = this._undoRedo.jumpToIndex(targetIndex);\n if (targetState) {\n this.restoreHistoryState(targetState, this._undoRedo.getCurrentAssets());\n this._hasUncommittedChanges = false;\n return true;\n }\n return false;\n }\n\n canUndo(): boolean {\n return this._hasUncommittedChanges || this._undoRedo.canUndo();\n }\n\n canRedo(): boolean {\n return !this._hasUncommittedChanges && this._undoRedo.canRedo();\n }\n\n getUndoMeta(): CommitMeta | null {\n if (this._hasUncommittedChanges) {\n return {\n label: \"Latest content changes\",\n source: CommitSource.SYSTEM,\n };\n }\n return this._undoRedo.getUndoMeta();\n }\n\n getRedoMeta(): CommitMeta | null {\n if (this._hasUncommittedChanges) {\n return null;\n }\n return this._undoRedo.getRedoMeta();\n }\n\n // Get memory usage statistics\n getMemoryUsage(): { totalMB: number; entries: number } {\n return this._undoRedo.getMemoryUsage();\n }\n\n // Get undo/redo configuration\n getUndoRedoConfig(): UndoRedoConfig {\n return this._undoRedo.getConfig();\n }\n\n /**\n * Get committed changes after the initial editor state up to the current undo/redo position.\n */\n getCommitsSinceInitial() {\n return this._undoRedo.getCommitsSinceInitial();\n }\n\n /**\n * Serialize the SurveyEditor state to JSON\n * @returns A JSON-serializable object containing the complete editor state\n */\n toJson(): SerializedSurveyEditor {\n return {\n version: \"1.0.0\",\n survey: this._survey.serialize(),\n undoRedo: this._undoRedo.serialize(),\n hasUncommittedChanges: this._hasUncommittedChanges,\n };\n }\n\n /**\n * Create a new SurveyEditor instance from JSON data\n * @param jsonData The serialized editor state\n * @param pluginRegistry Optional plugin registry for deserializing survey state (required when survey contains custom item types)\n * @returns A new SurveyEditor instance with the restored state\n */\n static fromJson(\n jsonData: SerializedSurveyEditor,\n pluginRegistry?: ItemTypeRegistry,\n ): SurveyEditor {\n if (!jsonData.survey) {\n throw new Error(\"Invalid object: survey is required\");\n }\n\n if (!jsonData.undoRedo) {\n throw new Error(\"Invalid object: undoRedo is required\");\n }\n\n if (typeof jsonData.hasUncommittedChanges !== \"boolean\") {\n throw new Error(\"Invalid object: hasUncommittedChanges must be a boolean\");\n }\n\n // Validate version (for future compatibility)\n if (jsonData.version && !jsonData.version.startsWith(\"1.\")) {\n console.warn(\n `Warning: Loading SurveyEditor with version ${jsonData.version}, current version is 1.0.0`,\n );\n }\n\n // Create survey from JSON\n const survey = Survey.fromJson(jsonData.survey, pluginRegistry);\n\n // Create a new editor instance\n const editor = new SurveyEditor(survey, { pluginRegistry });\n\n // Restore undo/redo state\n editor._undoRedo = SurveyEditorUndoRedo.deserialize(\n {\n ...jsonData.undoRedo,\n history: jsonData.undoRedo.history.map((entry) =>\n \"survey\" in entry\n ? {\n ...entry,\n survey: stripAssetsFromSurveySnapshot(entry.survey),\n }\n : entry,\n ),\n },\n jsonData.survey.assets,\n );\n\n // Infer whether the live survey contains uncommitted survey changes by comparing\n // the current survey content to the current history entry, ignoring assets.\n editor._hasUncommittedChanges =\n JSON.stringify(stripAssetsFromSurveySnapshot(jsonData.survey)) !==\n JSON.stringify(editor._undoRedo.getCurrentState());\n\n return editor;\n }\n\n private markAsModified(): void {\n this._hasUncommittedChanges = true;\n }\n\n addItem(target: Target, item: SurveyItemCore, content?: SurveyItemTranslations): void {\n // Mark as modified (uncommitted change)\n this.markAsModified();\n\n // Find the parent group item\n let parentGroup: GroupItemCore;\n\n if (!target) {\n // If no target provided, add to root\n\n const rootItem = this._survey.rootItem;\n if (!rootItem) {\n throw new Error(\"No root group found in survey\");\n }\n if (!(rootItem instanceof GroupItemCore)) {\n throw new Error(\"Root item is not a group item\");\n }\n parentGroup = rootItem;\n } else {\n // Find the target parent group\n const targetItem = this._survey.surveyItems.get(target.parentId);\n\n if (!targetItem) {\n throw new Error(`Parent item with id '${target.parentId}' not found`);\n }\n\n if (!(targetItem instanceof GroupItemCore)) {\n throw new Error(\n `Parent item '${target.parentId}' is not a group item (${targetItem.type})`,\n );\n }\n\n parentGroup = targetItem;\n }\n\n if (parentGroup.hasChild(item.id)) {\n throw new Error(`Item ${item.id} already in this group`);\n }\n\n // ensure that item's key not already used within the group\n const siblings = Array.from(this._survey.surveyItems.values()).filter((sItem) =>\n parentGroup.items?.includes(sItem.id),\n );\n let counter = 1;\n while (siblings.some((sibling) => sibling.key === item.key)) {\n item.key += `_${counter}`;\n counter++;\n }\n\n // Determine insertion index\n let insertIndex: number;\n if (target?.index !== undefined) {\n // Insert at specified index, or at end if index is larger than array length\n insertIndex = Math.min(target.index, parentGroup.items.length);\n } else {\n // Insert at the end\n insertIndex = parentGroup.items.length;\n }\n\n // Add the item to the survey items collection\n this._survey.surveyItems.set(item.id, item);\n\n // Add the item to the parent group (uses addChild for proper persistence)\n parentGroup.addChild(item.id, insertIndex);\n\n // Update translations in the survey\n if (content) {\n this._survey.translations.setItemTranslations(item.id, content);\n }\n }\n\n // Remove an item from the survey\n removeItem(itemId: string, nested: boolean = false): boolean {\n this.markAsModified();\n const item = this._survey.surveyItems.get(itemId);\n if (!item) {\n return false;\n }\n\n // Find parent group and remove from its items array\n const parentItem = this._survey.getParentItem(itemId);\n if (!parentItem) {\n throw new Error(`Item with id '${itemId}' is the root item`);\n }\n\n if (item instanceof GroupItemCore) {\n for (const childId of item.getChildrenIds()) {\n this.removeItem(childId, true);\n }\n }\n\n // Remove from survey items\n this._survey.surveyItems.delete(itemId);\n\n // Remove translations\n this._survey.translations?.onItemDeleted(itemId);\n\n if (!nested) {\n parentItem.removeChild(itemId);\n }\n return true;\n }\n\n // Move an item to a different position\n moveItem(itemId: string, newTarget: Target): boolean {\n this.markAsModified();\n // Check if item exists\n const item = this._survey.surveyItems.get(itemId);\n if (!item) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n\n // Check if new target exists and is a group\n const targetItem = this._survey.surveyItems.get(newTarget.parentId);\n if (!targetItem) {\n throw new Error(`Target parent with id '${newTarget.parentId}' not found`);\n }\n\n if (!(targetItem instanceof GroupItemCore)) {\n throw new Error(\n `Target parent '${newTarget.parentId}' is not a group item (${targetItem.type})`,\n );\n }\n\n // Check if new target is not a child of the current item (prevent circular reference)\n if (this._survey.isDescendantOf(newTarget.parentId, itemId)) {\n throw new Error(`Cannot move item '${itemId}' to its descendant '${newTarget.parentId}'`);\n }\n\n // If the item is already in the target parent\n const currentParentItem = this._survey.getParentItem(itemId);\n if (currentParentItem?.id === newTarget.parentId) {\n throw new Error(`Item '${itemId}' is already in the target parent '${newTarget.parentId}'`);\n }\n\n // Remove item from current parent's items array\n if (currentParentItem) {\n const currentParentGroup = currentParentItem as GroupItemCore;\n currentParentGroup.removeChild(itemId);\n }\n\n // Add item to new parent's items array\n const targetGroup = targetItem as GroupItemCore;\n\n // ensure that item's key not already used within the group\n const siblings = Array.from(this._survey.surveyItems.values()).filter((sItem) =>\n targetGroup.hasChild(sItem.id),\n );\n let counter = 1;\n while (siblings.some((sibling) => sibling.key === item.key)) {\n item.key += `_${counter}`;\n counter++;\n }\n\n const insertIndex =\n newTarget.index !== undefined\n ? Math.min(newTarget.index, targetGroup.items.length)\n : targetGroup.items.length;\n\n targetGroup.items.splice(insertIndex, 0, itemId);\n\n return true;\n }\n\n /**\n * Get a deep copy of an item's raw data.\n * The returned object is independent of the survey—mutating it will not affect the survey.\n * Use this when you need to edit an item in a form or pass it to updateItem after modifications.\n *\n * @param itemId - The ID of the item to copy\n * @returns A deep copy of the item's RawSurveyItem data\n * @throws Error if the item is not found\n */\n getItemDataCopy(itemId: string): RawSurveyItem {\n const item = this._survey.surveyItems.get(itemId);\n if (!item) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n return JSON.parse(JSON.stringify(item.rawItem)) as RawSurveyItem;\n }\n\n /**\n * Update an item's data in the survey.\n * Can update common attributes (displayConditions, disabledConditions, validations, etc.)\n * as well as type-specific config.\n *\n * Use getItemDataCopy to obtain an editable copy, modify it, then pass it here.\n * Alternatively, pass a Partial to merge specific fields (top-level keys only;\n * e.g. config replaces the entire config object).\n *\n * @param itemId - The ID of the item to update (must match data.id if provided)\n * @param rawItemData - Full RawSurveyItem or Partial to merge. The id cannot be changed.\n */\n updateItem(itemId: string, rawItemData: RawSurveyItem | Partial<RawSurveyItem>): void {\n const existingItem = this._survey.surveyItems.get(itemId);\n if (!existingItem) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n\n if (\"id\" in rawItemData && rawItemData.id !== undefined && rawItemData.id !== itemId) {\n throw new Error(`Cannot change item id from '${itemId}' to '${rawItemData.id}'`);\n }\n\n const currentRaw = existingItem.rawItem;\n const merged: RawSurveyItem = {\n ...currentRaw,\n ...rawItemData,\n id: itemId, // Ensure id is never changed\n };\n\n // Reject key change if it would collide with a sibling\n const newKey = merged.key ?? existingItem.key;\n const parentGroup = this._survey.getParentItem(itemId);\n if (parentGroup) {\n const siblingWithSameKey = (parentGroup.items ?? [])\n .filter((id) => id !== itemId)\n .map((id) => this._survey.surveyItems.get(id))\n .find((s) => s !== undefined && s.key === newKey);\n if (siblingWithSameKey) {\n throw new Error(\n `Key '${newKey}' is already in use by sibling item '${siblingWithSameKey.id}'`,\n );\n }\n }\n\n const newItem = this._survey.createItemFromRaw(merged);\n this._survey.surveyItems.set(itemId, newItem);\n this.markAsModified();\n }\n\n // TODO: add also to update component translations (updating part of the item)\n // Update item translations\n updateItemTranslations(itemId: string, updatedContent?: SurveyItemTranslations): boolean {\n const item = this._survey.surveyItems.get(itemId);\n if (!item) {\n return false;\n }\n\n this.markAsModified();\n this._survey.translations.setItemTranslations(itemId, updatedContent);\n\n return true;\n }\n\n /**\n * Update survey-level translations that are not tied to specific items.\n * Use these for survey card, navigation, validation messages, etc.\n */\n updateSurveyTranslations(updates: {\n surveyCard?: { locale: string; content?: SurveyCardContent };\n navigation?: { locale: string; content?: NavigationContent };\n validationMessages?: { locale: string; content?: { invalidResponse?: Content } };\n }): void {\n this.markAsModified();\n if (updates.surveyCard) {\n this._survey.translations.setSurveyCardContent(\n updates.surveyCard.locale,\n updates.surveyCard.content,\n );\n }\n if (updates.navigation) {\n this._survey.translations.setNavigationContent(\n updates.navigation.locale,\n updates.navigation.content,\n );\n }\n if (updates.validationMessages) {\n this._survey.translations.setValidationMessages(\n updates.validationMessages.locale,\n updates.validationMessages.content,\n );\n }\n }\n\n /**\n * Get maxItemsPerPage immutably (returns a copy).\n */\n getMaxItemsPerPage(): { large: number; small: number } | undefined {\n const val = this._survey.maxItemsPerPage;\n return val ? { ...val } : undefined;\n }\n\n /**\n * Update maxItemsPerPage.\n */\n updateMaxItemsPerPage(value: { large: number; small: number } | undefined): void {\n this.markAsModified();\n this._survey.maxItemsPerPage = value ? { ...value } : undefined;\n }\n\n /**\n * Get metadata immutably (returns a copy).\n */\n getMetadata(): { [key: string]: string } | undefined {\n const val = this._survey.metadata;\n return val ? { ...val } : undefined;\n }\n\n /**\n * Update metadata.\n */\n updateMetadata(metadata: { [key: string]: string } | undefined): void {\n this.markAsModified();\n this._survey.metadata = metadata ? { ...metadata } : undefined;\n }\n\n /**\n * Get a template value immutably (returns a deep copy).\n */\n getTemplateValue(key: string): TemplateValueDefinition | undefined {\n const val = this._survey.getTemplateValue(key);\n return val ? structuredCloneMethod(val) : undefined;\n }\n\n /**\n * Get all template values immutably (returns a new Map with deep-copied values).\n */\n getTemplateValues(): Map<string, TemplateValueDefinition> {\n const keys = this._survey.getTemplateValueKeys();\n const result = new Map<string, TemplateValueDefinition>();\n for (const key of keys) {\n const val = this._survey.getTemplateValue(key);\n if (val) {\n result.set(key, structuredCloneMethod(val));\n }\n }\n return result;\n }\n\n /**\n * Add or replace a template value.\n */\n setTemplateValue(key: string, templateValue: TemplateValueDefinition): void {\n this.markAsModified();\n this._survey.setTemplateValue(key, structuredCloneMethod(templateValue));\n }\n\n /**\n * Remove a template value.\n */\n removeTemplateValue(key: string): void {\n this.markAsModified();\n this._survey.deleteTemplateValue(key);\n }\n\n /**\n * Get a survey asset immutably.\n */\n getAsset(assetId: string): RawSurveyAsset | undefined {\n const asset = this._survey.getAsset(assetId);\n return asset ? structuredCloneMethod(asset) : undefined;\n }\n\n /**\n * Get all survey assets immutably.\n */\n getAssets(): Map<string, RawSurveyAsset> {\n return this._survey.getAssets();\n }\n\n /**\n * Add or replace a survey asset.\n */\n setAsset(assetId: string, asset: RawSurveyAsset): void {\n const previousAsset = this._survey.getAsset(assetId);\n this._survey.setAsset(assetId, structuredCloneMethod(asset));\n this._undoRedo.commitAssetChange(\n [\n {\n assetId,\n prev: previousAsset,\n next: structuredCloneMethod(asset),\n },\n ],\n {\n label: `Update asset: ${assetId}`,\n source: CommitSource.USER,\n },\n );\n }\n\n /**\n * Remove a survey asset.\n */\n removeAsset(assetId: string): void {\n const previousAsset = this._survey.getAsset(assetId);\n if (!previousAsset) {\n return;\n }\n this._survey.deleteAsset(assetId);\n this._undoRedo.commitAssetChange(\n [\n {\n assetId,\n prev: previousAsset,\n },\n ],\n {\n label: `Remove asset: ${assetId}`,\n source: CommitSource.USER,\n },\n );\n }\n\n /**\n * Copy a survey item and all its data to clipboard format\n * @param itemId - The ID of the item to copy\n * @returns Clipboard data that can be serialized to JSON for clipboard\n */\n copyItem(itemId: string): SurveyItemClipboardData {\n const copyPaste = new ItemCopyPaste(this._survey);\n return copyPaste.copyItem(itemId);\n }\n\n /**\n * Paste a survey item from clipboard data to a target location\n * @param clipboardData - The clipboard data containing the item to paste\n * @param target - Target location where to paste the item\n * @returns The ID of the pasted item\n */\n pasteItem(clipboardData: SurveyItemClipboardData, target: Target): string {\n this.markAsModified();\n const copyPaste = new ItemCopyPaste(this._survey);\n const newItemId = copyPaste.pasteItem(clipboardData, target);\n\n return newItemId;\n }\n}\n"],"mappings":";;AA+FA,MAAM,uBAA6D;CACjE,MAAM;CACN,SAAS;CACT,MAAM;CACP;AAED,MAAM,2BAA2B;AACjC,MAAM,wCAAwC;AAC9C,MAAM,yCAAyC;AAE/C,MAAM,mBAQF;CACF,SAAS;EACP,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAsB;EACvB;CACD,kBAAkB;EAChB,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAsB;EACvB;CACD,oBAAoB;EAClB,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAsB;EACvB;CACD,mBAAmB;EACjB,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAs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Ac,CAAC;;;;;CAM1E,oBAAoB,KAAmB;AACrC,OAAK,gBAAgB;AACrB,OAAK,QAAQ,oBAAoB,IAAI;;;;;CAMvC,SAAS,SAA6C;EACpD,MAAM,QAAQ,KAAK,QAAQ,SAAS,QAAQ;AAC5C,SAAO,QAAQ,sBAAsB,MAAM,GAAG,KAAA;;;;;CAMhD,YAAyC;AACvC,SAAO,KAAK,QAAQ,WAAW;;;;;CAMjC,SAAS,SAAiB,OAA6B;EACrD,MAAM,gBAAgB,KAAK,QAAQ,SAAS,QAAQ;AACpD,OAAK,QAAQ,SAAS,SAAS,sBAAsB,MAAM,CAAC;AAC5D,OAAK,UAAU,kBACb,CACE;GACE;GACA,MAAM;GACN,MAAM,sBAAsB,MAAM;GACnC,CACF,EACD;GACE,OAAO,iBAAiB;GACxB,QAAQ,aAAa;GACtB,CACF;;;;;CAMH,YAAY,SAAuB;EACjC,MAAM,gBAAgB,KAAK,QAAQ,SAAS,QAAQ;AACpD,MAAI,CAAC,cACH;AAEF,OAAK,QAAQ,YAAY,QAAQ;AACjC,OAAK,UAAU,kBACb,CACE;GACE;GACA,MAAM;GACP,CACF,EACD;GACE,OAAO,iBAAiB;GACxB,QAAQ,aAAa;GACtB,CACF;;;;;;;CAQH,SAAS,QAAyC;AAEhD,SAAO,IADe,cAAc,KAAK,QACzB,CAAC,SAAS,OAAO;;;;;;;;CASnC,UAAU,eAAwC,QAAwB;AACxE,OAAK,gBAAgB;AAIrB,SAFkB,IADI,cAAc,KAAK,QACd,CAAC,UAAU,eAAe,OAErC"}
|
package/build/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as RichTextLinkInline, $t as ExpressionEditorConfig, A as SurveyTranslations, An as ValueType, At as SurveyItemPrefillSource, B as RichTextBulletListBlock, Bt as ItemExpressionParameterInput, C as SurveyVersion, Cn as ReferenceArrayResponse, Ct as serializeTemplateValues, D as SurveyCardContent, Dn as StringArrayResponse, Dt as JsonSurveyItemPrefillTarget, E as NavigationContent, En as SlotResponseBase, Et as JsonSurveyItemPrefillSource, F as ContentType, Ft as prefillTargetsEqual, G as RichTextImageDimension, Gt as SurveyItemCore, H as RichTextDocument, Ht as buildItemExpression, I as MDContent, It as serializeSurveyItemPrefill, J as RichTextInline, Jt as RawSurveyItem, K as RichTextImageSize, Kt as SurveyItemCoreType, L as PlainTextContent, Lt as AnyItemExpressionDefinition, M as Content, Mn as isResponseValue, Mt as SurveyItemPrefillTargetType, N as ContentAssetUsage, Nt as SurveyItemPreviousResponseRef, O as SurveyCardTranslations, On as StringResponse, Ot as SurveyItemPrefill, P as ContentAttributes, Pt as deserializeSurveyItemPrefill, Q as RichTextLinkChildInline, Qt as Expression, R as RichTextBlockExtension, Rt as ItemExpressionDefinition, S as RawSurveyAsset, Sn as NumberResponse, St as serializeTemplateValue, T as JsonSurveyTranslations, Tn as ResponseValue, Tt as JsonSurveyItemPrefill, U as RichTextHeadingBlock, Ut as getItemExpressionDefinition, V as RichTextContent, Vt as ItemExpressionParameterOption, W as RichTextImageBlock, Wt as ItemCoreConstructor, X as RichTextInlineNode, Xt as ContextVariableExpression, Y as RichTextInlineExtension, Yt as ConstExpression, Z as RichTextLineBreakInline, Zt as ContextVariableType, _ as createItemTypeDefinitionRegistry, _n as DurationResponse, _t as TemplateValueBase, a as GroupItemCore, an as JsonExpression, at as RichTextTextInline, b as CURRENT_SURVEY_SCHEMA, bn as NumberArrayResponse, bt as deserializeTemplateValue, c as builtInItemCoreRegistry, cn as ResponseVariableExpression, ct as createRichTextContent, d as ItemTypeDefinition, dn as ValueReference, dt as getPlainTextFromRichTextContent, en as ExpressionType, et as RichTextListItemBlock, f as ItemTypeDefinitionRegistry, fn as ValueReferenceMethod, ft as hasRenderableRichTextBlock, g as createItemCore, gn as DurationArrayResponse, gt as TemplateDefTypes, h as createFullRegistry, hn as DateResponse, ht as JsonTemplateValue, i as GroupConfig, in as JsonContextVariableExpression, it as RichTextTemplateInline, j as validateLocale, jn as assertResponseValue, jt as SurveyItemPrefillTarget, k as SurveyItemTranslations, kn as ValueRefTypeLookup, kt as SurveyItemPrefillApplyMode, l as isBuiltInItemType, ln as ReferenceUsage, lt as getAssetUsagesFromContent, m as ItemTypeRegistry, mn as DateArrayResponse, mt as isContentEmpty, n as SurveyAssetUsage, nn as FunctionExpressionNames, nt as RichTextSeparatorBlock, o as PageBreakConfig, on as JsonFunctionExpression, ot as SurveyContentImageSource, p as ItemTypeName, pn as BooleanResponse, pt as hasRenderableRichTextContent, q as RichTextInfoBoxBlock, qt as ReservedSurveyItemTypes, r as BuiltInItemType, rn as JsonConstExpression, rt as RichTextStyle, s as PageBreakItemCore, sn as JsonResponseVariableExpression, st as TextAlignment, t as Survey, tn as FunctionExpression, tt as RichTextParagraphBlock, u as ItemTypeCapabilities, un as ReferenceUsageType, ut as getContentPlainText, v as toItemTypeDefinitionRegistry, vn as DurationUnit, vt as TemplateValueDefinition, w as JsonComponentContent, wn as ReferenceResponse, wt as ResponseSlotDefinition, x as RawSurvey, xn as NumberPrecision, xt as deserializeTemplateValues, y as SurveyItemKey, yn as DurationUnits, yt as TemplateValueFormatDate, z as RichTextBlockNode, zt as ItemExpressionParameterDefinition } from "./survey-
|
|
1
|
+
import { $ as RichTextLinkInline, $t as ExpressionEditorConfig, A as SurveyTranslations, An as ValueType, At as SurveyItemPrefillSource, B as RichTextBulletListBlock, Bt as ItemExpressionParameterInput, C as SurveyVersion, Cn as ReferenceArrayResponse, Ct as serializeTemplateValues, D as SurveyCardContent, Dn as StringArrayResponse, Dt as JsonSurveyItemPrefillTarget, E as NavigationContent, En as SlotResponseBase, Et as JsonSurveyItemPrefillSource, F as ContentType, Ft as prefillTargetsEqual, G as RichTextImageDimension, Gt as SurveyItemCore, H as RichTextDocument, Ht as buildItemExpression, I as MDContent, It as serializeSurveyItemPrefill, J as RichTextInline, Jt as RawSurveyItem, K as RichTextImageSize, Kt as SurveyItemCoreType, L as PlainTextContent, Lt as AnyItemExpressionDefinition, M as Content, Mn as isResponseValue, Mt as SurveyItemPrefillTargetType, N as ContentAssetUsage, Nt as SurveyItemPreviousResponseRef, O as SurveyCardTranslations, On as StringResponse, Ot as SurveyItemPrefill, P as ContentAttributes, Pt as deserializeSurveyItemPrefill, Q as RichTextLinkChildInline, Qt as Expression, R as RichTextBlockExtension, Rt as ItemExpressionDefinition, S as RawSurveyAsset, Sn as NumberResponse, St as serializeTemplateValue, T as JsonSurveyTranslations, Tn as ResponseValue, Tt as JsonSurveyItemPrefill, U as RichTextHeadingBlock, Ut as getItemExpressionDefinition, V as RichTextContent, Vt as ItemExpressionParameterOption, W as RichTextImageBlock, Wt as ItemCoreConstructor, X as RichTextInlineNode, Xt as ContextVariableExpression, Y as RichTextInlineExtension, Yt as ConstExpression, Z as RichTextLineBreakInline, Zt as ContextVariableType, _ as createItemTypeDefinitionRegistry, _n as DurationResponse, _t as TemplateValueBase, a as GroupItemCore, an as JsonExpression, at as RichTextTextInline, b as CURRENT_SURVEY_SCHEMA, bn as NumberArrayResponse, bt as deserializeTemplateValue, c as builtInItemCoreRegistry, cn as ResponseVariableExpression, ct as createRichTextContent, d as ItemTypeDefinition, dn as ValueReference, dt as getPlainTextFromRichTextContent, en as ExpressionType, et as RichTextListItemBlock, f as ItemTypeDefinitionRegistry, fn as ValueReferenceMethod, ft as hasRenderableRichTextBlock, g as createItemCore, gn as DurationArrayResponse, gt as TemplateDefTypes, h as createFullRegistry, hn as DateResponse, ht as JsonTemplateValue, i as GroupConfig, in as JsonContextVariableExpression, it as RichTextTemplateInline, j as validateLocale, jn as assertResponseValue, jt as SurveyItemPrefillTarget, k as SurveyItemTranslations, kn as ValueRefTypeLookup, kt as SurveyItemPrefillApplyMode, l as isBuiltInItemType, ln as ReferenceUsage, lt as getAssetUsagesFromContent, m as ItemTypeRegistry, mn as DateArrayResponse, mt as isContentEmpty, n as SurveyAssetUsage, nn as FunctionExpressionNames, nt as RichTextSeparatorBlock, o as PageBreakConfig, on as JsonFunctionExpression, ot as SurveyContentImageSource, p as ItemTypeName, pn as BooleanResponse, pt as hasRenderableRichTextContent, q as RichTextInfoBoxBlock, qt as ReservedSurveyItemTypes, r as BuiltInItemType, rn as JsonConstExpression, rt as RichTextStyle, s as PageBreakItemCore, sn as JsonResponseVariableExpression, st as TextAlignment, t as Survey, tn as FunctionExpression, tt as RichTextParagraphBlock, u as ItemTypeCapabilities, un as ReferenceUsageType, ut as getContentPlainText, v as toItemTypeDefinitionRegistry, vn as DurationUnit, vt as TemplateValueDefinition, w as JsonComponentContent, wn as ReferenceResponse, wt as ResponseSlotDefinition, x as RawSurvey, xn as NumberPrecision, xt as deserializeTemplateValues, y as SurveyItemKey, yn as DurationUnits, yt as TemplateValueFormatDate, z as RichTextBlockNode, zt as ItemExpressionParameterDefinition } from "./survey-BV8YHc3J.mjs";
|
|
2
2
|
import { Locale } from "date-fns";
|
|
3
3
|
|
|
4
4
|
//#region src/survey/responses/response-meta.d.ts
|
|
@@ -11,7 +11,7 @@ declare const SurveyEventTypes: {
|
|
|
11
11
|
readonly responeChanged: "responeChanged";
|
|
12
12
|
readonly languageChanged: "languageChanged";
|
|
13
13
|
};
|
|
14
|
-
type SurveyEventTypes = typeof SurveyEventTypes[keyof typeof SurveyEventTypes];
|
|
14
|
+
type SurveyEventTypes = (typeof SurveyEventTypes)[keyof typeof SurveyEventTypes];
|
|
15
15
|
interface SurveyEventBase<TEventType extends SurveyEventTypes = SurveyEventTypes> {
|
|
16
16
|
type: TEventType;
|
|
17
17
|
timestamp: number;
|
|
@@ -418,10 +418,10 @@ interface JsonSurveyResponse {
|
|
|
418
418
|
declare const initValueForType: (returnType: ValueType) => ResponseValue;
|
|
419
419
|
//#endregion
|
|
420
420
|
//#region src/to_mirgrate/data_types/expression.d.ts
|
|
421
|
-
type SelectionMethodNames =
|
|
422
|
-
type SurveyContextRuleNames =
|
|
423
|
-
type SurveyPrefillRuleNames =
|
|
424
|
-
type ClientSideSurveyExpName =
|
|
421
|
+
type SelectionMethodNames = "sequential" | "uniform" | "highestPriority" | "exponential";
|
|
422
|
+
type SurveyContextRuleNames = "LAST_RESPONSES_BY_KEY" | "ALL_RESPONSES_SINCE" | "RESPONSES_SINCE_BY_KEY";
|
|
423
|
+
type SurveyPrefillRuleNames = "GET_LAST_SURVEY_ITEM";
|
|
424
|
+
type ClientSideSurveyExpName = "or" | "and" | "not" | "eq" | "lt" | "lte" | "gt" | "gte" | "isDefined" | "getContext" | "getResponses" | "getRenderedItems" | "getAttribute" | "getArrayItemAtIndex" | "getArrayItemByKey" | "getObjByHierarchicalKey" | "getNestedObjectByKey" | "findPreviousSurveyResponsesByKey" | "getLastFromSurveyResponses" | "getPreviousResponses" | "filterResponsesByIncludesKeys" | "filterResponsesByValue" | "getLastFromSurveyItemResponses" | "getSecondsSince" | "parseValueAsNum" | "hasResponse" | "getResponseItem" | "getResponseValueAsNum" | "getResponseValueAsStr" | "checkResponseValueWithRegex" | "responseHasKeysAny" | "responseHasKeysAll" | "responseHasOnlyKeysOtherThan" | "getSurveyItemValidation" | "timestampWithOffset" | "dateResponseDiffFromNow" | "countResponseItems" | "hasParticipantFlagKey" | "hasParticipantFlagKeyAndValue" | "getParticipantFlagValue" | "validateSelectedOptionHasValueDefined";
|
|
425
425
|
type StudyEngineExpNames = string;
|
|
426
426
|
type ExpressionName = ClientSideSurveyExpName | SelectionMethodNames | SurveyContextRuleNames | SurveyPrefillRuleNames | StudyEngineExpNames;
|
|
427
427
|
interface Expression$1 {
|
|
@@ -429,7 +429,7 @@ interface Expression$1 {
|
|
|
429
429
|
returnType?: string;
|
|
430
430
|
data?: ExpressionArg[];
|
|
431
431
|
}
|
|
432
|
-
type ExpressionArgDType =
|
|
432
|
+
type ExpressionArgDType = "exp" | "num" | "str";
|
|
433
433
|
interface ExpressionArg {
|
|
434
434
|
dtype?: ExpressionArgDType;
|
|
435
435
|
exp?: Expression$1;
|
|
@@ -514,7 +514,7 @@ interface LegacySurveyGroupItem extends LegacySurveyItemBase {
|
|
|
514
514
|
selectionMethod?: Expression$1;
|
|
515
515
|
}
|
|
516
516
|
declare const isLegacySurveyGroupItem: (item: LegacySurveyItem) => item is LegacySurveyGroupItem;
|
|
517
|
-
type LegacySurveyItemTypes =
|
|
517
|
+
type LegacySurveyItemTypes = "pageBreak" | "test" | "surveyEnd";
|
|
518
518
|
interface LegacySurveySingleItem extends LegacySurveyItemBase {
|
|
519
519
|
type?: LegacySurveyItemTypes;
|
|
520
520
|
components?: LegacyItemGroupComponent;
|
|
@@ -524,10 +524,10 @@ interface LegacySurveySingleItem extends LegacySurveyItemBase {
|
|
|
524
524
|
}
|
|
525
525
|
interface LegacyValidation {
|
|
526
526
|
key: string;
|
|
527
|
-
type:
|
|
527
|
+
type: "soft" | "hard";
|
|
528
528
|
rule: Expression$1 | boolean;
|
|
529
529
|
}
|
|
530
|
-
type LegacyConfidentialMode =
|
|
530
|
+
type LegacyConfidentialMode = "add" | "replace";
|
|
531
531
|
//#endregion
|
|
532
532
|
//#region src/engine/engine.d.ts
|
|
533
533
|
type ScreenSize = "small" | "large";
|
package/build/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/survey/responses/response-meta.ts","../src/survey/responses/item-response.ts","../src/survey/utils/context.ts","../src/expressions/expression-evaluator.ts","../src/expressions/editors/expression-editor.ts","../src/expressions/editors/expression-editor-generators.ts","../src/survey/responses/survey-response.ts","../src/survey/responses/utils.ts","../src/to_mirgrate/data_types/expression.ts","../src/to_mirgrate/data_types/legacy-types.ts","../src/engine/engine.ts","../src/utils.ts","../src/response-exporter/types.ts","../src/response-exporter/exporter.ts","../src/response-exporter/slot-formatter.ts","../src/response-exporter/csv-serializer.ts","../src/response-exporter/codebook.ts"],"mappings":";;;;UAAiB,gBAAA;EACf,QAAA;AAAA;AAAA,cAGW,gBAAA;EAAA;;;;;KAOD,gBAAA,UAA0B,gBAAA,cAA8B,gBAAA;AAAA,UAInD,eAAA,oBAAmC,gBAAA,GAAmB,gBAAA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EaoEI,sBAAA,CAAuB,SAAA,WAAoB,YAAA;;;;;EAyC3C,cAAA,CACI,SAAA,UACA,SAAA,GAAY,cAAA,IACZ,UAAA,cACD,YAAA;EAAA,QA+DK,wBAAA;EAAA,QAIA,mBAAA;EAAA,QASA,mBAAA;EAAA,QAWA,kBAAA;EAAA,QAUA,yBAAA;EASR,cAAA,CAAe,QAAA,EAAU,cAAA,GAAiB,SAAA;EbpNR;;AAItC;EagQI,sBAAA,CACI,SAAA,EAAW,cAAA,KACZ,YAAA;EAOH,oBAAA,CACI,SAAA,EAAW,cAAA,IACX,OAAA,GAAU,gBAAA;AAAA;;;;cCjRL,iBAAA,EAAmB,mBAAA;AdThC;;;;AAAA,iBciBgB,wBAAA,CAAyB,MAAA;EACvC,KAAA,EAAO,aAAA;EACP,SAAA,EAAW,SAAA;EACX,eAAA,EAAiB,mBAAA;AAAA;;;;;;AdpBnB;iBeYgB,aAAA,CAAc,KAAA,UAAe,SAAA;;;;iBAiB7B,cAAA,CACd,OAAA,EAAS,YAAA,IACT,IAAA,EAAM,SAAA,IACN,OAAA,GAAU,gBAAA;;;;UC3BK,YAAA;EACf,MAAA;EACA,GAAA;EACA,OAAA;EACA,SAAA,EAAW,SAAA;AAAA;AhBLb;AAAA,UgBSiB,YAAA;EACf,EAAA;EACA,GAAA;EACA,OAAA;EACA,IAAA;EACA,WAAA;EACA,KAAA,EAAO,YAAA;;EAEP,eAAA,GAAkB,MAAA,SAAe,MAAA;AAAA;;UAIlB,QAAA;EACf,SAAA;EACA,KAAA,EAAO,YAAA;AAAA;;;;iBAOO,gBAAA,CACd,MAAA,EAAQ,MAAA,EACR,OAAA;EAAY,OAAA;AAAA,IACX,QAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/survey/responses/response-meta.ts","../src/survey/responses/item-response.ts","../src/survey/utils/context.ts","../src/expressions/expression-evaluator.ts","../src/expressions/editors/expression-editor.ts","../src/expressions/editors/expression-editor-generators.ts","../src/survey/responses/survey-response.ts","../src/survey/responses/utils.ts","../src/to_mirgrate/data_types/expression.ts","../src/to_mirgrate/data_types/legacy-types.ts","../src/engine/engine.ts","../src/utils.ts","../src/response-exporter/types.ts","../src/response-exporter/exporter.ts","../src/response-exporter/slot-formatter.ts","../src/response-exporter/csv-serializer.ts","../src/response-exporter/codebook.ts"],"mappings":";;;;UAAiB,gBAAA;EACf,QAAA;AAAA;AAAA,cAGW,gBAAA;EAAA;;;;;KAOD,gBAAA,WAA2B,gBAAA,eAA+B,gBAAA;AAAA,UAErD,eAAA,oBAAmC,gBAAA,GAAmB,gBAAA;EACrE,IAAA,EAAM,UAAA;EACN,SAAA;AAAA;AAAA,UAGe,eAAA,SAAwB,eAAA,QAAuB,gBAAA,CAAiB,UAAA;EAC/E,KAAA;AAAA;AAAA,UAGe,gBAAA,SAAyB,eAAA,QAAuB,gBAAA,CAAiB,WAAA;EAChF,KAAA;AAAA;AAAA,UAGe,oBAAA,SAA6B,eAAA,QACrC,gBAAA,CAAiB,cAAA;EAExB,MAAA;AAAA;AAAA,UAGe,oBAAA,SAA6B,eAAA,QACrC,gBAAA,CAAiB,eAAA;EAExB,KAAA;AAAA;AAAA,KAGU,WAAA,GACR,eAAA,GACA,gBAAA,GACA,oBAAA,GACA,oBAAA;;;UCvCa,sBAAA;EACf,MAAA;EACA,QAAA;EACA,IAAA,GAAO,gBAAA;EACP,QAAA,GAAW,gBAAA;AAAA;AAAA,UAGI,gBAAA;EACf,KAAA,EAAO,MAAA,SAAe,aAAA;AAAA;;;;cAMX,kBAAA;EACX,MAAA;EACA,IAAA,GAAO,gBAAA;EACP,QAAA,GAAW,YAAA;EACX,QAAA;cAGE,OAAA;IACE,MAAA;IACA,QAAA;EAAA,GAEF,QAAA,GAAW,YAAA;EAOb,SAAA,CAAA,GAAa,sBAAA;EAAA,OASN,WAAA,CAAY,IAAA,EAAM,sBAAA,GAAyB,kBAAA;AAAA;AAAA,cA2BvC,YAAA;EAAA,QACH,MAAA;cAEI,aA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