@pie-qti/player-elements 0.1.11 → 0.1.12
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/{auto-render-C11bWQ2g.js → auto-render-CgE10dG_.js} +2664 -2799
- package/dist/auto-render-CgE10dG_.js.map +1 -0
- package/dist/define-BHSpIM9S.js +38106 -0
- package/dist/define-BHSpIM9S.js.map +1 -0
- package/dist/index.js +2 -3
- package/dist/{mathlive.min-CAPebTxM-B2nv52My.js → mathlive.min-ClqhKA_b-C3M2nRa3.js} +3978 -3973
- package/dist/mathlive.min-ClqhKA_b-C3M2nRa3.js.map +1 -0
- package/dist/{plugins-B5K6bN6Q.js → plugins-BzziMseN.js} +9555 -9374
- package/dist/plugins-BzziMseN.js.map +1 -0
- package/dist/register.js +1 -1
- package/dist/register.js.map +1 -1
- package/package.json +4 -4
- package/dist/auto-render-C11bWQ2g.js.map +0 -1
- package/dist/define-Cv9Vn4ck.js +0 -15942
- package/dist/define-Cv9Vn4ck.js.map +0 -1
- package/dist/element-C5Y0zSz-.js +0 -21938
- package/dist/element-C5Y0zSz-.js.map +0 -1
- package/dist/mathlive.min-CAPebTxM-B2nv52My.js.map +0 -1
- package/dist/plugins-B5K6bN6Q.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define-Cv9Vn4ck.js","names":["parseXml","getAttr","resolveCheckedPackagePath","toCanonicalQtiName","parseXml","resolveQtiRelativePath","push","#blocking_pending","#skipped_branches","#is_deferred","#dirty_effects","#maybe_dirty_effects","#roots","#traverse","#defer_effects","#pending","#commit_callbacks","#deferred","#process","#commit","#discard_callbacks","#decrement_queued","#effect_pending","#local_pending_count","#anchor","#props","#children","#effect","#hydrate_open","#hydrate_failed_content","#hydrate_pending_content","#hydrate_resolved_content","#render","#main_effect","#failed_effect","#pending_effect","#offscreen_fragment","#run","#pending_count","#resolve","#dirty_effects","#maybe_dirty_effects","#update_pending_count","#pending_count_update_queued","#effect_pending_subscriber","append","#transition","#batches","#onscreen","#outroing","#offscreen","#commit","#discard","append_styles","whitespace","prop","#instance","#events","#state","#itemIdentifiers","#sessionController","#initializeItemSessions","#restoreItemSessionsFromState","#restoreItemResultsFromScores","#itemSessionStateSnapshot","#itemResults","CharCodes","voidElements","Parser","isTag","Text","Comment","CDATA","Node","Text","Comment","Document","Element","isTag","isTagRaw","Document","Element","Text","Comment","ElementType.Root","ElementType.Doctype","ElementType.Directive","ElementType.Comment","ElementType.CDATA","ElementType.Script","ElementType.Style","ElementType.Tag","ElementType.Text","renderHTML","getText","isTag","getChildren","getParent","getSiblings","getAttributeValue","hasAttrib","getName","nextElementSibling","isTag","append","findOne","isTag","existsOne","findAll","isTag","findOne","removeSubsets","fetch","Parser","customElements","attributeChangedCallback","HTMLParser2","Node","EventTarget","Attr","Node","String","CharacterData","Node","String","CDATASection","CharacterData","Comment","CharacterData","boolbase","parse","compile","boolbase","compile","parse","getNCheck","boolbase","boolbase","is","parse","compile","parse","sortRules","boolbase","DomUtils","compileRaw","boolbase","CSSselect.compile","CSSselect.is","Text","CharacterData","Node","Text","DocumentFragment","DocumentType","Node","refs","uhyphen","handler","Attr","handler","uhyphen","ShadowRoot","Element","String","Text","Event","Attr","ShadowRoot","SVGElement","Element","String","_Attr","_CDATASection","_CharacterData","Comment","_Comment","_DocumentFragment","_DocumentType","Element","_Element","Node","_Node","_ShadowRoot","Text","_Text","_SVGElement","HTMLElement","Element","Event","tagName","HTMLElement","HTMLElement","HTMLElement","tagName","HTMLElement","tagName","HTMLElement","HTMLElement","HTMLElement","HTMLElement","tagName","HTMLElement","HTMLElement","HTMLElement","HTMLElement","HTMLElement","HTMLElement","HTMLElement","HTMLElement","HTMLElement","HTMLElement","HTMLElement","tagName","HTMLElement","HTMLElement","HTMLMediaElement","HTMLElement","HTMLElement","tagName","HTMLElement","HTMLElement","HTMLElement","Canvas","tagName","HTMLElement","HTMLElement","tagName","HTMLElement","HTMLElement","HTMLElement","HTMLElement","HTMLElement","tagName","HTMLElement","HTMLElement","HTMLElement","HTMLElement","tagName","HTMLElement","HTMLElement","tagName","HTMLElement","HTMLElement","HTMLElement","HTMLElement","tagName","HTMLElement","HTMLElement","tagName","HTMLElement","tagName","HTMLElement","HTMLElement","tagName","HTMLElement","HTMLElement","HTMLElement","tagName","HTMLElement","HTMLElement","HTMLElement","HTMLElement","HTMLElement","tagName","HTMLElement","HTMLElement","HTMLElement","HTMLElement","HTMLElement","HTMLElement","HTMLElement","HTMLElement","CustomEvent","Event","Event","SVGElement","window","Document","EventTarget","DocumentType","Attr","CDATASection","Comment","DocumentFragment","Element","Text","create","Event","CustomEvent","SVGElement","HTMLElement","Document","Document","Document","DOMParser","_Document","#mountController","#controller","#allowMount","#assessmentTestXml","#assessmentId","#candidateId","#itemBaseUrl","#items","#config","#security","#syncFromQti","#loadSeq","#toSecureAssessment","#backend","#initSession"],"sources":["../src/constants.ts","../../item-player/dist/core/ComponentRegistry.js","../../item-player/dist/core/parsingLimits.js","../../item-player/dist/interactions/associate/extractor.js","../../item-player/dist/interactions/choice/extractor.js","../../item-player/dist/interactions/custom/extractor.js","../../item-player/dist/interactions/drawing/extractor.js","../../item-player/dist/interactions/end-attempt/extractor.js","../../item-player/dist/interactions/extended-text/extractor.js","../../item-player/dist/interactions/gap-match/extractor.js","../../item-player/dist/interactions/graphic-associate/extractor.js","../../item-player/dist/interactions/graphic-gap-match/extractor.js","../../item-player/dist/interactions/graphic-order/extractor.js","../../item-player/dist/interactions/hotspot/extractor.js","../../item-player/dist/core/urlPolicy.js","../../item-player/dist/core/sanitizer.js","../../item-player/dist/interactions/hottext/extractor.js","../../item-player/dist/interactions/inline-choice/extractor.js","../../item-player/dist/interactions/match/extractor.js","../../item-player/dist/interactions/media/extractor.js","../../item-player/dist/interactions/order/extractor.js","../../item-player/dist/interactions/position-object/extractor.js","../../item-player/dist/interactions/select-point/extractor.js","../../item-player/dist/interactions/slider/extractor.js","../../item-player/dist/interactions/text-entry/extractor.js","../../item-player/dist/interactions/upload/extractor.js","../../item-player/dist/interactions/modules.js","../../item-player/dist/document/AssessmentItemDocument.js","../../item-player/dist/extraction/types.js","../../item-player/dist/extraction/ExtractionRegistry.js","../../item-player/dist/extraction/utils.js","../../item-player/dist/extraction/createContext.js","../../item-player/dist/core/trustedTypes.js","../../item-player/dist/extraction/interactionSecurity.js","../../item-player/dist/extraction/interactionExtractionPipeline.js","../../item-player/dist/core/random.js","../../item-player/dist/pnp/applyPnp.js","../../item-player/dist/catalog/catalogExtractor.js","../../item-player/dist/catalog/catalogLookup.js","../../item-player/dist/pci/types.js","../../item-player/dist/pci/PciHost.js","../../item-player/dist/core/Player.js","../../../node_modules/.bun/node-html-parser@6.1.13/node_modules/node-html-parser/dist/nodes/node.js","../../../node_modules/.bun/node-html-parser@6.1.13/node_modules/node-html-parser/dist/nodes/type.js","../../../node_modules/.bun/node-html-parser@6.1.13/node_modules/node-html-parser/dist/nodes/comment.js","../../../node_modules/.bun/node-html-parser@6.1.13/node_modules/node-html-parser/dist/back.js","../../../node_modules/.bun/node-html-parser@6.1.13/node_modules/node-html-parser/dist/matcher.js","../../../node_modules/.bun/node-html-parser@6.1.13/node_modules/node-html-parser/dist/void-tag.js","../../../node_modules/.bun/node-html-parser@6.1.13/node_modules/node-html-parser/dist/nodes/text.js","../../../node_modules/.bun/node-html-parser@6.1.13/node_modules/node-html-parser/dist/nodes/html.js","../../../node_modules/.bun/node-html-parser@6.1.13/node_modules/node-html-parser/dist/parse.js","../../../node_modules/.bun/node-html-parser@6.1.13/node_modules/node-html-parser/dist/valid.js","../../../node_modules/.bun/node-html-parser@6.1.13/node_modules/node-html-parser/dist/index.js","../../ims-cp-core/dist/package-path.js","../../ims-cp-core/dist/qti3-shared-content.js","../../assessment-player/dist/integration/assessment-item-scorer.js","../../assessment-player/dist/integration/ReferenceBackendAdapter.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/disclose-version.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/constants.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/shared/utils.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/constants.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/shared/errors.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/errors.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/warnings.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/hydration.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/equality.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/flags/index.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dev/tracing.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/shared/dev.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/context.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/task.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/error-handling.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/status.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/utils.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/store.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/batch.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/reactivity/create-subscriber.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/blocks/boundary.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/async.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/deriveds.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/sources.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/proxy.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dev/equality.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/operations.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/effects.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/legacy.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/runtime.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/elements/events.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/reconciler.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/template.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/utils.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/render.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/blocks/branches.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/blocks/snippet.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/index-client.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dev/css.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/blocks/if.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/blocks/each.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/blocks/html.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/css.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/elements/actions.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/shared/attributes.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/elements/class.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/elements/style.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/elements/attributes.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/elements/bindings/this.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/props.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/legacy/legacy-client.js","../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/elements/custom-element.js","../../assessment-player/src/core/ItemSessionController.ts","../../assessment-player/src/core/AssessmentSessionCoordinator.ts","../../assessment-player/src/core/NavigationManager.ts","../../assessment-player/src/core/TimeManager.ts","../../assessment-player/src/core/AssessmentPlayer.ts","../../assessment-player/src/components/AccessibilityAnnouncer.svelte","../../assessment-player/src/components/SectionMenu.svelte","../../assessment-player/src/components/AssessmentHeader.svelte","../../assessment-player/src/components/ItemRenderer.svelte","../../assessment-player/src/components/NavigationBar.svelte","../../default-components/dist/shared/actions/typesetAction.js","../../assessment-player/src/components/RubricDisplay.svelte","../../assessment-player/src/components/SplitPaneResizer.svelte","../../assessment-player/src/components/TestFeedback.svelte","../../assessment-player/src/components/AssessmentShell.svelte","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/symbols.js","../../../node_modules/.bun/entities@6.0.1/node_modules/entities/dist/esm/generated/decode-data-html.js","../../../node_modules/.bun/entities@6.0.1/node_modules/entities/dist/esm/generated/decode-data-xml.js","../../../node_modules/.bun/entities@6.0.1/node_modules/entities/dist/esm/decode-codepoint.js","../../../node_modules/.bun/entities@6.0.1/node_modules/entities/dist/esm/decode.js","../../../node_modules/.bun/htmlparser2@10.0.0/node_modules/htmlparser2/dist/esm/Tokenizer.js","../../../node_modules/.bun/htmlparser2@10.0.0/node_modules/htmlparser2/dist/esm/Parser.js","../../../node_modules/.bun/domelementtype@2.3.0/node_modules/domelementtype/lib/esm/index.js","../../../node_modules/.bun/domhandler@5.0.3/node_modules/domhandler/lib/esm/node.js","../../../node_modules/.bun/domhandler@5.0.3/node_modules/domhandler/lib/esm/index.js","../../../node_modules/.bun/entities@4.5.0/node_modules/entities/lib/esm/escape.js","../../../node_modules/.bun/dom-serializer@2.0.0/node_modules/dom-serializer/lib/esm/foreignNames.js","../../../node_modules/.bun/dom-serializer@2.0.0/node_modules/dom-serializer/lib/esm/index.js","../../../node_modules/.bun/domutils@3.2.2/node_modules/domutils/lib/esm/stringify.js","../../../node_modules/.bun/domutils@3.2.2/node_modules/domutils/lib/esm/traversal.js","../../../node_modules/.bun/domutils@3.2.2/node_modules/domutils/lib/esm/manipulation.js","../../../node_modules/.bun/domutils@3.2.2/node_modules/domutils/lib/esm/querying.js","../../../node_modules/.bun/domutils@3.2.2/node_modules/domutils/lib/esm/legacy.js","../../../node_modules/.bun/domutils@3.2.2/node_modules/domutils/lib/esm/helpers.js","../../../node_modules/.bun/domutils@3.2.2/node_modules/domutils/lib/esm/feeds.js","../../../node_modules/.bun/domutils@3.2.2/node_modules/domutils/lib/esm/index.js","../../../node_modules/.bun/htmlparser2@10.0.0/node_modules/htmlparser2/dist/esm/index.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/constants.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/object.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/utils.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/shadow-roots.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/custom-element-registry.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/parse-from-string.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/register-html-class.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/jsdon.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/mutation-observer.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/attributes.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/event-target.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/node-list.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/node.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/text-escaper.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/attr.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/node.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/mixin/non-document-type-child-node.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/mixin/child-node.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/character-data.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/cdata-section.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/comment.js","../../../node_modules/.bun/css-select@5.2.2/node_modules/css-select/lib/esm/sort.js","../../../node_modules/.bun/css-select@5.2.2/node_modules/css-select/lib/esm/attributes.js","../../../node_modules/.bun/nth-check@2.1.1/node_modules/nth-check/lib/esm/parse.js","../../../node_modules/.bun/nth-check@2.1.1/node_modules/nth-check/lib/esm/compile.js","../../../node_modules/.bun/nth-check@2.1.1/node_modules/nth-check/lib/esm/index.js","../../../node_modules/.bun/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/filters.js","../../../node_modules/.bun/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/pseudos.js","../../../node_modules/.bun/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/aliases.js","../../../node_modules/.bun/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/subselects.js","../../../node_modules/.bun/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/index.js","../../../node_modules/.bun/css-select@5.2.2/node_modules/css-select/lib/esm/general.js","../../../node_modules/.bun/css-select@5.2.2/node_modules/css-select/lib/esm/compile.js","../../../node_modules/.bun/css-select@5.2.2/node_modules/css-select/lib/esm/index.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/matches.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/text.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/mixin/parent-node.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/mixin/non-element-parent-node.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/document-fragment.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/document-type.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/mixin/inner-html.js","../../../node_modules/.bun/uhyphen@0.2.0/node_modules/uhyphen/esm/index.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/dom/string-map.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/dom/token-list.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/css-style-declaration.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/event.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/named-node-map.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/shadow-root.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/svg/element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/facades.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/template-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/html-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/text-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/script-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/frame-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/i-frame-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/object-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/head-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/body-element.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/StyleSheet.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSRule.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSStyleRule.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSStyleSheet.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/MediaList.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSImportRule.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSGroupingRule.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSConditionRule.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSMediaRule.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSSupportsRule.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSFontFaceRule.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSHostRule.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSKeyframeRule.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSKeyframesRule.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSValue.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSValueExpression.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/MatcherList.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSDocumentRule.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/parse.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/CSSStyleDeclaration.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/clone.js","../../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/index.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/style-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/time-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/field-set-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/embed-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/hr-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/progress-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/paragraph-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/table-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/frame-set-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/li-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/base-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/data-list-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/input-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/param-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/media-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/audio-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/heading-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/directory-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/quote-element.js","../__vite-optional-peer-dep:canvas:linkedom","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/commonjs/canvas-shim.cjs","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/commonjs/canvas.cjs","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/canvas-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/legend-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/option-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/span-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/meter-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/video-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/table-cell-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/title-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/output-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/table-row-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/data-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/menu-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/select-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/br-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/button-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/map-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/opt-group-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/d-list-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/text-area-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/font-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/div-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/link-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/slot-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/form-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/image-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/pre-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/u-list-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/meta-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/picture-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/area-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/o-list-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/table-caption-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/anchor-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/label-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/unknown-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/mod-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/details-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/source-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/track-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/marquee-element.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/html-classes.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/mime.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/custom-event.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/input-event.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/image.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/range.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/tree-walker.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/interface/document.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/html/document.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/svg/document.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/xml/document.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/dom/parser.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/shared/parse-json.js","../../../node_modules/.bun/linkedom@0.18.12/node_modules/linkedom/esm/index.js","../src/qti/parseAssessmentTest.ts","../src/qti/resolveItems.ts","../src/utils/json.ts","../src/elements/BaseSvelteMountElement.ts","../src/elements/QtiAssessmentPlayerElement.ts","../src/elements/QtiItemPlayerElement.ts","../src/define.ts"],"sourcesContent":["export const QTI_ITEM_PLAYER_TAG = 'pie-qti-item-player';\nexport const QTI_ASSESSMENT_PLAYER_TAG = 'pie-qti-assessment-player';\n\n\n","/**\n * Component Registry for Web Component-based Interaction Rendering\n *\n * Provides a pluggable system for registering web components to render\n * different QTI interaction types. Uses priority-based dispatch similar to the\n * ExtractionRegistry, but for framework-agnostic web components.\n */\nconst DEFAULT_COMPONENT_TAGS_BY_TYPE = {\n choiceInteraction: { name: 'default-choice', tagName: 'pie-qti-choice' },\n sliderInteraction: { name: 'default-slider', tagName: 'pie-qti-slider' },\n orderInteraction: { name: 'default-order', tagName: 'pie-qti-order' },\n matchInteraction: { name: 'default-match', tagName: 'pie-qti-match' },\n associateInteraction: { name: 'default-associate', tagName: 'pie-qti-associate' },\n gapMatchInteraction: { name: 'default-gap-match', tagName: 'pie-qti-gap-match' },\n hotspotInteraction: { name: 'default-hotspot', tagName: 'pie-qti-hotspot' },\n hottextInteraction: { name: 'default-hottext', tagName: 'pie-qti-hottext' },\n mediaInteraction: { name: 'default-media', tagName: 'pie-qti-media' },\n customInteraction: { name: 'default-custom', tagName: 'pie-qti-custom' },\n endAttemptInteraction: { name: 'default-end-attempt', tagName: 'pie-qti-end-attempt' },\n positionObjectInteraction: { name: 'default-position-object', tagName: 'pie-qti-position-object' },\n graphicGapMatchInteraction: { name: 'default-graphic-gap-match', tagName: 'pie-qti-graphic-gap-match' },\n graphicOrderInteraction: { name: 'default-graphic-order', tagName: 'pie-qti-graphic-order' },\n graphicAssociateInteraction: { name: 'default-graphic-associate', tagName: 'pie-qti-graphic-associate' },\n selectPointInteraction: { name: 'default-select-point', tagName: 'pie-qti-select-point' },\n extendedTextInteraction: { name: 'default-extended-text', tagName: 'pie-qti-extended-text' },\n uploadInteraction: { name: 'default-upload', tagName: 'pie-qti-upload' },\n drawingInteraction: { name: 'default-drawing', tagName: 'pie-qti-drawing' },\n catalogPopup: { name: 'default-catalog-popup', tagName: 'pie-qti-catalog-popup' },\n};\n/**\n * Registry for web components that render QTI interactions\n */\nexport class ComponentRegistry {\n constructor() {\n this.components = new Map();\n this.definedElements = new Set();\n }\n /**\n * Register a web component for an interaction type with priority-based dispatch\n *\n * @param type - QTI interaction type (e.g., 'choiceInteraction', 'textEntryInteraction')\n * @param config - Component configuration with priority and canHandle predicate\n *\n * @example\n * // Custom rating choice component with high priority\n * registry.register('choiceInteraction', {\n * name: 'rating-choice',\n * priority: 100,\n * description: 'Star rating interactions',\n * canHandle: (data) => data.interactionClasses?.includes('rating-interaction'),\n * tagName: 'custom-rating-choice',\n * componentClass: RatingChoiceInteraction,\n * autoRegister: true\n * });\n *\n * // Default choice component\n * registry.register('choiceInteraction', {\n * name: 'standard-choice',\n * tagName: 'qti-choice-interaction'\n * });\n */\n register(type, config) {\n // Validate tag name\n if (!config.tagName.includes('-')) {\n throw new Error(`Invalid tag name '${config.tagName}'. ` +\n `Web component tag names must contain a hyphen.`);\n }\n // Auto-register custom element if requested\n if (config.componentClass && config.autoRegister !== false) {\n if (!this.definedElements.has(config.tagName)) {\n if (!customElements.get(config.tagName)) {\n customElements.define(config.tagName, config.componentClass);\n }\n this.definedElements.add(config.tagName);\n }\n }\n // Get or create component array for this type\n let components = this.components.get(type);\n if (!components) {\n components = [];\n this.components.set(type, components);\n }\n // Add normalized component and sort by priority (highest first)\n components.push(this.createRegisteredComponent(config));\n components.sort((a, b) => b.config.priority - a.config.priority);\n }\n createRegisteredComponent(config) {\n return {\n config: {\n ...config,\n priority: config.priority ?? 0,\n canHandle: config.canHandle ?? (() => true),\n },\n };\n }\n /**\n * Get a web component tag name for an interaction type\n * Evaluates canHandle predicates in priority order\n *\n * @param data - Interaction data\n * @returns Web component tag name (e.g., 'qti-choice-interaction')\n * @throws Error if no component matches\n */\n getTagName(data) {\n const components = this.components.get(data.type);\n if (!components || components.length === 0) {\n throw new Error(`No component registered for '${data.type}' interaction. ` +\n `Available types: ${Array.from(this.components.keys()).join(', ')}`);\n }\n // Evaluate canHandle in priority order\n for (const { config } of components) {\n try {\n if (config.canHandle(data)) {\n return config.tagName;\n }\n }\n catch (error) {\n // Log but continue to next component\n console.warn(`canHandle() failed for '${config.name}' component:`, error);\n }\n }\n // No component matched\n const componentList = components\n .map((c) => {\n const desc = c.config.description ? ` (${c.config.description})` : '';\n return `${c.config.name}${desc}`;\n })\n .join(', ');\n throw new Error(`No component available for '${data.type}' interaction.\\n` +\n `Registered components: ${componentList}.\\n` +\n `None of these components matched the current interaction.`);\n }\n /**\n * Get all registered interaction types\n * @returns Array of registered interaction type names\n */\n getRegisteredTypes() {\n return Array.from(this.components.keys());\n }\n /**\n * Check if a component is registered for a type\n */\n hasComponent(type) {\n return this.components.has(type) && this.components.get(type).length > 0;\n }\n /**\n * Get the tag name for a registered type by name (no canHandle evaluation).\n * Useful for non-interaction components like catalogPopup where the type string\n * is known and there is no InteractionData object to pass.\n *\n * Returns the highest-priority registered tag name for the type, or null if\n * the type is not registered.\n */\n getTagNameForType(type) {\n const components = this.components.get(type);\n if (!components || components.length === 0)\n return null;\n return components[0].config.tagName;\n }\n}\n/**\n * Create a new component registry\n */\nexport function createComponentRegistry() {\n const registry = new ComponentRegistry();\n registerDefaultComponentTags(registry);\n return registry;\n}\n/**\n * Register the default QTI interaction tag names without importing their implementations.\n *\n * Hosts still choose the implementation bundle, typically by importing\n * `@pie-qti/default-components/plugins` in the browser. Keeping only tag metadata here lets\n * the item-player custom element remain the public rendering boundary without depending on\n * Svelte-authored default components.\n */\nexport function registerDefaultComponentTags(registry) {\n for (const [type, component] of Object.entries(DEFAULT_COMPONENT_TAGS_BY_TYPE)) {\n registry.register(type, {\n ...component,\n description: `Default web component tag for ${type}`,\n priority: -100,\n });\n }\n}\n//# sourceMappingURL=ComponentRegistry.js.map","const DEFAULTS = {\n rejectDoctype: true,\n maxItemXmlBytes: 10000000,\n maxHtmlBytes: 5000000,\n maxHtmlNodes: 200000,\n maxHtmlDepth: 200,\n};\nfunction getByteLengthUtf8(s) {\n // TextEncoder is available in modern runtimes (browser + Bun/node 20+).\n // Fall back to a conservative approximation if unavailable.\n const TE = globalThis.TextEncoder;\n if (!TE)\n return s.length * 2;\n return new TE().encode(s).byteLength;\n}\nexport function normalizeParsingLimits(security) {\n const cfg = security?.parsingLimits;\n const enabled = cfg?.enabled === true;\n if (!enabled) {\n return { enabled: false, ...DEFAULTS };\n }\n return {\n enabled: true,\n rejectDoctype: cfg?.rejectDoctype ?? DEFAULTS.rejectDoctype,\n maxItemXmlBytes: cfg?.maxItemXmlBytes ?? DEFAULTS.maxItemXmlBytes,\n maxHtmlBytes: cfg?.maxHtmlBytes ?? DEFAULTS.maxHtmlBytes,\n maxHtmlNodes: cfg?.maxHtmlNodes ?? DEFAULTS.maxHtmlNodes,\n maxHtmlDepth: cfg?.maxHtmlDepth ?? DEFAULTS.maxHtmlDepth,\n };\n}\nexport function enforceItemXmlLimits(itemXml, security) {\n const limits = normalizeParsingLimits(security);\n if (!limits.enabled)\n return;\n const bytes = getByteLengthUtf8(String(itemXml ?? ''));\n if (bytes > limits.maxItemXmlBytes) {\n throw new Error(`itemXml exceeds maxItemXmlBytes (${bytes} > ${limits.maxItemXmlBytes})`);\n }\n if (limits.rejectDoctype) {\n // Case-insensitive and tolerant of whitespace: \"<!DOCTYPE\"\n if (/<!\\s*doctype/i.test(itemXml)) {\n throw new Error('itemXml contains <!DOCTYPE>, which is rejected by parsingLimits');\n }\n }\n}\n//# sourceMappingURL=parsingLimits.js.map","/**\n * Standard QTI associateInteraction extractor\n *\n * Extracts data from associateInteraction elements (associating items)\n */\n/**\n * Standard QTI associate interaction extractor\n * Handles associateInteraction elements (creating associations between items)\n */\nexport const standardAssociateExtractor = {\n id: 'qti:associate-interaction',\n name: 'QTI Standard Associate Interaction',\n priority: 10,\n elementTypes: ['associateInteraction'],\n description: 'Extracts standard QTI associateInteraction (associating items)',\n canHandle(element, context) {\n // All associateInteraction elements with simpleAssociableChoice are standard\n return (element.rawTagName === 'associateInteraction' &&\n context.utils.hasChildWithTag(element, 'simpleAssociableChoice'));\n },\n extract(element, context) {\n const { utils } = context;\n // Extract simpleAssociableChoice children\n const choiceElements = utils.getChildrenByTag(element, 'simpleAssociableChoice');\n const choices = choiceElements.map((choice) => {\n const classes = utils.getClasses(choice);\n const matchMax = utils.getNumberAttribute(choice, 'matchMax', 1);\n const matchMin = utils.getNumberAttribute(choice, 'matchMin', 0);\n const matchGroupRaw = utils.getAttribute(choice, 'matchGroup', '');\n const matchGroup = matchGroupRaw.split(/\\s+/).filter(Boolean);\n return {\n identifier: utils.getAttribute(choice, 'identifier', ''),\n text: utils.getHtmlContent(choice),\n matchMax,\n ...(matchMin > 0 ? { matchMin } : {}),\n ...(matchGroup.length > 0 ? { matchGroup } : {}),\n ...(classes.length > 0 ? { classes } : {}),\n };\n });\n // Extract attributes with proper defaults\n const shuffle = utils.getBooleanAttribute(element, 'shuffle');\n const maxAssociations = utils.getNumberAttribute(element, 'maxAssociations', 0);\n const minAssociations = utils.getNumberAttribute(element, 'minAssociations', 0);\n // Extract prompt (optional)\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n return {\n choices,\n shuffle,\n maxAssociations,\n ...(minAssociations > 0 ? { minAssociations } : {}),\n prompt,\n };\n },\n validate(data) {\n const errors = [];\n // Validate choices exist\n if (!data.choices || data.choices.length < 2) {\n errors.push('associateInteraction must have at least 2 choices');\n }\n // Validate choice identifiers\n if (data.choices) {\n const identifiers = new Set();\n for (const choice of data.choices) {\n if (!choice.identifier) {\n errors.push('All choices must have an identifier');\n }\n else if (identifiers.has(choice.identifier)) {\n errors.push(`Duplicate choice identifier: ${choice.identifier}`);\n }\n else {\n identifiers.add(choice.identifier);\n }\n // Validate matchMax\n if (choice.matchMax < 0) {\n errors.push(`matchMax must be non-negative for choice ${choice.identifier}`);\n }\n // Validate matchMin\n if (choice.matchMin !== undefined && choice.matchMin < 0) {\n errors.push(`matchMin must be non-negative for choice ${choice.identifier}`);\n }\n }\n }\n // Validate maxAssociations\n if (data.maxAssociations < 0) {\n errors.push('maxAssociations must be non-negative');\n }\n // Validate minAssociations\n if (data.minAssociations !== undefined && data.minAssociations < 0) {\n errors.push('minAssociations must be non-negative');\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI choiceInteraction extractor\n *\n * Extracts data from choiceInteraction elements with simpleChoice children\n */\n/**\n * Standard QTI choice interaction extractor\n * Handles choiceInteraction elements with simpleChoice children\n */\nexport const standardChoiceExtractor = {\n id: 'qti:choice-interaction',\n name: 'QTI Standard Choice Interaction',\n priority: 10,\n elementTypes: ['choiceInteraction'],\n description: 'Extracts standard QTI choiceInteraction with simpleChoice elements',\n canHandle(element, context) {\n // Standard QTI choice interactions have simpleChoice children\n return context.utils.hasChildWithTag(element, 'simpleChoice');\n },\n extract(element, context) {\n const { utils } = context;\n // Extract choices\n const simpleChoices = utils.getChildrenByTag(element, 'simpleChoice');\n const choices = simpleChoices.map((choice) => {\n const classes = utils.getClasses(choice);\n const fixed = utils.getBooleanAttribute(choice, 'fixed');\n return {\n identifier: utils.getAttribute(choice, 'identifier', ''),\n text: utils.getHtmlContent(choice),\n ...(fixed ? { fixed } : {}),\n ...(classes.length > 0 ? { classes } : {}),\n };\n });\n // Extract prompt\n const promptElement = utils.querySelector(element, 'prompt');\n const prompt = promptElement ? utils.getHtmlContent(promptElement) : null;\n // Extract attributes\n const shuffle = utils.getBooleanAttribute(element, 'shuffle');\n const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 1);\n const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);\n const interactionClasses = utils.getClasses(element);\n const maxSelectionsMessage = utils.getAttribute(element, 'data-max-selections-message', '') || null;\n const minSelectionsMessage = utils.getAttribute(element, 'data-min-selections-message', '') || null;\n return {\n choices,\n shuffle,\n maxChoices,\n minChoices,\n prompt,\n ...(interactionClasses.length > 0 ? { interactionClasses } : {}),\n ...(maxSelectionsMessage ? { maxSelectionsMessage } : {}),\n ...(minSelectionsMessage ? { minSelectionsMessage } : {}),\n };\n },\n validate(data) {\n const errors = [];\n const warnings = [];\n // Validate choices exist\n if (!data.choices || data.choices.length === 0) {\n errors.push('choiceInteraction must have at least one choice');\n }\n // Validate choice identifiers\n if (data.choices) {\n const identifiers = new Set();\n for (const choice of data.choices) {\n if (!choice.identifier) {\n errors.push('All choices must have an identifier');\n }\n else if (identifiers.has(choice.identifier)) {\n errors.push(`Duplicate choice identifier: ${choice.identifier}`);\n }\n else {\n identifiers.add(choice.identifier);\n }\n }\n }\n // Validate maxChoices\n if (data.maxChoices < 0) {\n errors.push('maxChoices must be non-negative');\n }\n if (data.maxChoices === 0) {\n warnings.push('maxChoices=0 means unlimited selections');\n }\n if (data.maxChoices > data.choices.length) {\n warnings.push(`maxChoices (${data.maxChoices}) is greater than the number of choices (${data.choices.length})`);\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI customInteraction extractor\n *\n * Extracts data from customInteraction elements (custom/portable interactions)\n */\n/**\n * Standard QTI custom interaction extractor\n * Handles customInteraction elements (vendor-specific or portable custom interactions)\n */\nexport const standardCustomExtractor = {\n id: 'qti:custom-interaction',\n name: 'QTI Standard Custom Interaction',\n priority: 10,\n elementTypes: ['customInteraction'],\n description: 'Extracts standard QTI customInteraction (custom/portable interactions)',\n canHandle(element, _context) {\n // All customInteraction elements are handled by this extractor\n return element.rawTagName === 'customInteraction';\n },\n extract(element, context) {\n const { utils } = context;\n // Capture the raw XML for the custom interaction\n const xml = element.outerHTML || element.toString();\n // Extract all attributes\n const rawAttributes = {};\n if (element.attributes) {\n for (const [key, value] of Object.entries(element.attributes)) {\n rawAttributes[key] = String(value);\n }\n }\n // Extract prompt (optional)\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n return {\n xml,\n rawAttributes,\n prompt,\n };\n },\n validate(_data) {\n const warnings = [];\n // Warn if no XML content\n if (!_data.xml || _data.xml.trim() === '') {\n warnings.push('customInteraction has no XML content');\n }\n return {\n valid: true,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI drawingInteraction extractor\n *\n * Extracts data from drawingInteraction elements (drawing on canvas)\n */\n/**\n * Standard QTI drawing interaction extractor\n * Handles drawingInteraction elements (drawing on a canvas)\n */\nexport const standardDrawingExtractor = {\n id: 'qti:drawing-interaction',\n name: 'QTI Standard Drawing Interaction',\n priority: 10,\n elementTypes: ['drawingInteraction'],\n description: 'Extracts standard QTI drawingInteraction (drawing on canvas)',\n canHandle(element, _context) {\n // All drawingInteraction elements are standard\n return element.rawTagName === 'drawingInteraction';\n },\n extract(element, context) {\n const { utils } = context;\n // Extract background image data from object element (optional)\n const objectElements = utils.getChildrenByTag(element, 'object');\n let imageData = null;\n if (objectElements.length > 0) {\n const objectElement = objectElements[0];\n const type = utils.getAttribute(objectElement, 'type', '');\n const data = utils.getAttribute(objectElement, 'data', '');\n const width = utils.getAttribute(objectElement, 'width', '');\n const height = utils.getAttribute(objectElement, 'height', '');\n if (type.startsWith('image/svg')) {\n // Extract inline SVG content\n const content = utils.getHtmlContent(objectElement);\n imageData = {\n type: 'svg',\n content,\n ...(width ? { width } : {}),\n ...(height ? { height } : {}),\n };\n }\n else if (data) {\n // External image reference\n imageData = {\n type: 'image',\n src: data,\n ...(width ? { width } : {}),\n ...(height ? { height } : {}),\n };\n }\n }\n // Extract all attributes\n const rawAttributes = {};\n if (element.attributes) {\n for (const [key, value] of Object.entries(element.attributes)) {\n rawAttributes[key] = String(value);\n }\n }\n // Extract prompt (optional)\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n return {\n imageData,\n rawAttributes,\n prompt,\n };\n },\n validate(data) {\n const warnings = [];\n // Warn if no background image\n if (!data.imageData) {\n warnings.push('drawingInteraction has no background image - students will draw on a blank canvas');\n }\n return {\n valid: true,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI endAttemptInteraction extractor\n *\n * Extracts data from endAttemptInteraction elements (end attempt button)\n */\n/**\n * Standard QTI end attempt interaction extractor\n * Handles endAttemptInteraction elements (button to end the attempt)\n */\nexport const standardEndAttemptExtractor = {\n id: 'qti:end-attempt-interaction',\n name: 'QTI Standard End Attempt Interaction',\n priority: 10,\n elementTypes: ['endAttemptInteraction'],\n description: 'Extracts standard QTI endAttemptInteraction (end attempt button)',\n canHandle(element, _context) {\n // All endAttemptInteraction elements are standard\n return element.rawTagName === 'endAttemptInteraction';\n },\n extract(element, context) {\n const { utils } = context;\n // Extract attributes with defaults\n const title = utils.getAttribute(element, 'title', 'End Attempt');\n const countAttempt = element.hasAttribute('countAttempt')\n ? utils.getBooleanAttribute(element, 'countAttempt')\n : true;\n // Extract prompt (optional)\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n return {\n title,\n countAttempt,\n prompt,\n };\n },\n validate(data) {\n const errors = [];\n const warnings = [];\n // Validate title is not empty\n if (!data.title || data.title.trim() === '') {\n errors.push('endAttemptInteraction must have a title');\n }\n // Warn if countAttempt is false (uncommon usage)\n if (data.countAttempt === false) {\n warnings.push('endAttemptInteraction has countAttempt=false - make sure this is intentional');\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI extendedTextInteraction extractor\n *\n * Extracts data from extendedTextInteraction elements (multi-line text input)\n */\n/**\n * Standard QTI extended text interaction extractor\n * Handles extendedTextInteraction elements (multi-line text input)\n */\nexport const standardExtendedTextExtractor = {\n id: 'qti:extended-text-interaction',\n name: 'QTI Standard Extended Text Interaction',\n priority: 10,\n elementTypes: ['extendedTextInteraction'],\n description: 'Extracts standard QTI extendedTextInteraction (multi-line text input)',\n canHandle(element, _context) {\n // All extendedTextInteraction elements are standard (both QTI 2.x and 3.0)\n return (element.rawTagName === 'extendedTextInteraction' ||\n element.rawTagName === 'qti-extended-text-interaction');\n },\n extract(element, context) {\n const { utils } = context;\n // Extract attributes\n const expectedLines = utils.getNumberAttribute(element, 'expectedLines', 3);\n const expectedLength = utils.getNumberAttribute(element, 'expectedLength', 200);\n const placeholderText = utils.getAttribute(element, 'placeholderText', '');\n const format = utils.getAttribute(element, 'format', 'plain');\n const patternMask = utils.getAttribute(element, 'patternMask', '') || null;\n const patternMaskMessage = utils.getAttribute(element, 'patternMaskMessage', '') || null;\n const interactionClasses = utils.getClasses(element);\n const prompt = utils.getPrompt(element);\n return {\n expectedLines,\n expectedLength,\n prompt,\n placeholderText,\n format,\n ...(patternMask ? { patternMask } : {}),\n ...(patternMaskMessage ? { patternMaskMessage } : {}),\n ...(interactionClasses.length > 0 ? { interactionClasses } : {}),\n };\n },\n validate(data) {\n const errors = [];\n const warnings = [];\n // Validate expectedLines\n if (data.expectedLines < 1) {\n errors.push('expectedLines must be at least 1');\n }\n // Validate expectedLength\n if (data.expectedLength < 1) {\n errors.push('expectedLength must be positive');\n }\n // Validate format\n const validFormats = ['plain', 'preFormatted', 'xhtml'];\n if (!validFormats.includes(data.format)) {\n warnings.push(`Unrecognized format \"${data.format}\" - expected plain, preFormatted, or xhtml`);\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI gapMatchInteraction extractor\n *\n * Extracts data from gapMatchInteraction elements (drag words into gaps)\n */\n/**\n * Standard QTI gap match interaction extractor\n * Handles gapMatchInteraction elements (drag words into gaps in text)\n */\nexport const standardGapMatchExtractor = {\n id: 'qti:gap-match-interaction',\n name: 'QTI Standard Gap Match Interaction',\n priority: 10,\n elementTypes: ['gapMatchInteraction'],\n description: 'Extracts standard QTI gapMatchInteraction (drag words into gaps)',\n canHandle(element, _context) {\n // All gapMatchInteraction elements are standard\n return element.rawTagName === 'gapMatchInteraction';\n },\n extract(element, context) {\n const { utils } = context;\n // Extract gapText children (draggable items)\n const gapTextElements = utils.getChildrenByTag(element, 'gapText');\n const gapTexts = gapTextElements.map((gapText) => {\n const classes = utils.getClasses(gapText);\n const matchMax = utils.getNumberAttribute(gapText, 'matchMax', 1);\n const matchMin = utils.getNumberAttribute(gapText, 'matchMin', 0);\n const matchGroupRaw = utils.getAttribute(gapText, 'matchGroup', '');\n const matchGroup = matchGroupRaw.split(/\\s+/).filter(Boolean);\n return {\n identifier: utils.getAttribute(gapText, 'identifier', ''),\n text: utils.getTextContent(gapText),\n matchMax,\n ...(matchMin > 0 ? { matchMin } : {}),\n ...(matchGroup.length > 0 ? { matchGroup } : {}),\n ...(classes.length > 0 ? { classes } : {}),\n };\n });\n // Extract prompt (optional) and process gap placeholders.\n // NOTE: Many QTI items place `<gap>` elements in the interaction content (e.g. a `<p>`/`<blockquote>`)\n // rather than inside a `<prompt>` element. Support both patterns.\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n let prompt = null;\n let promptText = '';\n const gaps = [];\n if (promptElements.length > 0) {\n const promptElement = promptElements[0];\n prompt = utils.getHtmlContent(promptElement);\n // Get the raw HTML content and extract gaps\n const promptHtml = promptElement.outerHTML || promptElement.toString();\n // Extract gap elements from prompt children\n const gapElements = utils.getChildrenByTag(promptElement, 'gap');\n for (const gap of gapElements) {\n gaps.push(utils.getAttribute(gap, 'identifier', ''));\n }\n // Replace gap elements with placeholders in the text\n promptText = promptHtml\n .replace(/<qti-prompt[^>]*>|<prompt[^>]*>/, '')\n .replace(/<\\/qti-prompt>|<\\/prompt>/, '')\n .replace(/<(?:qti-)?gap\\s+identifier=\"([^\"]+)\"[^>]*>/g, '[GAP:$1]')\n .replace(/<(?:qti-)?gap\\s+identifier='([^']+)'[^>]*>/g, '[GAP:$1]')\n .replace(/<\\/(?:qti-)?gap>/g, '')\n .trim();\n }\n // If gaps were not found inside a <prompt>, search the full interaction body.\n // This handles items where <gap> elements appear in <p>/<blockquote> siblings of <prompt>.\n if (gaps.length === 0) {\n const interactionHtml = element.outerHTML || element.toString();\n const gapIdMatches = Array.from(interactionHtml.matchAll(/<(?:qti-)?gap\\s+identifier=(?:\"([^\"]+)\"|'([^']+)')[^>]*\\/?>/gi));\n for (const m of gapIdMatches) {\n const id = (m[1] || m[2] || '').trim();\n if (id)\n gaps.push(id);\n }\n if (!promptText) {\n // No prompt element either: build promptText from full interaction content.\n const interactionHtml2 = element.outerHTML || element.toString();\n promptText = interactionHtml2\n .replace(/<(?:qti-)?gap-match-interaction[^>]*>|<gapMatchInteraction[^>]*>/, '')\n .replace(/<\\/(?:qti-)?gap-match-interaction>|<\\/gapMatchInteraction>/, '')\n .replace(/<(?:qti-)?gap-text[\\s\\S]*?<\\/(?:qti-)?gap-text>|<gapText[\\s\\S]*?<\\/gapText>/g, '')\n .replace(/<(?:qti-)?gap\\s+identifier=\"([^\"]+)\"[^>]*\\/?>/g, '[GAP:$1]')\n .replace(/<(?:qti-)?gap\\s+identifier='([^']+)'[^>]*\\/?>/g, '[GAP:$1]')\n .replace(/<\\/(?:qti-)?gap>/g, '')\n .trim();\n }\n }\n // Extract attributes\n const shuffle = utils.getBooleanAttribute(element, 'shuffle');\n const interactionClasses = utils.getClasses(element);\n const choicesContainerWidth = utils.getAttribute(element, 'data-choices-container-width', '') || null;\n const maxSelectionsMessage = utils.getAttribute(element, 'data-max-selections-message', '') || null;\n const minSelectionsMessage = utils.getAttribute(element, 'data-min-selections-message', '') || null;\n return {\n gapTexts,\n gaps,\n shuffle,\n prompt,\n promptText,\n ...(interactionClasses.length > 0 ? { interactionClasses } : {}),\n ...(choicesContainerWidth ? { choicesContainerWidth } : {}),\n ...(maxSelectionsMessage ? { maxSelectionsMessage } : {}),\n ...(minSelectionsMessage ? { minSelectionsMessage } : {}),\n };\n },\n validate(data) {\n const errors = [];\n // Validate gapTexts exist\n if (!data.gapTexts || data.gapTexts.length === 0) {\n errors.push('gapMatchInteraction must have at least one gapText');\n }\n // Validate gaps exist\n if (!data.gaps || data.gaps.length === 0) {\n errors.push('gapMatchInteraction must have at least one gap in the prompt');\n }\n // Validate gapText identifiers\n if (data.gapTexts) {\n const identifiers = new Set();\n for (const gapText of data.gapTexts) {\n if (!gapText.identifier) {\n errors.push('All gapTexts must have an identifier');\n }\n else if (identifiers.has(gapText.identifier)) {\n errors.push(`Duplicate gapText identifier: ${gapText.identifier}`);\n }\n else {\n identifiers.add(gapText.identifier);\n }\n // Validate matchMax\n if (gapText.matchMax < 0) {\n errors.push(`matchMax must be non-negative for gapText ${gapText.identifier}`);\n }\n }\n }\n // Validate gap identifiers\n if (data.gaps) {\n const identifiers = new Set();\n for (const gap of data.gaps) {\n if (!gap) {\n errors.push('All gaps must have an identifier');\n }\n else if (identifiers.has(gap)) {\n errors.push(`Duplicate gap identifier: ${gap}`);\n }\n else {\n identifiers.add(gap);\n }\n }\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI graphicAssociateInteraction extractor\n *\n * Extracts data from graphicAssociateInteraction elements (associate items on image)\n */\n/**\n * Standard QTI graphic associate interaction extractor\n * Handles graphicAssociateInteraction elements (creating associations between hotspots)\n */\nexport const standardGraphicAssociateExtractor = {\n id: 'qti:graphic-associate-interaction',\n name: 'QTI Standard Graphic Associate Interaction',\n priority: 10,\n elementTypes: ['graphicAssociateInteraction'],\n description: 'Extracts standard QTI graphicAssociateInteraction (associate items on image)',\n canHandle(element, _context) {\n // All graphicAssociateInteraction elements are standard\n return element.rawTagName === 'graphicAssociateInteraction';\n },\n extract(element, context) {\n const { utils } = context;\n // Extract image data from object element\n const objectElements = utils.getChildrenByTag(element, 'object');\n let imageData = null;\n if (objectElements.length > 0) {\n const objectElement = objectElements[0];\n const type = utils.getAttribute(objectElement, 'type', '');\n const data = utils.getAttribute(objectElement, 'data', '');\n const width = utils.getAttribute(objectElement, 'width', '500');\n const height = utils.getAttribute(objectElement, 'height', '300');\n if (type.startsWith('image/svg')) {\n // Extract inline SVG content - get full content including <svg> tag\n const content = utils.getHtmlContent(objectElement);\n imageData = {\n type: 'svg',\n content,\n width,\n height,\n };\n }\n else {\n // External image reference\n imageData = {\n type: 'image',\n src: data,\n width,\n height,\n };\n }\n }\n // Extract associableHotspot children\n const hotspotElements = utils.getChildrenByTag(element, 'associableHotspot');\n const associableHotspots = hotspotElements.map((hotspot) => {\n const classes = utils.getClasses(hotspot);\n const identifier = utils.getAttribute(hotspot, 'identifier', '');\n const shape = utils.getAttribute(hotspot, 'shape', 'rect');\n const coords = utils.getAttribute(hotspot, 'coords', '0,0,50,50');\n const matchMax = utils.getNumberAttribute(hotspot, 'matchMax', 1);\n const matchMin = utils.getNumberAttribute(hotspot, 'matchMin', 0);\n const matchGroupRaw = utils.getAttribute(hotspot, 'matchGroup', '');\n const matchGroup = matchGroupRaw.split(/\\s+/).filter(Boolean);\n // Get text content as label, use identifier as fallback\n const textContent = utils.getTextContent(hotspot).trim();\n const label = textContent || identifier;\n return {\n identifier,\n label,\n shape,\n coords,\n matchMax,\n ...(matchMin > 0 ? { matchMin } : {}),\n ...(matchGroup.length > 0 ? { matchGroup } : {}),\n ...(classes.length > 0 ? { classes } : {}),\n };\n });\n // Extract attributes with proper defaults\n const maxAssociations = utils.getNumberAttribute(element, 'maxAssociations', 1);\n const minAssociations = utils.getNumberAttribute(element, 'minAssociations', 0);\n // Extract prompt (optional)\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n return {\n imageData,\n associableHotspots,\n maxAssociations,\n minAssociations,\n prompt,\n };\n },\n validate(data) {\n const errors = [];\n const warnings = [];\n // Validate image data\n if (!data.imageData) {\n warnings.push('graphicAssociateInteraction has no image data');\n }\n else if (data.imageData.type === 'image' && !data.imageData.src) {\n errors.push('graphicAssociateInteraction must have an image URL');\n }\n else if (data.imageData.type === 'svg' && !data.imageData.content) {\n errors.push('graphicAssociateInteraction must have SVG content');\n }\n // Validate hotspots exist\n if (!data.associableHotspots || data.associableHotspots.length < 2) {\n errors.push('graphicAssociateInteraction must have at least 2 hotspots');\n }\n // Validate hotspot identifiers and coords\n if (data.associableHotspots && data.associableHotspots.length > 0) {\n const identifiers = new Set();\n for (const hotspot of data.associableHotspots) {\n if (!hotspot.identifier) {\n errors.push('All hotspots must have an identifier');\n }\n else if (identifiers.has(hotspot.identifier)) {\n errors.push(`Duplicate hotspot identifier: ${hotspot.identifier}`);\n }\n else {\n identifiers.add(hotspot.identifier);\n }\n if (!hotspot.coords) {\n errors.push(`Hotspot ${hotspot.identifier} must have coords`);\n }\n // Validate matchMax\n if (hotspot.matchMax < 0) {\n errors.push(`matchMax must be non-negative for hotspot ${hotspot.identifier}`);\n }\n }\n }\n // Validate maxAssociations\n if (data.maxAssociations < 0) {\n errors.push('maxAssociations must be non-negative');\n }\n // Validate minAssociations\n if (data.minAssociations < 0) {\n errors.push('minAssociations must be non-negative');\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI graphicGapMatchInteraction extractor\n *\n * Extracts data from graphicGapMatchInteraction elements (drag text/images into gaps on image)\n */\n/**\n * Standard QTI graphic gap match interaction extractor\n * Handles graphicGapMatchInteraction elements (drag text/images into gaps on an image)\n */\nexport const standardGraphicGapMatchExtractor = {\n id: 'qti:graphic-gap-match-interaction',\n name: 'QTI Standard Graphic Gap Match Interaction',\n priority: 10,\n elementTypes: ['graphicGapMatchInteraction'],\n description: 'Extracts standard QTI graphicGapMatchInteraction (drag text/images into gaps)',\n canHandle(element, _context) {\n // All graphicGapMatchInteraction elements are standard\n return element.rawTagName === 'graphicGapMatchInteraction';\n },\n extract(element, context) {\n const { utils } = context;\n // Extract image data from object element\n const objectElements = utils.getChildrenByTag(element, 'object');\n let imageData = null;\n if (objectElements.length > 0) {\n const objectElement = objectElements[0];\n const type = utils.getAttribute(objectElement, 'type', '');\n const data = utils.getAttribute(objectElement, 'data', '');\n const width = utils.getNumberAttribute(objectElement, 'width', 0);\n const height = utils.getNumberAttribute(objectElement, 'height', 0);\n if (type.startsWith('image/svg')) {\n // Inline SVG: <object type=\"image/svg+xml\"><svg>...</svg></object>\n // External SVG: <object type=\"image/svg+xml\" data=\"path/to/file.svg\"/>\n // The <object> may contain alt text (not SVG markup) — only treat as inline if content has <svg.\n const content = utils.getHtmlContent(objectElement);\n const hasSvgMarkup = /<svg[\\s>]/i.test(content);\n if (hasSvgMarkup) {\n imageData = {\n type: 'svg',\n content,\n ...(width > 0 ? { width } : {}),\n ...(height > 0 ? { height } : {}),\n };\n }\n else {\n // External SVG file reference — render via <img src>\n imageData = {\n type: 'image',\n src: data,\n ...(width > 0 ? { width } : {}),\n ...(height > 0 ? { height } : {}),\n };\n }\n }\n else {\n // External image reference\n imageData = {\n type: 'image',\n src: data,\n ...(width > 0 ? { width } : {}),\n ...(height > 0 ? { height } : {}),\n };\n }\n }\n // Extract interaction-level attributes\n const maxAssociations = utils.getNumberAttribute(element, 'maxAssociations', 0);\n // Extract gapText children (draggable text labels)\n const gapTextElements = utils.getChildrenByTag(element, 'gapText');\n const gapTexts = gapTextElements.map((gapText) => {\n const classes = utils.getClasses(gapText);\n const matchMax = utils.getNumberAttribute(gapText, 'matchMax', 1);\n const matchMin = utils.getNumberAttribute(gapText, 'matchMin', 0);\n const matchGroupRaw = utils.getAttribute(gapText, 'matchGroup', '');\n const matchGroup = matchGroupRaw.split(/\\s+/).filter(Boolean);\n const text = utils.getHtmlContent(gapText);\n return {\n identifier: utils.getAttribute(gapText, 'identifier', ''),\n text,\n matchMax,\n ...(matchMin > 0 ? { matchMin } : {}),\n ...(matchGroup.length > 0 ? { matchGroup } : {}),\n ...(classes.length > 0 ? { classes } : {}),\n };\n });\n // Extract gapImg children (draggable image labels)\n const gapImgElements = utils.getChildrenByTag(element, 'gapImg');\n const gapImages = gapImgElements.map((gapImg) => {\n const matchMax = utils.getNumberAttribute(gapImg, 'matchMax', 1);\n const matchGroupRaw = utils.getAttribute(gapImg, 'matchGroup', '');\n const matchGroup = matchGroupRaw.split(/\\s+/).filter(Boolean);\n const objectChildren = utils.getChildrenByTag(gapImg, 'object');\n let src = '';\n let alt = '';\n let width;\n let height;\n if (objectChildren.length > 0) {\n const obj = objectChildren[0];\n src = utils.getAttribute(obj, 'data', '');\n alt = utils.getTextContent(obj);\n const w = utils.getNumberAttribute(obj, 'width', 0);\n const h = utils.getNumberAttribute(obj, 'height', 0);\n if (w > 0)\n width = w;\n if (h > 0)\n height = h;\n }\n return {\n identifier: utils.getAttribute(gapImg, 'identifier', ''),\n src,\n alt,\n matchMax,\n ...(matchGroup.length > 0 ? { matchGroup } : {}),\n ...(width !== undefined ? { width } : {}),\n ...(height !== undefined ? { height } : {}),\n };\n });\n // Extract associableHotspot elements (gap targets)\n const hotspotElements = utils.getChildrenByTag(element, 'associableHotspot');\n const hotspots = hotspotElements.map((hotspot) => ({\n identifier: utils.getAttribute(hotspot, 'identifier', ''),\n shape: utils.getAttribute(hotspot, 'shape', 'rect'),\n coords: utils.getAttribute(hotspot, 'coords', ''),\n matchMax: utils.getNumberAttribute(hotspot, 'matchMax', 1),\n }));\n // Extract prompt (optional)\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n const interactionClasses = utils.getClasses(element);\n const choicesContainerWidth = utils.getAttribute(element, 'data-choices-container-width', '') || null;\n const maxSelectionsMessage = utils.getAttribute(element, 'data-max-selections-message', '') || null;\n const minSelectionsMessage = utils.getAttribute(element, 'data-min-selections-message', '') || null;\n return {\n imageData,\n maxAssociations,\n gapTexts,\n gapImages,\n hotspots,\n prompt,\n ...(interactionClasses.length > 0 ? { interactionClasses } : {}),\n ...(choicesContainerWidth ? { choicesContainerWidth } : {}),\n ...(maxSelectionsMessage ? { maxSelectionsMessage } : {}),\n ...(minSelectionsMessage ? { minSelectionsMessage } : {}),\n };\n },\n validate(data) {\n const errors = [];\n const warnings = [];\n // Validate image data (optional but recommended)\n if (!data.imageData) {\n warnings.push('graphicGapMatchInteraction has no background image');\n }\n else if (data.imageData.type === 'image' && !data.imageData.src) {\n errors.push('graphicGapMatchInteraction must have an image URL');\n }\n else if (data.imageData.type === 'svg' && !data.imageData.content) {\n errors.push('graphicGapMatchInteraction must have SVG content');\n }\n // Validate that at least one draggable choice type is present\n if ((!data.gapTexts || data.gapTexts.length === 0) && (!data.gapImages || data.gapImages.length === 0)) {\n errors.push('graphicGapMatchInteraction must have at least one gapText or gapImg');\n }\n // Validate hotspots exist\n if (!data.hotspots || data.hotspots.length === 0) {\n errors.push('graphicGapMatchInteraction must have at least one hotspot');\n }\n // Validate gapText identifiers\n if (data.gapTexts) {\n const identifiers = new Set();\n for (const gapText of data.gapTexts) {\n if (!gapText.identifier) {\n errors.push('All gapTexts must have an identifier');\n }\n else if (identifiers.has(gapText.identifier)) {\n errors.push(`Duplicate gapText identifier: ${gapText.identifier}`);\n }\n else {\n identifiers.add(gapText.identifier);\n }\n }\n }\n // Validate hotspot identifiers\n if (data.hotspots) {\n const identifiers = new Set();\n for (const hotspot of data.hotspots) {\n if (!hotspot.identifier) {\n errors.push('All hotspots must have an identifier');\n }\n else if (identifiers.has(hotspot.identifier)) {\n errors.push(`Duplicate hotspot identifier: ${hotspot.identifier}`);\n }\n else {\n identifiers.add(hotspot.identifier);\n }\n if (!hotspot.coords) {\n errors.push(`Hotspot ${hotspot.identifier} must have coords`);\n }\n }\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI graphicOrderInteraction extractor\n *\n * Extracts data from graphicOrderInteraction elements (order items on image)\n */\n/**\n * Standard QTI graphic order interaction extractor\n * Handles graphicOrderInteraction elements (ordering hotspots on an image)\n */\nexport const standardGraphicOrderExtractor = {\n id: 'qti:graphic-order-interaction',\n name: 'QTI Standard Graphic Order Interaction',\n priority: 10,\n elementTypes: ['graphicOrderInteraction'],\n description: 'Extracts standard QTI graphicOrderInteraction (order items on image)',\n canHandle(element, _context) {\n // All graphicOrderInteraction elements are standard\n return element.rawTagName === 'graphicOrderInteraction';\n },\n extract(element, context) {\n const { utils } = context;\n // Extract image data from object element\n const objectElements = utils.getChildrenByTag(element, 'object');\n let imageData = null;\n if (objectElements.length > 0) {\n const objectElement = objectElements[0];\n const type = utils.getAttribute(objectElement, 'type', '');\n const data = utils.getAttribute(objectElement, 'data', '');\n const width = utils.getAttribute(objectElement, 'width', '500');\n const height = utils.getAttribute(objectElement, 'height', '300');\n if (type.startsWith('image/svg')) {\n // Extract inline SVG content - get full content including <svg> tag\n const content = utils.getHtmlContent(objectElement);\n imageData = {\n type: 'svg',\n content,\n width,\n height,\n };\n }\n else {\n // External image reference\n imageData = {\n type: 'image',\n src: data,\n width,\n height,\n };\n }\n }\n // Extract hotspotChoice children\n const hotspotElements = utils.getChildrenByTag(element, 'hotspotChoice');\n const hotspotChoices = hotspotElements.map((hotspot) => {\n const classes = utils.getClasses(hotspot);\n const identifier = utils.getAttribute(hotspot, 'identifier', '');\n const shape = utils.getAttribute(hotspot, 'shape', 'rect');\n const coords = utils.getAttribute(hotspot, 'coords', '0,0,50,50');\n const fixed = utils.getBooleanAttribute(hotspot, 'fixed');\n // Get text content as label, use identifier as fallback\n const textContent = utils.getTextContent(hotspot).trim();\n const label = textContent || identifier;\n return {\n identifier,\n label,\n shape,\n coords,\n ...(fixed ? { fixed } : {}),\n ...(classes.length > 0 ? { classes } : {}),\n };\n });\n // Extract prompt (optional)\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n return {\n imageData,\n hotspotChoices,\n prompt,\n };\n },\n validate(data) {\n const errors = [];\n const warnings = [];\n // Validate image data\n if (!data.imageData) {\n warnings.push('graphicOrderInteraction has no image data');\n }\n else if (data.imageData.type === 'image' && !data.imageData.src) {\n errors.push('graphicOrderInteraction must have an image URL');\n }\n else if (data.imageData.type === 'svg' && !data.imageData.content) {\n errors.push('graphicOrderInteraction must have SVG content');\n }\n // Validate hotspot choices exist\n if (!data.hotspotChoices || data.hotspotChoices.length < 2) {\n errors.push('graphicOrderInteraction must have at least 2 hotspots');\n }\n // Validate hotspot choice identifiers and coords\n if (data.hotspotChoices) {\n const identifiers = new Set();\n for (const hotspot of data.hotspotChoices) {\n if (!hotspot.identifier) {\n errors.push('All hotspot choices must have an identifier');\n }\n else if (identifiers.has(hotspot.identifier)) {\n errors.push(`Duplicate hotspot identifier: ${hotspot.identifier}`);\n }\n else {\n identifiers.add(hotspot.identifier);\n }\n if (!hotspot.coords) {\n errors.push(`Hotspot ${hotspot.identifier} must have coords`);\n }\n }\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI hotspotInteraction extractor\n *\n * Extracts data from hotspotInteraction elements (clickable areas on image)\n */\n/**\n * Standard QTI hotspot interaction extractor\n * Handles hotspotInteraction elements (clickable areas on an image)\n */\nexport const standardHotspotExtractor = {\n id: 'qti:hotspot-interaction',\n name: 'QTI Standard Hotspot Interaction',\n priority: 10,\n elementTypes: ['hotspotInteraction'],\n description: 'Extracts standard QTI hotspotInteraction (clickable areas on image)',\n canHandle(element, _context) {\n // All hotspotInteraction elements are standard\n return element.rawTagName === 'hotspotInteraction';\n },\n extract(element, context) {\n const { utils } = context;\n // Extract image data from object element\n const objectElements = utils.getChildrenByTag(element, 'object');\n let imageData = null;\n if (objectElements.length > 0) {\n const objectElement = objectElements[0];\n const type = utils.getAttribute(objectElement, 'type', '');\n const data = utils.getAttribute(objectElement, 'data', '');\n const width = utils.getAttribute(objectElement, 'width', 'auto');\n const height = utils.getAttribute(objectElement, 'height', 'auto');\n if (type.startsWith('image/svg')) {\n // Inline SVG: <object type=\"image/svg+xml\"><svg>...</svg></object>\n // External SVG: <object type=\"image/svg+xml\" data=\"path/to/file.svg\"/>\n // The <object> may contain alt text (not SVG markup) — only treat as inline if content has <svg.\n const content = utils.getHtmlContent(objectElement);\n const hasSvgMarkup = /<svg[\\s>]/i.test(content);\n if (hasSvgMarkup) {\n imageData = {\n type: 'svg',\n content,\n width,\n height,\n };\n }\n else {\n // External SVG file reference — render via <img src> (SVG renders in img tags)\n imageData = {\n type: 'image',\n src: data,\n width,\n height,\n };\n }\n }\n else {\n // External image reference\n imageData = {\n type: 'image',\n src: data,\n width,\n height,\n };\n }\n }\n // Extract hotspotChoice children\n const hotspotElements = utils.getChildrenByTag(element, 'hotspotChoice');\n const hotspotChoices = hotspotElements.map((hotspot) => {\n const classes = utils.getClasses(hotspot);\n const shape = utils.getAttribute(hotspot, 'shape', 'rect');\n const coords = utils.getAttribute(hotspot, 'coords', '');\n const hotspotLabel = utils.getAttribute(hotspot, 'hotspotLabel', '');\n return {\n identifier: utils.getAttribute(hotspot, 'identifier', ''),\n shape: shape,\n coords,\n ...(hotspotLabel ? { hotspotLabel } : {}),\n ...(classes.length > 0 ? { classes } : {}),\n };\n });\n // Extract attributes\n const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 1);\n const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);\n const interactionClasses = utils.getClasses(element);\n const maxSelectionsMessage = utils.getAttribute(element, 'data-max-selections-message', '') || null;\n const minSelectionsMessage = utils.getAttribute(element, 'data-min-selections-message', '') || null;\n // Extract prompt (optional)\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n return {\n imageData,\n hotspotChoices,\n maxChoices,\n ...(minChoices > 0 ? { minChoices } : {}),\n prompt,\n ...(interactionClasses.length > 0 ? { interactionClasses } : {}),\n ...(maxSelectionsMessage ? { maxSelectionsMessage } : {}),\n ...(minSelectionsMessage ? { minSelectionsMessage } : {}),\n };\n },\n validate(data) {\n const errors = [];\n const warnings = [];\n // Validate image data\n if (!data.imageData) {\n warnings.push('hotspotInteraction has no image data');\n }\n else if (data.imageData.type === 'image' && !data.imageData.src) {\n errors.push('hotspotInteraction must have an image URL');\n }\n else if (data.imageData.type === 'svg' && !data.imageData.content) {\n errors.push('hotspotInteraction must have SVG content');\n }\n // Validate hotspots exist\n if (!data.hotspotChoices || data.hotspotChoices.length === 0) {\n errors.push('hotspotInteraction must have at least one hotspot');\n }\n // Validate hotspot identifiers and coords\n if (data.hotspotChoices && data.hotspotChoices.length > 0) {\n const identifiers = new Set();\n for (const hotspot of data.hotspotChoices) {\n if (!hotspot.identifier) {\n errors.push('All hotspots must have an identifier');\n }\n else if (identifiers.has(hotspot.identifier)) {\n errors.push(`Duplicate hotspot identifier: ${hotspot.identifier}`);\n }\n else {\n identifiers.add(hotspot.identifier);\n }\n if (!hotspot.coords) {\n errors.push(`Hotspot ${hotspot.identifier} must have coords`);\n }\n }\n // Warn if maxChoices exceeds hotspot count\n if (data.maxChoices > data.hotspotChoices.length) {\n warnings.push(`maxChoices (${data.maxChoices}) exceeds the number of hotspots (${data.hotspotChoices.length})`);\n }\n }\n // Validate maxChoices\n if (data.maxChoices < 0) {\n errors.push('maxChoices must be non-negative');\n }\n // Validate minChoices\n if (data.minChoices !== undefined && data.minChoices < 0) {\n errors.push('minChoices must be non-negative');\n }\n // Validate minChoices <= maxChoices\n if (data.minChoices !== undefined &&\n data.maxChoices > 0 &&\n data.minChoices > data.maxChoices) {\n errors.push('minChoices cannot exceed maxChoices');\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","const DEFAULT_POLICY = {\n allowHttps: true,\n allowHttp: false,\n allowProtocolRelative: false,\n allowDataImages: true,\n allowSvgDataImages: false,\n};\nfunction normalizePolicy(policy) {\n return { ...DEFAULT_POLICY, ...(policy ?? {}) };\n}\nfunction isDangerousScheme(u) {\n const s = u.toLowerCase().trim();\n return s.startsWith('javascript:') || s.startsWith('vbscript:') || s.startsWith('data:text/html');\n}\nfunction allowHost(hostname, policy) {\n const allow = policy.allowedHosts;\n if (!allow || allow.length === 0)\n return true;\n return allow.includes(hostname);\n}\nfunction sanitizeDataUrl(raw, kind, policy) {\n const s = raw.toLowerCase().trim();\n if (!s.startsWith('data:'))\n return null;\n if (kind !== 'img')\n return null;\n if (!policy.allowDataImages)\n return null;\n if (!s.startsWith('data:image/'))\n return null;\n if (!policy.allowSvgDataImages && s.startsWith('data:image/svg+xml'))\n return null;\n return raw.trim();\n}\n/**\n * Sanitize a URL used for embedding resources (img/audio/video/object/link).\n * Returns null when the URL should be blocked.\n */\nexport function sanitizeResourceUrl(raw, policy, kind = 'any') {\n const p = normalizePolicy(policy);\n const s = String(raw ?? '').trim();\n if (!s)\n return null;\n if (isDangerousScheme(s))\n return null;\n // data: URLs (context-sensitive)\n const dataOk = sanitizeDataUrl(s, kind, p);\n if (dataOk)\n return dataOk;\n if (s.toLowerCase().trim().startsWith('data:'))\n return null;\n // Protocol-relative URLs are treated as network loads and blocked by default.\n if (s.startsWith('//'))\n return p.allowProtocolRelative ? `https:${s}` : null;\n // Relative/absolute-path URLs: allow and optionally resolve.\n // Bare relative paths (e.g. \"images/foo.png\" from IMS CP manifests) are treated\n // the same as \"./\" paths — they have no scheme and are safe to pass through.\n if (s.startsWith('/') || s.startsWith('./') || s.startsWith('../') || !/^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(s)) {\n if (p.assetBaseUrl) {\n try {\n // Strip leading '/' to make URL constructor resolve relative to base path, not origin\n const relativePath = s.startsWith('/') ? s.slice(1) : s;\n return new URL(relativePath, p.assetBaseUrl).toString();\n }\n catch {\n // assetBaseUrl resolution failed; return the raw relative path as-is\n return s;\n }\n }\n return s;\n }\n // Absolute URLs: allow only http/https (by policy) and optional host allowlist.\n let u;\n try {\n u = new URL(s);\n }\n catch {\n return null;\n }\n const proto = u.protocol.toLowerCase();\n if (proto === 'https:' && !p.allowHttps)\n return null;\n if (proto === 'http:' && !p.allowHttp)\n return null;\n if (proto !== 'https:' && proto !== 'http:')\n return null;\n if (!allowHost(u.hostname, p))\n return null;\n return u.toString();\n}\n//# sourceMappingURL=urlPolicy.js.map","/**\n * HTML Sanitizer for QTI Content\n *\n * Removes dangerous HTML/scripts while preserving safe educational content.\n * Protects against XSS attacks via:\n * - Script tags\n * - Event handlers (onclick, onerror, onload, etc.)\n * - Dangerous protocols (javascript:, data:text/html)\n * - Unsafe iframe/object sources\n */\nimport { parse } from 'node-html-parser';\nimport { normalizeParsingLimits } from './parsingLimits.js';\nimport { sanitizeResourceUrl } from './urlPolicy.js';\nclass HtmlLimitExceeded extends Error {\n constructor(message) {\n super(message);\n }\n}\nfunction policyFromOptions(options) {\n return options?.security?.urlPolicy;\n}\nfunction allowObjectEmbeds(options) {\n return options?.security?.allowObjectEmbeds === true;\n}\nfunction allowIframes(options) {\n return options?.security?.allowIframes === true;\n}\nfunction escapeAttr(value) {\n return value\n .replace(/&/g, '&')\n .replace(/\"/g, '"')\n .replace(/</g, '<')\n .replace(/>/g, '>');\n}\nfunction getOptionalAttr(element, attrName) {\n const value = element.getAttribute(attrName);\n return value ? ` ${attrName}=\"${escapeAttr(value)}\"` : '';\n}\nfunction sanitizeUrlAttr(value, policy, kind) {\n return sanitizeResourceUrl(value, policy, kind) ?? '#';\n}\nfunction sanitizeSrcset(value, policy) {\n // srcset grammar is complex; we implement a conservative filter:\n // split by commas into candidate strings; sanitize the URL portion of each candidate.\n const parts = value\n .split(',')\n .map((p) => p.trim())\n .filter(Boolean);\n const out = [];\n for (const part of parts) {\n // URL is the first token; the rest are descriptors (e.g., 1x, 320w).\n const tokens = part.split(/\\s+/).filter(Boolean);\n if (tokens.length === 0)\n continue;\n const url = tokens[0];\n const sanitized = sanitizeResourceUrl(url, policy, 'img');\n if (!sanitized)\n continue;\n out.push([sanitized, ...tokens.slice(1)].join(' '));\n }\n return out.join(', ');\n}\n/**\n * Recursively sanitize an HTML element and its children\n */\nfunction sanitizeElement(element, options, limitsState, depth) {\n if (limitsState.enabled) {\n if (depth > limitsState.maxDepth) {\n throw new HtmlLimitExceeded(`HTML depth exceeds maxHtmlDepth (${depth} > ${limitsState.maxDepth})`);\n }\n limitsState.nodes++;\n if (limitsState.nodes > limitsState.maxNodes) {\n throw new HtmlLimitExceeded(`HTML node count exceeds maxHtmlNodes (${limitsState.nodes} > ${limitsState.maxNodes})`);\n }\n }\n const tagName = element.rawTagName?.toLowerCase();\n // Remove script tags entirely\n if (tagName === 'script') {\n element.remove();\n return;\n }\n // Remove high-risk elements by default (same-DOM embedding).\n if (tagName === 'iframe' && !allowIframes(options)) {\n element.remove();\n return;\n }\n if ((tagName === 'object' || tagName === 'embed') && !allowObjectEmbeds(options)) {\n const replacementHtml = getSafeObjectReplacementHtml(element, policyFromOptions(options));\n if (replacementHtml) {\n element.replaceWith(replacementHtml);\n return;\n }\n element.remove();\n return;\n }\n if (tagName === 'base' || tagName === 'meta' || tagName === 'link' || tagName === 'style' || tagName === 'foreignobject') {\n element.remove();\n return;\n }\n // Remove dangerous event handler attributes (case-insensitive).\n const attrs = element.attributes || {};\n for (const attrName of Object.keys(attrs)) {\n if (attrName.toLowerCase().startsWith('on')) {\n element.removeAttribute(attrName);\n }\n }\n // Sanitize URL attributes\n const policy = policyFromOptions(options);\n for (const attrName of Object.keys(attrs)) {\n const lower = attrName.toLowerCase();\n const value = element.getAttribute(attrName);\n if (!value)\n continue;\n // Block srcdoc everywhere (HTML document string).\n if (lower === 'srcdoc') {\n element.removeAttribute(attrName);\n continue;\n }\n if (lower === 'srcset') {\n const sanitized = sanitizeSrcset(value, policy);\n if (!sanitized)\n element.removeAttribute(attrName);\n else if (sanitized !== value)\n element.setAttribute(attrName, sanitized);\n continue;\n }\n // URL-bearing attributes (include SVG xlink:href).\n if (lower === 'href' ||\n lower === 'xlink:href' ||\n lower === 'src' ||\n lower === 'data' ||\n lower === 'action' ||\n lower === 'formaction' ||\n lower === 'poster') {\n const kind = tagName === 'img' ? 'img' :\n tagName === 'audio' || tagName === 'video' || tagName === 'source' ? 'media' :\n tagName === 'object' || tagName === 'embed' ? 'object' :\n tagName === 'a' ? 'link' :\n 'any';\n const sanitized = sanitizeUrlAttr(value, policy, kind);\n if (sanitized !== value)\n element.setAttribute(attrName, sanitized);\n }\n }\n // Recursively sanitize children\n const children = element.childNodes.filter((n) => n.rawTagName);\n for (const child of children) {\n sanitizeElement(child, options, limitsState, depth + 1);\n }\n}\n/**\n * Sanitize HTML string by removing XSS vectors\n *\n * @param html - HTML string to sanitize\n * @returns Sanitized HTML string safe for rendering\n */\nexport function sanitizeHtml(html, options) {\n if (!html || typeof html !== 'string') {\n return '';\n }\n try {\n const limits = normalizeParsingLimits(options?.security);\n if (limits.enabled) {\n const TE = globalThis.TextEncoder;\n const bytes = TE ? new TE().encode(html).byteLength : html.length * 2;\n if (bytes > limits.maxHtmlBytes) {\n return '';\n }\n }\n // Parse HTML\n const root = parse(html, {\n comment: false, // Remove comments (potential XSS vector)\n });\n // Sanitize all elements\n const elements = root.childNodes.filter((n) => n.rawTagName);\n const limitsState = {\n enabled: limits.enabled,\n nodes: 0,\n maxNodes: limits.maxHtmlNodes,\n maxDepth: limits.maxHtmlDepth,\n };\n for (const element of elements) {\n sanitizeElement(element, options, limitsState, 1);\n }\n // Return sanitized HTML\n return root.toString();\n }\n catch (error) {\n if (error instanceof HtmlLimitExceeded) {\n return '';\n }\n // If parsing fails, return empty string (safer than returning potentially malicious content)\n console.error('HTML sanitization failed:', error);\n return '';\n }\n}\n/**\n * Sanitize text content in choice labels, prompts, etc.\n * This is for content that gets serialized to JSON and displayed in UI.\n *\n * @param text - Text content that may contain HTML\n * @returns Sanitized text\n */\nexport function sanitizeTextContent(text, options) {\n if (!text || typeof text !== 'string') {\n return '';\n }\n // If it looks like HTML (contains tags), sanitize it\n if (/<[^>]+>/.test(text)) {\n return sanitizeHtml(text, options);\n }\n // Plain text - return as-is\n return text;\n}\nfunction getSafeObjectReplacementHtml(element, policy) {\n if (element.rawTagName?.toLowerCase() !== 'object') {\n return null;\n }\n const rawType = element.getAttribute('type')?.trim().toLowerCase() ?? '';\n const rawData = element.getAttribute('data')?.trim() ?? '';\n if (!rawType || !rawData) {\n return null;\n }\n const dimensions = `${getOptionalAttr(element, 'width')}${getOptionalAttr(element, 'height')}`;\n const classes = getOptionalAttr(element, 'class');\n const id = getOptionalAttr(element, 'id');\n if (rawType.startsWith('image/')) {\n const src = sanitizeResourceUrl(rawData, policy, 'img');\n if (!src) {\n return null;\n }\n const alt = element.getAttribute('aria-label') ??\n element.getAttribute('title') ??\n element.textContent?.trim() ??\n '';\n return `<img src=\"${escapeAttr(src)}\" alt=\"${escapeAttr(alt)}\"${dimensions}${classes}${id}>`;\n }\n if (rawType.startsWith('audio/')) {\n const src = sanitizeResourceUrl(rawData, policy, 'media');\n if (!src) {\n return null;\n }\n return `<audio controls${classes}${id}><source src=\"${escapeAttr(src)}\" type=\"${escapeAttr(rawType)}\"></audio>`;\n }\n if (rawType.startsWith('video/')) {\n const src = sanitizeResourceUrl(rawData, policy, 'media');\n if (!src) {\n return null;\n }\n const rawPoster = element.getAttribute('poster')?.trim() ?? '';\n const poster = rawPoster\n ? sanitizeResourceUrl(rawPoster, policy, 'img')\n : null;\n const posterAttr = poster ? ` poster=\"${escapeAttr(poster)}\"` : '';\n return `<video controls${dimensions}${classes}${id}${posterAttr}><source src=\"${escapeAttr(src)}\" type=\"${escapeAttr(rawType)}\"></video>`;\n }\n return null;\n}\n//# sourceMappingURL=sanitizer.js.map","/**\n * Standard QTI hottextInteraction extractor\n *\n * Extracts data from hottextInteraction elements (select text spans)\n */\nimport { sanitizeHtml } from '../../core/sanitizer.js';\n/**\n * Standard QTI hottext interaction extractor\n * Handles hottextInteraction elements (selectable text spans)\n */\nexport const standardHottextExtractor = {\n id: 'qti:hottext-interaction',\n name: 'QTI Standard Hottext Interaction',\n priority: 10,\n elementTypes: ['hottextInteraction'],\n description: 'Extracts standard QTI hottextInteraction (select text spans)',\n canHandle(element, _context) {\n // All hottextInteraction elements are standard\n return element.rawTagName === 'hottextInteraction' || element.rawTagName === 'qti-hottext-interaction';\n },\n extract(element, context) {\n const { utils } = context;\n // Extract hottext children (selectable text spans) - recursively search entire tree\n const findHottextElements = (el) => {\n const results = [];\n if (el.rawTagName === 'hottext' || el.rawTagName === 'qti-hottext') {\n results.push(el);\n }\n if (el.childNodes) {\n for (const child of el.childNodes) {\n if (typeof child !== 'string') {\n results.push(...findHottextElements(child));\n }\n }\n }\n return results;\n };\n const hottextElements = findHottextElements(element);\n const hottextChoices = hottextElements.map((hottext) => {\n const classes = utils.getClasses(hottext);\n return {\n identifier: utils.getAttribute(hottext, 'identifier', ''),\n text: utils.getTextContent(hottext),\n ...(classes.length > 0 ? { classes } : {}),\n };\n });\n // Extract attributes\n const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 1);\n const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);\n const interactionClasses = utils.getClasses(element);\n const maxSelectionsMessage = utils.getAttribute(element, 'data-max-selections-message', '') || null;\n const minSelectionsMessage = utils.getAttribute(element, 'data-min-selections-message', '') || null;\n // Extract prompt (optional)\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n // Extract content HTML (all content except prompt)\n let contentHtml = '';\n for (const child of element.childNodes) {\n // Skip prompt elements\n if (typeof child !== 'string' &&\n child.rawTagName !== 'prompt' &&\n child.rawTagName !== 'qti-prompt') {\n contentHtml += child.outerHTML || child.toString();\n }\n else if (typeof child === 'string') {\n contentHtml += child;\n }\n }\n // Sanitize extracted HTML before rendering via {@html} in the component.\n contentHtml = sanitizeHtml(contentHtml, { security: context.config.security });\n return {\n hottextChoices,\n contentHtml,\n maxChoices,\n minChoices,\n prompt,\n ...(interactionClasses.length > 0 ? { interactionClasses } : {}),\n ...(maxSelectionsMessage ? { maxSelectionsMessage } : {}),\n ...(minSelectionsMessage ? { minSelectionsMessage } : {}),\n };\n },\n validate(data) {\n const errors = [];\n const warnings = [];\n // Validate hottextChoices exist\n if (!data.hottextChoices || data.hottextChoices.length === 0) {\n errors.push('hottextInteraction must have at least one hottext');\n }\n // Validate hottext identifiers\n if (data.hottextChoices) {\n const identifiers = new Set();\n for (const hottext of data.hottextChoices) {\n if (!hottext.identifier) {\n errors.push('All hottext elements must have an identifier');\n }\n else if (identifiers.has(hottext.identifier)) {\n errors.push(`Duplicate hottext identifier: ${hottext.identifier}`);\n }\n else {\n identifiers.add(hottext.identifier);\n }\n }\n }\n // Validate maxChoices\n if (data.maxChoices < 0) {\n errors.push('maxChoices must be non-negative');\n }\n // Warn if maxChoices exceeds hottext count\n if (data.hottextChoices && data.maxChoices > data.hottextChoices.length) {\n warnings.push(`maxChoices (${data.maxChoices}) exceeds the number of hottext choices (${data.hottextChoices.length})`);\n }\n // Validate minChoices\n if (data.minChoices !== undefined && data.minChoices < 0) {\n errors.push('minChoices must be non-negative');\n }\n // Validate minChoices <= maxChoices\n if (data.minChoices !== undefined &&\n data.maxChoices > 0 &&\n data.minChoices > data.maxChoices) {\n errors.push('minChoices cannot exceed maxChoices');\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI inlineChoiceInteraction extractor\n *\n * Extracts data from inlineChoiceInteraction elements (dropdown in text)\n */\n/**\n * Standard QTI inline choice interaction extractor\n * Handles inlineChoiceInteraction elements (dropdown selections within text)\n */\nexport const standardInlineChoiceExtractor = {\n id: 'qti:inline-choice-interaction',\n name: 'QTI Standard Inline Choice Interaction',\n priority: 10,\n elementTypes: ['inlineChoiceInteraction'],\n description: 'Extracts standard QTI inlineChoiceInteraction (dropdown in text)',\n canHandle(element, _context) {\n // All inlineChoiceInteraction elements are standard\n return element.rawTagName === 'inlineChoiceInteraction' || element.rawTagName === 'qti-inline-choice-interaction';\n },\n extract(element, context) {\n const { utils } = context;\n // Extract choices (inlineChoice children)\n const inlineChoices = utils.getChildrenByTag(element, 'inlineChoice');\n const choices = inlineChoices.map((choice) => {\n const fixed = utils.getBooleanAttribute(choice, 'fixed');\n return {\n identifier: utils.getAttribute(choice, 'identifier', ''),\n text: utils.getTextContent(choice),\n ...(fixed ? { fixed } : {}),\n };\n });\n // Extract <label> child — used as placeholder text in the dropdown\n const labelElements = utils.getChildrenByTag(element, 'label');\n const label = labelElements.length > 0 ? utils.getTextContent(labelElements[0]) : null;\n // data-prompt: alternative placeholder for the dropdown default option\n const dataPrompt = utils.getAttribute(element, 'data-prompt', '') || null;\n // Extract attributes\n const shuffle = utils.getBooleanAttribute(element, 'shuffle');\n const interactionClasses = utils.getClasses(element);\n return {\n choices,\n shuffle,\n label,\n ...(dataPrompt ? { dataPrompt } : {}),\n ...(interactionClasses.length > 0 ? { interactionClasses } : {}),\n };\n },\n validate(data) {\n const errors = [];\n const warnings = [];\n // Validate choices exist\n if (!data.choices || data.choices.length === 0) {\n errors.push('inlineChoiceInteraction must have at least one choice');\n }\n // Validate choice identifiers\n if (data.choices) {\n const identifiers = new Set();\n for (const choice of data.choices) {\n if (!choice.identifier) {\n errors.push('All choices must have an identifier');\n }\n else if (identifiers.has(choice.identifier)) {\n errors.push(`Duplicate choice identifier: ${choice.identifier}`);\n }\n else {\n identifiers.add(choice.identifier);\n }\n }\n // Warn if too many choices\n if (data.choices.length >= 10) {\n warnings.push(`inlineChoiceInteraction has ${data.choices.length} choices - consider limiting for better usability`);\n }\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI matchInteraction extractor\n *\n * Extracts data from matchInteraction elements (matching pairs)\n */\n/**\n * Standard QTI match interaction extractor\n * Handles matchInteraction elements (matching pairs between two sets)\n */\nexport const standardMatchExtractor = {\n id: 'qti:match-interaction',\n name: 'QTI Standard Match Interaction',\n priority: 10,\n elementTypes: ['matchInteraction'],\n description: 'Extracts standard QTI matchInteraction (matching pairs)',\n canHandle(element, _context) {\n // All matchInteraction elements are standard (both QTI 2.x and 3.0)\n return element.rawTagName === 'matchInteraction' || element.rawTagName === 'qti-match-interaction';\n },\n extract(element, context) {\n const { utils } = context;\n // Extract all simpleAssociableChoice children\n const allChoices = utils.getChildrenByTag(element, 'simpleAssociableChoice');\n // Determine which are source vs target based on matchSet structure\n // In QTI, matchInteraction can have two simpleMatchSet elements\n const matchSets = utils.getChildrenByTag(element, 'simpleMatchSet');\n let sourceSet = [];\n let targetSet = [];\n if (matchSets.length >= 2) {\n // Extract choices from first matchSet (source)\n const sourceMatchSet = matchSets[0];\n const sourceElements = utils.getChildrenByTag(sourceMatchSet, 'simpleAssociableChoice');\n sourceSet = sourceElements.map((choice) => {\n const classes = utils.getClasses(choice);\n const matchMax = utils.getNumberAttribute(choice, 'matchMax', 1);\n const matchMin = utils.getNumberAttribute(choice, 'matchMin', 0);\n const matchGroupRaw = utils.getAttribute(choice, 'matchGroup', '');\n const matchGroup = matchGroupRaw.split(/\\s+/).filter(Boolean);\n return {\n identifier: utils.getAttribute(choice, 'identifier', ''),\n text: utils.getHtmlContent(choice),\n matchMax,\n ...(matchMin > 0 ? { matchMin } : {}),\n ...(matchGroup.length > 0 ? { matchGroup } : {}),\n ...(classes.length > 0 ? { classes } : {}),\n };\n });\n // Extract choices from second matchSet (target)\n const targetMatchSet = matchSets[1];\n const targetElements = utils.getChildrenByTag(targetMatchSet, 'simpleAssociableChoice');\n targetSet = targetElements.map((choice) => {\n const classes = utils.getClasses(choice);\n const matchMax = utils.getNumberAttribute(choice, 'matchMax', 1);\n const matchMin = utils.getNumberAttribute(choice, 'matchMin', 0);\n const matchGroupRaw = utils.getAttribute(choice, 'matchGroup', '');\n const matchGroup = matchGroupRaw.split(/\\s+/).filter(Boolean);\n return {\n identifier: utils.getAttribute(choice, 'identifier', ''),\n text: utils.getHtmlContent(choice),\n matchMax,\n ...(matchMin > 0 ? { matchMin } : {}),\n ...(matchGroup.length > 0 ? { matchGroup } : {}),\n ...(classes.length > 0 ? { classes } : {}),\n };\n });\n }\n else {\n // Fallback: treat all choices as both source and target\n const extractedChoices = allChoices.map((choice) => {\n const classes = utils.getClasses(choice);\n const matchMax = utils.getNumberAttribute(choice, 'matchMax', 1);\n const matchMin = utils.getNumberAttribute(choice, 'matchMin', 0);\n const matchGroupRaw = utils.getAttribute(choice, 'matchGroup', '');\n const matchGroup = matchGroupRaw.split(/\\s+/).filter(Boolean);\n return {\n identifier: utils.getAttribute(choice, 'identifier', ''),\n text: utils.getHtmlContent(choice),\n matchMax,\n ...(matchMin > 0 ? { matchMin } : {}),\n ...(matchGroup.length > 0 ? { matchGroup } : {}),\n ...(classes.length > 0 ? { classes } : {}),\n };\n });\n sourceSet = extractedChoices;\n targetSet = extractedChoices;\n }\n // Extract attributes\n const shuffle = utils.getBooleanAttribute(element, 'shuffle');\n const maxAssociations = utils.getNumberAttribute(element, 'maxAssociations', 1);\n const minAssociationsRaw = utils.getNumberAttribute(element, 'minAssociations', 0);\n const minAssociations = minAssociationsRaw > 0 ? minAssociationsRaw : undefined;\n const interactionClasses = utils.getClasses(element);\n const maxSelectionsMessage = utils.getAttribute(element, 'data-qti-max-selections-message', '') || null;\n const minSelectionsMessage = utils.getAttribute(element, 'data-qti-min-selections-message', '') || null;\n const firstColumnHeader = utils.getAttribute(element, 'data-qti-first-column-header', '') || null;\n // Extract prompt (optional)\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n return {\n sourceSet,\n targetSet,\n shuffle,\n maxAssociations,\n ...(minAssociations !== undefined ? { minAssociations } : {}),\n prompt,\n ...(interactionClasses.length > 0 ? { interactionClasses } : {}),\n ...(maxSelectionsMessage ? { maxSelectionsMessage } : {}),\n ...(minSelectionsMessage ? { minSelectionsMessage } : {}),\n ...(firstColumnHeader ? { firstColumnHeader } : {}),\n };\n },\n validate(data) {\n const errors = [];\n // Validate source choices exist\n if (!data.sourceSet || data.sourceSet.length === 0) {\n errors.push('matchInteraction must have at least one source choice');\n }\n // Validate target choices exist\n if (!data.targetSet || data.targetSet.length === 0) {\n errors.push('matchInteraction must have at least one target choice');\n }\n // Validate choice identifiers\n if (data.sourceSet) {\n const identifiers = new Set();\n for (const choice of data.sourceSet) {\n if (!choice.identifier) {\n errors.push('All source choices must have an identifier');\n }\n else if (identifiers.has(choice.identifier)) {\n errors.push(`Duplicate source identifier: ${choice.identifier}`);\n }\n else {\n identifiers.add(choice.identifier);\n }\n }\n }\n if (data.targetSet) {\n const identifiers = new Set();\n for (const choice of data.targetSet) {\n if (!choice.identifier) {\n errors.push('All target choices must have an identifier');\n }\n else if (identifiers.has(choice.identifier)) {\n errors.push(`Duplicate target identifier: ${choice.identifier}`);\n }\n else {\n identifiers.add(choice.identifier);\n }\n }\n }\n // Validate maxAssociations\n if (data.maxAssociations < 0) {\n errors.push('maxAssociations must be non-negative');\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI mediaInteraction extractor\n *\n * Extracts data from mediaInteraction elements (video/audio playback)\n */\n/**\n * Standard QTI media interaction extractor\n * Handles mediaInteraction elements (video/audio playback with interaction)\n */\nexport const standardMediaExtractor = {\n id: 'qti:media-interaction',\n name: 'QTI Standard Media Interaction',\n priority: 10,\n elementTypes: ['mediaInteraction'],\n description: 'Extracts standard QTI mediaInteraction (video/audio playback)',\n canHandle(element, _context) {\n // All mediaInteraction elements are standard\n return element.rawTagName === 'mediaInteraction';\n },\n extract(element, context) {\n const { utils } = context;\n // Extract attributes\n const autostart = utils.getBooleanAttribute(element, 'autostart', false);\n const minPlays = utils.getNumberAttribute(element, 'minPlays', 0);\n const maxPlays = utils.getNumberAttribute(element, 'maxPlays', 0);\n const loop = utils.getBooleanAttribute(element, 'loop', false);\n // Extract prompt (optional)\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n // Extract media element (audio, video, or object)\n let mediaElement = null;\n // Check for audio element\n const audioElements = utils.getChildrenByTag(element, 'audio');\n if (audioElements.length > 0) {\n const audioElement = audioElements[0];\n const sourceElements = utils.getChildrenByTag(audioElement, 'source');\n if (sourceElements.length === 0) {\n throw new Error('audio element must contain at least one source element');\n }\n const firstSource = sourceElements[0];\n mediaElement = {\n type: 'audio',\n src: utils.getAttribute(firstSource, 'src', ''),\n mimeType: utils.getAttribute(firstSource, 'type', ''),\n };\n }\n // Check for video element\n const videoElements = utils.getChildrenByTag(element, 'video');\n if (videoElements.length > 0) {\n const videoElement = videoElements[0];\n const sourceElements = utils.getChildrenByTag(videoElement, 'source');\n if (sourceElements.length === 0) {\n throw new Error('video element must contain at least one source element');\n }\n const firstSource = sourceElements[0];\n const width = utils.getNumberAttribute(videoElement, 'width', 640);\n const height = utils.getNumberAttribute(videoElement, 'height', 480);\n mediaElement = {\n type: 'video',\n src: utils.getAttribute(firstSource, 'src', ''),\n mimeType: utils.getAttribute(firstSource, 'type', ''),\n width,\n height,\n };\n }\n // Check for object element\n const objectElements = utils.getChildrenByTag(element, 'object');\n if (objectElements.length > 0) {\n const objectElement = objectElements[0];\n const data = utils.getAttribute(objectElement, 'data', '');\n if (!data) {\n throw new Error('object element must have data attribute');\n }\n const width = utils.getNumberAttribute(objectElement, 'width', 0);\n const height = utils.getNumberAttribute(objectElement, 'height', 0);\n mediaElement = {\n type: 'object',\n src: data,\n mimeType: utils.getAttribute(objectElement, 'type', ''),\n ...(width > 0 ? { width } : {}),\n ...(height > 0 ? { height } : {}),\n };\n }\n // Throw error if no media element found\n if (!mediaElement) {\n throw new Error('mediaInteraction must contain audio, video, or object element');\n }\n return {\n mediaElement,\n autostart,\n minPlays,\n maxPlays,\n loop,\n prompt,\n };\n },\n validate(data) {\n const errors = [];\n const warnings = [];\n // Validate media element exists\n if (!data.mediaElement) {\n errors.push('mediaInteraction must have a mediaElement');\n }\n // Validate play constraints\n if (data.minPlays < 0) {\n errors.push('minPlays must be non-negative');\n }\n if (data.maxPlays < 0) {\n errors.push('maxPlays must be non-negative');\n }\n // Validate minPlays <= maxPlays (when maxPlays > 0, as 0 means unlimited)\n if (data.maxPlays > 0 && data.minPlays > data.maxPlays) {\n errors.push(`maxPlays (${data.maxPlays}) must be greater than or equal to minPlays (${data.minPlays})`);\n }\n // Warn if loop is true with maxPlays\n if (data.loop && data.maxPlays > 0) {\n warnings.push('mediaInteraction has loop=true with maxPlays - loop may be ignored');\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI orderInteraction extractor\n *\n * Extracts data from orderInteraction elements (ordering/ranking tasks)\n */\n/**\n * Standard QTI order interaction extractor\n * Handles orderInteraction elements with simpleChoice children\n */\nexport const standardOrderExtractor = {\n id: 'qti:order-interaction',\n name: 'QTI Standard Order Interaction',\n priority: 10,\n elementTypes: ['orderInteraction'],\n description: 'Extracts standard QTI orderInteraction (ordering/ranking tasks)',\n canHandle(element, context) {\n // Standard QTI order interactions have simpleChoice children\n return context.utils.hasChildWithTag(element, 'simpleChoice');\n },\n extract(element, context) {\n const { utils } = context;\n // Extract choices\n const simpleChoices = utils.getChildrenByTag(element, 'simpleChoice');\n const choices = simpleChoices.map((choice) => {\n const classes = utils.getClasses(choice);\n const fixed = utils.getBooleanAttribute(choice, 'fixed');\n return {\n identifier: utils.getAttribute(choice, 'identifier', ''),\n text: utils.getHtmlContent(choice),\n ...(fixed ? { fixed } : {}),\n ...(classes.length > 0 ? { classes } : {}),\n };\n });\n // Extract prompt\n const promptElement = utils.querySelector(element, 'prompt');\n const prompt = promptElement ? utils.getHtmlContent(promptElement) : null;\n // Extract attributes\n const shuffle = utils.getBooleanAttribute(element, 'shuffle');\n const orientation = utils.getAttribute(element, 'orientation', 'vertical');\n const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);\n const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 0);\n return {\n choices,\n shuffle,\n orientation,\n minChoices,\n maxChoices,\n prompt,\n };\n },\n validate(data) {\n const errors = [];\n const warnings = [];\n // Validate choices exist\n if (!data.choices || data.choices.length < 2) {\n errors.push('orderInteraction must have at least 2 choices');\n }\n // Warn if too many choices (difficult to order)\n if (data.choices && data.choices.length > 10) {\n warnings.push(`orderInteraction has ${data.choices.length} choices - this may be difficult for users to order`);\n }\n // Validate choice identifiers\n if (data.choices) {\n const identifiers = new Set();\n for (const choice of data.choices) {\n if (!choice.identifier) {\n errors.push('All choices must have an identifier');\n }\n else if (identifiers.has(choice.identifier)) {\n errors.push(`Duplicate choice identifier: ${choice.identifier}`);\n }\n else {\n identifiers.add(choice.identifier);\n }\n }\n }\n // Validate orientation (only if provided)\n if (data.orientation) {\n const validOrientations = ['vertical', 'horizontal'];\n if (!validOrientations.includes(data.orientation)) {\n warnings.push(`orientation '${data.orientation}' is not standard (expected: ${validOrientations.join(', ')})`);\n }\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI positionObjectInteraction extractor\n *\n * Extracts data from positionObjectInteraction elements (drag objects to positions)\n *\n * ⚠️ IMPORTANT: QTI 2.2 positionObjectInteraction Limitations\n *\n * This interaction has severe limitations that make it impractical for most educational scenarios:\n *\n * 1. Response format is baseType=\"point\" - only stores coordinates [\"158 168\"]\n * 2. NO way to track which specific object was placed where\n * 3. Designed ONLY for placing multiple copies of the SAME object (e.g., airport icons)\n * 4. Cannot support \"place labeled objects on map\" use cases\n *\n * The official QTI 2.2 spec example shows:\n * - ONE positionObjectStage (container) with background image\n * - ONE positionObjectInteraction with ONE draggable object\n * - maxChoices determines how many times the object can be placed\n * - Scoring uses areaMapping to check if ANY placement hits target zones\n *\n * This extractor supports a NON-STANDARD extension with multiple positionObjectStage\n * elements (each with identifiers), but the response format cannot preserve object identity.\n * For labeled-object placement, use graphicGapMatchInteraction instead.\n */\n/**\n * Standard QTI position object interaction extractor\n * Handles positionObjectInteraction elements (dragging an object to a position)\n */\nexport const standardPositionObjectExtractor = {\n id: 'qti:position-object-interaction',\n name: 'QTI Standard Position Object Interaction',\n priority: 10,\n elementTypes: ['positionObjectInteraction'],\n description: 'Extracts standard QTI positionObjectInteraction (drag object to position)',\n canHandle(element, _context) {\n // All positionObjectInteraction elements are standard\n return element.rawTagName === 'positionObjectInteraction';\n },\n extract(element, context) {\n const { utils } = context;\n // Extract background image data from object element (direct child)\n const objectElements = utils.getChildrenByTag(element, 'object');\n let imageData = null;\n if (objectElements.length > 0) {\n const objectElement = objectElements[0];\n const type = utils.getAttribute(objectElement, 'type', '');\n const data = utils.getAttribute(objectElement, 'data', '');\n const width = utils.getAttribute(objectElement, 'width', '500');\n const height = utils.getAttribute(objectElement, 'height', '300');\n if (type.startsWith('image/svg')) {\n // Extract inline SVG content - get full content including <svg> tag\n const content = utils.getHtmlContent(objectElement);\n imageData = {\n type: 'svg',\n content,\n width,\n height,\n };\n }\n else {\n // External image reference\n imageData = {\n type: 'image',\n src: data,\n width,\n height,\n };\n }\n }\n // Extract positionObjectStage children\n const stageElements = utils.getChildrenByTag(element, 'positionObjectStage');\n const positionObjectStages = stageElements.map((stage) => {\n const classes = utils.getClasses(stage);\n const identifier = utils.getAttribute(stage, 'identifier', '');\n const matchMax = utils.getNumberAttribute(stage, 'matchMax', 1);\n const matchMin = utils.getNumberAttribute(stage, 'matchMin', 0);\n // Get text content as label, use identifier as fallback\n const textContent = utils.getTextContent(stage).trim();\n const label = textContent || identifier;\n // Extract object data from nested object element\n const stageObjectElements = utils.getChildrenByTag(stage, 'object');\n let objectData = null;\n if (stageObjectElements.length > 0) {\n const objElement = stageObjectElements[0];\n const objType = utils.getAttribute(objElement, 'type', '');\n const objData = utils.getAttribute(objElement, 'data', '');\n const objWidth = utils.getAttribute(objElement, 'width', '50');\n const objHeight = utils.getAttribute(objElement, 'height', '50');\n if (objType.startsWith('image/svg')) {\n // Extract inline SVG content\n const content = utils.getHtmlContent(objElement);\n objectData = {\n type: 'svg',\n content,\n width: objWidth,\n height: objHeight,\n };\n }\n else {\n // External image reference\n objectData = {\n type: 'image',\n src: objData,\n width: objWidth,\n height: objHeight,\n };\n }\n }\n return {\n identifier,\n label,\n matchMax,\n ...(matchMin > 0 ? { matchMin } : {}),\n objectData,\n ...(classes.length > 0 ? { classes } : {}),\n };\n });\n // Extract attributes\n // centerPoint defaults to true when not specified\n const centerPoint = utils.getBooleanAttribute(element, 'centerPoint', true);\n const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 0);\n const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);\n // Extract prompt (optional)\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n return {\n imageData,\n positionObjectStages,\n centerPoint,\n maxChoices,\n minChoices,\n prompt,\n };\n },\n validate(data) {\n const errors = [];\n const warnings = [];\n // Validate image data\n if (!data.imageData) {\n warnings.push('positionObjectInteraction has no background image');\n }\n else if (data.imageData.type === 'image' && !data.imageData.src) {\n errors.push('positionObjectInteraction must have an image URL');\n }\n else if (data.imageData.type === 'svg' && !data.imageData.content) {\n errors.push('positionObjectInteraction must have SVG content');\n }\n // Warn about dimension consistency (cannot verify actual file dimensions at extraction time)\n if (data.imageData && data.imageData.type === 'image') {\n warnings.push('IMPORTANT: Ensure declared width/height match actual image file dimensions. ' +\n 'Mismatched dimensions cause coordinate system errors in mapResponsePoint scoring. ' +\n `Declared: ${data.imageData.width || 'unspecified'}×${data.imageData.height || 'unspecified'}`);\n }\n // Validate positionObjectStages exist\n if (!data.positionObjectStages || data.positionObjectStages.length === 0) {\n errors.push('positionObjectInteraction must have at least one positionObjectStage');\n }\n // Validate positionObjectStage identifiers\n if (data.positionObjectStages) {\n const identifiers = new Set();\n for (const stage of data.positionObjectStages) {\n if (!stage.identifier) {\n errors.push('All positionObjectStages must have an identifier');\n }\n else if (identifiers.has(stage.identifier)) {\n errors.push(`Duplicate positionObjectStage identifier: ${stage.identifier}`);\n }\n else {\n identifiers.add(stage.identifier);\n }\n }\n }\n // Validate maxChoices\n if (data.maxChoices < 0) {\n errors.push('maxChoices must be non-negative');\n }\n // Validate minChoices\n if (data.minChoices < 0) {\n errors.push('minChoices must be non-negative');\n }\n // Validate minChoices <= maxChoices\n if (data.maxChoices > 0 && data.minChoices > data.maxChoices) {\n errors.push('minChoices cannot exceed maxChoices');\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI selectPointInteraction extractor\n *\n * Extracts data from selectPointInteraction elements (click point on image)\n */\n/**\n * Standard QTI select point interaction extractor\n * Handles selectPointInteraction elements (clicking points on an image)\n */\nexport const standardSelectPointExtractor = {\n id: 'qti:select-point-interaction',\n name: 'QTI Standard Select Point Interaction',\n priority: 10,\n elementTypes: ['selectPointInteraction'],\n description: 'Extracts standard QTI selectPointInteraction (click point on image)',\n canHandle(element, _context) {\n // All selectPointInteraction elements are standard\n return element.rawTagName === 'selectPointInteraction';\n },\n extract(element, context) {\n const { utils } = context;\n // Extract image data from object or img element\n const objectElements = utils.getChildrenByTag(element, 'object');\n const imgElements = utils.getChildrenByTag(element, 'img');\n let imageData = null;\n if (objectElements.length > 0) {\n const objectElement = objectElements[0];\n const type = utils.getAttribute(objectElement, 'type', '');\n const data = utils.getAttribute(objectElement, 'data', '');\n const width = utils.getAttribute(objectElement, 'width', '500');\n const height = utils.getAttribute(objectElement, 'height', '300');\n if (type.startsWith('image/svg')) {\n // Extract inline SVG content - get full content including <svg> tag\n const content = utils.getHtmlContent(objectElement);\n imageData = {\n type: 'svg',\n content,\n width,\n height,\n };\n }\n else {\n // External image reference\n imageData = {\n type: 'image',\n src: data,\n width,\n height,\n };\n }\n }\n else if (imgElements.length > 0) {\n // Handle img element as fallback\n const imgElement = imgElements[0];\n const src = utils.getAttribute(imgElement, 'src', '');\n const width = utils.getAttribute(imgElement, 'width', '500');\n const height = utils.getAttribute(imgElement, 'height', '300');\n imageData = {\n type: 'image',\n src,\n width,\n height,\n };\n }\n // Extract attributes\n const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 1);\n const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);\n // Extract prompt (optional)\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n return {\n imageData,\n maxChoices,\n minChoices,\n prompt,\n };\n },\n validate(data) {\n const errors = [];\n const warnings = [];\n // Validate image data\n if (!data.imageData) {\n warnings.push('selectPointInteraction has no image data');\n }\n else if (data.imageData.type === 'image' && !data.imageData.src) {\n errors.push('selectPointInteraction must have an image URL');\n }\n else if (data.imageData.type === 'svg' && !data.imageData.content) {\n errors.push('selectPointInteraction must have SVG content');\n }\n // Validate maxChoices — 0 means unlimited per QTI spec\n if (data.maxChoices < 0) {\n errors.push('maxChoices must be non-negative');\n }\n // Validate minChoices\n if (data.minChoices < 0) {\n errors.push('minChoices must be non-negative');\n }\n // Validate minChoices <= maxChoices (skip when maxChoices=0, meaning unlimited)\n if (data.maxChoices > 0 && data.minChoices > data.maxChoices) {\n errors.push(`minChoices (${data.minChoices}) must be less than or equal to maxChoices (${data.maxChoices})`);\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI sliderInteraction extractor\n *\n * Extracts data from sliderInteraction elements (slider input)\n */\n/**\n * Standard QTI slider interaction extractor\n * Handles sliderInteraction elements (slider for numeric input)\n */\nexport const standardSliderExtractor = {\n id: 'qti:slider-interaction',\n name: 'QTI Standard Slider Interaction',\n priority: 10,\n elementTypes: ['sliderInteraction'],\n description: 'Extracts standard QTI sliderInteraction (slider input)',\n canHandle(element, _context) {\n // All sliderInteraction elements are standard\n return element.rawTagName === 'sliderInteraction';\n },\n extract(element, context) {\n const { utils } = context;\n // Extract required attributes\n const lowerBound = utils.getNumberAttribute(element, 'lowerBound', 0);\n const upperBound = utils.getNumberAttribute(element, 'upperBound', 100);\n const step = utils.getNumberAttribute(element, 'step', 1);\n const orientation = utils.getAttribute(element, 'orientation', 'horizontal');\n const reverse = utils.getBooleanAttribute(element, 'reverse', false);\n // Extract optional attributes\n const stepLabel = utils.getBooleanAttribute(element, 'stepLabel');\n // Extract prompt (optional)\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n return {\n lowerBound,\n upperBound,\n step,\n orientation,\n reverse,\n ...(stepLabel ? { stepLabel } : {}),\n prompt,\n };\n },\n validate(data) {\n const errors = [];\n const warnings = [];\n // Validate bounds\n if (data.lowerBound >= data.upperBound) {\n errors.push('lowerBound must be less than upperBound');\n }\n // Validate step\n if (data.step <= 0) {\n errors.push('step must be greater than 0');\n }\n // Validate orientation\n if (data.orientation && !['horizontal', 'vertical'].includes(data.orientation)) {\n errors.push('orientation must be \"horizontal\" or \"vertical\"');\n }\n // Warn if step is larger than range\n const range = data.upperBound - data.lowerBound;\n if (data.step > range) {\n warnings.push(`step (${data.step}) is larger than the range (${range})`);\n }\n else if (range % data.step !== 0) {\n // Warn if step doesn't evenly divide range\n warnings.push(`step ${data.step} does not evenly divide range ${range} (${data.lowerBound} to ${data.upperBound})`);\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI textEntryInteraction extractor\n *\n * Extracts data from textEntryInteraction elements (inline text input)\n */\n/**\n * Standard QTI text entry interaction extractor\n * Handles textEntryInteraction elements (inline text input)\n */\nexport const standardTextEntryExtractor = {\n id: 'qti:text-entry-interaction',\n name: 'QTI Standard Text Entry Interaction',\n priority: 10,\n elementTypes: ['textEntryInteraction'],\n description: 'Extracts standard QTI textEntryInteraction (inline text input)',\n canHandle(element, _context) {\n // All textEntryInteraction elements are standard (both QTI 2.x and 3.0)\n return (element.rawTagName === 'textEntryInteraction' || element.rawTagName === 'qti-text-entry-interaction');\n },\n extract(element, context) {\n const { utils } = context;\n // Extract attributes\n const expectedLength = utils.getNumberAttribute(element, 'expectedLength', 20);\n const patternMask = utils.getAttribute(element, 'patternMask', '');\n const placeholderText = utils.getAttribute(element, 'placeholderText', '');\n const format = utils.getAttribute(element, 'format', '');\n const interactionClasses = utils.getClasses(element);\n const patternMaskMessage = utils.getAttribute(element, 'data-patternmask-message', '') || null;\n return {\n expectedLength,\n patternMask: patternMask || null,\n placeholderText,\n ...(format ? { format } : {}),\n ...(interactionClasses.length > 0 ? { interactionClasses } : {}),\n ...(patternMaskMessage ? { patternMaskMessage } : {}),\n };\n },\n validate(data) {\n const errors = [];\n const warnings = [];\n // Validate expectedLength\n if (data.expectedLength < 1) {\n errors.push('expectedLength must be positive');\n }\n if (data.expectedLength > 1000) {\n warnings.push(`expectedLength (${data.expectedLength}) is very large - consider using extendedTextInteraction`);\n }\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","/**\n * Standard QTI uploadInteraction extractor\n *\n * Extracts data from uploadInteraction elements (file upload)\n */\n/**\n * Standard QTI upload interaction extractor\n * Handles uploadInteraction elements (file upload)\n */\nexport const standardUploadExtractor = {\n id: 'qti:upload-interaction',\n name: 'QTI Standard Upload Interaction',\n priority: 10,\n elementTypes: ['uploadInteraction'],\n description: 'Extracts standard QTI uploadInteraction (file upload)',\n canHandle(element, _context) {\n // All uploadInteraction elements are standard\n return element.rawTagName === 'uploadInteraction';\n },\n extract(element, context) {\n const { utils } = context;\n // Extract fileType child elements (vendor / QTI 3.0 style)\n const fileTypeElements = utils.getChildrenByTag(element, 'fileType');\n let fileTypes = fileTypeElements.map((el) => utils.getTextContent(el));\n // Fall back to QTI 2.x `type` attribute when no <fileType> children are present\n if (fileTypes.length === 0) {\n const typeAttr = utils.getAttribute(element, 'type', '');\n if (typeAttr) {\n fileTypes = typeAttr.split(/\\s+/).filter(Boolean);\n }\n }\n // Extract all attributes\n const rawAttributes = {};\n if (element.attributes) {\n for (const [key, value] of Object.entries(element.attributes)) {\n rawAttributes[key] = String(value);\n }\n }\n // Extract prompt (optional)\n const promptElements = utils.getChildrenByTag(element, 'prompt');\n const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;\n return {\n fileTypes,\n rawAttributes,\n prompt,\n };\n },\n validate(data) {\n const warnings = [];\n // Warn if no file type restrictions\n if (!data.fileTypes || data.fileTypes.length === 0) {\n warnings.push('uploadInteraction has no fileTypes - any file type will be accepted');\n }\n return {\n valid: true,\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n },\n};\n//# sourceMappingURL=extractor.js.map","import { standardAssociateExtractor } from './associate/index.js';\nimport { standardChoiceExtractor } from './choice/index.js';\nimport { standardCustomExtractor } from './custom/index.js';\nimport { standardDrawingExtractor } from './drawing/index.js';\nimport { standardEndAttemptExtractor } from './end-attempt/index.js';\nimport { standardExtendedTextExtractor } from './extended-text/index.js';\nimport { standardGapMatchExtractor } from './gap-match/index.js';\nimport { standardGraphicAssociateExtractor } from './graphic-associate/index.js';\nimport { standardGraphicGapMatchExtractor } from './graphic-gap-match/index.js';\nimport { standardGraphicOrderExtractor } from './graphic-order/index.js';\nimport { standardHotspotExtractor } from './hotspot/index.js';\nimport { standardHottextExtractor } from './hottext/index.js';\nimport { standardInlineChoiceExtractor } from './inline-choice/index.js';\nimport { standardMatchExtractor } from './match/index.js';\nimport { standardMediaExtractor } from './media/index.js';\nimport { standardOrderExtractor } from './order/index.js';\nimport { standardPositionObjectExtractor } from './position-object/index.js';\nimport { standardSelectPointExtractor } from './select-point/index.js';\nimport { standardSliderExtractor } from './slider/index.js';\nimport { standardTextEntryExtractor } from './text-entry/index.js';\nimport { standardUploadExtractor } from './upload/index.js';\nexport const STANDARD_INTERACTION_MODULES = [\n { type: 'choiceInteraction', extractor: standardChoiceExtractor, placement: 'block' },\n { type: 'textEntryInteraction', extractor: standardTextEntryExtractor, placement: 'inline' },\n { type: 'extendedTextInteraction', extractor: standardExtendedTextExtractor, placement: 'block' },\n { type: 'inlineChoiceInteraction', extractor: standardInlineChoiceExtractor, placement: 'inline' },\n { type: 'orderInteraction', extractor: standardOrderExtractor, placement: 'block' },\n { type: 'matchInteraction', extractor: standardMatchExtractor, placement: 'block' },\n { type: 'associateInteraction', extractor: standardAssociateExtractor, placement: 'block' },\n { type: 'gapMatchInteraction', extractor: standardGapMatchExtractor, placement: 'block' },\n { type: 'sliderInteraction', extractor: standardSliderExtractor, placement: 'block' },\n { type: 'hotspotInteraction', extractor: standardHotspotExtractor, placement: 'block' },\n { type: 'graphicGapMatchInteraction', extractor: standardGraphicGapMatchExtractor, placement: 'block' },\n { type: 'uploadInteraction', extractor: standardUploadExtractor, placement: 'block' },\n { type: 'drawingInteraction', extractor: standardDrawingExtractor, placement: 'block' },\n { type: 'customInteraction', extractor: standardCustomExtractor, placement: 'block' },\n { type: 'mediaInteraction', extractor: standardMediaExtractor, placement: 'block' },\n { type: 'hottextInteraction', extractor: standardHottextExtractor, placement: 'block' },\n { type: 'selectPointInteraction', extractor: standardSelectPointExtractor, placement: 'block' },\n { type: 'graphicOrderInteraction', extractor: standardGraphicOrderExtractor, placement: 'block' },\n { type: 'graphicAssociateInteraction', extractor: standardGraphicAssociateExtractor, placement: 'block' },\n { type: 'positionObjectInteraction', extractor: standardPositionObjectExtractor, placement: 'block' },\n { type: 'endAttemptInteraction', extractor: standardEndAttemptExtractor, placement: 'block' },\n];\nexport function getStandardInteractionModules() {\n return STANDARD_INTERACTION_MODULES;\n}\nexport function getStandardBlockInteractionModules() {\n return STANDARD_INTERACTION_MODULES.filter((module) => module.placement === 'block');\n}\nexport function getStandardInlineInteractionModules() {\n return STANDARD_INTERACTION_MODULES.filter((module) => module.placement === 'inline');\n}\nexport function getStandardInteractionExtractors() {\n return STANDARD_INTERACTION_MODULES.map((module) => module.extractor);\n}\nexport function getStandardInteractionElementTypes() {\n const elementTypes = new Set();\n for (const module of STANDARD_INTERACTION_MODULES) {\n for (const elementType of module.extractor.elementTypes) {\n elementTypes.add(elementType);\n }\n }\n return [...elementTypes];\n}\nconst STANDARD_TYPE_BY_LOWERCASE = new Map(STANDARD_INTERACTION_MODULES.map((module) => [module.type.toLowerCase(), module.type]));\nexport function normalizeInteractionTypeFromTagName(tagName) {\n const lowerTagName = tagName.toLowerCase();\n if (lowerTagName.startsWith('qti-')) {\n return lowerTagName.slice(4).replace(/-([a-z])/g, (_match, letter) => letter.toUpperCase());\n }\n return STANDARD_TYPE_BY_LOWERCASE.get(lowerTagName) ?? tagName;\n}\nexport function getStandardInteractionModule(type) {\n const normalizedType = normalizeInteractionTypeFromTagName(type);\n return STANDARD_INTERACTION_MODULES.find((module) => module.type === normalizedType) ?? null;\n}\nexport function isStandardInlineInteractionType(type) {\n return getStandardInteractionModule(type)?.placement === 'inline';\n}\nexport function isStandardBlockInteractionType(type) {\n return getStandardInteractionModule(type)?.placement === 'block';\n}\nexport function isStandardInlineInteractionTagName(tagName) {\n return isStandardInlineInteractionType(normalizeInteractionTypeFromTagName(tagName));\n}\n//# sourceMappingURL=modules.js.map","import { findAssessmentItem, findDescendants, findFirstDescendant, parseXml, serializeXml, } from '@pie-qti/qti-processing';\nimport { parse } from 'node-html-parser';\nimport { enforceItemXmlLimits } from '../core/parsingLimits.js';\nimport { normalizeInteractionTypeFromTagName } from '../interactions/modules.js';\nexport class AssessmentItemDocument {\n constructor({ itemXml, elementNameMapper, attributeNameMapper, security, }) {\n this.extractionDocument = null;\n this.extractionRoot = null;\n this.itemXml = itemXml;\n this.security = security;\n this.mathMlPrefixes = findMathMlPrefixes(itemXml);\n this.elementNameMapper = elementNameMapper;\n this.attributeNameMapper = attributeNameMapper;\n enforceItemXmlLimits(this.itemXml, this.security);\n this.xmlDocument = parseXml(this.itemXml);\n this.assessmentItem = findAssessmentItem(this.xmlDocument);\n }\n getAssessmentItem() {\n return this.assessmentItem;\n }\n getProcessingElement(kind) {\n const tagName = kind === 'template'\n ? 'templateprocessing'\n : kind === 'response'\n ? 'responseprocessing'\n : 'outcomeprocessing';\n return findFirstDescendant(this.assessmentItem, this.elementNameMapper.toNative(tagName));\n }\n serializeItemBodyChildren() {\n const itemBody = this.getItemBodyElement();\n if (!itemBody)\n return '';\n return this.serializeChildren(itemBody);\n }\n findRubricElements() {\n return findDescendants(this.assessmentItem, this.elementNameMapper.toNative('rubricblock'));\n }\n findModalFeedbackElements() {\n return findDescendants(this.assessmentItem, this.elementNameMapper.toNative('modalfeedback'));\n }\n findDeclarationElements(kind) {\n const tagName = kind === 'response'\n ? 'responsedeclaration'\n : kind === 'outcome'\n ? 'outcomedeclaration'\n : 'templatedeclaration';\n return findDescendants(this.assessmentItem, this.elementNameMapper.toNative(tagName));\n }\n getAssessmentItemAttribute(name) {\n return this.assessmentItem.getAttribute(this.attributeNameMapper.toNative(name));\n }\n serializeChildren(element) {\n return normalizeMathMlPrefixes(unwrapCdataSections(this.serializeChildNodes(element)), this.mathMlPrefixes);\n }\n findExtractionElements(elementTypes) {\n const root = this.getExtractionRoot();\n if (!root)\n return [];\n const canonicalTypes = new Set([...elementTypes].map((elementType) => this.elementNameMapper.toCanonical(elementType)));\n const elements = [];\n this.walkExtractionChildren(root, (element) => {\n const rawTagName = element.rawTagName;\n if (!rawTagName)\n return;\n if (!canonicalTypes.has(this.elementNameMapper.toCanonical(rawTagName)))\n return;\n const responseIdentifier = this.getExtractionResponseIdentifier(element);\n if (!responseIdentifier)\n return;\n elements.push({\n element,\n contextRoot: root,\n responseIdentifier,\n normalizedType: normalizeInteractionTypeFromTagName(rawTagName),\n });\n });\n return elements;\n }\n getExtractionRoot() {\n if (this.extractionRoot)\n return this.extractionRoot;\n const docRoot = this.getExtractionDocument();\n const itemBodyTag = this.elementNameMapper.toNative('itembody').toLowerCase();\n this.extractionRoot = docRoot.querySelector?.(itemBodyTag) ?? null;\n return this.extractionRoot;\n }\n getExtractionDocument() {\n if (!this.extractionDocument) {\n enforceItemXmlLimits(this.itemXml, this.security);\n this.extractionDocument = parse(this.serializeItemBodyForExtraction(), {\n lowerCaseTagName: false,\n comment: false,\n });\n }\n return this.extractionDocument;\n }\n getItemBodyElement() {\n return findFirstDescendant(this.assessmentItem, this.elementNameMapper.toNative('itembody'));\n }\n serializeItemBodyForExtraction() {\n const itemBodyTag = this.elementNameMapper.toNative('itembody');\n const itemBody = this.getItemBodyElement();\n const itemBodyChildren = itemBody ? this.serializeChildren(itemBody) : '';\n return `<assessmentItem><${itemBodyTag}>${itemBodyChildren}</${itemBodyTag}></assessmentItem>`;\n }\n serializeChildNodes(element) {\n const children = element.childNodes;\n if (!children)\n return '';\n const serialized = [];\n for (let index = 0; index < children.length; index++) {\n const child = children[index];\n if (child) {\n serialized.push(serializeXml(child));\n }\n }\n return serialized.join('');\n }\n walkExtractionChildren(root, visit) {\n for (const child of root.childNodes ?? []) {\n const element = child;\n if (!element.rawTagName)\n continue;\n visit(element);\n this.walkExtractionChildren(element, visit);\n }\n }\n getExtractionResponseIdentifier(element) {\n const nativeName = this.attributeNameMapper.toNative('responseIdentifier');\n return (element.getAttribute?.('responseIdentifier') ||\n element.getAttribute?.(nativeName) ||\n element.getAttribute?.('response-identifier') ||\n element.getAttribute?.('responseidentifier') ||\n '');\n }\n}\nexport function parseAssessmentItemDocument(input) {\n return new AssessmentItemDocument(input);\n}\nfunction unwrapCdataSections(xml) {\n return xml.replace(/<!\\[CDATA\\[([\\s\\S]*?)\\]\\]>/g, (_match, content) => content);\n}\nfunction findMathMlPrefixes(xml) {\n const prefixes = new Set();\n for (const match of xml.matchAll(/\\sxmlns:([A-Za-z_][\\w.-]*)=([\"'])http:\\/\\/www\\.w3\\.org\\/1998\\/Math\\/MathML\\2/g)) {\n const prefix = match[1];\n if (prefix) {\n prefixes.add(prefix);\n }\n }\n return prefixes;\n}\nfunction normalizeMathMlPrefixes(xml, prefixes) {\n let normalized = xml;\n for (const prefix of prefixes) {\n const escapedPrefix = escapeRegExp(prefix);\n normalized = normalized\n .replace(new RegExp(`(<\\\\/?)${escapedPrefix}:([A-Za-z][\\\\w.-]*)(?=[\\\\s>/])`, 'g'), '$1$2')\n .replace(new RegExp(`\\\\sxmlns:${escapedPrefix}=([\"'])http:\\\\/\\\\/www\\\\.w3\\\\.org\\\\/1998\\\\/Math\\\\/MathML\\\\1`, 'g'), '');\n }\n return normalized;\n}\nfunction escapeRegExp(value) {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n//# sourceMappingURL=AssessmentItemDocument.js.map","/**\n * Core types for the plugin-based element extraction system\n *\n * Provides interfaces for extracting data from QTI XML elements with\n * priority-based dispatch, validation, and type safety.\n */\n/**\n * Error thrown during extraction\n */\nexport class ExtractionError extends Error {\n constructor(message, extractorId, elementType, cause) {\n super(message);\n this.extractorId = extractorId;\n this.elementType = elementType;\n this.cause = cause;\n this.name = 'ExtractionError';\n }\n}\n/**\n * Type guard for successful extraction result\n */\nexport function isSuccessResult(result) {\n return result.success === true;\n}\n/**\n * Type guard for failed extraction result\n */\nexport function isErrorResult(result) {\n return result.success === false;\n}\n//# sourceMappingURL=types.js.map","/**\n * ExtractionRegistry for priority-based element extraction\n *\n * Manages a collection of ElementExtractor instances with:\n * - Priority-based dispatch (highest priority checked first)\n * - Type-based indexing for O(M) lookup instead of O(N) scanning\n * - WeakMap caching for O(1) repeat lookups\n * - Validation and error handling\n */\nimport { Qti2xElementNameMapper } from '@pie-qti/qti-common';\nimport { ExtractionError } from './types.js';\n/**\n * Registry for element extractors with priority-based dispatch\n */\nexport class ExtractionRegistry {\n constructor(elementNameMapper) {\n /** All registered extractors by ID */\n this.extractorsById = new Map();\n /** Extractors indexed by element type for fast lookup */\n this.extractorsByType = new Map();\n /** Cache for element -> extractor lookups (WeakMap for automatic GC) */\n this.extractorCache = new WeakMap();\n /** QTI 2.x mapper for converting canonical names to extractor registry keys */\n this.qti2xMapper = new Qti2xElementNameMapper();\n this.elementNameMapper = elementNameMapper;\n }\n /**\n * Register an extractor with the registry\n *\n * @param extractor - The extractor to register\n * @throws Error if extractor ID is already registered\n *\n * @example\n * registry.register({\n * id: 'qti:choice',\n * name: 'QTI Standard Choice',\n * priority: 10,\n * elementTypes: ['choiceInteraction'],\n * canHandle: (element) => utils.hasChildWithTag(element, 'simpleChoice'),\n * extract: (element, context) => ({ choices: [...] })\n * });\n */\n register(extractor) {\n // Check for duplicate ID\n if (this.extractorsById.has(extractor.id)) {\n throw new Error(`Extractor with ID '${extractor.id}' is already registered. ` +\n `Each extractor must have a unique ID.`);\n }\n // Validate extractor configuration\n if (!extractor.id || typeof extractor.id !== 'string') {\n throw new Error(`Extractor must have a valid string ID`);\n }\n if (!extractor.elementTypes || extractor.elementTypes.length === 0) {\n throw new Error(`Extractor '${extractor.id}' must specify at least one element type`);\n }\n if (typeof extractor.priority !== 'number') {\n throw new Error(`Extractor '${extractor.id}' must have a numeric priority`);\n }\n // Register by ID\n this.extractorsById.set(extractor.id, extractor);\n // Register by type for fast lookup\n // Normalize element types to canonical (lowercase) form for version-agnostic lookup\n for (const type of extractor.elementTypes) {\n // Convert to canonical form - extractors specify QTI 2.x names (e.g., 'choiceInteraction')\n // but we store them in canonical form (e.g., 'choiceinteraction') for QTI version independence\n const canonicalType = this.qti2xMapper.toCanonical(type);\n let extractors = this.extractorsByType.get(canonicalType);\n if (!extractors) {\n extractors = [];\n this.extractorsByType.set(canonicalType, extractors);\n }\n extractors.push(extractor);\n // Keep sorted by priority (highest first)\n extractors.sort((a, b) => b.priority - a.priority);\n }\n }\n /**\n * Unregister an extractor by ID\n *\n * @param id - The extractor ID to unregister\n * @returns true if extractor was found and removed, false otherwise\n */\n unregister(id) {\n const extractor = this.extractorsById.get(id);\n if (!extractor)\n return false;\n // Remove from ID map\n this.extractorsById.delete(id);\n // Remove from type maps (using canonical form)\n for (const type of extractor.elementTypes) {\n const canonicalType = this.qti2xMapper.toCanonical(type);\n const extractors = this.extractorsByType.get(canonicalType);\n if (extractors) {\n const index = extractors.findIndex((e) => e.id === id);\n if (index !== -1) {\n extractors.splice(index, 1);\n }\n // Clean up empty arrays\n if (extractors.length === 0) {\n this.extractorsByType.delete(canonicalType);\n }\n }\n }\n return true;\n }\n /**\n * Find an extractor that can handle the given element\n * Uses type-based indexing and caching for performance\n *\n * @param element - The element to find an extractor for\n * @param context - Extraction context\n * @returns The matching extractor, or null if none found\n */\n findExtractor(element, context) {\n // Check cache first (O(1) lookup)\n const cached = this.extractorCache.get(element);\n if (cached)\n return cached;\n // Get element type - normalize using mapper for QTI version handling\n // Extractors are registered in canonical (lowercase) form for version independence.\n // Convert any QTI version element name to canonical form for lookup.\n //\n // Example for QTI 3.0:\n // 'qti-choice-interaction' → 'choiceinteraction' (canonical)\n // Example for QTI 2.x:\n // 'choiceInteraction' → 'choiceinteraction' (canonical)\n let lookupKey = element.rawTagName || '';\n const originalKey = lookupKey;\n if (lookupKey && this.elementNameMapper) {\n // Convert element's raw tag to canonical form using the document's mapper\n lookupKey = this.elementNameMapper.toCanonical(lookupKey);\n }\n // Get extractors for this element type (O(1) map lookup)\n const extractors = this.extractorsByType.get(lookupKey);\n if (!extractors || extractors.length === 0) {\n return null;\n }\n // Evaluate canHandle in priority order (O(M) where M = extractors for this type)\n for (const extractor of extractors) {\n try {\n const canHandle = extractor.canHandle(element, context);\n const typeMatchedThroughMapper = !!this.elementNameMapper && extractor.elementTypes.some((type) => this.qti2xMapper.toCanonical(type) === lookupKey);\n if (canHandle || typeMatchedThroughMapper) {\n // Cache the result\n this.extractorCache.set(element, extractor);\n return extractor;\n }\n }\n catch (error) {\n // Log but continue to next extractor\n console.warn(`canHandle() failed for extractor '${extractor.id}' (${extractor.name}):`, error);\n }\n }\n return null;\n }\n /**\n * Extract data from an element using the appropriate extractor\n *\n * @param element - The element to extract data from\n * @param context - Extraction context\n * @returns Extraction result with data or error\n *\n * @example\n * const result = registry.extract<ChoiceData>(element, context);\n * if (result.success) {\n * console.log('Extracted:', result.data);\n * if (result.warnings) console.warn('Warnings:', result.warnings);\n * } else {\n * console.error('Extraction failed:', result.error.message);\n * }\n */\n extract(element, context) {\n // Find appropriate extractor\n const extractor = this.findExtractor(element, context);\n if (!extractor) {\n const elementType = element.rawTagName || 'unknown';\n const error = new ExtractionError(`No extractor available for element '${elementType}'. ` +\n `Registered types: ${Array.from(this.extractorsByType.keys()).join(', ')}`, 'none', elementType);\n return { success: false, error };\n }\n try {\n // Extract data\n const data = extractor.extract(element, context);\n // Validate if validator provided\n if (extractor.validate) {\n const validation = extractor.validate(data);\n if (!validation.valid) {\n const error = new ExtractionError(`Validation failed for extractor '${extractor.id}': ${validation.errors?.join(', ')}`, extractor.id, element.rawTagName || 'unknown');\n return { success: false, error };\n }\n // Return with warnings if present\n if (validation.warnings && validation.warnings.length > 0) {\n return { success: true, data, warnings: validation.warnings };\n }\n }\n return { success: true, data };\n }\n catch (error) {\n const elementType = element.rawTagName || 'unknown';\n const extractionError = error instanceof ExtractionError\n ? error\n : new ExtractionError(`Extraction failed for '${elementType}': ${error instanceof Error ? error.message : String(error)}`, extractor.id, elementType, error instanceof Error ? error : undefined);\n return { success: false, error: extractionError };\n }\n }\n /**\n * Get all registered extractors\n * @returns Read-only array of extractors sorted by priority (highest first)\n */\n getExtractors() {\n const all = Array.from(this.extractorsById.values());\n all.sort((a, b) => b.priority - a.priority);\n return all;\n }\n /**\n * Get extractors for a specific element type\n * @param elementType - The element type (e.g., 'choiceInteraction')\n * @returns Read-only array of extractors for this type, sorted by priority\n */\n getExtractorsForType(elementType) {\n // Convert to canonical form for lookup\n const canonicalType = this.qti2xMapper.toCanonical(elementType);\n return this.extractorsByType.get(canonicalType) || [];\n }\n /**\n * Check if an extractor is registered by ID\n * @param id - The extractor ID\n * @returns true if extractor exists\n */\n hasExtractor(id) {\n return this.extractorsById.has(id);\n }\n /**\n * Clear all registered extractors\n * Useful for testing or resetting the registry\n */\n clear() {\n this.extractorsById.clear();\n this.extractorsByType.clear();\n }\n /**\n * Clone this registry with all extractors\n * @returns New registry with same extractors\n */\n clone() {\n const cloned = new ExtractionRegistry(this.elementNameMapper);\n for (const extractor of this.extractorsById.values()) {\n cloned.register(extractor);\n }\n return cloned;\n }\n}\n/**\n * Create a new extraction registry\n * @param elementNameMapper - Optional element name mapper for QTI version handling\n * @returns Empty registry ready for extractor registration\n */\nexport function createExtractionRegistry(elementNameMapper) {\n return new ExtractionRegistry(elementNameMapper);\n}\n//# sourceMappingURL=ExtractionRegistry.js.map","/**\n * Extraction utilities implementation\n *\n * Provides DOM manipulation and content extraction helpers for extractors\n */\nimport { Qti2xElementNameMapper, Qti2xAttributeNameMapper } from '@pie-qti/qti-common';\nimport { sanitizeTextContent } from '../core/sanitizer.js';\n/**\n * Extract text content from QTI elements\n */\nfunction getTextContent(element) {\n return element?.textContent?.trim() || '';\n}\n/**\n * Extract HTML content from QTI elements (preserves MathML and other markup)\n * Content is sanitized to prevent XSS attacks\n */\nfunction getHtmlContent(element) {\n const html = element?.innerHTML?.trim() || '';\n return sanitizeTextContent(html);\n}\n/**\n * Get children by tag name from QTI elements\n * Note: This version does NOT handle QTI version mapping - use the one in ExtractionUtils instead\n */\nfunction getChildrenByTag(element, tagName) {\n return element?.childNodes?.filter((n) => n.rawTagName === tagName) || [];\n}\n/**\n * Get children by tag name with QTI version awareness\n */\nfunction getChildrenByTagWithMapper(element, tagName, mapper) {\n if (!element?.childNodes)\n return [];\n return element.childNodes.filter((n) => matchesTagName(n.rawTagName, tagName, mapper));\n}\n/**\n * Extract a boolean attribute from a QTI element\n * Supports both QTI 2.x (camelCase) and QTI 3.0 (kebab-case) attributes\n */\nfunction getBooleanAttribute(element, name, defaultValue = false, attributeMapper) {\n let value = element.getAttribute(name);\n // If not found and we have a mapper, try the native format (QTI 3.0 kebab-case)\n if ((value === null || value === undefined) && attributeMapper) {\n const nativeName = attributeMapper.toNative(name);\n value = element.getAttribute(nativeName);\n }\n if (value === null || value === undefined)\n return defaultValue;\n return value === 'true';\n}\n/**\n * Extract a number attribute from a QTI element\n * Supports both QTI 2.x (camelCase) and QTI 3.0 (kebab-case) attributes\n */\nfunction getNumberAttribute(element, name, defaultValue, attributeMapper) {\n let value = element.getAttribute(name);\n // If not found and we have a mapper, try the native format (QTI 3.0 kebab-case)\n if ((value === null || value === undefined) && attributeMapper) {\n const nativeName = attributeMapper.toNative(name);\n value = element.getAttribute(nativeName);\n }\n return value ? Number(value) : defaultValue;\n}\n/**\n * Extract a string attribute from a QTI element\n * Supports both QTI 2.x (camelCase) and QTI 3.0 (kebab-case) attributes\n */\nfunction getStringAttribute(element, name, defaultValue = '', attributeMapper) {\n let value = element.getAttribute(name);\n // If not found and we have a mapper, try the native format (QTI 3.0 kebab-case)\n if ((value === null || value === undefined) && attributeMapper) {\n const nativeName = attributeMapper.toNative(name);\n value = element.getAttribute(nativeName);\n }\n return value || defaultValue;\n}\n/**\n * Extract CSS classes from an element\n */\nfunction getClasses(element) {\n const classAttr = element.getAttribute('class');\n return classAttr ? classAttr.split(/\\s+/).filter(Boolean) : [];\n}\n/**\n * Helper to check if an element's tag name matches a given QTI element name.\n * Handles both QTI 2.x and QTI 3.0 element naming conventions.\n *\n * @param rawTagName - The element's raw tag name from the HTML\n * @param expectedTagName - The tag name to check (in QTI 2.x format, e.g., 'simpleChoice')\n * @param mapper - Optional element name mapper for QTI version handling\n * @returns true if the tag name matches\n */\nfunction matchesTagName(rawTagName, expectedTagName, mapper) {\n if (!rawTagName)\n return false;\n // Convert expected tag name to canonical form (lowercase)\n const canonical = expectedTagName.toLowerCase();\n // Get the native form for this QTI version\n const native = mapper.toNative(canonical);\n // Check if raw tag name matches the native form (case-insensitive)\n return rawTagName.toLowerCase() === native.toLowerCase();\n}\n/**\n * Create extraction utilities instance\n * Provides standard helpers for extracting data from QTI elements.\n * Automatically handles both QTI 2.x and QTI 3.0 element and attribute naming conventions.\n */\nexport function createExtractionUtils(security, mapper, attributeMapper) {\n // Default to QTI 2.x mappers (primary supported QTI format)\n const elementMapper = mapper || new Qti2xElementNameMapper();\n const attrMapper = attributeMapper || new Qti2xAttributeNameMapper();\n return {\n getChildrenByTag(element, tagName) {\n return getChildrenByTagWithMapper(element, tagName, elementMapper);\n },\n querySelectorAll(element, selector) {\n // Parse simple selectors like \"choiceInteraction simpleChoice\"\n const parts = selector.split(/\\s+/);\n let results = [element];\n for (const part of parts) {\n const nextResults = [];\n for (const current of results) {\n if (matchesTagName(current.rawTagName, part, elementMapper)) {\n nextResults.push(current);\n }\n if (current.childNodes) {\n for (const child of current.childNodes) {\n if (typeof child !== 'string' && matchesTagName(child.rawTagName, part, elementMapper)) {\n nextResults.push(child);\n }\n }\n }\n }\n results = nextResults;\n }\n return results;\n },\n querySelector(element, selector) {\n const results = this.querySelectorAll(element, selector);\n return results.length > 0 ? results[0] : null;\n },\n hasChildWithTag(element, tagName) {\n // Fast boolean check without allocation\n if (!element.childNodes)\n return false;\n for (const child of element.childNodes) {\n if (typeof child !== 'string' && matchesTagName(child.rawTagName, tagName, elementMapper)) {\n return true;\n }\n }\n return false;\n },\n getHtmlContent(element) {\n const html = element?.innerHTML?.trim() || '';\n return sanitizeTextContent(html, { security });\n },\n getTextContent(element) {\n return getTextContent(element);\n },\n getAttribute(element, name, defaultValue = '') {\n return getStringAttribute(element, name, defaultValue, attrMapper);\n },\n getBooleanAttribute(element, name, defaultValue = false) {\n return getBooleanAttribute(element, name, defaultValue, attrMapper);\n },\n getNumberAttribute(element, name, defaultValue = 0) {\n return getNumberAttribute(element, name, defaultValue, attrMapper);\n },\n getPrompt(element) {\n const promptElement = getChildrenByTagWithMapper(element, 'prompt', elementMapper)[0];\n return promptElement ? getHtmlContent(promptElement) : null;\n },\n getClasses(element) {\n return getClasses(element);\n },\n };\n}\n//# sourceMappingURL=utils.js.map","/**\n * Context factory for element extraction\n *\n * Creates ExtractionContext instances with utilities and metadata\n */\nimport { createExtractionUtils } from './utils.js';\n/**\n * Create an extraction context for an element\n *\n * @param element - The element being extracted\n * @param responseId - Response identifier for this interaction\n * @param dom - Root DOM element for document-wide queries\n * @param declarations - Variable declarations from QTI\n * @param config - Player configuration\n * @returns Complete extraction context with utilities\n *\n * @example\n * const context = createExtractionContext(\n * element,\n * 'RESPONSE',\n * rootElement,\n * declarations,\n * playerConfig\n * );\n * const result = registry.extract<ChoiceData>(element, context);\n */\nexport function createExtractionContext(element, responseId, dom, declarations, config) {\n // Pass both element and attribute name mappers for QTI version handling\n const elementMapper = config.elementNameMapper;\n const attributeMapper = config.attributeNameMapper;\n return {\n element,\n responseId,\n dom,\n declarations,\n utils: createExtractionUtils(config.security, elementMapper, attributeMapper),\n config,\n };\n}\n//# sourceMappingURL=createContext.js.map","function getTrustedTypesGlobal() {\n return globalThis.trustedTypes;\n}\nconst policyCache = new Map();\nfunction getOrCreatePolicy(policyName) {\n const existing = policyCache.get(policyName);\n if (existing)\n return existing;\n const tt = getTrustedTypesGlobal();\n if (!tt?.createPolicy)\n return null;\n try {\n const policy = tt.createPolicy(policyName, {\n createHTML: (s) => s,\n });\n // Policy may be blocked/throw depending on CSP allowlist.\n if (!policy?.createHTML)\n return null;\n policyCache.set(policyName, policy);\n return policy;\n }\n catch {\n return null;\n }\n}\n/**\n * Convert a sanitized HTML string into a Trusted Types HTML value when:\n * - the host configured a policy name, and\n * - the browser supports Trusted Types, and\n * - CSP allows creating/using that policy.\n *\n * Otherwise returns the original string.\n */\nexport function toTrustedHtml(html, policyName) {\n if (!policyName)\n return html;\n if (!html)\n return '';\n const policy = getOrCreatePolicy(policyName);\n if (!policy)\n return html;\n try {\n return policy.createHTML(html);\n }\n catch {\n return html;\n }\n}\n/**\n * Normalize HtmlContent back to a string.\n * Useful when you need to perform string operations (replace/substr/etc) before re-wrapping.\n */\nexport function htmlToString(html) {\n return typeof html === 'string' ? html : String(html);\n}\n//# sourceMappingURL=trustedTypes.js.map","import { toTrustedHtml } from '../core/trustedTypes.js';\nimport { sanitizeResourceUrl } from '../core/urlPolicy.js';\nexport function applyInteractionSecurity(interactions, security) {\n const policy = security?.urlPolicy;\n const allowObjectEmbeds = security?.allowObjectEmbeds === true;\n const ttPolicyName = security?.trustedTypesPolicyName;\n for (const interaction of interactions) {\n // Wrap known HTML injection fields in TrustedHTML (when enabled).\n // Important: do NOT wrap fields rendered as plain text (e.g. prompt).\n if (interaction.type === 'choiceInteraction' && Array.isArray(interaction.choices)) {\n for (const choice of interaction.choices) {\n if (typeof choice?.text === 'string') {\n choice.text = toTrustedHtml(choice.text, ttPolicyName);\n }\n }\n }\n // Shared ImageData shape.\n if (interaction.imageData?.src) {\n interaction.imageData.src = sanitizeResourceUrl(interaction.imageData.src, policy, 'img') ?? '';\n }\n if (interaction.imageData?.content && typeof interaction.imageData.content === 'string') {\n interaction.imageData.content = toTrustedHtml(interaction.imageData.content, ttPolicyName);\n }\n // positionObject stages.\n if (Array.isArray(interaction.positionObjectStages)) {\n for (const stage of interaction.positionObjectStages) {\n if (stage?.objectData?.src) {\n stage.objectData.src = sanitizeResourceUrl(stage.objectData.src, policy, 'img') ?? '';\n }\n if (stage?.objectData?.content && typeof stage.objectData.content === 'string') {\n stage.objectData.content = toTrustedHtml(stage.objectData.content, ttPolicyName);\n }\n }\n }\n // mediaInteraction.\n if (interaction.type === 'mediaInteraction' && interaction.mediaElement?.src) {\n const kind = interaction.mediaElement.type === 'object' ? 'object' : 'media';\n interaction.mediaElement.src =\n sanitizeResourceUrl(interaction.mediaElement.src, policy, kind) ?? '';\n interaction.allowObjectEmbeds = allowObjectEmbeds;\n }\n // hottextInteraction content is injected via {@html}.\n if (interaction.type === 'hottextInteraction' && typeof interaction.contentHtml === 'string') {\n interaction.contentHtml = toTrustedHtml(interaction.contentHtml, ttPolicyName);\n }\n }\n return interactions;\n}\n//# sourceMappingURL=interactionSecurity.js.map","import { createExtractionContext } from './createContext.js';\nimport { applyInteractionSecurity } from './interactionSecurity.js';\nexport function extractInteractionData({ document, extractionRegistry, declarations, config, }) {\n const declMap = projectDeclarationsForExtraction(declarations);\n const elements = document.findExtractionElements(getRegisteredElementTypes(extractionRegistry));\n const interactions = [];\n for (const discovered of elements) {\n const context = createExtractionContext(discovered.element, discovered.responseIdentifier, discovered.contextRoot, declMap, config);\n const result = extractionRegistry.extract(discovered.element, context);\n if (!result.success)\n continue;\n interactions.push({\n type: discovered.normalizedType,\n responseId: discovered.responseIdentifier,\n ...result.data,\n });\n }\n return applyInteractionSecurity(interactions, config.security);\n}\nfunction getRegisteredElementTypes(extractionRegistry) {\n const elementTypes = new Set();\n for (const extractor of extractionRegistry.getExtractors()) {\n for (const elementType of extractor.elementTypes) {\n elementTypes.add(elementType);\n }\n }\n return [...elementTypes];\n}\nfunction projectDeclarationsForExtraction(declarations) {\n const declMap = new Map();\n for (const declaration of Object.values(declarations)) {\n declMap.set(declaration.identifier, {\n identifier: declaration.identifier,\n cardinality: declaration.cardinality,\n baseType: declaration.baseType,\n });\n }\n return declMap;\n}\n//# sourceMappingURL=interactionExtractionPipeline.js.map","/**\n * Deterministic pseudo-random number generator helpers.\n *\n * We keep this tiny and dependency-free so tests (and optionally consumers)\n * can run template processing deterministically.\n */\n/**\n * Mulberry32 PRNG.\n * Returns a function that yields a float in [0, 1).\n */\nexport function createSeededRng(seed) {\n // Ensure 32-bit unsigned int\n let a = seed >>> 0;\n return () => {\n a = (a + 0x6d2b79f5) >>> 0;\n let t = a;\n t = Math.imul(t ^ (t >>> 15), t | 1);\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n//# sourceMappingURL=random.js.map","const ATTR = 'data-qti-colorscheme';\nconst MAGNIFICATION_ATTR = 'data-qti-magnification';\n/**\n * Apply a PNP profile to the player root element.\n *\n * Currently handles color scheme (data-qti-colorscheme attribute).\n * Magnification is intentionally deferred — host stylesheets / browser zoom are sufficient for now.\n */\nexport function applyPnpToRoot(rootEl, pnp) {\n const scheme = pnp?.display?.colorScheme;\n if (!scheme || scheme === 'default') {\n rootEl.removeAttribute(ATTR);\n }\n else {\n rootEl.setAttribute(ATTR, scheme);\n }\n const magnification = pnp?.display?.magnification;\n if (magnification !== undefined && Number.isFinite(magnification) && magnification > 0) {\n rootEl.setAttribute(MAGNIFICATION_ATTR, String(magnification));\n rootEl.style?.setProperty?.('--qti-magnification', String(magnification));\n }\n else {\n rootEl.removeAttribute(MAGNIFICATION_ATTR);\n rootEl.style?.removeProperty?.('--qti-magnification');\n }\n}\n//# sourceMappingURL=applyPnp.js.map","import { parse as parseHtml } from 'node-html-parser';\n/**\n * Parse an XML string containing a QTI 3.0 <qti-catalog-info> element into a CatalogIndex.\n *\n * The mapper is not needed here because we parse the QTI 3.0 element names directly.\n * All element names use lower-case matching (node-html-parser normalises tags).\n */\nexport function extractCatalog(xml) {\n if (!xml.trim())\n return new Map();\n const doc = parseHtml(`<root>${xml}</root>`, { lowerCaseTagName: true });\n // Find <qti-catalog-info> (QTI 3.0 kebab form)\n const infoEl = doc.querySelector('qti-catalog-info');\n if (!infoEl)\n return new Map();\n return buildIndex(infoEl);\n}\n/**\n * Parse a raw QTI item XML string and extract the embedded catalog.\n * Used by Player when integrating with the full item XML.\n */\nexport function extractCatalogFromItemXml(itemXml) {\n const doc = parseHtml(itemXml, { lowerCaseTagName: true });\n const infoEl = doc.querySelector('qti-catalog-info');\n if (!infoEl)\n return new Map();\n return buildIndex(infoEl);\n}\n/**\n * Merge two CatalogIndex maps. itemLevel entries win on collision (same identifier).\n */\nexport function mergeCatalogs(base, override) {\n const merged = new Map(base);\n for (const [id, card] of override) {\n merged.set(id, card);\n }\n return merged;\n}\n// ---------------------------------------------------------------------------\n// Internal\n// ---------------------------------------------------------------------------\nfunction buildIndex(infoEl) {\n const index = new Map();\n for (const catalogEl of infoEl.querySelectorAll('qti-catalog')) {\n const identifier = catalogEl.getAttribute('id') ?? catalogEl.getAttribute('identifier');\n if (!identifier)\n continue;\n const entries = [];\n for (const cardEl of catalogEl.querySelectorAll('qti-card')) {\n const cardUsage = cardEl.getAttribute('support') ?? cardEl.getAttribute('usage');\n for (const entry of extractCardEntries(cardEl, cardUsage ?? undefined)) {\n entries.push(entry);\n }\n }\n if (entries.length > 0) {\n index.set(identifier, { entries });\n }\n }\n for (const cardEl of infoEl.querySelectorAll('qti-card')) {\n const identifier = cardEl.getAttribute('identifier');\n if (!identifier)\n continue;\n const entries = extractCardEntries(cardEl);\n if (entries.length > 0) {\n const existing = index.get(identifier);\n if (existing) {\n existing.entries.push(...entries);\n }\n else {\n index.set(identifier, { entries });\n }\n }\n }\n return index;\n}\nfunction extractCardEntries(cardEl, fallbackUsage) {\n const explicitEntries = cardEl.querySelectorAll('qti-card-entry');\n const entries = [];\n if (explicitEntries.length > 0) {\n for (const entryEl of explicitEntries) {\n const usage = entryEl.getAttribute('usage') ??\n entryEl.getAttribute('data-reading-type') ??\n fallbackUsage;\n if (!usage)\n continue;\n entries.push({\n usage,\n lang: getLang(entryEl),\n html: extractHtmlContent(entryEl),\n });\n }\n return entries;\n }\n if (fallbackUsage) {\n entries.push({\n usage: fallbackUsage,\n lang: getLang(cardEl),\n html: extractHtmlContent(cardEl),\n });\n }\n return entries;\n}\nfunction getLang(el) {\n return el.getAttribute('xml:lang') ?? el.getAttribute('xmllang') ?? el.getAttribute('lang') ?? undefined;\n}\nfunction extractHtmlContent(el) {\n const htmlContent = el.querySelector('qti-html-content');\n const fileHref = el.querySelector('qti-file-href');\n if (htmlContent)\n return htmlContent.innerHTML ?? htmlContent.text ?? '';\n if (fileHref)\n return fileHref.getAttribute('src') ?? fileHref.text?.trim() ?? '';\n return '';\n}\n//# sourceMappingURL=catalogExtractor.js.map","/**\n * Look up a catalog entry by card identifier, usage type, and optional language.\n *\n * Language fallback order (mirrors APIP 1.0 / HTTP Accept-Language conventions):\n * 1. Exact lang match (e.g. 'en-US')\n * 2. Language-prefix match (e.g. 'en' matches entry with lang 'en-US')\n * 3. Entry with no lang specified (universal fallback)\n * 4. null — no match found\n *\n * @param index CatalogIndex built by extractCatalog / extractCatalogFromItemXml\n * @param idref The data-catalog-idref value (maps to qti-card identifier)\n * @param usage Catalog usage type (e.g. 'glossary-on-screen')\n * @param lang Optional preferred language code (e.g. 'en-US', 'es')\n * @returns The matched entry's html string, or null if nothing found\n */\nexport function getCatalogEntry(index, idref, usage, lang) {\n const card = index.get(idref);\n if (!card)\n return null;\n const candidates = card.entries.filter((e) => e.usage === usage);\n if (candidates.length === 0)\n return null;\n // 1. Exact language match\n if (lang) {\n const exact = candidates.find((e) => e.lang === lang);\n if (exact)\n return exact.html;\n // 2. Language-prefix match: requested lang prefix matches entry lang\n // e.g. lang='en' matches entry.lang='en-US'\n // e.g. lang='en-US' matches entry.lang='en' (broader fallback)\n const prefix = lang.split('-')[0];\n const prefixMatch = candidates.find((e) => e.lang && (e.lang === prefix || e.lang.startsWith(`${prefix}-`) || lang.startsWith(`${e.lang}-`)));\n if (prefixMatch)\n return prefixMatch.html;\n }\n // 3. No-lang fallback (entry without a lang attribute)\n const noLang = candidates.find((e) => !e.lang);\n if (noLang)\n return noLang.html;\n // 4. If we get here and there's only one candidate, return it regardless of lang\n if (candidates.length === 1)\n return candidates[0].html;\n return null;\n}\n//# sourceMappingURL=catalogLookup.js.map","/**\n * QTI 3.0 Portable Custom Interaction (PCI) types.\n * Based on IMS QTI 3.0 Portable Custom Interaction specification.\n */\n/**\n * Thrown when a PCI module fails to load from both primary and fallback paths.\n */\nexport class PciLoadError extends Error {\n constructor(primaryPath, fallbackPath, cause) {\n super(fallbackPath\n ? `PCI module failed to load from '${primaryPath}' and fallback '${fallbackPath}'`\n : `PCI module failed to load from '${primaryPath}'`);\n this.primaryPath = primaryPath;\n this.fallbackPath = fallbackPath;\n this.name = 'PciLoadError';\n if (cause)\n Object.defineProperty(this, 'cause', { value: cause, writable: true, configurable: true });\n }\n}\n//# sourceMappingURL=types.js.map","import { PciLoadError } from './types.js';\n/**\n * Loads, initializes, and manages the lifecycle of a single PCI module.\n *\n * Usage:\n * const host = new PciHost(extractedData, baseUrl);\n * await host.load();\n * host.initialize(domNode);\n * host.getResponse(); // returns current response\n * host.destroy(); // cleanup on player teardown\n */\nexport class PciHost {\n constructor(data, baseUrl) {\n this.module = null;\n this._response = null;\n this._onResponseChange = null;\n this.data = data;\n this.baseUrl = baseUrl;\n }\n /**\n * Register a callback to fire when the PCI's response changes.\n * The player calls this to wire the PCI into its internal response map.\n */\n onResponseChange(callback) {\n this._onResponseChange = callback;\n }\n /**\n * Load the PCI module from primaryPath, falling back to fallbackPath.\n * Throws PciLoadError if both fail.\n */\n async load() {\n const primary = this.resolveUrl(this.data.primaryPath);\n try {\n const mod = await this.dynamicImport(primary);\n this.module = this.extractPciInterface(mod);\n return;\n }\n catch (primaryErr) {\n if (!this.data.fallbackPath) {\n throw new PciLoadError(this.data.primaryPath, undefined, primaryErr);\n }\n }\n const fallback = this.resolveUrl(this.data.fallbackPath);\n try {\n const mod = await this.dynamicImport(fallback);\n this.module = this.extractPciInterface(mod);\n }\n catch (fallbackErr) {\n throw new PciLoadError(this.data.primaryPath, this.data.fallbackPath, fallbackErr);\n }\n }\n /**\n * Initialize the PCI inside the given DOM element.\n * Must be called after load() resolves.\n */\n initialize(dom) {\n if (!this.module)\n return;\n const boundTo = {\n onReady: () => { },\n onResponseChange: (value) => {\n this._response = value;\n this._onResponseChange?.(this.data.responseIdentifier, value);\n },\n };\n this.module.initialize(dom, this.data.config, boundTo);\n }\n /** Return the current response value from the PCI module. */\n getResponse() {\n return this.module ? this.module.getResponse() : this._response;\n }\n /** Restore a response value into the PCI module (e.g. from session state). */\n setResponse(value) {\n this._response = value;\n this.module?.setResponse(value);\n }\n /** Disable the PCI (e.g. when role is not candidate, or after final submission). */\n disable() {\n this.module?.disable();\n }\n /** Re-enable the PCI. */\n enable() {\n this.module?.enable();\n }\n /** Tear down the PCI and release all resources. */\n destroy() {\n this.module?.destroy();\n this.module = null;\n }\n // ---------------------------------------------------------------------------\n // Private helpers\n // ---------------------------------------------------------------------------\n /** Thin wrapper around dynamic import — overridable in tests. */\n dynamicImport(url) {\n return import(/* @vite-ignore */ url);\n }\n resolveUrl(path) {\n if (/^https?:\\/\\//.test(path) || path.startsWith('/'))\n return path;\n // Relative path: resolve against baseUrl\n const base = this.baseUrl.endsWith('/') ? this.baseUrl : this.baseUrl + '/';\n return base + path;\n }\n /**\n * Extract a PciModule from a dynamic import result.\n * Supports: default export, named `getInstance` export, or the module itself.\n */\n extractPciInterface(mod) {\n const candidate = mod?.default ?? mod?.getInstance?.() ?? mod;\n if (typeof candidate?.initialize !== 'function') {\n throw new Error(`PCI module at '${this.data.primaryPath}' does not export a valid PciModule interface ` +\n '(expected .initialize, .getResponse, .setResponse, .disable, .enable, .destroy)');\n }\n return candidate;\n }\n}\n//# sourceMappingURL=PciHost.js.map","import { buildOutcomeProcessingAst, buildResponseProcessingAst, buildTemplateProcessingAst, childElements, coerceBaseValue, DeclarationContext, evalExpr, execProgram, findDescendants, findFirstDescendant, getAttr, OperatorRegistry, qtiNull, qtiValue, toBoolean, toNumber, toStringValue, } from '@pie-qti/qti-processing';\nimport { Qti2xElementNameMapper, Qti2xAttributeNameMapper, Qti3ElementNameMapper, Qti3AttributeNameMapper, detectQtiVersion, } from '@pie-qti/qti-common';\nimport { parseAssessmentItemDocument } from '../document/AssessmentItemDocument.js';\nimport { createExtractionRegistry } from '../extraction/ExtractionRegistry.js';\nimport { extractInteractionData } from '../extraction/interactionExtractionPipeline.js';\nimport { getStandardInteractionExtractors } from '../interactions/modules.js';\nimport { createComponentRegistry } from './ComponentRegistry.js';\nimport { createSeededRng } from './random.js';\nimport { sanitizeHtml } from './sanitizer.js';\nimport { toTrustedHtml } from './trustedTypes.js';\nimport { sanitizeResourceUrl } from './urlPolicy.js';\nimport { applyPnpToRoot } from '../pnp/applyPnp.js';\nimport { extractCatalog, extractCatalogFromItemXml, mergeCatalogs } from '../catalog/catalogExtractor.js';\nimport { getCatalogEntry } from '../catalog/catalogLookup.js';\nimport { PciHost } from '../pci/PciHost.js';\nexport class Player {\n constructor(config) {\n this.responseProcessingProgram = null;\n this.templateProcessingProgram = null;\n this.outcomeProcessingProgram = null;\n this._catalogIndex = new Map();\n this._stimulusCatalogIndexes = new Map();\n this._pciHosts = new Map();\n this._pnpChangeListeners = new Set();\n this.lifecycleStatus = 'initial';\n this.accumulatedDurationMs = 0;\n this.config = config;\n this.itemXml = config.itemXml ?? '';\n this.role = config.role ?? 'candidate';\n this.sessionGuid = createSessionGuid();\n this.sessionStartedAt = Date.now();\n this.rng = config.rng ?? (typeof config.seed === 'number' ? createSeededRng(config.seed) : Math.random);\n // Auto-detect QTI version and create appropriate mappers if not provided\n if (!config.elementNameMapper) {\n const version = detectQtiVersion(this.itemXml);\n if (version === '3.0') {\n this.mapper = new Qti3ElementNameMapper();\n // Set in config so it's available to extraction utils\n config.elementNameMapper = this.mapper;\n // Also set attribute mapper if not provided\n if (!config.attributeNameMapper) {\n config.attributeNameMapper = new Qti3AttributeNameMapper();\n }\n }\n else {\n this.mapper = new Qti2xElementNameMapper();\n config.elementNameMapper = this.mapper;\n if (!config.attributeNameMapper) {\n config.attributeNameMapper = new Qti2xAttributeNameMapper();\n }\n }\n }\n else {\n this.mapper = config.elementNameMapper;\n if (!config.attributeNameMapper) {\n config.attributeNameMapper =\n this.mapper.version === '3.0'\n ? new Qti3AttributeNameMapper()\n : new Qti2xAttributeNameMapper();\n }\n }\n this.itemDocument = parseAssessmentItemDocument({\n itemXml: this.itemXml,\n elementNameMapper: this.mapper,\n attributeNameMapper: config.attributeNameMapper,\n security: this.config.security,\n });\n this.assessmentItem = this.itemDocument.getAssessmentItem();\n this.decls = this.buildDeclarations();\n this.ensureBuiltinDeclarations(this.decls);\n this.ctx = new DeclarationContext(this.decls);\n this.ops = new OperatorRegistry();\n // Restore session state (outcomes + responses) before running templateProcessing.\n if (config.sessionState) {\n this.applySessionState(config.sessionState);\n }\n // Extraction + rendering registries (for interaction rendering)\n // Pass the element name mapper to the extraction registry for QTI version handling\n this.extractionRegistry = config.extractionRegistry ?? createExtractionRegistry(this.mapper);\n this.componentRegistry = config.componentRegistry ?? createComponentRegistry();\n // I18n provider (defaults to a simple fallback if not provided)\n this.i18nProvider = config.i18nProvider ?? this.createDefaultI18nProvider();\n // Register standard interaction extractors (idempotent per-registry instance)\n for (const ex of getStandardInteractionExtractors()) {\n try {\n this.extractionRegistry.register(ex);\n }\n catch {\n // ignore duplicates if a caller pre-registered\n }\n }\n // Plugins can further extend registries\n for (const p of (config.plugins ?? [])) {\n try {\n p?.registerExtractors?.(this.extractionRegistry);\n p?.registerComponents?.(this.componentRegistry);\n }\n catch {\n // plugin errors shouldn't prevent core parsing\n }\n }\n // Build ASTs once.\n const templateProcessing = this.itemDocument.getProcessingElement('template');\n if (templateProcessing) {\n this.templateProcessingProgram = buildTemplateProcessingAst(templateProcessing, {\n elementNameMapper: this.mapper,\n });\n this.execTemplateProcessing();\n }\n const responseProcessing = this.itemDocument.getProcessingElement('response');\n if (responseProcessing) {\n this.responseProcessingProgram = buildResponseProcessingAst(responseProcessing, {\n elementNameMapper: this.mapper,\n });\n }\n const outcomeProcessing = this.itemDocument.getProcessingElement('outcome');\n if (outcomeProcessing) {\n this.outcomeProcessingProgram = buildOutcomeProcessingAst(outcomeProcessing, {\n elementNameMapper: this.mapper,\n });\n }\n // Apply initial responses after templateProcessing (so template vars are ready).\n if (config.responses) {\n this.setResponses(config.responses);\n }\n // Detect and log QTI version for compatibility awareness\n const detectedVersion = this.detectQTIVersion();\n if (detectedVersion === 'unknown') {\n console.warn('[QTI Player] Could not detect QTI version. Assuming QTI 2.2 compatibility.');\n }\n else if (detectedVersion === '2.0') {\n console.warn('[QTI Player] QTI 2.0 detected. Some features may not be fully supported. QTI 2.2 is recommended.');\n }\n else if (detectedVersion === '2.1') {\n console.info('[QTI Player] QTI 2.1 detected. Using QTI 2.2 compatibility mode with CC2 template support.');\n }\n // Store PNP profile for later use (applyPnpToRoot is called once a root element is available).\n this._pnp = config.pnp;\n // Build catalog index from resolved delivery context, legacy shared catalog XML, and item XML.\n // Item/global entries are merged first; item-level entries win on global collisions.\n // Stimulus entries are kept separately so rendered stimulus terms can avoid ID collisions.\n let mergedCatalog = new Map();\n for (const source of config.deliveryContext?.catalogSources ?? []) {\n const sourceCatalog = extractCatalog(source.xml);\n if (source.scope === 'stimulus' && source.stimulusIdentifier) {\n const existing = this._stimulusCatalogIndexes.get(source.stimulusIdentifier) ?? new Map();\n this._stimulusCatalogIndexes.set(source.stimulusIdentifier, mergeCatalogs(existing, sourceCatalog));\n }\n else {\n mergedCatalog = mergeCatalogs(mergedCatalog, sourceCatalog);\n }\n }\n if (config.catalogXml) {\n mergedCatalog = mergeCatalogs(mergedCatalog, extractCatalogFromItemXml(config.catalogXml));\n }\n this._catalogIndex = mergeCatalogs(mergedCatalog, extractCatalogFromItemXml(this.itemXml));\n // Check strict compliance if enabled\n if (this.config.strictQtiCompliance?.enabled) {\n this.validateStrictCompliance();\n }\n }\n /**\n * Apply the PNP profile to a player root element.\n * Call this once the root DOM element is available (e.g. after mounting).\n * The player stores the element reference so updatePnp() can re-apply without re-parsing the item.\n */\n applyPnp(rootEl) {\n this._rootEl = rootEl;\n applyPnpToRoot(rootEl, this._pnp);\n }\n /**\n * Update the PNP profile mid-session without re-parsing the item XML.\n * Deep-merges the partial profile into the current profile and re-applies.\n */\n updatePnp(partial) {\n this._pnp = mergePnp(this._pnp, partial);\n if (this._rootEl) {\n applyPnpToRoot(this._rootEl, this._pnp);\n }\n for (const listener of this._pnpChangeListeners) {\n listener(this._pnp);\n }\n }\n /** Return the current resolved PNP profile. */\n getPnp() {\n return this._pnp;\n }\n onPnpChange(listener) {\n this._pnpChangeListeners.add(listener);\n return () => this._pnpChangeListeners.delete(listener);\n }\n /** Return the package/assessment-resolved delivery context, if one was supplied. */\n getDeliveryContext() {\n return this.config.deliveryContext;\n }\n /**\n * Look up a catalog entry by card identifier, usage type, and optional language.\n * Returns the HTML string for the matched entry, or null if not found.\n *\n * Language fallback: exact match → prefix match → no-lang entry → null.\n */\n getCatalogEntry(idref, usage, lang, options) {\n const stimulusHtml = options?.stimulusIdentifier\n ? getCatalogEntry(this._stimulusCatalogIndexes.get(options.stimulusIdentifier) ?? new Map(), idref, usage, lang)\n : null;\n const html = stimulusHtml ?? getCatalogEntry(this._catalogIndex, idref, usage, lang);\n if (html === null)\n return null;\n if (looksLikeCatalogUrl(html)) {\n return sanitizeResourceUrl(html.trim(), this.config.security?.urlPolicy, 'img');\n }\n return this.sanitizeHtmlContent(html);\n }\n /** Sanitize externally resolved item-adjacent HTML before it reaches a rendering sink. */\n sanitizeHtmlContent(html) {\n return sanitizeHtml(html, { security: this.config.security });\n }\n /**\n * Create a PciHost for an extracted PCI and register it for response tracking.\n * The caller is responsible for calling host.load() and\n * host.initialize(domNode) once the DOM element is available.\n */\n createPciHost(data) {\n const baseUrl = this.config.pciBaseUrl ?? (typeof document !== 'undefined' ? document.baseURI : '');\n const host = new PciHost(data, baseUrl);\n // Wire response changes back into the player's declaration context\n host.onResponseChange((responseId, value) => {\n const d = this.decls[responseId];\n if (d) {\n d.value = this.coerceToDeclarationValue(d.baseType, d.cardinality, value);\n }\n });\n this._pciHosts.set(data.responseIdentifier, host);\n return host;\n }\n /**\n * Push a response value into the PCI identified by responseIdentifier.\n * Called from setResponses() so session restore reaches PCI modules.\n */\n setPciResponse(responseIdentifier, value) {\n this._pciHosts.get(responseIdentifier)?.setResponse(value);\n }\n /**\n * Disable/enable all PCI hosts based on role.\n * 'candidate' = enabled; any other role = disabled.\n */\n syncPciDisabledState() {\n const disabled = this.role !== 'candidate';\n for (const host of this._pciHosts.values()) {\n if (disabled)\n host.disable();\n else\n host.enable();\n }\n }\n /**\n * Destroy all PCI hosts. Call on player teardown.\n */\n destroyPciHosts() {\n for (const host of this._pciHosts.values()) {\n host.destroy();\n }\n this._pciHosts.clear();\n }\n /** Breaking-change API: returns the typed declaration map */\n getDeclarations() {\n return this.decls;\n }\n setResponses(responses) {\n for (const [id, raw] of Object.entries(responses)) {\n const d = this.decls[id];\n if (!d)\n continue;\n d.value = this.coerceToDeclarationValue(d.baseType, d.cardinality, raw);\n // Push restored responses into any mounted PCI modules\n this.setPciResponse(id, raw);\n }\n }\n /**\n * Destroy all resources owned by this player instance (PCI modules, etc.).\n * Call when unmounting to prevent memory leaks.\n */\n destroy() {\n this.destroyPciHosts();\n }\n processResponses() {\n return this.runResponseProcessing({ finalizeNonAdaptiveAttempt: true });\n }\n saveItemSession() {\n this.freezeDuration();\n return this.serializeItemSession();\n }\n restoreItemSession(state) {\n this.sessionGuid = state.sessionGuid;\n this.lifecycleStatus = state.lifecycleStatus;\n this.accumulatedDurationMs = Math.max(0, Number(state.duration) || 0);\n this.sessionStartedAt = Date.now();\n this.applySerializedVariables(state.responseVariables);\n this.applySerializedVariables(state.outcomeVariables);\n this.applySerializedVariables(state.templateVariables);\n this.applySerializedVariables(state.contextVariables);\n this.updateDuration();\n }\n suspendAttempt() {\n return this.runItemSessionAction({ action: 'suspendAttempt' });\n }\n endAttempt(options = {}) {\n return this.runItemSessionAction({ action: 'endAttempt', ...options });\n }\n scoreAttempt() {\n return this.runItemSessionAction({ action: 'scoreAttempt' });\n }\n newTemplate(options = {}) {\n return this.runItemSessionAction({ action: 'newTemplate', ...options });\n }\n runItemSessionAction(command) {\n switch (command.action) {\n case 'suspendAttempt':\n return this.runSuspendAttemptAction();\n case 'endAttempt':\n return this.runEndAttemptAction(command);\n case 'scoreAttempt':\n return this.runScoreAttemptAction();\n case 'newTemplate':\n return this.runNewTemplateAction(command);\n case 'submitAttempt':\n return this.runSubmitAttemptAction(command.countAttempt ?? true);\n }\n }\n runSuspendAttemptAction() {\n const validation = this.validateResponses(this.getResponses());\n this.lifecycleStatus = 'suspended';\n const sessionState = this.saveItemSession();\n return this.createItemSessionActionResult('suspendAttempt', sessionState, { validation });\n }\n runEndAttemptAction(options) {\n const validate = options.validateResponses ?? false;\n const validation = validate ? this.validateResponses(this.getResponses()) : undefined;\n if (validation && !validation.valid) {\n return this.createItemSessionActionResult('endAttempt', this.saveItemSession(), { validation });\n }\n const scoring = this.isAdaptive()\n ? this.runAdaptiveSubmitAttempt(options.countAttempt ?? true)\n : this.runResponseProcessing({\n finalizeNonAdaptiveAttempt: true,\n countAttempt: options.countAttempt ?? true,\n });\n this.lifecycleStatus = scoring.completed ? 'closed' : 'interacting';\n return this.createItemSessionActionResult('endAttempt', this.saveItemSession(), {\n completed: scoring.completed,\n validation,\n scoring,\n });\n }\n runScoreAttemptAction() {\n const scoring = this.runResponseProcessing({ finalizeNonAdaptiveAttempt: false });\n return this.createItemSessionActionResult('scoreAttempt', this.saveItemSession(), {\n completed: scoring.completed,\n scoring,\n });\n }\n runNewTemplateAction(options) {\n this.resetOutcomesToDefault();\n if (options.resetResponses ?? true) {\n this.resetResponsesToDefault();\n }\n this.resetTemplatesToDefault();\n this.ctx.setValue('completionStatus', qtiValue('identifier', 'single', 'not_attempted'));\n this.ctx.setValue('numAttempts', qtiValue('integer', 'single', 0));\n this.execTemplateProcessing();\n this.lifecycleStatus = 'initial';\n this.accumulatedDurationMs = 0;\n this.sessionStartedAt = Date.now();\n this.updateDuration();\n return this.createItemSessionActionResult('newTemplate', this.serializeItemSession());\n }\n runSubmitAttemptAction(countAttempt) {\n const scoring = this.runAdaptiveSubmitAttempt(countAttempt);\n return this.createItemSessionActionResult('submitAttempt', this.saveItemSession(), {\n completed: scoring.completed,\n scoring,\n });\n }\n createItemSessionActionResult(action, sessionState, options = {}) {\n return {\n action,\n lifecycleStatus: this.lifecycleStatus,\n completionStatus: this.getCompletionStatus(),\n numAttempts: this.getNumAttempts(),\n duration: sessionState.duration,\n completed: options.completed ?? this.isCompleted(),\n sessionState,\n validation: options.validation,\n scoring: options.scoring,\n };\n }\n getSecurityConfig() {\n return this.config.security;\n }\n getTrustedTypesPolicyName() {\n return this.config.security?.trustedTypesPolicyName;\n }\n /**\n * Get the i18n provider instance\n * @returns I18nProvider instance\n */\n getI18nProvider() {\n return this.i18nProvider;\n }\n /**\n * Get attribute value with QTI version support.\n * Tries the attribute mapper's native form first, then falls back to direct lookup.\n * @param el - Element to get attribute from\n * @param canonicalName - Canonical (lowercase) attribute name\n * @returns Attribute value or null\n */\n getAttrMapped(el, canonicalName) {\n // Try mapped attribute name first (e.g., 'mapkey' -> 'map-key' for QTI 3.0)\n if (this.config.attributeNameMapper) {\n const nativeName = this.config.attributeNameMapper.toNative(canonicalName);\n const value = el.getAttribute(nativeName);\n if (value !== null)\n return value;\n }\n // Fallback to canonical name (for QTI 2.x compatibility)\n return getAttr(el, canonicalName);\n }\n /**\n * Create a simple fallback i18n provider when none is provided\n * This avoids a hard dependency on @pie-qti/i18n\n */\n createDefaultI18nProvider() {\n return {\n getLocale: () => 'en-US',\n setLocale: () => { },\n t: (key) => key, // Fallback to key\n plural: (key) => key,\n formatNumber: (value) => value.toString(),\n formatDate: (date) => date.toISOString(),\n };\n }\n /**\n * Detects the QTI version from the assessmentItem element.\n * Checks both namespace URI and version attribute.\n *\n * @returns QTI version string ('2.0', '2.1', '2.2') or 'unknown'\n */\n detectQTIVersion() {\n const ns = this.assessmentItem.namespaceURI;\n if (ns?.includes('v3p0') || ns?.includes('imsqtiasi_v3p0'))\n return '3.0';\n if (ns?.includes('v2p2') || ns?.includes('imsqti_v2p2'))\n return '2.2';\n if (ns?.includes('v2p1') || ns?.includes('imsqti_v2p1'))\n return '2.1';\n if (ns?.includes('v2p0') || ns?.includes('imsqti_v2p0'))\n return '2.0';\n // Check element name for QTI 3.0\n const localName = this.assessmentItem.localName || this.assessmentItem.tagName;\n if (localName === 'qti-assessment-item' || localName === 'qti-assessment-test') {\n return '3.0';\n }\n const versionAttr = getAttr(this.assessmentItem, 'version');\n if (versionAttr?.startsWith('3.'))\n return '3.0';\n if (versionAttr === '2.0')\n return '2.0';\n if (versionAttr === '2.1')\n return '2.1';\n if (versionAttr === '2.2')\n return '2.2';\n return 'unknown';\n }\n /**\n * Validates strict QTI 2.2 compliance if enabled in configuration.\n * Logs warnings or throws errors based on config settings.\n */\n validateStrictCompliance() {\n const config = this.config.strictQtiCompliance;\n if (!config?.enabled)\n return;\n const version = this.detectQTIVersion();\n if (version !== '2.2') {\n const message = `[QTI Player] Strict compliance enabled but item version is ${version}, not 2.2`;\n if (config.rejectUnknownExtensions) {\n throw new Error(message);\n }\n else if (config.logDeviations !== false) {\n console.warn(message);\n }\n }\n // Future: Add validation for non-standard elements/attributes\n }\n resetOutcomesToDefault() {\n for (const d of Object.values(this.decls)) {\n if (d.__kind !== 'outcome')\n continue;\n // Built-in stateful variables must survive across processing runs.\n // They are updated by the runtime (adaptive attempt tracking), not by outcome defaults.\n if (d.identifier === 'numAttempts' || d.identifier === 'completionStatus' || d.identifier === 'duration')\n continue;\n this.ctx.resetToDefault(d.identifier);\n }\n }\n resetResponsesToDefault() {\n for (const d of Object.values(this.decls)) {\n if (d.__kind !== 'response')\n continue;\n this.ctx.resetToDefault(d.identifier);\n this.setPciResponse(d.identifier, d.value.kind === 'value' ? d.value.value : null);\n }\n }\n resetTemplatesToDefault() {\n for (const d of Object.values(this.decls)) {\n if (!d.isTemplate)\n continue;\n this.ctx.resetToDefault(d.identifier);\n }\n }\n runResponseProcessing(options) {\n this.updateDuration();\n // Spec-aligned behavior: each processing run starts from outcome defaults.\n // This prevents stale outcomes when response/outcome processing doesn't set every variable.\n this.resetOutcomesToDefault();\n // Execute response processing if present\n const rpEl = this.itemDocument.getProcessingElement('response');\n if (rpEl) {\n // If responseProcessing has explicit statements, run the compiled program.\n // Otherwise, fall back to template-based processing (responseProcessing@template).\n const hasStatements = childElements(rpEl).length > 0;\n if (hasStatements) {\n this.execResponseProcessingProgram();\n }\n else {\n const templateUrl = getAttr(rpEl, 'template');\n if (templateUrl)\n this.execResponseProcessingTemplate(templateUrl);\n }\n }\n // Execute outcome processing if present (runs after responseProcessing)\n this.execOutcomeProcessingProgram();\n // Compatibility: processResponses() has historically finalized non-adaptive items.\n // New scoreAttempt() uses this same engine with finalization disabled.\n if (!this.isAdaptive() && options.finalizeNonAdaptiveAttempt) {\n this.ctx.setValue('completionStatus', qtiValue('identifier', 'single', 'completed'));\n if (options.countAttempt ?? true) {\n const currentAttempts = this.getNumAttempts();\n this.ctx.setValue('numAttempts', qtiValue('integer', 'single', currentAttempts + 1));\n }\n }\n const outcomes = this.collectOutcomes();\n const score = Number(outcomes.SCORE ?? 0);\n const maxScore = Number(outcomes.MAXSCORE ?? 1);\n const completionStatus = outcomes.completionStatus ?? 'not_attempted';\n const completed = completionStatus === 'completed' || (!this.isAdaptive() && options.finalizeNonAdaptiveAttempt);\n return {\n score,\n maxScore,\n completed,\n outcomeValues: outcomes,\n modalFeedback: this.getModalFeedback(outcomes),\n };\n }\n getItemBodyHtml() {\n const inner = this.itemDocument.serializeItemBodyChildren();\n if (!inner)\n return '';\n const printed = this.renderPrintedVariables(inner);\n const sanitized = sanitizeHtml(printed, { security: this.config.security });\n return toTrustedHtml(sanitized, this.config.security?.trustedTypesPolicyName);\n }\n /**\n * Extract rubric blocks for the current role.\n *\n * QTI uses `<rubricBlock view=\"...\">` to provide role-specific guidance.\n * We return sanitized HTML for direct rendering.\n */\n getRubrics() {\n const role = this.role;\n const rubricEls = this.itemDocument.findRubricElements();\n if (rubricEls.length === 0)\n return [];\n const blocks = [];\n for (const el of rubricEls) {\n const viewRaw = (getAttr(el, 'view') || '').trim();\n const view = viewRaw ? viewRaw.split(/\\s+/).filter(Boolean) : [];\n // If view is specified, show only when it includes the current role.\n if (view.length > 0 && role && !view.includes(role))\n continue;\n const contentRaw = this.itemDocument.serializeChildren(el) || (el.textContent || '');\n const printed = this.renderPrintedVariables(contentRaw);\n const sanitized = sanitizeHtml(printed, { security: this.config.security });\n const html = toTrustedHtml(sanitized, this.config.security?.trustedTypesPolicyName);\n blocks.push({ view, html });\n }\n return blocks;\n }\n getComponentRegistry() {\n return this.componentRegistry;\n }\n getExtractionRegistry() {\n return this.extractionRegistry;\n }\n /**\n * Canonical interaction API (new): extracted, typed interaction data.\n */\n getInteractionData() {\n return extractInteractionData({\n document: this.itemDocument,\n extractionRegistry: this.extractionRegistry,\n declarations: this.decls,\n config: this.config,\n });\n }\n /**\n * Convenience API (used by tests/bench): returns a minimal interaction list with QTI-ish field names.\n */\n getInteractions() {\n return this.getInteractionData().map((i) => ({\n ...i,\n responseIdentifier: i.responseId,\n }));\n }\n getResponseInteractions() {\n return this.getInteractions().filter((i) => i.type !== 'endAttemptInteraction');\n }\n /**\n * Returns response identifiers of endAttempt interactions with countAttempt=\"false\".\n * Used to detect hint-only submissions (e.g. Request Hint button).\n */\n getHintEndAttemptIdentifiers() {\n return this.getInteractions()\n .filter((i) => i.type === 'endAttemptInteraction' && i.countAttempt === false)\n .map((i) => i.responseIdentifier);\n }\n getResponseIdentifiers() {\n return this.getResponseInteractions().map((i) => i.responseIdentifier);\n }\n isAdaptive() {\n return (this.itemDocument.getAssessmentItemAttribute('adaptive') || '').toLowerCase() === 'true';\n }\n getNumAttempts() {\n return Math.max(0, Math.floor(toNumber(this.ctx.getValue('numAttempts')) || 0));\n }\n getCompletionStatus() {\n const s = (toStringValue(this.ctx.getValue('completionStatus')) || '').trim();\n return (s || 'not_attempted');\n }\n isCompleted() {\n return this.getCompletionStatus() === 'completed';\n }\n submitAttempt(countAttempt = true) {\n const result = this.runItemSessionAction({ action: 'submitAttempt', countAttempt });\n return result.scoring;\n }\n runAdaptiveSubmitAttempt(countAttempt = true) {\n if (this.isCompleted()) {\n throw new Error('Cannot submit: item is already completed');\n }\n // QTI adaptive semantics: numAttempts should reflect the attempt being processed.\n if (this.isAdaptive() && countAttempt) {\n const next = this.getNumAttempts() + 1;\n this.ctx.setValue('numAttempts', qtiValue('integer', 'single', next));\n // Promote completionStatus from not_attempted -> unknown on first submission unless RP sets it.\n if (this.getCompletionStatus() === 'not_attempted') {\n this.ctx.setValue('completionStatus', qtiValue('identifier', 'single', 'unknown'));\n }\n }\n const base = this.processResponses();\n const completionStatus = this.getCompletionStatus();\n const completed = completionStatus === 'completed';\n const canContinue = this.isAdaptive() ? !completed : false;\n return {\n ...base,\n completed,\n numAttempts: this.getNumAttempts(),\n completionStatus,\n canContinue,\n };\n }\n getResponses() {\n const out = {};\n for (const d of Object.values(this.decls)) {\n if (d.__kind !== 'response')\n continue;\n out[d.identifier] = d.value.kind === 'value' ? d.value.value : null;\n }\n return out;\n }\n /**\n * Get correct response for a specific response identifier\n * @param responseId - The response identifier\n * @returns The correct response value, or undefined if not available\n */\n getCorrectResponse(responseId) {\n const decl = this.decls[responseId];\n if (!decl || decl.__kind !== 'response')\n return undefined;\n const respDecl = decl; // ResponseDeclaration from qti-processing\n if (!respDecl.correctResponse)\n return undefined;\n if (respDecl.correctResponse.kind !== 'value')\n return undefined;\n return respDecl.correctResponse.value;\n }\n /**\n * Get all correct responses as a map\n * @returns Map of responseId to correct response value\n */\n getCorrectResponses() {\n const out = {};\n for (const d of Object.values(this.decls)) {\n if (d.__kind !== 'response')\n continue;\n const respDecl = d;\n if (!respDecl.correctResponse || respDecl.correctResponse.kind !== 'value')\n continue;\n out[d.identifier] = respDecl.correctResponse.value;\n }\n return out;\n }\n getTemplateVariables() {\n const out = {};\n for (const d of Object.values(this.decls)) {\n if (!d.isTemplate)\n continue;\n out[d.identifier] = d.value.kind === 'value' ? d.value.value : null;\n }\n return out;\n }\n setTemplateVariables(vars) {\n for (const [id, raw] of Object.entries(vars)) {\n const d = this.decls[id];\n if (!d?.isTemplate)\n continue;\n d.value = this.coerceToDeclarationValue(d.baseType, d.cardinality, raw);\n }\n }\n getSessionState() {\n const out = {};\n for (const d of Object.values(this.decls)) {\n out[d.identifier] = d.value.kind === 'value' ? d.value.value : null;\n }\n return out;\n }\n validateResponses(responses) {\n const interactions = this.getInteractions();\n const entries = {};\n const issues = [];\n for (const i of interactions) {\n const responseId = i.responseIdentifier;\n const decl = this.decls[responseId];\n const value = responses[responseId];\n const required = i.type !== 'endAttemptInteraction' &&\n (i.type !== 'mediaInteraction' || (typeof i.minPlays === 'number' && i.minPlays > 0));\n let complete = !required;\n if (i.type === 'mediaInteraction' && required) {\n const minPlays = Number(i.minPlays || 0);\n complete = Number(value || 0) >= minPlays;\n }\n else if (required) {\n if (Array.isArray(value)) {\n complete = value.length > 0;\n // Enforce minChoices / minAssociations where applicable\n const minChoices = Number(i.minChoices || i.minAssociations || 0);\n if (complete && minChoices > 0) {\n complete = value.length >= minChoices;\n }\n // Enforce matchMin per-choice: each pairing entry \"id1 id2\" in value must\n // appear at least matchMin times for the relevant choice.\n // Collect all choice arrays that can carry matchMin across all pairing interaction types.\n const choices = [\n ...(i.choices ?? []),\n ...(i.gapTexts ?? []),\n ...(i.gapImages ?? []),\n ...(i.sourceSet ?? []),\n ...(i.targetSet ?? []),\n ...(i.associableHotspots ?? []),\n ];\n for (const choice of choices) {\n const min = Number(choice.matchMin || 0);\n if (min > 0) {\n const count = value.filter((p) => {\n const parts = p.split(' ');\n return parts[0] === choice.identifier || parts[1] === choice.identifier;\n }).length;\n if (count < min) {\n complete = false;\n break;\n }\n }\n }\n }\n else {\n complete = value !== null && value !== undefined && value !== '';\n }\n }\n const errors = [];\n const warnings = [];\n if (decl) {\n if (decl.cardinality === 'multiple' || decl.cardinality === 'ordered') {\n if (!(value === null || value === undefined || Array.isArray(value))) {\n errors.push(`Expected an array for ${decl.cardinality} response '${responseId}'`);\n }\n }\n else {\n if (Array.isArray(value)) {\n errors.push(`Expected a single value for response '${responseId}'`);\n }\n }\n }\n const valid = errors.length === 0;\n entries[responseId] = {\n responseId,\n interactionType: i.type,\n required,\n complete,\n valid,\n errors,\n warnings,\n };\n for (const e of errors) {\n issues.push({\n responseId,\n code: 'invalid_shape',\n message: e,\n severity: 'error',\n });\n }\n }\n const allValid = Object.values(entries).every((e) => e.valid);\n return { valid: allValid, entries, issues };\n }\n getProgress(responses) {\n const v = this.validateResponses(responses);\n const required = Object.values(v.entries).filter((e) => e.required);\n const answered = required.filter((e) => e.complete).length;\n const total = required.length;\n return { total, answered, unanswered: Math.max(0, total - answered) };\n }\n canSubmitResponses(responses) {\n const v = this.validateResponses(responses);\n const required = Object.values(v.entries).filter((e) => e.required);\n return v.valid && required.every((e) => e.complete);\n }\n /**\n * True if the learner has made any meaningful interaction, even if submission is not yet allowed.\n * Used by assessment/session controllers to track \"answered\" state.\n */\n isAttempted(responses) {\n for (const i of this.getResponseInteractions()) {\n const id = i.responseIdentifier;\n const v = responses[id];\n if (i.type === 'mediaInteraction') {\n if (Number(v || 0) > 0)\n return true;\n continue;\n }\n if (Array.isArray(v)) {\n if (v.length > 0)\n return true;\n continue;\n }\n if (v !== null && v !== undefined && v !== '')\n return true;\n }\n return false;\n }\n // ----------------------------------------------------------------------------\n // Execution\n // ----------------------------------------------------------------------------\n execTemplateProcessing() {\n if (!this.templateProcessingProgram)\n return;\n execProgram({\n ctx: this.ctx,\n ops: this.ops,\n rng: this.rng,\n customOperators: this.config.customOperators,\n }, this.templateProcessingProgram);\n }\n execResponseProcessingProgram() {\n if (!this.responseProcessingProgram)\n return;\n execProgram({\n ctx: this.ctx,\n ops: this.ops,\n rng: this.rng,\n customOperators: this.config.customOperators,\n }, this.responseProcessingProgram);\n }\n execOutcomeProcessingProgram() {\n if (!this.outcomeProcessingProgram)\n return;\n execProgram({\n ctx: this.ctx,\n ops: this.ops,\n rng: this.rng,\n customOperators: this.config.customOperators,\n }, this.outcomeProcessingProgram);\n }\n execResponseProcessingTemplate(templateUrl) {\n const name = templateUrl.split('/').pop()?.toLowerCase().replace(/\\.xml$/, '');\n if (!name) {\n console.warn(`[QTI Player] Could not extract template name from URL: ${templateUrl}`);\n return;\n }\n const responseDeclIds = Object.values(this.decls)\n .filter((d) => d.__kind === 'response')\n .map((d) => d.identifier);\n switch (name) {\n case 'match_correct':\n case 'cc2_match': { // CC2_match is an alias for match_correct (QTI 2.1 compatibility)\n const allCorrect = responseDeclIds.every((id) => {\n const expr = { kind: 'expr.match', id: 'tmp', a: { kind: 'expr.variable', id: 'tmp', identifier: id }, b: { kind: 'expr.correct', id: 'tmp', identifier: id } };\n // Use evaluator match semantics by evaluating a constructed MatchExpr\n return toBoolean(evalExpr({ ctx: this.ctx, ops: this.ops, rng: this.rng, customOperators: this.config.customOperators }, expr));\n });\n const max = toNumber(this.ctx.getValue('MAXSCORE'));\n this.ctx.setValue('SCORE', qtiValue('float', 'single', allCorrect ? (Number.isFinite(max) ? max : 1) : 0));\n return;\n }\n case 'match_nothing':\n case 'cc2_match_nothing': { // QTI 2.1 compatibility\n const isEmptyResponse = (v) => {\n if (!v)\n return true;\n if (v.kind === 'null')\n return true;\n if (v.kind === 'invalid')\n return false;\n if (v.value === null || v.value === undefined)\n return true;\n if (Array.isArray(v.value))\n return v.value.length === 0;\n if (typeof v.value === 'string')\n return v.value.trim().length === 0;\n return false;\n };\n const allEmpty = responseDeclIds.every((id) => isEmptyResponse(this.ctx.getValue(id)));\n const max = toNumber(this.ctx.getValue('MAXSCORE'));\n this.ctx.setValue('SCORE', qtiValue('float', 'single', allEmpty ? (Number.isFinite(max) ? max : 1) : 0));\n return;\n }\n case 'map_response':\n case 'cc2_map_response': { // QTI 2.1 compatibility\n let total = 0;\n for (const id of responseDeclIds) {\n const d = this.decls[id];\n if (!d.mapping)\n continue;\n const v = evalExpr({ ctx: this.ctx, ops: this.ops, rng: this.rng }, { kind: 'expr.mapResponse', id: 'tmp', identifier: id });\n total += toNumber(v) || 0;\n }\n this.ctx.setValue('SCORE', qtiValue('float', 'single', total));\n return;\n }\n case 'map_response_point':\n case 'cc2_map_response_point': { // QTI 2.1 compatibility\n let total = 0;\n for (const id of responseDeclIds) {\n const d = this.decls[id];\n if (!d.areaMapping)\n continue;\n const v = evalExpr({ ctx: this.ctx, ops: this.ops, rng: this.rng }, { kind: 'expr.mapResponsePoint', id: 'tmp', identifier: id });\n total += toNumber(v) || 0;\n }\n this.ctx.setValue('SCORE', qtiValue('float', 'single', total));\n return;\n }\n default:\n console.warn(`[QTI Player] Unsupported response processing template: ${name}`);\n return;\n }\n }\n // ----------------------------------------------------------------------------\n // Declarations\n // ----------------------------------------------------------------------------\n buildDeclarations() {\n const decls = {};\n const addDecl = (kind, el) => {\n const identifier = this.getAttrMapped(el, 'identifier');\n const cardinality = (this.getAttrMapped(el, 'cardinality') || 'single');\n const baseType = (this.getAttrMapped(el, 'baseType') || 'string');\n if (!identifier)\n return;\n const defaultValue = this.parseDefaultValue(el, baseType, cardinality);\n decls[identifier] = {\n identifier,\n baseType,\n cardinality,\n defaultValue,\n value: defaultValue,\n isTemplate: kind === 'template',\n // @ts-expect-error internal marker for templates\n __kind: kind,\n };\n // Response + outcome declarations may define mappings used by mapResponse/mapOutcome.\n // (Templates do not participate in mapping.)\n if (kind === 'response' || kind === 'outcome') {\n const mappingEl = findFirstDescendant(el, this.mapper.toNative('mapping'));\n if (mappingEl) {\n decls[identifier].mapping = this.parseMapping(mappingEl, baseType);\n }\n }\n // Outcome declarations may define a lookup table (matchTable or interpolationTable)\n // used by the lookupOutcomeValue rule.\n if (kind === 'outcome') {\n const matchTableEl = findFirstDescendant(el, this.mapper.toNative('matchtable'));\n const interpolationTableEl = findFirstDescendant(el, this.mapper.toNative('interpolationtable'));\n if (matchTableEl) {\n decls[identifier].lookupTable = this.parseMatchTable(matchTableEl);\n }\n else if (interpolationTableEl) {\n decls[identifier].lookupTable = this.parseInterpolationTable(interpolationTableEl);\n }\n }\n if (kind === 'response') {\n const correctEl = findFirstDescendant(el, this.mapper.toNative('correctresponse'));\n if (correctEl) {\n decls[identifier].correctResponse = this.parseCorrectResponse(correctEl, baseType, cardinality);\n }\n const areaMappingEl = findFirstDescendant(el, this.mapper.toNative('areamapping'));\n if (areaMappingEl) {\n decls[identifier].areaMapping = this.parseAreaMapping(areaMappingEl);\n }\n }\n };\n for (const el of this.itemDocument.findDeclarationElements('response'))\n addDecl('response', el);\n for (const el of this.itemDocument.findDeclarationElements('outcome'))\n addDecl('outcome', el);\n for (const el of this.itemDocument.findDeclarationElements('template'))\n addDecl('template', el);\n return decls;\n }\n parseMatchTable(el) {\n const defaultValueRaw = (getAttr(el, 'defaultValue') || '').trim();\n const defaultValue = defaultValueRaw ? Number(defaultValueRaw) : undefined;\n return {\n kind: 'table.matchTable',\n defaultValue: Number.isFinite(defaultValue) ? defaultValue : undefined,\n entries: findDescendants(el, this.mapper.toNative('matchtableentry')).map((e) => ({\n sourceValue: (getAttr(e, 'sourceValue') || '').trim(),\n targetValue: (getAttr(e, 'targetValue') || '').trim(),\n })),\n };\n }\n parseInterpolationTable(el) {\n const defaultValueRaw = (getAttr(el, 'defaultValue') || '').trim();\n const defaultValue = defaultValueRaw ? Number(defaultValueRaw) : undefined;\n const interpolationMethod = (getAttr(el, 'interpolationMethod') || 'linear').trim();\n return {\n kind: 'table.interpolationTable',\n defaultValue: Number.isFinite(defaultValue) ? defaultValue : undefined,\n interpolationMethod,\n entries: findDescendants(el, this.mapper.toNative('interpolationtableentry'))\n .map((e) => ({\n sourceValue: Number((getAttr(e, 'sourceValue') || '').trim()),\n targetValue: Number((getAttr(e, 'targetValue') || '').trim()),\n }))\n .filter((e) => Number.isFinite(e.sourceValue) && Number.isFinite(e.targetValue)),\n };\n }\n ensureBuiltinDeclarations(decls) {\n // completionStatus + numAttempts are defined in QTI (esp. adaptive items) and commonly used\n // without explicit outcomeDeclaration in authoring content.\n if (!decls.completionStatus) {\n decls.completionStatus = {\n identifier: 'completionStatus',\n baseType: 'identifier',\n cardinality: 'single',\n value: qtiValue('identifier', 'single', 'not_attempted'),\n isTemplate: false,\n // @ts-expect-error internal marker\n __kind: 'outcome',\n };\n }\n if (!decls.numAttempts) {\n decls.numAttempts = {\n identifier: 'numAttempts',\n baseType: 'integer',\n cardinality: 'single',\n defaultValue: qtiValue('integer', 'single', 0),\n value: qtiValue('integer', 'single', 0),\n isTemplate: false,\n // @ts-expect-error internal marker\n __kind: 'outcome',\n };\n }\n if (!decls.duration) {\n decls.duration = {\n identifier: 'duration',\n baseType: 'duration',\n cardinality: 'single',\n defaultValue: qtiValue('duration', 'single', 0),\n value: qtiValue('duration', 'single', 0),\n isTemplate: false,\n // @ts-expect-error internal marker\n __kind: 'outcome',\n };\n }\n // Common scoring defaults\n if (!decls.SCORE) {\n decls.SCORE = {\n identifier: 'SCORE',\n baseType: 'float',\n cardinality: 'single',\n value: qtiValue('float', 'single', 0),\n isTemplate: false,\n // @ts-expect-error internal marker\n __kind: 'outcome',\n };\n }\n if (!decls.MAXSCORE) {\n decls.MAXSCORE = {\n identifier: 'MAXSCORE',\n baseType: 'float',\n cardinality: 'single',\n value: qtiValue('float', 'single', 1),\n isTemplate: false,\n // @ts-expect-error internal marker\n __kind: 'outcome',\n };\n }\n }\n applySessionState(state) {\n for (const [id, raw] of Object.entries(state)) {\n const d = this.decls[id];\n if (!d)\n continue;\n d.value = this.coerceToDeclarationValue(d.baseType, d.cardinality, raw);\n }\n const restoredDuration = Number(state.duration);\n if (Number.isFinite(restoredDuration) && restoredDuration >= 0) {\n this.accumulatedDurationMs = restoredDuration;\n this.sessionStartedAt = Date.now();\n this.updateDuration();\n }\n }\n applySerializedVariables(vars) {\n for (const v of Object.values(vars)) {\n const d = this.decls[v.identifier];\n if (!d)\n continue;\n d.value = this.coerceToDeclarationValue(d.baseType, d.cardinality, v.value);\n if (d.__kind === 'response') {\n this.setPciResponse(d.identifier, v.value);\n }\n }\n }\n serializeItemSession() {\n const responseVariables = {};\n const outcomeVariables = {};\n const templateVariables = {};\n const contextVariables = {};\n const contextIds = new Set(['completionStatus', 'numAttempts', 'duration']);\n for (const d of Object.values(this.decls)) {\n const variable = this.serializeVariable(d);\n if (d.isTemplate) {\n templateVariables[d.identifier] = { ...variable, kind: 'template' };\n }\n else if (contextIds.has(d.identifier)) {\n contextVariables[d.identifier] = { ...variable, kind: 'context' };\n }\n else if (d.__kind === 'response') {\n responseVariables[d.identifier] = { ...variable, kind: 'response' };\n }\n else if (d.__kind === 'outcome') {\n outcomeVariables[d.identifier] = { ...variable, kind: 'outcome' };\n }\n }\n const validation = this.validateResponses(this.getResponses());\n return {\n itemIdentifier: this.itemDocument.getAssessmentItemAttribute('identifier') ?? undefined,\n sessionGuid: this.sessionGuid,\n lifecycleStatus: this.lifecycleStatus,\n completionStatus: this.getCompletionStatus(),\n numAttempts: this.getNumAttempts(),\n duration: this.getDuration(),\n responseVariables,\n outcomeVariables,\n templateVariables,\n contextVariables,\n validationMessages: validation.issues,\n savedAt: new Date().toISOString(),\n };\n }\n serializeVariable(d) {\n return {\n identifier: d.identifier,\n kind: (d.__kind ?? (d.isTemplate ? 'template' : 'context')),\n baseType: d.baseType,\n cardinality: d.cardinality,\n value: this.qtiValueToSerializable(d.value),\n defaultValue: this.qtiValueToSerializable(d.defaultValue),\n };\n }\n qtiValueToSerializable(value) {\n if (!value || value.kind !== 'value')\n return null;\n return value.value;\n }\n updateDuration() {\n const elapsedMs = Math.max(0, Date.now() - this.sessionStartedAt);\n const durationMs = this.accumulatedDurationMs + elapsedMs;\n this.ctx.setValue('duration', qtiValue('duration', 'single', durationMs));\n }\n freezeDuration() {\n this.updateDuration();\n const duration = this.getDuration();\n this.accumulatedDurationMs = duration;\n this.sessionStartedAt = Date.now();\n return duration;\n }\n getDuration() {\n const value = this.ctx.getValue('duration');\n return Math.max(0, Math.floor(toNumber(value) || 0));\n }\n parseDefaultValue(declEl, baseType, cardinality) {\n const defaultEl = findFirstDescendant(declEl, this.mapper.toNative('defaultvalue'));\n if (!defaultEl)\n return qtiNull(baseType, cardinality);\n const values = findDescendants(defaultEl, this.mapper.toNative('value')).map((v) => (v.textContent || '').trim());\n if (cardinality === 'multiple' || cardinality === 'ordered') {\n return qtiValue(baseType, cardinality, values.map((t) => {\n const v = coerceBaseValue(baseType, t);\n return v.kind === 'value' ? v.value : null;\n }));\n }\n return coerceBaseValue(baseType, values[0] ?? '');\n }\n parseCorrectResponse(correctEl, baseType, cardinality) {\n const values = findDescendants(correctEl, this.mapper.toNative('value')).map((v) => (v.textContent || '').trim());\n if (cardinality === 'multiple' || cardinality === 'ordered') {\n return qtiValue(baseType, cardinality, values.map((t) => {\n const v = coerceBaseValue(baseType, t);\n return v.kind === 'value' ? v.value : null;\n }));\n }\n return coerceBaseValue(baseType, values[0] ?? '');\n }\n parseMapping(mappingEl, baseType) {\n const defaultValue = Number(this.getAttrMapped(mappingEl, 'defaultValue') || 0);\n const lowerBound = this.getAttrMapped(mappingEl, 'lowerBound') ? Number(this.getAttrMapped(mappingEl, 'lowerBound')) : undefined;\n const upperBound = this.getAttrMapped(mappingEl, 'upperBound') ? Number(this.getAttrMapped(mappingEl, 'upperBound')) : undefined;\n const mappingCaseSensitive = this.getAttrMapped(mappingEl, 'caseSensitive') || 'true';\n const entries = {};\n const normalizePairKey = (k) => {\n const parts = k.trim().split(/\\s+/).filter(Boolean);\n if (parts.length === 2)\n return [...parts].sort().join(' ');\n return k.trim();\n };\n const normalizeDirectedPairKey = (k) => {\n const parts = k.trim().split(/\\s+/).filter(Boolean);\n if (parts.length >= 2)\n return `${parts[0]} ${parts[1]}`;\n return k.trim();\n };\n for (const e of findDescendants(mappingEl, this.mapper.toNative('mapentry'))) {\n const mapKey = this.getAttrMapped(e, 'mapKey');\n const mappedValue = this.getAttrMapped(e, 'mappedValue');\n if (!mapKey || mappedValue === null)\n continue;\n const effectiveCaseSensitive = this.getAttrMapped(e, 'caseSensitive') || mappingCaseSensitive || 'true';\n const storedKey = baseType === 'pair'\n ? normalizePairKey(mapKey)\n : baseType === 'directedPair'\n ? normalizeDirectedPairKey(mapKey)\n : mapKey;\n entries[storedKey] = { mapKey: storedKey, mappedValue: Number(mappedValue), caseSensitive: effectiveCaseSensitive };\n if (effectiveCaseSensitive !== 'true') {\n const lowerKey = storedKey.toLowerCase();\n entries[lowerKey] = {\n mapKey: lowerKey,\n mappedValue: Number(mappedValue),\n caseSensitive: effectiveCaseSensitive,\n };\n }\n }\n return { defaultValue, lowerBound, upperBound, caseSensitive: mappingCaseSensitive, entries };\n }\n parseAreaMapping(areaMappingEl) {\n const defaultValue = Number(getAttr(areaMappingEl, 'defaultValue') || 0);\n const lowerBound = getAttr(areaMappingEl, 'lowerBound')\n ? Number(getAttr(areaMappingEl, 'lowerBound'))\n : undefined;\n const upperBound = getAttr(areaMappingEl, 'upperBound')\n ? Number(getAttr(areaMappingEl, 'upperBound'))\n : undefined;\n const entries = [];\n for (const e of findDescendants(areaMappingEl, this.mapper.toNative('areamapentry'))) {\n const shape = (getAttr(e, 'shape') || 'default');\n const coords = String(getAttr(e, 'coords') || '');\n const mappedValue = Number(getAttr(e, 'mappedValue') || 0);\n entries.push({ shape, coords, mappedValue });\n }\n return { defaultValue, lowerBound, upperBound, entries };\n }\n coerceToDeclarationValue(baseType, cardinality, raw) {\n if (raw === null || raw === undefined)\n return qtiNull(baseType, cardinality);\n // Allow callers to pass fully-formed QtiValue (e.g. session restore).\n if (typeof raw === 'object' && raw && 'kind' in raw) {\n return raw;\n }\n // For file types, preserve QTIFileResponse objects directly\n if (baseType === 'file') {\n if (cardinality === 'multiple' || cardinality === 'ordered') {\n const arr = Array.isArray(raw) ? raw : [raw];\n // For file types, preserve objects (QTIFileResponse) directly\n return qtiValue(baseType, cardinality, arr.filter((v) => v !== null && v !== undefined));\n }\n // For single file, preserve the object directly\n return qtiValue(baseType, cardinality, raw);\n }\n if (cardinality === 'multiple' || cardinality === 'ordered') {\n const arr = Array.isArray(raw) ? raw : [raw];\n const coerced = arr\n .map((v) => String(v ?? '').trim())\n .filter((s) => s.length > 0)\n .map((t) => {\n const v = coerceBaseValue(baseType, t);\n return v.kind === 'value' ? v.value : null;\n })\n .filter((v) => v !== null);\n // Multiple/ordered can legitimately be an empty container (distinct from null).\n return qtiValue(baseType, cardinality, coerced);\n }\n const t = String(raw ?? '').trim();\n if (t.length === 0)\n return qtiNull(baseType, cardinality);\n return coerceBaseValue(baseType, t);\n }\n collectOutcomes() {\n const out = {};\n for (const d of Object.values(this.decls)) {\n if (d.__kind !== 'outcome')\n continue;\n if (d.value.kind === 'value')\n out[d.identifier] = d.value.value;\n else if (d.value.kind === 'null')\n out[d.identifier] = null;\n }\n // Ensure MAXSCORE always has a value (fallback to 1.0 if null or missing)\n if (out.MAXSCORE === null || out.MAXSCORE === undefined) {\n out.MAXSCORE = 1.0;\n }\n return out;\n }\n // ----------------------------------------------------------------------------\n // printedVariable + feedback\n // ----------------------------------------------------------------------------\n renderPrintedVariables(html) {\n const readIdentifier = (attrs) => {\n const m = attrs.match(/identifier\\s*=\\s*(?:\"([^\"]+)\"|'([^']+)'|([^\\s>]+))/i);\n return (m?.[1] || m?.[2] || m?.[3] || '').trim() || null;\n };\n const renderId = (id) => {\n if (!id)\n return '';\n const v = this.ctx.getValue(id);\n if (v.kind !== 'value')\n return '';\n if (Array.isArray(v.value))\n return v.value.map(String).join(', ');\n return String(v.value);\n };\n let out = html.replace(/<printedVariable\\b([^>]*)>([\\s\\S]*?)<\\/printedVariable>/gi, (_m, attrs) => renderId(readIdentifier(String(attrs))));\n out = out.replace(/<printedVariable\\b([^>]*)\\/>/gi, (_m, attrs) => renderId(readIdentifier(String(attrs))));\n return out;\n }\n getModalFeedback(outcomes) {\n const feedbackEls = this.itemDocument.findModalFeedbackElements();\n const active = [];\n for (const el of feedbackEls) {\n const identifier = this.getAttrMapped(el, 'identifier') || '';\n const outcomeIdentifier = this.getAttrMapped(el, 'outcomeIdentifier') || '';\n const showHide = (this.getAttrMapped(el, 'showHide') || 'show');\n const title = this.getAttrMapped(el, 'title') || undefined;\n const contentRaw = this.itemDocument.serializeChildren(el) || (el.textContent || '');\n const sanitized = sanitizeHtml(contentRaw, { security: this.config.security });\n const content = toTrustedHtml(sanitized, this.config.security?.trustedTypesPolicyName);\n const outcomeValue = outcomes[outcomeIdentifier];\n const shouldShow = showHide === 'show' ? outcomeValue === identifier : outcomeValue !== identifier;\n if (shouldShow && content) {\n active.push({ identifier, outcomeIdentifier, showHide, content, title });\n }\n }\n return active;\n }\n}\n// ---------------------------------------------------------------------------\n// Module-level helpers\n// ---------------------------------------------------------------------------\nfunction mergePnp(base, partial) {\n return {\n display: { ...(base?.display ?? {}), ...(partial.display ?? {}) },\n content: { ...(base?.content ?? {}), ...(partial.content ?? {}) },\n cognitive: { ...(base?.cognitive ?? {}), ...(partial.cognitive ?? {}) },\n };\n}\nfunction createSessionGuid() {\n if (typeof crypto !== 'undefined' && 'randomUUID' in crypto) {\n return crypto.randomUUID();\n }\n return `item-session-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;\n}\nfunction looksLikeCatalogUrl(value) {\n const trimmed = value.trim();\n return /^(https?:\\/\\/|\\/\\/|\\/|\\.{0,2}\\/|data:|blob:)/i.test(trimmed) ||\n /\\.(png|jpe?g|gif|webp|svg|mp3|wav|ogg|mp4|webm|pdf)(\\?.*)?$/i.test(trimmed);\n}\n//# sourceMappingURL=Player.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar he_1 = require(\"he\");\n/**\n * Node Class as base class for TextNode and HTMLElement.\n */\nvar Node = /** @class */ (function () {\n function Node(parentNode, range) {\n if (parentNode === void 0) { parentNode = null; }\n this.parentNode = parentNode;\n this.childNodes = [];\n Object.defineProperty(this, 'range', {\n enumerable: false,\n writable: true,\n configurable: true,\n value: range !== null && range !== void 0 ? range : [-1, -1]\n });\n }\n /**\n * Remove current node\n */\n Node.prototype.remove = function () {\n var _this = this;\n if (this.parentNode) {\n var children = this.parentNode.childNodes;\n this.parentNode.childNodes = children.filter(function (child) {\n return _this !== child;\n });\n this.parentNode = null;\n }\n return this;\n };\n Object.defineProperty(Node.prototype, \"innerText\", {\n get: function () {\n return this.rawText;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Node.prototype, \"textContent\", {\n get: function () {\n return (0, he_1.decode)(this.rawText);\n },\n set: function (val) {\n this.rawText = (0, he_1.encode)(val);\n },\n enumerable: false,\n configurable: true\n });\n return Node;\n}());\nexports.default = Node;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar NodeType;\n(function (NodeType) {\n NodeType[NodeType[\"ELEMENT_NODE\"] = 1] = \"ELEMENT_NODE\";\n NodeType[NodeType[\"TEXT_NODE\"] = 3] = \"TEXT_NODE\";\n NodeType[NodeType[\"COMMENT_NODE\"] = 8] = \"COMMENT_NODE\";\n})(NodeType || (NodeType = {}));\nexports.default = NodeType;\n","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar node_1 = __importDefault(require(\"./node\"));\nvar type_1 = __importDefault(require(\"./type\"));\nvar CommentNode = /** @class */ (function (_super) {\n __extends(CommentNode, _super);\n function CommentNode(rawText, parentNode, range, rawTagName) {\n if (parentNode === void 0) { parentNode = null; }\n if (rawTagName === void 0) { rawTagName = '!--'; }\n var _this = _super.call(this, parentNode, range) || this;\n _this.rawText = rawText;\n _this.rawTagName = rawTagName;\n /**\n * Node Type declaration.\n * @type {Number}\n */\n _this.nodeType = type_1.default.COMMENT_NODE;\n return _this;\n }\n CommentNode.prototype.clone = function () {\n return new CommentNode(this.rawText, null, undefined, this.rawTagName);\n };\n Object.defineProperty(CommentNode.prototype, \"text\", {\n /**\n * Get unescaped text value of current node and its children.\n * @return {string} text content\n */\n get: function () {\n return this.rawText;\n },\n enumerable: false,\n configurable: true\n });\n CommentNode.prototype.toString = function () {\n return \"<!--\".concat(this.rawText, \"-->\");\n };\n return CommentNode;\n}(node_1.default));\nexports.default = CommentNode;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction arr_back(arr) {\n return arr[arr.length - 1];\n}\nexports.default = arr_back;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar type_1 = __importDefault(require(\"./nodes/type\"));\nfunction isTag(node) {\n return node && node.nodeType === type_1.default.ELEMENT_NODE;\n}\nfunction getAttributeValue(elem, name) {\n return isTag(elem) ? elem.getAttribute(name) : undefined;\n}\nfunction getName(elem) {\n return ((elem && elem.rawTagName) || '').toLowerCase();\n}\nfunction getChildren(node) {\n return node && node.childNodes;\n}\nfunction getParent(node) {\n return node ? node.parentNode : null;\n}\nfunction getText(node) {\n return node.text;\n}\nfunction removeSubsets(nodes) {\n var idx = nodes.length;\n var node;\n var ancestor;\n var replace;\n // Check if each node (or one of its ancestors) is already contained in the\n // array.\n while (--idx > -1) {\n node = ancestor = nodes[idx];\n // Temporarily remove the node under consideration\n nodes[idx] = null;\n replace = true;\n while (ancestor) {\n if (nodes.indexOf(ancestor) > -1) {\n replace = false;\n nodes.splice(idx, 1);\n break;\n }\n ancestor = getParent(ancestor);\n }\n // If the node has been found to be unique, re-insert it.\n if (replace) {\n nodes[idx] = node;\n }\n }\n return nodes;\n}\nfunction existsOne(test, elems) {\n return elems.some(function (elem) {\n return isTag(elem) ? test(elem) || existsOne(test, getChildren(elem)) : false;\n });\n}\nfunction getSiblings(node) {\n var parent = getParent(node);\n return parent ? getChildren(parent) : [];\n}\nfunction hasAttrib(elem, name) {\n return getAttributeValue(elem, name) !== undefined;\n}\nfunction findOne(test, elems) {\n var elem = null;\n for (var i = 0, l = elems === null || elems === void 0 ? void 0 : elems.length; i < l && !elem; i++) {\n var el = elems[i];\n if (test(el)) {\n elem = el;\n }\n else {\n var childs = getChildren(el);\n if (childs && childs.length > 0) {\n elem = findOne(test, childs);\n }\n }\n }\n return elem;\n}\nfunction findAll(test, nodes) {\n var result = [];\n for (var i = 0, j = nodes.length; i < j; i++) {\n if (!isTag(nodes[i]))\n continue;\n if (test(nodes[i]))\n result.push(nodes[i]);\n var childs = getChildren(nodes[i]);\n if (childs)\n result = result.concat(findAll(test, childs));\n }\n return result;\n}\nexports.default = {\n isTag: isTag,\n getAttributeValue: getAttributeValue,\n getName: getName,\n getChildren: getChildren,\n getParent: getParent,\n getText: getText,\n removeSubsets: removeSubsets,\n existsOne: existsOne,\n getSiblings: getSiblings,\n hasAttrib: hasAttrib,\n findOne: findOne,\n findAll: findAll\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar VoidTag = /** @class */ (function () {\n function VoidTag(addClosingSlash, tags) {\n if (addClosingSlash === void 0) { addClosingSlash = false; }\n this.addClosingSlash = addClosingSlash;\n if (Array.isArray(tags)) {\n this.voidTags = tags.reduce(function (set, tag) {\n return set.add(tag.toLowerCase()).add(tag.toUpperCase()).add(tag);\n }, new Set());\n }\n else {\n this.voidTags = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'].reduce(function (set, tag) {\n return set.add(tag.toLowerCase()).add(tag.toUpperCase()).add(tag);\n }, new Set());\n }\n }\n VoidTag.prototype.formatNode = function (tag, attrs, innerHTML) {\n var addClosingSlash = this.addClosingSlash;\n var closingSpace = (addClosingSlash && attrs && !attrs.endsWith(' ')) ? ' ' : '';\n var closingSlash = addClosingSlash ? \"\".concat(closingSpace, \"/\") : '';\n return this.isVoidElement(tag.toLowerCase()) ? \"<\".concat(tag).concat(attrs).concat(closingSlash, \">\") : \"<\".concat(tag).concat(attrs, \">\").concat(innerHTML, \"</\").concat(tag, \">\");\n };\n VoidTag.prototype.isVoidElement = function (tag) {\n return this.voidTags.has(tag);\n };\n return VoidTag;\n}());\nexports.default = VoidTag;\n","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar he_1 = require(\"he\");\nvar node_1 = __importDefault(require(\"./node\"));\nvar type_1 = __importDefault(require(\"./type\"));\n/**\n * TextNode to contain a text element in DOM tree.\n * @param {string} value [description]\n */\nvar TextNode = /** @class */ (function (_super) {\n __extends(TextNode, _super);\n function TextNode(rawText, parentNode, range) {\n if (parentNode === void 0) { parentNode = null; }\n var _this = _super.call(this, parentNode, range) || this;\n /**\n * Node Type declaration.\n * @type {Number}\n */\n _this.nodeType = type_1.default.TEXT_NODE;\n _this.rawTagName = '';\n _this._rawText = rawText;\n return _this;\n }\n TextNode.prototype.clone = function () {\n return new TextNode(this._rawText, null);\n };\n Object.defineProperty(TextNode.prototype, \"rawText\", {\n get: function () {\n return this._rawText;\n },\n /**\n * Set rawText and invalidate trimmed caches\n */\n set: function (text) {\n this._rawText = text;\n this._trimmedRawText = void 0;\n this._trimmedText = void 0;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextNode.prototype, \"trimmedRawText\", {\n /**\n * Returns raw text with all whitespace trimmed except single leading/trailing non-breaking space\n */\n get: function () {\n if (this._trimmedRawText !== undefined)\n return this._trimmedRawText;\n this._trimmedRawText = trimText(this.rawText);\n return this._trimmedRawText;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextNode.prototype, \"trimmedText\", {\n /**\n * Returns text with all whitespace trimmed except single leading/trailing non-breaking space\n */\n get: function () {\n if (this._trimmedText !== undefined)\n return this._trimmedText;\n this._trimmedText = trimText(this.text);\n return this._trimmedText;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextNode.prototype, \"text\", {\n /**\n * Get unescaped text value of current node and its children.\n * @return {string} text content\n */\n get: function () {\n return (0, he_1.decode)(this.rawText);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(TextNode.prototype, \"isWhitespace\", {\n /**\n * Detect if the node contains only white space.\n * @return {boolean}\n */\n get: function () {\n return /^(\\s| )*$/.test(this.rawText);\n },\n enumerable: false,\n configurable: true\n });\n TextNode.prototype.toString = function () {\n return this.rawText;\n };\n return TextNode;\n}(node_1.default));\nexports.default = TextNode;\n/**\n * Trim whitespace except single leading/trailing non-breaking space\n */\nfunction trimText(text) {\n var i = 0;\n var startPos;\n var endPos;\n while (i >= 0 && i < text.length) {\n if (/\\S/.test(text[i])) {\n if (startPos === undefined) {\n startPos = i;\n i = text.length;\n }\n else {\n endPos = i;\n i = void 0;\n }\n }\n if (startPos === undefined)\n i++;\n else\n i--;\n }\n if (startPos === undefined)\n startPos = 0;\n if (endPos === undefined)\n endPos = text.length - 1;\n var hasLeadingSpace = startPos > 0 && /[^\\S\\r\\n]/.test(text[startPos - 1]);\n var hasTrailingSpace = endPos < (text.length - 1) && /[^\\S\\r\\n]/.test(text[endPos + 1]);\n return (hasLeadingSpace ? ' ' : '') + text.slice(startPos, endPos + 1) + (hasTrailingSpace ? ' ' : '');\n}\n","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parse = exports.base_parse = void 0;\nvar css_select_1 = require(\"css-select\");\nvar he_1 = __importDefault(require(\"he\"));\nvar back_1 = __importDefault(require(\"../back\"));\nvar matcher_1 = __importDefault(require(\"../matcher\"));\nvar void_tag_1 = __importDefault(require(\"../void-tag\"));\nvar comment_1 = __importDefault(require(\"./comment\"));\nvar node_1 = __importDefault(require(\"./node\"));\nvar text_1 = __importDefault(require(\"./text\"));\nvar type_1 = __importDefault(require(\"./type\"));\nfunction decode(val) {\n // clone string\n return JSON.parse(JSON.stringify(he_1.default.decode(val)));\n}\n// https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements\nvar Htags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup'];\nvar Dtags = ['details', 'dialog', 'dd', 'div', 'dt'];\nvar Ftags = ['fieldset', 'figcaption', 'figure', 'footer', 'form'];\nvar tableTags = ['table', 'td', 'tr'];\nvar htmlTags = ['address', 'article', 'aside', 'blockquote', 'br', 'hr', 'li', 'main', 'nav', 'ol', 'p', 'pre', 'section', 'ul'];\nvar kBlockElements = new Set();\nfunction addToKBlockElement() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var addToSet = function (array) {\n for (var index = 0; index < array.length; index++) {\n var element = array[index];\n kBlockElements.add(element);\n kBlockElements.add(element.toUpperCase());\n }\n };\n for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {\n var arg = args_1[_a];\n addToSet(arg);\n }\n}\naddToKBlockElement(Htags, Dtags, Ftags, tableTags, htmlTags);\nvar DOMTokenList = /** @class */ (function () {\n function DOMTokenList(valuesInit, afterUpdate) {\n if (valuesInit === void 0) { valuesInit = []; }\n if (afterUpdate === void 0) { afterUpdate = function () { return null; }; }\n this._set = new Set(valuesInit);\n this._afterUpdate = afterUpdate;\n }\n DOMTokenList.prototype._validate = function (c) {\n if (/\\s/.test(c)) {\n throw new Error(\"DOMException in DOMTokenList.add: The token '\".concat(c, \"' contains HTML space characters, which are not valid in tokens.\"));\n }\n };\n DOMTokenList.prototype.add = function (c) {\n this._validate(c);\n this._set.add(c);\n this._afterUpdate(this); // eslint-disable-line @typescript-eslint/no-unsafe-call\n };\n DOMTokenList.prototype.replace = function (c1, c2) {\n this._validate(c2);\n this._set.delete(c1);\n this._set.add(c2);\n this._afterUpdate(this); // eslint-disable-line @typescript-eslint/no-unsafe-call\n };\n DOMTokenList.prototype.remove = function (c) {\n this._set.delete(c) && this._afterUpdate(this); // eslint-disable-line @typescript-eslint/no-unsafe-call\n };\n DOMTokenList.prototype.toggle = function (c) {\n this._validate(c);\n if (this._set.has(c))\n this._set.delete(c);\n else\n this._set.add(c);\n this._afterUpdate(this); // eslint-disable-line @typescript-eslint/no-unsafe-call\n };\n DOMTokenList.prototype.contains = function (c) {\n return this._set.has(c);\n };\n Object.defineProperty(DOMTokenList.prototype, \"length\", {\n get: function () {\n return this._set.size;\n },\n enumerable: false,\n configurable: true\n });\n DOMTokenList.prototype.values = function () {\n return this._set.values();\n };\n Object.defineProperty(DOMTokenList.prototype, \"value\", {\n get: function () {\n return Array.from(this._set.values());\n },\n enumerable: false,\n configurable: true\n });\n DOMTokenList.prototype.toString = function () {\n return Array.from(this._set.values()).join(' ');\n };\n return DOMTokenList;\n}());\n/**\n * HTMLElement, which contains a set of children.\n *\n * Note: this is a minimalist implementation, no complete tree\n * structure provided (no parentNode, nextSibling,\n * previousSibling etc).\n * @class HTMLElement\n * @extends {Node}\n */\nvar HTMLElement = /** @class */ (function (_super) {\n __extends(HTMLElement, _super);\n /**\n * Creates an instance of HTMLElement.\n * @param keyAttrs\tid and class attribute\n * @param [rawAttrs]\tattributes in string\n *\n * @memberof HTMLElement\n */\n function HTMLElement(tagName, keyAttrs, rawAttrs, parentNode, range, voidTag, _parseOptions) {\n if (rawAttrs === void 0) { rawAttrs = ''; }\n if (parentNode === void 0) { parentNode = null; }\n if (voidTag === void 0) { voidTag = new void_tag_1.default(); }\n if (_parseOptions === void 0) { _parseOptions = {}; }\n var _this = _super.call(this, parentNode, range) || this;\n _this.rawAttrs = rawAttrs;\n _this.voidTag = voidTag;\n /**\n * Node Type declaration.\n */\n _this.nodeType = type_1.default.ELEMENT_NODE;\n _this.rawTagName = tagName;\n _this.rawAttrs = rawAttrs || '';\n _this.id = keyAttrs.id || '';\n _this.childNodes = [];\n _this._parseOptions = _parseOptions;\n _this.classList = new DOMTokenList(keyAttrs.class ? keyAttrs.class.split(/\\s+/) : [], function (classList) { return _this.setAttribute('class', classList.toString()); } // eslint-disable-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n );\n if (keyAttrs.id) {\n if (!rawAttrs) {\n _this.rawAttrs = \"id=\\\"\".concat(keyAttrs.id, \"\\\"\");\n }\n }\n if (keyAttrs.class) {\n if (!rawAttrs) {\n var cls = \"class=\\\"\".concat(_this.classList.toString(), \"\\\"\");\n if (_this.rawAttrs) {\n _this.rawAttrs += \" \".concat(cls);\n }\n else {\n _this.rawAttrs = cls;\n }\n }\n }\n return _this;\n }\n /**\n * Quote attribute values\n * @param attr attribute value\n * @returns {string} quoted value\n */\n HTMLElement.prototype.quoteAttribute = function (attr) {\n if (attr == null) {\n return 'null';\n }\n return JSON.stringify(attr.replace(/\"/g, '"')).replace(/\\\\t/g, '\\t').replace(/\\\\n/g, '\\n').replace(/\\\\r/g, '\\r').replace(/\\\\/g, '');\n };\n /**\n * Remove Child element from childNodes array\n * @param {HTMLElement} node node to remove\n */\n HTMLElement.prototype.removeChild = function (node) {\n this.childNodes = this.childNodes.filter(function (child) {\n return child !== node;\n });\n return this;\n };\n /**\n * Exchanges given child with new child\n * @param {HTMLElement} oldNode node to exchange\n * @param {HTMLElement} newNode new node\n */\n HTMLElement.prototype.exchangeChild = function (oldNode, newNode) {\n var children = this.childNodes;\n this.childNodes = children.map(function (child) {\n if (child === oldNode) {\n return newNode;\n }\n return child;\n });\n return this;\n };\n Object.defineProperty(HTMLElement.prototype, \"tagName\", {\n get: function () {\n return this.rawTagName ? this.rawTagName.toUpperCase() : this.rawTagName;\n },\n set: function (newname) {\n this.rawTagName = newname.toLowerCase();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(HTMLElement.prototype, \"localName\", {\n get: function () {\n return this.rawTagName.toLowerCase();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(HTMLElement.prototype, \"isVoidElement\", {\n get: function () {\n return this.voidTag.isVoidElement(this.localName);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(HTMLElement.prototype, \"rawText\", {\n /**\n * Get escpaed (as-it) text value of current node and its children.\n * @return {string} text content\n */\n get: function () {\n // https://github.com/taoqf/node-html-parser/issues/249\n if (/^br$/i.test(this.rawTagName)) {\n return '\\n';\n }\n return this.childNodes.reduce(function (pre, cur) {\n return (pre += cur.rawText);\n }, '');\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(HTMLElement.prototype, \"textContent\", {\n get: function () {\n return decode(this.rawText);\n },\n set: function (val) {\n var content = [new text_1.default(val, this)];\n this.childNodes = content;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(HTMLElement.prototype, \"text\", {\n /**\n * Get unescaped text value of current node and its children.\n * @return {string} text content\n */\n get: function () {\n return decode(this.rawText);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(HTMLElement.prototype, \"structuredText\", {\n /**\n * Get structured Text (with '\\n' etc.)\n * @return {string} structured text\n */\n get: function () {\n var currentBlock = [];\n var blocks = [currentBlock];\n function dfs(node) {\n if (node.nodeType === type_1.default.ELEMENT_NODE) {\n if (kBlockElements.has(node.rawTagName)) {\n if (currentBlock.length > 0) {\n blocks.push((currentBlock = []));\n }\n node.childNodes.forEach(dfs);\n if (currentBlock.length > 0) {\n blocks.push((currentBlock = []));\n }\n }\n else {\n node.childNodes.forEach(dfs);\n }\n }\n else if (node.nodeType === type_1.default.TEXT_NODE) {\n if (node.isWhitespace) {\n // Whitespace node, postponed output\n currentBlock.prependWhitespace = true;\n }\n else {\n var text = node.trimmedText;\n if (currentBlock.prependWhitespace) {\n text = \" \".concat(text);\n currentBlock.prependWhitespace = false;\n }\n currentBlock.push(text);\n }\n }\n }\n dfs(this);\n return blocks\n .map(function (block) {\n return block.join('').replace(/\\s{2,}/g, ' '); // Normalize each line's whitespace\n })\n .join('\\n')\n .replace(/\\s+$/, ''); // trimRight;\n },\n enumerable: false,\n configurable: true\n });\n HTMLElement.prototype.toString = function () {\n var tag = this.rawTagName;\n if (tag) {\n var attrs = this.rawAttrs ? \" \".concat(this.rawAttrs) : '';\n return this.voidTag.formatNode(tag, attrs, this.innerHTML);\n }\n return this.innerHTML;\n };\n Object.defineProperty(HTMLElement.prototype, \"innerHTML\", {\n get: function () {\n return this.childNodes\n .map(function (child) {\n return child.toString();\n })\n .join('');\n },\n set: function (content) {\n var r = parse(content, this._parseOptions);\n var nodes = r.childNodes.length ? r.childNodes : [new text_1.default(content, this)];\n resetParent(nodes, this);\n resetParent(this.childNodes, null);\n this.childNodes = nodes;\n },\n enumerable: false,\n configurable: true\n });\n HTMLElement.prototype.set_content = function (content, options) {\n if (options === void 0) { options = {}; }\n if (content instanceof node_1.default) {\n content = [content];\n }\n else if (typeof content == 'string') {\n options = __assign(__assign({}, this._parseOptions), options);\n var r = parse(content, options);\n content = r.childNodes.length ? r.childNodes : [new text_1.default(r.innerHTML, this)];\n }\n resetParent(this.childNodes, null);\n resetParent(content, this);\n this.childNodes = content;\n return this;\n };\n HTMLElement.prototype.replaceWith = function () {\n var _this = this;\n var nodes = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n nodes[_i] = arguments[_i];\n }\n var parent = this.parentNode;\n var content = nodes\n .map(function (node) {\n if (node instanceof node_1.default) {\n return [node];\n }\n else if (typeof node == 'string') {\n var r = parse(node, _this._parseOptions);\n return r.childNodes.length ? r.childNodes : [new text_1.default(node, _this)];\n }\n return [];\n })\n .flat();\n var idx = parent.childNodes.findIndex(function (child) {\n return child === _this;\n });\n resetParent([this], null);\n parent.childNodes = __spreadArray(__spreadArray(__spreadArray([], parent.childNodes.slice(0, idx), true), resetParent(content, parent), true), parent.childNodes.slice(idx + 1), true);\n return this;\n };\n Object.defineProperty(HTMLElement.prototype, \"outerHTML\", {\n get: function () {\n return this.toString();\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Trim element from right (in block) after seeing pattern in a TextNode.\n * @param {RegExp} pattern pattern to find\n * @return {HTMLElement} reference to current node\n */\n HTMLElement.prototype.trimRight = function (pattern) {\n for (var i = 0; i < this.childNodes.length; i++) {\n var childNode = this.childNodes[i];\n if (childNode.nodeType === type_1.default.ELEMENT_NODE) {\n childNode.trimRight(pattern);\n }\n else {\n var index = childNode.rawText.search(pattern);\n if (index > -1) {\n childNode.rawText = childNode.rawText.substr(0, index);\n // trim all following nodes.\n this.childNodes.length = i + 1;\n }\n }\n }\n return this;\n };\n Object.defineProperty(HTMLElement.prototype, \"structure\", {\n /**\n * Get DOM structure\n * @return {string} structure\n */\n get: function () {\n var res = [];\n var indention = 0;\n function write(str) {\n res.push(' '.repeat(indention) + str);\n }\n function dfs(node) {\n var idStr = node.id ? \"#\".concat(node.id) : '';\n var classStr = node.classList.length ? \".\".concat(node.classList.value.join('.')) : ''; // eslint-disable-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-call\n write(\"\".concat(node.rawTagName).concat(idStr).concat(classStr));\n indention++;\n node.childNodes.forEach(function (childNode) {\n if (childNode.nodeType === type_1.default.ELEMENT_NODE) {\n dfs(childNode);\n }\n else if (childNode.nodeType === type_1.default.TEXT_NODE) {\n if (!childNode.isWhitespace) {\n write('#text');\n }\n }\n });\n indention--;\n }\n dfs(this);\n return res.join('\\n');\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Remove whitespaces in this sub tree.\n * @return {HTMLElement} pointer to this\n */\n HTMLElement.prototype.removeWhitespace = function () {\n var _this = this;\n var o = 0;\n this.childNodes.forEach(function (node) {\n if (node.nodeType === type_1.default.TEXT_NODE) {\n if (node.isWhitespace) {\n return;\n }\n node.rawText = node.trimmedRawText;\n }\n else if (node.nodeType === type_1.default.ELEMENT_NODE) {\n node.removeWhitespace();\n }\n _this.childNodes[o++] = node;\n });\n this.childNodes.length = o;\n return this;\n };\n /**\n * Query CSS selector to find matching nodes.\n * @param {string} selector Simplified CSS selector\n * @return {HTMLElement[]} matching elements\n */\n HTMLElement.prototype.querySelectorAll = function (selector) {\n return (0, css_select_1.selectAll)(selector, this, {\n xmlMode: true,\n adapter: matcher_1.default,\n });\n };\n /**\n * Query CSS Selector to find matching node.\n * @param {string} selector Simplified CSS selector\n * @return {(HTMLElement|null)} matching node\n */\n HTMLElement.prototype.querySelector = function (selector) {\n return (0, css_select_1.selectOne)(selector, this, {\n xmlMode: true,\n adapter: matcher_1.default,\n });\n };\n /**\n * find elements by their tagName\n * @param {string} tagName the tagName of the elements to select\n */\n HTMLElement.prototype.getElementsByTagName = function (tagName) {\n var upperCasedTagName = tagName.toUpperCase();\n var re = [];\n var stack = [];\n var currentNodeReference = this;\n var index = 0;\n // index turns to undefined once the stack is empty and the first condition occurs\n // which happens once all relevant children are searched through\n while (index !== undefined) {\n var child = void 0;\n // make it work with sparse arrays\n do {\n child = currentNodeReference.childNodes[index++];\n } while (index < currentNodeReference.childNodes.length && child === undefined);\n // if the child does not exist we move on with the last provided index (which belongs to the parentNode)\n if (child === undefined) {\n currentNodeReference = currentNodeReference.parentNode;\n index = stack.pop();\n continue;\n }\n if (child.nodeType === type_1.default.ELEMENT_NODE) {\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName#syntax\n if (tagName === '*' || child.tagName === upperCasedTagName)\n re.push(child);\n // if children are existing push the current status to the stack and keep searching for elements in the level below\n if (child.childNodes.length > 0) {\n stack.push(index);\n currentNodeReference = child;\n index = 0;\n }\n }\n }\n return re;\n };\n /**\n * find element by it's id\n * @param {string} id the id of the element to select\n * @returns {HTMLElement | null} the element with the given id or null if not found\n */\n HTMLElement.prototype.getElementById = function (id) {\n var stack = [];\n var currentNodeReference = this;\n var index = 0;\n // index turns to undefined once the stack is empty and the first condition occurs\n // which happens once all relevant children are searched through\n while (index !== undefined) {\n var child = void 0;\n // make it work with sparse arrays\n do {\n child = currentNodeReference.childNodes[index++];\n } while (index < currentNodeReference.childNodes.length && child === undefined);\n // if the child does not exist we move on with the last provided index (which belongs to the parentNode)\n if (child === undefined) {\n currentNodeReference = currentNodeReference.parentNode;\n index = stack.pop();\n continue;\n }\n if (child.nodeType === type_1.default.ELEMENT_NODE) {\n if (child.id === id) {\n return child;\n }\n ;\n // if children are existing push the current status to the stack and keep searching for elements in the level below\n if (child.childNodes.length > 0) {\n stack.push(index);\n currentNodeReference = child;\n index = 0;\n }\n }\n }\n return null;\n };\n /**\n * traverses the Element and its parents (heading toward the document root) until it finds a node that matches the provided selector string. Will return itself or the matching ancestor. If no such element exists, it returns null.\n * @param selector a DOMString containing a selector list\n * @returns {HTMLElement | null} the element with the given id or null if not found\n */\n HTMLElement.prototype.closest = function (selector) {\n var mapChild = new Map();\n var el = this;\n var old = null;\n function findOne(test, elems) {\n var elem = null;\n for (var i = 0, l = elems.length; i < l && !elem; i++) {\n var el_1 = elems[i];\n if (test(el_1)) {\n elem = el_1;\n }\n else {\n var child = mapChild.get(el_1);\n if (child) {\n elem = findOne(test, [child]);\n }\n }\n }\n return elem;\n }\n while (el) {\n mapChild.set(el, old);\n old = el;\n el = el.parentNode;\n }\n el = this;\n while (el) {\n var e = (0, css_select_1.selectOne)(selector, el, {\n xmlMode: true,\n adapter: __assign(__assign({}, matcher_1.default), { getChildren: function (node) {\n var child = mapChild.get(node);\n return child && [child];\n }, getSiblings: function (node) {\n return [node];\n }, findOne: findOne, findAll: function () {\n return [];\n } }),\n });\n if (e) {\n return e;\n }\n el = el.parentNode;\n }\n return null;\n };\n /**\n * Append a child node to childNodes\n * @param {Node} node node to append\n * @return {Node} node appended\n */\n HTMLElement.prototype.appendChild = function (node) {\n // remove the node from it's parent\n node.remove();\n this.childNodes.push(node);\n node.parentNode = this;\n return node;\n };\n Object.defineProperty(HTMLElement.prototype, \"firstChild\", {\n /**\n * Get first child node\n * @return {Node | undefined} first child node; or undefined if none\n */\n get: function () {\n return this.childNodes[0];\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(HTMLElement.prototype, \"lastChild\", {\n /**\n * Get last child node\n * @return {Node | undefined} last child node; or undefined if none\n */\n get: function () {\n return (0, back_1.default)(this.childNodes);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(HTMLElement.prototype, \"attrs\", {\n /**\n * Get attributes\n * @access private\n * @return {Object} parsed and unescaped attributes\n */\n get: function () {\n if (this._attrs) {\n return this._attrs;\n }\n this._attrs = {};\n var attrs = this.rawAttributes;\n for (var key in attrs) {\n var val = attrs[key] || '';\n this._attrs[key.toLowerCase()] = decode(val);\n }\n return this._attrs;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(HTMLElement.prototype, \"attributes\", {\n get: function () {\n var ret_attrs = {};\n var attrs = this.rawAttributes;\n for (var key in attrs) {\n var val = attrs[key] || '';\n ret_attrs[key] = decode(val);\n }\n return ret_attrs;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(HTMLElement.prototype, \"rawAttributes\", {\n /**\n * Get escaped (as-is) attributes\n * @return {Object} parsed attributes\n */\n get: function () {\n if (this._rawAttrs) {\n return this._rawAttrs;\n }\n var attrs = {};\n if (this.rawAttrs) {\n var re = /([a-zA-Z()[\\]#@$.?:][a-zA-Z0-9-_:()[\\]#]*)(?:\\s*=\\s*((?:'[^']*')|(?:\"[^\"]*\")|\\S+))?/g;\n var match = void 0;\n while ((match = re.exec(this.rawAttrs))) {\n var key = match[1];\n var val = match[2] || null;\n if (val && (val[0] === \"'\" || val[0] === \"\\\"\"))\n val = val.slice(1, val.length - 1);\n attrs[key] = attrs[key] || val;\n }\n }\n this._rawAttrs = attrs;\n return attrs;\n },\n enumerable: false,\n configurable: true\n });\n HTMLElement.prototype.removeAttribute = function (key) {\n var _this = this;\n var attrs = this.rawAttributes;\n delete attrs[key];\n // Update this.attribute\n if (this._attrs) {\n delete this._attrs[key];\n }\n // Update rawString\n this.rawAttrs = Object.keys(attrs)\n .map(function (name) {\n var val = _this.quoteAttribute(attrs[name]);\n if (val === 'null' || val === '\"\"')\n return name;\n return \"\".concat(name, \"=\").concat(val);\n })\n .join(' ');\n // Update this.id\n if (key === 'id') {\n this.id = '';\n }\n return this;\n };\n HTMLElement.prototype.hasAttribute = function (key) {\n return key.toLowerCase() in this.attrs;\n };\n /**\n * Get an attribute\n * @return {string | undefined} value of the attribute; or undefined if not exist\n */\n HTMLElement.prototype.getAttribute = function (key) {\n return this.attrs[key.toLowerCase()];\n };\n /**\n * Set an attribute value to the HTMLElement\n * @param {string} key The attribute name\n * @param {string} value The value to set, or null / undefined to remove an attribute\n */\n HTMLElement.prototype.setAttribute = function (key, value) {\n var _this = this;\n if (arguments.length < 2) {\n throw new Error(\"Failed to execute 'setAttribute' on 'Element'\");\n }\n var k2 = key.toLowerCase();\n var attrs = this.rawAttributes;\n for (var k in attrs) {\n if (k.toLowerCase() === k2) {\n key = k;\n break;\n }\n }\n attrs[key] = String(value);\n // update this.attrs\n if (this._attrs) {\n this._attrs[k2] = decode(attrs[key]);\n }\n // Update rawString\n this.rawAttrs = Object.keys(attrs)\n .map(function (name) {\n var val = _this.quoteAttribute(attrs[name]);\n if (val === 'null' || val === '\"\"')\n return name;\n return \"\".concat(name, \"=\").concat(val);\n })\n .join(' ');\n // Update this.id\n if (key === 'id') {\n this.id = value;\n }\n return this;\n };\n /**\n * Replace all the attributes of the HTMLElement by the provided attributes\n * @param {Attributes} attributes the new attribute set\n */\n HTMLElement.prototype.setAttributes = function (attributes) {\n var _this = this;\n // Invalidate current this.attributes\n if (this._attrs) {\n delete this._attrs;\n }\n // Invalidate current this.rawAttributes\n if (this._rawAttrs) {\n delete this._rawAttrs;\n }\n // Update rawString\n this.rawAttrs = Object.keys(attributes)\n .map(function (name) {\n var val = attributes[name];\n if (val === 'null' || val === '\"\"')\n return name;\n return \"\".concat(name, \"=\").concat(_this.quoteAttribute(String(val)));\n })\n .join(' ');\n return this;\n };\n HTMLElement.prototype.insertAdjacentHTML = function (where, html) {\n var _a, _b, _c;\n var _this = this;\n if (arguments.length < 2) {\n throw new Error('2 arguments required');\n }\n var p = parse(html, this._parseOptions);\n if (where === 'afterend') {\n var idx = this.parentNode.childNodes.findIndex(function (child) {\n return child === _this;\n });\n resetParent(p.childNodes, this.parentNode);\n (_a = this.parentNode.childNodes).splice.apply(_a, __spreadArray([idx + 1, 0], p.childNodes, false));\n }\n else if (where === 'afterbegin') {\n resetParent(p.childNodes, this);\n (_b = this.childNodes).unshift.apply(_b, p.childNodes);\n }\n else if (where === 'beforeend') {\n p.childNodes.forEach(function (n) {\n _this.appendChild(n);\n });\n }\n else if (where === 'beforebegin') {\n var idx = this.parentNode.childNodes.findIndex(function (child) {\n return child === _this;\n });\n resetParent(p.childNodes, this.parentNode);\n (_c = this.parentNode.childNodes).splice.apply(_c, __spreadArray([idx, 0], p.childNodes, false));\n }\n else {\n throw new Error(\"The value provided ('\".concat(where, \"') is not one of 'beforebegin', 'afterbegin', 'beforeend', or 'afterend'\"));\n }\n return this;\n // if (!where || html === undefined || html === null) {\n // \treturn;\n // }\n };\n Object.defineProperty(HTMLElement.prototype, \"nextSibling\", {\n get: function () {\n if (this.parentNode) {\n var children = this.parentNode.childNodes;\n var i = 0;\n while (i < children.length) {\n var child = children[i++];\n if (this === child)\n return children[i] || null;\n }\n return null;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(HTMLElement.prototype, \"nextElementSibling\", {\n get: function () {\n if (this.parentNode) {\n var children = this.parentNode.childNodes;\n var i = 0;\n var find = false;\n while (i < children.length) {\n var child = children[i++];\n if (find) {\n if (child instanceof HTMLElement) {\n return child || null;\n }\n }\n else if (this === child) {\n find = true;\n }\n }\n return null;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(HTMLElement.prototype, \"previousSibling\", {\n get: function () {\n if (this.parentNode) {\n var children = this.parentNode.childNodes;\n var i = children.length;\n while (i > 0) {\n var child = children[--i];\n if (this === child)\n return children[i - 1] || null;\n }\n return null;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(HTMLElement.prototype, \"previousElementSibling\", {\n get: function () {\n if (this.parentNode) {\n var children = this.parentNode.childNodes;\n var i = children.length;\n var find = false;\n while (i > 0) {\n var child = children[--i];\n if (find) {\n if (child instanceof HTMLElement) {\n return child || null;\n }\n }\n else if (this === child) {\n find = true;\n }\n }\n return null;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(HTMLElement.prototype, \"classNames\", {\n get: function () {\n return this.classList.toString();\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Clone this Node\n */\n HTMLElement.prototype.clone = function () {\n return parse(this.toString(), this._parseOptions).firstChild;\n };\n return HTMLElement;\n}(node_1.default));\nexports.default = HTMLElement;\n// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\nvar kMarkupPattern = /<!--[\\s\\S]*?-->|<(\\/?)([a-zA-Z][-.:0-9_a-zA-Z]*)((?:\\s+[^>]*?(?:(?:'[^']*')|(?:\"[^\"]*\"))?)*)\\s*(\\/?)>/g;\nvar kAttributePattern = /(?:^|\\s)(id|class)\\s*=\\s*((?:'[^']*')|(?:\"[^\"]*\")|\\S+)/gi;\nvar kElementsClosedByOpening = {\n li: { li: true, LI: true },\n LI: { li: true, LI: true },\n p: { p: true, div: true, P: true, DIV: true },\n P: { p: true, div: true, P: true, DIV: true },\n b: { div: true, DIV: true },\n B: { div: true, DIV: true },\n td: { td: true, th: true, TD: true, TH: true },\n TD: { td: true, th: true, TD: true, TH: true },\n th: { td: true, th: true, TD: true, TH: true },\n TH: { td: true, th: true, TD: true, TH: true },\n h1: { h1: true, H1: true },\n H1: { h1: true, H1: true },\n h2: { h2: true, H2: true },\n H2: { h2: true, H2: true },\n h3: { h3: true, H3: true },\n H3: { h3: true, H3: true },\n h4: { h4: true, H4: true },\n H4: { h4: true, H4: true },\n h5: { h5: true, H5: true },\n H5: { h5: true, H5: true },\n h6: { h6: true, H6: true },\n H6: { h6: true, H6: true },\n};\nvar kElementsClosedByClosing = {\n li: { ul: true, ol: true, UL: true, OL: true },\n LI: { ul: true, ol: true, UL: true, OL: true },\n a: { div: true, DIV: true },\n A: { div: true, DIV: true },\n b: { div: true, DIV: true },\n B: { div: true, DIV: true },\n i: { div: true, DIV: true },\n I: { div: true, DIV: true },\n p: { div: true, DIV: true },\n P: { div: true, DIV: true },\n td: { tr: true, table: true, TR: true, TABLE: true },\n TD: { tr: true, table: true, TR: true, TABLE: true },\n th: { tr: true, table: true, TR: true, TABLE: true },\n TH: { tr: true, table: true, TR: true, TABLE: true },\n};\nvar frameflag = 'documentfragmentcontainer';\n/**\n * Parses HTML and returns a root element\n * Parse a chuck of HTML source.\n * @param {string} data html\n * @return {HTMLElement} root element\n */\nfunction base_parse(data, options) {\n var _a, _b;\n if (options === void 0) { options = {}; }\n var voidTag = new void_tag_1.default((_a = options === null || options === void 0 ? void 0 : options.voidTag) === null || _a === void 0 ? void 0 : _a.closingSlash, (_b = options === null || options === void 0 ? void 0 : options.voidTag) === null || _b === void 0 ? void 0 : _b.tags);\n var elements = options.blockTextElements || {\n script: true,\n noscript: true,\n style: true,\n pre: true,\n };\n var element_names = Object.keys(elements);\n var kBlockTextElements = element_names.map(function (it) { return new RegExp(\"^\".concat(it, \"$\"), 'i'); });\n var kIgnoreElements = element_names.filter(function (it) { return Boolean(elements[it]); }).map(function (it) { return new RegExp(\"^\".concat(it, \"$\"), 'i'); });\n function element_should_be_ignore(tag) {\n return kIgnoreElements.some(function (it) { return it.test(tag); });\n }\n function is_block_text_element(tag) {\n return kBlockTextElements.some(function (it) { return it.test(tag); });\n }\n var createRange = function (startPos, endPos) { return [startPos - frameFlagOffset, endPos - frameFlagOffset]; };\n var root = new HTMLElement(null, {}, '', null, [0, data.length], voidTag, options);\n var currentParent = root;\n var stack = [root];\n var lastTextPos = -1;\n var noNestedTagIndex = undefined;\n var match;\n // https://github.com/taoqf/node-html-parser/issues/38\n data = \"<\".concat(frameflag, \">\").concat(data, \"</\").concat(frameflag, \">\");\n var lowerCaseTagName = options.lowerCaseTagName, fixNestedATags = options.fixNestedATags;\n var dataEndPos = data.length - (frameflag.length + 2);\n var frameFlagOffset = frameflag.length + 2;\n while ((match = kMarkupPattern.exec(data))) {\n // Note: Object destructuring here consistently tests as higher performance than array destructuring\n // eslint-disable-next-line prefer-const\n var matchText = match[0], leadingSlash = match[1], tagName = match[2], attributes = match[3], closingSlash = match[4];\n var matchLength = matchText.length;\n var tagStartPos = kMarkupPattern.lastIndex - matchLength;\n var tagEndPos = kMarkupPattern.lastIndex;\n // Add TextNode if content\n if (lastTextPos > -1) {\n if (lastTextPos + matchLength < tagEndPos) {\n var text = data.substring(lastTextPos, tagStartPos);\n currentParent.appendChild(new text_1.default(text, currentParent, createRange(lastTextPos, tagStartPos)));\n }\n }\n lastTextPos = kMarkupPattern.lastIndex;\n // https://github.com/taoqf/node-html-parser/issues/38\n // Skip frameflag node\n if (tagName === frameflag)\n continue;\n // Handle comments\n if (matchText[1] === '!') {\n if (options.comment) {\n // Only keep what is in between <!-- and -->\n var text = data.substring(tagStartPos + 4, tagEndPos - 3);\n currentParent.appendChild(new comment_1.default(text, currentParent, createRange(tagStartPos, tagEndPos)));\n }\n continue;\n }\n /* -- Handle tag matching -- */\n // Fix tag casing if necessary\n if (lowerCaseTagName)\n tagName = tagName.toLowerCase();\n // Handle opening tags (ie. <this> not </that>)\n if (!leadingSlash) {\n /* Populate attributes */\n var attrs = {};\n for (var attMatch = void 0; (attMatch = kAttributePattern.exec(attributes));) {\n var key = attMatch[1], val = attMatch[2];\n var isQuoted = val[0] === \"'\" || val[0] === \"\\\"\";\n attrs[key.toLowerCase()] = isQuoted ? val.slice(1, val.length - 1) : val;\n }\n var parentTagName = currentParent.rawTagName;\n if (!closingSlash && kElementsClosedByOpening[parentTagName]) {\n if (kElementsClosedByOpening[parentTagName][tagName]) {\n stack.pop();\n currentParent = (0, back_1.default)(stack);\n }\n }\n // Prevent nested A tags by terminating the last A and starting a new one : see issue #144\n if (fixNestedATags && (tagName === 'a' || tagName === 'A')) {\n if (noNestedTagIndex !== undefined) {\n stack.splice(noNestedTagIndex);\n currentParent = (0, back_1.default)(stack);\n }\n noNestedTagIndex = stack.length;\n }\n var tagEndPos_1 = kMarkupPattern.lastIndex;\n var tagStartPos_1 = tagEndPos_1 - matchLength;\n currentParent = currentParent.appendChild(\n // Initialize range (end position updated later for closed tags)\n new HTMLElement(tagName, attrs, attributes.slice(1), null, createRange(tagStartPos_1, tagEndPos_1), voidTag, options));\n stack.push(currentParent);\n if (is_block_text_element(tagName)) {\n // Find closing tag\n var closeMarkup = \"</\".concat(tagName, \">\");\n var closeIndex = lowerCaseTagName\n ? data.toLocaleLowerCase().indexOf(closeMarkup, kMarkupPattern.lastIndex)\n : data.indexOf(closeMarkup, kMarkupPattern.lastIndex);\n var textEndPos = closeIndex === -1 ? dataEndPos : closeIndex;\n if (element_should_be_ignore(tagName)) {\n var text = data.substring(tagEndPos_1, textEndPos);\n if (text.length > 0 && /\\S/.test(text)) {\n currentParent.appendChild(new text_1.default(text, currentParent, createRange(tagEndPos_1, textEndPos)));\n }\n }\n if (closeIndex === -1) {\n lastTextPos = kMarkupPattern.lastIndex = data.length + 1;\n }\n else {\n lastTextPos = kMarkupPattern.lastIndex = closeIndex + closeMarkup.length;\n // Cause to be treated as self-closing, because no close found\n leadingSlash = '/';\n }\n }\n }\n // Handle closing tags or self-closed elements (ie </tag> or <br>)\n if (leadingSlash || closingSlash || voidTag.isVoidElement(tagName)) {\n while (true) {\n if (noNestedTagIndex != null && (tagName === 'a' || tagName === 'A'))\n noNestedTagIndex = undefined;\n if (currentParent.rawTagName === tagName) {\n // Update range end for closed tag\n currentParent.range[1] = createRange(-1, Math.max(lastTextPos, tagEndPos))[1];\n stack.pop();\n currentParent = (0, back_1.default)(stack);\n break;\n }\n else {\n var parentTagName = currentParent.tagName;\n // Trying to close current tag, and move on\n if (kElementsClosedByClosing[parentTagName]) {\n if (kElementsClosedByClosing[parentTagName][tagName]) {\n stack.pop();\n currentParent = (0, back_1.default)(stack);\n continue;\n }\n }\n // Use aggressive strategy to handle unmatching markups.\n break;\n }\n }\n }\n }\n return stack;\n}\nexports.base_parse = base_parse;\n/**\n * Parses HTML and returns a root element\n * Parse a chuck of HTML source.\n */\nfunction parse(data, options) {\n if (options === void 0) { options = {}; }\n var stack = base_parse(data, options);\n var root = stack[0];\n var _loop_1 = function () {\n // Handle each error elements.\n var last = stack.pop();\n var oneBefore = (0, back_1.default)(stack);\n if (last.parentNode && last.parentNode.parentNode) {\n if (last.parentNode === oneBefore && last.tagName === oneBefore.tagName) {\n // Pair error case <h3> <h3> handle : Fixes to <h3> </h3>\n // this is wrong, becouse this will put the H3 outside the current right position which should be inside the current Html Element, see issue 152 for more info\n if (options.parseNoneClosedTags !== true) {\n oneBefore.removeChild(last);\n last.childNodes.forEach(function (child) {\n oneBefore.parentNode.appendChild(child);\n });\n stack.pop();\n }\n }\n else {\n // Single error <div> <h3> </div> handle: Just removes <h3>\n // Why remove? this is already a HtmlElement and the missing <H3> is already added in this case. see issue 152 for more info\n // eslint-disable-next-line no-lonely-if\n if (options.parseNoneClosedTags !== true) {\n oneBefore.removeChild(last);\n last.childNodes.forEach(function (child) {\n oneBefore.appendChild(child);\n });\n }\n }\n }\n else {\n // If it's final element just skip.\n }\n };\n while (stack.length > 1) {\n _loop_1();\n }\n // response.childNodes.forEach((node) => {\n // \tif (node instanceof HTMLElement) {\n // \t\tnode.parentNode = null;\n // \t}\n // });\n return root;\n}\nexports.parse = parse;\nfunction resetParent(nodes, parent) {\n return nodes.map(function (node) {\n node.parentNode = parent;\n return node;\n });\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = void 0;\nvar html_1 = require(\"./nodes/html\");\nObject.defineProperty(exports, \"default\", { enumerable: true, get: function () { return html_1.parse; } });\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar html_1 = require(\"./nodes/html\");\n/**\n * Parses HTML and returns a root element\n * Parse a chuck of HTML source.\n */\nfunction valid(data, options) {\n if (options === void 0) { options = {}; }\n var stack = (0, html_1.base_parse)(data, options);\n return Boolean(stack.length === 1);\n}\nexports.default = valid;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.NodeType = exports.TextNode = exports.Node = exports.valid = exports.CommentNode = exports.HTMLElement = exports.parse = void 0;\nvar comment_1 = __importDefault(require(\"./nodes/comment\"));\nexports.CommentNode = comment_1.default;\nvar html_1 = __importDefault(require(\"./nodes/html\"));\nexports.HTMLElement = html_1.default;\nvar node_1 = __importDefault(require(\"./nodes/node\"));\nexports.Node = node_1.default;\nvar text_1 = __importDefault(require(\"./nodes/text\"));\nexports.TextNode = text_1.default;\nvar type_1 = __importDefault(require(\"./nodes/type\"));\nexports.NodeType = type_1.default;\nvar parse_1 = __importDefault(require(\"./parse\"));\nvar valid_1 = __importDefault(require(\"./valid\"));\nexports.valid = valid_1.default;\nfunction parse(data, options) {\n if (options === void 0) { options = {}; }\n return (0, parse_1.default)(data, options);\n}\nexports.default = parse;\nexports.parse = parse;\nparse.parse = parse_1.default;\nparse.HTMLElement = html_1.default;\nparse.CommentNode = comment_1.default;\nparse.valid = valid_1.default;\nparse.Node = node_1.default;\nparse.TextNode = text_1.default;\nparse.NodeType = type_1.default;\n","export function joinPackagePath(...parts) {\n return parts.filter(Boolean).join('/');\n}\nexport function dirnamePackagePath(path) {\n const normalized = path.replaceAll('\\\\', '/');\n const index = normalized.lastIndexOf('/');\n return index === -1 ? '' : normalized.slice(0, index);\n}\nexport function resolvePackagePath(basePath, href) {\n return resolvePackagePathInternal(basePath, href).path;\n}\nexport function resolvePackagePathFromFile(baseHref, href) {\n return resolvePackagePath(dirnamePackagePath(baseHref), href);\n}\nexport function resolveCheckedPackagePath(basePath, href) {\n if (!isPackageRelativeHref(href))\n return null;\n const result = resolvePackagePathInternal(basePath, href, { rejectRootEscape: true });\n return result.escapedRoot ? null : result.path;\n}\nexport function resolveCheckedPackagePathFromFile(baseHref, href) {\n return resolveCheckedPackagePath(dirnamePackagePath(baseHref), href);\n}\nexport function isPackageRelativeHref(href) {\n const value = href.trim();\n return Boolean(value) && !value.startsWith('/') && !value.startsWith('//') && !/^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(value);\n}\nexport function isExternalPackageHref(href) {\n return /^(?:[a-z][a-z0-9+.-]*:|\\/\\/|#)/i.test(href);\n}\nfunction resolvePackagePathInternal(basePath, href, options = {}) {\n const raw = href.replaceAll('\\\\', '/');\n const combined = raw.startsWith('/') ? raw.slice(1) : joinPackagePath(basePath, raw);\n const normalized = [];\n let escapedRoot = false;\n for (const part of combined.split('/')) {\n if (!part || part === '.')\n continue;\n if (part === '..') {\n if (normalized.length === 0) {\n escapedRoot = true;\n if (options.rejectRootEscape)\n continue;\n }\n else {\n normalized.pop();\n }\n continue;\n }\n normalized.push(part);\n }\n return { path: normalized.join('/'), escapedRoot };\n}\n//# sourceMappingURL=package-path.js.map","import { parse } from 'node-html-parser';\nimport { isPackageRelativeHref, resolveCheckedPackagePathFromFile, resolvePackagePathFromFile, } from './package-path.js';\nconst STIMULUS_REF_TAGS = new Set(['assessmentstimulusref']);\nconst ASSESSMENT_STIMULUS_TAGS = new Set(['assessmentstimulus']);\nconst STIMULUS_BODY_TAGS = new Set(['stimulusbody']);\nconst STYLESHEET_TAGS = new Set(['stylesheet']);\nconst CATALOG_INFO_TAGS = new Set(['cataloginfo']);\nexport function extractAssessmentStimulusRefs(itemXml) {\n const refs = [];\n for (const el of findElements(parseXml(itemXml), STIMULUS_REF_TAGS)) {\n const identifier = readAttr(el, 'identifier');\n const href = readAttr(el, 'href');\n if (!identifier || !href)\n continue;\n refs.push({\n identifier,\n href,\n title: readAttr(el, 'title') ?? undefined,\n });\n }\n return refs;\n}\nexport function parseAssessmentStimulusXml(stimulusXml) {\n const root = parseXml(stimulusXml);\n const stimulus = findElements(root, ASSESSMENT_STIMULUS_TAGS)[0];\n const validationMessages = [];\n if (!stimulus) {\n validationMessages.push('Expected one qti-assessment-stimulus root element.');\n return { bodyHtml: '', stylesheets: [], validationMessages };\n }\n const bodyElements = directChildElements(stimulus).filter((child) => STIMULUS_BODY_TAGS.has(normalizeTag(child.tagName)));\n const catalogElements = directChildElements(stimulus).filter((child) => CATALOG_INFO_TAGS.has(normalizeTag(child.tagName)));\n const stylesheets = directChildElements(stimulus)\n .filter((child) => STYLESHEET_TAGS.has(normalizeTag(child.tagName)))\n .map(toStylesheetRef)\n .filter((style) => Boolean(style));\n if (bodyElements.length !== 1) {\n validationMessages.push('Expected exactly one qti-stimulus-body child element.');\n }\n if (catalogElements.length > 1) {\n validationMessages.push('Expected at most one qti-catalog-info child element.');\n }\n validateStimulusChildOrder(stimulus, validationMessages);\n return {\n identifier: readAttr(stimulus, 'identifier') ?? undefined,\n title: readAttr(stimulus, 'title') ?? undefined,\n lang: readAttr(stimulus, 'xml:lang') ?? readAttr(stimulus, 'lang') ?? undefined,\n bodyHtml: bodyElements[0] ? serializeChildren(bodyElements[0]).trim() : '',\n stylesheets,\n catalogInfoXml: catalogElements[0]?.toString(),\n validationMessages,\n };\n}\nexport function extractStimulusBodyHtml(stimulusXml) {\n return parseAssessmentStimulusXml(stimulusXml).bodyHtml;\n}\nexport function createResolvedItemDeliveryContext(options) {\n const itemHref = options.itemHref ?? '';\n const validationMessages = [];\n const stimuli = {};\n const catalogSources = [];\n const stylesheets = resolveStylesheetRefs(extractQtiStylesheets(options.itemXml), itemHref, 'item', validationMessages, options.readText);\n for (const itemCatalogXml of extractCatalogInfoXml(options.itemXml)) {\n catalogSources.push({ scope: 'item', xml: resolveCatalogFileHrefs(itemCatalogXml, itemHref), baseHref: itemHref });\n }\n for (const ref of extractAssessmentStimulusRefs(options.itemXml)) {\n const resolvedHref = resolvePackageHref(itemHref, ref.href, validationMessages, `Stimulus ${ref.identifier}`);\n if (!resolvedHref)\n continue;\n const stimulusXml = options.readText(resolvedHref);\n if (!stimulusXml) {\n validationMessages.push(`Stimulus file not found: ${resolvedHref}.`);\n continue;\n }\n const parsed = parseAssessmentStimulusXml(stimulusXml);\n const stimulusMessages = parsed.validationMessages.map((message) => `${ref.identifier}: ${message}`);\n validationMessages.push(...stimulusMessages);\n const bodyHtml = options.resolveAssetUrl\n ? rewriteHtmlAssetRefs(parsed.bodyHtml, resolvedHref, options.resolveAssetUrl)\n : parsed.bodyHtml;\n const stimulusStylesheets = resolveStylesheetRefs(parsed.stylesheets, resolvedHref, 'stimulus', validationMessages, options.readText, ref.identifier);\n const catalogSource = parsed.catalogInfoXml\n ? {\n scope: 'stimulus',\n xml: resolveCatalogFileHrefs(parsed.catalogInfoXml, resolvedHref),\n baseHref: resolvedHref,\n stimulusIdentifier: ref.identifier,\n }\n : undefined;\n if (catalogSource) {\n catalogSources.push(catalogSource);\n }\n stylesheets.push(...stimulusStylesheets);\n stimuli[ref.identifier] = {\n identifier: ref.identifier,\n href: ref.href,\n resolvedHref,\n title: ref.title ?? parsed.title,\n lang: parsed.lang,\n bodyHtml,\n stylesheets: stimulusStylesheets,\n catalogSource,\n validationMessages: stimulusMessages,\n };\n }\n return {\n itemHref: options.itemHref,\n stimuli,\n stylesheets,\n catalogSources,\n validationMessages,\n };\n}\nexport function extractQtiStylesheets(xml) {\n return findElements(parseXml(xml), STYLESHEET_TAGS)\n .map(toStylesheetRef)\n .filter((style) => Boolean(style));\n}\nexport function extractCatalogInfoXml(xml) {\n return findElements(parseXml(xml), CATALOG_INFO_TAGS).map((el) => el.toString());\n}\nexport function resolveRelativePath(baseHref, relativePath) {\n return resolvePackagePathFromFile(baseHref, relativePath);\n}\nfunction resolveCheckedPackagePath(baseHref, href) {\n if (!isPackageRelativeHref(href))\n return null;\n return resolveCheckedPackagePathFromFile(baseHref, href);\n}\nfunction resolvePackageHref(baseHref, href, validationMessages, label) {\n if (!isPackageRelativeHref(href)) {\n validationMessages.push(`${label} href is not a package-relative path: ${href}.`);\n return null;\n }\n const resolved = resolveCheckedPackagePath(baseHref, href);\n if (!resolved) {\n validationMessages.push(`${label} href escapes the package root: ${href}.`);\n return null;\n }\n return resolved;\n}\nfunction resolveStylesheetRefs(stylesheets, baseHref, source, validationMessages, readText, stimulusIdentifier) {\n const resolved = [];\n for (const style of stylesheets) {\n const resolvedHref = resolvePackageHref(baseHref, style.href, validationMessages, `${source === 'item' ? 'Item' : `Stimulus ${stimulusIdentifier ?? ''}`} stylesheet`);\n if (!resolvedHref)\n continue;\n const cssText = readText ? readText(resolvedHref) : undefined;\n const safeCssText = cssText === undefined || cssText === null\n ? undefined\n : sanitizeStylesheetCss(cssText, validationMessages, resolvedHref);\n resolved.push({\n ...style,\n resolvedHref,\n source,\n stimulusIdentifier,\n ...(safeCssText ? { cssText: safeCssText } : {}),\n });\n }\n return resolved;\n}\nfunction sanitizeStylesheetCss(css, validationMessages, resolvedHref) {\n if (!css.trim())\n return '';\n const blockedPattern = /@import\\b|url\\s*\\(|<\\/style|expression\\s*\\(|javascript\\s*:|vbscript\\s*:|data\\s*:/i;\n if (blockedPattern.test(css)) {\n validationMessages.push(`Stylesheet blocked by policy: ${resolvedHref}.`);\n return null;\n }\n return css;\n}\nfunction rewriteHtmlAssetRefs(html, baseHref, resolveAssetUrl) {\n if (!html.trim())\n return html;\n const root = parse(`<root>${html}</root>`, {\n comment: false,\n lowerCaseTagName: false,\n });\n const wrapper = root.querySelector('root') ?? root;\n for (const el of findElements(wrapper, new Set(['img', 'audio', 'video', 'source', 'track', 'object', 'embed', 'a']))) {\n for (const attr of ['src', 'href', 'data', 'poster']) {\n const raw = readAttr(el, attr);\n if (!raw || raw.trim().startsWith('#'))\n continue;\n const resolvedPath = resolveCheckedPackagePath(baseHref, raw);\n if (!resolvedPath) {\n el.removeAttribute(attr);\n continue;\n }\n const resolvedUrl = resolveAssetUrl(resolvedPath);\n if (resolvedUrl) {\n el.setAttribute(attr, resolvedUrl);\n }\n else {\n el.removeAttribute(attr);\n }\n }\n const srcset = readAttr(el, 'srcset');\n if (srcset) {\n const rewritten = rewriteSrcset(srcset, baseHref, resolveAssetUrl);\n if (rewritten)\n el.setAttribute('srcset', rewritten);\n else\n el.removeAttribute('srcset');\n }\n }\n return serializeChildren(wrapper);\n}\nfunction rewriteSrcset(value, baseHref, resolveAssetUrl) {\n const rewritten = [];\n for (const candidate of value.split(',').map((part) => part.trim()).filter(Boolean)) {\n const [rawUrl, ...descriptors] = candidate.split(/\\s+/).filter(Boolean);\n if (!rawUrl)\n return null;\n const resolvedPath = resolveCheckedPackagePath(baseHref, rawUrl);\n if (!resolvedPath)\n return null;\n const resolvedUrl = resolveAssetUrl(resolvedPath);\n if (!resolvedUrl)\n return null;\n rewritten.push([resolvedUrl, ...descriptors].join(' '));\n }\n return rewritten.length > 0 ? rewritten.join(', ') : null;\n}\nfunction resolveCatalogFileHrefs(xml, baseHref) {\n if (!xml.trim())\n return xml;\n const root = parse(`<root>${xml}</root>`, {\n comment: false,\n lowerCaseTagName: false,\n });\n const wrapper = root.querySelector('root') ?? root;\n for (const fileHref of findElements(wrapper, new Set(['filehref']))) {\n const raw = readAttr(fileHref, 'src') ?? fileHref.text?.trim() ?? '';\n const resolvedPath = resolveCheckedPackagePath(baseHref, raw);\n if (resolvedPath) {\n fileHref.setAttribute('src', resolvedPath);\n }\n else {\n fileHref.removeAttribute('src');\n }\n clearElementContent(fileHref);\n }\n return serializeChildren(wrapper);\n}\nfunction clearElementContent(el) {\n const mutable = el;\n if (typeof mutable.set_content === 'function') {\n mutable.set_content('');\n return;\n }\n mutable.innerHTML = '';\n mutable.textContent = '';\n}\nfunction parseXml(xml) {\n return parse(xml, {\n comment: false,\n lowerCaseTagName: false,\n });\n}\nfunction findElements(root, normalizedTags) {\n const matches = [];\n visit(root, (node) => {\n if (normalizedTags.has(normalizeTag(node.tagName))) {\n matches.push(node);\n }\n });\n return matches;\n}\nfunction visit(node, callback) {\n if (isElement(node)) {\n callback(node);\n }\n for (const child of node.childNodes ?? []) {\n visit(child, callback);\n }\n}\nfunction directChildElements(el) {\n return (el.childNodes ?? []).filter(isElement);\n}\nfunction isElement(node) {\n return typeof node.tagName === 'string';\n}\nfunction normalizeTag(tagName) {\n return tagName.toLowerCase().replace(/^qti-/, '').replace(/-([a-z])/g, (_match, char) => char);\n}\nfunction readAttr(el, name) {\n const direct = el.getAttribute(name);\n if (direct !== undefined)\n return direct;\n const kebabName = name.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);\n const kebab = el.getAttribute(kebabName);\n return kebab === undefined ? null : kebab;\n}\nfunction serializeChildren(el) {\n return (el.childNodes ?? []).map((child) => child.toString()).join('');\n}\nfunction toStylesheetRef(el) {\n const href = readAttr(el, 'href');\n if (!href)\n return null;\n return {\n href,\n type: readAttr(el, 'type') ?? undefined,\n media: readAttr(el, 'media') ?? undefined,\n xml: el.toString(),\n };\n}\nfunction validateStimulusChildOrder(stimulus, validationMessages) {\n let seenBody = false;\n let seenCatalog = false;\n for (const child of directChildElements(stimulus)) {\n const tag = normalizeTag(child.tagName);\n if (STYLESHEET_TAGS.has(tag)) {\n if (seenBody || seenCatalog) {\n validationMessages.push('qti-stylesheet must precede qti-stimulus-body and qti-catalog-info.');\n }\n continue;\n }\n if (STIMULUS_BODY_TAGS.has(tag)) {\n if (seenCatalog) {\n validationMessages.push('qti-stimulus-body must precede qti-catalog-info.');\n }\n seenBody = true;\n continue;\n }\n if (CATALOG_INFO_TAGS.has(tag)) {\n seenCatalog = true;\n continue;\n }\n validationMessages.push(`Unexpected qti-assessment-stimulus child element: ${child.tagName}.`);\n }\n}\n//# sourceMappingURL=qti3-shared-content.js.map","import { Player } from '@pie-qti/item-player';\nexport function getAssessmentItemIdentifier(itemXml) {\n const identifierMatch = itemXml.match(/assessmentItem[^>]+identifier=[\"']([^\"']+)[\"']/);\n return identifierMatch?.[1] || 'unknown';\n}\n/**\n * Runs QTI ResponseProcessing for one AssessmentItem and normalizes the result\n * to the BackendAdapter scoring shape used by AssessmentPlayer.\n */\nexport function scoreAssessmentItem({ itemXml, responses, itemSession, }) {\n const itemIdentifier = getAssessmentItemIdentifier(itemXml);\n try {\n // Use a scorer-grade view of the item for accurate scoring.\n // NOTE: This reference scorer is intentionally insecure and runs client-side.\n // In production, scoring must happen server-side with secured item content.\n const player = new Player({\n itemXml,\n role: 'scorer',\n });\n if (itemSession) {\n player.restoreItemSession(itemSession);\n }\n player.setResponses(responses);\n const result = itemSession ? (player.scoreAttempt().scoring ?? player.processResponses()) : player.processResponses();\n return {\n itemIdentifier,\n score: result.score,\n maxScore: result.maxScore,\n completed: result.completed,\n outcomeValues: result.outcomeValues,\n };\n }\n catch (error) {\n console.error('Scoring error:', error);\n return {\n itemIdentifier,\n score: 0,\n maxScore: 1,\n completed: false,\n outcomeValues: {},\n };\n }\n}\n//# sourceMappingURL=assessment-item-scorer.js.map","/**\n * Reference Backend Adapter - localStorage Implementation\n *\n * This is a REFERENCE IMPLEMENTATION demonstrating the BackendAdapter contract.\n * It uses localStorage for persistence and performs scoring CLIENT-SIDE.\n *\n * ## Security Warning\n *\n * This implementation is INSECURE for production use because:\n * - Scoring is done client-side (can be manipulated)\n * - QTI XML with correct answers is stored in client\n * - No authentication or authorization checks\n *\n * ## Purpose\n *\n * This adapter serves as:\n * 1. Reference implementation showing the API contract\n * 2. Development/demo tool for offline testing\n * 3. Template for building secure backend adapters\n *\n * ## Production Use\n *\n * Replace this with a real backend adapter that:\n * - Stores QTI XML server-side\n * - Performs scoring server-side\n * - Validates all requests with authentication\n * - Filters sensitive data based on role\n */\nimport { buildExpression, buildOutcomeProcessingAst, DeclarationContext, evalExpr, execProgram, OperatorRegistry, parseXml, serializeXml, qtiNull, qtiValue, } from '@pie-qti/qti-processing';\nimport { createResolvedItemDeliveryContext, extractAssessmentStimulusRefs, resolveRelativePath as resolveQtiRelativePath, } from '@pie-qti/ims-cp-core';\nimport { scoreAssessmentItem } from './assessment-item-scorer.js';\n/**\n * Storage key prefix for localStorage\n */\nconst STORAGE_PREFIX = 'qti_session_';\n/**\n * Cache key for item bank queries\n */\nconst BANK_CACHE_PREFIX = 'qti_bank_cache_';\nfunction toCanonicalQtiName(name) {\n const withoutPrefix = (name ?? '').replace(/^qti-/, '');\n return withoutPrefix.replace(/-([a-z])/g, (_, char) => char.toUpperCase());\n}\nconst qtiElementNameMapper = {\n version: 'qti2x-or-qti3',\n toCanonical: (elementName) => toCanonicalQtiName(elementName).toLowerCase(),\n toNative: (canonicalName) => canonicalName,\n isValidElementName: () => true,\n};\n/**\n * Reference Backend Adapter using localStorage\n *\n * @example\n * ```typescript\n * const adapter = new ReferenceBackendAdapter();\n * const response = await adapter.initSession({\n * assessmentId: 'test-001',\n * candidateId: 'student-123'\n * });\n * ```\n */\nexport class ReferenceBackendAdapter {\n constructor() {\n this.registeredAssessments = new Map();\n }\n /**\n * Register/override a client-provided assessment structure for a given assessmentId.\n *\n * This is useful for demos or web-components that supply assessment XML directly.\n * Security: this remains a reference/demo adapter; production backends should not\n * accept client-authored assessments.\n */\n registerAssessment(assessmentId, assessment) {\n this.registeredAssessments.set(assessmentId, assessment);\n }\n getAssessment(assessmentId) {\n return this.registeredAssessments.get(assessmentId) ?? this.createDemoAssessment(assessmentId);\n }\n hasAnyResponse(responses) {\n for (const value of Object.values(responses)) {\n if (value == null)\n continue;\n if (Array.isArray(value)) {\n if (value.length > 0)\n return true;\n continue;\n }\n if (typeof value === 'string') {\n if (value.trim().length > 0)\n return true;\n continue;\n }\n return true;\n }\n return false;\n }\n /**\n * Initialize a new assessment session\n */\n async initSession(request) {\n // Check if resuming existing session\n if (request.resumeSessionId) {\n const stored = this.loadSession(request.resumeSessionId);\n if (stored) {\n return {\n sessionId: stored.sessionId,\n assessment: stored.assessment,\n restoredState: stored.state,\n };\n }\n }\n // Create new session\n const sessionId = this.generateSessionId(request.assessmentId, request.candidateId);\n // In a real backend, you would:\n // 1. Fetch assessment from database\n // 2. Filter QTI XML based on role\n // 3. Remove responseProcessing for candidates\n //\n // For reference implementation, we'll use demo data\n const assessment = this.getAssessment(request.assessmentId);\n const state = {\n currentItemIdentifier: assessment.testParts[0].sections[0].assessmentItemRefs[0].identifier,\n visitedItems: [],\n itemResponses: {},\n itemScores: {},\n itemSessions: {},\n timing: {\n startedAt: Date.now(),\n itemTimes: {},\n totalTime: 0,\n },\n };\n const session = {\n sessionId,\n assessmentId: request.assessmentId,\n candidateId: request.candidateId,\n assessment,\n state,\n createdAt: Date.now(),\n finalized: false,\n };\n this.saveSession(session);\n return {\n sessionId,\n assessment,\n };\n }\n /**\n * Submit responses and get scoring result\n */\n async submitResponses(request) {\n const session = this.loadSession(request.sessionId);\n if (!session) {\n return {\n success: false,\n error: 'Session not found',\n };\n }\n if (session.finalized) {\n return {\n success: false,\n error: 'Session already finalized',\n };\n }\n const receivedAt = Date.now();\n const assessmentLimit = session.assessment.timeLimits;\n const effectiveAssessmentLimitSeconds = request.timing?.scope === 'assessment' && request.timing.limitSeconds !== undefined\n ? request.timing.limitSeconds\n : assessmentLimit?.maxTime;\n const assessmentAllowsLate = assessmentLimit?.allowLateSubmission ?? request.timing?.allowLateSubmission;\n if (effectiveAssessmentLimitSeconds !== undefined &&\n assessmentAllowsLate !== true &&\n receivedAt - session.createdAt > effectiveAssessmentLimitSeconds * 1000) {\n return {\n success: false,\n error: 'Assessment time limit expired',\n };\n }\n const evidenceExpired = request.timing?.limitSeconds !== undefined &&\n request.timing.elapsedMs >= request.timing.limitSeconds * 1000;\n if (evidenceExpired && request.timing?.allowLateSubmission !== true) {\n return {\n success: false,\n error: 'Time limit expired',\n };\n }\n // Find the item XML\n const itemXml = this.findItemXml(session.assessment, request.itemIdentifier);\n if (!itemXml) {\n return {\n success: false,\n error: 'Item not found',\n };\n }\n // **SECURITY WARNING**: Client-side scoring is INSECURE\n // In production, this MUST be done server-side\n const result = scoreAssessmentItem({ itemXml, responses: request.responses, itemSession: request.itemSession });\n // Store responses and result\n session.state.itemResponses[request.itemIdentifier] = request.responses;\n if (!session.state.itemScores) {\n session.state.itemScores = {};\n }\n session.state.itemScores[request.itemIdentifier] = result;\n if (request.itemSession) {\n session.state.itemSessions = {\n ...(session.state.itemSessions ?? {}),\n [request.itemIdentifier]: request.itemSession,\n };\n }\n const previousItemSession = session.state.itemSessionStates?.[request.itemIdentifier];\n session.state.itemSessionStates = {\n ...(session.state.itemSessionStates ?? {}),\n [request.itemIdentifier]: {\n itemIdentifier: request.itemIdentifier,\n attemptCount: (previousItemSession?.attemptCount ?? 0) + 1,\n isAnswered: this.hasAnyResponse(request.responses),\n isSubmitted: true,\n lastSubmissionTime: request.submittedAt,\n },\n };\n // Update timing\n if (request.timeSpent) {\n session.state.timing.itemTimes[request.itemIdentifier] = request.timeSpent;\n }\n // Add to visited items if not already there\n if (!session.state.visitedItems.includes(request.itemIdentifier)) {\n session.state.visitedItems.push(request.itemIdentifier);\n }\n this.saveSession(session);\n const order = this.getItemOrder(session.assessment);\n const idx = order.indexOf(request.itemIdentifier);\n let nextItemIdentifier = idx >= 0 ? order[idx + 1] : undefined;\n // QTI branchRule evaluation (backend-authoritative).\n // Evaluate each rule in order; the first matching rule determines the next item.\n // Special targets EXIT_TEST / EXIT_TESTPART / EXIT_SECTION are returned as-is for\n // the client to interpret.\n const itemRef = this.findItemRef(session.assessment, request.itemIdentifier);\n if (itemRef?.branchRule && itemRef.branchRule.length > 0) {\n const outcomeVars = {\n ...result.outcomeValues,\n SCORE: result.score,\n };\n nextItemIdentifier = undefined; // reset — branch rules take full control\n for (const rule of itemRef.branchRule) {\n const matches = rule.conditionXml\n ? this.evaluateConditionXml(rule.conditionXml, outcomeVars)\n : true; // unconditional branch\n if (matches) {\n nextItemIdentifier = rule.target;\n break;\n }\n }\n }\n return {\n success: true,\n result,\n nextItemIdentifier,\n updatedState: session.state,\n };\n }\n /**\n * Save session state (for auto-save)\n */\n async saveState(request) {\n const session = this.loadSession(request.sessionId);\n if (!session) {\n return {\n success: false,\n savedAt: Date.now(),\n };\n }\n // Update state\n session.state = request.state;\n this.saveSession(session);\n return {\n success: true,\n savedAt: Date.now(),\n };\n }\n /**\n * Finalize assessment and compute final scores\n */\n async finalizeAssessment(request) {\n const session = this.loadSession(request.sessionId);\n if (!session) {\n return {\n success: false,\n totalScore: 0,\n maxScore: 0,\n itemScores: {},\n finalizedAt: Date.now(),\n };\n }\n // Mark as finalized\n session.finalized = true;\n this.saveSession(session);\n // Compute total score\n const itemScores = session.state.itemScores || {};\n const fallbackTotal = Object.values(itemScores).reduce((sum, result) => sum + result.score, 0);\n const maxScore = Object.values(itemScores).reduce((sum, result) => sum + result.maxScore, 0);\n // Execute test-level outcome processing if available\n const outcomes = this.runOutcomeProcessing(session.assessment, itemScores);\n const totalScore = outcomes !== null ? (outcomes['SCORE_TOTAL'] ?? outcomes['SCORE'] ?? fallbackTotal) : fallbackTotal;\n return {\n success: true,\n totalScore,\n maxScore,\n itemScores,\n finalizedAt: Date.now(),\n };\n }\n /**\n * Execute test-level outcome processing (T9/T1).\n * Returns a map of outcome variable values, or null if no outcomeProcessing is defined.\n */\n runOutcomeProcessing(assessment, itemScores) {\n if (!assessment.outcomeProcessingXml) {\n return null;\n }\n try {\n // Build declaration map from outcomeDeclarations\n const decls = {};\n for (const d of assessment.outcomeDeclarations || []) {\n const baseType = d.baseType;\n const cardinality = d.cardinality;\n let defaultQtiValue;\n if (d.defaultValue !== undefined) {\n defaultQtiValue = qtiValue(baseType, cardinality, d.defaultValue);\n }\n else if (baseType === 'float' || baseType === 'integer') {\n defaultQtiValue = qtiValue(baseType, 'single', 0);\n }\n else {\n defaultQtiValue = qtiNull();\n }\n decls[d.identifier] = {\n identifier: d.identifier,\n baseType,\n cardinality,\n defaultValue: defaultQtiValue,\n value: { ...defaultQtiValue },\n };\n }\n const ctx = new DeclarationContext(decls);\n const ops = new OperatorRegistry();\n // Build test items array for testVariables expression\n const testItems = Object.entries(itemScores).map(([id, scoring]) => ({\n identifier: id,\n variables: {\n SCORE: qtiValue('float', 'single', scoring.score),\n // Add any other outcome values from the scoring result\n ...Object.fromEntries(Object.entries(scoring.outcomeValues || {}).map(([k, v]) => [\n k,\n typeof v === 'number'\n ? qtiValue('float', 'single', v)\n : qtiValue('string', 'single', String(v)),\n ])),\n },\n }));\n // Parse and execute outcome processing\n const opEl = parseXml(assessment.outcomeProcessingXml).documentElement;\n if (!opEl)\n return null;\n const program = buildOutcomeProcessingAst(opEl, {\n scope: 'test',\n elementNameMapper: qtiElementNameMapper,\n });\n execProgram({\n ctx,\n ops,\n rng: Math.random,\n test: { items: testItems },\n }, program);\n // Extract outcome values\n const result = {};\n for (const d of assessment.outcomeDeclarations || []) {\n const v = ctx.getValue(d.identifier);\n if (v.kind === 'value') {\n result[d.identifier] = v.value;\n }\n }\n return result;\n }\n catch (err) {\n console.warn('[ReferenceBackendAdapter] outcomeProcessing failed:', err);\n return null;\n }\n }\n /**\n * Resume existing session (alias for initSession with resumeSessionId)\n */\n async resumeSession(sessionId) {\n return this.initSession({\n assessmentId: '',\n candidateId: '',\n resumeSessionId: sessionId,\n });\n }\n /**\n * Query item bank for random item selection\n *\n * This reference implementation:\n * - Caches bank queries to avoid repeated calls\n * - Implements retry logic with exponential backoff\n * - Returns demo items (in production, fetch from real item bank)\n *\n * @param request - Item bank query request\n * @returns Selected items from bank\n */\n async queryItemBank(request) {\n const { sessionId, bankId, count, withReplacement, filters } = request;\n // Validate session exists\n const session = this.loadSession(sessionId);\n if (!session) {\n throw new Error(`Session not found: ${sessionId}`);\n }\n // Check cache first\n const cacheKey = this.getBankCacheKey(sessionId, bankId, count, withReplacement, filters);\n const cached = this.loadBankCache(cacheKey);\n if (cached) {\n return {\n items: cached.items,\n selectedAt: cached.timestamp,\n };\n }\n // Simulate network call with retry logic\n const items = await this.fetchItemsFromBank(bankId, count, withReplacement, filters);\n // Cache the result (5 minute TTL)\n this.saveBankCache(cacheKey, {\n items,\n timestamp: Date.now(),\n ttl: 5 * 60 * 1000, // 5 minutes\n });\n return {\n items,\n selectedAt: Date.now(),\n };\n }\n // =========================================================================\n // PRIVATE HELPERS\n // =========================================================================\n generateSessionId(assessmentId, candidateId) {\n return `${assessmentId}:${candidateId}:${Date.now()}`;\n }\n loadSession(sessionId) {\n try {\n const key = STORAGE_PREFIX + sessionId;\n const data = localStorage.getItem(key);\n if (!data)\n return null;\n return JSON.parse(data);\n }\n catch {\n return null;\n }\n }\n saveSession(session) {\n try {\n const key = STORAGE_PREFIX + session.sessionId;\n localStorage.setItem(key, JSON.stringify(session));\n }\n catch (error) {\n console.error('Failed to save session to localStorage:', error);\n }\n }\n findItemXml(assessment, itemIdentifier) {\n for (const part of assessment.testParts) {\n for (const section of part.sections) {\n for (const item of section.assessmentItemRefs) {\n if (item.identifier === itemIdentifier) {\n return item.itemXml;\n }\n }\n }\n }\n return null;\n }\n findItemRef(assessment, itemIdentifier) {\n for (const part of assessment.testParts) {\n for (const section of part.sections) {\n for (const item of section.assessmentItemRefs) {\n if (item.identifier === itemIdentifier) {\n return item;\n }\n }\n }\n }\n return null;\n }\n /**\n * Create demo assessment for testing\n *\n * In production, this would fetch from database\n */\n createDemoAssessment(assessmentId) {\n // This is a minimal demo assessment\n // In production, load from database and filter based on role\n return {\n identifier: assessmentId,\n title: 'Demo Assessment',\n navigationMode: 'nonlinear',\n submissionMode: 'simultaneous',\n testParts: [\n {\n identifier: 'part1',\n rubricBlocks: [],\n itemSessionControl: {\n maxAttempts: 1,\n showFeedback: true,\n allowReview: true,\n showSolution: false,\n allowComment: false,\n allowSkipping: true,\n validateResponses: true,\n },\n sections: [\n {\n identifier: 'section1',\n title: 'Section 1',\n visible: true,\n assessmentItemRefs: [\n {\n identifier: 'item1',\n role: 'candidate',\n // In production, load from database\n // For candidates, responseProcessing should be removed server-side\n itemXml: `<assessmentItem identifier=\"item1\" title=\"Sample Item\" adaptive=\"false\" timeDependent=\"false\">\n <responseDeclaration identifier=\"RESPONSE\" cardinality=\"single\" baseType=\"identifier\">\n <correctResponse>\n <value>A</value>\n </correctResponse>\n </responseDeclaration>\n <outcomeDeclaration identifier=\"SCORE\" cardinality=\"single\" baseType=\"float\">\n <defaultValue>\n <value>0</value>\n </defaultValue>\n </outcomeDeclaration>\n <itemBody>\n <p>What is 2 + 2?</p>\n <choiceInteraction responseIdentifier=\"RESPONSE\" shuffle=\"false\" maxChoices=\"1\">\n <simpleChoice identifier=\"A\">4</simpleChoice>\n <simpleChoice identifier=\"B\">3</simpleChoice>\n <simpleChoice identifier=\"C\">5</simpleChoice>\n </choiceInteraction>\n </itemBody>\n <responseProcessing>\n <responseCondition>\n <responseIf>\n <match>\n <variable identifier=\"RESPONSE\" />\n <correct identifier=\"RESPONSE\" />\n </match>\n <setOutcomeValue identifier=\"SCORE\">\n <baseValue baseType=\"float\">1</baseValue>\n </setOutcomeValue>\n </responseIf>\n <responseElse>\n <setOutcomeValue identifier=\"SCORE\">\n <baseValue baseType=\"float\">0</baseValue>\n </setOutcomeValue>\n </responseElse>\n </responseCondition>\n </responseProcessing>\n</assessmentItem>`,\n },\n {\n identifier: 'item2',\n role: 'candidate',\n itemXml: `<assessmentItem identifier=\"item2\" title=\"Follow-up Item\" adaptive=\"false\" timeDependent=\"false\">\n <responseDeclaration identifier=\"RESPONSE\" cardinality=\"single\" baseType=\"identifier\">\n <correctResponse>\n <value>A</value>\n </correctResponse>\n </responseDeclaration>\n <outcomeDeclaration identifier=\"SCORE\" cardinality=\"single\" baseType=\"float\">\n <defaultValue>\n <value>0</value>\n </defaultValue>\n </outcomeDeclaration>\n <itemBody>\n <p>Demo follow-up item</p>\n <choiceInteraction responseIdentifier=\"RESPONSE\" shuffle=\"false\" maxChoices=\"1\">\n <simpleChoice identifier=\"A\">ok</simpleChoice>\n <simpleChoice identifier=\"B\">no</simpleChoice>\n </choiceInteraction>\n </itemBody>\n <responseProcessing>\n <responseCondition>\n <responseIf>\n <match>\n <variable identifier=\"RESPONSE\" />\n <correct identifier=\"RESPONSE\" />\n </match>\n <setOutcomeValue identifier=\"SCORE\">\n <baseValue baseType=\"float\">1</baseValue>\n </setOutcomeValue>\n </responseIf>\n </responseCondition>\n </responseProcessing>\n</assessmentItem>`,\n },\n ],\n },\n ],\n },\n ],\n };\n }\n // =========================================================================\n // STATIC: QTI TEST XML PARSER\n // =========================================================================\n /**\n * Parse a QTI assessmentTest XML string into a SecureAssessment structure.\n *\n * Handles:\n * - S1: section-level itemSessionControl\n * - S9: assessmentSectionRef href resolution (requires fileResolver)\n * - T9/T1: outcomeDeclarations + outcomeProcessing extraction\n *\n * @param testXml - Raw QTI assessmentTest XML string\n * @param options.role - Role to assign to items (default: 'candidate')\n * @param options.itemXmlMap - Map of item identifier -> itemXml for pre-loaded items\n * @param options.fileResolver - Async function to load external files by relative href\n * @param options.baseUrl - Base URL for resolving relative hrefs\n */\n static async parseAssessmentTestXml(testXml, options = {}) {\n const { role = 'candidate', itemXmlMap = {}, fileResolver, baseUrl } = options;\n const doc = parseXml(testXml);\n const root = doc.documentElement;\n if (!root)\n throw new Error('Empty assessmentTest XML');\n const getAttr = (el, name) => {\n const direct = el.getAttribute(name);\n if (direct !== null && direct !== '')\n return direct;\n const mapped = el.getAttribute(name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`));\n return mapped === null || mapped === '' ? undefined : mapped;\n };\n const childElements = (el) => Array.from(el.childNodes).filter((n) => n.nodeType === 1);\n const childrenByTag = (el, tag) => childElements(el).filter((c) => toCanonicalQtiName(c.localName) === tag);\n // Parse itemSessionControl element\n const parseItemSessionControl = (el) => {\n const isc = childrenByTag(el, 'itemSessionControl')[0];\n if (!isc)\n return undefined;\n const boolAttr = (name) => {\n const v = getAttr(isc, name);\n return v === undefined ? undefined : v !== 'false';\n };\n const intAttr = (name) => {\n const v = getAttr(isc, name);\n return v === undefined ? undefined : parseInt(v, 10);\n };\n return {\n maxAttempts: intAttr('maxAttempts'),\n showFeedback: boolAttr('showFeedback') ?? boolAttr('show-feedback'),\n allowReview: boolAttr('allowReview') ?? boolAttr('allow-review'),\n showSolution: boolAttr('showSolution') ?? boolAttr('show-solution'),\n allowComment: boolAttr('allowComment') ?? boolAttr('allow-comment'),\n allowSkipping: boolAttr('allowSkipping') ?? boolAttr('allow-skipping'),\n validateResponses: boolAttr('validateResponses') ?? boolAttr('validate-responses'),\n };\n };\n const parseTimeLimits = (el) => {\n const limitsEl = childrenByTag(el, 'timeLimit')[0] ?? childrenByTag(el, 'timeLimits')[0];\n if (!limitsEl)\n return undefined;\n const numberAttr = (name) => {\n const value = getAttr(limitsEl, name);\n if (value === undefined)\n return undefined;\n const parsed = Number(value);\n return Number.isFinite(parsed) ? parsed : undefined;\n };\n const boolAttr = (name) => {\n const value = getAttr(limitsEl, name);\n return value === undefined ? undefined : value === 'true';\n };\n return {\n minTime: numberAttr('minTime'),\n maxTime: numberAttr('maxTime'),\n allowLateSubmission: boolAttr('allowLateSubmission'),\n };\n };\n const resolveAgainstBase = (href) => {\n if (!href)\n return undefined;\n return baseUrl ? resolveQtiRelativePath(baseUrl, href) : href;\n };\n const loadText = async (href) => {\n if (!href)\n return undefined;\n const candidates = [href, resolveAgainstBase(href)].filter((value, index, all) => Boolean(value) && all.indexOf(value) === index);\n for (const candidate of candidates) {\n if (itemXmlMap[candidate] !== undefined) {\n return itemXmlMap[candidate];\n }\n }\n if (!fileResolver)\n return undefined;\n for (const candidate of candidates) {\n try {\n return await fileResolver(candidate);\n }\n catch {\n // Try the next candidate before giving up.\n }\n }\n return undefined;\n };\n const buildDeliveryContext = async (itemXml, itemHref) => {\n if (!itemHref || extractAssessmentStimulusRefs(itemXml).length === 0) {\n return undefined;\n }\n const stimulusXmlByPath = {};\n for (const ref of extractAssessmentStimulusRefs(itemXml)) {\n const stimulusPath = resolveQtiRelativePath(itemHref, ref.href);\n const stimulusXml = await loadText(stimulusPath);\n if (stimulusXml) {\n stimulusXmlByPath[stimulusPath] = stimulusXml;\n }\n }\n return createResolvedItemDeliveryContext({\n itemXml,\n itemHref,\n readText: (path) => stimulusXmlByPath[path] ?? itemXmlMap[path],\n });\n };\n // Parse a single assessmentSection element\n const parseSection = async (sectionEl) => {\n const identifier = getAttr(sectionEl, 'identifier') ?? 'section';\n const title = getAttr(sectionEl, 'title');\n const visibleRaw = getAttr(sectionEl, 'visible');\n const visible = visibleRaw === undefined ? true : visibleRaw !== 'false';\n const itemSessionControl = parseItemSessionControl(sectionEl);\n const timeLimits = parseTimeLimits(sectionEl);\n // rubricBlocks\n const rubricBlockEls = childrenByTag(sectionEl, 'rubricBlock');\n const rubricBlocks = rubricBlockEls.length > 0\n ? rubricBlockEls.map((b, idx) => ({\n identifier: getAttr(b, 'identifier') ?? `${identifier}-rubric-${idx + 1}`,\n view: (getAttr(b, 'view') ?? 'candidate').split(/\\s+/).filter(Boolean),\n use: getAttr(b, 'use'),\n content: serializeXml(b),\n }))\n : undefined;\n // assessmentItemRefs\n const itemRefEls = childrenByTag(sectionEl, 'assessmentItemRef');\n const assessmentItemRefs = [];\n for (const ref of itemRefEls) {\n const itemId = getAttr(ref, 'identifier') ?? 'item';\n const href = getAttr(ref, 'href');\n const itemHref = resolveAgainstBase(href) ?? href;\n // Look up pre-loaded XML by identifier or href\n const resolvedXml = itemXmlMap[itemId] ?? (href ? itemXmlMap[href] : undefined) ?? (itemHref ? itemXmlMap[itemHref] : undefined) ?? (await loadText(href)) ?? '';\n const requiredRaw = getAttr(ref, 'required');\n const required = requiredRaw === undefined ? undefined : requiredRaw !== 'false';\n assessmentItemRefs.push({\n identifier: itemId,\n itemXml: resolvedXml,\n role,\n required,\n timeLimits: parseTimeLimits(ref),\n deliveryContext: await buildDeliveryContext(resolvedXml, itemHref),\n });\n }\n return {\n identifier,\n title,\n visible,\n assessmentItemRefs,\n rubricBlocks,\n itemSessionControl,\n timeLimits,\n };\n };\n // Resolve assessmentSectionRef: load and parse referenced section file\n const resolveSectionRef = async (sectionRefEl) => {\n const href = getAttr(sectionRefEl, 'href');\n if (!href) {\n console.warn('[ReferenceBackendAdapter] assessmentSectionRef missing href, skipping');\n return null;\n }\n if (!fileResolver) {\n console.warn(`[ReferenceBackendAdapter] assessmentSectionRef href=\"${href}\" found but no fileResolver provided, skipping`);\n return null;\n }\n try {\n const sectionXml = await fileResolver(href);\n const secDoc = parseXml(sectionXml);\n const secRoot = secDoc.documentElement;\n if (!secRoot || toCanonicalQtiName(secRoot.localName) !== 'assessmentSection') {\n console.warn(`[ReferenceBackendAdapter] assessmentSectionRef href=\"${href}\": root element is not <assessmentSection>, skipping`);\n return null;\n }\n return parseSection(secRoot);\n }\n catch (err) {\n console.warn(`[ReferenceBackendAdapter] Failed to load assessmentSectionRef href=\"${href}\":`, err);\n return null;\n }\n };\n // Parse testPart children (sections + sectionRefs)\n const parseSectionsForTestPart = async (testPartEl) => {\n const sections = [];\n for (const child of childElements(testPartEl)) {\n if (toCanonicalQtiName(child.localName) === 'assessmentSection') {\n sections.push(await parseSection(child));\n }\n else if (toCanonicalQtiName(child.localName) === 'assessmentSectionRef') {\n const resolved = await resolveSectionRef(child);\n if (resolved)\n sections.push(resolved);\n }\n }\n return sections;\n };\n // Parse testPart-level itemSessionControl\n const parseTestPartItemSessionControl = (testPartEl) => {\n const isc = childrenByTag(testPartEl, 'itemSessionControl')[0];\n if (!isc)\n return undefined;\n const boolAttr = (name) => {\n const v = getAttr(isc, name);\n return v === undefined ? undefined : v !== 'false';\n };\n const intAttr = (name) => {\n const v = getAttr(isc, name);\n return v === undefined ? undefined : parseInt(v, 10);\n };\n return {\n maxAttempts: intAttr('maxAttempts'),\n showFeedback: boolAttr('showFeedback') ?? boolAttr('show-feedback'),\n allowReview: boolAttr('allowReview') ?? boolAttr('allow-review'),\n showSolution: boolAttr('showSolution') ?? boolAttr('show-solution'),\n allowComment: boolAttr('allowComment') ?? boolAttr('allow-comment'),\n allowSkipping: boolAttr('allowSkipping') ?? boolAttr('allow-skipping'),\n validateResponses: boolAttr('validateResponses') ?? boolAttr('validate-responses'),\n };\n };\n // Extract outcomeDeclarations\n const outcomeDeclarations = childrenByTag(root, 'outcomeDeclaration').map((d) => {\n const identifier = getAttr(d, 'identifier') ?? 'OUTCOME';\n const baseType = getAttr(d, 'baseType') ?? 'float';\n const cardinality = getAttr(d, 'cardinality') ?? 'single';\n // Parse defaultValue if present\n const defaultValueEl = childrenByTag(d, 'defaultValue')[0];\n let defaultValue = undefined;\n if (defaultValueEl) {\n const valueEl = childrenByTag(defaultValueEl, 'value')[0];\n if (valueEl) {\n const text = valueEl.textContent?.trim() ?? '0';\n if (baseType === 'float' || baseType === 'integer') {\n defaultValue = Number(text);\n }\n else {\n defaultValue = text;\n }\n }\n }\n return { identifier, baseType, cardinality, defaultValue };\n });\n // Extract outcomeProcessing XML\n const outcomeProcessingEl = childrenByTag(root, 'outcomeProcessing')[0];\n const outcomeProcessingXml = outcomeProcessingEl\n ? serializeXml(outcomeProcessingEl)\n : undefined;\n // Extract assessment-level timeLimits.\n const timeLimits = parseTimeLimits(root);\n // Parse testParts\n const testPartEls = childrenByTag(root, 'testPart');\n const firstTestPart = testPartEls[0];\n // Navigation/submission mode from first testPart (QTI 2.2 spec)\n const navigationMode = (getAttr(firstTestPart ?? root, 'navigationMode') ?? 'nonlinear');\n const submissionMode = (getAttr(firstTestPart ?? root, 'submissionMode') ?? 'simultaneous');\n const testParts = [];\n for (const tp of testPartEls) {\n const tpIdentifier = getAttr(tp, 'identifier') ?? 'part-1';\n const tpItemSessionControl = parseTestPartItemSessionControl(tp);\n const tpTimeLimits = parseTimeLimits(tp);\n const tpRubricBlockEls = childrenByTag(tp, 'rubricBlock');\n const tpRubricBlocks = tpRubricBlockEls.length > 0\n ? tpRubricBlockEls.map((b, idx) => ({\n identifier: getAttr(b, 'identifier') ?? `${tpIdentifier}-rubric-${idx + 1}`,\n view: (getAttr(b, 'view') ?? 'candidate').split(/\\s+/).filter(Boolean),\n use: getAttr(b, 'use'),\n content: serializeXml(b),\n }))\n : undefined;\n const sections = await parseSectionsForTestPart(tp);\n testParts.push({\n identifier: tpIdentifier,\n sections,\n rubricBlocks: tpRubricBlocks,\n itemSessionControl: tpItemSessionControl,\n timeLimits: tpTimeLimits,\n });\n }\n // If no testParts, try top-level sections\n if (testParts.length === 0) {\n const topSections = [];\n for (const child of childElements(root)) {\n if (toCanonicalQtiName(child.localName) === 'assessmentSection') {\n topSections.push(await parseSection(child));\n }\n else if (toCanonicalQtiName(child.localName) === 'assessmentSectionRef') {\n const resolved = await resolveSectionRef(child);\n if (resolved)\n topSections.push(resolved);\n }\n }\n if (topSections.length > 0) {\n testParts.push({\n identifier: 'part-1',\n sections: topSections,\n });\n }\n }\n return {\n identifier: getAttr(root, 'identifier') ?? 'assessment',\n title: getAttr(root, 'title') ?? 'Assessment',\n navigationMode,\n submissionMode,\n testParts,\n timeLimits,\n outcomeDeclarations: outcomeDeclarations.length > 0 ? outcomeDeclarations : undefined,\n outcomeProcessingXml,\n baseUrl,\n };\n }\n evaluateConditionXml(conditionXml, vars) {\n // conditionXml is an operator element like <gt>...</gt> (not wrapped in <expression>).\n const doc = parseXml(conditionXml);\n const root = doc.documentElement;\n if (!root)\n return false;\n const decls = {};\n for (const [k, raw] of Object.entries(vars)) {\n let v = qtiNull();\n if (typeof raw === 'number')\n v = qtiValue('float', 'single', raw);\n else if (typeof raw === 'boolean')\n v = qtiValue('boolean', 'single', raw);\n else if (typeof raw === 'string')\n v = qtiValue('string', 'single', raw);\n decls[k] = {\n identifier: k,\n baseType: v.kind === 'value' ? v.baseType : 'string',\n cardinality: 'single',\n defaultValue: qtiNull(),\n value: v,\n };\n }\n const ctx = new DeclarationContext(decls);\n const ops = new OperatorRegistry();\n const expr = buildExpression(root, { scope: 'test' });\n const out = evalExpr({ ctx, ops, rng: Math.random }, expr);\n return out.kind === 'value' && out.baseType === 'boolean' ? Boolean(out.value) : false;\n }\n getItemOrder(assessment) {\n const out = [];\n for (const part of assessment.testParts || []) {\n for (const section of part.sections || []) {\n for (const item of section.assessmentItemRefs || []) {\n out.push(item.identifier);\n }\n }\n }\n return out;\n }\n // =========================================================================\n // ITEM BANK HELPERS\n // =========================================================================\n /**\n * Generate cache key for item bank query\n */\n getBankCacheKey(sessionId, bankId, count, withReplacement, filters) {\n const filterKey = filters ? JSON.stringify(filters) : '';\n return `${BANK_CACHE_PREFIX}${sessionId}:${bankId}:${count}:${withReplacement}:${filterKey}`;\n }\n /**\n * Load item bank cache from localStorage\n */\n loadBankCache(cacheKey) {\n try {\n const data = localStorage.getItem(cacheKey);\n if (!data)\n return null;\n const entry = JSON.parse(data);\n // Check if cache is expired\n const now = Date.now();\n if (now - entry.timestamp > entry.ttl) {\n // Clean up expired cache\n localStorage.removeItem(cacheKey);\n return null;\n }\n return entry;\n }\n catch {\n return null;\n }\n }\n /**\n * Save item bank cache to localStorage\n */\n saveBankCache(cacheKey, entry) {\n try {\n localStorage.setItem(cacheKey, JSON.stringify(entry));\n }\n catch (error) {\n console.error('Failed to save bank cache to localStorage:', error);\n }\n }\n /**\n * Fetch items from item bank with retry logic\n *\n * **DEMO IMPLEMENTATION**: Returns hardcoded items\n * In production, this would make HTTP request to item bank service\n */\n async fetchItemsFromBank(bankId, count, withReplacement, filters, retryCount = 0) {\n const maxRetries = 3;\n const baseDelay = 1000; // 1 second\n try {\n // Simulate network call delay\n await this.delay(100);\n // **DEMO**: Return hardcoded items\n // In production, replace with:\n // const response = await fetch(`/api/item-banks/${bankId}`, {\n // method: 'POST',\n // headers: { 'Content-Type': 'application/json' },\n // body: JSON.stringify({ count, withReplacement, filters })\n // });\n // return response.json();\n const demoItems = [\n {\n identifier: `bank-${bankId}-item1`,\n role: 'candidate',\n itemXml: `<assessmentItem identifier=\"bank-${bankId}-item1\" title=\"Bank Item 1\" adaptive=\"false\" timeDependent=\"false\">\n <responseDeclaration identifier=\"RESPONSE\" cardinality=\"single\" baseType=\"identifier\">\n <correctResponse><value>A</value></correctResponse>\n </responseDeclaration>\n <outcomeDeclaration identifier=\"SCORE\" cardinality=\"single\" baseType=\"float\">\n <defaultValue><value>0</value></defaultValue>\n </outcomeDeclaration>\n <itemBody>\n <p>Sample question from bank ${bankId}</p>\n <choiceInteraction responseIdentifier=\"RESPONSE\" shuffle=\"false\" maxChoices=\"1\">\n <simpleChoice identifier=\"A\">Option A</simpleChoice>\n <simpleChoice identifier=\"B\">Option B</simpleChoice>\n </choiceInteraction>\n </itemBody>\n <responseProcessing>\n <responseCondition>\n <responseIf>\n <match>\n <variable identifier=\"RESPONSE\" />\n <correct identifier=\"RESPONSE\" />\n </match>\n <setOutcomeValue identifier=\"SCORE\">\n <baseValue baseType=\"float\">1</baseValue>\n </setOutcomeValue>\n </responseIf>\n <responseElse>\n <setOutcomeValue identifier=\"SCORE\">\n <baseValue baseType=\"float\">0</baseValue>\n </setOutcomeValue>\n </responseElse>\n </responseCondition>\n </responseProcessing>\n</assessmentItem>`,\n },\n {\n identifier: `bank-${bankId}-item2`,\n role: 'candidate',\n itemXml: `<assessmentItem identifier=\"bank-${bankId}-item2\" title=\"Bank Item 2\" adaptive=\"false\" timeDependent=\"false\">\n <responseDeclaration identifier=\"RESPONSE\" cardinality=\"single\" baseType=\"identifier\">\n <correctResponse><value>B</value></correctResponse>\n </responseDeclaration>\n <outcomeDeclaration identifier=\"SCORE\" cardinality=\"single\" baseType=\"float\">\n <defaultValue><value>0</value></defaultValue>\n </outcomeDeclaration>\n <itemBody>\n <p>Another question from bank ${bankId}</p>\n <choiceInteraction responseIdentifier=\"RESPONSE\" shuffle=\"false\" maxChoices=\"1\">\n <simpleChoice identifier=\"A\">Option A</simpleChoice>\n <simpleChoice identifier=\"B\">Option B</simpleChoice>\n </choiceInteraction>\n </itemBody>\n <responseProcessing>\n <responseCondition>\n <responseIf>\n <match>\n <variable identifier=\"RESPONSE\" />\n <correct identifier=\"RESPONSE\" />\n </match>\n <setOutcomeValue identifier=\"SCORE\">\n <baseValue baseType=\"float\">1</baseValue>\n </setOutcomeValue>\n </responseIf>\n <responseElse>\n <setOutcomeValue identifier=\"SCORE\">\n <baseValue baseType=\"float\">0</baseValue>\n </setOutcomeValue>\n </responseElse>\n </responseCondition>\n </responseProcessing>\n</assessmentItem>`,\n },\n {\n identifier: `bank-${bankId}-item3`,\n role: 'candidate',\n itemXml: `<assessmentItem identifier=\"bank-${bankId}-item3\" title=\"Bank Item 3\" adaptive=\"false\" timeDependent=\"false\">\n <responseDeclaration identifier=\"RESPONSE\" cardinality=\"single\" baseType=\"identifier\">\n <correctResponse><value>A</value></correctResponse>\n </responseDeclaration>\n <outcomeDeclaration identifier=\"SCORE\" cardinality=\"single\" baseType=\"float\">\n <defaultValue><value>0</value></defaultValue>\n </outcomeDeclaration>\n <itemBody>\n <p>Third question from bank ${bankId}</p>\n <choiceInteraction responseIdentifier=\"RESPONSE\" shuffle=\"false\" maxChoices=\"1\">\n <simpleChoice identifier=\"A\">Option A</simpleChoice>\n <simpleChoice identifier=\"B\">Option B</simpleChoice>\n </choiceInteraction>\n </itemBody>\n <responseProcessing>\n <responseCondition>\n <responseIf>\n <match>\n <variable identifier=\"RESPONSE\" />\n <correct identifier=\"RESPONSE\" />\n </match>\n <setOutcomeValue identifier=\"SCORE\">\n <baseValue baseType=\"float\">1</baseValue>\n </setOutcomeValue>\n </responseIf>\n <responseElse>\n <setOutcomeValue identifier=\"SCORE\">\n <baseValue baseType=\"float\">0</baseValue>\n </setOutcomeValue>\n </responseElse>\n </responseCondition>\n </responseProcessing>\n</assessmentItem>`,\n },\n ];\n // Apply filtering if specified (demo implementation)\n let filteredItems = [...demoItems];\n if (filters?.difficulty) {\n // In production, server would filter by metadata\n console.log(`Filtering by difficulty: ${filters.difficulty}`);\n }\n // Select requested number of items\n if (withReplacement) {\n // Allow duplicates\n const selected = [];\n for (let i = 0; i < count; i++) {\n const randomIndex = Math.floor(Math.random() * filteredItems.length);\n selected.push(filteredItems[randomIndex]);\n }\n return selected;\n }\n else {\n // No duplicates - shuffle and take first N\n const shuffled = [...filteredItems].sort(() => Math.random() - 0.5);\n return shuffled.slice(0, Math.min(count, shuffled.length));\n }\n }\n catch (error) {\n // Implement exponential backoff retry\n if (retryCount < maxRetries) {\n const delay = baseDelay * Math.pow(2, retryCount);\n console.warn(`Item bank query failed (attempt ${retryCount + 1}/${maxRetries + 1}). ` +\n `Retrying in ${delay}ms...`, error);\n await this.delay(delay);\n return this.fetchItemsFromBank(bankId, count, withReplacement, filters, retryCount + 1);\n }\n // All retries exhausted\n throw new Error(`Failed to load items from bank \"${bankId}\" after ${maxRetries + 1} attempts: ${error}`);\n }\n }\n /**\n * Delay helper for async operations\n */\n delay(ms) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n}\n//# sourceMappingURL=ReferenceBackendAdapter.js.map","import { PUBLIC_VERSION } from '../version.js';\n\nif (typeof window !== 'undefined') {\n\t// @ts-expect-error\n\t((window.__svelte ??= {}).v ??= new Set()).add(PUBLIC_VERSION);\n}\n","export const EACH_ITEM_REACTIVE = 1;\nexport const EACH_INDEX_REACTIVE = 1 << 1;\n/** See EachBlock interface metadata.is_controlled for an explanation what this is */\nexport const EACH_IS_CONTROLLED = 1 << 2;\nexport const EACH_IS_ANIMATED = 1 << 3;\nexport const EACH_ITEM_IMMUTABLE = 1 << 4;\n\nexport const PROPS_IS_IMMUTABLE = 1;\nexport const PROPS_IS_RUNES = 1 << 1;\nexport const PROPS_IS_UPDATED = 1 << 2;\nexport const PROPS_IS_BINDABLE = 1 << 3;\nexport const PROPS_IS_LAZY_INITIAL = 1 << 4;\n\nexport const TRANSITION_IN = 1;\nexport const TRANSITION_OUT = 1 << 1;\nexport const TRANSITION_GLOBAL = 1 << 2;\n\nexport const TEMPLATE_FRAGMENT = 1;\nexport const TEMPLATE_USE_IMPORT_NODE = 1 << 1;\nexport const TEMPLATE_USE_SVG = 1 << 2;\nexport const TEMPLATE_USE_MATHML = 1 << 3;\n\nexport const HYDRATION_START = '[';\n/** used to indicate that an `{:else}...` block was rendered */\nexport const HYDRATION_START_ELSE = '[!';\n/** used to indicate that a boundary's `failed` snippet was rendered on the server */\nexport const HYDRATION_START_FAILED = '[?';\nexport const HYDRATION_END = ']';\nexport const HYDRATION_ERROR = {};\n\nexport const ELEMENT_IS_NAMESPACED = 1;\nexport const ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;\nexport const ELEMENT_IS_INPUT = 1 << 2;\n\nexport const UNINITIALIZED = Symbol();\n\n// Dev-time component properties\nexport const FILENAME = Symbol('filename');\nexport const HMR = Symbol('hmr');\n\nexport const NAMESPACE_HTML = 'http://www.w3.org/1999/xhtml';\nexport const NAMESPACE_SVG = 'http://www.w3.org/2000/svg';\nexport const NAMESPACE_MATHML = 'http://www.w3.org/1998/Math/MathML';\n\n// we use a list of ignorable runtime warnings because not every runtime warning\n// can be ignored and we want to keep the validation for svelte-ignore in place\nexport const IGNORABLE_RUNTIME_WARNINGS = /** @type {const} */ ([\n\t'await_waterfall',\n\t'await_reactivity_loss',\n\t'state_snapshot_uncloneable',\n\t'binding_property_non_reactive',\n\t'hydration_attribute_changed',\n\t'hydration_html_changed',\n\t'ownership_invalid_binding',\n\t'ownership_invalid_mutation'\n]);\n\n/**\n * Whitespace inside one of these elements will not result in\n * a whitespace node being created in any circumstances. (This\n * list is almost certainly very incomplete)\n * TODO this is currently unused\n */\nexport const ELEMENTS_WITHOUT_TEXT = ['audio', 'datalist', 'dl', 'optgroup', 'select', 'video'];\n\nexport const ATTACHMENT_KEY = '@attach';\n","// Store the references to globals in case someone tries to monkey patch these, causing the below\n// to de-opt (this occurs often when using popular extensions).\nexport var is_array = Array.isArray;\nexport var index_of = Array.prototype.indexOf;\nexport var includes = Array.prototype.includes;\nexport var array_from = Array.from;\nexport var object_keys = Object.keys;\nexport var define_property = Object.defineProperty;\nexport var get_descriptor = Object.getOwnPropertyDescriptor;\nexport var get_descriptors = Object.getOwnPropertyDescriptors;\nexport var object_prototype = Object.prototype;\nexport var array_prototype = Array.prototype;\nexport var get_prototype_of = Object.getPrototypeOf;\nexport var is_extensible = Object.isExtensible;\nexport var has_own_property = Object.prototype.hasOwnProperty;\n\n/**\n * @param {any} thing\n * @returns {thing is Function}\n */\nexport function is_function(thing) {\n\treturn typeof thing === 'function';\n}\n\nexport const noop = () => {};\n\n// Adapted from https://github.com/then/is-promise/blob/master/index.js\n// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE\n\n/**\n * @template [T=any]\n * @param {any} value\n * @returns {value is PromiseLike<T>}\n */\nexport function is_promise(value) {\n\treturn typeof value?.then === 'function';\n}\n\n/** @param {Function} fn */\nexport function run(fn) {\n\treturn fn();\n}\n\n/** @param {Array<() => void>} arr */\nexport function run_all(arr) {\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tarr[i]();\n\t}\n}\n\n/**\n * TODO replace with Promise.withResolvers once supported widely enough\n * @template [T=void]\n */\nexport function deferred() {\n\t/** @type {(value: T) => void} */\n\tvar resolve;\n\n\t/** @type {(reason: any) => void} */\n\tvar reject;\n\n\t/** @type {Promise<T>} */\n\tvar promise = new Promise((res, rej) => {\n\t\tresolve = res;\n\t\treject = rej;\n\t});\n\n\t// @ts-expect-error\n\treturn { promise, resolve, reject };\n}\n\n/**\n * @template V\n * @param {V} value\n * @param {V | (() => V)} fallback\n * @param {boolean} [lazy]\n * @returns {V}\n */\nexport function fallback(value, fallback, lazy = false) {\n\treturn value === undefined\n\t\t? lazy\n\t\t\t? /** @type {() => V} */ (fallback)()\n\t\t\t: /** @type {V} */ (fallback)\n\t\t: value;\n}\n\n/**\n * When encountering a situation like `let [a, b, c] = $derived(blah())`,\n * we need to stash an intermediate value that `a`, `b`, and `c` derive\n * from, in case it's an iterable\n * @template T\n * @param {ArrayLike<T> | Iterable<T>} value\n * @param {number} [n]\n * @returns {Array<T>}\n */\nexport function to_array(value, n) {\n\t// return arrays unchanged\n\tif (Array.isArray(value)) {\n\t\treturn value;\n\t}\n\n\t// if value is not iterable, or `n` is unspecified (indicates a rest\n\t// element, which means we're not concerned about unbounded iterables)\n\t// convert to an array with `Array.from`\n\tif (n === undefined || !(Symbol.iterator in value)) {\n\t\treturn Array.from(value);\n\t}\n\n\t// otherwise, populate an array with `n` values\n\n\t/** @type {T[]} */\n\tconst array = [];\n\n\tfor (const element of value) {\n\t\tarray.push(element);\n\t\tif (array.length === n) break;\n\t}\n\n\treturn array;\n}\n\n/**\n * @param {Record<string | symbol, unknown>} obj\n * @param {Array<string | symbol>} keys\n * @returns {Record<string | symbol, unknown>}\n */\nexport function exclude_from_object(obj, keys) {\n\t/** @type {Record<string | symbol, unknown>} */\n\tvar result = {};\n\n\tfor (var key in obj) {\n\t\tif (!keys.includes(key)) {\n\t\t\tresult[key] = obj[key];\n\t\t}\n\t}\n\n\tfor (var symbol of Object.getOwnPropertySymbols(obj)) {\n\t\tif (Object.propertyIsEnumerable.call(obj, symbol) && !keys.includes(symbol)) {\n\t\t\tresult[symbol] = obj[symbol];\n\t\t}\n\t}\n\n\treturn result;\n}\n","// General flags\nexport const DERIVED = 1 << 1;\nexport const EFFECT = 1 << 2;\nexport const RENDER_EFFECT = 1 << 3;\n/**\n * An effect that does not destroy its child effects when it reruns.\n * Runs as part of render effects, i.e. not eagerly as part of tree traversal or effect flushing.\n */\nexport const MANAGED_EFFECT = 1 << 24;\n/**\n * An effect that does not destroy its child effects when it reruns (like MANAGED_EFFECT).\n * Runs eagerly as part of tree traversal or effect flushing.\n */\nexport const BLOCK_EFFECT = 1 << 4;\nexport const BRANCH_EFFECT = 1 << 5;\nexport const ROOT_EFFECT = 1 << 6;\nexport const BOUNDARY_EFFECT = 1 << 7;\n/**\n * Indicates that a reaction is connected to an effect root — either it is an effect,\n * or it is a derived that is depended on by at least one effect. If a derived has\n * no dependents, we can disconnect it from the graph, allowing it to either be\n * GC'd or reconnected later if an effect comes to depend on it again\n */\nexport const CONNECTED = 1 << 9;\nexport const CLEAN = 1 << 10;\nexport const DIRTY = 1 << 11;\nexport const MAYBE_DIRTY = 1 << 12;\nexport const INERT = 1 << 13;\nexport const DESTROYED = 1 << 14;\n/** Set once a reaction has run for the first time */\nexport const REACTION_RAN = 1 << 15;\n/** Effect is in the process of getting destroyed. Can be observed in child teardown functions */\nexport const DESTROYING = 1 << 25;\n\n// Flags exclusive to effects\n/**\n * 'Transparent' effects do not create a transition boundary.\n * This is on a block effect 99% of the time but may also be on a branch effect if its parent block effect was pruned\n */\nexport const EFFECT_TRANSPARENT = 1 << 16;\nexport const EAGER_EFFECT = 1 << 17;\nexport const HEAD_EFFECT = 1 << 18;\nexport const EFFECT_PRESERVED = 1 << 19;\nexport const USER_EFFECT = 1 << 20;\nexport const EFFECT_OFFSCREEN = 1 << 25;\n\n// Flags exclusive to deriveds\n/**\n * Tells that we marked this derived and its reactions as visited during the \"mark as (maybe) dirty\"-phase.\n * Will be lifted during execution of the derived and during checking its dirty state (both are necessary\n * because a derived might be checked but not executed).\n */\nexport const WAS_MARKED = 1 << 16;\n\n// Flags used for async\nexport const REACTION_IS_UPDATING = 1 << 21;\nexport const ASYNC = 1 << 22;\n\nexport const ERROR_VALUE = 1 << 23;\n\nexport const STATE_SYMBOL = Symbol('$state');\nexport const LEGACY_PROPS = Symbol('legacy props');\nexport const LOADING_ATTR_SYMBOL = Symbol('');\nexport const PROXY_PATH_SYMBOL = Symbol('proxy path');\n\n/** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */\nexport const STALE_REACTION = new (class StaleReactionError extends Error {\n\tname = 'StaleReactionError';\n\tmessage = 'The reaction that called `getAbortSignal()` was re-run or destroyed';\n})();\n\nexport const IS_XHTML =\n\t// We gotta write it like this because after downleveling the pure comment may end up in the wrong location\n\t!!globalThis.document?.contentType &&\n\t/* @__PURE__ */ globalThis.document.contentType.includes('xml');\nexport const ELEMENT_NODE = 1;\nexport const TEXT_NODE = 3;\nexport const COMMENT_NODE = 8;\nexport const DOCUMENT_FRAGMENT_NODE = 11;\n","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\n/**\n * Cannot use `%name%(...)` unless the `experimental.async` compiler option is `true`\n * @param {string} name\n * @returns {never}\n */\nexport function experimental_async_required(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`experimental_async_required\\nCannot use \\`${name}(...)\\` unless the \\`experimental.async\\` compiler option is \\`true\\`\\nhttps://svelte.dev/e/experimental_async_required`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/experimental_async_required`);\n\t}\n}\n\n/**\n * Cannot use `{@render children(...)}` if the parent component uses `let:` directives. Consider using a named snippet instead\n * @returns {never}\n */\nexport function invalid_default_snippet() {\n\tif (DEV) {\n\t\tconst error = new Error(`invalid_default_snippet\\nCannot use \\`{@render children(...)}\\` if the parent component uses \\`let:\\` directives. Consider using a named snippet instead\\nhttps://svelte.dev/e/invalid_default_snippet`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invalid_default_snippet`);\n\t}\n}\n\n/**\n * A snippet function was passed invalid arguments. Snippets should only be instantiated via `{@render ...}`\n * @returns {never}\n */\nexport function invalid_snippet_arguments() {\n\tif (DEV) {\n\t\tconst error = new Error(`invalid_snippet_arguments\\nA snippet function was passed invalid arguments. Snippets should only be instantiated via \\`{@render ...}\\`\\nhttps://svelte.dev/e/invalid_snippet_arguments`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invalid_snippet_arguments`);\n\t}\n}\n\n/**\n * An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app — please open an issue at https://github.com/sveltejs/svelte, citing the following message: \"%message%\"\n * @param {string} message\n * @returns {never}\n */\nexport function invariant_violation(message) {\n\tif (DEV) {\n\t\tconst error = new Error(`invariant_violation\\nAn invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app — please open an issue at https://github.com/sveltejs/svelte, citing the following message: \"${message}\"\\nhttps://svelte.dev/e/invariant_violation`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invariant_violation`);\n\t}\n}\n\n/**\n * `%name%(...)` can only be used during component initialisation\n * @param {string} name\n * @returns {never}\n */\nexport function lifecycle_outside_component(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`lifecycle_outside_component\\n\\`${name}(...)\\` can only be used during component initialisation\\nhttps://svelte.dev/e/lifecycle_outside_component`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/lifecycle_outside_component`);\n\t}\n}\n\n/**\n * Context was not set in a parent component\n * @returns {never}\n */\nexport function missing_context() {\n\tif (DEV) {\n\t\tconst error = new Error(`missing_context\\nContext was not set in a parent component\\nhttps://svelte.dev/e/missing_context`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/missing_context`);\n\t}\n}\n\n/**\n * Attempted to render a snippet without a `{@render}` block. This would cause the snippet code to be stringified instead of its content being rendered to the DOM. To fix this, change `{snippet}` to `{@render snippet()}`.\n * @returns {never}\n */\nexport function snippet_without_render_tag() {\n\tif (DEV) {\n\t\tconst error = new Error(`snippet_without_render_tag\\nAttempted to render a snippet without a \\`{@render}\\` block. This would cause the snippet code to be stringified instead of its content being rendered to the DOM. To fix this, change \\`{snippet}\\` to \\`{@render snippet()}\\`.\\nhttps://svelte.dev/e/snippet_without_render_tag`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/snippet_without_render_tag`);\n\t}\n}\n\n/**\n * `%name%` is not a store with a `subscribe` method\n * @param {string} name\n * @returns {never}\n */\nexport function store_invalid_shape(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`store_invalid_shape\\n\\`${name}\\` is not a store with a \\`subscribe\\` method\\nhttps://svelte.dev/e/store_invalid_shape`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/store_invalid_shape`);\n\t}\n}\n\n/**\n * The `this` prop on `<svelte:element>` must be a string, if defined\n * @returns {never}\n */\nexport function svelte_element_invalid_this_value() {\n\tif (DEV) {\n\t\tconst error = new Error(`svelte_element_invalid_this_value\\nThe \\`this\\` prop on \\`<svelte:element>\\` must be a string, if defined\\nhttps://svelte.dev/e/svelte_element_invalid_this_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/svelte_element_invalid_this_value`);\n\t}\n}","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\nexport * from '../shared/errors.js';\n\n/**\n * Cannot create a `$derived(...)` with an `await` expression outside of an effect tree\n * @returns {never}\n */\nexport function async_derived_orphan() {\n\tif (DEV) {\n\t\tconst error = new Error(`async_derived_orphan\\nCannot create a \\`$derived(...)\\` with an \\`await\\` expression outside of an effect tree\\nhttps://svelte.dev/e/async_derived_orphan`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/async_derived_orphan`);\n\t}\n}\n\n/**\n * Using `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\n * @returns {never}\n */\nexport function bind_invalid_checkbox_value() {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_invalid_checkbox_value\\nUsing \\`bind:value\\` together with a checkbox input is not allowed. Use \\`bind:checked\\` instead\\nhttps://svelte.dev/e/bind_invalid_checkbox_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_invalid_checkbox_value`);\n\t}\n}\n\n/**\n * Component %component% has an export named `%key%` that a consumer component is trying to access using `bind:%key%`, which is disallowed. Instead, use `bind:this` (e.g. `<%name% bind:this={component} />`) and then access the property on the bound component instance (e.g. `component.%key%`)\n * @param {string} component\n * @param {string} key\n * @param {string} name\n * @returns {never}\n */\nexport function bind_invalid_export(component, key, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_invalid_export\\nComponent ${component} has an export named \\`${key}\\` that a consumer component is trying to access using \\`bind:${key}\\`, which is disallowed. Instead, use \\`bind:this\\` (e.g. \\`<${name} bind:this={component} />\\`) and then access the property on the bound component instance (e.g. \\`component.${key}\\`)\\nhttps://svelte.dev/e/bind_invalid_export`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_invalid_export`);\n\t}\n}\n\n/**\n * A component is attempting to bind to a non-bindable property `%key%` belonging to %component% (i.e. `<%name% bind:%key%={...}>`). To mark a property as bindable: `let { %key% = $bindable() } = $props()`\n * @param {string} key\n * @param {string} component\n * @param {string} name\n * @returns {never}\n */\nexport function bind_not_bindable(key, component, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_not_bindable\\nA component is attempting to bind to a non-bindable property \\`${key}\\` belonging to ${component} (i.e. \\`<${name} bind:${key}={...}>\\`). To mark a property as bindable: \\`let { ${key} = $bindable() } = $props()\\`\\nhttps://svelte.dev/e/bind_not_bindable`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_not_bindable`);\n\t}\n}\n\n/**\n * Calling `%method%` on a component instance (of %component%) is no longer valid in Svelte 5\n * @param {string} method\n * @param {string} component\n * @returns {never}\n */\nexport function component_api_changed(method, component) {\n\tif (DEV) {\n\t\tconst error = new Error(`component_api_changed\\nCalling \\`${method}\\` on a component instance (of ${component}) is no longer valid in Svelte 5\\nhttps://svelte.dev/e/component_api_changed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/component_api_changed`);\n\t}\n}\n\n/**\n * Attempted to instantiate %component% with `new %name%`, which is no longer valid in Svelte 5. If this component is not under your control, set the `compatibility.componentApi` compiler option to `4` to keep it working.\n * @param {string} component\n * @param {string} name\n * @returns {never}\n */\nexport function component_api_invalid_new(component, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`component_api_invalid_new\\nAttempted to instantiate ${component} with \\`new ${name}\\`, which is no longer valid in Svelte 5. If this component is not under your control, set the \\`compatibility.componentApi\\` compiler option to \\`4\\` to keep it working.\\nhttps://svelte.dev/e/component_api_invalid_new`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/component_api_invalid_new`);\n\t}\n}\n\n/**\n * A derived value cannot reference itself recursively\n * @returns {never}\n */\nexport function derived_references_self() {\n\tif (DEV) {\n\t\tconst error = new Error(`derived_references_self\\nA derived value cannot reference itself recursively\\nhttps://svelte.dev/e/derived_references_self`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/derived_references_self`);\n\t}\n}\n\n/**\n * Keyed each block has duplicate key `%value%` at indexes %a% and %b%\n * @param {string} a\n * @param {string} b\n * @param {string | undefined | null} [value]\n * @returns {never}\n */\nexport function each_key_duplicate(a, b, value) {\n\tif (DEV) {\n\t\tconst error = new Error(`each_key_duplicate\\n${value\n\t\t\t? `Keyed each block has duplicate key \\`${value}\\` at indexes ${a} and ${b}`\n\t\t\t: `Keyed each block has duplicate key at indexes ${a} and ${b}`}\\nhttps://svelte.dev/e/each_key_duplicate`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/each_key_duplicate`);\n\t}\n}\n\n/**\n * Keyed each block has key that is not idempotent — the key for item at index %index% was `%a%` but is now `%b%`. Keys must be the same each time for a given item\n * @param {string} index\n * @param {string} a\n * @param {string} b\n * @returns {never}\n */\nexport function each_key_volatile(index, a, b) {\n\tif (DEV) {\n\t\tconst error = new Error(`each_key_volatile\\nKeyed each block has key that is not idempotent — the key for item at index ${index} was \\`${a}\\` but is now \\`${b}\\`. Keys must be the same each time for a given item\\nhttps://svelte.dev/e/each_key_volatile`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/each_key_volatile`);\n\t}\n}\n\n/**\n * `%rune%` cannot be used inside an effect cleanup function\n * @param {string} rune\n * @returns {never}\n */\nexport function effect_in_teardown(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_in_teardown\\n\\`${rune}\\` cannot be used inside an effect cleanup function\\nhttps://svelte.dev/e/effect_in_teardown`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_in_teardown`);\n\t}\n}\n\n/**\n * Effect cannot be created inside a `$derived` value that was not itself created inside an effect\n * @returns {never}\n */\nexport function effect_in_unowned_derived() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_in_unowned_derived\\nEffect cannot be created inside a \\`$derived\\` value that was not itself created inside an effect\\nhttps://svelte.dev/e/effect_in_unowned_derived`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_in_unowned_derived`);\n\t}\n}\n\n/**\n * `%rune%` can only be used inside an effect (e.g. during component initialisation)\n * @param {string} rune\n * @returns {never}\n */\nexport function effect_orphan(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_orphan\\n\\`${rune}\\` can only be used inside an effect (e.g. during component initialisation)\\nhttps://svelte.dev/e/effect_orphan`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_orphan`);\n\t}\n}\n\n/**\n * `$effect.pending()` can only be called inside an effect or derived\n * @returns {never}\n */\nexport function effect_pending_outside_reaction() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_pending_outside_reaction\\n\\`$effect.pending()\\` can only be called inside an effect or derived\\nhttps://svelte.dev/e/effect_pending_outside_reaction`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_pending_outside_reaction`);\n\t}\n}\n\n/**\n * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\n * @returns {never}\n */\nexport function effect_update_depth_exceeded() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_update_depth_exceeded\\nMaximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\\nhttps://svelte.dev/e/effect_update_depth_exceeded`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);\n\t}\n}\n\n/**\n * Cannot use `flushSync` inside an effect\n * @returns {never}\n */\nexport function flush_sync_in_effect() {\n\tif (DEV) {\n\t\tconst error = new Error(`flush_sync_in_effect\\nCannot use \\`flushSync\\` inside an effect\\nhttps://svelte.dev/e/flush_sync_in_effect`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/flush_sync_in_effect`);\n\t}\n}\n\n/**\n * Cannot commit a fork that was already discarded\n * @returns {never}\n */\nexport function fork_discarded() {\n\tif (DEV) {\n\t\tconst error = new Error(`fork_discarded\\nCannot commit a fork that was already discarded\\nhttps://svelte.dev/e/fork_discarded`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/fork_discarded`);\n\t}\n}\n\n/**\n * Cannot create a fork inside an effect or when state changes are pending\n * @returns {never}\n */\nexport function fork_timing() {\n\tif (DEV) {\n\t\tconst error = new Error(`fork_timing\\nCannot create a fork inside an effect or when state changes are pending\\nhttps://svelte.dev/e/fork_timing`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/fork_timing`);\n\t}\n}\n\n/**\n * `getAbortSignal()` can only be called inside an effect or derived\n * @returns {never}\n */\nexport function get_abort_signal_outside_reaction() {\n\tif (DEV) {\n\t\tconst error = new Error(`get_abort_signal_outside_reaction\\n\\`getAbortSignal()\\` can only be called inside an effect or derived\\nhttps://svelte.dev/e/get_abort_signal_outside_reaction`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/get_abort_signal_outside_reaction`);\n\t}\n}\n\n/**\n * Expected to find a hydratable with key `%key%` during hydration, but did not.\n * @param {string} key\n * @returns {never}\n */\nexport function hydratable_missing_but_required(key) {\n\tif (DEV) {\n\t\tconst error = new Error(`hydratable_missing_but_required\\nExpected to find a hydratable with key \\`${key}\\` during hydration, but did not.\\nhttps://svelte.dev/e/hydratable_missing_but_required`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/hydratable_missing_but_required`);\n\t}\n}\n\n/**\n * Failed to hydrate the application\n * @returns {never}\n */\nexport function hydration_failed() {\n\tif (DEV) {\n\t\tconst error = new Error(`hydration_failed\\nFailed to hydrate the application\\nhttps://svelte.dev/e/hydration_failed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/hydration_failed`);\n\t}\n}\n\n/**\n * Could not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\n * @returns {never}\n */\nexport function invalid_snippet() {\n\tif (DEV) {\n\t\tconst error = new Error(`invalid_snippet\\nCould not \\`{@render}\\` snippet due to the expression being \\`null\\` or \\`undefined\\`. Consider using optional chaining \\`{@render snippet?.()}\\`\\nhttps://svelte.dev/e/invalid_snippet`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invalid_snippet`);\n\t}\n}\n\n/**\n * `%name%(...)` cannot be used in runes mode\n * @param {string} name\n * @returns {never}\n */\nexport function lifecycle_legacy_only(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`lifecycle_legacy_only\\n\\`${name}(...)\\` cannot be used in runes mode\\nhttps://svelte.dev/e/lifecycle_legacy_only`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/lifecycle_legacy_only`);\n\t}\n}\n\n/**\n * Cannot do `bind:%key%={undefined}` when `%key%` has a fallback value\n * @param {string} key\n * @returns {never}\n */\nexport function props_invalid_value(key) {\n\tif (DEV) {\n\t\tconst error = new Error(`props_invalid_value\\nCannot do \\`bind:${key}={undefined}\\` when \\`${key}\\` has a fallback value\\nhttps://svelte.dev/e/props_invalid_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/props_invalid_value`);\n\t}\n}\n\n/**\n * Rest element properties of `$props()` such as `%property%` are readonly\n * @param {string} property\n * @returns {never}\n */\nexport function props_rest_readonly(property) {\n\tif (DEV) {\n\t\tconst error = new Error(`props_rest_readonly\\nRest element properties of \\`$props()\\` such as \\`${property}\\` are readonly\\nhttps://svelte.dev/e/props_rest_readonly`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/props_rest_readonly`);\n\t}\n}\n\n/**\n * The `%rune%` rune is only available inside `.svelte` and `.svelte.js/ts` files\n * @param {string} rune\n * @returns {never}\n */\nexport function rune_outside_svelte(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`rune_outside_svelte\\nThe \\`${rune}\\` rune is only available inside \\`.svelte\\` and \\`.svelte.js/ts\\` files\\nhttps://svelte.dev/e/rune_outside_svelte`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/rune_outside_svelte`);\n\t}\n}\n\n/**\n * `setContext` must be called when a component first initializes, not in a subsequent effect or after an `await` expression\n * @returns {never}\n */\nexport function set_context_after_init() {\n\tif (DEV) {\n\t\tconst error = new Error(`set_context_after_init\\n\\`setContext\\` must be called when a component first initializes, not in a subsequent effect or after an \\`await\\` expression\\nhttps://svelte.dev/e/set_context_after_init`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/set_context_after_init`);\n\t}\n}\n\n/**\n * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\n * @returns {never}\n */\nexport function state_descriptors_fixed() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_descriptors_fixed\\nProperty descriptors defined on \\`$state\\` objects must contain \\`value\\` and always be \\`enumerable\\`, \\`configurable\\` and \\`writable\\`.\\nhttps://svelte.dev/e/state_descriptors_fixed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_descriptors_fixed`);\n\t}\n}\n\n/**\n * Cannot set prototype of `$state` object\n * @returns {never}\n */\nexport function state_prototype_fixed() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_prototype_fixed\\nCannot set prototype of \\`$state\\` object\\nhttps://svelte.dev/e/state_prototype_fixed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_prototype_fixed`);\n\t}\n}\n\n/**\n * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\n * @returns {never}\n */\nexport function state_unsafe_mutation() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_unsafe_mutation\\nUpdating state inside \\`$derived(...)\\`, \\`$inspect(...)\\` or a template expression is forbidden. If the value should not be reactive, declare it without \\`$state\\`\\nhttps://svelte.dev/e/state_unsafe_mutation`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_unsafe_mutation`);\n\t}\n}\n\n/**\n * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\n * @returns {never}\n */\nexport function svelte_boundary_reset_onerror() {\n\tif (DEV) {\n\t\tconst error = new Error(`svelte_boundary_reset_onerror\\nA \\`<svelte:boundary>\\` \\`reset\\` function cannot be called while an error is still being handled\\nhttps://svelte.dev/e/svelte_boundary_reset_onerror`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);\n\t}\n}","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\nvar bold = 'font-weight: bold';\nvar normal = 'font-weight: normal';\n\n/**\n * Assignment to `%property%` property (%location%) will evaluate to the right-hand side, not the value of `%property%` following the assignment. This may result in unexpected behaviour.\n * @param {string} property\n * @param {string} location\n */\nexport function assignment_value_stale(property, location) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] assignment_value_stale\\n%cAssignment to \\`${property}\\` property (${location}) will evaluate to the right-hand side, not the value of \\`${property}\\` following the assignment. This may result in unexpected behaviour.\\nhttps://svelte.dev/e/assignment_value_stale`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/assignment_value_stale`);\n\t}\n}\n\n/**\n * Detected reactivity loss when reading `%name%`. This happens when state is read in an async function after an earlier `await`\n * @param {string} name\n */\nexport function await_reactivity_loss(name) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] await_reactivity_loss\\n%cDetected reactivity loss when reading \\`${name}\\`. This happens when state is read in an async function after an earlier \\`await\\`\\nhttps://svelte.dev/e/await_reactivity_loss`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/await_reactivity_loss`);\n\t}\n}\n\n/**\n * An async derived, `%name%` (%location%) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app\n * @param {string} name\n * @param {string} location\n */\nexport function await_waterfall(name, location) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] await_waterfall\\n%cAn async derived, \\`${name}\\` (${location}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app\\nhttps://svelte.dev/e/await_waterfall`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/await_waterfall`);\n\t}\n}\n\n/**\n * `%binding%` (%location%) is binding to a non-reactive property\n * @param {string} binding\n * @param {string | undefined | null} [location]\n */\nexport function binding_property_non_reactive(binding, location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] binding_property_non_reactive\\n%c${location\n\t\t\t\t? `\\`${binding}\\` (${location}) is binding to a non-reactive property`\n\t\t\t\t: `\\`${binding}\\` is binding to a non-reactive property`}\\nhttps://svelte.dev/e/binding_property_non_reactive`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/binding_property_non_reactive`);\n\t}\n}\n\n/**\n * Your `console.%method%` contained `$state` proxies. Consider using `$inspect(...)` or `$state.snapshot(...)` instead\n * @param {string} method\n */\nexport function console_log_state(method) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] console_log_state\\n%cYour \\`console.${method}\\` contained \\`$state\\` proxies. Consider using \\`$inspect(...)\\` or \\`$state.snapshot(...)\\` instead\\nhttps://svelte.dev/e/console_log_state`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/console_log_state`);\n\t}\n}\n\n/**\n * %handler% should be a function. Did you mean to %suggestion%?\n * @param {string} handler\n * @param {string} suggestion\n */\nexport function event_handler_invalid(handler, suggestion) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] event_handler_invalid\\n%c${handler} should be a function. Did you mean to ${suggestion}?\\nhttps://svelte.dev/e/event_handler_invalid`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/event_handler_invalid`);\n\t}\n}\n\n/**\n * Expected to find a hydratable with key `%key%` during hydration, but did not.\n * @param {string} key\n */\nexport function hydratable_missing_but_expected(key) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] hydratable_missing_but_expected\\n%cExpected to find a hydratable with key \\`${key}\\` during hydration, but did not.\\nhttps://svelte.dev/e/hydratable_missing_but_expected`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydratable_missing_but_expected`);\n\t}\n}\n\n/**\n * The `%attribute%` attribute on `%html%` changed its value between server and client renders. The client value, `%value%`, will be ignored in favour of the server value\n * @param {string} attribute\n * @param {string} html\n * @param {string} value\n */\nexport function hydration_attribute_changed(attribute, html, value) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] hydration_attribute_changed\\n%cThe \\`${attribute}\\` attribute on \\`${html}\\` changed its value between server and client renders. The client value, \\`${value}\\`, will be ignored in favour of the server value\\nhttps://svelte.dev/e/hydration_attribute_changed`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_attribute_changed`);\n\t}\n}\n\n/**\n * The value of an `{@html ...}` block %location% changed between server and client renders. The client value will be ignored in favour of the server value\n * @param {string | undefined | null} [location]\n */\nexport function hydration_html_changed(location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] hydration_html_changed\\n%c${location\n\t\t\t\t? `The value of an \\`{@html ...}\\` block ${location} changed between server and client renders. The client value will be ignored in favour of the server value`\n\t\t\t\t: 'The value of an `{@html ...}` block changed between server and client renders. The client value will be ignored in favour of the server value'}\\nhttps://svelte.dev/e/hydration_html_changed`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_html_changed`);\n\t}\n}\n\n/**\n * Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location%\n * @param {string | undefined | null} [location]\n */\nexport function hydration_mismatch(location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] hydration_mismatch\\n%c${location\n\t\t\t\t? `Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${location}`\n\t\t\t\t: 'Hydration failed because the initial UI does not match what was rendered on the server'}\\nhttps://svelte.dev/e/hydration_mismatch`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_mismatch`);\n\t}\n}\n\n/**\n * The `render` function passed to `createRawSnippet` should return HTML for a single element\n */\nexport function invalid_raw_snippet_render() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] invalid_raw_snippet_render\\n%cThe \\`render\\` function passed to \\`createRawSnippet\\` should return HTML for a single element\\nhttps://svelte.dev/e/invalid_raw_snippet_render`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/invalid_raw_snippet_render`);\n\t}\n}\n\n/**\n * Detected a migrated `$:` reactive block in `%filename%` that both accesses and updates the same reactive value. This may cause recursive updates when converted to an `$effect`.\n * @param {string} filename\n */\nexport function legacy_recursive_reactive_block(filename) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] legacy_recursive_reactive_block\\n%cDetected a migrated \\`$:\\` reactive block in \\`${filename}\\` that both accesses and updates the same reactive value. This may cause recursive updates when converted to an \\`$effect\\`.\\nhttps://svelte.dev/e/legacy_recursive_reactive_block`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/legacy_recursive_reactive_block`);\n\t}\n}\n\n/**\n * Tried to unmount a component that was not mounted\n */\nexport function lifecycle_double_unmount() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] lifecycle_double_unmount\\n%cTried to unmount a component that was not mounted\\nhttps://svelte.dev/e/lifecycle_double_unmount`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/lifecycle_double_unmount`);\n\t}\n}\n\n/**\n * %parent% passed property `%prop%` to %child% with `bind:`, but its parent component %owner% did not declare `%prop%` as a binding. Consider creating a binding between %owner% and %parent% (e.g. `bind:%prop%={...}` instead of `%prop%={...}`)\n * @param {string} parent\n * @param {string} prop\n * @param {string} child\n * @param {string} owner\n */\nexport function ownership_invalid_binding(parent, prop, child, owner) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] ownership_invalid_binding\\n%c${parent} passed property \\`${prop}\\` to ${child} with \\`bind:\\`, but its parent component ${owner} did not declare \\`${prop}\\` as a binding. Consider creating a binding between ${owner} and ${parent} (e.g. \\`bind:${prop}={...}\\` instead of \\`${prop}={...}\\`)\\nhttps://svelte.dev/e/ownership_invalid_binding`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/ownership_invalid_binding`);\n\t}\n}\n\n/**\n * Mutating unbound props (`%name%`, at %location%) is strongly discouraged. Consider using `bind:%prop%={...}` in %parent% (or using a callback) instead\n * @param {string} name\n * @param {string} location\n * @param {string} prop\n * @param {string} parent\n */\nexport function ownership_invalid_mutation(name, location, prop, parent) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] ownership_invalid_mutation\\n%cMutating unbound props (\\`${name}\\`, at ${location}) is strongly discouraged. Consider using \\`bind:${prop}={...}\\` in ${parent} (or using a callback) instead\\nhttps://svelte.dev/e/ownership_invalid_mutation`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/ownership_invalid_mutation`);\n\t}\n}\n\n/**\n * The `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\n */\nexport function select_multiple_invalid_value() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] select_multiple_invalid_value\\n%cThe \\`value\\` property of a \\`<select multiple>\\` element should be an array, but it received a non-array value. The selection will be kept as is.\\nhttps://svelte.dev/e/select_multiple_invalid_value`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/select_multiple_invalid_value`);\n\t}\n}\n\n/**\n * Reactive `$state(...)` proxies and the values they proxy have different identities. Because of this, comparisons with `%operator%` will produce unexpected results\n * @param {string} operator\n */\nexport function state_proxy_equality_mismatch(operator) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] state_proxy_equality_mismatch\\n%cReactive \\`$state(...)\\` proxies and the values they proxy have different identities. Because of this, comparisons with \\`${operator}\\` will produce unexpected results\\nhttps://svelte.dev/e/state_proxy_equality_mismatch`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/state_proxy_equality_mismatch`);\n\t}\n}\n\n/**\n * Tried to unmount a state proxy, rather than a component\n */\nexport function state_proxy_unmount() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] state_proxy_unmount\\n%cTried to unmount a state proxy, rather than a component\\nhttps://svelte.dev/e/state_proxy_unmount`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/state_proxy_unmount`);\n\t}\n}\n\n/**\n * A `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\n */\nexport function svelte_boundary_reset_noop() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] svelte_boundary_reset_noop\\n%cA \\`<svelte:boundary>\\` \\`reset\\` function only resets the boundary the first time it is called\\nhttps://svelte.dev/e/svelte_boundary_reset_noop`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);\n\t}\n}\n\n/**\n * The `slide` transition does not work correctly for elements with `display: %value%`\n * @param {string} value\n */\nexport function transition_slide_display(value) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] transition_slide_display\\n%cThe \\`slide\\` transition does not work correctly for elements with \\`display: ${value}\\`\\nhttps://svelte.dev/e/transition_slide_display`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/transition_slide_display`);\n\t}\n}","/** @import { TemplateNode } from '#client' */\n\nimport { COMMENT_NODE } from '#client/constants';\nimport {\n\tHYDRATION_END,\n\tHYDRATION_ERROR,\n\tHYDRATION_START,\n\tHYDRATION_START_ELSE\n} from '../../../constants.js';\nimport * as w from '../warnings.js';\nimport { get_next_sibling } from './operations.js';\n\n/**\n * Use this variable to guard everything related to hydration code so it can be treeshaken out\n * if the user doesn't use the `hydrate` method and these code paths are therefore not needed.\n */\nexport let hydrating = false;\n\n/** @param {boolean} value */\nexport function set_hydrating(value) {\n\thydrating = value;\n}\n\n/**\n * The node that is currently being hydrated. This starts out as the first node inside the opening\n * <!--[--> comment, and updates each time a component calls `$.child(...)` or `$.sibling(...)`.\n * When entering a block (e.g. `{#if ...}`), `hydrate_node` is the block opening comment; by the\n * time we leave the block it is the closing comment, which serves as the block's anchor.\n * @type {TemplateNode}\n */\nexport let hydrate_node;\n\n/** @param {TemplateNode | null} node */\nexport function set_hydrate_node(node) {\n\tif (node === null) {\n\t\tw.hydration_mismatch();\n\t\tthrow HYDRATION_ERROR;\n\t}\n\n\treturn (hydrate_node = node);\n}\n\nexport function hydrate_next() {\n\treturn set_hydrate_node(get_next_sibling(hydrate_node));\n}\n\n/** @param {TemplateNode} node */\nexport function reset(node) {\n\tif (!hydrating) return;\n\n\t// If the node has remaining siblings, something has gone wrong\n\tif (get_next_sibling(hydrate_node) !== null) {\n\t\tw.hydration_mismatch();\n\t\tthrow HYDRATION_ERROR;\n\t}\n\n\thydrate_node = node;\n}\n\n/**\n * @param {HTMLTemplateElement} template\n */\nexport function hydrate_template(template) {\n\tif (hydrating) {\n\t\t// @ts-expect-error TemplateNode doesn't include DocumentFragment, but it's actually fine\n\t\thydrate_node = template.content;\n\t}\n}\n\nexport function next(count = 1) {\n\tif (hydrating) {\n\t\tvar i = count;\n\t\tvar node = hydrate_node;\n\n\t\twhile (i--) {\n\t\t\tnode = /** @type {TemplateNode} */ (get_next_sibling(node));\n\t\t}\n\n\t\thydrate_node = node;\n\t}\n}\n\n/**\n * Skips or removes (depending on {@link remove}) all nodes starting at `hydrate_node` up until the next hydration end comment\n * @param {boolean} remove\n */\nexport function skip_nodes(remove = true) {\n\tvar depth = 0;\n\tvar node = hydrate_node;\n\n\twhile (true) {\n\t\tif (node.nodeType === COMMENT_NODE) {\n\t\t\tvar data = /** @type {Comment} */ (node).data;\n\n\t\t\tif (data === HYDRATION_END) {\n\t\t\t\tif (depth === 0) return node;\n\t\t\t\tdepth -= 1;\n\t\t\t} else if (\n\t\t\t\tdata === HYDRATION_START ||\n\t\t\t\tdata === HYDRATION_START_ELSE ||\n\t\t\t\t// \"[1\", \"[2\", etc. for if blocks\n\t\t\t\t(data[0] === '[' && !isNaN(Number(data.slice(1))))\n\t\t\t) {\n\t\t\t\tdepth += 1;\n\t\t\t}\n\t\t}\n\n\t\tvar next = /** @type {TemplateNode} */ (get_next_sibling(node));\n\t\tif (remove) node.remove();\n\t\tnode = next;\n\t}\n}\n\n/**\n *\n * @param {TemplateNode} node\n */\nexport function read_hydration_instruction(node) {\n\tif (!node || node.nodeType !== COMMENT_NODE) {\n\t\tw.hydration_mismatch();\n\t\tthrow HYDRATION_ERROR;\n\t}\n\n\treturn /** @type {Comment} */ (node).data;\n}\n","/** @import { Equals } from '#client' */\n\n/** @type {Equals} */\nexport function equals(value) {\n\treturn value === this.v;\n}\n\n/**\n * @param {unknown} a\n * @param {unknown} b\n * @returns {boolean}\n */\nexport function safe_not_equal(a, b) {\n\treturn a != a\n\t\t? b == b\n\t\t: a !== b || (a !== null && typeof a === 'object') || typeof a === 'function';\n}\n\n/**\n * @param {unknown} a\n * @param {unknown} b\n * @returns {boolean}\n */\nexport function not_equal(a, b) {\n\treturn a !== b;\n}\n\n/** @type {Equals} */\nexport function safe_equals(value) {\n\treturn !safe_not_equal(value, this.v);\n}\n","/** True if experimental.async=true */\nexport let async_mode_flag = false;\n/** True if we're not certain that we only have Svelte 5 code in the compilation */\nexport let legacy_mode_flag = false;\n/** True if $inspect.trace is used */\nexport let tracing_mode_flag = false;\n\nexport function enable_async_mode_flag() {\n\tasync_mode_flag = true;\n}\n\n/** ONLY USE THIS DURING TESTING */\nexport function disable_async_mode_flag() {\n\tasync_mode_flag = false;\n}\n\nexport function enable_legacy_mode_flag() {\n\tlegacy_mode_flag = true;\n}\n\nexport function enable_tracing_mode_flag() {\n\ttracing_mode_flag = true;\n}\n","/** @import { Derived, Reaction, Value } from '#client' */\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { snapshot } from '../../shared/clone.js';\nimport { DERIVED, ASYNC, PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants';\nimport { effect_tracking } from '../reactivity/effects.js';\nimport { active_reaction, untrack } from '../runtime.js';\n\n/**\n * @typedef {{\n * traces: Error[];\n * }} TraceEntry\n */\n\n/** @type {{ reaction: Reaction | null, entries: Map<Value, TraceEntry> } | null} */\nexport let tracing_expressions = null;\n\n/**\n * @param {Value} signal\n * @param {TraceEntry} [entry]\n */\nfunction log_entry(signal, entry) {\n\tconst value = signal.v;\n\n\tif (value === UNINITIALIZED) {\n\t\treturn;\n\t}\n\n\tconst type = get_type(signal);\n\tconst current_reaction = /** @type {Reaction} */ (active_reaction);\n\tconst dirty = signal.wv > current_reaction.wv || current_reaction.wv === 0;\n\tconst style = dirty\n\t\t? 'color: CornflowerBlue; font-weight: bold'\n\t\t: 'color: grey; font-weight: normal';\n\n\t// eslint-disable-next-line no-console\n\tconsole.groupCollapsed(\n\t\tsignal.label ? `%c${type}%c ${signal.label}` : `%c${type}%c`,\n\t\tstyle,\n\t\tdirty ? 'font-weight: normal' : style,\n\t\ttypeof value === 'object' && value !== null && STATE_SYMBOL in value\n\t\t\t? snapshot(value, true)\n\t\t\t: value\n\t);\n\n\tif (type === '$derived') {\n\t\tconst deps = new Set(/** @type {Derived} */ (signal).deps);\n\t\tfor (const dep of deps) {\n\t\t\tlog_entry(dep);\n\t\t}\n\t}\n\n\tif (signal.created) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(signal.created);\n\t}\n\n\tif (dirty && signal.updated) {\n\t\tfor (const updated of signal.updated.values()) {\n\t\t\tif (updated.error) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(updated.error);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (entry) {\n\t\tfor (var trace of entry.traces) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log(trace);\n\t\t}\n\t}\n\n\t// eslint-disable-next-line no-console\n\tconsole.groupEnd();\n}\n\n/**\n * @param {Value} signal\n * @returns {'$state' | '$derived' | 'store'}\n */\nfunction get_type(signal) {\n\tif ((signal.f & (DERIVED | ASYNC)) !== 0) return '$derived';\n\treturn signal.label?.startsWith('$') ? 'store' : '$state';\n}\n\n/**\n * @template T\n * @param {() => string} label\n * @param {() => T} fn\n */\nexport function trace(label, fn) {\n\tvar previously_tracing_expressions = tracing_expressions;\n\n\ttry {\n\t\ttracing_expressions = { entries: new Map(), reaction: active_reaction };\n\n\t\tvar start = performance.now();\n\t\tvar value = fn();\n\t\tvar time = (performance.now() - start).toFixed(2);\n\n\t\tvar prefix = untrack(label);\n\n\t\tif (!effect_tracking()) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log(`${prefix} %cran outside of an effect (${time}ms)`, 'color: grey');\n\t\t} else if (tracing_expressions.entries.size === 0) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log(`${prefix} %cno reactive dependencies (${time}ms)`, 'color: grey');\n\t\t} else {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.group(`${prefix} %c(${time}ms)`, 'color: grey');\n\n\t\t\tvar entries = tracing_expressions.entries;\n\n\t\t\tuntrack(() => {\n\t\t\t\tfor (const [signal, traces] of entries) {\n\t\t\t\t\tlog_entry(signal, traces);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\ttracing_expressions = null;\n\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.groupEnd();\n\t\t}\n\n\t\treturn value;\n\t} finally {\n\t\ttracing_expressions = previously_tracing_expressions;\n\t}\n}\n\n/**\n * @param {Value} source\n * @param {string} label\n */\nexport function tag(source, label) {\n\tsource.label = label;\n\ttag_proxy(source.v, label);\n\n\treturn source;\n}\n\n/**\n * @param {unknown} value\n * @param {string} label\n */\nexport function tag_proxy(value, label) {\n\t// @ts-expect-error\n\tvalue?.[PROXY_PATH_SYMBOL]?.(label);\n\treturn value;\n}\n\n/**\n * @param {unknown} value\n */\nexport function label(value) {\n\tif (typeof value === 'symbol') return `Symbol(${value.description})`;\n\tif (typeof value === 'function') return '<function>';\n\tif (typeof value === 'object' && value) return '<object>';\n\treturn String(value);\n}\n","import { DEV } from 'esm-env';\nimport { define_property } from './utils.js';\nimport * as e from './errors.js';\n\n/**\n * @param {string} label\n * @returns {Error & { stack: string } | null}\n */\nexport function get_error(label) {\n\tconst error = new Error();\n\tconst stack = get_stack();\n\n\tif (stack.length === 0) {\n\t\treturn null;\n\t}\n\n\tstack.unshift('\\n');\n\n\tdefine_property(error, 'stack', {\n\t\tvalue: stack.join('\\n')\n\t});\n\n\tdefine_property(error, 'name', {\n\t\tvalue: label\n\t});\n\n\treturn /** @type {Error & { stack: string }} */ (error);\n}\n\n/**\n * @returns {string[]}\n */\nexport function get_stack() {\n\t// @ts-ignore - doesn't exist everywhere\n\tconst limit = Error.stackTraceLimit;\n\t// @ts-ignore - doesn't exist everywhere\n\tError.stackTraceLimit = Infinity;\n\tconst stack = new Error().stack;\n\t// @ts-ignore - doesn't exist everywhere\n\tError.stackTraceLimit = limit;\n\n\tif (!stack) return [];\n\n\tconst lines = stack.split('\\n');\n\tconst new_lines = [];\n\n\tfor (let i = 0; i < lines.length; i++) {\n\t\tconst line = lines[i];\n\t\tconst posixified = line.replaceAll('\\\\', '/');\n\n\t\tif (line.trim() === 'Error') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (line.includes('validate_each_keys')) {\n\t\t\treturn [];\n\t\t}\n\n\t\tif (posixified.includes('svelte/src/internal') || posixified.includes('node_modules/.vite')) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tnew_lines.push(line);\n\t}\n\n\treturn new_lines;\n}\n\n/**\n * @param {boolean} condition\n * @param {string} message\n */\nexport function invariant(condition, message) {\n\tif (!DEV) {\n\t\tthrow new Error('invariant(...) was not guarded by if (DEV)');\n\t}\n\n\tif (!condition) e.invariant_violation(message);\n}\n","/** @import { ComponentContext, DevStackEntry, Effect } from '#client' */\nimport { DEV } from 'esm-env';\nimport * as e from './errors.js';\nimport { active_effect, active_reaction } from './runtime.js';\nimport { create_user_effect } from './reactivity/effects.js';\nimport { async_mode_flag, legacy_mode_flag } from '../flags/index.js';\nimport { FILENAME } from '../../constants.js';\nimport { BRANCH_EFFECT } from './constants.js';\n\n/** @type {ComponentContext | null} */\nexport let component_context = null;\n\n/** @param {ComponentContext | null} context */\nexport function set_component_context(context) {\n\tcomponent_context = context;\n}\n\n/** @type {DevStackEntry | null} */\nexport let dev_stack = null;\n\n/** @param {DevStackEntry | null} stack */\nexport function set_dev_stack(stack) {\n\tdev_stack = stack;\n}\n\n/**\n * Execute a callback with a new dev stack entry\n * @param {() => any} callback - Function to execute\n * @param {DevStackEntry['type']} type - Type of block/component\n * @param {any} component - Component function\n * @param {number} line - Line number\n * @param {number} column - Column number\n * @param {Record<string, any>} [additional] - Any additional properties to add to the dev stack entry\n * @returns {any}\n */\nexport function add_svelte_meta(callback, type, component, line, column, additional) {\n\tconst parent = dev_stack;\n\n\tdev_stack = {\n\t\ttype,\n\t\tfile: component[FILENAME],\n\t\tline,\n\t\tcolumn,\n\t\tparent,\n\t\t...additional\n\t};\n\n\ttry {\n\t\treturn callback();\n\t} finally {\n\t\tdev_stack = parent;\n\t}\n}\n\n/**\n * The current component function. Different from current component context:\n * ```html\n * <!-- App.svelte -->\n * <Foo>\n * <Bar /> <!-- context == Foo.svelte, function == App.svelte -->\n * </Foo>\n * ```\n * @type {ComponentContext['function']}\n */\nexport let dev_current_component_function = null;\n\n/** @param {ComponentContext['function']} fn */\nexport function set_dev_current_component_function(fn) {\n\tdev_current_component_function = fn;\n}\n\n/**\n * Returns a `[get, set]` pair of functions for working with context in a type-safe way.\n *\n * `get` will throw an error if no parent component called `set`.\n *\n * @template T\n * @returns {[() => T, (context: T) => T]}\n * @since 5.40.0\n */\nexport function createContext() {\n\tconst key = {};\n\n\treturn [\n\t\t() => {\n\t\t\tif (!hasContext(key)) {\n\t\t\t\te.missing_context();\n\t\t\t}\n\n\t\t\treturn getContext(key);\n\t\t},\n\t\t(context) => setContext(key, context)\n\t];\n}\n\n/**\n * Retrieves the context that belongs to the closest parent component with the specified `key`.\n * Must be called during component initialisation.\n *\n * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative.\n *\n * @template T\n * @param {any} key\n * @returns {T}\n */\nexport function getContext(key) {\n\tconst context_map = get_or_init_context_map('getContext');\n\tconst result = /** @type {T} */ (context_map.get(key));\n\treturn result;\n}\n\n/**\n * Associates an arbitrary `context` object with the current component and the specified `key`\n * and returns that object. The context is then available to children of the component\n * (including slotted content) with `getContext`.\n *\n * Like lifecycle functions, this must be called during component initialisation.\n *\n * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative.\n *\n * @template T\n * @param {any} key\n * @param {T} context\n * @returns {T}\n */\nexport function setContext(key, context) {\n\tconst context_map = get_or_init_context_map('setContext');\n\n\tif (async_mode_flag) {\n\t\tvar flags = /** @type {Effect} */ (active_effect).f;\n\t\tvar valid =\n\t\t\t!active_reaction &&\n\t\t\t(flags & BRANCH_EFFECT) !== 0 &&\n\t\t\t// pop() runs synchronously, so this indicates we're setting context after an await\n\t\t\t!(/** @type {ComponentContext} */ (component_context).i);\n\n\t\tif (!valid) {\n\t\t\te.set_context_after_init();\n\t\t}\n\t}\n\n\tcontext_map.set(key, context);\n\treturn context;\n}\n\n/**\n * Checks whether a given `key` has been set in the context of a parent component.\n * Must be called during component initialisation.\n *\n * @param {any} key\n * @returns {boolean}\n */\nexport function hasContext(key) {\n\tconst context_map = get_or_init_context_map('hasContext');\n\treturn context_map.has(key);\n}\n\n/**\n * Retrieves the whole context map that belongs to the closest parent component.\n * Must be called during component initialisation. Useful, for example, if you\n * programmatically create a component and want to pass the existing context to it.\n *\n * @template {Map<any, any>} [T=Map<any, any>]\n * @returns {T}\n */\nexport function getAllContexts() {\n\tconst context_map = get_or_init_context_map('getAllContexts');\n\treturn /** @type {T} */ (context_map);\n}\n\n/**\n * @param {Record<string, unknown>} props\n * @param {any} runes\n * @param {Function} [fn]\n * @returns {void}\n */\nexport function push(props, runes = false, fn) {\n\tcomponent_context = {\n\t\tp: component_context,\n\t\ti: false,\n\t\tc: null,\n\t\te: null,\n\t\ts: props,\n\t\tx: null,\n\t\tr: /** @type {Effect} */ (active_effect),\n\t\tl: legacy_mode_flag && !runes ? { s: null, u: null, $: [] } : null\n\t};\n\n\tif (DEV) {\n\t\t// component function\n\t\tcomponent_context.function = fn;\n\t\tdev_current_component_function = fn;\n\t}\n}\n\n/**\n * @template {Record<string, any>} T\n * @param {T} [component]\n * @returns {T}\n */\nexport function pop(component) {\n\tvar context = /** @type {ComponentContext} */ (component_context);\n\tvar effects = context.e;\n\n\tif (effects !== null) {\n\t\tcontext.e = null;\n\n\t\tfor (var fn of effects) {\n\t\t\tcreate_user_effect(fn);\n\t\t}\n\t}\n\n\tif (component !== undefined) {\n\t\tcontext.x = component;\n\t}\n\n\tcontext.i = true;\n\n\tcomponent_context = context.p;\n\n\tif (DEV) {\n\t\tdev_current_component_function = component_context?.function ?? null;\n\t}\n\n\treturn component ?? /** @type {T} */ ({});\n}\n\n/** @returns {boolean} */\nexport function is_runes() {\n\treturn !legacy_mode_flag || (component_context !== null && component_context.l === null);\n}\n\n/**\n * @param {string} name\n * @returns {Map<unknown, unknown>}\n */\nfunction get_or_init_context_map(name) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component(name);\n\t}\n\n\treturn (component_context.c ??= new Map(get_parent_context(component_context) || undefined));\n}\n\n/**\n * @param {ComponentContext} component_context\n * @returns {Map<unknown, unknown> | null}\n */\nfunction get_parent_context(component_context) {\n\tlet parent = component_context.p;\n\twhile (parent !== null) {\n\t\tconst context_map = parent.c;\n\t\tif (context_map !== null) {\n\t\t\treturn context_map;\n\t\t}\n\t\tparent = parent.p;\n\t}\n\treturn null;\n}\n","import { run_all } from '../../shared/utils.js';\nimport { is_flushing_sync } from '../reactivity/batch.js';\n\n/** @type {Array<() => void>} */\nlet micro_tasks = [];\n\nfunction run_micro_tasks() {\n\tvar tasks = micro_tasks;\n\tmicro_tasks = [];\n\trun_all(tasks);\n}\n\n/**\n * @param {() => void} fn\n */\nexport function queue_micro_task(fn) {\n\tif (micro_tasks.length === 0 && !is_flushing_sync) {\n\t\tvar tasks = micro_tasks;\n\t\tqueueMicrotask(() => {\n\t\t\t// If this is false, a flushSync happened in the meantime. Do _not_ run new scheduled microtasks in that case\n\t\t\t// as the ordering of microtasks would be broken at that point - consider this case:\n\t\t\t// - queue_micro_task schedules microtask A to flush task X\n\t\t\t// - synchronously after, flushSync runs, processing task X\n\t\t\t// - synchronously after, some other microtask B is scheduled, but not through queue_micro_task but for example a Promise.resolve() in user code\n\t\t\t// - synchronously after, queue_micro_task schedules microtask C to flush task Y\n\t\t\t// - one tick later, microtask A now resolves, flushing task Y before microtask B, which is incorrect\n\t\t\t// This if check prevents that race condition (that realistically will only happen in tests)\n\t\t\tif (tasks === micro_tasks) run_micro_tasks();\n\t\t});\n\t}\n\n\tmicro_tasks.push(fn);\n}\n\n/**\n * Synchronously run any queued tasks.\n */\nexport function flush_tasks() {\n\twhile (micro_tasks.length > 0) {\n\t\trun_micro_tasks();\n\t}\n}\n","/** @import { Derived, Effect } from '#client' */\n/** @import { Boundary } from './dom/blocks/boundary.js' */\nimport { DEV } from 'esm-env';\nimport { FILENAME } from '../../constants.js';\nimport { is_firefox } from './dom/operations.js';\nimport { ERROR_VALUE, BOUNDARY_EFFECT, REACTION_RAN, EFFECT } from './constants.js';\nimport { define_property, get_descriptor } from '../shared/utils.js';\nimport { active_effect, active_reaction } from './runtime.js';\n\nconst adjustments = new WeakMap();\n\n/**\n * @param {unknown} error\n */\nexport function handle_error(error) {\n\tvar effect = active_effect;\n\n\t// for unowned deriveds, don't throw until we read the value\n\tif (effect === null) {\n\t\t/** @type {Derived} */ (active_reaction).f |= ERROR_VALUE;\n\t\treturn error;\n\t}\n\n\tif (DEV && error instanceof Error && !adjustments.has(error)) {\n\t\tadjustments.set(error, get_adjustments(error, effect));\n\t}\n\n\t// if the error occurred while creating this subtree, we let it\n\t// bubble up until it hits a boundary that can handle it, unless\n\t// it's an $effect in which case it doesn't run immediately\n\tif ((effect.f & REACTION_RAN) === 0 && (effect.f & EFFECT) === 0) {\n\t\tif (DEV && !effect.parent && error instanceof Error) {\n\t\t\tapply_adjustments(error);\n\t\t}\n\n\t\tthrow error;\n\t}\n\n\t// otherwise we bubble up the effect tree ourselves\n\tinvoke_error_boundary(error, effect);\n}\n\n/**\n * @param {unknown} error\n * @param {Effect | null} effect\n */\nexport function invoke_error_boundary(error, effect) {\n\twhile (effect !== null) {\n\t\tif ((effect.f & BOUNDARY_EFFECT) !== 0) {\n\t\t\tif ((effect.f & REACTION_RAN) === 0) {\n\t\t\t\t// we are still creating the boundary effect\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t/** @type {Boundary} */ (effect.b).error(error);\n\t\t\t\treturn;\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\t\t}\n\n\t\teffect = effect.parent;\n\t}\n\n\tif (DEV && error instanceof Error) {\n\t\tapply_adjustments(error);\n\t}\n\n\tthrow error;\n}\n\n/**\n * Add useful information to the error message/stack in development\n * @param {Error} error\n * @param {Effect} effect\n */\nfunction get_adjustments(error, effect) {\n\tconst message_descriptor = get_descriptor(error, 'message');\n\n\t// if the message was already changed and it's not configurable we can't change it\n\t// or it will throw a different error swallowing the original error\n\tif (message_descriptor && !message_descriptor.configurable) return;\n\n\tvar indent = is_firefox ? ' ' : '\\t';\n\tvar component_stack = `\\n${indent}in ${effect.fn?.name || '<unknown>'}`;\n\tvar context = effect.ctx;\n\n\twhile (context !== null) {\n\t\tcomponent_stack += `\\n${indent}in ${context.function?.[FILENAME].split('/').pop()}`;\n\t\tcontext = context.p;\n\t}\n\n\treturn {\n\t\tmessage: error.message + `\\n${component_stack}\\n`,\n\t\tstack: error.stack\n\t\t\t?.split('\\n')\n\t\t\t.filter((line) => !line.includes('svelte/src/internal'))\n\t\t\t.join('\\n')\n\t};\n}\n\n/**\n * @param {Error} error\n */\nfunction apply_adjustments(error) {\n\tconst adjusted = adjustments.get(error);\n\n\tif (adjusted) {\n\t\tdefine_property(error, 'message', {\n\t\t\tvalue: adjusted.message\n\t\t});\n\n\t\tdefine_property(error, 'stack', {\n\t\t\tvalue: adjusted.stack\n\t\t});\n\t}\n}\n","/** @import { Derived, Signal } from '#client' */\nimport { CLEAN, CONNECTED, DIRTY, MAYBE_DIRTY } from '#client/constants';\n\nconst STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);\n\n/**\n * @param {Signal} signal\n * @param {number} status\n */\nexport function set_signal_status(signal, status) {\n\tsignal.f = (signal.f & STATUS_MASK) | status;\n}\n\n/**\n * Set a derived's status to CLEAN or MAYBE_DIRTY based on its connection state.\n * @param {Derived} derived\n */\nexport function update_derived_status(derived) {\n\t// Only mark as MAYBE_DIRTY if disconnected and has dependencies.\n\tif ((derived.f & CONNECTED) !== 0 || derived.deps === null) {\n\t\tset_signal_status(derived, CLEAN);\n\t} else {\n\t\tset_signal_status(derived, MAYBE_DIRTY);\n\t}\n}\n","/** @import { Derived, Effect, Value } from '#client' */\nimport { CLEAN, DERIVED, DIRTY, MAYBE_DIRTY, WAS_MARKED } from '#client/constants';\nimport { set_signal_status } from './status.js';\n\n/**\n * @param {Value[] | null} deps\n */\nfunction clear_marked(deps) {\n\tif (deps === null) return;\n\n\tfor (const dep of deps) {\n\t\tif ((dep.f & DERIVED) === 0 || (dep.f & WAS_MARKED) === 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tdep.f ^= WAS_MARKED;\n\n\t\tclear_marked(/** @type {Derived} */ (dep).deps);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {Set<Effect>} dirty_effects\n * @param {Set<Effect>} maybe_dirty_effects\n */\nexport function defer_effect(effect, dirty_effects, maybe_dirty_effects) {\n\tif ((effect.f & DIRTY) !== 0) {\n\t\tdirty_effects.add(effect);\n\t} else if ((effect.f & MAYBE_DIRTY) !== 0) {\n\t\tmaybe_dirty_effects.add(effect);\n\t}\n\n\t// Since we're not executing these effects now, we need to clear any WAS_MARKED flags\n\t// so that other batches can correctly reach these effects during their own traversal\n\tclear_marked(effect.deps);\n\n\t// mark as clean so they get scheduled if they depend on pending async state\n\tset_signal_status(effect, CLEAN);\n}\n","/** @import { StoreReferencesContainer } from '#client' */\n/** @import { Store } from '#shared' */\nimport { subscribe_to_store } from '../../../store/utils.js';\nimport { get as get_store } from '../../../store/shared/index.js';\nimport { define_property, noop } from '../../shared/utils.js';\nimport { get } from '../runtime.js';\nimport { teardown } from './effects.js';\nimport { mutable_source, set } from './sources.js';\nimport { DEV } from 'esm-env';\n\n/**\n * We set this to `true` when updating a store so that we correctly\n * schedule effects if the update takes place inside a `$:` effect\n */\nexport let legacy_is_updating_store = false;\n\n/**\n * Whether or not the prop currently being read is a store binding, as in\n * `<Child bind:x={$y} />`. If it is, we treat the prop as mutable even in\n * runes mode, and skip `binding_property_non_reactive` validation\n */\nlet is_store_binding = false;\n\nlet IS_UNMOUNTED = Symbol();\n\n/**\n * Gets the current value of a store. If the store isn't subscribed to yet, it will create a proxy\n * signal that will be updated when the store is. The store references container is needed to\n * track reassignments to stores and to track the correct component context.\n * @template V\n * @param {Store<V> | null | undefined} store\n * @param {string} store_name\n * @param {StoreReferencesContainer} stores\n * @returns {V}\n */\nexport function store_get(store, store_name, stores) {\n\tconst entry = (stores[store_name] ??= {\n\t\tstore: null,\n\t\tsource: mutable_source(undefined),\n\t\tunsubscribe: noop\n\t});\n\n\tif (DEV) {\n\t\tentry.source.label = store_name;\n\t}\n\n\t// if the component that setup this is already unmounted we don't want to register a subscription\n\tif (entry.store !== store && !(IS_UNMOUNTED in stores)) {\n\t\tentry.unsubscribe();\n\t\tentry.store = store ?? null;\n\n\t\tif (store == null) {\n\t\t\tentry.source.v = undefined; // see synchronous callback comment below\n\t\t\tentry.unsubscribe = noop;\n\t\t} else {\n\t\t\tvar is_synchronous_callback = true;\n\n\t\t\tentry.unsubscribe = subscribe_to_store(store, (v) => {\n\t\t\t\tif (is_synchronous_callback) {\n\t\t\t\t\t// If the first updates to the store value (possibly multiple of them) are synchronously\n\t\t\t\t\t// inside a derived, we will hit the `state_unsafe_mutation` error if we `set` the value\n\t\t\t\t\tentry.source.v = v;\n\t\t\t\t} else {\n\t\t\t\t\tset(entry.source, v);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tis_synchronous_callback = false;\n\t\t}\n\t}\n\n\t// if the component that setup this stores is already unmounted the source will be out of sync\n\t// so we just use the `get` for the stores, less performant but it avoids to create a memory leak\n\t// and it will keep the value consistent\n\tif (store && IS_UNMOUNTED in stores) {\n\t\treturn get_store(store);\n\t}\n\n\treturn get(entry.source);\n}\n\n/**\n * Unsubscribe from a store if it's not the same as the one in the store references container.\n * We need this in addition to `store_get` because someone could unsubscribe from a store but\n * then never subscribe to the new one (if any), causing the subscription to stay open wrongfully.\n * @param {Store<any> | null | undefined} store\n * @param {string} store_name\n * @param {StoreReferencesContainer} stores\n */\nexport function store_unsub(store, store_name, stores) {\n\t/** @type {StoreReferencesContainer[''] | undefined} */\n\tlet entry = stores[store_name];\n\n\tif (entry && entry.store !== store) {\n\t\t// Don't reset store yet, so that store_get above can resubscribe to new store if necessary\n\t\tentry.unsubscribe();\n\t\tentry.unsubscribe = noop;\n\t}\n\n\treturn store;\n}\n\n/**\n * Sets the new value of a store and returns that value.\n * @template V\n * @param {Store<V>} store\n * @param {V} value\n * @returns {V}\n */\nexport function store_set(store, value) {\n\tupdate_with_flag(store, value);\n\treturn value;\n}\n\n/**\n * @param {StoreReferencesContainer} stores\n * @param {string} store_name\n */\nexport function invalidate_store(stores, store_name) {\n\tvar entry = stores[store_name];\n\tif (entry.store !== null) {\n\t\tstore_set(entry.store, entry.source.v);\n\t}\n}\n\n/**\n * Unsubscribes from all auto-subscribed stores on destroy\n * @returns {[StoreReferencesContainer, ()=>void]}\n */\nexport function setup_stores() {\n\t/** @type {StoreReferencesContainer} */\n\tconst stores = {};\n\n\tfunction cleanup() {\n\t\tteardown(() => {\n\t\t\tfor (var store_name in stores) {\n\t\t\t\tconst ref = stores[store_name];\n\t\t\t\tref.unsubscribe();\n\t\t\t}\n\t\t\tdefine_property(stores, IS_UNMOUNTED, {\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: true\n\t\t\t});\n\t\t});\n\t}\n\n\treturn [stores, cleanup];\n}\n\n/**\n * @param {Store<V>} store\n * @param {V} value\n * @template V\n */\nfunction update_with_flag(store, value) {\n\tlegacy_is_updating_store = true;\n\n\ttry {\n\t\tstore.set(value);\n\t} finally {\n\t\tlegacy_is_updating_store = false;\n\t}\n}\n\n/**\n * Updates a store with a new value.\n * @param {Store<V>} store the store to update\n * @param {any} expression the expression that mutates the store\n * @param {V} new_value the new store value\n * @template V\n */\nexport function store_mutate(store, expression, new_value) {\n\tupdate_with_flag(store, new_value);\n\treturn expression;\n}\n\n/**\n * @param {Store<number>} store\n * @param {number} store_value\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_store(store, store_value, d = 1) {\n\tupdate_with_flag(store, store_value + d);\n\treturn store_value;\n}\n\n/**\n * @param {Store<number>} store\n * @param {number} store_value\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_pre_store(store, store_value, d = 1) {\n\tconst value = store_value + d;\n\tupdate_with_flag(store, value);\n\treturn value;\n}\n\n/**\n * Called inside prop getters to communicate that the prop is a store binding\n */\nexport function mark_store_binding() {\n\tis_store_binding = true;\n}\n\n/**\n * Returns a tuple that indicates whether `fn()` reads a prop that is a store binding.\n * Used to prevent `binding_property_non_reactive` validation false positives and\n * ensure that these props are treated as mutable even in runes mode\n * @template T\n * @param {() => T} fn\n * @returns {[T, boolean]}\n */\nexport function capture_store_binding(fn) {\n\tvar previous_is_store_binding = is_store_binding;\n\n\ttry {\n\t\tis_store_binding = false;\n\t\treturn [fn(), is_store_binding];\n\t} finally {\n\t\tis_store_binding = previous_is_store_binding;\n\t}\n}\n","/** @import { Fork } from 'svelte' */\n/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */\nimport {\n\tBLOCK_EFFECT,\n\tBRANCH_EFFECT,\n\tCLEAN,\n\tDESTROYED,\n\tDIRTY,\n\tEFFECT,\n\tASYNC,\n\tINERT,\n\tRENDER_EFFECT,\n\tROOT_EFFECT,\n\tMAYBE_DIRTY,\n\tDERIVED,\n\tEAGER_EFFECT,\n\tERROR_VALUE,\n\tMANAGED_EFFECT,\n\tREACTION_RAN\n} from '#client/constants';\nimport { async_mode_flag } from '../../flags/index.js';\nimport { deferred, define_property, includes } from '../../shared/utils.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tincrement_write_version,\n\tis_dirty,\n\tupdate_effect\n} from '../runtime.js';\nimport * as e from '../errors.js';\nimport { flush_tasks, queue_micro_task } from '../dom/task.js';\nimport { DEV } from 'esm-env';\nimport { invoke_error_boundary } from '../error-handling.js';\nimport { flush_eager_effects, old_values, set_eager_effects, source, update } from './sources.js';\nimport { eager_effect, unlink_effect } from './effects.js';\nimport { defer_effect } from './utils.js';\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { set_signal_status } from './status.js';\nimport { legacy_is_updating_store } from './store.js';\nimport { invariant } from '../../shared/dev.js';\nimport { log_effect_tree } from '../dev/debug.js';\n\n/** @type {Set<Batch>} */\nconst batches = new Set();\n\n/** @type {Batch | null} */\nexport let current_batch = null;\n\n/**\n * This is needed to avoid overwriting inputs\n * @type {Batch | null}\n */\nexport let previous_batch = null;\n\n/**\n * When time travelling (i.e. working in one batch, while other batches\n * still have ongoing work), we ignore the real values of affected\n * signals in favour of their values within the batch\n * @type {Map<Value, any> | null}\n */\nexport let batch_values = null;\n\n/** @type {Effect | null} */\nlet last_scheduled_effect = null;\n\nexport let is_flushing_sync = false;\nlet is_processing = false;\n\n/**\n * During traversal, this is an array. Newly created effects are (if not immediately\n * executed) pushed to this array, rather than going through the scheduling\n * rigamarole that would cause another turn of the flush loop.\n * @type {Effect[] | null}\n */\nexport let collected_effects = null;\n\n/**\n * An array of effects that are marked during traversal as a result of a `set`\n * (not `internal_set`) call. These will be added to the next batch and\n * trigger another `batch.process()`\n * @type {Effect[] | null}\n * @deprecated when we get rid of legacy mode and stores, we can get rid of this\n */\nexport let legacy_updates = null;\n\nvar flush_count = 0;\nvar source_stacks = DEV ? new Set() : null;\n\nlet uid = 1;\n\nexport class Batch {\n\t// for debugging. TODO remove once async is stable\n\tid = uid++;\n\n\t/**\n\t * The current values of any sources that are updated in this batch\n\t * They keys of this map are identical to `this.#previous`\n\t * @type {Map<Source, any>}\n\t */\n\tcurrent = new Map();\n\n\t/**\n\t * The values of any sources that are updated in this batch _before_ those updates took place.\n\t * They keys of this map are identical to `this.#current`\n\t * @type {Map<Source, any>}\n\t */\n\tprevious = new Map();\n\n\t/**\n\t * When the batch is committed (and the DOM is updated), we need to remove old branches\n\t * and append new ones by calling the functions added inside (if/each/key/etc) blocks\n\t * @type {Set<(batch: Batch) => void>}\n\t */\n\t#commit_callbacks = new Set();\n\n\t/**\n\t * If a fork is discarded, we need to destroy any effects that are no longer needed\n\t * @type {Set<(batch: Batch) => void>}\n\t */\n\t#discard_callbacks = new Set();\n\n\t/**\n\t * The number of async effects that are currently in flight\n\t */\n\t#pending = 0;\n\n\t/**\n\t * The number of async effects that are currently in flight, _not_ inside a pending boundary\n\t */\n\t#blocking_pending = 0;\n\n\t/**\n\t * A deferred that resolves when the batch is committed, used with `settled()`\n\t * TODO replace with Promise.withResolvers once supported widely enough\n\t * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}\n\t */\n\t#deferred = null;\n\n\t/**\n\t * The root effects that need to be flushed\n\t * @type {Effect[]}\n\t */\n\t#roots = [];\n\n\t/**\n\t * Deferred effects (which run after async work has completed) that are DIRTY\n\t * @type {Set<Effect>}\n\t */\n\t#dirty_effects = new Set();\n\n\t/**\n\t * Deferred effects that are MAYBE_DIRTY\n\t * @type {Set<Effect>}\n\t */\n\t#maybe_dirty_effects = new Set();\n\n\t/**\n\t * A map of branches that still exist, but will be destroyed when this batch\n\t * is committed — we skip over these during `process`.\n\t * The value contains child effects that were dirty/maybe_dirty before being reset,\n\t * so they can be rescheduled if the branch survives.\n\t * @type {Map<Effect, { d: Effect[], m: Effect[] }>}\n\t */\n\t#skipped_branches = new Map();\n\n\tis_fork = false;\n\n\t#decrement_queued = false;\n\n\t#is_deferred() {\n\t\treturn this.is_fork || this.#blocking_pending > 0;\n\t}\n\n\t/**\n\t * Add an effect to the #skipped_branches map and reset its children\n\t * @param {Effect} effect\n\t */\n\tskip_effect(effect) {\n\t\tif (!this.#skipped_branches.has(effect)) {\n\t\t\tthis.#skipped_branches.set(effect, { d: [], m: [] });\n\t\t}\n\t}\n\n\t/**\n\t * Remove an effect from the #skipped_branches map and reschedule\n\t * any tracked dirty/maybe_dirty child effects\n\t * @param {Effect} effect\n\t */\n\tunskip_effect(effect) {\n\t\tvar tracked = this.#skipped_branches.get(effect);\n\t\tif (tracked) {\n\t\t\tthis.#skipped_branches.delete(effect);\n\n\t\t\tfor (var e of tracked.d) {\n\t\t\t\tset_signal_status(e, DIRTY);\n\t\t\t\tthis.schedule(e);\n\t\t\t}\n\n\t\t\tfor (e of tracked.m) {\n\t\t\t\tset_signal_status(e, MAYBE_DIRTY);\n\t\t\t\tthis.schedule(e);\n\t\t\t}\n\t\t}\n\t}\n\n\t#process() {\n\t\tif (flush_count++ > 1000) {\n\t\t\tbatches.delete(this);\n\t\t\tinfinite_loop_guard();\n\t\t}\n\n\t\t// we only reschedule previously-deferred effects if we expect\n\t\t// to be able to run them after processing the batch\n\t\tif (!this.#is_deferred()) {\n\t\t\tfor (const e of this.#dirty_effects) {\n\t\t\t\tthis.#maybe_dirty_effects.delete(e);\n\t\t\t\tset_signal_status(e, DIRTY);\n\t\t\t\tthis.schedule(e);\n\t\t\t}\n\n\t\t\tfor (const e of this.#maybe_dirty_effects) {\n\t\t\t\tset_signal_status(e, MAYBE_DIRTY);\n\t\t\t\tthis.schedule(e);\n\t\t\t}\n\t\t}\n\n\t\tconst roots = this.#roots;\n\t\tthis.#roots = [];\n\n\t\tthis.apply();\n\n\t\t/** @type {Effect[]} */\n\t\tvar effects = (collected_effects = []);\n\n\t\t/** @type {Effect[]} */\n\t\tvar render_effects = [];\n\n\t\t/**\n\t\t * @type {Effect[]}\n\t\t * @deprecated when we get rid of legacy mode and stores, we can get rid of this\n\t\t */\n\t\tvar updates = (legacy_updates = []);\n\n\t\tfor (const root of roots) {\n\t\t\ttry {\n\t\t\t\tthis.#traverse(root, effects, render_effects);\n\t\t\t} catch (e) {\n\t\t\t\treset_all(root);\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\n\t\t// any writes should take effect in a subsequent batch\n\t\tcurrent_batch = null;\n\n\t\tif (updates.length > 0) {\n\t\t\tvar batch = Batch.ensure();\n\t\t\tfor (const e of updates) {\n\t\t\t\tbatch.schedule(e);\n\t\t\t}\n\t\t}\n\n\t\tcollected_effects = null;\n\t\tlegacy_updates = null;\n\n\t\tif (this.#is_deferred()) {\n\t\t\tthis.#defer_effects(render_effects);\n\t\t\tthis.#defer_effects(effects);\n\n\t\t\tfor (const [e, t] of this.#skipped_branches) {\n\t\t\t\treset_branch(e, t);\n\t\t\t}\n\t\t} else {\n\t\t\tif (this.#pending === 0) {\n\t\t\t\tbatches.delete(this);\n\t\t\t}\n\n\t\t\t// clear effects. Those that are still needed will be rescheduled through unskipping the skipped branches.\n\t\t\tthis.#dirty_effects.clear();\n\t\t\tthis.#maybe_dirty_effects.clear();\n\n\t\t\t// append/remove branches\n\t\t\tfor (const fn of this.#commit_callbacks) fn(this);\n\t\t\tthis.#commit_callbacks.clear();\n\n\t\t\tprevious_batch = this;\n\t\t\tflush_queued_effects(render_effects);\n\t\t\tflush_queued_effects(effects);\n\t\t\tprevious_batch = null;\n\n\t\t\tthis.#deferred?.resolve();\n\t\t}\n\n\t\tvar next_batch = /** @type {Batch | null} */ (/** @type {unknown} */ (current_batch));\n\n\t\t// Edge case: During traversal new branches might create effects that run immediately and set state,\n\t\t// causing an effect and therefore a root to be scheduled again. We need to traverse the current batch\n\t\t// once more in that case - most of the time this will just clean up dirty branches.\n\t\tif (this.#roots.length > 0) {\n\t\t\tconst batch = (next_batch ??= this);\n\t\t\tbatch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r)));\n\t\t}\n\n\t\tif (next_batch !== null) {\n\t\t\tbatches.add(next_batch);\n\n\t\t\tif (DEV) {\n\t\t\t\tfor (const source of this.current.keys()) {\n\t\t\t\t\t/** @type {Set<Source>} */ (source_stacks).add(source);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnext_batch.#process();\n\t\t}\n\n\t\tif (!batches.has(this)) {\n\t\t\tthis.#commit();\n\t\t}\n\t}\n\n\t/**\n\t * Traverse the effect tree, executing effects or stashing\n\t * them for later execution as appropriate\n\t * @param {Effect} root\n\t * @param {Effect[]} effects\n\t * @param {Effect[]} render_effects\n\t */\n\t#traverse(root, effects, render_effects) {\n\t\troot.f ^= CLEAN;\n\n\t\tvar effect = root.first;\n\n\t\twhile (effect !== null) {\n\t\t\tvar flags = effect.f;\n\t\t\tvar is_branch = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;\n\t\t\tvar is_skippable_branch = is_branch && (flags & CLEAN) !== 0;\n\n\t\t\tvar skip = is_skippable_branch || (flags & INERT) !== 0 || this.#skipped_branches.has(effect);\n\n\t\t\tif (!skip && effect.fn !== null) {\n\t\t\t\tif (is_branch) {\n\t\t\t\t\teffect.f ^= CLEAN;\n\t\t\t\t} else if ((flags & EFFECT) !== 0) {\n\t\t\t\t\teffects.push(effect);\n\t\t\t\t} else if (async_mode_flag && (flags & (RENDER_EFFECT | MANAGED_EFFECT)) !== 0) {\n\t\t\t\t\trender_effects.push(effect);\n\t\t\t\t} else if (is_dirty(effect)) {\n\t\t\t\t\tif ((flags & BLOCK_EFFECT) !== 0) this.#maybe_dirty_effects.add(effect);\n\t\t\t\t\tupdate_effect(effect);\n\t\t\t\t}\n\n\t\t\t\tvar child = effect.first;\n\n\t\t\t\tif (child !== null) {\n\t\t\t\t\teffect = child;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twhile (effect !== null) {\n\t\t\t\tvar next = effect.next;\n\n\t\t\t\tif (next !== null) {\n\t\t\t\t\teffect = next;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\teffect = effect.parent;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {Effect[]} effects\n\t */\n\t#defer_effects(effects) {\n\t\tfor (var i = 0; i < effects.length; i += 1) {\n\t\t\tdefer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);\n\t\t}\n\t}\n\n\t/**\n\t * Associate a change to a given source with the current\n\t * batch, noting its previous and current values\n\t * @param {Source} source\n\t * @param {any} old_value\n\t */\n\tcapture(source, old_value) {\n\t\tif (old_value !== UNINITIALIZED && !this.previous.has(source)) {\n\t\t\tthis.previous.set(source, old_value);\n\t\t}\n\n\t\t// Don't save errors in `batch_values`, or they won't be thrown in `runtime.js#get`\n\t\tif ((source.f & ERROR_VALUE) === 0) {\n\t\t\tthis.current.set(source, source.v);\n\t\t\tbatch_values?.set(source, source.v);\n\t\t}\n\t}\n\n\tactivate() {\n\t\tcurrent_batch = this;\n\t}\n\n\tdeactivate() {\n\t\tcurrent_batch = null;\n\t\tbatch_values = null;\n\t}\n\n\tflush() {\n\t\tvar source_stacks = DEV ? new Set() : null;\n\n\t\ttry {\n\t\t\tis_processing = true;\n\t\t\tcurrent_batch = this;\n\n\t\t\tthis.#process();\n\t\t} finally {\n\t\t\tflush_count = 0;\n\t\t\tlast_scheduled_effect = null;\n\t\t\tcollected_effects = null;\n\t\t\tlegacy_updates = null;\n\t\t\tis_processing = false;\n\n\t\t\tcurrent_batch = null;\n\t\t\tbatch_values = null;\n\n\t\t\told_values.clear();\n\n\t\t\tif (DEV) {\n\t\t\t\tfor (const source of /** @type {Set<Source>} */ (source_stacks)) {\n\t\t\t\t\tsource.updated = null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tdiscard() {\n\t\tfor (const fn of this.#discard_callbacks) fn(this);\n\t\tthis.#discard_callbacks.clear();\n\n\t\tbatches.delete(this);\n\t}\n\n\t#commit() {\n\t\t// If there are other pending batches, they now need to be 'rebased' —\n\t\t// in other words, we re-run block/async effects with the newly\n\t\t// committed state, unless the batch in question has a more\n\t\t// recent value for a given source\n\t\tfor (const batch of batches) {\n\t\t\tvar is_earlier = batch.id < this.id;\n\n\t\t\t/** @type {Source[]} */\n\t\t\tvar sources = [];\n\n\t\t\tfor (const [source, value] of this.current) {\n\t\t\t\tif (batch.current.has(source)) {\n\t\t\t\t\tif (is_earlier && value !== batch.current.get(source)) {\n\t\t\t\t\t\t// bring the value up to date\n\t\t\t\t\t\tbatch.current.set(source, value);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// same value or later batch has more recent value,\n\t\t\t\t\t\t// no need to re-run these effects\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsources.push(source);\n\t\t\t}\n\n\t\t\t// Re-run async/block effects that depend on distinct values changed in both batches\n\t\t\tvar others = [...batch.current.keys()].filter((s) => !this.current.has(s));\n\n\t\t\tif (others.length === 0) {\n\t\t\t\tif (is_earlier) {\n\t\t\t\t\t// this batch is now obsolete and can be discarded\n\t\t\t\t\tbatch.discard();\n\t\t\t\t}\n\t\t\t} else if (sources.length > 0) {\n\t\t\t\tif (DEV) {\n\t\t\t\t\tinvariant(batch.#roots.length === 0, 'Batch has scheduled roots');\n\t\t\t\t}\n\n\t\t\t\tbatch.activate();\n\n\t\t\t\t/** @type {Set<Value>} */\n\t\t\t\tvar marked = new Set();\n\n\t\t\t\t/** @type {Map<Reaction, boolean>} */\n\t\t\t\tvar checked = new Map();\n\n\t\t\t\tfor (var source of sources) {\n\t\t\t\t\tmark_effects(source, others, marked, checked);\n\t\t\t\t}\n\n\t\t\t\t// Only apply and traverse when we know we triggered async work with marking the effects\n\t\t\t\tif (batch.#roots.length > 0) {\n\t\t\t\t\tbatch.apply();\n\n\t\t\t\t\tfor (var root of batch.#roots) {\n\t\t\t\t\t\tbatch.#traverse(root, [], []);\n\t\t\t\t\t}\n\n\t\t\t\t\tbatch.#roots = [];\n\t\t\t\t}\n\n\t\t\t\tbatch.deactivate();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {boolean} blocking\n\t */\n\tincrement(blocking) {\n\t\tthis.#pending += 1;\n\t\tif (blocking) this.#blocking_pending += 1;\n\t}\n\n\t/**\n\t * @param {boolean} blocking\n\t * @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)\n\t */\n\tdecrement(blocking, skip) {\n\t\tthis.#pending -= 1;\n\t\tif (blocking) this.#blocking_pending -= 1;\n\n\t\tif (this.#decrement_queued || skip) return;\n\t\tthis.#decrement_queued = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tthis.#decrement_queued = false;\n\t\t\tthis.flush();\n\t\t});\n\t}\n\n\t/**\n\t * @param {Set<Effect>} dirty_effects\n\t * @param {Set<Effect>} maybe_dirty_effects\n\t */\n\ttransfer_effects(dirty_effects, maybe_dirty_effects) {\n\t\tfor (const e of dirty_effects) {\n\t\t\tthis.#dirty_effects.add(e);\n\t\t}\n\n\t\tfor (const e of maybe_dirty_effects) {\n\t\t\tthis.#maybe_dirty_effects.add(e);\n\t\t}\n\n\t\tdirty_effects.clear();\n\t\tmaybe_dirty_effects.clear();\n\t}\n\n\t/** @param {(batch: Batch) => void} fn */\n\toncommit(fn) {\n\t\tthis.#commit_callbacks.add(fn);\n\t}\n\n\t/** @param {(batch: Batch) => void} fn */\n\tondiscard(fn) {\n\t\tthis.#discard_callbacks.add(fn);\n\t}\n\n\tsettled() {\n\t\treturn (this.#deferred ??= deferred()).promise;\n\t}\n\n\tstatic ensure() {\n\t\tif (current_batch === null) {\n\t\t\tconst batch = (current_batch = new Batch());\n\n\t\t\tif (!is_processing) {\n\t\t\t\tbatches.add(current_batch);\n\n\t\t\t\tif (!is_flushing_sync) {\n\t\t\t\t\tqueue_micro_task(() => {\n\t\t\t\t\t\tif (current_batch !== batch) {\n\t\t\t\t\t\t\t// a flushSync happened in the meantime\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbatch.flush();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn current_batch;\n\t}\n\n\tapply() {\n\t\tif (!async_mode_flag || (!this.is_fork && batches.size === 1)) {\n\t\t\tbatch_values = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// if there are multiple batches, we are 'time travelling' —\n\t\t// we need to override values with the ones in this batch...\n\t\tbatch_values = new Map(this.current);\n\n\t\t// ...and undo changes belonging to other batches\n\t\tfor (const batch of batches) {\n\t\t\tif (batch === this || batch.is_fork) continue;\n\n\t\t\tfor (const [source, previous] of batch.previous) {\n\t\t\t\tif (!batch_values.has(source)) {\n\t\t\t\t\tbatch_values.set(source, previous);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {Effect} effect\n\t */\n\tschedule(effect) {\n\t\tlast_scheduled_effect = effect;\n\n\t\t// defer render effects inside a pending boundary\n\t\t// TODO the `REACTION_RAN` check is only necessary because of legacy `$:` effects AFAICT — we can remove later\n\t\tif (\n\t\t\teffect.b?.is_pending &&\n\t\t\t(effect.f & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0 &&\n\t\t\t(effect.f & REACTION_RAN) === 0\n\t\t) {\n\t\t\teffect.b.defer_effect(effect);\n\t\t\treturn;\n\t\t}\n\n\t\tvar e = effect;\n\n\t\twhile (e.parent !== null) {\n\t\t\te = e.parent;\n\t\t\tvar flags = e.f;\n\n\t\t\t// if the effect is being scheduled because a parent (each/await/etc) block\n\t\t\t// updated an internal source, or because a branch is being unskipped,\n\t\t\t// bail out or we'll cause a second flush\n\t\t\tif (collected_effects !== null && e === active_effect) {\n\t\t\t\tif (async_mode_flag) return;\n\n\t\t\t\t// in sync mode, render effects run during traversal. in an extreme edge case\n\t\t\t\t// — namely that we're setting a value inside a derived read during traversal —\n\t\t\t\t// they can be made dirty after they have already been visited, in which\n\t\t\t\t// case we shouldn't bail out. we also shouldn't bail out if we're\n\t\t\t\t// updating a store inside a `$:`, since this might invalidate\n\t\t\t\t// effects that were already visited\n\t\t\t\tif (\n\t\t\t\t\t(active_reaction === null || (active_reaction.f & DERIVED) === 0) &&\n\t\t\t\t\t!legacy_is_updating_store\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ((flags & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {\n\t\t\t\tif ((flags & CLEAN) === 0) {\n\t\t\t\t\t// branch is already dirty, bail\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\te.f ^= CLEAN;\n\t\t\t}\n\t\t}\n\n\t\tthis.#roots.push(e);\n\t}\n}\n\n/**\n * Synchronously flush any pending updates.\n * Returns void if no callback is provided, otherwise returns the result of calling the callback.\n * @template [T=void]\n * @param {(() => T) | undefined} [fn]\n * @returns {T}\n */\nexport function flushSync(fn) {\n\tvar was_flushing_sync = is_flushing_sync;\n\tis_flushing_sync = true;\n\n\ttry {\n\t\tvar result;\n\n\t\tif (fn) {\n\t\t\tif (current_batch !== null && !current_batch.is_fork) {\n\t\t\t\tcurrent_batch.flush();\n\t\t\t}\n\n\t\t\tresult = fn();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tflush_tasks();\n\n\t\t\tif (current_batch === null) {\n\t\t\t\treturn /** @type {T} */ (result);\n\t\t\t}\n\n\t\t\tcurrent_batch.flush();\n\t\t}\n\t} finally {\n\t\tis_flushing_sync = was_flushing_sync;\n\t}\n}\n\nfunction infinite_loop_guard() {\n\tif (DEV) {\n\t\tvar updates = new Map();\n\n\t\tfor (const source of /** @type {Batch} */ (current_batch).current.keys()) {\n\t\t\tfor (const [stack, update] of source.updated ?? []) {\n\t\t\t\tvar entry = updates.get(stack);\n\n\t\t\t\tif (!entry) {\n\t\t\t\t\tentry = { error: update.error, count: 0 };\n\t\t\t\t\tupdates.set(stack, entry);\n\t\t\t\t}\n\n\t\t\t\tentry.count += update.count;\n\t\t\t}\n\t\t}\n\n\t\tfor (const update of updates.values()) {\n\t\t\tif (update.error) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error(update.error);\n\t\t\t}\n\t\t}\n\t}\n\n\ttry {\n\t\te.effect_update_depth_exceeded();\n\t} catch (error) {\n\t\tif (DEV) {\n\t\t\t// stack contains no useful information, replace it\n\t\t\tdefine_property(error, 'stack', { value: '' });\n\t\t}\n\n\t\t// Best effort: invoke the boundary nearest the most recent\n\t\t// effect and hope that it's relevant to the infinite loop\n\t\tinvoke_error_boundary(error, last_scheduled_effect);\n\t}\n}\n\n/** @type {Set<Effect> | null} */\nexport let eager_block_effects = null;\n\n/**\n * @param {Array<Effect>} effects\n * @returns {void}\n */\nfunction flush_queued_effects(effects) {\n\tvar length = effects.length;\n\tif (length === 0) return;\n\n\tvar i = 0;\n\n\twhile (i < length) {\n\t\tvar effect = effects[i++];\n\n\t\tif ((effect.f & (DESTROYED | INERT)) === 0 && is_dirty(effect)) {\n\t\t\teager_block_effects = new Set();\n\n\t\t\tupdate_effect(effect);\n\n\t\t\t// Effects with no dependencies or teardown do not get added to the effect tree.\n\t\t\t// Deferred effects (e.g. `$effect(...)`) _are_ added to the tree because we\n\t\t\t// don't know if we need to keep them until they are executed. Doing the check\n\t\t\t// here (rather than in `update_effect`) allows us to skip the work for\n\t\t\t// immediate effects.\n\t\t\tif (\n\t\t\t\teffect.deps === null &&\n\t\t\t\teffect.first === null &&\n\t\t\t\teffect.nodes === null &&\n\t\t\t\teffect.teardown === null &&\n\t\t\t\teffect.ac === null\n\t\t\t) {\n\t\t\t\t// remove this effect from the graph\n\t\t\t\tunlink_effect(effect);\n\t\t\t}\n\n\t\t\t// If update_effect() has a flushSync() in it, we may have flushed another flush_queued_effects(),\n\t\t\t// which already handled this logic and did set eager_block_effects to null.\n\t\t\tif (eager_block_effects?.size > 0) {\n\t\t\t\told_values.clear();\n\n\t\t\t\tfor (const e of eager_block_effects) {\n\t\t\t\t\t// Skip eager effects that have already been unmounted\n\t\t\t\t\tif ((e.f & (DESTROYED | INERT)) !== 0) continue;\n\n\t\t\t\t\t// Run effects in order from ancestor to descendant, else we could run into nullpointers\n\t\t\t\t\t/** @type {Effect[]} */\n\t\t\t\t\tconst ordered_effects = [e];\n\t\t\t\t\tlet ancestor = e.parent;\n\t\t\t\t\twhile (ancestor !== null) {\n\t\t\t\t\t\tif (eager_block_effects.has(ancestor)) {\n\t\t\t\t\t\t\teager_block_effects.delete(ancestor);\n\t\t\t\t\t\t\tordered_effects.push(ancestor);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tancestor = ancestor.parent;\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (let j = ordered_effects.length - 1; j >= 0; j--) {\n\t\t\t\t\t\tconst e = ordered_effects[j];\n\t\t\t\t\t\t// Skip eager effects that have already been unmounted\n\t\t\t\t\t\tif ((e.f & (DESTROYED | INERT)) !== 0) continue;\n\t\t\t\t\t\tupdate_effect(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\teager_block_effects.clear();\n\t\t\t}\n\t\t}\n\t}\n\n\teager_block_effects = null;\n}\n\n/**\n * This is similar to `mark_reactions`, but it only marks async/block effects\n * depending on `value` and at least one of the other `sources`, so that\n * these effects can re-run after another batch has been committed\n * @param {Value} value\n * @param {Source[]} sources\n * @param {Set<Value>} marked\n * @param {Map<Reaction, boolean>} checked\n */\nfunction mark_effects(value, sources, marked, checked) {\n\tif (marked.has(value)) return;\n\tmarked.add(value);\n\n\tif (value.reactions !== null) {\n\t\tfor (const reaction of value.reactions) {\n\t\t\tconst flags = reaction.f;\n\n\t\t\tif ((flags & DERIVED) !== 0) {\n\t\t\t\tmark_effects(/** @type {Derived} */ (reaction), sources, marked, checked);\n\t\t\t} else if (\n\t\t\t\t(flags & (ASYNC | BLOCK_EFFECT)) !== 0 &&\n\t\t\t\t(flags & DIRTY) === 0 &&\n\t\t\t\tdepends_on(reaction, sources, checked)\n\t\t\t) {\n\t\t\t\tset_signal_status(reaction, DIRTY);\n\t\t\t\tschedule_effect(/** @type {Effect} */ (reaction));\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * When committing a fork, we need to trigger eager effects so that\n * any `$state.eager(...)` expressions update immediately. This\n * function allows us to discover them\n * @param {Value} value\n * @param {Set<Effect>} effects\n */\nfunction mark_eager_effects(value, effects) {\n\tif (value.reactions === null) return;\n\n\tfor (const reaction of value.reactions) {\n\t\tconst flags = reaction.f;\n\n\t\tif ((flags & DERIVED) !== 0) {\n\t\t\tmark_eager_effects(/** @type {Derived} */ (reaction), effects);\n\t\t} else if ((flags & EAGER_EFFECT) !== 0) {\n\t\t\tset_signal_status(reaction, DIRTY);\n\t\t\teffects.add(/** @type {Effect} */ (reaction));\n\t\t}\n\t}\n}\n\n/**\n * @param {Reaction} reaction\n * @param {Source[]} sources\n * @param {Map<Reaction, boolean>} checked\n */\nfunction depends_on(reaction, sources, checked) {\n\tconst depends = checked.get(reaction);\n\tif (depends !== undefined) return depends;\n\n\tif (reaction.deps !== null) {\n\t\tfor (const dep of reaction.deps) {\n\t\t\tif (includes.call(sources, dep)) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif ((dep.f & DERIVED) !== 0 && depends_on(/** @type {Derived} */ (dep), sources, checked)) {\n\t\t\t\tchecked.set(/** @type {Derived} */ (dep), true);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\n\tchecked.set(reaction, false);\n\n\treturn false;\n}\n\n/**\n * @param {Effect} effect\n * @returns {void}\n */\nexport function schedule_effect(effect) {\n\t/** @type {Batch} */ (current_batch).schedule(effect);\n}\n\n/** @type {Source<number>[]} */\nlet eager_versions = [];\n\nfunction eager_flush() {\n\ttry {\n\t\tflushSync(() => {\n\t\t\tfor (const version of eager_versions) {\n\t\t\t\tupdate(version);\n\t\t\t}\n\t\t});\n\t} finally {\n\t\teager_versions = [];\n\t}\n}\n\n/**\n * Implementation of `$state.eager(fn())`\n * @template T\n * @param {() => T} fn\n * @returns {T}\n */\nexport function eager(fn) {\n\tvar version = source(0);\n\tvar initial = true;\n\tvar value = /** @type {T} */ (undefined);\n\n\tget(version);\n\n\teager_effect(() => {\n\t\tif (initial) {\n\t\t\t// the first time this runs, we create an eager effect\n\t\t\t// that will run eagerly whenever the expression changes\n\t\t\tvar previous_batch_values = batch_values;\n\n\t\t\ttry {\n\t\t\t\tbatch_values = null;\n\t\t\t\tvalue = fn();\n\t\t\t} finally {\n\t\t\t\tbatch_values = previous_batch_values;\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// the second time this effect runs, it's to schedule a\n\t\t// `version` update. since this will recreate the effect,\n\t\t// we don't need to evaluate the expression here\n\t\tif (eager_versions.length === 0) {\n\t\t\tqueue_micro_task(eager_flush);\n\t\t}\n\n\t\teager_versions.push(version);\n\t});\n\n\tinitial = false;\n\n\treturn value;\n}\n\n/**\n * Mark all the effects inside a skipped branch CLEAN, so that\n * they can be correctly rescheduled later. Tracks dirty and maybe_dirty\n * effects so they can be rescheduled if the branch survives.\n * @param {Effect} effect\n * @param {{ d: Effect[], m: Effect[] }} tracked\n */\nfunction reset_branch(effect, tracked) {\n\t// clean branch = nothing dirty inside, no need to traverse further\n\tif ((effect.f & BRANCH_EFFECT) !== 0 && (effect.f & CLEAN) !== 0) {\n\t\treturn;\n\t}\n\n\tif ((effect.f & DIRTY) !== 0) {\n\t\ttracked.d.push(effect);\n\t} else if ((effect.f & MAYBE_DIRTY) !== 0) {\n\t\ttracked.m.push(effect);\n\t}\n\n\tset_signal_status(effect, CLEAN);\n\n\tvar e = effect.first;\n\twhile (e !== null) {\n\t\treset_branch(e, tracked);\n\t\te = e.next;\n\t}\n}\n\n/**\n * Mark an entire effect tree clean following an error\n * @param {Effect} effect\n */\nfunction reset_all(effect) {\n\tset_signal_status(effect, CLEAN);\n\n\tvar e = effect.first;\n\twhile (e !== null) {\n\t\treset_all(e);\n\t\te = e.next;\n\t}\n}\n\n/**\n * Creates a 'fork', in which state changes are evaluated but not applied to the DOM.\n * This is useful for speculatively loading data (for example) when you suspect that\n * the user is about to take some action.\n *\n * Frameworks like SvelteKit can use this to preload data when the user touches or\n * hovers over a link, making any subsequent navigation feel instantaneous.\n *\n * The `fn` parameter is a synchronous function that modifies some state. The\n * state changes will be reverted after the fork is initialised, then reapplied\n * if and when the fork is eventually committed.\n *\n * When it becomes clear that a fork will _not_ be committed (e.g. because the\n * user navigated elsewhere), it must be discarded to avoid leaking memory.\n *\n * @param {() => void} fn\n * @returns {Fork}\n * @since 5.42\n */\nexport function fork(fn) {\n\tif (!async_mode_flag) {\n\t\te.experimental_async_required('fork');\n\t}\n\n\tif (current_batch !== null) {\n\t\te.fork_timing();\n\t}\n\n\tvar batch = Batch.ensure();\n\tbatch.is_fork = true;\n\tbatch_values = new Map();\n\n\tvar committed = false;\n\tvar settled = batch.settled();\n\n\tflushSync(fn);\n\n\t// revert state changes\n\tfor (var [source, value] of batch.previous) {\n\t\tsource.v = value;\n\t}\n\n\treturn {\n\t\tcommit: async () => {\n\t\t\tif (committed) {\n\t\t\t\tawait settled;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!batches.has(batch)) {\n\t\t\t\te.fork_discarded();\n\t\t\t}\n\n\t\t\tcommitted = true;\n\n\t\t\tbatch.is_fork = false;\n\n\t\t\t// apply changes and update write versions so deriveds see the change\n\t\t\tfor (var [source, value] of batch.current) {\n\t\t\t\tsource.v = value;\n\t\t\t\tsource.wv = increment_write_version();\n\t\t\t}\n\n\t\t\t// trigger any `$state.eager(...)` expressions with the new state.\n\t\t\t// eager effects don't get scheduled like other effects, so we\n\t\t\t// can't just encounter them during traversal, we need to\n\t\t\t// proactively flush them\n\t\t\t// TODO maybe there's a better implementation?\n\t\t\tflushSync(() => {\n\t\t\t\t/** @type {Set<Effect>} */\n\t\t\t\tvar eager_effects = new Set();\n\n\t\t\t\tfor (var source of batch.current.keys()) {\n\t\t\t\t\tmark_eager_effects(source, eager_effects);\n\t\t\t\t}\n\n\t\t\t\tset_eager_effects(eager_effects);\n\t\t\t\tflush_eager_effects();\n\t\t\t});\n\n\t\t\tbatch.flush();\n\t\t\tawait settled;\n\t\t},\n\t\tdiscard: () => {\n\t\t\t// cause any MAYBE_DIRTY deriveds to update\n\t\t\t// if they depend on things thath changed\n\t\t\t// inside the discarded fork\n\t\t\tfor (var source of batch.current.keys()) {\n\t\t\t\tsource.wv = increment_write_version();\n\t\t\t}\n\n\t\t\tif (!committed && batches.has(batch)) {\n\t\t\t\tbatch.discard();\n\t\t\t}\n\t\t}\n\t};\n}\n\n/**\n * Forcibly remove all current batches, to prevent cross-talk between tests\n */\nexport function clear() {\n\tbatches.clear();\n}\n","import { get, tick, untrack } from '../internal/client/runtime.js';\nimport { effect_tracking, render_effect } from '../internal/client/reactivity/effects.js';\nimport { source, increment } from '../internal/client/reactivity/sources.js';\nimport { tag } from '../internal/client/dev/tracing.js';\nimport { DEV } from 'esm-env';\nimport { queue_micro_task } from '../internal/client/dom/task.js';\n\n/**\n * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.\n * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.\n *\n * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),\n * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.\n *\n * If `start` returns a cleanup function, it will be called when the effect is destroyed.\n *\n * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects\n * are active, and the returned teardown function will only be called when all effects are destroyed.\n *\n * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):\n *\n * ```js\n * import { createSubscriber } from 'svelte/reactivity';\n * import { on } from 'svelte/events';\n *\n * export class MediaQuery {\n * \t#query;\n * \t#subscribe;\n *\n * \tconstructor(query) {\n * \t\tthis.#query = window.matchMedia(`(${query})`);\n *\n * \t\tthis.#subscribe = createSubscriber((update) => {\n * \t\t\t// when the `change` event occurs, re-run any effects that read `this.current`\n * \t\t\tconst off = on(this.#query, 'change', update);\n *\n * \t\t\t// stop listening when all the effects are destroyed\n * \t\t\treturn () => off();\n * \t\t});\n * \t}\n *\n * \tget current() {\n * \t\t// This makes the getter reactive, if read in an effect\n * \t\tthis.#subscribe();\n *\n * \t\t// Return the current state of the query, whether or not we're in an effect\n * \t\treturn this.#query.matches;\n * \t}\n * }\n * ```\n * @param {(update: () => void) => (() => void) | void} start\n * @since 5.7.0\n */\nexport function createSubscriber(start) {\n\tlet subscribers = 0;\n\tlet version = source(0);\n\t/** @type {(() => void) | void} */\n\tlet stop;\n\n\tif (DEV) {\n\t\ttag(version, 'createSubscriber version');\n\t}\n\n\treturn () => {\n\t\tif (effect_tracking()) {\n\t\t\tget(version);\n\n\t\t\trender_effect(() => {\n\t\t\t\tif (subscribers === 0) {\n\t\t\t\t\tstop = untrack(() => start(() => increment(version)));\n\t\t\t\t}\n\n\t\t\t\tsubscribers += 1;\n\n\t\t\t\treturn () => {\n\t\t\t\t\tqueue_micro_task(() => {\n\t\t\t\t\t\t// Only count down after a microtask, else we would reach 0 before our own render effect reruns,\n\t\t\t\t\t\t// but reach 1 again when the tick callback of the prior teardown runs. That would mean we\n\t\t\t\t\t\t// re-subcribe unnecessarily and create a memory leak because the old subscription is never cleaned up.\n\t\t\t\t\t\tsubscribers -= 1;\n\n\t\t\t\t\t\tif (subscribers === 0) {\n\t\t\t\t\t\t\tstop?.();\n\t\t\t\t\t\t\tstop = undefined;\n\t\t\t\t\t\t\t// Increment the version to ensure any dependent deriveds are marked dirty when the subscription is picked up again later.\n\t\t\t\t\t\t\t// If we didn't do this then the comparison of write versions would determine that the derived has a later version than\n\t\t\t\t\t\t\t// the subscriber, and it would not be re-run.\n\t\t\t\t\t\t\tincrement(version);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t};\n}\n","/** @import { Effect, Source, TemplateNode, } from '#client' */\nimport {\n\tBOUNDARY_EFFECT,\n\tDIRTY,\n\tEFFECT_PRESERVED,\n\tEFFECT_TRANSPARENT,\n\tMAYBE_DIRTY\n} from '#client/constants';\nimport { HYDRATION_START_ELSE, HYDRATION_START_FAILED } from '../../../../constants.js';\nimport { component_context, set_component_context } from '../../context.js';\nimport { handle_error, invoke_error_boundary } from '../../error-handling.js';\nimport {\n\tblock,\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect\n} from '../../reactivity/effects.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tnext,\n\tskip_nodes,\n\tset_hydrate_node\n} from '../hydration.js';\nimport { queue_micro_task } from '../task.js';\nimport * as e from '../../errors.js';\nimport * as w from '../../warnings.js';\nimport { DEV } from 'esm-env';\nimport { Batch, current_batch, schedule_effect } from '../../reactivity/batch.js';\nimport { internal_set, source } from '../../reactivity/sources.js';\nimport { tag } from '../../dev/tracing.js';\nimport { createSubscriber } from '../../../../reactivity/create-subscriber.js';\nimport { create_text } from '../operations.js';\nimport { defer_effect } from '../../reactivity/utils.js';\nimport { set_signal_status } from '../../reactivity/status.js';\n\n/**\n * @typedef {{\n * \t onerror?: (error: unknown, reset: () => void) => void;\n * failed?: (anchor: Node, error: () => unknown, reset: () => () => void) => void;\n * pending?: (anchor: Node) => void;\n * }} BoundaryProps\n */\n\nvar flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;\n\n/**\n * @param {TemplateNode} node\n * @param {BoundaryProps} props\n * @param {((anchor: Node) => void)} children\n * @param {((error: unknown) => unknown) | undefined} [transform_error]\n * @returns {void}\n */\nexport function boundary(node, props, children, transform_error) {\n\tnew Boundary(node, props, children, transform_error);\n}\n\nexport class Boundary {\n\t/** @type {Boundary | null} */\n\tparent;\n\n\tis_pending = false;\n\n\t/**\n\t * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.\n\t * Inherited from parent boundary, or defaults to identity.\n\t * @type {(error: unknown) => unknown}\n\t */\n\ttransform_error;\n\n\t/** @type {TemplateNode} */\n\t#anchor;\n\n\t/** @type {TemplateNode | null} */\n\t#hydrate_open = hydrating ? hydrate_node : null;\n\n\t/** @type {BoundaryProps} */\n\t#props;\n\n\t/** @type {((anchor: Node) => void)} */\n\t#children;\n\n\t/** @type {Effect} */\n\t#effect;\n\n\t/** @type {Effect | null} */\n\t#main_effect = null;\n\n\t/** @type {Effect | null} */\n\t#pending_effect = null;\n\n\t/** @type {Effect | null} */\n\t#failed_effect = null;\n\n\t/** @type {DocumentFragment | null} */\n\t#offscreen_fragment = null;\n\n\t#local_pending_count = 0;\n\t#pending_count = 0;\n\t#pending_count_update_queued = false;\n\n\t/** @type {Set<Effect>} */\n\t#dirty_effects = new Set();\n\n\t/** @type {Set<Effect>} */\n\t#maybe_dirty_effects = new Set();\n\n\t/**\n\t * A source containing the number of pending async deriveds/expressions.\n\t * Only created if `$effect.pending()` is used inside the boundary,\n\t * otherwise updating the source results in needless `Batch.ensure()`\n\t * calls followed by no-op flushes\n\t * @type {Source<number> | null}\n\t */\n\t#effect_pending = null;\n\n\t#effect_pending_subscriber = createSubscriber(() => {\n\t\tthis.#effect_pending = source(this.#local_pending_count);\n\n\t\tif (DEV) {\n\t\t\ttag(this.#effect_pending, '$effect.pending()');\n\t\t}\n\n\t\treturn () => {\n\t\t\tthis.#effect_pending = null;\n\t\t};\n\t});\n\n\t/**\n\t * @param {TemplateNode} node\n\t * @param {BoundaryProps} props\n\t * @param {((anchor: Node) => void)} children\n\t * @param {((error: unknown) => unknown) | undefined} [transform_error]\n\t */\n\tconstructor(node, props, children, transform_error) {\n\t\tthis.#anchor = node;\n\t\tthis.#props = props;\n\n\t\tthis.#children = (anchor) => {\n\t\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t\teffect.b = this;\n\t\t\teffect.f |= BOUNDARY_EFFECT;\n\n\t\t\tchildren(anchor);\n\t\t};\n\n\t\tthis.parent = /** @type {Effect} */ (active_effect).b;\n\n\t\t// Inherit transform_error from parent boundary, or use the provided one, or default to identity\n\t\tthis.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);\n\n\t\tthis.#effect = block(() => {\n\t\t\tif (hydrating) {\n\t\t\t\tconst comment = /** @type {Comment} */ (this.#hydrate_open);\n\t\t\t\thydrate_next();\n\n\t\t\t\tconst server_rendered_pending = comment.data === HYDRATION_START_ELSE;\n\t\t\t\tconst server_rendered_failed = comment.data.startsWith(HYDRATION_START_FAILED);\n\n\t\t\t\tif (server_rendered_failed) {\n\t\t\t\t\t// Server rendered the failed snippet - hydrate it.\n\t\t\t\t\t// The serialized error is embedded in the comment: <!--[?<json>-->\n\t\t\t\t\tconst serialized_error = JSON.parse(comment.data.slice(HYDRATION_START_FAILED.length));\n\t\t\t\t\tthis.#hydrate_failed_content(serialized_error);\n\t\t\t\t} else if (server_rendered_pending) {\n\t\t\t\t\tthis.#hydrate_pending_content();\n\t\t\t\t} else {\n\t\t\t\t\tthis.#hydrate_resolved_content();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.#render();\n\t\t\t}\n\t\t}, flags);\n\n\t\tif (hydrating) {\n\t\t\tthis.#anchor = hydrate_node;\n\t\t}\n\t}\n\n\t#hydrate_resolved_content() {\n\t\ttry {\n\t\t\tthis.#main_effect = branch(() => this.#children(this.#anchor));\n\t\t} catch (error) {\n\t\t\tthis.error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {unknown} error The deserialized error from the server's hydration comment\n\t */\n\t#hydrate_failed_content(error) {\n\t\tconst failed = this.#props.failed;\n\t\tif (!failed) return;\n\n\t\tthis.#failed_effect = branch(() => {\n\t\t\tfailed(\n\t\t\t\tthis.#anchor,\n\t\t\t\t() => error,\n\t\t\t\t() => () => {}\n\t\t\t);\n\t\t});\n\t}\n\n\t#hydrate_pending_content() {\n\t\tconst pending = this.#props.pending;\n\t\tif (!pending) return;\n\n\t\tthis.is_pending = true;\n\t\tthis.#pending_effect = branch(() => pending(this.#anchor));\n\n\t\tqueue_micro_task(() => {\n\t\t\tvar fragment = (this.#offscreen_fragment = document.createDocumentFragment());\n\t\t\tvar anchor = create_text();\n\n\t\t\tfragment.append(anchor);\n\n\t\t\tthis.#main_effect = this.#run(() => {\n\t\t\t\treturn branch(() => this.#children(anchor));\n\t\t\t});\n\n\t\t\tif (this.#pending_count === 0) {\n\t\t\t\tthis.#anchor.before(fragment);\n\t\t\t\tthis.#offscreen_fragment = null;\n\n\t\t\t\tpause_effect(/** @type {Effect} */ (this.#pending_effect), () => {\n\t\t\t\t\tthis.#pending_effect = null;\n\t\t\t\t});\n\n\t\t\t\tthis.#resolve(/** @type {Batch} */ (current_batch));\n\t\t\t}\n\t\t});\n\t}\n\n\t#render() {\n\t\ttry {\n\t\t\tthis.is_pending = this.has_pending_snippet();\n\t\t\tthis.#pending_count = 0;\n\t\t\tthis.#local_pending_count = 0;\n\n\t\t\tthis.#main_effect = branch(() => {\n\t\t\t\tthis.#children(this.#anchor);\n\t\t\t});\n\n\t\t\tif (this.#pending_count > 0) {\n\t\t\t\tvar fragment = (this.#offscreen_fragment = document.createDocumentFragment());\n\t\t\t\tmove_effect(this.#main_effect, fragment);\n\n\t\t\t\tconst pending = /** @type {(anchor: Node) => void} */ (this.#props.pending);\n\t\t\t\tthis.#pending_effect = branch(() => pending(this.#anchor));\n\t\t\t} else {\n\t\t\t\tthis.#resolve(/** @type {Batch} */ (current_batch));\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#resolve(batch) {\n\t\tthis.is_pending = false;\n\n\t\t// any effects that were previously deferred should be transferred\n\t\t// to the batch, which will flush in the next microtask\n\t\tbatch.transfer_effects(this.#dirty_effects, this.#maybe_dirty_effects);\n\t}\n\n\t/**\n\t * Defer an effect inside a pending boundary until the boundary resolves\n\t * @param {Effect} effect\n\t */\n\tdefer_effect(effect) {\n\t\tdefer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects);\n\t}\n\n\t/**\n\t * Returns `false` if the effect exists inside a boundary whose pending snippet is shown\n\t * @returns {boolean}\n\t */\n\tis_rendered() {\n\t\treturn !this.is_pending && (!this.parent || this.parent.is_rendered());\n\t}\n\n\thas_pending_snippet() {\n\t\treturn !!this.#props.pending;\n\t}\n\n\t/**\n\t * @template T\n\t * @param {() => T} fn\n\t */\n\t#run(fn) {\n\t\tvar previous_effect = active_effect;\n\t\tvar previous_reaction = active_reaction;\n\t\tvar previous_ctx = component_context;\n\n\t\tset_active_effect(this.#effect);\n\t\tset_active_reaction(this.#effect);\n\t\tset_component_context(this.#effect.ctx);\n\n\t\ttry {\n\t\t\tBatch.ensure();\n\t\t\treturn fn();\n\t\t} catch (e) {\n\t\t\thandle_error(e);\n\t\t\treturn null;\n\t\t} finally {\n\t\t\tset_active_effect(previous_effect);\n\t\t\tset_active_reaction(previous_reaction);\n\t\t\tset_component_context(previous_ctx);\n\t\t}\n\t}\n\n\t/**\n\t * Updates the pending count associated with the currently visible pending snippet,\n\t * if any, such that we can replace the snippet with content once work is done\n\t * @param {1 | -1} d\n\t * @param {Batch} batch\n\t */\n\t#update_pending_count(d, batch) {\n\t\tif (!this.has_pending_snippet()) {\n\t\t\tif (this.parent) {\n\t\t\t\tthis.parent.#update_pending_count(d, batch);\n\t\t\t}\n\n\t\t\t// if there's no parent, we're in a scope with no pending snippet\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#pending_count += d;\n\n\t\tif (this.#pending_count === 0) {\n\t\t\tthis.#resolve(batch);\n\n\t\t\tif (this.#pending_effect) {\n\t\t\t\tpause_effect(this.#pending_effect, () => {\n\t\t\t\t\tthis.#pending_effect = null;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (this.#offscreen_fragment) {\n\t\t\t\tthis.#anchor.before(this.#offscreen_fragment);\n\t\t\t\tthis.#offscreen_fragment = null;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Update the source that powers `$effect.pending()` inside this boundary,\n\t * and controls when the current `pending` snippet (if any) is removed.\n\t * Do not call from inside the class\n\t * @param {1 | -1} d\n\t * @param {Batch} batch\n\t */\n\tupdate_pending_count(d, batch) {\n\t\tthis.#update_pending_count(d, batch);\n\n\t\tthis.#local_pending_count += d;\n\n\t\tif (!this.#effect_pending || this.#pending_count_update_queued) return;\n\t\tthis.#pending_count_update_queued = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tthis.#pending_count_update_queued = false;\n\t\t\tif (this.#effect_pending) {\n\t\t\t\tinternal_set(this.#effect_pending, this.#local_pending_count);\n\t\t\t}\n\t\t});\n\t}\n\n\tget_effect_pending() {\n\t\tthis.#effect_pending_subscriber();\n\t\treturn get(/** @type {Source<number>} */ (this.#effect_pending));\n\t}\n\n\t/** @param {unknown} error */\n\terror(error) {\n\t\tvar onerror = this.#props.onerror;\n\t\tlet failed = this.#props.failed;\n\n\t\t// If we have nothing to capture the error, or if we hit an error while\n\t\t// rendering the fallback, re-throw for another boundary to handle\n\t\tif (!onerror && !failed) {\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (this.#main_effect) {\n\t\t\tdestroy_effect(this.#main_effect);\n\t\t\tthis.#main_effect = null;\n\t\t}\n\n\t\tif (this.#pending_effect) {\n\t\t\tdestroy_effect(this.#pending_effect);\n\t\t\tthis.#pending_effect = null;\n\t\t}\n\n\t\tif (this.#failed_effect) {\n\t\t\tdestroy_effect(this.#failed_effect);\n\t\t\tthis.#failed_effect = null;\n\t\t}\n\n\t\tif (hydrating) {\n\t\t\tset_hydrate_node(/** @type {TemplateNode} */ (this.#hydrate_open));\n\t\t\tnext();\n\t\t\tset_hydrate_node(skip_nodes());\n\t\t}\n\n\t\tvar did_reset = false;\n\t\tvar calling_on_error = false;\n\n\t\tconst reset = () => {\n\t\t\tif (did_reset) {\n\t\t\t\tw.svelte_boundary_reset_noop();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdid_reset = true;\n\n\t\t\tif (calling_on_error) {\n\t\t\t\te.svelte_boundary_reset_onerror();\n\t\t\t}\n\n\t\t\tif (this.#failed_effect !== null) {\n\t\t\t\tpause_effect(this.#failed_effect, () => {\n\t\t\t\t\tthis.#failed_effect = null;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.#run(() => {\n\t\t\t\tthis.#render();\n\t\t\t});\n\t\t};\n\n\t\t/** @param {unknown} transformed_error */\n\t\tconst handle_error_result = (transformed_error) => {\n\t\t\ttry {\n\t\t\t\tcalling_on_error = true;\n\t\t\t\tonerror?.(transformed_error, reset);\n\t\t\t\tcalling_on_error = false;\n\t\t\t} catch (error) {\n\t\t\t\tinvoke_error_boundary(error, this.#effect && this.#effect.parent);\n\t\t\t}\n\n\t\t\tif (failed) {\n\t\t\t\tthis.#failed_effect = this.#run(() => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn branch(() => {\n\t\t\t\t\t\t\t// errors in `failed` snippets cause the boundary to error again\n\t\t\t\t\t\t\t// TODO Svelte 6: revisit this decision, most likely better to go to parent boundary instead\n\t\t\t\t\t\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t\t\t\t\t\teffect.b = this;\n\t\t\t\t\t\t\teffect.f |= BOUNDARY_EFFECT;\n\n\t\t\t\t\t\t\tfailed(\n\t\t\t\t\t\t\t\tthis.#anchor,\n\t\t\t\t\t\t\t\t() => transformed_error,\n\t\t\t\t\t\t\t\t() => reset\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tinvoke_error_boundary(error, /** @type {Effect} */ (this.#effect.parent));\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\tqueue_micro_task(() => {\n\t\t\t// Run the error through the API-level transformError transform (e.g. SvelteKit's handleError)\n\t\t\t/** @type {unknown} */\n\t\t\tvar result;\n\t\t\ttry {\n\t\t\t\tresult = this.transform_error(error);\n\t\t\t} catch (e) {\n\t\t\t\tinvoke_error_boundary(e, this.#effect && this.#effect.parent);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tresult !== null &&\n\t\t\t\ttypeof result === 'object' &&\n\t\t\t\ttypeof (/** @type {any} */ (result).then) === 'function'\n\t\t\t) {\n\t\t\t\t// transformError returned a Promise — wait for it\n\t\t\t\t/** @type {any} */ (result).then(\n\t\t\t\t\thandle_error_result,\n\t\t\t\t\t/** @param {unknown} e */\n\t\t\t\t\t(e) => invoke_error_boundary(e, this.#effect && this.#effect.parent)\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Synchronous result — handle immediately\n\t\t\t\thandle_error_result(result);\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function pending() {\n\tif (active_effect === null) {\n\t\te.effect_pending_outside_reaction();\n\t}\n\n\tvar boundary = active_effect.b;\n\n\tif (boundary === null) {\n\t\treturn 0; // TODO eventually we will need this to be global\n\t}\n\n\treturn boundary.get_effect_pending();\n}\n","/** @import { Blocker, Effect, Value } from '#client' */\nimport { DESTROYED, STALE_REACTION } from '#client/constants';\nimport { DEV } from 'esm-env';\nimport {\n\tcomponent_context,\n\tdev_stack,\n\tis_runes,\n\tset_component_context,\n\tset_dev_stack\n} from '../context.js';\nimport { Boundary } from '../dom/blocks/boundary.js';\nimport { invoke_error_boundary } from '../error-handling.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../runtime.js';\nimport { Batch, current_batch } from './batch.js';\nimport {\n\tasync_derived,\n\treactivity_loss_tracker,\n\tderived,\n\tderived_safe_equal,\n\tset_reactivity_loss_tracker\n} from './deriveds.js';\nimport { aborted } from './effects.js';\n\n/**\n * @param {Blocker[]} blockers\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {(values: Value[]) => any} fn\n */\nexport function flatten(blockers, sync, async, fn) {\n\tconst d = is_runes() ? derived : derived_safe_equal;\n\n\t// Filter out already-settled blockers - no need to wait for them\n\tvar pending = blockers.filter((b) => !b.settled);\n\n\tif (async.length === 0 && pending.length === 0) {\n\t\tfn(sync.map(d));\n\t\treturn;\n\t}\n\n\tvar parent = /** @type {Effect} */ (active_effect);\n\n\tvar restore = capture();\n\tvar blocker_promise =\n\t\tpending.length === 1\n\t\t\t? pending[0].promise\n\t\t\t: pending.length > 1\n\t\t\t\t? Promise.all(pending.map((b) => b.promise))\n\t\t\t\t: null;\n\n\t/** @param {Value[]} values */\n\tfunction finish(values) {\n\t\trestore();\n\n\t\ttry {\n\t\t\tfn(values);\n\t\t} catch (error) {\n\t\t\tif ((parent.f & DESTROYED) === 0) {\n\t\t\t\tinvoke_error_boundary(error, parent);\n\t\t\t}\n\t\t}\n\n\t\tunset_context();\n\t}\n\n\t// Fast path: blockers but no async expressions\n\tif (async.length === 0) {\n\t\t/** @type {Promise<any>} */ (blocker_promise).then(() => finish(sync.map(d)));\n\t\treturn;\n\t}\n\n\tvar decrement_pending = increment_pending();\n\n\t// Full path: has async expressions\n\tfunction run() {\n\t\tPromise.all(async.map((expression) => async_derived(expression)))\n\t\t\t.then((result) => finish([...sync.map(d), ...result]))\n\t\t\t.catch((error) => invoke_error_boundary(error, parent))\n\t\t\t.finally(() => decrement_pending());\n\t}\n\n\tif (blocker_promise) {\n\t\tblocker_promise.then(() => {\n\t\t\trestore();\n\t\t\trun();\n\t\t\tunset_context();\n\t\t});\n\t} else {\n\t\trun();\n\t}\n}\n\n/**\n * @param {Blocker[]} blockers\n * @param {(values: Value[]) => any} fn\n */\nexport function run_after_blockers(blockers, fn) {\n\tflatten(blockers, [], [], fn);\n}\n\n/**\n * Captures the current effect context so that we can restore it after\n * some asynchronous work has happened (so that e.g. `await a + b`\n * causes `b` to be registered as a dependency).\n */\nexport function capture() {\n\tvar previous_effect = /** @type {Effect} */ (active_effect);\n\tvar previous_reaction = active_reaction;\n\tvar previous_component_context = component_context;\n\tvar previous_batch = /** @type {Batch} */ (current_batch);\n\n\tif (DEV) {\n\t\tvar previous_dev_stack = dev_stack;\n\t}\n\n\treturn function restore(activate_batch = true) {\n\t\tset_active_effect(previous_effect);\n\t\tset_active_reaction(previous_reaction);\n\t\tset_component_context(previous_component_context);\n\n\t\tif (activate_batch && (previous_effect.f & DESTROYED) === 0) {\n\t\t\t// TODO we only need optional chaining here because `{#await ...}` blocks\n\t\t\t// are anomalous. Once we retire them we can get rid of it\n\t\t\tprevious_batch?.activate();\n\t\t\tprevious_batch?.apply();\n\t\t}\n\n\t\tif (DEV) {\n\t\t\tset_reactivity_loss_tracker(null);\n\t\t\tset_dev_stack(previous_dev_stack);\n\t\t}\n\t};\n}\n\n/**\n * Wraps an `await` expression in such a way that the effect context that was\n * active before the expression evaluated can be reapplied afterwards —\n * `await a + b` becomes `(await $.save(a))() + b`\n * @template T\n * @param {Promise<T>} promise\n * @returns {Promise<() => T>}\n */\nexport async function save(promise) {\n\tvar restore = capture();\n\tvar value = await promise;\n\n\treturn () => {\n\t\trestore();\n\t\treturn value;\n\t};\n}\n\n/**\n * Reset `current_async_effect` after the `promise` resolves, so\n * that we can emit `await_reactivity_loss` warnings\n * @template T\n * @param {Promise<T>} promise\n * @returns {Promise<() => T>}\n */\nexport async function track_reactivity_loss(promise) {\n\tvar previous_async_effect = reactivity_loss_tracker;\n\tvar value = await promise;\n\n\treturn () => {\n\t\tset_reactivity_loss_tracker(previous_async_effect);\n\t\treturn value;\n\t};\n}\n\n/**\n * Used in `for await` loops in DEV, so\n * that we can emit `await_reactivity_loss` warnings\n * after each `async_iterator` result resolves and\n * after the `async_iterator` return resolves (if it runs)\n * @template T\n * @template TReturn\n * @param {Iterable<T> | AsyncIterable<T>} iterable\n * @returns {AsyncGenerator<T, TReturn | undefined>}\n */\nexport async function* for_await_track_reactivity_loss(iterable) {\n\t// This is based on the algorithms described in ECMA-262:\n\t// ForIn/OfBodyEvaluation\n\t// https://tc39.es/ecma262/multipage/ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset\n\t// AsyncIteratorClose\n\t// https://tc39.es/ecma262/multipage/abstract-operations.html#sec-asynciteratorclose\n\n\t/** @type {AsyncIterator<T, TReturn>} */\n\t// @ts-ignore\n\tconst iterator = iterable[Symbol.asyncIterator]?.() ?? iterable[Symbol.iterator]?.();\n\n\tif (iterator === undefined) {\n\t\tthrow new TypeError('value is not async iterable');\n\t}\n\n\t/** Whether the completion of the iterator was \"normal\", meaning it wasn't ended via `break` or a similar method */\n\tlet normal_completion = false;\n\ttry {\n\t\twhile (true) {\n\t\t\tconst { done, value } = (await track_reactivity_loss(iterator.next()))();\n\t\t\tif (done) {\n\t\t\t\tnormal_completion = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tyield value;\n\t\t}\n\t} finally {\n\t\t// If the iterator had a normal completion and `return` is defined on the iterator, call it and return the value\n\t\tif (normal_completion && iterator.return !== undefined) {\n\t\t\t// eslint-disable-next-line no-unsafe-finally\n\t\t\treturn /** @type {TReturn} */ ((await track_reactivity_loss(iterator.return()))().value);\n\t\t}\n\t}\n}\n\nexport function unset_context(deactivate_batch = true) {\n\tset_active_effect(null);\n\tset_active_reaction(null);\n\tset_component_context(null);\n\tif (deactivate_batch) current_batch?.deactivate();\n\n\tif (DEV) {\n\t\tset_reactivity_loss_tracker(null);\n\t\tset_dev_stack(null);\n\t}\n}\n\n/**\n * @param {Array<() => void | Promise<void>>} thunks\n */\nexport function run(thunks) {\n\tconst restore = capture();\n\n\tconst decrement_pending = increment_pending();\n\n\tvar active = /** @type {Effect} */ (active_effect);\n\n\t/** @type {null | { error: any }} */\n\tvar errored = null;\n\n\t/** @param {any} error */\n\tconst handle_error = (error) => {\n\t\terrored = { error }; // wrap in object in case a promise rejects with a falsy value\n\n\t\tif (!aborted(active)) {\n\t\t\tinvoke_error_boundary(error, active);\n\t\t}\n\t};\n\n\tvar promise = Promise.resolve(thunks[0]()).catch(handle_error);\n\n\t/** @type {Blocker} */\n\tvar blocker = { promise, settled: false };\n\tvar blockers = [blocker];\n\n\tpromise.finally(() => {\n\t\tblocker.settled = true;\n\t\tunset_context();\n\t});\n\n\tfor (const fn of thunks.slice(1)) {\n\t\tpromise = promise\n\t\t\t.then(() => {\n\t\t\t\tif (errored) {\n\t\t\t\t\tthrow errored.error;\n\t\t\t\t}\n\n\t\t\t\tif (aborted(active)) {\n\t\t\t\t\tthrow STALE_REACTION;\n\t\t\t\t}\n\n\t\t\t\trestore();\n\t\t\t\treturn fn();\n\t\t\t})\n\t\t\t.catch(handle_error);\n\n\t\tconst blocker = { promise, settled: false };\n\t\tblockers.push(blocker);\n\n\t\tpromise.finally(() => {\n\t\t\tblocker.settled = true;\n\t\t\tunset_context();\n\t\t});\n\t}\n\n\tpromise\n\t\t// wait one more tick, so that template effects are\n\t\t// guaranteed to run before `$effect(...)`\n\t\t.then(() => Promise.resolve())\n\t\t.finally(() => decrement_pending());\n\n\treturn blockers;\n}\n\n/**\n * @param {Blocker[]} blockers\n */\nexport function wait(blockers) {\n\treturn Promise.all(blockers.map((b) => b.promise));\n}\n\n/**\n * @returns {(skip?: boolean) => void}\n */\nexport function increment_pending() {\n\tvar boundary = /** @type {Boundary} */ (/** @type {Effect} */ (active_effect).b);\n\tvar batch = /** @type {Batch} */ (current_batch);\n\tvar blocking = boundary.is_rendered();\n\n\tboundary.update_pending_count(1, batch);\n\tbatch.increment(blocking);\n\n\treturn (skip = false) => {\n\t\tboundary.update_pending_count(-1, batch);\n\t\tbatch.decrement(blocking, skip);\n\t};\n}\n","/** @import { Derived, Effect, Source } from '#client' */\n/** @import { Batch } from './batch.js'; */\n/** @import { Boundary } from '../dom/blocks/boundary.js'; */\nimport { DEV } from 'esm-env';\nimport {\n\tERROR_VALUE,\n\tDERIVED,\n\tDIRTY,\n\tEFFECT_PRESERVED,\n\tSTALE_REACTION,\n\tASYNC,\n\tWAS_MARKED,\n\tDESTROYED,\n\tCLEAN,\n\tREACTION_RAN\n} from '#client/constants';\nimport {\n\tactive_reaction,\n\tactive_effect,\n\tupdate_reaction,\n\tincrement_write_version,\n\tset_active_effect,\n\tpush_reaction_value,\n\tis_destroying_effect,\n\tupdate_effect,\n\tremove_reactions\n} from '../runtime.js';\nimport { equals, safe_equals } from './equality.js';\nimport * as e from '../errors.js';\nimport * as w from '../warnings.js';\nimport {\n\tasync_effect,\n\tdestroy_effect,\n\tdestroy_effect_children,\n\teffect_tracking,\n\tteardown\n} from './effects.js';\nimport { eager_effects, internal_set, set_eager_effects, source } from './sources.js';\nimport { get_error } from '../../shared/dev.js';\nimport { async_mode_flag, tracing_mode_flag } from '../../flags/index.js';\nimport { component_context } from '../context.js';\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { batch_values, current_batch } from './batch.js';\nimport { increment_pending, unset_context } from './async.js';\nimport { deferred, includes, noop } from '../../shared/utils.js';\nimport { set_signal_status, update_derived_status } from './status.js';\n\n/**\n * This allows us to track 'reactivity loss' that occurs when signals\n * are read after a non-context-restoring `await`. Dev-only\n * @type {{ effect: Effect, warned: boolean } | null}\n */\nexport let reactivity_loss_tracker = null;\n\n/** @param {{ effect: Effect, warned: boolean } | null} v */\nexport function set_reactivity_loss_tracker(v) {\n\treactivity_loss_tracker = v;\n}\n\nexport const recent_async_deriveds = new Set();\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function derived(fn) {\n\tvar flags = DERIVED | DIRTY;\n\tvar parent_derived =\n\t\tactive_reaction !== null && (active_reaction.f & DERIVED) !== 0\n\t\t\t? /** @type {Derived} */ (active_reaction)\n\t\t\t: null;\n\n\tif (active_effect !== null) {\n\t\t// Since deriveds are evaluated lazily, any effects created inside them are\n\t\t// created too late to ensure that the parent effect is added to the tree\n\t\tactive_effect.f |= EFFECT_PRESERVED;\n\t}\n\n\t/** @type {Derived<V>} */\n\tconst signal = {\n\t\tctx: component_context,\n\t\tdeps: null,\n\t\teffects: null,\n\t\tequals,\n\t\tf: flags,\n\t\tfn,\n\t\treactions: null,\n\t\trv: 0,\n\t\tv: /** @type {V} */ (UNINITIALIZED),\n\t\twv: 0,\n\t\tparent: parent_derived ?? active_effect,\n\t\tac: null\n\t};\n\n\tif (DEV && tracing_mode_flag) {\n\t\tsignal.created = get_error('created at');\n\t}\n\n\treturn signal;\n}\n\n/**\n * @template V\n * @param {() => V | Promise<V>} fn\n * @param {string} [label]\n * @param {string} [location] If provided, print a warning if the value is not read immediately after update\n * @returns {Promise<Source<V>>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function async_derived(fn, label, location) {\n\tlet parent = /** @type {Effect | null} */ (active_effect);\n\n\tif (parent === null) {\n\t\te.async_derived_orphan();\n\t}\n\n\tvar promise = /** @type {Promise<V>} */ (/** @type {unknown} */ (undefined));\n\tvar signal = source(/** @type {V} */ (UNINITIALIZED));\n\n\tif (DEV) signal.label = label;\n\n\t// only suspend in async deriveds created on initialisation\n\tvar should_suspend = !active_reaction;\n\n\t/** @type {Map<Batch, ReturnType<typeof deferred<V>>>} */\n\tvar deferreds = new Map();\n\n\tasync_effect(() => {\n\t\tif (DEV) {\n\t\t\treactivity_loss_tracker = {\n\t\t\t\teffect: /** @type {Effect} */ (active_effect),\n\t\t\t\twarned: false\n\t\t\t};\n\t\t}\n\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t/** @type {ReturnType<typeof deferred<V>>} */\n\t\tvar d = deferred();\n\t\tpromise = d.promise;\n\n\t\ttry {\n\t\t\t// If this code is changed at some point, make sure to still access the then property\n\t\t\t// of fn() to read any signals it might access, so that we track them as dependencies.\n\t\t\t// We call `unset_context` to undo any `save` calls that happen inside `fn()`\n\t\t\tPromise.resolve(fn()).then(d.resolve, d.reject).finally(unset_context);\n\t\t} catch (error) {\n\t\t\td.reject(error);\n\t\t\tunset_context();\n\t\t}\n\n\t\tif (DEV) {\n\t\t\treactivity_loss_tracker = null;\n\t\t}\n\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\n\t\tif (should_suspend) {\n\t\t\t// we only increment the batch's pending state for updates, not creation, otherwise\n\t\t\t// we will decrement to zero before the work that depends on this promise (e.g. a\n\t\t\t// template effect) has initialized, causing the batch to resolve prematurely\n\t\t\tif ((effect.f & REACTION_RAN) !== 0) {\n\t\t\t\tvar decrement_pending = increment_pending();\n\t\t\t}\n\n\t\t\tif (/** @type {Boundary} */ (parent.b).is_rendered()) {\n\t\t\t\tdeferreds.get(batch)?.reject(STALE_REACTION);\n\t\t\t\tdeferreds.delete(batch); // delete to ensure correct order in Map iteration below\n\t\t\t} else {\n\t\t\t\t// While the boundary is still showing pending, a new run supersedes all older in-flight runs\n\t\t\t\t// for this async expression. Cancel eagerly so resolution cannot commit stale values.\n\t\t\t\tfor (const d of deferreds.values()) {\n\t\t\t\t\td.reject(STALE_REACTION);\n\t\t\t\t}\n\t\t\t\tdeferreds.clear();\n\t\t\t}\n\n\t\t\tdeferreds.set(batch, d);\n\t\t}\n\n\t\t/**\n\t\t * @param {any} value\n\t\t * @param {unknown} error\n\t\t */\n\t\tconst handler = (value, error = undefined) => {\n\t\t\tif (DEV) {\n\t\t\t\treactivity_loss_tracker = null;\n\t\t\t}\n\n\t\t\tif (decrement_pending) {\n\t\t\t\t// don't trigger an update if we're only here because\n\t\t\t\t// the promise was superseded before it could resolve\n\t\t\t\tvar skip = error === STALE_REACTION;\n\t\t\t\tdecrement_pending(skip);\n\t\t\t}\n\n\t\t\tif (error === STALE_REACTION || (effect.f & DESTROYED) !== 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tbatch.activate();\n\n\t\t\tif (error) {\n\t\t\t\tsignal.f |= ERROR_VALUE;\n\n\t\t\t\t// @ts-expect-error the error is the wrong type, but we don't care\n\t\t\t\tinternal_set(signal, error);\n\t\t\t} else {\n\t\t\t\tif ((signal.f & ERROR_VALUE) !== 0) {\n\t\t\t\t\tsignal.f ^= ERROR_VALUE;\n\t\t\t\t}\n\n\t\t\t\tinternal_set(signal, value);\n\n\t\t\t\t// All prior async derived runs are now stale\n\t\t\t\tfor (const [b, d] of deferreds) {\n\t\t\t\t\tdeferreds.delete(b);\n\t\t\t\t\tif (b === batch) break;\n\t\t\t\t\td.reject(STALE_REACTION);\n\t\t\t\t}\n\n\t\t\t\tif (DEV && location !== undefined) {\n\t\t\t\t\trecent_async_deriveds.add(signal);\n\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (recent_async_deriveds.has(signal)) {\n\t\t\t\t\t\t\tw.await_waterfall(/** @type {string} */ (signal.label), location);\n\t\t\t\t\t\t\trecent_async_deriveds.delete(signal);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbatch.deactivate();\n\t\t};\n\n\t\td.promise.then(handler, (e) => handler(null, e || 'unknown'));\n\t});\n\n\tteardown(() => {\n\t\tfor (const d of deferreds.values()) {\n\t\t\td.reject(STALE_REACTION);\n\t\t}\n\t});\n\n\tif (DEV) {\n\t\t// add a flag that lets this be printed as a derived\n\t\t// when using `$inspect.trace()`\n\t\tsignal.f |= ASYNC;\n\t}\n\n\treturn new Promise((fulfil) => {\n\t\t/** @param {Promise<V>} p */\n\t\tfunction next(p) {\n\t\t\tfunction go() {\n\t\t\t\tif (p === promise) {\n\t\t\t\t\tfulfil(signal);\n\t\t\t\t} else {\n\t\t\t\t\t// if the effect re-runs before the initial promise\n\t\t\t\t\t// resolves, delay resolution until we have a value\n\t\t\t\t\tnext(promise);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tp.then(go, go);\n\t\t}\n\n\t\tnext(promise);\n\t});\n}\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function user_derived(fn) {\n\tconst d = derived(fn);\n\n\tif (!async_mode_flag) push_reaction_value(d);\n\n\treturn d;\n}\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function derived_safe_equal(fn) {\n\tconst signal = derived(fn);\n\tsignal.equals = safe_equals;\n\treturn signal;\n}\n\n/**\n * @param {Derived} derived\n * @returns {void}\n */\nexport function destroy_derived_effects(derived) {\n\tvar effects = derived.effects;\n\n\tif (effects !== null) {\n\t\tderived.effects = null;\n\n\t\tfor (var i = 0; i < effects.length; i += 1) {\n\t\t\tdestroy_effect(/** @type {Effect} */ (effects[i]));\n\t\t}\n\t}\n}\n\n/**\n * The currently updating deriveds, used to detect infinite recursion\n * in dev mode and provide a nicer error than 'too much recursion'\n * @type {Derived[]}\n */\nlet stack = [];\n\n/**\n * @param {Derived} derived\n * @returns {Effect | null}\n */\nfunction get_derived_parent_effect(derived) {\n\tvar parent = derived.parent;\n\twhile (parent !== null) {\n\t\tif ((parent.f & DERIVED) === 0) {\n\t\t\t// The original parent effect might've been destroyed but the derived\n\t\t\t// is used elsewhere now - do not return the destroyed effect in that case\n\t\t\treturn (parent.f & DESTROYED) === 0 ? /** @type {Effect} */ (parent) : null;\n\t\t}\n\t\tparent = parent.parent;\n\t}\n\treturn null;\n}\n\n/**\n * @template T\n * @param {Derived} derived\n * @returns {T}\n */\nexport function execute_derived(derived) {\n\tvar value;\n\tvar prev_active_effect = active_effect;\n\n\tset_active_effect(get_derived_parent_effect(derived));\n\n\tif (DEV) {\n\t\tlet prev_eager_effects = eager_effects;\n\t\tset_eager_effects(new Set());\n\t\ttry {\n\t\t\tif (includes.call(stack, derived)) {\n\t\t\t\te.derived_references_self();\n\t\t\t}\n\n\t\t\tstack.push(derived);\n\n\t\t\tderived.f &= ~WAS_MARKED;\n\t\t\tdestroy_derived_effects(derived);\n\t\t\tvalue = update_reaction(derived);\n\t\t} finally {\n\t\t\tset_active_effect(prev_active_effect);\n\t\t\tset_eager_effects(prev_eager_effects);\n\t\t\tstack.pop();\n\t\t}\n\t} else {\n\t\ttry {\n\t\t\tderived.f &= ~WAS_MARKED;\n\t\t\tdestroy_derived_effects(derived);\n\t\t\tvalue = update_reaction(derived);\n\t\t} finally {\n\t\t\tset_active_effect(prev_active_effect);\n\t\t}\n\t}\n\n\treturn value;\n}\n\n/**\n * @param {Derived} derived\n * @returns {void}\n */\nexport function update_derived(derived) {\n\tvar old_value = derived.v;\n\tvar value = execute_derived(derived);\n\n\tif (!derived.equals(value)) {\n\t\tderived.wv = increment_write_version();\n\n\t\t// in a fork, we don't update the underlying value, just `batch_values`.\n\t\t// the underlying value will be updated when the fork is committed.\n\t\t// otherwise, the next time we get here after a 'real world' state\n\t\t// change, `derived.equals` may incorrectly return `true`\n\t\tif (!current_batch?.is_fork || derived.deps === null) {\n\t\t\tderived.v = value;\n\t\t\tcurrent_batch?.capture(derived, old_value);\n\n\t\t\t// deriveds without dependencies should never be recomputed\n\t\t\tif (derived.deps === null) {\n\t\t\t\tset_signal_status(derived, CLEAN);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\t// don't mark derived clean if we're reading it inside a\n\t// cleanup function, or it will cache a stale value\n\tif (is_destroying_effect) {\n\t\treturn;\n\t}\n\n\t// During time traveling we don't want to reset the status so that\n\t// traversal of the graph in the other batches still happens\n\tif (batch_values !== null) {\n\t\t// only cache the value if we're in a tracking context, otherwise we won't\n\t\t// clear the cache in `mark_reactions` when dependencies are updated\n\t\tif (effect_tracking() || current_batch?.is_fork) {\n\t\t\tbatch_values.set(derived, value);\n\t\t}\n\t} else {\n\t\tupdate_derived_status(derived);\n\t}\n}\n\n/**\n * @param {Derived} derived\n */\nexport function freeze_derived_effects(derived) {\n\tif (derived.effects === null) return;\n\n\tfor (const e of derived.effects) {\n\t\t// if the effect has a teardown function or abort signal, call it\n\t\tif (e.teardown || e.ac) {\n\t\t\te.teardown?.();\n\t\t\te.ac?.abort(STALE_REACTION);\n\n\t\t\t// make it a noop so it doesn't get called again if the derived\n\t\t\t// is unfrozen. we don't set it to `null`, because the existence\n\t\t\t// of a teardown function is what determines whether the\n\t\t\t// effect runs again during unfreezing\n\t\t\te.teardown = noop;\n\t\t\te.ac = null;\n\n\t\t\tremove_reactions(e, 0);\n\t\t\tdestroy_effect_children(e);\n\t\t}\n\t}\n}\n\n/**\n * @param {Derived} derived\n */\nexport function unfreeze_derived_effects(derived) {\n\tif (derived.effects === null) return;\n\n\tfor (const e of derived.effects) {\n\t\t// if the effect was previously frozen — indicated by the presence\n\t\t// of a teardown function — unfreeze it\n\t\tif (e.teardown) {\n\t\t\tupdate_effect(e);\n\t\t}\n\t}\n}\n","/** @import { Derived, Effect, Source, Value } from '#client' */\nimport { DEV } from 'esm-env';\nimport {\n\tactive_reaction,\n\tactive_effect,\n\tuntracked_writes,\n\tget,\n\tset_untracked_writes,\n\tuntrack,\n\tincrement_write_version,\n\tupdate_effect,\n\tcurrent_sources,\n\tis_dirty,\n\tuntracking,\n\tis_destroying_effect,\n\tpush_reaction_value\n} from '../runtime.js';\nimport { equals, safe_equals } from './equality.js';\nimport {\n\tCLEAN,\n\tDERIVED,\n\tDIRTY,\n\tBRANCH_EFFECT,\n\tEAGER_EFFECT,\n\tMAYBE_DIRTY,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tASYNC,\n\tWAS_MARKED,\n\tCONNECTED\n} from '#client/constants';\nimport * as e from '../errors.js';\nimport { legacy_mode_flag, tracing_mode_flag } from '../../flags/index.js';\nimport { includes } from '../../shared/utils.js';\nimport { tag_proxy } from '../dev/tracing.js';\nimport { get_error } from '../../shared/dev.js';\nimport { component_context, is_runes } from '../context.js';\nimport {\n\tBatch,\n\tbatch_values,\n\teager_block_effects,\n\tschedule_effect,\n\tlegacy_updates\n} from './batch.js';\nimport { proxy } from '../proxy.js';\nimport { execute_derived } from './deriveds.js';\nimport { set_signal_status, update_derived_status } from './status.js';\n\n/** @type {Set<any>} */\nexport let eager_effects = new Set();\n\n/** @type {Map<Source, any>} */\nexport const old_values = new Map();\n\n/**\n * @param {Set<any>} v\n */\nexport function set_eager_effects(v) {\n\teager_effects = v;\n}\n\nlet eager_effects_deferred = false;\n\nexport function set_eager_effects_deferred() {\n\teager_effects_deferred = true;\n}\n\n/**\n * @template V\n * @param {V} v\n * @param {Error | null} [stack]\n * @returns {Source<V>}\n */\n// TODO rename this to `state` throughout the codebase\nexport function source(v, stack) {\n\t/** @type {Value} */\n\tvar signal = {\n\t\tf: 0, // TODO ideally we could skip this altogether, but it causes type errors\n\t\tv,\n\t\treactions: null,\n\t\tequals,\n\t\trv: 0,\n\t\twv: 0\n\t};\n\n\tif (DEV && tracing_mode_flag) {\n\t\tsignal.created = stack ?? get_error('created at');\n\t\tsignal.updated = null;\n\t\tsignal.set_during_effect = false;\n\t\tsignal.trace = null;\n\t}\n\n\treturn signal;\n}\n\n/**\n * @template V\n * @param {V} v\n * @param {Error | null} [stack]\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function state(v, stack) {\n\tconst s = source(v, stack);\n\n\tpush_reaction_value(s);\n\n\treturn s;\n}\n\n/**\n * @template V\n * @param {V} initial_value\n * @param {boolean} [immutable]\n * @returns {Source<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function mutable_source(initial_value, immutable = false, trackable = true) {\n\tconst s = source(initial_value);\n\tif (!immutable) {\n\t\ts.equals = safe_equals;\n\t}\n\n\t// bind the signal to the component context, in case we need to\n\t// track updates to trigger beforeUpdate/afterUpdate callbacks\n\tif (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) {\n\t\t(component_context.l.s ??= []).push(s);\n\t}\n\n\treturn s;\n}\n\n/**\n * @template V\n * @param {Value<V>} source\n * @param {V} value\n */\nexport function mutate(source, value) {\n\tset(\n\t\tsource,\n\t\tuntrack(() => get(source))\n\t);\n\treturn value;\n}\n\n/**\n * @template V\n * @param {Source<V>} source\n * @param {V} value\n * @param {boolean} [should_proxy]\n * @returns {V}\n */\nexport function set(source, value, should_proxy = false) {\n\tif (\n\t\tactive_reaction !== null &&\n\t\t// since we are untracking the function inside `$inspect.with` we need to add this check\n\t\t// to ensure we error if state is set inside an inspect effect\n\t\t(!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) &&\n\t\tis_runes() &&\n\t\t(active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 &&\n\t\t(current_sources === null || !includes.call(current_sources, source))\n\t) {\n\t\te.state_unsafe_mutation();\n\t}\n\n\tlet new_value = should_proxy ? proxy(value) : value;\n\n\tif (DEV) {\n\t\ttag_proxy(new_value, /** @type {string} */ (source.label));\n\t}\n\n\treturn internal_set(source, new_value, legacy_updates);\n}\n\n/**\n * @template V\n * @param {Source<V>} source\n * @param {V} value\n * @param {Effect[] | null} [updated_during_traversal]\n * @returns {V}\n */\nexport function internal_set(source, value, updated_during_traversal = null) {\n\tif (!source.equals(value)) {\n\t\tvar old_value = source.v;\n\n\t\tif (is_destroying_effect) {\n\t\t\told_values.set(source, value);\n\t\t} else {\n\t\t\told_values.set(source, old_value);\n\t\t}\n\n\t\tsource.v = value;\n\n\t\tvar batch = Batch.ensure();\n\t\tbatch.capture(source, old_value);\n\n\t\tif (DEV) {\n\t\t\tif (tracing_mode_flag || active_effect !== null) {\n\t\t\t\tsource.updated ??= new Map();\n\n\t\t\t\t// For performance reasons, when not using $inspect.trace, we only start collecting stack traces\n\t\t\t\t// after the same source has been updated more than 5 times in the same flush cycle.\n\t\t\t\tconst count = (source.updated.get('')?.count ?? 0) + 1;\n\t\t\t\tsource.updated.set('', { error: /** @type {any} */ (null), count });\n\n\t\t\t\tif (tracing_mode_flag || count > 5) {\n\t\t\t\t\tconst error = get_error('updated at');\n\n\t\t\t\t\tif (error !== null) {\n\t\t\t\t\t\tlet entry = source.updated.get(error.stack);\n\n\t\t\t\t\t\tif (!entry) {\n\t\t\t\t\t\t\tentry = { error, count: 0 };\n\t\t\t\t\t\t\tsource.updated.set(error.stack, entry);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tentry.count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (active_effect !== null) {\n\t\t\t\tsource.set_during_effect = true;\n\t\t\t}\n\t\t}\n\n\t\tif ((source.f & DERIVED) !== 0) {\n\t\t\tconst derived = /** @type {Derived} */ (source);\n\n\t\t\t// if we are assigning to a dirty derived we set it to clean/maybe dirty but we also eagerly execute it to track the dependencies\n\t\t\tif ((source.f & DIRTY) !== 0) {\n\t\t\t\texecute_derived(derived);\n\t\t\t}\n\n\t\t\t// During time traveling we don't want to reset the status so that\n\t\t\t// traversal of the graph in the other batches still happens\n\t\t\tif (batch_values === null) {\n\t\t\t\tupdate_derived_status(derived);\n\t\t\t}\n\t\t}\n\n\t\tsource.wv = increment_write_version();\n\n\t\t// For debugging, in case you want to know which reactions are being scheduled:\n\t\t// log_reactions(source);\n\t\tmark_reactions(source, DIRTY, updated_during_traversal);\n\n\t\t// It's possible that the current reaction might not have up-to-date dependencies\n\t\t// whilst it's actively running. So in the case of ensuring it registers the reaction\n\t\t// properly for itself, we need to ensure the current effect actually gets\n\t\t// scheduled. i.e: `$effect(() => x++)`\n\t\tif (\n\t\t\tis_runes() &&\n\t\t\tactive_effect !== null &&\n\t\t\t(active_effect.f & CLEAN) !== 0 &&\n\t\t\t(active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0\n\t\t) {\n\t\t\tif (untracked_writes === null) {\n\t\t\t\tset_untracked_writes([source]);\n\t\t\t} else {\n\t\t\t\tuntracked_writes.push(source);\n\t\t\t}\n\t\t}\n\n\t\tif (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) {\n\t\t\tflush_eager_effects();\n\t\t}\n\t}\n\n\treturn value;\n}\n\nexport function flush_eager_effects() {\n\teager_effects_deferred = false;\n\n\tfor (const effect of eager_effects) {\n\t\t// Mark clean inspect-effects as maybe dirty and then check their dirtiness\n\t\t// instead of just updating the effects - this way we avoid overfiring.\n\t\tif ((effect.f & CLEAN) !== 0) {\n\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t}\n\n\t\tif (is_dirty(effect)) {\n\t\t\tupdate_effect(effect);\n\t\t}\n\t}\n\n\teager_effects.clear();\n}\n\n/**\n * @template {number | bigint} T\n * @param {Source<T>} source\n * @param {1 | -1} [d]\n * @returns {T}\n */\nexport function update(source, d = 1) {\n\tvar value = get(source);\n\tvar result = d === 1 ? value++ : value--;\n\n\tset(source, value);\n\n\t// @ts-expect-error\n\treturn result;\n}\n\n/**\n * @template {number | bigint} T\n * @param {Source<T>} source\n * @param {1 | -1} [d]\n * @returns {T}\n */\nexport function update_pre(source, d = 1) {\n\tvar value = get(source);\n\n\t// @ts-expect-error\n\t// eslint-disable-next-line no-useless-assignment -- `++`/`--` used for return value, not side effect on `value`\n\treturn set(source, d === 1 ? ++value : --value);\n}\n\n/**\n * Silently (without using `get`) increment a source\n * @param {Source<number>} source\n */\nexport function increment(source) {\n\tset(source, source.v + 1);\n}\n\n/**\n * @param {Value} signal\n * @param {number} status should be DIRTY or MAYBE_DIRTY\n * @param {Effect[] | null} updated_during_traversal\n * @returns {void}\n */\nfunction mark_reactions(signal, status, updated_during_traversal) {\n\tvar reactions = signal.reactions;\n\tif (reactions === null) return;\n\n\tvar runes = is_runes();\n\tvar length = reactions.length;\n\n\tfor (var i = 0; i < length; i++) {\n\t\tvar reaction = reactions[i];\n\t\tvar flags = reaction.f;\n\n\t\t// In legacy mode, skip the current effect to prevent infinite loops\n\t\tif (!runes && reaction === active_effect) continue;\n\n\t\t// Inspect effects need to run immediately, so that the stack trace makes sense\n\t\tif (DEV && (flags & EAGER_EFFECT) !== 0) {\n\t\t\teager_effects.add(reaction);\n\t\t\tcontinue;\n\t\t}\n\n\t\tvar not_dirty = (flags & DIRTY) === 0;\n\n\t\t// don't set a DIRTY reaction to MAYBE_DIRTY\n\t\tif (not_dirty) {\n\t\t\tset_signal_status(reaction, status);\n\t\t}\n\n\t\tif ((flags & DERIVED) !== 0) {\n\t\t\tvar derived = /** @type {Derived} */ (reaction);\n\n\t\t\tbatch_values?.delete(derived);\n\n\t\t\tif ((flags & WAS_MARKED) === 0) {\n\t\t\t\t// Only connected deriveds can be reliably unmarked right away\n\t\t\t\tif (flags & CONNECTED) {\n\t\t\t\t\treaction.f |= WAS_MARKED;\n\t\t\t\t}\n\n\t\t\t\tmark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);\n\t\t\t}\n\t\t} else if (not_dirty) {\n\t\t\tvar effect = /** @type {Effect} */ (reaction);\n\n\t\t\tif ((flags & BLOCK_EFFECT) !== 0 && eager_block_effects !== null) {\n\t\t\t\teager_block_effects.add(effect);\n\t\t\t}\n\n\t\t\tif (updated_during_traversal !== null) {\n\t\t\t\tupdated_during_traversal.push(effect);\n\t\t\t} else {\n\t\t\t\tschedule_effect(effect);\n\t\t\t}\n\t\t}\n\t}\n}\n","/** @import { Source } from '#client' */\nimport { DEV } from 'esm-env';\nimport {\n\tget,\n\tactive_effect,\n\tupdate_version,\n\tactive_reaction,\n\tset_update_version,\n\tset_active_reaction\n} from './runtime.js';\nimport {\n\tarray_prototype,\n\tget_descriptor,\n\tget_prototype_of,\n\tis_array,\n\tobject_prototype\n} from '../shared/utils.js';\nimport {\n\tstate as source,\n\tset,\n\tincrement,\n\tflush_eager_effects,\n\tset_eager_effects_deferred\n} from './reactivity/sources.js';\nimport { PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants';\nimport { UNINITIALIZED } from '../../constants.js';\nimport * as e from './errors.js';\nimport { tag } from './dev/tracing.js';\nimport { get_error } from '../shared/dev.js';\nimport { tracing_mode_flag } from '../flags/index.js';\n\n// TODO move all regexes into shared module?\nconst regex_is_valid_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;\n\n/**\n * @template T\n * @param {T} value\n * @returns {T}\n */\nexport function proxy(value) {\n\t// if non-proxyable, or is already a proxy, return `value`\n\tif (typeof value !== 'object' || value === null || STATE_SYMBOL in value) {\n\t\treturn value;\n\t}\n\n\tconst prototype = get_prototype_of(value);\n\n\tif (prototype !== object_prototype && prototype !== array_prototype) {\n\t\treturn value;\n\t}\n\n\t/** @type {Map<any, Source<any>>} */\n\tvar sources = new Map();\n\tvar is_proxied_array = is_array(value);\n\tvar version = source(0);\n\n\tvar stack = DEV && tracing_mode_flag ? get_error('created at') : null;\n\tvar parent_version = update_version;\n\n\t/**\n\t * Executes the proxy in the context of the reaction it was originally created in, if any\n\t * @template T\n\t * @param {() => T} fn\n\t */\n\tvar with_parent = (fn) => {\n\t\tif (update_version === parent_version) {\n\t\t\treturn fn();\n\t\t}\n\n\t\t// child source is being created after the initial proxy —\n\t\t// prevent it from being associated with the current reaction\n\t\tvar reaction = active_reaction;\n\t\tvar version = update_version;\n\n\t\tset_active_reaction(null);\n\t\tset_update_version(parent_version);\n\n\t\tvar result = fn();\n\n\t\tset_active_reaction(reaction);\n\t\tset_update_version(version);\n\n\t\treturn result;\n\t};\n\n\tif (is_proxied_array) {\n\t\t// We need to create the length source eagerly to ensure that\n\t\t// mutations to the array are properly synced with our proxy\n\t\tsources.set('length', source(/** @type {any[]} */ (value).length, stack));\n\t\tif (DEV) {\n\t\t\tvalue = /** @type {any} */ (inspectable_array(/** @type {any[]} */ (value)));\n\t\t}\n\t}\n\n\t/** Used in dev for $inspect.trace() */\n\tvar path = '';\n\tlet updating = false;\n\t/** @param {string} new_path */\n\tfunction update_path(new_path) {\n\t\tif (updating) return;\n\t\tupdating = true;\n\t\tpath = new_path;\n\n\t\ttag(version, `${path} version`);\n\n\t\t// rename all child sources and child proxies\n\t\tfor (const [prop, source] of sources) {\n\t\t\ttag(source, get_label(path, prop));\n\t\t}\n\t\tupdating = false;\n\t}\n\n\treturn new Proxy(/** @type {any} */ (value), {\n\t\tdefineProperty(_, prop, descriptor) {\n\t\t\tif (\n\t\t\t\t!('value' in descriptor) ||\n\t\t\t\tdescriptor.configurable === false ||\n\t\t\t\tdescriptor.enumerable === false ||\n\t\t\t\tdescriptor.writable === false\n\t\t\t) {\n\t\t\t\t// we disallow non-basic descriptors, because unless they are applied to the\n\t\t\t\t// target object — which we avoid, so that state can be forked — we will run\n\t\t\t\t// afoul of the various invariants\n\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/getOwnPropertyDescriptor#invariants\n\t\t\t\te.state_descriptors_fixed();\n\t\t\t}\n\t\t\tvar s = sources.get(prop);\n\t\t\tif (s === undefined) {\n\t\t\t\twith_parent(() => {\n\t\t\t\t\tvar s = source(descriptor.value, stack);\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t\tif (DEV && typeof prop === 'string') {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t\treturn s;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tset(s, descriptor.value, true);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\tdeleteProperty(target, prop) {\n\t\t\tvar s = sources.get(prop);\n\n\t\t\tif (s === undefined) {\n\t\t\t\tif (prop in target) {\n\t\t\t\t\tconst s = with_parent(() => source(UNINITIALIZED, stack));\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t\tincrement(version);\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tset(s, UNINITIALIZED);\n\t\t\t\tincrement(version);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\tget(target, prop, receiver) {\n\t\t\tif (prop === STATE_SYMBOL) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tif (DEV && prop === PROXY_PATH_SYMBOL) {\n\t\t\t\treturn update_path;\n\t\t\t}\n\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar exists = prop in target;\n\n\t\t\t// create a source, but only if it's an own property and not a prototype property\n\t\t\tif (s === undefined && (!exists || get_descriptor(target, prop)?.writable)) {\n\t\t\t\ts = with_parent(() => {\n\t\t\t\t\tvar p = proxy(exists ? target[prop] : UNINITIALIZED);\n\t\t\t\t\tvar s = source(p, stack);\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\n\t\t\t\t\treturn s;\n\t\t\t\t});\n\n\t\t\t\tsources.set(prop, s);\n\t\t\t}\n\n\t\t\tif (s !== undefined) {\n\t\t\t\tvar v = get(s);\n\t\t\t\treturn v === UNINITIALIZED ? undefined : v;\n\t\t\t}\n\n\t\t\treturn Reflect.get(target, prop, receiver);\n\t\t},\n\n\t\tgetOwnPropertyDescriptor(target, prop) {\n\t\t\tvar descriptor = Reflect.getOwnPropertyDescriptor(target, prop);\n\n\t\t\tif (descriptor && 'value' in descriptor) {\n\t\t\t\tvar s = sources.get(prop);\n\t\t\t\tif (s) descriptor.value = get(s);\n\t\t\t} else if (descriptor === undefined) {\n\t\t\t\tvar source = sources.get(prop);\n\t\t\t\tvar value = source?.v;\n\n\t\t\t\tif (source !== undefined && value !== UNINITIALIZED) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\twritable: true\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn descriptor;\n\t\t},\n\n\t\thas(target, prop) {\n\t\t\tif (prop === STATE_SYMBOL) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar has = (s !== undefined && s.v !== UNINITIALIZED) || Reflect.has(target, prop);\n\n\t\t\tif (\n\t\t\t\ts !== undefined ||\n\t\t\t\t(active_effect !== null && (!has || get_descriptor(target, prop)?.writable))\n\t\t\t) {\n\t\t\t\tif (s === undefined) {\n\t\t\t\t\ts = with_parent(() => {\n\t\t\t\t\t\tvar p = has ? proxy(target[prop]) : UNINITIALIZED;\n\t\t\t\t\t\tvar s = source(p, stack);\n\n\t\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn s;\n\t\t\t\t\t});\n\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t}\n\n\t\t\t\tvar value = get(s);\n\t\t\t\tif (value === UNINITIALIZED) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn has;\n\t\t},\n\n\t\tset(target, prop, value, receiver) {\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar has = prop in target;\n\n\t\t\t// variable.length = value -> clear all signals with index >= value\n\t\t\tif (is_proxied_array && prop === 'length') {\n\t\t\t\tfor (var i = value; i < /** @type {Source<number>} */ (s).v; i += 1) {\n\t\t\t\t\tvar other_s = sources.get(i + '');\n\t\t\t\t\tif (other_s !== undefined) {\n\t\t\t\t\t\tset(other_s, UNINITIALIZED);\n\t\t\t\t\t} else if (i in target) {\n\t\t\t\t\t\t// If the item exists in the original, we need to create an uninitialized source,\n\t\t\t\t\t\t// else a later read of the property would result in a source being created with\n\t\t\t\t\t\t// the value of the original item at that index.\n\t\t\t\t\t\tother_s = with_parent(() => source(UNINITIALIZED, stack));\n\t\t\t\t\t\tsources.set(i + '', other_s);\n\n\t\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\t\ttag(other_s, get_label(path, i));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we haven't yet created a source for this property, we need to ensure\n\t\t\t// we do so otherwise if we read it later, then the write won't be tracked and\n\t\t\t// the heuristics of effects will be different vs if we had read the proxied\n\t\t\t// object property before writing to that property.\n\t\t\tif (s === undefined) {\n\t\t\t\tif (!has || get_descriptor(target, prop)?.writable) {\n\t\t\t\t\ts = with_parent(() => source(undefined, stack));\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t\tset(s, proxy(value));\n\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thas = s.v !== UNINITIALIZED;\n\n\t\t\t\tvar p = with_parent(() => proxy(value));\n\t\t\t\tset(s, p);\n\t\t\t}\n\n\t\t\tvar descriptor = Reflect.getOwnPropertyDescriptor(target, prop);\n\n\t\t\t// Set the new value before updating any signals so that any listeners get the new value\n\t\t\tif (descriptor?.set) {\n\t\t\t\tdescriptor.set.call(receiver, value);\n\t\t\t}\n\n\t\t\tif (!has) {\n\t\t\t\t// If we have mutated an array directly, we might need to\n\t\t\t\t// signal that length has also changed. Do it before updating metadata\n\t\t\t\t// to ensure that iterating over the array as a result of a metadata update\n\t\t\t\t// will not cause the length to be out of sync.\n\t\t\t\tif (is_proxied_array && typeof prop === 'string') {\n\t\t\t\t\tvar ls = /** @type {Source<number>} */ (sources.get('length'));\n\t\t\t\t\tvar n = Number(prop);\n\n\t\t\t\t\tif (Number.isInteger(n) && n >= ls.v) {\n\t\t\t\t\t\tset(ls, n + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tincrement(version);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\townKeys(target) {\n\t\t\tget(version);\n\n\t\t\tvar own_keys = Reflect.ownKeys(target).filter((key) => {\n\t\t\t\tvar source = sources.get(key);\n\t\t\t\treturn source === undefined || source.v !== UNINITIALIZED;\n\t\t\t});\n\n\t\t\tfor (var [key, source] of sources) {\n\t\t\t\tif (source.v !== UNINITIALIZED && !(key in target)) {\n\t\t\t\t\town_keys.push(key);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn own_keys;\n\t\t},\n\n\t\tsetPrototypeOf() {\n\t\t\te.state_prototype_fixed();\n\t\t}\n\t});\n}\n\n/**\n * @param {string} path\n * @param {string | symbol} prop\n */\nfunction get_label(path, prop) {\n\tif (typeof prop === 'symbol') return `${path}[Symbol(${prop.description ?? ''})]`;\n\tif (regex_is_valid_identifier.test(prop)) return `${path}.${prop}`;\n\treturn /^\\d+$/.test(prop) ? `${path}[${prop}]` : `${path}['${prop}']`;\n}\n\n/**\n * @param {any} value\n */\nexport function get_proxied_value(value) {\n\ttry {\n\t\tif (value !== null && typeof value === 'object' && STATE_SYMBOL in value) {\n\t\t\treturn value[STATE_SYMBOL];\n\t\t}\n\t} catch {\n\t\t// the above if check can throw an error if the value in question\n\t\t// is the contentWindow of an iframe on another domain, in which\n\t\t// case we want to just return the value (because it's definitely\n\t\t// not a proxied value) so we don't break any JavaScript interacting\n\t\t// with that iframe (such as various payment companies client side\n\t\t// JavaScript libraries interacting with their iframes on the same\n\t\t// domain)\n\t}\n\n\treturn value;\n}\n\n/**\n * @param {any} a\n * @param {any} b\n */\nexport function is(a, b) {\n\treturn Object.is(get_proxied_value(a), get_proxied_value(b));\n}\n\nconst ARRAY_MUTATING_METHODS = new Set([\n\t'copyWithin',\n\t'fill',\n\t'pop',\n\t'push',\n\t'reverse',\n\t'shift',\n\t'sort',\n\t'splice',\n\t'unshift'\n]);\n\n/**\n * Wrap array mutating methods so $inspect is triggered only once and\n * to prevent logging an array in intermediate state (e.g. with an empty slot)\n * @param {any[]} array\n */\nfunction inspectable_array(array) {\n\treturn new Proxy(array, {\n\t\tget(target, prop, receiver) {\n\t\t\tvar value = Reflect.get(target, prop, receiver);\n\t\t\tif (!ARRAY_MUTATING_METHODS.has(/** @type {string} */ (prop))) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @this {any[]}\n\t\t\t * @param {any[]} args\n\t\t\t */\n\t\t\treturn function (...args) {\n\t\t\t\tset_eager_effects_deferred();\n\t\t\t\tvar result = value.apply(this, args);\n\t\t\t\tflush_eager_effects();\n\t\t\t\treturn result;\n\t\t\t};\n\t\t}\n\t});\n}\n","import * as w from '../warnings.js';\nimport { get_proxied_value } from '../proxy.js';\n\nexport function init_array_prototype_warnings() {\n\tconst array_prototype = Array.prototype;\n\t// The REPL ends up here over and over, and this prevents it from adding more and more patches\n\t// of the same kind to the prototype, which would slow down everything over time.\n\t// @ts-expect-error\n\tconst cleanup = Array.__svelte_cleanup;\n\tif (cleanup) {\n\t\tcleanup();\n\t}\n\n\tconst { indexOf, lastIndexOf, includes } = array_prototype;\n\n\tarray_prototype.indexOf = function (item, from_index) {\n\t\tconst index = indexOf.call(this, item, from_index);\n\n\t\tif (index === -1) {\n\t\t\tfor (let i = from_index ?? 0; i < this.length; i += 1) {\n\t\t\t\tif (get_proxied_value(this[i]) === item) {\n\t\t\t\t\tw.state_proxy_equality_mismatch('array.indexOf(...)');\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn index;\n\t};\n\n\tarray_prototype.lastIndexOf = function (item, from_index) {\n\t\t// we need to specify this.length - 1 because it's probably using something like\n\t\t// `arguments` inside so passing undefined is different from not passing anything\n\t\tconst index = lastIndexOf.call(this, item, from_index ?? this.length - 1);\n\n\t\tif (index === -1) {\n\t\t\tfor (let i = 0; i <= (from_index ?? this.length - 1); i += 1) {\n\t\t\t\tif (get_proxied_value(this[i]) === item) {\n\t\t\t\t\tw.state_proxy_equality_mismatch('array.lastIndexOf(...)');\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn index;\n\t};\n\n\tarray_prototype.includes = function (item, from_index) {\n\t\tconst has = includes.call(this, item, from_index);\n\n\t\tif (!has) {\n\t\t\tfor (let i = 0; i < this.length; i += 1) {\n\t\t\t\tif (get_proxied_value(this[i]) === item) {\n\t\t\t\t\tw.state_proxy_equality_mismatch('array.includes(...)');\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn has;\n\t};\n\n\t// @ts-expect-error\n\tArray.__svelte_cleanup = () => {\n\t\tarray_prototype.indexOf = indexOf;\n\t\tarray_prototype.lastIndexOf = lastIndexOf;\n\t\tarray_prototype.includes = includes;\n\t};\n}\n\n/**\n * @param {any} a\n * @param {any} b\n * @param {boolean} equal\n * @returns {boolean}\n */\nexport function strict_equals(a, b, equal = true) {\n\t// try-catch needed because this tries to read properties of `a` and `b`,\n\t// which could be disallowed for example in a secure context\n\ttry {\n\t\tif ((a === b) !== (get_proxied_value(a) === get_proxied_value(b))) {\n\t\t\tw.state_proxy_equality_mismatch(equal ? '===' : '!==');\n\t\t}\n\t} catch {}\n\n\treturn (a === b) === equal;\n}\n\n/**\n * @param {any} a\n * @param {any} b\n * @param {boolean} equal\n * @returns {boolean}\n */\nexport function equals(a, b, equal = true) {\n\tif ((a == b) !== (get_proxied_value(a) == get_proxied_value(b))) {\n\t\tw.state_proxy_equality_mismatch(equal ? '==' : '!=');\n\t}\n\n\treturn (a == b) === equal;\n}\n","/** @import { Effect, TemplateNode } from '#client' */\nimport { hydrate_node, hydrating, set_hydrate_node } from './hydration.js';\nimport { DEV } from 'esm-env';\nimport { init_array_prototype_warnings } from '../dev/equality.js';\nimport { get_descriptor, is_extensible } from '../../shared/utils.js';\nimport { active_effect } from '../runtime.js';\nimport { async_mode_flag } from '../../flags/index.js';\nimport { TEXT_NODE, REACTION_RAN } from '#client/constants';\nimport { eager_block_effects } from '../reactivity/batch.js';\nimport { NAMESPACE_HTML } from '../../../constants.js';\n\n// export these for reference in the compiled code, making global name deduplication unnecessary\n/** @type {Window} */\nexport var $window;\n\n/** @type {Document} */\nexport var $document;\n\n/** @type {boolean} */\nexport var is_firefox;\n\n/** @type {() => Node | null} */\nvar first_child_getter;\n/** @type {() => Node | null} */\nvar next_sibling_getter;\n\n/**\n * Initialize these lazily to avoid issues when using the runtime in a server context\n * where these globals are not available while avoiding a separate server entry point\n */\nexport function init_operations() {\n\tif ($window !== undefined) {\n\t\treturn;\n\t}\n\n\t$window = window;\n\t$document = document;\n\tis_firefox = /Firefox/.test(navigator.userAgent);\n\n\tvar element_prototype = Element.prototype;\n\tvar node_prototype = Node.prototype;\n\tvar text_prototype = Text.prototype;\n\n\t// @ts-ignore\n\tfirst_child_getter = get_descriptor(node_prototype, 'firstChild').get;\n\t// @ts-ignore\n\tnext_sibling_getter = get_descriptor(node_prototype, 'nextSibling').get;\n\n\tif (is_extensible(element_prototype)) {\n\t\t// the following assignments improve perf of lookups on DOM nodes\n\t\t// @ts-expect-error\n\t\telement_prototype.__click = undefined;\n\t\t// @ts-expect-error\n\t\telement_prototype.__className = undefined;\n\t\t// @ts-expect-error\n\t\telement_prototype.__attributes = null;\n\t\t// @ts-expect-error\n\t\telement_prototype.__style = undefined;\n\t\t// @ts-expect-error\n\t\telement_prototype.__e = undefined;\n\t}\n\n\tif (is_extensible(text_prototype)) {\n\t\t// @ts-expect-error\n\t\ttext_prototype.__t = undefined;\n\t}\n\n\tif (DEV) {\n\t\t// @ts-expect-error\n\t\telement_prototype.__svelte_meta = null;\n\n\t\tinit_array_prototype_warnings();\n\t}\n}\n\n/**\n * @param {string} value\n * @returns {Text}\n */\nexport function create_text(value = '') {\n\treturn document.createTextNode(value);\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function get_first_child(node) {\n\treturn /** @type {TemplateNode | null} */ (first_child_getter.call(node));\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function get_next_sibling(node) {\n\treturn /** @type {TemplateNode | null} */ (next_sibling_getter.call(node));\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @template {Node} N\n * @param {N} node\n * @param {boolean} is_text\n * @returns {TemplateNode | null}\n */\nexport function child(node, is_text) {\n\tif (!hydrating) {\n\t\treturn get_first_child(node);\n\t}\n\n\tvar child = get_first_child(hydrate_node);\n\n\t// Child can be null if we have an element with a single child, like `<p>{text}</p>`, where `text` is empty\n\tif (child === null) {\n\t\tchild = hydrate_node.appendChild(create_text());\n\t} else if (is_text && child.nodeType !== TEXT_NODE) {\n\t\tvar text = create_text();\n\t\tchild?.before(text);\n\t\tset_hydrate_node(text);\n\t\treturn text;\n\t}\n\n\tif (is_text) {\n\t\tmerge_text_nodes(/** @type {Text} */ (child));\n\t}\n\n\tset_hydrate_node(child);\n\treturn child;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {TemplateNode} node\n * @param {boolean} [is_text]\n * @returns {TemplateNode | null}\n */\nexport function first_child(node, is_text = false) {\n\tif (!hydrating) {\n\t\tvar first = get_first_child(node);\n\n\t\t// TODO prevent user comments with the empty string when preserveComments is true\n\t\tif (first instanceof Comment && first.data === '') return get_next_sibling(first);\n\n\t\treturn first;\n\t}\n\n\tif (is_text) {\n\t\t// if an {expression} is empty during SSR, there might be no\n\t\t// text node to hydrate — we must therefore create one\n\t\tif (hydrate_node?.nodeType !== TEXT_NODE) {\n\t\t\tvar text = create_text();\n\n\t\t\thydrate_node?.before(text);\n\t\t\tset_hydrate_node(text);\n\t\t\treturn text;\n\t\t}\n\n\t\tmerge_text_nodes(/** @type {Text} */ (hydrate_node));\n\t}\n\n\treturn hydrate_node;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {TemplateNode} node\n * @param {number} count\n * @param {boolean} is_text\n * @returns {TemplateNode | null}\n */\nexport function sibling(node, count = 1, is_text = false) {\n\tlet next_sibling = hydrating ? hydrate_node : node;\n\tvar last_sibling;\n\n\twhile (count--) {\n\t\tlast_sibling = next_sibling;\n\t\tnext_sibling = /** @type {TemplateNode} */ (get_next_sibling(next_sibling));\n\t}\n\n\tif (!hydrating) {\n\t\treturn next_sibling;\n\t}\n\n\tif (is_text) {\n\t\t// if a sibling {expression} is empty during SSR, there might be no\n\t\t// text node to hydrate — we must therefore create one\n\t\tif (next_sibling?.nodeType !== TEXT_NODE) {\n\t\t\tvar text = create_text();\n\t\t\t// If the next sibling is `null` and we're handling text then it's because\n\t\t\t// the SSR content was empty for the text, so we need to generate a new text\n\t\t\t// node and insert it after the last sibling\n\t\t\tif (next_sibling === null) {\n\t\t\t\tlast_sibling?.after(text);\n\t\t\t} else {\n\t\t\t\tnext_sibling.before(text);\n\t\t\t}\n\t\t\tset_hydrate_node(text);\n\t\t\treturn text;\n\t\t}\n\n\t\tmerge_text_nodes(/** @type {Text} */ (next_sibling));\n\t}\n\n\tset_hydrate_node(next_sibling);\n\treturn next_sibling;\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n * @returns {void}\n */\nexport function clear_text_content(node) {\n\tnode.textContent = '';\n}\n\n/**\n * Returns `true` if we're updating the current block, for example `condition` in\n * an `{#if condition}` block just changed. In this case, the branch should be\n * appended (or removed) at the same time as other updates within the\n * current `<svelte:boundary>`\n */\nexport function should_defer_append() {\n\tif (!async_mode_flag) return false;\n\tif (eager_block_effects !== null) return false;\n\n\tvar flags = /** @type {Effect} */ (active_effect).f;\n\treturn (flags & REACTION_RAN) !== 0;\n}\n\n/**\n * @template {keyof HTMLElementTagNameMap | string} T\n * @param {T} tag\n * @param {string} [namespace]\n * @param {string} [is]\n * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element}\n */\nexport function create_element(tag, namespace, is) {\n\tlet options = is ? { is } : undefined;\n\treturn /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */ (\n\t\tdocument.createElementNS(namespace ?? NAMESPACE_HTML, tag, options)\n\t);\n}\n\nexport function create_fragment() {\n\treturn document.createDocumentFragment();\n}\n\n/**\n * @param {string} data\n * @returns\n */\nexport function create_comment(data = '') {\n\treturn document.createComment(data);\n}\n\n/**\n * @param {Element} element\n * @param {string} key\n * @param {string} value\n * @returns\n */\nexport function set_attribute(element, key, value = '') {\n\tif (key.startsWith('xlink:')) {\n\t\telement.setAttributeNS('http://www.w3.org/1999/xlink', key, value);\n\t\treturn;\n\t}\n\treturn element.setAttribute(key, value);\n}\n\n/**\n * Browsers split text nodes larger than 65536 bytes when parsing.\n * For hydration to succeed, we need to stitch them back together\n * @param {Text} text\n */\nexport function merge_text_nodes(text) {\n\tif (/** @type {string} */ (text.nodeValue).length < 65536) {\n\t\treturn;\n\t}\n\n\tlet next = text.nextSibling;\n\n\twhile (next !== null && next.nodeType === TEXT_NODE) {\n\t\tnext.remove();\n\n\t\t/** @type {string} */ (text.nodeValue) += /** @type {string} */ (next.nodeValue);\n\n\t\tnext = text.nextSibling;\n\t}\n}\n","import { teardown } from '../../../reactivity/effects.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../../runtime.js';\nimport { add_form_reset_listener } from '../misc.js';\n\n/**\n * Fires the handler once immediately (unless corresponding arg is set to `false`),\n * then listens to the given events until the render effect context is destroyed\n * @param {EventTarget} target\n * @param {Array<string>} events\n * @param {(event?: Event) => void} handler\n * @param {any} call_handler_immediately\n */\nexport function listen(target, events, handler, call_handler_immediately = true) {\n\tif (call_handler_immediately) {\n\t\thandler();\n\t}\n\n\tfor (var name of events) {\n\t\ttarget.addEventListener(name, handler);\n\t}\n\n\tteardown(() => {\n\t\tfor (var name of events) {\n\t\t\ttarget.removeEventListener(name, handler);\n\t\t}\n\t});\n}\n\n/**\n * @template T\n * @param {() => T} fn\n */\nexport function without_reactive_context(fn) {\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\ttry {\n\t\treturn fn();\n\t} finally {\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t}\n}\n\n/**\n * Listen to the given event, and then instantiate a global form reset listener if not already done,\n * to notify all bindings when the form is reset\n * @param {HTMLElement} element\n * @param {string} event\n * @param {(is_reset?: true) => void} handler\n * @param {(is_reset?: true) => void} [on_reset]\n */\nexport function listen_to_event_and_reset_event(element, event, handler, on_reset = handler) {\n\telement.addEventListener(event, () => without_reactive_context(handler));\n\t// @ts-expect-error\n\tconst prev = element.__on_r;\n\tif (prev) {\n\t\t// special case for checkbox that can have multiple binds (group & checked)\n\t\t// @ts-expect-error\n\t\telement.__on_r = () => {\n\t\t\tprev();\n\t\t\ton_reset(true);\n\t\t};\n\t} else {\n\t\t// @ts-expect-error\n\t\telement.__on_r = () => on_reset(true);\n\t}\n\n\tadd_form_reset_listener();\n}\n","/** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */\nimport {\n\tis_dirty,\n\tactive_effect,\n\tactive_reaction,\n\tupdate_effect,\n\tget,\n\tis_destroying_effect,\n\tremove_reactions,\n\tset_active_reaction,\n\tset_is_destroying_effect,\n\tuntrack,\n\tuntracking,\n\tset_active_effect\n} from '../runtime.js';\nimport {\n\tDIRTY,\n\tBRANCH_EFFECT,\n\tRENDER_EFFECT,\n\tEFFECT,\n\tDESTROYED,\n\tINERT,\n\tREACTION_RAN,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tEFFECT_TRANSPARENT,\n\tDERIVED,\n\tCLEAN,\n\tEAGER_EFFECT,\n\tHEAD_EFFECT,\n\tMAYBE_DIRTY,\n\tEFFECT_PRESERVED,\n\tSTALE_REACTION,\n\tUSER_EFFECT,\n\tASYNC,\n\tCONNECTED,\n\tMANAGED_EFFECT,\n\tDESTROYING\n} from '#client/constants';\nimport * as e from '../errors.js';\nimport { DEV } from 'esm-env';\nimport { define_property } from '../../shared/utils.js';\nimport { get_next_sibling } from '../dom/operations.js';\nimport { component_context, dev_current_component_function, dev_stack } from '../context.js';\nimport { Batch, collected_effects } from './batch.js';\nimport { flatten, increment_pending } from './async.js';\nimport { without_reactive_context } from '../dom/elements/bindings/shared.js';\nimport { set_signal_status } from './status.js';\n\n/**\n * @param {'$effect' | '$effect.pre' | '$inspect'} rune\n */\nexport function validate_effect(rune) {\n\tif (active_effect === null) {\n\t\tif (active_reaction === null) {\n\t\t\te.effect_orphan(rune);\n\t\t}\n\n\t\te.effect_in_unowned_derived();\n\t}\n\n\tif (is_destroying_effect) {\n\t\te.effect_in_teardown(rune);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {Effect} parent_effect\n */\nfunction push_effect(effect, parent_effect) {\n\tvar parent_last = parent_effect.last;\n\tif (parent_last === null) {\n\t\tparent_effect.last = parent_effect.first = effect;\n\t} else {\n\t\tparent_last.next = effect;\n\t\teffect.prev = parent_last;\n\t\tparent_effect.last = effect;\n\t}\n}\n\n/**\n * @param {number} type\n * @param {null | (() => void | (() => void))} fn\n * @returns {Effect}\n */\nfunction create_effect(type, fn) {\n\tvar parent = active_effect;\n\n\tif (DEV) {\n\t\t// Ensure the parent is never an inspect effect\n\t\twhile (parent !== null && (parent.f & EAGER_EFFECT) !== 0) {\n\t\t\tparent = parent.parent;\n\t\t}\n\t}\n\n\tif (parent !== null && (parent.f & INERT) !== 0) {\n\t\ttype |= INERT;\n\t}\n\n\t/** @type {Effect} */\n\tvar effect = {\n\t\tctx: component_context,\n\t\tdeps: null,\n\t\tnodes: null,\n\t\tf: type | DIRTY | CONNECTED,\n\t\tfirst: null,\n\t\tfn,\n\t\tlast: null,\n\t\tnext: null,\n\t\tparent,\n\t\tb: parent && parent.b,\n\t\tprev: null,\n\t\tteardown: null,\n\t\twv: 0,\n\t\tac: null\n\t};\n\n\tif (DEV) {\n\t\teffect.component_function = dev_current_component_function;\n\t}\n\n\t/** @type {Effect | null} */\n\tvar e = effect;\n\n\tif ((type & EFFECT) !== 0) {\n\t\tif (collected_effects !== null) {\n\t\t\t// created during traversal — collect and run afterwards\n\t\t\tcollected_effects.push(effect);\n\t\t} else {\n\t\t\t// schedule for later\n\t\t\tBatch.ensure().schedule(effect);\n\t\t}\n\t} else if (fn !== null) {\n\t\ttry {\n\t\t\tupdate_effect(effect);\n\t\t} catch (e) {\n\t\t\tdestroy_effect(effect);\n\t\t\tthrow e;\n\t\t}\n\n\t\t// if an effect doesn't need to be kept in the tree (because it\n\t\t// won't re-run, has no DOM, and has no teardown etc)\n\t\t// then we skip it and go to its child (if any)\n\t\tif (\n\t\t\te.deps === null &&\n\t\t\te.teardown === null &&\n\t\t\te.nodes === null &&\n\t\t\te.first === e.last && // either `null`, or a singular child\n\t\t\t(e.f & EFFECT_PRESERVED) === 0\n\t\t) {\n\t\t\te = e.first;\n\t\t\tif ((type & BLOCK_EFFECT) !== 0 && (type & EFFECT_TRANSPARENT) !== 0 && e !== null) {\n\t\t\t\te.f |= EFFECT_TRANSPARENT;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (e !== null) {\n\t\te.parent = parent;\n\n\t\tif (parent !== null) {\n\t\t\tpush_effect(e, parent);\n\t\t}\n\n\t\t// if we're in a derived, add the effect there too\n\t\tif (\n\t\t\tactive_reaction !== null &&\n\t\t\t(active_reaction.f & DERIVED) !== 0 &&\n\t\t\t(type & ROOT_EFFECT) === 0\n\t\t) {\n\t\t\tvar derived = /** @type {Derived} */ (active_reaction);\n\t\t\t(derived.effects ??= []).push(e);\n\t\t}\n\t}\n\n\treturn effect;\n}\n\n/**\n * Internal representation of `$effect.tracking()`\n * @returns {boolean}\n */\nexport function effect_tracking() {\n\treturn active_reaction !== null && !untracking;\n}\n\n/**\n * @param {() => void} fn\n */\nexport function teardown(fn) {\n\tconst effect = create_effect(RENDER_EFFECT, null);\n\tset_signal_status(effect, CLEAN);\n\teffect.teardown = fn;\n\treturn effect;\n}\n\n/**\n * Internal representation of `$effect(...)`\n * @param {() => void | (() => void)} fn\n */\nexport function user_effect(fn) {\n\tvalidate_effect('$effect');\n\n\tif (DEV) {\n\t\tdefine_property(fn, 'name', {\n\t\t\tvalue: '$effect'\n\t\t});\n\t}\n\n\t// Non-nested `$effect(...)` in a component should be deferred\n\t// until the component is mounted\n\tvar flags = /** @type {Effect} */ (active_effect).f;\n\tvar defer = !active_reaction && (flags & BRANCH_EFFECT) !== 0 && (flags & REACTION_RAN) === 0;\n\n\tif (defer) {\n\t\t// Top-level `$effect(...)` in an unmounted component — defer until mount\n\t\tvar context = /** @type {ComponentContext} */ (component_context);\n\t\t(context.e ??= []).push(fn);\n\t} else {\n\t\t// Everything else — create immediately\n\t\treturn create_user_effect(fn);\n\t}\n}\n\n/**\n * @param {() => void | (() => void)} fn\n */\nexport function create_user_effect(fn) {\n\treturn create_effect(EFFECT | USER_EFFECT, fn);\n}\n\n/**\n * Internal representation of `$effect.pre(...)`\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function user_pre_effect(fn) {\n\tvalidate_effect('$effect.pre');\n\tif (DEV) {\n\t\tdefine_property(fn, 'name', {\n\t\t\tvalue: '$effect.pre'\n\t\t});\n\t}\n\treturn create_effect(RENDER_EFFECT | USER_EFFECT, fn);\n}\n\n/** @param {() => void | (() => void)} fn */\nexport function eager_effect(fn) {\n\treturn create_effect(EAGER_EFFECT, fn);\n}\n\n/**\n * Internal representation of `$effect.root(...)`\n * @param {() => void | (() => void)} fn\n * @returns {() => void}\n */\nexport function effect_root(fn) {\n\tBatch.ensure();\n\tconst effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn);\n\n\treturn () => {\n\t\tdestroy_effect(effect);\n\t};\n}\n\n/**\n * An effect root whose children can transition out\n * @param {() => void} fn\n * @returns {(options?: { outro?: boolean }) => Promise<void>}\n */\nexport function component_root(fn) {\n\tBatch.ensure();\n\tconst effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn);\n\n\treturn (options = {}) => {\n\t\treturn new Promise((fulfil) => {\n\t\t\tif (options.outro) {\n\t\t\t\tpause_effect(effect, () => {\n\t\t\t\t\tdestroy_effect(effect);\n\t\t\t\t\tfulfil(undefined);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tdestroy_effect(effect);\n\t\t\t\tfulfil(undefined);\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function effect(fn) {\n\treturn create_effect(EFFECT, fn);\n}\n\n/**\n * Internal representation of `$: ..`\n * @param {() => any} deps\n * @param {() => void | (() => void)} fn\n */\nexport function legacy_pre_effect(deps, fn) {\n\tvar context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\t/** @type {{ effect: null | Effect, ran: boolean, deps: () => any }} */\n\tvar token = { effect: null, ran: false, deps };\n\n\tcontext.l.$.push(token);\n\n\ttoken.effect = render_effect(() => {\n\t\tdeps();\n\n\t\t// If this legacy pre effect has already run before the end of the reset, then\n\t\t// bail out to emulate the same behavior.\n\t\tif (token.ran) return;\n\n\t\ttoken.ran = true;\n\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t// here, we lie: by setting `active_effect` to be the parent branch, any writes\n\t\t// that happen inside `fn` will _not_ cause an unnecessary reschedule, because\n\t\t// the affected effects will be children of `active_effect`. this is safe\n\t\t// because these effects are known to run in the correct order\n\t\ttry {\n\t\t\tset_active_effect(effect.parent);\n\t\t\tuntrack(fn);\n\t\t} finally {\n\t\t\tset_active_effect(effect);\n\t\t}\n\t});\n}\n\nexport function legacy_pre_effect_reset() {\n\tvar context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\trender_effect(() => {\n\t\t// Run dirty `$:` statements\n\t\tfor (var token of context.l.$) {\n\t\t\ttoken.deps();\n\n\t\t\tvar effect = token.effect;\n\n\t\t\t// If the effect is CLEAN, then make it MAYBE_DIRTY. This ensures we traverse through\n\t\t\t// the effects dependencies and correctly ensure each dependency is up-to-date.\n\t\t\tif ((effect.f & CLEAN) !== 0 && effect.deps !== null) {\n\t\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t\t}\n\n\t\t\tif (is_dirty(effect)) {\n\t\t\t\tupdate_effect(effect);\n\t\t\t}\n\n\t\t\ttoken.ran = false;\n\t\t}\n\t});\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function async_effect(fn) {\n\treturn create_effect(ASYNC | EFFECT_PRESERVED, fn);\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function render_effect(fn, flags = 0) {\n\treturn create_effect(RENDER_EFFECT | flags, fn);\n}\n\n/**\n * @param {(...expressions: any) => void | (() => void)} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n */\nexport function template_effect(fn, sync = [], async = [], blockers = []) {\n\tflatten(blockers, sync, async, (values) => {\n\t\tcreate_effect(RENDER_EFFECT, () => fn(...values.map(get)));\n\t});\n}\n\n/**\n * Like `template_effect`, but with an effect which is deferred until the batch commits\n * @param {(...expressions: any) => void | (() => void)} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n */\nexport function deferred_template_effect(fn, sync = [], async = [], blockers = []) {\n\tif (async.length > 0 || blockers.length > 0) {\n\t\tvar decrement_pending = increment_pending();\n\t}\n\n\tflatten(blockers, sync, async, (values) => {\n\t\tcreate_effect(EFFECT, () => fn(...values.map(get)));\n\n\t\tif (decrement_pending) {\n\t\t\tdecrement_pending();\n\t\t}\n\t});\n}\n\n/**\n * @param {(() => void)} fn\n * @param {number} flags\n */\nexport function block(fn, flags = 0) {\n\tvar effect = create_effect(BLOCK_EFFECT | flags, fn);\n\tif (DEV) {\n\t\teffect.dev_stack = dev_stack;\n\t}\n\treturn effect;\n}\n\n/**\n * @param {(() => void)} fn\n * @param {number} flags\n */\nexport function managed(fn, flags = 0) {\n\tvar effect = create_effect(MANAGED_EFFECT | flags, fn);\n\tif (DEV) {\n\t\teffect.dev_stack = dev_stack;\n\t}\n\treturn effect;\n}\n\n/**\n * @param {(() => void)} fn\n */\nexport function branch(fn) {\n\treturn create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn);\n}\n\n/**\n * @param {Effect} effect\n */\nexport function execute_effect_teardown(effect) {\n\tvar teardown = effect.teardown;\n\tif (teardown !== null) {\n\t\tconst previously_destroying_effect = is_destroying_effect;\n\t\tconst previous_reaction = active_reaction;\n\t\tset_is_destroying_effect(true);\n\t\tset_active_reaction(null);\n\t\ttry {\n\t\t\tteardown.call(null);\n\t\t} finally {\n\t\t\tset_is_destroying_effect(previously_destroying_effect);\n\t\t\tset_active_reaction(previous_reaction);\n\t\t}\n\t}\n}\n\n/**\n * @param {Effect} signal\n * @param {boolean} remove_dom\n * @returns {void}\n */\nexport function destroy_effect_children(signal, remove_dom = false) {\n\tvar effect = signal.first;\n\tsignal.first = signal.last = null;\n\n\twhile (effect !== null) {\n\t\tconst controller = effect.ac;\n\n\t\tif (controller !== null) {\n\t\t\twithout_reactive_context(() => {\n\t\t\t\tcontroller.abort(STALE_REACTION);\n\t\t\t});\n\t\t}\n\n\t\tvar next = effect.next;\n\n\t\tif ((effect.f & ROOT_EFFECT) !== 0) {\n\t\t\t// this is now an independent root\n\t\t\teffect.parent = null;\n\t\t} else {\n\t\t\tdestroy_effect(effect, remove_dom);\n\t\t}\n\n\t\teffect = next;\n\t}\n}\n\n/**\n * @param {Effect} signal\n * @returns {void}\n */\nexport function destroy_block_effect_children(signal) {\n\tvar effect = signal.first;\n\n\twhile (effect !== null) {\n\t\tvar next = effect.next;\n\t\tif ((effect.f & BRANCH_EFFECT) === 0) {\n\t\t\tdestroy_effect(effect);\n\t\t}\n\t\teffect = next;\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {boolean} [remove_dom]\n * @returns {void}\n */\nexport function destroy_effect(effect, remove_dom = true) {\n\tvar removed = false;\n\n\tif (\n\t\t(remove_dom || (effect.f & HEAD_EFFECT) !== 0) &&\n\t\teffect.nodes !== null &&\n\t\teffect.nodes.end !== null\n\t) {\n\t\tremove_effect_dom(effect.nodes.start, /** @type {TemplateNode} */ (effect.nodes.end));\n\t\tremoved = true;\n\t}\n\n\tset_signal_status(effect, DESTROYING);\n\tdestroy_effect_children(effect, remove_dom && !removed);\n\tremove_reactions(effect, 0);\n\n\tvar transitions = effect.nodes && effect.nodes.t;\n\n\tif (transitions !== null) {\n\t\tfor (const transition of transitions) {\n\t\t\ttransition.stop();\n\t\t}\n\t}\n\n\texecute_effect_teardown(effect);\n\n\teffect.f ^= DESTROYING;\n\teffect.f |= DESTROYED;\n\n\tvar parent = effect.parent;\n\n\t// If the parent doesn't have any children, then skip this work altogether\n\tif (parent !== null && parent.first !== null) {\n\t\tunlink_effect(effect);\n\t}\n\n\tif (DEV) {\n\t\teffect.component_function = null;\n\t}\n\n\t// `first` and `child` are nulled out in destroy_effect_children\n\t// we don't null out `parent` so that error propagation can work correctly\n\teffect.next =\n\t\teffect.prev =\n\t\teffect.teardown =\n\t\teffect.ctx =\n\t\teffect.deps =\n\t\teffect.fn =\n\t\teffect.nodes =\n\t\teffect.ac =\n\t\t\tnull;\n}\n\n/**\n *\n * @param {TemplateNode | null} node\n * @param {TemplateNode} end\n */\nexport function remove_effect_dom(node, end) {\n\twhile (node !== null) {\n\t\t/** @type {TemplateNode | null} */\n\t\tvar next = node === end ? null : get_next_sibling(node);\n\n\t\tnode.remove();\n\t\tnode = next;\n\t}\n}\n\n/**\n * Detach an effect from the effect tree, freeing up memory and\n * reducing the amount of work that happens on subsequent traversals\n * @param {Effect} effect\n */\nexport function unlink_effect(effect) {\n\tvar parent = effect.parent;\n\tvar prev = effect.prev;\n\tvar next = effect.next;\n\n\tif (prev !== null) prev.next = next;\n\tif (next !== null) next.prev = prev;\n\n\tif (parent !== null) {\n\t\tif (parent.first === effect) parent.first = next;\n\t\tif (parent.last === effect) parent.last = prev;\n\t}\n}\n\n/**\n * When a block effect is removed, we don't immediately destroy it or yank it\n * out of the DOM, because it might have transitions. Instead, we 'pause' it.\n * It stays around (in memory, and in the DOM) until outro transitions have\n * completed, and if the state change is reversed then we _resume_ it.\n * A paused effect does not update, and the DOM subtree becomes inert.\n * @param {Effect} effect\n * @param {() => void} [callback]\n * @param {boolean} [destroy]\n */\nexport function pause_effect(effect, callback, destroy = true) {\n\t/** @type {TransitionManager[]} */\n\tvar transitions = [];\n\n\tpause_children(effect, transitions, true);\n\n\tvar fn = () => {\n\t\tif (destroy) destroy_effect(effect);\n\t\tif (callback) callback();\n\t};\n\n\tvar remaining = transitions.length;\n\tif (remaining > 0) {\n\t\tvar check = () => --remaining || fn();\n\t\tfor (var transition of transitions) {\n\t\t\ttransition.out(check);\n\t\t}\n\t} else {\n\t\tfn();\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {TransitionManager[]} transitions\n * @param {boolean} local\n */\nfunction pause_children(effect, transitions, local) {\n\tif ((effect.f & INERT) !== 0) return;\n\teffect.f ^= INERT;\n\n\tvar t = effect.nodes && effect.nodes.t;\n\n\tif (t !== null) {\n\t\tfor (const transition of t) {\n\t\t\tif (transition.is_global || local) {\n\t\t\t\ttransitions.push(transition);\n\t\t\t}\n\t\t}\n\t}\n\n\tvar child = effect.first;\n\n\twhile (child !== null) {\n\t\tvar sibling = child.next;\n\t\tvar transparent =\n\t\t\t(child.f & EFFECT_TRANSPARENT) !== 0 ||\n\t\t\t// If this is a branch effect without a block effect parent,\n\t\t\t// it means the parent block effect was pruned. In that case,\n\t\t\t// transparency information was transferred to the branch effect.\n\t\t\t((child.f & BRANCH_EFFECT) !== 0 && (effect.f & BLOCK_EFFECT) !== 0);\n\t\t// TODO we don't need to call pause_children recursively with a linked list in place\n\t\t// it's slightly more involved though as we have to account for `transparent` changing\n\t\t// through the tree.\n\t\tpause_children(child, transitions, transparent ? local : false);\n\t\tchild = sibling;\n\t}\n}\n\n/**\n * The opposite of `pause_effect`. We call this if (for example)\n * `x` becomes falsy then truthy: `{#if x}...{/if}`\n * @param {Effect} effect\n */\nexport function resume_effect(effect) {\n\tresume_children(effect, true);\n}\n\n/**\n * @param {Effect} effect\n * @param {boolean} local\n */\nfunction resume_children(effect, local) {\n\tif ((effect.f & INERT) === 0) return;\n\teffect.f ^= INERT;\n\n\t// If a dependency of this effect changed while it was paused,\n\t// schedule the effect to update. we don't use `is_dirty`\n\t// here because we don't want to eagerly recompute a derived like\n\t// `{#if foo}{foo.bar()}{/if}` if `foo` is now `undefined\n\tif ((effect.f & CLEAN) === 0) {\n\t\tset_signal_status(effect, DIRTY);\n\t\tBatch.ensure().schedule(effect); // Assumption: This happens during the commit phase of the batch, causing another flush, but it's safe\n\t}\n\n\tvar child = effect.first;\n\n\twhile (child !== null) {\n\t\tvar sibling = child.next;\n\t\tvar transparent = (child.f & EFFECT_TRANSPARENT) !== 0 || (child.f & BRANCH_EFFECT) !== 0;\n\t\t// TODO we don't need to call resume_children recursively with a linked list in place\n\t\t// it's slightly more involved though as we have to account for `transparent` changing\n\t\t// through the tree.\n\t\tresume_children(child, transparent ? local : false);\n\t\tchild = sibling;\n\t}\n\n\tvar t = effect.nodes && effect.nodes.t;\n\n\tif (t !== null) {\n\t\tfor (const transition of t) {\n\t\t\tif (transition.is_global || local) {\n\t\t\t\ttransition.in();\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function aborted(effect = /** @type {Effect} */ (active_effect)) {\n\treturn (effect.f & DESTROYED) !== 0;\n}\n\n/**\n * @param {Effect} effect\n * @param {DocumentFragment} fragment\n */\nexport function move_effect(effect, fragment) {\n\tif (!effect.nodes) return;\n\n\t/** @type {TemplateNode | null} */\n\tvar node = effect.nodes.start;\n\tvar end = effect.nodes.end;\n\n\twhile (node !== null) {\n\t\t/** @type {TemplateNode | null} */\n\t\tvar next = node === end ? null : get_next_sibling(node);\n\n\t\tfragment.append(node);\n\t\tnode = next;\n\t}\n}\n","/** @import { Value } from '#client' */\nimport { internal_set } from './reactivity/sources.js';\nimport { untrack } from './runtime.js';\n\n/**\n * @type {Set<Value> | null}\n * @deprecated\n */\nexport let captured_signals = null;\n\n/**\n * Capture an array of all the signals that are read when `fn` is called\n * @template T\n * @param {() => T} fn\n */\nfunction capture_signals(fn) {\n\tvar previous_captured_signals = captured_signals;\n\n\ttry {\n\t\tcaptured_signals = new Set();\n\n\t\tuntrack(fn);\n\n\t\tif (previous_captured_signals !== null) {\n\t\t\tfor (var signal of captured_signals) {\n\t\t\t\tprevious_captured_signals.add(signal);\n\t\t\t}\n\t\t}\n\n\t\treturn captured_signals;\n\t} finally {\n\t\tcaptured_signals = previous_captured_signals;\n\t}\n}\n\n/**\n * Invokes a function and captures all signals that are read during the invocation,\n * then invalidates them.\n * @param {() => any} fn\n * @deprecated\n */\nexport function invalidate_inner_signals(fn) {\n\tfor (var signal of capture_signals(fn)) {\n\t\tinternal_set(signal, signal.v);\n\t}\n}\n","/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */\nimport { DEV } from 'esm-env';\nimport { get_descriptors, get_prototype_of, includes, index_of } from '../shared/utils.js';\nimport {\n\tdestroy_block_effect_children,\n\tdestroy_effect_children,\n\teffect_tracking,\n\texecute_effect_teardown\n} from './reactivity/effects.js';\nimport {\n\tDIRTY,\n\tMAYBE_DIRTY,\n\tCLEAN,\n\tDERIVED,\n\tDESTROYED,\n\tBRANCH_EFFECT,\n\tSTATE_SYMBOL,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tCONNECTED,\n\tREACTION_IS_UPDATING,\n\tSTALE_REACTION,\n\tERROR_VALUE,\n\tWAS_MARKED,\n\tMANAGED_EFFECT,\n\tREACTION_RAN\n} from './constants.js';\nimport { old_values } from './reactivity/sources.js';\nimport {\n\treactivity_loss_tracker,\n\texecute_derived,\n\tfreeze_derived_effects,\n\trecent_async_deriveds,\n\tunfreeze_derived_effects,\n\tupdate_derived\n} from './reactivity/deriveds.js';\nimport { async_mode_flag, tracing_mode_flag } from '../flags/index.js';\nimport { tracing_expressions } from './dev/tracing.js';\nimport { get_error } from '../shared/dev.js';\nimport {\n\tcomponent_context,\n\tdev_current_component_function,\n\tdev_stack,\n\tis_runes,\n\tset_component_context,\n\tset_dev_current_component_function,\n\tset_dev_stack\n} from './context.js';\nimport {\n\tBatch,\n\tbatch_values,\n\tcurrent_batch,\n\tflushSync,\n\tschedule_effect\n} from './reactivity/batch.js';\nimport { handle_error } from './error-handling.js';\nimport { UNINITIALIZED } from '../../constants.js';\nimport { captured_signals } from './legacy.js';\nimport { without_reactive_context } from './dom/elements/bindings/shared.js';\nimport { set_signal_status, update_derived_status } from './reactivity/status.js';\nimport * as w from './warnings.js';\n\nlet is_updating_effect = false;\n\nexport let is_destroying_effect = false;\n\n/** @param {boolean} value */\nexport function set_is_destroying_effect(value) {\n\tis_destroying_effect = value;\n}\n\n/** @type {null | Reaction} */\nexport let active_reaction = null;\n\nexport let untracking = false;\n\n/** @param {null | Reaction} reaction */\nexport function set_active_reaction(reaction) {\n\tactive_reaction = reaction;\n}\n\n/** @type {null | Effect} */\nexport let active_effect = null;\n\n/** @param {null | Effect} effect */\nexport function set_active_effect(effect) {\n\tactive_effect = effect;\n}\n\n/**\n * When sources are created within a reaction, reading and writing\n * them within that reaction should not cause a re-run\n * @type {null | Source[]}\n */\nexport let current_sources = null;\n\n/** @param {Value} value */\nexport function push_reaction_value(value) {\n\tif (active_reaction !== null && (!async_mode_flag || (active_reaction.f & DERIVED) !== 0)) {\n\t\tif (current_sources === null) {\n\t\t\tcurrent_sources = [value];\n\t\t} else {\n\t\t\tcurrent_sources.push(value);\n\t\t}\n\t}\n}\n\n/**\n * The dependencies of the reaction that is currently being executed. In many cases,\n * the dependencies are unchanged between runs, and so this will be `null` unless\n * and until a new dependency is accessed — we track this via `skipped_deps`\n * @type {null | Value[]}\n */\nlet new_deps = null;\n\nlet skipped_deps = 0;\n\n/**\n * Tracks writes that the effect it's executed in doesn't listen to yet,\n * so that the dependency can be added to the effect later on if it then reads it\n * @type {null | Source[]}\n */\nexport let untracked_writes = null;\n\n/** @param {null | Source[]} value */\nexport function set_untracked_writes(value) {\n\tuntracked_writes = value;\n}\n\n/**\n * @type {number} Used by sources and deriveds for handling updates.\n * Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing\n **/\nexport let write_version = 1;\n\n/** @type {number} Used to version each read of a source of derived to avoid duplicating depedencies inside a reaction */\nlet read_version = 0;\n\nexport let update_version = read_version;\n\n/** @param {number} value */\nexport function set_update_version(value) {\n\tupdate_version = value;\n}\n\nexport function increment_write_version() {\n\treturn ++write_version;\n}\n\n/**\n * Determines whether a derived or effect is dirty.\n * If it is MAYBE_DIRTY, will set the status to CLEAN\n * @param {Reaction} reaction\n * @returns {boolean}\n */\nexport function is_dirty(reaction) {\n\tvar flags = reaction.f;\n\n\tif ((flags & DIRTY) !== 0) {\n\t\treturn true;\n\t}\n\n\tif (flags & DERIVED) {\n\t\treaction.f &= ~WAS_MARKED;\n\t}\n\n\tif ((flags & MAYBE_DIRTY) !== 0) {\n\t\tvar dependencies = /** @type {Value[]} */ (reaction.deps);\n\t\tvar length = dependencies.length;\n\n\t\tfor (var i = 0; i < length; i++) {\n\t\t\tvar dependency = dependencies[i];\n\n\t\t\tif (is_dirty(/** @type {Derived} */ (dependency))) {\n\t\t\t\tupdate_derived(/** @type {Derived} */ (dependency));\n\t\t\t}\n\n\t\t\tif (dependency.wv > reaction.wv) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t(flags & CONNECTED) !== 0 &&\n\t\t\t// During time traveling we don't want to reset the status so that\n\t\t\t// traversal of the graph in the other batches still happens\n\t\t\tbatch_values === null\n\t\t) {\n\t\t\tset_signal_status(reaction, CLEAN);\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * @param {Value} signal\n * @param {Effect} effect\n * @param {boolean} [root]\n */\nfunction schedule_possible_effect_self_invalidation(signal, effect, root = true) {\n\tvar reactions = signal.reactions;\n\tif (reactions === null) return;\n\n\tif (!async_mode_flag && current_sources !== null && includes.call(current_sources, signal)) {\n\t\treturn;\n\t}\n\n\tfor (var i = 0; i < reactions.length; i++) {\n\t\tvar reaction = reactions[i];\n\n\t\tif ((reaction.f & DERIVED) !== 0) {\n\t\t\tschedule_possible_effect_self_invalidation(/** @type {Derived} */ (reaction), effect, false);\n\t\t} else if (effect === reaction) {\n\t\t\tif (root) {\n\t\t\t\tset_signal_status(reaction, DIRTY);\n\t\t\t} else if ((reaction.f & CLEAN) !== 0) {\n\t\t\t\tset_signal_status(reaction, MAYBE_DIRTY);\n\t\t\t}\n\t\t\tschedule_effect(/** @type {Effect} */ (reaction));\n\t\t}\n\t}\n}\n\n/** @param {Reaction} reaction */\nexport function update_reaction(reaction) {\n\tvar previous_deps = new_deps;\n\tvar previous_skipped_deps = skipped_deps;\n\tvar previous_untracked_writes = untracked_writes;\n\tvar previous_reaction = active_reaction;\n\tvar previous_sources = current_sources;\n\tvar previous_component_context = component_context;\n\tvar previous_untracking = untracking;\n\tvar previous_update_version = update_version;\n\n\tvar flags = reaction.f;\n\n\tnew_deps = /** @type {null | Value[]} */ (null);\n\tskipped_deps = 0;\n\tuntracked_writes = null;\n\tactive_reaction = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) === 0 ? reaction : null;\n\n\tcurrent_sources = null;\n\tset_component_context(reaction.ctx);\n\tuntracking = false;\n\tupdate_version = ++read_version;\n\n\tif (reaction.ac !== null) {\n\t\twithout_reactive_context(() => {\n\t\t\t/** @type {AbortController} */ (reaction.ac).abort(STALE_REACTION);\n\t\t});\n\n\t\treaction.ac = null;\n\t}\n\n\ttry {\n\t\treaction.f |= REACTION_IS_UPDATING;\n\t\tvar fn = /** @type {Function} */ (reaction.fn);\n\t\tvar result = fn();\n\t\treaction.f |= REACTION_RAN;\n\t\tvar deps = reaction.deps;\n\n\t\t// Don't remove reactions during fork;\n\t\t// they must remain for when fork is discarded\n\t\tvar is_fork = current_batch?.is_fork;\n\n\t\tif (new_deps !== null) {\n\t\t\tvar i;\n\n\t\t\tif (!is_fork) {\n\t\t\t\tremove_reactions(reaction, skipped_deps);\n\t\t\t}\n\n\t\t\tif (deps !== null && skipped_deps > 0) {\n\t\t\t\tdeps.length = skipped_deps + new_deps.length;\n\t\t\t\tfor (i = 0; i < new_deps.length; i++) {\n\t\t\t\t\tdeps[skipped_deps + i] = new_deps[i];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treaction.deps = deps = new_deps;\n\t\t\t}\n\n\t\t\tif (effect_tracking() && (reaction.f & CONNECTED) !== 0) {\n\t\t\t\tfor (i = skipped_deps; i < deps.length; i++) {\n\t\t\t\t\t(deps[i].reactions ??= []).push(reaction);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (!is_fork && deps !== null && skipped_deps < deps.length) {\n\t\t\tremove_reactions(reaction, skipped_deps);\n\t\t\tdeps.length = skipped_deps;\n\t\t}\n\n\t\t// If we're inside an effect and we have untracked writes, then we need to\n\t\t// ensure that if any of those untracked writes result in re-invalidation\n\t\t// of the current effect, then that happens accordingly\n\t\tif (\n\t\t\tis_runes() &&\n\t\t\tuntracked_writes !== null &&\n\t\t\t!untracking &&\n\t\t\tdeps !== null &&\n\t\t\t(reaction.f & (DERIVED | MAYBE_DIRTY | DIRTY)) === 0\n\t\t) {\n\t\t\tfor (i = 0; i < /** @type {Source[]} */ (untracked_writes).length; i++) {\n\t\t\t\tschedule_possible_effect_self_invalidation(\n\t\t\t\t\tuntracked_writes[i],\n\t\t\t\t\t/** @type {Effect} */ (reaction)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// If we are returning to an previous reaction then\n\t\t// we need to increment the read version to ensure that\n\t\t// any dependencies in this reaction aren't marked with\n\t\t// the same version\n\t\tif (previous_reaction !== null && previous_reaction !== reaction) {\n\t\t\tread_version++;\n\n\t\t\t// update the `rv` of the previous reaction's deps — both existing and new —\n\t\t\t// so that they are not added again\n\t\t\tif (previous_reaction.deps !== null) {\n\t\t\t\tfor (let i = 0; i < previous_skipped_deps; i += 1) {\n\t\t\t\t\tprevious_reaction.deps[i].rv = read_version;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (previous_deps !== null) {\n\t\t\t\tfor (const dep of previous_deps) {\n\t\t\t\t\tdep.rv = read_version;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (untracked_writes !== null) {\n\t\t\t\tif (previous_untracked_writes === null) {\n\t\t\t\t\tprevious_untracked_writes = untracked_writes;\n\t\t\t\t} else {\n\t\t\t\t\tprevious_untracked_writes.push(.../** @type {Source[]} */ (untracked_writes));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ((reaction.f & ERROR_VALUE) !== 0) {\n\t\t\treaction.f ^= ERROR_VALUE;\n\t\t}\n\n\t\treturn result;\n\t} catch (error) {\n\t\treturn handle_error(error);\n\t} finally {\n\t\treaction.f ^= REACTION_IS_UPDATING;\n\t\tnew_deps = previous_deps;\n\t\tskipped_deps = previous_skipped_deps;\n\t\tuntracked_writes = previous_untracked_writes;\n\t\tactive_reaction = previous_reaction;\n\t\tcurrent_sources = previous_sources;\n\t\tset_component_context(previous_component_context);\n\t\tuntracking = previous_untracking;\n\t\tupdate_version = previous_update_version;\n\t}\n}\n\n/**\n * @template V\n * @param {Reaction} signal\n * @param {Value<V>} dependency\n * @returns {void}\n */\nfunction remove_reaction(signal, dependency) {\n\tlet reactions = dependency.reactions;\n\tif (reactions !== null) {\n\t\tvar index = index_of.call(reactions, signal);\n\t\tif (index !== -1) {\n\t\t\tvar new_length = reactions.length - 1;\n\t\t\tif (new_length === 0) {\n\t\t\t\treactions = dependency.reactions = null;\n\t\t\t} else {\n\t\t\t\t// Swap with last element and then remove.\n\t\t\t\treactions[index] = reactions[new_length];\n\t\t\t\treactions.pop();\n\t\t\t}\n\t\t}\n\t}\n\n\t// If the derived has no reactions, then we can disconnect it from the graph,\n\t// allowing it to either reconnect in the future, or be GC'd by the VM.\n\tif (\n\t\treactions === null &&\n\t\t(dependency.f & DERIVED) !== 0 &&\n\t\t// Destroying a child effect while updating a parent effect can cause a dependency to appear\n\t\t// to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`\n\t\t// allows us to skip the expensive work of disconnecting and immediately reconnecting it\n\t\t(new_deps === null || !includes.call(new_deps, dependency))\n\t) {\n\t\tvar derived = /** @type {Derived} */ (dependency);\n\n\t\t// If we are working with a derived that is owned by an effect, then mark it as being\n\t\t// disconnected and remove the mark flag, as it cannot be reliably removed otherwise\n\t\tif ((derived.f & CONNECTED) !== 0) {\n\t\t\tderived.f ^= CONNECTED;\n\t\t\tderived.f &= ~WAS_MARKED;\n\t\t}\n\n\t\tupdate_derived_status(derived);\n\n\t\t// freeze any effects inside this derived\n\t\tfreeze_derived_effects(derived);\n\n\t\t// Disconnect any reactions owned by this reaction\n\t\tremove_reactions(derived, 0);\n\t}\n}\n\n/**\n * @param {Reaction} signal\n * @param {number} start_index\n * @returns {void}\n */\nexport function remove_reactions(signal, start_index) {\n\tvar dependencies = signal.deps;\n\tif (dependencies === null) return;\n\n\tfor (var i = start_index; i < dependencies.length; i++) {\n\t\tremove_reaction(signal, dependencies[i]);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @returns {void}\n */\nexport function update_effect(effect) {\n\tvar flags = effect.f;\n\n\tif ((flags & DESTROYED) !== 0) {\n\t\treturn;\n\t}\n\n\tset_signal_status(effect, CLEAN);\n\n\tvar previous_effect = active_effect;\n\tvar was_updating_effect = is_updating_effect;\n\n\tactive_effect = effect;\n\tis_updating_effect = true;\n\n\tif (DEV) {\n\t\tvar previous_component_fn = dev_current_component_function;\n\t\tset_dev_current_component_function(effect.component_function);\n\t\tvar previous_stack = /** @type {any} */ (dev_stack);\n\t\t// only block effects have a dev stack, keep the current one otherwise\n\t\tset_dev_stack(effect.dev_stack ?? dev_stack);\n\t}\n\n\ttry {\n\t\tif ((flags & (BLOCK_EFFECT | MANAGED_EFFECT)) !== 0) {\n\t\t\tdestroy_block_effect_children(effect);\n\t\t} else {\n\t\t\tdestroy_effect_children(effect);\n\t\t}\n\n\t\texecute_effect_teardown(effect);\n\t\tvar teardown = update_reaction(effect);\n\t\teffect.teardown = typeof teardown === 'function' ? teardown : null;\n\t\teffect.wv = write_version;\n\n\t\t// In DEV, increment versions of any sources that were written to during the effect,\n\t\t// so that they are correctly marked as dirty when the effect re-runs\n\t\tif (DEV && tracing_mode_flag && (effect.f & DIRTY) !== 0 && effect.deps !== null) {\n\t\t\tfor (var dep of effect.deps) {\n\t\t\t\tif (dep.set_during_effect) {\n\t\t\t\t\tdep.wv = increment_write_version();\n\t\t\t\t\tdep.set_during_effect = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} finally {\n\t\tis_updating_effect = was_updating_effect;\n\t\tactive_effect = previous_effect;\n\n\t\tif (DEV) {\n\t\t\tset_dev_current_component_function(previous_component_fn);\n\t\t\tset_dev_stack(previous_stack);\n\t\t}\n\t}\n}\n\n/**\n * Returns a promise that resolves once any pending state changes have been applied.\n * @returns {Promise<void>}\n */\nexport async function tick() {\n\tif (async_mode_flag) {\n\t\treturn new Promise((f) => {\n\t\t\t// Race them against each other - in almost all cases requestAnimationFrame will fire first,\n\t\t\t// but e.g. in case the window is not focused or a view transition happens, requestAnimationFrame\n\t\t\t// will be delayed and setTimeout helps us resolve fast enough in that case\n\t\t\trequestAnimationFrame(() => f());\n\t\t\tsetTimeout(() => f());\n\t\t});\n\t}\n\n\tawait Promise.resolve();\n\n\t// By calling flushSync we guarantee that any pending state changes are applied after one tick.\n\t// TODO look into whether we can make flushing subsequent updates synchronously in the future.\n\tflushSync();\n}\n\n/**\n * Returns a promise that resolves once any state changes, and asynchronous work resulting from them,\n * have resolved and the DOM has been updated\n * @returns {Promise<void>}\n * @since 5.36\n */\nexport function settled() {\n\treturn Batch.ensure().settled();\n}\n\n/**\n * @template V\n * @param {Value<V>} signal\n * @returns {V}\n */\nexport function get(signal) {\n\tvar flags = signal.f;\n\tvar is_derived = (flags & DERIVED) !== 0;\n\n\tcaptured_signals?.add(signal);\n\n\t// Register the dependency on the current reaction signal.\n\tif (active_reaction !== null && !untracking) {\n\t\t// if we're in a derived that is being read inside an _async_ derived,\n\t\t// it's possible that the effect was already destroyed. In this case,\n\t\t// we don't add the dependency, because that would create a memory leak\n\t\tvar destroyed = active_effect !== null && (active_effect.f & DESTROYED) !== 0;\n\n\t\tif (!destroyed && (current_sources === null || !includes.call(current_sources, signal))) {\n\t\t\tvar deps = active_reaction.deps;\n\n\t\t\tif ((active_reaction.f & REACTION_IS_UPDATING) !== 0) {\n\t\t\t\t// we're in the effect init/update cycle\n\t\t\t\tif (signal.rv < read_version) {\n\t\t\t\t\tsignal.rv = read_version;\n\n\t\t\t\t\t// If the signal is accessing the same dependencies in the same\n\t\t\t\t\t// order as it did last time, increment `skipped_deps`\n\t\t\t\t\t// rather than updating `new_deps`, which creates GC cost\n\t\t\t\t\tif (new_deps === null && deps !== null && deps[skipped_deps] === signal) {\n\t\t\t\t\t\tskipped_deps++;\n\t\t\t\t\t} else if (new_deps === null) {\n\t\t\t\t\t\tnew_deps = [signal];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnew_deps.push(signal);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// we're adding a dependency outside the init/update cycle\n\t\t\t\t// (i.e. after an `await`)\n\t\t\t\t(active_reaction.deps ??= []).push(signal);\n\n\t\t\t\tvar reactions = signal.reactions;\n\n\t\t\t\tif (reactions === null) {\n\t\t\t\t\tsignal.reactions = [active_reaction];\n\t\t\t\t} else if (!includes.call(reactions, active_reaction)) {\n\t\t\t\t\treactions.push(active_reaction);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (DEV) {\n\t\tif (\n\t\t\t!untracking &&\n\t\t\treactivity_loss_tracker &&\n\t\t\t!reactivity_loss_tracker.warned &&\n\t\t\t(reactivity_loss_tracker.effect.f & REACTION_IS_UPDATING) === 0\n\t\t) {\n\t\t\treactivity_loss_tracker.warned = true;\n\n\t\t\tw.await_reactivity_loss(/** @type {string} */ (signal.label));\n\n\t\t\tvar trace = get_error('traced at');\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tif (trace) console.warn(trace);\n\t\t}\n\n\t\trecent_async_deriveds.delete(signal);\n\n\t\tif (\n\t\t\ttracing_mode_flag &&\n\t\t\t!untracking &&\n\t\t\ttracing_expressions !== null &&\n\t\t\tactive_reaction !== null &&\n\t\t\ttracing_expressions.reaction === active_reaction\n\t\t) {\n\t\t\t// Used when mapping state between special blocks like `each`\n\t\t\tif (signal.trace) {\n\t\t\t\tsignal.trace();\n\t\t\t} else {\n\t\t\t\ttrace = get_error('traced at');\n\n\t\t\t\tif (trace) {\n\t\t\t\t\tvar entry = tracing_expressions.entries.get(signal);\n\n\t\t\t\t\tif (entry === undefined) {\n\t\t\t\t\t\tentry = { traces: [] };\n\t\t\t\t\t\ttracing_expressions.entries.set(signal, entry);\n\t\t\t\t\t}\n\n\t\t\t\t\tvar last = entry.traces[entry.traces.length - 1];\n\n\t\t\t\t\t// traces can be duplicated, e.g. by `snapshot` invoking both\n\t\t\t\t\t// both `getOwnPropertyDescriptor` and `get` traps at once\n\t\t\t\t\tif (trace.stack !== last?.stack) {\n\t\t\t\t\t\tentry.traces.push(trace);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (is_destroying_effect && old_values.has(signal)) {\n\t\treturn old_values.get(signal);\n\t}\n\n\tif (is_derived) {\n\t\tvar derived = /** @type {Derived} */ (signal);\n\n\t\tif (is_destroying_effect) {\n\t\t\tvar value = derived.v;\n\n\t\t\t// if the derived is dirty and has reactions, or depends on the values that just changed, re-execute\n\t\t\t// (a derived can be maybe_dirty due to the effect destroy removing its last reaction)\n\t\t\tif (\n\t\t\t\t((derived.f & CLEAN) === 0 && derived.reactions !== null) ||\n\t\t\t\tdepends_on_old_values(derived)\n\t\t\t) {\n\t\t\t\tvalue = execute_derived(derived);\n\t\t\t}\n\n\t\t\told_values.set(derived, value);\n\n\t\t\treturn value;\n\t\t}\n\n\t\t// connect disconnected deriveds if we are reading them inside an effect,\n\t\t// or inside another derived that is already connected\n\t\tvar should_connect =\n\t\t\t(derived.f & CONNECTED) === 0 &&\n\t\t\t!untracking &&\n\t\t\tactive_reaction !== null &&\n\t\t\t(is_updating_effect || (active_reaction.f & CONNECTED) !== 0);\n\n\t\tvar is_new = (derived.f & REACTION_RAN) === 0;\n\n\t\tif (is_dirty(derived)) {\n\t\t\tif (should_connect) {\n\t\t\t\t// set the flag before `update_derived`, so that the derived\n\t\t\t\t// is added as a reaction to its dependencies\n\t\t\t\tderived.f |= CONNECTED;\n\t\t\t}\n\n\t\t\tupdate_derived(derived);\n\t\t}\n\n\t\tif (should_connect && !is_new) {\n\t\t\tunfreeze_derived_effects(derived);\n\t\t\treconnect(derived);\n\t\t}\n\t}\n\n\tif (batch_values?.has(signal)) {\n\t\treturn batch_values.get(signal);\n\t}\n\n\tif ((signal.f & ERROR_VALUE) !== 0) {\n\t\tthrow signal.v;\n\t}\n\n\treturn signal.v;\n}\n\n/**\n * (Re)connect a disconnected derived, so that it is notified\n * of changes in `mark_reactions`\n * @param {Derived} derived\n */\nfunction reconnect(derived) {\n\tderived.f |= CONNECTED;\n\n\tif (derived.deps === null) return;\n\n\tfor (const dep of derived.deps) {\n\t\t(dep.reactions ??= []).push(derived);\n\n\t\tif ((dep.f & DERIVED) !== 0 && (dep.f & CONNECTED) === 0) {\n\t\t\tunfreeze_derived_effects(/** @type {Derived} */ (dep));\n\t\t\treconnect(/** @type {Derived} */ (dep));\n\t\t}\n\t}\n}\n\n/** @param {Derived} derived */\nfunction depends_on_old_values(derived) {\n\tif (derived.v === UNINITIALIZED) return true; // we don't know, so assume the worst\n\tif (derived.deps === null) return false;\n\n\tfor (const dep of derived.deps) {\n\t\tif (old_values.has(dep)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ((dep.f & DERIVED) !== 0 && depends_on_old_values(/** @type {Derived} */ (dep))) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Like `get`, but checks for `undefined`. Used for `var` declarations because they can be accessed before being declared\n * @template V\n * @param {Value<V> | undefined} signal\n * @returns {V | undefined}\n */\nexport function safe_get(signal) {\n\treturn signal && get(signal);\n}\n\n/**\n * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),\n * any state read inside `fn` will not be treated as a dependency.\n *\n * ```ts\n * $effect(() => {\n * // this will run when `data` changes, but not when `time` changes\n * save(data, {\n * timestamp: untrack(() => time)\n * });\n * });\n * ```\n * @template T\n * @param {() => T} fn\n * @returns {T}\n */\nexport function untrack(fn) {\n\tvar previous_untracking = untracking;\n\ttry {\n\t\tuntracking = true;\n\t\treturn fn();\n\t} finally {\n\t\tuntracking = previous_untracking;\n\t}\n}\n\n/**\n * Possibly traverse an object and read all its properties so that they're all reactive in case this is `$state`.\n * Does only check first level of an object for performance reasons (heuristic should be good for 99% of all cases).\n * @param {any} value\n * @returns {void}\n */\nexport function deep_read_state(value) {\n\tif (typeof value !== 'object' || !value || value instanceof EventTarget) {\n\t\treturn;\n\t}\n\n\tif (STATE_SYMBOL in value) {\n\t\tdeep_read(value);\n\t} else if (!Array.isArray(value)) {\n\t\tfor (let key in value) {\n\t\t\tconst prop = value[key];\n\t\t\tif (typeof prop === 'object' && prop && STATE_SYMBOL in prop) {\n\t\t\t\tdeep_read(prop);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Deeply traverse an object and read all its properties\n * so that they're all reactive in case this is `$state`\n * @param {any} value\n * @param {Set<any>} visited\n * @returns {void}\n */\nexport function deep_read(value, visited = new Set()) {\n\tif (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t// We don't want to traverse DOM elements\n\t\t!(value instanceof EventTarget) &&\n\t\t!visited.has(value)\n\t) {\n\t\tvisited.add(value);\n\t\t// When working with a possible SvelteDate, this\n\t\t// will ensure we capture changes to it.\n\t\tif (value instanceof Date) {\n\t\t\tvalue.getTime();\n\t\t}\n\t\tfor (let key in value) {\n\t\t\ttry {\n\t\t\t\tdeep_read(value[key], visited);\n\t\t\t} catch (e) {\n\t\t\t\t// continue\n\t\t\t}\n\t\t}\n\t\tconst proto = get_prototype_of(value);\n\t\tif (\n\t\t\tproto !== Object.prototype &&\n\t\t\tproto !== Array.prototype &&\n\t\t\tproto !== Map.prototype &&\n\t\t\tproto !== Set.prototype &&\n\t\t\tproto !== Date.prototype\n\t\t) {\n\t\t\tconst descriptors = get_descriptors(proto);\n\t\t\tfor (let key in descriptors) {\n\t\t\t\tconst get = descriptors[key].get;\n\t\t\t\tif (get) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tget.call(value);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t// continue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { teardown } from '../../reactivity/effects.js';\nimport { define_property } from '../../../shared/utils.js';\nimport { hydrating } from '../hydration.js';\nimport { queue_micro_task } from '../task.js';\nimport { FILENAME } from '../../../../constants.js';\nimport * as w from '../../warnings.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport { without_reactive_context } from './bindings/shared.js';\n\n/**\n * Used on elements, as a map of event type -> event handler,\n * and on events themselves to track which element handled an event\n */\nexport const event_symbol = Symbol('events');\n\n/** @type {Set<string>} */\nexport const all_registered_events = new Set();\n\n/** @type {Set<(events: Array<string>) => void>} */\nexport const root_event_handles = new Set();\n\n/**\n * SSR adds onload and onerror attributes to catch those events before the hydration.\n * This function detects those cases, removes the attributes and replays the events.\n * @param {HTMLElement} dom\n */\nexport function replay_events(dom) {\n\tif (!hydrating) return;\n\n\tdom.removeAttribute('onload');\n\tdom.removeAttribute('onerror');\n\t// @ts-expect-error\n\tconst event = dom.__e;\n\tif (event !== undefined) {\n\t\t// @ts-expect-error\n\t\tdom.__e = undefined;\n\t\tqueueMicrotask(() => {\n\t\t\tif (dom.isConnected) {\n\t\t\t\tdom.dispatchEvent(event);\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @param {string} event_name\n * @param {EventTarget} dom\n * @param {EventListener} [handler]\n * @param {AddEventListenerOptions} [options]\n */\nexport function create_event(event_name, dom, handler, options = {}) {\n\t/**\n\t * @this {EventTarget}\n\t */\n\tfunction target_handler(/** @type {Event} */ event) {\n\t\tif (!options.capture) {\n\t\t\t// Only call in the bubble phase, else delegated events would be called before the capturing events\n\t\t\thandle_event_propagation.call(dom, event);\n\t\t}\n\t\tif (!event.cancelBubble) {\n\t\t\treturn without_reactive_context(() => {\n\t\t\t\treturn handler?.call(this, event);\n\t\t\t});\n\t\t}\n\t}\n\n\t// Chrome has a bug where pointer events don't work when attached to a DOM element that has been cloned\n\t// with cloneNode() and the DOM element is disconnected from the document. To ensure the event works, we\n\t// defer the attachment till after it's been appended to the document. TODO: remove this once Chrome fixes\n\t// this bug. The same applies to wheel events and touch events.\n\tif (\n\t\tevent_name.startsWith('pointer') ||\n\t\tevent_name.startsWith('touch') ||\n\t\tevent_name === 'wheel'\n\t) {\n\t\tqueue_micro_task(() => {\n\t\t\tdom.addEventListener(event_name, target_handler, options);\n\t\t});\n\t} else {\n\t\tdom.addEventListener(event_name, target_handler, options);\n\t}\n\n\treturn target_handler;\n}\n\n/**\n * Attaches an event handler to an element and returns a function that removes the handler. Using this\n * rather than `addEventListener` will preserve the correct order relative to handlers added declaratively\n * (with attributes like `onclick`), which use event delegation for performance reasons\n *\n * @param {EventTarget} element\n * @param {string} type\n * @param {EventListener} handler\n * @param {AddEventListenerOptions} [options]\n */\nexport function on(element, type, handler, options = {}) {\n\tvar target_handler = create_event(type, element, handler, options);\n\n\treturn () => {\n\t\telement.removeEventListener(type, target_handler, options);\n\t};\n}\n\n/**\n * @param {string} event_name\n * @param {Element} dom\n * @param {EventListener} [handler]\n * @param {boolean} [capture]\n * @param {boolean} [passive]\n * @returns {void}\n */\nexport function event(event_name, dom, handler, capture, passive) {\n\tvar options = { capture, passive };\n\tvar target_handler = create_event(event_name, dom, handler, options);\n\n\tif (\n\t\tdom === document.body ||\n\t\t// @ts-ignore\n\t\tdom === window ||\n\t\t// @ts-ignore\n\t\tdom === document ||\n\t\t// Firefox has quirky behavior, it can happen that we still get \"canplay\" events when the element is already removed\n\t\tdom instanceof HTMLMediaElement\n\t) {\n\t\tteardown(() => {\n\t\t\tdom.removeEventListener(event_name, target_handler, options);\n\t\t});\n\t}\n}\n\n/**\n * @param {string} event_name\n * @param {Element} element\n * @param {EventListener} [handler]\n * @returns {void}\n */\nexport function delegated(event_name, element, handler) {\n\t// @ts-expect-error\n\t(element[event_symbol] ??= {})[event_name] = handler;\n}\n\n/**\n * @param {Array<string>} events\n * @returns {void}\n */\nexport function delegate(events) {\n\tfor (var i = 0; i < events.length; i++) {\n\t\tall_registered_events.add(events[i]);\n\t}\n\n\tfor (var fn of root_event_handles) {\n\t\tfn(events);\n\t}\n}\n\n// used to store the reference to the currently propagated event\n// to prevent garbage collection between microtasks in Firefox\n// If the event object is GCed too early, the expando __root property\n// set on the event object is lost, causing the event delegation\n// to process the event twice\nlet last_propagated_event = null;\n\n/**\n * @this {EventTarget}\n * @param {Event} event\n * @returns {void}\n */\nexport function handle_event_propagation(event) {\n\tvar handler_element = this;\n\tvar owner_document = /** @type {Node} */ (handler_element).ownerDocument;\n\tvar event_name = event.type;\n\tvar path = event.composedPath?.() || [];\n\tvar current_target = /** @type {null | Element} */ (path[0] || event.target);\n\n\tlast_propagated_event = event;\n\n\t// composedPath contains list of nodes the event has propagated through.\n\t// We check `event_symbol` to skip all nodes below it in case this is a\n\t// parent of the `event_symbol` node, which indicates that there's nested\n\t// mounted apps. In this case we don't want to trigger events multiple times.\n\tvar path_idx = 0;\n\n\t// the `last_propagated_event === event` check is redundant, but\n\t// without it the variable will be DCE'd and things will\n\t// fail mysteriously in Firefox\n\t// @ts-expect-error is added below\n\tvar handled_at = last_propagated_event === event && event[event_symbol];\n\n\tif (handled_at) {\n\t\tvar at_idx = path.indexOf(handled_at);\n\t\tif (\n\t\t\tat_idx !== -1 &&\n\t\t\t(handler_element === document || handler_element === /** @type {any} */ (window))\n\t\t) {\n\t\t\t// This is the fallback document listener or a window listener, but the event was already handled\n\t\t\t// -> ignore, but set handle_at to document/window so that we're resetting the event\n\t\t\t// chain in case someone manually dispatches the same event object again.\n\t\t\t// @ts-expect-error\n\t\t\tevent[event_symbol] = handler_element;\n\t\t\treturn;\n\t\t}\n\n\t\t// We're deliberately not skipping if the index is higher, because\n\t\t// someone could create an event programmatically and emit it multiple times,\n\t\t// in which case we want to handle the whole propagation chain properly each time.\n\t\t// (this will only be a false negative if the event is dispatched multiple times and\n\t\t// the fallback document listener isn't reached in between, but that's super rare)\n\t\tvar handler_idx = path.indexOf(handler_element);\n\t\tif (handler_idx === -1) {\n\t\t\t// handle_idx can theoretically be -1 (happened in some JSDOM testing scenarios with an event listener on the window object)\n\t\t\t// so guard against that, too, and assume that everything was handled at this point.\n\t\t\treturn;\n\t\t}\n\n\t\tif (at_idx <= handler_idx) {\n\t\t\tpath_idx = at_idx;\n\t\t}\n\t}\n\n\tcurrent_target = /** @type {Element} */ (path[path_idx] || event.target);\n\t// there can only be one delegated event per element, and we either already handled the current target,\n\t// or this is the very first target in the chain which has a non-delegated listener, in which case it's safe\n\t// to handle a possible delegated event on it later (through the root delegation listener for example).\n\tif (current_target === handler_element) return;\n\n\t// Proxy currentTarget to correct target\n\tdefine_property(event, 'currentTarget', {\n\t\tconfigurable: true,\n\t\tget() {\n\t\t\treturn current_target || owner_document;\n\t\t}\n\t});\n\n\t// This started because of Chromium issue https://chromestatus.com/feature/5128696823545856,\n\t// where removal or moving of of the DOM can cause sync `blur` events to fire, which can cause logic\n\t// to run inside the current `active_reaction`, which isn't what we want at all. However, on reflection,\n\t// it's probably best that all event handled by Svelte have this behaviour, as we don't really want\n\t// an event handler to run in the context of another reaction or effect.\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\n\ttry {\n\t\t/**\n\t\t * @type {unknown}\n\t\t */\n\t\tvar throw_error;\n\t\t/**\n\t\t * @type {unknown[]}\n\t\t */\n\t\tvar other_errors = [];\n\n\t\twhile (current_target !== null) {\n\t\t\t/** @type {null | Element} */\n\t\t\tvar parent_element =\n\t\t\t\tcurrent_target.assignedSlot ||\n\t\t\t\tcurrent_target.parentNode ||\n\t\t\t\t/** @type {any} */ (current_target).host ||\n\t\t\t\tnull;\n\n\t\t\ttry {\n\t\t\t\t// @ts-expect-error\n\t\t\t\tvar delegated = current_target[event_symbol]?.[event_name];\n\n\t\t\t\tif (\n\t\t\t\t\tdelegated != null &&\n\t\t\t\t\t(!(/** @type {any} */ (current_target).disabled) ||\n\t\t\t\t\t\t// DOM could've been updated already by the time this is reached, so we check this as well\n\t\t\t\t\t\t// -> the target could not have been disabled because it emits the event in the first place\n\t\t\t\t\t\tevent.target === current_target)\n\t\t\t\t) {\n\t\t\t\t\tdelegated.call(current_target, event);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (throw_error) {\n\t\t\t\t\tother_errors.push(error);\n\t\t\t\t} else {\n\t\t\t\t\tthrow_error = error;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (event.cancelBubble || parent_element === handler_element || parent_element === null) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcurrent_target = parent_element;\n\t\t}\n\n\t\tif (throw_error) {\n\t\t\tfor (let error of other_errors) {\n\t\t\t\t// Throw the rest of the errors, one-by-one on a microtask\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t\t}\n\t\t\tthrow throw_error;\n\t\t}\n\t} finally {\n\t\t// @ts-expect-error is used above\n\t\tevent[event_symbol] = handler_element;\n\t\t// @ts-ignore remove proxy on currentTarget\n\t\tdelete event.currentTarget;\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t}\n}\n\n/**\n * In dev, warn if an event handler is not a function, as it means the\n * user probably called the handler or forgot to add a `() =>`\n * @param {() => (event: Event, ...args: any) => void} thunk\n * @param {EventTarget} element\n * @param {[Event, ...any]} args\n * @param {any} component\n * @param {[number, number]} [loc]\n * @param {boolean} [remove_parens]\n */\nexport function apply(\n\tthunk,\n\telement,\n\targs,\n\tcomponent,\n\tloc,\n\thas_side_effects = false,\n\tremove_parens = false\n) {\n\tlet handler;\n\tlet error;\n\n\ttry {\n\t\thandler = thunk();\n\t} catch (e) {\n\t\terror = e;\n\t}\n\n\tif (typeof handler !== 'function' && (has_side_effects || handler != null || error)) {\n\t\tconst filename = component?.[FILENAME];\n\t\tconst location = loc ? ` at ${filename}:${loc[0]}:${loc[1]}` : ` in ${filename}`;\n\t\tconst phase = args[0]?.eventPhase < Event.BUBBLING_PHASE ? 'capture' : '';\n\t\tconst event_name = args[0]?.type + phase;\n\t\tconst description = `\\`${event_name}\\` handler${location}`;\n\t\tconst suggestion = remove_parens ? 'remove the trailing `()`' : 'add a leading `() =>`';\n\n\t\tw.event_handler_invalid(description, suggestion);\n\n\t\tif (error) {\n\t\t\tthrow error;\n\t\t}\n\t}\n\thandler?.apply(element, args);\n}\n","import { create_element } from './operations.js';\n\nconst policy =\n\t// We gotta write it like this because after downleveling the pure comment may end up in the wrong location\n\tglobalThis?.window?.trustedTypes &&\n\t/* @__PURE__ */ globalThis.window.trustedTypes.createPolicy('svelte-trusted-html', {\n\t\t/** @param {string} html */\n\t\tcreateHTML: (html) => {\n\t\t\treturn html;\n\t\t}\n\t});\n\n/** @param {string} html */\nexport function create_trusted_html(html) {\n\treturn /** @type {string} */ (policy?.createHTML(html) ?? html);\n}\n\n/**\n * @param {string} html\n */\nexport function create_fragment_from_html(html) {\n\tvar elem = create_element('template');\n\telem.innerHTML = create_trusted_html(html.replaceAll('<!>', '<!---->')); // XHTML compliance\n\treturn elem.content;\n}\n","/** @import { Effect, EffectNodes, TemplateNode } from '#client' */\n/** @import { TemplateStructure } from './types' */\nimport { hydrate_next, hydrate_node, hydrating, set_hydrate_node } from './hydration.js';\nimport {\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tis_firefox,\n\tcreate_element,\n\tcreate_fragment,\n\tcreate_comment,\n\tset_attribute,\n\tmerge_text_nodes\n} from './operations.js';\nimport { create_fragment_from_html } from './reconciler.js';\nimport { active_effect } from '../runtime.js';\nimport {\n\tNAMESPACE_MATHML,\n\tNAMESPACE_SVG,\n\tTEMPLATE_FRAGMENT,\n\tTEMPLATE_USE_IMPORT_NODE,\n\tTEMPLATE_USE_MATHML,\n\tTEMPLATE_USE_SVG\n} from '../../../constants.js';\nimport {\n\tCOMMENT_NODE,\n\tDOCUMENT_FRAGMENT_NODE,\n\tIS_XHTML,\n\tREACTION_RAN,\n\tTEXT_NODE\n} from '#client/constants';\n\nconst TEMPLATE_TAG = IS_XHTML ? 'template' : 'TEMPLATE';\nconst SCRIPT_TAG = IS_XHTML ? 'script' : 'SCRIPT';\n\n/**\n * @param {TemplateNode} start\n * @param {TemplateNode | null} end\n */\nexport function assign_nodes(start, end) {\n\tvar effect = /** @type {Effect} */ (active_effect);\n\tif (effect.nodes === null) {\n\t\teffect.nodes = { start, end, a: null, t: null };\n\t}\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_html(content, flags) {\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;\n\n\t/** @type {Node} */\n\tvar node;\n\n\t/**\n\t * Whether or not the first item is a text/element node. If not, we need to\n\t * create an additional comment node to act as `effect.nodes.start`\n\t */\n\tvar has_start = !content.startsWith('<!>');\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (node === undefined) {\n\t\t\tnode = create_fragment_from_html(has_start ? content : '<!>' + content);\n\t\t\tif (!is_fragment) node = /** @type {TemplateNode} */ (get_first_child(node));\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (\n\t\t\tuse_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true)\n\t\t);\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (clone.lastChild);\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n * @param {'svg' | 'math'} ns\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nfunction from_namespace(content, flags, ns = 'svg') {\n\t/**\n\t * Whether or not the first item is a text/element node. If not, we need to\n\t * create an additional comment node to act as `effect.nodes.start`\n\t */\n\tvar has_start = !content.startsWith('<!>');\n\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar wrapped = `<${ns}>${has_start ? content : '<!>' + content}</${ns}>`;\n\n\t/** @type {Element | DocumentFragment} */\n\tvar node;\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (!node) {\n\t\t\tvar fragment = /** @type {DocumentFragment} */ (create_fragment_from_html(wrapped));\n\t\t\tvar root = /** @type {Element} */ (get_first_child(fragment));\n\n\t\t\tif (is_fragment) {\n\t\t\t\tnode = document.createDocumentFragment();\n\t\t\t\twhile (get_first_child(root)) {\n\t\t\t\t\tnode.appendChild(/** @type {TemplateNode} */ (get_first_child(root)));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnode = /** @type {Element} */ (get_first_child(root));\n\t\t\t}\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (node.cloneNode(true));\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (clone.lastChild);\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_svg(content, flags) {\n\treturn from_namespace(content, flags, 'svg');\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_mathml(content, flags) {\n\treturn from_namespace(content, flags, 'math');\n}\n\n/**\n * @param {TemplateStructure[]} structure\n * @param {typeof NAMESPACE_SVG | typeof NAMESPACE_MATHML | undefined} [ns]\n */\nfunction fragment_from_tree(structure, ns) {\n\tvar fragment = create_fragment();\n\n\tfor (var item of structure) {\n\t\tif (typeof item === 'string') {\n\t\t\tfragment.append(create_text(item));\n\t\t\tcontinue;\n\t\t}\n\n\t\t// if `preserveComments === true`, comments are represented as `['// <data>']`\n\t\tif (item === undefined || item[0][0] === '/') {\n\t\t\tfragment.append(create_comment(item ? item[0].slice(3) : ''));\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst [name, attributes, ...children] = item;\n\n\t\tconst namespace = name === 'svg' ? NAMESPACE_SVG : name === 'math' ? NAMESPACE_MATHML : ns;\n\n\t\tvar element = create_element(name, namespace, attributes?.is);\n\n\t\tfor (var key in attributes) {\n\t\t\tset_attribute(element, key, attributes[key]);\n\t\t}\n\n\t\tif (children.length > 0) {\n\t\t\tvar target =\n\t\t\t\telement.nodeName === TEMPLATE_TAG\n\t\t\t\t\t? /** @type {HTMLTemplateElement} */ (element).content\n\t\t\t\t\t: element;\n\n\t\t\ttarget.append(\n\t\t\t\tfragment_from_tree(children, element.nodeName === 'foreignObject' ? undefined : namespace)\n\t\t\t);\n\t\t}\n\n\t\tfragment.append(element);\n\t}\n\n\treturn fragment;\n}\n\n/**\n * @param {TemplateStructure[]} structure\n * @param {number} flags\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_tree(structure, flags) {\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;\n\n\t/** @type {Node} */\n\tvar node;\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (node === undefined) {\n\t\t\tconst ns =\n\t\t\t\t(flags & TEMPLATE_USE_SVG) !== 0\n\t\t\t\t\t? NAMESPACE_SVG\n\t\t\t\t\t: (flags & TEMPLATE_USE_MATHML) !== 0\n\t\t\t\t\t\t? NAMESPACE_MATHML\n\t\t\t\t\t\t: undefined;\n\n\t\t\tnode = fragment_from_tree(structure, ns);\n\t\t\tif (!is_fragment) node = /** @type {TemplateNode} */ (get_first_child(node));\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (\n\t\t\tuse_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true)\n\t\t);\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (clone.lastChild);\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {() => Element | DocumentFragment} fn\n */\nexport function with_script(fn) {\n\treturn () => run_scripts(fn());\n}\n\n/**\n * Creating a document fragment from HTML that contains script tags will not execute\n * the scripts. We need to replace the script tags with new ones so that they are executed.\n * @param {Element | DocumentFragment} node\n * @returns {Node | Node[]}\n */\nfunction run_scripts(node) {\n\t// scripts were SSR'd, in which case they will run\n\tif (hydrating) return node;\n\n\tconst is_fragment = node.nodeType === DOCUMENT_FRAGMENT_NODE;\n\tconst scripts =\n\t\t/** @type {HTMLElement} */ (node).nodeName === SCRIPT_TAG\n\t\t\t? [/** @type {HTMLScriptElement} */ (node)]\n\t\t\t: node.querySelectorAll('script');\n\n\tconst effect = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);\n\n\tfor (const script of scripts) {\n\t\tconst clone = create_element('script');\n\t\tfor (var attribute of script.attributes) {\n\t\t\tclone.setAttribute(attribute.name, attribute.value);\n\t\t}\n\n\t\tclone.textContent = script.textContent;\n\n\t\t// The script has changed - if it's at the edges, the effect now points at dead nodes\n\t\tif (is_fragment ? node.firstChild === script : node === script) {\n\t\t\teffect.nodes.start = clone;\n\t\t}\n\t\tif (is_fragment ? node.lastChild === script : node === script) {\n\t\t\teffect.nodes.end = clone;\n\t\t}\n\n\t\tscript.replaceWith(clone);\n\t}\n\treturn node;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {any} value\n */\nexport function text(value = '') {\n\tif (!hydrating) {\n\t\tvar t = create_text(value + '');\n\t\tassign_nodes(t, t);\n\t\treturn t;\n\t}\n\n\tvar node = hydrate_node;\n\n\tif (node.nodeType !== TEXT_NODE) {\n\t\t// if an {expression} is empty during SSR, we need to insert an empty text node\n\t\tnode.before((node = create_text()));\n\t\tset_hydrate_node(node);\n\t} else {\n\t\tmerge_text_nodes(/** @type {Text} */ (node));\n\t}\n\n\tassign_nodes(node, node);\n\treturn node;\n}\n\n/**\n * @returns {TemplateNode | DocumentFragment}\n */\nexport function comment() {\n\t// we're not delegating to `template` here for performance reasons\n\tif (hydrating) {\n\t\tassign_nodes(hydrate_node, null);\n\t\treturn hydrate_node;\n\t}\n\n\tvar frag = document.createDocumentFragment();\n\tvar start = document.createComment('');\n\tvar anchor = create_text();\n\tfrag.append(start, anchor);\n\n\tassign_nodes(start, anchor);\n\n\treturn frag;\n}\n\n/**\n * Assign the created (or in hydration mode, traversed) dom elements to the current block\n * and insert the elements into the dom (in client mode).\n * @param {Text | Comment | Element} anchor\n * @param {DocumentFragment | Element} dom\n */\nexport function append(anchor, dom) {\n\tif (hydrating) {\n\t\tvar effect = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);\n\n\t\t// When hydrating and outer component and an inner component is async, i.e. blocked on a promise,\n\t\t// then by the time the inner resolves we have already advanced to the end of the hydrated nodes\n\t\t// of the parent component. Check for defined for that reason to avoid rewinding the parent's end marker.\n\t\tif ((effect.f & REACTION_RAN) === 0 || effect.nodes.end === null) {\n\t\t\teffect.nodes.end = hydrate_node;\n\t\t}\n\n\t\thydrate_next();\n\t\treturn;\n\t}\n\n\tif (anchor === null) {\n\t\t// edge case — void `<svelte:element>` with content\n\t\treturn;\n\t}\n\n\tanchor.before(/** @type {Node} */ (dom));\n}\n\n/**\n * Create (or hydrate) an unique UID for the component instance.\n */\nexport function props_id() {\n\tif (\n\t\thydrating &&\n\t\thydrate_node &&\n\t\thydrate_node.nodeType === COMMENT_NODE &&\n\t\thydrate_node.textContent?.startsWith(`$`)\n\t) {\n\t\tconst id = hydrate_node.textContent.substring(1);\n\t\thydrate_next();\n\t\treturn id;\n\t}\n\n\t// @ts-expect-error This way we ensure the id is unique even across Svelte runtimes\n\t(window.__svelte ??= {}).uid ??= 1;\n\n\t// @ts-expect-error\n\treturn `c${window.__svelte.uid++}`;\n}\n","const regex_return_characters = /\\r/g;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nexport function hash(str) {\n\tstr = str.replace(regex_return_characters, '');\n\tlet hash = 5381;\n\tlet i = str.length;\n\n\twhile (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i);\n\treturn (hash >>> 0).toString(36);\n}\n\nconst VOID_ELEMENT_NAMES = [\n\t'area',\n\t'base',\n\t'br',\n\t'col',\n\t'command',\n\t'embed',\n\t'hr',\n\t'img',\n\t'input',\n\t'keygen',\n\t'link',\n\t'meta',\n\t'param',\n\t'source',\n\t'track',\n\t'wbr'\n];\n\n/**\n * Returns `true` if `name` is of a void element\n * @param {string} name\n */\nexport function is_void(name) {\n\treturn VOID_ELEMENT_NAMES.includes(name) || name.toLowerCase() === '!doctype';\n}\n\nconst RESERVED_WORDS = [\n\t'arguments',\n\t'await',\n\t'break',\n\t'case',\n\t'catch',\n\t'class',\n\t'const',\n\t'continue',\n\t'debugger',\n\t'default',\n\t'delete',\n\t'do',\n\t'else',\n\t'enum',\n\t'eval',\n\t'export',\n\t'extends',\n\t'false',\n\t'finally',\n\t'for',\n\t'function',\n\t'if',\n\t'implements',\n\t'import',\n\t'in',\n\t'instanceof',\n\t'interface',\n\t'let',\n\t'new',\n\t'null',\n\t'package',\n\t'private',\n\t'protected',\n\t'public',\n\t'return',\n\t'static',\n\t'super',\n\t'switch',\n\t'this',\n\t'throw',\n\t'true',\n\t'try',\n\t'typeof',\n\t'var',\n\t'void',\n\t'while',\n\t'with',\n\t'yield'\n];\n\n/**\n * Returns `true` if `word` is a reserved JavaScript keyword\n * @param {string} word\n */\nexport function is_reserved(word) {\n\treturn RESERVED_WORDS.includes(word);\n}\n\n/**\n * @param {string} name\n */\nexport function is_capture_event(name) {\n\treturn name.endsWith('capture') && name !== 'gotpointercapture' && name !== 'lostpointercapture';\n}\n\n/** List of Element events that will be delegated */\nconst DELEGATED_EVENTS = [\n\t'beforeinput',\n\t'click',\n\t'change',\n\t'dblclick',\n\t'contextmenu',\n\t'focusin',\n\t'focusout',\n\t'input',\n\t'keydown',\n\t'keyup',\n\t'mousedown',\n\t'mousemove',\n\t'mouseout',\n\t'mouseover',\n\t'mouseup',\n\t'pointerdown',\n\t'pointermove',\n\t'pointerout',\n\t'pointerover',\n\t'pointerup',\n\t'touchend',\n\t'touchmove',\n\t'touchstart'\n];\n\n/**\n * Returns `true` if `event_name` is a delegated event\n * @param {string} event_name\n */\nexport function can_delegate_event(event_name) {\n\treturn DELEGATED_EVENTS.includes(event_name);\n}\n\n/**\n * Attributes that are boolean, i.e. they are present or not present.\n */\nconst DOM_BOOLEAN_ATTRIBUTES = [\n\t'allowfullscreen',\n\t'async',\n\t'autofocus',\n\t'autoplay',\n\t'checked',\n\t'controls',\n\t'default',\n\t'disabled',\n\t'formnovalidate',\n\t'indeterminate',\n\t'inert',\n\t'ismap',\n\t'loop',\n\t'multiple',\n\t'muted',\n\t'nomodule',\n\t'novalidate',\n\t'open',\n\t'playsinline',\n\t'readonly',\n\t'required',\n\t'reversed',\n\t'seamless',\n\t'selected',\n\t'webkitdirectory',\n\t'defer',\n\t'disablepictureinpicture',\n\t'disableremoteplayback'\n];\n\n/**\n * Returns `true` if `name` is a boolean attribute\n * @param {string} name\n */\nexport function is_boolean_attribute(name) {\n\treturn DOM_BOOLEAN_ATTRIBUTES.includes(name);\n}\n\n/**\n * @type {Record<string, string>}\n * List of attribute names that should be aliased to their property names\n * because they behave differently between setting them as an attribute and\n * setting them as a property.\n */\nconst ATTRIBUTE_ALIASES = {\n\t// no `class: 'className'` because we handle that separately\n\tformnovalidate: 'formNoValidate',\n\tismap: 'isMap',\n\tnomodule: 'noModule',\n\tplaysinline: 'playsInline',\n\treadonly: 'readOnly',\n\tdefaultvalue: 'defaultValue',\n\tdefaultchecked: 'defaultChecked',\n\tsrcobject: 'srcObject',\n\tnovalidate: 'noValidate',\n\tallowfullscreen: 'allowFullscreen',\n\tdisablepictureinpicture: 'disablePictureInPicture',\n\tdisableremoteplayback: 'disableRemotePlayback'\n};\n\n/**\n * @param {string} name\n */\nexport function normalize_attribute(name) {\n\tname = name.toLowerCase();\n\treturn ATTRIBUTE_ALIASES[name] ?? name;\n}\n\nconst DOM_PROPERTIES = [\n\t...DOM_BOOLEAN_ATTRIBUTES,\n\t'formNoValidate',\n\t'isMap',\n\t'noModule',\n\t'playsInline',\n\t'readOnly',\n\t'value',\n\t'volume',\n\t'defaultValue',\n\t'defaultChecked',\n\t'srcObject',\n\t'noValidate',\n\t'allowFullscreen',\n\t'disablePictureInPicture',\n\t'disableRemotePlayback'\n];\n\n/**\n * @param {string} name\n */\nexport function is_dom_property(name) {\n\treturn DOM_PROPERTIES.includes(name);\n}\n\nconst NON_STATIC_PROPERTIES = ['autofocus', 'muted', 'defaultValue', 'defaultChecked'];\n\n/**\n * Returns `true` if the given attribute cannot be set through the template\n * string, i.e. needs some kind of JavaScript handling to work.\n * @param {string} name\n */\nexport function cannot_be_set_statically(name) {\n\treturn NON_STATIC_PROPERTIES.includes(name);\n}\n\n/**\n * Subset of delegated events which should be passive by default.\n * These two are already passive via browser defaults on window, document and body.\n * But since\n * - we're delegating them\n * - they happen often\n * - they apply to mobile which is generally less performant\n * we're marking them as passive by default for other elements, too.\n */\nconst PASSIVE_EVENTS = ['touchstart', 'touchmove'];\n\n/**\n * Returns `true` if `name` is a passive event\n * @param {string} name\n */\nexport function is_passive_event(name) {\n\treturn PASSIVE_EVENTS.includes(name);\n}\n\nconst CONTENT_EDITABLE_BINDINGS = ['textContent', 'innerHTML', 'innerText'];\n\n/** @param {string} name */\nexport function is_content_editable_binding(name) {\n\treturn CONTENT_EDITABLE_BINDINGS.includes(name);\n}\n\nconst LOAD_ERROR_ELEMENTS = [\n\t'body',\n\t'embed',\n\t'iframe',\n\t'img',\n\t'link',\n\t'object',\n\t'script',\n\t'style',\n\t'track'\n];\n\n/**\n * Returns `true` if the element emits `load` and `error` events\n * @param {string} name\n */\nexport function is_load_error_element(name) {\n\treturn LOAD_ERROR_ELEMENTS.includes(name);\n}\n\nconst SVG_ELEMENTS = [\n\t'altGlyph',\n\t'altGlyphDef',\n\t'altGlyphItem',\n\t'animate',\n\t'animateColor',\n\t'animateMotion',\n\t'animateTransform',\n\t'circle',\n\t'clipPath',\n\t'color-profile',\n\t'cursor',\n\t'defs',\n\t'desc',\n\t'discard',\n\t'ellipse',\n\t'feBlend',\n\t'feColorMatrix',\n\t'feComponentTransfer',\n\t'feComposite',\n\t'feConvolveMatrix',\n\t'feDiffuseLighting',\n\t'feDisplacementMap',\n\t'feDistantLight',\n\t'feDropShadow',\n\t'feFlood',\n\t'feFuncA',\n\t'feFuncB',\n\t'feFuncG',\n\t'feFuncR',\n\t'feGaussianBlur',\n\t'feImage',\n\t'feMerge',\n\t'feMergeNode',\n\t'feMorphology',\n\t'feOffset',\n\t'fePointLight',\n\t'feSpecularLighting',\n\t'feSpotLight',\n\t'feTile',\n\t'feTurbulence',\n\t'filter',\n\t'font',\n\t'font-face',\n\t'font-face-format',\n\t'font-face-name',\n\t'font-face-src',\n\t'font-face-uri',\n\t'foreignObject',\n\t'g',\n\t'glyph',\n\t'glyphRef',\n\t'hatch',\n\t'hatchpath',\n\t'hkern',\n\t'image',\n\t'line',\n\t'linearGradient',\n\t'marker',\n\t'mask',\n\t'mesh',\n\t'meshgradient',\n\t'meshpatch',\n\t'meshrow',\n\t'metadata',\n\t'missing-glyph',\n\t'mpath',\n\t'path',\n\t'pattern',\n\t'polygon',\n\t'polyline',\n\t'radialGradient',\n\t'rect',\n\t'set',\n\t'solidcolor',\n\t'stop',\n\t'svg',\n\t'switch',\n\t'symbol',\n\t'text',\n\t'textPath',\n\t'tref',\n\t'tspan',\n\t'unknown',\n\t'use',\n\t'view',\n\t'vkern'\n];\n\n/** @param {string} name */\nexport function is_svg(name) {\n\treturn SVG_ELEMENTS.includes(name);\n}\n\nconst MATHML_ELEMENTS = [\n\t'annotation',\n\t'annotation-xml',\n\t'maction',\n\t'math',\n\t'merror',\n\t'mfrac',\n\t'mi',\n\t'mmultiscripts',\n\t'mn',\n\t'mo',\n\t'mover',\n\t'mpadded',\n\t'mphantom',\n\t'mprescripts',\n\t'mroot',\n\t'mrow',\n\t'ms',\n\t'mspace',\n\t'msqrt',\n\t'mstyle',\n\t'msub',\n\t'msubsup',\n\t'msup',\n\t'mtable',\n\t'mtd',\n\t'mtext',\n\t'mtr',\n\t'munder',\n\t'munderover',\n\t'semantics'\n];\n\n/** @param {string} name */\nexport function is_mathml(name) {\n\treturn MATHML_ELEMENTS.includes(name);\n}\n\nconst STATE_CREATION_RUNES = /** @type {const} */ ([\n\t'$state',\n\t'$state.raw',\n\t'$derived',\n\t'$derived.by'\n]);\n\nconst RUNES = /** @type {const} */ ([\n\t...STATE_CREATION_RUNES,\n\t'$state.eager',\n\t'$state.snapshot',\n\t'$props',\n\t'$props.id',\n\t'$bindable',\n\t'$effect',\n\t'$effect.pre',\n\t'$effect.tracking',\n\t'$effect.root',\n\t'$effect.pending',\n\t'$inspect',\n\t'$inspect().with',\n\t'$inspect.trace',\n\t'$host'\n]);\n\n/** @typedef {typeof RUNES[number]} RuneName */\n\n/**\n * @param {string} name\n * @returns {name is RuneName}\n */\nexport function is_rune(name) {\n\treturn RUNES.includes(/** @type {RuneName} */ (name));\n}\n\n/** @typedef {typeof STATE_CREATION_RUNES[number]} StateCreationRuneName */\n\n/**\n * @param {string} name\n * @returns {name is StateCreationRuneName}\n */\nexport function is_state_creation_rune(name) {\n\treturn STATE_CREATION_RUNES.includes(/** @type {StateCreationRuneName} */ (name));\n}\n\n/** List of elements that require raw contents and should not have SSR comments put in them */\nconst RAW_TEXT_ELEMENTS = /** @type {const} */ (['textarea', 'script', 'style', 'title']);\n\n/** @param {string} name */\nexport function is_raw_text_element(name) {\n\treturn RAW_TEXT_ELEMENTS.includes(/** @type {typeof RAW_TEXT_ELEMENTS[number]} */ (name));\n}\n\n// Matches valid HTML/SVG/MathML element names and custom element names.\n// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n//\n// Standard elements: ASCII alpha start, followed by ASCII alphanumerics.\n// Custom elements: ASCII alpha start, followed by any mix of PCENChar (which\n// includes ASCII alphanumerics, `-`, `.`, `_`, and specified Unicode ranges),\n// with at least one hyphen required somewhere after the first character.\n//\n// Rejects strings containing whitespace, quotes, angle brackets, slashes, equals,\n// or other characters that could break out of a tag-name token and enable markup injection.\nexport const REGEX_VALID_TAG_NAME =\n\t/^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\\-_\\u00B7\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F-\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{EFFFF}]+)*$/u;\n\n/**\n * Prevent devtools trying to make `location` a clickable link by inserting a zero-width space\n * @template {string | undefined} T\n * @param {T} location\n * @returns {T};\n */\nexport function sanitize_location(location) {\n\treturn /** @type {T} */ (location?.replace(/\\//g, '/\\u200b'));\n}\n","/** @import { ComponentContext, Effect, EffectNodes, TemplateNode } from '#client' */\n/** @import { Component, ComponentType, SvelteComponent, MountOptions } from '../../index.js' */\nimport { DEV } from 'esm-env';\nimport {\n\tclear_text_content,\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tinit_operations\n} from './dom/operations.js';\nimport { HYDRATION_END, HYDRATION_ERROR, HYDRATION_START } from '../../constants.js';\nimport { active_effect } from './runtime.js';\nimport { push, pop, component_context } from './context.js';\nimport { component_root } from './reactivity/effects.js';\nimport { hydrate_node, hydrating, set_hydrate_node, set_hydrating } from './dom/hydration.js';\nimport { array_from } from '../shared/utils.js';\nimport {\n\tall_registered_events,\n\thandle_event_propagation,\n\troot_event_handles\n} from './dom/elements/events.js';\nimport * as w from './warnings.js';\nimport * as e from './errors.js';\nimport { assign_nodes } from './dom/template.js';\nimport { is_passive_event } from '../../utils.js';\nimport { COMMENT_NODE, STATE_SYMBOL } from './constants.js';\nimport { boundary } from './dom/blocks/boundary.js';\n\n/**\n * This is normally true — block effects should run their intro transitions —\n * but is false during hydration (unless `options.intro` is `true`) and\n * when creating the children of a `<svelte:element>` that just changed tag\n */\nexport let should_intro = true;\n\n/** @param {boolean} value */\nexport function set_should_intro(value) {\n\tshould_intro = value;\n}\n\n/**\n * @param {Element} text\n * @param {string} value\n * @returns {void}\n */\nexport function set_text(text, value) {\n\t// For objects, we apply string coercion (which might make things like $state array references in the template reactive) before diffing\n\tvar str = value == null ? '' : typeof value === 'object' ? `${value}` : value;\n\t// @ts-expect-error\n\tif (str !== (text.__t ??= text.nodeValue)) {\n\t\t// @ts-expect-error\n\t\ttext.__t = str;\n\t\ttext.nodeValue = `${str}`;\n\t}\n}\n\n/**\n * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component.\n * Transitions will play during the initial render unless the `intro` option is set to `false`.\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component\n * @param {MountOptions<Props>} options\n * @returns {Exports}\n */\nexport function mount(component, options) {\n\treturn _mount(component, options);\n}\n\n/**\n * Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component\n * @param {{} extends Props ? {\n * \t\ttarget: Document | Element | ShadowRoot;\n * \t\tprops?: Props;\n * \t\tevents?: Record<string, (e: any) => any>;\n * \tcontext?: Map<any, any>;\n * \t\tintro?: boolean;\n * \t\trecover?: boolean;\n *\t\ttransformError?: (error: unknown) => unknown;\n * \t} : {\n * \t\ttarget: Document | Element | ShadowRoot;\n * \t\tprops: Props;\n * \t\tevents?: Record<string, (e: any) => any>;\n * \tcontext?: Map<any, any>;\n * \t\tintro?: boolean;\n * \t\trecover?: boolean;\n *\t\ttransformError?: (error: unknown) => unknown;\n * \t}} options\n * @returns {Exports}\n */\nexport function hydrate(component, options) {\n\tinit_operations();\n\toptions.intro = options.intro ?? false;\n\tconst target = options.target;\n\tconst was_hydrating = hydrating;\n\tconst previous_hydrate_node = hydrate_node;\n\n\ttry {\n\t\tvar anchor = get_first_child(target);\n\n\t\twhile (\n\t\t\tanchor &&\n\t\t\t(anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */ (anchor).data !== HYDRATION_START)\n\t\t) {\n\t\t\tanchor = get_next_sibling(anchor);\n\t\t}\n\n\t\tif (!anchor) {\n\t\t\tthrow HYDRATION_ERROR;\n\t\t}\n\n\t\tset_hydrating(true);\n\t\tset_hydrate_node(/** @type {Comment} */ (anchor));\n\n\t\tconst instance = _mount(component, { ...options, anchor });\n\n\t\tset_hydrating(false);\n\n\t\treturn /** @type {Exports} */ (instance);\n\t} catch (error) {\n\t\t// re-throw Svelte errors - they are certainly not related to hydration\n\t\tif (\n\t\t\terror instanceof Error &&\n\t\t\terror.message.split('\\n').some((line) => line.startsWith('https://svelte.dev/e/'))\n\t\t) {\n\t\t\tthrow error;\n\t\t}\n\t\tif (error !== HYDRATION_ERROR) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn('Failed to hydrate: ', error);\n\t\t}\n\n\t\tif (options.recover === false) {\n\t\t\te.hydration_failed();\n\t\t}\n\n\t\t// If an error occurred above, the operations might not yet have been initialised.\n\t\tinit_operations();\n\t\tclear_text_content(target);\n\n\t\tset_hydrating(false);\n\t\treturn mount(component, options);\n\t} finally {\n\t\tset_hydrating(was_hydrating);\n\t\tset_hydrate_node(previous_hydrate_node);\n\t}\n}\n\n/** @type {Map<EventTarget, Map<string, number>>} */\nconst listeners = new Map();\n\n/**\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<any>> | Component<any>} Component\n * @param {MountOptions} options\n * @returns {Exports}\n */\nfunction _mount(\n\tComponent,\n\t{ target, anchor, props = {}, events, context, intro = true, transformError }\n) {\n\tinit_operations();\n\n\t/** @type {Exports} */\n\t// @ts-expect-error will be defined because the render effect runs synchronously\n\tvar component = undefined;\n\n\tvar unmount = component_root(() => {\n\t\tvar anchor_node = anchor ?? target.appendChild(create_text());\n\n\t\tboundary(\n\t\t\t/** @type {TemplateNode} */ (anchor_node),\n\t\t\t{\n\t\t\t\tpending: () => {}\n\t\t\t},\n\t\t\t(anchor_node) => {\n\t\t\t\tpush({});\n\t\t\t\tvar ctx = /** @type {ComponentContext} */ (component_context);\n\t\t\t\tif (context) ctx.c = context;\n\n\t\t\t\tif (events) {\n\t\t\t\t\t// We can't spread the object or else we'd lose the state proxy stuff, if it is one\n\t\t\t\t\t/** @type {any} */ (props).$$events = events;\n\t\t\t\t}\n\n\t\t\t\tif (hydrating) {\n\t\t\t\t\tassign_nodes(/** @type {TemplateNode} */ (anchor_node), null);\n\t\t\t\t}\n\n\t\t\t\tshould_intro = intro;\n\t\t\t\t// @ts-expect-error the public typings are not what the actual function looks like\n\t\t\t\tcomponent = Component(anchor_node, props) || {};\n\t\t\t\tshould_intro = true;\n\n\t\t\t\tif (hydrating) {\n\t\t\t\t\t/** @type {Effect & { nodes: EffectNodes }} */ (active_effect).nodes.end = hydrate_node;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\thydrate_node === null ||\n\t\t\t\t\t\thydrate_node.nodeType !== COMMENT_NODE ||\n\t\t\t\t\t\t/** @type {Comment} */ (hydrate_node).data !== HYDRATION_END\n\t\t\t\t\t) {\n\t\t\t\t\t\tw.hydration_mismatch();\n\t\t\t\t\t\tthrow HYDRATION_ERROR;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tpop();\n\t\t\t},\n\t\t\ttransformError\n\t\t);\n\n\t\t// Setup event delegation _after_ component is mounted - if an error would happen during mount, it would otherwise not be cleaned up\n\t\t/** @type {Set<string>} */\n\t\tvar registered_events = new Set();\n\n\t\t/** @param {Array<string>} events */\n\t\tvar event_handle = (events) => {\n\t\t\tfor (var i = 0; i < events.length; i++) {\n\t\t\t\tvar event_name = events[i];\n\n\t\t\t\tif (registered_events.has(event_name)) continue;\n\t\t\t\tregistered_events.add(event_name);\n\n\t\t\t\tvar passive = is_passive_event(event_name);\n\n\t\t\t\t// Add the event listener to both the container and the document.\n\t\t\t\t// The container listener ensures we catch events from within in case\n\t\t\t\t// the outer content stops propagation of the event.\n\t\t\t\t//\n\t\t\t\t// The document listener ensures we catch events that originate from elements that were\n\t\t\t\t// manually moved outside of the container (e.g. via manual portals).\n\t\t\t\tfor (const node of [target, document]) {\n\t\t\t\t\tvar counts = listeners.get(node);\n\n\t\t\t\t\tif (counts === undefined) {\n\t\t\t\t\t\tcounts = new Map();\n\t\t\t\t\t\tlisteners.set(node, counts);\n\t\t\t\t\t}\n\n\t\t\t\t\tvar count = counts.get(event_name);\n\n\t\t\t\t\tif (count === undefined) {\n\t\t\t\t\t\tnode.addEventListener(event_name, handle_event_propagation, { passive });\n\t\t\t\t\t\tcounts.set(event_name, 1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcounts.set(event_name, count + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tevent_handle(array_from(all_registered_events));\n\t\troot_event_handles.add(event_handle);\n\n\t\treturn () => {\n\t\t\tfor (var event_name of registered_events) {\n\t\t\t\tfor (const node of [target, document]) {\n\t\t\t\t\tvar counts = /** @type {Map<string, number>} */ (listeners.get(node));\n\t\t\t\t\tvar count = /** @type {number} */ (counts.get(event_name));\n\n\t\t\t\t\tif (--count == 0) {\n\t\t\t\t\t\tnode.removeEventListener(event_name, handle_event_propagation);\n\t\t\t\t\t\tcounts.delete(event_name);\n\n\t\t\t\t\t\tif (counts.size === 0) {\n\t\t\t\t\t\t\tlisteners.delete(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcounts.set(event_name, count);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\troot_event_handles.delete(event_handle);\n\n\t\t\tif (anchor_node !== anchor) {\n\t\t\t\tanchor_node.parentNode?.removeChild(anchor_node);\n\t\t\t}\n\t\t};\n\t});\n\n\tmounted_components.set(component, unmount);\n\treturn component;\n}\n\n/**\n * References of the components that were mounted or hydrated.\n * Uses a `WeakMap` to avoid memory leaks.\n */\nlet mounted_components = new WeakMap();\n\n/**\n * Unmounts a component that was previously mounted using `mount` or `hydrate`.\n *\n * Since 5.13.0, if `options.outro` is `true`, [transitions](https://svelte.dev/docs/svelte/transition) will play before the component is removed from the DOM.\n *\n * Returns a `Promise` that resolves after transitions have completed if `options.outro` is true, or immediately otherwise (prior to 5.13.0, returns `void`).\n *\n * ```js\n * import { mount, unmount } from 'svelte';\n * import App from './App.svelte';\n *\n * const app = mount(App, { target: document.body });\n *\n * // later...\n * unmount(app, { outro: true });\n * ```\n * @param {Record<string, any>} component\n * @param {{ outro?: boolean }} [options]\n * @returns {Promise<void>}\n */\nexport function unmount(component, options) {\n\tconst fn = mounted_components.get(component);\n\n\tif (fn) {\n\t\tmounted_components.delete(component);\n\t\treturn fn(options);\n\t}\n\n\tif (DEV) {\n\t\tif (STATE_SYMBOL in component) {\n\t\t\tw.state_proxy_unmount();\n\t\t} else {\n\t\t\tw.lifecycle_double_unmount();\n\t\t}\n\t}\n\n\treturn Promise.resolve();\n}\n","/** @import { Effect, TemplateNode } from '#client' */\nimport { Batch, current_batch } from '../../reactivity/batch.js';\nimport {\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect,\n\tresume_effect\n} from '../../reactivity/effects.js';\nimport { hydrate_node, hydrating } from '../hydration.js';\nimport { create_text, should_defer_append } from '../operations.js';\n\n/**\n * @typedef {{ effect: Effect, fragment: DocumentFragment }} Branch\n */\n\n/**\n * @template Key\n */\nexport class BranchManager {\n\t/** @type {TemplateNode} */\n\tanchor;\n\n\t/** @type {Map<Batch, Key>} */\n\t#batches = new Map();\n\n\t/**\n\t * Map of keys to effects that are currently rendered in the DOM.\n\t * These effects are visible and actively part of the document tree.\n\t * Example:\n\t * ```\n\t * {#if condition}\n\t * \tfoo\n\t * {:else}\n\t * \tbar\n\t * {/if}\n\t * ```\n\t * Can result in the entries `true->Effect` and `false->Effect`\n\t * @type {Map<Key, Effect>}\n\t */\n\t#onscreen = new Map();\n\n\t/**\n\t * Similar to #onscreen with respect to the keys, but contains branches that are not yet\n\t * in the DOM, because their insertion is deferred.\n\t * @type {Map<Key, Branch>}\n\t */\n\t#offscreen = new Map();\n\n\t/**\n\t * Keys of effects that are currently outroing\n\t * @type {Set<Key>}\n\t */\n\t#outroing = new Set();\n\n\t/**\n\t * Whether to pause (i.e. outro) on change, or destroy immediately.\n\t * This is necessary for `<svelte:element>`\n\t */\n\t#transition = true;\n\n\t/**\n\t * @param {TemplateNode} anchor\n\t * @param {boolean} transition\n\t */\n\tconstructor(anchor, transition = true) {\n\t\tthis.anchor = anchor;\n\t\tthis.#transition = transition;\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#commit = (batch) => {\n\t\t// if this batch was made obsolete, bail\n\t\tif (!this.#batches.has(batch)) return;\n\n\t\tvar key = /** @type {Key} */ (this.#batches.get(batch));\n\n\t\tvar onscreen = this.#onscreen.get(key);\n\n\t\tif (onscreen) {\n\t\t\t// effect is already in the DOM — abort any current outro\n\t\t\tresume_effect(onscreen);\n\t\t\tthis.#outroing.delete(key);\n\t\t} else {\n\t\t\t// effect is currently offscreen. put it in the DOM\n\t\t\tvar offscreen = this.#offscreen.get(key);\n\n\t\t\tif (offscreen) {\n\t\t\t\tthis.#onscreen.set(key, offscreen.effect);\n\t\t\t\tthis.#offscreen.delete(key);\n\n\t\t\t\t// remove the anchor...\n\t\t\t\t/** @type {TemplateNode} */ (offscreen.fragment.lastChild).remove();\n\n\t\t\t\t// ...and append the fragment\n\t\t\t\tthis.anchor.before(offscreen.fragment);\n\t\t\t\tonscreen = offscreen.effect;\n\t\t\t}\n\t\t}\n\n\t\tfor (const [b, k] of this.#batches) {\n\t\t\tthis.#batches.delete(b);\n\n\t\t\tif (b === batch) {\n\t\t\t\t// keep values for newer batches\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst offscreen = this.#offscreen.get(k);\n\n\t\t\tif (offscreen) {\n\t\t\t\t// for older batches, destroy offscreen effects\n\t\t\t\t// as they will never be committed\n\t\t\t\tdestroy_effect(offscreen.effect);\n\t\t\t\tthis.#offscreen.delete(k);\n\t\t\t}\n\t\t}\n\n\t\t// outro/destroy all onscreen effects...\n\t\tfor (const [k, effect] of this.#onscreen) {\n\t\t\t// ...except the one that was just committed\n\t\t\t// or those that are already outroing (else the transition is aborted and the effect destroyed right away)\n\t\t\tif (k === key || this.#outroing.has(k)) continue;\n\n\t\t\tconst on_destroy = () => {\n\t\t\t\tconst keys = Array.from(this.#batches.values());\n\n\t\t\t\tif (keys.includes(k)) {\n\t\t\t\t\t// keep the effect offscreen, as another batch will need it\n\t\t\t\t\tvar fragment = document.createDocumentFragment();\n\t\t\t\t\tmove_effect(effect, fragment);\n\n\t\t\t\t\tfragment.append(create_text()); // TODO can we avoid this?\n\n\t\t\t\t\tthis.#offscreen.set(k, { effect, fragment });\n\t\t\t\t} else {\n\t\t\t\t\tdestroy_effect(effect);\n\t\t\t\t}\n\n\t\t\t\tthis.#outroing.delete(k);\n\t\t\t\tthis.#onscreen.delete(k);\n\t\t\t};\n\n\t\t\tif (this.#transition || !onscreen) {\n\t\t\t\tthis.#outroing.add(k);\n\t\t\t\tpause_effect(effect, on_destroy, false);\n\t\t\t} else {\n\t\t\t\ton_destroy();\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#discard = (batch) => {\n\t\tthis.#batches.delete(batch);\n\n\t\tconst keys = Array.from(this.#batches.values());\n\n\t\tfor (const [k, branch] of this.#offscreen) {\n\t\t\tif (!keys.includes(k)) {\n\t\t\t\tdestroy_effect(branch.effect);\n\t\t\t\tthis.#offscreen.delete(k);\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t *\n\t * @param {any} key\n\t * @param {null | ((target: TemplateNode) => void)} fn\n\t */\n\tensure(key, fn) {\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\tvar defer = should_defer_append();\n\n\t\tif (fn && !this.#onscreen.has(key) && !this.#offscreen.has(key)) {\n\t\t\tif (defer) {\n\t\t\t\tvar fragment = document.createDocumentFragment();\n\t\t\t\tvar target = create_text();\n\n\t\t\t\tfragment.append(target);\n\n\t\t\t\tthis.#offscreen.set(key, {\n\t\t\t\t\teffect: branch(() => fn(target)),\n\t\t\t\t\tfragment\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.#onscreen.set(\n\t\t\t\t\tkey,\n\t\t\t\t\tbranch(() => fn(this.anchor))\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tthis.#batches.set(batch, key);\n\n\t\tif (defer) {\n\t\t\tfor (const [k, effect] of this.#onscreen) {\n\t\t\t\tif (k === key) {\n\t\t\t\t\tbatch.unskip_effect(effect);\n\t\t\t\t} else {\n\t\t\t\t\tbatch.skip_effect(effect);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [k, branch] of this.#offscreen) {\n\t\t\t\tif (k === key) {\n\t\t\t\t\tbatch.unskip_effect(branch.effect);\n\t\t\t\t} else {\n\t\t\t\t\tbatch.skip_effect(branch.effect);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbatch.oncommit(this.#commit);\n\t\t\tbatch.ondiscard(this.#discard);\n\t\t} else {\n\t\t\tif (hydrating) {\n\t\t\t\tthis.anchor = hydrate_node;\n\t\t\t}\n\n\t\t\tthis.#commit(batch);\n\t\t}\n\t}\n}\n","/** @import { Snippet } from 'svelte' */\n/** @import { TemplateNode } from '#client' */\n/** @import { Getters } from '#shared' */\nimport { EFFECT_TRANSPARENT, ELEMENT_NODE } from '#client/constants';\nimport { block, teardown } from '../../reactivity/effects.js';\nimport {\n\tdev_current_component_function,\n\tset_dev_current_component_function\n} from '../../context.js';\nimport { hydrate_next, hydrate_node, hydrating } from '../hydration.js';\nimport { create_fragment_from_html } from '../reconciler.js';\nimport { assign_nodes } from '../template.js';\nimport * as w from '../../warnings.js';\nimport * as e from '../../errors.js';\nimport { DEV } from 'esm-env';\nimport { get_first_child, get_next_sibling } from '../operations.js';\nimport { prevent_snippet_stringification } from '../../../shared/validate.js';\nimport { BranchManager } from './branches.js';\n\n/**\n * @template {(node: TemplateNode, ...args: any[]) => void} SnippetFn\n * @param {TemplateNode} node\n * @param {() => SnippetFn | null | undefined} get_snippet\n * @param {(() => any)[]} args\n * @returns {void}\n */\nexport function snippet(node, get_snippet, ...args) {\n\tvar branches = new BranchManager(node);\n\n\tblock(() => {\n\t\tconst snippet = get_snippet() ?? null;\n\n\t\tif (DEV && snippet == null) {\n\t\t\te.invalid_snippet();\n\t\t}\n\n\t\tbranches.ensure(snippet, snippet && ((anchor) => snippet(anchor, ...args)));\n\t}, EFFECT_TRANSPARENT);\n}\n\n/**\n * In development, wrap the snippet function so that it passes validation, and so that the\n * correct component context is set for ownership checks\n * @param {any} component\n * @param {(node: TemplateNode, ...args: any[]) => void} fn\n */\nexport function wrap_snippet(component, fn) {\n\tconst snippet = (/** @type {TemplateNode} */ node, /** @type {any[]} */ ...args) => {\n\t\tvar previous_component_function = dev_current_component_function;\n\t\tset_dev_current_component_function(component);\n\n\t\ttry {\n\t\t\treturn fn(node, ...args);\n\t\t} finally {\n\t\t\tset_dev_current_component_function(previous_component_function);\n\t\t}\n\t};\n\n\tprevent_snippet_stringification(snippet);\n\n\treturn snippet;\n}\n\n/**\n * Create a snippet programmatically\n * @template {unknown[]} Params\n * @param {(...params: Getters<Params>) => {\n * render: () => string\n * setup?: (element: Element) => void | (() => void)\n * }} fn\n * @returns {Snippet<Params>}\n */\nexport function createRawSnippet(fn) {\n\t// @ts-expect-error the types are a lie\n\treturn (/** @type {TemplateNode} */ anchor, /** @type {Getters<Params>} */ ...params) => {\n\t\tvar snippet = fn(...params);\n\n\t\t/** @type {Element} */\n\t\tvar element;\n\n\t\tif (hydrating) {\n\t\t\telement = /** @type {Element} */ (hydrate_node);\n\t\t\thydrate_next();\n\t\t} else {\n\t\t\tvar html = snippet.render().trim();\n\t\t\tvar fragment = create_fragment_from_html(html);\n\t\t\telement = /** @type {Element} */ (get_first_child(fragment));\n\n\t\t\tif (DEV && (get_next_sibling(element) !== null || element.nodeType !== ELEMENT_NODE)) {\n\t\t\t\tw.invalid_raw_snippet_render();\n\t\t\t}\n\n\t\t\tanchor.before(element);\n\t\t}\n\n\t\tconst result = snippet.setup?.(element);\n\t\tassign_nodes(element, element);\n\n\t\tif (typeof result === 'function') {\n\t\t\tteardown(result);\n\t\t}\n\t};\n}\n","/** @import { ComponentContext, ComponentContextLegacy } from '#client' */\n/** @import { EventDispatcher } from './index.js' */\n/** @import { NotFunction } from './internal/types.js' */\nimport { active_reaction, untrack } from './internal/client/runtime.js';\nimport { is_array } from './internal/shared/utils.js';\nimport { user_effect } from './internal/client/index.js';\nimport * as e from './internal/client/errors.js';\nimport { legacy_mode_flag } from './internal/flags/index.js';\nimport { component_context } from './internal/client/context.js';\nimport { DEV } from 'esm-env';\n\nif (DEV) {\n\t/**\n\t * @param {string} rune\n\t */\n\tfunction throw_rune_error(rune) {\n\t\tif (!(rune in globalThis)) {\n\t\t\t// TODO if people start adjusting the \"this can contain runes\" config through v-p-s more, adjust this message\n\t\t\t/** @type {any} */\n\t\t\tlet value; // let's hope noone modifies this global, but belts and braces\n\t\t\tObject.defineProperty(globalThis, rune, {\n\t\t\t\tconfigurable: true,\n\t\t\t\t// eslint-disable-next-line getter-return\n\t\t\t\tget: () => {\n\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\treturn value;\n\t\t\t\t\t}\n\n\t\t\t\t\te.rune_outside_svelte(rune);\n\t\t\t\t},\n\t\t\t\tset: (v) => {\n\t\t\t\t\tvalue = v;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tthrow_rune_error('$state');\n\tthrow_rune_error('$effect');\n\tthrow_rune_error('$derived');\n\tthrow_rune_error('$inspect');\n\tthrow_rune_error('$props');\n\tthrow_rune_error('$bindable');\n}\n\n/**\n * Returns an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that aborts when the current [derived](https://svelte.dev/docs/svelte/$derived) or [effect](https://svelte.dev/docs/svelte/$effect) re-runs or is destroyed.\n *\n * Must be called while a derived or effect is running.\n *\n * ```svelte\n * <script>\n * \timport { getAbortSignal } from 'svelte';\n *\n * \tlet { id } = $props();\n *\n * \tasync function getData(id) {\n * \t\tconst response = await fetch(`/items/${id}`, {\n * \t\t\tsignal: getAbortSignal()\n * \t\t});\n *\n * \t\treturn await response.json();\n * \t}\n *\n * \tconst data = $derived(await getData(id));\n * </script>\n * ```\n */\nexport function getAbortSignal() {\n\tif (active_reaction === null) {\n\t\te.get_abort_signal_outside_reaction();\n\t}\n\n\treturn (active_reaction.ac ??= new AbortController()).signal;\n}\n\n/**\n * `onMount`, like [`$effect`](https://svelte.dev/docs/svelte/$effect), schedules a function to run as soon as the component has been mounted to the DOM.\n * Unlike `$effect`, the provided function only runs once.\n *\n * It must be called during the component's initialisation (but doesn't need to live _inside_ the component;\n * it can be called from an external module). If a function is returned _synchronously_ from `onMount`,\n * it will be called when the component is unmounted.\n *\n * `onMount` functions do not run during [server-side rendering](https://svelte.dev/docs/svelte/svelte-server#render).\n *\n * @template T\n * @param {() => NotFunction<T> | Promise<NotFunction<T>> | (() => any)} fn\n * @returns {void}\n */\nexport function onMount(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('onMount');\n\t}\n\n\tif (legacy_mode_flag && component_context.l !== null) {\n\t\tinit_update_callbacks(component_context).m.push(fn);\n\t} else {\n\t\tuser_effect(() => {\n\t\t\tconst cleanup = untrack(fn);\n\t\t\tif (typeof cleanup === 'function') return /** @type {() => void} */ (cleanup);\n\t\t});\n\t}\n}\n\n/**\n * Schedules a callback to run immediately before the component is unmounted.\n *\n * Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the\n * only one that runs inside a server-side component.\n *\n * @param {() => any} fn\n * @returns {void}\n */\nexport function onDestroy(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('onDestroy');\n\t}\n\n\tonMount(() => () => untrack(fn));\n}\n\n/**\n * @template [T=any]\n * @param {string} type\n * @param {T} [detail]\n * @param {any}params_0\n * @returns {CustomEvent<T>}\n */\nfunction create_custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {\n\treturn new CustomEvent(type, { detail, bubbles, cancelable });\n}\n\n/**\n * Creates an event dispatcher that can be used to dispatch [component events](https://svelte.dev/docs/svelte/legacy-on#Component-events).\n * Event dispatchers are functions that can take two arguments: `name` and `detail`.\n *\n * Component events created with `createEventDispatcher` create a\n * [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent).\n * These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture).\n * The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail)\n * property and can contain any type of data.\n *\n * The event dispatcher can be typed to narrow the allowed event names and the type of the `detail` argument:\n * ```ts\n * const dispatch = createEventDispatcher<{\n * loaded: null; // does not take a detail argument\n * change: string; // takes a detail argument of type string, which is required\n * optional: number | null; // takes an optional detail argument of type number\n * }>();\n * ```\n *\n * @deprecated Use callback props and/or the `$host()` rune instead — see [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Event-changes-Component-events)\n * @template {Record<string, any>} [EventMap = any]\n * @returns {EventDispatcher<EventMap>}\n */\nexport function createEventDispatcher() {\n\tconst active_component_context = component_context;\n\tif (active_component_context === null) {\n\t\te.lifecycle_outside_component('createEventDispatcher');\n\t}\n\n\t/**\n\t * @param [detail]\n\t * @param [options]\n\t */\n\treturn (type, detail, options) => {\n\t\tconst events = /** @type {Record<string, Function | Function[]>} */ (\n\t\t\tactive_component_context.s.$$events\n\t\t)?.[/** @type {string} */ (type)];\n\n\t\tif (events) {\n\t\t\tconst callbacks = is_array(events) ? events.slice() : [events];\n\t\t\t// TODO are there situations where events could be dispatched\n\t\t\t// in a server (non-DOM) environment?\n\t\t\tconst event = create_custom_event(/** @type {string} */ (type), detail, options);\n\t\t\tfor (const fn of callbacks) {\n\t\t\t\tfn.call(active_component_context.x, event);\n\t\t\t}\n\t\t\treturn !event.defaultPrevented;\n\t\t}\n\n\t\treturn true;\n\t};\n}\n\n// TODO mark beforeUpdate and afterUpdate as deprecated in Svelte 6\n\n/**\n * Schedules a callback to run immediately before the component is updated after any state change.\n *\n * The first time the callback runs will be before the initial `onMount`.\n *\n * In runes mode use `$effect.pre` instead.\n *\n * @deprecated Use [`$effect.pre`](https://svelte.dev/docs/svelte/$effect#$effect.pre) instead\n * @param {() => void} fn\n * @returns {void}\n */\nexport function beforeUpdate(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('beforeUpdate');\n\t}\n\n\tif (component_context.l === null) {\n\t\te.lifecycle_legacy_only('beforeUpdate');\n\t}\n\n\tinit_update_callbacks(component_context).b.push(fn);\n}\n\n/**\n * Schedules a callback to run immediately after the component has been updated.\n *\n * The first time the callback runs will be after the initial `onMount`.\n *\n * In runes mode use `$effect` instead.\n *\n * @deprecated Use [`$effect`](https://svelte.dev/docs/svelte/$effect) instead\n * @param {() => void} fn\n * @returns {void}\n */\nexport function afterUpdate(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('afterUpdate');\n\t}\n\n\tif (component_context.l === null) {\n\t\te.lifecycle_legacy_only('afterUpdate');\n\t}\n\n\tinit_update_callbacks(component_context).a.push(fn);\n}\n\n/**\n * Legacy-mode: Init callbacks object for onMount/beforeUpdate/afterUpdate\n * @param {ComponentContext} context\n */\nfunction init_update_callbacks(context) {\n\tvar l = /** @type {ComponentContextLegacy} */ (context).l;\n\treturn (l.u ??= { a: [], b: [], m: [] });\n}\n\nexport { flushSync, fork } from './internal/client/reactivity/batch.js';\nexport {\n\tcreateContext,\n\tgetContext,\n\tgetAllContexts,\n\thasContext,\n\tsetContext\n} from './internal/client/context.js';\nexport { hydratable } from './internal/client/hydratable.js';\nexport { hydrate, mount, unmount } from './internal/client/render.js';\nexport { tick, untrack, settled } from './internal/client/runtime.js';\nexport { createRawSnippet } from './internal/client/dom/blocks/snippet.js';\n","/** @type {Map<String, Set<HTMLStyleElement>>} */\nvar all_styles = new Map();\n\n/**\n * @param {String} hash\n * @param {HTMLStyleElement} style\n */\nexport function register_style(hash, style) {\n\tvar styles = all_styles.get(hash);\n\n\tif (!styles) {\n\t\tstyles = new Set();\n\t\tall_styles.set(hash, styles);\n\t}\n\n\tstyles.add(style);\n}\n\n/**\n * @param {String} hash\n */\nexport function cleanup_styles(hash) {\n\tvar styles = all_styles.get(hash);\n\tif (!styles) return;\n\n\tfor (const style of styles) {\n\t\tstyle.remove();\n\t}\n\n\tall_styles.delete(hash);\n}\n","/** @import { TemplateNode } from '#client' */\nimport { EFFECT_TRANSPARENT } from '#client/constants';\nimport {\n\thydrate_next,\n\thydrating,\n\tread_hydration_instruction,\n\tskip_nodes,\n\tset_hydrate_node,\n\tset_hydrating,\n\thydrate_node\n} from '../hydration.js';\nimport { block } from '../../reactivity/effects.js';\nimport { BranchManager } from './branches.js';\n\n/**\n * @param {TemplateNode} node\n * @param {(branch: (fn: (anchor: Node) => void, key?: number | false) => void) => void} fn\n * @param {boolean} [elseif] True if this is an `{:else if ...}` block rather than an `{#if ...}`, as that affects which transitions are considered 'local'\n * @returns {void}\n */\nexport function if_block(node, fn, elseif = false) {\n\t/** @type {TemplateNode | undefined} */\n\tvar marker;\n\tif (hydrating) {\n\t\tmarker = hydrate_node;\n\t\thydrate_next();\n\t}\n\n\tvar branches = new BranchManager(node);\n\tvar flags = elseif ? EFFECT_TRANSPARENT : 0;\n\n\t/**\n\t * @param {number | false} key\n\t * @param {null | ((anchor: Node) => void)} fn\n\t */\n\tfunction update_branch(key, fn) {\n\t\tif (hydrating) {\n\t\t\tvar data = read_hydration_instruction(/** @type {TemplateNode} */ (marker));\n\n\t\t\t// \"[n\" = branch n, \"[-1\" = else\n\t\t\tif (key !== parseInt(data.substring(1))) {\n\t\t\t\t// Hydration mismatch: remove everything inside the anchor and start fresh.\n\t\t\t\t// This could happen with `{#if browser}...{/if}`, for example\n\t\t\t\tvar anchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tbranches.anchor = anchor;\n\n\t\t\t\tset_hydrating(false);\n\t\t\t\tbranches.ensure(key, fn);\n\t\t\t\tset_hydrating(true);\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tbranches.ensure(key, fn);\n\t}\n\n\tblock(() => {\n\t\tvar has_branch = false;\n\n\t\tfn((fn, key = 0) => {\n\t\t\thas_branch = true;\n\t\t\tupdate_branch(key, fn);\n\t\t});\n\n\t\tif (!has_branch) {\n\t\t\tupdate_branch(-1, null);\n\t\t}\n\t}, flags);\n}\n","/** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, Source, TemplateNode, TransitionManager, Value } from '#client' */\n/** @import { Batch } from '../../reactivity/batch.js'; */\nimport {\n\tEACH_INDEX_REACTIVE,\n\tEACH_IS_ANIMATED,\n\tEACH_IS_CONTROLLED,\n\tEACH_ITEM_IMMUTABLE,\n\tEACH_ITEM_REACTIVE,\n\tHYDRATION_END,\n\tHYDRATION_START_ELSE\n} from '../../../../constants.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tread_hydration_instruction,\n\tskip_nodes,\n\tset_hydrate_node,\n\tset_hydrating\n} from '../hydration.js';\nimport {\n\tclear_text_content,\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tshould_defer_append\n} from '../operations.js';\nimport {\n\tblock,\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect,\n\tresume_effect\n} from '../../reactivity/effects.js';\nimport { source, mutable_source, internal_set } from '../../reactivity/sources.js';\nimport { array_from, is_array } from '../../../shared/utils.js';\nimport { BRANCH_EFFECT, COMMENT_NODE, DESTROYED, EFFECT_OFFSCREEN, INERT } from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { get } from '../../runtime.js';\nimport { DEV } from 'esm-env';\nimport { derived_safe_equal } from '../../reactivity/deriveds.js';\nimport { current_batch } from '../../reactivity/batch.js';\nimport * as e from '../../errors.js';\n\n// When making substantive changes to this file, validate them with the each block stress test:\n// https://svelte.dev/playground/1972b2cf46564476ad8c8c6405b23b7b\n// This test also exists in this repo, as `packages/svelte/tests/manual/each-stress-test`\n\n/**\n * @param {any} _\n * @param {number} i\n */\nexport function index(_, i) {\n\treturn i;\n}\n\n/**\n * Pause multiple effects simultaneously, and coordinate their\n * subsequent destruction. Used in each blocks\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {null | Node} controlled_anchor\n */\nfunction pause_effects(state, to_destroy, controlled_anchor) {\n\t/** @type {TransitionManager[]} */\n\tvar transitions = [];\n\tvar length = to_destroy.length;\n\n\t/** @type {EachOutroGroup} */\n\tvar group;\n\tvar remaining = to_destroy.length;\n\n\tfor (var i = 0; i < length; i++) {\n\t\tlet effect = to_destroy[i];\n\n\t\tpause_effect(\n\t\t\teffect,\n\t\t\t() => {\n\t\t\t\tif (group) {\n\t\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\t\tgroup.done.add(effect);\n\n\t\t\t\t\tif (group.pending.size === 0) {\n\t\t\t\t\t\tvar groups = /** @type {Set<EachOutroGroup>} */ (state.outrogroups);\n\n\t\t\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\t\t\tgroups.delete(group);\n\n\t\t\t\t\t\tif (groups.size === 0) {\n\t\t\t\t\t\t\tstate.outrogroups = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tremaining -= 1;\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse\n\t\t);\n\t}\n\n\tif (remaining === 0) {\n\t\t// If we're in a controlled each block (i.e. the block is the only child of an\n\t\t// element), and we are removing all items, _and_ there are no out transitions,\n\t\t// we can use the fast path — emptying the element and replacing the anchor\n\t\tvar fast_path = transitions.length === 0 && controlled_anchor !== null;\n\n\t\tif (fast_path) {\n\t\t\tvar anchor = /** @type {Element} */ (controlled_anchor);\n\t\t\tvar parent_node = /** @type {Element} */ (anchor.parentNode);\n\n\t\t\tclear_text_content(parent_node);\n\t\t\tparent_node.append(anchor);\n\n\t\t\tstate.items.clear();\n\t\t}\n\n\t\tdestroy_effects(state, to_destroy, !fast_path);\n\t} else {\n\t\tgroup = {\n\t\t\tpending: new Set(to_destroy),\n\t\t\tdone: new Set()\n\t\t};\n\n\t\t(state.outrogroups ??= new Set()).add(group);\n\t}\n}\n\n/**\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {boolean} remove_dom\n */\nfunction destroy_effects(state, to_destroy, remove_dom = true) {\n\t/** @type {Set<Effect> | undefined} */\n\tvar preserved_effects;\n\n\t// The loop-in-a-loop isn't ideal, but we should only hit this in relatively rare cases\n\tif (state.pending.size > 0) {\n\t\tpreserved_effects = new Set();\n\n\t\tfor (const keys of state.pending.values()) {\n\t\t\tfor (const key of keys) {\n\t\t\t\tpreserved_effects.add(/** @type {EachItem} */ (state.items.get(key)).e);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (var i = 0; i < to_destroy.length; i++) {\n\t\tvar e = to_destroy[i];\n\n\t\tif (preserved_effects?.has(e)) {\n\t\t\te.f |= EFFECT_OFFSCREEN;\n\n\t\t\tconst fragment = document.createDocumentFragment();\n\t\t\tmove_effect(e, fragment);\n\t\t} else {\n\t\t\tdestroy_effect(to_destroy[i], remove_dom);\n\t\t}\n\t}\n}\n\n/** @type {TemplateNode} */\nvar offscreen_anchor;\n\n/**\n * @template V\n * @param {Element | Comment} node The next sibling node, or the parent node if this is a 'controlled' block\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @param {(value: V, index: number) => any} get_key\n * @param {(anchor: Node, item: MaybeSource<V>, index: MaybeSource<number>) => void} render_fn\n * @param {null | ((anchor: Node) => void)} fallback_fn\n * @returns {void}\n */\nexport function each(node, flags, get_collection, get_key, render_fn, fallback_fn = null) {\n\tvar anchor = node;\n\n\t/** @type {Map<any, EachItem>} */\n\tvar items = new Map();\n\n\tvar is_controlled = (flags & EACH_IS_CONTROLLED) !== 0;\n\n\tif (is_controlled) {\n\t\tvar parent_node = /** @type {Element} */ (node);\n\n\t\tanchor = hydrating\n\t\t\t? set_hydrate_node(get_first_child(parent_node))\n\t\t\t: parent_node.appendChild(create_text());\n\t}\n\n\tif (hydrating) {\n\t\thydrate_next();\n\t}\n\n\t/** @type {Effect | null} */\n\tvar fallback = null;\n\n\t// TODO: ideally we could use derived for runes mode but because of the ability\n\t// to use a store which can be mutated, we can't do that here as mutating a store\n\t// will still result in the collection array being the same from the store\n\tvar each_array = derived_safe_equal(() => {\n\t\tvar collection = get_collection();\n\n\t\treturn is_array(collection) ? collection : collection == null ? [] : array_from(collection);\n\t});\n\n\t/** @type {V[]} */\n\tvar array;\n\n\t/** @type {Map<Batch, Set<any>>} */\n\tvar pending = new Map();\n\n\tvar first_run = true;\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction commit(batch) {\n\t\tif ((state.effect.f & DESTROYED) !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tstate.pending.delete(batch);\n\n\t\tstate.fallback = fallback;\n\t\treconcile(state, array, anchor, flags, get_key);\n\n\t\tif (fallback !== null) {\n\t\t\tif (array.length === 0) {\n\t\t\t\tif ((fallback.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\t\tresume_effect(fallback);\n\t\t\t\t} else {\n\t\t\t\t\tfallback.f ^= EFFECT_OFFSCREEN;\n\t\t\t\t\tmove(fallback, null, anchor);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpause_effect(fallback, () => {\n\t\t\t\t\t// TODO only null out if no pending batch needs it,\n\t\t\t\t\t// otherwise re-add `fallback.fragment` and move the\n\t\t\t\t\t// effect into it\n\t\t\t\t\tfallback = null;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction discard(batch) {\n\t\tstate.pending.delete(batch);\n\t}\n\n\tvar effect = block(() => {\n\t\tarray = /** @type {V[]} */ (get(each_array));\n\t\tvar length = array.length;\n\n\t\t/** `true` if there was a hydration mismatch. Needs to be a `let` or else it isn't treeshaken out */\n\t\tlet mismatch = false;\n\n\t\tif (hydrating) {\n\t\t\tvar is_else = read_hydration_instruction(anchor) === HYDRATION_START_ELSE;\n\n\t\t\tif (is_else !== (length === 0)) {\n\t\t\t\t// hydration mismatch — remove the server-rendered DOM and start over\n\t\t\t\tanchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tset_hydrating(false);\n\t\t\t\tmismatch = true;\n\t\t\t}\n\t\t}\n\n\t\tvar keys = new Set();\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\tvar defer = should_defer_append();\n\n\t\tfor (var index = 0; index < length; index += 1) {\n\t\t\tif (\n\t\t\t\thydrating &&\n\t\t\t\thydrate_node.nodeType === COMMENT_NODE &&\n\t\t\t\t/** @type {Comment} */ (hydrate_node).data === HYDRATION_END\n\t\t\t) {\n\t\t\t\t// The server rendered fewer items than expected,\n\t\t\t\t// so break out and continue appending non-hydrated items\n\t\t\t\tanchor = /** @type {Comment} */ (hydrate_node);\n\t\t\t\tmismatch = true;\n\t\t\t\tset_hydrating(false);\n\t\t\t}\n\n\t\t\tvar value = array[index];\n\t\t\tvar key = get_key(value, index);\n\n\t\t\tif (DEV) {\n\t\t\t\t// Check that the key function is idempotent (returns the same value when called twice)\n\t\t\t\tvar key_again = get_key(value, index);\n\t\t\t\tif (key !== key_again) {\n\t\t\t\t\te.each_key_volatile(String(index), String(key), String(key_again));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar item = first_run ? null : items.get(key);\n\n\t\t\tif (item) {\n\t\t\t\t// update before reconciliation, to trigger any async updates\n\t\t\t\tif (item.v) internal_set(item.v, value);\n\t\t\t\tif (item.i) internal_set(item.i, index);\n\n\t\t\t\tif (defer) {\n\t\t\t\t\tbatch.unskip_effect(item.e);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\titem = create_item(\n\t\t\t\t\titems,\n\t\t\t\t\tfirst_run ? anchor : (offscreen_anchor ??= create_text()),\n\t\t\t\t\tvalue,\n\t\t\t\t\tkey,\n\t\t\t\t\tindex,\n\t\t\t\t\trender_fn,\n\t\t\t\t\tflags,\n\t\t\t\t\tget_collection\n\t\t\t\t);\n\n\t\t\t\tif (!first_run) {\n\t\t\t\t\titem.e.f |= EFFECT_OFFSCREEN;\n\t\t\t\t}\n\n\t\t\t\titems.set(key, item);\n\t\t\t}\n\n\t\t\tkeys.add(key);\n\t\t}\n\n\t\tif (length === 0 && fallback_fn && !fallback) {\n\t\t\tif (first_run) {\n\t\t\t\tfallback = branch(() => fallback_fn(anchor));\n\t\t\t} else {\n\t\t\t\tfallback = branch(() => fallback_fn((offscreen_anchor ??= create_text())));\n\t\t\t\tfallback.f |= EFFECT_OFFSCREEN;\n\t\t\t}\n\t\t}\n\n\t\tif (length > keys.size) {\n\t\t\tif (DEV) {\n\t\t\t\tvalidate_each_keys(array, get_key);\n\t\t\t} else {\n\t\t\t\t// in prod, the additional information isn't printed, so don't bother computing it\n\t\t\t\te.each_key_duplicate('', '', '');\n\t\t\t}\n\t\t}\n\n\t\t// remove excess nodes\n\t\tif (hydrating && length > 0) {\n\t\t\tset_hydrate_node(skip_nodes());\n\t\t}\n\n\t\tif (!first_run) {\n\t\t\tpending.set(batch, keys);\n\n\t\t\tif (defer) {\n\t\t\t\tfor (const [key, item] of items) {\n\t\t\t\t\tif (!keys.has(key)) {\n\t\t\t\t\t\tbatch.skip_effect(item.e);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbatch.oncommit(commit);\n\t\t\t\tbatch.ondiscard(discard);\n\t\t\t} else {\n\t\t\t\tcommit(batch);\n\t\t\t}\n\t\t}\n\n\t\tif (mismatch) {\n\t\t\t// continue in hydration mode\n\t\t\tset_hydrating(true);\n\t\t}\n\n\t\t// When we mount the each block for the first time, the collection won't be\n\t\t// connected to this effect as the effect hasn't finished running yet and its deps\n\t\t// won't be assigned. However, it's possible that when reconciling the each block\n\t\t// that a mutation occurred and it's made the collection MAYBE_DIRTY, so reading the\n\t\t// collection again can provide consistency to the reactive graph again as the deriveds\n\t\t// will now be `CLEAN`.\n\t\tget(each_array);\n\t});\n\n\t/** @type {EachState} */\n\tvar state = { effect, flags, items, pending, outrogroups: null, fallback };\n\n\tfirst_run = false;\n\n\tif (hydrating) {\n\t\tanchor = hydrate_node;\n\t}\n}\n\n/**\n * Skip past any non-branch effects (which could be created with `createSubscriber`, for example) to find the next branch effect\n * @param {Effect | null} effect\n * @returns {Effect | null}\n */\nfunction skip_to_branch(effect) {\n\twhile (effect !== null && (effect.f & BRANCH_EFFECT) === 0) {\n\t\teffect = effect.next;\n\t}\n\treturn effect;\n}\n\n/**\n * Add, remove, or reorder items output by an each block as its input changes\n * @template V\n * @param {EachState} state\n * @param {Array<V>} array\n * @param {Element | Comment | Text} anchor\n * @param {number} flags\n * @param {(value: V, index: number) => any} get_key\n * @returns {void}\n */\nfunction reconcile(state, array, anchor, flags, get_key) {\n\tvar is_animated = (flags & EACH_IS_ANIMATED) !== 0;\n\n\tvar length = array.length;\n\tvar items = state.items;\n\tvar current = skip_to_branch(state.effect.first);\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar seen;\n\n\t/** @type {Effect | null} */\n\tvar prev = null;\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar to_animate;\n\n\t/** @type {Effect[]} */\n\tvar matched = [];\n\n\t/** @type {Effect[]} */\n\tvar stashed = [];\n\n\t/** @type {V} */\n\tvar value;\n\n\t/** @type {any} */\n\tvar key;\n\n\t/** @type {Effect | undefined} */\n\tvar effect;\n\n\t/** @type {number} */\n\tvar i;\n\n\tif (is_animated) {\n\t\tfor (i = 0; i < length; i += 1) {\n\t\t\tvalue = array[i];\n\t\t\tkey = get_key(value, i);\n\t\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\t\t// offscreen == coming in now, no animation in that case,\n\t\t\t// else this would happen https://github.com/sveltejs/svelte/issues/17181\n\t\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\teffect.nodes?.a?.measure();\n\t\t\t\t(to_animate ??= new Set()).add(effect);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (i = 0; i < length; i += 1) {\n\t\tvalue = array[i];\n\t\tkey = get_key(value, i);\n\n\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\tif (state.outrogroups !== null) {\n\t\t\tfor (const group of state.outrogroups) {\n\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\tgroup.done.delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & INERT) !== 0) {\n\t\t\tresume_effect(effect);\n\t\t\tif (is_animated) {\n\t\t\t\teffect.nodes?.a?.unfix();\n\t\t\t\t(to_animate ??= new Set()).delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) !== 0) {\n\t\t\teffect.f ^= EFFECT_OFFSCREEN;\n\n\t\t\tif (effect === current) {\n\t\t\t\tmove(effect, null, anchor);\n\t\t\t} else {\n\t\t\t\tvar next = prev ? prev.next : current;\n\n\t\t\t\tif (effect === state.effect.last) {\n\t\t\t\t\tstate.effect.last = effect.prev;\n\t\t\t\t}\n\n\t\t\t\tif (effect.prev) effect.prev.next = effect.next;\n\t\t\t\tif (effect.next) effect.next.prev = effect.prev;\n\t\t\t\tlink(state, prev, effect);\n\t\t\t\tlink(state, effect, next);\n\n\t\t\t\tmove(effect, next, anchor);\n\t\t\t\tprev = effect;\n\n\t\t\t\tmatched = [];\n\t\t\t\tstashed = [];\n\n\t\t\t\tcurrent = skip_to_branch(prev.next);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (effect !== current) {\n\t\t\tif (seen !== undefined && seen.has(effect)) {\n\t\t\t\tif (matched.length < stashed.length) {\n\t\t\t\t\t// more efficient to move later items to the front\n\t\t\t\t\tvar start = stashed[0];\n\t\t\t\t\tvar j;\n\n\t\t\t\t\tprev = start.prev;\n\n\t\t\t\t\tvar a = matched[0];\n\t\t\t\t\tvar b = matched[matched.length - 1];\n\n\t\t\t\t\tfor (j = 0; j < matched.length; j += 1) {\n\t\t\t\t\t\tmove(matched[j], start, anchor);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (j = 0; j < stashed.length; j += 1) {\n\t\t\t\t\t\tseen.delete(stashed[j]);\n\t\t\t\t\t}\n\n\t\t\t\t\tlink(state, a.prev, b.next);\n\t\t\t\t\tlink(state, prev, a);\n\t\t\t\t\tlink(state, b, start);\n\n\t\t\t\t\tcurrent = start;\n\t\t\t\t\tprev = b;\n\t\t\t\t\ti -= 1;\n\n\t\t\t\t\tmatched = [];\n\t\t\t\t\tstashed = [];\n\t\t\t\t} else {\n\t\t\t\t\t// more efficient to move earlier items to the back\n\t\t\t\t\tseen.delete(effect);\n\t\t\t\t\tmove(effect, current, anchor);\n\n\t\t\t\t\tlink(state, effect.prev, effect.next);\n\t\t\t\t\tlink(state, effect, prev === null ? state.effect.first : prev.next);\n\t\t\t\t\tlink(state, prev, effect);\n\n\t\t\t\t\tprev = effect;\n\t\t\t\t}\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tmatched = [];\n\t\t\tstashed = [];\n\n\t\t\twhile (current !== null && current !== effect) {\n\t\t\t\t(seen ??= new Set()).add(current);\n\t\t\t\tstashed.push(current);\n\t\t\t\tcurrent = skip_to_branch(current.next);\n\t\t\t}\n\n\t\t\tif (current === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\tmatched.push(effect);\n\t\t}\n\n\t\tprev = effect;\n\t\tcurrent = skip_to_branch(effect.next);\n\t}\n\n\tif (state.outrogroups !== null) {\n\t\tfor (const group of state.outrogroups) {\n\t\t\tif (group.pending.size === 0) {\n\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\tstate.outrogroups?.delete(group);\n\t\t\t}\n\t\t}\n\n\t\tif (state.outrogroups.size === 0) {\n\t\t\tstate.outrogroups = null;\n\t\t}\n\t}\n\n\tif (current !== null || seen !== undefined) {\n\t\t/** @type {Effect[]} */\n\t\tvar to_destroy = [];\n\n\t\tif (seen !== undefined) {\n\t\t\tfor (effect of seen) {\n\t\t\t\tif ((effect.f & INERT) === 0) {\n\t\t\t\t\tto_destroy.push(effect);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\twhile (current !== null) {\n\t\t\t// If the each block isn't inert, then inert effects are currently outroing and will be removed once the transition is finished\n\t\t\tif ((current.f & INERT) === 0 && current !== state.fallback) {\n\t\t\t\tto_destroy.push(current);\n\t\t\t}\n\n\t\t\tcurrent = skip_to_branch(current.next);\n\t\t}\n\n\t\tvar destroy_length = to_destroy.length;\n\n\t\tif (destroy_length > 0) {\n\t\t\tvar controlled_anchor = (flags & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null;\n\n\t\t\tif (is_animated) {\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.measure();\n\t\t\t\t}\n\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.fix();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpause_effects(state, to_destroy, controlled_anchor);\n\t\t}\n\t}\n\n\tif (is_animated) {\n\t\tqueue_micro_task(() => {\n\t\t\tif (to_animate === undefined) return;\n\t\t\tfor (effect of to_animate) {\n\t\t\t\teffect.nodes?.a?.apply();\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @template V\n * @param {Map<any, EachItem>} items\n * @param {Node} anchor\n * @param {V} value\n * @param {unknown} key\n * @param {number} index\n * @param {(anchor: Node, item: V | Source<V>, index: number | Value<number>, collection: () => V[]) => void} render_fn\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @returns {EachItem}\n */\nfunction create_item(items, anchor, value, key, index, render_fn, flags, get_collection) {\n\tvar v =\n\t\t(flags & EACH_ITEM_REACTIVE) !== 0\n\t\t\t? (flags & EACH_ITEM_IMMUTABLE) === 0\n\t\t\t\t? mutable_source(value, false, false)\n\t\t\t\t: source(value)\n\t\t\t: null;\n\n\tvar i = (flags & EACH_INDEX_REACTIVE) !== 0 ? source(index) : null;\n\n\tif (DEV && v) {\n\t\t// For tracing purposes, we need to link the source signal we create with the\n\t\t// collection + index so that tracing works as intended\n\t\tv.trace = () => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n\t\t\tget_collection()[i?.v ?? index];\n\t\t};\n\t}\n\n\treturn {\n\t\tv,\n\t\ti,\n\t\te: branch(() => {\n\t\t\trender_fn(anchor, v ?? value, i ?? index, get_collection);\n\n\t\t\treturn () => {\n\t\t\t\titems.delete(key);\n\t\t\t};\n\t\t})\n\t};\n}\n\n/**\n * @param {Effect} effect\n * @param {Effect | null} next\n * @param {Text | Element | Comment} anchor\n */\nfunction move(effect, next, anchor) {\n\tif (!effect.nodes) return;\n\n\tvar node = effect.nodes.start;\n\tvar end = effect.nodes.end;\n\n\tvar dest =\n\t\tnext && (next.f & EFFECT_OFFSCREEN) === 0\n\t\t\t? /** @type {EffectNodes} */ (next.nodes).start\n\t\t\t: anchor;\n\n\twhile (node !== null) {\n\t\tvar next_node = /** @type {TemplateNode} */ (get_next_sibling(node));\n\t\tdest.before(node);\n\n\t\tif (node === end) {\n\t\t\treturn;\n\t\t}\n\n\t\tnode = next_node;\n\t}\n}\n\n/**\n * @param {EachState} state\n * @param {Effect | null} prev\n * @param {Effect | null} next\n */\nfunction link(state, prev, next) {\n\tif (prev === null) {\n\t\tstate.effect.first = next;\n\t} else {\n\t\tprev.next = next;\n\t}\n\n\tif (next === null) {\n\t\tstate.effect.last = prev;\n\t} else {\n\t\tnext.prev = prev;\n\t}\n}\n\n/**\n * @param {Array<any>} array\n * @param {(item: any, index: number) => string} key_fn\n * @returns {void}\n */\nfunction validate_each_keys(array, key_fn) {\n\tconst keys = new Map();\n\tconst length = array.length;\n\n\tfor (let i = 0; i < length; i++) {\n\t\tconst key = key_fn(array[i], i);\n\n\t\tif (keys.has(key)) {\n\t\t\tconst a = String(keys.get(key));\n\t\t\tconst b = String(i);\n\n\t\t\t/** @type {string | null} */\n\t\t\tlet k = String(key);\n\t\t\tif (k.startsWith('[object ')) k = null;\n\n\t\t\te.each_key_duplicate(a, b, k);\n\t\t}\n\n\t\tkeys.set(key, i);\n\t}\n}\n","/** @import { Effect, TemplateNode } from '#client' */\n/** @import {} from 'trusted-types' */\nimport {\n\tFILENAME,\n\tHYDRATION_ERROR,\n\tNAMESPACE_SVG,\n\tNAMESPACE_MATHML\n} from '../../../../constants.js';\nimport { remove_effect_dom, template_effect } from '../../reactivity/effects.js';\nimport { hydrate_next, hydrate_node, hydrating, set_hydrate_node } from '../hydration.js';\n\nimport { assign_nodes } from '../template.js';\nimport * as w from '../../warnings.js';\nimport { hash, sanitize_location } from '../../../../utils.js';\nimport { DEV } from 'esm-env';\nimport { dev_current_component_function } from '../../context.js';\nimport { create_element, get_first_child, get_next_sibling } from '../operations.js';\nimport { active_effect } from '../../runtime.js';\nimport { COMMENT_NODE } from '#client/constants';\n\n/**\n * @param {Element} element\n * @param {string | null} server_hash\n * @param {string | TrustedHTML} value\n */\nfunction check_hash(element, server_hash, value) {\n\tif (!server_hash || server_hash === hash(String(value ?? ''))) return;\n\n\tlet location;\n\n\t// @ts-expect-error\n\tconst loc = element.__svelte_meta?.loc;\n\tif (loc) {\n\t\tlocation = `near ${loc.file}:${loc.line}:${loc.column}`;\n\t} else if (dev_current_component_function?.[FILENAME]) {\n\t\tlocation = `in ${dev_current_component_function[FILENAME]}`;\n\t}\n\n\tw.hydration_html_changed(sanitize_location(location));\n}\n\n/**\n * @param {Element | Text | Comment} node\n * @param {() => string | TrustedHTML} get_value\n * @param {boolean} [is_controlled]\n * @param {boolean} [svg]\n * @param {boolean} [mathml]\n * @param {boolean} [skip_warning]\n * @returns {void}\n */\nexport function html(\n\tnode,\n\tget_value,\n\tis_controlled = false,\n\tsvg = false,\n\tmathml = false,\n\tskip_warning = false\n) {\n\tvar anchor = node;\n\n\t/** @type {string | TrustedHTML} */\n\tvar value = '';\n\n\tif (is_controlled) {\n\t\tvar parent_node = /** @type {Element} */ (node);\n\n\t\tif (hydrating) {\n\t\t\tanchor = set_hydrate_node(get_first_child(parent_node));\n\t\t}\n\t}\n\n\ttemplate_effect(() => {\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\tif (value === (value = get_value() ?? '')) {\n\t\t\tif (hydrating) hydrate_next();\n\t\t\treturn;\n\t\t}\n\n\t\tif (is_controlled && !hydrating) {\n\t\t\t// When @html is the only child, use innerHTML directly.\n\t\t\t// This also handles contenteditable, where the user may delete the anchor comment.\n\t\t\teffect.nodes = null;\n\t\t\tparent_node.innerHTML = /** @type {string} */ (value);\n\n\t\t\tif (value !== '') {\n\t\t\t\tassign_nodes(\n\t\t\t\t\t/** @type {TemplateNode} */ (get_first_child(parent_node)),\n\t\t\t\t\t/** @type {TemplateNode} */ (parent_node.lastChild)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (effect.nodes !== null) {\n\t\t\tremove_effect_dom(effect.nodes.start, /** @type {TemplateNode} */ (effect.nodes.end));\n\t\t\teffect.nodes = null;\n\t\t}\n\n\t\tif (value === '') return;\n\n\t\tif (hydrating) {\n\t\t\t// We're deliberately not trying to repair mismatches between server and client,\n\t\t\t// as it's costly and error-prone (and it's an edge case to have a mismatch anyway)\n\t\t\tvar hash = /** @type {Comment} */ (hydrate_node).data;\n\n\t\t\t/** @type {TemplateNode | null} */\n\t\t\tvar next = hydrate_next();\n\t\t\tvar last = next;\n\n\t\t\twhile (\n\t\t\t\tnext !== null &&\n\t\t\t\t(next.nodeType !== COMMENT_NODE || /** @type {Comment} */ (next).data !== '')\n\t\t\t) {\n\t\t\t\tlast = next;\n\t\t\t\tnext = get_next_sibling(next);\n\t\t\t}\n\n\t\t\tif (next === null) {\n\t\t\t\tw.hydration_mismatch();\n\t\t\t\tthrow HYDRATION_ERROR;\n\t\t\t}\n\n\t\t\tif (DEV && !skip_warning) {\n\t\t\t\tcheck_hash(/** @type {Element} */ (next.parentNode), hash, value);\n\t\t\t}\n\n\t\t\tassign_nodes(hydrate_node, last);\n\t\t\tanchor = set_hydrate_node(next);\n\t\t\treturn;\n\t\t}\n\n\t\t// Don't use create_fragment_with_script_from_html here because that would mean script tags are executed.\n\t\t// @html is basically `.innerHTML = ...` and that doesn't execute scripts either due to security reasons.\n\t\t// Use a <template>, <svg>, or <math> wrapper depending on context. If value is a TrustedHTML object,\n\t\t// it will be assigned directly to innerHTML without coercion — this allows {@html policy.createHTML(...)} to work.\n\t\tvar ns = svg ? NAMESPACE_SVG : mathml ? NAMESPACE_MATHML : undefined;\n\t\tvar wrapper = /** @type {HTMLTemplateElement | SVGElement | MathMLElement} */ (\n\t\t\tcreate_element(svg ? 'svg' : mathml ? 'math' : 'template', ns)\n\t\t);\n\t\twrapper.innerHTML = /** @type {any} */ (value);\n\n\t\t/** @type {DocumentFragment | Element} */\n\t\tvar node = svg || mathml ? wrapper : /** @type {HTMLTemplateElement} */ (wrapper).content;\n\n\t\tassign_nodes(\n\t\t\t/** @type {TemplateNode} */ (get_first_child(node)),\n\t\t\t/** @type {TemplateNode} */ (node.lastChild)\n\t\t);\n\n\t\tif (svg || mathml) {\n\t\t\twhile (get_first_child(node)) {\n\t\t\t\tanchor.before(/** @type {TemplateNode} */ (get_first_child(node)));\n\t\t\t}\n\t\t} else {\n\t\t\tanchor.before(node);\n\t\t}\n\t});\n}\n","import { DEV } from 'esm-env';\nimport { register_style } from '../dev/css.js';\nimport { effect } from '../reactivity/effects.js';\nimport { create_element } from './operations.js';\n\n/**\n * @param {Node} anchor\n * @param {{ hash: string, code: string }} css\n */\nexport function append_styles(anchor, css) {\n\t// Use `queue_micro_task` to ensure `anchor` is in the DOM, otherwise getRootNode() will yield wrong results\n\teffect(() => {\n\t\tvar root = anchor.getRootNode();\n\n\t\tvar target = /** @type {ShadowRoot} */ (root).host\n\t\t\t? /** @type {ShadowRoot} */ (root)\n\t\t\t: /** @type {Document} */ (root).head ?? /** @type {Document} */ (root.ownerDocument).head;\n\n\t\t// Always querying the DOM is roughly the same perf as additionally checking for presence in a map first assuming\n\t\t// that you'll get cache hits half of the time, so we just always query the dom for simplicity and code savings.\n\t\tif (!target.querySelector('#' + css.hash)) {\n\t\t\tconst style = create_element('style');\n\t\t\tstyle.id = css.hash;\n\t\t\tstyle.textContent = css.code;\n\n\t\t\ttarget.appendChild(style);\n\n\t\t\tif (DEV) {\n\t\t\t\tregister_style(css.hash, style);\n\t\t\t}\n\t\t}\n\t});\n}\n","/** @import { ActionPayload } from '#client' */\nimport { effect, render_effect } from '../../reactivity/effects.js';\nimport { safe_not_equal } from '../../reactivity/equality.js';\nimport { deep_read_state, untrack } from '../../runtime.js';\n\n/**\n * @template P\n * @param {Element} dom\n * @param {(dom: Element, value?: P) => ActionPayload<P>} action\n * @param {() => P} [get_value]\n * @returns {void}\n */\nexport function action(dom, action, get_value) {\n\teffect(() => {\n\t\tvar payload = untrack(() => action(dom, get_value?.()) || {});\n\n\t\tif (get_value && payload?.update) {\n\t\t\tvar inited = false;\n\t\t\t/** @type {P} */\n\t\t\tvar prev = /** @type {any} */ ({}); // initialize with something so it's never equal on first run\n\n\t\t\trender_effect(() => {\n\t\t\t\tvar value = get_value();\n\n\t\t\t\t// Action's update method is coarse-grained, i.e. when anything in the passed value changes, update.\n\t\t\t\t// This works in legacy mode because of mutable_source being updated as a whole, but when using $state\n\t\t\t\t// together with actions and mutation, it wouldn't notice the change without a deep read.\n\t\t\t\tdeep_read_state(value);\n\n\t\t\t\tif (inited && safe_not_equal(prev, value)) {\n\t\t\t\t\tprev = value;\n\t\t\t\t\t/** @type {Function} */ (payload.update)(value);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tinited = true;\n\t\t}\n\n\t\tif (payload?.destroy) {\n\t\t\treturn () => /** @type {Function} */ (payload.destroy)();\n\t\t}\n\t});\n}\n","import { escape_html } from '../../escaping.js';\nimport { clsx as _clsx } from 'clsx';\nimport { has_own_property } from './utils.js';\n\n/**\n * `<div translate={false}>` should be rendered as `<div translate=\"no\">` and _not_\n * `<div translate=\"false\">`, which is equivalent to `<div translate=\"yes\">`. There\n * may be other odd cases that need to be added to this list in future\n * @type {Record<string, Map<any, string>>}\n */\nconst replacements = {\n\ttranslate: new Map([\n\t\t[true, 'yes'],\n\t\t[false, 'no']\n\t])\n};\n\n/**\n * @template V\n * @param {string} name\n * @param {V} value\n * @param {boolean} [is_boolean]\n * @returns {string}\n */\nexport function attr(name, value, is_boolean = false) {\n\t// attribute hidden for values other than \"until-found\" behaves like a boolean attribute\n\tif (name === 'hidden' && value !== 'until-found') {\n\t\tis_boolean = true;\n\t}\n\tif (value == null || (!value && is_boolean)) return '';\n\tconst normalized =\n\t\t(has_own_property.call(replacements, name) && replacements[name].get(value)) || value;\n\tconst assignment = is_boolean ? `=\"\"` : `=\"${escape_html(normalized, true)}\"`;\n\treturn ` ${name}${assignment}`;\n}\n\n/**\n * Small wrapper around clsx to preserve Svelte's (weird) handling of falsy values.\n * TODO Svelte 6 revisit this, and likely turn all falsy values into the empty string (what clsx also does)\n * @param {any} value\n */\nexport function clsx(value) {\n\tif (typeof value === 'object') {\n\t\treturn _clsx(value);\n\t} else {\n\t\treturn value ?? '';\n\t}\n}\n\nconst whitespace = [...' \\t\\n\\r\\f\\u00a0\\u000b\\ufeff'];\n\n/**\n * @param {any} value\n * @param {string | null} [hash]\n * @param {Record<string, boolean>} [directives]\n * @returns {string | null}\n */\nexport function to_class(value, hash, directives) {\n\tvar classname = value == null ? '' : '' + value;\n\n\tif (hash) {\n\t\tclassname = classname ? classname + ' ' + hash : hash;\n\t}\n\n\tif (directives) {\n\t\tfor (var key of Object.keys(directives)) {\n\t\t\tif (directives[key]) {\n\t\t\t\tclassname = classname ? classname + ' ' + key : key;\n\t\t\t} else if (classname.length) {\n\t\t\t\tvar len = key.length;\n\t\t\t\tvar a = 0;\n\n\t\t\t\twhile ((a = classname.indexOf(key, a)) >= 0) {\n\t\t\t\t\tvar b = a + len;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t(a === 0 || whitespace.includes(classname[a - 1])) &&\n\t\t\t\t\t\t(b === classname.length || whitespace.includes(classname[b]))\n\t\t\t\t\t) {\n\t\t\t\t\t\tclassname = (a === 0 ? '' : classname.substring(0, a)) + classname.substring(b + 1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ta = b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn classname === '' ? null : classname;\n}\n\n/**\n *\n * @param {Record<string,any>} styles\n * @param {boolean} important\n */\nfunction append_styles(styles, important = false) {\n\tvar separator = important ? ' !important;' : ';';\n\tvar css = '';\n\n\tfor (var key of Object.keys(styles)) {\n\t\tvar value = styles[key];\n\t\tif (value != null && value !== '') {\n\t\t\tcss += ' ' + key + ': ' + value + separator;\n\t\t}\n\t}\n\n\treturn css;\n}\n\n/**\n * @param {string} name\n * @returns {string}\n */\nfunction to_css_name(name) {\n\tif (name[0] !== '-' || name[1] !== '-') {\n\t\treturn name.toLowerCase();\n\t}\n\treturn name;\n}\n\n/**\n * @param {any} value\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [styles]\n * @returns {string | null}\n */\nexport function to_style(value, styles) {\n\tif (styles) {\n\t\tvar new_style = '';\n\n\t\t/** @type {Record<string,any> | undefined} */\n\t\tvar normal_styles;\n\n\t\t/** @type {Record<string,any> | undefined} */\n\t\tvar important_styles;\n\n\t\tif (Array.isArray(styles)) {\n\t\t\tnormal_styles = styles[0];\n\t\t\timportant_styles = styles[1];\n\t\t} else {\n\t\t\tnormal_styles = styles;\n\t\t}\n\n\t\tif (value) {\n\t\t\tvalue = String(value)\n\t\t\t\t.replaceAll(/\\s*\\/\\*.*?\\*\\/\\s*/g, '')\n\t\t\t\t.trim();\n\n\t\t\t/** @type {boolean | '\"' | \"'\"} */\n\t\t\tvar in_str = false;\n\t\t\tvar in_apo = 0;\n\t\t\tvar in_comment = false;\n\n\t\t\tvar reserved_names = [];\n\n\t\t\tif (normal_styles) {\n\t\t\t\treserved_names.push(...Object.keys(normal_styles).map(to_css_name));\n\t\t\t}\n\t\t\tif (important_styles) {\n\t\t\t\treserved_names.push(...Object.keys(important_styles).map(to_css_name));\n\t\t\t}\n\n\t\t\tvar start_index = 0;\n\t\t\tvar name_index = -1;\n\n\t\t\tconst len = value.length;\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tvar c = value[i];\n\n\t\t\t\tif (in_comment) {\n\t\t\t\t\tif (c === '/' && value[i - 1] === '*') {\n\t\t\t\t\t\tin_comment = false;\n\t\t\t\t\t}\n\t\t\t\t} else if (in_str) {\n\t\t\t\t\tif (in_str === c) {\n\t\t\t\t\t\tin_str = false;\n\t\t\t\t\t}\n\t\t\t\t} else if (c === '/' && value[i + 1] === '*') {\n\t\t\t\t\tin_comment = true;\n\t\t\t\t} else if (c === '\"' || c === \"'\") {\n\t\t\t\t\tin_str = c;\n\t\t\t\t} else if (c === '(') {\n\t\t\t\t\tin_apo++;\n\t\t\t\t} else if (c === ')') {\n\t\t\t\t\tin_apo--;\n\t\t\t\t}\n\n\t\t\t\tif (!in_comment && in_str === false && in_apo === 0) {\n\t\t\t\t\tif (c === ':' && name_index === -1) {\n\t\t\t\t\t\tname_index = i;\n\t\t\t\t\t} else if (c === ';' || i === len - 1) {\n\t\t\t\t\t\tif (name_index !== -1) {\n\t\t\t\t\t\t\tvar name = to_css_name(value.substring(start_index, name_index).trim());\n\n\t\t\t\t\t\t\tif (!reserved_names.includes(name)) {\n\t\t\t\t\t\t\t\tif (c !== ';') {\n\t\t\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvar property = value.substring(start_index, i).trim();\n\t\t\t\t\t\t\t\tnew_style += ' ' + property + ';';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstart_index = i + 1;\n\t\t\t\t\t\tname_index = -1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (normal_styles) {\n\t\t\tnew_style += append_styles(normal_styles);\n\t\t}\n\n\t\tif (important_styles) {\n\t\t\tnew_style += append_styles(important_styles, true);\n\t\t}\n\n\t\tnew_style = new_style.trim();\n\t\treturn new_style === '' ? null : new_style;\n\t}\n\n\treturn value == null ? null : String(value);\n}\n","import { to_class } from '../../../shared/attributes.js';\nimport { hydrating } from '../hydration.js';\n\n/**\n * @param {Element} dom\n * @param {boolean | number} is_html\n * @param {string | null} value\n * @param {string} [hash]\n * @param {Record<string, any>} [prev_classes]\n * @param {Record<string, any>} [next_classes]\n * @returns {Record<string, boolean> | undefined}\n */\nexport function set_class(dom, is_html, value, hash, prev_classes, next_classes) {\n\t// @ts-expect-error need to add __className to patched prototype\n\tvar prev = dom.__className;\n\n\tif (\n\t\thydrating ||\n\t\tprev !== value ||\n\t\tprev === undefined // for edge case of `class={undefined}`\n\t) {\n\t\tvar next_class_name = to_class(value, hash, next_classes);\n\n\t\tif (!hydrating || next_class_name !== dom.getAttribute('class')) {\n\t\t\t// Removing the attribute when the value is only an empty string causes\n\t\t\t// performance issues vs simply making the className an empty string. So\n\t\t\t// we should only remove the class if the value is nullish\n\t\t\t// and there no hash/directives :\n\t\t\tif (next_class_name == null) {\n\t\t\t\tdom.removeAttribute('class');\n\t\t\t} else if (is_html) {\n\t\t\t\tdom.className = next_class_name;\n\t\t\t} else {\n\t\t\t\tdom.setAttribute('class', next_class_name);\n\t\t\t}\n\t\t}\n\n\t\t// @ts-expect-error need to add __className to patched prototype\n\t\tdom.__className = value;\n\t} else if (next_classes && prev_classes !== next_classes) {\n\t\tfor (var key in next_classes) {\n\t\t\tvar is_present = !!next_classes[key];\n\n\t\t\tif (prev_classes == null || is_present !== !!prev_classes[key]) {\n\t\t\t\tdom.classList.toggle(key, is_present);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn next_classes;\n}\n","import { to_style } from '../../../shared/attributes.js';\nimport { hydrating } from '../hydration.js';\n\n/**\n * @param {Element & ElementCSSInlineStyle} dom\n * @param {Record<string, any>} prev\n * @param {Record<string, any>} next\n * @param {string} [priority]\n */\nfunction update_styles(dom, prev = {}, next, priority) {\n\tfor (var key in next) {\n\t\tvar value = next[key];\n\n\t\tif (prev[key] !== value) {\n\t\t\tif (next[key] == null) {\n\t\t\t\tdom.style.removeProperty(key);\n\t\t\t} else {\n\t\t\t\tdom.style.setProperty(key, value, priority);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} dom\n * @param {string | null} value\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [prev_styles]\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [next_styles]\n */\nexport function set_style(dom, value, prev_styles, next_styles) {\n\t// @ts-expect-error\n\tvar prev = dom.__style;\n\n\tif (hydrating || prev !== value) {\n\t\tvar next_style_attr = to_style(value, next_styles);\n\n\t\tif (!hydrating || next_style_attr !== dom.getAttribute('style')) {\n\t\t\tif (next_style_attr == null) {\n\t\t\t\tdom.removeAttribute('style');\n\t\t\t} else {\n\t\t\t\tdom.style.cssText = next_style_attr;\n\t\t\t}\n\t\t}\n\n\t\t// @ts-expect-error\n\t\tdom.__style = value;\n\t} else if (next_styles) {\n\t\tif (Array.isArray(next_styles)) {\n\t\t\tupdate_styles(dom, prev_styles?.[0], next_styles[0]);\n\t\t\tupdate_styles(dom, prev_styles?.[1], next_styles[1], 'important');\n\t\t} else {\n\t\t\tupdate_styles(dom, prev_styles, next_styles);\n\t\t}\n\t}\n\n\treturn next_styles;\n}\n","/** @import { Blocker, Effect } from '#client' */\nimport { DEV } from 'esm-env';\nimport { hydrating, set_hydrating } from '../hydration.js';\nimport { get_descriptors, get_prototype_of } from '../../../shared/utils.js';\nimport { create_event, delegate, delegated, event, event_symbol } from './events.js';\nimport { add_form_reset_listener, autofocus } from './misc.js';\nimport * as w from '../../warnings.js';\nimport { IS_XHTML, LOADING_ATTR_SYMBOL } from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { is_capture_event, can_delegate_event, normalize_attribute } from '../../../../utils.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport { attach } from './attachments.js';\nimport { clsx } from '../../../shared/attributes.js';\nimport { set_class } from './class.js';\nimport { set_style } from './style.js';\nimport { ATTACHMENT_KEY, NAMESPACE_HTML, UNINITIALIZED } from '../../../../constants.js';\nimport { branch, destroy_effect, effect, managed } from '../../reactivity/effects.js';\nimport { init_select, select_option } from './bindings/select.js';\nimport { flatten } from '../../reactivity/async.js';\n\nexport const CLASS = Symbol('class');\nexport const STYLE = Symbol('style');\n\nconst IS_CUSTOM_ELEMENT = Symbol('is custom element');\nconst IS_HTML = Symbol('is html');\n\nconst LINK_TAG = IS_XHTML ? 'link' : 'LINK';\nconst INPUT_TAG = IS_XHTML ? 'input' : 'INPUT';\nconst OPTION_TAG = IS_XHTML ? 'option' : 'OPTION';\nconst SELECT_TAG = IS_XHTML ? 'select' : 'SELECT';\nconst PROGRESS_TAG = IS_XHTML ? 'progress' : 'PROGRESS';\n\n/**\n * The value/checked attribute in the template actually corresponds to the defaultValue property, so we need\n * to remove it upon hydration to avoid a bug when someone resets the form value.\n * @param {HTMLInputElement} input\n * @returns {void}\n */\nexport function remove_input_defaults(input) {\n\tif (!hydrating) return;\n\n\tvar already_removed = false;\n\n\t// We try and remove the default attributes later, rather than sync during hydration.\n\t// Doing it sync during hydration has a negative impact on performance, but deferring the\n\t// work in an idle task alleviates this greatly. If a form reset event comes in before\n\t// the idle callback, then we ensure the input defaults are cleared just before.\n\tvar remove_defaults = () => {\n\t\tif (already_removed) return;\n\t\talready_removed = true;\n\n\t\t// Remove the attributes but preserve the values\n\t\tif (input.hasAttribute('value')) {\n\t\t\tvar value = input.value;\n\t\t\tset_attribute(input, 'value', null);\n\t\t\tinput.value = value;\n\t\t}\n\n\t\tif (input.hasAttribute('checked')) {\n\t\t\tvar checked = input.checked;\n\t\t\tset_attribute(input, 'checked', null);\n\t\t\tinput.checked = checked;\n\t\t}\n\t};\n\n\t// @ts-expect-error\n\tinput.__on_r = remove_defaults;\n\tqueue_micro_task(remove_defaults);\n\tadd_form_reset_listener();\n}\n\n/**\n * @param {Element} element\n * @param {any} value\n */\nexport function set_value(element, value) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.value ===\n\t\t\t(attributes.value =\n\t\t\t\t// treat null and undefined the same for the initial value\n\t\t\t\tvalue ?? undefined) ||\n\t\t// @ts-expect-error\n\t\t// `progress` elements always need their value set when it's `0`\n\t\t(element.value === value && (value !== 0 || element.nodeName !== PROGRESS_TAG))\n\t) {\n\t\treturn;\n\t}\n\n\t// @ts-expect-error\n\telement.value = value ?? '';\n}\n\n/**\n * @param {Element} element\n * @param {boolean} checked\n */\nexport function set_checked(element, checked) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.checked ===\n\t\t(attributes.checked =\n\t\t\t// treat null and undefined the same for the initial value\n\t\t\tchecked ?? undefined)\n\t) {\n\t\treturn;\n\t}\n\n\t// @ts-expect-error\n\telement.checked = checked;\n}\n\n/**\n * Sets the `selected` attribute on an `option` element.\n * Not set through the property because that doesn't reflect to the DOM,\n * which means it wouldn't be taken into account when a form is reset.\n * @param {HTMLOptionElement} element\n * @param {boolean} selected\n */\nexport function set_selected(element, selected) {\n\tif (selected) {\n\t\t// The selected option could've changed via user selection, and\n\t\t// setting the value without this check would set it back.\n\t\tif (!element.hasAttribute('selected')) {\n\t\t\telement.setAttribute('selected', '');\n\t\t}\n\t} else {\n\t\telement.removeAttribute('selected');\n\t}\n}\n\n/**\n * Applies the default checked property without influencing the current checked property.\n * @param {HTMLInputElement} element\n * @param {boolean} checked\n */\nexport function set_default_checked(element, checked) {\n\tconst existing_value = element.checked;\n\telement.defaultChecked = checked;\n\telement.checked = existing_value;\n}\n\n/**\n * Applies the default value property without influencing the current value property.\n * @param {HTMLInputElement | HTMLTextAreaElement} element\n * @param {string} value\n */\nexport function set_default_value(element, value) {\n\tconst existing_value = element.value;\n\telement.defaultValue = value;\n\telement.value = existing_value;\n}\n\n/**\n * @param {Element} element\n * @param {string} attribute\n * @param {string | null} value\n * @param {boolean} [skip_warning]\n */\nexport function set_attribute(element, attribute, value, skip_warning) {\n\tvar attributes = get_attributes(element);\n\n\tif (hydrating) {\n\t\tattributes[attribute] = element.getAttribute(attribute);\n\n\t\tif (\n\t\t\tattribute === 'src' ||\n\t\t\tattribute === 'srcset' ||\n\t\t\t(attribute === 'href' && element.nodeName === LINK_TAG)\n\t\t) {\n\t\t\tif (!skip_warning) {\n\t\t\t\tcheck_src_in_dev_hydration(element, attribute, value ?? '');\n\t\t\t}\n\n\t\t\t// If we reset these attributes, they would result in another network request, which we want to avoid.\n\t\t\t// We assume they are the same between client and server as checking if they are equal is expensive\n\t\t\t// (we can't just compare the strings as they can be different between client and server but result in the\n\t\t\t// same url, so we would need to create hidden anchor elements to compare them)\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (attributes[attribute] === (attributes[attribute] = value)) return;\n\n\tif (attribute === 'loading') {\n\t\t// @ts-expect-error\n\t\telement[LOADING_ATTR_SYMBOL] = value;\n\t}\n\n\tif (value == null) {\n\t\telement.removeAttribute(attribute);\n\t} else if (typeof value !== 'string' && get_setters(element).includes(attribute)) {\n\t\t// @ts-ignore\n\t\telement[attribute] = value;\n\t} else {\n\t\telement.setAttribute(attribute, value);\n\t}\n}\n\n/**\n * @param {Element} dom\n * @param {string} attribute\n * @param {string} value\n */\nexport function set_xlink_attribute(dom, attribute, value) {\n\tdom.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\n\n/**\n * @param {HTMLElement} node\n * @param {string} prop\n * @param {any} value\n */\nexport function set_custom_element_data(node, prop, value) {\n\t// We need to ensure that setting custom element props, which can\n\t// invoke lifecycle methods on other custom elements, does not also\n\t// associate those lifecycle methods with the current active reaction\n\t// or effect\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet was_hydrating = hydrating;\n\tif (hydrating) {\n\t\tset_hydrating(false);\n\t}\n\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\n\ttry {\n\t\tif (\n\t\t\t// `style` should use `set_attribute` rather than the setter\n\t\t\tprop !== 'style' &&\n\t\t\t// Don't compute setters for custom elements while they aren't registered yet,\n\t\t\t// because during their upgrade/instantiation they might add more setters.\n\t\t\t// Instead, fall back to a simple \"an object, then set as property\" heuristic.\n\t\t\t(setters_cache.has(node.getAttribute('is') || node.nodeName) ||\n\t\t\t// customElements may not be available in browser extension contexts\n\t\t\t!customElements ||\n\t\t\tcustomElements.get(node.getAttribute('is') || node.nodeName.toLowerCase())\n\t\t\t\t? get_setters(node).includes(prop)\n\t\t\t\t: value && typeof value === 'object')\n\t\t) {\n\t\t\t// @ts-expect-error\n\t\t\tnode[prop] = value;\n\t\t} else {\n\t\t\t// We did getters etc checks already, stringify before passing to set_attribute\n\t\t\t// to ensure it doesn't invoke the same logic again, and potentially populating\n\t\t\t// the setters cache too early.\n\t\t\tset_attribute(node, prop, value == null ? value : String(value));\n\t\t}\n\t} finally {\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t\tif (was_hydrating) {\n\t\t\tset_hydrating(true);\n\t\t}\n\t}\n}\n\n/**\n * Spreads attributes onto a DOM element, taking into account the currently set attributes\n * @param {Element & ElementCSSInlineStyle} element\n * @param {Record<string | symbol, any> | undefined} prev\n * @param {Record<string | symbol, any>} next New attributes - this function mutates this object\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n * @returns {Record<string, any>}\n */\nfunction set_attributes(\n\telement,\n\tprev,\n\tnext,\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tif (hydrating && should_remove_defaults && element.nodeName === INPUT_TAG) {\n\t\tvar input = /** @type {HTMLInputElement} */ (element);\n\t\tvar attribute = input.type === 'checkbox' ? 'defaultChecked' : 'defaultValue';\n\n\t\tif (!(attribute in next)) {\n\t\t\tremove_input_defaults(input);\n\t\t}\n\t}\n\n\tvar attributes = get_attributes(element);\n\n\tvar is_custom_element = attributes[IS_CUSTOM_ELEMENT];\n\tvar preserve_attribute_case = !attributes[IS_HTML];\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet is_hydrating_custom_element = hydrating && is_custom_element;\n\tif (is_hydrating_custom_element) {\n\t\tset_hydrating(false);\n\t}\n\n\tvar current = prev || {};\n\tvar is_option_element = element.nodeName === OPTION_TAG;\n\n\tfor (var key in prev) {\n\t\tif (!(key in next)) {\n\t\t\tnext[key] = null;\n\t\t}\n\t}\n\n\tif (next.class) {\n\t\tnext.class = clsx(next.class);\n\t} else if (css_hash || next[CLASS]) {\n\t\tnext.class = null; /* force call to set_class() */\n\t}\n\n\tif (next[STYLE]) {\n\t\tnext.style ??= null; /* force call to set_style() */\n\t}\n\n\tvar setters = get_setters(element);\n\n\t// since key is captured we use const\n\tfor (const key in next) {\n\t\t// let instead of var because referenced in a closure\n\t\tlet value = next[key];\n\n\t\t// Up here because we want to do this for the initial value, too, even if it's undefined,\n\t\t// and this wouldn't be reached in case of undefined because of the equality check below\n\t\tif (is_option_element && key === 'value' && value == null) {\n\t\t\t// The <option> element is a special case because removing the value attribute means\n\t\t\t// the value is set to the text content of the option element, and setting the value\n\t\t\t// to null or undefined means the value is set to the string \"null\" or \"undefined\".\n\t\t\t// To align with how we handle this case in non-spread-scenarios, this logic is needed.\n\t\t\t// There's a super-edge-case bug here that is left in in favor of smaller code size:\n\t\t\t// Because of the \"set missing props to null\" logic above, we can't differentiate\n\t\t\t// between a missing value and an explicitly set value of null or undefined. That means\n\t\t\t// that once set, the value attribute of an <option> element can't be removed. This is\n\t\t\t// a very rare edge case, and removing the attribute altogether isn't possible either\n\t\t\t// for the <option value={undefined}> case, so we're not losing any functionality here.\n\t\t\t// @ts-ignore\n\t\t\telement.value = element.__value = '';\n\t\t\tcurrent[key] = value;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (key === 'class') {\n\t\t\tvar is_html = element.namespaceURI === 'http://www.w3.org/1999/xhtml';\n\t\t\tset_class(element, is_html, value, css_hash, prev?.[CLASS], next[CLASS]);\n\t\t\tcurrent[key] = value;\n\t\t\tcurrent[CLASS] = next[CLASS];\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (key === 'style') {\n\t\t\tset_style(element, value, prev?.[STYLE], next[STYLE]);\n\t\t\tcurrent[key] = value;\n\t\t\tcurrent[STYLE] = next[STYLE];\n\t\t\tcontinue;\n\t\t}\n\n\t\tvar prev_value = current[key];\n\n\t\t// Skip if value is unchanged, unless it's `undefined` and the element still has the attribute\n\t\tif (value === prev_value && !(value === undefined && element.hasAttribute(key))) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tcurrent[key] = value;\n\n\t\tvar prefix = key[0] + key[1]; // this is faster than key.slice(0, 2)\n\t\tif (prefix === '$$') continue;\n\n\t\tif (prefix === 'on') {\n\t\t\t/** @type {{ capture?: true }} */\n\t\t\tconst opts = {};\n\t\t\tconst event_handle_key = '$$' + key;\n\t\t\tlet event_name = key.slice(2);\n\t\t\tvar is_delegated = can_delegate_event(event_name);\n\n\t\t\tif (is_capture_event(event_name)) {\n\t\t\t\tevent_name = event_name.slice(0, -7);\n\t\t\t\topts.capture = true;\n\t\t\t}\n\n\t\t\tif (!is_delegated && prev_value) {\n\t\t\t\t// Listening to same event but different handler -> our handle function below takes care of this\n\t\t\t\t// If we were to remove and add listeners in this case, it could happen that the event is \"swallowed\"\n\t\t\t\t// (the browser seems to not know yet that a new one exists now) and doesn't reach the handler\n\t\t\t\t// https://github.com/sveltejs/svelte/issues/11903\n\t\t\t\tif (value != null) continue;\n\n\t\t\t\telement.removeEventListener(event_name, current[event_handle_key], opts);\n\t\t\t\tcurrent[event_handle_key] = null;\n\t\t\t}\n\n\t\t\tif (is_delegated) {\n\t\t\t\tdelegated(event_name, element, value);\n\t\t\t\tdelegate([event_name]);\n\t\t\t} else if (value != null) {\n\t\t\t\t/**\n\t\t\t\t * @this {any}\n\t\t\t\t * @param {Event} evt\n\t\t\t\t */\n\t\t\t\tfunction handle(evt) {\n\t\t\t\t\tcurrent[key].call(this, evt);\n\t\t\t\t}\n\n\t\t\t\tcurrent[event_handle_key] = create_event(event_name, element, handle, opts);\n\t\t\t}\n\t\t} else if (key === 'style') {\n\t\t\t// avoid using the setter\n\t\t\tset_attribute(element, key, value);\n\t\t} else if (key === 'autofocus') {\n\t\t\tautofocus(/** @type {HTMLElement} */ (element), Boolean(value));\n\t\t} else if (!is_custom_element && (key === '__value' || (key === 'value' && value != null))) {\n\t\t\t// @ts-ignore We're not running this for custom elements because __value is actually\n\t\t\t// how Lit stores the current value on the element, and messing with that would break things.\n\t\t\telement.value = element.__value = value;\n\t\t} else if (key === 'selected' && is_option_element) {\n\t\t\tset_selected(/** @type {HTMLOptionElement} */ (element), value);\n\t\t} else {\n\t\t\tvar name = key;\n\t\t\tif (!preserve_attribute_case) {\n\t\t\t\tname = normalize_attribute(name);\n\t\t\t}\n\n\t\t\tvar is_default = name === 'defaultValue' || name === 'defaultChecked';\n\n\t\t\tif (value == null && !is_custom_element && !is_default) {\n\t\t\t\tattributes[key] = null;\n\n\t\t\t\tif (name === 'value' || name === 'checked') {\n\t\t\t\t\t// removing value/checked also removes defaultValue/defaultChecked — preserve\n\t\t\t\t\tlet input = /** @type {HTMLInputElement} */ (element);\n\t\t\t\t\tconst use_default = prev === undefined;\n\t\t\t\t\tif (name === 'value') {\n\t\t\t\t\t\tlet previous = input.defaultValue;\n\t\t\t\t\t\tinput.removeAttribute(name);\n\t\t\t\t\t\tinput.defaultValue = previous;\n\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\tinput.value = input.__value = use_default ? previous : null;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet previous = input.defaultChecked;\n\t\t\t\t\t\tinput.removeAttribute(name);\n\t\t\t\t\t\tinput.defaultChecked = previous;\n\t\t\t\t\t\tinput.checked = use_default ? previous : false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\telement.removeAttribute(key);\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tis_default ||\n\t\t\t\t(setters.includes(name) && (is_custom_element || typeof value !== 'string'))\n\t\t\t) {\n\t\t\t\t// @ts-ignore\n\t\t\t\telement[name] = value;\n\t\t\t\t// remove it from attributes's cache\n\t\t\t\tif (name in attributes) attributes[name] = UNINITIALIZED;\n\t\t\t} else if (typeof value !== 'function') {\n\t\t\t\tset_attribute(element, name, value, skip_warning);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (is_hydrating_custom_element) {\n\t\tset_hydrating(true);\n\t}\n\n\treturn current;\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} element\n * @param {(...expressions: any) => Record<string | symbol, any>} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n */\nexport function attribute_effect(\n\telement,\n\tfn,\n\tsync = [],\n\tasync = [],\n\tblockers = [],\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tflatten(blockers, sync, async, (values) => {\n\t\t/** @type {Record<string | symbol, any> | undefined} */\n\t\tvar prev = undefined;\n\n\t\t/** @type {Record<symbol, Effect>} */\n\t\tvar effects = {};\n\n\t\tvar is_select = element.nodeName === SELECT_TAG;\n\t\tvar inited = false;\n\n\t\tmanaged(() => {\n\t\t\tvar next = fn(...values.map(get));\n\t\t\t/** @type {Record<string | symbol, any>} */\n\t\t\tvar current = set_attributes(\n\t\t\t\telement,\n\t\t\t\tprev,\n\t\t\t\tnext,\n\t\t\t\tcss_hash,\n\t\t\t\tshould_remove_defaults,\n\t\t\t\tskip_warning\n\t\t\t);\n\n\t\t\tif (inited && is_select && 'value' in next) {\n\t\t\t\tselect_option(/** @type {HTMLSelectElement} */ (element), next.value);\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(effects)) {\n\t\t\t\tif (!next[symbol]) destroy_effect(effects[symbol]);\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(next)) {\n\t\t\t\tvar n = next[symbol];\n\n\t\t\t\tif (symbol.description === ATTACHMENT_KEY && (!prev || n !== prev[symbol])) {\n\t\t\t\t\tif (effects[symbol]) destroy_effect(effects[symbol]);\n\t\t\t\t\teffects[symbol] = branch(() => attach(element, () => n));\n\t\t\t\t}\n\n\t\t\t\tcurrent[symbol] = n;\n\t\t\t}\n\n\t\t\tprev = current;\n\t\t});\n\n\t\tif (is_select) {\n\t\t\tvar select = /** @type {HTMLSelectElement} */ (element);\n\n\t\t\teffect(() => {\n\t\t\t\tselect_option(select, /** @type {Record<string | symbol, any>} */ (prev).value, true);\n\t\t\t\tinit_select(select);\n\t\t\t});\n\t\t}\n\n\t\tinited = true;\n\t});\n}\n\n/**\n *\n * @param {Element} element\n */\nfunction get_attributes(element) {\n\treturn /** @type {Record<string | symbol, unknown>} **/ (\n\t\t// @ts-expect-error\n\t\telement.__attributes ??= {\n\t\t\t[IS_CUSTOM_ELEMENT]: element.nodeName.includes('-'),\n\t\t\t[IS_HTML]: element.namespaceURI === NAMESPACE_HTML\n\t\t}\n\t);\n}\n\n/** @type {Map<string, string[]>} */\nvar setters_cache = new Map();\n\n/** @param {Element} element */\nfunction get_setters(element) {\n\tvar cache_key = element.getAttribute('is') || element.nodeName;\n\tvar setters = setters_cache.get(cache_key);\n\tif (setters) return setters;\n\tsetters_cache.set(cache_key, (setters = []));\n\n\tvar descriptors;\n\tvar proto = element; // In the case of custom elements there might be setters on the instance\n\tvar element_proto = Element.prototype;\n\n\t// Stop at Element, from there on there's only unnecessary setters we're not interested in\n\t// Do not use contructor.name here as that's unreliable in some browser environments\n\twhile (element_proto !== proto) {\n\t\tdescriptors = get_descriptors(proto);\n\n\t\tfor (var key in descriptors) {\n\t\t\tif (descriptors[key].set) {\n\t\t\t\tsetters.push(key);\n\t\t\t}\n\t\t}\n\n\t\tproto = get_prototype_of(proto);\n\t}\n\n\treturn setters;\n}\n\n/**\n * @param {any} element\n * @param {string} attribute\n * @param {string} value\n */\nfunction check_src_in_dev_hydration(element, attribute, value) {\n\tif (!DEV) return;\n\tif (attribute === 'srcset' && srcset_url_equal(element, value)) return;\n\tif (src_url_equal(element.getAttribute(attribute) ?? '', value)) return;\n\n\tw.hydration_attribute_changed(\n\t\tattribute,\n\t\telement.outerHTML.replace(element.innerHTML, element.innerHTML && '...'),\n\t\tString(value)\n\t);\n}\n\n/**\n * @param {string} element_src\n * @param {string} url\n * @returns {boolean}\n */\nfunction src_url_equal(element_src, url) {\n\tif (element_src === url) return true;\n\treturn new URL(element_src, document.baseURI).href === new URL(url, document.baseURI).href;\n}\n\n/** @param {string} srcset */\nfunction split_srcset(srcset) {\n\treturn srcset.split(',').map((src) => src.trim().split(' ').filter(Boolean));\n}\n\n/**\n * @param {HTMLSourceElement | HTMLImageElement} element\n * @param {string} srcset\n * @returns {boolean}\n */\nfunction srcset_url_equal(element, srcset) {\n\tvar element_urls = split_srcset(element.srcset);\n\tvar urls = split_srcset(srcset);\n\n\treturn (\n\t\turls.length === element_urls.length &&\n\t\turls.every(\n\t\t\t([url, width], i) =>\n\t\t\t\twidth === element_urls[i][1] &&\n\t\t\t\t// We need to test both ways because Vite will create an a full URL with\n\t\t\t\t// `new URL(asset, import.meta.url).href` for the client when `base: './'`, and the\n\t\t\t\t// relative URLs inside srcset are not automatically resolved to absolute URLs by\n\t\t\t\t// browsers (in contrast to img.src). This means both SSR and DOM code could\n\t\t\t\t// contain relative or absolute URLs.\n\t\t\t\t(src_url_equal(element_urls[i][0], url) || src_url_equal(url, element_urls[i][0]))\n\t\t)\n\t);\n}\n","/** @import { ComponentContext, Effect } from '#client' */\nimport { DESTROYING, STATE_SYMBOL } from '#client/constants';\nimport { component_context } from '../../../context.js';\nimport { effect, render_effect } from '../../../reactivity/effects.js';\nimport { active_effect, untrack } from '../../../runtime.js';\n\n/**\n * @param {any} bound_value\n * @param {Element} element_or_component\n * @returns {boolean}\n */\nfunction is_bound_this(bound_value, element_or_component) {\n\treturn (\n\t\tbound_value === element_or_component || bound_value?.[STATE_SYMBOL] === element_or_component\n\t);\n}\n\n/**\n * @param {any} element_or_component\n * @param {(value: unknown, ...parts: unknown[]) => void} update\n * @param {(...parts: unknown[]) => unknown} get_value\n * @param {() => unknown[]} [get_parts] Set if the this binding is used inside an each block,\n * \t\t\t\t\t\t\t\t\t\treturns all the parts of the each block context that are used in the expression\n * @returns {void}\n */\nexport function bind_this(element_or_component = {}, update, get_value, get_parts) {\n\tvar component_effect = /** @type {ComponentContext} */ (component_context).r;\n\tvar parent = /** @type {Effect} */ (active_effect);\n\n\teffect(() => {\n\t\t/** @type {unknown[]} */\n\t\tvar old_parts;\n\n\t\t/** @type {unknown[]} */\n\t\tvar parts;\n\n\t\trender_effect(() => {\n\t\t\told_parts = parts;\n\t\t\t// We only track changes to the parts, not the value itself to avoid unnecessary reruns.\n\t\t\tparts = get_parts?.() || [];\n\n\t\t\tuntrack(() => {\n\t\t\t\tif (element_or_component !== get_value(...parts)) {\n\t\t\t\t\tupdate(element_or_component, ...parts);\n\t\t\t\t\t// If this is an effect rerun (cause: each block context changes), then nullify the binding at\n\t\t\t\t\t// the previous position if it isn't already taken over by a different effect.\n\t\t\t\t\tif (old_parts && is_bound_this(get_value(...old_parts), element_or_component)) {\n\t\t\t\t\t\tupdate(null, ...old_parts);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\treturn () => {\n\t\t\t// When the bind:this effect is destroyed, we go up the effect parent chain until we find the last parent effect that is destroyed,\n\t\t\t// or the effect containing the component bind:this is in (whichever comes first). That way we can time the nulling of the binding\n\t\t\t// as close to user/developer expectation as possible.\n\t\t\t// TODO Svelte 6: Decide if we want to keep this logic or just always null the binding in the component effect's teardown\n\t\t\t// (which would be simpler, but less intuitive in some cases, and breaks the `ondestroy-before-cleanup` test)\n\t\t\tlet p = parent;\n\t\t\twhile (p !== component_effect && p.parent !== null && p.parent.f & DESTROYING) {\n\t\t\t\tp = p.parent;\n\t\t\t}\n\t\t\tconst teardown = () => {\n\t\t\t\tif (parts && is_bound_this(get_value(...parts), element_or_component)) {\n\t\t\t\t\tupdate(null, ...parts);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst original_teardown = p.teardown;\n\t\t\tp.teardown = () => {\n\t\t\t\tteardown();\n\t\t\t\toriginal_teardown?.();\n\t\t\t};\n\t\t};\n\t});\n\n\treturn element_or_component;\n}\n","/** @import { Effect, Source } from './types.js' */\nimport { DEV } from 'esm-env';\nimport {\n\tPROPS_IS_BINDABLE,\n\tPROPS_IS_IMMUTABLE,\n\tPROPS_IS_LAZY_INITIAL,\n\tPROPS_IS_RUNES,\n\tPROPS_IS_UPDATED\n} from '../../../constants.js';\nimport { get_descriptor, is_function } from '../../shared/utils.js';\nimport { set, source, update } from './sources.js';\nimport { derived, derived_safe_equal } from './deriveds.js';\nimport {\n\tactive_effect,\n\tget,\n\tis_destroying_effect,\n\tset_active_effect,\n\tuntrack\n} from '../runtime.js';\nimport * as e from '../errors.js';\nimport { DESTROYED, LEGACY_PROPS, STATE_SYMBOL } from '#client/constants';\nimport { proxy } from '../proxy.js';\nimport { capture_store_binding } from './store.js';\nimport { legacy_mode_flag } from '../../flags/index.js';\nimport { effect, render_effect } from './effects.js';\n\n/**\n * @param {((value?: number) => number)} fn\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_prop(fn, d = 1) {\n\tconst value = fn();\n\tfn(value + d);\n\treturn value;\n}\n\n/**\n * @param {((value?: number) => number)} fn\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_pre_prop(fn, d = 1) {\n\tconst value = fn() + d;\n\tfn(value);\n\treturn value;\n}\n\n/**\n * The proxy handler for rest props (i.e. `const { x, ...rest } = $props()`).\n * Is passed the full `$$props` object and excludes the named props.\n * @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Array<string | symbol>, name?: string }>}}\n */\nconst rest_props_handler = {\n\tget(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\treturn target.props[key];\n\t},\n\tset(target, key) {\n\t\tif (DEV) {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.props_rest_readonly(`${target.name}.${String(key)}`);\n\t\t}\n\n\t\treturn false;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\tif (key in target.props) {\n\t\t\treturn {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: target.props[key]\n\t\t\t};\n\t\t}\n\t},\n\thas(target, key) {\n\t\tif (target.exclude.includes(key)) return false;\n\t\treturn key in target.props;\n\t},\n\townKeys(target) {\n\t\treturn Reflect.ownKeys(target.props).filter((key) => !target.exclude.includes(key));\n\t}\n};\n\n/**\n * @param {Record<string, unknown>} props\n * @param {string[]} exclude\n * @param {string} [name]\n * @returns {Record<string, unknown>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function rest_props(props, exclude, name) {\n\treturn new Proxy(\n\t\tDEV ? { props, exclude, name, other: {}, to_proxy: [] } : { props, exclude },\n\t\trest_props_handler\n\t);\n}\n\n/**\n * The proxy handler for legacy $$restProps and $$props\n * @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Array<string | symbol>, special: Record<string | symbol, (v?: unknown) => unknown>, version: Source<number>, parent_effect: Effect }>}}\n */\nconst legacy_rest_props_handler = {\n\tget(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\tget(target.version);\n\t\treturn key in target.special ? target.special[key]() : target.props[key];\n\t},\n\tset(target, key, value) {\n\t\tif (!(key in target.special)) {\n\t\t\tvar previous_effect = active_effect;\n\n\t\t\ttry {\n\t\t\t\tset_active_effect(target.parent_effect);\n\n\t\t\t\t// Handle props that can temporarily get out of sync with the parent\n\t\t\t\t/** @type {Record<string, (v?: unknown) => unknown>} */\n\t\t\t\ttarget.special[key] = prop(\n\t\t\t\t\t{\n\t\t\t\t\t\tget [key]() {\n\t\t\t\t\t\t\treturn target.props[key];\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t/** @type {string} */ (key),\n\t\t\t\t\tPROPS_IS_UPDATED\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\tset_active_effect(previous_effect);\n\t\t\t}\n\t\t}\n\n\t\ttarget.special[key](value);\n\t\tupdate(target.version); // $$props is coarse-grained: when $$props.x is updated, usages of $$props.y etc are also rerun\n\t\treturn true;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\tif (key in target.props) {\n\t\t\treturn {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: target.props[key]\n\t\t\t};\n\t\t}\n\t},\n\tdeleteProperty(target, key) {\n\t\t// Svelte 4 allowed for deletions on $$restProps\n\t\tif (target.exclude.includes(key)) return true;\n\t\ttarget.exclude.push(key);\n\t\tupdate(target.version);\n\t\treturn true;\n\t},\n\thas(target, key) {\n\t\tif (target.exclude.includes(key)) return false;\n\t\treturn key in target.props;\n\t},\n\townKeys(target) {\n\t\treturn Reflect.ownKeys(target.props).filter((key) => !target.exclude.includes(key));\n\t}\n};\n\n/**\n * @param {Record<string, unknown>} props\n * @param {string[]} exclude\n * @returns {Record<string, unknown>}\n */\nexport function legacy_rest_props(props, exclude) {\n\treturn new Proxy(\n\t\t{\n\t\t\tprops,\n\t\t\texclude,\n\t\t\tspecial: {},\n\t\t\tversion: source(0),\n\t\t\t// TODO this is only necessary because we need to track component\n\t\t\t// destruction inside `prop`, because of `bind:this`, but it\n\t\t\t// seems likely that we can simplify `bind:this` instead\n\t\t\tparent_effect: /** @type {Effect} */ (active_effect)\n\t\t},\n\t\tlegacy_rest_props_handler\n\t);\n}\n\n/**\n * The proxy handler for spread props. Handles the incoming array of props\n * that looks like `() => { dynamic: props }, { static: prop }, ..` and wraps\n * them so that the whole thing is passed to the component as the `$$props` argument.\n * @type {ProxyHandler<{ props: Array<Record<string | symbol, unknown> | (() => Record<string | symbol, unknown>)> }>}}\n */\nconst spread_props_handler = {\n\tget(target, key) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (typeof p === 'object' && p !== null && key in p) return p[key];\n\t\t}\n\t},\n\tset(target, key, value) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tconst desc = get_descriptor(p, key);\n\t\t\tif (desc && desc.set) {\n\t\t\t\tdesc.set(value);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (typeof p === 'object' && p !== null && key in p) {\n\t\t\t\tconst descriptor = get_descriptor(p, key);\n\t\t\t\tif (descriptor && !descriptor.configurable) {\n\t\t\t\t\t// Prevent a \"Non-configurability Report Error\": The target is an array, it does\n\t\t\t\t\t// not actually contain this property. If it is now described as non-configurable,\n\t\t\t\t\t// the proxy throws a validation error. Setting it to true avoids that.\n\t\t\t\t\tdescriptor.configurable = true;\n\t\t\t\t}\n\t\t\t\treturn descriptor;\n\t\t\t}\n\t\t}\n\t},\n\thas(target, key) {\n\t\t// To prevent a false positive `is_entry_props` in the `prop` function\n\t\tif (key === STATE_SYMBOL || key === LEGACY_PROPS) return false;\n\n\t\tfor (let p of target.props) {\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (p != null && key in p) return true;\n\t\t}\n\n\t\treturn false;\n\t},\n\townKeys(target) {\n\t\t/** @type {Array<string | symbol>} */\n\t\tconst keys = [];\n\n\t\tfor (let p of target.props) {\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (!p) continue;\n\n\t\t\tfor (const key in p) {\n\t\t\t\tif (!keys.includes(key)) keys.push(key);\n\t\t\t}\n\n\t\t\tfor (const key of Object.getOwnPropertySymbols(p)) {\n\t\t\t\tif (!keys.includes(key)) keys.push(key);\n\t\t\t}\n\t\t}\n\n\t\treturn keys;\n\t}\n};\n\n/**\n * @param {Array<Record<string, unknown> | (() => Record<string, unknown>)>} props\n * @returns {any}\n */\nexport function spread_props(...props) {\n\treturn new Proxy({ props }, spread_props_handler);\n}\n\n/**\n * This function is responsible for synchronizing a possibly bound prop with the inner component state.\n * It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.\n * @template V\n * @param {Record<string, unknown>} props\n * @param {string} key\n * @param {number} flags\n * @param {V | (() => V)} [fallback]\n * @returns {(() => V | ((arg: V) => V) | ((arg: V, mutation: boolean) => V))}\n */\nexport function prop(props, key, flags, fallback) {\n\tvar runes = !legacy_mode_flag || (flags & PROPS_IS_RUNES) !== 0;\n\tvar bindable = (flags & PROPS_IS_BINDABLE) !== 0;\n\tvar lazy = (flags & PROPS_IS_LAZY_INITIAL) !== 0;\n\n\tvar fallback_value = /** @type {V} */ (fallback);\n\tvar fallback_dirty = true;\n\n\tvar get_fallback = () => {\n\t\tif (fallback_dirty) {\n\t\t\tfallback_dirty = false;\n\n\t\t\tfallback_value = lazy\n\t\t\t\t? untrack(/** @type {() => V} */ (fallback))\n\t\t\t\t: /** @type {V} */ (fallback);\n\t\t}\n\n\t\treturn fallback_value;\n\t};\n\n\t/** @type {((v: V) => void) | undefined} */\n\tlet setter;\n\n\tif (bindable) {\n\t\t// Can be the case when someone does `mount(Component, props)` with `let props = $state({...})`\n\t\t// or `createClassComponent(Component, props)`\n\t\tvar is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props;\n\n\t\tsetter =\n\t\t\tget_descriptor(props, key)?.set ??\n\t\t\t(is_entry_props && key in props ? (v) => (props[key] = v) : undefined);\n\t}\n\n\t/** @type {V} */\n\tvar initial_value;\n\tvar is_store_sub = false;\n\n\tif (bindable) {\n\t\t[initial_value, is_store_sub] = capture_store_binding(() => /** @type {V} */ (props[key]));\n\t} else {\n\t\tinitial_value = /** @type {V} */ (props[key]);\n\t}\n\n\tif (initial_value === undefined && fallback !== undefined) {\n\t\tinitial_value = get_fallback();\n\n\t\tif (setter) {\n\t\t\tif (runes) e.props_invalid_value(key);\n\t\t\tsetter(initial_value);\n\t\t}\n\t}\n\n\t/** @type {() => V} */\n\tvar getter;\n\n\tif (runes) {\n\t\tgetter = () => {\n\t\t\tvar value = /** @type {V} */ (props[key]);\n\t\t\tif (value === undefined) return get_fallback();\n\t\t\tfallback_dirty = true;\n\t\t\treturn value;\n\t\t};\n\t} else {\n\t\tgetter = () => {\n\t\t\tvar value = /** @type {V} */ (props[key]);\n\n\t\t\tif (value !== undefined) {\n\t\t\t\t// in legacy mode, we don't revert to the fallback value\n\t\t\t\t// if the prop goes from defined to undefined. The easiest\n\t\t\t\t// way to model this is to make the fallback undefined\n\t\t\t\t// as soon as the prop has a value\n\t\t\t\tfallback_value = /** @type {V} */ (undefined);\n\t\t\t}\n\n\t\t\treturn value === undefined ? fallback_value : value;\n\t\t};\n\t}\n\n\t// prop is never written to — we only need a getter\n\tif (runes && (flags & PROPS_IS_UPDATED) === 0) {\n\t\treturn getter;\n\t}\n\n\t// prop is written to, but the parent component had `bind:foo` which\n\t// means we can just call `$$props.foo = value` directly\n\tif (setter) {\n\t\tvar legacy_parent = props.$$legacy;\n\t\treturn /** @type {() => V} */ (\n\t\t\tfunction (/** @type {V} */ value, /** @type {boolean} */ mutation) {\n\t\t\t\tif (arguments.length > 0) {\n\t\t\t\t\t// We don't want to notify if the value was mutated and the parent is in runes mode.\n\t\t\t\t\t// In that case the state proxy (if it exists) should take care of the notification.\n\t\t\t\t\t// If the parent is not in runes mode, we need to notify on mutation, too, that the prop\n\t\t\t\t\t// has changed because the parent will not be able to detect the change otherwise.\n\t\t\t\t\tif (!runes || !mutation || legacy_parent || is_store_sub) {\n\t\t\t\t\t\t/** @type {Function} */ (setter)(mutation ? getter() : value);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\n\t\t\t\treturn getter();\n\t\t\t}\n\t\t);\n\t}\n\n\t// Either prop is written to, but there's no binding, which means we\n\t// create a derived that we can write to locally.\n\t// Or we are in legacy mode where we always create a derived to replicate that\n\t// Svelte 4 did not trigger updates when a primitive value was updated to the same value.\n\tvar overridden = false;\n\n\tvar d = ((flags & PROPS_IS_IMMUTABLE) !== 0 ? derived : derived_safe_equal)(() => {\n\t\toverridden = false;\n\t\treturn getter();\n\t});\n\n\tif (DEV) {\n\t\td.label = key;\n\t}\n\n\t// Capture the initial value if it's bindable\n\tif (bindable) get(d);\n\n\tvar parent_effect = /** @type {Effect} */ (active_effect);\n\n\treturn /** @type {() => V} */ (\n\t\tfunction (/** @type {any} */ value, /** @type {boolean} */ mutation) {\n\t\t\tif (arguments.length > 0) {\n\t\t\t\tconst new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;\n\n\t\t\t\tset(d, new_value);\n\t\t\t\toverridden = true;\n\n\t\t\t\tif (fallback_value !== undefined) {\n\t\t\t\t\tfallback_value = new_value;\n\t\t\t\t}\n\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\t// special case — avoid recalculating the derived if we're in a\n\t\t\t// teardown function and the prop was overridden locally, or the\n\t\t\t// component was already destroyed (people could access props in a timeout)\n\t\t\tif ((is_destroying_effect && overridden) || (parent_effect.f & DESTROYED) !== 0) {\n\t\t\t\treturn d.v;\n\t\t\t}\n\n\t\t\treturn get(d);\n\t\t}\n\t);\n}\n","/** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */\nimport { DIRTY, LEGACY_PROPS, MAYBE_DIRTY } from '../internal/client/constants.js';\nimport { user_pre_effect } from '../internal/client/reactivity/effects.js';\nimport { mutable_source, set } from '../internal/client/reactivity/sources.js';\nimport { hydrate, mount, unmount } from '../internal/client/render.js';\nimport { active_effect, get } from '../internal/client/runtime.js';\nimport { flushSync } from '../internal/client/reactivity/batch.js';\nimport { define_property, is_array } from '../internal/shared/utils.js';\nimport * as e from '../internal/client/errors.js';\nimport * as w from '../internal/client/warnings.js';\nimport { DEV } from 'esm-env';\nimport { FILENAME } from '../constants.js';\nimport { component_context, dev_current_component_function } from '../internal/client/context.js';\nimport { async_mode_flag } from '../internal/flags/index.js';\nimport { set_signal_status } from '../internal/client/reactivity/status.js';\n\n/**\n * Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component.\n *\n * @deprecated Use this only as a temporary solution to migrate your imperative component code to Svelte 5.\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @template {Record<string, any>} Events\n * @template {Record<string, any>} Slots\n *\n * @param {ComponentConstructorOptions<Props> & {\n * \tcomponent: ComponentType<SvelteComponent<Props, Events, Slots>> | Component<Props>;\n * }} options\n * @returns {SvelteComponent<Props, Events, Slots> & Exports}\n */\nexport function createClassComponent(options) {\n\t// @ts-expect-error $$prop_def etc are not actually defined\n\treturn new Svelte4Component(options);\n}\n\n/**\n * Takes the component function and returns a Svelte 4 compatible component constructor.\n *\n * @deprecated Use this only as a temporary solution to migrate your imperative component code to Svelte 5.\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @template {Record<string, any>} Events\n * @template {Record<string, any>} Slots\n *\n * @param {SvelteComponent<Props, Events, Slots> | Component<Props>} component\n * @returns {ComponentType<SvelteComponent<Props, Events, Slots> & Exports>}\n */\nexport function asClassComponent(component) {\n\t// @ts-expect-error $$prop_def etc are not actually defined\n\treturn class extends Svelte4Component {\n\t\t/** @param {any} options */\n\t\tconstructor(options) {\n\t\t\tsuper({\n\t\t\t\tcomponent,\n\t\t\t\t...options\n\t\t\t});\n\t\t}\n\t};\n}\n\n/**\n * Support using the component as both a class and function during the transition period\n * @typedef {{new (o: ComponentConstructorOptions): SvelteComponent;(...args: Parameters<Component<Record<string, any>>>): ReturnType<Component<Record<string, any>, Record<string, any>>>;}} LegacyComponentType\n */\n\nclass Svelte4Component {\n\t/** @type {any} */\n\t#events;\n\n\t/** @type {Record<string, any>} */\n\t#instance;\n\n\t/**\n\t * @param {ComponentConstructorOptions & {\n\t * component: any;\n\t * }} options\n\t */\n\tconstructor(options) {\n\t\tvar sources = new Map();\n\n\t\t/**\n\t\t * @param {string | symbol} key\n\t\t * @param {unknown} value\n\t\t */\n\t\tvar add_source = (key, value) => {\n\t\t\tvar s = mutable_source(value, false, false);\n\t\t\tsources.set(key, s);\n\t\t\treturn s;\n\t\t};\n\n\t\t// Replicate coarse-grained props through a proxy that has a version source for\n\t\t// each property, which is incremented on updates to the property itself. Do not\n\t\t// use our $state proxy because that one has fine-grained reactivity.\n\t\tconst props = new Proxy(\n\t\t\t{ ...(options.props || {}), $$events: {} },\n\t\t\t{\n\t\t\t\tget(target, prop) {\n\t\t\t\t\treturn get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));\n\t\t\t\t},\n\t\t\t\thas(target, prop) {\n\t\t\t\t\t// Necessary to not throw \"invalid binding\" validation errors on the component side\n\t\t\t\t\tif (prop === LEGACY_PROPS) return true;\n\n\t\t\t\t\tget(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));\n\t\t\t\t\treturn Reflect.has(target, prop);\n\t\t\t\t},\n\t\t\t\tset(target, prop, value) {\n\t\t\t\t\tset(sources.get(prop) ?? add_source(prop, value), value);\n\t\t\t\t\treturn Reflect.set(target, prop, value);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tthis.#instance = (options.hydrate ? hydrate : mount)(options.component, {\n\t\t\ttarget: options.target,\n\t\t\tanchor: options.anchor,\n\t\t\tprops,\n\t\t\tcontext: options.context,\n\t\t\tintro: options.intro ?? false,\n\t\t\trecover: options.recover,\n\t\t\ttransformError: options.transformError\n\t\t});\n\n\t\t// We don't flushSync for custom element wrappers or if the user doesn't want it,\n\t\t// or if we're in async mode since `flushSync()` will fail\n\t\tif (!async_mode_flag && (!options?.props?.$$host || options.sync === false)) {\n\t\t\tflushSync();\n\t\t}\n\n\t\tthis.#events = props.$$events;\n\n\t\tfor (const key of Object.keys(this.#instance)) {\n\t\t\tif (key === '$set' || key === '$destroy' || key === '$on') continue;\n\t\t\tdefine_property(this, key, {\n\t\t\t\tget() {\n\t\t\t\t\treturn this.#instance[key];\n\t\t\t\t},\n\t\t\t\t/** @param {any} value */\n\t\t\t\tset(value) {\n\t\t\t\t\tthis.#instance[key] = value;\n\t\t\t\t},\n\t\t\t\tenumerable: true\n\t\t\t});\n\t\t}\n\n\t\tthis.#instance.$set = /** @param {Record<string, any>} next */ (next) => {\n\t\t\tObject.assign(props, next);\n\t\t};\n\n\t\tthis.#instance.$destroy = () => {\n\t\t\tunmount(this.#instance);\n\t\t};\n\t}\n\n\t/** @param {Record<string, any>} props */\n\t$set(props) {\n\t\tthis.#instance.$set(props);\n\t}\n\n\t/**\n\t * @param {string} event\n\t * @param {(...args: any[]) => any} callback\n\t * @returns {any}\n\t */\n\t$on(event, callback) {\n\t\tthis.#events[event] = this.#events[event] || [];\n\n\t\t/** @param {any[]} args */\n\t\tconst cb = (...args) => callback.call(this, ...args);\n\t\tthis.#events[event].push(cb);\n\t\treturn () => {\n\t\t\tthis.#events[event] = this.#events[event].filter(/** @param {any} fn */ (fn) => fn !== cb);\n\t\t};\n\t}\n\n\t$destroy() {\n\t\tthis.#instance.$destroy();\n\t}\n}\n\n/**\n * Runs the given function once immediately on the server, and works like `$effect.pre` on the client.\n *\n * @deprecated Use this only as a temporary solution to migrate your component code to Svelte 5.\n * @param {() => void | (() => void)} fn\n * @returns {void}\n */\nexport function run(fn) {\n\tuser_pre_effect(() => {\n\t\tfn();\n\t\tvar effect = /** @type {import('#client').Effect} */ (active_effect);\n\t\t// If the effect is immediately made dirty again, mark it as maybe dirty to emulate legacy behaviour\n\t\tif ((effect.f & DIRTY) !== 0) {\n\t\t\tlet filename = \"a file (we can't know which one)\";\n\t\t\tif (DEV) {\n\t\t\t\t// @ts-ignore\n\t\t\t\tfilename = dev_current_component_function?.[FILENAME] ?? filename;\n\t\t\t}\n\t\t\tw.legacy_recursive_reactive_block(filename);\n\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t}\n\t});\n}\n\n/**\n * Function to mimic the multiple listeners available in svelte 4\n * @deprecated\n * @param {EventListener[]} handlers\n * @returns {EventListener}\n */\nexport function handlers(...handlers) {\n\treturn function (event) {\n\t\tconst { stopImmediatePropagation } = event;\n\t\tlet stopped = false;\n\n\t\tevent.stopImmediatePropagation = () => {\n\t\t\tstopped = true;\n\t\t\tstopImmediatePropagation.call(event);\n\t\t};\n\n\t\tconst errors = [];\n\n\t\tfor (const handler of handlers) {\n\t\t\ttry {\n\t\t\t\t// @ts-expect-error `this` is not typed\n\t\t\t\thandler?.call(this, event);\n\t\t\t} catch (e) {\n\t\t\t\terrors.push(e);\n\t\t\t}\n\n\t\t\tif (stopped) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tfor (let error of errors) {\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tthrow error;\n\t\t\t});\n\t\t}\n\t};\n}\n\n/**\n * Function to create a `bubble` function that mimic the behavior of `on:click` without handler available in svelte 4.\n * @deprecated Use this only as a temporary solution to migrate your automatically delegated events in Svelte 5.\n */\nexport function createBubbler() {\n\tconst active_component_context = component_context;\n\tif (active_component_context === null) {\n\t\te.lifecycle_outside_component('createBubbler');\n\t}\n\n\treturn (/**@type {string}*/ type) => (/**@type {Event}*/ event) => {\n\t\tconst events = /** @type {Record<string, Function | Function[]>} */ (\n\t\t\tactive_component_context.s.$$events\n\t\t)?.[/** @type {any} */ (type)];\n\n\t\tif (events) {\n\t\t\tconst callbacks = is_array(events) ? events.slice() : [events];\n\t\t\tfor (const fn of callbacks) {\n\t\t\t\tfn.call(active_component_context.x, event);\n\t\t\t}\n\t\t\treturn !event.defaultPrevented;\n\t\t}\n\t\treturn true;\n\t};\n}\n\nexport {\n\tonce,\n\tpreventDefault,\n\tself,\n\tstopImmediatePropagation,\n\tstopPropagation,\n\ttrusted,\n\tpassive,\n\tnonpassive\n} from '../internal/client/dom/legacy/event-modifiers.js';\n","import { createClassComponent } from '../../../../legacy/legacy-client.js';\nimport { effect_root, render_effect } from '../../reactivity/effects.js';\nimport { append } from '../template.js';\nimport { define_property, get_descriptor, object_keys } from '../../../shared/utils.js';\nimport { create_element } from '../operations.js';\n\n/**\n * @typedef {Object} CustomElementPropDefinition\n * @property {string} [attribute]\n * @property {boolean} [reflect]\n * @property {'String'|'Boolean'|'Number'|'Array'|'Object'} [type]\n */\n\n/** @type {any} */\nlet SvelteElement;\n\nif (typeof HTMLElement === 'function') {\n\tSvelteElement = class extends HTMLElement {\n\t\t/** The Svelte component constructor */\n\t\t$$ctor;\n\t\t/** Slots */\n\t\t$$s;\n\t\t/** @type {any} The Svelte component instance */\n\t\t$$c;\n\t\t/** Whether or not the custom element is connected */\n\t\t$$cn = false;\n\t\t/** @type {Record<string, any>} Component props data */\n\t\t$$d = {};\n\t\t/** `true` if currently in the process of reflecting component props back to attributes */\n\t\t$$r = false;\n\t\t/** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */\n\t\t$$p_d = {};\n\t\t/** @type {Record<string, EventListenerOrEventListenerObject[]>} Event listeners */\n\t\t$$l = {};\n\t\t/** @type {Map<EventListenerOrEventListenerObject, Function>} Event listener unsubscribe functions */\n\t\t$$l_u = new Map();\n\t\t/** @type {any} The managed render effect for reflecting attributes */\n\t\t$$me;\n\t\t/** @type {ShadowRoot | null} The ShadowRoot of the custom element */\n\t\t$$shadowRoot = null;\n\n\t\t/**\n\t\t * @param {*} $$componentCtor\n\t\t * @param {*} $$slots\n\t\t * @param {ShadowRootInit | undefined} shadow_root_init\n\t\t */\n\t\tconstructor($$componentCtor, $$slots, shadow_root_init) {\n\t\t\tsuper();\n\t\t\tthis.$$ctor = $$componentCtor;\n\t\t\tthis.$$s = $$slots;\n\n\t\t\tif (shadow_root_init) {\n\t\t\t\t// We need to store the reference to shadow root, because `closed` shadow root cannot be\n\t\t\t\t// accessed with `this.shadowRoot`.\n\t\t\t\tthis.$$shadowRoot = this.attachShadow(shadow_root_init);\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * @param {string} type\n\t\t * @param {EventListenerOrEventListenerObject} listener\n\t\t * @param {boolean | AddEventListenerOptions} [options]\n\t\t */\n\t\taddEventListener(type, listener, options) {\n\t\t\t// We can't determine upfront if the event is a custom event or not, so we have to\n\t\t\t// listen to both. If someone uses a custom event with the same name as a regular\n\t\t\t// browser event, this fires twice - we can't avoid that.\n\t\t\tthis.$$l[type] = this.$$l[type] || [];\n\t\t\tthis.$$l[type].push(listener);\n\t\t\tif (this.$$c) {\n\t\t\t\tconst unsub = this.$$c.$on(type, listener);\n\t\t\t\tthis.$$l_u.set(listener, unsub);\n\t\t\t}\n\t\t\tsuper.addEventListener(type, listener, options);\n\t\t}\n\n\t\t/**\n\t\t * @param {string} type\n\t\t * @param {EventListenerOrEventListenerObject} listener\n\t\t * @param {boolean | AddEventListenerOptions} [options]\n\t\t */\n\t\tremoveEventListener(type, listener, options) {\n\t\t\tsuper.removeEventListener(type, listener, options);\n\t\t\tif (this.$$c) {\n\t\t\t\tconst unsub = this.$$l_u.get(listener);\n\t\t\t\tif (unsub) {\n\t\t\t\t\tunsub();\n\t\t\t\t\tthis.$$l_u.delete(listener);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tasync connectedCallback() {\n\t\t\tthis.$$cn = true;\n\t\t\tif (!this.$$c) {\n\t\t\t\t// We wait one tick to let possible child slot elements be created/mounted\n\t\t\t\tawait Promise.resolve();\n\t\t\t\tif (!this.$$cn || this.$$c) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t/** @param {string} name */\n\t\t\t\tfunction create_slot(name) {\n\t\t\t\t\t/**\n\t\t\t\t\t * @param {Element} anchor\n\t\t\t\t\t */\n\t\t\t\t\treturn (anchor) => {\n\t\t\t\t\t\tconst slot = create_element('slot');\n\t\t\t\t\t\tif (name !== 'default') slot.name = name;\n\n\t\t\t\t\t\tappend(anchor, slot);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\t/** @type {Record<string, any>} */\n\t\t\t\tconst $$slots = {};\n\t\t\t\tconst existing_slots = get_custom_elements_slots(this);\n\t\t\t\tfor (const name of this.$$s) {\n\t\t\t\t\tif (name in existing_slots) {\n\t\t\t\t\t\tif (name === 'default' && !this.$$d.children) {\n\t\t\t\t\t\t\tthis.$$d.children = create_slot(name);\n\t\t\t\t\t\t\t$$slots.default = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$$slots[name] = create_slot(name);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const attribute of this.attributes) {\n\t\t\t\t\t// this.$$data takes precedence over this.attributes\n\t\t\t\t\tconst name = this.$$g_p(attribute.name);\n\t\t\t\t\tif (!(name in this.$$d)) {\n\t\t\t\t\t\tthis.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, 'toProp');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Port over props that were set programmatically before ce was initialized\n\t\t\t\tfor (const key in this.$$p_d) {\n\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\tif (!(key in this.$$d) && this[key] !== undefined) {\n\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\tthis.$$d[key] = this[key]; // don't transform, these were set through JavaScript\n\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\tdelete this[key]; // remove the property that shadows the getter/setter\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.$$c = createClassComponent({\n\t\t\t\t\tcomponent: this.$$ctor,\n\t\t\t\t\ttarget: this.$$shadowRoot || this,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...this.$$d,\n\t\t\t\t\t\t$$slots,\n\t\t\t\t\t\t$$host: this\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// Reflect component props as attributes\n\t\t\t\tthis.$$me = effect_root(() => {\n\t\t\t\t\trender_effect(() => {\n\t\t\t\t\t\tthis.$$r = true;\n\t\t\t\t\t\tfor (const key of object_keys(this.$$c)) {\n\t\t\t\t\t\t\tif (!this.$$p_d[key]?.reflect) continue;\n\t\t\t\t\t\t\tthis.$$d[key] = this.$$c[key];\n\t\t\t\t\t\t\tconst attribute_value = get_custom_element_value(\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tthis.$$d[key],\n\t\t\t\t\t\t\t\tthis.$$p_d,\n\t\t\t\t\t\t\t\t'toAttribute'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (attribute_value == null) {\n\t\t\t\t\t\t\t\tthis.removeAttribute(this.$$p_d[key].attribute || key);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.setAttribute(this.$$p_d[key].attribute || key, attribute_value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.$$r = false;\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tfor (const type in this.$$l) {\n\t\t\t\t\tfor (const listener of this.$$l[type]) {\n\t\t\t\t\t\tconst unsub = this.$$c.$on(type, listener);\n\t\t\t\t\t\tthis.$$l_u.set(listener, unsub);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.$$l = {};\n\t\t\t}\n\t\t}\n\n\t\t// We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte\n\t\t// and setting attributes through setAttribute etc, this is helpful\n\n\t\t/**\n\t\t * @param {string} attr\n\t\t * @param {string} _oldValue\n\t\t * @param {string} newValue\n\t\t */\n\t\tattributeChangedCallback(attr, _oldValue, newValue) {\n\t\t\tif (this.$$r) return;\n\t\t\tattr = this.$$g_p(attr);\n\t\t\tthis.$$d[attr] = get_custom_element_value(attr, newValue, this.$$p_d, 'toProp');\n\t\t\tthis.$$c?.$set({ [attr]: this.$$d[attr] });\n\t\t}\n\n\t\tdisconnectedCallback() {\n\t\t\tthis.$$cn = false;\n\t\t\t// In a microtask, because this could be a move within the DOM\n\t\t\tPromise.resolve().then(() => {\n\t\t\t\tif (!this.$$cn && this.$$c) {\n\t\t\t\t\tthis.$$c.$destroy();\n\t\t\t\t\tthis.$$me();\n\t\t\t\t\tthis.$$c = undefined;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * @param {string} attribute_name\n\t\t */\n\t\t$$g_p(attribute_name) {\n\t\t\treturn (\n\t\t\t\tobject_keys(this.$$p_d).find(\n\t\t\t\t\t(key) =>\n\t\t\t\t\t\tthis.$$p_d[key].attribute === attribute_name ||\n\t\t\t\t\t\t(!this.$$p_d[key].attribute && key.toLowerCase() === attribute_name)\n\t\t\t\t) || attribute_name\n\t\t\t);\n\t\t}\n\t};\n}\n\n/**\n * @param {string} prop\n * @param {any} value\n * @param {Record<string, CustomElementPropDefinition>} props_definition\n * @param {'toAttribute' | 'toProp'} [transform]\n */\nfunction get_custom_element_value(prop, value, props_definition, transform) {\n\tconst type = props_definition[prop]?.type;\n\tvalue = type === 'Boolean' && typeof value !== 'boolean' ? value != null : value;\n\tif (!transform || !props_definition[prop]) {\n\t\treturn value;\n\t} else if (transform === 'toAttribute') {\n\t\tswitch (type) {\n\t\t\tcase 'Object':\n\t\t\tcase 'Array':\n\t\t\t\treturn value == null ? null : JSON.stringify(value);\n\t\t\tcase 'Boolean':\n\t\t\t\treturn value ? '' : null;\n\t\t\tcase 'Number':\n\t\t\t\treturn value == null ? null : value;\n\t\t\tdefault:\n\t\t\t\treturn value;\n\t\t}\n\t} else {\n\t\tswitch (type) {\n\t\t\tcase 'Object':\n\t\t\tcase 'Array':\n\t\t\t\treturn value && JSON.parse(value);\n\t\t\tcase 'Boolean':\n\t\t\t\treturn value; // conversion already handled above\n\t\t\tcase 'Number':\n\t\t\t\treturn value != null ? +value : value;\n\t\t\tdefault:\n\t\t\t\treturn value;\n\t\t}\n\t}\n}\n\n/**\n * @param {HTMLElement} element\n */\nfunction get_custom_elements_slots(element) {\n\t/** @type {Record<string, true>} */\n\tconst result = {};\n\telement.childNodes.forEach((node) => {\n\t\tresult[/** @type {Element} node */ (node).slot || 'default'] = true;\n\t});\n\treturn result;\n}\n\n/**\n * @internal\n *\n * Turn a Svelte component into a custom element.\n * @param {any} Component A Svelte component function\n * @param {Record<string, CustomElementPropDefinition>} props_definition The props to observe\n * @param {string[]} slots The slots to create\n * @param {string[]} exports Explicitly exported values, other than props\n * @param {ShadowRootInit | undefined} shadow_root_init Options passed to shadow DOM constructor\n * @param {(ce: new () => HTMLElement) => new () => HTMLElement} [extend]\n */\nexport function create_custom_element(\n\tComponent,\n\tprops_definition,\n\tslots,\n\texports,\n\tshadow_root_init,\n\textend\n) {\n\tlet Class = class extends SvelteElement {\n\t\tconstructor() {\n\t\t\tsuper(Component, slots, shadow_root_init);\n\t\t\tthis.$$p_d = props_definition;\n\t\t}\n\t\tstatic get observedAttributes() {\n\t\t\treturn object_keys(props_definition).map((key) =>\n\t\t\t\t(props_definition[key].attribute || key).toLowerCase()\n\t\t\t);\n\t\t}\n\t};\n\tobject_keys(props_definition).forEach((prop) => {\n\t\tdefine_property(Class.prototype, prop, {\n\t\t\tget() {\n\t\t\t\treturn this.$$c && prop in this.$$c ? this.$$c[prop] : this.$$d[prop];\n\t\t\t},\n\t\t\tset(value) {\n\t\t\t\tvalue = get_custom_element_value(prop, value, props_definition);\n\t\t\t\tthis.$$d[prop] = value;\n\t\t\t\tvar component = this.$$c;\n\n\t\t\t\tif (component) {\n\t\t\t\t\t// // If the instance has an accessor, use that instead\n\t\t\t\t\tvar setter = get_descriptor(component, prop)?.get;\n\n\t\t\t\t\tif (setter) {\n\t\t\t\t\t\tcomponent[prop] = value;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcomponent.$set({ [prop]: value });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n\texports.forEach((property) => {\n\t\tdefine_property(Class.prototype, property, {\n\t\t\tget() {\n\t\t\t\treturn this.$$c?.[property];\n\t\t\t}\n\t\t});\n\t});\n\tif (extend) {\n\t\t// @ts-expect-error - assigning here is fine\n\t\tClass = extend(Class);\n\t}\n\tComponent.element = /** @type {any} */ Class;\n\treturn Class;\n}\n","/**\n * ItemSessionController\n *\n * Manages QTI itemSessionControl rules for individual items.\n * Enforces attempt limits, feedback visibility, review/skip controls, and validation.\n *\n * QTI 2.2 itemSessionControl attributes:\n * - maxAttempts: Maximum number of submission attempts (0 = unlimited)\n * - showFeedback: Whether to show feedback after responses\n * - showSolution: Whether to show correct answers\n * - allowReview: Allow returning to already-answered items\n * - allowSkipping: Allow skipping items without answering\n * - validateResponses: Require valid responses before moving on\n * - allowComment: Allow candidate comments (not implemented yet)\n */\n\nexport interface ItemSessionControlSettings {\n\tmaxAttempts?: number; // 0 = unlimited\n\tshowFeedback?: boolean;\n\tallowReview?: boolean;\n\tshowSolution?: boolean;\n\tallowComment?: boolean;\n\tallowSkipping?: boolean;\n\tvalidateResponses?: boolean;\n}\n\nexport interface ItemSessionState {\n\titemIdentifier: string;\n\tattemptCount: number;\n\tisAnswered: boolean;\n\tisSubmitted: boolean;\n\tlastSubmissionTime?: number;\n}\n\nexport class ItemSessionController {\n\tprivate settings: ItemSessionControlSettings;\n\tprivate sessionStates: Map<string, ItemSessionState> = new Map();\n\n\tconstructor(settings: ItemSessionControlSettings = {}) {\n\t\t// Apply defaults per QTI 2.2 spec\n\t\tthis.settings = {\n\t\t\tmaxAttempts: settings.maxAttempts ?? 0, // 0 = unlimited\n\t\t\tshowFeedback: settings.showFeedback ?? false,\n\t\t\tallowReview: settings.allowReview ?? true,\n\t\t\tshowSolution: settings.showSolution ?? false,\n\t\t\tallowComment: settings.allowComment ?? false,\n\t\t\tallowSkipping: settings.allowSkipping ?? true,\n\t\t\tvalidateResponses: settings.validateResponses ?? false,\n\t\t};\n\t}\n\n\t/**\n\t * Initialize session state for an item\n\t */\n\tinitializeItem(itemIdentifier: string): void {\n\t\tif (!this.sessionStates.has(itemIdentifier)) {\n\t\t\tthis.sessionStates.set(itemIdentifier, {\n\t\t\t\titemIdentifier,\n\t\t\t\tattemptCount: 0,\n\t\t\t\tisAnswered: false,\n\t\t\t\tisSubmitted: false,\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Get session state for an item\n\t */\n\tgetItemState(itemIdentifier: string): ItemSessionState | null {\n\t\treturn this.sessionStates.get(itemIdentifier) ?? null;\n\t}\n\n\t/**\n\t * Record a submission attempt for an item\n\t */\n\trecordAttempt(itemIdentifier: string): void {\n\t\tconst state = this.sessionStates.get(itemIdentifier);\n\t\tif (!state) {\n\t\t\tthrow new Error(`Item session not initialized: ${itemIdentifier}`);\n\t\t}\n\n\t\tstate.attemptCount++;\n\t\tstate.isSubmitted = true;\n\t\tstate.lastSubmissionTime = Date.now();\n\t}\n\n\t/**\n\t * Mark item as answered (has responses)\n\t */\n\tmarkAnswered(itemIdentifier: string, hasResponses: boolean): void {\n\t\tconst state = this.sessionStates.get(itemIdentifier);\n\t\tif (state) {\n\t\t\tstate.isAnswered = hasResponses;\n\t\t}\n\t}\n\n\t/**\n\t * Check if item can be submitted\n\t */\n\tcanSubmit(itemIdentifier: string): boolean {\n\t\tconst state = this.sessionStates.get(itemIdentifier);\n\t\tif (!state) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check maxAttempts\n\t\tconst maxAttempts = this.settings.maxAttempts ?? 0;\n\t\tif (maxAttempts > 0 && state.attemptCount >= maxAttempts) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Get remaining attempts for an item\n\t */\n\tgetRemainingAttempts(itemIdentifier: string): number | null {\n\t\tconst state = this.sessionStates.get(itemIdentifier);\n\t\tif (!state) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst maxAttempts = this.settings.maxAttempts ?? 0;\n\t\tif (maxAttempts === 0) {\n\t\t\treturn null; // Unlimited\n\t\t}\n\n\t\treturn Math.max(0, maxAttempts - state.attemptCount);\n\t}\n\n\t/**\n\t * Check if feedback should be shown for an item\n\t */\n\tshouldShowFeedback(itemIdentifier: string): boolean {\n\t\tconst state = this.sessionStates.get(itemIdentifier);\n\t\tif (!state || !state.isSubmitted) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn this.settings.showFeedback ?? false;\n\t}\n\n\t/**\n\t * Check if solution should be shown for an item\n\t */\n\tshouldShowSolution(itemIdentifier: string): boolean {\n\t\tconst state = this.sessionStates.get(itemIdentifier);\n\t\tif (!state || !state.isSubmitted) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn this.settings.showSolution ?? false;\n\t}\n\n\t/**\n\t * Check if candidate can navigate to a previously answered item\n\t */\n\tcanReview(itemIdentifier: string): boolean {\n\t\tconst state = this.sessionStates.get(itemIdentifier);\n\t\tif (!state || !state.isSubmitted) {\n\t\t\treturn true; // Can always navigate to unsubmitted items\n\t\t}\n\n\t\treturn this.settings.allowReview ?? true;\n\t}\n\n\t/**\n\t * Check if candidate can skip an item without answering\n\t */\n\tcanSkip(_itemIdentifier: string): boolean {\n\t\treturn this.settings.allowSkipping ?? true;\n\t}\n\n\t/**\n\t * Check if responses must be validated before navigation\n\t */\n\tmustValidateResponses(): boolean {\n\t\treturn this.settings.validateResponses ?? false;\n\t}\n\n\t/**\n\t * Validate that an item has valid responses (if validation is required)\n\t */\n\tvalidateItem(itemIdentifier: string, hasValidResponses: boolean): {\n\t\tisValid: boolean;\n\t\terror?: string;\n\t} {\n\t\tif (!this.mustValidateResponses()) {\n\t\t\treturn { isValid: true };\n\t\t}\n\n\t\tconst state = this.sessionStates.get(itemIdentifier);\n\t\tif (!state) {\n\t\t\treturn { isValid: true };\n\t\t}\n\n\t\t// If item is required and has no valid responses, fail validation\n\t\tif (!hasValidResponses) {\n\t\t\treturn {\n\t\t\t\tisValid: false,\n\t\t\t\terror: 'This item requires a valid response before continuing.',\n\t\t\t};\n\t\t}\n\n\t\treturn { isValid: true };\n\t}\n\n\t/**\n\t * Check if navigation away from current item is allowed\n\t */\n\tcanNavigateAway(itemIdentifier: string, hasValidResponses: boolean): {\n\t\tallowed: boolean;\n\t\treason?: string;\n\t} {\n\t\tconst state = this.sessionStates.get(itemIdentifier);\n\t\tif (!state) {\n\t\t\treturn { allowed: true };\n\t\t}\n\n\t\t// Check if skipping is allowed when item is unanswered\n\t\tif (!state.isAnswered && !this.canSkip(itemIdentifier)) {\n\t\t\treturn {\n\t\t\t\tallowed: false,\n\t\t\t\treason: 'You must answer this item before continuing.',\n\t\t\t};\n\t\t}\n\n\t\t// Check validation requirements\n\t\tif (this.mustValidateResponses() && state.isAnswered && !hasValidResponses) {\n\t\t\treturn {\n\t\t\t\tallowed: false,\n\t\t\t\treason: 'Please provide valid responses before continuing.',\n\t\t\t};\n\t\t}\n\n\t\treturn { allowed: true };\n\t}\n\n\t/**\n\t * Get full settings\n\t */\n\tgetSettings(): ItemSessionControlSettings {\n\t\treturn { ...this.settings };\n\t}\n\n\t/**\n\t * Update settings (useful for different sections with different controls)\n\t */\n\tupdateSettings(settings: Partial<ItemSessionControlSettings>): void {\n\t\tthis.settings = { ...this.settings, ...settings };\n\t}\n\n\t/**\n\t * Get all session states (for persistence)\n\t */\n\tgetAllStates(): Map<string, ItemSessionState> {\n\t\treturn new Map(this.sessionStates);\n\t}\n\n\t/**\n\t * Restore session states (from persistence)\n\t */\n\trestoreStates(states: Map<string, ItemSessionState>): void {\n\t\tthis.sessionStates = new Map(states);\n\t}\n\n\t/**\n\t * Reset session state for an item (useful for practice/retry scenarios)\n\t */\n\tresetItem(itemIdentifier: string): void {\n\t\tconst state = this.sessionStates.get(itemIdentifier);\n\t\tif (state) {\n\t\t\tstate.attemptCount = 0;\n\t\t\tstate.isAnswered = false;\n\t\t\tstate.isSubmitted = false;\n\t\t\tstate.lastSubmissionTime = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * Clear all session states\n\t */\n\tclear(): void {\n\t\tthis.sessionStates.clear();\n\t}\n}\n","import type { SerializedItemSessionState } from '@pie-qti/item-player';\nimport type { AssessmentSessionState } from '../integration/api-contract.js';\nimport type { ItemResult } from '../types/index.js';\nimport {\n\tItemSessionController,\n\ttype ItemSessionControlSettings,\n\ttype ItemSessionState,\n} from './ItemSessionController.js';\n\nexport interface AssessmentSessionCoordinatorOptions {\n\tstate: AssessmentSessionState;\n\titemIdentifiers: string[];\n\titemSessionControl?: ItemSessionControlSettings;\n}\n\nexport interface ItemSessionInfo {\n\tcanSubmit: boolean;\n\tremainingAttempts: number | null;\n\tattemptCount: number;\n\tshowFeedback: boolean;\n\tshowSolution: boolean;\n\tcanReview: boolean;\n\tcanSkip: boolean;\n}\n\nexport class AssessmentSessionCoordinator {\n\t#state: AssessmentSessionState;\n\t#sessionController: ItemSessionController;\n\t#itemResults = new Map<string, ItemResult>();\n\t#itemIdentifiers: string[];\n\n\tconstructor({ state, itemIdentifiers, itemSessionControl }: AssessmentSessionCoordinatorOptions) {\n\t\tthis.#state = state;\n\t\tthis.#itemIdentifiers = itemIdentifiers;\n\t\tthis.#sessionController = new ItemSessionController(itemSessionControl);\n\t\tthis.#initializeItemSessions();\n\t\tthis.#restoreItemSessionsFromState(state);\n\t\tthis.#restoreItemResultsFromScores(state);\n\t}\n\n\tget state() {\n\t\treturn this.#state;\n\t}\n\n\trestoreState(state: AssessmentSessionState): void {\n\t\tthis.#state = state;\n\t\tthis.#restoreItemSessionsFromState(state);\n\t\tthis.#restoreItemResultsFromScores(state);\n\t}\n\n\tsnapshot(options: { includeItemSessions?: boolean } = {}): AssessmentSessionState {\n\t\treturn {\n\t\t\t...this.#state,\n\t\t\tvisitedItems: [...this.#state.visitedItems],\n\t\t\titemResponses: { ...this.#state.itemResponses },\n\t\t\titemScores: this.#state.itemScores ? { ...this.#state.itemScores } : undefined,\n\t\t\titemSessions:\n\t\t\t\toptions.includeItemSessions && this.#state.itemSessions\n\t\t\t\t\t? { ...this.#state.itemSessions }\n\t\t\t\t\t: undefined,\n\t\t\titemSessionStates: this.#itemSessionStateSnapshot(),\n\t\t\ttiming: {\n\t\t\t\t...this.#state.timing,\n\t\t\t\titemTimes: { ...this.#state.timing.itemTimes },\n\t\t\t},\n\t\t};\n\t}\n\n\tactivateItem(itemIdentifier: string): Record<string, unknown> {\n\t\tthis.#state.currentItemIdentifier = itemIdentifier;\n\t\treturn this.getResponses(itemIdentifier);\n\t}\n\n\tgetActiveResponses(): Record<string, unknown> {\n\t\treturn this.getResponses(this.#state.currentItemIdentifier);\n\t}\n\n\tgetResponses(itemIdentifier: string): Record<string, unknown> {\n\t\treturn { ...((this.#state.itemResponses?.[itemIdentifier] || {}) as Record<string, unknown>) };\n\t}\n\n\tupdateActiveResponse(responseId: string, value: unknown): Record<string, unknown> {\n\t\treturn this.updateResponseForItem(this.#state.currentItemIdentifier, responseId, value);\n\t}\n\n\tupdateResponseForItem(\n\t\titemIdentifier: string,\n\t\tresponseId: string,\n\t\tvalue: unknown\n\t): Record<string, unknown> {\n\t\tconst next = {\n\t\t\t...((this.#state.itemResponses?.[itemIdentifier] || {}) as Record<string, unknown>),\n\t\t\t[responseId]: value,\n\t\t};\n\t\tthis.#state.itemResponses[itemIdentifier] = next as any;\n\t\tthis.markAnswered(itemIdentifier, next);\n\t\treturn next;\n\t}\n\n\tsaveItemSession(\n\t\titemIdentifier: string,\n\t\tresponses: Record<string, unknown>,\n\t\tsessionState: SerializedItemSessionState,\n\t\tduration: number\n\t): void {\n\t\tthis.#state.itemSessions = {\n\t\t\t...(this.#state.itemSessions ?? {}),\n\t\t\t[itemIdentifier]: sessionState,\n\t\t};\n\t\tthis.#state.itemResponses[itemIdentifier] = responses as any;\n\t\tthis.#state.timing.itemTimes[itemIdentifier] = duration;\n\t\tthis.markAnswered(itemIdentifier, responses);\n\t}\n\n\tsetItemSession(itemIdentifier: string, sessionState: SerializedItemSessionState): void {\n\t\tthis.#state.itemSessions = {\n\t\t\t...(this.#state.itemSessions ?? {}),\n\t\t\t[itemIdentifier]: sessionState,\n\t\t};\n\t}\n\n\tmergeItemSessions(itemSessions: AssessmentSessionState['itemSessions']): void {\n\t\tif (!itemSessions) return;\n\t\tthis.#state.itemSessions = {\n\t\t\t...(this.#state.itemSessions ?? {}),\n\t\t\t...itemSessions,\n\t\t};\n\t}\n\n\treplaceStatePreservingItemSessions(updatedState: AssessmentSessionState): void {\n\t\tconst localItemSessions = this.#state.itemSessions;\n\t\tthis.restoreState(updatedState);\n\t\tthis.mergeItemSessions(localItemSessions);\n\t}\n\n\treplaceStatePreservingResponsesAndSessions(\n\t\tupdatedState: AssessmentSessionState,\n\t\titemResponses: AssessmentSessionState['itemResponses'],\n\t\titemSessions: AssessmentSessionState['itemSessions']\n\t): void {\n\t\tthis.restoreState(updatedState);\n\t\tthis.#state.itemResponses = itemResponses;\n\t\tthis.#state.itemSessions = itemSessions;\n\t}\n\n\tmarkVisited(itemIdentifier: string): void {\n\t\tif (!this.#state.visitedItems.includes(itemIdentifier)) {\n\t\t\tthis.#state.visitedItems.push(itemIdentifier);\n\t\t}\n\t}\n\n\tmarkAnswered(itemIdentifier: string, responses: Record<string, unknown>): void {\n\t\tthis.#sessionController.markAnswered(itemIdentifier, hasAnyResponse(responses));\n\t}\n\n\tcanReview(itemIdentifier: string): boolean {\n\t\treturn this.#sessionController.canReview(itemIdentifier);\n\t}\n\n\tcanNavigateAway(\n\t\titemIdentifier: string,\n\t\tresponses: Record<string, unknown>\n\t): { allowed: boolean; reason?: string } {\n\t\treturn this.#sessionController.canNavigateAway(itemIdentifier, hasAnyResponse(responses));\n\t}\n\n\tupdateItemSessionControl(settings: ItemSessionControlSettings): void {\n\t\tthis.#sessionController.updateSettings(settings);\n\t}\n\n\tmustValidateResponses(): boolean {\n\t\treturn this.#sessionController.mustValidateResponses();\n\t}\n\n\trecordAttempt(itemIdentifier: string): void {\n\t\tthis.#sessionController.recordAttempt(itemIdentifier);\n\t}\n\n\tsetItemResult(itemResult: ItemResult): void {\n\t\tthis.#itemResults.set(itemResult.itemIdentifier, itemResult);\n\t}\n\n\thasItemResult(itemIdentifier: string): boolean {\n\t\treturn this.#itemResults.has(itemIdentifier);\n\t}\n\n\tgetItemSessionInfo(itemIdentifier: string): ItemSessionInfo {\n\t\tif (!this.#sessionController.getItemState(itemIdentifier)) {\n\t\t\tthis.#sessionController.initializeItem(itemIdentifier);\n\t\t}\n\t\tconst state = this.#sessionController.getItemState(itemIdentifier);\n\t\treturn {\n\t\t\tcanSubmit: this.#sessionController.canSubmit(itemIdentifier),\n\t\t\tremainingAttempts: this.#sessionController.getRemainingAttempts(itemIdentifier),\n\t\t\tattemptCount: state?.attemptCount ?? 0,\n\t\t\tshowFeedback: this.#sessionController.shouldShowFeedback(itemIdentifier),\n\t\t\tshowSolution: this.#sessionController.shouldShowSolution(itemIdentifier),\n\t\t\tcanReview: this.#sessionController.canReview(itemIdentifier),\n\t\t\tcanSkip: this.#sessionController.canSkip(itemIdentifier),\n\t\t};\n\t}\n\n\t#initializeItemSessions(): void {\n\t\tfor (const itemIdentifier of this.#itemIdentifiers) {\n\t\t\tthis.#sessionController.initializeItem(itemIdentifier);\n\t\t}\n\t}\n\n\t#restoreItemSessionsFromState(state: AssessmentSessionState): void {\n\t\tconst restoredStates = new Map<string, ItemSessionState>();\n\t\tfor (const itemIdentifier of this.#itemIdentifiers) {\n\t\t\tconst persisted = state.itemSessionStates?.[itemIdentifier];\n\t\t\tif (persisted) {\n\t\t\t\trestoredStates.set(itemIdentifier, {\n\t\t\t\t\titemIdentifier,\n\t\t\t\t\tattemptCount: Math.max(0, persisted.attemptCount),\n\t\t\t\t\tisAnswered: persisted.isAnswered,\n\t\t\t\t\tisSubmitted: persisted.isSubmitted,\n\t\t\t\t\tlastSubmissionTime: persisted.lastSubmissionTime,\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst responses = state.itemResponses?.[itemIdentifier] ?? {};\n\t\t\tconst isSubmitted = Boolean(state.itemScores?.[itemIdentifier]);\n\t\t\trestoredStates.set(itemIdentifier, {\n\t\t\t\titemIdentifier,\n\t\t\t\tattemptCount: isSubmitted ? 1 : 0,\n\t\t\t\tisAnswered: hasAnyResponse(responses),\n\t\t\t\tisSubmitted,\n\t\t\t});\n\t\t}\n\t\tthis.#sessionController.restoreStates(restoredStates);\n\t}\n\n\t#restoreItemResultsFromScores(state: AssessmentSessionState): void {\n\t\tthis.#itemResults.clear();\n\t\tif (!state.itemScores) return;\n\t\tfor (const [itemIdentifier, scoring] of Object.entries(state.itemScores)) {\n\t\t\tthis.#itemResults.set(itemIdentifier, {\n\t\t\t\titemIdentifier,\n\t\t\t\tscore: scoring.score,\n\t\t\t\tmaxScore: scoring.maxScore,\n\t\t\t\tresponses: state.itemResponses?.[itemIdentifier] || {},\n\t\t\t});\n\t\t}\n\t}\n\n\t#itemSessionStateSnapshot(): Record<string, ItemSessionState> {\n\t\treturn Object.fromEntries(\n\t\t\t[...this.#sessionController.getAllStates().entries()].map(([itemIdentifier, state]) => [\n\t\t\t\titemIdentifier,\n\t\t\t\t{ ...state },\n\t\t\t])\n\t\t);\n\t}\n}\n\nfunction hasAnyResponse(responses: Record<string, unknown>): boolean {\n\tfor (const value of Object.values(responses)) {\n\t\tif (value == null) continue;\n\t\tif (Array.isArray(value)) {\n\t\t\tif (value.length > 0) return true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (typeof value === 'string') {\n\t\t\tif (value.trim().length > 0) return true;\n\t\t\tcontinue;\n\t\t}\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n","/**\n * NavigationManager\n *\n * Handles navigation logic for linear and nonlinear assessment modes.\n * - Linear: Sequential navigation only (can go back, but can't skip forward)\n * - Nonlinear: Free navigation (can jump to any item)\n */\n\nexport type NavigationMode = 'linear' | 'nonlinear';\n\nexport class NavigationManager {\n\tprivate mode: NavigationMode;\n\tprivate totalItems: number;\n\tprivate visitedItems: Set<number>;\n\n\tconstructor(mode: NavigationMode, totalItems: number) {\n\t\tthis.mode = mode;\n\t\tthis.totalItems = totalItems;\n\t\tthis.visitedItems = new Set<number>();\n\t}\n\n\t/**\n\t * Check if navigation to a specific index is allowed\n\t */\n\tcanNavigateTo(targetIndex: number, currentIndex: number): boolean {\n\t\t// Out of bounds check\n\t\tif (targetIndex < 0 || targetIndex >= this.totalItems) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// In nonlinear mode, can navigate anywhere\n\t\tif (this.mode === 'nonlinear') {\n\t\t\treturn true;\n\t\t}\n\n\t\t// In linear mode:\n\t\t// - Can go back to any visited item\n\t\t// - Can only go forward to the next unvisited item\n\t\tif (targetIndex <= currentIndex) {\n\t\t\treturn true; // Can always go back\n\t\t}\n\n\t\tif (targetIndex === currentIndex + 1) {\n\t\t\treturn true; // Can advance to next item\n\t\t}\n\n\t\t// Can't skip ahead in linear mode\n\t\treturn false;\n\t}\n\n\t/**\n\t * Check if \"next\" navigation is allowed\n\t */\n\tcanNext(currentIndex: number): boolean {\n\t\treturn currentIndex < this.totalItems - 1;\n\t}\n\n\t/**\n\t * Check if \"previous\" navigation is allowed\n\t */\n\tcanPrevious(currentIndex: number): boolean {\n\t\treturn currentIndex > 0;\n\t}\n\n\t/**\n\t * Get the next valid index\n\t */\n\tgetNextIndex(currentIndex: number): number | null {\n\t\tif (!this.canNext(currentIndex)) {\n\t\t\treturn null;\n\t\t}\n\t\treturn currentIndex + 1;\n\t}\n\n\t/**\n\t * Get the previous valid index\n\t */\n\tgetPreviousIndex(currentIndex: number): number | null {\n\t\tif (!this.canPrevious(currentIndex)) {\n\t\t\treturn null;\n\t\t}\n\t\treturn currentIndex - 1;\n\t}\n\n\t/**\n\t * Mark an item as visited\n\t */\n\tmarkVisited(index: number): void {\n\t\tthis.visitedItems.add(index);\n\t}\n\n\t/**\n\t * Check if an item has been visited\n\t */\n\tisVisited(index: number): boolean {\n\t\treturn this.visitedItems.has(index);\n\t}\n\n\t/**\n\t * Get all visited item indices\n\t */\n\tgetVisitedItems(): number[] {\n\t\treturn Array.from(this.visitedItems).sort((a, b) => a - b);\n\t}\n\n\t/**\n\t * Get navigation mode\n\t */\n\tgetMode(): NavigationMode {\n\t\treturn this.mode;\n\t}\n\n\t/**\n\t * Reset visited items (e.g., for retaking assessment)\n\t */\n\treset(): void {\n\t\tthis.visitedItems.clear();\n\t}\n\n\t/**\n\t * Restore state (for save/resume)\n\t */\n\trestoreState(visitedItems: number[]): void {\n\t\tthis.visitedItems = new Set(visitedItems);\n\t}\n}\n","/**\n * TimeManager\n *\n * Manages time limits and tracking for QTI assessments.\n * Supports test-level, section-level, and item-level time limits.\n *\n * Features:\n * - Countdown timers with warnings\n * - Auto-submission when time expires\n * - Time spent tracking per item\n * - Pause/resume support\n * - Late submission handling\n */\n\nimport type { TimeLimits } from '../types/index.js';\n\nexport interface TimeManagerConfig {\n\t/** Assessment-level time limits */\n\tassessmentTimeLimits?: TimeLimits;\n\t/** Warning threshold (seconds before expiry) */\n\twarningThreshold?: number;\n\t/** Callback when time warning is triggered */\n\tonWarning?: (remainingSeconds: number) => void;\n\t/** Callback when time expires */\n\tonExpired?: () => void;\n\t/** Callback for time updates (fires every second) */\n\tonTick?: (remainingSeconds: number, elapsedSeconds: number) => void;\n\t/**\n\t * QTI 3.0 PNP extended time accommodation.\n\t * When active, multiplies assessmentTimeLimits.maxTime by the given multiplier.\n\t * multiplier: Infinity removes the time limit entirely.\n\t */\n\textendedTime?: { active: boolean; multiplier: number };\n}\n\nexport interface TimeTrackingState {\n\t/** Total elapsed time (ms) */\n\ttotalElapsed: number;\n\t/** Time spent per item identifier (ms) */\n\titemTimes: Record<string, number>;\n\t/** Time spent per section identifier (ms) */\n\tsectionTimes: Record<string, number>;\n\t/** Session start timestamp */\n\tstartedAt: number;\n\t/** Current item start time (for tracking) */\n\tcurrentItemStartTime?: number;\n\t/** Current section identifier */\n\tcurrentSectionId?: string;\n\t/** Is timer currently paused */\n\tisPaused: boolean;\n}\n\nexport class TimeManager {\n\tprivate config: TimeManagerConfig;\n\tprivate state: TimeTrackingState;\n\n\t// Timer internals\n\tprivate intervalId: ReturnType<typeof setInterval> | null = null;\n\tprivate maxTimeSeconds: number | null = null;\n\tprivate warningTriggered = false;\n\n\tconstructor(config: TimeManagerConfig) {\n\t\tthis.config = config;\n\t\tthis.state = {\n\t\t\ttotalElapsed: 0,\n\t\t\titemTimes: {},\n\t\t\tsectionTimes: {},\n\t\t\tstartedAt: Date.now(),\n\t\t\tisPaused: false,\n\t\t};\n\n\t\t// Initialize timer if time limit exists, applying PNP extended-time multiplier if set.\n\t\tif (config.assessmentTimeLimits?.maxTime) {\n\t\t\tconst base = config.assessmentTimeLimits.maxTime;\n\t\t\tconst et = config.extendedTime;\n\t\t\tif (et?.active && et.multiplier === Infinity) {\n\t\t\t\t// multiplier: Infinity → unlimited time (no countdown)\n\t\t\t\tthis.maxTimeSeconds = null;\n\t\t\t} else if (et?.active && et.multiplier > 0) {\n\t\t\t\tthis.maxTimeSeconds = base * et.multiplier;\n\t\t\t} else {\n\t\t\t\tthis.maxTimeSeconds = base;\n\t\t\t}\n\t\t\tif (this.maxTimeSeconds !== null) {\n\t\t\t\tthis.startTimer();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Start or resume the timer\n\t */\n\tprivate startTimer(): void {\n\t\tif (this.intervalId) {\n\t\t\treturn; // Already running\n\t\t}\n\n\t\tthis.state.isPaused = false;\n\n\t\tthis.intervalId = setInterval(() => {\n\t\t\tif (this.state.isPaused) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.state.totalElapsed += 1000; // Increment by 1 second\n\n\t\t\tconst elapsedSeconds = Math.floor(this.state.totalElapsed / 1000);\n\n\t\t\t// Track item time if active\n\t\t\tif (this.state.currentItemStartTime) {\n\t\t\t\t// Item tracking handled by startItem/endItem\n\t\t\t}\n\n\t\t\t// Calculate remaining time\n\t\t\tif (this.maxTimeSeconds) {\n\t\t\t\tconst remainingSeconds = this.maxTimeSeconds - elapsedSeconds;\n\n\t\t\t\t// Trigger warning\n\t\t\t\tconst warningThreshold = this.config.warningThreshold || 60;\n\t\t\t\tif (!this.warningTriggered && remainingSeconds <= warningThreshold && remainingSeconds > 0) {\n\t\t\t\t\tthis.warningTriggered = true;\n\t\t\t\t\tthis.config.onWarning?.(remainingSeconds);\n\t\t\t\t}\n\n\t\t\t\t// Trigger expiration\n\t\t\t\tif (remainingSeconds <= 0) {\n\t\t\t\t\tthis.handleExpiration();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Tick callback\n\t\t\t\tthis.config.onTick?.(remainingSeconds, elapsedSeconds);\n\t\t\t} else {\n\t\t\t\t// No limit - just count up\n\t\t\t\tthis.config.onTick?.(0, elapsedSeconds);\n\t\t\t}\n\t\t}, 1000);\n\t}\n\n\t/**\n\t * Handle time expiration\n\t */\n\tprivate handleExpiration(): void {\n\t\tthis.stopTimer();\n\t\tthis.config.onExpired?.();\n\t}\n\n\t/**\n\t * Stop the timer\n\t */\n\tstopTimer(): void {\n\t\tif (this.intervalId) {\n\t\t\tclearInterval(this.intervalId);\n\t\t\tthis.intervalId = null;\n\t\t}\n\t}\n\n\t/**\n\t * Pause the timer\n\t */\n\tpause(): void {\n\t\tthis.state.isPaused = true;\n\t}\n\n\t/**\n\t * Resume the timer\n\t */\n\tresume(): void {\n\t\tthis.state.isPaused = false;\n\t}\n\n\t/**\n\t * Start tracking time for an item\n\t */\n\tstartItem(_itemIdentifier: string): void {\n\t\t// End previous item if any\n\t\tif (this.state.currentItemStartTime) {\n\t\t\tthis.endCurrentItem();\n\t\t}\n\n\t\tthis.state.currentItemStartTime = Date.now();\n\t}\n\n\t/**\n\t * End tracking time for current item\n\t */\n\tprivate endCurrentItem(): void {\n\t\tif (!this.state.currentItemStartTime) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst timeSpent = Date.now() - this.state.currentItemStartTime;\n\t\t// Note: We need the item identifier, which should be tracked separately\n\t\t// For now, we'll handle this in the endItem method\n\t\tthis.state.currentItemStartTime = undefined;\n\t}\n\n\t/**\n\t * End tracking time for an item\n\t */\n\tendItem(itemIdentifier: string): void {\n\t\tif (!this.state.currentItemStartTime) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst timeSpent = Date.now() - this.state.currentItemStartTime;\n\t\tthis.state.itemTimes[itemIdentifier] = (this.state.itemTimes[itemIdentifier] || 0) + timeSpent;\n\t\tthis.state.currentItemStartTime = undefined;\n\t}\n\n\t/**\n\t * Start tracking time for a section\n\t */\n\tstartSection(sectionIdentifier: string): void {\n\t\tthis.state.currentSectionId = sectionIdentifier;\n\t}\n\n\t/**\n\t * Get remaining time in seconds (null if no limit)\n\t */\n\tgetRemainingSeconds(): number | null {\n\t\tif (!this.maxTimeSeconds) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst elapsedSeconds = Math.floor(this.state.totalElapsed / 1000);\n\t\treturn Math.max(0, this.maxTimeSeconds - elapsedSeconds);\n\t}\n\n\t/**\n\t * Get elapsed time in seconds\n\t */\n\tgetElapsedSeconds(): number {\n\t\treturn Math.floor(this.state.totalElapsed / 1000);\n\t}\n\n\t/**\n\t * Get time spent on a specific item (ms)\n\t */\n\tgetItemTime(itemIdentifier: string): number {\n\t\treturn this.state.itemTimes[itemIdentifier] || 0;\n\t}\n\n\t/**\n\t * Get current tracking state (for persistence)\n\t */\n\tgetState(): TimeTrackingState {\n\t\treturn { ...this.state };\n\t}\n\n\t/**\n\t * Restore tracking state (for resume)\n\t */\n\trestoreState(state: TimeTrackingState): void {\n\t\tthis.state = { ...state };\n\n\t\t// Restart timer if not expired\n\t\tif (this.maxTimeSeconds) {\n\t\t\tconst elapsedSeconds = Math.floor(this.state.totalElapsed / 1000);\n\t\t\tif (elapsedSeconds < this.maxTimeSeconds) {\n\t\t\t\tthis.startTimer();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Check if time has expired\n\t */\n\tisExpired(): boolean {\n\t\tif (!this.maxTimeSeconds) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst elapsedSeconds = Math.floor(this.state.totalElapsed / 1000);\n\t\treturn elapsedSeconds >= this.maxTimeSeconds;\n\t}\n\n\t/**\n\t * Check if late submission is allowed\n\t */\n\tallowsLateSubmission(): boolean {\n\t\treturn this.config.assessmentTimeLimits?.allowLateSubmission || false;\n\t}\n\n\t/**\n\t * Format time as MM:SS or HH:MM:SS\n\t */\n\tstatic formatTime(seconds: number): string {\n\t\tconst hours = Math.floor(seconds / 3600);\n\t\tconst minutes = Math.floor((seconds % 3600) / 60);\n\t\tconst secs = seconds % 60;\n\n\t\tif (hours > 0) {\n\t\t\treturn `${hours}:${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;\n\t\t}\n\n\t\treturn `${minutes}:${secs.toString().padStart(2, '0')}`;\n\t}\n\n\t/**\n\t * Cleanup - stop all timers\n\t */\n\tdestroy(): void {\n\t\tthis.stopTimer();\n\t}\n}\n","/**\n * AssessmentPlayer (backend-authoritative)\n *\n * Client responsibilities:\n * - Render items using @pie-qti/item-player\n * - Collect candidate responses\n * - Submit responses to BackendAdapter\n * - Apply backend navigation decisions + session state\n */\n\nimport type { QTIRole, PnpProfile, SerializedItemSessionState } from '@pie-qti/item-player';\nimport { Player } from '@pie-qti/item-player';\nimport type {\n\tAssessmentRubricBlock,\n\tAssessmentSessionState,\n\tAssessmentScoringResult,\n\tBackendAdapter,\n\tFinalizeAssessmentResponse,\n\tInitSessionRequest,\n\tInitSessionResponse,\n\tSecureAssessment,\n\tSecureItemRef,\n\tSecureSection,\n\tSecureTestPart,\n\tSessionId,\n} from '../integration/api-contract.js';\nimport type {\n\tAssessmentResults,\n\tItemResult,\n\tNavigationState,\n\tTimeLimits,\n} from '../types/index.js';\nimport { AssessmentSessionCoordinator } from './AssessmentSessionCoordinator.js';\nimport { NavigationManager } from './NavigationManager.js';\nimport { TimeManager } from './TimeManager.js';\n\nexport interface BackendAssessmentPlayerConfig {\n\tbackend: BackendAdapter;\n\tinitSession: InitSessionRequest;\n\trole?: QTIRole;\n\t/** Optional RNG for deterministic shuffling in selection/ordering. Defaults to Math.random. */\n\trng?: () => number;\n\t/**\n\t * Optional hint for item renderers that support multiple extended text editors.\n\t * (Plumbed through the shell; the item player remains authoritative for behavior.)\n\t */\n\textendedTextEditor?: string;\n\t/**\n\t * Optional i18n provider for internationalization.\n\t * If provided, this will be shared across all item players in the assessment.\n\t */\n\ti18nProvider?: any; // Will be I18nProvider from @pie-qti/i18n\n\t/**\n\t * Security configuration for URL policy and content restrictions.\n\t * If provided, this will be passed to all item players in the assessment.\n\t */\n\tsecurity?: any; // Will be PlayerSecurityConfig from @pie-qti/item-player\n\t/**\n\t * Demo/reference-only escape hatch. When false (default), rich item-session\n\t * variables stay client-local and are not submitted because template variables\n\t * can contain answer keys. Production backends should own this state server-side.\n\t */\n\tsendItemSessionToBackend?: boolean;\n\t// UI options\n\tshowSections?: boolean;\n\tallowSectionNavigation?: boolean;\n\tshowProgress?: boolean;\n\t// Time management\n\ttimeWarningThreshold?: number;\n\t/**\n\t * QTI 3.0 §6.2 Personal Needs and Preferences profile.\n\t * Extended time (pnp.content.extendedTime) is applied to assessment timeLimits.\n\t * The full profile is passed down to each item player for component-level features\n\t * (color scheme, elimination tool).\n\t */\n\tpnp?: PnpProfile;\n\t// Callbacks\n\tonItemChange?: (itemIndex: number, totalItems: number) => void;\n\tonSectionChange?: (sectionIndex: number, totalSections: number) => void;\n\tonResponseChange?: (responses: Record<string, unknown>) => void;\n\tonComplete?: () => void;\n}\n\ntype FlatItem = {\n\tidentifier: string;\n\titem: SecureItemRef;\n\tsection: SecureSection;\n\ttestPart: SecureTestPart;\n\tindex: number;\n\tsectionIndex: number;\n};\n\ntype CurrentItemView = {\n\tidentifier: string;\n\ttitle?: string;\n\trequired?: boolean;\n\titemXml: string;\n\tdeliveryContext?: SecureItemRef['deliveryContext'];\n};\n\nexport interface EffectiveItemTimeLimits {\n\ttimeLimits?: TimeLimits;\n\tsource?: 'item' | 'section' | 'testPart' | 'assessment';\n}\n\ntype ItemSessionCapablePlayer = Player & {\n\tsuspendAttempt(): { sessionState: SerializedItemSessionState; duration: number };\n\tendAttempt(options?: { countAttempt?: boolean; validateResponses?: boolean }): {\n\t\tsessionState: SerializedItemSessionState;\n\t\tduration: number;\n\t\tvalidation?: { valid: boolean; issues: Array<{ message: string }> };\n\t};\n\trestoreItemSession(state: SerializedItemSessionState): void;\n};\n\nexport class AssessmentPlayer {\n\tpublic static async create(config: BackendAssessmentPlayerConfig): Promise<AssessmentPlayer> {\n\t\tconst init = await config.backend.initSession(config.initSession);\n\t\treturn new AssessmentPlayer(config, init);\n\t}\n\n\tprivate backend: BackendAdapter;\n\tprivate sessionId: SessionId;\n\tprivate assessment: SecureAssessment;\n\tprivate i18nProvider: any; // I18nProvider from @pie-qti/i18n\n\n\tprivate navigationManager: NavigationManager;\n\tprivate sessionCoordinator!: AssessmentSessionCoordinator;\n\tprivate timeManager: TimeManager | null = null;\n\n\tprivate items: FlatItem[] = [];\n\tprivate currentItemIndex = -1;\n\tprivate currentItemPlayer: Player | null = null;\n\tprivate visibleFeedback: Array<{ identifier: string; content: string; access: string }> = [];\n\n\t// Event listeners\n\tprivate itemChangeListeners = new Set<(index: number, total: number) => void>();\n\tprivate sectionChangeListeners = new Set<(index: number, total: number) => void>();\n\tprivate responseChangeListeners = new Set<(responses: Record<string, unknown>) => void>();\n\tprivate completeListeners = new Set<() => void>();\n\tprivate timeWarningListeners = new Set<(remainingSeconds: number) => void>();\n\tprivate timeExpiredListeners = new Set<() => void>();\n\tprivate timeTickListeners = new Set<(remainingSeconds: number, elapsedSeconds: number) => void>();\n\n\tprivate constructor(private config: BackendAssessmentPlayerConfig, init: InitSessionResponse) {\n\t\tthis.backend = config.backend;\n\t\tthis.sessionId = init.sessionId;\n\t\tthis.assessment = init.assessment;\n\t\tthis.i18nProvider = config.i18nProvider ?? this.createDefaultI18nProvider();\n\t\tconst initialState =\n\t\t\tinit.restoredState ??\n\t\t\t({\n\t\t\t\tcurrentItemIdentifier: '',\n\t\t\t\tvisitedItems: [],\n\t\t\t\titemResponses: {},\n\t\t\t\titemScores: {},\n\t\t\t\titemSessions: {},\n\t\t\t\ttiming: { startedAt: Date.now(), itemTimes: {}, totalTime: 0 },\n\t\t\t} as AssessmentSessionState);\n\n\t\tthis.items = this.flattenItems(this.assessment);\n\n\t\tconst navigationMode = this.assessment.navigationMode || 'nonlinear';\n\t\tthis.navigationManager = new NavigationManager(navigationMode, this.items.length);\n\n\t\t// Item session control is a UI hint; backend remains authoritative.\n\t\t// Start with testPart-level defaults; section-level overrides are applied per item in navigateTo().\n\t\tconst itemSessionControl = this.assessment.testParts?.[0]?.itemSessionControl;\n\t\tthis.sessionCoordinator = new AssessmentSessionCoordinator({\n\t\t\tstate: initialState,\n\t\t\titemIdentifiers: this.items.map((q) => q.identifier),\n\t\t\titemSessionControl,\n\t\t});\n\n\t\tthis.timeManager = new TimeManager({\n\t\t\tassessmentTimeLimits: this.assessment.timeLimits,\n\t\t\twarningThreshold: config.timeWarningThreshold || 60,\n\t\t\textendedTime: config.pnp?.content?.extendedTime,\n\t\t\tonWarning: (remainingSeconds) => this.notifyTimeWarning(remainingSeconds),\n\t\t\tonExpired: () => this.notifyTimeExpired(),\n\t\t\tonTick: (remainingSeconds, elapsedSeconds) => this.notifyTimeTick(remainingSeconds, elapsedSeconds),\n\t\t});\n\n\t\t// Restore to backend-provided current item if present\n\t\tconst startId = this.state.currentItemIdentifier;\n\t\tconst idx = startId ? this.items.findIndex((q) => q.identifier === startId) : -1;\n\t\tif (idx >= 0) {\n\t\t\tthis.navigateTo(idx, { restoring: true }).catch(() => {});\n\t\t} else if (this.items.length > 0) {\n\t\t\tthis.navigateTo(0, { restoring: true }).catch(() => {});\n\t\t}\n\t}\n\n\tprivate get state(): AssessmentSessionState {\n\t\treturn this.sessionCoordinator.state;\n\t}\n\n\tprivate set state(state: AssessmentSessionState) {\n\t\tthis.sessionCoordinator.restoreState(state);\n\t}\n\n\t/**\n\t * Compute effective itemSessionControl for a given item using three-level fallback:\n\t * section-level (highest priority) → testPart-level → defaults.\n\t * Section-level values override testPart-level when present.\n\t */\n\tprivate getEffectiveItemSessionControl(flat: FlatItem): SecureSection['itemSessionControl'] {\n\t\tconst testPartControl = flat.testPart.itemSessionControl;\n\t\tconst sectionControl = flat.section.itemSessionControl;\n\n\t\tif (!sectionControl) return testPartControl;\n\t\tif (!testPartControl) return sectionControl;\n\n\t\treturn {\n\t\t\tmaxAttempts: sectionControl.maxAttempts ?? testPartControl.maxAttempts,\n\t\t\tshowFeedback: sectionControl.showFeedback ?? testPartControl.showFeedback,\n\t\t\tallowReview: sectionControl.allowReview ?? testPartControl.allowReview,\n\t\t\tshowSolution: sectionControl.showSolution ?? testPartControl.showSolution,\n\t\t\tallowComment: sectionControl.allowComment ?? testPartControl.allowComment,\n\t\t\tallowSkipping: sectionControl.allowSkipping ?? testPartControl.allowSkipping,\n\t\t\tvalidateResponses: sectionControl.validateResponses ?? testPartControl.validateResponses,\n\t\t};\n\t}\n\n\tprivate getEffectiveItemTimeLimits(flat: FlatItem): EffectiveItemTimeLimits {\n\t\tconst scopes: Array<{ source: EffectiveItemTimeLimits['source']; limits?: TimeLimits }> = [\n\t\t\t{ source: 'assessment', limits: this.assessment.timeLimits },\n\t\t\t{ source: 'testPart', limits: flat.testPart.timeLimits },\n\t\t\t{ source: 'section', limits: flat.section.timeLimits },\n\t\t\t{ source: 'item', limits: flat.item.timeLimits },\n\t\t];\n\t\tlet source: EffectiveItemTimeLimits['source'];\n\t\tlet minTime: number | undefined;\n\t\tlet maxTime: number | undefined;\n\t\tlet allowLateSubmission: boolean | undefined;\n\t\tfor (const scope of scopes) {\n\t\t\tif (!scope.limits) continue;\n\t\t\tif (scope.limits.minTime !== undefined) {\n\t\t\t\tminTime = minTime === undefined ? scope.limits.minTime : Math.max(minTime, scope.limits.minTime);\n\t\t\t}\n\t\t\tif (scope.limits.maxTime !== undefined) {\n\t\t\t\tconst extended = this.config.pnp?.content?.extendedTime;\n\t\t\t\tconst scopedMaxTime = extended?.active\n\t\t\t\t\t? extended.multiplier === Infinity\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: scope.limits.maxTime * extended.multiplier\n\t\t\t\t\t: scope.limits.maxTime;\n\t\t\t\tif (scopedMaxTime !== undefined && (maxTime === undefined || scopedMaxTime < maxTime)) {\n\t\t\t\t\tmaxTime = scopedMaxTime;\n\t\t\t\t\tsource = scope.source;\n\t\t\t\t\tallowLateSubmission = scope.limits.allowLateSubmission;\n\t\t\t\t}\n\t\t\t} else if (scope.limits.allowLateSubmission !== undefined && maxTime === undefined) {\n\t\t\t\tallowLateSubmission = scope.limits.allowLateSubmission;\n\t\t\t\tsource = scope.source;\n\t\t\t}\n\t\t}\n\n\t\tif (maxTime === undefined && minTime === undefined && allowLateSubmission === undefined) {\n\t\t\treturn {};\n\t\t}\n\t\treturn { source, timeLimits: { minTime, maxTime, allowLateSubmission } };\n\t}\n\n\tpublic getCurrentEffectiveTimeLimits(): EffectiveItemTimeLimits {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\treturn q ? this.getEffectiveItemTimeLimits(q) : {};\n\t}\n\n\tprivate getSubmitTimingEvidence(q: FlatItem, elapsedMs: number): import('../integration/api-contract.js').SubmitTimingEvidence | undefined {\n\t\tconst effective = this.getEffectiveItemTimeLimits(q);\n\t\tconst limitSeconds = effective.timeLimits?.maxTime;\n\t\tif (!effective.source || limitSeconds === undefined) return undefined;\n\t\tif (effective.source !== 'item' && effective.source !== 'assessment') {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst scopedElapsedMs = effective.source === 'assessment'\n\t\t\t? (this.timeManager?.getElapsedSeconds() ?? 0) * 1000\n\t\t\t: elapsedMs;\n\t\treturn {\n\t\t\tscope: effective.source,\n\t\t\telapsedMs: scopedElapsedMs,\n\t\t\tlimitSeconds,\n\t\t\texpired: scopedElapsedMs >= limitSeconds * 1000,\n\t\t\tallowLateSubmission: effective.timeLimits?.allowLateSubmission,\n\t\t};\n\t}\n\n\tprivate flattenItems(assessment: SecureAssessment): FlatItem[] {\n\t\tconst out: FlatItem[] = [];\n\t\tconst testParts = assessment.testParts || [];\n\t\tlet idx = 0;\n\t\tlet secIdx = 0;\n\t\tconst rng = this.config.rng ?? Math.random;\n\n\t\tfor (const tp of testParts) {\n\t\t\tfor (const section of tp.sections || []) {\n\t\t\t\tlet refs = [...(section.assessmentItemRefs || [])];\n\n\t\t\t\t// QTI ordering: shuffle items within the section when requested.\n\t\t\t\t// The server may have already shuffled; if not (e.g. reference adapter), do it client-side.\n\t\t\t\tif (section.ordering?.shuffle) {\n\t\t\t\t\trefs = shuffleArray(refs, rng);\n\t\t\t\t}\n\n\t\t\t\t// QTI selection: take only `select` items from the (possibly shuffled) list.\n\t\t\t\tif (section.selection && section.selection.select > 0 && section.selection.select < refs.length) {\n\t\t\t\t\trefs = refs.slice(0, section.selection.select);\n\t\t\t\t}\n\n\t\t\t\tfor (const item of refs) {\n\t\t\t\t\tout.push({\n\t\t\t\t\t\tidentifier: item.identifier,\n\t\t\t\t\t\titem,\n\t\t\t\t\t\tsection,\n\t\t\t\t\t\ttestPart: tp,\n\t\t\t\t\t\tindex: idx++,\n\t\t\t\t\t\tsectionIndex: secIdx,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tsecIdx++;\n\t\t\t}\n\t\t}\n\t\treturn out;\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Public API used by components\n\t// ---------------------------------------------------------------------------\n\n\tpublic getAllSections(): Array<{ id: string; title?: string; visible: boolean; index: number }> {\n\t\tconst out: Array<{ id: string; title?: string; visible: boolean; index: number }> = [];\n\t\tlet idx = 0;\n\t\tfor (const tp of this.assessment.testParts || []) {\n\t\t\tfor (const s of tp.sections || []) {\n\t\t\t\tout.push({ id: s.identifier, title: s.title, visible: s.visible, index: idx++ });\n\t\t\t}\n\t\t}\n\t\treturn out;\n\t}\n\n\tpublic getNavigationState(): NavigationState {\n\t\tconst total = this.items.length;\n\t\tconst canPrevious = this.canPrevious();\n\t\tconst canNext = this.canNext();\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tconst totalSections = this.getAllSections().length;\n\t\treturn {\n\t\t\tcurrentIndex: this.currentItemIndex,\n\t\t\ttotalItems: total,\n\t\t\tcanNext,\n\t\t\tcanPrevious,\n\t\t\tisLoading: false,\n\t\t\tcurrentSection: q\n\t\t\t\t? { id: q.section.identifier, title: q.section.title, index: q.sectionIndex }\n\t\t\t\t: undefined,\n\t\t\ttotalSections,\n\t\t};\n\t}\n\n\tpublic getCurrentItem(): CurrentItemView | null {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q) return null;\n\t\treturn {\n\t\t\tidentifier: q.item.identifier,\n\t\t\ttitle: q.section.title,\n\t\t\trequired: q.item.required,\n\t\t\titemXml: q.item.itemXml,\n\t\t\tdeliveryContext: q.item.deliveryContext,\n\t\t};\n\t}\n\n\tpublic getCurrentRubricBlocks(): AssessmentRubricBlock[] {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q) return [];\n\t\treturn q.section.rubricBlocks || q.testPart.rubricBlocks || [];\n\t}\n\n\tpublic getVisibleFeedback(): Array<{ identifier: string; content: string; access: string }> {\n\t\treturn this.visibleFeedback;\n\t}\n\n\tpublic updateResponse(responseId: string, value: unknown): void {\n\t\tthis.sessionCoordinator.updateActiveResponse(responseId, value);\n\t\tthis.notifyResponseChange();\n\t}\n\n\t/**\n\t * Update a response for a specific item.\n\t * Useful when response events are observed outside the current-item renderer and we\n\t * want to be explicit about which item receives the response (some assessments reuse\n\t * the same responseIdentifier like \"RESPONSE\" across items).\n\t */\n\tpublic updateResponseForItem(itemIdentifier: string, responseId: string, value: unknown): void {\n\t\tconst next = this.sessionCoordinator.updateResponseForItem(itemIdentifier, responseId, value);\n\n\t\t// If this is the active item, keep the live response state + UI hints in sync.\n\t\tconst active = this.items[this.currentItemIndex];\n\t\tif (active?.identifier === itemIdentifier) {\n\t\t\tthis.currentItemPlayer?.setResponses(next as any);\n\t\t\tthis.notifyResponseChange();\n\t\t}\n\t}\n\n\t/**\n\t * Get current unsaved responses for the active item.\n\t * (Useful for host integrations / web components.)\n\t */\n\tpublic getResponses(): Record<string, unknown> {\n\t\treturn this.sessionCoordinator.getActiveResponses();\n\t}\n\n\tpublic saveCurrentItemSession(): SerializedItemSessionState | null {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q || !this.currentItemPlayer) return null;\n\t\tconst responses = this.sessionCoordinator.getActiveResponses();\n\t\tthis.currentItemPlayer.setResponses(responses as any);\n\t\tconst result = (this.currentItemPlayer as ItemSessionCapablePlayer).suspendAttempt();\n\t\tthis.sessionCoordinator.saveItemSession(q.identifier, responses, result.sessionState, result.duration);\n\t\treturn result.sessionState;\n\t}\n\n\tprivate endItemSessionForSubmit(\n\t\tq: FlatItem,\n\t\tresponses: Record<string, unknown>,\n\t\titemSession?: SerializedItemSessionState\n\t): SerializedItemSessionState {\n\t\tconst player = new Player({\n\t\t\titemXml: q.item.itemXml,\n\t\t\trole: q.item.role,\n\t\t\ti18nProvider: this.i18nProvider,\n\t\t\tpnp: this.config.pnp,\n\t\t\tsecurity: this.config.security,\n\t\t\tdeliveryContext: q.item.deliveryContext,\n\t\t}) as ItemSessionCapablePlayer;\n\t\tif (itemSession) {\n\t\t\tplayer.restoreItemSession(itemSession);\n\t\t}\n\t\tplayer.setResponses(responses as any);\n\t\treturn player.endAttempt().sessionState;\n\t}\n\n\t/**\n\t * Get the current session state snapshot (client-side view).\n\t * Note: backend remains authoritative; this is intended for simple save/resume.\n\t */\n\tpublic getState(options: { includeItemSessions?: boolean } = {}): AssessmentSessionState {\n\t\treturn this.sessionCoordinator.snapshot(options);\n\t}\n\n\t/**\n\t * Restore a previously saved session state.\n\t */\n\tpublic async restoreState(state: AssessmentSessionState): Promise<void> {\n\t\tthis.state = state;\n\n\t\t// Restore visited state for UI navigation hints.\n\t\tconst visitedIdx = (state.visitedItems || [])\n\t\t\t.map((id) => this.items.findIndex((q) => q.identifier === id))\n\t\t\t.filter((i) => i >= 0);\n\t\tthis.navigationManager.restoreState(visitedIdx);\n\n\t\tconst currentId = state.currentItemIdentifier;\n\t\tconst idx = currentId ? this.items.findIndex((q) => q.identifier === currentId) : -1;\n\t\tif (idx >= 0) {\n\t\t\tawait this.navigateTo(idx, { restoring: true });\n\t\t} else if (this.items.length > 0) {\n\t\t\tawait this.navigateTo(0, { restoring: true });\n\t\t}\n\t}\n\n\tpublic async navigateTo(index: number, options: { restoring?: boolean } = {}): Promise<void> {\n\t\tif (index < 0 || index >= this.items.length) throw new Error(`Invalid item index: ${index}`);\n\n\t\t// Enforce navigation rules (UI hints, still backend-authoritative for real deployments).\n\t\tif (!options.restoring && this.currentItemIndex >= 0 && !this.navigationManager.canNavigateTo(index, this.currentItemIndex)) {\n\t\t\tif (this.navigationManager.getMode() === 'linear' && index > this.currentItemIndex + 1) {\n\t\t\t\tthrow new Error('In linear navigation mode, you can only move to the next question.');\n\t\t\t}\n\t\t\tthrow new Error('Navigation is not allowed.');\n\t\t}\n\t\tconst target = this.items[index];\n\t\tif (!options.restoring && target && !this.sessionCoordinator.canReview(target.identifier)) {\n\t\t\tthrow new Error('You cannot go back to previous questions in this assessment.');\n\t\t}\n\n\t\tconst currentItem = this.items[this.currentItemIndex];\n\t\tconst currentSessionStatus = currentItem ? this.state.itemSessions?.[currentItem.identifier]?.lifecycleStatus : undefined;\n\t\tif (\n\t\t\t!options.restoring &&\n\t\t\tthis.currentItemIndex >= 0 &&\n\t\t\tthis.currentItemIndex !== index &&\n\t\t\tcurrentSessionStatus !== 'closed'\n\t\t) {\n\t\t\tthis.saveCurrentItemSession();\n\t\t}\n\t\tif (currentItem && this.currentItemIndex !== index) {\n\t\t\tthis.timeManager?.endItem(currentItem.identifier);\n\t\t}\n\n\t\tthis.currentItemIndex = index;\n\t\tconst q = this.items[index]!;\n\t\tthis.state.currentItemIdentifier = q.identifier;\n\t\tthis.timeManager?.startSection(q.section.identifier);\n\t\tthis.timeManager?.startItem(q.identifier);\n\n\t\t// Apply three-level itemSessionControl fallback for this item's section (S1).\n\t\tconst effectiveControl = this.getEffectiveItemSessionControl(q);\n\t\tif (effectiveControl) {\n\t\t\tthis.sessionCoordinator.updateItemSessionControl(effectiveControl);\n\t\t}\n\n\t\t// Restore responses\n\t\tconst responses = this.sessionCoordinator.activateItem(q.identifier);\n\n\t\t// Create item player\n\t\tthis.currentItemPlayer?.destroy();\n\t\tthis.currentItemPlayer = new Player({\n\t\t\titemXml: q.item.itemXml,\n\t\t\trole: q.item.role,\n\t\t\ti18nProvider: this.i18nProvider,\n\t\t\tpnp: this.config.pnp,\n\t\t\tsecurity: this.config.security,\n\t\t\tdeliveryContext: q.item.deliveryContext,\n\t\t});\n\t\tconst restoredItemSession = this.state.itemSessions?.[q.identifier];\n\t\tif (restoredItemSession) {\n\t\t\t(this.currentItemPlayer as ItemSessionCapablePlayer).restoreItemSession(restoredItemSession);\n\t\t} else {\n\t\t\tthis.currentItemPlayer.setResponses(responses as any);\n\t\t}\n\n\t\tthis.notifyItemChange();\n\t\tthis.notifySectionChange();\n\t}\n\n\tpublic async navigateToSection(sectionId: string): Promise<void> {\n\t\tconst idx = this.items.findIndex((q) => q.section.identifier === sectionId);\n\t\tif (idx >= 0) await this.navigateTo(idx);\n\t}\n\n\tpublic async next(): Promise<void> {\n\t\tconst state = this.getNavigationState();\n\t\tif (!state.canNext) return;\n\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (q) {\n\t\t\tconst responses = this.sessionCoordinator.getActiveResponses();\n\t\t\tthis.sessionCoordinator.markAnswered(q.identifier, responses);\n\n\t\t\tconst navAway = this.sessionCoordinator.canNavigateAway(q.identifier, responses);\n\t\t\tif (!navAway.allowed) {\n\t\t\t\tthrow new Error(navAway.reason || 'You must answer this question before continuing.');\n\t\t\t}\n\n\t\t\t// In individual submission mode, submit current item before moving forward.\n\t\t\tif (this.assessment.submissionMode === 'individual') {\n\t\t\t\tconst before = this.currentItemIndex;\n\t\t\t\tawait this.submitCurrentItem();\n\t\t\t\t// submitCurrentItem may branch/navigate; if it did, we're done.\n\t\t\t\tif (this.currentItemIndex !== before) return;\n\t\t\t}\n\t\t}\n\n\t\tawait this.navigateTo(this.currentItemIndex + 1);\n\t}\n\n\tpublic async previous(): Promise<void> {\n\t\tconst state = this.getNavigationState();\n\t\tif (!state.canPrevious) return;\n\t\tawait this.navigateTo(this.currentItemIndex - 1);\n\t}\n\n\t/** Submit current item (server-side scoring) */\n\tpublic async submitCurrentItem(): Promise<ItemResult> {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q) throw new Error('No current item');\n\n\t\tconst submittedAt = Date.now();\n\t\tlet itemSession: SerializedItemSessionState | undefined;\n\t\tconst responses = this.sessionCoordinator.getActiveResponses();\n\t\tif (this.currentItemPlayer) {\n\t\t\tthis.currentItemPlayer.setResponses(responses as any);\n\t\t\tconst attempt = (this.currentItemPlayer as ItemSessionCapablePlayer).endAttempt({\n\t\t\t\tvalidateResponses: this.sessionCoordinator.mustValidateResponses(),\n\t\t\t});\n\t\t\tif (attempt.validation && !attempt.validation.valid) {\n\t\t\t\tthrow new Error(attempt.validation.issues[0]?.message || 'Submit failed: invalid response');\n\t\t\t}\n\t\t\titemSession = attempt.sessionState;\n\t\t\tthis.sessionCoordinator.setItemSession(q.identifier, itemSession);\n\t\t}\n\t\tconst res = await this.backend.submitResponses({\n\t\t\tsessionId: this.sessionId,\n\t\t\titemIdentifier: q.identifier,\n\t\t\tresponses: responses as any,\n\t\t\tsubmittedAt,\n\t\t\ttimeSpent: itemSession?.duration,\n\t\t\ttiming: this.getSubmitTimingEvidence(q, itemSession?.duration ?? 0),\n\t\t\titemSession: this.config.sendItemSessionToBackend ? itemSession : undefined,\n\t\t});\n\n\t\tif (!res.success || !res.result) {\n\t\t\tthrow new Error(res.error || 'Submit failed');\n\t\t}\n\n\t\tif (res.updatedState) {\n\t\t\tthis.sessionCoordinator.replaceStatePreservingItemSessions(res.updatedState);\n\t\t} else {\n\t\t\t// Minimal state update when backend doesn't return full state.\n\t\t\tthis.state.itemScores = this.state.itemScores || {};\n\t\t\tthis.state.itemScores[q.identifier] = res.result;\n\t\t\tthis.sessionCoordinator.markVisited(q.identifier);\n\t\t\tthis.state.itemResponses[q.identifier] = responses as any;\n\t\t\tif (itemSession) {\n\t\t\t\tthis.sessionCoordinator.setItemSession(q.identifier, itemSession);\n\t\t\t}\n\t\t}\n\n\t\tconst itemResult: ItemResult = {\n\t\t\titemIdentifier: q.identifier,\n\t\t\tscore: res.result.score,\n\t\t\tmaxScore: res.result.maxScore,\n\t\t\tresponses: { ...responses },\n\t\t};\n\t\tthis.sessionCoordinator.setItemResult(itemResult);\n\n\t\t// Track item session rules (review/attempts) and visited items for navigation hints.\n\t\ttry {\n\t\t\tthis.sessionCoordinator.recordAttempt(q.identifier);\n\t\t} catch {\n\t\t\t// ignore\n\t\t}\n\t\tthis.sessionCoordinator.markAnswered(q.identifier, responses);\n\t\tthis.navigationManager.markVisited(this.currentItemIndex);\n\n\t\t// Apply backend branching decision if provided.\n\t\t// Special QTI targets EXIT_TEST / EXIT_TESTPART / EXIT_SECTION trigger finalization.\n\t\tif (res.nextItemIdentifier) {\n\t\t\tconst special = res.nextItemIdentifier;\n\t\t\tif (special === 'EXIT_TEST') {\n\t\t\t\t// Finalize immediately — no further navigation\n\t\t\t\tfor (const l of this.completeListeners) l();\n\t\t\t\tthis.config.onComplete?.();\n\t\t\t} else if (special === 'EXIT_TESTPART' || special === 'EXIT_SECTION') {\n\t\t\t\t// Advance past all remaining items in the current testPart or section\n\t\t\t\tconst currentItem = this.items[this.currentItemIndex];\n\t\t\t\tconst isSection = special === 'EXIT_SECTION';\n\t\t\t\tconst nextIdx = this.items.findIndex((item, i) =>\n\t\t\t\t\ti > this.currentItemIndex &&\n\t\t\t\t\t(isSection\n\t\t\t\t\t\t? item.section.identifier !== currentItem?.section.identifier\n\t\t\t\t\t\t: item.testPart.identifier !== currentItem?.testPart.identifier)\n\t\t\t\t);\n\t\t\t\tif (nextIdx >= 0) {\n\t\t\t\t\tawait this.navigateTo(nextIdx);\n\t\t\t\t} else {\n\t\t\t\t\t// No further items — signal completion\n\t\t\t\t\tfor (const l of this.completeListeners) l();\n\t\t\t\t\tthis.config.onComplete?.();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst nextIdx = this.items.findIndex((x) => x.identifier === special);\n\t\t\t\tif (nextIdx >= 0) {\n\t\t\t\t\tawait this.navigateTo(nextIdx);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn itemResult;\n\t}\n\n\tprivate canPrevious(): boolean {\n\t\tif (this.currentItemIndex <= 0) return false;\n\t\tconst prev = this.items[this.currentItemIndex - 1];\n\t\tif (!prev) return false;\n\t\tif (!this.navigationManager.canNavigateTo(this.currentItemIndex - 1, this.currentItemIndex)) return false;\n\t\treturn this.sessionCoordinator.canReview(prev.identifier);\n\t}\n\n\tprivate canNext(): boolean {\n\t\tif (this.currentItemIndex < 0) return false;\n\t\tconst nextIdx = this.currentItemIndex + 1;\n\t\tif (nextIdx >= this.items.length) return false;\n\t\tif (!this.navigationManager.canNavigateTo(nextIdx, this.currentItemIndex)) return false;\n\t\t// Note: itemSessionControl constraints on leaving current item are enforced in next().\n\t\treturn true;\n\t}\n\n\t/** Submit entire assessment (finalize on backend) */\n\tpublic async submit(): Promise<AssessmentResults> {\n\t\t// For simultaneous submission, ensure all items are submitted before finalize so\n\t\t// the backend can compute a complete test score.\n\t\tif (this.assessment.submissionMode === 'simultaneous') {\n\t\t\tthis.saveCurrentItemSession();\n\t\t\t// Preserve client-collected responses across backend state updates.\n\t\t\t// Some backend adapters return an updatedState snapshot that may only include\n\t\t\t// responses for items that have been submitted so far, which would otherwise\n\t\t\t// wipe out responses for later items during this loop.\n\t\t\tconst allItemResponses = { ...(this.state.itemResponses || {}) } as any;\n\t\t\tconst allItemSessions = { ...(this.state.itemSessions || {}) };\n\n\t\t\tfor (const q of this.items) {\n\t\t\t\tif (this.sessionCoordinator.hasItemResult(q.identifier)) continue;\n\t\t\t\tconst submittedAt = Date.now();\n\t\t\t\tconst responsesForItem = (allItemResponses?.[q.identifier] || {}) as any;\n\t\t\t\tconst itemSession = this.endItemSessionForSubmit(q, responsesForItem, allItemSessions[q.identifier]);\n\t\t\t\tallItemSessions[q.identifier] = itemSession;\n\t\t\t\tconst res = await this.backend.submitResponses({\n\t\t\t\t\tsessionId: this.sessionId,\n\t\t\t\t\titemIdentifier: q.identifier,\n\t\t\t\t\tresponses: responsesForItem,\n\t\t\t\t\tsubmittedAt,\n\t\t\t\t\ttimeSpent: itemSession?.duration,\n\t\t\t\t\ttiming: this.getSubmitTimingEvidence(q, itemSession?.duration ?? 0),\n\t\t\t\t\titemSession: this.config.sendItemSessionToBackend ? itemSession : undefined,\n\t\t\t\t});\n\t\t\t\tif (!res.success || !res.result) {\n\t\t\t\t\tthrow new Error(res.error || `Submit failed for item ${q.identifier}`);\n\t\t\t\t}\n\t\t\t\tif (res.updatedState) {\n\t\t\t\t\tthis.sessionCoordinator.replaceStatePreservingResponsesAndSessions(\n\t\t\t\t\t\tres.updatedState,\n\t\t\t\t\t\tallItemResponses,\n\t\t\t\t\t\tallItemSessions\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tthis.state.itemScores = this.state.itemScores || {};\n\t\t\t\t\tthis.state.itemScores[q.identifier] = res.result;\n\t\t\t\t\tthis.sessionCoordinator.markVisited(q.identifier);\n\t\t\t\t\tthis.state.itemResponses[q.identifier] = responsesForItem;\n\t\t\t\t\tif (itemSession) {\n\t\t\t\t\t\tthis.sessionCoordinator.setItemSession(q.identifier, itemSession);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.sessionCoordinator.setItemResult({\n\t\t\t\t\titemIdentifier: q.identifier,\n\t\t\t\t\tscore: res.result.score,\n\t\t\t\t\tmaxScore: res.result.maxScore,\n\t\t\t\t\tresponses: this.state.itemResponses[q.identifier] || {},\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\t// Ensure current item is submitted (individual submission mode)\n\t\t\tconst q = this.items[this.currentItemIndex];\n\t\t\tif (q && !this.sessionCoordinator.hasItemResult(q.identifier)) {\n\t\t\t\tawait this.submitCurrentItem();\n\t\t\t}\n\t\t}\n\n\t\tconst finalized: FinalizeAssessmentResponse = await this.backend.finalizeAssessment({\n\t\t\tsessionId: this.sessionId,\n\t\t});\n\t\tif (!finalized.success) throw new Error('Finalize failed');\n\n\t\t// Map backend itemScores to ItemResult[]\n\t\tconst itemScores = finalized.itemScores || {};\n\t\tconst itemResults: ItemResult[] = Object.values(itemScores).map((r: AssessmentScoringResult) => ({\n\t\t\titemIdentifier: r.itemIdentifier,\n\t\t\tscore: r.score,\n\t\t\tmaxScore: r.maxScore,\n\t\t\tresponses: this.state.itemResponses[r.itemIdentifier] || {},\n\t\t}));\n\n\t\t// Evaluate testFeedback visibility using QTI string equality:\n\t\t// show when outcomeIdentifier's value equals feedback.identifier (for showHide='show'),\n\t\t// or does NOT equal it (for showHide='hide').\n\t\tconst structuredFeedback = this.assessment.testFeedback ?? [];\n\t\tconst outcomes = finalized.outcomes ?? {};\n\t\tif (structuredFeedback.length > 0) {\n\t\t\tthis.visibleFeedback = structuredFeedback\n\t\t\t\t.filter((fb) => fb.access === 'atEnd')\n\t\t\t\t.filter((fb) => {\n\t\t\t\t\tconst outcomeValue = String(outcomes[fb.outcomeIdentifier] ?? '');\n\t\t\t\t\tconst matches = outcomeValue === fb.identifier;\n\t\t\t\t\treturn fb.showHide === 'show' ? matches : !matches;\n\t\t\t\t})\n\t\t\t\t.map((fb) => ({ identifier: fb.identifier, content: fb.content, access: fb.access }));\n\t\t} else {\n\t\t\t// Legacy: backend returns a plain feedback string\n\t\t\tthis.visibleFeedback = finalized.feedback\n\t\t\t\t? [{ identifier: 'testFeedback', content: finalized.feedback, access: 'atEnd' }]\n\t\t\t\t: [];\n\t\t}\n\n\t\tthis.notifyComplete();\n\t\tif (this.config.onComplete) this.config.onComplete();\n\n\t\treturn {\n\t\t\ttotalScore: finalized.totalScore,\n\t\t\tmaxScore: finalized.maxScore,\n\t\t\titemResults,\n\t\t\tcompletedAt: new Date(finalized.finalizedAt),\n\t\t};\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Session info + time helpers\n\t// ---------------------------------------------------------------------------\n\n\tpublic getItemSessionInfo(_itemIdentifier?: string): {\n\t\tcanSubmit: boolean;\n\t\tremainingAttempts: number | null;\n\t\tattemptCount: number;\n\t\tshowFeedback: boolean;\n\t\tshowSolution: boolean;\n\t\tcanReview: boolean;\n\t\tcanSkip: boolean;\n\t} | null {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q) return null;\n\t\tconst id = q.identifier;\n\n\t\treturn this.sessionCoordinator.getItemSessionInfo(id);\n\t}\n\n\tpublic getRemainingTime(): number {\n\t\t// TimeManager exposes seconds getters.\n\t\treturn this.timeManager?.getRemainingSeconds() ?? 0;\n\t}\n\n\tpublic getElapsedTime(): number {\n\t\treturn this.timeManager?.getElapsedSeconds() ?? 0;\n\t}\n\n\tpublic isTimeExpired(): boolean {\n\t\treturn this.timeManager?.isExpired() ?? false;\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Event subscriptions\n\t// ---------------------------------------------------------------------------\n\n\tpublic onItemChange(listener: (index: number, total: number) => void): () => void {\n\t\tthis.itemChangeListeners.add(listener);\n\t\treturn () => this.itemChangeListeners.delete(listener);\n\t}\n\n\tpublic onSectionChange(listener: (index: number, total: number) => void): () => void {\n\t\tthis.sectionChangeListeners.add(listener);\n\t\treturn () => this.sectionChangeListeners.delete(listener);\n\t}\n\n\tpublic onResponseChange(listener: (responses: Record<string, unknown>) => void): () => void {\n\t\tthis.responseChangeListeners.add(listener);\n\t\treturn () => this.responseChangeListeners.delete(listener);\n\t}\n\n\tpublic onComplete(listener: () => void): () => void {\n\t\tthis.completeListeners.add(listener);\n\t\treturn () => this.completeListeners.delete(listener);\n\t}\n\n\tpublic onTimeWarning(listener: (remainingSeconds: number) => void): () => void {\n\t\tthis.timeWarningListeners.add(listener);\n\t\treturn () => this.timeWarningListeners.delete(listener);\n\t}\n\n\tpublic onTimeExpired(listener: () => void): () => void {\n\t\tthis.timeExpiredListeners.add(listener);\n\t\treturn () => this.timeExpiredListeners.delete(listener);\n\t}\n\n\tpublic onTimeTick(listener: (remainingSeconds: number, elapsedSeconds: number) => void): () => void {\n\t\tthis.timeTickListeners.add(listener);\n\t\treturn () => this.timeTickListeners.delete(listener);\n\t}\n\n\tpublic destroy(): void {\n\t\tthis.timeManager?.destroy();\n\t\tthis.currentItemPlayer?.destroy();\n\t\tthis.itemChangeListeners.clear();\n\t\tthis.sectionChangeListeners.clear();\n\t\tthis.responseChangeListeners.clear();\n\t\tthis.completeListeners.clear();\n\t\tthis.timeWarningListeners.clear();\n\t\tthis.timeExpiredListeners.clear();\n\t\tthis.timeTickListeners.clear();\n\t\tthis.currentItemPlayer = null;\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Internal notify helpers\n\t// ---------------------------------------------------------------------------\n\n\tprivate notifyItemChange(): void {\n\t\tfor (const l of this.itemChangeListeners) l(this.currentItemIndex, this.items.length);\n\t\tthis.config.onItemChange?.(this.currentItemIndex, this.items.length);\n\t}\n\n\tprivate notifySectionChange(): void {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tconst sectionIndex = q?.sectionIndex ?? 0;\n\t\tconst totalSections = this.getAllSections().length;\n\t\tfor (const l of this.sectionChangeListeners) l(sectionIndex, totalSections);\n\t\tthis.config.onSectionChange?.(sectionIndex, totalSections);\n\t}\n\n\tprivate notifyResponseChange(): void {\n\t\tconst responses = this.sessionCoordinator.getActiveResponses();\n\t\tfor (const l of this.responseChangeListeners) l(responses);\n\t\tthis.config.onResponseChange?.(responses);\n\t}\n\n\tprivate notifyComplete(): void {\n\t\tfor (const l of this.completeListeners) l();\n\t}\n\n\tprivate notifyTimeWarning(remainingSeconds: number): void {\n\t\tfor (const l of this.timeWarningListeners) l(remainingSeconds);\n\t}\n\n\tprivate notifyTimeExpired(): void {\n\t\tfor (const l of this.timeExpiredListeners) l();\n\t}\n\n\tprivate notifyTimeTick(remainingSeconds: number, elapsedSeconds: number): void {\n\t\tfor (const l of this.timeTickListeners) l(remainingSeconds, elapsedSeconds);\n\t}\n\n\t/**\n\t * Get the i18n provider instance\n\t * @returns I18nProvider instance\n\t */\n\tpublic getI18nProvider(): any {\n\t\treturn this.i18nProvider;\n\t}\n\n\t/**\n\t * Create a simple fallback i18n provider when none is provided\n\t */\n\tprivate createDefaultI18nProvider(): any {\n\t\treturn {\n\t\t\tgetLocale: () => 'en-US',\n\t\t\tsetLocale: () => {},\n\t\t\tt: (key: string) => key, // Fallback to key\n\t\t\tplural: (key: string) => key,\n\t\t\tformatNumber: (value: number) => value.toString(),\n\t\t\tformatDate: (date: Date) => date.toISOString(),\n\t\t};\n\t}\n}\n\n/** Fisher-Yates shuffle using a provided RNG (returns a new array). */\nfunction shuffleArray<T>(arr: T[], rng: () => number): T[] {\n\tconst out = [...arr];\n\tfor (let i = out.length - 1; i > 0; i--) {\n\t\tconst j = Math.floor(rng() * (i + 1));\n\t\t[out[i], out[j]] = [out[j], out[i]];\n\t}\n\treturn out;\n}\n","<script lang=\"ts\">\n\timport { onDestroy } from 'svelte';\n\n\t/**\n\t * Accessibility Announcer Component\n\t *\n\t * Provides ARIA live region for announcing dynamic content changes\n\t * to screen reader users, particularly for state restoration.\n\t *\n\t * Usage:\n\t * ```svelte\n\t * <AccessibilityAnnouncer bind:this={announcer} />\n\t *\n\t * // Later announce something\n\t * announcer.announce('Session restored from previous attempt');\n\t * ```\n\t */\n\n\tinterface Props {\n\t\t/** Priority level for announcements */\n\t\tpriority?: 'polite' | 'assertive';\n\t}\n\n\tconst { priority = 'polite' }: Props = $props();\n\n\tlet announcement = $state('');\n\tlet currentPriority = $state<'polite' | 'assertive'>('polite');\n\tlet announceTimeout: ReturnType<typeof setTimeout> | null = null;\n\n\t$effect(() => {\n\t\tif (!announcement) {\n\t\t\tcurrentPriority = priority;\n\t\t}\n\t});\n\n\t// Clean up timeout on destroy to prevent memory leaks\n\tonDestroy(() => {\n\t\tif (announceTimeout) {\n\t\t\tclearTimeout(announceTimeout);\n\t\t\tannounceTimeout = null;\n\t\t}\n\t});\n\n\t/**\n\t * Announce a message to screen readers\n\t *\n\t * @param message - Text to announce\n\t * @param clearAfter - Milliseconds to wait before clearing (default: 1000)\n\t * @param nextPriority - Announcement priority for this message\n\t */\n\texport function announce(message: string, clearAfter = 1000, nextPriority: 'polite' | 'assertive' = priority): void {\n\t\t// Clear any existing announcement timeout\n\t\tif (announceTimeout) {\n\t\t\tclearTimeout(announceTimeout);\n\t\t\tannounceTimeout = null;\n\t\t}\n\n\t\t// Set the new announcement\n\t\tcurrentPriority = nextPriority;\n\t\tannouncement = message;\n\n\t\t// Clear after delay to allow screen readers to announce\n\t\t// and prepare for next announcement\n\t\tannounceTimeout = setTimeout(() => {\n\t\t\tannouncement = '';\n\t\t\tcurrentPriority = priority;\n\t\t\tannounceTimeout = null;\n\t\t}, clearAfter);\n\t}\n\n\t/**\n\t * Clear the current announcement immediately\n\t */\n\texport function clear(): void {\n\t\tif (announceTimeout) {\n\t\t\tclearTimeout(announceTimeout);\n\t\t\tannounceTimeout = null;\n\t\t}\n\t\tannouncement = '';\n\t\tcurrentPriority = priority;\n\t}\n</script>\n\n<!--\n\tARIA live region for screen reader announcements\n\t- visually-hidden: Hide from sighted users but available to screen readers\n\t- aria-live: Announce changes to this region\n\t- aria-atomic: Read entire region content when it changes\n\t- role=\"status\": Indicates this is a status message\n-->\n<div\n\tclass=\"sr-only\"\n\trole=\"status\"\n\taria-live={currentPriority}\n\taria-atomic=\"true\"\n>\n\t{announcement}\n</div>\n\n<style>\n\t/* Screen reader only - visually hidden but accessible */\n\t.sr-only {\n\t\tposition: absolute;\n\t\twidth: 1px;\n\t\theight: 1px;\n\t\tpadding: 0;\n\t\tmargin: -1px;\n\t\toverflow: hidden;\n\t\tclip: rect(0, 0, 0, 0);\n\t\twhite-space: nowrap;\n\t\tborder-width: 0;\n\t}\n</style>\n","<script lang=\"ts\">\n\timport { tick } from 'svelte';\n\timport type { I18nProvider } from '@pie-qti/i18n';\n\n\tinterface Section {\n\t\tid: string;\n\t\ttitle?: string;\n\t\tindex: number;\n\t}\n\n\tinterface Props {\n\t\tsections: Section[];\n\t\tcurrentSectionIndex?: number;\n\t\ti18n?: I18nProvider;\n\t\tonSectionSelect?: (sectionIndex: number) => void;\n\t\tdisabled?: boolean;\n\t}\n\n\tconst { sections, currentSectionIndex, i18n, onSectionSelect, disabled = false }: Props = $props();\n\n\tlet isOpen = $state(false);\n\tlet toggleButton = $state<HTMLButtonElement | null>(null);\n\tlet dropdownContent = $state<HTMLDivElement | null>(null);\n\tconst menuId = 'assessment-section-menu';\n\n\tasync function openMenu() {\n\t\tif (disabled) return;\n\t\tisOpen = true;\n\t\tawait tick();\n\t\tconst active = dropdownContent?.querySelector<HTMLButtonElement>('.section-item.active');\n\t\tconst first = dropdownContent?.querySelector<HTMLButtonElement>('.section-item:not(:disabled)');\n\t\t(active ?? first)?.focus();\n\t}\n\n\tfunction closeMenu({ restoreFocus = true } = {}) {\n\t\tisOpen = false;\n\t\tif (restoreFocus) {\n\t\t\ttoggleButton?.focus();\n\t\t}\n\t}\n\n\tfunction toggleMenu() {\n\t\tif (isOpen) {\n\t\t\tcloseMenu();\n\t\t\treturn;\n\t\t}\n\t\tvoid openMenu();\n\t}\n\n\tfunction handleMenuKeydown(event: KeyboardEvent) {\n\t\tif (event.key === 'Escape') {\n\t\t\tevent.preventDefault();\n\t\t\tcloseMenu();\n\t\t}\n\t}\n\n\tfunction handleToggleKeydown(event: KeyboardEvent) {\n\t\tif (event.key === 'ArrowDown') {\n\t\t\tevent.preventDefault();\n\t\t\tvoid openMenu();\n\t\t}\n\t}\n\n\tfunction handleBackdropClick() {\n\t\tcloseMenu();\n\t}\n\n\tfunction selectSection(sectionIndex: number) {\n\t\tif (disabled) return;\n\t\tif (onSectionSelect) {\n\t\t\tonSectionSelect(sectionIndex);\n\t\t}\n\t\tcloseMenu();\n\t}\n</script>\n\n{#if sections.length > 1}\n\t<div class=\"section-menu\">\n\t\t<button\n\t\t\tbind:this={toggleButton}\n\t\t\tclass=\"btn btn-outline btn-sm\"\n\t\t\ttype=\"button\"\n\t\t\taria-expanded={isOpen}\n\t\t\taria-controls={menuId}\n\t\t\tonclick={() => toggleMenu?.()}\n\t\t\tonkeydown={handleToggleKeydown}\n\t\t\tdisabled={disabled}\n\t\t>\n\t\t\t<svg\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\tclass=\"h-5 w-5\"\n\t\t\t\tfill=\"none\"\n\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t>\n\t\t\t\t<path\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\td=\"M4 6h16M4 12h16M4 18h16\"\n\t\t\t\t/>\n\t\t\t</svg>\n\t\t\t{i18n?.t('assessment.sections.title') ?? 'Sections'}\n\t\t</button>\n\n\t\t{#if isOpen}\n\t\t\t<div class=\"section-dropdown\">\n\t\t\t\t<div\n\t\t\t\t\tbind:this={dropdownContent}\n\t\t\t\t\tid={menuId}\n\t\t\t\t\tclass=\"section-dropdown-content\"\n\t\t\t\t\trole=\"menu\"\n\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\taria-label={i18n?.t('assessment.sections.title') ?? 'Sections'}\n\t\t\t\t\tonkeydown={handleMenuKeydown}\n\t\t\t\t>\n\t\t\t\t\t<div class=\"section-list\">\n\t\t\t\t\t\t{#each sections as section}\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tclass=\"section-item\"\n\t\t\t\t\t\t\t\tclass:active={currentSectionIndex === section.index}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\taria-checked={currentSectionIndex === section.index}\n\t\t\t\t\t\t\t\tonclick={() => selectSection(section.index)}\n\t\t\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div class=\"section-icon\">\n\t\t\t\t\t\t\t\t\t{#if currentSectionIndex === section.index}\n\t\t\t\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t\t\t\t\tclass=\"h-5 w-5\"\n\t\t\t\t\t\t\t\t\t\t\tviewBox=\"0 0 20 20\"\n\t\t\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\t\tfill-rule=\"evenodd\"\n\t\t\t\t\t\t\t\t\t\t\t\td=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z\"\n\t\t\t\t\t\t\t\t\t\t\t\tclip-rule=\"evenodd\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t\t\t{:else}\n\t\t\t\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t\t\t\t\tclass=\"h-5 w-5\"\n\t\t\t\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\t\t\t\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\t\t\t\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\t\t\t\t\t\t\t\td=\"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t\t\t{/if}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"section-info\">\n\t\t\t\t\t\t\t\t\t<div class=\"section-title\">\n\t\t\t\t\t\t\t\t\t\t{section.title || (i18n?.t('assessment.sectionDefault', { number: section.index + 1 }) ?? `Section ${section.index + 1}`)}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t{/each}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<button\n\t\t\t\t\tclass=\"section-backdrop\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonclick={handleBackdropClick}\n\t\t\t\t\taria-label={i18n?.t('assessment.closeMenu') ?? 'Close menu'}\n\t\t\t\t></button>\n\t\t\t</div>\n\t\t{/if}\n\t</div>\n{/if}\n\n<style>\n\t.section-menu {\n\t\tposition: relative;\n\t}\n\n\t.section-dropdown {\n\t\tposition: fixed;\n\t\tinset: 0;\n\t\tz-index: 50;\n\t}\n\n\t.section-backdrop {\n\t\tposition: absolute;\n\t\tinset: 0;\n\t\tbackground: transparent;\n\t\tborder: none;\n\t\tcursor: default;\n\t}\n\n\t.section-dropdown-content {\n\t\tposition: absolute;\n\t\ttop: 4rem;\n\t\tright: 1rem;\n\t\twidth: 20rem;\n\t\tmax-height: 24rem;\n\t\toverflow-y: auto;\n\t\tbackground: var(--color-base-100);\n\t\tborder: 1px solid var(--color-base-300);\n\t\tborder-radius: 0.5rem;\n\t\tbox-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);\n\t\tz-index: 51;\n\t}\n\n\t.section-list {\n\t\tpadding: 0.5rem;\n\t}\n\n\t.section-item {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tgap: 0.75rem;\n\t\twidth: 100%;\n\t\tpadding: 0.75rem;\n\t\tborder: none;\n\t\tbackground: transparent;\n\t\tborder-radius: 0.375rem;\n\t\tcursor: pointer;\n\t\ttransition: background-color 0.2s;\n\t\ttext-align: left;\n\t}\n\n\t.section-item:hover:not(:disabled) {\n\t\tbackground: var(--color-base-200);\n\t}\n\n\t.section-item.active {\n\t\tbackground: color-mix(in oklab, var(--color-primary) 12%, transparent);\n\t\tcolor: var(--color-primary);\n\t}\n\n\t.section-item:disabled {\n\t\topacity: 0.5;\n\t\tcursor: not-allowed;\n\t}\n\n\t.section-icon {\n\t\tflex-shrink: 0;\n\t\tcolor: color-mix(in oklab, var(--color-base-content) 60%, transparent);\n\t}\n\n\t.section-item.active .section-icon {\n\t\tcolor: var(--color-primary);\n\t}\n\n\t.section-info {\n\t\tflex: 1;\n\t\tmin-width: 0;\n\t}\n\n\t.section-title {\n\t\tfont-weight: 500;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\twhite-space: nowrap;\n\t}\n\n\t@media (max-width: 640px) {\n\t\t.section-dropdown-content {\n\t\t\tright: 0;\n\t\t\tleft: 0;\n\t\t\twidth: auto;\n\t\t\tmargin: 0 1rem;\n\t\t}\n\t}\n</style>\n","<script lang=\"ts\">\n\timport SectionMenu from './SectionMenu.svelte';\n\n\tinterface Section {\n\t\tid: string;\n\t\ttitle?: string;\n\t\tindex: number;\n\t}\n\n\tinterface Props {\n\t\t/** Assessment title */\n\t\ttitle: string;\n\t\t/** Available sections */\n\t\tsections?: Section[];\n\t\t/** Current section index */\n\t\tcurrentSectionIndex?: number;\n\t\t/** Whether to show section menu */\n\t\tshowSections?: boolean;\n\t\t/** Whether section navigation is allowed */\n\t\tallowSectionNavigation?: boolean;\n\t\t/** Section selection callback */\n\t\tonSectionSelect?: (sectionIndex: number) => void;\n\t}\n\n\tconst {\n\t\ttitle,\n\t\tsections = [],\n\t\tcurrentSectionIndex,\n\t\tshowSections = true,\n\t\tallowSectionNavigation = true,\n\t\tonSectionSelect\n\t}: Props = $props();\n</script>\n\n<div class=\"assessment-header\">\n\t<div class=\"assessment-title\">\n\t\t<h2 class=\"text-2xl font-bold\">{title}</h2>\n\t</div>\n\n\t{#if showSections && sections.length > 1}\n\t\t<SectionMenu\n\t\t\t{sections}\n\t\t\t{currentSectionIndex}\n\t\t\t{onSectionSelect}\n\t\t\tdisabled={!allowSectionNavigation}\n\t\t/>\n\t{/if}\n</div>\n\n<style>\n\t.assessment-header {\n\t\tdisplay: flex;\n\t\tjustify-content: space-between;\n\t\talign-items: center;\n\t\tpadding: 1.5rem;\n\t\tborder-bottom: 1px solid var(--color-base-300);\n\t\tbackground: var(--color-base-100);\n\t\tposition: sticky;\n\t\ttop: 0;\n\t\tz-index: 10;\n\t}\n\n\t.assessment-title {\n\t\tflex: 1;\n\t}\n\n\t@media (max-width: 768px) {\n\t\t.assessment-header {\n\t\t\tpadding: 1rem;\n\t\t}\n\n\t\t.assessment-title :global(h2) {\n\t\t\tfont-size: 1.25rem;\n\t\t}\n\t}\n</style>\n","<script lang=\"ts\">\n\timport type { PlayerSecurityConfig, PnpProfile, QTIRole } from '@pie-qti/item-player';\n\timport type { InteractionResponseValue } from '@pie-qti/item-player/web-components';\n\timport type { I18nProvider } from '@pie-qti/i18n';\n\timport { assignProps } from '@pie-qti/qti-common';\n\timport { onMount } from 'svelte';\n\timport type { ItemRef } from '../types/index.js';\n\n\ttype ItemResponseValue = InteractionResponseValue | null;\n\ttype ItemResponseMap = Record<string, ItemResponseValue>;\n\ttype PieQtiItemPlayerElement = HTMLElement & {\n\t\titemXml?: string;\n\t\trole?: QTIRole;\n\t\tdisabled?: boolean;\n\t\tresponses?: ItemResponseMap;\n\t\ttypeset?: (root: HTMLElement) => void | Promise<void>;\n\t\ti18n?: I18nProvider;\n\t\tsecurity?: PlayerSecurityConfig;\n\t\tpnp?: PnpProfile;\n\t\tdeliveryContext?: ItemRef['deliveryContext'];\n\t\tonResponseChange?: (responseId: string, value: ItemResponseValue) => void;\n\t};\n\n\tinterface Props {\n\t\titemRef: ItemRef;\n\t\trole?: QTIRole;\n\t\textendedTextEditor?: string;\n\t\t/** Responses for the current item (keyed by responseIdentifier). */\n\t\tresponses?: ItemResponseMap;\n\t\tonResponseChange?: (responseId: string, value: ItemResponseValue) => void;\n\t\t/** Math typesetting function (KaTeX, MathJax, etc.) */\n\t\ttypeset?: (root: HTMLElement) => void | Promise<void>;\n\t\t/** I18n provider for translations */\n\t\ti18n?: I18nProvider;\n\t\t/** Security configuration for URL policy and content restrictions */\n\t\tsecurity?: PlayerSecurityConfig;\n\t\t/** QTI 3.0 Personal Needs and Preferences profile */\n\t\tpnp?: PnpProfile;\n\t}\n\n\tconst {\n\t\titemRef,\n\t\trole = 'candidate',\n\t\textendedTextEditor: _extendedTextEditor,\n\t\tresponses = {},\n\t\tonResponseChange,\n\t\ttypeset,\n\t\ti18n,\n\t\tsecurity,\n\t\tpnp,\n\t}: Props = $props();\n\n\tlet playerLoaded = $state(false);\n\tlet errorMessage = $state<string | null>(null);\n\n\tonMount(() => {\n\t\tlet cancelled = false;\n\t\tvoid Promise.all([\n\t\t\timport('@pie-qti/default-components/plugins'),\n\t\t\timport('@pie-qti/item-player/element'),\n\t\t])\n\t\t\t.then(() => {\n\t\t\t\tif (!cancelled) {\n\t\t\t\t\tplayerLoaded = true;\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tif (!cancelled) {\n\t\t\t\t\terrorMessage =\n\t\t\t\t\t\terror instanceof Error ? error.message : 'Unable to load the QTI item player.';\n\t\t\t\t}\n\t\t\t});\n\n\t\treturn () => {\n\t\t\tcancelled = true;\n\t\t};\n\t});\n\n\tfunction handleResponseChange(responseId: string, value: ItemResponseValue) {\n\t\tonResponseChange?.(responseId, value);\n\t}\n\n\tfunction itemPlayerProps(node: PieQtiItemPlayerElement, props: Record<string, unknown>) {\n\t\tassignProps(node, props);\n\n\t\treturn {\n\t\t\tupdate(next: Record<string, unknown>) {\n\t\t\t\tassignProps(node, next);\n\t\t\t},\n\t\t};\n\t}\n</script>\n\n{#if errorMessage}\n\t<div class=\"alert alert-error\">\n\t\t<svg\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\tclass=\"stroke-current shrink-0 h-6 w-6\"\n\t\t\tfill=\"none\"\n\t\t\tviewBox=\"0 0 24 24\"\n\t\t>\n\t\t\t<path\n\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\tstroke-width=\"2\"\n\t\t\t\td=\"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z\"\n\t\t\t/>\n\t\t</svg>\n\t\t<span>{i18n?.t('item.loadError', 'Error loading item: {error}', { error: errorMessage })}</span>\n\t</div>\n{:else if !itemRef.itemXml}\n\t<div class=\"alert alert-error\">\n\t\t<span>{i18n?.t('item.loadingError') ?? 'No item XML provided'}</span>\n\t</div>\n{:else if !playerLoaded}\n\t<div class=\"flex items-center justify-center p-8\">\n\t\t<span class=\"loading loading-spinner loading-lg\"></span>\n\t\t<span class=\"ml-4\">{i18n?.t('item.loading', 'Loading item...')}</span>\n\t</div>\n{:else}\n\t<div class=\"item-container\">\n\t\t{#if itemRef.title}\n\t\t\t<div class=\"item-header\">\n\t\t\t\t<h3 class=\"text-lg font-semibold mb-4\">{itemRef.title}</h3>\n\t\t\t</div>\n\t\t{/if}\n\n\t\t<div class=\"item-content\">\n\t\t\t<pie-qti-item-player\n\t\t\t\tuse:itemPlayerProps={{\n\t\t\t\t\titemXml: itemRef.itemXml,\n\t\t\t\t\trole,\n\t\t\t\t\tdisabled: role !== 'candidate',\n\t\t\t\t\tresponses,\n\t\t\t\t\ttypeset,\n\t\t\t\t\ti18n,\n\t\t\t\t\tsecurity,\n\t\t\t\t\tpnp,\n\t\t\t\t\tdeliveryContext: itemRef.deliveryContext,\n\t\t\t\t\tonResponseChange: handleResponseChange,\n\t\t\t\t}}\n\t\t\t></pie-qti-item-player>\n\t\t</div>\n\t</div>\n{/if}\n\n<style>\n\t.item-container {\n\t\twidth: 100%;\n\t\tpadding: 1rem;\n\t}\n\n\t.item-content {\n\t\twidth: 100%;\n\t}\n</style>\n","<script lang=\"ts\">\n\timport type { NavigationState } from '../types/index.js';\n\timport type { SvelteI18nProvider } from '@pie-qti/i18n';\n\n\tinterface Props {\n\t\tnavState: NavigationState;\n\t\ti18n?: SvelteI18nProvider;\n\t\tonPrevious?: () => void;\n\t\tonNext?: () => void;\n\t\tonSubmit?: () => void;\n\t\tshowProgress?: boolean;\n\t}\n\n\tconst { navState, i18n, onPrevious, onNext, onSubmit, showProgress = true }: Props = $props();\n\n\tconst progressPercentage = $derived(\n\t\tnavState.totalItems > 0 ? ((navState.currentIndex + 1) / navState.totalItems) * 100 : 0,\n\t);\n\n\t// Simplified translations - no manual subscriptions needed\n\t// Locale changes trigger page refresh, so reactivity is not required\n\tconst translations = $derived({\n\t\tquestion: i18n?.t('assessment.question', { current: navState.currentIndex + 1, total: navState.totalItems })\n\t\t\t?? `Question ${navState.currentIndex + 1} of ${navState.totalItems}`,\n\t\tsection: navState.currentSection\n\t\t\t? (navState.currentSection.title ?? (i18n?.t('assessment.section', { current: navState.currentSection.index + 1, total: 0 })\n\t\t\t\t?? `Section ${navState.currentSection.index + 1}`))\n\t\t\t: null,\n\t\tprevious: i18n?.t('common.previous') ?? 'Previous',\n\t\tnext: i18n?.t('common.next') ?? 'Next',\n\t\tsubmit: i18n?.t('assessment.navigation.submit') ?? 'Submit',\n\t\tprogress: `${i18n?.t('assessment.navigation.progress', { percent: Math.round(progressPercentage) }) ?? `Progress: ${Math.round(progressPercentage)}%`}: ${i18n?.t('assessment.question', { current: navState.currentIndex + 1, total: navState.totalItems }) ?? `Question ${navState.currentIndex + 1} of ${navState.totalItems}`}`,\n\t});\n</script>\n\n<div class=\"navigation-bar\">\n\t<!-- Progress indicator -->\n\t{#if showProgress}\n\t\t<div class=\"progress-section\">\n\t\t\t<div class=\"progress-label text-sm\">\n\t\t\t\t{translations.question}\n\t\t\t\t{#if translations.section}\n\t\t\t\t\t<span class=\"text-base-content/60\">\n\t\t\t\t\t\t({translations.section})\n\t\t\t\t\t</span>\n\t\t\t\t{/if}\n\t\t\t</div>\n\t\t\t<progress\n\t\t\t\tclass=\"progress progress-primary w-full\"\n\t\t\t\tvalue={progressPercentage}\n\t\t\t\tmax=\"100\"\n\t\t\t\taria-label={translations.progress}\n\t\t\t></progress>\n\t\t</div>\n\t{/if}\n\n\t<!-- Navigation buttons -->\n\t<div class=\"navigation-buttons\">\n\t\t<button\n\t\t\tclass=\"btn btn-outline\"\n\t\t\tdata-testid=\"assessment-prev\"\n\t\t\tonclick={() => onPrevious?.()}\n\t\t\tdisabled={!navState.canPrevious || navState.isLoading}\n\t\t>\n\t\t\t<svg\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\tclass=\"h-5 w-5\"\n\t\t\t\tfill=\"none\"\n\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t>\n\t\t\t\t<path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M15 19l-7-7 7-7\" />\n\t\t\t</svg>\n\t\t\t{translations.previous}\n\t\t</button>\n\n\t\t<div class=\"flex-1\"></div>\n\n\t\t{#if navState.currentIndex === navState.totalItems - 1}\n\t\t\t<!-- Submit button on last item -->\n\t\t\t<button class=\"btn btn-primary\" data-testid=\"assessment-submit\" onclick={() => onSubmit?.()} disabled={navState.isLoading}>\n\t\t\t\t{translations.submit}\n\t\t\t</button>\n\t\t{:else}\n\t\t\t<!-- Next button -->\n\t\t\t<button\n\t\t\t\tclass=\"btn btn-primary\"\n\t\t\t\tdata-testid=\"assessment-next\"\n\t\t\t\tonclick={() => onNext?.()}\n\t\t\t\tdisabled={!navState.canNext || navState.isLoading}\n\t\t\t>\n\t\t\t\t{translations.next}\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\tclass=\"h-5 w-5\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t>\n\t\t\t\t\t<path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M9 5l7 7-7 7\" />\n\t\t\t\t</svg>\n\t\t\t</button>\n\t\t{/if}\n\t</div>\n</div>\n\n<style>\n\t.navigation-bar {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 1rem;\n\t\tpadding: 1rem;\n\t\tborder-top: 1px solid var(--color-base-300);\n\t\tbackground: var(--color-base-100);\n\t}\n\n\t.progress-section {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 0.5rem;\n\t}\n\n\t.progress-label {\n\t\tfont-weight: 500;\n\t}\n\n\t.navigation-buttons {\n\t\tdisplay: flex;\n\t\tgap: 0.5rem;\n\t\talign-items: center;\n\t}\n\n\t@media (max-width: 640px) {\n\t\t.navigation-buttons {\n\t\t\tflex-direction: column;\n\t\t}\n\n\t\t.navigation-buttons button {\n\t\t\twidth: 100%;\n\t\t}\n\n\t\t.flex-1 {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n</style>\n","/// <reference lib=\"dom\" />\n/**\n * Generic Svelte action that calls `params.typeset(node)` initially and on DOM updates.\n *\n * This is intentionally dependency-free so the player/components can be used\n * outside the example app without pulling in a math engine.\n *\n * If typeset is undefined, the action becomes a no-op (returns immediately).\n */\nexport function typesetAction(node, params) {\n // No-op if no typeset function provided\n if (!params?.typeset) {\n return { update() { }, destroy() { } };\n }\n const isBrowser = typeof window !== 'undefined' && typeof MutationObserver !== 'undefined';\n if (!isBrowser)\n return { update() { }, destroy() { } };\n let disposed = false;\n let scheduled = false;\n let observer = null;\n let current = params;\n const schedule = () => {\n if (disposed || scheduled || !current.typeset)\n return;\n scheduled = true;\n requestAnimationFrame(async () => {\n scheduled = false;\n if (disposed || !current.typeset)\n return;\n try {\n await current.typeset(node);\n }\n catch {\n // ignore typesetting errors; keep raw text\n }\n });\n };\n const startObserver = () => {\n if (observer)\n return;\n observer = new MutationObserver(() => schedule());\n observer.observe(node, { childList: true, subtree: true, characterData: true });\n };\n const stopObserver = () => {\n observer?.disconnect();\n observer = null;\n };\n // initial\n schedule();\n if (current.observe !== false)\n startObserver();\n return {\n update(next) {\n if (!next?.typeset) {\n stopObserver();\n return;\n }\n current = next;\n if (current.observe === false)\n stopObserver();\n else\n startObserver();\n schedule();\n },\n destroy() {\n disposed = true;\n stopObserver();\n },\n };\n}\n//# sourceMappingURL=typesetAction.js.map","<script lang=\"ts\">\n\timport { typesetAction } from '@pie-qti/default-components/shared';\n\timport type { I18nProvider } from '@pie-qti/i18n';\n\timport type { AssessmentRubricBlock } from '../integration/api-contract.js';\n\n\tinterface Props {\n\t\tblocks: AssessmentRubricBlock[];\n\t\tcollapsed?: boolean;\n\t\ti18n?: I18nProvider;\n\t\t/** Math typesetting function (KaTeX, MathJax, etc.) */\n\t\ttypeset?: (root: HTMLElement) => void | Promise<void>;\n\t}\n\n\tconst { blocks, collapsed = false, i18n, typeset }: Props = $props();\n\n\tlet isCollapsed = $state(false);\n\n\t$effect(() => {\n\t\tisCollapsed = collapsed;\n\t});\n\n\tfunction toggleCollapse() {\n\t\tisCollapsed = !isCollapsed;\n\t}\n\n\t// Filter blocks by view type (for student/candidate view)\n\tconst visibleBlocks = $derived(blocks.filter((block) => block.view.includes('candidate')));\n\n\t// Group blocks by use type\n\tconst passages = $derived(visibleBlocks.filter((block) => block.use === 'passage'));\n\tconst instructions = $derived(visibleBlocks.filter((block) => block.use === 'instructions'));\n\tconst rubrics = $derived(visibleBlocks.filter((block) => !block.use || block.use === 'rubric'));\n</script>\n\n{#if visibleBlocks.length > 0}\n\t<div class=\"rubric-container\">\n\t\t<!-- Passages (typically reading comprehension) -->\n\t\t{#if passages.length > 0}\n\t\t\t<div class=\"passage-section\">\n\t\t\t\t{#each passages as passage}\n\t\t\t\t\t<div class=\"passage\">\n\t\t\t\t\t\t<div class=\"passage-header\">\n\t\t\t\t\t\t\t<h4 class=\"font-semibold text-base\">{i18n?.t('assessment.readingPassage') ?? 'Reading Passage'}</h4>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tclass=\"btn btn-ghost btn-sm\"\n\t\t\t\t\t\t\t\tonclick={() => toggleCollapse?.()}\n\t\t\t\t\t\t\t\taria-label={isCollapsed ? (i18n?.t('assessment.expandPassage') ?? 'Expand passage') : (i18n?.t('assessment.collapsePassage') ?? 'Collapse passage')}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{#if isCollapsed}\n\t\t\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t\t\t\tclass=\"h-5 w-5\"\n\t\t\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\t\t\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\t\t\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\t\t\t\t\t\t\td=\"M19 9l-7 7-7-7\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t\t{:else}\n\t\t\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t\t\t\tclass=\"h-5 w-5\"\n\t\t\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\t\t\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\t\t\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\t\t\t\t\t\t\td=\"M5 15l7-7 7 7\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t\t\t{/if}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t{#if !isCollapsed}\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tuse:typesetAction={{ typeset }}\n\t\t\t\t\t\t\t\tclass=\"passage-content prose max-w-none\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{@html passage.content}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{/if}\n\t\t\t\t\t</div>\n\t\t\t\t{/each}\n\t\t\t</div>\n\t\t{/if}\n\n\t\t<!-- Instructions -->\n\t\t{#if instructions.length > 0}\n\t\t\t<div class=\"instructions-section\">\n\t\t\t\t{#each instructions as instruction}\n\t\t\t\t\t<div class=\"alert alert-info\">\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\tclass=\"stroke-current shrink-0 w-6 h-6\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\t\t\t\td=\"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"\n\t\t\t\t\t\t\t></path>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t<div use:typesetAction={{ typeset }}>\n\t\t\t\t\t\t\t{@html instruction.content}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t{/each}\n\t\t\t</div>\n\t\t{/if}\n\n\t\t<!-- Other rubric blocks -->\n\t\t{#if rubrics.length > 0}\n\t\t\t<div class=\"rubric-section\">\n\t\t\t\t{#each rubrics as rubric}\n\t\t\t\t\t<div use:typesetAction={{ typeset }} class=\"rubric-block\">\n\t\t\t\t\t\t{@html rubric.content}\n\t\t\t\t\t</div>\n\t\t\t\t{/each}\n\t\t\t</div>\n\t\t{/if}\n\t</div>\n{/if}\n\n<style>\n\t.rubric-container {\n\t\tmargin-bottom: 2rem;\n\t}\n\n\t.passage-section {\n\t\tmargin-bottom: 1.5rem;\n\t}\n\n\t.passage {\n\t\tborder: 1px solid var(--color-base-300);\n\t\tborder-radius: 0.5rem;\n\t\tpadding: 1rem;\n\t\tbackground: var(--color-base-200);\n\t}\n\n\t.passage-header {\n\t\tdisplay: flex;\n\t\tjustify-content: space-between;\n\t\talign-items: center;\n\t\tmargin-bottom: 0.5rem;\n\t}\n\n\t.passage-content {\n\t\tpadding: 1rem 0;\n\t\tline-height: 1.6;\n\t}\n\n\t.instructions-section {\n\t\tmargin-bottom: 1.5rem;\n\t}\n\n\t.rubric-section {\n\t\tmargin-bottom: 1.5rem;\n\t}\n\n\t.rubric-block {\n\t\tpadding: 1rem;\n\t\tbackground: var(--color-base-200);\n\t\tborder-radius: 0.5rem;\n\t\tmargin-bottom: 1rem;\n\t}\n\n\t:global(.passage-content p) {\n\t\tmargin-bottom: 1rem;\n\t}\n\n\t:global(.passage-content p:last-child) {\n\t\tmargin-bottom: 0;\n\t}\n</style>\n","<script lang=\"ts\">\n\timport { onMount } from 'svelte';\n\timport type { I18nProvider } from '@pie-qti/i18n';\n\timport RubricDisplay from './RubricDisplay.svelte';\n\n\tinterface Props {\n\t\t/** Left pane content (passage/stimulus) */\n\t\tleftContent: any[];\n\t\t/** Right pane content slot */\n\t\tchildren: any;\n\t\t/** Math typesetting function */\n\t\ttypeset?: (root: HTMLElement) => void | Promise<void>;\n\t\ti18n?: I18nProvider;\n\t\t/** Storage key for persisting split position */\n\t\tstorageKey?: string;\n\t\t/** Minimum left pane percentage */\n\t\tminLeftPct?: number;\n\t\t/** Maximum left pane percentage */\n\t\tmaxLeftPct?: number;\n\t\t/** Initial split percentage */\n\t\tinitialSplitPct?: number;\n\t\t/** Callback when right pane element is ready (for scroll management) */\n\t\tonRightPaneReady?: (element: HTMLDivElement) => void;\n\t}\n\n\tconst {\n\t\tleftContent,\n\t\tchildren,\n\t\ttypeset,\n\t\ti18n,\n\t\tstorageKey = 'qti22-split-pane.splitLeftPct',\n\t\tminLeftPct = 25,\n\t\tmaxLeftPct = 75,\n\t\tinitialSplitPct = 50,\n\t\tonRightPaneReady\n\t}: Props = $props();\n\n\tlet splitContainerEl = $state<HTMLDivElement | null>(null);\n\tlet rightPaneEl = $state<HTMLDivElement | null>(null);\n\tlet splitLeftPct = $state<number>(50);\n\tlet isResizing = $state(false);\n\tlet hasInitializedFromProps = $state(false);\n\n\tfunction clampPct(pct: number) {\n\t\treturn Math.min(maxLeftPct, Math.max(minLeftPct, pct));\n\t}\n\n\tfunction saveSplitPct(pct: number) {\n\t\ttry {\n\t\t\tif (typeof window === 'undefined') return;\n\t\t\twindow.localStorage.setItem(storageKey, String(pct));\n\t\t} catch {\n\t\t\t// ignore\n\t\t}\n\t}\n\n\tfunction loadSplitPct() {\n\t\ttry {\n\t\t\tif (typeof window === 'undefined') return null;\n\t\t\tconst raw = window.localStorage.getItem(storageKey);\n\t\t\tif (!raw) return null;\n\t\t\tconst n = Number(raw);\n\t\t\tif (!Number.isFinite(n)) return null;\n\t\t\treturn clampPct(n);\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tfunction updateSplitFromClientX(clientX: number) {\n\t\tif (!splitContainerEl) return;\n\t\tconst rect = splitContainerEl.getBoundingClientRect();\n\t\tif (rect.width <= 0) return;\n\t\tconst x = clientX - rect.left;\n\t\tconst pct = (x / rect.width) * 100;\n\t\tsplitLeftPct = clampPct(pct);\n\t}\n\n\tfunction onSplitterPointerDown(e: PointerEvent) {\n\t\tif (!splitContainerEl) return;\n\t\tisResizing = true;\n\t\t(e.currentTarget as HTMLElement | null)?.setPointerCapture?.(e.pointerId);\n\t\tupdateSplitFromClientX(e.clientX);\n\n\t\tconst move = (ev: PointerEvent) => updateSplitFromClientX(ev.clientX);\n\t\tconst up = () => {\n\t\t\tisResizing = false;\n\t\t\twindow.removeEventListener('pointermove', move);\n\t\t\twindow.removeEventListener('pointerup', up);\n\t\t\twindow.removeEventListener('pointercancel', up);\n\t\t\tsaveSplitPct(splitLeftPct);\n\t\t};\n\n\t\twindow.addEventListener('pointermove', move);\n\t\twindow.addEventListener('pointerup', up, { once: true });\n\t\twindow.addEventListener('pointercancel', up, { once: true });\n\t}\n\n\tfunction onSplitterKeyDown(e: KeyboardEvent) {\n\t\t// Keyboard accessible resizing\n\t\tif (e.key === 'ArrowLeft') {\n\t\t\te.preventDefault();\n\t\t\tsplitLeftPct = clampPct(splitLeftPct - 2);\n\t\t\tsaveSplitPct(splitLeftPct);\n\t\t} else if (e.key === 'ArrowRight') {\n\t\t\te.preventDefault();\n\t\t\tsplitLeftPct = clampPct(splitLeftPct + 2);\n\t\t\tsaveSplitPct(splitLeftPct);\n\t\t} else if (e.key === 'Home') {\n\t\t\te.preventDefault();\n\t\t\tsplitLeftPct = minLeftPct;\n\t\t\tsaveSplitPct(splitLeftPct);\n\t\t} else if (e.key === 'End') {\n\t\t\te.preventDefault();\n\t\t\tsplitLeftPct = maxLeftPct;\n\t\t\tsaveSplitPct(splitLeftPct);\n\t\t}\n\t}\n\n\tfunction splitterInteractions(node: HTMLElement) {\n\t\tconst pointerDown = (e: PointerEvent) => onSplitterPointerDown(e);\n\t\tconst keyDown = (e: KeyboardEvent) => onSplitterKeyDown(e);\n\n\t\tnode.addEventListener('pointerdown', pointerDown);\n\t\tnode.addEventListener('keydown', keyDown);\n\n\t\treturn {\n\t\t\tdestroy() {\n\t\t\t\tnode.removeEventListener('pointerdown', pointerDown);\n\t\t\t\tnode.removeEventListener('keydown', keyDown);\n\t\t\t}\n\t\t};\n\t}\n\n\t// Load saved position on mount\n\tonMount(() => {\n\t\tconst loaded = loadSplitPct();\n\t\tif (loaded !== null) splitLeftPct = loaded;\n\t});\n\n\t// Initialize from prop (once). If there's a saved value, onMount() will override.\n\t$effect(() => {\n\t\tif (hasInitializedFromProps) return;\n\t\tsplitLeftPct = clampPct(initialSplitPct);\n\t\thasInitializedFromProps = true;\n\t});\n\n\t// Notify parent when right pane is ready\n\t$effect(() => {\n\t\tif (rightPaneEl && onRightPaneReady) {\n\t\t\tonRightPaneReady(rightPaneEl);\n\t\t}\n\t});\n</script>\n\n<div\n\tclass:resizing={isResizing}\n\tclass=\"split-layout\"\n\tbind:this={splitContainerEl}\n\tstyle={`--split-left: ${splitLeftPct}%;`}\n>\n\t<!-- Left pane (passage/stimulus) -->\n\t<div class=\"pane pane-left\">\n\t\t<RubricDisplay blocks={leftContent} {typeset} />\n\t</div>\n\n\t<!-- Resizer -->\n\t<!-- svelte-ignore a11y_no_noninteractive_tabindex -->\n\t<div\n\t\tclass=\"splitter\"\n\t\trole=\"separator\"\n\t\taria-orientation=\"vertical\"\n\t\taria-label={i18n?.t('accessibility.resizer', 'Resize passage and question panels')}\n\t\taria-valuemin={minLeftPct}\n\t\taria-valuemax={maxLeftPct}\n\t\taria-valuenow={Math.round(splitLeftPct)}\n\t\ttabindex=\"0\"\n\t\tuse:splitterInteractions\n\t>\n\t\t<div class=\"splitter-grip\" aria-hidden=\"true\"></div>\n\t</div>\n\n\t<!-- Right pane (question) -->\n\t<div class=\"pane pane-right\" bind:this={rightPaneEl}>\n\t\t{@render children()}\n\t</div>\n</div>\n\n<style>\n\t.split-layout {\n\t\tdisplay: grid;\n\t\t--splitter-size: 16px;\n\t\tgrid-template-columns: minmax(320px, var(--split-left)) var(--splitter-size) minmax(320px, 1fr);\n\t\tgap: 0;\n\t\theight: 100%;\n\t\tpadding: 2rem;\n\t\tmax-width: 1400px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.pane {\n\t\tmin-height: 0;\n\t\toverflow: auto;\n\t\tpadding: 0 1rem;\n\t}\n\n\t.splitter {\n\t\twidth: var(--splitter-size);\n\t\tcursor: col-resize;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\talign-self: stretch;\n\t\theight: 100%;\n\t\tbackground: var(--color-base-200);\n\t\tborder-left: 1px solid var(--color-base-300);\n\t\tborder-right: 1px solid var(--color-base-300);\n\t\tuser-select: none;\n\t\ttouch-action: none;\n\t\tposition: relative;\n\t}\n\n\t.splitter:hover {\n\t\tbackground: var(--color-base-300);\n\t\tborder-left-color: var(--color-base-300);\n\t\tborder-right-color: var(--color-base-300);\n\t}\n\n\t.splitter:focus-visible {\n\t\toutline: 2px solid var(--color-primary);\n\t\toutline-offset: 2px;\n\t}\n\n\t/* High-contrast center rail */\n\t.splitter::before {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tbottom: 0;\n\t\tleft: 50%;\n\t\twidth: 2px;\n\t\ttransform: translateX(-50%);\n\t\tbackground: color-mix(in oklab, var(--color-base-content) 55%, transparent);\n\t}\n\n\t.splitter-grip {\n\t\twidth: 6px;\n\t\theight: 72px;\n\t\tborder-radius: 999px;\n\t\tbackground: linear-gradient(\n\t\t\tto bottom,\n\t\t\tcolor-mix(in oklab, var(--color-base-content) 15%, transparent),\n\t\t\tcolor-mix(in oklab, var(--color-base-content) 55%, transparent),\n\t\t\tcolor-mix(in oklab, var(--color-base-content) 15%, transparent)\n\t\t);\n\t}\n\n\t.split-layout.resizing .splitter {\n\t\tbackground: color-mix(in oklab, var(--color-primary) 14%, transparent);\n\t\tborder-left-color: color-mix(in oklab, var(--color-primary) 60%, transparent);\n\t\tborder-right-color: color-mix(in oklab, var(--color-primary) 60%, transparent);\n\t}\n\n\t/* Avoid accidental text selection during resize */\n\t.split-layout.resizing {\n\t\tuser-select: none;\n\t}\n\n\t/* Avoid extra bottom spacing in panes */\n\t.pane :global(.rubric-container) {\n\t\tmargin-bottom: 0;\n\t}\n\n\t@media (max-width: 768px) {\n\t\t.split-layout {\n\t\t\tgrid-template-columns: 1fr;\n\t\t\tpadding: 1rem;\n\t\t}\n\n\t\t.splitter {\n\t\t\tdisplay: none;\n\t\t}\n\n\t\t.pane-left {\n\t\t\tmax-height: 40vh;\n\t\t}\n\t}\n</style>\n","<script lang=\"ts\">\n\t/**\n\t * TestFeedback Component\n\t *\n\t * Displays assessment-level feedback based on outcome conditions.\n\t * Shows feedback when QTI outcome conditions are met.\n\t */\n\timport type { I18nProvider } from '@pie-qti/i18n';\n\n\tinterface FeedbackItem {\n\t\tidentifier: string;\n\t\tcontent: string;\n\t\taccess: string;\n\t}\n\n\tinterface Props {\n\t\t/** Array of visible feedback items to display */\n\t\tfeedback?: FeedbackItem[];\n\t\t/** Callback when feedback is dismissed (if dismissable) */\n\t\tonDismiss?: (identifier: string) => void;\n\t\t/** Allow dismissing individual feedback items */\n\t\tdismissable?: boolean;\n\t\t/** CSS class for custom styling */\n\t\tclass?: string;\n\t\ti18n?: I18nProvider;\n\t}\n\n\tlet {\n\t\tfeedback = [],\n\t\tonDismiss,\n\t\tdismissable = false,\n\t\tclass: className = '',\n\t\ti18n\n\t}: Props = $props();\n\n\t// Track dismissed items\n\tlet dismissedItems = $state<Set<string>>(new Set());\n\n\t// Filter out dismissed items\n\tconst visibleFeedback = $derived(\n\t\tfeedback.filter((fb) => !dismissedItems.has(fb.identifier))\n\t);\n\n\tfunction handleDismiss(identifier: string) {\n\t\tdismissedItems.add(identifier);\n\t\tonDismiss?.(identifier);\n\t}\n</script>\n\n{#if visibleFeedback.length > 0}\n\t<div class=\"test-feedback {className}\" role=\"region\" aria-label={i18n?.t('feedback.testFeedback') ?? 'Test feedback'}>\n\t\t{#each visibleFeedback as item (item.identifier)}\n\t\t\t<div class=\"feedback-item\" data-identifier={item.identifier}>\n\t\t\t\t<div class=\"feedback-content\">\n\t\t\t\t\t{@html item.content}\n\t\t\t\t</div>\n\t\t\t\t{#if dismissable}\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"feedback-dismiss\"\n\t\t\t\t\t\tonclick={() => handleDismiss(item.identifier)}\n\t\t\t\t\t\taria-label={i18n?.t('feedback.closeFeedback', 'Dismiss feedback')}\n\t\t\t\t\t>\n\t\t\t\t\t\t×\n\t\t\t\t\t</button>\n\t\t\t\t{/if}\n\t\t\t</div>\n\t\t{/each}\n\t</div>\n{/if}\n\n<style>\n\t.test-feedback {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 1rem;\n\t\tmargin: 1rem 0;\n\t}\n\n\t.feedback-item {\n\t\tposition: relative;\n\t\tpadding: 1rem;\n\t\tborder-radius: 0.5rem;\n\t\tbackground-color: var(--feedback-bg, #f0f9ff);\n\t\tborder: 1px solid var(--feedback-border, #0ea5e9);\n\t\tbox-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n\t}\n\n\t.feedback-content {\n\t\tcolor: var(--feedback-text, #0c4a6e);\n\t\tline-height: 1.6;\n\t}\n\n\t.feedback-content :global(p) {\n\t\tmargin: 0 0 0.5rem 0;\n\t}\n\n\t.feedback-content :global(p:last-child) {\n\t\tmargin-bottom: 0;\n\t}\n\n\t.feedback-content :global(strong) {\n\t\tfont-weight: 600;\n\t}\n\n\t.feedback-content :global(em) {\n\t\tfont-style: italic;\n\t}\n\n\t.feedback-content :global(ul),\n\t.feedback-content :global(ol) {\n\t\tmargin: 0.5rem 0;\n\t\tpadding-left: 1.5rem;\n\t}\n\n\t.feedback-content :global(li) {\n\t\tmargin: 0.25rem 0;\n\t}\n\n\t.feedback-dismiss {\n\t\tposition: absolute;\n\t\ttop: 0.5rem;\n\t\tright: 0.5rem;\n\t\twidth: 2rem;\n\t\theight: 2rem;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tborder: none;\n\t\tbackground: transparent;\n\t\tcolor: var(--feedback-dismiss-color, #64748b);\n\t\tfont-size: 1.5rem;\n\t\tline-height: 1;\n\t\tcursor: pointer;\n\t\tborder-radius: 0.25rem;\n\t\ttransition: all 0.2s;\n\t}\n\n\t.feedback-dismiss:hover {\n\t\tbackground-color: var(--feedback-dismiss-hover-bg, rgba(0, 0, 0, 0.05));\n\t\tcolor: var(--feedback-dismiss-hover-color, #1e293b);\n\t}\n\n\t.feedback-dismiss:focus {\n\t\toutline: 2px solid var(--feedback-dismiss-focus, #0ea5e9);\n\t\toutline-offset: 2px;\n\t}\n</style>\n","<script lang=\"ts\">\n\timport { onMount, tick, getContext } from 'svelte';\n\timport type { SvelteI18nProvider } from '@pie-qti/i18n';\n\timport type { BackendAssessmentPlayerConfig } from '../core/AssessmentPlayer.js';\n\timport { AssessmentPlayer } from '../core/AssessmentPlayer.js';\n\timport type { BackendAdapter, InitSessionRequest } from '../integration/api-contract.js';\n\timport type { AssessmentResults, NavigationState } from '../types/index.js';\n\timport AccessibilityAnnouncer from './AccessibilityAnnouncer.svelte';\n\timport AssessmentHeader from './AssessmentHeader.svelte';\n\timport ItemRenderer from './ItemRenderer.svelte';\n\timport NavigationBar from './NavigationBar.svelte';\n\timport RubricDisplay from './RubricDisplay.svelte';\n\timport SplitPaneResizer from './SplitPaneResizer.svelte';\n\timport TestFeedback from './TestFeedback.svelte';\n\n\tinterface Props {\n\t\tbackend: BackendAdapter;\n\t\tinitSession: InitSessionRequest;\n\t\tconfig?: Partial<BackendAssessmentPlayerConfig>;\n\t\t/**\n\t\t * Called after a successful submit (with results).\n\t\t * Note: `config.onComplete` is invoked by `AssessmentPlayer.submit()` already.\n\t\t */\n\t\tonSubmit?: (results: AssessmentResults) => void;\n\t\t/** Math typesetting function (KaTeX, MathJax, etc.) */\n\t\ttypeset?: (root: HTMLElement) => void | Promise<void>;\n\t}\n\n\tconst { backend, initSession, config = {}, onSubmit, typeset }: Props = $props();\n\n\t// Get i18n from context (set by +layout.svelte)\n\tconst contextI18nWrapper = getContext<{ value: SvelteI18nProvider | null } | undefined>('i18n');\n\tconst contextI18n = $derived(contextI18nWrapper?.value);\n\n\tlet player = $state<AssessmentPlayer | null>(null);\n\tconst i18n = $derived(player?.getI18nProvider() ?? contextI18n);\n\tlet navState = $state<NavigationState>({\n\t\tcurrentIndex: -1,\n\t\ttotalItems: 0,\n\t\tcanNext: false,\n\t\tcanPrevious: false,\n\t\tisLoading: false,\n\t\tcurrentSection: undefined,\n\t\ttotalSections: undefined,\n\t});\n\tlet currentItem = $state<any>(null);\n\tlet currentRubricBlocks = $state<any[]>([]);\n\tlet currentResponses = $state<Record<string, unknown>>({});\n\tlet sections = $state<any[]>([]);\n\tlet error = $state<string | null>(null);\n\tlet navError = $state<string | null>(null);\n\tlet itemPaneEl = $state<HTMLDivElement | null>(null);\n\tlet rootEl = $state<HTMLElement | null>(null);\n\tlet testFeedback = $state<Array<{ identifier: string; content: string; access: string }>>([]);\n\tlet isComplete = $state(false);\n\tlet initTimeout: ReturnType<typeof setTimeout> | null = null;\n\tlet hasFirstItem = $state(false);\n\tlet announcer = $state<AccessibilityAnnouncer | null>(null);\n\n\tconst passageBlocks = $derived(currentRubricBlocks.filter((b) => b?.use === 'passage'));\n\tconst nonPassageRubricBlocks = $derived(currentRubricBlocks.filter((b) => b?.use !== 'passage'));\n\tconst hasPassage = $derived(passageBlocks.length > 0);\n\n\t// Initialize player\n\tonMount(() => {\n\t\t// Never allow infinite \"Loading assessment...\" state\n\t\tinitTimeout = setTimeout(() => {\n\t\t\tif (!hasFirstItem && !error) {\n\t\t\t\terror = contextI18n?.t('assessment.loadingError') ?? 'assessment.loadingError';\n\t\t\t\tannouncer?.announce(error, 3000, 'assertive');\n\t\t\t}\n\t\t}, 10000);\n\n\t\tconst playerConfig: BackendAssessmentPlayerConfig = {\n\t\t\tbackend,\n\t\t\tinitSession,\n\t\t\tshowSections: config.showSections !== false,\n\t\t\tallowSectionNavigation: config.allowSectionNavigation !== false,\n\t\t\tshowProgress: config.showProgress !== false,\n\t\t\ti18nProvider: contextI18n, // Pass i18n from context\n\t\t\t...config,\n\t\t};\n\n\t\t(async () => {\n\t\t\tplayer = await AssessmentPlayer.create(playerConfig);\n\n\t\t\t// Get sections\n\t\t\tsections = player.getAllSections();\n\n\t\t\t// Set up event listeners\n\t\t\tplayer.onItemChange(async () => {\n\t\t\t\tupdateState();\n\t\t\t\tnavError = null;\n\t\t\t\thasFirstItem = true;\n\t\t\t\tif (initTimeout) {\n\t\t\t\t\tclearTimeout(initTimeout);\n\t\t\t\t\tinitTimeout = null;\n\t\t\t\t}\n\t\t\t\tawait tick();\n\t\t\t\titemPaneEl?.scrollTo({ top: 0, behavior: 'auto' });\n\t\t\t});\n\n\t\t\tplayer.onSectionChange(() => {\n\t\t\t\tupdateState();\n\t\t\t});\n\n\t\t\tplayer.onResponseChange((responses) => {\n\t\t\t\tcurrentResponses = responses;\n\t\t\t});\n\n\t\t\t// If backend did not restore a current item, start at index 0.\n\t\t\tif (player.getNavigationState().currentIndex < 0) {\n\t\t\t\tawait player.navigateTo(0);\n\t\t\t} else {\n\t\t\t\tupdateState();\n\t\t\t\thasFirstItem = true;\n\t\t\t\tif (initTimeout) {\n\t\t\t\t\tclearTimeout(initTimeout);\n\t\t\t\t\tinitTimeout = null;\n\t\t\t\t}\n\t\t\t}\n\t\t})().catch((err) => {\n\t\t\tconsole.error('Failed to initialize assessment player:', err);\n\t\t\terror = err instanceof Error ? err.message : (contextI18n?.t('assessment.loadingError') ?? 'assessment.loadingError');\n\t\t\tannouncer?.announce(error, 3000, 'assertive');\n\t\t});\n\n\t\treturn () => {\n\t\t\tif (initTimeout) {\n\t\t\t\tclearTimeout(initTimeout);\n\t\t\t\tinitTimeout = null;\n\t\t\t}\n\t\t\tif (player) {\n\t\t\t\tplayer.destroy();\n\t\t\t}\n\t\t};\n\t});\n\n\tfunction updateState() {\n\t\tif (!player) return;\n\n\t\tnavState = player.getNavigationState();\n\t\tcurrentItem = player.getCurrentItem();\n\t\tcurrentRubricBlocks = player.getCurrentRubricBlocks();\n\t\tcurrentResponses = player.getResponses();\n\t}\n\n\tasync function handlePrevious() {\n\t\tif (!player) return;\n\t\ttry {\n\t\t\tnavError = null;\n\t\t\tawait player.previous();\n\t\t\tawait manageFocusAfterNavigation();\n\t\t\tannounceCurrentQuestion();\n\t\t} catch (err) {\n\t\t\tconsole.error('Previous navigation failed:', err);\n\t\t\tconst message = err instanceof Error ? err.message : (i18n?.t('assessment.errors.navigationFailed') ?? 'assessment.errors.navigationFailed');\n\t\t\tnavError = message;\n\t\t}\n\t}\n\n\tasync function handleNext() {\n\t\tif (!player) return;\n\t\ttry {\n\t\t\tnavError = null;\n\t\t\tawait player.next();\n\t\t\tawait manageFocusAfterNavigation();\n\t\t\tannounceCurrentQuestion();\n\t\t} catch (err) {\n\t\t\tconsole.error('Next navigation failed:', err);\n\t\t\tconst message = err instanceof Error ? err.message : (i18n?.t('assessment.errors.navigationFailed') ?? 'assessment.errors.navigationFailed');\n\t\t\tnavError = message;\n\t\t}\n\t}\n\n\t/**\n\t * Announce current question to screen readers\n\t */\n\tfunction announceCurrentQuestion() {\n\t\tif (!player) return;\n\t\tconst state = player.getNavigationState();\n\t\tconst msg = i18n?.t('assessment.questionAnnouncement', {\n\t\t\tcurrent: state.currentIndex + 1,\n\t\t\ttotal: state.totalItems\n\t\t}) ?? `assessment.questionAnnouncement (${state.currentIndex + 1}/${state.totalItems})`;\n\t\tannouncer?.announce(msg, 1500);\n\t}\n\n\tasync function handleSectionSelect(sectionIndex: number) {\n\t\tif (!player || !sections[sectionIndex]) return;\n\n\t\tconst section = sections[sectionIndex];\n\t\tawait player.navigateToSection(section.id);\n\t\tawait manageFocusAfterNavigation();\n\t}\n\n\t/**\n\t * Manage focus after navigation to improve accessibility.\n\t * Moves focus to the content area so screen reader users are aware of the content change.\n\t */\n\tasync function manageFocusAfterNavigation() {\n\t\tawait tick(); // Wait for DOM updates\n\n\t\t// Try to focus on the item pane (for split pane layout)\n\t\tif (itemPaneEl) {\n\t\t\titemPaneEl.focus();\n\t\t\treturn;\n\t\t}\n\n\t\t// Otherwise focus on the content area\n\t\tconst contentEl = document.querySelector('.assessment-content') as HTMLElement;\n\t\tif (contentEl) {\n\t\t\tcontentEl.focus();\n\t\t}\n\t}\n\n\tasync function handleSubmit() {\n\t\tif (!player) return;\n\n\t\ttry {\n\t\t\tconst results = await player.submit();\n\t\t\tconsole.log('Assessment results:', results);\n\n\t\t\t// Get test feedback based on outcomes\n\t\t\ttestFeedback = player.getVisibleFeedback();\n\t\t\tisComplete = true;\n\n\t\t\tonSubmit?.(results);\n\n\t\t\t// Could also emit a custom event here\n\t\t\t// Or show results modal\n\t\t} catch (err) {\n\t\t\tconsole.error('Failed to submit assessment:', err);\n\t\t\tconst message = err instanceof Error ? err.message : (i18n?.t('assessment.errors.submitFailed') ?? 'assessment.errors.submitFailed');\n\t\t\terror = message;\n\t\t\tannouncer?.announce(message, 3000, 'assertive');\n\t\t}\n\t}\n\n\tfunction handleResponseChange(responseId: string, value: unknown) {\n\t\tif (!player) return;\n\t\tif (currentItem?.identifier) {\n\t\t\tplayer.updateResponseForItem(currentItem.identifier, responseId, value);\n\t\t} else {\n\t\t\tplayer.updateResponse(responseId, value);\n\t\t}\n\t}\n\n\t/**\n\t * Imperative API (useful for embedding in host frameworks / custom elements)\n\t */\n\texport async function next() {\n\t\treturn player?.next();\n\t}\n\n\texport async function previous() {\n\t\treturn player?.previous();\n\t}\n\n\texport async function navigateTo(index: number) {\n\t\treturn player?.navigateTo(index);\n\t}\n\n\texport async function navigateToSection(sectionIdentifier: string) {\n\t\treturn player?.navigateToSection(sectionIdentifier);\n\t}\n\n\texport async function submit() {\n\t\treturn player?.submit();\n\t}\n\n\texport function getResponses() {\n\t\treturn player?.getResponses();\n\t}\n\n\texport function getState() {\n\t\treturn player?.getState();\n\t}\n\n\texport function restoreState(state: any) {\n\t\treturn player?.restoreState(state);\n\t}\n</script>\n\n<!-- Accessibility announcer for screen readers -->\n<AccessibilityAnnouncer bind:this={announcer} />\n\n{#if error}\n\t<div class=\"assessment-error\">\n\t\t<div class=\"alert alert-error\" role=\"alert\" aria-live=\"assertive\">\n\t\t\t<svg\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\tclass=\"stroke-current shrink-0 h-6 w-6\"\n\t\t\t\tfill=\"none\"\n\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t>\n\t\t\t\t<path\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\td=\"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z\"\n\t\t\t\t/>\n\t\t\t</svg>\n\t\t\t<span>{error}</span>\n\t\t</div>\n\t</div>\n{:else if !player || navState.currentIndex < 0}\n\t<div class=\"assessment-loading\">\n\t\t<div class=\"flex items-center justify-center p-8\" role=\"status\" aria-live=\"polite\">\n\t\t\t<span class=\"loading loading-spinner loading-lg\"></span>\n\t\t\t<span class=\"ml-4\">{contextI18n?.t('assessment.loading') ?? 'assessment.loading'}</span>\n\t\t</div>\n\t</div>\n{:else}\n\t<div bind:this={rootEl} class=\"assessment-shell\" role=\"region\" aria-label=\"Assessment player\">\n\t\t<!-- Header with title and section menu -->\n\t\t<AssessmentHeader\n\t\t\ttitle={initSession.assessmentId || (i18n?.t('assessment.title') ?? 'Assessment')}\n\t\t\t{sections}\n\t\t\tcurrentSectionIndex={navState.currentSection?.index}\n\t\t\tshowSections={config.showSections}\n\t\t\tallowSectionNavigation={config.allowSectionNavigation}\n\t\t\tonSectionSelect={handleSectionSelect}\n\t\t/>\n\n\t\t<!-- Test Feedback (shown after completion) -->\n\t\t{#if isComplete && testFeedback.length > 0}\n\t\t\t<TestFeedback feedback={testFeedback} />\n\t\t{/if}\n\n\t\t{#if navError}\n\t\t\t<div class=\"assessment-nav-error\">\n\t\t\t\t<div class=\"alert alert-warning\" role=\"alert\" aria-live=\"assertive\">\n\t\t\t\t\t<svg\n\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\tclass=\"stroke-current shrink-0 h-6 w-6\"\n\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<path\n\t\t\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\t\t\td=\"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</svg>\n\t\t\t\t\t<span>{navError}</span>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t{/if}\n\n\t\t<!-- Main content area -->\n\t\t<div\n\t\t\tclass:has-passage={hasPassage}\n\t\t\tclass=\"assessment-content\"\n\t\t\ttabindex=\"-1\"\n\t\t\trole=\"region\"\n\t\t\taria-label={i18n?.t('accessibility.itemBody') ?? 'Question content'}\n\t\t>\n\t\t\t{#if hasPassage}\n\t\t\t\t<SplitPaneResizer\n\t\t\t\t\tleftContent={passageBlocks}\n\t\t\t\t\t{typeset}\n\t\t\t\t\tstorageKey=\"pie-qti22-assessment-player.splitLeftPct\"\n\t\t\t\t\tonRightPaneReady={(el) => itemPaneEl = el}\n\t\t\t\t>\n\t\t\t\t\t{#if nonPassageRubricBlocks.length > 0}\n\t\t\t\t\t\t<RubricDisplay blocks={nonPassageRubricBlocks} {typeset} />\n\t\t\t\t\t{/if}\n\n\t\t\t\t\t{#if currentItem}\n\t\t\t\t\t\t<ItemRenderer\n\t\t\t\t\t\t\titemRef={currentItem}\n\t\t\t\t\t\t\tresponses={currentResponses}\n\t\t\t\t\t\t\trole={config.role || 'candidate'}\n\t\t\t\t\t\t\textendedTextEditor={config.extendedTextEditor || 'tiptap'}\n\t\t\t\t\t\t\tonResponseChange={handleResponseChange}\n\t\t\t\t\t\t\t{typeset}\n\t\t\t\t\t\t\t{i18n}\n\t\t\t\t\t\t\tsecurity={config.security}\n\t\t\t\t\t\t\tpnp={config.pnp}\n\t\t\t\t\t\t/>\n\t\t\t\t\t{/if}\n\t\t\t\t</SplitPaneResizer>\n\t\t\t{:else}\n\t\t\t\t<!-- Rubric blocks (passages, instructions) -->\n\t\t\t\t{#if currentRubricBlocks.length > 0}\n\t\t\t\t\t<RubricDisplay blocks={currentRubricBlocks} {typeset} />\n\t\t\t\t{/if}\n\n\t\t\t\t<!-- Current item -->\n\t\t\t\t{#if currentItem}\n\t\t\t\t\t<ItemRenderer\n\t\t\t\t\t\titemRef={currentItem}\n\t\t\t\t\t\tresponses={currentResponses}\n\t\t\t\t\t\trole={config.role || 'candidate'}\n\t\t\t\t\t\tonResponseChange={handleResponseChange}\n\t\t\t\t\t\t{typeset}\n\t\t\t\t\t\t{i18n}\n\t\t\t\t\t\tsecurity={config.security}\n\t\t\t\t\t\tpnp={config.pnp}\n\t\t\t\t\t/>\n\t\t\t\t{/if}\n\t\t\t{/if}\n\t\t</div>\n\n\t\t<!-- Navigation bar -->\n\t\t{#if i18n}\n\t\t\t<NavigationBar\n\t\t\t\tnavState={navState}\n\t\t\t\t{i18n}\n\t\t\t\tonPrevious={handlePrevious}\n\t\t\t\tonNext={handleNext}\n\t\t\t\tonSubmit={handleSubmit}\n\t\t\t\tshowProgress={config.showProgress !== false}\n\t\t\t/>\n\t\t{/if}\n\t</div>\n{/if}\n\n<style>\n\t.assessment-shell {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\theight: 100vh;\n\t\toverflow: hidden;\n\t\tbackground: var(--color-base-100);\n\t}\n\n\t.assessment-content {\n\t\tflex: 1;\n\t\tpadding: 2rem;\n\t\tmax-width: 1200px;\n\t\tmargin: 0 auto;\n\t\twidth: 100%;\n\t\toverflow: auto;\n\t}\n\n\t.assessment-content:focus {\n\t\toutline: 2px solid var(--color-primary);\n\t\toutline-offset: -2px;\n\t}\n\n\t.assessment-content.has-passage {\n\t\tpadding: 0;\n\t\tmax-width: none;\n\t\toverflow: hidden;\n\t}\n\n\t.assessment-error,\n\t.assessment-loading {\n\t\tpadding: 2rem;\n\t}\n\n\t.assessment-nav-error {\n\t\tpadding: 1rem 2rem 0;\n\t}\n\n\t@media (max-width: 768px) {\n\t\t.assessment-content {\n\t\t\tpadding: 1rem;\n\t\t}\n\n\t\t.assessment-content.has-passage {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n</style>\n","// used in Attr to signal changes\nexport const CHANGED = Symbol('changed');\n\n// used in Element to setup once classList\nexport const CLASS_LIST = Symbol('classList');\n\n// used in Document to attach once customElements\nexport const CUSTOM_ELEMENTS = Symbol('CustomElements');\n\n// used in HTMLTemplateElement\nexport const CONTENT = Symbol('content');\n\n// used in Element for data attributes\nexport const DATASET = Symbol('dataset');\n\n// used in Document to attach the DocType\nexport const DOCTYPE = Symbol('doctype');\n\n// used in parser and Document to attach once a DOMParser\nexport const DOM_PARSER = Symbol('DOMParser');\n\n// used to reference an end node\nexport const END = Symbol('end');\n\n// used in Document to make the globalThis an event target\nexport const EVENT_TARGET = Symbol('EventTarget');\n\n// used to augment a created document defaultView\nexport const GLOBALS = Symbol('globals');\n\n// used in both Canvas and Document to provide images\nexport const IMAGE = Symbol('image');\n\n// used to define Document mime type\nexport const MIME = Symbol('mime');\n\n// used in Document to attach once MutationObserver\nexport const MUTATION_OBSERVER = Symbol('MutationObserver');\n\n// used to define next node reference\nexport const NEXT = Symbol('next');\n\n// used to define Attr owner elements\nexport const OWNER_ELEMENT = Symbol('ownerElement');\n\n// used to define previous node reference\nexport const PREV = Symbol('prev');\n\n// used to define various \"private\" properties\nexport const PRIVATE = Symbol('private');\n\n// used to define the CSSStyleSheet.sheet\nexport const SHEET = Symbol('sheet');\n\n// used to define start node reference\nexport const START = Symbol('start');\n\n// used to define special CSS style attribute\nexport const STYLE = Symbol('style');\n\n// used to upgrade Custom Elements\nexport const UPGRADE = Symbol('upgrade');\n\n// used to define generic values\nexport const VALUE = Symbol('value');\n","// Generated using scripts/write-decode-map.ts\nexport const htmlDecodeTree = /* #__PURE__ */ new Uint16Array(\n// prettier-ignore\n/* #__PURE__ */ \"\\u1d41<\\xd5\\u0131\\u028a\\u049d\\u057b\\u05d0\\u0675\\u06de\\u07a2\\u07d6\\u080f\\u0a4a\\u0a91\\u0da1\\u0e6d\\u0f09\\u0f26\\u10ca\\u1228\\u12e1\\u1415\\u149d\\u14c3\\u14df\\u1525\\0\\0\\0\\0\\0\\0\\u156b\\u16cd\\u198d\\u1c12\\u1ddd\\u1f7e\\u2060\\u21b0\\u228d\\u23c0\\u23fb\\u2442\\u2824\\u2912\\u2d08\\u2e48\\u2fce\\u3016\\u32ba\\u3639\\u37ac\\u38fe\\u3a28\\u3a71\\u3ae0\\u3b2e\\u0800EMabcfglmnoprstu\\\\bfms\\x7f\\x84\\x8b\\x90\\x95\\x98\\xa6\\xb3\\xb9\\xc8\\xcflig\\u803b\\xc6\\u40c6P\\u803b&\\u4026cute\\u803b\\xc1\\u40c1reve;\\u4102\\u0100iyx}rc\\u803b\\xc2\\u40c2;\\u4410r;\\uc000\\ud835\\udd04rave\\u803b\\xc0\\u40c0pha;\\u4391acr;\\u4100d;\\u6a53\\u0100gp\\x9d\\xa1on;\\u4104f;\\uc000\\ud835\\udd38plyFunction;\\u6061ing\\u803b\\xc5\\u40c5\\u0100cs\\xbe\\xc3r;\\uc000\\ud835\\udc9cign;\\u6254ilde\\u803b\\xc3\\u40c3ml\\u803b\\xc4\\u40c4\\u0400aceforsu\\xe5\\xfb\\xfe\\u0117\\u011c\\u0122\\u0127\\u012a\\u0100cr\\xea\\xf2kslash;\\u6216\\u0176\\xf6\\xf8;\\u6ae7ed;\\u6306y;\\u4411\\u0180crt\\u0105\\u010b\\u0114ause;\\u6235noullis;\\u612ca;\\u4392r;\\uc000\\ud835\\udd05pf;\\uc000\\ud835\\udd39eve;\\u42d8c\\xf2\\u0113mpeq;\\u624e\\u0700HOacdefhilorsu\\u014d\\u0151\\u0156\\u0180\\u019e\\u01a2\\u01b5\\u01b7\\u01ba\\u01dc\\u0215\\u0273\\u0278\\u027ecy;\\u4427PY\\u803b\\xa9\\u40a9\\u0180cpy\\u015d\\u0162\\u017aute;\\u4106\\u0100;i\\u0167\\u0168\\u62d2talDifferentialD;\\u6145leys;\\u612d\\u0200aeio\\u0189\\u018e\\u0194\\u0198ron;\\u410cdil\\u803b\\xc7\\u40c7rc;\\u4108nint;\\u6230ot;\\u410a\\u0100dn\\u01a7\\u01adilla;\\u40b8terDot;\\u40b7\\xf2\\u017fi;\\u43a7rcle\\u0200DMPT\\u01c7\\u01cb\\u01d1\\u01d6ot;\\u6299inus;\\u6296lus;\\u6295imes;\\u6297o\\u0100cs\\u01e2\\u01f8kwiseContourIntegral;\\u6232eCurly\\u0100DQ\\u0203\\u020foubleQuote;\\u601duote;\\u6019\\u0200lnpu\\u021e\\u0228\\u0247\\u0255on\\u0100;e\\u0225\\u0226\\u6237;\\u6a74\\u0180git\\u022f\\u0236\\u023aruent;\\u6261nt;\\u622fourIntegral;\\u622e\\u0100fr\\u024c\\u024e;\\u6102oduct;\\u6210nterClockwiseContourIntegral;\\u6233oss;\\u6a2fcr;\\uc000\\ud835\\udc9ep\\u0100;C\\u0284\\u0285\\u62d3ap;\\u624d\\u0580DJSZacefios\\u02a0\\u02ac\\u02b0\\u02b4\\u02b8\\u02cb\\u02d7\\u02e1\\u02e6\\u0333\\u048d\\u0100;o\\u0179\\u02a5trahd;\\u6911cy;\\u4402cy;\\u4405cy;\\u440f\\u0180grs\\u02bf\\u02c4\\u02c7ger;\\u6021r;\\u61a1hv;\\u6ae4\\u0100ay\\u02d0\\u02d5ron;\\u410e;\\u4414l\\u0100;t\\u02dd\\u02de\\u6207a;\\u4394r;\\uc000\\ud835\\udd07\\u0100af\\u02eb\\u0327\\u0100cm\\u02f0\\u0322ritical\\u0200ADGT\\u0300\\u0306\\u0316\\u031ccute;\\u40b4o\\u0174\\u030b\\u030d;\\u42d9bleAcute;\\u42ddrave;\\u4060ilde;\\u42dcond;\\u62c4ferentialD;\\u6146\\u0470\\u033d\\0\\0\\0\\u0342\\u0354\\0\\u0405f;\\uc000\\ud835\\udd3b\\u0180;DE\\u0348\\u0349\\u034d\\u40a8ot;\\u60dcqual;\\u6250ble\\u0300CDLRUV\\u0363\\u0372\\u0382\\u03cf\\u03e2\\u03f8ontourIntegra\\xec\\u0239o\\u0274\\u0379\\0\\0\\u037b\\xbb\\u0349nArrow;\\u61d3\\u0100eo\\u0387\\u03a4ft\\u0180ART\\u0390\\u0396\\u03a1rrow;\\u61d0ightArrow;\\u61d4e\\xe5\\u02cang\\u0100LR\\u03ab\\u03c4eft\\u0100AR\\u03b3\\u03b9rrow;\\u67f8ightArrow;\\u67faightArrow;\\u67f9ight\\u0100AT\\u03d8\\u03derrow;\\u61d2ee;\\u62a8p\\u0241\\u03e9\\0\\0\\u03efrrow;\\u61d1ownArrow;\\u61d5erticalBar;\\u6225n\\u0300ABLRTa\\u0412\\u042a\\u0430\\u045e\\u047f\\u037crrow\\u0180;BU\\u041d\\u041e\\u0422\\u6193ar;\\u6913pArrow;\\u61f5reve;\\u4311eft\\u02d2\\u043a\\0\\u0446\\0\\u0450ightVector;\\u6950eeVector;\\u695eector\\u0100;B\\u0459\\u045a\\u61bdar;\\u6956ight\\u01d4\\u0467\\0\\u0471eeVector;\\u695fector\\u0100;B\\u047a\\u047b\\u61c1ar;\\u6957ee\\u0100;A\\u0486\\u0487\\u62a4rrow;\\u61a7\\u0100ct\\u0492\\u0497r;\\uc000\\ud835\\udc9frok;\\u4110\\u0800NTacdfglmopqstux\\u04bd\\u04c0\\u04c4\\u04cb\\u04de\\u04e2\\u04e7\\u04ee\\u04f5\\u0521\\u052f\\u0536\\u0552\\u055d\\u0560\\u0565G;\\u414aH\\u803b\\xd0\\u40d0cute\\u803b\\xc9\\u40c9\\u0180aiy\\u04d2\\u04d7\\u04dcron;\\u411arc\\u803b\\xca\\u40ca;\\u442dot;\\u4116r;\\uc000\\ud835\\udd08rave\\u803b\\xc8\\u40c8ement;\\u6208\\u0100ap\\u04fa\\u04fecr;\\u4112ty\\u0253\\u0506\\0\\0\\u0512mallSquare;\\u65fberySmallSquare;\\u65ab\\u0100gp\\u0526\\u052aon;\\u4118f;\\uc000\\ud835\\udd3csilon;\\u4395u\\u0100ai\\u053c\\u0549l\\u0100;T\\u0542\\u0543\\u6a75ilde;\\u6242librium;\\u61cc\\u0100ci\\u0557\\u055ar;\\u6130m;\\u6a73a;\\u4397ml\\u803b\\xcb\\u40cb\\u0100ip\\u056a\\u056fsts;\\u6203onentialE;\\u6147\\u0280cfios\\u0585\\u0588\\u058d\\u05b2\\u05ccy;\\u4424r;\\uc000\\ud835\\udd09lled\\u0253\\u0597\\0\\0\\u05a3mallSquare;\\u65fcerySmallSquare;\\u65aa\\u0370\\u05ba\\0\\u05bf\\0\\0\\u05c4f;\\uc000\\ud835\\udd3dAll;\\u6200riertrf;\\u6131c\\xf2\\u05cb\\u0600JTabcdfgorst\\u05e8\\u05ec\\u05ef\\u05fa\\u0600\\u0612\\u0616\\u061b\\u061d\\u0623\\u066c\\u0672cy;\\u4403\\u803b>\\u403emma\\u0100;d\\u05f7\\u05f8\\u4393;\\u43dcreve;\\u411e\\u0180eiy\\u0607\\u060c\\u0610dil;\\u4122rc;\\u411c;\\u4413ot;\\u4120r;\\uc000\\ud835\\udd0a;\\u62d9pf;\\uc000\\ud835\\udd3eeater\\u0300EFGLST\\u0635\\u0644\\u064e\\u0656\\u065b\\u0666qual\\u0100;L\\u063e\\u063f\\u6265ess;\\u62dbullEqual;\\u6267reater;\\u6aa2ess;\\u6277lantEqual;\\u6a7eilde;\\u6273cr;\\uc000\\ud835\\udca2;\\u626b\\u0400Aacfiosu\\u0685\\u068b\\u0696\\u069b\\u069e\\u06aa\\u06be\\u06caRDcy;\\u442a\\u0100ct\\u0690\\u0694ek;\\u42c7;\\u405eirc;\\u4124r;\\u610clbertSpace;\\u610b\\u01f0\\u06af\\0\\u06b2f;\\u610dizontalLine;\\u6500\\u0100ct\\u06c3\\u06c5\\xf2\\u06a9rok;\\u4126mp\\u0144\\u06d0\\u06d8ownHum\\xf0\\u012fqual;\\u624f\\u0700EJOacdfgmnostu\\u06fa\\u06fe\\u0703\\u0707\\u070e\\u071a\\u071e\\u0721\\u0728\\u0744\\u0778\\u078b\\u078f\\u0795cy;\\u4415lig;\\u4132cy;\\u4401cute\\u803b\\xcd\\u40cd\\u0100iy\\u0713\\u0718rc\\u803b\\xce\\u40ce;\\u4418ot;\\u4130r;\\u6111rave\\u803b\\xcc\\u40cc\\u0180;ap\\u0720\\u072f\\u073f\\u0100cg\\u0734\\u0737r;\\u412ainaryI;\\u6148lie\\xf3\\u03dd\\u01f4\\u0749\\0\\u0762\\u0100;e\\u074d\\u074e\\u622c\\u0100gr\\u0753\\u0758ral;\\u622bsection;\\u62c2isible\\u0100CT\\u076c\\u0772omma;\\u6063imes;\\u6062\\u0180gpt\\u077f\\u0783\\u0788on;\\u412ef;\\uc000\\ud835\\udd40a;\\u4399cr;\\u6110ilde;\\u4128\\u01eb\\u079a\\0\\u079ecy;\\u4406l\\u803b\\xcf\\u40cf\\u0280cfosu\\u07ac\\u07b7\\u07bc\\u07c2\\u07d0\\u0100iy\\u07b1\\u07b5rc;\\u4134;\\u4419r;\\uc000\\ud835\\udd0dpf;\\uc000\\ud835\\udd41\\u01e3\\u07c7\\0\\u07ccr;\\uc000\\ud835\\udca5rcy;\\u4408kcy;\\u4404\\u0380HJacfos\\u07e4\\u07e8\\u07ec\\u07f1\\u07fd\\u0802\\u0808cy;\\u4425cy;\\u440cppa;\\u439a\\u0100ey\\u07f6\\u07fbdil;\\u4136;\\u441ar;\\uc000\\ud835\\udd0epf;\\uc000\\ud835\\udd42cr;\\uc000\\ud835\\udca6\\u0580JTaceflmost\\u0825\\u0829\\u082c\\u0850\\u0863\\u09b3\\u09b8\\u09c7\\u09cd\\u0a37\\u0a47cy;\\u4409\\u803b<\\u403c\\u0280cmnpr\\u0837\\u083c\\u0841\\u0844\\u084dute;\\u4139bda;\\u439bg;\\u67ealacetrf;\\u6112r;\\u619e\\u0180aey\\u0857\\u085c\\u0861ron;\\u413ddil;\\u413b;\\u441b\\u0100fs\\u0868\\u0970t\\u0500ACDFRTUVar\\u087e\\u08a9\\u08b1\\u08e0\\u08e6\\u08fc\\u092f\\u095b\\u0390\\u096a\\u0100nr\\u0883\\u088fgleBracket;\\u67e8row\\u0180;BR\\u0899\\u089a\\u089e\\u6190ar;\\u61e4ightArrow;\\u61c6eiling;\\u6308o\\u01f5\\u08b7\\0\\u08c3bleBracket;\\u67e6n\\u01d4\\u08c8\\0\\u08d2eeVector;\\u6961ector\\u0100;B\\u08db\\u08dc\\u61c3ar;\\u6959loor;\\u630aight\\u0100AV\\u08ef\\u08f5rrow;\\u6194ector;\\u694e\\u0100er\\u0901\\u0917e\\u0180;AV\\u0909\\u090a\\u0910\\u62a3rrow;\\u61a4ector;\\u695aiangle\\u0180;BE\\u0924\\u0925\\u0929\\u62b2ar;\\u69cfqual;\\u62b4p\\u0180DTV\\u0937\\u0942\\u094cownVector;\\u6951eeVector;\\u6960ector\\u0100;B\\u0956\\u0957\\u61bfar;\\u6958ector\\u0100;B\\u0965\\u0966\\u61bcar;\\u6952ight\\xe1\\u039cs\\u0300EFGLST\\u097e\\u098b\\u0995\\u099d\\u09a2\\u09adqualGreater;\\u62daullEqual;\\u6266reater;\\u6276ess;\\u6aa1lantEqual;\\u6a7dilde;\\u6272r;\\uc000\\ud835\\udd0f\\u0100;e\\u09bd\\u09be\\u62d8ftarrow;\\u61daidot;\\u413f\\u0180npw\\u09d4\\u0a16\\u0a1bg\\u0200LRlr\\u09de\\u09f7\\u0a02\\u0a10eft\\u0100AR\\u09e6\\u09ecrrow;\\u67f5ightArrow;\\u67f7ightArrow;\\u67f6eft\\u0100ar\\u03b3\\u0a0aight\\xe1\\u03bfight\\xe1\\u03caf;\\uc000\\ud835\\udd43er\\u0100LR\\u0a22\\u0a2ceftArrow;\\u6199ightArrow;\\u6198\\u0180cht\\u0a3e\\u0a40\\u0a42\\xf2\\u084c;\\u61b0rok;\\u4141;\\u626a\\u0400acefiosu\\u0a5a\\u0a5d\\u0a60\\u0a77\\u0a7c\\u0a85\\u0a8b\\u0a8ep;\\u6905y;\\u441c\\u0100dl\\u0a65\\u0a6fiumSpace;\\u605flintrf;\\u6133r;\\uc000\\ud835\\udd10nusPlus;\\u6213pf;\\uc000\\ud835\\udd44c\\xf2\\u0a76;\\u439c\\u0480Jacefostu\\u0aa3\\u0aa7\\u0aad\\u0ac0\\u0b14\\u0b19\\u0d91\\u0d97\\u0d9ecy;\\u440acute;\\u4143\\u0180aey\\u0ab4\\u0ab9\\u0aberon;\\u4147dil;\\u4145;\\u441d\\u0180gsw\\u0ac7\\u0af0\\u0b0eative\\u0180MTV\\u0ad3\\u0adf\\u0ae8ediumSpace;\\u600bhi\\u0100cn\\u0ae6\\u0ad8\\xeb\\u0ad9eryThi\\xee\\u0ad9ted\\u0100GL\\u0af8\\u0b06reaterGreate\\xf2\\u0673essLes\\xf3\\u0a48Line;\\u400ar;\\uc000\\ud835\\udd11\\u0200Bnpt\\u0b22\\u0b28\\u0b37\\u0b3areak;\\u6060BreakingSpace;\\u40a0f;\\u6115\\u0680;CDEGHLNPRSTV\\u0b55\\u0b56\\u0b6a\\u0b7c\\u0ba1\\u0beb\\u0c04\\u0c5e\\u0c84\\u0ca6\\u0cd8\\u0d61\\u0d85\\u6aec\\u0100ou\\u0b5b\\u0b64ngruent;\\u6262pCap;\\u626doubleVerticalBar;\\u6226\\u0180lqx\\u0b83\\u0b8a\\u0b9bement;\\u6209ual\\u0100;T\\u0b92\\u0b93\\u6260ilde;\\uc000\\u2242\\u0338ists;\\u6204reater\\u0380;EFGLST\\u0bb6\\u0bb7\\u0bbd\\u0bc9\\u0bd3\\u0bd8\\u0be5\\u626fqual;\\u6271ullEqual;\\uc000\\u2267\\u0338reater;\\uc000\\u226b\\u0338ess;\\u6279lantEqual;\\uc000\\u2a7e\\u0338ilde;\\u6275ump\\u0144\\u0bf2\\u0bfdownHump;\\uc000\\u224e\\u0338qual;\\uc000\\u224f\\u0338e\\u0100fs\\u0c0a\\u0c27tTriangle\\u0180;BE\\u0c1a\\u0c1b\\u0c21\\u62eaar;\\uc000\\u29cf\\u0338qual;\\u62ecs\\u0300;EGLST\\u0c35\\u0c36\\u0c3c\\u0c44\\u0c4b\\u0c58\\u626equal;\\u6270reater;\\u6278ess;\\uc000\\u226a\\u0338lantEqual;\\uc000\\u2a7d\\u0338ilde;\\u6274ested\\u0100GL\\u0c68\\u0c79reaterGreater;\\uc000\\u2aa2\\u0338essLess;\\uc000\\u2aa1\\u0338recedes\\u0180;ES\\u0c92\\u0c93\\u0c9b\\u6280qual;\\uc000\\u2aaf\\u0338lantEqual;\\u62e0\\u0100ei\\u0cab\\u0cb9verseElement;\\u620cghtTriangle\\u0180;BE\\u0ccb\\u0ccc\\u0cd2\\u62ebar;\\uc000\\u29d0\\u0338qual;\\u62ed\\u0100qu\\u0cdd\\u0d0cuareSu\\u0100bp\\u0ce8\\u0cf9set\\u0100;E\\u0cf0\\u0cf3\\uc000\\u228f\\u0338qual;\\u62e2erset\\u0100;E\\u0d03\\u0d06\\uc000\\u2290\\u0338qual;\\u62e3\\u0180bcp\\u0d13\\u0d24\\u0d4eset\\u0100;E\\u0d1b\\u0d1e\\uc000\\u2282\\u20d2qual;\\u6288ceeds\\u0200;EST\\u0d32\\u0d33\\u0d3b\\u0d46\\u6281qual;\\uc000\\u2ab0\\u0338lantEqual;\\u62e1ilde;\\uc000\\u227f\\u0338erset\\u0100;E\\u0d58\\u0d5b\\uc000\\u2283\\u20d2qual;\\u6289ilde\\u0200;EFT\\u0d6e\\u0d6f\\u0d75\\u0d7f\\u6241qual;\\u6244ullEqual;\\u6247ilde;\\u6249erticalBar;\\u6224cr;\\uc000\\ud835\\udca9ilde\\u803b\\xd1\\u40d1;\\u439d\\u0700Eacdfgmoprstuv\\u0dbd\\u0dc2\\u0dc9\\u0dd5\\u0ddb\\u0de0\\u0de7\\u0dfc\\u0e02\\u0e20\\u0e22\\u0e32\\u0e3f\\u0e44lig;\\u4152cute\\u803b\\xd3\\u40d3\\u0100iy\\u0dce\\u0dd3rc\\u803b\\xd4\\u40d4;\\u441eblac;\\u4150r;\\uc000\\ud835\\udd12rave\\u803b\\xd2\\u40d2\\u0180aei\\u0dee\\u0df2\\u0df6cr;\\u414cga;\\u43a9cron;\\u439fpf;\\uc000\\ud835\\udd46enCurly\\u0100DQ\\u0e0e\\u0e1aoubleQuote;\\u601cuote;\\u6018;\\u6a54\\u0100cl\\u0e27\\u0e2cr;\\uc000\\ud835\\udcaaash\\u803b\\xd8\\u40d8i\\u016c\\u0e37\\u0e3cde\\u803b\\xd5\\u40d5es;\\u6a37ml\\u803b\\xd6\\u40d6er\\u0100BP\\u0e4b\\u0e60\\u0100ar\\u0e50\\u0e53r;\\u603eac\\u0100ek\\u0e5a\\u0e5c;\\u63deet;\\u63b4arenthesis;\\u63dc\\u0480acfhilors\\u0e7f\\u0e87\\u0e8a\\u0e8f\\u0e92\\u0e94\\u0e9d\\u0eb0\\u0efcrtialD;\\u6202y;\\u441fr;\\uc000\\ud835\\udd13i;\\u43a6;\\u43a0usMinus;\\u40b1\\u0100ip\\u0ea2\\u0eadncareplan\\xe5\\u069df;\\u6119\\u0200;eio\\u0eb9\\u0eba\\u0ee0\\u0ee4\\u6abbcedes\\u0200;EST\\u0ec8\\u0ec9\\u0ecf\\u0eda\\u627aqual;\\u6aaflantEqual;\\u627cilde;\\u627eme;\\u6033\\u0100dp\\u0ee9\\u0eeeuct;\\u620fortion\\u0100;a\\u0225\\u0ef9l;\\u621d\\u0100ci\\u0f01\\u0f06r;\\uc000\\ud835\\udcab;\\u43a8\\u0200Ufos\\u0f11\\u0f16\\u0f1b\\u0f1fOT\\u803b\\\"\\u4022r;\\uc000\\ud835\\udd14pf;\\u611acr;\\uc000\\ud835\\udcac\\u0600BEacefhiorsu\\u0f3e\\u0f43\\u0f47\\u0f60\\u0f73\\u0fa7\\u0faa\\u0fad\\u1096\\u10a9\\u10b4\\u10bearr;\\u6910G\\u803b\\xae\\u40ae\\u0180cnr\\u0f4e\\u0f53\\u0f56ute;\\u4154g;\\u67ebr\\u0100;t\\u0f5c\\u0f5d\\u61a0l;\\u6916\\u0180aey\\u0f67\\u0f6c\\u0f71ron;\\u4158dil;\\u4156;\\u4420\\u0100;v\\u0f78\\u0f79\\u611cerse\\u0100EU\\u0f82\\u0f99\\u0100lq\\u0f87\\u0f8eement;\\u620builibrium;\\u61cbpEquilibrium;\\u696fr\\xbb\\u0f79o;\\u43a1ght\\u0400ACDFTUVa\\u0fc1\\u0feb\\u0ff3\\u1022\\u1028\\u105b\\u1087\\u03d8\\u0100nr\\u0fc6\\u0fd2gleBracket;\\u67e9row\\u0180;BL\\u0fdc\\u0fdd\\u0fe1\\u6192ar;\\u61e5eftArrow;\\u61c4eiling;\\u6309o\\u01f5\\u0ff9\\0\\u1005bleBracket;\\u67e7n\\u01d4\\u100a\\0\\u1014eeVector;\\u695dector\\u0100;B\\u101d\\u101e\\u61c2ar;\\u6955loor;\\u630b\\u0100er\\u102d\\u1043e\\u0180;AV\\u1035\\u1036\\u103c\\u62a2rrow;\\u61a6ector;\\u695biangle\\u0180;BE\\u1050\\u1051\\u1055\\u62b3ar;\\u69d0qual;\\u62b5p\\u0180DTV\\u1063\\u106e\\u1078ownVector;\\u694feeVector;\\u695cector\\u0100;B\\u1082\\u1083\\u61bear;\\u6954ector\\u0100;B\\u1091\\u1092\\u61c0ar;\\u6953\\u0100pu\\u109b\\u109ef;\\u611dndImplies;\\u6970ightarrow;\\u61db\\u0100ch\\u10b9\\u10bcr;\\u611b;\\u61b1leDelayed;\\u69f4\\u0680HOacfhimoqstu\\u10e4\\u10f1\\u10f7\\u10fd\\u1119\\u111e\\u1151\\u1156\\u1161\\u1167\\u11b5\\u11bb\\u11bf\\u0100Cc\\u10e9\\u10eeHcy;\\u4429y;\\u4428FTcy;\\u442ccute;\\u415a\\u0280;aeiy\\u1108\\u1109\\u110e\\u1113\\u1117\\u6abcron;\\u4160dil;\\u415erc;\\u415c;\\u4421r;\\uc000\\ud835\\udd16ort\\u0200DLRU\\u112a\\u1134\\u113e\\u1149ownArrow\\xbb\\u041eeftArrow\\xbb\\u089aightArrow\\xbb\\u0fddpArrow;\\u6191gma;\\u43a3allCircle;\\u6218pf;\\uc000\\ud835\\udd4a\\u0272\\u116d\\0\\0\\u1170t;\\u621aare\\u0200;ISU\\u117b\\u117c\\u1189\\u11af\\u65a1ntersection;\\u6293u\\u0100bp\\u118f\\u119eset\\u0100;E\\u1197\\u1198\\u628fqual;\\u6291erset\\u0100;E\\u11a8\\u11a9\\u6290qual;\\u6292nion;\\u6294cr;\\uc000\\ud835\\udcaear;\\u62c6\\u0200bcmp\\u11c8\\u11db\\u1209\\u120b\\u0100;s\\u11cd\\u11ce\\u62d0et\\u0100;E\\u11cd\\u11d5qual;\\u6286\\u0100ch\\u11e0\\u1205eeds\\u0200;EST\\u11ed\\u11ee\\u11f4\\u11ff\\u627bqual;\\u6ab0lantEqual;\\u627dilde;\\u627fTh\\xe1\\u0f8c;\\u6211\\u0180;es\\u1212\\u1213\\u1223\\u62d1rset\\u0100;E\\u121c\\u121d\\u6283qual;\\u6287et\\xbb\\u1213\\u0580HRSacfhiors\\u123e\\u1244\\u1249\\u1255\\u125e\\u1271\\u1276\\u129f\\u12c2\\u12c8\\u12d1ORN\\u803b\\xde\\u40deADE;\\u6122\\u0100Hc\\u124e\\u1252cy;\\u440by;\\u4426\\u0100bu\\u125a\\u125c;\\u4009;\\u43a4\\u0180aey\\u1265\\u126a\\u126fron;\\u4164dil;\\u4162;\\u4422r;\\uc000\\ud835\\udd17\\u0100ei\\u127b\\u1289\\u01f2\\u1280\\0\\u1287efore;\\u6234a;\\u4398\\u0100cn\\u128e\\u1298kSpace;\\uc000\\u205f\\u200aSpace;\\u6009lde\\u0200;EFT\\u12ab\\u12ac\\u12b2\\u12bc\\u623cqual;\\u6243ullEqual;\\u6245ilde;\\u6248pf;\\uc000\\ud835\\udd4bipleDot;\\u60db\\u0100ct\\u12d6\\u12dbr;\\uc000\\ud835\\udcafrok;\\u4166\\u0ae1\\u12f7\\u130e\\u131a\\u1326\\0\\u132c\\u1331\\0\\0\\0\\0\\0\\u1338\\u133d\\u1377\\u1385\\0\\u13ff\\u1404\\u140a\\u1410\\u0100cr\\u12fb\\u1301ute\\u803b\\xda\\u40dar\\u0100;o\\u1307\\u1308\\u619fcir;\\u6949r\\u01e3\\u1313\\0\\u1316y;\\u440eve;\\u416c\\u0100iy\\u131e\\u1323rc\\u803b\\xdb\\u40db;\\u4423blac;\\u4170r;\\uc000\\ud835\\udd18rave\\u803b\\xd9\\u40d9acr;\\u416a\\u0100di\\u1341\\u1369er\\u0100BP\\u1348\\u135d\\u0100ar\\u134d\\u1350r;\\u405fac\\u0100ek\\u1357\\u1359;\\u63dfet;\\u63b5arenthesis;\\u63ddon\\u0100;P\\u1370\\u1371\\u62c3lus;\\u628e\\u0100gp\\u137b\\u137fon;\\u4172f;\\uc000\\ud835\\udd4c\\u0400ADETadps\\u1395\\u13ae\\u13b8\\u13c4\\u03e8\\u13d2\\u13d7\\u13f3rrow\\u0180;BD\\u1150\\u13a0\\u13a4ar;\\u6912ownArrow;\\u61c5ownArrow;\\u6195quilibrium;\\u696eee\\u0100;A\\u13cb\\u13cc\\u62a5rrow;\\u61a5own\\xe1\\u03f3er\\u0100LR\\u13de\\u13e8eftArrow;\\u6196ightArrow;\\u6197i\\u0100;l\\u13f9\\u13fa\\u43d2on;\\u43a5ing;\\u416ecr;\\uc000\\ud835\\udcb0ilde;\\u4168ml\\u803b\\xdc\\u40dc\\u0480Dbcdefosv\\u1427\\u142c\\u1430\\u1433\\u143e\\u1485\\u148a\\u1490\\u1496ash;\\u62abar;\\u6aeby;\\u4412ash\\u0100;l\\u143b\\u143c\\u62a9;\\u6ae6\\u0100er\\u1443\\u1445;\\u62c1\\u0180bty\\u144c\\u1450\\u147aar;\\u6016\\u0100;i\\u144f\\u1455cal\\u0200BLST\\u1461\\u1465\\u146a\\u1474ar;\\u6223ine;\\u407ceparator;\\u6758ilde;\\u6240ThinSpace;\\u600ar;\\uc000\\ud835\\udd19pf;\\uc000\\ud835\\udd4dcr;\\uc000\\ud835\\udcb1dash;\\u62aa\\u0280cefos\\u14a7\\u14ac\\u14b1\\u14b6\\u14bcirc;\\u4174dge;\\u62c0r;\\uc000\\ud835\\udd1apf;\\uc000\\ud835\\udd4ecr;\\uc000\\ud835\\udcb2\\u0200fios\\u14cb\\u14d0\\u14d2\\u14d8r;\\uc000\\ud835\\udd1b;\\u439epf;\\uc000\\ud835\\udd4fcr;\\uc000\\ud835\\udcb3\\u0480AIUacfosu\\u14f1\\u14f5\\u14f9\\u14fd\\u1504\\u150f\\u1514\\u151a\\u1520cy;\\u442fcy;\\u4407cy;\\u442ecute\\u803b\\xdd\\u40dd\\u0100iy\\u1509\\u150drc;\\u4176;\\u442br;\\uc000\\ud835\\udd1cpf;\\uc000\\ud835\\udd50cr;\\uc000\\ud835\\udcb4ml;\\u4178\\u0400Hacdefos\\u1535\\u1539\\u153f\\u154b\\u154f\\u155d\\u1560\\u1564cy;\\u4416cute;\\u4179\\u0100ay\\u1544\\u1549ron;\\u417d;\\u4417ot;\\u417b\\u01f2\\u1554\\0\\u155boWidt\\xe8\\u0ad9a;\\u4396r;\\u6128pf;\\u6124cr;\\uc000\\ud835\\udcb5\\u0be1\\u1583\\u158a\\u1590\\0\\u15b0\\u15b6\\u15bf\\0\\0\\0\\0\\u15c6\\u15db\\u15eb\\u165f\\u166d\\0\\u1695\\u169b\\u16b2\\u16b9\\0\\u16becute\\u803b\\xe1\\u40e1reve;\\u4103\\u0300;Ediuy\\u159c\\u159d\\u15a1\\u15a3\\u15a8\\u15ad\\u623e;\\uc000\\u223e\\u0333;\\u623frc\\u803b\\xe2\\u40e2te\\u80bb\\xb4\\u0306;\\u4430lig\\u803b\\xe6\\u40e6\\u0100;r\\xb2\\u15ba;\\uc000\\ud835\\udd1erave\\u803b\\xe0\\u40e0\\u0100ep\\u15ca\\u15d6\\u0100fp\\u15cf\\u15d4sym;\\u6135\\xe8\\u15d3ha;\\u43b1\\u0100ap\\u15dfc\\u0100cl\\u15e4\\u15e7r;\\u4101g;\\u6a3f\\u0264\\u15f0\\0\\0\\u160a\\u0280;adsv\\u15fa\\u15fb\\u15ff\\u1601\\u1607\\u6227nd;\\u6a55;\\u6a5clope;\\u6a58;\\u6a5a\\u0380;elmrsz\\u1618\\u1619\\u161b\\u161e\\u163f\\u164f\\u1659\\u6220;\\u69a4e\\xbb\\u1619sd\\u0100;a\\u1625\\u1626\\u6221\\u0461\\u1630\\u1632\\u1634\\u1636\\u1638\\u163a\\u163c\\u163e;\\u69a8;\\u69a9;\\u69aa;\\u69ab;\\u69ac;\\u69ad;\\u69ae;\\u69aft\\u0100;v\\u1645\\u1646\\u621fb\\u0100;d\\u164c\\u164d\\u62be;\\u699d\\u0100pt\\u1654\\u1657h;\\u6222\\xbb\\xb9arr;\\u637c\\u0100gp\\u1663\\u1667on;\\u4105f;\\uc000\\ud835\\udd52\\u0380;Eaeiop\\u12c1\\u167b\\u167d\\u1682\\u1684\\u1687\\u168a;\\u6a70cir;\\u6a6f;\\u624ad;\\u624bs;\\u4027rox\\u0100;e\\u12c1\\u1692\\xf1\\u1683ing\\u803b\\xe5\\u40e5\\u0180cty\\u16a1\\u16a6\\u16a8r;\\uc000\\ud835\\udcb6;\\u402amp\\u0100;e\\u12c1\\u16af\\xf1\\u0288ilde\\u803b\\xe3\\u40e3ml\\u803b\\xe4\\u40e4\\u0100ci\\u16c2\\u16c8onin\\xf4\\u0272nt;\\u6a11\\u0800Nabcdefiklnoprsu\\u16ed\\u16f1\\u1730\\u173c\\u1743\\u1748\\u1778\\u177d\\u17e0\\u17e6\\u1839\\u1850\\u170d\\u193d\\u1948\\u1970ot;\\u6aed\\u0100cr\\u16f6\\u171ek\\u0200ceps\\u1700\\u1705\\u170d\\u1713ong;\\u624cpsilon;\\u43f6rime;\\u6035im\\u0100;e\\u171a\\u171b\\u623dq;\\u62cd\\u0176\\u1722\\u1726ee;\\u62bded\\u0100;g\\u172c\\u172d\\u6305e\\xbb\\u172drk\\u0100;t\\u135c\\u1737brk;\\u63b6\\u0100oy\\u1701\\u1741;\\u4431quo;\\u601e\\u0280cmprt\\u1753\\u175b\\u1761\\u1764\\u1768aus\\u0100;e\\u010a\\u0109ptyv;\\u69b0s\\xe9\\u170cno\\xf5\\u0113\\u0180ahw\\u176f\\u1771\\u1773;\\u43b2;\\u6136een;\\u626cr;\\uc000\\ud835\\udd1fg\\u0380costuvw\\u178d\\u179d\\u17b3\\u17c1\\u17d5\\u17db\\u17de\\u0180aiu\\u1794\\u1796\\u179a\\xf0\\u0760rc;\\u65efp\\xbb\\u1371\\u0180dpt\\u17a4\\u17a8\\u17adot;\\u6a00lus;\\u6a01imes;\\u6a02\\u0271\\u17b9\\0\\0\\u17becup;\\u6a06ar;\\u6605riangle\\u0100du\\u17cd\\u17d2own;\\u65bdp;\\u65b3plus;\\u6a04e\\xe5\\u1444\\xe5\\u14adarow;\\u690d\\u0180ako\\u17ed\\u1826\\u1835\\u0100cn\\u17f2\\u1823k\\u0180lst\\u17fa\\u05ab\\u1802ozenge;\\u69ebriangle\\u0200;dlr\\u1812\\u1813\\u1818\\u181d\\u65b4own;\\u65beeft;\\u65c2ight;\\u65b8k;\\u6423\\u01b1\\u182b\\0\\u1833\\u01b2\\u182f\\0\\u1831;\\u6592;\\u65914;\\u6593ck;\\u6588\\u0100eo\\u183e\\u184d\\u0100;q\\u1843\\u1846\\uc000=\\u20e5uiv;\\uc000\\u2261\\u20e5t;\\u6310\\u0200ptwx\\u1859\\u185e\\u1867\\u186cf;\\uc000\\ud835\\udd53\\u0100;t\\u13cb\\u1863om\\xbb\\u13cctie;\\u62c8\\u0600DHUVbdhmptuv\\u1885\\u1896\\u18aa\\u18bb\\u18d7\\u18db\\u18ec\\u18ff\\u1905\\u190a\\u1910\\u1921\\u0200LRlr\\u188e\\u1890\\u1892\\u1894;\\u6557;\\u6554;\\u6556;\\u6553\\u0280;DUdu\\u18a1\\u18a2\\u18a4\\u18a6\\u18a8\\u6550;\\u6566;\\u6569;\\u6564;\\u6567\\u0200LRlr\\u18b3\\u18b5\\u18b7\\u18b9;\\u655d;\\u655a;\\u655c;\\u6559\\u0380;HLRhlr\\u18ca\\u18cb\\u18cd\\u18cf\\u18d1\\u18d3\\u18d5\\u6551;\\u656c;\\u6563;\\u6560;\\u656b;\\u6562;\\u655fox;\\u69c9\\u0200LRlr\\u18e4\\u18e6\\u18e8\\u18ea;\\u6555;\\u6552;\\u6510;\\u650c\\u0280;DUdu\\u06bd\\u18f7\\u18f9\\u18fb\\u18fd;\\u6565;\\u6568;\\u652c;\\u6534inus;\\u629flus;\\u629eimes;\\u62a0\\u0200LRlr\\u1919\\u191b\\u191d\\u191f;\\u655b;\\u6558;\\u6518;\\u6514\\u0380;HLRhlr\\u1930\\u1931\\u1933\\u1935\\u1937\\u1939\\u193b\\u6502;\\u656a;\\u6561;\\u655e;\\u653c;\\u6524;\\u651c\\u0100ev\\u0123\\u1942bar\\u803b\\xa6\\u40a6\\u0200ceio\\u1951\\u1956\\u195a\\u1960r;\\uc000\\ud835\\udcb7mi;\\u604fm\\u0100;e\\u171a\\u171cl\\u0180;bh\\u1968\\u1969\\u196b\\u405c;\\u69c5sub;\\u67c8\\u016c\\u1974\\u197el\\u0100;e\\u1979\\u197a\\u6022t\\xbb\\u197ap\\u0180;Ee\\u012f\\u1985\\u1987;\\u6aae\\u0100;q\\u06dc\\u06db\\u0ce1\\u19a7\\0\\u19e8\\u1a11\\u1a15\\u1a32\\0\\u1a37\\u1a50\\0\\0\\u1ab4\\0\\0\\u1ac1\\0\\0\\u1b21\\u1b2e\\u1b4d\\u1b52\\0\\u1bfd\\0\\u1c0c\\u0180cpr\\u19ad\\u19b2\\u19ddute;\\u4107\\u0300;abcds\\u19bf\\u19c0\\u19c4\\u19ca\\u19d5\\u19d9\\u6229nd;\\u6a44rcup;\\u6a49\\u0100au\\u19cf\\u19d2p;\\u6a4bp;\\u6a47ot;\\u6a40;\\uc000\\u2229\\ufe00\\u0100eo\\u19e2\\u19e5t;\\u6041\\xee\\u0693\\u0200aeiu\\u19f0\\u19fb\\u1a01\\u1a05\\u01f0\\u19f5\\0\\u19f8s;\\u6a4don;\\u410ddil\\u803b\\xe7\\u40e7rc;\\u4109ps\\u0100;s\\u1a0c\\u1a0d\\u6a4cm;\\u6a50ot;\\u410b\\u0180dmn\\u1a1b\\u1a20\\u1a26il\\u80bb\\xb8\\u01adptyv;\\u69b2t\\u8100\\xa2;e\\u1a2d\\u1a2e\\u40a2r\\xe4\\u01b2r;\\uc000\\ud835\\udd20\\u0180cei\\u1a3d\\u1a40\\u1a4dy;\\u4447ck\\u0100;m\\u1a47\\u1a48\\u6713ark\\xbb\\u1a48;\\u43c7r\\u0380;Ecefms\\u1a5f\\u1a60\\u1a62\\u1a6b\\u1aa4\\u1aaa\\u1aae\\u65cb;\\u69c3\\u0180;el\\u1a69\\u1a6a\\u1a6d\\u42c6q;\\u6257e\\u0261\\u1a74\\0\\0\\u1a88rrow\\u0100lr\\u1a7c\\u1a81eft;\\u61baight;\\u61bb\\u0280RSacd\\u1a92\\u1a94\\u1a96\\u1a9a\\u1a9f\\xbb\\u0f47;\\u64c8st;\\u629birc;\\u629aash;\\u629dnint;\\u6a10id;\\u6aefcir;\\u69c2ubs\\u0100;u\\u1abb\\u1abc\\u6663it\\xbb\\u1abc\\u02ec\\u1ac7\\u1ad4\\u1afa\\0\\u1b0aon\\u0100;e\\u1acd\\u1ace\\u403a\\u0100;q\\xc7\\xc6\\u026d\\u1ad9\\0\\0\\u1ae2a\\u0100;t\\u1ade\\u1adf\\u402c;\\u4040\\u0180;fl\\u1ae8\\u1ae9\\u1aeb\\u6201\\xee\\u1160e\\u0100mx\\u1af1\\u1af6ent\\xbb\\u1ae9e\\xf3\\u024d\\u01e7\\u1afe\\0\\u1b07\\u0100;d\\u12bb\\u1b02ot;\\u6a6dn\\xf4\\u0246\\u0180fry\\u1b10\\u1b14\\u1b17;\\uc000\\ud835\\udd54o\\xe4\\u0254\\u8100\\xa9;s\\u0155\\u1b1dr;\\u6117\\u0100ao\\u1b25\\u1b29rr;\\u61b5ss;\\u6717\\u0100cu\\u1b32\\u1b37r;\\uc000\\ud835\\udcb8\\u0100bp\\u1b3c\\u1b44\\u0100;e\\u1b41\\u1b42\\u6acf;\\u6ad1\\u0100;e\\u1b49\\u1b4a\\u6ad0;\\u6ad2dot;\\u62ef\\u0380delprvw\\u1b60\\u1b6c\\u1b77\\u1b82\\u1bac\\u1bd4\\u1bf9arr\\u0100lr\\u1b68\\u1b6a;\\u6938;\\u6935\\u0270\\u1b72\\0\\0\\u1b75r;\\u62dec;\\u62dfarr\\u0100;p\\u1b7f\\u1b80\\u61b6;\\u693d\\u0300;bcdos\\u1b8f\\u1b90\\u1b96\\u1ba1\\u1ba5\\u1ba8\\u622arcap;\\u6a48\\u0100au\\u1b9b\\u1b9ep;\\u6a46p;\\u6a4aot;\\u628dr;\\u6a45;\\uc000\\u222a\\ufe00\\u0200alrv\\u1bb5\\u1bbf\\u1bde\\u1be3rr\\u0100;m\\u1bbc\\u1bbd\\u61b7;\\u693cy\\u0180evw\\u1bc7\\u1bd4\\u1bd8q\\u0270\\u1bce\\0\\0\\u1bd2re\\xe3\\u1b73u\\xe3\\u1b75ee;\\u62ceedge;\\u62cfen\\u803b\\xa4\\u40a4earrow\\u0100lr\\u1bee\\u1bf3eft\\xbb\\u1b80ight\\xbb\\u1bbde\\xe4\\u1bdd\\u0100ci\\u1c01\\u1c07onin\\xf4\\u01f7nt;\\u6231lcty;\\u632d\\u0980AHabcdefhijlorstuwz\\u1c38\\u1c3b\\u1c3f\\u1c5d\\u1c69\\u1c75\\u1c8a\\u1c9e\\u1cac\\u1cb7\\u1cfb\\u1cff\\u1d0d\\u1d7b\\u1d91\\u1dab\\u1dbb\\u1dc6\\u1dcdr\\xf2\\u0381ar;\\u6965\\u0200glrs\\u1c48\\u1c4d\\u1c52\\u1c54ger;\\u6020eth;\\u6138\\xf2\\u1133h\\u0100;v\\u1c5a\\u1c5b\\u6010\\xbb\\u090a\\u016b\\u1c61\\u1c67arow;\\u690fa\\xe3\\u0315\\u0100ay\\u1c6e\\u1c73ron;\\u410f;\\u4434\\u0180;ao\\u0332\\u1c7c\\u1c84\\u0100gr\\u02bf\\u1c81r;\\u61catseq;\\u6a77\\u0180glm\\u1c91\\u1c94\\u1c98\\u803b\\xb0\\u40b0ta;\\u43b4ptyv;\\u69b1\\u0100ir\\u1ca3\\u1ca8sht;\\u697f;\\uc000\\ud835\\udd21ar\\u0100lr\\u1cb3\\u1cb5\\xbb\\u08dc\\xbb\\u101e\\u0280aegsv\\u1cc2\\u0378\\u1cd6\\u1cdc\\u1ce0m\\u0180;os\\u0326\\u1cca\\u1cd4nd\\u0100;s\\u0326\\u1cd1uit;\\u6666amma;\\u43ddin;\\u62f2\\u0180;io\\u1ce7\\u1ce8\\u1cf8\\u40f7de\\u8100\\xf7;o\\u1ce7\\u1cf0ntimes;\\u62c7n\\xf8\\u1cf7cy;\\u4452c\\u026f\\u1d06\\0\\0\\u1d0arn;\\u631eop;\\u630d\\u0280lptuw\\u1d18\\u1d1d\\u1d22\\u1d49\\u1d55lar;\\u4024f;\\uc000\\ud835\\udd55\\u0280;emps\\u030b\\u1d2d\\u1d37\\u1d3d\\u1d42q\\u0100;d\\u0352\\u1d33ot;\\u6251inus;\\u6238lus;\\u6214quare;\\u62a1blebarwedg\\xe5\\xfan\\u0180adh\\u112e\\u1d5d\\u1d67ownarrow\\xf3\\u1c83arpoon\\u0100lr\\u1d72\\u1d76ef\\xf4\\u1cb4igh\\xf4\\u1cb6\\u0162\\u1d7f\\u1d85karo\\xf7\\u0f42\\u026f\\u1d8a\\0\\0\\u1d8ern;\\u631fop;\\u630c\\u0180cot\\u1d98\\u1da3\\u1da6\\u0100ry\\u1d9d\\u1da1;\\uc000\\ud835\\udcb9;\\u4455l;\\u69f6rok;\\u4111\\u0100dr\\u1db0\\u1db4ot;\\u62f1i\\u0100;f\\u1dba\\u1816\\u65bf\\u0100ah\\u1dc0\\u1dc3r\\xf2\\u0429a\\xf2\\u0fa6angle;\\u69a6\\u0100ci\\u1dd2\\u1dd5y;\\u445fgrarr;\\u67ff\\u0900Dacdefglmnopqrstux\\u1e01\\u1e09\\u1e19\\u1e38\\u0578\\u1e3c\\u1e49\\u1e61\\u1e7e\\u1ea5\\u1eaf\\u1ebd\\u1ee1\\u1f2a\\u1f37\\u1f44\\u1f4e\\u1f5a\\u0100Do\\u1e06\\u1d34o\\xf4\\u1c89\\u0100cs\\u1e0e\\u1e14ute\\u803b\\xe9\\u40e9ter;\\u6a6e\\u0200aioy\\u1e22\\u1e27\\u1e31\\u1e36ron;\\u411br\\u0100;c\\u1e2d\\u1e2e\\u6256\\u803b\\xea\\u40ealon;\\u6255;\\u444dot;\\u4117\\u0100Dr\\u1e41\\u1e45ot;\\u6252;\\uc000\\ud835\\udd22\\u0180;rs\\u1e50\\u1e51\\u1e57\\u6a9aave\\u803b\\xe8\\u40e8\\u0100;d\\u1e5c\\u1e5d\\u6a96ot;\\u6a98\\u0200;ils\\u1e6a\\u1e6b\\u1e72\\u1e74\\u6a99nters;\\u63e7;\\u6113\\u0100;d\\u1e79\\u1e7a\\u6a95ot;\\u6a97\\u0180aps\\u1e85\\u1e89\\u1e97cr;\\u4113ty\\u0180;sv\\u1e92\\u1e93\\u1e95\\u6205et\\xbb\\u1e93p\\u01001;\\u1e9d\\u1ea4\\u0133\\u1ea1\\u1ea3;\\u6004;\\u6005\\u6003\\u0100gs\\u1eaa\\u1eac;\\u414bp;\\u6002\\u0100gp\\u1eb4\\u1eb8on;\\u4119f;\\uc000\\ud835\\udd56\\u0180als\\u1ec4\\u1ece\\u1ed2r\\u0100;s\\u1eca\\u1ecb\\u62d5l;\\u69e3us;\\u6a71i\\u0180;lv\\u1eda\\u1edb\\u1edf\\u43b5on\\xbb\\u1edb;\\u43f5\\u0200csuv\\u1eea\\u1ef3\\u1f0b\\u1f23\\u0100io\\u1eef\\u1e31rc\\xbb\\u1e2e\\u0269\\u1ef9\\0\\0\\u1efb\\xed\\u0548ant\\u0100gl\\u1f02\\u1f06tr\\xbb\\u1e5dess\\xbb\\u1e7a\\u0180aei\\u1f12\\u1f16\\u1f1als;\\u403dst;\\u625fv\\u0100;D\\u0235\\u1f20D;\\u6a78parsl;\\u69e5\\u0100Da\\u1f2f\\u1f33ot;\\u6253rr;\\u6971\\u0180cdi\\u1f3e\\u1f41\\u1ef8r;\\u612fo\\xf4\\u0352\\u0100ah\\u1f49\\u1f4b;\\u43b7\\u803b\\xf0\\u40f0\\u0100mr\\u1f53\\u1f57l\\u803b\\xeb\\u40ebo;\\u60ac\\u0180cip\\u1f61\\u1f64\\u1f67l;\\u4021s\\xf4\\u056e\\u0100eo\\u1f6c\\u1f74ctatio\\xee\\u0559nential\\xe5\\u0579\\u09e1\\u1f92\\0\\u1f9e\\0\\u1fa1\\u1fa7\\0\\0\\u1fc6\\u1fcc\\0\\u1fd3\\0\\u1fe6\\u1fea\\u2000\\0\\u2008\\u205allingdotse\\xf1\\u1e44y;\\u4444male;\\u6640\\u0180ilr\\u1fad\\u1fb3\\u1fc1lig;\\u8000\\ufb03\\u0269\\u1fb9\\0\\0\\u1fbdg;\\u8000\\ufb00ig;\\u8000\\ufb04;\\uc000\\ud835\\udd23lig;\\u8000\\ufb01lig;\\uc000fj\\u0180alt\\u1fd9\\u1fdc\\u1fe1t;\\u666dig;\\u8000\\ufb02ns;\\u65b1of;\\u4192\\u01f0\\u1fee\\0\\u1ff3f;\\uc000\\ud835\\udd57\\u0100ak\\u05bf\\u1ff7\\u0100;v\\u1ffc\\u1ffd\\u62d4;\\u6ad9artint;\\u6a0d\\u0100ao\\u200c\\u2055\\u0100cs\\u2011\\u2052\\u03b1\\u201a\\u2030\\u2038\\u2045\\u2048\\0\\u2050\\u03b2\\u2022\\u2025\\u2027\\u202a\\u202c\\0\\u202e\\u803b\\xbd\\u40bd;\\u6153\\u803b\\xbc\\u40bc;\\u6155;\\u6159;\\u615b\\u01b3\\u2034\\0\\u2036;\\u6154;\\u6156\\u02b4\\u203e\\u2041\\0\\0\\u2043\\u803b\\xbe\\u40be;\\u6157;\\u615c5;\\u6158\\u01b6\\u204c\\0\\u204e;\\u615a;\\u615d8;\\u615el;\\u6044wn;\\u6322cr;\\uc000\\ud835\\udcbb\\u0880Eabcdefgijlnorstv\\u2082\\u2089\\u209f\\u20a5\\u20b0\\u20b4\\u20f0\\u20f5\\u20fa\\u20ff\\u2103\\u2112\\u2138\\u0317\\u213e\\u2152\\u219e\\u0100;l\\u064d\\u2087;\\u6a8c\\u0180cmp\\u2090\\u2095\\u209dute;\\u41f5ma\\u0100;d\\u209c\\u1cda\\u43b3;\\u6a86reve;\\u411f\\u0100iy\\u20aa\\u20aerc;\\u411d;\\u4433ot;\\u4121\\u0200;lqs\\u063e\\u0642\\u20bd\\u20c9\\u0180;qs\\u063e\\u064c\\u20c4lan\\xf4\\u0665\\u0200;cdl\\u0665\\u20d2\\u20d5\\u20e5c;\\u6aa9ot\\u0100;o\\u20dc\\u20dd\\u6a80\\u0100;l\\u20e2\\u20e3\\u6a82;\\u6a84\\u0100;e\\u20ea\\u20ed\\uc000\\u22db\\ufe00s;\\u6a94r;\\uc000\\ud835\\udd24\\u0100;g\\u0673\\u061bmel;\\u6137cy;\\u4453\\u0200;Eaj\\u065a\\u210c\\u210e\\u2110;\\u6a92;\\u6aa5;\\u6aa4\\u0200Eaes\\u211b\\u211d\\u2129\\u2134;\\u6269p\\u0100;p\\u2123\\u2124\\u6a8arox\\xbb\\u2124\\u0100;q\\u212e\\u212f\\u6a88\\u0100;q\\u212e\\u211bim;\\u62e7pf;\\uc000\\ud835\\udd58\\u0100ci\\u2143\\u2146r;\\u610am\\u0180;el\\u066b\\u214e\\u2150;\\u6a8e;\\u6a90\\u8300>;cdlqr\\u05ee\\u2160\\u216a\\u216e\\u2173\\u2179\\u0100ci\\u2165\\u2167;\\u6aa7r;\\u6a7aot;\\u62d7Par;\\u6995uest;\\u6a7c\\u0280adels\\u2184\\u216a\\u2190\\u0656\\u219b\\u01f0\\u2189\\0\\u218epro\\xf8\\u209er;\\u6978q\\u0100lq\\u063f\\u2196les\\xf3\\u2088i\\xed\\u066b\\u0100en\\u21a3\\u21adrtneqq;\\uc000\\u2269\\ufe00\\xc5\\u21aa\\u0500Aabcefkosy\\u21c4\\u21c7\\u21f1\\u21f5\\u21fa\\u2218\\u221d\\u222f\\u2268\\u227dr\\xf2\\u03a0\\u0200ilmr\\u21d0\\u21d4\\u21d7\\u21dbrs\\xf0\\u1484f\\xbb\\u2024il\\xf4\\u06a9\\u0100dr\\u21e0\\u21e4cy;\\u444a\\u0180;cw\\u08f4\\u21eb\\u21efir;\\u6948;\\u61adar;\\u610firc;\\u4125\\u0180alr\\u2201\\u220e\\u2213rts\\u0100;u\\u2209\\u220a\\u6665it\\xbb\\u220alip;\\u6026con;\\u62b9r;\\uc000\\ud835\\udd25s\\u0100ew\\u2223\\u2229arow;\\u6925arow;\\u6926\\u0280amopr\\u223a\\u223e\\u2243\\u225e\\u2263rr;\\u61fftht;\\u623bk\\u0100lr\\u2249\\u2253eftarrow;\\u61a9ightarrow;\\u61aaf;\\uc000\\ud835\\udd59bar;\\u6015\\u0180clt\\u226f\\u2274\\u2278r;\\uc000\\ud835\\udcbdas\\xe8\\u21f4rok;\\u4127\\u0100bp\\u2282\\u2287ull;\\u6043hen\\xbb\\u1c5b\\u0ae1\\u22a3\\0\\u22aa\\0\\u22b8\\u22c5\\u22ce\\0\\u22d5\\u22f3\\0\\0\\u22f8\\u2322\\u2367\\u2362\\u237f\\0\\u2386\\u23aa\\u23b4cute\\u803b\\xed\\u40ed\\u0180;iy\\u0771\\u22b0\\u22b5rc\\u803b\\xee\\u40ee;\\u4438\\u0100cx\\u22bc\\u22bfy;\\u4435cl\\u803b\\xa1\\u40a1\\u0100fr\\u039f\\u22c9;\\uc000\\ud835\\udd26rave\\u803b\\xec\\u40ec\\u0200;ino\\u073e\\u22dd\\u22e9\\u22ee\\u0100in\\u22e2\\u22e6nt;\\u6a0ct;\\u622dfin;\\u69dcta;\\u6129lig;\\u4133\\u0180aop\\u22fe\\u231a\\u231d\\u0180cgt\\u2305\\u2308\\u2317r;\\u412b\\u0180elp\\u071f\\u230f\\u2313in\\xe5\\u078ear\\xf4\\u0720h;\\u4131f;\\u62b7ed;\\u41b5\\u0280;cfot\\u04f4\\u232c\\u2331\\u233d\\u2341are;\\u6105in\\u0100;t\\u2338\\u2339\\u621eie;\\u69dddo\\xf4\\u2319\\u0280;celp\\u0757\\u234c\\u2350\\u235b\\u2361al;\\u62ba\\u0100gr\\u2355\\u2359er\\xf3\\u1563\\xe3\\u234darhk;\\u6a17rod;\\u6a3c\\u0200cgpt\\u236f\\u2372\\u2376\\u237by;\\u4451on;\\u412ff;\\uc000\\ud835\\udd5aa;\\u43b9uest\\u803b\\xbf\\u40bf\\u0100ci\\u238a\\u238fr;\\uc000\\ud835\\udcben\\u0280;Edsv\\u04f4\\u239b\\u239d\\u23a1\\u04f3;\\u62f9ot;\\u62f5\\u0100;v\\u23a6\\u23a7\\u62f4;\\u62f3\\u0100;i\\u0777\\u23aelde;\\u4129\\u01eb\\u23b8\\0\\u23bccy;\\u4456l\\u803b\\xef\\u40ef\\u0300cfmosu\\u23cc\\u23d7\\u23dc\\u23e1\\u23e7\\u23f5\\u0100iy\\u23d1\\u23d5rc;\\u4135;\\u4439r;\\uc000\\ud835\\udd27ath;\\u4237pf;\\uc000\\ud835\\udd5b\\u01e3\\u23ec\\0\\u23f1r;\\uc000\\ud835\\udcbfrcy;\\u4458kcy;\\u4454\\u0400acfghjos\\u240b\\u2416\\u2422\\u2427\\u242d\\u2431\\u2435\\u243bppa\\u0100;v\\u2413\\u2414\\u43ba;\\u43f0\\u0100ey\\u241b\\u2420dil;\\u4137;\\u443ar;\\uc000\\ud835\\udd28reen;\\u4138cy;\\u4445cy;\\u445cpf;\\uc000\\ud835\\udd5ccr;\\uc000\\ud835\\udcc0\\u0b80ABEHabcdefghjlmnoprstuv\\u2470\\u2481\\u2486\\u248d\\u2491\\u250e\\u253d\\u255a\\u2580\\u264e\\u265e\\u2665\\u2679\\u267d\\u269a\\u26b2\\u26d8\\u275d\\u2768\\u278b\\u27c0\\u2801\\u2812\\u0180art\\u2477\\u247a\\u247cr\\xf2\\u09c6\\xf2\\u0395ail;\\u691barr;\\u690e\\u0100;g\\u0994\\u248b;\\u6a8bar;\\u6962\\u0963\\u24a5\\0\\u24aa\\0\\u24b1\\0\\0\\0\\0\\0\\u24b5\\u24ba\\0\\u24c6\\u24c8\\u24cd\\0\\u24f9ute;\\u413amptyv;\\u69b4ra\\xee\\u084cbda;\\u43bbg\\u0180;dl\\u088e\\u24c1\\u24c3;\\u6991\\xe5\\u088e;\\u6a85uo\\u803b\\xab\\u40abr\\u0400;bfhlpst\\u0899\\u24de\\u24e6\\u24e9\\u24eb\\u24ee\\u24f1\\u24f5\\u0100;f\\u089d\\u24e3s;\\u691fs;\\u691d\\xeb\\u2252p;\\u61abl;\\u6939im;\\u6973l;\\u61a2\\u0180;ae\\u24ff\\u2500\\u2504\\u6aabil;\\u6919\\u0100;s\\u2509\\u250a\\u6aad;\\uc000\\u2aad\\ufe00\\u0180abr\\u2515\\u2519\\u251drr;\\u690crk;\\u6772\\u0100ak\\u2522\\u252cc\\u0100ek\\u2528\\u252a;\\u407b;\\u405b\\u0100es\\u2531\\u2533;\\u698bl\\u0100du\\u2539\\u253b;\\u698f;\\u698d\\u0200aeuy\\u2546\\u254b\\u2556\\u2558ron;\\u413e\\u0100di\\u2550\\u2554il;\\u413c\\xec\\u08b0\\xe2\\u2529;\\u443b\\u0200cqrs\\u2563\\u2566\\u256d\\u257da;\\u6936uo\\u0100;r\\u0e19\\u1746\\u0100du\\u2572\\u2577har;\\u6967shar;\\u694bh;\\u61b2\\u0280;fgqs\\u258b\\u258c\\u0989\\u25f3\\u25ff\\u6264t\\u0280ahlrt\\u2598\\u25a4\\u25b7\\u25c2\\u25e8rrow\\u0100;t\\u0899\\u25a1a\\xe9\\u24f6arpoon\\u0100du\\u25af\\u25b4own\\xbb\\u045ap\\xbb\\u0966eftarrows;\\u61c7ight\\u0180ahs\\u25cd\\u25d6\\u25derrow\\u0100;s\\u08f4\\u08a7arpoon\\xf3\\u0f98quigarro\\xf7\\u21f0hreetimes;\\u62cb\\u0180;qs\\u258b\\u0993\\u25falan\\xf4\\u09ac\\u0280;cdgs\\u09ac\\u260a\\u260d\\u261d\\u2628c;\\u6aa8ot\\u0100;o\\u2614\\u2615\\u6a7f\\u0100;r\\u261a\\u261b\\u6a81;\\u6a83\\u0100;e\\u2622\\u2625\\uc000\\u22da\\ufe00s;\\u6a93\\u0280adegs\\u2633\\u2639\\u263d\\u2649\\u264bppro\\xf8\\u24c6ot;\\u62d6q\\u0100gq\\u2643\\u2645\\xf4\\u0989gt\\xf2\\u248c\\xf4\\u099bi\\xed\\u09b2\\u0180ilr\\u2655\\u08e1\\u265asht;\\u697c;\\uc000\\ud835\\udd29\\u0100;E\\u099c\\u2663;\\u6a91\\u0161\\u2669\\u2676r\\u0100du\\u25b2\\u266e\\u0100;l\\u0965\\u2673;\\u696alk;\\u6584cy;\\u4459\\u0280;acht\\u0a48\\u2688\\u268b\\u2691\\u2696r\\xf2\\u25c1orne\\xf2\\u1d08ard;\\u696bri;\\u65fa\\u0100io\\u269f\\u26a4dot;\\u4140ust\\u0100;a\\u26ac\\u26ad\\u63b0che\\xbb\\u26ad\\u0200Eaes\\u26bb\\u26bd\\u26c9\\u26d4;\\u6268p\\u0100;p\\u26c3\\u26c4\\u6a89rox\\xbb\\u26c4\\u0100;q\\u26ce\\u26cf\\u6a87\\u0100;q\\u26ce\\u26bbim;\\u62e6\\u0400abnoptwz\\u26e9\\u26f4\\u26f7\\u271a\\u272f\\u2741\\u2747\\u2750\\u0100nr\\u26ee\\u26f1g;\\u67ecr;\\u61fdr\\xeb\\u08c1g\\u0180lmr\\u26ff\\u270d\\u2714eft\\u0100ar\\u09e6\\u2707ight\\xe1\\u09f2apsto;\\u67fcight\\xe1\\u09fdparrow\\u0100lr\\u2725\\u2729ef\\xf4\\u24edight;\\u61ac\\u0180afl\\u2736\\u2739\\u273dr;\\u6985;\\uc000\\ud835\\udd5dus;\\u6a2dimes;\\u6a34\\u0161\\u274b\\u274fst;\\u6217\\xe1\\u134e\\u0180;ef\\u2757\\u2758\\u1800\\u65cange\\xbb\\u2758ar\\u0100;l\\u2764\\u2765\\u4028t;\\u6993\\u0280achmt\\u2773\\u2776\\u277c\\u2785\\u2787r\\xf2\\u08a8orne\\xf2\\u1d8car\\u0100;d\\u0f98\\u2783;\\u696d;\\u600eri;\\u62bf\\u0300achiqt\\u2798\\u279d\\u0a40\\u27a2\\u27ae\\u27bbquo;\\u6039r;\\uc000\\ud835\\udcc1m\\u0180;eg\\u09b2\\u27aa\\u27ac;\\u6a8d;\\u6a8f\\u0100bu\\u252a\\u27b3o\\u0100;r\\u0e1f\\u27b9;\\u601arok;\\u4142\\u8400<;cdhilqr\\u082b\\u27d2\\u2639\\u27dc\\u27e0\\u27e5\\u27ea\\u27f0\\u0100ci\\u27d7\\u27d9;\\u6aa6r;\\u6a79re\\xe5\\u25f2mes;\\u62c9arr;\\u6976uest;\\u6a7b\\u0100Pi\\u27f5\\u27f9ar;\\u6996\\u0180;ef\\u2800\\u092d\\u181b\\u65c3r\\u0100du\\u2807\\u280dshar;\\u694ahar;\\u6966\\u0100en\\u2817\\u2821rtneqq;\\uc000\\u2268\\ufe00\\xc5\\u281e\\u0700Dacdefhilnopsu\\u2840\\u2845\\u2882\\u288e\\u2893\\u28a0\\u28a5\\u28a8\\u28da\\u28e2\\u28e4\\u0a83\\u28f3\\u2902Dot;\\u623a\\u0200clpr\\u284e\\u2852\\u2863\\u287dr\\u803b\\xaf\\u40af\\u0100et\\u2857\\u2859;\\u6642\\u0100;e\\u285e\\u285f\\u6720se\\xbb\\u285f\\u0100;s\\u103b\\u2868to\\u0200;dlu\\u103b\\u2873\\u2877\\u287bow\\xee\\u048cef\\xf4\\u090f\\xf0\\u13d1ker;\\u65ae\\u0100oy\\u2887\\u288cmma;\\u6a29;\\u443cash;\\u6014asuredangle\\xbb\\u1626r;\\uc000\\ud835\\udd2ao;\\u6127\\u0180cdn\\u28af\\u28b4\\u28c9ro\\u803b\\xb5\\u40b5\\u0200;acd\\u1464\\u28bd\\u28c0\\u28c4s\\xf4\\u16a7ir;\\u6af0ot\\u80bb\\xb7\\u01b5us\\u0180;bd\\u28d2\\u1903\\u28d3\\u6212\\u0100;u\\u1d3c\\u28d8;\\u6a2a\\u0163\\u28de\\u28e1p;\\u6adb\\xf2\\u2212\\xf0\\u0a81\\u0100dp\\u28e9\\u28eeels;\\u62a7f;\\uc000\\ud835\\udd5e\\u0100ct\\u28f8\\u28fdr;\\uc000\\ud835\\udcc2pos\\xbb\\u159d\\u0180;lm\\u2909\\u290a\\u290d\\u43bctimap;\\u62b8\\u0c00GLRVabcdefghijlmoprstuvw\\u2942\\u2953\\u297e\\u2989\\u2998\\u29da\\u29e9\\u2a15\\u2a1a\\u2a58\\u2a5d\\u2a83\\u2a95\\u2aa4\\u2aa8\\u2b04\\u2b07\\u2b44\\u2b7f\\u2bae\\u2c34\\u2c67\\u2c7c\\u2ce9\\u0100gt\\u2947\\u294b;\\uc000\\u22d9\\u0338\\u0100;v\\u2950\\u0bcf\\uc000\\u226b\\u20d2\\u0180elt\\u295a\\u2972\\u2976ft\\u0100ar\\u2961\\u2967rrow;\\u61cdightarrow;\\u61ce;\\uc000\\u22d8\\u0338\\u0100;v\\u297b\\u0c47\\uc000\\u226a\\u20d2ightarrow;\\u61cf\\u0100Dd\\u298e\\u2993ash;\\u62afash;\\u62ae\\u0280bcnpt\\u29a3\\u29a7\\u29ac\\u29b1\\u29ccla\\xbb\\u02deute;\\u4144g;\\uc000\\u2220\\u20d2\\u0280;Eiop\\u0d84\\u29bc\\u29c0\\u29c5\\u29c8;\\uc000\\u2a70\\u0338d;\\uc000\\u224b\\u0338s;\\u4149ro\\xf8\\u0d84ur\\u0100;a\\u29d3\\u29d4\\u666el\\u0100;s\\u29d3\\u0b38\\u01f3\\u29df\\0\\u29e3p\\u80bb\\xa0\\u0b37mp\\u0100;e\\u0bf9\\u0c00\\u0280aeouy\\u29f4\\u29fe\\u2a03\\u2a10\\u2a13\\u01f0\\u29f9\\0\\u29fb;\\u6a43on;\\u4148dil;\\u4146ng\\u0100;d\\u0d7e\\u2a0aot;\\uc000\\u2a6d\\u0338p;\\u6a42;\\u443dash;\\u6013\\u0380;Aadqsx\\u0b92\\u2a29\\u2a2d\\u2a3b\\u2a41\\u2a45\\u2a50rr;\\u61d7r\\u0100hr\\u2a33\\u2a36k;\\u6924\\u0100;o\\u13f2\\u13f0ot;\\uc000\\u2250\\u0338ui\\xf6\\u0b63\\u0100ei\\u2a4a\\u2a4ear;\\u6928\\xed\\u0b98ist\\u0100;s\\u0ba0\\u0b9fr;\\uc000\\ud835\\udd2b\\u0200Eest\\u0bc5\\u2a66\\u2a79\\u2a7c\\u0180;qs\\u0bbc\\u2a6d\\u0be1\\u0180;qs\\u0bbc\\u0bc5\\u2a74lan\\xf4\\u0be2i\\xed\\u0bea\\u0100;r\\u0bb6\\u2a81\\xbb\\u0bb7\\u0180Aap\\u2a8a\\u2a8d\\u2a91r\\xf2\\u2971rr;\\u61aear;\\u6af2\\u0180;sv\\u0f8d\\u2a9c\\u0f8c\\u0100;d\\u2aa1\\u2aa2\\u62fc;\\u62facy;\\u445a\\u0380AEadest\\u2ab7\\u2aba\\u2abe\\u2ac2\\u2ac5\\u2af6\\u2af9r\\xf2\\u2966;\\uc000\\u2266\\u0338rr;\\u619ar;\\u6025\\u0200;fqs\\u0c3b\\u2ace\\u2ae3\\u2aeft\\u0100ar\\u2ad4\\u2ad9rro\\xf7\\u2ac1ightarro\\xf7\\u2a90\\u0180;qs\\u0c3b\\u2aba\\u2aealan\\xf4\\u0c55\\u0100;s\\u0c55\\u2af4\\xbb\\u0c36i\\xed\\u0c5d\\u0100;r\\u0c35\\u2afei\\u0100;e\\u0c1a\\u0c25i\\xe4\\u0d90\\u0100pt\\u2b0c\\u2b11f;\\uc000\\ud835\\udd5f\\u8180\\xac;in\\u2b19\\u2b1a\\u2b36\\u40acn\\u0200;Edv\\u0b89\\u2b24\\u2b28\\u2b2e;\\uc000\\u22f9\\u0338ot;\\uc000\\u22f5\\u0338\\u01e1\\u0b89\\u2b33\\u2b35;\\u62f7;\\u62f6i\\u0100;v\\u0cb8\\u2b3c\\u01e1\\u0cb8\\u2b41\\u2b43;\\u62fe;\\u62fd\\u0180aor\\u2b4b\\u2b63\\u2b69r\\u0200;ast\\u0b7b\\u2b55\\u2b5a\\u2b5flle\\xec\\u0b7bl;\\uc000\\u2afd\\u20e5;\\uc000\\u2202\\u0338lint;\\u6a14\\u0180;ce\\u0c92\\u2b70\\u2b73u\\xe5\\u0ca5\\u0100;c\\u0c98\\u2b78\\u0100;e\\u0c92\\u2b7d\\xf1\\u0c98\\u0200Aait\\u2b88\\u2b8b\\u2b9d\\u2ba7r\\xf2\\u2988rr\\u0180;cw\\u2b94\\u2b95\\u2b99\\u619b;\\uc000\\u2933\\u0338;\\uc000\\u219d\\u0338ghtarrow\\xbb\\u2b95ri\\u0100;e\\u0ccb\\u0cd6\\u0380chimpqu\\u2bbd\\u2bcd\\u2bd9\\u2b04\\u0b78\\u2be4\\u2bef\\u0200;cer\\u0d32\\u2bc6\\u0d37\\u2bc9u\\xe5\\u0d45;\\uc000\\ud835\\udcc3ort\\u026d\\u2b05\\0\\0\\u2bd6ar\\xe1\\u2b56m\\u0100;e\\u0d6e\\u2bdf\\u0100;q\\u0d74\\u0d73su\\u0100bp\\u2beb\\u2bed\\xe5\\u0cf8\\xe5\\u0d0b\\u0180bcp\\u2bf6\\u2c11\\u2c19\\u0200;Ees\\u2bff\\u2c00\\u0d22\\u2c04\\u6284;\\uc000\\u2ac5\\u0338et\\u0100;e\\u0d1b\\u2c0bq\\u0100;q\\u0d23\\u2c00c\\u0100;e\\u0d32\\u2c17\\xf1\\u0d38\\u0200;Ees\\u2c22\\u2c23\\u0d5f\\u2c27\\u6285;\\uc000\\u2ac6\\u0338et\\u0100;e\\u0d58\\u2c2eq\\u0100;q\\u0d60\\u2c23\\u0200gilr\\u2c3d\\u2c3f\\u2c45\\u2c47\\xec\\u0bd7lde\\u803b\\xf1\\u40f1\\xe7\\u0c43iangle\\u0100lr\\u2c52\\u2c5ceft\\u0100;e\\u0c1a\\u2c5a\\xf1\\u0c26ight\\u0100;e\\u0ccb\\u2c65\\xf1\\u0cd7\\u0100;m\\u2c6c\\u2c6d\\u43bd\\u0180;es\\u2c74\\u2c75\\u2c79\\u4023ro;\\u6116p;\\u6007\\u0480DHadgilrs\\u2c8f\\u2c94\\u2c99\\u2c9e\\u2ca3\\u2cb0\\u2cb6\\u2cd3\\u2ce3ash;\\u62adarr;\\u6904p;\\uc000\\u224d\\u20d2ash;\\u62ac\\u0100et\\u2ca8\\u2cac;\\uc000\\u2265\\u20d2;\\uc000>\\u20d2nfin;\\u69de\\u0180Aet\\u2cbd\\u2cc1\\u2cc5rr;\\u6902;\\uc000\\u2264\\u20d2\\u0100;r\\u2cca\\u2ccd\\uc000<\\u20d2ie;\\uc000\\u22b4\\u20d2\\u0100At\\u2cd8\\u2cdcrr;\\u6903rie;\\uc000\\u22b5\\u20d2im;\\uc000\\u223c\\u20d2\\u0180Aan\\u2cf0\\u2cf4\\u2d02rr;\\u61d6r\\u0100hr\\u2cfa\\u2cfdk;\\u6923\\u0100;o\\u13e7\\u13e5ear;\\u6927\\u1253\\u1a95\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\u2d2d\\0\\u2d38\\u2d48\\u2d60\\u2d65\\u2d72\\u2d84\\u1b07\\0\\0\\u2d8d\\u2dab\\0\\u2dc8\\u2dce\\0\\u2ddc\\u2e19\\u2e2b\\u2e3e\\u2e43\\u0100cs\\u2d31\\u1a97ute\\u803b\\xf3\\u40f3\\u0100iy\\u2d3c\\u2d45r\\u0100;c\\u1a9e\\u2d42\\u803b\\xf4\\u40f4;\\u443e\\u0280abios\\u1aa0\\u2d52\\u2d57\\u01c8\\u2d5alac;\\u4151v;\\u6a38old;\\u69bclig;\\u4153\\u0100cr\\u2d69\\u2d6dir;\\u69bf;\\uc000\\ud835\\udd2c\\u036f\\u2d79\\0\\0\\u2d7c\\0\\u2d82n;\\u42dbave\\u803b\\xf2\\u40f2;\\u69c1\\u0100bm\\u2d88\\u0df4ar;\\u69b5\\u0200acit\\u2d95\\u2d98\\u2da5\\u2da8r\\xf2\\u1a80\\u0100ir\\u2d9d\\u2da0r;\\u69beoss;\\u69bbn\\xe5\\u0e52;\\u69c0\\u0180aei\\u2db1\\u2db5\\u2db9cr;\\u414dga;\\u43c9\\u0180cdn\\u2dc0\\u2dc5\\u01cdron;\\u43bf;\\u69b6pf;\\uc000\\ud835\\udd60\\u0180ael\\u2dd4\\u2dd7\\u01d2r;\\u69b7rp;\\u69b9\\u0380;adiosv\\u2dea\\u2deb\\u2dee\\u2e08\\u2e0d\\u2e10\\u2e16\\u6228r\\xf2\\u1a86\\u0200;efm\\u2df7\\u2df8\\u2e02\\u2e05\\u6a5dr\\u0100;o\\u2dfe\\u2dff\\u6134f\\xbb\\u2dff\\u803b\\xaa\\u40aa\\u803b\\xba\\u40bagof;\\u62b6r;\\u6a56lope;\\u6a57;\\u6a5b\\u0180clo\\u2e1f\\u2e21\\u2e27\\xf2\\u2e01ash\\u803b\\xf8\\u40f8l;\\u6298i\\u016c\\u2e2f\\u2e34de\\u803b\\xf5\\u40f5es\\u0100;a\\u01db\\u2e3as;\\u6a36ml\\u803b\\xf6\\u40f6bar;\\u633d\\u0ae1\\u2e5e\\0\\u2e7d\\0\\u2e80\\u2e9d\\0\\u2ea2\\u2eb9\\0\\0\\u2ecb\\u0e9c\\0\\u2f13\\0\\0\\u2f2b\\u2fbc\\0\\u2fc8r\\u0200;ast\\u0403\\u2e67\\u2e72\\u0e85\\u8100\\xb6;l\\u2e6d\\u2e6e\\u40b6le\\xec\\u0403\\u0269\\u2e78\\0\\0\\u2e7bm;\\u6af3;\\u6afdy;\\u443fr\\u0280cimpt\\u2e8b\\u2e8f\\u2e93\\u1865\\u2e97nt;\\u4025od;\\u402eil;\\u6030enk;\\u6031r;\\uc000\\ud835\\udd2d\\u0180imo\\u2ea8\\u2eb0\\u2eb4\\u0100;v\\u2ead\\u2eae\\u43c6;\\u43d5ma\\xf4\\u0a76ne;\\u660e\\u0180;tv\\u2ebf\\u2ec0\\u2ec8\\u43c0chfork\\xbb\\u1ffd;\\u43d6\\u0100au\\u2ecf\\u2edfn\\u0100ck\\u2ed5\\u2eddk\\u0100;h\\u21f4\\u2edb;\\u610e\\xf6\\u21f4s\\u0480;abcdemst\\u2ef3\\u2ef4\\u1908\\u2ef9\\u2efd\\u2f04\\u2f06\\u2f0a\\u2f0e\\u402bcir;\\u6a23ir;\\u6a22\\u0100ou\\u1d40\\u2f02;\\u6a25;\\u6a72n\\u80bb\\xb1\\u0e9dim;\\u6a26wo;\\u6a27\\u0180ipu\\u2f19\\u2f20\\u2f25ntint;\\u6a15f;\\uc000\\ud835\\udd61nd\\u803b\\xa3\\u40a3\\u0500;Eaceinosu\\u0ec8\\u2f3f\\u2f41\\u2f44\\u2f47\\u2f81\\u2f89\\u2f92\\u2f7e\\u2fb6;\\u6ab3p;\\u6ab7u\\xe5\\u0ed9\\u0100;c\\u0ece\\u2f4c\\u0300;acens\\u0ec8\\u2f59\\u2f5f\\u2f66\\u2f68\\u2f7eppro\\xf8\\u2f43urlye\\xf1\\u0ed9\\xf1\\u0ece\\u0180aes\\u2f6f\\u2f76\\u2f7approx;\\u6ab9qq;\\u6ab5im;\\u62e8i\\xed\\u0edfme\\u0100;s\\u2f88\\u0eae\\u6032\\u0180Eas\\u2f78\\u2f90\\u2f7a\\xf0\\u2f75\\u0180dfp\\u0eec\\u2f99\\u2faf\\u0180als\\u2fa0\\u2fa5\\u2faalar;\\u632eine;\\u6312urf;\\u6313\\u0100;t\\u0efb\\u2fb4\\xef\\u0efbrel;\\u62b0\\u0100ci\\u2fc0\\u2fc5r;\\uc000\\ud835\\udcc5;\\u43c8ncsp;\\u6008\\u0300fiopsu\\u2fda\\u22e2\\u2fdf\\u2fe5\\u2feb\\u2ff1r;\\uc000\\ud835\\udd2epf;\\uc000\\ud835\\udd62rime;\\u6057cr;\\uc000\\ud835\\udcc6\\u0180aeo\\u2ff8\\u3009\\u3013t\\u0100ei\\u2ffe\\u3005rnion\\xf3\\u06b0nt;\\u6a16st\\u0100;e\\u3010\\u3011\\u403f\\xf1\\u1f19\\xf4\\u0f14\\u0a80ABHabcdefhilmnoprstux\\u3040\\u3051\\u3055\\u3059\\u30e0\\u310e\\u312b\\u3147\\u3162\\u3172\\u318e\\u3206\\u3215\\u3224\\u3229\\u3258\\u326e\\u3272\\u3290\\u32b0\\u32b7\\u0180art\\u3047\\u304a\\u304cr\\xf2\\u10b3\\xf2\\u03ddail;\\u691car\\xf2\\u1c65ar;\\u6964\\u0380cdenqrt\\u3068\\u3075\\u3078\\u307f\\u308f\\u3094\\u30cc\\u0100eu\\u306d\\u3071;\\uc000\\u223d\\u0331te;\\u4155i\\xe3\\u116emptyv;\\u69b3g\\u0200;del\\u0fd1\\u3089\\u308b\\u308d;\\u6992;\\u69a5\\xe5\\u0fd1uo\\u803b\\xbb\\u40bbr\\u0580;abcfhlpstw\\u0fdc\\u30ac\\u30af\\u30b7\\u30b9\\u30bc\\u30be\\u30c0\\u30c3\\u30c7\\u30cap;\\u6975\\u0100;f\\u0fe0\\u30b4s;\\u6920;\\u6933s;\\u691e\\xeb\\u225d\\xf0\\u272el;\\u6945im;\\u6974l;\\u61a3;\\u619d\\u0100ai\\u30d1\\u30d5il;\\u691ao\\u0100;n\\u30db\\u30dc\\u6236al\\xf3\\u0f1e\\u0180abr\\u30e7\\u30ea\\u30eer\\xf2\\u17e5rk;\\u6773\\u0100ak\\u30f3\\u30fdc\\u0100ek\\u30f9\\u30fb;\\u407d;\\u405d\\u0100es\\u3102\\u3104;\\u698cl\\u0100du\\u310a\\u310c;\\u698e;\\u6990\\u0200aeuy\\u3117\\u311c\\u3127\\u3129ron;\\u4159\\u0100di\\u3121\\u3125il;\\u4157\\xec\\u0ff2\\xe2\\u30fa;\\u4440\\u0200clqs\\u3134\\u3137\\u313d\\u3144a;\\u6937dhar;\\u6969uo\\u0100;r\\u020e\\u020dh;\\u61b3\\u0180acg\\u314e\\u315f\\u0f44l\\u0200;ips\\u0f78\\u3158\\u315b\\u109cn\\xe5\\u10bbar\\xf4\\u0fa9t;\\u65ad\\u0180ilr\\u3169\\u1023\\u316esht;\\u697d;\\uc000\\ud835\\udd2f\\u0100ao\\u3177\\u3186r\\u0100du\\u317d\\u317f\\xbb\\u047b\\u0100;l\\u1091\\u3184;\\u696c\\u0100;v\\u318b\\u318c\\u43c1;\\u43f1\\u0180gns\\u3195\\u31f9\\u31fcht\\u0300ahlrst\\u31a4\\u31b0\\u31c2\\u31d8\\u31e4\\u31eerrow\\u0100;t\\u0fdc\\u31ada\\xe9\\u30c8arpoon\\u0100du\\u31bb\\u31bfow\\xee\\u317ep\\xbb\\u1092eft\\u0100ah\\u31ca\\u31d0rrow\\xf3\\u0feaarpoon\\xf3\\u0551ightarrows;\\u61c9quigarro\\xf7\\u30cbhreetimes;\\u62ccg;\\u42daingdotse\\xf1\\u1f32\\u0180ahm\\u320d\\u3210\\u3213r\\xf2\\u0feaa\\xf2\\u0551;\\u600foust\\u0100;a\\u321e\\u321f\\u63b1che\\xbb\\u321fmid;\\u6aee\\u0200abpt\\u3232\\u323d\\u3240\\u3252\\u0100nr\\u3237\\u323ag;\\u67edr;\\u61fer\\xeb\\u1003\\u0180afl\\u3247\\u324a\\u324er;\\u6986;\\uc000\\ud835\\udd63us;\\u6a2eimes;\\u6a35\\u0100ap\\u325d\\u3267r\\u0100;g\\u3263\\u3264\\u4029t;\\u6994olint;\\u6a12ar\\xf2\\u31e3\\u0200achq\\u327b\\u3280\\u10bc\\u3285quo;\\u603ar;\\uc000\\ud835\\udcc7\\u0100bu\\u30fb\\u328ao\\u0100;r\\u0214\\u0213\\u0180hir\\u3297\\u329b\\u32a0re\\xe5\\u31f8mes;\\u62cai\\u0200;efl\\u32aa\\u1059\\u1821\\u32ab\\u65b9tri;\\u69celuhar;\\u6968;\\u611e\\u0d61\\u32d5\\u32db\\u32df\\u332c\\u3338\\u3371\\0\\u337a\\u33a4\\0\\0\\u33ec\\u33f0\\0\\u3428\\u3448\\u345a\\u34ad\\u34b1\\u34ca\\u34f1\\0\\u3616\\0\\0\\u3633cute;\\u415bqu\\xef\\u27ba\\u0500;Eaceinpsy\\u11ed\\u32f3\\u32f5\\u32ff\\u3302\\u330b\\u330f\\u331f\\u3326\\u3329;\\u6ab4\\u01f0\\u32fa\\0\\u32fc;\\u6ab8on;\\u4161u\\xe5\\u11fe\\u0100;d\\u11f3\\u3307il;\\u415frc;\\u415d\\u0180Eas\\u3316\\u3318\\u331b;\\u6ab6p;\\u6abaim;\\u62e9olint;\\u6a13i\\xed\\u1204;\\u4441ot\\u0180;be\\u3334\\u1d47\\u3335\\u62c5;\\u6a66\\u0380Aacmstx\\u3346\\u334a\\u3357\\u335b\\u335e\\u3363\\u336drr;\\u61d8r\\u0100hr\\u3350\\u3352\\xeb\\u2228\\u0100;o\\u0a36\\u0a34t\\u803b\\xa7\\u40a7i;\\u403bwar;\\u6929m\\u0100in\\u3369\\xf0nu\\xf3\\xf1t;\\u6736r\\u0100;o\\u3376\\u2055\\uc000\\ud835\\udd30\\u0200acoy\\u3382\\u3386\\u3391\\u33a0rp;\\u666f\\u0100hy\\u338b\\u338fcy;\\u4449;\\u4448rt\\u026d\\u3399\\0\\0\\u339ci\\xe4\\u1464ara\\xec\\u2e6f\\u803b\\xad\\u40ad\\u0100gm\\u33a8\\u33b4ma\\u0180;fv\\u33b1\\u33b2\\u33b2\\u43c3;\\u43c2\\u0400;deglnpr\\u12ab\\u33c5\\u33c9\\u33ce\\u33d6\\u33de\\u33e1\\u33e6ot;\\u6a6a\\u0100;q\\u12b1\\u12b0\\u0100;E\\u33d3\\u33d4\\u6a9e;\\u6aa0\\u0100;E\\u33db\\u33dc\\u6a9d;\\u6a9fe;\\u6246lus;\\u6a24arr;\\u6972ar\\xf2\\u113d\\u0200aeit\\u33f8\\u3408\\u340f\\u3417\\u0100ls\\u33fd\\u3404lsetm\\xe9\\u336ahp;\\u6a33parsl;\\u69e4\\u0100dl\\u1463\\u3414e;\\u6323\\u0100;e\\u341c\\u341d\\u6aaa\\u0100;s\\u3422\\u3423\\u6aac;\\uc000\\u2aac\\ufe00\\u0180flp\\u342e\\u3433\\u3442tcy;\\u444c\\u0100;b\\u3438\\u3439\\u402f\\u0100;a\\u343e\\u343f\\u69c4r;\\u633ff;\\uc000\\ud835\\udd64a\\u0100dr\\u344d\\u0402es\\u0100;u\\u3454\\u3455\\u6660it\\xbb\\u3455\\u0180csu\\u3460\\u3479\\u349f\\u0100au\\u3465\\u346fp\\u0100;s\\u1188\\u346b;\\uc000\\u2293\\ufe00p\\u0100;s\\u11b4\\u3475;\\uc000\\u2294\\ufe00u\\u0100bp\\u347f\\u348f\\u0180;es\\u1197\\u119c\\u3486et\\u0100;e\\u1197\\u348d\\xf1\\u119d\\u0180;es\\u11a8\\u11ad\\u3496et\\u0100;e\\u11a8\\u349d\\xf1\\u11ae\\u0180;af\\u117b\\u34a6\\u05b0r\\u0165\\u34ab\\u05b1\\xbb\\u117car\\xf2\\u1148\\u0200cemt\\u34b9\\u34be\\u34c2\\u34c5r;\\uc000\\ud835\\udcc8tm\\xee\\xf1i\\xec\\u3415ar\\xe6\\u11be\\u0100ar\\u34ce\\u34d5r\\u0100;f\\u34d4\\u17bf\\u6606\\u0100an\\u34da\\u34edight\\u0100ep\\u34e3\\u34eapsilo\\xee\\u1ee0h\\xe9\\u2eafs\\xbb\\u2852\\u0280bcmnp\\u34fb\\u355e\\u1209\\u358b\\u358e\\u0480;Edemnprs\\u350e\\u350f\\u3511\\u3515\\u351e\\u3523\\u352c\\u3531\\u3536\\u6282;\\u6ac5ot;\\u6abd\\u0100;d\\u11da\\u351aot;\\u6ac3ult;\\u6ac1\\u0100Ee\\u3528\\u352a;\\u6acb;\\u628alus;\\u6abfarr;\\u6979\\u0180eiu\\u353d\\u3552\\u3555t\\u0180;en\\u350e\\u3545\\u354bq\\u0100;q\\u11da\\u350feq\\u0100;q\\u352b\\u3528m;\\u6ac7\\u0100bp\\u355a\\u355c;\\u6ad5;\\u6ad3c\\u0300;acens\\u11ed\\u356c\\u3572\\u3579\\u357b\\u3326ppro\\xf8\\u32faurlye\\xf1\\u11fe\\xf1\\u11f3\\u0180aes\\u3582\\u3588\\u331bppro\\xf8\\u331aq\\xf1\\u3317g;\\u666a\\u0680123;Edehlmnps\\u35a9\\u35ac\\u35af\\u121c\\u35b2\\u35b4\\u35c0\\u35c9\\u35d5\\u35da\\u35df\\u35e8\\u35ed\\u803b\\xb9\\u40b9\\u803b\\xb2\\u40b2\\u803b\\xb3\\u40b3;\\u6ac6\\u0100os\\u35b9\\u35bct;\\u6abeub;\\u6ad8\\u0100;d\\u1222\\u35c5ot;\\u6ac4s\\u0100ou\\u35cf\\u35d2l;\\u67c9b;\\u6ad7arr;\\u697bult;\\u6ac2\\u0100Ee\\u35e4\\u35e6;\\u6acc;\\u628blus;\\u6ac0\\u0180eiu\\u35f4\\u3609\\u360ct\\u0180;en\\u121c\\u35fc\\u3602q\\u0100;q\\u1222\\u35b2eq\\u0100;q\\u35e7\\u35e4m;\\u6ac8\\u0100bp\\u3611\\u3613;\\u6ad4;\\u6ad6\\u0180Aan\\u361c\\u3620\\u362drr;\\u61d9r\\u0100hr\\u3626\\u3628\\xeb\\u222e\\u0100;o\\u0a2b\\u0a29war;\\u692alig\\u803b\\xdf\\u40df\\u0be1\\u3651\\u365d\\u3660\\u12ce\\u3673\\u3679\\0\\u367e\\u36c2\\0\\0\\0\\0\\0\\u36db\\u3703\\0\\u3709\\u376c\\0\\0\\0\\u3787\\u0272\\u3656\\0\\0\\u365bget;\\u6316;\\u43c4r\\xeb\\u0e5f\\u0180aey\\u3666\\u366b\\u3670ron;\\u4165dil;\\u4163;\\u4442lrec;\\u6315r;\\uc000\\ud835\\udd31\\u0200eiko\\u3686\\u369d\\u36b5\\u36bc\\u01f2\\u368b\\0\\u3691e\\u01004f\\u1284\\u1281a\\u0180;sv\\u3698\\u3699\\u369b\\u43b8ym;\\u43d1\\u0100cn\\u36a2\\u36b2k\\u0100as\\u36a8\\u36aeppro\\xf8\\u12c1im\\xbb\\u12acs\\xf0\\u129e\\u0100as\\u36ba\\u36ae\\xf0\\u12c1rn\\u803b\\xfe\\u40fe\\u01ec\\u031f\\u36c6\\u22e7es\\u8180\\xd7;bd\\u36cf\\u36d0\\u36d8\\u40d7\\u0100;a\\u190f\\u36d5r;\\u6a31;\\u6a30\\u0180eps\\u36e1\\u36e3\\u3700\\xe1\\u2a4d\\u0200;bcf\\u0486\\u36ec\\u36f0\\u36f4ot;\\u6336ir;\\u6af1\\u0100;o\\u36f9\\u36fc\\uc000\\ud835\\udd65rk;\\u6ada\\xe1\\u3362rime;\\u6034\\u0180aip\\u370f\\u3712\\u3764d\\xe5\\u1248\\u0380adempst\\u3721\\u374d\\u3740\\u3751\\u3757\\u375c\\u375fngle\\u0280;dlqr\\u3730\\u3731\\u3736\\u3740\\u3742\\u65b5own\\xbb\\u1dbbeft\\u0100;e\\u2800\\u373e\\xf1\\u092e;\\u625cight\\u0100;e\\u32aa\\u374b\\xf1\\u105aot;\\u65ecinus;\\u6a3alus;\\u6a39b;\\u69cdime;\\u6a3bezium;\\u63e2\\u0180cht\\u3772\\u377d\\u3781\\u0100ry\\u3777\\u377b;\\uc000\\ud835\\udcc9;\\u4446cy;\\u445brok;\\u4167\\u0100io\\u378b\\u378ex\\xf4\\u1777head\\u0100lr\\u3797\\u37a0eftarro\\xf7\\u084fightarrow\\xbb\\u0f5d\\u0900AHabcdfghlmoprstuw\\u37d0\\u37d3\\u37d7\\u37e4\\u37f0\\u37fc\\u380e\\u381c\\u3823\\u3834\\u3851\\u385d\\u386b\\u38a9\\u38cc\\u38d2\\u38ea\\u38f6r\\xf2\\u03edar;\\u6963\\u0100cr\\u37dc\\u37e2ute\\u803b\\xfa\\u40fa\\xf2\\u1150r\\u01e3\\u37ea\\0\\u37edy;\\u445eve;\\u416d\\u0100iy\\u37f5\\u37farc\\u803b\\xfb\\u40fb;\\u4443\\u0180abh\\u3803\\u3806\\u380br\\xf2\\u13adlac;\\u4171a\\xf2\\u13c3\\u0100ir\\u3813\\u3818sht;\\u697e;\\uc000\\ud835\\udd32rave\\u803b\\xf9\\u40f9\\u0161\\u3827\\u3831r\\u0100lr\\u382c\\u382e\\xbb\\u0957\\xbb\\u1083lk;\\u6580\\u0100ct\\u3839\\u384d\\u026f\\u383f\\0\\0\\u384arn\\u0100;e\\u3845\\u3846\\u631cr\\xbb\\u3846op;\\u630fri;\\u65f8\\u0100al\\u3856\\u385acr;\\u416b\\u80bb\\xa8\\u0349\\u0100gp\\u3862\\u3866on;\\u4173f;\\uc000\\ud835\\udd66\\u0300adhlsu\\u114b\\u3878\\u387d\\u1372\\u3891\\u38a0own\\xe1\\u13b3arpoon\\u0100lr\\u3888\\u388cef\\xf4\\u382digh\\xf4\\u382fi\\u0180;hl\\u3899\\u389a\\u389c\\u43c5\\xbb\\u13faon\\xbb\\u389aparrows;\\u61c8\\u0180cit\\u38b0\\u38c4\\u38c8\\u026f\\u38b6\\0\\0\\u38c1rn\\u0100;e\\u38bc\\u38bd\\u631dr\\xbb\\u38bdop;\\u630eng;\\u416fri;\\u65f9cr;\\uc000\\ud835\\udcca\\u0180dir\\u38d9\\u38dd\\u38e2ot;\\u62f0lde;\\u4169i\\u0100;f\\u3730\\u38e8\\xbb\\u1813\\u0100am\\u38ef\\u38f2r\\xf2\\u38a8l\\u803b\\xfc\\u40fcangle;\\u69a7\\u0780ABDacdeflnoprsz\\u391c\\u391f\\u3929\\u392d\\u39b5\\u39b8\\u39bd\\u39df\\u39e4\\u39e8\\u39f3\\u39f9\\u39fd\\u3a01\\u3a20r\\xf2\\u03f7ar\\u0100;v\\u3926\\u3927\\u6ae8;\\u6ae9as\\xe8\\u03e1\\u0100nr\\u3932\\u3937grt;\\u699c\\u0380eknprst\\u34e3\\u3946\\u394b\\u3952\\u395d\\u3964\\u3996app\\xe1\\u2415othin\\xe7\\u1e96\\u0180hir\\u34eb\\u2ec8\\u3959op\\xf4\\u2fb5\\u0100;h\\u13b7\\u3962\\xef\\u318d\\u0100iu\\u3969\\u396dgm\\xe1\\u33b3\\u0100bp\\u3972\\u3984setneq\\u0100;q\\u397d\\u3980\\uc000\\u228a\\ufe00;\\uc000\\u2acb\\ufe00setneq\\u0100;q\\u398f\\u3992\\uc000\\u228b\\ufe00;\\uc000\\u2acc\\ufe00\\u0100hr\\u399b\\u399fet\\xe1\\u369ciangle\\u0100lr\\u39aa\\u39afeft\\xbb\\u0925ight\\xbb\\u1051y;\\u4432ash\\xbb\\u1036\\u0180elr\\u39c4\\u39d2\\u39d7\\u0180;be\\u2dea\\u39cb\\u39cfar;\\u62bbq;\\u625alip;\\u62ee\\u0100bt\\u39dc\\u1468a\\xf2\\u1469r;\\uc000\\ud835\\udd33tr\\xe9\\u39aesu\\u0100bp\\u39ef\\u39f1\\xbb\\u0d1c\\xbb\\u0d59pf;\\uc000\\ud835\\udd67ro\\xf0\\u0efbtr\\xe9\\u39b4\\u0100cu\\u3a06\\u3a0br;\\uc000\\ud835\\udccb\\u0100bp\\u3a10\\u3a18n\\u0100Ee\\u3980\\u3a16\\xbb\\u397en\\u0100Ee\\u3992\\u3a1e\\xbb\\u3990igzag;\\u699a\\u0380cefoprs\\u3a36\\u3a3b\\u3a56\\u3a5b\\u3a54\\u3a61\\u3a6airc;\\u4175\\u0100di\\u3a40\\u3a51\\u0100bg\\u3a45\\u3a49ar;\\u6a5fe\\u0100;q\\u15fa\\u3a4f;\\u6259erp;\\u6118r;\\uc000\\ud835\\udd34pf;\\uc000\\ud835\\udd68\\u0100;e\\u1479\\u3a66at\\xe8\\u1479cr;\\uc000\\ud835\\udccc\\u0ae3\\u178e\\u3a87\\0\\u3a8b\\0\\u3a90\\u3a9b\\0\\0\\u3a9d\\u3aa8\\u3aab\\u3aaf\\0\\0\\u3ac3\\u3ace\\0\\u3ad8\\u17dc\\u17dftr\\xe9\\u17d1r;\\uc000\\ud835\\udd35\\u0100Aa\\u3a94\\u3a97r\\xf2\\u03c3r\\xf2\\u09f6;\\u43be\\u0100Aa\\u3aa1\\u3aa4r\\xf2\\u03b8r\\xf2\\u09eba\\xf0\\u2713is;\\u62fb\\u0180dpt\\u17a4\\u3ab5\\u3abe\\u0100fl\\u3aba\\u17a9;\\uc000\\ud835\\udd69im\\xe5\\u17b2\\u0100Aa\\u3ac7\\u3acar\\xf2\\u03cer\\xf2\\u0a01\\u0100cq\\u3ad2\\u17b8r;\\uc000\\ud835\\udccd\\u0100pt\\u17d6\\u3adcr\\xe9\\u17d4\\u0400acefiosu\\u3af0\\u3afd\\u3b08\\u3b0c\\u3b11\\u3b15\\u3b1b\\u3b21c\\u0100uy\\u3af6\\u3afbte\\u803b\\xfd\\u40fd;\\u444f\\u0100iy\\u3b02\\u3b06rc;\\u4177;\\u444bn\\u803b\\xa5\\u40a5r;\\uc000\\ud835\\udd36cy;\\u4457pf;\\uc000\\ud835\\udd6acr;\\uc000\\ud835\\udcce\\u0100cm\\u3b26\\u3b29y;\\u444el\\u803b\\xff\\u40ff\\u0500acdefhiosw\\u3b42\\u3b48\\u3b54\\u3b58\\u3b64\\u3b69\\u3b6d\\u3b74\\u3b7a\\u3b80cute;\\u417a\\u0100ay\\u3b4d\\u3b52ron;\\u417e;\\u4437ot;\\u417c\\u0100et\\u3b5d\\u3b61tr\\xe6\\u155fa;\\u43b6r;\\uc000\\ud835\\udd37cy;\\u4436grarr;\\u61ddpf;\\uc000\\ud835\\udd6bcr;\\uc000\\ud835\\udccf\\u0100jn\\u3b85\\u3b87;\\u600dj;\\u600c\"\n .split(\"\")\n .map((c) => c.charCodeAt(0)));\n//# sourceMappingURL=decode-data-html.js.map","// Generated using scripts/write-decode-map.ts\nexport const xmlDecodeTree = /* #__PURE__ */ new Uint16Array(\n// prettier-ignore\n/* #__PURE__ */ \"\\u0200aglq\\t\\x15\\x18\\x1b\\u026d\\x0f\\0\\0\\x12p;\\u4026os;\\u4027t;\\u403et;\\u403cuot;\\u4022\"\n .split(\"\")\n .map((c) => c.charCodeAt(0)));\n//# sourceMappingURL=decode-data-xml.js.map","// Adapted from https://github.com/mathiasbynens/he/blob/36afe179392226cf1b6ccdb16ebbb7a5a844d93a/src/he.js#L106-L134\nvar _a;\nconst decodeMap = new Map([\n [0, 65533],\n // C1 Unicode control character reference replacements\n [128, 8364],\n [130, 8218],\n [131, 402],\n [132, 8222],\n [133, 8230],\n [134, 8224],\n [135, 8225],\n [136, 710],\n [137, 8240],\n [138, 352],\n [139, 8249],\n [140, 338],\n [142, 381],\n [145, 8216],\n [146, 8217],\n [147, 8220],\n [148, 8221],\n [149, 8226],\n [150, 8211],\n [151, 8212],\n [152, 732],\n [153, 8482],\n [154, 353],\n [155, 8250],\n [156, 339],\n [158, 382],\n [159, 376],\n]);\n/**\n * Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point.\n */\nexport const fromCodePoint = \n// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, n/no-unsupported-features/es-builtins\n(_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : function (codePoint) {\n let output = \"\";\n if (codePoint > 65535) {\n codePoint -= 65536;\n output += String.fromCharCode(((codePoint >>> 10) & 1023) | 55296);\n codePoint = 56320 | (codePoint & 1023);\n }\n output += String.fromCharCode(codePoint);\n return output;\n};\n/**\n * Replace the given code point with a replacement character if it is a\n * surrogate or is outside the valid range. Otherwise return the code\n * point unchanged.\n */\nexport function replaceCodePoint(codePoint) {\n var _a;\n if ((codePoint >= 55296 && codePoint <= 57343) ||\n codePoint > 1114111) {\n return 65533;\n }\n return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;\n}\n/**\n * Replace the code point if relevant, then convert it to a string.\n *\n * @deprecated Use `fromCodePoint(replaceCodePoint(codePoint))` instead.\n * @param codePoint The code point to decode.\n * @returns The decoded code point.\n */\nexport function decodeCodePoint(codePoint) {\n return fromCodePoint(replaceCodePoint(codePoint));\n}\n//# sourceMappingURL=decode-codepoint.js.map","import { htmlDecodeTree } from \"./generated/decode-data-html.js\";\nimport { xmlDecodeTree } from \"./generated/decode-data-xml.js\";\nimport { replaceCodePoint, fromCodePoint } from \"./decode-codepoint.js\";\nvar CharCodes;\n(function (CharCodes) {\n CharCodes[CharCodes[\"NUM\"] = 35] = \"NUM\";\n CharCodes[CharCodes[\"SEMI\"] = 59] = \"SEMI\";\n CharCodes[CharCodes[\"EQUALS\"] = 61] = \"EQUALS\";\n CharCodes[CharCodes[\"ZERO\"] = 48] = \"ZERO\";\n CharCodes[CharCodes[\"NINE\"] = 57] = \"NINE\";\n CharCodes[CharCodes[\"LOWER_A\"] = 97] = \"LOWER_A\";\n CharCodes[CharCodes[\"LOWER_F\"] = 102] = \"LOWER_F\";\n CharCodes[CharCodes[\"LOWER_X\"] = 120] = \"LOWER_X\";\n CharCodes[CharCodes[\"LOWER_Z\"] = 122] = \"LOWER_Z\";\n CharCodes[CharCodes[\"UPPER_A\"] = 65] = \"UPPER_A\";\n CharCodes[CharCodes[\"UPPER_F\"] = 70] = \"UPPER_F\";\n CharCodes[CharCodes[\"UPPER_Z\"] = 90] = \"UPPER_Z\";\n})(CharCodes || (CharCodes = {}));\n/** Bit that needs to be set to convert an upper case ASCII character to lower case */\nconst TO_LOWER_BIT = 32;\nexport var BinTrieFlags;\n(function (BinTrieFlags) {\n BinTrieFlags[BinTrieFlags[\"VALUE_LENGTH\"] = 49152] = \"VALUE_LENGTH\";\n BinTrieFlags[BinTrieFlags[\"BRANCH_LENGTH\"] = 16256] = \"BRANCH_LENGTH\";\n BinTrieFlags[BinTrieFlags[\"JUMP_TABLE\"] = 127] = \"JUMP_TABLE\";\n})(BinTrieFlags || (BinTrieFlags = {}));\nfunction isNumber(code) {\n return code >= CharCodes.ZERO && code <= CharCodes.NINE;\n}\nfunction isHexadecimalCharacter(code) {\n return ((code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F) ||\n (code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F));\n}\nfunction isAsciiAlphaNumeric(code) {\n return ((code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z) ||\n (code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z) ||\n isNumber(code));\n}\n/**\n * Checks if the given character is a valid end character for an entity in an attribute.\n *\n * Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.\n * See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state\n */\nfunction isEntityInAttributeInvalidEnd(code) {\n return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code);\n}\nvar EntityDecoderState;\n(function (EntityDecoderState) {\n EntityDecoderState[EntityDecoderState[\"EntityStart\"] = 0] = \"EntityStart\";\n EntityDecoderState[EntityDecoderState[\"NumericStart\"] = 1] = \"NumericStart\";\n EntityDecoderState[EntityDecoderState[\"NumericDecimal\"] = 2] = \"NumericDecimal\";\n EntityDecoderState[EntityDecoderState[\"NumericHex\"] = 3] = \"NumericHex\";\n EntityDecoderState[EntityDecoderState[\"NamedEntity\"] = 4] = \"NamedEntity\";\n})(EntityDecoderState || (EntityDecoderState = {}));\nexport var DecodingMode;\n(function (DecodingMode) {\n /** Entities in text nodes that can end with any character. */\n DecodingMode[DecodingMode[\"Legacy\"] = 0] = \"Legacy\";\n /** Only allow entities terminated with a semicolon. */\n DecodingMode[DecodingMode[\"Strict\"] = 1] = \"Strict\";\n /** Entities in attributes have limitations on ending characters. */\n DecodingMode[DecodingMode[\"Attribute\"] = 2] = \"Attribute\";\n})(DecodingMode || (DecodingMode = {}));\n/**\n * Token decoder with support of writing partial entities.\n */\nexport class EntityDecoder {\n constructor(\n /** The tree used to decode entities. */\n decodeTree, \n /**\n * The function that is called when a codepoint is decoded.\n *\n * For multi-byte named entities, this will be called multiple times,\n * with the second codepoint, and the same `consumed` value.\n *\n * @param codepoint The decoded codepoint.\n * @param consumed The number of bytes consumed by the decoder.\n */\n emitCodePoint, \n /** An object that is used to produce errors. */\n errors) {\n this.decodeTree = decodeTree;\n this.emitCodePoint = emitCodePoint;\n this.errors = errors;\n /** The current state of the decoder. */\n this.state = EntityDecoderState.EntityStart;\n /** Characters that were consumed while parsing an entity. */\n this.consumed = 1;\n /**\n * The result of the entity.\n *\n * Either the result index of a numeric entity, or the codepoint of a\n * numeric entity.\n */\n this.result = 0;\n /** The current index in the decode tree. */\n this.treeIndex = 0;\n /** The number of characters that were consumed in excess. */\n this.excess = 1;\n /** The mode in which the decoder is operating. */\n this.decodeMode = DecodingMode.Strict;\n }\n /** Resets the instance to make it reusable. */\n startEntity(decodeMode) {\n this.decodeMode = decodeMode;\n this.state = EntityDecoderState.EntityStart;\n this.result = 0;\n this.treeIndex = 0;\n this.excess = 1;\n this.consumed = 1;\n }\n /**\n * Write an entity to the decoder. This can be called multiple times with partial entities.\n * If the entity is incomplete, the decoder will return -1.\n *\n * Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the\n * entity is incomplete, and resume when the next string is written.\n *\n * @param input The string containing the entity (or a continuation of the entity).\n * @param offset The offset at which the entity begins. Should be 0 if this is not the first call.\n * @returns The number of characters that were consumed, or -1 if the entity is incomplete.\n */\n write(input, offset) {\n switch (this.state) {\n case EntityDecoderState.EntityStart: {\n if (input.charCodeAt(offset) === CharCodes.NUM) {\n this.state = EntityDecoderState.NumericStart;\n this.consumed += 1;\n return this.stateNumericStart(input, offset + 1);\n }\n this.state = EntityDecoderState.NamedEntity;\n return this.stateNamedEntity(input, offset);\n }\n case EntityDecoderState.NumericStart: {\n return this.stateNumericStart(input, offset);\n }\n case EntityDecoderState.NumericDecimal: {\n return this.stateNumericDecimal(input, offset);\n }\n case EntityDecoderState.NumericHex: {\n return this.stateNumericHex(input, offset);\n }\n case EntityDecoderState.NamedEntity: {\n return this.stateNamedEntity(input, offset);\n }\n }\n }\n /**\n * Switches between the numeric decimal and hexadecimal states.\n *\n * Equivalent to the `Numeric character reference state` in the HTML spec.\n *\n * @param input The string containing the entity (or a continuation of the entity).\n * @param offset The current offset.\n * @returns The number of characters that were consumed, or -1 if the entity is incomplete.\n */\n stateNumericStart(input, offset) {\n if (offset >= input.length) {\n return -1;\n }\n if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {\n this.state = EntityDecoderState.NumericHex;\n this.consumed += 1;\n return this.stateNumericHex(input, offset + 1);\n }\n this.state = EntityDecoderState.NumericDecimal;\n return this.stateNumericDecimal(input, offset);\n }\n addToNumericResult(input, start, end, base) {\n if (start !== end) {\n const digitCount = end - start;\n this.result =\n this.result * Math.pow(base, digitCount) +\n Number.parseInt(input.substr(start, digitCount), base);\n this.consumed += digitCount;\n }\n }\n /**\n * Parses a hexadecimal numeric entity.\n *\n * Equivalent to the `Hexademical character reference state` in the HTML spec.\n *\n * @param input The string containing the entity (or a continuation of the entity).\n * @param offset The current offset.\n * @returns The number of characters that were consumed, or -1 if the entity is incomplete.\n */\n stateNumericHex(input, offset) {\n const startIndex = offset;\n while (offset < input.length) {\n const char = input.charCodeAt(offset);\n if (isNumber(char) || isHexadecimalCharacter(char)) {\n offset += 1;\n }\n else {\n this.addToNumericResult(input, startIndex, offset, 16);\n return this.emitNumericEntity(char, 3);\n }\n }\n this.addToNumericResult(input, startIndex, offset, 16);\n return -1;\n }\n /**\n * Parses a decimal numeric entity.\n *\n * Equivalent to the `Decimal character reference state` in the HTML spec.\n *\n * @param input The string containing the entity (or a continuation of the entity).\n * @param offset The current offset.\n * @returns The number of characters that were consumed, or -1 if the entity is incomplete.\n */\n stateNumericDecimal(input, offset) {\n const startIndex = offset;\n while (offset < input.length) {\n const char = input.charCodeAt(offset);\n if (isNumber(char)) {\n offset += 1;\n }\n else {\n this.addToNumericResult(input, startIndex, offset, 10);\n return this.emitNumericEntity(char, 2);\n }\n }\n this.addToNumericResult(input, startIndex, offset, 10);\n return -1;\n }\n /**\n * Validate and emit a numeric entity.\n *\n * Implements the logic from the `Hexademical character reference start\n * state` and `Numeric character reference end state` in the HTML spec.\n *\n * @param lastCp The last code point of the entity. Used to see if the\n * entity was terminated with a semicolon.\n * @param expectedLength The minimum number of characters that should be\n * consumed. Used to validate that at least one digit\n * was consumed.\n * @returns The number of characters that were consumed.\n */\n emitNumericEntity(lastCp, expectedLength) {\n var _a;\n // Ensure we consumed at least one digit.\n if (this.consumed <= expectedLength) {\n (_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);\n return 0;\n }\n // Figure out if this is a legit end of the entity\n if (lastCp === CharCodes.SEMI) {\n this.consumed += 1;\n }\n else if (this.decodeMode === DecodingMode.Strict) {\n return 0;\n }\n this.emitCodePoint(replaceCodePoint(this.result), this.consumed);\n if (this.errors) {\n if (lastCp !== CharCodes.SEMI) {\n this.errors.missingSemicolonAfterCharacterReference();\n }\n this.errors.validateNumericCharacterReference(this.result);\n }\n return this.consumed;\n }\n /**\n * Parses a named entity.\n *\n * Equivalent to the `Named character reference state` in the HTML spec.\n *\n * @param input The string containing the entity (or a continuation of the entity).\n * @param offset The current offset.\n * @returns The number of characters that were consumed, or -1 if the entity is incomplete.\n */\n stateNamedEntity(input, offset) {\n const { decodeTree } = this;\n let current = decodeTree[this.treeIndex];\n // The mask is the number of bytes of the value, including the current byte.\n let valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;\n for (; offset < input.length; offset++, this.excess++) {\n const char = input.charCodeAt(offset);\n this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);\n if (this.treeIndex < 0) {\n return this.result === 0 ||\n // If we are parsing an attribute\n (this.decodeMode === DecodingMode.Attribute &&\n // We shouldn't have consumed any characters after the entity,\n (valueLength === 0 ||\n // And there should be no invalid characters.\n isEntityInAttributeInvalidEnd(char)))\n ? 0\n : this.emitNotTerminatedNamedEntity();\n }\n current = decodeTree[this.treeIndex];\n valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;\n // If the branch is a value, store it and continue\n if (valueLength !== 0) {\n // If the entity is terminated by a semicolon, we are done.\n if (char === CharCodes.SEMI) {\n return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);\n }\n // If we encounter a non-terminated (legacy) entity while parsing strictly, then ignore it.\n if (this.decodeMode !== DecodingMode.Strict) {\n this.result = this.treeIndex;\n this.consumed += this.excess;\n this.excess = 0;\n }\n }\n }\n return -1;\n }\n /**\n * Emit a named entity that was not terminated with a semicolon.\n *\n * @returns The number of characters consumed.\n */\n emitNotTerminatedNamedEntity() {\n var _a;\n const { result, decodeTree } = this;\n const valueLength = (decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14;\n this.emitNamedEntityData(result, valueLength, this.consumed);\n (_a = this.errors) === null || _a === void 0 ? void 0 : _a.missingSemicolonAfterCharacterReference();\n return this.consumed;\n }\n /**\n * Emit a named entity.\n *\n * @param result The index of the entity in the decode tree.\n * @param valueLength The number of bytes in the entity.\n * @param consumed The number of characters consumed.\n *\n * @returns The number of characters consumed.\n */\n emitNamedEntityData(result, valueLength, consumed) {\n const { decodeTree } = this;\n this.emitCodePoint(valueLength === 1\n ? decodeTree[result] & ~BinTrieFlags.VALUE_LENGTH\n : decodeTree[result + 1], consumed);\n if (valueLength === 3) {\n // For multi-byte values, we need to emit the second byte.\n this.emitCodePoint(decodeTree[result + 2], consumed);\n }\n return consumed;\n }\n /**\n * Signal to the parser that the end of the input was reached.\n *\n * Remaining data will be emitted and relevant errors will be produced.\n *\n * @returns The number of characters consumed.\n */\n end() {\n var _a;\n switch (this.state) {\n case EntityDecoderState.NamedEntity: {\n // Emit a named entity if we have one.\n return this.result !== 0 &&\n (this.decodeMode !== DecodingMode.Attribute ||\n this.result === this.treeIndex)\n ? this.emitNotTerminatedNamedEntity()\n : 0;\n }\n // Otherwise, emit a numeric entity if we have one.\n case EntityDecoderState.NumericDecimal: {\n return this.emitNumericEntity(0, 2);\n }\n case EntityDecoderState.NumericHex: {\n return this.emitNumericEntity(0, 3);\n }\n case EntityDecoderState.NumericStart: {\n (_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);\n return 0;\n }\n case EntityDecoderState.EntityStart: {\n // Return 0 if we have no entity.\n return 0;\n }\n }\n }\n}\n/**\n * Creates a function that decodes entities in a string.\n *\n * @param decodeTree The decode tree.\n * @returns A function that decodes entities in a string.\n */\nfunction getDecoder(decodeTree) {\n let returnValue = \"\";\n const decoder = new EntityDecoder(decodeTree, (data) => (returnValue += fromCodePoint(data)));\n return function decodeWithTrie(input, decodeMode) {\n let lastIndex = 0;\n let offset = 0;\n while ((offset = input.indexOf(\"&\", offset)) >= 0) {\n returnValue += input.slice(lastIndex, offset);\n decoder.startEntity(decodeMode);\n const length = decoder.write(input, \n // Skip the \"&\"\n offset + 1);\n if (length < 0) {\n lastIndex = offset + decoder.end();\n break;\n }\n lastIndex = offset + length;\n // If `length` is 0, skip the current `&` and continue.\n offset = length === 0 ? lastIndex + 1 : lastIndex;\n }\n const result = returnValue + input.slice(lastIndex);\n // Make sure we don't keep a reference to the final string.\n returnValue = \"\";\n return result;\n };\n}\n/**\n * Determines the branch of the current node that is taken given the current\n * character. This function is used to traverse the trie.\n *\n * @param decodeTree The trie.\n * @param current The current node.\n * @param nodeIdx The index right after the current node and its value.\n * @param char The current character.\n * @returns The index of the next node, or -1 if no branch is taken.\n */\nexport function determineBranch(decodeTree, current, nodeIndex, char) {\n const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;\n const jumpOffset = current & BinTrieFlags.JUMP_TABLE;\n // Case 1: Single branch encoded in jump offset\n if (branchCount === 0) {\n return jumpOffset !== 0 && char === jumpOffset ? nodeIndex : -1;\n }\n // Case 2: Multiple branches encoded in jump table\n if (jumpOffset) {\n const value = char - jumpOffset;\n return value < 0 || value >= branchCount\n ? -1\n : decodeTree[nodeIndex + value] - 1;\n }\n // Case 3: Multiple branches encoded in dictionary\n // Binary search for the character.\n let lo = nodeIndex;\n let hi = lo + branchCount - 1;\n while (lo <= hi) {\n const mid = (lo + hi) >>> 1;\n const midValue = decodeTree[mid];\n if (midValue < char) {\n lo = mid + 1;\n }\n else if (midValue > char) {\n hi = mid - 1;\n }\n else {\n return decodeTree[mid + branchCount];\n }\n }\n return -1;\n}\nconst htmlDecoder = /* #__PURE__ */ getDecoder(htmlDecodeTree);\nconst xmlDecoder = /* #__PURE__ */ getDecoder(xmlDecodeTree);\n/**\n * Decodes an HTML string.\n *\n * @param htmlString The string to decode.\n * @param mode The decoding mode.\n * @returns The decoded string.\n */\nexport function decodeHTML(htmlString, mode = DecodingMode.Legacy) {\n return htmlDecoder(htmlString, mode);\n}\n/**\n * Decodes an HTML string in an attribute.\n *\n * @param htmlAttribute The string to decode.\n * @returns The decoded string.\n */\nexport function decodeHTMLAttribute(htmlAttribute) {\n return htmlDecoder(htmlAttribute, DecodingMode.Attribute);\n}\n/**\n * Decodes an HTML string, requiring all entities to be terminated by a semicolon.\n *\n * @param htmlString The string to decode.\n * @returns The decoded string.\n */\nexport function decodeHTMLStrict(htmlString) {\n return htmlDecoder(htmlString, DecodingMode.Strict);\n}\n/**\n * Decodes an XML string, requiring all entities to be terminated by a semicolon.\n *\n * @param xmlString The string to decode.\n * @returns The decoded string.\n */\nexport function decodeXML(xmlString) {\n return xmlDecoder(xmlString, DecodingMode.Strict);\n}\n// Re-export for use by eg. htmlparser2\nexport { htmlDecodeTree } from \"./generated/decode-data-html.js\";\nexport { xmlDecodeTree } from \"./generated/decode-data-xml.js\";\nexport { decodeCodePoint, replaceCodePoint, fromCodePoint, } from \"./decode-codepoint.js\";\n//# sourceMappingURL=decode.js.map","import { EntityDecoder, DecodingMode, htmlDecodeTree, xmlDecodeTree, } from \"entities/decode\";\nvar CharCodes;\n(function (CharCodes) {\n CharCodes[CharCodes[\"Tab\"] = 9] = \"Tab\";\n CharCodes[CharCodes[\"NewLine\"] = 10] = \"NewLine\";\n CharCodes[CharCodes[\"FormFeed\"] = 12] = \"FormFeed\";\n CharCodes[CharCodes[\"CarriageReturn\"] = 13] = \"CarriageReturn\";\n CharCodes[CharCodes[\"Space\"] = 32] = \"Space\";\n CharCodes[CharCodes[\"ExclamationMark\"] = 33] = \"ExclamationMark\";\n CharCodes[CharCodes[\"Number\"] = 35] = \"Number\";\n CharCodes[CharCodes[\"Amp\"] = 38] = \"Amp\";\n CharCodes[CharCodes[\"SingleQuote\"] = 39] = \"SingleQuote\";\n CharCodes[CharCodes[\"DoubleQuote\"] = 34] = \"DoubleQuote\";\n CharCodes[CharCodes[\"Dash\"] = 45] = \"Dash\";\n CharCodes[CharCodes[\"Slash\"] = 47] = \"Slash\";\n CharCodes[CharCodes[\"Zero\"] = 48] = \"Zero\";\n CharCodes[CharCodes[\"Nine\"] = 57] = \"Nine\";\n CharCodes[CharCodes[\"Semi\"] = 59] = \"Semi\";\n CharCodes[CharCodes[\"Lt\"] = 60] = \"Lt\";\n CharCodes[CharCodes[\"Eq\"] = 61] = \"Eq\";\n CharCodes[CharCodes[\"Gt\"] = 62] = \"Gt\";\n CharCodes[CharCodes[\"Questionmark\"] = 63] = \"Questionmark\";\n CharCodes[CharCodes[\"UpperA\"] = 65] = \"UpperA\";\n CharCodes[CharCodes[\"LowerA\"] = 97] = \"LowerA\";\n CharCodes[CharCodes[\"UpperF\"] = 70] = \"UpperF\";\n CharCodes[CharCodes[\"LowerF\"] = 102] = \"LowerF\";\n CharCodes[CharCodes[\"UpperZ\"] = 90] = \"UpperZ\";\n CharCodes[CharCodes[\"LowerZ\"] = 122] = \"LowerZ\";\n CharCodes[CharCodes[\"LowerX\"] = 120] = \"LowerX\";\n CharCodes[CharCodes[\"OpeningSquareBracket\"] = 91] = \"OpeningSquareBracket\";\n})(CharCodes || (CharCodes = {}));\n/** All the states the tokenizer can be in. */\nvar State;\n(function (State) {\n State[State[\"Text\"] = 1] = \"Text\";\n State[State[\"BeforeTagName\"] = 2] = \"BeforeTagName\";\n State[State[\"InTagName\"] = 3] = \"InTagName\";\n State[State[\"InSelfClosingTag\"] = 4] = \"InSelfClosingTag\";\n State[State[\"BeforeClosingTagName\"] = 5] = \"BeforeClosingTagName\";\n State[State[\"InClosingTagName\"] = 6] = \"InClosingTagName\";\n State[State[\"AfterClosingTagName\"] = 7] = \"AfterClosingTagName\";\n // Attributes\n State[State[\"BeforeAttributeName\"] = 8] = \"BeforeAttributeName\";\n State[State[\"InAttributeName\"] = 9] = \"InAttributeName\";\n State[State[\"AfterAttributeName\"] = 10] = \"AfterAttributeName\";\n State[State[\"BeforeAttributeValue\"] = 11] = \"BeforeAttributeValue\";\n State[State[\"InAttributeValueDq\"] = 12] = \"InAttributeValueDq\";\n State[State[\"InAttributeValueSq\"] = 13] = \"InAttributeValueSq\";\n State[State[\"InAttributeValueNq\"] = 14] = \"InAttributeValueNq\";\n // Declarations\n State[State[\"BeforeDeclaration\"] = 15] = \"BeforeDeclaration\";\n State[State[\"InDeclaration\"] = 16] = \"InDeclaration\";\n // Processing instructions\n State[State[\"InProcessingInstruction\"] = 17] = \"InProcessingInstruction\";\n // Comments & CDATA\n State[State[\"BeforeComment\"] = 18] = \"BeforeComment\";\n State[State[\"CDATASequence\"] = 19] = \"CDATASequence\";\n State[State[\"InSpecialComment\"] = 20] = \"InSpecialComment\";\n State[State[\"InCommentLike\"] = 21] = \"InCommentLike\";\n // Special tags\n State[State[\"BeforeSpecialS\"] = 22] = \"BeforeSpecialS\";\n State[State[\"BeforeSpecialT\"] = 23] = \"BeforeSpecialT\";\n State[State[\"SpecialStartSequence\"] = 24] = \"SpecialStartSequence\";\n State[State[\"InSpecialTag\"] = 25] = \"InSpecialTag\";\n State[State[\"InEntity\"] = 26] = \"InEntity\";\n})(State || (State = {}));\nfunction isWhitespace(c) {\n return (c === CharCodes.Space ||\n c === CharCodes.NewLine ||\n c === CharCodes.Tab ||\n c === CharCodes.FormFeed ||\n c === CharCodes.CarriageReturn);\n}\nfunction isEndOfTagSection(c) {\n return c === CharCodes.Slash || c === CharCodes.Gt || isWhitespace(c);\n}\nfunction isASCIIAlpha(c) {\n return ((c >= CharCodes.LowerA && c <= CharCodes.LowerZ) ||\n (c >= CharCodes.UpperA && c <= CharCodes.UpperZ));\n}\nexport var QuoteType;\n(function (QuoteType) {\n QuoteType[QuoteType[\"NoValue\"] = 0] = \"NoValue\";\n QuoteType[QuoteType[\"Unquoted\"] = 1] = \"Unquoted\";\n QuoteType[QuoteType[\"Single\"] = 2] = \"Single\";\n QuoteType[QuoteType[\"Double\"] = 3] = \"Double\";\n})(QuoteType || (QuoteType = {}));\n/**\n * Sequences used to match longer strings.\n *\n * We don't have `Script`, `Style`, or `Title` here. Instead, we re-use the *End\n * sequences with an increased offset.\n */\nconst Sequences = {\n Cdata: new Uint8Array([0x43, 0x44, 0x41, 0x54, 0x41, 0x5b]), // CDATA[\n CdataEnd: new Uint8Array([0x5d, 0x5d, 0x3e]), // ]]>\n CommentEnd: new Uint8Array([0x2d, 0x2d, 0x3e]), // `-->`\n ScriptEnd: new Uint8Array([0x3c, 0x2f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74]), // `</script`\n StyleEnd: new Uint8Array([0x3c, 0x2f, 0x73, 0x74, 0x79, 0x6c, 0x65]), // `</style`\n TitleEnd: new Uint8Array([0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65]), // `</title`\n TextareaEnd: new Uint8Array([\n 0x3c, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x61, 0x72, 0x65, 0x61,\n ]), // `</textarea`\n XmpEnd: new Uint8Array([0x3c, 0x2f, 0x78, 0x6d, 0x70]), // `</xmp`\n};\nexport default class Tokenizer {\n constructor({ xmlMode = false, decodeEntities = true, }, cbs) {\n this.cbs = cbs;\n /** The current state the tokenizer is in. */\n this.state = State.Text;\n /** The read buffer. */\n this.buffer = \"\";\n /** The beginning of the section that is currently being read. */\n this.sectionStart = 0;\n /** The index within the buffer that we are currently looking at. */\n this.index = 0;\n /** The start of the last entity. */\n this.entityStart = 0;\n /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */\n this.baseState = State.Text;\n /** For special parsing behavior inside of script and style tags. */\n this.isSpecial = false;\n /** Indicates whether the tokenizer has been paused. */\n this.running = true;\n /** The offset of the current buffer. */\n this.offset = 0;\n this.currentSequence = undefined;\n this.sequenceIndex = 0;\n this.xmlMode = xmlMode;\n this.decodeEntities = decodeEntities;\n this.entityDecoder = new EntityDecoder(xmlMode ? xmlDecodeTree : htmlDecodeTree, (cp, consumed) => this.emitCodePoint(cp, consumed));\n }\n reset() {\n this.state = State.Text;\n this.buffer = \"\";\n this.sectionStart = 0;\n this.index = 0;\n this.baseState = State.Text;\n this.currentSequence = undefined;\n this.running = true;\n this.offset = 0;\n }\n write(chunk) {\n this.offset += this.buffer.length;\n this.buffer = chunk;\n this.parse();\n }\n end() {\n if (this.running)\n this.finish();\n }\n pause() {\n this.running = false;\n }\n resume() {\n this.running = true;\n if (this.index < this.buffer.length + this.offset) {\n this.parse();\n }\n }\n stateText(c) {\n if (c === CharCodes.Lt ||\n (!this.decodeEntities && this.fastForwardTo(CharCodes.Lt))) {\n if (this.index > this.sectionStart) {\n this.cbs.ontext(this.sectionStart, this.index);\n }\n this.state = State.BeforeTagName;\n this.sectionStart = this.index;\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.startEntity();\n }\n }\n stateSpecialStartSequence(c) {\n const isEnd = this.sequenceIndex === this.currentSequence.length;\n const isMatch = isEnd\n ? // If we are at the end of the sequence, make sure the tag name has ended\n isEndOfTagSection(c)\n : // Otherwise, do a case-insensitive comparison\n (c | 0x20) === this.currentSequence[this.sequenceIndex];\n if (!isMatch) {\n this.isSpecial = false;\n }\n else if (!isEnd) {\n this.sequenceIndex++;\n return;\n }\n this.sequenceIndex = 0;\n this.state = State.InTagName;\n this.stateInTagName(c);\n }\n /** Look for an end tag. For <title> tags, also decode entities. */\n stateInSpecialTag(c) {\n if (this.sequenceIndex === this.currentSequence.length) {\n if (c === CharCodes.Gt || isWhitespace(c)) {\n const endOfText = this.index - this.currentSequence.length;\n if (this.sectionStart < endOfText) {\n // Spoof the index so that reported locations match up.\n const actualIndex = this.index;\n this.index = endOfText;\n this.cbs.ontext(this.sectionStart, endOfText);\n this.index = actualIndex;\n }\n this.isSpecial = false;\n this.sectionStart = endOfText + 2; // Skip over the `</`\n this.stateInClosingTagName(c);\n return; // We are done; skip the rest of the function.\n }\n this.sequenceIndex = 0;\n }\n if ((c | 0x20) === this.currentSequence[this.sequenceIndex]) {\n this.sequenceIndex += 1;\n }\n else if (this.sequenceIndex === 0) {\n if (this.currentSequence === Sequences.TitleEnd) {\n // We have to parse entities in <title> tags.\n if (this.decodeEntities && c === CharCodes.Amp) {\n this.startEntity();\n }\n }\n else if (this.fastForwardTo(CharCodes.Lt)) {\n // Outside of <title> tags, we can fast-forward.\n this.sequenceIndex = 1;\n }\n }\n else {\n // If we see a `<`, set the sequence index to 1; useful for eg. `<</script>`.\n this.sequenceIndex = Number(c === CharCodes.Lt);\n }\n }\n stateCDATASequence(c) {\n if (c === Sequences.Cdata[this.sequenceIndex]) {\n if (++this.sequenceIndex === Sequences.Cdata.length) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CdataEnd;\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n }\n }\n else {\n this.sequenceIndex = 0;\n this.state = State.InDeclaration;\n this.stateInDeclaration(c); // Reconsume the character\n }\n }\n /**\n * When we wait for one specific character, we can speed things up\n * by skipping through the buffer until we find it.\n *\n * @returns Whether the character was found.\n */\n fastForwardTo(c) {\n while (++this.index < this.buffer.length + this.offset) {\n if (this.buffer.charCodeAt(this.index - this.offset) === c) {\n return true;\n }\n }\n /*\n * We increment the index at the end of the `parse` loop,\n * so set it to `buffer.length - 1` here.\n *\n * TODO: Refactor `parse` to increment index before calling states.\n */\n this.index = this.buffer.length + this.offset - 1;\n return false;\n }\n /**\n * Comments and CDATA end with `-->` and `]]>`.\n *\n * Their common qualities are:\n * - Their end sequences have a distinct character they start with.\n * - That character is then repeated, so we have to check multiple repeats.\n * - All characters but the start character of the sequence can be skipped.\n */\n stateInCommentLike(c) {\n if (c === this.currentSequence[this.sequenceIndex]) {\n if (++this.sequenceIndex === this.currentSequence.length) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, this.index, 2);\n }\n else {\n this.cbs.oncomment(this.sectionStart, this.index, 2);\n }\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n this.state = State.Text;\n }\n }\n else if (this.sequenceIndex === 0) {\n // Fast-forward to the first character of the sequence\n if (this.fastForwardTo(this.currentSequence[0])) {\n this.sequenceIndex = 1;\n }\n }\n else if (c !== this.currentSequence[this.sequenceIndex - 1]) {\n // Allow long sequences, eg. --->, ]]]>\n this.sequenceIndex = 0;\n }\n }\n /**\n * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.\n *\n * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).\n * We allow anything that wouldn't end the tag.\n */\n isTagStartChar(c) {\n return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c);\n }\n startSpecial(sequence, offset) {\n this.isSpecial = true;\n this.currentSequence = sequence;\n this.sequenceIndex = offset;\n this.state = State.SpecialStartSequence;\n }\n stateBeforeTagName(c) {\n if (c === CharCodes.ExclamationMark) {\n this.state = State.BeforeDeclaration;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Questionmark) {\n this.state = State.InProcessingInstruction;\n this.sectionStart = this.index + 1;\n }\n else if (this.isTagStartChar(c)) {\n const lower = c | 0x20;\n this.sectionStart = this.index;\n if (this.xmlMode) {\n this.state = State.InTagName;\n }\n else if (lower === Sequences.ScriptEnd[2]) {\n this.state = State.BeforeSpecialS;\n }\n else if (lower === Sequences.TitleEnd[2] ||\n lower === Sequences.XmpEnd[2]) {\n this.state = State.BeforeSpecialT;\n }\n else {\n this.state = State.InTagName;\n }\n }\n else if (c === CharCodes.Slash) {\n this.state = State.BeforeClosingTagName;\n }\n else {\n this.state = State.Text;\n this.stateText(c);\n }\n }\n stateInTagName(c) {\n if (isEndOfTagSection(c)) {\n this.cbs.onopentagname(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n }\n stateBeforeClosingTagName(c) {\n if (isWhitespace(c)) {\n // Ignore\n }\n else if (c === CharCodes.Gt) {\n this.state = State.Text;\n }\n else {\n this.state = this.isTagStartChar(c)\n ? State.InClosingTagName\n : State.InSpecialComment;\n this.sectionStart = this.index;\n }\n }\n stateInClosingTagName(c) {\n if (c === CharCodes.Gt || isWhitespace(c)) {\n this.cbs.onclosetag(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.AfterClosingTagName;\n this.stateAfterClosingTagName(c);\n }\n }\n stateAfterClosingTagName(c) {\n // Skip everything until \">\"\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateBeforeAttributeName(c) {\n if (c === CharCodes.Gt) {\n this.cbs.onopentagend(this.index);\n if (this.isSpecial) {\n this.state = State.InSpecialTag;\n this.sequenceIndex = 0;\n }\n else {\n this.state = State.Text;\n }\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Slash) {\n this.state = State.InSelfClosingTag;\n }\n else if (!isWhitespace(c)) {\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n }\n stateInSelfClosingTag(c) {\n if (c === CharCodes.Gt) {\n this.cbs.onselfclosingtag(this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n this.isSpecial = false; // Reset special state, in case of self-closing special tags\n }\n else if (!isWhitespace(c)) {\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n }\n stateInAttributeName(c) {\n if (c === CharCodes.Eq || isEndOfTagSection(c)) {\n this.cbs.onattribname(this.sectionStart, this.index);\n this.sectionStart = this.index;\n this.state = State.AfterAttributeName;\n this.stateAfterAttributeName(c);\n }\n }\n stateAfterAttributeName(c) {\n if (c === CharCodes.Eq) {\n this.state = State.BeforeAttributeValue;\n }\n else if (c === CharCodes.Slash || c === CharCodes.Gt) {\n this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);\n this.sectionStart = -1;\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (!isWhitespace(c)) {\n this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n }\n stateBeforeAttributeValue(c) {\n if (c === CharCodes.DoubleQuote) {\n this.state = State.InAttributeValueDq;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.SingleQuote) {\n this.state = State.InAttributeValueSq;\n this.sectionStart = this.index + 1;\n }\n else if (!isWhitespace(c)) {\n this.sectionStart = this.index;\n this.state = State.InAttributeValueNq;\n this.stateInAttributeValueNoQuotes(c); // Reconsume token\n }\n }\n handleInAttributeValue(c, quote) {\n if (c === quote ||\n (!this.decodeEntities && this.fastForwardTo(quote))) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(quote === CharCodes.DoubleQuote\n ? QuoteType.Double\n : QuoteType.Single, this.index + 1);\n this.state = State.BeforeAttributeName;\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.startEntity();\n }\n }\n stateInAttributeValueDoubleQuotes(c) {\n this.handleInAttributeValue(c, CharCodes.DoubleQuote);\n }\n stateInAttributeValueSingleQuotes(c) {\n this.handleInAttributeValue(c, CharCodes.SingleQuote);\n }\n stateInAttributeValueNoQuotes(c) {\n if (isWhitespace(c) || c === CharCodes.Gt) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(QuoteType.Unquoted, this.index);\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.startEntity();\n }\n }\n stateBeforeDeclaration(c) {\n if (c === CharCodes.OpeningSquareBracket) {\n this.state = State.CDATASequence;\n this.sequenceIndex = 0;\n }\n else {\n this.state =\n c === CharCodes.Dash\n ? State.BeforeComment\n : State.InDeclaration;\n }\n }\n stateInDeclaration(c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.ondeclaration(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateInProcessingInstruction(c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.onprocessinginstruction(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateBeforeComment(c) {\n if (c === CharCodes.Dash) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CommentEnd;\n // Allow short comments (eg. <!-->)\n this.sequenceIndex = 2;\n this.sectionStart = this.index + 1;\n }\n else {\n this.state = State.InDeclaration;\n }\n }\n stateInSpecialComment(c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.oncomment(this.sectionStart, this.index, 0);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateBeforeSpecialS(c) {\n const lower = c | 0x20;\n if (lower === Sequences.ScriptEnd[3]) {\n this.startSpecial(Sequences.ScriptEnd, 4);\n }\n else if (lower === Sequences.StyleEnd[3]) {\n this.startSpecial(Sequences.StyleEnd, 4);\n }\n else {\n this.state = State.InTagName;\n this.stateInTagName(c); // Consume the token again\n }\n }\n stateBeforeSpecialT(c) {\n const lower = c | 0x20;\n switch (lower) {\n case Sequences.TitleEnd[3]: {\n this.startSpecial(Sequences.TitleEnd, 4);\n break;\n }\n case Sequences.TextareaEnd[3]: {\n this.startSpecial(Sequences.TextareaEnd, 4);\n break;\n }\n case Sequences.XmpEnd[3]: {\n this.startSpecial(Sequences.XmpEnd, 4);\n break;\n }\n default: {\n this.state = State.InTagName;\n this.stateInTagName(c); // Consume the token again\n }\n }\n }\n startEntity() {\n this.baseState = this.state;\n this.state = State.InEntity;\n this.entityStart = this.index;\n this.entityDecoder.startEntity(this.xmlMode\n ? DecodingMode.Strict\n : this.baseState === State.Text ||\n this.baseState === State.InSpecialTag\n ? DecodingMode.Legacy\n : DecodingMode.Attribute);\n }\n stateInEntity() {\n const length = this.entityDecoder.write(this.buffer, this.index - this.offset);\n // If `length` is positive, we are done with the entity.\n if (length >= 0) {\n this.state = this.baseState;\n if (length === 0) {\n this.index = this.entityStart;\n }\n }\n else {\n // Mark buffer as consumed.\n this.index = this.offset + this.buffer.length - 1;\n }\n }\n /**\n * Remove data that has already been consumed from the buffer.\n */\n cleanup() {\n // If we are inside of text or attributes, emit what we already have.\n if (this.running && this.sectionStart !== this.index) {\n if (this.state === State.Text ||\n (this.state === State.InSpecialTag && this.sequenceIndex === 0)) {\n this.cbs.ontext(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n else if (this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueNq) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n }\n }\n shouldContinue() {\n return this.index < this.buffer.length + this.offset && this.running;\n }\n /**\n * Iterates through the buffer, calling the function corresponding to the current state.\n *\n * States that are more likely to be hit are higher up, as a performance improvement.\n */\n parse() {\n while (this.shouldContinue()) {\n const c = this.buffer.charCodeAt(this.index - this.offset);\n switch (this.state) {\n case State.Text: {\n this.stateText(c);\n break;\n }\n case State.SpecialStartSequence: {\n this.stateSpecialStartSequence(c);\n break;\n }\n case State.InSpecialTag: {\n this.stateInSpecialTag(c);\n break;\n }\n case State.CDATASequence: {\n this.stateCDATASequence(c);\n break;\n }\n case State.InAttributeValueDq: {\n this.stateInAttributeValueDoubleQuotes(c);\n break;\n }\n case State.InAttributeName: {\n this.stateInAttributeName(c);\n break;\n }\n case State.InCommentLike: {\n this.stateInCommentLike(c);\n break;\n }\n case State.InSpecialComment: {\n this.stateInSpecialComment(c);\n break;\n }\n case State.BeforeAttributeName: {\n this.stateBeforeAttributeName(c);\n break;\n }\n case State.InTagName: {\n this.stateInTagName(c);\n break;\n }\n case State.InClosingTagName: {\n this.stateInClosingTagName(c);\n break;\n }\n case State.BeforeTagName: {\n this.stateBeforeTagName(c);\n break;\n }\n case State.AfterAttributeName: {\n this.stateAfterAttributeName(c);\n break;\n }\n case State.InAttributeValueSq: {\n this.stateInAttributeValueSingleQuotes(c);\n break;\n }\n case State.BeforeAttributeValue: {\n this.stateBeforeAttributeValue(c);\n break;\n }\n case State.BeforeClosingTagName: {\n this.stateBeforeClosingTagName(c);\n break;\n }\n case State.AfterClosingTagName: {\n this.stateAfterClosingTagName(c);\n break;\n }\n case State.BeforeSpecialS: {\n this.stateBeforeSpecialS(c);\n break;\n }\n case State.BeforeSpecialT: {\n this.stateBeforeSpecialT(c);\n break;\n }\n case State.InAttributeValueNq: {\n this.stateInAttributeValueNoQuotes(c);\n break;\n }\n case State.InSelfClosingTag: {\n this.stateInSelfClosingTag(c);\n break;\n }\n case State.InDeclaration: {\n this.stateInDeclaration(c);\n break;\n }\n case State.BeforeDeclaration: {\n this.stateBeforeDeclaration(c);\n break;\n }\n case State.BeforeComment: {\n this.stateBeforeComment(c);\n break;\n }\n case State.InProcessingInstruction: {\n this.stateInProcessingInstruction(c);\n break;\n }\n case State.InEntity: {\n this.stateInEntity();\n break;\n }\n }\n this.index++;\n }\n this.cleanup();\n }\n finish() {\n if (this.state === State.InEntity) {\n this.entityDecoder.end();\n this.state = this.baseState;\n }\n this.handleTrailingData();\n this.cbs.onend();\n }\n /** Handle any trailing data. */\n handleTrailingData() {\n const endIndex = this.buffer.length + this.offset;\n // If there is no remaining data, we are done.\n if (this.sectionStart >= endIndex) {\n return;\n }\n if (this.state === State.InCommentLike) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, endIndex, 0);\n }\n else {\n this.cbs.oncomment(this.sectionStart, endIndex, 0);\n }\n }\n else if (this.state === State.InTagName ||\n this.state === State.BeforeAttributeName ||\n this.state === State.BeforeAttributeValue ||\n this.state === State.AfterAttributeName ||\n this.state === State.InAttributeName ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueNq ||\n this.state === State.InClosingTagName) {\n /*\n * If we are currently in an opening or closing tag, us not calling the\n * respective callback signals that the tag should be ignored.\n */\n }\n else {\n this.cbs.ontext(this.sectionStart, endIndex);\n }\n }\n emitCodePoint(cp, consumed) {\n if (this.baseState !== State.Text &&\n this.baseState !== State.InSpecialTag) {\n if (this.sectionStart < this.entityStart) {\n this.cbs.onattribdata(this.sectionStart, this.entityStart);\n }\n this.sectionStart = this.entityStart + consumed;\n this.index = this.sectionStart - 1;\n this.cbs.onattribentity(cp);\n }\n else {\n if (this.sectionStart < this.entityStart) {\n this.cbs.ontext(this.sectionStart, this.entityStart);\n }\n this.sectionStart = this.entityStart + consumed;\n this.index = this.sectionStart - 1;\n this.cbs.ontextentity(cp, this.sectionStart);\n }\n }\n}\n//# sourceMappingURL=Tokenizer.js.map","import Tokenizer, { QuoteType } from \"./Tokenizer.js\";\nimport { fromCodePoint } from \"entities/decode\";\nconst formTags = new Set([\n \"input\",\n \"option\",\n \"optgroup\",\n \"select\",\n \"button\",\n \"datalist\",\n \"textarea\",\n]);\nconst pTag = new Set([\"p\"]);\nconst tableSectionTags = new Set([\"thead\", \"tbody\"]);\nconst ddtTags = new Set([\"dd\", \"dt\"]);\nconst rtpTags = new Set([\"rt\", \"rp\"]);\nconst openImpliesClose = new Map([\n [\"tr\", new Set([\"tr\", \"th\", \"td\"])],\n [\"th\", new Set([\"th\"])],\n [\"td\", new Set([\"thead\", \"th\", \"td\"])],\n [\"body\", new Set([\"head\", \"link\", \"script\"])],\n [\"li\", new Set([\"li\"])],\n [\"p\", pTag],\n [\"h1\", pTag],\n [\"h2\", pTag],\n [\"h3\", pTag],\n [\"h4\", pTag],\n [\"h5\", pTag],\n [\"h6\", pTag],\n [\"select\", formTags],\n [\"input\", formTags],\n [\"output\", formTags],\n [\"button\", formTags],\n [\"datalist\", formTags],\n [\"textarea\", formTags],\n [\"option\", new Set([\"option\"])],\n [\"optgroup\", new Set([\"optgroup\", \"option\"])],\n [\"dd\", ddtTags],\n [\"dt\", ddtTags],\n [\"address\", pTag],\n [\"article\", pTag],\n [\"aside\", pTag],\n [\"blockquote\", pTag],\n [\"details\", pTag],\n [\"div\", pTag],\n [\"dl\", pTag],\n [\"fieldset\", pTag],\n [\"figcaption\", pTag],\n [\"figure\", pTag],\n [\"footer\", pTag],\n [\"form\", pTag],\n [\"header\", pTag],\n [\"hr\", pTag],\n [\"main\", pTag],\n [\"nav\", pTag],\n [\"ol\", pTag],\n [\"pre\", pTag],\n [\"section\", pTag],\n [\"table\", pTag],\n [\"ul\", pTag],\n [\"rt\", rtpTags],\n [\"rp\", rtpTags],\n [\"tbody\", tableSectionTags],\n [\"tfoot\", tableSectionTags],\n]);\nconst voidElements = new Set([\n \"area\",\n \"base\",\n \"basefont\",\n \"br\",\n \"col\",\n \"command\",\n \"embed\",\n \"frame\",\n \"hr\",\n \"img\",\n \"input\",\n \"isindex\",\n \"keygen\",\n \"link\",\n \"meta\",\n \"param\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\nconst foreignContextElements = new Set([\"math\", \"svg\"]);\nconst htmlIntegrationElements = new Set([\n \"mi\",\n \"mo\",\n \"mn\",\n \"ms\",\n \"mtext\",\n \"annotation-xml\",\n \"foreignobject\",\n \"desc\",\n \"title\",\n]);\nconst reNameEnd = /\\s|\\//;\nexport class Parser {\n constructor(cbs, options = {}) {\n var _a, _b, _c, _d, _e, _f;\n this.options = options;\n /** The start index of the last event. */\n this.startIndex = 0;\n /** The end index of the last event. */\n this.endIndex = 0;\n /**\n * Store the start index of the current open tag,\n * so we can update the start index for attributes.\n */\n this.openTagStart = 0;\n this.tagname = \"\";\n this.attribname = \"\";\n this.attribvalue = \"\";\n this.attribs = null;\n this.stack = [];\n this.buffers = [];\n this.bufferOffset = 0;\n /** The index of the last written buffer. Used when resuming after a `pause()`. */\n this.writeIndex = 0;\n /** Indicates whether the parser has finished running / `.end` has been called. */\n this.ended = false;\n this.cbs = cbs !== null && cbs !== void 0 ? cbs : {};\n this.htmlMode = !this.options.xmlMode;\n this.lowerCaseTagNames = (_a = options.lowerCaseTags) !== null && _a !== void 0 ? _a : this.htmlMode;\n this.lowerCaseAttributeNames =\n (_b = options.lowerCaseAttributeNames) !== null && _b !== void 0 ? _b : this.htmlMode;\n this.recognizeSelfClosing =\n (_c = options.recognizeSelfClosing) !== null && _c !== void 0 ? _c : !this.htmlMode;\n this.tokenizer = new ((_d = options.Tokenizer) !== null && _d !== void 0 ? _d : Tokenizer)(this.options, this);\n this.foreignContext = [!this.htmlMode];\n (_f = (_e = this.cbs).onparserinit) === null || _f === void 0 ? void 0 : _f.call(_e, this);\n }\n // Tokenizer event handlers\n /** @internal */\n ontext(start, endIndex) {\n var _a, _b;\n const data = this.getSlice(start, endIndex);\n this.endIndex = endIndex - 1;\n (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, data);\n this.startIndex = endIndex;\n }\n /** @internal */\n ontextentity(cp, endIndex) {\n var _a, _b;\n this.endIndex = endIndex - 1;\n (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, fromCodePoint(cp));\n this.startIndex = endIndex;\n }\n /**\n * Checks if the current tag is a void element. Override this if you want\n * to specify your own additional void elements.\n */\n isVoidElement(name) {\n return this.htmlMode && voidElements.has(name);\n }\n /** @internal */\n onopentagname(start, endIndex) {\n this.endIndex = endIndex;\n let name = this.getSlice(start, endIndex);\n if (this.lowerCaseTagNames) {\n name = name.toLowerCase();\n }\n this.emitOpenTag(name);\n }\n emitOpenTag(name) {\n var _a, _b, _c, _d;\n this.openTagStart = this.startIndex;\n this.tagname = name;\n const impliesClose = this.htmlMode && openImpliesClose.get(name);\n if (impliesClose) {\n while (this.stack.length > 0 && impliesClose.has(this.stack[0])) {\n const element = this.stack.shift();\n (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, element, true);\n }\n }\n if (!this.isVoidElement(name)) {\n this.stack.unshift(name);\n if (this.htmlMode) {\n if (foreignContextElements.has(name)) {\n this.foreignContext.unshift(true);\n }\n else if (htmlIntegrationElements.has(name)) {\n this.foreignContext.unshift(false);\n }\n }\n }\n (_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, name);\n if (this.cbs.onopentag)\n this.attribs = {};\n }\n endOpenTag(isImplied) {\n var _a, _b;\n this.startIndex = this.openTagStart;\n if (this.attribs) {\n (_b = (_a = this.cbs).onopentag) === null || _b === void 0 ? void 0 : _b.call(_a, this.tagname, this.attribs, isImplied);\n this.attribs = null;\n }\n if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) {\n this.cbs.onclosetag(this.tagname, true);\n }\n this.tagname = \"\";\n }\n /** @internal */\n onopentagend(endIndex) {\n this.endIndex = endIndex;\n this.endOpenTag(false);\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onclosetag(start, endIndex) {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n this.endIndex = endIndex;\n let name = this.getSlice(start, endIndex);\n if (this.lowerCaseTagNames) {\n name = name.toLowerCase();\n }\n if (this.htmlMode &&\n (foreignContextElements.has(name) ||\n htmlIntegrationElements.has(name))) {\n this.foreignContext.shift();\n }\n if (!this.isVoidElement(name)) {\n const pos = this.stack.indexOf(name);\n if (pos !== -1) {\n for (let index = 0; index <= pos; index++) {\n const element = this.stack.shift();\n // We know the stack has sufficient elements.\n (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, element, index !== pos);\n }\n }\n else if (this.htmlMode && name === \"p\") {\n // Implicit open before close\n this.emitOpenTag(\"p\");\n this.closeCurrentTag(true);\n }\n }\n else if (this.htmlMode && name === \"br\") {\n // We can't use `emitOpenTag` for implicit open, as `br` would be implicitly closed.\n (_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, \"br\");\n (_f = (_e = this.cbs).onopentag) === null || _f === void 0 ? void 0 : _f.call(_e, \"br\", {}, true);\n (_h = (_g = this.cbs).onclosetag) === null || _h === void 0 ? void 0 : _h.call(_g, \"br\", false);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onselfclosingtag(endIndex) {\n this.endIndex = endIndex;\n if (this.recognizeSelfClosing || this.foreignContext[0]) {\n this.closeCurrentTag(false);\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n else {\n // Ignore the fact that the tag is self-closing.\n this.onopentagend(endIndex);\n }\n }\n closeCurrentTag(isOpenImplied) {\n var _a, _b;\n const name = this.tagname;\n this.endOpenTag(isOpenImplied);\n // Self-closing tags will be on the top of the stack\n if (this.stack[0] === name) {\n // If the opening tag isn't implied, the closing tag has to be implied.\n (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, name, !isOpenImplied);\n this.stack.shift();\n }\n }\n /** @internal */\n onattribname(start, endIndex) {\n this.startIndex = start;\n const name = this.getSlice(start, endIndex);\n this.attribname = this.lowerCaseAttributeNames\n ? name.toLowerCase()\n : name;\n }\n /** @internal */\n onattribdata(start, endIndex) {\n this.attribvalue += this.getSlice(start, endIndex);\n }\n /** @internal */\n onattribentity(cp) {\n this.attribvalue += fromCodePoint(cp);\n }\n /** @internal */\n onattribend(quote, endIndex) {\n var _a, _b;\n this.endIndex = endIndex;\n (_b = (_a = this.cbs).onattribute) === null || _b === void 0 ? void 0 : _b.call(_a, this.attribname, this.attribvalue, quote === QuoteType.Double\n ? '\"'\n : quote === QuoteType.Single\n ? \"'\"\n : quote === QuoteType.NoValue\n ? undefined\n : null);\n if (this.attribs &&\n !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) {\n this.attribs[this.attribname] = this.attribvalue;\n }\n this.attribvalue = \"\";\n }\n getInstructionName(value) {\n const index = value.search(reNameEnd);\n let name = index < 0 ? value : value.substr(0, index);\n if (this.lowerCaseTagNames) {\n name = name.toLowerCase();\n }\n return name;\n }\n /** @internal */\n ondeclaration(start, endIndex) {\n this.endIndex = endIndex;\n const value = this.getSlice(start, endIndex);\n if (this.cbs.onprocessinginstruction) {\n const name = this.getInstructionName(value);\n this.cbs.onprocessinginstruction(`!${name}`, `!${value}`);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onprocessinginstruction(start, endIndex) {\n this.endIndex = endIndex;\n const value = this.getSlice(start, endIndex);\n if (this.cbs.onprocessinginstruction) {\n const name = this.getInstructionName(value);\n this.cbs.onprocessinginstruction(`?${name}`, `?${value}`);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n oncomment(start, endIndex, offset) {\n var _a, _b, _c, _d;\n this.endIndex = endIndex;\n (_b = (_a = this.cbs).oncomment) === null || _b === void 0 ? void 0 : _b.call(_a, this.getSlice(start, endIndex - offset));\n (_d = (_c = this.cbs).oncommentend) === null || _d === void 0 ? void 0 : _d.call(_c);\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n oncdata(start, endIndex, offset) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;\n this.endIndex = endIndex;\n const value = this.getSlice(start, endIndex - offset);\n if (!this.htmlMode || this.options.recognizeCDATA) {\n (_b = (_a = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a);\n (_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value);\n (_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e);\n }\n else {\n (_h = (_g = this.cbs).oncomment) === null || _h === void 0 ? void 0 : _h.call(_g, `[CDATA[${value}]]`);\n (_k = (_j = this.cbs).oncommentend) === null || _k === void 0 ? void 0 : _k.call(_j);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onend() {\n var _a, _b;\n if (this.cbs.onclosetag) {\n // Set the end index for all remaining tags\n this.endIndex = this.startIndex;\n for (let index = 0; index < this.stack.length; index++) {\n this.cbs.onclosetag(this.stack[index], true);\n }\n }\n (_b = (_a = this.cbs).onend) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n /**\n * Resets the parser to a blank state, ready to parse a new HTML document\n */\n reset() {\n var _a, _b, _c, _d;\n (_b = (_a = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a);\n this.tokenizer.reset();\n this.tagname = \"\";\n this.attribname = \"\";\n this.attribs = null;\n this.stack.length = 0;\n this.startIndex = 0;\n this.endIndex = 0;\n (_d = (_c = this.cbs).onparserinit) === null || _d === void 0 ? void 0 : _d.call(_c, this);\n this.buffers.length = 0;\n this.foreignContext.length = 0;\n this.foreignContext.unshift(!this.htmlMode);\n this.bufferOffset = 0;\n this.writeIndex = 0;\n this.ended = false;\n }\n /**\n * Resets the parser, then parses a complete document and\n * pushes it to the handler.\n *\n * @param data Document to parse.\n */\n parseComplete(data) {\n this.reset();\n this.end(data);\n }\n getSlice(start, end) {\n while (start - this.bufferOffset >= this.buffers[0].length) {\n this.shiftBuffer();\n }\n let slice = this.buffers[0].slice(start - this.bufferOffset, end - this.bufferOffset);\n while (end - this.bufferOffset > this.buffers[0].length) {\n this.shiftBuffer();\n slice += this.buffers[0].slice(0, end - this.bufferOffset);\n }\n return slice;\n }\n shiftBuffer() {\n this.bufferOffset += this.buffers[0].length;\n this.writeIndex--;\n this.buffers.shift();\n }\n /**\n * Parses a chunk of data and calls the corresponding callbacks.\n *\n * @param chunk Chunk to parse.\n */\n write(chunk) {\n var _a, _b;\n if (this.ended) {\n (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, new Error(\".write() after done!\"));\n return;\n }\n this.buffers.push(chunk);\n if (this.tokenizer.running) {\n this.tokenizer.write(chunk);\n this.writeIndex++;\n }\n }\n /**\n * Parses the end of the buffer and clears the stack, calls onend.\n *\n * @param chunk Optional final chunk to parse.\n */\n end(chunk) {\n var _a, _b;\n if (this.ended) {\n (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, new Error(\".end() after done!\"));\n return;\n }\n if (chunk)\n this.write(chunk);\n this.ended = true;\n this.tokenizer.end();\n }\n /**\n * Pauses parsing. The parser won't emit events until `resume` is called.\n */\n pause() {\n this.tokenizer.pause();\n }\n /**\n * Resumes parsing after `pause` was called.\n */\n resume() {\n this.tokenizer.resume();\n while (this.tokenizer.running &&\n this.writeIndex < this.buffers.length) {\n this.tokenizer.write(this.buffers[this.writeIndex++]);\n }\n if (this.ended)\n this.tokenizer.end();\n }\n /**\n * Alias of `write`, for backwards compatibility.\n *\n * @param chunk Chunk to parse.\n * @deprecated\n */\n parseChunk(chunk) {\n this.write(chunk);\n }\n /**\n * Alias of `end`, for backwards compatibility.\n *\n * @param chunk Optional final chunk to parse.\n * @deprecated\n */\n done(chunk) {\n this.end(chunk);\n }\n}\n//# sourceMappingURL=Parser.js.map","/** Types of elements found in htmlparser2's DOM */\nexport var ElementType;\n(function (ElementType) {\n /** Type for the root element of a document */\n ElementType[\"Root\"] = \"root\";\n /** Type for Text */\n ElementType[\"Text\"] = \"text\";\n /** Type for <? ... ?> */\n ElementType[\"Directive\"] = \"directive\";\n /** Type for <!-- ... --> */\n ElementType[\"Comment\"] = \"comment\";\n /** Type for <script> tags */\n ElementType[\"Script\"] = \"script\";\n /** Type for <style> tags */\n ElementType[\"Style\"] = \"style\";\n /** Type for Any tag */\n ElementType[\"Tag\"] = \"tag\";\n /** Type for <![CDATA[ ... ]]> */\n ElementType[\"CDATA\"] = \"cdata\";\n /** Type for <!doctype ...> */\n ElementType[\"Doctype\"] = \"doctype\";\n})(ElementType || (ElementType = {}));\n/**\n * Tests whether an element is a tag or not.\n *\n * @param elem Element to test\n */\nexport function isTag(elem) {\n return (elem.type === ElementType.Tag ||\n elem.type === ElementType.Script ||\n elem.type === ElementType.Style);\n}\n// Exports for backwards compatibility\n/** Type for the root element of a document */\nexport const Root = ElementType.Root;\n/** Type for Text */\nexport const Text = ElementType.Text;\n/** Type for <? ... ?> */\nexport const Directive = ElementType.Directive;\n/** Type for <!-- ... --> */\nexport const Comment = ElementType.Comment;\n/** Type for <script> tags */\nexport const Script = ElementType.Script;\n/** Type for <style> tags */\nexport const Style = ElementType.Style;\n/** Type for Any tag */\nexport const Tag = ElementType.Tag;\n/** Type for <![CDATA[ ... ]]> */\nexport const CDATA = ElementType.CDATA;\n/** Type for <!doctype ...> */\nexport const Doctype = ElementType.Doctype;\n","import { ElementType, isTag as isTagRaw } from \"domelementtype\";\n/**\n * This object will be used as the prototype for Nodes when creating a\n * DOM-Level-1-compliant structure.\n */\nexport class Node {\n constructor() {\n /** Parent of the node */\n this.parent = null;\n /** Previous sibling */\n this.prev = null;\n /** Next sibling */\n this.next = null;\n /** The start index of the node. Requires `withStartIndices` on the handler to be `true. */\n this.startIndex = null;\n /** The end index of the node. Requires `withEndIndices` on the handler to be `true. */\n this.endIndex = null;\n }\n // Read-write aliases for properties\n /**\n * Same as {@link parent}.\n * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.\n */\n get parentNode() {\n return this.parent;\n }\n set parentNode(parent) {\n this.parent = parent;\n }\n /**\n * Same as {@link prev}.\n * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.\n */\n get previousSibling() {\n return this.prev;\n }\n set previousSibling(prev) {\n this.prev = prev;\n }\n /**\n * Same as {@link next}.\n * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.\n */\n get nextSibling() {\n return this.next;\n }\n set nextSibling(next) {\n this.next = next;\n }\n /**\n * Clone this node, and optionally its children.\n *\n * @param recursive Clone child nodes as well.\n * @returns A clone of the node.\n */\n cloneNode(recursive = false) {\n return cloneNode(this, recursive);\n }\n}\n/**\n * A node that contains some data.\n */\nexport class DataNode extends Node {\n /**\n * @param data The content of the data node\n */\n constructor(data) {\n super();\n this.data = data;\n }\n /**\n * Same as {@link data}.\n * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.\n */\n get nodeValue() {\n return this.data;\n }\n set nodeValue(data) {\n this.data = data;\n }\n}\n/**\n * Text within the document.\n */\nexport class Text extends DataNode {\n constructor() {\n super(...arguments);\n this.type = ElementType.Text;\n }\n get nodeType() {\n return 3;\n }\n}\n/**\n * Comments within the document.\n */\nexport class Comment extends DataNode {\n constructor() {\n super(...arguments);\n this.type = ElementType.Comment;\n }\n get nodeType() {\n return 8;\n }\n}\n/**\n * Processing instructions, including doc types.\n */\nexport class ProcessingInstruction extends DataNode {\n constructor(name, data) {\n super(data);\n this.name = name;\n this.type = ElementType.Directive;\n }\n get nodeType() {\n return 1;\n }\n}\n/**\n * A `Node` that can have children.\n */\nexport class NodeWithChildren extends Node {\n /**\n * @param children Children of the node. Only certain node types can have children.\n */\n constructor(children) {\n super();\n this.children = children;\n }\n // Aliases\n /** First child of the node. */\n get firstChild() {\n var _a;\n return (_a = this.children[0]) !== null && _a !== void 0 ? _a : null;\n }\n /** Last child of the node. */\n get lastChild() {\n return this.children.length > 0\n ? this.children[this.children.length - 1]\n : null;\n }\n /**\n * Same as {@link children}.\n * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.\n */\n get childNodes() {\n return this.children;\n }\n set childNodes(children) {\n this.children = children;\n }\n}\nexport class CDATA extends NodeWithChildren {\n constructor() {\n super(...arguments);\n this.type = ElementType.CDATA;\n }\n get nodeType() {\n return 4;\n }\n}\n/**\n * The root node of the document.\n */\nexport class Document extends NodeWithChildren {\n constructor() {\n super(...arguments);\n this.type = ElementType.Root;\n }\n get nodeType() {\n return 9;\n }\n}\n/**\n * An element within the DOM.\n */\nexport class Element extends NodeWithChildren {\n /**\n * @param name Name of the tag, eg. `div`, `span`.\n * @param attribs Object mapping attribute names to attribute values.\n * @param children Children of the node.\n */\n constructor(name, attribs, children = [], type = name === \"script\"\n ? ElementType.Script\n : name === \"style\"\n ? ElementType.Style\n : ElementType.Tag) {\n super(children);\n this.name = name;\n this.attribs = attribs;\n this.type = type;\n }\n get nodeType() {\n return 1;\n }\n // DOM Level 1 aliases\n /**\n * Same as {@link name}.\n * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.\n */\n get tagName() {\n return this.name;\n }\n set tagName(name) {\n this.name = name;\n }\n get attributes() {\n return Object.keys(this.attribs).map((name) => {\n var _a, _b;\n return ({\n name,\n value: this.attribs[name],\n namespace: (_a = this[\"x-attribsNamespace\"]) === null || _a === void 0 ? void 0 : _a[name],\n prefix: (_b = this[\"x-attribsPrefix\"]) === null || _b === void 0 ? void 0 : _b[name],\n });\n });\n }\n}\n/**\n * @param node Node to check.\n * @returns `true` if the node is a `Element`, `false` otherwise.\n */\nexport function isTag(node) {\n return isTagRaw(node);\n}\n/**\n * @param node Node to check.\n * @returns `true` if the node has the type `CDATA`, `false` otherwise.\n */\nexport function isCDATA(node) {\n return node.type === ElementType.CDATA;\n}\n/**\n * @param node Node to check.\n * @returns `true` if the node has the type `Text`, `false` otherwise.\n */\nexport function isText(node) {\n return node.type === ElementType.Text;\n}\n/**\n * @param node Node to check.\n * @returns `true` if the node has the type `Comment`, `false` otherwise.\n */\nexport function isComment(node) {\n return node.type === ElementType.Comment;\n}\n/**\n * @param node Node to check.\n * @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.\n */\nexport function isDirective(node) {\n return node.type === ElementType.Directive;\n}\n/**\n * @param node Node to check.\n * @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.\n */\nexport function isDocument(node) {\n return node.type === ElementType.Root;\n}\n/**\n * @param node Node to check.\n * @returns `true` if the node has children, `false` otherwise.\n */\nexport function hasChildren(node) {\n return Object.prototype.hasOwnProperty.call(node, \"children\");\n}\n/**\n * Clone a node, and optionally its children.\n *\n * @param recursive Clone child nodes as well.\n * @returns A clone of the node.\n */\nexport function cloneNode(node, recursive = false) {\n let result;\n if (isText(node)) {\n result = new Text(node.data);\n }\n else if (isComment(node)) {\n result = new Comment(node.data);\n }\n else if (isTag(node)) {\n const children = recursive ? cloneChildren(node.children) : [];\n const clone = new Element(node.name, { ...node.attribs }, children);\n children.forEach((child) => (child.parent = clone));\n if (node.namespace != null) {\n clone.namespace = node.namespace;\n }\n if (node[\"x-attribsNamespace\"]) {\n clone[\"x-attribsNamespace\"] = { ...node[\"x-attribsNamespace\"] };\n }\n if (node[\"x-attribsPrefix\"]) {\n clone[\"x-attribsPrefix\"] = { ...node[\"x-attribsPrefix\"] };\n }\n result = clone;\n }\n else if (isCDATA(node)) {\n const children = recursive ? cloneChildren(node.children) : [];\n const clone = new CDATA(children);\n children.forEach((child) => (child.parent = clone));\n result = clone;\n }\n else if (isDocument(node)) {\n const children = recursive ? cloneChildren(node.children) : [];\n const clone = new Document(children);\n children.forEach((child) => (child.parent = clone));\n if (node[\"x-mode\"]) {\n clone[\"x-mode\"] = node[\"x-mode\"];\n }\n result = clone;\n }\n else if (isDirective(node)) {\n const instruction = new ProcessingInstruction(node.name, node.data);\n if (node[\"x-name\"] != null) {\n instruction[\"x-name\"] = node[\"x-name\"];\n instruction[\"x-publicId\"] = node[\"x-publicId\"];\n instruction[\"x-systemId\"] = node[\"x-systemId\"];\n }\n result = instruction;\n }\n else {\n throw new Error(`Not implemented yet: ${node.type}`);\n }\n result.startIndex = node.startIndex;\n result.endIndex = node.endIndex;\n if (node.sourceCodeLocation != null) {\n result.sourceCodeLocation = node.sourceCodeLocation;\n }\n return result;\n}\nfunction cloneChildren(childs) {\n const children = childs.map((child) => cloneNode(child, true));\n for (let i = 1; i < children.length; i++) {\n children[i].prev = children[i - 1];\n children[i - 1].next = children[i];\n }\n return children;\n}\n","import { ElementType } from \"domelementtype\";\nimport { Element, Text, Comment, CDATA, Document, ProcessingInstruction, } from \"./node.js\";\nexport * from \"./node.js\";\n// Default options\nconst defaultOpts = {\n withStartIndices: false,\n withEndIndices: false,\n xmlMode: false,\n};\nexport class DomHandler {\n /**\n * @param callback Called once parsing has completed.\n * @param options Settings for the handler.\n * @param elementCB Callback whenever a tag is closed.\n */\n constructor(callback, options, elementCB) {\n /** The elements of the DOM */\n this.dom = [];\n /** The root element for the DOM */\n this.root = new Document(this.dom);\n /** Indicated whether parsing has been completed. */\n this.done = false;\n /** Stack of open tags. */\n this.tagStack = [this.root];\n /** A data node that is still being written to. */\n this.lastNode = null;\n /** Reference to the parser instance. Used for location information. */\n this.parser = null;\n // Make it possible to skip arguments, for backwards-compatibility\n if (typeof options === \"function\") {\n elementCB = options;\n options = defaultOpts;\n }\n if (typeof callback === \"object\") {\n options = callback;\n callback = undefined;\n }\n this.callback = callback !== null && callback !== void 0 ? callback : null;\n this.options = options !== null && options !== void 0 ? options : defaultOpts;\n this.elementCB = elementCB !== null && elementCB !== void 0 ? elementCB : null;\n }\n onparserinit(parser) {\n this.parser = parser;\n }\n // Resets the handler back to starting state\n onreset() {\n this.dom = [];\n this.root = new Document(this.dom);\n this.done = false;\n this.tagStack = [this.root];\n this.lastNode = null;\n this.parser = null;\n }\n // Signals the handler that parsing is done\n onend() {\n if (this.done)\n return;\n this.done = true;\n this.parser = null;\n this.handleCallback(null);\n }\n onerror(error) {\n this.handleCallback(error);\n }\n onclosetag() {\n this.lastNode = null;\n const elem = this.tagStack.pop();\n if (this.options.withEndIndices) {\n elem.endIndex = this.parser.endIndex;\n }\n if (this.elementCB)\n this.elementCB(elem);\n }\n onopentag(name, attribs) {\n const type = this.options.xmlMode ? ElementType.Tag : undefined;\n const element = new Element(name, attribs, undefined, type);\n this.addNode(element);\n this.tagStack.push(element);\n }\n ontext(data) {\n const { lastNode } = this;\n if (lastNode && lastNode.type === ElementType.Text) {\n lastNode.data += data;\n if (this.options.withEndIndices) {\n lastNode.endIndex = this.parser.endIndex;\n }\n }\n else {\n const node = new Text(data);\n this.addNode(node);\n this.lastNode = node;\n }\n }\n oncomment(data) {\n if (this.lastNode && this.lastNode.type === ElementType.Comment) {\n this.lastNode.data += data;\n return;\n }\n const node = new Comment(data);\n this.addNode(node);\n this.lastNode = node;\n }\n oncommentend() {\n this.lastNode = null;\n }\n oncdatastart() {\n const text = new Text(\"\");\n const node = new CDATA([text]);\n this.addNode(node);\n text.parent = node;\n this.lastNode = text;\n }\n oncdataend() {\n this.lastNode = null;\n }\n onprocessinginstruction(name, data) {\n const node = new ProcessingInstruction(name, data);\n this.addNode(node);\n }\n handleCallback(error) {\n if (typeof this.callback === \"function\") {\n this.callback(error, this.dom);\n }\n else if (error) {\n throw error;\n }\n }\n addNode(node) {\n const parent = this.tagStack[this.tagStack.length - 1];\n const previousSibling = parent.children[parent.children.length - 1];\n if (this.options.withStartIndices) {\n node.startIndex = this.parser.startIndex;\n }\n if (this.options.withEndIndices) {\n node.endIndex = this.parser.endIndex;\n }\n parent.children.push(node);\n if (previousSibling) {\n node.prev = previousSibling;\n previousSibling.next = node;\n }\n node.parent = parent;\n this.lastNode = null;\n }\n}\nexport default DomHandler;\n","export const xmlReplacer = /[\"&'<>$\\x80-\\uFFFF]/g;\nconst xmlCodeMap = new Map([\n [34, \""\"],\n [38, \"&\"],\n [39, \"'\"],\n [60, \"<\"],\n [62, \">\"],\n]);\n// For compatibility with node < 4, we wrap `codePointAt`\nexport const getCodePoint = \n// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\nString.prototype.codePointAt != null\n ? (str, index) => str.codePointAt(index)\n : // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\n (c, index) => (c.charCodeAt(index) & 0xfc00) === 0xd800\n ? (c.charCodeAt(index) - 0xd800) * 0x400 +\n c.charCodeAt(index + 1) -\n 0xdc00 +\n 0x10000\n : c.charCodeAt(index);\n/**\n * Encodes all non-ASCII characters, as well as characters not valid in XML\n * documents using XML entities.\n *\n * If a character has no equivalent entity, a\n * numeric hexadecimal reference (eg. `ü`) will be used.\n */\nexport function encodeXML(str) {\n let ret = \"\";\n let lastIdx = 0;\n let match;\n while ((match = xmlReplacer.exec(str)) !== null) {\n const i = match.index;\n const char = str.charCodeAt(i);\n const next = xmlCodeMap.get(char);\n if (next !== undefined) {\n ret += str.substring(lastIdx, i) + next;\n lastIdx = i + 1;\n }\n else {\n ret += `${str.substring(lastIdx, i)}&#x${getCodePoint(str, i).toString(16)};`;\n // Increase by 1 if we have a surrogate pair\n lastIdx = xmlReplacer.lastIndex += Number((char & 0xfc00) === 0xd800);\n }\n }\n return ret + str.substr(lastIdx);\n}\n/**\n * Encodes all non-ASCII characters, as well as characters not valid in XML\n * documents using numeric hexadecimal reference (eg. `ü`).\n *\n * Have a look at `escapeUTF8` if you want a more concise output at the expense\n * of reduced transportability.\n *\n * @param data String to escape.\n */\nexport const escape = encodeXML;\n/**\n * Creates a function that escapes all characters matched by the given regular\n * expression using the given map of characters to escape to their entities.\n *\n * @param regex Regular expression to match characters to escape.\n * @param map Map of characters to escape to their entities.\n *\n * @returns Function that escapes all characters matched by the given regular\n * expression using the given map of characters to escape to their entities.\n */\nfunction getEscaper(regex, map) {\n return function escape(data) {\n let match;\n let lastIdx = 0;\n let result = \"\";\n while ((match = regex.exec(data))) {\n if (lastIdx !== match.index) {\n result += data.substring(lastIdx, match.index);\n }\n // We know that this character will be in the map.\n result += map.get(match[0].charCodeAt(0));\n // Every match will be of length 1\n lastIdx = match.index + 1;\n }\n return result + data.substring(lastIdx);\n };\n}\n/**\n * Encodes all characters not valid in XML documents using XML entities.\n *\n * Note that the output will be character-set dependent.\n *\n * @param data String to escape.\n */\nexport const escapeUTF8 = getEscaper(/[&<>'\"]/g, xmlCodeMap);\n/**\n * Encodes all characters that have to be escaped in HTML attributes,\n * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.\n *\n * @param data String to escape.\n */\nexport const escapeAttribute = getEscaper(/[\"&\\u00A0]/g, new Map([\n [34, \""\"],\n [38, \"&\"],\n [160, \" \"],\n]));\n/**\n * Encodes all characters that have to be escaped in HTML text,\n * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}.\n *\n * @param data String to escape.\n */\nexport const escapeText = getEscaper(/[&<>\\u00A0]/g, new Map([\n [38, \"&\"],\n [60, \"<\"],\n [62, \">\"],\n [160, \" \"],\n]));\n//# sourceMappingURL=escape.js.map","export const elementNames = new Map([\n \"altGlyph\",\n \"altGlyphDef\",\n \"altGlyphItem\",\n \"animateColor\",\n \"animateMotion\",\n \"animateTransform\",\n \"clipPath\",\n \"feBlend\",\n \"feColorMatrix\",\n \"feComponentTransfer\",\n \"feComposite\",\n \"feConvolveMatrix\",\n \"feDiffuseLighting\",\n \"feDisplacementMap\",\n \"feDistantLight\",\n \"feDropShadow\",\n \"feFlood\",\n \"feFuncA\",\n \"feFuncB\",\n \"feFuncG\",\n \"feFuncR\",\n \"feGaussianBlur\",\n \"feImage\",\n \"feMerge\",\n \"feMergeNode\",\n \"feMorphology\",\n \"feOffset\",\n \"fePointLight\",\n \"feSpecularLighting\",\n \"feSpotLight\",\n \"feTile\",\n \"feTurbulence\",\n \"foreignObject\",\n \"glyphRef\",\n \"linearGradient\",\n \"radialGradient\",\n \"textPath\",\n].map((val) => [val.toLowerCase(), val]));\nexport const attributeNames = new Map([\n \"definitionURL\",\n \"attributeName\",\n \"attributeType\",\n \"baseFrequency\",\n \"baseProfile\",\n \"calcMode\",\n \"clipPathUnits\",\n \"diffuseConstant\",\n \"edgeMode\",\n \"filterUnits\",\n \"glyphRef\",\n \"gradientTransform\",\n \"gradientUnits\",\n \"kernelMatrix\",\n \"kernelUnitLength\",\n \"keyPoints\",\n \"keySplines\",\n \"keyTimes\",\n \"lengthAdjust\",\n \"limitingConeAngle\",\n \"markerHeight\",\n \"markerUnits\",\n \"markerWidth\",\n \"maskContentUnits\",\n \"maskUnits\",\n \"numOctaves\",\n \"pathLength\",\n \"patternContentUnits\",\n \"patternTransform\",\n \"patternUnits\",\n \"pointsAtX\",\n \"pointsAtY\",\n \"pointsAtZ\",\n \"preserveAlpha\",\n \"preserveAspectRatio\",\n \"primitiveUnits\",\n \"refX\",\n \"refY\",\n \"repeatCount\",\n \"repeatDur\",\n \"requiredExtensions\",\n \"requiredFeatures\",\n \"specularConstant\",\n \"specularExponent\",\n \"spreadMethod\",\n \"startOffset\",\n \"stdDeviation\",\n \"stitchTiles\",\n \"surfaceScale\",\n \"systemLanguage\",\n \"tableValues\",\n \"targetX\",\n \"targetY\",\n \"textLength\",\n \"viewBox\",\n \"viewTarget\",\n \"xChannelSelector\",\n \"yChannelSelector\",\n \"zoomAndPan\",\n].map((val) => [val.toLowerCase(), val]));\n","/*\n * Module dependencies\n */\nimport * as ElementType from \"domelementtype\";\nimport { encodeXML, escapeAttribute, escapeText } from \"entities\";\n/**\n * Mixed-case SVG and MathML tags & attributes\n * recognized by the HTML parser.\n *\n * @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign\n */\nimport { elementNames, attributeNames } from \"./foreignNames.js\";\nconst unencodedElements = new Set([\n \"style\",\n \"script\",\n \"xmp\",\n \"iframe\",\n \"noembed\",\n \"noframes\",\n \"plaintext\",\n \"noscript\",\n]);\nfunction replaceQuotes(value) {\n return value.replace(/\"/g, \""\");\n}\n/**\n * Format attributes\n */\nfunction formatAttributes(attributes, opts) {\n var _a;\n if (!attributes)\n return;\n const encode = ((_a = opts.encodeEntities) !== null && _a !== void 0 ? _a : opts.decodeEntities) === false\n ? replaceQuotes\n : opts.xmlMode || opts.encodeEntities !== \"utf8\"\n ? encodeXML\n : escapeAttribute;\n return Object.keys(attributes)\n .map((key) => {\n var _a, _b;\n const value = (_a = attributes[key]) !== null && _a !== void 0 ? _a : \"\";\n if (opts.xmlMode === \"foreign\") {\n /* Fix up mixed-case attribute names */\n key = (_b = attributeNames.get(key)) !== null && _b !== void 0 ? _b : key;\n }\n if (!opts.emptyAttrs && !opts.xmlMode && value === \"\") {\n return key;\n }\n return `${key}=\"${encode(value)}\"`;\n })\n .join(\" \");\n}\n/**\n * Self-enclosing tags\n */\nconst singleTag = new Set([\n \"area\",\n \"base\",\n \"basefont\",\n \"br\",\n \"col\",\n \"command\",\n \"embed\",\n \"frame\",\n \"hr\",\n \"img\",\n \"input\",\n \"isindex\",\n \"keygen\",\n \"link\",\n \"meta\",\n \"param\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\n/**\n * Renders a DOM node or an array of DOM nodes to a string.\n *\n * Can be thought of as the equivalent of the `outerHTML` of the passed node(s).\n *\n * @param node Node to be rendered.\n * @param options Changes serialization behavior\n */\nexport function render(node, options = {}) {\n const nodes = \"length\" in node ? node : [node];\n let output = \"\";\n for (let i = 0; i < nodes.length; i++) {\n output += renderNode(nodes[i], options);\n }\n return output;\n}\nexport default render;\nfunction renderNode(node, options) {\n switch (node.type) {\n case ElementType.Root:\n return render(node.children, options);\n // @ts-expect-error We don't use `Doctype` yet\n case ElementType.Doctype:\n case ElementType.Directive:\n return renderDirective(node);\n case ElementType.Comment:\n return renderComment(node);\n case ElementType.CDATA:\n return renderCdata(node);\n case ElementType.Script:\n case ElementType.Style:\n case ElementType.Tag:\n return renderTag(node, options);\n case ElementType.Text:\n return renderText(node, options);\n }\n}\nconst foreignModeIntegrationPoints = new Set([\n \"mi\",\n \"mo\",\n \"mn\",\n \"ms\",\n \"mtext\",\n \"annotation-xml\",\n \"foreignObject\",\n \"desc\",\n \"title\",\n]);\nconst foreignElements = new Set([\"svg\", \"math\"]);\nfunction renderTag(elem, opts) {\n var _a;\n // Handle SVG / MathML in HTML\n if (opts.xmlMode === \"foreign\") {\n /* Fix up mixed-case element names */\n elem.name = (_a = elementNames.get(elem.name)) !== null && _a !== void 0 ? _a : elem.name;\n /* Exit foreign mode at integration points */\n if (elem.parent &&\n foreignModeIntegrationPoints.has(elem.parent.name)) {\n opts = { ...opts, xmlMode: false };\n }\n }\n if (!opts.xmlMode && foreignElements.has(elem.name)) {\n opts = { ...opts, xmlMode: \"foreign\" };\n }\n let tag = `<${elem.name}`;\n const attribs = formatAttributes(elem.attribs, opts);\n if (attribs) {\n tag += ` ${attribs}`;\n }\n if (elem.children.length === 0 &&\n (opts.xmlMode\n ? // In XML mode or foreign mode, and user hasn't explicitly turned off self-closing tags\n opts.selfClosingTags !== false\n : // User explicitly asked for self-closing tags, even in HTML mode\n opts.selfClosingTags && singleTag.has(elem.name))) {\n if (!opts.xmlMode)\n tag += \" \";\n tag += \"/>\";\n }\n else {\n tag += \">\";\n if (elem.children.length > 0) {\n tag += render(elem.children, opts);\n }\n if (opts.xmlMode || !singleTag.has(elem.name)) {\n tag += `</${elem.name}>`;\n }\n }\n return tag;\n}\nfunction renderDirective(elem) {\n return `<${elem.data}>`;\n}\nfunction renderText(elem, opts) {\n var _a;\n let data = elem.data || \"\";\n // If entities weren't decoded, no need to encode them back\n if (((_a = opts.encodeEntities) !== null && _a !== void 0 ? _a : opts.decodeEntities) !== false &&\n !(!opts.xmlMode &&\n elem.parent &&\n unencodedElements.has(elem.parent.name))) {\n data =\n opts.xmlMode || opts.encodeEntities !== \"utf8\"\n ? encodeXML(data)\n : escapeText(data);\n }\n return data;\n}\nfunction renderCdata(elem) {\n return `<![CDATA[${elem.children[0].data}]]>`;\n}\nfunction renderComment(elem) {\n return `<!--${elem.data}-->`;\n}\n","import { isTag, isCDATA, isText, hasChildren, isComment, } from \"domhandler\";\nimport renderHTML from \"dom-serializer\";\nimport { ElementType } from \"domelementtype\";\n/**\n * @category Stringify\n * @deprecated Use the `dom-serializer` module directly.\n * @param node Node to get the outer HTML of.\n * @param options Options for serialization.\n * @returns `node`'s outer HTML.\n */\nexport function getOuterHTML(node, options) {\n return renderHTML(node, options);\n}\n/**\n * @category Stringify\n * @deprecated Use the `dom-serializer` module directly.\n * @param node Node to get the inner HTML of.\n * @param options Options for serialization.\n * @returns `node`'s inner HTML.\n */\nexport function getInnerHTML(node, options) {\n return hasChildren(node)\n ? node.children.map((node) => getOuterHTML(node, options)).join(\"\")\n : \"\";\n}\n/**\n * Get a node's inner text. Same as `textContent`, but inserts newlines for `<br>` tags. Ignores comments.\n *\n * @category Stringify\n * @deprecated Use `textContent` instead.\n * @param node Node to get the inner text of.\n * @returns `node`'s inner text.\n */\nexport function getText(node) {\n if (Array.isArray(node))\n return node.map(getText).join(\"\");\n if (isTag(node))\n return node.name === \"br\" ? \"\\n\" : getText(node.children);\n if (isCDATA(node))\n return getText(node.children);\n if (isText(node))\n return node.data;\n return \"\";\n}\n/**\n * Get a node's text content. Ignores comments.\n *\n * @category Stringify\n * @param node Node to get the text content of.\n * @returns `node`'s text content.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent}\n */\nexport function textContent(node) {\n if (Array.isArray(node))\n return node.map(textContent).join(\"\");\n if (hasChildren(node) && !isComment(node)) {\n return textContent(node.children);\n }\n if (isText(node))\n return node.data;\n return \"\";\n}\n/**\n * Get a node's inner text, ignoring `<script>` and `<style>` tags. Ignores comments.\n *\n * @category Stringify\n * @param node Node to get the inner text of.\n * @returns `node`'s inner text.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/innerText}\n */\nexport function innerText(node) {\n if (Array.isArray(node))\n return node.map(innerText).join(\"\");\n if (hasChildren(node) && (node.type === ElementType.Tag || isCDATA(node))) {\n return innerText(node.children);\n }\n if (isText(node))\n return node.data;\n return \"\";\n}\n//# sourceMappingURL=stringify.js.map","import { isTag, hasChildren, } from \"domhandler\";\n/**\n * Get a node's children.\n *\n * @category Traversal\n * @param elem Node to get the children of.\n * @returns `elem`'s children, or an empty array.\n */\nexport function getChildren(elem) {\n return hasChildren(elem) ? elem.children : [];\n}\n/**\n * Get a node's parent.\n *\n * @category Traversal\n * @param elem Node to get the parent of.\n * @returns `elem`'s parent node, or `null` if `elem` is a root node.\n */\nexport function getParent(elem) {\n return elem.parent || null;\n}\n/**\n * Gets an elements siblings, including the element itself.\n *\n * Attempts to get the children through the element's parent first. If we don't\n * have a parent (the element is a root node), we walk the element's `prev` &\n * `next` to get all remaining nodes.\n *\n * @category Traversal\n * @param elem Element to get the siblings of.\n * @returns `elem`'s siblings, including `elem`.\n */\nexport function getSiblings(elem) {\n const parent = getParent(elem);\n if (parent != null)\n return getChildren(parent);\n const siblings = [elem];\n let { prev, next } = elem;\n while (prev != null) {\n siblings.unshift(prev);\n ({ prev } = prev);\n }\n while (next != null) {\n siblings.push(next);\n ({ next } = next);\n }\n return siblings;\n}\n/**\n * Gets an attribute from an element.\n *\n * @category Traversal\n * @param elem Element to check.\n * @param name Attribute name to retrieve.\n * @returns The element's attribute value, or `undefined`.\n */\nexport function getAttributeValue(elem, name) {\n var _a;\n return (_a = elem.attribs) === null || _a === void 0 ? void 0 : _a[name];\n}\n/**\n * Checks whether an element has an attribute.\n *\n * @category Traversal\n * @param elem Element to check.\n * @param name Attribute name to look for.\n * @returns Returns whether `elem` has the attribute `name`.\n */\nexport function hasAttrib(elem, name) {\n return (elem.attribs != null &&\n Object.prototype.hasOwnProperty.call(elem.attribs, name) &&\n elem.attribs[name] != null);\n}\n/**\n * Get the tag name of an element.\n *\n * @category Traversal\n * @param elem The element to get the name for.\n * @returns The tag name of `elem`.\n */\nexport function getName(elem) {\n return elem.name;\n}\n/**\n * Returns the next element sibling of a node.\n *\n * @category Traversal\n * @param elem The element to get the next sibling of.\n * @returns `elem`'s next sibling that is a tag, or `null` if there is no next\n * sibling.\n */\nexport function nextElementSibling(elem) {\n let { next } = elem;\n while (next !== null && !isTag(next))\n ({ next } = next);\n return next;\n}\n/**\n * Returns the previous element sibling of a node.\n *\n * @category Traversal\n * @param elem The element to get the previous sibling of.\n * @returns `elem`'s previous sibling that is a tag, or `null` if there is no\n * previous sibling.\n */\nexport function prevElementSibling(elem) {\n let { prev } = elem;\n while (prev !== null && !isTag(prev))\n ({ prev } = prev);\n return prev;\n}\n//# sourceMappingURL=traversal.js.map","/**\n * Remove an element from the dom\n *\n * @category Manipulation\n * @param elem The element to be removed\n */\nexport function removeElement(elem) {\n if (elem.prev)\n elem.prev.next = elem.next;\n if (elem.next)\n elem.next.prev = elem.prev;\n if (elem.parent) {\n const childs = elem.parent.children;\n const childsIndex = childs.lastIndexOf(elem);\n if (childsIndex >= 0) {\n childs.splice(childsIndex, 1);\n }\n }\n elem.next = null;\n elem.prev = null;\n elem.parent = null;\n}\n/**\n * Replace an element in the dom\n *\n * @category Manipulation\n * @param elem The element to be replaced\n * @param replacement The element to be added\n */\nexport function replaceElement(elem, replacement) {\n const prev = (replacement.prev = elem.prev);\n if (prev) {\n prev.next = replacement;\n }\n const next = (replacement.next = elem.next);\n if (next) {\n next.prev = replacement;\n }\n const parent = (replacement.parent = elem.parent);\n if (parent) {\n const childs = parent.children;\n childs[childs.lastIndexOf(elem)] = replacement;\n elem.parent = null;\n }\n}\n/**\n * Append a child to an element.\n *\n * @category Manipulation\n * @param parent The element to append to.\n * @param child The element to be added as a child.\n */\nexport function appendChild(parent, child) {\n removeElement(child);\n child.next = null;\n child.parent = parent;\n if (parent.children.push(child) > 1) {\n const sibling = parent.children[parent.children.length - 2];\n sibling.next = child;\n child.prev = sibling;\n }\n else {\n child.prev = null;\n }\n}\n/**\n * Append an element after another.\n *\n * @category Manipulation\n * @param elem The element to append after.\n * @param next The element be added.\n */\nexport function append(elem, next) {\n removeElement(next);\n const { parent } = elem;\n const currNext = elem.next;\n next.next = currNext;\n next.prev = elem;\n elem.next = next;\n next.parent = parent;\n if (currNext) {\n currNext.prev = next;\n if (parent) {\n const childs = parent.children;\n childs.splice(childs.lastIndexOf(currNext), 0, next);\n }\n }\n else if (parent) {\n parent.children.push(next);\n }\n}\n/**\n * Prepend a child to an element.\n *\n * @category Manipulation\n * @param parent The element to prepend before.\n * @param child The element to be added as a child.\n */\nexport function prependChild(parent, child) {\n removeElement(child);\n child.parent = parent;\n child.prev = null;\n if (parent.children.unshift(child) !== 1) {\n const sibling = parent.children[1];\n sibling.prev = child;\n child.next = sibling;\n }\n else {\n child.next = null;\n }\n}\n/**\n * Prepend an element before another.\n *\n * @category Manipulation\n * @param elem The element to prepend before.\n * @param prev The element be added.\n */\nexport function prepend(elem, prev) {\n removeElement(prev);\n const { parent } = elem;\n if (parent) {\n const childs = parent.children;\n childs.splice(childs.indexOf(elem), 0, prev);\n }\n if (elem.prev) {\n elem.prev.next = prev;\n }\n prev.parent = parent;\n prev.prev = elem.prev;\n prev.next = elem;\n elem.prev = prev;\n}\n//# sourceMappingURL=manipulation.js.map","import { isTag, hasChildren } from \"domhandler\";\n/**\n * Search a node and its children for nodes passing a test function. If `node` is not an array, it will be wrapped in one.\n *\n * @category Querying\n * @param test Function to test nodes on.\n * @param node Node to search. Will be included in the result set if it matches.\n * @param recurse Also consider child nodes.\n * @param limit Maximum number of nodes to return.\n * @returns All nodes passing `test`.\n */\nexport function filter(test, node, recurse = true, limit = Infinity) {\n return find(test, Array.isArray(node) ? node : [node], recurse, limit);\n}\n/**\n * Search an array of nodes and their children for nodes passing a test function.\n *\n * @category Querying\n * @param test Function to test nodes on.\n * @param nodes Array of nodes to search.\n * @param recurse Also consider child nodes.\n * @param limit Maximum number of nodes to return.\n * @returns All nodes passing `test`.\n */\nexport function find(test, nodes, recurse, limit) {\n const result = [];\n /** Stack of the arrays we are looking at. */\n const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]];\n /** Stack of the indices within the arrays. */\n const indexStack = [0];\n for (;;) {\n // First, check if the current array has any more elements to look at.\n if (indexStack[0] >= nodeStack[0].length) {\n // If we have no more arrays to look at, we are done.\n if (indexStack.length === 1) {\n return result;\n }\n // Otherwise, remove the current array from the stack.\n nodeStack.shift();\n indexStack.shift();\n // Loop back to the start to continue with the next array.\n continue;\n }\n const elem = nodeStack[0][indexStack[0]++];\n if (test(elem)) {\n result.push(elem);\n if (--limit <= 0)\n return result;\n }\n if (recurse && hasChildren(elem) && elem.children.length > 0) {\n /*\n * Add the children to the stack. We are depth-first, so this is\n * the next array we look at.\n */\n indexStack.unshift(0);\n nodeStack.unshift(elem.children);\n }\n }\n}\n/**\n * Finds the first element inside of an array that matches a test function. This is an alias for `Array.prototype.find`.\n *\n * @category Querying\n * @param test Function to test nodes on.\n * @param nodes Array of nodes to search.\n * @returns The first node in the array that passes `test`.\n * @deprecated Use `Array.prototype.find` directly.\n */\nexport function findOneChild(test, nodes) {\n return nodes.find(test);\n}\n/**\n * Finds one element in a tree that passes a test.\n *\n * @category Querying\n * @param test Function to test nodes on.\n * @param nodes Node or array of nodes to search.\n * @param recurse Also consider child nodes.\n * @returns The first node that passes `test`.\n */\nexport function findOne(test, nodes, recurse = true) {\n const searchedNodes = Array.isArray(nodes) ? nodes : [nodes];\n for (let i = 0; i < searchedNodes.length; i++) {\n const node = searchedNodes[i];\n if (isTag(node) && test(node)) {\n return node;\n }\n if (recurse && hasChildren(node) && node.children.length > 0) {\n const found = findOne(test, node.children, true);\n if (found)\n return found;\n }\n }\n return null;\n}\n/**\n * Checks if a tree of nodes contains at least one node passing a test.\n *\n * @category Querying\n * @param test Function to test nodes on.\n * @param nodes Array of nodes to search.\n * @returns Whether a tree of nodes contains at least one node passing the test.\n */\nexport function existsOne(test, nodes) {\n return (Array.isArray(nodes) ? nodes : [nodes]).some((node) => (isTag(node) && test(node)) ||\n (hasChildren(node) && existsOne(test, node.children)));\n}\n/**\n * Search an array of nodes and their children for elements passing a test function.\n *\n * Same as `find`, but limited to elements and with less options, leading to reduced complexity.\n *\n * @category Querying\n * @param test Function to test nodes on.\n * @param nodes Array of nodes to search.\n * @returns All nodes passing `test`.\n */\nexport function findAll(test, nodes) {\n const result = [];\n const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]];\n const indexStack = [0];\n for (;;) {\n if (indexStack[0] >= nodeStack[0].length) {\n if (nodeStack.length === 1) {\n return result;\n }\n // Otherwise, remove the current array from the stack.\n nodeStack.shift();\n indexStack.shift();\n // Loop back to the start to continue with the next array.\n continue;\n }\n const elem = nodeStack[0][indexStack[0]++];\n if (isTag(elem) && test(elem))\n result.push(elem);\n if (hasChildren(elem) && elem.children.length > 0) {\n indexStack.unshift(0);\n nodeStack.unshift(elem.children);\n }\n }\n}\n//# sourceMappingURL=querying.js.map","import { isTag, isText } from \"domhandler\";\nimport { filter, findOne } from \"./querying.js\";\n/**\n * A map of functions to check nodes against.\n */\nconst Checks = {\n tag_name(name) {\n if (typeof name === \"function\") {\n return (elem) => isTag(elem) && name(elem.name);\n }\n else if (name === \"*\") {\n return isTag;\n }\n return (elem) => isTag(elem) && elem.name === name;\n },\n tag_type(type) {\n if (typeof type === \"function\") {\n return (elem) => type(elem.type);\n }\n return (elem) => elem.type === type;\n },\n tag_contains(data) {\n if (typeof data === \"function\") {\n return (elem) => isText(elem) && data(elem.data);\n }\n return (elem) => isText(elem) && elem.data === data;\n },\n};\n/**\n * Returns a function to check whether a node has an attribute with a particular\n * value.\n *\n * @param attrib Attribute to check.\n * @param value Attribute value to look for.\n * @returns A function to check whether the a node has an attribute with a\n * particular value.\n */\nfunction getAttribCheck(attrib, value) {\n if (typeof value === \"function\") {\n return (elem) => isTag(elem) && value(elem.attribs[attrib]);\n }\n return (elem) => isTag(elem) && elem.attribs[attrib] === value;\n}\n/**\n * Returns a function that returns `true` if either of the input functions\n * returns `true` for a node.\n *\n * @param a First function to combine.\n * @param b Second function to combine.\n * @returns A function taking a node and returning `true` if either of the input\n * functions returns `true` for the node.\n */\nfunction combineFuncs(a, b) {\n return (elem) => a(elem) || b(elem);\n}\n/**\n * Returns a function that executes all checks in `options` and returns `true`\n * if any of them match a node.\n *\n * @param options An object describing nodes to look for.\n * @returns A function that executes all checks in `options` and returns `true`\n * if any of them match a node.\n */\nfunction compileTest(options) {\n const funcs = Object.keys(options).map((key) => {\n const value = options[key];\n return Object.prototype.hasOwnProperty.call(Checks, key)\n ? Checks[key](value)\n : getAttribCheck(key, value);\n });\n return funcs.length === 0 ? null : funcs.reduce(combineFuncs);\n}\n/**\n * Checks whether a node matches the description in `options`.\n *\n * @category Legacy Query Functions\n * @param options An object describing nodes to look for.\n * @param node The element to test.\n * @returns Whether the element matches the description in `options`.\n */\nexport function testElement(options, node) {\n const test = compileTest(options);\n return test ? test(node) : true;\n}\n/**\n * Returns all nodes that match `options`.\n *\n * @category Legacy Query Functions\n * @param options An object describing nodes to look for.\n * @param nodes Nodes to search through.\n * @param recurse Also consider child nodes.\n * @param limit Maximum number of nodes to return.\n * @returns All nodes that match `options`.\n */\nexport function getElements(options, nodes, recurse, limit = Infinity) {\n const test = compileTest(options);\n return test ? filter(test, nodes, recurse, limit) : [];\n}\n/**\n * Returns the node with the supplied ID.\n *\n * @category Legacy Query Functions\n * @param id The unique ID attribute value to look for.\n * @param nodes Nodes to search through.\n * @param recurse Also consider child nodes.\n * @returns The node with the supplied ID.\n */\nexport function getElementById(id, nodes, recurse = true) {\n if (!Array.isArray(nodes))\n nodes = [nodes];\n return findOne(getAttribCheck(\"id\", id), nodes, recurse);\n}\n/**\n * Returns all nodes with the supplied `tagName`.\n *\n * @category Legacy Query Functions\n * @param tagName Tag name to search for.\n * @param nodes Nodes to search through.\n * @param recurse Also consider child nodes.\n * @param limit Maximum number of nodes to return.\n * @returns All nodes with the supplied `tagName`.\n */\nexport function getElementsByTagName(tagName, nodes, recurse = true, limit = Infinity) {\n return filter(Checks[\"tag_name\"](tagName), nodes, recurse, limit);\n}\n/**\n * Returns all nodes with the supplied `className`.\n *\n * @category Legacy Query Functions\n * @param className Class name to search for.\n * @param nodes Nodes to search through.\n * @param recurse Also consider child nodes.\n * @param limit Maximum number of nodes to return.\n * @returns All nodes with the supplied `className`.\n */\nexport function getElementsByClassName(className, nodes, recurse = true, limit = Infinity) {\n return filter(getAttribCheck(\"class\", className), nodes, recurse, limit);\n}\n/**\n * Returns all nodes with the supplied `type`.\n *\n * @category Legacy Query Functions\n * @param type Element type to look for.\n * @param nodes Nodes to search through.\n * @param recurse Also consider child nodes.\n * @param limit Maximum number of nodes to return.\n * @returns All nodes with the supplied `type`.\n */\nexport function getElementsByTagType(type, nodes, recurse = true, limit = Infinity) {\n return filter(Checks[\"tag_type\"](type), nodes, recurse, limit);\n}\n//# sourceMappingURL=legacy.js.map","import { hasChildren } from \"domhandler\";\n/**\n * Given an array of nodes, remove any member that is contained by another\n * member.\n *\n * @category Helpers\n * @param nodes Nodes to filter.\n * @returns Remaining nodes that aren't contained by other nodes.\n */\nexport function removeSubsets(nodes) {\n let idx = nodes.length;\n /*\n * Check if each node (or one of its ancestors) is already contained in the\n * array.\n */\n while (--idx >= 0) {\n const node = nodes[idx];\n /*\n * Remove the node if it is not unique.\n * We are going through the array from the end, so we only\n * have to check nodes that preceed the node under consideration in the array.\n */\n if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {\n nodes.splice(idx, 1);\n continue;\n }\n for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) {\n if (nodes.includes(ancestor)) {\n nodes.splice(idx, 1);\n break;\n }\n }\n }\n return nodes;\n}\n/**\n * @category Helpers\n * @see {@link http://dom.spec.whatwg.org/#dom-node-comparedocumentposition}\n */\nexport var DocumentPosition;\n(function (DocumentPosition) {\n DocumentPosition[DocumentPosition[\"DISCONNECTED\"] = 1] = \"DISCONNECTED\";\n DocumentPosition[DocumentPosition[\"PRECEDING\"] = 2] = \"PRECEDING\";\n DocumentPosition[DocumentPosition[\"FOLLOWING\"] = 4] = \"FOLLOWING\";\n DocumentPosition[DocumentPosition[\"CONTAINS\"] = 8] = \"CONTAINS\";\n DocumentPosition[DocumentPosition[\"CONTAINED_BY\"] = 16] = \"CONTAINED_BY\";\n})(DocumentPosition || (DocumentPosition = {}));\n/**\n * Compare the position of one node against another node in any other document,\n * returning a bitmask with the values from {@link DocumentPosition}.\n *\n * Document order:\n * > There is an ordering, document order, defined on all the nodes in the\n * > document corresponding to the order in which the first character of the\n * > XML representation of each node occurs in the XML representation of the\n * > document after expansion of general entities. Thus, the document element\n * > node will be the first node. Element nodes occur before their children.\n * > Thus, document order orders element nodes in order of the occurrence of\n * > their start-tag in the XML (after expansion of entities). The attribute\n * > nodes of an element occur after the element and before its children. The\n * > relative order of attribute nodes is implementation-dependent.\n *\n * Source:\n * http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order\n *\n * @category Helpers\n * @param nodeA The first node to use in the comparison\n * @param nodeB The second node to use in the comparison\n * @returns A bitmask describing the input nodes' relative position.\n *\n * See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for\n * a description of these values.\n */\nexport function compareDocumentPosition(nodeA, nodeB) {\n const aParents = [];\n const bParents = [];\n if (nodeA === nodeB) {\n return 0;\n }\n let current = hasChildren(nodeA) ? nodeA : nodeA.parent;\n while (current) {\n aParents.unshift(current);\n current = current.parent;\n }\n current = hasChildren(nodeB) ? nodeB : nodeB.parent;\n while (current) {\n bParents.unshift(current);\n current = current.parent;\n }\n const maxIdx = Math.min(aParents.length, bParents.length);\n let idx = 0;\n while (idx < maxIdx && aParents[idx] === bParents[idx]) {\n idx++;\n }\n if (idx === 0) {\n return DocumentPosition.DISCONNECTED;\n }\n const sharedParent = aParents[idx - 1];\n const siblings = sharedParent.children;\n const aSibling = aParents[idx];\n const bSibling = bParents[idx];\n if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) {\n if (sharedParent === nodeB) {\n return DocumentPosition.FOLLOWING | DocumentPosition.CONTAINED_BY;\n }\n return DocumentPosition.FOLLOWING;\n }\n if (sharedParent === nodeA) {\n return DocumentPosition.PRECEDING | DocumentPosition.CONTAINS;\n }\n return DocumentPosition.PRECEDING;\n}\n/**\n * Sort an array of nodes based on their relative position in the document,\n * removing any duplicate nodes. If the array contains nodes that do not belong\n * to the same document, sort order is unspecified.\n *\n * @category Helpers\n * @param nodes Array of DOM nodes.\n * @returns Collection of unique nodes, sorted in document order.\n */\nexport function uniqueSort(nodes) {\n nodes = nodes.filter((node, i, arr) => !arr.includes(node, i + 1));\n nodes.sort((a, b) => {\n const relative = compareDocumentPosition(a, b);\n if (relative & DocumentPosition.PRECEDING) {\n return -1;\n }\n else if (relative & DocumentPosition.FOLLOWING) {\n return 1;\n }\n return 0;\n });\n return nodes;\n}\n//# sourceMappingURL=helpers.js.map","import { textContent } from \"./stringify.js\";\nimport { getElementsByTagName } from \"./legacy.js\";\n/**\n * Get the feed object from the root of a DOM tree.\n *\n * @category Feeds\n * @param doc - The DOM to to extract the feed from.\n * @returns The feed.\n */\nexport function getFeed(doc) {\n const feedRoot = getOneElement(isValidFeed, doc);\n return !feedRoot\n ? null\n : feedRoot.name === \"feed\"\n ? getAtomFeed(feedRoot)\n : getRssFeed(feedRoot);\n}\n/**\n * Parse an Atom feed.\n *\n * @param feedRoot The root of the feed.\n * @returns The parsed feed.\n */\nfunction getAtomFeed(feedRoot) {\n var _a;\n const childs = feedRoot.children;\n const feed = {\n type: \"atom\",\n items: getElementsByTagName(\"entry\", childs).map((item) => {\n var _a;\n const { children } = item;\n const entry = { media: getMediaElements(children) };\n addConditionally(entry, \"id\", \"id\", children);\n addConditionally(entry, \"title\", \"title\", children);\n const href = (_a = getOneElement(\"link\", children)) === null || _a === void 0 ? void 0 : _a.attribs[\"href\"];\n if (href) {\n entry.link = href;\n }\n const description = fetch(\"summary\", children) || fetch(\"content\", children);\n if (description) {\n entry.description = description;\n }\n const pubDate = fetch(\"updated\", children);\n if (pubDate) {\n entry.pubDate = new Date(pubDate);\n }\n return entry;\n }),\n };\n addConditionally(feed, \"id\", \"id\", childs);\n addConditionally(feed, \"title\", \"title\", childs);\n const href = (_a = getOneElement(\"link\", childs)) === null || _a === void 0 ? void 0 : _a.attribs[\"href\"];\n if (href) {\n feed.link = href;\n }\n addConditionally(feed, \"description\", \"subtitle\", childs);\n const updated = fetch(\"updated\", childs);\n if (updated) {\n feed.updated = new Date(updated);\n }\n addConditionally(feed, \"author\", \"email\", childs, true);\n return feed;\n}\n/**\n * Parse a RSS feed.\n *\n * @param feedRoot The root of the feed.\n * @returns The parsed feed.\n */\nfunction getRssFeed(feedRoot) {\n var _a, _b;\n const childs = (_b = (_a = getOneElement(\"channel\", feedRoot.children)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : [];\n const feed = {\n type: feedRoot.name.substr(0, 3),\n id: \"\",\n items: getElementsByTagName(\"item\", feedRoot.children).map((item) => {\n const { children } = item;\n const entry = { media: getMediaElements(children) };\n addConditionally(entry, \"id\", \"guid\", children);\n addConditionally(entry, \"title\", \"title\", children);\n addConditionally(entry, \"link\", \"link\", children);\n addConditionally(entry, \"description\", \"description\", children);\n const pubDate = fetch(\"pubDate\", children) || fetch(\"dc:date\", children);\n if (pubDate)\n entry.pubDate = new Date(pubDate);\n return entry;\n }),\n };\n addConditionally(feed, \"title\", \"title\", childs);\n addConditionally(feed, \"link\", \"link\", childs);\n addConditionally(feed, \"description\", \"description\", childs);\n const updated = fetch(\"lastBuildDate\", childs);\n if (updated) {\n feed.updated = new Date(updated);\n }\n addConditionally(feed, \"author\", \"managingEditor\", childs, true);\n return feed;\n}\nconst MEDIA_KEYS_STRING = [\"url\", \"type\", \"lang\"];\nconst MEDIA_KEYS_INT = [\n \"fileSize\",\n \"bitrate\",\n \"framerate\",\n \"samplingrate\",\n \"channels\",\n \"duration\",\n \"height\",\n \"width\",\n];\n/**\n * Get all media elements of a feed item.\n *\n * @param where Nodes to search in.\n * @returns Media elements.\n */\nfunction getMediaElements(where) {\n return getElementsByTagName(\"media:content\", where).map((elem) => {\n const { attribs } = elem;\n const media = {\n medium: attribs[\"medium\"],\n isDefault: !!attribs[\"isDefault\"],\n };\n for (const attrib of MEDIA_KEYS_STRING) {\n if (attribs[attrib]) {\n media[attrib] = attribs[attrib];\n }\n }\n for (const attrib of MEDIA_KEYS_INT) {\n if (attribs[attrib]) {\n media[attrib] = parseInt(attribs[attrib], 10);\n }\n }\n if (attribs[\"expression\"]) {\n media.expression = attribs[\"expression\"];\n }\n return media;\n });\n}\n/**\n * Get one element by tag name.\n *\n * @param tagName Tag name to look for\n * @param node Node to search in\n * @returns The element or null\n */\nfunction getOneElement(tagName, node) {\n return getElementsByTagName(tagName, node, true, 1)[0];\n}\n/**\n * Get the text content of an element with a certain tag name.\n *\n * @param tagName Tag name to look for.\n * @param where Node to search in.\n * @param recurse Whether to recurse into child nodes.\n * @returns The text content of the element.\n */\nfunction fetch(tagName, where, recurse = false) {\n return textContent(getElementsByTagName(tagName, where, recurse, 1)).trim();\n}\n/**\n * Adds a property to an object if it has a value.\n *\n * @param obj Object to be extended\n * @param prop Property name\n * @param tagName Tag name that contains the conditionally added property\n * @param where Element to search for the property\n * @param recurse Whether to recurse into child nodes.\n */\nfunction addConditionally(obj, prop, tagName, where, recurse = false) {\n const val = fetch(tagName, where, recurse);\n if (val)\n obj[prop] = val;\n}\n/**\n * Checks if an element is a feed root node.\n *\n * @param value The name of the element to check.\n * @returns Whether an element is a feed root node.\n */\nfunction isValidFeed(value) {\n return value === \"rss\" || value === \"feed\" || value === \"rdf:RDF\";\n}\n//# sourceMappingURL=feeds.js.map","export * from \"./stringify.js\";\nexport * from \"./traversal.js\";\nexport * from \"./manipulation.js\";\nexport * from \"./querying.js\";\nexport * from \"./legacy.js\";\nexport * from \"./helpers.js\";\nexport * from \"./feeds.js\";\n/** @deprecated Use these methods from `domhandler` directly. */\nexport { isTag, isCDATA, isText, isComment, isDocument, hasChildren, } from \"domhandler\";\n//# sourceMappingURL=index.js.map","import { Parser } from \"./Parser.js\";\nexport { Parser } from \"./Parser.js\";\nimport { DomHandler, } from \"domhandler\";\nexport { DomHandler, \n// Old name for DomHandler\nDomHandler as DefaultHandler, } from \"domhandler\";\n// Helper methods\n/**\n * Parses the data, returns the resulting document.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM handler.\n */\nexport function parseDocument(data, options) {\n const handler = new DomHandler(undefined, options);\n new Parser(handler, options).end(data);\n return handler.root;\n}\n/**\n * Parses data, returns an array of the root nodes.\n *\n * Note that the root nodes still have a `Document` node as their parent.\n * Use `parseDocument` to get the `Document` node instead.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM handler.\n * @deprecated Use `parseDocument` instead.\n */\nexport function parseDOM(data, options) {\n return parseDocument(data, options).children;\n}\n/**\n * Creates a parser instance, with an attached DOM handler.\n *\n * @param callback A callback that will be called once parsing has been completed, with the resulting document.\n * @param options Optional options for the parser and DOM handler.\n * @param elementCallback An optional callback that will be called every time a tag has been completed inside of the DOM.\n */\nexport function createDocumentStream(callback, options, elementCallback) {\n const handler = new DomHandler((error) => callback(error, handler.root), options, elementCallback);\n return new Parser(handler, options);\n}\n/**\n * Creates a parser instance, with an attached DOM handler.\n *\n * @param callback A callback that will be called once parsing has been completed, with an array of root nodes.\n * @param options Optional options for the parser and DOM handler.\n * @param elementCallback An optional callback that will be called every time a tag has been completed inside of the DOM.\n * @deprecated Use `createDocumentStream` instead.\n */\nexport function createDomStream(callback, options, elementCallback) {\n const handler = new DomHandler(callback, options, elementCallback);\n return new Parser(handler, options);\n}\nexport { default as Tokenizer, QuoteType, } from \"./Tokenizer.js\";\n/*\n * All of the following exports exist for backwards-compatibility.\n * They should probably be removed eventually.\n */\nexport * as ElementType from \"domelementtype\";\nimport { getFeed } from \"domutils\";\nexport { getFeed } from \"domutils\";\nconst parseFeedDefaultOptions = { xmlMode: true };\n/**\n * Parse a feed.\n *\n * @param feed The feed that should be parsed, as a string.\n * @param options Optionally, options for parsing. When using this, you should set `xmlMode` to `true`.\n */\nexport function parseFeed(feed, options = parseFeedDefaultOptions) {\n return getFeed(parseDOM(feed, options));\n}\nexport * as DomUtils from \"domutils\";\n//# sourceMappingURL=index.js.map","// Internal\nexport const NODE_END = -1;\n\n// Node\nexport const ELEMENT_NODE = 1;\nexport const ATTRIBUTE_NODE = 2;\nexport const TEXT_NODE = 3;\nexport const CDATA_SECTION_NODE = 4;\nexport const COMMENT_NODE = 8;\nexport const DOCUMENT_NODE = 9;\nexport const DOCUMENT_TYPE_NODE = 10;\nexport const DOCUMENT_FRAGMENT_NODE = 11;\n\n// Elements\nexport const BLOCK_ELEMENTS = new Set(['ARTICLE', 'ASIDE', 'BLOCKQUOTE', 'BODY', 'BR', 'BUTTON', 'CANVAS', 'CAPTION', 'COL', 'COLGROUP', 'DD', 'DIV', 'DL', 'DT', 'EMBED', 'FIELDSET', 'FIGCAPTION', 'FIGURE', 'FOOTER', 'FORM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'LI', 'UL', 'OL', 'P']);\n\n// TreeWalker\nexport const SHOW_ALL = -1;\nexport const SHOW_ELEMENT = 1;\nexport const SHOW_TEXT = 4;\nexport const SHOW_CDATA_SECTION = 8;\nexport const SHOW_COMMENT = 128;\n\n// Document position\nexport const DOCUMENT_POSITION_DISCONNECTED = 0x01;\nexport const DOCUMENT_POSITION_PRECEDING = 0x02;\nexport const DOCUMENT_POSITION_FOLLOWING = 0x04;\nexport const DOCUMENT_POSITION_CONTAINS = 0x08;\nexport const DOCUMENT_POSITION_CONTAINED_BY = 0x10;\nexport const DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;\n\n// SVG\nexport const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n","const {\n assign,\n create,\n defineProperties,\n entries,\n getOwnPropertyDescriptors,\n keys,\n setPrototypeOf\n} = Object;\n\nexport {\n assign,\n create,\n defineProperties,\n entries,\n getOwnPropertyDescriptors,\n keys,\n setPrototypeOf\n};\n","import {ELEMENT_NODE} from './constants.js';\nimport {END, MIME, NEXT, PREV} from './symbols.js';\n\nconst $String = String;\nexport {$String as String};\n\nexport const getEnd = node => node.nodeType === ELEMENT_NODE ? node[END] : node;\n\nexport const ignoreCase = ({ownerDocument}) => ownerDocument[MIME].ignoreCase;\n\nexport const knownAdjacent = (prev, next) => {\n prev[NEXT] = next;\n next[PREV] = prev;\n};\n\nexport const knownBoundaries = (prev, current, next) => {\n knownAdjacent(prev, current);\n knownAdjacent(getEnd(current), next);\n};\n\nexport const knownSegment = (prev, start, end, next) => {\n knownAdjacent(prev, start);\n knownAdjacent(getEnd(end), next);\n};\n\nexport const knownSiblings = (prev, current, next) => {\n knownAdjacent(prev, current);\n knownAdjacent(current, next);\n};\n\nexport const localCase = ({localName, ownerDocument}) => {\n return ownerDocument[MIME].ignoreCase ? localName.toUpperCase() : localName;\n};\n\nexport const setAdjacent = (prev, next) => {\n if (prev)\n prev[NEXT] = next;\n if (next)\n next[PREV] = prev;\n};\n\n/**\n * @param {import(\"../interface/document.js\").Document} ownerDocument\n * @param {string} html\n * @return {import(\"../interface/document-fragment.js\").DocumentFragment}\n */\nexport const htmlToFragment = (ownerDocument, html) => {\n const fragment = ownerDocument.createDocumentFragment();\n\n const elem = ownerDocument.createElement('');\n elem.innerHTML = html;\n const { firstChild, lastChild } = elem;\n\n if (firstChild) {\n knownSegment(fragment, firstChild, lastChild, fragment[END]);\n\n let child = firstChild;\n do {\n child.parentNode = fragment;\n } while (child !== lastChild && (child = getEnd(child)[NEXT]));\n }\n\n return fragment;\n};","export const shadowRoots = new WeakMap;\n","import {ELEMENT_NODE} from '../shared/constants.js';\nimport {END, NEXT, UPGRADE} from '../shared/symbols.js';\nimport {entries, setPrototypeOf} from '../shared/object.js';\nimport {shadowRoots} from '../shared/shadow-roots.js';\n\nlet reactive = false;\n\nexport const Classes = new WeakMap;\n\nexport const customElements = new WeakMap;\n\nexport const attributeChangedCallback = (element, attributeName, oldValue, newValue) => {\n if (\n reactive &&\n customElements.has(element) &&\n element.attributeChangedCallback &&\n element.constructor.observedAttributes.includes(attributeName)\n ) {\n element.attributeChangedCallback(attributeName, oldValue, newValue);\n }\n};\n\nconst createTrigger = (method, isConnected) => element => {\n if (customElements.has(element)) {\n const info = customElements.get(element);\n if (info.connected !== isConnected && element.isConnected === isConnected) {\n info.connected = isConnected;\n if (method in element)\n element[method]();\n }\n }\n};\n\nconst triggerConnected = createTrigger('connectedCallback', true);\nexport const connectedCallback = element => {\n if (reactive) {\n triggerConnected(element);\n if (shadowRoots.has(element))\n element = shadowRoots.get(element).shadowRoot;\n let {[NEXT]: next, [END]: end} = element;\n while (next !== end) {\n if (next.nodeType === ELEMENT_NODE)\n triggerConnected(next);\n next = next[NEXT];\n }\n }\n};\n\nconst triggerDisconnected = createTrigger('disconnectedCallback', false);\nexport const disconnectedCallback = element => {\n if (reactive) {\n triggerDisconnected(element);\n if (shadowRoots.has(element))\n element = shadowRoots.get(element).shadowRoot;\n let {[NEXT]: next, [END]: end} = element;\n while (next !== end) {\n if (next.nodeType === ELEMENT_NODE)\n triggerDisconnected(next);\n next = next[NEXT];\n }\n }\n};\n\n/**\n * @implements globalThis.CustomElementRegistry\n */\nexport class CustomElementRegistry {\n\n /**\n * @param {Document} ownerDocument\n */\n constructor(ownerDocument) {\n /**\n * @private\n */\n this.ownerDocument = ownerDocument;\n\n /**\n * @private\n */\n this.registry = new Map;\n\n /**\n * @private\n */\n this.waiting = new Map;\n\n /**\n * @private\n */\n this.active = false;\n }\n\n /**\n * @param {string} localName the custom element definition name\n * @param {Function} Class the custom element **Class** definition\n * @param {object?} options the optional object with an `extends` property\n */\n define(localName, Class, options = {}) {\n const {ownerDocument, registry, waiting} = this;\n\n if (registry.has(localName))\n throw new Error('unable to redefine ' + localName);\n\n if (Classes.has(Class))\n throw new Error('unable to redefine the same class: ' + Class);\n\n this.active = (reactive = true);\n\n const {extends: extend} = options;\n\n Classes.set(Class, {\n ownerDocument,\n options: {is: extend ? localName : ''},\n localName: extend || localName\n });\n\n const check = extend ?\n element => {\n return element.localName === extend &&\n element.getAttribute('is') === localName;\n } :\n element => element.localName === localName;\n registry.set(localName, {Class, check});\n if (waiting.has(localName)) {\n for (const resolve of waiting.get(localName))\n resolve(Class);\n waiting.delete(localName);\n }\n ownerDocument.querySelectorAll(\n extend ? `${extend}[is=\"${localName}\"]` : localName\n ).forEach(this.upgrade, this);\n }\n\n /**\n * @param {Element} element\n */\n upgrade(element) {\n if (customElements.has(element))\n return;\n const {ownerDocument, registry} = this;\n const ce = element.getAttribute('is') || element.localName;\n if (registry.has(ce)) {\n const {Class, check} = registry.get(ce);\n if (check(element)) {\n const {attributes, isConnected} = element;\n for (const attr of attributes)\n element.removeAttributeNode(attr);\n\n const values = entries(element);\n for (const [key] of values)\n delete element[key];\n\n setPrototypeOf(element, Class.prototype);\n ownerDocument[UPGRADE] = {element, values};\n new Class(ownerDocument, ce);\n\n customElements.set(element, {connected: isConnected});\n\n for (const attr of attributes)\n element.setAttributeNode(attr);\n\n if (isConnected && element.connectedCallback)\n element.connectedCallback();\n }\n }\n }\n\n /**\n * @param {string} localName the custom element definition name\n */\n whenDefined(localName) {\n const {registry, waiting} = this;\n return new Promise(resolve => {\n if (registry.has(localName))\n resolve(registry.get(localName).Class);\n else {\n if (!waiting.has(localName))\n waiting.set(localName, []);\n waiting.get(localName).push(resolve);\n }\n });\n }\n\n /**\n * @param {string} localName the custom element definition name\n * @returns {Function?} the custom element **Class**, if any\n */\n get(localName) {\n const info = this.registry.get(localName);\n return info && info.Class;\n }\n\n /**\n * @param {Function} Class **Class** of custom element\n * @returns {string?} found tag name or null\n */\n getName(Class) {\n if (Classes.has(Class)) {\n const { localName } = Classes.get(Class);\n return localName;\n }\n return null;\n }\n}\n","import * as HTMLParser2 from 'htmlparser2';\n\nimport {ELEMENT_NODE, SVG_NAMESPACE} from './constants.js';\nimport {CUSTOM_ELEMENTS, PREV, END, VALUE} from './symbols.js';\nimport {keys} from './object.js';\n\nimport {knownBoundaries, knownSiblings} from './utils.js';\nimport {attributeChangedCallback, connectedCallback} from '../interface/custom-element-registry.js';\n\nconst {Parser} = HTMLParser2;\n\n// import {Mime} from './mime.js';\n// const VOID_SOURCE = Mime['text/html'].voidElements.source.slice(4, -2);\n// const VOID_ELEMENTS = new RegExp(`<(${VOID_SOURCE})([^>]*?)>`, 'gi');\n// const VOID_SANITIZER = (_, $1, $2) => `<${$1}${$2}${/\\/$/.test($2) ? '' : ' /'}>`;\n// const voidSanitizer = html => html.replace(VOID_ELEMENTS, VOID_SANITIZER);\n\nlet notParsing = true;\n\nconst append = (self, node, active) => {\n const end = self[END];\n node.parentNode = self;\n knownBoundaries(end[PREV], node, end);\n if (active && node.nodeType === ELEMENT_NODE)\n connectedCallback(node);\n return node;\n};\n\nconst attribute = (element, end, attribute, value, active) => {\n attribute[VALUE] = value;\n attribute.ownerElement = element;\n knownSiblings(end[PREV], attribute, end);\n if (attribute.name === 'class')\n element.className = value;\n if (active)\n attributeChangedCallback(element, attribute.name, null, value);\n};\n\nexport const isNotParsing = () => notParsing;\n\nexport const parseFromString = (document, isHTML, markupLanguage) => {\n const {active, registry} = document[CUSTOM_ELEMENTS];\n\n let node = document;\n let ownerSVGElement = null;\n let parsingCData = false;\n\n notParsing = false;\n\n const content = new Parser({\n // <!DOCTYPE ...>\n onprocessinginstruction(name, data) {\n if (name.toLowerCase() === '!doctype')\n document.doctype = data.slice(name.length).trim();\n },\n\n // <tagName>\n onopentag(name, attributes) {\n let create = true;\n if (isHTML) {\n if (ownerSVGElement) {\n node = append(node, document.createElementNS(SVG_NAMESPACE, name), active);\n node.ownerSVGElement = ownerSVGElement;\n create = false;\n }\n else if (name === 'svg' || name === 'SVG') {\n ownerSVGElement = document.createElementNS(SVG_NAMESPACE, name);\n node = append(node, ownerSVGElement, active);\n create = false;\n }\n else if (active) {\n const ce = name.includes('-') ? name : (attributes.is || '');\n if (ce && registry.has(ce)) {\n const {Class} = registry.get(ce);\n node = append(node, new Class, active);\n delete attributes.is;\n create = false;\n }\n }\n }\n\n if (create)\n node = append(node, document.createElement(name), false);\n\n let end = node[END];\n for (const name of keys(attributes))\n attribute(node, end, document.createAttribute(name), attributes[name], active);\n },\n\n // #text, #comment\n oncomment(data) { append(node, document.createComment(data), active); },\n ontext(text) {\n if (parsingCData) {\n append(node, document.createCDATASection(text), active);\n } else {\n append(node, document.createTextNode(text), active);\n }\n },\n\n // #cdata\n oncdatastart() { parsingCData = true; },\n oncdataend() { parsingCData = false; },\n\n // </tagName>\n onclosetag() {\n if (isHTML && node === ownerSVGElement)\n ownerSVGElement = null;\n node = node.parentNode;\n }\n }, {\n lowerCaseAttributeNames: false,\n decodeEntities: true,\n xmlMode: !isHTML\n });\n\n content.write(markupLanguage);\n content.end();\n\n notParsing = true;\n\n return document;\n};\n","export const htmlClasses = new Map;\n\nexport const registerHTMLClass = (names, Class) => {\n for (const name of [].concat(names)) {\n htmlClasses.set(name, Class);\n htmlClasses.set(name.toUpperCase(), Class);\n }\n};\n","import {\n NODE_END,\n ATTRIBUTE_NODE,\n CDATA_SECTION_NODE,\n COMMENT_NODE,\n DOCUMENT_TYPE_NODE,\n ELEMENT_NODE,\n TEXT_NODE\n} from './constants.js';\n\nimport {END, NEXT, VALUE} from './symbols.js';\n\nimport {getEnd} from './utils.js';\n\nconst loopSegment = ({[NEXT]: next, [END]: end}, json) => {\n while (next !== end) {\n switch (next.nodeType) {\n case ATTRIBUTE_NODE:\n attrAsJSON(next, json);\n break;\n case TEXT_NODE:\n case COMMENT_NODE:\n case CDATA_SECTION_NODE:\n characterDataAsJSON(next, json);\n break;\n case ELEMENT_NODE:\n elementAsJSON(next, json);\n next = getEnd(next);\n break;\n case DOCUMENT_TYPE_NODE:\n documentTypeAsJSON(next, json);\n break;\n }\n next = next[NEXT];\n }\n const last = json.length - 1;\n const value = json[last];\n if (typeof value === 'number' && value < 0)\n json[last] += NODE_END;\n else\n json.push(NODE_END);\n};\n\nexport const attrAsJSON = (attr, json) => {\n json.push(ATTRIBUTE_NODE, attr.name);\n const value = attr[VALUE].trim();\n if (value)\n json.push(value);\n};\n\nexport const characterDataAsJSON = (node, json) => {\n const value = node[VALUE];\n if (value.trim())\n json.push(node.nodeType, value);\n};\n\nexport const nonElementAsJSON = (node, json) => {\n json.push(node.nodeType);\n loopSegment(node, json);\n};\n\nexport const documentTypeAsJSON = ({name, publicId, systemId}, json) => {\n json.push(DOCUMENT_TYPE_NODE, name);\n if (publicId)\n json.push(publicId);\n if (systemId)\n json.push(systemId);\n};\n\nexport const elementAsJSON = (element, json) => {\n json.push(ELEMENT_NODE, element.localName);\n loopSegment(element, json);\n};\n","import {MUTATION_OBSERVER} from '../shared/symbols.js';\n\nconst createRecord =\n (type, target, element, addedNodes, removedNodes, attributeName, oldValue) =>\n ({\n type,\n target,\n addedNodes,\n removedNodes,\n attributeName,\n oldValue,\n previousSibling: element?.previousSibling || null,\n nextSibling: element?.nextSibling || null,\n});\n\nconst queueAttribute = (\n observer, target, attributeName, attributeFilter, attributeOldValue, oldValue\n) => {\n if ((!attributeFilter || attributeFilter.includes(attributeName))) {\n const {callback, records, scheduled} = observer;\n records.push(createRecord(\n 'attributes', target, null,\n [], [],\n attributeName, attributeOldValue ? oldValue : void 0\n ));\n if (!scheduled) {\n observer.scheduled = true;\n Promise.resolve().then(() => {\n observer.scheduled = false;\n callback(records.splice(0), observer);\n });\n }\n }\n};\n\nexport const attributeChangedCallback = (element, attributeName, oldValue) => {\n const {ownerDocument} = element;\n const {active, observers} = ownerDocument[MUTATION_OBSERVER];\n if (active) {\n for (const observer of observers) {\n for (const [\n target,\n {\n childList,\n subtree,\n attributes,\n attributeFilter,\n attributeOldValue\n }\n ] of observer.nodes) {\n if (childList) {\n if (\n (subtree && (target === ownerDocument || target.contains(element))) ||\n (!subtree && target.children.includes(element))\n ) {\n queueAttribute(\n observer, element,\n attributeName, attributeFilter, attributeOldValue, oldValue\n );\n break;\n }\n }\n else if (\n attributes &&\n target === element\n ) {\n queueAttribute(\n observer, element,\n attributeName, attributeFilter, attributeOldValue, oldValue\n );\n break;\n }\n }\n }\n }\n};\n\nexport const moCallback = (element, parentNode) => {\n const {ownerDocument} = element;\n const {active, observers} = ownerDocument[MUTATION_OBSERVER];\n if (active) {\n for (const observer of observers) {\n for (const [target, {subtree, childList, characterData}] of observer.nodes) {\n if (childList) {\n if (\n (parentNode && (target === parentNode || /* c8 ignore next */(subtree && target.contains(parentNode)))) ||\n (!parentNode && ((subtree && (target === ownerDocument || /* c8 ignore next */target.contains(element))) ||\n (!subtree && target[characterData ? 'childNodes' : 'children'].includes(element))))\n ) {\n const {callback, records, scheduled} = observer;\n records.push(createRecord(\n 'childList', target, element,\n parentNode ? [] : [element], parentNode ? [element] : []\n ));\n if (!scheduled) {\n observer.scheduled = true;\n Promise.resolve().then(() => {\n observer.scheduled = false;\n callback(records.splice(0), observer);\n });\n }\n break;\n }\n }\n }\n }\n }\n};\n\nexport class MutationObserverClass {\n constructor(ownerDocument) {\n const observers = new Set;\n this.observers = observers;\n this.active = false;\n\n /**\n * @implements globalThis.MutationObserver\n */\n this.class = class MutationObserver {\n\n constructor(callback) {\n /**\n * @private\n */\n this.callback = callback;\n\n /**\n * @private\n */\n this.nodes = new Map;\n\n /**\n * @private\n */\n this.records = [];\n\n /**\n * @private\n */\n this.scheduled = false;\n }\n\n disconnect() {\n this.records.splice(0);\n this.nodes.clear();\n observers.delete(this);\n ownerDocument[MUTATION_OBSERVER].active = !!observers.size;\n }\n\n /**\n * @param {Element} target\n * @param {MutationObserverInit} options\n */\n observe(target, options = {\n subtree: false,\n childList: false,\n attributes: false,\n attributeFilter: null,\n attributeOldValue: false,\n characterData: false,\n // TODO: not implemented yet\n // characterDataOldValue: false\n }) {\n if (('attributeOldValue' in options) || ('attributeFilter' in options))\n options.attributes = true;\n // if ('characterDataOldValue' in options)\n // options.characterData = true;\n options.childList = !!options.childList;\n options.subtree = !!options.subtree;\n this.nodes.set(target, options);\n observers.add(this);\n ownerDocument[MUTATION_OBSERVER].active = true;\n }\n\n /**\n * @returns {MutationRecord[]}\n */\n takeRecords() { return this.records.splice(0); }\n }\n }\n}\n","import {CLASS_LIST, NEXT, PREV, VALUE} from './symbols.js';\n\nimport {knownAdjacent, knownSiblings} from './utils.js';\n\nimport {attributeChangedCallback as ceAttributes} from '../interface/custom-element-registry.js';\nimport {attributeChangedCallback as moAttributes} from '../interface/mutation-observer.js';\n\nexport const emptyAttributes = new Set([\n 'allowfullscreen',\n 'allowpaymentrequest',\n 'async',\n 'autofocus',\n 'autoplay',\n 'checked',\n 'class',\n 'contenteditable',\n 'controls',\n 'default',\n 'defer',\n 'disabled',\n 'draggable',\n 'formnovalidate',\n 'hidden',\n 'id',\n 'ismap',\n 'itemscope',\n 'loop',\n 'multiple',\n 'muted',\n 'nomodule',\n 'novalidate',\n 'open',\n 'playsinline',\n 'readonly',\n 'required',\n 'reversed',\n 'selected',\n 'style',\n 'truespeed'\n]);\n\nexport const setAttribute = (element, attribute) => {\n const {[VALUE]: value, name} = attribute;\n attribute.ownerElement = element;\n knownSiblings(element, attribute, element[NEXT]);\n if (name === 'class')\n element.className = value;\n moAttributes(element, name, null);\n ceAttributes(element, name, null, value);\n};\n\nexport const removeAttribute = (element, attribute) => {\n const {[VALUE]: value, name} = attribute;\n knownAdjacent(attribute[PREV], attribute[NEXT]);\n attribute.ownerElement = attribute[PREV] = attribute[NEXT] = null;\n if (name === 'class')\n element[CLASS_LIST] = null;\n moAttributes(element, name, value);\n ceAttributes(element, name, value, null);\n};\n\nexport const booleanAttribute = {\n get(element, name) {\n return element.hasAttribute(name);\n },\n set(element, name, value) {\n if (value)\n element.setAttribute(name, '');\n else\n element.removeAttribute(name);\n }\n};\n\nexport const numericAttribute = {\n get(element, name) {\n return parseFloat(element.getAttribute(name) || 0);\n },\n set(element, name, value) {\n element.setAttribute(name, value);\n }\n};\n\nexport const stringAttribute = {\n get(element, name) {\n return element.getAttribute(name) || '';\n },\n set(element, name, value) {\n element.setAttribute(name, value);\n }\n};\n\n/* oddly enough, this apparently is not a thing\nexport const nullableAttribute = {\n get(element, name) {\n return element.getAttribute(name);\n },\n set(element, name, value) {\n if (value === null)\n element.removeAttribute(name);\n else\n element.setAttribute(name, value);\n }\n};\n*/\n","// https://dom.spec.whatwg.org/#interface-eventtarget\n\nconst wm = new WeakMap();\n\nfunction dispatch(event, listener) {\n if (typeof listener === 'function')\n listener.call(event.target, event);\n else\n listener.handleEvent(event);\n return event._stopImmediatePropagationFlag;\n}\n\nfunction invokeListeners({currentTarget, target}) {\n const map = wm.get(currentTarget);\n if (map && map.has(this.type)) {\n const listeners = map.get(this.type);\n if (currentTarget === target) {\n this.eventPhase = this.AT_TARGET;\n } else {\n this.eventPhase = this.BUBBLING_PHASE;\n }\n\n this.currentTarget = currentTarget;\n this.target = target;\n for (const [listener, options] of listeners) {\n if (options && options.once)\n listeners.delete(listener);\n if (dispatch(this, listener))\n break;\n }\n delete this.currentTarget;\n delete this.target;\n return this.cancelBubble;\n }\n}\n\n\n/**\n * @implements globalThis.EventTarget\n */\nclass DOMEventTarget {\n\n constructor() {\n wm.set(this, new Map);\n }\n\n /**\n * @protected\n */\n _getParent() {\n return null;\n }\n\n addEventListener(type, listener, options) {\n const map = wm.get(this);\n if (!map.has(type)) \n map.set(type, new Map);\n map.get(type).set(listener, options);\n }\n\n removeEventListener(type, listener) {\n const map = wm.get(this);\n if (map.has(type)) {\n const listeners = map.get(type);\n if (listeners.delete(listener) && !listeners.size)\n map.delete(type);\n }\n }\n\n dispatchEvent(event) {\n let node = this;\n event.eventPhase = event.CAPTURING_PHASE;\n\n // intentionally simplified, specs imply way more code: https://dom.spec.whatwg.org/#event-path\n while (node) {\n if (node.dispatchEvent)\n event._path.push({currentTarget: node, target: this});\n node = event.bubbles && node._getParent && node._getParent();\n }\n event._path.some(invokeListeners, event);\n event._path = [];\n event.eventPhase = event.NONE;\n return !event.defaultPrevented;\n }\n\n}\n\nexport {DOMEventTarget as EventTarget};\n","// https://dom.spec.whatwg.org/#interface-nodelist\n\n/**\n * @implements globalThis.NodeList\n */\nexport class NodeList extends Array {\n item(i) { return i < this.length ? this[i] : null; }\n}\n","// https://dom.spec.whatwg.org/#node\n\nimport {\n ELEMENT_NODE,\n ATTRIBUTE_NODE,\n TEXT_NODE,\n CDATA_SECTION_NODE,\n COMMENT_NODE,\n DOCUMENT_NODE,\n DOCUMENT_FRAGMENT_NODE,\n DOCUMENT_TYPE_NODE,\n DOCUMENT_POSITION_DISCONNECTED,\n DOCUMENT_POSITION_PRECEDING,\n DOCUMENT_POSITION_FOLLOWING,\n DOCUMENT_POSITION_CONTAINS,\n DOCUMENT_POSITION_CONTAINED_BY,\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC\n} from '../shared/constants.js';\n\nimport {NEXT, PREV} from '../shared/symbols.js';\n\nimport {EventTarget} from './event-target.js';\n\nimport {NodeList} from './node-list.js';\n\nconst getParentNodeCount = ({parentNode}) => {\n let count = 0;\n while (parentNode) {\n count++;\n parentNode = parentNode.parentNode;\n }\n return count;\n};\n\n/**\n * @implements globalThis.Node\n */\nexport class Node extends EventTarget {\n\n static get ELEMENT_NODE() { return ELEMENT_NODE; }\n static get ATTRIBUTE_NODE() { return ATTRIBUTE_NODE; }\n static get TEXT_NODE() { return TEXT_NODE; }\n static get CDATA_SECTION_NODE() { return CDATA_SECTION_NODE; }\n static get COMMENT_NODE() { return COMMENT_NODE; }\n static get DOCUMENT_NODE() { return DOCUMENT_NODE; }\n static get DOCUMENT_FRAGMENT_NODE() { return DOCUMENT_FRAGMENT_NODE; }\n static get DOCUMENT_TYPE_NODE() { return DOCUMENT_TYPE_NODE; }\n\n constructor(ownerDocument, localName, nodeType) {\n super();\n this.ownerDocument = ownerDocument;\n this.localName = localName;\n this.nodeType = nodeType;\n this.parentNode = null;\n this[NEXT] = null;\n this[PREV] = null;\n }\n\n get ELEMENT_NODE() { return ELEMENT_NODE; }\n get ATTRIBUTE_NODE() { return ATTRIBUTE_NODE; }\n get TEXT_NODE() { return TEXT_NODE; }\n get CDATA_SECTION_NODE() { return CDATA_SECTION_NODE; }\n get COMMENT_NODE() { return COMMENT_NODE; }\n get DOCUMENT_NODE() { return DOCUMENT_NODE; }\n get DOCUMENT_FRAGMENT_NODE() { return DOCUMENT_FRAGMENT_NODE; }\n get DOCUMENT_TYPE_NODE() { return DOCUMENT_TYPE_NODE; }\n\n get baseURI() {\n const ownerDocument = this.nodeType === DOCUMENT_NODE ?\n this : this.ownerDocument;\n if (ownerDocument) {\n const base = ownerDocument.querySelector('base');\n if (base)\n return base.getAttribute('href');\n\n const {location} = ownerDocument.defaultView;\n if (location)\n return location.href;\n }\n\n return null;\n }\n\n /* c8 ignore start */\n // mixin: node\n get isConnected() { return false; }\n get nodeName() { return this.localName; }\n get parentElement() { return null; }\n get previousSibling() { return null; }\n get previousElementSibling() { return null; }\n get nextSibling() { return null; }\n get nextElementSibling() { return null; }\n get childNodes() { return new NodeList; }\n get firstChild() { return null; }\n get lastChild() { return null; }\n\n // default values\n get nodeValue() { return null; }\n set nodeValue(value) {}\n get textContent() { return null; }\n set textContent(value) {}\n normalize() {}\n cloneNode() { return null; }\n contains() { return false; }\n /**\n * Inserts a node before a reference node as a child of this parent node.\n * @param {Node} newNode The node to be inserted.\n * @param {Node} referenceNode The node before which newNode is inserted. If this is null, then newNode is inserted at the end of node's child nodes.\n * @returns The added child\n */\n // eslint-disable-next-line no-unused-vars\n insertBefore(newNode, referenceNode) { return newNode }\n /**\n * Adds a node to the end of the list of children of this node.\n * @param {Node} child The node to append to the given parent node.\n * @returns The appended child.\n */\n appendChild(child) { return child }\n /**\n * Replaces a child node within this node\n * @param {Node} newChild The new node to replace oldChild.\n * @param {Node} oldChild The child to be replaced.\n * @returns The replaced Node. This is the same node as oldChild.\n */\n replaceChild(newChild, oldChild) { return oldChild }\n /**\n * Removes a child node from the DOM.\n * @param {Node} child A Node that is the child node to be removed from the DOM.\n * @returns The removed node.\n */\n removeChild(child) { return child }\n toString() { return ''; }\n /* c8 ignore stop */\n\n hasChildNodes() { return !!this.lastChild; }\n isSameNode(node) { return this === node; }\n\n // TODO: attributes?\n compareDocumentPosition(target) {\n let result = 0;\n if (this !== target) {\n let self = getParentNodeCount(this);\n let other = getParentNodeCount(target);\n if (self < other) {\n result += DOCUMENT_POSITION_FOLLOWING;\n if (this.contains(target))\n result += DOCUMENT_POSITION_CONTAINED_BY;\n }\n else if (other < self) {\n result += DOCUMENT_POSITION_PRECEDING;\n if (target.contains(this))\n result += DOCUMENT_POSITION_CONTAINS;\n }\n else if (self && other) {\n const {childNodes} = this.parentNode;\n if (childNodes.indexOf(this) < childNodes.indexOf(target))\n result += DOCUMENT_POSITION_FOLLOWING;\n else\n result += DOCUMENT_POSITION_PRECEDING;\n }\n if (!self || !other) {\n result += DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC;\n result += DOCUMENT_POSITION_DISCONNECTED;\n }\n }\n return result;\n }\n\n isEqualNode(node) {\n if (this === node)\n return true;\n if (this.nodeType === node.nodeType) {\n switch (this.nodeType) {\n case DOCUMENT_NODE:\n case DOCUMENT_FRAGMENT_NODE: {\n const aNodes = this.childNodes;\n const bNodes = node.childNodes;\n return aNodes.length === bNodes.length && aNodes.every((node, i) => node.isEqualNode(bNodes[i]));\n }\n }\n return this.toString() === node.toString();\n }\n return false;\n }\n\n /**\n * @protected\n */\n _getParent() {\n return this.parentNode;\n }\n\n /**\n * Calling it on an element inside a standard web page will return an HTMLDocument object representing the entire page (or <iframe>).\n * Calling it on an element inside a shadow DOM will return the associated ShadowRoot.\n * @return {ShadowRoot | HTMLDocument}\n */\n getRootNode() {\n let root = this;\n while (root.parentNode)\n root = root.parentNode;\n return root;\n }\n}\n","const {replace} = '';\n\n// escape\nconst ca = /[<>&\\xA0]/g;\n\nconst esca = {\n '\\xA0': ' ',\n '&': '&',\n '<': '<',\n '>': '>'\n};\n\nconst pe = m => esca[m];\n\n/**\n * Safely escape HTML entities such as `&`, `<`, `>` only.\n * @param {string} es the input to safely escape\n * @returns {string} the escaped input, and it **throws** an error if\n * the input type is unexpected, except for boolean and numbers,\n * converted as string.\n */\nexport const escape = es => replace.call(es, ca, pe);\n","import {ATTRIBUTE_NODE} from '../shared/constants.js';\nimport {CHANGED, VALUE} from '../shared/symbols.js';\nimport {String, ignoreCase} from '../shared/utils.js';\nimport {attrAsJSON} from '../shared/jsdon.js';\nimport {emptyAttributes} from '../shared/attributes.js';\n\nimport {attributeChangedCallback as moAttributes} from './mutation-observer.js';\nimport {attributeChangedCallback as ceAttributes} from './custom-element-registry.js';\n\nimport {Node} from './node.js';\nimport {escape} from '../shared/text-escaper.js';\n\nconst QUOTE = /\"/g;\n\n/**\n * @implements globalThis.Attr\n */\nexport class Attr extends Node {\n constructor(ownerDocument, name, value = '') {\n super(ownerDocument, name, ATTRIBUTE_NODE);\n this.ownerElement = null;\n this.name = String(name);\n this[VALUE] = String(value);\n this[CHANGED] = false;\n }\n\n get value() { return this[VALUE]; }\n set value(newValue) {\n const {[VALUE]: oldValue, name, ownerElement} = this;\n this[VALUE] = String(newValue);\n this[CHANGED] = true;\n if (ownerElement) {\n moAttributes(ownerElement, name, oldValue);\n ceAttributes(ownerElement, name, oldValue, this[VALUE]);\n }\n }\n\n cloneNode() {\n const {ownerDocument, name, [VALUE]: value} = this;\n return new Attr(ownerDocument, name, value);\n }\n\n toString() {\n const {name, [VALUE]: value} = this;\n if (emptyAttributes.has(name) && !value) {\n return ignoreCase(this) ? name : `${name}=\"\"`;\n }\n const escapedValue = (ignoreCase(this) ? value : escape(value)).replace(QUOTE, '"');\n return `${name}=\"${escapedValue}\"`;\n }\n\n toJSON() {\n const json = [];\n attrAsJSON(this, json);\n return json;\n }\n}\n","import {\n CDATA_SECTION_NODE,\n COMMENT_NODE,\n DOCUMENT_NODE,\n DOCUMENT_FRAGMENT_NODE,\n TEXT_NODE,\n NODE_END\n} from './constants.js';\n\nimport {START, NEXT, PREV} from './symbols.js';\nimport {getEnd} from './utils.js';\n\nexport const isConnected = ({ownerDocument, parentNode}) => {\n while (parentNode) {\n if (parentNode === ownerDocument)\n return true;\n parentNode = parentNode.parentNode || parentNode.host;\n }\n return false;\n};\n\nexport const parentElement = ({parentNode}) => {\n if (parentNode) {\n switch (parentNode.nodeType) {\n case DOCUMENT_NODE:\n case DOCUMENT_FRAGMENT_NODE:\n return null;\n }\n }\n return parentNode;\n};\n\nexport const previousSibling = ({[PREV]: prev}) => {\n switch (prev ? prev.nodeType : 0) {\n case NODE_END:\n return prev[START];\n case TEXT_NODE:\n case COMMENT_NODE:\n case CDATA_SECTION_NODE:\n return prev;\n }\n return null;\n};\n\nexport const nextSibling = node => {\n const next = getEnd(node)[NEXT];\n return next && (next.nodeType === NODE_END ? null : next);\n};\n","// https://dom.spec.whatwg.org/#nondocumenttypechildnode\n// CharacterData, Element\n\nimport {ELEMENT_NODE} from '../shared/constants.js';\n\nimport {nextSibling, previousSibling} from '../shared/node.js';\n\nexport const nextElementSibling = node => {\n let next = nextSibling(node);\n while (next && next.nodeType !== ELEMENT_NODE)\n next = nextSibling(next);\n return next;\n};\n\nexport const previousElementSibling = node => {\n let prev = previousSibling(node);\n while (prev && prev.nodeType !== ELEMENT_NODE)\n prev = previousSibling(prev);\n return prev;\n};\n","// https://dom.spec.whatwg.org/#childnode\n// CharacterData, DocumentType, Element\n\nimport {ELEMENT_NODE} from '../shared/constants.js';\nimport {NEXT, PREV} from '../shared/symbols.js';\n\nimport {getEnd, setAdjacent} from '../shared/utils.js';\n\nimport {moCallback} from '../interface/mutation-observer.js';\nimport {disconnectedCallback} from '../interface/custom-element-registry.js';\n\nconst asFragment = (ownerDocument, nodes) => {\n const fragment = ownerDocument.createDocumentFragment();\n fragment.append(...nodes);\n return fragment;\n};\n\nexport const before = (node, nodes) => {\n const {ownerDocument, parentNode} = node;\n if (parentNode)\n parentNode.insertBefore(\n asFragment(ownerDocument, nodes),\n node\n );\n};\n\nexport const after = (node, nodes) => {\n const {ownerDocument, parentNode} = node;\n if (parentNode)\n parentNode.insertBefore(\n asFragment(ownerDocument, nodes),\n getEnd(node)[NEXT]\n );\n};\n\nexport const replaceWith = (node, nodes) => {\n const {ownerDocument, parentNode} = node;\n if (parentNode) {\n if (nodes.includes(node))\n replaceWith(node, [node = node.cloneNode()]);\n parentNode.insertBefore(\n asFragment(ownerDocument, nodes),\n node\n );\n node.remove();\n }\n};\n\nexport const remove = (prev, current, next) => {\n const {parentNode, nodeType} = current;\n if (prev || next) {\n setAdjacent(prev, next);\n current[PREV] = null;\n getEnd(current)[NEXT] = null;\n }\n if (parentNode) {\n current.parentNode = null;\n moCallback(current, parentNode);\n if (nodeType === ELEMENT_NODE)\n disconnectedCallback(current);\n }\n};\n","// https://dom.spec.whatwg.org/#interface-characterdata\n\nimport {NEXT, PREV, VALUE} from '../shared/symbols.js';\nimport {String} from '../shared/utils.js';\nimport {isConnected, parentElement, previousSibling, nextSibling} from '../shared/node.js';\nimport {characterDataAsJSON} from '../shared/jsdon.js';\n\nimport {previousElementSibling, nextElementSibling} from '../mixin/non-document-type-child-node.js';\nimport {before, after, replaceWith, remove} from '../mixin/child-node.js';\n\nimport {Node} from './node.js';\nimport {moCallback} from './mutation-observer.js';\n\n/**\n * @implements globalThis.CharacterData\n */\nexport class CharacterData extends Node {\n\n constructor(ownerDocument, localName, nodeType, data) {\n super(ownerDocument, localName, nodeType);\n this[VALUE] = String(data);\n }\n\n // <Mixins>\n get isConnected() { return isConnected(this); }\n get parentElement() { return parentElement(this); }\n get previousSibling() { return previousSibling(this); }\n get nextSibling() { return nextSibling(this); }\n\n get previousElementSibling() { return previousElementSibling(this); }\n get nextElementSibling() { return nextElementSibling(this); }\n\n before(...nodes) { before(this, nodes); }\n after(...nodes) { after(this, nodes); }\n replaceWith(...nodes) { replaceWith(this, nodes); }\n remove() { remove(this[PREV], this, this[NEXT]); }\n // </Mixins>\n\n // CharacterData only\n /* c8 ignore start */\n get data() { return this[VALUE]; }\n set data(value) {\n this[VALUE] = String(value);\n moCallback(this, this.parentNode);\n }\n\n get nodeValue() { return this.data; }\n set nodeValue(value) { this.data = value; }\n\n get textContent() { return this.data; }\n set textContent(value) { this.data = value; }\n\n get length() { return this.data.length; }\n\n substringData(offset, count) {\n return this.data.substr(offset, count);\n }\n\n appendData(data) {\n this.data += data;\n }\n\n insertData(offset, data) {\n const {data: t} = this;\n this.data = t.slice(0, offset) + data + t.slice(offset);\n }\n\n deleteData(offset, count) {\n const {data: t} = this;\n this.data = t.slice(0, offset) + t.slice(offset + count);\n }\n\n replaceData(offset, count, data) {\n const {data: t} = this;\n this.data = t.slice(0, offset) + data + t.slice(offset + count);\n }\n /* c8 ignore stop */\n\n toJSON() {\n const json = [];\n characterDataAsJSON(this, json);\n return json;\n }\n}\n","import {CDATA_SECTION_NODE} from '../shared/constants.js';\nimport {VALUE} from '../shared/symbols.js';\n\nimport {CharacterData} from './character-data.js';\n\n/**\n * @implements globalThis.CDATASection\n */\nexport class CDATASection extends CharacterData {\n constructor(ownerDocument, data = '') {\n super(ownerDocument, '#cdatasection', CDATA_SECTION_NODE, data);\n }\n\n cloneNode() {\n const {ownerDocument, [VALUE]: data} = this;\n return new CDATASection(ownerDocument, data);\n }\n\n toString() { return `<![CDATA[${this[VALUE]}]]>`; }\n}\n","import {COMMENT_NODE} from '../shared/constants.js';\nimport {VALUE} from '../shared/symbols.js';\n\nimport {CharacterData} from './character-data.js';\n\n/**\n * @implements globalThis.Comment\n */\nexport class Comment extends CharacterData {\n constructor(ownerDocument, data = '') {\n super(ownerDocument, '#comment', COMMENT_NODE, data);\n }\n\n cloneNode() {\n const {ownerDocument, [VALUE]: data} = this;\n return new Comment(ownerDocument, data);\n }\n\n toString() { return `<!--${this[VALUE]}-->`; }\n}\n","import { AttributeAction, SelectorType } from \"css-what\";\nconst procedure = new Map([\n [SelectorType.Universal, 50],\n [SelectorType.Tag, 30],\n [SelectorType.Attribute, 1],\n [SelectorType.Pseudo, 0],\n]);\nexport function isTraversal(token) {\n return !procedure.has(token.type);\n}\nconst attributes = new Map([\n [AttributeAction.Exists, 10],\n [AttributeAction.Equals, 8],\n [AttributeAction.Not, 7],\n [AttributeAction.Start, 6],\n [AttributeAction.End, 6],\n [AttributeAction.Any, 5],\n]);\n/**\n * Sort the parts of the passed selector,\n * as there is potential for optimization\n * (some types of selectors are faster than others)\n *\n * @param arr Selector to sort\n */\nexport default function sortByProcedure(arr) {\n const procs = arr.map(getProcedure);\n for (let i = 1; i < arr.length; i++) {\n const procNew = procs[i];\n if (procNew < 0)\n continue;\n for (let j = i - 1; j >= 0 && procNew < procs[j]; j--) {\n const token = arr[j + 1];\n arr[j + 1] = arr[j];\n arr[j] = token;\n procs[j + 1] = procs[j];\n procs[j] = procNew;\n }\n }\n}\nfunction getProcedure(token) {\n var _a, _b;\n let proc = (_a = procedure.get(token.type)) !== null && _a !== void 0 ? _a : -1;\n if (token.type === SelectorType.Attribute) {\n proc = (_b = attributes.get(token.action)) !== null && _b !== void 0 ? _b : 4;\n if (token.action === AttributeAction.Equals && token.name === \"id\") {\n // Prefer ID selectors (eg. #ID)\n proc = 9;\n }\n if (token.ignoreCase) {\n /*\n * IgnoreCase adds some overhead, prefer \"normal\" token\n * this is a binary operation, to ensure it's still an int\n */\n proc >>= 1;\n }\n }\n else if (token.type === SelectorType.Pseudo) {\n if (!token.data) {\n proc = 3;\n }\n else if (token.name === \"has\" || token.name === \"contains\") {\n proc = 0; // Expensive in any case\n }\n else if (Array.isArray(token.data)) {\n // Eg. :matches, :not\n proc = Math.min(...token.data.map((d) => Math.min(...d.map(getProcedure))));\n // If we have traversals, try to avoid executing this selector\n if (proc < 0) {\n proc = 0;\n }\n }\n else {\n proc = 2;\n }\n }\n return proc;\n}\n//# sourceMappingURL=sort.js.map","import boolbase from \"boolbase\";\n/**\n * All reserved characters in a regex, used for escaping.\n *\n * Taken from XRegExp, (c) 2007-2020 Steven Levithan under the MIT license\n * https://github.com/slevithan/xregexp/blob/95eeebeb8fac8754d54eafe2b4743661ac1cf028/src/xregexp.js#L794\n */\nconst reChars = /[-[\\]{}()*+?.,\\\\^$|#\\s]/g;\nfunction escapeRegex(value) {\n return value.replace(reChars, \"\\\\$&\");\n}\n/**\n * Attributes that are case-insensitive in HTML.\n *\n * @private\n * @see https://html.spec.whatwg.org/multipage/semantics-other.html#case-sensitivity-of-selectors\n */\nconst caseInsensitiveAttributes = new Set([\n \"accept\",\n \"accept-charset\",\n \"align\",\n \"alink\",\n \"axis\",\n \"bgcolor\",\n \"charset\",\n \"checked\",\n \"clear\",\n \"codetype\",\n \"color\",\n \"compact\",\n \"declare\",\n \"defer\",\n \"dir\",\n \"direction\",\n \"disabled\",\n \"enctype\",\n \"face\",\n \"frame\",\n \"hreflang\",\n \"http-equiv\",\n \"lang\",\n \"language\",\n \"link\",\n \"media\",\n \"method\",\n \"multiple\",\n \"nohref\",\n \"noresize\",\n \"noshade\",\n \"nowrap\",\n \"readonly\",\n \"rel\",\n \"rev\",\n \"rules\",\n \"scope\",\n \"scrolling\",\n \"selected\",\n \"shape\",\n \"target\",\n \"text\",\n \"type\",\n \"valign\",\n \"valuetype\",\n \"vlink\",\n]);\nfunction shouldIgnoreCase(selector, options) {\n return typeof selector.ignoreCase === \"boolean\"\n ? selector.ignoreCase\n : selector.ignoreCase === \"quirks\"\n ? !!options.quirksMode\n : !options.xmlMode && caseInsensitiveAttributes.has(selector.name);\n}\n/**\n * Attribute selectors\n */\nexport const attributeRules = {\n equals(next, data, options) {\n const { adapter } = options;\n const { name } = data;\n let { value } = data;\n if (shouldIgnoreCase(data, options)) {\n value = value.toLowerCase();\n return (elem) => {\n const attr = adapter.getAttributeValue(elem, name);\n return (attr != null &&\n attr.length === value.length &&\n attr.toLowerCase() === value &&\n next(elem));\n };\n }\n return (elem) => adapter.getAttributeValue(elem, name) === value && next(elem);\n },\n hyphen(next, data, options) {\n const { adapter } = options;\n const { name } = data;\n let { value } = data;\n const len = value.length;\n if (shouldIgnoreCase(data, options)) {\n value = value.toLowerCase();\n return function hyphenIC(elem) {\n const attr = adapter.getAttributeValue(elem, name);\n return (attr != null &&\n (attr.length === len || attr.charAt(len) === \"-\") &&\n attr.substr(0, len).toLowerCase() === value &&\n next(elem));\n };\n }\n return function hyphen(elem) {\n const attr = adapter.getAttributeValue(elem, name);\n return (attr != null &&\n (attr.length === len || attr.charAt(len) === \"-\") &&\n attr.substr(0, len) === value &&\n next(elem));\n };\n },\n element(next, data, options) {\n const { adapter } = options;\n const { name, value } = data;\n if (/\\s/.test(value)) {\n return boolbase.falseFunc;\n }\n const regex = new RegExp(`(?:^|\\\\s)${escapeRegex(value)}(?:$|\\\\s)`, shouldIgnoreCase(data, options) ? \"i\" : \"\");\n return function element(elem) {\n const attr = adapter.getAttributeValue(elem, name);\n return (attr != null &&\n attr.length >= value.length &&\n regex.test(attr) &&\n next(elem));\n };\n },\n exists(next, { name }, { adapter }) {\n return (elem) => adapter.hasAttrib(elem, name) && next(elem);\n },\n start(next, data, options) {\n const { adapter } = options;\n const { name } = data;\n let { value } = data;\n const len = value.length;\n if (len === 0) {\n return boolbase.falseFunc;\n }\n if (shouldIgnoreCase(data, options)) {\n value = value.toLowerCase();\n return (elem) => {\n const attr = adapter.getAttributeValue(elem, name);\n return (attr != null &&\n attr.length >= len &&\n attr.substr(0, len).toLowerCase() === value &&\n next(elem));\n };\n }\n return (elem) => {\n var _a;\n return !!((_a = adapter.getAttributeValue(elem, name)) === null || _a === void 0 ? void 0 : _a.startsWith(value)) &&\n next(elem);\n };\n },\n end(next, data, options) {\n const { adapter } = options;\n const { name } = data;\n let { value } = data;\n const len = -value.length;\n if (len === 0) {\n return boolbase.falseFunc;\n }\n if (shouldIgnoreCase(data, options)) {\n value = value.toLowerCase();\n return (elem) => {\n var _a;\n return ((_a = adapter\n .getAttributeValue(elem, name)) === null || _a === void 0 ? void 0 : _a.substr(len).toLowerCase()) === value && next(elem);\n };\n }\n return (elem) => {\n var _a;\n return !!((_a = adapter.getAttributeValue(elem, name)) === null || _a === void 0 ? void 0 : _a.endsWith(value)) &&\n next(elem);\n };\n },\n any(next, data, options) {\n const { adapter } = options;\n const { name, value } = data;\n if (value === \"\") {\n return boolbase.falseFunc;\n }\n if (shouldIgnoreCase(data, options)) {\n const regex = new RegExp(escapeRegex(value), \"i\");\n return function anyIC(elem) {\n const attr = adapter.getAttributeValue(elem, name);\n return (attr != null &&\n attr.length >= value.length &&\n regex.test(attr) &&\n next(elem));\n };\n }\n return (elem) => {\n var _a;\n return !!((_a = adapter.getAttributeValue(elem, name)) === null || _a === void 0 ? void 0 : _a.includes(value)) &&\n next(elem);\n };\n },\n not(next, data, options) {\n const { adapter } = options;\n const { name } = data;\n let { value } = data;\n if (value === \"\") {\n return (elem) => !!adapter.getAttributeValue(elem, name) && next(elem);\n }\n else if (shouldIgnoreCase(data, options)) {\n value = value.toLowerCase();\n return (elem) => {\n const attr = adapter.getAttributeValue(elem, name);\n return ((attr == null ||\n attr.length !== value.length ||\n attr.toLowerCase() !== value) &&\n next(elem));\n };\n }\n return (elem) => adapter.getAttributeValue(elem, name) !== value && next(elem);\n },\n};\n//# sourceMappingURL=attributes.js.map","// Following http://www.w3.org/TR/css3-selectors/#nth-child-pseudo\n// Whitespace as per https://www.w3.org/TR/selectors-3/#lex is \" \\t\\r\\n\\f\"\nconst whitespace = new Set([9, 10, 12, 13, 32]);\nconst ZERO = \"0\".charCodeAt(0);\nconst NINE = \"9\".charCodeAt(0);\n/**\n * Parses an expression.\n *\n * @throws An `Error` if parsing fails.\n * @returns An array containing the integer step size and the integer offset of the nth rule.\n * @example nthCheck.parse(\"2n+3\"); // returns [2, 3]\n */\nexport function parse(formula) {\n formula = formula.trim().toLowerCase();\n if (formula === \"even\") {\n return [2, 0];\n }\n else if (formula === \"odd\") {\n return [2, 1];\n }\n // Parse [ ['-'|'+']? INTEGER? {N} [ S* ['-'|'+'] S* INTEGER ]?\n let idx = 0;\n let a = 0;\n let sign = readSign();\n let number = readNumber();\n if (idx < formula.length && formula.charAt(idx) === \"n\") {\n idx++;\n a = sign * (number !== null && number !== void 0 ? number : 1);\n skipWhitespace();\n if (idx < formula.length) {\n sign = readSign();\n skipWhitespace();\n number = readNumber();\n }\n else {\n sign = number = 0;\n }\n }\n // Throw if there is anything else\n if (number === null || idx < formula.length) {\n throw new Error(`n-th rule couldn't be parsed ('${formula}')`);\n }\n return [a, sign * number];\n function readSign() {\n if (formula.charAt(idx) === \"-\") {\n idx++;\n return -1;\n }\n if (formula.charAt(idx) === \"+\") {\n idx++;\n }\n return 1;\n }\n function readNumber() {\n const start = idx;\n let value = 0;\n while (idx < formula.length &&\n formula.charCodeAt(idx) >= ZERO &&\n formula.charCodeAt(idx) <= NINE) {\n value = value * 10 + (formula.charCodeAt(idx) - ZERO);\n idx++;\n }\n // Return `null` if we didn't read anything.\n return idx === start ? null : value;\n }\n function skipWhitespace() {\n while (idx < formula.length &&\n whitespace.has(formula.charCodeAt(idx))) {\n idx++;\n }\n }\n}\n//# sourceMappingURL=parse.js.map","import boolbase from \"boolbase\";\n/**\n * Returns a function that checks if an elements index matches the given rule\n * highly optimized to return the fastest solution.\n *\n * @param parsed A tuple [a, b], as returned by `parse`.\n * @returns A highly optimized function that returns whether an index matches the nth-check.\n * @example\n *\n * ```js\n * const check = nthCheck.compile([2, 3]);\n *\n * check(0); // `false`\n * check(1); // `false`\n * check(2); // `true`\n * check(3); // `false`\n * check(4); // `true`\n * check(5); // `false`\n * check(6); // `true`\n * ```\n */\nexport function compile(parsed) {\n const a = parsed[0];\n // Subtract 1 from `b`, to convert from one- to zero-indexed.\n const b = parsed[1] - 1;\n /*\n * When `b <= 0`, `a * n` won't be lead to any matches for `a < 0`.\n * Besides, the specification states that no elements are\n * matched when `a` and `b` are 0.\n *\n * `b < 0` here as we subtracted 1 from `b` above.\n */\n if (b < 0 && a <= 0)\n return boolbase.falseFunc;\n // When `a` is in the range -1..1, it matches any element (so only `b` is checked).\n if (a === -1)\n return (index) => index <= b;\n if (a === 0)\n return (index) => index === b;\n // When `b <= 0` and `a === 1`, they match any element.\n if (a === 1)\n return b < 0 ? boolbase.trueFunc : (index) => index >= b;\n /*\n * Otherwise, modulo can be used to check if there is a match.\n *\n * Modulo doesn't care about the sign, so let's use `a`s absolute value.\n */\n const absA = Math.abs(a);\n // Get `b mod a`, + a if this is negative.\n const bMod = ((b % absA) + absA) % absA;\n return a > 1\n ? (index) => index >= b && index % absA === bMod\n : (index) => index <= b && index % absA === bMod;\n}\n/**\n * Returns a function that produces a monotonously increasing sequence of indices.\n *\n * If the sequence has an end, the returned function will return `null` after\n * the last index in the sequence.\n *\n * @param parsed A tuple [a, b], as returned by `parse`.\n * @returns A function that produces a sequence of indices.\n * @example <caption>Always increasing (2n+3)</caption>\n *\n * ```js\n * const gen = nthCheck.generate([2, 3])\n *\n * gen() // `1`\n * gen() // `3`\n * gen() // `5`\n * gen() // `8`\n * gen() // `11`\n * ```\n *\n * @example <caption>With end value (-2n+10)</caption>\n *\n * ```js\n *\n * const gen = nthCheck.generate([-2, 5]);\n *\n * gen() // 0\n * gen() // 2\n * gen() // 4\n * gen() // null\n * ```\n */\nexport function generate(parsed) {\n const a = parsed[0];\n // Subtract 1 from `b`, to convert from one- to zero-indexed.\n let b = parsed[1] - 1;\n let n = 0;\n // Make sure to always return an increasing sequence\n if (a < 0) {\n const aPos = -a;\n // Get `b mod a`\n const minValue = ((b % aPos) + aPos) % aPos;\n return () => {\n const val = minValue + aPos * n++;\n return val > b ? null : val;\n };\n }\n if (a === 0)\n return b < 0\n ? // There are no result — always return `null`\n () => null\n : // Return `b` exactly once\n () => (n++ === 0 ? b : null);\n if (b < 0) {\n b += a * Math.ceil(-b / a);\n }\n return () => a * n++ + b;\n}\n//# sourceMappingURL=compile.js.map","import { parse } from \"./parse.js\";\nimport { compile, generate } from \"./compile.js\";\nexport { parse, compile, generate };\n/**\n * Parses and compiles a formula to a highly optimized function.\n * Combination of {@link parse} and {@link compile}.\n *\n * If the formula doesn't match any elements,\n * it returns [`boolbase`](https://github.com/fb55/boolbase)'s `falseFunc`.\n * Otherwise, a function accepting an _index_ is returned, which returns\n * whether or not the passed _index_ matches the formula.\n *\n * Note: The nth-rule starts counting at `1`, the returned function at `0`.\n *\n * @param formula The formula to compile.\n * @example\n * const check = nthCheck(\"2n+3\");\n *\n * check(0); // `false`\n * check(1); // `false`\n * check(2); // `true`\n * check(3); // `false`\n * check(4); // `true`\n * check(5); // `false`\n * check(6); // `true`\n */\nexport default function nthCheck(formula) {\n return compile(parse(formula));\n}\n/**\n * Parses and compiles a formula to a generator that produces a sequence of indices.\n * Combination of {@link parse} and {@link generate}.\n *\n * @param formula The formula to compile.\n * @returns A function that produces a sequence of indices.\n * @example <caption>Always increasing</caption>\n *\n * ```js\n * const gen = nthCheck.sequence('2n+3')\n *\n * gen() // `1`\n * gen() // `3`\n * gen() // `5`\n * gen() // `8`\n * gen() // `11`\n * ```\n *\n * @example <caption>With end value</caption>\n *\n * ```js\n *\n * const gen = nthCheck.sequence('-2n+5');\n *\n * gen() // 0\n * gen() // 2\n * gen() // 4\n * gen() // null\n * ```\n */\nexport function sequence(formula) {\n return generate(parse(formula));\n}\n//# sourceMappingURL=index.js.map","import getNCheck from \"nth-check\";\nimport boolbase from \"boolbase\";\nfunction getChildFunc(next, adapter) {\n return (elem) => {\n const parent = adapter.getParent(elem);\n return parent != null && adapter.isTag(parent) && next(elem);\n };\n}\nexport const filters = {\n contains(next, text, { adapter }) {\n return function contains(elem) {\n return next(elem) && adapter.getText(elem).includes(text);\n };\n },\n icontains(next, text, { adapter }) {\n const itext = text.toLowerCase();\n return function icontains(elem) {\n return (next(elem) &&\n adapter.getText(elem).toLowerCase().includes(itext));\n };\n },\n // Location specific methods\n \"nth-child\"(next, rule, { adapter, equals }) {\n const func = getNCheck(rule);\n if (func === boolbase.falseFunc)\n return boolbase.falseFunc;\n if (func === boolbase.trueFunc)\n return getChildFunc(next, adapter);\n return function nthChild(elem) {\n const siblings = adapter.getSiblings(elem);\n let pos = 0;\n for (let i = 0; i < siblings.length; i++) {\n if (equals(elem, siblings[i]))\n break;\n if (adapter.isTag(siblings[i])) {\n pos++;\n }\n }\n return func(pos) && next(elem);\n };\n },\n \"nth-last-child\"(next, rule, { adapter, equals }) {\n const func = getNCheck(rule);\n if (func === boolbase.falseFunc)\n return boolbase.falseFunc;\n if (func === boolbase.trueFunc)\n return getChildFunc(next, adapter);\n return function nthLastChild(elem) {\n const siblings = adapter.getSiblings(elem);\n let pos = 0;\n for (let i = siblings.length - 1; i >= 0; i--) {\n if (equals(elem, siblings[i]))\n break;\n if (adapter.isTag(siblings[i])) {\n pos++;\n }\n }\n return func(pos) && next(elem);\n };\n },\n \"nth-of-type\"(next, rule, { adapter, equals }) {\n const func = getNCheck(rule);\n if (func === boolbase.falseFunc)\n return boolbase.falseFunc;\n if (func === boolbase.trueFunc)\n return getChildFunc(next, adapter);\n return function nthOfType(elem) {\n const siblings = adapter.getSiblings(elem);\n let pos = 0;\n for (let i = 0; i < siblings.length; i++) {\n const currentSibling = siblings[i];\n if (equals(elem, currentSibling))\n break;\n if (adapter.isTag(currentSibling) &&\n adapter.getName(currentSibling) === adapter.getName(elem)) {\n pos++;\n }\n }\n return func(pos) && next(elem);\n };\n },\n \"nth-last-of-type\"(next, rule, { adapter, equals }) {\n const func = getNCheck(rule);\n if (func === boolbase.falseFunc)\n return boolbase.falseFunc;\n if (func === boolbase.trueFunc)\n return getChildFunc(next, adapter);\n return function nthLastOfType(elem) {\n const siblings = adapter.getSiblings(elem);\n let pos = 0;\n for (let i = siblings.length - 1; i >= 0; i--) {\n const currentSibling = siblings[i];\n if (equals(elem, currentSibling))\n break;\n if (adapter.isTag(currentSibling) &&\n adapter.getName(currentSibling) === adapter.getName(elem)) {\n pos++;\n }\n }\n return func(pos) && next(elem);\n };\n },\n // TODO determine the actual root element\n root(next, _rule, { adapter }) {\n return (elem) => {\n const parent = adapter.getParent(elem);\n return (parent == null || !adapter.isTag(parent)) && next(elem);\n };\n },\n scope(next, rule, options, context) {\n const { equals } = options;\n if (!context || context.length === 0) {\n // Equivalent to :root\n return filters[\"root\"](next, rule, options);\n }\n if (context.length === 1) {\n // NOTE: can't be unpacked, as :has uses this for side-effects\n return (elem) => equals(context[0], elem) && next(elem);\n }\n return (elem) => context.includes(elem) && next(elem);\n },\n hover: dynamicStatePseudo(\"isHovered\"),\n visited: dynamicStatePseudo(\"isVisited\"),\n active: dynamicStatePseudo(\"isActive\"),\n};\n/**\n * Dynamic state pseudos. These depend on optional Adapter methods.\n *\n * @param name The name of the adapter method to call.\n * @returns Pseudo for the `filters` object.\n */\nfunction dynamicStatePseudo(name) {\n return function dynamicPseudo(next, _rule, { adapter }) {\n const func = adapter[name];\n if (typeof func !== \"function\") {\n return boolbase.falseFunc;\n }\n return function active(elem) {\n return func(elem) && next(elem);\n };\n };\n}\n//# sourceMappingURL=filters.js.map","// While filters are precompiled, pseudos get called when they are needed\nexport const pseudos = {\n empty(elem, { adapter }) {\n return !adapter.getChildren(elem).some((elem) => \n // FIXME: `getText` call is potentially expensive.\n adapter.isTag(elem) || adapter.getText(elem) !== \"\");\n },\n \"first-child\"(elem, { adapter, equals }) {\n if (adapter.prevElementSibling) {\n return adapter.prevElementSibling(elem) == null;\n }\n const firstChild = adapter\n .getSiblings(elem)\n .find((elem) => adapter.isTag(elem));\n return firstChild != null && equals(elem, firstChild);\n },\n \"last-child\"(elem, { adapter, equals }) {\n const siblings = adapter.getSiblings(elem);\n for (let i = siblings.length - 1; i >= 0; i--) {\n if (equals(elem, siblings[i]))\n return true;\n if (adapter.isTag(siblings[i]))\n break;\n }\n return false;\n },\n \"first-of-type\"(elem, { adapter, equals }) {\n const siblings = adapter.getSiblings(elem);\n const elemName = adapter.getName(elem);\n for (let i = 0; i < siblings.length; i++) {\n const currentSibling = siblings[i];\n if (equals(elem, currentSibling))\n return true;\n if (adapter.isTag(currentSibling) &&\n adapter.getName(currentSibling) === elemName) {\n break;\n }\n }\n return false;\n },\n \"last-of-type\"(elem, { adapter, equals }) {\n const siblings = adapter.getSiblings(elem);\n const elemName = adapter.getName(elem);\n for (let i = siblings.length - 1; i >= 0; i--) {\n const currentSibling = siblings[i];\n if (equals(elem, currentSibling))\n return true;\n if (adapter.isTag(currentSibling) &&\n adapter.getName(currentSibling) === elemName) {\n break;\n }\n }\n return false;\n },\n \"only-of-type\"(elem, { adapter, equals }) {\n const elemName = adapter.getName(elem);\n return adapter\n .getSiblings(elem)\n .every((sibling) => equals(elem, sibling) ||\n !adapter.isTag(sibling) ||\n adapter.getName(sibling) !== elemName);\n },\n \"only-child\"(elem, { adapter, equals }) {\n return adapter\n .getSiblings(elem)\n .every((sibling) => equals(elem, sibling) || !adapter.isTag(sibling));\n },\n};\nexport function verifyPseudoArgs(func, name, subselect, argIndex) {\n if (subselect === null) {\n if (func.length > argIndex) {\n throw new Error(`Pseudo-class :${name} requires an argument`);\n }\n }\n else if (func.length === argIndex) {\n throw new Error(`Pseudo-class :${name} doesn't have any arguments`);\n }\n}\n//# sourceMappingURL=pseudos.js.map","/**\n * Aliases are pseudos that are expressed as selectors.\n */\nexport const aliases = {\n // Links\n \"any-link\": \":is(a, area, link)[href]\",\n link: \":any-link:not(:visited)\",\n // Forms\n // https://html.spec.whatwg.org/multipage/scripting.html#disabled-elements\n disabled: `:is(\n :is(button, input, select, textarea, optgroup, option)[disabled],\n optgroup[disabled] > option,\n fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *)\n )`,\n enabled: \":not(:disabled)\",\n checked: \":is(:is(input[type=radio], input[type=checkbox])[checked], option:selected)\",\n required: \":is(input, select, textarea)[required]\",\n optional: \":is(input, select, textarea):not([required])\",\n // JQuery extensions\n // https://html.spec.whatwg.org/multipage/form-elements.html#concept-option-selectedness\n selected: \"option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)\",\n checkbox: \"[type=checkbox]\",\n file: \"[type=file]\",\n password: \"[type=password]\",\n radio: \"[type=radio]\",\n reset: \"[type=reset]\",\n image: \"[type=image]\",\n submit: \"[type=submit]\",\n parent: \":not(:empty)\",\n header: \":is(h1, h2, h3, h4, h5, h6)\",\n button: \":is(button, input[type=button])\",\n input: \":is(input, textarea, select, button)\",\n text: \"input:is(:not([type!='']), [type=text])\",\n};\n//# sourceMappingURL=aliases.js.map","import boolbase from \"boolbase\";\nimport { isTraversal } from \"../sort.js\";\n/** Used as a placeholder for :has. Will be replaced with the actual element. */\nexport const PLACEHOLDER_ELEMENT = {};\nexport function ensureIsTag(next, adapter) {\n if (next === boolbase.falseFunc)\n return boolbase.falseFunc;\n return (elem) => adapter.isTag(elem) && next(elem);\n}\nexport function getNextSiblings(elem, adapter) {\n const siblings = adapter.getSiblings(elem);\n if (siblings.length <= 1)\n return [];\n const elemIndex = siblings.indexOf(elem);\n if (elemIndex < 0 || elemIndex === siblings.length - 1)\n return [];\n return siblings.slice(elemIndex + 1).filter(adapter.isTag);\n}\nfunction copyOptions(options) {\n // Not copied: context, rootFunc\n return {\n xmlMode: !!options.xmlMode,\n lowerCaseAttributeNames: !!options.lowerCaseAttributeNames,\n lowerCaseTags: !!options.lowerCaseTags,\n quirksMode: !!options.quirksMode,\n cacheResults: !!options.cacheResults,\n pseudos: options.pseudos,\n adapter: options.adapter,\n equals: options.equals,\n };\n}\nconst is = (next, token, options, context, compileToken) => {\n const func = compileToken(token, copyOptions(options), context);\n return func === boolbase.trueFunc\n ? next\n : func === boolbase.falseFunc\n ? boolbase.falseFunc\n : (elem) => func(elem) && next(elem);\n};\n/*\n * :not, :has, :is, :matches and :where have to compile selectors\n * doing this in src/pseudos.ts would lead to circular dependencies,\n * so we add them here\n */\nexport const subselects = {\n is,\n /**\n * `:matches` and `:where` are aliases for `:is`.\n */\n matches: is,\n where: is,\n not(next, token, options, context, compileToken) {\n const func = compileToken(token, copyOptions(options), context);\n return func === boolbase.falseFunc\n ? next\n : func === boolbase.trueFunc\n ? boolbase.falseFunc\n : (elem) => !func(elem) && next(elem);\n },\n has(next, subselect, options, _context, compileToken) {\n const { adapter } = options;\n const opts = copyOptions(options);\n opts.relativeSelector = true;\n const context = subselect.some((s) => s.some(isTraversal))\n ? // Used as a placeholder. Will be replaced with the actual element.\n [PLACEHOLDER_ELEMENT]\n : undefined;\n const compiled = compileToken(subselect, opts, context);\n if (compiled === boolbase.falseFunc)\n return boolbase.falseFunc;\n const hasElement = ensureIsTag(compiled, adapter);\n // If `compiled` is `trueFunc`, we can skip this.\n if (context && compiled !== boolbase.trueFunc) {\n /*\n * `shouldTestNextSiblings` will only be true if the query starts with\n * a traversal (sibling or adjacent). That means we will always have a context.\n */\n const { shouldTestNextSiblings = false } = compiled;\n return (elem) => {\n if (!next(elem))\n return false;\n context[0] = elem;\n const childs = adapter.getChildren(elem);\n const nextElements = shouldTestNextSiblings\n ? [...childs, ...getNextSiblings(elem, adapter)]\n : childs;\n return adapter.existsOne(hasElement, nextElements);\n };\n }\n return (elem) => next(elem) &&\n adapter.existsOne(hasElement, adapter.getChildren(elem));\n },\n};\n//# sourceMappingURL=subselects.js.map","import { parse } from \"css-what\";\nimport { filters } from \"./filters.js\";\nimport { pseudos, verifyPseudoArgs } from \"./pseudos.js\";\nimport { aliases } from \"./aliases.js\";\nimport { subselects } from \"./subselects.js\";\nexport { filters, pseudos, aliases };\nexport function compilePseudoSelector(next, selector, options, context, compileToken) {\n var _a;\n const { name, data } = selector;\n if (Array.isArray(data)) {\n if (!(name in subselects)) {\n throw new Error(`Unknown pseudo-class :${name}(${data})`);\n }\n return subselects[name](next, data, options, context, compileToken);\n }\n const userPseudo = (_a = options.pseudos) === null || _a === void 0 ? void 0 : _a[name];\n const stringPseudo = typeof userPseudo === \"string\" ? userPseudo : aliases[name];\n if (typeof stringPseudo === \"string\") {\n if (data != null) {\n throw new Error(`Pseudo ${name} doesn't have any arguments`);\n }\n // The alias has to be parsed here, to make sure options are respected.\n const alias = parse(stringPseudo);\n return subselects[\"is\"](next, alias, options, context, compileToken);\n }\n if (typeof userPseudo === \"function\") {\n verifyPseudoArgs(userPseudo, name, data, 1);\n return (elem) => userPseudo(elem, data) && next(elem);\n }\n if (name in filters) {\n return filters[name](next, data, options, context);\n }\n if (name in pseudos) {\n const pseudo = pseudos[name];\n verifyPseudoArgs(pseudo, name, data, 2);\n return (elem) => pseudo(elem, options, data) && next(elem);\n }\n throw new Error(`Unknown pseudo-class :${name}`);\n}\n//# sourceMappingURL=index.js.map","import { attributeRules } from \"./attributes.js\";\nimport { compilePseudoSelector } from \"./pseudo-selectors/index.js\";\nimport { SelectorType } from \"css-what\";\nfunction getElementParent(node, adapter) {\n const parent = adapter.getParent(node);\n if (parent && adapter.isTag(parent)) {\n return parent;\n }\n return null;\n}\n/*\n * All available rules\n */\nexport function compileGeneralSelector(next, selector, options, context, compileToken) {\n const { adapter, equals } = options;\n switch (selector.type) {\n case SelectorType.PseudoElement: {\n throw new Error(\"Pseudo-elements are not supported by css-select\");\n }\n case SelectorType.ColumnCombinator: {\n throw new Error(\"Column combinators are not yet supported by css-select\");\n }\n case SelectorType.Attribute: {\n if (selector.namespace != null) {\n throw new Error(\"Namespaced attributes are not yet supported by css-select\");\n }\n if (!options.xmlMode || options.lowerCaseAttributeNames) {\n selector.name = selector.name.toLowerCase();\n }\n return attributeRules[selector.action](next, selector, options);\n }\n case SelectorType.Pseudo: {\n return compilePseudoSelector(next, selector, options, context, compileToken);\n }\n // Tags\n case SelectorType.Tag: {\n if (selector.namespace != null) {\n throw new Error(\"Namespaced tag names are not yet supported by css-select\");\n }\n let { name } = selector;\n if (!options.xmlMode || options.lowerCaseTags) {\n name = name.toLowerCase();\n }\n return function tag(elem) {\n return adapter.getName(elem) === name && next(elem);\n };\n }\n // Traversal\n case SelectorType.Descendant: {\n if (options.cacheResults === false ||\n typeof WeakSet === \"undefined\") {\n return function descendant(elem) {\n let current = elem;\n while ((current = getElementParent(current, adapter))) {\n if (next(current)) {\n return true;\n }\n }\n return false;\n };\n }\n // @ts-expect-error `ElementNode` is not extending object\n const isFalseCache = new WeakSet();\n return function cachedDescendant(elem) {\n let current = elem;\n while ((current = getElementParent(current, adapter))) {\n if (!isFalseCache.has(current)) {\n if (adapter.isTag(current) && next(current)) {\n return true;\n }\n isFalseCache.add(current);\n }\n }\n return false;\n };\n }\n case \"_flexibleDescendant\": {\n // Include element itself, only used while querying an array\n return function flexibleDescendant(elem) {\n let current = elem;\n do {\n if (next(current))\n return true;\n } while ((current = getElementParent(current, adapter)));\n return false;\n };\n }\n case SelectorType.Parent: {\n return function parent(elem) {\n return adapter\n .getChildren(elem)\n .some((elem) => adapter.isTag(elem) && next(elem));\n };\n }\n case SelectorType.Child: {\n return function child(elem) {\n const parent = adapter.getParent(elem);\n return parent != null && adapter.isTag(parent) && next(parent);\n };\n }\n case SelectorType.Sibling: {\n return function sibling(elem) {\n const siblings = adapter.getSiblings(elem);\n for (let i = 0; i < siblings.length; i++) {\n const currentSibling = siblings[i];\n if (equals(elem, currentSibling))\n break;\n if (adapter.isTag(currentSibling) && next(currentSibling)) {\n return true;\n }\n }\n return false;\n };\n }\n case SelectorType.Adjacent: {\n if (adapter.prevElementSibling) {\n return function adjacent(elem) {\n const previous = adapter.prevElementSibling(elem);\n return previous != null && next(previous);\n };\n }\n return function adjacent(elem) {\n const siblings = adapter.getSiblings(elem);\n let lastElement;\n for (let i = 0; i < siblings.length; i++) {\n const currentSibling = siblings[i];\n if (equals(elem, currentSibling))\n break;\n if (adapter.isTag(currentSibling)) {\n lastElement = currentSibling;\n }\n }\n return !!lastElement && next(lastElement);\n };\n }\n case SelectorType.Universal: {\n if (selector.namespace != null && selector.namespace !== \"*\") {\n throw new Error(\"Namespaced universal selectors are not yet supported by css-select\");\n }\n return next;\n }\n }\n}\n//# sourceMappingURL=general.js.map","import { parse, SelectorType } from \"css-what\";\nimport boolbase from \"boolbase\";\nimport sortRules, { isTraversal } from \"./sort.js\";\nimport { compileGeneralSelector } from \"./general.js\";\nimport { ensureIsTag, PLACEHOLDER_ELEMENT, } from \"./pseudo-selectors/subselects.js\";\n/**\n * Compiles a selector to an executable function.\n *\n * @param selector Selector to compile.\n * @param options Compilation options.\n * @param context Optional context for the selector.\n */\nexport function compile(selector, options, context) {\n const next = compileUnsafe(selector, options, context);\n return ensureIsTag(next, options.adapter);\n}\nexport function compileUnsafe(selector, options, context) {\n const token = typeof selector === \"string\" ? parse(selector) : selector;\n return compileToken(token, options, context);\n}\nfunction includesScopePseudo(t) {\n return (t.type === SelectorType.Pseudo &&\n (t.name === \"scope\" ||\n (Array.isArray(t.data) &&\n t.data.some((data) => data.some(includesScopePseudo)))));\n}\nconst DESCENDANT_TOKEN = { type: SelectorType.Descendant };\nconst FLEXIBLE_DESCENDANT_TOKEN = {\n type: \"_flexibleDescendant\",\n};\nconst SCOPE_TOKEN = {\n type: SelectorType.Pseudo,\n name: \"scope\",\n data: null,\n};\n/*\n * CSS 4 Spec (Draft): 3.4.1. Absolutizing a Relative Selector\n * http://www.w3.org/TR/selectors4/#absolutizing\n */\nfunction absolutize(token, { adapter }, context) {\n // TODO Use better check if the context is a document\n const hasContext = !!(context === null || context === void 0 ? void 0 : context.every((e) => {\n const parent = adapter.isTag(e) && adapter.getParent(e);\n return e === PLACEHOLDER_ELEMENT || (parent && adapter.isTag(parent));\n }));\n for (const t of token) {\n if (t.length > 0 &&\n isTraversal(t[0]) &&\n t[0].type !== SelectorType.Descendant) {\n // Don't continue in else branch\n }\n else if (hasContext && !t.some(includesScopePseudo)) {\n t.unshift(DESCENDANT_TOKEN);\n }\n else {\n continue;\n }\n t.unshift(SCOPE_TOKEN);\n }\n}\nexport function compileToken(token, options, context) {\n var _a;\n token.forEach(sortRules);\n context = (_a = options.context) !== null && _a !== void 0 ? _a : context;\n const isArrayContext = Array.isArray(context);\n const finalContext = context && (Array.isArray(context) ? context : [context]);\n // Check if the selector is relative\n if (options.relativeSelector !== false) {\n absolutize(token, options, finalContext);\n }\n else if (token.some((t) => t.length > 0 && isTraversal(t[0]))) {\n throw new Error(\"Relative selectors are not allowed when the `relativeSelector` option is disabled\");\n }\n let shouldTestNextSiblings = false;\n const query = token\n .map((rules) => {\n if (rules.length >= 2) {\n const [first, second] = rules;\n if (first.type !== SelectorType.Pseudo ||\n first.name !== \"scope\") {\n // Ignore\n }\n else if (isArrayContext &&\n second.type === SelectorType.Descendant) {\n rules[1] = FLEXIBLE_DESCENDANT_TOKEN;\n }\n else if (second.type === SelectorType.Adjacent ||\n second.type === SelectorType.Sibling) {\n shouldTestNextSiblings = true;\n }\n }\n return compileRules(rules, options, finalContext);\n })\n .reduce(reduceRules, boolbase.falseFunc);\n query.shouldTestNextSiblings = shouldTestNextSiblings;\n return query;\n}\nfunction compileRules(rules, options, context) {\n var _a;\n return rules.reduce((previous, rule) => previous === boolbase.falseFunc\n ? boolbase.falseFunc\n : compileGeneralSelector(previous, rule, options, context, compileToken), (_a = options.rootFunc) !== null && _a !== void 0 ? _a : boolbase.trueFunc);\n}\nfunction reduceRules(a, b) {\n if (b === boolbase.falseFunc || a === boolbase.trueFunc) {\n return a;\n }\n if (a === boolbase.falseFunc || b === boolbase.trueFunc) {\n return b;\n }\n return function combine(elem) {\n return a(elem) || b(elem);\n };\n}\n//# sourceMappingURL=compile.js.map","import * as DomUtils from \"domutils\";\nimport boolbase from \"boolbase\";\nimport { compile as compileRaw, compileUnsafe, compileToken, } from \"./compile.js\";\nimport { getNextSiblings } from \"./pseudo-selectors/subselects.js\";\nconst defaultEquals = (a, b) => a === b;\nconst defaultOptions = {\n adapter: DomUtils,\n equals: defaultEquals,\n};\nfunction convertOptionFormats(options) {\n var _a, _b, _c, _d;\n /*\n * We force one format of options to the other one.\n */\n // @ts-expect-error Default options may have incompatible `Node` / `ElementNode`.\n const opts = options !== null && options !== void 0 ? options : defaultOptions;\n // @ts-expect-error Same as above.\n (_a = opts.adapter) !== null && _a !== void 0 ? _a : (opts.adapter = DomUtils);\n // @ts-expect-error `equals` does not exist on `Options`\n (_b = opts.equals) !== null && _b !== void 0 ? _b : (opts.equals = (_d = (_c = opts.adapter) === null || _c === void 0 ? void 0 : _c.equals) !== null && _d !== void 0 ? _d : defaultEquals);\n return opts;\n}\nfunction wrapCompile(func) {\n return function addAdapter(selector, options, context) {\n const opts = convertOptionFormats(options);\n return func(selector, opts, context);\n };\n}\n/**\n * Compiles the query, returns a function.\n */\nexport const compile = wrapCompile(compileRaw);\nexport const _compileUnsafe = wrapCompile(compileUnsafe);\nexport const _compileToken = wrapCompile(compileToken);\nfunction getSelectorFunc(searchFunc) {\n return function select(query, elements, options) {\n const opts = convertOptionFormats(options);\n if (typeof query !== \"function\") {\n query = compileUnsafe(query, opts, elements);\n }\n const filteredElements = prepareContext(elements, opts.adapter, query.shouldTestNextSiblings);\n return searchFunc(query, filteredElements, opts);\n };\n}\nexport function prepareContext(elems, adapter, shouldTestNextSiblings = false) {\n /*\n * Add siblings if the query requires them.\n * See https://github.com/fb55/css-select/pull/43#issuecomment-225414692\n */\n if (shouldTestNextSiblings) {\n elems = appendNextSiblings(elems, adapter);\n }\n return Array.isArray(elems)\n ? adapter.removeSubsets(elems)\n : adapter.getChildren(elems);\n}\nfunction appendNextSiblings(elem, adapter) {\n // Order matters because jQuery seems to check the children before the siblings\n const elems = Array.isArray(elem) ? elem.slice(0) : [elem];\n const elemsLength = elems.length;\n for (let i = 0; i < elemsLength; i++) {\n const nextSiblings = getNextSiblings(elems[i], adapter);\n elems.push(...nextSiblings);\n }\n return elems;\n}\n/**\n * @template Node The generic Node type for the DOM adapter being used.\n * @template ElementNode The Node type for elements for the DOM adapter being used.\n * @param elems Elements to query. If it is an element, its children will be queried..\n * @param query can be either a CSS selector string or a compiled query function.\n * @param [options] options for querying the document.\n * @see compile for supported selector queries.\n * @returns All matching elements.\n *\n */\nexport const selectAll = getSelectorFunc((query, elems, options) => query === boolbase.falseFunc || !elems || elems.length === 0\n ? []\n : options.adapter.findAll(query, elems));\n/**\n * @template Node The generic Node type for the DOM adapter being used.\n * @template ElementNode The Node type for elements for the DOM adapter being used.\n * @param elems Elements to query. If it is an element, its children will be queried..\n * @param query can be either a CSS selector string or a compiled query function.\n * @param [options] options for querying the document.\n * @see compile for supported selector queries.\n * @returns the first match, or null if there was no match.\n */\nexport const selectOne = getSelectorFunc((query, elems, options) => query === boolbase.falseFunc || !elems || elems.length === 0\n ? null\n : options.adapter.findOne(query, elems));\n/**\n * Tests whether or not an element is matched by query.\n *\n * @template Node The generic Node type for the DOM adapter being used.\n * @template ElementNode The Node type for elements for the DOM adapter being used.\n * @param elem The element to test if it matches the query.\n * @param query can be either a CSS selector string or a compiled query function.\n * @param [options] options for querying the document.\n * @see compile for supported selector queries.\n * @returns\n */\nexport function is(elem, query, options) {\n const opts = convertOptionFormats(options);\n return (typeof query === \"function\" ? query : compileRaw(query, opts))(elem);\n}\n/**\n * Alias for selectAll(query, elems, options).\n * @see [compile] for supported selector queries.\n */\nexport default selectAll;\n// Export filters, pseudos and aliases to allow users to supply their own.\n/** @deprecated Use the `pseudos` option instead. */\nexport { filters, pseudos, aliases } from \"./pseudo-selectors/index.js\";\n//# sourceMappingURL=index.js.map","import * as CSSselect from 'css-select';\n\nimport {ELEMENT_NODE, TEXT_NODE} from './constants.js';\nimport {ignoreCase} from './utils.js';\n\nconst {isArray} = Array;\n\n/* c8 ignore start */\nconst isTag = ({nodeType}) => nodeType === ELEMENT_NODE;\n\nconst existsOne = (test, elements) => elements.some(\n element => isTag(element) && (\n test(element) ||\n existsOne(test, getChildren(element))\n )\n);\n\nconst getAttributeValue = (element, name) => name === 'class' ?\n element.classList.value : element.getAttribute(name);\n\nconst getChildren = ({childNodes}) => childNodes;\n\nconst getName = (element) => {\n const {localName} = element;\n return ignoreCase(element) ? localName.toLowerCase() : localName;\n};\n\nconst getParent = ({parentNode}) => parentNode;\n\nconst getSiblings = element => {\n const {parentNode} = element;\n return parentNode ? getChildren(parentNode) : element;\n};\n\nconst getText = node => {\n if (isArray(node))\n return node.map(getText).join('');\n if (isTag(node))\n return getText(getChildren(node));\n if (node.nodeType === TEXT_NODE)\n return node.data;\n return '';\n};\n\nconst hasAttrib = (element, name) => element.hasAttribute(name);\n\nconst removeSubsets = nodes => {\n let {length} = nodes;\n while (length--) {\n const node = nodes[length];\n if (length && -1 < nodes.lastIndexOf(node, length - 1)) {\n nodes.splice(length, 1);\n continue;\n }\n for (let {parentNode} = node; parentNode; parentNode = parentNode.parentNode) {\n if (nodes.includes(parentNode)) {\n nodes.splice(length, 1);\n break;\n }\n }\n }\n return nodes;\n};\n\nconst findAll = (test, nodes) => {\n const matches = [];\n for (const node of nodes) {\n if (isTag(node)) {\n if (test(node))\n matches.push(node);\n matches.push(...findAll(test, getChildren(node)));\n }\n }\n return matches;\n};\n\nconst findOne = (test, nodes) => {\n for (let node of nodes)\n if (test(node) || (node = findOne(test, getChildren(node))))\n return node;\n return null;\n};\n/* c8 ignore stop */\n\nconst adapter = {\n isTag,\n existsOne,\n getAttributeValue,\n getChildren,\n getName,\n getParent,\n getSiblings,\n getText,\n hasAttrib,\n removeSubsets,\n findAll,\n findOne\n};\n\nexport const prepareMatch = (element, selectors) => CSSselect.compile(\n selectors,\n {\n context: selectors.includes(':scope') ? element : void 0,\n xmlMode: !ignoreCase(element),\n adapter\n }\n);\n\nexport const matches = (element, selectors) => CSSselect.is(\n element,\n selectors,\n {\n strict: true,\n context: selectors.includes(':scope') ? element : void 0,\n xmlMode: !ignoreCase(element),\n adapter\n }\n);\n","import {TEXT_NODE} from '../shared/constants.js';\nimport {VALUE} from '../shared/symbols.js';\nimport {escape} from '../shared/text-escaper.js';\n\nimport {CharacterData} from './character-data.js';\n\n/**\n * @implements globalThis.Text\n */\nexport class Text extends CharacterData {\n constructor(ownerDocument, data = '') {\n super(ownerDocument, '#text', TEXT_NODE, data);\n }\n\n get wholeText() {\n const text = [];\n let {previousSibling, nextSibling} = this;\n while (previousSibling) {\n if (previousSibling.nodeType === TEXT_NODE)\n text.unshift(previousSibling[VALUE]);\n else\n break;\n previousSibling = previousSibling.previousSibling;\n }\n text.push(this[VALUE]);\n while (nextSibling) {\n if (nextSibling.nodeType === TEXT_NODE)\n text.push(nextSibling[VALUE]);\n else\n break;\n nextSibling = nextSibling.nextSibling;\n }\n return text.join('');\n }\n\n cloneNode() {\n const {ownerDocument, [VALUE]: data} = this;\n return new Text(ownerDocument, data);\n }\n\n toString() { return escape(this[VALUE]); }\n}\n","// https://dom.spec.whatwg.org/#interface-parentnode\n// Document, DocumentFragment, Element\n\nimport {\n ATTRIBUTE_NODE,\n DOCUMENT_FRAGMENT_NODE,\n ELEMENT_NODE,\n TEXT_NODE,\n NODE_END,\n CDATA_SECTION_NODE,\n COMMENT_NODE\n} from '../shared/constants.js';\n\nimport {PRIVATE, END, NEXT, PREV, START, VALUE} from '../shared/symbols.js';\n\nimport {prepareMatch} from '../shared/matches.js';\nimport {previousSibling, nextSibling} from '../shared/node.js';\nimport {getEnd, knownAdjacent, knownBoundaries, knownSegment, knownSiblings, localCase} from '../shared/utils.js';\n\nimport {Node} from '../interface/node.js';\nimport {Text} from '../interface/text.js';\nimport {NodeList} from '../interface/node-list.js';\n\nimport {moCallback} from '../interface/mutation-observer.js';\nimport {connectedCallback} from '../interface/custom-element-registry.js';\n\nimport {nextElementSibling} from './non-document-type-child-node.js';\n\nconst isNode = node => node instanceof Node;\n\nconst insert = (parentNode, child, nodes) => {\n const {ownerDocument} = parentNode;\n for (const node of nodes)\n parentNode.insertBefore(\n isNode(node) ? node : new Text(ownerDocument, node),\n child\n );\n};\n\n/** @typedef { import('../interface/element.js').Element & {\n [typeof NEXT]: NodeStruct,\n [typeof PREV]: NodeStruct,\n [typeof START]: NodeStruct,\n nodeType: typeof ATTRIBUTE_NODE | typeof DOCUMENT_FRAGMENT_NODE | typeof ELEMENT_NODE | typeof TEXT_NODE | typeof NODE_END | typeof COMMENT_NODE | typeof CDATA_SECTION_NODE,\n ownerDocument: Document,\n parentNode: ParentNode,\n}} NodeStruct */\n\nexport class ParentNode extends Node {\n constructor(ownerDocument, localName, nodeType) {\n super(ownerDocument, localName, nodeType);\n this[PRIVATE] = null;\n /** @type {NodeStruct} */\n this[NEXT] = this[END] = {\n [NEXT]: null,\n [PREV]: this,\n [START]: this,\n nodeType: NODE_END,\n ownerDocument: this.ownerDocument,\n parentNode: null\n };\n }\n\n get childNodes() {\n const childNodes = new NodeList;\n let {firstChild} = this;\n while (firstChild) {\n childNodes.push(firstChild);\n firstChild = nextSibling(firstChild);\n }\n return childNodes;\n }\n\n get children() {\n const children = new NodeList;\n let {firstElementChild} = this;\n while (firstElementChild) {\n children.push(firstElementChild);\n firstElementChild = nextElementSibling(firstElementChild);\n }\n return children;\n }\n\n /**\n * @returns {NodeStruct | null}\n */\n get firstChild() {\n let {[NEXT]: next, [END]: end} = this;\n while (next.nodeType === ATTRIBUTE_NODE)\n next = next[NEXT];\n return next === end ? null : next;\n }\n\n /**\n * @returns {NodeStruct | null}\n */\n get firstElementChild() {\n let {firstChild} = this;\n while (firstChild) {\n if (firstChild.nodeType === ELEMENT_NODE)\n return firstChild;\n firstChild = nextSibling(firstChild);\n }\n return null;\n }\n\n get lastChild() {\n const prev = this[END][PREV];\n switch (prev.nodeType) {\n case NODE_END:\n return prev[START];\n case ATTRIBUTE_NODE:\n return null;\n }\n return prev === this ? null : prev;\n }\n\n get lastElementChild() {\n let {lastChild} = this;\n while (lastChild) {\n if (lastChild.nodeType === ELEMENT_NODE)\n return lastChild;\n lastChild = previousSibling(lastChild);\n }\n return null;\n }\n\n get childElementCount() {\n return this.children.length;\n }\n\n prepend(...nodes) {\n insert(this, this.firstChild, nodes);\n }\n\n append(...nodes) {\n insert(this, this[END], nodes);\n }\n\n replaceChildren(...nodes) {\n let {[NEXT]: next, [END]: end} = this;\n while (next !== end && next.nodeType === ATTRIBUTE_NODE)\n next = next[NEXT];\n while (next !== end) {\n const after = getEnd(next)[NEXT];\n next.remove();\n next = after;\n }\n if (nodes.length)\n insert(this, end, nodes);\n }\n\n getElementsByClassName(className) {\n const elements = new NodeList;\n let {[NEXT]: next, [END]: end} = this;\n while (next !== end) {\n if (\n next.nodeType === ELEMENT_NODE &&\n next.hasAttribute('class') &&\n next.classList.has(className)\n )\n elements.push(next);\n next = next[NEXT];\n }\n return elements;\n }\n\n getElementsByTagName(tagName) {\n const elements = new NodeList;\n let {[NEXT]: next, [END]: end} = this;\n while (next !== end) {\n if (next.nodeType === ELEMENT_NODE && (\n next.localName === tagName ||\n localCase(next) === tagName\n ))\n elements.push(next);\n next = next[NEXT];\n }\n return elements;\n }\n\n querySelector(selectors) {\n const matches = prepareMatch(this, selectors);\n let {[NEXT]: next, [END]: end} = this;\n while (next !== end) {\n if (next.nodeType === ELEMENT_NODE && matches(next))\n return next;\n next = next.nodeType === ELEMENT_NODE && next.localName === 'template' ? next[END] : next[NEXT];\n }\n return null;\n }\n\n querySelectorAll(selectors) {\n const matches = prepareMatch(this, selectors);\n const elements = new NodeList;\n let {[NEXT]: next, [END]: end} = this;\n while (next !== end) {\n if (next.nodeType === ELEMENT_NODE && matches(next))\n elements.push(next);\n next = next.nodeType === ELEMENT_NODE && next.localName === 'template' ? next[END] : next[NEXT];\n }\n return elements;\n }\n\n appendChild(node) {\n return this.insertBefore(node, this[END]);\n }\n\n contains(node) {\n let parentNode = node;\n while (parentNode && parentNode !== this)\n parentNode = parentNode.parentNode;\n return parentNode === this;\n }\n\n insertBefore(node, before = null) {\n if (node === before)\n return node;\n if (node === this)\n throw new Error('unable to append a node to itself');\n const next = before || this[END];\n switch (node.nodeType) {\n case ELEMENT_NODE:\n node.remove();\n node.parentNode = this;\n knownBoundaries(next[PREV], node, next);\n moCallback(node, null);\n connectedCallback(node);\n break;\n case DOCUMENT_FRAGMENT_NODE: {\n let {[PRIVATE]: parentNode, firstChild, lastChild} = node;\n if (firstChild) {\n knownSegment(next[PREV], firstChild, lastChild, next);\n knownAdjacent(node, node[END]);\n if (parentNode)\n parentNode.replaceChildren();\n do {\n firstChild.parentNode = this;\n moCallback(firstChild, null);\n if (firstChild.nodeType === ELEMENT_NODE)\n connectedCallback(firstChild);\n } while (\n firstChild !== lastChild &&\n (firstChild = nextSibling(firstChild))\n );\n }\n break;\n }\n case TEXT_NODE:\n case COMMENT_NODE:\n case CDATA_SECTION_NODE:\n node.remove();\n /* eslint no-fallthrough:0 */\n // this covers DOCUMENT_TYPE_NODE too\n default:\n node.parentNode = this;\n knownSiblings(next[PREV], node, next);\n moCallback(node, null);\n break;\n }\n return node;\n }\n\n normalize() {\n let {[NEXT]: next, [END]: end} = this;\n while (next !== end) {\n const {[NEXT]: $next, [PREV]: $prev, nodeType} = next;\n if (nodeType === TEXT_NODE) {\n if (!next[VALUE])\n next.remove();\n else if ($prev && $prev.nodeType === TEXT_NODE) {\n $prev.textContent += next.textContent;\n next.remove();\n }\n }\n next = $next;\n }\n }\n\n removeChild(node) {\n if (node.parentNode !== this)\n throw new Error('node is not a child');\n node.remove();\n return node;\n }\n\n replaceChild(node, replaced) {\n const next = getEnd(replaced)[NEXT];\n replaced.remove();\n this.insertBefore(node, next);\n return replaced;\n }\n}\n","// https://dom.spec.whatwg.org/#interface-nonelementparentnode\n// Document, DocumentFragment\n\nimport {ELEMENT_NODE} from '../shared/constants.js';\nimport {END, NEXT} from '../shared/symbols.js';\nimport {nonElementAsJSON} from '../shared/jsdon.js';\n\nimport {ParentNode} from './parent-node.js';\n\nexport class NonElementParentNode extends ParentNode {\n getElementById(id) {\n let {[NEXT]: next, [END]: end} = this;\n while (next !== end) {\n if (next.nodeType === ELEMENT_NODE && next.id === id)\n return next;\n next = next[NEXT];\n }\n return null;\n }\n\n cloneNode(deep) {\n const {ownerDocument, constructor} = this;\n const nonEPN = new constructor(ownerDocument);\n if (deep) {\n const {[END]: end} = nonEPN;\n for (const node of this.childNodes)\n nonEPN.insertBefore(node.cloneNode(deep), end);\n }\n return nonEPN; \n }\n\n toString() {\n const {childNodes, localName} = this;\n return `<${localName}>${childNodes.join('')}</${localName}>`;\n }\n\n toJSON() {\n const json = [];\n nonElementAsJSON(this, json);\n return json;\n }\n}\n","import {DOCUMENT_FRAGMENT_NODE} from '../shared/constants.js';\nimport {NonElementParentNode} from '../mixin/non-element-parent-node.js';\n\n/**\n * @implements globalThis.DocumentFragment\n */\nexport class DocumentFragment extends NonElementParentNode {\n constructor(ownerDocument) {\n super(ownerDocument, '#document-fragment', DOCUMENT_FRAGMENT_NODE);\n }\n}\n","import {DOCUMENT_TYPE_NODE} from '../shared/constants.js';\nimport {documentTypeAsJSON} from '../shared/jsdon.js';\n\nimport {Node} from './node.js';\n\n/**\n * @implements globalThis.DocumentType\n */\nexport class DocumentType extends Node {\n constructor(ownerDocument, name, publicId = '', systemId = '') {\n super(ownerDocument, '#document-type', DOCUMENT_TYPE_NODE);\n this.name = name;\n this.publicId = publicId;\n this.systemId = systemId;\n }\n\n cloneNode() {\n const {ownerDocument, name, publicId, systemId} = this;\n return new DocumentType(ownerDocument, name, publicId, systemId);\n }\n\n toString() {\n const {name, publicId, systemId} = this;\n const hasPublic = 0 < publicId.length;\n const str = [name];\n if (hasPublic)\n str.push('PUBLIC', `\"${publicId}\"`);\n if (systemId.length) {\n if (!hasPublic)\n str.push('SYSTEM');\n str.push(`\"${systemId}\"`);\n }\n return `<!DOCTYPE ${str.join(' ')}>`;\n }\n\n toJSON() {\n const json = [];\n documentTypeAsJSON(this, json);\n return json;\n }\n}\n","import {ELEMENT_NODE, DOCUMENT_FRAGMENT_NODE} from '../shared/constants.js';\nimport {CUSTOM_ELEMENTS} from '../shared/symbols.js';\nimport {parseFromString} from '../shared/parse-from-string.js';\nimport {ignoreCase} from '../shared/utils.js';\n\n\n/**\n * @param {Node} node\n * @returns {String}\n */\nexport const getInnerHtml = node => node.childNodes.join('');\n\n/**\n * @param {Node} node\n * @param {String} html\n */\nexport const setInnerHtml = (node, html) => {\n const {ownerDocument} = node;\n const {constructor} = ownerDocument;\n const document = new constructor;\n document[CUSTOM_ELEMENTS] = ownerDocument[CUSTOM_ELEMENTS];\n const {childNodes} = parseFromString(document, ignoreCase(node), html);\n\n node.replaceChildren(...childNodes.map(setOwnerDocument, ownerDocument));\n};\n\nfunction setOwnerDocument(node) {\n node.ownerDocument = this;\n switch (node.nodeType) {\n case ELEMENT_NODE:\n case DOCUMENT_FRAGMENT_NODE:\n node.childNodes.forEach(setOwnerDocument, this);\n break;\n }\n return node;\n}\n","export default camel => camel.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z0-9]+)([A-Z]))/g, '$2$5-$3$6')\n .toLowerCase();\n","import uhyphen from 'uhyphen';\nimport {setPrototypeOf} from '../shared/object.js';\n\nconst refs = new WeakMap;\n\nconst key = name => `data-${uhyphen(name)}`;\nconst prop = name => name.slice(5).replace(/-([a-z])/g, (_, $1) => $1.toUpperCase());\n\nconst handler = {\n get(dataset, name) {\n if (name in dataset)\n return refs.get(dataset).getAttribute(key(name));\n },\n\n set(dataset, name, value) {\n dataset[name] = value;\n refs.get(dataset).setAttribute(key(name), value);\n return true;\n },\n\n deleteProperty(dataset, name) {\n if (name in dataset)\n refs.get(dataset).removeAttribute(key(name));\n return delete dataset[name];\n }\n};\n\n/**\n * @implements globalThis.DOMStringMap\n */\nexport class DOMStringMap {\n /**\n * @param {Element} ref\n */\n constructor(ref) {\n for (const {name, value} of ref.attributes) {\n if (/^data-/.test(name))\n this[prop(name)] = value;\n }\n refs.set(this, ref);\n return new Proxy(this, handler);\n }\n}\n\nsetPrototypeOf(DOMStringMap.prototype, null);\n","import {OWNER_ELEMENT} from '../shared/symbols.js';\nimport {setAttribute} from '../shared/attributes.js';\n\nimport {Attr} from '../interface/attr.js';\n\nconst {add} = Set.prototype;\nconst addTokens = (self, tokens) => {\n for (const token of tokens) {\n if (token)\n add.call(self, token);\n }\n};\n\nconst update = ({[OWNER_ELEMENT]: ownerElement, value}) => {\n const attribute = ownerElement.getAttributeNode('class');\n if (attribute)\n attribute.value = value;\n else\n setAttribute(\n ownerElement,\n new Attr(ownerElement.ownerDocument, 'class', value)\n );\n};\n\n/**\n * @implements globalThis.DOMTokenList\n */\nexport class DOMTokenList extends Set {\n\n constructor(ownerElement) {\n super();\n this[OWNER_ELEMENT] = ownerElement;\n const attribute = ownerElement.getAttributeNode('class');\n if (attribute)\n addTokens(this, attribute.value.split(/\\s+/));\n }\n\n get length() { return this.size; }\n\n get value() { return [...this].join(' '); }\n\n /**\n * @param {...string} tokens\n */\n add(...tokens) {\n addTokens(this, tokens);\n update(this);\n }\n\n /**\n * @param {string} token\n */\n contains(token) { return this.has(token); }\n\n /**\n * @param {...string} tokens\n */\n remove(...tokens) {\n for (const token of tokens)\n this.delete(token);\n update(this);\n }\n\n /**\n * @param {string} token\n * @param {boolean?} force\n */\n toggle(token, force) {\n if (this.has(token)) {\n if (force)\n return true;\n this.delete(token);\n update(this);\n }\n else if (force || arguments.length === 1) {\n super.add(token);\n update(this);\n return true;\n }\n return false;\n }\n\n /**\n * @param {string} token\n * @param {string} newToken\n */\n replace(token, newToken) {\n if (this.has(token)) {\n this.delete(token);\n super.add(newToken);\n update(this);\n return true;\n }\n return false;\n }\n\n /**\n * @param {string} token\n */\n supports() { return true; }\n}\n","import uhyphen from 'uhyphen';\n\nimport {CHANGED, PRIVATE, VALUE} from '../shared/symbols.js';\n\nconst refs = new WeakMap;\n\nconst getKeys = style => [...style.keys()].filter(key => key !== PRIVATE);\n\nconst updateKeys = style => {\n const attr = refs.get(style).getAttributeNode('style');\n if (!attr || attr[CHANGED] || style.get(PRIVATE) !== attr) {\n style.clear();\n if (attr) {\n style.set(PRIVATE, attr);\n for (const rule of attr[VALUE].split(/\\s*;\\s*/)) {\n let [key, ...rest] = rule.split(':');\n if (rest.length > 0) {\n key = key.trim();\n const value = rest.join(':').trim();\n if (key && value)\n style.set(key, value);\n }\n }\n }\n }\n return attr;\n};\n\nconst handler = {\n get(style, name) {\n if (name in prototype)\n return style[name];\n updateKeys(style);\n if (name === 'length')\n return getKeys(style).length;\n if (/^\\d+$/.test(name))\n return getKeys(style)[name];\n return style.get(uhyphen(name));\n },\n\n set(style, name, value) {\n if (name === 'cssText')\n style[name] = value;\n else {\n let attr = updateKeys(style);\n if (value == null)\n style.delete(uhyphen(name));\n else\n style.set(uhyphen(name), value);\n if (!attr) {\n const element = refs.get(style);\n attr = element.ownerDocument.createAttribute('style');\n element.setAttributeNode(attr);\n style.set(PRIVATE, attr);\n }\n attr[CHANGED] = false;\n attr[VALUE] = style.toString();\n }\n return true;\n }\n};\n\n/**\n * @implements globalThis.CSSStyleDeclaration\n */\nexport class CSSStyleDeclaration extends Map {\n constructor(element) {\n super();\n refs.set(this, element);\n /* c8 ignore start */\n return new Proxy(this, handler);\n /* c8 ignore stop */\n }\n\n get cssText() {\n return this.toString();\n }\n\n set cssText(value) {\n refs.get(this).setAttribute('style', value);\n }\n\n getPropertyValue(name) {\n const self = this[PRIVATE];\n return handler.get(self, name);\n }\n\n setProperty(name, value) {\n const self = this[PRIVATE];\n handler.set(self, name, value);\n }\n\n removeProperty(name) {\n const self = this[PRIVATE];\n handler.set(self, name, null);\n }\n\n [Symbol.iterator]() {\n const self = this[PRIVATE];\n updateKeys(self);\n const keys = getKeys(self);\n const {length} = keys;\n let i = 0;\n return {\n next() {\n const done = i === length;\n return {done, value: done ? null : keys[i++]};\n }\n };\n }\n\n get[PRIVATE]() { return this; }\n\n toString() {\n const self = this[PRIVATE];\n updateKeys(self);\n const cssText = [];\n self.forEach(push, cssText);\n return cssText.join(';');\n }\n}\n\nconst {prototype} = CSSStyleDeclaration;\n\nfunction push(value, key) {\n if (key !== PRIVATE)\n this.push(`${key}:${value}`);\n}\n","// https://dom.spec.whatwg.org/#interface-event\n\n/* c8 ignore start */\n\n// Node 15 has Event but 14 and 12 don't\nconst BUBBLING_PHASE = 3;\nconst AT_TARGET = 2;\nconst CAPTURING_PHASE = 1;\nconst NONE = 0;\n\nfunction getCurrentTarget(ev) {\n return ev.currentTarget;\n}\n\n/**\n * @implements globalThis.Event\n */\nclass GlobalEvent {\n static get BUBBLING_PHASE() { return BUBBLING_PHASE; }\n static get AT_TARGET() { return AT_TARGET; }\n static get CAPTURING_PHASE() { return CAPTURING_PHASE; }\n static get NONE() { return NONE; }\n\n constructor(type, eventInitDict = {}) {\n this.type = type;\n this.bubbles = !!eventInitDict.bubbles;\n this.cancelBubble = false;\n this._stopImmediatePropagationFlag = false;\n this.cancelable = !!eventInitDict.cancelable;\n this.eventPhase = this.NONE;\n this.timeStamp = Date.now();\n this.defaultPrevented = false;\n this.originalTarget = null;\n this.returnValue = null;\n this.srcElement = null;\n this.target = null;\n this._path = [];\n }\n\n get BUBBLING_PHASE() { return BUBBLING_PHASE; }\n get AT_TARGET() { return AT_TARGET; }\n get CAPTURING_PHASE() { return CAPTURING_PHASE; }\n get NONE() { return NONE; }\n\n preventDefault() { this.defaultPrevented = true; }\n\n // simplified implementation, should be https://dom.spec.whatwg.org/#dom-event-composedpath\n composedPath() {\n return this._path.map(getCurrentTarget);\n }\n\n stopPropagation() {\n this.cancelBubble = true;\n }\n \n stopImmediatePropagation() {\n this.stopPropagation();\n this._stopImmediatePropagationFlag = true;\n }\n }\n\nexport {GlobalEvent as Event};\n\n/* c8 ignore stop */\n","/**\n * @implements globalThis.NamedNodeMap\n */\nexport class NamedNodeMap extends Array {\n constructor(ownerElement) {\n super();\n this.ownerElement = ownerElement;\n }\n\n getNamedItem(name) {\n return this.ownerElement.getAttributeNode(name);\n }\n\n setNamedItem(attr) {\n this.ownerElement.setAttributeNode(attr);\n this.unshift(attr);\n }\n\n removeNamedItem(name) {\n const item = this.getNamedItem(name);\n this.ownerElement.removeAttribute(name);\n this.splice(this.indexOf(item), 1);\n }\n\n item(index) {\n return index < this.length ? this[index] : null;\n }\n\n /* c8 ignore start */\n getNamedItemNS(_, name) {\n return this.getNamedItem(name);\n }\n\n setNamedItemNS(_, attr) {\n return this.setNamedItem(attr);\n }\n\n removeNamedItemNS(_, name) {\n return this.removeNamedItem(name);\n }\n /* c8 ignore stop */\n}\n","import {DOCUMENT_FRAGMENT_NODE} from '../shared/constants.js';\nimport {getInnerHtml, setInnerHtml} from '../mixin/inner-html.js';\nimport {NonElementParentNode} from '../mixin/non-element-parent-node.js';\n\n/**\n * @implements globalThis.ShadowRoot\n */\nexport class ShadowRoot extends NonElementParentNode {\n constructor(host) {\n super(host.ownerDocument, '#shadow-root', DOCUMENT_FRAGMENT_NODE);\n this.host = host;\n }\n\n get innerHTML() {\n return getInnerHtml(this);\n }\n set innerHTML(html) {\n setInnerHtml(this, html);\n }\n}\n","// https://dom.spec.whatwg.org/#interface-element\n\nimport {\n ATTRIBUTE_NODE,\n BLOCK_ELEMENTS,\n CDATA_SECTION_NODE,\n COMMENT_NODE,\n ELEMENT_NODE,\n NODE_END,\n TEXT_NODE,\n SVG_NAMESPACE\n} from '../shared/constants.js';\n\nimport {\n setAttribute, removeAttribute,\n numericAttribute, stringAttribute\n} from '../shared/attributes.js';\n\nimport {\n CLASS_LIST, DATASET, STYLE,\n END, NEXT, PREV, START,\n MIME\n} from '../shared/symbols.js';\n\nimport {\n htmlToFragment,\n ignoreCase,\n knownAdjacent,\n localCase,\n String\n} from '../shared/utils.js';\n\nimport {elementAsJSON} from '../shared/jsdon.js';\nimport {matches, prepareMatch} from '../shared/matches.js';\nimport {shadowRoots} from '../shared/shadow-roots.js';\n\nimport {isConnected, parentElement, previousSibling, nextSibling} from '../shared/node.js';\nimport {previousElementSibling, nextElementSibling} from '../mixin/non-document-type-child-node.js';\n\nimport {before, after, replaceWith, remove} from '../mixin/child-node.js';\nimport {getInnerHtml, setInnerHtml} from '../mixin/inner-html.js';\nimport {ParentNode} from '../mixin/parent-node.js';\n\nimport {DOMStringMap} from '../dom/string-map.js';\nimport {DOMTokenList} from '../dom/token-list.js';\n\nimport {CSSStyleDeclaration} from './css-style-declaration.js';\nimport {Event} from './event.js';\nimport {NamedNodeMap} from './named-node-map.js';\nimport {ShadowRoot} from './shadow-root.js';\nimport {NodeList} from './node-list.js';\nimport {Attr} from './attr.js';\nimport {Text} from './text.js';\nimport {escape} from '../shared/text-escaper.js';\n\n// <utils>\nconst attributesHandler = {\n get(target, key) {\n return key in target ? target[key] : target.find(({name}) => name === key);\n }\n};\n\nconst create = (ownerDocument, element, localName) => {\n if ('ownerSVGElement' in element) {\n const svg = ownerDocument.createElementNS(SVG_NAMESPACE, localName);\n svg.ownerSVGElement = element.ownerSVGElement;\n return svg;\n }\n return ownerDocument.createElement(localName);\n};\n\nconst isVoid = ({localName, ownerDocument}) => {\n return ownerDocument[MIME].voidElements.test(localName);\n};\n\n// </utils>\n\n/**\n * @implements globalThis.Element\n */\nexport class Element extends ParentNode {\n constructor(ownerDocument, localName) {\n super(ownerDocument, localName, ELEMENT_NODE);\n this[CLASS_LIST] = null;\n this[DATASET] = null;\n this[STYLE] = null;\n }\n\n // <Mixins>\n get isConnected() { return isConnected(this); }\n get parentElement() { return parentElement(this); }\n get previousSibling() { return previousSibling(this); }\n get nextSibling() { return nextSibling(this); }\n get namespaceURI() {\n return 'http://www.w3.org/1999/xhtml';\n }\n\n get previousElementSibling() { return previousElementSibling(this); }\n get nextElementSibling() { return nextElementSibling(this); }\n\n before(...nodes) { before(this, nodes); }\n after(...nodes) { after(this, nodes); }\n replaceWith(...nodes) { replaceWith(this, nodes); }\n remove() { remove(this[PREV], this, this[END][NEXT]); }\n // </Mixins>\n\n // <specialGetters>\n get id() { return stringAttribute.get(this, 'id'); }\n set id(value) { stringAttribute.set(this, 'id', value); }\n\n get className() { return this.classList.value; }\n set className(value) {\n const {classList} = this;\n classList.clear();\n classList.add(...(String(value).split(/\\s+/)));\n }\n\n get nodeName() { return localCase(this); }\n get tagName() { return localCase(this); }\n\n get classList() {\n return this[CLASS_LIST] || (\n this[CLASS_LIST] = new DOMTokenList(this)\n );\n }\n\n get dataset() {\n return this[DATASET] || (\n this[DATASET] = new DOMStringMap(this)\n );\n }\n\n getBoundingClientRect() {\n return {\n x: 0,\n y: 0,\n bottom: 0,\n height: 0,\n left: 0,\n right: 0,\n top: 0,\n width: 0\n };\n }\n\n get nonce() { return stringAttribute.get(this, 'nonce'); }\n set nonce(value) { stringAttribute.set(this, 'nonce', value); }\n\n get style() {\n return this[STYLE] || (\n this[STYLE] = new CSSStyleDeclaration(this)\n );\n }\n\n get tabIndex() { return numericAttribute.get(this, 'tabindex') || -1; }\n set tabIndex(value) { numericAttribute.set(this, 'tabindex', value); }\n\n get slot() { return stringAttribute.get(this, 'slot'); }\n set slot(value) { stringAttribute.set(this, 'slot', value); }\n // </specialGetters>\n\n\n // <contentRelated>\n get innerText() {\n const text = [];\n let {[NEXT]: next, [END]: end} = this;\n while (next !== end) {\n if (next.nodeType === TEXT_NODE) {\n text.push(next.textContent.replace(/\\s+/g, ' '));\n } else if(\n text.length && next[NEXT] != end &&\n BLOCK_ELEMENTS.has(next.tagName)\n ) {\n text.push('\\n');\n }\n next = next[NEXT];\n }\n return text.join('');\n }\n\n /**\n * @returns {String}\n */\n get textContent() {\n const text = [];\n let {[NEXT]: next, [END]: end} = this;\n while (next !== end) {\n const nodeType = next.nodeType;\n if (nodeType === TEXT_NODE || nodeType === CDATA_SECTION_NODE)\n text.push(next.textContent);\n next = next[NEXT];\n }\n return text.join('');\n }\n\n set textContent(text) {\n this.replaceChildren();\n if (text != null && text !== '')\n this.appendChild(new Text(this.ownerDocument, text));\n }\n\n get innerHTML() {\n return getInnerHtml(this);\n }\n set innerHTML(html) {\n setInnerHtml(this, html);\n }\n\n get outerHTML() { return this.toString(); }\n set outerHTML(html) {\n const template = this.ownerDocument.createElement('');\n template.innerHTML = html;\n this.replaceWith(...template.childNodes);\n }\n // </contentRelated>\n\n // <attributes>\n get attributes() {\n const attributes = new NamedNodeMap(this);\n let next = this[NEXT];\n while (next.nodeType === ATTRIBUTE_NODE) {\n attributes.push(next);\n next = next[NEXT];\n }\n return new Proxy(attributes, attributesHandler);\n }\n\n focus() { this.dispatchEvent(new Event('focus')); }\n\n getAttribute(name) {\n if (name === 'class')\n return this.className;\n const attribute = this.getAttributeNode(name);\n return attribute && (ignoreCase(this) ? attribute.value : escape(attribute.value));\n }\n\n getAttributeNode(name) {\n let next = this[NEXT];\n while (next.nodeType === ATTRIBUTE_NODE) {\n if (next.name === name)\n return next;\n next = next[NEXT];\n }\n return null;\n }\n\n getAttributeNames() {\n const attributes = new NodeList;\n let next = this[NEXT];\n while (next.nodeType === ATTRIBUTE_NODE) {\n attributes.push(next.name);\n next = next[NEXT];\n }\n return attributes;\n }\n\n hasAttribute(name) { return !!this.getAttributeNode(name); }\n hasAttributes() { return this[NEXT].nodeType === ATTRIBUTE_NODE; }\n\n removeAttribute(name) {\n if (name === 'class' && this[CLASS_LIST])\n this[CLASS_LIST].clear();\n let next = this[NEXT];\n while (next.nodeType === ATTRIBUTE_NODE) {\n if (next.name === name) {\n removeAttribute(this, next);\n return;\n }\n next = next[NEXT];\n }\n }\n\n removeAttributeNode(attribute) {\n let next = this[NEXT];\n while (next.nodeType === ATTRIBUTE_NODE) {\n if (next === attribute) {\n removeAttribute(this, next);\n return;\n }\n next = next[NEXT];\n }\n }\n\n setAttribute(name, value) {\n if (name === 'class')\n this.className = value;\n else {\n const attribute = this.getAttributeNode(name);\n if (attribute)\n attribute.value = value;\n else\n setAttribute(this, new Attr(this.ownerDocument, name, value));\n }\n }\n\n setAttributeNode(attribute) {\n const {name} = attribute;\n const previously = this.getAttributeNode(name);\n if (previously !== attribute) {\n if (previously)\n this.removeAttributeNode(previously);\n const {ownerElement} = attribute;\n if (ownerElement)\n ownerElement.removeAttributeNode(attribute);\n setAttribute(this, attribute);\n }\n return previously;\n }\n\n toggleAttribute(name, force) {\n if (this.hasAttribute(name)) {\n if (!force) {\n this.removeAttribute(name);\n return false;\n }\n return true;\n }\n else if (force || arguments.length === 1) {\n this.setAttribute(name, '');\n return true;\n }\n return false;\n }\n // </attributes>\n\n // <ShadowDOM>\n get shadowRoot() {\n if (shadowRoots.has(this)) {\n const {mode, shadowRoot} = shadowRoots.get(this);\n if (mode === 'open')\n return shadowRoot;\n }\n return null;\n }\n\n attachShadow(init) {\n if (shadowRoots.has(this))\n throw new Error('operation not supported');\n // TODO: shadowRoot should be likely a specialized class that extends DocumentFragment\n // but until DSD is out, I am not sure I should spend time on this.\n const shadowRoot = new ShadowRoot(this);\n shadowRoots.set(this, {\n mode: init.mode,\n shadowRoot\n });\n return shadowRoot;\n }\n // </ShadowDOM>\n\n // <selectors>\n matches(selectors) { return matches(this, selectors); }\n closest(selectors) {\n let parentElement = this;\n const matches = prepareMatch(parentElement, selectors);\n while (parentElement && !matches(parentElement))\n parentElement = parentElement.parentElement;\n return parentElement;\n }\n // </selectors>\n\n // <insertAdjacent>\n insertAdjacentElement(position, element) {\n const {parentElement} = this;\n switch (position) {\n case 'beforebegin':\n if (parentElement) {\n parentElement.insertBefore(element, this);\n break;\n }\n return null;\n case 'afterbegin':\n this.insertBefore(element, this.firstChild);\n break;\n case 'beforeend':\n this.insertBefore(element, null);\n break;\n case 'afterend':\n if (parentElement) {\n parentElement.insertBefore(element, this.nextSibling);\n break;\n }\n return null;\n }\n return element;\n }\n\n insertAdjacentHTML(position, html) {\n this.insertAdjacentElement(position, htmlToFragment(this.ownerDocument, html));\n }\n\n insertAdjacentText(position, text) {\n const node = this.ownerDocument.createTextNode(text);\n this.insertAdjacentElement(position, node);\n }\n // </insertAdjacent>\n\n cloneNode(deep = false) {\n const {ownerDocument, localName} = this;\n const addNext = next => {\n next.parentNode = parentNode;\n knownAdjacent($next, next);\n $next = next;\n };\n const clone = create(ownerDocument, this, localName);\n let parentNode = clone, $next = clone;\n let {[NEXT]: next, [END]: prev} = this;\n while (next !== prev && (deep || next.nodeType === ATTRIBUTE_NODE)) {\n switch (next.nodeType) {\n case NODE_END:\n knownAdjacent($next, parentNode[END]);\n $next = parentNode[END];\n parentNode = parentNode.parentNode;\n break;\n case ELEMENT_NODE: {\n const node = create(ownerDocument, next, next.localName);\n addNext(node);\n parentNode = node;\n break;\n }\n case ATTRIBUTE_NODE: {\n const attr = next.cloneNode(deep);\n attr.ownerElement = parentNode;\n addNext(attr);\n break;\n }\n case TEXT_NODE:\n case COMMENT_NODE:\n case CDATA_SECTION_NODE:\n addNext(next.cloneNode(deep));\n break;\n }\n next = next[NEXT];\n }\n knownAdjacent($next, clone[END]);\n return clone;\n }\n\n // <custom>\n toString() {\n const out = [];\n const {[END]: end} = this;\n let next = {[NEXT]: this};\n let isOpened = false;\n do {\n next = next[NEXT];\n switch (next.nodeType) {\n case ATTRIBUTE_NODE: {\n const attr = ' ' + next;\n switch (attr) {\n case ' id':\n case ' class':\n case ' style':\n break;\n default:\n out.push(attr);\n }\n break;\n }\n case NODE_END: {\n const start = next[START];\n if (isOpened) {\n if ('ownerSVGElement' in start)\n out.push(' />');\n else if (isVoid(start))\n out.push(ignoreCase(start) ? '>' : ' />');\n else\n out.push(`></${start.localName}>`);\n isOpened = false;\n }\n else\n out.push(`</${start.localName}>`);\n break;\n }\n case ELEMENT_NODE:\n if (isOpened)\n out.push('>');\n if (next.toString !== this.toString) {\n out.push(next.toString());\n next = next[END];\n isOpened = false;\n }\n else {\n out.push(`<${next.localName}`);\n isOpened = true;\n }\n break;\n case TEXT_NODE:\n case COMMENT_NODE:\n case CDATA_SECTION_NODE:\n out.push((isOpened ? '>' : '') + next);\n isOpened = false;\n break;\n }\n } while (next !== end);\n return out.join('');\n }\n\n toJSON() {\n const json = [];\n elementAsJSON(this, json);\n return json;\n }\n // </custom>\n\n\n /* c8 ignore start */\n getAttributeNS(_, name) { return this.getAttribute(name); }\n getElementsByTagNameNS(_, name) { return this.getElementsByTagName(name); }\n hasAttributeNS(_, name) { return this.hasAttribute(name); }\n removeAttributeNS(_, name) { this.removeAttribute(name); }\n setAttributeNS(_, name, value) { this.setAttribute(name, value); }\n setAttributeNodeNS(attr) { return this.setAttributeNode(attr); }\n /* c8 ignore stop */\n}\n","import {Element} from '../interface/element.js';\nimport {String} from '../shared/utils.js';\n\nconst classNames = new WeakMap;\n\nconst handler = {\n get(target, name) {\n return target[name];\n },\n set(target, name, value) {\n target[name] = value;\n return true;\n }\n};\n\n/**\n * @implements globalThis.SVGElement\n */\nexport class SVGElement extends Element {\n constructor(ownerDocument, localName, ownerSVGElement = null) {\n super(ownerDocument, localName);\n this.ownerSVGElement = ownerSVGElement;\n }\n\n get className() {\n if (!classNames.has(this))\n classNames.set(this, new Proxy({baseVal: '', animVal: ''}, handler));\n return classNames.get(this);\n }\n\n /* c8 ignore start */\n set className(value) {\n const {classList} = this;\n classList.clear();\n classList.add(...(String(value).split(/\\s+/)));\n }\n /* c8 ignore stop */\n\n get namespaceURI() {\n return 'http://www.w3.org/2000/svg';\n }\n\n getAttribute(name) {\n return name === 'class' ?\n [...this.classList].join(' ') :\n super.getAttribute(name);\n }\n\n setAttribute(name, value) {\n if (name === 'class')\n this.className = value;\n else if (name === 'style') {\n const {className} = this;\n className.baseVal = className.animVal = value;\n }\n super.setAttribute(name, value);\n }\n}\n","import {Attr as _Attr} from '../interface/attr.js';\nimport {CharacterData as _CharacterData} from '../interface/character-data.js';\nimport {CDATASection as _CDATASection} from '../interface/cdata-section.js';\nimport {Comment as _Comment} from '../interface/comment.js';\nimport {DocumentFragment as _DocumentFragment} from '../interface/document-fragment.js';\nimport {DocumentType as _DocumentType} from '../interface/document-type.js';\nimport {Element as _Element} from '../interface/element.js';\nimport {Node as _Node} from '../interface/node.js';\nimport {ShadowRoot as _ShadowRoot} from '../interface/shadow-root.js';\nimport {Text as _Text} from '../interface/text.js';\nimport {SVGElement as _SVGElement} from '../svg/element.js';\n\nimport {setPrototypeOf} from './object.js';\n\n/* c8 ignore start */\nexport const illegalConstructor = () => {\n throw new TypeError('Illegal constructor');\n};\n\nexport function Attr() { illegalConstructor(); }\nsetPrototypeOf(Attr, _Attr);\nAttr.prototype = _Attr.prototype;\n\nexport function CDATASection() { illegalConstructor(); }\nsetPrototypeOf(CDATASection, _CDATASection);\nCDATASection.prototype = _CDATASection.prototype;\n\nexport function CharacterData() { illegalConstructor(); }\nsetPrototypeOf(CharacterData, _CharacterData);\nCharacterData.prototype = _CharacterData.prototype;\n\nexport function Comment() { illegalConstructor(); }\nsetPrototypeOf(Comment, _Comment);\nComment.prototype = _Comment.prototype;\n\nexport function DocumentFragment() { illegalConstructor(); }\nsetPrototypeOf(DocumentFragment, _DocumentFragment);\nDocumentFragment.prototype = _DocumentFragment.prototype;\n\nexport function DocumentType() { illegalConstructor(); }\nsetPrototypeOf(DocumentType, _DocumentType);\nDocumentType.prototype = _DocumentType.prototype;\n\nexport function Element() { illegalConstructor(); }\nsetPrototypeOf(Element, _Element);\nElement.prototype = _Element.prototype;\n\nexport function Node() { illegalConstructor(); }\nsetPrototypeOf(Node, _Node);\nNode.prototype = _Node.prototype;\n\nexport function ShadowRoot() { illegalConstructor(); }\nsetPrototypeOf(ShadowRoot, _ShadowRoot);\nShadowRoot.prototype = _ShadowRoot.prototype;\n\nexport function Text() { illegalConstructor(); }\nsetPrototypeOf(Text, _Text);\nText.prototype = _Text.prototype;\n\nexport function SVGElement() { illegalConstructor(); }\nsetPrototypeOf(SVGElement, _SVGElement);\nSVGElement.prototype = _SVGElement.prototype;\n/* c8 ignore stop */\n\nexport const Facades = {\n Attr,\n CDATASection,\n CharacterData,\n Comment,\n DocumentFragment,\n DocumentType,\n Element,\n Node,\n ShadowRoot,\n Text,\n SVGElement\n};\n","import {END, UPGRADE} from '../shared/symbols.js';\nimport {booleanAttribute, stringAttribute} from '../shared/attributes.js';\n\nimport {Event} from '../interface/event.js';\nimport {Element} from '../interface/element.js';\nimport {Classes, customElements} from '../interface/custom-element-registry.js';\n\nconst Level0 = new WeakMap;\nconst level0 = {\n get(element, name) {\n return Level0.has(element) && Level0.get(element)[name] || null;\n },\n set(element, name, value) {\n if (!Level0.has(element))\n Level0.set(element, {});\n const handlers = Level0.get(element);\n const type = name.slice(2);\n if (handlers[name])\n element.removeEventListener(type, handlers[name], false);\n if ((handlers[name] = value))\n element.addEventListener(type, value, false);\n }\n};\n\n/**\n * @implements globalThis.HTMLElement\n */\nexport class HTMLElement extends Element {\n\n static get observedAttributes() { return []; }\n\n constructor(ownerDocument = null, localName = '') {\n super(ownerDocument, localName);\n\n const ownerLess = !ownerDocument;\n let options;\n\n if (ownerLess) {\n const {constructor: Class} = this;\n if (!Classes.has(Class))\n throw new Error('unable to initialize this Custom Element');\n ({ownerDocument, localName, options} = Classes.get(Class));\n }\n\n if (ownerDocument[UPGRADE]) {\n const {element, values} = ownerDocument[UPGRADE];\n ownerDocument[UPGRADE] = null;\n for (const [key, value] of values)\n element[key] = value;\n return element;\n }\n\n if (ownerLess) {\n this.ownerDocument = this[END].ownerDocument = ownerDocument;\n this.localName = localName;\n customElements.set(this, {connected: false});\n if (options.is)\n this.setAttribute('is', options.is);\n }\n }\n\n /* c8 ignore start */\n\n /* TODO: what about these?\n offsetHeight\n offsetLeft\n offsetParent\n offsetTop\n offsetWidth\n */\n\n blur() { this.dispatchEvent(new Event('blur')); }\n click() {\n const clickEvent = new Event('click', {bubbles: true, cancelable: true});\n clickEvent.button = 0;\n\n this.dispatchEvent(clickEvent);\n }\n\n // Boolean getters\n get accessKeyLabel() {\n const {accessKey} = this;\n return accessKey && `Alt+Shift+${accessKey}`;\n }\n get isContentEditable() { return this.hasAttribute('contenteditable'); }\n\n // Boolean Accessors\n get contentEditable() { return booleanAttribute.get(this, 'contenteditable'); }\n set contentEditable(value) { booleanAttribute.set(this, 'contenteditable', value); }\n get draggable() { return booleanAttribute.get(this, 'draggable'); }\n set draggable(value) { booleanAttribute.set(this, 'draggable', value); }\n get hidden() { return booleanAttribute.get(this, 'hidden'); }\n set hidden(value) { booleanAttribute.set(this, 'hidden', value); }\n get spellcheck() { return booleanAttribute.get(this, 'spellcheck'); }\n set spellcheck(value) { booleanAttribute.set(this, 'spellcheck', value); }\n\n // String Accessors\n get accessKey() { return stringAttribute.get(this, 'accesskey'); }\n set accessKey(value) { stringAttribute.set(this, 'accesskey', value); }\n get dir() { return stringAttribute.get(this, 'dir'); }\n set dir(value) { stringAttribute.set(this, 'dir', value); }\n get lang() { return stringAttribute.get(this, 'lang'); }\n set lang(value) { stringAttribute.set(this, 'lang', value); }\n get title() { return stringAttribute.get(this, 'title'); }\n set title(value) { stringAttribute.set(this, 'title', value); }\n\n // DOM Level 0\n get onabort() { return level0.get(this, 'onabort'); }\n set onabort(value) { level0.set(this, 'onabort', value); }\n\n get onblur() { return level0.get(this, 'onblur'); }\n set onblur(value) { level0.set(this, 'onblur', value); }\n\n get oncancel() { return level0.get(this, 'oncancel'); }\n set oncancel(value) { level0.set(this, 'oncancel', value); }\n\n get oncanplay() { return level0.get(this, 'oncanplay'); }\n set oncanplay(value) { level0.set(this, 'oncanplay', value); }\n\n get oncanplaythrough() { return level0.get(this, 'oncanplaythrough'); }\n set oncanplaythrough(value) { level0.set(this, 'oncanplaythrough', value); }\n\n get onchange() { return level0.get(this, 'onchange'); }\n set onchange(value) { level0.set(this, 'onchange', value); }\n\n get onclick() { return level0.get(this, 'onclick'); }\n set onclick(value) { level0.set(this, 'onclick', value); }\n\n get onclose() { return level0.get(this, 'onclose'); }\n set onclose(value) { level0.set(this, 'onclose', value); }\n\n get oncontextmenu() { return level0.get(this, 'oncontextmenu'); }\n set oncontextmenu(value) { level0.set(this, 'oncontextmenu', value); }\n\n get oncuechange() { return level0.get(this, 'oncuechange'); }\n set oncuechange(value) { level0.set(this, 'oncuechange', value); }\n\n get ondblclick() { return level0.get(this, 'ondblclick'); }\n set ondblclick(value) { level0.set(this, 'ondblclick', value); }\n\n get ondrag() { return level0.get(this, 'ondrag'); }\n set ondrag(value) { level0.set(this, 'ondrag', value); }\n\n get ondragend() { return level0.get(this, 'ondragend'); }\n set ondragend(value) { level0.set(this, 'ondragend', value); }\n\n get ondragenter() { return level0.get(this, 'ondragenter'); }\n set ondragenter(value) { level0.set(this, 'ondragenter', value); }\n\n get ondragleave() { return level0.get(this, 'ondragleave'); }\n set ondragleave(value) { level0.set(this, 'ondragleave', value); }\n\n get ondragover() { return level0.get(this, 'ondragover'); }\n set ondragover(value) { level0.set(this, 'ondragover', value); }\n\n get ondragstart() { return level0.get(this, 'ondragstart'); }\n set ondragstart(value) { level0.set(this, 'ondragstart', value); }\n\n get ondrop() { return level0.get(this, 'ondrop'); }\n set ondrop(value) { level0.set(this, 'ondrop', value); }\n\n get ondurationchange() { return level0.get(this, 'ondurationchange'); }\n set ondurationchange(value) { level0.set(this, 'ondurationchange', value); }\n\n get onemptied() { return level0.get(this, 'onemptied'); }\n set onemptied(value) { level0.set(this, 'onemptied', value); }\n\n get onended() { return level0.get(this, 'onended'); }\n set onended(value) { level0.set(this, 'onended', value); }\n\n get onerror() { return level0.get(this, 'onerror'); }\n set onerror(value) { level0.set(this, 'onerror', value); }\n\n get onfocus() { return level0.get(this, 'onfocus'); }\n set onfocus(value) { level0.set(this, 'onfocus', value); }\n\n get oninput() { return level0.get(this, 'oninput'); }\n set oninput(value) { level0.set(this, 'oninput', value); }\n\n get oninvalid() { return level0.get(this, 'oninvalid'); }\n set oninvalid(value) { level0.set(this, 'oninvalid', value); }\n\n get onkeydown() { return level0.get(this, 'onkeydown'); }\n set onkeydown(value) { level0.set(this, 'onkeydown', value); }\n\n get onkeypress() { return level0.get(this, 'onkeypress'); }\n set onkeypress(value) { level0.set(this, 'onkeypress', value); }\n\n get onkeyup() { return level0.get(this, 'onkeyup'); }\n set onkeyup(value) { level0.set(this, 'onkeyup', value); }\n\n get onload() { return level0.get(this, 'onload'); }\n set onload(value) { level0.set(this, 'onload', value); }\n\n get onloadeddata() { return level0.get(this, 'onloadeddata'); }\n set onloadeddata(value) { level0.set(this, 'onloadeddata', value); }\n\n get onloadedmetadata() { return level0.get(this, 'onloadedmetadata'); }\n set onloadedmetadata(value) { level0.set(this, 'onloadedmetadata', value); }\n\n get onloadstart() { return level0.get(this, 'onloadstart'); }\n set onloadstart(value) { level0.set(this, 'onloadstart', value); }\n\n get onmousedown() { return level0.get(this, 'onmousedown'); }\n set onmousedown(value) { level0.set(this, 'onmousedown', value); }\n\n get onmouseenter() { return level0.get(this, 'onmouseenter'); }\n set onmouseenter(value) { level0.set(this, 'onmouseenter', value); }\n\n get onmouseleave() { return level0.get(this, 'onmouseleave'); }\n set onmouseleave(value) { level0.set(this, 'onmouseleave', value); }\n\n get onmousemove() { return level0.get(this, 'onmousemove'); }\n set onmousemove(value) { level0.set(this, 'onmousemove', value); }\n\n get onmouseout() { return level0.get(this, 'onmouseout'); }\n set onmouseout(value) { level0.set(this, 'onmouseout', value); }\n\n get onmouseover() { return level0.get(this, 'onmouseover'); }\n set onmouseover(value) { level0.set(this, 'onmouseover', value); }\n\n get onmouseup() { return level0.get(this, 'onmouseup'); }\n set onmouseup(value) { level0.set(this, 'onmouseup', value); }\n\n get onmousewheel() { return level0.get(this, 'onmousewheel'); }\n set onmousewheel(value) { level0.set(this, 'onmousewheel', value); }\n\n get onpause() { return level0.get(this, 'onpause'); }\n set onpause(value) { level0.set(this, 'onpause', value); }\n\n get onplay() { return level0.get(this, 'onplay'); }\n set onplay(value) { level0.set(this, 'onplay', value); }\n\n get onplaying() { return level0.get(this, 'onplaying'); }\n set onplaying(value) { level0.set(this, 'onplaying', value); }\n\n get onprogress() { return level0.get(this, 'onprogress'); }\n set onprogress(value) { level0.set(this, 'onprogress', value); }\n\n get onratechange() { return level0.get(this, 'onratechange'); }\n set onratechange(value) { level0.set(this, 'onratechange', value); }\n\n get onreset() { return level0.get(this, 'onreset'); }\n set onreset(value) { level0.set(this, 'onreset', value); }\n\n get onresize() { return level0.get(this, 'onresize'); }\n set onresize(value) { level0.set(this, 'onresize', value); }\n\n get onscroll() { return level0.get(this, 'onscroll'); }\n set onscroll(value) { level0.set(this, 'onscroll', value); }\n\n get onseeked() { return level0.get(this, 'onseeked'); }\n set onseeked(value) { level0.set(this, 'onseeked', value); }\n\n get onseeking() { return level0.get(this, 'onseeking'); }\n set onseeking(value) { level0.set(this, 'onseeking', value); }\n\n get onselect() { return level0.get(this, 'onselect'); }\n set onselect(value) { level0.set(this, 'onselect', value); }\n\n get onshow() { return level0.get(this, 'onshow'); }\n set onshow(value) { level0.set(this, 'onshow', value); }\n\n get onstalled() { return level0.get(this, 'onstalled'); }\n set onstalled(value) { level0.set(this, 'onstalled', value); }\n\n get onsubmit() { return level0.get(this, 'onsubmit'); }\n set onsubmit(value) { level0.set(this, 'onsubmit', value); }\n\n get onsuspend() { return level0.get(this, 'onsuspend'); }\n set onsuspend(value) { level0.set(this, 'onsuspend', value); }\n\n get ontimeupdate() { return level0.get(this, 'ontimeupdate'); }\n set ontimeupdate(value) { level0.set(this, 'ontimeupdate', value); }\n\n get ontoggle() { return level0.get(this, 'ontoggle'); }\n set ontoggle(value) { level0.set(this, 'ontoggle', value); }\n\n get onvolumechange() { return level0.get(this, 'onvolumechange'); }\n set onvolumechange(value) { level0.set(this, 'onvolumechange', value); }\n\n get onwaiting() { return level0.get(this, 'onwaiting'); }\n set onwaiting(value) { level0.set(this, 'onwaiting', value); }\n\n get onauxclick() { return level0.get(this, 'onauxclick'); }\n set onauxclick(value) { level0.set(this, 'onauxclick', value); }\n\n get ongotpointercapture() { return level0.get(this, 'ongotpointercapture'); }\n set ongotpointercapture(value) { level0.set(this, 'ongotpointercapture', value); }\n\n get onlostpointercapture() { return level0.get(this, 'onlostpointercapture'); }\n set onlostpointercapture(value) { level0.set(this, 'onlostpointercapture', value); }\n\n get onpointercancel() { return level0.get(this, 'onpointercancel'); }\n set onpointercancel(value) { level0.set(this, 'onpointercancel', value); }\n\n get onpointerdown() { return level0.get(this, 'onpointerdown'); }\n set onpointerdown(value) { level0.set(this, 'onpointerdown', value); }\n\n get onpointerenter() { return level0.get(this, 'onpointerenter'); }\n set onpointerenter(value) { level0.set(this, 'onpointerenter', value); }\n\n get onpointerleave() { return level0.get(this, 'onpointerleave'); }\n set onpointerleave(value) { level0.set(this, 'onpointerleave', value); }\n\n get onpointermove() { return level0.get(this, 'onpointermove'); }\n set onpointermove(value) { level0.set(this, 'onpointermove', value); }\n\n get onpointerout() { return level0.get(this, 'onpointerout'); }\n set onpointerout(value) { level0.set(this, 'onpointerout', value); }\n\n get onpointerover() { return level0.get(this, 'onpointerover'); }\n set onpointerover(value) { level0.set(this, 'onpointerover', value); }\n\n get onpointerup() { return level0.get(this, 'onpointerup'); }\n set onpointerup(value) { level0.set(this, 'onpointerup', value); }\n /* c8 ignore stop */\n\n}\n","import {CONTENT, PRIVATE} from '../shared/symbols.js';\n\nimport {registerHTMLClass} from '../shared/register-html-class.js';\n\nimport {HTMLElement} from './element.js';\n\nconst tagName = 'template';\n\n/**\n * @implements globalThis.HTMLTemplateElement\n */\nclass HTMLTemplateElement extends HTMLElement {\n constructor(ownerDocument) {\n super(ownerDocument, tagName);\n const content = this.ownerDocument.createDocumentFragment();\n (this[CONTENT] = content)[PRIVATE] = this;\n }\n\n get content() {\n if (this.hasChildNodes() && !this[CONTENT].hasChildNodes()) {\n for (const node of this.childNodes)\n this[CONTENT].appendChild(node.cloneNode(true));\n }\n return this[CONTENT];\n }\n}\n\nregisterHTMLClass(tagName, HTMLTemplateElement);\n\nexport {HTMLTemplateElement};\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLHtmlElement\n */\nexport class HTMLHtmlElement extends HTMLElement {\n constructor(ownerDocument, localName = 'html') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\nconst {toString} = HTMLElement.prototype;\n\nexport class TextElement extends HTMLElement {\n\n get innerHTML() { return this.textContent; }\n set innerHTML(html) { this.textContent = html; }\n\n toString() {\n const outerHTML = toString.call(this.cloneNode());\n return outerHTML.replace('><', () => `>${this.textContent}<`);\n }\n}\n","import { booleanAttribute, stringAttribute } from '../shared/attributes.js';\nimport { registerHTMLClass } from '../shared/register-html-class.js';\n\nimport { TextElement } from './text-element.js';\n\nconst tagName = 'script';\n\n/**\n * @implements globalThis.HTMLScriptElement\n */\nclass HTMLScriptElement extends TextElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n }\n\n get type() {\n return stringAttribute.get(this, 'type');\n }\n set type(value) {\n stringAttribute.set(this, 'type', value);\n }\n\n get src() {\n return stringAttribute.get(this, 'src');\n }\n set src(value) {\n stringAttribute.set(this, 'src', value);\n }\n\n get defer() {\n return booleanAttribute.get(this, 'defer');\n }\n\n set defer(value) {\n booleanAttribute.set(this, 'defer', value);\n }\n\n get crossOrigin() {\n return stringAttribute.get(this, 'crossorigin');\n }\n set crossOrigin(value) {\n stringAttribute.set(this, 'crossorigin', value);\n }\n\n get nomodule() {\n return booleanAttribute.get(this, 'nomodule');\n }\n set nomodule(value) {\n booleanAttribute.set(this, 'nomodule', value);\n }\n\n get referrerPolicy() {\n return stringAttribute.get(this, 'referrerpolicy');\n }\n set referrerPolicy(value) {\n stringAttribute.set(this, 'referrerpolicy', value);\n }\n\n get nonce() {\n return stringAttribute.get(this, 'nonce');\n }\n set nonce(value) {\n stringAttribute.set(this, 'nonce', value);\n }\n\n get async() {\n return booleanAttribute.get(this, 'async');\n }\n set async(value) {\n booleanAttribute.set(this, 'async', value);\n }\n\n get text() { return this.textContent; }\n set text(content) { this.textContent = content; }\n}\n\nregisterHTMLClass(tagName, HTMLScriptElement);\n\nexport { HTMLScriptElement };\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLFrameElement\n */\nexport class HTMLFrameElement extends HTMLElement {\n constructor(ownerDocument, localName = 'frame') {\n super(ownerDocument, localName);\n }\n}\n","import {registerHTMLClass} from '../shared/register-html-class.js';\nimport {booleanAttribute, stringAttribute} from '../shared/attributes.js';\n\nimport {HTMLElement} from './element.js';\n\nconst tagName = 'iframe';\n\n/**\n * @implements globalThis.HTMLIFrameElement\n */\nclass HTMLIFrameElement extends HTMLElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n }\n\n /* c8 ignore start */\n get src() { return stringAttribute.get(this, 'src'); }\n set src(value) { stringAttribute.set(this, 'src', value); }\n\n get srcdoc() { return stringAttribute.get(this, \"srcdoc\"); }\n set srcdoc(value) { stringAttribute.set(this, \"srcdoc\", value); }\n\n get name() { return stringAttribute.get(this, \"name\"); }\n set name(value) { stringAttribute.set(this, \"name\", value); }\n\n get allow() { return stringAttribute.get(this, \"allow\"); }\n set allow(value) { stringAttribute.set(this, \"allow\", value); }\n\n get allowFullscreen() { return booleanAttribute.get(this, \"allowfullscreen\"); }\n set allowFullscreen(value) { booleanAttribute.set(this, \"allowfullscreen\", value); }\n \n get referrerPolicy() { return stringAttribute.get(this, \"referrerpolicy\"); }\n set referrerPolicy(value) { stringAttribute.set(this, \"referrerpolicy\", value); }\n \n get loading() { return stringAttribute.get(this, \"loading\"); }\n set loading(value) { stringAttribute.set(this, \"loading\", value); }\n /* c8 ignore stop */\n}\n\nregisterHTMLClass(tagName, HTMLIFrameElement);\n\nexport {HTMLIFrameElement};\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLObjectElement\n */\nexport class HTMLObjectElement extends HTMLElement {\n constructor(ownerDocument, localName = 'object') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLHeadElement\n */\nexport class HTMLHeadElement extends HTMLElement {\n constructor(ownerDocument, localName = 'head') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLBodyElement\n */\nexport class HTMLBodyElement extends HTMLElement {\n constructor(ownerDocument, localName = 'body') {\n super(ownerDocument, localName);\n }\n}\n","//.CommonJS\nvar CSSOM = {};\n///CommonJS\n\n\n/**\n * @constructor\n * @see http://dev.w3.org/csswg/cssom/#the-stylesheet-interface\n */\nCSSOM.StyleSheet = function StyleSheet() {\n\tthis.parentStyleSheet = null;\n};\n\n\n//.CommonJS\nexports.StyleSheet = CSSOM.StyleSheet;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {};\n///CommonJS\n\n\n/**\n * @constructor\n * @see http://dev.w3.org/csswg/cssom/#the-cssrule-interface\n * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSRule\n */\nCSSOM.CSSRule = function CSSRule() {\n\tthis.parentRule = null;\n\tthis.parentStyleSheet = null;\n};\n\nCSSOM.CSSRule.UNKNOWN_RULE = 0; // obsolete\nCSSOM.CSSRule.STYLE_RULE = 1;\nCSSOM.CSSRule.CHARSET_RULE = 2; // obsolete\nCSSOM.CSSRule.IMPORT_RULE = 3;\nCSSOM.CSSRule.MEDIA_RULE = 4;\nCSSOM.CSSRule.FONT_FACE_RULE = 5;\nCSSOM.CSSRule.PAGE_RULE = 6;\nCSSOM.CSSRule.KEYFRAMES_RULE = 7;\nCSSOM.CSSRule.KEYFRAME_RULE = 8;\nCSSOM.CSSRule.MARGIN_RULE = 9;\nCSSOM.CSSRule.NAMESPACE_RULE = 10;\nCSSOM.CSSRule.COUNTER_STYLE_RULE = 11;\nCSSOM.CSSRule.SUPPORTS_RULE = 12;\nCSSOM.CSSRule.DOCUMENT_RULE = 13;\nCSSOM.CSSRule.FONT_FEATURE_VALUES_RULE = 14;\nCSSOM.CSSRule.VIEWPORT_RULE = 15;\nCSSOM.CSSRule.REGION_STYLE_RULE = 16;\n\n\nCSSOM.CSSRule.prototype = {\n\tconstructor: CSSOM.CSSRule\n\t//FIXME\n};\n\n\n//.CommonJS\nexports.CSSRule = CSSOM.CSSRule;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {\n\tCSSStyleDeclaration: require(\"./CSSStyleDeclaration\").CSSStyleDeclaration,\n\tCSSRule: require(\"./CSSRule\").CSSRule\n};\n///CommonJS\n\n\n/**\n * @constructor\n * @see http://dev.w3.org/csswg/cssom/#cssstylerule\n * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleRule\n */\nCSSOM.CSSStyleRule = function CSSStyleRule() {\n\tCSSOM.CSSRule.call(this);\n\tthis.selectorText = \"\";\n\tthis.style = new CSSOM.CSSStyleDeclaration();\n\tthis.style.parentRule = this;\n};\n\nCSSOM.CSSStyleRule.prototype = new CSSOM.CSSRule();\nCSSOM.CSSStyleRule.prototype.constructor = CSSOM.CSSStyleRule;\nCSSOM.CSSStyleRule.prototype.type = 1;\n\nObject.defineProperty(CSSOM.CSSStyleRule.prototype, \"cssText\", {\n\tget: function() {\n\t\tvar text;\n\t\tif (this.selectorText) {\n\t\t\ttext = this.selectorText + \" {\" + this.style.cssText + \"}\";\n\t\t} else {\n\t\t\ttext = \"\";\n\t\t}\n\t\treturn text;\n\t},\n\tset: function(cssText) {\n\t\tvar rule = CSSOM.CSSStyleRule.parse(cssText);\n\t\tthis.style = rule.style;\n\t\tthis.selectorText = rule.selectorText;\n\t}\n});\n\n\n/**\n * NON-STANDARD\n * lightweight version of parse.js.\n * @param {string} ruleText\n * @return CSSStyleRule\n */\nCSSOM.CSSStyleRule.parse = function(ruleText) {\n\tvar i = 0;\n\tvar state = \"selector\";\n\tvar index;\n\tvar j = i;\n\tvar buffer = \"\";\n\n\tvar SIGNIFICANT_WHITESPACE = {\n\t\t\"selector\": true,\n\t\t\"value\": true\n\t};\n\n\tvar styleRule = new CSSOM.CSSStyleRule();\n\tvar name, priority=\"\";\n\n\tfor (var character; (character = ruleText.charAt(i)); i++) {\n\n\t\tswitch (character) {\n\n\t\tcase \" \":\n\t\tcase \"\\t\":\n\t\tcase \"\\r\":\n\t\tcase \"\\n\":\n\t\tcase \"\\f\":\n\t\t\tif (SIGNIFICANT_WHITESPACE[state]) {\n\t\t\t\t// Squash 2 or more white-spaces in the row into 1\n\t\t\t\tswitch (ruleText.charAt(i - 1)) {\n\t\t\t\t\tcase \" \":\n\t\t\t\t\tcase \"\\t\":\n\t\t\t\t\tcase \"\\r\":\n\t\t\t\t\tcase \"\\n\":\n\t\t\t\t\tcase \"\\f\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tbuffer += \" \";\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\n\t\t// String\n\t\tcase '\"':\n\t\t\tj = i + 1;\n\t\t\tindex = ruleText.indexOf('\"', j) + 1;\n\t\t\tif (!index) {\n\t\t\t\tthrow '\" is missing';\n\t\t\t}\n\t\t\tbuffer += ruleText.slice(i, index);\n\t\t\ti = index - 1;\n\t\t\tbreak;\n\n\t\tcase \"'\":\n\t\t\tj = i + 1;\n\t\t\tindex = ruleText.indexOf(\"'\", j) + 1;\n\t\t\tif (!index) {\n\t\t\t\tthrow \"' is missing\";\n\t\t\t}\n\t\t\tbuffer += ruleText.slice(i, index);\n\t\t\ti = index - 1;\n\t\t\tbreak;\n\n\t\t// Comment\n\t\tcase \"/\":\n\t\t\tif (ruleText.charAt(i + 1) === \"*\") {\n\t\t\t\ti += 2;\n\t\t\t\tindex = ruleText.indexOf(\"*/\", i);\n\t\t\t\tif (index === -1) {\n\t\t\t\t\tthrow new SyntaxError(\"Missing */\");\n\t\t\t\t} else {\n\t\t\t\t\ti = index + 1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbuffer += character;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase \"{\":\n\t\t\tif (state === \"selector\") {\n\t\t\t\tstyleRule.selectorText = buffer.trim();\n\t\t\t\tbuffer = \"\";\n\t\t\t\tstate = \"name\";\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase \":\":\n\t\t\tif (state === \"name\") {\n\t\t\t\tname = buffer.trim();\n\t\t\t\tbuffer = \"\";\n\t\t\t\tstate = \"value\";\n\t\t\t} else {\n\t\t\t\tbuffer += character;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase \"!\":\n\t\t\tif (state === \"value\" && ruleText.indexOf(\"!important\", i) === i) {\n\t\t\t\tpriority = \"important\";\n\t\t\t\ti += \"important\".length;\n\t\t\t} else {\n\t\t\t\tbuffer += character;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase \";\":\n\t\t\tif (state === \"value\") {\n\t\t\t\tstyleRule.style.setProperty(name, buffer.trim(), priority);\n\t\t\t\tpriority = \"\";\n\t\t\t\tbuffer = \"\";\n\t\t\t\tstate = \"name\";\n\t\t\t} else {\n\t\t\t\tbuffer += character;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase \"}\":\n\t\t\tif (state === \"value\") {\n\t\t\t\tstyleRule.style.setProperty(name, buffer.trim(), priority);\n\t\t\t\tpriority = \"\";\n\t\t\t\tbuffer = \"\";\n\t\t\t} else if (state === \"name\") {\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tbuffer += character;\n\t\t\t}\n\t\t\tstate = \"selector\";\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbuffer += character;\n\t\t\tbreak;\n\n\t\t}\n\t}\n\n\treturn styleRule;\n\n};\n\n\n//.CommonJS\nexports.CSSStyleRule = CSSOM.CSSStyleRule;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {\n\tStyleSheet: require(\"./StyleSheet\").StyleSheet,\n\tCSSStyleRule: require(\"./CSSStyleRule\").CSSStyleRule\n};\n///CommonJS\n\n\n/**\n * @constructor\n * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet\n */\nCSSOM.CSSStyleSheet = function CSSStyleSheet() {\n\tCSSOM.StyleSheet.call(this);\n\tthis.cssRules = [];\n};\n\n\nCSSOM.CSSStyleSheet.prototype = new CSSOM.StyleSheet();\nCSSOM.CSSStyleSheet.prototype.constructor = CSSOM.CSSStyleSheet;\n\n\n/**\n * Used to insert a new rule into the style sheet. The new rule now becomes part of the cascade.\n *\n * sheet = new Sheet(\"body {margin: 0}\")\n * sheet.toString()\n * -> \"body{margin:0;}\"\n * sheet.insertRule(\"img {border: none}\", 0)\n * -> 0\n * sheet.toString()\n * -> \"img{border:none;}body{margin:0;}\"\n *\n * @param {string} rule\n * @param {number} index\n * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet-insertRule\n * @return {number} The index within the style sheet's rule collection of the newly inserted rule.\n */\nCSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) {\n\tif (index < 0 || index > this.cssRules.length) {\n\t\tthrow new RangeError(\"INDEX_SIZE_ERR\");\n\t}\n\tvar cssRule = CSSOM.parse(rule).cssRules[0];\n\tcssRule.parentStyleSheet = this;\n\tthis.cssRules.splice(index, 0, cssRule);\n\treturn index;\n};\n\n\n/**\n * Used to delete a rule from the style sheet.\n *\n * sheet = new Sheet(\"img{border:none} body{margin:0}\")\n * sheet.toString()\n * -> \"img{border:none;}body{margin:0;}\"\n * sheet.deleteRule(0)\n * sheet.toString()\n * -> \"body{margin:0;}\"\n *\n * @param {number} index within the style sheet's rule list of the rule to remove.\n * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet-deleteRule\n */\nCSSOM.CSSStyleSheet.prototype.deleteRule = function(index) {\n\tif (index < 0 || index >= this.cssRules.length) {\n\t\tthrow new RangeError(\"INDEX_SIZE_ERR\");\n\t}\n\tthis.cssRules.splice(index, 1);\n};\n\n\n/**\n * NON-STANDARD\n * @return {string} serialize stylesheet\n */\nCSSOM.CSSStyleSheet.prototype.toString = function() {\n\tvar result = \"\";\n\tvar rules = this.cssRules;\n\tfor (var i=0; i<rules.length; i++) {\n\t\tresult += rules[i].cssText + \"\\n\";\n\t}\n\treturn result;\n};\n\n\n//.CommonJS\nexports.CSSStyleSheet = CSSOM.CSSStyleSheet;\nCSSOM.parse = require('./parse').parse; // Cannot be included sooner due to the mutual dependency between parse.js and CSSStyleSheet.js\n///CommonJS\n","//.CommonJS\nvar CSSOM = {};\n///CommonJS\n\n\n/**\n * @constructor\n * @see http://dev.w3.org/csswg/cssom/#the-medialist-interface\n */\nCSSOM.MediaList = function MediaList(){\n\tthis.length = 0;\n};\n\nCSSOM.MediaList.prototype = {\n\n\tconstructor: CSSOM.MediaList,\n\n\t/**\n\t * @return {string}\n\t */\n\tget mediaText() {\n\t\treturn Array.prototype.join.call(this, \", \");\n\t},\n\n\t/**\n\t * @param {string} value\n\t */\n\tset mediaText(value) {\n\t\tvar values = value.split(\",\");\n\t\tvar length = this.length = values.length;\n\t\tfor (var i=0; i<length; i++) {\n\t\t\tthis[i] = values[i].trim();\n\t\t}\n\t},\n\n\t/**\n\t * @param {string} medium\n\t */\n\tappendMedium: function(medium) {\n\t\tif (Array.prototype.indexOf.call(this, medium) === -1) {\n\t\t\tthis[this.length] = medium;\n\t\t\tthis.length++;\n\t\t}\n\t},\n\n\t/**\n\t * @param {string} medium\n\t */\n\tdeleteMedium: function(medium) {\n\t\tvar index = Array.prototype.indexOf.call(this, medium);\n\t\tif (index !== -1) {\n\t\t\tArray.prototype.splice.call(this, index, 1);\n\t\t}\n\t}\n\n};\n\n\n//.CommonJS\nexports.MediaList = CSSOM.MediaList;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {\n\tCSSRule: require(\"./CSSRule\").CSSRule,\n\tCSSStyleSheet: require(\"./CSSStyleSheet\").CSSStyleSheet,\n\tMediaList: require(\"./MediaList\").MediaList\n};\n///CommonJS\n\n\n/**\n * @constructor\n * @see http://dev.w3.org/csswg/cssom/#cssimportrule\n * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSImportRule\n */\nCSSOM.CSSImportRule = function CSSImportRule() {\n\tCSSOM.CSSRule.call(this);\n\tthis.href = \"\";\n\tthis.media = new CSSOM.MediaList();\n\tthis.styleSheet = new CSSOM.CSSStyleSheet();\n};\n\nCSSOM.CSSImportRule.prototype = new CSSOM.CSSRule();\nCSSOM.CSSImportRule.prototype.constructor = CSSOM.CSSImportRule;\nCSSOM.CSSImportRule.prototype.type = 3;\n\nObject.defineProperty(CSSOM.CSSImportRule.prototype, \"cssText\", {\n get: function() {\n var mediaText = this.media.mediaText;\n return \"@import url(\" + this.href + \")\" + (mediaText ? \" \" + mediaText : \"\") + \";\";\n },\n set: function(cssText) {\n var i = 0;\n\n /**\n * @import url(partial.css) screen, handheld;\n * || |\n * after-import media\n * |\n * url\n */\n var state = '';\n\n var buffer = '';\n var index;\n for (var character; (character = cssText.charAt(i)); i++) {\n\n switch (character) {\n case ' ':\n case '\\t':\n case '\\r':\n case '\\n':\n case '\\f':\n if (state === 'after-import') {\n state = 'url';\n } else {\n buffer += character;\n }\n break;\n\n case '@':\n if (!state && cssText.indexOf('@import', i) === i) {\n state = 'after-import';\n i += 'import'.length;\n buffer = '';\n }\n break;\n\n case 'u':\n if (state === 'url' && cssText.indexOf('url(', i) === i) {\n index = cssText.indexOf(')', i + 1);\n if (index === -1) {\n throw i + ': \")\" not found';\n }\n i += 'url('.length;\n var url = cssText.slice(i, index);\n if (url[0] === url[url.length - 1]) {\n if (url[0] === '\"' || url[0] === \"'\") {\n url = url.slice(1, -1);\n }\n }\n this.href = url;\n i = index;\n state = 'media';\n }\n break;\n\n case '\"':\n if (state === 'url') {\n index = cssText.indexOf('\"', i + 1);\n if (!index) {\n throw i + \": '\\\"' not found\";\n }\n this.href = cssText.slice(i + 1, index);\n i = index;\n state = 'media';\n }\n break;\n\n case \"'\":\n if (state === 'url') {\n index = cssText.indexOf(\"'\", i + 1);\n if (!index) {\n throw i + ': \"\\'\" not found';\n }\n this.href = cssText.slice(i + 1, index);\n i = index;\n state = 'media';\n }\n break;\n\n case ';':\n if (state === 'media') {\n if (buffer) {\n this.media.mediaText = buffer.trim();\n }\n }\n break;\n\n default:\n if (state === 'media') {\n buffer += character;\n }\n break;\n }\n }\n }\n});\n\n\n//.CommonJS\nexports.CSSImportRule = CSSOM.CSSImportRule;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {\n\tCSSRule: require(\"./CSSRule\").CSSRule\n};\n///CommonJS\n\n\n/**\n * @constructor\n * @see https://drafts.csswg.org/cssom/#the-cssgroupingrule-interface\n */\nCSSOM.CSSGroupingRule = function CSSGroupingRule() {\n\tCSSOM.CSSRule.call(this);\n\tthis.cssRules = [];\n};\n\nCSSOM.CSSGroupingRule.prototype = new CSSOM.CSSRule();\nCSSOM.CSSGroupingRule.prototype.constructor = CSSOM.CSSGroupingRule;\n\n\n/**\n * Used to insert a new CSS rule to a list of CSS rules.\n *\n * @example\n * cssGroupingRule.cssText\n * -> \"body{margin:0;}\"\n * cssGroupingRule.insertRule(\"img{border:none;}\", 1)\n * -> 1\n * cssGroupingRule.cssText\n * -> \"body{margin:0;}img{border:none;}\"\n *\n * @param {string} rule\n * @param {number} [index]\n * @see https://www.w3.org/TR/cssom-1/#dom-cssgroupingrule-insertrule\n * @return {number} The index within the grouping rule's collection of the newly inserted rule.\n */\n CSSOM.CSSGroupingRule.prototype.insertRule = function insertRule(rule, index) {\n\tif (index < 0 || index > this.cssRules.length) {\n\t\tthrow new RangeError(\"INDEX_SIZE_ERR\");\n\t}\n\tvar cssRule = CSSOM.parse(rule).cssRules[0];\n\tcssRule.parentRule = this;\n\tthis.cssRules.splice(index, 0, cssRule);\n\treturn index;\n};\n\n/**\n * Used to delete a rule from the grouping rule.\n *\n * cssGroupingRule.cssText\n * -> \"img{border:none;}body{margin:0;}\"\n * cssGroupingRule.deleteRule(0)\n * cssGroupingRule.cssText\n * -> \"body{margin:0;}\"\n *\n * @param {number} index within the grouping rule's rule list of the rule to remove.\n * @see https://www.w3.org/TR/cssom-1/#dom-cssgroupingrule-deleterule\n */\n CSSOM.CSSGroupingRule.prototype.deleteRule = function deleteRule(index) {\n\tif (index < 0 || index >= this.cssRules.length) {\n\t\tthrow new RangeError(\"INDEX_SIZE_ERR\");\n\t}\n\tthis.cssRules.splice(index, 1)[0].parentRule = null;\n};\n\n//.CommonJS\nexports.CSSGroupingRule = CSSOM.CSSGroupingRule;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {\n CSSRule: require(\"./CSSRule\").CSSRule,\n CSSGroupingRule: require(\"./CSSGroupingRule\").CSSGroupingRule\n};\n///CommonJS\n\n\n/**\n * @constructor\n * @see https://www.w3.org/TR/css-conditional-3/#the-cssconditionrule-interface\n */\nCSSOM.CSSConditionRule = function CSSConditionRule() {\n CSSOM.CSSGroupingRule.call(this);\n this.cssRules = [];\n};\n\nCSSOM.CSSConditionRule.prototype = new CSSOM.CSSGroupingRule();\nCSSOM.CSSConditionRule.prototype.constructor = CSSOM.CSSConditionRule;\nCSSOM.CSSConditionRule.prototype.conditionText = ''\nCSSOM.CSSConditionRule.prototype.cssText = ''\n\n//.CommonJS\nexports.CSSConditionRule = CSSOM.CSSConditionRule;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {\n\tCSSRule: require(\"./CSSRule\").CSSRule,\n\tCSSGroupingRule: require(\"./CSSGroupingRule\").CSSGroupingRule,\n\tCSSConditionRule: require(\"./CSSConditionRule\").CSSConditionRule,\n\tMediaList: require(\"./MediaList\").MediaList\n};\n///CommonJS\n\n\n/**\n * @constructor\n * @see http://dev.w3.org/csswg/cssom/#cssmediarule\n * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSMediaRule\n */\nCSSOM.CSSMediaRule = function CSSMediaRule() {\n\tCSSOM.CSSConditionRule.call(this);\n\tthis.media = new CSSOM.MediaList();\n};\n\nCSSOM.CSSMediaRule.prototype = new CSSOM.CSSConditionRule();\nCSSOM.CSSMediaRule.prototype.constructor = CSSOM.CSSMediaRule;\nCSSOM.CSSMediaRule.prototype.type = 4;\n\n// https://opensource.apple.com/source/WebCore/WebCore-7611.1.21.161.3/css/CSSMediaRule.cpp\nObject.defineProperties(CSSOM.CSSMediaRule.prototype, {\n \"conditionText\": {\n get: function() {\n return this.media.mediaText;\n },\n set: function(value) {\n this.media.mediaText = value;\n },\n configurable: true,\n enumerable: true\n },\n \"cssText\": {\n get: function() {\n var cssTexts = [];\n for (var i=0, length=this.cssRules.length; i < length; i++) {\n cssTexts.push(this.cssRules[i].cssText);\n }\n return \"@media \" + this.media.mediaText + \" {\" + cssTexts.join(\"\") + \"}\";\n },\n configurable: true,\n enumerable: true\n }\n});\n\n\n//.CommonJS\nexports.CSSMediaRule = CSSOM.CSSMediaRule;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {\n CSSRule: require(\"./CSSRule\").CSSRule,\n CSSGroupingRule: require(\"./CSSGroupingRule\").CSSGroupingRule,\n CSSConditionRule: require(\"./CSSConditionRule\").CSSConditionRule\n};\n///CommonJS\n\n\n/**\n * @constructor\n * @see https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface\n */\nCSSOM.CSSSupportsRule = function CSSSupportsRule() {\n CSSOM.CSSConditionRule.call(this);\n};\n\nCSSOM.CSSSupportsRule.prototype = new CSSOM.CSSConditionRule();\nCSSOM.CSSSupportsRule.prototype.constructor = CSSOM.CSSSupportsRule;\nCSSOM.CSSSupportsRule.prototype.type = 12;\n\nObject.defineProperty(CSSOM.CSSSupportsRule.prototype, \"cssText\", {\n get: function() {\n var cssTexts = [];\n\n for (var i = 0, length = this.cssRules.length; i < length; i++) {\n cssTexts.push(this.cssRules[i].cssText);\n }\n\n return \"@supports \" + this.conditionText + \" {\" + cssTexts.join(\"\") + \"}\";\n }\n});\n\n//.CommonJS\nexports.CSSSupportsRule = CSSOM.CSSSupportsRule;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {\n\tCSSStyleDeclaration: require(\"./CSSStyleDeclaration\").CSSStyleDeclaration,\n\tCSSRule: require(\"./CSSRule\").CSSRule\n};\n///CommonJS\n\n\n/**\n * @constructor\n * @see http://dev.w3.org/csswg/cssom/#css-font-face-rule\n */\nCSSOM.CSSFontFaceRule = function CSSFontFaceRule() {\n\tCSSOM.CSSRule.call(this);\n\tthis.style = new CSSOM.CSSStyleDeclaration();\n\tthis.style.parentRule = this;\n};\n\nCSSOM.CSSFontFaceRule.prototype = new CSSOM.CSSRule();\nCSSOM.CSSFontFaceRule.prototype.constructor = CSSOM.CSSFontFaceRule;\nCSSOM.CSSFontFaceRule.prototype.type = 5;\n//FIXME\n//CSSOM.CSSFontFaceRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;\n//CSSOM.CSSFontFaceRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;\n\n// http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSFontFaceRule.cpp\nObject.defineProperty(CSSOM.CSSFontFaceRule.prototype, \"cssText\", {\n get: function() {\n return \"@font-face {\" + this.style.cssText + \"}\";\n }\n});\n\n\n//.CommonJS\nexports.CSSFontFaceRule = CSSOM.CSSFontFaceRule;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {\n\tCSSRule: require(\"./CSSRule\").CSSRule\n};\n///CommonJS\n\n\n/**\n * @constructor\n * @see http://www.w3.org/TR/shadow-dom/#host-at-rule\n */\nCSSOM.CSSHostRule = function CSSHostRule() {\n\tCSSOM.CSSRule.call(this);\n\tthis.cssRules = [];\n};\n\nCSSOM.CSSHostRule.prototype = new CSSOM.CSSRule();\nCSSOM.CSSHostRule.prototype.constructor = CSSOM.CSSHostRule;\nCSSOM.CSSHostRule.prototype.type = 1001;\n//FIXME\n//CSSOM.CSSHostRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;\n//CSSOM.CSSHostRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;\n\nObject.defineProperty(CSSOM.CSSHostRule.prototype, \"cssText\", {\n\tget: function() {\n\t\tvar cssTexts = [];\n\t\tfor (var i=0, length=this.cssRules.length; i < length; i++) {\n\t\t\tcssTexts.push(this.cssRules[i].cssText);\n\t\t}\n\t\treturn \"@host {\" + cssTexts.join(\"\") + \"}\";\n\t}\n});\n\n\n//.CommonJS\nexports.CSSHostRule = CSSOM.CSSHostRule;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {\n\tCSSRule: require(\"./CSSRule\").CSSRule,\n\tCSSStyleDeclaration: require('./CSSStyleDeclaration').CSSStyleDeclaration\n};\n///CommonJS\n\n\n/**\n * @constructor\n * @see http://www.w3.org/TR/css3-animations/#DOM-CSSKeyframeRule\n */\nCSSOM.CSSKeyframeRule = function CSSKeyframeRule() {\n\tCSSOM.CSSRule.call(this);\n\tthis.keyText = '';\n\tthis.style = new CSSOM.CSSStyleDeclaration();\n\tthis.style.parentRule = this;\n};\n\nCSSOM.CSSKeyframeRule.prototype = new CSSOM.CSSRule();\nCSSOM.CSSKeyframeRule.prototype.constructor = CSSOM.CSSKeyframeRule;\nCSSOM.CSSKeyframeRule.prototype.type = 8;\n//FIXME\n//CSSOM.CSSKeyframeRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;\n//CSSOM.CSSKeyframeRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;\n\n// http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSKeyframeRule.cpp\nObject.defineProperty(CSSOM.CSSKeyframeRule.prototype, \"cssText\", {\n get: function() {\n return this.keyText + \" {\" + this.style.cssText + \"} \";\n }\n});\n\n\n//.CommonJS\nexports.CSSKeyframeRule = CSSOM.CSSKeyframeRule;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {\n\tCSSRule: require(\"./CSSRule\").CSSRule\n};\n///CommonJS\n\n\n/**\n * @constructor\n * @see http://www.w3.org/TR/css3-animations/#DOM-CSSKeyframesRule\n */\nCSSOM.CSSKeyframesRule = function CSSKeyframesRule() {\n\tCSSOM.CSSRule.call(this);\n\tthis.name = '';\n\tthis.cssRules = [];\n};\n\nCSSOM.CSSKeyframesRule.prototype = new CSSOM.CSSRule();\nCSSOM.CSSKeyframesRule.prototype.constructor = CSSOM.CSSKeyframesRule;\nCSSOM.CSSKeyframesRule.prototype.type = 7;\n//FIXME\n//CSSOM.CSSKeyframesRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;\n//CSSOM.CSSKeyframesRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;\n\n// http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSKeyframesRule.cpp\nObject.defineProperty(CSSOM.CSSKeyframesRule.prototype, \"cssText\", {\n get: function() {\n var cssTexts = [];\n for (var i=0, length=this.cssRules.length; i < length; i++) {\n cssTexts.push(\" \" + this.cssRules[i].cssText);\n }\n return \"@\" + (this._vendorPrefix || '') + \"keyframes \" + this.name + \" { \\n\" + cssTexts.join(\"\\n\") + \"\\n}\";\n }\n});\n\n\n//.CommonJS\nexports.CSSKeyframesRule = CSSOM.CSSKeyframesRule;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {};\n///CommonJS\n\n\n/**\n * @constructor\n * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSValue\n *\n * TODO: add if needed\n */\nCSSOM.CSSValue = function CSSValue() {\n};\n\nCSSOM.CSSValue.prototype = {\n\tconstructor: CSSOM.CSSValue,\n\n\t// @see: http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSValue\n\tset cssText(text) {\n\t\tvar name = this._getConstructorName();\n\n\t\tthrow new Error('DOMException: property \"cssText\" of \"' + name + '\" is readonly and can not be replaced with \"' + text + '\"!');\n\t},\n\n\tget cssText() {\n\t\tvar name = this._getConstructorName();\n\n\t\tthrow new Error('getter \"cssText\" of \"' + name + '\" is not implemented!');\n\t},\n\n\t_getConstructorName: function() {\n\t\tvar s = this.constructor.toString(),\n\t\t\t\tc = s.match(/function\\s([^\\(]+)/),\n\t\t\t\tname = c[1];\n\n\t\treturn name;\n\t}\n};\n\n\n//.CommonJS\nexports.CSSValue = CSSOM.CSSValue;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {\n\tCSSValue: require('./CSSValue').CSSValue\n};\n///CommonJS\n\n\n/**\n * @constructor\n * @see http://msdn.microsoft.com/en-us/library/ms537634(v=vs.85).aspx\n *\n */\nCSSOM.CSSValueExpression = function CSSValueExpression(token, idx) {\n\tthis._token = token;\n\tthis._idx = idx;\n};\n\nCSSOM.CSSValueExpression.prototype = new CSSOM.CSSValue();\nCSSOM.CSSValueExpression.prototype.constructor = CSSOM.CSSValueExpression;\n\n/**\n * parse css expression() value\n *\n * @return {Object}\n * - error:\n * or\n * - idx:\n * - expression:\n *\n * Example:\n *\n * .selector {\n *\t\tzoom: expression(documentElement.clientWidth > 1000 ? '1000px' : 'auto');\n * }\n */\nCSSOM.CSSValueExpression.prototype.parse = function() {\n\tvar token = this._token,\n\t\t\tidx = this._idx;\n\n\tvar character = '',\n\t\t\texpression = '',\n\t\t\terror = '',\n\t\t\tinfo,\n\t\t\tparen = [];\n\n\n\tfor (; ; ++idx) {\n\t\tcharacter = token.charAt(idx);\n\n\t\t// end of token\n\t\tif (character === '') {\n\t\t\terror = 'css expression error: unfinished expression!';\n\t\t\tbreak;\n\t\t}\n\n\t\tswitch(character) {\n\t\t\tcase '(':\n\t\t\t\tparen.push(character);\n\t\t\t\texpression += character;\n\t\t\t\tbreak;\n\n\t\t\tcase ')':\n\t\t\t\tparen.pop(character);\n\t\t\t\texpression += character;\n\t\t\t\tbreak;\n\n\t\t\tcase '/':\n\t\t\t\tif ((info = this._parseJSComment(token, idx))) { // comment?\n\t\t\t\t\tif (info.error) {\n\t\t\t\t\t\terror = 'css expression error: unfinished comment in expression!';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tidx = info.idx;\n\t\t\t\t\t\t// ignore the comment\n\t\t\t\t\t}\n\t\t\t\t} else if ((info = this._parseJSRexExp(token, idx))) { // regexp\n\t\t\t\t\tidx = info.idx;\n\t\t\t\t\texpression += info.text;\n\t\t\t\t} else { // other\n\t\t\t\t\texpression += character;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase \"'\":\n\t\t\tcase '\"':\n\t\t\t\tinfo = this._parseJSString(token, idx, character);\n\t\t\t\tif (info) { // string\n\t\t\t\t\tidx = info.idx;\n\t\t\t\t\texpression += info.text;\n\t\t\t\t} else {\n\t\t\t\t\texpression += character;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\texpression += character;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (error) {\n\t\t\tbreak;\n\t\t}\n\n\t\t// end of expression\n\t\tif (paren.length === 0) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tvar ret;\n\tif (error) {\n\t\tret = {\n\t\t\terror: error\n\t\t};\n\t} else {\n\t\tret = {\n\t\t\tidx: idx,\n\t\t\texpression: expression\n\t\t};\n\t}\n\n\treturn ret;\n};\n\n\n/**\n *\n * @return {Object|false}\n * - idx:\n * - text:\n * or\n * - error:\n * or\n * false\n *\n */\nCSSOM.CSSValueExpression.prototype._parseJSComment = function(token, idx) {\n\tvar nextChar = token.charAt(idx + 1),\n\t\t\ttext;\n\n\tif (nextChar === '/' || nextChar === '*') {\n\t\tvar startIdx = idx,\n\t\t\t\tendIdx,\n\t\t\t\tcommentEndChar;\n\n\t\tif (nextChar === '/') { // line comment\n\t\t\tcommentEndChar = '\\n';\n\t\t} else if (nextChar === '*') { // block comment\n\t\t\tcommentEndChar = '*/';\n\t\t}\n\n\t\tendIdx = token.indexOf(commentEndChar, startIdx + 1 + 1);\n\t\tif (endIdx !== -1) {\n\t\t\tendIdx = endIdx + commentEndChar.length - 1;\n\t\t\ttext = token.substring(idx, endIdx + 1);\n\t\t\treturn {\n\t\t\t\tidx: endIdx,\n\t\t\t\ttext: text\n\t\t\t};\n\t\t} else {\n\t\t\tvar error = 'css expression error: unfinished comment in expression!';\n\t\t\treturn {\n\t\t\t\terror: error\n\t\t\t};\n\t\t}\n\t} else {\n\t\treturn false;\n\t}\n};\n\n\n/**\n *\n * @return {Object|false}\n *\t\t\t\t\t- idx:\n *\t\t\t\t\t- text:\n *\t\t\t\t\tor \n *\t\t\t\t\tfalse\n *\n */\nCSSOM.CSSValueExpression.prototype._parseJSString = function(token, idx, sep) {\n\tvar endIdx = this._findMatchedIdx(token, idx, sep),\n\t\t\ttext;\n\n\tif (endIdx === -1) {\n\t\treturn false;\n\t} else {\n\t\ttext = token.substring(idx, endIdx + sep.length);\n\n\t\treturn {\n\t\t\tidx: endIdx,\n\t\t\ttext: text\n\t\t};\n\t}\n};\n\n\n/**\n * parse regexp in css expression\n *\n * @return {Object|false}\n *\t\t\t\t- idx:\n *\t\t\t\t- regExp:\n *\t\t\t\tor \n *\t\t\t\tfalse\n */\n\n/*\n\nall legal RegExp\n \n/a/\n(/a/)\n[/a/]\n[12, /a/]\n\n!/a/\n\n+/a/\n-/a/\n* /a/\n/ /a/\n%/a/\n\n===/a/\n!==/a/\n==/a/\n!=/a/\n>/a/\n>=/a/\n</a/\n<=/a/\n\n&/a/\n|/a/\n^/a/\n~/a/\n<</a/\n>>/a/\n>>>/a/\n\n&&/a/\n||/a/\n?/a/\n=/a/\n,/a/\n\n\t\tdelete /a/\n\t\t\t\tin /a/\ninstanceof /a/\n\t\t\t\tnew /a/\n\t\ttypeof /a/\n\t\t\tvoid /a/\n\n*/\nCSSOM.CSSValueExpression.prototype._parseJSRexExp = function(token, idx) {\n\tvar before = token.substring(0, idx).replace(/\\s+$/, \"\"),\n\t\t\tlegalRegx = [\n\t\t\t\t/^$/,\n\t\t\t\t/\\($/,\n\t\t\t\t/\\[$/,\n\t\t\t\t/\\!$/,\n\t\t\t\t/\\+$/,\n\t\t\t\t/\\-$/,\n\t\t\t\t/\\*$/,\n\t\t\t\t/\\/\\s+/,\n\t\t\t\t/\\%$/,\n\t\t\t\t/\\=$/,\n\t\t\t\t/\\>$/,\n\t\t\t\t/<$/,\n\t\t\t\t/\\&$/,\n\t\t\t\t/\\|$/,\n\t\t\t\t/\\^$/,\n\t\t\t\t/\\~$/,\n\t\t\t\t/\\?$/,\n\t\t\t\t/\\,$/,\n\t\t\t\t/delete$/,\n\t\t\t\t/in$/,\n\t\t\t\t/instanceof$/,\n\t\t\t\t/new$/,\n\t\t\t\t/typeof$/,\n\t\t\t\t/void$/\n\t\t\t];\n\n\tvar isLegal = legalRegx.some(function(reg) {\n\t\treturn reg.test(before);\n\t});\n\n\tif (!isLegal) {\n\t\treturn false;\n\t} else {\n\t\tvar sep = '/';\n\n\t\t// same logic as string\n\t\treturn this._parseJSString(token, idx, sep);\n\t}\n};\n\n\n/**\n *\n * find next sep(same line) index in `token`\n *\n * @return {Number}\n *\n */\nCSSOM.CSSValueExpression.prototype._findMatchedIdx = function(token, idx, sep) {\n\tvar startIdx = idx,\n\t\t\tendIdx;\n\n\tvar NOT_FOUND = -1;\n\n\twhile(true) {\n\t\tendIdx = token.indexOf(sep, startIdx + 1);\n\n\t\tif (endIdx === -1) { // not found\n\t\t\tendIdx = NOT_FOUND;\n\t\t\tbreak;\n\t\t} else {\n\t\t\tvar text = token.substring(idx + 1, endIdx),\n\t\t\t\t\tmatched = text.match(/\\\\+$/);\n\t\t\tif (!matched || matched[0] % 2 === 0) { // not escaped\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tstartIdx = endIdx;\n\t\t\t}\n\t\t}\n\t}\n\n\t// boundary must be in the same line(js sting or regexp)\n\tvar nextNewLineIdx = token.indexOf('\\n', idx + 1);\n\tif (nextNewLineIdx < endIdx) {\n\t\tendIdx = NOT_FOUND;\n\t}\n\n\n\treturn endIdx;\n};\n\n\n\n\n//.CommonJS\nexports.CSSValueExpression = CSSOM.CSSValueExpression;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {};\n///CommonJS\n\n\n/**\n * @constructor\n * @see https://developer.mozilla.org/en/CSS/@-moz-document\n */\nCSSOM.MatcherList = function MatcherList(){\n this.length = 0;\n};\n\nCSSOM.MatcherList.prototype = {\n\n constructor: CSSOM.MatcherList,\n\n /**\n * @return {string}\n */\n get matcherText() {\n return Array.prototype.join.call(this, \", \");\n },\n\n /**\n * @param {string} value\n */\n set matcherText(value) {\n // just a temporary solution, actually it may be wrong by just split the value with ',', because a url can include ','.\n var values = value.split(\",\");\n var length = this.length = values.length;\n for (var i=0; i<length; i++) {\n this[i] = values[i].trim();\n }\n },\n\n /**\n * @param {string} matcher\n */\n appendMatcher: function(matcher) {\n if (Array.prototype.indexOf.call(this, matcher) === -1) {\n this[this.length] = matcher;\n this.length++;\n }\n },\n\n /**\n * @param {string} matcher\n */\n deleteMatcher: function(matcher) {\n var index = Array.prototype.indexOf.call(this, matcher);\n if (index !== -1) {\n Array.prototype.splice.call(this, index, 1);\n }\n }\n\n};\n\n\n//.CommonJS\nexports.MatcherList = CSSOM.MatcherList;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {\n CSSRule: require(\"./CSSRule\").CSSRule,\n MatcherList: require(\"./MatcherList\").MatcherList\n};\n///CommonJS\n\n\n/**\n * @constructor\n * @see https://developer.mozilla.org/en/CSS/@-moz-document\n */\nCSSOM.CSSDocumentRule = function CSSDocumentRule() {\n CSSOM.CSSRule.call(this);\n this.matcher = new CSSOM.MatcherList();\n this.cssRules = [];\n};\n\nCSSOM.CSSDocumentRule.prototype = new CSSOM.CSSRule();\nCSSOM.CSSDocumentRule.prototype.constructor = CSSOM.CSSDocumentRule;\nCSSOM.CSSDocumentRule.prototype.type = 10;\n//FIXME\n//CSSOM.CSSDocumentRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;\n//CSSOM.CSSDocumentRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;\n\nObject.defineProperty(CSSOM.CSSDocumentRule.prototype, \"cssText\", {\n get: function() {\n var cssTexts = [];\n for (var i=0, length=this.cssRules.length; i < length; i++) {\n cssTexts.push(this.cssRules[i].cssText);\n }\n return \"@-moz-document \" + this.matcher.matcherText + \" {\" + cssTexts.join(\"\") + \"}\";\n }\n});\n\n\n//.CommonJS\nexports.CSSDocumentRule = CSSOM.CSSDocumentRule;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {};\n///CommonJS\n\n\n/**\n * @param {string} token\n */\nCSSOM.parse = function parse(token) {\n\n\tvar i = 0;\n\n\t/**\n\t\t\"before-selector\" or\n\t\t\"selector\" or\n\t\t\"atRule\" or\n\t\t\"atBlock\" or\n\t\t\"conditionBlock\" or\n\t\t\"before-name\" or\n\t\t\"name\" or\n\t\t\"before-value\" or\n\t\t\"value\"\n\t*/\n\tvar state = \"before-selector\";\n\n\tvar index;\n\tvar buffer = \"\";\n\tvar valueParenthesisDepth = 0;\n\n\tvar SIGNIFICANT_WHITESPACE = {\n\t\t\"selector\": true,\n\t\t\"value\": true,\n\t\t\"value-parenthesis\": true,\n\t\t\"atRule\": true,\n\t\t\"importRule-begin\": true,\n\t\t\"importRule\": true,\n\t\t\"atBlock\": true,\n\t\t\"conditionBlock\": true,\n\t\t'documentRule-begin': true\n\t};\n\n\tvar styleSheet = new CSSOM.CSSStyleSheet();\n\n\t// @type CSSStyleSheet|CSSMediaRule|CSSSupportsRule|CSSFontFaceRule|CSSKeyframesRule|CSSDocumentRule\n\tvar currentScope = styleSheet;\n\n\t// @type CSSMediaRule|CSSSupportsRule|CSSKeyframesRule|CSSDocumentRule\n\tvar parentRule;\n\n\tvar ancestorRules = [];\n\tvar hasAncestors = false;\n\tvar prevScope;\n\n\tvar name, priority=\"\", styleRule, mediaRule, supportsRule, importRule, fontFaceRule, keyframesRule, documentRule, hostRule;\n\n\tvar atKeyframesRegExp = /@(-(?:\\w+-)+)?keyframes/g;\n\n\tvar parseError = function(message) {\n\t\tvar lines = token.substring(0, i).split('\\n');\n\t\tvar lineCount = lines.length;\n\t\tvar charCount = lines.pop().length + 1;\n\t\tvar error = new Error(message + ' (line ' + lineCount + ', char ' + charCount + ')');\n\t\terror.line = lineCount;\n\t\t/* jshint sub : true */\n\t\terror['char'] = charCount;\n\t\terror.styleSheet = styleSheet;\n\t\tthrow error;\n\t};\n\n\tfor (var character; (character = token.charAt(i)); i++) {\n\n\t\tswitch (character) {\n\n\t\tcase \" \":\n\t\tcase \"\\t\":\n\t\tcase \"\\r\":\n\t\tcase \"\\n\":\n\t\tcase \"\\f\":\n\t\t\tif (SIGNIFICANT_WHITESPACE[state]) {\n\t\t\t\tbuffer += character;\n\t\t\t}\n\t\t\tbreak;\n\n\t\t// String\n\t\tcase '\"':\n\t\t\tindex = i + 1;\n\t\t\tdo {\n\t\t\t\tindex = token.indexOf('\"', index) + 1;\n\t\t\t\tif (!index) {\n\t\t\t\t\tparseError('Unmatched \"');\n\t\t\t\t}\n\t\t\t} while (token[index - 2] === '\\\\');\n\t\t\tbuffer += token.slice(i, index);\n\t\t\ti = index - 1;\n\t\t\tswitch (state) {\n\t\t\t\tcase 'before-value':\n\t\t\t\t\tstate = 'value';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'importRule-begin':\n\t\t\t\t\tstate = 'importRule';\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase \"'\":\n\t\t\tindex = i + 1;\n\t\t\tdo {\n\t\t\t\tindex = token.indexOf(\"'\", index) + 1;\n\t\t\t\tif (!index) {\n\t\t\t\t\tparseError(\"Unmatched '\");\n\t\t\t\t}\n\t\t\t} while (token[index - 2] === '\\\\');\n\t\t\tbuffer += token.slice(i, index);\n\t\t\ti = index - 1;\n\t\t\tswitch (state) {\n\t\t\t\tcase 'before-value':\n\t\t\t\t\tstate = 'value';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'importRule-begin':\n\t\t\t\t\tstate = 'importRule';\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\n\t\t// Comment\n\t\tcase \"/\":\n\t\t\tif (token.charAt(i + 1) === \"*\") {\n\t\t\t\ti += 2;\n\t\t\t\tindex = token.indexOf(\"*/\", i);\n\t\t\t\tif (index === -1) {\n\t\t\t\t\tparseError(\"Missing */\");\n\t\t\t\t} else {\n\t\t\t\t\ti = index + 1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbuffer += character;\n\t\t\t}\n\t\t\tif (state === \"importRule-begin\") {\n\t\t\t\tbuffer += \" \";\n\t\t\t\tstate = \"importRule\";\n\t\t\t}\n\t\t\tbreak;\n\n\t\t// At-rule\n\t\tcase \"@\":\n\t\t\tif (token.indexOf(\"@-moz-document\", i) === i) {\n\t\t\t\tstate = \"documentRule-begin\";\n\t\t\t\tdocumentRule = new CSSOM.CSSDocumentRule();\n\t\t\t\tdocumentRule.__starts = i;\n\t\t\t\ti += \"-moz-document\".length;\n\t\t\t\tbuffer = \"\";\n\t\t\t\tbreak;\n\t\t\t} else if (token.indexOf(\"@media\", i) === i) {\n\t\t\t\tstate = \"atBlock\";\n\t\t\t\tmediaRule = new CSSOM.CSSMediaRule();\n\t\t\t\tmediaRule.__starts = i;\n\t\t\t\ti += \"media\".length;\n\t\t\t\tbuffer = \"\";\n\t\t\t\tbreak;\n\t\t\t} else if (token.indexOf(\"@supports\", i) === i) {\n\t\t\t\tstate = \"conditionBlock\";\n\t\t\t\tsupportsRule = new CSSOM.CSSSupportsRule();\n\t\t\t\tsupportsRule.__starts = i;\n\t\t\t\ti += \"supports\".length;\n\t\t\t\tbuffer = \"\";\n\t\t\t\tbreak;\n\t\t\t} else if (token.indexOf(\"@host\", i) === i) {\n\t\t\t\tstate = \"hostRule-begin\";\n\t\t\t\ti += \"host\".length;\n\t\t\t\thostRule = new CSSOM.CSSHostRule();\n\t\t\t\thostRule.__starts = i;\n\t\t\t\tbuffer = \"\";\n\t\t\t\tbreak;\n\t\t\t} else if (token.indexOf(\"@import\", i) === i) {\n\t\t\t\tstate = \"importRule-begin\";\n\t\t\t\ti += \"import\".length;\n\t\t\t\tbuffer += \"@import\";\n\t\t\t\tbreak;\n\t\t\t} else if (token.indexOf(\"@font-face\", i) === i) {\n\t\t\t\tstate = \"fontFaceRule-begin\";\n\t\t\t\ti += \"font-face\".length;\n\t\t\t\tfontFaceRule = new CSSOM.CSSFontFaceRule();\n\t\t\t\tfontFaceRule.__starts = i;\n\t\t\t\tbuffer = \"\";\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tatKeyframesRegExp.lastIndex = i;\n\t\t\t\tvar matchKeyframes = atKeyframesRegExp.exec(token);\n\t\t\t\tif (matchKeyframes && matchKeyframes.index === i) {\n\t\t\t\t\tstate = \"keyframesRule-begin\";\n\t\t\t\t\tkeyframesRule = new CSSOM.CSSKeyframesRule();\n\t\t\t\t\tkeyframesRule.__starts = i;\n\t\t\t\t\tkeyframesRule._vendorPrefix = matchKeyframes[1]; // Will come out as undefined if no prefix was found\n\t\t\t\t\ti += matchKeyframes[0].length - 1;\n\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (state === \"selector\") {\n\t\t\t\t\tstate = \"atRule\";\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuffer += character;\n\t\t\tbreak;\n\n\t\tcase \"{\":\n\t\t\tif (state === \"selector\" || state === \"atRule\") {\n\t\t\t\tstyleRule.selectorText = buffer.trim();\n\t\t\t\tstyleRule.style.__starts = i;\n\t\t\t\tbuffer = \"\";\n\t\t\t\tstate = \"before-name\";\n\t\t\t} else if (state === \"atBlock\") {\n\t\t\t\tmediaRule.media.mediaText = buffer.trim();\n\n\t\t\t\tif (parentRule) {\n\t\t\t\t\tancestorRules.push(parentRule);\n\t\t\t\t}\n\n\t\t\t\tcurrentScope = parentRule = mediaRule;\n\t\t\t\tmediaRule.parentStyleSheet = styleSheet;\n\t\t\t\tbuffer = \"\";\n\t\t\t\tstate = \"before-selector\";\n\t\t\t} else if (state === \"conditionBlock\") {\n\t\t\t\tsupportsRule.conditionText = buffer.trim();\n\n\t\t\t\tif (parentRule) {\n\t\t\t\t\tancestorRules.push(parentRule);\n\t\t\t\t}\n\n\t\t\t\tcurrentScope = parentRule = supportsRule;\n\t\t\t\tsupportsRule.parentStyleSheet = styleSheet;\n\t\t\t\tbuffer = \"\";\n\t\t\t\tstate = \"before-selector\";\n\t\t\t} else if (state === \"hostRule-begin\") {\n\t\t\t\tif (parentRule) {\n\t\t\t\t\tancestorRules.push(parentRule);\n\t\t\t\t}\n\n\t\t\t\tcurrentScope = parentRule = hostRule;\n\t\t\t\thostRule.parentStyleSheet = styleSheet;\n\t\t\t\tbuffer = \"\";\n\t\t\t\tstate = \"before-selector\";\n\t\t\t} else if (state === \"fontFaceRule-begin\") {\n\t\t\t\tif (parentRule) {\n\t\t\t\t\tfontFaceRule.parentRule = parentRule;\n\t\t\t\t}\n\t\t\t\tfontFaceRule.parentStyleSheet = styleSheet;\n\t\t\t\tstyleRule = fontFaceRule;\n\t\t\t\tbuffer = \"\";\n\t\t\t\tstate = \"before-name\";\n\t\t\t} else if (state === \"keyframesRule-begin\") {\n\t\t\t\tkeyframesRule.name = buffer.trim();\n\t\t\t\tif (parentRule) {\n\t\t\t\t\tancestorRules.push(parentRule);\n\t\t\t\t\tkeyframesRule.parentRule = parentRule;\n\t\t\t\t}\n\t\t\t\tkeyframesRule.parentStyleSheet = styleSheet;\n\t\t\t\tcurrentScope = parentRule = keyframesRule;\n\t\t\t\tbuffer = \"\";\n\t\t\t\tstate = \"keyframeRule-begin\";\n\t\t\t} else if (state === \"keyframeRule-begin\") {\n\t\t\t\tstyleRule = new CSSOM.CSSKeyframeRule();\n\t\t\t\tstyleRule.keyText = buffer.trim();\n\t\t\t\tstyleRule.__starts = i;\n\t\t\t\tbuffer = \"\";\n\t\t\t\tstate = \"before-name\";\n\t\t\t} else if (state === \"documentRule-begin\") {\n\t\t\t\t// FIXME: what if this '{' is in the url text of the match function?\n\t\t\t\tdocumentRule.matcher.matcherText = buffer.trim();\n\t\t\t\tif (parentRule) {\n\t\t\t\t\tancestorRules.push(parentRule);\n\t\t\t\t\tdocumentRule.parentRule = parentRule;\n\t\t\t\t}\n\t\t\t\tcurrentScope = parentRule = documentRule;\n\t\t\t\tdocumentRule.parentStyleSheet = styleSheet;\n\t\t\t\tbuffer = \"\";\n\t\t\t\tstate = \"before-selector\";\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase \":\":\n\t\t\tif (state === \"name\") {\n\t\t\t\tname = buffer.trim();\n\t\t\t\tbuffer = \"\";\n\t\t\t\tstate = \"before-value\";\n\t\t\t} else {\n\t\t\t\tbuffer += character;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase \"(\":\n\t\t\tif (state === 'value') {\n\t\t\t\t// ie css expression mode\n\t\t\t\tif (buffer.trim() === 'expression') {\n\t\t\t\t\tvar info = (new CSSOM.CSSValueExpression(token, i)).parse();\n\n\t\t\t\t\tif (info.error) {\n\t\t\t\t\t\tparseError(info.error);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbuffer += info.expression;\n\t\t\t\t\t\ti = info.idx;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tstate = 'value-parenthesis';\n\t\t\t\t\t//always ensure this is reset to 1 on transition\n\t\t\t\t\t//from value to value-parenthesis\n\t\t\t\t\tvalueParenthesisDepth = 1;\n\t\t\t\t\tbuffer += character;\n\t\t\t\t}\n\t\t\t} else if (state === 'value-parenthesis') {\n\t\t\t\tvalueParenthesisDepth++;\n\t\t\t\tbuffer += character;\n\t\t\t} else {\n\t\t\t\tbuffer += character;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase \")\":\n\t\t\tif (state === 'value-parenthesis') {\n\t\t\t\tvalueParenthesisDepth--;\n\t\t\t\tif (valueParenthesisDepth === 0) state = 'value';\n\t\t\t}\n\t\t\tbuffer += character;\n\t\t\tbreak;\n\n\t\tcase \"!\":\n\t\t\tif (state === \"value\" && token.indexOf(\"!important\", i) === i) {\n\t\t\t\tpriority = \"important\";\n\t\t\t\ti += \"important\".length;\n\t\t\t} else {\n\t\t\t\tbuffer += character;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase \";\":\n\t\t\tswitch (state) {\n\t\t\t\tcase \"value\":\n\t\t\t\t\tstyleRule.style.setProperty(name, buffer.trim(), priority);\n\t\t\t\t\tpriority = \"\";\n\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\tstate = \"before-name\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"atRule\":\n\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\tstate = \"before-selector\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"importRule\":\n\t\t\t\t\timportRule = new CSSOM.CSSImportRule();\n\t\t\t\t\timportRule.parentStyleSheet = importRule.styleSheet.parentStyleSheet = styleSheet;\n\t\t\t\t\timportRule.cssText = buffer + character;\n\t\t\t\t\tstyleSheet.cssRules.push(importRule);\n\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\tstate = \"before-selector\";\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbuffer += character;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase \"}\":\n\t\t\tswitch (state) {\n\t\t\t\tcase \"value\":\n\t\t\t\t\tstyleRule.style.setProperty(name, buffer.trim(), priority);\n\t\t\t\t\tpriority = \"\";\n\t\t\t\t\t/* falls through */\n\t\t\t\tcase \"before-name\":\n\t\t\t\tcase \"name\":\n\t\t\t\t\tstyleRule.__ends = i + 1;\n\t\t\t\t\tif (parentRule) {\n\t\t\t\t\t\tstyleRule.parentRule = parentRule;\n\t\t\t\t\t}\n\t\t\t\t\tstyleRule.parentStyleSheet = styleSheet;\n\t\t\t\t\tcurrentScope.cssRules.push(styleRule);\n\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\tif (currentScope.constructor === CSSOM.CSSKeyframesRule) {\n\t\t\t\t\t\tstate = \"keyframeRule-begin\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstate = \"before-selector\";\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"keyframeRule-begin\":\n\t\t\t\tcase \"before-selector\":\n\t\t\t\tcase \"selector\":\n\t\t\t\t\t// End of media/supports/document rule.\n\t\t\t\t\tif (!parentRule) {\n\t\t\t\t\t\tparseError(\"Unexpected }\");\n\t\t\t\t\t}\n\n\t\t\t\t\t// Handle rules nested in @media or @supports\n\t\t\t\t\thasAncestors = ancestorRules.length > 0;\n\n\t\t\t\t\twhile (ancestorRules.length > 0) {\n\t\t\t\t\t\tparentRule = ancestorRules.pop();\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tparentRule.constructor.name === \"CSSMediaRule\"\n\t\t\t\t\t\t\t|| parentRule.constructor.name === \"CSSSupportsRule\"\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tprevScope = currentScope;\n\t\t\t\t\t\t\tcurrentScope = parentRule;\n\t\t\t\t\t\t\tcurrentScope.cssRules.push(prevScope);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (ancestorRules.length === 0) {\n\t\t\t\t\t\t\thasAncestors = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (!hasAncestors) {\n\t\t\t\t\t\tcurrentScope.__ends = i + 1;\n\t\t\t\t\t\tstyleSheet.cssRules.push(currentScope);\n\t\t\t\t\t\tcurrentScope = styleSheet;\n\t\t\t\t\t\tparentRule = null;\n\t\t\t\t\t}\n\n\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\tstate = \"before-selector\";\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tswitch (state) {\n\t\t\t\tcase \"before-selector\":\n\t\t\t\t\tstate = \"selector\";\n\t\t\t\t\tstyleRule = new CSSOM.CSSStyleRule();\n\t\t\t\t\tstyleRule.__starts = i;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"before-name\":\n\t\t\t\t\tstate = \"name\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"before-value\":\n\t\t\t\t\tstate = \"value\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"importRule-begin\":\n\t\t\t\t\tstate = \"importRule\";\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbuffer += character;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn styleSheet;\n};\n\n\n//.CommonJS\nexports.parse = CSSOM.parse;\n// The following modules cannot be included sooner due to the mutual dependency with parse.js\nCSSOM.CSSStyleSheet = require(\"./CSSStyleSheet\").CSSStyleSheet;\nCSSOM.CSSStyleRule = require(\"./CSSStyleRule\").CSSStyleRule;\nCSSOM.CSSImportRule = require(\"./CSSImportRule\").CSSImportRule;\nCSSOM.CSSGroupingRule = require(\"./CSSGroupingRule\").CSSGroupingRule;\nCSSOM.CSSMediaRule = require(\"./CSSMediaRule\").CSSMediaRule;\nCSSOM.CSSConditionRule = require(\"./CSSConditionRule\").CSSConditionRule;\nCSSOM.CSSSupportsRule = require(\"./CSSSupportsRule\").CSSSupportsRule;\nCSSOM.CSSFontFaceRule = require(\"./CSSFontFaceRule\").CSSFontFaceRule;\nCSSOM.CSSHostRule = require(\"./CSSHostRule\").CSSHostRule;\nCSSOM.CSSStyleDeclaration = require('./CSSStyleDeclaration').CSSStyleDeclaration;\nCSSOM.CSSKeyframeRule = require('./CSSKeyframeRule').CSSKeyframeRule;\nCSSOM.CSSKeyframesRule = require('./CSSKeyframesRule').CSSKeyframesRule;\nCSSOM.CSSValueExpression = require('./CSSValueExpression').CSSValueExpression;\nCSSOM.CSSDocumentRule = require('./CSSDocumentRule').CSSDocumentRule;\n///CommonJS\n","//.CommonJS\nvar CSSOM = {};\n///CommonJS\n\n\n/**\n * @constructor\n * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration\n */\nCSSOM.CSSStyleDeclaration = function CSSStyleDeclaration(){\n\tthis.length = 0;\n\tthis.parentRule = null;\n\n\t// NON-STANDARD\n\tthis._importants = {};\n};\n\n\nCSSOM.CSSStyleDeclaration.prototype = {\n\n\tconstructor: CSSOM.CSSStyleDeclaration,\n\n\t/**\n\t *\n\t * @param {string} name\n\t * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-getPropertyValue\n\t * @return {string} the value of the property if it has been explicitly set for this declaration block.\n\t * Returns the empty string if the property has not been set.\n\t */\n\tgetPropertyValue: function(name) {\n\t\treturn this[name] || \"\";\n\t},\n\n\t/**\n\t *\n\t * @param {string} name\n\t * @param {string} value\n\t * @param {string} [priority=null] \"important\" or null\n\t * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-setProperty\n\t */\n\tsetProperty: function(name, value, priority) {\n\t\tif (this[name]) {\n\t\t\t// Property already exist. Overwrite it.\n\t\t\tvar index = Array.prototype.indexOf.call(this, name);\n\t\t\tif (index < 0) {\n\t\t\t\tthis[this.length] = name;\n\t\t\t\tthis.length++;\n\t\t\t}\n\t\t} else {\n\t\t\t// New property.\n\t\t\tthis[this.length] = name;\n\t\t\tthis.length++;\n\t\t}\n\t\tthis[name] = value + \"\";\n\t\tthis._importants[name] = priority;\n\t},\n\n\t/**\n\t *\n\t * @param {string} name\n\t * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-removeProperty\n\t * @return {string} the value of the property if it has been explicitly set for this declaration block.\n\t * Returns the empty string if the property has not been set or the property name does not correspond to a known CSS property.\n\t */\n\tremoveProperty: function(name) {\n\t\tif (!(name in this)) {\n\t\t\treturn \"\";\n\t\t}\n\t\tvar index = Array.prototype.indexOf.call(this, name);\n\t\tif (index < 0) {\n\t\t\treturn \"\";\n\t\t}\n\t\tvar prevValue = this[name];\n\t\tthis[name] = \"\";\n\n\t\t// That's what WebKit and Opera do\n\t\tArray.prototype.splice.call(this, index, 1);\n\n\t\t// That's what Firefox does\n\t\t//this[index] = \"\"\n\n\t\treturn prevValue;\n\t},\n\n\tgetPropertyCSSValue: function() {\n\t\t//FIXME\n\t},\n\n\t/**\n\t *\n\t * @param {String} name\n\t */\n\tgetPropertyPriority: function(name) {\n\t\treturn this._importants[name] || \"\";\n\t},\n\n\n\t/**\n\t * element.style.overflow = \"auto\"\n\t * element.style.getPropertyShorthand(\"overflow-x\")\n\t * -> \"overflow\"\n\t */\n\tgetPropertyShorthand: function() {\n\t\t//FIXME\n\t},\n\n\tisPropertyImplicit: function() {\n\t\t//FIXME\n\t},\n\n\t// Doesn't work in IE < 9\n\tget cssText(){\n\t\tvar properties = [];\n\t\tfor (var i=0, length=this.length; i < length; ++i) {\n\t\t\tvar name = this[i];\n\t\t\tvar value = this.getPropertyValue(name);\n\t\t\tvar priority = this.getPropertyPriority(name);\n\t\t\tif (priority) {\n\t\t\t\tpriority = \" !\" + priority;\n\t\t\t}\n\t\t\tproperties[i] = name + \": \" + value + priority + \";\";\n\t\t}\n\t\treturn properties.join(\" \");\n\t},\n\n\tset cssText(text){\n\t\tvar i, name;\n\t\tfor (i = this.length; i--;) {\n\t\t\tname = this[i];\n\t\t\tthis[name] = \"\";\n\t\t}\n\t\tArray.prototype.splice.call(this, 0, this.length);\n\t\tthis._importants = {};\n\n\t\tvar dummyRule = CSSOM.parse('#bogus{' + text + '}').cssRules[0].style;\n\t\tvar length = dummyRule.length;\n\t\tfor (i = 0; i < length; ++i) {\n\t\t\tname = dummyRule[i];\n\t\t\tthis.setProperty(dummyRule[i], dummyRule.getPropertyValue(name), dummyRule.getPropertyPriority(name));\n\t\t}\n\t}\n};\n\n\n//.CommonJS\nexports.CSSStyleDeclaration = CSSOM.CSSStyleDeclaration;\nCSSOM.parse = require('./parse').parse; // Cannot be included sooner due to the mutual dependency between parse.js and CSSStyleDeclaration.js\n///CommonJS\n","//.CommonJS\nvar CSSOM = {\n\tCSSStyleSheet: require(\"./CSSStyleSheet\").CSSStyleSheet,\n\tCSSRule: require(\"./CSSRule\").CSSRule,\n\tCSSStyleRule: require(\"./CSSStyleRule\").CSSStyleRule,\n\tCSSGroupingRule: require(\"./CSSGroupingRule\").CSSGroupingRule,\n\tCSSConditionRule: require(\"./CSSConditionRule\").CSSConditionRule,\n\tCSSMediaRule: require(\"./CSSMediaRule\").CSSMediaRule,\n\tCSSSupportsRule: require(\"./CSSSupportsRule\").CSSSupportsRule,\n\tCSSStyleDeclaration: require(\"./CSSStyleDeclaration\").CSSStyleDeclaration,\n\tCSSKeyframeRule: require('./CSSKeyframeRule').CSSKeyframeRule,\n\tCSSKeyframesRule: require('./CSSKeyframesRule').CSSKeyframesRule\n};\n///CommonJS\n\n\n/**\n * Produces a deep copy of stylesheet — the instance variables of stylesheet are copied recursively.\n * @param {CSSStyleSheet|CSSOM.CSSStyleSheet} stylesheet\n * @nosideeffects\n * @return {CSSOM.CSSStyleSheet}\n */\nCSSOM.clone = function clone(stylesheet) {\n\n\tvar cloned = new CSSOM.CSSStyleSheet();\n\n\tvar rules = stylesheet.cssRules;\n\tif (!rules) {\n\t\treturn cloned;\n\t}\n\n\tfor (var i = 0, rulesLength = rules.length; i < rulesLength; i++) {\n\t\tvar rule = rules[i];\n\t\tvar ruleClone = cloned.cssRules[i] = new rule.constructor();\n\n\t\tvar style = rule.style;\n\t\tif (style) {\n\t\t\tvar styleClone = ruleClone.style = new CSSOM.CSSStyleDeclaration();\n\t\t\tfor (var j = 0, styleLength = style.length; j < styleLength; j++) {\n\t\t\t\tvar name = styleClone[j] = style[j];\n\t\t\t\tstyleClone[name] = style[name];\n\t\t\t\tstyleClone._importants[name] = style.getPropertyPriority(name);\n\t\t\t}\n\t\t\tstyleClone.length = style.length;\n\t\t}\n\n\t\tif (rule.hasOwnProperty('keyText')) {\n\t\t\truleClone.keyText = rule.keyText;\n\t\t}\n\n\t\tif (rule.hasOwnProperty('selectorText')) {\n\t\t\truleClone.selectorText = rule.selectorText;\n\t\t}\n\n\t\tif (rule.hasOwnProperty('mediaText')) {\n\t\t\truleClone.mediaText = rule.mediaText;\n\t\t}\n\n\t\tif (rule.hasOwnProperty('conditionText')) {\n\t\t\truleClone.conditionText = rule.conditionText;\n\t\t}\n\n\t\tif (rule.hasOwnProperty('cssRules')) {\n\t\t\truleClone.cssRules = clone(rule).cssRules;\n\t\t}\n\t}\n\n\treturn cloned;\n\n};\n\n//.CommonJS\nexports.clone = CSSOM.clone;\n///CommonJS\n","'use strict';\n\nexports.CSSStyleDeclaration = require('./CSSStyleDeclaration').CSSStyleDeclaration;\nexports.CSSRule = require('./CSSRule').CSSRule;\nexports.CSSGroupingRule = require('./CSSGroupingRule').CSSGroupingRule;\nexports.CSSConditionRule = require('./CSSConditionRule').CSSConditionRule;\nexports.CSSStyleRule = require('./CSSStyleRule').CSSStyleRule;\nexports.MediaList = require('./MediaList').MediaList;\nexports.CSSMediaRule = require('./CSSMediaRule').CSSMediaRule;\nexports.CSSSupportsRule = require('./CSSSupportsRule').CSSSupportsRule;\nexports.CSSImportRule = require('./CSSImportRule').CSSImportRule;\nexports.CSSFontFaceRule = require('./CSSFontFaceRule').CSSFontFaceRule;\nexports.CSSHostRule = require('./CSSHostRule').CSSHostRule;\nexports.StyleSheet = require('./StyleSheet').StyleSheet;\nexports.CSSStyleSheet = require('./CSSStyleSheet').CSSStyleSheet;\nexports.CSSKeyframesRule = require('./CSSKeyframesRule').CSSKeyframesRule;\nexports.CSSKeyframeRule = require('./CSSKeyframeRule').CSSKeyframeRule;\nexports.MatcherList = require('./MatcherList').MatcherList;\nexports.CSSDocumentRule = require('./CSSDocumentRule').CSSDocumentRule;\nexports.CSSValue = require('./CSSValue').CSSValue;\nexports.CSSValueExpression = require('./CSSValueExpression').CSSValueExpression;\nexports.parse = require('./parse').parse;\nexports.clone = require('./clone').clone;\n","import {parse} from 'cssom';\n\nimport {registerHTMLClass} from '../shared/register-html-class.js';\nimport {SHEET} from '../shared/symbols.js';\n\nimport {TextElement} from './text-element.js';\n\nconst tagName = 'style';\n\n/**\n * @implements globalThis.HTMLStyleElement\n */\nclass HTMLStyleElement extends TextElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n this[SHEET] = null;\n }\n\n get sheet() {\n const sheet = this[SHEET];\n if (sheet !== null) {\n return sheet;\n }\n return this[SHEET] = parse(this.textContent);\n }\n\n get innerHTML() {\n return super.innerHTML || '';\n }\n set innerHTML(value) {\n super.textContent = value;\n this[SHEET] = null;\n }\n get innerText() {\n return super.innerText || '';\n }\n set innerText(value) {\n super.textContent = value;\n this[SHEET] = null;\n }\n get textContent() {\n return super.textContent || '';\n }\n set textContent(value) {\n super.textContent = value;\n this[SHEET] = null;\n }\n}\n\nregisterHTMLClass(tagName, HTMLStyleElement);\n\nexport {HTMLStyleElement};\n","import {stringAttribute} from '../shared/attributes.js';\nimport {registerHTMLClass} from '../shared/register-html-class.js';\n\nimport {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLTimeElement\n */\nclass HTMLTimeElement extends HTMLElement {\n constructor(ownerDocument, localName = 'time') {\n super(ownerDocument, localName);\n }\n\n /**\n * @type {string}\n */\n get dateTime() { return stringAttribute.get(this, 'datetime'); }\n set dateTime(value) { stringAttribute.set(this, 'datetime', value); }\n}\n\nregisterHTMLClass('time', HTMLTimeElement)\n\nexport {HTMLTimeElement};\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLFieldSetElement\n */\nexport class HTMLFieldSetElement extends HTMLElement {\n constructor(ownerDocument, localName = 'fieldset') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLEmbedElement\n */\nexport class HTMLEmbedElement extends HTMLElement {\n constructor(ownerDocument, localName = 'embed') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLHRElement\n */\nexport class HTMLHRElement extends HTMLElement {\n constructor(ownerDocument, localName = 'hr') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLProgressElement\n */\nexport class HTMLProgressElement extends HTMLElement {\n constructor(ownerDocument, localName = 'progress') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLParagraphElement\n */\nexport class HTMLParagraphElement extends HTMLElement {\n constructor(ownerDocument, localName = 'p') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLTableElement\n */\nexport class HTMLTableElement extends HTMLElement {\n constructor(ownerDocument, localName = 'table') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLFrameSetElement\n */\nexport class HTMLFrameSetElement extends HTMLElement {\n constructor(ownerDocument, localName = 'frameset') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLLIElement\n */\nexport class HTMLLIElement extends HTMLElement {\n constructor(ownerDocument, localName = 'li') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLBaseElement\n */\nexport class HTMLBaseElement extends HTMLElement {\n constructor(ownerDocument, localName = 'base') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLDataListElement\n */\nexport class HTMLDataListElement extends HTMLElement {\n constructor(ownerDocument, localName = 'datalist') {\n super(ownerDocument, localName);\n }\n}\n","import {registerHTMLClass} from '../shared/register-html-class.js';\nimport {booleanAttribute, stringAttribute} from '../shared/attributes.js';\n\nimport {HTMLElement} from './element.js';\n\nconst tagName = 'input';\n\n/**\n * @implements globalThis.HTMLInputElement\n */\nclass HTMLInputElement extends HTMLElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n }\n\n /* c8 ignore start */\n get autofocus() { return booleanAttribute.get(this, 'autofocus') || -1; }\n set autofocus(value) { booleanAttribute.set(this, 'autofocus', value); }\n\n get disabled() { return booleanAttribute.get(this, 'disabled'); }\n set disabled(value) { booleanAttribute.set(this, 'disabled', value); }\n\n get name() { return this.getAttribute('name'); }\n set name(value) { this.setAttribute('name', value); }\n\n get placeholder() { return this.getAttribute('placeholder'); }\n set placeholder(value) { this.setAttribute('placeholder', value); }\n\n get type() { return this.getAttribute('type'); }\n set type(value) { this.setAttribute('type', value); }\n\n get value() { return stringAttribute.get(this, 'value'); }\n set value(value) { stringAttribute.set(this, 'value', value); }\n /* c8 ignore stop */\n}\n\nregisterHTMLClass(tagName, HTMLInputElement);\n\nexport {HTMLInputElement};\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLParamElement\n */\nexport class HTMLParamElement extends HTMLElement {\n constructor(ownerDocument, localName = 'param') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLMediaElement\n */\nexport class HTMLMediaElement extends HTMLElement {\n constructor(ownerDocument, localName = 'media') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLAudioElement\n */\nexport class HTMLAudioElement extends HTMLElement {\n constructor(ownerDocument, localName = 'audio') {\n super(ownerDocument, localName);\n }\n}\n","import {registerHTMLClass} from '../shared/register-html-class.js';\n\nimport {HTMLElement} from './element.js';\n\nconst tagName = 'h1';\n\n/**\n * @implements globalThis.HTMLHeadingElement\n */\nclass HTMLHeadingElement extends HTMLElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n }\n}\n\nregisterHTMLClass([tagName, 'h2', 'h3', 'h4', 'h5', 'h6'], HTMLHeadingElement);\n\nexport {HTMLHeadingElement};\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLDirectoryElement\n */\nexport class HTMLDirectoryElement extends HTMLElement {\n constructor(ownerDocument, localName = 'dir') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLQuoteElement\n */\nexport class HTMLQuoteElement extends HTMLElement {\n constructor(ownerDocument, localName = 'quote') {\n super(ownerDocument, localName);\n }\n}\n","export default {};\nthrow new Error(`Could not resolve \"canvas\" imported by \"linkedom\". Is it installed?`)","class Canvas {\n constructor(width, height) {\n this.width = width;\n this.height = height;\n }\n getContext() {\n return null;\n }\n toDataURL() {\n return '';\n }\n}\n\nmodule.exports = {\n createCanvas: (width, height) => new Canvas(width, height),\n};\n","/* c8 ignore start */\ntry {\n module.exports = require('canvas');\n} catch (fallback) {\n module.exports = require('./canvas-shim.cjs');\n}\n/* c8 ignore stop */\n","import {IMAGE} from '../shared/symbols.js';\n\nimport {registerHTMLClass} from '../shared/register-html-class.js';\nimport {numericAttribute} from '../shared/attributes.js';\n\nimport Canvas from '../../commonjs/canvas.cjs';\n\nimport {HTMLElement} from './element.js';\n\nconst {createCanvas} = Canvas;\n\nconst tagName = 'canvas';\n\n/**\n * @implements globalThis.HTMLCanvasElement\n */\nclass HTMLCanvasElement extends HTMLElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n this[IMAGE] = createCanvas(300, 150);\n }\n\n get width() {\n return this[IMAGE].width;\n }\n\n set width(value) {\n numericAttribute.set(this, 'width', value);\n this[IMAGE].width = value;\n }\n\n get height() {\n return this[IMAGE].height;\n }\n\n set height(value) {\n numericAttribute.set(this, 'height', value);\n this[IMAGE].height = value;\n }\n\n getContext(type) {\n return this[IMAGE].getContext(type);\n }\n\n toDataURL(...args) {\n return this[IMAGE].toDataURL(...args);\n }\n}\n\nregisterHTMLClass(tagName, HTMLCanvasElement);\n\nexport {HTMLCanvasElement};\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLLegendElement\n */\nexport class HTMLLegendElement extends HTMLElement {\n constructor(ownerDocument, localName = 'legend') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\nimport {booleanAttribute, stringAttribute} from '../shared/attributes.js';\nimport {registerHTMLClass} from '../shared/register-html-class.js';\n\nconst tagName = 'option';\n\n/**\n * @implements globalThis.HTMLOptionElement\n */\nclass HTMLOptionElement extends HTMLElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n }\n\n /* c8 ignore start */\n get value() { return stringAttribute.get(this, 'value'); }\n set value(value) { stringAttribute.set(this, 'value', value); }\n /* c8 ignore stop */\n\n get selected() { return booleanAttribute.get(this, 'selected'); }\n set selected(value) {\n const option = this.parentElement?.querySelector('option[selected]');\n if (option && option !== this)\n option.selected = false;\n booleanAttribute.set(this, 'selected', value);\n }\n}\n\nregisterHTMLClass(tagName, HTMLOptionElement);\n\nexport {HTMLOptionElement};\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLSpanElement\n */\nexport class HTMLSpanElement extends HTMLElement {\n constructor(ownerDocument, localName = 'span') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLMeterElement\n */\nexport class HTMLMeterElement extends HTMLElement {\n constructor(ownerDocument, localName = 'meter') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLVideoElement\n */\nexport class HTMLVideoElement extends HTMLElement {\n constructor(ownerDocument, localName = 'video') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLTableCellElement\n */\nexport class HTMLTableCellElement extends HTMLElement {\n constructor(ownerDocument, localName = 'td') {\n super(ownerDocument, localName);\n }\n}\n","import {registerHTMLClass} from '../shared/register-html-class.js';\n\nimport {TextElement} from './text-element.js';\n\nconst tagName = 'title';\n\n/**\n * @implements globalThis.HTMLTitleElement\n */\nclass HTMLTitleElement extends TextElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n }\n}\n\nregisterHTMLClass(tagName, HTMLTitleElement);\n\nexport {HTMLTitleElement};\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLOutputElement\n */\nexport class HTMLOutputElement extends HTMLElement {\n constructor(ownerDocument, localName = 'output') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLTableRowElement\n */\nexport class HTMLTableRowElement extends HTMLElement {\n constructor(ownerDocument, localName = 'tr') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLDataElement\n */\nexport class HTMLDataElement extends HTMLElement {\n constructor(ownerDocument, localName = 'data') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLMenuElement\n */\nexport class HTMLMenuElement extends HTMLElement {\n constructor(ownerDocument, localName = 'menu') {\n super(ownerDocument, localName);\n }\n}\n","import {registerHTMLClass} from '../shared/register-html-class.js';\nimport {booleanAttribute} from '../shared/attributes.js';\n\nimport {HTMLElement} from './element.js';\nimport {NodeList} from '../interface/node-list.js';\n\nconst tagName = 'select';\n\n/**\n * @implements globalThis.HTMLSelectElement\n */\nclass HTMLSelectElement extends HTMLElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n }\n\n get options() {\n let children = new NodeList;\n let {firstElementChild} = this;\n while (firstElementChild) {\n if (firstElementChild.tagName === 'OPTGROUP')\n children.push(...firstElementChild.children);\n else\n children.push(firstElementChild);\n firstElementChild = firstElementChild.nextElementSibling;\n }\n return children;\n }\n\n /* c8 ignore start */\n get disabled() { return booleanAttribute.get(this, 'disabled'); }\n set disabled(value) { booleanAttribute.set(this, 'disabled', value); }\n\n get name() { return this.getAttribute('name'); }\n set name(value) { this.setAttribute('name', value); }\n /* c8 ignore stop */\n\n get value() { return this.querySelector('option[selected]')?.value; }\n}\n\nregisterHTMLClass(tagName, HTMLSelectElement);\n\nexport {HTMLSelectElement};\n\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLBRElement\n */\nexport class HTMLBRElement extends HTMLElement {\n constructor(ownerDocument, localName = 'br') {\n super(ownerDocument, localName);\n }\n}\n","import {registerHTMLClass} from '../shared/register-html-class.js';\nimport {booleanAttribute} from '../shared/attributes.js';\n\nimport {HTMLElement} from './element.js';\n\nconst tagName = 'button';\n\n/**\n * @implements globalThis.HTMLButtonElement\n */\nclass HTMLButtonElement extends HTMLElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n }\n\n /* c8 ignore start */\n get disabled() { return booleanAttribute.get(this, 'disabled'); }\n set disabled(value) { booleanAttribute.set(this, 'disabled', value); }\n\n get name() { return this.getAttribute('name'); }\n set name(value) { this.setAttribute('name', value); }\n\n get type() { return this.getAttribute('type'); }\n set type(value) { this.setAttribute('type', value); }\n /* c8 ignore stop */\n}\n\nregisterHTMLClass(tagName, HTMLButtonElement);\n\nexport {HTMLButtonElement};\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLMapElement\n */\nexport class HTMLMapElement extends HTMLElement {\n constructor(ownerDocument, localName = 'map') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLOptGroupElement\n */\nexport class HTMLOptGroupElement extends HTMLElement {\n constructor(ownerDocument, localName = 'optgroup') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLDListElement\n */\nexport class HTMLDListElement extends HTMLElement {\n constructor(ownerDocument, localName = 'dl') {\n super(ownerDocument, localName);\n }\n}\n","import {registerHTMLClass} from '../shared/register-html-class.js';\nimport {booleanAttribute} from '../shared/attributes.js';\n\nimport {TextElement} from './text-element.js';\n\nconst tagName = 'textarea';\n\n/**\n * @implements globalThis.HTMLTextAreaElement\n */\nclass HTMLTextAreaElement extends TextElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n }\n\n /* c8 ignore start */\n get disabled() { return booleanAttribute.get(this, 'disabled'); }\n set disabled(value) { booleanAttribute.set(this, 'disabled', value); }\n\n get name() { return this.getAttribute('name'); }\n set name(value) { this.setAttribute('name', value); }\n\n get placeholder() { return this.getAttribute('placeholder'); }\n set placeholder(value) { this.setAttribute('placeholder', value); }\n\n get type() { return this.getAttribute('type'); }\n set type(value) { this.setAttribute('type', value); }\n\n get value() { return this.textContent; }\n set value(content) { this.textContent = content; }\n /* c8 ignore stop */\n}\n\nregisterHTMLClass(tagName, HTMLTextAreaElement);\n\nexport {HTMLTextAreaElement};\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLFontElement\n */\nexport class HTMLFontElement extends HTMLElement {\n constructor(ownerDocument, localName = 'font') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLDivElement\n */\nexport class HTMLDivElement extends HTMLElement {\n constructor(ownerDocument, localName = 'div') {\n super(ownerDocument, localName);\n }\n}\n","import {registerHTMLClass} from '../shared/register-html-class.js';\nimport {booleanAttribute, stringAttribute} from '../shared/attributes.js';\n\nimport {HTMLElement} from './element.js';\n\nconst tagName = 'link';\n\n/**\n * @implements globalThis.HTMLLinkElement\n */\nclass HTMLLinkElement extends HTMLElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n }\n\n /* c8 ignore start */ // copy paste from img.src, already covered\n get disabled() { return booleanAttribute.get(this, 'disabled'); }\n set disabled(value) { booleanAttribute.set(this, 'disabled', value); }\n\n get href() { return stringAttribute.get(this, 'href').trim(); }\n set href(value) { stringAttribute.set(this, 'href', value); }\n\n get hreflang() { return stringAttribute.get(this, 'hreflang'); }\n set hreflang(value) { stringAttribute.set(this, 'hreflang', value); }\n\n get media() { return stringAttribute.get(this, 'media'); }\n set media(value) { stringAttribute.set(this, 'media', value); }\n\n get rel() { return stringAttribute.get(this, 'rel'); }\n set rel(value) { stringAttribute.set(this, 'rel', value); }\n\n get type() { return stringAttribute.get(this, 'type'); }\n set type(value) { stringAttribute.set(this, 'type', value); }\n /* c8 ignore stop */\n\n}\n\nregisterHTMLClass(tagName, HTMLLinkElement);\n\nexport {HTMLLinkElement};\n","import {HTMLElement} from './element.js';\nimport {registerHTMLClass} from '../shared/register-html-class.js';\n\nconst tagName = 'slot';\n\n/**\n * @implements globalThis.HTMLSlotElement\n */\nclass HTMLSlotElement extends HTMLElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n }\n\n /* c8 ignore start */\n get name() { return this.getAttribute('name'); }\n set name(value) { this.setAttribute('name', value); }\n\n assign() {}\n\n assignedNodes(options) {\n const isNamedSlot = !!this.name;\n const hostChildNodes = this.getRootNode().host?.childNodes ?? [];\n let slottables;\n\n if (isNamedSlot) {\n slottables = [...hostChildNodes].filter(node => node.slot === this.name);\n } else {\n slottables = [...hostChildNodes].filter(node => !node.slot);\n }\n\n if (options?.flatten) {\n const result = [];\n\n // Element and Text nodes are slottables. A slot can be a slottable.\n for (let slottable of slottables) {\n if (slottable.localName === 'slot') {\n result.push(...slottable.assignedNodes({ flatten: true }));\n } else {\n result.push(slottable);\n }\n }\n\n slottables = result;\n }\n\n // If no assigned nodes are found, it returns the slot's fallback content.\n return slottables.length ? slottables : [...this.childNodes];\n }\n\n assignedElements(options) {\n const slottables = this.assignedNodes(options).filter(n => n.nodeType === 1);\n\n // If no assigned elements are found, it returns the slot's fallback content.\n return slottables.length ? slottables : [...this.children];\n }\n /* c8 ignore stop */\n}\n\nregisterHTMLClass(tagName, HTMLSlotElement);\n\nexport {HTMLSlotElement};\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLFormElement\n */\nexport class HTMLFormElement extends HTMLElement {\n constructor(ownerDocument, localName = 'form') {\n super(ownerDocument, localName);\n }\n}\n","import {registerHTMLClass} from '../shared/register-html-class.js';\nimport {numericAttribute, stringAttribute} from '../shared/attributes.js';\n\nimport {HTMLElement} from './element.js';\n\nconst tagName = 'img';\n\n/**\n * @implements globalThis.HTMLImageElement\n */\nclass HTMLImageElement extends HTMLElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n }\n\n /* c8 ignore start */\n get alt() { return stringAttribute.get(this, 'alt'); }\n set alt(value) { stringAttribute.set(this, 'alt', value); }\n\n get sizes() { return stringAttribute.get(this, 'sizes'); }\n set sizes(value) { stringAttribute.set(this, 'sizes', value); }\n\n get src() { return stringAttribute.get(this, 'src'); }\n set src(value) { stringAttribute.set(this, 'src', value); }\n\n get srcset() { return stringAttribute.get(this, 'srcset'); }\n set srcset(value) { stringAttribute.set(this, 'srcset', value); }\n\n get title() { return stringAttribute.get(this, 'title'); }\n set title(value) { stringAttribute.set(this, 'title', value); }\n\n get width() { return numericAttribute.get(this, 'width'); }\n set width(value) { numericAttribute.set(this, 'width', value); }\n\n get height() { return numericAttribute.get(this, 'height'); }\n set height(value) { numericAttribute.set(this, 'height', value); }\n /* c8 ignore stop */\n}\n\nregisterHTMLClass(tagName, HTMLImageElement);\n\nexport {HTMLImageElement};\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLPreElement\n */\nexport class HTMLPreElement extends HTMLElement {\n constructor(ownerDocument, localName = 'pre') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLUListElement\n */\nexport class HTMLUListElement extends HTMLElement {\n constructor(ownerDocument, localName = 'ul') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\nimport {registerHTMLClass} from '../shared/register-html-class.js';\nimport { stringAttribute } from '../shared/attributes.js';\n\nconst tagName = 'meta'\n/**\n * @implements globalThis.HTMLMetaElement\n */\nexport class HTMLMetaElement extends HTMLElement {\n constructor(ownerDocument, localName =tagName) {\n super(ownerDocument, localName);\n }\n\n /* c8 ignore start */\n get name() { return stringAttribute.get(this, 'name'); }\n set name(value) { stringAttribute.set(this, 'name', value); }\n\n get httpEquiv() { return stringAttribute.get(this, 'http-equiv'); }\n set httpEquiv(value) { stringAttribute.set(this, 'http-equiv', value); }\n\n get content() { return stringAttribute.get(this, 'content'); }\n set content(value) { stringAttribute.set(this, 'content', value); }\n\n get charset() { return stringAttribute.get(this, 'charset'); }\n set charset(value) { stringAttribute.set(this, 'charset', value); }\n\n get media() { return stringAttribute.get(this, 'media'); }\n set media(value) { stringAttribute.set(this, 'media', value); }\n /* c8 ignore stop */\n\n}\n\nregisterHTMLClass(tagName, HTMLMetaElement);\n\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLPictureElement\n */\nexport class HTMLPictureElement extends HTMLElement {\n constructor(ownerDocument, localName = 'picture') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLAreaElement\n */\nexport class HTMLAreaElement extends HTMLElement {\n constructor(ownerDocument, localName = 'area') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLOListElement\n */\nexport class HTMLOListElement extends HTMLElement {\n constructor(ownerDocument, localName = 'ol') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLTableCaptionElement\n */\nexport class HTMLTableCaptionElement extends HTMLElement {\n constructor(ownerDocument, localName = 'caption') {\n super(ownerDocument, localName);\n }\n}\n","import {registerHTMLClass} from '../shared/register-html-class.js';\nimport {stringAttribute} from '../shared/attributes.js';\n\nimport {HTMLElement} from './element.js';\n\nconst tagName = 'a';\n\n/**\n * @implements globalThis.HTMLAnchorElement\n */\nclass HTMLAnchorElement extends HTMLElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n }\n\n /* c8 ignore start */ // copy paste from img.src, already covered\n get href() { return encodeURI(decodeURI(stringAttribute.get(this, 'href'))).trim(); }\n set href(value) { stringAttribute.set(this, 'href', decodeURI(value)); }\n\n get download() { return encodeURI(decodeURI(stringAttribute.get(this, 'download'))); }\n set download(value) { stringAttribute.set(this, 'download', decodeURI(value)); }\n\n get target() { return stringAttribute.get(this, 'target'); }\n set target(value) { stringAttribute.set(this, 'target', value); }\n\n get type() { return stringAttribute.get(this, 'type'); }\n set type(value) { stringAttribute.set(this, 'type', value); }\n\n get rel() { return stringAttribute.get(this, 'rel'); }\n set rel(value) { stringAttribute.set(this, 'rel', value); }\n /* c8 ignore stop */\n\n}\n\nregisterHTMLClass(tagName, HTMLAnchorElement);\n\nexport {HTMLAnchorElement};\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLLabelElement\n */\nexport class HTMLLabelElement extends HTMLElement {\n constructor(ownerDocument, localName = 'label') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLUnknownElement\n */\nexport class HTMLUnknownElement extends HTMLElement {\n constructor(ownerDocument, localName = 'unknown') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLModElement\n */\nexport class HTMLModElement extends HTMLElement {\n constructor(ownerDocument, localName = 'mod') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLDetailsElement\n */\nexport class HTMLDetailsElement extends HTMLElement {\n constructor(ownerDocument, localName = 'details') {\n super(ownerDocument, localName);\n }\n}\n","import {registerHTMLClass} from '../shared/register-html-class.js';\nimport {stringAttribute} from '../shared/attributes.js';\n\nimport {HTMLElement} from './element.js';\n\nconst tagName = 'source';\n\n/**\n * @implements globalThis.HTMLSourceElement\n */\nclass HTMLSourceElement extends HTMLElement {\n constructor(ownerDocument, localName = tagName) {\n super(ownerDocument, localName);\n }\n\n /* c8 ignore start */\n get src() { return stringAttribute.get(this, 'src'); }\n set src(value) { stringAttribute.set(this, 'src', value); }\n\n get srcset() { return stringAttribute.get(this, 'srcset'); }\n set srcset(value) { stringAttribute.set(this, 'srcset', value); }\n\n get sizes() { return stringAttribute.get(this, 'sizes'); }\n set sizes(value) { stringAttribute.set(this, 'sizes', value); }\n\n get type() { return stringAttribute.get(this, 'type'); }\n set type(value) { stringAttribute.set(this, 'type', value); }\n /* c8 ignore stop */\n}\n\nregisterHTMLClass(tagName, HTMLSourceElement);\n\nexport {HTMLSourceElement};\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLTrackElement\n */\nexport class HTMLTrackElement extends HTMLElement {\n constructor(ownerDocument, localName = 'track') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from './element.js';\n\n/**\n * @implements globalThis.HTMLMarqueeElement\n */\nexport class HTMLMarqueeElement extends HTMLElement {\n constructor(ownerDocument, localName = 'marquee') {\n super(ownerDocument, localName);\n }\n}\n","import {HTMLElement} from '../html/element.js';\nimport {HTMLTemplateElement} from '../html/template-element.js';\nimport {HTMLHtmlElement} from '../html/html-element.js';\nimport {HTMLScriptElement} from '../html/script-element.js';\nimport {HTMLFrameElement} from '../html/frame-element.js';\nimport {HTMLIFrameElement} from '../html/i-frame-element.js';\nimport {HTMLObjectElement} from '../html/object-element.js';\nimport {HTMLHeadElement} from '../html/head-element.js';\nimport {HTMLBodyElement} from '../html/body-element.js';\nimport {HTMLStyleElement} from '../html/style-element.js';\nimport {HTMLTimeElement} from '../html/time-element.js';\nimport {HTMLFieldSetElement} from '../html/field-set-element.js';\nimport {HTMLEmbedElement} from '../html/embed-element.js';\nimport {HTMLHRElement} from '../html/hr-element.js';\nimport {HTMLProgressElement} from '../html/progress-element.js';\nimport {HTMLParagraphElement} from '../html/paragraph-element.js';\nimport {HTMLTableElement} from '../html/table-element.js';\nimport {HTMLFrameSetElement} from '../html/frame-set-element.js';\nimport {HTMLLIElement} from '../html/li-element.js';\nimport {HTMLBaseElement} from '../html/base-element.js';\nimport {HTMLDataListElement} from '../html/data-list-element.js';\nimport {HTMLInputElement} from '../html/input-element.js';\nimport {HTMLParamElement} from '../html/param-element.js';\nimport {HTMLMediaElement} from '../html/media-element.js';\nimport {HTMLAudioElement} from '../html/audio-element.js';\nimport {HTMLHeadingElement} from '../html/heading-element.js';\nimport {HTMLDirectoryElement} from '../html/directory-element.js';\nimport {HTMLQuoteElement} from '../html/quote-element.js';\nimport {HTMLCanvasElement} from '../html/canvas-element.js';\nimport {HTMLLegendElement} from '../html/legend-element.js';\nimport {HTMLOptionElement} from '../html/option-element.js';\nimport {HTMLSpanElement} from '../html/span-element.js';\nimport {HTMLMeterElement} from '../html/meter-element.js';\nimport {HTMLVideoElement} from '../html/video-element.js';\nimport {HTMLTableCellElement} from '../html/table-cell-element.js';\nimport {HTMLTitleElement} from '../html/title-element.js';\nimport {HTMLOutputElement} from '../html/output-element.js';\nimport {HTMLTableRowElement} from '../html/table-row-element.js';\nimport {HTMLDataElement} from '../html/data-element.js';\nimport {HTMLMenuElement} from '../html/menu-element.js';\nimport {HTMLSelectElement} from '../html/select-element.js';\nimport {HTMLBRElement} from '../html/br-element.js';\nimport {HTMLButtonElement} from '../html/button-element.js';\nimport {HTMLMapElement} from '../html/map-element.js';\nimport {HTMLOptGroupElement} from '../html/opt-group-element.js';\nimport {HTMLDListElement} from '../html/d-list-element.js';\nimport {HTMLTextAreaElement} from '../html/text-area-element.js';\nimport {HTMLFontElement} from '../html/font-element.js';\nimport {HTMLDivElement} from '../html/div-element.js';\nimport {HTMLLinkElement} from '../html/link-element.js';\nimport {HTMLSlotElement} from '../html/slot-element.js';\nimport {HTMLFormElement} from '../html/form-element.js';\nimport {HTMLImageElement} from '../html/image-element.js';\nimport {HTMLPreElement} from '../html/pre-element.js';\nimport {HTMLUListElement} from '../html/u-list-element.js';\nimport {HTMLMetaElement} from '../html/meta-element.js';\nimport {HTMLPictureElement} from '../html/picture-element.js';\nimport {HTMLAreaElement} from '../html/area-element.js';\nimport {HTMLOListElement} from '../html/o-list-element.js';\nimport {HTMLTableCaptionElement} from '../html/table-caption-element.js';\nimport {HTMLAnchorElement} from '../html/anchor-element.js';\nimport {HTMLLabelElement} from '../html/label-element.js';\nimport {HTMLUnknownElement} from '../html/unknown-element.js';\nimport {HTMLModElement} from '../html/mod-element.js';\nimport {HTMLDetailsElement} from '../html/details-element.js';\nimport {HTMLSourceElement} from '../html/source-element.js';\nimport {HTMLTrackElement} from '../html/track-element.js';\nimport {HTMLMarqueeElement} from '../html/marquee-element.js';\n\nexport {\n HTMLElement,\n HTMLTemplateElement,\n HTMLHtmlElement,\n HTMLScriptElement,\n HTMLFrameElement,\n HTMLIFrameElement,\n HTMLObjectElement,\n HTMLHeadElement,\n HTMLBodyElement,\n HTMLStyleElement,\n HTMLTimeElement,\n HTMLFieldSetElement,\n HTMLEmbedElement,\n HTMLHRElement,\n HTMLProgressElement,\n HTMLParagraphElement,\n HTMLTableElement,\n HTMLFrameSetElement,\n HTMLLIElement,\n HTMLBaseElement,\n HTMLDataListElement,\n HTMLInputElement,\n HTMLParamElement,\n HTMLMediaElement,\n HTMLAudioElement,\n HTMLHeadingElement,\n HTMLDirectoryElement,\n HTMLQuoteElement,\n HTMLCanvasElement,\n HTMLLegendElement,\n HTMLOptionElement,\n HTMLSpanElement,\n HTMLMeterElement,\n HTMLVideoElement,\n HTMLTableCellElement,\n HTMLTitleElement,\n HTMLOutputElement,\n HTMLTableRowElement,\n HTMLDataElement,\n HTMLMenuElement,\n HTMLSelectElement,\n HTMLBRElement,\n HTMLButtonElement,\n HTMLMapElement,\n HTMLOptGroupElement,\n HTMLDListElement,\n HTMLTextAreaElement,\n HTMLFontElement,\n HTMLDivElement,\n HTMLLinkElement,\n HTMLSlotElement,\n HTMLFormElement,\n HTMLImageElement,\n HTMLPreElement,\n HTMLUListElement,\n HTMLMetaElement,\n HTMLPictureElement,\n HTMLAreaElement,\n HTMLOListElement,\n HTMLTableCaptionElement,\n HTMLAnchorElement,\n HTMLLabelElement,\n HTMLUnknownElement,\n HTMLModElement,\n HTMLDetailsElement,\n HTMLSourceElement,\n HTMLTrackElement,\n HTMLMarqueeElement\n};\n\nexport const HTMLClasses = {\n HTMLElement,\n HTMLTemplateElement,\n HTMLHtmlElement,\n HTMLScriptElement,\n HTMLFrameElement,\n HTMLIFrameElement,\n HTMLObjectElement,\n HTMLHeadElement,\n HTMLBodyElement,\n HTMLStyleElement,\n HTMLTimeElement,\n HTMLFieldSetElement,\n HTMLEmbedElement,\n HTMLHRElement,\n HTMLProgressElement,\n HTMLParagraphElement,\n HTMLTableElement,\n HTMLFrameSetElement,\n HTMLLIElement,\n HTMLBaseElement,\n HTMLDataListElement,\n HTMLInputElement,\n HTMLParamElement,\n HTMLMediaElement,\n HTMLAudioElement,\n HTMLHeadingElement,\n HTMLDirectoryElement,\n HTMLQuoteElement,\n HTMLCanvasElement,\n HTMLLegendElement,\n HTMLOptionElement,\n HTMLSpanElement,\n HTMLMeterElement,\n HTMLVideoElement,\n HTMLTableCellElement,\n HTMLTitleElement,\n HTMLOutputElement,\n HTMLTableRowElement,\n HTMLDataElement,\n HTMLMenuElement,\n HTMLSelectElement,\n HTMLBRElement,\n HTMLButtonElement,\n HTMLMapElement,\n HTMLOptGroupElement,\n HTMLDListElement,\n HTMLTextAreaElement,\n HTMLFontElement,\n HTMLDivElement,\n HTMLLinkElement,\n HTMLSlotElement,\n HTMLFormElement,\n HTMLImageElement,\n HTMLPreElement,\n HTMLUListElement,\n HTMLMetaElement,\n HTMLPictureElement,\n HTMLAreaElement,\n HTMLOListElement,\n HTMLTableCaptionElement,\n HTMLAnchorElement,\n HTMLLabelElement,\n HTMLUnknownElement,\n HTMLModElement,\n HTMLDetailsElement,\n HTMLSourceElement,\n HTMLTrackElement,\n HTMLMarqueeElement\n};\n","// TODO: ensure all these are text only\n// /^(?:plaintext|script|style|textarea|title|xmp)$/i\n\nconst voidElements = {test: () => true};\nexport const Mime = {\n 'text/html': {\n docType: '<!DOCTYPE html>',\n ignoreCase: true,\n voidElements: /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i\n },\n 'image/svg+xml': {\n docType: '<?xml version=\"1.0\" encoding=\"utf-8\"?>',\n ignoreCase: false,\n voidElements\n },\n 'text/xml': {\n docType: '<?xml version=\"1.0\" encoding=\"utf-8\"?>',\n ignoreCase: false,\n voidElements\n },\n 'application/xml': {\n docType: '<?xml version=\"1.0\" encoding=\"utf-8\"?>',\n ignoreCase: false,\n voidElements\n },\n 'application/xhtml+xml': {\n docType: '<?xml version=\"1.0\" encoding=\"utf-8\"?>',\n ignoreCase: false,\n voidElements\n }\n};\n","// https://dom.spec.whatwg.org/#interface-customevent\n\n/* c8 ignore start */\n\n// One day Node might have CustomEvent too\n\nimport {Event} from './event.js';\n\n/**\n * @implements globalThis.CustomEvent\n */\nexport class CustomEvent extends Event {\n constructor(type, eventInitDict = {}) {\n super(type, eventInitDict);\n this.detail = eventInitDict.detail;\n }\n}\n\n/* c8 ignore stop */\n","// https://dom.spec.whatwg.org/#interface-customevent\n\n/* c8 ignore start */\n\n// One day Node might have CustomEvent too\n\nimport {Event} from './event.js';\n\n/**\n * @implements globalThis.InputEvent\n */\nexport class InputEvent extends Event {\n constructor(type, inputEventInit = {}) {\n super(type, inputEventInit);\n this.inputType = inputEventInit.inputType;\n this.data = inputEventInit.data;\n this.dataTransfer = inputEventInit.dataTransfer;\n this.isComposing = inputEventInit.isComposing || false;\n this.ranges = inputEventInit.ranges;\n }\n}\n/* c8 ignore stop */\n","import {HTMLImageElement} from '../html/image-element.js';\n\nexport const ImageClass = ownerDocument =>\n/**\n * @implements globalThis.Image\n */\nclass Image extends HTMLImageElement {\n constructor(width, height) {\n super(ownerDocument);\n switch (arguments.length) {\n case 1:\n this.height = width;\n this.width = width;\n break;\n case 2:\n this.height = height;\n this.width = width;\n break;\n }\n }\n};\n","// https://dom.spec.whatwg.org/#concept-live-range\n\nimport {END, NEXT, PREV, START} from '../shared/symbols.js';\n\nimport {SVGElement} from '../svg/element.js';\n\nimport {getEnd, htmlToFragment, setAdjacent} from '../shared/utils.js';\n\nconst deleteContents = ({[START]: start, [END]: end}, fragment = null) => {\n setAdjacent(start[PREV], end[NEXT]);\n do {\n const after = getEnd(start);\n const next = after === end ? after : after[NEXT];\n if (fragment)\n fragment.insertBefore(start, fragment[END]);\n else\n start.remove();\n start = next;\n } while (start !== end);\n};\n\n/**\n * @implements globalThis.Range\n */\nexport class Range {\n constructor() {\n this[START] = null;\n this[END] = null;\n this.commonAncestorContainer = null;\n }\n\n /* TODO: this is more complicated than it looks\n setStart(node, offset) {\n this[START] = node.childNodes[offset];\n }\n\n setEnd(node, offset) {\n this[END] = getEnd(node.childNodes[offset]);\n }\n //*/\n\n insertNode(newNode) {\n this[END].parentNode.insertBefore(newNode, this[START]);\n }\n\n selectNode(node) {\n this[START] = node;\n this[END] = getEnd(node);\n }\n\n // TODO: SVG elements should then create contextual fragments\n // that return SVG nodes\n selectNodeContents(node) {\n this.selectNode(node);\n this.commonAncestorContainer = node;\n }\n\n surroundContents(parentNode) {\n parentNode.replaceChildren(this.extractContents());\n }\n\n setStartBefore(node) {\n this[START] = node;\n }\n\n setStartAfter(node) {\n this[START] = node.nextSibling;\n }\n\n setEndBefore(node) {\n this[END] = getEnd(node.previousSibling);\n }\n\n setEndAfter(node) {\n this[END] = getEnd(node);\n }\n\n cloneContents() {\n let {[START]: start, [END]: end} = this;\n const fragment = start.ownerDocument.createDocumentFragment();\n while (start !== end) {\n fragment.insertBefore(start.cloneNode(true), fragment[END]);\n start = getEnd(start);\n if (start !== end)\n start = start[NEXT];\n }\n return fragment;\n }\n\n deleteContents() {\n deleteContents(this);\n }\n\n extractContents() {\n const fragment = this[START].ownerDocument.createDocumentFragment();\n deleteContents(this, fragment);\n return fragment;\n }\n\n createContextualFragment(html) {\n const { commonAncestorContainer: doc } = this;\n const isSVG = 'ownerSVGElement' in doc;\n const document = isSVG ? doc.ownerDocument : doc;\n let content = htmlToFragment(document, html);\n if (isSVG) {\n const childNodes = [...content.childNodes];\n content = document.createDocumentFragment();\n Object.setPrototypeOf(content, SVGElement.prototype);\n content.ownerSVGElement = document;\n for (const child of childNodes) {\n Object.setPrototypeOf(child, SVGElement.prototype);\n child.ownerSVGElement = document;\n content.appendChild(child);\n }\n }\n else\n this.selectNode(content);\n return content;\n }\n\n cloneRange() {\n const range = new Range;\n range[START] = this[START];\n range[END] = this[END];\n return range;\n }\n}\n","import {\n DOCUMENT_NODE,\n ELEMENT_NODE,\n TEXT_NODE,\n CDATA_SECTION_NODE,\n COMMENT_NODE,\n SHOW_ALL,\n SHOW_ELEMENT,\n SHOW_CDATA_SECTION,\n SHOW_COMMENT,\n SHOW_TEXT\n} from '../shared/constants.js';\n\nimport {PRIVATE, END, NEXT} from '../shared/symbols.js';\n\nconst isOK = ({nodeType}, mask) => {\n switch (nodeType) {\n case ELEMENT_NODE:\n return mask & SHOW_ELEMENT;\n case TEXT_NODE:\n return mask & SHOW_TEXT;\n case COMMENT_NODE:\n return mask & SHOW_COMMENT;\n case CDATA_SECTION_NODE:\n return mask & SHOW_CDATA_SECTION;\n }\n return 0;\n};\n\n/**\n * @implements globalThis.TreeWalker\n */\nexport class TreeWalker {\n constructor(root, whatToShow = SHOW_ALL) {\n this.root = root;\n this.currentNode = root;\n this.whatToShow = whatToShow;\n let {[NEXT]: next, [END]: end} = root;\n if (root.nodeType === DOCUMENT_NODE) {\n const {documentElement} = root;\n next = documentElement;\n end = documentElement[END];\n }\n const nodes = [];\n while (next && next !== end) {\n if (isOK(next, whatToShow))\n nodes.push(next);\n next = next[NEXT];\n }\n this[PRIVATE] = {i: 0, nodes};\n }\n\n nextNode() {\n const $ = this[PRIVATE];\n this.currentNode = $.i < $.nodes.length ? $.nodes[$.i++] : null;\n return this.currentNode;\n }\n}\n","import {DOCUMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, SVG_NAMESPACE} from '../shared/constants.js';\n\nimport {\n CUSTOM_ELEMENTS, DOM_PARSER, GLOBALS, IMAGE, MUTATION_OBSERVER,\n DOCTYPE, END, NEXT, MIME, EVENT_TARGET, UPGRADE\n} from '../shared/symbols.js';\n\nimport {Facades, illegalConstructor} from '../shared/facades.js';\nimport {HTMLClasses} from '../shared/html-classes.js';\nimport {Mime} from '../shared/mime.js';\nimport {knownSiblings} from '../shared/utils.js';\nimport {assign, create, defineProperties, setPrototypeOf} from '../shared/object.js';\n\nimport {NonElementParentNode} from '../mixin/non-element-parent-node.js';\n\nimport {SVGElement} from '../svg/element.js';\n\nimport {Attr} from './attr.js';\nimport {CDATASection} from './cdata-section.js'\nimport {Comment} from './comment.js';\nimport {CustomElementRegistry} from './custom-element-registry.js';\nimport {CustomEvent} from './custom-event.js';\nimport {DocumentFragment} from './document-fragment.js';\nimport {DocumentType} from './document-type.js';\nimport {Element} from './element.js';\nimport {Event} from './event.js';\nimport {EventTarget} from './event-target.js';\nimport {InputEvent} from './input-event.js';\nimport {ImageClass} from './image.js';\nimport {MutationObserverClass} from './mutation-observer.js';\nimport {NamedNodeMap} from './named-node-map.js';\nimport {NodeList} from './node-list.js';\nimport {Range} from './range.js';\nimport {Text} from './text.js';\nimport {TreeWalker} from './tree-walker.js';\n\nconst query = (method, ownerDocument, selectors) => {\n let {[NEXT]: next, [END]: end} = ownerDocument;\n return method.call({ownerDocument, [NEXT]: next, [END]: end}, selectors);\n};\n\nconst globalExports = assign(\n {},\n Facades,\n HTMLClasses,\n {\n CustomEvent,\n Event,\n EventTarget,\n InputEvent,\n NamedNodeMap,\n NodeList\n }\n);\n\nconst window = new WeakMap;\n\n/**\n * @implements globalThis.Document\n */\nexport class Document extends NonElementParentNode {\n constructor(type) {\n super(null, '#document', DOCUMENT_NODE);\n this[CUSTOM_ELEMENTS] = {active: false, registry: null};\n this[MUTATION_OBSERVER] = {active: false, class: null};\n this[MIME] = Mime[type];\n /** @type {DocumentType} */\n this[DOCTYPE] = null;\n this[DOM_PARSER] = null;\n this[GLOBALS] = null;\n this[IMAGE] = null;\n this[UPGRADE] = null;\n }\n\n /**\n * @type {globalThis.Document['defaultView']}\n */\n get defaultView() {\n if (!window.has(this))\n window.set(this, new Proxy(globalThis, {\n set: (target, name, value) => {\n switch (name) {\n case 'addEventListener':\n case 'removeEventListener':\n case 'dispatchEvent':\n this[EVENT_TARGET][name] = value;\n break;\n default:\n target[name] = value;\n break;\n }\n return true;\n },\n get: (globalThis, name) => {\n switch (name) {\n case 'addEventListener':\n case 'removeEventListener':\n case 'dispatchEvent':\n if (!this[EVENT_TARGET]) {\n const et = this[EVENT_TARGET] = new EventTarget;\n et.dispatchEvent = et.dispatchEvent.bind(et);\n et.addEventListener = et.addEventListener.bind(et);\n et.removeEventListener = et.removeEventListener.bind(et);\n }\n return this[EVENT_TARGET][name];\n case 'document':\n return this;\n /* c8 ignore start */\n case 'navigator':\n return {\n userAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36'\n };\n /* c8 ignore stop */\n case 'window':\n return window.get(this);\n case 'customElements':\n if (!this[CUSTOM_ELEMENTS].registry)\n this[CUSTOM_ELEMENTS] = new CustomElementRegistry(this);\n return this[CUSTOM_ELEMENTS];\n case 'performance':\n return globalThis.performance;\n case 'DOMParser':\n return this[DOM_PARSER];\n case 'Image':\n if (!this[IMAGE])\n this[IMAGE] = ImageClass(this);\n return this[IMAGE];\n case 'MutationObserver':\n if (!this[MUTATION_OBSERVER].class)\n this[MUTATION_OBSERVER] = new MutationObserverClass(this);\n return this[MUTATION_OBSERVER].class;\n }\n return (this[GLOBALS] && this[GLOBALS][name]) ||\n globalExports[name] ||\n globalThis[name];\n }\n }));\n return window.get(this);\n }\n\n get doctype() {\n const docType = this[DOCTYPE];\n if (docType)\n return docType;\n const {firstChild} = this;\n if (firstChild && firstChild.nodeType === DOCUMENT_TYPE_NODE)\n return (this[DOCTYPE] = firstChild);\n return null;\n }\n\n set doctype(value) {\n if (/^([a-z:]+)(\\s+system|\\s+public(\\s+\"([^\"]+)\")?)?(\\s+\"([^\"]+)\")?/i.test(value)) {\n const {$1: name, $4: publicId, $6: systemId} = RegExp;\n this[DOCTYPE] = new DocumentType(this, name, publicId, systemId);\n knownSiblings(this, this[DOCTYPE], this[NEXT]);\n }\n }\n\n get documentElement() {\n return this.firstElementChild;\n }\n\n get isConnected() { return true; }\n\n /**\n * @protected\n */\n _getParent() {\n return this[EVENT_TARGET];\n }\n\n createAttribute(name) { return new Attr(this, name); }\n createCDATASection(data) { return new CDATASection(this, data); }\n createComment(textContent) { return new Comment(this, textContent); }\n createDocumentFragment() { return new DocumentFragment(this); }\n createDocumentType(name, publicId, systemId) { return new DocumentType(this, name, publicId, systemId); }\n createElement(localName) { return new Element(this, localName); }\n createRange() {\n const range = new Range;\n range.commonAncestorContainer = this;\n return range;\n }\n createTextNode(textContent) { return new Text(this, textContent); }\n createTreeWalker(root, whatToShow = -1) { return new TreeWalker(root, whatToShow); }\n createNodeIterator(root, whatToShow = -1) { return this.createTreeWalker(root, whatToShow); }\n\n createEvent(name) {\n const event = create(name === 'Event' ? new Event('') : new CustomEvent(''));\n event.initEvent = event.initCustomEvent = (\n type,\n canBubble = false,\n cancelable = false,\n detail\n ) => {\n event.bubbles = !!canBubble;\n\n defineProperties(event, {\n type: {value: type},\n canBubble: {value: canBubble},\n cancelable: {value: cancelable},\n detail: {value: detail}\n });\n };\n return event;\n }\n\n cloneNode(deep = false) {\n const {\n constructor,\n [CUSTOM_ELEMENTS]: customElements,\n [DOCTYPE]: doctype\n } = this;\n const document = new constructor();\n document[CUSTOM_ELEMENTS] = customElements;\n if (deep) {\n const end = document[END];\n const {childNodes} = this;\n for (let {length} = childNodes, i = 0; i < length; i++)\n document.insertBefore(childNodes[i].cloneNode(true), end);\n if (doctype)\n document[DOCTYPE] = childNodes[0];\n }\n return document;\n }\n\n importNode(externalNode) {\n // important: keep the signature length as *one*\n // or it would behave like old IE or Edge with polyfills\n const deep = 1 < arguments.length && !!arguments[1];\n const node = externalNode.cloneNode(deep);\n const {[CUSTOM_ELEMENTS]: customElements} = this;\n const {active} = customElements;\n const upgrade = element => {\n const {ownerDocument, nodeType} = element;\n element.ownerDocument = this;\n if (active && ownerDocument !== this && nodeType === ELEMENT_NODE)\n customElements.upgrade(element);\n };\n upgrade(node);\n if (deep) {\n switch (node.nodeType) {\n case ELEMENT_NODE:\n case DOCUMENT_FRAGMENT_NODE: {\n let {[NEXT]: next, [END]: end} = node;\n while (next !== end) {\n if (next.nodeType === ELEMENT_NODE)\n upgrade(next);\n next = next[NEXT];\n }\n break;\n }\n }\n }\n return node;\n }\n\n toString() { return this.childNodes.join(''); }\n\n querySelector(selectors) {\n return query(super.querySelector, this, selectors);\n }\n\n querySelectorAll(selectors) {\n return query(super.querySelectorAll, this, selectors);\n }\n\n /* c8 ignore start */\n getElementsByTagNameNS(_, name) {\n return this.getElementsByTagName(name);\n }\n createAttributeNS(_, name) {\n return this.createAttribute(name);\n }\n createElementNS(nsp, localName, options) {\n return nsp === SVG_NAMESPACE ?\n new SVGElement(this, localName, null) :\n this.createElement(localName, options);\n }\n /* c8 ignore stop */\n}\n\nsetPrototypeOf(\n globalExports.Document = function Document() {\n illegalConstructor();\n },\n Document\n).prototype = Document.prototype;\n","import {ELEMENT_NODE} from '../shared/constants.js';\nimport {CUSTOM_ELEMENTS, END, NEXT} from '../shared/symbols.js';\nimport {htmlClasses} from '../shared/register-html-class.js';\n\nimport {Document} from '../interface/document.js';\nimport {NodeList} from '../interface/node-list.js';\nimport {customElements} from '../interface/custom-element-registry.js';\n\nimport {HTMLElement} from './element.js';\n\nconst createHTMLElement = (ownerDocument, builtin, localName, options) => {\n if (!builtin && htmlClasses.has(localName)) {\n const Class = htmlClasses.get(localName);\n return new Class(ownerDocument, localName);\n }\n const {[CUSTOM_ELEMENTS]: {active, registry}} = ownerDocument;\n if (active) {\n const ce = builtin ? options.is : localName;\n if (registry.has(ce)) {\n const {Class} = registry.get(ce);\n const element = new Class(ownerDocument, localName);\n customElements.set(element, {connected: false});\n return element;\n }\n }\n return new HTMLElement(ownerDocument, localName);\n};\n\n/**\n * @implements globalThis.HTMLDocument\n */\nexport class HTMLDocument extends Document {\n constructor() { super('text/html'); }\n\n get all() {\n const nodeList = new NodeList;\n let {[NEXT]: next, [END]: end} = this;\n while (next !== end) {\n switch (next.nodeType) {\n case ELEMENT_NODE:\n nodeList.push(next);\n break;\n }\n next = next[NEXT];\n }\n return nodeList;\n }\n\n /**\n * @type HTMLHeadElement\n */\n get head() {\n const {documentElement} = this;\n let {firstElementChild} = documentElement;\n if (!firstElementChild || firstElementChild.tagName !== 'HEAD') {\n firstElementChild = this.createElement('head');\n documentElement.prepend(firstElementChild);\n }\n return firstElementChild;\n }\n\n /**\n * @type HTMLBodyElement\n */\n get body() {\n const {head} = this;\n let {nextElementSibling} = head;\n if (!nextElementSibling || nextElementSibling.tagName !== 'BODY') {\n nextElementSibling = this.createElement('body');\n head.after(nextElementSibling);\n }\n return nextElementSibling;\n }\n\n /**\n * @type HTMLTitleElement\n */\n get title() {\n const {head} = this;\n return head.getElementsByTagName('title').at(0)?.textContent || '';\n }\n\n set title(textContent) {\n const {head} = this;\n let title = head.getElementsByTagName('title').at(0);\n if (title)\n title.textContent = textContent;\n else {\n head.insertBefore(\n this.createElement('title'),\n head.firstChild\n ).textContent = textContent;\n }\n }\n\n createElement(localName, options) {\n const builtin = !!(options && options.is);\n const element = createHTMLElement(this, builtin, localName, options);\n if (builtin)\n element.setAttribute('is', options.is);\n return element;\n }\n}\n","import {MIME} from '../shared/symbols.js';\nimport {Document} from '../interface/document.js';\n\n/**\n * @implements globalThis.Document\n */\nexport class SVGDocument extends Document {\n constructor() { super('image/svg+xml'); }\n toString() {\n return this[MIME].docType + super.toString();\n }\n}\n","import {MIME} from '../shared/symbols.js';\nimport {Document} from '../interface/document.js';\n\n/**\n * @implements globalThis.XMLDocument\n */\nexport class XMLDocument extends Document {\n constructor() { super('text/xml'); }\n toString() {\n return this[MIME].docType + super.toString();\n }\n}\n","import {DOM_PARSER, GLOBALS} from '../shared/symbols.js';\nimport {parseFromString} from '../shared/parse-from-string.js';\n\nimport {HTMLDocument} from '../html/document.js';\nimport {SVGDocument} from '../svg/document.js';\nimport {XMLDocument} from '../xml/document.js';\n\n/**\n * @implements globalThis.DOMParser\n */\nexport class DOMParser {\n\n /** @typedef {{ \"text/html\": HTMLDocument, \"image/svg+xml\": SVGDocument, \"text/xml\": XMLDocument }} MimeToDoc */\n /**\n * @template {keyof MimeToDoc} MIME\n * @param {string} markupLanguage\n * @param {MIME} mimeType\n * @returns {MimeToDoc[MIME]}\n */\n parseFromString(markupLanguage, mimeType, globals = null) {\n let isHTML = false, document;\n if (mimeType === 'text/html') {\n isHTML = true;\n document = new HTMLDocument;\n }\n else if (mimeType === 'image/svg+xml')\n document = new SVGDocument;\n else\n document = new XMLDocument;\n document[DOM_PARSER] = DOMParser;\n if (globals)\n document[GLOBALS] = globals;\n if (isHTML && markupLanguage === '...')\n markupLanguage = '<!doctype html><html><head></head><body></body></html>';\n return markupLanguage ?\n parseFromString(document, isHTML, markupLanguage) :\n document;\n }\n}\n","import {\n NODE_END,\n ELEMENT_NODE,\n ATTRIBUTE_NODE,\n TEXT_NODE,\n CDATA_SECTION_NODE,\n COMMENT_NODE,\n DOCUMENT_NODE,\n DOCUMENT_TYPE_NODE,\n DOCUMENT_FRAGMENT_NODE\n} from './constants.js';\n\nimport {END, PREV} from './symbols.js';\n\nimport {htmlClasses} from './register-html-class.js';\nimport {knownBoundaries, knownSiblings} from './utils.js';\n\nimport {Attr} from '../interface/attr.js';\nimport {CDATASection} from '../interface/cdata-section.js';\nimport {Comment} from '../interface/comment.js';\nimport {DocumentType} from '../interface/document-type.js';\nimport {Text} from '../interface/text.js';\n\nimport {HTMLDocument} from '../html/document.js';\nimport {HTMLElement} from '../html/element.js';\nimport {SVGElement} from '../svg/element.js';\n\nconst {parse} = JSON;\n\nconst append = (parentNode, node, end) => {\n node.parentNode = parentNode;\n knownSiblings(end[PREV], node, end);\n};\n\nconst createHTMLElement = (ownerDocument, localName) => {\n if (htmlClasses.has(localName)) {\n const Class = htmlClasses.get(localName);\n return new Class(ownerDocument, localName);\n }\n return new HTMLElement(ownerDocument, localName);\n};\n\n/**\n * @typedef {number|string} jsdonValue - either a node type or its content\n */\n\n/**\n * Given a stringified, or arrayfied DOM element, returns an HTMLDocument\n * that represent the content of such string, or array.\n * @param {string|jsdonValue[]} value\n * @returns {HTMLDocument}\n */\nexport const parseJSON = value => {\n const array = typeof value === 'string' ? parse(value) : value;\n const {length} = array;\n const document = new HTMLDocument;\n let parentNode = document, end = parentNode[END], svg = false, i = 0;\n while (i < length) {\n let nodeType = array[i++];\n switch (nodeType) {\n case ELEMENT_NODE: {\n const localName = array[i++];\n const isSVG = svg || localName === 'svg' || localName === 'SVG';\n const element = isSVG ?\n new SVGElement(document, localName, parentNode.ownerSVGElement || null) :\n createHTMLElement(document, localName);\n knownBoundaries(end[PREV], element, end);\n element.parentNode = parentNode;\n parentNode = element;\n end = parentNode[END];\n svg = isSVG;\n break;\n }\n case ATTRIBUTE_NODE: {\n const name = array[i++];\n const value = typeof array[i] === 'string' ? array[i++] : '';\n const attr = new Attr(document, name, value);\n attr.ownerElement = parentNode;\n knownSiblings(end[PREV], attr, end);\n break;\n }\n case TEXT_NODE:\n append(parentNode, new Text(document, array[i++]), end);\n break;\n case COMMENT_NODE:\n append(parentNode, new Comment(document, array[i++]), end);\n break;\n case CDATA_SECTION_NODE:\n append(parentNode, new CDATASection(document, array[i++]), end);\n break;\n case DOCUMENT_TYPE_NODE: {\n const args = [document];\n while (typeof array[i] === 'string')\n args.push(array[i++]);\n if (args.length === 3 && /\\.dtd$/i.test(args[2]))\n args.splice(2, 0, '');\n append(parentNode, new DocumentType(...args), end);\n break;\n }\n case DOCUMENT_FRAGMENT_NODE:\n parentNode = document.createDocumentFragment();\n end = parentNode[END];\n /* eslint no-fallthrough:0 */\n case DOCUMENT_NODE:\n break;\n default:\n do {\n nodeType -= NODE_END;\n if (svg && !parentNode.ownerSVGElement)\n svg = false;\n parentNode = parentNode.parentNode || parentNode;\n } while (nodeType < 0);\n end = parentNode[END];\n break;\n }\n }\n switch (i && array[0]) {\n case ELEMENT_NODE:\n return document.firstElementChild;\n case DOCUMENT_FRAGMENT_NODE:\n return parentNode;\n }\n return document;\n};\n\n/**\n * \n * @param {Document|Element} node the Document or Element to serialize\n * @returns {jsdonValue[]} the linear jsdon serialized array\n */\nexport const toJSON = node => node.toJSON();\n","import {DOMParser} from './dom/parser.js';\nimport {Document as _Document} from './interface/document.js';\n\nimport {illegalConstructor} from './shared/facades.js';\nimport {setPrototypeOf} from './shared/object.js';\nexport {parseJSON, toJSON} from './shared/parse-json.js';\n\nexport * from './shared/facades.js';\nexport * from './shared/html-classes.js';\n\nexport {DOMParser};\n\nexport {CustomEvent} from './interface/custom-event.js';\nexport {Event} from './interface/event.js';\nexport {EventTarget} from './interface/event-target.js';\nexport {InputEvent} from './interface/input-event.js';\nexport {NodeList} from './interface/node-list.js';\nexport {NodeFilter} from './interface/node-filter.js';\n\nexport const parseHTML = (html, globals = null) => (new DOMParser).parseFromString(\n html, 'text/html', globals\n).defaultView;\n\nexport function Document() {\n illegalConstructor();\n}\n\nsetPrototypeOf(Document, _Document).prototype = _Document.prototype;\n","import type { AssessmentRubricBlock, QTIRole } from '@pie-qti/assessment-player';\nimport { DOMParser as LinkedomDOMParser } from 'linkedom';\nimport type { ParsedAssessmentItemRef, ParsedAssessmentSection, ParsedAssessmentTest, ParsedTestPart } from './types.js';\n\n// Use native DOMParser in browser, linkedom in Node/Bun\nconst DOMParserImpl = typeof DOMParser !== 'undefined' ? DOMParser : LinkedomDOMParser;\n\nfunction toCanonicalQtiName(name: string | null | undefined): string {\n\tconst withoutPrefix = (name ?? '').replace(/^qti-/, '');\n\treturn withoutPrefix.replace(/-([a-z])/g, (_, char: string) => char.toUpperCase());\n}\n\nfunction firstByLocalName(parent: ParentNode, localName: string): Element | null {\n\tconst all = (parent as any).getElementsByTagNameNS\n\t\t? (parent as any).getElementsByTagNameNS('*', localName)\n\t\t: (parent as any).getElementsByTagName?.(localName);\n\tconst direct = all?.[0] ?? null;\n\tif (direct) return direct;\n\n\tconst canonical = localName;\n\tconst allElements = (parent as any).getElementsByTagName?.('*') ?? [];\n\treturn Array.from(allElements).find((el) => toCanonicalQtiName((el as Element).localName) === canonical) as Element | null ?? null;\n}\n\nfunction childrenByLocalName(parent: ParentNode, localName: string): Element[] {\n\tconst all = (parent as any).getElementsByTagNameNS\n\t\t? (parent as any).getElementsByTagNameNS('*', localName)\n\t\t: (parent as any).getElementsByTagName?.(localName);\n\tconst direct = all ? Array.from(all) as Element[] : [];\n\tif (direct.length > 0) return direct;\n\n\tconst allElements = (parent as any).getElementsByTagName?.('*') ?? [];\n\treturn (Array.from(allElements) as Element[]).filter((el) => toCanonicalQtiName(el.localName) === localName);\n}\n\nfunction serializeInnerXml(el: Element): string {\n\t// In linkedom, use innerHTML; in browser, use XMLSerializer\n\tif (typeof XMLSerializer !== 'undefined') {\n\t\tconst s = new XMLSerializer();\n\t\tlet out = '';\n\t\tfor (const node of Array.from(el.childNodes)) {\n\t\t\tout += s.serializeToString(node);\n\t\t}\n\t\treturn out.trim();\n\t} else {\n\t\t// linkedom: use innerHTML which works for both HTML and XML\n\t\treturn el.innerHTML.trim();\n\t}\n}\n\nfunction getAttr(el: Element, name: string): string | undefined {\n\tconst v = el.getAttribute(name) ?? el.getAttribute(name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`));\n\treturn v === null ? undefined : v;\n}\n\nfunction parseQtiRoleList(viewAttr: string | undefined): QTIRole[] {\n\tif (!viewAttr) return ['candidate'];\n\tconst roles = viewAttr\n\t\t.split(/\\s+/g)\n\t\t.map((r) => r.trim())\n\t\t.filter(Boolean) as QTIRole[];\n\treturn roles.length ? roles : ['candidate'];\n}\n\nfunction parseRubricBlocks(sectionEl: Element): AssessmentRubricBlock[] | undefined {\n\tconst blocks = childrenByLocalName(sectionEl, 'rubricBlock');\n\tif (blocks.length === 0) return undefined;\n\n\treturn blocks.map((b, idx) => ({\n\t\tidentifier: getAttr(b, 'identifier') ?? `${getAttr(sectionEl, 'identifier') ?? 'section'}-rubric-${idx + 1}`,\n\t\tview: parseQtiRoleList(getAttr(b, 'view')),\n\t\tuse: getAttr(b, 'use'),\n\t\tcontent: serializeInnerXml(b),\n\t}));\n}\n\nfunction parseAssessmentItemRefs(sectionEl: Element): ParsedAssessmentItemRef[] | undefined {\n\tconst itemRefs = Array.from(sectionEl.childNodes)\n\t\t.filter((n): n is Element => n.nodeType === 1)\n\t\t.filter((el) => toCanonicalQtiName((el as Element).localName) === 'assessmentItemRef');\n\n\tif (itemRefs.length === 0) return undefined;\n\n\treturn itemRefs.map((el) => {\n\t\tconst identifier = getAttr(el, 'identifier') ?? 'item';\n\t\tconst href = getAttr(el, 'href');\n\t\tconst requiredRaw = getAttr(el, 'required');\n\t\tconst required = requiredRaw === undefined ? undefined : requiredRaw !== 'false';\n\t\treturn {\n\t\t\tidentifier,\n\t\t\thref,\n\t\t\ttitle: getAttr(el, 'title'),\n\t\t\trequired,\n\t\t};\n\t});\n}\n\nfunction parseSection(sectionEl: Element): ParsedAssessmentSection {\n\tconst identifier = getAttr(sectionEl, 'identifier') ?? 'section';\n\tconst title = getAttr(sectionEl, 'title') ?? undefined;\n\tconst visibleRaw = getAttr(sectionEl, 'visible');\n\tconst visible = visibleRaw === undefined ? undefined : visibleRaw !== 'false';\n\n\tconst rubricBlocks = parseRubricBlocks(sectionEl);\n\tconst assessmentItemRefs = parseAssessmentItemRefs(sectionEl);\n\n\t// Only parse direct child sections (not deep descendants)\n\tconst childSections = Array.from(sectionEl.childNodes)\n\t\t.filter((n): n is Element => n.nodeType === 1)\n\t\t.filter((el) => toCanonicalQtiName((el as Element).localName) === 'assessmentSection')\n\t\t.map(parseSection);\n\n\treturn {\n\t\tidentifier,\n\t\ttitle,\n\t\tvisible,\n\t\trubricBlocks,\n\t\tassessmentItemRefs,\n\t\tsections: childSections.length ? childSections : undefined,\n\t};\n}\n\nfunction parseTestPart(testPartEl: Element): ParsedTestPart {\n\tconst identifier = getAttr(testPartEl, 'identifier') ?? 'part-1';\n\tconst navigationMode = (getAttr(testPartEl, 'navigationMode') ?? 'nonlinear') as ParsedTestPart['navigationMode'];\n\tconst submissionMode = (getAttr(testPartEl, 'submissionMode') ?? 'simultaneous') as ParsedTestPart['submissionMode'];\n\n\t// Only direct child sections\n\tconst sections = Array.from(testPartEl.childNodes)\n\t\t.filter((n): n is Element => n.nodeType === 1)\n\t\t.filter((el) => toCanonicalQtiName((el as Element).localName) === 'assessmentSection')\n\t\t.map(parseSection);\n\n\treturn {\n\t\tidentifier,\n\t\tnavigationMode,\n\t\tsubmissionMode,\n\t\tsections,\n\t};\n}\n\nexport function parseAssessmentTestXml(xml: string): ParsedAssessmentTest {\n\tconst doc = new DOMParserImpl().parseFromString(xml, 'application/xml' as any);\n\tconst parserError = firstByLocalName(doc as ParentNode, 'parsererror');\n\tif (parserError) {\n\t\tthrow new Error('Failed to parse assessmentTest XML');\n\t}\n\n\tconst assessmentTestEl = firstByLocalName(doc as ParentNode, 'assessmentTest') ?? doc.documentElement;\n\tif (!assessmentTestEl || toCanonicalQtiName(assessmentTestEl.localName) !== 'assessmentTest') {\n\t\tthrow new Error('No <assessmentTest> root element found');\n\t}\n\n\tconst identifier = getAttr(assessmentTestEl as Element, 'identifier');\n\tconst title = getAttr(assessmentTestEl as Element, 'title');\n\n\t// Prefer explicit testPart(s); if missing, synthesize one from top-level sections\n\tconst testPartsEls = Array.from(assessmentTestEl.childNodes)\n\t\t.filter((n): n is Element => (n as any).nodeType === 1)\n\t\t.filter((el) => toCanonicalQtiName((el as Element).localName) === 'testPart');\n\n\tlet testParts: ParsedTestPart[] | undefined;\n\tif (testPartsEls.length > 0) {\n\t\ttestParts = testPartsEls.map(parseTestPart);\n\t} else {\n\t\tconst topSections = Array.from(assessmentTestEl.childNodes)\n\t\t\t.filter((n): n is Element => (n as any).nodeType === 1)\n\t\t\t.filter((el) => toCanonicalQtiName((el as Element).localName) === 'assessmentSection')\n\t\t\t.map(parseSection);\n\n\t\ttestParts = [\n\t\t\t{\n\t\t\t\tidentifier: 'part-1',\n\t\t\t\tnavigationMode: 'nonlinear',\n\t\t\t\tsubmissionMode: 'simultaneous',\n\t\t\t\tsections: topSections,\n\t\t\t},\n\t\t];\n\t}\n\n\treturn {\n\t\tidentifier,\n\t\ttitle,\n\t\ttestParts,\n\t};\n}\n\n\n","import type { ParsedAssessmentItemRef, ParsedAssessmentSection, ParsedAssessmentTest, ParsedTestPart } from './types.js';\n\nexport type QtiItemMap = Record<string, string>;\n\nfunction collectAssessmentItemRefsFromSections(sections: ParsedAssessmentSection[] | undefined): ParsedAssessmentItemRef[] {\n\tif (!sections) return [];\n\tconst out: ParsedAssessmentItemRef[] = [];\n\tfor (const s of sections) {\n\t\tif (s.assessmentItemRefs) out.push(...s.assessmentItemRefs);\n\t\tif (s.sections) out.push(...collectAssessmentItemRefsFromSections(s.sections));\n\t}\n\treturn out;\n}\n\nfunction collectAssessmentItemRefs(assessment: ParsedAssessmentTest): ParsedAssessmentItemRef[] {\n\tconst parts = assessment.testParts ?? [];\n\tconst out: ParsedAssessmentItemRef[] = [];\n\tfor (const p of parts) {\n\t\tout.push(...collectAssessmentItemRefsFromSections(p.sections));\n\t}\n\treturn out;\n}\n\nfunction setAssessmentItemRefXmlInPlace(\n\tassessment: ParsedAssessmentTest,\n\tidentifier: string,\n\thref: string | undefined,\n\titemXml: string,\n) {\n\tconst parts = assessment.testParts ?? [];\n\tfor (const p of parts) {\n\t\tconst stack: ParsedAssessmentSection[] = [...(p.sections ?? [])];\n\t\twhile (stack.length) {\n\t\t\tconst s = stack.pop()!;\n\t\t\tif (s.assessmentItemRefs) {\n\t\t\t\tfor (const q of s.assessmentItemRefs) {\n\t\t\t\t\tif (q.identifier === identifier || (href && q.href === href)) {\n\t\t\t\t\t\tq.itemXml = itemXml;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (s.sections) stack.push(...s.sections);\n\t\t}\n\t}\n}\n\nfunction normalizeBaseUrl(baseUrl: string) {\n\ttry {\n\t\treturn new URL(baseUrl, window.location.href).toString();\n\t} catch {\n\t\treturn baseUrl;\n\t}\n}\n\nexport async function resolveItemsForAssessment(options: {\n\tassessment: ParsedAssessmentTest;\n\titemBaseUrl?: string;\n\titems?: QtiItemMap;\n}): Promise<ParsedAssessmentTest> {\n\tconst { assessment, itemBaseUrl, items } = options;\n\tconst baseUrl = itemBaseUrl ? normalizeBaseUrl(itemBaseUrl) : undefined;\n\n\t// Mutate in-place (assessmentItemRefs are nested); return same reference.\n\tconst refs = collectAssessmentItemRefs(assessment);\n\n\tconst tasks = refs.map(async (q) => {\n\t\tif (q.itemXml) return;\n\n\t\t// A) fallback convenience: host provides item XML map by href or identifier\n\t\tif (items) {\n\t\t\tconst fromHref = q.href ? items[q.href] : undefined;\n\t\t\tconst fromId = items[q.identifier];\n\t\t\tconst xml = fromHref ?? fromId;\n\t\t\tif (xml) {\n\t\t\t\tq.itemXml = xml;\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// B) standard: fetch item XML using href relative to a base URL\n\t\tif (baseUrl && q.href) {\n\t\t\tconst url = new URL(q.href, baseUrl).toString();\n\t\t\tconst res = await fetch(url);\n\t\t\tif (!res.ok) throw new Error(`Failed to fetch QTI item: ${url} (${res.status})`);\n\t\t\tconst xml = await res.text();\n\t\t\tsetAssessmentItemRefXmlInPlace(assessment, q.identifier, q.href, xml);\n\t\t}\n\t});\n\n\tawait Promise.all(tasks);\n\treturn assessment;\n}\n\n\n","export function safeJsonParse<T>(value: string | null | undefined): T | undefined {\n\tif (!value) return undefined;\n\ttry {\n\t\treturn JSON.parse(value) as T;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n\n","import { mount, unmount } from 'svelte';\nimport { createSvelteMountController, type SvelteMountController } from '@pie-qti/qti-common';\n\nexport abstract class BaseSvelteMountElement<TProps extends Record<string, unknown>> extends HTMLElement {\n\tprotected abstract Component: any;\n\tprotected abstract getProps(): TProps;\n\n\t#mountController: SvelteMountController<TProps, any> | null = null;\n\n\tprotected get _instance() {\n\t\treturn this.#mountController?.instance ?? null;\n\t}\n\n\tconnectedCallback() {\n\t\tthis._mountOrUpdate();\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis._teardownInstance();\n\t}\n\n\tprotected _mountOrUpdate() {\n\t\tthis.#controller().mountOrUpdate(this.getProps());\n\t}\n\n\tprotected _teardownInstance() {\n\t\tthis.#mountController?.teardown({ removeContainer: true });\n\t}\n\n\t#controller() {\n\t\tif (!this.#mountController) {\n\t\t\tthis.#mountController = createSvelteMountController({\n\t\t\t\thost: this,\n\t\t\t\tmount: (target, props) =>\n\t\t\t\t\tmount(this.Component, {\n\t\t\t\t\t\ttarget,\n\t\t\t\t\t\tprops,\n\t\t\t\t\t}),\n\t\t\t\tunmount,\n\t\t\t});\n\t\t}\n\t\treturn this.#mountController;\n\t}\n}\n\n\n","import type { AssessmentResults, BackendAdapter, BackendAssessmentPlayerConfig, InitSessionRequest, SecureAssessment } from '@pie-qti/assessment-player';\nimport { ReferenceBackendAdapter } from '@pie-qti/assessment-player';\nimport type { PlayerSecurityConfig } from '@pie-qti/item-player';\nimport AssessmentShell from '../../../assessment-player/src/components/AssessmentShell.svelte';\nimport { QTI_ASSESSMENT_PLAYER_TAG } from '../constants.js';\nimport { parseAssessmentTestXml } from '../qti/parseAssessmentTest.js';\nimport { type QtiItemMap, resolveItemsForAssessment } from '../qti/resolveItems.js';\nimport type { ParsedAssessmentSection, ParsedAssessmentTest } from '../qti/types.js';\nimport { safeJsonParse } from '../utils/json.js';\nimport { BaseSvelteMountElement } from './BaseSvelteMountElement.js';\n\nexport type QtiAssessmentResponseChangeDetail = {\n\tresponses: Record<string, unknown>;\n};\n\nexport type QtiAssessmentItemChangeDetail = {\n\titemIndex: number;\n\ttotalItems: number;\n};\n\nexport type QtiAssessmentSectionChangeDetail = {\n\tsectionIndex: number;\n\ttotalSections: number;\n};\n\nexport type QtiAssessmentSubmitDetail = {\n\tresults: AssessmentResults;\n};\n\nexport class QtiAssessmentPlayerElement extends BaseSvelteMountElement<Record<string, unknown>> {\n\tstatic get observedAttributes() {\n\t\treturn [\n\t\t\t// Pure-QTI inputs\n\t\t\t'assessment-test-xml',\n\t\t\t'assessment-id',\n\t\t\t'candidate-id',\n\t\t\t'item-base-url',\n\t\t\t'items-json',\n\t\t\t// Common\n\t\t\t'config-json',\n\t\t\t'security-json',\n\t\t];\n\t}\n\n\tprotected Component: any = AssessmentShell;\n\n\t#assessmentTestXml: string | null = null;\n\t#assessmentId: string | undefined;\n\t#candidateId: string | undefined;\n\t#itemBaseUrl: string | undefined;\n\t#items: QtiItemMap | undefined;\n\t#config: Partial<BackendAssessmentPlayerConfig> = {};\n\t#security: PlayerSecurityConfig | undefined;\n\n\t#backend: BackendAdapter = {\n\t\tasync initSession(_request) {\n\t\t\tthrow new Error('No assessment loaded. Provide `assessment-test-xml`.');\n\t\t},\n\t\tasync submitResponses(_request) {\n\t\t\treturn { success: false, error: 'No assessment loaded.' };\n\t\t},\n\t\tasync finalizeAssessment(_request) {\n\t\t\treturn { success: false, totalScore: 0, maxScore: 0, itemScores: {}, finalizedAt: Date.now() };\n\t\t},\n\t\tasync saveState(_request) {\n\t\t\treturn { success: false, savedAt: Date.now() };\n\t\t},\n\t\tasync queryItemBank(_request) {\n\t\t\treturn { items: [], selectedAt: Date.now() };\n\t\t},\n\t};\n\t#initSession: InitSessionRequest = { assessmentId: 'assessment', candidateId: 'candidate' };\n\n\t#loadSeq = 0;\n\t#allowMount = false;\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\t\tqueueMicrotask(() => {\n\t\t\tthis.dispatchEvent(new CustomEvent('ready', { bubbles: true, composed: true }));\n\t\t});\n\t}\n\n\tprotected override _mountOrUpdate() {\n\t\t// Pure-QTI assessment elements need their XML resolved before the Svelte shell mounts.\n\t\tif (!this.#allowMount) {\n\t\t\treturn;\n\t\t}\n\t\tsuper._mountOrUpdate();\n\t}\n\n\tattributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null) {\n\t\tif (name === 'assessment-test-xml') {\n\t\t\tthis.#assessmentTestXml = newValue;\n\t\t}\n\n\t\tif (name === 'assessment-id') {\n\t\t\tthis.#assessmentId = newValue ?? undefined;\n\t\t}\n\n\t\tif (name === 'candidate-id') {\n\t\t\tthis.#candidateId = newValue ?? undefined;\n\t\t}\n\n\t\tif (name === 'item-base-url') {\n\t\t\tthis.#itemBaseUrl = newValue ?? undefined;\n\t\t}\n\n\t\tif (name === 'items-json') {\n\t\t\tconst parsed = safeJsonParse<QtiItemMap>(newValue);\n\t\t\tif (parsed) this.#items = parsed;\n\t\t}\n\n\t\tif (name === 'config-json') {\n\t\t\tconst parsed = safeJsonParse<Partial<BackendAssessmentPlayerConfig>>(newValue);\n\t\t\tif (parsed) this.#config = parsed;\n\t\t}\n\n\t\tif (name === 'security-json') {\n\t\t\tconst parsed = safeJsonParse<PlayerSecurityConfig>(newValue);\n\t\t\tif (parsed) this.#security = parsed;\n\t\t}\n\n\t\tvoid this.#syncFromQti();\n\t\t// Don't call _mountOrUpdate here - let #syncFromQti handle it when done\n\t}\n\n\tget config() {\n\t\treturn this.#config;\n\t}\n\tset config(value: Partial<BackendAssessmentPlayerConfig>) {\n\t\tthis.#config = value ?? {};\n\t\t// Let #syncFromQti mount once the assessment backend is ready.\n\t\tif (this.#allowMount) {\n\t\t\tthis._mountOrUpdate();\n\t\t}\n\t}\n\n\tget security() {\n\t\treturn this.#security;\n\t}\n\tset security(value: PlayerSecurityConfig | undefined) {\n\t\tthis.#security = value;\n\t\t// Let #syncFromQti mount once the assessment backend is ready.\n\t\tif (this.#allowMount) {\n\t\t\tthis._mountOrUpdate();\n\t\t}\n\t}\n\n\t/**\n\t * Pure-QTI API (preferred): supply an assessmentTest XML string and let the element\n\t * resolve itemRefs via either an item map (A) or base URL fetching (B).\n\t */\n\tget assessmentTestXml() {\n\t\treturn this.#assessmentTestXml;\n\t}\n\tset assessmentTestXml(value: string | null) {\n\t\tthis.#assessmentTestXml = value;\n\t\tvoid this.#syncFromQti();\n\t\t// Don't call _mountOrUpdate here - let #syncFromQti handle it when done\n\t}\n\n\tget itemBaseUrl() {\n\t\treturn this.#itemBaseUrl;\n\t}\n\tset itemBaseUrl(value: string | undefined) {\n\t\tthis.#itemBaseUrl = value;\n\t\tvoid this.#syncFromQti();\n\t\t// Don't call _mountOrUpdate here - let #syncFromQti handle it when done\n\t}\n\n\tget items() {\n\t\treturn this.#items;\n\t}\n\tset items(value: QtiItemMap | undefined) {\n\t\tthis.#items = value;\n\t\tvoid this.#syncFromQti();\n\t\t// Don't call _mountOrUpdate here - let #syncFromQti handle it when done\n\t}\n\n\t/**\n\t * Imperative API (proxied through `AssessmentShell` exports)\n\t */\n\tasync next() {\n\t\treturn this._instance?.next?.();\n\t}\n\tasync previous() {\n\t\treturn this._instance?.previous?.();\n\t}\n\tasync navigateTo(index: number) {\n\t\treturn this._instance?.navigateTo?.(index);\n\t}\n\tasync navigateToSection(sectionIdentifier: string) {\n\t\treturn this._instance?.navigateToSection?.(sectionIdentifier);\n\t}\n\tasync submit() {\n\t\treturn this._instance?.submit?.();\n\t}\n\tgetResponses() {\n\t\treturn this._instance?.getResponses?.();\n\t}\n\tgetState() {\n\t\treturn this._instance?.getState?.();\n\t}\n\trestoreState(state: unknown) {\n\t\treturn this._instance?.restoreState?.(state);\n\t}\n\n\tasync #syncFromQti() {\n\t\tif (!this.#assessmentTestXml) return;\n\n\t\tconst seq = ++this.#loadSeq;\n\t\tthis.dispatchEvent(new CustomEvent('load-start', { bubbles: true, composed: true }));\n\n\t\ttry {\n\t\t\tconst parsed = parseAssessmentTestXml(this.#assessmentTestXml);\n\t\t\tawait resolveItemsForAssessment({\n\t\t\t\tassessment: parsed,\n\t\t\t\titemBaseUrl: this.#itemBaseUrl,\n\t\t\t\titems: this.#items,\n\t\t\t});\n\n\t\t\tif (seq !== this.#loadSeq) return; // superseded\n\t\t\tconst assessmentId = this.#assessmentId ?? parsed.identifier ?? 'assessment';\n\t\t\tconst candidateId = this.#candidateId ?? 'candidate';\n\n\t\t\tconst secure = this.#toSecureAssessment(parsed, this.#config.role ?? 'candidate');\n\t\t\tconst backend = new ReferenceBackendAdapter();\n\t\t\tbackend.registerAssessment(assessmentId, secure);\n\t\t\tthis.#backend = backend;\n\t\t\tthis.#initSession = { assessmentId, candidateId };\n\n\t\t\tthis.dispatchEvent(new CustomEvent('load-end', { bubbles: true, composed: true }));\n\n\t\t\t// Allow mounting now that backend is ready\n\t\t\tthis.#allowMount = true;\n\t\t\tthis._mountOrUpdate();\n\t\t} catch (e) {\n\t\t\tif (seq !== this.#loadSeq) return;\n\t\t\t// Keep current backend/initSession; component will display error.\n\t\t\tthis.dispatchEvent(\n\t\t\t\tnew CustomEvent('load-error', {\n\t\t\t\t\tdetail: { message: e instanceof Error ? e.message : String(e) },\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true,\n\t\t\t\t}),\n\t\t\t);\n\t\t\tthis._mountOrUpdate(); // Mount/update even on error (will show fallback)\n\t\t}\n\t}\n\n\t#toSecureAssessment(parsed: ParsedAssessmentTest, role: BackendAssessmentPlayerConfig['role']): SecureAssessment {\n\t\tconst testParts = parsed.testParts ?? [];\n\t\tconst first = testParts[0];\n\n\t\tif (!first) {\n\t\t\treturn {\n\t\t\t\tidentifier: parsed.identifier ?? 'assessment',\n\t\t\t\ttitle: parsed.title ?? 'Assessment',\n\t\t\t\tnavigationMode: 'nonlinear',\n\t\t\t\tsubmissionMode: 'simultaneous',\n\t\t\t\ttestParts: [],\n\t\t\t};\n\t\t}\n\n\t\tconst flattenSections = (roots: ParsedAssessmentSection[]): ParsedAssessmentSection[] => {\n\t\t\tconst out: ParsedAssessmentSection[] = [];\n\t\t\tconst stack = [...roots].reverse();\n\t\t\twhile (stack.length) {\n\t\t\t\tconst s = stack.pop()!;\n\t\t\t\tout.push(s);\n\t\t\t\tif (s.sections && s.sections.length) {\n\t\t\t\t\t// depth-first, preserve original order\n\t\t\t\t\tfor (const child of [...s.sections].reverse()) stack.push(child);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn out;\n\t\t};\n\n\t\tconst mapSection = (s: ParsedAssessmentSection) => {\n\t\t\tconst items =\n\t\t\t\ts.assessmentItemRefs?.map((q) => {\n\t\t\t\t\tif (!q.itemXml) {\n\t\t\t\t\t\tthrow new Error(`Missing itemXml for item \"${q.identifier}\" (provide items-json or item-base-url).`);\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tidentifier: q.identifier,\n\t\t\t\t\t\titemXml: q.itemXml,\n\t\t\t\t\t\trole: role ?? 'candidate',\n\t\t\t\t\t\trequired: q.required,\n\t\t\t\t\t};\n\t\t\t\t}) ?? [];\n\n\t\t\treturn {\n\t\t\t\tidentifier: s.identifier,\n\t\t\t\ttitle: s.title,\n\t\t\t\tvisible: s.visible ?? true,\n\t\t\t\tassessmentItemRefs: items,\n\t\t\t\trubricBlocks: s.rubricBlocks,\n\t\t\t};\n\t\t};\n\n\t\treturn {\n\t\t\tidentifier: parsed.identifier ?? 'assessment',\n\t\t\ttitle: parsed.title ?? 'Assessment',\n\t\t\tnavigationMode: first.navigationMode ?? 'nonlinear',\n\t\t\tsubmissionMode: first.submissionMode ?? 'simultaneous',\n\t\t\ttestParts: testParts.map((p) => ({\n\t\t\t\tidentifier: p.identifier,\n\t\t\t\tsections: flattenSections(p.sections).map(mapSection),\n\t\t\t})),\n\t\t};\n\t}\n\n\tgetProps() {\n\t\t// Ensure we never expose callback-style config as the public API.\n\t\t// Consumers should listen to DOM events instead.\n\t\tconst baseConfig: Partial<BackendAssessmentPlayerConfig> = {\n\t\t\t...this.#config,\n\t\t\tsecurity: this.#security,\n\t\t\tonItemChange: (itemIndex: number, totalItems: number) => {\n\t\t\t\tconst detail: QtiAssessmentItemChangeDetail = { itemIndex, totalItems };\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent<QtiAssessmentItemChangeDetail>('item-change', {\n\t\t\t\t\t\tdetail,\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t},\n\t\t\tonSectionChange: (sectionIndex: number, totalSections: number) => {\n\t\t\t\tconst detail: QtiAssessmentSectionChangeDetail = { sectionIndex, totalSections };\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent<QtiAssessmentSectionChangeDetail>('section-change', {\n\t\t\t\t\t\tdetail,\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t},\n\t\t\tonResponseChange: (responses: Record<string, unknown>) => {\n\t\t\t\tconst detail: QtiAssessmentResponseChangeDetail = { responses: { ...responses } };\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent<QtiAssessmentResponseChangeDetail>('response-change', {\n\t\t\t\t\t\tdetail,\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t},\n\t\t\tonComplete: () => {\n\t\t\t\tthis.dispatchEvent(new CustomEvent('complete', { bubbles: true, composed: true }));\n\t\t\t},\n\t\t};\n\n\t\tconst props: any = {\n\t\t\tbackend: this.#backend,\n\t\t\tinitSession: this.#initSession,\n\t\t\tconfig: baseConfig,\n\t\t\tonSubmit: (results: AssessmentResults) => {\n\t\t\t\tconst detail: QtiAssessmentSubmitDetail = { results };\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent<QtiAssessmentSubmitDetail>('submit', {\n\t\t\t\t\t\tdetail,\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t\t// Don't pass typeset at all if not provided (passing undefined can cause issues)\n\t\treturn props;\n\t}\n}\n\nexport function defineQtiAssessmentPlayerElement() {\n\tif (!customElements.get(QTI_ASSESSMENT_PLAYER_TAG)) {\n\t\tcustomElements.define(QTI_ASSESSMENT_PLAYER_TAG, QtiAssessmentPlayerElement);\n\t}\n}\n\n\n","import { QTI_ITEM_PLAYER_TAG } from '../constants.js';\nimport '@pie-qti/item-player/element';\nexport { PieQtiItemPlayerElement as QtiItemPlayerElement } from '@pie-qti/item-player/element';\n\nexport type QtiItemPlayerResponseChangeDetail = {\n\tresponseId: string;\n\tvalue: unknown;\n\tresponses: Record<string, unknown>;\n};\n\nexport function defineQtiItemPlayerElement() {\n\tif (!customElements.get(QTI_ITEM_PLAYER_TAG)) {\n\t\tthrow new Error('@pie-qti/item-player/element did not register <pie-qti-item-player>.');\n\t}\n}\n\n\n","import { defineQtiAssessmentPlayerElement } from './elements/QtiAssessmentPlayerElement.js';\nimport { defineQtiItemPlayerElement } from './elements/QtiItemPlayerElement.js';\n\nexport function defineQtiPlayerElements() {\n\tdefineQtiItemPlayerElement();\n\tdefineQtiAssessmentPlayerElement();\n}\n\n\n"],"x_google_ignoreList":[42,43,44,45,46,47,48,49,50,51,52,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305],"mappings":";;AAAA,IAAa,KAAsB,uBACtB,KAA4B,6BCMnC,KAAiC;CACnC,mBAAmB;EAAE,MAAM;EAAkB,SAAS;EAAkB;CACxE,mBAAmB;EAAE,MAAM;EAAkB,SAAS;EAAkB;CACxE,kBAAkB;EAAE,MAAM;EAAiB,SAAS;EAAiB;CACrE,kBAAkB;EAAE,MAAM;EAAiB,SAAS;EAAiB;CACrE,sBAAsB;EAAE,MAAM;EAAqB,SAAS;EAAqB;CACjF,qBAAq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