@pie-qti/item-player 1.0.0-beta.5 → 1.0.0-beta.6

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 CHANGED
@@ -257,7 +257,7 @@ const pci = {
257
257
  }),
258
258
  // Or the sandboxed engine: module URLs are resolved and handed to the runner
259
259
  // frame; nothing is evaluated in the page.
260
- // sandbox: { runnerUrl: 'https://qti.pie-framework.org/pci-runner.html' },
260
+ // sandbox: { runnerUrl: 'https://pci-runner.example.com/pci-runner.html' },
261
261
  };
262
262
  ```
263
263
 
@@ -476,6 +476,9 @@ export class Player {
476
476
  return this.runItemSessionAction({ action: 'newTemplate', ...options });
477
477
  }
478
478
  runItemSessionAction(command) {
479
+ // A mounted PCI module answers through getResponse() when the delivery engine asks, and
480
+ // need not call ondone after each change: settle its value before processing or saving.
481
+ this.getResponses();
479
482
  switch (command.action) {
480
483
  case 'suspendAttempt':
481
484
  return this.runSuspendAttemptAction();
@@ -1 +1 @@
1
- {"version":3,"file":"Player.js","sourceRoot":"","sources":["../../src/core/Player.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAE1B,kBAAkB,EAElB,kBAAkB,EAClB,QAAQ,EAIR,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,aAAa,GACb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AACvE,OAAO,EACN,gBAAgB,EAChB,wBAAwB,GAExB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAEpF,OAAO,EACN,wBAAwB,EACxB,+BAA+B,GAE/B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE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K,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/E,OAAO,gBAAgB,GAAG,EAAE,CAAC;IAC9B,CAAC;IACD,MAAM,IAAI,KAAK,CACd,oFAAoF;QACnF,iFAAiF;QACjF,8BAA8B,CAC/B,CAAC;AACH,CAAC","sourcesContent":["import {\n\ttype BaseType,\n\tbuildOutcomeProcessingAst,\n\tbuildResponseProcessingAst,\n\tbuildTemplateProcessingAst,\n\ttype Cardinality,\n\tDeclarationContext,\n\ttype DeclarationMap,\n\tfindAssessmentItem,\n\tparseXml,\n\ttype ProcessingProgram,\n\ttype QtiValue,\n\tqtiNull,\n\tqtiValue,\n\ttoBoolean,\n\ttoNumber,\n\ttoStringValue,\n} from '@pie-qti/qti-processing';\nimport type { ElementNameMapper, AttributeNameMapper, QtiVersion } from '@pie-qti/qti-common';\nimport { prepareContentMarkup } from '@pie-qti/qti-common/accessibility';\nimport type { ResolvedItemDeliveryContext } from '@pie-qti/ims-cp-core';\nimport { DefaultI18nProvider, type I18nProvider } from '@pie-qti/i18n';\nimport {\n\tdetectQtiVersion,\n\tdetectQtiVersionDetailed,\n\ttype QtiVersionDetection,\n} from '@pie-qti/qti-common';\nimport type {\n\tAssessmentItemDocument,\n\tResponseProcessingDescriptor,\n} from '../document/AssessmentItemDocument.js';\nimport { parseAssessmentItemDocument } from '../document/AssessmentItemDocument.js';\nimport type { ContentHandlers } from '../document/contentPass.js';\nimport {\n\tcreateExtractionRegistry,\n\tregisterFrameworkDeliveryFields,\n\ttype ExtractionRegistry,\n} from '../extraction/ExtractionRegistry.js';\nimport { extractInteractionData } from '../extraction/interactionExtractionPipeline.js';\nimport { getStandardInteractionModules } from '../interactions/modules.js';\nimport type {\n\tAdaptiveAttemptResult,\n\tCompletionStatus,\n\tHtmlContent,\n\tItemSessionAction,\n\tItemSessionActionCommand,\n\tItemLifecycleStatus,\n\tItemSessionActionResult,\n\tModalFeedback,\n\tItemSessionEngineConfig,\n\tPlayerSecurityConfig,\n\tQTIRole,\n\tRubricBlock,\n\tRubricBlockOptions,\n\tScoringResult,\n\tSerializedItemSessionState,\n\tSerializedItemSessionVariable,\n} from '../types/index.js';\nimport type { BaseInteractionData, TextEntryInteractionData } from '../interactions/shared/types.js';\nimport type { ResponseValidationResult } from '../types/responseValidation.js';\nimport type { ComponentRegistry } from './ComponentRegistry.js';\nimport { createComponentRegistry } from './ComponentRegistry.js';\nimport { collectItemDiagnostics, type QtiItemDiagnostic, reportItemDiagnostics } from './compliance.js';\nimport { type MatchGroupConstraints, readMatchGroupConstraints } from './matchGroups.js';\nimport { createSeededRng } from './random.js';\nimport { sanitizeHtml } from './sanitizer.js';\nimport { enforceItemXmlLimits } from './parsingLimits.js';\nimport type { PnpProfile } from '../pnp/types.js';\nimport { applyPnpToRoot } from '../pnp/applyPnp.js';\nimport type { CatalogIndex } from '../catalog/types.js';\nimport { buildSessionCatalogIndexes, catalogEntryOf } from '../catalog/sessionCatalog.js';\nimport { PciHost } from '../pci/PciHost.js';\nimport { cloneValue } from '../utils/cloneFreeze.js';\nimport { attributeNameMapperForVersion, elementNameMapperForVersion } from './nameMappers.js';\nimport { contentHandlers } from './rendering/contentPass.js';\nimport { itemBodyHtml, modalFeedbackOf, rubricsOf } from './rendering/htmlRender.js';\nimport {\n\tapplySerializedVariables,\n\tfreezeDuration,\n\tisContextSerialized,\n\tserializeItemSession,\n\tupdateDuration,\n} from './serialization/sessionState.js';\nimport { qtiValueEquals, qtiValueToPci, qtiValueToPublic } from './serialization/valueForms.js';\nimport {\n\tbuildDeclarationMap,\n\tensureBuiltinDeclarations,\n} from './declarations/declarationBuilder.js';\nimport { coerceToDeclarationValue } from './declarations/declarationValues.js';\nimport {\n\tisAttempted,\n\tvalidateAttemptResponses,\n\tvalidateResponses,\n} from './processing/responseValidation.js';\nimport {\n\tassertSupportedResponseProcessing,\n\texecTemplateProcessingProgram,\n\tresetOutcomesToDefault,\n\tresetResponsesToDefault,\n\tresetTemplatesToDefault,\n\trestoreDeclaredTemplateRuleTargets,\n\trunResponseProcessing,\n} from './processing/responseProcessing.js';\nimport type { ExtractedPci, PciInteractionStatus } from '../pci/types.js';\nimport { PciHostSession } from '../pci/sessionHosts.js';\nimport { createTextEntryStringResponse, textEntryStringIdentifier } from '../interactions/text-entry/response.js';\n\n/** Immutable source-derived artifacts shared by sessions from one definition. */\ninterface PreparedPlayerDefinition {\n\treadonly identifier: string;\n\treadonly mapper: ElementNameMapper;\n\treadonly attributeMapper: AttributeNameMapper;\n\treadonly itemDocument: AssessmentItemDocument;\n\treadonly declarations: DeclarationMap;\n\treadonly responseProcessing: ResponseProcessingDescriptor;\n\treadonly responseProcessingProgram: ProcessingProgram | null;\n\treadonly templateProcessingProgram: ProcessingProgram | null;\n\treadonly outcomeProcessingProgram: ProcessingProgram | null;\n\treadonly catalogIndex: CatalogIndex;\n\treadonly stimulusCatalogIndexes: Map<string, CatalogIndex>;\n\treadonly diagnostics: readonly QtiItemDiagnostic[];\n\treadonly matchGroupConstraints: ReadonlyMap<string, MatchGroupConstraints>;\n}\n\ninterface PlayerConstructionOptions {\n\t/** Compile source-derived artifacts without starting an item attempt. */\n\treadonly compileOnly?: boolean;\n\t/** Restore supplies template variables, so avoid an observable throwaway template run. */\n\treadonly skipTemplateProcessing?: boolean;\n}\n\n/** @internal Used by AssessmentItemDefinition; deliberately absent from the package root API. */\nexport function preparePlayerDefinitionInternal(config: ItemSessionEngineConfig): unknown {\n\tconst compiler = new Player(config, undefined, { compileOnly: true });\n\ttry {\n\t\treturn compiler.capturePreparedDefinition();\n\t} finally {\n\t\tcompiler.destroy();\n\t}\n}\n\n/** @internal Used by ItemSession; deliberately absent from the package root API. */\nexport function createPlayerFromPreparedInternal(\n\tconfig: ItemSessionEngineConfig,\n\tprepared: unknown,\n\tskipTemplateProcessing = false,\n): Player {\n\treturn new Player(config, prepared as PreparedPlayerDefinition, {\n\t\tskipTemplateProcessing,\n\t});\n}\n\nexport class Player {\n\t/** @internal Rendering resolves rubric views against the session's role. */\n\trole: QTIRole;\n\t/** @internal Engine modules read the resolved configuration through the host. */\n\tconfig: ItemSessionEngineConfig;\n\tprivate itemXml: string;\n\t/** @internal Engine modules read the parsed item document through the host. */\n\titemDocument: AssessmentItemDocument;\n\t/** @internal Engine modules read the session's declarations through the host. */\n\tdecls: DeclarationMap;\n\t/** @internal The declarations as compiled from the item source, before any template rule changed them. */\n\tsourceDeclarations: DeclarationMap;\n\t/** @internal Engine modules read the variable context through the host. */\n\tctx: DeclarationContext;\n\t/** @internal Engine modules read the session's random stream through the host. */\n\trng: () => number;\n\tprivate extractionRegistry: ExtractionRegistry;\n\tprivate interactionDataCache: readonly BaseInteractionData[] | null = null;\n\t/** Template variables declared with `mathVariable`, substituted into MathML. @internal */\n\tmathVariableIds: ReadonlySet<string> | null = null;\n\t/** Template variables declared with `paramVariable`, substituted into `<param>` values. @internal */\n\tparamVariableIds: ReadonlySet<string> | null = null;\n\tprivate componentRegistry: ComponentRegistry;\n\tprivate i18nProvider: I18nProvider;\n\t/** @internal Engine modules resolve canonical element names through the host. */\n\tmapper: ElementNameMapper;\n\t/** The item's detected QTI version ('unknown' when nothing identified it). */\n\tprivate qtiVersion: QtiVersion;\n\n\t/** @internal Set once the implied-zero MAXSCORE warning has fired. */\n\twarnedImpliedZeroMaxScore = false;\n\t/** @internal Compiled processing programs, shared by the sessions of one definition. */\n\tresponseProcessingProgram: ProcessingProgram | null = null;\n\t/** @internal */\n\tresponseProcessing: ResponseProcessingDescriptor;\n\t/** @internal */\n\ttemplateProcessingProgram: ProcessingProgram | null = null;\n\t/** @internal */\n\toutcomeProcessingProgram: ProcessingProgram | null = null;\n\tprivate _pnp: PnpProfile | undefined;\n\tprivate _rootEl: HTMLElement | undefined;\n\tprivate _catalogIndex: CatalogIndex = new Map();\n\tprivate _stimulusCatalogIndexes: Map<string, CatalogIndex> = new Map();\n\t/** @internal The PCI hosts of this session, by response identifier. */\n\tprivate readonly pciSession = new PciHostSession();\n\tprivate _pnpChangeListeners = new Set<(pnp: PnpProfile | undefined) => void>();\n\t/** @internal The shuffle seed, persisted in saved state and restored. */\n\tsessionGuid: string;\n\t/** @internal The item-session lifecycle stage; action orchestration mutates it. */\n\tlifecycleStatus: ItemLifecycleStatus = 'initial';\n\t/**\n\t * End-attempt responses the candidate turned true since the attempt last ended: the\n\t * interactions that invoke the next response processing (see settleEndAttemptResponses).\n\t * @internal Response resets read and clear it through the host.\n\t */\n\treadonly endAttemptActivations = new Set<string>();\n\tprivate diagnostics: readonly QtiItemDiagnostic[] = [];\n\t/** @internal matchGroup constraints of the item's pairing interactions, by response identifier. */\n\tmatchGroupConstraints: ReadonlyMap<string, MatchGroupConstraints> = new Map();\n\t/** @internal When the current duration clock window started. */\n\tsessionStartedAt: number;\n\t/** @internal Time on task accumulated before the current clock window. */\n\taccumulatedDurationMs = 0;\n\t/** Time on task at the last duration update, in milliseconds. @internal */\n\tdurationMs = 0;\n\t/**\n\t * Bumped at every change to the session's response values (candidate input, restore,\n\t * template rules, PCI writes, attempt settlement) and wherever the interaction data\n\t * regenerates; keys the response-validation memo.\n\t */\n\tprivate responseRevision = 0;\n\tprivate interactionDataGeneration = 0;\n\t/** The base validation of the engine's current responses, memoized per revision. */\n\tprivate engineValidationMemo: { revision: number; generation: number; result: ResponseValidationResult } | null = null;\n\t/** The last base validation computed for an explicit responses record. */\n\tprivate validationMemo: {\n\t\tresponses: Record<string, any>;\n\t\trevision: number;\n\t\tgeneration: number;\n\t\tresult: ResponseValidationResult;\n\t} | null = null;\n\n\tconstructor(config: ItemSessionEngineConfig);\n\t/** @internal Definition-backed sessions use the module-local factory above. */\n\tconstructor(\n\t\tconfig: ItemSessionEngineConfig,\n\t\tprepared: PreparedPlayerDefinition | undefined,\n\t\tconstruction?: PlayerConstructionOptions,\n\t);\n\tconstructor(\n\t\tconfig: ItemSessionEngineConfig,\n\t\tprepared?: PreparedPlayerDefinition,\n\t\tconstruction: PlayerConstructionOptions = {},\n\t) {\n\t\tthis.config = config;\n\t\tthis.itemXml = config.itemXml ?? '';\n\t\tthis.role = config.role ?? 'candidate';\n\t\tthis.sessionGuid = createSessionGuid();\n\t\tthis.sessionStartedAt = Date.now();\n\t\tthis.rng = config.rng ?? (typeof config.seed === 'number' ? createSeededRng(config.seed) : Math.random);\n\n\t\t// Resolve QTI-version mappers without mutating caller-owned configuration.\n\t\t// The detected version also drives per-version spec defaults during extraction\n\t\t// (e.g. graphicGapMatchInteraction maxAssociations); detect it once, here.\n\t\tthis.qtiVersion = config.qtiVersion ?? detectQtiVersion(this.itemXml);\n\t\tthis.mapper =\n\t\t\tprepared?.mapper ??\n\t\t\tconfig.elementNameMapper ??\n\t\t\telementNameMapperForVersion(this.qtiVersion);\n\t\tconst attributeMapper =\n\t\t\tprepared?.attributeMapper ??\n\t\t\tconfig.attributeNameMapper ??\n\t\t\tattributeNameMapperForVersion(this.mapper.version);\n\t\tthis.config = {\n\t\t\t...config,\n\t\t\telementNameMapper: this.mapper,\n\t\t\tattributeNameMapper: attributeMapper,\n\t\t\tqtiVersion: this.qtiVersion,\n\t\t};\n\n\t\tif (prepared) {\n\t\t\tthis.itemDocument = prepared.itemDocument;\n\t\t\tthis.decls = cloneValue(prepared.declarations);\n\t\t} else {\n\t\t\t// Read-aloud markup: suppression restated as the attribute the PIE tools read, and SSML\n\t\t\t// docked as catalog idrefs and unwrapped from the visible body. The section player derives\n\t\t\t// the same `spoken` cards from the same XML.\n\t\t\tenforceItemXmlLimits(this.itemXml, this.config.security);\n\t\t\tthis.itemXml = prepareContentMarkup(this.itemXml, [], { hidingStyles: false }).xml;\n\t\t\tthis.itemDocument = parseAssessmentItemDocument({\n\t\t\t\titemXml: this.itemXml,\n\t\t\t\telementNameMapper: this.mapper,\n\t\t\t\tattributeNameMapper: attributeMapper as AttributeNameMapper,\n\t\t\t\tsecurity: this.config.security,\n\t\t\t});\n\t\t\tthis.decls = buildDeclarationMap({\n\t\t\t\titemDocument: this.itemDocument,\n\t\t\t\tmapper: this.mapper,\n\t\t\t\tattributeMapper: this.config.attributeNameMapper,\n\t\t\t});\n\t\t\tensureBuiltinDeclarations(this.decls);\n\t\t}\n\t\tthis.applyContextVariables(config.contextVariables);\n\t\tthis.applyTemplateDefaults(config.templateDefaults);\n\t\tthis.sourceDeclarations = cloneValue(this.decls);\n\t\tthis.ctx = new DeclarationContext(this.decls);\n\n\t\t// Extraction + rendering registries (for interaction rendering)\n\t\t// Pass the element name mapper to the extraction registry for QTI version handling\n\t\tthis.extractionRegistry =\n\t\t\t(this.config.extractionRegistry as ExtractionRegistry | undefined) ??\n\t\t\tcreateExtractionRegistry(this.mapper);\n\t\tthis.componentRegistry =\n\t\t\t(this.config.componentRegistry as ComponentRegistry | undefined) ??\n\t\t\tcreateComponentRegistry();\n\n\t\t// I18n provider (defaults to a simple fallback if not provided)\n\t\tthis.i18nProvider = this.config.i18nProvider ?? this.createDefaultI18nProvider();\n\n\t\tif (!this.extractionRegistry.isSealed()) {\n\t\t\t// Register standard interaction extractors.\n\t\t\tfor (const module of getStandardInteractionModules()) {\n\t\t\t\tthis.extractionRegistry.register(module.extractor as any);\n\t\t\t\tregisterFrameworkDeliveryFields(\n\t\t\t\t\tthis.extractionRegistry,\n\t\t\t\t\tmodule.type,\n\t\t\t\t\tmodule.delivery,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis.extractionRegistry.seal();\n\t\t}\n\n\t\t// Build ASTs once.\n\t\tconst processingBuildOptions = {\n\t\t\telementNameMapper: this.mapper,\n\t\t\tresolveProcessingFragment: this.config.resolveProcessingFragment,\n\t\t\tmaxProcessingFragmentDepth: this.config.processingFragmentLimits?.maxDepth,\n\t\t\tmaxProcessingFragmentCharacters: this.config.processingFragmentLimits?.maxCharacters,\n\t\t};\n\t\tconst templateProcessing = prepared ? null : this.itemDocument.getProcessingElement('template');\n\t\tthis.templateProcessingProgram =\n\t\t\tprepared?.templateProcessingProgram ??\n\t\t\t(templateProcessing\n\t\t\t\t? buildTemplateProcessingAst(templateProcessing, processingBuildOptions)\n\t\t\t\t: null);\n\t\tif (\n\t\t\tthis.templateProcessingProgram &&\n\t\t\t!construction.compileOnly &&\n\t\t\t!construction.skipTemplateProcessing\n\t\t) {\n\t\t\tthis.execTemplateProcessing();\n\t\t}\n\n\t\tconst responseProcessing = prepared ? null : this.itemDocument.getProcessingElement('response');\n\t\tthis.responseProcessing = prepared?.responseProcessing ?? this.itemDocument.describeResponseProcessing();\n\t\tif (!prepared) assertSupportedResponseProcessing(this);\n\t\tthis.responseProcessingProgram =\n\t\t\tprepared?.responseProcessingProgram ??\n\t\t\t(responseProcessing\n\t\t\t\t? buildResponseProcessingAst(responseProcessing, processingBuildOptions)\n\t\t\t\t: null);\n\n\t\tconst outcomeProcessing = prepared ? null : this.itemDocument.getProcessingElement('outcome');\n\t\tthis.outcomeProcessingProgram =\n\t\t\tprepared?.outcomeProcessingProgram ??\n\t\t\t(outcomeProcessing\n\t\t\t\t? buildOutcomeProcessingAst(outcomeProcessing, processingBuildOptions)\n\t\t\t\t: null);\n\n\t\t// QTI 2.1 is delivered through the QTI 2.2 code path; other version findings are diagnostics.\n\t\tconst versionDetection = prepared ? null : detectQtiVersionDetailed(config.itemXml ?? '');\n\t\tif (versionDetection?.version === '2.1' && !this.config.strictQtiCompliance?.enabled) {\n\t\t\tconsole.info(\n\t\t\t\t'[QTI Player] QTI 2.1 detected. Using QTI 2.2 compatibility mode with CC2 template support.'\n\t\t\t);\n\t\t}\n\n\t\t// Store PNP profile for later use (applyPnpToRoot is called once a root element is available).\n\t\tthis._pnp = this.config.pnp;\n\n\t\t// Build the catalog index from shared catalog XML, item XML, and resolved delivery context.\n\t\t// Sanitized item-level delivery context entries win over raw item XML on collisions.\n\t\t// Stimulus entries are kept separately so rendered stimulus terms can avoid ID collisions.\n\t\t// Package (shared catalog file) entries merge first: they hold the lowest\n\t\t// precedence, below catalogXml and the item's own catalogs (QTI 3.0 §6.3).\n\t\tif (prepared) {\n\t\t\tthis._catalogIndex = prepared.catalogIndex;\n\t\t\tthis._stimulusCatalogIndexes = prepared.stimulusCatalogIndexes;\n\t\t} else {\n\t\t\tconst indexes = buildSessionCatalogIndexes({ config: this.config, itemXml: this.itemXml });\n\t\t\tthis._catalogIndex = indexes.catalogIndex;\n\t\t\tthis._stimulusCatalogIndexes = indexes.stimulusCatalogIndexes;\n\t\t}\n\n\t\t// Checks that read the item as authored, before the content pass: matchGroup constraints, and\n\t\t// compliance findings, reported (or rejected, in strict mode) once, when the item compiles.\n\t\tif (prepared) {\n\t\t\tthis.matchGroupConstraints = prepared.matchGroupConstraints;\n\t\t\tthis.diagnostics = prepared.diagnostics;\n\t\t} else {\n\t\t\tconst sourceItem = findAssessmentItem(parseXml(config.itemXml ?? ''));\n\t\t\tthis.matchGroupConstraints = readMatchGroupConstraints(sourceItem, this.mapper);\n\t\t\tthis.diagnostics = this.compileDiagnostics(config.itemXml ?? '', sourceItem, versionDetection ?? undefined);\n\t\t}\n\t}\n\n\t/** @internal Definition compiler capture; parser artifacts remain module-private. */\n\tcapturePreparedDefinition(): PreparedPlayerDefinition {\n\t\tconst identifier = this.itemDocument.getAssessmentItemAttribute('identifier')?.trim();\n\t\tif (!identifier) {\n\t\t\tthrow new Error('AssessmentItemDefinition requires an assessment-item identifier');\n\t\t}\n\t\treturn Object.freeze({\n\t\t\tidentifier,\n\t\t\tmapper: this.mapper,\n\t\t\tattributeMapper: this.config.attributeNameMapper as AttributeNameMapper,\n\t\t\titemDocument: this.itemDocument,\n\t\t\tdeclarations: cloneValue(this.sourceDeclarations),\n\t\t\tresponseProcessing: this.responseProcessing,\n\t\t\tresponseProcessingProgram: this.responseProcessingProgram,\n\t\t\ttemplateProcessingProgram: this.templateProcessingProgram,\n\t\t\toutcomeProcessingProgram: this.outcomeProcessingProgram,\n\t\t\tcatalogIndex: this._catalogIndex,\n\t\t\tstimulusCatalogIndexes: this._stimulusCatalogIndexes,\n\t\t\tdiagnostics: this.diagnostics,\n\t\t\tmatchGroupConstraints: this.matchGroupConstraints,\n\t\t});\n\t}\n\n\t/** The item's QTI compliance findings from compilation; empty when it compiled cleanly. */\n\tpublic getDiagnostics(): readonly QtiItemDiagnostic[] {\n\t\treturn this.diagnostics;\n\t}\n\n\t/**\n\t * Apply the PNP profile to a player root element.\n\t * Call this once the root DOM element is available (e.g. after mounting).\n\t * The player stores the element reference so updatePnp() can re-apply without re-parsing the item.\n\t */\n\tpublic applyPnp(rootEl: HTMLElement): void {\n\t\tthis._rootEl = rootEl;\n\t\tapplyPnpToRoot(rootEl, this._pnp);\n\t}\n\n\t/**\n\t * Update the PNP profile mid-session without re-parsing the item XML.\n\t * Deep-merges the partial profile into the current profile and re-applies.\n\t */\n\tpublic updatePnp(partial: Partial<PnpProfile>): void {\n\t\tthis._pnp = mergePnp(this._pnp, partial);\n\t\tif (this._rootEl) {\n\t\t\tapplyPnpToRoot(this._rootEl, this._pnp);\n\t\t}\n\t\tfor (const listener of this._pnpChangeListeners) {\n\t\t\tlistener(this._pnp);\n\t\t}\n\t}\n\n\t/** The language the item's content is written in, from the nearest `xml:lang` on its body. */\n\tpublic getContentLanguage(): string | undefined {\n\t\treturn this.itemDocument.getContentLanguage();\n\t}\n\n\t/** Return the current resolved PNP profile. */\n\tpublic getPnp(): PnpProfile | undefined {\n\t\treturn this._pnp;\n\t}\n\n\tpublic onPnpChange(listener: (pnp: PnpProfile | undefined) => void): () => void {\n\t\tthis._pnpChangeListeners.add(listener);\n\t\treturn () => this._pnpChangeListeners.delete(listener);\n\t}\n\n\t/** Return the package/assessment-resolved delivery context, if one was supplied. */\n\tpublic getDeliveryContext(): ResolvedItemDeliveryContext | undefined {\n\t\treturn this.config.deliveryContext;\n\t}\n\n\t/**\n\t * Look up a catalog entry by card identifier, usage type, and optional language.\n\t * Returns the HTML string for the matched entry, or null if not found.\n\t *\n\t * Language fallback: exact match → prefix match → no-lang entry → null.\n\t */\n\tpublic getCatalogEntry(\n\t\tidref: string,\n\t\tusage: string,\n\t\tlang?: string,\n\t\toptions?: { stimulusIdentifier?: string }\n\t): HtmlContent | null {\n\t\treturn catalogEntryOf(\n\t\t\t{ catalogIndex: this._catalogIndex, stimulusCatalogIndexes: this._stimulusCatalogIndexes },\n\t\t\tidref,\n\t\t\tusage,\n\t\t\tlang,\n\t\t\toptions,\n\t\t\tthis.config.security,\n\t\t);\n\t}\n\n\tpublic sanitizeHtmlContent(html: string): string {\n\t\treturn sanitizeHtml(html, { security: this.config.security });\n\t}\n\n\tpublic createPciHost(data: ExtractedPci): PciHost {\n\t\treturn this.pciSession.create(data, {\n\t\t\tpci: this.config.pci,\n\t\t\tdecls: this.decls,\n\t\t\tlifecycleStatus: () => this.lifecycleStatus,\n\t\t\tinteractionStatus: () => this.pciInteractionStatus(),\n\t\t\tcontentLanguage: () => this.getContentLanguage(),\n\t\t\tcoerceToDeclarationValue: (baseType, cardinality, raw, identifier) =>\n\t\t\t\tthis.coerceToDeclarationValue(baseType, cardinality, raw, identifier),\n\t\t\tonResponseApplied: () => {\n\t\t\t\t// A mounted PCI module reporting its own change is a candidate response change,\n\t\t\t\t// so the attempt has begun (beginAttempt's spec citation applies).\n\t\t\t\tthis.beginAttempt();\n\t\t\t\tthis.touchResponses();\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate pciInteractionStatus(): PciInteractionStatus {\n\t\tif (this.role !== 'candidate') return 'review';\n\t\tif (this.lifecycleStatus === 'closed') return 'closed';\n\t\treturn 'interacting';\n\t}\n\n\t/**\n\t * Offer a response value to the PCI identified by responseIdentifier. A\n\t * mounted module that has already reported a response keeps it.\n\t */\n\tpublic offerPciResponse(responseIdentifier: string, value: unknown): void {\n\t\tthis.pciSession.offer(responseIdentifier, value);\n\t}\n\n\t/**\n\t * Authoritatively replace a PCI's response, discarding in-progress candidate\n\t * state. Session restore and reset-to-default use this.\n\t */\n\tpublic restorePciResponse(responseIdentifier: string, value: unknown): void {\n\t\tthis.pciSession.restore(responseIdentifier, value);\n\t}\n\n\t/**\n\t * Destroy all PCI hosts. Call on player teardown.\n\t */\n\tpublic destroyPciHosts(): void {\n\t\tthis.pciSession.destroyAll();\n\t}\n\n\t/** Breaking-change API: returns the typed declaration map */\n\tpublic getDeclarations(): DeclarationMap {\n\t\treturn this.decls;\n\t}\n\n\t/**\n\t * Apply candidate response values to the declaration context.\n\t *\n\t * Every candidate interaction reaches this method, including a PCI reporting\n\t * its own change, so a mounted PCI module is offered the value rather than\n\t * force-fed it. Use `restoreResponses()` when the caller's value must replace\n\t * in-progress module state.\n\t */\n\tpublic setResponses(responses: Record<string, unknown>): void {\n\t\tconst endAttemptIds = this.getEndAttemptResponseIdentifiers().filter((id) => id in responses);\n\t\tconst wasTrue = new Set(endAttemptIds.filter((id) => this.isResponseTrue(id)));\n\t\tthis.applyResponses(responses, (id, value) => this.offerPciResponse(id, value));\n\t\tfor (const id of endAttemptIds) {\n\t\t\tif (!this.isResponseTrue(id)) this.endAttemptActivations.delete(id);\n\t\t\telse if (!wasTrue.has(id)) this.endAttemptActivations.add(id);\n\t\t}\n\t\tthis.beginAttempt();\n\t}\n\n\t/**\n\t * Apply response values authoritatively, discarding in-progress PCI candidate\n\t * state. State replacement and explicit host overrides use this.\n\t */\n\tpublic restoreResponses(responses: Record<string, unknown>): void {\n\t\tthis.applyResponses(responses, (id, value) => this.restorePciResponse(id, value));\n\t\t// A replaced value is the state as it stands, not the candidate activating an interaction.\n\t\tfor (const id of Object.keys(responses)) this.endAttemptActivations.delete(id);\n\t}\n\n\tprivate applyResponses(\n\t\tresponses: Record<string, unknown>,\n\t\tapplyToPci: (responseIdentifier: string, value: unknown) => void\n\t): void {\n\t\tfor (const [id, raw] of Object.entries(responses)) {\n\t\t\tconst d = this.decls[id];\n\t\t\tif (!d) continue;\n\t\t\td.value = this.coerceToDeclarationValue(d.baseType, d.cardinality, raw, d.identifier);\n\t\t\t// Only a response a textEntryInteraction binds can carry a stringIdentifier companion.\n\t\t\tif (this.itemDocument.getTextEntryBase(id) !== undefined) this.applyTextEntryStringResponse(id, raw);\n\t\t\tapplyToPci(id, this.qtiValueToPci(d.value));\n\t\t}\n\t\tthis.touchResponses();\n\t}\n\n\t/**\n\t * QTI ASI §5.2.1 built-in `completionStatus` transitions, as the specification's table names\n\t * them: `not_attempted` when the item session is registered, `unknown` once the attempt has\n\t * begun, and `completed` when response processing completes the attempt (the submission of a\n\t * non-adaptive item; an adaptive item reaches `completed` only through its own response\n\t * processing rules). This engine begins the attempt when the candidate changes a response\n\t * (every candidate write goes through setResponses, a mounted PCI reporting its own change\n\t * included) and when a suspended handoff is activated for interaction; response processing\n\t * completes it (responseProcessing.ts).\n\t *\n\t * Documented reading of an ambiguous edge: `openSession({ responses })` pre-seeds through\n\t * setResponses, so it counts as the attempt having begun. `restoreResponses` deliberately\n\t * does not begin an attempt — it replaces saved state (\"the state as it stands\"), and the\n\t * restored completionStatus travels with that state.\n\t */\n\tprivate beginAttempt(): void {\n\t\tif (this.getCompletionStatus() === 'not_attempted') {\n\t\t\tthis.ctx.setValue('completionStatus', qtiValue('identifier', 'single', 'unknown'));\n\t\t}\n\t}\n\n\t/** Response values changed: the response snapshot and its memoized validation drop. */\n\tprivate touchResponses(): void {\n\t\tthis.responseRevision += 1;\n\t\tthis.responseSnapshotState = null;\n\t\tthis.engineValidationMemo = null;\n\t}\n\n\t/**\n\t * textEntryInteraction@stringIdentifier (QTI ASI §5.122.3; `string-identifier` in QTI 3.0):\n\t * writing the text entry's response also writes the response its stringIdentifier names, with\n\t * the text as entered before the numeric response reads it — \"3.50\" where the float response\n\t * is 3.5 — or NULL for an empty field, so response processing can score that lexical form. A\n\t * stringIdentifier that repeats the response, or names no declared response, is ignored.\n\t */\n\tprivate applyTextEntryStringResponse(responseId: string, raw: unknown): void {\n\t\tconst interaction = this.getInteractionData().find(\n\t\t\t(candidate): candidate is TextEntryInteractionData =>\n\t\t\t\tcandidate.type === 'textEntryInteraction' && candidate.responseId === responseId,\n\t\t);\n\t\tconst stringIdentifier = interaction ? textEntryStringIdentifier(interaction) : undefined;\n\t\tconst companion = stringIdentifier ? this.decls[stringIdentifier] : undefined;\n\t\tif (!interaction || !companion || (companion as any).__kind !== 'response') return;\n\t\tcompanion.value = this.coerceToDeclarationValue(\n\t\t\tcompanion.baseType,\n\t\t\tcompanion.cardinality,\n\t\t\tcreateTextEntryStringResponse(raw, interaction),\n\t\t\tcompanion.identifier,\n\t\t);\n\t}\n\n\t/**\n\t * Destroy all resources owned by this player instance (PCI modules, etc.).\n\t * Call when unmounting to prevent memory leaks.\n\t */\n\tpublic destroy(): void {\n\t\tthis.destroyPciHosts();\n\t}\n\n\tpublic processResponses(): ScoringResult {\n\t\treturn this.runResponseProcessing({ finalizeNonAdaptiveAttempt: true });\n\t}\n\n\tpublic saveItemSession(): SerializedItemSessionState {\n\t\tthis.freezeDuration();\n\t\treturn this.serializeItemSession();\n\t}\n\n\tpublic restoreItemSession(state: SerializedItemSessionState): void {\n\t\tthis.sessionGuid = state.sessionGuid;\n\t\tthis.invalidateInteractionData();\n\t\tthis.endAttemptActivations.clear();\n\t\tthis.lifecycleStatus = state.lifecycleStatus;\n\t\tthis.accumulatedDurationMs = Math.max(0, Number(state.duration) || 0);\n\t\tthis.sessionStartedAt = Date.now();\n\t\tthis.applySerializedVariables(state.responseVariables);\n\t\tthis.applySerializedVariables(state.outcomeVariables);\n\t\tthis.applySerializedVariables(state.templateVariables);\n\t\tthis.applySerializedVariables(state.contextVariables);\n\t\tthis.touchResponses();\n\t\tthis.updateDuration();\n\t}\n\n\t/** @internal ItemSession uses this to activate a restored delivery handoff. */\n\tpublic getLifecycleStatus(): ItemLifecycleStatus {\n\t\treturn this.lifecycleStatus;\n\t}\n\n\t/** @internal ItemSession uses this to resume a suspended delivery handoff. */\n\tpublic activateAttempt(): void {\n\t\tif (this.lifecycleStatus === 'suspended') {\n\t\t\tthis.lifecycleStatus = 'interacting';\n\t\t\t// Resuming hands the item back to the candidate: the attempt has begun\n\t\t\t// (beginAttempt's spec citation applies), even before a first response change.\n\t\t\tthis.beginAttempt();\n\t\t}\n\t}\n\n\t/** Test seam (paramVariable delivery); sessions dispatch newTemplate through ItemSession. */\n\tpublic newTemplate(options: { resetResponses?: boolean } = {}): ItemSessionActionResult {\n\t\treturn this.runItemSessionAction({ action: 'newTemplate', ...options });\n\t}\n\n\tpublic runItemSessionAction(command: ItemSessionActionCommand): ItemSessionActionResult {\n\t\tswitch (command.action) {\n\t\t\tcase 'suspendAttempt':\n\t\t\t\treturn this.runSuspendAttemptAction();\n\t\t\tcase 'endAttempt':\n\t\t\t\treturn this.runEndAttemptAction(command);\n\t\t\tcase 'scoreAttempt':\n\t\t\t\treturn this.runScoreAttemptAction();\n\t\t\tcase 'newTemplate':\n\t\t\t\treturn this.runNewTemplateAction(command);\n\t\t\tcase 'submitAttempt':\n\t\t\t\treturn this.runSubmitAttemptAction(command.countAttempt ?? true);\n\t\t}\n\t}\n\n\tprivate runSuspendAttemptAction(): ItemSessionActionResult {\n\t\tconst validation = this.currentResponsesValidation();\n\t\tthis.lifecycleStatus = 'suspended';\n\t\tconst sessionState = this.saveItemSession();\n\t\treturn this.createItemSessionActionResult('suspendAttempt', sessionState, { validation });\n\t}\n\n\tprivate runEndAttemptAction(options: { countAttempt?: boolean; validateResponses?: boolean }): ItemSessionActionResult {\n\t\tconst validate = options.validateResponses ?? false;\n\t\tconst validation = validate ? this.validateAttemptResponses(this.responseSnapshot()) : undefined;\n\t\tif (validation && !validation.valid) {\n\t\t\treturn this.createItemSessionActionResult('endAttempt', this.saveItemSession(), { validation });\n\t\t}\n\n\t\t// QTI countAttempt=false (hint / \"show me\"): response processing runs so outcomes and\n\t\t// feedback compute, but the attempt is not counted and the session stays open for the\n\t\t// candidate to continue — only a counted attempt finalizes a non-adaptive item.\n\t\tconst countAttempt = options.countAttempt ?? true;\n\t\t// The adaptive path settles the end-attempt responses in runAdaptiveSubmitAttempt.\n\t\tif (!this.isAdaptive()) this.settleEndAttemptResponses();\n\t\tconst scoring = this.isAdaptive()\n\t\t\t? this.runAdaptiveSubmitAttempt(countAttempt)\n\t\t\t: this.runResponseProcessing({\n\t\t\t\t\tfinalizeNonAdaptiveAttempt: countAttempt,\n\t\t\t\t\tcountAttempt,\n\t\t\t\t});\n\t\tthis.lifecycleStatus = scoring.completed ? 'closed' : 'interacting';\n\n\t\treturn this.createItemSessionActionResult('endAttempt', this.saveItemSession(), {\n\t\t\tcompleted: scoring.completed,\n\t\t\tvalidation,\n\t\t\tscoring,\n\t\t});\n\t}\n\n\tprivate runScoreAttemptAction(): ItemSessionActionResult {\n\t\tconst scoring = this.runResponseProcessing({ finalizeNonAdaptiveAttempt: false });\n\t\treturn this.createItemSessionActionResult('scoreAttempt', this.saveItemSession(), {\n\t\t\tcompleted: scoring.completed,\n\t\t\tscoring,\n\t\t});\n\t}\n\n\tprivate runNewTemplateAction(options: { resetResponses?: boolean }): ItemSessionActionResult {\n\t\tthis.restoreDeclaredTemplateRuleTargets();\n\t\tthis.resetOutcomesToDefault();\n\t\tif (options.resetResponses ?? true) {\n\t\t\tthis.resetResponsesToDefault();\n\t\t}\n\t\tthis.resetTemplatesToDefault();\n\t\tthis.ctx.setValue('completionStatus', qtiValue('identifier', 'single', 'not_attempted'));\n\t\tthis.ctx.setValue('numAttempts', qtiValue('integer', 'single', 0));\n\t\tthis.execTemplateProcessing();\n\t\tthis.lifecycleStatus = 'initial';\n\t\tthis.accumulatedDurationMs = 0;\n\t\tthis.sessionStartedAt = Date.now();\n\t\tthis.updateDuration();\n\n\t\treturn this.createItemSessionActionResult('newTemplate', this.serializeItemSession());\n\t}\n\n\tprivate runSubmitAttemptAction(countAttempt: boolean): ItemSessionActionResult {\n\t\tconst scoring = this.runAdaptiveSubmitAttempt(countAttempt);\n\t\treturn this.createItemSessionActionResult('submitAttempt', this.saveItemSession(), {\n\t\t\tcompleted: scoring.completed,\n\t\t\tscoring,\n\t\t});\n\t}\n\n\tprivate createItemSessionActionResult(\n\t\taction: ItemSessionAction,\n\t\tsessionState: SerializedItemSessionState,\n\t\toptions: {\n\t\t\tcompleted?: boolean;\n\t\t\tvalidation?: ResponseValidationResult;\n\t\t\tscoring?: ScoringResult;\n\t\t} = {}\n\t): ItemSessionActionResult {\n\t\treturn {\n\t\t\taction,\n\t\t\tlifecycleStatus: this.lifecycleStatus,\n\t\t\tcompletionStatus: this.getCompletionStatus(),\n\t\t\tnumAttempts: this.getNumAttempts(),\n\t\t\tduration: sessionState.duration,\n\t\t\tcompleted: options.completed ?? this.isCompleted(),\n\t\t\tsessionState,\n\t\t\tvalidation: options.validation,\n\t\t\tscoring: options.scoring,\n\t\t};\n\t}\n\n\tpublic getSecurityConfig(): PlayerSecurityConfig | undefined {\n\t\treturn this.config.security;\n\t}\n\n\t/**\n\t * Get the i18n provider instance\n\t * @returns I18nProvider instance\n\t */\n\tpublic getI18nProvider(): I18nProvider {\n\t\treturn this.i18nProvider;\n\t}\n\n\t/**\n\t * The provider used when the host passes none: English, from the catalog\n\t * `@pie-qti/i18n` bundles eagerly.\n\t */\n\tprivate createDefaultI18nProvider(): I18nProvider {\n\t\treturn new DefaultI18nProvider('en-US');\n\t}\n\n\t/**\n\t * The item's QTI compliance findings (see `collectItemDiagnostics`): errors in strict mode,\n\t * warnings otherwise. Strict mode with `rejectUnknownExtensions` throws a `QtiComplianceError`\n\t * on any finding; otherwise they are logged unless `logDeviations` is false.\n\t */\n\tprivate compileDiagnostics(\n\t\tsourceXml: string,\n\t\tsourceItem: Element,\n\t\tversionDetection?: QtiVersionDetection,\n\t): readonly QtiItemDiagnostic[] {\n\t\tconst compliance = this.config.strictQtiCompliance;\n\t\tconst strict = compliance?.enabled === true;\n\t\tconst diagnostics = Object.freeze(\n\t\t\tcollectItemDiagnostics({\n\t\t\t\titemXml: sourceXml,\n\t\t\t\titem: sourceItem,\n\t\t\t\tversionDetection,\n\t\t\t\telementNameMapper: this.mapper,\n\t\t\t\textractionRegistry: this.extractionRegistry,\n\t\t\t\tresponseIdentifiers: new Set(\n\t\t\t\t\tObject.values(this.decls)\n\t\t\t\t\t\t.filter((d) => (d as any).__kind === 'response')\n\t\t\t\t\t\t.map((d) => d.identifier),\n\t\t\t\t),\n\t\t\t\tstrict,\n\t\t\t}),\n\t\t);\n\t\treportItemDiagnostics(diagnostics, {\n\t\t\titemIdentifier: this.itemDocument.getAssessmentItemAttribute('identifier') ?? undefined,\n\t\t\treject: strict && compliance?.rejectUnknownExtensions === true,\n\t\t\tlog: compliance?.logDeviations !== false,\n\t\t});\n\t\treturn diagnostics;\n\t}\n\n\tprivate resetOutcomesToDefault(): void {\n\t\tresetOutcomesToDefault(this);\n\t}\n\n\tprivate resetResponsesToDefault(): void {\n\t\tresetResponsesToDefault(this);\n\t\tthis.touchResponses();\n\t}\n\n\tprivate resetTemplatesToDefault(): void {\n\t\tresetTemplatesToDefault(this);\n\t}\n\n\tprivate restoreDeclaredTemplateRuleTargets(): void {\n\t\trestoreDeclaredTemplateRuleTargets(this);\n\t}\n\n\tprivate runResponseProcessing(options: {\n\t\tfinalizeNonAdaptiveAttempt: boolean;\n\t\tcountAttempt?: boolean;\n\t}): ScoringResult {\n\t\treturn runResponseProcessing(this, options);\n\t}\n\n\tpublic getItemBodyHtml(): HtmlContent {\n\t\treturn itemBodyHtml(this, this.contentHandlers({ feedback: false }));\n\t}\n\n\t/**\n\t * Extract rubric blocks for the current role.\n\t *\n\t * QTI uses `<rubricBlock view=\"...\">` to provide role-specific guidance.\n\t * We return sanitized HTML for host rendering. `scope: \"direct\"` rubrics\n\t * are assessmentItem children; `scope: \"itemBody\"` rubrics are authored in\n\t * the rendered item body flow.\n\t */\n\tpublic getRubrics(options: RubricBlockOptions = {}): RubricBlock[] {\n\t\treturn rubricsOf(this, this.contentHandlers(), options);\n\t}\n\n\tpublic getComponentRegistry(): ComponentRegistry {\n\t\treturn this.componentRegistry;\n\t}\n\n\t/**\n\t * Canonical interaction API (new): extracted, typed interaction data.\n\t */\n\tpublic getInteractionData(): readonly BaseInteractionData[] {\n\t\tif (this.interactionDataCache) return this.interactionDataCache;\n\t\tthis.interactionDataCache = extractInteractionData({\n\t\t\tdocument: this.itemDocument,\n\t\t\textractionRegistry: this.extractionRegistry,\n\t\t\tdeclarations: this.decls,\n\t\t\tconfig: this.config,\n\t\t\t// Seeds `shuffle`. The GUID is persisted in saved state and restored, so a\n\t\t\t// resumed session reproduces the order the candidate already saw, while a\n\t\t\t// different candidate or a new attempt gets a different one.\n\t\t\tsessionGuid: this.sessionGuid,\n\t\t\t// Template content resolves before extraction, so interactions are extracted again\n\t\t\t// when template values change. Choice feedback resolves in presentation.\n\t\t\tcontentHandlers: this.contentHandlers({ feedback: false }),\n\t\t});\n\t\treturn this.interactionDataCache;\n\t}\n\n\t/**\n\t * Convenience API (used by tests/bench): returns a minimal interaction list with QTI-ish field names.\n\t */\n\tpublic getInteractions(): Array<{ type: string; responseIdentifier: string } & Record<string, any>> {\n\t\treturn this.getInteractionData().map((i: any) => ({\n\t\t\t...i,\n\t\t\tresponseIdentifier: i.responseId,\n\t\t}));\n\t}\n\n\tpublic getResponseInteractions(): Array<{ type: string; responseIdentifier: string } & Record<string, any>> {\n\t\treturn this.getInteractions().filter((i) => i.type !== 'endAttemptInteraction');\n\t}\n\n\t/**\n\t * Returns response identifiers of endAttempt interactions with countAttempt=\"false\".\n\t * Used to detect hint-only submissions (e.g. Request Hint button).\n\t */\n\tpublic getHintEndAttemptIdentifiers(): string[] {\n\t\treturn this.getInteractions()\n\t\t\t.filter((i: any) => i.type === 'endAttemptInteraction' && i.countAttempt === false)\n\t\t\t.map((i: any) => i.responseIdentifier);\n\t}\n\n\tprivate getEndAttemptResponseIdentifiers(): string[] {\n\t\treturn this.getInteractions()\n\t\t\t.filter((i) => i.type === 'endAttemptInteraction')\n\t\t\t.map((i) => i.responseIdentifier);\n\t}\n\n\tprivate isResponseTrue(responseIdentifier: string): boolean {\n\t\treturn toBoolean(this.ctx.getValue(responseIdentifier));\n\t}\n\n\t/**\n\t * QTI endAttemptInteraction (QTI 3.0 §5.45): \"If the candidate invokes response processing\n\t * using an end-attempt interaction then the associated response variable is set to true. If\n\t * response processing is invoked in any other way […] then the associated response variable\n\t * is set to false. The default value of the response variable is always ignored.\" The\n\t * interactions that invoke this attempt's processing are the ones the candidate turned true\n\t * since the attempt last ended; a value restored with the session invokes nothing. Rescoring\n\t * (scoreAttempt) replays the last submission and leaves these responses as they are.\n\t */\n\tprivate settleEndAttemptResponses(): void {\n\t\tfor (const id of this.getEndAttemptResponseIdentifiers()) {\n\t\t\tconst d = this.decls[id];\n\t\t\tif (!d) continue;\n\t\t\td.value = this.coerceToDeclarationValue(d.baseType, d.cardinality, this.endAttemptActivations.has(id), d.identifier);\n\t\t}\n\t\tthis.endAttemptActivations.clear();\n\t\tthis.touchResponses();\n\t}\n\n\tpublic getResponseIdentifiers(): string[] {\n\t\treturn this.getResponseInteractions().map((i) => i.responseIdentifier);\n\t}\n\n\t/**\n\t * Response identifiers the item's content prints live: the `printedVariable` targets of the\n\t * body and rubric content that are declared responses. Their values are substituted while\n\t * `getItemBodyHtml()` serializes (the content pass reads the live context), so they are the\n\t * part of the response state a presentation's markup actually renders — presentation\n\t * consumers (ItemBody) can key caching on them. The declared response set is fixed per\n\t * session, so the filtered set is computed once.\n\t */\n\tpublic getResponseIdentifiersPrintedInContent(): ReadonlySet<string> {\n\t\tthis.printedResponseIdentifiers ??= new Set(\n\t\t\t[...this.itemDocument.printedVariableIdentifiers()].filter(\n\t\t\t\t(identifier) => (this.decls[identifier] as any)?.__kind === 'response'\n\t\t\t)\n\t\t);\n\t\treturn this.printedResponseIdentifiers;\n\t}\n\n\tprivate printedResponseIdentifiers?: ReadonlySet<string>;\n\n\t/**\n\t * Context identifiers the item's content prints live: the `printedVariable` targets of the\n\t * body and rubric content the session reports as context state — the QTI built-ins\n\t * (`duration`, `numAttempts`, `completionStatus`) and declared context variables. Their\n\t * values are substituted while `getItemBodyHtml()` serializes (the content pass reads the\n\t * live context), so they are the part of the context state a presentation's markup actually\n\t * renders — presentation consumers (ItemBody) can key caching on them. The context\n\t * declaration set is fixed per session, so the filtered set is computed once.\n\t */\n\tpublic getContextIdentifiersPrintedInContent(): ReadonlySet<string> {\n\t\tthis.printedContextIdentifiers ??= new Set(\n\t\t\t[...this.itemDocument.printedVariableIdentifiers()].filter((identifier) =>\n\t\t\t\tisContextSerialized(this.decls[identifier])\n\t\t\t)\n\t\t);\n\t\treturn this.printedContextIdentifiers;\n\t}\n\n\tprivate printedContextIdentifiers?: ReadonlySet<string>;\n\n\tpublic isAdaptive(): boolean {\n\t\treturn (this.itemDocument.getAssessmentItemAttribute('adaptive') || '').toLowerCase() === 'true';\n\t}\n\n\tpublic getNumAttempts(): number {\n\t\treturn Math.max(0, Math.floor(toNumber(this.ctx.getValue('numAttempts')) || 0));\n\t}\n\n\tpublic getCompletionStatus(): CompletionStatus {\n\t\tconst s = (toStringValue(this.ctx.getValue('completionStatus')) || '').trim() as CompletionStatus;\n\t\treturn (s || 'not_attempted') as CompletionStatus;\n\t}\n\n\tpublic isCompleted(): boolean {\n\t\treturn this.getCompletionStatus() === 'completed';\n\t}\n\n\tprivate runAdaptiveSubmitAttempt(countAttempt: boolean = true): AdaptiveAttemptResult {\n\t\tif (this.isCompleted()) {\n\t\t\tthrow new Error('Cannot submit: item is already completed');\n\t\t}\n\t\tthis.settleEndAttemptResponses();\n\n\t\t// QTI adaptive semantics: numAttempts should reflect the attempt being processed.\n\t\tif (this.isAdaptive() && countAttempt) {\n\t\t\tconst next = this.getNumAttempts() + 1;\n\t\t\tthis.ctx.setValue('numAttempts', qtiValue('integer', 'single', next));\n\t\t\t// Promote completionStatus from not_attempted -> unknown on first submission unless RP sets it.\n\t\t\tif (this.getCompletionStatus() === 'not_attempted') {\n\t\t\t\tthis.ctx.setValue('completionStatus', qtiValue('identifier', 'single', 'unknown'));\n\t\t\t}\n\t\t}\n\n\t\t// A non-adaptive item counts (and finalizes) only a counted attempt, as endAttempt does.\n\t\tconst base = this.isAdaptive()\n\t\t\t? this.processResponses()\n\t\t\t: this.runResponseProcessing({ finalizeNonAdaptiveAttempt: countAttempt, countAttempt });\n\t\tconst completionStatus = this.getCompletionStatus();\n\t\tconst completed = completionStatus === 'completed';\n\t\tconst canContinue = this.isAdaptive() ? !completed : false;\n\n\t\treturn {\n\t\t\t...base,\n\t\t\tcompleted,\n\t\t\tnumAttempts: this.getNumAttempts(),\n\t\t\tcompletionStatus,\n\t\t\tcanContinue,\n\t\t};\n\t}\n\n\tpublic getResponses(): Record<string, any> {\n\t\tconst out: Record<string, any> = {};\n\t\tfor (const d of Object.values(this.decls)) {\n\t\t\tif ((d as any).__kind !== 'response') continue;\n\t\t\tconst pciHost = this.pciSession.get(d.identifier);\n\t\t\tif (pciHost) {\n\t\t\t\tconst before = d.value;\n\t\t\t\tconst currentResponse = pciHost.getResponse();\n\t\t\t\td.value = this.coerceToDeclarationValue(\n\t\t\t\t\td.baseType,\n\t\t\t\t\td.cardinality,\n\t\t\t\t\tcurrentResponse,\n\t\t\t\t\td.identifier\n\t\t\t\t);\n\t\t\t\t// Adopting a different mounted-module response is a response change.\n\t\t\t\tif (!qtiValueEquals(before, d.value)) this.touchResponses();\n\t\t\t}\n\t\t\tout[d.identifier] = this.qtiValueToPublic(d.value);\n\t\t}\n\t\treturn out;\n\t}\n\n\t/**\n\t * The engine's current responses, stable within one response revision: the serializer and\n\t * the end-attempt gate read the same record, so their validations memoize together.\n\t * @internal Serialization reads it through the host.\n\t */\n\tresponseSnapshot(): Record<string, any> {\n\t\tif (this.responseSnapshotState && this.responseSnapshotState.revision === this.responseRevision) {\n\t\t\treturn this.responseSnapshotState.responses;\n\t\t}\n\t\tconst responses = this.getResponses();\n\t\tthis.responseSnapshotState = { revision: this.responseRevision, responses };\n\t\treturn responses;\n\t}\n\n\tprivate responseSnapshotState: { revision: number; responses: Record<string, any> } | null = null;\n\n\t/**\n\t * Get all correct responses as a map\n\t * @returns Map of responseId to correct response value\n\t */\n\tpublic getCorrectResponses(): Record<string, any> {\n\t\tconst out: Record<string, any> = {};\n\t\tfor (const d of Object.values(this.decls)) {\n\t\t\tif ((d as any).__kind !== 'response') continue;\n\t\t\tconst respDecl = d as any;\n\t\t\tif (!respDecl.correctResponse || respDecl.correctResponse.kind !== 'value') continue;\n\t\t\tout[d.identifier] = this.qtiValueToPublic(respDecl.correctResponse);\n\t\t}\n\t\treturn out;\n\t}\n\n\tpublic setTemplateVariables(vars: Record<string, any>): void {\n\t\tthis.invalidateInteractionData();\n\t\tfor (const [id, raw] of Object.entries(vars)) {\n\t\t\tconst d = this.decls[id];\n\t\t\tif (!d?.isTemplate) continue;\n\t\t\td.value = this.coerceToDeclarationValue(d.baseType, d.cardinality, raw, d.identifier);\n\t\t}\n\t}\n\n\tpublic validateResponses(responses: Record<string, any>): ResponseValidationResult {\n\t\tconst memo = this.validationMemo;\n\t\tif (\n\t\t\tmemo &&\n\t\t\tmemo.responses === responses &&\n\t\t\tmemo.revision === this.responseRevision &&\n\t\t\tmemo.generation === this.interactionDataGeneration\n\t\t) {\n\t\t\treturn memo.result;\n\t\t}\n\t\tconst result = validateResponses(this, responses);\n\t\tthis.validationMemo = {\n\t\t\tresponses,\n\t\t\trevision: this.responseRevision,\n\t\t\tgeneration: this.interactionDataGeneration,\n\t\t\tresult,\n\t\t};\n\t\treturn result;\n\t}\n\n\t/**\n\t * The base validation of the engine's current responses, memoized per response revision\n\t * and interaction-data generation: serialization and the suspend path read it repeatedly\n\t * at unchanged state. The end-attempt gate (validateAttemptResponses) stays a separate\n\t * derivation, so its `incomplete` issues never reach the memoized base result.\n\t */\n\tprivate currentResponsesValidation(): ResponseValidationResult {\n\t\tconst memo = this.engineValidationMemo;\n\t\tif (\n\t\t\tmemo &&\n\t\t\tmemo.revision === this.responseRevision &&\n\t\t\tmemo.generation === this.interactionDataGeneration\n\t\t) {\n\t\t\treturn memo.result;\n\t\t}\n\t\tconst result = this.validateResponses(this.responseSnapshot());\n\t\tthis.engineValidationMemo = {\n\t\t\trevision: this.responseRevision,\n\t\t\tgeneration: this.interactionDataGeneration,\n\t\t\tresult,\n\t\t};\n\t\treturn result;\n\t}\n\n\t/**\n\t * The validation `dispatch({ action: 'endAttempt', validateResponses: true })` gates on\n\t * (QTI ASI §4\n\t * itemSessionControl validateResponses). An invalid response \"does not satisfy the\n\t * constraints imposed by the interaction\": beyond a malformed value or a matchGroup\n\t * pairing (`validateResponses`), an interaction that requires input — minChoices,\n\t * minAssociations, minStrings, minPlays, matchMin — rejects an incomplete one. Those\n\t * entries turn invalid with an `incomplete` issue, so the result reads invalid through\n\t * the same channel as every other rejection.\n\t *\n\t * An item with no response at all is a skip, which allowSkipping governs (\"delivery\n\t * engines must ensure that the candidate can choose to submit no response\" when it is\n\t * true). The item cannot see allowSkipping, so completeness applies only once the\n\t * candidate has responded and a skip is the caller's decision.\n\t */\n\tprivate validateAttemptResponses(responses: Record<string, any>): ResponseValidationResult {\n\t\treturn validateAttemptResponses(this, responses);\n\t}\n\n\tpublic getProgress(responses: Record<string, any>): { total: number; answered: number; unanswered: number } {\n\t\tconst v = this.validateResponses(responses);\n\t\tconst required = Object.values(v.entries).filter((e) => e.required);\n\t\tconst answered = required.filter((e) => e.complete).length;\n\t\tconst total = required.length;\n\t\treturn { total, answered, unanswered: Math.max(0, total - answered) };\n\t}\n\n\tpublic canSubmitResponses(responses: Record<string, any>): boolean {\n\t\tconst v = this.validateResponses(responses);\n\t\tconst required = Object.values(v.entries).filter((e) => e.required);\n\t\treturn v.valid && required.every((e) => e.complete);\n\t}\n\n\t/**\n\t * True if the learner has made any meaningful interaction, even if submission is not yet allowed.\n\t * Used by assessment/session controllers to track \"answered\" state.\n\t */\n\tpublic isAttempted(responses: Record<string, any>): boolean {\n\t\treturn isAttempted(this, responses);\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// Execution\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Template processing re-extracts the item's interactions, so the interaction cache\n\t * drops before the program runs. Template rules can also change response values\n\t * (setDefaultValue), so the response revision moves with it.\n\t */\n\tprivate execTemplateProcessing(): void {\n\t\tthis.invalidateInteractionData();\n\t\texecTemplateProcessingProgram(this);\n\t\tthis.responseRevision += 1;\n\t\tthis.responseSnapshotState = null;\n\t}\n\n\tprivate invalidateInteractionData(): void {\n\t\tthis.interactionDataCache = null;\n\t\tthis.interactionDataGeneration += 1;\n\t\tthis.responseSnapshotState = null;\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// Declarations\n\t// ----------------------------------------------------------------------------\n\n\t/** Host-supplied context values, e.g. `QTI_CONTEXT`; identifiers that are not context variables are ignored. */\n\tprivate applyContextVariables(values: Readonly<Record<string, unknown>> | undefined): void {\n\t\tfor (const [id, raw] of Object.entries(values ?? {})) {\n\t\t\tconst d = this.decls[id];\n\t\t\tif ((d as any)?.__kind !== 'context') continue;\n\t\t\td.value = this.coerceToDeclarationValue(d.baseType, d.cardinality, raw, d.identifier);\n\t\t}\n\t}\n\n\t/** Test-supplied template defaults; identifiers that are not template variables are ignored. */\n\tprivate applyTemplateDefaults(values: Readonly<Record<string, unknown>> | undefined): void {\n\t\tfor (const [id, raw] of Object.entries(values ?? {})) {\n\t\t\tconst d = this.decls[id];\n\t\t\tif (!d?.isTemplate) continue;\n\t\t\td.defaultValue = this.coerceToDeclarationValue(d.baseType, d.cardinality, raw, d.identifier);\n\t\t\td.value = d.defaultValue;\n\t\t}\n\t}\n\n\tprivate applySerializedVariables(vars: Record<string, SerializedItemSessionVariable>): void {\n\t\tapplySerializedVariables(this, vars);\n\t}\n\n\tprivate serializeItemSession(): SerializedItemSessionState {\n\t\treturn serializeItemSession(this);\n\t}\n\n\t/** @internal Value forms shared with PCI hosts and the serializer. */\n\tqtiValueToPci(value: QtiValue | undefined): unknown {\n\t\treturn qtiValueToPci(value);\n\t}\n\n\t/** @internal */\n\tqtiValueToPublic(value: QtiValue | undefined): any {\n\t\treturn qtiValueToPublic(value);\n\t}\n\n\t/** @internal Response processing runs start by bringing the duration variable current. */\n\tupdateDuration(): void {\n\t\tupdateDuration(this);\n\t}\n\n\tprivate freezeDuration(): number {\n\t\treturn freezeDuration(this);\n\t}\n\n\t/** Time on task in whole milliseconds, as the host-facing session fields report it. */\n\tprivate getDuration(): number {\n\t\treturn this.durationMs;\n\t}\n\n\t/** Raw values read as a declaration's QTI base type and cardinality; see declarations/declarationValues. */\n\tprivate coerceToDeclarationValue(\n\t\tbaseType: BaseType | undefined,\n\t\tcardinality: Cardinality,\n\t\traw: unknown,\n\t\tidentifier?: string,\n\t): QtiValue {\n\t\treturn coerceToDeclarationValue({ itemDocument: this.itemDocument }, baseType, cardinality, raw, identifier);\n\t}\n\n\n\t// ----------------------------------------------------------------------------\n\t// Item content pass: printedVariable, feedback, templates\n\t// ----------------------------------------------------------------------------\n\n\tprivate contentHandlers({ feedback = true }: { feedback?: boolean } = {}): ContentHandlers {\n\t\treturn contentHandlers(this, { feedback });\n\t}\n\n\t/** @internal Scoring resolves the attempt's active modal feedback. */\n\tgetModalFeedback(outcomes: Record<string, any>): ModalFeedback[] {\n\t\treturn modalFeedbackOf(this, this.contentHandlers(), outcomes);\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Module-level helpers\n// ---------------------------------------------------------------------------\n\nfunction mergePnp(base: PnpProfile | undefined, partial: Partial<PnpProfile>): PnpProfile {\n\treturn {\n\t\tdisplay: { ...(base?.display ?? {}), ...(partial.display ?? {}) },\n\t\tcontent: { ...(base?.content ?? {}), ...(partial.content ?? {}) },\n\t\tcognitive: { ...(base?.cognitive ?? {}), ...(partial.cognitive ?? {}) },\n\t\t...(base?.tools || partial.tools ? { tools: { ...(base?.tools ?? {}), ...(partial.tools ?? {}) } } : {}),\n\t};\n}\n\nfunction createSessionGuid(): string {\n\t// `Crypto` is typed as always providing `randomUUID`, but it is restricted to secure\n\t// contexts and so is genuinely absent when the player is served over plain HTTP.\n\t// Reading through a `Partial<Crypto>` keeps TypeScript from narrowing the fallback\n\t// branch to `never` on the strength of a type that overstates what is available.\n\tconst webCrypto: Partial<Crypto> | undefined = typeof crypto !== 'undefined' ? crypto : undefined;\n\n\tif (typeof webCrypto?.randomUUID === 'function') {\n\t\treturn webCrypto.randomUUID();\n\t}\n\t// `getRandomValues` carries no secure-context restriction and offers the same entropy\n\t// guarantee, so it covers the plain-HTTP case. The previous fallback here used\n\t// `Math.random()`, which is not a CSPRNG and left session GUIDs predictable in\n\t// exactly the environments that reached it.\n\tif (typeof webCrypto?.getRandomValues === 'function') {\n\t\tconst bytes = new Uint8Array(16);\n\t\twebCrypto.getRandomValues(bytes);\n\t\tconst hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');\n\t\treturn `item-session-${hex}`;\n\t}\n\tthrow new Error(\n\t\t'No Web Crypto API available: cannot generate a session GUID. @pie-qti/item-player ' +\n\t\t\t'requires crypto.randomUUID or crypto.getRandomValues (present in all supported ' +\n\t\t\t'browsers and in Node >= 20).',\n\t);\n}\n\n"]}
1
+ {"version":3,"file":"Player.js","sourceRoot":"","sources":["../../src/core/Player.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAE1B,kBAAkB,EAElB,kBAAkB,EAClB,QAAQ,EAIR,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,aAAa,GACb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AACvE,OAAO,EACN,gBAAgB,EAChB,wBAAwB,GAExB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAEpF,OAAO,EACN,wBAAwB,EACxB,+BAA+B,GAE/B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,6BAA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eAAe,CAAC,KAAK,CAAC,CAAC;QACjC,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/E,OAAO,gBAAgB,GAAG,EAAE,CAAC;IAC9B,CAAC;IACD,MAAM,IAAI,KAAK,CACd,oFAAoF;QACnF,iFAAiF;QACjF,8BAA8B,CAC/B,CAAC;AACH,CAAC","sourcesContent":["import {\n\ttype BaseType,\n\tbuildOutcomeProcessingAst,\n\tbuildResponseProcessingAst,\n\tbuildTemplateProcessingAst,\n\ttype Cardinality,\n\tDeclarationContext,\n\ttype DeclarationMap,\n\tfindAssessmentItem,\n\tparseXml,\n\ttype ProcessingProgram,\n\ttype QtiValue,\n\tqtiNull,\n\tqtiValue,\n\ttoBoolean,\n\ttoNumber,\n\ttoStringValue,\n} from '@pie-qti/qti-processing';\nimport type { ElementNameMapper, AttributeNameMapper, QtiVersion } from '@pie-qti/qti-common';\nimport { prepareContentMarkup } from '@pie-qti/qti-common/accessibility';\nimport type { ResolvedItemDeliveryContext } from '@pie-qti/ims-cp-core';\nimport { DefaultI18nProvider, type I18nProvider } from '@pie-qti/i18n';\nimport {\n\tdetectQtiVersion,\n\tdetectQtiVersionDetailed,\n\ttype QtiVersionDetection,\n} from '@pie-qti/qti-common';\nimport type {\n\tAssessmentItemDocument,\n\tResponseProcessingDescriptor,\n} from '../document/AssessmentItemDocument.js';\nimport { parseAssessmentItemDocument } from '../document/AssessmentItemDocument.js';\nimport type { ContentHandlers } from '../document/contentPass.js';\nimport {\n\tcreateExtractionRegistry,\n\tregisterFrameworkDeliveryFields,\n\ttype ExtractionRegistry,\n} from '../extraction/ExtractionRegistry.js';\nimport { extractInteractionData } from '../extraction/interactionExtractionPipeline.js';\nimport { getStandardInteractionModules } from '../interactions/modules.js';\nimport type {\n\tAdaptiveAttemptResult,\n\tCompletionStatus,\n\tHtmlContent,\n\tItemSessionAction,\n\tItemSessionActionCommand,\n\tItemLifecycleStatus,\n\tItemSessionActionResult,\n\tModalFeedback,\n\tItemSessionEngineConfig,\n\tPlayerSecurityConfig,\n\tQTIRole,\n\tRubricBlock,\n\tRubricBlockOptions,\n\tScoringResult,\n\tSerializedItemSessionState,\n\tSerializedItemSessionVariable,\n} from '../types/index.js';\nimport type { BaseInteractionData, TextEntryInteractionData } from '../interactions/shared/types.js';\nimport type { ResponseValidationResult } from '../types/responseValidation.js';\nimport type { ComponentRegistry } from './ComponentRegistry.js';\nimport { createComponentRegistry } from './ComponentRegistry.js';\nimport { collectItemDiagnostics, type QtiItemDiagnostic, reportItemDiagnostics } from './compliance.js';\nimport { type MatchGroupConstraints, readMatchGroupConstraints } from './matchGroups.js';\nimport { createSeededRng } from './random.js';\nimport { sanitizeHtml } from './sanitizer.js';\nimport { enforceItemXmlLimits } from './parsingLimits.js';\nimport type { PnpProfile } from '../pnp/types.js';\nimport { applyPnpToRoot } from '../pnp/applyPnp.js';\nimport type { CatalogIndex } from '../catalog/types.js';\nimport { buildSessionCatalogIndexes, catalogEntryOf } from '../catalog/sessionCatalog.js';\nimport { PciHost } from '../pci/PciHost.js';\nimport { cloneValue } from '../utils/cloneFreeze.js';\nimport { attributeNameMapperForVersion, elementNameMapperForVersion } from './nameMappers.js';\nimport { contentHandlers } from './rendering/contentPass.js';\nimport { itemBodyHtml, modalFeedbackOf, rubricsOf } from './rendering/htmlRender.js';\nimport {\n\tapplySerializedVariables,\n\tfreezeDuration,\n\tisContextSerialized,\n\tserializeItemSession,\n\tupdateDuration,\n} from './serialization/sessionState.js';\nimport { qtiValueEquals, qtiValueToPci, qtiValueToPublic } from './serialization/valueForms.js';\nimport {\n\tbuildDeclarationMap,\n\tensureBuiltinDeclarations,\n} from './declarations/declarationBuilder.js';\nimport { coerceToDeclarationValue } from './declarations/declarationValues.js';\nimport {\n\tisAttempted,\n\tvalidateAttemptResponses,\n\tvalidateResponses,\n} from './processing/responseValidation.js';\nimport {\n\tassertSupportedResponseProcessing,\n\texecTemplateProcessingProgram,\n\tresetOutcomesToDefault,\n\tresetResponsesToDefault,\n\tresetTemplatesToDefault,\n\trestoreDeclaredTemplateRuleTargets,\n\trunResponseProcessing,\n} from './processing/responseProcessing.js';\nimport type { ExtractedPci, PciInteractionStatus } from '../pci/types.js';\nimport { PciHostSession } from '../pci/sessionHosts.js';\nimport { createTextEntryStringResponse, textEntryStringIdentifier } from '../interactions/text-entry/response.js';\n\n/** Immutable source-derived artifacts shared by sessions from one definition. */\ninterface PreparedPlayerDefinition {\n\treadonly identifier: string;\n\treadonly mapper: ElementNameMapper;\n\treadonly attributeMapper: AttributeNameMapper;\n\treadonly itemDocument: AssessmentItemDocument;\n\treadonly declarations: DeclarationMap;\n\treadonly responseProcessing: ResponseProcessingDescriptor;\n\treadonly responseProcessingProgram: ProcessingProgram | null;\n\treadonly templateProcessingProgram: ProcessingProgram | null;\n\treadonly outcomeProcessingProgram: ProcessingProgram | null;\n\treadonly catalogIndex: CatalogIndex;\n\treadonly stimulusCatalogIndexes: Map<string, CatalogIndex>;\n\treadonly diagnostics: readonly QtiItemDiagnostic[];\n\treadonly matchGroupConstraints: ReadonlyMap<string, MatchGroupConstraints>;\n}\n\ninterface PlayerConstructionOptions {\n\t/** Compile source-derived artifacts without starting an item attempt. */\n\treadonly compileOnly?: boolean;\n\t/** Restore supplies template variables, so avoid an observable throwaway template run. */\n\treadonly skipTemplateProcessing?: boolean;\n}\n\n/** @internal Used by AssessmentItemDefinition; deliberately absent from the package root API. */\nexport function preparePlayerDefinitionInternal(config: ItemSessionEngineConfig): unknown {\n\tconst compiler = new Player(config, undefined, { compileOnly: true });\n\ttry {\n\t\treturn compiler.capturePreparedDefinition();\n\t} finally {\n\t\tcompiler.destroy();\n\t}\n}\n\n/** @internal Used by ItemSession; deliberately absent from the package root API. */\nexport function createPlayerFromPreparedInternal(\n\tconfig: ItemSessionEngineConfig,\n\tprepared: unknown,\n\tskipTemplateProcessing = false,\n): Player {\n\treturn new Player(config, prepared as PreparedPlayerDefinition, {\n\t\tskipTemplateProcessing,\n\t});\n}\n\nexport class Player {\n\t/** @internal Rendering resolves rubric views against the session's role. */\n\trole: QTIRole;\n\t/** @internal Engine modules read the resolved configuration through the host. */\n\tconfig: ItemSessionEngineConfig;\n\tprivate itemXml: string;\n\t/** @internal Engine modules read the parsed item document through the host. */\n\titemDocument: AssessmentItemDocument;\n\t/** @internal Engine modules read the session's declarations through the host. */\n\tdecls: DeclarationMap;\n\t/** @internal The declarations as compiled from the item source, before any template rule changed them. */\n\tsourceDeclarations: DeclarationMap;\n\t/** @internal Engine modules read the variable context through the host. */\n\tctx: DeclarationContext;\n\t/** @internal Engine modules read the session's random stream through the host. */\n\trng: () => number;\n\tprivate extractionRegistry: ExtractionRegistry;\n\tprivate interactionDataCache: readonly BaseInteractionData[] | null = null;\n\t/** Template variables declared with `mathVariable`, substituted into MathML. @internal */\n\tmathVariableIds: ReadonlySet<string> | null = null;\n\t/** Template variables declared with `paramVariable`, substituted into `<param>` values. @internal */\n\tparamVariableIds: ReadonlySet<string> | null = null;\n\tprivate componentRegistry: ComponentRegistry;\n\tprivate i18nProvider: I18nProvider;\n\t/** @internal Engine modules resolve canonical element names through the host. */\n\tmapper: ElementNameMapper;\n\t/** The item's detected QTI version ('unknown' when nothing identified it). */\n\tprivate qtiVersion: QtiVersion;\n\n\t/** @internal Set once the implied-zero MAXSCORE warning has fired. */\n\twarnedImpliedZeroMaxScore = false;\n\t/** @internal Compiled processing programs, shared by the sessions of one definition. */\n\tresponseProcessingProgram: ProcessingProgram | null = null;\n\t/** @internal */\n\tresponseProcessing: ResponseProcessingDescriptor;\n\t/** @internal */\n\ttemplateProcessingProgram: ProcessingProgram | null = null;\n\t/** @internal */\n\toutcomeProcessingProgram: ProcessingProgram | null = null;\n\tprivate _pnp: PnpProfile | undefined;\n\tprivate _rootEl: HTMLElement | undefined;\n\tprivate _catalogIndex: CatalogIndex = new Map();\n\tprivate _stimulusCatalogIndexes: Map<string, CatalogIndex> = new Map();\n\t/** @internal The PCI hosts of this session, by response identifier. */\n\tprivate readonly pciSession = new PciHostSession();\n\tprivate _pnpChangeListeners = new Set<(pnp: PnpProfile | undefined) => void>();\n\t/** @internal The shuffle seed, persisted in saved state and restored. */\n\tsessionGuid: string;\n\t/** @internal The item-session lifecycle stage; action orchestration mutates it. */\n\tlifecycleStatus: ItemLifecycleStatus = 'initial';\n\t/**\n\t * End-attempt responses the candidate turned true since the attempt last ended: the\n\t * interactions that invoke the next response processing (see settleEndAttemptResponses).\n\t * @internal Response resets read and clear it through the host.\n\t */\n\treadonly endAttemptActivations = new Set<string>();\n\tprivate diagnostics: readonly QtiItemDiagnostic[] = [];\n\t/** @internal matchGroup constraints of the item's pairing interactions, by response identifier. */\n\tmatchGroupConstraints: ReadonlyMap<string, MatchGroupConstraints> = new Map();\n\t/** @internal When the current duration clock window started. */\n\tsessionStartedAt: number;\n\t/** @internal Time on task accumulated before the current clock window. */\n\taccumulatedDurationMs = 0;\n\t/** Time on task at the last duration update, in milliseconds. @internal */\n\tdurationMs = 0;\n\t/**\n\t * Bumped at every change to the session's response values (candidate input, restore,\n\t * template rules, PCI writes, attempt settlement) and wherever the interaction data\n\t * regenerates; keys the response-validation memo.\n\t */\n\tprivate responseRevision = 0;\n\tprivate interactionDataGeneration = 0;\n\t/** The base validation of the engine's current responses, memoized per revision. */\n\tprivate engineValidationMemo: { revision: number; generation: number; result: ResponseValidationResult } | null = null;\n\t/** The last base validation computed for an explicit responses record. */\n\tprivate validationMemo: {\n\t\tresponses: Record<string, any>;\n\t\trevision: number;\n\t\tgeneration: number;\n\t\tresult: ResponseValidationResult;\n\t} | null = null;\n\n\tconstructor(config: ItemSessionEngineConfig);\n\t/** @internal Definition-backed sessions use the module-local factory above. */\n\tconstructor(\n\t\tconfig: ItemSessionEngineConfig,\n\t\tprepared: PreparedPlayerDefinition | undefined,\n\t\tconstruction?: PlayerConstructionOptions,\n\t);\n\tconstructor(\n\t\tconfig: ItemSessionEngineConfig,\n\t\tprepared?: PreparedPlayerDefinition,\n\t\tconstruction: PlayerConstructionOptions = {},\n\t) {\n\t\tthis.config = config;\n\t\tthis.itemXml = config.itemXml ?? '';\n\t\tthis.role = config.role ?? 'candidate';\n\t\tthis.sessionGuid = createSessionGuid();\n\t\tthis.sessionStartedAt = Date.now();\n\t\tthis.rng = config.rng ?? (typeof config.seed === 'number' ? createSeededRng(config.seed) : Math.random);\n\n\t\t// Resolve QTI-version mappers without mutating caller-owned configuration.\n\t\t// The detected version also drives per-version spec defaults during extraction\n\t\t// (e.g. graphicGapMatchInteraction maxAssociations); detect it once, here.\n\t\tthis.qtiVersion = config.qtiVersion ?? detectQtiVersion(this.itemXml);\n\t\tthis.mapper =\n\t\t\tprepared?.mapper ??\n\t\t\tconfig.elementNameMapper ??\n\t\t\telementNameMapperForVersion(this.qtiVersion);\n\t\tconst attributeMapper =\n\t\t\tprepared?.attributeMapper ??\n\t\t\tconfig.attributeNameMapper ??\n\t\t\tattributeNameMapperForVersion(this.mapper.version);\n\t\tthis.config = {\n\t\t\t...config,\n\t\t\telementNameMapper: this.mapper,\n\t\t\tattributeNameMapper: attributeMapper,\n\t\t\tqtiVersion: this.qtiVersion,\n\t\t};\n\n\t\tif (prepared) {\n\t\t\tthis.itemDocument = prepared.itemDocument;\n\t\t\tthis.decls = cloneValue(prepared.declarations);\n\t\t} else {\n\t\t\t// Read-aloud markup: suppression restated as the attribute the PIE tools read, and SSML\n\t\t\t// docked as catalog idrefs and unwrapped from the visible body. The section player derives\n\t\t\t// the same `spoken` cards from the same XML.\n\t\t\tenforceItemXmlLimits(this.itemXml, this.config.security);\n\t\t\tthis.itemXml = prepareContentMarkup(this.itemXml, [], { hidingStyles: false }).xml;\n\t\t\tthis.itemDocument = parseAssessmentItemDocument({\n\t\t\t\titemXml: this.itemXml,\n\t\t\t\telementNameMapper: this.mapper,\n\t\t\t\tattributeNameMapper: attributeMapper as AttributeNameMapper,\n\t\t\t\tsecurity: this.config.security,\n\t\t\t});\n\t\t\tthis.decls = buildDeclarationMap({\n\t\t\t\titemDocument: this.itemDocument,\n\t\t\t\tmapper: this.mapper,\n\t\t\t\tattributeMapper: this.config.attributeNameMapper,\n\t\t\t});\n\t\t\tensureBuiltinDeclarations(this.decls);\n\t\t}\n\t\tthis.applyContextVariables(config.contextVariables);\n\t\tthis.applyTemplateDefaults(config.templateDefaults);\n\t\tthis.sourceDeclarations = cloneValue(this.decls);\n\t\tthis.ctx = new DeclarationContext(this.decls);\n\n\t\t// Extraction + rendering registries (for interaction rendering)\n\t\t// Pass the element name mapper to the extraction registry for QTI version handling\n\t\tthis.extractionRegistry =\n\t\t\t(this.config.extractionRegistry as ExtractionRegistry | undefined) ??\n\t\t\tcreateExtractionRegistry(this.mapper);\n\t\tthis.componentRegistry =\n\t\t\t(this.config.componentRegistry as ComponentRegistry | undefined) ??\n\t\t\tcreateComponentRegistry();\n\n\t\t// I18n provider (defaults to a simple fallback if not provided)\n\t\tthis.i18nProvider = this.config.i18nProvider ?? this.createDefaultI18nProvider();\n\n\t\tif (!this.extractionRegistry.isSealed()) {\n\t\t\t// Register standard interaction extractors.\n\t\t\tfor (const module of getStandardInteractionModules()) {\n\t\t\t\tthis.extractionRegistry.register(module.extractor as any);\n\t\t\t\tregisterFrameworkDeliveryFields(\n\t\t\t\t\tthis.extractionRegistry,\n\t\t\t\t\tmodule.type,\n\t\t\t\t\tmodule.delivery,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis.extractionRegistry.seal();\n\t\t}\n\n\t\t// Build ASTs once.\n\t\tconst processingBuildOptions = {\n\t\t\telementNameMapper: this.mapper,\n\t\t\tresolveProcessingFragment: this.config.resolveProcessingFragment,\n\t\t\tmaxProcessingFragmentDepth: this.config.processingFragmentLimits?.maxDepth,\n\t\t\tmaxProcessingFragmentCharacters: this.config.processingFragmentLimits?.maxCharacters,\n\t\t};\n\t\tconst templateProcessing = prepared ? null : this.itemDocument.getProcessingElement('template');\n\t\tthis.templateProcessingProgram =\n\t\t\tprepared?.templateProcessingProgram ??\n\t\t\t(templateProcessing\n\t\t\t\t? buildTemplateProcessingAst(templateProcessing, processingBuildOptions)\n\t\t\t\t: null);\n\t\tif (\n\t\t\tthis.templateProcessingProgram &&\n\t\t\t!construction.compileOnly &&\n\t\t\t!construction.skipTemplateProcessing\n\t\t) {\n\t\t\tthis.execTemplateProcessing();\n\t\t}\n\n\t\tconst responseProcessing = prepared ? null : this.itemDocument.getProcessingElement('response');\n\t\tthis.responseProcessing = prepared?.responseProcessing ?? this.itemDocument.describeResponseProcessing();\n\t\tif (!prepared) assertSupportedResponseProcessing(this);\n\t\tthis.responseProcessingProgram =\n\t\t\tprepared?.responseProcessingProgram ??\n\t\t\t(responseProcessing\n\t\t\t\t? buildResponseProcessingAst(responseProcessing, processingBuildOptions)\n\t\t\t\t: null);\n\n\t\tconst outcomeProcessing = prepared ? null : this.itemDocument.getProcessingElement('outcome');\n\t\tthis.outcomeProcessingProgram =\n\t\t\tprepared?.outcomeProcessingProgram ??\n\t\t\t(outcomeProcessing\n\t\t\t\t? buildOutcomeProcessingAst(outcomeProcessing, processingBuildOptions)\n\t\t\t\t: null);\n\n\t\t// QTI 2.1 is delivered through the QTI 2.2 code path; other version findings are diagnostics.\n\t\tconst versionDetection = prepared ? null : detectQtiVersionDetailed(config.itemXml ?? '');\n\t\tif (versionDetection?.version === '2.1' && !this.config.strictQtiCompliance?.enabled) {\n\t\t\tconsole.info(\n\t\t\t\t'[QTI Player] QTI 2.1 detected. Using QTI 2.2 compatibility mode with CC2 template support.'\n\t\t\t);\n\t\t}\n\n\t\t// Store PNP profile for later use (applyPnpToRoot is called once a root element is available).\n\t\tthis._pnp = this.config.pnp;\n\n\t\t// Build the catalog index from shared catalog XML, item XML, and resolved delivery context.\n\t\t// Sanitized item-level delivery context entries win over raw item XML on collisions.\n\t\t// Stimulus entries are kept separately so rendered stimulus terms can avoid ID collisions.\n\t\t// Package (shared catalog file) entries merge first: they hold the lowest\n\t\t// precedence, below catalogXml and the item's own catalogs (QTI 3.0 §6.3).\n\t\tif (prepared) {\n\t\t\tthis._catalogIndex = prepared.catalogIndex;\n\t\t\tthis._stimulusCatalogIndexes = prepared.stimulusCatalogIndexes;\n\t\t} else {\n\t\t\tconst indexes = buildSessionCatalogIndexes({ config: this.config, itemXml: this.itemXml });\n\t\t\tthis._catalogIndex = indexes.catalogIndex;\n\t\t\tthis._stimulusCatalogIndexes = indexes.stimulusCatalogIndexes;\n\t\t}\n\n\t\t// Checks that read the item as authored, before the content pass: matchGroup constraints, and\n\t\t// compliance findings, reported (or rejected, in strict mode) once, when the item compiles.\n\t\tif (prepared) {\n\t\t\tthis.matchGroupConstraints = prepared.matchGroupConstraints;\n\t\t\tthis.diagnostics = prepared.diagnostics;\n\t\t} else {\n\t\t\tconst sourceItem = findAssessmentItem(parseXml(config.itemXml ?? ''));\n\t\t\tthis.matchGroupConstraints = readMatchGroupConstraints(sourceItem, this.mapper);\n\t\t\tthis.diagnostics = this.compileDiagnostics(config.itemXml ?? '', sourceItem, versionDetection ?? undefined);\n\t\t}\n\t}\n\n\t/** @internal Definition compiler capture; parser artifacts remain module-private. */\n\tcapturePreparedDefinition(): PreparedPlayerDefinition {\n\t\tconst identifier = this.itemDocument.getAssessmentItemAttribute('identifier')?.trim();\n\t\tif (!identifier) {\n\t\t\tthrow new Error('AssessmentItemDefinition requires an assessment-item identifier');\n\t\t}\n\t\treturn Object.freeze({\n\t\t\tidentifier,\n\t\t\tmapper: this.mapper,\n\t\t\tattributeMapper: this.config.attributeNameMapper as AttributeNameMapper,\n\t\t\titemDocument: this.itemDocument,\n\t\t\tdeclarations: cloneValue(this.sourceDeclarations),\n\t\t\tresponseProcessing: this.responseProcessing,\n\t\t\tresponseProcessingProgram: this.responseProcessingProgram,\n\t\t\ttemplateProcessingProgram: this.templateProcessingProgram,\n\t\t\toutcomeProcessingProgram: this.outcomeProcessingProgram,\n\t\t\tcatalogIndex: this._catalogIndex,\n\t\t\tstimulusCatalogIndexes: this._stimulusCatalogIndexes,\n\t\t\tdiagnostics: this.diagnostics,\n\t\t\tmatchGroupConstraints: this.matchGroupConstraints,\n\t\t});\n\t}\n\n\t/** The item's QTI compliance findings from compilation; empty when it compiled cleanly. */\n\tpublic getDiagnostics(): readonly QtiItemDiagnostic[] {\n\t\treturn this.diagnostics;\n\t}\n\n\t/**\n\t * Apply the PNP profile to a player root element.\n\t * Call this once the root DOM element is available (e.g. after mounting).\n\t * The player stores the element reference so updatePnp() can re-apply without re-parsing the item.\n\t */\n\tpublic applyPnp(rootEl: HTMLElement): void {\n\t\tthis._rootEl = rootEl;\n\t\tapplyPnpToRoot(rootEl, this._pnp);\n\t}\n\n\t/**\n\t * Update the PNP profile mid-session without re-parsing the item XML.\n\t * Deep-merges the partial profile into the current profile and re-applies.\n\t */\n\tpublic updatePnp(partial: Partial<PnpProfile>): void {\n\t\tthis._pnp = mergePnp(this._pnp, partial);\n\t\tif (this._rootEl) {\n\t\t\tapplyPnpToRoot(this._rootEl, this._pnp);\n\t\t}\n\t\tfor (const listener of this._pnpChangeListeners) {\n\t\t\tlistener(this._pnp);\n\t\t}\n\t}\n\n\t/** The language the item's content is written in, from the nearest `xml:lang` on its body. */\n\tpublic getContentLanguage(): string | undefined {\n\t\treturn this.itemDocument.getContentLanguage();\n\t}\n\n\t/** Return the current resolved PNP profile. */\n\tpublic getPnp(): PnpProfile | undefined {\n\t\treturn this._pnp;\n\t}\n\n\tpublic onPnpChange(listener: (pnp: PnpProfile | undefined) => void): () => void {\n\t\tthis._pnpChangeListeners.add(listener);\n\t\treturn () => this._pnpChangeListeners.delete(listener);\n\t}\n\n\t/** Return the package/assessment-resolved delivery context, if one was supplied. */\n\tpublic getDeliveryContext(): ResolvedItemDeliveryContext | undefined {\n\t\treturn this.config.deliveryContext;\n\t}\n\n\t/**\n\t * Look up a catalog entry by card identifier, usage type, and optional language.\n\t * Returns the HTML string for the matched entry, or null if not found.\n\t *\n\t * Language fallback: exact match → prefix match → no-lang entry → null.\n\t */\n\tpublic getCatalogEntry(\n\t\tidref: string,\n\t\tusage: string,\n\t\tlang?: string,\n\t\toptions?: { stimulusIdentifier?: string }\n\t): HtmlContent | null {\n\t\treturn catalogEntryOf(\n\t\t\t{ catalogIndex: this._catalogIndex, stimulusCatalogIndexes: this._stimulusCatalogIndexes },\n\t\t\tidref,\n\t\t\tusage,\n\t\t\tlang,\n\t\t\toptions,\n\t\t\tthis.config.security,\n\t\t);\n\t}\n\n\tpublic sanitizeHtmlContent(html: string): string {\n\t\treturn sanitizeHtml(html, { security: this.config.security });\n\t}\n\n\tpublic createPciHost(data: ExtractedPci): PciHost {\n\t\treturn this.pciSession.create(data, {\n\t\t\tpci: this.config.pci,\n\t\t\tdecls: this.decls,\n\t\t\tlifecycleStatus: () => this.lifecycleStatus,\n\t\t\tinteractionStatus: () => this.pciInteractionStatus(),\n\t\t\tcontentLanguage: () => this.getContentLanguage(),\n\t\t\tcoerceToDeclarationValue: (baseType, cardinality, raw, identifier) =>\n\t\t\t\tthis.coerceToDeclarationValue(baseType, cardinality, raw, identifier),\n\t\t\tonResponseApplied: () => {\n\t\t\t\t// A mounted PCI module reporting its own change is a candidate response change,\n\t\t\t\t// so the attempt has begun (beginAttempt's spec citation applies).\n\t\t\t\tthis.beginAttempt();\n\t\t\t\tthis.touchResponses();\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate pciInteractionStatus(): PciInteractionStatus {\n\t\tif (this.role !== 'candidate') return 'review';\n\t\tif (this.lifecycleStatus === 'closed') return 'closed';\n\t\treturn 'interacting';\n\t}\n\n\t/**\n\t * Offer a response value to the PCI identified by responseIdentifier. A\n\t * mounted module that has already reported a response keeps it.\n\t */\n\tpublic offerPciResponse(responseIdentifier: string, value: unknown): void {\n\t\tthis.pciSession.offer(responseIdentifier, value);\n\t}\n\n\t/**\n\t * Authoritatively replace a PCI's response, discarding in-progress candidate\n\t * state. Session restore and reset-to-default use this.\n\t */\n\tpublic restorePciResponse(responseIdentifier: string, value: unknown): void {\n\t\tthis.pciSession.restore(responseIdentifier, value);\n\t}\n\n\t/**\n\t * Destroy all PCI hosts. Call on player teardown.\n\t */\n\tpublic destroyPciHosts(): void {\n\t\tthis.pciSession.destroyAll();\n\t}\n\n\t/** Breaking-change API: returns the typed declaration map */\n\tpublic getDeclarations(): DeclarationMap {\n\t\treturn this.decls;\n\t}\n\n\t/**\n\t * Apply candidate response values to the declaration context.\n\t *\n\t * Every candidate interaction reaches this method, including a PCI reporting\n\t * its own change, so a mounted PCI module is offered the value rather than\n\t * force-fed it. Use `restoreResponses()` when the caller's value must replace\n\t * in-progress module state.\n\t */\n\tpublic setResponses(responses: Record<string, unknown>): void {\n\t\tconst endAttemptIds = this.getEndAttemptResponseIdentifiers().filter((id) => id in responses);\n\t\tconst wasTrue = new Set(endAttemptIds.filter((id) => this.isResponseTrue(id)));\n\t\tthis.applyResponses(responses, (id, value) => this.offerPciResponse(id, value));\n\t\tfor (const id of endAttemptIds) {\n\t\t\tif (!this.isResponseTrue(id)) this.endAttemptActivations.delete(id);\n\t\t\telse if (!wasTrue.has(id)) this.endAttemptActivations.add(id);\n\t\t}\n\t\tthis.beginAttempt();\n\t}\n\n\t/**\n\t * Apply response values authoritatively, discarding in-progress PCI candidate\n\t * state. State replacement and explicit host overrides use this.\n\t */\n\tpublic restoreResponses(responses: Record<string, unknown>): void {\n\t\tthis.applyResponses(responses, (id, value) => this.restorePciResponse(id, value));\n\t\t// A replaced value is the state as it stands, not the candidate activating an interaction.\n\t\tfor (const id of Object.keys(responses)) this.endAttemptActivations.delete(id);\n\t}\n\n\tprivate applyResponses(\n\t\tresponses: Record<string, unknown>,\n\t\tapplyToPci: (responseIdentifier: string, value: unknown) => void\n\t): void {\n\t\tfor (const [id, raw] of Object.entries(responses)) {\n\t\t\tconst d = this.decls[id];\n\t\t\tif (!d) continue;\n\t\t\td.value = this.coerceToDeclarationValue(d.baseType, d.cardinality, raw, d.identifier);\n\t\t\t// Only a response a textEntryInteraction binds can carry a stringIdentifier companion.\n\t\t\tif (this.itemDocument.getTextEntryBase(id) !== undefined) this.applyTextEntryStringResponse(id, raw);\n\t\t\tapplyToPci(id, this.qtiValueToPci(d.value));\n\t\t}\n\t\tthis.touchResponses();\n\t}\n\n\t/**\n\t * QTI ASI §5.2.1 built-in `completionStatus` transitions, as the specification's table names\n\t * them: `not_attempted` when the item session is registered, `unknown` once the attempt has\n\t * begun, and `completed` when response processing completes the attempt (the submission of a\n\t * non-adaptive item; an adaptive item reaches `completed` only through its own response\n\t * processing rules). This engine begins the attempt when the candidate changes a response\n\t * (every candidate write goes through setResponses, a mounted PCI reporting its own change\n\t * included) and when a suspended handoff is activated for interaction; response processing\n\t * completes it (responseProcessing.ts).\n\t *\n\t * Documented reading of an ambiguous edge: `openSession({ responses })` pre-seeds through\n\t * setResponses, so it counts as the attempt having begun. `restoreResponses` deliberately\n\t * does not begin an attempt — it replaces saved state (\"the state as it stands\"), and the\n\t * restored completionStatus travels with that state.\n\t */\n\tprivate beginAttempt(): void {\n\t\tif (this.getCompletionStatus() === 'not_attempted') {\n\t\t\tthis.ctx.setValue('completionStatus', qtiValue('identifier', 'single', 'unknown'));\n\t\t}\n\t}\n\n\t/** Response values changed: the response snapshot and its memoized validation drop. */\n\tprivate touchResponses(): void {\n\t\tthis.responseRevision += 1;\n\t\tthis.responseSnapshotState = null;\n\t\tthis.engineValidationMemo = null;\n\t}\n\n\t/**\n\t * textEntryInteraction@stringIdentifier (QTI ASI §5.122.3; `string-identifier` in QTI 3.0):\n\t * writing the text entry's response also writes the response its stringIdentifier names, with\n\t * the text as entered before the numeric response reads it — \"3.50\" where the float response\n\t * is 3.5 — or NULL for an empty field, so response processing can score that lexical form. A\n\t * stringIdentifier that repeats the response, or names no declared response, is ignored.\n\t */\n\tprivate applyTextEntryStringResponse(responseId: string, raw: unknown): void {\n\t\tconst interaction = this.getInteractionData().find(\n\t\t\t(candidate): candidate is TextEntryInteractionData =>\n\t\t\t\tcandidate.type === 'textEntryInteraction' && candidate.responseId === responseId,\n\t\t);\n\t\tconst stringIdentifier = interaction ? textEntryStringIdentifier(interaction) : undefined;\n\t\tconst companion = stringIdentifier ? this.decls[stringIdentifier] : undefined;\n\t\tif (!interaction || !companion || (companion as any).__kind !== 'response') return;\n\t\tcompanion.value = this.coerceToDeclarationValue(\n\t\t\tcompanion.baseType,\n\t\t\tcompanion.cardinality,\n\t\t\tcreateTextEntryStringResponse(raw, interaction),\n\t\t\tcompanion.identifier,\n\t\t);\n\t}\n\n\t/**\n\t * Destroy all resources owned by this player instance (PCI modules, etc.).\n\t * Call when unmounting to prevent memory leaks.\n\t */\n\tpublic destroy(): void {\n\t\tthis.destroyPciHosts();\n\t}\n\n\tpublic processResponses(): ScoringResult {\n\t\treturn this.runResponseProcessing({ finalizeNonAdaptiveAttempt: true });\n\t}\n\n\tpublic saveItemSession(): SerializedItemSessionState {\n\t\tthis.freezeDuration();\n\t\treturn this.serializeItemSession();\n\t}\n\n\tpublic restoreItemSession(state: SerializedItemSessionState): void {\n\t\tthis.sessionGuid = state.sessionGuid;\n\t\tthis.invalidateInteractionData();\n\t\tthis.endAttemptActivations.clear();\n\t\tthis.lifecycleStatus = state.lifecycleStatus;\n\t\tthis.accumulatedDurationMs = Math.max(0, Number(state.duration) || 0);\n\t\tthis.sessionStartedAt = Date.now();\n\t\tthis.applySerializedVariables(state.responseVariables);\n\t\tthis.applySerializedVariables(state.outcomeVariables);\n\t\tthis.applySerializedVariables(state.templateVariables);\n\t\tthis.applySerializedVariables(state.contextVariables);\n\t\tthis.touchResponses();\n\t\tthis.updateDuration();\n\t}\n\n\t/** @internal ItemSession uses this to activate a restored delivery handoff. */\n\tpublic getLifecycleStatus(): ItemLifecycleStatus {\n\t\treturn this.lifecycleStatus;\n\t}\n\n\t/** @internal ItemSession uses this to resume a suspended delivery handoff. */\n\tpublic activateAttempt(): void {\n\t\tif (this.lifecycleStatus === 'suspended') {\n\t\t\tthis.lifecycleStatus = 'interacting';\n\t\t\t// Resuming hands the item back to the candidate: the attempt has begun\n\t\t\t// (beginAttempt's spec citation applies), even before a first response change.\n\t\t\tthis.beginAttempt();\n\t\t}\n\t}\n\n\t/** Test seam (paramVariable delivery); sessions dispatch newTemplate through ItemSession. */\n\tpublic newTemplate(options: { resetResponses?: boolean } = {}): ItemSessionActionResult {\n\t\treturn this.runItemSessionAction({ action: 'newTemplate', ...options });\n\t}\n\n\tpublic runItemSessionAction(command: ItemSessionActionCommand): ItemSessionActionResult {\n\t\t// A mounted PCI module answers through getResponse() when the delivery engine asks, and\n\t\t// need not call ondone after each change: settle its value before processing or saving.\n\t\tthis.getResponses();\n\t\tswitch (command.action) {\n\t\t\tcase 'suspendAttempt':\n\t\t\t\treturn this.runSuspendAttemptAction();\n\t\t\tcase 'endAttempt':\n\t\t\t\treturn this.runEndAttemptAction(command);\n\t\t\tcase 'scoreAttempt':\n\t\t\t\treturn this.runScoreAttemptAction();\n\t\t\tcase 'newTemplate':\n\t\t\t\treturn this.runNewTemplateAction(command);\n\t\t\tcase 'submitAttempt':\n\t\t\t\treturn this.runSubmitAttemptAction(command.countAttempt ?? true);\n\t\t}\n\t}\n\n\tprivate runSuspendAttemptAction(): ItemSessionActionResult {\n\t\tconst validation = this.currentResponsesValidation();\n\t\tthis.lifecycleStatus = 'suspended';\n\t\tconst sessionState = this.saveItemSession();\n\t\treturn this.createItemSessionActionResult('suspendAttempt', sessionState, { validation });\n\t}\n\n\tprivate runEndAttemptAction(options: { countAttempt?: boolean; validateResponses?: boolean }): ItemSessionActionResult {\n\t\tconst validate = options.validateResponses ?? false;\n\t\tconst validation = validate ? this.validateAttemptResponses(this.responseSnapshot()) : undefined;\n\t\tif (validation && !validation.valid) {\n\t\t\treturn this.createItemSessionActionResult('endAttempt', this.saveItemSession(), { validation });\n\t\t}\n\n\t\t// QTI countAttempt=false (hint / \"show me\"): response processing runs so outcomes and\n\t\t// feedback compute, but the attempt is not counted and the session stays open for the\n\t\t// candidate to continue — only a counted attempt finalizes a non-adaptive item.\n\t\tconst countAttempt = options.countAttempt ?? true;\n\t\t// The adaptive path settles the end-attempt responses in runAdaptiveSubmitAttempt.\n\t\tif (!this.isAdaptive()) this.settleEndAttemptResponses();\n\t\tconst scoring = this.isAdaptive()\n\t\t\t? this.runAdaptiveSubmitAttempt(countAttempt)\n\t\t\t: this.runResponseProcessing({\n\t\t\t\t\tfinalizeNonAdaptiveAttempt: countAttempt,\n\t\t\t\t\tcountAttempt,\n\t\t\t\t});\n\t\tthis.lifecycleStatus = scoring.completed ? 'closed' : 'interacting';\n\n\t\treturn this.createItemSessionActionResult('endAttempt', this.saveItemSession(), {\n\t\t\tcompleted: scoring.completed,\n\t\t\tvalidation,\n\t\t\tscoring,\n\t\t});\n\t}\n\n\tprivate runScoreAttemptAction(): ItemSessionActionResult {\n\t\tconst scoring = this.runResponseProcessing({ finalizeNonAdaptiveAttempt: false });\n\t\treturn this.createItemSessionActionResult('scoreAttempt', this.saveItemSession(), {\n\t\t\tcompleted: scoring.completed,\n\t\t\tscoring,\n\t\t});\n\t}\n\n\tprivate runNewTemplateAction(options: { resetResponses?: boolean }): ItemSessionActionResult {\n\t\tthis.restoreDeclaredTemplateRuleTargets();\n\t\tthis.resetOutcomesToDefault();\n\t\tif (options.resetResponses ?? true) {\n\t\t\tthis.resetResponsesToDefault();\n\t\t}\n\t\tthis.resetTemplatesToDefault();\n\t\tthis.ctx.setValue('completionStatus', qtiValue('identifier', 'single', 'not_attempted'));\n\t\tthis.ctx.setValue('numAttempts', qtiValue('integer', 'single', 0));\n\t\tthis.execTemplateProcessing();\n\t\tthis.lifecycleStatus = 'initial';\n\t\tthis.accumulatedDurationMs = 0;\n\t\tthis.sessionStartedAt = Date.now();\n\t\tthis.updateDuration();\n\n\t\treturn this.createItemSessionActionResult('newTemplate', this.serializeItemSession());\n\t}\n\n\tprivate runSubmitAttemptAction(countAttempt: boolean): ItemSessionActionResult {\n\t\tconst scoring = this.runAdaptiveSubmitAttempt(countAttempt);\n\t\treturn this.createItemSessionActionResult('submitAttempt', this.saveItemSession(), {\n\t\t\tcompleted: scoring.completed,\n\t\t\tscoring,\n\t\t});\n\t}\n\n\tprivate createItemSessionActionResult(\n\t\taction: ItemSessionAction,\n\t\tsessionState: SerializedItemSessionState,\n\t\toptions: {\n\t\t\tcompleted?: boolean;\n\t\t\tvalidation?: ResponseValidationResult;\n\t\t\tscoring?: ScoringResult;\n\t\t} = {}\n\t): ItemSessionActionResult {\n\t\treturn {\n\t\t\taction,\n\t\t\tlifecycleStatus: this.lifecycleStatus,\n\t\t\tcompletionStatus: this.getCompletionStatus(),\n\t\t\tnumAttempts: this.getNumAttempts(),\n\t\t\tduration: sessionState.duration,\n\t\t\tcompleted: options.completed ?? this.isCompleted(),\n\t\t\tsessionState,\n\t\t\tvalidation: options.validation,\n\t\t\tscoring: options.scoring,\n\t\t};\n\t}\n\n\tpublic getSecurityConfig(): PlayerSecurityConfig | undefined {\n\t\treturn this.config.security;\n\t}\n\n\t/**\n\t * Get the i18n provider instance\n\t * @returns I18nProvider instance\n\t */\n\tpublic getI18nProvider(): I18nProvider {\n\t\treturn this.i18nProvider;\n\t}\n\n\t/**\n\t * The provider used when the host passes none: English, from the catalog\n\t * `@pie-qti/i18n` bundles eagerly.\n\t */\n\tprivate createDefaultI18nProvider(): I18nProvider {\n\t\treturn new DefaultI18nProvider('en-US');\n\t}\n\n\t/**\n\t * The item's QTI compliance findings (see `collectItemDiagnostics`): errors in strict mode,\n\t * warnings otherwise. Strict mode with `rejectUnknownExtensions` throws a `QtiComplianceError`\n\t * on any finding; otherwise they are logged unless `logDeviations` is false.\n\t */\n\tprivate compileDiagnostics(\n\t\tsourceXml: string,\n\t\tsourceItem: Element,\n\t\tversionDetection?: QtiVersionDetection,\n\t): readonly QtiItemDiagnostic[] {\n\t\tconst compliance = this.config.strictQtiCompliance;\n\t\tconst strict = compliance?.enabled === true;\n\t\tconst diagnostics = Object.freeze(\n\t\t\tcollectItemDiagnostics({\n\t\t\t\titemXml: sourceXml,\n\t\t\t\titem: sourceItem,\n\t\t\t\tversionDetection,\n\t\t\t\telementNameMapper: this.mapper,\n\t\t\t\textractionRegistry: this.extractionRegistry,\n\t\t\t\tresponseIdentifiers: new Set(\n\t\t\t\t\tObject.values(this.decls)\n\t\t\t\t\t\t.filter((d) => (d as any).__kind === 'response')\n\t\t\t\t\t\t.map((d) => d.identifier),\n\t\t\t\t),\n\t\t\t\tstrict,\n\t\t\t}),\n\t\t);\n\t\treportItemDiagnostics(diagnostics, {\n\t\t\titemIdentifier: this.itemDocument.getAssessmentItemAttribute('identifier') ?? undefined,\n\t\t\treject: strict && compliance?.rejectUnknownExtensions === true,\n\t\t\tlog: compliance?.logDeviations !== false,\n\t\t});\n\t\treturn diagnostics;\n\t}\n\n\tprivate resetOutcomesToDefault(): void {\n\t\tresetOutcomesToDefault(this);\n\t}\n\n\tprivate resetResponsesToDefault(): void {\n\t\tresetResponsesToDefault(this);\n\t\tthis.touchResponses();\n\t}\n\n\tprivate resetTemplatesToDefault(): void {\n\t\tresetTemplatesToDefault(this);\n\t}\n\n\tprivate restoreDeclaredTemplateRuleTargets(): void {\n\t\trestoreDeclaredTemplateRuleTargets(this);\n\t}\n\n\tprivate runResponseProcessing(options: {\n\t\tfinalizeNonAdaptiveAttempt: boolean;\n\t\tcountAttempt?: boolean;\n\t}): ScoringResult {\n\t\treturn runResponseProcessing(this, options);\n\t}\n\n\tpublic getItemBodyHtml(): HtmlContent {\n\t\treturn itemBodyHtml(this, this.contentHandlers({ feedback: false }));\n\t}\n\n\t/**\n\t * Extract rubric blocks for the current role.\n\t *\n\t * QTI uses `<rubricBlock view=\"...\">` to provide role-specific guidance.\n\t * We return sanitized HTML for host rendering. `scope: \"direct\"` rubrics\n\t * are assessmentItem children; `scope: \"itemBody\"` rubrics are authored in\n\t * the rendered item body flow.\n\t */\n\tpublic getRubrics(options: RubricBlockOptions = {}): RubricBlock[] {\n\t\treturn rubricsOf(this, this.contentHandlers(), options);\n\t}\n\n\tpublic getComponentRegistry(): ComponentRegistry {\n\t\treturn this.componentRegistry;\n\t}\n\n\t/**\n\t * Canonical interaction API (new): extracted, typed interaction data.\n\t */\n\tpublic getInteractionData(): readonly BaseInteractionData[] {\n\t\tif (this.interactionDataCache) return this.interactionDataCache;\n\t\tthis.interactionDataCache = extractInteractionData({\n\t\t\tdocument: this.itemDocument,\n\t\t\textractionRegistry: this.extractionRegistry,\n\t\t\tdeclarations: this.decls,\n\t\t\tconfig: this.config,\n\t\t\t// Seeds `shuffle`. The GUID is persisted in saved state and restored, so a\n\t\t\t// resumed session reproduces the order the candidate already saw, while a\n\t\t\t// different candidate or a new attempt gets a different one.\n\t\t\tsessionGuid: this.sessionGuid,\n\t\t\t// Template content resolves before extraction, so interactions are extracted again\n\t\t\t// when template values change. Choice feedback resolves in presentation.\n\t\t\tcontentHandlers: this.contentHandlers({ feedback: false }),\n\t\t});\n\t\treturn this.interactionDataCache;\n\t}\n\n\t/**\n\t * Convenience API (used by tests/bench): returns a minimal interaction list with QTI-ish field names.\n\t */\n\tpublic getInteractions(): Array<{ type: string; responseIdentifier: string } & Record<string, any>> {\n\t\treturn this.getInteractionData().map((i: any) => ({\n\t\t\t...i,\n\t\t\tresponseIdentifier: i.responseId,\n\t\t}));\n\t}\n\n\tpublic getResponseInteractions(): Array<{ type: string; responseIdentifier: string } & Record<string, any>> {\n\t\treturn this.getInteractions().filter((i) => i.type !== 'endAttemptInteraction');\n\t}\n\n\t/**\n\t * Returns response identifiers of endAttempt interactions with countAttempt=\"false\".\n\t * Used to detect hint-only submissions (e.g. Request Hint button).\n\t */\n\tpublic getHintEndAttemptIdentifiers(): string[] {\n\t\treturn this.getInteractions()\n\t\t\t.filter((i: any) => i.type === 'endAttemptInteraction' && i.countAttempt === false)\n\t\t\t.map((i: any) => i.responseIdentifier);\n\t}\n\n\tprivate getEndAttemptResponseIdentifiers(): string[] {\n\t\treturn this.getInteractions()\n\t\t\t.filter((i) => i.type === 'endAttemptInteraction')\n\t\t\t.map((i) => i.responseIdentifier);\n\t}\n\n\tprivate isResponseTrue(responseIdentifier: string): boolean {\n\t\treturn toBoolean(this.ctx.getValue(responseIdentifier));\n\t}\n\n\t/**\n\t * QTI endAttemptInteraction (QTI 3.0 §5.45): \"If the candidate invokes response processing\n\t * using an end-attempt interaction then the associated response variable is set to true. If\n\t * response processing is invoked in any other way […] then the associated response variable\n\t * is set to false. The default value of the response variable is always ignored.\" The\n\t * interactions that invoke this attempt's processing are the ones the candidate turned true\n\t * since the attempt last ended; a value restored with the session invokes nothing. Rescoring\n\t * (scoreAttempt) replays the last submission and leaves these responses as they are.\n\t */\n\tprivate settleEndAttemptResponses(): void {\n\t\tfor (const id of this.getEndAttemptResponseIdentifiers()) {\n\t\t\tconst d = this.decls[id];\n\t\t\tif (!d) continue;\n\t\t\td.value = this.coerceToDeclarationValue(d.baseType, d.cardinality, this.endAttemptActivations.has(id), d.identifier);\n\t\t}\n\t\tthis.endAttemptActivations.clear();\n\t\tthis.touchResponses();\n\t}\n\n\tpublic getResponseIdentifiers(): string[] {\n\t\treturn this.getResponseInteractions().map((i) => i.responseIdentifier);\n\t}\n\n\t/**\n\t * Response identifiers the item's content prints live: the `printedVariable` targets of the\n\t * body and rubric content that are declared responses. Their values are substituted while\n\t * `getItemBodyHtml()` serializes (the content pass reads the live context), so they are the\n\t * part of the response state a presentation's markup actually renders — presentation\n\t * consumers (ItemBody) can key caching on them. The declared response set is fixed per\n\t * session, so the filtered set is computed once.\n\t */\n\tpublic getResponseIdentifiersPrintedInContent(): ReadonlySet<string> {\n\t\tthis.printedResponseIdentifiers ??= new Set(\n\t\t\t[...this.itemDocument.printedVariableIdentifiers()].filter(\n\t\t\t\t(identifier) => (this.decls[identifier] as any)?.__kind === 'response'\n\t\t\t)\n\t\t);\n\t\treturn this.printedResponseIdentifiers;\n\t}\n\n\tprivate printedResponseIdentifiers?: ReadonlySet<string>;\n\n\t/**\n\t * Context identifiers the item's content prints live: the `printedVariable` targets of the\n\t * body and rubric content the session reports as context state — the QTI built-ins\n\t * (`duration`, `numAttempts`, `completionStatus`) and declared context variables. Their\n\t * values are substituted while `getItemBodyHtml()` serializes (the content pass reads the\n\t * live context), so they are the part of the context state a presentation's markup actually\n\t * renders — presentation consumers (ItemBody) can key caching on them. The context\n\t * declaration set is fixed per session, so the filtered set is computed once.\n\t */\n\tpublic getContextIdentifiersPrintedInContent(): ReadonlySet<string> {\n\t\tthis.printedContextIdentifiers ??= new Set(\n\t\t\t[...this.itemDocument.printedVariableIdentifiers()].filter((identifier) =>\n\t\t\t\tisContextSerialized(this.decls[identifier])\n\t\t\t)\n\t\t);\n\t\treturn this.printedContextIdentifiers;\n\t}\n\n\tprivate printedContextIdentifiers?: ReadonlySet<string>;\n\n\tpublic isAdaptive(): boolean {\n\t\treturn (this.itemDocument.getAssessmentItemAttribute('adaptive') || '').toLowerCase() === 'true';\n\t}\n\n\tpublic getNumAttempts(): number {\n\t\treturn Math.max(0, Math.floor(toNumber(this.ctx.getValue('numAttempts')) || 0));\n\t}\n\n\tpublic getCompletionStatus(): CompletionStatus {\n\t\tconst s = (toStringValue(this.ctx.getValue('completionStatus')) || '').trim() as CompletionStatus;\n\t\treturn (s || 'not_attempted') as CompletionStatus;\n\t}\n\n\tpublic isCompleted(): boolean {\n\t\treturn this.getCompletionStatus() === 'completed';\n\t}\n\n\tprivate runAdaptiveSubmitAttempt(countAttempt: boolean = true): AdaptiveAttemptResult {\n\t\tif (this.isCompleted()) {\n\t\t\tthrow new Error('Cannot submit: item is already completed');\n\t\t}\n\t\tthis.settleEndAttemptResponses();\n\n\t\t// QTI adaptive semantics: numAttempts should reflect the attempt being processed.\n\t\tif (this.isAdaptive() && countAttempt) {\n\t\t\tconst next = this.getNumAttempts() + 1;\n\t\t\tthis.ctx.setValue('numAttempts', qtiValue('integer', 'single', next));\n\t\t\t// Promote completionStatus from not_attempted -> unknown on first submission unless RP sets it.\n\t\t\tif (this.getCompletionStatus() === 'not_attempted') {\n\t\t\t\tthis.ctx.setValue('completionStatus', qtiValue('identifier', 'single', 'unknown'));\n\t\t\t}\n\t\t}\n\n\t\t// A non-adaptive item counts (and finalizes) only a counted attempt, as endAttempt does.\n\t\tconst base = this.isAdaptive()\n\t\t\t? this.processResponses()\n\t\t\t: this.runResponseProcessing({ finalizeNonAdaptiveAttempt: countAttempt, countAttempt });\n\t\tconst completionStatus = this.getCompletionStatus();\n\t\tconst completed = completionStatus === 'completed';\n\t\tconst canContinue = this.isAdaptive() ? !completed : false;\n\n\t\treturn {\n\t\t\t...base,\n\t\t\tcompleted,\n\t\t\tnumAttempts: this.getNumAttempts(),\n\t\t\tcompletionStatus,\n\t\t\tcanContinue,\n\t\t};\n\t}\n\n\tpublic getResponses(): Record<string, any> {\n\t\tconst out: Record<string, any> = {};\n\t\tfor (const d of Object.values(this.decls)) {\n\t\t\tif ((d as any).__kind !== 'response') continue;\n\t\t\tconst pciHost = this.pciSession.get(d.identifier);\n\t\t\tif (pciHost) {\n\t\t\t\tconst before = d.value;\n\t\t\t\tconst currentResponse = pciHost.getResponse();\n\t\t\t\td.value = this.coerceToDeclarationValue(\n\t\t\t\t\td.baseType,\n\t\t\t\t\td.cardinality,\n\t\t\t\t\tcurrentResponse,\n\t\t\t\t\td.identifier\n\t\t\t\t);\n\t\t\t\t// Adopting a different mounted-module response is a response change.\n\t\t\t\tif (!qtiValueEquals(before, d.value)) this.touchResponses();\n\t\t\t}\n\t\t\tout[d.identifier] = this.qtiValueToPublic(d.value);\n\t\t}\n\t\treturn out;\n\t}\n\n\t/**\n\t * The engine's current responses, stable within one response revision: the serializer and\n\t * the end-attempt gate read the same record, so their validations memoize together.\n\t * @internal Serialization reads it through the host.\n\t */\n\tresponseSnapshot(): Record<string, any> {\n\t\tif (this.responseSnapshotState && this.responseSnapshotState.revision === this.responseRevision) {\n\t\t\treturn this.responseSnapshotState.responses;\n\t\t}\n\t\tconst responses = this.getResponses();\n\t\tthis.responseSnapshotState = { revision: this.responseRevision, responses };\n\t\treturn responses;\n\t}\n\n\tprivate responseSnapshotState: { revision: number; responses: Record<string, any> } | null = null;\n\n\t/**\n\t * Get all correct responses as a map\n\t * @returns Map of responseId to correct response value\n\t */\n\tpublic getCorrectResponses(): Record<string, any> {\n\t\tconst out: Record<string, any> = {};\n\t\tfor (const d of Object.values(this.decls)) {\n\t\t\tif ((d as any).__kind !== 'response') continue;\n\t\t\tconst respDecl = d as any;\n\t\t\tif (!respDecl.correctResponse || respDecl.correctResponse.kind !== 'value') continue;\n\t\t\tout[d.identifier] = this.qtiValueToPublic(respDecl.correctResponse);\n\t\t}\n\t\treturn out;\n\t}\n\n\tpublic setTemplateVariables(vars: Record<string, any>): void {\n\t\tthis.invalidateInteractionData();\n\t\tfor (const [id, raw] of Object.entries(vars)) {\n\t\t\tconst d = this.decls[id];\n\t\t\tif (!d?.isTemplate) continue;\n\t\t\td.value = this.coerceToDeclarationValue(d.baseType, d.cardinality, raw, d.identifier);\n\t\t}\n\t}\n\n\tpublic validateResponses(responses: Record<string, any>): ResponseValidationResult {\n\t\tconst memo = this.validationMemo;\n\t\tif (\n\t\t\tmemo &&\n\t\t\tmemo.responses === responses &&\n\t\t\tmemo.revision === this.responseRevision &&\n\t\t\tmemo.generation === this.interactionDataGeneration\n\t\t) {\n\t\t\treturn memo.result;\n\t\t}\n\t\tconst result = validateResponses(this, responses);\n\t\tthis.validationMemo = {\n\t\t\tresponses,\n\t\t\trevision: this.responseRevision,\n\t\t\tgeneration: this.interactionDataGeneration,\n\t\t\tresult,\n\t\t};\n\t\treturn result;\n\t}\n\n\t/**\n\t * The base validation of the engine's current responses, memoized per response revision\n\t * and interaction-data generation: serialization and the suspend path read it repeatedly\n\t * at unchanged state. The end-attempt gate (validateAttemptResponses) stays a separate\n\t * derivation, so its `incomplete` issues never reach the memoized base result.\n\t */\n\tprivate currentResponsesValidation(): ResponseValidationResult {\n\t\tconst memo = this.engineValidationMemo;\n\t\tif (\n\t\t\tmemo &&\n\t\t\tmemo.revision === this.responseRevision &&\n\t\t\tmemo.generation === this.interactionDataGeneration\n\t\t) {\n\t\t\treturn memo.result;\n\t\t}\n\t\tconst result = this.validateResponses(this.responseSnapshot());\n\t\tthis.engineValidationMemo = {\n\t\t\trevision: this.responseRevision,\n\t\t\tgeneration: this.interactionDataGeneration,\n\t\t\tresult,\n\t\t};\n\t\treturn result;\n\t}\n\n\t/**\n\t * The validation `dispatch({ action: 'endAttempt', validateResponses: true })` gates on\n\t * (QTI ASI §4\n\t * itemSessionControl validateResponses). An invalid response \"does not satisfy the\n\t * constraints imposed by the interaction\": beyond a malformed value or a matchGroup\n\t * pairing (`validateResponses`), an interaction that requires input — minChoices,\n\t * minAssociations, minStrings, minPlays, matchMin — rejects an incomplete one. Those\n\t * entries turn invalid with an `incomplete` issue, so the result reads invalid through\n\t * the same channel as every other rejection.\n\t *\n\t * An item with no response at all is a skip, which allowSkipping governs (\"delivery\n\t * engines must ensure that the candidate can choose to submit no response\" when it is\n\t * true). The item cannot see allowSkipping, so completeness applies only once the\n\t * candidate has responded and a skip is the caller's decision.\n\t */\n\tprivate validateAttemptResponses(responses: Record<string, any>): ResponseValidationResult {\n\t\treturn validateAttemptResponses(this, responses);\n\t}\n\n\tpublic getProgress(responses: Record<string, any>): { total: number; answered: number; unanswered: number } {\n\t\tconst v = this.validateResponses(responses);\n\t\tconst required = Object.values(v.entries).filter((e) => e.required);\n\t\tconst answered = required.filter((e) => e.complete).length;\n\t\tconst total = required.length;\n\t\treturn { total, answered, unanswered: Math.max(0, total - answered) };\n\t}\n\n\tpublic canSubmitResponses(responses: Record<string, any>): boolean {\n\t\tconst v = this.validateResponses(responses);\n\t\tconst required = Object.values(v.entries).filter((e) => e.required);\n\t\treturn v.valid && required.every((e) => e.complete);\n\t}\n\n\t/**\n\t * True if the learner has made any meaningful interaction, even if submission is not yet allowed.\n\t * Used by assessment/session controllers to track \"answered\" state.\n\t */\n\tpublic isAttempted(responses: Record<string, any>): boolean {\n\t\treturn isAttempted(this, responses);\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// Execution\n\t// ----------------------------------------------------------------------------\n\n\t/**\n\t * Template processing re-extracts the item's interactions, so the interaction cache\n\t * drops before the program runs. Template rules can also change response values\n\t * (setDefaultValue), so the response revision moves with it.\n\t */\n\tprivate execTemplateProcessing(): void {\n\t\tthis.invalidateInteractionData();\n\t\texecTemplateProcessingProgram(this);\n\t\tthis.responseRevision += 1;\n\t\tthis.responseSnapshotState = null;\n\t}\n\n\tprivate invalidateInteractionData(): void {\n\t\tthis.interactionDataCache = null;\n\t\tthis.interactionDataGeneration += 1;\n\t\tthis.responseSnapshotState = null;\n\t}\n\n\t// ----------------------------------------------------------------------------\n\t// Declarations\n\t// ----------------------------------------------------------------------------\n\n\t/** Host-supplied context values, e.g. `QTI_CONTEXT`; identifiers that are not context variables are ignored. */\n\tprivate applyContextVariables(values: Readonly<Record<string, unknown>> | undefined): void {\n\t\tfor (const [id, raw] of Object.entries(values ?? {})) {\n\t\t\tconst d = this.decls[id];\n\t\t\tif ((d as any)?.__kind !== 'context') continue;\n\t\t\td.value = this.coerceToDeclarationValue(d.baseType, d.cardinality, raw, d.identifier);\n\t\t}\n\t}\n\n\t/** Test-supplied template defaults; identifiers that are not template variables are ignored. */\n\tprivate applyTemplateDefaults(values: Readonly<Record<string, unknown>> | undefined): void {\n\t\tfor (const [id, raw] of Object.entries(values ?? {})) {\n\t\t\tconst d = this.decls[id];\n\t\t\tif (!d?.isTemplate) continue;\n\t\t\td.defaultValue = this.coerceToDeclarationValue(d.baseType, d.cardinality, raw, d.identifier);\n\t\t\td.value = d.defaultValue;\n\t\t}\n\t}\n\n\tprivate applySerializedVariables(vars: Record<string, SerializedItemSessionVariable>): void {\n\t\tapplySerializedVariables(this, vars);\n\t}\n\n\tprivate serializeItemSession(): SerializedItemSessionState {\n\t\treturn serializeItemSession(this);\n\t}\n\n\t/** @internal Value forms shared with PCI hosts and the serializer. */\n\tqtiValueToPci(value: QtiValue | undefined): unknown {\n\t\treturn qtiValueToPci(value);\n\t}\n\n\t/** @internal */\n\tqtiValueToPublic(value: QtiValue | undefined): any {\n\t\treturn qtiValueToPublic(value);\n\t}\n\n\t/** @internal Response processing runs start by bringing the duration variable current. */\n\tupdateDuration(): void {\n\t\tupdateDuration(this);\n\t}\n\n\tprivate freezeDuration(): number {\n\t\treturn freezeDuration(this);\n\t}\n\n\t/** Time on task in whole milliseconds, as the host-facing session fields report it. */\n\tprivate getDuration(): number {\n\t\treturn this.durationMs;\n\t}\n\n\t/** Raw values read as a declaration's QTI base type and cardinality; see declarations/declarationValues. */\n\tprivate coerceToDeclarationValue(\n\t\tbaseType: BaseType | undefined,\n\t\tcardinality: Cardinality,\n\t\traw: unknown,\n\t\tidentifier?: string,\n\t): QtiValue {\n\t\treturn coerceToDeclarationValue({ itemDocument: this.itemDocument }, baseType, cardinality, raw, identifier);\n\t}\n\n\n\t// ----------------------------------------------------------------------------\n\t// Item content pass: printedVariable, feedback, templates\n\t// ----------------------------------------------------------------------------\n\n\tprivate contentHandlers({ feedback = true }: { feedback?: boolean } = {}): ContentHandlers {\n\t\treturn contentHandlers(this, { feedback });\n\t}\n\n\t/** @internal Scoring resolves the attempt's active modal feedback. */\n\tgetModalFeedback(outcomes: Record<string, any>): ModalFeedback[] {\n\t\treturn modalFeedbackOf(this, this.contentHandlers(), outcomes);\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Module-level helpers\n// ---------------------------------------------------------------------------\n\nfunction mergePnp(base: PnpProfile | undefined, partial: Partial<PnpProfile>): PnpProfile {\n\treturn {\n\t\tdisplay: { ...(base?.display ?? {}), ...(partial.display ?? {}) },\n\t\tcontent: { ...(base?.content ?? {}), ...(partial.content ?? {}) },\n\t\tcognitive: { ...(base?.cognitive ?? {}), ...(partial.cognitive ?? {}) },\n\t\t...(base?.tools || partial.tools ? { tools: { ...(base?.tools ?? {}), ...(partial.tools ?? {}) } } : {}),\n\t};\n}\n\nfunction createSessionGuid(): string {\n\t// `Crypto` is typed as always providing `randomUUID`, but it is restricted to secure\n\t// contexts and so is genuinely absent when the player is served over plain HTTP.\n\t// Reading through a `Partial<Crypto>` keeps TypeScript from narrowing the fallback\n\t// branch to `never` on the strength of a type that overstates what is available.\n\tconst webCrypto: Partial<Crypto> | undefined = typeof crypto !== 'undefined' ? crypto : undefined;\n\n\tif (typeof webCrypto?.randomUUID === 'function') {\n\t\treturn webCrypto.randomUUID();\n\t}\n\t// `getRandomValues` carries no secure-context restriction and offers the same entropy\n\t// guarantee, so it covers the plain-HTTP case. The previous fallback here used\n\t// `Math.random()`, which is not a CSPRNG and left session GUIDs predictable in\n\t// exactly the environments that reached it.\n\tif (typeof webCrypto?.getRandomValues === 'function') {\n\t\tconst bytes = new Uint8Array(16);\n\t\twebCrypto.getRandomValues(bytes);\n\t\tconst hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');\n\t\treturn `item-session-${hex}`;\n\t}\n\tthrow new Error(\n\t\t'No Web Crypto API available: cannot generate a session GUID. @pie-qti/item-player ' +\n\t\t\t'requires crypto.randomUUID or crypto.getRandomValues (present in all supported ' +\n\t\t\t'browsers and in Node >= 20).',\n\t);\n}\n\n"]}