@pie-qti/player-elements 0.1.24 → 0.1.25
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/dist/ItemToolBar-d36g3aw4-B6TGPyKt.js +3079 -0
- package/dist/ItemToolBar-d36g3aw4-B6TGPyKt.js.map +1 -0
- package/dist/{define-D7_K0JFy.js → define-D80uAEx4.js} +1902 -4395
- package/dist/define-D80uAEx4.js.map +1 -0
- package/dist/dist-BSG0NOza.js +229 -0
- package/dist/dist-BSG0NOza.js.map +1 -0
- package/dist/{dist-ffJZTPTU.js → dist-C8BDh5vZ.js} +987 -707
- package/dist/dist-C8BDh5vZ.js.map +1 -0
- package/dist/dist-CQel8-vi.js +2507 -0
- package/dist/dist-CQel8-vi.js.map +1 -0
- package/dist/{dist-BaQdJU08.js → dist-L-bDDBry.js} +116 -103
- package/dist/dist-L-bDDBry.js.map +1 -0
- package/dist/{element-DSCNeDLu.js → element-C5rTAwch.js} +2 -2
- package/dist/{element-DSCNeDLu.js.map → element-C5rTAwch.js.map} +1 -1
- package/dist/{element-class-DQy2cIPM-CldZrSRR.js → element-class-B_qAd8ET-DGj15cBY.js} +5124 -4448
- package/dist/element-class-B_qAd8ET-DGj15cBY.js.map +1 -0
- package/dist/elements.js +3 -3
- package/dist/index.js +2 -2
- package/dist/item-toolbar-element-BgqPFwsS.js +1990 -0
- package/dist/item-toolbar-element-BgqPFwsS.js.map +1 -0
- package/dist/{language-tags-DVlRltrl.js → language-tags-BwFWXo71.js} +3 -3
- package/dist/{language-tags-DVlRltrl.js.map → language-tags-BwFWXo71.js.map} +1 -1
- package/dist/{nl-NL-BeQBX6yq.js → nl-NL-BRA_1Wcl.js} +5 -3
- package/dist/nl-NL-BRA_1Wcl.js.map +1 -0
- package/dist/pie-DwmznDHb.js +363 -0
- package/dist/pie-DwmznDHb.js.map +1 -0
- package/dist/pie-assessment-toolkit-Cruxm385.js +5 -0
- package/dist/pie-assessment-toolkit-Cruxm385.js.map +1 -0
- package/dist/pie-assessment-toolkit-DJfg6laX.js +5 -0
- package/dist/pie-assessment-toolkit-DJfg6laX.js.map +1 -0
- package/dist/{pie-assessment-toolkit-element-CpiB3twr.js → pie-assessment-toolkit-element-CT5UuvVY.js} +1364 -1203
- package/dist/pie-assessment-toolkit-element-CT5UuvVY.js.map +1 -0
- package/dist/pie-tool-calculator-Crfk-IZe.js +378 -0
- package/dist/pie-tool-calculator-Crfk-IZe.js.map +1 -0
- package/dist/{provider-Y5PhmTAu.js → provider-gBXlGb0d.js} +3 -3
- package/dist/{provider-Y5PhmTAu.js.map → provider-gBXlGb0d.js.map} +1 -1
- package/dist/register-players.js +1 -1
- package/dist/register.js +10246 -9664
- package/dist/register.js.map +1 -1
- package/dist/{resolveItems-D8DJkv-4.js → resolveItems-CNMvD8LP.js} +2 -2
- package/dist/{resolveItems-D8DJkv-4.js.map → resolveItems-CNMvD8LP.js.map} +1 -1
- package/dist/{root-DSkIM1v3.js → root-dCY6j_Hh.js} +3 -3
- package/dist/{root-DSkIM1v3.js.map → root-dCY6j_Hh.js.map} +1 -1
- package/dist/tag-names-DZGvnAgd.js +2495 -0
- package/dist/tag-names-DZGvnAgd.js.map +1 -0
- package/dist/{tool-tts-inline-B71NTBbb.js → tool-tts-inline-k3hLJUfp.js} +1315 -1303
- package/dist/tool-tts-inline-k3hLJUfp.js.map +1 -0
- package/package.json +8 -8
- package/dist/define-D7_K0JFy.js.map +0 -1
- package/dist/dist-BRTWr852.js +0 -5809
- package/dist/dist-BRTWr852.js.map +0 -1
- package/dist/dist-BaQdJU08.js.map +0 -1
- package/dist/dist-DwvskOs6.js +0 -220
- package/dist/dist-DwvskOs6.js.map +0 -1
- package/dist/dist-ffJZTPTU.js.map +0 -1
- package/dist/element-class-DQy2cIPM-CldZrSRR.js.map +0 -1
- package/dist/item-toolbar-element-BW9Y_n5x.js +0 -1990
- package/dist/item-toolbar-element-BW9Y_n5x.js.map +0 -1
- package/dist/nl-NL-BeQBX6yq.js.map +0 -1
- package/dist/pie-assessment-toolkit-element-CpiB3twr.js.map +0 -1
- package/dist/pie-tool-calculator-BiWMTJe7.js +0 -2992
- package/dist/pie-tool-calculator-BiWMTJe7.js.map +0 -1
- package/dist/tool-tts-inline-B71NTBbb.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie-DwmznDHb.js","names":["logger","logger","logger","logger","logger","logger","logger","logger","logger","customEvent","logger"],"sources":["../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/config/profile.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/instrumentation/providers/BaseInstrumentationProvider.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/instrumentation/providers/NewRelicInstrumentationProvider.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/instrumentation/provider-guards.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/loader-config.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/types.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/types/index.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/logger.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/scoring.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/initialize-element.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/math-rendering.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/updates.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/initialization.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/element-observer.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/asset-handler.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/authoring.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/instrumentation-event-bridge.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/instrumentation-provider-resolution.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/stages.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/stage-tracker.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/item-session-contract.js","../../../node_modules/.bun/@pie-players+pie-players-shared@0.3.73/node_modules/@pie-players/pie-players-shared/dist/pie/overrides.js"],"sourcesContent":["/**\n * Minimal, frontend-safe defaults for PIE build service URLs.\n *\n * In PIEOneer, these come from `$env/dynamic/public`. In `pie-players` we avoid\n * SvelteKit env dependencies so this can be consumed by any bundler.\n */\n// Default public bundle host. Keep this aligned with the IIFE loader default.\n// (We prefer the proxy endpoint, which is stable/cached for browser usage.)\nconst DEFAULT_BUILDER_ORIGIN_URL = \"https://proxy.pie-api.com\";\nconst DEFAULT_BUILDER_BUNDLE_URL = `${DEFAULT_BUILDER_ORIGIN_URL}/bundles/`;\nfunction readPublicEnv(key) {\n try {\n // Vite/SvelteKit-like\n const v = import.meta?.env?.[key];\n if (typeof v === \"string\" && v.length > 0)\n return v;\n }\n catch { }\n return undefined;\n}\nexport const BUILDER_ORIGIN_URL = (typeof window !== \"undefined\" && window.PIE_BUILDER_ORIGIN_URL) ||\n readPublicEnv(\"PUBLIC_BUILDER_ORIGIN_URL\") ||\n DEFAULT_BUILDER_ORIGIN_URL;\nexport const BUILDER_BUNDLE_URL = (typeof window !== \"undefined\" && window.PIE_BUILDER_BUNDLE_URL) ||\n readPublicEnv(\"PUBLIC_BUILDER_BUNDLE_URL\") ||\n DEFAULT_BUILDER_BUNDLE_URL;\n","/**\n * Base Instrumentation Provider\n *\n * Abstract base class that implements common instrumentation logic for all providers.\n * Provides a template method pattern for tracking errors and events with consistent\n * filtering, transformation, and sampling behavior.\n *\n * Concrete providers only need to implement the actual tracking methods specific\n * to their instrumentation backend (New Relic, DataDog, etc.)\n */\n/**\n * Abstract base class for instrumentation providers\n *\n * Implements the template method pattern:\n * 1. Checks if provider is ready\n * 2. Applies filters (errorFilter, eventFilter)\n * 3. Applies sampling (sampleRate)\n * 4. Transforms attributes (attributeTransformer)\n * 5. Delegates to concrete provider implementation (doTrackError, doTrackEvent, etc.)\n */\nexport class BaseInstrumentationProvider {\n initialized = false;\n config;\n // ============================================================================\n // Public API methods (template methods)\n // ============================================================================\n /**\n * Track an error with the instrumentation provider\n *\n * Template method that:\n * 1. Checks if provider is ready\n * 2. Applies error filter if configured\n * 3. Transforms attributes if configured\n * 4. Delegates to concrete provider implementation (doTrackError)\n *\n * @param error The error to track\n * @param attributes Contextual attributes\n */\n trackError(error, attributes) {\n // Guard: check if provider is ready\n if (!this.guardedOperation(\"trackError\", error, attributes)) {\n return;\n }\n // Apply error filter\n if (!this.applyErrorFilter(error, attributes)) {\n return;\n }\n // Transform attributes\n const finalAttributes = this.transformAttributes(attributes);\n // Delegate to concrete provider\n try {\n this.doTrackError(error, finalAttributes);\n if (this.config?.debug) {\n console.log(`[${this.providerName}] Tracked error:`, error, finalAttributes);\n }\n }\n catch (err) {\n console.error(`[${this.providerName}] Error tracking error:`, err);\n }\n }\n /**\n * Track a custom event with the instrumentation provider\n *\n * Template method that:\n * 1. Checks if provider is ready\n * 2. Applies event filter if configured\n * 3. Applies sampling if configured\n * 4. Transforms attributes if configured\n * 5. Adds timestamp if not present\n * 6. Delegates to concrete provider implementation (doTrackEvent)\n *\n * @param eventName Name of the event\n * @param attributes Event attributes\n */\n trackEvent(eventName, attributes) {\n // Guard: check if provider is ready\n if (!this.guardedOperation(\"trackEvent\", eventName, attributes)) {\n return;\n }\n // Apply event filter\n if (!this.applyEventFilter(eventName, attributes)) {\n return;\n }\n // Apply sampling\n if (!this.applySampling(eventName)) {\n return;\n }\n // Transform attributes\n let finalAttributes = this.transformAttributes(attributes);\n // Add timestamp if not present\n if (!finalAttributes.timestamp) {\n finalAttributes = {\n ...finalAttributes,\n timestamp: new Date().toISOString(),\n };\n }\n // Delegate to concrete provider\n try {\n this.doTrackEvent(eventName, finalAttributes);\n if (this.config?.debug) {\n console.log(`[${this.providerName}] Tracked event:`, eventName, finalAttributes);\n }\n }\n catch (err) {\n console.error(`[${this.providerName}] Error tracking event:`, err);\n }\n }\n /**\n * Track a performance metric\n *\n * Default implementation tracks metrics as events with a `metric:` prefix.\n * Concrete providers can override this method if their backend has a\n * dedicated metric API.\n *\n * @param metricName Name of the metric\n * @param value Numeric value\n * @param attributes Optional metric attributes\n */\n trackMetric(metricName, value, attributes) {\n // Default implementation: track as event\n this.trackEvent(`metric:${metricName}`, {\n ...attributes,\n metricValue: value,\n metricName,\n });\n }\n /**\n * Set user context for session tracking\n *\n * Template method that checks if provider is ready then delegates\n * to concrete provider implementation.\n *\n * @param userId User identifier\n * @param attributes Optional user attributes\n */\n setUserContext(userId, attributes) {\n // Guard: check if provider is ready\n if (!this.guardedOperation(\"setUserContext\", userId, attributes)) {\n return;\n }\n // Delegate to concrete provider\n try {\n this.doSetUserContext(userId, attributes);\n if (this.config?.debug) {\n console.log(`[${this.providerName}] Set user context:`, userId, attributes);\n }\n }\n catch (err) {\n console.error(`[${this.providerName}] Error setting user context:`, err);\n }\n }\n /**\n * Set global custom attributes\n *\n * Template method that checks if provider is ready then delegates\n * to concrete provider implementation.\n *\n * @param attributes Attributes to set globally\n */\n setGlobalAttributes(attributes) {\n // Guard: check if provider is ready\n if (!this.guardedOperation(\"setGlobalAttributes\", attributes)) {\n return;\n }\n // Delegate to concrete provider\n try {\n this.doSetGlobalAttributes(attributes);\n if (this.config?.debug) {\n console.log(`[${this.providerName}] Set global attributes:`, attributes);\n }\n }\n catch (err) {\n console.error(`[${this.providerName}] Error setting global attributes:`, err);\n }\n }\n // ============================================================================\n // Protected utility methods (shared logic)\n // ============================================================================\n /**\n * Guard operation - check if provider is ready\n *\n * Returns false if provider is not ready, logging a warning in debug mode.\n *\n * @param operation Name of the operation for logging\n * @param args Arguments for logging\n * @returns true if provider is ready, false otherwise\n */\n guardedOperation(operation, ...args) {\n if (!this.isReady()) {\n if (this.config?.debug) {\n console.warn(`[${this.providerName}] Attempted to ${operation} but provider not ready:`, ...args);\n }\n return false;\n }\n return true;\n }\n /**\n * Apply error filter if configured\n *\n * Returns false if error should be filtered out, logging in debug mode.\n *\n * @param error The error\n * @param attributes Error attributes\n * @returns true if error should be tracked, false if filtered out\n */\n applyErrorFilter(error, attributes) {\n if (this.config?.errorFilter &&\n !this.config.errorFilter(error, attributes)) {\n if (this.config?.debug) {\n console.log(`[${this.providerName}] Error filtered out:`, error, attributes);\n }\n return false;\n }\n return true;\n }\n /**\n * Apply event filter if configured\n *\n * Returns false if event should be filtered out, logging in debug mode.\n *\n * @param eventName Event name\n * @param attributes Event attributes\n * @returns true if event should be tracked, false if filtered out\n */\n applyEventFilter(eventName, attributes) {\n if (this.config?.eventFilter &&\n !this.config.eventFilter(eventName, attributes)) {\n if (this.config?.debug) {\n console.log(`[${this.providerName}] Event filtered out:`, eventName, attributes);\n }\n return false;\n }\n return true;\n }\n /**\n * Apply sampling if configured\n *\n * Returns false if event should be sampled out, logging in debug mode.\n *\n * @param eventName Event name for logging\n * @returns true if event should be tracked, false if sampled out\n */\n applySampling(eventName) {\n if (this.config?.sampleRate !== undefined && this.config.sampleRate < 1.0) {\n if (Math.random() > this.config.sampleRate) {\n if (this.config?.debug) {\n console.log(`[${this.providerName}] Event sampled out:`, eventName);\n }\n return false;\n }\n }\n return true;\n }\n /**\n * Transform attributes if transformer is configured\n *\n * @param attributes Original attributes\n * @returns Transformed attributes or original if no transformer\n */\n transformAttributes(attributes) {\n if (this.config?.attributeTransformer) {\n return this.config.attributeTransformer(attributes);\n }\n return attributes;\n }\n}\n","/**\n * New Relic Instrumentation Provider\n *\n * Default provider for existing New Relic Browser Agent instrumentation.\n *\n * This provider wraps the global `window.newrelic` object provided by\n * the New Relic Browser Agent.\n *\n * @example\n * ```typescript\n * const provider = new NewRelicInstrumentationProvider();\n * await provider.initialize();\n *\n * if (provider.isReady()) {\n * provider.trackError(new Error('Something went wrong'), {\n * component: 'my-component',\n * errorType: 'ValidationError'\n * });\n * }\n * ```\n */\nimport { BaseInstrumentationProvider } from \"./BaseInstrumentationProvider.js\";\nexport class NewRelicInstrumentationProvider extends BaseInstrumentationProvider {\n providerId = \"newrelic\";\n providerName = \"New Relic\";\n /**\n * Initialize the New Relic provider\n *\n * Checks if the New Relic Browser Agent is available via `window.newrelic`.\n * If not available, initialization succeeds but `isReady()` will return false.\n *\n * @param config Optional configuration\n */\n async initialize(config) {\n this.config = config;\n // Check if New Relic is available\n if (typeof window !== \"undefined\" && window.newrelic) {\n this.initialized = true;\n if (this.config?.debug) {\n console.log(\"[NewRelicProvider] Initialized successfully\");\n }\n }\n else {\n if (this.config?.debug) {\n console.warn(\"[NewRelicProvider] New Relic not available (window.newrelic not found)\");\n }\n // Don't throw - allow graceful degradation\n this.initialized = false;\n }\n }\n /**\n * Check if provider is ready\n *\n * @returns true if New Relic is available and initialized\n */\n isReady() {\n return (this.initialized &&\n typeof window !== \"undefined\" &&\n !!window.newrelic);\n }\n /**\n * Cleanup provider resources\n *\n * Marks provider as uninitialized. The global `window.newrelic` object\n * is not modified.\n */\n destroy() {\n this.initialized = false;\n if (this.config?.debug) {\n console.log(\"[NewRelicProvider] Destroyed\");\n }\n }\n /**\n * Track an error with New Relic\n *\n * Calls `newrelic.noticeError(error, attributes)`\n *\n * @param error The error to track\n * @param attributes Transformed attributes (already filtered and transformed by base class)\n */\n doTrackError(error, attributes) {\n const newrelic = window.newrelic;\n newrelic.noticeError(error, attributes);\n }\n /**\n * Track a custom event/page action with New Relic\n *\n * Calls `newrelic.addPageAction(eventName, attributes)`\n *\n * @param eventName Name of the event\n * @param attributes Transformed attributes (already filtered and transformed by base class)\n */\n doTrackEvent(eventName, attributes) {\n const newrelic = window.newrelic;\n newrelic.addPageAction(eventName, attributes);\n }\n /**\n * Set user context for session tracking\n *\n * Calls `newrelic.setUserId()` and `newrelic.setCustomAttribute()` for user attributes.\n *\n * @param userId User identifier\n * @param attributes Optional user attributes\n */\n doSetUserContext(userId, attributes) {\n const newrelic = window.newrelic;\n // Set user ID if method exists\n if (newrelic.setUserId) {\n newrelic.setUserId(userId);\n }\n // Set custom attributes for user\n if (attributes && newrelic.setCustomAttribute) {\n for (const [key, value] of Object.entries(attributes)) {\n newrelic.setCustomAttribute(key, value);\n }\n }\n }\n /**\n * Set global custom attributes\n *\n * Calls `newrelic.setCustomAttribute()` for each attribute.\n *\n * @param attributes Attributes to set globally\n */\n doSetGlobalAttributes(attributes) {\n const newrelic = window.newrelic;\n if (newrelic.setCustomAttribute) {\n for (const [key, value] of Object.entries(attributes)) {\n newrelic.setCustomAttribute(key, value);\n }\n }\n }\n}\n","export function isInstrumentationProvider(value) {\n if (!value || typeof value !== \"object\")\n return false;\n const candidate = value;\n return (typeof candidate.providerId === \"string\" &&\n typeof candidate.providerName === \"string\" &&\n typeof candidate.initialize === \"function\" &&\n typeof candidate.trackError === \"function\" &&\n typeof candidate.trackEvent === \"function\" &&\n typeof candidate.destroy === \"function\" &&\n typeof candidate.isReady === \"function\");\n}\n","/**\n * Shared loader configuration for PIE custom elements.\n *\n * Mirrors the `LoaderConfig` used by PIEOneer's custom element tags.\n */\nexport const DEFAULT_IIFE_BUNDLE_RETRY_CONFIG = {\n retryDelayMs: 3000,\n timeoutMs: 120000,\n};\nexport const DEFAULT_LOADER_CONFIG = {\n trackPageActions: false,\n instrumentationProvider: undefined,\n maxResourceRetries: 3,\n resourceRetryDelay: 500,\n iifeBundleRetry: DEFAULT_IIFE_BUNDLE_RETRY_CONFIG,\n};\n","/**\n * PIE Types Module\n *\n * Pure type definitions, interfaces, and enums used across PIE utilities.\n * This module has NO runtime dependencies on other PIE modules.\n */\n/**\n * PIE bundle types\n */\nexport var BundleType;\n(function (BundleType) {\n BundleType[\"player\"] = \"player.js\";\n BundleType[\"clientPlayer\"] = \"client-player.js\";\n BundleType[\"editor\"] = \"editor.js\";\n})(BundleType || (BundleType = {}));\n/**\n * Internal PIE registry entry status\n */\nexport var Status;\n(function (Status) {\n Status[\"loading\"] = \"loading\";\n Status[\"loaded\"] = \"loaded\";\n})(Status || (Status = {}));\n/**\n * Default options for updatePieElement\n */\nexport const defaultPieElementOptions = {\n invokeControllerForModel: true,\n env: { mode: \"gather\", role: \"student\", partialScoring: false },\n eventListeners: {},\n};\n/**\n * Type guard: Check if object has window.pie\n */\nexport function isPieAvailable(obj) {\n return obj && typeof obj.pie === \"object\";\n}\n/**\n * Type guard: Check if object is a CustomElementConstructor\n */\nexport function isCustomElementConstructor(obj) {\n return (typeof obj === \"function\" &&\n \"prototype\" in obj &&\n obj.prototype instanceof HTMLElement);\n}\n/**\n * Type guard: Check if window has PIE_REGISTRY\n */\nexport function isPieRegistryAvailable(obj) {\n return obj && typeof obj.PIE_REGISTRY === \"object\";\n}\n","export var SessionEventType;\n(function (SessionEventType) {\n SessionEventType[\"SAVE\"] = \"save\";\n SessionEventType[\"MODEL\"] = \"model\";\n SessionEventType[\"SCORE\"] = \"score\";\n SessionEventType[\"MANUAL_SCORE\"] = \"manual-score\";\n})(SessionEventType || (SessionEventType = {}));\nexport var ScoreType;\n(function (ScoreType) {\n ScoreType[\"AUTO\"] = \"auto\";\n ScoreType[\"MANUAL\"] = \"manual\";\n})(ScoreType || (ScoreType = {}));\nexport var ModeType;\n(function (ModeType) {\n ModeType[\"GATHER\"] = \"gather\";\n ModeType[\"VIEW\"] = \"view\";\n ModeType[\"EVALUATE\"] = \"evaluate\";\n})(ModeType || (ModeType = {}));\nexport var SanctionedVersionChangeStatus;\n(function (SanctionedVersionChangeStatus) {\n SanctionedVersionChangeStatus[\"PENDING\"] = \"pending\";\n SanctionedVersionChangeStatus[\"IN_PROGRESS\"] = \"in_progress\";\n SanctionedVersionChangeStatus[\"COMPLETED\"] = \"completed\";\n SanctionedVersionChangeStatus[\"FAILED\"] = \"failed\";\n})(SanctionedVersionChangeStatus || (SanctionedVersionChangeStatus = {}));\n/**\n * During the loading of elements from PIE bundles, we do a trick where we make\n * editor components available as web components by appending this to the element name.\n */\nexport const editorPostFix = \"-pie-editor--\";\nexport class ModelUpdatedEvent extends CustomEvent {\n update;\n reset;\n static TYPE = \"model.updated\";\n constructor(update, reset = false) {\n super(ModelUpdatedEvent.TYPE, { bubbles: true, detail: { update, reset } });\n this.update = update;\n this.reset = reset;\n }\n}\nexport class DeleteImageEvent extends CustomEvent {\n src;\n done;\n static TYPE = \"delete.image\";\n constructor(src, done) {\n super(DeleteImageEvent.TYPE, { bubbles: true, detail: { src, done } });\n this.src = src;\n this.done = done;\n }\n}\nexport class InsertImageEvent extends CustomEvent {\n handler;\n static TYPE = \"insert.image\";\n constructor(handler) {\n super(InsertImageEvent.TYPE, { bubbles: true, detail: handler });\n this.handler = handler;\n }\n}\nexport class DeleteSoundEvent extends CustomEvent {\n src;\n done;\n static TYPE = \"delete.sound\";\n constructor(src, done) {\n super(DeleteSoundEvent.TYPE, { bubbles: true, detail: { src, done } });\n this.src = src;\n this.done = done;\n }\n}\nexport class InsertSoundEvent extends CustomEvent {\n handler;\n static TYPE = \"insert.sound\";\n constructor(handler) {\n super(InsertSoundEvent.TYPE, { bubbles: true, detail: handler });\n this.handler = handler;\n }\n}\nexport const isPassageEntity = (passage) => typeof passage === \"object\" && passage !== null;\nexport function isPrerelease(version) {\n return (typeof version === \"object\" &&\n version !== null &&\n typeof version.major === \"number\" &&\n typeof version.minor === \"number\" &&\n typeof version.patch === \"number\" &&\n !!version.prerelease && // Check if prerelease exists\n typeof version.prerelease.tag === \"string\" &&\n typeof version.prerelease.version === \"number\");\n}\nexport function formatVersion(semVer) {\n if (!semVer)\n return \"\";\n const base = [semVer.major, semVer.minor, semVer.patch].join(\".\");\n if (isPrerelease(semVer) && semVer.prerelease) {\n const prerelease = [semVer.prerelease.tag, semVer.prerelease.version].join(\".\");\n return `${base}-${prerelease}`;\n }\n return base;\n}\nexport class SessionChangedEvent extends CustomEvent {\n component;\n complete;\n static TYPE = \"session-changed\";\n constructor(component, complete) {\n super(SessionChangedEvent.TYPE, {\n bubbles: true,\n composed: true,\n detail: { complete, component },\n });\n this.component = component;\n this.complete = complete;\n }\n}\n// CMS Types (copied from @pie-api-aws/datastore to avoid importing server-only package)\nexport var StandardType;\n(function (StandardType) {\n StandardType[StandardType[\"ROOT\"] = 0] = \"ROOT\";\n StandardType[StandardType[\"SUBJECT\"] = 1] = \"SUBJECT\";\n StandardType[StandardType[\"LEVEL\"] = 2] = \"LEVEL\";\n StandardType[StandardType[\"STANDARD\"] = 3] = \"STANDARD\";\n})(StandardType || (StandardType = {}));\n","/**\n * PIE Logger Utility\n *\n * Simple, efficient logging for PIE players with debug mode support.\n * Uses browser console methods (debug, info, warn, error) which can be\n * filtered natively in browser dev tools.\n *\n * Usage:\n * ```typescript\n * const logger = createPieLogger('pie-item-player', debug);\n * logger.debug('Detailed debug info', data); // Only shown if debug=true\n * logger.info('Important production info'); // Always shown\n * logger.warn('Warning message'); // Always shown\n * logger.error('Error occurred', error); // Always shown\n * ```\n */\n/**\n * Create a PIE logger instance\n *\n * @param namespace - Component name for log prefixing (e.g., 'pie-item-player')\n * @param debugEnabledFn - Function that returns whether debug logs should be shown (checked dynamically on each call)\n * @returns Logger instance with debug, info, warn, error methods\n */\nexport function createPieLogger(namespace, debugEnabledFn) {\n const prefix = `[${namespace}]`;\n return {\n // Only debug method checks debugEnabledFn - it's checked dynamically on every call\n debug: (message, ...args) => {\n if (debugEnabledFn()) {\n console.debug(prefix, message, ...args);\n }\n },\n // info, warn, error always log (not gated by debug flag)\n info: (message, ...args) => console.info(prefix, message, ...args),\n warn: (message, ...args) => console.warn(prefix, message, ...args),\n error: (message, ...args) => console.error(prefix, message, ...args),\n };\n}\n/**\n * Check if debug mode is enabled globally\n */\nexport function isGlobalDebugEnabled() {\n return typeof window !== \"undefined\" && window.PIE_DEBUG === true;\n}\n","/**\n * PIE Scoring Module\n *\n * Scoring and outcome calculation for PIE elements.\n */\nimport { createPieLogger, isGlobalDebugEnabled } from \"./logger.js\";\nimport { pieRegistry } from \"./registry.js\";\nimport { BundleType } from \"./types.js\";\nimport { findOrAddSession } from \"./utils.js\";\n// Create module-level logger (respects global debug flag - pass function for dynamic checking)\nconst logger = createPieLogger(\"pie-scoring\", () => isGlobalDebugEnabled());\n/**\n * Find the controller for a PIE element\n */\nexport const findPieController = (elementName) => {\n const registry = pieRegistry();\n logger.debug(`[findPieController] Looking for controller for: ${elementName}`);\n logger.debug(`[findPieController] Registry has entries for:`, Object.keys(registry));\n const entry = registry[elementName];\n if (!entry) {\n logger.error(`[findPieController] ❌ No registry entry found for element: ${elementName}`);\n logger.error(`[findPieController] Available element names:`, Object.keys(registry));\n logger.error(`[findPieController] Full registry:`, registry);\n return undefined;\n }\n logger.debug(`[findPieController] Found registry entry for ${elementName}:`, {\n package: entry.package,\n tagName: entry.tagName,\n hasController: !!entry.controller,\n controllerKeys: entry.controller ? Object.keys(entry.controller) : [],\n bundleType: entry.bundleType,\n });\n const controller = entry.controller;\n if (!controller) {\n // Check if missing controller is expected based on bundle type\n if (entry.bundleType === BundleType.clientPlayer) {\n // client-player.js MUST have controllers\n logger.error(`[findPieController] ❌ CRITICAL: Registry entry exists for ${elementName} but controller is missing!`);\n logger.error(`[findPieController] Bundle type: ${entry.bundleType} (controllers required)`);\n logger.error(`[findPieController] Entry:`, entry);\n throw new Error(`No controller found for ${elementName}. client-player.js bundles MUST include controllers. Check bundle loading and registration.`);\n }\n else {\n // player.js doesn't have controllers - this is expected\n logger.debug(`[findPieController] ℹ️ No controller for ${elementName} - using server-processed models (player.js bundle)`);\n }\n }\n else {\n logger.debug(`[findPieController] ✅ Controller found for ${elementName} with functions:`, Object.keys(controller));\n }\n return controller;\n};\nconst escapeAttributeSelectorValue = (value) => value\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\"/g, '\\\\\"')\n .replace(/\\n/g, \"\\\\a \")\n .replace(/\\r/g, \"\\\\d \");\nconst findRenderedPieElement = (root, modelId) => {\n const escapedId = escapeAttributeSelectorValue(modelId);\n return (root.querySelector(`[id=\"${escapedId}\"]`) ||\n root.querySelector(`[pie-id=\"${escapedId}\"]`));\n};\nconst invokeOutcome = async (controller, model, session, env, argumentShape) => {\n if (argumentShape === \"model-session-env\") {\n const outcome = controller.outcome;\n return outcome.call(controller, model, session, env);\n }\n const outcome = controller.outcome;\n return outcome.call(controller, session, env);\n};\n/**\n * Score a PIE item by calling outcome on all PIE elements\n */\nexport async function scorePieItem(config, sessionData, options = {}) {\n const root = options.container ?? document;\n const models = options.models ?? config.models ?? [];\n const outcomeArguments = options.outcomeArguments ?? \"session-env\";\n const scoringEnv = {\n ...options.env,\n mode: \"evaluate\",\n partialScoring: options.env?.partialScoring,\n };\n const r = await Promise.all(models.map(async (model) => {\n const pieEl = findRenderedPieElement(root, model.id);\n logger.debug(\"found pieEl %O for model id %s\", pieEl, model.id);\n const session = findOrAddSession(sessionData, model.id, model.element);\n if (pieEl) {\n const controller = findPieController(pieEl.localName);\n if (controller?.outcome) {\n return {\n ...session,\n ...(await invokeOutcome(controller, model, session, scoringEnv, outcomeArguments)),\n };\n }\n else {\n logger.debug(\"ignore %s (no controller)\", pieEl.localName);\n }\n }\n else {\n logger.debug(\"ignore %s (no element found for %s)\", model.id);\n }\n return undefined;\n }));\n logger.debug(\"scorePieItem result\", r);\n return {\n results: options.includeMissingResults\n ? r\n : r.filter(Boolean),\n };\n}\n","/**\n * Binding a single PIE element to its model and session.\n *\n * Split out of `initialization.ts` so the late-arrival observer in\n * `element-observer.ts` can reuse it without importing the bundle loaders.\n */\nimport { wrapModelRichContent } from \"../security/wrap-model-rich-content.js\";\nimport { createPieLogger, isGlobalDebugEnabled } from \"./logger.js\";\nimport { pieRegistry } from \"./registry.js\";\nimport { findPieController } from \"./scoring.js\";\nimport { BundleType } from \"./types.js\";\nimport { findOrAddSession } from \"./utils.js\";\nconst logger = createPieLogger(\"pie-initialize-element\", () => isGlobalDebugEnabled());\n/**\n * Bind `element` to the model in `options.config` whose `id` matches it.\n *\n * Returns whether the element is bound: `true` once a model has been applied\n * (including on a repeat call for an element that is already bound), `false`\n * when the config carries no model for this `id`. A caller holding several\n * configs — an item player registers its item config and its passage config\n * separately — uses that to stop at the config the element belongs to.\n */\nexport const initializePieElement = (element, options) => {\n const { config, session, env, eventListeners } = options;\n if (element.__pieInitialized) {\n return true;\n }\n const tagName = element.tagName.toLowerCase();\n logger.debug(`[initializePieElement] Initializing ${tagName}#${element.id}`);\n // Find model for this element\n const model = config?.models?.find((m) => m.id === element.id);\n if (!model) {\n // Only warn if this element is from a client-player.js bundle (where models are expected)\n // player.js bundles use server-processed models, so missing models are expected there\n const registry = pieRegistry();\n const registryEntry = registry[tagName];\n if (registryEntry && registryEntry.bundleType === BundleType.clientPlayer) {\n logger.warn(`[initializePieElement] Model not found for PIE element ${tagName}#${element.id} (client-player.js bundle)`);\n }\n return false;\n }\n // Set session (with element property for updateSession callback)\n const elementSession = findOrAddSession(session, model.id, model.element);\n element.session = elementSession;\n element.__pieInitialized = true;\n logger.debug(`[initializePieElement] Session set for ${tagName}#${element.id}:`, elementSession);\n // Set model - use controller if available (client-player.js), or use server-processed model (player.js)\n const controller = findPieController(tagName);\n if (!env) {\n logger.error(`[initializePieElement] ❌ FATAL: No env provided for ${tagName}`);\n throw new Error(`No env provided for ${tagName}. PIE elements require an env object with mode and role.`);\n }\n if (!controller) {\n // No controller available - using server-processed model (player.js bundle)\n logger.debug(`[initializePieElement] ℹ️ No controller for ${tagName}, using server-processed model`);\n logger.debug(`[initializePieElement] Model already processed by server:`, {\n id: model.id,\n element: model.element,\n hasCorrectResponse: \"correctResponse\" in model,\n mode: env.mode,\n role: env.role,\n });\n // Set model directly - server already processed it\n element.model = wrapModelRichContent(model);\n }\n else {\n // Controller available - run client-side processing (client-player.js bundle)\n // Note: updatePieElementWithRef handles controller invocation\n logger.debug(`[initializePieElement] Controller found for ${tagName}, will invoke model() function`);\n }\n // Add event listeners\n if (eventListeners) {\n Object.entries(eventListeners).forEach(([evt, fn]) => {\n element.addEventListener(evt, fn);\n });\n }\n return true;\n};\n","/**\n * Math rendering bootstrap for PIE players\n *\n * PIE elements expect @pie-lib/math-rendering to be available on window.\n * This module ensures required globals are populated from the upstream\n * @pie-lib/math-rendering-module package, and also supports overriding with\n * a custom renderer object when needed.\n */\n/// <reference path=\"../shims.d.ts\" />\nimport { createPieLogger, isGlobalDebugEnabled } from \"./logger.js\";\nconst GLOBAL_KEY = \"@pie-lib/math-rendering\";\nconst GLOBAL_DLL_KEY = \"_dll_pie_lib__math_rendering\";\nlet initPromise = null;\nconst logger = createPieLogger(\"math-rendering\", () => isGlobalDebugEnabled());\nconst getWindowRenderer = () => {\n if (typeof window === \"undefined\") {\n return null;\n }\n const renderer = window[GLOBAL_KEY];\n return renderer || null;\n};\nconst setWindowRenderer = (renderer) => {\n if (typeof window === \"undefined\")\n return;\n window[GLOBAL_KEY] = renderer;\n window[GLOBAL_DLL_KEY] = renderer;\n};\n/**\n * Initialize math rendering with optional custom renderer\n *\n * If no custom renderer is provided, defaults to MathJax.\n * For custom renderers, use setMathRenderer() before calling this function.\n *\n * Sets TWO window globals that PIE elements expect:\n * - window[\"@pie-lib/math-rendering\"] (standard key)\n * - window[\"_dll_pie_lib__math_rendering\"] (SystemJS/DLL key for IIFE bundles)\n *\n * @param customRenderer - Optional custom renderer to use instead of default MathJax\n *\n * @example\n * ```typescript\n * // Default MathJax\n * await initializeMathRendering();\n *\n * // Custom renderer instance implementing MathRenderingAPI\n * const customRenderer = await createCustomRenderer();\n * await initializeMathRendering(customRenderer);\n *\n * // Or use setMathRenderer first\n * setMathRenderer(katexRenderer);\n * await initializeMathRendering();\n * ```\n */\nexport async function initializeMathRendering(customRenderer) {\n // Only run in browser\n if (typeof window === \"undefined\") {\n return;\n }\n // Explicit override always wins.\n if (customRenderer) {\n setWindowRenderer(customRenderer);\n return;\n }\n // Already initialized - skip.\n if (getWindowRenderer()) {\n return;\n }\n if (initPromise) {\n await initPromise;\n return;\n }\n initPromise = (async () => {\n try {\n const { _dll_pie_lib__math_rendering } = await import(\"@pie-lib/math-rendering-module/module\");\n // A host may install its renderer while the default module is in flight.\n // The explicit renderer remains authoritative when that happens.\n if (!getWindowRenderer()) {\n setWindowRenderer(_dll_pie_lib__math_rendering);\n logger.debug(\"Math rendering module initialized (both globals set)\");\n }\n }\n catch (error) {\n logger.error(\"Failed to initialize math rendering:\", error);\n throw error;\n }\n })();\n try {\n await initPromise;\n }\n finally {\n initPromise = null;\n }\n}\n/**\n * Set custom math renderer programmatically\n *\n * Call this BEFORE initializeMathRendering() or any loader.load() calls\n * to override the default MathJax renderer.\n *\n * @param renderer - The renderer to use\n *\n * @example\n * ```typescript\n * import { setMathRenderer } from '@pie-players/pie-players-shared/pie';\n *\n * const renderer = await createCustomRenderer();\n * setMathRenderer(renderer);\n *\n * // Now load PIE elements - they'll use your custom renderer\n * await loader.load(config, document, needsControllers);\n * ```\n */\nexport function setMathRenderer(renderer) {\n setWindowRenderer(renderer);\n}\n/**\n * Render math in the given element\n *\n * Convenience wrapper that calls the active renderer's renderMath() function.\n * Typically called after PIE elements are rendered.\n *\n * @param element - The element to render math within\n */\nexport function renderMath(element) {\n const renderer = getWindowRenderer();\n if (renderer && typeof renderer.renderMath === \"function\") {\n renderer.renderMath(element);\n }\n}\n","/**\n * PIE Updates Module\n *\n * Functions for updating PIE elements with new models, sessions, and env.\n */\nimport { mergeObjectsIgnoringNullUndefined } from \"../object/index.js\";\nimport { wrapModelRichContent } from \"../security/wrap-model-rich-content.js\";\nimport { createPieLogger, isGlobalDebugEnabled } from \"./logger.js\";\nimport { findPieController } from \"./scoring.js\";\nimport { defaultPieElementOptions } from \"./types.js\";\nimport { findOrAddSession } from \"./utils.js\";\n// Create module-level logger (respects global debug flag - pass function for dynamic checking)\nconst logger = createPieLogger(\"pie-updates\", () => isGlobalDebugEnabled());\nconst describeControllerShape = (controller) => {\n if (!controller)\n return \"missing\";\n if (typeof controller === \"function\")\n return \"function\";\n if (typeof controller !== \"object\")\n return typeof controller;\n const keys = Object.keys(controller);\n const defaultValue = controller.default;\n const defaultKeys = defaultValue && typeof defaultValue === \"object\"\n ? Object.keys(defaultValue)\n : [];\n return defaultKeys.length > 0\n ? `object(keys=[${keys.join(\",\")}],defaultKeys=[${defaultKeys.join(\",\")}])`\n : `object(keys=[${keys.join(\",\")}])`;\n};\nconst resolveControllerModelFunction = (controller) => {\n if (!controller)\n return null;\n if (typeof controller === \"function\") {\n return controller;\n }\n if (typeof controller !== \"object\")\n return null;\n const direct = controller.model;\n if (typeof direct === \"function\") {\n return (model, sessionData, env, updateSession) => direct.call(controller, model, sessionData, env, updateSession);\n }\n const fromDefault = controller.default;\n if (fromDefault && typeof fromDefault === \"object\") {\n const nested = fromDefault.model;\n if (typeof nested === \"function\") {\n return (model, sessionData, env, updateSession) => nested.call(fromDefault, model, sessionData, env, updateSession);\n }\n }\n return null;\n};\nconst emitControllerError = (pieElement, detail) => {\n pieElement.dispatchEvent(new CustomEvent(\"pie-controller-error\", {\n detail,\n bubbles: true,\n composed: true,\n }));\n};\n/**\n * Helper function to apply controller to element\n * Extracted to eliminate duplication and ensure consistent controller invocation\n */\nconst applyControllerToElement = async (element, model, elementSession, controller, env, logPrefix, onElementSessionUpdate) => {\n logger.debug(`${logPrefix} Using controller, env:`, env);\n logger.debug(`${logPrefix} Model before filter:`, {\n id: model.id,\n element: model.element,\n hasCorrectResponse: \"correctResponse\" in model,\n });\n // Create updateSession callback for controller to save derived state (e.g.\n // shuffle order). Mutate the in-flight element session so this render uses it,\n // AND propagate the write to the authoritative session via the host callback\n // so subsequent renders reuse it instead of regenerating it. The write-back is\n // keyed by the canonical model id/element (the entry findOrAddSession resolved),\n // which also tolerates controllers that pass an undefined id/element.\n const updateSession = (id, _elementName, properties) => {\n logger.debug(`${logPrefix} updateSession called for ${id} with:`, properties);\n Object.assign(elementSession, properties);\n onElementSessionUpdate?.(model.id, model.element, properties);\n return Promise.resolve();\n };\n try {\n const modelFunction = resolveControllerModelFunction(controller);\n if (!modelFunction) {\n throw new Error(`Controller contract mismatch: expected a model() function but received ${describeControllerShape(controller)}`);\n }\n const controllerResult = await modelFunction(model, elementSession, env, updateSession);\n // Merge controller result with id and element (like server-side PieControllerExecutor does)\n const controllerResultObject = controllerResult && typeof controllerResult === \"object\"\n ? controllerResult\n : {};\n const filteredModel = {\n id: model.id,\n element: model.element,\n ...controllerResultObject,\n };\n const wrappedModel = wrapModelRichContent(filteredModel);\n logger.debug(`${logPrefix} ✅ Controller filtered model:`, {\n id: wrappedModel.id,\n element: wrappedModel.element,\n hasCorrectResponse: \"correctResponse\" in wrappedModel,\n mode: env.mode,\n role: env.role,\n });\n element.model = wrappedModel;\n element.session = elementSession;\n }\n catch (err) {\n logger.error(`${logPrefix} ❌ Controller error:`, err);\n throw err; // Re-throw - controller errors are fatal\n }\n};\nconst resolveAndValidateUpdateOptions = (opts) => {\n const { config, session, env, eventListeners, invokeControllerForModel, onElementSessionUpdate, } = mergeObjectsIgnoringNullUndefined(defaultPieElementOptions, opts);\n if (!env) {\n throw new Error(\"env is required\");\n }\n if (!session) {\n throw new Error(\"session is required\");\n }\n if (!config) {\n throw new Error(\"config is required\");\n }\n return {\n config,\n session,\n env,\n eventListeners,\n invokeControllerForModel,\n onElementSessionUpdate,\n };\n};\nconst updateSinglePieElement = async (pieElement, controllerLookupTag, options, logContext) => {\n const { config, session, env, eventListeners, invokeControllerForModel, onElementSessionUpdate, } = options;\n const model = config.models?.find((m) => m.id === pieElement.id);\n if (!model) {\n logger.error(`${logContext} Model not found for`, controllerLookupTag);\n throw new Error(`model not found for ${controllerLookupTag}`);\n }\n const elementSession = findOrAddSession(session, model.id, model.element);\n // Always attach event listeners (don't skip them for no-controller case)\n if (eventListeners) {\n Object.entries(eventListeners).forEach(([evt, fn]) => {\n pieElement.addEventListener(evt, fn);\n });\n }\n if (env && invokeControllerForModel) {\n const controller = findPieController(controllerLookupTag);\n if (!controller) {\n logger.debug(`${logContext} ℹ️ No controller for ${controllerLookupTag}, using server-processed model`);\n pieElement.model = wrapModelRichContent(model);\n pieElement.session = elementSession;\n return;\n }\n logger.debug(`${logContext} Invoking controller for ${controllerLookupTag}#${pieElement.id}`, {\n mode: env.mode,\n role: env.role,\n hasCorrectResponse: \"correctResponse\" in model,\n });\n // Await the controller so any updateSession write-back completes before the\n // caller computes/emits the session signature; otherwise a late, async\n // shuffle write lands after the cycle that read the session and the order\n // never round-trips (PIE-631).\n try {\n await applyControllerToElement(pieElement, model, elementSession, controller, env, `${logContext}(${controllerLookupTag}#${pieElement.id})`, onElementSessionUpdate);\n }\n catch (err) {\n const errorMessage = err instanceof Error ? err.message : String(err);\n const isContractError = errorMessage.includes(\"Controller contract mismatch\");\n logger.error(`${logContext} Controller failed for ${controllerLookupTag}#${pieElement.id}:`, err);\n emitControllerError(pieElement, {\n code: isContractError\n ? \"PIE_CONTROLLER_CONTRACT_ERROR\"\n : \"PIE_CONTROLLER_RUNTIME_ERROR\",\n message: `${controllerLookupTag} controller failed while applying model for ${pieElement.id}. ${errorMessage}`,\n elementName: controllerLookupTag,\n elementId: pieElement.id,\n controllerShape: describeControllerShape(controller),\n cause: errorMessage,\n });\n // Fall back to raw model on controller error\n pieElement.model = wrapModelRichContent(model);\n pieElement.session = elementSession;\n }\n }\n else {\n logger.debug(`${logContext} Direct model assignment for ${controllerLookupTag}#${pieElement.id} (no controller invocation requested)`);\n pieElement.model = wrapModelRichContent(model);\n pieElement.session = elementSession;\n }\n};\n/**\n * Update a PIE element by ref (direct Element reference)\n */\nexport const updatePieElementWithRef = (el, opts) => {\n const options = resolveAndValidateUpdateOptions(opts);\n const pieElement = el;\n const elName = pieElement.tagName.toLowerCase();\n return updateSinglePieElement(pieElement, elName, options, \"[updatePieElementWithRef]\");\n};\n/**\n * Update a PIE element by name (finds all matching elements in DOM)\n */\nexport const updatePieElement = (elName, opts) => {\n const options = resolveAndValidateUpdateOptions(opts);\n const { container } = mergeObjectsIgnoringNullUndefined(defaultPieElementOptions, opts);\n // Use container for scoped query or fallback to document for global query\n const searchRoot = container || document;\n const pieElements = searchRoot.querySelectorAll(elName);\n if (!pieElements || pieElements.length === 0) {\n logger.debug(`no elements found for ${elName}`);\n return Promise.resolve();\n }\n return Promise.all(Array.from(pieElements, (el) => updateSinglePieElement(el, elName, options, \"[updatePieElement]\"))).then(() => undefined);\n};\n/**\n * Update all PIE elements in a config\n */\nexport const updatePieElements = (config, session, env, container, onElementSessionUpdate) => {\n logger.debug(\"[updatePieElements] Updating all elements with env:\", env);\n return Promise.all(Object.entries(config.elements).map(([elName, _pkg]) => updatePieElement(elName, {\n config,\n session,\n env,\n container,\n onElementSessionUpdate,\n }))).then(() => undefined);\n};\n","/**\n * PIE Initialization Module\n *\n * Bundle loading and element initialization logic.\n * This is the core of the PIE player system.\n */\nimport { BUILDER_BUNDLE_URL } from \"../config/profile.js\";\nimport { DEFAULT_IIFE_BUNDLE_RETRY_CONFIG } from \"../loader-config.js\";\nimport { mergeObjectsIgnoringNullUndefined } from \"../object/index.js\";\nimport { editorPostFix } from \"../types/index.js\";\nimport { initializePieElement } from \"./initialize-element.js\";\nimport { createPieLogger, isGlobalDebugEnabled } from \"./logger.js\";\nimport { initializeMathRendering } from \"./math-rendering.js\";\nimport { pieRegistry } from \"./registry.js\";\nimport { defineCustomElementSafely } from \"./custom-element-define.js\";\nimport { validateCustomElementTag } from \"./tag-names.js\";\nimport { BundleType, isCustomElementConstructor, isPieAvailable, Status, } from \"./types.js\";\nimport { updatePieElement } from \"./updates.js\";\nimport { getPackageWithoutVersion, getPieElementBundlesUrl, } from \"./utils.js\";\n// Create module-level logger (respects global debug flag - pass function for dynamic checking)\nconst logger = createPieLogger(\"pie-initialization\", () => isGlobalDebugEnabled());\n/**\n * Deadline for `loadPieModule`'s bundle `<script>` load when the caller\n * sets no `loadTimeoutMs`. Shared with the `ElementLoader` primitive's\n * `DEFAULT_LOAD_TIMEOUT_MS` so a bundle gets the same budget whichever\n * path a host loads it through.\n */\nconst DEFAULT_LOAD_TIMEOUT_MS = DEFAULT_IIFE_BUNDLE_RETRY_CONFIG.timeoutMs;\n// Default options for loading PIE elements\nconst defaultOptions = {\n buildServiceBase: BUILDER_BUNDLE_URL,\n bundleType: BundleType.player, // Default to player.js (no controllers, server-processed models)\n env: { mode: \"gather\", role: \"student\" },\n};\nconst getEditorElementTagName = (elementTagName, pkg) => validateCustomElementTag(elementTagName + editorPostFix, `editor element tag for ${pkg}`);\nconst updateRegisteredElement = (elementTagName, config, session, options, omitEnv = false) => {\n updatePieElement(elementTagName, {\n config,\n session,\n ...(omitEnv ? {} : { env: options.env }),\n container: options.container,\n ...(options.eventListeners?.[elementTagName] && {\n eventListeners: options.eventListeners[elementTagName],\n }),\n });\n};\n/**\n * Shared element registration logic\n * Extracted from initializePiesFromLoadedBundle and loadPieModule to eliminate ~200 lines of duplication\n *\n * Binds the elements already present in `options.container`. Elements that\n * arrive later are bound by the container owner's observer — see\n * `element-observer.ts`.\n *\n * `elementModule` may be `null`. In that case we cannot register *new*\n * tags (no element constructor source), but we can still update tags\n * that another loader (e.g. the section-player's IIFE adapter) has\n * already registered with `customElements`. This is the common case\n * when `pie-item-player` mounts inside `pie-section-player`: the\n * section player has already pre-warmed the bundle through the deep\n * `ElementLoader` primitive, so the `window.pie.default` bundle-global\n * path is not required for those tags.\n */\nconst registerPieElementsFromBundle = (elementModule, config, session, registry, options) => {\n const promises = [];\n if (elementModule) {\n logger.debug(\"[registerPieElementsFromBundle] Available packages in bundle:\", Object.keys(elementModule));\n }\n else {\n logger.debug(\"[registerPieElementsFromBundle] No bundle module supplied; will only update tags already registered with customElements.\");\n }\n logger.debug(\"[registerPieElementsFromBundle] config.elements:\", config.elements);\n Object.entries(config.elements).forEach(([elName, pkg]) => {\n const elementTagName = validateCustomElementTag(elName, `element tag in config.elements for ${String(pkg)}`);\n logger.debug(`[registerPieElementsFromBundle] Processing element: ${elementTagName} -> ${pkg}`);\n // Fast path — the tag is already registered with customElements\n // (typically by the host's pre-warm pipeline). We can update its\n // session/model bindings without needing the bundle module at all.\n // This branch is also the one that runs when `elementModule` is\n // `null` because `window.pie` was missing.\n if (customElements.get(elementTagName)) {\n updateRegisteredElement(elementTagName, config, session, options);\n if (options.bundleType === BundleType.editor) {\n const editorElName = getEditorElementTagName(elementTagName, String(pkg));\n updateRegisteredElement(editorElName, config, session, options, true);\n }\n return;\n }\n // From here on we are in the \"register a new tag\" branch, which\n // requires a bundle module to read the element constructor from.\n if (!elementModule) {\n // A missing bundle module + an unregistered tag is *not*\n // always an error: in the section-player composition the\n // host's own `ElementLoader` may register this tag\n // out-of-band moments later, in which case `updatePieElement`\n // will pick it up on the next reactive pass via the\n // MutationObserver / `whenDefined` paths. Log at warn so the\n // transient miss is still visible during diagnostics without\n // printing a red stack trace for a routine timing condition.\n logger.warn(`[registerPieElementsFromBundle] Skipping \"${elementTagName}\" — no bundle module available and the tag is not yet registered. Will bind on next update if the host's loader registers it.`);\n return;\n }\n const pkgStripped = getPackageWithoutVersion(pkg);\n logger.debug(`[registerPieElementsFromBundle] Package without version: \"${pkgStripped}\"`);\n const elementData = elementModule[pkgStripped];\n logger.debug(`[registerPieElementsFromBundle] elementData result:`, elementData ? \"FOUND\" : \"UNDEFINED\");\n if (!elementData) {\n logger.error(`[registerPieElementsFromBundle] ❌ Package \"${pkgStripped}\" not found in bundle!`);\n logger.error(`[registerPieElementsFromBundle] Lookup key: \"${pkgStripped}\"`);\n logger.error(`[registerPieElementsFromBundle] Available packages:`, Object.keys(elementModule));\n throw new Error(`pie ${pkgStripped} not found in ${Object.keys(elementModule)}`);\n }\n logger.debug(`[registerPieElementsFromBundle] elementData for ${pkgStripped}:`, {\n hasController: !!elementData.controller,\n hasElement: !!elementData.Element,\n hasConfig: !!elementData.config,\n controllerKeys: elementData.controller\n ? Object.keys(elementData.controller)\n : [],\n bundleType: options.bundleType,\n });\n // Validate controller presence based on bundle type\n if (!elementData.controller) {\n if (options.bundleType === BundleType.clientPlayer) {\n logger.error(`[registerPieElementsFromBundle] ❌ CRITICAL: No controller found for ${pkgStripped}!`);\n logger.error(`[registerPieElementsFromBundle] Bundle type: ${options.bundleType} (controllers required)`);\n throw new Error(`No controller found for ${pkgStripped}. client-player.js bundles MUST include controllers!`);\n }\n else {\n logger.debug(`[registerPieElementsFromBundle] ℹ️ No controller found for ${pkgStripped} - using server-processed models (player.js bundle)`);\n }\n }\n {\n // Register the element in our registry\n logger.debug(`[registerPieElementsFromBundle] Registering ${elName} in registry${elementData.controller\n ? \" with controller\"\n : \" (no controller - server-processed models)\"}`);\n registry[elementTagName] = {\n package: pkg,\n status: Status.loading,\n tagName: elementTagName,\n controller: elementData.controller || null,\n config: elementData.config,\n bundleType: options.bundleType,\n };\n if (isCustomElementConstructor(elementData.Element)) {\n defineCustomElementSafely(elementTagName, elementData.Element, `element tag in config.elements for ${String(pkg)}`);\n // Initialize existing elements\n const searchRoot = options.container || document;\n const elements = searchRoot.querySelectorAll(elementTagName);\n logger.debug(`[registerPieElementsFromBundle] Found ${elements.length} elements for tag '${elementTagName}'`);\n elements.forEach((el) => {\n initializePieElement(el, {\n config,\n session,\n env: options.env,\n eventListeners: options.eventListeners?.[elementTagName],\n });\n });\n // Update registry status\n registry[elementTagName] = {\n ...registry[elementTagName],\n status: Status.loaded,\n };\n promises.push(customElements.whenDefined(elementTagName).then(() => {\n logger.debug(\"[registerPieElementsFromBundle] defined custom PIE element: %s\", elementTagName);\n }));\n // Handle editor elements if needed\n if (options.bundleType === BundleType.editor) {\n if (isCustomElementConstructor(elementData.Configure)) {\n const editorElName = getEditorElementTagName(elementTagName, String(pkg));\n defineCustomElementSafely(editorElName, elementData.Configure, `editor element tag for ${String(pkg)}`);\n promises.push(customElements.whenDefined(editorElName).then(() => {\n logger.debug(`[registerPieElementsFromBundle] defined custom PIE editor element: ${editorElName}`);\n }));\n }\n else {\n logger.error(`[registerPieElementsFromBundle] pie.Configure for ${pkgStripped} is not a valid custom element constructor.`, elementData.configure);\n }\n }\n }\n else {\n logger.error(`[registerPieElementsFromBundle] pie.Element for ${pkgStripped} is not a valid custom element constructor.`);\n }\n }\n });\n return promises;\n};\n/**\n * Initialize PIE elements from a bundle that may already be loaded.\n *\n * `window.pie` is the IIFE bundle-loading global populated by\n * `loadPieModule` / `loadBundleFromString`. When the host loaded the\n * bundle through the deep `ElementLoader` primitive instead — as\n * `pie-section-player` does — the global is irrelevant: the loader\n * registers tags directly with `customElements`, so this function only\n * needs to bind models/sessions to whatever is already registered.\n *\n * Behavior:\n * - `window.pie` available → register any new tags from the bundle and\n * update bindings for already-registered tags.\n * - `window.pie` missing → fall back to the update-only path. Tags that\n * are already registered get their model/session updated; tags that\n * are not yet registered are logged at `warn` and left alone — the\n * host's loader is expected to register them imminently, after which\n * the existing `MutationObserver` / `updatePieElements` flow binds\n * them on the next reactive pass.\n *\n * The original blanket `window.pie not found; was the bundle inlined\n * correctly?` error has been removed: in the section-player + item-player\n * composition it produced a confusing red stack trace for a routine\n * timing condition that the host already handles. Genuine failures\n * (bundle not loaded by *anyone*) still surface — every unregistered tag\n * gets its own warning, and `updatePieElements` later reports any tag\n * that never resolves.\n *\n * Binds the elements present in `opts.container` now. Elements that arrive\n * later are the container owner's concern: a player with a lifecycle calls\n * `observePieElements` and releases it on teardown.\n */\nexport const initializePiesFromLoadedBundle = (config, session, opts = {}) => {\n const registry = pieRegistry();\n const options = mergeObjectsIgnoringNullUndefined(defaultOptions, opts);\n if (isPieAvailable(window)) {\n logger.debug(\"[initializePiesFromLoadedBundle] window.pie available\");\n const elementModule = window.pie.default;\n registerPieElementsFromBundle(elementModule, config, session, registry, options);\n return;\n }\n logger.debug(\"[initializePiesFromLoadedBundle] window.pie not present; using update-only path. Already-registered tags will be bound now; missing tags are expected to be registered by the host's loader and will bind on the next update pass.\");\n registerPieElementsFromBundle(null, config, session, registry, options);\n};\n/**\n * Load a PIE bundle from a URL and initialize elements.\n *\n * Rejects — rather than hanging or throwing on the window — for every way\n * the load can fail: the `error` event (404, blocked request, CSP refusal),\n * the `loadTimeoutMs` deadline (a stalled request that never fires either\n * event), a bundle whose script ran without populating `window.pie`, and a\n * throw out of registration. Every rejection names the bundle URL and drops\n * the injected `<script>`.\n */\nexport const loadPieModule = async (config, session, opts = {}) => {\n if (!session) {\n throw new Error(\"session is required\");\n }\n // Initialize math-rendering module (required by PIE elements)\n await initializeMathRendering();\n const registry = pieRegistry();\n const options = mergeObjectsIgnoringNullUndefined(defaultOptions, opts);\n const url = opts.bundleUrl || getPieElementBundlesUrl(config, options);\n const loadTimeoutMs = options.loadTimeoutMs ?? DEFAULT_LOAD_TIMEOUT_MS;\n const script = document.createElement(\"script\");\n script.src = url;\n script.defer = true;\n let timer;\n // Removing a `<script>` does not abort a request already in flight, so a\n // late `load` can still fire after the deadline rejected. Each handler\n // checks this so registration never runs for a load the caller has\n // already been told failed.\n let settled = false;\n try {\n await new Promise((resolve, reject) => {\n const succeed = () => {\n settled = true;\n resolve();\n };\n const fail = (error) => {\n settled = true;\n reject(error);\n };\n script.addEventListener(\"load\", () => {\n if (settled)\n return;\n logger.debug(\"[loadPieModule] Script loaded from:\", url);\n if (!isPieAvailable(window)) {\n // Deliberately a rejection, not a resolve. The script executed\n // and registered nothing, so the URL did not serve a PIE IIFE\n // bundle; resolving would report a successful load to a caller\n // that then waits on elements which never arrive.\n // `initializePiesFromLoadedBundle` tolerates the same missing\n // global because there the host's own loader owns registration.\n // Here this function owns it, so there is no other party to\n // wait for. Matches the IIFE `ElementLoader` adapter, which\n // fails with `cause: \"window.pie.default missing after bundle\n // load\"`.\n fail(new Error(`PIE bundle loaded but window.pie is absent; is ${url} a proper PIE IIFE module?`));\n return;\n }\n logger.debug(\"[loadPieModule] window.pie available\");\n const elementModule = window.pie.default;\n try {\n // Use shared registration logic (returns array of promises)\n const registrationPromises = registerPieElementsFromBundle(elementModule, config, session, registry, options);\n // Wait for all element definitions to complete\n Promise.all(registrationPromises).then(succeed, fail);\n }\n catch (error) {\n // `registerPieElementsFromBundle` throws synchronously for a\n // package missing from the bundle and for a client-player\n // bundle with no controller. Inside a DOM event handler that\n // throw reaches the window instead of the caller.\n fail(error instanceof Error ? error : new Error(String(error)));\n }\n });\n script.addEventListener(\"error\", () => {\n if (settled)\n return;\n fail(new Error(`failed to load PIE bundle script: ${url}`));\n });\n if (loadTimeoutMs > 0) {\n timer = setTimeout(() => {\n if (settled)\n return;\n fail(new Error(`PIE bundle script load timed out after ${loadTimeoutMs}ms: ${url}`));\n }, loadTimeoutMs);\n }\n document.head.appendChild(script);\n });\n }\n catch (error) {\n // Drop the injected node so a retry starts from a clean head.\n script.remove();\n throw error;\n }\n finally {\n if (timer)\n clearTimeout(timer);\n }\n return { session };\n};\n/**\n * Load a PIE bundle from a JavaScript string into window.pie (IIFE bundles only)\n * This only registers elements and controllers - does NOT initialize them.\n * For initialization, use initializePiesFromLoadedBundle after loading.\n */\nexport const loadBundleFromString = async (bundleJs) => {\n await initializeMathRendering();\n await withBlobBundleUrl(bundleJs, { stripSourceMapComment: true }, async (bundleUrl) => {\n // Create a script tag to execute the bundle\n const script = document.createElement(\"script\");\n script.src = bundleUrl;\n script.type = \"text/javascript\"; // IIFE bundles are standard JS\n // Wait for script to load\n await new Promise((resolve, reject) => {\n script.onload = () => resolve();\n script.onerror = () => reject(new Error(\"Failed to load bundle\"));\n document.head.appendChild(script);\n });\n logger.debug(\"[loadBundleFromString] Bundle loaded into window.pie\");\n });\n};\n/**\n * Load a PIE bundle from a JavaScript string and initialize elements\n * Convenience wrapper around loadBundleFromString + loadPieModule\n */\nexport const loadPieModuleFromString = async (bundleJs, config, session, opts = {}) => {\n await withBlobBundleUrl(bundleJs, {}, async (bundleUrl) => {\n // Use existing loadPieModule with the blob URL\n await loadPieModule(config, session, { ...opts, bundleUrl });\n });\n};\nconst withBlobBundleUrl = async (bundleJs, options, run) => {\n const source = options.stripSourceMapComment\n ? bundleJs.replace(/\\/\\/# sourceMappingURL=.*$/m, \"\")\n : bundleJs;\n const blob = new Blob([source], { type: \"application/javascript\" });\n const bundleUrl = URL.createObjectURL(blob);\n try {\n return await run(bundleUrl);\n }\n finally {\n URL.revokeObjectURL(bundleUrl);\n }\n};\n","/**\n * Binding PIE elements that arrive after their bundle was registered.\n *\n * A bundle registration binds models and sessions to the PIE elements present\n * in its container at registration time. Elements that arrive afterwards — ones\n * a host appends to authored markup after the player mounted, or ones a tag's\n * own render pass paints into its subtree — are bound by a `MutationObserver`.\n *\n * The observer is scoped to the registration's container, so a mutation\n * elsewhere on the host page never reaches the callback and no `contains()`\n * walk is needed to reject one. One observer serves every registration made\n * against the same container — an item player registers its item config and its\n * passage config separately — and it disconnects when the last of those\n * registrations is released.\n *\n * This replaces a pair of `window` globals: one observer on `document.body` for\n * the lifetime of the page, and one context slot that every registration\n * overwrote. With a single slot the second registration displaced the first, so\n * a late passage element, or any element in a player that was not the most\n * recently registered, silently never bound.\n */\nimport { initializePieElement } from \"./initialize-element.js\";\nimport { createPieLogger, isGlobalDebugEnabled } from \"./logger.js\";\nimport { pieRegistry } from \"./registry.js\";\nconst logger = createPieLogger(\"pie-element-observer\", () => isGlobalDebugEnabled());\nconst observed = new Map();\nconst resolveContexts = (sources) => {\n const contexts = [];\n for (const source of sources) {\n try {\n contexts.push(source());\n }\n catch (error) {\n logger.error(\"[pieElementObserver] A context source threw; skipping it.\", error);\n }\n }\n return contexts;\n};\nconst bindElement = (element, contexts) => {\n const tagName = element.tagName.toLowerCase();\n if (!pieRegistry()[tagName])\n return;\n for (const context of contexts) {\n const bound = initializePieElement(element, {\n config: context.config,\n session: context.session,\n env: context.env,\n eventListeners: context.eventListeners?.[tagName],\n });\n if (bound)\n return;\n }\n};\nconst handleMutations = (sources, mutations) => {\n // Resolved once per delivery, not per element.\n const contexts = resolveContexts(sources);\n if (contexts.length === 0)\n return;\n for (const mutation of mutations) {\n if (mutation.type !== \"childList\")\n continue;\n for (const node of mutation.addedNodes) {\n if (node.nodeType !== Node.ELEMENT_NODE)\n continue;\n const element = node;\n bindElement(element, contexts);\n for (const descendant of Array.from(element.querySelectorAll(\"*\"))) {\n bindElement(descendant, contexts);\n }\n }\n }\n};\n/**\n * Watch `container` for late-arriving PIE elements and bind them with whatever\n * `getContext` returns at that moment. `container` defaults to `document.body`,\n * matching an unscoped `LoadPieElementsOptions.container`.\n *\n * Returns the release for this registration. Calling it more than once is a\n * no-op; the observer disconnects once every registration against the container\n * has been released, so the caller that acquired it owns it.\n */\nexport const observePieElements = (container, getContext) => {\n if (typeof document === \"undefined\" ||\n typeof MutationObserver === \"undefined\") {\n return () => { };\n }\n const target = container ?? document.body;\n if (!target)\n return () => { };\n let entry = observed.get(target);\n if (!entry) {\n const sources = new Set();\n const observer = new MutationObserver((mutations) => handleMutations(sources, mutations));\n observer.observe(target, { childList: true, subtree: true });\n entry = { sources, observer };\n observed.set(target, entry);\n logger.debug(\"[observePieElements] Observing a new container\");\n }\n const { sources, observer } = entry;\n sources.add(getContext);\n logger.debug(`[observePieElements] Container now has ${sources.size} registration(s)`);\n let released = false;\n return () => {\n if (released)\n return;\n released = true;\n sources.delete(getContext);\n if (sources.size > 0)\n return;\n observer.disconnect();\n observed.delete(target);\n logger.debug(\"[observePieElements] Released the last registration, disconnected\");\n };\n};\n/**\n * The contexts registered for `root` or for any container inside it, resolved\n * now, in registration order.\n *\n * A host holds the custom element it mounted while the player registers its own\n * inner root as the container, so the lookup accepts an ancestor of the\n * container.\n */\nexport const pieElementContextsWithin = (root) => {\n const sources = [];\n for (const [container, entry] of observed) {\n if (container !== root && !root.contains(container))\n continue;\n sources.push(...entry.sources);\n }\n return resolveContexts(sources);\n};\n","/**\n * Asset Handler Utilities\n *\n * Handles image and sound upload events for authoring mode.\n * Provides default DataURL-based implementation and event management.\n */\nimport { DeleteImageEvent, DeleteSoundEvent, InsertImageEvent, InsertSoundEvent, } from \"../types/index.js\";\nimport { createPieLogger, isGlobalDebugEnabled } from \"./logger.js\";\nconst logger = createPieLogger(\"asset-handler\", () => isGlobalDebugEnabled());\n/**\n * DataURL-based asset handler (default implementation)\n *\n * Converts uploaded files to base64 data URLs.\n * Suitable for demos and local development.\n */\nexport class DataURLAssetHandler {\n onComplete;\n cancelled = false;\n fileReader = null;\n constructor(onComplete) {\n this.onComplete = onComplete;\n }\n cancel() {\n this.cancelled = true;\n if (this.fileReader) {\n this.fileReader.abort();\n }\n logger.debug(\"[DataURLAssetHandler] Upload cancelled\");\n }\n done(err, src) {\n if (this.cancelled) {\n return;\n }\n if (err) {\n logger.error(\"[DataURLAssetHandler] Error during upload:\", err);\n // Optionally notify user of error\n return;\n }\n if (src) {\n logger.debug(\"[DataURLAssetHandler] Upload complete, src:\", src.substring(0, 50) + \"...\");\n this.onComplete(src);\n }\n }\n fileChosen(file) {\n if (this.cancelled) {\n return;\n }\n logger.debug(\"[DataURLAssetHandler] File chosen:\", file.name, file.type, file.size);\n this.fileReader = new FileReader();\n this.fileReader.onload = (e) => {\n const dataUrl = e.target?.result;\n logger.debug(\"[DataURLAssetHandler] File converted to data URL\");\n this.done(undefined, dataUrl);\n };\n this.fileReader.onerror = () => {\n logger.error(\"[DataURLAssetHandler] FileReader error\");\n this.done(new Error(\"Failed to read file\"));\n };\n this.fileReader.onprogress = (e) => {\n if (e.lengthComputable) {\n const percent = (e.loaded / e.total) * 100;\n this.progress(percent, e.loaded, e.total);\n }\n };\n this.fileReader.readAsDataURL(file);\n }\n progress(percent, bytes, total) {\n logger.debug(`[DataURLAssetHandler] Progress: ${percent.toFixed(1)}% (${bytes}/${total} bytes)`);\n // Could dispatch custom event here for progress UI\n }\n}\nfunction toError(value, fallback) {\n if (value instanceof Error) {\n return value;\n }\n return new Error(String(value ?? fallback));\n}\nfunction createOnceCompletion(handler, dataURLHandler) {\n let settled = false;\n const originalDone = handler.done;\n const originalCancel = handler.cancel;\n const done = (err, src) => {\n if (settled) {\n return;\n }\n settled = true;\n if (err) {\n try {\n originalCancel?.();\n }\n catch (cancelError) {\n logger.error(\"[asset-handler] cancel callback failed:\", cancelError);\n }\n dataURLHandler.cancel();\n }\n try {\n originalDone?.(err, src);\n }\n catch (doneError) {\n logger.error(\"[asset-handler] done callback failed:\", doneError);\n }\n };\n const cancel = () => {\n if (settled) {\n return;\n }\n settled = true;\n try {\n originalCancel?.();\n }\n catch (cancelError) {\n logger.error(\"[asset-handler] cancel callback failed:\", cancelError);\n }\n dataURLHandler.cancel();\n };\n handler.done = done;\n handler.cancel = cancel;\n return {\n done,\n cancel,\n isSettled: () => settled,\n };\n}\nfunction pickFileWithDialogLifecycle(accept, onCancel) {\n return new Promise((resolve) => {\n const input = document.createElement(\"input\");\n input.type = \"file\";\n input.accept = accept;\n let resolved = false;\n let changeHandled = false;\n let dialogOpened = false;\n const cleanup = () => {\n input.onchange = null;\n window.removeEventListener(\"focus\", onFocus);\n input.removeEventListener(\"cancel\", onCancelEvent);\n };\n const finalize = (file) => {\n if (resolved) {\n return;\n }\n resolved = true;\n cleanup();\n resolve(file);\n };\n const onFocus = () => {\n if (!dialogOpened || changeHandled) {\n return;\n }\n dialogOpened = false;\n window.setTimeout(() => {\n if (changeHandled || resolved) {\n return;\n }\n const file = input.files?.[0] ?? null;\n if (!file) {\n onCancel();\n }\n finalize(file);\n }, 300);\n };\n const onCancelEvent = () => {\n onCancel();\n finalize(null);\n };\n input.onchange = () => {\n changeHandled = true;\n dialogOpened = false;\n finalize(input.files?.[0] ?? null);\n };\n input.addEventListener(\"cancel\", onCancelEvent);\n window.addEventListener(\"focus\", onFocus);\n dialogOpened = true;\n input.click();\n });\n}\nfunction getPastedFile(handler) {\n if (!handler.isPasted || typeof handler.getChosenFile !== \"function\") {\n return null;\n }\n try {\n return handler.getChosenFile() ?? null;\n }\n catch (error) {\n logger.error(\"[asset-handler] Failed to read pasted file\", error);\n return null;\n }\n}\n/**\n * Asset Event Manager\n *\n * Manages asset-related event listeners for configure elements.\n * Handles InsertImageEvent, DeleteImageEvent, InsertSoundEvent, DeleteSoundEvent.\n */\nexport class AssetEventManager {\n element;\n onInsertImage;\n onDeleteImage;\n onInsertSound;\n onDeleteSound;\n listeners = [];\n constructor(element, onInsertImage, onDeleteImage, onInsertSound, onDeleteSound) {\n this.element = element;\n this.onInsertImage = onInsertImage;\n this.onDeleteImage = onDeleteImage;\n this.onInsertSound = onInsertSound;\n this.onDeleteSound = onDeleteSound;\n }\n /**\n * Attach event listeners\n */\n attach() {\n logger.debug(\"[AssetEventManager] Attaching event listeners\");\n // Insert Image Event\n if (this.onInsertImage) {\n const insertImageHandler = (e) => {\n const event = e;\n logger.debug(\"[AssetEventManager] InsertImageEvent received\");\n this.onInsertImage(event.detail);\n };\n this.element.addEventListener(InsertImageEvent.TYPE, insertImageHandler);\n this.listeners.push({\n type: InsertImageEvent.TYPE,\n handler: insertImageHandler,\n });\n }\n // Delete Image Event\n if (this.onDeleteImage) {\n const deleteImageHandler = (e) => {\n const event = e;\n logger.debug(\"[AssetEventManager] DeleteImageEvent received, src:\", event.detail.src);\n this.onDeleteImage(event.detail.src, event.detail.done);\n };\n this.element.addEventListener(DeleteImageEvent.TYPE, deleteImageHandler);\n this.listeners.push({\n type: DeleteImageEvent.TYPE,\n handler: deleteImageHandler,\n });\n }\n // Insert Sound Event\n if (this.onInsertSound) {\n const insertSoundHandler = (e) => {\n const event = e;\n logger.debug(\"[AssetEventManager] InsertSoundEvent received\");\n this.onInsertSound(event.detail);\n };\n this.element.addEventListener(InsertSoundEvent.TYPE, insertSoundHandler);\n this.listeners.push({\n type: InsertSoundEvent.TYPE,\n handler: insertSoundHandler,\n });\n }\n // Delete Sound Event\n if (this.onDeleteSound) {\n const deleteSoundHandler = (e) => {\n const event = e;\n logger.debug(\"[AssetEventManager] DeleteSoundEvent received, src:\", event.detail.src);\n this.onDeleteSound(event.detail.src, event.detail.done);\n };\n this.element.addEventListener(DeleteSoundEvent.TYPE, deleteSoundHandler);\n this.listeners.push({\n type: DeleteSoundEvent.TYPE,\n handler: deleteSoundHandler,\n });\n }\n logger.debug(\"[AssetEventManager] Attached\", this.listeners.length, \"event listeners\");\n }\n /**\n * Detach event listeners (cleanup)\n */\n detach() {\n logger.debug(\"[AssetEventManager] Detaching event listeners\");\n this.listeners.forEach(({ type, handler }) => {\n this.element.removeEventListener(type, handler);\n });\n this.listeners = [];\n logger.debug(\"[AssetEventManager] All event listeners detached\");\n }\n}\n/**\n * Create default image insert handler using DataURL conversion\n */\nexport function createDefaultImageInsertHandler(onComplete) {\n return (handler) => {\n logger.debug(\"[createDefaultImageInsertHandler] Creating DataURL handler\");\n let completion = null;\n const dataURLHandler = new DataURLAssetHandler((src) => {\n onComplete(src);\n completion?.done(undefined, src);\n });\n completion = createOnceCompletion(handler, dataURLHandler);\n const finishCancelled = () => {\n completion?.done(new Error(\"Image selection cancelled\"));\n };\n const handleChosenFile = (file) => {\n if (!file) {\n finishCancelled();\n return;\n }\n try {\n handler.fileChosen(file);\n }\n catch (error) {\n logger.error(\"[createDefaultImageInsertHandler] fileChosen failed\", error);\n completion?.done(toError(error, \"Image fileChosen failed\"));\n return;\n }\n try {\n dataURLHandler.fileChosen(file);\n }\n catch (error) {\n completion?.done(toError(error, \"Image upload failed\"));\n }\n };\n const pastedFile = getPastedFile(handler);\n if (pastedFile) {\n handleChosenFile(pastedFile);\n return;\n }\n if (handler.isPasted) {\n completion?.done(new Error(\"Pasted image is unavailable\"));\n return;\n }\n void pickFileWithDialogLifecycle(\"image/*\", finishCancelled)\n .then((file) => {\n if (completion?.isSettled()) {\n return;\n }\n handleChosenFile(file);\n })\n .catch((error) => {\n completion?.done(toError(error, \"Image selection failed\"));\n });\n };\n}\n/**\n * Create default sound insert handler using DataURL conversion\n */\nexport function createDefaultSoundInsertHandler(onComplete) {\n return (handler) => {\n logger.debug(\"[createDefaultSoundInsertHandler] Creating DataURL handler\");\n let completion = null;\n const dataURLHandler = new DataURLAssetHandler((src) => {\n onComplete(src);\n completion?.done(undefined, src);\n });\n const handlerLike = handler;\n completion = createOnceCompletion(handlerLike, dataURLHandler);\n const finishCancelled = () => {\n completion?.done(new Error(\"Sound selection cancelled\"));\n };\n const handleChosenFile = (file) => {\n if (!file) {\n finishCancelled();\n return;\n }\n // Some handlers expose fileChosen as function, while others store file directly.\n const maybeFileChosen = handlerLike.fileChosen;\n if (typeof maybeFileChosen === \"function\") {\n try {\n maybeFileChosen(file);\n }\n catch (error) {\n logger.error(\"[createDefaultSoundInsertHandler] fileChosen failed\", error);\n completion?.done(toError(error, \"Sound fileChosen failed\"));\n return;\n }\n }\n try {\n dataURLHandler.fileChosen(file);\n }\n catch (error) {\n completion?.done(toError(error, \"Sound upload failed\"));\n }\n };\n const pastedFile = getPastedFile(handlerLike);\n if (pastedFile) {\n handleChosenFile(pastedFile);\n return;\n }\n if (handlerLike.isPasted) {\n completion?.done(new Error(\"Pasted sound is unavailable\"));\n return;\n }\n void pickFileWithDialogLifecycle(\"audio/*\", finishCancelled)\n .then((file) => {\n if (completion?.isSettled()) {\n return;\n }\n handleChosenFile(file);\n })\n .catch((error) => {\n completion?.done(toError(error, \"Sound selection failed\"));\n });\n };\n}\n/**\n * Create default image delete handler (no-op for DataURL)\n */\nexport function createDefaultImageDeleteHandler() {\n return (src, done) => {\n logger.debug(\"[createDefaultImageDeleteHandler] Delete requested for:\", src.substring(0, 50));\n // For DataURL, no server-side deletion needed\n done(); // Success\n };\n}\n/**\n * Create default sound delete handler (no-op for DataURL)\n */\nexport function createDefaultSoundDeleteHandler() {\n return (src, done) => {\n logger.debug(\"[createDefaultSoundDeleteHandler] Delete requested for:\", src.substring(0, 50));\n // For DataURL, no server-side deletion needed\n done(); // Success\n };\n}\n","import { AssetEventManager } from \"./asset-handler.js\";\nimport { createPieLogger, isGlobalDebugEnabled } from \"./logger.js\";\nimport { findPieController } from \"./scoring.js\";\nimport { parsePackageName } from \"./utils.js\";\nconst logger = createPieLogger(\"authoring\", () => isGlobalDebugEnabled());\nfunction isRecord(value) {\n return !!value && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction packageNameWithoutVersion(packageSpec) {\n try {\n return parsePackageName(packageSpec).name;\n }\n catch {\n return packageSpec;\n }\n}\nfunction packageBaseName(packageName) {\n const lastSegment = packageName.split(\"/\").pop();\n return lastSegment || packageName;\n}\nfunction lookupOwn(source, keys) {\n if (!isRecord(source))\n return undefined;\n for (const key of keys) {\n if (Object.hasOwn(source, key)) {\n return source[key];\n }\n }\n return undefined;\n}\nfunction mergeConfiguration(deliveryConfig, authoringConfig) {\n if (authoringConfig === undefined) {\n return deliveryConfig ?? {};\n }\n if (isRecord(deliveryConfig) && isRecord(authoringConfig)) {\n return {\n ...deliveryConfig,\n ...authoringConfig,\n };\n }\n return authoringConfig;\n}\nexport function resolveConfigureConfiguration(configuration, elementTag, packageSpec) {\n const versionlessPackageName = packageNameWithoutVersion(packageSpec);\n const basePackageName = packageBaseName(versionlessPackageName);\n const deliveryConfig = lookupOwn(configuration, [\n packageSpec,\n versionlessPackageName,\n elementTag,\n ]);\n const authoringConfig = lookupOwn(configuration?.authoring, [\n elementTag,\n packageSpec,\n versionlessPackageName,\n basePackageName,\n ]);\n return mergeConfiguration(deliveryConfig, authoringConfig);\n}\nfunction findModelForConfigureElement(models, configureElement) {\n const modelId = configureElement.id;\n if (!modelId)\n return undefined;\n return models.find((model) => model.id === modelId);\n}\nfunction queryConfigureElements(container, configureTag) {\n return Array.from(container.querySelectorAll(configureTag));\n}\nexport function initializeAuthoringConfigures(config, configuration = {}, options) {\n const container = options.container ?? document;\n const initializedModels = [];\n logger.debug(\"[initializeAuthoringConfigures] Starting initialization\");\n logger.debug(\"[initializeAuthoringConfigures] Config:\", config);\n logger.debug(\"[initializeAuthoringConfigures] Configuration:\", configuration);\n logger.debug(\"[initializeAuthoringConfigures] Env:\", options.env);\n if (!config?.elements || !config?.models) {\n logger.warn(\"[initializeAuthoringConfigures] Invalid config - missing elements or models\");\n return initializedModels;\n }\n for (const [elementTag, packageSpec] of Object.entries(config.elements)) {\n const configureTag = `${elementTag}-config`;\n const elements = queryConfigureElements(container, configureTag);\n logger.debug(`[initializeAuthoringConfigures] Found ${elements.length} ${configureTag} elements`);\n for (const element of elements) {\n const model = findModelForConfigureElement(config.models, element);\n if (!model) {\n logger.warn(`[initializeAuthoringConfigures] No model found for ${configureTag}#${element.id || \"(missing-id)\"}`);\n continue;\n }\n const configureElement = element;\n const elementConfiguration = resolveConfigureConfiguration(configuration, elementTag, String(packageSpec));\n configureElement.model = model;\n configureElement.configuration = elementConfiguration;\n initializedModels.push({\n id: model.id,\n element: model.element,\n configureTag,\n configuration: elementConfiguration,\n });\n logger.debug(`[initializeAuthoringConfigures] Model and configuration set for ${configureTag}#${model.id}`, elementConfiguration);\n }\n }\n logger.debug(\"[initializeAuthoringConfigures] Initialization complete\");\n return initializedModels;\n}\nfunction resolveValidationController(configureElement) {\n return findPieController(configureElement.localName);\n}\nfunction hasValidationErrors(validation) {\n if (!validation || typeof validation !== \"object\")\n return false;\n const validationRecord = validation;\n if (validationRecord.hasErrors === true)\n return true;\n const errors = validationRecord.errors;\n return Array.isArray(errors) && errors.length > 0;\n}\nexport async function validateAuthoringModels(config, configuration = {}, options = {}) {\n const container = options.container ?? document;\n const validatedModels = [];\n if (!config?.elements || !config?.models) {\n return { hasErrors: false, validatedModels };\n }\n for (const [elementTag, packageSpec] of Object.entries(config.elements)) {\n const configureTag = `${elementTag}-config`;\n const elements = queryConfigureElements(container, configureTag);\n for (const element of elements) {\n const model = findModelForConfigureElement(config.models, element);\n if (!model)\n continue;\n const controller = resolveValidationController(element);\n const elementConfiguration = resolveConfigureConfiguration(configuration, elementTag, String(packageSpec));\n const validation = typeof controller?.validate === \"function\"\n ? await controller.validate(model, elementConfiguration)\n : undefined;\n validatedModels.push({\n ...model,\n ...(isRecord(validation) ? validation : {}),\n id: model.id,\n element: model.element,\n validation,\n });\n }\n }\n return {\n hasErrors: validatedModels.some((model) => hasValidationErrors(model.validation)),\n validatedModels,\n };\n}\nfunction toError(value) {\n return value instanceof Error\n ? value\n : new Error(String(value ?? \"Unknown authoring error\"));\n}\nexport function createAuthoringAssetEventManager(rootElement, handlers, onHandlerError) {\n return new AssetEventManager(rootElement, handlers.onInsertImage\n ? (handler) => {\n try {\n handlers.onInsertImage?.(handler);\n }\n catch (error) {\n const err = toError(error);\n onHandlerError(\"onInsertImage\", err);\n handler.done(err);\n }\n }\n : undefined, handlers.onDeleteImage\n ? (src, done) => {\n try {\n handlers.onDeleteImage?.(src, done);\n }\n catch (error) {\n const err = toError(error);\n onHandlerError(\"onDeleteImage\", err);\n done(err);\n }\n }\n : undefined, handlers.onInsertSound\n ? (handler) => {\n try {\n handlers.onInsertSound?.(handler);\n }\n catch (error) {\n const err = toError(error);\n onHandlerError(\"onInsertSound\", err);\n handler.done(err);\n }\n }\n : undefined, handlers.onDeleteSound\n ? (src, done) => {\n try {\n handlers.onDeleteSound?.(src, done);\n }\n catch (error) {\n const err = toError(error);\n onHandlerError(\"onDeleteSound\", err);\n done(err);\n }\n }\n : undefined);\n}\n","import { isInstrumentationProvider } from \"../instrumentation/provider-guards.js\";\nimport { createPieLogger, isGlobalDebugEnabled } from \"./logger.js\";\nconst logger = createPieLogger(\"instrumentation-event-bridge\", () => isGlobalDebugEnabled());\nfunction normalizeEventDetail(detail) {\n if (detail && typeof detail === \"object\") {\n return detail;\n }\n if (typeof detail === \"undefined\") {\n return {};\n }\n return { value: detail };\n}\nfunction warnInvalidProvider(component) {\n logger.warn(`[InstrumentationEventBridge:${component}] Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);\n}\nfunction trackBridgeError(args) {\n try {\n args.provider.trackError(args.error instanceof Error\n ? args.error\n : new Error(String(args.error ?? \"Unknown instrumentation bridge error\")), {\n component: args.component,\n errorType: \"InstrumentationBridgeError\",\n sourceEventName: args.sourceEventName,\n });\n }\n catch {\n // Avoid recursive failures while reporting instrumentation bridge errors.\n }\n}\nexport function attachInstrumentationEventBridge(args) {\n if (!args.host || !args.eventMap.length)\n return () => { };\n if (!args.instrumentationProvider)\n return () => { };\n if (!isInstrumentationProvider(args.instrumentationProvider)) {\n if (args.debug) {\n warnInvalidProvider(args.component);\n }\n return () => { };\n }\n const provider = args.instrumentationProvider;\n const removeListeners = [];\n const dedupeWindowMs = Math.max(0, args.dedupeWindowMs ?? 0);\n const recentEventMap = new Map();\n const computeDedupeKey = (mapping, detail) => {\n const summary = [\n detail.assessmentId,\n detail.sectionId,\n detail.attemptId,\n detail.itemId,\n detail.canonicalItemId,\n detail.sourceRuntimeId,\n ]\n .map((value) => String(value ?? \"\"))\n .join(\"|\");\n return `${mapping.instrumentationEventName}|${summary}`;\n };\n for (const mapping of args.eventMap) {\n const handler = (event) => {\n try {\n if (!provider.isReady())\n return;\n if (args.shouldTrackEvent && !args.shouldTrackEvent(event))\n return;\n const customEvent = event;\n const detail = normalizeEventDetail(customEvent.detail);\n const timestamp = new Date().toISOString();\n const mergedAttributes = {\n ...detail,\n ...args.staticAttributes,\n component: args.component,\n sourceEventName: mapping.sourceEventName,\n timestamp,\n };\n if (dedupeWindowMs > 0) {\n const now = Date.now();\n const dedupeKey = computeDedupeKey(mapping, mergedAttributes);\n const previousTimestamp = recentEventMap.get(dedupeKey);\n if (typeof previousTimestamp === \"number\" &&\n now - previousTimestamp < dedupeWindowMs) {\n return;\n }\n recentEventMap.set(dedupeKey, now);\n }\n provider.trackEvent(mapping.instrumentationEventName, {\n ...mergedAttributes,\n });\n }\n catch (error) {\n trackBridgeError({\n provider,\n component: args.component,\n error,\n sourceEventName: mapping.sourceEventName,\n });\n }\n };\n args.host.addEventListener(mapping.sourceEventName, handler);\n removeListeners.push(() => {\n args.host?.removeEventListener(mapping.sourceEventName, handler);\n });\n }\n return () => {\n for (const removeListener of removeListeners) {\n removeListener();\n }\n };\n}\n","import { isInstrumentationProvider } from \"../instrumentation/provider-guards.js\";\nimport { NewRelicInstrumentationProvider } from \"../instrumentation/providers/NewRelicInstrumentationProvider.js\";\nimport { createPieLogger, isGlobalDebugEnabled } from \"./logger.js\";\nfunction asRecord(value) {\n return value && typeof value === \"object\" ? value : {};\n}\nfunction resolveLoaderConfig(playerLike) {\n const player = asRecord(playerLike);\n const loaderConfig = asRecord(player.loaderConfig);\n return Object.keys(loaderConfig).length > 0 ? loaderConfig : null;\n}\nfunction resolveProviderFromLoaderConfig(loaderConfig) {\n if (!loaderConfig || !(\"instrumentationProvider\" in loaderConfig)) {\n return { kind: \"unset\" };\n }\n const provider = loaderConfig.instrumentationProvider;\n if (provider === null)\n return { kind: \"null\" };\n if (typeof provider === \"undefined\")\n return { kind: \"unset\" };\n return { kind: \"value\", value: provider };\n}\nfunction resolveTrackPageActionsFromLoaderConfig(loaderConfig) {\n if (!loaderConfig || !(\"trackPageActions\" in loaderConfig))\n return undefined;\n const trackPageActions = loaderConfig.trackPageActions;\n return typeof trackPageActions === \"boolean\" ? trackPageActions : undefined;\n}\nfunction selectProviderCandidate(runtimeCandidate, topLevelCandidate) {\n if (runtimeCandidate.kind === \"value\" || runtimeCandidate.kind === \"null\") {\n return runtimeCandidate;\n }\n return topLevelCandidate;\n}\nlet defaultProvider;\nconst logger = createPieLogger(\"instrumentation-provider-resolution\", () => isGlobalDebugEnabled());\nfunction getDefaultInstrumentationProvider() {\n if (!defaultProvider) {\n defaultProvider = new NewRelicInstrumentationProvider();\n // New Relic provider sets readiness based on window.newrelic.\n void defaultProvider.initialize();\n }\n return defaultProvider;\n}\nexport function resolveInstrumentationProvider(args) {\n const runtimeLoaderConfig = resolveLoaderConfig(args.runtimePlayer);\n const topLevelLoaderConfig = resolveLoaderConfig(args.player);\n const runtimeTrackPageActions = resolveTrackPageActionsFromLoaderConfig(runtimeLoaderConfig);\n const topLevelTrackPageActions = resolveTrackPageActionsFromLoaderConfig(topLevelLoaderConfig);\n const trackPageActions = runtimeTrackPageActions ?? topLevelTrackPageActions ?? false;\n const candidateProvider = selectProviderCandidate(resolveProviderFromLoaderConfig(runtimeLoaderConfig), resolveProviderFromLoaderConfig(topLevelLoaderConfig));\n if (candidateProvider.kind === \"null\")\n return undefined;\n if (candidateProvider.kind === \"unset\") {\n return trackPageActions ? getDefaultInstrumentationProvider() : undefined;\n }\n if (isInstrumentationProvider(candidateProvider.value)) {\n return candidateProvider.value;\n }\n if (args.debug) {\n const prefix = args.component ? `[${args.component}] ` : \"\";\n logger.warn(`${prefix}Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);\n }\n return undefined;\n}\n","/**\n * Canonical stage vocabulary (M6 of the Coherent Options Surface track).\n *\n * One monotonic stage list is the unified replacement for the previous\n * drift of `toolkit-ready`, `section-ready`, `section-controller-ready`,\n * `interaction-ready`, `readiness-change`, and `ready` — all of which\n * have been removed. Hosts ask the same question — \"is this CE at\n * stage ≥ X?\" — across every `<pie-section-player-*>` and\n * `<pie-assessment-toolkit>` element.\n *\n * The four-stage canonical list (`composed`, `engine-ready`, `interactive`,\n * `disposed`) was finalized after the M5/M6 cumulative review confirmed\n * zero internal or external consumers for the original `attached`,\n * `runtime-bound`, and `ui-rendered` stages. The retro keeps the same\n * shape for both the toolkit CE and the layout CEs — every CE iterates\n * through the same list so subscribers don't need to special-case shape.\n *\n * Locked decisions (see `m6_ready_vocab_canonical_followup.plan.md`):\n * - **A1** Stage machine model with one canonical event family.\n * - **B1** \"All items loaded\" is reclassified as `pie-loading-complete`,\n * not a stage. (The previous `ready` DOM event alias was removed in\n * the broad architecture review compat sweep.)\n * - **C1** `readiness.mode = \"strict\"` only delays the `interactive`\n * transition; every earlier stage fires identically across modes.\n * - **D1** One DOM event family `pie-stage-change` with the stage in the\n * payload, mirroring the M3 `framework-error` idiom.\n *\n * Failure semantics deliberately stay in the M3 framework-error contract —\n * `status: \"failed\"` records the position; the framework error records the\n * cause.\n */\nexport const STAGES = Object.freeze([\n \"composed\",\n \"engine-ready\",\n \"interactive\",\n \"disposed\",\n]);\n/**\n * Stages that apply to a given CE shape. Post-retro the toolkit and the\n * layout CEs share the same canonical list; `applicableStages` is kept as\n * an indirection so the tracker, telemetry, and tests don't have to be\n * rewritten when a future stage diverges between shapes.\n */\nexport function applicableStages(_sourceCe) {\n return STAGES;\n}\n/**\n * Strict ordering index used by the tracker to detect monotonic\n * violations. `disposed` is last; `composed` is first.\n */\nexport function stageOrdinal(stage) {\n const idx = STAGES.indexOf(stage);\n if (idx === -1) {\n throw new Error(`Unknown stage \\`${stage}\\``);\n }\n return idx;\n}\n","import { STAGES, applicableStages, stageOrdinal, } from \"./stages.js\";\nlet unexpectedTransitionWarned = false;\nfunction defaultUnexpectedTransitionLogger(info) {\n if (unexpectedTransitionWarned)\n return;\n unexpectedTransitionWarned = true;\n if (typeof console !== \"undefined\" && console.warn) {\n console.warn(`[pie-stage-tracker] Unexpected ${info.reason} stage transition ` +\n `from \\`${info.from ?? \"<none>\"}\\` to \\`${info.to}\\`. ` +\n `Stage transitions are expected to be monotonic within a cohort; ` +\n `call \\`reset()\\` when \\`(sectionId, attemptId)\\` changes.`);\n }\n}\nexport function createStageTracker(opts) {\n const applicable = applicableStages(opts.sourceCeShape);\n const applicableSet = new Set(applicable);\n const now = opts.now ?? (() => new Date().toISOString());\n const onUnexpected = opts.onUnexpectedTransition ?? defaultUnexpectedTransitionLogger;\n let current = null;\n let sectionId = opts.sectionId;\n let attemptId = opts.attemptId;\n const emitted = new Set();\n function emitDetail(stage, status) {\n opts.emit({\n stage,\n status,\n runtimeId: opts.runtimeId,\n sectionId,\n attemptId,\n timestamp: now(),\n sourceCe: opts.sourceCe,\n });\n }\n function fillSkippedBefore(stage) {\n const targetIdx = stageOrdinal(stage);\n const startIdx = current === null ? 0 : stageOrdinal(current) + 1;\n for (let idx = startIdx; idx < targetIdx; idx += 1) {\n const skipCandidate = STAGES[idx];\n if (applicableSet.has(skipCandidate))\n continue;\n if (emitted.has(skipCandidate))\n continue;\n emitted.add(skipCandidate);\n emitDetail(skipCandidate, \"skipped\");\n }\n }\n function enter(stage, status = \"entered\") {\n const nextOrdinal = stageOrdinal(stage);\n const currentOrdinal = current === null ? -1 : stageOrdinal(current);\n if (status === \"entered\") {\n if (emitted.has(stage)) {\n onUnexpected({ from: current, to: stage, reason: \"duplicate\" });\n return;\n }\n if (nextOrdinal < currentOrdinal) {\n onUnexpected({ from: current, to: stage, reason: \"backward\" });\n return;\n }\n if (!applicableSet.has(stage)) {\n // A non-applicable stage entered with `entered` is a programming\n // error: the tracker auto-skips it when a later stage enters.\n // Treat it as a `skipped` emission and continue.\n if (emitted.has(stage))\n return;\n emitted.add(stage);\n emitDetail(stage, \"skipped\");\n return;\n }\n fillSkippedBefore(stage);\n emitted.add(stage);\n current = stage;\n emitDetail(stage, \"entered\");\n return;\n }\n // `status === \"failed\"` records position; do not gate on monotonic\n // ordering — failure can happen during any transition. Mark the stage\n // as emitted so a subsequent `entered` for the same stage warns as a\n // duplicate; downstream recovery should call `reset()` first.\n if (status === \"failed\") {\n fillSkippedBefore(stage);\n emitted.add(stage);\n current = stage;\n emitDetail(stage, \"failed\");\n return;\n }\n // `status === \"skipped\"` is reserved for the auto-fill path; explicit\n // callers shouldn't pass it. Accept it idempotently for robustness.\n if (emitted.has(stage))\n return;\n emitted.add(stage);\n emitDetail(stage, \"skipped\");\n }\n function reset(next) {\n current = null;\n emitted.clear();\n if (next) {\n sectionId = next.sectionId;\n attemptId = next.attemptId;\n }\n }\n function getCurrent() {\n return current;\n }\n return { enter, reset, getCurrent };\n}\n","const DEFAULT_SESSION_ID = \"\";\nconst METADATA_ONLY_SESSION_KEYS = new Set([\n \"complete\",\n \"component\",\n \"timestamp\",\n \"sourceRuntimeId\",\n]);\nconst ELEMENT_IDENTITY_SESSION_KEYS = new Set([\n \"id\",\n \"element\",\n ...METADATA_ONLY_SESSION_KEYS,\n]);\nfunction areSessionContainersEqual(left, right) {\n if (!left && !right)\n return true;\n if (!left || !right)\n return false;\n if ((left.id || \"\") !== (right.id || \"\"))\n return false;\n try {\n return JSON.stringify(left.data || []) === JSON.stringify(right.data || []);\n }\n catch {\n return false;\n }\n}\nfunction alignPreviousSessionIdForRendererSnapshot(candidate, previous) {\n if (!previous || candidate.id !== \"\")\n return previous;\n return {\n ...previous,\n id: \"\",\n };\n}\nexport function normalizeItemSessionContainer(input, fallbackSessionId = DEFAULT_SESSION_ID) {\n if (input && typeof input === \"object\") {\n const candidate = input;\n if (Array.isArray(candidate.data)) {\n return {\n id: typeof candidate.id === \"string\" ? candidate.id : fallbackSessionId,\n data: candidate.data,\n };\n }\n if (Array.isArray(input)) {\n return { id: fallbackSessionId, data: input };\n }\n return { id: fallbackSessionId, data: [input] };\n }\n if (Array.isArray(input)) {\n return { id: fallbackSessionId, data: input };\n }\n return { id: fallbackSessionId, data: [] };\n}\nexport function hasResponseValue(value) {\n if (value == null)\n return false;\n if (Array.isArray(value))\n return value.some((entry) => hasResponseValue(entry));\n if (typeof value !== \"object\")\n return false;\n for (const [key, nested] of Object.entries(value)) {\n if (key === \"value\" &&\n nested !== undefined &&\n nested !== null &&\n !(typeof nested === \"string\" && nested.trim() === \"\") &&\n !(Array.isArray(nested) && nested.length === 0)) {\n return true;\n }\n if (hasResponseValue(nested))\n return true;\n }\n return false;\n}\n/**\n * Keys a delivery element carries on its session that are never learner input:\n * element identity, the dispatch metadata the event contract defines, and\n * presentation state a controller writes at load (choice shuffle order).\n */\nconst NON_RESPONSE_SESSION_KEYS = new Set([\n \"id\",\n \"element\",\n \"complete\",\n \"component\",\n \"timestamp\",\n \"sourceRuntimeId\",\n \"shuffledValues\",\n]);\n/**\n * `id` inside an array entry is the response - which hotspot, which choice.\n * `id` inside an object property that repeats the property's own name is\n * structure, which is how `explicit-constructed-response` and `ebsr` key their\n * parts. Distinguishing the two by container is what keeps an unanswered\n * `{ value: { partA: { id: \"partA\" } } }` from reading as a response.\n */\nfunction carriesContent(value, owningKey) {\n if (value == null)\n return false;\n if (typeof value === \"string\")\n return value.trim() !== \"\";\n if (typeof value === \"number\" || typeof value === \"boolean\")\n return true;\n if (Array.isArray(value))\n return value.some((entry) => carriesContent(entry));\n if (typeof value !== \"object\")\n return false;\n return Object.entries(value).some(([key, nested]) => {\n if (key === \"id\" && owningKey !== undefined && nested === owningKey) {\n return false;\n }\n return carriesContent(nested, key);\n });\n}\n/**\n * Whether an element session holds anything the learner put there.\n *\n * Shape-agnostic by necessity: `value` is one element's answer key, and\n * `response`, `selectedTokens`, `answers`, `answer`, `drawables` are others.\n * Anything outside the non-response key set with content in it counts, so an\n * element this function has never heard of is handled by default.\n *\n * This is the fallback discriminant for the session commit. The primary one is\n * a comparison against the session the player last observed, which needs no\n * schema knowledge at all; see `session-commit.ts`.\n */\nexport function hasLearnerResponse(session) {\n if (!session || typeof session !== \"object\")\n return false;\n if (Array.isArray(session))\n return session.some(hasLearnerResponse);\n return Object.entries(session).some(([key, value]) => !NON_RESPONSE_SESSION_KEYS.has(key) && carriesContent(value, key));\n}\nexport function hasResponseField(value) {\n if (value == null)\n return false;\n if (Array.isArray(value))\n return value.some((entry) => hasResponseField(entry));\n if (typeof value !== \"object\")\n return false;\n for (const [key, nested] of Object.entries(value)) {\n if (key === \"value\") {\n return true;\n }\n if (hasResponseField(nested))\n return true;\n }\n return false;\n}\nfunction isPlainObject(value) {\n return Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction getMetadataComponent(sessionDetail, candidate) {\n if (typeof sessionDetail.component === \"string\")\n return sessionDetail.component;\n if (typeof candidate?.component === \"string\")\n return candidate.component;\n return undefined;\n}\nfunction getMetadataComplete(sessionDetail, candidate) {\n if (typeof sessionDetail.complete === \"boolean\")\n return sessionDetail.complete;\n if (typeof candidate?.complete === \"boolean\")\n return candidate.complete;\n return undefined;\n}\nfunction isElementIdentityOnlyPayload(candidate) {\n const candidateKeys = Object.keys(candidate);\n const hasIdentityKey = \"id\" in candidate || \"element\" in candidate;\n return (hasIdentityKey &&\n !hasResponseField(candidate) &&\n candidateKeys.every((key) => ELEMENT_IDENTITY_SESSION_KEYS.has(key)));\n}\nfunction isWrappedIdentityOnlyElementEcho(candidate) {\n return (candidate.data.length > 0 &&\n candidate.data.every((entry) => entry &&\n typeof entry === \"object\" &&\n !Array.isArray(entry) &&\n isElementIdentityOnlyPayload(entry)));\n}\nfunction mergeSessionEntry(existing, incoming) {\n const merged = { ...existing };\n for (const [key, value] of Object.entries(incoming)) {\n const previous = merged[key];\n merged[key] =\n isPlainObject(previous) && isPlainObject(value)\n ? mergeSessionEntry(previous, value)\n : value;\n }\n return merged;\n}\nexport function mergeElementIntoSession(itemId, previousItemSession, entryId, entry) {\n const previous = normalizeItemSessionContainer(previousItemSession, itemId);\n const nextData = [...previous.data];\n const existingIndex = nextData.findIndex((candidate) => {\n if (!candidate || typeof candidate !== \"object\")\n return false;\n return candidate.id === entryId;\n });\n if (existingIndex >= 0) {\n const existing = nextData[existingIndex];\n nextData[existingIndex] =\n existing && typeof existing === \"object\"\n ? mergeSessionEntry(existing, entry)\n : entry;\n }\n else {\n nextData.push(entry);\n }\n return {\n id: previous.id || itemId,\n data: nextData,\n };\n}\nexport function normalizeItemSessionChange(args) {\n const sessionDetail = (args.sessionDetail || {});\n const actualSession = sessionDetail &&\n typeof sessionDetail === \"object\" &&\n \"session\" in sessionDetail\n ? sessionDetail.session\n : args.sessionDetail;\n const safeItemId = typeof args.itemId === \"string\" && args.itemId\n ? args.itemId\n : typeof actualSession?.id ===\n \"string\"\n ? String(actualSession.id)\n : \"\";\n if (!actualSession || typeof actualSession !== \"object\") {\n return {\n itemId: safeItemId,\n session: null,\n intent: \"metadata-only\",\n component: getMetadataComponent(sessionDetail),\n complete: getMetadataComplete(sessionDetail),\n };\n }\n const candidate = actualSession;\n if (Array.isArray(candidate.data)) {\n const normalizedCandidate = normalizeItemSessionContainer(candidate, safeItemId);\n const previousNormalized = args.previousItemSession !== undefined\n ? normalizeItemSessionContainer(args.previousItemSession, safeItemId)\n : null;\n const previousForMetadataComparison = alignPreviousSessionIdForRendererSnapshot(normalizedCandidate, previousNormalized);\n const sessionDetailKeys = Object.keys(sessionDetail);\n const metadataWithSessionOnly = sessionDetailKeys.length > 0 &&\n sessionDetailKeys.every((key) => key === \"session\" ||\n key === \"complete\" ||\n key === \"component\" ||\n key === \"timestamp\" ||\n key === \"sourceRuntimeId\");\n const hasMetadataBeyondSession = sessionDetailKeys.some((key) => key !== \"session\");\n if (metadataWithSessionOnly &&\n hasMetadataBeyondSession &&\n previousForMetadataComparison &&\n areSessionContainersEqual(normalizedCandidate, previousForMetadataComparison)) {\n return {\n itemId: safeItemId,\n session: null,\n intent: \"metadata-only\",\n component: getMetadataComponent(sessionDetail),\n complete: getMetadataComplete(sessionDetail),\n };\n }\n if (metadataWithSessionOnly &&\n isWrappedIdentityOnlyElementEcho(normalizedCandidate)) {\n return {\n itemId: safeItemId,\n session: null,\n intent: \"metadata-only\",\n component: getMetadataComponent(sessionDetail),\n complete: getMetadataComplete(sessionDetail),\n };\n }\n return {\n itemId: safeItemId,\n session: normalizedCandidate,\n intent: \"replace-item-session\",\n component: getMetadataComponent(sessionDetail),\n complete: getMetadataComplete(sessionDetail),\n };\n }\n const candidateKeys = Object.keys(candidate);\n const isMetadataOnlyPayload = candidateKeys.length > 0 &&\n candidateKeys.every((key) => key === \"complete\" ||\n key === \"component\" ||\n key === \"timestamp\" ||\n key === \"sourceRuntimeId\");\n if (isMetadataOnlyPayload) {\n return {\n itemId: safeItemId,\n session: null,\n intent: \"metadata-only\",\n component: getMetadataComponent(sessionDetail, candidate),\n complete: getMetadataComplete(sessionDetail, candidate),\n };\n }\n if (isElementIdentityOnlyPayload(candidate)) {\n return {\n itemId: safeItemId,\n session: null,\n intent: \"metadata-only\",\n component: getMetadataComponent(sessionDetail, candidate),\n complete: getMetadataComplete(sessionDetail, candidate),\n };\n }\n const component = getMetadataComponent(sessionDetail, candidate) ?? \"response\";\n const elementEntryId = typeof candidate.id === \"string\" && candidate.id ? candidate.id : component;\n const merged = mergeElementIntoSession(safeItemId, args.previousItemSession, elementEntryId, { id: elementEntryId, ...candidate });\n return {\n itemId: safeItemId,\n session: merged,\n intent: \"merge-element-session\",\n component,\n complete: getMetadataComplete(sessionDetail, candidate),\n };\n}\nfunction hostContainerEntries(hostContainer) {\n if (!isPlainObject(hostContainer)) {\n return null;\n }\n // A frozen container is not a live view of anything, and a shared immutable\n // default (one object handed to every item) must never take one item's\n // entries. Both say the same thing: do not project here.\n if (Object.isFrozen(hostContainer)) {\n return null;\n }\n const existing = hostContainer.data;\n if (Array.isArray(existing)) {\n return Object.isFrozen(existing) ? null : existing;\n }\n if (existing === undefined || existing === null) {\n const created = [];\n hostContainer.data = created;\n return created;\n }\n return null;\n}\nfunction sessionEntryId(value) {\n if (!isPlainObject(value)) {\n return null;\n }\n const id = value.id;\n return typeof id === \"string\" && id.length > 0 ? id : null;\n}\n/**\n * Create the bare `{ id }` entry `<pie-player>` created at render time, for each\n * element the item declares. A host that indexes `data[0]` before the learner\n * has answered finds an entry instead of `undefined`.\n *\n * Only the host's container gets these. The authoritative session stays empty\n * until an element reports something, so an untouched item still saves nothing.\n */\nexport function ensureHostSessionEntries(hostContainer, entryIds) {\n const entries = hostContainerEntries(hostContainer);\n if (!entries) {\n return false;\n }\n let wrote = false;\n for (const id of entryIds) {\n if (typeof id !== \"string\" || id.length === 0) {\n continue;\n }\n if (entries.some((entry) => sessionEntryId(entry) === id)) {\n continue;\n }\n entries.push({ id });\n wrote = true;\n }\n return wrote;\n}\n/**\n * Keep the container a host handed in as a live view of the session, the\n * contract `<pie-player>` had: `findOrAddSession` pushed an entry per element\n * into the host's own `data` array and the element mutated that entry in place,\n * so a host read the response off its own object. `ItemController` owns the\n * session here, so this runs one way and never reads the container back.\n *\n * The array and the entry objects keep their identity, for a host holding a\n * reference into `data`. Entries this player did not produce are left alone: in\n * a section the host's container spans every item and an item player sees one.\n *\n * Inside an entry the player's own session wins, and a key it does not carry is\n * removed - a cleared response has to clear here too, and the entry belongs to\n * the element, as it did under `<pie-player>`. A host keeping its own\n * annotations on an entry keeps them beside it, not inside it.\n */\nexport function projectSessionIntoHostContainer(hostContainer, liveSession) {\n const entries = hostContainerEntries(hostContainer);\n if (!entries || !isPlainObject(hostContainer)) {\n return false;\n }\n const live = normalizeItemSessionContainer(liveSession);\n let wrote = false;\n // The host owns the container id; fill it only when there is nothing there.\n if (typeof hostContainer.id !== \"string\") {\n hostContainer.id = live.id;\n wrote = true;\n }\n for (const nextEntry of live.data) {\n const id = sessionEntryId(nextEntry);\n if (!id || !isPlainObject(nextEntry)) {\n continue;\n }\n const target = entries.find((entry) => sessionEntryId(entry) === id);\n if (!isPlainObject(target)) {\n entries.push({ ...nextEntry });\n wrote = true;\n continue;\n }\n for (const key of Object.keys(target)) {\n if (!(key in nextEntry)) {\n delete target[key];\n wrote = true;\n }\n }\n for (const [key, value] of Object.entries(nextEntry)) {\n if (target[key] !== value) {\n target[key] = value;\n wrote = true;\n }\n }\n }\n return wrote;\n}\n","/**\n * PIE element override helpers.\n *\n * Used to:\n * - parse overrides from URL params\n * - apply overrides to a PIE config (server-side or client-side)\n * - build URLs/params for sharing override state\n */\nimport { cloneDeep } from \"../object/index.js\";\nimport { createPieLogger, isGlobalDebugEnabled } from \"./logger.js\";\nimport { parsePackageName } from \"./utils.js\";\nimport { toPackageVersionedTag } from \"./versioned-tag.js\";\nconst logger = createPieLogger(\"pie-overrides\", () => isGlobalDebugEnabled());\n/**\n * Apply element overrides to a PIE config\n * @param config The original PIE config\n * @param elementOverrides Map of element packages to override versions\n * @returns Updated config with overridden elements\n */\nexport function applyElementOverrides(config, elementOverrides) {\n if (!config ||\n !elementOverrides ||\n Object.keys(elementOverrides).length === 0) {\n return config;\n }\n // pie-item contract compatibility: runtime version overrides have historically\n // returned a cloned config with tags renamed for the selected package version.\n const updatedConfig = cloneDeep(config);\n // Check if there are elements to override\n if (!updatedConfig.elements) {\n return updatedConfig;\n }\n const matchedPackages = new Set();\n const tagMappings = new Map();\n const elements = {};\n for (const [elementKey, elementPackageValue] of Object.entries(updatedConfig.elements)) {\n const elementPackageStr = String(elementPackageValue);\n try {\n const parsed = parsePackageName(elementPackageStr);\n const overrideVersion = elementOverrides[parsed.name];\n if (overrideVersion === undefined) {\n elements[elementKey] = elementPackageValue;\n continue;\n }\n matchedPackages.add(parsed.name);\n const packageBase = parsed.path\n ? `${parsed.name}/${parsed.path}`\n : parsed.name;\n const overriddenPackage = `${packageBase}@${String(overrideVersion).trim()}`;\n const overriddenTag = toPackageVersionedTag(elementKey, overriddenPackage);\n elements[overriddenTag] = overriddenPackage;\n if (overriddenTag !== elementKey) {\n tagMappings.set(elementKey, overriddenTag);\n }\n }\n catch {\n logger.debug(`Couldn't parse element package value: ${elementPackageStr}`);\n elements[elementKey] = elementPackageValue;\n }\n }\n updatedConfig.elements = elements;\n if (tagMappings.size > 0) {\n if (updatedConfig.markup) {\n const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const sourceTags = [...tagMappings.keys()]\n .sort((left, right) => right.length - left.length)\n .map(escapeRegExp)\n .join(\"|\");\n const exactTag = new RegExp(`(<\\\\/?)(${sourceTags})(?=[\\\\t\\\\n\\\\f\\\\r />])`, \"g\");\n updatedConfig.markup = String(updatedConfig.markup).replace(exactTag, (_match, opening, tagName) => `${opening}${tagMappings.get(tagName) ?? tagName}`);\n }\n if (Array.isArray(updatedConfig.models)) {\n updatedConfig.models = updatedConfig.models.map((model) => {\n const overriddenTag = tagMappings.get(model?.element);\n return overriddenTag ? { ...model, element: overriddenTag } : model;\n });\n }\n }\n for (const packageName of Object.keys(elementOverrides)) {\n if (!matchedPackages.has(packageName)) {\n logger.debug(`No matching element found for package ${packageName}`);\n }\n }\n return updatedConfig;\n}\n/**\n * Apply element version overrides without renaming custom element tags.\n *\n * Unlike `applyElementOverrides`, this helper keeps `config.markup` and\n * `config.elements` keys intact and only updates each matching element package\n * value to the requested version. This is intended for unified `pie-item-player`\n * flows that preserve authored tags at the override boundary; `makeUniqueTags`\n * later derives the effective per-version runtime namespace on a cloned config.\n */\nexport function applyElementVersionOverridesPreserveTags(config, elementOverrides) {\n if (!config ||\n !elementOverrides ||\n Object.keys(elementOverrides).length === 0) {\n return config;\n }\n const updatedConfig = cloneDeep(config);\n if (!updatedConfig.elements || typeof updatedConfig.elements !== \"object\") {\n return updatedConfig;\n }\n for (const [elementKey, elementPackageValue] of Object.entries(updatedConfig.elements)) {\n const elementPackageStr = String(elementPackageValue);\n try {\n const parsed = parsePackageName(elementPackageStr);\n const nextVersion = elementOverrides[parsed.name];\n if (!nextVersion)\n continue;\n const packageBase = parsed.path\n ? `${parsed.name}/${parsed.path}`\n : parsed.name;\n updatedConfig.elements[elementKey] =\n `${packageBase}@${String(nextVersion).trim()}`;\n }\n catch {\n logger.debug(`Couldn't parse element package value: ${elementPackageStr}`);\n }\n }\n return updatedConfig;\n}\n/**\n * Parse element overrides from URL search params.\n * @returns Map of element package names to versions\n */\nexport function parseElementOverridesFromUrl(searchParams) {\n const overrides = {};\n // Look for parameters with the pattern pie-overrides[packageName]=version\n for (const [key, value] of searchParams.entries()) {\n if (key.startsWith(\"pie-overrides[\") && key.endsWith(\"]\")) {\n // Extract the package name from between the brackets\n const packageName = key.substring(14, key.length - 1);\n // Ensure the package name format is correct (including @)\n const normalizedPackageName = packageName.startsWith(\"@\")\n ? packageName\n : `@${packageName}`;\n overrides[normalizedPackageName] = value;\n }\n }\n return overrides;\n}\n/**\n * Parse element overrides from current window URL (client-only).\n */\nexport function parseElementOverridesFromCurrentUrl() {\n if (typeof window === \"undefined\") {\n return {};\n }\n const url = new URL(window.location.href);\n return parseElementOverridesFromUrl(url.searchParams);\n}\n/**\n * Generate a URL parameter string for an element override\n */\nexport function formatElementOverrideParam(packageName, version) {\n // Normalize the package name for the parameter key (strip leading @)\n const normalizedPackageName = packageName.startsWith(\"@\")\n ? packageName.substring(1)\n : packageName;\n return `pie-overrides[${normalizedPackageName}]=${encodeURIComponent(version)}`;\n}\n/**\n * Creates a URL that preserves existing overrides and adds or updates a new one.\n */\nexport function addOrUpdateOverrideInUrl(url, packageName, version) {\n const params = new URLSearchParams(url.search);\n // Remove @ if present for consistency in URL\n const normalizedPackageName = packageName.startsWith(\"@\")\n ? packageName.substring(1)\n : packageName;\n // Set the new override\n params.set(`pie-overrides[${normalizedPackageName}]`, version);\n // Create the new URL\n const newUrl = new URL(url.pathname, url.origin);\n newUrl.search = params.toString();\n return newUrl.toString();\n}\n/**\n * Extract package information from a package string.\n * Intended for UI display.\n */\nexport function extractPackageInfo(packageStr) {\n try {\n const parsed = parsePackageName(String(packageStr));\n return {\n name: parsed.name,\n version: parsed.version || \"unknown\",\n displayName: parsed.name.split(\"/\").pop() || parsed.name,\n };\n }\n catch {\n const s = String(packageStr);\n return {\n name: s,\n version: \"unknown\",\n displayName: s.split(\"/\").pop() || s,\n };\n }\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21],"mappings":"AAUA,SAAS,EAAc,GAAK;CACxB,IAAI;EAEA,IAAM,IAAA;;;;;;EAAuB,EAAA;EAC7B,IAAI,OAAO,KAAM,YAAY,EAAE,SAAS,GACpC,OAAO;CACf,QACM,CAAE;AAEZ;AACmC,OAAO,SAAW,OAAe,OAAO,0BACvE,EAAc,2BAA2B,GAEV,OAAO,SAAW,OAAe,OAAO,0BACvE,EAAc,2BAA2B;AAD7C,ICHa,IAAb,MAAyC;CACrC,cAAc;CACd;CAgBA,WAAW,GAAO,GAAY;EAM1B,IAJI,CAAC,KAAK,iBAAiB,cAAc,GAAO,CA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,KAAK,EAAa,CAAO;EACnE,IAAI,MAAW,WAAW;GACtB,IAAI,EAAQ,IAAI,CAAK,GAAG;IACpB,EAAa;KAAE,MAAM;KAAS,IAAI;KAAO,QAAQ;IAAY,CAAC;IAC9D;GACJ;GACA,IAAI,IAAc,GAAgB;IAC9B,EAAa;KAAE,MAAM;KAAS,IAAI;KAAO,QAAQ;IAAW,CAAC;IAC7D;GACJ;GACA,IAAI,CAAC,EAAc,IAAI,CAAK,GAAG;IAI3B,IAAI,EAAQ,IAAI,CAAK,GACjB;IAEJ,AADA,EAAQ,IAAI,CAAK,GACjB,EAAW,GAAO,SAAS;IAC3B;GACJ;GAIA,AAHA,EAAkB,CAAK,GACvB,EAAQ,IAAI,CAAK,GACjB,IAAU,GACV,EAAW,GAAO,SAAS;GAC3B;EACJ;EAKA,IAAI,MAAW,UAAU;GAIrB,AAHA,EAAkB,CAAK,GACvB,EAAQ,IAAI,CAAK,GACjB,IAAU,GACV,EAAW,GAAO,QAAQ;GAC1B;EACJ;EAGI,EAAQ,IAAI,CAAK,MAErB,EAAQ,IAAI,CAAK,GACjB,EAAW,GAAO,SAAS;CAC/B;CACA,SAAS,EAAM,GAAM;EAGjB,AAFA,IAAU,MACV,EAAQ,MAAM,GACV,MACA,IAAY,EAAK,WACjB,IAAY,EAAK;CAEzB;CACA,SAAS,IAAa;EAClB,OAAO;CACX;CACA,OAAO;EAAE;EAAO;EAAO;CAAW;AACtC;ACjG8C,CAG1C,mBAAG,IATgC,IAAI;CACvC;CACA;CACA;CACA;AACJ,CAIgC,CAChC,GCCe,EAAgB,uBAAuB,EAAqB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region __vite-optional-peer-dep:@pie-players/pie-calculator-geogebra:@pie-players/pie-assessment-toolkit
|
|
2
|
+
throw Error("Could not resolve \"@pie-players/pie-calculator-geogebra\" imported by \"@pie-players/pie-assessment-toolkit\". Is it installed?");
|
|
3
|
+
//#endregion
|
|
4
|
+
|
|
5
|
+
//# sourceMappingURL=pie-assessment-toolkit-Cruxm385.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie-assessment-toolkit-Cruxm385.js","names":[],"sources":["../__vite-optional-peer-dep:@pie-players/pie-calculator-geogebra:@pie-players/pie-assessment-toolkit"],"sourcesContent":["export default {};\nthrow new Error(`Could not resolve \"@pie-players/pie-calculator-geogebra\" imported by \"@pie-players/pie-assessment-toolkit\". Is it installed?`)"],"mappings":";AACA,MAAU,MAAM,kIAA8H"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region __vite-optional-peer-dep:@pie-players/pie-calculator-cortex:@pie-players/pie-assessment-toolkit
|
|
2
|
+
throw Error("Could not resolve \"@pie-players/pie-calculator-cortex\" imported by \"@pie-players/pie-assessment-toolkit\". Is it installed?");
|
|
3
|
+
//#endregion
|
|
4
|
+
|
|
5
|
+
//# sourceMappingURL=pie-assessment-toolkit-DJfg6laX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie-assessment-toolkit-DJfg6laX.js","names":[],"sources":["../__vite-optional-peer-dep:@pie-players/pie-calculator-cortex:@pie-players/pie-assessment-toolkit"],"sourcesContent":["export default {};\nthrow new Error(`Could not resolve \"@pie-players/pie-calculator-cortex\" imported by \"@pie-players/pie-assessment-toolkit\". Is it installed?`)"],"mappings":";AACA,MAAU,MAAM,gIAA4H"}
|