@citolab/qti-components 7.14.0 → 7.14.2

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/cdn/index.js CHANGED
@@ -23,7 +23,7 @@ Make sure to test your application with a production build as repeat registratio
23
23
  <xsl:apply-templates/>
24
24
  </xsl:element>
25
25
  </xsl:template>
26
- </xsl:stylesheet>`;function Ks(o,r,e){o.querySelectorAll(r).forEach(t=>{let i=`${r}-${e}`,s=Qs(t,i);t.replaceWith(s)})}function Zs(o,r){o.querySelectorAll("*").forEach(e=>{let t=e.classList;t&&t.forEach(i=>{if(i.startsWith(`${r}:`)){let s=i.slice(`${r}:`.length),n=`${e.nodeName}-${s}`,a=Qs(e,n);e.replaceWith(a)}})})}function Qs(o,r){let e=document.createElement(r);for(let t of o.attributes)e.setAttribute(t.name,t.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function eo(o){let r=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let t=e.getAttribute("identifier"),i=e.getAttribute("href"),s=e.getAttribute("category");r.push({identifier:t,href:i,category:s})}),r}function jt(o,r){return fetch(o,{signal:r}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>new DOMParser().parseFromString(e,"text/xml")).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Bt(o){return new DOMParser().parseFromString(o,"text/xml")}function ct(o){let r=new XSLTProcessor,e=new DOMParser().parseFromString(En,"text/xml");return r.importStylesheet(e),r.transformToFragment(o,document)}function dt(o,r){r.endsWith("/")||(r+="/"),o.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{let t="";e.getAttribute("src")&&(t="src"),e.getAttribute("href")&&(t="href"),e.getAttribute("primary-path")&&(t="primary-path");let i=e.getAttribute(t)?.trim();if(!/^(data:|https?:|blob:)/.test(i)){let s=r+encodeURI(i);e.setAttribute(t,s)}})}function to(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let t=document.createComment(e.textContent);e.replaceChild(t,e.firstChild)})}function ro(o){o.querySelectorAll("qti-stylesheet").forEach(r=>r.remove())}function io(o){switch(o){case"qti-choice-interaction":case"qti-order-interaction":return"qti-simple-choice";case"qti-inline-choice-interaction":return"qti-inline-choice";case"qti-match-interaction":return["qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice"];case"qti-gap-match-interaction":return"qti-gap-text";case"qti-associate-interaction":return"qti-simple-associable-choice";default:}}var Le=(o=!1)=>{let r,e="",t={load(i,s){e=i;let n=encodeURI(i);return o&&sessionStorage.getItem(n)?Promise.resolve(t.parse(sessionStorage.getItem(n))):jt(i,s).then(a=>(r=a,t.shuffleInteractions(),o&&sessionStorage.setItem(n,new XMLSerializer().serializeToString(r)),t))},parse(i){return r=Bt(i),t},path:i=>(dt(r,i),e=null,t),fn(i){return i(r),t},pciHooks(i){let s=["hook","module"],n=i.substring(0,i.lastIndexOf("/"));for(let a of s)r.querySelectorAll("["+a+"]").forEach(d=>{let p=d.getAttribute(a);!p.startsWith("data:")&&!p.startsWith("http")&&(d.setAttribute("base-url",i),d.setAttribute("module",n+"/"+encodeURI(p+(p.endsWith(".js")?"":".js"))))});return t},async configurePci(i,s,n="qti-portable-custom-interaction"){let a=[],l=r.querySelectorAll(n),d=await s(i,"/modules/module_resolution.js"),p=await s(i,"/modules/fallback_module_resolution.js");if(l.length>0)for(let m of Array.from(l)){m.setAttribute("data-base-url",i);let f=m.getAttribute("custom-interaction-type-identifier");f&&a.includes(f)&&(f=f+a.length,m.setAttribute("custom-interaction-type-identifier",f),a.push(f)),f&&a.push(f);let b=m.querySelector("qti-interaction-modules");if(b&&b.getAttribute("primary-configuration")){let y=b.getAttribute("primary-configuration");if(y)try{let E=await s(i,`/${y}`),S=Array.from(b.querySelectorAll("qti-interaction-module"));for(let q of S){let T=q.getAttribute("id");if(T&&E.paths&&E.paths[T]){let M=E.paths[T],O=Array.isArray(M)?M[0]:M;if(q.setAttribute("primary-path",O),p&&p.paths&&p.paths[T]){let N=p.paths[T];Array.isArray(N)?q.setAttribute("fallback-path",N[0]):q.setAttribute("fallback-path",N)}}}if(E.paths){for(let q in E.paths)if(!b.querySelector(`qti-interaction-module[id="${q}"]`)){let M=r.createElement("qti-interaction-module");M.setAttribute("id",q);let O=Array.isArray(E.paths[q])?E.paths[q][0]:E.paths[q];if(M.setAttribute("primary-path",O),p&&p.paths&&p.paths[q]){let N=p.paths[q];Array.isArray(N)?M.setAttribute("fallback-path",N[0]):M.setAttribute("fallback-path",N)}b.appendChild(M)}}E.urlArgs&&b.setAttribute("url-args",E.urlArgs)}catch(E){console.warn(`Failed to load primary configuration: ${y}`,E)}}else if(d){m.querySelector("qti-interaction-modules")===null?(b=r.createElement("qti-interaction-modules"),m.appendChild(b)):b=m.querySelector("qti-interaction-modules");for(let y in d.paths){let E=d.paths[y],S="";p&&p.paths&&p.paths[y]&&(S=p.paths[y]);let q=Array.isArray(E)?E:[E],T=Array.isArray(S)?S:[S],M=q.map((O,N)=>{let tn=T.length>N?T[N]:"";return{primaryPath:O,fallbackPath:tn}});for(let O of T)M.some(N=>N.fallbackPath===O)||M.push({primaryPath:q.length>0?q[0]:O,fallbackPath:O});for(let O of M){let N=r.createElement("qti-interaction-module");O.fallbackPath&&N.setAttribute("fallback-path",O.fallbackPath),N.setAttribute("id",y),N.setAttribute("primary-path",O.primaryPath),b&&b.appendChild(N)}}}}return t},shuffleInteractions(){let i=r.querySelectorAll('[shuffle="true"]'),s=Array.from(i).filter(n=>n.tagName?.toLowerCase().endsWith("-interaction"));for(let n of s){let a=io(n.tagName.toLowerCase()),l=Array.isArray(a)?a:[a];for(let d of l){let p=Array.from(n.querySelectorAll(d)),m=p.map((q,T)=>({element:q,fixed:q.hasAttribute("fixed")&&q.getAttribute("fixed")==="true",originalOrder:T})).filter(q=>q.fixed),f=p.filter(q=>!q.hasAttribute("fixed")||q.getAttribute("fixed")!=="true");if(f.length<=1)return console.warn("Shuffling is not possible with fewer than 2 non-fixed elements."),t;let b=[...f],y=!1,E=0;for(;!y&&E<20;){E++;for(let q=f.length-1;q>0;q--){let T=Math.floor(Math.random()*(q+1));[f[q],f[T]]=[f[T],f[q]]}y=!f.every((q,T)=>q===b[T])}if(!y)return console.warn("Failed to shuffle the choices after multiple attempts."),null;n.removeAttribute("shuffle");let S=0;for(let q of f)q.parentElement.insertBefore(q,m[S]?.element),S++;for(let q of m)q.element.parentElement.insertBefore(q.element,f[q.originalOrder])}}return t},extendElementName:(i,s)=>(Ks(r,i,s),t),extendElementsWithClass:(i="extend")=>(Zs(r,i),t),customInteraction(i,s){let n=r.querySelector("qti-custom-interaction"),a=n.querySelector("object");return n.setAttribute("data-base-ref",i),n.setAttribute("data-base-item",i+s),n.setAttribute("data",a.getAttribute("data")),n.setAttribute("width",a.getAttribute("width")),n.setAttribute("height",a.getAttribute("height")),n.removeChild(a),t},convertCDATAtoComment(){return to(r),t},stripStyleSheets(){return ro(r),t},html(){return e!==null&&dt(r,e.substring(0,e.lastIndexOf("/"))),new XMLSerializer().serializeToString(ct(r))},xml(){return new XMLSerializer().serializeToString(r)},htmlDoc(){return e!==null&&dt(r,e.substring(0,e.lastIndexOf("/"))),ct(r)},xmlDoc(){return r}};return t};var Vi=()=>{let o,r={async load(e,t){return new Promise((i,s)=>{jt(e,t).then(n=>(o=n,r.path(e.substring(0,e.lastIndexOf("/"))),i(r)))})},parse(e){return o=Bt(e),r},path:e=>(dt(o,e),r),fn(e){return e(o),r},items(){return eo(o)},html(){return new XMLSerializer().serializeToString(ct(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(){return ct(o)},xmlDoc(){return o}};return r};var Oi=class o extends Event{constructor(e,t){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0});this.element=e;this.item=t}static{this.eventName="qti-assessment-stimulus-ref-connected"}},pt=class extends v{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let e=this.closest("qti-assessment-item"),t=new Oi(this,e);this.dispatchEvent(t);let i=e?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!t.defaultPrevented&&i&&await this.updateStimulusRef(i)}async updateStimulusRef(e){let t=await Le().load(this.href).then(i=>i.htmlDoc());if(t){let i=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...i)}}};c([u({type:String})],pt.prototype,"identifier",2),c([u({type:String})],pt.prototype,"href",2),pt=c([g("qti-assessment-stimulus-ref")],pt);var Br=class extends v{};Br=c([g("qti-companion-materials-info")],Br);var Wt=class extends v{render(){return h`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let r=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",r?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let r={variable:t=>this._context?.variables.find(i=>i.identifier===t)?.value??"",correct:t=>this._context?.variables.find(i=>i.identifier===t)?.correctResponse??""},e={getVariable:t=>this._context?.variables.find(i=>i.identifier===t),updateOutcomeVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:i}}))},updateResponseVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,response:i}}))}};return this.operatorFunction(this._context,r,e)}};c([_({context:$,subscribe:!0}),C()],Wt.prototype,"_context",2),Wt=c([g("qti-custom-operator")],Wt);var wn=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Xt=o=>{if(typeof o=="string")return o;let r=wn();return r==="."?o.toLocaleString():o.toString().replace(".","").replace(r,".")};function Ni(o){return o==null}function Ke(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Y=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(r){let e=this._context.variables.find(i=>i.identifier===r)||null;if(this.outcomeIdentifier!==r||!e)return;let t=!1;Array.isArray(e.value)?t=e.value.includes(this.identifier):t=!Ni(this.identifier)&&!Ni(e?.value)&&this.identifier===e.value||!1,this.showFeedback(t)}showFeedback(r){this.showStatus=r&&this.showHide==="show"||!r&&this.showHide==="hide"?"on":"off"}};c([u({type:String,attribute:"show-hide"})],Y.prototype,"showHide",2),c([u({type:String,attribute:"outcome-identifier"})],Y.prototype,"outcomeIdentifier",2),c([u({type:String})],Y.prototype,"identifier",2),c([u({type:String,attribute:!1})],Y.prototype,"showStatus",2),c([_({context:$,subscribe:!0}),C()],Y.prototype,"_context",2);var Gt=class extends Y{render(){return h` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};Gt.styles=x`
26
+ </xsl:stylesheet>`;function Ks(o,r,e){o.querySelectorAll(r).forEach(t=>{let i=`${r}-${e}`,s=Qs(t,i);t.replaceWith(s)})}function Zs(o,r){o.querySelectorAll("*").forEach(e=>{let t=e.classList;t&&t.forEach(i=>{if(i.startsWith(`${r}:`)){let s=i.slice(`${r}:`.length),n=`${e.nodeName}-${s}`,a=Qs(e,n);e.replaceWith(a)}})})}function Qs(o,r){let e=o.ownerDocument.createElement(r);for(let t of o.attributes)e.setAttribute(t.name,t.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function eo(o){let r=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let t=e.getAttribute("identifier"),i=e.getAttribute("href"),s=e.getAttribute("category");r.push({identifier:t,href:i,category:s})}),r}function jt(o,r){return fetch(o,{signal:r}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>new DOMParser().parseFromString(e,"text/xml")).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Bt(o){return new DOMParser().parseFromString(o,"text/xml")}function ct(o){let r=new XSLTProcessor,e=new DOMParser().parseFromString(En,"text/xml");return r.importStylesheet(e),r.transformToFragment(o,document)}function dt(o,r){r.endsWith("/")||(r+="/"),o.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{let t="";e.getAttribute("src")&&(t="src"),e.getAttribute("href")&&(t="href"),e.getAttribute("primary-path")&&(t="primary-path");let i=e.getAttribute(t)?.trim();if(!/^(data:|https?:|blob:)/.test(i)){let s=r+encodeURI(i);e.setAttribute(t,s)}})}function to(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let t=document.createComment(e.textContent);e.replaceChild(t,e.firstChild)})}function ro(o){o.querySelectorAll("qti-stylesheet").forEach(r=>r.remove())}function io(o){switch(o){case"qti-choice-interaction":case"qti-order-interaction":return"qti-simple-choice";case"qti-inline-choice-interaction":return"qti-inline-choice";case"qti-match-interaction":return["qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice"];case"qti-gap-match-interaction":return"qti-gap-text";case"qti-associate-interaction":return"qti-simple-associable-choice";default:}}var Le=(o=!1)=>{let r,e="",t={load(i,s){e=i;let n=encodeURI(i);return o&&sessionStorage.getItem(n)?Promise.resolve(t.parse(sessionStorage.getItem(n))):jt(i,s).then(a=>(r=a,t.shuffleInteractions(),o&&sessionStorage.setItem(n,new XMLSerializer().serializeToString(r)),t))},parse(i){return r=Bt(i),t},path:i=>(dt(r,i),e=null,t),fn(i){return i(r),t},pciHooks(i){let s=["hook","module"],n=i.substring(0,i.lastIndexOf("/"));for(let a of s)r.querySelectorAll("["+a+"]").forEach(d=>{let p=d.getAttribute(a);!p.startsWith("data:")&&!p.startsWith("http")&&(d.setAttribute("base-url",i),d.setAttribute("module",n+"/"+encodeURI(p+(p.endsWith(".js")?"":".js"))))});return t},async configurePci(i,s,n="qti-portable-custom-interaction"){let a=[],l=r.querySelectorAll(n),d=await s(i,"/modules/module_resolution.js"),p=await s(i,"/modules/fallback_module_resolution.js");if(l.length>0)for(let m of Array.from(l)){m.setAttribute("data-base-url",i);let f=m.getAttribute("custom-interaction-type-identifier");f&&a.includes(f)&&(f=f+a.length,m.setAttribute("custom-interaction-type-identifier",f),a.push(f)),f&&a.push(f);let b=m.querySelector("qti-interaction-modules");if(b&&b.getAttribute("primary-configuration")){let y=b.getAttribute("primary-configuration");if(y)try{let E=await s(i,`/${y}`),S=Array.from(b.querySelectorAll("qti-interaction-module"));for(let q of S){let T=q.getAttribute("id");if(T&&E.paths&&E.paths[T]){let M=E.paths[T],O=Array.isArray(M)?M[0]:M;if(q.setAttribute("primary-path",O),p&&p.paths&&p.paths[T]){let N=p.paths[T];Array.isArray(N)?q.setAttribute("fallback-path",N[0]):q.setAttribute("fallback-path",N)}}}if(E.paths){for(let q in E.paths)if(!b.querySelector(`qti-interaction-module[id="${q}"]`)){let M=r.createElement("qti-interaction-module");M.setAttribute("id",q);let O=Array.isArray(E.paths[q])?E.paths[q][0]:E.paths[q];if(M.setAttribute("primary-path",O),p&&p.paths&&p.paths[q]){let N=p.paths[q];Array.isArray(N)?M.setAttribute("fallback-path",N[0]):M.setAttribute("fallback-path",N)}b.appendChild(M)}}E.urlArgs&&b.setAttribute("url-args",E.urlArgs)}catch(E){console.warn(`Failed to load primary configuration: ${y}`,E)}}else if(d){m.querySelector("qti-interaction-modules")===null?(b=r.createElement("qti-interaction-modules"),m.appendChild(b)):b=m.querySelector("qti-interaction-modules");for(let y in d.paths){let E=d.paths[y],S="";p&&p.paths&&p.paths[y]&&(S=p.paths[y]);let q=Array.isArray(E)?E:[E],T=Array.isArray(S)?S:[S],M=q.map((O,N)=>{let tn=T.length>N?T[N]:"";return{primaryPath:O,fallbackPath:tn}});for(let O of T)M.some(N=>N.fallbackPath===O)||M.push({primaryPath:q.length>0?q[0]:O,fallbackPath:O});for(let O of M){let N=r.createElement("qti-interaction-module");O.fallbackPath&&N.setAttribute("fallback-path",O.fallbackPath),N.setAttribute("id",y),N.setAttribute("primary-path",O.primaryPath),b&&b.appendChild(N)}}}}return t},shuffleInteractions(){let i=r.querySelectorAll('[shuffle="true"]'),s=Array.from(i).filter(n=>n.tagName?.toLowerCase().endsWith("-interaction"));for(let n of s){let a=io(n.tagName.toLowerCase()),l=Array.isArray(a)?a:[a];for(let d of l){let p=Array.from(n.querySelectorAll(d)),m=p.map((q,T)=>({element:q,fixed:q.hasAttribute("fixed")&&q.getAttribute("fixed")==="true",originalOrder:T})).filter(q=>q.fixed),f=p.filter(q=>!q.hasAttribute("fixed")||q.getAttribute("fixed")!=="true");if(f.length<=1)return console.warn("Shuffling is not possible with fewer than 2 non-fixed elements."),t;let b=[...f],y=!1,E=0;for(;!y&&E<20;){E++;for(let q=f.length-1;q>0;q--){let T=Math.floor(Math.random()*(q+1));[f[q],f[T]]=[f[T],f[q]]}y=!f.every((q,T)=>q===b[T])}if(!y)return console.warn("Failed to shuffle the choices after multiple attempts."),null;n.removeAttribute("shuffle");let S=0;for(let q of f)q.parentElement.insertBefore(q,m[S]?.element),S++;for(let q of m)q.element.parentElement.insertBefore(q.element,f[q.originalOrder])}}return t},extendElementName:(i,s)=>(Ks(r,i,s),t),extendElementsWithClass:(i="extend")=>(Zs(r,i),t),customInteraction(i,s){let n=r.querySelector("qti-custom-interaction"),a=n.querySelector("object");return n.setAttribute("data-base-ref",i),n.setAttribute("data-base-item",i+s),n.setAttribute("data",a.getAttribute("data")),n.setAttribute("width",a.getAttribute("width")),n.setAttribute("height",a.getAttribute("height")),n.removeChild(a),t},convertCDATAtoComment(){return to(r),t},stripStyleSheets(){return ro(r),t},html(){return e!==null&&dt(r,e.substring(0,e.lastIndexOf("/"))),new XMLSerializer().serializeToString(ct(r))},xml(){return new XMLSerializer().serializeToString(r)},htmlDoc(){return e!==null&&dt(r,e.substring(0,e.lastIndexOf("/"))),ct(r)},xmlDoc(){return r}};return t};var Vi=()=>{let o,r={async load(e,t){return new Promise((i,s)=>{jt(e,t).then(n=>(o=n,r.path(e.substring(0,e.lastIndexOf("/"))),i(r)))})},parse(e){return o=Bt(e),r},path:e=>(dt(o,e),r),fn(e){return e(o),r},items(){return eo(o)},html(){return new XMLSerializer().serializeToString(ct(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(){return ct(o)},xmlDoc(){return o}};return r};var Oi=class o extends Event{constructor(e,t){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0});this.element=e;this.item=t}static{this.eventName="qti-assessment-stimulus-ref-connected"}},pt=class extends v{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let e=this.closest("qti-assessment-item"),t=new Oi(this,e);this.dispatchEvent(t);let i=e?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!t.defaultPrevented&&i&&await this.updateStimulusRef(i)}async updateStimulusRef(e){let t=await Le().load(this.href).then(i=>i.htmlDoc());if(t){let i=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...i)}}};c([u({type:String})],pt.prototype,"identifier",2),c([u({type:String})],pt.prototype,"href",2),pt=c([g("qti-assessment-stimulus-ref")],pt);var Br=class extends v{};Br=c([g("qti-companion-materials-info")],Br);var Wt=class extends v{render(){return h`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let r=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",r?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let r={variable:t=>this._context?.variables.find(i=>i.identifier===t)?.value??"",correct:t=>this._context?.variables.find(i=>i.identifier===t)?.correctResponse??""},e={getVariable:t=>this._context?.variables.find(i=>i.identifier===t),updateOutcomeVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:i}}))},updateResponseVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,response:i}}))}};return this.operatorFunction(this._context,r,e)}};c([_({context:$,subscribe:!0}),C()],Wt.prototype,"_context",2),Wt=c([g("qti-custom-operator")],Wt);var wn=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Xt=o=>{if(typeof o=="string")return o;let r=wn();return r==="."?o.toLocaleString():o.toString().replace(".","").replace(r,".")};function Ni(o){return o==null}function Ke(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Y=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(r){let e=this._context.variables.find(i=>i.identifier===r)||null;if(this.outcomeIdentifier!==r||!e)return;let t=!1;Array.isArray(e.value)?t=e.value.includes(this.identifier):t=!Ni(this.identifier)&&!Ni(e?.value)&&this.identifier===e.value||!1,this.showFeedback(t)}showFeedback(r){this.showStatus=r&&this.showHide==="show"||!r&&this.showHide==="hide"?"on":"off"}};c([u({type:String,attribute:"show-hide"})],Y.prototype,"showHide",2),c([u({type:String,attribute:"outcome-identifier"})],Y.prototype,"outcomeIdentifier",2),c([u({type:String})],Y.prototype,"identifier",2),c([u({type:String,attribute:!1})],Y.prototype,"showStatus",2),c([_({context:$,subscribe:!0}),C()],Y.prototype,"_context",2);var Gt=class extends Y{render(){return h` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};Gt.styles=x`
27
27
  :host {
28
28
  display: block;
29
29
  }
@@ -5432,7 +5432,7 @@ div.full-correct-response-inline {
5432
5432
  :host([disabled]) {
5433
5433
  ${Qo};
5434
5434
  }
5435
- `,c([_({context:kt,subscribe:!0})],te.prototype,"computedContext",2),c([u({type:Boolean,reflect:!0})],te.prototype,"shown",2),c([u({type:Boolean,reflect:!0})],te.prototype,"disabled",2),c([u({type:String})],te.prototype,"showCorrectText",2),c([u({type:String})],te.prototype,"hideCorrectText",2),c([u({type:String})],te.prototype,"noCorrectResponseText",2),te=c([g("item-show-correct-response")],te);var Rt=class extends v{constructor(){super();this.configContext={};this._onItemContextChanged=this._handleItemContextChanged.bind(this);this._onAssessmentItemConnected=this._handleAssessmentItemConnected.bind(this);this._onHandleShowCorrectResponse=this._handleShowCorrectResponse.bind(this);this._onHandleShowCandidateCorrection=this._handleShowCandidateCorrection.bind(this);this._onHandleSwitchCorrectResponseMode=this._handleSwitchCorrectResponseMode.bind(this);this.addEventListener("qti-item-context-updated",this._onItemContextChanged),this.addEventListener("qti-assessment-item-connected",this._onAssessmentItemConnected),this.addEventListener("item-show-correct-response",this._onHandleShowCorrectResponse),this.addEventListener("item-show-candidate-correction",this._onHandleShowCandidateCorrection),this.addEventListener("item-switch-correct-response-mode",this._onHandleSwitchCorrectResponseMode)}_handleItemContextChanged(e){this._updateItemVariablesInTestContext(e.detail.itemContext.identifier,e.detail?.itemContext?.variables||[])}_handleAssessmentItemConnected(e){let t=e.detail._context.variables;this._qtiAssessmentItem=e.detail,this.computedContext=this.computedContext?.identifier===this._qtiAssessmentItem.identifier?{...this.computedContext,title:this._qtiAssessmentItem.title}:{identifier:this._qtiAssessmentItem.identifier,title:this._qtiAssessmentItem.title,adaptive:this._qtiAssessmentItem.getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:t,correctResponseMode:"internal"},this._updateItemVariablesInTestContext(this._qtiAssessmentItem.identifier,t||[])}_handleShowCorrectResponse(e){this._qtiAssessmentItem&&this._qtiAssessmentItem.showCorrectResponse(e.detail)}_handleShowCandidateCorrection(e){this._qtiAssessmentItem&&this._qtiAssessmentItem.showCandidateCorrection(e.detail)}_handleSwitchCorrectResponseMode(e){this._handleShowCorrectResponse(new CustomEvent("item-show-correct-response",{detail:!1,bubbles:!0})),this.configContext={...this.configContext,correctResponseMode:e.detail}}_updateItemVariablesInTestContext(e,t){let i=t?.find(p=>p.identifier=="SCORE")?.value,s=parseFloat(i?.toString()),n=t?.find(p=>p.identifier==="completionStatus")?.value,a=s!==void 0&&!isNaN(s)&&s>0,l=s!==void 0&&!isNaN(s)&&s<=0,d=n==="completed";this.computedContext={...this.computedContext,identifier:e,correct:a,incorrect:l,completed:d,variables:t}}render(){return h`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this._onItemContextChanged),this.removeEventListener("qti-assessment-item-connected",this._onAssessmentItemConnected)}};c([C(),X({context:kt})],Rt.prototype,"computedContext",2),c([C(),X({context:oe})],Rt.prototype,"configContext",2),Rt=c([g("qti-item")],Rt);var en={name:"@citolab/qti-components",repository:{type:"git",url:"git+https://github.com/Citolab/qti-components.git"},description:"QTI webcomponents",author:{name:"Patrick de Klein"},contributors:[{name:"Sander Looise"},{name:"Marcel Hoekstra"}],license:"GPLv3",private:!1,engines:{node:">=22.0.0"},version:"7.14.0",type:"module",main:"./dist/index.js",types:"./dist/index.d.ts",sideEffects:!0,exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./exports/*":{import:"./dist/exports/*"},"./qti-components":{types:"./dist/qti-components/index.d.ts",import:"./dist/qti-components/index.js"},"./qti-item":{types:"./dist/qti-item/index.d.ts",import:"./dist/qti-item/index.js"},"./qti-test":{types:"./dist/qti-test/index.d.ts",import:"./dist/qti-test/index.js"},"./qti-loader":{types:"./dist/qti-loader/index.d.ts",import:"./dist/qti-loader/index.js"},"./qti-transformers":{types:"./dist/qti-transformers/index.d.ts",import:"./dist/qti-transformers/index.js"},"./customElements":"./custom-elements.json","./react":"./dist/qti-components-jsx.d.ts","./item.css":"./dist/item.css","./cdn/*":"./cdn/*","./package.json":"./package.json"},files:["dist","cdn","custom-elements.json"],scripts:{storybook:"run-p storybook:dev cem:watch",watch:'nodemon --watch src --ext ts,css --exec "run-s tsup cem css && yalc push"',"-----------------------cmds--":"-","pre-commit":"run-s lint stylelint madge","commit-msg":"commitlint --edit","build-storybook":"npm run cem && storybook build","-----------------------scripts--":"-",build:"run-p cem css tsup","storybook:dev":"storybook dev -p 6006",cem:"cem analyze","cem:watch":"cem analyze --watch",css:"postcss src/item.css -d dist -m",ci:"npm ci",tsup:"tsup",publint:"publint",lint:"eslint src/**/*.ts",stylelint:'stylelint "src/**/*.css"',test:"vitest run",attw:"attw --profile esm-only --pack --exclude-entrypoints ./item.css ./react",chromatic:"node chromatic-runner.cjs",clean:"rm -rf dist cdn",madge:"madge --circular --extensions ts src",commitlint:"commitlint --edit","-----------------------npm--":"-",prepare:"husky"},peerDependencies:{"@heximal/templates":"^0.1.5","@lit/context":"^1.1.3",lit:"^3.2.1"},devDependencies:{"@arethetypeswrong/cli":"^0.18.2","@chromatic-com/storybook":"^4.1.1","@commitlint/cli":"^19.8.1","@commitlint/config-conventional":"^19.8.1","@custom-elements-manifest/analyzer":"^0.10.4","@eslint/js":"^9.29.0","@heximal/templates":"0.1.5","@lit/context":"^1.1.5","@open-wc/lit-helpers":"^0.7.0","@storybook/addon-a11y":"^9.1.5","@storybook/addon-docs":"^9.1.5","@storybook/addon-links":"^9.1.5","@storybook/addon-themes":"^9.1.5","@storybook/addon-vitest":"^9.1.5","@storybook/web-components-vite":"^9.1.5","@swc/core":"^1.12.1","@testing-library/dom":"^10.4.0","@types/dom-view-transitions":"^1.0.6","@types/node":"^24.0.3","@vitest/browser":"^3.2.4","@vitest/coverage-v8":"^3.2.4","@vitest/ui":"^3.2.4","@wc-toolkit/cem-inheritance":"^1.1.0","@wc-toolkit/cem-sorter":"^1.0.1","@wc-toolkit/cem-utilities":"^1.3.0","@wc-toolkit/changelog":"^1.0.1","@wc-toolkit/jsx-types":"^1.2.2","@wc-toolkit/storybook-helpers":"^9.0.0","@wc-toolkit/type-parser":"^1.1.0",autoprefixer:"^10.4.21",chromatic:"^13.0.0","custom-element-vs-code-integration":"^1.5.0","custom-elements-manifest-deprecator":"^1.2.0",dotenv:"^16.5.0",eslint:"^9.29.0","eslint-import-resolver-typescript":"^4.4.3","eslint-plugin-import":"^2.31.0","eslint-plugin-lit":"^2.1.1","eslint-plugin-lit-a11y":"^5.0.1","eslint-plugin-react":"^7.37.5","eslint-plugin-sort-imports-es6-autofix":"^0.6.0","eslint-plugin-storybook":"^9.1.5","eslint-plugin-wc":"^3.0.1","fast-xml-parser":"^5.2.5",globals:"^16.2.0",globby:"^14.1.0",husky:"^9.1.7",lit:"^3.3.0",madge:"^8.0.0","mdx-mermaid":"^2.0.3",mermaid:"^11.12.0",msw:"^2.11.5","msw-storybook-addon":"^2.0.5",nodemon:"^3.1.10","npm-run-all":"^4.1.5","path-browserify":"^1.0.1","pkg-pr-new":"^0.0.51",playwright:"^1.53.0",postcss:"^8.5.6","postcss-class-apply":"^4.0.1","postcss-cli":"^11.0.1","postcss-import":"^16.1.1","postcss-nesting":"^13.0.2",prettier:"3.5.3","prettier-v2":"npm:prettier@2.8.8",publint:"^0.3.12","remark-gfm":"^4.0.1","shadow-dom-testing-library":"^1.12.0",storybook:"^9.1.5","storybook-addon-tag-badges":"^2.0.1",stylelint:"^16.20.0","stylelint-config-standard":"^38.0.0","stylelint-prettier":"^5.0.3",tsup:"^8.5.0",typescript:"^5.8.3","typescript-eslint":"^8.34.1",vite:"^6.3.5","vite-tsconfig-paths":"^5.1.4",vitest:"^3.2.4",yalc:"^1.0.0-pre.53"},optionalDependencies:{"@rollup/rollup-linux-x64-gnu":"^4.43.0"},customElements:"custom-elements.json",bugs:{url:"https://github.com/Citolab/qti-components/issues"},homepage:"https://github.com/Citolab/qti-components#readme",overrides:{storybook:"$storybook"},msw:{workerDirectory:["public"]}};console.info("%cC\xBFTO%cLab%c: qti-components v%c%s%c loaded",'font-family: "PT Sans", font-weight:bold; color:green; font-size: smaller;vertical-align: sub',"font-weight:bold; color:green","font-weight:unset","font-weight:bold; color:#2563eb",en.version,"font-weight:unset");export{Ki as INITIAL_TEST_CONTEXT,Se as ItemContainer,te as ItemShowCorrectResponse,St as PrintItemVariables,Jr as QtiAnd,G as QtiAssessmentItem,_e as QtiAssessmentItemRef,Te as QtiAssessmentSection,pt as QtiAssessmentStimulusRef,Oi as QtiAssessmentStimulusRefConnectedEvent,et as QtiAssessmentTest,Jt as QtiAssociableHotspot,ut as QtiAssociateInteraction,Kr as QtiBaseValue,mt as QtiChoiceInteraction,Br as QtiCompanionMaterialsInfo,Gi as QtiContainerSize,Yi as QtiContains,oi as QtiContentBody,Ji as QtiCorrect,ve as QtiCustomInteraction,Wt as QtiCustomOperator,qt as QtiDefault,ys as QtiDelete,Pe as QtiEndAttemptInteraction,Qr as QtiEqual,Zr as QtiEqualRounded,U as QtiExtendedTextInteraction,Gt as QtiFeedbackBlock,Yt as QtiFeedbackInline,ss as QtiFieldValue,gt as QtiGap,ht as QtiGapImg,Kt as QtiGapMatchInteraction,ft as QtiGapText,Qi as QtiGcd,le as QtiGraphicAssociateInteraction,Zt as QtiGraphicGapMatchInteraction,Qt as QtiGraphicOrderInteraction,es as QtiGt,ts as QtiGte,Qe as QtiHotspotChoice,er as QtiHotspotInteraction,rr as QtiHottext,tr as QtiHottextInteraction,br as QtiIndex,sr as QtiInlineChoice,ye as QtiInlineChoiceInteraction,is as QtiIsNull,Rt as QtiItem,cr as QtiItemBody,ur as QtiLookupOutcomeValue,os as QtiLt,ns as QtiLte,ei as QtiMapResponse,ti as QtiMapResponsePoint,as as QtiMatch,xe as QtiMatchInteraction,ri as QtiMathOperator,or as QtiMediaInteraction,ls as QtiMember,Ze as QtiModalFeedback,cs as QtiMultiple,ds as QtiNot,rs as QtiNull,ps as QtiOr,qe as QtiOrderInteraction,us as QtiOrdered,me as QtiOutcomeDeclaration,dr as QtiOutcomeProcessing,Ui as QtiOutcomeProcessingProcessor,z as QtiPortableCustomInteraction,Di as QtiPositionObjectInteraction,nr as QtiPositionObjectStage,ms as QtiPower,gr as QtiPrintedVariable,hs as QtiProduct,Gr as QtiPrompt,vs as QtiRandom,Ct as QtiRandomInteger,ji as QtiResponseCondition,we as QtiResponseDeclaration,mr as QtiResponseElse,Xi as QtiResponseElseIf,hr as QtiResponseIf,pr as QtiResponseProcessing,Zi as QtiRound,fr as QtiRoundTo,ue as QtiRubricBlock,de as QtiRule,ce as QtiSelectPointInteraction,Bi as QtiSetOutcomeValue,Wi as QtiSetOutcomeValueRule,De as QtiSimpleAssociableChoice,Ce as QtiSimpleChoice,Ee as QtiSliderInteraction,si as QtiStringMatch,ni as QtiStylesheet,ii as QtiSubtract,fs as QtiSum,gs as QtiSumExpression,ai as QtiTest,vr as QtiTestFeedback,Ae as QtiTestPart,J as QtiTextEntryInteraction,lr as QtiUploadInteraction,bs as QtiVariable,kr as TestCheckItem,ke as TestContainer,yr as TestEndAttempt,wt as TestItemLink,Z as TestNavigation,Fe as TestNext,wr as TestPagingButtonsStamp,Ue as TestPrev,Tr as TestPrintContext,_t as TestPrintVariables,it as TestScoringButtons,At as TestScoringFeedback,_r as TestSectionButtonsStamp,Tt as TestSectionLink,ee as TestShowCorrectResponse,rt as TestStamp,W as TestView,Ar as TestViewToggle,Mn as qtiAndMixin,In as qtiSubtractMixin,pe as testContext};
5435
+ `,c([_({context:kt,subscribe:!0})],te.prototype,"computedContext",2),c([u({type:Boolean,reflect:!0})],te.prototype,"shown",2),c([u({type:Boolean,reflect:!0})],te.prototype,"disabled",2),c([u({type:String})],te.prototype,"showCorrectText",2),c([u({type:String})],te.prototype,"hideCorrectText",2),c([u({type:String})],te.prototype,"noCorrectResponseText",2),te=c([g("item-show-correct-response")],te);var Rt=class extends v{constructor(){super();this.configContext={};this._onItemContextChanged=this._handleItemContextChanged.bind(this);this._onAssessmentItemConnected=this._handleAssessmentItemConnected.bind(this);this._onHandleShowCorrectResponse=this._handleShowCorrectResponse.bind(this);this._onHandleShowCandidateCorrection=this._handleShowCandidateCorrection.bind(this);this._onHandleSwitchCorrectResponseMode=this._handleSwitchCorrectResponseMode.bind(this);this.addEventListener("qti-item-context-updated",this._onItemContextChanged),this.addEventListener("qti-assessment-item-connected",this._onAssessmentItemConnected),this.addEventListener("item-show-correct-response",this._onHandleShowCorrectResponse),this.addEventListener("item-show-candidate-correction",this._onHandleShowCandidateCorrection),this.addEventListener("item-switch-correct-response-mode",this._onHandleSwitchCorrectResponseMode)}_handleItemContextChanged(e){this._updateItemVariablesInTestContext(e.detail.itemContext.identifier,e.detail?.itemContext?.variables||[])}_handleAssessmentItemConnected(e){let t=e.detail._context.variables;this._qtiAssessmentItem=e.detail,this.computedContext=this.computedContext?.identifier===this._qtiAssessmentItem.identifier?{...this.computedContext,title:this._qtiAssessmentItem.title}:{identifier:this._qtiAssessmentItem.identifier,title:this._qtiAssessmentItem.title,adaptive:this._qtiAssessmentItem.getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:t,correctResponseMode:"internal"},this._updateItemVariablesInTestContext(this._qtiAssessmentItem.identifier,t||[])}_handleShowCorrectResponse(e){this._qtiAssessmentItem&&this._qtiAssessmentItem.showCorrectResponse(e.detail)}_handleShowCandidateCorrection(e){this._qtiAssessmentItem&&this._qtiAssessmentItem.showCandidateCorrection(e.detail)}_handleSwitchCorrectResponseMode(e){this._handleShowCorrectResponse(new CustomEvent("item-show-correct-response",{detail:!1,bubbles:!0})),this.configContext={...this.configContext,correctResponseMode:e.detail}}_updateItemVariablesInTestContext(e,t){let i=t?.find(p=>p.identifier=="SCORE")?.value,s=parseFloat(i?.toString()),n=t?.find(p=>p.identifier==="completionStatus")?.value,a=s!==void 0&&!isNaN(s)&&s>0,l=s!==void 0&&!isNaN(s)&&s<=0,d=n==="completed";this.computedContext={...this.computedContext,identifier:e,correct:a,incorrect:l,completed:d,variables:t}}render(){return h`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this._onItemContextChanged),this.removeEventListener("qti-assessment-item-connected",this._onAssessmentItemConnected)}};c([C(),X({context:kt})],Rt.prototype,"computedContext",2),c([C(),X({context:oe})],Rt.prototype,"configContext",2),Rt=c([g("qti-item")],Rt);var en={name:"@citolab/qti-components",repository:{type:"git",url:"git+https://github.com/Citolab/qti-components.git"},description:"QTI webcomponents",author:{name:"Patrick de Klein"},contributors:[{name:"Sander Looise"},{name:"Marcel Hoekstra"}],license:"GPLv3",private:!1,engines:{node:">=22.0.0"},version:"7.14.2",type:"module",main:"./dist/index.js",types:"./dist/index.d.ts",sideEffects:!0,exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./exports/*":{import:"./dist/exports/*"},"./qti-components":{types:"./dist/qti-components/index.d.ts",import:"./dist/qti-components/index.js"},"./qti-item":{types:"./dist/qti-item/index.d.ts",import:"./dist/qti-item/index.js"},"./qti-test":{types:"./dist/qti-test/index.d.ts",import:"./dist/qti-test/index.js"},"./qti-loader":{types:"./dist/qti-loader/index.d.ts",import:"./dist/qti-loader/index.js"},"./qti-transformers":{types:"./dist/qti-transformers/index.d.ts",import:"./dist/qti-transformers/index.js"},"./customElements":"./custom-elements.json","./react":"./dist/qti-components-jsx.d.ts","./item.css":"./dist/item.css","./cdn/*":"./cdn/*","./package.json":"./package.json"},files:["dist","cdn","custom-elements.json"],scripts:{storybook:"run-p storybook:dev cem:watch",watch:'nodemon --watch src --ext ts,css --exec "run-s tsup cem css && yalc push"',"-----------------------cmds--":"-","pre-commit":"run-s lint stylelint madge","commit-msg":"commitlint --edit","build-storybook":"npm run cem && storybook build","-----------------------scripts--":"-",build:"run-p cem css tsup","storybook:dev":"storybook dev -p 6006",cem:"cem analyze","cem:watch":"cem analyze --watch",css:"postcss src/item.css -d dist -m",ci:"npm ci",tsup:"tsup",publint:"publint",lint:"eslint src/**/*.ts",stylelint:'stylelint "src/**/*.css"',test:"vitest run",attw:"attw --profile esm-only --pack --exclude-entrypoints ./item.css ./react",chromatic:"node chromatic-runner.cjs",clean:"rm -rf dist cdn",madge:"madge --circular --extensions ts src",commitlint:"commitlint --edit","-----------------------npm--":"-",prepare:"husky"},peerDependencies:{"@heximal/templates":"^0.1.5","@lit/context":"^1.1.3",lit:"^3.2.1"},devDependencies:{"@arethetypeswrong/cli":"^0.18.2","@chromatic-com/storybook":"^4.1.1","@commitlint/cli":"^19.8.1","@commitlint/config-conventional":"^19.8.1","@custom-elements-manifest/analyzer":"^0.10.4","@eslint/js":"^9.29.0","@heximal/templates":"0.1.5","@lit/context":"^1.1.5","@open-wc/lit-helpers":"^0.7.0","@storybook/addon-a11y":"^9.1.5","@storybook/addon-docs":"^9.1.5","@storybook/addon-links":"^9.1.5","@storybook/addon-themes":"^9.1.5","@storybook/addon-vitest":"^9.1.5","@storybook/web-components-vite":"^9.1.5","@swc/core":"^1.12.1","@testing-library/dom":"^10.4.0","@types/dom-view-transitions":"^1.0.6","@types/node":"^24.0.3","@vitest/browser":"^3.2.4","@vitest/coverage-v8":"^3.2.4","@vitest/ui":"^3.2.4","@wc-toolkit/cem-inheritance":"^1.1.0","@wc-toolkit/cem-sorter":"^1.0.1","@wc-toolkit/cem-utilities":"^1.3.0","@wc-toolkit/changelog":"^1.0.1","@wc-toolkit/jsx-types":"^1.2.2","@wc-toolkit/storybook-helpers":"^9.0.0","@wc-toolkit/type-parser":"^1.1.0",autoprefixer:"^10.4.21",chromatic:"^13.0.0","custom-element-vs-code-integration":"^1.5.0","custom-elements-manifest-deprecator":"^1.2.0",dotenv:"^16.5.0",eslint:"^9.29.0","eslint-import-resolver-typescript":"^4.4.3","eslint-plugin-import":"^2.31.0","eslint-plugin-lit":"^2.1.1","eslint-plugin-lit-a11y":"^5.0.1","eslint-plugin-react":"^7.37.5","eslint-plugin-sort-imports-es6-autofix":"^0.6.0","eslint-plugin-storybook":"^9.1.5","eslint-plugin-wc":"^3.0.1","fast-xml-parser":"^5.2.5",globals:"^16.2.0",globby:"^14.1.0",husky:"^9.1.7",lit:"^3.3.0",madge:"^8.0.0","mdx-mermaid":"^2.0.3",mermaid:"^11.12.0",msw:"^2.11.5","msw-storybook-addon":"^2.0.5",nodemon:"^3.1.10","npm-run-all":"^4.1.5","path-browserify":"^1.0.1","pkg-pr-new":"^0.0.51",playwright:"^1.53.0",postcss:"^8.5.6","postcss-class-apply":"^4.0.1","postcss-cli":"^11.0.1","postcss-import":"^16.1.1","postcss-nesting":"^13.0.2",prettier:"3.5.3","prettier-v2":"npm:prettier@2.8.8",publint:"^0.3.12","remark-gfm":"^4.0.1","shadow-dom-testing-library":"^1.12.0",storybook:"^9.1.5","storybook-addon-tag-badges":"^2.0.1",stylelint:"^16.20.0","stylelint-config-standard":"^38.0.0","stylelint-prettier":"^5.0.3",tsup:"^8.5.0",typescript:"^5.8.3","typescript-eslint":"^8.34.1",vite:"^6.3.5","vite-tsconfig-paths":"^5.1.4",vitest:"^3.2.4",yalc:"^1.0.0-pre.53"},optionalDependencies:{"@rollup/rollup-linux-x64-gnu":"^4.43.0"},customElements:"custom-elements.json",bugs:{url:"https://github.com/Citolab/qti-components/issues"},homepage:"https://github.com/Citolab/qti-components#readme",overrides:{storybook:"$storybook"},msw:{workerDirectory:["public"]}};console.info("%cC\xBFTO%cLab%c: qti-components v%c%s%c loaded",'font-family: "PT Sans", font-weight:bold; color:green; font-size: smaller;vertical-align: sub',"font-weight:bold; color:green","font-weight:unset","font-weight:bold; color:#2563eb",en.version,"font-weight:unset");export{Ki as INITIAL_TEST_CONTEXT,Se as ItemContainer,te as ItemShowCorrectResponse,St as PrintItemVariables,Jr as QtiAnd,G as QtiAssessmentItem,_e as QtiAssessmentItemRef,Te as QtiAssessmentSection,pt as QtiAssessmentStimulusRef,Oi as QtiAssessmentStimulusRefConnectedEvent,et as QtiAssessmentTest,Jt as QtiAssociableHotspot,ut as QtiAssociateInteraction,Kr as QtiBaseValue,mt as QtiChoiceInteraction,Br as QtiCompanionMaterialsInfo,Gi as QtiContainerSize,Yi as QtiContains,oi as QtiContentBody,Ji as QtiCorrect,ve as QtiCustomInteraction,Wt as QtiCustomOperator,qt as QtiDefault,ys as QtiDelete,Pe as QtiEndAttemptInteraction,Qr as QtiEqual,Zr as QtiEqualRounded,U as QtiExtendedTextInteraction,Gt as QtiFeedbackBlock,Yt as QtiFeedbackInline,ss as QtiFieldValue,gt as QtiGap,ht as QtiGapImg,Kt as QtiGapMatchInteraction,ft as QtiGapText,Qi as QtiGcd,le as QtiGraphicAssociateInteraction,Zt as QtiGraphicGapMatchInteraction,Qt as QtiGraphicOrderInteraction,es as QtiGt,ts as QtiGte,Qe as QtiHotspotChoice,er as QtiHotspotInteraction,rr as QtiHottext,tr as QtiHottextInteraction,br as QtiIndex,sr as QtiInlineChoice,ye as QtiInlineChoiceInteraction,is as QtiIsNull,Rt as QtiItem,cr as QtiItemBody,ur as QtiLookupOutcomeValue,os as QtiLt,ns as QtiLte,ei as QtiMapResponse,ti as QtiMapResponsePoint,as as QtiMatch,xe as QtiMatchInteraction,ri as QtiMathOperator,or as QtiMediaInteraction,ls as QtiMember,Ze as QtiModalFeedback,cs as QtiMultiple,ds as QtiNot,rs as QtiNull,ps as QtiOr,qe as QtiOrderInteraction,us as QtiOrdered,me as QtiOutcomeDeclaration,dr as QtiOutcomeProcessing,Ui as QtiOutcomeProcessingProcessor,z as QtiPortableCustomInteraction,Di as QtiPositionObjectInteraction,nr as QtiPositionObjectStage,ms as QtiPower,gr as QtiPrintedVariable,hs as QtiProduct,Gr as QtiPrompt,vs as QtiRandom,Ct as QtiRandomInteger,ji as QtiResponseCondition,we as QtiResponseDeclaration,mr as QtiResponseElse,Xi as QtiResponseElseIf,hr as QtiResponseIf,pr as QtiResponseProcessing,Zi as QtiRound,fr as QtiRoundTo,ue as QtiRubricBlock,de as QtiRule,ce as QtiSelectPointInteraction,Bi as QtiSetOutcomeValue,Wi as QtiSetOutcomeValueRule,De as QtiSimpleAssociableChoice,Ce as QtiSimpleChoice,Ee as QtiSliderInteraction,si as QtiStringMatch,ni as QtiStylesheet,ii as QtiSubtract,fs as QtiSum,gs as QtiSumExpression,ai as QtiTest,vr as QtiTestFeedback,Ae as QtiTestPart,J as QtiTextEntryInteraction,lr as QtiUploadInteraction,bs as QtiVariable,kr as TestCheckItem,ke as TestContainer,yr as TestEndAttempt,wt as TestItemLink,Z as TestNavigation,Fe as TestNext,wr as TestPagingButtonsStamp,Ue as TestPrev,Tr as TestPrintContext,_t as TestPrintVariables,it as TestScoringButtons,At as TestScoringFeedback,_r as TestSectionButtonsStamp,Tt as TestSectionLink,ee as TestShowCorrectResponse,rt as TestStamp,W as TestView,Ar as TestViewToggle,Mn as qtiAndMixin,In as qtiSubtractMixin,pe as testContext};
5436
5436
  /*! Bundled license information:
5437
5437
 
5438
5438
  @lit/context/lib/context-request-event.js:
@@ -26742,21 +26742,27 @@
26742
26742
  "kind": "field",
26743
26743
  "name": "view",
26744
26744
  "type": {
26745
- "text": "ViewMode"
26745
+ "text": "View"
26746
26746
  },
26747
26747
  "privacy": "public",
26748
26748
  "default": "null",
26749
- "attribute": "view"
26749
+ "attribute": "view",
26750
+ "parsedType": {
26751
+ "text": "'' | 'author' | 'candidate' | 'proctor' | 'scorer' | 'testConstructor' | 'tutor'"
26752
+ }
26750
26753
  }
26751
26754
  ],
26752
26755
  "attributes": [
26753
26756
  {
26754
26757
  "name": "view",
26755
26758
  "type": {
26756
- "text": "ViewMode"
26759
+ "text": "View"
26757
26760
  },
26758
26761
  "default": "null",
26759
- "fieldName": "view"
26762
+ "fieldName": "view",
26763
+ "parsedType": {
26764
+ "text": "'' | 'author' | 'candidate' | 'proctor' | 'scorer' | 'testConstructor' | 'tutor'"
26765
+ }
26760
26766
  }
26761
26767
  ],
26762
26768
  "superclass": {
@@ -1,36 +1,36 @@
1
1
  import {
2
- QtiFeedback,
3
- convertNumberToUniversalFormat,
4
- liveQuery,
5
- removeDoubleSlashes
6
- } from "./chunk-YD7FVKDP.js";
7
- import {
8
- watch
9
- } from "./chunk-ELDMXTUQ.js";
2
+ Interaction
3
+ } from "./chunk-P4QBOVQ2.js";
10
4
  import {
11
- qtiTransformItem
12
- } from "./chunk-LJ4KAG72.js";
5
+ itemContextVariables
6
+ } from "./chunk-JQ6HWGRY.js";
13
7
  import {
14
8
  QtiConditionExpression
15
9
  } from "./chunk-SV4K25ZI.js";
16
10
  import {
17
11
  QtiExpression
18
12
  } from "./chunk-GAAFN7QF.js";
13
+ import {
14
+ QtiFeedback,
15
+ convertNumberToUniversalFormat,
16
+ liveQuery,
17
+ removeDoubleSlashes
18
+ } from "./chunk-YD7FVKDP.js";
19
19
  import {
20
20
  testContext
21
21
  } from "./chunk-CJADUWEC.js";
22
- import {
23
- Interaction
24
- } from "./chunk-P4QBOVQ2.js";
25
22
  import {
26
23
  itemContext
27
24
  } from "./chunk-NJNQOQUU.js";
25
+ import {
26
+ watch
27
+ } from "./chunk-ELDMXTUQ.js";
28
+ import {
29
+ qtiTransformItem
30
+ } from "./chunk-XBPO6E25.js";
28
31
  import {
29
32
  configContext
30
33
  } from "./chunk-BHJSX3Q6.js";
31
- import {
32
- itemContextVariables
33
- } from "./chunk-JQ6HWGRY.js";
34
34
  import {
35
35
  __decorateClass
36
36
  } from "./chunk-H2JE6IVU.js";
@@ -8827,4 +8827,4 @@ export {
8827
8827
  QtiOutcomeDeclaration,
8828
8828
  QtiResponseDeclaration
8829
8829
  };
8830
- //# sourceMappingURL=chunk-SJGUMIKK.js.map
8830
+ //# sourceMappingURL=chunk-2X2C5WI5.js.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-ELDMXTUQ.js";
7
7
  import {
8
8
  qtiTransformItem
9
- } from "./chunk-LJ4KAG72.js";
9
+ } from "./chunk-XBPO6E25.js";
10
10
  import {
11
11
  computedItemContext
12
12
  } from "./chunk-4OGJBG35.js";
@@ -362,4 +362,4 @@ export {
362
362
  ItemShowCorrectResponse,
363
363
  QtiItem
364
364
  };
365
- //# sourceMappingURL=chunk-CNLDFJAA.js.map
365
+ //# sourceMappingURL=chunk-7567ZPN6.js.map
@@ -46,7 +46,7 @@ function extendElementsWithClass(xmlFragment, classNamePattern) {
46
46
  });
47
47
  }
48
48
  function createElementWithNewTagName(element, newTagName) {
49
- const newElement = document.createElement(newTagName);
49
+ const newElement = element.ownerDocument.createElement(newTagName);
50
50
  for (const attr of element.attributes) {
51
51
  newElement.setAttribute(attr.name, attr.value);
52
52
  }
@@ -489,4 +489,4 @@ export {
489
489
  qtiTransformManifest,
490
490
  qtiTransformTest
491
491
  };
492
- //# sourceMappingURL=chunk-LJ4KAG72.js.map
492
+ //# sourceMappingURL=chunk-XBPO6E25.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-transformers/qti-transformers.ts","../../src/lib/qti-transformers/qti-transform-item.ts","../../src/lib/qti-transformers/qti-transform-manifest.ts","../../src/lib/qti-transformers/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, newTagName) {\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) {\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 }\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, signal) {\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,QAAQ,aAAW;AACnD,UAAM,YAAY,QAAQ;AAC1B,QAAI,WAAW;AACb,gBAAU,QAAQ,eAAa;AAC7B,YAAI,UAAU,WAAW,GAAG,gBAAgB,GAAG,GAAG;AAChD,gBAAM,SAAS,UAAU,MAAM,GAAG,gBAAgB,IAAI,MAAM;AAC5D,gBAAM,aAAa,GAAG,QAAQ,QAAQ,IAAI,MAAM;AAChD,gBAAM,aAAa,4BAA4B,SAAS,UAAU;AAClE,kBAAQ,YAAY,UAAU;AAAA,QAChC;AAAA,MACF,CAAC;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AG,CAAC,CAAC;AAC/C,iBAAO,QAAQ,GAAG;AAAA,QACpB,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAAA,IACA,MAAM,WAAmB;AACvB,oBAAc,SAAS,SAAS;AAChC,aAAO;AAAA,IACT;AAAA,IACA,MAAM,CAAC,aAAiC;AACtC,kBAAY,aAAa,QAAQ;AACjC,aAAO;AAAA,IACT;AAAA,IACA,GAAG,IAAwC;AACzC,SAAG,WAAW;AACd,aAAO;AAAA,IACT;AAAA,IACA,QAAQ;AACN,aAAO,cAAc,WAAW;AAAA,IAClC;AAAA,IACA,OAAO;AACL,aAAO,IAAI,cAAc,EAAE,kBAAkB,OAAO,WAAW,CAAC;AAAA,IAClE;AAAA,IACA,MAAc;AACZ,aAAO,IAAI,cAAc,EAAE,kBAAkB,WAAW;AAAA,IAC1D;AAAA,IACA,UAAU;AACR,aAAO,OAAO,WAAW;AAAA,IAC3B;AAAA,IACA,SAAsB;AACpB,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;","names":["xml","fallbackPath","path","originalOrder","xml","xml"]}
@@ -1,27 +1,27 @@
1
1
  import {
2
- QtiModalFeedback
3
- } from "./chunk-YD7FVKDP.js";
2
+ INITIAL_SESSION_CONTEXT,
3
+ sessionContext
4
+ } from "./chunk-C5RLRG3L.js";
4
5
  import {
5
6
  item_default
6
7
  } from "./chunk-PT5ASWGQ.js";
7
8
  import {
8
- watch
9
- } from "./chunk-ELDMXTUQ.js";
9
+ QtiModalFeedback
10
+ } from "./chunk-YD7FVKDP.js";
10
11
  import {
11
- qtiTransformItem,
12
- qtiTransformTest
13
- } from "./chunk-LJ4KAG72.js";
12
+ INITIAL_TEST_CONTEXT,
13
+ testContext
14
+ } from "./chunk-CJADUWEC.js";
14
15
  import {
15
16
  qtiContext
16
17
  } from "./chunk-H6KHXSIO.js";
17
18
  import {
18
- INITIAL_SESSION_CONTEXT,
19
- sessionContext
20
- } from "./chunk-C5RLRG3L.js";
19
+ watch
20
+ } from "./chunk-ELDMXTUQ.js";
21
21
  import {
22
- INITIAL_TEST_CONTEXT,
23
- testContext
24
- } from "./chunk-CJADUWEC.js";
22
+ qtiTransformItem,
23
+ qtiTransformTest
24
+ } from "./chunk-XBPO6E25.js";
25
25
  import {
26
26
  computedContext
27
27
  } from "./chunk-DVQQ7I6Y.js";
@@ -2289,4 +2289,4 @@ export {
2289
2289
  TestScoringFeedback,
2290
2290
  TestCheckItem
2291
2291
  };
2292
- //# sourceMappingURL=chunk-XD7DR5YG.js.map
2292
+ //# sourceMappingURL=chunk-Z2FFXTKX.js.map