@citolab/qti-components 7.16.0 → 7.17.0
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/base.d.ts +48 -8
- package/dist/base.js +49 -2
- package/dist/base.js.map +1 -1
- package/dist/chunk-2DOYPVF5.js +481 -0
- package/dist/chunk-2DOYPVF5.js.map +1 -0
- package/dist/chunk-2ZEJ3RR5.js +89 -0
- package/dist/chunk-2ZEJ3RR5.js.map +1 -0
- package/dist/chunk-352OTVTY.js +3330 -0
- package/dist/chunk-352OTVTY.js.map +1 -0
- package/dist/chunk-C2HQFI2C.js +5927 -0
- package/dist/chunk-C2HQFI2C.js.map +1 -0
- package/dist/chunk-DWIRLYDS.js +20 -0
- package/dist/chunk-DWIRLYDS.js.map +1 -0
- package/dist/chunk-EUXUH3YW.js +15 -0
- package/dist/chunk-EUXUH3YW.js.map +1 -0
- package/dist/chunk-F44CI35W.js +145 -0
- package/dist/chunk-F44CI35W.js.map +1 -0
- package/dist/chunk-INKI27D5.js +493 -0
- package/dist/chunk-INKI27D5.js.map +1 -0
- package/dist/chunk-JEUY3MYB.js +2010 -0
- package/dist/chunk-JEUY3MYB.js.map +1 -0
- package/dist/chunk-O4XIWHTF.js +1139 -0
- package/dist/chunk-O4XIWHTF.js.map +1 -0
- package/dist/chunk-RI47B4ZT.js +1753 -0
- package/dist/chunk-RI47B4ZT.js.map +1 -0
- package/dist/chunk-VEV4DGPH.js +31 -0
- package/dist/chunk-VEV4DGPH.js.map +1 -0
- package/dist/chunk-W4SQRNWO.js +3844 -0
- package/dist/chunk-W4SQRNWO.js.map +1 -0
- package/dist/computed-item.context-CiddHLPz.d.ts +22 -0
- package/dist/computed.context-CH09_LCR.d.ts +45 -0
- package/dist/config.context-DAdkDDf5.d.ts +14 -0
- package/dist/elements.d.ts +318 -1
- package/dist/elements.js +41 -2
- package/dist/elements.js.map +1 -1
- package/dist/index.d.ts +21 -8
- package/dist/index.js +327 -9
- package/dist/index.js.map +1 -1
- package/dist/interaction-C5Up6-68.d.ts +56 -0
- package/dist/interactions.d.ts +913 -1
- package/dist/interactions.js +71 -2
- package/dist/interactions.js.map +1 -1
- package/dist/item.context-BRKXBC3m.d.ts +10 -0
- package/dist/item.d.ts +147 -1
- package/dist/item.js +22 -2
- package/dist/item.js.map +1 -1
- package/dist/loader.d.ts +21 -1
- package/dist/loader.js +10 -2
- package/dist/loader.js.map +1 -1
- package/dist/processing.d.ts +393 -1
- package/dist/processing.js +102 -2
- package/dist/processing.js.map +1 -1
- package/dist/qti-feedback-B4cMzOcq.d.ts +21 -0
- package/dist/qti-rule-base-dL4opfvi.d.ts +39 -0
- package/dist/qti-transform-test-Bz9A3hmD.d.ts +63 -0
- package/dist/test.context-Bpw1HNAZ.d.ts +28 -0
- package/dist/test.d.ts +569 -1
- package/dist/test.js +60 -2
- package/dist/test.js.map +1 -1
- package/dist/transformers.d.ts +18 -1
- package/dist/transformers.js +11 -2
- package/dist/transformers.js.map +1 -1
- package/dist/variables-CusMRnyJ.d.ts +69 -0
- package/package.json +8 -14
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
// ../qti-transformers/src/qti-transformers.ts
|
|
2
|
+
var xml = String.raw;
|
|
3
|
+
var xmlToHTML = xml`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
4
|
+
<xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" />
|
|
5
|
+
<xsl:template match="@*|node()">
|
|
6
|
+
<xsl:copy>
|
|
7
|
+
<xsl:apply-templates select="@*|node()"/>
|
|
8
|
+
</xsl:copy>
|
|
9
|
+
</xsl:template>
|
|
10
|
+
|
|
11
|
+
<!-- remove existing namespaces -->
|
|
12
|
+
<xsl:template match="*">
|
|
13
|
+
<!-- remove element prefix -->
|
|
14
|
+
<xsl:element name="{local-name()}">
|
|
15
|
+
<!-- process attributes -->
|
|
16
|
+
<xsl:for-each select="@*">
|
|
17
|
+
<!-- remove attribute prefix -->
|
|
18
|
+
<xsl:attribute name="{local-name()}">
|
|
19
|
+
<xsl:value-of select="."/>
|
|
20
|
+
</xsl:attribute>
|
|
21
|
+
</xsl:for-each>
|
|
22
|
+
<xsl:apply-templates/>
|
|
23
|
+
</xsl:element>
|
|
24
|
+
</xsl:template>
|
|
25
|
+
</xsl:stylesheet>`;
|
|
26
|
+
function extendElementName(xmlFragment, tagName, extension) {
|
|
27
|
+
xmlFragment.querySelectorAll(tagName).forEach((element) => {
|
|
28
|
+
const newTagName = `${tagName}-${extension}`;
|
|
29
|
+
const newElement = createElementWithNewTagName(element, newTagName);
|
|
30
|
+
element.replaceWith(newElement);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function extendElementsWithClass(xmlFragment, classNamePattern) {
|
|
34
|
+
xmlFragment.querySelectorAll("*").forEach((element) => {
|
|
35
|
+
const classList = element.classList;
|
|
36
|
+
if (classList) {
|
|
37
|
+
classList.forEach((className) => {
|
|
38
|
+
if (className.startsWith(`${classNamePattern}:`)) {
|
|
39
|
+
const suffix = className.slice(`${classNamePattern}:`.length);
|
|
40
|
+
const newTagName = `${element.nodeName}-${suffix}`;
|
|
41
|
+
const newElement = createElementWithNewTagName(element, newTagName);
|
|
42
|
+
element.replaceWith(newElement);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function createElementWithNewTagName(element, newTagName) {
|
|
49
|
+
const newElement = element.ownerDocument.createElement(newTagName);
|
|
50
|
+
for (const attr of element.attributes) {
|
|
51
|
+
newElement.setAttribute(attr.name, attr.value);
|
|
52
|
+
}
|
|
53
|
+
while (element.firstChild) {
|
|
54
|
+
newElement.appendChild(element.firstChild);
|
|
55
|
+
}
|
|
56
|
+
return newElement;
|
|
57
|
+
}
|
|
58
|
+
function itemsFromTest(xmlFragment) {
|
|
59
|
+
const items = [];
|
|
60
|
+
xmlFragment.querySelectorAll("qti-assessment-item-ref").forEach((el) => {
|
|
61
|
+
const identifier = el.getAttribute("identifier");
|
|
62
|
+
const href = el.getAttribute("href");
|
|
63
|
+
const category = el.getAttribute("category");
|
|
64
|
+
items.push({ identifier, href, category });
|
|
65
|
+
});
|
|
66
|
+
return items;
|
|
67
|
+
}
|
|
68
|
+
function loadXML(url, signal) {
|
|
69
|
+
return fetch(url, { signal }).then((response) => {
|
|
70
|
+
if (!response.ok) {
|
|
71
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
72
|
+
}
|
|
73
|
+
return response.text();
|
|
74
|
+
}).then((text) => {
|
|
75
|
+
const parser = new DOMParser();
|
|
76
|
+
return parser.parseFromString(text, "text/xml");
|
|
77
|
+
}).catch((error) => {
|
|
78
|
+
if (error.name === "AbortError") {
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
throw new Error(`Failed to load XML: ${error.message}`);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function parseXML(xmlDocument) {
|
|
85
|
+
const parser = new DOMParser();
|
|
86
|
+
const xmlFragment = parser.parseFromString(xmlDocument, "text/xml");
|
|
87
|
+
return xmlFragment;
|
|
88
|
+
}
|
|
89
|
+
function toHTML(xmlFragment) {
|
|
90
|
+
const processor = new XSLTProcessor();
|
|
91
|
+
const xsltDocument = new DOMParser().parseFromString(xmlToHTML, "text/xml");
|
|
92
|
+
processor.importStylesheet(xsltDocument);
|
|
93
|
+
const itemHTMLFragment = processor.transformToFragment(xmlFragment, document);
|
|
94
|
+
return itemHTMLFragment;
|
|
95
|
+
}
|
|
96
|
+
function setLocation(xmlFragment, location) {
|
|
97
|
+
if (!location.endsWith("/")) {
|
|
98
|
+
location += "/";
|
|
99
|
+
}
|
|
100
|
+
xmlFragment.querySelectorAll("[src],[href],[primary-path]").forEach((elWithSrc) => {
|
|
101
|
+
let attr = "";
|
|
102
|
+
if (elWithSrc.getAttribute("src")) {
|
|
103
|
+
attr = "src";
|
|
104
|
+
}
|
|
105
|
+
if (elWithSrc.getAttribute("href")) {
|
|
106
|
+
attr = "href";
|
|
107
|
+
}
|
|
108
|
+
if (elWithSrc.getAttribute("primary-path")) {
|
|
109
|
+
attr = "primary-path";
|
|
110
|
+
}
|
|
111
|
+
const attrValue = elWithSrc.getAttribute(attr)?.trim();
|
|
112
|
+
if (!/^(data:|https?:|blob:)/.test(attrValue)) {
|
|
113
|
+
const newSrcValue = location + encodeURI(attrValue);
|
|
114
|
+
elWithSrc.setAttribute(attr, newSrcValue);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function convertCDATAtoComment(xmlFragment) {
|
|
119
|
+
const cdataElements = xmlFragment.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value');
|
|
120
|
+
cdataElements.forEach((element) => {
|
|
121
|
+
const commentText = document.createComment(element.textContent);
|
|
122
|
+
element.replaceChild(commentText, element.firstChild);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function stripStyleSheets(xmlFragment) {
|
|
126
|
+
xmlFragment.querySelectorAll("qti-stylesheet").forEach((stylesheet) => stylesheet.remove());
|
|
127
|
+
}
|
|
128
|
+
function getShuffleQuerySelectorByTagName(tagName) {
|
|
129
|
+
switch (tagName) {
|
|
130
|
+
case "qti-choice-interaction":
|
|
131
|
+
case "qti-order-interaction":
|
|
132
|
+
return "qti-simple-choice";
|
|
133
|
+
case "qti-inline-choice-interaction":
|
|
134
|
+
return "qti-inline-choice";
|
|
135
|
+
case "qti-match-interaction":
|
|
136
|
+
return [
|
|
137
|
+
"qti-simple-match-set:first-of-type qti-simple-associable-choice",
|
|
138
|
+
"qti-simple-match-set:last-of-type > qti-simple-associable-choice"
|
|
139
|
+
];
|
|
140
|
+
case "qti-gap-match-interaction":
|
|
141
|
+
return "qti-gap-text";
|
|
142
|
+
case "qti-associate-interaction":
|
|
143
|
+
return "qti-simple-associable-choice";
|
|
144
|
+
default:
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ../qti-transformers/src/qti-transform-item.ts
|
|
150
|
+
var qtiTransformItem = (cache = false) => {
|
|
151
|
+
let xmlFragment;
|
|
152
|
+
let xmlUri = "";
|
|
153
|
+
const api = {
|
|
154
|
+
load(uri, signal) {
|
|
155
|
+
xmlUri = uri;
|
|
156
|
+
const fullKey = encodeURI(uri);
|
|
157
|
+
if (cache) {
|
|
158
|
+
if (sessionStorage.getItem(fullKey)) {
|
|
159
|
+
return Promise.resolve(api.parse(sessionStorage.getItem(fullKey)));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return loadXML(uri, signal).then((xml2) => {
|
|
163
|
+
xmlFragment = xml2;
|
|
164
|
+
api.shuffleInteractions();
|
|
165
|
+
if (cache) sessionStorage.setItem(fullKey, new XMLSerializer().serializeToString(xmlFragment));
|
|
166
|
+
return api;
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
parse(xmlString) {
|
|
170
|
+
xmlFragment = parseXML(xmlString);
|
|
171
|
+
return api;
|
|
172
|
+
},
|
|
173
|
+
path: (location) => {
|
|
174
|
+
setLocation(xmlFragment, location);
|
|
175
|
+
xmlUri = null;
|
|
176
|
+
return api;
|
|
177
|
+
},
|
|
178
|
+
fn(fn) {
|
|
179
|
+
fn(xmlFragment);
|
|
180
|
+
return api;
|
|
181
|
+
},
|
|
182
|
+
pciHooks(uri) {
|
|
183
|
+
const attributes = ["hook", "module"];
|
|
184
|
+
const documentPath = uri.substring(0, uri.lastIndexOf("/"));
|
|
185
|
+
for (const attribute of attributes) {
|
|
186
|
+
const srcAttributes = xmlFragment.querySelectorAll("[" + attribute + "]");
|
|
187
|
+
srcAttributes.forEach((node) => {
|
|
188
|
+
const srcValue = node.getAttribute(attribute);
|
|
189
|
+
if (!srcValue.startsWith("data:") && !srcValue.startsWith("http")) {
|
|
190
|
+
node.setAttribute("base-url", uri);
|
|
191
|
+
node.setAttribute(
|
|
192
|
+
"module",
|
|
193
|
+
documentPath + "/" + encodeURI(srcValue + (srcValue.endsWith(".js") ? "" : ".js"))
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
return api;
|
|
199
|
+
},
|
|
200
|
+
async configurePci(baseUrl, getModuleResolutionConfig, selector = "qti-portable-custom-interaction") {
|
|
201
|
+
const customInteractionTypeIdentifiers = [];
|
|
202
|
+
const portableCustomInteractions = xmlFragment.querySelectorAll(selector);
|
|
203
|
+
const moduleResolutionConfig = await getModuleResolutionConfig(baseUrl, "/modules/module_resolution.js");
|
|
204
|
+
const moduleResolutionFallbackConfig = await getModuleResolutionConfig(
|
|
205
|
+
baseUrl,
|
|
206
|
+
"/modules/fallback_module_resolution.js"
|
|
207
|
+
);
|
|
208
|
+
if (portableCustomInteractions.length > 0) {
|
|
209
|
+
for (const interaction of Array.from(portableCustomInteractions)) {
|
|
210
|
+
interaction.setAttribute("data-base-url", baseUrl);
|
|
211
|
+
let customInteractionTypeIdentifier = interaction.getAttribute("custom-interaction-type-identifier");
|
|
212
|
+
if (customInteractionTypeIdentifier && customInteractionTypeIdentifiers.includes(customInteractionTypeIdentifier)) {
|
|
213
|
+
customInteractionTypeIdentifier = customInteractionTypeIdentifier + customInteractionTypeIdentifiers.length;
|
|
214
|
+
interaction.setAttribute("custom-interaction-type-identifier", customInteractionTypeIdentifier);
|
|
215
|
+
customInteractionTypeIdentifiers.push(customInteractionTypeIdentifier);
|
|
216
|
+
}
|
|
217
|
+
if (customInteractionTypeIdentifier) {
|
|
218
|
+
customInteractionTypeIdentifiers.push(customInteractionTypeIdentifier);
|
|
219
|
+
}
|
|
220
|
+
let modulesElement = interaction.querySelector("qti-interaction-modules");
|
|
221
|
+
if (modulesElement && modulesElement.getAttribute("primary-configuration")) {
|
|
222
|
+
const primaryConfigPath = modulesElement.getAttribute("primary-configuration");
|
|
223
|
+
if (primaryConfigPath) {
|
|
224
|
+
try {
|
|
225
|
+
const primaryConfig = await getModuleResolutionConfig(baseUrl, `/${primaryConfigPath}`);
|
|
226
|
+
const existingModules = Array.from(modulesElement.querySelectorAll("qti-interaction-module"));
|
|
227
|
+
for (const moduleEl of existingModules) {
|
|
228
|
+
const moduleId = moduleEl.getAttribute("id");
|
|
229
|
+
if (moduleId && primaryConfig.paths && primaryConfig.paths[moduleId]) {
|
|
230
|
+
const primaryPath = primaryConfig.paths[moduleId];
|
|
231
|
+
const primaryPathString = Array.isArray(primaryPath) ? primaryPath[0] : primaryPath;
|
|
232
|
+
moduleEl.setAttribute("primary-path", primaryPathString);
|
|
233
|
+
if (moduleResolutionFallbackConfig && moduleResolutionFallbackConfig.paths && moduleResolutionFallbackConfig.paths[moduleId]) {
|
|
234
|
+
const fallbackPath = moduleResolutionFallbackConfig.paths[moduleId];
|
|
235
|
+
if (Array.isArray(fallbackPath)) {
|
|
236
|
+
moduleEl.setAttribute("fallback-path", fallbackPath[0]);
|
|
237
|
+
} else {
|
|
238
|
+
moduleEl.setAttribute("fallback-path", fallbackPath);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
if (primaryConfig.paths) {
|
|
244
|
+
for (const moduleId in primaryConfig.paths) {
|
|
245
|
+
const existingModule = modulesElement.querySelector(`qti-interaction-module[id="${moduleId}"]`);
|
|
246
|
+
if (!existingModule) {
|
|
247
|
+
const newModuleElement = xmlFragment.createElement("qti-interaction-module");
|
|
248
|
+
newModuleElement.setAttribute("id", moduleId);
|
|
249
|
+
const primaryPathString = Array.isArray(primaryConfig.paths[moduleId]) ? primaryConfig.paths[moduleId][0] : primaryConfig.paths[moduleId];
|
|
250
|
+
newModuleElement.setAttribute("primary-path", primaryPathString);
|
|
251
|
+
if (moduleResolutionFallbackConfig && moduleResolutionFallbackConfig.paths && moduleResolutionFallbackConfig.paths[moduleId]) {
|
|
252
|
+
const fallbackPath = moduleResolutionFallbackConfig.paths[moduleId];
|
|
253
|
+
if (Array.isArray(fallbackPath)) {
|
|
254
|
+
newModuleElement.setAttribute("fallback-path", fallbackPath[0]);
|
|
255
|
+
} else {
|
|
256
|
+
newModuleElement.setAttribute("fallback-path", fallbackPath);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
modulesElement.appendChild(newModuleElement);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (primaryConfig.urlArgs) {
|
|
264
|
+
modulesElement.setAttribute("url-args", primaryConfig.urlArgs);
|
|
265
|
+
}
|
|
266
|
+
} catch (error) {
|
|
267
|
+
console.warn(`Failed to load primary configuration: ${primaryConfigPath}`, error);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
} else {
|
|
271
|
+
if (moduleResolutionConfig) {
|
|
272
|
+
if (interaction.querySelector("qti-interaction-modules") === null) {
|
|
273
|
+
modulesElement = xmlFragment.createElement("qti-interaction-modules");
|
|
274
|
+
interaction.appendChild(modulesElement);
|
|
275
|
+
} else {
|
|
276
|
+
modulesElement = interaction.querySelector("qti-interaction-modules");
|
|
277
|
+
}
|
|
278
|
+
for (const module in moduleResolutionConfig.paths) {
|
|
279
|
+
const path = moduleResolutionConfig.paths[module];
|
|
280
|
+
let fallbackPath = "";
|
|
281
|
+
if (moduleResolutionFallbackConfig && moduleResolutionFallbackConfig.paths && moduleResolutionFallbackConfig.paths[module]) {
|
|
282
|
+
fallbackPath = moduleResolutionFallbackConfig.paths[module];
|
|
283
|
+
}
|
|
284
|
+
const primaryArray = Array.isArray(path) ? path : [path];
|
|
285
|
+
const fallbackPathArray = Array.isArray(fallbackPath) ? fallbackPath : [fallbackPath];
|
|
286
|
+
const paths = primaryArray.map((primaryPath, i) => {
|
|
287
|
+
const fallbackPath2 = fallbackPathArray.length > i ? fallbackPathArray[i] : "";
|
|
288
|
+
return {
|
|
289
|
+
primaryPath,
|
|
290
|
+
fallbackPath: fallbackPath2
|
|
291
|
+
};
|
|
292
|
+
});
|
|
293
|
+
for (const fallbackPath2 of fallbackPathArray) {
|
|
294
|
+
if (!paths.some((p) => p.fallbackPath === fallbackPath2)) {
|
|
295
|
+
paths.push({
|
|
296
|
+
primaryPath: primaryArray.length > 0 ? primaryArray[0] : fallbackPath2,
|
|
297
|
+
fallbackPath: fallbackPath2
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
for (const path2 of paths) {
|
|
302
|
+
const moduleElement = xmlFragment.createElement("qti-interaction-module");
|
|
303
|
+
if (path2.fallbackPath) {
|
|
304
|
+
moduleElement.setAttribute("fallback-path", path2.fallbackPath);
|
|
305
|
+
}
|
|
306
|
+
moduleElement.setAttribute("id", module);
|
|
307
|
+
moduleElement.setAttribute("primary-path", path2.primaryPath);
|
|
308
|
+
if (modulesElement) {
|
|
309
|
+
modulesElement.appendChild(moduleElement);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return api;
|
|
318
|
+
},
|
|
319
|
+
shuffleInteractions() {
|
|
320
|
+
const shuffleElements = xmlFragment.querySelectorAll(`[shuffle="true"]`);
|
|
321
|
+
const shuffleInteractions = Array.from(shuffleElements).filter(
|
|
322
|
+
(e) => e.tagName?.toLowerCase().endsWith("-interaction")
|
|
323
|
+
);
|
|
324
|
+
for (const shuffleInteraction of shuffleInteractions) {
|
|
325
|
+
const query = getShuffleQuerySelectorByTagName(shuffleInteraction.tagName.toLowerCase());
|
|
326
|
+
const queries = Array.isArray(query) ? query : [query];
|
|
327
|
+
for (const q of queries) {
|
|
328
|
+
const choices = Array.from(shuffleInteraction.querySelectorAll(q));
|
|
329
|
+
const fixedChoices = choices.map((choice, originalOrder2) => ({
|
|
330
|
+
element: choice,
|
|
331
|
+
fixed: choice.hasAttribute("fixed") && choice.getAttribute("fixed") === "true",
|
|
332
|
+
originalOrder: originalOrder2
|
|
333
|
+
})).filter((choice) => choice.fixed);
|
|
334
|
+
const nonFixedChoices = choices.filter(
|
|
335
|
+
(choice) => !choice.hasAttribute("fixed") || choice.getAttribute("fixed") !== "true"
|
|
336
|
+
);
|
|
337
|
+
if (nonFixedChoices.length <= 1) {
|
|
338
|
+
console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");
|
|
339
|
+
return api;
|
|
340
|
+
}
|
|
341
|
+
const originalOrder = [...nonFixedChoices];
|
|
342
|
+
let shuffled = false;
|
|
343
|
+
let attempts = 0;
|
|
344
|
+
while (!shuffled && attempts < 20) {
|
|
345
|
+
attempts++;
|
|
346
|
+
for (let i = nonFixedChoices.length - 1; i > 0; i--) {
|
|
347
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
348
|
+
[nonFixedChoices[i], nonFixedChoices[j]] = [nonFixedChoices[j], nonFixedChoices[i]];
|
|
349
|
+
}
|
|
350
|
+
shuffled = !nonFixedChoices.every((choice, index) => choice === originalOrder[index]);
|
|
351
|
+
}
|
|
352
|
+
if (!shuffled) {
|
|
353
|
+
console.warn("Failed to shuffle the choices after multiple attempts.");
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
shuffleInteraction.removeAttribute("shuffle");
|
|
357
|
+
let nonFixedIndex = 0;
|
|
358
|
+
for (const nonFixedChoice of nonFixedChoices) {
|
|
359
|
+
nonFixedChoice.parentElement.insertBefore(nonFixedChoice, fixedChoices[nonFixedIndex]?.element);
|
|
360
|
+
nonFixedIndex++;
|
|
361
|
+
}
|
|
362
|
+
for (const fixedChoice of fixedChoices) {
|
|
363
|
+
fixedChoice.element.parentElement.insertBefore(
|
|
364
|
+
fixedChoice.element,
|
|
365
|
+
nonFixedChoices[fixedChoice.originalOrder]
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return api;
|
|
371
|
+
},
|
|
372
|
+
extendElementName: (tagName, extension) => {
|
|
373
|
+
extendElementName(xmlFragment, tagName, extension);
|
|
374
|
+
return api;
|
|
375
|
+
},
|
|
376
|
+
extendElementsWithClass: (param = "extend") => {
|
|
377
|
+
extendElementsWithClass(xmlFragment, param);
|
|
378
|
+
return api;
|
|
379
|
+
},
|
|
380
|
+
customInteraction(baseRef, baseItem) {
|
|
381
|
+
const qtiCustomInteraction = xmlFragment.querySelector("qti-custom-interaction");
|
|
382
|
+
const qtiCustomInteractionObject = qtiCustomInteraction.querySelector("object");
|
|
383
|
+
qtiCustomInteraction.setAttribute("data-base-ref", baseRef);
|
|
384
|
+
qtiCustomInteraction.setAttribute("data-base-item", baseRef + baseItem);
|
|
385
|
+
qtiCustomInteraction.setAttribute("data", qtiCustomInteractionObject.getAttribute("data"));
|
|
386
|
+
qtiCustomInteraction.setAttribute("width", qtiCustomInteractionObject.getAttribute("width"));
|
|
387
|
+
qtiCustomInteraction.setAttribute("height", qtiCustomInteractionObject.getAttribute("height"));
|
|
388
|
+
qtiCustomInteraction.removeChild(qtiCustomInteractionObject);
|
|
389
|
+
return api;
|
|
390
|
+
},
|
|
391
|
+
convertCDATAtoComment() {
|
|
392
|
+
convertCDATAtoComment(xmlFragment);
|
|
393
|
+
return api;
|
|
394
|
+
},
|
|
395
|
+
stripStyleSheets() {
|
|
396
|
+
stripStyleSheets(xmlFragment);
|
|
397
|
+
return api;
|
|
398
|
+
},
|
|
399
|
+
html() {
|
|
400
|
+
if (xmlUri !== null) {
|
|
401
|
+
setLocation(xmlFragment, xmlUri.substring(0, xmlUri.lastIndexOf("/")));
|
|
402
|
+
}
|
|
403
|
+
return new XMLSerializer().serializeToString(toHTML(xmlFragment));
|
|
404
|
+
},
|
|
405
|
+
xml() {
|
|
406
|
+
return new XMLSerializer().serializeToString(xmlFragment);
|
|
407
|
+
},
|
|
408
|
+
htmlDoc() {
|
|
409
|
+
if (xmlUri !== null) {
|
|
410
|
+
setLocation(xmlFragment, xmlUri.substring(0, xmlUri.lastIndexOf("/")));
|
|
411
|
+
}
|
|
412
|
+
return toHTML(xmlFragment);
|
|
413
|
+
},
|
|
414
|
+
xmlDoc() {
|
|
415
|
+
return xmlFragment;
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
return api;
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
// ../qti-transformers/src/qti-transform-manifest.ts
|
|
422
|
+
var qtiTransformManifest = () => {
|
|
423
|
+
let xmlFragment;
|
|
424
|
+
const api = {
|
|
425
|
+
async load(uri, signal) {
|
|
426
|
+
return new Promise((resolve) => {
|
|
427
|
+
loadXML(uri, signal).then((xml2) => {
|
|
428
|
+
xmlFragment = xml2;
|
|
429
|
+
return resolve(api);
|
|
430
|
+
});
|
|
431
|
+
});
|
|
432
|
+
},
|
|
433
|
+
parse(xmlString) {
|
|
434
|
+
xmlFragment = parseXML(xmlString);
|
|
435
|
+
},
|
|
436
|
+
assessmentTest() {
|
|
437
|
+
const el = xmlFragment.querySelector('resource[type="imsqti_test_xmlv3p0"]');
|
|
438
|
+
return { href: el.getAttribute("href"), identifier: el.getAttribute("identifier") };
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
return api;
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
// ../qti-transformers/src/qti-transform-test.ts
|
|
445
|
+
var qtiTransformTest = () => {
|
|
446
|
+
let xmlFragment;
|
|
447
|
+
const api = {
|
|
448
|
+
async load(uri, signal) {
|
|
449
|
+
return new Promise((resolve, _) => {
|
|
450
|
+
loadXML(uri, signal).then((xml2) => {
|
|
451
|
+
xmlFragment = xml2;
|
|
452
|
+
api.path(uri.substring(0, uri.lastIndexOf("/")));
|
|
453
|
+
return resolve(api);
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
},
|
|
457
|
+
parse(xmlString) {
|
|
458
|
+
xmlFragment = parseXML(xmlString);
|
|
459
|
+
return api;
|
|
460
|
+
},
|
|
461
|
+
path: (location) => {
|
|
462
|
+
setLocation(xmlFragment, location);
|
|
463
|
+
return api;
|
|
464
|
+
},
|
|
465
|
+
fn(fn) {
|
|
466
|
+
fn(xmlFragment);
|
|
467
|
+
return api;
|
|
468
|
+
},
|
|
469
|
+
items() {
|
|
470
|
+
return itemsFromTest(xmlFragment);
|
|
471
|
+
},
|
|
472
|
+
html() {
|
|
473
|
+
return new XMLSerializer().serializeToString(toHTML(xmlFragment));
|
|
474
|
+
},
|
|
475
|
+
xml() {
|
|
476
|
+
return new XMLSerializer().serializeToString(xmlFragment);
|
|
477
|
+
},
|
|
478
|
+
htmlDoc() {
|
|
479
|
+
return toHTML(xmlFragment);
|
|
480
|
+
},
|
|
481
|
+
xmlDoc() {
|
|
482
|
+
return xmlFragment;
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
return api;
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
export {
|
|
489
|
+
qtiTransformItem,
|
|
490
|
+
qtiTransformManifest,
|
|
491
|
+
qtiTransformTest
|
|
492
|
+
};
|
|
493
|
+
//# sourceMappingURL=chunk-INKI27D5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../qti-transformers/src/qti-transformers.ts","../../qti-transformers/src/qti-transform-item.ts","../../qti-transformers/src/qti-transform-manifest.ts","../../qti-transformers/src/qti-transform-test.ts"],"sourcesContent":["const xml = String.raw;\n\n/* <!-- convert CDATA to comments -->\n <xsl:template match=\"text()[contains(., 'CDATA')]\">\n <xsl:comment>\n <xsl:value-of select=\".\"/>\n </xsl:comment>\n</xsl:template>\n*/\n\n/*\n <!-- remove xml comments -->\n <xsl:template match=\"comment()\" />\n */\n\nconst xmlToHTML = xml`<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n<xsl:output method=\"html\" version=\"5.0\" encoding=\"UTF-8\" indent=\"yes\" />\n <xsl:template match=\"@*|node()\">\n <xsl:copy>\n <xsl:apply-templates select=\"@*|node()\"/>\n </xsl:copy>\n </xsl:template>\n\n <!-- remove existing namespaces -->\n <xsl:template match=\"*\">\n <!-- remove element prefix -->\n <xsl:element name=\"{local-name()}\">\n <!-- process attributes -->\n <xsl:for-each select=\"@*\">\n <!-- remove attribute prefix -->\n <xsl:attribute name=\"{local-name()}\">\n <xsl:value-of select=\".\"/>\n </xsl:attribute>\n </xsl:for-each>\n <xsl:apply-templates/>\n </xsl:element>\n</xsl:template>\n</xsl:stylesheet>`;\n\n// Function to extend elements with a specific tag name by adding an extension suffix\nexport function extendElementName(xmlFragment: XMLDocument, tagName: string, extension: string) {\n xmlFragment.querySelectorAll(tagName).forEach(element => {\n const newTagName = `${tagName}-${extension}`;\n const newElement = createElementWithNewTagName(element, newTagName);\n element.replaceWith(newElement);\n });\n}\n\n// Function to extend any element with a specific class pattern (e.g., \"extend:suffix\")\nexport function extendElementsWithClass(xmlFragment: XMLDocument, classNamePattern: string) {\n xmlFragment.querySelectorAll('*').forEach(element => {\n const classList = element.classList;\n if (classList) {\n classList.forEach(className => {\n if (className.startsWith(`${classNamePattern}:`)) {\n const suffix = className.slice(`${classNamePattern}:`.length);\n const newTagName = `${element.nodeName}-${suffix}`;\n const newElement = createElementWithNewTagName(element, newTagName);\n element.replaceWith(newElement);\n }\n });\n }\n });\n}\n\n// Helper function to create a new element with a new tag name and copy attributes and children\nfunction createElementWithNewTagName(element: Element, newTagName: string) {\n // create Elements on the ownerDocument which is usually the XMLDocument\n const newElement = element.ownerDocument.createElement(newTagName);\n // Copy attributes\n for (const attr of element.attributes) {\n newElement.setAttribute(attr.name, attr.value);\n }\n // Copy child nodes\n while (element.firstChild) {\n newElement.appendChild(element.firstChild);\n }\n return newElement;\n}\n\nexport function itemsFromTest(xmlFragment: DocumentFragment) {\n const items: { identifier: string; href: string; category: string }[] = [];\n xmlFragment.querySelectorAll('qti-assessment-item-ref').forEach(el => {\n const identifier = el.getAttribute('identifier');\n const href = el.getAttribute('href');\n const category = el.getAttribute('category');\n items.push({ identifier, href, category });\n });\n return items;\n}\n\n// let currentRequest: XMLHttpRequest | null = null;\n\nexport function loadXML(url: string, signal?: AbortSignal): Promise<XMLDocument | null> {\n return fetch(url, { signal })\n .then(response => {\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n return response.text();\n })\n .then(text => {\n const parser = new DOMParser();\n return parser.parseFromString(text, 'text/xml');\n })\n .catch(error => {\n if (error.name === 'AbortError') {\n throw error;\n }\n throw new Error(`Failed to load XML: ${error.message}`);\n });\n}\n\nexport function parseXML(xmlDocument: string) {\n const parser = new DOMParser();\n const xmlFragment = parser.parseFromString(xmlDocument, 'text/xml');\n return xmlFragment;\n}\n\nexport function toHTML(xmlFragment: Document): DocumentFragment {\n const processor = new XSLTProcessor();\n const xsltDocument = new DOMParser().parseFromString(xmlToHTML, 'text/xml');\n processor.importStylesheet(xsltDocument);\n const itemHTMLFragment = processor.transformToFragment(xmlFragment, document);\n return itemHTMLFragment;\n}\n\nexport function setLocation(xmlFragment: DocumentFragment, location: string) {\n if (!location.endsWith('/')) {\n location += '/';\n }\n\n xmlFragment.querySelectorAll('[src],[href],[primary-path]').forEach(elWithSrc => {\n let attr: 'src' | 'href' | 'primary-path' | '' = '';\n\n if (elWithSrc.getAttribute('src')) {\n attr = 'src';\n }\n if (elWithSrc.getAttribute('href')) {\n attr = 'href';\n }\n if (elWithSrc.getAttribute('primary-path')) {\n attr = 'primary-path';\n }\n const attrValue = elWithSrc.getAttribute(attr)?.trim();\n\n if (!/^(data:|https?:|blob:)/.test(attrValue)) {\n const newSrcValue = location + encodeURI(attrValue);\n elWithSrc.setAttribute(attr, newSrcValue);\n }\n });\n}\n\nexport function convertCDATAtoComment(xmlFragment: DocumentFragment) {\n const cdataElements = xmlFragment.querySelectorAll('qti-custom-operator[class=\"js.org\"] > qti-base-value');\n cdataElements.forEach(element => {\n const commentText = document.createComment(element.textContent);\n element.replaceChild(commentText, element.firstChild);\n });\n}\n\nexport function stripStyleSheets(xmlFragment: DocumentFragment) {\n // remove qti-stylesheet tag\n xmlFragment.querySelectorAll('qti-stylesheet').forEach(stylesheet => stylesheet.remove());\n}\n\nexport function getShuffleQuerySelectorByTagName(tagName: string): string | string[] | null {\n switch (tagName) {\n case 'qti-choice-interaction':\n case 'qti-order-interaction':\n return 'qti-simple-choice';\n case 'qti-inline-choice-interaction':\n return 'qti-inline-choice';\n case 'qti-match-interaction':\n return [\n 'qti-simple-match-set:first-of-type qti-simple-associable-choice',\n 'qti-simple-match-set:last-of-type > qti-simple-associable-choice'\n ];\n case 'qti-gap-match-interaction':\n return 'qti-gap-text';\n case 'qti-associate-interaction':\n return 'qti-simple-associable-choice';\n default:\n return null;\n }\n}\n","/**\n * Browser based QTI-XML to HTML transformer.\n * Returns an object with methods to load, parse, transform and serialize QTI XML items.\n * @returns An object with methods to load, parse, transform and serialize QTI XML items.\n * @example\n * const qtiTransformer = qtiTransformItem();\n * await qtiTransformer.load('path/to/xml/file.xml');\n * qtiTransformer.path('/assessmentItem/itemBody');\n * const html = qtiTransformer.html();\n * const xml = qtiTransformer.xml();\n * const htmldoc = qtiTransformer.htmldoc();\n * const xmldoc = qtiTransformer.xmldoc();\n *\n * qtiTransformItem().parse(storyXML).html()\n */\nimport {\n convertCDATAtoComment,\n extendElementName,\n extendElementsWithClass,\n getShuffleQuerySelectorByTagName,\n loadXML,\n parseXML,\n setLocation,\n stripStyleSheets,\n toHTML\n} from './qti-transformers';\n\n// Type definition for module resolution config\nexport interface ModuleResolutionConfig {\n waitSeconds?: number;\n context?: string;\n catchError?: boolean;\n urlArgs?: string;\n paths: {\n [key: string]: string | string[];\n };\n shim?: {\n [key: string]: {\n deps?: string[]; // Array of dependencies\n exports?: string; // The global variable to use as the module's value\n };\n };\n}\n\nexport type transformItemApi = {\n load: (uri: string, signal?: AbortSignal) => Promise<transformItemApi>;\n parse: (xmlString: string) => transformItemApi;\n path: (location: string) => transformItemApi;\n fn: (fn: (xmlFragment: XMLDocument) => void) => transformItemApi;\n pciHooks: (uri: string) => transformItemApi;\n configurePci: (\n baseUrl: string,\n getModuleResolutionConfig: (baseUrl: string, fileUrl: string) => Promise<ModuleResolutionConfig>,\n selector?: string\n ) => Promise<transformItemApi>;\n extendElementName: (elementName: string, extend: string) => transformItemApi;\n extendElementsWithClass: (param?: string) => transformItemApi;\n customInteraction: (baseRef: string, baseItem: string) => transformItemApi;\n convertCDATAtoComment: () => transformItemApi;\n shuffleInteractions: () => transformItemApi;\n stripStyleSheets: () => transformItemApi;\n html: () => string;\n xml: () => string;\n htmlDoc: () => DocumentFragment;\n xmlDoc: () => XMLDocument;\n};\n\nexport const qtiTransformItem = (cache: boolean = false) => {\n let xmlFragment: XMLDocument;\n let xmlUri = '';\n\n const api: transformItemApi = {\n load(uri: string, signal?: AbortSignal) {\n xmlUri = uri;\n const fullKey = encodeURI(uri);\n if (cache) {\n if (sessionStorage.getItem(fullKey)) {\n return Promise.resolve(api.parse(sessionStorage.getItem(fullKey)!));\n }\n }\n return loadXML(uri, signal).then(xml => {\n xmlFragment = xml;\n api.shuffleInteractions();\n if (cache) sessionStorage.setItem(fullKey, new XMLSerializer().serializeToString(xmlFragment));\n return api;\n });\n },\n parse(xmlString: string): typeof api {\n xmlFragment = parseXML(xmlString);\n return api;\n },\n path: (location: string): typeof api => {\n setLocation(xmlFragment, location);\n xmlUri = null;\n return api;\n },\n fn(fn: (xmlFragment: XMLDocument) => void): typeof api {\n fn(xmlFragment);\n return api;\n },\n pciHooks(uri: string): typeof api {\n const attributes = ['hook', 'module'];\n const documentPath = uri.substring(0, uri.lastIndexOf('/'));\n for (const attribute of attributes) {\n const srcAttributes = xmlFragment.querySelectorAll('[' + attribute + ']');\n srcAttributes.forEach(node => {\n const srcValue = node.getAttribute(attribute)!;\n if (!srcValue.startsWith('data:') && !srcValue.startsWith('http')) {\n // Just paste the relative path of the src location after the documentrootPath\n // old pcis can have a .js, new pci's don't\n node.setAttribute('base-url', uri);\n node.setAttribute(\n 'module',\n documentPath + '/' + encodeURI(srcValue + (srcValue.endsWith('.js') ? '' : '.js'))\n );\n }\n });\n }\n return api;\n },\n async configurePci(\n baseUrl: string,\n getModuleResolutionConfig: (baseUrl: string, fileUrl: string) => Promise<ModuleResolutionConfig>,\n selector = 'qti-portable-custom-interaction'\n ): Promise<typeof api> {\n const customInteractionTypeIdentifiers: string[] = [];\n const portableCustomInteractions = xmlFragment.querySelectorAll(selector);\n\n const moduleResolutionConfig = await getModuleResolutionConfig(baseUrl, '/modules/module_resolution.js');\n const moduleResolutionFallbackConfig = await getModuleResolutionConfig(\n baseUrl,\n '/modules/fallback_module_resolution.js'\n );\n\n if (portableCustomInteractions.length > 0) {\n for (const interaction of Array.from(portableCustomInteractions)) {\n // set data-base-url\n interaction.setAttribute('data-base-url', baseUrl);\n\n let customInteractionTypeIdentifier = interaction.getAttribute('custom-interaction-type-identifier');\n if (\n customInteractionTypeIdentifier &&\n customInteractionTypeIdentifiers.includes(customInteractionTypeIdentifier)\n ) {\n customInteractionTypeIdentifier = customInteractionTypeIdentifier + customInteractionTypeIdentifiers.length;\n interaction.setAttribute('custom-interaction-type-identifier', customInteractionTypeIdentifier);\n customInteractionTypeIdentifiers.push(customInteractionTypeIdentifier);\n }\n if (customInteractionTypeIdentifier) {\n customInteractionTypeIdentifiers.push(customInteractionTypeIdentifier);\n }\n\n // Check if qti-interaction-modules already exists\n let modulesElement = interaction.querySelector('qti-interaction-modules');\n\n // If it exists and has primary-configuration, handle that format\n if (modulesElement && modulesElement.getAttribute('primary-configuration')) {\n const primaryConfigPath = modulesElement.getAttribute('primary-configuration');\n if (primaryConfigPath) {\n try {\n // Load the primary configuration\n const primaryConfig = await getModuleResolutionConfig(baseUrl, `/${primaryConfigPath}`);\n\n // Get existing module elements that only have id attributes\n const existingModules = Array.from(modulesElement.querySelectorAll('qti-interaction-module'));\n\n // Update existing modules with paths from config\n for (const moduleEl of existingModules) {\n const moduleId = moduleEl.getAttribute('id');\n if (moduleId && primaryConfig.paths && primaryConfig.paths[moduleId]) {\n const primaryPath = primaryConfig.paths[moduleId];\n const primaryPathString = Array.isArray(primaryPath) ? primaryPath[0] : primaryPath;\n moduleEl.setAttribute('primary-path', primaryPathString);\n\n // Check for fallback path\n if (\n moduleResolutionFallbackConfig &&\n moduleResolutionFallbackConfig.paths &&\n moduleResolutionFallbackConfig.paths[moduleId]\n ) {\n const fallbackPath = moduleResolutionFallbackConfig.paths[moduleId];\n if (Array.isArray(fallbackPath)) {\n moduleEl.setAttribute('fallback-path', fallbackPath[0]);\n } else {\n moduleEl.setAttribute('fallback-path', fallbackPath);\n }\n }\n }\n }\n\n // Add any additional modules from primary config that aren't already present\n if (primaryConfig.paths) {\n for (const moduleId in primaryConfig.paths) {\n const existingModule = modulesElement.querySelector(`qti-interaction-module[id=\"${moduleId}\"]`);\n if (!existingModule) {\n const newModuleElement = xmlFragment.createElement('qti-interaction-module');\n newModuleElement.setAttribute('id', moduleId);\n const primaryPathString = Array.isArray(primaryConfig.paths[moduleId])\n ? primaryConfig.paths[moduleId][0]\n : primaryConfig.paths[moduleId];\n newModuleElement.setAttribute('primary-path', primaryPathString);\n\n // Check for fallback path\n if (\n moduleResolutionFallbackConfig &&\n moduleResolutionFallbackConfig.paths &&\n moduleResolutionFallbackConfig.paths[moduleId]\n ) {\n const fallbackPath = moduleResolutionFallbackConfig.paths[moduleId];\n if (Array.isArray(fallbackPath)) {\n newModuleElement.setAttribute('fallback-path', fallbackPath[0]);\n } else {\n newModuleElement.setAttribute('fallback-path', fallbackPath);\n }\n }\n\n modulesElement.appendChild(newModuleElement);\n }\n }\n }\n\n // Apply urlArgs if present in config\n if (primaryConfig.urlArgs) {\n modulesElement.setAttribute('url-args', primaryConfig.urlArgs);\n }\n } catch (error) {\n console.warn(`Failed to load primary configuration: ${primaryConfigPath}`, error);\n }\n }\n } else {\n // Original logic for when there's no existing qti-interaction-modules or no primary-configuration\n if (moduleResolutionConfig) {\n // Create qti-interaction-modules if it doesn't exist\n if (interaction.querySelector('qti-interaction-modules') === null) {\n modulesElement = xmlFragment.createElement('qti-interaction-modules');\n interaction.appendChild(modulesElement);\n } else {\n modulesElement = interaction.querySelector('qti-interaction-modules');\n }\n\n for (const module in moduleResolutionConfig.paths) {\n const path = moduleResolutionConfig.paths[module];\n let fallbackPath: string | string[] = '';\n\n if (\n moduleResolutionFallbackConfig &&\n moduleResolutionFallbackConfig.paths &&\n moduleResolutionFallbackConfig.paths[module]\n ) {\n fallbackPath = moduleResolutionFallbackConfig.paths[module];\n }\n\n const primaryArray = Array.isArray(path) ? path : [path];\n const fallbackPathArray = Array.isArray(fallbackPath) ? fallbackPath : [fallbackPath];\n\n // create an array with primary and fallback paths.\n const paths = primaryArray.map((primaryPath, i) => {\n const fallbackPath = fallbackPathArray.length > i ? fallbackPathArray[i] : '';\n return {\n primaryPath,\n fallbackPath\n };\n });\n\n // check if all fallbackPath elements are in the array: paths, otherwise add\n for (const fallbackPath of fallbackPathArray) {\n if (!paths.some(p => p.fallbackPath === fallbackPath)) {\n paths.push({\n primaryPath: primaryArray.length > 0 ? primaryArray[0] : fallbackPath,\n fallbackPath\n });\n }\n }\n\n // add the paths to the qti-interaction-modules\n for (const path of paths) {\n const moduleElement = xmlFragment.createElement('qti-interaction-module');\n if (path.fallbackPath) {\n moduleElement.setAttribute('fallback-path', path.fallbackPath);\n }\n moduleElement.setAttribute('id', module);\n moduleElement.setAttribute('primary-path', path.primaryPath);\n\n if (modulesElement) {\n modulesElement.appendChild(moduleElement);\n }\n }\n }\n }\n }\n }\n }\n\n return api;\n },\n shuffleInteractions(): typeof api {\n const shuffleElements = xmlFragment.querySelectorAll(`[shuffle=\"true\"]`);\n const shuffleInteractions = Array.from(shuffleElements).filter(e =>\n e.tagName?.toLowerCase().endsWith('-interaction')\n );\n\n for (const shuffleInteraction of shuffleInteractions) {\n const query = getShuffleQuerySelectorByTagName(shuffleInteraction.tagName.toLowerCase());\n const queries = Array.isArray(query) ? query : [query];\n\n for (const q of queries) {\n const choices = Array.from(shuffleInteraction.querySelectorAll(q)) as HTMLElement[];\n\n const fixedChoices = choices\n .map((choice, originalOrder) => ({\n element: choice,\n fixed: choice.hasAttribute('fixed') && choice.getAttribute('fixed') === 'true',\n originalOrder\n }))\n .filter(choice => choice.fixed);\n\n const nonFixedChoices = choices.filter(\n choice => !choice.hasAttribute('fixed') || choice.getAttribute('fixed') !== 'true'\n );\n\n if (nonFixedChoices.length <= 1) {\n console.warn('Shuffling is not possible with fewer than 2 non-fixed elements.');\n return api;\n }\n\n const originalOrder = [...nonFixedChoices];\n let shuffled = false;\n let attempts = 0;\n\n while (!shuffled && attempts < 20) {\n attempts++;\n for (let i = nonFixedChoices.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [nonFixedChoices[i], nonFixedChoices[j]] = [nonFixedChoices[j], nonFixedChoices[i]];\n }\n shuffled = !nonFixedChoices.every((choice, index) => choice === originalOrder[index]);\n }\n\n if (!shuffled) {\n console.warn('Failed to shuffle the choices after multiple attempts.');\n return null;\n }\n\n // Remove the shuffle attribute\n shuffleInteraction.removeAttribute('shuffle');\n\n // Reorder the elements in the DOM\n let nonFixedIndex = 0;\n for (const nonFixedChoice of nonFixedChoices) {\n nonFixedChoice.parentElement.insertBefore(nonFixedChoice, fixedChoices[nonFixedIndex]?.element);\n nonFixedIndex++;\n }\n for (const fixedChoice of fixedChoices) {\n fixedChoice.element.parentElement.insertBefore(\n fixedChoice.element,\n nonFixedChoices[fixedChoice.originalOrder]\n );\n }\n }\n }\n\n return api;\n },\n extendElementName: (tagName: string, extension: string): typeof api => {\n extendElementName(xmlFragment, tagName, extension);\n return api;\n },\n extendElementsWithClass: (param: string = 'extend'): typeof api => {\n extendElementsWithClass(xmlFragment, param);\n return api;\n },\n customInteraction(baseRef: string, baseItem: string): typeof api {\n const qtiCustomInteraction = xmlFragment.querySelector('qti-custom-interaction');\n const qtiCustomInteractionObject = qtiCustomInteraction.querySelector('object');\n\n qtiCustomInteraction.setAttribute('data-base-ref', baseRef);\n qtiCustomInteraction.setAttribute('data-base-item', baseRef + baseItem);\n qtiCustomInteraction.setAttribute('data', qtiCustomInteractionObject.getAttribute('data'));\n qtiCustomInteraction.setAttribute('width', qtiCustomInteractionObject.getAttribute('width'));\n qtiCustomInteraction.setAttribute('height', qtiCustomInteractionObject.getAttribute('height'));\n\n qtiCustomInteraction.removeChild(qtiCustomInteractionObject);\n return api;\n },\n convertCDATAtoComment(): typeof api {\n convertCDATAtoComment(xmlFragment);\n return api;\n },\n stripStyleSheets(): typeof api {\n stripStyleSheets(xmlFragment);\n return api;\n },\n html() {\n if (xmlUri !== null) {\n setLocation(xmlFragment, xmlUri.substring(0, xmlUri.lastIndexOf('/')));\n }\n return new XMLSerializer().serializeToString(toHTML(xmlFragment));\n },\n xml(): string {\n return new XMLSerializer().serializeToString(xmlFragment);\n },\n htmlDoc() {\n if (xmlUri !== null) {\n setLocation(xmlFragment, xmlUri.substring(0, xmlUri.lastIndexOf('/')));\n }\n return toHTML(xmlFragment);\n },\n xmlDoc(): XMLDocument {\n return xmlFragment; // new XMLSerializer().serializeToString(xmlFragment);\n }\n };\n return api;\n};\n","import { loadXML, parseXML } from './qti-transformers';\n\nexport const qtiTransformManifest = (): {\n load: (uri: string, signal?: AbortSignal) => Promise<typeof api>;\n assessmentTest: () => { href: string; identifier: string };\n} => {\n let xmlFragment: XMLDocument;\n\n const api = {\n async load(uri: string, signal: AbortSignal) {\n return new Promise<typeof api>(resolve => {\n loadXML(uri, signal).then(xml => {\n xmlFragment = xml;\n return resolve(api);\n });\n });\n },\n parse(xmlString: string) {\n xmlFragment = parseXML(xmlString);\n },\n assessmentTest() {\n const el = xmlFragment.querySelector('resource[type=\"imsqti_test_xmlv3p0\"]');\n return { href: el.getAttribute('href'), identifier: el.getAttribute('identifier') };\n }\n };\n return api;\n};\n","/**\n * Returns an object with methods to load, parse and transform QTI tests.\n * @returns An object with methods to load, parse and transform QTI tests.\n * @example\n * const qtiTransformer = qtiTransformTest();\n * await qtiTransformer.load('https://example.com/test.xml');\n * const items = qtiTransformer.items();\n * const html = qtiTransformer.html();\n * const xml = qtiTransformer.xml();\n */\n\nimport { itemsFromTest, loadXML, parseXML, setLocation, toHTML } from './qti-transformers';\n\nexport type transformTestApi = {\n load: (uri: string, signal?: AbortSignal) => Promise<transformTestApi>;\n parse: (xmlString: string) => transformTestApi;\n path: (location: string) => transformTestApi;\n fn: (fn: (xmlFragment: XMLDocument) => void) => transformTestApi;\n items: () => { identifier: string; href: string; category: string }[];\n html: () => string;\n xml: () => string;\n htmlDoc: () => DocumentFragment;\n xmlDoc: () => XMLDocument;\n};\n\nexport const qtiTransformTest = (): transformTestApi => {\n let xmlFragment: XMLDocument;\n\n const api: transformTestApi = {\n async load(uri, signal) {\n return new Promise<transformTestApi>((resolve, _) => {\n loadXML(uri, signal).then(xml => {\n xmlFragment = xml;\n\n api.path(uri.substring(0, uri.lastIndexOf('/')));\n return resolve(api);\n });\n });\n },\n parse(xmlString: string) {\n xmlFragment = parseXML(xmlString);\n return api;\n },\n path: (location: string): typeof api => {\n setLocation(xmlFragment, location);\n return api;\n },\n fn(fn: (xmlFragment: XMLDocument) => void) {\n fn(xmlFragment);\n return api;\n },\n items() {\n return itemsFromTest(xmlFragment);\n },\n html() {\n return new XMLSerializer().serializeToString(toHTML(xmlFragment));\n },\n xml(): string {\n return new XMLSerializer().serializeToString(xmlFragment);\n },\n htmlDoc() {\n return toHTML(xmlFragment);\n },\n xmlDoc(): XMLDocument {\n return xmlFragment;\n }\n };\n return api;\n};\n"],"mappings":";AAAA,IAAM,MAAM,OAAO;AAenB,IAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBX,SAAS,kBAAkB,aAA0B,SAAiB,WAAmB;AAC9F,cAAY,iBAAiB,OAAO,EAAE,QAAQ,aAAW;AACvD,UAAM,aAAa,GAAG,OAAO,IAAI,SAAS;AAC1C,UAAM,aAAa,4BAA4B,SAAS,UAAU;AAClE,YAAQ,YAAY,UAAU;AAAA,EAChC,CAAC;AACH;AAGO,SAAS,wBAAwB,aAA0B,kBAA0B;AAC1F,cAAY,iBAAiB,GAAG,EAAE,Q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