@pie-qti/item-player 0.1.7 → 0.1.9
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/core/sanitizer.d.ts.map +1 -1
- package/dist/core/sanitizer.js +60 -0
- package/dist/document/AssessmentItemDocument.d.ts +4 -0
- package/dist/document/AssessmentItemDocument.d.ts.map +1 -1
- package/dist/document/AssessmentItemDocument.js +53 -4
- package/dist/element.js +381 -306
- package/dist/element.js.map +1 -1
- package/dist/interactions/extended-text/extractor.d.ts +1 -0
- package/dist/interactions/extended-text/extractor.d.ts.map +1 -1
- package/dist/interactions/extended-text/extractor.js +2 -0
- package/dist/interactions/shared/types.d.ts +1 -0
- package/dist/interactions/shared/types.d.ts.map +1 -1
- package/package.json +13 -8
- package/src/core/sanitizer.ts +70 -0
- package/src/document/AssessmentItemDocument.ts +76 -7
- package/src/interactions/extended-text/extractor.ts +3 -0
- package/src/interactions/shared/types.ts +1 -0
package/dist/element.js
CHANGED
|
@@ -2478,6 +2478,7 @@ var ro = {
|
|
|
2478
2478
|
return {
|
|
2479
2479
|
expectedLines: r,
|
|
2480
2480
|
expectedLength: i,
|
|
2481
|
+
prompt: n.getPrompt(e),
|
|
2481
2482
|
placeholderText: a,
|
|
2482
2483
|
format: o,
|
|
2483
2484
|
...s ? { patternMask: s } : {},
|
|
@@ -2901,10 +2902,17 @@ function Co(e) {
|
|
|
2901
2902
|
function wo(e) {
|
|
2902
2903
|
return e?.security?.allowIframes === !0;
|
|
2903
2904
|
}
|
|
2904
|
-
function To(e
|
|
2905
|
-
return
|
|
2905
|
+
function To(e) {
|
|
2906
|
+
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
2906
2907
|
}
|
|
2907
2908
|
function Eo(e, t) {
|
|
2909
|
+
let n = e.getAttribute(t);
|
|
2910
|
+
return n ? ` ${t}="${To(n)}"` : "";
|
|
2911
|
+
}
|
|
2912
|
+
function Do(e, t, n) {
|
|
2913
|
+
return bo(e, t, n) ?? "#";
|
|
2914
|
+
}
|
|
2915
|
+
function Oo(e, t) {
|
|
2908
2916
|
let n = e.split(",").map((e) => e.trim()).filter(Boolean), r = [];
|
|
2909
2917
|
for (let e of n) {
|
|
2910
2918
|
let n = e.split(/\s+/).filter(Boolean);
|
|
@@ -2914,7 +2922,7 @@ function Eo(e, t) {
|
|
|
2914
2922
|
}
|
|
2915
2923
|
return r.join(", ");
|
|
2916
2924
|
}
|
|
2917
|
-
function
|
|
2925
|
+
function ko(e, t, n, r) {
|
|
2918
2926
|
if (n.enabled) {
|
|
2919
2927
|
if (r > n.maxDepth) throw new xo(`HTML depth exceeds maxHtmlDepth (${r} > ${n.maxDepth})`);
|
|
2920
2928
|
if (n.nodes++, n.nodes > n.maxNodes) throw new xo(`HTML node count exceeds maxHtmlNodes (${n.nodes} > ${n.maxNodes})`);
|
|
@@ -2929,6 +2937,11 @@ function Do(e, t, n, r) {
|
|
|
2929
2937
|
return;
|
|
2930
2938
|
}
|
|
2931
2939
|
if ((i === "object" || i === "embed") && !Co(t)) {
|
|
2940
|
+
let n = Mo(e, So(t));
|
|
2941
|
+
if (n) {
|
|
2942
|
+
e.replaceWith(n);
|
|
2943
|
+
return;
|
|
2944
|
+
}
|
|
2932
2945
|
e.remove();
|
|
2933
2946
|
return;
|
|
2934
2947
|
}
|
|
@@ -2947,20 +2960,20 @@ function Do(e, t, n, r) {
|
|
|
2947
2960
|
continue;
|
|
2948
2961
|
}
|
|
2949
2962
|
if (n === "srcset") {
|
|
2950
|
-
let n =
|
|
2963
|
+
let n = Oo(r, o);
|
|
2951
2964
|
n ? n !== r && e.setAttribute(t, n) : e.removeAttribute(t);
|
|
2952
2965
|
continue;
|
|
2953
2966
|
}
|
|
2954
2967
|
if (n === "href" || n === "xlink:href" || n === "src" || n === "data" || n === "action" || n === "formaction" || n === "poster") {
|
|
2955
|
-
let n =
|
|
2968
|
+
let n = Do(r, o, i === "img" ? "img" : i === "audio" || i === "video" || i === "source" ? "media" : i === "object" || i === "embed" ? "object" : i === "a" ? "link" : "any");
|
|
2956
2969
|
n !== r && e.setAttribute(t, n);
|
|
2957
2970
|
}
|
|
2958
2971
|
}
|
|
2959
2972
|
}
|
|
2960
2973
|
let s = e.childNodes.filter((e) => e.rawTagName);
|
|
2961
|
-
for (let e of s)
|
|
2974
|
+
for (let e of s) ko(e, t, n, r + 1);
|
|
2962
2975
|
}
|
|
2963
|
-
function
|
|
2976
|
+
function Ao(e, t) {
|
|
2964
2977
|
if (!e || typeof e != "string") return "";
|
|
2965
2978
|
try {
|
|
2966
2979
|
let n = to(t?.security);
|
|
@@ -2974,18 +2987,41 @@ function Oo(e, t) {
|
|
|
2974
2987
|
maxNodes: n.maxHtmlNodes,
|
|
2975
2988
|
maxDepth: n.maxHtmlDepth
|
|
2976
2989
|
};
|
|
2977
|
-
for (let e of i)
|
|
2990
|
+
for (let e of i) ko(e, t, a, 1);
|
|
2978
2991
|
return r.toString();
|
|
2979
2992
|
} catch (e) {
|
|
2980
2993
|
return e instanceof xo || console.error("HTML sanitization failed:", e), "";
|
|
2981
2994
|
}
|
|
2982
2995
|
}
|
|
2983
|
-
function
|
|
2984
|
-
return !e || typeof e != "string" ? "" : /<[^>]+>/.test(e) ?
|
|
2996
|
+
function jo(e, t) {
|
|
2997
|
+
return !e || typeof e != "string" ? "" : /<[^>]+>/.test(e) ? Ao(e, t) : e;
|
|
2998
|
+
}
|
|
2999
|
+
function Mo(e, t) {
|
|
3000
|
+
if (e.rawTagName?.toLowerCase() !== "object") return null;
|
|
3001
|
+
let n = e.getAttribute("type")?.trim().toLowerCase() ?? "", r = e.getAttribute("data")?.trim() ?? "";
|
|
3002
|
+
if (!n || !r) return null;
|
|
3003
|
+
let i = `${Eo(e, "width")}${Eo(e, "height")}`, a = Eo(e, "class"), o = Eo(e, "id");
|
|
3004
|
+
if (n.startsWith("image/")) {
|
|
3005
|
+
let n = bo(r, t, "img");
|
|
3006
|
+
if (!n) return null;
|
|
3007
|
+
let s = e.getAttribute("aria-label") ?? e.getAttribute("title") ?? e.textContent?.trim() ?? "";
|
|
3008
|
+
return `<img src="${To(n)}" alt="${To(s)}"${i}${a}${o}>`;
|
|
3009
|
+
}
|
|
3010
|
+
if (n.startsWith("audio/")) {
|
|
3011
|
+
let e = bo(r, t, "media");
|
|
3012
|
+
return e ? `<audio controls${a}${o}><source src="${To(e)}" type="${To(n)}"></audio>` : null;
|
|
3013
|
+
}
|
|
3014
|
+
if (n.startsWith("video/")) {
|
|
3015
|
+
let s = bo(r, t, "media");
|
|
3016
|
+
if (!s) return null;
|
|
3017
|
+
let c = e.getAttribute("poster")?.trim() ?? "", l = c ? bo(c, t, "img") : null;
|
|
3018
|
+
return `<video controls${i}${a}${o}${l ? ` poster="${To(l)}"` : ""}><source src="${To(s)}" type="${To(n)}"></video>`;
|
|
3019
|
+
}
|
|
3020
|
+
return null;
|
|
2985
3021
|
}
|
|
2986
3022
|
//#endregion
|
|
2987
3023
|
//#region src/interactions/modules.ts
|
|
2988
|
-
var
|
|
3024
|
+
var No = [
|
|
2989
3025
|
{
|
|
2990
3026
|
type: "choiceInteraction",
|
|
2991
3027
|
extractor: io,
|
|
@@ -3403,7 +3439,7 @@ var Ao = [
|
|
|
3403
3439
|
};
|
|
3404
3440
|
}), a = n.getNumberAttribute(e, "maxChoices", 1), o = n.getNumberAttribute(e, "minChoices", 0), s = n.getClasses(e), c = n.getAttribute(e, "data-max-selections-message", "") || null, l = n.getAttribute(e, "data-min-selections-message", "") || null, u = n.getChildrenByTag(e, "prompt"), d = u.length > 0 ? n.getHtmlContent(u[0]) : null, f = "";
|
|
3405
3441
|
for (let t of e.childNodes) typeof t != "string" && t.rawTagName !== "prompt" && t.rawTagName !== "qti-prompt" ? f += t.outerHTML || t.toString() : typeof t == "string" && (f += t);
|
|
3406
|
-
return f =
|
|
3442
|
+
return f = Ao(f, { security: t.config.security }), {
|
|
3407
3443
|
hottextChoices: i,
|
|
3408
3444
|
contentHtml: f,
|
|
3409
3445
|
maxChoices: a,
|
|
@@ -3575,29 +3611,29 @@ var Ao = [
|
|
|
3575
3611
|
placement: "block"
|
|
3576
3612
|
}
|
|
3577
3613
|
];
|
|
3578
|
-
function
|
|
3579
|
-
return
|
|
3614
|
+
function Po() {
|
|
3615
|
+
return No.map((e) => e.extractor);
|
|
3580
3616
|
}
|
|
3581
|
-
var
|
|
3582
|
-
function
|
|
3617
|
+
var Fo = new Map(No.map((e) => [e.type.toLowerCase(), e.type]));
|
|
3618
|
+
function Io(e) {
|
|
3583
3619
|
let t = e.toLowerCase();
|
|
3584
|
-
return t.startsWith("qti-") ? t.slice(4).replace(/-([a-z])/g, (e, t) => t.toUpperCase()) :
|
|
3620
|
+
return t.startsWith("qti-") ? t.slice(4).replace(/-([a-z])/g, (e, t) => t.toUpperCase()) : Fo.get(t) ?? e;
|
|
3585
3621
|
}
|
|
3586
|
-
function
|
|
3587
|
-
let t =
|
|
3588
|
-
return
|
|
3622
|
+
function Lo(e) {
|
|
3623
|
+
let t = Io(e);
|
|
3624
|
+
return No.find((e) => e.type === t) ?? null;
|
|
3589
3625
|
}
|
|
3590
|
-
function
|
|
3591
|
-
return
|
|
3626
|
+
function Ro(e) {
|
|
3627
|
+
return Lo(e)?.placement === "inline";
|
|
3592
3628
|
}
|
|
3593
|
-
function
|
|
3594
|
-
return
|
|
3629
|
+
function zo(e) {
|
|
3630
|
+
return Ro(Io(e));
|
|
3595
3631
|
}
|
|
3596
3632
|
//#endregion
|
|
3597
3633
|
//#region src/document/AssessmentItemDocument.ts
|
|
3598
|
-
var
|
|
3634
|
+
var Bo = class {
|
|
3599
3635
|
constructor({ itemXml: e, elementNameMapper: t, attributeNameMapper: n, security: r }) {
|
|
3600
|
-
this.extractionDocument = null, this.extractionRoot = null, this.itemXml = e, this.security = r, this.elementNameMapper = t, this.attributeNameMapper = n, no(this.itemXml, this.security), this.xmlDocument = p(this.itemXml), this.assessmentItem = l(this.xmlDocument);
|
|
3636
|
+
this.extractionDocument = null, this.extractionRoot = null, this.itemXml = e, this.security = r, this.mathMlPrefixes = Uo(e), this.elementNameMapper = t, this.attributeNameMapper = n, no(this.itemXml, this.security), this.xmlDocument = p(this.itemXml), this.assessmentItem = l(this.xmlDocument);
|
|
3601
3637
|
}
|
|
3602
3638
|
getAssessmentItem() {
|
|
3603
3639
|
return this.assessmentItem;
|
|
@@ -3607,7 +3643,7 @@ var Lo = class {
|
|
|
3607
3643
|
return d(this.assessmentItem, this.elementNameMapper.toNative(t));
|
|
3608
3644
|
}
|
|
3609
3645
|
serializeItemBodyChildren() {
|
|
3610
|
-
let e =
|
|
3646
|
+
let e = this.getItemBodyElement();
|
|
3611
3647
|
return e ? this.serializeChildren(e) : "";
|
|
3612
3648
|
}
|
|
3613
3649
|
findRubricElements() {
|
|
@@ -3624,7 +3660,7 @@ var Lo = class {
|
|
|
3624
3660
|
return this.assessmentItem.getAttribute(this.attributeNameMapper.toNative(e));
|
|
3625
3661
|
}
|
|
3626
3662
|
serializeChildren(e) {
|
|
3627
|
-
return
|
|
3663
|
+
return Wo(Ho(this.serializeChildNodes(e)), this.mathMlPrefixes);
|
|
3628
3664
|
}
|
|
3629
3665
|
findExtractionElements(e) {
|
|
3630
3666
|
let t = this.getExtractionRoot();
|
|
@@ -3638,7 +3674,7 @@ var Lo = class {
|
|
|
3638
3674
|
element: e,
|
|
3639
3675
|
contextRoot: t,
|
|
3640
3676
|
responseIdentifier: a,
|
|
3641
|
-
normalizedType:
|
|
3677
|
+
normalizedType: Io(i)
|
|
3642
3678
|
});
|
|
3643
3679
|
}), r;
|
|
3644
3680
|
}
|
|
@@ -3648,11 +3684,28 @@ var Lo = class {
|
|
|
3648
3684
|
return this.extractionRoot = e.querySelector?.(t) ?? null, this.extractionRoot;
|
|
3649
3685
|
}
|
|
3650
3686
|
getExtractionDocument() {
|
|
3651
|
-
return this.extractionDocument || (no(this.itemXml, this.security), this.extractionDocument = ie(this.
|
|
3687
|
+
return this.extractionDocument || (no(this.itemXml, this.security), this.extractionDocument = ie(this.serializeItemBodyForExtraction(), {
|
|
3652
3688
|
lowerCaseTagName: !1,
|
|
3653
3689
|
comment: !1
|
|
3654
3690
|
})), this.extractionDocument;
|
|
3655
3691
|
}
|
|
3692
|
+
getItemBodyElement() {
|
|
3693
|
+
return d(this.assessmentItem, this.elementNameMapper.toNative("itembody"));
|
|
3694
|
+
}
|
|
3695
|
+
serializeItemBodyForExtraction() {
|
|
3696
|
+
let e = this.elementNameMapper.toNative("itembody"), t = this.getItemBodyElement();
|
|
3697
|
+
return `<assessmentItem><${e}>${t ? this.serializeChildren(t) : ""}</${e}></assessmentItem>`;
|
|
3698
|
+
}
|
|
3699
|
+
serializeChildNodes(e) {
|
|
3700
|
+
let t = e.childNodes;
|
|
3701
|
+
if (!t) return "";
|
|
3702
|
+
let n = [];
|
|
3703
|
+
for (let e = 0; e < t.length; e++) {
|
|
3704
|
+
let r = t[e];
|
|
3705
|
+
r && n.push(g(r));
|
|
3706
|
+
}
|
|
3707
|
+
return n.join("");
|
|
3708
|
+
}
|
|
3656
3709
|
walkExtractionChildren(e, t) {
|
|
3657
3710
|
for (let n of e.childNodes ?? []) {
|
|
3658
3711
|
let e = n;
|
|
@@ -3664,16 +3717,38 @@ var Lo = class {
|
|
|
3664
3717
|
return e.getAttribute?.("responseIdentifier") || e.getAttribute?.(t) || e.getAttribute?.("response-identifier") || e.getAttribute?.("responseidentifier") || "";
|
|
3665
3718
|
}
|
|
3666
3719
|
};
|
|
3667
|
-
function
|
|
3668
|
-
return new
|
|
3720
|
+
function Vo(e) {
|
|
3721
|
+
return new Bo(e);
|
|
3722
|
+
}
|
|
3723
|
+
function Ho(e) {
|
|
3724
|
+
return e.replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g, (e, t) => t);
|
|
3725
|
+
}
|
|
3726
|
+
function Uo(e) {
|
|
3727
|
+
let t = /* @__PURE__ */ new Set();
|
|
3728
|
+
for (let n of e.matchAll(/\sxmlns:([A-Za-z_][\w.-]*)=(["'])http:\/\/www\.w3\.org\/1998\/Math\/MathML\2/g)) {
|
|
3729
|
+
let e = n[1];
|
|
3730
|
+
e && t.add(e);
|
|
3731
|
+
}
|
|
3732
|
+
return t;
|
|
3733
|
+
}
|
|
3734
|
+
function Wo(e, t) {
|
|
3735
|
+
let n = e;
|
|
3736
|
+
for (let e of t) {
|
|
3737
|
+
let t = Go(e);
|
|
3738
|
+
n = n.replace(RegExp(`(<\\/?)${t}:([A-Za-z][\\w.-]*)(?=[\\s>/])`, "g"), "$1$2").replace(RegExp(`\\sxmlns:${t}=(["'])http:\\/\\/www\\.w3\\.org\\/1998\\/Math\\/MathML\\1`, "g"), "");
|
|
3739
|
+
}
|
|
3740
|
+
return n;
|
|
3741
|
+
}
|
|
3742
|
+
function Go(e) {
|
|
3743
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3669
3744
|
}
|
|
3670
3745
|
//#endregion
|
|
3671
3746
|
//#region src/extraction/types.ts
|
|
3672
|
-
var
|
|
3747
|
+
var Ko = class extends Error {
|
|
3673
3748
|
constructor(e, t, n, r) {
|
|
3674
3749
|
super(e), this.extractorId = t, this.elementType = n, this.cause = r, this.name = "ExtractionError";
|
|
3675
3750
|
}
|
|
3676
|
-
},
|
|
3751
|
+
}, qo = class e {
|
|
3677
3752
|
constructor(e) {
|
|
3678
3753
|
this.extractorsById = /* @__PURE__ */ new Map(), this.extractorsByType = /* @__PURE__ */ new Map(), this.extractorCache = /* @__PURE__ */ new WeakMap(), this.qti2xMapper = new ee(), this.elementNameMapper = e;
|
|
3679
3754
|
}
|
|
@@ -3722,7 +3797,7 @@ var zo = class extends Error {
|
|
|
3722
3797
|
let t = e.rawTagName || "unknown";
|
|
3723
3798
|
return {
|
|
3724
3799
|
success: !1,
|
|
3725
|
-
error: new
|
|
3800
|
+
error: new Ko(`No extractor available for element '${t}'. Registered types: ${Array.from(this.extractorsByType.keys()).join(", ")}`, "none", t)
|
|
3726
3801
|
};
|
|
3727
3802
|
}
|
|
3728
3803
|
try {
|
|
@@ -3731,7 +3806,7 @@ var zo = class extends Error {
|
|
|
3731
3806
|
let t = n.validate(r);
|
|
3732
3807
|
if (!t.valid) return {
|
|
3733
3808
|
success: !1,
|
|
3734
|
-
error: new
|
|
3809
|
+
error: new Ko(`Validation failed for extractor '${n.id}': ${t.errors?.join(", ")}`, n.id, e.rawTagName || "unknown")
|
|
3735
3810
|
};
|
|
3736
3811
|
if (t.warnings && t.warnings.length > 0) return {
|
|
3737
3812
|
success: !0,
|
|
@@ -3747,7 +3822,7 @@ var zo = class extends Error {
|
|
|
3747
3822
|
let r = e.rawTagName || "unknown";
|
|
3748
3823
|
return {
|
|
3749
3824
|
success: !1,
|
|
3750
|
-
error: t instanceof
|
|
3825
|
+
error: t instanceof Ko ? t : new Ko(`Extraction failed for '${r}': ${t instanceof Error ? t.message : String(t)}`, n.id, r, t instanceof Error ? t : void 0)
|
|
3751
3826
|
};
|
|
3752
3827
|
}
|
|
3753
3828
|
}
|
|
@@ -3771,21 +3846,21 @@ var zo = class extends Error {
|
|
|
3771
3846
|
return t;
|
|
3772
3847
|
}
|
|
3773
3848
|
};
|
|
3774
|
-
function
|
|
3775
|
-
return new
|
|
3849
|
+
function Jo(e) {
|
|
3850
|
+
return new qo(e);
|
|
3776
3851
|
}
|
|
3777
3852
|
//#endregion
|
|
3778
3853
|
//#region src/extraction/utils.ts
|
|
3779
|
-
function
|
|
3854
|
+
function Yo(e) {
|
|
3780
3855
|
return e?.textContent?.trim() || "";
|
|
3781
3856
|
}
|
|
3782
|
-
function
|
|
3783
|
-
return
|
|
3857
|
+
function Xo(e) {
|
|
3858
|
+
return jo(e?.innerHTML?.trim() || "");
|
|
3784
3859
|
}
|
|
3785
|
-
function
|
|
3786
|
-
return e?.childNodes ? e.childNodes.filter((e) =>
|
|
3860
|
+
function Zo(e, t, n) {
|
|
3861
|
+
return e?.childNodes ? e.childNodes.filter((e) => ns(e.rawTagName, t, n)) : [];
|
|
3787
3862
|
}
|
|
3788
|
-
function
|
|
3863
|
+
function Qo(e, t, n = !1, r) {
|
|
3789
3864
|
let i = e.getAttribute(t);
|
|
3790
3865
|
if (i == null && r) {
|
|
3791
3866
|
let n = r.toNative(t);
|
|
@@ -3793,7 +3868,7 @@ function Go(e, t, n = !1, r) {
|
|
|
3793
3868
|
}
|
|
3794
3869
|
return i == null ? n : i === "true";
|
|
3795
3870
|
}
|
|
3796
|
-
function
|
|
3871
|
+
function $o(e, t, n, r) {
|
|
3797
3872
|
let i = e.getAttribute(t);
|
|
3798
3873
|
if (i == null && r) {
|
|
3799
3874
|
let n = r.toNative(t);
|
|
@@ -3801,7 +3876,7 @@ function Ko(e, t, n, r) {
|
|
|
3801
3876
|
}
|
|
3802
3877
|
return i ? Number(i) : n;
|
|
3803
3878
|
}
|
|
3804
|
-
function
|
|
3879
|
+
function es(e, t, n = "", r) {
|
|
3805
3880
|
let i = e.getAttribute(t);
|
|
3806
3881
|
if (i == null && r) {
|
|
3807
3882
|
let n = r.toNative(t);
|
|
@@ -3809,26 +3884,26 @@ function qo(e, t, n = "", r) {
|
|
|
3809
3884
|
}
|
|
3810
3885
|
return i || n;
|
|
3811
3886
|
}
|
|
3812
|
-
function
|
|
3887
|
+
function ts(e) {
|
|
3813
3888
|
let t = e.getAttribute("class");
|
|
3814
3889
|
return t ? t.split(/\s+/).filter(Boolean) : [];
|
|
3815
3890
|
}
|
|
3816
|
-
function
|
|
3891
|
+
function ns(e, t, n) {
|
|
3817
3892
|
if (!e) return !1;
|
|
3818
3893
|
let r = t.toLowerCase(), i = n.toNative(r);
|
|
3819
3894
|
return e.toLowerCase() === i.toLowerCase();
|
|
3820
3895
|
}
|
|
3821
|
-
function
|
|
3896
|
+
function rs(e, t, n) {
|
|
3822
3897
|
let r = t || new ee(), i = n || new b();
|
|
3823
3898
|
return {
|
|
3824
3899
|
getChildrenByTag(e, t) {
|
|
3825
|
-
return
|
|
3900
|
+
return Zo(e, t, r);
|
|
3826
3901
|
},
|
|
3827
3902
|
querySelectorAll(e, t) {
|
|
3828
3903
|
let n = t.split(/\s+/), i = [e];
|
|
3829
3904
|
for (let e of n) {
|
|
3830
3905
|
let t = [];
|
|
3831
|
-
for (let n of i) if (
|
|
3906
|
+
for (let n of i) if (ns(n.rawTagName, e, r) && t.push(n), n.childNodes) for (let i of n.childNodes) typeof i != "string" && ns(i.rawTagName, e, r) && t.push(i);
|
|
3832
3907
|
i = t;
|
|
3833
3908
|
}
|
|
3834
3909
|
return i;
|
|
@@ -3839,68 +3914,68 @@ function Xo(e, t, n) {
|
|
|
3839
3914
|
},
|
|
3840
3915
|
hasChildWithTag(e, t) {
|
|
3841
3916
|
if (!e.childNodes) return !1;
|
|
3842
|
-
for (let n of e.childNodes) if (typeof n != "string" &&
|
|
3917
|
+
for (let n of e.childNodes) if (typeof n != "string" && ns(n.rawTagName, t, r)) return !0;
|
|
3843
3918
|
return !1;
|
|
3844
3919
|
},
|
|
3845
3920
|
getHtmlContent(t) {
|
|
3846
|
-
return
|
|
3921
|
+
return jo(t?.innerHTML?.trim() || "", { security: e });
|
|
3847
3922
|
},
|
|
3848
3923
|
getTextContent(e) {
|
|
3849
|
-
return
|
|
3924
|
+
return Yo(e);
|
|
3850
3925
|
},
|
|
3851
3926
|
getAttribute(e, t, n = "") {
|
|
3852
|
-
return
|
|
3927
|
+
return es(e, t, n, i);
|
|
3853
3928
|
},
|
|
3854
3929
|
getBooleanAttribute(e, t, n = !1) {
|
|
3855
|
-
return
|
|
3930
|
+
return Qo(e, t, n, i);
|
|
3856
3931
|
},
|
|
3857
3932
|
getNumberAttribute(e, t, n = 0) {
|
|
3858
|
-
return
|
|
3933
|
+
return $o(e, t, n, i);
|
|
3859
3934
|
},
|
|
3860
3935
|
getPrompt(e) {
|
|
3861
|
-
let t =
|
|
3862
|
-
return t ?
|
|
3936
|
+
let t = Zo(e, "prompt", r)[0];
|
|
3937
|
+
return t ? Xo(t) : null;
|
|
3863
3938
|
},
|
|
3864
3939
|
getClasses(e) {
|
|
3865
|
-
return
|
|
3940
|
+
return ts(e);
|
|
3866
3941
|
}
|
|
3867
3942
|
};
|
|
3868
3943
|
}
|
|
3869
3944
|
//#endregion
|
|
3870
3945
|
//#region src/extraction/createContext.ts
|
|
3871
|
-
function
|
|
3946
|
+
function is(e, t, n, r, i) {
|
|
3872
3947
|
let a = i.elementNameMapper, o = i.attributeNameMapper;
|
|
3873
3948
|
return {
|
|
3874
3949
|
element: e,
|
|
3875
3950
|
responseId: t,
|
|
3876
3951
|
dom: n,
|
|
3877
3952
|
declarations: r,
|
|
3878
|
-
utils:
|
|
3953
|
+
utils: rs(i.security, a, o),
|
|
3879
3954
|
config: i
|
|
3880
3955
|
};
|
|
3881
3956
|
}
|
|
3882
3957
|
//#endregion
|
|
3883
3958
|
//#region src/core/trustedTypes.ts
|
|
3884
|
-
function
|
|
3959
|
+
function as() {
|
|
3885
3960
|
return globalThis.trustedTypes;
|
|
3886
3961
|
}
|
|
3887
|
-
var
|
|
3888
|
-
function
|
|
3889
|
-
let t =
|
|
3962
|
+
var os = /* @__PURE__ */ new Map();
|
|
3963
|
+
function ss(e) {
|
|
3964
|
+
let t = os.get(e);
|
|
3890
3965
|
if (t) return t;
|
|
3891
|
-
let n =
|
|
3966
|
+
let n = as();
|
|
3892
3967
|
if (!n?.createPolicy) return null;
|
|
3893
3968
|
try {
|
|
3894
3969
|
let t = n.createPolicy(e, { createHTML: (e) => e });
|
|
3895
|
-
return t?.createHTML ? (
|
|
3970
|
+
return t?.createHTML ? (os.set(e, t), t) : null;
|
|
3896
3971
|
} catch {
|
|
3897
3972
|
return null;
|
|
3898
3973
|
}
|
|
3899
3974
|
}
|
|
3900
|
-
function
|
|
3975
|
+
function cs(e, t) {
|
|
3901
3976
|
if (!t) return e;
|
|
3902
3977
|
if (!e) return "";
|
|
3903
|
-
let n =
|
|
3978
|
+
let n = ss(t);
|
|
3904
3979
|
if (!n) return e;
|
|
3905
3980
|
try {
|
|
3906
3981
|
return n.createHTML(e);
|
|
@@ -3910,39 +3985,39 @@ function ts(e, t) {
|
|
|
3910
3985
|
}
|
|
3911
3986
|
//#endregion
|
|
3912
3987
|
//#region src/extraction/interactionSecurity.ts
|
|
3913
|
-
function
|
|
3988
|
+
function ls(e, t) {
|
|
3914
3989
|
let n = t?.urlPolicy, r = t?.allowObjectEmbeds === !0, i = t?.trustedTypesPolicyName;
|
|
3915
3990
|
for (let t of e) {
|
|
3916
|
-
if (t.type === "choiceInteraction" && Array.isArray(t.choices)) for (let e of t.choices) typeof e?.text == "string" && (e.text =
|
|
3917
|
-
if (t.imageData?.src && (t.imageData.src = bo(t.imageData.src, n, "img") ?? ""), t.imageData?.content && typeof t.imageData.content == "string" && (t.imageData.content =
|
|
3991
|
+
if (t.type === "choiceInteraction" && Array.isArray(t.choices)) for (let e of t.choices) typeof e?.text == "string" && (e.text = cs(e.text, i));
|
|
3992
|
+
if (t.imageData?.src && (t.imageData.src = bo(t.imageData.src, n, "img") ?? ""), t.imageData?.content && typeof t.imageData.content == "string" && (t.imageData.content = cs(t.imageData.content, i)), Array.isArray(t.positionObjectStages)) for (let e of t.positionObjectStages) e?.objectData?.src && (e.objectData.src = bo(e.objectData.src, n, "img") ?? ""), e?.objectData?.content && typeof e.objectData.content == "string" && (e.objectData.content = cs(e.objectData.content, i));
|
|
3918
3993
|
if (t.type === "mediaInteraction" && t.mediaElement?.src) {
|
|
3919
3994
|
let e = t.mediaElement.type === "object" ? "object" : "media";
|
|
3920
3995
|
t.mediaElement.src = bo(t.mediaElement.src, n, e) ?? "", t.allowObjectEmbeds = r;
|
|
3921
3996
|
}
|
|
3922
|
-
t.type === "hottextInteraction" && typeof t.contentHtml == "string" && (t.contentHtml =
|
|
3997
|
+
t.type === "hottextInteraction" && typeof t.contentHtml == "string" && (t.contentHtml = cs(t.contentHtml, i));
|
|
3923
3998
|
}
|
|
3924
3999
|
return e;
|
|
3925
4000
|
}
|
|
3926
4001
|
//#endregion
|
|
3927
4002
|
//#region src/extraction/interactionExtractionPipeline.ts
|
|
3928
|
-
function
|
|
3929
|
-
let i =
|
|
4003
|
+
function us({ document: e, extractionRegistry: t, declarations: n, config: r }) {
|
|
4004
|
+
let i = fs(n), a = e.findExtractionElements(ds(t)), o = [];
|
|
3930
4005
|
for (let e of a) {
|
|
3931
|
-
let n =
|
|
4006
|
+
let n = is(e.element, e.responseIdentifier, e.contextRoot, i, r), a = t.extract(e.element, n);
|
|
3932
4007
|
a.success && o.push({
|
|
3933
4008
|
type: e.normalizedType,
|
|
3934
4009
|
responseId: e.responseIdentifier,
|
|
3935
4010
|
...a.data
|
|
3936
4011
|
});
|
|
3937
4012
|
}
|
|
3938
|
-
return
|
|
4013
|
+
return ls(o, r.security);
|
|
3939
4014
|
}
|
|
3940
|
-
function
|
|
4015
|
+
function ds(e) {
|
|
3941
4016
|
let t = /* @__PURE__ */ new Set();
|
|
3942
4017
|
for (let n of e.getExtractors()) for (let e of n.elementTypes) t.add(e);
|
|
3943
4018
|
return [...t];
|
|
3944
4019
|
}
|
|
3945
|
-
function
|
|
4020
|
+
function fs(e) {
|
|
3946
4021
|
let t = /* @__PURE__ */ new Map();
|
|
3947
4022
|
for (let n of Object.values(e)) t.set(n.identifier, {
|
|
3948
4023
|
identifier: n.identifier,
|
|
@@ -3953,7 +4028,7 @@ function as(e) {
|
|
|
3953
4028
|
}
|
|
3954
4029
|
//#endregion
|
|
3955
4030
|
//#region src/core/ComponentRegistry.ts
|
|
3956
|
-
var
|
|
4031
|
+
var ps = class {
|
|
3957
4032
|
constructor() {
|
|
3958
4033
|
this.components = /* @__PURE__ */ new Map(), this.definedElements = /* @__PURE__ */ new Set();
|
|
3959
4034
|
}
|
|
@@ -3995,12 +4070,12 @@ var os = class {
|
|
|
3995
4070
|
return !t || t.length === 0 ? null : t[0].config.tagName;
|
|
3996
4071
|
}
|
|
3997
4072
|
};
|
|
3998
|
-
function
|
|
3999
|
-
return new
|
|
4073
|
+
function ms() {
|
|
4074
|
+
return new ps();
|
|
4000
4075
|
}
|
|
4001
4076
|
//#endregion
|
|
4002
4077
|
//#region src/core/random.ts
|
|
4003
|
-
function
|
|
4078
|
+
function hs(e) {
|
|
4004
4079
|
let t = e >>> 0;
|
|
4005
4080
|
return () => {
|
|
4006
4081
|
t = t + 1831565813 >>> 0;
|
|
@@ -4010,30 +4085,30 @@ function cs(e) {
|
|
|
4010
4085
|
}
|
|
4011
4086
|
//#endregion
|
|
4012
4087
|
//#region src/pnp/applyPnp.ts
|
|
4013
|
-
var
|
|
4014
|
-
function
|
|
4088
|
+
var gs = "data-qti-colorscheme", _s = "data-qti-magnification";
|
|
4089
|
+
function vs(e, t) {
|
|
4015
4090
|
let n = t?.display?.colorScheme;
|
|
4016
|
-
!n || n === "default" ? e.removeAttribute(
|
|
4091
|
+
!n || n === "default" ? e.removeAttribute(gs) : e.setAttribute(gs, n);
|
|
4017
4092
|
let r = t?.display?.magnification;
|
|
4018
|
-
r !== void 0 && Number.isFinite(r) && r > 0 ? (e.setAttribute(
|
|
4093
|
+
r !== void 0 && Number.isFinite(r) && r > 0 ? (e.setAttribute(_s, String(r)), e.style?.setProperty?.("--qti-magnification", String(r))) : (e.removeAttribute(_s), e.style?.removeProperty?.("--qti-magnification"));
|
|
4019
4094
|
}
|
|
4020
4095
|
//#endregion
|
|
4021
4096
|
//#region src/catalog/catalogExtractor.ts
|
|
4022
|
-
function
|
|
4097
|
+
function ys(e) {
|
|
4023
4098
|
if (!e.trim()) return /* @__PURE__ */ new Map();
|
|
4024
4099
|
let t = ie(`<root>${e}</root>`, { lowerCaseTagName: !0 }).querySelector("qti-catalog-info");
|
|
4025
|
-
return t ?
|
|
4100
|
+
return t ? Ss(t) : /* @__PURE__ */ new Map();
|
|
4026
4101
|
}
|
|
4027
|
-
function
|
|
4102
|
+
function bs(e) {
|
|
4028
4103
|
let t = ie(e, { lowerCaseTagName: !0 }).querySelector("qti-catalog-info");
|
|
4029
|
-
return t ?
|
|
4104
|
+
return t ? Ss(t) : /* @__PURE__ */ new Map();
|
|
4030
4105
|
}
|
|
4031
|
-
function
|
|
4106
|
+
function xs(e, t) {
|
|
4032
4107
|
let n = new Map(e);
|
|
4033
4108
|
for (let [e, r] of t) n.set(e, r);
|
|
4034
4109
|
return n;
|
|
4035
4110
|
}
|
|
4036
|
-
function
|
|
4111
|
+
function Ss(e) {
|
|
4037
4112
|
let t = /* @__PURE__ */ new Map();
|
|
4038
4113
|
for (let n of e.querySelectorAll("qti-catalog")) {
|
|
4039
4114
|
let e = n.getAttribute("id") ?? n.getAttribute("identifier");
|
|
@@ -4041,14 +4116,14 @@ function hs(e) {
|
|
|
4041
4116
|
let r = [];
|
|
4042
4117
|
for (let e of n.querySelectorAll("qti-card")) {
|
|
4043
4118
|
let t = e.getAttribute("support") ?? e.getAttribute("usage");
|
|
4044
|
-
for (let n of
|
|
4119
|
+
for (let n of Cs(e, t ?? void 0)) r.push(n);
|
|
4045
4120
|
}
|
|
4046
4121
|
r.length > 0 && t.set(e, { entries: r });
|
|
4047
4122
|
}
|
|
4048
4123
|
for (let n of e.querySelectorAll("qti-card")) {
|
|
4049
4124
|
let e = n.getAttribute("identifier");
|
|
4050
4125
|
if (!e) continue;
|
|
4051
|
-
let r =
|
|
4126
|
+
let r = Cs(n);
|
|
4052
4127
|
if (r.length > 0) {
|
|
4053
4128
|
let n = t.get(e);
|
|
4054
4129
|
n ? n.entries.push(...r) : t.set(e, { entries: r });
|
|
@@ -4056,35 +4131,35 @@ function hs(e) {
|
|
|
4056
4131
|
}
|
|
4057
4132
|
return t;
|
|
4058
4133
|
}
|
|
4059
|
-
function
|
|
4134
|
+
function Cs(e, t) {
|
|
4060
4135
|
let n = e.querySelectorAll("qti-card-entry"), r = [];
|
|
4061
4136
|
if (n.length > 0) {
|
|
4062
4137
|
for (let e of n) {
|
|
4063
4138
|
let n = e.getAttribute("usage") ?? e.getAttribute("data-reading-type") ?? t;
|
|
4064
4139
|
n && r.push({
|
|
4065
4140
|
usage: n,
|
|
4066
|
-
lang:
|
|
4067
|
-
html:
|
|
4141
|
+
lang: ws(e),
|
|
4142
|
+
html: Ts(e)
|
|
4068
4143
|
});
|
|
4069
4144
|
}
|
|
4070
4145
|
return r;
|
|
4071
4146
|
}
|
|
4072
4147
|
return t && r.push({
|
|
4073
4148
|
usage: t,
|
|
4074
|
-
lang:
|
|
4075
|
-
html:
|
|
4149
|
+
lang: ws(e),
|
|
4150
|
+
html: Ts(e)
|
|
4076
4151
|
}), r;
|
|
4077
4152
|
}
|
|
4078
|
-
function
|
|
4153
|
+
function ws(e) {
|
|
4079
4154
|
return e.getAttribute("xml:lang") ?? e.getAttribute("xmllang") ?? e.getAttribute("lang") ?? void 0;
|
|
4080
4155
|
}
|
|
4081
|
-
function
|
|
4156
|
+
function Ts(e) {
|
|
4082
4157
|
let t = e.querySelector("qti-html-content"), n = e.querySelector("qti-file-href");
|
|
4083
4158
|
return t ? t.innerHTML ?? t.text ?? "" : n ? n.getAttribute("src") ?? n.text?.trim() ?? "" : "";
|
|
4084
4159
|
}
|
|
4085
4160
|
//#endregion
|
|
4086
4161
|
//#region src/catalog/catalogLookup.ts
|
|
4087
|
-
function
|
|
4162
|
+
function Es(e, t, n, r) {
|
|
4088
4163
|
let i = e.get(t);
|
|
4089
4164
|
if (!i) return null;
|
|
4090
4165
|
let a = i.entries.filter((e) => e.usage === n);
|
|
@@ -4100,7 +4175,7 @@ function ys(e, t, n, r) {
|
|
|
4100
4175
|
}
|
|
4101
4176
|
//#endregion
|
|
4102
4177
|
//#region src/pci/types.ts
|
|
4103
|
-
var
|
|
4178
|
+
var Ds = class extends Error {
|
|
4104
4179
|
constructor(e, t, n) {
|
|
4105
4180
|
super(t ? `PCI module failed to load from '${e}' and fallback '${t}'` : `PCI module failed to load from '${e}'`), this.primaryPath = e, this.fallbackPath = t, this.name = "PciLoadError", n && Object.defineProperty(this, "cause", {
|
|
4106
4181
|
value: n,
|
|
@@ -4108,7 +4183,7 @@ var bs = class extends Error {
|
|
|
4108
4183
|
configurable: !0
|
|
4109
4184
|
});
|
|
4110
4185
|
}
|
|
4111
|
-
},
|
|
4186
|
+
}, Os = class {
|
|
4112
4187
|
constructor(e, t) {
|
|
4113
4188
|
this.module = null, this._response = null, this._onResponseChange = null, this.data = e, this.baseUrl = t;
|
|
4114
4189
|
}
|
|
@@ -4122,14 +4197,14 @@ var bs = class extends Error {
|
|
|
4122
4197
|
this.module = this.extractPciInterface(t);
|
|
4123
4198
|
return;
|
|
4124
4199
|
} catch (e) {
|
|
4125
|
-
if (!this.data.fallbackPath) throw new
|
|
4200
|
+
if (!this.data.fallbackPath) throw new Ds(this.data.primaryPath, void 0, e);
|
|
4126
4201
|
}
|
|
4127
4202
|
let t = this.resolveUrl(this.data.fallbackPath);
|
|
4128
4203
|
try {
|
|
4129
4204
|
let e = await this.dynamicImport(t);
|
|
4130
4205
|
this.module = this.extractPciInterface(e);
|
|
4131
4206
|
} catch (e) {
|
|
4132
|
-
throw new
|
|
4207
|
+
throw new Ds(this.data.primaryPath, this.data.fallbackPath, e);
|
|
4133
4208
|
}
|
|
4134
4209
|
}
|
|
4135
4210
|
initialize(e) {
|
|
@@ -4169,15 +4244,15 @@ var bs = class extends Error {
|
|
|
4169
4244
|
if (typeof t?.initialize != "function") throw Error(`PCI module at '${this.data.primaryPath}' does not export a valid PciModule interface (expected .initialize, .getResponse, .setResponse, .disable, .enable, .destroy)`);
|
|
4170
4245
|
return t;
|
|
4171
4246
|
}
|
|
4172
|
-
},
|
|
4247
|
+
}, ks = class {
|
|
4173
4248
|
constructor(a) {
|
|
4174
|
-
this.responseProcessingProgram = null, this.templateProcessingProgram = null, this.outcomeProcessingProgram = null, this._catalogIndex = /* @__PURE__ */ new Map(), this._stimulusCatalogIndexes = /* @__PURE__ */ new Map(), this._pciHosts = /* @__PURE__ */ new Map(), this._pnpChangeListeners = /* @__PURE__ */ new Set(), this.lifecycleStatus = "initial", this.accumulatedDurationMs = 0, this.config = a, this.itemXml = a.itemXml ?? "", this.role = a.role ?? "candidate", this.sessionGuid =
|
|
4249
|
+
this.responseProcessingProgram = null, this.templateProcessingProgram = null, this.outcomeProcessingProgram = null, this._catalogIndex = /* @__PURE__ */ new Map(), this._stimulusCatalogIndexes = /* @__PURE__ */ new Map(), this._pciHosts = /* @__PURE__ */ new Map(), this._pnpChangeListeners = /* @__PURE__ */ new Set(), this.lifecycleStatus = "initial", this.accumulatedDurationMs = 0, this.config = a, this.itemXml = a.itemXml ?? "", this.role = a.role ?? "candidate", this.sessionGuid = js(), this.sessionStartedAt = Date.now(), this.rng = a.rng ?? (typeof a.seed == "number" ? hs(a.seed) : Math.random), a.elementNameMapper ? (this.mapper = a.elementNameMapper, a.attributeNameMapper || (a.attributeNameMapper = this.mapper.version === "3.0" ? new x() : new b())) : re(this.itemXml) === "3.0" ? (this.mapper = new te(), a.elementNameMapper = this.mapper, a.attributeNameMapper || (a.attributeNameMapper = new x())) : (this.mapper = new ee(), a.elementNameMapper = this.mapper, a.attributeNameMapper || (a.attributeNameMapper = new b())), this.itemDocument = Vo({
|
|
4175
4250
|
itemXml: this.itemXml,
|
|
4176
4251
|
elementNameMapper: this.mapper,
|
|
4177
4252
|
attributeNameMapper: a.attributeNameMapper,
|
|
4178
4253
|
security: this.config.security
|
|
4179
|
-
}), this.assessmentItem = this.itemDocument.getAssessmentItem(), this.decls = this.buildDeclarations(), this.ensureBuiltinDeclarations(this.decls), this.ctx = new e(this.decls), this.ops = new t(), a.sessionState && this.applySessionState(a.sessionState), this.extractionRegistry = a.extractionRegistry ??
|
|
4180
|
-
for (let e of
|
|
4254
|
+
}), this.assessmentItem = this.itemDocument.getAssessmentItem(), this.decls = this.buildDeclarations(), this.ensureBuiltinDeclarations(this.decls), this.ctx = new e(this.decls), this.ops = new t(), a.sessionState && this.applySessionState(a.sessionState), this.extractionRegistry = a.extractionRegistry ?? Jo(this.mapper), this.componentRegistry = a.componentRegistry ?? ms(), this.i18nProvider = a.i18nProvider ?? this.createDefaultI18nProvider();
|
|
4255
|
+
for (let e of Po()) try {
|
|
4181
4256
|
this.extractionRegistry.register(e);
|
|
4182
4257
|
} catch {}
|
|
4183
4258
|
for (let e of a.plugins ?? []) try {
|
|
@@ -4193,19 +4268,19 @@ var bs = class extends Error {
|
|
|
4193
4268
|
l === "unknown" ? console.warn("[QTI Player] Could not detect QTI version. Assuming QTI 2.2 compatibility.") : l === "2.0" ? console.warn("[QTI Player] QTI 2.0 detected. Some features may not be fully supported. QTI 2.2 is recommended.") : l === "2.1" && console.info("[QTI Player] QTI 2.1 detected. Using QTI 2.2 compatibility mode with CC2 template support."), this._pnp = a.pnp;
|
|
4194
4269
|
let u = /* @__PURE__ */ new Map();
|
|
4195
4270
|
for (let e of a.deliveryContext?.catalogSources ?? []) {
|
|
4196
|
-
let t =
|
|
4271
|
+
let t = ys(e.xml);
|
|
4197
4272
|
if (e.scope === "stimulus" && e.stimulusIdentifier) {
|
|
4198
4273
|
let n = this._stimulusCatalogIndexes.get(e.stimulusIdentifier) ?? /* @__PURE__ */ new Map();
|
|
4199
|
-
this._stimulusCatalogIndexes.set(e.stimulusIdentifier,
|
|
4200
|
-
} else u =
|
|
4274
|
+
this._stimulusCatalogIndexes.set(e.stimulusIdentifier, xs(n, t));
|
|
4275
|
+
} else u = xs(u, t);
|
|
4201
4276
|
}
|
|
4202
|
-
a.catalogXml && (u =
|
|
4277
|
+
a.catalogXml && (u = xs(u, bs(a.catalogXml))), this._catalogIndex = xs(u, bs(this.itemXml)), this.config.strictQtiCompliance?.enabled && this.validateStrictCompliance();
|
|
4203
4278
|
}
|
|
4204
4279
|
applyPnp(e) {
|
|
4205
|
-
this._rootEl = e,
|
|
4280
|
+
this._rootEl = e, vs(e, this._pnp);
|
|
4206
4281
|
}
|
|
4207
4282
|
updatePnp(e) {
|
|
4208
|
-
this._pnp =
|
|
4283
|
+
this._pnp = As(this._pnp, e), this._rootEl && vs(this._rootEl, this._pnp);
|
|
4209
4284
|
for (let e of this._pnpChangeListeners) e(this._pnp);
|
|
4210
4285
|
}
|
|
4211
4286
|
getPnp() {
|
|
@@ -4218,14 +4293,14 @@ var bs = class extends Error {
|
|
|
4218
4293
|
return this.config.deliveryContext;
|
|
4219
4294
|
}
|
|
4220
4295
|
getCatalogEntry(e, t, n, r) {
|
|
4221
|
-
let i = (r?.stimulusIdentifier ?
|
|
4222
|
-
return i === null ? null :
|
|
4296
|
+
let i = (r?.stimulusIdentifier ? Es(this._stimulusCatalogIndexes.get(r.stimulusIdentifier) ?? /* @__PURE__ */ new Map(), e, t, n) : null) ?? Es(this._catalogIndex, e, t, n);
|
|
4297
|
+
return i === null ? null : Ms(i) ? bo(i.trim(), this.config.security?.urlPolicy, "img") : this.sanitizeHtmlContent(i);
|
|
4223
4298
|
}
|
|
4224
4299
|
sanitizeHtmlContent(e) {
|
|
4225
|
-
return
|
|
4300
|
+
return Ao(e, { security: this.config.security });
|
|
4226
4301
|
}
|
|
4227
4302
|
createPciHost(e) {
|
|
4228
|
-
let t = new
|
|
4303
|
+
let t = new Os(e, this.config.pciBaseUrl ?? (typeof document < "u" ? document.baseURI : ""));
|
|
4229
4304
|
return t.onResponseChange((e, t) => {
|
|
4230
4305
|
let n = this.decls[e];
|
|
4231
4306
|
n && (n.value = this.coerceToDeclarationValue(n.baseType, n.cardinality, t));
|
|
@@ -4416,7 +4491,7 @@ var bs = class extends Error {
|
|
|
4416
4491
|
}
|
|
4417
4492
|
getItemBodyHtml() {
|
|
4418
4493
|
let e = this.itemDocument.serializeItemBodyChildren();
|
|
4419
|
-
return e ?
|
|
4494
|
+
return e ? cs(Ao(this.renderPrintedVariables(e), { security: this.config.security }), this.config.security?.trustedTypesPolicyName) : "";
|
|
4420
4495
|
}
|
|
4421
4496
|
getRubrics() {
|
|
4422
4497
|
let e = this.role, t = this.itemDocument.findRubricElements();
|
|
@@ -4425,7 +4500,7 @@ var bs = class extends Error {
|
|
|
4425
4500
|
for (let r of t) {
|
|
4426
4501
|
let t = (f(r, "view") || "").trim(), i = t ? t.split(/\s+/).filter(Boolean) : [];
|
|
4427
4502
|
if (i.length > 0 && e && !i.includes(e)) continue;
|
|
4428
|
-
let a = this.itemDocument.serializeChildren(r) || r.textContent || "", o =
|
|
4503
|
+
let a = this.itemDocument.serializeChildren(r) || r.textContent || "", o = cs(Ao(this.renderPrintedVariables(a), { security: this.config.security }), this.config.security?.trustedTypesPolicyName);
|
|
4429
4504
|
n.push({
|
|
4430
4505
|
view: i,
|
|
4431
4506
|
html: o
|
|
@@ -4440,7 +4515,7 @@ var bs = class extends Error {
|
|
|
4440
4515
|
return this.extractionRegistry;
|
|
4441
4516
|
}
|
|
4442
4517
|
getInteractionData() {
|
|
4443
|
-
return
|
|
4518
|
+
return us({
|
|
4444
4519
|
document: this.itemDocument,
|
|
4445
4520
|
extractionRegistry: this.extractionRegistry,
|
|
4446
4521
|
declarations: this.decls,
|
|
@@ -4985,7 +5060,7 @@ var bs = class extends Error {
|
|
|
4985
5060
|
getModalFeedback(e) {
|
|
4986
5061
|
let t = this.itemDocument.findModalFeedbackElements(), n = [];
|
|
4987
5062
|
for (let r of t) {
|
|
4988
|
-
let t = this.getAttrMapped(r, "identifier") || "", i = this.getAttrMapped(r, "outcomeIdentifier") || "", a = this.getAttrMapped(r, "showHide") || "show", o = this.getAttrMapped(r, "title") || void 0, s =
|
|
5063
|
+
let t = this.getAttrMapped(r, "identifier") || "", i = this.getAttrMapped(r, "outcomeIdentifier") || "", a = this.getAttrMapped(r, "showHide") || "show", o = this.getAttrMapped(r, "title") || void 0, s = cs(Ao(this.itemDocument.serializeChildren(r) || r.textContent || "", { security: this.config.security }), this.config.security?.trustedTypesPolicyName), c = e[i];
|
|
4989
5064
|
(a === "show" ? c === t : c !== t) && s && n.push({
|
|
4990
5065
|
identifier: t,
|
|
4991
5066
|
outcomeIdentifier: i,
|
|
@@ -4997,7 +5072,7 @@ var bs = class extends Error {
|
|
|
4997
5072
|
return n;
|
|
4998
5073
|
}
|
|
4999
5074
|
};
|
|
5000
|
-
function
|
|
5075
|
+
function As(e, t) {
|
|
5001
5076
|
return {
|
|
5002
5077
|
display: {
|
|
5003
5078
|
...e?.display ?? {},
|
|
@@ -5013,16 +5088,16 @@ function Cs(e, t) {
|
|
|
5013
5088
|
}
|
|
5014
5089
|
};
|
|
5015
5090
|
}
|
|
5016
|
-
function
|
|
5091
|
+
function js() {
|
|
5017
5092
|
return typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `item-session-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
5018
5093
|
}
|
|
5019
|
-
function
|
|
5094
|
+
function Ms(e) {
|
|
5020
5095
|
let t = e.trim();
|
|
5021
5096
|
return /^(https?:\/\/|\/\/|\/|\.{0,2}\/|data:|blob:)/i.test(t) || /\.(png|jpe?g|gif|webp|svg|mp3|wav|ogg|mp4|webm|pdf)(\?.*)?$/i.test(t);
|
|
5022
5097
|
}
|
|
5023
5098
|
//#endregion
|
|
5024
5099
|
//#region src/components/utils/feedbackUtils.ts
|
|
5025
|
-
var
|
|
5100
|
+
var Ns = [
|
|
5026
5101
|
{
|
|
5027
5102
|
pattern: /<strong>Incorrect;<\/strong>/gi,
|
|
5028
5103
|
replacement: "<strong>Incorrect</strong> "
|
|
@@ -5040,24 +5115,24 @@ var Es = [
|
|
|
5040
5115
|
replacement: "Correct "
|
|
5041
5116
|
}
|
|
5042
5117
|
];
|
|
5043
|
-
function
|
|
5118
|
+
function Ps(e, t = Ns) {
|
|
5044
5119
|
if (!e) return e;
|
|
5045
5120
|
let n = e;
|
|
5046
5121
|
for (let e of t) n = n.replace(e.pattern, e.replacement);
|
|
5047
5122
|
return n;
|
|
5048
5123
|
}
|
|
5049
|
-
function
|
|
5124
|
+
function Fs(e, t) {
|
|
5050
5125
|
let { outcomeValues: n, applyHeuristics: r = !1, wrapWithSpan: i = !1, transforms: a } = t;
|
|
5051
5126
|
return e && e.replace(/<feedbackInline[^>]*outcomeIdentifier="([^"]+)"[^>]*identifier="([^"]+)"[^>]*showHide="([^"]+)"[^>]*>([\s\S]*?)<\/feedbackInline>/gi, (e, t, o, s) => {
|
|
5052
5127
|
let c = n[t];
|
|
5053
5128
|
if (c == null || c === "" || !(s.toLowerCase() === "show" ? c === o : c !== o)) return "";
|
|
5054
5129
|
let l = e.replace(/<feedbackInline[^>]*>/, "").replace(/<\/feedbackInline>/, "");
|
|
5055
|
-
return r && (l =
|
|
5130
|
+
return r && (l = Ps(l, a)), i ? ` <span class="qti-feedback-inline">${l}</span>` : l;
|
|
5056
5131
|
});
|
|
5057
5132
|
}
|
|
5058
5133
|
//#endregion
|
|
5059
5134
|
//#region src/components/actions/typesetAction.ts
|
|
5060
|
-
function
|
|
5135
|
+
function Is(e, t) {
|
|
5061
5136
|
if (!(typeof window < "u" && typeof MutationObserver < "u")) return {
|
|
5062
5137
|
update() {},
|
|
5063
5138
|
destroy() {}
|
|
@@ -5088,7 +5163,7 @@ function ks(e, t) {
|
|
|
5088
5163
|
}
|
|
5089
5164
|
//#endregion
|
|
5090
5165
|
//#region src/catalog/applyGlossaryTriggers.ts
|
|
5091
|
-
var
|
|
5166
|
+
var Ls = [
|
|
5092
5167
|
{
|
|
5093
5168
|
usage: "tts-pronunciation",
|
|
5094
5169
|
flag: "ttsPronunciation",
|
|
@@ -5119,90 +5194,90 @@ var As = [
|
|
|
5119
5194
|
label: "Request extended description",
|
|
5120
5195
|
text: "D"
|
|
5121
5196
|
}
|
|
5122
|
-
],
|
|
5197
|
+
], Rs = "illustrated-glossary", zs = new Set([
|
|
5123
5198
|
"glossary-on-screen",
|
|
5124
5199
|
"keyword-translation",
|
|
5125
|
-
|
|
5126
|
-
]),
|
|
5127
|
-
function
|
|
5128
|
-
|
|
5200
|
+
Rs
|
|
5201
|
+
]), Bs = new Set(Ls.map((e) => e.flag)), Vs = new Set(Ls.map((e) => e.usage)), Hs = /^[a-z][a-z0-9._-]*$/;
|
|
5202
|
+
function Us(e, t) {
|
|
5203
|
+
Ws(e);
|
|
5129
5204
|
let n = t.getPnp();
|
|
5130
|
-
if (!n) return () =>
|
|
5131
|
-
let r = n.content?.glossaryOnScreen === !0, i = n.content?.keywordTranslation, a = i?.active === !0 && !!i.languageCode, o = n.content?.illustratedGlossary === !0, s = n.content?.catalogSupports ?? {}, c =
|
|
5132
|
-
if (!r && !a && !o && !l && c.length === 0) return () =>
|
|
5205
|
+
if (!n) return () => Ws(e);
|
|
5206
|
+
let r = n.content?.glossaryOnScreen === !0, i = n.content?.keywordTranslation, a = i?.active === !0 && !!i.languageCode, o = n.content?.illustratedGlossary === !0, s = n.content?.catalogSupports ?? {}, c = Js(s), l = Ls.some((e) => Xs(Ys(s, e)));
|
|
5207
|
+
if (!r && !a && !o && !l && c.length === 0) return () => Ws(e);
|
|
5133
5208
|
let u = e.querySelectorAll("[data-catalog-idref]");
|
|
5134
|
-
if (u.length === 0) return () =>
|
|
5209
|
+
if (u.length === 0) return () => Ws(e);
|
|
5135
5210
|
let d = null;
|
|
5136
5211
|
for (let e of Array.from(u)) {
|
|
5137
5212
|
let n = e.getAttribute("data-catalog-idref");
|
|
5138
5213
|
if (!n) continue;
|
|
5139
|
-
let l =
|
|
5214
|
+
let l = qs(e), u = document.createElement("span");
|
|
5140
5215
|
if (u.className = "qti-catalog-term", u.style.cssText = "position:relative;display:inline", e.parentNode?.insertBefore(u, e), u.appendChild(e), r) {
|
|
5141
|
-
let r =
|
|
5216
|
+
let r = Gs(e.textContent ?? n, "glossary-on-screen", "Show definition");
|
|
5142
5217
|
u.appendChild(r), r.addEventListener("click", () => {
|
|
5143
5218
|
if (d) {
|
|
5144
5219
|
d(), d = null;
|
|
5145
5220
|
return;
|
|
5146
5221
|
}
|
|
5147
5222
|
let i = t.getCatalogEntry(n, "glossary-on-screen", void 0, { stimulusIdentifier: l });
|
|
5148
|
-
i !== null && (d =
|
|
5223
|
+
i !== null && (d = ec(u, e.textContent ?? n, i, r, t, () => {
|
|
5149
5224
|
d = null;
|
|
5150
5225
|
}));
|
|
5151
5226
|
});
|
|
5152
5227
|
}
|
|
5153
5228
|
if (a) {
|
|
5154
|
-
let r = i.languageCode, a =
|
|
5229
|
+
let r = i.languageCode, a = Gs(e.textContent ?? n, "keyword-translation", "Show translation");
|
|
5155
5230
|
u.appendChild(a), a.addEventListener("click", () => {
|
|
5156
5231
|
if (d) {
|
|
5157
5232
|
d(), d = null;
|
|
5158
5233
|
return;
|
|
5159
5234
|
}
|
|
5160
5235
|
let i = t.getCatalogEntry(n, "keyword-translation", r, { stimulusIdentifier: l });
|
|
5161
|
-
i !== null && (d =
|
|
5236
|
+
i !== null && (d = ec(u, e.textContent ?? n, i, a, t, () => {
|
|
5162
5237
|
d = null;
|
|
5163
5238
|
}));
|
|
5164
5239
|
});
|
|
5165
5240
|
}
|
|
5166
5241
|
if (o) {
|
|
5167
|
-
let r =
|
|
5242
|
+
let r = Gs(e.textContent ?? n, Rs, "Show illustrated glossary");
|
|
5168
5243
|
u.appendChild(r), r.addEventListener("click", () => {
|
|
5169
5244
|
if (d) {
|
|
5170
5245
|
d(), d = null;
|
|
5171
5246
|
return;
|
|
5172
5247
|
}
|
|
5173
|
-
let i = t.getCatalogEntry(n,
|
|
5174
|
-
i !== null && (d =
|
|
5248
|
+
let i = t.getCatalogEntry(n, Rs, void 0, { stimulusIdentifier: l });
|
|
5249
|
+
i !== null && (d = ec(u, e.textContent ?? n, i, r, t, () => {
|
|
5175
5250
|
d = null;
|
|
5176
5251
|
}));
|
|
5177
5252
|
});
|
|
5178
5253
|
}
|
|
5179
|
-
for (let r of
|
|
5180
|
-
let i =
|
|
5181
|
-
|
|
5254
|
+
for (let r of Ls) {
|
|
5255
|
+
let i = Ys(s, r);
|
|
5256
|
+
Xs(i) && Ks(u, e, n, {
|
|
5182
5257
|
...r,
|
|
5183
|
-
languageCode:
|
|
5258
|
+
languageCode: Zs(i)
|
|
5184
5259
|
}, t, l);
|
|
5185
5260
|
}
|
|
5186
|
-
for (let r of c)
|
|
5261
|
+
for (let r of c) Ks(u, e, n, r, t, l);
|
|
5187
5262
|
}
|
|
5188
5263
|
return () => {
|
|
5189
|
-
d?.(),
|
|
5264
|
+
d?.(), Ws(e);
|
|
5190
5265
|
};
|
|
5191
5266
|
}
|
|
5192
|
-
function
|
|
5267
|
+
function Ws(e) {
|
|
5193
5268
|
for (let t of Array.from(e.querySelectorAll(".qti-catalog-term"))) {
|
|
5194
5269
|
let e = Array.from(t.children).find((e) => e.getAttribute?.("data-catalog-idref") !== null);
|
|
5195
5270
|
e && t.parentNode && t.parentNode.insertBefore(e, t), t.remove();
|
|
5196
5271
|
}
|
|
5197
5272
|
}
|
|
5198
|
-
function
|
|
5273
|
+
function Gs(e, t, n, r) {
|
|
5199
5274
|
let i = document.createElement("button");
|
|
5200
|
-
return i.type = "button", i.className = "qti-catalog-trigger", i.style.cssText = "display:inline-flex;align-items:center;justify-content:center;min-width:1.75rem;min-height:1.75rem;margin-inline:0.25rem;line-height:1;", i.setAttribute("aria-label", `${n}: ${e}`), i.setAttribute("data-catalog-usage", t), i.textContent = r ?? (t === "keyword-translation" ? "T" : t ===
|
|
5275
|
+
return i.type = "button", i.className = "qti-catalog-trigger", i.style.cssText = "display:inline-flex;align-items:center;justify-content:center;min-width:1.75rem;min-height:1.75rem;margin-inline:0.25rem;line-height:1;", i.setAttribute("aria-label", `${n}: ${e}`), i.setAttribute("data-catalog-usage", t), i.textContent = r ?? (t === "keyword-translation" ? "T" : t === Rs ? "I" : "?"), i;
|
|
5201
5276
|
}
|
|
5202
|
-
function
|
|
5277
|
+
function Ks(e, t, n, r, i, a) {
|
|
5203
5278
|
let o = i.getCatalogEntry(n, r.usage, r.languageCode, { stimulusIdentifier: a });
|
|
5204
5279
|
if (o === null) return;
|
|
5205
|
-
let s =
|
|
5280
|
+
let s = Gs(t.textContent ?? n, r.usage, r.label, r.text);
|
|
5206
5281
|
e.appendChild(s), s.addEventListener("click", () => {
|
|
5207
5282
|
s.dispatchEvent(new CustomEvent("qti-catalog-lookup", {
|
|
5208
5283
|
bubbles: !0,
|
|
@@ -5217,39 +5292,39 @@ function zs(e, t, n, r, i, a) {
|
|
|
5217
5292
|
}));
|
|
5218
5293
|
});
|
|
5219
5294
|
}
|
|
5220
|
-
function
|
|
5295
|
+
function qs(e) {
|
|
5221
5296
|
return (e.closest?.("[data-stimulus-idref]"))?.getAttribute?.("data-stimulus-idref")?.trim() || void 0;
|
|
5222
5297
|
}
|
|
5223
|
-
function
|
|
5298
|
+
function Js(e) {
|
|
5224
5299
|
return Object.entries(e).map(([e, t]) => ({
|
|
5225
|
-
usage:
|
|
5300
|
+
usage: Qs(e),
|
|
5226
5301
|
preference: t
|
|
5227
|
-
})).filter(({ usage: e, preference: t }) => e !== null &&
|
|
5302
|
+
})).filter(({ usage: e, preference: t }) => e !== null && Xs(t) && !$s(e)).map(({ usage: e, preference: t }) => ({
|
|
5228
5303
|
usage: e,
|
|
5229
5304
|
label: `Request ${e.replace(/[-_]+/g, " ")}`,
|
|
5230
5305
|
text: e.slice(0, 1).toUpperCase(),
|
|
5231
|
-
languageCode:
|
|
5306
|
+
languageCode: Zs(t)
|
|
5232
5307
|
}));
|
|
5233
5308
|
}
|
|
5234
|
-
function
|
|
5309
|
+
function Ys(e, t) {
|
|
5235
5310
|
return e[t.flag] ?? e[t.usage];
|
|
5236
5311
|
}
|
|
5237
|
-
function
|
|
5312
|
+
function Xs(e) {
|
|
5238
5313
|
return e === void 0 ? !1 : typeof e == "boolean" ? e : e.active !== !1;
|
|
5239
5314
|
}
|
|
5240
|
-
function
|
|
5315
|
+
function Zs(e) {
|
|
5241
5316
|
if (!e || typeof e == "boolean") return;
|
|
5242
5317
|
let t = e.languageCode?.trim();
|
|
5243
5318
|
if (!(!t || !/^[a-zA-Z]{2,8}(?:-[a-zA-Z0-9]{1,8})*$/.test(t))) return t;
|
|
5244
5319
|
}
|
|
5245
|
-
function
|
|
5320
|
+
function Qs(e) {
|
|
5246
5321
|
let t = e.trim().toLowerCase();
|
|
5247
|
-
return
|
|
5322
|
+
return Hs.test(t) ? t : null;
|
|
5248
5323
|
}
|
|
5249
|
-
function
|
|
5250
|
-
return
|
|
5324
|
+
function $s(e) {
|
|
5325
|
+
return Bs.has(e) || Vs.has(e) || zs.has(e);
|
|
5251
5326
|
}
|
|
5252
|
-
function
|
|
5327
|
+
function ec(e, t, n, r, i, a) {
|
|
5253
5328
|
let o = i.getComponentRegistry(), s, c = !1;
|
|
5254
5329
|
function l() {
|
|
5255
5330
|
c || (c = !0, s.remove(), r.focus(), a());
|
|
@@ -5258,10 +5333,10 @@ function qs(e, t, n, r, i, a) {
|
|
|
5258
5333
|
if (u !== null) {
|
|
5259
5334
|
let r = document.createElement(u);
|
|
5260
5335
|
r.content = n, r.label = t, r.onClose = l, e.appendChild(r), s = r;
|
|
5261
|
-
} else s =
|
|
5336
|
+
} else s = tc(t, n, l), e.appendChild(s);
|
|
5262
5337
|
return l;
|
|
5263
5338
|
}
|
|
5264
|
-
function
|
|
5339
|
+
function tc(e, t, n) {
|
|
5265
5340
|
let r = document.createElement("div");
|
|
5266
5341
|
r.className = "card card-bordered bg-base-100 shadow-lg qti-catalog-popup", r.setAttribute("role", "dialog"), r.setAttribute("aria-label", e), r.setAttribute("aria-modal", "true"), r.style.cssText = "position:absolute;z-index:1000;min-width:16rem;max-width:24rem";
|
|
5267
5342
|
let i = document.createElement("div");
|
|
@@ -5295,14 +5370,14 @@ function Js(e, t, n) {
|
|
|
5295
5370
|
}
|
|
5296
5371
|
//#endregion
|
|
5297
5372
|
//#region src/catalog/glossaryAction.ts
|
|
5298
|
-
function
|
|
5299
|
-
let n =
|
|
5300
|
-
n(), n =
|
|
5373
|
+
function nc(e, t) {
|
|
5374
|
+
let n = Us(e, t.player), r = t.player.onPnpChange?.(() => {
|
|
5375
|
+
n(), n = Us(e, t.player);
|
|
5301
5376
|
}) ?? (() => {});
|
|
5302
5377
|
return {
|
|
5303
5378
|
update(t) {
|
|
5304
|
-
n(), r(), n =
|
|
5305
|
-
n(), n =
|
|
5379
|
+
n(), r(), n = Us(e, t.player), r = t.player.onPnpChange?.(() => {
|
|
5380
|
+
n(), n = Us(e, t.player);
|
|
5306
5381
|
}) ?? (() => {});
|
|
5307
5382
|
},
|
|
5308
5383
|
destroy() {
|
|
@@ -5312,80 +5387,80 @@ function Ys(e, t) {
|
|
|
5312
5387
|
}
|
|
5313
5388
|
//#endregion
|
|
5314
5389
|
//#region src/components/utils/stylesheetRender.ts
|
|
5315
|
-
var
|
|
5316
|
-
function
|
|
5317
|
-
return e ? e.stylesheets.map((e) =>
|
|
5390
|
+
var rc = /@import\b|url\s*\(|<\/style|expression\s*\(|javascript\s*:|vbscript\s*:|data\s*:/i;
|
|
5391
|
+
function ic(e, t = "[data-qti-item-body-scope]") {
|
|
5392
|
+
return e ? e.stylesheets.map((e) => ac(e, t)).filter(Boolean).join("\n") : "";
|
|
5318
5393
|
}
|
|
5319
|
-
function
|
|
5394
|
+
function ac(e, t) {
|
|
5320
5395
|
let n = e.cssText?.trim();
|
|
5321
|
-
return !n ||
|
|
5396
|
+
return !n || rc.test(n) ? "" : oc(n, sc(e, t)) || "";
|
|
5322
5397
|
}
|
|
5323
|
-
function
|
|
5398
|
+
function oc(e, t = "[data-qti-item-body-scope]") {
|
|
5324
5399
|
let n = e.replace(/\/\*[\s\S]*?\*\//g, ""), r = "";
|
|
5325
5400
|
for (let e of n.matchAll(/([^{}@]+)\{([^{}]*)\}/g)) {
|
|
5326
5401
|
let n = e[1]?.trim(), i = e[2]?.trim();
|
|
5327
5402
|
if (!n || !i) continue;
|
|
5328
|
-
let a = n.split(",").map((e) =>
|
|
5403
|
+
let a = n.split(",").map((e) => cc(e.trim(), t)).filter(Boolean);
|
|
5329
5404
|
a.length !== 0 && (r += `${a.join(", ")} { ${i} }\n`);
|
|
5330
5405
|
}
|
|
5331
5406
|
return r.trim();
|
|
5332
5407
|
}
|
|
5333
|
-
function
|
|
5334
|
-
return e.source !== "stimulus" || !e.stimulusIdentifier ? t : `${t} [data-stimulus-idref="${
|
|
5408
|
+
function sc(e, t) {
|
|
5409
|
+
return e.source !== "stimulus" || !e.stimulusIdentifier ? t : `${t} [data-stimulus-idref="${lc(e.stimulusIdentifier)}"]`;
|
|
5335
5410
|
}
|
|
5336
|
-
function
|
|
5411
|
+
function cc(e, t) {
|
|
5337
5412
|
return e ? e.startsWith(t) ? e : e === ":root" || e === "html" || e === "body" ? t : e.startsWith(":") ? `${t}${e}` : `${t} ${e}` : "";
|
|
5338
5413
|
}
|
|
5339
|
-
function
|
|
5414
|
+
function lc(e) {
|
|
5340
5415
|
return e.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n|\r|\f/g, " ");
|
|
5341
5416
|
}
|
|
5342
5417
|
//#endregion
|
|
5343
5418
|
//#region src/components/utils/stimulusRender.ts
|
|
5344
|
-
function
|
|
5419
|
+
function uc(e, t, n) {
|
|
5345
5420
|
let r = Object.fromEntries(Object.entries(e?.stimuli ?? {}).map(([e, t]) => [e, n(t.bodyHtml)])), i = Object.fromEntries(Object.entries(t).map(([e, t]) => [e, n(t)]));
|
|
5346
5421
|
return {
|
|
5347
5422
|
...r,
|
|
5348
5423
|
...i
|
|
5349
5424
|
};
|
|
5350
5425
|
}
|
|
5351
|
-
function
|
|
5426
|
+
function dc(e, t) {
|
|
5352
5427
|
if (Object.keys(t).length === 0) return e;
|
|
5353
5428
|
let n = /* @__PURE__ */ new Set(), r = e.replace(/<([a-z][\w:-]*)([^>]*\bdata-stimulus-idref=(["'])([^"']+)\3[^>]*)>\s*<\/\1>/gi, (e, r, i, a, o) => {
|
|
5354
5429
|
let s = t[o];
|
|
5355
|
-
return s ? (n.add(o), `<${r}${
|
|
5430
|
+
return s ? (n.add(o), `<${r}${pc(i, "qti-stimulus-dock")}>${s}</${r}>`) : e;
|
|
5356
5431
|
});
|
|
5357
5432
|
r = r.replace(/<qti-assessment-stimulus-ref\b([^>]*)\/?>\s*(?:<\/qti-assessment-stimulus-ref>)?/gi, (e, r) => {
|
|
5358
|
-
let i =
|
|
5433
|
+
let i = fc(r, "identifier");
|
|
5359
5434
|
if (!i) return e;
|
|
5360
5435
|
if (n.has(i)) return "";
|
|
5361
5436
|
let a = t[i];
|
|
5362
|
-
return a ? (n.add(i), `<div data-stimulus-idref="${
|
|
5437
|
+
return a ? (n.add(i), `<div data-stimulus-idref="${mc(i)}" class="qti-stimulus-dock">${a}</div>`) : e;
|
|
5363
5438
|
});
|
|
5364
|
-
let i = Object.entries(t).filter(([e]) => !n.has(e)).map(([e, t]) => `<div data-stimulus-idref="${
|
|
5439
|
+
let i = Object.entries(t).filter(([e]) => !n.has(e)).map(([e, t]) => `<div data-stimulus-idref="${mc(e)}" class="qti-stimulus-block">${t}</div>`).join("");
|
|
5365
5440
|
return i ? i + r : r;
|
|
5366
5441
|
}
|
|
5367
|
-
function
|
|
5442
|
+
function fc(e, t) {
|
|
5368
5443
|
return e.match(RegExp(`\\b${t}\\s*=\\s*["']([^"']+)["']`, "i"))?.[1] ?? null;
|
|
5369
5444
|
}
|
|
5370
|
-
function
|
|
5445
|
+
function pc(e, t) {
|
|
5371
5446
|
let n = e.match(/\bclass\s*=\s*(["'])([^"']*)\1/i);
|
|
5372
5447
|
if (!n) return `${e} class="${t}"`;
|
|
5373
5448
|
let r = n[1], i = n[2] ?? "", a = new Set(i.split(/\s+/).filter(Boolean));
|
|
5374
5449
|
return a.add(t), e.replace(n[0], `class=${r}${Array.from(a).join(" ")}${r}`);
|
|
5375
5450
|
}
|
|
5376
|
-
function
|
|
5451
|
+
function mc(e) {
|
|
5377
5452
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
5378
5453
|
}
|
|
5379
5454
|
//#endregion
|
|
5380
5455
|
//#region src/core/rolePolicy.ts
|
|
5381
|
-
var
|
|
5456
|
+
var hc = new Set([
|
|
5382
5457
|
"scorer",
|
|
5383
5458
|
"author",
|
|
5384
5459
|
"tutor",
|
|
5385
5460
|
"testConstructor"
|
|
5386
5461
|
]);
|
|
5387
|
-
function
|
|
5388
|
-
let t = e === "candidate", n =
|
|
5462
|
+
function gc(e) {
|
|
5463
|
+
let t = e === "candidate", n = hc.has(e);
|
|
5389
5464
|
return {
|
|
5390
5465
|
isCandidate: t,
|
|
5391
5466
|
isReadOnly: !t,
|
|
@@ -5394,20 +5469,20 @@ function lc(e) {
|
|
|
5394
5469
|
}
|
|
5395
5470
|
//#endregion
|
|
5396
5471
|
//#region src/interactions/inline-choice/InlineChoice.svelte
|
|
5397
|
-
var
|
|
5398
|
-
function
|
|
5472
|
+
var _c = /* @__PURE__ */ Y("<option> </option>"), vc = /* @__PURE__ */ Y("<span class=\"badge badge-success badge-sm\" style=\"position: absolute; top: -1.5rem; left: 0; white-space: nowrap; font-size: 0.7rem;\"> </span>"), yc = /* @__PURE__ */ Y("<span class=\"inline-choice-wrapper\" style=\"display: inline-block; position: relative;\"><select style=\"display: inline-block; margin: 0 4px; width: auto; min-width: 120px;\"><option> </option><!></select> <!></span>");
|
|
5473
|
+
function bc(e, t) {
|
|
5399
5474
|
yt(t, !0);
|
|
5400
5475
|
let n = Q(t, "response", 3, ""), r = Q(t, "correctAnswer", 3, null), i = Q(t, "disabled", 3, !1), a = Q(t, "onResponseChange", 3, () => {}), o = /* @__PURE__ */ I(() => r() === null ? n() : r()), s = /* @__PURE__ */ I(() => r() ? t.interaction.choices.find((e) => e.identifier === r()) : null);
|
|
5401
5476
|
function c(e) {
|
|
5402
5477
|
let n = e.currentTarget?.value ?? "";
|
|
5403
5478
|
a()(t.interaction.responseId, n);
|
|
5404
5479
|
}
|
|
5405
|
-
var l =
|
|
5480
|
+
var l = yc(), u = V(l);
|
|
5406
5481
|
let d;
|
|
5407
5482
|
var f = V(u), p = V(f, !0);
|
|
5408
5483
|
E(f), f.value = f.__value = "", la(Sr(f), 17, () => t.interaction.choices, aa, (e, t) => {
|
|
5409
5484
|
let n = /* @__PURE__ */ I(() => r() === J(t).identifier);
|
|
5410
|
-
var i =
|
|
5485
|
+
var i = _c(), a = V(i);
|
|
5411
5486
|
E(i);
|
|
5412
5487
|
var o = {};
|
|
5413
5488
|
H(() => {
|
|
@@ -5417,7 +5492,7 @@ function pc(e, t) {
|
|
|
5417
5492
|
var m;
|
|
5418
5493
|
ja(u);
|
|
5419
5494
|
var h = Sr(u, 2), g = (e) => {
|
|
5420
|
-
var n =
|
|
5495
|
+
var n = vc(), r = V(n);
|
|
5421
5496
|
E(n), H((e) => Wi(r, `${e ?? ""}: ${J(s).text ?? ""}`), [() => t.i18n?.t("interactions.choice.correct", "Correct") ?? "Correct"]), X(e, n);
|
|
5422
5497
|
};
|
|
5423
5498
|
ia(h, (e) => {
|
|
@@ -5433,8 +5508,8 @@ function pc(e, t) {
|
|
|
5433
5508
|
Ii(["change"]);
|
|
5434
5509
|
//#endregion
|
|
5435
5510
|
//#region src/interactions/text-entry/InlineTextEntry.svelte
|
|
5436
|
-
var
|
|
5437
|
-
function
|
|
5511
|
+
var xc = /* @__PURE__ */ Y("<span role=\"alert\" class=\"qti-text-entry-error text-error text-xs\" style=\"display: block;\"> </span>"), Sc = /* @__PURE__ */ Y("<input type=\"text\"/> <!>", 1);
|
|
5512
|
+
function Cc(e, t) {
|
|
5438
5513
|
yt(t, !0);
|
|
5439
5514
|
let n = Q(t, "response", 3, ""), r = Q(t, "correctAnswer", 3, null), i = Q(t, "disabled", 3, !1), a = Q(t, "onResponseChange", 3, () => {}), o = /* @__PURE__ */ L(null), s = /* @__PURE__ */ I(() => r() === null ? n() : r()), c = /* @__PURE__ */ I(() => (t.interaction.interactionClasses ?? []).find((e) => e.startsWith("qti-input-width-"))), l = /* @__PURE__ */ I(() => (t.interaction.interactionClasses ?? []).filter((e) => !e.startsWith("qti-input-width-")).join(" ")), u = /* @__PURE__ */ I(() => `${t.interaction.responseId}-error`);
|
|
5440
5515
|
function d(e) {
|
|
@@ -5447,11 +5522,11 @@ function gc(e, t) {
|
|
|
5447
5522
|
function p(e) {
|
|
5448
5523
|
e.currentTarget?.checkValidity();
|
|
5449
5524
|
}
|
|
5450
|
-
var m =
|
|
5525
|
+
var m = Sc(), h = xr(m);
|
|
5451
5526
|
La(h);
|
|
5452
5527
|
let g;
|
|
5453
5528
|
var _ = Sr(h, 2), v = (e) => {
|
|
5454
|
-
var t =
|
|
5529
|
+
var t = xc(), n = V(t, !0);
|
|
5455
5530
|
E(t), H(() => {
|
|
5456
5531
|
Z(t, "id", J(u)), Wi(n, J(o));
|
|
5457
5532
|
}), X(e, t);
|
|
@@ -5473,29 +5548,29 @@ function gc(e, t) {
|
|
|
5473
5548
|
Ii(["input"]);
|
|
5474
5549
|
//#endregion
|
|
5475
5550
|
//#region src/interactions/inline/render-plan.ts
|
|
5476
|
-
function
|
|
5477
|
-
return
|
|
5551
|
+
function wc(e) {
|
|
5552
|
+
return Ro(e);
|
|
5478
5553
|
}
|
|
5479
|
-
function
|
|
5480
|
-
return
|
|
5554
|
+
function Tc(e) {
|
|
5555
|
+
return zo(e);
|
|
5481
5556
|
}
|
|
5482
|
-
function
|
|
5483
|
-
return e.replace(/<textEntryInteraction[^>]*responseIdentifier="([^"]+)"[^>]*?(?:\/>|><\/textEntryInteraction>)/gi, (e, n) =>
|
|
5557
|
+
function Ec(e, t) {
|
|
5558
|
+
return e.replace(/<textEntryInteraction[^>]*responseIdentifier="([^"]+)"[^>]*?(?:\/>|><\/textEntryInteraction>)/gi, (e, n) => kc(t, n, "textEntryInteraction") ? Oc("textEntry", n) : e).replace(/<qti-text-entry-interaction[^>]*response-identifier="([^"]+)"[^>]*?(?:\/>|><\/qti-text-entry-interaction>)/gi, (e, n) => kc(t, n, "textEntryInteraction") ? Oc("textEntry", n) : e).replace(/<inlineChoiceInteraction[^>]*responseIdentifier="([^"]+)"[^>]*>[\s\S]*?<\/inlineChoiceInteraction>/gi, (e, n) => kc(t, n, "inlineChoiceInteraction") ? Oc("inlineChoice", n) : e).replace(/<qti-inline-choice-interaction[^>]*response-identifier="([^"]+)"[^>]*>[\s\S]*?<\/qti-inline-choice-interaction>/gi, (e, n) => kc(t, n, "inlineChoiceInteraction") ? Oc("inlineChoice", n) : e);
|
|
5484
5559
|
}
|
|
5485
|
-
function
|
|
5486
|
-
let n =
|
|
5560
|
+
function Dc(e, t) {
|
|
5561
|
+
let n = Ec(e, t), r = [], i = /\[TEXTENTRY:([^\]]+)\]|\[INLINECHOICE:([^\]]+)\]/g, a = 0, o;
|
|
5487
5562
|
for (; (o = i.exec(n)) !== null;) {
|
|
5488
5563
|
if (o.index > a && r.push({
|
|
5489
5564
|
type: "html",
|
|
5490
5565
|
content: n.substring(a, o.index)
|
|
5491
5566
|
}), o[0].startsWith("[TEXTENTRY:")) {
|
|
5492
|
-
let e =
|
|
5567
|
+
let e = Ac(t, o[1], "textEntryInteraction");
|
|
5493
5568
|
e && r.push({
|
|
5494
5569
|
type: "textEntry",
|
|
5495
5570
|
interaction: e
|
|
5496
5571
|
});
|
|
5497
5572
|
} else {
|
|
5498
|
-
let e =
|
|
5573
|
+
let e = Ac(t, o[2], "inlineChoiceInteraction");
|
|
5499
5574
|
e && r.push({
|
|
5500
5575
|
type: "inlineChoice",
|
|
5501
5576
|
interaction: e
|
|
@@ -5511,24 +5586,24 @@ function bc(e, t) {
|
|
|
5511
5586
|
content: n
|
|
5512
5587
|
}];
|
|
5513
5588
|
}
|
|
5514
|
-
function
|
|
5589
|
+
function Oc(e, t) {
|
|
5515
5590
|
return e === "textEntry" ? `[TEXTENTRY:${t}]` : `[INLINECHOICE:${t}]`;
|
|
5516
5591
|
}
|
|
5517
|
-
function
|
|
5518
|
-
return !!
|
|
5592
|
+
function kc(e, t, n) {
|
|
5593
|
+
return !!Ac(e, t, n);
|
|
5519
5594
|
}
|
|
5520
|
-
function
|
|
5595
|
+
function Ac(e, t, n) {
|
|
5521
5596
|
return e.find((e) => e.responseId === t && e.type === n) ?? null;
|
|
5522
5597
|
}
|
|
5523
5598
|
//#endregion
|
|
5524
5599
|
//#region src/components/ItemBody.svelte
|
|
5525
|
-
var
|
|
5600
|
+
var jc = 0, Mc = /* @__PURE__ */ Y("<div class=\"qti-item-body svelte-11qbngh\"><div class=\"prose max-w-none mb-4\"><div class=\"inline-interaction-container svelte-11qbngh\"></div></div> <!></div>"), Nc = {
|
|
5526
5601
|
hash: "svelte-11qbngh",
|
|
5527
5602
|
code: "\n /* Allow the whole item body to shrink inside flex/grid layouts (prevents overflow). */.qti-item-body.svelte-11qbngh {max-width:100%;min-width:0;}\n\n /*\n * Custom elements default to inline; force them to be block-level and width-contained.\n * This prevents wide interactions (SVGs, tables, canvases) from spilling outside panels.\n */.qti-item-body :is(\n pie-qti-choice,\n pie-qti-slider,\n pie-qti-order,\n pie-qti-match,\n pie-qti-associate,\n pie-qti-gap-match,\n pie-qti-hotspot,\n pie-qti-hottext,\n pie-qti-media,\n pie-qti-custom,\n pie-qti-end-attempt,\n pie-qti-position-object,\n pie-qti-graphic-gap-match,\n pie-qti-graphic-order,\n pie-qti-graphic-associate,\n pie-qti-select-point,\n pie-qti-extended-text\n ) {display:block;max-width:100%;min-width:0;}\n\n /* Keep inline interactions from breaking paragraph flow */.inline-interaction-container.svelte-11qbngh p {display:inline;}\n\n /*\n * Hide all QTI interaction elements wrapped with qti-hidden-interaction.\n * These are rendered separately as web components above.\n * Keeping them in the HTML (but hidden) makes debugging easier and is fully extensible.\n * Any *Interaction element will be automatically wrapped and hidden - no hardcoded list needed!\n */.qti-item-body .qti-hidden-interaction {display:none !important;}\n\n /*\n * Style for inline feedback elements that appear within choice text or other content.\n * Provides visual distinction and spacing for feedback that appears inline with content.\n */.qti-feedback-inline {display:inline-block;margin-left:0.5rem;padding-left:0.5rem;border-left:2px solid var(--color-base-content, currentColor);opacity:0.8;}\n\n /* QTI 3.0 Shared Stimulus: stimulus blocks that were prepended before the item body */.qti-stimulus-block {margin-bottom:1rem;}\n\n /* QTI 3.0 Shared Vocabulary: qti-input-width-N sets minimum input width in character units. */.qti-input-width-1 {min-width:1ch;}.qti-input-width-2 {min-width:2ch;}.qti-input-width-3 {min-width:3ch;}.qti-input-width-4 {min-width:4ch;}.qti-input-width-5 {min-width:5ch;}.qti-input-width-6 {min-width:6ch;}.qti-input-width-10 {min-width:10ch;}.qti-input-width-15 {min-width:15ch;}.qti-input-width-20 {min-width:20ch;}.qti-input-width-25 {min-width:25ch;}.qti-input-width-30 {min-width:30ch;}.qti-input-width-35 {min-width:35ch;}.qti-input-width-40 {min-width:40ch;}.qti-input-width-45 {min-width:45ch;}.qti-input-width-50 {min-width:50ch;}.qti-input-width-72 {min-width:72ch;}"
|
|
5528
5603
|
};
|
|
5529
|
-
function
|
|
5530
|
-
yt(t, !0), _a(e,
|
|
5531
|
-
let n = Q(t, "responses", 19, () => ({})), r = Q(t, "disabled", 3, !1), i = Q(t, "role", 3, "candidate"), a = Q(t, "onResponseChange", 3, () => {}), o = Q(t, "outcomeValues", 19, () => ({})), s = Q(t, "stimulusContent", 19, () => ({})), c = `qti-item-body-${++
|
|
5604
|
+
function Pc(e, t) {
|
|
5605
|
+
yt(t, !0), _a(e, Nc);
|
|
5606
|
+
let n = Q(t, "responses", 19, () => ({})), r = Q(t, "disabled", 3, !1), i = Q(t, "role", 3, "candidate"), a = Q(t, "onResponseChange", 3, () => {}), o = Q(t, "outcomeValues", 19, () => ({})), s = Q(t, "stimulusContent", 19, () => ({})), c = `qti-item-body-${++jc}`, l = `[data-qti-item-body-scope="${c}"]`, u = /* @__PURE__ */ I(() => oe(t.heuristicsConfig)), d = /* @__PURE__ */ I(() => t.player.getComponentRegistry()), f = /* @__PURE__ */ I(() => gc(i())), p = /* @__PURE__ */ I(() => r() || J(f).isReadOnly), m = /* @__PURE__ */ I(() => t.player.getInteractionData()), h = /* @__PURE__ */ I(() => J(f).canViewCorrectResponses ? t.player.getCorrectResponses() : {}), g = /* @__PURE__ */ I(() => J(m).filter((e) => !wc(e.type)).map((e) => {
|
|
5532
5607
|
try {
|
|
5533
5608
|
return {
|
|
5534
5609
|
interaction: e,
|
|
@@ -5538,13 +5613,13 @@ function Dc(e, t) {
|
|
|
5538
5613
|
return console.error(`Failed to get tag name for ${e.type}:`, t), null;
|
|
5539
5614
|
}
|
|
5540
5615
|
}).filter((e) => e !== null)), _ = /* @__PURE__ */ I(() => {
|
|
5541
|
-
let e = t.player.getItemBodyHtml(), n = t.deliveryContext ?? t.player.getDeliveryContext(), r =
|
|
5542
|
-
return e =
|
|
5616
|
+
let e = t.player.getItemBodyHtml(), n = t.deliveryContext ?? t.player.getDeliveryContext(), r = ic(n, l), i = uc(n, s(), (e) => t.player.sanitizeHtmlContent(e));
|
|
5617
|
+
return e = dc(e, i), r && (e = `<style data-qti-stylesheets="resolved">${r}</style>${e}`), e = Fs(e, {
|
|
5543
5618
|
outcomeValues: o(),
|
|
5544
5619
|
applyHeuristics: J(u).feedbackTextFormatting,
|
|
5545
5620
|
wrapWithSpan: !1
|
|
5546
|
-
}), e = e.replace(/<(\w+Interaction|qti-[\w-]+-interaction)(\s[^>]*)?>[\s\S]*?<\/\1>/gi, (e, t) =>
|
|
5547
|
-
}), v = /* @__PURE__ */ I(() =>
|
|
5621
|
+
}), e = e.replace(/<(\w+Interaction|qti-[\w-]+-interaction)(\s[^>]*)?>[\s\S]*?<\/\1>/gi, (e, t) => Tc(t.toLowerCase()) ? e : `<span class="qti-hidden-interaction">${e}</span>`), e;
|
|
5622
|
+
}), v = /* @__PURE__ */ I(() => Dc(J(_), J(m)));
|
|
5548
5623
|
function y(e) {
|
|
5549
5624
|
let t = n()[e];
|
|
5550
5625
|
return typeof t == "string" ? t : "";
|
|
@@ -5579,7 +5654,7 @@ function Dc(e, t) {
|
|
|
5579
5654
|
destroy() {}
|
|
5580
5655
|
};
|
|
5581
5656
|
}
|
|
5582
|
-
var ie =
|
|
5657
|
+
var ie = Mc(), ae = V(ie), se = V(ae);
|
|
5583
5658
|
la(se, 21, () => J(v), aa, (e, n) => {
|
|
5584
5659
|
var r = Ui(), i = xr(r), a = (e) => {
|
|
5585
5660
|
var t = Ui();
|
|
@@ -5588,7 +5663,7 @@ function Dc(e, t) {
|
|
|
5588
5663
|
let r = /* @__PURE__ */ I(() => J(f).canViewCorrectResponses ? J(h)[J(n).interaction.responseId] ?? null : null);
|
|
5589
5664
|
{
|
|
5590
5665
|
let i = /* @__PURE__ */ I(() => y(J(n).interaction.responseId)), a = /* @__PURE__ */ I(() => J(f).canViewCorrectResponses ? J(r) : null);
|
|
5591
|
-
|
|
5666
|
+
Cc(e, {
|
|
5592
5667
|
get interaction() {
|
|
5593
5668
|
return J(n).interaction;
|
|
5594
5669
|
},
|
|
@@ -5611,7 +5686,7 @@ function Dc(e, t) {
|
|
|
5611
5686
|
let r = /* @__PURE__ */ I(() => J(f).canViewCorrectResponses ? J(h)[J(n).interaction.responseId] ?? null : null);
|
|
5612
5687
|
{
|
|
5613
5688
|
let i = /* @__PURE__ */ I(() => y(J(n).interaction.responseId)), a = /* @__PURE__ */ I(() => J(f).canViewCorrectResponses ? J(r) : null);
|
|
5614
|
-
|
|
5689
|
+
bc(e, {
|
|
5615
5690
|
get interaction() {
|
|
5616
5691
|
return J(n).interaction;
|
|
5617
5692
|
},
|
|
@@ -5650,16 +5725,16 @@ function Dc(e, t) {
|
|
|
5650
5725
|
role: J(f).canViewCorrectResponses ? "scorer" : void 0
|
|
5651
5726
|
}));
|
|
5652
5727
|
}), X(e, s);
|
|
5653
|
-
}), E(ie), Xa(ie, (e) => R(x, e), () => J(x)), va(ie, (e, t) =>
|
|
5728
|
+
}), E(ie), Xa(ie, (e) => R(x, e), () => J(x)), va(ie, (e, t) => Is?.(e, t), () => ({ typeset: t.typeset })), va(ie, (e, t) => nc?.(e, t), () => ({ player: t.player })), H(() => Z(ie, "data-qti-item-body-scope", c)), X(e, ie), bt();
|
|
5654
5729
|
}
|
|
5655
5730
|
//#endregion
|
|
5656
5731
|
//#region src/components/ModalFeedbackDisplay.svelte
|
|
5657
|
-
var
|
|
5732
|
+
var Fc = /* @__PURE__ */ Y("<h3 class=\"font-bold text-lg mb-2\"> </h3>"), Ic = /* @__PURE__ */ Y("<div class=\"prose max-w-none\"></div>"), Lc = /* @__PURE__ */ Y("<div class=\"prose max-w-none\"></div>"), Rc = /* @__PURE__ */ Y("<div><!> <!></div>"), zc = /* @__PURE__ */ Y("<dialog open=\"\" class=\"modal modal-open svelte-i66ia0\" aria-modal=\"true\"><div class=\"modal-box max-w-3xl svelte-i66ia0\"><button class=\"btn btn-sm btn-circle btn-ghost absolute right-2 top-2\" type=\"button\">✕</button> <!> <div class=\"modal-action\"><button class=\"btn btn-primary\" type=\"button\"> </button></div></div></dialog>"), Bc = {
|
|
5658
5733
|
hash: "svelte-i66ia0",
|
|
5659
5734
|
code: "\n /* Ensure modal is accessible */dialog.svelte-i66ia0 {background-color:rgba(0, 0, 0, 0.5);}\n\n /* Ensure feedback content is readable */.modal-box.svelte-i66ia0 {max-height:80vh;overflow-y:auto;}"
|
|
5660
5735
|
};
|
|
5661
|
-
function
|
|
5662
|
-
yt(t, !0), _a(e,
|
|
5736
|
+
function Vc(e, t) {
|
|
5737
|
+
yt(t, !0), _a(e, Bc);
|
|
5663
5738
|
let n = Q(t, "feedback", 19, () => []), r = /* @__PURE__ */ I(() => n().length > 0), i = "item-player-modal-feedback-title", a = /* @__PURE__ */ I(() => n().find((e) => e.title)?.title);
|
|
5664
5739
|
function o() {
|
|
5665
5740
|
t.onClose?.();
|
|
@@ -5668,10 +5743,10 @@ function Pc(e, t) {
|
|
|
5668
5743
|
e.target === e.currentTarget && o();
|
|
5669
5744
|
}
|
|
5670
5745
|
var c = Ui(), l = xr(c), u = (e) => {
|
|
5671
|
-
var r =
|
|
5746
|
+
var r = zc(), c = V(r), l = V(c), u = Sr(l, 2);
|
|
5672
5747
|
la(u, 17, n, aa, (e, r, a) => {
|
|
5673
|
-
var o =
|
|
5674
|
-
var t =
|
|
5748
|
+
var o = Rc(), s = V(o), c = (e) => {
|
|
5749
|
+
var t = Fc();
|
|
5675
5750
|
Z(t, "id", a === 0 ? i : void 0);
|
|
5676
5751
|
var n = V(t, !0);
|
|
5677
5752
|
E(t), H(() => Wi(n, J(r).title)), X(e, t);
|
|
@@ -5680,10 +5755,10 @@ function Pc(e, t) {
|
|
|
5680
5755
|
J(r).title && e(c);
|
|
5681
5756
|
});
|
|
5682
5757
|
var l = Sr(s, 2), u = (e) => {
|
|
5683
|
-
var n =
|
|
5684
|
-
ha(n, () => J(r).content, !0), E(n), va(n, (e, t) =>
|
|
5758
|
+
var n = Ic();
|
|
5759
|
+
ha(n, () => J(r).content, !0), E(n), va(n, (e, t) => Is?.(e, t), () => ({ typeset: t.typeset })), X(e, n);
|
|
5685
5760
|
}, d = (e) => {
|
|
5686
|
-
var t =
|
|
5761
|
+
var t = Lc();
|
|
5687
5762
|
ha(t, () => J(r).content, !0), E(t), X(e, t);
|
|
5688
5763
|
};
|
|
5689
5764
|
ia(l, (e) => {
|
|
@@ -5706,13 +5781,13 @@ function Pc(e, t) {
|
|
|
5706
5781
|
Ii(["click"]);
|
|
5707
5782
|
//#endregion
|
|
5708
5783
|
//#region src/components/ItemPlayer.svelte
|
|
5709
|
-
var
|
|
5710
|
-
function
|
|
5784
|
+
var Hc = /* @__PURE__ */ Y("<div class=\"alert alert-error\"><span> </span></div>"), Uc = /* @__PURE__ */ Y("<span class=\"badge badge-success\"> </span>"), Wc = /* @__PURE__ */ Y("<span> </span>"), Gc = /* @__PURE__ */ Y("<div class=\"text-sm text-base-content/70\"><!></div>"), Kc = /* @__PURE__ */ Y("<div class=\"mt-6 flex items-center gap-4\"><button class=\"btn btn-primary\"> </button> <!></div>"), qc = /* @__PURE__ */ Y("<!> <!> <!>", 1), Jc = /* @__PURE__ */ Y("<div class=\"alert alert-info\"><span> </span></div>"), Yc = /* @__PURE__ */ Y("<div class=\"qti-item-player\"><!></div>");
|
|
5785
|
+
function Xc(e, t) {
|
|
5711
5786
|
yt(t, !0);
|
|
5712
5787
|
let n = Q(t, "role", 3, "candidate"), r = Q(t, "disabled", 3, !1), i = /* @__PURE__ */ I(() => t.typeset ?? ae), a = /* @__PURE__ */ L(null), o = /* @__PURE__ */ L(fr({})), s = /* @__PURE__ */ L(null), c = /* @__PURE__ */ L(fr([])), l = /* @__PURE__ */ L(fr({})), u = /* @__PURE__ */ L(!1), d = /* @__PURE__ */ L(!1), f = /* @__PURE__ */ L(0);
|
|
5713
5788
|
Fr(() => {
|
|
5714
5789
|
try {
|
|
5715
|
-
R(a, new
|
|
5790
|
+
R(a, new ks({
|
|
5716
5791
|
itemXml: t.itemXml,
|
|
5717
5792
|
role: n(),
|
|
5718
5793
|
security: t.security
|
|
@@ -5743,12 +5818,12 @@ function Uc(e, t) {
|
|
|
5743
5818
|
function h() {
|
|
5744
5819
|
R(c, [], !0);
|
|
5745
5820
|
}
|
|
5746
|
-
var g =
|
|
5747
|
-
var t =
|
|
5821
|
+
var g = Yc(), _ = V(g), v = (e) => {
|
|
5822
|
+
var t = Hc(), n = V(t), r = V(n, !0);
|
|
5748
5823
|
E(n), E(t), H(() => Wi(r, J(s))), X(e, t);
|
|
5749
5824
|
}, y = (e) => {
|
|
5750
|
-
var s =
|
|
5751
|
-
|
|
5825
|
+
var s = qc(), g = xr(s);
|
|
5826
|
+
Pc(g, {
|
|
5752
5827
|
get player() {
|
|
5753
5828
|
return J(a);
|
|
5754
5829
|
},
|
|
@@ -5774,14 +5849,14 @@ function Uc(e, t) {
|
|
|
5774
5849
|
});
|
|
5775
5850
|
var _ = Sr(g, 2), v = (e) => {
|
|
5776
5851
|
let n = /* @__PURE__ */ I(() => J(a).canSubmitResponses(J(o)));
|
|
5777
|
-
var r =
|
|
5852
|
+
var r = Kc(), i = V(r), s = V(i, !0);
|
|
5778
5853
|
E(i);
|
|
5779
5854
|
var c = Sr(i, 2), l = (e) => {
|
|
5780
|
-
var n =
|
|
5781
|
-
var n =
|
|
5855
|
+
var n = Gc(), r = V(n), i = (e) => {
|
|
5856
|
+
var n = Uc(), r = V(n, !0);
|
|
5782
5857
|
E(n), H((e) => Wi(r, e), [() => t.i18n?.t("item.complete") ?? "item.complete"]), X(e, n);
|
|
5783
5858
|
}, a = (e) => {
|
|
5784
|
-
var n =
|
|
5859
|
+
var n = Wc(), r = V(n, !0);
|
|
5785
5860
|
E(n), H((e) => Wi(r, e), [() => t.i18n?.t("item.attempt", { numAttempts: J(f) + 1 }) ?? `item.attempt (${J(f) + 1})`]), X(e, n);
|
|
5786
5861
|
};
|
|
5787
5862
|
ia(r, (e) => {
|
|
@@ -5796,7 +5871,7 @@ function Uc(e, t) {
|
|
|
5796
5871
|
};
|
|
5797
5872
|
ia(_, (e) => {
|
|
5798
5873
|
n() === "candidate" && !r() && t.onSubmit && e(v);
|
|
5799
|
-
}),
|
|
5874
|
+
}), Vc(Sr(_, 2), {
|
|
5800
5875
|
get feedback() {
|
|
5801
5876
|
return J(c);
|
|
5802
5877
|
},
|
|
@@ -5809,7 +5884,7 @@ function Uc(e, t) {
|
|
|
5809
5884
|
}
|
|
5810
5885
|
}), X(e, s);
|
|
5811
5886
|
}, b = (e) => {
|
|
5812
|
-
var n =
|
|
5887
|
+
var n = Jc(), r = V(n), i = V(r, !0);
|
|
5813
5888
|
E(r), E(n), H((e) => Wi(i, e), [() => t.i18n?.t("item.loading") ?? "item.loading"]), X(e, n);
|
|
5814
5889
|
};
|
|
5815
5890
|
ia(_, (e) => {
|
|
@@ -5819,94 +5894,94 @@ function Uc(e, t) {
|
|
|
5819
5894
|
Ii(["click"]);
|
|
5820
5895
|
//#endregion
|
|
5821
5896
|
//#region src/element.ts
|
|
5822
|
-
var
|
|
5897
|
+
var Zc, Qc = "pie-qti-item-player", $c = /* @__PURE__ */ new WeakMap(), el = /* @__PURE__ */ new WeakMap(), tl = /* @__PURE__ */ new WeakMap(), nl = /* @__PURE__ */ new WeakMap(), rl = /* @__PURE__ */ new WeakMap(), il = /* @__PURE__ */ new WeakMap(), al = /* @__PURE__ */ new WeakMap(), ol = /* @__PURE__ */ new WeakMap(), sl = /* @__PURE__ */ new WeakMap(), cl = /* @__PURE__ */ new WeakMap(), ll = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakSet(), ul = class extends HTMLElement {
|
|
5823
5898
|
constructor(...e) {
|
|
5824
|
-
super(...e), Ft(this, $), k(this,
|
|
5899
|
+
super(...e), Ft(this, $), k(this, $c, null), k(this, el, null), k(this, tl, ""), k(this, nl, "candidate"), k(this, rl, !1), k(this, il, void 0), k(this, al, void 0), k(this, ol, void 0), k(this, sl, void 0), k(this, cl, void 0), k(this, ll, void 0);
|
|
5825
5900
|
}
|
|
5826
5901
|
get typeset() {
|
|
5827
|
-
return j(
|
|
5902
|
+
return j(il, this);
|
|
5828
5903
|
}
|
|
5829
5904
|
set typeset(e) {
|
|
5830
|
-
M(
|
|
5905
|
+
M(il, this, e), A($, this, pl).call(this);
|
|
5831
5906
|
}
|
|
5832
5907
|
get i18n() {
|
|
5833
|
-
return j(
|
|
5908
|
+
return j(al, this);
|
|
5834
5909
|
}
|
|
5835
5910
|
set i18n(e) {
|
|
5836
|
-
M(
|
|
5911
|
+
M(al, this, e), A($, this, pl).call(this);
|
|
5837
5912
|
}
|
|
5838
5913
|
get security() {
|
|
5839
|
-
return j(
|
|
5914
|
+
return j(ol, this);
|
|
5840
5915
|
}
|
|
5841
5916
|
set security(e) {
|
|
5842
|
-
M(
|
|
5917
|
+
M(ol, this, e), A($, this, pl).call(this);
|
|
5843
5918
|
}
|
|
5844
5919
|
get onResponseChange() {
|
|
5845
|
-
return j(
|
|
5920
|
+
return j(sl, this);
|
|
5846
5921
|
}
|
|
5847
5922
|
set onResponseChange(e) {
|
|
5848
|
-
M(
|
|
5923
|
+
M(sl, this, e), A($, this, pl).call(this);
|
|
5849
5924
|
}
|
|
5850
5925
|
get onSubmit() {
|
|
5851
|
-
return j(
|
|
5926
|
+
return j(cl, this);
|
|
5852
5927
|
}
|
|
5853
5928
|
set onSubmit(e) {
|
|
5854
|
-
M(
|
|
5929
|
+
M(cl, this, e), A($, this, pl).call(this);
|
|
5855
5930
|
}
|
|
5856
5931
|
get onComplete() {
|
|
5857
|
-
return j(
|
|
5932
|
+
return j(ll, this);
|
|
5858
5933
|
}
|
|
5859
5934
|
set onComplete(e) {
|
|
5860
|
-
M(
|
|
5935
|
+
M(ll, this, e), A($, this, pl).call(this);
|
|
5861
5936
|
}
|
|
5862
5937
|
connectedCallback() {
|
|
5863
|
-
A($, this,
|
|
5938
|
+
A($, this, fl).call(this);
|
|
5864
5939
|
}
|
|
5865
5940
|
disconnectedCallback() {
|
|
5866
|
-
A($, this,
|
|
5941
|
+
A($, this, ml).call(this);
|
|
5867
5942
|
}
|
|
5868
5943
|
attributeChangedCallback(e, t, n) {
|
|
5869
|
-
e === "item-xml" ? M(
|
|
5944
|
+
e === "item-xml" ? M(tl, this, n ?? "") : e === "role" ? M(nl, this, n ?? "candidate") : e === "disabled" && M(rl, this, n !== null), A($, this, pl).call(this);
|
|
5870
5945
|
}
|
|
5871
5946
|
};
|
|
5872
|
-
|
|
5873
|
-
function
|
|
5947
|
+
Zc = ul;
|
|
5948
|
+
function dl() {
|
|
5874
5949
|
return {
|
|
5875
|
-
itemXml: j(
|
|
5876
|
-
role: j(
|
|
5877
|
-
disabled: j(
|
|
5878
|
-
typeset: j(
|
|
5879
|
-
i18n: j(
|
|
5880
|
-
security: j(
|
|
5881
|
-
onResponseChange: j(
|
|
5882
|
-
onSubmit: j(
|
|
5883
|
-
onComplete: j(
|
|
5950
|
+
itemXml: j(tl, this),
|
|
5951
|
+
role: j(nl, this),
|
|
5952
|
+
disabled: j(rl, this),
|
|
5953
|
+
typeset: j(il, this),
|
|
5954
|
+
i18n: j(al, this),
|
|
5955
|
+
security: j(ol, this),
|
|
5956
|
+
onResponseChange: j(sl, this),
|
|
5957
|
+
onSubmit: j(cl, this),
|
|
5958
|
+
onComplete: j(ll, this)
|
|
5884
5959
|
};
|
|
5885
5960
|
}
|
|
5886
|
-
function
|
|
5887
|
-
j(
|
|
5888
|
-
target: j(
|
|
5889
|
-
props: A($, this,
|
|
5961
|
+
function fl() {
|
|
5962
|
+
j(el, this) || (j($c, this) || (M($c, this, document.createElement("div")), j($c, this).style.display = "contents", this.appendChild(j($c, this))), M(el, this, Gi(Xc, {
|
|
5963
|
+
target: j($c, this),
|
|
5964
|
+
props: A($, this, dl).call(this)
|
|
5890
5965
|
})));
|
|
5891
5966
|
}
|
|
5892
|
-
function
|
|
5893
|
-
j(
|
|
5967
|
+
function pl() {
|
|
5968
|
+
j(el, this) && (typeof j(el, this).$set == "function" ? j(el, this).$set(A($, this, dl).call(this)) : (A($, this, ml).call(this), A($, this, fl).call(this)));
|
|
5894
5969
|
}
|
|
5895
|
-
function
|
|
5896
|
-
if (j(
|
|
5970
|
+
function ml() {
|
|
5971
|
+
if (j(el, this)) {
|
|
5897
5972
|
try {
|
|
5898
|
-
Yi(j(
|
|
5973
|
+
Yi(j(el, this));
|
|
5899
5974
|
} catch {}
|
|
5900
|
-
M(
|
|
5975
|
+
M(el, this, null);
|
|
5901
5976
|
}
|
|
5902
|
-
j(
|
|
5977
|
+
j($c, this) && (j($c, this).remove(), M($c, this, null));
|
|
5903
5978
|
}
|
|
5904
|
-
|
|
5979
|
+
Zc.observedAttributes = [
|
|
5905
5980
|
"item-xml",
|
|
5906
5981
|
"role",
|
|
5907
5982
|
"disabled"
|
|
5908
|
-
], customElements.get(
|
|
5983
|
+
], customElements.get(Qc) || customElements.define(Qc, ul);
|
|
5909
5984
|
//#endregion
|
|
5910
|
-
export {
|
|
5985
|
+
export { ul as PieQtiItemPlayerElement };
|
|
5911
5986
|
|
|
5912
5987
|
//# sourceMappingURL=element.js.map
|