qti3-item-player-vue3 0.2.3 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
|
|
1
|
-
(function(l,Xe){typeof exports=="object"&&typeof module<"u"?module.exports=Xe(require("vue")):typeof define=="function"&&define.amd?define(["vue"],Xe):(l=typeof globalThis<"u"?globalThis:l||self,l.Qti3Player=Xe(l.Vue))})(this,function(l){"use strict";var U3=Object.defineProperty;var G3=(l,Xe,Ds)=>Xe in l?U3(l,Xe,{enumerable:!0,configurable:!0,writable:!0,value:Ds}):l[Xe]=Ds;var J=(l,Xe,Ds)=>G3(l,typeof Xe!="symbol"?Xe+"":Xe,Ds);class Xe{constructor(t,i,s){this.fieldIdentifier=t,this.value=s,this.baseType=i,this.cardinality="single"}getValue(){return this.value}setValue(t){this.value=t}getBaseType(){return this.baseType}setBaseType(t){this.baseType=t}getCardinality(){return this.cardinality}getFieldIdentifier(){return this.fieldIdentifier}setFieldIdentifier(t){this.fieldIdentifier=t}}class Ds{constructor(){J(this,"constants",{COLOR_DEFAULT:"qti3-player-color-default",COLOR_DEFAULT_REVERSE:"qti3-player-color-defaultreverse",COLOR_BLACK_WHITE:"qti3-player-color-blackwhite",COLOR_WHITE_BLACK:"qti3-player-color-whiteblack",COLOR_BLACK_ROSE:"qti3-player-color-blackrose",COLOR_ROSE_BLACK:"qti3-player-color-roseblack",COLOR_YELLOW_BLUE:"qti3-player-color-yellowblue",COLOR_BLUE_YELLOW:"qti3-player-color-blueyellow",COLOR_MGRAY_DGRAY:"qti3-player-color-mgraydgray",COLOR_DGRAY_MGRAY:"qti3-player-color-dgraymgray",COLOR_BLACK_CYAN:"qti3-player-color-blackcyan",COLOR_CYAN_BLACK:"qti3-player-color-cyanblack",COLOR_BLACK_CREAM:"qti3-player-color-blackcream",COLOR_CREAM_BLACK:"qti3-player-color-creamblack",GLOSSARY_ON:"glossary-on",GLOSSARY_OFF:"glossary-off",KEYWORD_TRANS_OFF:"ktlang-off",KEYWORD_TRANS_AR:"ktlang-ar",KEYWORD_TRANS_CMN:"ktlang-cmn",KEYWORD_TRANS_DE:"ktlang-de",KEYWORD_TRANS_EN:"ktlang-en",KEYWORD_TRANS_ES:"ktlang-es",KEYWORD_TRANS_FR:"ktlang-fr",KEYWORD_TRANS_HMN:"ktlang-hmn",KEYWORD_TRANS_IT:"ktlang-it",KEYWORD_TRANS_JA:"ktlang-ja",KEYWORD_TRANS_KO:"ktlang-ko",KEYWORD_TRANS_MY:"ktlang-my",KEYWORD_TRANS_NL:"ktlang-nl",KEYWORD_TRANS_PA:"ktlang-pa",KEYWORD_TRANS_RU:"ktlang-ru",KEYWORD_TRANS_SO:"ktlang-so",KEYWORD_TRANS_TL:"ktlang-tl",KEYWORD_TRANS_UK:"ktlang-uk",KEYWORD_TRANS_VI:"ktlang-vi",KEYWORD_TRANS_YUE:"ktlang-yue",KEYWORD_TRANS_ZH:"ktlang-zh",EXT_SBAC_GLOSSARY_ILLUSTRATION_ON:"sbacGlossaryIllustration-on",EXT_SBAC_GLOSSARY_ILLUSTRATION_OFF:"sbacGlossaryIllustration-off"});return this.pnp=this.defaultPnp(),this}defaultPnp(){return{textAppearance:{colorStyle:this.constants.COLOR_DEFAULT},glossaryOnScreen:!0,keywordTranslationLanguage:"",extSbacGlossaryIllustration:!1,layoutSingleColumn:!1}}setPnp(t){typeof t>"u"||(t===null&&(this.pnp=this.defaultPnp()),"textAppearance"in t&&t.textAppearance!==null&&"colorStyle"in t.textAppearance&&this.setColorStyle(t.textAppearance.colorStyle),"glossaryOnScreen"in t&&t.glossaryOnScreen!==null&&this.setGlossaryOnScreen(t.glossaryOnScreen),"keywordTranslationLanguage"in t&&this.setKeywordTranslationLanguage(t.keywordTranslationLanguage),"extSbacGlossaryIllustration"in t&&t.extSbacGlossaryIllustration!==null&&this.setExtSbacGlossaryIllustration(t.extSbacGlossaryIllustration),"layoutSingleColumn"in t&&t.layoutSingleColumn!==null&&this.setLayoutSingleColumn(t.layoutSingleColumn))}getPnp(){return this.pnp}getColorStyle(){return this.pnp.textAppearance.colorStyle}setColorStyle(t){this.pnp.textAppearance.colorStyle=t}getGlossaryOnScreen(){return this.pnp.glossaryOnScreen}setGlossaryOnScreen(t){this.pnp.glossaryOnScreen=t}getKeywordTranslationLanguage(){return this.pnp.keywordTranslationLanguage}setKeywordTranslationLanguage(t){this.pnp.keywordTranslationLanguage=t}getExtSbacGlossaryIllustration(){return this.pnp.extSbacGlossaryIllustration}setExtSbacGlossaryIllustration(t){this.pnp.extSbacGlossaryIllustration=t}getLayoutSingleColumn(){return this.pnp.layoutSingleColumn}setLayoutSingleColumn(t){this.pnp.layoutSingleColumn=t}evaluatePnpEvent(t){let i=!1;switch(t){case this.constants.GLOSSARY_ON:this.getGlossaryOnScreen()===!1&&(this.setGlossaryOnScreen(!0),i=!0);break;case this.constants.GLOSSARY_OFF:this.getGlossaryOnScreen()===!0&&(this.setGlossaryOnScreen(!1),i=!0);break;case this.constants.KEYWORD_TRANS_OFF:this.getKeywordTranslationLanguage()!==""&&(this.setKeywordTranslationLanguage(""),i=!0);break;case this.constants.KEYWORD_TRANS_AR:this.getKeywordTranslationLanguage()!=="ar"&&(this.setKeywordTranslationLanguage("ar"),i=!0);break;case this.constants.KEYWORD_TRANS_CMN:this.getKeywordTranslationLanguage()!=="cmn"&&(this.setKeywordTranslationLanguage("cmn"),i=!0);break;case this.constants.KEYWORD_TRANS_DE:this.getKeywordTranslationLanguage()!=="de"&&(this.setKeywordTranslationLanguage("de"),i=!0);break;case this.constants.KEYWORD_TRANS_EN:this.getKeywordTranslationLanguage()!=="en"&&(this.setKeywordTranslationLanguage("en"),i=!0);break;case this.constants.KEYWORD_TRANS_ES:this.getKeywordTranslationLanguage()!=="es"&&(this.setKeywordTranslationLanguage("es"),i=!0);break;case this.constants.KEYWORD_TRANS_FR:this.getKeywordTranslationLanguage()!=="fr"&&(this.setKeywordTranslationLanguage("fr"),i=!0);break;case this.constants.KEYWORD_TRANS_HMN:this.getKeywordTranslationLanguage()!=="hmn"&&(this.setKeywordTranslationLanguage("hmn"),i=!0);break;case this.constants.KEYWORD_TRANS_IT:this.getKeywordTranslationLanguage()!=="it"&&(this.setKeywordTranslationLanguage("it"),i=!0);break;case this.constants.KEYWORD_TRANS_JA:this.getKeywordTranslationLanguage()!=="ja"&&(this.setKeywordTranslationLanguage("ja"),i=!0);break;case this.constants.KEYWORD_TRANS_KO:this.getKeywordTranslationLanguage()!=="ko"&&(this.setKeywordTranslationLanguage("ko"),i=!0);break;case this.constants.KEYWORD_TRANS_MY:this.getKeywordTranslationLanguage()!=="my"&&(this.setKeywordTranslationLanguage("my"),i=!0);break;case this.constants.KEYWORD_TRANS_NL:this.getKeywordTranslationLanguage()!=="nl"&&(this.setKeywordTranslationLanguage("nl"),i=!0);break;case this.constants.KEYWORD_TRANS_PA:this.getKeywordTranslationLanguage()!=="pa"&&(this.setKeywordTranslationLanguage("pa"),i=!0);break;case this.constants.KEYWORD_TRANS_RU:this.getKeywordTranslationLanguage()!=="ru"&&(this.setKeywordTranslationLanguage("ru"),i=!0);break;case this.constants.KEYWORD_TRANS_SO:this.getKeywordTranslationLanguage()!=="so"&&(this.setKeywordTranslationLanguage("so"),i=!0);break;case this.constants.KEYWORD_TRANS_TL:this.getKeywordTranslationLanguage()!=="tl"&&(this.setKeywordTranslationLanguage("tl"),i=!0);break;case this.constants.KEYWORD_TRANS_UK:this.getKeywordTranslationLanguage()!=="uk"&&(this.setKeywordTranslationLanguage("uk"),i=!0);break;case this.constants.KEYWORD_TRANS_VI:this.getKeywordTranslationLanguage()!=="vi"&&(this.setKeywordTranslationLanguage("vi"),i=!0);break;case this.constants.KEYWORD_TRANS_YUE:this.getKeywordTranslationLanguage()!=="yue"&&(this.setKeywordTranslationLanguage("yue"),i=!0);break;case this.constants.KEYWORD_TRANS_ZH:this.getKeywordTranslationLanguage()!=="zh"&&(this.setKeywordTranslationLanguage("zh"),i=!0);break;case this.constants.EXT_SBAC_GLOSSARY_ILLUSTRATION_ON:this.getExtSbacGlossaryIllustration()===!1&&(this.setExtSbacGlossaryIllustration(!0),i=!0);break;case this.constants.EXT_SBAC_GLOSSARY_ILLUSTRATION_OFF:this.getExtSbacGlossaryIllustration()===!0&&(this.setExtSbacGlossaryIllustration(!1),i=!0);break}return i}}class Pb{constructor(){J(this,"constants",{TIME_LIMITS_DEFAULT:{min_time:null,max_time:null,allow_late_submission:!1},ATTEMPTS_UNLIMITED:0});return this.sc=this.defaultSessionControl(),this}defaultSessionControl(){return this.sc={allow_comment:!1,allow_review:!0,allow_skipping:!0,max_attempts:this.constants.ATTEMPTS_UNLIMITED,show_feedback:!1,show_solution:!1,time_limits:this.constants.TIME_LIMITS_DEFAULT,validate_responses:!1},this.sc}setSessionControl(t){if(!(typeof t>"u")){if(t===null)return this.sc=this.defaultSessionControl();"allow_comment"in t&&t.allow_comment!==null&&this.setAllowComment(t.allow_comment),"allow_review"in t&&t.allow_review!==null&&this.setAllowReview(t.allow_review),"allow_skipping"in t&&t.allow_skipping!==null&&this.setAllowSkipping(t.allow_skipping),"max_attempts"in t&&t.max_attempts!==null&&this.setMaxAttempts(t.max_attempts),"show_feedback"in t&&t.show_feedback!==null&&this.setShowFeedback(t.show_feedback),"show_solution"in t&&t.show_solution!==null&&this.setShowSolution(t.show_solution),"time_limits"in t&&t.time_limits!==null&&("min_time"in t.time_limits&&this.setTimeLimitsMinTime(t.time_limits.min_time),"max_time"in t.time_limits&&this.setTimeLimitsMaxTime(t.time_limits.max_time),"allow_late_submission"in t.time_limits&&this.setTimeLimitsAllowLateSubmission(t.time_limits.allow_late_submission)),"validate_responses"in t&&t.validate_responses!==null&&this.setValidateResponses(t.validate_responses)}}getSessionControl(){return{allow_comment:this.getAllowComment(),allow_review:this.getAllowReview(),allow_skipping:this.getAllowSkipping(),max_attempts:this.getMaxAttempts(),show_feedback:this.getShowFeedback(),show_solution:this.getShowSolution(),time_limits:this.getTimeLimits(),validate_responses:this.getValidateResponses()}}getAllowComment(){return this.sc.allow_comment}setAllowComment(t){this.sc.allow_comment=t}getAllowReview(){return this.sc.allow_review}setAllowReview(t){this.sc.allow_review=t}getAllowSkipping(){return this.sc.allow_skipping}setAllowSkipping(t){this.sc.allow_skipping=t}getMaxAttempts(){return this.sc.max_attempts}setMaxAttempts(t){this.sc.max_attempts=t}getShowFeedback(){return this.sc.show_feedback}setShowFeedback(t){this.sc.show_feedback=t}getShowSolution(){return this.sc.show_solution}setShowSolution(t){this.sc.show_solution=t}getTimeLimits(){return this.sc.time_limits}setTimeLimits(t=null,i=null,s=!1){this.setTimeLimitsMinTime(t),this.setTimeLimitsMaxTime(i),this.setTimeLimitsAllowLateSubmission(s)}getTimeLimitsMinTime(){return this.sc.time_limits.min_time}setTimeLimitsMinTime(t){this.sc.time_limits.min_time=t}getTimeLimitsMaxTime(){return this.sc.time_limits.max_time}setTimeLimitsMaxTime(t){this.sc.time_limits.max_time=t}getTimeLimitsAllowLateSubmission(){return this.sc.time_limits.allow_late_submission}setTimeLimitsAllowLateSubmission(t){this.sc.time_limits.allow_late_submission=t}getValidateResponses(){return this.sc.validate_responses}setValidateResponses(t){this.sc.validate_responses=t}}class bc{constructor(t,i){return typeof t>"u"?this:(this.identifier=t,this.guid=i.getItemContextGuid(),this.contextVariables=i.getContextDeclarations(),this.responseVariables=i.getResponseDeclarations(),this.templateVariables=i.getTemplateDeclarations(),this.outcomeVariables=i.getOutcomeDeclarations(),this.validationMessages=i.getItemContextValidationMessages(),this)}createStateFromState(t){return this.identifier=t.identifier,this.guid=t.guid,this.contextVariables=t.contextVariables,this.responseVariables=t.responseVariables,this.templateVariables=t.templateVariables,this.outcomeVariables=t.outcomeVariables,this.validationMessages=t.validationMessages,this.getSerializedState()}getSerializedState(){return{identifier:this.identifier,guid:this.guid,contextVariables:this.serializeVariables(this.contextVariables),responseVariables:this.serializeResponseVariables(this.responseVariables),outcomeVariables:this.serializeOutcomeVariables(this.outcomeVariables),templateVariables:this.serializeVariables(this.templateVariables),validationMessages:this.serializeValidationMessages(this.validationMessages)}}serializeResponseVariables(t){let i=[];return t.forEach(s=>{let n={identifier:s.identifier,cardinality:s.cardinality,baseType:this.resolveBaseType(s.baseType),value:this.serializeVariableValue(s.cardinality,s.value),state:this.serializeVariableState(s.state)};"correctResponse"in s&&(n.correctResponse=this.serializeVariableValue(s.cardinality,s.correctResponse)),i.push(n)}),i}serializeOutcomeVariables(t){let i=[];return t.forEach(s=>{i.push({identifier:s.identifier,cardinality:s.cardinality,baseType:this.resolveBaseType(s.baseType),value:this.serializeVariableValue(s.cardinality,s.value),view:s.view,interpretation:s.interpretation,longInterpretation:s.longInterpretation,normalMaximum:s.normalMaximum,normalMinimum:s.normalMinimum,masteryValue:s.masteryValue,externalScored:s.externalScored,variableIdentifierRef:s.variableIdentifierRef})}),i}serializeVariables(t){let i=[];return t.forEach(s=>{i.push({identifier:s.identifier,cardinality:s.cardinality,baseType:this.resolveBaseType(s.baseType),value:this.serializeVariableValue(s.cardinality,s.value)})}),i}serializeValidationMessages(t){let i=[];return t.forEach(s=>{i.push({identifier:s.identifier,message:s.message})}),i}serializeVariableValue(t,i){return t!=="record"?JSON.parse(JSON.stringify(i)):this.serializeRecordVariableValue(i)}serializeVariableState(t){return JSON.parse(JSON.stringify(t))}resolveBaseType(t){return typeof t>"u"?null:t}serializeRecordVariableValue(t){const i=this.strMapToJson(t);return this.jsonToStrMap(i)}strMapToJson(t){return JSON.stringify(this.strMapToObj(t))}jsonToStrMap(t){return this.objToStrMap(JSON.parse(t))}strMapToObj(t){let i=Object.create(null);for(let[s,n]of t)i[s]=typeof n=="object"&&n!==null?n.getValue():n;return i}objToStrMap(t){let i=new Map;for(let s of Object.keys(t))i.set(s,t[s]);return i}}class Db{constructor(){J(this,"itemTimer");J(this,"itemDuration");this.setTime(0)}getTime(){return this.itemDuration}setTime(t){this.itemDuration=t}startTimer(){this.clearTimer(),this.setTime(0),this.itemTimer=setInterval(this.updateTime.bind(this),1e3)}updateTime(){++this.itemDuration}resetTimer(){this.clearTimer(),this.setTime(0)}clearTimer(){clearInterval(this.itemTimer)}}var Qb=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,vc=Math.ceil,Yt=Math.floor,Ct="[BigNumber Error] ",hf=Ct+"Number primitive has more than 15 significant digits: ",fi=1e14,ye=14,Ec=9007199254740991,Tc=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ws=1e7,tt=1e9;function df(e){var t,i,s,n=x.prototype={constructor:x,toString:null,valueOf:null},r=new x(1),a=20,o=4,u=-7,h=21,f=-1e7,m=1e7,w=!1,y=1,b=0,S={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},C="0123456789abcdefghijklmnopqrstuvwxyz",L=!0;function x(p,v){var T,N,V,$,q,A,M,k,R=this;if(!(R instanceof x))return new x(p,v);if(v==null){if(p&&p._isBigNumber===!0){R.s=p.s,!p.c||p.e>m?R.c=R.e=null:p.e<f?R.c=[R.e=0]:(R.e=p.e,R.c=p.c.slice());return}if((A=typeof p=="number")&&p*0==0){if(R.s=1/p<0?(p=-p,-1):1,p===~~p){for($=0,q=p;q>=10;q/=10,$++);$>m?R.c=R.e=null:(R.e=$,R.c=[p]);return}k=String(p)}else{if(!Qb.test(k=String(p)))return s(R,k,A);R.s=k.charCodeAt(0)==45?(k=k.slice(1),-1):1}($=k.indexOf("."))>-1&&(k=k.replace(".","")),(q=k.search(/e/i))>0?($<0&&($=q),$+=+k.slice(q+1),k=k.substring(0,q)):$<0&&($=k.length)}else{if(De(v,2,C.length,"Base"),v==10&&L)return R=new x(p),Q(R,a+R.e+1,o);if(k=String(p),A=typeof p=="number"){if(p*0!=0)return s(R,k,A,v);if(R.s=1/p<0?(k=k.slice(1),-1):1,x.DEBUG&&k.replace(/^0\.0*|\./,"").length>15)throw Error(hf+p)}else R.s=k.charCodeAt(0)===45?(k=k.slice(1),-1):1;for(T=C.slice(0,v),$=q=0,M=k.length;q<M;q++)if(T.indexOf(N=k.charAt(q))<0){if(N=="."){if(q>$){$=M;continue}}else if(!V&&(k==k.toUpperCase()&&(k=k.toLowerCase())||k==k.toLowerCase()&&(k=k.toUpperCase()))){V=!0,q=-1,$=0;continue}return s(R,String(p),A,v)}A=!1,k=i(k,v,10,R.s),($=k.indexOf("."))>-1?k=k.replace(".",""):$=k.length}for(q=0;k.charCodeAt(q)===48;q++);for(M=k.length;k.charCodeAt(--M)===48;);if(k=k.slice(q,++M)){if(M-=q,A&&x.DEBUG&&M>15&&(p>Ec||p!==Yt(p)))throw Error(hf+R.s*p);if(($=$-q-1)>m)R.c=R.e=null;else if($<f)R.c=[R.e=0];else{if(R.e=$,R.c=[],q=($+1)%ye,$<0&&(q+=ye),q<M){for(q&&R.c.push(+k.slice(0,q)),M-=ye;q<M;)R.c.push(+k.slice(q,q+=ye));q=ye-(k=k.slice(q)).length}else q-=M;for(;q--;k+="0");R.c.push(+k)}}else R.c=[R.e=0]}x.clone=df,x.ROUND_UP=0,x.ROUND_DOWN=1,x.ROUND_CEIL=2,x.ROUND_FLOOR=3,x.ROUND_HALF_UP=4,x.ROUND_HALF_DOWN=5,x.ROUND_HALF_EVEN=6,x.ROUND_HALF_CEIL=7,x.ROUND_HALF_FLOOR=8,x.EUCLID=9,x.config=x.set=function(p){var v,T;if(p!=null)if(typeof p=="object"){if(p.hasOwnProperty(v="DECIMAL_PLACES")&&(T=p[v],De(T,0,tt,v),a=T),p.hasOwnProperty(v="ROUNDING_MODE")&&(T=p[v],De(T,0,8,v),o=T),p.hasOwnProperty(v="EXPONENTIAL_AT")&&(T=p[v],T&&T.pop?(De(T[0],-tt,0,v),De(T[1],0,tt,v),u=T[0],h=T[1]):(De(T,-tt,tt,v),u=-(h=T<0?-T:T))),p.hasOwnProperty(v="RANGE"))if(T=p[v],T&&T.pop)De(T[0],-tt,-1,v),De(T[1],1,tt,v),f=T[0],m=T[1];else if(De(T,-tt,tt,v),T)f=-(m=T<0?-T:T);else throw Error(Ct+v+" cannot be zero: "+T);if(p.hasOwnProperty(v="CRYPTO"))if(T=p[v],T===!!T)if(T)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))w=T;else throw w=!T,Error(Ct+"crypto unavailable");else w=T;else throw Error(Ct+v+" not true or false: "+T);if(p.hasOwnProperty(v="MODULO_MODE")&&(T=p[v],De(T,0,9,v),y=T),p.hasOwnProperty(v="POW_PRECISION")&&(T=p[v],De(T,0,tt,v),b=T),p.hasOwnProperty(v="FORMAT"))if(T=p[v],typeof T=="object")S=T;else throw Error(Ct+v+" not an object: "+T);if(p.hasOwnProperty(v="ALPHABET"))if(T=p[v],typeof T=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(T))L=T.slice(0,10)=="0123456789",C=T;else throw Error(Ct+v+" invalid: "+T)}else throw Error(Ct+"Object expected: "+p);return{DECIMAL_PLACES:a,ROUNDING_MODE:o,EXPONENTIAL_AT:[u,h],RANGE:[f,m],CRYPTO:w,MODULO_MODE:y,POW_PRECISION:b,FORMAT:S,ALPHABET:C}},x.isBigNumber=function(p){if(!p||p._isBigNumber!==!0)return!1;if(!x.DEBUG)return!0;var v,T,N=p.c,V=p.e,$=p.s;e:if({}.toString.call(N)=="[object Array]"){if(($===1||$===-1)&&V>=-tt&&V<=tt&&V===Yt(V)){if(N[0]===0){if(V===0&&N.length===1)return!0;break e}if(v=(V+1)%ye,v<1&&(v+=ye),String(N[0]).length==v){for(v=0;v<N.length;v++)if(T=N[v],T<0||T>=fi||T!==Yt(T))break e;if(T!==0)return!0}}}else if(N===null&&V===null&&($===null||$===1||$===-1))return!0;throw Error(Ct+"Invalid BigNumber: "+p)},x.maximum=x.max=function(){return E(arguments,-1)},x.minimum=x.min=function(){return E(arguments,1)},x.random=function(){var p=9007199254740992,v=Math.random()*p&2097151?function(){return Yt(Math.random()*p)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(T){var N,V,$,q,A,M=0,k=[],R=new x(r);if(T==null?T=a:De(T,0,tt),q=vc(T/ye),w)if(crypto.getRandomValues){for(N=crypto.getRandomValues(new Uint32Array(q*=2));M<q;)A=N[M]*131072+(N[M+1]>>>11),A>=9e15?(V=crypto.getRandomValues(new Uint32Array(2)),N[M]=V[0],N[M+1]=V[1]):(k.push(A%1e14),M+=2);M=q/2}else if(crypto.randomBytes){for(N=crypto.randomBytes(q*=7);M<q;)A=(N[M]&31)*281474976710656+N[M+1]*1099511627776+N[M+2]*4294967296+N[M+3]*16777216+(N[M+4]<<16)+(N[M+5]<<8)+N[M+6],A>=9e15?crypto.randomBytes(7).copy(N,M):(k.push(A%1e14),M+=7);M=q/7}else throw w=!1,Error(Ct+"crypto unavailable");if(!w)for(;M<q;)A=v(),A<9e15&&(k[M++]=A%1e14);for(q=k[--M],T%=ye,q&&T&&(A=Tc[ye-T],k[M]=Yt(q/A)*A);k[M]===0;k.pop(),M--);if(M<0)k=[$=0];else{for($=-1;k[0]===0;k.splice(0,1),$-=ye);for(M=1,A=k[0];A>=10;A/=10,M++);M<ye&&($-=ye-M)}return R.e=$,R.c=k,R}}(),x.sum=function(){for(var p=1,v=arguments,T=new x(v[0]);p<v.length;)T=T.plus(v[p++]);return T},i=function(){var p="0123456789";function v(T,N,V,$){for(var q,A=[0],M,k=0,R=T.length;k<R;){for(M=A.length;M--;A[M]*=N);for(A[0]+=$.indexOf(T.charAt(k++)),q=0;q<A.length;q++)A[q]>V-1&&(A[q+1]==null&&(A[q+1]=0),A[q+1]+=A[q]/V|0,A[q]%=V)}return A.reverse()}return function(T,N,V,$,q){var A,M,k,R,z,Z,ne,de,ge=T.indexOf("."),Ee=a,P=o;for(ge>=0&&(R=b,b=0,T=T.replace(".",""),de=new x(N),Z=de.pow(T.length-ge),b=R,de.c=v(Ji(Zt(Z.c),Z.e,"0"),10,V,p),de.e=de.c.length),ne=v(T,N,V,q?(A=C,p):(A=p,C)),k=R=ne.length;ne[--R]==0;ne.pop());if(!ne[0])return A.charAt(0);if(ge<0?--k:(Z.c=ne,Z.e=k,Z.s=$,Z=t(Z,de,Ee,P,V),ne=Z.c,z=Z.r,k=Z.e),M=k+Ee+1,ge=ne[M],R=V/2,z=z||M<0||ne[M+1]!=null,z=P<4?(ge!=null||z)&&(P==0||P==(Z.s<0?3:2)):ge>R||ge==R&&(P==4||z||P==6&&ne[M-1]&1||P==(Z.s<0?8:7)),M<1||!ne[0])T=z?Ji(A.charAt(1),-Ee,A.charAt(0)):A.charAt(0);else{if(ne.length=M,z)for(--V;++ne[--M]>V;)ne[M]=0,M||(++k,ne=[1].concat(ne));for(R=ne.length;!ne[--R];);for(ge=0,T="";ge<=R;T+=A.charAt(ne[ge++]));T=Ji(T,k,A.charAt(0))}return T}}(),t=function(){function p(N,V,$){var q,A,M,k,R=0,z=N.length,Z=V%ws,ne=V/ws|0;for(N=N.slice();z--;)M=N[z]%ws,k=N[z]/ws|0,q=ne*M+k*Z,A=Z*M+q%ws*ws+R,R=(A/$|0)+(q/ws|0)+ne*k,N[z]=A%$;return R&&(N=[R].concat(N)),N}function v(N,V,$,q){var A,M;if($!=q)M=$>q?1:-1;else for(A=M=0;A<$;A++)if(N[A]!=V[A]){M=N[A]>V[A]?1:-1;break}return M}function T(N,V,$,q){for(var A=0;$--;)N[$]-=A,A=N[$]<V[$]?1:0,N[$]=A*q+N[$]-V[$];for(;!N[0]&&N.length>1;N.splice(0,1));}return function(N,V,$,q,A){var M,k,R,z,Z,ne,de,ge,Ee,P,K,Me,qe,Et,at,He,ft,Fe=N.s==V.s?1:-1,Oe=N.c,_e=V.c;if(!Oe||!Oe[0]||!_e||!_e[0])return new x(!N.s||!V.s||(Oe?_e&&Oe[0]==_e[0]:!_e)?NaN:Oe&&Oe[0]==0||!_e?Fe*0:Fe/0);for(ge=new x(Fe),Ee=ge.c=[],k=N.e-V.e,Fe=$+k+1,A||(A=fi,k=Xt(N.e/ye)-Xt(V.e/ye),Fe=Fe/ye|0),R=0;_e[R]==(Oe[R]||0);R++);if(_e[R]>(Oe[R]||0)&&k--,Fe<0)Ee.push(1),z=!0;else{for(Et=Oe.length,He=_e.length,R=0,Fe+=2,Z=Yt(A/(_e[0]+1)),Z>1&&(_e=p(_e,Z,A),Oe=p(Oe,Z,A),He=_e.length,Et=Oe.length),qe=He,P=Oe.slice(0,He),K=P.length;K<He;P[K++]=0);ft=_e.slice(),ft=[0].concat(ft),at=_e[0],_e[1]>=A/2&&at++;do{if(Z=0,M=v(_e,P,He,K),M<0){if(Me=P[0],He!=K&&(Me=Me*A+(P[1]||0)),Z=Yt(Me/at),Z>1)for(Z>=A&&(Z=A-1),ne=p(_e,Z,A),de=ne.length,K=P.length;v(ne,P,de,K)==1;)Z--,T(ne,He<de?ft:_e,de,A),de=ne.length,M=1;else Z==0&&(M=Z=1),ne=_e.slice(),de=ne.length;if(de<K&&(ne=[0].concat(ne)),T(P,ne,K,A),K=P.length,M==-1)for(;v(_e,P,He,K)<1;)Z++,T(P,He<K?ft:_e,K,A),K=P.length}else M===0&&(Z++,P=[0]);Ee[R++]=Z,P[0]?P[K++]=Oe[qe]||0:(P=[Oe[qe]],K=1)}while((qe++<Et||P[0]!=null)&&Fe--);z=P[0]!=null,Ee[0]||Ee.splice(0,1)}if(A==fi){for(R=1,Fe=Ee[0];Fe>=10;Fe/=10,R++);Q(ge,$+(ge.e=R+k*ye-1)+1,q,z)}else ge.e=k,ge.r=+z;return ge}}();function D(p,v,T,N){var V,$,q,A,M;if(T==null?T=o:De(T,0,8),!p.c)return p.toString();if(V=p.c[0],q=p.e,v==null)M=Zt(p.c),M=N==1||N==2&&(q<=u||q>=h)?bo(M,q):Ji(M,q,"0");else if(p=Q(new x(p),v,T),$=p.e,M=Zt(p.c),A=M.length,N==1||N==2&&(v<=$||$<=u)){for(;A<v;M+="0",A++);M=bo(M,$)}else if(v-=q,M=Ji(M,$,"0"),$+1>A){if(--v>0)for(M+=".";v--;M+="0");}else if(v+=$-A,v>0)for($+1==A&&(M+=".");v--;M+="0");return p.s<0&&V?"-"+M:M}function E(p,v){for(var T,N,V=1,$=new x(p[0]);V<p.length;V++)N=new x(p[V]),(!N.s||(T=Qs($,N))===v||T===0&&$.s===v)&&($=N);return $}function U(p,v,T){for(var N=1,V=v.length;!v[--V];v.pop());for(V=v[0];V>=10;V/=10,N++);return(T=N+T*ye-1)>m?p.c=p.e=null:T<f?p.c=[p.e=0]:(p.e=T,p.c=v),p}s=function(){var p=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,T=/^\.([^.]+)$/,N=/^-?(Infinity|NaN)$/,V=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function($,q,A,M){var k,R=A?q:q.replace(V,"");if(N.test(R))$.s=isNaN(R)?null:R<0?-1:1;else{if(!A&&(R=R.replace(p,function(z,Z,ne){return k=(ne=ne.toLowerCase())=="x"?16:ne=="b"?2:8,!M||M==k?Z:z}),M&&(k=M,R=R.replace(v,"$1").replace(T,"0.$1")),q!=R))return new x(R,k);if(x.DEBUG)throw Error(Ct+"Not a"+(M?" base "+M:"")+" number: "+q);$.s=null}$.c=$.e=null}}();function Q(p,v,T,N){var V,$,q,A,M,k,R,z=p.c,Z=Tc;if(z){e:{for(V=1,A=z[0];A>=10;A/=10,V++);if($=v-V,$<0)$+=ye,q=v,M=z[k=0],R=Yt(M/Z[V-q-1]%10);else if(k=vc(($+1)/ye),k>=z.length)if(N){for(;z.length<=k;z.push(0));M=R=0,V=1,$%=ye,q=$-ye+1}else break e;else{for(M=A=z[k],V=1;A>=10;A/=10,V++);$%=ye,q=$-ye+V,R=q<0?0:Yt(M/Z[V-q-1]%10)}if(N=N||v<0||z[k+1]!=null||(q<0?M:M%Z[V-q-1]),N=T<4?(R||N)&&(T==0||T==(p.s<0?3:2)):R>5||R==5&&(T==4||N||T==6&&($>0?q>0?M/Z[V-q]:0:z[k-1])%10&1||T==(p.s<0?8:7)),v<1||!z[0])return z.length=0,N?(v-=p.e+1,z[0]=Z[(ye-v%ye)%ye],p.e=-v||0):z[0]=p.e=0,p;if($==0?(z.length=k,A=1,k--):(z.length=k+1,A=Z[ye-$],z[k]=q>0?Yt(M/Z[V-q]%Z[q])*A:0),N)for(;;)if(k==0){for($=1,q=z[0];q>=10;q/=10,$++);for(q=z[0]+=A,A=1;q>=10;q/=10,A++);$!=A&&(p.e++,z[0]==fi&&(z[0]=1));break}else{if(z[k]+=A,z[k]!=fi)break;z[k--]=0,A=1}for($=z.length;z[--$]===0;z.pop());}p.e>m?p.c=p.e=null:p.e<f&&(p.c=[p.e=0])}return p}function ee(p){var v,T=p.e;return T===null?p.toString():(v=Zt(p.c),v=T<=u||T>=h?bo(v,T):Ji(v,T,"0"),p.s<0?"-"+v:v)}return n.absoluteValue=n.abs=function(){var p=new x(this);return p.s<0&&(p.s=1),p},n.comparedTo=function(p,v){return Qs(this,new x(p,v))},n.decimalPlaces=n.dp=function(p,v){var T,N,V,$=this;if(p!=null)return De(p,0,tt),v==null?v=o:De(v,0,8),Q(new x($),p+$.e+1,v);if(!(T=$.c))return null;if(N=((V=T.length-1)-Xt(this.e/ye))*ye,V=T[V])for(;V%10==0;V/=10,N--);return N<0&&(N=0),N},n.dividedBy=n.div=function(p,v){return t(this,new x(p,v),a,o)},n.dividedToIntegerBy=n.idiv=function(p,v){return t(this,new x(p,v),0,1)},n.exponentiatedBy=n.pow=function(p,v){var T,N,V,$,q,A,M,k,R,z=this;if(p=new x(p),p.c&&!p.isInteger())throw Error(Ct+"Exponent not an integer: "+ee(p));if(v!=null&&(v=new x(v)),A=p.e>14,!z.c||!z.c[0]||z.c[0]==1&&!z.e&&z.c.length==1||!p.c||!p.c[0])return R=new x(Math.pow(+ee(z),A?p.s*(2-wo(p)):+ee(p))),v?R.mod(v):R;if(M=p.s<0,v){if(v.c?!v.c[0]:!v.s)return new x(NaN);N=!M&&z.isInteger()&&v.isInteger(),N&&(z=z.mod(v))}else{if(p.e>9&&(z.e>0||z.e<-1||(z.e==0?z.c[0]>1||A&&z.c[1]>=24e7:z.c[0]<8e13||A&&z.c[0]<=9999975e7)))return $=z.s<0&&wo(p)?-0:0,z.e>-1&&($=1/$),new x(M?1/$:$);b&&($=vc(b/ye+2))}for(A?(T=new x(.5),M&&(p.s=1),k=wo(p)):(V=Math.abs(+ee(p)),k=V%2),R=new x(r);;){if(k){if(R=R.times(z),!R.c)break;$?R.c.length>$&&(R.c.length=$):N&&(R=R.mod(v))}if(V){if(V=Yt(V/2),V===0)break;k=V%2}else if(p=p.times(T),Q(p,p.e+1,1),p.e>14)k=wo(p);else{if(V=+ee(p),V===0)break;k=V%2}z=z.times(z),$?z.c&&z.c.length>$&&(z.c.length=$):N&&(z=z.mod(v))}return N?R:(M&&(R=r.div(R)),v?R.mod(v):$?Q(R,b,o,q):R)},n.integerValue=function(p){var v=new x(this);return p==null?p=o:De(p,0,8),Q(v,v.e+1,p)},n.isEqualTo=n.eq=function(p,v){return Qs(this,new x(p,v))===0},n.isFinite=function(){return!!this.c},n.isGreaterThan=n.gt=function(p,v){return Qs(this,new x(p,v))>0},n.isGreaterThanOrEqualTo=n.gte=function(p,v){return(v=Qs(this,new x(p,v)))===1||v===0},n.isInteger=function(){return!!this.c&&Xt(this.e/ye)>this.c.length-2},n.isLessThan=n.lt=function(p,v){return Qs(this,new x(p,v))<0},n.isLessThanOrEqualTo=n.lte=function(p,v){return(v=Qs(this,new x(p,v)))===-1||v===0},n.isNaN=function(){return!this.s},n.isNegative=function(){return this.s<0},n.isPositive=function(){return this.s>0},n.isZero=function(){return!!this.c&&this.c[0]==0},n.minus=function(p,v){var T,N,V,$,q=this,A=q.s;if(p=new x(p,v),v=p.s,!A||!v)return new x(NaN);if(A!=v)return p.s=-v,q.plus(p);var M=q.e/ye,k=p.e/ye,R=q.c,z=p.c;if(!M||!k){if(!R||!z)return R?(p.s=-v,p):new x(z?q:NaN);if(!R[0]||!z[0])return z[0]?(p.s=-v,p):new x(R[0]?q:o==3?-0:0)}if(M=Xt(M),k=Xt(k),R=R.slice(),A=M-k){for(($=A<0)?(A=-A,V=R):(k=M,V=z),V.reverse(),v=A;v--;V.push(0));V.reverse()}else for(N=($=(A=R.length)<(v=z.length))?A:v,A=v=0;v<N;v++)if(R[v]!=z[v]){$=R[v]<z[v];break}if($&&(V=R,R=z,z=V,p.s=-p.s),v=(N=z.length)-(T=R.length),v>0)for(;v--;R[T++]=0);for(v=fi-1;N>A;){if(R[--N]<z[N]){for(T=N;T&&!R[--T];R[T]=v);--R[T],R[N]+=fi}R[N]-=z[N]}for(;R[0]==0;R.splice(0,1),--k);return R[0]?U(p,R,k):(p.s=o==3?-1:1,p.c=[p.e=0],p)},n.modulo=n.mod=function(p,v){var T,N,V=this;return p=new x(p,v),!V.c||!p.s||p.c&&!p.c[0]?new x(NaN):!p.c||V.c&&!V.c[0]?new x(V):(y==9?(N=p.s,p.s=1,T=t(V,p,0,3),p.s=N,T.s*=N):T=t(V,p,0,y),p=V.minus(T.times(p)),!p.c[0]&&y==1&&(p.s=V.s),p)},n.multipliedBy=n.times=function(p,v){var T,N,V,$,q,A,M,k,R,z,Z,ne,de,ge,Ee,P=this,K=P.c,Me=(p=new x(p,v)).c;if(!K||!Me||!K[0]||!Me[0])return!P.s||!p.s||K&&!K[0]&&!Me||Me&&!Me[0]&&!K?p.c=p.e=p.s=null:(p.s*=P.s,!K||!Me?p.c=p.e=null:(p.c=[0],p.e=0)),p;for(N=Xt(P.e/ye)+Xt(p.e/ye),p.s*=P.s,M=K.length,z=Me.length,M<z&&(de=K,K=Me,Me=de,V=M,M=z,z=V),V=M+z,de=[];V--;de.push(0));for(ge=fi,Ee=ws,V=z;--V>=0;){for(T=0,Z=Me[V]%Ee,ne=Me[V]/Ee|0,q=M,$=V+q;$>V;)k=K[--q]%Ee,R=K[q]/Ee|0,A=ne*k+R*Z,k=Z*k+A%Ee*Ee+de[$]+T,T=(k/ge|0)+(A/Ee|0)+ne*R,de[$--]=k%ge;de[$]=T}return T?++N:de.splice(0,1),U(p,de,N)},n.negated=function(){var p=new x(this);return p.s=-p.s||null,p},n.plus=function(p,v){var T,N=this,V=N.s;if(p=new x(p,v),v=p.s,!V||!v)return new x(NaN);if(V!=v)return p.s=-v,N.minus(p);var $=N.e/ye,q=p.e/ye,A=N.c,M=p.c;if(!$||!q){if(!A||!M)return new x(V/0);if(!A[0]||!M[0])return M[0]?p:new x(A[0]?N:V*0)}if($=Xt($),q=Xt(q),A=A.slice(),V=$-q){for(V>0?(q=$,T=M):(V=-V,T=A),T.reverse();V--;T.push(0));T.reverse()}for(V=A.length,v=M.length,V-v<0&&(T=M,M=A,A=T,v=V),V=0;v;)V=(A[--v]=A[v]+M[v]+V)/fi|0,A[v]=fi===A[v]?0:A[v]%fi;return V&&(A=[V].concat(A),++q),U(p,A,q)},n.precision=n.sd=function(p,v){var T,N,V,$=this;if(p!=null&&p!==!!p)return De(p,1,tt),v==null?v=o:De(v,0,8),Q(new x($),p,v);if(!(T=$.c))return null;if(V=T.length-1,N=V*ye+1,V=T[V]){for(;V%10==0;V/=10,N--);for(V=T[0];V>=10;V/=10,N++);}return p&&$.e+1>N&&(N=$.e+1),N},n.shiftedBy=function(p){return De(p,-Ec,Ec),this.times("1e"+p)},n.squareRoot=n.sqrt=function(){var p,v,T,N,V,$=this,q=$.c,A=$.s,M=$.e,k=a+4,R=new x("0.5");if(A!==1||!q||!q[0])return new x(!A||A<0&&(!q||q[0])?NaN:q?$:1/0);if(A=Math.sqrt(+ee($)),A==0||A==1/0?(v=Zt(q),(v.length+M)%2==0&&(v+="0"),A=Math.sqrt(+v),M=Xt((M+1)/2)-(M<0||M%2),A==1/0?v="5e"+M:(v=A.toExponential(),v=v.slice(0,v.indexOf("e")+1)+M),T=new x(v)):T=new x(A+""),T.c[0]){for(M=T.e,A=M+k,A<3&&(A=0);;)if(V=T,T=R.times(V.plus(t($,V,k,1))),Zt(V.c).slice(0,A)===(v=Zt(T.c)).slice(0,A))if(T.e<M&&--A,v=v.slice(A-3,A+1),v=="9999"||!N&&v=="4999"){if(!N&&(Q(V,V.e+a+2,0),V.times(V).eq($))){T=V;break}k+=4,A+=4,N=1}else{(!+v||!+v.slice(1)&&v.charAt(0)=="5")&&(Q(T,T.e+a+2,1),p=!T.times(T).eq($));break}}return Q(T,T.e+a+1,o,p)},n.toExponential=function(p,v){return p!=null&&(De(p,0,tt),p++),D(this,p,v,1)},n.toFixed=function(p,v){return p!=null&&(De(p,0,tt),p=p+this.e+1),D(this,p,v)},n.toFormat=function(p,v,T){var N,V=this;if(T==null)p!=null&&v&&typeof v=="object"?(T=v,v=null):p&&typeof p=="object"?(T=p,p=v=null):T=S;else if(typeof T!="object")throw Error(Ct+"Argument not an object: "+T);if(N=V.toFixed(p,v),V.c){var $,q=N.split("."),A=+T.groupSize,M=+T.secondaryGroupSize,k=T.groupSeparator||"",R=q[0],z=q[1],Z=V.s<0,ne=Z?R.slice(1):R,de=ne.length;if(M&&($=A,A=M,M=$,de-=$),A>0&&de>0){for($=de%A||A,R=ne.substr(0,$);$<de;$+=A)R+=k+ne.substr($,A);M>0&&(R+=k+ne.slice($)),Z&&(R="-"+R)}N=z?R+(T.decimalSeparator||"")+((M=+T.fractionGroupSize)?z.replace(new RegExp("\\d{"+M+"}\\B","g"),"$&"+(T.fractionGroupSeparator||"")):z):R}return(T.prefix||"")+N+(T.suffix||"")},n.toFraction=function(p){var v,T,N,V,$,q,A,M,k,R,z,Z,ne=this,de=ne.c;if(p!=null&&(A=new x(p),!A.isInteger()&&(A.c||A.s!==1)||A.lt(r)))throw Error(Ct+"Argument "+(A.isInteger()?"out of range: ":"not an integer: ")+ee(A));if(!de)return new x(ne);for(v=new x(r),k=T=new x(r),N=M=new x(r),Z=Zt(de),$=v.e=Z.length-ne.e-1,v.c[0]=Tc[(q=$%ye)<0?ye+q:q],p=!p||A.comparedTo(v)>0?$>0?v:k:A,q=m,m=1/0,A=new x(Z),M.c[0]=0;R=t(A,v,0,1),V=T.plus(R.times(N)),V.comparedTo(p)!=1;)T=N,N=V,k=M.plus(R.times(V=k)),M=V,v=A.minus(R.times(V=v)),A=V;return V=t(p.minus(T),N,0,1),M=M.plus(V.times(k)),T=T.plus(V.times(N)),M.s=k.s=ne.s,$=$*2,z=t(k,N,$,o).minus(ne).abs().comparedTo(t(M,T,$,o).minus(ne).abs())<1?[k,N]:[M,T],m=q,z},n.toNumber=function(){return+ee(this)},n.toPrecision=function(p,v){return p!=null&&De(p,1,tt),D(this,p,v,2)},n.toString=function(p){var v,T=this,N=T.s,V=T.e;return V===null?N?(v="Infinity",N<0&&(v="-"+v)):v="NaN":(p==null?v=V<=u||V>=h?bo(Zt(T.c),V):Ji(Zt(T.c),V,"0"):p===10&&L?(T=Q(new x(T),a+V+1,o),v=Ji(Zt(T.c),T.e,"0")):(De(p,2,C.length,"Base"),v=i(Ji(Zt(T.c),V,"0"),10,p,N,!0)),N<0&&T.c[0]&&(v="-"+v)),v},n.valueOf=n.toJSON=function(){return ee(this)},n._isBigNumber=!0,n[Symbol.toStringTag]="BigNumber",n[Symbol.for("nodejs.util.inspect.custom")]=n.valueOf,e!=null&&x.set(e),x}function Xt(e){var t=e|0;return e>0||e===t?t:t-1}function Zt(e){for(var t,i,s=1,n=e.length,r=e[0]+"";s<n;){for(t=e[s++]+"",i=ye-t.length;i--;t="0"+t);r+=t}for(n=r.length;r.charCodeAt(--n)===48;);return r.slice(0,n+1||1)}function Qs(e,t){var i,s,n=e.c,r=t.c,a=e.s,o=t.s,u=e.e,h=t.e;if(!a||!o)return null;if(i=n&&!n[0],s=r&&!r[0],i||s)return i?s?0:-o:a;if(a!=o)return a;if(i=a<0,s=u==h,!n||!r)return s?0:!n^i?1:-1;if(!s)return u>h^i?1:-1;for(o=(u=n.length)<(h=r.length)?u:h,a=0;a<o;a++)if(n[a]!=r[a])return n[a]>r[a]^i?1:-1;return u==h?0:u>h^i?1:-1}function De(e,t,i,s){if(e<t||e>i||e!==Yt(e))throw Error(Ct+(s||"Argument")+(typeof e=="number"?e<t||e>i?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function wo(e){var t=e.c.length-1;return Xt(e.e/ye)==t&&e.c[t]%2!=0}function bo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Ji(e,t,i){var s,n;if(t<0){for(n=i+".";++t;n+=i);e=n+e}else if(s=e.length,++t>s){for(n=i,t-=s;--t;n+=i);e+=n}else t<s&&(e=e.slice(0,t)+"."+e.slice(t));return e}var X=df();class O extends Error{constructor(t){super(t),this.name="QtiEvaluationException"}}class ie{QTI_RESPONSE_RULES(){return["qti-response-processing-fragment","qti-response-condition","qti-set-outcome-value","qti-lookup-outcome-value","qti-get-outcome-value","qti-exit-response"]}QTI_TEMPLATE_RULES(){return["qti-set-template-value","qti-exit-template","qti-template-condition","qti-set-default-value","qti-set-correct-response","qti-template-constraint"]}QTI_EXPRESSIONS(){return["qti-base-value","qti-variable","qti-correct","qti-default","qti-is-null","qti-null","qti-and","qti-or","qti-not","qti-match","qti-map-response","qti-member","qti-subtract","qti-sum","qti-random","qti-random-float","qti-random-integer","qti-index","qti-integer-divide","qti-integer-modulus","qti-integer-to-float","qti-equal","qti-equal-rounded","qti-field-value","qti-multiple","qti-ordered","qti-map-response-point","qti-product","qti-delete","qti-string-match","qti-pattern-match","qti-substring","qti-round","qti-round-to","qti-truncate","qti-divide","qti-gt","qti-gte","qti-lt","qti-lte","qti-max","qti-min","qti-custom-operator","qti-math-operator","qti-math-constant","qti-repeat","qti-gcd","qti-lcm","qti-stats-operator","qti-power","qti-any-n","qti-test-variables"]}constructor(){}isExpressionNode(t){return this.QTI_EXPRESSIONS().includes(t)}isResponseRuleNode(t){return this.QTI_RESPONSE_RULES().includes(t)}isTemplateRuleNode(t){return this.QTI_TEMPLATE_RULES().includes(t)}nullValue(){return null}isNullValue(t){return typeof t>"u"||t===null}isBaseTypeNumeric(t){return t==="float"||t==="integer"}isSingleValuesMatch(t,i,s){if(this.isBaseTypeNumeric(t)){let n=new X(i),r=new X(s);return n.comparedTo(r)==0}return i===s}isMultipleValuesMatch(t,i,s){if(!Array.isArray(i)||!Array.isArray(s)||i.length!==s.length)return!1;const n=i.concat().sort(),r=s.concat().sort();if(this.isBaseTypeNumeric(t)){for(let a=0;a<n.length;a++)if(!this.isSingleValuesMatch(t,n[a],r[a]))return!1}else for(let a=0;a<n.length;a++)if(n[a]!==r[a])return!1;return!0}isOrderedValuesMatch(t,i,s){if(!Array.isArray(i)||!Array.isArray(s)||i.length!==s.length)return!1;if(this.isBaseTypeNumeric(t)){for(let n=0;n<i.length;n++)if(!this.isSingleValuesMatch(t,i[n],s[n]))return!1}else for(let n=0;n<i.length;n++)if(i[n]!==s[n])return!1;return!0}mapResponse(t){if(this.isNullValue(t.value))return t.mapping.getDefaultValue();const i=t.mapping.getValue(),s=i.length;if(t.cardinality==="single"){let n=this.isBaseTypeNumeric(t.baseType)?new X(t.value).toString():t.value;for(let r=0;r<s;r++){const a=i[r];if(this.isSingleValuesMatch("string",a.caseSensitive?a.mapKey:a.mapKey.toLowerCase(),a.caseSensitive?n:n.toLowerCase()))return t.mapping.applyConstraints(new X(a.mappedValue))}}else if(t.cardinality==="multiple"||t.cardinality==="ordered"){let n=new X(0),r=t.value;if(this.isBaseTypeNumeric(t.baseType))for(let a=0;a<r.length;a++)r[a]!==null&&(r[a]=new X(r[a]).toString());r=this.mappingEliminateNullsAndDuplicates(r);for(let a=0;a<s;a++){const o=i[a];for(let u=0;u<r.length;u++)this.isSingleValuesMatch("string",o.caseSensitive?o.mapKey:o.mapKey.toLowerCase(),o.caseSensitive?r[u]:r[u].toLowerCase())&&(n=n.plus(o.mappedValue))}return t.mapping.applyConstraints(n)}return t.mapping.getDefaultValue()}mappingEliminateNullsAndDuplicates(t){let i=t.length,s=[],n={};for(let r=0;r<i;r++)t[r]!==null&&(n[t[r]]=0);for(let r in n)s.push(r);return s}mapValueFromLookupTable(t,i){if(this.isNullValue(t.lookupTable))return this.nullValue();if(this.isNullValue(i))return t.lookupTable.getDefaultValue();const s=t.lookupTable.getValue(),n=t.lookupTable.getTableType();if(i=new X(i),n==="interpolation"){s.sort(function(r,a){return r.sourceValue-a.sourceValue});for(let r=0;r<s.length;r++){let a=s[r];const o=new X(a.sourceValue);if(i.comparedTo(o)<0||a.includeBoundary&&i.comparedTo(o)===0)return a.targetValue}}else if(n==="match"){i=new X(i);for(let r=0;r<s.length;r++){let a=s[r];const o=new X(a.sourceValue);if(i.comparedTo(o)===0)return a.targetValue}}return t.lookupTable.getDefaultValue()}shuffleArray(t){for(let i=t.length-1;i>0;i--){let s=Math.floor(Math.random()*(i+1)),n=t[i];t[i]=t[s],t[s]=n}}shuffleArrayFixed(t){for(let i=t.length-1;i>0;i--){let s=Math.floor(Math.random()*(i+1));if(t[i].fixed||t[s].fixed)continue;let n=t[i];t[i]=t[s],t[s]=n}}generalizedLcm(t,i){let s=i[0];for(let n=1;n<t;n++){if(s===0||i[n]===0)return 0;s=this.lcm(s,i[n])}return s}lcm(t,i){return new X(t).multipliedBy(i).dividedBy(this.gcd(t,i)).toNumber()}generalizedGcd(t,i){let s=i[0];for(let n=1;n<t;n++)s=this.gcd(s,i[n]);return s}gcd(t,i){return i=new X(i),i.isZero()?t:this.gcd(i.toNumber(),new X(t).modulo(i).toNumber())}getParametersFromDefinition(t){let i=new Map;if(typeof t>"u"||(t=t.trim(),t.length===0))return i;let s=t.split("|||");for(let n=0;n<s.length;n++){const r=s[n].split("=");i.set(r[0],r.length<2?"":r[1].replaceAll("=","="))}return i}computeWordCount(t){const i=t.match(/\S+/g);return i===null?0:i.length}valueToPciJson(t,i,s){return t===null?{base:null}:s==="single"?{base:this.baseValueToPciJson(t,i)}:s==="multiple"||s==="ordered"?{list:this.baseValueToPciJson(t,i)}:s==="record"?{record:this.recordValueToPciJson(t)}:{base:null}}baseValueToPciJson(t,i){let s={};switch(i){case"string":case"identifier":case"integer":case"float":case"duration":case"boolean":case"point":case"directedPair":case"pair":case"uri":return s[i]=t,s;case"intOrIdentifier":case"file":return s[i]=null,s;default:return s[i]=null,s}}recordValueToPciJson(t){let i=[];for(let s of t.values())i.push({name:s.fieldIdentifier,base:s.value===null?null:this.valueToPciJson(s.value,s.baseType,s.cardinality)});return i}processInteractionResponse(t,i){return t.interactionType==="PortableCustom"?this.getValueFromPciJson(t.node.getResponse(),i):t.node.getResponse()}getValueFromPciJson(t,i){if(console.log("[GetValueFromPciJson][Value]",t,i),t===null||typeof i>"u")return this.nullValue();try{if(typeof t!="object")throw new O("Improper value encoding. Must be an Object.");if(Array.isArray(t))throw new O("Improper value encoding. Found Array. Must be an Object.");if(t.base!==void 0){if(i.cardinality==="single")return this.baseValueFromPciJson(t.base,i.baseType);throw new O("Inconsistent value cardinality [base] for this variable. Variable must be single cardinality.")}if(t.list!==void 0){if(i.cardinality==="multiple"||i.cardinality==="ordered")return this.baseValueFromPciJson(t.list,i.baseType);throw new O("Inconsistent value cardinality [list] for this variable. Variable must be multiple or ordered cardinality.")}if(t.record!==void 0){if(i.cardinality==="record")return this.recordValueFromPciJson(t.record,i);throw new O("Inconsistent value cardinality [record] for this variable. Variable must be record cardinality.")}throw new O('Improper value encoding. Must be one of "base", "list", "record".')}catch({name:s,message:n}){return console.log("[PciDecodingException][ValueFromJson] ",n),this.nullValue()}}baseValueFromPciJson(t,i){if(t===null)return this.nullValue();try{if(typeof t!="object")throw new O("Invalid value. Must be an Object.");if(Array.isArray(t))throw new O("Invalid value. Found Array. Must be an Object.");if(t[i]!==void 0)return t[i];throw new O(`Value does not have the required base-type. Expecting ${i}.`)}catch({name:s,message:n}){return console.log("[PciDecodingException][BaseValueFromJson] ",n,t),this.nullValue()}}recordValueFromPciJson(t,i){try{let s=this.getRecordVariableFieldDefinition(i);if(s===null)throw new O(`Unable to retrieve ${i.identifier} record field definition.`);if(typeof t!="object")throw new O("Improper record value encoding. Must be an Array.");if(!Array.isArray(t))throw new O("Improper record value encoding. Must be an Array.");const n=new Map;for(let[r,a]of s)for(let o=0;o<t.length;o++)if(t[o].name!==void 0&&t[o].base!==void 0&&t[o].name===r){const u=this.baseValueFromPciJson(t[o].base,a.getBaseType()),h=new Xe(r,a.getBaseType(),u);n.set(r,h);break}return n}catch({name:s,message:n}){return console.log("[VariableDecodingException][RecordValueFromJson] ",n),new Map}}getRecordVariableFieldDefinition(t){return t==null?null:t.defaultValue!==null?t.defaultValue:t.correctResponse}computeProcessingContext(t){return this.computeProcessingType(t)==="OUTCOME"?"TEST":"ITEM"}computeProcessingType(t){return t===null?"UNKNOWN":t.$options.name==="QtiOutcomeProcessing"?"OUTCOME":t.$options.name==="QtiResponseProcessing"?"RESPONSE":t.$options.name==="QtiTemplateProcessing"?"TEMPLATE":t.$options.name==="QtiBranchRule"?"OUTCOME":this.computeProcessingType(t.$parent)}computeNodeContext(t){return t===null||t.$options.name==="QtiAssessmentItem"?"ITEM":t.$options.name==="QtiAssessmentTest"?"TEST":this.computeNodeContext(t.$parent)}}const Hb=new ie,_={player:null,state:{item:null,itemBody:null,identifier:"",title:"",responseDeclarations:[],outcomeDeclarations:[],templateDeclarations:[],contextDeclarations:[],stimulusRefs:[],interactions:[],processing:[],feedbacks:[],templates:[],printedVariables:[],catalogs:[],scoringRubricBlocks:[],asyncStateMap:new Map},itemContext:{guid:null,pnp:null,sc:null,state:null,validationMessages:[],lifecycleStatus:null},itemTimer:new Db,pciContext:{renderer2p0:"assets/pci/pci.html"},pciMessageHandler:null,windowResizeHandler:null,getResponseDeclarations(){return this.state.responseDeclarations},getResponseDeclaration(e){return this.state.responseDeclarations.find(t=>t.identifier===e)},getOutcomeDeclarations(){return this.state.outcomeDeclarations},getOutcomeDeclaration(e){return this.state.outcomeDeclarations.find(t=>t.identifier===e)},getTemplateDeclarations(){return this.state.templateDeclarations},getTemplateMathParameterVariables(){return this.state.templateDeclarations.filter(e=>e.mathVariable===!0)},getTemplateDeclaration(e){return this.state.templateDeclarations.find(t=>t.identifier===e)},getContextDeclarations(){return this.state.contextDeclarations},getContextDeclaration(e){return this.state.contextDeclarations.find(t=>t.identifier===e)},getStimulusRefs(){return this.state.stimulusRefs},getStimulusRef(e){return this.state.stimulusRefs.find(t=>t.identifier===e)},getVariableDeclaration(e){let t=this.state.outcomeDeclarations.find(i=>i.identifier===e);return typeof t<"u"||(t=this.state.responseDeclarations.find(i=>i.identifier===e),typeof t<"u")||(t=this.state.templateDeclarations.find(i=>i.identifier===e),typeof t<"u")||(t=this.state.contextDeclarations.find(i=>i.identifier===e),typeof t<"u")?t:null},getInteraction(e){return this.state.interactions.find(t=>t.identifier===e)},getInteractions(){return this.state.interactions},getProcessing(e){return this.state.processing.find(t=>t.processingType===e)},getFeedbacks(){return this.state.feedbacks},getTemplates(){return this.state.templates},getPrintedVariables(){return this.state.printedVariables},getCatalog(e){return this.state.catalogs.find(t=>t.id===e)},getCatalogs(){return this.state.catalogs},getScoringRubricBlocks(){return this.state.scoringRubricBlocks},getItem(){return this.state.item},setItem(e){this.state.item=e.item},getItemBody(){return this.state.itemBody},setItemBody(e){this.state.itemBody=e},defineResponseDeclaration(e){let t=this.state.responseDeclarations.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.responseDeclarations[t]=e:this.state.responseDeclarations.push(e)},defineOutcomeDeclaration(e){let t=this.state.outcomeDeclarations.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.outcomeDeclarations[t]=e:this.state.outcomeDeclarations.push(e)},defineTemplateDeclaration(e){let t=this.state.templateDeclarations.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.templateDeclarations[t]=e:this.state.templateDeclarations.push(e)},defineContextDeclaration(e){let t=this.state.contextDeclarations.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.contextDeclarations[t]=e:this.state.contextDeclarations.push(e)},defineStimulusRef(e){let t=this.state.stimulusRefs.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.stimulusRefs[t]=e:this.state.stimulusRefs.push(e)},defineInteraction(e){let t=this.state.interactions.findIndex(s=>s.identifier==e.identifier);if(t<0){console.log("[DefineInteraction]["+e.identifier+"]"),this.state.interactions.push(e);return}let i=this.state.interactions[t];i.interactionType=e.interactionType,i.isValidResponse=e.isValidResponse,i.invalidResponseMessage=e.invalidResponseMessage,i.maxSelectionsMessage=e.maxSelectionsMessage,i.node=e.node,i.resetValue=e.resetValue},defineProcessing(e){let t=e.processingType,i=this.state.processing.findIndex(s=>s.processingType==t);i>-1?this.state.processing[i]=e:this.state.processing.push(e),t=="response"?console.log("[QtiResponseProcessing][Defined]",e):t=="template"?console.log("[QtiTemplateProcessing][Defined]",e):t=="outcome"&&console.log("[QtiOutcomeProcessing][Defined]",e)},defineResponseProcessing(e){this.defineProcessing({processingType:"response",node:e.node})},defineTemplateProcessing(e){this.defineProcessing({processingType:"template",node:e.node})},defineItemBody(e){this.setItemBody(e.node)},defineFeedback(e){this.state.feedbacks.push(e),console.log("[DefineFeedback]["+e.outcomeIdentifier+"]["+e.identifier+"]")},defineTemplate(e){this.state.templates.push(e)},definePrintedVariable(e){this.state.printedVariables.push(e)},defineCatalog(e){let t=this.state.catalogs.findIndex(i=>i.id==e.id);if(t<0){this.state.catalogs.push(e);return}this.state.catalogs[t]=e},defineScoringRubricBlock(e){this.state.scoringRubricBlocks.push(e)},resetAll(){this.state.item=null,this.state.itemBody=null,this.state.identifier="",this.state.title="",this.state.responseDeclarations.splice(0,this.state.responseDeclarations.length),this.state.outcomeDeclarations.splice(0,this.state.outcomeDeclarations.length),this.state.templateDeclarations.splice(0,this.state.templateDeclarations.length),this.state.contextDeclarations.splice(0,this.state.contextDeclarations.length),this.state.stimulusRefs.splice(0,this.state.stimulusRefs.length),this.state.interactions.splice(0,this.state.interactions.length),this.state.processing.splice(0,this.state.processing.length),this.state.feedbacks.splice(0,this.state.feedbacks.length),this.state.templates.splice(0,this.state.templates.length),this.state.printedVariables.splice(0,this.state.printedVariables.length),this.state.catalogs.splice(0,this.state.catalogs.length),this.state.scoringRubricBlocks.splice(0,this.state.scoringRubricBlocks.length),this.state.asyncStateMap.clear(),this.resetItemTimer(),this.itemContext.guid=null,this.itemContext.state=null,this.itemContext.validationMessages.splice(0,this.itemContext.validationMessages.length),this.itemContext.lifecycleStatus=null},initializeBuiltInDeclarations(){function e(){return 0}const t=new Map;t.set("candidateIdentifier",new Xe("candidateIdentifier","string",null)),t.set("testIdentifier",new Xe("testIdentifier","string",null)),t.set("environmentIdentifier",new Xe("environmentIdentifier","string",null)),this.defineContextDeclaration({identifier:"QTI_CONTEXT",baseType:null,cardinality:"record",value:t,defaultValue:t}),console.log("[QtiAssessmentItem][QTI_CONTEXT] initialized"),this.defineOutcomeDeclaration({identifier:"SCORE",baseType:"float",cardinality:"single",value:0,defaultValue:0,lookupTable:null,lookupTableType:null,view:null,interpretation:null,longInterpretation:null,normalMaximum:null,normalMinimum:null,masteryValue:null,externalScored:null,variableIdentifierRef:null}),console.log("[QtiAssessmentItem][SCORE] initialized"),this.defineOutcomeDeclaration({identifier:"MAXSCORE",baseType:"float",cardinality:"single",value:0,defaultValue:0,lookupTable:null,lookupTableType:null,view:null,interpretation:null,longInterpretation:null,normalMaximum:null,normalMinimum:null,masteryValue:null,externalScored:null,variableIdentifierRef:null}),console.log("[QtiAssessmentItem][MAXSCORE] initialized"),this.defineOutcomeDeclaration({identifier:"completionStatus",baseType:"identifier",cardinality:"single",value:"not_attempted",defaultValue:"not_attempted",lookupTable:null,lookupTableType:null,normalMaximum:null,normalMinimum:null,externalScored:null,interpretation:null}),console.log("[QtiAssessmentItem][completionStatus] initialized"),this.defineResponseDeclaration({identifier:"numAttempts",baseType:"integer",cardinality:"single",value:0,resetValue:e,defaultValue:0,state:null}),console.log("[QtiAssessmentItem][numAttempts] initialized"),this.defineResponseDeclaration({identifier:"duration",baseType:"duration",cardinality:"single",value:0,resetValue:e,defaultValue:0,state:null}),console.log("[QtiAssessmentItem][duration] initialized")},restoreContextVariables(){if(!this.hasItemContextState())return null;const e=this.getItemContextState();"contextVariables"in e&&e.contextVariables!==null&&e.contextVariables.forEach(t=>{let i=this.state.contextDeclarations.findIndex(s=>s.identifier==t.identifier);i<0||(this.state.contextDeclarations[i].value=t.value)},this)},restoreOutcomeVariables(){if(!this.hasItemContextState())return null;const e=this.getItemContextState();"outcomeVariables"in e&&e.outcomeVariables!==null&&e.outcomeVariables.forEach(t=>{this.setOutcomeVariableValue({identifier:t.identifier,value:t.value})},this)},setOutcomeVariableValue(e){let t=this.state.outcomeDeclarations.findIndex(i=>i.identifier==e.identifier);t<0||(this.state.outcomeDeclarations[t].value=e.value)},resetOutcomeVariableValue(e){let t=this.state.outcomeDeclarations.findIndex(s=>s.identifier==e.identifier);if(t<0)return;let i=this.state.outcomeDeclarations[t];if(i.defaultValue!==null){i.value=this.defaultValue;return}if(i.cardinality==="record"||i.cardinality==="multiple"||i.cardinality==="ordered"){i.value=null;return}if(i.baseType==="integer"||i.baseType==="float"){i.value=0;return}i.value=null},getResponseVariableCorrectResponse(e){let t=this.state.responseDeclarations.findIndex(i=>i.identifier==e);return t<0?null:this.state.responseDeclarations[t].correctResponse},setResponseVariableCorrectResponse(e){let t=this.state.responseDeclarations.findIndex(s=>s.identifier==e.identifier);if(t<0)return;let i=this.state.responseDeclarations[t];i.correctResponse=e.value},setInteractionIsValidResponse(e){let t=this.state.interactions.findIndex(i=>i.identifier==e.identifier);t<0||(this.state.interactions[t].isValidResponse=e.isValidResponse)},resetInteractionStateIsValidResponse(){this.state.interactions.forEach(e=>{e.interactionType!=="EndAttemptInteraction"&&(e.isValidResponse=!1)})},restoreResponseVariables(){if(!this.hasItemContextState())return null;const e=this.getItemContextState();"responseVariables"in e&&e.responseVariables!==null&&e.responseVariables.forEach(t=>{this.setResponseVariableValue({identifier:t.identifier,value:t.value,state:t.state}),"correctResponse"in t&&this.setResponseVariableCorrectResponse({identifier:t.identifier,value:t.correctResponse})},this)},setResponseVariableValue(e){let t=this.state.responseDeclarations.findIndex(s=>s.identifier==e.identifier);if(t<0)return;let i=this.state.responseDeclarations[t];i.value=e.value,i.state=e.state},resetResponseVariableValue(e){let t=this.state.responseDeclarations.findIndex(s=>s.identifier==e.identifier);if(t<0)return;let i=this.state.responseDeclarations[t];i.value=i.defaultValue!==null?i.defaultValue:null},incrementNumAttempts(){let e=this.state.responseDeclarations.findIndex(t=>t.identifier=="numAttempts");this.state.responseDeclarations[e].value+=1},updateItemDuration(){const e=this.getResponseDeclaration("duration");e.value+=this.itemTimer.getTime(),this.restartItemTimer()},restartItemTimer(){this.itemTimer.startTimer()},resetItemTimer(){this.itemTimer.resetTimer()},setTemplateVariableValue(e){let t=this.state.templateDeclarations.findIndex(i=>i.identifier==e.identifier);t<0||(this.state.templateDeclarations[t].value=e.value)},resetTemplateVariables(){this.state.templateDeclarations.forEach(e=>{e.node.reset()})},setVariableDefaultValue(e){let t=this.state.responseDeclarations.findIndex(i=>i.identifier==e.identifier);if(t>-1){let i=this.state.responseDeclarations[t];i.defaultValue=e.value;return}if(t=this.state.outcomeDeclarations.findIndex(i=>i.identifier==e.identifier),t>-1){let i=this.state.responseDeclarations[t];i.defaultValue=e.value;return}},getPciContext(){return this.pciContext},setPciContext(e){this.pciContext=e},getPciContextRenderer(){return this.pciContext.renderer2p0},setPciContextRenderer(e){this.pciContext.renderer2p0=e},initializePciMessageListener(){this.pciMessageHandler=this.PciMessageListener.bind(this),this.windowResizeHandler=this.WindowResize.bind(this),window.addEventListener("message",this.pciMessageHandler),window.addEventListener("resize",this.windowResizeHandler)},removePciMessageListener(){this.pciMessageHandler!==null&&window.removeEventListener("message",this.pciMessageHandler),this.windowResizeHandler!==null&&window.removeEventListener("resize",this.windowResizeHandler)},PciMessageListener(e){switch(e.data.message){case"PciChildLoaded":console.log("[PCI Parent] PCI Frame Loaded: "+e.data.identifier),this.pciInitialize(e.data.identifier);break;case"PciReady":console.log("[PCI Parent] PCI Ready: "+e.data.identifier+", height: "+e.data.height+", width: "+e.data.width),this.pciReady(e.data.identifier),this.pciResizeIframe(e.data.identifier,e.data.height,e.data.width,!0);break;case"PciResize":console.log("[PCI Parent] PCI Resize: "+e.data.identifier+", height: "+e.data.height+", width: "+e.data.width),this.pciResizeIframe(e.data.identifier,e.data.height,e.data.width,!1);break;case"PciGetState_Reply":console.log("[PCI Parent] PCI GetState Reply: "+e.data.identifier+", state:",e.data.state),this.pciSaveState(e.data.identifier,e.data.state);break}},WindowResize(){this.getInteractions().forEach(e=>{e.interactionType==="PortableCustom"&&e.node.pciResizeIframeWidthToContainer()})},pciInitialize(e){let t=_.getInteraction(e);typeof t>"u"||t.interactionType!=="PortableCustom"||t.node.pciInitialize()},pciReady(e){let t=_.getInteraction(e);typeof t>"u"||t.interactionType!=="PortableCustom"||t.node.pciSetReady()},pciResizeIframe(e,t,i,s){let n=_.getInteraction(e);typeof n>"u"||n.interactionType!=="PortableCustom"||(s?n.node.pciResizeIframe(t,n.node.initialWidth):n.node.pciResizeIframe(t,i))},pciSaveState(e,t){let i=_.getInteraction(e);typeof i>"u"||i.interactionType!=="PortableCustom"||i.node.pciSaveState(t)},getAsyncStateMap(){return this.state.asyncStateMap},getItemContextGuid(){return this.itemContext.guid},setItemContextGuid(e){this.itemContext.guid=e},initializeItemContextPnp(){this.itemContext.pnp=new Ds},getItemContextPnp(){return this.itemContext.pnp},setItemContextPnp(e){this.itemContext.pnp===null&&this.initializeItemContextPnp(),this.itemContext.pnp.setPnp(e)},initializeItemContextSessionControl(){this.itemContext.sc=new Pb},getItemContextSessionControl(){return this.itemContext.sc},setItemContextSessionControl(e){this.itemContext.sc===null&&this.initializeItemContextSessionControl(),this.itemContext.sc.setSessionControl(e)},getItemContextState(){return this.itemContext.state},setItemContextState(e){const t=new bc,i=e===null?e:t.createStateFromState(e);this.itemContext.state=i},getItemContextStateVariable(e){if(!this.hasItemContextState())return null;const t=this.getItemContextState();let i=t.outcomeVariables.find(s=>s.identifier===e);return typeof i<"u"||(i=t.responseVariables.find(s=>s.identifier===e),typeof i<"u")||(i=t.templateVariables.find(s=>s.identifier===e),typeof i<"u")||(i=t.contextDeclarations.find(s=>s.identifier===e),typeof i<"u")?i:null},hasItemContextState(){return this.getItemContextState()!==null},getItemContextValidationMessages(){return this.itemContext.validationMessages},addItemContextValidationMessage(e){this.itemContext.validationMessages.push(e)},resetItemContextValidationMessages(){this.itemContext.validationMessages.splice(0,this.itemContext.validationMessages.length)},getItemLifecycleStatus(){return this.lifecycleStatus},setItemLifecycleStatus(e){this.lifecycleStatus=e},NotifyPlayerReady(e){this.player=e.player},NotifyEndAttempt(e){this.state.item.endAttempt(e,(function(){this.state.item.notifyEndAttemptInteractionResults("itemEndAttemptReady")}).bind(this))},NotifyNewTemplate(e){this.state.item.newTemplate(e)},NotifyItemReady(e){this.setItem(e),this.getItem().isAdaptive||this.restartItemTimer(),this.getItem().isAdaptiveItemCompleted()||this.restartItemTimer()},NotifyInteractionSelectionsLimit(e){const t={icon:"warning",message:e};this.player.displayAlertMessage(t)},NotifyInteractionStateReady(e){console.log("[InteractionStateReady][Interaction]",e.identifier);const t=this.getInteraction(e.identifier);typeof t>"u"||typeof this.getAsyncStateMap().get(t.identifier)>"u"||(this.setResponseVariableValue({identifier:t.identifier,value:Hb.processInteractionResponse(t,this.getResponseDeclaration(t.identifier)),state:t.node.getState()}),this.getAsyncStateMap().delete(t.identifier),this.getAsyncStateMap().size===0&&this.getItem().triggerGetResponsesComplete())}},it={player:null,state:{test:null,identifier:"",title:"",responseDeclarations:[],contextDeclarations:[],outcomeDeclarations:[],timeLimit:null,testParts:[],outcomeProcessing:null,feedbacks:[],printedVariables:[],catalogs:[],scoringRubricBlocks:[]},testContext:{guid:null,pnp:null},sectionItemStates:new Map,getTest(){return this.state.test},setTest(e){this.state.test=e.test},getResponseDeclarations(){return this.state.responseDeclarations},getResponseDeclaration(e){return this.state.responseDeclarations.find(t=>t.identifier===e)},getOutcomeDeclarations(){return this.state.outcomeDeclarations},getOutcomeDeclaration(e){return this.state.outcomeDeclarations.find(t=>t.identifier===e)},getContextDeclarations(){return this.state.contextDeclarations},getContextDeclaration(e){return this.state.contextDeclarations.find(t=>t.identifier===e)},getVariableDeclaration(e){let t=this.state.outcomeDeclarations.find(i=>i.identifier===e);return typeof t<"u"||(t=this.state.contextDeclarations.find(i=>i.identifier===e),typeof t<"u")||(t=this.state.responseDeclarations.find(i=>i.identifier===e),typeof t<"u")?t:null},getTimeLimit(){return this.timeLimit},getTestParts(){return this.state.testParts},getTestPart(e){return this.state.testParts.find(t=>t.identifier===e)},getOutcomeProcessing(){return this.state.outcomeProcessing},getFeedbacks(){return this.state.feedbacks},getPrintedVariables(){return this.state.printedVariables},getCatalog(e){return this.state.catalogs.find(t=>t.id===e)},getCatalogs(){return this.state.catalogs},getScoringRubricBlocks(){return this.state.scoringRubricBlocks},defineContextDeclaration(e){let t=this.state.contextDeclarations.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.contextDeclarations[t]=e:this.state.contextDeclarations.push(e)},defineResponseDeclaration(e){let t=this.state.responseDeclarations.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.responseDeclarations[t]=e:this.state.responseDeclarations.push(e)},defineOutcomeDeclaration(e){let t=this.state.outcomeDeclarations.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.outcomeDeclarations[t]=e:this.state.outcomeDeclarations.push(e)},defineTimeLimit(e){this.state.timeLimit=e.node},defineTestPart(e){let t=this.state.testParts.findIndex(i=>i.identifier==e.identifier);if(t<0){this.state.testParts.push(e.testPart);return}this.state.testParts[t]=e.testPart},defineProcessing(e){this.state.processing=e,console.log("[QtiOutcomeProcessing][Defined]",e)},defineOutcomeProcessing(e){const t={processingType:"outcome",node:e.node};this.state.outcomeProcessing=t,console.log("[QtiOutcomeProcessing][Defined]",t)},defineFeedback(e){this.state.feedbacks.push(e),console.log("[DefineFeedback]["+e.outcomeIdentifier+"]["+e.identifier+"]")},definePrintedVariable(e){this.state.printedVariables.push(e)},defineCatalog(e){let t=this.state.catalogs.findIndex(i=>i.id==e.id);if(t<0){this.state.catalogs.push(e);return}this.state.catalogs[t]=e},defineScoringRubricBlock(e){this.state.scoringRubricBlocks.push(e)},resetAll(){this.state.test=null,this.state.identifier="",this.state.title="",this.state.responseDeclarations.splice(0,this.state.responseDeclarations.length),this.state.outcomeDeclarations.splice(0,this.state.outcomeDeclarations.length),this.state.contextDeclarations.splice(0,this.state.contextDeclarations.length),this.state.timeLimit=null,this.state.testParts.splice(0,this.state.testParts.length),this.state.outcomeProcessing=null,this.state.feedbacks.splice(0,this.state.feedbacks.length),this.state.printedVariables.splice(0,this.state.printedVariables.length),this.state.catalogs.splice(0,this.state.catalogs.length),this.state.scoringRubricBlocks.splice(0,this.state.scoringRubricBlocks.length),this.testContext.guid=null,this.testContext.state=null},initializeBuiltInDeclarations(){function e(){return 0}const t=new Map;t.set("candidateIdentifier",new Xe("candidateIdentifier","string",null)),t.set("testIdentifier",new Xe("testIdentifier","string",null)),t.set("environmentIdentifier",new Xe("environmentIdentifier","string",null)),this.defineContextDeclaration({identifier:"QTI_CONTEXT",baseType:null,cardinality:"record",value:t,defaultValue:t}),console.log("[QtiAssessmentTest][QTI_CONTEXT] initialized"),this.defineResponseDeclaration({identifier:"duration",baseType:"duration",cardinality:"single",value:0,resetValue:e,defaultValue:0,state:null}),console.log("[QtiAssessmentTest][duration] initialized")},setOutcomeVariableValue(e){let t=this.state.outcomeDeclarations.findIndex(i=>i.identifier==e.identifier);t<0||(this.state.outcomeDeclarations[t].value=e.value)},resetOutcomeVariableValue(e){let t=this.state.outcomeDeclarations.findIndex(s=>s.identifier==e.identifier);if(t<0)return;let i=this.state.outcomeDeclarations[t];if(i.defaultValue!==null){i.value=this.defaultValue;return}if(i.cardinality==="record"||i.cardinality==="multiple"||i.cardinality==="ordered"){i.value=null;return}if(i.baseType==="integer"||i.baseType==="float"){i.value=0;return}i.value=null},getTestContextGuid(){return this.testContext.guid},setTestContextGuid(e){this.testContext.guid=e},initializeTestContextPnp(){this.testContext.pnp=new Ds},getTestContextPnp(){return this.testContext.pnp},setTestContextPnp(e){this.testContext.pnp===null&&this.initializeTestContextPnp(),this.testContext.pnp.setPnp(e)},getAllTestStateItemStatesMap(){return this.sectionItemStates},setTestStateItemState(e,t,i,s){console.log("[TestStore][SetState][Part:"+e+"][Section:"+t+"][Item:"+i+"]",s);const n=`${e}~~${t}`;let r=this.getItemStateMapBySectionIdentifier(n);r!=null&&r.set(i,s)},getItemStateMapBySectionIdentifier(e){return this.sectionItemStates.has(e)?this.sectionItemStates.get(e):this.initializePartSectionItemStateMap(e)},getPartSectionMapBySectionIdentifier(e){for(let[t,i]of this.sectionItemStates)if(t.endsWith(e))return i;return null},initializePartSectionItemStateMap(e){return this.sectionItemStates.set(e,new Map),this.sectionItemStates.get(e)},findItemVariableValueByIdentifier(e,t){const i=this.findVariableByIdentifier(e.contextVariables,t);if(typeof i<"u")return i;const s=this.findVariableByIdentifier(e.outcomeVariables,t);if(typeof s<"u")return s;const n=this.findVariableByIdentifier(e.responseVariables,t);if(typeof n<"u")return n;const r=this.findVariableByIdentifier(e.templateVariables,t);return typeof r<"u"?r:null},findVariableByIdentifier(e,t){return e.find(i=>i.identifier===t)},getSerializedState(){return{contextVariables:this.serializeVariables(this.getContextDeclarations()),outcomeVariables:this.serializeVariables(this.getOutcomeDeclarations())}},serializeVariables(e){let t=[];return e.forEach(i=>{t.push({identifier:i.identifier,cardinality:i.cardinality,baseType:i.baseType,value:this.serializeVariableValue(i.cardinality,i.value)})}),t},serializeVariableValue(e,t){return e!=="record"?JSON.parse(JSON.stringify(t)):this.serializeRecordVariableValue(t)},serializeVariableState(e){return JSON.parse(JSON.stringify(e))},serializeRecordVariableValue(e){const t=this.strMapToJson(e);return this.jsonToStrMap(t)},strMapToJson(e){return JSON.stringify(this.strMapToObj(e))},jsonToStrMap(e){return this.objToStrMap(JSON.parse(e))},strMapToObj(e){let t=Object.create(null);for(let[i,s]of e)t[i]=s;return t},objToStrMap(e){let t=new Map;for(let i of Object.keys(e))t.set(i,e[i]);return t},NotifyTestPlayerReady(e){this.player=e.player},NotifyTestReady(e){this.setTest(e)}};class Fb{constructor(){J(this,"xmlDeclaration",null);J(this,"rxTrackSource",null);this.xmlDeclaration=new RegExp(/<\?xml.*?\?>/s),this.rxTrackSource=new RegExp(/<(track|source)[^>]+?\/>/g)}filterXmlDeclaration(t){return t.replace(this.xmlDeclaration,"")}filterCdata(t){return t.replaceAll("<![CDATA[","").replaceAll("]]>","")}filterStyle(t){return t.replaceAll("<style>","<amp-style>").replaceAll("</style>","</amp-style>")}filterMedia(t){return t=t.replaceAll("<video>","<amp-video>").replaceAll("<video ","<amp-video ").replaceAll("</video>","</amp-video>").replaceAll("<audio>","<amp-audio>").replaceAll("<audio ","<amp-audio ").replaceAll("</audio>","</amp-audio>"),this.filterTrackSource(t)}filterTrackSource(t){return t.replace(this.rxTrackSource,i=>i.replace(/\/>/g,">"))}}/*!
|
1
|
+
(function(l,Xe){typeof exports=="object"&&typeof module<"u"?module.exports=Xe(require("vue")):typeof define=="function"&&define.amd?define(["vue"],Xe):(l=typeof globalThis<"u"?globalThis:l||self,l.Qti3Player=Xe(l.Vue))})(this,function(l){"use strict";var U3=Object.defineProperty;var G3=(l,Xe,Ds)=>Xe in l?U3(l,Xe,{enumerable:!0,configurable:!0,writable:!0,value:Ds}):l[Xe]=Ds;var J=(l,Xe,Ds)=>G3(l,typeof Xe!="symbol"?Xe+"":Xe,Ds);class Xe{constructor(t,i,s){this.fieldIdentifier=t,this.value=s,this.baseType=i,this.cardinality="single"}getValue(){return this.value}setValue(t){this.value=t}getBaseType(){return this.baseType}setBaseType(t){this.baseType=t}getCardinality(){return this.cardinality}getFieldIdentifier(){return this.fieldIdentifier}setFieldIdentifier(t){this.fieldIdentifier=t}}class Ds{constructor(){J(this,"constants",{COLOR_DEFAULT:"qti3-player-color-default",COLOR_DEFAULT_REVERSE:"qti3-player-color-defaultreverse",COLOR_BLACK_WHITE:"qti3-player-color-blackwhite",COLOR_WHITE_BLACK:"qti3-player-color-whiteblack",COLOR_BLACK_ROSE:"qti3-player-color-blackrose",COLOR_ROSE_BLACK:"qti3-player-color-roseblack",COLOR_YELLOW_BLUE:"qti3-player-color-yellowblue",COLOR_BLUE_YELLOW:"qti3-player-color-blueyellow",COLOR_MGRAY_DGRAY:"qti3-player-color-mgraydgray",COLOR_DGRAY_MGRAY:"qti3-player-color-dgraymgray",COLOR_BLACK_CYAN:"qti3-player-color-blackcyan",COLOR_CYAN_BLACK:"qti3-player-color-cyanblack",COLOR_BLACK_CREAM:"qti3-player-color-blackcream",COLOR_CREAM_BLACK:"qti3-player-color-creamblack",GLOSSARY_ON:"glossary-on",GLOSSARY_OFF:"glossary-off",KEYWORD_TRANS_OFF:"ktlang-off",KEYWORD_TRANS_AR:"ktlang-ar",KEYWORD_TRANS_CMN:"ktlang-cmn",KEYWORD_TRANS_DE:"ktlang-de",KEYWORD_TRANS_EN:"ktlang-en",KEYWORD_TRANS_ES:"ktlang-es",KEYWORD_TRANS_FR:"ktlang-fr",KEYWORD_TRANS_HMN:"ktlang-hmn",KEYWORD_TRANS_IT:"ktlang-it",KEYWORD_TRANS_JA:"ktlang-ja",KEYWORD_TRANS_KO:"ktlang-ko",KEYWORD_TRANS_MY:"ktlang-my",KEYWORD_TRANS_NL:"ktlang-nl",KEYWORD_TRANS_PA:"ktlang-pa",KEYWORD_TRANS_RU:"ktlang-ru",KEYWORD_TRANS_SO:"ktlang-so",KEYWORD_TRANS_TL:"ktlang-tl",KEYWORD_TRANS_UK:"ktlang-uk",KEYWORD_TRANS_VI:"ktlang-vi",KEYWORD_TRANS_YUE:"ktlang-yue",KEYWORD_TRANS_ZH:"ktlang-zh",EXT_SBAC_GLOSSARY_ILLUSTRATION_ON:"sbacGlossaryIllustration-on",EXT_SBAC_GLOSSARY_ILLUSTRATION_OFF:"sbacGlossaryIllustration-off"});return this.pnp=this.defaultPnp(),this}defaultPnp(){return{textAppearance:{colorStyle:this.constants.COLOR_DEFAULT},glossaryOnScreen:!0,keywordTranslationLanguage:"",extSbacGlossaryIllustration:!1,layoutSingleColumn:!1}}setPnp(t){typeof t>"u"||(t===null&&(this.pnp=this.defaultPnp()),"textAppearance"in t&&t.textAppearance!==null&&"colorStyle"in t.textAppearance&&this.setColorStyle(t.textAppearance.colorStyle),"glossaryOnScreen"in t&&t.glossaryOnScreen!==null&&this.setGlossaryOnScreen(t.glossaryOnScreen),"keywordTranslationLanguage"in t&&this.setKeywordTranslationLanguage(t.keywordTranslationLanguage),"extSbacGlossaryIllustration"in t&&t.extSbacGlossaryIllustration!==null&&this.setExtSbacGlossaryIllustration(t.extSbacGlossaryIllustration),"layoutSingleColumn"in t&&t.layoutSingleColumn!==null&&this.setLayoutSingleColumn(t.layoutSingleColumn))}getPnp(){return this.pnp}getColorStyle(){return this.pnp.textAppearance.colorStyle}setColorStyle(t){this.pnp.textAppearance.colorStyle=t}getGlossaryOnScreen(){return this.pnp.glossaryOnScreen}setGlossaryOnScreen(t){this.pnp.glossaryOnScreen=t}getKeywordTranslationLanguage(){return this.pnp.keywordTranslationLanguage}setKeywordTranslationLanguage(t){this.pnp.keywordTranslationLanguage=t}getExtSbacGlossaryIllustration(){return this.pnp.extSbacGlossaryIllustration}setExtSbacGlossaryIllustration(t){this.pnp.extSbacGlossaryIllustration=t}getLayoutSingleColumn(){return this.pnp.layoutSingleColumn}setLayoutSingleColumn(t){this.pnp.layoutSingleColumn=t}evaluatePnpEvent(t){let i=!1;switch(t){case this.constants.GLOSSARY_ON:this.getGlossaryOnScreen()===!1&&(this.setGlossaryOnScreen(!0),i=!0);break;case this.constants.GLOSSARY_OFF:this.getGlossaryOnScreen()===!0&&(this.setGlossaryOnScreen(!1),i=!0);break;case this.constants.KEYWORD_TRANS_OFF:this.getKeywordTranslationLanguage()!==""&&(this.setKeywordTranslationLanguage(""),i=!0);break;case this.constants.KEYWORD_TRANS_AR:this.getKeywordTranslationLanguage()!=="ar"&&(this.setKeywordTranslationLanguage("ar"),i=!0);break;case this.constants.KEYWORD_TRANS_CMN:this.getKeywordTranslationLanguage()!=="cmn"&&(this.setKeywordTranslationLanguage("cmn"),i=!0);break;case this.constants.KEYWORD_TRANS_DE:this.getKeywordTranslationLanguage()!=="de"&&(this.setKeywordTranslationLanguage("de"),i=!0);break;case this.constants.KEYWORD_TRANS_EN:this.getKeywordTranslationLanguage()!=="en"&&(this.setKeywordTranslationLanguage("en"),i=!0);break;case this.constants.KEYWORD_TRANS_ES:this.getKeywordTranslationLanguage()!=="es"&&(this.setKeywordTranslationLanguage("es"),i=!0);break;case this.constants.KEYWORD_TRANS_FR:this.getKeywordTranslationLanguage()!=="fr"&&(this.setKeywordTranslationLanguage("fr"),i=!0);break;case this.constants.KEYWORD_TRANS_HMN:this.getKeywordTranslationLanguage()!=="hmn"&&(this.setKeywordTranslationLanguage("hmn"),i=!0);break;case this.constants.KEYWORD_TRANS_IT:this.getKeywordTranslationLanguage()!=="it"&&(this.setKeywordTranslationLanguage("it"),i=!0);break;case this.constants.KEYWORD_TRANS_JA:this.getKeywordTranslationLanguage()!=="ja"&&(this.setKeywordTranslationLanguage("ja"),i=!0);break;case this.constants.KEYWORD_TRANS_KO:this.getKeywordTranslationLanguage()!=="ko"&&(this.setKeywordTranslationLanguage("ko"),i=!0);break;case this.constants.KEYWORD_TRANS_MY:this.getKeywordTranslationLanguage()!=="my"&&(this.setKeywordTranslationLanguage("my"),i=!0);break;case this.constants.KEYWORD_TRANS_NL:this.getKeywordTranslationLanguage()!=="nl"&&(this.setKeywordTranslationLanguage("nl"),i=!0);break;case this.constants.KEYWORD_TRANS_PA:this.getKeywordTranslationLanguage()!=="pa"&&(this.setKeywordTranslationLanguage("pa"),i=!0);break;case this.constants.KEYWORD_TRANS_RU:this.getKeywordTranslationLanguage()!=="ru"&&(this.setKeywordTranslationLanguage("ru"),i=!0);break;case this.constants.KEYWORD_TRANS_SO:this.getKeywordTranslationLanguage()!=="so"&&(this.setKeywordTranslationLanguage("so"),i=!0);break;case this.constants.KEYWORD_TRANS_TL:this.getKeywordTranslationLanguage()!=="tl"&&(this.setKeywordTranslationLanguage("tl"),i=!0);break;case this.constants.KEYWORD_TRANS_UK:this.getKeywordTranslationLanguage()!=="uk"&&(this.setKeywordTranslationLanguage("uk"),i=!0);break;case this.constants.KEYWORD_TRANS_VI:this.getKeywordTranslationLanguage()!=="vi"&&(this.setKeywordTranslationLanguage("vi"),i=!0);break;case this.constants.KEYWORD_TRANS_YUE:this.getKeywordTranslationLanguage()!=="yue"&&(this.setKeywordTranslationLanguage("yue"),i=!0);break;case this.constants.KEYWORD_TRANS_ZH:this.getKeywordTranslationLanguage()!=="zh"&&(this.setKeywordTranslationLanguage("zh"),i=!0);break;case this.constants.EXT_SBAC_GLOSSARY_ILLUSTRATION_ON:this.getExtSbacGlossaryIllustration()===!1&&(this.setExtSbacGlossaryIllustration(!0),i=!0);break;case this.constants.EXT_SBAC_GLOSSARY_ILLUSTRATION_OFF:this.getExtSbacGlossaryIllustration()===!0&&(this.setExtSbacGlossaryIllustration(!1),i=!0);break}return i}}class Pb{constructor(){J(this,"constants",{TIME_LIMITS_DEFAULT:{min_time:null,max_time:null,allow_late_submission:!1},ATTEMPTS_UNLIMITED:0});return this.sc=this.defaultSessionControl(),this}defaultSessionControl(){return this.sc={allow_comment:!1,allow_review:!0,allow_skipping:!0,max_attempts:this.constants.ATTEMPTS_UNLIMITED,show_feedback:!1,show_solution:!1,time_limits:this.constants.TIME_LIMITS_DEFAULT,validate_responses:!1},this.sc}setSessionControl(t){if(!(typeof t>"u")){if(t===null)return this.sc=this.defaultSessionControl();"allow_comment"in t&&t.allow_comment!==null&&this.setAllowComment(t.allow_comment),"allow_review"in t&&t.allow_review!==null&&this.setAllowReview(t.allow_review),"allow_skipping"in t&&t.allow_skipping!==null&&this.setAllowSkipping(t.allow_skipping),"max_attempts"in t&&t.max_attempts!==null&&this.setMaxAttempts(t.max_attempts),"show_feedback"in t&&t.show_feedback!==null&&this.setShowFeedback(t.show_feedback),"show_solution"in t&&t.show_solution!==null&&this.setShowSolution(t.show_solution),"time_limits"in t&&t.time_limits!==null&&("min_time"in t.time_limits&&this.setTimeLimitsMinTime(t.time_limits.min_time),"max_time"in t.time_limits&&this.setTimeLimitsMaxTime(t.time_limits.max_time),"allow_late_submission"in t.time_limits&&this.setTimeLimitsAllowLateSubmission(t.time_limits.allow_late_submission)),"validate_responses"in t&&t.validate_responses!==null&&this.setValidateResponses(t.validate_responses)}}getSessionControl(){return{allow_comment:this.getAllowComment(),allow_review:this.getAllowReview(),allow_skipping:this.getAllowSkipping(),max_attempts:this.getMaxAttempts(),show_feedback:this.getShowFeedback(),show_solution:this.getShowSolution(),time_limits:this.getTimeLimits(),validate_responses:this.getValidateResponses()}}getAllowComment(){return this.sc.allow_comment}setAllowComment(t){this.sc.allow_comment=t}getAllowReview(){return this.sc.allow_review}setAllowReview(t){this.sc.allow_review=t}getAllowSkipping(){return this.sc.allow_skipping}setAllowSkipping(t){this.sc.allow_skipping=t}getMaxAttempts(){return this.sc.max_attempts}setMaxAttempts(t){this.sc.max_attempts=t}getShowFeedback(){return this.sc.show_feedback}setShowFeedback(t){this.sc.show_feedback=t}getShowSolution(){return this.sc.show_solution}setShowSolution(t){this.sc.show_solution=t}getTimeLimits(){return this.sc.time_limits}setTimeLimits(t=null,i=null,s=!1){this.setTimeLimitsMinTime(t),this.setTimeLimitsMaxTime(i),this.setTimeLimitsAllowLateSubmission(s)}getTimeLimitsMinTime(){return this.sc.time_limits.min_time}setTimeLimitsMinTime(t){this.sc.time_limits.min_time=t}getTimeLimitsMaxTime(){return this.sc.time_limits.max_time}setTimeLimitsMaxTime(t){this.sc.time_limits.max_time=t}getTimeLimitsAllowLateSubmission(){return this.sc.time_limits.allow_late_submission}setTimeLimitsAllowLateSubmission(t){this.sc.time_limits.allow_late_submission=t}getValidateResponses(){return this.sc.validate_responses}setValidateResponses(t){this.sc.validate_responses=t}}class bc{constructor(t,i){return typeof t>"u"?this:(this.identifier=t,this.guid=i.getItemContextGuid(),this.contextVariables=i.getContextDeclarations(),this.responseVariables=i.getResponseDeclarations(),this.templateVariables=i.getTemplateDeclarations(),this.outcomeVariables=i.getOutcomeDeclarations(),this.validationMessages=i.getItemContextValidationMessages(),this)}createStateFromState(t){return this.identifier=t.identifier,this.guid=t.guid,this.contextVariables=t.contextVariables,this.responseVariables=t.responseVariables,this.templateVariables=t.templateVariables,this.outcomeVariables=t.outcomeVariables,this.validationMessages=t.validationMessages,this.getSerializedState()}getSerializedState(){return{identifier:this.identifier,guid:this.guid,contextVariables:this.serializeVariables(this.contextVariables),responseVariables:this.serializeResponseVariables(this.responseVariables),outcomeVariables:this.serializeOutcomeVariables(this.outcomeVariables),templateVariables:this.serializeVariables(this.templateVariables),validationMessages:this.serializeValidationMessages(this.validationMessages)}}serializeResponseVariables(t){let i=[];return t.forEach(s=>{let n={identifier:s.identifier,cardinality:s.cardinality,baseType:this.resolveBaseType(s.baseType),value:this.serializeVariableValue(s.cardinality,s.value),state:this.serializeVariableState(s.state)};"correctResponse"in s&&(n.correctResponse=this.serializeVariableValue(s.cardinality,s.correctResponse)),i.push(n)}),i}serializeOutcomeVariables(t){let i=[];return t.forEach(s=>{i.push({identifier:s.identifier,cardinality:s.cardinality,baseType:this.resolveBaseType(s.baseType),value:this.serializeVariableValue(s.cardinality,s.value),view:s.view,interpretation:s.interpretation,longInterpretation:s.longInterpretation,normalMaximum:s.normalMaximum,normalMinimum:s.normalMinimum,masteryValue:s.masteryValue,externalScored:s.externalScored,variableIdentifierRef:s.variableIdentifierRef})}),i}serializeVariables(t){let i=[];return t.forEach(s=>{i.push({identifier:s.identifier,cardinality:s.cardinality,baseType:this.resolveBaseType(s.baseType),value:this.serializeVariableValue(s.cardinality,s.value)})}),i}serializeValidationMessages(t){let i=[];return t.forEach(s=>{i.push({identifier:s.identifier,message:s.message})}),i}serializeVariableValue(t,i){return t!=="record"?JSON.parse(JSON.stringify(i)):this.serializeRecordVariableValue(i)}serializeVariableState(t){return JSON.parse(JSON.stringify(t))}resolveBaseType(t){return typeof t>"u"?null:t}serializeRecordVariableValue(t){const i=this.strMapToJson(t);return this.jsonToStrMap(i)}strMapToJson(t){return JSON.stringify(this.strMapToObj(t))}jsonToStrMap(t){return this.objToStrMap(JSON.parse(t))}strMapToObj(t){let i=Object.create(null);for(let[s,n]of t)i[s]=typeof n=="object"&&n!==null?n.getValue():n;return i}objToStrMap(t){let i=new Map;for(let s of Object.keys(t))i.set(s,t[s]);return i}}class Db{constructor(){J(this,"itemTimer");J(this,"itemDuration");this.setTime(0)}getTime(){return this.itemDuration}setTime(t){this.itemDuration=t}startTimer(){this.clearTimer(),this.setTime(0),this.itemTimer=setInterval(this.updateTime.bind(this),1e3)}updateTime(){++this.itemDuration}resetTimer(){this.clearTimer(),this.setTime(0)}clearTimer(){clearInterval(this.itemTimer)}}var Qb=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,vc=Math.ceil,Yt=Math.floor,Ct="[BigNumber Error] ",hf=Ct+"Number primitive has more than 15 significant digits: ",fi=1e14,ye=14,Ec=9007199254740991,Tc=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ws=1e7,tt=1e9;function df(e){var t,i,s,n=x.prototype={constructor:x,toString:null,valueOf:null},r=new x(1),a=20,o=4,u=-7,h=21,f=-1e7,m=1e7,w=!1,y=1,b=0,S={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},C="0123456789abcdefghijklmnopqrstuvwxyz",L=!0;function x(p,v){var T,N,V,$,q,A,M,k,R=this;if(!(R instanceof x))return new x(p,v);if(v==null){if(p&&p._isBigNumber===!0){R.s=p.s,!p.c||p.e>m?R.c=R.e=null:p.e<f?R.c=[R.e=0]:(R.e=p.e,R.c=p.c.slice());return}if((A=typeof p=="number")&&p*0==0){if(R.s=1/p<0?(p=-p,-1):1,p===~~p){for($=0,q=p;q>=10;q/=10,$++);$>m?R.c=R.e=null:(R.e=$,R.c=[p]);return}k=String(p)}else{if(!Qb.test(k=String(p)))return s(R,k,A);R.s=k.charCodeAt(0)==45?(k=k.slice(1),-1):1}($=k.indexOf("."))>-1&&(k=k.replace(".","")),(q=k.search(/e/i))>0?($<0&&($=q),$+=+k.slice(q+1),k=k.substring(0,q)):$<0&&($=k.length)}else{if(De(v,2,C.length,"Base"),v==10&&L)return R=new x(p),Q(R,a+R.e+1,o);if(k=String(p),A=typeof p=="number"){if(p*0!=0)return s(R,k,A,v);if(R.s=1/p<0?(k=k.slice(1),-1):1,x.DEBUG&&k.replace(/^0\.0*|\./,"").length>15)throw Error(hf+p)}else R.s=k.charCodeAt(0)===45?(k=k.slice(1),-1):1;for(T=C.slice(0,v),$=q=0,M=k.length;q<M;q++)if(T.indexOf(N=k.charAt(q))<0){if(N=="."){if(q>$){$=M;continue}}else if(!V&&(k==k.toUpperCase()&&(k=k.toLowerCase())||k==k.toLowerCase()&&(k=k.toUpperCase()))){V=!0,q=-1,$=0;continue}return s(R,String(p),A,v)}A=!1,k=i(k,v,10,R.s),($=k.indexOf("."))>-1?k=k.replace(".",""):$=k.length}for(q=0;k.charCodeAt(q)===48;q++);for(M=k.length;k.charCodeAt(--M)===48;);if(k=k.slice(q,++M)){if(M-=q,A&&x.DEBUG&&M>15&&(p>Ec||p!==Yt(p)))throw Error(hf+R.s*p);if(($=$-q-1)>m)R.c=R.e=null;else if($<f)R.c=[R.e=0];else{if(R.e=$,R.c=[],q=($+1)%ye,$<0&&(q+=ye),q<M){for(q&&R.c.push(+k.slice(0,q)),M-=ye;q<M;)R.c.push(+k.slice(q,q+=ye));q=ye-(k=k.slice(q)).length}else q-=M;for(;q--;k+="0");R.c.push(+k)}}else R.c=[R.e=0]}x.clone=df,x.ROUND_UP=0,x.ROUND_DOWN=1,x.ROUND_CEIL=2,x.ROUND_FLOOR=3,x.ROUND_HALF_UP=4,x.ROUND_HALF_DOWN=5,x.ROUND_HALF_EVEN=6,x.ROUND_HALF_CEIL=7,x.ROUND_HALF_FLOOR=8,x.EUCLID=9,x.config=x.set=function(p){var v,T;if(p!=null)if(typeof p=="object"){if(p.hasOwnProperty(v="DECIMAL_PLACES")&&(T=p[v],De(T,0,tt,v),a=T),p.hasOwnProperty(v="ROUNDING_MODE")&&(T=p[v],De(T,0,8,v),o=T),p.hasOwnProperty(v="EXPONENTIAL_AT")&&(T=p[v],T&&T.pop?(De(T[0],-tt,0,v),De(T[1],0,tt,v),u=T[0],h=T[1]):(De(T,-tt,tt,v),u=-(h=T<0?-T:T))),p.hasOwnProperty(v="RANGE"))if(T=p[v],T&&T.pop)De(T[0],-tt,-1,v),De(T[1],1,tt,v),f=T[0],m=T[1];else if(De(T,-tt,tt,v),T)f=-(m=T<0?-T:T);else throw Error(Ct+v+" cannot be zero: "+T);if(p.hasOwnProperty(v="CRYPTO"))if(T=p[v],T===!!T)if(T)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))w=T;else throw w=!T,Error(Ct+"crypto unavailable");else w=T;else throw Error(Ct+v+" not true or false: "+T);if(p.hasOwnProperty(v="MODULO_MODE")&&(T=p[v],De(T,0,9,v),y=T),p.hasOwnProperty(v="POW_PRECISION")&&(T=p[v],De(T,0,tt,v),b=T),p.hasOwnProperty(v="FORMAT"))if(T=p[v],typeof T=="object")S=T;else throw Error(Ct+v+" not an object: "+T);if(p.hasOwnProperty(v="ALPHABET"))if(T=p[v],typeof T=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(T))L=T.slice(0,10)=="0123456789",C=T;else throw Error(Ct+v+" invalid: "+T)}else throw Error(Ct+"Object expected: "+p);return{DECIMAL_PLACES:a,ROUNDING_MODE:o,EXPONENTIAL_AT:[u,h],RANGE:[f,m],CRYPTO:w,MODULO_MODE:y,POW_PRECISION:b,FORMAT:S,ALPHABET:C}},x.isBigNumber=function(p){if(!p||p._isBigNumber!==!0)return!1;if(!x.DEBUG)return!0;var v,T,N=p.c,V=p.e,$=p.s;e:if({}.toString.call(N)=="[object Array]"){if(($===1||$===-1)&&V>=-tt&&V<=tt&&V===Yt(V)){if(N[0]===0){if(V===0&&N.length===1)return!0;break e}if(v=(V+1)%ye,v<1&&(v+=ye),String(N[0]).length==v){for(v=0;v<N.length;v++)if(T=N[v],T<0||T>=fi||T!==Yt(T))break e;if(T!==0)return!0}}}else if(N===null&&V===null&&($===null||$===1||$===-1))return!0;throw Error(Ct+"Invalid BigNumber: "+p)},x.maximum=x.max=function(){return E(arguments,-1)},x.minimum=x.min=function(){return E(arguments,1)},x.random=function(){var p=9007199254740992,v=Math.random()*p&2097151?function(){return Yt(Math.random()*p)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(T){var N,V,$,q,A,M=0,k=[],R=new x(r);if(T==null?T=a:De(T,0,tt),q=vc(T/ye),w)if(crypto.getRandomValues){for(N=crypto.getRandomValues(new Uint32Array(q*=2));M<q;)A=N[M]*131072+(N[M+1]>>>11),A>=9e15?(V=crypto.getRandomValues(new Uint32Array(2)),N[M]=V[0],N[M+1]=V[1]):(k.push(A%1e14),M+=2);M=q/2}else if(crypto.randomBytes){for(N=crypto.randomBytes(q*=7);M<q;)A=(N[M]&31)*281474976710656+N[M+1]*1099511627776+N[M+2]*4294967296+N[M+3]*16777216+(N[M+4]<<16)+(N[M+5]<<8)+N[M+6],A>=9e15?crypto.randomBytes(7).copy(N,M):(k.push(A%1e14),M+=7);M=q/7}else throw w=!1,Error(Ct+"crypto unavailable");if(!w)for(;M<q;)A=v(),A<9e15&&(k[M++]=A%1e14);for(q=k[--M],T%=ye,q&&T&&(A=Tc[ye-T],k[M]=Yt(q/A)*A);k[M]===0;k.pop(),M--);if(M<0)k=[$=0];else{for($=-1;k[0]===0;k.splice(0,1),$-=ye);for(M=1,A=k[0];A>=10;A/=10,M++);M<ye&&($-=ye-M)}return R.e=$,R.c=k,R}}(),x.sum=function(){for(var p=1,v=arguments,T=new x(v[0]);p<v.length;)T=T.plus(v[p++]);return T},i=function(){var p="0123456789";function v(T,N,V,$){for(var q,A=[0],M,k=0,R=T.length;k<R;){for(M=A.length;M--;A[M]*=N);for(A[0]+=$.indexOf(T.charAt(k++)),q=0;q<A.length;q++)A[q]>V-1&&(A[q+1]==null&&(A[q+1]=0),A[q+1]+=A[q]/V|0,A[q]%=V)}return A.reverse()}return function(T,N,V,$,q){var A,M,k,R,z,Z,ne,de,ge=T.indexOf("."),Ee=a,P=o;for(ge>=0&&(R=b,b=0,T=T.replace(".",""),de=new x(N),Z=de.pow(T.length-ge),b=R,de.c=v(Ji(Zt(Z.c),Z.e,"0"),10,V,p),de.e=de.c.length),ne=v(T,N,V,q?(A=C,p):(A=p,C)),k=R=ne.length;ne[--R]==0;ne.pop());if(!ne[0])return A.charAt(0);if(ge<0?--k:(Z.c=ne,Z.e=k,Z.s=$,Z=t(Z,de,Ee,P,V),ne=Z.c,z=Z.r,k=Z.e),M=k+Ee+1,ge=ne[M],R=V/2,z=z||M<0||ne[M+1]!=null,z=P<4?(ge!=null||z)&&(P==0||P==(Z.s<0?3:2)):ge>R||ge==R&&(P==4||z||P==6&&ne[M-1]&1||P==(Z.s<0?8:7)),M<1||!ne[0])T=z?Ji(A.charAt(1),-Ee,A.charAt(0)):A.charAt(0);else{if(ne.length=M,z)for(--V;++ne[--M]>V;)ne[M]=0,M||(++k,ne=[1].concat(ne));for(R=ne.length;!ne[--R];);for(ge=0,T="";ge<=R;T+=A.charAt(ne[ge++]));T=Ji(T,k,A.charAt(0))}return T}}(),t=function(){function p(N,V,$){var q,A,M,k,R=0,z=N.length,Z=V%ws,ne=V/ws|0;for(N=N.slice();z--;)M=N[z]%ws,k=N[z]/ws|0,q=ne*M+k*Z,A=Z*M+q%ws*ws+R,R=(A/$|0)+(q/ws|0)+ne*k,N[z]=A%$;return R&&(N=[R].concat(N)),N}function v(N,V,$,q){var A,M;if($!=q)M=$>q?1:-1;else for(A=M=0;A<$;A++)if(N[A]!=V[A]){M=N[A]>V[A]?1:-1;break}return M}function T(N,V,$,q){for(var A=0;$--;)N[$]-=A,A=N[$]<V[$]?1:0,N[$]=A*q+N[$]-V[$];for(;!N[0]&&N.length>1;N.splice(0,1));}return function(N,V,$,q,A){var M,k,R,z,Z,ne,de,ge,Ee,P,K,Me,qe,Et,at,He,ft,Fe=N.s==V.s?1:-1,Oe=N.c,_e=V.c;if(!Oe||!Oe[0]||!_e||!_e[0])return new x(!N.s||!V.s||(Oe?_e&&Oe[0]==_e[0]:!_e)?NaN:Oe&&Oe[0]==0||!_e?Fe*0:Fe/0);for(ge=new x(Fe),Ee=ge.c=[],k=N.e-V.e,Fe=$+k+1,A||(A=fi,k=Xt(N.e/ye)-Xt(V.e/ye),Fe=Fe/ye|0),R=0;_e[R]==(Oe[R]||0);R++);if(_e[R]>(Oe[R]||0)&&k--,Fe<0)Ee.push(1),z=!0;else{for(Et=Oe.length,He=_e.length,R=0,Fe+=2,Z=Yt(A/(_e[0]+1)),Z>1&&(_e=p(_e,Z,A),Oe=p(Oe,Z,A),He=_e.length,Et=Oe.length),qe=He,P=Oe.slice(0,He),K=P.length;K<He;P[K++]=0);ft=_e.slice(),ft=[0].concat(ft),at=_e[0],_e[1]>=A/2&&at++;do{if(Z=0,M=v(_e,P,He,K),M<0){if(Me=P[0],He!=K&&(Me=Me*A+(P[1]||0)),Z=Yt(Me/at),Z>1)for(Z>=A&&(Z=A-1),ne=p(_e,Z,A),de=ne.length,K=P.length;v(ne,P,de,K)==1;)Z--,T(ne,He<de?ft:_e,de,A),de=ne.length,M=1;else Z==0&&(M=Z=1),ne=_e.slice(),de=ne.length;if(de<K&&(ne=[0].concat(ne)),T(P,ne,K,A),K=P.length,M==-1)for(;v(_e,P,He,K)<1;)Z++,T(P,He<K?ft:_e,K,A),K=P.length}else M===0&&(Z++,P=[0]);Ee[R++]=Z,P[0]?P[K++]=Oe[qe]||0:(P=[Oe[qe]],K=1)}while((qe++<Et||P[0]!=null)&&Fe--);z=P[0]!=null,Ee[0]||Ee.splice(0,1)}if(A==fi){for(R=1,Fe=Ee[0];Fe>=10;Fe/=10,R++);Q(ge,$+(ge.e=R+k*ye-1)+1,q,z)}else ge.e=k,ge.r=+z;return ge}}();function D(p,v,T,N){var V,$,q,A,M;if(T==null?T=o:De(T,0,8),!p.c)return p.toString();if(V=p.c[0],q=p.e,v==null)M=Zt(p.c),M=N==1||N==2&&(q<=u||q>=h)?bo(M,q):Ji(M,q,"0");else if(p=Q(new x(p),v,T),$=p.e,M=Zt(p.c),A=M.length,N==1||N==2&&(v<=$||$<=u)){for(;A<v;M+="0",A++);M=bo(M,$)}else if(v-=q,M=Ji(M,$,"0"),$+1>A){if(--v>0)for(M+=".";v--;M+="0");}else if(v+=$-A,v>0)for($+1==A&&(M+=".");v--;M+="0");return p.s<0&&V?"-"+M:M}function E(p,v){for(var T,N,V=1,$=new x(p[0]);V<p.length;V++)N=new x(p[V]),(!N.s||(T=Qs($,N))===v||T===0&&$.s===v)&&($=N);return $}function U(p,v,T){for(var N=1,V=v.length;!v[--V];v.pop());for(V=v[0];V>=10;V/=10,N++);return(T=N+T*ye-1)>m?p.c=p.e=null:T<f?p.c=[p.e=0]:(p.e=T,p.c=v),p}s=function(){var p=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,T=/^\.([^.]+)$/,N=/^-?(Infinity|NaN)$/,V=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function($,q,A,M){var k,R=A?q:q.replace(V,"");if(N.test(R))$.s=isNaN(R)?null:R<0?-1:1;else{if(!A&&(R=R.replace(p,function(z,Z,ne){return k=(ne=ne.toLowerCase())=="x"?16:ne=="b"?2:8,!M||M==k?Z:z}),M&&(k=M,R=R.replace(v,"$1").replace(T,"0.$1")),q!=R))return new x(R,k);if(x.DEBUG)throw Error(Ct+"Not a"+(M?" base "+M:"")+" number: "+q);$.s=null}$.c=$.e=null}}();function Q(p,v,T,N){var V,$,q,A,M,k,R,z=p.c,Z=Tc;if(z){e:{for(V=1,A=z[0];A>=10;A/=10,V++);if($=v-V,$<0)$+=ye,q=v,M=z[k=0],R=Yt(M/Z[V-q-1]%10);else if(k=vc(($+1)/ye),k>=z.length)if(N){for(;z.length<=k;z.push(0));M=R=0,V=1,$%=ye,q=$-ye+1}else break e;else{for(M=A=z[k],V=1;A>=10;A/=10,V++);$%=ye,q=$-ye+V,R=q<0?0:Yt(M/Z[V-q-1]%10)}if(N=N||v<0||z[k+1]!=null||(q<0?M:M%Z[V-q-1]),N=T<4?(R||N)&&(T==0||T==(p.s<0?3:2)):R>5||R==5&&(T==4||N||T==6&&($>0?q>0?M/Z[V-q]:0:z[k-1])%10&1||T==(p.s<0?8:7)),v<1||!z[0])return z.length=0,N?(v-=p.e+1,z[0]=Z[(ye-v%ye)%ye],p.e=-v||0):z[0]=p.e=0,p;if($==0?(z.length=k,A=1,k--):(z.length=k+1,A=Z[ye-$],z[k]=q>0?Yt(M/Z[V-q]%Z[q])*A:0),N)for(;;)if(k==0){for($=1,q=z[0];q>=10;q/=10,$++);for(q=z[0]+=A,A=1;q>=10;q/=10,A++);$!=A&&(p.e++,z[0]==fi&&(z[0]=1));break}else{if(z[k]+=A,z[k]!=fi)break;z[k--]=0,A=1}for($=z.length;z[--$]===0;z.pop());}p.e>m?p.c=p.e=null:p.e<f&&(p.c=[p.e=0])}return p}function ee(p){var v,T=p.e;return T===null?p.toString():(v=Zt(p.c),v=T<=u||T>=h?bo(v,T):Ji(v,T,"0"),p.s<0?"-"+v:v)}return n.absoluteValue=n.abs=function(){var p=new x(this);return p.s<0&&(p.s=1),p},n.comparedTo=function(p,v){return Qs(this,new x(p,v))},n.decimalPlaces=n.dp=function(p,v){var T,N,V,$=this;if(p!=null)return De(p,0,tt),v==null?v=o:De(v,0,8),Q(new x($),p+$.e+1,v);if(!(T=$.c))return null;if(N=((V=T.length-1)-Xt(this.e/ye))*ye,V=T[V])for(;V%10==0;V/=10,N--);return N<0&&(N=0),N},n.dividedBy=n.div=function(p,v){return t(this,new x(p,v),a,o)},n.dividedToIntegerBy=n.idiv=function(p,v){return t(this,new x(p,v),0,1)},n.exponentiatedBy=n.pow=function(p,v){var T,N,V,$,q,A,M,k,R,z=this;if(p=new x(p),p.c&&!p.isInteger())throw Error(Ct+"Exponent not an integer: "+ee(p));if(v!=null&&(v=new x(v)),A=p.e>14,!z.c||!z.c[0]||z.c[0]==1&&!z.e&&z.c.length==1||!p.c||!p.c[0])return R=new x(Math.pow(+ee(z),A?p.s*(2-wo(p)):+ee(p))),v?R.mod(v):R;if(M=p.s<0,v){if(v.c?!v.c[0]:!v.s)return new x(NaN);N=!M&&z.isInteger()&&v.isInteger(),N&&(z=z.mod(v))}else{if(p.e>9&&(z.e>0||z.e<-1||(z.e==0?z.c[0]>1||A&&z.c[1]>=24e7:z.c[0]<8e13||A&&z.c[0]<=9999975e7)))return $=z.s<0&&wo(p)?-0:0,z.e>-1&&($=1/$),new x(M?1/$:$);b&&($=vc(b/ye+2))}for(A?(T=new x(.5),M&&(p.s=1),k=wo(p)):(V=Math.abs(+ee(p)),k=V%2),R=new x(r);;){if(k){if(R=R.times(z),!R.c)break;$?R.c.length>$&&(R.c.length=$):N&&(R=R.mod(v))}if(V){if(V=Yt(V/2),V===0)break;k=V%2}else if(p=p.times(T),Q(p,p.e+1,1),p.e>14)k=wo(p);else{if(V=+ee(p),V===0)break;k=V%2}z=z.times(z),$?z.c&&z.c.length>$&&(z.c.length=$):N&&(z=z.mod(v))}return N?R:(M&&(R=r.div(R)),v?R.mod(v):$?Q(R,b,o,q):R)},n.integerValue=function(p){var v=new x(this);return p==null?p=o:De(p,0,8),Q(v,v.e+1,p)},n.isEqualTo=n.eq=function(p,v){return Qs(this,new x(p,v))===0},n.isFinite=function(){return!!this.c},n.isGreaterThan=n.gt=function(p,v){return Qs(this,new x(p,v))>0},n.isGreaterThanOrEqualTo=n.gte=function(p,v){return(v=Qs(this,new x(p,v)))===1||v===0},n.isInteger=function(){return!!this.c&&Xt(this.e/ye)>this.c.length-2},n.isLessThan=n.lt=function(p,v){return Qs(this,new x(p,v))<0},n.isLessThanOrEqualTo=n.lte=function(p,v){return(v=Qs(this,new x(p,v)))===-1||v===0},n.isNaN=function(){return!this.s},n.isNegative=function(){return this.s<0},n.isPositive=function(){return this.s>0},n.isZero=function(){return!!this.c&&this.c[0]==0},n.minus=function(p,v){var T,N,V,$,q=this,A=q.s;if(p=new x(p,v),v=p.s,!A||!v)return new x(NaN);if(A!=v)return p.s=-v,q.plus(p);var M=q.e/ye,k=p.e/ye,R=q.c,z=p.c;if(!M||!k){if(!R||!z)return R?(p.s=-v,p):new x(z?q:NaN);if(!R[0]||!z[0])return z[0]?(p.s=-v,p):new x(R[0]?q:o==3?-0:0)}if(M=Xt(M),k=Xt(k),R=R.slice(),A=M-k){for(($=A<0)?(A=-A,V=R):(k=M,V=z),V.reverse(),v=A;v--;V.push(0));V.reverse()}else for(N=($=(A=R.length)<(v=z.length))?A:v,A=v=0;v<N;v++)if(R[v]!=z[v]){$=R[v]<z[v];break}if($&&(V=R,R=z,z=V,p.s=-p.s),v=(N=z.length)-(T=R.length),v>0)for(;v--;R[T++]=0);for(v=fi-1;N>A;){if(R[--N]<z[N]){for(T=N;T&&!R[--T];R[T]=v);--R[T],R[N]+=fi}R[N]-=z[N]}for(;R[0]==0;R.splice(0,1),--k);return R[0]?U(p,R,k):(p.s=o==3?-1:1,p.c=[p.e=0],p)},n.modulo=n.mod=function(p,v){var T,N,V=this;return p=new x(p,v),!V.c||!p.s||p.c&&!p.c[0]?new x(NaN):!p.c||V.c&&!V.c[0]?new x(V):(y==9?(N=p.s,p.s=1,T=t(V,p,0,3),p.s=N,T.s*=N):T=t(V,p,0,y),p=V.minus(T.times(p)),!p.c[0]&&y==1&&(p.s=V.s),p)},n.multipliedBy=n.times=function(p,v){var T,N,V,$,q,A,M,k,R,z,Z,ne,de,ge,Ee,P=this,K=P.c,Me=(p=new x(p,v)).c;if(!K||!Me||!K[0]||!Me[0])return!P.s||!p.s||K&&!K[0]&&!Me||Me&&!Me[0]&&!K?p.c=p.e=p.s=null:(p.s*=P.s,!K||!Me?p.c=p.e=null:(p.c=[0],p.e=0)),p;for(N=Xt(P.e/ye)+Xt(p.e/ye),p.s*=P.s,M=K.length,z=Me.length,M<z&&(de=K,K=Me,Me=de,V=M,M=z,z=V),V=M+z,de=[];V--;de.push(0));for(ge=fi,Ee=ws,V=z;--V>=0;){for(T=0,Z=Me[V]%Ee,ne=Me[V]/Ee|0,q=M,$=V+q;$>V;)k=K[--q]%Ee,R=K[q]/Ee|0,A=ne*k+R*Z,k=Z*k+A%Ee*Ee+de[$]+T,T=(k/ge|0)+(A/Ee|0)+ne*R,de[$--]=k%ge;de[$]=T}return T?++N:de.splice(0,1),U(p,de,N)},n.negated=function(){var p=new x(this);return p.s=-p.s||null,p},n.plus=function(p,v){var T,N=this,V=N.s;if(p=new x(p,v),v=p.s,!V||!v)return new x(NaN);if(V!=v)return p.s=-v,N.minus(p);var $=N.e/ye,q=p.e/ye,A=N.c,M=p.c;if(!$||!q){if(!A||!M)return new x(V/0);if(!A[0]||!M[0])return M[0]?p:new x(A[0]?N:V*0)}if($=Xt($),q=Xt(q),A=A.slice(),V=$-q){for(V>0?(q=$,T=M):(V=-V,T=A),T.reverse();V--;T.push(0));T.reverse()}for(V=A.length,v=M.length,V-v<0&&(T=M,M=A,A=T,v=V),V=0;v;)V=(A[--v]=A[v]+M[v]+V)/fi|0,A[v]=fi===A[v]?0:A[v]%fi;return V&&(A=[V].concat(A),++q),U(p,A,q)},n.precision=n.sd=function(p,v){var T,N,V,$=this;if(p!=null&&p!==!!p)return De(p,1,tt),v==null?v=o:De(v,0,8),Q(new x($),p,v);if(!(T=$.c))return null;if(V=T.length-1,N=V*ye+1,V=T[V]){for(;V%10==0;V/=10,N--);for(V=T[0];V>=10;V/=10,N++);}return p&&$.e+1>N&&(N=$.e+1),N},n.shiftedBy=function(p){return De(p,-Ec,Ec),this.times("1e"+p)},n.squareRoot=n.sqrt=function(){var p,v,T,N,V,$=this,q=$.c,A=$.s,M=$.e,k=a+4,R=new x("0.5");if(A!==1||!q||!q[0])return new x(!A||A<0&&(!q||q[0])?NaN:q?$:1/0);if(A=Math.sqrt(+ee($)),A==0||A==1/0?(v=Zt(q),(v.length+M)%2==0&&(v+="0"),A=Math.sqrt(+v),M=Xt((M+1)/2)-(M<0||M%2),A==1/0?v="5e"+M:(v=A.toExponential(),v=v.slice(0,v.indexOf("e")+1)+M),T=new x(v)):T=new x(A+""),T.c[0]){for(M=T.e,A=M+k,A<3&&(A=0);;)if(V=T,T=R.times(V.plus(t($,V,k,1))),Zt(V.c).slice(0,A)===(v=Zt(T.c)).slice(0,A))if(T.e<M&&--A,v=v.slice(A-3,A+1),v=="9999"||!N&&v=="4999"){if(!N&&(Q(V,V.e+a+2,0),V.times(V).eq($))){T=V;break}k+=4,A+=4,N=1}else{(!+v||!+v.slice(1)&&v.charAt(0)=="5")&&(Q(T,T.e+a+2,1),p=!T.times(T).eq($));break}}return Q(T,T.e+a+1,o,p)},n.toExponential=function(p,v){return p!=null&&(De(p,0,tt),p++),D(this,p,v,1)},n.toFixed=function(p,v){return p!=null&&(De(p,0,tt),p=p+this.e+1),D(this,p,v)},n.toFormat=function(p,v,T){var N,V=this;if(T==null)p!=null&&v&&typeof v=="object"?(T=v,v=null):p&&typeof p=="object"?(T=p,p=v=null):T=S;else if(typeof T!="object")throw Error(Ct+"Argument not an object: "+T);if(N=V.toFixed(p,v),V.c){var $,q=N.split("."),A=+T.groupSize,M=+T.secondaryGroupSize,k=T.groupSeparator||"",R=q[0],z=q[1],Z=V.s<0,ne=Z?R.slice(1):R,de=ne.length;if(M&&($=A,A=M,M=$,de-=$),A>0&&de>0){for($=de%A||A,R=ne.substr(0,$);$<de;$+=A)R+=k+ne.substr($,A);M>0&&(R+=k+ne.slice($)),Z&&(R="-"+R)}N=z?R+(T.decimalSeparator||"")+((M=+T.fractionGroupSize)?z.replace(new RegExp("\\d{"+M+"}\\B","g"),"$&"+(T.fractionGroupSeparator||"")):z):R}return(T.prefix||"")+N+(T.suffix||"")},n.toFraction=function(p){var v,T,N,V,$,q,A,M,k,R,z,Z,ne=this,de=ne.c;if(p!=null&&(A=new x(p),!A.isInteger()&&(A.c||A.s!==1)||A.lt(r)))throw Error(Ct+"Argument "+(A.isInteger()?"out of range: ":"not an integer: ")+ee(A));if(!de)return new x(ne);for(v=new x(r),k=T=new x(r),N=M=new x(r),Z=Zt(de),$=v.e=Z.length-ne.e-1,v.c[0]=Tc[(q=$%ye)<0?ye+q:q],p=!p||A.comparedTo(v)>0?$>0?v:k:A,q=m,m=1/0,A=new x(Z),M.c[0]=0;R=t(A,v,0,1),V=T.plus(R.times(N)),V.comparedTo(p)!=1;)T=N,N=V,k=M.plus(R.times(V=k)),M=V,v=A.minus(R.times(V=v)),A=V;return V=t(p.minus(T),N,0,1),M=M.plus(V.times(k)),T=T.plus(V.times(N)),M.s=k.s=ne.s,$=$*2,z=t(k,N,$,o).minus(ne).abs().comparedTo(t(M,T,$,o).minus(ne).abs())<1?[k,N]:[M,T],m=q,z},n.toNumber=function(){return+ee(this)},n.toPrecision=function(p,v){return p!=null&&De(p,1,tt),D(this,p,v,2)},n.toString=function(p){var v,T=this,N=T.s,V=T.e;return V===null?N?(v="Infinity",N<0&&(v="-"+v)):v="NaN":(p==null?v=V<=u||V>=h?bo(Zt(T.c),V):Ji(Zt(T.c),V,"0"):p===10&&L?(T=Q(new x(T),a+V+1,o),v=Ji(Zt(T.c),T.e,"0")):(De(p,2,C.length,"Base"),v=i(Ji(Zt(T.c),V,"0"),10,p,N,!0)),N<0&&T.c[0]&&(v="-"+v)),v},n.valueOf=n.toJSON=function(){return ee(this)},n._isBigNumber=!0,n[Symbol.toStringTag]="BigNumber",n[Symbol.for("nodejs.util.inspect.custom")]=n.valueOf,e!=null&&x.set(e),x}function Xt(e){var t=e|0;return e>0||e===t?t:t-1}function Zt(e){for(var t,i,s=1,n=e.length,r=e[0]+"";s<n;){for(t=e[s++]+"",i=ye-t.length;i--;t="0"+t);r+=t}for(n=r.length;r.charCodeAt(--n)===48;);return r.slice(0,n+1||1)}function Qs(e,t){var i,s,n=e.c,r=t.c,a=e.s,o=t.s,u=e.e,h=t.e;if(!a||!o)return null;if(i=n&&!n[0],s=r&&!r[0],i||s)return i?s?0:-o:a;if(a!=o)return a;if(i=a<0,s=u==h,!n||!r)return s?0:!n^i?1:-1;if(!s)return u>h^i?1:-1;for(o=(u=n.length)<(h=r.length)?u:h,a=0;a<o;a++)if(n[a]!=r[a])return n[a]>r[a]^i?1:-1;return u==h?0:u>h^i?1:-1}function De(e,t,i,s){if(e<t||e>i||e!==Yt(e))throw Error(Ct+(s||"Argument")+(typeof e=="number"?e<t||e>i?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function wo(e){var t=e.c.length-1;return Xt(e.e/ye)==t&&e.c[t]%2!=0}function bo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Ji(e,t,i){var s,n;if(t<0){for(n=i+".";++t;n+=i);e=n+e}else if(s=e.length,++t>s){for(n=i,t-=s;--t;n+=i);e+=n}else t<s&&(e=e.slice(0,t)+"."+e.slice(t));return e}var X=df();class O extends Error{constructor(t){super(t),this.name="QtiEvaluationException"}}class ie{QTI_RESPONSE_RULES(){return["qti-response-processing-fragment","qti-response-condition","qti-set-outcome-value","qti-lookup-outcome-value","qti-get-outcome-value","qti-exit-response"]}QTI_TEMPLATE_RULES(){return["qti-set-template-value","qti-exit-template","qti-template-condition","qti-set-default-value","qti-set-correct-response","qti-template-constraint"]}QTI_EXPRESSIONS(){return["qti-base-value","qti-variable","qti-correct","qti-default","qti-is-null","qti-null","qti-and","qti-or","qti-not","qti-match","qti-map-response","qti-member","qti-subtract","qti-sum","qti-random","qti-random-float","qti-random-integer","qti-index","qti-integer-divide","qti-integer-modulus","qti-integer-to-float","qti-equal","qti-equal-rounded","qti-field-value","qti-multiple","qti-ordered","qti-map-response-point","qti-product","qti-delete","qti-string-match","qti-pattern-match","qti-substring","qti-round","qti-round-to","qti-truncate","qti-divide","qti-gt","qti-gte","qti-lt","qti-lte","qti-max","qti-min","qti-custom-operator","qti-math-operator","qti-math-constant","qti-repeat","qti-gcd","qti-lcm","qti-stats-operator","qti-power","qti-any-n","qti-test-variables"]}constructor(){}isExpressionNode(t){return this.QTI_EXPRESSIONS().includes(t)}isResponseRuleNode(t){return this.QTI_RESPONSE_RULES().includes(t)}isTemplateRuleNode(t){return this.QTI_TEMPLATE_RULES().includes(t)}nullValue(){return null}isNullValue(t){return typeof t>"u"||t===null}isBaseTypeNumeric(t){return t==="float"||t==="integer"}isSingleValuesMatch(t,i,s){if(this.isBaseTypeNumeric(t)){let n=new X(i),r=new X(s);return n.comparedTo(r)==0}return i===s}isMultipleValuesMatch(t,i,s){if(!Array.isArray(i)||!Array.isArray(s)||i.length!==s.length)return!1;const n=i.concat().sort(),r=s.concat().sort();if(this.isBaseTypeNumeric(t)){for(let a=0;a<n.length;a++)if(!this.isSingleValuesMatch(t,n[a],r[a]))return!1}else for(let a=0;a<n.length;a++)if(n[a]!==r[a])return!1;return!0}isOrderedValuesMatch(t,i,s){if(!Array.isArray(i)||!Array.isArray(s)||i.length!==s.length)return!1;if(this.isBaseTypeNumeric(t)){for(let n=0;n<i.length;n++)if(!this.isSingleValuesMatch(t,i[n],s[n]))return!1}else for(let n=0;n<i.length;n++)if(i[n]!==s[n])return!1;return!0}mapResponse(t){if(this.isNullValue(t.value))return t.mapping.getDefaultValue();const i=t.mapping.getValue(),s=i.length;if(t.cardinality==="single"){let n=this.isBaseTypeNumeric(t.baseType)?new X(t.value).toString():t.value;for(let r=0;r<s;r++){const a=i[r];if(this.isSingleValuesMatch("string",a.caseSensitive?a.mapKey:a.mapKey.toLowerCase(),a.caseSensitive?n:n.toLowerCase()))return t.mapping.applyConstraints(new X(a.mappedValue))}}else if(t.cardinality==="multiple"||t.cardinality==="ordered"){let n=new X(0),r=t.value;if(this.isBaseTypeNumeric(t.baseType))for(let a=0;a<r.length;a++)r[a]!==null&&(r[a]=new X(r[a]).toString());r=this.mappingEliminateNullsAndDuplicates(r);for(let a=0;a<s;a++){const o=i[a];for(let u=0;u<r.length;u++)this.isSingleValuesMatch("string",o.caseSensitive?o.mapKey:o.mapKey.toLowerCase(),o.caseSensitive?r[u]:r[u].toLowerCase())&&(n=n.plus(o.mappedValue))}return t.mapping.applyConstraints(n)}return t.mapping.getDefaultValue()}mappingEliminateNullsAndDuplicates(t){let i=t.length,s=[],n={};for(let r=0;r<i;r++)t[r]!==null&&(n[t[r]]=0);for(let r in n)s.push(r);return s}mapValueFromLookupTable(t,i){if(this.isNullValue(t.lookupTable))return this.nullValue();if(this.isNullValue(i))return t.lookupTable.getDefaultValue();const s=t.lookupTable.getValue(),n=t.lookupTable.getTableType();if(i=new X(i),n==="interpolation"){s.sort(function(r,a){return r.sourceValue-a.sourceValue});for(let r=0;r<s.length;r++){let a=s[r];const o=new X(a.sourceValue);if(i.comparedTo(o)<0||a.includeBoundary&&i.comparedTo(o)===0)return a.targetValue}}else if(n==="match"){i=new X(i);for(let r=0;r<s.length;r++){let a=s[r];const o=new X(a.sourceValue);if(i.comparedTo(o)===0)return a.targetValue}}return t.lookupTable.getDefaultValue()}shuffleArray(t){for(let i=t.length-1;i>0;i--){let s=Math.floor(Math.random()*(i+1)),n=t[i];t[i]=t[s],t[s]=n}}shuffleArrayFixed(t){for(let i=t.length-1;i>0;i--){let s=Math.floor(Math.random()*(i+1));if(t[i].fixed||t[s].fixed)continue;let n=t[i];t[i]=t[s],t[s]=n}}generalizedLcm(t,i){let s=i[0];for(let n=1;n<t;n++){if(s===0||i[n]===0)return 0;s=this.lcm(s,i[n])}return s}lcm(t,i){return new X(t).multipliedBy(i).dividedBy(this.gcd(t,i)).toNumber()}generalizedGcd(t,i){let s=i[0];for(let n=1;n<t;n++)s=this.gcd(s,i[n]);return s}gcd(t,i){return i=new X(i),i.isZero()?t:this.gcd(i.toNumber(),new X(t).modulo(i).toNumber())}getParametersFromDefinition(t){let i=new Map;if(typeof t>"u"||(t=t.trim(),t.length===0))return i;let s=t.split("|||");for(let n=0;n<s.length;n++){const r=s[n].split("=");i.set(r[0],r.length<2?"":r[1].replaceAll("=","="))}return i}computeWordCount(t){const i=t.match(/\S+/g);return i===null?0:i.length}valueToPciJson(t,i,s){return t===null?{base:null}:s==="single"?{base:this.baseValueToPciJson(t,i)}:s==="multiple"||s==="ordered"?{list:this.baseValueToPciJson(t,i)}:s==="record"?{record:this.recordValueToPciJson(t)}:{base:null}}baseValueToPciJson(t,i){let s={};switch(i){case"string":case"identifier":case"integer":case"float":case"duration":case"boolean":case"point":case"directedPair":case"pair":case"uri":case"file":return s[i]=t,s;case"intOrIdentifier":return s[i]=null,s;default:return s[i]=null,s}}recordValueToPciJson(t){let i=[];for(let s of t.values())i.push({name:s.fieldIdentifier,base:s.value===null?null:this.valueToPciJson(s.value,s.baseType,s.cardinality)});return i}processInteractionResponse(t,i){return t.interactionType==="PortableCustom"?this.getValueFromPciJson(t.node.getResponse(),i):t.node.getResponse()}getValueFromPciJson(t,i){if(console.log("[GetValueFromPciJson][Value]",t,i),t===null||typeof i>"u")return this.nullValue();try{if(typeof t!="object")throw new O("Improper value encoding. Must be an Object.");if(Array.isArray(t))throw new O("Improper value encoding. Found Array. Must be an Object.");if(t.base!==void 0){if(i.cardinality==="single")return this.baseValueFromPciJson(t.base,i.baseType);throw new O("Inconsistent value cardinality [base] for this variable. Variable must be single cardinality.")}if(t.list!==void 0){if(i.cardinality==="multiple"||i.cardinality==="ordered")return this.baseValueFromPciJson(t.list,i.baseType);throw new O("Inconsistent value cardinality [list] for this variable. Variable must be multiple or ordered cardinality.")}if(t.record!==void 0){if(i.cardinality==="record")return this.recordValueFromPciJson(t.record,i);throw new O("Inconsistent value cardinality [record] for this variable. Variable must be record cardinality.")}throw new O('Improper value encoding. Must be one of "base", "list", "record".')}catch({name:s,message:n}){return console.log("[PciDecodingException][ValueFromJson] ",n),this.nullValue()}}baseValueFromPciJson(t,i){if(t===null)return this.nullValue();try{if(typeof t!="object")throw new O("Invalid value. Must be an Object.");if(Array.isArray(t))throw new O("Invalid value. Found Array. Must be an Object.");if(t[i]!==void 0)return t[i];throw new O(`Value does not have the required base-type. Expecting ${i}.`)}catch({name:s,message:n}){return console.log("[PciDecodingException][BaseValueFromJson] ",n,t),this.nullValue()}}recordValueFromPciJson(t,i){try{let s=this.getRecordVariableFieldDefinition(i);if(s===null)throw new O(`Unable to retrieve ${i.identifier} record field definition.`);if(typeof t!="object")throw new O("Improper record value encoding. Must be an Array.");if(!Array.isArray(t))throw new O("Improper record value encoding. Must be an Array.");const n=new Map;for(let[r,a]of s)for(let o=0;o<t.length;o++)if(t[o].name!==void 0&&t[o].base!==void 0&&t[o].name===r){const u=this.baseValueFromPciJson(t[o].base,a.getBaseType()),h=new Xe(r,a.getBaseType(),u);n.set(r,h);break}return n}catch({name:s,message:n}){return console.log("[VariableDecodingException][RecordValueFromJson] ",n),new Map}}getRecordVariableFieldDefinition(t){return t==null?null:t.defaultValue!==null?t.defaultValue:t.correctResponse}computeProcessingContext(t){return this.computeProcessingType(t)==="OUTCOME"?"TEST":"ITEM"}computeProcessingType(t){return t===null?"UNKNOWN":t.$options.name==="QtiOutcomeProcessing"?"OUTCOME":t.$options.name==="QtiResponseProcessing"?"RESPONSE":t.$options.name==="QtiTemplateProcessing"?"TEMPLATE":t.$options.name==="QtiBranchRule"?"OUTCOME":this.computeProcessingType(t.$parent)}computeNodeContext(t){return t===null||t.$options.name==="QtiAssessmentItem"?"ITEM":t.$options.name==="QtiAssessmentTest"?"TEST":this.computeNodeContext(t.$parent)}base64ToBytes(t){const i=atob(t);return Uint8Array.from(i,s=>s.codePointAt(0))}bytesToBase64(t){const i=Array.from(t,s=>String.fromCodePoint(s)).join("");return btoa(i)}encodeBytesToBase64(t){const i=new TextEncoder;return this.bytesToBase64(i.encode(t))}decodeBase64ToBytes(t){return new TextDecoder().decode(this.base64ToBytes(t))}}const Hb=new ie,_={player:null,state:{item:null,itemBody:null,identifier:"",title:"",responseDeclarations:[],outcomeDeclarations:[],templateDeclarations:[],contextDeclarations:[],stimulusRefs:[],interactions:[],processing:[],feedbacks:[],templates:[],printedVariables:[],catalogs:[],scoringRubricBlocks:[],asyncStateMap:new Map},itemContext:{guid:null,pnp:null,sc:null,state:null,validationMessages:[],lifecycleStatus:null},itemTimer:new Db,pciContext:{renderer2p0:"assets/pci/pci.html"},pciMessageHandler:null,windowResizeHandler:null,getResponseDeclarations(){return this.state.responseDeclarations},getResponseDeclaration(e){return this.state.responseDeclarations.find(t=>t.identifier===e)},getOutcomeDeclarations(){return this.state.outcomeDeclarations},getOutcomeDeclaration(e){return this.state.outcomeDeclarations.find(t=>t.identifier===e)},getTemplateDeclarations(){return this.state.templateDeclarations},getTemplateMathParameterVariables(){return this.state.templateDeclarations.filter(e=>e.mathVariable===!0)},getTemplateDeclaration(e){return this.state.templateDeclarations.find(t=>t.identifier===e)},getContextDeclarations(){return this.state.contextDeclarations},getContextDeclaration(e){return this.state.contextDeclarations.find(t=>t.identifier===e)},getStimulusRefs(){return this.state.stimulusRefs},getStimulusRef(e){return this.state.stimulusRefs.find(t=>t.identifier===e)},getVariableDeclaration(e){let t=this.state.outcomeDeclarations.find(i=>i.identifier===e);return typeof t<"u"||(t=this.state.responseDeclarations.find(i=>i.identifier===e),typeof t<"u")||(t=this.state.templateDeclarations.find(i=>i.identifier===e),typeof t<"u")||(t=this.state.contextDeclarations.find(i=>i.identifier===e),typeof t<"u")?t:null},getInteraction(e){return this.state.interactions.find(t=>t.identifier===e)},getInteractions(){return this.state.interactions},getProcessing(e){return this.state.processing.find(t=>t.processingType===e)},getFeedbacks(){return this.state.feedbacks},getTemplates(){return this.state.templates},getPrintedVariables(){return this.state.printedVariables},getCatalog(e){return this.state.catalogs.find(t=>t.id===e)},getCatalogs(){return this.state.catalogs},getScoringRubricBlocks(){return this.state.scoringRubricBlocks},getItem(){return this.state.item},setItem(e){this.state.item=e.item},getItemBody(){return this.state.itemBody},setItemBody(e){this.state.itemBody=e},defineResponseDeclaration(e){let t=this.state.responseDeclarations.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.responseDeclarations[t]=e:this.state.responseDeclarations.push(e)},defineOutcomeDeclaration(e){let t=this.state.outcomeDeclarations.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.outcomeDeclarations[t]=e:this.state.outcomeDeclarations.push(e)},defineTemplateDeclaration(e){let t=this.state.templateDeclarations.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.templateDeclarations[t]=e:this.state.templateDeclarations.push(e)},defineContextDeclaration(e){let t=this.state.contextDeclarations.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.contextDeclarations[t]=e:this.state.contextDeclarations.push(e)},defineStimulusRef(e){let t=this.state.stimulusRefs.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.stimulusRefs[t]=e:this.state.stimulusRefs.push(e)},defineInteraction(e){let t=this.state.interactions.findIndex(s=>s.identifier==e.identifier);if(t<0){console.log("[DefineInteraction]["+e.identifier+"]"),this.state.interactions.push(e);return}let i=this.state.interactions[t];i.interactionType=e.interactionType,i.isValidResponse=e.isValidResponse,i.invalidResponseMessage=e.invalidResponseMessage,i.maxSelectionsMessage=e.maxSelectionsMessage,i.node=e.node,i.resetValue=e.resetValue},defineProcessing(e){let t=e.processingType,i=this.state.processing.findIndex(s=>s.processingType==t);i>-1?this.state.processing[i]=e:this.state.processing.push(e),t=="response"?console.log("[QtiResponseProcessing][Defined]",e):t=="template"?console.log("[QtiTemplateProcessing][Defined]",e):t=="outcome"&&console.log("[QtiOutcomeProcessing][Defined]",e)},defineResponseProcessing(e){this.defineProcessing({processingType:"response",node:e.node})},defineTemplateProcessing(e){this.defineProcessing({processingType:"template",node:e.node})},defineItemBody(e){this.setItemBody(e.node)},defineFeedback(e){this.state.feedbacks.push(e),console.log("[DefineFeedback]["+e.outcomeIdentifier+"]["+e.identifier+"]")},defineTemplate(e){this.state.templates.push(e)},definePrintedVariable(e){this.state.printedVariables.push(e)},defineCatalog(e){let t=this.state.catalogs.findIndex(i=>i.id==e.id);if(t<0){this.state.catalogs.push(e);return}this.state.catalogs[t]=e},defineScoringRubricBlock(e){this.state.scoringRubricBlocks.push(e)},resetAll(){this.state.item=null,this.state.itemBody=null,this.state.identifier="",this.state.title="",this.state.responseDeclarations.splice(0,this.state.responseDeclarations.length),this.state.outcomeDeclarations.splice(0,this.state.outcomeDeclarations.length),this.state.templateDeclarations.splice(0,this.state.templateDeclarations.length),this.state.contextDeclarations.splice(0,this.state.contextDeclarations.length),this.state.stimulusRefs.splice(0,this.state.stimulusRefs.length),this.state.interactions.splice(0,this.state.interactions.length),this.state.processing.splice(0,this.state.processing.length),this.state.feedbacks.splice(0,this.state.feedbacks.length),this.state.templates.splice(0,this.state.templates.length),this.state.printedVariables.splice(0,this.state.printedVariables.length),this.state.catalogs.splice(0,this.state.catalogs.length),this.state.scoringRubricBlocks.splice(0,this.state.scoringRubricBlocks.length),this.state.asyncStateMap.clear(),this.resetItemTimer(),this.itemContext.guid=null,this.itemContext.state=null,this.itemContext.validationMessages.splice(0,this.itemContext.validationMessages.length),this.itemContext.lifecycleStatus=null},initializeBuiltInDeclarations(){function e(){return 0}const t=new Map;t.set("candidateIdentifier",new Xe("candidateIdentifier","string",null)),t.set("testIdentifier",new Xe("testIdentifier","string",null)),t.set("environmentIdentifier",new Xe("environmentIdentifier","string",null)),this.defineContextDeclaration({identifier:"QTI_CONTEXT",baseType:null,cardinality:"record",value:t,defaultValue:t}),console.log("[QtiAssessmentItem][QTI_CONTEXT] initialized"),this.defineOutcomeDeclaration({identifier:"SCORE",baseType:"float",cardinality:"single",value:0,defaultValue:0,lookupTable:null,lookupTableType:null,view:null,interpretation:null,longInterpretation:null,normalMaximum:null,normalMinimum:null,masteryValue:null,externalScored:null,variableIdentifierRef:null}),console.log("[QtiAssessmentItem][SCORE] initialized"),this.defineOutcomeDeclaration({identifier:"MAXSCORE",baseType:"float",cardinality:"single",value:0,defaultValue:0,lookupTable:null,lookupTableType:null,view:null,interpretation:null,longInterpretation:null,normalMaximum:null,normalMinimum:null,masteryValue:null,externalScored:null,variableIdentifierRef:null}),console.log("[QtiAssessmentItem][MAXSCORE] initialized"),this.defineOutcomeDeclaration({identifier:"completionStatus",baseType:"identifier",cardinality:"single",value:"not_attempted",defaultValue:"not_attempted",lookupTable:null,lookupTableType:null,normalMaximum:null,normalMinimum:null,externalScored:null,interpretation:null}),console.log("[QtiAssessmentItem][completionStatus] initialized"),this.defineResponseDeclaration({identifier:"numAttempts",baseType:"integer",cardinality:"single",value:0,resetValue:e,defaultValue:0,state:null}),console.log("[QtiAssessmentItem][numAttempts] initialized"),this.defineResponseDeclaration({identifier:"duration",baseType:"duration",cardinality:"single",value:0,resetValue:e,defaultValue:0,state:null}),console.log("[QtiAssessmentItem][duration] initialized")},restoreContextVariables(){if(!this.hasItemContextState())return null;const e=this.getItemContextState();"contextVariables"in e&&e.contextVariables!==null&&e.contextVariables.forEach(t=>{let i=this.state.contextDeclarations.findIndex(s=>s.identifier==t.identifier);i<0||(this.state.contextDeclarations[i].value=t.value)},this)},restoreOutcomeVariables(){if(!this.hasItemContextState())return null;const e=this.getItemContextState();"outcomeVariables"in e&&e.outcomeVariables!==null&&e.outcomeVariables.forEach(t=>{this.setOutcomeVariableValue({identifier:t.identifier,value:t.value})},this)},setOutcomeVariableValue(e){let t=this.state.outcomeDeclarations.findIndex(i=>i.identifier==e.identifier);t<0||(this.state.outcomeDeclarations[t].value=e.value)},resetOutcomeVariableValue(e){let t=this.state.outcomeDeclarations.findIndex(s=>s.identifier==e.identifier);if(t<0)return;let i=this.state.outcomeDeclarations[t];if(i.defaultValue!==null){i.value=this.defaultValue;return}if(i.cardinality==="record"||i.cardinality==="multiple"||i.cardinality==="ordered"){i.value=null;return}if(i.baseType==="integer"||i.baseType==="float"){i.value=0;return}i.value=null},getResponseVariableCorrectResponse(e){let t=this.state.responseDeclarations.findIndex(i=>i.identifier==e);return t<0?null:this.state.responseDeclarations[t].correctResponse},setResponseVariableCorrectResponse(e){let t=this.state.responseDeclarations.findIndex(s=>s.identifier==e.identifier);if(t<0)return;let i=this.state.responseDeclarations[t];i.correctResponse=e.value},setInteractionIsValidResponse(e){let t=this.state.interactions.findIndex(i=>i.identifier==e.identifier);t<0||(this.state.interactions[t].isValidResponse=e.isValidResponse)},resetInteractionStateIsValidResponse(){this.state.interactions.forEach(e=>{e.interactionType!=="EndAttemptInteraction"&&(e.isValidResponse=!1)})},restoreResponseVariables(){if(!this.hasItemContextState())return null;const e=this.getItemContextState();"responseVariables"in e&&e.responseVariables!==null&&e.responseVariables.forEach(t=>{this.setResponseVariableValue({identifier:t.identifier,value:t.value,state:t.state}),"correctResponse"in t&&this.setResponseVariableCorrectResponse({identifier:t.identifier,value:t.correctResponse})},this)},setResponseVariableValue(e){let t=this.state.responseDeclarations.findIndex(s=>s.identifier==e.identifier);if(t<0)return;let i=this.state.responseDeclarations[t];i.value=e.value,i.state=e.state},resetResponseVariableValue(e){let t=this.state.responseDeclarations.findIndex(s=>s.identifier==e.identifier);if(t<0)return;let i=this.state.responseDeclarations[t];i.value=i.defaultValue!==null?i.defaultValue:null},incrementNumAttempts(){let e=this.state.responseDeclarations.findIndex(t=>t.identifier=="numAttempts");this.state.responseDeclarations[e].value+=1},updateItemDuration(){const e=this.getResponseDeclaration("duration");e.value+=this.itemTimer.getTime(),this.restartItemTimer()},restartItemTimer(){this.itemTimer.startTimer()},resetItemTimer(){this.itemTimer.resetTimer()},setTemplateVariableValue(e){let t=this.state.templateDeclarations.findIndex(i=>i.identifier==e.identifier);t<0||(this.state.templateDeclarations[t].value=e.value)},resetTemplateVariables(){this.state.templateDeclarations.forEach(e=>{e.node.reset()})},setVariableDefaultValue(e){let t=this.state.responseDeclarations.findIndex(i=>i.identifier==e.identifier);if(t>-1){let i=this.state.responseDeclarations[t];i.defaultValue=e.value;return}if(t=this.state.outcomeDeclarations.findIndex(i=>i.identifier==e.identifier),t>-1){let i=this.state.responseDeclarations[t];i.defaultValue=e.value;return}},getPciContext(){return this.pciContext},setPciContext(e){this.pciContext=e},getPciContextRenderer(){return this.pciContext.renderer2p0},setPciContextRenderer(e){this.pciContext.renderer2p0=e},initializePciMessageListener(){this.pciMessageHandler=this.PciMessageListener.bind(this),this.windowResizeHandler=this.WindowResize.bind(this),window.addEventListener("message",this.pciMessageHandler),window.addEventListener("resize",this.windowResizeHandler)},removePciMessageListener(){this.pciMessageHandler!==null&&window.removeEventListener("message",this.pciMessageHandler),this.windowResizeHandler!==null&&window.removeEventListener("resize",this.windowResizeHandler)},PciMessageListener(e){switch(e.data.message){case"PciChildLoaded":console.log("[PCI Parent] PCI Frame Loaded: "+e.data.identifier),this.pciInitialize(e.data.identifier);break;case"PciReady":console.log("[PCI Parent] PCI Ready: "+e.data.identifier+", height: "+e.data.height+", width: "+e.data.width),this.pciReady(e.data.identifier),this.pciResizeIframe(e.data.identifier,e.data.height,e.data.width,!0);break;case"PciResize":console.log("[PCI Parent] PCI Resize: "+e.data.identifier+", height: "+e.data.height+", width: "+e.data.width),this.pciResizeIframe(e.data.identifier,e.data.height,e.data.width,!1);break;case"PciGetState_Reply":console.log("[PCI Parent] PCI GetState Reply: "+e.data.identifier+", state:",e.data.state),this.pciSaveState(e.data.identifier,e.data.state);break}},WindowResize(){this.getInteractions().forEach(e=>{e.interactionType==="PortableCustom"&&e.node.pciResizeIframeWidthToContainer()})},pciInitialize(e){let t=_.getInteraction(e);typeof t>"u"||t.interactionType!=="PortableCustom"||t.node.pciInitialize()},pciReady(e){let t=_.getInteraction(e);typeof t>"u"||t.interactionType!=="PortableCustom"||t.node.pciSetReady()},pciResizeIframe(e,t,i,s){let n=_.getInteraction(e);typeof n>"u"||n.interactionType!=="PortableCustom"||(s?n.node.pciResizeIframe(t,n.node.initialWidth):n.node.pciResizeIframe(t,i))},pciSaveState(e,t){let i=_.getInteraction(e);typeof i>"u"||i.interactionType!=="PortableCustom"||i.node.pciSaveState(t)},getAsyncStateMap(){return this.state.asyncStateMap},getItemContextGuid(){return this.itemContext.guid},setItemContextGuid(e){this.itemContext.guid=e},initializeItemContextPnp(){this.itemContext.pnp=new Ds},getItemContextPnp(){return this.itemContext.pnp},setItemContextPnp(e){this.itemContext.pnp===null&&this.initializeItemContextPnp(),this.itemContext.pnp.setPnp(e)},initializeItemContextSessionControl(){this.itemContext.sc=new Pb},getItemContextSessionControl(){return this.itemContext.sc},setItemContextSessionControl(e){this.itemContext.sc===null&&this.initializeItemContextSessionControl(),this.itemContext.sc.setSessionControl(e)},getItemContextState(){return this.itemContext.state},setItemContextState(e){const t=new bc,i=e===null?e:t.createStateFromState(e);this.itemContext.state=i},getItemContextStateVariable(e){if(!this.hasItemContextState())return null;const t=this.getItemContextState();let i=t.outcomeVariables.find(s=>s.identifier===e);return typeof i<"u"||(i=t.responseVariables.find(s=>s.identifier===e),typeof i<"u")||(i=t.templateVariables.find(s=>s.identifier===e),typeof i<"u")||(i=t.contextDeclarations.find(s=>s.identifier===e),typeof i<"u")?i:null},hasItemContextState(){return this.getItemContextState()!==null},getItemContextValidationMessages(){return this.itemContext.validationMessages},addItemContextValidationMessage(e){this.itemContext.validationMessages.push(e)},resetItemContextValidationMessages(){this.itemContext.validationMessages.splice(0,this.itemContext.validationMessages.length)},getItemLifecycleStatus(){return this.lifecycleStatus},setItemLifecycleStatus(e){this.lifecycleStatus=e},NotifyPlayerReady(e){this.player=e.player},NotifyEndAttempt(e){this.state.item.endAttempt(e,(function(){this.state.item.notifyEndAttemptInteractionResults("itemEndAttemptReady")}).bind(this))},NotifyNewTemplate(e){this.state.item.newTemplate(e)},NotifyItemReady(e){this.setItem(e),this.getItem().isAdaptive||this.restartItemTimer(),this.getItem().isAdaptiveItemCompleted()||this.restartItemTimer()},NotifyInteractionSelectionsLimit(e){const t={icon:"warning",message:e};this.player.displayAlertMessage(t)},NotifyInteractionStateReady(e){console.log("[InteractionStateReady][Interaction]",e.identifier);const t=this.getInteraction(e.identifier);typeof t>"u"||typeof this.getAsyncStateMap().get(t.identifier)>"u"||(this.setResponseVariableValue({identifier:t.identifier,value:Hb.processInteractionResponse(t,this.getResponseDeclaration(t.identifier)),state:t.node.getState()}),this.getAsyncStateMap().delete(t.identifier),this.getAsyncStateMap().size===0&&this.getItem().triggerGetResponsesComplete())}},it={player:null,state:{test:null,identifier:"",title:"",responseDeclarations:[],contextDeclarations:[],outcomeDeclarations:[],timeLimit:null,testParts:[],outcomeProcessing:null,feedbacks:[],printedVariables:[],catalogs:[],scoringRubricBlocks:[]},testContext:{guid:null,pnp:null},sectionItemStates:new Map,getTest(){return this.state.test},setTest(e){this.state.test=e.test},getResponseDeclarations(){return this.state.responseDeclarations},getResponseDeclaration(e){return this.state.responseDeclarations.find(t=>t.identifier===e)},getOutcomeDeclarations(){return this.state.outcomeDeclarations},getOutcomeDeclaration(e){return this.state.outcomeDeclarations.find(t=>t.identifier===e)},getContextDeclarations(){return this.state.contextDeclarations},getContextDeclaration(e){return this.state.contextDeclarations.find(t=>t.identifier===e)},getVariableDeclaration(e){let t=this.state.outcomeDeclarations.find(i=>i.identifier===e);return typeof t<"u"||(t=this.state.contextDeclarations.find(i=>i.identifier===e),typeof t<"u")||(t=this.state.responseDeclarations.find(i=>i.identifier===e),typeof t<"u")?t:null},getTimeLimit(){return this.timeLimit},getTestParts(){return this.state.testParts},getTestPart(e){return this.state.testParts.find(t=>t.identifier===e)},getOutcomeProcessing(){return this.state.outcomeProcessing},getFeedbacks(){return this.state.feedbacks},getPrintedVariables(){return this.state.printedVariables},getCatalog(e){return this.state.catalogs.find(t=>t.id===e)},getCatalogs(){return this.state.catalogs},getScoringRubricBlocks(){return this.state.scoringRubricBlocks},defineContextDeclaration(e){let t=this.state.contextDeclarations.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.contextDeclarations[t]=e:this.state.contextDeclarations.push(e)},defineResponseDeclaration(e){let t=this.state.responseDeclarations.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.responseDeclarations[t]=e:this.state.responseDeclarations.push(e)},defineOutcomeDeclaration(e){let t=this.state.outcomeDeclarations.findIndex(i=>i.identifier==e.identifier);t>-1?this.state.outcomeDeclarations[t]=e:this.state.outcomeDeclarations.push(e)},defineTimeLimit(e){this.state.timeLimit=e.node},defineTestPart(e){let t=this.state.testParts.findIndex(i=>i.identifier==e.identifier);if(t<0){this.state.testParts.push(e.testPart);return}this.state.testParts[t]=e.testPart},defineProcessing(e){this.state.processing=e,console.log("[QtiOutcomeProcessing][Defined]",e)},defineOutcomeProcessing(e){const t={processingType:"outcome",node:e.node};this.state.outcomeProcessing=t,console.log("[QtiOutcomeProcessing][Defined]",t)},defineFeedback(e){this.state.feedbacks.push(e),console.log("[DefineFeedback]["+e.outcomeIdentifier+"]["+e.identifier+"]")},definePrintedVariable(e){this.state.printedVariables.push(e)},defineCatalog(e){let t=this.state.catalogs.findIndex(i=>i.id==e.id);if(t<0){this.state.catalogs.push(e);return}this.state.catalogs[t]=e},defineScoringRubricBlock(e){this.state.scoringRubricBlocks.push(e)},resetAll(){this.state.test=null,this.state.identifier="",this.state.title="",this.state.responseDeclarations.splice(0,this.state.responseDeclarations.length),this.state.outcomeDeclarations.splice(0,this.state.outcomeDeclarations.length),this.state.contextDeclarations.splice(0,this.state.contextDeclarations.length),this.state.timeLimit=null,this.state.testParts.splice(0,this.state.testParts.length),this.state.outcomeProcessing=null,this.state.feedbacks.splice(0,this.state.feedbacks.length),this.state.printedVariables.splice(0,this.state.printedVariables.length),this.state.catalogs.splice(0,this.state.catalogs.length),this.state.scoringRubricBlocks.splice(0,this.state.scoringRubricBlocks.length),this.testContext.guid=null,this.testContext.state=null},initializeBuiltInDeclarations(){function e(){return 0}const t=new Map;t.set("candidateIdentifier",new Xe("candidateIdentifier","string",null)),t.set("testIdentifier",new Xe("testIdentifier","string",null)),t.set("environmentIdentifier",new Xe("environmentIdentifier","string",null)),this.defineContextDeclaration({identifier:"QTI_CONTEXT",baseType:null,cardinality:"record",value:t,defaultValue:t}),console.log("[QtiAssessmentTest][QTI_CONTEXT] initialized"),this.defineResponseDeclaration({identifier:"duration",baseType:"duration",cardinality:"single",value:0,resetValue:e,defaultValue:0,state:null}),console.log("[QtiAssessmentTest][duration] initialized")},setOutcomeVariableValue(e){let t=this.state.outcomeDeclarations.findIndex(i=>i.identifier==e.identifier);t<0||(this.state.outcomeDeclarations[t].value=e.value)},resetOutcomeVariableValue(e){let t=this.state.outcomeDeclarations.findIndex(s=>s.identifier==e.identifier);if(t<0)return;let i=this.state.outcomeDeclarations[t];if(i.defaultValue!==null){i.value=this.defaultValue;return}if(i.cardinality==="record"||i.cardinality==="multiple"||i.cardinality==="ordered"){i.value=null;return}if(i.baseType==="integer"||i.baseType==="float"){i.value=0;return}i.value=null},getTestContextGuid(){return this.testContext.guid},setTestContextGuid(e){this.testContext.guid=e},initializeTestContextPnp(){this.testContext.pnp=new Ds},getTestContextPnp(){return this.testContext.pnp},setTestContextPnp(e){this.testContext.pnp===null&&this.initializeTestContextPnp(),this.testContext.pnp.setPnp(e)},getAllTestStateItemStatesMap(){return this.sectionItemStates},setTestStateItemState(e,t,i,s){console.log("[TestStore][SetState][Part:"+e+"][Section:"+t+"][Item:"+i+"]",s);const n=`${e}~~${t}`;let r=this.getItemStateMapBySectionIdentifier(n);r!=null&&r.set(i,s)},getItemStateMapBySectionIdentifier(e){return this.sectionItemStates.has(e)?this.sectionItemStates.get(e):this.initializePartSectionItemStateMap(e)},getPartSectionMapBySectionIdentifier(e){for(let[t,i]of this.sectionItemStates)if(t.endsWith(e))return i;return null},initializePartSectionItemStateMap(e){return this.sectionItemStates.set(e,new Map),this.sectionItemStates.get(e)},findItemVariableValueByIdentifier(e,t){const i=this.findVariableByIdentifier(e.contextVariables,t);if(typeof i<"u")return i;const s=this.findVariableByIdentifier(e.outcomeVariables,t);if(typeof s<"u")return s;const n=this.findVariableByIdentifier(e.responseVariables,t);if(typeof n<"u")return n;const r=this.findVariableByIdentifier(e.templateVariables,t);return typeof r<"u"?r:null},findVariableByIdentifier(e,t){return e.find(i=>i.identifier===t)},getSerializedState(){return{contextVariables:this.serializeVariables(this.getContextDeclarations()),outcomeVariables:this.serializeVariables(this.getOutcomeDeclarations())}},serializeVariables(e){let t=[];return e.forEach(i=>{t.push({identifier:i.identifier,cardinality:i.cardinality,baseType:i.baseType,value:this.serializeVariableValue(i.cardinality,i.value)})}),t},serializeVariableValue(e,t){return e!=="record"?JSON.parse(JSON.stringify(t)):this.serializeRecordVariableValue(t)},serializeVariableState(e){return JSON.parse(JSON.stringify(e))},serializeRecordVariableValue(e){const t=this.strMapToJson(e);return this.jsonToStrMap(t)},strMapToJson(e){return JSON.stringify(this.strMapToObj(e))},jsonToStrMap(e){return this.objToStrMap(JSON.parse(e))},strMapToObj(e){let t=Object.create(null);for(let[i,s]of e)t[i]=s;return t},objToStrMap(e){let t=new Map;for(let i of Object.keys(e))t.set(i,e[i]);return t},NotifyTestPlayerReady(e){this.player=e.player},NotifyTestReady(e){this.setTest(e)}};class Fb{constructor(){J(this,"xmlDeclaration",null);J(this,"rxTrackSource",null);this.xmlDeclaration=new RegExp(/<\?xml.*?\?>/s),this.rxTrackSource=new RegExp(/<(track|source)[^>]+?\/>/g)}filterXmlDeclaration(t){return t.replace(this.xmlDeclaration,"")}filterCdata(t){return t.replaceAll("<![CDATA[","").replaceAll("]]>","")}filterStyle(t){return t.replaceAll("<style>","<amp-style>").replaceAll("</style>","</amp-style>")}filterMedia(t){return t=t.replaceAll("<video>","<amp-video>").replaceAll("<video ","<amp-video ").replaceAll("</video>","</amp-video>").replaceAll("<audio>","<amp-audio>").replaceAll("<audio ","<amp-audio ").replaceAll("</audio>","</amp-audio>"),this.filterTrackSource(t)}filterTrackSource(t){return t.replace(this.rxTrackSource,i=>i.replace(/\/>/g,">"))}}/*!
|
2
2
|
* sweetalert2 v11.14.0
|
3
3
|
* Released under the MIT License.
|
4
4
|
*/function ff(e,t,i){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:i;throw new TypeError("Private element is not present on this object")}function Ub(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pf(e,t){return e.get(ff(e,t))}function Gb(e,t,i){Ub(e,t),t.set(e,i)}function jb(e,t,i){return e.set(ff(e,t),i),i}const Wb=100,he={},zb=()=>{he.previousActiveElement instanceof HTMLElement?(he.previousActiveElement.focus(),he.previousActiveElement=null):document.body&&document.body.focus()},Kb=e=>new Promise(t=>{if(!e)return t();const i=window.scrollX,s=window.scrollY;he.restoreFocusTimeout=setTimeout(()=>{zb(),t()},Wb),window.scrollTo(i,s)}),mf="swal2-",H=["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","show","hide","close","title","html-container","actions","confirm","deny","cancel","default-outline","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","input-label","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loader","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error"].reduce((e,t)=>(e[t]=mf+t,e),{}),vo=["success","warning","info","question","error"].reduce((e,t)=>(e[t]=mf+t,e),{}),gf="SweetAlert2:",Cc=e=>e.charAt(0).toUpperCase()+e.slice(1),St=e=>{console.warn(`${gf} ${typeof e=="object"?e.join(" "):e}`)},Hs=e=>{console.error(`${gf} ${e}`)},yf=[],Yb=e=>{yf.includes(e)||(yf.push(e),St(e))},wf=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;Yb(`"${e}" is deprecated and will be removed in the next major release.${t?` Use "${t}" instead.`:""}`)},Eo=e=>typeof e=="function"?e():e,Sc=e=>e&&typeof e.toPromise=="function",Mr=e=>Sc(e)?e.toPromise():Promise.resolve(e),xc=e=>e&&Promise.resolve(e)===e,xt=()=>document.body.querySelector(`.${H.container}`),Nr=e=>{const t=xt();return t?t.querySelector(e):null},Bt=e=>Nr(`.${e}`),Le=()=>Bt(H.popup),Rr=()=>Bt(H.icon),Xb=()=>Bt(H["icon-content"]),bf=()=>Bt(H.title),_c=()=>Bt(H["html-container"]),vf=()=>Bt(H.image),Ic=()=>Bt(H["progress-steps"]),To=()=>Bt(H["validation-message"]),Li=()=>Nr(`.${H.actions} .${H.confirm}`),_n=()=>Nr(`.${H.actions} .${H.cancel}`),Fs=()=>Nr(`.${H.actions} .${H.deny}`),Zb=()=>Bt(H["input-label"]),In=()=>Nr(`.${H.loader}`),kr=()=>Bt(H.actions),Ef=()=>Bt(H.footer),Co=()=>Bt(H["timer-progress-bar"]),Vc=()=>Bt(H.close),Jb=`
|
@@ -79,12 +79,12 @@ https://sweetalert2.github.io/#ajax-request`),g0(e),typeof e.title=="string"&&(e
|
|
79
79
|
role="tabpanel"
|
80
80
|
class="${n===-1?"hidden":""}"
|
81
81
|
id="${i}"
|
82
|
-
aria-labelledby="${t}">${s}</div>`}createIds(){const t={tabWrapperId:"",tabIds:[],tabPanelIds:[]};t.tabWrapperId="catalog-tabwrapper-"+this.randomString(5,"a");for(let i=0;i<3;i++){const s=this.randomString(5,"a");t.tabIds.push("catalog-"+i+"-tab-"+s),t.tabPanelIds.push("catalog-"+i+"-tabpanel-"+s)}return t}tabList(t,i,s){let n=[];return t&&n.push(this.constants.labels.GLOSSARY),i&&n.push(this.constants.labels.KEYWORD_TRANSLATION),s&&n.push(this.constants.labels.GLOSSARY_ILLUSTRATION),n}bindTabListEvents(){const t=document.getElementById(this.idList.tabWrapperId);if(t!==null&&(this.tabElements=t.querySelectorAll('[role="tab"]'),this.tabPanelElements=t.querySelectorAll('[role="tabpanel"]'),this.tabElements.length==this.tabPanelElements.length)){for(let i=0;i<this.tabElements.length;++i)this.addListeners(this.tabElements[i],this.tabPanelElements[i],i);this.bindTabAudioPlayers()}}unbindTabListEvents(){this.removeListeners(),this.unbindTabAudioPlayers()}bindTabAudioPlayers(){this.element.querySelectorAll("audio").forEach(i=>{const s=new _0(i).create();this.audioPlayers.push(s)},this)}unbindTabAudioPlayers(){this.audioPlayers.forEach(t=>{t.removeListeners()},this),this.audioPlayers.splice(0,this.audioPlayers.length)}addListeners(t,i,s){t.addEventListener("click",this.onTabClick),t.addEventListener("keydown",this.onKeyDown),t.addEventListener("keyup",this.onKeyUp),t.index=s}removeListeners(){this.tabElements.forEach(t=>{t.removeEventListener("click",this.onTabClick),t.removeEventListener("keydown",this.onKeyDown),t.removeEventListener("keyup",this.onKeyUp)},this)}tabClickHandler(t){var i=t.target;this.activateTab(i,!1)}keydownHandler(t){switch(t.keyCode){case this.constants.keys.END:t.preventDefault(),this.focusLastTab();break;case this.constants.keys.HOME:t.preventDefault(),this.focusFirstTab();break;case this.constants.keys.UP:case this.constants.keys.DOWN:this.switchTabOnArrowPress(t);break}}switchTabOnArrowPress(t){const i=t.keyCode;if(this.constants.direction[i]){let s=t.target;if(s.index!==void 0){if(this.tabElements[s.index+this.constants.direction[i]]){this.tabElements[s.index+this.constants.direction[i]].focus();return}if(i===this.constants.keys.LEFT||i===this.constants.keys.UP){this.focusLastTab();return}(i===this.constants.keys.RIGHT||i==this.constants.keys.DOWN)&&this.focusFirstTab()}}}keyupHandler(t){switch(t.keyCode){case this.constants.keys.LEFT:case this.constants.keys.RIGHT:this.switchTabOnArrowPress(t);break;case this.constants.keys.ENTER:case this.constants.keys.SPACE:this.activateTab(t.target);break}}activateTab(t,i){i=i||!0,this.deactivateTabs(),t.setAttribute("aria-selected","true");let s=t.getAttribute("aria-controls");document.getElementById(s).classList.remove("hidden"),i&&t.focus()}deactivateTabs(){this.audioPlayers.forEach(t=>{t.pause()},this),this.tabElements.forEach(t=>{t.setAttribute("aria-selected","false")},this),this.tabPanelElements.forEach(t=>{t.classList.add("hidden")},this)}focusFirstTab(){this.tabElements[0].focus()}focusLastTab(){this.tabElements[this.tabElements.length-1].focus()}randomString(t,i){i=i&&i.toLowerCase();let s="";const n=i=="a"?10:0,r=i=="n"?10:62;for(let a=0;a<t;a++){let o=Math.random()*(r-n)+n<<0;s+=String.fromCharCode(o+=o>9?o<36?55:61:48)}return s}}const B=(e,t)=>{const i=e.__vccOpts||e;for(const[s,n]of t)i[s]=n;return i},V0={name:"CatalogDialog",data(){return{state:{isShown:!1,dragging:!1,hidden:!0,xDiff:0,yDiff:0,x:0,y:0},content:{term:""},tabs:null}},methods:{setContent(e){this.resetDialogContent(),this.setDialogTerm(e.term),this.setDialogContent(e),this.createTabs(this.content)},setDialogContent(e){"data"in e&&e.data.forEach(t=>{switch(t.support){case"glossary-on-screen":this.setDialogGlossary(t.card);break;case"keyword-translation":this.setDialogKeywordTranslation(t.card);break;case"ext:sbac-glossary-illustration":this.setDialogGlossaryIllustration(t.card);break}},this)},resetDialogContent(){"glossary"in this.content&&delete this.content.glossary,"keywordTranslation"in this.content&&delete this.content.keywordTranslation,"glossaryIllustration"in this.content&&delete this.content.glossaryIllustration},setDialogTerm(e){this.content.term=e},setDialogGlossary(e){this.content.glossary=e},setDialogKeywordTranslation(e){this.content.keywordTranslation=e},setDialogGlossaryIllustration(e){this.content.glossaryIllustration=e},createTabs(e){this.tabs.create(e)},show(){this.state.hidden=!1,this.render(),this.state.isShown||(this.state.isShown=!0,this.center())},hide(){this.state.hidden=!0,this.render()},center(){this.$refs.dialog.style.top=window.innerHeight/2-this.$refs.dialog.offsetHeight/2+"px",this.$refs.dialog.style.left=window.innerWidth/2-this.$refs.dialog.offsetWidth/2+"px"},reset(){this.state.x=0,this.state.y=0,this.state.isShown=!1,this.state.hidden=!0,this.render()},render(){this.state.hidden?this.$refs.dialog.style.display="none":this.$refs.dialog.style.display="",this.$refs.dialog.style.transform="translate("+this.state.x+"px, "+this.state.y+"px)"},addListeners(){this.$refs.header.addEventListener("mousedown",this.onMouseDown.bind(this)),this.$refs.header.addEventListener("mousemove",this.onMouseMove.bind(this)),this.$refs.header.addEventListener("mouseup",this.onMouseUp.bind(this)),this.$refs.header.addEventListener("mouseleave",this.onMouseUp.bind(this)),this.$refs.header.addEventListener("touchstart",this.onTouchStart.bind(this)),this.$refs.header.addEventListener("touchmove",this.onTouchMove.bind(this)),this.$refs.header.addEventListener("touchend",this.onTouchEnd.bind(this)),this.$refs.close.addEventListener("click",this.hide.bind(this)),this.$refs.close.addEventListener("touchend",this.hide.bind(this))},removeListeners(){this.$refs.header.removeEventListener("mousedown",this.onMouseDown),this.$refs.header.removeEventListener("mousemove",this.onMouseMove),this.$refs.header.removeEventListener("mouseup",this.onMouseUp),this.$refs.header.removeEventListener("mouseleave",this.onMouseUp),this.$refs.header.removeEventListener("touchstart",this.onTouchStart),this.$refs.header.removeEventListener("touchmove",this.onTouchMove),this.$refs.header.removeEventListener("touchend",this.onTouchEnd),this.$refs.close.removeEventListener("click",this.hide),this.$refs.close.removeEventListener("touchend",this.hide)},onMouseDown(e){this.state.dragging=!0,this.state.xDiff=e.pageX-this.state.x,this.state.yDiff=e.pageY-this.state.y},onTouchStart(e){e.preventDefault(),this.state.dragging=!0,this.state.xDiff=e.targetTouches[0].pageX-this.state.x,this.state.yDiff=e.targetTouches[0].pageY-this.state.y},onMouseMove(e){this.state.dragging&&(this.state.x=e.pageX-this.state.xDiff,this.state.y=e.pageY-this.state.yDiff),this.render()},onTouchMove(e){e.preventDefault(),e.stopPropagation(),this.state.dragging&&(this.state.x=e.targetTouches[0].pageX-this.state.xDiff,this.state.y=e.targetTouches[0].pageY-this.state.yDiff),this.render()},onMouseUp(){this.state.dragging=!1},onTouchEnd(e){e.preventDefault(),this.state.dragging=!1}},mounted(){this.tabs=new I0(this.$refs.body),this.addListeners()},beforeUnmount(){this.tabs.removeListeners(),this.removeListeners()}},A0={ref:"dialog",class:"qti3-player-cat-dialog",role:"dialog",style:{display:"none"}},$0={ref:"header",class:"qti3-player-cat-dialog-header"},L0={class:"qti3-player-cat-dialog-term"},M0={ref:"close",type:"button",class:"qti3-player-cat-dialog-close","aria-label":"Close"},N0={ref:"body",class:"qti3-player-cat-dialog-body"};function R0(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",A0,[l.createElementVNode("div",$0,[l.createElementVNode("span",L0,l.toDisplayString(n.content.term),1),l.createElementVNode("button",M0,"×",512)],512),l.createElementVNode("div",N0,null,512)],512)}const k0=B(V0,[["render",R0]]),q0={name:"AmpStyle",render(){return l.h("style",{},this.$slots.default())}},O0=new G,B0={name:"AmpAudio",emits:["mediaLoaded","mediaEnded","mediaMounted"],props:{},data(){return{audio:null,audioSubType:null,currentTime:0,duration:0,displayCurrentTime:"00:00",displayDuration:"00:00",audioLoaded:!1,isPlaying:!1,isMuted:!1,isTimeUpdateListening:!0,showPlayTimer:!1,showVolumeMute:!1,showProgress:!1,showCaptions:!1,textTracksMap:null,mediaInteractionChild:!1,isDisabled:!1,isQtiValid:!0}},methods:{disable(){this.isDisabled=!0,this.pauseAudio(),this.disableController()},enable(){this.isDisabled=!1,this.enableController()},disableController(){this.$refs.playpause.setAttribute("tabindex","-1"),this.$refs.playpause.classList.add("disabled"),this.$refs.progress.setAttribute("tabindex","-1"),this.$refs.progress.classList.add("disabled"),this.$refs.volume.setAttribute("tabindex","-1"),this.$refs.volume.classList.add("disabled"),this.$refs.playtimer.classList.add("disabled")},enableController(){this.$refs.playpause.setAttribute("tabindex","0"),this.$refs.playpause.classList.remove("disabled"),(this.isMediaInteractionChild()||this.audioSubType==="audioprogress")&&(this.$refs.progress.setAttribute("tabindex","0"),this.$refs.progress.classList.remove("disabled"),this.$refs.volume.setAttribute("tabindex","0"),this.$refs.volume.classList.remove("disabled"),this.$refs.playtimer.classList.remove("disabled"))},handleLoaded(){this.audio&&(this.addControllerEventListeners(),this.duration=Math.round(this.audio.duration),this.displayDuration=this.convertTime(this.duration),this.isMediaInteractionChild()&&this.$parent.$emit("mediaLoaded",{node:this}))},handleEnded(){this.isPlaying=!1,this.isMediaInteractionChild()&&this.$parent.$emit("mediaEnded",{})},handleCanPlay(){this.audioLoaded=!0},handleTimeUpdate(){if(!this.isTimeUpdateListening)return;let e=Math.round(this.audio.currentTime);this.currentTime=e,this.displayCurrentTime=this.convertTime(e)},handlePlayPauseClick(){this.isDisabled||this.toggleAudio()},handlePlayPauseKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleAudio(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleProgressMouseDown(){this.isDisabled||(this.isTimeUpdateListening=!1,this.audio.paused?this.wasPlaying=!1:(this.wasPlaying=!0,this.audio.pause(),this.isPlaying=!1))},handleProgressInput(e){this.isDisabled||(this.displayCurrentTime=this.convertTime(e.target.valueAsNumber))},handleProgressChange(e){this.isDisabled||(this.setPosition(e.target.valueAsNumber),this.isTimeUpdateListening=!0,this.wasPlaying&&this.audio.paused&&(this.wasPlaying=!1,this.toggleAudio()))},handleVolumeMuteClick(){this.isDisabled||this.toggleVolume()},handleVolumeMuteKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleVolume(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleCueChange(e){const t=e.target.activeCues;if(t.length>0&&this.showCaptions){const i=t[0].text.replace(/\n/g,"<br/>");console.log("[AmpAudio][currentCue]",i),this.$refs.captions.innerHTML=i}},setPosition(e){this.audio.currentTime=e,this.displayCurrentTime=this.convertTime(e)},toggleAudio(){this.audio&&(this.isPlaying?(this.isPlaying=!1,this.audio.pause()):(this.isPlaying=!0,this.audio.play()))},playAudio(){this.audio&&(this.audio.play(),this.isPlaying=!0)},pauseAudio(){this.audio&&(this.audio.pause(),this.isPlaying=!1)},toggleVolume(){this.audio&&(this.audio.muted?(this.audio.muted=!1,this.isMuted=!1):(this.audio.muted=!0,this.isMuted=!0))},initSlider(){this.audio&&(this.duration=Math.round(this.audio.duration))},convertTime(e){let t=new Date(e*1e3).toISOString().substr(11,8);return t.indexOf("00:")===0&&(t=t.substr(3)),t},setAudioSubType(e){this.audioSubType=e,this.audioSubType==="audioprogress"&&(this.showProgress=!0,this.showPlayTimer=!0,this.showVolumeMute=!0)},getAudioSubType(e){if(e===null)return null;const t=e.class;if(typeof t>"u"||t===null||t.length==0)return null;const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case"sbaudio":case"audioprogress":return this.showProgress=!0,this.showPlayTimer=!0,this.showVolumeMute=!0,"audioprogress"}return null},detectAudioSubType(e){return this.getAudioSubType(e)},isMediaInteractionChild(){return this.mediaInteractionChild},detectMediaInteractionChild(){this.mediaInteractionChild=this.$parent.$el.classList.contains("qti3-player-media-group")},processChildren(){this.audio=this.$refs.player,this.audio.removeAttribute("controls"),this.audio.removeAttribute("autoplay"),this.textTracksMap=this.filterTextTracks(this.audio.querySelectorAll("track"))},filterTextTracks(e){let t=new Map;return e.forEach(i=>{switch(i.getAttribute("kind")){case"subtitles":case"captions":i.hasAttribute("id")||i.setAttribute("id","track-"+O0.randomString(5,"a")),t.set(i.getAttribute("id"),i);break}},this),t},isDefaultTextTrack(e){return e.hasAttribute("default")},addTextTrackCueEventListener(){this.audio&&this.audio.textTracks.length!==0&&this.audio.textTracks.forEach(e=>{const t=this.textTracksMap.get(e.id);if(typeof t<"u"&&this.isDefaultTextTrack(t)){e.addEventListener("cuechange",this.handleCueChange);return}},this)},removeTextTrackCueEventListener(){this.audio&&this.audio.textTracks.length!==0&&this.audio.textTracks.forEach(e=>{const t=this.textTracksMap.get(e.id);if(typeof t<"u"&&this.isDefaultTextTrack(t)){e.removeEventListener("cuechange",this.handleCueChange);return}},this)},addControllerEventListeners(){this.$refs.playpause.addEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.addEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.addEventListener("input",this.handleProgressInput),this.$refs.progress.addEventListener("change",this.handleProgressChange),this.$refs.progress.addEventListener("mousedown",this.handleProgressMouseDown),this.$refs.volume.addEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.addEventListener("keydown",this.handleVolumeMuteKeydown)},removeControllerEventListeners(){this.$refs.playpause.removeEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.removeEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.removeEventListener("input",this.handleProgressInput),this.$refs.progress.removeEventListener("change",this.handleProgressChange),this.$refs.progress.removeEventListener("mousedown",this.handleProgressMouseDown),this.$refs.volume.removeEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.removeEventListener("keydown",this.handleVolumeMuteKeydown)}},created(){this.setAudioSubType(this.detectAudioSubType(this.$.vnode.props))},mounted(){if(this.isQtiValid)try{if(this.detectMediaInteractionChild(),this.processChildren(),this.$nextTick(function(){this.audio&&(this.audio.addEventListener("loadedmetadata",this.handleLoaded),this.audio.addEventListener("canplay",this.handleCanPlay),this.audio.addEventListener("timeupdate",this.handleTimeUpdate),this.audio.addEventListener("ended",this.handleEnded),this.addTextTrackCueEventListener())}),this.isMediaInteractionChild()){this.$parent.$emit("mediaMounted",{node:this,mediaType:"audio"});return}this.enable()}catch(e){throw this.isQtiValid=!1,new c(e.message)}},beforeUnmount(){this.audio&&(this.audio.removeEventListener("loadedmetadata",this.handleLoaded),this.audio.removeEventListener("canplay",this.handleCanPlay),this.audio.removeEventListener("timeupdate",this.handleTimeUpdate),this.audio.removeEventListener("ended",this.handleEnded),this.removeTextTrackCueEventListener()),this.removeControllerEventListeners()}},P0={class:"amp-audio"},D0={class:"amp-audio__holder"},Q0={ref:"controller",class:"amp-audio__container"},H0={ref:"playpause",class:"amp-audio-playpause__container"},F0={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},U0={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},G0={ref:"playtimer",class:"amp-playtimer__container"},j0={class:"amp-progress__container"},W0=["max"],z0={ref:"volume",class:"amp-video-volumemute__container","aria-label":"Volume mute or unmute"},K0={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512"},Y0={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},X0={class:"amp-audio-captions__container hidden"},Z0={class:"amp-audio-captions",ref:"captions"};function J0(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",P0,[l.createElementVNode("div",D0,[l.createElementVNode("audio",l.mergeProps({ref:"player",tabIndex:"-1"},e.$attrs),[l.renderSlot(e.$slots,"default",{},void 0,!0)],16)]),l.createElementVNode("div",Q0,[l.createElementVNode("button",H0,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",F0,t[1]||(t[1]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,!n.isPlaying]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",U0,t[2]||(t[2]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zM7 8a1 1 0 012 0v4a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,n.isPlaying]])],512),l.withDirectives(l.createElementVNode("div",G0,[l.createElementVNode("span",null,l.toDisplayString(n.displayCurrentTime),1),t[3]||(t[3]=l.createElementVNode("span",null," / ",-1)),l.createElementVNode("span",null,l.toDisplayString(n.displayDuration),1)],512),[[l.vShow,n.showPlayTimer]]),l.withDirectives(l.createElementVNode("div",j0,[l.withDirectives(l.createElementVNode("input",{ref:"progress","onUpdate:modelValue":t[0]||(t[0]=a=>n.currentTime=a),type:"range",min:"0",max:n.duration,class:"slider"},null,8,W0),[[l.vModelText,n.currentTime]])],512),[[l.vShow,n.showProgress]]),l.withDirectives(l.createElementVNode("div",z0,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",K0,t[4]||(t[4]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zm233.32-51.08c-11.17-7.33-26.18-4.24-33.51 6.95-7.34 11.17-4.22 26.18 6.95 33.51 66.27 43.49 105.82 116.6 105.82 195.58 0 78.98-39.55 152.09-105.82 195.58-11.17 7.32-14.29 22.34-6.95 33.5 7.04 10.71 21.93 14.56 33.51 6.95C528.27 439.58 576 351.33 576 256S528.27 72.43 448.35 19.97zM480 256c0-63.53-32.06-121.94-85.77-156.24-11.19-7.14-26.03-3.82-33.12 7.46s-3.78 26.21 7.41 33.36C408.27 165.97 432 209.11 432 256s-23.73 90.03-63.48 115.42c-11.19 7.14-14.5 22.07-7.41 33.36 6.51 10.36 21.12 15.14 33.12 7.46C447.94 377.94 480 319.54 480 256zm-141.77-76.87c-11.58-6.33-26.19-2.16-32.61 9.45-6.39 11.61-2.16 26.2 9.45 32.61C327.98 228.28 336 241.63 336 256c0 14.38-8.02 27.72-20.92 34.81-11.61 6.41-15.84 21-9.45 32.61 6.43 11.66 21.05 15.8 32.61 9.45 28.23-15.55 45.77-45 45.77-76.88s-17.54-61.32-45.78-76.86z"},null,-1)]),512)),[[l.vShow,!n.isMuted]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",Y0,t[5]||(t[5]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z"},null,-1)]),512)),[[l.vShow,n.isMuted]])],512),[[l.vShow,n.showVolumeMute]])],512),l.createElementVNode("div",X0,[l.createElementVNode("div",Z0,null,512)])])}const eT=B(B0,[["render",J0],["__scopeId","data-v-a1958132"]]),tT=new G,iT={name:"AmpVideo",emits:["mediaLoaded","mediaEnded","mediaMounted"],props:{},data(){return{video:null,playerSubType:null,currentTime:0,duration:0,displayCurrentTime:"00:00",displayDuration:"00:00",videoLoaded:!1,isPlaying:!1,isMuted:!1,isTimeUpdateListening:!0,showPlayTimer:!1,showVolumeMute:!1,showProgress:!1,showCaptions:!1,textTracksMap:null,mediaInteractionChild:!1,subtitlesMenu:null,subtitleMenuButtons:[],isDisabled:!1,isQtiValid:!0}},methods:{disable(){this.isDisabled=!0,this.pauseVideo(),this.disableController()},enable(){this.isDisabled=!1,this.enableController()},disableController(){this.$refs.playpause.setAttribute("tabindex","-1"),this.$refs.playpause.classList.add("disabled"),this.$refs.progress.setAttribute("tabindex","-1"),this.$refs.progress.classList.add("disabled"),this.$refs.cc.setAttribute("tabindex","-1"),this.$refs.cc.classList.add("disabled"),this.$refs.volume.setAttribute("tabindex","-1"),this.$refs.volume.classList.add("disabled"),this.$refs.playtimer.classList.add("disabled")},enableController(){this.$refs.playpause.setAttribute("tabindex","0"),this.$refs.playpause.classList.remove("disabled"),this.$refs.progress.setAttribute("tabindex","0"),this.$refs.progress.classList.remove("disabled"),this.$refs.cc.setAttribute("tabindex","0"),this.$refs.cc.classList.remove("disabled"),this.$refs.volume.setAttribute("tabindex","0"),this.$refs.volume.classList.remove("disabled"),this.$refs.playtimer.classList.remove("disabled")},handleLoaded(){this.video&&(this.addControllerEventListeners(),this.duration=Math.round(this.video.duration),this.displayDuration=this.convertTime(this.duration),this.isMediaInteractionChild()&&this.$parent.$emit("mediaLoaded",{node:this}))},handleEnded(){this.isPlaying=!1,this.isMediaInteractionChild()&&this.$parent.$emit("mediaEnded",{})},handleCanPlay(){this.videoLoaded=!0},handleTimeUpdate(){if(!this.isTimeUpdateListening||!this.video)return;let e=Math.round(this.video.currentTime);this.currentTime=e,this.displayCurrentTime=this.convertTime(e)},handlePlayPauseClick(){this.isDisabled||this.toggleVideo()},handlePlayPauseKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleVideo(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleProgressMouseDown(){this.isDisabled||(this.isTimeUpdateListening=!1,this.video.paused?this.wasPlaying=!1:(this.wasPlaying=!0,this.video.pause(),this.isPlaying=!1))},handleProgressInput(e){this.isDisabled||(this.displayCurrentTime=this.convertTime(e.target.valueAsNumber))},handleProgressChange(e){this.isDisabled||(this.setPosition(e.target.valueAsNumber),this.isTimeUpdateListening=!0,this.wasPlaying&&this.video.paused&&(this.wasPlaying=!1,this.toggleVideo()))},handleCaptionsClick(){this.isDisabled||this.toggleCaptionsMenu()},handleCaptionsKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleCaptionsMenu(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},toggleCaptionsMenu(){this.subtitlesMenu.style.display=this.subtitlesMenu.style.display==="block"?"none":"block"},handleVolumeMuteClick(){this.isDisabled||this.toggleVolume()},handleVolumeMuteKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleVolume(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleCueChange(){},setPosition(e){this.video.currentTime=e,this.displayCurrentTime=this.convertTime(e)},toggleVideo(){this.video&&(this.isPlaying?(this.isPlaying=!1,this.video.pause()):(this.isPlaying=!0,this.video.play()))},playVideo(){this.video&&(this.video.play(),this.isPlaying=!0)},pauseVideo(){this.video&&(this.video.pause(),this.isPlaying=!1)},toggleVolume(){this.video&&(this.video.muted?(this.video.muted=!1,this.isMuted=!1):(this.video.muted=!0,this.isMuted=!0))},initSlider(){this.video&&(this.duration=Math.round(this.video.duration))},convertTime(e){let t=new Date(e*1e3).toISOString().substr(11,8);return t.indexOf("00:")===0&&(t=t.substr(3)),t},getPlayerSubType(){return this.showProgress=!0,this.showPlayTimer=!0,this.showVolumeMute=!0,"ampvideo-default"},detectPlayerSubType(e){return this.getPlayerSubType(e)},isMediaInteractionChild(){return this.mediaInteractionChild},detectMediaInteractionChild(){this.mediaInteractionChild=this.$parent.$el.classList.contains("qti3-player-media-group")},processChildren(){if(this.video=this.$refs.player,this.video.removeAttribute("controls"),this.video.removeAttribute("autoplay"),this.video.hasAttribute("width")){const e=`${this.video.getAttribute("width")}`,t=e.endsWith("%")?`width:${e}`:`width:${e}px`;this.$refs.videocontainer.setAttribute("style",t),this.$refs.controller.setAttribute("style",t)}else this.video.setAttribute("width","100%");this.textTracksMap=this.filterTextTracks(this.video.querySelectorAll("track"))},filterTextTracks(e){let t=new Map;return e.forEach(i=>{switch(i.getAttribute("kind")){case"subtitles":case"captions":i.hasAttribute("id")||i.setAttribute("id","track-"+tT.randomString(5,"a")),t.set(i.getAttribute("id"),i);break}},this),t},isDefaultTextTrack(e){return e.hasAttribute("default")},addTextTrackCueEventListener(){if(this.video&&this.video.textTracks.length!==0){this.showCaptions=!0,this.initializeSubtitlesMenu();for(let e=0;e<this.video.textTracks.length;e++){const t=this.video.textTracks[e];t.mode="hidden",this.addSubtitlesMenuItem(t),typeof this.textTracksMap.get(t.id)<"u"&&t.addEventListener("cuechange",this.handleCueChange)}this.$refs.videocontainer.appendChild(this.subtitlesMenu)}},removeTextTrackCueEventListener(){if(this.video&&this.video.textTracks.length!==0){this.subtitleMenuButtons.forEach(e=>{e.removeEventListener("click",this.handleSubtitleButtonClick)});for(let e=0;e<this.video.textTracks.length;e++){const t=this.video.textTracks[e];typeof this.textTracksMap.get(t.id)<"u"&&t.removeEventListener("cuechange",this.handleCueChange)}}},initializeSubtitlesMenu(){const e=document.createDocumentFragment();this.subtitlesMenu=e.appendChild(document.createElement("ul")),this.subtitlesMenu.className="ampvideo-subtitles-menu",this.subtitlesMenu.appendChild(this.createMenuItem("subtitles-off","","Off"))},addSubtitlesMenuItem(e){this.subtitlesMenu.appendChild(this.createMenuItem(`subtitles-${e.language}`,e.language,e.label))},createMenuItem(e,t,i){const s=document.createElement("li"),n=s.appendChild(document.createElement("button"));return n.setAttribute("id",e),n.className="ampvideo-subtitles-button",t.length>0&&n.setAttribute("lang",t),n.value=i,t===""?n.setAttribute("data-state","active"):n.setAttribute("data-state","inactive"),n.appendChild(document.createTextNode(i)),n.addEventListener("click",this.handleSubtitleButtonClick),this.subtitleMenuButtons.push(n),s},handleSubtitleButtonClick(e){const t=e.currentTarget;this.subtitleMenuButtons.forEach(s=>{s.setAttribute("data-state","inactive")});const i=t.getAttribute("lang");for(let s=0;s<this.video.textTracks.length;s++)this.video.textTracks[s].language===i?(this.video.textTracks[s].mode="showing",t.setAttribute("data-state","active")):this.video.textTracks[s].mode="hidden";i===null&&t.setAttribute("data-state","active"),this.subtitlesMenu.style.display="none"},addControllerEventListeners(){this.$refs.playpause.addEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.addEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.addEventListener("input",this.handleProgressInput),this.$refs.progress.addEventListener("change",this.handleProgressChange),this.$refs.progress.addEventListener("mousedown",this.handleProgressMouseDown),this.$refs.cc.addEventListener("click",this.handleCaptionsClick),this.$refs.cc.addEventListener("keydown",this.handleCaptionsKeydown),this.$refs.volume.addEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.addEventListener("keydown",this.handleVolumeMuteKeydown)},removeControllerEventListeners(){this.$refs.playpause.removeEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.removeEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.removeEventListener("input",this.handleProgressInput),this.$refs.progress.removeEventListener("change",this.handleProgressChange),this.$refs.progress.removeEventListener("mousedown",this.handleProgressMouseDown),this.$refs.cc.removeEventListener("click",this.handleCaptionsClick),this.$refs.cc.removeEventListener("keydown",this.handleCaptionsKeydown),this.$refs.volume.removeEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.removeEventListener("keydown",this.handleVolumeMuteKeydown)}},created(){this.playerSubType=this.detectPlayerSubType(this.$.vnode.props)},mounted(){if(this.isQtiValid)try{if(this.detectMediaInteractionChild(),this.processChildren(),this.$nextTick(function(){this.video&&(this.video.addEventListener("loadedmetadata",this.handleLoaded),this.video.addEventListener("canplay",this.handleCanPlay),this.video.addEventListener("timeupdate",this.handleTimeUpdate),this.video.addEventListener("ended",this.handleEnded),this.addTextTrackCueEventListener())}),this.isMediaInteractionChild()){this.$parent.$emit("mediaMounted",{node:this,mediaType:"video"});return}this.enable()}catch(e){throw this.isQtiValid=!1,new c(e.message)}},beforeUnmount(){this.video&&(this.video.removeEventListener("loadedmetadata",this.handleLoaded),this.video.removeEventListener("canplay",this.handleCanPlay),this.video.removeEventListener("timeupdate",this.handleTimeUpdate),this.video.removeEventListener("ended",this.handleEnded),this.removeTextTrackCueEventListener()),this.removeControllerEventListeners()}},sT={ref:"videocontainer",class:"amp-video"},nT={class:"amp-video__holder"},rT={ref:"controller",class:"amp-video__container"},aT={ref:"playpause",class:"amp-video-playpause__container"},oT={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},lT={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},cT={ref:"playtimer",class:"amp-playtimer__container"},uT={class:"amp-progress__container"},hT=["max"],dT={ref:"cc",class:"amp-video-cc__container","aria-label":"Captions menu"},fT={ref:"volume",class:"amp-video-volumemute__container","aria-label":"Volume mute or unmute"},pT={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512"},mT={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"};function gT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",sT,[l.createElementVNode("div",nT,[l.createElementVNode("video",l.mergeProps({ref:"player",tabIndex:"-1",class:"amp-video__video"},e.$attrs),[l.renderSlot(e.$slots,"default")],16)]),l.createElementVNode("div",rT,[l.createElementVNode("button",aT,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",oT,t[1]||(t[1]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,!n.isPlaying]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",lT,t[2]||(t[2]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zM7 8a1 1 0 012 0v4a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,n.isPlaying]])],512),l.withDirectives(l.createElementVNode("div",cT,[l.createElementVNode("span",null,l.toDisplayString(n.displayCurrentTime),1),t[3]||(t[3]=l.createElementVNode("span",null," / ",-1)),l.createElementVNode("span",null,l.toDisplayString(n.displayDuration),1)],512),[[l.vShow,n.showPlayTimer]]),l.withDirectives(l.createElementVNode("div",uT,[l.withDirectives(l.createElementVNode("input",{ref:"progress","onUpdate:modelValue":t[0]||(t[0]=a=>n.currentTime=a),type:"range",min:"0",max:n.duration,class:"slider"},null,8,hT),[[l.vModelText,n.currentTime]])],512),[[l.vShow,n.showProgress]]),l.withDirectives(l.createElementVNode("div",dT," CC ",512),[[l.vShow,n.showCaptions]]),l.withDirectives(l.createElementVNode("div",fT,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",pT,t[4]||(t[4]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zm233.32-51.08c-11.17-7.33-26.18-4.24-33.51 6.95-7.34 11.17-4.22 26.18 6.95 33.51 66.27 43.49 105.82 116.6 105.82 195.58 0 78.98-39.55 152.09-105.82 195.58-11.17 7.32-14.29 22.34-6.95 33.5 7.04 10.71 21.93 14.56 33.51 6.95C528.27 439.58 576 351.33 576 256S528.27 72.43 448.35 19.97zM480 256c0-63.53-32.06-121.94-85.77-156.24-11.19-7.14-26.03-3.82-33.12 7.46s-3.78 26.21 7.41 33.36C408.27 165.97 432 209.11 432 256s-23.73 90.03-63.48 115.42c-11.19 7.14-14.5 22.07-7.41 33.36 6.51 10.36 21.12 15.14 33.12 7.46C447.94 377.94 480 319.54 480 256zm-141.77-76.87c-11.58-6.33-26.19-2.16-32.61 9.45-6.39 11.61-2.16 26.2 9.45 32.61C327.98 228.28 336 241.63 336 256c0 14.38-8.02 27.72-20.92 34.81-11.61 6.41-15.84 21-9.45 32.61 6.43 11.66 21.05 15.8 32.61 9.45 28.23-15.55 45.77-45 45.77-76.88s-17.54-61.32-45.78-76.86z"},null,-1)]),512)),[[l.vShow,!n.isMuted]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",mT,t[5]||(t[5]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z"},null,-1)]),512)),[[l.vShow,n.isMuted]])],512),[[l.vShow,n.showVolumeMute]])],512)],512)}const yT=B(iT,[["render",gT]]);class wT{constructor(t,i){J(this,"constants",{supports:{GLOSSARY:"glossary-on-screen",KEYWORD_TRANSLATION:"keyword-translation",EXT_SBAC_GLOSSARY_ILLUSTRATION:"ext:sbac-glossary-illustration"},GLOSSARY_CLICKABLE_CLASS:"qti3-player-catalog-clickable-term",LANGUAGE_OFF:""});return this.item=t,this.itemElement=t.$refs.item,this.store=i,this.nodeList=null,this.showGlossary=this.showGlossaryHandler.bind(this),this}bindAll(){this.store.getCatalogs().length!==0&&(this.resetAll(),this.nodeList=this.itemElement.querySelectorAll("[data-catalog-idref]"),this.nodeList.length!==0&&this.bindGlossary(this.nodeList))}resetAll(){this.nodeList!==null&&(this.nodeList.forEach(t=>{this.unbindGlossaryDOM(t)},this),this.nodeList=null)}getPnpGlossarySupports(t){let i=[];return t.getGlossaryOnScreen()&&i.push(this.constants.supports.GLOSSARY),t.getKeywordTranslationLanguage()!==this.constants.LANGUAGE_OFF&&i.push(`${this.constants.supports.KEYWORD_TRANSLATION}:${t.getKeywordTranslationLanguage()}`),t.getExtSbacGlossaryIllustration()&&i.push(this.constants.supports.EXT_SBAC_GLOSSARY_ILLUSTRATION),i}bindGlossary(t){const i=this.getPnpGlossarySupports(this.store.getItemContextPnp());i.length!==0&&t.forEach(s=>{this.bindGlossaryNode(s,i)},this)}bindGlossaryNode(t,i){const s=t.getAttribute("data-catalog-idref"),n=this.store.getCatalog(s);typeof n>"u"||this.hasCatalogGlossarySupport(n,i)&&this.bindGlossaryDOM(t)}bindGlossaryDOM(t){t.classList.contains(this.constants.GLOSSARY_CLICKABLE_CLASS)||(t.classList.add(this.constants.GLOSSARY_CLICKABLE_CLASS),this.setGlossaryTerm(t),t.addEventListener("click",this.showGlossary),t.addEventListener("touchend",this.showGlossary))}unbindGlossaryDOM(t){t.classList.contains(this.constants.GLOSSARY_CLICKABLE_CLASS)&&(t.classList.remove(this.constants.GLOSSARY_CLICKABLE_CLASS),t.removeEventListener("click",this.showGlossary),t.removeEventListener("touchend",this.showGlossary))}setGlossaryTerm(t){if(!t.hasAttribute("data-glossary-term")){if(t.hasAttribute("data-sbac-term")){t.setAttribute("data-glossary-term",t.getAttribute("data-sbac-term"));return}t.setAttribute("data-glossary-term",t.innerText)}}showGlossaryHandler(t){t.preventDefault(),t.stopPropagation();const i=t.target.getAttribute("data-catalog-idref"),s=this.createGlossaryData(i);this.item.$parent.$emit("itemCatalogEvent",{type:"glossary",catalogIdRef:i,term:t.target.getAttribute("data-glossary-term"),data:s})}createGlossaryData(t){const i=this.store.getCatalog(t),s=this.getPnpGlossarySupports(this.store.getItemContextPnp());return this.createGlossaryDataFromCatalog(i,s)}createGlossaryDataFromCatalog(t,i){let s=[];return i.forEach(n=>{const r=this.findCatalogCardBySupport(t,n);if(r!==null){if(n===this.constants.supports.GLOSSARY||n===this.constants.supports.EXT_SBAC_GLOSSARY_ILLUSTRATION){const a=this.createGlossaryContent(r);if(a===null)return;s.push({support:n,card:a});return}if(n.startsWith(`${this.constants.supports.KEYWORD_TRANSLATION}:`)){const a=this.getLanguageCodeFromSupport(n),o=this.createTranslationContent(r,a);if(o===null)return;s.push({support:this.constants.supports.KEYWORD_TRANSLATION,card:o});return}}},this),s}hasCatalogGlossarySupport(t,i){let s=null;return i.forEach(n=>{let r=this.findCatalogCardBySupport(t,n);if(r!==null){s=r;return}},this),s!=null}getLanguageCodeFromSupport(t){const i=t.indexOf(":");return t.length>i+1?t.substring(i+1):""}findCatalogCardBySupport(t,i){return typeof t>"u"?null:this.findCardBySupport(t.node.getCards(),i)}findCardBySupport(t,i){let s=null,n="";return i.startsWith(`${this.constants.supports.KEYWORD_TRANSLATION}:`)&&(n=this.getLanguageCodeFromSupport(i),i=this.constants.supports.KEYWORD_TRANSLATION),t.forEach(r=>{if(r.support===i){if(i===this.constants.supports.KEYWORD_TRANSLATION&&this.createTranslationContent(r,n)===null)return;s=r;return}},this),s}createGlossaryContent(t){return this.getGlossaryCardContent(t)}createTranslationContent(t,i){let s=this.getTranslationCardContent(t,i);return s!==null?s:this.getTranslationCardContent(t,i,!0)}getGlossaryCardContent(t){let i=null;return t.getChildren().forEach(s=>{switch(s.$options.name){case"QtiHtmlContent":i=this.createContent("qti-html-content",s);return;case"QtiFileRef":i=this.createContent("qti-file-ref",s);return;case"QtiCardEntry":i=this.getGlossaryCardContent(s);return;default:return}},this),i}getTranslationCardContent(t,i,s=!1,n=0){if(n>1||n==0&&t.getLanguage().length>0&&t.getLanguage()!==i)return null;let r=null;return t.getChildren().forEach(a=>{switch(a.$options.name){case"QtiHtmlContent":r=this.createContent("qti-html-content",a);return;case"QtiFileRef":r=this.createContent("qti-file-ref",a);return;case"QtiCardEntry":if(s&&a.isDefault()){r=this.getTranslationCardContent(a,i,s,n+1);return}if(a.getLanguage()===i){r=this.getTranslationCardContent(a,i,s,n+1);return}return;default:return}},this),r}createContent(t,i){return{properties:{name:t},content:i.getContent()}}}const bT={name:"EventListener",emits:["templateProcessingReady","itemBodyReady"],setup(e,t){return()=>{var i,s;return((s=(i=t.slots).default)==null?void 0:s.call(i))??null}}},vT=new G,ET={name:"QtiAssessmentItem",components:{EventListener:bT},emits:["itemReady","itemCompleted","itemSuspendAttemptReady","itemEndAttemptReady","itemScoreAttemptReady","itemCatalogEvent","itemNewTemplate","itemNewTemplateCompleted"],props:{identifier:{type:String,required:!0},title:{type:String,required:!1},adaptive:{type:String,required:!1},timeDependent:{type:String,required:!1},"xml:lang":{type:String,required:!1}},data(){return{isAdaptive:!1,isTimeDependent:!1,lang:null,locale:null,catalogFactory:null,getResponsesCallback:null}},methods:{getEndAttempt(e){this.endAttempt(void 0,(function(){this.notifyAttemptResults("itemEndAttemptReady",e)}).bind(this))},getSuspendAttempt(e){_.updateItemDuration(),this.getResponses((function(){this.evaluateAttemptValidity(_.getItemContextSessionControl().getValidateResponses()),this.notifyAttemptResults("itemSuspendAttemptReady",e)}).bind(this))},getScoreAttempt(e){this.processResponses(!0),this.notifyAttemptResults("itemScoreAttemptReady",e)},notifyAttemptResults(e,t){const i=new bc(this.identifier,_);this.$parent.$emit(e,{state:i.getSerializedState(),target:typeof t<"u"?t:null})},notifyEndAttemptInteractionResults(){const t=new bc(this.identifier,_).getSerializedState();_.getItemContextSessionControl().getValidateResponses()&&t.validationMessages.length>0&&_.getInteractions().forEach(i=>{i.interactionType==="EndAttemptInteraction"&&i.interactionSubType==="endattempt-controller-bar"&&i.enable()}),this.$parent.$emit("itemEndAttemptReady",{state:t,target:null})},handleTemplateProcessingReady(e){console.log("[QtiAssessmentItem][TemplateProcessingReady]"),_.defineTemplateProcessing({node:e.templateProcessing}),_.hasItemContextState()||this.executeTemplateProcessing()},handleItemBodyReady(e){console.log("[QtiAssessmentItem][ItemBodyReady][Adaptive="+this.isAdaptive+"]",e),_.defineItemBody({node:e.itemBody}),this.initializeResponseDeclarations(_.hasItemContextState()),this.initializeOutcomeDeclarations(_.hasItemContextState()),this.isAdaptive&&this.evaluateFeedbacks(),(_.getItemLifecycleStatus()==="closed"||_.getItemLifecycleStatus()==="review"||_.getItemLifecycleStatus()==="solution")&&(_.resetItemTimer(),this.disableInteractions())},getItemBody(){return _.getItemBody()},getTemplateProcessing(){let e=_.getProcessing("template");return typeof e>"u"?null:e.node},getResponseProcessing(){let e=_.getProcessing("response");return typeof e>"u"?null:e.node},newTemplate(){console.log("[QtiAssessmentItem][NewTemplate][Started]"),this.$parent.$emit("itemNewTemplate"),this.resetResponseDeclarations(),this.resetInteractions(),this.resetTemplateDeclarations(),this.executeTemplateProcessing(),this.evaluatePrintedVariables(),this.evaluateTemplateMathVariables(),this.evaluateTemplates(),this.resetOutcomeDeclarations(),this.evaluateFeedbacks(),_.restartItemTimer(),console.log("[QtiAssessmentItem][NewTemplate][Completed]"),this.$parent.$emit("itemNewTemplateCompleted")},evaluateTemplateMathVariables(){if(_.getTemplateMathParameterVariables().length===0)return;const t=this.getItemBody();t!==null&&t.updateTemplateMathVariables(),_.getFeedbacks().forEach(i=>{i.feedbackType==="Modal"&&i.node.updateTemplateMathVariables()})},executeTemplateProcessing(){let e=this.getTemplateProcessing();e!==null&&e.evaluate()},initializeOutcomeDeclarations(e){e?_.restoreOutcomeVariables():this.resetOutcomeDeclarations()},resetOutcomeDeclarations(){_.getOutcomeDeclarations().forEach(e=>{this.resetOutcomeDeclaration(e)},this)},resetOutcomeDeclaration(e){if(e.node!==void 0){e.node.reset();return}_.setOutcomeVariableValue({identifier:e.identifier,value:e.defaultValue})},initializeResponseDeclarations(e){e?_.restoreResponseVariables():this.resetResponseDeclarations()},resetResponseDeclarations(){_.getResponseDeclarations().forEach(e=>{e.resetValue&&e.resetValue()})},resetTemplateDeclarations(){_.getTemplateDeclarations().forEach(e=>{e.node.reset()})},resetInteractions(){_.getInteractions().forEach(e=>{console.log("[ResetInteractions]["+e.identifier+"]",e),e.resetValue&&e.resetValue(),e.node.enable&&e.node.enable()}),_.resetInteractionStateIsValidResponse()},disableInteractions(){_.getInteractions().forEach(e=>{e.node.disable&&e.node.disable()})},showSolutionInteractions(){_.getItemContextSessionControl().getShowSolution()&&_.getItemLifecycleState()==="solution"&&_.getInteractions().forEach(e=>{e.node.showSolution&&e.node.showSolution(_.getResponseVariableCorrectResponse(e.identifier))})},evaluateFeedbacks(){console.log("[EvaluateFeedback][Started]"),_.getFeedbacks().forEach(e=>{e.node.evaluate()}),console.log("[EvaluateFeedback][Completed]")},evaluatePrintedVariables(){console.log("[EvaluatePrintedVariables][Started]"),_.getPrintedVariables().forEach(e=>{e.node.evaluate()}),console.log("[EvaluatePrintedVariables][Completed]")},evaluateTemplates(){console.log("[EvaluateTemplates][Started]"),_.getTemplates().forEach(e=>{e.node.evaluate()}),console.log("[EvaluateTemplates][Completed]")},endAttempt(e,t){console.log("[EndAttempt][Start][Identifier]",this.identifier),_.updateItemDuration(),this.getResponses((function(){if(!this.evaluateAttemptValidity(_.getItemContextSessionControl().getValidateResponses())){console.log("[EndAttempt][InvalidResponses][Identifier]",this.identifier),t&&t();return}this.processResponses(),this.isAdaptive&&this.evaluateItemCompleted(),this.updateItemBodyUI(e),console.log("[EndAttempt][Complete][Identifier]",this.identifier),t&&t()}).bind(this))},updateItemBodyUI(e){typeof e>"u"||e.interactionSubType!=="endattempt-controller-bar"&&_.getInteractions().forEach(t=>{if(t.interactionType==="EndAttemptInteraction"){if(t.interactionSubType==="endattempt-controller-bar"){t.disable();return}if(this.isAdaptive){if(this.isAdaptiveItemCompleted()){t.disable();return}t.enable()}}})},getResponses(e){console.log("[GetResponses][Start]"),_.getAsyncStateMap().clear(),this.getResponsesCallback=e;let t=_.getResponseDeclarations();for(let i=0;i<t.length;i++){const s=t[i],n=_.getInteraction(s.identifier);if(typeof n>"u"){s.identifier!=="numAttempts"&&s.identifier!=="duration"&&_.resetResponseVariableValue({identifier:s.identifier,value:s.defaultValue,state:null});continue}if(n.interactionType!=="PortableCustom"){console.log("[GetResponses]["+s.identifier+"]:",n.node.getResponse()),_.setResponseVariableValue({identifier:s.identifier,value:n.node.getResponse(),state:n.node.getState()});continue}n.node.pciIsReady()?_.getAsyncStateMap().set(n.identifier,{identifier:n.identifier,node:n.node}):_.setResponseVariableValue({identifier:s.identifier,value:n.node.getResponse(),state:n.node.getState()})}this.initiateAsyncGetResponsesRequests()},initiateAsyncGetResponsesRequests(){if(_.getAsyncStateMap().size===0)return this.triggerGetResponsesComplete();for(const[e,t]of _.getAsyncStateMap().entries())console.log("[GetResponses]["+e+"][PCI Initiate]"),t.node.getStateRequest()},triggerGetResponsesComplete(){console.log("[GetResponses][Complete]"),typeof this.getResponsesCallback=="function"&&this.getResponsesCallback()},evaluateItemCompleted(){this.isAdaptiveItemCompleted()&&(_.resetItemTimer(),this.$parent.$emit("itemCompleted"))},isAdaptiveItemCompleted(){return _.getOutcomeDeclaration("completionStatus").value==="completed"},processResponses(e=!1){console.log("[ProcessResponses][Started]"),e||_.incrementNumAttempts(),console.log("[ProcessResponses][IsAdaptive]",this.isAdaptive),this.isAdaptive||this.resetOutcomeDeclarations();let t=this.getResponseProcessing();t!==null&&t.evaluate(),e||(this.printOutcomeDeclarations(),this.evaluatePrintedVariables(),_.getItemContextSessionControl().getShowFeedback()&&this.evaluateFeedbacks()),console.log("[ProcessResponses][Completed]")},evaluateAttemptValidity(e){return e?(_.resetItemContextValidationMessages(),this.evaluateInteractionResponseValidity(_.getInteractions())):!0},evaluateInteractionResponseValidity(e){let t=!0;return e.forEach(i=>{i.isValidResponse||(_.addItemContextValidationMessage({identifier:i.identifier,message:i.invalidResponseMessage}),t=!1)}),t},bindCatalog(){this.catalogFactory!==null&&this.catalogFactory.bindAll()},setLang(e,t){t!==null&&e.setAttribute("lang",t)},coerceItemAttributes(){this.isTimeDependent=typeof this.timeDependent>"u"?!1:this.timeDependent==="true",this.isAdaptive=typeof this.adaptive>"u"?!1:this.adaptive==="true",this.lang=vT.parseXmlLangAttribute(this.$props["xml:lang"]),this.locale=this.lang===null?"en":this.lang},printOutcomeDeclarations(){_.getOutcomeDeclarations().forEach(e=>{(this.isAdaptive||e.identifier!=="completionStatus")&&console.log("[ProcessResponses][Outcomes]["+e.identifier+"][Value]",e.value)})}},errorCaptured(e,t){return console.log("["+e.name+"]["+t.$options.name+"] "+e.message),!1},created(){this.coerceItemAttributes()},mounted(){this.setLang(this.$refs.item,this.lang),this.catalogFactory=new wT(this,_),this.bindCatalog(),this.$parent.$emit("itemReady",{item:this})},beforeUnmount(){this.catalogFactory!==null&&this.catalogFactory.resetAll()}},TT={ref:"item",class:"qti-assessment-item"};function CT(e,t,i,s,n,r){const a=l.resolveComponent("event-listener");return l.openBlock(),l.createElementBlock("div",TT,[l.createVNode(a,{onTemplateProcessingReady:r.handleTemplateProcessingReady,onItemBodyReady:r.handleItemBodyReady},{default:l.withCtx(()=>[l.createElementVNode("div",null,[l.renderSlot(e.$slots,"default")])]),_:3},8,["onTemplateProcessingReady","onItemBodyReady"])],512)}const ST=B(ET,[["render",CT]]),Lo=new G,xT=new ie,_T={name:"QtiContextDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0}},data(){return{value:null,defaultValue:null,isQtiValid:!0,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getDefaultValue(){return this.defaultValue},getDeclarationContext(){return this.declarationContext},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}this.setValue(xT.nullValue())},reset(){this.initializeValue()},computeDeclarationContext(){var e,t,i;this.declarationContext=((i=(t=(e=this.$parent)==null?void 0:e.$parent)==null?void 0:t.$options)==null?void 0:i.name)==="QtiAssessmentTest"?"TEST":"ITEM"},getStore(){return this.declarationContext==="TEST"?it:_},validateChildren(){let e=!1;this.$slots.default&&this.$slots.default().forEach(t=>{if(Lo.isValidSlot(t)){if(t.type.name==="QtiDefaultValue"){if(!e)return e=!0;throw new c("Maximum of 1 qti-default-value element permitted")}throw new c('Element must be one of qti-default-value: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.component!==null){if(t.type.name==="QtiDefaultValue")return this.defaultValue=t.component.proxy.getValue();throw new c("["+t.type.name+'][Unhandled Child Node]: "'+t.type.name+'"')}})}},created:function(){try{this.computeDeclarationContext(),Lo.validateCardinality(this.cardinality),Lo.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),Lo.validateIdentifierAttribute(this.identifier),this.validateChildren(),this.getStore().defineContextDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:null,resetValue:this.reset,defaultValue:null})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted:function(){if(this.isQtiValid)try{this.processChildren(),this.initializeValue();const e={identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:this.getValue(),resetValue:this.reset,defaultValue:this.defaultValue};this.declarationContext==="TEST"?it.defineContextDeclaration(e):_.defineContextDeclaration(e),console.log("["+this.$options.name+"]["+this.identifier+"]["+this.declarationContext+"][DefaultValue]",this.defaultValue)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},IT=["identifier"];function VT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-context-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,IT)}const AT=B(_T,[["render",VT]]),Mo=new G,$T=new ie,LT={name:"QtiResponseDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0}},data(){return{value:null,state:null,defaultValue:null,correctResponse:null,mapping:null,areaMapping:null,isQtiValid:!0,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},getState(){return this.state},setState(e){this.state=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getDefaultValue(){return this.defaultValue},getCorrectResponse(){return this.correctResponse},getMapping(){return this.mapping},getAreaMapping(){return this.areaMapping},getDeclarationContext(){return"ITEM"},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}this.setValue($T.nullValue())},validateChildren(){let e=!1,t=!1,i=!1,s=!1;this.$slots.default&&this.$slots.default().forEach(n=>{if(Mo.isValidSlot(n)){if(n.type.name==="QtiCorrectResponse"){if(!e)return e=!0;throw new c("Maximum of 1 qti-correct-response element permitted")}if(n.type.name==="QtiDefaultValue"){if(!t)return t=!0;throw new c("Maximum of 1 qti-default-value element permitted")}if(n.type.name==="QtiMapping"){if(!i)return i=!0;throw new c("Maximum of 1 qti-mapping element permitted")}if(n.type.name==="QtiAreaMapping"){if(!s)return s=!0;throw new c("Maximum of 1 qti-area-mapping element permitted")}throw new c('Element must be one of qti-correct-response, qti-default-value, qti-mapping, qti-area-mapping: "'+n.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.component!==null){if(t.type.name==="QtiCorrectResponse")return this.correctResponse=t.component.proxy.getValue();if(t.type.name==="QtiDefaultValue")return this.defaultValue=t.component.proxy.getValue();if(t.type.name==="QtiMapping")return this.mapping=t.component.proxy;throw new c("["+t.type.name+'][Unhandled Child Node]: "'+t.type.name+'"')}})},getPriorState(e){const t=_.getItemContextStateVariable(e);if(console.log("[ResponseDeclaration]["+e+"][priorState]",t),t===null)return null;if(!("value"in t))throw new O('Variable Restore State Invalid. "value" property not found.');if(!("state"in t))throw new O('Variable Restore State Invalid. "state" property not found.');return this.setValue(t.value),this.setState(t.state),t}},created(){try{Mo.validateCardinality(this.cardinality),Mo.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),Mo.validateIdentifierAttribute(this.identifier),this.validateChildren(),_.defineResponseDeclaration({identifier:this.getIdentifier(),baseType:this.getBaseType(),cardinality:this.getCardinality(),value:null,state:null,defaultValue:null,correctResponse:null,mapping:null,areaMapping:null})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.getPriorState(this.identifier)===null&&this.initializeValue(),_.defineResponseDeclaration({identifier:this.getIdentifier(),baseType:this.getBaseType(),cardinality:this.getCardinality(),value:this.getValue(),state:this.getState(),defaultValue:this.getDefaultValue(),correctResponse:this.getCorrectResponse(),mapping:this.getMapping(),areaMapping:this.getAreaMapping()}),console.log("["+this.$options.name+"]["+this.identifier+"][CorrectResponse]",this.correctResponse,"[Mapping]",this.mapping)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},MT=["identifier"];function NT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"root",class:"qti-response-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,MT)}const RT=B(LT,[["render",NT]]),zs=new G,pp=new ie,kT={name:"QtiOutcomeDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0},view:{type:String,required:!1,default:null},interpretation:{type:String,required:!1,default:null},longInterpretation:{type:String,required:!1,default:null},normalMaximum:{type:String,required:!1},normalMinimum:{type:String,required:!1},masteryValue:{type:String,required:!1},externalScored:{type:String,required:!1,default:null},variableIdentifierRef:{type:String,required:!1,default:null}},data(){return{value:null,defaultValue:null,lookupTable:null,isQtiValid:!0,normalMaximumValue:null,normalMinimumValue:null,masteryValueValue:null,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getNormalMaximumValue(){return this.normalMaximumValue},getNormalMinimumValue(){return this.normalMinimumValue},getMasteryValueValue(){return this.masteryValueValue},getDefaultValue(){return this.defaultValue},getDeclarationContext(){return this.declarationContext},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}if(this.getCardinality()==="single"&&pp.isBaseTypeNumeric(this.getBaseType())){this.setValue(new X(0).toNumber());return}this.setValue(pp.nullValue())},reset(){this.initializeValue(),this.getStore().setOutcomeVariableValue({identifier:this.identifier,value:this.getValue()})},computeDeclarationContext(){var e,t,i;this.declarationContext=((i=(t=(e=this.$parent)==null?void 0:e.$parent)==null?void 0:t.$options)==null?void 0:i.name)==="QtiAssessmentTest"?"TEST":"ITEM"},getStore(){return this.declarationContext==="TEST"?it:_},validateChildren(){let e=!1,t=!1,i=!1;this.$slots.default&&this.$slots.default().forEach(s=>{if(zs.isValidSlot(s)){if(s.type.name==="QtiDefaultValue"){if(!e)return e=!0;throw new c("Maximum of 1 qti-default-value element permitted")}if(s.type.name==="QtiMatchTable"){if(i)throw new c("Maximum of 1 lookupTable permitted");if(!t)return t=!0;throw new c("Maximum of 1 qti-match-table element permitted")}if(s.type.name==="QtiInterpolationTable"){if(t)throw new c("Maximum of 1 lookupTable permitted");if(!i)return i=!0;throw new c("Maximum of 1 qti-interpolation-table element permitted")}throw new c('Element must be one of qti-default-value, qti-match-table, qti-interpolation-table: "'+s.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.component!==null){if(t.type.name==="QtiDefaultValue")return this.defaultValue=t.component.proxy.getValue();if(t.type.name==="QtiMatchTable"||t.type.name==="QtiInterpolationTable")return this.lookupTable=t.component.proxy;throw new c("["+this.$options.name+'][Unhandled Child Node]: "'+t.type.name+'"')}})}},created(){try{if(this.computeDeclarationContext(),zs.validateCardinality(this.cardinality),zs.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),zs.validateIdentifierAttribute(this.identifier),this.validateChildren(),this.normalMaximumValue=zs.validateFloatAttribute("normal-maximum",this.normalMaximum,!1,null),this.normalMaximumValue!==null&&this.normalMaximumValue<=0)throw new c('Outcome declaration "'+this.identifier+'" has invalid normal-maximum attribute value. Must be a positive value.');if(this.normalMinimumValue=zs.validateFloatAttribute("normal-minimum",this.normalMinimum,!1,null),this.masteryValueValue=zs.validateFloatAttribute("mastery-value",this.masteryValue,!1,null),this.identifier==="SCORE"||this.identifier==="MAXSCORE"){if(typeof this.baseType>"u"||this.baseType!=="float")throw new c('Outcome declaration "'+this.identifier+'" has invalid base-type. Must be base-type="float".');if(typeof this.cardinality>"u"||this.cardinality!=="single")throw new c('Outcome declaration "'+this.identifier+'" has invalid cardinality. Must be cardinality="single".')}this.getStore().defineOutcomeDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),view:this.view,interpretation:this.interpretation,longInterpretation:this.longInterpretation,normalMaximum:this.getNormalMaximumValue(),normalMinimum:this.getNormalMinimumValue(),masteryValue:this.getMasteryValueValue(),externalScored:this.externalScored,variableIdentifierRef:this.variableIdentifierRef,value:null,defaultValue:null,node:this})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.initializeValue();const e={identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),view:this.view,interpretation:this.interpretation,longInterpretation:this.longInterpretation,normalMaximum:this.getNormalMaximumValue(),normalMinimum:this.getNormalMinimumValue(),masteryValue:this.getMasteryValueValue(),externalScored:this.externalScored,variableIdentifierRef:this.variableIdentifierRef,value:this.getValue(),defaultValue:this.defaultValue,lookupTable:this.lookupTable,lookupTableType:this.lookupTableType,node:this};this.declarationContext==="TEST"?it.defineOutcomeDeclaration(e):_.defineOutcomeDeclaration(e),console.log("["+this.$options.name+"]["+this.identifier+"]["+this.declarationContext+"][DefaultValue]",this.defaultValue,"[lookupTable]",this.lookupTable)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},qT=["identifier"];function OT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-outcome-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,qT)}const BT=B(kT,[["render",OT]]),No=new G,PT=new ie,DT={name:"QtiTemplateDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0},paramVariable:{type:String,required:!1,default:"false"},mathVariable:{type:String,required:!1,default:"false"}},data(){return{value:null,defaultValue:null,isQtiValid:!0,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getDefaultValue(){return this.defaultValue},getDeclarationContext(){return"ITEM"},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}this.setValue(PT.nullValue())},reset(){this.initializeValue(),_.setTemplateVariableValue({identifier:this.identifier,value:this.getValue()})},validateChildren(){let e=!1;this.$slots.default&&this.$slots.default().forEach(t=>{if(No.isValidSlot(t)){if(t.type.name==="QtiDefaultValue"){if(!e)return e=!0;throw new c("Maximum of 1 qti-default-value element permitted")}throw new c('Element must be qti-default-value: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.type.name==="QtiDefaultValue"&&t.component!==null)return this.defaultValue=t.component.proxy.getValue();throw new c("["+t.type.name+'][Unhandled Child Node]: "'+t.type.name+'"')})},readChildren:function(){this.$children.forEach(e=>{switch(e.$el.className){case"qti-default-value":this.defaultValue=e.getValue();break;default:throw new c("["+this.$options.name+'][Unhandled Child Node]: "'+e.$el.className+'"')}})},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Variable Restore State Invalid. "value" property not found.');return this.setValue(t.value),t}},created:function(){try{No.validateCardinality(this.cardinality),No.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),No.validateIdentifierAttribute(this.identifier),this.validateChildren(),_.defineTemplateDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:null,defaultValue:null,paramVariable:this.paramVariable==="true",mathVariable:this.mathVariable==="true",node:this})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted:function(){if(this.isQtiValid)try{this.processChildren(),this.getPriorState(this.identifier)===null&&this.initializeValue(),_.defineTemplateDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:this.getValue(),defaultValue:this.getDefaultValue(),paramVariable:this.paramVariable==="true",mathVariable:this.mathVariable==="true",node:this}),console.log("["+this.$options.name+"]["+this.identifier+"][Value]",this.getValue())}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},QT=["identifier"];function HT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-template-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,QT)}const FT=B(DT,[["render",HT]]);function mp(e,t){return function(){return e.apply(t,arguments)}}const{toString:UT}=Object.prototype,{getPrototypeOf:Qc}=Object,Ro=(e=>t=>{const i=UT.call(t);return e[i]||(e[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),pi=e=>(e=e.toLowerCase(),t=>Ro(t)===e),ko=e=>t=>typeof t===e,{isArray:Nn}=Array,Dr=ko("undefined");function GT(e){return e!==null&&!Dr(e)&&e.constructor!==null&&!Dr(e.constructor)&&Qt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const gp=pi("ArrayBuffer");function jT(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&gp(e.buffer),t}const WT=ko("string"),Qt=ko("function"),yp=ko("number"),qo=e=>e!==null&&typeof e=="object",zT=e=>e===!0||e===!1,Oo=e=>{if(Ro(e)!=="object")return!1;const t=Qc(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},KT=pi("Date"),YT=pi("File"),XT=pi("Blob"),ZT=pi("FileList"),JT=e=>qo(e)&&Qt(e.pipe),eC=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Qt(e.append)&&((t=Ro(e))==="formdata"||t==="object"&&Qt(e.toString)&&e.toString()==="[object FormData]"))},tC=pi("URLSearchParams"),[iC,sC,nC,rC]=["ReadableStream","Request","Response","Headers"].map(pi),aC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Qr(e,t,{allOwnKeys:i=!1}={}){if(e===null||typeof e>"u")return;let s,n;if(typeof e!="object"&&(e=[e]),Nn(e))for(s=0,n=e.length;s<n;s++)t.call(null,e[s],s,e);else{const r=i?Object.getOwnPropertyNames(e):Object.keys(e),a=r.length;let o;for(s=0;s<a;s++)o=r[s],t.call(null,e[o],o,e)}}function wp(e,t){t=t.toLowerCase();const i=Object.keys(e);let s=i.length,n;for(;s-- >0;)if(n=i[s],t===n.toLowerCase())return n;return null}const Ks=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,bp=e=>!Dr(e)&&e!==Ks;function Hc(){const{caseless:e}=bp(this)&&this||{},t={},i=(s,n)=>{const r=e&&wp(t,n)||n;Oo(t[r])&&Oo(s)?t[r]=Hc(t[r],s):Oo(s)?t[r]=Hc({},s):Nn(s)?t[r]=s.slice():t[r]=s};for(let s=0,n=arguments.length;s<n;s++)arguments[s]&&Qr(arguments[s],i);return t}const oC=(e,t,i,{allOwnKeys:s}={})=>(Qr(t,(n,r)=>{i&&Qt(n)?e[r]=mp(n,i):e[r]=n},{allOwnKeys:s}),e),lC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),cC=(e,t,i,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),i&&Object.assign(e.prototype,i)},uC=(e,t,i,s)=>{let n,r,a;const o={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),r=n.length;r-- >0;)a=n[r],(!s||s(a,e,t))&&!o[a]&&(t[a]=e[a],o[a]=!0);e=i!==!1&&Qc(e)}while(e&&(!i||i(e,t))&&e!==Object.prototype);return t},hC=(e,t,i)=>{e=String(e),(i===void 0||i>e.length)&&(i=e.length),i-=t.length;const s=e.indexOf(t,i);return s!==-1&&s===i},dC=e=>{if(!e)return null;if(Nn(e))return e;let t=e.length;if(!yp(t))return null;const i=new Array(t);for(;t-- >0;)i[t]=e[t];return i},fC=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Qc(Uint8Array)),pC=(e,t)=>{const s=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=s.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},mC=(e,t)=>{let i;const s=[];for(;(i=e.exec(t))!==null;)s.push(i);return s},gC=pi("HTMLFormElement"),yC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,s,n){return s.toUpperCase()+n}),vp=(({hasOwnProperty:e})=>(t,i)=>e.call(t,i))(Object.prototype),wC=pi("RegExp"),Ep=(e,t)=>{const i=Object.getOwnPropertyDescriptors(e),s={};Qr(i,(n,r)=>{let a;(a=t(n,r,e))!==!1&&(s[r]=a||n)}),Object.defineProperties(e,s)},bC=e=>{Ep(e,(t,i)=>{if(Qt(e)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const s=e[i];if(Qt(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},vC=(e,t)=>{const i={},s=n=>{n.forEach(r=>{i[r]=!0})};return Nn(e)?s(e):s(String(e).split(t)),i},EC=()=>{},TC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Fc="abcdefghijklmnopqrstuvwxyz",Tp="0123456789",Cp={DIGIT:Tp,ALPHA:Fc,ALPHA_DIGIT:Fc+Fc.toUpperCase()+Tp},CC=(e=16,t=Cp.ALPHA_DIGIT)=>{let i="";const{length:s}=t;for(;e--;)i+=t[Math.random()*s|0];return i};function SC(e){return!!(e&&Qt(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const xC=e=>{const t=new Array(10),i=(s,n)=>{if(qo(s)){if(t.indexOf(s)>=0)return;if(!("toJSON"in s)){t[n]=s;const r=Nn(s)?[]:{};return Qr(s,(a,o)=>{const u=i(a,n+1);!Dr(u)&&(r[o]=u)}),t[n]=void 0,r}}return s};return i(e,0)},_C=pi("AsyncFunction"),IC=e=>e&&(qo(e)||Qt(e))&&Qt(e.then)&&Qt(e.catch),Sp=((e,t)=>e?setImmediate:t?((i,s)=>(Ks.addEventListener("message",({source:n,data:r})=>{n===Ks&&r===i&&s.length&&s.shift()()},!1),n=>{s.push(n),Ks.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",Qt(Ks.postMessage)),VC=typeof queueMicrotask<"u"?queueMicrotask.bind(Ks):typeof process<"u"&&process.nextTick||Sp,F={isArray:Nn,isArrayBuffer:gp,isBuffer:GT,isFormData:eC,isArrayBufferView:jT,isString:WT,isNumber:yp,isBoolean:zT,isObject:qo,isPlainObject:Oo,isReadableStream:iC,isRequest:sC,isResponse:nC,isHeaders:rC,isUndefined:Dr,isDate:KT,isFile:YT,isBlob:XT,isRegExp:wC,isFunction:Qt,isStream:JT,isURLSearchParams:tC,isTypedArray:fC,isFileList:ZT,forEach:Qr,merge:Hc,extend:oC,trim:aC,stripBOM:lC,inherits:cC,toFlatObject:uC,kindOf:Ro,kindOfTest:pi,endsWith:hC,toArray:dC,forEachEntry:pC,matchAll:mC,isHTMLForm:gC,hasOwnProperty:vp,hasOwnProp:vp,reduceDescriptors:Ep,freezeMethods:bC,toObjectSet:vC,toCamelCase:yC,noop:EC,toFiniteNumber:TC,findKey:wp,global:Ks,isContextDefined:bp,ALPHABET:Cp,generateString:CC,isSpecCompliantForm:SC,toJSONObject:xC,isAsyncFn:_C,isThenable:IC,setImmediate:Sp,asap:VC};function be(e,t,i,s,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),i&&(this.config=i),s&&(this.request=s),n&&(this.response=n,this.status=n.status?n.status:null)}F.inherits(be,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:F.toJSONObject(this.config),code:this.code,status:this.status}}});const xp=be.prototype,_p={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{_p[e]={value:e}}),Object.defineProperties(be,_p),Object.defineProperty(xp,"isAxiosError",{value:!0}),be.from=(e,t,i,s,n,r)=>{const a=Object.create(xp);return F.toFlatObject(e,a,function(u){return u!==Error.prototype},o=>o!=="isAxiosError"),be.call(a,e.message,t,i,s,n),a.cause=e,a.name=e.name,r&&Object.assign(a,r),a};const AC=null;function Uc(e){return F.isPlainObject(e)||F.isArray(e)}function Ip(e){return F.endsWith(e,"[]")?e.slice(0,-2):e}function Vp(e,t,i){return e?e.concat(t).map(function(n,r){return n=Ip(n),!i&&r?"["+n+"]":n}).join(i?".":""):t}function $C(e){return F.isArray(e)&&!e.some(Uc)}const LC=F.toFlatObject(F,{},null,function(t){return/^is[A-Z]/.test(t)});function Bo(e,t,i){if(!F.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,i=F.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,C){return!F.isUndefined(C[S])});const s=i.metaTokens,n=i.visitor||f,r=i.dots,a=i.indexes,u=(i.Blob||typeof Blob<"u"&&Blob)&&F.isSpecCompliantForm(t);if(!F.isFunction(n))throw new TypeError("visitor must be a function");function h(b){if(b===null)return"";if(F.isDate(b))return b.toISOString();if(!u&&F.isBlob(b))throw new be("Blob is not supported. Use a Buffer instead.");return F.isArrayBuffer(b)||F.isTypedArray(b)?u&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function f(b,S,C){let L=b;if(b&&!C&&typeof b=="object"){if(F.endsWith(S,"{}"))S=s?S:S.slice(0,-2),b=JSON.stringify(b);else if(F.isArray(b)&&$C(b)||(F.isFileList(b)||F.endsWith(S,"[]"))&&(L=F.toArray(b)))return S=Ip(S),L.forEach(function(D,E){!(F.isUndefined(D)||D===null)&&t.append(a===!0?Vp([S],E,r):a===null?S:S+"[]",h(D))}),!1}return Uc(b)?!0:(t.append(Vp(C,S,r),h(b)),!1)}const m=[],w=Object.assign(LC,{defaultVisitor:f,convertValue:h,isVisitable:Uc});function y(b,S){if(!F.isUndefined(b)){if(m.indexOf(b)!==-1)throw Error("Circular reference detected in "+S.join("."));m.push(b),F.forEach(b,function(L,x){(!(F.isUndefined(L)||L===null)&&n.call(t,L,F.isString(x)?x.trim():x,S,w))===!0&&y(L,S?S.concat(x):[x])}),m.pop()}}if(!F.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Ap(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function Gc(e,t){this._pairs=[],e&&Bo(e,this,t)}const $p=Gc.prototype;$p.append=function(t,i){this._pairs.push([t,i])},$p.toString=function(t){const i=t?function(s){return t.call(this,s,Ap)}:Ap;return this._pairs.map(function(n){return i(n[0])+"="+i(n[1])},"").join("&")};function MC(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Lp(e,t,i){if(!t)return e;const s=i&&i.encode||MC,n=i&&i.serialize;let r;if(n?r=n(t,i):r=F.isURLSearchParams(t)?t.toString():new Gc(t,i).toString(s),r){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+r}return e}class Mp{constructor(){this.handlers=[]}use(t,i,s){return this.handlers.push({fulfilled:t,rejected:i,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){F.forEach(this.handlers,function(s){s!==null&&t(s)})}}const Np={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},NC={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Gc,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},jc=typeof window<"u"&&typeof document<"u",Wc=typeof navigator=="object"&&navigator||void 0,RC=jc&&(!Wc||["ReactNative","NativeScript","NS"].indexOf(Wc.product)<0),kC=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",qC=jc&&window.location.href||"http://localhost",It={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:jc,hasStandardBrowserEnv:RC,hasStandardBrowserWebWorkerEnv:kC,navigator:Wc,origin:qC},Symbol.toStringTag,{value:"Module"})),...NC};function OC(e,t){return Bo(e,new It.classes.URLSearchParams,Object.assign({visitor:function(i,s,n,r){return It.isNode&&F.isBuffer(i)?(this.append(s,i.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}function BC(e){return F.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function PC(e){const t={},i=Object.keys(e);let s;const n=i.length;let r;for(s=0;s<n;s++)r=i[s],t[r]=e[r];return t}function Rp(e){function t(i,s,n,r){let a=i[r++];if(a==="__proto__")return!0;const o=Number.isFinite(+a),u=r>=i.length;return a=!a&&F.isArray(n)?n.length:a,u?(F.hasOwnProp(n,a)?n[a]=[n[a],s]:n[a]=s,!o):((!n[a]||!F.isObject(n[a]))&&(n[a]=[]),t(i,s,n[a],r)&&F.isArray(n[a])&&(n[a]=PC(n[a])),!o)}if(F.isFormData(e)&&F.isFunction(e.entries)){const i={};return F.forEachEntry(e,(s,n)=>{t(BC(s),n,i,0)}),i}return null}function DC(e,t,i){if(F.isString(e))try{return(t||JSON.parse)(e),F.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(i||JSON.stringify)(e)}const Hr={transitional:Np,adapter:["xhr","http","fetch"],transformRequest:[function(t,i){const s=i.getContentType()||"",n=s.indexOf("application/json")>-1,r=F.isObject(t);if(r&&F.isHTMLForm(t)&&(t=new FormData(t)),F.isFormData(t))return n?JSON.stringify(Rp(t)):t;if(F.isArrayBuffer(t)||F.isBuffer(t)||F.isStream(t)||F.isFile(t)||F.isBlob(t)||F.isReadableStream(t))return t;if(F.isArrayBufferView(t))return t.buffer;if(F.isURLSearchParams(t))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(r){if(s.indexOf("application/x-www-form-urlencoded")>-1)return OC(t,this.formSerializer).toString();if((o=F.isFileList(t))||s.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return Bo(o?{"files[]":t}:t,u&&new u,this.formSerializer)}}return r||n?(i.setContentType("application/json",!1),DC(t)):t}],transformResponse:[function(t){const i=this.transitional||Hr.transitional,s=i&&i.forcedJSONParsing,n=this.responseType==="json";if(F.isResponse(t)||F.isReadableStream(t))return t;if(t&&F.isString(t)&&(s&&!this.responseType||n)){const a=!(i&&i.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(o){if(a)throw o.name==="SyntaxError"?be.from(o,be.ERR_BAD_RESPONSE,this,null,this.response):o}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:It.classes.FormData,Blob:It.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};F.forEach(["delete","get","head","post","put","patch"],e=>{Hr.headers[e]={}});const QC=F.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),HC=e=>{const t={};let i,s,n;return e&&e.split(`
|
82
|
+
aria-labelledby="${t}">${s}</div>`}createIds(){const t={tabWrapperId:"",tabIds:[],tabPanelIds:[]};t.tabWrapperId="catalog-tabwrapper-"+this.randomString(5,"a");for(let i=0;i<3;i++){const s=this.randomString(5,"a");t.tabIds.push("catalog-"+i+"-tab-"+s),t.tabPanelIds.push("catalog-"+i+"-tabpanel-"+s)}return t}tabList(t,i,s){let n=[];return t&&n.push(this.constants.labels.GLOSSARY),i&&n.push(this.constants.labels.KEYWORD_TRANSLATION),s&&n.push(this.constants.labels.GLOSSARY_ILLUSTRATION),n}bindTabListEvents(){const t=document.getElementById(this.idList.tabWrapperId);if(t!==null&&(this.tabElements=t.querySelectorAll('[role="tab"]'),this.tabPanelElements=t.querySelectorAll('[role="tabpanel"]'),this.tabElements.length==this.tabPanelElements.length)){for(let i=0;i<this.tabElements.length;++i)this.addListeners(this.tabElements[i],this.tabPanelElements[i],i);this.bindTabAudioPlayers()}}unbindTabListEvents(){this.removeListeners(),this.unbindTabAudioPlayers()}bindTabAudioPlayers(){this.element.querySelectorAll("audio").forEach(i=>{const s=new _0(i).create();this.audioPlayers.push(s)},this)}unbindTabAudioPlayers(){this.audioPlayers.forEach(t=>{t.removeListeners()},this),this.audioPlayers.splice(0,this.audioPlayers.length)}addListeners(t,i,s){t.addEventListener("click",this.onTabClick),t.addEventListener("keydown",this.onKeyDown),t.addEventListener("keyup",this.onKeyUp),t.index=s}removeListeners(){this.tabElements.forEach(t=>{t.removeEventListener("click",this.onTabClick),t.removeEventListener("keydown",this.onKeyDown),t.removeEventListener("keyup",this.onKeyUp)},this)}tabClickHandler(t){var i=t.target;this.activateTab(i,!1)}keydownHandler(t){switch(t.keyCode){case this.constants.keys.END:t.preventDefault(),this.focusLastTab();break;case this.constants.keys.HOME:t.preventDefault(),this.focusFirstTab();break;case this.constants.keys.UP:case this.constants.keys.DOWN:this.switchTabOnArrowPress(t);break}}switchTabOnArrowPress(t){const i=t.keyCode;if(this.constants.direction[i]){let s=t.target;if(s.index!==void 0){if(this.tabElements[s.index+this.constants.direction[i]]){this.tabElements[s.index+this.constants.direction[i]].focus();return}if(i===this.constants.keys.LEFT||i===this.constants.keys.UP){this.focusLastTab();return}(i===this.constants.keys.RIGHT||i==this.constants.keys.DOWN)&&this.focusFirstTab()}}}keyupHandler(t){switch(t.keyCode){case this.constants.keys.LEFT:case this.constants.keys.RIGHT:this.switchTabOnArrowPress(t);break;case this.constants.keys.ENTER:case this.constants.keys.SPACE:this.activateTab(t.target);break}}activateTab(t,i){i=i||!0,this.deactivateTabs(),t.setAttribute("aria-selected","true");let s=t.getAttribute("aria-controls");document.getElementById(s).classList.remove("hidden"),i&&t.focus()}deactivateTabs(){this.audioPlayers.forEach(t=>{t.pause()},this),this.tabElements.forEach(t=>{t.setAttribute("aria-selected","false")},this),this.tabPanelElements.forEach(t=>{t.classList.add("hidden")},this)}focusFirstTab(){this.tabElements[0].focus()}focusLastTab(){this.tabElements[this.tabElements.length-1].focus()}randomString(t,i){i=i&&i.toLowerCase();let s="";const n=i=="a"?10:0,r=i=="n"?10:62;for(let a=0;a<t;a++){let o=Math.random()*(r-n)+n<<0;s+=String.fromCharCode(o+=o>9?o<36?55:61:48)}return s}}const B=(e,t)=>{const i=e.__vccOpts||e;for(const[s,n]of t)i[s]=n;return i},V0={name:"CatalogDialog",data(){return{state:{isShown:!1,dragging:!1,hidden:!0,xDiff:0,yDiff:0,x:0,y:0},content:{term:""},tabs:null}},methods:{setContent(e){this.resetDialogContent(),this.setDialogTerm(e.term),this.setDialogContent(e),this.createTabs(this.content)},setDialogContent(e){"data"in e&&e.data.forEach(t=>{switch(t.support){case"glossary-on-screen":this.setDialogGlossary(t.card);break;case"keyword-translation":this.setDialogKeywordTranslation(t.card);break;case"ext:sbac-glossary-illustration":this.setDialogGlossaryIllustration(t.card);break}},this)},resetDialogContent(){"glossary"in this.content&&delete this.content.glossary,"keywordTranslation"in this.content&&delete this.content.keywordTranslation,"glossaryIllustration"in this.content&&delete this.content.glossaryIllustration},setDialogTerm(e){this.content.term=e},setDialogGlossary(e){this.content.glossary=e},setDialogKeywordTranslation(e){this.content.keywordTranslation=e},setDialogGlossaryIllustration(e){this.content.glossaryIllustration=e},createTabs(e){this.tabs.create(e)},focusFirstTab(){this.tabs!==null&&this.tabs.focusFirstTab()},show(){this.state.hidden=!1,this.render(),this.focusFirstTab(),this.state.isShown||(this.state.isShown=!0,this.center())},hide(){this.state.hidden=!0,this.render()},center(){this.$refs.dialog.style.top=window.innerHeight/2-this.$refs.dialog.offsetHeight/2+"px",this.$refs.dialog.style.left=window.innerWidth/2-this.$refs.dialog.offsetWidth/2+"px"},reset(){this.state.x=0,this.state.y=0,this.state.isShown=!1,this.state.hidden=!0,this.render()},render(){this.state.hidden?this.$refs.dialog.style.display="none":this.$refs.dialog.style.display="",this.$refs.dialog.style.transform="translate("+this.state.x+"px, "+this.state.y+"px)"},addListeners(){this.$refs.header.addEventListener("mousedown",this.onMouseDown.bind(this)),this.$refs.header.addEventListener("mousemove",this.onMouseMove.bind(this)),this.$refs.header.addEventListener("mouseup",this.onMouseUp.bind(this)),this.$refs.header.addEventListener("mouseleave",this.onMouseUp.bind(this)),this.$refs.header.addEventListener("touchstart",this.onTouchStart.bind(this)),this.$refs.header.addEventListener("touchmove",this.onTouchMove.bind(this)),this.$refs.header.addEventListener("touchend",this.onTouchEnd.bind(this)),this.$refs.close.addEventListener("click",this.hide.bind(this)),this.$refs.close.addEventListener("touchend",this.hide.bind(this))},removeListeners(){this.$refs.header.removeEventListener("mousedown",this.onMouseDown),this.$refs.header.removeEventListener("mousemove",this.onMouseMove),this.$refs.header.removeEventListener("mouseup",this.onMouseUp),this.$refs.header.removeEventListener("mouseleave",this.onMouseUp),this.$refs.header.removeEventListener("touchstart",this.onTouchStart),this.$refs.header.removeEventListener("touchmove",this.onTouchMove),this.$refs.header.removeEventListener("touchend",this.onTouchEnd),this.$refs.close.removeEventListener("click",this.hide),this.$refs.close.removeEventListener("touchend",this.hide)},onMouseDown(e){this.state.dragging=!0,this.state.xDiff=e.pageX-this.state.x,this.state.yDiff=e.pageY-this.state.y},onTouchStart(e){e.preventDefault(),this.state.dragging=!0,this.state.xDiff=e.targetTouches[0].pageX-this.state.x,this.state.yDiff=e.targetTouches[0].pageY-this.state.y},onMouseMove(e){this.state.dragging&&(this.state.x=e.pageX-this.state.xDiff,this.state.y=e.pageY-this.state.yDiff),this.render()},onTouchMove(e){e.preventDefault(),e.stopPropagation(),this.state.dragging&&(this.state.x=e.targetTouches[0].pageX-this.state.xDiff,this.state.y=e.targetTouches[0].pageY-this.state.yDiff),this.render()},onMouseUp(){this.state.dragging=!1},onTouchEnd(e){e.preventDefault(),this.state.dragging=!1}},mounted(){this.tabs=new I0(this.$refs.body),this.addListeners()},beforeUnmount(){this.tabs.removeListeners(),this.removeListeners()}},A0={ref:"dialog",class:"qti3-player-cat-dialog",role:"dialog",style:{display:"none"}},$0={ref:"header",class:"qti3-player-cat-dialog-header"},L0={class:"qti3-player-cat-dialog-term"},M0={ref:"close",type:"button",class:"qti3-player-cat-dialog-close","aria-label":"Close"},N0={ref:"body",class:"qti3-player-cat-dialog-body"};function R0(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",A0,[l.createElementVNode("div",$0,[l.createElementVNode("span",L0,l.toDisplayString(n.content.term),1),l.createElementVNode("button",M0,"×",512)],512),l.createElementVNode("div",N0,null,512)],512)}const k0=B(V0,[["render",R0]]),q0={name:"AmpStyle",render(){return l.h("style",{},this.$slots.default())}},O0=new G,B0={name:"AmpAudio",emits:["mediaLoaded","mediaEnded","mediaMounted"],props:{},data(){return{audio:null,audioSubType:null,currentTime:0,duration:0,displayCurrentTime:"00:00",displayDuration:"00:00",audioLoaded:!1,isPlaying:!1,isMuted:!1,isTimeUpdateListening:!0,showPlayTimer:!1,showVolumeMute:!1,showProgress:!1,showCaptions:!1,textTracksMap:null,mediaInteractionChild:!1,isDisabled:!1,isQtiValid:!0}},methods:{disable(){this.isDisabled=!0,this.pauseAudio(),this.disableController()},enable(){this.isDisabled=!1,this.enableController()},disableController(){this.$refs.playpause.setAttribute("tabindex","-1"),this.$refs.playpause.classList.add("disabled"),this.$refs.progress.setAttribute("tabindex","-1"),this.$refs.progress.classList.add("disabled"),this.$refs.volume.setAttribute("tabindex","-1"),this.$refs.volume.classList.add("disabled"),this.$refs.playtimer.classList.add("disabled")},enableController(){this.$refs.playpause.setAttribute("tabindex","0"),this.$refs.playpause.classList.remove("disabled"),(this.isMediaInteractionChild()||this.audioSubType==="audioprogress")&&(this.$refs.progress.setAttribute("tabindex","0"),this.$refs.progress.classList.remove("disabled"),this.$refs.volume.setAttribute("tabindex","0"),this.$refs.volume.classList.remove("disabled"),this.$refs.playtimer.classList.remove("disabled"))},handleLoaded(){this.audio&&(this.addControllerEventListeners(),this.duration=Math.round(this.audio.duration),this.displayDuration=this.convertTime(this.duration),this.isMediaInteractionChild()&&this.$parent.$emit("mediaLoaded",{node:this}))},handleEnded(){this.isPlaying=!1,this.isMediaInteractionChild()&&this.$parent.$emit("mediaEnded",{})},handleCanPlay(){this.audioLoaded=!0},handleTimeUpdate(){if(!this.isTimeUpdateListening)return;let e=Math.round(this.audio.currentTime);this.currentTime=e,this.displayCurrentTime=this.convertTime(e)},handlePlayPauseClick(){this.isDisabled||this.toggleAudio()},handlePlayPauseKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleAudio(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleProgressMouseDown(){this.isDisabled||(this.isTimeUpdateListening=!1,this.audio.paused?this.wasPlaying=!1:(this.wasPlaying=!0,this.audio.pause(),this.isPlaying=!1))},handleProgressInput(e){this.isDisabled||(this.displayCurrentTime=this.convertTime(e.target.valueAsNumber))},handleProgressChange(e){this.isDisabled||(this.setPosition(e.target.valueAsNumber),this.isTimeUpdateListening=!0,this.wasPlaying&&this.audio.paused&&(this.wasPlaying=!1,this.toggleAudio()))},handleVolumeMuteClick(){this.isDisabled||this.toggleVolume()},handleVolumeMuteKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleVolume(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleCueChange(e){const t=e.target.activeCues;if(t.length>0&&this.showCaptions){const i=t[0].text.replace(/\n/g,"<br/>");console.log("[AmpAudio][currentCue]",i),this.$refs.captions.innerHTML=i}},setPosition(e){this.audio.currentTime=e,this.displayCurrentTime=this.convertTime(e)},toggleAudio(){this.audio&&(this.isPlaying?(this.isPlaying=!1,this.audio.pause()):(this.isPlaying=!0,this.audio.play()))},playAudio(){this.audio&&(this.audio.play(),this.isPlaying=!0)},pauseAudio(){this.audio&&(this.audio.pause(),this.isPlaying=!1)},toggleVolume(){this.audio&&(this.audio.muted?(this.audio.muted=!1,this.isMuted=!1):(this.audio.muted=!0,this.isMuted=!0))},initSlider(){this.audio&&(this.duration=Math.round(this.audio.duration))},convertTime(e){let t=new Date(e*1e3).toISOString().substr(11,8);return t.indexOf("00:")===0&&(t=t.substr(3)),t},setAudioSubType(e){this.audioSubType=e,this.audioSubType==="audioprogress"&&(this.showProgress=!0,this.showPlayTimer=!0,this.showVolumeMute=!0)},getAudioSubType(e){if(e===null)return null;const t=e.class;if(typeof t>"u"||t===null||t.length==0)return null;const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case"sbaudio":case"audioprogress":return this.showProgress=!0,this.showPlayTimer=!0,this.showVolumeMute=!0,"audioprogress"}return null},detectAudioSubType(e){return this.getAudioSubType(e)},isMediaInteractionChild(){return this.mediaInteractionChild},detectMediaInteractionChild(){this.mediaInteractionChild=this.$parent.$el.classList.contains("qti3-player-media-group")},processChildren(){this.audio=this.$refs.player,this.audio.removeAttribute("controls"),this.audio.removeAttribute("autoplay"),this.textTracksMap=this.filterTextTracks(this.audio.querySelectorAll("track"))},filterTextTracks(e){let t=new Map;return e.forEach(i=>{switch(i.getAttribute("kind")){case"subtitles":case"captions":i.hasAttribute("id")||i.setAttribute("id","track-"+O0.randomString(5,"a")),t.set(i.getAttribute("id"),i);break}},this),t},isDefaultTextTrack(e){return e.hasAttribute("default")},addTextTrackCueEventListener(){this.audio&&this.audio.textTracks.length!==0&&this.audio.textTracks.forEach(e=>{const t=this.textTracksMap.get(e.id);if(typeof t<"u"&&this.isDefaultTextTrack(t)){e.addEventListener("cuechange",this.handleCueChange);return}},this)},removeTextTrackCueEventListener(){this.audio&&this.audio.textTracks.length!==0&&this.audio.textTracks.forEach(e=>{const t=this.textTracksMap.get(e.id);if(typeof t<"u"&&this.isDefaultTextTrack(t)){e.removeEventListener("cuechange",this.handleCueChange);return}},this)},addControllerEventListeners(){this.$refs.playpause.addEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.addEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.addEventListener("input",this.handleProgressInput),this.$refs.progress.addEventListener("change",this.handleProgressChange),this.$refs.progress.addEventListener("mousedown",this.handleProgressMouseDown),this.$refs.volume.addEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.addEventListener("keydown",this.handleVolumeMuteKeydown)},removeControllerEventListeners(){this.$refs.playpause.removeEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.removeEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.removeEventListener("input",this.handleProgressInput),this.$refs.progress.removeEventListener("change",this.handleProgressChange),this.$refs.progress.removeEventListener("mousedown",this.handleProgressMouseDown),this.$refs.volume.removeEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.removeEventListener("keydown",this.handleVolumeMuteKeydown)}},created(){this.setAudioSubType(this.detectAudioSubType(this.$.vnode.props))},mounted(){if(this.isQtiValid)try{if(this.detectMediaInteractionChild(),this.processChildren(),this.$nextTick(function(){this.audio&&(this.audio.addEventListener("loadedmetadata",this.handleLoaded),this.audio.addEventListener("canplay",this.handleCanPlay),this.audio.addEventListener("timeupdate",this.handleTimeUpdate),this.audio.addEventListener("ended",this.handleEnded),this.addTextTrackCueEventListener())}),this.isMediaInteractionChild()){this.$parent.$emit("mediaMounted",{node:this,mediaType:"audio"});return}this.enable()}catch(e){throw this.isQtiValid=!1,new c(e.message)}},beforeUnmount(){this.audio&&(this.audio.removeEventListener("loadedmetadata",this.handleLoaded),this.audio.removeEventListener("canplay",this.handleCanPlay),this.audio.removeEventListener("timeupdate",this.handleTimeUpdate),this.audio.removeEventListener("ended",this.handleEnded),this.removeTextTrackCueEventListener()),this.removeControllerEventListeners()}},P0={class:"amp-audio"},D0={class:"amp-audio__holder"},Q0={ref:"controller",class:"amp-audio__container"},H0={ref:"playpause",class:"amp-audio-playpause__container"},F0={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},U0={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},G0={ref:"playtimer",class:"amp-playtimer__container"},j0={class:"amp-progress__container"},W0=["max"],z0={ref:"volume",class:"amp-video-volumemute__container","aria-label":"Volume mute or unmute"},K0={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512"},Y0={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},X0={class:"amp-audio-captions__container hidden"},Z0={class:"amp-audio-captions",ref:"captions"};function J0(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",P0,[l.createElementVNode("div",D0,[l.createElementVNode("audio",l.mergeProps({ref:"player",tabIndex:"-1"},e.$attrs),[l.renderSlot(e.$slots,"default",{},void 0,!0)],16)]),l.createElementVNode("div",Q0,[l.createElementVNode("button",H0,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",F0,t[1]||(t[1]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,!n.isPlaying]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",U0,t[2]||(t[2]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zM7 8a1 1 0 012 0v4a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,n.isPlaying]])],512),l.withDirectives(l.createElementVNode("div",G0,[l.createElementVNode("span",null,l.toDisplayString(n.displayCurrentTime),1),t[3]||(t[3]=l.createElementVNode("span",null," / ",-1)),l.createElementVNode("span",null,l.toDisplayString(n.displayDuration),1)],512),[[l.vShow,n.showPlayTimer]]),l.withDirectives(l.createElementVNode("div",j0,[l.withDirectives(l.createElementVNode("input",{ref:"progress","onUpdate:modelValue":t[0]||(t[0]=a=>n.currentTime=a),type:"range",min:"0",max:n.duration,class:"slider"},null,8,W0),[[l.vModelText,n.currentTime]])],512),[[l.vShow,n.showProgress]]),l.withDirectives(l.createElementVNode("div",z0,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",K0,t[4]||(t[4]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zm233.32-51.08c-11.17-7.33-26.18-4.24-33.51 6.95-7.34 11.17-4.22 26.18 6.95 33.51 66.27 43.49 105.82 116.6 105.82 195.58 0 78.98-39.55 152.09-105.82 195.58-11.17 7.32-14.29 22.34-6.95 33.5 7.04 10.71 21.93 14.56 33.51 6.95C528.27 439.58 576 351.33 576 256S528.27 72.43 448.35 19.97zM480 256c0-63.53-32.06-121.94-85.77-156.24-11.19-7.14-26.03-3.82-33.12 7.46s-3.78 26.21 7.41 33.36C408.27 165.97 432 209.11 432 256s-23.73 90.03-63.48 115.42c-11.19 7.14-14.5 22.07-7.41 33.36 6.51 10.36 21.12 15.14 33.12 7.46C447.94 377.94 480 319.54 480 256zm-141.77-76.87c-11.58-6.33-26.19-2.16-32.61 9.45-6.39 11.61-2.16 26.2 9.45 32.61C327.98 228.28 336 241.63 336 256c0 14.38-8.02 27.72-20.92 34.81-11.61 6.41-15.84 21-9.45 32.61 6.43 11.66 21.05 15.8 32.61 9.45 28.23-15.55 45.77-45 45.77-76.88s-17.54-61.32-45.78-76.86z"},null,-1)]),512)),[[l.vShow,!n.isMuted]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",Y0,t[5]||(t[5]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z"},null,-1)]),512)),[[l.vShow,n.isMuted]])],512),[[l.vShow,n.showVolumeMute]])],512),l.createElementVNode("div",X0,[l.createElementVNode("div",Z0,null,512)])])}const eT=B(B0,[["render",J0],["__scopeId","data-v-a1958132"]]),tT=new G,iT={name:"AmpVideo",emits:["mediaLoaded","mediaEnded","mediaMounted"],props:{},data(){return{video:null,playerSubType:null,currentTime:0,duration:0,displayCurrentTime:"00:00",displayDuration:"00:00",videoLoaded:!1,isPlaying:!1,isMuted:!1,isTimeUpdateListening:!0,showPlayTimer:!1,showVolumeMute:!1,showProgress:!1,showCaptions:!1,textTracksMap:null,mediaInteractionChild:!1,subtitlesMenu:null,subtitleMenuButtons:[],isDisabled:!1,isQtiValid:!0}},methods:{disable(){this.isDisabled=!0,this.pauseVideo(),this.disableController()},enable(){this.isDisabled=!1,this.enableController()},disableController(){this.$refs.playpause.setAttribute("tabindex","-1"),this.$refs.playpause.classList.add("disabled"),this.$refs.progress.setAttribute("tabindex","-1"),this.$refs.progress.classList.add("disabled"),this.$refs.cc.setAttribute("tabindex","-1"),this.$refs.cc.classList.add("disabled"),this.$refs.volume.setAttribute("tabindex","-1"),this.$refs.volume.classList.add("disabled"),this.$refs.playtimer.classList.add("disabled")},enableController(){this.$refs.playpause.setAttribute("tabindex","0"),this.$refs.playpause.classList.remove("disabled"),this.$refs.progress.setAttribute("tabindex","0"),this.$refs.progress.classList.remove("disabled"),this.$refs.cc.setAttribute("tabindex","0"),this.$refs.cc.classList.remove("disabled"),this.$refs.volume.setAttribute("tabindex","0"),this.$refs.volume.classList.remove("disabled"),this.$refs.playtimer.classList.remove("disabled")},handleLoaded(){this.video&&(this.addControllerEventListeners(),this.duration=Math.round(this.video.duration),this.displayDuration=this.convertTime(this.duration),this.isMediaInteractionChild()&&this.$parent.$emit("mediaLoaded",{node:this}))},handleEnded(){this.isPlaying=!1,this.isMediaInteractionChild()&&this.$parent.$emit("mediaEnded",{})},handleCanPlay(){this.videoLoaded=!0},handleTimeUpdate(){if(!this.isTimeUpdateListening||!this.video)return;let e=Math.round(this.video.currentTime);this.currentTime=e,this.displayCurrentTime=this.convertTime(e)},handlePlayPauseClick(){this.isDisabled||this.toggleVideo()},handlePlayPauseKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleVideo(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleProgressMouseDown(){this.isDisabled||(this.isTimeUpdateListening=!1,this.video.paused?this.wasPlaying=!1:(this.wasPlaying=!0,this.video.pause(),this.isPlaying=!1))},handleProgressInput(e){this.isDisabled||(this.displayCurrentTime=this.convertTime(e.target.valueAsNumber))},handleProgressChange(e){this.isDisabled||(this.setPosition(e.target.valueAsNumber),this.isTimeUpdateListening=!0,this.wasPlaying&&this.video.paused&&(this.wasPlaying=!1,this.toggleVideo()))},handleCaptionsClick(){this.isDisabled||this.toggleCaptionsMenu()},handleCaptionsKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleCaptionsMenu(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},toggleCaptionsMenu(){this.subtitlesMenu.style.display=this.subtitlesMenu.style.display==="block"?"none":"block"},handleVolumeMuteClick(){this.isDisabled||this.toggleVolume()},handleVolumeMuteKeydown(e){if(this.isDisabled)return;let t=!1;switch(e.code){case"Space":case"Enter":this.toggleVolume(),t=!0;break}t&&(e.stopPropagation(),e.preventDefault())},handleCueChange(){},setPosition(e){this.video.currentTime=e,this.displayCurrentTime=this.convertTime(e)},toggleVideo(){this.video&&(this.isPlaying?(this.isPlaying=!1,this.video.pause()):(this.isPlaying=!0,this.video.play()))},playVideo(){this.video&&(this.video.play(),this.isPlaying=!0)},pauseVideo(){this.video&&(this.video.pause(),this.isPlaying=!1)},toggleVolume(){this.video&&(this.video.muted?(this.video.muted=!1,this.isMuted=!1):(this.video.muted=!0,this.isMuted=!0))},initSlider(){this.video&&(this.duration=Math.round(this.video.duration))},convertTime(e){let t=new Date(e*1e3).toISOString().substr(11,8);return t.indexOf("00:")===0&&(t=t.substr(3)),t},getPlayerSubType(){return this.showProgress=!0,this.showPlayTimer=!0,this.showVolumeMute=!0,"ampvideo-default"},detectPlayerSubType(e){return this.getPlayerSubType(e)},isMediaInteractionChild(){return this.mediaInteractionChild},detectMediaInteractionChild(){this.mediaInteractionChild=this.$parent.$el.classList.contains("qti3-player-media-group")},processChildren(){if(this.video=this.$refs.player,this.video.removeAttribute("controls"),this.video.removeAttribute("autoplay"),this.video.hasAttribute("width")){const e=`${this.video.getAttribute("width")}`,t=e.endsWith("%")?`width:${e}`:`width:${e}px`;this.$refs.videocontainer.setAttribute("style",t),this.$refs.controller.setAttribute("style",t)}else this.video.setAttribute("width","100%");this.textTracksMap=this.filterTextTracks(this.video.querySelectorAll("track"))},filterTextTracks(e){let t=new Map;return e.forEach(i=>{switch(i.getAttribute("kind")){case"subtitles":case"captions":i.hasAttribute("id")||i.setAttribute("id","track-"+tT.randomString(5,"a")),t.set(i.getAttribute("id"),i);break}},this),t},isDefaultTextTrack(e){return e.hasAttribute("default")},addTextTrackCueEventListener(){if(this.video&&this.video.textTracks.length!==0){this.showCaptions=!0,this.initializeSubtitlesMenu();for(let e=0;e<this.video.textTracks.length;e++){const t=this.video.textTracks[e];t.mode="hidden",this.addSubtitlesMenuItem(t),typeof this.textTracksMap.get(t.id)<"u"&&t.addEventListener("cuechange",this.handleCueChange)}this.$refs.videocontainer.appendChild(this.subtitlesMenu)}},removeTextTrackCueEventListener(){if(this.video&&this.video.textTracks.length!==0){this.subtitleMenuButtons.forEach(e=>{e.removeEventListener("click",this.handleSubtitleButtonClick)});for(let e=0;e<this.video.textTracks.length;e++){const t=this.video.textTracks[e];typeof this.textTracksMap.get(t.id)<"u"&&t.removeEventListener("cuechange",this.handleCueChange)}}},initializeSubtitlesMenu(){const e=document.createDocumentFragment();this.subtitlesMenu=e.appendChild(document.createElement("ul")),this.subtitlesMenu.className="ampvideo-subtitles-menu",this.subtitlesMenu.appendChild(this.createMenuItem("subtitles-off","","Off"))},addSubtitlesMenuItem(e){this.subtitlesMenu.appendChild(this.createMenuItem(`subtitles-${e.language}`,e.language,e.label))},createMenuItem(e,t,i){const s=document.createElement("li"),n=s.appendChild(document.createElement("button"));return n.setAttribute("id",e),n.className="ampvideo-subtitles-button",t.length>0&&n.setAttribute("lang",t),n.value=i,t===""?n.setAttribute("data-state","active"):n.setAttribute("data-state","inactive"),n.appendChild(document.createTextNode(i)),n.addEventListener("click",this.handleSubtitleButtonClick),this.subtitleMenuButtons.push(n),s},handleSubtitleButtonClick(e){const t=e.currentTarget;this.subtitleMenuButtons.forEach(s=>{s.setAttribute("data-state","inactive")});const i=t.getAttribute("lang");for(let s=0;s<this.video.textTracks.length;s++)this.video.textTracks[s].language===i?(this.video.textTracks[s].mode="showing",t.setAttribute("data-state","active")):this.video.textTracks[s].mode="hidden";i===null&&t.setAttribute("data-state","active"),this.subtitlesMenu.style.display="none"},addControllerEventListeners(){this.$refs.playpause.addEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.addEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.addEventListener("input",this.handleProgressInput),this.$refs.progress.addEventListener("change",this.handleProgressChange),this.$refs.progress.addEventListener("mousedown",this.handleProgressMouseDown),this.$refs.cc.addEventListener("click",this.handleCaptionsClick),this.$refs.cc.addEventListener("keydown",this.handleCaptionsKeydown),this.$refs.volume.addEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.addEventListener("keydown",this.handleVolumeMuteKeydown)},removeControllerEventListeners(){this.$refs.playpause.removeEventListener("click",this.handlePlayPauseClick),this.$refs.playpause.removeEventListener("keydown",this.handlePlayPauseKeydown),this.$refs.progress.removeEventListener("input",this.handleProgressInput),this.$refs.progress.removeEventListener("change",this.handleProgressChange),this.$refs.progress.removeEventListener("mousedown",this.handleProgressMouseDown),this.$refs.cc.removeEventListener("click",this.handleCaptionsClick),this.$refs.cc.removeEventListener("keydown",this.handleCaptionsKeydown),this.$refs.volume.removeEventListener("click",this.handleVolumeMuteClick),this.$refs.volume.removeEventListener("keydown",this.handleVolumeMuteKeydown)}},created(){this.playerSubType=this.detectPlayerSubType(this.$.vnode.props)},mounted(){if(this.isQtiValid)try{if(this.detectMediaInteractionChild(),this.processChildren(),this.$nextTick(function(){this.video&&(this.video.addEventListener("loadedmetadata",this.handleLoaded),this.video.addEventListener("canplay",this.handleCanPlay),this.video.addEventListener("timeupdate",this.handleTimeUpdate),this.video.addEventListener("ended",this.handleEnded),this.addTextTrackCueEventListener())}),this.isMediaInteractionChild()){this.$parent.$emit("mediaMounted",{node:this,mediaType:"video"});return}this.enable()}catch(e){throw this.isQtiValid=!1,new c(e.message)}},beforeUnmount(){this.video&&(this.video.removeEventListener("loadedmetadata",this.handleLoaded),this.video.removeEventListener("canplay",this.handleCanPlay),this.video.removeEventListener("timeupdate",this.handleTimeUpdate),this.video.removeEventListener("ended",this.handleEnded),this.removeTextTrackCueEventListener()),this.removeControllerEventListeners()}},sT={ref:"videocontainer",class:"amp-video"},nT={class:"amp-video__holder"},rT={ref:"controller",class:"amp-video__container"},aT={ref:"playpause",class:"amp-video-playpause__container"},oT={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},lT={class:"amp-playpause-button",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},cT={ref:"playtimer",class:"amp-playtimer__container"},uT={class:"amp-progress__container"},hT=["max"],dT={ref:"cc",class:"amp-video-cc__container","aria-label":"Captions menu"},fT={ref:"volume",class:"amp-video-volumemute__container","aria-label":"Volume mute or unmute"},pT={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512"},mT={class:"amp-volumemute-button","aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"};function gT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",sT,[l.createElementVNode("div",nT,[l.createElementVNode("video",l.mergeProps({ref:"player",tabIndex:"-1",class:"amp-video__video"},e.$attrs),[l.renderSlot(e.$slots,"default")],16)]),l.createElementVNode("div",rT,[l.createElementVNode("button",aT,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",oT,t[1]||(t[1]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,!n.isPlaying]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",lT,t[2]||(t[2]=[l.createElementVNode("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zM7 8a1 1 0 012 0v4a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"},null,-1)]),512)),[[l.vShow,n.isPlaying]])],512),l.withDirectives(l.createElementVNode("div",cT,[l.createElementVNode("span",null,l.toDisplayString(n.displayCurrentTime),1),t[3]||(t[3]=l.createElementVNode("span",null," / ",-1)),l.createElementVNode("span",null,l.toDisplayString(n.displayDuration),1)],512),[[l.vShow,n.showPlayTimer]]),l.withDirectives(l.createElementVNode("div",uT,[l.withDirectives(l.createElementVNode("input",{ref:"progress","onUpdate:modelValue":t[0]||(t[0]=a=>n.currentTime=a),type:"range",min:"0",max:n.duration,class:"slider"},null,8,hT),[[l.vModelText,n.currentTime]])],512),[[l.vShow,n.showProgress]]),l.withDirectives(l.createElementVNode("div",dT," CC ",512),[[l.vShow,n.showCaptions]]),l.withDirectives(l.createElementVNode("div",fT,[l.withDirectives((l.openBlock(),l.createElementBlock("svg",pT,t[4]||(t[4]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zm233.32-51.08c-11.17-7.33-26.18-4.24-33.51 6.95-7.34 11.17-4.22 26.18 6.95 33.51 66.27 43.49 105.82 116.6 105.82 195.58 0 78.98-39.55 152.09-105.82 195.58-11.17 7.32-14.29 22.34-6.95 33.5 7.04 10.71 21.93 14.56 33.51 6.95C528.27 439.58 576 351.33 576 256S528.27 72.43 448.35 19.97zM480 256c0-63.53-32.06-121.94-85.77-156.24-11.19-7.14-26.03-3.82-33.12 7.46s-3.78 26.21 7.41 33.36C408.27 165.97 432 209.11 432 256s-23.73 90.03-63.48 115.42c-11.19 7.14-14.5 22.07-7.41 33.36 6.51 10.36 21.12 15.14 33.12 7.46C447.94 377.94 480 319.54 480 256zm-141.77-76.87c-11.58-6.33-26.19-2.16-32.61 9.45-6.39 11.61-2.16 26.2 9.45 32.61C327.98 228.28 336 241.63 336 256c0 14.38-8.02 27.72-20.92 34.81-11.61 6.41-15.84 21-9.45 32.61 6.43 11.66 21.05 15.8 32.61 9.45 28.23-15.55 45.77-45 45.77-76.88s-17.54-61.32-45.78-76.86z"},null,-1)]),512)),[[l.vShow,!n.isMuted]]),l.withDirectives((l.openBlock(),l.createElementBlock("svg",mT,t[5]||(t[5]=[l.createElementVNode("path",{fill:"currentColor",d:"M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z"},null,-1)]),512)),[[l.vShow,n.isMuted]])],512),[[l.vShow,n.showVolumeMute]])],512)],512)}const yT=B(iT,[["render",gT]]);class wT{constructor(t,i){J(this,"constants",{supports:{GLOSSARY:"glossary-on-screen",KEYWORD_TRANSLATION:"keyword-translation",EXT_SBAC_GLOSSARY_ILLUSTRATION:"ext:sbac-glossary-illustration"},GLOSSARY_CLICKABLE_CLASS:"qti3-player-catalog-clickable-term",LANGUAGE_OFF:"",keys:{ENTER:13,SPACE:32}});return this.item=t,this.itemElement=t.$refs.item,this.store=i,this.nodeList=null,this.showGlossary=this.showGlossaryHandler.bind(this),this.onKeyDown=this.keydownHandler.bind(this),this}bindAll(){this.store.getCatalogs().length!==0&&(this.resetAll(),this.nodeList=this.itemElement.querySelectorAll("[data-catalog-idref]"),this.nodeList.length!==0&&this.bindGlossary(this.nodeList))}resetAll(){this.nodeList!==null&&(this.nodeList.forEach(t=>{this.unbindGlossaryDOM(t)},this),this.nodeList=null)}getPnpGlossarySupports(t){let i=[];return t.getGlossaryOnScreen()&&i.push(this.constants.supports.GLOSSARY),t.getKeywordTranslationLanguage()!==this.constants.LANGUAGE_OFF&&i.push(`${this.constants.supports.KEYWORD_TRANSLATION}:${t.getKeywordTranslationLanguage()}`),t.getExtSbacGlossaryIllustration()&&i.push(this.constants.supports.EXT_SBAC_GLOSSARY_ILLUSTRATION),i}bindGlossary(t){const i=this.getPnpGlossarySupports(this.store.getItemContextPnp());i.length!==0&&t.forEach(s=>{this.bindGlossaryNode(s,i)},this)}bindGlossaryNode(t,i){const s=t.getAttribute("data-catalog-idref"),n=this.store.getCatalog(s);typeof n>"u"||this.hasCatalogGlossarySupport(n,i)&&this.bindGlossaryDOM(t)}bindGlossaryDOM(t){t.classList.contains(this.constants.GLOSSARY_CLICKABLE_CLASS)||(t.classList.add(this.constants.GLOSSARY_CLICKABLE_CLASS),t.setAttribute("tabindex","0"),this.setGlossaryTerm(t),t.addEventListener("click",this.showGlossary),t.addEventListener("touchend",this.showGlossary),t.addEventListener("keydown",this.onKeyDown))}unbindGlossaryDOM(t){t.classList.contains(this.constants.GLOSSARY_CLICKABLE_CLASS)&&(t.classList.remove(this.constants.GLOSSARY_CLICKABLE_CLASS),t.setAttribute("tabindex","-1"),t.removeEventListener("click",this.showGlossary),t.removeEventListener("touchend",this.showGlossary),t.removeEventListener("keydown",this.keyDownHandler))}setGlossaryTerm(t){if(!t.hasAttribute("data-glossary-term")){if(t.hasAttribute("data-sbac-term")){t.setAttribute("data-glossary-term",t.getAttribute("data-sbac-term"));return}t.setAttribute("data-glossary-term",t.innerText)}}showGlossaryHandler(t){t.preventDefault(),t.stopPropagation(),this.emitShowGlossaryEvent(t)}keydownHandler(t){let i=!1;switch(t.keyCode){case this.constants.keys.SPACE:case this.constants.keys.ENTER:this.emitShowGlossaryEvent(t),i=!0;break}i&&(t.stopPropagation(),t.preventDefault())}emitShowGlossaryEvent(t){const i=t.target.getAttribute("data-catalog-idref"),s=this.createGlossaryData(i);this.item.$parent.$emit("itemCatalogEvent",{type:"glossary",catalogIdRef:i,term:t.target.getAttribute("data-glossary-term"),data:s})}createGlossaryData(t){const i=this.store.getCatalog(t),s=this.getPnpGlossarySupports(this.store.getItemContextPnp());return this.createGlossaryDataFromCatalog(i,s)}createGlossaryDataFromCatalog(t,i){let s=[];return i.forEach(n=>{const r=this.findCatalogCardBySupport(t,n);if(r!==null){if(n===this.constants.supports.GLOSSARY||n===this.constants.supports.EXT_SBAC_GLOSSARY_ILLUSTRATION){const a=this.createGlossaryContent(r);if(a===null)return;s.push({support:n,card:a});return}if(n.startsWith(`${this.constants.supports.KEYWORD_TRANSLATION}:`)){const a=this.getLanguageCodeFromSupport(n),o=this.createTranslationContent(r,a);if(o===null)return;s.push({support:this.constants.supports.KEYWORD_TRANSLATION,card:o});return}}},this),s}hasCatalogGlossarySupport(t,i){let s=null;return i.forEach(n=>{let r=this.findCatalogCardBySupport(t,n);if(r!==null){s=r;return}},this),s!=null}getLanguageCodeFromSupport(t){const i=t.indexOf(":");return t.length>i+1?t.substring(i+1):""}findCatalogCardBySupport(t,i){return typeof t>"u"?null:this.findCardBySupport(t.node.getCards(),i)}findCardBySupport(t,i){let s=null,n="";return i.startsWith(`${this.constants.supports.KEYWORD_TRANSLATION}:`)&&(n=this.getLanguageCodeFromSupport(i),i=this.constants.supports.KEYWORD_TRANSLATION),t.forEach(r=>{if(r.support===i){if(i===this.constants.supports.KEYWORD_TRANSLATION&&this.createTranslationContent(r,n)===null)return;s=r;return}},this),s}createGlossaryContent(t){return this.getGlossaryCardContent(t)}createTranslationContent(t,i){let s=this.getTranslationCardContent(t,i);return s!==null?s:this.getTranslationCardContent(t,i,!0)}getGlossaryCardContent(t){let i=null;return t.getChildren().forEach(s=>{switch(s.$options.name){case"QtiHtmlContent":i=this.createContent("qti-html-content",s);return;case"QtiFileRef":i=this.createContent("qti-file-ref",s);return;case"QtiCardEntry":i=this.getGlossaryCardContent(s);return;default:return}},this),i}getTranslationCardContent(t,i,s=!1,n=0){if(n>1||n==0&&t.getLanguage().length>0&&t.getLanguage()!==i)return null;let r=null;return t.getChildren().forEach(a=>{switch(a.$options.name){case"QtiHtmlContent":r=this.createContent("qti-html-content",a);return;case"QtiFileRef":r=this.createContent("qti-file-ref",a);return;case"QtiCardEntry":if(s&&a.isDefault()){r=this.getTranslationCardContent(a,i,s,n+1);return}if(a.getLanguage()===i){r=this.getTranslationCardContent(a,i,s,n+1);return}return;default:return}},this),r}createContent(t,i){return{properties:{name:t},content:i.getContent()}}}const bT={name:"EventListener",emits:["templateProcessingReady","itemBodyReady"],setup(e,t){return()=>{var i,s;return((s=(i=t.slots).default)==null?void 0:s.call(i))??null}}},vT=new G,ET={name:"QtiAssessmentItem",components:{EventListener:bT},emits:["itemReady","itemCompleted","itemSuspendAttemptReady","itemEndAttemptReady","itemScoreAttemptReady","itemCatalogEvent","itemNewTemplate","itemNewTemplateCompleted"],props:{identifier:{type:String,required:!0},title:{type:String,required:!1},adaptive:{type:String,required:!1},timeDependent:{type:String,required:!1},"xml:lang":{type:String,required:!1}},data(){return{isAdaptive:!1,isTimeDependent:!1,lang:null,locale:null,catalogFactory:null,getResponsesCallback:null}},methods:{getEndAttempt(e){this.endAttempt(void 0,(function(){this.notifyAttemptResults("itemEndAttemptReady",e)}).bind(this))},getSuspendAttempt(e){_.updateItemDuration(),this.getResponses((function(){this.evaluateAttemptValidity(_.getItemContextSessionControl().getValidateResponses()),this.notifyAttemptResults("itemSuspendAttemptReady",e)}).bind(this))},getScoreAttempt(e){this.processResponses(!0),this.notifyAttemptResults("itemScoreAttemptReady",e)},notifyAttemptResults(e,t){const i=new bc(this.identifier,_);this.$parent.$emit(e,{state:i.getSerializedState(),target:typeof t<"u"?t:null})},notifyEndAttemptInteractionResults(){const t=new bc(this.identifier,_).getSerializedState();_.getItemContextSessionControl().getValidateResponses()&&t.validationMessages.length>0&&_.getInteractions().forEach(i=>{i.interactionType==="EndAttemptInteraction"&&i.interactionSubType==="endattempt-controller-bar"&&i.enable()}),this.$parent.$emit("itemEndAttemptReady",{state:t,target:null})},handleTemplateProcessingReady(e){console.log("[QtiAssessmentItem][TemplateProcessingReady]"),_.defineTemplateProcessing({node:e.templateProcessing}),_.hasItemContextState()||this.executeTemplateProcessing()},handleItemBodyReady(e){console.log("[QtiAssessmentItem][ItemBodyReady][Adaptive="+this.isAdaptive+"]",e),_.defineItemBody({node:e.itemBody}),this.initializeResponseDeclarations(_.hasItemContextState()),this.initializeOutcomeDeclarations(_.hasItemContextState()),this.isAdaptive&&this.evaluateFeedbacks(),(_.getItemLifecycleStatus()==="closed"||_.getItemLifecycleStatus()==="review"||_.getItemLifecycleStatus()==="solution")&&(_.resetItemTimer(),this.disableInteractions())},getItemBody(){return _.getItemBody()},getTemplateProcessing(){let e=_.getProcessing("template");return typeof e>"u"?null:e.node},getResponseProcessing(){let e=_.getProcessing("response");return typeof e>"u"?null:e.node},newTemplate(){console.log("[QtiAssessmentItem][NewTemplate][Started]"),this.$parent.$emit("itemNewTemplate"),this.resetResponseDeclarations(),this.resetInteractions(),this.resetTemplateDeclarations(),this.executeTemplateProcessing(),this.evaluatePrintedVariables(),this.evaluateTemplateMathVariables(),this.evaluateTemplates(),this.resetOutcomeDeclarations(),this.evaluateFeedbacks(),_.restartItemTimer(),console.log("[QtiAssessmentItem][NewTemplate][Completed]"),this.$parent.$emit("itemNewTemplateCompleted")},evaluateTemplateMathVariables(){if(_.getTemplateMathParameterVariables().length===0)return;const t=this.getItemBody();t!==null&&t.updateTemplateMathVariables(),_.getFeedbacks().forEach(i=>{i.feedbackType==="Modal"&&i.node.updateTemplateMathVariables()})},executeTemplateProcessing(){let e=this.getTemplateProcessing();e!==null&&e.evaluate()},initializeOutcomeDeclarations(e){e?_.restoreOutcomeVariables():this.resetOutcomeDeclarations()},resetOutcomeDeclarations(){_.getOutcomeDeclarations().forEach(e=>{this.resetOutcomeDeclaration(e)},this)},resetOutcomeDeclaration(e){if(e.node!==void 0){e.node.reset();return}_.setOutcomeVariableValue({identifier:e.identifier,value:e.defaultValue})},initializeResponseDeclarations(e){e?_.restoreResponseVariables():this.resetResponseDeclarations()},resetResponseDeclarations(){_.getResponseDeclarations().forEach(e=>{e.resetValue&&e.resetValue()})},resetTemplateDeclarations(){_.getTemplateDeclarations().forEach(e=>{e.node.reset()})},resetInteractions(){_.getInteractions().forEach(e=>{console.log("[ResetInteractions]["+e.identifier+"]",e),e.resetValue&&e.resetValue(),e.node.enable&&e.node.enable()}),_.resetInteractionStateIsValidResponse()},disableInteractions(){_.getInteractions().forEach(e=>{e.node.disable&&e.node.disable()})},showSolutionInteractions(){_.getItemContextSessionControl().getShowSolution()&&_.getItemLifecycleState()==="solution"&&_.getInteractions().forEach(e=>{e.node.showSolution&&e.node.showSolution(_.getResponseVariableCorrectResponse(e.identifier))})},evaluateFeedbacks(){console.log("[EvaluateFeedback][Started]"),_.getFeedbacks().forEach(e=>{e.node.evaluate()}),console.log("[EvaluateFeedback][Completed]")},evaluatePrintedVariables(){console.log("[EvaluatePrintedVariables][Started]"),_.getPrintedVariables().forEach(e=>{e.node.evaluate()}),console.log("[EvaluatePrintedVariables][Completed]")},evaluateTemplates(){console.log("[EvaluateTemplates][Started]"),_.getTemplates().forEach(e=>{e.node.evaluate()}),console.log("[EvaluateTemplates][Completed]")},endAttempt(e,t){console.log("[EndAttempt][Start][Identifier]",this.identifier),_.updateItemDuration(),this.getResponses((function(){if(!this.evaluateAttemptValidity(_.getItemContextSessionControl().getValidateResponses())){console.log("[EndAttempt][InvalidResponses][Identifier]",this.identifier),t&&t();return}this.processResponses(),this.isAdaptive&&this.evaluateItemCompleted(),this.updateItemBodyUI(e),console.log("[EndAttempt][Complete][Identifier]",this.identifier),t&&t()}).bind(this))},updateItemBodyUI(e){typeof e>"u"||e.interactionSubType!=="endattempt-controller-bar"&&_.getInteractions().forEach(t=>{if(t.interactionType==="EndAttemptInteraction"){if(t.interactionSubType==="endattempt-controller-bar"){t.disable();return}if(this.isAdaptive){if(this.isAdaptiveItemCompleted()){t.disable();return}t.enable()}}})},getResponses(e){console.log("[GetResponses][Start]"),_.getAsyncStateMap().clear(),this.getResponsesCallback=e;let t=_.getResponseDeclarations();for(let i=0;i<t.length;i++){const s=t[i],n=_.getInteraction(s.identifier);if(typeof n>"u"){s.identifier!=="numAttempts"&&s.identifier!=="duration"&&_.resetResponseVariableValue({identifier:s.identifier,value:s.defaultValue,state:null});continue}if(n.interactionType!=="PortableCustom"){console.log("[GetResponses]["+s.identifier+"]:",n.node.getResponse()),_.setResponseVariableValue({identifier:s.identifier,value:n.node.getResponse(),state:n.node.getState()});continue}n.node.pciIsReady()?_.getAsyncStateMap().set(n.identifier,{identifier:n.identifier,node:n.node}):_.setResponseVariableValue({identifier:s.identifier,value:n.node.getResponse(),state:n.node.getState()})}this.initiateAsyncGetResponsesRequests()},initiateAsyncGetResponsesRequests(){if(_.getAsyncStateMap().size===0)return this.triggerGetResponsesComplete();for(const[e,t]of _.getAsyncStateMap().entries())console.log("[GetResponses]["+e+"][PCI Initiate]"),t.node.getStateRequest()},triggerGetResponsesComplete(){console.log("[GetResponses][Complete]"),typeof this.getResponsesCallback=="function"&&this.getResponsesCallback()},evaluateItemCompleted(){this.isAdaptiveItemCompleted()&&(_.resetItemTimer(),this.$parent.$emit("itemCompleted"))},isAdaptiveItemCompleted(){return _.getOutcomeDeclaration("completionStatus").value==="completed"},processResponses(e=!1){console.log("[ProcessResponses][Started]"),e||_.incrementNumAttempts(),console.log("[ProcessResponses][IsAdaptive]",this.isAdaptive),this.isAdaptive||this.resetOutcomeDeclarations();let t=this.getResponseProcessing();t!==null&&t.evaluate(),e||(this.printOutcomeDeclarations(),this.evaluatePrintedVariables(),_.getItemContextSessionControl().getShowFeedback()&&this.evaluateFeedbacks()),console.log("[ProcessResponses][Completed]")},evaluateAttemptValidity(e){return e?(_.resetItemContextValidationMessages(),this.evaluateInteractionResponseValidity(_.getInteractions())):!0},evaluateInteractionResponseValidity(e){let t=!0;return e.forEach(i=>{i.isValidResponse||(_.addItemContextValidationMessage({identifier:i.identifier,message:i.invalidResponseMessage}),t=!1)}),t},bindCatalog(){this.catalogFactory!==null&&this.catalogFactory.bindAll()},setLang(e,t){t!==null&&e.setAttribute("lang",t)},coerceItemAttributes(){this.isTimeDependent=typeof this.timeDependent>"u"?!1:this.timeDependent==="true",this.isAdaptive=typeof this.adaptive>"u"?!1:this.adaptive==="true",this.lang=vT.parseXmlLangAttribute(this.$props["xml:lang"]),this.locale=this.lang===null?"en":this.lang},printOutcomeDeclarations(){_.getOutcomeDeclarations().forEach(e=>{(this.isAdaptive||e.identifier!=="completionStatus")&&console.log("[ProcessResponses][Outcomes]["+e.identifier+"][Value]",e.value)})}},errorCaptured(e,t){return console.log("["+e.name+"]["+t.$options.name+"] "+e.message),!1},created(){this.coerceItemAttributes()},mounted(){this.setLang(this.$refs.item,this.lang),this.catalogFactory=new wT(this,_),this.bindCatalog(),this.$parent.$emit("itemReady",{item:this})},beforeUnmount(){this.catalogFactory!==null&&this.catalogFactory.resetAll()}},TT={ref:"item",class:"qti-assessment-item"};function CT(e,t,i,s,n,r){const a=l.resolveComponent("event-listener");return l.openBlock(),l.createElementBlock("div",TT,[l.createVNode(a,{onTemplateProcessingReady:r.handleTemplateProcessingReady,onItemBodyReady:r.handleItemBodyReady},{default:l.withCtx(()=>[l.createElementVNode("div",null,[l.renderSlot(e.$slots,"default")])]),_:3},8,["onTemplateProcessingReady","onItemBodyReady"])],512)}const ST=B(ET,[["render",CT]]),Lo=new G,xT=new ie,_T={name:"QtiContextDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0}},data(){return{value:null,defaultValue:null,isQtiValid:!0,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getDefaultValue(){return this.defaultValue},getDeclarationContext(){return this.declarationContext},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}this.setValue(xT.nullValue())},reset(){this.initializeValue()},computeDeclarationContext(){var e,t,i;this.declarationContext=((i=(t=(e=this.$parent)==null?void 0:e.$parent)==null?void 0:t.$options)==null?void 0:i.name)==="QtiAssessmentTest"?"TEST":"ITEM"},getStore(){return this.declarationContext==="TEST"?it:_},validateChildren(){let e=!1;this.$slots.default&&this.$slots.default().forEach(t=>{if(Lo.isValidSlot(t)){if(t.type.name==="QtiDefaultValue"){if(!e)return e=!0;throw new c("Maximum of 1 qti-default-value element permitted")}throw new c('Element must be one of qti-default-value: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.component!==null){if(t.type.name==="QtiDefaultValue")return this.defaultValue=t.component.proxy.getValue();throw new c("["+t.type.name+'][Unhandled Child Node]: "'+t.type.name+'"')}})}},created:function(){try{this.computeDeclarationContext(),Lo.validateCardinality(this.cardinality),Lo.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),Lo.validateIdentifierAttribute(this.identifier),this.validateChildren(),this.getStore().defineContextDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:null,resetValue:this.reset,defaultValue:null})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted:function(){if(this.isQtiValid)try{this.processChildren(),this.initializeValue();const e={identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:this.getValue(),resetValue:this.reset,defaultValue:this.defaultValue};this.declarationContext==="TEST"?it.defineContextDeclaration(e):_.defineContextDeclaration(e),console.log("["+this.$options.name+"]["+this.identifier+"]["+this.declarationContext+"][DefaultValue]",this.defaultValue)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},IT=["identifier"];function VT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-context-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,IT)}const AT=B(_T,[["render",VT]]),Mo=new G,$T=new ie,LT={name:"QtiResponseDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0}},data(){return{value:null,state:null,defaultValue:null,correctResponse:null,mapping:null,areaMapping:null,isQtiValid:!0,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},getState(){return this.state},setState(e){this.state=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getDefaultValue(){return this.defaultValue},getCorrectResponse(){return this.correctResponse},getMapping(){return this.mapping},getAreaMapping(){return this.areaMapping},getDeclarationContext(){return"ITEM"},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}this.setValue($T.nullValue())},validateChildren(){let e=!1,t=!1,i=!1,s=!1;this.$slots.default&&this.$slots.default().forEach(n=>{if(Mo.isValidSlot(n)){if(n.type.name==="QtiCorrectResponse"){if(!e)return e=!0;throw new c("Maximum of 1 qti-correct-response element permitted")}if(n.type.name==="QtiDefaultValue"){if(!t)return t=!0;throw new c("Maximum of 1 qti-default-value element permitted")}if(n.type.name==="QtiMapping"){if(!i)return i=!0;throw new c("Maximum of 1 qti-mapping element permitted")}if(n.type.name==="QtiAreaMapping"){if(!s)return s=!0;throw new c("Maximum of 1 qti-area-mapping element permitted")}throw new c('Element must be one of qti-correct-response, qti-default-value, qti-mapping, qti-area-mapping: "'+n.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.component!==null){if(t.type.name==="QtiCorrectResponse")return this.correctResponse=t.component.proxy.getValue();if(t.type.name==="QtiDefaultValue")return this.defaultValue=t.component.proxy.getValue();if(t.type.name==="QtiMapping")return this.mapping=t.component.proxy;throw new c("["+t.type.name+'][Unhandled Child Node]: "'+t.type.name+'"')}})},getPriorState(e){const t=_.getItemContextStateVariable(e);if(console.log("[ResponseDeclaration]["+e+"][priorState]",t),t===null)return null;if(!("value"in t))throw new O('Variable Restore State Invalid. "value" property not found.');if(!("state"in t))throw new O('Variable Restore State Invalid. "state" property not found.');return this.setValue(t.value),this.setState(t.state),t}},created(){try{Mo.validateCardinality(this.cardinality),Mo.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),Mo.validateIdentifierAttribute(this.identifier),this.validateChildren(),_.defineResponseDeclaration({identifier:this.getIdentifier(),baseType:this.getBaseType(),cardinality:this.getCardinality(),value:null,state:null,defaultValue:null,correctResponse:null,mapping:null,areaMapping:null})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.getPriorState(this.identifier)===null&&this.initializeValue(),_.defineResponseDeclaration({identifier:this.getIdentifier(),baseType:this.getBaseType(),cardinality:this.getCardinality(),value:this.getValue(),state:this.getState(),defaultValue:this.getDefaultValue(),correctResponse:this.getCorrectResponse(),mapping:this.getMapping(),areaMapping:this.getAreaMapping()}),console.log("["+this.$options.name+"]["+this.identifier+"][CorrectResponse]",this.correctResponse,"[Mapping]",this.mapping)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},MT=["identifier"];function NT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"root",class:"qti-response-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,MT)}const RT=B(LT,[["render",NT]]),zs=new G,pp=new ie,kT={name:"QtiOutcomeDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0},view:{type:String,required:!1,default:null},interpretation:{type:String,required:!1,default:null},longInterpretation:{type:String,required:!1,default:null},normalMaximum:{type:String,required:!1},normalMinimum:{type:String,required:!1},masteryValue:{type:String,required:!1},externalScored:{type:String,required:!1,default:null},variableIdentifierRef:{type:String,required:!1,default:null}},data(){return{value:null,defaultValue:null,lookupTable:null,isQtiValid:!0,normalMaximumValue:null,normalMinimumValue:null,masteryValueValue:null,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getNormalMaximumValue(){return this.normalMaximumValue},getNormalMinimumValue(){return this.normalMinimumValue},getMasteryValueValue(){return this.masteryValueValue},getDefaultValue(){return this.defaultValue},getDeclarationContext(){return this.declarationContext},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}if(this.getCardinality()==="single"&&pp.isBaseTypeNumeric(this.getBaseType())){this.setValue(new X(0).toNumber());return}this.setValue(pp.nullValue())},reset(){this.initializeValue(),this.getStore().setOutcomeVariableValue({identifier:this.identifier,value:this.getValue()})},computeDeclarationContext(){var e,t,i;this.declarationContext=((i=(t=(e=this.$parent)==null?void 0:e.$parent)==null?void 0:t.$options)==null?void 0:i.name)==="QtiAssessmentTest"?"TEST":"ITEM"},getStore(){return this.declarationContext==="TEST"?it:_},validateChildren(){let e=!1,t=!1,i=!1;this.$slots.default&&this.$slots.default().forEach(s=>{if(zs.isValidSlot(s)){if(s.type.name==="QtiDefaultValue"){if(!e)return e=!0;throw new c("Maximum of 1 qti-default-value element permitted")}if(s.type.name==="QtiMatchTable"){if(i)throw new c("Maximum of 1 lookupTable permitted");if(!t)return t=!0;throw new c("Maximum of 1 qti-match-table element permitted")}if(s.type.name==="QtiInterpolationTable"){if(t)throw new c("Maximum of 1 lookupTable permitted");if(!i)return i=!0;throw new c("Maximum of 1 qti-interpolation-table element permitted")}throw new c('Element must be one of qti-default-value, qti-match-table, qti-interpolation-table: "'+s.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.component!==null){if(t.type.name==="QtiDefaultValue")return this.defaultValue=t.component.proxy.getValue();if(t.type.name==="QtiMatchTable"||t.type.name==="QtiInterpolationTable")return this.lookupTable=t.component.proxy;throw new c("["+this.$options.name+'][Unhandled Child Node]: "'+t.type.name+'"')}})}},created(){try{if(this.computeDeclarationContext(),zs.validateCardinality(this.cardinality),zs.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),zs.validateIdentifierAttribute(this.identifier),this.validateChildren(),this.normalMaximumValue=zs.validateFloatAttribute("normal-maximum",this.normalMaximum,!1,null),this.normalMaximumValue!==null&&this.normalMaximumValue<=0)throw new c('Outcome declaration "'+this.identifier+'" has invalid normal-maximum attribute value. Must be a positive value.');if(this.normalMinimumValue=zs.validateFloatAttribute("normal-minimum",this.normalMinimum,!1,null),this.masteryValueValue=zs.validateFloatAttribute("mastery-value",this.masteryValue,!1,null),this.identifier==="SCORE"||this.identifier==="MAXSCORE"){if(typeof this.baseType>"u"||this.baseType!=="float")throw new c('Outcome declaration "'+this.identifier+'" has invalid base-type. Must be base-type="float".');if(typeof this.cardinality>"u"||this.cardinality!=="single")throw new c('Outcome declaration "'+this.identifier+'" has invalid cardinality. Must be cardinality="single".')}this.getStore().defineOutcomeDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),view:this.view,interpretation:this.interpretation,longInterpretation:this.longInterpretation,normalMaximum:this.getNormalMaximumValue(),normalMinimum:this.getNormalMinimumValue(),masteryValue:this.getMasteryValueValue(),externalScored:this.externalScored,variableIdentifierRef:this.variableIdentifierRef,value:null,defaultValue:null,node:this})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.initializeValue();const e={identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),view:this.view,interpretation:this.interpretation,longInterpretation:this.longInterpretation,normalMaximum:this.getNormalMaximumValue(),normalMinimum:this.getNormalMinimumValue(),masteryValue:this.getMasteryValueValue(),externalScored:this.externalScored,variableIdentifierRef:this.variableIdentifierRef,value:this.getValue(),defaultValue:this.defaultValue,lookupTable:this.lookupTable,lookupTableType:this.lookupTableType,node:this};this.declarationContext==="TEST"?it.defineOutcomeDeclaration(e):_.defineOutcomeDeclaration(e),console.log("["+this.$options.name+"]["+this.identifier+"]["+this.declarationContext+"][DefaultValue]",this.defaultValue,"[lookupTable]",this.lookupTable)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},qT=["identifier"];function OT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-outcome-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,qT)}const BT=B(kT,[["render",OT]]),No=new G,PT=new ie,DT={name:"QtiTemplateDeclaration",props:{identifier:{type:String,required:!0},baseType:{type:String,required:!1},cardinality:{type:String,required:!0},paramVariable:{type:String,required:!1,default:"false"},mathVariable:{type:String,required:!1,default:"false"}},data(){return{value:null,defaultValue:null,isQtiValid:!0,declarationContext:"ITEM"}},methods:{getIdentifier(){return this.identifier},getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.baseType},getCardinality(){return this.cardinality},getDefaultValue(){return this.defaultValue},getDeclarationContext(){return"ITEM"},initializeValue(){if(this.defaultValue!==null){this.setValue(this.defaultValue);return}this.setValue(PT.nullValue())},reset(){this.initializeValue(),_.setTemplateVariableValue({identifier:this.identifier,value:this.getValue()})},validateChildren(){let e=!1;this.$slots.default&&this.$slots.default().forEach(t=>{if(No.isValidSlot(t)){if(t.type.name==="QtiDefaultValue"){if(!e)return e=!0;throw new c("Maximum of 1 qti-default-value element permitted")}throw new c('Element must be qti-default-value: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children.forEach(t=>{if(t.type.name==="QtiDefaultValue"&&t.component!==null)return this.defaultValue=t.component.proxy.getValue();throw new c("["+t.type.name+'][Unhandled Child Node]: "'+t.type.name+'"')})},readChildren:function(){this.$children.forEach(e=>{switch(e.$el.className){case"qti-default-value":this.defaultValue=e.getValue();break;default:throw new c("["+this.$options.name+'][Unhandled Child Node]: "'+e.$el.className+'"')}})},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Variable Restore State Invalid. "value" property not found.');return this.setValue(t.value),t}},created:function(){try{No.validateCardinality(this.cardinality),No.validateBaseTypeAndCardinality(this.baseType,this.cardinality==="record"),No.validateIdentifierAttribute(this.identifier),this.validateChildren(),_.defineTemplateDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:null,defaultValue:null,paramVariable:this.paramVariable==="true",mathVariable:this.mathVariable==="true",node:this})}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted:function(){if(this.isQtiValid)try{this.processChildren(),this.getPriorState(this.identifier)===null&&this.initializeValue(),_.defineTemplateDeclaration({identifier:this.identifier,baseType:this.getBaseType(),cardinality:this.getCardinality(),value:this.getValue(),defaultValue:this.getDefaultValue(),paramVariable:this.paramVariable==="true",mathVariable:this.mathVariable==="true",node:this}),console.log("["+this.$options.name+"]["+this.identifier+"][Value]",this.getValue())}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},QT=["identifier"];function HT(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-template-declaration",identifier:i.identifier},[l.renderSlot(e.$slots,"default")],8,QT)}const FT=B(DT,[["render",HT]]);function mp(e,t){return function(){return e.apply(t,arguments)}}const{toString:UT}=Object.prototype,{getPrototypeOf:Qc}=Object,Ro=(e=>t=>{const i=UT.call(t);return e[i]||(e[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),pi=e=>(e=e.toLowerCase(),t=>Ro(t)===e),ko=e=>t=>typeof t===e,{isArray:Nn}=Array,Dr=ko("undefined");function GT(e){return e!==null&&!Dr(e)&&e.constructor!==null&&!Dr(e.constructor)&&Qt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const gp=pi("ArrayBuffer");function jT(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&gp(e.buffer),t}const WT=ko("string"),Qt=ko("function"),yp=ko("number"),qo=e=>e!==null&&typeof e=="object",zT=e=>e===!0||e===!1,Oo=e=>{if(Ro(e)!=="object")return!1;const t=Qc(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},KT=pi("Date"),YT=pi("File"),XT=pi("Blob"),ZT=pi("FileList"),JT=e=>qo(e)&&Qt(e.pipe),eC=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Qt(e.append)&&((t=Ro(e))==="formdata"||t==="object"&&Qt(e.toString)&&e.toString()==="[object FormData]"))},tC=pi("URLSearchParams"),[iC,sC,nC,rC]=["ReadableStream","Request","Response","Headers"].map(pi),aC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Qr(e,t,{allOwnKeys:i=!1}={}){if(e===null||typeof e>"u")return;let s,n;if(typeof e!="object"&&(e=[e]),Nn(e))for(s=0,n=e.length;s<n;s++)t.call(null,e[s],s,e);else{const r=i?Object.getOwnPropertyNames(e):Object.keys(e),a=r.length;let o;for(s=0;s<a;s++)o=r[s],t.call(null,e[o],o,e)}}function wp(e,t){t=t.toLowerCase();const i=Object.keys(e);let s=i.length,n;for(;s-- >0;)if(n=i[s],t===n.toLowerCase())return n;return null}const Ks=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,bp=e=>!Dr(e)&&e!==Ks;function Hc(){const{caseless:e}=bp(this)&&this||{},t={},i=(s,n)=>{const r=e&&wp(t,n)||n;Oo(t[r])&&Oo(s)?t[r]=Hc(t[r],s):Oo(s)?t[r]=Hc({},s):Nn(s)?t[r]=s.slice():t[r]=s};for(let s=0,n=arguments.length;s<n;s++)arguments[s]&&Qr(arguments[s],i);return t}const oC=(e,t,i,{allOwnKeys:s}={})=>(Qr(t,(n,r)=>{i&&Qt(n)?e[r]=mp(n,i):e[r]=n},{allOwnKeys:s}),e),lC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),cC=(e,t,i,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),i&&Object.assign(e.prototype,i)},uC=(e,t,i,s)=>{let n,r,a;const o={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),r=n.length;r-- >0;)a=n[r],(!s||s(a,e,t))&&!o[a]&&(t[a]=e[a],o[a]=!0);e=i!==!1&&Qc(e)}while(e&&(!i||i(e,t))&&e!==Object.prototype);return t},hC=(e,t,i)=>{e=String(e),(i===void 0||i>e.length)&&(i=e.length),i-=t.length;const s=e.indexOf(t,i);return s!==-1&&s===i},dC=e=>{if(!e)return null;if(Nn(e))return e;let t=e.length;if(!yp(t))return null;const i=new Array(t);for(;t-- >0;)i[t]=e[t];return i},fC=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Qc(Uint8Array)),pC=(e,t)=>{const s=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=s.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},mC=(e,t)=>{let i;const s=[];for(;(i=e.exec(t))!==null;)s.push(i);return s},gC=pi("HTMLFormElement"),yC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,s,n){return s.toUpperCase()+n}),vp=(({hasOwnProperty:e})=>(t,i)=>e.call(t,i))(Object.prototype),wC=pi("RegExp"),Ep=(e,t)=>{const i=Object.getOwnPropertyDescriptors(e),s={};Qr(i,(n,r)=>{let a;(a=t(n,r,e))!==!1&&(s[r]=a||n)}),Object.defineProperties(e,s)},bC=e=>{Ep(e,(t,i)=>{if(Qt(e)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const s=e[i];if(Qt(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},vC=(e,t)=>{const i={},s=n=>{n.forEach(r=>{i[r]=!0})};return Nn(e)?s(e):s(String(e).split(t)),i},EC=()=>{},TC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Fc="abcdefghijklmnopqrstuvwxyz",Tp="0123456789",Cp={DIGIT:Tp,ALPHA:Fc,ALPHA_DIGIT:Fc+Fc.toUpperCase()+Tp},CC=(e=16,t=Cp.ALPHA_DIGIT)=>{let i="";const{length:s}=t;for(;e--;)i+=t[Math.random()*s|0];return i};function SC(e){return!!(e&&Qt(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const xC=e=>{const t=new Array(10),i=(s,n)=>{if(qo(s)){if(t.indexOf(s)>=0)return;if(!("toJSON"in s)){t[n]=s;const r=Nn(s)?[]:{};return Qr(s,(a,o)=>{const u=i(a,n+1);!Dr(u)&&(r[o]=u)}),t[n]=void 0,r}}return s};return i(e,0)},_C=pi("AsyncFunction"),IC=e=>e&&(qo(e)||Qt(e))&&Qt(e.then)&&Qt(e.catch),Sp=((e,t)=>e?setImmediate:t?((i,s)=>(Ks.addEventListener("message",({source:n,data:r})=>{n===Ks&&r===i&&s.length&&s.shift()()},!1),n=>{s.push(n),Ks.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",Qt(Ks.postMessage)),VC=typeof queueMicrotask<"u"?queueMicrotask.bind(Ks):typeof process<"u"&&process.nextTick||Sp,F={isArray:Nn,isArrayBuffer:gp,isBuffer:GT,isFormData:eC,isArrayBufferView:jT,isString:WT,isNumber:yp,isBoolean:zT,isObject:qo,isPlainObject:Oo,isReadableStream:iC,isRequest:sC,isResponse:nC,isHeaders:rC,isUndefined:Dr,isDate:KT,isFile:YT,isBlob:XT,isRegExp:wC,isFunction:Qt,isStream:JT,isURLSearchParams:tC,isTypedArray:fC,isFileList:ZT,forEach:Qr,merge:Hc,extend:oC,trim:aC,stripBOM:lC,inherits:cC,toFlatObject:uC,kindOf:Ro,kindOfTest:pi,endsWith:hC,toArray:dC,forEachEntry:pC,matchAll:mC,isHTMLForm:gC,hasOwnProperty:vp,hasOwnProp:vp,reduceDescriptors:Ep,freezeMethods:bC,toObjectSet:vC,toCamelCase:yC,noop:EC,toFiniteNumber:TC,findKey:wp,global:Ks,isContextDefined:bp,ALPHABET:Cp,generateString:CC,isSpecCompliantForm:SC,toJSONObject:xC,isAsyncFn:_C,isThenable:IC,setImmediate:Sp,asap:VC};function be(e,t,i,s,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),i&&(this.config=i),s&&(this.request=s),n&&(this.response=n,this.status=n.status?n.status:null)}F.inherits(be,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:F.toJSONObject(this.config),code:this.code,status:this.status}}});const xp=be.prototype,_p={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{_p[e]={value:e}}),Object.defineProperties(be,_p),Object.defineProperty(xp,"isAxiosError",{value:!0}),be.from=(e,t,i,s,n,r)=>{const a=Object.create(xp);return F.toFlatObject(e,a,function(u){return u!==Error.prototype},o=>o!=="isAxiosError"),be.call(a,e.message,t,i,s,n),a.cause=e,a.name=e.name,r&&Object.assign(a,r),a};const AC=null;function Uc(e){return F.isPlainObject(e)||F.isArray(e)}function Ip(e){return F.endsWith(e,"[]")?e.slice(0,-2):e}function Vp(e,t,i){return e?e.concat(t).map(function(n,r){return n=Ip(n),!i&&r?"["+n+"]":n}).join(i?".":""):t}function $C(e){return F.isArray(e)&&!e.some(Uc)}const LC=F.toFlatObject(F,{},null,function(t){return/^is[A-Z]/.test(t)});function Bo(e,t,i){if(!F.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,i=F.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,C){return!F.isUndefined(C[S])});const s=i.metaTokens,n=i.visitor||f,r=i.dots,a=i.indexes,u=(i.Blob||typeof Blob<"u"&&Blob)&&F.isSpecCompliantForm(t);if(!F.isFunction(n))throw new TypeError("visitor must be a function");function h(b){if(b===null)return"";if(F.isDate(b))return b.toISOString();if(!u&&F.isBlob(b))throw new be("Blob is not supported. Use a Buffer instead.");return F.isArrayBuffer(b)||F.isTypedArray(b)?u&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function f(b,S,C){let L=b;if(b&&!C&&typeof b=="object"){if(F.endsWith(S,"{}"))S=s?S:S.slice(0,-2),b=JSON.stringify(b);else if(F.isArray(b)&&$C(b)||(F.isFileList(b)||F.endsWith(S,"[]"))&&(L=F.toArray(b)))return S=Ip(S),L.forEach(function(D,E){!(F.isUndefined(D)||D===null)&&t.append(a===!0?Vp([S],E,r):a===null?S:S+"[]",h(D))}),!1}return Uc(b)?!0:(t.append(Vp(C,S,r),h(b)),!1)}const m=[],w=Object.assign(LC,{defaultVisitor:f,convertValue:h,isVisitable:Uc});function y(b,S){if(!F.isUndefined(b)){if(m.indexOf(b)!==-1)throw Error("Circular reference detected in "+S.join("."));m.push(b),F.forEach(b,function(L,x){(!(F.isUndefined(L)||L===null)&&n.call(t,L,F.isString(x)?x.trim():x,S,w))===!0&&y(L,S?S.concat(x):[x])}),m.pop()}}if(!F.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Ap(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function Gc(e,t){this._pairs=[],e&&Bo(e,this,t)}const $p=Gc.prototype;$p.append=function(t,i){this._pairs.push([t,i])},$p.toString=function(t){const i=t?function(s){return t.call(this,s,Ap)}:Ap;return this._pairs.map(function(n){return i(n[0])+"="+i(n[1])},"").join("&")};function MC(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Lp(e,t,i){if(!t)return e;const s=i&&i.encode||MC,n=i&&i.serialize;let r;if(n?r=n(t,i):r=F.isURLSearchParams(t)?t.toString():new Gc(t,i).toString(s),r){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+r}return e}class Mp{constructor(){this.handlers=[]}use(t,i,s){return this.handlers.push({fulfilled:t,rejected:i,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){F.forEach(this.handlers,function(s){s!==null&&t(s)})}}const Np={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},NC={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Gc,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},jc=typeof window<"u"&&typeof document<"u",Wc=typeof navigator=="object"&&navigator||void 0,RC=jc&&(!Wc||["ReactNative","NativeScript","NS"].indexOf(Wc.product)<0),kC=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",qC=jc&&window.location.href||"http://localhost",It={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:jc,hasStandardBrowserEnv:RC,hasStandardBrowserWebWorkerEnv:kC,navigator:Wc,origin:qC},Symbol.toStringTag,{value:"Module"})),...NC};function OC(e,t){return Bo(e,new It.classes.URLSearchParams,Object.assign({visitor:function(i,s,n,r){return It.isNode&&F.isBuffer(i)?(this.append(s,i.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}function BC(e){return F.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function PC(e){const t={},i=Object.keys(e);let s;const n=i.length;let r;for(s=0;s<n;s++)r=i[s],t[r]=e[r];return t}function Rp(e){function t(i,s,n,r){let a=i[r++];if(a==="__proto__")return!0;const o=Number.isFinite(+a),u=r>=i.length;return a=!a&&F.isArray(n)?n.length:a,u?(F.hasOwnProp(n,a)?n[a]=[n[a],s]:n[a]=s,!o):((!n[a]||!F.isObject(n[a]))&&(n[a]=[]),t(i,s,n[a],r)&&F.isArray(n[a])&&(n[a]=PC(n[a])),!o)}if(F.isFormData(e)&&F.isFunction(e.entries)){const i={};return F.forEachEntry(e,(s,n)=>{t(BC(s),n,i,0)}),i}return null}function DC(e,t,i){if(F.isString(e))try{return(t||JSON.parse)(e),F.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(i||JSON.stringify)(e)}const Hr={transitional:Np,adapter:["xhr","http","fetch"],transformRequest:[function(t,i){const s=i.getContentType()||"",n=s.indexOf("application/json")>-1,r=F.isObject(t);if(r&&F.isHTMLForm(t)&&(t=new FormData(t)),F.isFormData(t))return n?JSON.stringify(Rp(t)):t;if(F.isArrayBuffer(t)||F.isBuffer(t)||F.isStream(t)||F.isFile(t)||F.isBlob(t)||F.isReadableStream(t))return t;if(F.isArrayBufferView(t))return t.buffer;if(F.isURLSearchParams(t))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(r){if(s.indexOf("application/x-www-form-urlencoded")>-1)return OC(t,this.formSerializer).toString();if((o=F.isFileList(t))||s.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return Bo(o?{"files[]":t}:t,u&&new u,this.formSerializer)}}return r||n?(i.setContentType("application/json",!1),DC(t)):t}],transformResponse:[function(t){const i=this.transitional||Hr.transitional,s=i&&i.forcedJSONParsing,n=this.responseType==="json";if(F.isResponse(t)||F.isReadableStream(t))return t;if(t&&F.isString(t)&&(s&&!this.responseType||n)){const a=!(i&&i.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(o){if(a)throw o.name==="SyntaxError"?be.from(o,be.ERR_BAD_RESPONSE,this,null,this.response):o}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:It.classes.FormData,Blob:It.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};F.forEach(["delete","get","head","post","put","patch"],e=>{Hr.headers[e]={}});const QC=F.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),HC=e=>{const t={};let i,s,n;return e&&e.split(`
|
83
83
|
`).forEach(function(a){n=a.indexOf(":"),i=a.substring(0,n).trim().toLowerCase(),s=a.substring(n+1).trim(),!(!i||t[i]&&QC[i])&&(i==="set-cookie"?t[i]?t[i].push(s):t[i]=[s]:t[i]=t[i]?t[i]+", "+s:s)}),t},kp=Symbol("internals");function Fr(e){return e&&String(e).trim().toLowerCase()}function Po(e){return e===!1||e==null?e:F.isArray(e)?e.map(Po):String(e)}function FC(e){const t=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=i.exec(e);)t[s[1]]=s[2];return t}const UC=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function zc(e,t,i,s,n){if(F.isFunction(s))return s.call(this,t,i);if(n&&(t=i),!!F.isString(t)){if(F.isString(s))return t.indexOf(s)!==-1;if(F.isRegExp(s))return s.test(t)}}function GC(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,i,s)=>i.toUpperCase()+s)}function jC(e,t){const i=F.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+i,{value:function(n,r,a){return this[s].call(this,t,n,r,a)},configurable:!0})})}class Vt{constructor(t){t&&this.set(t)}set(t,i,s){const n=this;function r(o,u,h){const f=Fr(u);if(!f)throw new Error("header name must be a non-empty string");const m=F.findKey(n,f);(!m||n[m]===void 0||h===!0||h===void 0&&n[m]!==!1)&&(n[m||u]=Po(o))}const a=(o,u)=>F.forEach(o,(h,f)=>r(h,f,u));if(F.isPlainObject(t)||t instanceof this.constructor)a(t,i);else if(F.isString(t)&&(t=t.trim())&&!UC(t))a(HC(t),i);else if(F.isHeaders(t))for(const[o,u]of t.entries())r(u,o,s);else t!=null&&r(i,t,s);return this}get(t,i){if(t=Fr(t),t){const s=F.findKey(this,t);if(s){const n=this[s];if(!i)return n;if(i===!0)return FC(n);if(F.isFunction(i))return i.call(this,n,s);if(F.isRegExp(i))return i.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,i){if(t=Fr(t),t){const s=F.findKey(this,t);return!!(s&&this[s]!==void 0&&(!i||zc(this,this[s],s,i)))}return!1}delete(t,i){const s=this;let n=!1;function r(a){if(a=Fr(a),a){const o=F.findKey(s,a);o&&(!i||zc(s,s[o],o,i))&&(delete s[o],n=!0)}}return F.isArray(t)?t.forEach(r):r(t),n}clear(t){const i=Object.keys(this);let s=i.length,n=!1;for(;s--;){const r=i[s];(!t||zc(this,this[r],r,t,!0))&&(delete this[r],n=!0)}return n}normalize(t){const i=this,s={};return F.forEach(this,(n,r)=>{const a=F.findKey(s,r);if(a){i[a]=Po(n),delete i[r];return}const o=t?GC(r):String(r).trim();o!==r&&delete i[r],i[o]=Po(n),s[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const i=Object.create(null);return F.forEach(this,(s,n)=>{s!=null&&s!==!1&&(i[n]=t&&F.isArray(s)?s.join(", "):s)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,i])=>t+": "+i).join(`
|
84
84
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...i){const s=new this(t);return i.forEach(n=>s.set(n)),s}static accessor(t){const s=(this[kp]=this[kp]={accessors:{}}).accessors,n=this.prototype;function r(a){const o=Fr(a);s[o]||(jC(n,a),s[o]=!0)}return F.isArray(t)?t.forEach(r):r(t),this}}Vt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),F.reduceDescriptors(Vt.prototype,({value:e},t)=>{let i=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[i]=s}}}),F.freezeMethods(Vt);function Kc(e,t){const i=this||Hr,s=t||i,n=Vt.from(s.headers);let r=s.data;return F.forEach(e,function(o){r=o.call(i,r,n.normalize(),t?t.status:void 0)}),n.normalize(),r}function qp(e){return!!(e&&e.__CANCEL__)}function Rn(e,t,i){be.call(this,e??"canceled",be.ERR_CANCELED,t,i),this.name="CanceledError"}F.inherits(Rn,be,{__CANCEL__:!0});function Op(e,t,i){const s=i.config.validateStatus;!i.status||!s||s(i.status)?e(i):t(new be("Request failed with status code "+i.status,[be.ERR_BAD_REQUEST,be.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function WC(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function zC(e,t){e=e||10;const i=new Array(e),s=new Array(e);let n=0,r=0,a;return t=t!==void 0?t:1e3,function(u){const h=Date.now(),f=s[r];a||(a=h),i[n]=u,s[n]=h;let m=r,w=0;for(;m!==n;)w+=i[m++],m=m%e;if(n=(n+1)%e,n===r&&(r=(r+1)%e),h-a<t)return;const y=f&&h-f;return y?Math.round(w*1e3/y):void 0}}function KC(e,t){let i=0,s=1e3/t,n,r;const a=(h,f=Date.now())=>{i=f,n=null,r&&(clearTimeout(r),r=null),e.apply(null,h)};return[(...h)=>{const f=Date.now(),m=f-i;m>=s?a(h,f):(n=h,r||(r=setTimeout(()=>{r=null,a(n)},s-m)))},()=>n&&a(n)]}const Do=(e,t,i=3)=>{let s=0;const n=zC(50,250);return KC(r=>{const a=r.loaded,o=r.lengthComputable?r.total:void 0,u=a-s,h=n(u),f=a<=o;s=a;const m={loaded:a,total:o,progress:o?a/o:void 0,bytes:u,rate:h||void 0,estimated:h&&o&&f?(o-a)/h:void 0,event:r,lengthComputable:o!=null,[t?"download":"upload"]:!0};e(m)},i)},Bp=(e,t)=>{const i=e!=null;return[s=>t[0]({lengthComputable:i,total:e,loaded:s}),t[1]]},Pp=e=>(...t)=>F.asap(()=>e(...t)),YC=It.hasStandardBrowserEnv?function(){const t=It.navigator&&/(msie|trident)/i.test(It.navigator.userAgent),i=document.createElement("a");let s;function n(r){let a=r;return t&&(i.setAttribute("href",a),a=i.href),i.setAttribute("href",a),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:i.pathname.charAt(0)==="/"?i.pathname:"/"+i.pathname}}return s=n(window.location.href),function(a){const o=F.isString(a)?n(a):a;return o.protocol===s.protocol&&o.host===s.host}}():function(){return function(){return!0}}(),XC=It.hasStandardBrowserEnv?{write(e,t,i,s,n,r){const a=[e+"="+encodeURIComponent(t)];F.isNumber(i)&&a.push("expires="+new Date(i).toGMTString()),F.isString(s)&&a.push("path="+s),F.isString(n)&&a.push("domain="+n),r===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ZC(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function JC(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Dp(e,t){return e&&!ZC(t)?JC(e,t):t}const Qp=e=>e instanceof Vt?{...e}:e;function Ys(e,t){t=t||{};const i={};function s(h,f,m){return F.isPlainObject(h)&&F.isPlainObject(f)?F.merge.call({caseless:m},h,f):F.isPlainObject(f)?F.merge({},f):F.isArray(f)?f.slice():f}function n(h,f,m){if(F.isUndefined(f)){if(!F.isUndefined(h))return s(void 0,h,m)}else return s(h,f,m)}function r(h,f){if(!F.isUndefined(f))return s(void 0,f)}function a(h,f){if(F.isUndefined(f)){if(!F.isUndefined(h))return s(void 0,h)}else return s(void 0,f)}function o(h,f,m){if(m in t)return s(h,f);if(m in e)return s(void 0,h)}const u={url:r,method:r,data:r,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(h,f)=>n(Qp(h),Qp(f),!0)};return F.forEach(Object.keys(Object.assign({},e,t)),function(f){const m=u[f]||n,w=m(e[f],t[f],f);F.isUndefined(w)&&m!==o||(i[f]=w)}),i}const Hp=e=>{const t=Ys({},e);let{data:i,withXSRFToken:s,xsrfHeaderName:n,xsrfCookieName:r,headers:a,auth:o}=t;t.headers=a=Vt.from(a),t.url=Lp(Dp(t.baseURL,t.url),e.params,e.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):"")));let u;if(F.isFormData(i)){if(It.hasStandardBrowserEnv||It.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((u=a.getContentType())!==!1){const[h,...f]=u?u.split(";").map(m=>m.trim()).filter(Boolean):[];a.setContentType([h||"multipart/form-data",...f].join("; "))}}if(It.hasStandardBrowserEnv&&(s&&F.isFunction(s)&&(s=s(t)),s||s!==!1&&YC(t.url))){const h=n&&r&&XC.read(r);h&&a.set(n,h)}return t},eS=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(i,s){const n=Hp(e);let r=n.data;const a=Vt.from(n.headers).normalize();let{responseType:o,onUploadProgress:u,onDownloadProgress:h}=n,f,m,w,y,b;function S(){y&&y(),b&&b(),n.cancelToken&&n.cancelToken.unsubscribe(f),n.signal&&n.signal.removeEventListener("abort",f)}let C=new XMLHttpRequest;C.open(n.method.toUpperCase(),n.url,!0),C.timeout=n.timeout;function L(){if(!C)return;const D=Vt.from("getAllResponseHeaders"in C&&C.getAllResponseHeaders()),U={data:!o||o==="text"||o==="json"?C.responseText:C.response,status:C.status,statusText:C.statusText,headers:D,config:e,request:C};Op(function(ee){i(ee),S()},function(ee){s(ee),S()},U),C=null}"onloadend"in C?C.onloadend=L:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(L)},C.onabort=function(){C&&(s(new be("Request aborted",be.ECONNABORTED,e,C)),C=null)},C.onerror=function(){s(new be("Network Error",be.ERR_NETWORK,e,C)),C=null},C.ontimeout=function(){let E=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const U=n.transitional||Np;n.timeoutErrorMessage&&(E=n.timeoutErrorMessage),s(new be(E,U.clarifyTimeoutError?be.ETIMEDOUT:be.ECONNABORTED,e,C)),C=null},r===void 0&&a.setContentType(null),"setRequestHeader"in C&&F.forEach(a.toJSON(),function(E,U){C.setRequestHeader(U,E)}),F.isUndefined(n.withCredentials)||(C.withCredentials=!!n.withCredentials),o&&o!=="json"&&(C.responseType=n.responseType),h&&([w,b]=Do(h,!0),C.addEventListener("progress",w)),u&&C.upload&&([m,y]=Do(u),C.upload.addEventListener("progress",m),C.upload.addEventListener("loadend",y)),(n.cancelToken||n.signal)&&(f=D=>{C&&(s(!D||D.type?new Rn(null,e,C):D),C.abort(),C=null)},n.cancelToken&&n.cancelToken.subscribe(f),n.signal&&(n.signal.aborted?f():n.signal.addEventListener("abort",f)));const x=WC(n.url);if(x&&It.protocols.indexOf(x)===-1){s(new be("Unsupported protocol "+x+":",be.ERR_BAD_REQUEST,e));return}C.send(r||null)})},tS=(e,t)=>{const{length:i}=e=e?e.filter(Boolean):[];if(t||i){let s=new AbortController,n;const r=function(h){if(!n){n=!0,o();const f=h instanceof Error?h:this.reason;s.abort(f instanceof be?f:new Rn(f instanceof Error?f.message:f))}};let a=t&&setTimeout(()=>{a=null,r(new be(`timeout ${t} of ms exceeded`,be.ETIMEDOUT))},t);const o=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(h=>{h.unsubscribe?h.unsubscribe(r):h.removeEventListener("abort",r)}),e=null)};e.forEach(h=>h.addEventListener("abort",r));const{signal:u}=s;return u.unsubscribe=()=>F.asap(o),u}},iS=function*(e,t){let i=e.byteLength;if(!t||i<t){yield e;return}let s=0,n;for(;s<i;)n=s+t,yield e.slice(s,n),s=n},sS=async function*(e,t){for await(const i of nS(e))yield*iS(i,t)},nS=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:i,value:s}=await t.read();if(i)break;yield s}}finally{await t.cancel()}},Fp=(e,t,i,s)=>{const n=sS(e,t);let r=0,a,o=u=>{a||(a=!0,s&&s(u))};return new ReadableStream({async pull(u){try{const{done:h,value:f}=await n.next();if(h){o(),u.close();return}let m=f.byteLength;if(i){let w=r+=m;i(w)}u.enqueue(new Uint8Array(f))}catch(h){throw o(h),h}},cancel(u){return o(u),n.return()}},{highWaterMark:2})},Qo=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Up=Qo&&typeof ReadableStream=="function",rS=Qo&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Gp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},aS=Up&&Gp(()=>{let e=!1;const t=new Request(It.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),jp=64*1024,Yc=Up&&Gp(()=>F.isReadableStream(new Response("").body)),Ho={stream:Yc&&(e=>e.body)};Qo&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Ho[t]&&(Ho[t]=F.isFunction(e[t])?i=>i[t]():(i,s)=>{throw new be(`Response type '${t}' is not supported`,be.ERR_NOT_SUPPORT,s)})})})(new Response);const oS=async e=>{if(e==null)return 0;if(F.isBlob(e))return e.size;if(F.isSpecCompliantForm(e))return(await new Request(It.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(F.isArrayBufferView(e)||F.isArrayBuffer(e))return e.byteLength;if(F.isURLSearchParams(e)&&(e=e+""),F.isString(e))return(await rS(e)).byteLength},lS=async(e,t)=>{const i=F.toFiniteNumber(e.getContentLength());return i??oS(t)},Xc={http:AC,xhr:eS,fetch:Qo&&(async e=>{let{url:t,method:i,data:s,signal:n,cancelToken:r,timeout:a,onDownloadProgress:o,onUploadProgress:u,responseType:h,headers:f,withCredentials:m="same-origin",fetchOptions:w}=Hp(e);h=h?(h+"").toLowerCase():"text";let y=tS([n,r&&r.toAbortSignal()],a),b;const S=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let C;try{if(u&&aS&&i!=="get"&&i!=="head"&&(C=await lS(f,s))!==0){let U=new Request(t,{method:"POST",body:s,duplex:"half"}),Q;if(F.isFormData(s)&&(Q=U.headers.get("content-type"))&&f.setContentType(Q),U.body){const[ee,p]=Bp(C,Do(Pp(u)));s=Fp(U.body,jp,ee,p)}}F.isString(m)||(m=m?"include":"omit");const L="credentials"in Request.prototype;b=new Request(t,{...w,signal:y,method:i.toUpperCase(),headers:f.normalize().toJSON(),body:s,duplex:"half",credentials:L?m:void 0});let x=await fetch(b);const D=Yc&&(h==="stream"||h==="response");if(Yc&&(o||D&&S)){const U={};["status","statusText","headers"].forEach(v=>{U[v]=x[v]});const Q=F.toFiniteNumber(x.headers.get("content-length")),[ee,p]=o&&Bp(Q,Do(Pp(o),!0))||[];x=new Response(Fp(x.body,jp,ee,()=>{p&&p(),S&&S()}),U)}h=h||"text";let E=await Ho[F.findKey(Ho,h)||"text"](x,e);return!D&&S&&S(),await new Promise((U,Q)=>{Op(U,Q,{data:E,headers:Vt.from(x.headers),status:x.status,statusText:x.statusText,config:e,request:b})})}catch(L){throw S&&S(),L&&L.name==="TypeError"&&/fetch/i.test(L.message)?Object.assign(new be("Network Error",be.ERR_NETWORK,e,b),{cause:L.cause||L}):be.from(L,L&&L.code,e,b)}})};F.forEach(Xc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Wp=e=>`- ${e}`,cS=e=>F.isFunction(e)||e===null||e===!1,zp={getAdapter:e=>{e=F.isArray(e)?e:[e];const{length:t}=e;let i,s;const n={};for(let r=0;r<t;r++){i=e[r];let a;if(s=i,!cS(i)&&(s=Xc[(a=String(i)).toLowerCase()],s===void 0))throw new be(`Unknown adapter '${a}'`);if(s)break;n[a||"#"+r]=s}if(!s){const r=Object.entries(n).map(([o,u])=>`adapter ${o} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=t?r.length>1?`since :
|
85
85
|
`+r.map(Wp).join(`
|
86
86
|
`):" "+Wp(r[0]):"as no adapter specified";throw new be("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s},adapters:Xc};function Zc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Rn(null,e)}function Kp(e){return Zc(e),e.headers=Vt.from(e.headers),e.data=Kc.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),zp.getAdapter(e.adapter||Hr.adapter)(e).then(function(s){return Zc(e),s.data=Kc.call(e,e.transformResponse,s),s.headers=Vt.from(s.headers),s},function(s){return qp(s)||(Zc(e),s&&s.response&&(s.response.data=Kc.call(e,e.transformResponse,s.response),s.response.headers=Vt.from(s.response.headers))),Promise.reject(s)})}const Yp="1.7.7",Jc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Jc[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const Xp={};Jc.transitional=function(t,i,s){function n(r,a){return"[Axios v"+Yp+"] Transitional option '"+r+"'"+a+(s?". "+s:"")}return(r,a,o)=>{if(t===!1)throw new be(n(a," has been removed"+(i?" in "+i:"")),be.ERR_DEPRECATED);return i&&!Xp[a]&&(Xp[a]=!0,console.warn(n(a," has been deprecated since v"+i+" and will be removed in the near future"))),t?t(r,a,o):!0}};function uS(e,t,i){if(typeof e!="object")throw new be("options must be an object",be.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let n=s.length;for(;n-- >0;){const r=s[n],a=t[r];if(a){const o=e[r],u=o===void 0||a(o,r,e);if(u!==!0)throw new be("option "+r+" must be "+u,be.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new be("Unknown option "+r,be.ERR_BAD_OPTION)}}const eu={assertOptions:uS,validators:Jc},Es=eu.validators;class Xs{constructor(t){this.defaults=t,this.interceptors={request:new Mp,response:new Mp}}async request(t,i){try{return await this._request(t,i)}catch(s){if(s instanceof Error){let n;Error.captureStackTrace?Error.captureStackTrace(n={}):n=new Error;const r=n.stack?n.stack.replace(/^.+\n/,""):"";try{s.stack?r&&!String(s.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(s.stack+=`
|
87
|
-
`+r):s.stack=r}catch{}}throw s}}_request(t,i){typeof t=="string"?(i=i||{},i.url=t):i=t||{},i=Ys(this.defaults,i);const{transitional:s,paramsSerializer:n,headers:r}=i;s!==void 0&&eu.assertOptions(s,{silentJSONParsing:Es.transitional(Es.boolean),forcedJSONParsing:Es.transitional(Es.boolean),clarifyTimeoutError:Es.transitional(Es.boolean)},!1),n!=null&&(F.isFunction(n)?i.paramsSerializer={serialize:n}:eu.assertOptions(n,{encode:Es.function,serialize:Es.function},!0)),i.method=(i.method||this.defaults.method||"get").toLowerCase();let a=r&&F.merge(r.common,r[i.method]);r&&F.forEach(["delete","get","head","post","put","patch","common"],b=>{delete r[b]}),i.headers=Vt.concat(a,r);const o=[];let u=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(i)===!1||(u=u&&S.synchronous,o.unshift(S.fulfilled,S.rejected))});const h=[];this.interceptors.response.forEach(function(S){h.push(S.fulfilled,S.rejected)});let f,m=0,w;if(!u){const b=[Kp.bind(this),void 0];for(b.unshift.apply(b,o),b.push.apply(b,h),w=b.length,f=Promise.resolve(i);m<w;)f=f.then(b[m++],b[m++]);return f}w=o.length;let y=i;for(m=0;m<w;){const b=o[m++],S=o[m++];try{y=b(y)}catch(C){S.call(this,C);break}}try{f=Kp.call(this,y)}catch(b){return Promise.reject(b)}for(m=0,w=h.length;m<w;)f=f.then(h[m++],h[m++]);return f}getUri(t){t=Ys(this.defaults,t);const i=Dp(t.baseURL,t.url);return Lp(i,t.params,t.paramsSerializer)}}F.forEach(["delete","get","head","options"],function(t){Xs.prototype[t]=function(i,s){return this.request(Ys(s||{},{method:t,url:i,data:(s||{}).data}))}}),F.forEach(["post","put","patch"],function(t){function i(s){return function(r,a,o){return this.request(Ys(o||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:r,data:a}))}}Xs.prototype[t]=i(),Xs.prototype[t+"Form"]=i(!0)});class tu{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(r){i=r});const s=this;this.promise.then(n=>{if(!s._listeners)return;let r=s._listeners.length;for(;r-- >0;)s._listeners[r](n);s._listeners=null}),this.promise.then=n=>{let r;const a=new Promise(o=>{s.subscribe(o),r=o}).then(n);return a.cancel=function(){s.unsubscribe(r)},a},t(function(r,a,o){s.reason||(s.reason=new Rn(r,a,o),i(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const i=this._listeners.indexOf(t);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const t=new AbortController,i=s=>{t.abort(s)};return this.subscribe(i),t.signal.unsubscribe=()=>this.unsubscribe(i),t.signal}static source(){let t;return{token:new tu(function(n){t=n}),cancel:t}}}function hS(e){return function(i){return e.apply(null,i)}}function dS(e){return F.isObject(e)&&e.isAxiosError===!0}const iu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(iu).forEach(([e,t])=>{iu[t]=e});function Zp(e){const t=new Xs(e),i=mp(Xs.prototype.request,t);return F.extend(i,Xs.prototype,t,{allOwnKeys:!0}),F.extend(i,t,null,{allOwnKeys:!0}),i.create=function(n){return Zp(Ys(e,n))},i}const We=Zp(Hr);We.Axios=Xs,We.CanceledError=Rn,We.CancelToken=tu,We.isCancel=qp,We.VERSION=Yp,We.toFormData=Bo,We.AxiosError=be,We.Cancel=We.CanceledError,We.all=function(t){return Promise.all(t)},We.spread=hS,We.isAxiosError=dS,We.mergeConfig=Ys,We.AxiosHeaders=Vt,We.formToJSON=e=>Rp(F.isHTMLForm(e)?new FormData(e):e),We.getAdapter=zp.getAdapter,We.HttpStatusCode=iu,We.default=We;const fS={name:"QtiStylesheet",props:{href:{type:String,required:!0},type:{type:String,required:!0}},data(){return{css:"",isQtiValid:!0}},methods:{getCss(){We.get(this.href).then(e=>{this.css=`<style>${e.data}</style>`}).catch(e=>{console.log("["+this.$options.name+"][CSS Fetch Error: "+e+"]")})},validateChildren(){}},created(){this.getCss()},mounted(){if(this.isQtiValid)try{this.validateChildren(),console.log("["+this.$options.name+"][Href: "+this.href+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},pS=["innerHTML"];function mS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"root",class:"qti-stylesheet",innerHTML:n.css},null,8,pS)}const gS=B(fS,[["render",mS]]),yS={name:"QtiCompanionMaterialsInfo",data(){return{isQtiValid:!0}},methods:{validateChildren(){}},mounted(){if(this.isQtiValid)try{this.validateChildren(),console.log("["+this.$options.name+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},wS={class:"qti-companion-materials-info"};function bS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",wS)}const vS=B(yS,[["render",bS]]),Ur=new G,ES={name:"QtiMapping",props:{lowerBound:{type:String,required:!1},upperBound:{type:String,required:!1},defaultValue:{type:String,required:!1}},data(){return{value:null,valueBaseType:"float",valueCardinality:"single",valueLowerBound:null,valueUpperBound:null,valueDefaultValue:new X(0).toNumber(),isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},getLowerBound(){return this.valueLowerBound},setLowerBound(e){this.valueLowerBound=e},getUpperBound(){return this.valueUpperBound},setUpperBound(e){this.valueUpperBound=e},getDefaultValue(){return this.valueDefaultValue},setDefaultValue(e){this.valueDefaultValue=e},computeFloatValue(e){let t=null;try{t=new X(e)}catch(i){throw new se(i.message)}return t.toNumber()},applyConstraints(e){return e===null||!X.isBigNumber(e)?null:(this.getLowerBound()!==null&&e.comparedTo(this.getLowerBound())<0&&(e=new X(this.getLowerBound())),this.getUpperBound()!==null&&e.comparedTo(this.getUpperBound())>0&&(e=new X(this.getUpperBound())),e.toNumber())},validateChildren:function(){let e=0;if(!this.$slots.default)throw new c("Must have at least one qti-map-entry node");if(this.$slots.default().forEach(t=>{if(Ur.isValidSlot(t))if(Ur.kebabCase(t.type.name)==="qti-map-entry")e+=1;else throw new c('Node is not a qti-map-entry: "'+t.tpe.name+'"')}),e===0)throw new c("Must have at least one qti-map-entry node")},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{if(i.component===null)return;const s=i.component.proxy;e===null&&(e=[]),e.push(s.getValue())}),e}},created(){try{typeof this.lowerBound<"u"&&this.setLowerBound(this.computeFloatValue(Ur.FloatValue(this.lowerBound))),typeof this.upperBound<"u"&&this.setUpperBound(this.computeFloatValue(Ur.FloatValue(this.upperBound))),typeof this.defaultValue<"u"&&this.setDefaultValue(this.computeFloatValue(Ur.FloatValue(this.defaultValue))),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[QtiMapping][lowerBound][upperBound][defaultValue][Value]",this.getLowerBound(),this.getUpperBound(),this.getDefaultValue(),this.getValue())}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},TS={class:"qti-mapping"};function CS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",TS,[l.renderSlot(e.$slots,"default")])}const SS=B(ES,[["render",CS]]),su=new G,xS={name:"QtiMapEntry",props:{mapKey:{type:String,required:!0},mappedValue:{type:String,required:!0},caseSensitive:{type:String,required:!1}},data(){return{value:null,valueBaseType:"float",valueCardinality:"single",valueMappedValue:null,valueCaseSensitive:!1,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},setMappedValue(e){this.valueMappedValue=e},getMappedValue(){return this.valueMappedValue},setCaseSensitive(e){this.valueCaseSensitive=e},getCaseSensitive(){return this.valueCaseSensitive},computeMappedValue(e){let t=null;try{t=new X(e)}catch(i){throw new se(i.message)}return t.toNumber()},validateChildren:function(){this.$slots.default&&this.$slots.default().forEach(e=>{if(su.isValidSlot(e))throw new c('Invalid Child Node: "'+e.tpe.name+'"')})}},created(){try{this.setCaseSensitive(su.validateCaseSensitive(this.caseSensitive,!1)),this.setMappedValue(this.computeMappedValue(su.FloatValue(this.mappedValue))),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){let e=this.$el.querySelector(".amp-mapentry__container");this.isQtiValid&&(this.setValue({mapKey:this.mapKey,mappedValue:this.getMappedValue(),caseSensitive:this.getCaseSensitive()}),console.log("["+this.$options.name+"][Value]",this.getValue())),e.remove()}},_S={class:"qti-map-entry"},IS={class:"amp-mapentry__container"};function VS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",_S,[l.createElementVNode("div",IS,[l.renderSlot(e.$slots,"default")])])}const AS=B(xS,[["render",VS]]),$S={name:"QtiAreaMapping",methods:{},created:function(){},mounted:function(){console.log("[AreaMapping][Mounted]")}},LS={class:"qti-area-mapping"};function MS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",LS)}const NS=B($S,[["render",MS]]),nu=new G,RS={name:"QtiInterpolationTable",props:{defaultValue:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:"single",valueDefaultValue:null,tableType:"interpolation",isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},setBaseType(e){this.valueBaseType=e},getCardinality(){return this.valueCardinality},getTableType(){return this.tableType},getDefaultValue(){return this.valueDefaultValue},setDefaultValue(e){this.valueDefaultValue=e},validateChildren:function(){let e=0;if(!this.$slots.default)throw new c("Must have at least one qti-interpolation-table-entry node");if(this.$slots.default().forEach(t=>{if(nu.isValidSlot(t))if(nu.kebabCase(t.type.name)==="qti-interpolation-table-entry")e+=1;else throw new c('Node is not a qti-interpolation-table-entry: "'+t.tpe.name+'"')}),e===0)throw new c("Must have at least one qti-interpolation-table-entry node")},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{e===null&&(e=[]),e.push(i.getValue())}),e}},created(){try{let e=this.$parent.getBaseType();this.setBaseType(e),typeof this.defaultValue>"u"?this.setDefaultValue(null):this.setDefaultValue(nu.validateValueFromBaseType(e,this.defaultValue)),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[QtiInterpolationTable][DefaultValue][Value]",this.getDefaultValue(),this.getValue())}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},kS={class:"qti-interpolation-table"};function qS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",kS,[l.renderSlot(e.$slots,"default")])}const OS=B(RS,[["render",qS]]),Fo=new G,BS={name:"QtiInterpolationTableEntry",props:{sourceValue:{type:String,required:!0},includeBoundary:{type:String,required:!1},targetValue:{type:String,required:!0}},data(){return{value:null,valueSourceValue:null,valueTargetValue:null,valueIncludeBoundary:!0,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},setSourceValue(e){this.valueSourceValue=e},getSourceValue(){return this.valueSourceValue},setTargetValue(e){this.valueTargetValue=e},getTargetValue(){return this.valueTargetValue},setIncludeBoundary(e){this.valueIncludeBoundary=e},getIncludeBoundary(){return this.valueIncludeBoundary},computeSourceValue(e){let t=null;try{t=new X(e)}catch(i){throw new se(i.message)}return t.toNumber()},isValidSlot(e){if(typeof e.componentOptions<"u")return!0;if(typeof e.text<"u"&&e.text.trim().length>0)throw new c('Invalid Child Node: "'+e.text.trim()+'"');return!1},validateChildren(){this.$slots.default&&this.$slots.default().forEach(e=>{if(Fo.isValidSlot(e))throw new c('Invalid Child Node: "'+e.tpe.name+'"')})}},created(){try{let e=this.$parent.$parent.getBaseType();this.setIncludeBoundary(Fo.validateIncludeBoundary(this.includeBoundary,"include-boundary")),this.setSourceValue(this.computeSourceValue(Fo.FloatValue(this.sourceValue))),this.setTargetValue(Fo.validateValueFromBaseType(e,this.targetValue))}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw new c(e.message);if(e.name==="QtiParseException")throw new se(e.message)}},mounted(){let e=this.$el.querySelector(".amp-interpolationentry__container");this.isQtiValid&&(this.setValue({sourceValue:this.getSourceValue(),targetValue:this.getTargetValue(),includeBoundary:this.getIncludeBoundary()}),console.log("["+this.$options.name+"][Value]",this.getValue())),e.remove()}},PS={class:"qti-interpolation-table-entry"},DS={class:"amp-interpolationentry__container"};function QS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",PS,[l.createElementVNode("div",DS,[l.renderSlot(e.$slots,"default")])])}const HS=B(BS,[["render",QS]]),ru=new G,FS={name:"QtiMatchTable",props:{defaultValue:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:"single",valueDefaultValue:null,tableType:"match",isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},setBaseType(e){this.valueBaseType=e},getCardinality(){return this.valueCardinality},getTableType(){return this.tableType},getDefaultValue(){return this.valueDefaultValue},setDefaultValue(e){this.valueDefaultValue=e},validateChildren:function(){let e=0;if(!this.$slots.default)throw new c("Must have at least one qti-match-table-entry node");if(this.$slots.default().forEach(t=>{if(ru.isValidSlot(t))if(ru.kebabCase(t.type.name)==="qti-match-table-entry")e+=1;else throw new c('Node is not a qti-match-table-entry: "'+t.tpe.name+'"')}),e===0)throw new c("Must have at least one qti-match-table-entry node")},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{e===null&&(e=[]),e.push(i.getValue())}),e}},created(){try{let e=this.$parent.getBaseType();this.setBaseType(e),typeof this.defaultValue>"u"?this.setDefaultValue(null):this.setDefaultValue(ru.validateValueFromBaseType(e,this.defaultValue)),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[QtiMatchTable][DefaultValue][Value]",this.getDefaultValue(),this.getValue())}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},US={class:"qti-match-table"};function GS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",US,[l.renderSlot(e.$slots,"default")])}const jS=B(FS,[["render",GS]]),au=new G,WS={name:"QtiMatchTableEntry",props:{sourceValue:{type:String,required:!0},targetValue:{type:String,required:!0}},data(){return{value:null,valueSourceValue:null,valueTargetValue:null,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},setSourceValue(e){this.valueSourceValue=e},getSourceValue(){return this.valueSourceValue},setTargetValue(e){this.valueTargetValue=e},getTargetValue(){return this.valueTargetValue},computeSourceValue(e){let t=null;try{if(t=new X(e),!t.isInteger())throw new se('Invalid qti-match-table-entry source-value integer "'+t+'"')}catch(i){throw new se(i.message)}return t.toNumber()},validateChildren(){this.$slots.default&&this.$slots.default().forEach(e=>{if(au.isValidSlot(e))throw new c('Invalid Child Node: "'+e.tpe.name+'"')})}},created(){try{let e=this.$parent.$parent.getBaseType();this.setSourceValue(this.computeSourceValue(au.IntegerValue(this.sourceValue))),this.setTargetValue(au.validateValueFromBaseType(e,this.targetValue)),this.validateChildren()}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw new c(e.message);if(e.name==="QtiParseException")throw new se(e.message)}},mounted(){let e=this.$el.querySelector(".amp-matchtableentry__container");this.isQtiValid&&(this.setValue({sourceValue:this.getSourceValue(),targetValue:this.getTargetValue()}),console.log("["+this.$options.name+"][Value]",this.getValue())),e.remove()}},zS={class:"qti-match-table-entry"},KS={class:"amp-matchtableentry__container"};function YS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",zS,[l.createElementVNode("div",KS,[l.renderSlot(e.$slots,"default")])])}const XS=B(WS,[["render",YS]]),ZS={name:"QtiDefaultValue",props:{interpretation:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:null,variableBaseType:null,variableCardinality:null,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{if(i.component===null)return;const s=i.component.proxy;switch(this.variableCardinality){case"record":e===null&&(e=new Map),s.isRecordFieldValue()&&e.set(s.getFieldIdentifier(),s);break;case"multiple":case"ordered":e===null&&(e=[]),e.push(s.getValue());break;case"single":e=e===null?s.getValue():e;break;default:console.log("[DefaultValue][Cardinality]: processChildren cardinality unhandled = "+this.variableCardinality)}}),e},getVariableBaseType(){return this.$parent.$props.baseType},getVariableCardinality(){return this.$parent.$props.cardinality},evaluate(){return this.getValue()}},created(){try{this.valueBaseType=this.variableBaseType=this.getVariableBaseType(),this.valueCardinality=this.variableCardinality=this.getVariableCardinality()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[DefaultValue][Value:",this.getValue(),"][BaseType:"+this.getBaseType()+"][Cardinality:"+this.getCardinality()+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},JS={ref:"root",class:"qti-default-value"};function e1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",JS,[l.renderSlot(e.$slots,"default")],512)}const t1=B(ZS,[["render",e1]]),i1={name:"QtiCorrectResponse",props:{interpretation:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:null,variableBaseType:null,variableCardinality:null,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{if(i.component===null)return;const s=i.component.proxy;switch(this.variableCardinality){case"record":e===null&&(e=new Map),s.isRecordFieldValue()&&e.set(s.getFieldIdentifier(),s);break;case"multiple":case"ordered":e===null&&(e=[]),e.push(s.getValue());break;case"single":e=e===null?s.getValue():e;break;default:console.log("[CorrectResponse][Cardinality]: processChildren cardinality unhandled = "+this.variableCardinality)}}),e},getVariableBaseType(){return this.$parent.$props.baseType},getVariableCardinality(){return this.$parent.$props.cardinality},evaluate(){return this.getValue()}},created(){try{this.valueBaseType=this.variableBaseType=this.getVariableBaseType(),this.valueCardinality=this.variableCardinality=this.getVariableCardinality()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[CorrectResponse][Value:",this.getValue(),"][BaseType:"+this.getBaseType()+"][Cardinality:"+this.getCardinality()+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},s1={class:"qti-correct-response"};function n1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",s1,[l.renderSlot(e.$slots,"default")])}const r1=B(i1,[["render",n1]]);class Jp{constructor(){}IntegerValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid integer "'+t+'". Length is not valid.');try{let i=parseInt(t,10);if(Number.isNaN(i))throw new se('Invalid integer "'+t+'". ');return i}catch(i){throw new se('Invalid integer "'+t+'". '+i.message)}}FloatValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid float "'+t+'". Length is not valid.');try{let i=parseFloat(t);if(Number.isNaN(i))throw new se('Invalid float "'+t+'". ');return i}catch(i){throw new se('Invalid float "'+t+'". '+i.message)}}BooleanValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid boolean "'+t+'". Length is not valid.');if(t.toLowerCase()==="true"||t==="1")return!0;if(t.toLowerCase()==="false"||t==="0")return!1;throw new se('Invalid boolean "'+t+'".')}StringValue(t){if(t==null||t.length==0)throw new se('Invalid string "'+t+'". Length is not valid.');return t}IdentifierValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid identifier "'+t+'". Length is not valid.');if(!this.isCharacterALetter(t.charAt(0))&&!this.isCharacterADigit(t.charAt(0))&&t.charAt(0)!=="_")throw new se('Invalid identifier "'+t+'". First character "'+t.charAt(0)+'" is not valid.');for(let i=1;i<t.length;i++)if(!this.isCharacterALetterOrDigit(t.charAt(i))&&t.charAt(i)!=="_"&&t.charAt(i)!=="-"&&t.charAt(i)!==".")throw new se('Invalid identifier "'+t+'". Character "'+t.charAt(i)+'" at position '+(i+1)+" is not valid.");return t}isCharacterALetter(t){return/[a-zA-Z]/.test(t)}isCharacterADigit(t){return/\d/.test(t)}isCharacterALetterOrDigit(t){return this.isCharacterALetter(t)||this.isCharacterADigit(t)}}const ou=new G,kn=new Jp,a1={name:"QtiValue",props:{baseType:{type:String,required:!1},fieldIdentifier:{type:String,required:!1}},data(){return{singleValue:null,valueBaseType:null,valueCardinality:"single",valueFieldIdentifier:null,variableBaseType:null,variableCardinality:null,isQtiValid:!0}},methods:{getValue(){if(this.isNull())return null;switch(this.valueBaseType){case"integer":case"float":return this.singleValue.toNumber();case"boolean":return this.singleValue;case"string":case"identifier":case"directedPair":case"pair":return this.singleValue;default:return console.log("[QtiValue][GetValue Exception]","Unhandled BaseType:"+this.valueBaseType),null}},isNull(){return this.singleValue===null},getBaseType(){return this.valueBaseType},getCardinality(){return"single"},getFieldIdentifier(){return this.valueFieldIdentifier},isRecordFieldValue(){return this.valueFieldIdentifier!==null&&this.valueBaseType!==null},readChildren(e){this.valueBaseType!=null&&(this.singleValue=this.parseSingleValue(this.valueBaseType,e.textContent))},parseSingleValue(e,t){let i=null;try{switch(e){case"integer":i=new X(kn.IntegerValue(t));break;case"float":i=new X(kn.FloatValue(t));break;case"boolean":i=kn.BooleanValue(t);break;case"string":i=kn.StringValue(t);break;case"identifier":i=kn.IdentifierValue(t);break;case"directedPair":case"pair":i=kn.StringValue(t);break;default:throw new se('[QtiValue][Unhandled BaseType]: "'+e+'"')}}catch(s){throw new se(s.message)}return i},_getVariableBaseType(e){return typeof e<"u"?e.baseType:null},_getVariableCardinality(e){return typeof e<"u"?e.cardinality:null},_validateAttributes(e,t){if(t==="record"){if(typeof this.baseType>"u")throw new c('base-type is a required attribute for "record" cardinality');if(ou.validateBaseType(this.baseType),this.valueBaseType=this.baseType,typeof this.fieldIdentifier>"u")throw new c('field-identifier is a required attribute for "record" cardinality');ou.validateIdentifierAttribute(this.fieldIdentifier),this.valueFieldIdentifier=this.fieldIdentifier}else{if(typeof this.baseType<"u")throw new c("base-type only permitted for record cardinality.");if(typeof this.fieldIdentifier<"u")throw new c("field-identifier only permitted for record cardinality.");this.valueBaseType=e}},getStore(){return this.$parent.$parent.getDeclarationContext()==="TEST"?it:_}},created:function(){try{let e=ou.validateVariableIdentifierAttribute(this.getStore(),this.$parent.$parent.$props.identifier);if(typeof e>"u")throw new c('Variable declaration not found: "'+this.$parent.$parent.$props.identifier+'"');this.variableCardinality=this._getVariableCardinality(e),this.variableBaseType=this._getVariableBaseType(e),this._validateAttributes(this.variableBaseType,this.variableCardinality)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted:function(){let e=this.$el.querySelector(".amp-value__container");if(this.isQtiValid){try{this.readChildren(e)}catch(t){throw this.isQtiValid=!1,t.name==="QtiValidationException"?new c(t.message):t.name==="QtiParseException"?new se(t.message):new Error(t.message)}console.log("["+this.$options.name+"][Value:"+this.getValue()+"][BaseType:"+this.getBaseType()+"][FieldIdentifier:"+this.getFieldIdentifier()+"]")}e.remove()}},o1=["variable-basetype","variable-cardinality"],l1={class:"amp-value__container"};function c1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-value","variable-basetype":n.variableBaseType,"variable-cardinality":n.variableCardinality},[l.createElementVNode("div",l1,[l.renderSlot(e.$slots,"default")])],8,o1)}const u1=B(a1,[["render",c1]]),h1=new G,d1={name:"QtiItemBody",emits:["itemBodyReady"],data(){return{mathElementMap:new Map}},methods:{initializeTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathElements().forEach(function(i){this.archiveMathElement(i),i.innerHTML=this.applyTemplateValuesToMathml(i.innerHTML,e)},this)},updateTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathScriptElements().forEach(function(i){for(let[s,n]of this.mathElementMap){const r=new RegExp('id="('+s+')"',"g");if(i.innerHTML.match(r)){i.innerHTML=this.applyTemplateValuesToMathml(n,e);break}}},this),this.reprocessMML()},getTemplateMathVariables(){return _.getTemplateMathParameterVariables()},getMathElements(){return this.$el.querySelectorAll("math")},getMathScriptElements(){return this.$el.querySelectorAll('script[type="math/mml"]')},archiveMathElement(e){e.hasAttribute("id")||(e.id=h1.randomString(5,"a")),this.mathElementMap.set(e.id,e.outerHTML)},applyTemplateValuesToMathml(e,t){let i=e;return t.forEach(function(s){const n=new RegExp("<[mc]i[^>]*>("+s.identifier+")<\\/[mc]i>","g"),r=e.match(n);r&&(i=i.replace(n,r[0].replace(s.identifier,s.value)))}),i},reprocessMML(){this.$nextTick(()=>{window.MathJax&&window.MathJax.Hub.Queue(["Reprocess",window.MathJax.Hub,this.$refs.root])})}},mounted(){this.initializeTemplateMathVariables(),this.$parent.$emit("itemBodyReady",{itemBody:this})}},f1={ref:"root",class:"qti-item-body"};function p1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",f1,[l.renderSlot(e.$slots,"default")],512)}const m1=B(d1,[["render",p1]]),g1={name:"ModalDialog",data(){return{visible:!0}},methods:{hide(){this.$refs.mymodal.classList.remove("fade","show"),document.querySelector("body").classList.remove("modal-open")},show(){this.$refs.mymodal.classList.add("fade","show"),document.querySelector("body").classList.add("modal-open")}}},y1={key:0,ref:"mymodal",class:"qti3-player-modal"},w1={class:"qti3-player-modal-dialog qti3-player-modal-md qti3-player-modal-dialog-centered"},b1={class:"qti3-player-modal-content"},v1={class:"qti3-player-modal-header"},E1={class:"qti3-player-modal-body"},T1={class:"qti3-player-modal-footer"};function C1(e,t,i,s,n,r){return l.openBlock(),l.createBlock(l.Transition,{name:"fade"},{default:l.withCtx(()=>[n.visible?(l.openBlock(),l.createElementBlock("div",y1,[l.createElementVNode("div",w1,[t[2]||(t[2]=l.createElementVNode("span",{tabindex:"0"},null,-1)),l.createElementVNode("div",b1,[l.createElementVNode("header",v1,[l.renderSlot(e.$slots,"header",{},void 0,!0),l.createElementVNode("button",{type:"button",class:"qti3-player-close","aria-label":"Close",onClick:t[0]||(t[0]=a=>r.hide())},"×")]),l.createElementVNode("div",E1,[l.renderSlot(e.$slots,"body",{},void 0,!0)]),l.createElementVNode("footer",T1,[l.renderSlot(e.$slots,"footer",{},void 0,!0)])]),t[3]||(t[3]=l.createElementVNode("span",{tabindex:"0"},null,-1))]),l.createElementVNode("div",{class:"qti3-player-modal-backdrop",onClick:t[1]||(t[1]=a=>r.hide())})],512)):l.createCommentVNode("",!0)]),_:3})}const S1=B(g1,[["render",C1],["__scopeId","data-v-2611a8eb"]]),Gr=new G,x1={name:"QtiModalFeedback",components:{ModalDialog:S1},props:{identifier:{type:String,required:!0},outcomeIdentifier:{type:String,required:!0},showHide:{type:String,required:!0},title:{type:String,required:!1}},computed:{modalTitle(){return typeof this.title>"u"?void 0:this.title}},data(){return{outcomeDeclaration:null,mathElementMap:new Map,isQtiValid:!0}},inheritAttrs:!0,methods:{initializeTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathElements().forEach(function(i){this.archiveMathElement(i),i.innerHTML=this.applyTemplateValuesToMathml(i.innerHTML,e)},this)},updateTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathScriptElements().forEach(function(i){for(let[s,n]of this.mathElementMap){const r=new RegExp('id="('+s+')"',"g");if(i.innerHTML.match(r)){i.innerHTML=this.applyTemplateValuesToMathml(n,e);break}}},this),this.reprocessMML()},getTemplateMathVariables(){return _.getTemplateMathParameterVariables()},getMathElements(){return this.$el.querySelectorAll("math")},getMathScriptElements(){return this.$el.querySelectorAll('script[type="math/mml"]')},archiveMathElement(e){e.hasAttribute("id")||(e.id=Gr.randomString(5,"a")),this.mathElementMap.set(e.id,e.outerHTML)},applyTemplateValuesToMathml(e,t){let i=e;return t.forEach(function(s){const n=new RegExp("<[mc]i[^>]*>("+s.identifier+")<\\/[mc]i>","g"),r=e.match(n);r&&(i=i.replace(n,r[0].replace(s.identifier,s.value)))}),i},reprocessMML(){this.$nextTick(()=>{window.MathJax&&window.MathJax.Hub.Queue(["Reprocess",window.MathJax.Hub,this.$refs.root])})},display(e){e?this.$refs.modal.show():this.$refs.modal.hide()},evaluate(){if(this.outcomeDeclaration=Gr.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier),this.outcomeDeclaration.cardinality==="single"){if(this.outcomeDeclaration.value===this.identifier){this.display(this.show);return}this.show||this.display(!0);return}if(this.outcomeDeclaration.cardinality==="multiple"){for(let e=0;e<this.outcomeDeclaration.value.length;e++)if(this.outcomeDeclaration.value[e]===this.identifier){this.display(this.show);return}this.show||this.display(!0)}}},created(){try{let e=Gr.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier);if(e.baseType!=="identifier")throw new c('Invalid outcome variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid outcome variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Gr.validateIdentifierAttribute(this.identifier),this.show=Gr.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.initializeTemplateMathVariables(),_.defineFeedback({outcomeIdentifier:this.outcomeIdentifier,identifier:this.identifier,feedbackType:"Modal",node:this}),console.log("[ModalFeedback]",this)}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},_1={ref:"root",class:"qti-modal-feedback"};function I1(e,t,i,s,n,r){const a=l.resolveComponent("ModalDialog");return l.openBlock(),l.createElementBlock("div",_1,[l.createVNode(a,{ref:"modal"},{header:l.withCtx(()=>[l.createElementVNode("h5",null,l.toDisplayString(r.modalTitle),1)]),body:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),footer:l.withCtx(()=>[l.createElementVNode("button",{class:"qti-modal-feedback-ok",onClick:t[0]||(t[0]=o=>e.$refs.modal.hide())},"OK")]),_:3},512)],512)}const V1=B(x1,[["render",I1]]),A1={name:"QtiContentBody",data(){return{isQtiValid:!0}},mounted(){}},$1={ref:"root",class:"qti-content-body"};function L1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",$1,[l.renderSlot(e.$slots,"default")],512)}const M1=B(A1,[["render",L1]]),Uo=new G,N1={name:"QtiTemplateInline",props:{identifier:{type:String,required:!0},templateIdentifier:{type:String,required:!0},showHide:{type:String,required:!1,default:"show"}},data(){return{value:null,templateDeclaration:null,show:!0,isQtiValid:!0}},methods:{evaluate(){try{if(this.hideTemplate(),this.templateDeclaration=Uo.validateTemplateIdentifierAttribute(_,this.templateIdentifier),console.log("[QtiTemplateInline]["+this.templateIdentifier+"][Show]",this.show),this.templateDeclaration.cardinality==="single"){if(this.templateDeclaration.value===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.showTemplate();return}if(this.templateDeclaration.cardinality==="multiple"){for(let e=0;e<this.templateDeclaration.value.length;e++)if(this.templateDeclaration.value[e]===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.hideTemplate();return}}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}},hideTemplate(){this.$refs.root.classList.add("hidden")},showTemplate(){this.$refs.root.classList.remove("hidden")}},created(){try{let e=Uo.validateTemplateIdentifierAttribute(_,this.templateIdentifier);if(e.baseType!=="identifier")throw new c('Invalid template variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid template variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Uo.validateIdentifierAttribute(this.identifier),this.show=Uo.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.defineTemplate({node:this}),this.evaluate()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},R1={ref:"root",class:"qti-template-inline hidden"};function k1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",R1,[l.renderSlot(e.$slots,"default")],512)}const q1=B(N1,[["render",k1]]),Go=new G,O1={name:"QtiTemplateBlock",props:{identifier:{type:String,required:!0},templateIdentifier:{type:String,required:!0},showHide:{type:String,required:!1,default:"show"}},data(){return{value:null,templateDeclaration:null,show:!0,isQtiValid:!0}},methods:{evaluate(){try{if(this.hideTemplate(),this.templateDeclaration=Go.validateTemplateIdentifierAttribute(_,this.templateIdentifier),console.log("[QtiTemplateBlock]["+this.templateIdentifier+"][Show]",this.show),this.templateDeclaration.cardinality==="single"){if(this.templateDeclaration.value===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.showTemplate();return}if(this.templateDeclaration.cardinality==="multiple"){for(let e=0;e<this.templateDeclaration.value.length;e++)if(this.templateDeclaration.value[e]===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.showTemplate();return}}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}},hideTemplate(){this.$refs.root.classList.add("hidden")},showTemplate(){this.$refs.root.classList.remove("hidden")}},created(){try{let e=Go.validateTemplateIdentifierAttribute(_,this.templateIdentifier);if(e.baseType!=="identifier")throw new c('Invalid template variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid template variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Go.validateIdentifierAttribute(this.identifier),this.show=Go.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.defineTemplate({node:this}),this.evaluate()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},B1={ref:"root",class:"qti-template-block hidden"};function P1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",B1,[l.renderSlot(e.$slots,"default")],512)}const D1=B(O1,[["render",P1]]),jo=new G,Q1={name:"QtiFeedbackInline",props:{identifier:{type:String,required:!0},outcomeIdentifier:{type:String,required:!0},showHide:{type:String,required:!0}},data(){return{show:null,outcomeDeclaration:null,isQtiValid:!0}},methods:{defaultShowHide(){this.show?this.$refs.root.classList.add("hidden"):this.$refs.root.classList.remove("hidden")},display(e){e?this.$refs.root.classList.remove("hidden"):this.$refs.root.classList.add("hidden")},isOutcomeValueNull(e){return e===null},evaluate(){if(this.defaultShowHide(),this.outcomeDeclaration=jo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier),this.outcomeDeclaration.cardinality==="single"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;if(this.outcomeDeclaration.value===this.identifier){this.display(this.show);return}this.show||this.display(!0);return}if(this.outcomeDeclaration.cardinality==="multiple"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;for(let e=0;e<this.outcomeDeclaration.value.length;e++)if(this.outcomeDeclaration.value[e]===this.identifier){this.display(this.show);return}this.show||this.display(!0)}}},created(){try{let e=jo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier);if(e.baseType!=="identifier")throw new c('Invalid outcome variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid outcome variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');jo.validateIdentifierAttribute(this.identifier),this.show=jo.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.defaultShowHide(),_.defineFeedback({outcomeIdentifier:this.outcomeIdentifier,identifier:this.identifier,feedbackType:"Inline",show:this.show,node:this}),console.log("[FeedbackInline]",this)}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},H1={ref:"root",class:"qti-feedback-inline hidden"};function F1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",H1,[l.renderSlot(e.$slots,"default")],512)}const U1=B(Q1,[["render",F1]]),Wo=new G,G1={name:"QtiFeedbackBlock",props:{identifier:{type:String,required:!0},outcomeIdentifier:{type:String,required:!0},showHide:{type:String,required:!0}},data(){return{show:null,outcomeDeclaration:null,isQtiValid:!0}},methods:{defaultShowHide(){this.show?this.$refs.root.classList.add("hidden"):this.$refs.root.classList.remove("hidden")},display(e){e?this.$refs.root.classList.remove("hidden"):this.$refs.root.classList.add("hidden")},isOutcomeValueNull(e){return e===null},evaluate(){if(this.defaultShowHide(),this.outcomeDeclaration=Wo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier),console.log("[FeedbackBlock]["+this.identifier+"][evaluate]",this.outcomeIdentifier,this.outcomeDeclaration.value),this.outcomeDeclaration.cardinality==="single"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;if(this.outcomeDeclaration.value===this.identifier){this.display(this.show);return}this.show||this.display(!0);return}if(this.outcomeDeclaration.cardinality==="multiple"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;for(let e=0;e<this.outcomeDeclaration.value.length;e++)if(this.outcomeDeclaration.value[e]===this.identifier){this.display(this.show);return}this.show||this.display(!0)}}},created(){try{let e=Wo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier);if(e.baseType!=="identifier")throw new c('Invalid outcome variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid outcome variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Wo.validateIdentifierAttribute(this.identifier),this.show=Wo.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.defaultShowHide(),_.defineFeedback({outcomeIdentifier:this.outcomeIdentifier,identifier:this.identifier,feedbackType:"Block",show:this.show,node:this}),console.log("[FeedbackBlock]",this)}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},j1={ref:"root",class:"qti-feedback-block hidden"};function W1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",j1,[l.renderSlot(e.$slots,"default")],512)}const z1=B(G1,[["render",W1]]),K1=new G,Y1=new ie,X1={name:"QtiRubricBlock",props:{view:{type:String,required:!0},use:{type:String,required:!1}},data(){return{rubricBlockContext:null,isQtiValid:!0}},computed:{isScoringRubricBlock(){const e=this.view.split(" ");for(let t=0;t<e.length;t++)if(e[t]==="scorer")return!0;return!1}},methods:{getView(){return this.view},getUse(){return this.use},getInnerHtml(){return this.$refs.root.innerHTML},getStore(){return this.rubricBlockContext==="TEST"?it:_},validateChildren(){},evaluate(){if(!this.isScoringRubricBlock){this.$refs.root.classList.remove("hidden");return}this.$refs.root.innerHTML=""}},created(){try{this.rubricBlockContext=Y1.computeNodeContext(this),K1.validateRubricBlockViewAttribute(this.view),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.isScoringRubricBlock&&this.getStore().defineScoringRubricBlock({view:this.view,html:this.$refs.root.innerHTML,node:this}),this.evaluate(),console.log("["+this.$options.name+"]["+this.rubricBlockContext+"][View: "+this.view+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},Z1={ref:"root",class:"qti-rubric-block hidden"};function J1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",Z1,[l.renderSlot(e.$slots,"default")],512)}const ex=B(X1,[["render",J1]]);var Ts=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function em(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tm={},zo={},im={},Ko={};Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.boolean=void 0;const tx=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());case"[object Number]":return e.valueOf()===1;case"[object Boolean]":return e.valueOf();default:return!1}};Ko.boolean=tx;var Yo={};Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.isBooleanable=void 0;const ix=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1","false","f","no","n","off","0"].includes(e.trim().toLowerCase());case"[object Number]":return[0,1].includes(e.valueOf());case"[object Boolean]":return!0;default:return!1}};Yo.isBooleanable=ix,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isBooleanable=e.boolean=void 0;const t=Ko;Object.defineProperty(e,"boolean",{enumerable:!0,get:function(){return t.boolean}});const i=Yo;Object.defineProperty(e,"isBooleanable",{enumerable:!0,get:function(){return i.isBooleanable}})}(im);var Xo={};Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.tokenize=void 0;const sx=/(?:%(?<flag>([+0-]|-\+))?(?<width>\d+)?(?<position>\d+\$)?(?<precision>\.\d+)?(?<conversion>[%BCESb-iosux]))|(\\%)/g,nx=e=>{let t;const i=[];let s=0,n=0,r=null;for(;(t=sx.exec(e))!==null;){t.index>n&&(r={literal:e.slice(n,t.index),type:"literal"},i.push(r));const a=t[0];n=t.index+a.length,a==="\\%"||a==="%%"?r&&r.type==="literal"?r.literal+="%":(r={literal:"%",type:"literal"},i.push(r)):t.groups&&(r={conversion:t.groups.conversion,flag:t.groups.flag||null,placeholder:a,position:t.groups.position?Number.parseInt(t.groups.position,10)-1:s++,precision:t.groups.precision?Number.parseInt(t.groups.precision.slice(1),10):null,type:"placeholder",width:t.groups.width?Number.parseInt(t.groups.width,10):null},i.push(r))}return n<=e.length-1&&(r&&r.type==="literal"?r.literal+=e.slice(n):i.push({literal:e.slice(n),type:"literal"})),i};Xo.tokenize=nx,Object.defineProperty(zo,"__esModule",{value:!0}),zo.createPrintf=void 0;const sm=im,rx=Xo,ax=(e,t)=>t.placeholder,ox=e=>{var t;const i=(r,a,o)=>o==="-"?r.padEnd(a," "):o==="-+"?((Number(r)>=0?"+":"")+r).padEnd(a," "):o==="+"?((Number(r)>=0?"+":"")+r).padStart(a," "):o==="0"?r.padStart(a,"0"):r.padStart(a," "),s=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:ax,n={};return(r,...a)=>{let o=n[r];o||(o=n[r]=rx.tokenize(r));let u="";for(const h of o)if(h.type==="literal")u+=h.literal;else{let f=a[h.position];if(f===void 0)u+=s(r,h,a);else if(h.conversion==="b")u+=sm.boolean(f)?"true":"false";else if(h.conversion==="B")u+=sm.boolean(f)?"TRUE":"FALSE";else if(h.conversion==="c")u+=f;else if(h.conversion==="C")u+=String(f).toUpperCase();else if(h.conversion==="i"||h.conversion==="d")f=String(Math.trunc(f)),h.width!==null&&(f=i(f,h.width,h.flag)),u+=f;else if(h.conversion==="e")u+=Number(f).toExponential();else if(h.conversion==="E")u+=Number(f).toExponential().toUpperCase();else if(h.conversion==="f")h.precision!==null&&(f=Number(f).toFixed(h.precision)),h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=f;else if(h.conversion==="o")u+=(Number.parseInt(String(f),10)>>>0).toString(8);else if(h.conversion==="s")h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=f;else if(h.conversion==="S")h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=String(f).toUpperCase();else if(h.conversion==="u")u+=Number.parseInt(String(f),10)>>>0;else if(h.conversion==="x")f=(Number.parseInt(String(f),10)>>>0).toString(16),h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=f;else throw new Error("Unknown format specifier.")}return u}};zo.createPrintf=ox,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=zo;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()}(tm);const nm=new G,lx={name:"QtiPrintedVariable",props:{id:{type:String,required:!1},language:{type:String,required:!1},label:{type:String,required:!1},baseuri:{type:String,required:!1},identifier:{type:String,required:!0},format:{type:String,required:!1},base:{type:String,required:!1},index:{type:String,required:!1},powerForm:{type:String,required:!1},field:{type:String,required:!1},delimiter:{type:String,required:!1},mappingIndicator:{type:String,required:!1}},data(){return{value:this.identifier,declaration:null,isQtiValid:!0}},methods:{printedValue(e){return typeof this.format>"u"?e:tm.printf(this.format,e)},evaluate(){try{this.declaration=nm.validatePrintedVariableIdentifierAttribute(_,this.identifier),this.value=this.printedValue(this.declaration.value),console.log("[QtiPrintedVariable]["+this.identifier+"][Value]",this.value)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},created(){try{nm.validatePrintedVariableIdentifierAttribute(_,this.identifier)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.definePrintedVariable({node:this}),this.evaluate()}catch(e){throw this.isQtiValid=!1,new c(e.message)}}};function cx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"root",class:"qti-printed-variable"},l.toDisplayString(n.value),513)}const ux=B(lx,[["render",cx]]);class hx{constructor(){this.constants={LABELS_UPPER_ALPHA:["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],LABELS_LOWER_ALPHA:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],LABELS_DECIMAL:["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26"],LABELS_CJK_IDEOGRAPHIC:["一","二","三","四","五","六","七","八","九","十"],LABELS_SUFFIX_PERIOD:".",LABELS_SUFFIX_PARENTHESIS:")",LABELS_SUFFIX_NONE:"",LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA:"、",QTI_LABELS_NONE:"qti-labels-none",QTI_LABELS_DECIMAL:"qti-labels-decimal",QTI_LABELS_LOWER_ALPHA:"qti-labels-lower-alpha",QTI_LABELS_UPPER_ALPHA:"qti-labels-upper-alpha",QTI_LABELS_CJK_IDEOGRAPHIC:"qti-labels-cjk-ideographic",QTI_LABELS_SUFFIX_NONE:"qti-labels-suffix-none",QTI_LABELS_SUFFIX_PERIOD:"qti-labels-suffix-period",QTI_LABELS_SUFFIX_PARENTHESIS:"qti-labels-suffix-parenthesis",QTI_LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA:"qti-labels-cjk-ideographic-comma",QTI_ORIENTATION_VERTICAL:"qti-orientation-vertical",QTI_ORIENTATION_HORIZONTAL:"qti-orientation-horizontal",QTI_INPUT_CONTROL_HIDDEN:"qti-input-control-hidden",SBAC_PRESENTATION:"sbac",LRN_PRESENTATION:"lrn",QTI_CHOICES_STACKING_1:"qti-choices-stacking-1",QTI_CHOICES_STACKING_2:"qti-choices-stacking-2",QTI_CHOICES_STACKING_3:"qti-choices-stacking-3",QTI_CHOICES_STACKING_4:"qti-choices-stacking-4",QTI_CHOICES_STACKING_5:"qti-choices-stacking-5",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message"},this.parentClassList=null,this.choiceGroupNode=null,this.choices=null,this.presentation_HideLabels=!1,this.presentation_Labels=this.constants.LABELS_UPPER_ALPHA,this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_PERIOD,this.presentation_Sbac=!1,this.presentation_Lrn=!1,this.presentation_IsInputControlHidden=!1,this.presentation_IsOrientationVertical=!1,this.presentation_IsOrientationHorizontal=!1,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage="",this.presentation_Label_Style="",this.presentation_Stacking_Class=""}initialize(t){this.choiceGroupNode=t,this.parentClassList=t.choiceInteractionClassAttribute,this.choices=t.choices,this.processRootClassAttribute(this.parentClassList),this.processStackingClass(),this.processLabelsAndInputControls()}processRootClassAttribute(t){const i=t.values();for(let s of i)switch(s){case this.constants.QTI_ORIENTATION_VERTICAL:this.presentation_IsOrientationVertical=!0,this.presentation_IsOrientationHorizontal=!1;break;case this.constants.QTI_ORIENTATION_HORIZONTAL:this.presentation_IsOrientationVertical=!1,this.presentation_IsOrientationHorizontal=!0;break;case this.constants.QTI_CHOICES_STACKING_1:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_1;break;case this.constants.QTI_CHOICES_STACKING_2:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_2;break;case this.constants.QTI_CHOICES_STACKING_3:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_3;break;case this.constants.QTI_CHOICES_STACKING_4:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_4;break;case this.constants.QTI_CHOICES_STACKING_5:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_5;break;case this.constants.QTI_LABELS_NONE:this.presentation_HideLabels=!0;break;case this.constants.QTI_LABELS_UPPER_ALPHA:this.presentation_Labels=this.constants.LABELS_UPPER_ALPHA;break;case this.constants.QTI_LABELS_LOWER_ALPHA:this.presentation_Labels=this.constants.LABELS_LOWER_ALPHA;break;case this.constants.QTI_LABELS_DECIMAL:this.presentation_Labels=this.constants.LABELS_DECIMAL;break;case this.constants.QTI_LABELS_CJK_IDEOGRAPHIC:this.presentation_Labels=this.constants.LABELS_CJK_IDEOGRAPHIC;break;case this.constants.QTI_LABELS_SUFFIX_NONE:this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_NONE;break;case this.constants.QTI_LABELS_SUFFIX_PERIOD:this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_PERIOD;break;case this.constants.QTI_LABELS_SUFFIX_PARENTHESIS:this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_PARENTHESIS;break;case this.constants.QTI_LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA:this.presentation_LabelsSuffix=this.constants.QTI_LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA;break;case this.constants.QTI_INPUT_CONTROL_HIDDEN:this.presentation_IsInputControlHidden=!0;break;case this.constants.SBAC_PRESENTATION:this.presentation_Sbac=!0;break;case this.constants.LRN_PRESENTATION:this.presentation_Lrn=!0;break}}processStackingClass(){if(this.presentation_Stacking_Class!==""&&!this.presentation_IsOrientationVertical&&!this.presentation_IsOrientationHorizontal)this.choices.length>1?this.presentation_IsOrientationHorizontal=!0:this.presentation_IsOrientationVertical=!0;else if(this.presentation_Stacking_Class===""&&this.presentation_IsOrientationHorizontal){const t=this.choices.length;t>=5?this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_5:t==4?this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_4:t==3?this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_3:t==2&&(this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_2),t==1&&(this.presentation_IsOrientationVertical=!0,this.presentation_IsOrientationHorizontal=!1)}!this.presentation_IsOrientationVertical&&!this.presentation_IsOrientationHorizontal&&(this.presentation_IsOrientationVertical=!0),this.choiceGroupNode.$refs.choicegroup.classList.add(this.presentation_IsOrientationVertical?this.constants.QTI_ORIENTATION_VERTICAL:this.constants.QTI_ORIENTATION_HORIZONTAL),this.presentation_Stacking_Class!==""&&this.choiceGroupNode.$refs.choicegroup.classList.add(this.presentation_Stacking_Class)}processLabelsAndInputControls(){for(let t=0;t<this.choices.length;t++)this.presentation_HideLabels?this.choices[t].hideLabel():this.presentation_Sbac?this.choices[t].setLabelSbac(this.presentation_Labels[t]):this.choices[t].setLabel(this.presentation_Labels[t]+this.presentation_LabelsSuffix),this.presentation_Lrn&&this.choices[t].setChoiceLrn(),this.presentation_IsInputControlHidden&&this.choices[t].hideControl()}}const dx=new G,fx=new ie,px={props:{responseIdentifier:{required:!0,type:String},cardinality:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},maxChoices:{required:!1,type:String,default:"1"}},data(){return{choices:[],firstChoice:null,lastChoice:null,role:null,isRadio:null,isShuffle:null,hasPrompt:!1,choiceInteractionClassAttribute:null,presentationFactory:null,isQtiValid:!0,priorState:null}},methods:{getPriorState(){return this.priorState},setPriorState(e){this.priorState=e},validateChildren(){let e=!1;this.$slots.default&&this.$slots.default()[0].children.forEach(t=>{if(dx.isValidSlot(t)){if(t.type.name==="QtiPrompt"){if(e)throw new c("Invalid element order. qti-prompt must come before qti-simple-choices");if(!this.hasPrompt)return this.hasPrompt=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(t.type.name==="QtiSimpleChoice")return e=!0;if(t.type.name!=="QtiSimpleChoice")throw new c('Node is not a qti-simple-choice: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children[0].children.forEach(t=>{t.component!==null&&t.type.name==="QtiSimpleChoice"&&this.choices.push(t.component.proxy)},this)},processGroupUI(){this.isShuffle&&this.processShuffle(),this.presentationFactory.initialize(this),this.setActiveDescendant(""),this.isRadio&&this.processFirstAndLastChoices()},resetGroupUI(){this.setPriorState(null),this.processGroupUI(),this.$emit("choiceGroupReady",{choices:this.choices,firstChoice:this.firstChoice,lastChoice:this.lastChoice})},processShuffle(){let e=this.createShuffleContainer(this.choices,this.getPriorState()),t=null;if(this.hasPrompt){const i=this.$refs.choicegroup.querySelector(".qti-prompt");i!==null&&(t=i.cloneNode(!0))}this.choices.splice(0,this.choices.length),this.$refs.choicegroup.innerHTML="",t!==null&&this.$refs.choicegroup.appendChild(t),e.forEach(i=>{this.$refs.choicegroup.appendChild(i.node.$el),this.choices.push(i.node)},this)},createShuffleContainer(e,t){let i=[];return t===null?(e.forEach(s=>{i.push({fixed:s.fixed==="true",node:s})}),fx.shuffleArrayFixed(i),i):(t.state.order.forEach(s=>{i.push({node:this.findChoiceByIdentifier(s,e)})},this),i)},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Choice Interaction State Invalid. Choice identifier "'+e+'" not found.')},processFirstAndLastChoices(){this.choices.length!==0&&(this.firstChoice=this.choices[0],this.lastChoice=this.choices[this.choices.length-1])},setActiveDescendant(e){this.$refs.choicegroup.setAttribute("aria-activedescendant",e)},initializeChoiceGroup(){switch(this.cardinality){case"single":this.role="radiogroup",this.isRadio=!0;break;case"multiple":this.role="group",this.isRadio=!1;break;default:this.role="radiogroup",this.isRadio=!0;break}this.isShuffle=this.shuffle==="true",this.presentationFactory=new hx}},created(){try{if(typeof this.cardinality>"u")throw new c("Undefined qti-choice-interaction cardinality");this.initializeChoiceGroup(),this.validateChildren()}catch(e){throw this.isQtiValid=!1,console.log("[QtiChoiceInteraction][ValidationError]",e.name,e.message),new c(e.message)}},mounted(){if(this.isQtiValid)try{this.choiceInteractionClassAttribute=this.$parent.$refs.root.classList,this.processChildren(),this.setPriorState(this.$parent.priorState),this.processGroupUI(),this.$emit("choiceGroupReady",{choices:this.choices,firstChoice:this.firstChoice,lastChoice:this.lastChoice})}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw console.log("[QtiChoiceInteraction][ValidationException]",e.message),new c(e.message);if(e.name==="QtiEvaluationException")throw console.log("[QtiChoiceInteraction][EvaluationException]",e.message),new O(e.message)}}},mx=["role"];function gx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("ul",{ref:"choicegroup",role:n.role,class:"qti-choice-list"},[l.renderSlot(e.$slots,"default")],8,mx)}const rm=B(px,[["render",gx]]),am=new G,yx={name:"QtiChoiceInteraction",components:[rm],props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},orientation:{required:!1,type:String},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,choices:[],firstChoice:null,lastChoice:null,currentChoice:null,isRadio:!0,isShuffle:!1,hasPrompts:!1,isDisabled:!1,isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.toggleDisableChoices(!0)},enable(){this.toggleDisableChoices(!1)},toggleDisableChoices(e){this.isDisabled=e,this.choices.forEach(t=>{t.setIsDisabled(e)})},getInvalidResponseMessage(){return this.minSelectionsMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.choices.forEach(e=>{e.setChecked(!1),this.isRadio&&e.setTabIndex("-1")}),this.currentChoice=null,this.priorState=null,this.$refs.choicegroup.resetGroupUI()},restoreValue(e){e!==null&&(this.isRadio?this.handleSetChecked({identifier:e,checked:"true"},!0):e.forEach(t=>{this.handleSetChecked({identifier:t,checked:"true"},!0)},this),this.updateValidity(this.computeIsValid()))},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality!=="multiple"?"single":"multiple":"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleSetChecked(e,t=!1){this.choices.forEach(i=>{this.isRadio&&(i.setChecked(!1),i.setTabIndex("-1")),i.identifier===e.identifier&&(this.currentChoice=i)}),e.checked==="true"?this.checkMaxChoicesLimit()?this.currentChoice.setChecked(!1):this.currentChoice.setChecked(!0):this.currentChoice.setChecked(!1),t||(this.setResponse(this.computeResponse()),this.currentChoice.setFocus(),this.evaluateValidity()),this.currentChoice.setTabIndex("0")},handleSetFocusPreviousChoice(e){this.isRadio&&this.removeChoiceFromTabOrder(e),this.setFocusChoice(this.findPreviousIdentifier(e))},handleSetFocusNextChoice(e){this.isRadio&&this.removeChoiceFromTabOrder(e),this.setFocusChoice(this.findNextIdentifier(e))},handleSetActiveDescendant(e){this.$refs.choicegroup.setActiveDescendant(e)},setFocusChoice(e){for(let t=0;t<this.choices.length;t++)this.choices[t].identifier===e&&(this.currentChoice=this.choices[t]);this.currentChoice.setTabIndex("0"),this.currentChoice.setFocus()},removeChoiceFromTabOrder(e){for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e){this.choices[t].setTabIndex(-1);break}},findPreviousIdentifier(e){if(e===this.firstChoice.identifier)return this.lastChoice.identifier;for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e)return this.choices[t-1].identifier;return null},findNextIdentifier(e){if(e===this.lastChoice.identifier)return this.firstChoice.identifier;for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e)return this.choices[t+1].identifier;return null},handleChoiceGroupReady(e){this.choices=e.choices,this.firstChoice=e.firstChoice,this.lastChoice=e.lastChoice,this.isRadio&&this.firstChoice.setTabIndex("0"),this.priorState!==null&&this.restoreValue(this.priorState.value),this.setResponse(this.computeResponse()),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},computeResponse(){let e=this.isRadio?null:[];return this.choices.forEach(t=>{t.isChecked()&&(this.isRadio?e=t.identifier:e.push(t.identifier))}),this.isRadio?e:e.length===0?null:e},computeState(){const e={};let t=[];return this.choices.forEach(i=>{t.push(i.identifier)}),e.order=t,e},computeIsValid(){return this.minChoices*1===0?!0:this.response===null?!1:this.cardinality==="single"||this.cardinality==="multiple"&&this.response.length>=this.minChoices*1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},checkMaxChoicesLimit(){if(this.isRadio||this.maxChoices==0)return!1;const e=this.getResponse();return e!==null&&e.length==this.maxChoices?(_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage),!0):!1},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoices==0?"":"You are permitted a maximum of "+this.maxChoices+" choice"+(this.maxChoices>1?"s":"")+" for this question.<br/><br/>Please unselect one of your choices before making another choice."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minSelectionsMessage=this.minChoices==0?"":"You must make at least "+this.minChoices+" choice"+(this.minChoices>1?"s":"")+" for this question."},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Choice Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Choice Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Choice Interaction State Invalid. "order" property not found.');return t},showSolution(e){if(e!==null){if(this.isRadio){this.choices.forEach(t=>{this.setChoiceSolution(t,e)},this);return}this.choices.forEach(t=>{const i=this.findIdentifierInCorrectResponse(t.identifier,e);this.setChoiceSolution(t,i)},this)}},setChoiceSolution(e,t){e.isChecked()?e.identifier===t?e.setCorrectSolution():e.setIncorrectSolution():e.identifier===t?e.setExpectedSolution():e.setIgnoreSolution()},findIdentifierInCorrectResponse(e,t){for(let i=0;i<t.length;i++)if(e===t[i])return e;return null}},created(){try{this.responseDeclaration=am.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.priorState=this.getPriorState(this.responseIdentifier),am.validateMaxMinChoices(this.maxChoices,this.minChoices),this.cardinality=this.getCardinality(),this.isRadio=this.cardinality!=="multiple",this.isShuffle=this.shuffle==="true",this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Choice",node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},wx={ref:"root",class:"qti-choice-interaction"},bx={ref:"prompt",class:"qti-prompt-wrapper"};function vx(e,t,i,s,n,r){const a=l.resolveComponent("ChoiceGroup");return l.openBlock(),l.createElementBlock("div",wx,[l.createElementVNode("div",bx,null,512),l.createVNode(a,l.mergeProps({ref:"choicegroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxChoices:i.maxChoices,minChoices:i.minChoices,onChoiceGroupReady:r.handleChoiceGroupReady,onSetChecked:r.handleSetChecked,onSetFocusNextChoice:r.handleSetFocusNextChoice,onSetFocusPreviousChoice:r.handleSetFocusPreviousChoice,onSetActiveDescendant:r.handleSetActiveDescendant},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxChoices","minChoices","onChoiceGroupReady","onSetChecked","onSetFocusNextChoice","onSetFocusPreviousChoice","onSetActiveDescendant"])],512)}const Ex=B(yx,[["render",vx]]);class Tx{constructor(t){return this.constants={QTI_ORIENTATION_HORIZONTAL:"qti-orientation-horizontal",QTI_ORIENTATION_VERTICAL:"qti-orientation-vertical",QTI_WRITING_ORIENTATION_VERTICAL_RL:"qti-writing-orientation-vertical-rl"},this.classList=t,this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_ORIENTATION_VERTICAL:case this.constants.QTI_WRITING_ORIENTATION_VERTICAL_RL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_VERTICAL;break;case this.constants.QTI_ORIENTATION_HORIZONTAL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL;break}}getOrientationClass(){return this.presentation_OrientationClass}isOrientationVertical(){return this.presentation_OrientationClass==this.constants.QTI_ORIENTATION_VERTICAL}setVerticalOrientation(t){this.isOrientationVertical()&&t.classList.add(this.constants.QTI_ORIENTATION_VERTICAL)}}const lu=new G,Cx=new ie,Sx={name:"QtiInlineChoiceInteraction",props:{responseIdentifier:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},required:{required:!1,type:String,default:"false"},dataPrompt:{required:!1,type:String,default:"Choose..."},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},dataMinSelectionsMessage:{required:!1,type:String}},computed:{labelId(){return"inlinechoice_label_"+this.responseIdentifier},buttonId(){return"inlinechoice_button_"+this.responseIdentifier},buttonAriaLabelledbyId(){return"inlinechoice_label_"+this.responseIdentifier+" inlinechoice_button_"+this.responseIdentifier},listboxId(){return"inlinechoice_listbox_"+this.responseIdentifier},listboxAriaLabelledbyId(){return"inlinechoice_label_"+this.responseIdentifier}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",choices:[],allOptionElements:null,activeDescendant:null,keysSoFar:"",searchIndex:null,isShuffle:null,isRequired:!1,isDisabled:!1,isQtiValid:!0,presentationFactory:null,isOrientationVertical:!1,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.toggleDisable(!0)},enable(){this.toggleDisable(!1)},toggleDisable(e){this.isDisabled=e,e?(this.getResponse()===null&&(this.$refs.label.innerHTML=""),this.$refs.label.classList.remove("qti-hidden"),this.$refs.label.setAttribute("tabIndex",0),this.$refs.button.classList.add("qti-hidden"),this.$refs.listbox.classList.add("inline-choice-select-listbox-hidden")):(this.$refs.label.classList.add("qti-hidden"),this.$refs.label.setAttribute("tabIndex",-1),this.$refs.button.classList.remove("qti-hidden"))},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.$refs.listbox.querySelectorAll('[role="option"]').forEach(t=>{this.defocusOption(t)},this),this.processGroupUI()},restoreValue(e){if(e===null)return;const t=this.findChoiceByIdentifier(e,this.choices);this.focusOption(t.$el,!0),this.setResponse(this.computeResponse(e)),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);if(typeof e>"u"&&(this.cardinality="single"),e.cardinality!=="single")throw new c('Invalid qti-inline-choice-interaction Response Variable cardinality: "'+this.cardinality+'"');return this.cardinality="single",this.cardinality},computeResponse(e){return e===null||e.length===0?null:e},computeState(){const e={};let t=[];return this.choices.forEach(i=>{t.push(i.identifier)}),e.order=t,e},computeIsValid(){return!this.isRequired&&this.minChoices*1===0?!0:this.response!==null},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}!this.isRequired&&this.minChoices*1===0||(this.minSelectionsMessage="You must make at least 1 choice for this question.")},handleButtonClick(){this.isDisabled||this.showListbox()},handleButtonKeyup(e){switch(e.code){case"ArrowUp":case"ArrowDown":if(e.preventDefault(),this.isDisabled)return;this.showListbox();break}},handleChoiceMousedown(e){e.preventDefault();let t=e.target;t.getAttribute("role")==="option"&&(this.focusOption(t),this.hideListbox(),this.$refs.button.focus())},handleBlur(){this.hideListbox()},handleFocusChange(e){this.$refs.prompt.innerHTML=e.innerHTML,this.$refs.label.innerHTML=e.innerHTML},showListbox(){this.$refs.listbox.classList.remove("inline-choice-select-listbox-hidden"),this.$refs.button.setAttribute("aria-expanded","true"),this.$refs.listbox.focus()},hideListbox(){this.$refs.listbox.classList.add("inline-choice-select-listbox-hidden"),this.$refs.button.removeAttribute("aria-expanded")},setupFocus(){this.activeDescendant||this.focusFirstOption()},focusFirstOption(){let e=this.$refs.listbox.querySelector('[role="option"]');e&&this.focusOption(e)},focusLastOption(){let e=this.$refs.listbox.querySelectorAll('[role="option"]');e.length&&this.focusOption(e[e.length-1])},focusOption(e,t=!1){if(t||this.defocusOption(document.getElementById(this.activeDescendant)),e.setAttribute("aria-selected","true"),e.classList.add("focused"),this.setActiveDescendant(e.id),!t&&(this.setResponse(this.computeResponse(e.getAttribute("data-identifier"))),this.evaluateValidity(),this.$refs.listbox.scrollHeight>this.$refs.listbox.clientHeight)){const i=this.$refs.listbox.clientHeight+this.$refs.listbox.scrollTop,s=e.offsetTop+e.offsetHeight;s>i?this.$refs.listbox.scrollTop=s-this.$refs.listbox.clientHeight:e.offsetTop<this.$refs.listbox.scrollTop&&(this.$refs.listbox.scrollTop=e.offsetTop)}this.handleFocusChange(e)},defocusOption(e){e&&(e.removeAttribute("aria-selected"),e.classList.remove("focused"))},checkKeyPress(e){if(e.code=="Enter"||e.code=="Escape"){e.preventDefault(),this.hideListbox(),this.$refs.button.focus();return}let t=document.getElementById(this.activeDescendant);if(t)switch(e.code){case"ArrowUp":case"ArrowDown":e.preventDefault(),e.code=="ArrowUp"?t=t.previousElementSibling:t=t.nextElementSibling,t&&this.focusOption(t);break;case"Home":e.preventDefault(),this.focusFirstOption();break;case"End":e.preventDefault(),this.focusLastOption();break}},findOptionToFocus(e){let t=this.$refs.listbox.querySelectorAll('[role="option"]');if(!this.keysSoFar)for(let s=0;s<t.length;s++)t[s].getAttribute("id")==this.activeDescendant&&(this.searchIndex=s);this.keysSoFar+=e,this.clearKeysSoFarAfterDelay();let i=this.findMatchInRange(t,this.searchIndex+1,t.length);return i||(i=this.findMatchInRange(t,0,this.searchIndex)),i},clearKeysSoFarAfterDelay(){this.keyClear&&(clearTimeout(this.keyClear),this.keyClear=null);let e=this;this.keyClear=setTimeout((function(){e.keysSoFar="",e.keyClear=null}).bind(this),500)},findMatchInRange(e,t,i){for(let s=t;s<i;s++){let n=e[s].innerText;if(n&&n.toUpperCase().indexOf(this.keysSoFar)===0)return e[s]}return null},validateChildren(){this.$slots.default&&this.$slots.default().forEach(e=>{if(lu.isValidSlot(e)){if(e.type.name==="QtiInlineChoice")return;throw new c('Node is not a qti-inline-choice: "'+e.type.name+'"')}})},processChildren(){const e=this.$.subTree.children[0].children[2].children[0];this.choices.push(e.component.proxy),this.$.subTree.children[0].children[2].children[1].children.forEach(i=>{i.component!==null&&this.choices.push(i.component.proxy)})},processGroupUI(){this.isOrientationVertical&&this.presentationFactory.setVerticalOrientation(this.$refs.root),this.isShuffle&&this.processShuffle(),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid()),this.setActiveDescendant("")},processShuffle(){let e=this.createShuffleContainer(this.choices,this.priorState);this.choices.splice(0,this.choices.length),this.$refs.listbox.innerHTML="",e.forEach(t=>{this.$refs.listbox.appendChild(t.node.$el),this.choices.push(t.node)},this)},createShuffleContainer(e,t){let i=[];return t===null?(e.forEach(s=>{i.push({fixed:s.fixed==="true",node:s})}),Cx.shuffleArrayFixed(i),i):(t.state.order.forEach(s=>{i.push({node:this.findChoiceByIdentifier(s,e)})},this),i)},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Inline Choice Interaction State Invalid. Inline Choice identifier "'+e+'" not found.')},setActiveDescendant(e){this.activeDescendant=e,this.$refs.listbox.setAttribute("aria-activedescendant",e)},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Choice Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Choice Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Choice Interaction State Invalid. "order" property not found.');return t},addChoiceMousedownListeners(){this.allOptionElements=this.$refs.listbox.querySelectorAll('[role="option"]'),this.allOptionElements.forEach(e=>{e.addEventListener("mousedown",this.handleChoiceMousedown)})},removeChoiceMousedownListeners(){this.allOptionsElements!==null&&this.allOptionElements.forEach(e=>{e.removeEventListener("mousedown",this.handleChoiceMousedown)})}},created(){try{if(this.responseDeclaration=lu.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.presentationFactory=new Tx(this.$.vnode.props.class),this.isOrientationVertical=this.presentationFactory.isOrientationVertical(),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),lu.validateMaxMinChoices(this.maxChoices,this.minChoices),this.minChoices>1)throw new c('Invalid qti-inline-choice-interaction min-choices attribute: "'+this.minChoices+'"');this.cardinality=this.getCardinality(),this.isShuffle=this.shuffle==="true",this.isRequired=this.required==="true",this.computeMinSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.processGroupUI(),this.priorState!==null&&this.restoreValue(this.priorState.value),this.addChoiceMousedownListeners(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"InlineChoice",node:this,resetValue:this.resetValue,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:null}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}},beforeUnmount(){this.removeChoiceMousedownListeners()}},xx={ref:"root",class:"qti-inline-choice-interaction"},_x={class:"inline-choice-wrapper"},Ix=["aria-labelledby","id"],Vx=["aria-labelledby"];function Ax(e,t,i,s,n,r){const a=l.resolveComponent("qti-inline-choice");return l.openBlock(),l.createElementBlock("div",xx,[l.createElementVNode("div",_x,[l.createElementVNode("div",{ref:"label",class:"inline-choice-select-label qti-hidden"},l.toDisplayString(i.dataPrompt),513),l.createElementVNode("button",{ref:"button","aria-haspopup":"listbox","aria-labelledby":r.buttonAriaLabelledbyId,id:r.buttonId,class:"inline-choice-select",onClick:t[0]||(t[0]=(...o)=>r.handleButtonClick&&r.handleButtonClick(...o)),onKeyup:t[1]||(t[1]=(...o)=>r.handleButtonKeyup&&r.handleButtonKeyup(...o))},[l.createElementVNode("div",{ref:"prompt",class:"inline-choice-select-prompt"},l.toDisplayString(i.dataPrompt),513)],40,Ix),l.createElementVNode("ul",{ref:"listbox",tabindex:"-1",role:"listbox","aria-labelledby":r.labelId,class:"inline-choice-select-listbox inline-choice-select-listbox-hidden",onBlur:t[2]||(t[2]=(...o)=>r.handleBlur&&r.handleBlur(...o)),onFocus:t[3]||(t[3]=(...o)=>r.setupFocus&&r.setupFocus(...o)),onKeydown:t[4]||(t[4]=(...o)=>r.checkKeyPress&&r.checkKeyPress(...o))},[l.createVNode(a,{identifier:"",fixed:"true"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(i.dataPrompt),1)]),_:1}),l.renderSlot(e.$slots,"default")],40,Vx)])],512)}const $x=B(Sx,[["render",Ax]]),Lx={name:"EndAttemptGeneric",props:{title:{required:!0,type:String}},data(){return{step:1,isBtnDisabled:!1}},methods:{getIsBtnDisabled(){return this.isBtnDisabled},setIsBtnDisabled(e){this.isBtnDisabled=e},handleEndAttempt(){this.$parent.$emit("endAttempt",{response:!0})},enable(){this.toggleButtonDisabled(!1)},disable(){this.toggleButtonDisabled(!0)},toggleButtonDisabled(e){e?this.$refs.root.setAttribute("disabled",""):this.$refs.root.removeAttribute("disabled"),this.setIsBtnDisabled(e)}},created(){},mounted(){this.$parent.$emit("endAttemptReady",{node:this})}};function Mx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("button",{ref:"root",class:"qti-end-attempt-interaction",onClick:t[0]||(t[0]=l.withModifiers((...a)=>r.handleEndAttempt&&r.handleEndAttempt(...a),["prevent"])),type:"button"},l.toDisplayString(i.title),513)}const Nx=B(Lx,[["render",Mx]]),Rx={name:"EndAttemptControllerBar",props:{responseIdentifier:{required:!0,type:String},title:{required:!0,type:String},dataSteps:{required:!1,type:String},dataHastemplates:{required:!1,type:String},dataControllerType:{required:!1,type:String},dataHideprogress:{required:!1,type:String}},data(){return{step:1,isBtnDisabled:!1,response:!1}},computed:{progressMaximumSteps(){return typeof this.dataSteps>"u"?1:this.dataSteps*1},progressActiveWidth(){let e=this.progressMaximumSteps;return e=this.step>e?this.step:e,Math.floor(100*(this.step/e))},progressMessage(){return this.step===this.progressMaximumSteps?"All Parts Showing":"Step "+this.step+" of "+this.progressMaximumSteps},hasTemplates(){return typeof this.dataHastemplates<"u"?this.dataHastemplates==="true":!1},controllerType(){return typeof this.dataControllerType<"u"?this.dataControllerType:"generic"},progressClass(){return{"endattempt-progress-panel":!0,"progress-hidden":typeof this.dataHideprogress<"u"?this.dataHideprogress==="true":!1}}},methods:{getStep(){return this.step},setStep(e){this.step=e<this.progressMaximumSteps?e:this.progressMaximumSteps},incrementStep(){this.setStep(this.getStep()+1)},getIsBtnDisabled(){return this.isBtnDisabled},setIsBtnDisabled(e){this.isBtnDisabled=e},handleControllerNewTemplate(){this.resetControllerState(),_.NotifyNewTemplate({identifier:this.responseIdentifier,step:this.getStep(),maximumSteps:this.progressMaximumSteps})},handleControllerEndAttempt(){this.updateControllerState(),this.$parent.$emit("endAttempt",{response:this.response})},enable(){this.toggleButtonDisabled(!1)},disable(){this.toggleButtonDisabled(!0)},toggleButtonDisabled(e){e?this.$refs.endattempt.setAttribute("disabled",""):this.$refs.endattempt.removeAttribute("disabled"),this.setIsBtnDisabled(e)},resetControllerState(){this.setStep(1),this.enable(),this.$parent.$emit("notifyUpdateState",{})},updateControllerState(){switch(this.dataControllerType){case"showexample":case"solve":this.incrementStep(),this.getStep()<this.progressMaximumSteps?(this.response=!1,this.enable()):(this.response=!0,this.disable());break;case"generic":default:this.getStep()<this.progressMaximumSteps?(this.response=!1,this.incrementStep(),this.enable()):(this.response=!0,this.disable())}}},created(){},mounted(){this.$parent.$emit("endAttemptReady",{node:this})}},kx={class:"endattempt-controller"},qx={class:"endattempt-controller-progress"},Ox={id:"msgNotes"},Bx={class:"progress"},Px=["aria-valuenow"],Dx={class:"endattempt-controller-buttons"};function Qx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",kx,[l.createElementVNode("div",qx,[l.createElementVNode("div",{class:l.normalizeClass(r.progressClass)},[l.createElementVNode("div",Ox,l.toDisplayString(r.progressMessage),1),l.createElementVNode("div",Bx,[l.createElementVNode("div",{class:"progress-bar",style:l.normalizeStyle({width:r.progressActiveWidth+"%"}),role:"progressbar","aria-valuenow":r.progressActiveWidth,"aria-valuemin":"0","aria-valuemax":"progressMaximumSteps"},null,12,Px)])],2)]),t[2]||(t[2]=l.createElementVNode("div",{class:"endattempt-controller-filler"},null,-1)),l.createElementVNode("div",Dx,[r.hasTemplates?(l.openBlock(),l.createElementBlock("button",{key:0,id:"btnNewTemplate",onClick:t[0]||(t[0]=l.withModifiers((...a)=>r.handleControllerNewTemplate&&r.handleControllerNewTemplate(...a),["prevent"])),type:"button",class:"endattempt-btn endattempt-btn-secondary"},"New Question")):l.createCommentVNode("",!0),l.createElementVNode("button",{ref:"endattempt",id:"btnEndAttempt",onClick:t[1]||(t[1]=l.withModifiers((...a)=>r.handleControllerEndAttempt&&r.handleControllerEndAttempt(...a),["prevent"])),type:"button",class:"endattempt-btn endattempt-btn-primary"},l.toDisplayString(i.title),513)])])}const Hx=B(Rx,[["render",Qx]]),Zo={DEFAULT:"",ENDATTEMPT_CONTROLLER_BAR:"endattempt-controller-bar"};function Fx(e,t){switch(e){case Zo.ENDATTEMPT_CONTROLLER_BAR:return{template:'<end-attempt-controller-bar response-identifier="'+t.responseIdentifier+'" title="'+t.title+'" data-steps="'+t.dataSteps+'" data-hastemplates="'+t.dataHastemplates+'" data-controller-type="'+t.dataControllerType+'" data-hideprogress="'+t.dataHideprogress+'" />',components:{EndAttemptControllerBar:Hx}};default:return{template:'<end-attempt-default response-identifier="'+t.responseIdentifier+'" title="'+t.title+'"/>',components:{EndAttemptDefault:Nx}}}}function Ux(e){if(typeof e>"u"||e===null||e.length==0)return Zo.DEFAULT;const t=e.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case Zo.ENDATTEMPT_CONTROLLER_BAR:return t[i]}return Zo.DEFAULT}const Gx=new G,jx={name:"QtiEndAttemptInteraction",props:{responseIdentifier:{required:!0,type:String},title:{required:!0,type:String},dataSteps:{required:!1,type:String},dataHastemplates:{required:!1,type:String},dataControllerType:{required:!1,type:String},dataHideprogress:{required:!1,type:String}},data(){return{response:!1,state:null,cardinality:"single",responseDeclaration:null,interactionSubType:"",isBtnDisabled:!1,isValidResponse:!0,invalidResponseMessage:"",isQtiValid:!0,node:null,priorState:null}},computed:{interactionTemplate(){return Fx(this.interactionSubType,this.createComponentProperties())}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},updateState(){this.setState(this.computeState())},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.invalidResponseMessage},getCardinality(){return this.cardinality},getStep(){return this.interactionSubType==="endattempt-controller-bar"?this.node.getStep():1},setStep(e){this.interactionSubType==="endattempt-controller-bar"&&this.node.setStep(e)},initializeValue(){this.enableButton(),this.setStep(1),this.updateState(),this.setResponse(!1),this.setIsValid(!0)},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.initializeValue()},restoreValue(e){e.state.isBtnDisabled?this.disableButton():this.enableButton(),this.setStep(e.state.step),this.setState(this.computeState()),this.setResponse(this.computeResponse(e.value)),this.setIsValid(!0)},computeResponse(e){return e===null?!1:e},computeState(){return{step:this.getStep(),isBtnDisabled:this.getIsBtnDisabled(),interactionSubType:this.getInteractionSubType()}},disable(){this.disableButton(),this.updateState()},enable(){this.enableButton(),this.setResponse(!1),this.updateState()},getIsBtnDisabled(){return this.node.getIsBtnDisabled()},setIsBtnDisabled(e){this.node.setIsBtnDisabled(e)},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},handleEndAttempt(e){this.setResponse(e.response),this.updateState(),this.notifyEndAttempt()},handleUpdateState(){this.updateState()},enableButton(){this.node.enable()},disableButton(){this.node.disable()},detectInteractionSubType(e){return Ux(e)},createComponentProperties(){const e={responseIdentifier:this.responseIdentifier,title:this.title};return e.dataSteps=typeof this.dataSteps<"u"?this.dataSteps:"1",e.dataHastemplates=typeof this.dataHastemplates<"u"?this.dataHastemplates==="true":!1,e.dataHideprogress=typeof this.dataHideprogress<"u"?this.dataHideprogress==="true":!1,e.dataControllerType=typeof this.dataControllerType<"u"?this.dataControllerType:"generic",e},handleEndAttemptReady(e){this.node=e.node},notifyEndAttempt(){_.NotifyEndAttempt({identifier:this.responseIdentifier,step:this.getStep(),maximumSteps:typeof this.dataSteps<"u"?this.dataSteps*1:1,interactionSubType:this.getInteractionSubType()})},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('End Attempt Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('End Attempt Interaction State Invalid. "state" property not found.');if(!("step"in t.state))throw new O('End Attempt Interaction State Invalid. "step" property not found.');if(!("isBtnDisabled"in t.state))throw new O('End Attempt Interaction State Invalid. "isBtnDisabled" property not found.');return t}},created(){try{this.responseDeclaration=Gx.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$attrs.class)),this.priorState=this.getPriorState(this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.priorState===null?this.initializeValue():this.restoreValue(this.priorState),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"EndAttemptInteraction",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,disable:this.disable,enable:this.enable,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage()}),console.log("["+this.$options.name+":"+this.interactionSubType+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Wx={ref:"root"};function zx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",Wx,[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.interactionTemplate),l.mergeProps({ref:"endattempt",onEndAttempt:r.handleEndAttempt,onUpdateState:r.handleUpdateState,onEndAttemptReady:r.handleEndAttemptReady},e.$attrs),null,16,["onEndAttempt","onUpdateState","onEndAttemptReady"]))],512)}const Kx=B(jx,[["render",zx]]);class Yx{constructor(t,i){return this.constants={QTI_COUNTER_NONE:"none",QTI_COUNTER_UP:"qti-counter-up",QTI_COUNTER_DOWN:"qti-counter-down",QTI_HEIGHT_LINES_3:"qti-height-lines-3",QTI_HEIGHT_LINES_6:"qti-height-lines-6",QTI_HEIGHT_LINES_15:"qti-height-lines-15",SBAC_HEIGHT_LINES_95:"sbac-height-lines-95",SBAC_PRESENTATION:"sbac"},this.classList=t,this.expectedLength=i,this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_3,this.presentation_CounterStyle=this.constants.QTI_COUNTER_NONE,this.presentation_Sbac=!1,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.SBAC_PRESENTATION:this.presentation_Sbac=!0;break;case this.constants.SBAC_HEIGHT_LINES_95:this.presentation_HeightClass=this.constants.SBAC_HEIGHT_LINES_95;break;case this.constants.QTI_COUNTER_UP:this.presentation_CounterStyle="up",this.expectedLength=this.processExpectedLength();break;case this.constants.QTI_COUNTER_DOWN:this.presentation_CounterStyle="down",this.expectedLength=this.processExpectedLength();break;case this.constants.QTI_HEIGHT_LINES_3:this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_3;break;case this.constants.QTI_HEIGHT_LINES_6:this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_6;break;case this.constants.QTI_HEIGHT_LINES_15:this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_15;break}}processExpectedLength(){return typeof this.expectedLength>"u"||this.expectedLength===null||this.expectedLength.length==0||this.expectedLength==="0"?400:this.expectedLength*1}getCounterStyle(){return this.presentation_CounterStyle}getHeightClass(){return this.presentation_HeightClass}getExpectedLength(){return this.expectedLength}getIsSbac(){return this.presentation_Sbac}}var At="top",Jt="bottom",ei="right",$t="left",cu="auto",jr=[At,Jt,ei,$t],qn="start",Wr="end",Xx="clippingParents",om="viewport",zr="popper",Zx="reference",lm=jr.reduce(function(e,t){return e.concat([t+"-"+qn,t+"-"+Wr])},[]),cm=[].concat(jr,[cu]).reduce(function(e,t){return e.concat([t,t+"-"+qn,t+"-"+Wr])},[]),Jx="beforeRead",e_="read",t_="afterRead",i_="beforeMain",s_="main",n_="afterMain",r_="beforeWrite",a_="write",o_="afterWrite",l_=[Jx,e_,t_,i_,s_,n_,r_,a_,o_];function Ri(e){return e?(e.nodeName||"").toLowerCase():null}function Ht(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Zs(e){var t=Ht(e).Element;return e instanceof t||e instanceof Element}function ti(e){var t=Ht(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function uu(e){if(typeof ShadowRoot>"u")return!1;var t=Ht(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function c_(e){var t=e.state;Object.keys(t.elements).forEach(function(i){var s=t.styles[i]||{},n=t.attributes[i]||{},r=t.elements[i];!ti(r)||!Ri(r)||(Object.assign(r.style,s),Object.keys(n).forEach(function(a){var o=n[a];o===!1?r.removeAttribute(a):r.setAttribute(a,o===!0?"":o)}))})}function u_(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow),function(){Object.keys(t.elements).forEach(function(s){var n=t.elements[s],r=t.attributes[s]||{},a=Object.keys(t.styles.hasOwnProperty(s)?t.styles[s]:i[s]),o=a.reduce(function(u,h){return u[h]="",u},{});!ti(n)||!Ri(n)||(Object.assign(n.style,o),Object.keys(r).forEach(function(u){n.removeAttribute(u)}))})}}const um={name:"applyStyles",enabled:!0,phase:"write",fn:c_,effect:u_,requires:["computeStyles"]};function ki(e){return e.split("-")[0]}var Js=Math.max,Jo=Math.min,On=Math.round;function hu(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function hm(){return!/^((?!chrome|android).)*safari/i.test(hu())}function Bn(e,t,i){t===void 0&&(t=!1),i===void 0&&(i=!1);var s=e.getBoundingClientRect(),n=1,r=1;t&&ti(e)&&(n=e.offsetWidth>0&&On(s.width)/e.offsetWidth||1,r=e.offsetHeight>0&&On(s.height)/e.offsetHeight||1);var a=Zs(e)?Ht(e):window,o=a.visualViewport,u=!hm()&&i,h=(s.left+(u&&o?o.offsetLeft:0))/n,f=(s.top+(u&&o?o.offsetTop:0))/r,m=s.width/n,w=s.height/r;return{width:m,height:w,top:f,right:h+m,bottom:f+w,left:h,x:h,y:f}}function du(e){var t=Bn(e),i=e.offsetWidth,s=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-s)<=1&&(s=t.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:s}}function dm(e,t){var i=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(i&&uu(i)){var s=t;do{if(s&&e.isSameNode(s))return!0;s=s.parentNode||s.host}while(s)}return!1}function ts(e){return Ht(e).getComputedStyle(e)}function h_(e){return["table","td","th"].indexOf(Ri(e))>=0}function Cs(e){return((Zs(e)?e.ownerDocument:e.document)||window.document).documentElement}function el(e){return Ri(e)==="html"?e:e.assignedSlot||e.parentNode||(uu(e)?e.host:null)||Cs(e)}function fm(e){return!ti(e)||ts(e).position==="fixed"?null:e.offsetParent}function d_(e){var t=/firefox/i.test(hu()),i=/Trident/i.test(hu());if(i&&ti(e)){var s=ts(e);if(s.position==="fixed")return null}var n=el(e);for(uu(n)&&(n=n.host);ti(n)&&["html","body"].indexOf(Ri(n))<0;){var r=ts(n);if(r.transform!=="none"||r.perspective!=="none"||r.contain==="paint"||["transform","perspective"].indexOf(r.willChange)!==-1||t&&r.willChange==="filter"||t&&r.filter&&r.filter!=="none")return n;n=n.parentNode}return null}function Kr(e){for(var t=Ht(e),i=fm(e);i&&h_(i)&&ts(i).position==="static";)i=fm(i);return i&&(Ri(i)==="html"||Ri(i)==="body"&&ts(i).position==="static")?t:i||d_(e)||t}function fu(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Yr(e,t,i){return Js(e,Jo(t,i))}function f_(e,t,i){var s=Yr(e,t,i);return s>i?i:s}function pm(){return{top:0,right:0,bottom:0,left:0}}function mm(e){return Object.assign({},pm(),e)}function gm(e,t){return t.reduce(function(i,s){return i[s]=e,i},{})}var p_=function(t,i){return t=typeof t=="function"?t(Object.assign({},i.rects,{placement:i.placement})):t,mm(typeof t!="number"?t:gm(t,jr))};function m_(e){var t,i=e.state,s=e.name,n=e.options,r=i.elements.arrow,a=i.modifiersData.popperOffsets,o=ki(i.placement),u=fu(o),h=[$t,ei].indexOf(o)>=0,f=h?"height":"width";if(!(!r||!a)){var m=p_(n.padding,i),w=du(r),y=u==="y"?At:$t,b=u==="y"?Jt:ei,S=i.rects.reference[f]+i.rects.reference[u]-a[u]-i.rects.popper[f],C=a[u]-i.rects.reference[u],L=Kr(r),x=L?u==="y"?L.clientHeight||0:L.clientWidth||0:0,D=S/2-C/2,E=m[y],U=x-w[f]-m[b],Q=x/2-w[f]/2+D,ee=Yr(E,Q,U),p=u;i.modifiersData[s]=(t={},t[p]=ee,t.centerOffset=ee-Q,t)}}function g_(e){var t=e.state,i=e.options,s=i.element,n=s===void 0?"[data-popper-arrow]":s;n!=null&&(typeof n=="string"&&(n=t.elements.popper.querySelector(n),!n)||dm(t.elements.popper,n)&&(t.elements.arrow=n))}const y_={name:"arrow",enabled:!0,phase:"main",fn:m_,effect:g_,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Pn(e){return e.split("-")[1]}var w_={top:"auto",right:"auto",bottom:"auto",left:"auto"};function b_(e,t){var i=e.x,s=e.y,n=t.devicePixelRatio||1;return{x:On(i*n)/n||0,y:On(s*n)/n||0}}function ym(e){var t,i=e.popper,s=e.popperRect,n=e.placement,r=e.variation,a=e.offsets,o=e.position,u=e.gpuAcceleration,h=e.adaptive,f=e.roundOffsets,m=e.isFixed,w=a.x,y=w===void 0?0:w,b=a.y,S=b===void 0?0:b,C=typeof f=="function"?f({x:y,y:S}):{x:y,y:S};y=C.x,S=C.y;var L=a.hasOwnProperty("x"),x=a.hasOwnProperty("y"),D=$t,E=At,U=window;if(h){var Q=Kr(i),ee="clientHeight",p="clientWidth";if(Q===Ht(i)&&(Q=Cs(i),ts(Q).position!=="static"&&o==="absolute"&&(ee="scrollHeight",p="scrollWidth")),Q=Q,n===At||(n===$t||n===ei)&&r===Wr){E=Jt;var v=m&&Q===U&&U.visualViewport?U.visualViewport.height:Q[ee];S-=v-s.height,S*=u?1:-1}if(n===$t||(n===At||n===Jt)&&r===Wr){D=ei;var T=m&&Q===U&&U.visualViewport?U.visualViewport.width:Q[p];y-=T-s.width,y*=u?1:-1}}var N=Object.assign({position:o},h&&w_),V=f===!0?b_({x:y,y:S},Ht(i)):{x:y,y:S};if(y=V.x,S=V.y,u){var $;return Object.assign({},N,($={},$[E]=x?"0":"",$[D]=L?"0":"",$.transform=(U.devicePixelRatio||1)<=1?"translate("+y+"px, "+S+"px)":"translate3d("+y+"px, "+S+"px, 0)",$))}return Object.assign({},N,(t={},t[E]=x?S+"px":"",t[D]=L?y+"px":"",t.transform="",t))}function v_(e){var t=e.state,i=e.options,s=i.gpuAcceleration,n=s===void 0?!0:s,r=i.adaptive,a=r===void 0?!0:r,o=i.roundOffsets,u=o===void 0?!0:o,h={placement:ki(t.placement),variation:Pn(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:n,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,ym(Object.assign({},h,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:u})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,ym(Object.assign({},h,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const E_={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:v_,data:{}};var tl={passive:!0};function T_(e){var t=e.state,i=e.instance,s=e.options,n=s.scroll,r=n===void 0?!0:n,a=s.resize,o=a===void 0?!0:a,u=Ht(t.elements.popper),h=[].concat(t.scrollParents.reference,t.scrollParents.popper);return r&&h.forEach(function(f){f.addEventListener("scroll",i.update,tl)}),o&&u.addEventListener("resize",i.update,tl),function(){r&&h.forEach(function(f){f.removeEventListener("scroll",i.update,tl)}),o&&u.removeEventListener("resize",i.update,tl)}}const C_={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:T_,data:{}};var S_={left:"right",right:"left",bottom:"top",top:"bottom"};function il(e){return e.replace(/left|right|bottom|top/g,function(t){return S_[t]})}var x_={start:"end",end:"start"};function wm(e){return e.replace(/start|end/g,function(t){return x_[t]})}function pu(e){var t=Ht(e),i=t.pageXOffset,s=t.pageYOffset;return{scrollLeft:i,scrollTop:s}}function mu(e){return Bn(Cs(e)).left+pu(e).scrollLeft}function __(e,t){var i=Ht(e),s=Cs(e),n=i.visualViewport,r=s.clientWidth,a=s.clientHeight,o=0,u=0;if(n){r=n.width,a=n.height;var h=hm();(h||!h&&t==="fixed")&&(o=n.offsetLeft,u=n.offsetTop)}return{width:r,height:a,x:o+mu(e),y:u}}function I_(e){var t,i=Cs(e),s=pu(e),n=(t=e.ownerDocument)==null?void 0:t.body,r=Js(i.scrollWidth,i.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),a=Js(i.scrollHeight,i.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),o=-s.scrollLeft+mu(e),u=-s.scrollTop;return ts(n||i).direction==="rtl"&&(o+=Js(i.clientWidth,n?n.clientWidth:0)-r),{width:r,height:a,x:o,y:u}}function gu(e){var t=ts(e),i=t.overflow,s=t.overflowX,n=t.overflowY;return/auto|scroll|overlay|hidden/.test(i+n+s)}function bm(e){return["html","body","#document"].indexOf(Ri(e))>=0?e.ownerDocument.body:ti(e)&&gu(e)?e:bm(el(e))}function Xr(e,t){var i;t===void 0&&(t=[]);var s=bm(e),n=s===((i=e.ownerDocument)==null?void 0:i.body),r=Ht(s),a=n?[r].concat(r.visualViewport||[],gu(s)?s:[]):s,o=t.concat(a);return n?o:o.concat(Xr(el(a)))}function yu(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function V_(e,t){var i=Bn(e,!1,t==="fixed");return i.top=i.top+e.clientTop,i.left=i.left+e.clientLeft,i.bottom=i.top+e.clientHeight,i.right=i.left+e.clientWidth,i.width=e.clientWidth,i.height=e.clientHeight,i.x=i.left,i.y=i.top,i}function vm(e,t,i){return t===om?yu(__(e,i)):Zs(t)?V_(t,i):yu(I_(Cs(e)))}function A_(e){var t=Xr(el(e)),i=["absolute","fixed"].indexOf(ts(e).position)>=0,s=i&&ti(e)?Kr(e):e;return Zs(s)?t.filter(function(n){return Zs(n)&&dm(n,s)&&Ri(n)!=="body"}):[]}function $_(e,t,i,s){var n=t==="clippingParents"?A_(e):[].concat(t),r=[].concat(n,[i]),a=r[0],o=r.reduce(function(u,h){var f=vm(e,h,s);return u.top=Js(f.top,u.top),u.right=Jo(f.right,u.right),u.bottom=Jo(f.bottom,u.bottom),u.left=Js(f.left,u.left),u},vm(e,a,s));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function Em(e){var t=e.reference,i=e.element,s=e.placement,n=s?ki(s):null,r=s?Pn(s):null,a=t.x+t.width/2-i.width/2,o=t.y+t.height/2-i.height/2,u;switch(n){case At:u={x:a,y:t.y-i.height};break;case Jt:u={x:a,y:t.y+t.height};break;case ei:u={x:t.x+t.width,y:o};break;case $t:u={x:t.x-i.width,y:o};break;default:u={x:t.x,y:t.y}}var h=n?fu(n):null;if(h!=null){var f=h==="y"?"height":"width";switch(r){case qn:u[h]=u[h]-(t[f]/2-i[f]/2);break;case Wr:u[h]=u[h]+(t[f]/2-i[f]/2);break}}return u}function Zr(e,t){t===void 0&&(t={});var i=t,s=i.placement,n=s===void 0?e.placement:s,r=i.strategy,a=r===void 0?e.strategy:r,o=i.boundary,u=o===void 0?Xx:o,h=i.rootBoundary,f=h===void 0?om:h,m=i.elementContext,w=m===void 0?zr:m,y=i.altBoundary,b=y===void 0?!1:y,S=i.padding,C=S===void 0?0:S,L=mm(typeof C!="number"?C:gm(C,jr)),x=w===zr?Zx:zr,D=e.rects.popper,E=e.elements[b?x:w],U=$_(Zs(E)?E:E.contextElement||Cs(e.elements.popper),u,f,a),Q=Bn(e.elements.reference),ee=Em({reference:Q,element:D,strategy:"absolute",placement:n}),p=yu(Object.assign({},D,ee)),v=w===zr?p:Q,T={top:U.top-v.top+L.top,bottom:v.bottom-U.bottom+L.bottom,left:U.left-v.left+L.left,right:v.right-U.right+L.right},N=e.modifiersData.offset;if(w===zr&&N){var V=N[n];Object.keys(T).forEach(function($){var q=[ei,Jt].indexOf($)>=0?1:-1,A=[At,Jt].indexOf($)>=0?"y":"x";T[$]+=V[A]*q})}return T}function L_(e,t){t===void 0&&(t={});var i=t,s=i.placement,n=i.boundary,r=i.rootBoundary,a=i.padding,o=i.flipVariations,u=i.allowedAutoPlacements,h=u===void 0?cm:u,f=Pn(s),m=f?o?lm:lm.filter(function(b){return Pn(b)===f}):jr,w=m.filter(function(b){return h.indexOf(b)>=0});w.length===0&&(w=m);var y=w.reduce(function(b,S){return b[S]=Zr(e,{placement:S,boundary:n,rootBoundary:r,padding:a})[ki(S)],b},{});return Object.keys(y).sort(function(b,S){return y[b]-y[S]})}function M_(e){if(ki(e)===cu)return[];var t=il(e);return[wm(e),t,wm(t)]}function N_(e){var t=e.state,i=e.options,s=e.name;if(!t.modifiersData[s]._skip){for(var n=i.mainAxis,r=n===void 0?!0:n,a=i.altAxis,o=a===void 0?!0:a,u=i.fallbackPlacements,h=i.padding,f=i.boundary,m=i.rootBoundary,w=i.altBoundary,y=i.flipVariations,b=y===void 0?!0:y,S=i.allowedAutoPlacements,C=t.options.placement,L=ki(C),x=L===C,D=u||(x||!b?[il(C)]:M_(C)),E=[C].concat(D).reduce(function(Ee,P){return Ee.concat(ki(P)===cu?L_(t,{placement:P,boundary:f,rootBoundary:m,padding:h,flipVariations:b,allowedAutoPlacements:S}):P)},[]),U=t.rects.reference,Q=t.rects.popper,ee=new Map,p=!0,v=E[0],T=0;T<E.length;T++){var N=E[T],V=ki(N),$=Pn(N)===qn,q=[At,Jt].indexOf(V)>=0,A=q?"width":"height",M=Zr(t,{placement:N,boundary:f,rootBoundary:m,altBoundary:w,padding:h}),k=q?$?ei:$t:$?Jt:At;U[A]>Q[A]&&(k=il(k));var R=il(k),z=[];if(r&&z.push(M[V]<=0),o&&z.push(M[k]<=0,M[R]<=0),z.every(function(Ee){return Ee})){v=N,p=!1;break}ee.set(N,z)}if(p)for(var Z=b?3:1,ne=function(P){var K=E.find(function(Me){var qe=ee.get(Me);if(qe)return qe.slice(0,P).every(function(Et){return Et})});if(K)return v=K,"break"},de=Z;de>0;de--){var ge=ne(de);if(ge==="break")break}t.placement!==v&&(t.modifiersData[s]._skip=!0,t.placement=v,t.reset=!0)}}const R_={name:"flip",enabled:!0,phase:"main",fn:N_,requiresIfExists:["offset"],data:{_skip:!1}};function Tm(e,t,i){return i===void 0&&(i={x:0,y:0}),{top:e.top-t.height-i.y,right:e.right-t.width+i.x,bottom:e.bottom-t.height+i.y,left:e.left-t.width-i.x}}function Cm(e){return[At,ei,Jt,$t].some(function(t){return e[t]>=0})}function k_(e){var t=e.state,i=e.name,s=t.rects.reference,n=t.rects.popper,r=t.modifiersData.preventOverflow,a=Zr(t,{elementContext:"reference"}),o=Zr(t,{altBoundary:!0}),u=Tm(a,s),h=Tm(o,n,r),f=Cm(u),m=Cm(h);t.modifiersData[i]={referenceClippingOffsets:u,popperEscapeOffsets:h,isReferenceHidden:f,hasPopperEscaped:m},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":f,"data-popper-escaped":m})}const q_={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:k_};function O_(e,t,i){var s=ki(e),n=[$t,At].indexOf(s)>=0?-1:1,r=typeof i=="function"?i(Object.assign({},t,{placement:e})):i,a=r[0],o=r[1];return a=a||0,o=(o||0)*n,[$t,ei].indexOf(s)>=0?{x:o,y:a}:{x:a,y:o}}function B_(e){var t=e.state,i=e.options,s=e.name,n=i.offset,r=n===void 0?[0,0]:n,a=cm.reduce(function(f,m){return f[m]=O_(m,t.rects,r),f},{}),o=a[t.placement],u=o.x,h=o.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=u,t.modifiersData.popperOffsets.y+=h),t.modifiersData[s]=a}const P_={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:B_};function D_(e){var t=e.state,i=e.name;t.modifiersData[i]=Em({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Q_={name:"popperOffsets",enabled:!0,phase:"read",fn:D_,data:{}};function H_(e){return e==="x"?"y":"x"}function F_(e){var t=e.state,i=e.options,s=e.name,n=i.mainAxis,r=n===void 0?!0:n,a=i.altAxis,o=a===void 0?!1:a,u=i.boundary,h=i.rootBoundary,f=i.altBoundary,m=i.padding,w=i.tether,y=w===void 0?!0:w,b=i.tetherOffset,S=b===void 0?0:b,C=Zr(t,{boundary:u,rootBoundary:h,padding:m,altBoundary:f}),L=ki(t.placement),x=Pn(t.placement),D=!x,E=fu(L),U=H_(E),Q=t.modifiersData.popperOffsets,ee=t.rects.reference,p=t.rects.popper,v=typeof S=="function"?S(Object.assign({},t.rects,{placement:t.placement})):S,T=typeof v=="number"?{mainAxis:v,altAxis:v}:Object.assign({mainAxis:0,altAxis:0},v),N=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,V={x:0,y:0};if(Q){if(r){var $,q=E==="y"?At:$t,A=E==="y"?Jt:ei,M=E==="y"?"height":"width",k=Q[E],R=k+C[q],z=k-C[A],Z=y?-p[M]/2:0,ne=x===qn?ee[M]:p[M],de=x===qn?-p[M]:-ee[M],ge=t.elements.arrow,Ee=y&&ge?du(ge):{width:0,height:0},P=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:pm(),K=P[q],Me=P[A],qe=Yr(0,ee[M],Ee[M]),Et=D?ee[M]/2-Z-qe-K-T.mainAxis:ne-qe-K-T.mainAxis,at=D?-ee[M]/2+Z+qe+Me+T.mainAxis:de+qe+Me+T.mainAxis,He=t.elements.arrow&&Kr(t.elements.arrow),ft=He?E==="y"?He.clientTop||0:He.clientLeft||0:0,Fe=($=N==null?void 0:N[E])!=null?$:0,Oe=k+Et-Fe-ft,_e=k+at-Fe,_i=Yr(y?Jo(R,Oe):R,k,y?Js(z,_e):z);Q[E]=_i,V[E]=_i-k}if(o){var ji,ks=E==="x"?At:$t,qs=E==="x"?Jt:ei,pt=Q[U],Rt=U==="y"?"height":"width",Wi=pt+C[ks],li=pt-C[qs],mt=[At,$t].indexOf(L)!==-1,Ii=(ji=N==null?void 0:N[U])!=null?ji:0,Os=mt?Wi:pt-ee[Rt]-p[Rt]-Ii+T.altAxis,ci=mt?pt+ee[Rt]+p[Rt]-Ii-T.altAxis:li,Vi=y&&mt?f_(Os,pt,ci):Yr(y?Os:Wi,pt,y?ci:li);Q[U]=Vi,V[U]=Vi-pt}t.modifiersData[s]=V}}const U_={name:"preventOverflow",enabled:!0,phase:"main",fn:F_,requiresIfExists:["offset"]};function G_(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function j_(e){return e===Ht(e)||!ti(e)?pu(e):G_(e)}function W_(e){var t=e.getBoundingClientRect(),i=On(t.width)/e.offsetWidth||1,s=On(t.height)/e.offsetHeight||1;return i!==1||s!==1}function z_(e,t,i){i===void 0&&(i=!1);var s=ti(t),n=ti(t)&&W_(t),r=Cs(t),a=Bn(e,n,i),o={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(s||!s&&!i)&&((Ri(t)!=="body"||gu(r))&&(o=j_(t)),ti(t)?(u=Bn(t,!0),u.x+=t.clientLeft,u.y+=t.clientTop):r&&(u.x=mu(r))),{x:a.left+o.scrollLeft-u.x,y:a.top+o.scrollTop-u.y,width:a.width,height:a.height}}function K_(e){var t=new Map,i=new Set,s=[];e.forEach(function(r){t.set(r.name,r)});function n(r){i.add(r.name);var a=[].concat(r.requires||[],r.requiresIfExists||[]);a.forEach(function(o){if(!i.has(o)){var u=t.get(o);u&&n(u)}}),s.push(r)}return e.forEach(function(r){i.has(r.name)||n(r)}),s}function Y_(e){var t=K_(e);return l_.reduce(function(i,s){return i.concat(t.filter(function(n){return n.phase===s}))},[])}function X_(e){var t;return function(){return t||(t=new Promise(function(i){Promise.resolve().then(function(){t=void 0,i(e())})})),t}}function Z_(e){var t=e.reduce(function(i,s){var n=i[s.name];return i[s.name]=n?Object.assign({},n,s,{options:Object.assign({},n.options,s.options),data:Object.assign({},n.data,s.data)}):s,i},{});return Object.keys(t).map(function(i){return t[i]})}var Sm={placement:"bottom",modifiers:[],strategy:"absolute"};function xm(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return!t.some(function(s){return!(s&&typeof s.getBoundingClientRect=="function")})}function J_(e){e===void 0&&(e={});var t=e,i=t.defaultModifiers,s=i===void 0?[]:i,n=t.defaultOptions,r=n===void 0?Sm:n;return function(o,u,h){h===void 0&&(h=r);var f={placement:"bottom",orderedModifiers:[],options:Object.assign({},Sm,r),modifiersData:{},elements:{reference:o,popper:u},attributes:{},styles:{}},m=[],w=!1,y={state:f,setOptions:function(L){var x=typeof L=="function"?L(f.options):L;S(),f.options=Object.assign({},r,f.options,x),f.scrollParents={reference:Zs(o)?Xr(o):o.contextElement?Xr(o.contextElement):[],popper:Xr(u)};var D=Y_(Z_([].concat(s,f.options.modifiers)));return f.orderedModifiers=D.filter(function(E){return E.enabled}),b(),y.update()},forceUpdate:function(){if(!w){var L=f.elements,x=L.reference,D=L.popper;if(xm(x,D)){f.rects={reference:z_(x,Kr(D),f.options.strategy==="fixed"),popper:du(D)},f.reset=!1,f.placement=f.options.placement,f.orderedModifiers.forEach(function(T){return f.modifiersData[T.name]=Object.assign({},T.data)});for(var E=0;E<f.orderedModifiers.length;E++){if(f.reset===!0){f.reset=!1,E=-1;continue}var U=f.orderedModifiers[E],Q=U.fn,ee=U.options,p=ee===void 0?{}:ee,v=U.name;typeof Q=="function"&&(f=Q({state:f,options:p,name:v,instance:y})||f)}}}},update:X_(function(){return new Promise(function(C){y.forceUpdate(),C(f)})}),destroy:function(){S(),w=!0}};if(!xm(o,u))return y;y.setOptions(h).then(function(C){!w&&h.onFirstUpdate&&h.onFirstUpdate(C)});function b(){f.orderedModifiers.forEach(function(C){var L=C.name,x=C.options,D=x===void 0?{}:x,E=C.effect;if(typeof E=="function"){var U=E({state:f,name:L,instance:y,options:D}),Q=function(){};m.push(U||Q)}})}function S(){m.forEach(function(C){return C()}),m=[]}return y}}var eI=[C_,Q_,E_,um,P_,R_,U_,y_,q_],tI=J_({defaultModifiers:eI}),iI="tippy-box",_m="tippy-content",sI="tippy-backdrop",Im="tippy-arrow",Vm="tippy-svg-arrow",en={passive:!0,capture:!0},Am=function(){return document.body};function nI(e,t){return{}.hasOwnProperty.call(e,t)}function wu(e,t,i){if(Array.isArray(e)){var s=e[t];return s??(Array.isArray(i)?i[t]:i)}return e}function bu(e,t){var i={}.toString.call(e);return i.indexOf("[object")===0&&i.indexOf(t+"]")>-1}function $m(e,t){return typeof e=="function"?e.apply(void 0,t):e}function Lm(e,t){if(t===0)return e;var i;return function(s){clearTimeout(i),i=setTimeout(function(){e(s)},t)}}function rI(e,t){var i=Object.assign({},e);return t.forEach(function(s){delete i[s]}),i}function aI(e){return e.split(/\s+/).filter(Boolean)}function Dn(e){return[].concat(e)}function Mm(e,t){e.indexOf(t)===-1&&e.push(t)}function oI(e){return e.filter(function(t,i){return e.indexOf(t)===i})}function lI(e){return e.split("-")[0]}function sl(e){return[].slice.call(e)}function Nm(e){return Object.keys(e).reduce(function(t,i){return e[i]!==void 0&&(t[i]=e[i]),t},{})}function Jr(){return document.createElement("div")}function ea(e){return["Element","Fragment"].some(function(t){return bu(e,t)})}function cI(e){return bu(e,"NodeList")}function uI(e){return bu(e,"MouseEvent")}function hI(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function dI(e){return ea(e)?[e]:cI(e)?sl(e):Array.isArray(e)?e:sl(document.querySelectorAll(e))}function vu(e,t){e.forEach(function(i){i&&(i.style.transitionDuration=t+"ms")})}function Rm(e,t){e.forEach(function(i){i&&i.setAttribute("data-state",t)})}function fI(e){var t,i=Dn(e),s=i[0];return s!=null&&(t=s.ownerDocument)!=null&&t.body?s.ownerDocument:document}function pI(e,t){var i=t.clientX,s=t.clientY;return e.every(function(n){var r=n.popperRect,a=n.popperState,o=n.props,u=o.interactiveBorder,h=lI(a.placement),f=a.modifiersData.offset;if(!f)return!0;var m=h==="bottom"?f.top.y:0,w=h==="top"?f.bottom.y:0,y=h==="right"?f.left.x:0,b=h==="left"?f.right.x:0,S=r.top-s+m>u,C=s-r.bottom-w>u,L=r.left-i+y>u,x=i-r.right-b>u;return S||C||L||x})}function Eu(e,t,i){var s=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(n){e[s](n,i)})}function km(e,t){for(var i=t;i;){var s;if(e.contains(i))return!0;i=i.getRootNode==null||(s=i.getRootNode())==null?void 0:s.host}return!1}var qi={isTouch:!1},qm=0;function mI(){qi.isTouch||(qi.isTouch=!0,window.performance&&document.addEventListener("mousemove",Om))}function Om(){var e=performance.now();e-qm<20&&(qi.isTouch=!1,document.removeEventListener("mousemove",Om)),qm=e}function gI(){var e=document.activeElement;if(hI(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function yI(){document.addEventListener("touchstart",mI,en),window.addEventListener("blur",gI)}var wI=typeof window<"u"&&typeof document<"u",bI=wI?!!window.msCrypto:!1;function Qn(e){var t=e==="destroy"?"n already-":" ";return[e+"() was called on a"+t+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Bm(e){var t=/[ \t]{2,}/g,i=/^[ \t]*/gm;return e.replace(t," ").replace(i,"").trim()}function vI(e){return Bm(`
|
87
|
+
`+r):s.stack=r}catch{}}throw s}}_request(t,i){typeof t=="string"?(i=i||{},i.url=t):i=t||{},i=Ys(this.defaults,i);const{transitional:s,paramsSerializer:n,headers:r}=i;s!==void 0&&eu.assertOptions(s,{silentJSONParsing:Es.transitional(Es.boolean),forcedJSONParsing:Es.transitional(Es.boolean),clarifyTimeoutError:Es.transitional(Es.boolean)},!1),n!=null&&(F.isFunction(n)?i.paramsSerializer={serialize:n}:eu.assertOptions(n,{encode:Es.function,serialize:Es.function},!0)),i.method=(i.method||this.defaults.method||"get").toLowerCase();let a=r&&F.merge(r.common,r[i.method]);r&&F.forEach(["delete","get","head","post","put","patch","common"],b=>{delete r[b]}),i.headers=Vt.concat(a,r);const o=[];let u=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(i)===!1||(u=u&&S.synchronous,o.unshift(S.fulfilled,S.rejected))});const h=[];this.interceptors.response.forEach(function(S){h.push(S.fulfilled,S.rejected)});let f,m=0,w;if(!u){const b=[Kp.bind(this),void 0];for(b.unshift.apply(b,o),b.push.apply(b,h),w=b.length,f=Promise.resolve(i);m<w;)f=f.then(b[m++],b[m++]);return f}w=o.length;let y=i;for(m=0;m<w;){const b=o[m++],S=o[m++];try{y=b(y)}catch(C){S.call(this,C);break}}try{f=Kp.call(this,y)}catch(b){return Promise.reject(b)}for(m=0,w=h.length;m<w;)f=f.then(h[m++],h[m++]);return f}getUri(t){t=Ys(this.defaults,t);const i=Dp(t.baseURL,t.url);return Lp(i,t.params,t.paramsSerializer)}}F.forEach(["delete","get","head","options"],function(t){Xs.prototype[t]=function(i,s){return this.request(Ys(s||{},{method:t,url:i,data:(s||{}).data}))}}),F.forEach(["post","put","patch"],function(t){function i(s){return function(r,a,o){return this.request(Ys(o||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:r,data:a}))}}Xs.prototype[t]=i(),Xs.prototype[t+"Form"]=i(!0)});class tu{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(r){i=r});const s=this;this.promise.then(n=>{if(!s._listeners)return;let r=s._listeners.length;for(;r-- >0;)s._listeners[r](n);s._listeners=null}),this.promise.then=n=>{let r;const a=new Promise(o=>{s.subscribe(o),r=o}).then(n);return a.cancel=function(){s.unsubscribe(r)},a},t(function(r,a,o){s.reason||(s.reason=new Rn(r,a,o),i(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const i=this._listeners.indexOf(t);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const t=new AbortController,i=s=>{t.abort(s)};return this.subscribe(i),t.signal.unsubscribe=()=>this.unsubscribe(i),t.signal}static source(){let t;return{token:new tu(function(n){t=n}),cancel:t}}}function hS(e){return function(i){return e.apply(null,i)}}function dS(e){return F.isObject(e)&&e.isAxiosError===!0}const iu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(iu).forEach(([e,t])=>{iu[t]=e});function Zp(e){const t=new Xs(e),i=mp(Xs.prototype.request,t);return F.extend(i,Xs.prototype,t,{allOwnKeys:!0}),F.extend(i,t,null,{allOwnKeys:!0}),i.create=function(n){return Zp(Ys(e,n))},i}const We=Zp(Hr);We.Axios=Xs,We.CanceledError=Rn,We.CancelToken=tu,We.isCancel=qp,We.VERSION=Yp,We.toFormData=Bo,We.AxiosError=be,We.Cancel=We.CanceledError,We.all=function(t){return Promise.all(t)},We.spread=hS,We.isAxiosError=dS,We.mergeConfig=Ys,We.AxiosHeaders=Vt,We.formToJSON=e=>Rp(F.isHTMLForm(e)?new FormData(e):e),We.getAdapter=zp.getAdapter,We.HttpStatusCode=iu,We.default=We;const fS={name:"QtiStylesheet",props:{href:{type:String,required:!0},type:{type:String,required:!0}},data(){return{css:"",isQtiValid:!0}},methods:{getHref(){return this.href},getType(){return this.type},getCss(){We.get(this.href).then(e=>{this.css=`<style>${e.data}</style>`}).catch(e=>{console.log("["+this.$options.name+"][CSS Fetch Error: "+e+"]")})},validateChildren(){}},created(){this.getCss()},mounted(){if(this.isQtiValid)try{this.validateChildren(),console.log("["+this.$options.name+"][Href: "+this.href+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},pS=["innerHTML"];function mS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"root",class:"qti-stylesheet",innerHTML:n.css},null,8,pS)}const gS=B(fS,[["render",mS]]),yS={name:"QtiCompanionMaterialsInfo",data(){return{isQtiValid:!0}},methods:{validateChildren(){}},mounted(){if(this.isQtiValid)try{this.validateChildren(),console.log("["+this.$options.name+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},wS={class:"qti-companion-materials-info"};function bS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",wS)}const vS=B(yS,[["render",bS]]),Ur=new G,ES={name:"QtiMapping",props:{lowerBound:{type:String,required:!1},upperBound:{type:String,required:!1},defaultValue:{type:String,required:!1}},data(){return{value:null,valueBaseType:"float",valueCardinality:"single",valueLowerBound:null,valueUpperBound:null,valueDefaultValue:new X(0).toNumber(),isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},getLowerBound(){return this.valueLowerBound},setLowerBound(e){this.valueLowerBound=e},getUpperBound(){return this.valueUpperBound},setUpperBound(e){this.valueUpperBound=e},getDefaultValue(){return this.valueDefaultValue},setDefaultValue(e){this.valueDefaultValue=e},computeFloatValue(e){let t=null;try{t=new X(e)}catch(i){throw new se(i.message)}return t.toNumber()},applyConstraints(e){return e===null||!X.isBigNumber(e)?null:(this.getLowerBound()!==null&&e.comparedTo(this.getLowerBound())<0&&(e=new X(this.getLowerBound())),this.getUpperBound()!==null&&e.comparedTo(this.getUpperBound())>0&&(e=new X(this.getUpperBound())),e.toNumber())},validateChildren:function(){let e=0;if(!this.$slots.default)throw new c("Must have at least one qti-map-entry node");if(this.$slots.default().forEach(t=>{if(Ur.isValidSlot(t))if(Ur.kebabCase(t.type.name)==="qti-map-entry")e+=1;else throw new c('Node is not a qti-map-entry: "'+t.tpe.name+'"')}),e===0)throw new c("Must have at least one qti-map-entry node")},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{if(i.component===null)return;const s=i.component.proxy;e===null&&(e=[]),e.push(s.getValue())}),e}},created(){try{typeof this.lowerBound<"u"&&this.setLowerBound(this.computeFloatValue(Ur.FloatValue(this.lowerBound))),typeof this.upperBound<"u"&&this.setUpperBound(this.computeFloatValue(Ur.FloatValue(this.upperBound))),typeof this.defaultValue<"u"&&this.setDefaultValue(this.computeFloatValue(Ur.FloatValue(this.defaultValue))),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[QtiMapping][lowerBound][upperBound][defaultValue][Value]",this.getLowerBound(),this.getUpperBound(),this.getDefaultValue(),this.getValue())}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},TS={class:"qti-mapping"};function CS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",TS,[l.renderSlot(e.$slots,"default")])}const SS=B(ES,[["render",CS]]),su=new G,xS={name:"QtiMapEntry",props:{mapKey:{type:String,required:!0},mappedValue:{type:String,required:!0},caseSensitive:{type:String,required:!1}},data(){return{value:null,valueBaseType:"float",valueCardinality:"single",valueMappedValue:null,valueCaseSensitive:!1,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},setMappedValue(e){this.valueMappedValue=e},getMappedValue(){return this.valueMappedValue},setCaseSensitive(e){this.valueCaseSensitive=e},getCaseSensitive(){return this.valueCaseSensitive},computeMappedValue(e){let t=null;try{t=new X(e)}catch(i){throw new se(i.message)}return t.toNumber()},validateChildren:function(){this.$slots.default&&this.$slots.default().forEach(e=>{if(su.isValidSlot(e))throw new c('Invalid Child Node: "'+e.tpe.name+'"')})}},created(){try{this.setCaseSensitive(su.validateCaseSensitive(this.caseSensitive,!1)),this.setMappedValue(this.computeMappedValue(su.FloatValue(this.mappedValue))),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){let e=this.$el.querySelector(".amp-mapentry__container");this.isQtiValid&&(this.setValue({mapKey:this.mapKey,mappedValue:this.getMappedValue(),caseSensitive:this.getCaseSensitive()}),console.log("["+this.$options.name+"][Value]",this.getValue())),e.remove()}},_S={class:"qti-map-entry"},IS={class:"amp-mapentry__container"};function VS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",_S,[l.createElementVNode("div",IS,[l.renderSlot(e.$slots,"default")])])}const AS=B(xS,[["render",VS]]),$S={name:"QtiAreaMapping",methods:{},created:function(){},mounted:function(){console.log("[AreaMapping][Mounted]")}},LS={class:"qti-area-mapping"};function MS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",LS)}const NS=B($S,[["render",MS]]),nu=new G,RS={name:"QtiInterpolationTable",props:{defaultValue:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:"single",valueDefaultValue:null,tableType:"interpolation",isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},setBaseType(e){this.valueBaseType=e},getCardinality(){return this.valueCardinality},getTableType(){return this.tableType},getDefaultValue(){return this.valueDefaultValue},setDefaultValue(e){this.valueDefaultValue=e},validateChildren:function(){let e=0;if(!this.$slots.default)throw new c("Must have at least one qti-interpolation-table-entry node");if(this.$slots.default().forEach(t=>{if(nu.isValidSlot(t))if(nu.kebabCase(t.type.name)==="qti-interpolation-table-entry")e+=1;else throw new c('Node is not a qti-interpolation-table-entry: "'+t.tpe.name+'"')}),e===0)throw new c("Must have at least one qti-interpolation-table-entry node")},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{e===null&&(e=[]),e.push(i.getValue())}),e}},created(){try{let e=this.$parent.getBaseType();this.setBaseType(e),typeof this.defaultValue>"u"?this.setDefaultValue(null):this.setDefaultValue(nu.validateValueFromBaseType(e,this.defaultValue)),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[QtiInterpolationTable][DefaultValue][Value]",this.getDefaultValue(),this.getValue())}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},kS={class:"qti-interpolation-table"};function qS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",kS,[l.renderSlot(e.$slots,"default")])}const OS=B(RS,[["render",qS]]),Fo=new G,BS={name:"QtiInterpolationTableEntry",props:{sourceValue:{type:String,required:!0},includeBoundary:{type:String,required:!1},targetValue:{type:String,required:!0}},data(){return{value:null,valueSourceValue:null,valueTargetValue:null,valueIncludeBoundary:!0,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},setSourceValue(e){this.valueSourceValue=e},getSourceValue(){return this.valueSourceValue},setTargetValue(e){this.valueTargetValue=e},getTargetValue(){return this.valueTargetValue},setIncludeBoundary(e){this.valueIncludeBoundary=e},getIncludeBoundary(){return this.valueIncludeBoundary},computeSourceValue(e){let t=null;try{t=new X(e)}catch(i){throw new se(i.message)}return t.toNumber()},isValidSlot(e){if(typeof e.componentOptions<"u")return!0;if(typeof e.text<"u"&&e.text.trim().length>0)throw new c('Invalid Child Node: "'+e.text.trim()+'"');return!1},validateChildren(){this.$slots.default&&this.$slots.default().forEach(e=>{if(Fo.isValidSlot(e))throw new c('Invalid Child Node: "'+e.tpe.name+'"')})}},created(){try{let e=this.$parent.$parent.getBaseType();this.setIncludeBoundary(Fo.validateIncludeBoundary(this.includeBoundary,"include-boundary")),this.setSourceValue(this.computeSourceValue(Fo.FloatValue(this.sourceValue))),this.setTargetValue(Fo.validateValueFromBaseType(e,this.targetValue))}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw new c(e.message);if(e.name==="QtiParseException")throw new se(e.message)}},mounted(){let e=this.$el.querySelector(".amp-interpolationentry__container");this.isQtiValid&&(this.setValue({sourceValue:this.getSourceValue(),targetValue:this.getTargetValue(),includeBoundary:this.getIncludeBoundary()}),console.log("["+this.$options.name+"][Value]",this.getValue())),e.remove()}},PS={class:"qti-interpolation-table-entry"},DS={class:"amp-interpolationentry__container"};function QS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",PS,[l.createElementVNode("div",DS,[l.renderSlot(e.$slots,"default")])])}const HS=B(BS,[["render",QS]]),ru=new G,FS={name:"QtiMatchTable",props:{defaultValue:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:"single",valueDefaultValue:null,tableType:"match",isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},setBaseType(e){this.valueBaseType=e},getCardinality(){return this.valueCardinality},getTableType(){return this.tableType},getDefaultValue(){return this.valueDefaultValue},setDefaultValue(e){this.valueDefaultValue=e},validateChildren:function(){let e=0;if(!this.$slots.default)throw new c("Must have at least one qti-match-table-entry node");if(this.$slots.default().forEach(t=>{if(ru.isValidSlot(t))if(ru.kebabCase(t.type.name)==="qti-match-table-entry")e+=1;else throw new c('Node is not a qti-match-table-entry: "'+t.tpe.name+'"')}),e===0)throw new c("Must have at least one qti-match-table-entry node")},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{e===null&&(e=[]),e.push(i.getValue())}),e}},created(){try{let e=this.$parent.getBaseType();this.setBaseType(e),typeof this.defaultValue>"u"?this.setDefaultValue(null):this.setDefaultValue(ru.validateValueFromBaseType(e,this.defaultValue)),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[QtiMatchTable][DefaultValue][Value]",this.getDefaultValue(),this.getValue())}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},US={class:"qti-match-table"};function GS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",US,[l.renderSlot(e.$slots,"default")])}const jS=B(FS,[["render",GS]]),au=new G,WS={name:"QtiMatchTableEntry",props:{sourceValue:{type:String,required:!0},targetValue:{type:String,required:!0}},data(){return{value:null,valueSourceValue:null,valueTargetValue:null,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},setSourceValue(e){this.valueSourceValue=e},getSourceValue(){return this.valueSourceValue},setTargetValue(e){this.valueTargetValue=e},getTargetValue(){return this.valueTargetValue},computeSourceValue(e){let t=null;try{if(t=new X(e),!t.isInteger())throw new se('Invalid qti-match-table-entry source-value integer "'+t+'"')}catch(i){throw new se(i.message)}return t.toNumber()},validateChildren(){this.$slots.default&&this.$slots.default().forEach(e=>{if(au.isValidSlot(e))throw new c('Invalid Child Node: "'+e.tpe.name+'"')})}},created(){try{let e=this.$parent.$parent.getBaseType();this.setSourceValue(this.computeSourceValue(au.IntegerValue(this.sourceValue))),this.setTargetValue(au.validateValueFromBaseType(e,this.targetValue)),this.validateChildren()}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw new c(e.message);if(e.name==="QtiParseException")throw new se(e.message)}},mounted(){let e=this.$el.querySelector(".amp-matchtableentry__container");this.isQtiValid&&(this.setValue({sourceValue:this.getSourceValue(),targetValue:this.getTargetValue()}),console.log("["+this.$options.name+"][Value]",this.getValue())),e.remove()}},zS={class:"qti-match-table-entry"},KS={class:"amp-matchtableentry__container"};function YS(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",zS,[l.createElementVNode("div",KS,[l.renderSlot(e.$slots,"default")])])}const XS=B(WS,[["render",YS]]),ZS={name:"QtiDefaultValue",props:{interpretation:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:null,variableBaseType:null,variableCardinality:null,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{if(i.component===null)return;const s=i.component.proxy;switch(this.variableCardinality){case"record":e===null&&(e=new Map),s.isRecordFieldValue()&&e.set(s.getFieldIdentifier(),s);break;case"multiple":case"ordered":e===null&&(e=[]),e.push(s.getValue());break;case"single":e=e===null?s.getValue():e;break;default:console.log("[DefaultValue][Cardinality]: processChildren cardinality unhandled = "+this.variableCardinality)}}),e},getVariableBaseType(){return this.$parent.$props.baseType},getVariableCardinality(){return this.$parent.$props.cardinality},evaluate(){return this.getValue()}},created(){try{this.valueBaseType=this.variableBaseType=this.getVariableBaseType(),this.valueCardinality=this.variableCardinality=this.getVariableCardinality()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[DefaultValue][Value:",this.getValue(),"][BaseType:"+this.getBaseType()+"][Cardinality:"+this.getCardinality()+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},JS={ref:"root",class:"qti-default-value"};function e1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",JS,[l.renderSlot(e.$slots,"default")],512)}const t1=B(ZS,[["render",e1]]),i1={name:"QtiCorrectResponse",props:{interpretation:{type:String,required:!1}},data(){return{value:null,valueBaseType:null,valueCardinality:null,variableBaseType:null,variableCardinality:null,isQtiValid:!0}},methods:{getValue(){return this.value},setValue(e){this.value=e},isNull(){return this.value===null},getBaseType(){return this.valueBaseType},getCardinality(){return this.valueCardinality},processChildren(){let e=null;return this.$.subTree.children[0].children.forEach(i=>{if(i.component===null)return;const s=i.component.proxy;switch(this.variableCardinality){case"record":e===null&&(e=new Map),s.isRecordFieldValue()&&e.set(s.getFieldIdentifier(),s);break;case"multiple":case"ordered":e===null&&(e=[]),e.push(s.getValue());break;case"single":e=e===null?s.getValue():e;break;default:console.log("[CorrectResponse][Cardinality]: processChildren cardinality unhandled = "+this.variableCardinality)}}),e},getVariableBaseType(){return this.$parent.$props.baseType},getVariableCardinality(){return this.$parent.$props.cardinality},evaluate(){return this.getValue()}},created(){try{this.valueBaseType=this.variableBaseType=this.getVariableBaseType(),this.valueCardinality=this.variableCardinality=this.getVariableCardinality()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.setValue(this.processChildren()),console.log("[CorrectResponse][Value:",this.getValue(),"][BaseType:"+this.getBaseType()+"][Cardinality:"+this.getCardinality()+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},s1={class:"qti-correct-response"};function n1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",s1,[l.renderSlot(e.$slots,"default")])}const r1=B(i1,[["render",n1]]);class Jp{constructor(){}IntegerValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid integer "'+t+'". Length is not valid.');try{let i=parseInt(t,10);if(Number.isNaN(i))throw new se('Invalid integer "'+t+'". ');return i}catch(i){throw new se('Invalid integer "'+t+'". '+i.message)}}FloatValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid float "'+t+'". Length is not valid.');try{let i=parseFloat(t);if(Number.isNaN(i))throw new se('Invalid float "'+t+'". ');return i}catch(i){throw new se('Invalid float "'+t+'". '+i.message)}}BooleanValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid boolean "'+t+'". Length is not valid.');if(t.toLowerCase()==="true"||t==="1")return!0;if(t.toLowerCase()==="false"||t==="0")return!1;throw new se('Invalid boolean "'+t+'".')}StringValue(t){if(t==null||t.length==0)throw new se('Invalid string "'+t+'". Length is not valid.');return t}IdentifierValue(t){if(t!=null&&(t=t.trim()),t==null||t.length==0)throw new se('Invalid identifier "'+t+'". Length is not valid.');if(!this.isCharacterALetter(t.charAt(0))&&!this.isCharacterADigit(t.charAt(0))&&t.charAt(0)!=="_")throw new se('Invalid identifier "'+t+'". First character "'+t.charAt(0)+'" is not valid.');for(let i=1;i<t.length;i++)if(!this.isCharacterALetterOrDigit(t.charAt(i))&&t.charAt(i)!=="_"&&t.charAt(i)!=="-"&&t.charAt(i)!==".")throw new se('Invalid identifier "'+t+'". Character "'+t.charAt(i)+'" at position '+(i+1)+" is not valid.");return t}isCharacterALetter(t){return/[a-zA-Z]/.test(t)}isCharacterADigit(t){return/\d/.test(t)}isCharacterALetterOrDigit(t){return this.isCharacterALetter(t)||this.isCharacterADigit(t)}}const ou=new G,kn=new Jp,a1={name:"QtiValue",props:{baseType:{type:String,required:!1},fieldIdentifier:{type:String,required:!1}},data(){return{singleValue:null,valueBaseType:null,valueCardinality:"single",valueFieldIdentifier:null,variableBaseType:null,variableCardinality:null,isQtiValid:!0}},methods:{getValue(){if(this.isNull())return null;switch(this.valueBaseType){case"integer":case"float":return this.singleValue.toNumber();case"boolean":return this.singleValue;case"string":case"identifier":case"directedPair":case"pair":return this.singleValue;default:return console.log("[QtiValue][GetValue Exception]","Unhandled BaseType:"+this.valueBaseType),null}},isNull(){return this.singleValue===null},getBaseType(){return this.valueBaseType},getCardinality(){return"single"},getFieldIdentifier(){return this.valueFieldIdentifier},isRecordFieldValue(){return this.valueFieldIdentifier!==null&&this.valueBaseType!==null},readChildren(e){this.valueBaseType!=null&&(this.singleValue=this.parseSingleValue(this.valueBaseType,e.textContent))},parseSingleValue(e,t){let i=null;try{switch(e){case"integer":i=new X(kn.IntegerValue(t));break;case"float":i=new X(kn.FloatValue(t));break;case"boolean":i=kn.BooleanValue(t);break;case"string":i=kn.StringValue(t);break;case"identifier":i=kn.IdentifierValue(t);break;case"directedPair":case"pair":i=kn.StringValue(t);break;default:throw new se('[QtiValue][Unhandled BaseType]: "'+e+'"')}}catch(s){throw new se(s.message)}return i},_getVariableBaseType(e){return typeof e<"u"?e.baseType:null},_getVariableCardinality(e){return typeof e<"u"?e.cardinality:null},_validateAttributes(e,t){if(t==="record"){if(typeof this.baseType>"u")throw new c('base-type is a required attribute for "record" cardinality');if(ou.validateBaseType(this.baseType),this.valueBaseType=this.baseType,typeof this.fieldIdentifier>"u")throw new c('field-identifier is a required attribute for "record" cardinality');ou.validateIdentifierAttribute(this.fieldIdentifier),this.valueFieldIdentifier=this.fieldIdentifier}else{if(typeof this.baseType<"u")throw new c("base-type only permitted for record cardinality.");if(typeof this.fieldIdentifier<"u")throw new c("field-identifier only permitted for record cardinality.");this.valueBaseType=e}},getStore(){return this.$parent.$parent.getDeclarationContext()==="TEST"?it:_}},created:function(){try{let e=ou.validateVariableIdentifierAttribute(this.getStore(),this.$parent.$parent.$props.identifier);if(typeof e>"u")throw new c('Variable declaration not found: "'+this.$parent.$parent.$props.identifier+'"');this.variableCardinality=this._getVariableCardinality(e),this.variableBaseType=this._getVariableBaseType(e),this._validateAttributes(this.variableBaseType,this.variableCardinality)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted:function(){let e=this.$el.querySelector(".amp-value__container");if(this.isQtiValid){try{this.readChildren(e)}catch(t){throw this.isQtiValid=!1,t.name==="QtiValidationException"?new c(t.message):t.name==="QtiParseException"?new se(t.message):new Error(t.message)}console.log("["+this.$options.name+"][Value:"+this.getValue()+"][BaseType:"+this.getBaseType()+"][FieldIdentifier:"+this.getFieldIdentifier()+"]")}e.remove()}},o1=["variable-basetype","variable-cardinality"],l1={class:"amp-value__container"};function c1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{class:"qti-value","variable-basetype":n.variableBaseType,"variable-cardinality":n.variableCardinality},[l.createElementVNode("div",l1,[l.renderSlot(e.$slots,"default")])],8,o1)}const u1=B(a1,[["render",c1]]),h1=new G,d1={name:"QtiItemBody",emits:["itemBodyReady"],data(){return{mathElementMap:new Map}},methods:{initializeTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathElements().forEach(function(i){this.archiveMathElement(i),i.innerHTML=this.applyTemplateValuesToMathml(i.innerHTML,e)},this)},updateTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathScriptElements().forEach(function(i){for(let[s,n]of this.mathElementMap){const r=new RegExp('id="('+s+')"',"g");if(i.innerHTML.match(r)){i.innerHTML=this.applyTemplateValuesToMathml(n,e);break}}},this),this.reprocessMML()},getTemplateMathVariables(){return _.getTemplateMathParameterVariables()},getMathElements(){return this.$el.querySelectorAll("math")},getMathScriptElements(){return this.$el.querySelectorAll('script[type="math/mml"]')},archiveMathElement(e){e.hasAttribute("id")||(e.id=h1.randomString(5,"a")),this.mathElementMap.set(e.id,e.outerHTML)},applyTemplateValuesToMathml(e,t){let i=e;return t.forEach(function(s){const n=new RegExp("<[mc]i[^>]*>("+s.identifier+")<\\/[mc]i>","g"),r=e.match(n);r&&(i=i.replace(n,r[0].replace(s.identifier,s.value)))}),i},reprocessMML(){this.$nextTick(()=>{window.MathJax&&window.MathJax.Hub.Queue(["Reprocess",window.MathJax.Hub,this.$refs.root])})}},mounted(){this.initializeTemplateMathVariables(),this.$parent.$emit("itemBodyReady",{itemBody:this})}},f1={ref:"root",class:"qti-item-body"};function p1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",f1,[l.renderSlot(e.$slots,"default")],512)}const m1=B(d1,[["render",p1]]),g1={name:"ModalDialog",data(){return{visible:!0}},methods:{hide(){this.$refs.mymodal.classList.remove("fade","show"),document.querySelector("body").classList.remove("modal-open")},show(){this.$refs.mymodal.classList.add("fade","show"),document.querySelector("body").classList.add("modal-open")}}},y1={key:0,ref:"mymodal",class:"qti3-player-modal"},w1={class:"qti3-player-modal-dialog qti3-player-modal-md qti3-player-modal-dialog-centered"},b1={class:"qti3-player-modal-content"},v1={class:"qti3-player-modal-header"},E1={class:"qti3-player-modal-body"},T1={class:"qti3-player-modal-footer"};function C1(e,t,i,s,n,r){return l.openBlock(),l.createBlock(l.Transition,{name:"fade"},{default:l.withCtx(()=>[n.visible?(l.openBlock(),l.createElementBlock("div",y1,[l.createElementVNode("div",w1,[t[2]||(t[2]=l.createElementVNode("span",{tabindex:"0"},null,-1)),l.createElementVNode("div",b1,[l.createElementVNode("header",v1,[l.renderSlot(e.$slots,"header",{},void 0,!0),l.createElementVNode("button",{type:"button",class:"qti3-player-close","aria-label":"Close",onClick:t[0]||(t[0]=a=>r.hide())},"×")]),l.createElementVNode("div",E1,[l.renderSlot(e.$slots,"body",{},void 0,!0)]),l.createElementVNode("footer",T1,[l.renderSlot(e.$slots,"footer",{},void 0,!0)])]),t[3]||(t[3]=l.createElementVNode("span",{tabindex:"0"},null,-1))]),l.createElementVNode("div",{class:"qti3-player-modal-backdrop",onClick:t[1]||(t[1]=a=>r.hide())})],512)):l.createCommentVNode("",!0)]),_:3})}const S1=B(g1,[["render",C1],["__scopeId","data-v-2611a8eb"]]),Gr=new G,x1={name:"QtiModalFeedback",components:{ModalDialog:S1},props:{identifier:{type:String,required:!0},outcomeIdentifier:{type:String,required:!0},showHide:{type:String,required:!0},title:{type:String,required:!1}},computed:{modalTitle(){return typeof this.title>"u"?void 0:this.title}},data(){return{outcomeDeclaration:null,mathElementMap:new Map,isQtiValid:!0}},inheritAttrs:!0,methods:{initializeTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathElements().forEach(function(i){this.archiveMathElement(i),i.innerHTML=this.applyTemplateValuesToMathml(i.innerHTML,e)},this)},updateTemplateMathVariables(){const e=this.getTemplateMathVariables();if(e.length===0)return;this.getMathScriptElements().forEach(function(i){for(let[s,n]of this.mathElementMap){const r=new RegExp('id="('+s+')"',"g");if(i.innerHTML.match(r)){i.innerHTML=this.applyTemplateValuesToMathml(n,e);break}}},this),this.reprocessMML()},getTemplateMathVariables(){return _.getTemplateMathParameterVariables()},getMathElements(){return this.$el.querySelectorAll("math")},getMathScriptElements(){return this.$el.querySelectorAll('script[type="math/mml"]')},archiveMathElement(e){e.hasAttribute("id")||(e.id=Gr.randomString(5,"a")),this.mathElementMap.set(e.id,e.outerHTML)},applyTemplateValuesToMathml(e,t){let i=e;return t.forEach(function(s){const n=new RegExp("<[mc]i[^>]*>("+s.identifier+")<\\/[mc]i>","g"),r=e.match(n);r&&(i=i.replace(n,r[0].replace(s.identifier,s.value)))}),i},reprocessMML(){this.$nextTick(()=>{window.MathJax&&window.MathJax.Hub.Queue(["Reprocess",window.MathJax.Hub,this.$refs.root])})},display(e){e?this.$refs.modal.show():this.$refs.modal.hide()},evaluate(){if(this.outcomeDeclaration=Gr.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier),this.outcomeDeclaration.cardinality==="single"){if(this.outcomeDeclaration.value===this.identifier){this.display(this.show);return}this.show||this.display(!0);return}if(this.outcomeDeclaration.cardinality==="multiple"){for(let e=0;e<this.outcomeDeclaration.value.length;e++)if(this.outcomeDeclaration.value[e]===this.identifier){this.display(this.show);return}this.show||this.display(!0)}}},created(){try{let e=Gr.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier);if(e.baseType!=="identifier")throw new c('Invalid outcome variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid outcome variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Gr.validateIdentifierAttribute(this.identifier),this.show=Gr.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.initializeTemplateMathVariables(),_.defineFeedback({outcomeIdentifier:this.outcomeIdentifier,identifier:this.identifier,feedbackType:"Modal",node:this}),console.log("[ModalFeedback]",this)}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},_1={ref:"root",class:"qti-modal-feedback"};function I1(e,t,i,s,n,r){const a=l.resolveComponent("ModalDialog");return l.openBlock(),l.createElementBlock("div",_1,[l.createVNode(a,{ref:"modal"},{header:l.withCtx(()=>[l.createElementVNode("h5",null,l.toDisplayString(r.modalTitle),1)]),body:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),footer:l.withCtx(()=>[l.createElementVNode("button",{class:"qti-modal-feedback-ok",onClick:t[0]||(t[0]=o=>e.$refs.modal.hide())},"OK")]),_:3},512)],512)}const V1=B(x1,[["render",I1]]),A1={name:"QtiContentBody",data(){return{isQtiValid:!0}},mounted(){}},$1={ref:"root",class:"qti-content-body"};function L1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",$1,[l.renderSlot(e.$slots,"default")],512)}const M1=B(A1,[["render",L1]]),Uo=new G,N1={name:"QtiTemplateInline",props:{identifier:{type:String,required:!0},templateIdentifier:{type:String,required:!0},showHide:{type:String,required:!1,default:"show"}},data(){return{value:null,templateDeclaration:null,show:!0,isQtiValid:!0}},methods:{evaluate(){try{if(this.hideTemplate(),this.templateDeclaration=Uo.validateTemplateIdentifierAttribute(_,this.templateIdentifier),console.log("[QtiTemplateInline]["+this.templateIdentifier+"][Show]",this.show),this.templateDeclaration.cardinality==="single"){if(this.templateDeclaration.value===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.showTemplate();return}if(this.templateDeclaration.cardinality==="multiple"){for(let e=0;e<this.templateDeclaration.value.length;e++)if(this.templateDeclaration.value[e]===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.hideTemplate();return}}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}},hideTemplate(){this.$refs.root.classList.add("hidden")},showTemplate(){this.$refs.root.classList.remove("hidden")}},created(){try{let e=Uo.validateTemplateIdentifierAttribute(_,this.templateIdentifier);if(e.baseType!=="identifier")throw new c('Invalid template variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid template variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Uo.validateIdentifierAttribute(this.identifier),this.show=Uo.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.defineTemplate({node:this}),this.evaluate()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},R1={ref:"root",class:"qti-template-inline hidden"};function k1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",R1,[l.renderSlot(e.$slots,"default")],512)}const q1=B(N1,[["render",k1]]),Go=new G,O1={name:"QtiTemplateBlock",props:{identifier:{type:String,required:!0},templateIdentifier:{type:String,required:!0},showHide:{type:String,required:!1,default:"show"}},data(){return{value:null,templateDeclaration:null,show:!0,isQtiValid:!0}},methods:{evaluate(){try{if(this.hideTemplate(),this.templateDeclaration=Go.validateTemplateIdentifierAttribute(_,this.templateIdentifier),console.log("[QtiTemplateBlock]["+this.templateIdentifier+"][Show]",this.show),this.templateDeclaration.cardinality==="single"){if(this.templateDeclaration.value===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.showTemplate();return}if(this.templateDeclaration.cardinality==="multiple"){for(let e=0;e<this.templateDeclaration.value.length;e++)if(this.templateDeclaration.value[e]===this.identifier){this.show?this.showTemplate():this.hideTemplate();return}this.show||this.showTemplate();return}}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}},hideTemplate(){this.$refs.root.classList.add("hidden")},showTemplate(){this.$refs.root.classList.remove("hidden")}},created(){try{let e=Go.validateTemplateIdentifierAttribute(_,this.templateIdentifier);if(e.baseType!=="identifier")throw new c('Invalid template variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid template variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Go.validateIdentifierAttribute(this.identifier),this.show=Go.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.defineTemplate({node:this}),this.evaluate()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},B1={ref:"root",class:"qti-template-block hidden"};function P1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",B1,[l.renderSlot(e.$slots,"default")],512)}const D1=B(O1,[["render",P1]]),jo=new G,Q1={name:"QtiFeedbackInline",props:{identifier:{type:String,required:!0},outcomeIdentifier:{type:String,required:!0},showHide:{type:String,required:!0}},data(){return{show:null,outcomeDeclaration:null,isQtiValid:!0}},methods:{defaultShowHide(){this.show?this.$refs.root.classList.add("hidden"):this.$refs.root.classList.remove("hidden")},display(e){e?this.$refs.root.classList.remove("hidden"):this.$refs.root.classList.add("hidden")},isOutcomeValueNull(e){return e===null},evaluate(){if(this.defaultShowHide(),this.outcomeDeclaration=jo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier),this.outcomeDeclaration.cardinality==="single"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;if(this.outcomeDeclaration.value===this.identifier){this.display(this.show);return}this.show||this.display(!0);return}if(this.outcomeDeclaration.cardinality==="multiple"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;for(let e=0;e<this.outcomeDeclaration.value.length;e++)if(this.outcomeDeclaration.value[e]===this.identifier){this.display(this.show);return}this.show||this.display(!0)}}},created(){try{let e=jo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier);if(e.baseType!=="identifier")throw new c('Invalid outcome variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid outcome variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');jo.validateIdentifierAttribute(this.identifier),this.show=jo.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.defaultShowHide(),_.defineFeedback({outcomeIdentifier:this.outcomeIdentifier,identifier:this.identifier,feedbackType:"Inline",show:this.show,node:this}),console.log("[FeedbackInline]",this)}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},H1={ref:"root",class:"qti-feedback-inline hidden"};function F1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",H1,[l.renderSlot(e.$slots,"default")],512)}const U1=B(Q1,[["render",F1]]),Wo=new G,G1={name:"QtiFeedbackBlock",props:{identifier:{type:String,required:!0},outcomeIdentifier:{type:String,required:!0},showHide:{type:String,required:!0}},data(){return{show:null,outcomeDeclaration:null,isQtiValid:!0}},methods:{defaultShowHide(){this.show?this.$refs.root.classList.add("hidden"):this.$refs.root.classList.remove("hidden")},display(e){e?this.$refs.root.classList.remove("hidden"):this.$refs.root.classList.add("hidden")},isOutcomeValueNull(e){return e===null},evaluate(){if(this.defaultShowHide(),this.outcomeDeclaration=Wo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier),console.log("[FeedbackBlock]["+this.identifier+"][evaluate]",this.outcomeIdentifier,this.outcomeDeclaration.value),this.outcomeDeclaration.cardinality==="single"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;if(this.outcomeDeclaration.value===this.identifier){this.display(this.show);return}this.show||this.display(!0);return}if(this.outcomeDeclaration.cardinality==="multiple"){if(this.isOutcomeValueNull(this.outcomeDeclaration.value))return;for(let e=0;e<this.outcomeDeclaration.value.length;e++)if(this.outcomeDeclaration.value[e]===this.identifier){this.display(this.show);return}this.show||this.display(!0)}}},created(){try{let e=Wo.validateOutcomeIdentifierAttribute(_,this.outcomeIdentifier);if(e.baseType!=="identifier")throw new c('Invalid outcome variable base-type: "'+e.baseType+'". Must be "identifier".');if(e.cardinality!=="single"&&e.cardinality!=="multiple")throw new c('Invalid outcome variable cardinality: "'+e.cardinality+'". Must be "single" or "multiple".');Wo.validateIdentifierAttribute(this.identifier),this.show=Wo.validateShowHideAttribute(this.showHide)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.defaultShowHide(),_.defineFeedback({outcomeIdentifier:this.outcomeIdentifier,identifier:this.identifier,feedbackType:"Block",show:this.show,node:this}),console.log("[FeedbackBlock]",this)}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},j1={ref:"root",class:"qti-feedback-block hidden"};function W1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",j1,[l.renderSlot(e.$slots,"default")],512)}const z1=B(G1,[["render",W1]]),K1=new G,Y1=new ie,X1={name:"QtiRubricBlock",props:{view:{type:String,required:!0},use:{type:String,required:!1}},data(){return{rubricBlockContext:null,isQtiValid:!0}},computed:{isScoringRubricBlock(){const e=this.view.split(" ");for(let t=0;t<e.length;t++)if(e[t]==="scorer")return!0;return!1}},methods:{getView(){return this.view},getUse(){return this.use},getInnerHtml(){return this.$refs.root.innerHTML},getStore(){return this.rubricBlockContext==="TEST"?it:_},validateChildren(){},evaluate(){if(!this.isScoringRubricBlock){this.$refs.root.classList.remove("hidden");return}this.$refs.root.innerHTML=""}},created(){try{this.rubricBlockContext=Y1.computeNodeContext(this),K1.validateRubricBlockViewAttribute(this.view),this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.isScoringRubricBlock&&this.getStore().defineScoringRubricBlock({view:this.view,html:this.$refs.root.innerHTML,node:this}),this.evaluate(),console.log("["+this.$options.name+"]["+this.rubricBlockContext+"][View: "+this.view+"]")}catch(e){throw this.isQtiValid=!1,new c(e.message)}}},Z1={ref:"root",class:"qti-rubric-block hidden"};function J1(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",Z1,[l.renderSlot(e.$slots,"default")],512)}const ex=B(X1,[["render",J1]]);var Ts=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function em(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tm={},zo={},im={},Ko={};Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.boolean=void 0;const tx=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());case"[object Number]":return e.valueOf()===1;case"[object Boolean]":return e.valueOf();default:return!1}};Ko.boolean=tx;var Yo={};Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.isBooleanable=void 0;const ix=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1","false","f","no","n","off","0"].includes(e.trim().toLowerCase());case"[object Number]":return[0,1].includes(e.valueOf());case"[object Boolean]":return!0;default:return!1}};Yo.isBooleanable=ix,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isBooleanable=e.boolean=void 0;const t=Ko;Object.defineProperty(e,"boolean",{enumerable:!0,get:function(){return t.boolean}});const i=Yo;Object.defineProperty(e,"isBooleanable",{enumerable:!0,get:function(){return i.isBooleanable}})}(im);var Xo={};Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.tokenize=void 0;const sx=/(?:%(?<flag>([+0-]|-\+))?(?<width>\d+)?(?<position>\d+\$)?(?<precision>\.\d+)?(?<conversion>[%BCESb-iosux]))|(\\%)/g,nx=e=>{let t;const i=[];let s=0,n=0,r=null;for(;(t=sx.exec(e))!==null;){t.index>n&&(r={literal:e.slice(n,t.index),type:"literal"},i.push(r));const a=t[0];n=t.index+a.length,a==="\\%"||a==="%%"?r&&r.type==="literal"?r.literal+="%":(r={literal:"%",type:"literal"},i.push(r)):t.groups&&(r={conversion:t.groups.conversion,flag:t.groups.flag||null,placeholder:a,position:t.groups.position?Number.parseInt(t.groups.position,10)-1:s++,precision:t.groups.precision?Number.parseInt(t.groups.precision.slice(1),10):null,type:"placeholder",width:t.groups.width?Number.parseInt(t.groups.width,10):null},i.push(r))}return n<=e.length-1&&(r&&r.type==="literal"?r.literal+=e.slice(n):i.push({literal:e.slice(n),type:"literal"})),i};Xo.tokenize=nx,Object.defineProperty(zo,"__esModule",{value:!0}),zo.createPrintf=void 0;const sm=im,rx=Xo,ax=(e,t)=>t.placeholder,ox=e=>{var t;const i=(r,a,o)=>o==="-"?r.padEnd(a," "):o==="-+"?((Number(r)>=0?"+":"")+r).padEnd(a," "):o==="+"?((Number(r)>=0?"+":"")+r).padStart(a," "):o==="0"?r.padStart(a,"0"):r.padStart(a," "),s=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:ax,n={};return(r,...a)=>{let o=n[r];o||(o=n[r]=rx.tokenize(r));let u="";for(const h of o)if(h.type==="literal")u+=h.literal;else{let f=a[h.position];if(f===void 0)u+=s(r,h,a);else if(h.conversion==="b")u+=sm.boolean(f)?"true":"false";else if(h.conversion==="B")u+=sm.boolean(f)?"TRUE":"FALSE";else if(h.conversion==="c")u+=f;else if(h.conversion==="C")u+=String(f).toUpperCase();else if(h.conversion==="i"||h.conversion==="d")f=String(Math.trunc(f)),h.width!==null&&(f=i(f,h.width,h.flag)),u+=f;else if(h.conversion==="e")u+=Number(f).toExponential();else if(h.conversion==="E")u+=Number(f).toExponential().toUpperCase();else if(h.conversion==="f")h.precision!==null&&(f=Number(f).toFixed(h.precision)),h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=f;else if(h.conversion==="o")u+=(Number.parseInt(String(f),10)>>>0).toString(8);else if(h.conversion==="s")h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=f;else if(h.conversion==="S")h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=String(f).toUpperCase();else if(h.conversion==="u")u+=Number.parseInt(String(f),10)>>>0;else if(h.conversion==="x")f=(Number.parseInt(String(f),10)>>>0).toString(16),h.width!==null&&(f=i(String(f),h.width,h.flag)),u+=f;else throw new Error("Unknown format specifier.")}return u}};zo.createPrintf=ox,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=zo;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()}(tm);const nm=new G,lx={name:"QtiPrintedVariable",props:{id:{type:String,required:!1},language:{type:String,required:!1},label:{type:String,required:!1},baseuri:{type:String,required:!1},identifier:{type:String,required:!0},format:{type:String,required:!1},base:{type:String,required:!1},index:{type:String,required:!1},powerForm:{type:String,required:!1},field:{type:String,required:!1},delimiter:{type:String,required:!1},mappingIndicator:{type:String,required:!1}},data(){return{value:this.identifier,declaration:null,isQtiValid:!0}},methods:{printedValue(e){return typeof this.format>"u"?e:tm.printf(this.format,e)},evaluate(){try{this.declaration=nm.validatePrintedVariableIdentifierAttribute(_,this.identifier),this.value=this.printedValue(this.declaration.value),console.log("[QtiPrintedVariable]["+this.identifier+"][Value]",this.value)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiEvaluationException"?new O(e.message):new Error(e.message)}}},created(){try{nm.validatePrintedVariableIdentifierAttribute(_,this.identifier)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.definePrintedVariable({node:this}),this.evaluate()}catch(e){throw this.isQtiValid=!1,new c(e.message)}}};function cx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"root",class:"qti-printed-variable"},l.toDisplayString(n.value),513)}const ux=B(lx,[["render",cx]]);class hx{constructor(){this.constants={LABELS_UPPER_ALPHA:["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],LABELS_LOWER_ALPHA:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],LABELS_DECIMAL:["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26"],LABELS_CJK_IDEOGRAPHIC:["一","二","三","四","五","六","七","八","九","十"],LABELS_SUFFIX_PERIOD:".",LABELS_SUFFIX_PARENTHESIS:")",LABELS_SUFFIX_NONE:"",LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA:"、",QTI_LABELS_NONE:"qti-labels-none",QTI_LABELS_DECIMAL:"qti-labels-decimal",QTI_LABELS_LOWER_ALPHA:"qti-labels-lower-alpha",QTI_LABELS_UPPER_ALPHA:"qti-labels-upper-alpha",QTI_LABELS_CJK_IDEOGRAPHIC:"qti-labels-cjk-ideographic",QTI_LABELS_SUFFIX_NONE:"qti-labels-suffix-none",QTI_LABELS_SUFFIX_PERIOD:"qti-labels-suffix-period",QTI_LABELS_SUFFIX_PARENTHESIS:"qti-labels-suffix-parenthesis",QTI_LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA:"qti-labels-cjk-ideographic-comma",QTI_ORIENTATION_VERTICAL:"qti-orientation-vertical",QTI_ORIENTATION_HORIZONTAL:"qti-orientation-horizontal",QTI_INPUT_CONTROL_HIDDEN:"qti-input-control-hidden",SBAC_PRESENTATION:"sbac",LRN_PRESENTATION:"lrn",QTI_CHOICES_STACKING_1:"qti-choices-stacking-1",QTI_CHOICES_STACKING_2:"qti-choices-stacking-2",QTI_CHOICES_STACKING_3:"qti-choices-stacking-3",QTI_CHOICES_STACKING_4:"qti-choices-stacking-4",QTI_CHOICES_STACKING_5:"qti-choices-stacking-5",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message"},this.parentClassList=null,this.choiceGroupNode=null,this.choices=null,this.presentation_HideLabels=!1,this.presentation_Labels=this.constants.LABELS_UPPER_ALPHA,this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_PERIOD,this.presentation_Sbac=!1,this.presentation_Lrn=!1,this.presentation_IsInputControlHidden=!1,this.presentation_IsOrientationVertical=!1,this.presentation_IsOrientationHorizontal=!1,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage="",this.presentation_Label_Style="",this.presentation_Stacking_Class=""}initialize(t){this.choiceGroupNode=t,this.parentClassList=t.choiceInteractionClassAttribute,this.choices=t.choices,this.processRootClassAttribute(this.parentClassList),this.processStackingClass(),this.processLabelsAndInputControls()}processRootClassAttribute(t){const i=t.values();for(let s of i)switch(s){case this.constants.QTI_ORIENTATION_VERTICAL:this.presentation_IsOrientationVertical=!0,this.presentation_IsOrientationHorizontal=!1;break;case this.constants.QTI_ORIENTATION_HORIZONTAL:this.presentation_IsOrientationVertical=!1,this.presentation_IsOrientationHorizontal=!0;break;case this.constants.QTI_CHOICES_STACKING_1:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_1;break;case this.constants.QTI_CHOICES_STACKING_2:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_2;break;case this.constants.QTI_CHOICES_STACKING_3:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_3;break;case this.constants.QTI_CHOICES_STACKING_4:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_4;break;case this.constants.QTI_CHOICES_STACKING_5:this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_5;break;case this.constants.QTI_LABELS_NONE:this.presentation_HideLabels=!0;break;case this.constants.QTI_LABELS_UPPER_ALPHA:this.presentation_Labels=this.constants.LABELS_UPPER_ALPHA;break;case this.constants.QTI_LABELS_LOWER_ALPHA:this.presentation_Labels=this.constants.LABELS_LOWER_ALPHA;break;case this.constants.QTI_LABELS_DECIMAL:this.presentation_Labels=this.constants.LABELS_DECIMAL;break;case this.constants.QTI_LABELS_CJK_IDEOGRAPHIC:this.presentation_Labels=this.constants.LABELS_CJK_IDEOGRAPHIC;break;case this.constants.QTI_LABELS_SUFFIX_NONE:this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_NONE;break;case this.constants.QTI_LABELS_SUFFIX_PERIOD:this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_PERIOD;break;case this.constants.QTI_LABELS_SUFFIX_PARENTHESIS:this.presentation_LabelsSuffix=this.constants.LABELS_SUFFIX_PARENTHESIS;break;case this.constants.QTI_LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA:this.presentation_LabelsSuffix=this.constants.QTI_LABELS_SUFFIX_CJK_IDEOGRAPHIC_COMMA;break;case this.constants.QTI_INPUT_CONTROL_HIDDEN:this.presentation_IsInputControlHidden=!0;break;case this.constants.SBAC_PRESENTATION:this.presentation_Sbac=!0;break;case this.constants.LRN_PRESENTATION:this.presentation_Lrn=!0;break}}processStackingClass(){if(this.presentation_Stacking_Class!==""&&!this.presentation_IsOrientationVertical&&!this.presentation_IsOrientationHorizontal)this.choices.length>1?this.presentation_IsOrientationHorizontal=!0:this.presentation_IsOrientationVertical=!0;else if(this.presentation_Stacking_Class===""&&this.presentation_IsOrientationHorizontal){const t=this.choices.length;t>=5?this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_5:t==4?this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_4:t==3?this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_3:t==2&&(this.presentation_Stacking_Class=this.constants.QTI_CHOICES_STACKING_2),t==1&&(this.presentation_IsOrientationVertical=!0,this.presentation_IsOrientationHorizontal=!1)}!this.presentation_IsOrientationVertical&&!this.presentation_IsOrientationHorizontal&&(this.presentation_IsOrientationVertical=!0),this.choiceGroupNode.$refs.choicegroup.classList.add(this.presentation_IsOrientationVertical?this.constants.QTI_ORIENTATION_VERTICAL:this.constants.QTI_ORIENTATION_HORIZONTAL),this.presentation_Stacking_Class!==""&&this.choiceGroupNode.$refs.choicegroup.classList.add(this.presentation_Stacking_Class)}processLabelsAndInputControls(){for(let t=0;t<this.choices.length;t++)this.presentation_HideLabels?this.choices[t].hideLabel():this.presentation_Sbac?this.choices[t].setLabelSbac(this.presentation_Labels[t]):this.choices[t].setLabel(this.presentation_Labels[t]+this.presentation_LabelsSuffix),this.presentation_Lrn&&this.choices[t].setChoiceLrn(),this.presentation_IsInputControlHidden&&this.choices[t].hideControl()}}const dx=new G,fx=new ie,px={props:{responseIdentifier:{required:!0,type:String},cardinality:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},maxChoices:{required:!1,type:String,default:"1"}},data(){return{choices:[],firstChoice:null,lastChoice:null,role:null,isRadio:null,isShuffle:null,hasPrompt:!1,choiceInteractionClassAttribute:null,presentationFactory:null,isQtiValid:!0,priorState:null}},methods:{getPriorState(){return this.priorState},setPriorState(e){this.priorState=e},validateChildren(){let e=!1;this.$slots.default&&this.$slots.default()[0].children.forEach(t=>{if(dx.isValidSlot(t)){if(t.type.name==="QtiPrompt"){if(e)throw new c("Invalid element order. qti-prompt must come before qti-simple-choices");if(!this.hasPrompt)return this.hasPrompt=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(t.type.name==="QtiSimpleChoice")return e=!0;if(t.type.name!=="QtiSimpleChoice")throw new c('Node is not a qti-simple-choice: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children[0].children.forEach(t=>{t.component!==null&&t.type.name==="QtiSimpleChoice"&&this.choices.push(t.component.proxy)},this)},processGroupUI(){this.isShuffle&&this.processShuffle(),this.presentationFactory.initialize(this),this.setActiveDescendant(""),this.isRadio&&this.processFirstAndLastChoices()},resetGroupUI(){this.setPriorState(null),this.processGroupUI(),this.$emit("choiceGroupReady",{choices:this.choices,firstChoice:this.firstChoice,lastChoice:this.lastChoice})},processShuffle(){let e=this.createShuffleContainer(this.choices,this.getPriorState()),t=null;if(this.hasPrompt){const i=this.$refs.choicegroup.querySelector(".qti-prompt");i!==null&&(t=i.cloneNode(!0))}this.choices.splice(0,this.choices.length),this.$refs.choicegroup.innerHTML="",t!==null&&this.$refs.choicegroup.appendChild(t),e.forEach(i=>{this.$refs.choicegroup.appendChild(i.node.$el),this.choices.push(i.node)},this)},createShuffleContainer(e,t){let i=[];return t===null?(e.forEach(s=>{i.push({fixed:s.fixed==="true",node:s})}),fx.shuffleArrayFixed(i),i):(t.state.order.forEach(s=>{i.push({node:this.findChoiceByIdentifier(s,e)})},this),i)},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Choice Interaction State Invalid. Choice identifier "'+e+'" not found.')},processFirstAndLastChoices(){this.choices.length!==0&&(this.firstChoice=this.choices[0],this.lastChoice=this.choices[this.choices.length-1])},setActiveDescendant(e){this.$refs.choicegroup.setAttribute("aria-activedescendant",e)},initializeChoiceGroup(){switch(this.cardinality){case"single":this.role="radiogroup",this.isRadio=!0;break;case"multiple":this.role="group",this.isRadio=!1;break;default:this.role="radiogroup",this.isRadio=!0;break}this.isShuffle=this.shuffle==="true",this.presentationFactory=new hx}},created(){try{if(typeof this.cardinality>"u")throw new c("Undefined qti-choice-interaction cardinality");this.initializeChoiceGroup(),this.validateChildren()}catch(e){throw this.isQtiValid=!1,console.log("[QtiChoiceInteraction][ValidationError]",e.name,e.message),new c(e.message)}},mounted(){if(this.isQtiValid)try{this.choiceInteractionClassAttribute=this.$parent.$refs.root.classList,this.processChildren(),this.setPriorState(this.$parent.priorState),this.processGroupUI(),this.$emit("choiceGroupReady",{choices:this.choices,firstChoice:this.firstChoice,lastChoice:this.lastChoice})}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw console.log("[QtiChoiceInteraction][ValidationException]",e.message),new c(e.message);if(e.name==="QtiEvaluationException")throw console.log("[QtiChoiceInteraction][EvaluationException]",e.message),new O(e.message)}}},mx=["role"];function gx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("ul",{ref:"choicegroup",role:n.role,class:"qti-choice-list"},[l.renderSlot(e.$slots,"default")],8,mx)}const rm=B(px,[["render",gx]]),am=new G,yx={name:"QtiChoiceInteraction",components:[rm],props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},orientation:{required:!1,type:String},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,choices:[],firstChoice:null,lastChoice:null,currentChoice:null,isRadio:!0,isShuffle:!1,hasPrompts:!1,isDisabled:!1,isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.toggleDisableChoices(!0)},enable(){this.toggleDisableChoices(!1)},toggleDisableChoices(e){this.isDisabled=e,this.choices.forEach(t=>{t.setIsDisabled(e)})},getInvalidResponseMessage(){return this.minSelectionsMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.choices.forEach(e=>{e.setChecked(!1),this.isRadio&&e.setTabIndex("-1")}),this.currentChoice=null,this.priorState=null,this.$refs.choicegroup.resetGroupUI()},restoreValue(e){e!==null&&(this.isRadio?this.handleSetChecked({identifier:e,checked:"true"},!0):e.forEach(t=>{this.handleSetChecked({identifier:t,checked:"true"},!0)},this),this.updateValidity(this.computeIsValid()))},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality!=="multiple"?"single":"multiple":"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleSetChecked(e,t=!1){this.choices.forEach(i=>{this.isRadio&&(i.setChecked(!1),i.setTabIndex("-1")),i.identifier===e.identifier&&(this.currentChoice=i)}),e.checked==="true"?this.checkMaxChoicesLimit()?this.currentChoice.setChecked(!1):this.currentChoice.setChecked(!0):this.currentChoice.setChecked(!1),t||(this.setResponse(this.computeResponse()),this.currentChoice.setFocus(),this.evaluateValidity()),this.currentChoice.setTabIndex("0")},handleSetFocusPreviousChoice(e){this.isRadio&&this.removeChoiceFromTabOrder(e),this.setFocusChoice(this.findPreviousIdentifier(e))},handleSetFocusNextChoice(e){this.isRadio&&this.removeChoiceFromTabOrder(e),this.setFocusChoice(this.findNextIdentifier(e))},handleSetActiveDescendant(e){this.$refs.choicegroup.setActiveDescendant(e)},setFocusChoice(e){for(let t=0;t<this.choices.length;t++)this.choices[t].identifier===e&&(this.currentChoice=this.choices[t]);this.currentChoice.setTabIndex("0"),this.currentChoice.setFocus()},removeChoiceFromTabOrder(e){for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e){this.choices[t].setTabIndex(-1);break}},findPreviousIdentifier(e){if(e===this.firstChoice.identifier)return this.lastChoice.identifier;for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e)return this.choices[t-1].identifier;return null},findNextIdentifier(e){if(e===this.lastChoice.identifier)return this.firstChoice.identifier;for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e)return this.choices[t+1].identifier;return null},handleChoiceGroupReady(e){this.choices=e.choices,this.firstChoice=e.firstChoice,this.lastChoice=e.lastChoice,this.isRadio&&this.firstChoice.setTabIndex("0"),this.priorState!==null&&this.restoreValue(this.priorState.value),this.setResponse(this.computeResponse()),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},computeResponse(){let e=this.isRadio?null:[];return this.choices.forEach(t=>{t.isChecked()&&(this.isRadio?e=t.identifier:e.push(t.identifier))}),this.isRadio?e:e.length===0?null:e},computeState(){const e={};let t=[];return this.choices.forEach(i=>{t.push(i.identifier)}),e.order=t,e},computeIsValid(){return this.minChoices*1===0?!0:this.response===null?!1:this.cardinality==="single"||this.cardinality==="multiple"&&this.response.length>=this.minChoices*1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},checkMaxChoicesLimit(){if(this.isRadio||this.maxChoices==0)return!1;const e=this.getResponse();return e!==null&&e.length==this.maxChoices?(_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage),!0):!1},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoices==0?"":"You are permitted a maximum of "+this.maxChoices+" choice"+(this.maxChoices>1?"s":"")+" for this question.<br/><br/>Please unselect one of your choices before making another choice."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minSelectionsMessage=this.minChoices==0?"":"You must make at least "+this.minChoices+" choice"+(this.minChoices>1?"s":"")+" for this question."},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Choice Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Choice Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Choice Interaction State Invalid. "order" property not found.');return t},showSolution(e){if(e!==null){if(this.isRadio){this.choices.forEach(t=>{this.setChoiceSolution(t,e)},this);return}this.choices.forEach(t=>{const i=this.findIdentifierInCorrectResponse(t.identifier,e);this.setChoiceSolution(t,i)},this)}},setChoiceSolution(e,t){e.isChecked()?e.identifier===t?e.setCorrectSolution():e.setIncorrectSolution():e.identifier===t?e.setExpectedSolution():e.setIgnoreSolution()},findIdentifierInCorrectResponse(e,t){for(let i=0;i<t.length;i++)if(e===t[i])return e;return null}},created(){try{this.responseDeclaration=am.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.priorState=this.getPriorState(this.responseIdentifier),am.validateMaxMinChoices(this.maxChoices,this.minChoices),this.cardinality=this.getCardinality(),this.isRadio=this.cardinality!=="multiple",this.isShuffle=this.shuffle==="true",this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Choice",node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},wx={ref:"root",class:"qti-choice-interaction"},bx={ref:"prompt",class:"qti-prompt-wrapper"};function vx(e,t,i,s,n,r){const a=l.resolveComponent("ChoiceGroup");return l.openBlock(),l.createElementBlock("div",wx,[l.createElementVNode("div",bx,null,512),l.createVNode(a,l.mergeProps({ref:"choicegroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxChoices:i.maxChoices,minChoices:i.minChoices,onChoiceGroupReady:r.handleChoiceGroupReady,onSetChecked:r.handleSetChecked,onSetFocusNextChoice:r.handleSetFocusNextChoice,onSetFocusPreviousChoice:r.handleSetFocusPreviousChoice,onSetActiveDescendant:r.handleSetActiveDescendant},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxChoices","minChoices","onChoiceGroupReady","onSetChecked","onSetFocusNextChoice","onSetFocusPreviousChoice","onSetActiveDescendant"])],512)}const Ex=B(yx,[["render",vx]]);class Tx{constructor(t){return this.constants={QTI_ORIENTATION_HORIZONTAL:"qti-orientation-horizontal",QTI_ORIENTATION_VERTICAL:"qti-orientation-vertical",QTI_WRITING_ORIENTATION_VERTICAL_RL:"qti-writing-orientation-vertical-rl"},this.classList=t,this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_ORIENTATION_VERTICAL:case this.constants.QTI_WRITING_ORIENTATION_VERTICAL_RL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_VERTICAL;break;case this.constants.QTI_ORIENTATION_HORIZONTAL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL;break}}getOrientationClass(){return this.presentation_OrientationClass}isOrientationVertical(){return this.presentation_OrientationClass==this.constants.QTI_ORIENTATION_VERTICAL}setVerticalOrientation(t){this.isOrientationVertical()&&t.classList.add(this.constants.QTI_ORIENTATION_VERTICAL)}}const lu=new G,Cx=new ie,Sx={name:"QtiInlineChoiceInteraction",props:{responseIdentifier:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},required:{required:!1,type:String,default:"false"},dataPrompt:{required:!1,type:String,default:"Choose..."},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},dataMinSelectionsMessage:{required:!1,type:String}},computed:{labelId(){return"inlinechoice_label_"+this.responseIdentifier},buttonId(){return"inlinechoice_button_"+this.responseIdentifier},buttonAriaLabelledbyId(){return"inlinechoice_label_"+this.responseIdentifier+" inlinechoice_button_"+this.responseIdentifier},listboxId(){return"inlinechoice_listbox_"+this.responseIdentifier},listboxAriaLabelledbyId(){return"inlinechoice_label_"+this.responseIdentifier}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",choices:[],allOptionElements:null,activeDescendant:null,keysSoFar:"",searchIndex:null,isShuffle:null,isRequired:!1,isDisabled:!1,isQtiValid:!0,presentationFactory:null,isOrientationVertical:!1,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.toggleDisable(!0)},enable(){this.toggleDisable(!1)},toggleDisable(e){this.isDisabled=e,e?(this.getResponse()===null&&(this.$refs.label.innerHTML=""),this.$refs.label.classList.remove("qti-hidden"),this.$refs.label.setAttribute("tabIndex",0),this.$refs.button.classList.add("qti-hidden"),this.$refs.listbox.classList.add("inline-choice-select-listbox-hidden")):(this.$refs.label.classList.add("qti-hidden"),this.$refs.label.setAttribute("tabIndex",-1),this.$refs.button.classList.remove("qti-hidden"))},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.$refs.listbox.querySelectorAll('[role="option"]').forEach(t=>{this.defocusOption(t)},this),this.processGroupUI()},restoreValue(e){if(e===null)return;const t=this.findChoiceByIdentifier(e,this.choices);this.focusOption(t.$el,!0),this.setResponse(this.computeResponse(e)),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);if(typeof e>"u"&&(this.cardinality="single"),e.cardinality!=="single")throw new c('Invalid qti-inline-choice-interaction Response Variable cardinality: "'+this.cardinality+'"');return this.cardinality="single",this.cardinality},computeResponse(e){return e===null||e.length===0?null:e},computeState(){const e={};let t=[];return this.choices.forEach(i=>{t.push(i.identifier)}),e.order=t,e},computeIsValid(){return!this.isRequired&&this.minChoices*1===0?!0:this.response!==null},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}!this.isRequired&&this.minChoices*1===0||(this.minSelectionsMessage="You must make at least 1 choice for this question.")},handleButtonClick(){this.isDisabled||this.showListbox()},handleButtonKeyup(e){switch(e.code){case"ArrowUp":case"ArrowDown":if(e.preventDefault(),this.isDisabled)return;this.showListbox();break}},handleChoiceMousedown(e){e.preventDefault();let t=e.target;t.getAttribute("role")==="option"&&(this.focusOption(t),this.hideListbox(),this.$refs.button.focus())},handleBlur(){this.hideListbox()},handleFocusChange(e){this.$refs.prompt.innerHTML=e.innerHTML,this.$refs.label.innerHTML=e.innerHTML},showListbox(){this.$refs.listbox.classList.remove("inline-choice-select-listbox-hidden"),this.$refs.button.setAttribute("aria-expanded","true"),this.$refs.listbox.focus()},hideListbox(){this.$refs.listbox.classList.add("inline-choice-select-listbox-hidden"),this.$refs.button.removeAttribute("aria-expanded")},setupFocus(){this.activeDescendant||this.focusFirstOption()},focusFirstOption(){let e=this.$refs.listbox.querySelector('[role="option"]');e&&this.focusOption(e)},focusLastOption(){let e=this.$refs.listbox.querySelectorAll('[role="option"]');e.length&&this.focusOption(e[e.length-1])},focusOption(e,t=!1){if(t||this.defocusOption(document.getElementById(this.activeDescendant)),e.setAttribute("aria-selected","true"),e.classList.add("focused"),this.setActiveDescendant(e.id),!t&&(this.setResponse(this.computeResponse(e.getAttribute("data-identifier"))),this.evaluateValidity(),this.$refs.listbox.scrollHeight>this.$refs.listbox.clientHeight)){const i=this.$refs.listbox.clientHeight+this.$refs.listbox.scrollTop,s=e.offsetTop+e.offsetHeight;s>i?this.$refs.listbox.scrollTop=s-this.$refs.listbox.clientHeight:e.offsetTop<this.$refs.listbox.scrollTop&&(this.$refs.listbox.scrollTop=e.offsetTop)}this.handleFocusChange(e)},defocusOption(e){e&&(e.removeAttribute("aria-selected"),e.classList.remove("focused"))},checkKeyPress(e){if(e.code=="Enter"||e.code=="Escape"){e.preventDefault(),this.hideListbox(),this.$refs.button.focus();return}let t=document.getElementById(this.activeDescendant);if(t)switch(e.code){case"ArrowUp":case"ArrowDown":e.preventDefault(),e.code=="ArrowUp"?t=t.previousElementSibling:t=t.nextElementSibling,t&&this.focusOption(t);break;case"Home":e.preventDefault(),this.focusFirstOption();break;case"End":e.preventDefault(),this.focusLastOption();break}},findOptionToFocus(e){let t=this.$refs.listbox.querySelectorAll('[role="option"]');if(!this.keysSoFar)for(let s=0;s<t.length;s++)t[s].getAttribute("id")==this.activeDescendant&&(this.searchIndex=s);this.keysSoFar+=e,this.clearKeysSoFarAfterDelay();let i=this.findMatchInRange(t,this.searchIndex+1,t.length);return i||(i=this.findMatchInRange(t,0,this.searchIndex)),i},clearKeysSoFarAfterDelay(){this.keyClear&&(clearTimeout(this.keyClear),this.keyClear=null);let e=this;this.keyClear=setTimeout((function(){e.keysSoFar="",e.keyClear=null}).bind(this),500)},findMatchInRange(e,t,i){for(let s=t;s<i;s++){let n=e[s].innerText;if(n&&n.toUpperCase().indexOf(this.keysSoFar)===0)return e[s]}return null},validateChildren(){this.$slots.default&&this.$slots.default().forEach(e=>{if(lu.isValidSlot(e)){if(e.type.name==="QtiInlineChoice")return;throw new c('Node is not a qti-inline-choice: "'+e.type.name+'"')}})},processChildren(){const e=this.$.subTree.children[0].children[2].children[0];this.choices.push(e.component.proxy),this.$.subTree.children[0].children[2].children[1].children.forEach(i=>{i.component!==null&&this.choices.push(i.component.proxy)})},processGroupUI(){this.isOrientationVertical&&this.presentationFactory.setVerticalOrientation(this.$refs.root),this.isShuffle&&this.processShuffle(),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid()),this.setActiveDescendant("")},processShuffle(){let e=this.createShuffleContainer(this.choices,this.priorState);this.choices.splice(0,this.choices.length),this.$refs.listbox.innerHTML="",e.forEach(t=>{this.$refs.listbox.appendChild(t.node.$el),this.choices.push(t.node)},this)},createShuffleContainer(e,t){let i=[];return t===null?(e.forEach(s=>{i.push({fixed:s.fixed==="true",node:s})}),Cx.shuffleArrayFixed(i),i):(t.state.order.forEach(s=>{i.push({node:this.findChoiceByIdentifier(s,e)})},this),i)},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Inline Choice Interaction State Invalid. Inline Choice identifier "'+e+'" not found.')},setActiveDescendant(e){this.activeDescendant=e,this.$refs.listbox.setAttribute("aria-activedescendant",e)},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Choice Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Choice Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Choice Interaction State Invalid. "order" property not found.');return t},addChoiceMousedownListeners(){this.allOptionElements=this.$refs.listbox.querySelectorAll('[role="option"]'),this.allOptionElements.forEach(e=>{e.addEventListener("mousedown",this.handleChoiceMousedown)})},removeChoiceMousedownListeners(){this.allOptionsElements!==null&&this.allOptionElements.forEach(e=>{e.removeEventListener("mousedown",this.handleChoiceMousedown)})}},created(){try{if(this.responseDeclaration=lu.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.presentationFactory=new Tx(this.$.vnode.props.class),this.isOrientationVertical=this.presentationFactory.isOrientationVertical(),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),lu.validateMaxMinChoices(this.maxChoices,this.minChoices),this.minChoices>1)throw new c('Invalid qti-inline-choice-interaction min-choices attribute: "'+this.minChoices+'"');this.cardinality=this.getCardinality(),this.isShuffle=this.shuffle==="true",this.isRequired=this.required==="true",this.computeMinSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.processGroupUI(),this.priorState!==null&&this.restoreValue(this.priorState.value),this.addChoiceMousedownListeners(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"InlineChoice",node:this,resetValue:this.resetValue,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:null}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}},beforeUnmount(){this.removeChoiceMousedownListeners()}},xx={ref:"root",class:"qti-inline-choice-interaction"},_x={class:"inline-choice-wrapper"},Ix=["aria-labelledby","id"],Vx=["aria-labelledby"];function Ax(e,t,i,s,n,r){const a=l.resolveComponent("qti-inline-choice");return l.openBlock(),l.createElementBlock("div",xx,[l.createElementVNode("div",_x,[l.createElementVNode("div",{ref:"label",class:"inline-choice-select-label qti-hidden"},l.toDisplayString(i.dataPrompt),513),l.createElementVNode("button",{ref:"button","aria-haspopup":"listbox","aria-labelledby":r.buttonAriaLabelledbyId,id:r.buttonId,class:"inline-choice-select",onClick:t[0]||(t[0]=(...o)=>r.handleButtonClick&&r.handleButtonClick(...o)),onKeyup:t[1]||(t[1]=(...o)=>r.handleButtonKeyup&&r.handleButtonKeyup(...o))},[l.createElementVNode("div",{ref:"prompt",class:"inline-choice-select-prompt"},l.toDisplayString(i.dataPrompt),513)],40,Ix),l.createElementVNode("ul",{ref:"listbox",tabindex:"-1",role:"listbox","aria-labelledby":r.labelId,class:"inline-choice-select-listbox inline-choice-select-listbox-hidden",onBlur:t[2]||(t[2]=(...o)=>r.handleBlur&&r.handleBlur(...o)),onFocus:t[3]||(t[3]=(...o)=>r.setupFocus&&r.setupFocus(...o)),onKeydown:t[4]||(t[4]=(...o)=>r.checkKeyPress&&r.checkKeyPress(...o))},[l.createVNode(a,{identifier:"",fixed:"true"},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(i.dataPrompt),1)]),_:1}),l.renderSlot(e.$slots,"default")],40,Vx)])],512)}const $x=B(Sx,[["render",Ax]]),Lx={name:"EndAttemptGeneric",props:{title:{required:!0,type:String}},data(){return{step:1,isBtnDisabled:!1}},methods:{getIsBtnDisabled(){return this.isBtnDisabled},setIsBtnDisabled(e){this.isBtnDisabled=e},handleEndAttempt(){this.$parent.$emit("endAttempt",{response:!0})},enable(){this.toggleButtonDisabled(!1)},disable(){this.toggleButtonDisabled(!0)},toggleButtonDisabled(e){e?this.$refs.root.setAttribute("disabled",""):this.$refs.root.removeAttribute("disabled"),this.setIsBtnDisabled(e)}},created(){},mounted(){this.$parent.$emit("endAttemptReady",{node:this})}};function Mx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("button",{ref:"root",class:"qti-end-attempt-interaction",onClick:t[0]||(t[0]=l.withModifiers((...a)=>r.handleEndAttempt&&r.handleEndAttempt(...a),["prevent"])),type:"button"},l.toDisplayString(i.title),513)}const Nx=B(Lx,[["render",Mx]]),Rx={name:"EndAttemptControllerBar",props:{responseIdentifier:{required:!0,type:String},title:{required:!0,type:String},dataSteps:{required:!1,type:String},dataHastemplates:{required:!1,type:String},dataControllerType:{required:!1,type:String},dataHideprogress:{required:!1,type:String}},data(){return{step:1,isBtnDisabled:!1,response:!1}},computed:{progressMaximumSteps(){return typeof this.dataSteps>"u"?1:this.dataSteps*1},progressActiveWidth(){let e=this.progressMaximumSteps;return e=this.step>e?this.step:e,Math.floor(100*(this.step/e))},progressMessage(){return this.step===this.progressMaximumSteps?"All Parts Showing":"Step "+this.step+" of "+this.progressMaximumSteps},hasTemplates(){return typeof this.dataHastemplates<"u"?this.dataHastemplates==="true":!1},controllerType(){return typeof this.dataControllerType<"u"?this.dataControllerType:"generic"},progressClass(){return{"endattempt-progress-panel":!0,"progress-hidden":typeof this.dataHideprogress<"u"?this.dataHideprogress==="true":!1}}},methods:{getStep(){return this.step},setStep(e){this.step=e<this.progressMaximumSteps?e:this.progressMaximumSteps},incrementStep(){this.setStep(this.getStep()+1)},getIsBtnDisabled(){return this.isBtnDisabled},setIsBtnDisabled(e){this.isBtnDisabled=e},handleControllerNewTemplate(){this.resetControllerState(),_.NotifyNewTemplate({identifier:this.responseIdentifier,step:this.getStep(),maximumSteps:this.progressMaximumSteps})},handleControllerEndAttempt(){this.updateControllerState(),this.$parent.$emit("endAttempt",{response:this.response})},enable(){this.toggleButtonDisabled(!1)},disable(){this.toggleButtonDisabled(!0)},toggleButtonDisabled(e){e?this.$refs.endattempt.setAttribute("disabled",""):this.$refs.endattempt.removeAttribute("disabled"),this.setIsBtnDisabled(e)},resetControllerState(){this.setStep(1),this.enable(),this.$parent.$emit("notifyUpdateState",{})},updateControllerState(){switch(this.dataControllerType){case"showexample":case"solve":this.incrementStep(),this.getStep()<this.progressMaximumSteps?(this.response=!1,this.enable()):(this.response=!0,this.disable());break;case"generic":default:this.getStep()<this.progressMaximumSteps?(this.response=!1,this.incrementStep(),this.enable()):(this.response=!0,this.disable())}}},created(){},mounted(){this.$parent.$emit("endAttemptReady",{node:this})}},kx={class:"endattempt-controller"},qx={class:"endattempt-controller-progress"},Ox={id:"msgNotes"},Bx={class:"progress"},Px=["aria-valuenow"],Dx={class:"endattempt-controller-buttons"};function Qx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",kx,[l.createElementVNode("div",qx,[l.createElementVNode("div",{class:l.normalizeClass(r.progressClass)},[l.createElementVNode("div",Ox,l.toDisplayString(r.progressMessage),1),l.createElementVNode("div",Bx,[l.createElementVNode("div",{class:"progress-bar",style:l.normalizeStyle({width:r.progressActiveWidth+"%"}),role:"progressbar","aria-valuenow":r.progressActiveWidth,"aria-valuemin":"0","aria-valuemax":"progressMaximumSteps"},null,12,Px)])],2)]),t[2]||(t[2]=l.createElementVNode("div",{class:"endattempt-controller-filler"},null,-1)),l.createElementVNode("div",Dx,[r.hasTemplates?(l.openBlock(),l.createElementBlock("button",{key:0,id:"btnNewTemplate",onClick:t[0]||(t[0]=l.withModifiers((...a)=>r.handleControllerNewTemplate&&r.handleControllerNewTemplate(...a),["prevent"])),type:"button",class:"endattempt-btn endattempt-btn-secondary"},"New Question")):l.createCommentVNode("",!0),l.createElementVNode("button",{ref:"endattempt",id:"btnEndAttempt",onClick:t[1]||(t[1]=l.withModifiers((...a)=>r.handleControllerEndAttempt&&r.handleControllerEndAttempt(...a),["prevent"])),type:"button",class:"endattempt-btn endattempt-btn-primary"},l.toDisplayString(i.title),513)])])}const Hx=B(Rx,[["render",Qx]]),Zo={DEFAULT:"",ENDATTEMPT_CONTROLLER_BAR:"endattempt-controller-bar"};function Fx(e,t){switch(e){case Zo.ENDATTEMPT_CONTROLLER_BAR:return{template:'<end-attempt-controller-bar response-identifier="'+t.responseIdentifier+'" title="'+t.title+'" data-steps="'+t.dataSteps+'" data-hastemplates="'+t.dataHastemplates+'" data-controller-type="'+t.dataControllerType+'" data-hideprogress="'+t.dataHideprogress+'" />',components:{EndAttemptControllerBar:Hx}};default:return{template:'<end-attempt-default response-identifier="'+t.responseIdentifier+'" title="'+t.title+'"/>',components:{EndAttemptDefault:Nx}}}}function Ux(e){if(typeof e>"u"||e===null||e.length==0)return Zo.DEFAULT;const t=e.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case Zo.ENDATTEMPT_CONTROLLER_BAR:return t[i]}return Zo.DEFAULT}const Gx=new G,jx={name:"QtiEndAttemptInteraction",props:{responseIdentifier:{required:!0,type:String},title:{required:!0,type:String},dataSteps:{required:!1,type:String},dataHastemplates:{required:!1,type:String},dataControllerType:{required:!1,type:String},dataHideprogress:{required:!1,type:String}},data(){return{response:!1,state:null,cardinality:"single",responseDeclaration:null,interactionSubType:"",isBtnDisabled:!1,isValidResponse:!0,invalidResponseMessage:"",isQtiValid:!0,node:null,priorState:null}},computed:{interactionTemplate(){return Fx(this.interactionSubType,this.createComponentProperties())}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},updateState(){this.setState(this.computeState())},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.invalidResponseMessage},getCardinality(){return this.cardinality},getStep(){return this.interactionSubType==="endattempt-controller-bar"?this.node.getStep():1},setStep(e){this.interactionSubType==="endattempt-controller-bar"&&this.node.setStep(e)},initializeValue(){this.enableButton(),this.setStep(1),this.updateState(),this.setResponse(!1),this.setIsValid(!0)},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.initializeValue()},restoreValue(e){e.state.isBtnDisabled?this.disableButton():this.enableButton(),this.setStep(e.state.step),this.setState(this.computeState()),this.setResponse(this.computeResponse(e.value)),this.setIsValid(!0)},computeResponse(e){return e===null?!1:e},computeState(){return{step:this.getStep(),isBtnDisabled:this.getIsBtnDisabled(),interactionSubType:this.getInteractionSubType()}},disable(){this.disableButton(),this.updateState()},enable(){this.enableButton(),this.setResponse(!1),this.updateState()},getIsBtnDisabled(){return this.node.getIsBtnDisabled()},setIsBtnDisabled(e){this.node.setIsBtnDisabled(e)},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},handleEndAttempt(e){this.setResponse(e.response),this.updateState(),this.notifyEndAttempt()},handleUpdateState(){this.updateState()},enableButton(){this.node.enable()},disableButton(){this.node.disable()},detectInteractionSubType(e){return Ux(e)},createComponentProperties(){const e={responseIdentifier:this.responseIdentifier,title:this.title};return e.dataSteps=typeof this.dataSteps<"u"?this.dataSteps:"1",e.dataHastemplates=typeof this.dataHastemplates<"u"?this.dataHastemplates==="true":!1,e.dataHideprogress=typeof this.dataHideprogress<"u"?this.dataHideprogress==="true":!1,e.dataControllerType=typeof this.dataControllerType<"u"?this.dataControllerType:"generic",e},handleEndAttemptReady(e){this.node=e.node},notifyEndAttempt(){_.NotifyEndAttempt({identifier:this.responseIdentifier,step:this.getStep(),maximumSteps:typeof this.dataSteps<"u"?this.dataSteps*1:1,interactionSubType:this.getInteractionSubType()})},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('End Attempt Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('End Attempt Interaction State Invalid. "state" property not found.');if(!("step"in t.state))throw new O('End Attempt Interaction State Invalid. "step" property not found.');if(!("isBtnDisabled"in t.state))throw new O('End Attempt Interaction State Invalid. "isBtnDisabled" property not found.');return t}},created(){try{this.responseDeclaration=Gx.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$attrs.class)),this.priorState=this.getPriorState(this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.priorState===null?this.initializeValue():this.restoreValue(this.priorState),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"EndAttemptInteraction",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,disable:this.disable,enable:this.enable,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage()}),console.log("["+this.$options.name+":"+this.interactionSubType+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Wx={ref:"root"};function zx(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",Wx,[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.interactionTemplate),l.mergeProps({ref:"endattempt",onEndAttempt:r.handleEndAttempt,onUpdateState:r.handleUpdateState,onEndAttemptReady:r.handleEndAttemptReady},e.$attrs),null,16,["onEndAttempt","onUpdateState","onEndAttemptReady"]))],512)}const Kx=B(jx,[["render",zx]]);class Yx{constructor(t,i){return this.constants={QTI_COUNTER_NONE:"none",QTI_COUNTER_UP:"qti-counter-up",QTI_COUNTER_DOWN:"qti-counter-down",QTI_HEIGHT_LINES_3:"qti-height-lines-3",QTI_HEIGHT_LINES_6:"qti-height-lines-6",QTI_HEIGHT_LINES_15:"qti-height-lines-15",SBAC_HEIGHT_LINES_95:"sbac-height-lines-95",SBAC_PRESENTATION:"sbac"},this.classList=t,this.expectedLength=i,this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_3,this.presentation_CounterStyle=this.constants.QTI_COUNTER_NONE,this.presentation_Sbac=!1,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.SBAC_PRESENTATION:this.presentation_Sbac=!0;break;case this.constants.SBAC_HEIGHT_LINES_95:this.presentation_HeightClass=this.constants.SBAC_HEIGHT_LINES_95;break;case this.constants.QTI_COUNTER_UP:this.presentation_CounterStyle="up",this.expectedLength=this.processExpectedLength();break;case this.constants.QTI_COUNTER_DOWN:this.presentation_CounterStyle="down",this.expectedLength=this.processExpectedLength();break;case this.constants.QTI_HEIGHT_LINES_3:this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_3;break;case this.constants.QTI_HEIGHT_LINES_6:this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_6;break;case this.constants.QTI_HEIGHT_LINES_15:this.presentation_HeightClass=this.constants.QTI_HEIGHT_LINES_15;break}}processExpectedLength(){return typeof this.expectedLength>"u"||this.expectedLength===null||this.expectedLength.length==0||this.expectedLength==="0"?400:this.expectedLength*1}getCounterStyle(){return this.presentation_CounterStyle}getHeightClass(){return this.presentation_HeightClass}getExpectedLength(){return this.expectedLength}getIsSbac(){return this.presentation_Sbac}}var At="top",Jt="bottom",ei="right",$t="left",cu="auto",jr=[At,Jt,ei,$t],qn="start",Wr="end",Xx="clippingParents",om="viewport",zr="popper",Zx="reference",lm=jr.reduce(function(e,t){return e.concat([t+"-"+qn,t+"-"+Wr])},[]),cm=[].concat(jr,[cu]).reduce(function(e,t){return e.concat([t,t+"-"+qn,t+"-"+Wr])},[]),Jx="beforeRead",e_="read",t_="afterRead",i_="beforeMain",s_="main",n_="afterMain",r_="beforeWrite",a_="write",o_="afterWrite",l_=[Jx,e_,t_,i_,s_,n_,r_,a_,o_];function Ri(e){return e?(e.nodeName||"").toLowerCase():null}function Ht(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Zs(e){var t=Ht(e).Element;return e instanceof t||e instanceof Element}function ti(e){var t=Ht(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function uu(e){if(typeof ShadowRoot>"u")return!1;var t=Ht(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function c_(e){var t=e.state;Object.keys(t.elements).forEach(function(i){var s=t.styles[i]||{},n=t.attributes[i]||{},r=t.elements[i];!ti(r)||!Ri(r)||(Object.assign(r.style,s),Object.keys(n).forEach(function(a){var o=n[a];o===!1?r.removeAttribute(a):r.setAttribute(a,o===!0?"":o)}))})}function u_(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow),function(){Object.keys(t.elements).forEach(function(s){var n=t.elements[s],r=t.attributes[s]||{},a=Object.keys(t.styles.hasOwnProperty(s)?t.styles[s]:i[s]),o=a.reduce(function(u,h){return u[h]="",u},{});!ti(n)||!Ri(n)||(Object.assign(n.style,o),Object.keys(r).forEach(function(u){n.removeAttribute(u)}))})}}const um={name:"applyStyles",enabled:!0,phase:"write",fn:c_,effect:u_,requires:["computeStyles"]};function ki(e){return e.split("-")[0]}var Js=Math.max,Jo=Math.min,On=Math.round;function hu(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function hm(){return!/^((?!chrome|android).)*safari/i.test(hu())}function Bn(e,t,i){t===void 0&&(t=!1),i===void 0&&(i=!1);var s=e.getBoundingClientRect(),n=1,r=1;t&&ti(e)&&(n=e.offsetWidth>0&&On(s.width)/e.offsetWidth||1,r=e.offsetHeight>0&&On(s.height)/e.offsetHeight||1);var a=Zs(e)?Ht(e):window,o=a.visualViewport,u=!hm()&&i,h=(s.left+(u&&o?o.offsetLeft:0))/n,f=(s.top+(u&&o?o.offsetTop:0))/r,m=s.width/n,w=s.height/r;return{width:m,height:w,top:f,right:h+m,bottom:f+w,left:h,x:h,y:f}}function du(e){var t=Bn(e),i=e.offsetWidth,s=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-s)<=1&&(s=t.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:s}}function dm(e,t){var i=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(i&&uu(i)){var s=t;do{if(s&&e.isSameNode(s))return!0;s=s.parentNode||s.host}while(s)}return!1}function ts(e){return Ht(e).getComputedStyle(e)}function h_(e){return["table","td","th"].indexOf(Ri(e))>=0}function Cs(e){return((Zs(e)?e.ownerDocument:e.document)||window.document).documentElement}function el(e){return Ri(e)==="html"?e:e.assignedSlot||e.parentNode||(uu(e)?e.host:null)||Cs(e)}function fm(e){return!ti(e)||ts(e).position==="fixed"?null:e.offsetParent}function d_(e){var t=/firefox/i.test(hu()),i=/Trident/i.test(hu());if(i&&ti(e)){var s=ts(e);if(s.position==="fixed")return null}var n=el(e);for(uu(n)&&(n=n.host);ti(n)&&["html","body"].indexOf(Ri(n))<0;){var r=ts(n);if(r.transform!=="none"||r.perspective!=="none"||r.contain==="paint"||["transform","perspective"].indexOf(r.willChange)!==-1||t&&r.willChange==="filter"||t&&r.filter&&r.filter!=="none")return n;n=n.parentNode}return null}function Kr(e){for(var t=Ht(e),i=fm(e);i&&h_(i)&&ts(i).position==="static";)i=fm(i);return i&&(Ri(i)==="html"||Ri(i)==="body"&&ts(i).position==="static")?t:i||d_(e)||t}function fu(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Yr(e,t,i){return Js(e,Jo(t,i))}function f_(e,t,i){var s=Yr(e,t,i);return s>i?i:s}function pm(){return{top:0,right:0,bottom:0,left:0}}function mm(e){return Object.assign({},pm(),e)}function gm(e,t){return t.reduce(function(i,s){return i[s]=e,i},{})}var p_=function(t,i){return t=typeof t=="function"?t(Object.assign({},i.rects,{placement:i.placement})):t,mm(typeof t!="number"?t:gm(t,jr))};function m_(e){var t,i=e.state,s=e.name,n=e.options,r=i.elements.arrow,a=i.modifiersData.popperOffsets,o=ki(i.placement),u=fu(o),h=[$t,ei].indexOf(o)>=0,f=h?"height":"width";if(!(!r||!a)){var m=p_(n.padding,i),w=du(r),y=u==="y"?At:$t,b=u==="y"?Jt:ei,S=i.rects.reference[f]+i.rects.reference[u]-a[u]-i.rects.popper[f],C=a[u]-i.rects.reference[u],L=Kr(r),x=L?u==="y"?L.clientHeight||0:L.clientWidth||0:0,D=S/2-C/2,E=m[y],U=x-w[f]-m[b],Q=x/2-w[f]/2+D,ee=Yr(E,Q,U),p=u;i.modifiersData[s]=(t={},t[p]=ee,t.centerOffset=ee-Q,t)}}function g_(e){var t=e.state,i=e.options,s=i.element,n=s===void 0?"[data-popper-arrow]":s;n!=null&&(typeof n=="string"&&(n=t.elements.popper.querySelector(n),!n)||dm(t.elements.popper,n)&&(t.elements.arrow=n))}const y_={name:"arrow",enabled:!0,phase:"main",fn:m_,effect:g_,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Pn(e){return e.split("-")[1]}var w_={top:"auto",right:"auto",bottom:"auto",left:"auto"};function b_(e,t){var i=e.x,s=e.y,n=t.devicePixelRatio||1;return{x:On(i*n)/n||0,y:On(s*n)/n||0}}function ym(e){var t,i=e.popper,s=e.popperRect,n=e.placement,r=e.variation,a=e.offsets,o=e.position,u=e.gpuAcceleration,h=e.adaptive,f=e.roundOffsets,m=e.isFixed,w=a.x,y=w===void 0?0:w,b=a.y,S=b===void 0?0:b,C=typeof f=="function"?f({x:y,y:S}):{x:y,y:S};y=C.x,S=C.y;var L=a.hasOwnProperty("x"),x=a.hasOwnProperty("y"),D=$t,E=At,U=window;if(h){var Q=Kr(i),ee="clientHeight",p="clientWidth";if(Q===Ht(i)&&(Q=Cs(i),ts(Q).position!=="static"&&o==="absolute"&&(ee="scrollHeight",p="scrollWidth")),Q=Q,n===At||(n===$t||n===ei)&&r===Wr){E=Jt;var v=m&&Q===U&&U.visualViewport?U.visualViewport.height:Q[ee];S-=v-s.height,S*=u?1:-1}if(n===$t||(n===At||n===Jt)&&r===Wr){D=ei;var T=m&&Q===U&&U.visualViewport?U.visualViewport.width:Q[p];y-=T-s.width,y*=u?1:-1}}var N=Object.assign({position:o},h&&w_),V=f===!0?b_({x:y,y:S},Ht(i)):{x:y,y:S};if(y=V.x,S=V.y,u){var $;return Object.assign({},N,($={},$[E]=x?"0":"",$[D]=L?"0":"",$.transform=(U.devicePixelRatio||1)<=1?"translate("+y+"px, "+S+"px)":"translate3d("+y+"px, "+S+"px, 0)",$))}return Object.assign({},N,(t={},t[E]=x?S+"px":"",t[D]=L?y+"px":"",t.transform="",t))}function v_(e){var t=e.state,i=e.options,s=i.gpuAcceleration,n=s===void 0?!0:s,r=i.adaptive,a=r===void 0?!0:r,o=i.roundOffsets,u=o===void 0?!0:o,h={placement:ki(t.placement),variation:Pn(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:n,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,ym(Object.assign({},h,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:u})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,ym(Object.assign({},h,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const E_={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:v_,data:{}};var tl={passive:!0};function T_(e){var t=e.state,i=e.instance,s=e.options,n=s.scroll,r=n===void 0?!0:n,a=s.resize,o=a===void 0?!0:a,u=Ht(t.elements.popper),h=[].concat(t.scrollParents.reference,t.scrollParents.popper);return r&&h.forEach(function(f){f.addEventListener("scroll",i.update,tl)}),o&&u.addEventListener("resize",i.update,tl),function(){r&&h.forEach(function(f){f.removeEventListener("scroll",i.update,tl)}),o&&u.removeEventListener("resize",i.update,tl)}}const C_={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:T_,data:{}};var S_={left:"right",right:"left",bottom:"top",top:"bottom"};function il(e){return e.replace(/left|right|bottom|top/g,function(t){return S_[t]})}var x_={start:"end",end:"start"};function wm(e){return e.replace(/start|end/g,function(t){return x_[t]})}function pu(e){var t=Ht(e),i=t.pageXOffset,s=t.pageYOffset;return{scrollLeft:i,scrollTop:s}}function mu(e){return Bn(Cs(e)).left+pu(e).scrollLeft}function __(e,t){var i=Ht(e),s=Cs(e),n=i.visualViewport,r=s.clientWidth,a=s.clientHeight,o=0,u=0;if(n){r=n.width,a=n.height;var h=hm();(h||!h&&t==="fixed")&&(o=n.offsetLeft,u=n.offsetTop)}return{width:r,height:a,x:o+mu(e),y:u}}function I_(e){var t,i=Cs(e),s=pu(e),n=(t=e.ownerDocument)==null?void 0:t.body,r=Js(i.scrollWidth,i.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),a=Js(i.scrollHeight,i.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),o=-s.scrollLeft+mu(e),u=-s.scrollTop;return ts(n||i).direction==="rtl"&&(o+=Js(i.clientWidth,n?n.clientWidth:0)-r),{width:r,height:a,x:o,y:u}}function gu(e){var t=ts(e),i=t.overflow,s=t.overflowX,n=t.overflowY;return/auto|scroll|overlay|hidden/.test(i+n+s)}function bm(e){return["html","body","#document"].indexOf(Ri(e))>=0?e.ownerDocument.body:ti(e)&&gu(e)?e:bm(el(e))}function Xr(e,t){var i;t===void 0&&(t=[]);var s=bm(e),n=s===((i=e.ownerDocument)==null?void 0:i.body),r=Ht(s),a=n?[r].concat(r.visualViewport||[],gu(s)?s:[]):s,o=t.concat(a);return n?o:o.concat(Xr(el(a)))}function yu(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function V_(e,t){var i=Bn(e,!1,t==="fixed");return i.top=i.top+e.clientTop,i.left=i.left+e.clientLeft,i.bottom=i.top+e.clientHeight,i.right=i.left+e.clientWidth,i.width=e.clientWidth,i.height=e.clientHeight,i.x=i.left,i.y=i.top,i}function vm(e,t,i){return t===om?yu(__(e,i)):Zs(t)?V_(t,i):yu(I_(Cs(e)))}function A_(e){var t=Xr(el(e)),i=["absolute","fixed"].indexOf(ts(e).position)>=0,s=i&&ti(e)?Kr(e):e;return Zs(s)?t.filter(function(n){return Zs(n)&&dm(n,s)&&Ri(n)!=="body"}):[]}function $_(e,t,i,s){var n=t==="clippingParents"?A_(e):[].concat(t),r=[].concat(n,[i]),a=r[0],o=r.reduce(function(u,h){var f=vm(e,h,s);return u.top=Js(f.top,u.top),u.right=Jo(f.right,u.right),u.bottom=Jo(f.bottom,u.bottom),u.left=Js(f.left,u.left),u},vm(e,a,s));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function Em(e){var t=e.reference,i=e.element,s=e.placement,n=s?ki(s):null,r=s?Pn(s):null,a=t.x+t.width/2-i.width/2,o=t.y+t.height/2-i.height/2,u;switch(n){case At:u={x:a,y:t.y-i.height};break;case Jt:u={x:a,y:t.y+t.height};break;case ei:u={x:t.x+t.width,y:o};break;case $t:u={x:t.x-i.width,y:o};break;default:u={x:t.x,y:t.y}}var h=n?fu(n):null;if(h!=null){var f=h==="y"?"height":"width";switch(r){case qn:u[h]=u[h]-(t[f]/2-i[f]/2);break;case Wr:u[h]=u[h]+(t[f]/2-i[f]/2);break}}return u}function Zr(e,t){t===void 0&&(t={});var i=t,s=i.placement,n=s===void 0?e.placement:s,r=i.strategy,a=r===void 0?e.strategy:r,o=i.boundary,u=o===void 0?Xx:o,h=i.rootBoundary,f=h===void 0?om:h,m=i.elementContext,w=m===void 0?zr:m,y=i.altBoundary,b=y===void 0?!1:y,S=i.padding,C=S===void 0?0:S,L=mm(typeof C!="number"?C:gm(C,jr)),x=w===zr?Zx:zr,D=e.rects.popper,E=e.elements[b?x:w],U=$_(Zs(E)?E:E.contextElement||Cs(e.elements.popper),u,f,a),Q=Bn(e.elements.reference),ee=Em({reference:Q,element:D,strategy:"absolute",placement:n}),p=yu(Object.assign({},D,ee)),v=w===zr?p:Q,T={top:U.top-v.top+L.top,bottom:v.bottom-U.bottom+L.bottom,left:U.left-v.left+L.left,right:v.right-U.right+L.right},N=e.modifiersData.offset;if(w===zr&&N){var V=N[n];Object.keys(T).forEach(function($){var q=[ei,Jt].indexOf($)>=0?1:-1,A=[At,Jt].indexOf($)>=0?"y":"x";T[$]+=V[A]*q})}return T}function L_(e,t){t===void 0&&(t={});var i=t,s=i.placement,n=i.boundary,r=i.rootBoundary,a=i.padding,o=i.flipVariations,u=i.allowedAutoPlacements,h=u===void 0?cm:u,f=Pn(s),m=f?o?lm:lm.filter(function(b){return Pn(b)===f}):jr,w=m.filter(function(b){return h.indexOf(b)>=0});w.length===0&&(w=m);var y=w.reduce(function(b,S){return b[S]=Zr(e,{placement:S,boundary:n,rootBoundary:r,padding:a})[ki(S)],b},{});return Object.keys(y).sort(function(b,S){return y[b]-y[S]})}function M_(e){if(ki(e)===cu)return[];var t=il(e);return[wm(e),t,wm(t)]}function N_(e){var t=e.state,i=e.options,s=e.name;if(!t.modifiersData[s]._skip){for(var n=i.mainAxis,r=n===void 0?!0:n,a=i.altAxis,o=a===void 0?!0:a,u=i.fallbackPlacements,h=i.padding,f=i.boundary,m=i.rootBoundary,w=i.altBoundary,y=i.flipVariations,b=y===void 0?!0:y,S=i.allowedAutoPlacements,C=t.options.placement,L=ki(C),x=L===C,D=u||(x||!b?[il(C)]:M_(C)),E=[C].concat(D).reduce(function(Ee,P){return Ee.concat(ki(P)===cu?L_(t,{placement:P,boundary:f,rootBoundary:m,padding:h,flipVariations:b,allowedAutoPlacements:S}):P)},[]),U=t.rects.reference,Q=t.rects.popper,ee=new Map,p=!0,v=E[0],T=0;T<E.length;T++){var N=E[T],V=ki(N),$=Pn(N)===qn,q=[At,Jt].indexOf(V)>=0,A=q?"width":"height",M=Zr(t,{placement:N,boundary:f,rootBoundary:m,altBoundary:w,padding:h}),k=q?$?ei:$t:$?Jt:At;U[A]>Q[A]&&(k=il(k));var R=il(k),z=[];if(r&&z.push(M[V]<=0),o&&z.push(M[k]<=0,M[R]<=0),z.every(function(Ee){return Ee})){v=N,p=!1;break}ee.set(N,z)}if(p)for(var Z=b?3:1,ne=function(P){var K=E.find(function(Me){var qe=ee.get(Me);if(qe)return qe.slice(0,P).every(function(Et){return Et})});if(K)return v=K,"break"},de=Z;de>0;de--){var ge=ne(de);if(ge==="break")break}t.placement!==v&&(t.modifiersData[s]._skip=!0,t.placement=v,t.reset=!0)}}const R_={name:"flip",enabled:!0,phase:"main",fn:N_,requiresIfExists:["offset"],data:{_skip:!1}};function Tm(e,t,i){return i===void 0&&(i={x:0,y:0}),{top:e.top-t.height-i.y,right:e.right-t.width+i.x,bottom:e.bottom-t.height+i.y,left:e.left-t.width-i.x}}function Cm(e){return[At,ei,Jt,$t].some(function(t){return e[t]>=0})}function k_(e){var t=e.state,i=e.name,s=t.rects.reference,n=t.rects.popper,r=t.modifiersData.preventOverflow,a=Zr(t,{elementContext:"reference"}),o=Zr(t,{altBoundary:!0}),u=Tm(a,s),h=Tm(o,n,r),f=Cm(u),m=Cm(h);t.modifiersData[i]={referenceClippingOffsets:u,popperEscapeOffsets:h,isReferenceHidden:f,hasPopperEscaped:m},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":f,"data-popper-escaped":m})}const q_={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:k_};function O_(e,t,i){var s=ki(e),n=[$t,At].indexOf(s)>=0?-1:1,r=typeof i=="function"?i(Object.assign({},t,{placement:e})):i,a=r[0],o=r[1];return a=a||0,o=(o||0)*n,[$t,ei].indexOf(s)>=0?{x:o,y:a}:{x:a,y:o}}function B_(e){var t=e.state,i=e.options,s=e.name,n=i.offset,r=n===void 0?[0,0]:n,a=cm.reduce(function(f,m){return f[m]=O_(m,t.rects,r),f},{}),o=a[t.placement],u=o.x,h=o.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=u,t.modifiersData.popperOffsets.y+=h),t.modifiersData[s]=a}const P_={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:B_};function D_(e){var t=e.state,i=e.name;t.modifiersData[i]=Em({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Q_={name:"popperOffsets",enabled:!0,phase:"read",fn:D_,data:{}};function H_(e){return e==="x"?"y":"x"}function F_(e){var t=e.state,i=e.options,s=e.name,n=i.mainAxis,r=n===void 0?!0:n,a=i.altAxis,o=a===void 0?!1:a,u=i.boundary,h=i.rootBoundary,f=i.altBoundary,m=i.padding,w=i.tether,y=w===void 0?!0:w,b=i.tetherOffset,S=b===void 0?0:b,C=Zr(t,{boundary:u,rootBoundary:h,padding:m,altBoundary:f}),L=ki(t.placement),x=Pn(t.placement),D=!x,E=fu(L),U=H_(E),Q=t.modifiersData.popperOffsets,ee=t.rects.reference,p=t.rects.popper,v=typeof S=="function"?S(Object.assign({},t.rects,{placement:t.placement})):S,T=typeof v=="number"?{mainAxis:v,altAxis:v}:Object.assign({mainAxis:0,altAxis:0},v),N=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,V={x:0,y:0};if(Q){if(r){var $,q=E==="y"?At:$t,A=E==="y"?Jt:ei,M=E==="y"?"height":"width",k=Q[E],R=k+C[q],z=k-C[A],Z=y?-p[M]/2:0,ne=x===qn?ee[M]:p[M],de=x===qn?-p[M]:-ee[M],ge=t.elements.arrow,Ee=y&&ge?du(ge):{width:0,height:0},P=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:pm(),K=P[q],Me=P[A],qe=Yr(0,ee[M],Ee[M]),Et=D?ee[M]/2-Z-qe-K-T.mainAxis:ne-qe-K-T.mainAxis,at=D?-ee[M]/2+Z+qe+Me+T.mainAxis:de+qe+Me+T.mainAxis,He=t.elements.arrow&&Kr(t.elements.arrow),ft=He?E==="y"?He.clientTop||0:He.clientLeft||0:0,Fe=($=N==null?void 0:N[E])!=null?$:0,Oe=k+Et-Fe-ft,_e=k+at-Fe,_i=Yr(y?Jo(R,Oe):R,k,y?Js(z,_e):z);Q[E]=_i,V[E]=_i-k}if(o){var ji,ks=E==="x"?At:$t,qs=E==="x"?Jt:ei,pt=Q[U],Rt=U==="y"?"height":"width",Wi=pt+C[ks],li=pt-C[qs],mt=[At,$t].indexOf(L)!==-1,Ii=(ji=N==null?void 0:N[U])!=null?ji:0,Os=mt?Wi:pt-ee[Rt]-p[Rt]-Ii+T.altAxis,ci=mt?pt+ee[Rt]+p[Rt]-Ii-T.altAxis:li,Vi=y&&mt?f_(Os,pt,ci):Yr(y?Os:Wi,pt,y?ci:li);Q[U]=Vi,V[U]=Vi-pt}t.modifiersData[s]=V}}const U_={name:"preventOverflow",enabled:!0,phase:"main",fn:F_,requiresIfExists:["offset"]};function G_(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function j_(e){return e===Ht(e)||!ti(e)?pu(e):G_(e)}function W_(e){var t=e.getBoundingClientRect(),i=On(t.width)/e.offsetWidth||1,s=On(t.height)/e.offsetHeight||1;return i!==1||s!==1}function z_(e,t,i){i===void 0&&(i=!1);var s=ti(t),n=ti(t)&&W_(t),r=Cs(t),a=Bn(e,n,i),o={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(s||!s&&!i)&&((Ri(t)!=="body"||gu(r))&&(o=j_(t)),ti(t)?(u=Bn(t,!0),u.x+=t.clientLeft,u.y+=t.clientTop):r&&(u.x=mu(r))),{x:a.left+o.scrollLeft-u.x,y:a.top+o.scrollTop-u.y,width:a.width,height:a.height}}function K_(e){var t=new Map,i=new Set,s=[];e.forEach(function(r){t.set(r.name,r)});function n(r){i.add(r.name);var a=[].concat(r.requires||[],r.requiresIfExists||[]);a.forEach(function(o){if(!i.has(o)){var u=t.get(o);u&&n(u)}}),s.push(r)}return e.forEach(function(r){i.has(r.name)||n(r)}),s}function Y_(e){var t=K_(e);return l_.reduce(function(i,s){return i.concat(t.filter(function(n){return n.phase===s}))},[])}function X_(e){var t;return function(){return t||(t=new Promise(function(i){Promise.resolve().then(function(){t=void 0,i(e())})})),t}}function Z_(e){var t=e.reduce(function(i,s){var n=i[s.name];return i[s.name]=n?Object.assign({},n,s,{options:Object.assign({},n.options,s.options),data:Object.assign({},n.data,s.data)}):s,i},{});return Object.keys(t).map(function(i){return t[i]})}var Sm={placement:"bottom",modifiers:[],strategy:"absolute"};function xm(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return!t.some(function(s){return!(s&&typeof s.getBoundingClientRect=="function")})}function J_(e){e===void 0&&(e={});var t=e,i=t.defaultModifiers,s=i===void 0?[]:i,n=t.defaultOptions,r=n===void 0?Sm:n;return function(o,u,h){h===void 0&&(h=r);var f={placement:"bottom",orderedModifiers:[],options:Object.assign({},Sm,r),modifiersData:{},elements:{reference:o,popper:u},attributes:{},styles:{}},m=[],w=!1,y={state:f,setOptions:function(L){var x=typeof L=="function"?L(f.options):L;S(),f.options=Object.assign({},r,f.options,x),f.scrollParents={reference:Zs(o)?Xr(o):o.contextElement?Xr(o.contextElement):[],popper:Xr(u)};var D=Y_(Z_([].concat(s,f.options.modifiers)));return f.orderedModifiers=D.filter(function(E){return E.enabled}),b(),y.update()},forceUpdate:function(){if(!w){var L=f.elements,x=L.reference,D=L.popper;if(xm(x,D)){f.rects={reference:z_(x,Kr(D),f.options.strategy==="fixed"),popper:du(D)},f.reset=!1,f.placement=f.options.placement,f.orderedModifiers.forEach(function(T){return f.modifiersData[T.name]=Object.assign({},T.data)});for(var E=0;E<f.orderedModifiers.length;E++){if(f.reset===!0){f.reset=!1,E=-1;continue}var U=f.orderedModifiers[E],Q=U.fn,ee=U.options,p=ee===void 0?{}:ee,v=U.name;typeof Q=="function"&&(f=Q({state:f,options:p,name:v,instance:y})||f)}}}},update:X_(function(){return new Promise(function(C){y.forceUpdate(),C(f)})}),destroy:function(){S(),w=!0}};if(!xm(o,u))return y;y.setOptions(h).then(function(C){!w&&h.onFirstUpdate&&h.onFirstUpdate(C)});function b(){f.orderedModifiers.forEach(function(C){var L=C.name,x=C.options,D=x===void 0?{}:x,E=C.effect;if(typeof E=="function"){var U=E({state:f,name:L,instance:y,options:D}),Q=function(){};m.push(U||Q)}})}function S(){m.forEach(function(C){return C()}),m=[]}return y}}var eI=[C_,Q_,E_,um,P_,R_,U_,y_,q_],tI=J_({defaultModifiers:eI}),iI="tippy-box",_m="tippy-content",sI="tippy-backdrop",Im="tippy-arrow",Vm="tippy-svg-arrow",en={passive:!0,capture:!0},Am=function(){return document.body};function nI(e,t){return{}.hasOwnProperty.call(e,t)}function wu(e,t,i){if(Array.isArray(e)){var s=e[t];return s??(Array.isArray(i)?i[t]:i)}return e}function bu(e,t){var i={}.toString.call(e);return i.indexOf("[object")===0&&i.indexOf(t+"]")>-1}function $m(e,t){return typeof e=="function"?e.apply(void 0,t):e}function Lm(e,t){if(t===0)return e;var i;return function(s){clearTimeout(i),i=setTimeout(function(){e(s)},t)}}function rI(e,t){var i=Object.assign({},e);return t.forEach(function(s){delete i[s]}),i}function aI(e){return e.split(/\s+/).filter(Boolean)}function Dn(e){return[].concat(e)}function Mm(e,t){e.indexOf(t)===-1&&e.push(t)}function oI(e){return e.filter(function(t,i){return e.indexOf(t)===i})}function lI(e){return e.split("-")[0]}function sl(e){return[].slice.call(e)}function Nm(e){return Object.keys(e).reduce(function(t,i){return e[i]!==void 0&&(t[i]=e[i]),t},{})}function Jr(){return document.createElement("div")}function ea(e){return["Element","Fragment"].some(function(t){return bu(e,t)})}function cI(e){return bu(e,"NodeList")}function uI(e){return bu(e,"MouseEvent")}function hI(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function dI(e){return ea(e)?[e]:cI(e)?sl(e):Array.isArray(e)?e:sl(document.querySelectorAll(e))}function vu(e,t){e.forEach(function(i){i&&(i.style.transitionDuration=t+"ms")})}function Rm(e,t){e.forEach(function(i){i&&i.setAttribute("data-state",t)})}function fI(e){var t,i=Dn(e),s=i[0];return s!=null&&(t=s.ownerDocument)!=null&&t.body?s.ownerDocument:document}function pI(e,t){var i=t.clientX,s=t.clientY;return e.every(function(n){var r=n.popperRect,a=n.popperState,o=n.props,u=o.interactiveBorder,h=lI(a.placement),f=a.modifiersData.offset;if(!f)return!0;var m=h==="bottom"?f.top.y:0,w=h==="top"?f.bottom.y:0,y=h==="right"?f.left.x:0,b=h==="left"?f.right.x:0,S=r.top-s+m>u,C=s-r.bottom-w>u,L=r.left-i+y>u,x=i-r.right-b>u;return S||C||L||x})}function Eu(e,t,i){var s=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(n){e[s](n,i)})}function km(e,t){for(var i=t;i;){var s;if(e.contains(i))return!0;i=i.getRootNode==null||(s=i.getRootNode())==null?void 0:s.host}return!1}var qi={isTouch:!1},qm=0;function mI(){qi.isTouch||(qi.isTouch=!0,window.performance&&document.addEventListener("mousemove",Om))}function Om(){var e=performance.now();e-qm<20&&(qi.isTouch=!1,document.removeEventListener("mousemove",Om)),qm=e}function gI(){var e=document.activeElement;if(hI(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function yI(){document.addEventListener("touchstart",mI,en),window.addEventListener("blur",gI)}var wI=typeof window<"u"&&typeof document<"u",bI=wI?!!window.msCrypto:!1;function Qn(e){var t=e==="destroy"?"n already-":" ";return[e+"() was called on a"+t+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Bm(e){var t=/[ \t]{2,}/g,i=/^[ \t]*/gm;return e.replace(t," ").replace(i,"").trim()}function vI(e){return Bm(`
|
88
88
|
%ctippy.js
|
89
89
|
|
90
90
|
%c`+Bm(e)+`
|
@@ -164,7 +164,7 @@ ${El(this.code(t,i))}
|
|
164
164
|
</svg>`,e.redo=`<svg viewbox="0 0 18 18">
|
165
165
|
<polygon class="ql-fill ql-stroke" points="12 10 14 12 16 10 12 10"></polygon>
|
166
166
|
<path class="ql-stroke" d="M9.91,13.91A4.6,4.6,0,0,1,9,14a5,5,0,1,1,5-5"></path>
|
167
|
-
</svg>`;const t={theme:"snow",boundary:"div.qti-extended-text-interaction",modules:{toolbar:{container:[["undo","redo"],["bold","italic","underline"],["blockquote"],[{list:"ordered"},{list:"bullet"}]],handlers:{redo(){this.quill.history.redo()},undo(){this.quill.history.undo()}}},history:{delay:2e3,maxStack:100,userOnly:!1},keyboard:{bindings:{tab:{key:9,handler:function(){return!0}}}}},placeholder:this.placeholder,readOnly:!1};this.quill=new Y(this.$refs.editor,t),this.quill.root.setAttribute("spellcheck",!1),this.quill.on("text-change",this.textChangeHandler),this.updateCounter(this.getLength()),this.quill.enable(!0)}},setQuillEditorStyleProperties(){this.$refs.editor!=null&&this.$refs.editor.children!=null&&this.$refs.editor.children.length>0&&(this.$refs.editor.children[0].style=`width:${this.editorHeight};overflow-x:auto;`)},textChangeHandler(){let e=this.getText(),t=this.$refs.editor.children[0].innerHTML,i=this.getLength();if(this.expectedLength&&i>this.expectedLength){this.quill.deleteText(this.expectedLength,i);return}t==="<p><br></p>"&&(t=""),this.updateCounter(this.getLength()),this.$emit("input",{html:t,text:e})},updateCounter(e){if(this.showCounter){if(this.isCounterUp){this.counter=e;return}this.counter=this.computedExpectedLength-e}},getLength(){return this.quill.getLength()-1},getText(){return this.quill.getText()}},mounted(){this.initialize(),this.setQuillEditorStyleProperties(),this.$emit("editorReady",{node:this})},beforeUnmount(){this.$el&&this.quill.off("text-change",this.textChangeHandler),this.$el.remove(),this.quill=void 0}},qR={ref:"root",class:"quill-editor vertical-rl"},OR={key:0,"aria-hidden":"true",class:"ext-text-xhtml-vert-rl-counter"},BR={key:0};function PR(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",qR,[l.createElementVNode("div",{ref:"label",style:l.normalizeStyle(r.styleLabel),class:"ext-text-xhtml-vert-label qti-hidden"},null,4),l.createElementVNode("div",{ref:"editor",style:l.normalizeStyle(r.style)},null,4),r.showCounter?(l.openBlock(),l.createElementBlock("div",OR,[l.createTextVNode(l.toDisplayString(n.counter),1),r.isCounterUp?(l.openBlock(),l.createElementBlock("span",BR," / "+l.toDisplayString(i.expectedLength),1)):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)],512)}const DR={name:"ExtendedTextXhtmlVerticalRl",components:{EditorQuillVerticalRl:B(kR,[["render",PR]])},props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},placeholder:{required:!1,type:String,default:""},heightClass:{required:!1,type:String,default:""},counterStyle:{required:!1,type:String,default:"none"}},computed:{computedExpectedLength(){return typeof this.expectedLength<"u"?this.expectedLength:"400"},colorStyle(){return _.getItemContextPnp().getColorStyle()},editorHeight(){return this.heightClass==="qti-height-lines-15"?"25.9rem":this.heightClass==="qti-height-lines-6"?"11.5rem":"6.7rem"},labelHeight(){return this.heightClass==="qti-height-lines-15"?"29.7rem":this.heightClass==="qti-height-lines-6"?"12.3rem":"6.6rem"},maxLength(){return 1e4},disabled(){return this.isDisabled}},data(){return{response:"",content:"",state:null,editor:null,isDisabled:!1}},inheritAttrs:!1,methods:{getResponse(){return this.response},setResponse(e){if(e===null){this.response="",this.setContent("");return}this.setContent(e),this.response=e},updateResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getContent(){return this.content},setContent(e){this.content=e},computeState(e){return{text:e}},setIsDisabled(e){this.isDisabled=e},handleInput(e){e.html&&(this.updateResponse(e.html),this.setState(this.computeState(e.text)),this.$parent.$emit("extendedTextUpdate",{response:this.getResponse()}))},handleEditorReady(e){this.node=e.node,this.$parent.$emit("extendedTextReady",{node:this})}},mounted(){}},QR={ref:"root"};function HR(e,t,i,s,n,r){const a=l.resolveComponent("EditorQuillVerticalRl");return l.openBlock(),l.createElementBlock("div",QR,[l.createVNode(a,{content:n.content,placeholder:i.placeholder,editorHeight:r.editorHeight,labelHeight:r.labelHeight,counterStyle:i.counterStyle,expectedLength:r.computedExpectedLength,disabled:r.disabled,onInput:r.handleInput,onEditorReady:r.handleEditorReady},null,8,["content","placeholder","editorHeight","labelHeight","counterStyle","expectedLength","disabled","onInput","onEditorReady"])],512)}const FR=B(DR,[["render",HR]]),jt={DEFAULT:"default-plain",DEFAULT_SBAC:"sbac-plain",DEFAULT_LRN:"lrn-plain",DEFAULT_VERTICAL_RL:"vertical-rl-plain",XHTML_DEFAULT:"default-xhtml",XHTML_SBAC:"sbac-xhtml",XHTML_VERTICAL_RL:"vertical-rl-xhtml"};function UR(e,t,i){switch(e){case jt.XHTML_DEFAULT:case jt.XHTML_SBAC:return{template:'<extended-text-xhtml-default response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextXhtmlDefault:RR}};case jt.DEFAULT_LRN:return{template:'<extended-text-plain-lrn response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextPlainLrn:ZI}};case jt.DEFAULT_VERTICAL_RL:return{template:'<extended-text-plain-vertical-rl response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextPlainVerticalRl:oV}};case jt.XHTML_VERTICAL_RL:return{template:'<extended-text-xhtml-vertical-rl response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextXhtmlVerticalRl:FR}};default:return{template:'<extended-text-plain-default response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextPlainDefault:QI}}}}function GR(e,t){const i=jR(e);if(i&&t==="plain")return jt.DEFAULT_SBAC;if(i&&t==="xhtml")return jt.XHTML_DEFAULT;if(WR(e)&&t==="plain")return jt.DEFAULT_LRN;const n=zR(e);return n&&t==="plain"?jt.DEFAULT_VERTICAL_RL:n&&t==="xhtml"?jt.XHTML_VERTICAL_RL:t==="plain"?jt.DEFAULT:t==="xhtml"?jt.XHTML_DEFAULT:jt.DEFAULT}function Sa(e){return typeof e.patternMask>"u"?"":'pattern-mask="'+e.patternMask+'" '}function xa(e){return'pattern-mask-message="'+e.patternMaskMessage+'" '}function _a(e){return'placeholder="'+e.placeholder+'" '}function Ia(e){return typeof e.expectedLength>"u"?"":'expected-length="'+e.expectedLength+'" '}function Va(e){return typeof e.heightClass>"u"?"":'height-class="'+e.heightClass+'" '}function Aa(e){return typeof e.counterStyle>"u"?"none":'counter-style="'+e.counterStyle+'" '}function $a(e){let t="";for(const[i,s]of Object.entries(e))t+=`${i}="${s}" `;return t}function jR(e){return typeof e>"u"||e===null||e.length==0?!1:kh("sbac",e)}function WR(e){return typeof e>"u"||e===null||e.length==0?!1:kh("lrn",e)}function zR(e){return typeof e>"u"||e===null||e.length==0?!1:kh("qti-writing-orientation-vertical-rl",e)}function kh(e,t){const i=t.split(" ");for(let s=0;s<i.length;s++)if(i[s]===e)return!0;return!1}const La=new G,KR=new ie,YR={name:"QtiExtendedTextInteraction",props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},patternMask:{required:!1,type:String},placeholderText:{required:!1,type:String},format:{required:!1,type:String,default:"plain"},dataPatternmaskMessage:{required:!1,type:String},minStrings:{required:!1,type:String,default:"0"},maxStrings:{required:!1,type:String,default:"0"}},computed:{interactionTemplate(){return UR(this.interactionSubType,this.createComponentProperties(),this.$attrs)},placeholder(){return La.validatePlaceholderText(this.placeholderText,"")},hasPatternMask(){return typeof this.patternMask<"u"},patternMaskMessage(){return La.validatePatternmaskMessage(this.dataPatternmaskMessage,"Invalid Input")}},data(){return{response:"",state:null,baseType:"string",cardinality:"single",interactionSubType:null,isValidResponse:!1,invalidResponseMessage:"Input Required",classAttribute:"",isDisabled:!1,isQtiValid:!0,hasPrompts:!1,presentationFactory:null,node:null,priorState:null}},methods:{getResponse(){return this.response.length===0?null:this.response},setResponse(e){e===null?this.response="":this.response=e,this.node.setResponse(this.response,!0)},updateResponse(e){e===null?this.response="":this.response=e},getState(){return this.state},setState(e){this.state=e,this.node.setState(this.state,!0)},updateState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},disable(){this.toggleDisable(!0)},enable(){this.toggleDisable(!1)},toggleDisable(e){this.isDisabled=e,this.node.setIsDisabled(e)},getInvalidResponseMessage(){return this.invalidResponseMessage},initializeValue(){this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},restoreValue(e){this.setResponse(e.value),this.setState(e.state),this.updateValidity(this.computeIsValid())},getCardinality(){return this.cardinality},computeState(){return{}},computeIsValid(){const e=this.minStrings*1;if(e===0)return!0;if(this.response===null)return!1;const t=this.response.trim();return!(t.length<1||KR.computeWordCount(t)<e)},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},detectInteractionSubType(e,t){return GR(e,t)},createComponentProperties(){return{responseIdentifier:this.responseIdentifier,expectedLength:this.presentationFactory.getExpectedLength(),placeholder:this.placeholder,patternMask:this.patternMask,patternMaskMessage:this.patternMaskMessage,heightClass:this.presentationFactory.getHeightClass(),counterStyle:this.presentationFactory.getCounterStyle()}},handleExtendedTextUpdate(e){this.updateResponse(e.response),"state"in e&&this.updateState(e.state),this.evaluateValidity()},handleExtendedTextReady(e){this.node=e.node,this.priorState===null?this.initializeValue():this.restoreValue(this.priorState)},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Extended Text Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Extended Text Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=La.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class,this.format)),this.presentationFactory=new Yx(this.$.vnode.props.class,this.expectedLength),La.validateMaxMinStrings(this.maxStrings,this.minStrings),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.hasPrompts=this.getPrompts(this.$slots).length>0,this.appliedRegex=La.validatePattern("pattern-mask",this.patternMask)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.defineInteraction({identifier:this.responseIdentifier,interactionType:"ExtendedText",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage()}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},XR={ref:"root",class:"qti-extended-text-interaction"},ZR={ref:"prompt",class:"qti-prompt-wrapper"};function JR(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",XR,[l.createElementVNode("div",ZR,[l.renderSlot(e.$slots,"default")],512),(l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.interactionTemplate),{ref:"textarea",onExtendedTextUpdate:r.handleExtendedTextUpdate,onExtendedTextReady:r.handleExtendedTextReady},null,40,["onExtendedTextUpdate","onExtendedTextReady"]))],512)}const ek=B(YR,[["render",JR]]);class tk{constructor(t){return this.constants={QTI_ORIENTATION_HORIZONTAL:"qti-orientation-horizontal",QTI_ORIENTATION_VERTICAL:"qti-orientation-vertical",QTI_INPUT_WIDTH_DEFAULT:"",QTI_INPUT_WIDTH_1:"qti-input-width-1",QTI_INPUT_WIDTH_2:"qti-input-width-2",QTI_INPUT_WIDTH_3:"qti-input-width-3",QTI_INPUT_WIDTH_4:"qti-input-width-4",QTI_INPUT_WIDTH_5:"qti-input-width-5",QTI_INPUT_WIDTH_6:"qti-input-width-6",QTI_INPUT_WIDTH_10:"qti-input-width-10",QTI_INPUT_WIDTH_15:"qti-input-width-15",QTI_INPUT_WIDTH_20:"qti-input-width-20",QTI_INPUT_WIDTH_25:"qti-input-width-25",QTI_INPUT_WIDTH_30:"qti-input-width-30",QTI_INPUT_WIDTH_35:"qti-input-width-35",QTI_INPUT_WIDTH_40:"qti-input-width-40",QTI_INPUT_WIDTH_45:"qti-input-width-45",QTI_INPUT_WIDTH_50:"qti-input-width-50",QTI_INPUT_WIDTH_72:"qti-input-width-72"},this.classList=t,this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL,this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_DEFAULT,this.presentation_MaxLength=8,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_ORIENTATION_VERTICAL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_VERTICAL;break;case this.constants.QTI_ORIENTATION_HORIZONTAL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL;break;case this.constants.QTI_INPUT_WIDTH_1:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_1,this.presentation_MaxLength=1;break;case this.constants.QTI_INPUT_WIDTH_2:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_2,this.presentation_MaxLength=2;break;case this.constants.QTI_INPUT_WIDTH_3:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_3,this.presentation_MaxLength=3;break;case this.constants.QTI_INPUT_WIDTH_4:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_4,this.presentation_MaxLength=4;break;case this.constants.QTI_INPUT_WIDTH_5:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_5,this.presentation_MaxLength=5;break;case this.constants.QTI_INPUT_WIDTH_6:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_6,this.presentation_MaxLength=6;break;case this.constants.QTI_INPUT_WIDTH_10:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_10,this.presentation_MaxLength=10;break;case this.constants.QTI_INPUT_WIDTH_15:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_15,this.presentation_MaxLength=15;break;case this.constants.QTI_INPUT_WIDTH_20:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_20,this.presentation_MaxLength=20;break;case this.constants.QTI_INPUT_WIDTH_25:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_25,this.presentation_MaxLength=25;break;case this.constants.QTI_INPUT_WIDTH_30:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_30,this.presentation_MaxLength=30;break;case this.constants.QTI_INPUT_WIDTH_35:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_35,this.presentation_MaxLength=35;break;case this.constants.QTI_INPUT_WIDTH_40:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_40,this.presentation_MaxLength=40;break;case this.constants.QTI_INPUT_WIDTH_45:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_45,this.presentation_MaxLength=45;break;case this.constants.QTI_INPUT_WIDTH_50:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_50,this.presentation_MaxLength=50;break;case this.constants.QTI_INPUT_WIDTH_72:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_72,this.presentation_MaxLength=500;break}}getOrientationClass(){return this.presentation_OrientationClass}isOrientationVertical(){return this.presentation_OrientationClass==this.constants.QTI_ORIENTATION_VERTICAL}getWidthClass(){return this.presentation_WidthClass}getVerticalMaxLength(){return this.presentation_MaxLength}}const ik=new G,sk={name:"TextEntryPlainDefault",emits:["textEntryReady","textEntryUpdate"],components:{Tooltip:sa},props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},placeholder:{required:!1,type:String,default:""},patternMask:{required:!1,type:String},patternMaskMessage:{required:!1,type:String,default:"Invalid Input"},spellcheck:{required:!1,type:String,default:"false"},maxlength:{required:!1,type:String,default:"500"}},computed:{computedExpectedLength(){return typeof this.expectedLength<"u"?this.expectedLength*1:400},hasPatternMask(){return typeof this.patternMask<"u"},colorStyle(){return _.getItemContextPnp().getColorStyle()},disabled(){return this.isDisabled}},data(){return{response:"",priorResponse:"",appliedRegex:null,displayMessage:!1,isDisabled:!1}},methods:{getResponse(){return this.response},setResponse(e){if(e===null){this.response="";return}this.response=e},getState(){return this.state},setState(e){this.state=e},setIsDisabled(e){if(this.isDisabled=e,e){const t=this.getResponse();this.$refs.label.innerHTML=t===null?"":t,this.$refs.label.classList.remove("qti-hidden"),this.$refs.label.setAttribute("tabIndex",0),this.$refs.input.classList.add("qti-hidden"),(t===null||t.length===0)&&(this.$refs.label.style.paddingRight="1.1rem")}else this.$refs.label.classList.add("qti-hidden"),this.$refs.label.setAttribute("tabIndex",-1),this.$refs.input.classList.remove("qti-hidden")},handleInput(e){e.preventDefault();let t=!0;this.appliedRegex!==null?t=this.applyPatternMask(this.$refs.input.value):this.setResponse(this.$refs.input.value),t&&(this.priorResponse=this.$refs.input.value,this.$parent.$emit("textEntryUpdate",{response:this.getResponse()}))},getLength(){return this.response.length},applyPatternMask(e){return this.appliedRegex.test(e)?(this.setResponse(e),this.priorResponse=e,!0):(this.showPatternMaskMessage(),this.setResponse(this.priorResponse),!1)},showPatternMaskMessage(){this.$refs.tooltip.show(),this.hidePatternMaskMessage()},hidePatternMaskMessage(e=3e3){setTimeout(()=>{this.$refs.tooltip.hide()},e)}},created(){this.appliedRegex=ik.validatePattern("pattern-mask",this.patternMask)},mounted(){this.$parent.$emit("textEntryReady",{node:this})}},nk={ref:"root"},rk={ref:"label",class:"text-entry-default-label qti-hidden"},ak=["placeholder","disabled","spellcheck","maxlength"];function ok(e,t,i,s,n,r){const a=l.resolveComponent("tooltip");return l.openBlock(),l.createElementBlock("span",nk,[l.createElementVNode("span",rk,null,512),l.withDirectives(l.createElementVNode("input",l.mergeProps({ref:"input",class:"text-entry-default"},e.$attrs,{"onUpdate:modelValue":t[0]||(t[0]=o=>n.response=o),type:"text",placeholder:i.placeholder,disabled:r.disabled,autocapitalize:"none",spellcheck:i.spellcheck,maxlength:i.maxlength,onInput:t[1]||(t[1]=(...o)=>r.handleInput&&r.handleInput(...o))}),null,16,ak),[[l.vModelText,n.response]]),r.hasPatternMask?(l.openBlock(),l.createBlock(a,{key:0,ref:"tooltip",target:()=>e.$refs.input,message:i.patternMaskMessage,"color-style":r.colorStyle},null,8,["target","message","color-style"])):l.createCommentVNode("",!0)],512)}const ow=B(sk,[["render",ok]]),lk=new G,ck={name:"TextEntryPlainDefaultVertical",emits:["textEntryReady","textEntryUpdate"],components:{Tooltip:sa},props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},placeholder:{required:!1,type:String,default:""},patternMask:{required:!1,type:String},patternMaskMessage:{required:!1,type:String,default:"Invalid Input"},spellcheck:{required:!1,type:String,default:"false"},widthClass:{required:!1,type:String,default:""},maxlength:{required:!1,type:String,default:"8"}},computed:{computedExpectedLength(){return typeof this.expectedLength<"u"?this.expectedLength*1:400},hasPatternMask(){return typeof this.patternMask<"u"},colorStyle(){return _.getItemContextPnp().getColorStyle()},disabled(){return this.isDisabled}},data(){return{response:"",priorResponse:"",appliedRegex:null,displayMessage:!1,caretIndex:0,maxlengthMessage:"",isDisabled:!1}},inheritAttrs:!1,methods:{getResponse(){return this.response},setResponse(e,t=!1){e===null?this.response="":this.response=e,t&&this.updateContent(this.response)},getState(){return this.state},setState(e){this.state=e},setIsDisabled(e){if(this.isDisabled=e,e){const t=this.getResponse();this.$refs.label.innerHTML=t===null?"":t,this.$refs.label.classList.remove("qti-hidden"),this.$refs.label.setAttribute("tabIndex",0),this.$refs.input.classList.add("qti-hidden"),this.hidePlaceholder()}else this.$refs.label.classList.add("qti-hidden"),this.$refs.label.setAttribute("tabIndex",-1),this.$refs.input.classList.remove("qti-hidden"),this.getContent().length===0?this.showPlaceholder():this.hidePlaceholder()},getContent(){return this.$refs.input.innerText},updateContent(e){this.$refs.input.innerText=e,e.length>0?this.hidePlaceholder():this.showPlaceholder()},getCaretIndex(){return this.caretIndex},setCaretIndex(e){this.caretIndex=e},handleInput(e){e.preventDefault();let t=!0;this.setCaretIndex(this.getCaretPos(this.$refs.input)-1);const i=this.getContent();i.length>0&&this.hidePlaceholder(),this.applyLimitCheck(i)&&(this.appliedRegex!==null?t=this.applyPatternMask(i):this.setResponse(i),t&&(i.length==0&&this.showPlaceholder(),this.priorResponse=i,this.$parent.$emit("textEntryUpdate",{response:this.getResponse()})))},handlePaste(e){e.preventDefault();const t=this.getRange();if(t===null)return;const i=this.getContent(),s=t.startOffset,n=t.endOffset;let r=e.clipboardData.getData("text/plain"),a=i.substring(0,s)+r+i.substring(n),o=!0;if(a.length>0&&this.hidePlaceholder(),a.length>this.maxlength){this.showMaxlengthMessage(),this.setResponse(this.priorResponse,!0),this.setCaretPos(this.$refs.input,s);return}this.appliedRegex!==null?o=this.applyPatternMask(a):this.setResponse(a,!0),o&&(this.setCaretIndex(s+r.length),this.setCaretPos(this.$refs.input,this.getCaretIndex()),this.priorResponse=a,this.$parent.$emit("textEntryUpdate",{response:this.getResponse()}))},handleDrop(e){e.preventDefault()},handleKeydown(e){switch(this.setCaretIndex(this.getCaretPos(this.$refs.input)),e.code){case"Enter":e.preventDefault();return;case"KeyI":case"KeyB":case"KeyU":e.ctrlKey&&e.preventDefault();return}},newDownRange(e){const t=e.firstChild,i=this.getRange();if(i===null)return;const s=i.startOffset,n=i.endOffset;if(n===this.getResponse().length)return;const r=window.getSelection();r.removeAllRanges();const a=document.createRange();a.setStart(t,s),a.setEnd(t,n+1),r.addRange(a)},newUpRange(e){const t=e.firstChild,i=this.getRange();if(i===null)return;const s=i.startOffset,n=i.endOffset;if(s===0)return;const r=window.getSelection();r.removeAllRanges();const a=document.createRange();a.setStart(t,s-1),a.setEnd(t,n),r.addRange(a)},getRange(){const e=document.getSelection();return e.rangeCount===0?null:e.getRangeAt(0)},getCaretPos(e){let t=0;if(typeof window.getSelection<"u"&&window.getSelection().rangeCount!==0){const n=window.getSelection().getRangeAt(0),r=n.cloneRange();r.selectNodeContents(e),r.setEnd(n.endContainer,n.endOffset),t=r.toString().length}return t},setCaretPos(e,t){e.focus(),e.childNodes.length===1&&document.getSelection().collapse(e.childNodes[0],t)},showPlaceholder(){this.$refs.placeholder.classList.remove("text-entry-ph-hidden")},hidePlaceholder(){this.$refs.placeholder.classList.add("text-entry-ph-hidden")},handleBlur(){this.$refs.root.classList.remove("focused")},handleFocus(){this.$refs.root.classList.add("focused")},getLength(){return this.response.length},applyLimitCheck(e){return e.length>this.maxlength?(this.showMaxlengthMessage(),this.setResponse(this.priorResponse,!0),this.setCaretPos(this.$refs.input,this.getCaretIndex()),!1):!0},applyPatternMask(e){return this.appliedRegex.test(e)?(this.setResponse(e),this.priorResponse=e,!0):(this.showPatternMaskMessage(),this.setResponse(this.priorResponse,!0),this.setCaretPos(this.$refs.input,this.getCaretIndex()),!1)},showPatternMaskMessage(){this.$refs.tooltip.show(),this.hidePatternMaskMessage()},hidePatternMaskMessage(e=3e3){setTimeout(()=>{this.$refs.tooltip.hide()},e)},showMaxlengthMessage(){this.$refs.tooltipMaxlength.show(),this.hideMaxlengthMessage()},hideMaxlengthMessage(e=1e3){setTimeout(()=>{this.$refs.tooltipMaxlength.hide()},e)},computeMaxlengthMessage(){this.maxlengthMessage=`Maximum of ${this.maxlength} character`+(this.maxlength==="1"?"":"s")}},created(){this.appliedRegex=lk.validatePattern("pattern-mask",this.patternMask),this.computeMaxlengthMessage()},mounted(){this.$parent.$emit("textEntryReady",{node:this})}},uk=["spellcheck","maxlength","disabled"];function hk(e,t,i,s,n,r){const a=l.resolveComponent("tooltip");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref:"root",class:"text-entry-default-vert-wrapper"},e.$attrs),[l.createElementVNode("div",{ref:"label",class:"text-entry-default-vert-label qti-hidden",onFocus:t[0]||(t[0]=(...o)=>r.handleFocus&&r.handleFocus(...o)),onBlur:t[1]||(t[1]=(...o)=>r.handleBlur&&r.handleBlur(...o))},null,544),l.createElementVNode("div",{ref:"input",class:"text-entry-default-vert",tabindex:"0",contenteditable:"true",autocapitalize:"false",spellcheck:i.spellcheck,maxlength:i.maxlength,disabled:r.disabled,onInput:t[2]||(t[2]=(...o)=>r.handleInput&&r.handleInput(...o)),onBlur:t[3]||(t[3]=(...o)=>r.handleBlur&&r.handleBlur(...o)),onFocus:t[4]||(t[4]=(...o)=>r.handleFocus&&r.handleFocus(...o)),onKeydown:t[5]||(t[5]=(...o)=>r.handleKeydown&&r.handleKeydown(...o)),onPaste:t[6]||(t[6]=(...o)=>r.handlePaste&&r.handlePaste(...o)),onDrop:t[7]||(t[7]=(...o)=>r.handleDrop&&r.handleDrop(...o))},null,40,uk),l.createElementVNode("label",{ref:"placeholder",class:"text-entry-default-vert-ph","aria-hidden":"true"},l.toDisplayString(i.placeholder),513),r.hasPatternMask?(l.openBlock(),l.createBlock(a,{key:0,ref:"tooltip",target:()=>e.$refs.input,message:i.patternMaskMessage,"color-style":r.colorStyle},null,8,["target","message","color-style"])):l.createCommentVNode("",!0),l.createVNode(a,{ref:"tooltipMaxlength",target:()=>e.$refs.input,message:n.maxlengthMessage,"color-style":r.colorStyle},null,8,["target","message","color-style"])],16)}const dk=B(ck,[["render",hk]]),Ll={DEFAULT:"default-plain-horizontal",DEFAULT_VERTICAL:"default-plain-vertical"};function fk(e,t,i){switch(e){case Ll.DEFAULT:return{template:'<text-entry-plain-default response-identifier="'+t.responseIdentifier+'" '+Ph(t)+qh(t)+Oh(t)+Bh(t)+Dh(t)+Qh(t)+lw(t)+Hh(i)+" />",components:{TextEntryPlainDefault:ow}};case Ll.DEFAULT_VERTICAL:return{template:'<text-entry-plain-default-vertical response-identifier="'+t.responseIdentifier+'" '+Ph(t)+qh(t)+Oh(t)+Bh(t)+Dh(t)+Qh(t)+mk(t)+gk(t)+Hh(i)+" />",components:{TextEntryPlainDefaultVertical:dk}};default:return{template:'<text-entry-plain-default response-identifier="'+t.responseIdentifier+'" '+Ph(t)+qh(t)+Oh(t)+Bh(t)+Dh(t)+Qh(t)+lw(t)+Hh(i)+" />",components:{TextEntryPlainDefault:ow}}}}function pk(e){return yk(e)?Ll.DEFAULT_VERTICAL:Ll.DEFAULT}function qh(e){return typeof e.patternMask>"u"?"":'pattern-mask="'+e.patternMask+'" '}function Oh(e){return'pattern-mask-message="'+e.patternMaskMessage+'" '}function Bh(e){return'placeholder="'+e.placeholder+'" '}function Ph(e){return typeof e.expectedLength>"u"?"":'expected-length="'+e.expectedLength+'" '}function Dh(e){return typeof e.format>"u"||e.format.length==0?"":'format="'+e.format+'" '}function Qh(e){return typeof e.spellcheck>"u"?"":'spellcheck="'+e.spellcheck+'" '}function lw(e){return typeof e.maxlength>"u"?"":'maxlength="'+e.maxlength+'" '}function mk(e){return typeof e.widthClass>"u"?"":'width-class="'+e.widthClass+'" '}function gk(e){return typeof e.verticalMaxlength>"u"?"":'maxlength="'+e.verticalMaxlength+'" '}function Hh(e){let t="";for(const[i,s]of Object.entries(e))t+=`${i}="${s}" `;return t}function yk(e){return typeof e>"u"||e===null||e.length==0?!1:cw("qti-writing-orientation-vertical-rl",e)?!0:cw("qti-orientation-vertical",e)}function cw(e,t){const i=t.split(" ");for(let s=0;s<i.length;s++)if(i[s]===e)return!0;return!1}const Ml=new G,wk={name:"QtiTextEntryInteraction",props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},patternMask:{required:!1,type:String},placeholderText:{required:!1,type:String},format:{required:!1,type:String,default:""},dataPatternmaskMessage:{required:!1,type:String},dataMaxlength:{required:!1,type:String},dataSpellcheck:{required:!1,type:String}},computed:{interactionTemplate(){return fk(this.interactionSubType,this.createComponentProperties(),this.$attrs)},placeholder(){return Ml.validatePlaceholderText(this.placeholderText,"")},hasPatternMask(){return typeof this.patternMask<"u"},patternMaskMessage(){return Ml.validatePatternmaskMessage(this.dataPatternmaskMessage,"Invalid Input")},colorStyle(){return _.getItemContextPnp().getColorStyle()},computeMaxlength(){return typeof this.dataMaxlength<"u"?this.dataMaxlength:500},computeSpellcheck(){return typeof this.dataSpellcheck<"u"?this.dataSpellcheck:!1}},data(){return{response:"",state:null,baseType:"string",cardinality:"single",interactionSubType:null,isValidResponse:!1,invalidResponseMessage:"Input Required",classAttribute:"",isDisabled:!1,isQtiValid:!0,presentationFactory:null,node:null,priorState:null}},methods:{getResponse(){return this.response.length===0?null:this.response},setResponse(e){e===null?this.response="":this.response=e,this.node.setResponse(this.response,!0)},updateResponse(e){e===null?this.response="":this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},disable(){this.toggleDisable(!0)},enable(){this.toggleDisable(!1)},toggleDisable(e){this.isDisabled=e,this.node.setIsDisabled(e)},getInvalidResponseMessage(){return this.invalidResponseMessage},initializeValue(){this.setResponse(null),this.setState(this.computeState()),this.setIsValid(!1)},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(!1)},restoreValue(e){this.setResponse(e.value),this.setState(e.state),this.updateValidity(this.computeIsValid())},getCardinality(){return this.cardinality},computeState(){return{}},computeIsValid(){return!(this.response===null||this.response.length<1)},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},detectInteractionSubType(e){return pk(e)},createComponentProperties(){return{responseIdentifier:this.responseIdentifier,placeholder:this.placeholder,patternMask:this.patternMask,patternMaskMessage:this.patternMaskMessage,spellcheck:this.computeSpellcheck,maxlength:this.computeMaxlength,widthClass:this.presentationFactory.getWidthClass(),verticalMaxlength:this.presentationFactory.getVerticalMaxLength(),format:this.format}},handleTextEntryUpdate(e){this.updateResponse(e.response),this.evaluateValidity()},handleTextEntryReady(e){this.node=e.node,this.priorState===null?this.initializeValue():this.restoreValue(this.priorState)},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Text Entry Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Text Entry Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=Ml.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.presentationFactory=new tk(this.$.vnode.props.class),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.appliedRegex=Ml.validatePattern("pattern-mask",this.patternMask)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.priorState===null?this.initializeValue():this.restoreValue(this.priorState),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"TextEntry",node:this,resetValue:this.resetValue,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage()}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}};function bk(e,t,i,s,n,r){return l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.interactionTemplate),{ref:"input",class:"qti-text-entry-interaction",onTextEntryUpdate:r.handleTextEntryUpdate,onTextEntryReady:r.handleTextEntryReady},null,40,["onTextEntryUpdate","onTextEntryReady"])}const vk=B(wk,[["render",bk]]),Ek=new G,Tk={name:"QtiMatchInteraction",props:{responseIdentifier:{required:!0,type:String},minAssociations:{required:!1,type:String,default:"0"},maxAssociations:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataFirstColumnHeader:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,matchsets:[],orders:[],cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,hasPrompts:!1,matchInteractionStaticClass:"",interactionSubType:"default",headerHidden:"false",rowCentric:"false",isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.matchgroup.disable()},enable(){this.$refs.matchgroup.enable()},initializeValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.matchgroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleMatchGroupReady(e){this.matchsets=e.matchsets,this.orders=e.orders,this.initializeValue(e.response)},handleMatchGroupUpdate(e){this.setResponse(e.response),this.updateValidity(this.computeIsValid())},handleAssociationsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeState(){return this.priorState!==null?this.priorState.state:{orders:this.orders}},computeIsValid(){const e=this.getResponse(),t=this.minAssociations*1;return t===0?!0:e===null?!1:this.cardinality==="single"||e.length>=t},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxAssociations*1==0?"":"You may make a maximum of "+this.maxAssociations+" match"+(this.maxAssociations*1>1?"es":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minAssociations*1!=0&&(this.minSelectionsMessage="You must make at least "+this.minAssociations+" match"+(this.minAssociations*1>1?"es":"")+" for this question.")},detectInteractionSubType(e){return this.getMatchInteractionSubType(e)},getMatchInteractionSubType(e){let t="default";if(typeof e>"u"||e===null||e.length==0)return t;this.matchInteractionStaticClass=e;const i=e.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case"qti-match-tabular":t="matchtabular";break;case"qti-header-hidden":this.headerHidden="true";break;case"row-centric":this.rowCentric="true";break}return t},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Match Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Match Interaction State Invalid. "state" property not found.');if(!("orders"in t.state))throw new O('Match Interaction State Invalid. "orders" property not found.');return t}},created(){try{if(this.responseDeclaration=Ek.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="single"&&this.cardinality!=="multiple")throw new c('qti-match-interaction cardinality must be "single" or "multiple"');if(this.maxAssociations*1!=1&&this.cardinality!=="multiple")throw new c('qti-match-interaction response variable must have "multiple" cardinality because max-associations is '+this.maxAssociations);if(this.minAssociations*1>1&&this.cardinality==="single")throw new c('qti-match-interaction response variable must have "multiple" cardinality because min-associations is '+this.minAssociations);this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Match",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Ck={ref:"root",class:"qti-match-interaction"},Sk={ref:"prompt",class:"qti-prompt-wrapper"};function xk(e,t,i,s,n,r){const a=l.resolveComponent("MatchGroup");return l.openBlock(),l.createElementBlock("div",Ck,[l.createElementVNode("div",Sk,null,512),l.createVNode(a,l.mergeProps({ref:"matchgroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxAssociations:i.maxAssociations,minAssociations:i.minAssociations,interactionSubType:n.interactionSubType,matchInteractionStaticClass:n.matchInteractionStaticClass,headerHidden:n.headerHidden,rowCentric:n.rowCentric,dataFirstColumnHeader:i.dataFirstColumnHeader,priorState:n.priorState,onMatchGroupReady:r.handleMatchGroupReady,onMatchGroupUpdate:r.handleMatchGroupUpdate,onMatchGroupAssociationsLimit:r.handleAssociationsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxAssociations","minAssociations","interactionSubType","matchInteractionStaticClass","headerHidden","rowCentric","dataFirstColumnHeader","priorState","onMatchGroupReady","onMatchGroupUpdate","onMatchGroupAssociationsLimit"])],512)}const _k=B(Tk,[["render",xk]]),Ik=new G,Vk={name:"QtiGapMatchInteraction",props:{responseIdentifier:{required:!0,type:String},minAssociations:{required:!1,type:String,default:"0"},maxAssociations:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataChoicesContainerWidth:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,choices:[],order:[],cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,hasPrompts:!1,gapMatchInteractionStaticClass:"",interactionSubType:"default",isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.gapmatchgroup.disable()},enable(){this.$refs.gapmatchgroup.enable()},initializeValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.matchgroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleGapMatchGroupReady(e){this.choices=e.choices,this.order=e.order,this.initializeValue(e.response)},handleGapMatchGroupUpdate(e){this.setResponse(e.response),this.updateValidity(this.computeIsValid())},handleAssociationsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeState(){return this.priorState!==null?this.priorState.state:{order:this.order}},computeIsValid(){const e=this.getResponse(),t=this.minAssociations*1;return t===0?!0:e===null?!1:this.cardinality==="single"||e.length>=t},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxAssociations*1==0?"":"You may make a maximum of "+this.maxAssociations+" match"+(this.maxAssociations*1>1?"es":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minAssociations*1!=0&&(this.minSelectionsMessage="You must make at least "+this.minAssociations+" match"+(this.minAssociations*1>1?"es":"")+" for this question.")},detectInteractionSubType(e){return this.computeInteractionSubType(e)},computeInteractionSubType(e){let t="default";return typeof e>"u"||e===null||e.length==0||(this.gapMatchInteractionStaticClass=e),t},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Gap Match Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Gap Match Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Gap Match Interaction State Invalid. "order" property not found.');return t}},created(){try{if(this.responseDeclaration=Ik.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="single"&&this.cardinality!=="multiple")throw new c('qti-gap-match-interaction cardinality must be "single" or "multiple"');if(this.maxAssociations*1!=1&&this.cardinality!=="multiple")throw new c('qti-gap-match-interaction response variable must have "multiple" cardinality because max-associations is '+this.maxAssociations);if(this.minAssociations*1>1&&this.cardinality==="single")throw new c('qti-gap-match-interaction response variable must have "multiple" cardinality because min-associations is '+this.minAssociations);this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"GapMatch",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Ak={ref:"root",class:"qti-gap-match-interaction"},$k={ref:"prompt",class:"qti-prompt-wrapper"};function Lk(e,t,i,s,n,r){const a=l.resolveComponent("GapMatchGroup");return l.openBlock(),l.createElementBlock("div",Ak,[l.createElementVNode("div",$k,null,512),l.createVNode(a,l.mergeProps({ref:"gapmatchgroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxAssociations:i.maxAssociations,minAssociations:i.minAssociations,interactionSubType:n.interactionSubType,gapMatchInteractionStaticClass:n.gapMatchInteractionStaticClass,dataChoicesContainerWidth:i.dataChoicesContainerWidth,priorState:n.priorState,onGapMatchGroupReady:r.handleGapMatchGroupReady,onGapMatchGroupUpdate:r.handleGapMatchGroupUpdate,onGapMatchGroupAssociationsLimit:r.handleAssociationsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxAssociations","minAssociations","interactionSubType","gapMatchInteractionStaticClass","dataChoicesContainerWidth","priorState","onGapMatchGroupReady","onGapMatchGroupUpdate","onGapMatchGroupAssociationsLimit"])],512)}const Mk=B(Vk,[["render",Lk]]),Nk=new G,Rk={name:"QtiGraphicGapMatchInteraction",props:{responseIdentifier:{required:!0,type:String},minAssociations:{required:!1,type:String,default:"0"},maxAssociations:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataChoicesContainerWidth:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,choices:[],order:[],cardinality:"multiple",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,hasPrompts:!1,interactionStaticClass:"",interactionSubType:"default",isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.ggmgroup.disable()},enable(){this.$refs.ggmgroup.enable()},initializeValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.matchgroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleGraphicGapMatchGroupReady(e){this.choices=e.choices,this.order=e.order,this.initializeValue(e.response)},handleGraphicGapMatchGroupUpdate(e){this.setResponse(e.response),this.updateValidity(this.computeIsValid())},handleAssociationsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeState(){return this.priorState!==null?this.priorState.state:{order:this.order}},computeIsValid(){const e=this.getResponse(),t=this.minAssociations*1;return t===0?!0:e===null?!1:this.cardinality==="single"||e.length>=t},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxAssociations*1==0?"":"You may make a maximum of "+this.maxAssociations+" match"+(this.maxAssociations*1>1?"es":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minAssociations*1!=0&&(this.minSelectionsMessage="You must make at least "+this.minAssociations+" match"+(this.minAssociations*1>1?"es":"")+" for this question.")},detectInteractionSubType(e){return this.computeInteractionSubType(e)},computeInteractionSubType(e){let t="default";return typeof e>"u"||e===null||e.length==0||(this.interactionStaticClass=e),t},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Gap Match Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Gap Match Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Gap Match Interaction State Invalid. "order" property not found.');return t}},created(){try{if(this.responseDeclaration=Nk.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="multiple")throw new c('qti-graphic-gap-match-interaction cardinality must be "multiple"');this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"GraphicGapMatch",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},kk={ref:"root",class:"qti-graphic-gap-match-interaction"},qk={ref:"prompt",class:"qti-prompt-wrapper"};function Ok(e,t,i,s,n,r){const a=l.resolveComponent("GraphicGapMatchGroup");return l.openBlock(),l.createElementBlock("div",kk,[l.createElementVNode("div",qk,null,512),l.createVNode(a,l.mergeProps({ref:"ggmgroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxAssociations:i.maxAssociations,minAssociations:i.minAssociations,interactionSubType:n.interactionSubType,interactionStaticClass:n.interactionStaticClass,dataChoicesContainerWidth:i.dataChoicesContainerWidth,priorState:n.priorState,onGgmGroupReady:r.handleGraphicGapMatchGroupReady,onGgmGroupUpdate:r.handleGraphicGapMatchGroupUpdate,onGgmGroupAssociationsLimit:r.handleAssociationsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxAssociations","minAssociations","interactionSubType","interactionStaticClass","dataChoicesContainerWidth","priorState","onGgmGroupReady","onGgmGroupUpdate","onGgmGroupAssociationsLimit"])],512)}const Bk=B(Rk,[["render",Ok]]),Pk={},Dk={ref:"root",class:"qti3-player-media-group"};function Qk(e,t){return l.openBlock(),l.createElementBlock("div",Dk,[l.renderSlot(e.$slots,"default")],512)}const uw=B(Pk,[["render",Qk]]),hw=new G,Hk={name:"QtiMediaInteraction",components:[uw],props:{responseIdentifier:{required:!0,type:String},autostart:{required:!1,type:String,default:"false"},minPlays:{required:!1,type:String,default:"0"},maxPlays:{required:!1,type:String,default:"0"},loop:{required:!1,type:String,default:"false"},coords:{required:!1,type:String},dataMaxPlaysMessage:{required:!1,type:String},dataMinPlaysMessage:{required:!1,type:String}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minPlaysMessage:"",maxPlaysMessage:"",responseDeclaration:null,mediaType:"media",isAutostart:!1,isLoop:!1,isDisabled:!1,isQtiValid:!0,hasPrompts:!1,node:null,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},incrementPlays(){let e=this.getResponse();this.setResponse(e===null?1:e+1)},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.node!==null&&this.node.disable()},enable(){this.node!==null&&this.node.enable()},getInvalidResponseMessage(){return this.computeMinPlaysMessage(),this.minPlaysMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.priorState=null,this.setResponse(null),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},restoreValue(e){e!==null&&(this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid()),this.evaluateMaxPlays())},getCardinality(){return this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleMediaMounted(e){this.node=e.node,this.mediaType=e.mediaType,e.mediaType==="audio"&&this.node.setAudioSubType("audioprogress"),this.evaluateMaxPlays()},handleMediaLoaded(e){this.node=e.node,this.evaluateMaxPlays(),this.evaluateAutostart()},handleMediaEnded(){this.incrementPlays(),this.evaluateValidity(),this.evaluateMaxPlays(),this.evaluateLoop()},computeState(){return{}},computeIsValid(){const e=this.minPlays*1;if(e===0)return!0;const t=this.getResponse();return t===null?!1:t>=e},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},evaluateMaxPlays(){this.checkMaxPlaysLimit()?this.disable():this.enable()},evaluateLoop(){this.isLoop&&(this.checkMaxPlaysLimit()||this.isDisabled||this.playMedia())},evaluateAutostart(){this.isAutostart&&(this.checkMaxPlaysLimit()||this.isDisabled||(console.log(`[${this.$options.name}][Identifier=${this.responseIdentifier}][AutoStart]`),this.playMedia()))},playMedia(){if(this.node!=null){if(this.mediaType==="audio")return this.node.playAudio();this.node.playVideo()}},checkMaxPlaysLimit(){if(this.maxPlays*1===0)return!1;const e=this.getResponse();return e!==null&&e==this.maxPlays*1},computeMaxPlaysMessage(){if(typeof this.dataMaxPlaysMessage<"u"){this.maxPlaysMessage=this.dataMaxPlaysMessage;return}const e=this.maxPlays*1;this.maxPlaysMessage=e===0?"":`You are permitted a maximum of ${this.maxPlays} play${e>1?"s":""} for this ${this.mediaType}.`},computeMinPlaysMessage(){if(typeof this.dataMinPlaysMessage<"u"){this.minPlaysMessage=this.dataMinPlaysMessage;return}const e=this.minPlays*1;this.minPlaysMessage=e===0?"":`You must play this ${this.mediaType} to the end at least ${this.minPlays} time${e>1?"s":""}.`},validateChildren(){},processChildren(){this.processMedia(),this.setIsValid(this.computeIsValid()),this.priorState!==null&&this.restoreValue(this.priorState.value)},processMedia(){let e=this.$refs.mediagroup.$el.getElementsByTagName("object");if(e.length!==0)throw new c("Unsupported Media Interaction element. The <object> elemnt is deprecated. Use <video> or <audio> instead.");if(e=this.$refs.mediagroup.$el.getElementsByTagName("video"),e.length===0&&(e=this.$refs.mediagroup.$el.getElementsByTagName("audio")),e.length!==1)throw new c("Media Interaction must have exactly one <video> or <audio> node.")},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Media Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Media Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=hw.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),hw.validateMaxMinPlays(this.maxPlays,this.minPlays),this.hasPrompts=this.getPrompts(this.$slots).length>0,this.isAutostart=this.autostart==="true",this.isLoop=this.loop==="true",this.computeMaxPlaysMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Media",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxPlaysMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Fk={ref:"root",class:"qti-media-interaction"},Uk={ref:"prompt",class:"qti-prompt-wrapper"};function Gk(e,t,i,s,n,r){const a=l.resolveComponent("MediaGroup");return l.openBlock(),l.createElementBlock("div",Fk,[l.createElementVNode("div",Uk,null,512),l.createVNode(a,{ref:"mediagroup",onMediaMounted:r.handleMediaMounted,onMediaLoaded:r.handleMediaLoaded,onMediaEnded:r.handleMediaEnded},{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},8,["onMediaMounted","onMediaLoaded","onMediaEnded"])],512)}const jk=B(Hk,[["render",Gk]]),Fh=new G,Wk={name:"QtiOrderInteraction",props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String},maxChoices:{required:!1,type:String},shuffle:{required:!1,type:String,default:"false"},orientation:{required:!1,type:String,default:"horizontal"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataChoicesContainerWidth:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"ordered",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,interactionSubType:"default",choices:[],isShuffle:!1,hasPrompts:!1,minChoicesValue:null,maxChoicesValue:null,isMinChoicesSpecified:!1,isMaxChoicesSpecified:!1,isQtiValid:!0,priorState:null,originalOrder:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.ordergroup.disable()},enable(){this.$refs.ordergroup.enable()},initializeValue(e){this.setResponse(this.computeResponse(e)),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},initializeOriginalOrder(){if(this.originalOrder!==null)return;let e=[];this.choices.forEach(t=>{e.push(t.identifier)}),this.originalOrder=e},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.ordergroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"ordered",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){this.hasPrompts&&this.$refs.prompt.appendChild(this.$refs.ordergroup.getPromptElement())},handleOrderGroupReady(e){this.choices=e.choices,this.isMinChoicesSpecified||(this.minChoicesValue=this.choices.length),this.originalOrder===null&&this.initializeOriginalOrder(),this.initializeValue(e.response)},handleOrderGroupUpdate(e){this.setResponse(this.computeResponse(e.response)),this.setState({order:e.response,oorder:this.originalOrder}),this.updateValidity(this.computeIsValid())},handleSelectionsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeResponse(e){let t=[];typeof e>"u"?this.choices.forEach(s=>{t.push(s.identifier)}):t=e;let i=0;switch(this.interactionSubType){case"default":for(let s=0;s<t.length;s++)t[s]!==this.originalOrder[s]&&(i+=1);break;case"ordermatch":for(let s=0;s<t.length;s++)t[s]!==null&&(i+=1);break}return i===0?null:t},computeOrder(){const e=[];return this.choices.forEach(t=>{e.push(t.identifier)}),e},computeState(){return this.priorState!==null?this.priorState.state:{order:this.computeOrder(),oorder:this.originalOrder}},computeIsValid(){const e=this.getResponse(),t=this.minChoicesValue;if(e===null||e.length!==this.originalOrder.length)return!1;let i=0;switch(this.interactionSubType){case"default":for(let s=0;s<e.length;s++)e[s]!==this.originalOrder[s]&&(i+=1);return this.isMinChoicesSpecified?i>=t:i===t;case"ordermatch":for(let s=0;s<e.length;s++)e[s]!==null&&(i+=1);return this.isMinChoicesSpecified?i>=t:i===e.length}return!1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoicesValue===null?"":"You may set an order for a maximum of "+this.maxChoicesValue+" choice"+(this.maxChoicesValue>1?"s":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.isMinChoicesSpecified?this.minSelectionsMessage="You must set the order for at least "+this.minChoicesValue+" choice"+(this.minChoicesValue>1?"s":"")+" for this question.":this.minSelectionsMessage="You must set the order for all choices for this question."},detectInteractionSubType(e){return this.getOrderInteractionSubType(e)},getOrderInteractionSubType(e){if(typeof e>"u"||e===null||e.length==0)return"default";const t=e.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case"qti-choices-top":case"qti-choices-bottom":case"qti-choices-left":case"qti-choices-right":return"ordermatch"}return"default"},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Order Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Order Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Order Interaction State Invalid. "order" property not found.');if(!("oorder"in t.state))throw new O('Order Interaction State Invalid. "oorder" property not found.');return this.originalOrder=t.state.oorder,t}},created(){try{if(this.responseDeclaration=Fh.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="ordered")throw new c('qti-order-interaction cardinality must be "ordered"');if(this.isShuffle=this.shuffle==="true",this.hasPrompts=this.getPrompts(this.$slots).length>0,typeof this.minChoices<"u"&&(this.isMinChoicesSpecified=!0),this.minChoicesValue=Fh.validateIntegerAttribute("min-choices",this.minChoices,!1,null),this.minChoicesValue===0)throw new c('qti-order-interaction "min-choices", when specified, must not be 0');if(this.isMinChoicesSpecified?(typeof this.maxChoices<"u"&&(this.isMaxChoicesSpecified=!0),this.maxChoicesValue=Fh.validateIntegerAttribute("max-choices",this.maxChoices,!1,null)):this.maxChoicesValue=null,this.isMinChoicesSpecified&&this.isMaxChoicesSpecified&&this.minChoicesValue>this.maxChoicesValue)throw new c('qti-order-interaction "min-choices" must not be greater than "max-choices"');this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Order",node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},zk={ref:"root",class:"qti-order-interaction"},Kk={ref:"prompt",class:"qti-prompt-wrapper"};function Yk(e,t,i,s,n,r){const a=l.resolveComponent("OrderGroup");return l.openBlock(),l.createElementBlock("div",zk,[l.createElementVNode("div",Kk,null,512),l.createVNode(a,l.mergeProps({ref:"ordergroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,orientation:i.orientation,maxChoices:n.maxChoicesValue,minChoices:n.minChoicesValue,interactionSubType:n.interactionSubType,dataChoicesContainerWidth:i.dataChoicesContainerWidth,priorState:n.priorState,onOrderGroupReady:r.handleOrderGroupReady,onOrderGroupUpdate:r.handleOrderGroupUpdate,onOrderGroupSelectionsLimit:r.handleSelectionsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","orientation","maxChoices","minChoices","interactionSubType","dataChoicesContainerWidth","priorState","onOrderGroupReady","onOrderGroupUpdate","onOrderGroupSelectionsLimit"])],512)}const Xk=B(Wk,[["render",Yk]]);class Zk{constructor(){this.nodes=[]}find(t,i){if(Array.isArray(t))return t.forEach(s=>{var n;if(s.component!==null&&((n=s.component.type)==null?void 0:n.name)===i){this.nodes.push(s.component.proxy);return}Array.isArray(s==null?void 0:s.children)&&this.find(s.children,i)}),this.nodes}findNodes(t,{within:i}){return this.find(i,t)}}class Jk{constructor(t){return this.constants={QTI_UNSELECTED_HIDDEN:"qti-unselected-hidden"},this.classList=t,this.presentation_UnselectedHidden=!1,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_UNSELECTED_HIDDEN:this.presentation_UnselectedHidden=!0;break}}getUnselectedHidden(){return this.presentation_UnselectedHidden}}const dw=new G,e2=new Zk,t2={name:"QtiHottextInteraction",props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String}},inheritAttrs:!0,data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,choices:[],currentChoice:null,isRadio:!0,isDisabled:!1,isQtiValid:!0,hasPrompts:!1,presentationFactory:null,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.toggleDisableChoices(!0)},enable(){this.toggleDisableChoices(!1)},toggleDisableChoices(e){this.isDisabled=e,this.choices.forEach(t=>{t.setIsDisabled(e)})},getInvalidResponseMessage(){return this.minSelectionsMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.choices.forEach(e=>{e.setChecked(!1)}),this.currentChoice=null,this.priorState=null},restoreValue(e){e!==null&&(this.isRadio?this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:e,checked:"true"}}),!0):e.forEach(t=>{this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:t,checked:"true"}}),!0)},this),this.setResponse(this.computeResponse()),this.setState(this.computeState()),this.updateValidity(this.computeIsValid()))},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality!=="multiple"?"single":"multiple":"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleSetChecked(e,t=!1){const i=e.detail;this.choices.forEach(s=>{this.isRadio&&s.setChecked(!1),s.identifier===i.identifier&&(this.currentChoice=s)}),i.checked==="true"?this.checkMaxChoicesLimit()?this.currentChoice.setChecked(!1):this.currentChoice.setChecked(!0):this.currentChoice.setChecked(!1),t||(this.setResponse(this.computeResponse()),this.currentChoice.setFocus(),this.evaluateValidity())},computeResponse(){let e=this.isRadio?null:[];return this.choices.forEach(t=>{t.isChecked()&&(this.isRadio?e=t.identifier:e.push(t.identifier))}),this.isRadio?e:e.length===0?null:e},computeState(){return{}},computeIsValid(){return this.minChoices*1===0?!0:this.response===null?!1:this.cardinality==="single"||this.cardinality==="multiple"&&this.response.length>=this.minChoices*1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},checkMaxChoicesLimit(){if(this.isRadio||this.maxChoices==0)return!1;const e=this.getResponse();return e!==null&&e.length==this.maxChoices?(_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage),!0):!1},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoices==0?"":"You are permitted a maximum of "+this.maxChoices+" selection"+(this.maxChoices>1?"s":"")+" for this question.<br/><br/>Please unselect one of your selections before making another selection."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minSelectionsMessage=this.minChoices==0?"":"You must make at least "+this.minChoices+" selection"+(this.minChoices>1?"s":"")+" for this question."},validateChildren(){},processChildren(){const e=this.$.subTree===null?null:this.$.subTree.children[1].children;this.choices=e2.findNodes("QtiHottext",{within:e}),this.processGroupUI(),this.priorState!==null&&this.restoreValue(this.priorState.value)},processGroupUI(){this.setUnselectedHidden(),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},setUnselectedHidden(){this.presentationFactory.getUnselectedHidden()&&this.$refs.hottextgroup.setAttribute("class","qti3-player-hottext-group qti-unselected-hidden")},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Hottext Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Hottext Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=dw.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.presentationFactory=new Jk(this.$.vnode.props.class),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),dw.validateMaxMinChoices(this.maxChoices,this.minChoices),this.isRadio=this.getCardinality()!=="multiple",this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Hottext",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},i2={ref:"root",class:"qti-hottext-interaction"},s2={ref:"prompt",class:"qti-prompt-wrapper"};function n2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",i2,[l.createElementVNode("div",s2,null,512),l.createElementVNode("div",{ref:"hottextgroup","on:setChecked":t[0]||(t[0]=(...a)=>r.handleSetChecked&&r.handleSetChecked(...a)),class:"qti3-player-hottext-group"},[l.renderSlot(e.$slots,"default")],544)],512)}const r2=B(t2,[["render",n2]]);class a2{constructor(t){return this.constants={QTI_SELECTIONS_LIGHT:"qti-selections-light",QTI_SELECTIONS_DARK:"qti-selections-dark",QTI_UNSELECTED_HIDDEN:"qti-unselected-hidden",THEME_LIGHT:{selectedOpacity:"1.0",unselectedOpacity:"0.5",fillColor:"orange",fillOpacity:"0",strokeColor:"orange",strokeWidth:2,selectedStrokeWidth:4},THEME_DARK:{selectedOpacity:"1.0",unselectedOpacity:"0.5",fillColor:"#0088CC",fillOpacity:"0",strokeColor:"blue",strokeWidth:2,selectedStrokeWidth:4},THEME_HIDDEN_LIGHT:{selectedOpacity:"1.0",unselectedOpacity:"0",fillColor:"orange",fillOpacity:"0",strokeColor:"orange",strokeWidth:2,selectedStrokeWidth:4},THEME_HIDDEN_DARK:{selectedOpacity:"1.0",unselectedOpacity:"0",fillColor:"blue",fillOpacity:"0",strokeColor:"blue",strokeWidth:2,selectedStrokeWidth:4}},this.classList=t,this.presentation_Theme=this.constants.QTI_SELECTIONS_DARK,this.theme=this.constants.THEME_DARK,this.presentation_UnselectedHidden=!1,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_SELECTIONS_DARK:this.presentation_Theme=this.constants.QTI_SELECTIONS_DARK;break;case this.constants.QTI_SELECTIONS_LIGHT:this.presentation_Theme=this.constants.QTI_SELECTIONS_LIGHT;break;case this.constants.QTI_UNSELECTED_HIDDEN:this.presentation_UnselectedHidden=!0;break}switch(this.presentation_Theme){case this.constants.QTI_SELECTIONS_DARK:this.presentation_UnselectedHidden&&(this.theme=this.constants.THEME_HIDDEN_DARK);break;case this.constants.QTI_SELECTIONS_LIGHT:this.presentation_UnselectedHidden?this.theme=this.constants.THEME_HIDDEN_LIGHT:this.theme=this.constants.THEME_LIGHT;break}}getThemeColors(){return this.theme}}const fw=new G,o2={name:"QtiHotspotInteraction",props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,choices:[],currentChoice:null,shapeElements:[],currentElement:null,backgroundImage:null,backgroundImageWidth:"0",backgroundImageHeight:"0",isRadio:!0,isDisabled:!1,isQtiValid:!0,hasPrompts:!1,presentationFactory:null,shapeColorProperties:null,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.toggleDisableChoices(!0)},enable(){this.toggleDisableChoices(!1)},toggleDisableChoices(e){this.isDisabled=e},getInvalidResponseMessage(){return this.minSelectionsMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier);for(let e=0;e<this.choices.length;e++)this.setChoiceUnChecked(this.choices[e],this.shapeElements[e]);this.currentChoice=null,this.currentElement=null,this.priorState=null,this.setResponse(null),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},restoreValue(e){e!==null&&(this.isRadio?this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:e,checked:"true"}}),!0):e.forEach(t=>{this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:t,checked:"true"}}),!0)},this),this.setResponse(this.computeResponse()),this.setState(this.computeState()),this.updateValidity(this.computeIsValid()))},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality!=="multiple"?"single":"multiple":"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleSetChecked(e,t=!1){const i=e.detail;for(let s=0;s<this.choices.length;s++)this.isRadio&&this.setChoiceUnChecked(this.choices[s],this.shapeElements[s]),this.choices[s].identifier===i.identifier&&(this.currentChoice=this.choices[s],this.currentElement=this.shapeElements[s]);i.checked==="true"?this.checkMaxChoicesLimit()?this.setChoiceUnChecked(this.currentChoice,this.currentElement):this.setChoiceChecked(this.currentChoice,this.currentElement):this.setChoiceUnChecked(this.currentChoice,this.currentElement),t||(this.setResponse(this.computeResponse()),this.currentElement.focus(),this.evaluateValidity())},computeResponse(){let e=this.isRadio?null:[];return this.choices.forEach(t=>{t.isChecked()&&(this.isRadio?e=t.identifier:e.push(t.identifier))}),this.isRadio?e:e.length===0?null:e},computeState(){return{}},computeIsValid(){return this.minChoices*1===0?!0:this.response===null?!1:this.cardinality==="single"||this.cardinality==="multiple"&&this.response.length>=this.minChoices*1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},checkMaxChoicesLimit(){if(this.isRadio||this.maxChoices==0)return!1;const e=this.getResponse();return e!==null&&e.length==this.maxChoices?(_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage),!0):!1},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoices==0?"":"You are permitted a maximum of "+this.maxChoices+" selection"+(this.maxChoices>1?"s":"")+" for this question.<br/><br/>Please unselect one of your selections before making another selection."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minSelectionsMessage=this.minChoices==0?"":"You must make at least "+this.minChoices+" selection"+(this.minChoices>1?"s":"")+" for this question."},validateChildren(){},processChildren(){this.processBackgroundImage(),this.$.subTree.children[1].children[0].dynamicChildren.forEach(t=>{if(t.component!==null&&t.type.name==="QtiHotspotChoice"){const i=t.component.proxy;this.choices.push(i);const s=i.getShapeElement();s!==null&&(this.addHotspotListeners(s),this.shapeElements.push(s),this.$refs.overlay.appendChild(s))}}),this.processGroupUI(),this.priorState!==null&&this.restoreValue(this.priorState.value)},addHotspotListeners(e){e.addEventListener("click",this.handleHotspotClick),e.addEventListener("keydown",this.handleHotspotKeydown)},removeHotspotListeners(e){e.removeEventListener("click",this.handleHotspotClick),e.removeEventListener("keydown",this.handleHotspotKeydown)},handleHotspotClick(e){if(e.preventDefault(),this.isDisabled)return;const t=e.target.getAttribute("data-identifier"),i=this.findChoiceByIdentifier(t);this.isRadio?this.triggerChecked(e.target.getAttribute("data-identifier"),"true"):(this.toggleChecked(i,e.target),this.triggerChecked(t,i.getChecked()))},handleHotspotKeydown(e){const t=e.target.getAttribute("data-identifier"),i=this.findChoiceByIdentifier(t);switch(e.code){case"Space":case"Enter":if(e.stopPropagation(),e.preventDefault(),this.isDisabled||i==null)return;this.toggleChecked(i,e.target),this.triggerChecked(t,i.getChecked());break}},findChoiceByIdentifier(e){for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e)return this.choices[t];return null},toggleChecked(e,t){if(e.toggleChecked(),t===null)return;const i=t.getAttribute("aria-checked");t.setAttribute("aria-checked",i==="true"?"false":"true")},triggerChecked(e,t){const i=new CustomEvent("setChecked",{bubbles:!0,cancelable:!0,detail:{identifier:e,checked:t}});this.$refs.hotspotgroup.dispatchEvent(i)},setChoiceUnChecked(e,t){e.setChecked(!1),t.setAttribute("aria-checked","false");const i=e.getShapeColorProperties();t.setAttribute("fill",`${i.fillColor}`),t.setAttribute("fill-opacity",`${i.fillOpacity}`),t.setAttribute("opacity",`${i.unselectedOpacity}`),t.setAttribute("stroke",`${i.strokeColor}`),t.setAttribute("stroke-width",`${i.strokeWidth}`)},setChoiceChecked(e,t){e.setChecked(!0),t.setAttribute("aria-checked","true");const i=e.getShapeColorProperties();t.setAttribute("fill",`${i.fillColor}`),t.setAttribute("fill-opacity",`${i.fillOpacity}`),t.setAttribute("opacity",`${i.selectedOpacity}`),t.setAttribute("stroke",`${i.strokeColor}`),t.setAttribute("stroke-width",`${i.selectedStrokeWidth}`)},processGroupUI(){this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},processBackgroundImage(){let e=this.$refs.hotspotgroup.getElementsByTagName("object");if(e.length===0&&(e=this.$refs.hotspotgroup.getElementsByTagName("img")),e.length===0&&(e=this.$refs.hotspotgroup.getElementsByTagName("picture")),e.length!==1)throw new c("Hotspot interaction must have exactly one <img>, <object>, or <picture> node");this.backgroundImage=e[0],this.backgroundImage.setAttribute("draggable","false"),this.backgroundImageWidth=`${e[0].clientWidth}`,this.backgroundImageHeight=`${e[0].clientHeight}`,this.$refs.overlay.setAttribute("viewBox",`0 0 ${this.backgroundImageWidth} ${this.backgroundImageHeight}`),this.$refs.overlay.setAttribute("tabindex","-1"),this.$refs.overlay.setAttribute("role","application"),this.$refs.overlay.setAttribute("focusable","false"),this.$refs.hotspotgroup.setAttribute("style",`width:${e[0].clientWidth};height:${e[0].clientHeight}`)},getShapeColorProperties(){return this.shapeColorProperties},setShapeColorProperties(e){this.shapeColorProperties=e},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Hotspot Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Hotspot Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=fw.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.presentationFactory=new a2(this.$.vnode.props.class),this.setShapeColorProperties(this.presentationFactory.getThemeColors()),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),fw.validateMaxMinChoices(this.maxChoices,this.minChoices),this.isRadio=this.getCardinality()!=="multiple",this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Hotspot",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}},beforeUnmount(){this.shapeElements.forEach(e=>{this.removeHotspotListeners(e)})}},l2={ref:"root",class:"qti-hotspot-interaction"},c2={ref:"prompt",class:"qti-prompt-wrapper"},u2={ref:"overlay",class:"qti3-player-hotspot-overlay"};function h2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",l2,[l.createElementVNode("div",c2,null,512),l.createElementVNode("div",{ref:"hotspotgroup","on:setChecked":t[0]||(t[0]=(...a)=>r.handleSetChecked&&r.handleSetChecked(...a)),class:"qti3-player-hotspot-group"},[l.renderSlot(e.$slots,"default"),(l.openBlock(),l.createElementBlock("svg",u2,null,512))],544)],512)}const d2=B(o2,[["render",h2]]);class f2{constructor(t,i,s){J(this,"moduleAttribute","");J(this,"modulesNode",null);J(this,"itemPathUri","");J(this,"modules",null);J(this,"constants",{BASE_CONFIG:{waitSeconds:60,paths:{}}});return this.moduleAttribute=t,this.modulesNode=i,this.itemPathUri=s,this}async getConfiguration(t){this.setModules(this.getInteractionModules());let i=null;this.moduleAttribute.length>0&&this.modulesNode===null?i=await this.getConfigurationFromUrl(this.getModules()):i=await this.resolveModules(this.getModules()),t&&t(i)}async resolveModules(t){let i=null;if(t===null)return i;let s=this.constants.BASE_CONFIG;return s=await this.initBaseConfiguration(s,t),i=await this.resolvePrimaryConfigurationModules(s,t),i!==null||(i=await this.resolveSecondaryConfigurationModules(s,t)),i}async initBaseConfiguration(t,i){const s=`${this.getItemPathUri()}modules/module_resolution.js`;if(typeof i.primaryconfiguration>"u"&&typeof i.secondaryConfiguration>"u"){const n=await this.fetchDefaultModuleResolution(s,!1);if(n!==null)return n}return t}async resolvePrimaryConfigurationModules(t,i){let s=[];if(typeof i.primaryconfiguration>"u"){for(let o=0;o<i.module.length;o++){if(typeof i.module[o].primarypath>"u")return null;s.push(this.addPathJs(i.module[o].primarypath)),t.paths[i.module[o].id]=this.stripPathJs(i.module[o].primarypath)}return await this.resolveConfigurationModules(s)?t:null}const n=await this.fetchConfiguration(i.primaryconfiguration,!0,!0);if(n===null)return null;for(const a in n.paths)n.paths[a]=this.stripPathJs(n.paths[a]);for(let a=0;a<i.module.length;a++)typeof i.module[a].primarypath<"u"&&(n.paths[i.module[a].id]=this.stripPathJs(this.addPathJs(i.module[a].primarypath)));return await this.resolveConfigurationPathUrls(n.paths)?n:null}async resolveSecondaryConfigurationModules(t,i){let s=[];if(typeof i.secondaryconfiguration>"u"){for(let o=0;o<i.module.length;o++){if(typeof i.module[o].fallbackpath>"u")return null;s.push(this.addPathJs(i.module[o].fallbackpath)),t.paths[i.module[o].id]=this.stripPathJs(i.module[o].fallbackpath)}return await this.resolveConfigurationModules(s)?t:null}const n=await this.fetchConfiguration(i.secondaryconfiguration,!1,!0);if(n===null)return null;for(const a in n.paths)n.paths[a]=this.stripPathJs(n.paths[a]);for(let a=0;a<i.module.length;a++)typeof i.module[a].fallbackpath<"u"&&(n.paths[i.module[a].id]=this.stripPathJs(this.addPathJs(i.module[a].fallbackpath)));return await this.resolveConfigurationPathUrls(n.paths)?n:null}async resolveConfigurationPathUrls(t){let i=[];for(let n=0;n<t.length;n++)i.push(t[n]);return await this.resolveConfigurationModules(i)}async resolveConfigurationModules(t){return await Promise.all(t.map(s=>fetch(s).then(n=>{if(n.ok)return console.log("[PCI Parent] Module Loader Success:",s),n;throw new Error(s)}))).catch(s=>(console.log("[PCI Parent] Module Loader Failure:",s.message),null))!==null}async getConfigurationFromUrl(t){let i=null;return t===null||(typeof t.primaryconfiguration<"u"&&(i=await this.fetchConfiguration(t.primaryconfiguration,!0,!1)),i!==null)||typeof t.secondaryconfiguration<"u"&&(i=await this.fetchConfiguration(t.secondaryconfiguration,!1,!1)),i}async fetchConfiguration(t,i,s){try{const n=await fetch(t);if(!n.ok)throw new Error(`HTTP error: ${n.status}`);const r=await n.json();let a=r.paths;for(let o in a)a[o]!==null&&!a[o].startsWith("http")&&(s?a[o]=`${this.getConfigurationRelativePath(t)}${a[o]}`:a[o]=`${this.getItemPathUri()}${a[o]}`);return r}catch(n){return console.log((i?"Primary":"Fallback")+"configuration Fetch error:",n),null}}async fetchDefaultModuleResolution(t,i){try{const s=await fetch(t);if(!s.ok)throw new Error(`HTTP error: ${s.status}`);const n=await s.json();let r=n.paths;for(let a in r)r[a]!==null&&!r[a].startsWith("http")&&(i?r[a]=`${this.getConfigurationRelativePath(t)}${r[a]}`:r[a]=`${this.getItemPathUri()}${r[a]}`);return n}catch(s){return console.log("module_resolution.js Fetch error:",s),null}}getItemPathUri(){return this.itemPathUri}getModules(){return this.modules}setModules(t){this.modules=t}getInteractionModules(){let t={};if(this.modulesNode===null)return t={primaryconfiguration:"modules/module_resolution.js",secondaryconfiguration:"modules/fallback_module_resolution.js"},this.addPackagePath(t);const i=this.modulesNode.getPrimaryConfiguration();i.length>0&&(t.primaryconfiguration=i);const s=this.modulesNode.getSecondaryConfiguration();s.length>0&&(t.secondaryconfiguration=s),t.module=[];let n=this.modulesNode.getModules();for(let r=0;r<n.length;r++){let a={id:n[r].getId()};n[r].getPrimaryPath().length>0&&(a.primarypath=n[r].getPrimaryPath()),n[r].getFallbackPath().length>0&&(a.fallbackpath=n[r].getFallbackPath()),t.module.push(a)}return this.addPackagePath(t)}addPackagePath(t){for(let s in{primaryconfiguration:"",secondaryconfiguration:""})s in t&&t[s]!==null&&!t[s].startsWith("http")&&(t[s]=this.getAbsolutePath(this.getItemPathUri(),t[s]));let i=t.module;if(i!=null)for(let s=0;s<i.length;s++){let n=i[s];for(let r in{primarypath:"",fallbackpath:""})r in n&&n[r]!==null&&!n[r].startsWith("http")&&(n[r]=this.getAbsolutePath(this.getItemPathUri(),n[r]))}return t}getAbsolutePath(t,i){let s=t.split("/"),n=i.split("/");s.pop();for(var r=0;r<n.length;r++)n[r]!="."&&(n[r]==".."?s.pop():s.push(n[r]));return s.join("/")}getConfigurationRelativePath(t){if(t===null||t.length===0)return"";const i=t.lastIndexOf("/");return i<0?"":t.substring(0,i+1)}stripPathJs(t){return t===null?null:t.endsWith(".js")?t.slice(0,t.lastIndexOf(".")):t}addPathJs(t){return t===null?null:t.length>0&&!t.endsWith(".js")?`${t}.js`:t}}const Uh=new G,pw=new ie,p2={name:"QtiPortableCustomInteraction",props:{responseIdentifier:{required:!0,type:String},customInteractionTypeIdentifier:{required:!0,type:String},module:{required:!1,type:String,default:""},dataItemPathUri:{required:!1,type:String,default:""}},inheritAttrs:!0,data(){return{response:null,state:null,baseType:null,cardinality:null,isValidResponse:!0,isQtiValid:!0,hasPrompts:!1,pciModuleResolver:null,loadIframeHandler:null,renderer:"",classAttribute:"",properties:{},modulesNode:null,modules:null,configuration:null,templateVariables:[],contextVariables:[],uniqueId:null,pciIframe:null,isReady:!1,initialWidth:0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getStateRequest(){this.pciIframe.contentWindow.postMessage({message:"PciGetState_Request"},"*")},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return""},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.priorState=null},restoreValue(e,t){this.setResponse(e),this.setState(t)},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=e.cardinality,this.cardinality},getBaseType(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.baseType=e.baseType,this.baseType},getPrompts(e){let t=[];return e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},computeState(){return{}},computeIsValid(){return!0},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},validateChildren(){if(!this.$slots.default)return;let e=!1,t=!1,i=!1,s=!1,n=!1;this.$slots.default().forEach(r=>{if(Uh.isValidSlot(r)){if(r.type.name==="QtiPrompt"){if(t||i||s||n)throw new c("Invalid element order. qti-prompt must be the first element");if(!e)return e=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(r.type.name==="QtiInteractionModules"){if(t||s||n)throw new c("Invalid element order: qti-interaction-modules");if(!i)return i=!0;throw new c("Maximum of 1 qti-interaction-modules element permitted")}if(r.type.name==="QtiInteractionMarkup"){if(s||n)throw new c("Invalid element order: qti-interaction-markup");if(!t)return t=!0;throw new c("Maximum of 1 qti-interaction-markup element permitted")}if(r.type.name==="QtiTemplateVariable"){if(s)throw new c("Invalid element order: qti-template-variable");if(!n)return n=!0;throw new c("Maximum of 1 qti-interaction-markup element permitted")}if(r.type.name==="QtiContextVariable")return s=!0;if(r.type.name==="QtiStylesheet")return!0;throw new c('Node is not permitted inside QtiPortableCustomInteraction: "'+r.type.name+'"')}})},processChildren(){const e=this.$.subTree.children[1].children[0].children;e!==null&&(e.forEach(t=>{if(t.component===null)return;const i=t.component.proxy;switch(t.type.name){case"QtiInteractionMarkup":this.markup=i.getMarkup();break;case"QtiInteractionModules":this.modulesNode=i;break;case"QtiTemplateVariable":this.templateVariables.push(i);break;case"QtiContextVariable":this.contextVariables.push(i);break}}),this.priorState!==null&&this.restoreValue(this.priorState.value,this.priorState.state),this.initialWidth=this.$refs.root.clientWidth)},disable(){},enable(){},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('PCI State Invalid. "value" property not found.');if(!("state"in t))throw new O('PCI State Invalid. "state" property not found.');return t},createId(){return"pci_"+Uh.randomString(5,"a")},initialize(){this.setProperties(this.getPciProperties()),this.pciModuleResolver=new f2(this.module,this.modulesNode,this.dataItemPathUri),this.pciModuleResolver.getConfiguration((function(e){this.setConfiguration(e),console.log("[PCI Parent] PCI Configuration:",e),e!==null&&this.loadPciIframe(this.initialWidth)}).bind(this))},loadPciIframe(e){const t=document.createElement("iframe");t.name=this.uniqueId,t.id=this.uniqueId,t.setAttribute("scrolling","no"),t.style.border="none",t.style.width=`${e}px`,t.addEventListener("load",this.loadIframeHandler),t.src=`${this.renderer}?identifier=${this.responseIdentifier}&uniqueId=${this.uniqueId}`,this.$refs.ic.appendChild(t)},handleLoadIframe(e){this.pciIframe=e.target},getItemPathUri(){return this.dataItemPathUri},getPciProperties(){let e=this.$refs.root;const t={};for(let i in e.dataset)i!=="uniqueId"&&(t[i]=e.dataset[i]);return t},getProperties(){return this.properties},setProperties(e){this.properties=e},getContextVariables(){let e={};for(let t=0;t<this.contextVariables.length;t++)e[this.contextVariables[t].getIdentifier()]=this.contextVariables[t].evaluate();return e},getTemplateVariables(){let e={};for(let t=0;t<this.templateVariables.length;t++)e[this.templateVariables[t].getIdentifier()]=this.templateVariables[t].evaluate();return e},getModules(){return this.modules},setModules(e){this.modules=e},getConfiguration(){return this.configuration},setConfiguration(e){this.configuration=e},getClassAttribute(){return this.classAttribute},setClassAttribute(e){this.classAttribute=e},copyAttributes(e,t,i){return e.forEach(function(s){let n=s.replace("-","");t[n]=i.getAttribute(s)}),t},getResponseVariable(){let e=pw.valueToPciJson(this.getResponse(),this.baseType,this.cardinality),t={};return t[this.responseIdentifier]=e,t},pciInitialize(){let e={typeIdentifier:this.customInteractionTypeIdentifier,classAttribute:this.getClassAttribute(),markup:this.markup,properties:this.getProperties(),boundTo:this.getResponseVariable(),templateVariables:this.getTemplateVariables(),contextVariables:this.getContextVariables(),module:this.module,modules:this.getModules(),moduleResolution:this.getConfiguration(),status:_.getItemLifecycleStatus()},t={message:"PciLoadInteraction",pci:JSON.stringify(e)};this.priorState!==null&&(t.state=JSON.stringify({response:pw.valueToPciJson(this.getResponse(),this.baseType,this.cardinality),state:this.getState()})),this.pciIframe.contentWindow.postMessage(t,"*")},pciResizeIframe(e,t){this.pciIframe!==null&&(this.pciIframe.style.height=`${e}px`,this.pciIframe.style.width=`${t}px`)},pciResizeIframeWidthToContainer(){this.pciIframe!==null&&(this.pciIframe.style.width=`${this.$refs.ic.clientWidth}px`)},pciSaveState(e){const t=JSON.parse(e);typeof t.response<"u"?this.setResponse(t.response):this.setResponse(null),typeof t.state<"u"?this.setState(t.state):this.setState(null),this.notifyInteractionStateReady()},pciSetReady(){this.isReady=!0},pciIsReady(){return this.pciIframe!==null&&this.isReady},notifyInteractionStateReady(){_.NotifyInteractionStateReady({identifier:this.responseIdentifier})}},created(){try{this.responseDeclaration=Uh.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.validateChildren(),this.renderer=_.getPciContextRenderer(),this.loadIframeHandler=this.handleLoadIframe.bind(this);const e=typeof this.$.vnode.props.class<"u"?this.$.vnode.props.class:"";this.setClassAttribute(e),this.priorState=this.getPriorState(this.responseIdentifier),this.hasPrompts=this.getPrompts(this.$slots).length>0,this.cardinality=this.getCardinality(),this.baseType=this.getBaseType(),this.uniqueId=this.createId()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"PortableCustom",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:""}),this.initialize(),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}},beforeUnmount(){this.pciIframe!==null&&this.pciIframe.removeEventListener("load",this.loadIframeHandler)}},m2={ref:"root",class:"qti-portable-custom-interaction"},g2={ref:"prompt",class:"qti-prompt-wrapper"},y2={ref:"pcigroup",class:"qti3-player-pci-group"},w2={ref:"ic",class:"qti3-player-pci-iframe-container"};function b2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",m2,[l.createElementVNode("div",g2,null,512),l.createElementVNode("div",y2,[l.renderSlot(e.$slots,"default")],512),l.createElementVNode("div",w2,null,512)],512)}const v2=B(p2,[["render",b2]]),E2={name:"QtiPrompt"},T2={class:"qti-prompt"};function C2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",T2,[l.renderSlot(e.$slots,"default")])}const S2=B(E2,[["render",C2]]),x2=new G,_2={name:"QtiInlineChoice",props:{identifier:{required:!0,type:String},fixed:{required:!1,type:String,default:"false"},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"}},data(){return{id:null}},inheritAttrs:!0,methods:{createId(){if(this.$refs.choice.hasAttribute("id")){this.id=this.$refs.choice.getAttribute("id");return}this.id="inlinechoice_"+x2.randomString(5,"a")+"_"+this.identifier,this.$refs.choice.setAttribute("id",this.id)}},created(){},mounted(){this.createId()}},I2=["data-identifier"];function V2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("li",{ref:"choice",role:"option","data-identifier":i.identifier,class:"qti-inline-choice"},[l.renderSlot(e.$slots,"default")],8,I2)}const A2=B(_2,[["render",V2]]),$2=new G,L2={name:"QtiSimpleChoice",emits:["setChecked","setFocusPreviousChoice","setFocusNextChoice","setActiveDescendant"],props:{identifier:{required:!0,type:String},fixed:{required:!1,type:String,default:"false"},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"}},data(){return{id:null,checked:"false",isRadio:!0,role:"radio",tabIndex:"-1",hasMath:!1,isDisabled:!1,parentCardinality:"single"}},inheritAttrs:!0,methods:{handleClick(){if(!this.isDisabled)if(this.isRadio)this.$parent.$emit("setChecked",{identifier:this.identifier,checked:"true"});else{if(this.toggleChecked(),this.parentCardinality==="ordered")return;this.$parent.$emit("setChecked",{identifier:this.identifier,checked:this.checked})}},handleKeydown(e){let t=!1;switch(e.code){case"Space":if(!this.isDisabled){if(this.toggleChecked(),this.parentCardinality==="ordered")return;this.$parent.$emit("setChecked",{identifier:this.identifier,checked:this.checked})}t=!0;break;case"Enter":if(!this.isDisabled){if(this.toggleChecked(),this.parentCardinality==="ordered")return;this.$parent.$emit("setChecked",{identifier:this.identifier,checked:this.checked})}t=!0;break;case"ArrowUp":case"ArrowLeft":this.isRadio&&(this.$parent.$emit("setFocusPreviousChoice",this.identifier),t=!0);break;case"ArrowDown":case"ArrowRight":this.isRadio&&(this.$parent.$emit("setFocusNextChoice",this.identifier),t=!0);break}t&&(e.stopPropagation(),e.preventDefault())},handleFocus(){this.parentCardinality!=="ordered"&&this.$parent.$emit("setActiveDescendant",this.id)},handleBlur(){},setChecked(e){this.checked=e?"true":"false"},isChecked(){return this.checked==="true"},setTabIndex(e){this.tabIndex=e},setFocus(){this.$refs.choice.focus()},setBlur(){this.$refs.choice.blur()},toggleChecked(){this.checked=this.checked==="true"?"false":"true"},setLabel(e){this.$refs.label.innerText=e},hideLabel(){this.$refs.label.classList.add("qti-hidden")},showLabel(){this.$refs.label.classList.remove("qti-hidden")},setLabelSbac(e){this.$refs.choice.classList.add("sbac"),this.$refs.choice.setAttribute("data-label",e),this.$refs.label.innerText=e,this.$refs.label.classList.add("qti-visually-hidden")},setChoiceLrn(){this.$refs.choice.classList.add("lrn")},hideControl(){this.$refs.choice.classList.add("control-hidden")},setIsDisabled(e){this.isDisabled=e},initializeChoice(){switch(this.parentCardinality=this.$parent.cardinality,this.parentCardinality){case"ordered":this.role="button",this.isRadio=!1,this.tabIndex=0;break;case"multiple":this.role="checkbox",this.isRadio=!1,this.tabIndex=0;break;default:this.role="radio",this.isRadio=!0,this.tabIndex=-1;break}},initializeOrderChoice(){this.role==="button"&&(this.hideLabel(),this.hideControl())},createId(){if(this.$refs.choice.hasAttribute("id")){this.id=this.$refs.choice.getAttribute("id");return}this.id="choice_"+$2.randomString(5,"a")+"_"+this.identifier,this.$refs.choice.setAttribute("id",this.id)},setExpectedSolution(){this.$refs.choice.classList.add("player-show-solution","player-choice-expected")},setCorrectSolution(){this.$refs.choice.classList.add("player-show-solution","player-choice-correct")},setIncorrectSolution(){this.$refs.choice.classList.add("player-show-solution","player-choice-incorrect")},setIgnoreSolution(){this.$refs.choice.classList.remove("player-show-solution","player-choice-incorrect","player-choice-correct","player-choice-expected")}},created(){this.initializeChoice()},mounted(){this.initializeOrderChoice(),this.createId()}},M2=["role","aria-checked","tabindex","data-identifier"],N2={ref:"label",class:"qti-choice-label"},R2={ref:"description",class:"qti-choice-description"};function k2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("li",{ref:"choice",role:n.role,"aria-checked":n.checked,tabindex:n.tabIndex,"data-identifier":i.identifier,onFocus:t[0]||(t[0]=(...a)=>r.handleFocus&&r.handleFocus(...a)),onBlur:t[1]||(t[1]=(...a)=>r.handleBlur&&r.handleBlur(...a)),onClick:t[2]||(t[2]=(...a)=>r.handleClick&&r.handleClick(...a)),onKeydown:t[3]||(t[3]=(...a)=>r.handleKeydown&&r.handleKeydown(...a)),class:l.normalizeClass(["qti-simple-choice",{source:n.role=="button"}])},[l.createElementVNode("div",{class:l.normalizeClass(["qti-simple-choice-wrapper",{draggable:n.role=="button"}]),style:{width:"100%"}},[l.createElementVNode("div",N2,null,512),l.createElementVNode("div",R2,[l.renderSlot(e.$slots,"default")],512)],2)],42,M2)}const q2=B(L2,[["render",k2]]),O2=new G,B2={name:"QtiSimpleAssociableChoice",props:{identifier:{required:!0,type:String},fixed:{required:!1,type:String,default:"false"},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"},matchGroup:{required:!1,type:String,default:""},matchMax:{required:!0,type:String},matchMin:{required:!1,type:String,default:"0"}},data(){return{id:null}},methods:{createId(){if(this.$refs.choice.hasAttribute("id")){this.id=this.$refs.choice.getAttribute("id");return}this.id="choice_"+O2.randomString(5,"a")+"_"+this.identifier,this.$refs.choice.setAttribute("id",this.id)}},mounted(){this.createId()}},P2=["data-identifier","data-match-max","data-match-min","data-match-group"],D2={ref:"description",class:"choice-description"};function Q2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("li",{ref:"choice","data-identifier":i.identifier,"data-match-max":i.matchMax,"data-match-min":i.matchMin,"data-match-group":i.matchGroup,class:"qti-simple-associable-choice"},[l.createElementVNode("div",D2,[l.renderSlot(e.$slots,"default")],512)],8,P2)}const H2=B(B2,[["render",Q2]]),F2=new G,U2={name:"QtiAssociableHotspot",props:{identifier:{required:!0,type:String},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"},matchGroup:{required:!1,type:String,default:""},shape:{required:!0,type:String},coords:{required:!0,type:String},hotspotLabel:{required:!1,type:String,default:""},ariaLabel:{required:!1,type:String,default:""},matchMax:{required:!0,type:String},matchMin:{required:!1,type:String,default:"0"}},data(){return{shapeData:null,shapeColorProperties:null,isQtiValid:!0}},inheritAttrs:!0,methods:{getIdentifier(){return this.identifier},getShape(){return this.shape},getShapeData(){return this.shapeData},setShapeData(){const e=this.coords.split(",");switch(this.getShape()){case"circle":if(e.length!=3)return;this.shapeData=e;return;case"rect":if(e.length!==4)return;e[2]=parseInt(e[2])-parseInt(e[0]),e[3]=parseInt(e[3])-parseInt(e[1]),this.shapeData=e;return;case"poly":this.shapeData=this.transformPolyCoords(e);return;case"ellipse":if(e.length!=4)return;this.shapeData=e;return;case"default":this.shapeData="";return}},transformPolyCoords(e){let t=[];if(e.length%2!=0)return t;for(let i=0;i<e.length;i+=2)t.push(`${e[i]} ${e[i+1]}`);return t},initialize(){F2.validateShapeAttribute(this.shape),this.setShapeData()}},created(){try{this.initialize()}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw new c(e.message)}},mounted(){if(this.isQtiValid)try{console.log("["+this.$options.name+"][Identifier]",this.identifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},G2=["data-identifier","data-match-max","data-match-min","data-match-group"];function j2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"gap","data-identifier":i.identifier,"data-match-max":i.matchMax,"data-match-min":i.matchMin,"data-match-group":i.matchGroup,class:"ggm-gap"},null,8,G2)}const W2=B(U2,[["render",j2]]),z2=new G,K2=new ie,Y2={name:"QtiSimpleMatchSet",data(){return{choices:[],isShuffle:!1,isQtiValid:!0}},methods:{getChoices(){return this.choices},setIsShuffle(e){this.isShuffle=e},createContainer(e,t){let i=[];return e===null?(this.choices.forEach(n=>{i.push({fixed:n.fixed==="true",node:n})}),this.isShuffle&&K2.shuffleArrayFixed(i),i):(e.state.orders[t].forEach(n=>{const r=this.findChoiceByIdentifier(n,this.choices);r!==null&&i.push({fixed:r.fixed==="true",node:r})},this),i)},processContainerChoices(e){this.choices.splice(0,this.choices.length),this.$refs.matchset.innerHTML="",e.forEach(t=>{this.$refs.matchset.appendChild(t.node.$el),this.choices.push(t.node)},this)},validateChildren(){let e=0;if(!this.$slots.default)throw new c("Must have at least 1 qti-simple-associable-choice");if(this.$slots.default().forEach(t=>{if(z2.isValidSlot(t)){if(t.type.name==="QtiSimpleAssociableChoice")return e+=1;throw new c('Node is not a qti-simple-associable-choice: "'+t.type.name+'"')}}),e===0)throw new c("Must have at least 1 qti-simple-associable-choice")},processChildren(){this.$.subTree.children[0].children.forEach(t=>{t.component!==null&&this.choices.push(t.component.proxy)})},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Match Interaction State Invalid. Choice identifier "'+e+'" not found.')}},created(){try{this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),console.log("["+this.$options.name+"]")}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},X2={ref:"matchset",class:"qti-simple-match-set"};function Z2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("ul",X2,[l.renderSlot(e.$slots,"default")],512)}const J2=B(Y2,[["render",Z2]]);class eq{constructor(t){this.constants={QTI_CHOICES_TOP:"qti-choices-top",QTI_CHOICES_BOTTOM:"qti-choices-bottom",QTI_CHOICES_LEFT:"qti-choices-left",QTI_CHOICES_RIGHT:"qti-choices-right",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message",DATA_CHOICES_CONTAINER_WIDTH:null},this.parentClass=t,this.clazzTokens=[],this.gapMatchGroupElement=null,this.gapChoiceWrapperElement=null,this.gapTargetWrapperElement=null,this.choicesContainerWidth=null,this.gapChoices=[],this.gaps=[],this.presentation_Choices_Orientation=null,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage=""}initialize(t,i,s,n,r,a){this.gapMatchGroupElement=t,this.gapChoiceWrapperElement=i,this.gapTargetWrapperElement=s,this.choicesContainerWidth=n,this.gapChoices=r,this.gaps=a,this.processRootClassAttribute(this.parentClass),this.processPresentation()}processRootClassAttribute(t){const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case this.constants.QTI_CHOICES_TOP:case this.constants.QTI_CHOICES_BOTTOM:case this.constants.QTI_CHOICES_LEFT:case this.constants.QTI_CHOICES_RIGHT:this.presentation_Choices_Orientation=i[s];break}this.clazzTokens=i}processPresentation(){this.presentation_Choices_Orientation===null&&(this.presentation_Choices_Orientation=this.constants.QTI_CHOICES_TOP),this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_LEFT?(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.gapMatchGroupElement.classList.add(this.constants.QTI_CHOICES_LEFT)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_TOP?(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_RIGHT?(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.gapMatchGroupElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.gapMatchGroupElement.insertBefore(this.gapTargetWrapperElement,this.gapChoiceWrapperElement)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_BOTTOM&&(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.gapMatchGroupElement.insertBefore(this.gapTargetWrapperElement,this.gapChoiceWrapperElement)),this.processChoicesContainerWidth(),this.processGaps()}processChoicesContainerWidth(){this.choicesContainerWidth!==null&&(this.gapChoiceWrapperElement.style.width=`${this.choicesContainerWidth}px`)}processGaps(){for(let t=0;t<this.gaps.length;t++)this.gaps[t].classList.add("target")}}class tq{constructor(t,i){J(this,"options",{interactionSubType:"default",cardinality:"single",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null});return this.qtiAttributeValidation=new G,this.wrapper=t,this.sourcewrapper=this.wrapper.querySelector(".qti-gap-match-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-gap-match-target-wrapper"),this.processOptions(i),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragMove=this.handleDragMove.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.itemTarget=null,this.itemStart=null,this.isItemStartSource=!0,this.initialX=0,this.initialY=0,this.offsetX=0,this.offsetY=0,this.startingX=0,this.startingY=0,this.currentAssociationsCount=0,this.isDisabled=!1,this.currentDragger=null,this.initializeSources(this.sourcewrapper),this.initializeTargets(this.targetwrapper),this.restoreResponse(this.options.response),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.draggers.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleDragStart(t){if(t.preventDefault(),!this.isDisabled&&t.button==0)return this.interactionStart(t.target,t.clientX,t.clientY,!1),!1}handleTouchStart(t){if(t.preventDefault(),!this.isDisabled)return t.targetTouches.length!=1||this.interactionStart(t.target,t.touches[0].pageX,t.touches[0].pageY,!0),!1}interactionStart(t,i,s,n){const r=this.getClosestElement(t,"draggable");this.itemStart=r.parentNode,this.isItemStartSource=this.itemStart.classList.contains("source"),this.identifyTargets(this.itemStart,!0),this.itemTarget=null;const a=r.getBoundingClientRect();this.initialX=i,this.initialY=s,this.startingX=a.left,this.startingY=a.top,this.offsetX=i-this.startingX,this.offsetY=s-this.startingY,this.addPlaceholder(r),r.style.userSelect="none",r.style.width=a.width+"px",r.style.height=a.height+"px",r.style.transform=`translateX(${a.left}px) translateY(${a.top}px) translateZ(0)`,r.classList.add("dragging"),this.setCurrentDragger(r),this.addListeners(r,n)}handleDragMove(t){t.preventDefault(),!this.isDisabled&&this.interactionMove(t.clientX,t.clientY)}handleTouchMove(t){t.preventDefault(),!this.isDisabled&&t.targetTouches.length==1&&this.interactionMove(t.touches[0].clientX,t.touches[0].clientY)}interactionMove(t,i){const s=this.currentDragger;this.offsetX=t-this.initialX,this.offsetY=i-this.initialY,this.constrainDraggerToWrapper(s,this.wrapper),s.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0) scale(1)`;const n=s.getBoundingClientRect();this.findDraggerItemTarget(s,n,this.targets),this.isItemStartSource||this.findSourceDraggerTarget(s,n)}constrainDraggerToWrapper(t,i){const s=t.getBoundingClientRect(),n=i.getBoundingClientRect(),r=this.startingX+this.offsetX-n.x,a=this.startingY+this.offsetY-n.y,o=this.startingX+s.width+this.offsetX-(n.x+n.width),u=this.startingY+s.height+this.offsetY-(n.y+n.height);r<0&&(this.offsetX=this.offsetX-r),o>0&&(this.offsetX=this.offsetX-o),a<0&&(this.offsetY=this.offsetY-a),u>0&&(this.offsetY=this.offsetY-u)}handleDragEnd(t){this.isDisabled||this.interactionEnd(t.clientX,t.clientY,!1)}handleTouchEnd(t){this.isDisabled||this.interactionEnd(t.changedTouches[0].clientX,t.changedTouches[0].clientY,!0)}interactionEnd(t,i,s){const n=this.currentDragger;if(this.itemTarget===null?n.style.transform=`translateX(${this.startingX}px) translateY(${this.startingY}px) translateZ(0)`:n.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0)`,n.removeAttribute("style"),n.classList.remove("dragging"),this.clearTargetHighlights(),this.itemTarget===null){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemTarget.classList.contains("active")){if(this.itemTarget.classList.remove("active"),this.isExceedingMaxAssociations(this.itemStart,this.itemTarget,n)){this.resetDraggerToItemStart(this.itemStart,n),this.notifyAssociationsLimit(),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemStart.getAttribute("data-identifier")===this.itemTarget.getAttribute("data-identifier")){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}this.removePlaceholder(n),this.setDraggerToItemTarget(this.itemTarget,n),this.itemTarget.classList.contains("source")&&(this.itemTarget.classList.add("full"),this.itemTarget.dataset.matchMax*1>0&&this.incrementRemaining(this.itemTarget),this.decrementAssociationsCount(),this.sortContainerElements(this.sourcewrapper)),this.itemStart.classList.contains("source")&&(this.itemStart.dataset.matchMax*1>0&&this.decrementRemaining(this.itemStart)===0&&this.itemStart.classList.remove("full"),this.incrementAssociationsCount()),this.itemStart.classList.contains("target")&&(this.isTargetFull(this.itemStart)?this.itemStart.classList.add("full"):this.itemStart.classList.remove("full")),this.notifyUpdate()}this.setCurrentDragger(null),this.removeListeners(n,s)}setCurrentDragger(t){this.currentDragger=t}resetDraggerToItemStart(t,i){this.replacePlaceholder(i),t.classList.contains("source")||i.setAttribute("style","width:100%")}setDraggerToItemTarget(t,i){if(t.classList.contains("source")){if(t.classList.contains("full")){const s=t.querySelector(".draggable");s!=null&&t.replaceChild(i,s);return}t.append(i);return}t.append(i),i.setAttribute("style","width:100%"),this.isTargetFull(t)?t.classList.add("full"):t.classList.remove("full")}findDraggerItemTarget(t,i,s){this.itemTarget=null,s.forEach(n=>{const r=n.getBoundingClientRect();if(i.top+t.offsetHeight/2<r.bottom&&i.right-t.offsetWidth/2>r.left&&i.bottom-t.offsetHeight/2>r.top&&i.left+t.offsetWidth/2<r.right){if(this.isItemStartSource&&n.classList.contains("source")||n.classList.contains("full")||!this.hasMatchingMatchGroup(t.parentNode,n))return;n.classList.add("active"),this.itemTarget=n}else n.classList.remove("active")},this)}findSourceDraggerTarget(t,i){const s=this.sourcewrapper.getBoundingClientRect();if(i.top+t.offsetHeight/2<s.bottom&&i.right-t.offsetWidth/2>s.left&&i.bottom-t.offsetHeight/2>s.top&&i.left+t.offsetWidth/2<s.right){for(let n=0;n<this.sources.length;n++)if(this.sources[n].dataset.identifier===t.dataset.identifier){this.sources[n].classList.add("active"),this.itemTarget=this.sources[n];break}}else for(let n=0;n<this.sources.length;n++)this.sources[n].classList.contains("active")&&this.sources[n].classList.remove("active")}addPlaceholder(t){if(!t.parentNode.classList.contains("source")){this.addPlaceholderElement(t,!1);return}const i=t.parentNode.dataset.matchMax*1;if(i===1){this.addPlaceholderElement(t,!1);return}if(i===0){this.addPlaceholderElement(t,!0);return}if(this.getRemaining(t.parentNode)===1){this.addPlaceholderElement(t,!1);return}this.addPlaceholderElement(t,!0)}addPlaceholderElement(t,i){const s=t.cloneNode(!0);this.deepCloneId(s),i?(s.classList.add("clone"),s.addEventListener("mousedown",this.handleDragStart),s.addEventListener("touchstart",this.handleTouchStart)):s.classList.add("gm-dragger-placeholder"),s.classList.add("placeholder-fade"),t.parentNode.insertBefore(s,t)}removePlaceholder(t){if(t.parentNode.classList.contains("target")){const n=t.parentNode.querySelector(".gm-dragger-placeholder");if(n===null)return;t.parentNode.removeChild(n);return}const i=t.parentNode.dataset.matchMax*1,s=t.parentNode.querySelector(".gm-dragger-placeholder");if(s===null){const n=t.parentNode.querySelector(".clone");if(n===null)return;n.classList.remove("placeholder-fade");return}i!==0&&t.parentNode.removeChild(s)}replacePlaceholder(t){const i=t.parentNode;let s=i.querySelector(".gm-dragger-placeholder");if(i.classList.contains("source")){if(s==null&&(s=i.querySelector(".draggable")),s===null)return;i.replaceChild(t,s);return}s!==null&&i.replaceChild(t,s)}addClonePlaceholder(t){const i=t.cloneNode(!0);this.deepCloneId(i),i.classList.add("clone"),t.parentNode.insertBefore(i,t),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)}initializeSources(t){this.sources=t.querySelectorAll(".source"),this.sources.forEach(i=>{i.classList.add("full");const s=i.dataset.matchMax*1;this.setRemaining(i,s===0?1e3:s)},this),this.draggers=t.querySelectorAll(".draggable"),this.draggers.forEach((i,s)=>{const n=i.parentNode.getAttribute("data-identifier");i.setAttribute("data-identifier",n),i.setAttribute("data-order",s),i.setAttribute("tabindex",0),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)},this)}initializeTargets(t){this.targets=t.querySelectorAll(".target"),this.targets.forEach(i=>{i.setAttribute("tabindex",0)})}identifyTargets(t,i){this.targets.forEach(s=>{i&&!s.classList.contains("full")&&this.hasMatchingMatchGroup(t,s)&&s.classList.add("target-active")},this),i&&!this.isItemStartSource&&this.sourcewrapper.classList.add("target-active")}addListeners(t,i){i?(this.removeListeners(t,i),t.addEventListener("touchmove",this.handleTouchMove),t.addEventListener("touchend",this.handleTouchEnd)):(this.removeListeners(t,i),document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd))}removeListeners(t,i){i?(t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("touchend",this.handleTouchEnd)):(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd))}clearTargetHighlights(){this.targets.forEach(t=>{t.classList.remove("target-active")},this),this.sourcewrapper.classList.remove("target-active")}getClosestElement(t,i){return t?t&&t.classList.contains(i)?t:this.getClosestElement(t.parentElement,i):!1}sortContainerElements(t){let i=[],s=t.children;for(let n=0;n<s.length;n++){const r=s[n].querySelector("div.draggable");r&&i.push([1*r.dataset.order,s[n]])}i.sort(function(n,r){return n[0]-r[0]});for(let n=0;n<i.length;n++)t.appendChild(i[n][1])}getResponse(){return this.computeResponse()}computeResponse(){let t=[];return this.targets.forEach(i=>{i.querySelectorAll(".draggable").forEach(s=>{t.push(`${s.dataset.identifier} ${i.dataset.identifier}`)})}),t.length===0?null:this.options.cardinality==="single"?t[0]:t}restoreResponse(t){t!==null&&(this.options.cardinality==="single"?this.restoreResponsePair(t):t.forEach(i=>{this.restoreResponsePair(i)},this))}restoreResponsePair(t){const i=this.getPair(t);if(i===null)return;const s=this.findSourceByIdentifier(i.source),n=this.findTargetGapByIdentifier(i.target);if(s===null||n===null)return;const r=s.querySelector(".draggable");r!==null&&(this.cloneOrEmptySourceDragger(s,r),this.restoreSourceDraggerToTarget(n,r))}cloneOrEmptySourceDragger(t,i){const s=t.dataset.matchMax*1;if(s===1){t.classList.remove("full"),this.decrementRemaining(t);return}if(s===0){this.addClonePlaceholder(i);return}if(this.getRemaining(t)===1){t.classList.remove("full"),this.decrementRemaining(t);return}this.decrementRemaining(t),this.addClonePlaceholder(i)}findSourceByIdentifier(t){for(let i=0;i<this.sources.length;i++)if(t===this.sources[i].dataset.identifier)return this.sources[i];return null}findTargetGapByIdentifier(t){for(let i=0;i<this.targets.length;i++)if(t===this.targets[i].dataset.identifier)return this.targets[i];return null}getPair(t){if(t===null)return null;const i=t.split(" ");return i.length!=2?null:{source:i[0],target:i[1]}}restoreSourceDraggerToTarget(t,i){t===null||i===null||(t.append(i),i.setAttribute("style","width:100%"),this.incrementAssociationsCount(),this.isTargetFull(t)&&t.classList.add("full"))}hasMatchingMatchGroup(t,i){return t===null||i===null?!1:t.dataset.matchGroup===i.dataset.matchGroup}isTargetFull(t){if(t==null)return!1;const i=t.querySelectorAll(".draggable"),s=t.dataset.matchMax*1;return s===0?!1:i.length>=s}isExceedingMaxAssociations(t,i){return!(this.options.maxAssociations===0||i.classList.contains("source")||t.classList.contains("target")||this.currentAssociationsCount<this.options.maxAssociations)}initializeAssociationsCount(){this.currentAssociationsCount=0}incrementAssociationsCount(){this.currentAssociationsCount+=1}decrementAssociationsCount(){this.currentAssociationsCount!==0&&(this.currentAssociationsCount-=1)}getRemaining(t){return t.dataset.remaining*1}setRemaining(t,i){t.setAttribute("data-remaining",i)}incrementRemaining(t){const i=t.dataset.remaining*1+1;return t.setAttribute("data-remaining",i),i}decrementRemaining(t){let i=t.dataset.remaining*1-1;return i=i>=0?i:0,t.setAttribute("data-remaining",i),i}deepCloneId(t){t.id&&(t.id=`clone_${this.qtiAttributeValidation.randomString(5,"a")}`);for(let i=0;i<t.children.length;i++)this.deepCloneId(t.children[i])}reset(){this.resetDraggersToSources(),this.initializeAssociationsCount(),this.destroy()}resetDraggersToSources(){this.targets.forEach(t=>{t.querySelectorAll(".draggable").forEach(s=>{const n=this.findSourceByIdentifier(s.getAttribute("data-identifier"));n.classList.contains("full")||(t.classList.remove("full"),n.classList.contains("full")?t.removeChild(s):(n.append(s),n.classList.add("full")))},this)},this)}destroy(){this.currentDragger!==null&&(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd)),this.wrapper.querySelectorAll(".draggable").forEach(i=>{i.removeEventListener("touchstart",this.handleTouchStart),i.removeEventListener("touchmove",this.handleTouchMove),i.removeEventListener("touchend",this.handleTouchEnd),i.removeEventListener("mousedown",this.handleDragStart)},this)}}const iq=new G,sq=new ie,nq={emits:["gapMatchGroupReady","gapMatchGroupUpdate","gapMatchGroupAssociationsLimit"],props:{responseIdentifier:{required:!0,type:String},cardinality:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},maxAssociations:{required:!1,type:String,default:"1"},minAssociations:{required:!1,type:String,default:"0"},dataChoicesContainerWidth:{required:!1,type:String,default:null},interactionSubType:{required:!1,type:String,default:"default"},gapMatchInteractionStaticClass:{required:!0,type:String},priorState:{required:!1,type:Object,default:null}},data(){return{choices:[],order:[],gaps:[],response:null,isShuffle:null,hasPrompt:!1,gapMatchInteractionClassAttribute:null,presentationFactory:null,matchable:null,isQtiValid:!0}},computed:{computedMaxAssociations(){return this.maxAssociations*1}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},disable(){this.matchable!==null&&this.matchable.toggleDisable(!0)},enable(){this.matchable!==null&&this.matchable.toggleDisable(!1)},getChoices(){return this.choices},setIsShuffle(e){this.isShuffle=e},validateChildren(){let e=0;this.$slots.default()[0].children.forEach(t=>{if(iq.isValidSlot(t)){if(t.type.name==="QtiPrompt"){if(e>0)throw new c("Invalid element order. qti-prompt must come before qti-gap-text's, qti-gap-img's, or qti-gap's");if(!this.hasPrompt)return this.hasPrompt=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(t.type.name==="QtiGapText"||t.type.name==="QtiGapImg")return e+=1;throw new c('Node is not one of qti-gap-text or qti-gap-img: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children[0].children.forEach(i=>{i.component!==null&&(i.type.name==="QtiGapText"||i.type.name==="QtiGapImg")&&this.choices.push(i.component.proxy)}),this.$refs.root.querySelectorAll(".gap-match-gap").forEach(i=>{this.gaps.push(i)})},insertAfter(e,t){t.parentNode.insertBefore(e,t.nextSibling)},processGroupUI(e){let t=this.createGapChoiceWrapper();if(t==null)return;let i=this.createContainer(this.priorState);this.processContainerChoices(i,t),this.saveContainerOrder(i);let s=this.createGapTargetWrapper(t);this.presentationFactory.initialize(this.$refs.root,t,s,this.dataChoicesContainerWidth,this.choices,this.gaps),this.matchable=new tq(this.$refs.root,{interactionSubType:this.interactionSubType,cardinality:this.cardinality,maxAssociations:this.computedMaxAssociations,response:e,onReady:this.handleWidgetReady,onUpdate:this.handleWidgetUpdate,onAssociationsLimit:this.handleAssociationsLimit})},createGapChoiceWrapper(){let e=this.$refs.root.querySelector(".qti-gap-choice");if(e===null)return null;let t=document.createElement("ul");return t.classList.add("qti-gap-match-source-wrapper"),this.$refs.root.insertBefore(t,e),t},createGapTargetWrapper(e){const t=document.createElement("div");t.classList.add("qti-gap-match-target-wrapper"),this.insertAfter(t,e);const i=t.nextElementSibling;return i!=null&&t.append(i),t},createContainer(e){let t=[];return e===null?(this.choices.forEach(s=>{t.push({fixed:s.fixed==="true",node:s})}),this.isShuffle&&sq.shuffleArrayFixed(t),t):(e.state.order.forEach(s=>{const n=this.findChoiceByIdentifier(s,this.choices);n!==null&&t.push({fixed:n.fixed==="true",node:n})},this),t)},processContainerChoices(e,t){this.choices.splice(0,this.choices.length),t.innerHTML="",e.forEach(i=>{t.appendChild(i.node.$el),this.choices.push(i.node)},this)},saveContainerOrder(e){const t=[];e.forEach(i=>{t.push(i.node.identifier)}),this.order=t},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Gap Match Interaction State Invalid. Choice identifier "'+e+'" not found.')},resetGroupUI(){this.processGroupUI(null)},handleWidgetReady(e){this.setResponse(e.response),this.$emit("gapMatchGroupReady",{response:this.getResponse(),order:this.order})},handleWidgetUpdate(e){this.setResponse(e.response),this.$emit("gapMatchGroupUpdate",{response:this.getResponse()})},handleAssociationsLimit(){this.$emit("gapMatchGroupAssociationsLimit")},initializeGapMatchGroup(){this.presentationFactory=new eq(this.gapMatchInteractionStaticClass)}},created(){try{if(typeof this.cardinality>"u")throw new c("Undefined qti-gap-match-interaction cardinality");if(this.cardinality!=="single"&&this.cardinality!=="multiple")throw new c('qti-gap-match-interaction cardinality must be "single" or "multiple"');this.setIsShuffle(this.shuffle==="true"),this.initializeGapMatchGroup(),this.validateChildren()}catch(e){throw this.isQtiValid=!1,console.log("[QtiGapMatchInteraction][ValidationError]",e.name,e.message),new c(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.processGroupUI(this.priorState===null?null:this.priorState.value)}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw console.log("[QtiGapMatchInteraction][ValidationException]",e.message),new c(e.message);if(e.name==="QtiEvaluationException")throw console.log("[QtiGapMatchInteraction][EvaluationException]",e.message),new O(e.message)}},beforeUnmount(){this.matchable!==null&&(this.matchable.destroy(),this.matchable=null)}},rq={ref:"root",class:"qti-gap-match-group-wrapper"};function aq(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",rq,[l.renderSlot(e.$slots,"default")],512)}const oq=B(nq,[["render",aq]]);class lq{constructor(t){this.constants={QTI_SELECTIONS_LIGHT:"qti-selections-light",QTI_SELECTIONS_DARK:"qti-selections-dark",QTI_UNSELECTED_HIDDEN:"qti-unselected-hidden",QTI_CHOICES_TOP:"qti-choices-top",QTI_CHOICES_BOTTOM:"qti-choices-bottom",QTI_CHOICES_LEFT:"qti-choices-left",QTI_CHOICES_RIGHT:"qti-choices-right",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message",DATA_CHOICES_CONTAINER_WIDTH:null},this.parentClass=t,this.clazzTokens=[],this.ggmGroupElement=null,this.ggmChoiceWrapperElement=null,this.ggmTargetWrapperElement=null,this.image=null,this.choicesContainerWidth=null,this.gapChoices=[],this.gaps=[],this.presentation_Choices_Orientation=null,this.presentation_Theme=this.constants.QTI_SELECTIONS_DARK,this.presentation_UnselectedHidden=!1,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage=""}initialize(t,i,s,n,r,a,o){this.ggmGroupElement=t,this.ggmChoiceWrapperElement=i,this.ggmTargetWrapperElement=s,this.image=n,this.choicesContainerWidth=r,this.gapChoices=a,this.gaps=o,this.processRootClassAttribute(this.parentClass),this.processPresentation()}processRootClassAttribute(t){const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case this.constants.QTI_CHOICES_TOP:case this.constants.QTI_CHOICES_BOTTOM:case this.constants.QTI_CHOICES_LEFT:case this.constants.QTI_CHOICES_RIGHT:this.presentation_Choices_Orientation=i[s];break;case this.constants.QTI_SELECTIONS_DARK:case this.constants.QTI_SELECTIONS_LIGHT:this.presentation_Theme=i[s];break;case this.constants.QTI_UNSELECTED_HIDDEN:this.presentation_UnselectedHidden=!0;break}this.clazzTokens=i}processPresentation(){this.presentation_Choices_Orientation===null&&(this.presentation_Choices_Orientation=this.constants.QTI_CHOICES_TOP),this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_LEFT?(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.ggmGroupElement.classList.add(this.constants.QTI_CHOICES_LEFT)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_TOP?(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_RIGHT?(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.ggmGroupElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.ggmGroupElement.insertBefore(this.ggmTargetWrapperElement,this.ggmChoiceWrapperElement)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_BOTTOM&&(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.ggmGroupElement.insertBefore(this.ggmTargetWrapperElement,this.ggmChoiceWrapperElement)),this.processBackgroundImage(),this.processChoicesContainerWidth(),this.processGaps()}processBackgroundImage(){if(this.image===null)return;this.image.setAttribute("draggable","false");const t=this.image.getBoundingClientRect();this.ggmTargetWrapperElement.style.width=`${t.width}px`,this.ggmTargetWrapperElement.style.height=`${t.height}px`}processChoicesContainerWidth(){this.choicesContainerWidth!==null&&(this.ggmChoiceWrapperElement.style.width=`${this.choicesContainerWidth}px`,this.ggmChoiceWrapperElement.style.textAlign="center")}processGaps(){for(let t=0;t<this.gaps.length;t++){const i=this.gaps[t];this.setGapStyle(i,i.getShape(),i.getShapeData()),this.gaps[t].$refs.gap.classList.add("target",this.presentation_Theme),this.presentation_UnselectedHidden&&this.gaps[t].$refs.gap.classList.add(this.constants.QTI_UNSELECTED_HIDDEN)}}setGapStyle(t,i,s){switch(i){case"rect":t.$refs.gap.style.left=`${s[0]}px`,t.$refs.gap.style.top=`${s[1]}px`,t.$refs.gap.style.width=`${s[2]}px`,t.$refs.gap.style.height=`${s[3]}px`;break}}}class cq{constructor(t,i){J(this,"options",{interactionSubType:"default",cardinality:"multiple",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null,zindex:1e3});return this.qtiAttributeValidation=new G,this.wrapper=t,this.sourcewrapper=this.wrapper.querySelector(".qti-ggm-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-ggm-target-wrapper"),this.processOptions(i),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragMove=this.handleDragMove.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.itemTarget=null,this.itemStart=null,this.isItemStartSource=!0,this.savedGapZindex="",this.initialX=0,this.initialY=0,this.offsetX=0,this.offsetY=0,this.startingX=0,this.startingY=0,this.currentAssociationsCount=0,this.isDisabled=!1,this.currentDragger=null,this.initializeSources(this.sourcewrapper),this.initializeTargets(this.targetwrapper),this.restoreResponse(this.options.response),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.draggers.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleDragStart(t){if(t.preventDefault(),!this.isDisabled&&t.button==0)return this.interactionStart(t.target,t.clientX,t.clientY,!1),!1}handleTouchStart(t){if(t.preventDefault(),!this.isDisabled)return t.targetTouches.length!=1||this.interactionStart(t.target,t.touches[0].pageX,t.touches[0].pageY,!0),!1}interactionStart(t,i,s,n){const r=this.getClosestElement(t,"draggable");this.itemStart=r.parentNode,this.isItemStartSource=this.itemStart.classList.contains("source"),this.isItemStartSource||this.saveGapZindex(this.itemStart),this.identifyTargets(this.itemStart,!0),this.itemTarget=null;const a=r.getBoundingClientRect();this.initialX=i,this.initialY=s,this.startingX=a.left,this.startingY=a.top,this.offsetX=i-this.startingX,this.offsetY=s-this.startingY,this.addPlaceholder(r),r.classList.add("dragging"),r.style.userSelect="none",r.style.width=a.width+"px",r.style.height=a.height+"px",r.style.transform=`translateX(${a.left}px) translateY(${a.top}px) translateZ(0)`,this.setCurrentDragger(r),this.addListeners(r,n)}handleDragMove(t){t.preventDefault(),!this.isDisabled&&this.interactionMove(t.clientX,t.clientY)}handleTouchMove(t){t.preventDefault(),!this.isDisabled&&t.targetTouches.length==1&&this.interactionMove(t.touches[0].clientX,t.touches[0].clientY)}interactionMove(t,i){const s=this.currentDragger;this.offsetX=t-this.initialX,this.offsetY=i-this.initialY,this.constrainDraggerToWrapper(s,this.wrapper),s.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0) scale(1)`;const n=s.getBoundingClientRect();this.findDraggerItemTarget(s,n,this.targets),this.isItemStartSource||this.findSourceDraggerTarget(s,n)}constrainDraggerToWrapper(t,i){const s=t.getBoundingClientRect(),n=i.getBoundingClientRect(),r=this.startingX+this.offsetX-n.x,a=this.startingY+this.offsetY-n.y,o=this.startingX+s.width+this.offsetX-(n.x+n.width),u=this.startingY+s.height+this.offsetY-(n.y+n.height);r<0&&(this.offsetX=this.offsetX-r),o>0&&(this.offsetX=this.offsetX-o),a<0&&(this.offsetY=this.offsetY-a),u>0&&(this.offsetY=this.offsetY-u)}handleDragEnd(t){this.isDisabled||this.interactionEnd(t.clientX,t.clientY,!1)}handleTouchEnd(t){this.isDisabled||this.interactionEnd(t.changedTouches[0].clientX,t.changedTouches[0].clientY,!0)}interactionEnd(t,i,s){const n=this.currentDragger;if(this.itemTarget===null?n.style.transform=`translateX(${this.startingX}px) translateY(${this.startingY}px) translateZ(0)`:n.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0)`,n.removeAttribute("style"),n.classList.remove("dragging"),this.clearTargetHighlights(),this.itemTarget===null){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemTarget.classList.contains("active")){if(this.itemTarget.classList.remove("active"),this.isExceedingMaxAssociations(this.itemStart,this.itemTarget,n)){this.resetDraggerToItemStart(this.itemStart,n),this.notifyAssociationsLimit(),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemStart.getAttribute("data-identifier")===this.itemTarget.getAttribute("data-identifier")){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}this.removePlaceholder(n),this.setDraggerToItemTarget(this.itemTarget,n),this.itemTarget.classList.contains("source")&&(this.itemTarget.classList.add("full"),this.itemTarget.dataset.matchMax*1>0&&this.incrementRemaining(this.itemTarget),this.decrementAssociationsCount(),this.sortContainerElements(this.sourcewrapper)),this.itemStart.classList.contains("source")&&(this.itemStart.dataset.matchMax*1>0&&this.decrementRemaining(this.itemStart)===0&&this.itemStart.classList.remove("full"),this.incrementAssociationsCount()),this.itemStart.classList.contains("target")&&(this.restoreGapZindex(this.itemStart),this.isTargetFull(this.itemStart)?this.itemStart.classList.add("full","contains-choice"):(this.itemStart.classList.remove("full"),this.containsChoices(this.itemStart)?this.itemStart.classList.add("contains-choice"):this.itemStart.classList.remove("contains-choice"))),this.notifyUpdate()}this.setCurrentDragger(null),this.removeListeners(n,s)}setCurrentDragger(t){this.currentDragger=t}resetDraggerToItemStart(t,i){t.classList.contains("target")&&this.restoreGapZindex(t),this.replacePlaceholder(i)}setDraggerToItemTarget(t,i){if(t.classList.contains("source")){this.appendDraggerToSourceTarget(t,i);return}this.appendDraggerToGapTarget(t,i),this.isTargetFull(t)?t.classList.add("full"):t.classList.remove("full")}appendDraggerToSourceTarget(t,i){if(t.classList.contains("full")){const s=t.querySelector(".draggable");s!=null&&t.replaceChild(i,s);return}t.append(i)}appendDraggerToGapTarget(t,i){t.classList.add("contains-choice"),t.append(i)}findDraggerItemTarget(t,i,s){this.itemTarget=null,s.forEach(n=>{const r=n.getBoundingClientRect();if(i.top+t.offsetHeight/2<r.bottom&&i.right-t.offsetWidth/2>r.left&&i.bottom-t.offsetHeight/2>r.top&&i.left+t.offsetWidth/2<r.right){if(this.isItemStartSource&&n.classList.contains("source")||n.classList.contains("full")||!this.hasMatchingMatchGroup(t.parentNode,n))return;n.classList.add("active"),this.itemTarget=n}else n.classList.remove("active")},this)}findSourceDraggerTarget(t,i){const s=this.sourcewrapper.getBoundingClientRect();if(i.top+t.offsetHeight/2<s.bottom&&i.right-t.offsetWidth/2>s.left&&i.bottom-t.offsetHeight/2>s.top&&i.left+t.offsetWidth/2<s.right){for(let n=0;n<this.sources.length;n++)if(this.sources[n].dataset.identifier===t.dataset.identifier){this.sources[n].classList.add("active"),this.itemTarget=this.sources[n];break}}else for(let n=0;n<this.sources.length;n++)this.sources[n].classList.contains("active")&&this.sources[n].classList.remove("active")}addPlaceholder(t){if(!t.parentNode.classList.contains("source")){this.addPlaceholderElement(t,!1);return}const i=t.parentNode.dataset.matchMax*1;if(i===1){this.addPlaceholderElement(t,!1);return}if(i===0){this.addPlaceholderElement(t,!0);return}if(this.getRemaining(t.parentNode)===1){this.addPlaceholderElement(t,!1);return}this.addPlaceholderElement(t,!0)}addPlaceholderElement(t,i){const s=t.cloneNode(!0);this.deepCloneId(s),i?(s.classList.add("clone"),s.addEventListener("mousedown",this.handleDragStart),s.addEventListener("touchstart",this.handleTouchStart)):s.classList.add("ggm-dragger-placeholder"),s.classList.add("placeholder-fade"),t.parentNode.insertBefore(s,t)}removePlaceholder(t){if(t.parentNode.classList.contains("target")){const n=t.parentNode.querySelector(".ggm-dragger-placeholder");if(n===null)return;t.parentNode.removeChild(n);return}const i=t.parentNode.dataset.matchMax*1,s=t.parentNode.querySelector(".ggm-dragger-placeholder");if(s===null){const n=t.parentNode.querySelector(".clone");if(n===null)return;n.classList.remove("placeholder-fade");return}i!==0&&t.parentNode.removeChild(s)}replacePlaceholder(t){const i=t.parentNode;let s=i.querySelector(".ggm-dragger-placeholder");if(i.classList.contains("source")){if(s==null&&(s=i.querySelector(".draggable")),s===null)return;i.replaceChild(t,s);return}s!==null&&i.replaceChild(t,s)}addClonePlaceholder(t){const i=t.cloneNode(!0);this.deepCloneId(i),i.classList.add("clone"),t.parentNode.insertBefore(i,t),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)}initializeSources(t){this.sources=t.querySelectorAll(".source"),this.sources.forEach(i=>{i.classList.add("full");const s=i.dataset.matchMax*1;this.setRemaining(i,s===0?1e3:s)},this),this.draggers=t.querySelectorAll(".draggable"),this.draggers.forEach((i,s)=>{const n=i.parentNode.getAttribute("data-identifier");i.setAttribute("data-identifier",n),i.setAttribute("data-order",s),i.setAttribute("tabindex",0),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)},this)}initializeTargets(t){this.targets=t.querySelectorAll(".target"),this.targets.forEach(i=>{i.setAttribute("tabindex",0)})}identifyTargets(t,i){this.targets.forEach(s=>{i&&!s.classList.contains("full")&&this.hasMatchingMatchGroup(t,s)&&s.classList.add("target-active")},this),i&&!this.isItemStartSource&&this.sourcewrapper.classList.add("target-active")}addListeners(t,i){i?(this.removeListeners(t,i),t.addEventListener("touchmove",this.handleTouchMove),t.addEventListener("touchend",this.handleTouchEnd)):(this.removeListeners(t,i),document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd))}removeListeners(t,i){i?(t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("touchend",this.handleTouchEnd)):(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd))}clearTargetHighlights(){this.targets.forEach(t=>{t.classList.remove("target-active")},this),this.sourcewrapper.classList.remove("target-active")}getClosestElement(t,i){return t?t&&t.classList.contains(i)?t:this.getClosestElement(t.parentElement,i):!1}sortContainerElements(t){let i=[],s=t.children;for(let n=0;n<s.length;n++){const r=s[n].querySelector("div.draggable");r&&i.push([1*r.dataset.order,s[n]])}i.sort(function(n,r){return n[0]-r[0]});for(let n=0;n<i.length;n++)t.appendChild(i[n][1])}saveGapZindex(t){this.savedGapZindex=t.style.zIndex,t.style.zIndex=this.options.zindex}restoreGapZindex(t){t.style.zIndex=this.savedGapZindex}getResponse(){return this.computeResponse()}computeResponse(){let t=[];return this.targets.forEach(i=>{i.querySelectorAll(".draggable").forEach(s=>{t.push(`${s.dataset.identifier} ${i.dataset.identifier}`)})}),t.length===0?null:this.options.cardinality==="single"?t[0]:t}restoreResponse(t){t!==null&&(this.options.cardinality==="single"?this.restoreResponsePair(t):t.forEach(i=>{this.restoreResponsePair(i)},this))}restoreResponsePair(t){const i=this.getPair(t);if(i===null)return;const s=this.findSourceByIdentifier(i.source),n=this.findTargetGapByIdentifier(i.target);if(s===null||n===null)return;const r=s.querySelector(".draggable");r!==null&&(this.cloneOrEmptySourceDragger(s,r),this.restoreSourceDraggerToTarget(n,r))}cloneOrEmptySourceDragger(t,i){const s=t.dataset.matchMax*1;if(s===1){t.classList.remove("full"),this.decrementRemaining(t);return}if(s===0){this.addClonePlaceholder(i);return}if(this.getRemaining(t)===1){t.classList.remove("full"),this.decrementRemaining(t);return}this.decrementRemaining(t),this.addClonePlaceholder(i)}findSourceByIdentifier(t){for(let i=0;i<this.sources.length;i++)if(t===this.sources[i].dataset.identifier)return this.sources[i];return null}findTargetGapByIdentifier(t){for(let i=0;i<this.targets.length;i++)if(t===this.targets[i].dataset.identifier)return this.targets[i];return null}getPair(t){if(t===null)return null;const i=t.split(" ");return i.length!=2?null:{source:i[0],target:i[1]}}restoreSourceDraggerToTarget(t,i){t===null||i===null||(this.appendDraggerToGapTarget(t,i),this.incrementAssociationsCount(),this.isTargetFull(t)&&t.classList.add("full"))}hasMatchingMatchGroup(t,i){return t===null||i===null?!1:t.dataset.matchGroup===i.dataset.matchGroup}isTargetFull(t){if(t==null)return!1;const i=t.querySelectorAll(".draggable"),s=t.dataset.matchMax*1;return s===0?!1:i.length>=s}containsChoices(t){return t==null?!1:t.querySelectorAll(".draggable").length!==0}isExceedingMaxAssociations(t,i){return!(this.options.maxAssociations===0||i.classList.contains("source")||t.classList.contains("target")||this.currentAssociationsCount<this.options.maxAssociations)}initializeAssociationsCount(){this.currentAssociationsCount=0}incrementAssociationsCount(){this.currentAssociationsCount+=1}decrementAssociationsCount(){this.currentAssociationsCount!==0&&(this.currentAssociationsCount-=1)}getRemaining(t){return t.dataset.remaining*1}setRemaining(t,i){t.setAttribute("data-remaining",i)}incrementRemaining(t){const i=t.dataset.remaining*1+1;return t.setAttribute("data-remaining",i),i}decrementRemaining(t){let i=t.dataset.remaining*1-1;return i=i>=0?i:0,t.setAttribute("data-remaining",i),i}deepCloneId(t){t.id&&(t.id=`clone_${this.qtiAttributeValidation.randomString(5,"a")}`);for(let i=0;i<t.children.length;i++)this.deepCloneId(t.children[i])}reset(){this.resetDraggersToSources(),this.initializeAssociationsCount(),this.destroy()}resetDraggersToSources(){this.targets.forEach(t=>{t.querySelectorAll(".draggable").forEach(s=>{const n=this.findSourceByIdentifier(s.getAttribute("data-identifier"));n.classList.contains("full")||(n.classList.contains("full")?t.removeChild(s):(n.append(s),n.classList.add("full")))},this),t.classList.remove("full","contains-choice")},this)}destroy(){this.currentDragger!==null&&(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd)),this.wrapper.querySelectorAll(".draggable").forEach(i=>{i.removeEventListener("touchstart",this.handleTouchStart),i.removeEventListener("touchmove",this.handleTouchMove),i.removeEventListener("touchend",this.handleTouchEnd),i.removeEventListener("mousedown",this.handleDragStart)},this)}}const uq=new G,hq=new ie,dq={emits:["ggmGroupReady","ggmGroupUpdate","ggmGroupAssociationsLimit"],props:{responseIdentifier:{required:!0,type:String},cardinality:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},maxAssociations:{required:!1,type:String,default:"1"},minAssociations:{required:!1,type:String,default:"0"},dataChoicesContainerWidth:{required:!1,type:String,default:null},interactionSubType:{required:!1,type:String,default:"default"},interactionStaticClass:{required:!0,type:String},priorState:{required:!1,type:Object,default:null}},data(){return{image:null,choices:[],order:[],gaps:[],response:null,isShuffle:null,hasPrompt:!1,interactionClassAttribute:null,presentationFactory:null,matchable:null,isQtiValid:!0}},computed:{computedMaxAssociations(){return this.maxAssociations*1}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},disable(){this.matchable!==null&&this.matchable.toggleDisable(!0)},enable(){this.matchable!==null&&this.matchable.toggleDisable(!1)},getChoices(){return this.choices},setIsShuffle(e){this.isShuffle=e},validateChildren(){let e=0,t=0,i=!1;this.$slots.default()[0].children.forEach(s=>{if(uq.isValidSlot(s)){if(s.type.name==="QtiPrompt"){if(e>0||t>0||i)throw new c("Invalid element order. qti-prompt must come before the background image, qti-gap-text's, qti-gap-img's, or qti-associable-hotspot's");if(!this.hasPrompt)return this.hasPrompt=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(s.type.name==="QtiGapText"||s.type.name==="QtiGapImg"){if(t>0)throw new c("Invalid element order. qti-gap-text's and qti-gap-img's must come before qti-associable-hotspot's");return e+=1}if(s.type.name==="QtiAssociableHotspot")return t+=1;throw new c('Node is not one of qti-gap-text, qti-gap-img, or qti-associable-hotspot: "'+s.type.name+'"')}else if(s.type==="img"||s.type==="object"||s.type==="picture"){if(e>0||t>0)throw new c("Invalid element order. Background image must preceed qti-gap-text's, qti-gap-img's and qti-associable-hotspot's");i=!0}})},processChildren(){this.$.subTree.children[0].children[0].children.forEach(t=>{if(t.type==="img"||t.type==="object"||t.type==="picture"){this.image=t.el;return}t.component!==null&&(t.type.name==="QtiGapText"||t.type.name==="QtiGapImg"?this.choices.push(t.component.proxy):t.type.name==="QtiAssociableHotspot"&&this.gaps.push(t.component.proxy))})},insertAfter(e,t){t.parentNode.insertBefore(e,t.nextSibling)},processGroupUI(e){let t=this.createGapChoiceWrapper();if(t==null)return;let i=this.createGapTargetWrapper(),s=this.createContainer(this.priorState);this.processContainerChoices(s,t),this.saveContainerOrder(s),this.presentationFactory.initialize(this.$refs.root,t,i,this.image,this.dataChoicesContainerWidth,this.choices,this.gaps),this.matchable=new cq(this.$refs.root,{interactionSubType:this.interactionSubType,cardinality:this.cardinality,maxAssociations:this.computedMaxAssociations,response:e,onReady:this.handleWidgetReady,onUpdate:this.handleWidgetUpdate,onAssociationsLimit:this.handleAssociationsLimit})},createGapChoiceWrapper(){let e=this.$refs.root.querySelector(".qti-gap-choice");if(e===null)return null;let t=document.createElement("ul");return t.classList.add("qti-ggm-source-wrapper"),this.$refs.root.insertBefore(t,e),t},createGapTargetWrapper(){let e=document.createElement("div");e.classList.add("qti-ggm-target-wrapper"),e.append(this.image);for(let t=0;t<this.gaps.length;t++)e.append(this.gaps[t].$el);return this.$refs.root.append(e),e},createContainer(e){let t=[];return e===null?(this.choices.forEach(s=>{t.push({fixed:s.fixed==="true",node:s})}),this.isShuffle&&hq.shuffleArrayFixed(t),t):(e.state.order.forEach(s=>{const n=this.findChoiceByIdentifier(s,this.choices);n!==null&&t.push({fixed:n.fixed==="true",node:n})},this),t)},processContainerChoices(e,t){this.choices.splice(0,this.choices.length),t.innerHTML="",e.forEach(i=>{t.appendChild(i.node.$el),this.choices.push(i.node)},this)},saveContainerOrder(e){const t=[];e.forEach(i=>{t.push(i.node.identifier)}),this.order=t},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Gap Match Interaction State Invalid. Choice identifier "'+e+'" not found.')},resetGroupUI(){this.processGroupUI(null)},handleWidgetReady(e){this.setResponse(e.response),this.$emit("ggmGroupReady",{response:this.getResponse(),order:this.order})},handleWidgetUpdate(e){this.setResponse(e.response),this.$emit("ggmGroupUpdate",{response:this.getResponse()})},handleAssociationsLimit(){this.$emit("ggmGroupAssociationsLimit")},initializeGraphicGapMatchGroup(){this.presentationFactory=new lq(this.interactionStaticClass)}},created(){try{if(typeof this.cardinality>"u")throw new c("Undefined qti-graphic-gap-match-interaction cardinality");if(this.cardinality!=="multiple")throw new c('qti-graphic-gap-match-interaction cardinality must be "multiple"');this.setIsShuffle(this.shuffle==="true"),this.initializeGraphicGapMatchGroup(),this.validateChildren()}catch(e){throw this.isQtiValid=!1,console.log("[QtiGapMatchInteraction][ValidationError]",e.name,e.message),new c(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.processGroupUI(this.priorState===null?null:this.priorState.value)}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw console.log("[QtiGapMatchInteraction][ValidationException]",e.message),new c(e.message);if(e.name==="QtiEvaluationException")throw console.log("[QtiGapMatchInteraction][EvaluationException]",e.message),new O(e.message)}},beforeUnmount(){this.matchable!==null&&(this.matchable.destroy(),this.matchable=null)}},fq={ref:"root",class:"qti-ggm-group-wrapper"};function pq(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",fq,[l.renderSlot(e.$slots,"default")],512)}const mq=B(dq,[["render",pq]]);class gq{constructor(){this.constants={QTI_CHOICES_TOP:"qti-choices-top",QTI_CHOICES_BOTTOM:"qti-choices-bottom",QTI_CHOICES_LEFT:"qti-choices-left",QTI_CHOICES_RIGHT:"qti-choices-right",QTI_MATCH_TABULAR:"qti-match-tabular",QTI_HEADER_HIDDEN:"qti-header-hidden",ROW_CENTRIC:"row-centric",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message",DATA_FIRST_COLUMN_HEADER:""},this.interactionSubType="default",this.parentClass="",this.clazzTokens=[],this.matchWrapperElement=null,this.matchGroupNode=null,this.matchSetNode1=null,this.matchSetNode2=null,this.choices1=[],this.choices2=[],this.presentation_Choices_Orientation=null,this.presentation_Header_Hidden=!1,this.presentation_Row_Centric=!1,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage=""}initialize(t,i,s,n,r){this.interactionSubType=t,this.matchWrapperElement=i,this.matchGroupNode=s,this.parentClass=s.matchInteractionStaticClass,this.matchSetNode1=n,this.matchSetNode2=r,this.choices1=this.matchSetNode1.getChoices(),this.choices2=this.matchSetNode2.getChoices(),this.processRootClassAttribute(this.parentClass),this.processPresentation()}processRootClassAttribute(t){const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case this.constants.QTI_CHOICES_TOP:case this.constants.QTI_CHOICES_BOTTOM:case this.constants.QTI_CHOICES_LEFT:case this.constants.QTI_CHOICES_RIGHT:this.presentation_Choices_Orientation=i[s];break;case this.constants.QTI_MATCH_TABULAR:break;case this.constants.QTI_HEADER_HIDDEN:this.presentation_Header_Hidden=!0;break;case this.constants.ROW_CENTRIC:this.presentation_Row_Centric=!0;break}this.clazzTokens=i}processPresentation(){this.matchSetNode1.$refs.matchset.classList.add("qti-match-source-wrapper"),this.matchSetNode2.$refs.matchset.classList.add("qti-match-target-wrapper"),this.interactionSubType==="default"?(this.presentation_Choices_Orientation===null&&(this.presentation_Choices_Orientation=this.constants.QTI_CHOICES_TOP),this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_LEFT?(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_LEFT),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_LEFT)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_TOP?(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_TOP),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_TOP)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_RIGHT?(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_RIGHT),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_RIGHT),this.matchWrapperElement.insertBefore(this.matchSetNode2.$refs.matchset,this.matchSetNode1.$refs.matchset)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_BOTTOM&&(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.matchWrapperElement.insertBefore(this.matchSetNode2.$refs.matchset,this.matchSetNode1.$refs.matchset)),this.updateMatchSetChoices(this.matchSetNode1,!0),this.updateMatchSetChoices(this.matchSetNode2,!1)):this.interactionSubType==="matchtabular"&&(this.createMatchTable(),this.matchSetNode1.$refs.matchset.classList.add("matchset-hidden"),this.matchSetNode2.$refs.matchset.classList.add("matchset-hidden"))}updateMatchSetChoices(t,i){const s=t.getChoices();for(let n=0;n<s.length;n++)i?(s[n].$refs.choice.classList.add("source"),s[n].$refs.description.classList.add("draggable")):(s[n].$refs.choice.classList.add("target"),s[n].$refs.description.classList.add("match-target-label"))}createMatchTable(){const t=document.createElement("table");this.clazzTokens.forEach(i=>{t.classList.add(i)}),t.classList.add("matchtabular","table","table-bordered"),this.matchWrapperElement.insertBefore(t,this.matchSetNode1.$refs.matchset)}}class yq{constructor(t,i){J(this,"options",{interactionSubType:"default",cardinality:"single",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null});return this.qtiAttributeValidation=new G,this.wrapper=t,this.sourcewrapper=this.wrapper.querySelector(".qti-match-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-match-target-wrapper"),this.processOptions(i),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragMove=this.handleDragMove.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.itemTarget=null,this.itemStart=null,this.isItemStartSource=!0,this.initialX=0,this.initialY=0,this.offsetX=0,this.offsetY=0,this.startingX=0,this.startingY=0,this.currentAssociationsCount=0,this.isDisabled=!1,this.currentDragger=null,this.initializeSources(this.sourcewrapper),this.initializeTargets(this.targetwrapper),this.restoreResponse(this.options.response),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.draggers.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleDragStart(t){if(t.preventDefault(),!this.isDisabled&&t.button==0)return this.interactionStart(t.target,t.clientX,t.clientY,!1),!1}handleTouchStart(t){if(t.preventDefault(),!this.isDisabled)return t.targetTouches.length!=1||this.interactionStart(t.target,t.touches[0].pageX,t.touches[0].pageY,!0),!1}interactionStart(t,i,s,n){const r=this.getClosestElement(t,"draggable");this.itemStart=r.parentNode,this.isItemStartSource=this.itemStart.classList.contains("source"),this.identifyTargets(this.itemStart,!0),this.itemTarget=null;const a=r.getBoundingClientRect();this.initialX=i,this.initialY=s,this.startingX=a.left,this.startingY=a.top,this.offsetX=i-this.startingX,this.offsetY=s-this.startingY,this.addPlaceholder(r),r.style.userSelect="none",r.style.width=a.width+"px",r.style.height=a.height+"px",r.style.transform=`translateX(${a.left}px) translateY(${a.top}px) translateZ(0)`,r.classList.add("dragging"),this.setCurrentDragger(r),this.addListeners(r,n)}handleDragMove(t){t.preventDefault(),!this.isDisabled&&this.interactionMove(t.clientX,t.clientY)}handleTouchMove(t){t.preventDefault(),!this.isDisabled&&t.targetTouches.length==1&&this.interactionMove(t.touches[0].clientX,t.touches[0].clientY)}interactionMove(t,i){const s=this.currentDragger;this.offsetX=t-this.initialX,this.offsetY=i-this.initialY,this.constrainDraggerToWrapper(s,this.wrapper),s.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0) scale(1)`;const n=s.getBoundingClientRect();this.findDraggerItemTarget(s,n,this.targets),this.isItemStartSource||this.findSourceDraggerTarget(s,n)}constrainDraggerToWrapper(t,i){const s=t.getBoundingClientRect(),n=i.getBoundingClientRect(),r=this.startingX+this.offsetX-n.x,a=this.startingY+this.offsetY-n.y,o=this.startingX+s.width+this.offsetX-(n.x+n.width),u=this.startingY+s.height+this.offsetY-(n.y+n.height);r<0&&(this.offsetX=this.offsetX-r),o>0&&(this.offsetX=this.offsetX-o),a<0&&(this.offsetY=this.offsetY-a),u>0&&(this.offsetY=this.offsetY-u)}handleDragEnd(t){this.isDisabled||this.interactionEnd(t.clientX,t.clientY,!1)}handleTouchEnd(t){this.isDisabled||this.interactionEnd(t.changedTouches[0].clientX,t.changedTouches[0].clientY,!0)}interactionEnd(t,i,s){const n=this.currentDragger;if(this.itemTarget===null?n.style.transform=`translateX(${this.startingX}px) translateY(${this.startingY}px) translateZ(0)`:n.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0)`,n.removeAttribute("style"),n.classList.remove("dragging"),this.clearTargetHighlights(),this.itemTarget===null){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemTarget.classList.contains("active")){if(this.itemTarget.classList.remove("active"),this.isExceedingMaxAssociations(this.itemStart,this.itemTarget,n)){this.resetDraggerToItemStart(this.itemStart,n),this.notifyAssociationsLimit(),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemStart.getAttribute("data-identifier")===this.itemTarget.getAttribute("data-identifier")){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}this.removePlaceholder(n),this.setDraggerToItemTarget(this.itemTarget,n),this.itemTarget.classList.contains("source")&&(this.itemTarget.classList.add("full"),this.itemTarget.dataset.matchMax*1>0&&this.incrementRemaining(this.itemTarget),this.decrementAssociationsCount(),this.sortContainerElements(this.sourcewrapper)),this.itemStart.classList.contains("source")&&(this.itemStart.dataset.matchMax*1>0&&this.decrementRemaining(this.itemStart)===0&&this.itemStart.classList.remove("full"),this.incrementAssociationsCount()),this.itemStart.classList.contains("target")&&(this.isTargetFull(this.itemStart)?this.itemStart.classList.add("full"):this.itemStart.classList.remove("full")),this.notifyUpdate()}this.setCurrentDragger(null),this.removeListeners(n,s)}setCurrentDragger(t){this.currentDragger=t}resetDraggerToItemStart(t,i){this.replacePlaceholder(i),t.classList.contains("source")||i.setAttribute("style","width:100%")}setDraggerToItemTarget(t,i){if(t.classList.contains("source")){if(t.classList.contains("full")){const s=t.querySelector(".draggable");s!=null&&t.replaceChild(i,s);return}t.append(i);return}t.append(i),i.setAttribute("style","width:100%"),this.isTargetFull(t)?t.classList.add("full"):t.classList.remove("full")}findDraggerItemTarget(t,i,s){this.itemTarget=null,s.forEach(n=>{const r=n.getBoundingClientRect();if(i.top+t.offsetHeight/2<r.bottom&&i.right-t.offsetWidth/2>r.left&&i.bottom-t.offsetHeight/2>r.top&&i.left+t.offsetWidth/2<r.right){if(this.isItemStartSource&&n.classList.contains("source")||n.classList.contains("full")||!this.hasMatchingMatchGroup(t.parentNode,n))return;n.classList.add("active"),this.itemTarget=n}else n.classList.remove("active")},this)}findSourceDraggerTarget(t,i){const s=this.sourcewrapper.getBoundingClientRect();if(i.top+t.offsetHeight/2<s.bottom&&i.right-t.offsetWidth/2>s.left&&i.bottom-t.offsetHeight/2>s.top&&i.left+t.offsetWidth/2<s.right){for(let n=0;n<this.sources.length;n++)if(this.sources[n].dataset.identifier===t.dataset.identifier){this.sources[n].classList.add("active"),this.itemTarget=this.sources[n];break}}else for(let n=0;n<this.sources.length;n++)this.sources[n].classList.contains("active")&&this.sources[n].classList.remove("active")}addPlaceholder(t){if(!t.parentNode.classList.contains("source")){this.addPlaceholderElement(t,!1);return}const i=t.parentNode.dataset.matchMax*1;if(i===1){this.addPlaceholderElement(t,!1);return}if(i===0){this.addPlaceholderElement(t,!0);return}if(this.getRemaining(t.parentNode)===1){this.addPlaceholderElement(t,!1);return}this.addPlaceholderElement(t,!0)}addPlaceholderElement(t,i){const s=t.cloneNode(!0);this.deepCloneId(s),i?(s.classList.add("clone"),s.addEventListener("mousedown",this.handleDragStart),s.addEventListener("touchstart",this.handleTouchStart)):s.classList.add("match-dragger-placeholder"),s.classList.add("placeholder-fade"),t.parentNode.insertBefore(s,t)}removePlaceholder(t){if(t.parentNode.classList.contains("target")){const n=t.parentNode.querySelector(".match-dragger-placeholder");if(n===null)return;t.parentNode.removeChild(n);return}const i=t.parentNode.dataset.matchMax*1,s=t.parentNode.querySelector(".match-dragger-placeholder");if(s===null){const n=t.parentNode.querySelector(".clone");if(n===null)return;n.classList.remove("placeholder-fade");return}i!==0&&t.parentNode.removeChild(s)}replacePlaceholder(t){const i=t.parentNode;let s=i.querySelector(".match-dragger-placeholder");if(i.classList.contains("source")){if(s==null&&(s=i.querySelector(".draggable")),s===null)return;i.replaceChild(t,s);return}s!==null&&i.replaceChild(t,s)}addClonePlaceholder(t){const i=t.cloneNode(!0);this.deepCloneId(i),i.classList.add("clone"),t.parentNode.insertBefore(i,t),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)}initializeSources(t){this.sources=t.querySelectorAll(".source"),this.sources.forEach(i=>{i.classList.add("full");const s=i.dataset.matchMax*1;this.setRemaining(i,s===0?1e3:s)},this),this.draggers=t.querySelectorAll(".draggable"),this.draggers.forEach((i,s)=>{const n=i.parentNode.getAttribute("data-identifier");i.setAttribute("data-identifier",n),i.setAttribute("data-order",s),i.setAttribute("tabindex",0),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)},this)}initializeTargets(t){this.targets=t.querySelectorAll(".target"),this.targets.forEach(i=>{i.setAttribute("tabindex",0)})}identifyTargets(t,i){this.targets.forEach(s=>{i&&!s.classList.contains("full")&&this.hasMatchingMatchGroup(t,s)&&s.classList.add("target-active")},this),i&&!this.isItemStartSource&&this.sourcewrapper.classList.add("target-active")}addListeners(t,i){i?(this.removeListeners(t,i),t.addEventListener("touchmove",this.handleTouchMove),t.addEventListener("touchend",this.handleTouchEnd)):(this.removeListeners(t,i),document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd))}removeListeners(t,i){i?(t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("touchend",this.handleTouchEnd)):(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd))}clearTargetHighlights(){this.targets.forEach(t=>{t.classList.remove("target-active")},this),this.sourcewrapper.classList.remove("target-active")}getClosestElement(t,i){return t?t&&t.classList.contains(i)?t:this.getClosestElement(t.parentElement,i):!1}sortContainerElements(t){let i=[],s=t.children;for(let n=0;n<s.length;n++){const r=s[n].querySelector("div.draggable");r&&i.push([1*r.dataset.order,s[n]])}i.sort(function(n,r){return n[0]-r[0]});for(let n=0;n<i.length;n++)t.appendChild(i[n][1])}getResponse(){return this.computeResponse()}computeResponse(){let t=[];return this.targets.forEach(i=>{i.querySelectorAll(".draggable").forEach(s=>{t.push(`${s.dataset.identifier} ${i.dataset.identifier}`)})}),t.length===0?null:this.options.cardinality==="single"?t[0]:t}restoreResponse(t){t!==null&&(this.options.cardinality==="single"?this.restoreResponsePair(t):t.forEach(i=>{this.restoreResponsePair(i)},this))}restoreResponsePair(t){const i=this.getPair(t);if(i===null)return;const s=this.findSourceByIdentifier(i.source),n=this.findTargetGapByIdentifier(i.target);if(s===null||n===null)return;const r=s.querySelector(".draggable");r!==null&&(this.cloneOrEmptySourceDragger(s,r),this.restoreSourceDraggerToTarget(n,r))}cloneOrEmptySourceDragger(t,i){const s=t.dataset.matchMax*1;if(s===1){t.classList.remove("full"),this.decrementRemaining(t);return}if(s===0){this.addClonePlaceholder(i);return}if(this.getRemaining(t)===1){t.classList.remove("full"),this.decrementRemaining(t);return}this.decrementRemaining(t),this.addClonePlaceholder(i)}findSourceByIdentifier(t){for(let i=0;i<this.sources.length;i++)if(t===this.sources[i].dataset.identifier)return this.sources[i];return null}findTargetGapByIdentifier(t){for(let i=0;i<this.targets.length;i++)if(t===this.targets[i].dataset.identifier)return this.targets[i];return null}getPair(t){if(t===null)return null;const i=t.split(" ");return i.length!=2?null:{source:i[0],target:i[1]}}restoreSourceDraggerToTarget(t,i){t===null||i===null||(t.append(i),i.setAttribute("style","width:100%"),this.incrementAssociationsCount(),this.isTargetFull(t)&&t.classList.add("full"))}hasMatchingMatchGroup(t,i){return t===null||i===null?!1:t.dataset.matchGroup===i.dataset.matchGroup}isTargetFull(t){if(t==null)return!1;const i=t.querySelectorAll(".draggable"),s=t.dataset.matchMax*1;return s===0?!1:i.length>=s}isExceedingMaxAssociations(t,i){return!(this.options.maxAssociations===0||i.classList.contains("source")||t.classList.contains("target")||this.currentAssociationsCount<this.options.maxAssociations)}initializeAssociationsCount(){this.currentAssociationsCount=0}incrementAssociationsCount(){this.currentAssociationsCount+=1}decrementAssociationsCount(){this.currentAssociationsCount!==0&&(this.currentAssociationsCount-=1)}getRemaining(t){return t.dataset.remaining*1}setRemaining(t,i){t.setAttribute("data-remaining",i)}incrementRemaining(t){const i=t.dataset.remaining*1+1;return t.setAttribute("data-remaining",i),i}decrementRemaining(t){let i=t.dataset.remaining*1-1;return i=i>=0?i:0,t.setAttribute("data-remaining",i),i}deepCloneId(t){t.id&&(t.id=`clone_${this.qtiAttributeValidation.randomString(5,"a")}`);for(let i=0;i<t.children.length;i++)this.deepCloneId(t.children[i])}reset(){this.resetDraggersToSources(),this.initializeAssociationsCount(),this.destroy()}resetDraggersToSources(){this.targets.forEach(t=>{t.querySelectorAll(".draggable").forEach(s=>{const n=this.findSourceByIdentifier(s.getAttribute("data-identifier"));n.classList.contains("full")||(t.classList.remove("full"),n.classList.contains("full")?t.removeChild(s):(n.append(s),n.classList.add("full")))},this)},this)}destroy(){this.currentDragger!==null&&(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd)),this.wrapper.querySelectorAll(".draggable").forEach(i=>{i.removeEventListener("touchstart",this.handleTouchStart),i.removeEventListener("touchmove",this.handleTouchMove),i.removeEventListener("touchend",this.handleTouchEnd),i.removeEventListener("mousedown",this.handleDragStart)},this)}}class wq{constructor(t,i){J(this,"options",{interactionSubType:"matchtabular",isHeaderHidden:!1,isRowCentric:!1,firstColumnHeader:null,cardinality:"single",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null});J(this,"keyCodes",{Enter:13,Space:32,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40});return this.wrapper=t,this.table=this.wrapper.querySelector("table.matchtabular"),this.sourcewrapper=this.wrapper.querySelector(".qti-match-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-match-target-wrapper"),this.currentAssociationsCount=0,this.isDisabled=!1,this.processOptions(i),this.handleClick=this.handleClick.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.state=new Map,this.initializeTable(this.sourcewrapper,this.targetwrapper),this.restoreResponse(),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"isHeaderHidden"in t&&(this.options.isHeaderHidden=t.isHeaderHidden),"isRowCentric"in t&&(this.options.isRowCentric=t.isRowCentric),"firstColumnHeader"in t&&(this.options.firstColumnHeader=t.firstColumnHeader),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.controls.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleClick(t){if(!this.isDisabled){if(this.isRadio(t.target)){this.setControlChecked(t.target);return}this.toggleControl(t.target)}}handleKeydown(t){let i=!1;switch(t.code){case"Space":case"Enter":this.isDisabled||this.toggleControl(t.target),i=!0;break;case"ArrowUp":case"ArrowLeft":i=!0;break;case"ArrowDown":case"ArrowRight":i=!0;break}i&&(t.stopPropagation(),t.preventDefault())}handleFocus(){}handleBlur(){}toggleControl(t){if(!this.isChecked(t)){if(this.isExceedingMaxAssociations()){this.notifyAssociationsLimit();return}if(this.isExceedingMatchMax(t.dataset.pair,t.dataset.sourceMax*1,!0)||this.isExceedingMatchMax(t.dataset.pair,t.dataset.targetMax*1,!1))return;this.updateState(t.dataset.pair,this.toggleChecked(t)),this.notifyUpdate();return}this.updateState(t.dataset.pair,this.toggleChecked(t)),this.notifyUpdate()}setControlChecked(t){if(!this.isChecked(t)){if(this.isExceedingMaxAssociations()){this.notifyAssociationsLimit();return}if(this.isExceedingMatchMax(t.dataset.pair,t.dataset.sourceMax*1,!0)||this.isExceedingMatchMax(t.dataset.pair,t.dataset.targetMax*1,!1))return;this.updateState(t.dataset.pair,this.setChecked(t,!0)),this.notifyUpdate();return}this.updateState(t.dataset.pair,this.setChecked(t,!0)),this.notifyUpdate()}setChecked(t,i){const s=i?"true":"false";return t.setAttribute("aria-checked",s),s}toggleChecked(t){const s=t.getAttribute("aria-checked")==="true"?"false":"true";return t.setAttribute("aria-checked",s),s}isRadio(t){return t===null?!1:t.getAttribute("role")==="radio"}isChecked(t){return t===null?!1:t.getAttribute("aria-checked")==="true"}setTabIndex(t){this.tabIndex=t}setFocus(){}setBlur(){}updateState(t,i){this.state.set(t,i),this.currentAssociationsCount=0;for(let s of this.state.values())s==="true"&&(this.currentAssociationsCount+=1)}initializeTable(t,i){this.sources=this.getChoices(t),this.targets=this.getChoices(i);const s=`width:${this.getColumnWidthPercentage(this.targets.length)}%`;this.table.innerHTML=`${this.getHeader(s)}${this.getBody(s)}`,this.controls=this.table.querySelectorAll(".control-cell"),this.controls.forEach(n=>{const r=n.getAttribute("data-pair");this.updateState(r,"false"),n.addEventListener("click",this.handleClick),n.addEventListener("keydown",this.handleKeydown),n.addEventListener("focus",this.handleFocus),n.addEventListener("blur",this.handleBlur)},this)}getHeader(t){if(this.options.isHeaderHidden)return"";let i=`<th scope="col" class="header-cell">${this.options.firstColumnHeader==null?"":this.options.firstColumnHeader}</th>`;return this.options.isRowCentric?(i+=this.getSourceHeader(t),`<thead>${i}</thead>`):(i+=this.getTargetHeader(t),`<thead>${i}</thead>`)}getTargetHeader(t){let i="";return this.targets.forEach(s=>{i+=`<th scope="col" class="header-cell" style="${t}">${s.innerHTML}</th>`}),i}getSourceHeader(t){let i="";return this.sources.forEach(s=>{i+=`<th scope="col" class="header-cell" style="${t}">${s.innerHTML}</th>`}),i}getBody(t){let i="";return this.options.isRowCentric?(this.targets.forEach(s=>{i+=`<tr><th scope="row" class="row-header-cell">${s.innerHTML}</th>`;const n=s.getAttribute("data-match-max");this.sources.forEach(r=>{const a=r.getAttribute("data-match-max"),o=r.getAttribute("data-identifier"),u=s.getAttribute("data-identifier"),h=`${o} ${u}`;i+=`<td class="table-cell" style="${t}">
|
167
|
+
</svg>`;const t={theme:"snow",boundary:"div.qti-extended-text-interaction",modules:{toolbar:{container:[["undo","redo"],["bold","italic","underline"],["blockquote"],[{list:"ordered"},{list:"bullet"}]],handlers:{redo(){this.quill.history.redo()},undo(){this.quill.history.undo()}}},history:{delay:2e3,maxStack:100,userOnly:!1},keyboard:{bindings:{tab:{key:9,handler:function(){return!0}}}}},placeholder:this.placeholder,readOnly:!1};this.quill=new Y(this.$refs.editor,t),this.quill.root.setAttribute("spellcheck",!1),this.quill.on("text-change",this.textChangeHandler),this.updateCounter(this.getLength()),this.quill.enable(!0)}},setQuillEditorStyleProperties(){this.$refs.editor!=null&&this.$refs.editor.children!=null&&this.$refs.editor.children.length>0&&(this.$refs.editor.children[0].style=`width:${this.editorHeight};overflow-x:auto;`)},textChangeHandler(){let e=this.getText(),t=this.$refs.editor.children[0].innerHTML,i=this.getLength();if(this.expectedLength&&i>this.expectedLength){this.quill.deleteText(this.expectedLength,i);return}t==="<p><br></p>"&&(t=""),this.updateCounter(this.getLength()),this.$emit("input",{html:t,text:e})},updateCounter(e){if(this.showCounter){if(this.isCounterUp){this.counter=e;return}this.counter=this.computedExpectedLength-e}},getLength(){return this.quill.getLength()-1},getText(){return this.quill.getText()}},mounted(){this.initialize(),this.setQuillEditorStyleProperties(),this.$emit("editorReady",{node:this})},beforeUnmount(){this.$el&&this.quill.off("text-change",this.textChangeHandler),this.$el.remove(),this.quill=void 0}},qR={ref:"root",class:"quill-editor vertical-rl"},OR={key:0,"aria-hidden":"true",class:"ext-text-xhtml-vert-rl-counter"},BR={key:0};function PR(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",qR,[l.createElementVNode("div",{ref:"label",style:l.normalizeStyle(r.styleLabel),class:"ext-text-xhtml-vert-label qti-hidden"},null,4),l.createElementVNode("div",{ref:"editor",style:l.normalizeStyle(r.style)},null,4),r.showCounter?(l.openBlock(),l.createElementBlock("div",OR,[l.createTextVNode(l.toDisplayString(n.counter),1),r.isCounterUp?(l.openBlock(),l.createElementBlock("span",BR," / "+l.toDisplayString(i.expectedLength),1)):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)],512)}const DR={name:"ExtendedTextXhtmlVerticalRl",components:{EditorQuillVerticalRl:B(kR,[["render",PR]])},props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},placeholder:{required:!1,type:String,default:""},heightClass:{required:!1,type:String,default:""},counterStyle:{required:!1,type:String,default:"none"}},computed:{computedExpectedLength(){return typeof this.expectedLength<"u"?this.expectedLength:"400"},colorStyle(){return _.getItemContextPnp().getColorStyle()},editorHeight(){return this.heightClass==="qti-height-lines-15"?"25.9rem":this.heightClass==="qti-height-lines-6"?"11.5rem":"6.7rem"},labelHeight(){return this.heightClass==="qti-height-lines-15"?"29.7rem":this.heightClass==="qti-height-lines-6"?"12.3rem":"6.6rem"},maxLength(){return 1e4},disabled(){return this.isDisabled}},data(){return{response:"",content:"",state:null,editor:null,isDisabled:!1}},inheritAttrs:!1,methods:{getResponse(){return this.response},setResponse(e){if(e===null){this.response="",this.setContent("");return}this.setContent(e),this.response=e},updateResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getContent(){return this.content},setContent(e){this.content=e},computeState(e){return{text:e}},setIsDisabled(e){this.isDisabled=e},handleInput(e){e.html&&(this.updateResponse(e.html),this.setState(this.computeState(e.text)),this.$parent.$emit("extendedTextUpdate",{response:this.getResponse()}))},handleEditorReady(e){this.node=e.node,this.$parent.$emit("extendedTextReady",{node:this})}},mounted(){}},QR={ref:"root"};function HR(e,t,i,s,n,r){const a=l.resolveComponent("EditorQuillVerticalRl");return l.openBlock(),l.createElementBlock("div",QR,[l.createVNode(a,{content:n.content,placeholder:i.placeholder,editorHeight:r.editorHeight,labelHeight:r.labelHeight,counterStyle:i.counterStyle,expectedLength:r.computedExpectedLength,disabled:r.disabled,onInput:r.handleInput,onEditorReady:r.handleEditorReady},null,8,["content","placeholder","editorHeight","labelHeight","counterStyle","expectedLength","disabled","onInput","onEditorReady"])],512)}const FR=B(DR,[["render",HR]]),jt={DEFAULT:"default-plain",DEFAULT_SBAC:"sbac-plain",DEFAULT_LRN:"lrn-plain",DEFAULT_VERTICAL_RL:"vertical-rl-plain",XHTML_DEFAULT:"default-xhtml",XHTML_SBAC:"sbac-xhtml",XHTML_VERTICAL_RL:"vertical-rl-xhtml"};function UR(e,t,i){switch(e){case jt.XHTML_DEFAULT:case jt.XHTML_SBAC:return{template:'<extended-text-xhtml-default response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextXhtmlDefault:RR}};case jt.DEFAULT_LRN:return{template:'<extended-text-plain-lrn response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextPlainLrn:ZI}};case jt.DEFAULT_VERTICAL_RL:return{template:'<extended-text-plain-vertical-rl response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextPlainVerticalRl:oV}};case jt.XHTML_VERTICAL_RL:return{template:'<extended-text-xhtml-vertical-rl response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextXhtmlVerticalRl:FR}};default:return{template:'<extended-text-plain-default response-identifier="'+t.responseIdentifier+'" '+Ia(t)+Sa(t)+xa(t)+_a(t)+Va(t)+Aa(t)+$a(i)+" />",components:{ExtendedTextPlainDefault:QI}}}}function GR(e,t){const i=jR(e);if(i&&t==="plain")return jt.DEFAULT_SBAC;if(i&&t==="xhtml")return jt.XHTML_DEFAULT;if(WR(e)&&t==="plain")return jt.DEFAULT_LRN;const n=zR(e);return n&&t==="plain"?jt.DEFAULT_VERTICAL_RL:n&&t==="xhtml"?jt.XHTML_VERTICAL_RL:t==="plain"?jt.DEFAULT:t==="xhtml"?jt.XHTML_DEFAULT:jt.DEFAULT}function Sa(e){return typeof e.patternMask>"u"?"":'pattern-mask="'+e.patternMask+'" '}function xa(e){return'pattern-mask-message="'+e.patternMaskMessage+'" '}function _a(e){return'placeholder="'+e.placeholder+'" '}function Ia(e){return typeof e.expectedLength>"u"?"":'expected-length="'+e.expectedLength+'" '}function Va(e){return typeof e.heightClass>"u"?"":'height-class="'+e.heightClass+'" '}function Aa(e){return typeof e.counterStyle>"u"?"none":'counter-style="'+e.counterStyle+'" '}function $a(e){let t="";for(const[i,s]of Object.entries(e))t+=`${i}="${s}" `;return t}function jR(e){return typeof e>"u"||e===null||e.length==0?!1:kh("sbac",e)}function WR(e){return typeof e>"u"||e===null||e.length==0?!1:kh("lrn",e)}function zR(e){return typeof e>"u"||e===null||e.length==0?!1:kh("qti-writing-orientation-vertical-rl",e)}function kh(e,t){const i=t.split(" ");for(let s=0;s<i.length;s++)if(i[s]===e)return!0;return!1}const La=new G,KR=new ie,YR={name:"QtiExtendedTextInteraction",props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},patternMask:{required:!1,type:String},placeholderText:{required:!1,type:String},format:{required:!1,type:String,default:"plain"},dataPatternmaskMessage:{required:!1,type:String},minStrings:{required:!1,type:String,default:"0"},maxStrings:{required:!1,type:String,default:"0"}},computed:{interactionTemplate(){return UR(this.interactionSubType,this.createComponentProperties(),this.$attrs)},placeholder(){return La.validatePlaceholderText(this.placeholderText,"")},hasPatternMask(){return typeof this.patternMask<"u"},patternMaskMessage(){return La.validatePatternmaskMessage(this.dataPatternmaskMessage,"Invalid Input")}},data(){return{response:"",state:null,baseType:"string",cardinality:"single",interactionSubType:null,isValidResponse:!1,invalidResponseMessage:"Input Required",classAttribute:"",isDisabled:!1,isQtiValid:!0,hasPrompts:!1,presentationFactory:null,node:null,priorState:null}},methods:{getResponse(){return this.response.length===0?null:this.response},setResponse(e){e===null?this.response="":this.response=e,this.node.setResponse(this.response,!0)},updateResponse(e){e===null?this.response="":this.response=e},getState(){return this.state},setState(e){this.state=e,this.node.setState(this.state,!0)},updateState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},disable(){this.toggleDisable(!0)},enable(){this.toggleDisable(!1)},toggleDisable(e){this.isDisabled=e,this.node.setIsDisabled(e)},getInvalidResponseMessage(){return this.invalidResponseMessage},initializeValue(){this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},restoreValue(e){this.setResponse(e.value),this.setState(e.state),this.updateValidity(this.computeIsValid())},getCardinality(){return this.cardinality},computeState(){return{}},computeIsValid(){const e=this.minStrings*1;if(e===0)return!0;if(this.response===null)return!1;const t=this.response.trim();return!(t.length<1||KR.computeWordCount(t)<e)},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},detectInteractionSubType(e,t){return GR(e,t)},createComponentProperties(){return{responseIdentifier:this.responseIdentifier,expectedLength:this.presentationFactory.getExpectedLength(),placeholder:this.placeholder,patternMask:this.patternMask,patternMaskMessage:this.patternMaskMessage,heightClass:this.presentationFactory.getHeightClass(),counterStyle:this.presentationFactory.getCounterStyle()}},handleExtendedTextUpdate(e){this.updateResponse(e.response),"state"in e&&this.updateState(e.state),this.evaluateValidity()},handleExtendedTextReady(e){this.node=e.node,this.priorState===null?this.initializeValue():this.restoreValue(this.priorState)},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Extended Text Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Extended Text Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=La.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class,this.format)),this.presentationFactory=new Yx(this.$.vnode.props.class,this.expectedLength),La.validateMaxMinStrings(this.maxStrings,this.minStrings),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.hasPrompts=this.getPrompts(this.$slots).length>0,this.appliedRegex=La.validatePattern("pattern-mask",this.patternMask)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{_.defineInteraction({identifier:this.responseIdentifier,interactionType:"ExtendedText",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage()}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},XR={ref:"root",class:"qti-extended-text-interaction"},ZR={ref:"prompt",class:"qti-prompt-wrapper"};function JR(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",XR,[l.createElementVNode("div",ZR,[l.renderSlot(e.$slots,"default")],512),(l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.interactionTemplate),{ref:"textarea",onExtendedTextUpdate:r.handleExtendedTextUpdate,onExtendedTextReady:r.handleExtendedTextReady},null,40,["onExtendedTextUpdate","onExtendedTextReady"]))],512)}const ek=B(YR,[["render",JR]]);class tk{constructor(t){return this.constants={QTI_ORIENTATION_HORIZONTAL:"qti-orientation-horizontal",QTI_ORIENTATION_VERTICAL:"qti-orientation-vertical",QTI_INPUT_WIDTH_DEFAULT:"",QTI_INPUT_WIDTH_1:"qti-input-width-1",QTI_INPUT_WIDTH_2:"qti-input-width-2",QTI_INPUT_WIDTH_3:"qti-input-width-3",QTI_INPUT_WIDTH_4:"qti-input-width-4",QTI_INPUT_WIDTH_5:"qti-input-width-5",QTI_INPUT_WIDTH_6:"qti-input-width-6",QTI_INPUT_WIDTH_10:"qti-input-width-10",QTI_INPUT_WIDTH_15:"qti-input-width-15",QTI_INPUT_WIDTH_20:"qti-input-width-20",QTI_INPUT_WIDTH_25:"qti-input-width-25",QTI_INPUT_WIDTH_30:"qti-input-width-30",QTI_INPUT_WIDTH_35:"qti-input-width-35",QTI_INPUT_WIDTH_40:"qti-input-width-40",QTI_INPUT_WIDTH_45:"qti-input-width-45",QTI_INPUT_WIDTH_50:"qti-input-width-50",QTI_INPUT_WIDTH_72:"qti-input-width-72"},this.classList=t,this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL,this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_DEFAULT,this.presentation_MaxLength=8,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_ORIENTATION_VERTICAL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_VERTICAL;break;case this.constants.QTI_ORIENTATION_HORIZONTAL:this.presentation_OrientationClass=this.constants.QTI_ORIENTATION_HORIZONTAL;break;case this.constants.QTI_INPUT_WIDTH_1:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_1,this.presentation_MaxLength=1;break;case this.constants.QTI_INPUT_WIDTH_2:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_2,this.presentation_MaxLength=2;break;case this.constants.QTI_INPUT_WIDTH_3:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_3,this.presentation_MaxLength=3;break;case this.constants.QTI_INPUT_WIDTH_4:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_4,this.presentation_MaxLength=4;break;case this.constants.QTI_INPUT_WIDTH_5:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_5,this.presentation_MaxLength=5;break;case this.constants.QTI_INPUT_WIDTH_6:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_6,this.presentation_MaxLength=6;break;case this.constants.QTI_INPUT_WIDTH_10:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_10,this.presentation_MaxLength=10;break;case this.constants.QTI_INPUT_WIDTH_15:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_15,this.presentation_MaxLength=15;break;case this.constants.QTI_INPUT_WIDTH_20:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_20,this.presentation_MaxLength=20;break;case this.constants.QTI_INPUT_WIDTH_25:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_25,this.presentation_MaxLength=25;break;case this.constants.QTI_INPUT_WIDTH_30:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_30,this.presentation_MaxLength=30;break;case this.constants.QTI_INPUT_WIDTH_35:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_35,this.presentation_MaxLength=35;break;case this.constants.QTI_INPUT_WIDTH_40:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_40,this.presentation_MaxLength=40;break;case this.constants.QTI_INPUT_WIDTH_45:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_45,this.presentation_MaxLength=45;break;case this.constants.QTI_INPUT_WIDTH_50:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_50,this.presentation_MaxLength=50;break;case this.constants.QTI_INPUT_WIDTH_72:this.presentation_WidthClass=this.constants.QTI_INPUT_WIDTH_72,this.presentation_MaxLength=500;break}}getOrientationClass(){return this.presentation_OrientationClass}isOrientationVertical(){return this.presentation_OrientationClass==this.constants.QTI_ORIENTATION_VERTICAL}getWidthClass(){return this.presentation_WidthClass}getVerticalMaxLength(){return this.presentation_MaxLength}}const ik=new G,sk={name:"TextEntryPlainDefault",emits:["textEntryReady","textEntryUpdate"],components:{Tooltip:sa},props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},placeholder:{required:!1,type:String,default:""},patternMask:{required:!1,type:String},patternMaskMessage:{required:!1,type:String,default:"Invalid Input"},spellcheck:{required:!1,type:String,default:"false"},maxlength:{required:!1,type:String,default:"500"}},computed:{computedExpectedLength(){return typeof this.expectedLength<"u"?this.expectedLength*1:400},hasPatternMask(){return typeof this.patternMask<"u"},colorStyle(){return _.getItemContextPnp().getColorStyle()},disabled(){return this.isDisabled}},data(){return{response:"",priorResponse:"",appliedRegex:null,displayMessage:!1,isDisabled:!1}},methods:{getResponse(){return this.response},setResponse(e){if(e===null){this.response="";return}this.response=e},getState(){return this.state},setState(e){this.state=e},setIsDisabled(e){if(this.isDisabled=e,e){const t=this.getResponse();this.$refs.label.innerHTML=t===null?"":t,this.$refs.label.classList.remove("qti-hidden"),this.$refs.label.setAttribute("tabIndex",0),this.$refs.input.classList.add("qti-hidden"),(t===null||t.length===0)&&(this.$refs.label.style.paddingRight="1.1rem")}else this.$refs.label.classList.add("qti-hidden"),this.$refs.label.setAttribute("tabIndex",-1),this.$refs.input.classList.remove("qti-hidden")},handleInput(e){e.preventDefault();let t=!0;this.appliedRegex!==null?t=this.applyPatternMask(this.$refs.input.value):this.setResponse(this.$refs.input.value),t&&(this.priorResponse=this.$refs.input.value,this.$parent.$emit("textEntryUpdate",{response:this.getResponse()}))},getLength(){return this.response.length},applyPatternMask(e){return this.appliedRegex.test(e)?(this.setResponse(e),this.priorResponse=e,!0):(this.showPatternMaskMessage(),this.setResponse(this.priorResponse),!1)},showPatternMaskMessage(){this.$refs.tooltip.show(),this.hidePatternMaskMessage()},hidePatternMaskMessage(e=3e3){setTimeout(()=>{this.$refs.tooltip.hide()},e)}},created(){this.appliedRegex=ik.validatePattern("pattern-mask",this.patternMask)},mounted(){this.$parent.$emit("textEntryReady",{node:this})}},nk={ref:"root"},rk={ref:"label",class:"text-entry-default-label qti-hidden"},ak=["placeholder","disabled","spellcheck","maxlength"];function ok(e,t,i,s,n,r){const a=l.resolveComponent("tooltip");return l.openBlock(),l.createElementBlock("span",nk,[l.createElementVNode("span",rk,null,512),l.withDirectives(l.createElementVNode("input",l.mergeProps({ref:"input",class:"text-entry-default"},e.$attrs,{"onUpdate:modelValue":t[0]||(t[0]=o=>n.response=o),type:"text",placeholder:i.placeholder,disabled:r.disabled,autocapitalize:"none",spellcheck:i.spellcheck,maxlength:i.maxlength,onInput:t[1]||(t[1]=(...o)=>r.handleInput&&r.handleInput(...o))}),null,16,ak),[[l.vModelText,n.response]]),r.hasPatternMask?(l.openBlock(),l.createBlock(a,{key:0,ref:"tooltip",target:()=>e.$refs.input,message:i.patternMaskMessage,"color-style":r.colorStyle},null,8,["target","message","color-style"])):l.createCommentVNode("",!0)],512)}const ow=B(sk,[["render",ok]]),lk=new G,ck={name:"TextEntryPlainDefaultVertical",emits:["textEntryReady","textEntryUpdate"],components:{Tooltip:sa},props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},placeholder:{required:!1,type:String,default:""},patternMask:{required:!1,type:String},patternMaskMessage:{required:!1,type:String,default:"Invalid Input"},spellcheck:{required:!1,type:String,default:"false"},widthClass:{required:!1,type:String,default:""},maxlength:{required:!1,type:String,default:"8"}},computed:{computedExpectedLength(){return typeof this.expectedLength<"u"?this.expectedLength*1:400},hasPatternMask(){return typeof this.patternMask<"u"},colorStyle(){return _.getItemContextPnp().getColorStyle()},disabled(){return this.isDisabled}},data(){return{response:"",priorResponse:"",appliedRegex:null,displayMessage:!1,caretIndex:0,maxlengthMessage:"",isDisabled:!1}},inheritAttrs:!1,methods:{getResponse(){return this.response},setResponse(e,t=!1){e===null?this.response="":this.response=e,t&&this.updateContent(this.response)},getState(){return this.state},setState(e){this.state=e},setIsDisabled(e){if(this.isDisabled=e,e){const t=this.getResponse();this.$refs.label.innerHTML=t===null?"":t,this.$refs.label.classList.remove("qti-hidden"),this.$refs.label.setAttribute("tabIndex",0),this.$refs.input.classList.add("qti-hidden"),this.hidePlaceholder()}else this.$refs.label.classList.add("qti-hidden"),this.$refs.label.setAttribute("tabIndex",-1),this.$refs.input.classList.remove("qti-hidden"),this.getContent().length===0?this.showPlaceholder():this.hidePlaceholder()},getContent(){return this.$refs.input.innerText},updateContent(e){this.$refs.input.innerText=e,e.length>0?this.hidePlaceholder():this.showPlaceholder()},getCaretIndex(){return this.caretIndex},setCaretIndex(e){this.caretIndex=e},handleInput(e){e.preventDefault();let t=!0;this.setCaretIndex(this.getCaretPos(this.$refs.input)-1);const i=this.getContent();i.length>0&&this.hidePlaceholder(),this.applyLimitCheck(i)&&(this.appliedRegex!==null?t=this.applyPatternMask(i):this.setResponse(i),t&&(i.length==0&&this.showPlaceholder(),this.priorResponse=i,this.$parent.$emit("textEntryUpdate",{response:this.getResponse()})))},handlePaste(e){e.preventDefault();const t=this.getRange();if(t===null)return;const i=this.getContent(),s=t.startOffset,n=t.endOffset;let r=e.clipboardData.getData("text/plain"),a=i.substring(0,s)+r+i.substring(n),o=!0;if(a.length>0&&this.hidePlaceholder(),a.length>this.maxlength){this.showMaxlengthMessage(),this.setResponse(this.priorResponse,!0),this.setCaretPos(this.$refs.input,s);return}this.appliedRegex!==null?o=this.applyPatternMask(a):this.setResponse(a,!0),o&&(this.setCaretIndex(s+r.length),this.setCaretPos(this.$refs.input,this.getCaretIndex()),this.priorResponse=a,this.$parent.$emit("textEntryUpdate",{response:this.getResponse()}))},handleDrop(e){e.preventDefault()},handleKeydown(e){switch(this.setCaretIndex(this.getCaretPos(this.$refs.input)),e.code){case"Enter":e.preventDefault();return;case"KeyI":case"KeyB":case"KeyU":e.ctrlKey&&e.preventDefault();return}},newDownRange(e){const t=e.firstChild,i=this.getRange();if(i===null)return;const s=i.startOffset,n=i.endOffset;if(n===this.getResponse().length)return;const r=window.getSelection();r.removeAllRanges();const a=document.createRange();a.setStart(t,s),a.setEnd(t,n+1),r.addRange(a)},newUpRange(e){const t=e.firstChild,i=this.getRange();if(i===null)return;const s=i.startOffset,n=i.endOffset;if(s===0)return;const r=window.getSelection();r.removeAllRanges();const a=document.createRange();a.setStart(t,s-1),a.setEnd(t,n),r.addRange(a)},getRange(){const e=document.getSelection();return e.rangeCount===0?null:e.getRangeAt(0)},getCaretPos(e){let t=0;if(typeof window.getSelection<"u"&&window.getSelection().rangeCount!==0){const n=window.getSelection().getRangeAt(0),r=n.cloneRange();r.selectNodeContents(e),r.setEnd(n.endContainer,n.endOffset),t=r.toString().length}return t},setCaretPos(e,t){e.focus(),e.childNodes.length===1&&document.getSelection().collapse(e.childNodes[0],t)},showPlaceholder(){this.$refs.placeholder.classList.remove("text-entry-ph-hidden")},hidePlaceholder(){this.$refs.placeholder.classList.add("text-entry-ph-hidden")},handleBlur(){this.$refs.root.classList.remove("focused")},handleFocus(){this.$refs.root.classList.add("focused")},getLength(){return this.response.length},applyLimitCheck(e){return e.length>this.maxlength?(this.showMaxlengthMessage(),this.setResponse(this.priorResponse,!0),this.setCaretPos(this.$refs.input,this.getCaretIndex()),!1):!0},applyPatternMask(e){return this.appliedRegex.test(e)?(this.setResponse(e),this.priorResponse=e,!0):(this.showPatternMaskMessage(),this.setResponse(this.priorResponse,!0),this.setCaretPos(this.$refs.input,this.getCaretIndex()),!1)},showPatternMaskMessage(){this.$refs.tooltip.show(),this.hidePatternMaskMessage()},hidePatternMaskMessage(e=3e3){setTimeout(()=>{this.$refs.tooltip.hide()},e)},showMaxlengthMessage(){this.$refs.tooltipMaxlength.show(),this.hideMaxlengthMessage()},hideMaxlengthMessage(e=1e3){setTimeout(()=>{this.$refs.tooltipMaxlength.hide()},e)},computeMaxlengthMessage(){this.maxlengthMessage=`Maximum of ${this.maxlength} character`+(this.maxlength==="1"?"":"s")}},created(){this.appliedRegex=lk.validatePattern("pattern-mask",this.patternMask),this.computeMaxlengthMessage()},mounted(){this.$parent.$emit("textEntryReady",{node:this})}},uk=["spellcheck","maxlength","disabled"];function hk(e,t,i,s,n,r){const a=l.resolveComponent("tooltip");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref:"root",class:"text-entry-default-vert-wrapper"},e.$attrs),[l.createElementVNode("div",{ref:"label",class:"text-entry-default-vert-label qti-hidden",onFocus:t[0]||(t[0]=(...o)=>r.handleFocus&&r.handleFocus(...o)),onBlur:t[1]||(t[1]=(...o)=>r.handleBlur&&r.handleBlur(...o))},null,544),l.createElementVNode("div",{ref:"input",class:"text-entry-default-vert",tabindex:"0",contenteditable:"true",autocapitalize:"false",spellcheck:i.spellcheck,maxlength:i.maxlength,disabled:r.disabled,onInput:t[2]||(t[2]=(...o)=>r.handleInput&&r.handleInput(...o)),onBlur:t[3]||(t[3]=(...o)=>r.handleBlur&&r.handleBlur(...o)),onFocus:t[4]||(t[4]=(...o)=>r.handleFocus&&r.handleFocus(...o)),onKeydown:t[5]||(t[5]=(...o)=>r.handleKeydown&&r.handleKeydown(...o)),onPaste:t[6]||(t[6]=(...o)=>r.handlePaste&&r.handlePaste(...o)),onDrop:t[7]||(t[7]=(...o)=>r.handleDrop&&r.handleDrop(...o))},null,40,uk),l.createElementVNode("label",{ref:"placeholder",class:"text-entry-default-vert-ph","aria-hidden":"true"},l.toDisplayString(i.placeholder),513),r.hasPatternMask?(l.openBlock(),l.createBlock(a,{key:0,ref:"tooltip",target:()=>e.$refs.input,message:i.patternMaskMessage,"color-style":r.colorStyle},null,8,["target","message","color-style"])):l.createCommentVNode("",!0),l.createVNode(a,{ref:"tooltipMaxlength",target:()=>e.$refs.input,message:n.maxlengthMessage,"color-style":r.colorStyle},null,8,["target","message","color-style"])],16)}const dk=B(ck,[["render",hk]]),Ll={DEFAULT:"default-plain-horizontal",DEFAULT_VERTICAL:"default-plain-vertical"};function fk(e,t,i){switch(e){case Ll.DEFAULT:return{template:'<text-entry-plain-default response-identifier="'+t.responseIdentifier+'" '+Ph(t)+qh(t)+Oh(t)+Bh(t)+Dh(t)+Qh(t)+lw(t)+Hh(i)+" />",components:{TextEntryPlainDefault:ow}};case Ll.DEFAULT_VERTICAL:return{template:'<text-entry-plain-default-vertical response-identifier="'+t.responseIdentifier+'" '+Ph(t)+qh(t)+Oh(t)+Bh(t)+Dh(t)+Qh(t)+mk(t)+gk(t)+Hh(i)+" />",components:{TextEntryPlainDefaultVertical:dk}};default:return{template:'<text-entry-plain-default response-identifier="'+t.responseIdentifier+'" '+Ph(t)+qh(t)+Oh(t)+Bh(t)+Dh(t)+Qh(t)+lw(t)+Hh(i)+" />",components:{TextEntryPlainDefault:ow}}}}function pk(e){return yk(e)?Ll.DEFAULT_VERTICAL:Ll.DEFAULT}function qh(e){return typeof e.patternMask>"u"?"":'pattern-mask="'+e.patternMask+'" '}function Oh(e){return'pattern-mask-message="'+e.patternMaskMessage+'" '}function Bh(e){return'placeholder="'+e.placeholder+'" '}function Ph(e){return typeof e.expectedLength>"u"?"":'expected-length="'+e.expectedLength+'" '}function Dh(e){return typeof e.format>"u"||e.format.length==0?"":'format="'+e.format+'" '}function Qh(e){return typeof e.spellcheck>"u"?"":'spellcheck="'+e.spellcheck+'" '}function lw(e){return typeof e.maxlength>"u"?"":'maxlength="'+e.maxlength+'" '}function mk(e){return typeof e.widthClass>"u"?"":'width-class="'+e.widthClass+'" '}function gk(e){return typeof e.verticalMaxlength>"u"?"":'maxlength="'+e.verticalMaxlength+'" '}function Hh(e){let t="";for(const[i,s]of Object.entries(e))t+=`${i}="${s}" `;return t}function yk(e){return typeof e>"u"||e===null||e.length==0?!1:cw("qti-writing-orientation-vertical-rl",e)?!0:cw("qti-orientation-vertical",e)}function cw(e,t){const i=t.split(" ");for(let s=0;s<i.length;s++)if(i[s]===e)return!0;return!1}const Ml=new G,wk={name:"QtiTextEntryInteraction",props:{responseIdentifier:{required:!0,type:String},expectedLength:{required:!1,type:String},patternMask:{required:!1,type:String},placeholderText:{required:!1,type:String},format:{required:!1,type:String,default:""},dataPatternmaskMessage:{required:!1,type:String},dataMaxlength:{required:!1,type:String},dataSpellcheck:{required:!1,type:String}},computed:{interactionTemplate(){return fk(this.interactionSubType,this.createComponentProperties(),this.$attrs)},placeholder(){return Ml.validatePlaceholderText(this.placeholderText,"")},hasPatternMask(){return typeof this.patternMask<"u"},patternMaskMessage(){return Ml.validatePatternmaskMessage(this.dataPatternmaskMessage,"Invalid Input")},colorStyle(){return _.getItemContextPnp().getColorStyle()},computeMaxlength(){return typeof this.dataMaxlength<"u"?this.dataMaxlength:500},computeSpellcheck(){return typeof this.dataSpellcheck<"u"?this.dataSpellcheck:!1}},data(){return{response:"",state:null,baseType:"string",cardinality:"single",interactionSubType:null,isValidResponse:!1,invalidResponseMessage:"Input Required",classAttribute:"",isDisabled:!1,isQtiValid:!0,presentationFactory:null,node:null,priorState:null}},methods:{getResponse(){return this.response.length===0?null:this.response},setResponse(e){e===null?this.response="":this.response=e,this.node.setResponse(this.response,!0)},updateResponse(e){e===null?this.response="":this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},disable(){this.toggleDisable(!0)},enable(){this.toggleDisable(!1)},toggleDisable(e){this.isDisabled=e,this.node.setIsDisabled(e)},getInvalidResponseMessage(){return this.invalidResponseMessage},initializeValue(){this.setResponse(null),this.setState(this.computeState()),this.setIsValid(!1)},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(!1)},restoreValue(e){this.setResponse(e.value),this.setState(e.state),this.updateValidity(this.computeIsValid())},getCardinality(){return this.cardinality},computeState(){return{}},computeIsValid(){return!(this.response===null||this.response.length<1)},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},detectInteractionSubType(e){return pk(e)},createComponentProperties(){return{responseIdentifier:this.responseIdentifier,placeholder:this.placeholder,patternMask:this.patternMask,patternMaskMessage:this.patternMaskMessage,spellcheck:this.computeSpellcheck,maxlength:this.computeMaxlength,widthClass:this.presentationFactory.getWidthClass(),verticalMaxlength:this.presentationFactory.getVerticalMaxLength(),format:this.format}},handleTextEntryUpdate(e){this.updateResponse(e.response),this.evaluateValidity()},handleTextEntryReady(e){this.node=e.node,this.priorState===null?this.initializeValue():this.restoreValue(this.priorState)},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Text Entry Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Text Entry Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=Ml.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.presentationFactory=new tk(this.$.vnode.props.class),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.appliedRegex=Ml.validatePattern("pattern-mask",this.patternMask)}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.priorState===null?this.initializeValue():this.restoreValue(this.priorState),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"TextEntry",node:this,resetValue:this.resetValue,isValidResponse:this.isValidResponse,invalidResponseMessage:this.getInvalidResponseMessage()}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}};function bk(e,t,i,s,n,r){return l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.interactionTemplate),{ref:"input",class:"qti-text-entry-interaction",onTextEntryUpdate:r.handleTextEntryUpdate,onTextEntryReady:r.handleTextEntryReady},null,40,["onTextEntryUpdate","onTextEntryReady"])}const vk=B(wk,[["render",bk]]),Ek=new G,Tk={name:"QtiMatchInteraction",props:{responseIdentifier:{required:!0,type:String},minAssociations:{required:!1,type:String,default:"0"},maxAssociations:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataFirstColumnHeader:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,matchsets:[],orders:[],cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,hasPrompts:!1,matchInteractionStaticClass:"",interactionSubType:"default",headerHidden:"false",rowCentric:"false",isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.matchgroup.disable()},enable(){this.$refs.matchgroup.enable()},initializeValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.matchgroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleMatchGroupReady(e){this.matchsets=e.matchsets,this.orders=e.orders,this.initializeValue(e.response)},handleMatchGroupUpdate(e){this.setResponse(e.response),this.updateValidity(this.computeIsValid())},handleAssociationsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeState(){return this.priorState!==null?this.priorState.state:{orders:this.orders}},computeIsValid(){const e=this.getResponse(),t=this.minAssociations*1;return t===0?!0:e===null?!1:this.cardinality==="single"||e.length>=t},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxAssociations*1==0?"":"You may make a maximum of "+this.maxAssociations+" match"+(this.maxAssociations*1>1?"es":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minAssociations*1!=0&&(this.minSelectionsMessage="You must make at least "+this.minAssociations+" match"+(this.minAssociations*1>1?"es":"")+" for this question.")},detectInteractionSubType(e){return this.getMatchInteractionSubType(e)},getMatchInteractionSubType(e){let t="default";if(typeof e>"u"||e===null||e.length==0)return t;this.matchInteractionStaticClass=e;const i=e.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case"qti-match-tabular":t="matchtabular";break;case"qti-header-hidden":this.headerHidden="true";break;case"row-centric":this.rowCentric="true";break}return t},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Match Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Match Interaction State Invalid. "state" property not found.');if(!("orders"in t.state))throw new O('Match Interaction State Invalid. "orders" property not found.');return t}},created(){try{if(this.responseDeclaration=Ek.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="single"&&this.cardinality!=="multiple")throw new c('qti-match-interaction cardinality must be "single" or "multiple"');if(this.maxAssociations*1!=1&&this.cardinality!=="multiple")throw new c('qti-match-interaction response variable must have "multiple" cardinality because max-associations is '+this.maxAssociations);if(this.minAssociations*1>1&&this.cardinality==="single")throw new c('qti-match-interaction response variable must have "multiple" cardinality because min-associations is '+this.minAssociations);this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Match",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Ck={ref:"root",class:"qti-match-interaction"},Sk={ref:"prompt",class:"qti-prompt-wrapper"};function xk(e,t,i,s,n,r){const a=l.resolveComponent("MatchGroup");return l.openBlock(),l.createElementBlock("div",Ck,[l.createElementVNode("div",Sk,null,512),l.createVNode(a,l.mergeProps({ref:"matchgroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxAssociations:i.maxAssociations,minAssociations:i.minAssociations,interactionSubType:n.interactionSubType,matchInteractionStaticClass:n.matchInteractionStaticClass,headerHidden:n.headerHidden,rowCentric:n.rowCentric,dataFirstColumnHeader:i.dataFirstColumnHeader,priorState:n.priorState,onMatchGroupReady:r.handleMatchGroupReady,onMatchGroupUpdate:r.handleMatchGroupUpdate,onMatchGroupAssociationsLimit:r.handleAssociationsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxAssociations","minAssociations","interactionSubType","matchInteractionStaticClass","headerHidden","rowCentric","dataFirstColumnHeader","priorState","onMatchGroupReady","onMatchGroupUpdate","onMatchGroupAssociationsLimit"])],512)}const _k=B(Tk,[["render",xk]]),Ik=new G,Vk={name:"QtiGapMatchInteraction",props:{responseIdentifier:{required:!0,type:String},minAssociations:{required:!1,type:String,default:"0"},maxAssociations:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataChoicesContainerWidth:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,choices:[],order:[],cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,hasPrompts:!1,gapMatchInteractionStaticClass:"",interactionSubType:"default",isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.gapmatchgroup.disable()},enable(){this.$refs.gapmatchgroup.enable()},initializeValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.matchgroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleGapMatchGroupReady(e){this.choices=e.choices,this.order=e.order,this.initializeValue(e.response)},handleGapMatchGroupUpdate(e){this.setResponse(e.response),this.updateValidity(this.computeIsValid())},handleAssociationsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeState(){return this.priorState!==null?this.priorState.state:{order:this.order}},computeIsValid(){const e=this.getResponse(),t=this.minAssociations*1;return t===0?!0:e===null?!1:this.cardinality==="single"||e.length>=t},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxAssociations*1==0?"":"You may make a maximum of "+this.maxAssociations+" match"+(this.maxAssociations*1>1?"es":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minAssociations*1!=0&&(this.minSelectionsMessage="You must make at least "+this.minAssociations+" match"+(this.minAssociations*1>1?"es":"")+" for this question.")},detectInteractionSubType(e){return this.computeInteractionSubType(e)},computeInteractionSubType(e){let t="default";return typeof e>"u"||e===null||e.length==0||(this.gapMatchInteractionStaticClass=e),t},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Gap Match Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Gap Match Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Gap Match Interaction State Invalid. "order" property not found.');return t}},created(){try{if(this.responseDeclaration=Ik.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="single"&&this.cardinality!=="multiple")throw new c('qti-gap-match-interaction cardinality must be "single" or "multiple"');if(this.maxAssociations*1!=1&&this.cardinality!=="multiple")throw new c('qti-gap-match-interaction response variable must have "multiple" cardinality because max-associations is '+this.maxAssociations);if(this.minAssociations*1>1&&this.cardinality==="single")throw new c('qti-gap-match-interaction response variable must have "multiple" cardinality because min-associations is '+this.minAssociations);this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"GapMatch",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Ak={ref:"root",class:"qti-gap-match-interaction"},$k={ref:"prompt",class:"qti-prompt-wrapper"};function Lk(e,t,i,s,n,r){const a=l.resolveComponent("GapMatchGroup");return l.openBlock(),l.createElementBlock("div",Ak,[l.createElementVNode("div",$k,null,512),l.createVNode(a,l.mergeProps({ref:"gapmatchgroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxAssociations:i.maxAssociations,minAssociations:i.minAssociations,interactionSubType:n.interactionSubType,gapMatchInteractionStaticClass:n.gapMatchInteractionStaticClass,dataChoicesContainerWidth:i.dataChoicesContainerWidth,priorState:n.priorState,onGapMatchGroupReady:r.handleGapMatchGroupReady,onGapMatchGroupUpdate:r.handleGapMatchGroupUpdate,onGapMatchGroupAssociationsLimit:r.handleAssociationsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxAssociations","minAssociations","interactionSubType","gapMatchInteractionStaticClass","dataChoicesContainerWidth","priorState","onGapMatchGroupReady","onGapMatchGroupUpdate","onGapMatchGroupAssociationsLimit"])],512)}const Mk=B(Vk,[["render",Lk]]),Nk=new G,Rk={name:"QtiGraphicGapMatchInteraction",props:{responseIdentifier:{required:!0,type:String},minAssociations:{required:!1,type:String,default:"0"},maxAssociations:{required:!1,type:String,default:"1"},shuffle:{required:!1,type:String,default:"false"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataChoicesContainerWidth:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,choices:[],order:[],cardinality:"multiple",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,hasPrompts:!1,interactionStaticClass:"",interactionSubType:"default",isQtiValid:!0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.ggmgroup.disable()},enable(){this.$refs.ggmgroup.enable()},initializeValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.matchgroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleGraphicGapMatchGroupReady(e){this.choices=e.choices,this.order=e.order,this.initializeValue(e.response)},handleGraphicGapMatchGroupUpdate(e){this.setResponse(e.response),this.updateValidity(this.computeIsValid())},handleAssociationsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeState(){return this.priorState!==null?this.priorState.state:{order:this.order}},computeIsValid(){const e=this.getResponse(),t=this.minAssociations*1;return t===0?!0:e===null?!1:this.cardinality==="single"||e.length>=t},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxAssociations*1==0?"":"You may make a maximum of "+this.maxAssociations+" match"+(this.maxAssociations*1>1?"es":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minAssociations*1!=0&&(this.minSelectionsMessage="You must make at least "+this.minAssociations+" match"+(this.minAssociations*1>1?"es":"")+" for this question.")},detectInteractionSubType(e){return this.computeInteractionSubType(e)},computeInteractionSubType(e){let t="default";return typeof e>"u"||e===null||e.length==0||(this.interactionStaticClass=e),t},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Gap Match Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Gap Match Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Gap Match Interaction State Invalid. "order" property not found.');return t}},created(){try{if(this.responseDeclaration=Nk.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="multiple")throw new c('qti-graphic-gap-match-interaction cardinality must be "multiple"');this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"GraphicGapMatch",interactionSubType:this.interactionSubType,node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},kk={ref:"root",class:"qti-graphic-gap-match-interaction"},qk={ref:"prompt",class:"qti-prompt-wrapper"};function Ok(e,t,i,s,n,r){const a=l.resolveComponent("GraphicGapMatchGroup");return l.openBlock(),l.createElementBlock("div",kk,[l.createElementVNode("div",qk,null,512),l.createVNode(a,l.mergeProps({ref:"ggmgroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,maxAssociations:i.maxAssociations,minAssociations:i.minAssociations,interactionSubType:n.interactionSubType,interactionStaticClass:n.interactionStaticClass,dataChoicesContainerWidth:i.dataChoicesContainerWidth,priorState:n.priorState,onGgmGroupReady:r.handleGraphicGapMatchGroupReady,onGgmGroupUpdate:r.handleGraphicGapMatchGroupUpdate,onGgmGroupAssociationsLimit:r.handleAssociationsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","maxAssociations","minAssociations","interactionSubType","interactionStaticClass","dataChoicesContainerWidth","priorState","onGgmGroupReady","onGgmGroupUpdate","onGgmGroupAssociationsLimit"])],512)}const Bk=B(Rk,[["render",Ok]]),Pk={},Dk={ref:"root",class:"qti3-player-media-group"};function Qk(e,t){return l.openBlock(),l.createElementBlock("div",Dk,[l.renderSlot(e.$slots,"default")],512)}const uw=B(Pk,[["render",Qk]]),hw=new G,Hk={name:"QtiMediaInteraction",components:[uw],props:{responseIdentifier:{required:!0,type:String},autostart:{required:!1,type:String,default:"false"},minPlays:{required:!1,type:String,default:"0"},maxPlays:{required:!1,type:String,default:"0"},loop:{required:!1,type:String,default:"false"},coords:{required:!1,type:String},dataMaxPlaysMessage:{required:!1,type:String},dataMinPlaysMessage:{required:!1,type:String}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minPlaysMessage:"",maxPlaysMessage:"",responseDeclaration:null,mediaType:"media",isAutostart:!1,isLoop:!1,isDisabled:!1,isQtiValid:!0,hasPrompts:!1,node:null,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},incrementPlays(){let e=this.getResponse();this.setResponse(e===null?1:e+1)},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.node!==null&&this.node.disable()},enable(){this.node!==null&&this.node.enable()},getInvalidResponseMessage(){return this.computeMinPlaysMessage(),this.minPlaysMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.priorState=null,this.setResponse(null),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},restoreValue(e){e!==null&&(this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid()),this.evaluateMaxPlays())},getCardinality(){return this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleMediaMounted(e){this.node=e.node,this.mediaType=e.mediaType,e.mediaType==="audio"&&this.node.setAudioSubType("audioprogress"),this.evaluateMaxPlays()},handleMediaLoaded(e){this.node=e.node,this.evaluateMaxPlays(),this.evaluateAutostart()},handleMediaEnded(){this.incrementPlays(),this.evaluateValidity(),this.evaluateMaxPlays(),this.evaluateLoop()},computeState(){return{}},computeIsValid(){const e=this.minPlays*1;if(e===0)return!0;const t=this.getResponse();return t===null?!1:t>=e},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},evaluateMaxPlays(){this.checkMaxPlaysLimit()?this.disable():this.enable()},evaluateLoop(){this.isLoop&&(this.checkMaxPlaysLimit()||this.isDisabled||this.playMedia())},evaluateAutostart(){this.isAutostart&&(this.checkMaxPlaysLimit()||this.isDisabled||(console.log(`[${this.$options.name}][Identifier=${this.responseIdentifier}][AutoStart]`),this.playMedia()))},playMedia(){if(this.node!=null){if(this.mediaType==="audio")return this.node.playAudio();this.node.playVideo()}},checkMaxPlaysLimit(){if(this.maxPlays*1===0)return!1;const e=this.getResponse();return e!==null&&e==this.maxPlays*1},computeMaxPlaysMessage(){if(typeof this.dataMaxPlaysMessage<"u"){this.maxPlaysMessage=this.dataMaxPlaysMessage;return}const e=this.maxPlays*1;this.maxPlaysMessage=e===0?"":`You are permitted a maximum of ${this.maxPlays} play${e>1?"s":""} for this ${this.mediaType}.`},computeMinPlaysMessage(){if(typeof this.dataMinPlaysMessage<"u"){this.minPlaysMessage=this.dataMinPlaysMessage;return}const e=this.minPlays*1;this.minPlaysMessage=e===0?"":`You must play this ${this.mediaType} to the end at least ${this.minPlays} time${e>1?"s":""}.`},validateChildren(){},processChildren(){this.processMedia(),this.setIsValid(this.computeIsValid()),this.priorState!==null&&this.restoreValue(this.priorState.value)},processMedia(){let e=this.$refs.mediagroup.$el.getElementsByTagName("object");if(e.length!==0)throw new c("Unsupported Media Interaction element. The <object> elemnt is deprecated. Use <video> or <audio> instead.");if(e=this.$refs.mediagroup.$el.getElementsByTagName("video"),e.length===0&&(e=this.$refs.mediagroup.$el.getElementsByTagName("audio")),e.length!==1)throw new c("Media Interaction must have exactly one <video> or <audio> node.")},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Media Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Media Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=hw.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),hw.validateMaxMinPlays(this.maxPlays,this.minPlays),this.hasPrompts=this.getPrompts(this.$slots).length>0,this.isAutostart=this.autostart==="true",this.isLoop=this.loop==="true",this.computeMaxPlaysMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Media",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxPlaysMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},Fk={ref:"root",class:"qti-media-interaction"},Uk={ref:"prompt",class:"qti-prompt-wrapper"};function Gk(e,t,i,s,n,r){const a=l.resolveComponent("MediaGroup");return l.openBlock(),l.createElementBlock("div",Fk,[l.createElementVNode("div",Uk,null,512),l.createVNode(a,{ref:"mediagroup",onMediaMounted:r.handleMediaMounted,onMediaLoaded:r.handleMediaLoaded,onMediaEnded:r.handleMediaEnded},{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},8,["onMediaMounted","onMediaLoaded","onMediaEnded"])],512)}const jk=B(Hk,[["render",Gk]]),Fh=new G,Wk={name:"QtiOrderInteraction",props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String},maxChoices:{required:!1,type:String},shuffle:{required:!1,type:String,default:"false"},orientation:{required:!1,type:String,default:"horizontal"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String},dataChoicesContainerWidth:{required:!1,type:String,default:null}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"ordered",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,interactionSubType:"default",choices:[],isShuffle:!1,hasPrompts:!1,minChoicesValue:null,maxChoicesValue:null,isMinChoicesSpecified:!1,isMaxChoicesSpecified:!1,isQtiValid:!0,priorState:null,originalOrder:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},setInteractionSubType(e){this.interactionSubType=e},getInteractionSubType(){return this.interactionSubType},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return this.minSelectionsMessage},disable(){this.$refs.ordergroup.disable()},enable(){this.$refs.ordergroup.enable()},initializeValue(e){this.setResponse(this.computeResponse(e)),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},initializeOriginalOrder(){if(this.originalOrder!==null)return;let e=[];this.choices.forEach(t=>{e.push(t.identifier)}),this.originalOrder=e},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.setResponse(null),this.setState(null),this.priorState=null,this.$refs.ordergroup.resetGroupUI()},restoreValue(e){this.setResponse(e),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality:"ordered",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){this.hasPrompts&&this.$refs.prompt.appendChild(this.$refs.ordergroup.getPromptElement())},handleOrderGroupReady(e){this.choices=e.choices,this.isMinChoicesSpecified||(this.minChoicesValue=this.choices.length),this.originalOrder===null&&this.initializeOriginalOrder(),this.initializeValue(e.response)},handleOrderGroupUpdate(e){this.setResponse(this.computeResponse(e.response)),this.setState({order:e.response,oorder:this.originalOrder}),this.updateValidity(this.computeIsValid())},handleSelectionsLimit(){_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage)},computeResponse(e){let t=[];typeof e>"u"?this.choices.forEach(s=>{t.push(s.identifier)}):t=e;let i=0;switch(this.interactionSubType){case"default":for(let s=0;s<t.length;s++)t[s]!==this.originalOrder[s]&&(i+=1);break;case"ordermatch":for(let s=0;s<t.length;s++)t[s]!==null&&(i+=1);break}return i===0?null:t},computeOrder(){const e=[];return this.choices.forEach(t=>{e.push(t.identifier)}),e},computeState(){return this.priorState!==null?this.priorState.state:{order:this.computeOrder(),oorder:this.originalOrder}},computeIsValid(){const e=this.getResponse(),t=this.minChoicesValue;if(e===null||e.length!==this.originalOrder.length)return!1;let i=0;switch(this.interactionSubType){case"default":for(let s=0;s<e.length;s++)e[s]!==this.originalOrder[s]&&(i+=1);return this.isMinChoicesSpecified?i>=t:i===t;case"ordermatch":for(let s=0;s<e.length;s++)e[s]!==null&&(i+=1);return this.isMinChoicesSpecified?i>=t:i===e.length}return!1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoicesValue===null?"":"You may set an order for a maximum of "+this.maxChoicesValue+" choice"+(this.maxChoicesValue>1?"s":"")+" for this question."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.isMinChoicesSpecified?this.minSelectionsMessage="You must set the order for at least "+this.minChoicesValue+" choice"+(this.minChoicesValue>1?"s":"")+" for this question.":this.minSelectionsMessage="You must set the order for all choices for this question."},detectInteractionSubType(e){return this.getOrderInteractionSubType(e)},getOrderInteractionSubType(e){if(typeof e>"u"||e===null||e.length==0)return"default";const t=e.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case"qti-choices-top":case"qti-choices-bottom":case"qti-choices-left":case"qti-choices-right":return"ordermatch"}return"default"},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Order Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Order Interaction State Invalid. "state" property not found.');if(!("order"in t.state))throw new O('Order Interaction State Invalid. "order" property not found.');if(!("oorder"in t.state))throw new O('Order Interaction State Invalid. "oorder" property not found.');return this.originalOrder=t.state.oorder,t}},created(){try{if(this.responseDeclaration=Fh.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.setInteractionSubType(this.detectInteractionSubType(this.$.vnode.props.class)),this.priorState=this.getPriorState(this.responseIdentifier),this.cardinality=this.getCardinality(),this.cardinality!=="ordered")throw new c('qti-order-interaction cardinality must be "ordered"');if(this.isShuffle=this.shuffle==="true",this.hasPrompts=this.getPrompts(this.$slots).length>0,typeof this.minChoices<"u"&&(this.isMinChoicesSpecified=!0),this.minChoicesValue=Fh.validateIntegerAttribute("min-choices",this.minChoices,!1,null),this.minChoicesValue===0)throw new c('qti-order-interaction "min-choices", when specified, must not be 0');if(this.isMinChoicesSpecified?(typeof this.maxChoices<"u"&&(this.isMaxChoicesSpecified=!0),this.maxChoicesValue=Fh.validateIntegerAttribute("max-choices",this.maxChoices,!1,null)):this.maxChoicesValue=null,this.isMinChoicesSpecified&&this.isMaxChoicesSpecified&&this.minChoicesValue>this.maxChoicesValue)throw new c('qti-order-interaction "min-choices" must not be greater than "max-choices"');this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Order",node:this,resetValue:this.resetValue,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},zk={ref:"root",class:"qti-order-interaction"},Kk={ref:"prompt",class:"qti-prompt-wrapper"};function Yk(e,t,i,s,n,r){const a=l.resolveComponent("OrderGroup");return l.openBlock(),l.createElementBlock("div",zk,[l.createElementVNode("div",Kk,null,512),l.createVNode(a,l.mergeProps({ref:"ordergroup",cardinality:n.cardinality,shuffle:i.shuffle,responseIdentifier:i.responseIdentifier,orientation:i.orientation,maxChoices:n.maxChoicesValue,minChoices:n.minChoicesValue,interactionSubType:n.interactionSubType,dataChoicesContainerWidth:i.dataChoicesContainerWidth,priorState:n.priorState,onOrderGroupReady:r.handleOrderGroupReady,onOrderGroupUpdate:r.handleOrderGroupUpdate,onOrderGroupSelectionsLimit:r.handleSelectionsLimit},e.$attrs),{default:l.withCtx(()=>[l.renderSlot(e.$slots,"default")]),_:3},16,["cardinality","shuffle","responseIdentifier","orientation","maxChoices","minChoices","interactionSubType","dataChoicesContainerWidth","priorState","onOrderGroupReady","onOrderGroupUpdate","onOrderGroupSelectionsLimit"])],512)}const Xk=B(Wk,[["render",Yk]]);class Zk{constructor(){this.nodes=[]}find(t,i){if(Array.isArray(t))return t.forEach(s=>{var n;if(s.component!==null&&((n=s.component.type)==null?void 0:n.name)===i){this.nodes.push(s.component.proxy);return}Array.isArray(s==null?void 0:s.children)&&this.find(s.children,i)}),this.nodes}findNodes(t,{within:i}){return this.find(i,t)}}class Jk{constructor(t){return this.constants={QTI_UNSELECTED_HIDDEN:"qti-unselected-hidden"},this.classList=t,this.presentation_UnselectedHidden=!1,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_UNSELECTED_HIDDEN:this.presentation_UnselectedHidden=!0;break}}getUnselectedHidden(){return this.presentation_UnselectedHidden}}const dw=new G,e2=new Zk,t2={name:"QtiHottextInteraction",props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String}},inheritAttrs:!0,data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,choices:[],currentChoice:null,isRadio:!0,isDisabled:!1,isQtiValid:!0,hasPrompts:!1,presentationFactory:null,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.toggleDisableChoices(!0)},enable(){this.toggleDisableChoices(!1)},toggleDisableChoices(e){this.isDisabled=e,this.choices.forEach(t=>{t.setIsDisabled(e)})},getInvalidResponseMessage(){return this.minSelectionsMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.choices.forEach(e=>{e.setChecked(!1)}),this.currentChoice=null,this.priorState=null},restoreValue(e){e!==null&&(this.isRadio?this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:e,checked:"true"}}),!0):e.forEach(t=>{this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:t,checked:"true"}}),!0)},this),this.setResponse(this.computeResponse()),this.setState(this.computeState()),this.updateValidity(this.computeIsValid()))},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality!=="multiple"?"single":"multiple":"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleSetChecked(e,t=!1){const i=e.detail;this.choices.forEach(s=>{this.isRadio&&s.setChecked(!1),s.identifier===i.identifier&&(this.currentChoice=s)}),i.checked==="true"?this.checkMaxChoicesLimit()?this.currentChoice.setChecked(!1):this.currentChoice.setChecked(!0):this.currentChoice.setChecked(!1),t||(this.setResponse(this.computeResponse()),this.currentChoice.setFocus(),this.evaluateValidity())},computeResponse(){let e=this.isRadio?null:[];return this.choices.forEach(t=>{t.isChecked()&&(this.isRadio?e=t.identifier:e.push(t.identifier))}),this.isRadio?e:e.length===0?null:e},computeState(){return{}},computeIsValid(){return this.minChoices*1===0?!0:this.response===null?!1:this.cardinality==="single"||this.cardinality==="multiple"&&this.response.length>=this.minChoices*1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},checkMaxChoicesLimit(){if(this.isRadio||this.maxChoices==0)return!1;const e=this.getResponse();return e!==null&&e.length==this.maxChoices?(_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage),!0):!1},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoices==0?"":"You are permitted a maximum of "+this.maxChoices+" selection"+(this.maxChoices>1?"s":"")+" for this question.<br/><br/>Please unselect one of your selections before making another selection."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minSelectionsMessage=this.minChoices==0?"":"You must make at least "+this.minChoices+" selection"+(this.minChoices>1?"s":"")+" for this question."},validateChildren(){},processChildren(){const e=this.$.subTree===null?null:this.$.subTree.children[1].children;this.choices=e2.findNodes("QtiHottext",{within:e}),this.processGroupUI(),this.priorState!==null&&this.restoreValue(this.priorState.value)},processGroupUI(){this.setUnselectedHidden(),this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},setUnselectedHidden(){this.presentationFactory.getUnselectedHidden()&&this.$refs.hottextgroup.setAttribute("class","qti3-player-hottext-group qti-unselected-hidden")},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Hottext Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Hottext Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=dw.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.presentationFactory=new Jk(this.$.vnode.props.class),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),dw.validateMaxMinChoices(this.maxChoices,this.minChoices),this.isRadio=this.getCardinality()!=="multiple",this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Hottext",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},i2={ref:"root",class:"qti-hottext-interaction"},s2={ref:"prompt",class:"qti-prompt-wrapper"};function n2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",i2,[l.createElementVNode("div",s2,null,512),l.createElementVNode("div",{ref:"hottextgroup","on:setChecked":t[0]||(t[0]=(...a)=>r.handleSetChecked&&r.handleSetChecked(...a)),class:"qti3-player-hottext-group"},[l.renderSlot(e.$slots,"default")],544)],512)}const r2=B(t2,[["render",n2]]);class a2{constructor(t){return this.constants={QTI_SELECTIONS_LIGHT:"qti-selections-light",QTI_SELECTIONS_DARK:"qti-selections-dark",QTI_UNSELECTED_HIDDEN:"qti-unselected-hidden",THEME_LIGHT:{selectedOpacity:"1.0",unselectedOpacity:"0.5",fillColor:"orange",fillOpacity:"0",strokeColor:"orange",strokeWidth:2,selectedStrokeWidth:4},THEME_DARK:{selectedOpacity:"1.0",unselectedOpacity:"0.5",fillColor:"#0088CC",fillOpacity:"0",strokeColor:"blue",strokeWidth:2,selectedStrokeWidth:4},THEME_HIDDEN_LIGHT:{selectedOpacity:"1.0",unselectedOpacity:"0",fillColor:"orange",fillOpacity:"0",strokeColor:"orange",strokeWidth:2,selectedStrokeWidth:4},THEME_HIDDEN_DARK:{selectedOpacity:"1.0",unselectedOpacity:"0",fillColor:"blue",fillOpacity:"0",strokeColor:"blue",strokeWidth:2,selectedStrokeWidth:4}},this.classList=t,this.presentation_Theme=this.constants.QTI_SELECTIONS_DARK,this.theme=this.constants.THEME_DARK,this.presentation_UnselectedHidden=!1,this.processClassAttribute(),this}processClassAttribute(){if(typeof this.classList>"u"||this.classList===null||this.classList.length==0)return;const t=this.classList.split(" ");for(let i=0;i<t.length;i++)switch(t[i]){case this.constants.QTI_SELECTIONS_DARK:this.presentation_Theme=this.constants.QTI_SELECTIONS_DARK;break;case this.constants.QTI_SELECTIONS_LIGHT:this.presentation_Theme=this.constants.QTI_SELECTIONS_LIGHT;break;case this.constants.QTI_UNSELECTED_HIDDEN:this.presentation_UnselectedHidden=!0;break}switch(this.presentation_Theme){case this.constants.QTI_SELECTIONS_DARK:this.presentation_UnselectedHidden&&(this.theme=this.constants.THEME_HIDDEN_DARK);break;case this.constants.QTI_SELECTIONS_LIGHT:this.presentation_UnselectedHidden?this.theme=this.constants.THEME_HIDDEN_LIGHT:this.theme=this.constants.THEME_LIGHT;break}}getThemeColors(){return this.theme}}const fw=new G,o2={name:"QtiHotspotInteraction",props:{responseIdentifier:{required:!0,type:String},minChoices:{required:!1,type:String,default:"0"},maxChoices:{required:!1,type:String,default:"1"},dataMaxSelectionsMessage:{required:!1,type:String},dataMinSelectionsMessage:{required:!1,type:String}},data(){return{response:null,state:null,isValidResponse:!1,cardinality:"single",minSelectionsMessage:"",maxSelectionsMessage:"",responseDeclaration:null,choices:[],currentChoice:null,shapeElements:[],currentElement:null,backgroundImage:null,backgroundImageWidth:"0",backgroundImageHeight:"0",isRadio:!0,isDisabled:!1,isQtiValid:!0,hasPrompts:!1,presentationFactory:null,shapeColorProperties:null,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},disable(){this.toggleDisableChoices(!0)},enable(){this.toggleDisableChoices(!1)},toggleDisableChoices(e){this.isDisabled=e},getInvalidResponseMessage(){return this.minSelectionsMessage},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier);for(let e=0;e<this.choices.length;e++)this.setChoiceUnChecked(this.choices[e],this.shapeElements[e]);this.currentChoice=null,this.currentElement=null,this.priorState=null,this.setResponse(null),this.setState(this.computeState()),this.updateValidity(this.computeIsValid())},restoreValue(e){e!==null&&(this.isRadio?this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:e,checked:"true"}}),!0):e.forEach(t=>{this.handleSetChecked(new CustomEvent("setChecked",{bubbles:!1,detail:{identifier:t,checked:"true"}}),!0)},this),this.setResponse(this.computeResponse()),this.setState(this.computeState()),this.updateValidity(this.computeIsValid()))},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=typeof e<"u"?e.cardinality!=="multiple"?"single":"multiple":"single",this.cardinality},getPrompts(e){let t=[];return e.default&&e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},handleSetChecked(e,t=!1){const i=e.detail;for(let s=0;s<this.choices.length;s++)this.isRadio&&this.setChoiceUnChecked(this.choices[s],this.shapeElements[s]),this.choices[s].identifier===i.identifier&&(this.currentChoice=this.choices[s],this.currentElement=this.shapeElements[s]);i.checked==="true"?this.checkMaxChoicesLimit()?this.setChoiceUnChecked(this.currentChoice,this.currentElement):this.setChoiceChecked(this.currentChoice,this.currentElement):this.setChoiceUnChecked(this.currentChoice,this.currentElement),t||(this.setResponse(this.computeResponse()),this.currentElement.focus(),this.evaluateValidity())},computeResponse(){let e=this.isRadio?null:[];return this.choices.forEach(t=>{t.isChecked()&&(this.isRadio?e=t.identifier:e.push(t.identifier))}),this.isRadio?e:e.length===0?null:e},computeState(){return{}},computeIsValid(){return this.minChoices*1===0?!0:this.response===null?!1:this.cardinality==="single"||this.cardinality==="multiple"&&this.response.length>=this.minChoices*1},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},checkMaxChoicesLimit(){if(this.isRadio||this.maxChoices==0)return!1;const e=this.getResponse();return e!==null&&e.length==this.maxChoices?(_.NotifyInteractionSelectionsLimit(this.maxSelectionsMessage),!0):!1},computeMaxSelectionsMessage(){if(typeof this.dataMaxSelectionsMessage<"u"){this.maxSelectionsMessage=this.dataMaxSelectionsMessage;return}this.maxSelectionsMessage=this.maxChoices==0?"":"You are permitted a maximum of "+this.maxChoices+" selection"+(this.maxChoices>1?"s":"")+" for this question.<br/><br/>Please unselect one of your selections before making another selection."},computeMinSelectionsMessage(){if(typeof this.dataMinSelectionsMessage<"u"){this.minSelectionsMessage=this.dataMinSelectionsMessage;return}this.minSelectionsMessage=this.minChoices==0?"":"You must make at least "+this.minChoices+" selection"+(this.minChoices>1?"s":"")+" for this question."},validateChildren(){},processChildren(){this.processBackgroundImage(),this.$.subTree.children[1].children[0].dynamicChildren.forEach(t=>{if(t.component!==null&&t.type.name==="QtiHotspotChoice"){const i=t.component.proxy;this.choices.push(i);const s=i.getShapeElement();s!==null&&(this.addHotspotListeners(s),this.shapeElements.push(s),this.$refs.overlay.appendChild(s))}}),this.processGroupUI(),this.priorState!==null&&this.restoreValue(this.priorState.value)},addHotspotListeners(e){e.addEventListener("click",this.handleHotspotClick),e.addEventListener("keydown",this.handleHotspotKeydown)},removeHotspotListeners(e){e.removeEventListener("click",this.handleHotspotClick),e.removeEventListener("keydown",this.handleHotspotKeydown)},handleHotspotClick(e){if(e.preventDefault(),this.isDisabled)return;const t=e.target.getAttribute("data-identifier"),i=this.findChoiceByIdentifier(t);this.isRadio?this.triggerChecked(e.target.getAttribute("data-identifier"),"true"):(this.toggleChecked(i,e.target),this.triggerChecked(t,i.getChecked()))},handleHotspotKeydown(e){const t=e.target.getAttribute("data-identifier"),i=this.findChoiceByIdentifier(t);switch(e.code){case"Space":case"Enter":if(e.stopPropagation(),e.preventDefault(),this.isDisabled||i==null)return;this.toggleChecked(i,e.target),this.triggerChecked(t,i.getChecked());break}},findChoiceByIdentifier(e){for(let t=0;t<this.choices.length;t++)if(this.choices[t].identifier===e)return this.choices[t];return null},toggleChecked(e,t){if(e.toggleChecked(),t===null)return;const i=t.getAttribute("aria-checked");t.setAttribute("aria-checked",i==="true"?"false":"true")},triggerChecked(e,t){const i=new CustomEvent("setChecked",{bubbles:!0,cancelable:!0,detail:{identifier:e,checked:t}});this.$refs.hotspotgroup.dispatchEvent(i)},setChoiceUnChecked(e,t){e.setChecked(!1),t.setAttribute("aria-checked","false");const i=e.getShapeColorProperties();t.setAttribute("fill",`${i.fillColor}`),t.setAttribute("fill-opacity",`${i.fillOpacity}`),t.setAttribute("opacity",`${i.unselectedOpacity}`),t.setAttribute("stroke",`${i.strokeColor}`),t.setAttribute("stroke-width",`${i.strokeWidth}`)},setChoiceChecked(e,t){e.setChecked(!0),t.setAttribute("aria-checked","true");const i=e.getShapeColorProperties();t.setAttribute("fill",`${i.fillColor}`),t.setAttribute("fill-opacity",`${i.fillOpacity}`),t.setAttribute("opacity",`${i.selectedOpacity}`),t.setAttribute("stroke",`${i.strokeColor}`),t.setAttribute("stroke-width",`${i.selectedStrokeWidth}`)},processGroupUI(){this.setResponse(null),this.setState(this.computeState()),this.setIsValid(this.computeIsValid())},processBackgroundImage(){let e=this.$refs.hotspotgroup.getElementsByTagName("object");if(e.length===0&&(e=this.$refs.hotspotgroup.getElementsByTagName("img")),e.length===0&&(e=this.$refs.hotspotgroup.getElementsByTagName("picture")),e.length!==1)throw new c("Hotspot interaction must have exactly one <img>, <object>, or <picture> node");this.backgroundImage=e[0],this.backgroundImage.setAttribute("draggable","false"),this.backgroundImageWidth=`${e[0].clientWidth}`,this.backgroundImageHeight=`${e[0].clientHeight}`,this.$refs.overlay.setAttribute("viewBox",`0 0 ${this.backgroundImageWidth} ${this.backgroundImageHeight}`),this.$refs.overlay.setAttribute("tabindex","-1"),this.$refs.overlay.setAttribute("role","application"),this.$refs.overlay.setAttribute("focusable","false"),this.$refs.hotspotgroup.setAttribute("style",`width:${e[0].clientWidth};height:${e[0].clientHeight}`)},getShapeColorProperties(){return this.shapeColorProperties},setShapeColorProperties(e){this.shapeColorProperties=e},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('Hotspot Interaction State Invalid. "value" property not found.');if(!("state"in t))throw new O('Hotspot Interaction State Invalid. "state" property not found.');return t}},created(){try{this.responseDeclaration=fw.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.presentationFactory=new a2(this.$.vnode.props.class),this.setShapeColorProperties(this.presentationFactory.getThemeColors()),this.validateChildren(),this.priorState=this.getPriorState(this.responseIdentifier),fw.validateMaxMinChoices(this.maxChoices,this.minChoices),this.isRadio=this.getCardinality()!=="multiple",this.hasPrompts=this.getPrompts(this.$slots).length>0,this.computeMinSelectionsMessage(),this.computeMaxSelectionsMessage()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"Hotspot",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:this.maxSelectionsMessage}),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}},beforeUnmount(){this.shapeElements.forEach(e=>{this.removeHotspotListeners(e)})}},l2={ref:"root",class:"qti-hotspot-interaction"},c2={ref:"prompt",class:"qti-prompt-wrapper"},u2={ref:"overlay",class:"qti3-player-hotspot-overlay"};function h2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",l2,[l.createElementVNode("div",c2,null,512),l.createElementVNode("div",{ref:"hotspotgroup","on:setChecked":t[0]||(t[0]=(...a)=>r.handleSetChecked&&r.handleSetChecked(...a)),class:"qti3-player-hotspot-group"},[l.renderSlot(e.$slots,"default"),(l.openBlock(),l.createElementBlock("svg",u2,null,512))],544)],512)}const d2=B(o2,[["render",h2]]);class f2{constructor(t,i,s){J(this,"moduleAttribute","");J(this,"modulesNode",null);J(this,"itemPathUri","");J(this,"modules",null);J(this,"constants",{BASE_CONFIG:{waitSeconds:60,paths:{}}});return this.moduleAttribute=t,this.modulesNode=i,this.itemPathUri=s,this}async getConfiguration(t){this.setModules(this.getInteractionModules());let i=null;this.moduleAttribute.length>0&&this.modulesNode===null?i=await this.getConfigurationFromUrl(this.getModules()):i=await this.resolveModules(this.getModules()),t&&t(i)}async resolveModules(t){let i=null;if(t===null)return i;let s=this.constants.BASE_CONFIG;return s=await this.initBaseConfiguration(s,t),i=await this.resolvePrimaryConfigurationModules(s,t),i!==null||(i=await this.resolveSecondaryConfigurationModules(s,t)),i}async initBaseConfiguration(t,i){const s=`${this.getItemPathUri()}modules/module_resolution.js`;if(typeof i.primaryconfiguration>"u"&&typeof i.secondaryConfiguration>"u"){const n=await this.fetchDefaultModuleResolution(s,!1);if(n!==null)return n}return t}async resolvePrimaryConfigurationModules(t,i){let s=[];if(typeof i.primaryconfiguration>"u"){for(let o=0;o<i.module.length;o++){if(typeof i.module[o].primarypath>"u")return null;s.push(this.addPathJs(i.module[o].primarypath)),t.paths[i.module[o].id]=this.stripPathJs(i.module[o].primarypath)}return await this.resolveConfigurationModules(s)?t:null}const n=await this.fetchConfiguration(i.primaryconfiguration,!0,!0);if(n===null)return null;for(const a in n.paths)n.paths[a]=this.stripPathJs(n.paths[a]);for(let a=0;a<i.module.length;a++)typeof i.module[a].primarypath<"u"&&(n.paths[i.module[a].id]=this.stripPathJs(this.addPathJs(i.module[a].primarypath)));return await this.resolveConfigurationPathUrls(n.paths)?n:null}async resolveSecondaryConfigurationModules(t,i){let s=[];if(typeof i.secondaryconfiguration>"u"){for(let o=0;o<i.module.length;o++){if(typeof i.module[o].fallbackpath>"u")return null;s.push(this.addPathJs(i.module[o].fallbackpath)),t.paths[i.module[o].id]=this.stripPathJs(i.module[o].fallbackpath)}return await this.resolveConfigurationModules(s)?t:null}const n=await this.fetchConfiguration(i.secondaryconfiguration,!1,!0);if(n===null)return null;for(const a in n.paths)n.paths[a]=this.stripPathJs(n.paths[a]);for(let a=0;a<i.module.length;a++)typeof i.module[a].fallbackpath<"u"&&(n.paths[i.module[a].id]=this.stripPathJs(this.addPathJs(i.module[a].fallbackpath)));return await this.resolveConfigurationPathUrls(n.paths)?n:null}async resolveConfigurationPathUrls(t){let i=[];for(let n=0;n<t.length;n++)i.push(t[n]);return await this.resolveConfigurationModules(i)}async resolveConfigurationModules(t){return await Promise.all(t.map(s=>fetch(s).then(n=>{if(n.ok)return console.log("[PCI Parent] Module Loader Success:",s),n;throw new Error(s)}))).catch(s=>(console.log("[PCI Parent] Module Loader Failure:",s.message),null))!==null}async getConfigurationFromUrl(t){let i=null;return t===null||(typeof t.primaryconfiguration<"u"&&(i=await this.fetchConfiguration(t.primaryconfiguration,!0,!1)),i!==null)||typeof t.secondaryconfiguration<"u"&&(i=await this.fetchConfiguration(t.secondaryconfiguration,!1,!1)),i}async fetchConfiguration(t,i,s){try{const n=await fetch(t);if(!n.ok)throw new Error(`HTTP error: ${n.status}`);const r=await n.json();let a=r.paths;for(let o in a)a[o]!==null&&!a[o].startsWith("http")&&(s?a[o]=`${this.getConfigurationRelativePath(t)}${a[o]}`:a[o]=`${this.getItemPathUri()}${a[o]}`);return r}catch(n){return console.log((i?"Primary":"Fallback")+" Configuration Fetch error:",n),null}}async fetchDefaultModuleResolution(t,i){try{const s=await fetch(t);if(!s.ok)throw new Error(`HTTP error: ${s.status}`);const n=await s.json();let r=n.paths;for(let a in r)r[a]!==null&&!r[a].startsWith("http")&&(i?r[a]=`${this.getConfigurationRelativePath(t)}${r[a]}`:r[a]=`${this.getItemPathUri()}${r[a]}`);return n}catch(s){return console.log("module_resolution.js Fetch error:",s),null}}getItemPathUri(){return this.itemPathUri}getModules(){return this.modules}setModules(t){this.modules=t}getInteractionModules(){let t={};if(this.modulesNode===null)return t={primaryconfiguration:"modules/module_resolution.js",secondaryconfiguration:"modules/fallback_module_resolution.js"},this.addPackagePath(t);const i=this.modulesNode.getPrimaryConfiguration();i.length>0&&(t.primaryconfiguration=i);const s=this.modulesNode.getSecondaryConfiguration();s.length>0&&(t.secondaryconfiguration=s),t.module=[];let n=this.modulesNode.getModules();for(let r=0;r<n.length;r++){let a={id:n[r].getId()};n[r].getPrimaryPath().length>0&&(a.primarypath=n[r].getPrimaryPath()),n[r].getFallbackPath().length>0&&(a.fallbackpath=n[r].getFallbackPath()),t.module.push(a)}return this.addPackagePath(t)}addPackagePath(t){for(let s in{primaryconfiguration:"",secondaryconfiguration:""})s in t&&t[s]!==null&&!t[s].startsWith("http")&&(t[s]=this.getAbsolutePath(this.getItemPathUri(),t[s]));let i=t.module;if(i!=null)for(let s=0;s<i.length;s++){let n=i[s];for(let r in{primarypath:"",fallbackpath:""})r in n&&n[r]!==null&&!n[r].startsWith("http")&&(n[r]=this.getAbsolutePath(this.getItemPathUri(),n[r]))}return t}getAbsolutePath(t,i){let s=t.split("/"),n=i.split("/");s.pop();for(var r=0;r<n.length;r++)n[r]!="."&&(n[r]==".."?s.pop():s.push(n[r]));return s.join("/")}getConfigurationRelativePath(t){if(t===null||t.length===0)return"";const i=t.lastIndexOf("/");return i<0?"":t.substring(0,i+1)}stripPathJs(t){return t===null?null:t.endsWith(".js")?t.slice(0,t.lastIndexOf(".")):t}addPathJs(t){return t===null?null:t.length>0&&!t.endsWith(".js")?`${t}.js`:t}}const Uh=new G,pw=new ie,p2={name:"QtiPortableCustomInteraction",props:{responseIdentifier:{required:!0,type:String},customInteractionTypeIdentifier:{required:!0,type:String},module:{required:!1,type:String,default:""},dataItemPathUri:{required:!1,type:String,default:""}},inheritAttrs:!0,data(){return{response:null,state:null,baseType:null,cardinality:null,isValidResponse:!0,isQtiValid:!0,hasPrompts:!1,pciModuleResolver:null,loadIframeHandler:null,renderer:"",classAttribute:"",properties:{},modulesNode:null,modules:null,configuration:null,templateVariables:[],contextVariables:[],stylesheets:[],catalogInfoNode:null,uniqueId:null,pciIframe:null,isReady:!1,initialWidth:0,priorState:null}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},getState(){return this.state},setState(e){this.state=e},getStateRequest(){this.pciIframe.contentWindow.postMessage({message:"PciGetState_Request"},"*")},getIsValid(){return this.isValidResponse},setIsValid(e){this.isValidResponse=e},getInvalidResponseMessage(){return""},resetValue(){console.log("[ResetValue][identifier]",this.responseIdentifier),this.priorState=null},restoreValue(e,t){this.setResponse(e),this.setState(t)},getCardinality(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.cardinality=e.cardinality,this.cardinality},getBaseType(){let e=_.getResponseDeclaration(this.responseIdentifier);return this.baseType=e.baseType,this.baseType},getPrompts(e){let t=[];return e.default().forEach(i=>{typeof i.type<"u"&&i.type.name==="QtiPrompt"&&t.push(i)}),t},movePrompt(){if(!this.hasPrompts)return;const e=this.$refs.root.querySelector(".qti-prompt");e!==null&&this.$refs.prompt.appendChild(e)},computeState(){return{}},computeIsValid(){return!0},evaluateValidity(){const e=this.getIsValid(),t=this.computeIsValid();e!==t&&this.updateValidity(t)},updateValidity(e){this.setIsValid(e),_.setInteractionIsValidResponse({identifier:this.responseIdentifier,isValidResponse:e})},validateChildren(){if(!this.$slots.default)return;let e=!1,t=!1,i=!1,s=!1,n=!1,r=!1,a=!1;this.$slots.default().forEach(o=>{if(Uh.isValidSlot(o)){if(o.type.name==="QtiPrompt"){if(t||i||s||n||r||a)throw new c("Invalid element order. qti-prompt must be the first element");if(!e)return e=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(o.type.name==="QtiInteractionModules"){if(t||s||n||r||a)throw new c("Invalid element order: qti-interaction-modules");if(!i)return i=!0;throw new c("Maximum of 1 qti-interaction-modules element permitted")}if(o.type.name==="QtiInteractionMarkup"){if(s||n||r||a)throw new c("Invalid element order: qti-interaction-markup");if(!t)return t=!0;throw new c("Maximum of 1 qti-interaction-markup element permitted")}if(o.type.name==="QtiTemplateVariable"){if(s||r||a)throw new c("Invalid element order: qti-template-variable");return n=!0}if(o.type.name==="QtiContextVariable"){if(r||a)throw new c("Invalid element order: qti-context-variable");return s=!0}if(o.type.name==="QtiStylesheet"){if(a)throw new c("Invalid element order: qti-stylesheet");return r=!0}if(o.type.name==="QtiCatalogInfo"){if(!a)return a=!0;throw new c("Maximum of 1 qti-catalog-info element permitted")}throw new c('Node is not permitted inside QtiPortableCustomInteraction: "'+o.type.name+'"')}})},processChildren(){const e=this.$.subTree.children[1].children[0].children;e!==null&&(e.forEach(t=>{if(t.component===null)return;const i=t.component.proxy;switch(t.type.name){case"QtiInteractionMarkup":this.markup=i.getMarkup();break;case"QtiInteractionModules":this.modulesNode=i;break;case"QtiTemplateVariable":this.templateVariables.push(i);break;case"QtiContextVariable":this.contextVariables.push(i);break;case"QtiStylesheet":this.stylesheets.push(i);break;case"QtiCatalogInfo":this.catalogInfoNode=i;break}}),this.priorState!==null&&this.restoreValue(this.priorState.value,this.priorState.state),this.initialWidth=this.$refs.root.clientWidth)},disable(){},enable(){},getPriorState(e){const t=_.getItemContextStateVariable(e);if(t===null)return null;if(!("value"in t))throw new O('PCI State Invalid. "value" property not found.');if(!("state"in t))throw new O('PCI State Invalid. "state" property not found.');return t},createId(){return"pci_"+Uh.randomString(5,"a")},initialize(){this.setProperties(this.getPciProperties()),this.pciModuleResolver=new f2(this.module,this.modulesNode,this.dataItemPathUri),this.pciModuleResolver.getConfiguration((function(e){this.setConfiguration(e),console.log("[PCI Parent] PCI Configuration:",e),e!==null&&this.loadPciIframe(this.initialWidth)}).bind(this))},loadPciIframe(e){const t=document.createElement("iframe");t.name=this.uniqueId,t.id=this.uniqueId,t.setAttribute("scrolling","no"),t.style.border="none",t.style.width=`${e}px`,t.addEventListener("load",this.loadIframeHandler),t.src=`${this.renderer}?identifier=${this.responseIdentifier}&uniqueId=${this.uniqueId}`,this.$refs.ic.appendChild(t)},handleLoadIframe(e){this.pciIframe=e.target},getItemPathUri(){return this.dataItemPathUri},getPciProperties(){let e=this.$refs.root;const t={};for(let i in e.dataset)i!=="uniqueId"&&(t[i]=e.dataset[i]);return t},getProperties(){return this.properties},setProperties(e){this.properties=e},getContextVariables(){let e={};for(let t=0;t<this.contextVariables.length;t++)e[this.contextVariables[t].getIdentifier()]=this.contextVariables[t].evaluate();return e},getTemplateVariables(){let e={};for(let t=0;t<this.templateVariables.length;t++)e[this.templateVariables[t].getIdentifier()]=this.templateVariables[t].evaluate();return e},getStylesheets(){let e=[];for(let t=0;t<this.stylesheets.length;t++){const i=this.stylesheets[t];e.push({href:i.getHref(),type:i.getType()})}return e},getCatalogInfo(){return this.catalogInfoNode},getModules(){return this.modules},setModules(e){this.modules=e},getConfiguration(){return this.configuration},setConfiguration(e){this.configuration=e},getClassAttribute(){return this.classAttribute},setClassAttribute(e){this.classAttribute=e},copyAttributes(e,t,i){return e.forEach(function(s){let n=s.replace("-","");t[n]=i.getAttribute(s)}),t},getResponseVariable(){let e=pw.valueToPciJson(this.getResponse(),this.baseType,this.cardinality),t={};return t[this.responseIdentifier]=e,t},pciInitialize(){let e={typeIdentifier:this.customInteractionTypeIdentifier,classAttribute:this.getClassAttribute(),markup:this.markup,properties:this.getProperties(),boundTo:this.getResponseVariable(),templateVariables:this.getTemplateVariables(),contextVariables:this.getContextVariables(),stylesheets:this.getStylesheets(),catalogInfo:this.getCatalogInfo(),module:this.module,modules:this.getModules(),moduleResolution:this.getConfiguration(),status:_.getItemLifecycleStatus()},t={message:"PciLoadInteraction",pci:JSON.stringify(e)};this.priorState!==null&&(t.state=JSON.stringify({response:pw.valueToPciJson(this.getResponse(),this.baseType,this.cardinality),state:this.getState()})),this.pciIframe.contentWindow.postMessage(t,"*")},pciResizeIframe(e,t){this.pciIframe!==null&&(this.pciIframe.style.height=`${e}px`,this.pciIframe.style.width=`${t}px`)},pciResizeIframeWidthToContainer(){this.pciIframe!==null&&(this.pciIframe.style.width=`${this.$refs.ic.clientWidth}px`)},pciSaveState(e){const t=JSON.parse(e);typeof t.response<"u"?this.setResponse(t.response):this.setResponse(null),typeof t.state<"u"?this.setState(t.state):this.setState(null),this.notifyInteractionStateReady()},pciSetReady(){this.isReady=!0},pciIsReady(){return this.pciIframe!==null&&this.isReady},notifyInteractionStateReady(){_.NotifyInteractionStateReady({identifier:this.responseIdentifier})}},created(){try{this.responseDeclaration=Uh.validateResponseIdentifierAttribute(_,this.responseIdentifier),this.validateChildren(),this.renderer=_.getPciContextRenderer(),this.loadIframeHandler=this.handleLoadIframe.bind(this);const e=typeof this.$.vnode.props.class<"u"?this.$.vnode.props.class:"";this.setClassAttribute(e),this.priorState=this.getPriorState(this.responseIdentifier),this.hasPrompts=this.getPrompts(this.$slots).length>0,this.cardinality=this.getCardinality(),this.baseType=this.getBaseType(),this.uniqueId=this.createId()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):e.name==="QtiParseException"?new se(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.movePrompt(),this.processChildren(),_.defineInteraction({identifier:this.responseIdentifier,interactionType:"PortableCustom",node:this,resetValue:this.resetValue,disable:this.disable,isValidResponse:this.getIsValid(),invalidResponseMessage:this.getInvalidResponseMessage(),maxSelectionsMessage:""}),this.initialize(),console.log("["+this.$options.name+"][Identifier]",this.responseIdentifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}},beforeUnmount(){this.pciIframe!==null&&this.pciIframe.removeEventListener("load",this.loadIframeHandler)}},m2={ref:"root",class:"qti-portable-custom-interaction"},g2={ref:"prompt",class:"qti-prompt-wrapper"},y2={ref:"pcigroup",class:"qti3-player-pci-group"},w2={ref:"ic",class:"qti3-player-pci-iframe-container"};function b2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",m2,[l.createElementVNode("div",g2,null,512),l.createElementVNode("div",y2,[l.renderSlot(e.$slots,"default")],512),l.createElementVNode("div",w2,null,512)],512)}const v2=B(p2,[["render",b2]]),E2={name:"QtiPrompt"},T2={class:"qti-prompt"};function C2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",T2,[l.renderSlot(e.$slots,"default")])}const S2=B(E2,[["render",C2]]),x2=new G,_2={name:"QtiInlineChoice",props:{identifier:{required:!0,type:String},fixed:{required:!1,type:String,default:"false"},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"}},data(){return{id:null}},inheritAttrs:!0,methods:{createId(){if(this.$refs.choice.hasAttribute("id")){this.id=this.$refs.choice.getAttribute("id");return}this.id="inlinechoice_"+x2.randomString(5,"a")+"_"+this.identifier,this.$refs.choice.setAttribute("id",this.id)}},created(){},mounted(){this.createId()}},I2=["data-identifier"];function V2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("li",{ref:"choice",role:"option","data-identifier":i.identifier,class:"qti-inline-choice"},[l.renderSlot(e.$slots,"default")],8,I2)}const A2=B(_2,[["render",V2]]),$2=new G,L2={name:"QtiSimpleChoice",emits:["setChecked","setFocusPreviousChoice","setFocusNextChoice","setActiveDescendant"],props:{identifier:{required:!0,type:String},fixed:{required:!1,type:String,default:"false"},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"}},data(){return{id:null,checked:"false",isRadio:!0,role:"radio",tabIndex:"-1",hasMath:!1,isDisabled:!1,parentCardinality:"single"}},inheritAttrs:!0,methods:{handleClick(){if(!this.isDisabled)if(this.isRadio)this.$parent.$emit("setChecked",{identifier:this.identifier,checked:"true"});else{if(this.toggleChecked(),this.parentCardinality==="ordered")return;this.$parent.$emit("setChecked",{identifier:this.identifier,checked:this.checked})}},handleKeydown(e){let t=!1;switch(e.code){case"Space":if(!this.isDisabled){if(this.toggleChecked(),this.parentCardinality==="ordered")return;this.$parent.$emit("setChecked",{identifier:this.identifier,checked:this.checked})}t=!0;break;case"Enter":if(!this.isDisabled){if(this.toggleChecked(),this.parentCardinality==="ordered")return;this.$parent.$emit("setChecked",{identifier:this.identifier,checked:this.checked})}t=!0;break;case"ArrowUp":case"ArrowLeft":this.isRadio&&(this.$parent.$emit("setFocusPreviousChoice",this.identifier),t=!0);break;case"ArrowDown":case"ArrowRight":this.isRadio&&(this.$parent.$emit("setFocusNextChoice",this.identifier),t=!0);break}t&&(e.stopPropagation(),e.preventDefault())},handleFocus(){this.parentCardinality!=="ordered"&&this.$parent.$emit("setActiveDescendant",this.id)},handleBlur(){},setChecked(e){this.checked=e?"true":"false"},isChecked(){return this.checked==="true"},setTabIndex(e){this.tabIndex=e},setFocus(){this.$refs.choice.focus()},setBlur(){this.$refs.choice.blur()},toggleChecked(){this.checked=this.checked==="true"?"false":"true"},setLabel(e){this.$refs.label.innerText=e},hideLabel(){this.$refs.label.classList.add("qti-hidden")},showLabel(){this.$refs.label.classList.remove("qti-hidden")},setLabelSbac(e){this.$refs.choice.classList.add("sbac"),this.$refs.choice.setAttribute("data-label",e),this.$refs.label.innerText=e,this.$refs.label.classList.add("qti-visually-hidden")},setChoiceLrn(){this.$refs.choice.classList.add("lrn")},hideControl(){this.$refs.choice.classList.add("control-hidden")},setIsDisabled(e){this.isDisabled=e},initializeChoice(){switch(this.parentCardinality=this.$parent.cardinality,this.parentCardinality){case"ordered":this.role="button",this.isRadio=!1,this.tabIndex=0;break;case"multiple":this.role="checkbox",this.isRadio=!1,this.tabIndex=0;break;default:this.role="radio",this.isRadio=!0,this.tabIndex=-1;break}},initializeOrderChoice(){this.role==="button"&&(this.hideLabel(),this.hideControl())},createId(){if(this.$refs.choice.hasAttribute("id")){this.id=this.$refs.choice.getAttribute("id");return}this.id="choice_"+$2.randomString(5,"a")+"_"+this.identifier,this.$refs.choice.setAttribute("id",this.id)},setExpectedSolution(){this.$refs.choice.classList.add("player-show-solution","player-choice-expected")},setCorrectSolution(){this.$refs.choice.classList.add("player-show-solution","player-choice-correct")},setIncorrectSolution(){this.$refs.choice.classList.add("player-show-solution","player-choice-incorrect")},setIgnoreSolution(){this.$refs.choice.classList.remove("player-show-solution","player-choice-incorrect","player-choice-correct","player-choice-expected")}},created(){this.initializeChoice()},mounted(){this.initializeOrderChoice(),this.createId()}},M2=["role","aria-checked","tabindex","data-identifier"],N2={ref:"label",class:"qti-choice-label"},R2={ref:"description",class:"qti-choice-description"};function k2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("li",{ref:"choice",role:n.role,"aria-checked":n.checked,tabindex:n.tabIndex,"data-identifier":i.identifier,onFocus:t[0]||(t[0]=(...a)=>r.handleFocus&&r.handleFocus(...a)),onBlur:t[1]||(t[1]=(...a)=>r.handleBlur&&r.handleBlur(...a)),onClick:t[2]||(t[2]=(...a)=>r.handleClick&&r.handleClick(...a)),onKeydown:t[3]||(t[3]=(...a)=>r.handleKeydown&&r.handleKeydown(...a)),class:l.normalizeClass(["qti-simple-choice",{source:n.role=="button"}])},[l.createElementVNode("div",{class:l.normalizeClass(["qti-simple-choice-wrapper",{draggable:n.role=="button"}]),style:{width:"100%"}},[l.createElementVNode("div",N2,null,512),l.createElementVNode("div",R2,[l.renderSlot(e.$slots,"default")],512)],2)],42,M2)}const q2=B(L2,[["render",k2]]),O2=new G,B2={name:"QtiSimpleAssociableChoice",props:{identifier:{required:!0,type:String},fixed:{required:!1,type:String,default:"false"},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"},matchGroup:{required:!1,type:String,default:""},matchMax:{required:!0,type:String},matchMin:{required:!1,type:String,default:"0"}},data(){return{id:null}},methods:{createId(){if(this.$refs.choice.hasAttribute("id")){this.id=this.$refs.choice.getAttribute("id");return}this.id="choice_"+O2.randomString(5,"a")+"_"+this.identifier,this.$refs.choice.setAttribute("id",this.id)}},mounted(){this.createId()}},P2=["data-identifier","data-match-max","data-match-min","data-match-group"],D2={ref:"description",class:"choice-description"};function Q2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("li",{ref:"choice","data-identifier":i.identifier,"data-match-max":i.matchMax,"data-match-min":i.matchMin,"data-match-group":i.matchGroup,class:"qti-simple-associable-choice"},[l.createElementVNode("div",D2,[l.renderSlot(e.$slots,"default")],512)],8,P2)}const H2=B(B2,[["render",Q2]]),F2=new G,U2={name:"QtiAssociableHotspot",props:{identifier:{required:!0,type:String},templateIdentifier:{required:!1,type:String},showHide:{required:!1,type:String,default:"show"},matchGroup:{required:!1,type:String,default:""},shape:{required:!0,type:String},coords:{required:!0,type:String},hotspotLabel:{required:!1,type:String,default:""},ariaLabel:{required:!1,type:String,default:""},matchMax:{required:!0,type:String},matchMin:{required:!1,type:String,default:"0"}},data(){return{shapeData:null,shapeColorProperties:null,isQtiValid:!0}},inheritAttrs:!0,methods:{getIdentifier(){return this.identifier},getShape(){return this.shape},getShapeData(){return this.shapeData},setShapeData(){const e=this.coords.split(",");switch(this.getShape()){case"circle":if(e.length!=3)return;this.shapeData=e;return;case"rect":if(e.length!==4)return;e[2]=parseInt(e[2])-parseInt(e[0]),e[3]=parseInt(e[3])-parseInt(e[1]),this.shapeData=e;return;case"poly":this.shapeData=this.transformPolyCoords(e);return;case"ellipse":if(e.length!=4)return;this.shapeData=e;return;case"default":this.shapeData="";return}},transformPolyCoords(e){let t=[];if(e.length%2!=0)return t;for(let i=0;i<e.length;i+=2)t.push(`${e[i]} ${e[i+1]}`);return t},initialize(){F2.validateShapeAttribute(this.shape),this.setShapeData()}},created(){try{this.initialize()}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw new c(e.message)}},mounted(){if(this.isQtiValid)try{console.log("["+this.$options.name+"][Identifier]",this.identifier)}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},G2=["data-identifier","data-match-max","data-match-min","data-match-group"];function j2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",{ref:"gap","data-identifier":i.identifier,"data-match-max":i.matchMax,"data-match-min":i.matchMin,"data-match-group":i.matchGroup,class:"ggm-gap"},null,8,G2)}const W2=B(U2,[["render",j2]]),z2=new G,K2=new ie,Y2={name:"QtiSimpleMatchSet",data(){return{choices:[],isShuffle:!1,isQtiValid:!0}},methods:{getChoices(){return this.choices},setIsShuffle(e){this.isShuffle=e},createContainer(e,t){let i=[];return e===null?(this.choices.forEach(n=>{i.push({fixed:n.fixed==="true",node:n})}),this.isShuffle&&K2.shuffleArrayFixed(i),i):(e.state.orders[t].forEach(n=>{const r=this.findChoiceByIdentifier(n,this.choices);r!==null&&i.push({fixed:r.fixed==="true",node:r})},this),i)},processContainerChoices(e){this.choices.splice(0,this.choices.length),this.$refs.matchset.innerHTML="",e.forEach(t=>{this.$refs.matchset.appendChild(t.node.$el),this.choices.push(t.node)},this)},validateChildren(){let e=0;if(!this.$slots.default)throw new c("Must have at least 1 qti-simple-associable-choice");if(this.$slots.default().forEach(t=>{if(z2.isValidSlot(t)){if(t.type.name==="QtiSimpleAssociableChoice")return e+=1;throw new c('Node is not a qti-simple-associable-choice: "'+t.type.name+'"')}}),e===0)throw new c("Must have at least 1 qti-simple-associable-choice")},processChildren(){this.$.subTree.children[0].children.forEach(t=>{t.component!==null&&this.choices.push(t.component.proxy)})},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Match Interaction State Invalid. Choice identifier "'+e+'" not found.')}},created(){try{this.validateChildren()}catch(e){throw this.isQtiValid=!1,e.name==="QtiValidationException"?new c(e.message):new Error(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),console.log("["+this.$options.name+"]")}catch(e){throw this.isQtiValid=!1,console.log("["+this.$options.name+"][ValidationError]",e.name,e.message),new c(e.message)}}},X2={ref:"matchset",class:"qti-simple-match-set"};function Z2(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("ul",X2,[l.renderSlot(e.$slots,"default")],512)}const J2=B(Y2,[["render",Z2]]);class eq{constructor(t){this.constants={QTI_CHOICES_TOP:"qti-choices-top",QTI_CHOICES_BOTTOM:"qti-choices-bottom",QTI_CHOICES_LEFT:"qti-choices-left",QTI_CHOICES_RIGHT:"qti-choices-right",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message",DATA_CHOICES_CONTAINER_WIDTH:null},this.parentClass=t,this.clazzTokens=[],this.gapMatchGroupElement=null,this.gapChoiceWrapperElement=null,this.gapTargetWrapperElement=null,this.choicesContainerWidth=null,this.gapChoices=[],this.gaps=[],this.presentation_Choices_Orientation=null,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage=""}initialize(t,i,s,n,r,a){this.gapMatchGroupElement=t,this.gapChoiceWrapperElement=i,this.gapTargetWrapperElement=s,this.choicesContainerWidth=n,this.gapChoices=r,this.gaps=a,this.processRootClassAttribute(this.parentClass),this.processPresentation()}processRootClassAttribute(t){const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case this.constants.QTI_CHOICES_TOP:case this.constants.QTI_CHOICES_BOTTOM:case this.constants.QTI_CHOICES_LEFT:case this.constants.QTI_CHOICES_RIGHT:this.presentation_Choices_Orientation=i[s];break}this.clazzTokens=i}processPresentation(){this.presentation_Choices_Orientation===null&&(this.presentation_Choices_Orientation=this.constants.QTI_CHOICES_TOP),this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_LEFT?(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.gapMatchGroupElement.classList.add(this.constants.QTI_CHOICES_LEFT)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_TOP?(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_RIGHT?(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.gapMatchGroupElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.gapMatchGroupElement.insertBefore(this.gapTargetWrapperElement,this.gapChoiceWrapperElement)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_BOTTOM&&(this.gapChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.gapTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.gapMatchGroupElement.insertBefore(this.gapTargetWrapperElement,this.gapChoiceWrapperElement)),this.processChoicesContainerWidth(),this.processGaps()}processChoicesContainerWidth(){this.choicesContainerWidth!==null&&(this.gapChoiceWrapperElement.style.width=`${this.choicesContainerWidth}px`)}processGaps(){for(let t=0;t<this.gaps.length;t++)this.gaps[t].classList.add("target")}}class tq{constructor(t,i){J(this,"options",{interactionSubType:"default",cardinality:"single",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null});return this.qtiAttributeValidation=new G,this.wrapper=t,this.sourcewrapper=this.wrapper.querySelector(".qti-gap-match-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-gap-match-target-wrapper"),this.processOptions(i),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragMove=this.handleDragMove.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.itemTarget=null,this.itemStart=null,this.isItemStartSource=!0,this.initialX=0,this.initialY=0,this.offsetX=0,this.offsetY=0,this.startingX=0,this.startingY=0,this.currentAssociationsCount=0,this.isDisabled=!1,this.currentDragger=null,this.initializeSources(this.sourcewrapper),this.initializeTargets(this.targetwrapper),this.restoreResponse(this.options.response),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.draggers.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleDragStart(t){if(t.preventDefault(),!this.isDisabled&&t.button==0)return this.interactionStart(t.target,t.clientX,t.clientY,!1),!1}handleTouchStart(t){if(t.preventDefault(),!this.isDisabled)return t.targetTouches.length!=1||this.interactionStart(t.target,t.touches[0].pageX,t.touches[0].pageY,!0),!1}interactionStart(t,i,s,n){const r=this.getClosestElement(t,"draggable");this.itemStart=r.parentNode,this.isItemStartSource=this.itemStart.classList.contains("source"),this.identifyTargets(this.itemStart,!0),this.itemTarget=null;const a=r.getBoundingClientRect();this.initialX=i,this.initialY=s,this.startingX=a.left,this.startingY=a.top,this.offsetX=i-this.startingX,this.offsetY=s-this.startingY,this.addPlaceholder(r),r.style.userSelect="none",r.style.width=a.width+"px",r.style.height=a.height+"px",r.style.transform=`translateX(${a.left}px) translateY(${a.top}px) translateZ(0)`,r.classList.add("dragging"),this.setCurrentDragger(r),this.addListeners(r,n)}handleDragMove(t){t.preventDefault(),!this.isDisabled&&this.interactionMove(t.clientX,t.clientY)}handleTouchMove(t){t.preventDefault(),!this.isDisabled&&t.targetTouches.length==1&&this.interactionMove(t.touches[0].clientX,t.touches[0].clientY)}interactionMove(t,i){const s=this.currentDragger;this.offsetX=t-this.initialX,this.offsetY=i-this.initialY,this.constrainDraggerToWrapper(s,this.wrapper),s.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0) scale(1)`;const n=s.getBoundingClientRect();this.findDraggerItemTarget(s,n,this.targets),this.isItemStartSource||this.findSourceDraggerTarget(s,n)}constrainDraggerToWrapper(t,i){const s=t.getBoundingClientRect(),n=i.getBoundingClientRect(),r=this.startingX+this.offsetX-n.x,a=this.startingY+this.offsetY-n.y,o=this.startingX+s.width+this.offsetX-(n.x+n.width),u=this.startingY+s.height+this.offsetY-(n.y+n.height);r<0&&(this.offsetX=this.offsetX-r),o>0&&(this.offsetX=this.offsetX-o),a<0&&(this.offsetY=this.offsetY-a),u>0&&(this.offsetY=this.offsetY-u)}handleDragEnd(t){this.isDisabled||this.interactionEnd(t.clientX,t.clientY,!1)}handleTouchEnd(t){this.isDisabled||this.interactionEnd(t.changedTouches[0].clientX,t.changedTouches[0].clientY,!0)}interactionEnd(t,i,s){const n=this.currentDragger;if(this.itemTarget===null?n.style.transform=`translateX(${this.startingX}px) translateY(${this.startingY}px) translateZ(0)`:n.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0)`,n.removeAttribute("style"),n.classList.remove("dragging"),this.clearTargetHighlights(),this.itemTarget===null){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemTarget.classList.contains("active")){if(this.itemTarget.classList.remove("active"),this.isExceedingMaxAssociations(this.itemStart,this.itemTarget,n)){this.resetDraggerToItemStart(this.itemStart,n),this.notifyAssociationsLimit(),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemStart.getAttribute("data-identifier")===this.itemTarget.getAttribute("data-identifier")){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}this.removePlaceholder(n),this.setDraggerToItemTarget(this.itemTarget,n),this.itemTarget.classList.contains("source")&&(this.itemTarget.classList.add("full"),this.itemTarget.dataset.matchMax*1>0&&this.incrementRemaining(this.itemTarget),this.decrementAssociationsCount(),this.sortContainerElements(this.sourcewrapper)),this.itemStart.classList.contains("source")&&(this.itemStart.dataset.matchMax*1>0&&this.decrementRemaining(this.itemStart)===0&&this.itemStart.classList.remove("full"),this.incrementAssociationsCount()),this.itemStart.classList.contains("target")&&(this.isTargetFull(this.itemStart)?this.itemStart.classList.add("full"):this.itemStart.classList.remove("full")),this.notifyUpdate()}this.setCurrentDragger(null),this.removeListeners(n,s)}setCurrentDragger(t){this.currentDragger=t}resetDraggerToItemStart(t,i){this.replacePlaceholder(i),t.classList.contains("source")||i.setAttribute("style","width:100%")}setDraggerToItemTarget(t,i){if(t.classList.contains("source")){if(t.classList.contains("full")){const s=t.querySelector(".draggable");s!=null&&t.replaceChild(i,s);return}t.append(i);return}t.append(i),i.setAttribute("style","width:100%"),this.isTargetFull(t)?t.classList.add("full"):t.classList.remove("full")}findDraggerItemTarget(t,i,s){this.itemTarget=null,s.forEach(n=>{const r=n.getBoundingClientRect();if(i.top+t.offsetHeight/2<r.bottom&&i.right-t.offsetWidth/2>r.left&&i.bottom-t.offsetHeight/2>r.top&&i.left+t.offsetWidth/2<r.right){if(this.isItemStartSource&&n.classList.contains("source")||n.classList.contains("full")||!this.hasMatchingMatchGroup(t.parentNode,n))return;n.classList.add("active"),this.itemTarget=n}else n.classList.remove("active")},this)}findSourceDraggerTarget(t,i){const s=this.sourcewrapper.getBoundingClientRect();if(i.top+t.offsetHeight/2<s.bottom&&i.right-t.offsetWidth/2>s.left&&i.bottom-t.offsetHeight/2>s.top&&i.left+t.offsetWidth/2<s.right){for(let n=0;n<this.sources.length;n++)if(this.sources[n].dataset.identifier===t.dataset.identifier){this.sources[n].classList.add("active"),this.itemTarget=this.sources[n];break}}else for(let n=0;n<this.sources.length;n++)this.sources[n].classList.contains("active")&&this.sources[n].classList.remove("active")}addPlaceholder(t){if(!t.parentNode.classList.contains("source")){this.addPlaceholderElement(t,!1);return}const i=t.parentNode.dataset.matchMax*1;if(i===1){this.addPlaceholderElement(t,!1);return}if(i===0){this.addPlaceholderElement(t,!0);return}if(this.getRemaining(t.parentNode)===1){this.addPlaceholderElement(t,!1);return}this.addPlaceholderElement(t,!0)}addPlaceholderElement(t,i){const s=t.cloneNode(!0);this.deepCloneId(s),i?(s.classList.add("clone"),s.addEventListener("mousedown",this.handleDragStart),s.addEventListener("touchstart",this.handleTouchStart)):s.classList.add("gm-dragger-placeholder"),s.classList.add("placeholder-fade"),t.parentNode.insertBefore(s,t)}removePlaceholder(t){if(t.parentNode.classList.contains("target")){const n=t.parentNode.querySelector(".gm-dragger-placeholder");if(n===null)return;t.parentNode.removeChild(n);return}const i=t.parentNode.dataset.matchMax*1,s=t.parentNode.querySelector(".gm-dragger-placeholder");if(s===null){const n=t.parentNode.querySelector(".clone");if(n===null)return;n.classList.remove("placeholder-fade");return}i!==0&&t.parentNode.removeChild(s)}replacePlaceholder(t){const i=t.parentNode;let s=i.querySelector(".gm-dragger-placeholder");if(i.classList.contains("source")){if(s==null&&(s=i.querySelector(".draggable")),s===null)return;i.replaceChild(t,s);return}s!==null&&i.replaceChild(t,s)}addClonePlaceholder(t){const i=t.cloneNode(!0);this.deepCloneId(i),i.classList.add("clone"),t.parentNode.insertBefore(i,t),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)}initializeSources(t){this.sources=t.querySelectorAll(".source"),this.sources.forEach(i=>{i.classList.add("full");const s=i.dataset.matchMax*1;this.setRemaining(i,s===0?1e3:s)},this),this.draggers=t.querySelectorAll(".draggable"),this.draggers.forEach((i,s)=>{const n=i.parentNode.getAttribute("data-identifier");i.setAttribute("data-identifier",n),i.setAttribute("data-order",s),i.setAttribute("tabindex",0),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)},this)}initializeTargets(t){this.targets=t.querySelectorAll(".target"),this.targets.forEach(i=>{i.setAttribute("tabindex",0)})}identifyTargets(t,i){this.targets.forEach(s=>{i&&!s.classList.contains("full")&&this.hasMatchingMatchGroup(t,s)&&s.classList.add("target-active")},this),i&&!this.isItemStartSource&&this.sourcewrapper.classList.add("target-active")}addListeners(t,i){i?(this.removeListeners(t,i),t.addEventListener("touchmove",this.handleTouchMove),t.addEventListener("touchend",this.handleTouchEnd)):(this.removeListeners(t,i),document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd))}removeListeners(t,i){i?(t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("touchend",this.handleTouchEnd)):(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd))}clearTargetHighlights(){this.targets.forEach(t=>{t.classList.remove("target-active")},this),this.sourcewrapper.classList.remove("target-active")}getClosestElement(t,i){return t?t&&t.classList.contains(i)?t:this.getClosestElement(t.parentElement,i):!1}sortContainerElements(t){let i=[],s=t.children;for(let n=0;n<s.length;n++){const r=s[n].querySelector("div.draggable");r&&i.push([1*r.dataset.order,s[n]])}i.sort(function(n,r){return n[0]-r[0]});for(let n=0;n<i.length;n++)t.appendChild(i[n][1])}getResponse(){return this.computeResponse()}computeResponse(){let t=[];return this.targets.forEach(i=>{i.querySelectorAll(".draggable").forEach(s=>{t.push(`${s.dataset.identifier} ${i.dataset.identifier}`)})}),t.length===0?null:this.options.cardinality==="single"?t[0]:t}restoreResponse(t){t!==null&&(this.options.cardinality==="single"?this.restoreResponsePair(t):t.forEach(i=>{this.restoreResponsePair(i)},this))}restoreResponsePair(t){const i=this.getPair(t);if(i===null)return;const s=this.findSourceByIdentifier(i.source),n=this.findTargetGapByIdentifier(i.target);if(s===null||n===null)return;const r=s.querySelector(".draggable");r!==null&&(this.cloneOrEmptySourceDragger(s,r),this.restoreSourceDraggerToTarget(n,r))}cloneOrEmptySourceDragger(t,i){const s=t.dataset.matchMax*1;if(s===1){t.classList.remove("full"),this.decrementRemaining(t);return}if(s===0){this.addClonePlaceholder(i);return}if(this.getRemaining(t)===1){t.classList.remove("full"),this.decrementRemaining(t);return}this.decrementRemaining(t),this.addClonePlaceholder(i)}findSourceByIdentifier(t){for(let i=0;i<this.sources.length;i++)if(t===this.sources[i].dataset.identifier)return this.sources[i];return null}findTargetGapByIdentifier(t){for(let i=0;i<this.targets.length;i++)if(t===this.targets[i].dataset.identifier)return this.targets[i];return null}getPair(t){if(t===null)return null;const i=t.split(" ");return i.length!=2?null:{source:i[0],target:i[1]}}restoreSourceDraggerToTarget(t,i){t===null||i===null||(t.append(i),i.setAttribute("style","width:100%"),this.incrementAssociationsCount(),this.isTargetFull(t)&&t.classList.add("full"))}hasMatchingMatchGroup(t,i){return t===null||i===null?!1:t.dataset.matchGroup===i.dataset.matchGroup}isTargetFull(t){if(t==null)return!1;const i=t.querySelectorAll(".draggable"),s=t.dataset.matchMax*1;return s===0?!1:i.length>=s}isExceedingMaxAssociations(t,i){return!(this.options.maxAssociations===0||i.classList.contains("source")||t.classList.contains("target")||this.currentAssociationsCount<this.options.maxAssociations)}initializeAssociationsCount(){this.currentAssociationsCount=0}incrementAssociationsCount(){this.currentAssociationsCount+=1}decrementAssociationsCount(){this.currentAssociationsCount!==0&&(this.currentAssociationsCount-=1)}getRemaining(t){return t.dataset.remaining*1}setRemaining(t,i){t.setAttribute("data-remaining",i)}incrementRemaining(t){const i=t.dataset.remaining*1+1;return t.setAttribute("data-remaining",i),i}decrementRemaining(t){let i=t.dataset.remaining*1-1;return i=i>=0?i:0,t.setAttribute("data-remaining",i),i}deepCloneId(t){t.id&&(t.id=`clone_${this.qtiAttributeValidation.randomString(5,"a")}`);for(let i=0;i<t.children.length;i++)this.deepCloneId(t.children[i])}reset(){this.resetDraggersToSources(),this.initializeAssociationsCount(),this.destroy()}resetDraggersToSources(){this.targets.forEach(t=>{t.querySelectorAll(".draggable").forEach(s=>{const n=this.findSourceByIdentifier(s.getAttribute("data-identifier"));n.classList.contains("full")||(t.classList.remove("full"),n.classList.contains("full")?t.removeChild(s):(n.append(s),n.classList.add("full")))},this)},this)}destroy(){this.currentDragger!==null&&(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd)),this.wrapper.querySelectorAll(".draggable").forEach(i=>{i.removeEventListener("touchstart",this.handleTouchStart),i.removeEventListener("touchmove",this.handleTouchMove),i.removeEventListener("touchend",this.handleTouchEnd),i.removeEventListener("mousedown",this.handleDragStart)},this)}}const iq=new G,sq=new ie,nq={emits:["gapMatchGroupReady","gapMatchGroupUpdate","gapMatchGroupAssociationsLimit"],props:{responseIdentifier:{required:!0,type:String},cardinality:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},maxAssociations:{required:!1,type:String,default:"1"},minAssociations:{required:!1,type:String,default:"0"},dataChoicesContainerWidth:{required:!1,type:String,default:null},interactionSubType:{required:!1,type:String,default:"default"},gapMatchInteractionStaticClass:{required:!0,type:String},priorState:{required:!1,type:Object,default:null}},data(){return{choices:[],order:[],gaps:[],response:null,isShuffle:null,hasPrompt:!1,gapMatchInteractionClassAttribute:null,presentationFactory:null,matchable:null,isQtiValid:!0}},computed:{computedMaxAssociations(){return this.maxAssociations*1}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},disable(){this.matchable!==null&&this.matchable.toggleDisable(!0)},enable(){this.matchable!==null&&this.matchable.toggleDisable(!1)},getChoices(){return this.choices},setIsShuffle(e){this.isShuffle=e},validateChildren(){let e=0;this.$slots.default()[0].children.forEach(t=>{if(iq.isValidSlot(t)){if(t.type.name==="QtiPrompt"){if(e>0)throw new c("Invalid element order. qti-prompt must come before qti-gap-text's, qti-gap-img's, or qti-gap's");if(!this.hasPrompt)return this.hasPrompt=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(t.type.name==="QtiGapText"||t.type.name==="QtiGapImg")return e+=1;throw new c('Node is not one of qti-gap-text or qti-gap-img: "'+t.type.name+'"')}})},processChildren(){this.$.subTree.children[0].children[0].children.forEach(i=>{i.component!==null&&(i.type.name==="QtiGapText"||i.type.name==="QtiGapImg")&&this.choices.push(i.component.proxy)}),this.$refs.root.querySelectorAll(".gap-match-gap").forEach(i=>{this.gaps.push(i)})},insertAfter(e,t){t.parentNode.insertBefore(e,t.nextSibling)},processGroupUI(e){let t=this.createGapChoiceWrapper();if(t==null)return;let i=this.createContainer(this.priorState);this.processContainerChoices(i,t),this.saveContainerOrder(i);let s=this.createGapTargetWrapper(t);this.presentationFactory.initialize(this.$refs.root,t,s,this.dataChoicesContainerWidth,this.choices,this.gaps),this.matchable=new tq(this.$refs.root,{interactionSubType:this.interactionSubType,cardinality:this.cardinality,maxAssociations:this.computedMaxAssociations,response:e,onReady:this.handleWidgetReady,onUpdate:this.handleWidgetUpdate,onAssociationsLimit:this.handleAssociationsLimit})},createGapChoiceWrapper(){let e=this.$refs.root.querySelector(".qti-gap-choice");if(e===null)return null;let t=document.createElement("ul");return t.classList.add("qti-gap-match-source-wrapper"),this.$refs.root.insertBefore(t,e),t},createGapTargetWrapper(e){const t=document.createElement("div");t.classList.add("qti-gap-match-target-wrapper"),this.insertAfter(t,e);const i=t.nextElementSibling;return i!=null&&t.append(i),t},createContainer(e){let t=[];return e===null?(this.choices.forEach(s=>{t.push({fixed:s.fixed==="true",node:s})}),this.isShuffle&&sq.shuffleArrayFixed(t),t):(e.state.order.forEach(s=>{const n=this.findChoiceByIdentifier(s,this.choices);n!==null&&t.push({fixed:n.fixed==="true",node:n})},this),t)},processContainerChoices(e,t){this.choices.splice(0,this.choices.length),t.innerHTML="",e.forEach(i=>{t.appendChild(i.node.$el),this.choices.push(i.node)},this)},saveContainerOrder(e){const t=[];e.forEach(i=>{t.push(i.node.identifier)}),this.order=t},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Gap Match Interaction State Invalid. Choice identifier "'+e+'" not found.')},resetGroupUI(){this.processGroupUI(null)},handleWidgetReady(e){this.setResponse(e.response),this.$emit("gapMatchGroupReady",{response:this.getResponse(),order:this.order})},handleWidgetUpdate(e){this.setResponse(e.response),this.$emit("gapMatchGroupUpdate",{response:this.getResponse()})},handleAssociationsLimit(){this.$emit("gapMatchGroupAssociationsLimit")},initializeGapMatchGroup(){this.presentationFactory=new eq(this.gapMatchInteractionStaticClass)}},created(){try{if(typeof this.cardinality>"u")throw new c("Undefined qti-gap-match-interaction cardinality");if(this.cardinality!=="single"&&this.cardinality!=="multiple")throw new c('qti-gap-match-interaction cardinality must be "single" or "multiple"');this.setIsShuffle(this.shuffle==="true"),this.initializeGapMatchGroup(),this.validateChildren()}catch(e){throw this.isQtiValid=!1,console.log("[QtiGapMatchInteraction][ValidationError]",e.name,e.message),new c(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.processGroupUI(this.priorState===null?null:this.priorState.value)}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw console.log("[QtiGapMatchInteraction][ValidationException]",e.message),new c(e.message);if(e.name==="QtiEvaluationException")throw console.log("[QtiGapMatchInteraction][EvaluationException]",e.message),new O(e.message)}},beforeUnmount(){this.matchable!==null&&(this.matchable.destroy(),this.matchable=null)}},rq={ref:"root",class:"qti-gap-match-group-wrapper"};function aq(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",rq,[l.renderSlot(e.$slots,"default")],512)}const oq=B(nq,[["render",aq]]);class lq{constructor(t){this.constants={QTI_SELECTIONS_LIGHT:"qti-selections-light",QTI_SELECTIONS_DARK:"qti-selections-dark",QTI_UNSELECTED_HIDDEN:"qti-unselected-hidden",QTI_CHOICES_TOP:"qti-choices-top",QTI_CHOICES_BOTTOM:"qti-choices-bottom",QTI_CHOICES_LEFT:"qti-choices-left",QTI_CHOICES_RIGHT:"qti-choices-right",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message",DATA_CHOICES_CONTAINER_WIDTH:null},this.parentClass=t,this.clazzTokens=[],this.ggmGroupElement=null,this.ggmChoiceWrapperElement=null,this.ggmTargetWrapperElement=null,this.image=null,this.choicesContainerWidth=null,this.gapChoices=[],this.gaps=[],this.presentation_Choices_Orientation=null,this.presentation_Theme=this.constants.QTI_SELECTIONS_DARK,this.presentation_UnselectedHidden=!1,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage=""}initialize(t,i,s,n,r,a,o){this.ggmGroupElement=t,this.ggmChoiceWrapperElement=i,this.ggmTargetWrapperElement=s,this.image=n,this.choicesContainerWidth=r,this.gapChoices=a,this.gaps=o,this.processRootClassAttribute(this.parentClass),this.processPresentation()}processRootClassAttribute(t){const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case this.constants.QTI_CHOICES_TOP:case this.constants.QTI_CHOICES_BOTTOM:case this.constants.QTI_CHOICES_LEFT:case this.constants.QTI_CHOICES_RIGHT:this.presentation_Choices_Orientation=i[s];break;case this.constants.QTI_SELECTIONS_DARK:case this.constants.QTI_SELECTIONS_LIGHT:this.presentation_Theme=i[s];break;case this.constants.QTI_UNSELECTED_HIDDEN:this.presentation_UnselectedHidden=!0;break}this.clazzTokens=i}processPresentation(){this.presentation_Choices_Orientation===null&&(this.presentation_Choices_Orientation=this.constants.QTI_CHOICES_TOP),this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_LEFT?(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_LEFT),this.ggmGroupElement.classList.add(this.constants.QTI_CHOICES_LEFT)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_TOP?(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_TOP)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_RIGHT?(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.ggmGroupElement.classList.add(this.constants.QTI_CHOICES_RIGHT),this.ggmGroupElement.insertBefore(this.ggmTargetWrapperElement,this.ggmChoiceWrapperElement)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_BOTTOM&&(this.ggmChoiceWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.ggmTargetWrapperElement.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.ggmGroupElement.insertBefore(this.ggmTargetWrapperElement,this.ggmChoiceWrapperElement)),this.processBackgroundImage(),this.processChoicesContainerWidth(),this.processGaps()}processBackgroundImage(){if(this.image===null)return;this.image.setAttribute("draggable","false");const t=this.image.getBoundingClientRect();this.ggmTargetWrapperElement.style.width=`${t.width}px`,this.ggmTargetWrapperElement.style.height=`${t.height}px`}processChoicesContainerWidth(){this.choicesContainerWidth!==null&&(this.ggmChoiceWrapperElement.style.width=`${this.choicesContainerWidth}px`,this.ggmChoiceWrapperElement.style.textAlign="center")}processGaps(){for(let t=0;t<this.gaps.length;t++){const i=this.gaps[t];this.setGapStyle(i,i.getShape(),i.getShapeData()),this.gaps[t].$refs.gap.classList.add("target",this.presentation_Theme),this.presentation_UnselectedHidden&&this.gaps[t].$refs.gap.classList.add(this.constants.QTI_UNSELECTED_HIDDEN)}}setGapStyle(t,i,s){switch(i){case"rect":t.$refs.gap.style.left=`${s[0]}px`,t.$refs.gap.style.top=`${s[1]}px`,t.$refs.gap.style.width=`${s[2]}px`,t.$refs.gap.style.height=`${s[3]}px`;break}}}class cq{constructor(t,i){J(this,"options",{interactionSubType:"default",cardinality:"multiple",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null,zindex:1e3});return this.qtiAttributeValidation=new G,this.wrapper=t,this.sourcewrapper=this.wrapper.querySelector(".qti-ggm-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-ggm-target-wrapper"),this.processOptions(i),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragMove=this.handleDragMove.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.itemTarget=null,this.itemStart=null,this.isItemStartSource=!0,this.savedGapZindex="",this.initialX=0,this.initialY=0,this.offsetX=0,this.offsetY=0,this.startingX=0,this.startingY=0,this.currentAssociationsCount=0,this.isDisabled=!1,this.currentDragger=null,this.initializeSources(this.sourcewrapper),this.initializeTargets(this.targetwrapper),this.restoreResponse(this.options.response),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.draggers.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleDragStart(t){if(t.preventDefault(),!this.isDisabled&&t.button==0)return this.interactionStart(t.target,t.clientX,t.clientY,!1),!1}handleTouchStart(t){if(t.preventDefault(),!this.isDisabled)return t.targetTouches.length!=1||this.interactionStart(t.target,t.touches[0].pageX,t.touches[0].pageY,!0),!1}interactionStart(t,i,s,n){const r=this.getClosestElement(t,"draggable");this.itemStart=r.parentNode,this.isItemStartSource=this.itemStart.classList.contains("source"),this.isItemStartSource||this.saveGapZindex(this.itemStart),this.identifyTargets(this.itemStart,!0),this.itemTarget=null;const a=r.getBoundingClientRect();this.initialX=i,this.initialY=s,this.startingX=a.left,this.startingY=a.top,this.offsetX=i-this.startingX,this.offsetY=s-this.startingY,this.addPlaceholder(r),r.classList.add("dragging"),r.style.userSelect="none",r.style.width=a.width+"px",r.style.height=a.height+"px",r.style.transform=`translateX(${a.left}px) translateY(${a.top}px) translateZ(0)`,this.setCurrentDragger(r),this.addListeners(r,n)}handleDragMove(t){t.preventDefault(),!this.isDisabled&&this.interactionMove(t.clientX,t.clientY)}handleTouchMove(t){t.preventDefault(),!this.isDisabled&&t.targetTouches.length==1&&this.interactionMove(t.touches[0].clientX,t.touches[0].clientY)}interactionMove(t,i){const s=this.currentDragger;this.offsetX=t-this.initialX,this.offsetY=i-this.initialY,this.constrainDraggerToWrapper(s,this.wrapper),s.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0) scale(1)`;const n=s.getBoundingClientRect();this.findDraggerItemTarget(s,n,this.targets),this.isItemStartSource||this.findSourceDraggerTarget(s,n)}constrainDraggerToWrapper(t,i){const s=t.getBoundingClientRect(),n=i.getBoundingClientRect(),r=this.startingX+this.offsetX-n.x,a=this.startingY+this.offsetY-n.y,o=this.startingX+s.width+this.offsetX-(n.x+n.width),u=this.startingY+s.height+this.offsetY-(n.y+n.height);r<0&&(this.offsetX=this.offsetX-r),o>0&&(this.offsetX=this.offsetX-o),a<0&&(this.offsetY=this.offsetY-a),u>0&&(this.offsetY=this.offsetY-u)}handleDragEnd(t){this.isDisabled||this.interactionEnd(t.clientX,t.clientY,!1)}handleTouchEnd(t){this.isDisabled||this.interactionEnd(t.changedTouches[0].clientX,t.changedTouches[0].clientY,!0)}interactionEnd(t,i,s){const n=this.currentDragger;if(this.itemTarget===null?n.style.transform=`translateX(${this.startingX}px) translateY(${this.startingY}px) translateZ(0)`:n.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0)`,n.removeAttribute("style"),n.classList.remove("dragging"),this.clearTargetHighlights(),this.itemTarget===null){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemTarget.classList.contains("active")){if(this.itemTarget.classList.remove("active"),this.isExceedingMaxAssociations(this.itemStart,this.itemTarget,n)){this.resetDraggerToItemStart(this.itemStart,n),this.notifyAssociationsLimit(),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemStart.getAttribute("data-identifier")===this.itemTarget.getAttribute("data-identifier")){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}this.removePlaceholder(n),this.setDraggerToItemTarget(this.itemTarget,n),this.itemTarget.classList.contains("source")&&(this.itemTarget.classList.add("full"),this.itemTarget.dataset.matchMax*1>0&&this.incrementRemaining(this.itemTarget),this.decrementAssociationsCount(),this.sortContainerElements(this.sourcewrapper)),this.itemStart.classList.contains("source")&&(this.itemStart.dataset.matchMax*1>0&&this.decrementRemaining(this.itemStart)===0&&this.itemStart.classList.remove("full"),this.incrementAssociationsCount()),this.itemStart.classList.contains("target")&&(this.restoreGapZindex(this.itemStart),this.isTargetFull(this.itemStart)?this.itemStart.classList.add("full","contains-choice"):(this.itemStart.classList.remove("full"),this.containsChoices(this.itemStart)?this.itemStart.classList.add("contains-choice"):this.itemStart.classList.remove("contains-choice"))),this.notifyUpdate()}this.setCurrentDragger(null),this.removeListeners(n,s)}setCurrentDragger(t){this.currentDragger=t}resetDraggerToItemStart(t,i){t.classList.contains("target")&&this.restoreGapZindex(t),this.replacePlaceholder(i)}setDraggerToItemTarget(t,i){if(t.classList.contains("source")){this.appendDraggerToSourceTarget(t,i);return}this.appendDraggerToGapTarget(t,i),this.isTargetFull(t)?t.classList.add("full"):t.classList.remove("full")}appendDraggerToSourceTarget(t,i){if(t.classList.contains("full")){const s=t.querySelector(".draggable");s!=null&&t.replaceChild(i,s);return}t.append(i)}appendDraggerToGapTarget(t,i){t.classList.add("contains-choice"),t.append(i)}findDraggerItemTarget(t,i,s){this.itemTarget=null,s.forEach(n=>{const r=n.getBoundingClientRect();if(i.top+t.offsetHeight/2<r.bottom&&i.right-t.offsetWidth/2>r.left&&i.bottom-t.offsetHeight/2>r.top&&i.left+t.offsetWidth/2<r.right){if(this.isItemStartSource&&n.classList.contains("source")||n.classList.contains("full")||!this.hasMatchingMatchGroup(t.parentNode,n))return;n.classList.add("active"),this.itemTarget=n}else n.classList.remove("active")},this)}findSourceDraggerTarget(t,i){const s=this.sourcewrapper.getBoundingClientRect();if(i.top+t.offsetHeight/2<s.bottom&&i.right-t.offsetWidth/2>s.left&&i.bottom-t.offsetHeight/2>s.top&&i.left+t.offsetWidth/2<s.right){for(let n=0;n<this.sources.length;n++)if(this.sources[n].dataset.identifier===t.dataset.identifier){this.sources[n].classList.add("active"),this.itemTarget=this.sources[n];break}}else for(let n=0;n<this.sources.length;n++)this.sources[n].classList.contains("active")&&this.sources[n].classList.remove("active")}addPlaceholder(t){if(!t.parentNode.classList.contains("source")){this.addPlaceholderElement(t,!1);return}const i=t.parentNode.dataset.matchMax*1;if(i===1){this.addPlaceholderElement(t,!1);return}if(i===0){this.addPlaceholderElement(t,!0);return}if(this.getRemaining(t.parentNode)===1){this.addPlaceholderElement(t,!1);return}this.addPlaceholderElement(t,!0)}addPlaceholderElement(t,i){const s=t.cloneNode(!0);this.deepCloneId(s),i?(s.classList.add("clone"),s.addEventListener("mousedown",this.handleDragStart),s.addEventListener("touchstart",this.handleTouchStart)):s.classList.add("ggm-dragger-placeholder"),s.classList.add("placeholder-fade"),t.parentNode.insertBefore(s,t)}removePlaceholder(t){if(t.parentNode.classList.contains("target")){const n=t.parentNode.querySelector(".ggm-dragger-placeholder");if(n===null)return;t.parentNode.removeChild(n);return}const i=t.parentNode.dataset.matchMax*1,s=t.parentNode.querySelector(".ggm-dragger-placeholder");if(s===null){const n=t.parentNode.querySelector(".clone");if(n===null)return;n.classList.remove("placeholder-fade");return}i!==0&&t.parentNode.removeChild(s)}replacePlaceholder(t){const i=t.parentNode;let s=i.querySelector(".ggm-dragger-placeholder");if(i.classList.contains("source")){if(s==null&&(s=i.querySelector(".draggable")),s===null)return;i.replaceChild(t,s);return}s!==null&&i.replaceChild(t,s)}addClonePlaceholder(t){const i=t.cloneNode(!0);this.deepCloneId(i),i.classList.add("clone"),t.parentNode.insertBefore(i,t),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)}initializeSources(t){this.sources=t.querySelectorAll(".source"),this.sources.forEach(i=>{i.classList.add("full");const s=i.dataset.matchMax*1;this.setRemaining(i,s===0?1e3:s)},this),this.draggers=t.querySelectorAll(".draggable"),this.draggers.forEach((i,s)=>{const n=i.parentNode.getAttribute("data-identifier");i.setAttribute("data-identifier",n),i.setAttribute("data-order",s),i.setAttribute("tabindex",0),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)},this)}initializeTargets(t){this.targets=t.querySelectorAll(".target"),this.targets.forEach(i=>{i.setAttribute("tabindex",0)})}identifyTargets(t,i){this.targets.forEach(s=>{i&&!s.classList.contains("full")&&this.hasMatchingMatchGroup(t,s)&&s.classList.add("target-active")},this),i&&!this.isItemStartSource&&this.sourcewrapper.classList.add("target-active")}addListeners(t,i){i?(this.removeListeners(t,i),t.addEventListener("touchmove",this.handleTouchMove),t.addEventListener("touchend",this.handleTouchEnd)):(this.removeListeners(t,i),document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd))}removeListeners(t,i){i?(t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("touchend",this.handleTouchEnd)):(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd))}clearTargetHighlights(){this.targets.forEach(t=>{t.classList.remove("target-active")},this),this.sourcewrapper.classList.remove("target-active")}getClosestElement(t,i){return t?t&&t.classList.contains(i)?t:this.getClosestElement(t.parentElement,i):!1}sortContainerElements(t){let i=[],s=t.children;for(let n=0;n<s.length;n++){const r=s[n].querySelector("div.draggable");r&&i.push([1*r.dataset.order,s[n]])}i.sort(function(n,r){return n[0]-r[0]});for(let n=0;n<i.length;n++)t.appendChild(i[n][1])}saveGapZindex(t){this.savedGapZindex=t.style.zIndex,t.style.zIndex=this.options.zindex}restoreGapZindex(t){t.style.zIndex=this.savedGapZindex}getResponse(){return this.computeResponse()}computeResponse(){let t=[];return this.targets.forEach(i=>{i.querySelectorAll(".draggable").forEach(s=>{t.push(`${s.dataset.identifier} ${i.dataset.identifier}`)})}),t.length===0?null:this.options.cardinality==="single"?t[0]:t}restoreResponse(t){t!==null&&(this.options.cardinality==="single"?this.restoreResponsePair(t):t.forEach(i=>{this.restoreResponsePair(i)},this))}restoreResponsePair(t){const i=this.getPair(t);if(i===null)return;const s=this.findSourceByIdentifier(i.source),n=this.findTargetGapByIdentifier(i.target);if(s===null||n===null)return;const r=s.querySelector(".draggable");r!==null&&(this.cloneOrEmptySourceDragger(s,r),this.restoreSourceDraggerToTarget(n,r))}cloneOrEmptySourceDragger(t,i){const s=t.dataset.matchMax*1;if(s===1){t.classList.remove("full"),this.decrementRemaining(t);return}if(s===0){this.addClonePlaceholder(i);return}if(this.getRemaining(t)===1){t.classList.remove("full"),this.decrementRemaining(t);return}this.decrementRemaining(t),this.addClonePlaceholder(i)}findSourceByIdentifier(t){for(let i=0;i<this.sources.length;i++)if(t===this.sources[i].dataset.identifier)return this.sources[i];return null}findTargetGapByIdentifier(t){for(let i=0;i<this.targets.length;i++)if(t===this.targets[i].dataset.identifier)return this.targets[i];return null}getPair(t){if(t===null)return null;const i=t.split(" ");return i.length!=2?null:{source:i[0],target:i[1]}}restoreSourceDraggerToTarget(t,i){t===null||i===null||(this.appendDraggerToGapTarget(t,i),this.incrementAssociationsCount(),this.isTargetFull(t)&&t.classList.add("full"))}hasMatchingMatchGroup(t,i){return t===null||i===null?!1:t.dataset.matchGroup===i.dataset.matchGroup}isTargetFull(t){if(t==null)return!1;const i=t.querySelectorAll(".draggable"),s=t.dataset.matchMax*1;return s===0?!1:i.length>=s}containsChoices(t){return t==null?!1:t.querySelectorAll(".draggable").length!==0}isExceedingMaxAssociations(t,i){return!(this.options.maxAssociations===0||i.classList.contains("source")||t.classList.contains("target")||this.currentAssociationsCount<this.options.maxAssociations)}initializeAssociationsCount(){this.currentAssociationsCount=0}incrementAssociationsCount(){this.currentAssociationsCount+=1}decrementAssociationsCount(){this.currentAssociationsCount!==0&&(this.currentAssociationsCount-=1)}getRemaining(t){return t.dataset.remaining*1}setRemaining(t,i){t.setAttribute("data-remaining",i)}incrementRemaining(t){const i=t.dataset.remaining*1+1;return t.setAttribute("data-remaining",i),i}decrementRemaining(t){let i=t.dataset.remaining*1-1;return i=i>=0?i:0,t.setAttribute("data-remaining",i),i}deepCloneId(t){t.id&&(t.id=`clone_${this.qtiAttributeValidation.randomString(5,"a")}`);for(let i=0;i<t.children.length;i++)this.deepCloneId(t.children[i])}reset(){this.resetDraggersToSources(),this.initializeAssociationsCount(),this.destroy()}resetDraggersToSources(){this.targets.forEach(t=>{t.querySelectorAll(".draggable").forEach(s=>{const n=this.findSourceByIdentifier(s.getAttribute("data-identifier"));n.classList.contains("full")||(n.classList.contains("full")?t.removeChild(s):(n.append(s),n.classList.add("full")))},this),t.classList.remove("full","contains-choice")},this)}destroy(){this.currentDragger!==null&&(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd)),this.wrapper.querySelectorAll(".draggable").forEach(i=>{i.removeEventListener("touchstart",this.handleTouchStart),i.removeEventListener("touchmove",this.handleTouchMove),i.removeEventListener("touchend",this.handleTouchEnd),i.removeEventListener("mousedown",this.handleDragStart)},this)}}const uq=new G,hq=new ie,dq={emits:["ggmGroupReady","ggmGroupUpdate","ggmGroupAssociationsLimit"],props:{responseIdentifier:{required:!0,type:String},cardinality:{required:!0,type:String},shuffle:{required:!1,type:String,default:"false"},maxAssociations:{required:!1,type:String,default:"1"},minAssociations:{required:!1,type:String,default:"0"},dataChoicesContainerWidth:{required:!1,type:String,default:null},interactionSubType:{required:!1,type:String,default:"default"},interactionStaticClass:{required:!0,type:String},priorState:{required:!1,type:Object,default:null}},data(){return{image:null,choices:[],order:[],gaps:[],response:null,isShuffle:null,hasPrompt:!1,interactionClassAttribute:null,presentationFactory:null,matchable:null,isQtiValid:!0}},computed:{computedMaxAssociations(){return this.maxAssociations*1}},methods:{getResponse(){return this.response},setResponse(e){this.response=e},disable(){this.matchable!==null&&this.matchable.toggleDisable(!0)},enable(){this.matchable!==null&&this.matchable.toggleDisable(!1)},getChoices(){return this.choices},setIsShuffle(e){this.isShuffle=e},validateChildren(){let e=0,t=0,i=!1;this.$slots.default()[0].children.forEach(s=>{if(uq.isValidSlot(s)){if(s.type.name==="QtiPrompt"){if(e>0||t>0||i)throw new c("Invalid element order. qti-prompt must come before the background image, qti-gap-text's, qti-gap-img's, or qti-associable-hotspot's");if(!this.hasPrompt)return this.hasPrompt=!0;throw new c("Maximum of 1 qti-prompt element permitted")}if(s.type.name==="QtiGapText"||s.type.name==="QtiGapImg"){if(t>0)throw new c("Invalid element order. qti-gap-text's and qti-gap-img's must come before qti-associable-hotspot's");return e+=1}if(s.type.name==="QtiAssociableHotspot")return t+=1;throw new c('Node is not one of qti-gap-text, qti-gap-img, or qti-associable-hotspot: "'+s.type.name+'"')}else if(s.type==="img"||s.type==="object"||s.type==="picture"){if(e>0||t>0)throw new c("Invalid element order. Background image must preceed qti-gap-text's, qti-gap-img's and qti-associable-hotspot's");i=!0}})},processChildren(){this.$.subTree.children[0].children[0].children.forEach(t=>{if(t.type==="img"||t.type==="object"||t.type==="picture"){this.image=t.el;return}t.component!==null&&(t.type.name==="QtiGapText"||t.type.name==="QtiGapImg"?this.choices.push(t.component.proxy):t.type.name==="QtiAssociableHotspot"&&this.gaps.push(t.component.proxy))})},insertAfter(e,t){t.parentNode.insertBefore(e,t.nextSibling)},processGroupUI(e){let t=this.createGapChoiceWrapper();if(t==null)return;let i=this.createGapTargetWrapper(),s=this.createContainer(this.priorState);this.processContainerChoices(s,t),this.saveContainerOrder(s),this.presentationFactory.initialize(this.$refs.root,t,i,this.image,this.dataChoicesContainerWidth,this.choices,this.gaps),this.matchable=new cq(this.$refs.root,{interactionSubType:this.interactionSubType,cardinality:this.cardinality,maxAssociations:this.computedMaxAssociations,response:e,onReady:this.handleWidgetReady,onUpdate:this.handleWidgetUpdate,onAssociationsLimit:this.handleAssociationsLimit})},createGapChoiceWrapper(){let e=this.$refs.root.querySelector(".qti-gap-choice");if(e===null)return null;let t=document.createElement("ul");return t.classList.add("qti-ggm-source-wrapper"),this.$refs.root.insertBefore(t,e),t},createGapTargetWrapper(){let e=document.createElement("div");e.classList.add("qti-ggm-target-wrapper"),e.append(this.image);for(let t=0;t<this.gaps.length;t++)e.append(this.gaps[t].$el);return this.$refs.root.append(e),e},createContainer(e){let t=[];return e===null?(this.choices.forEach(s=>{t.push({fixed:s.fixed==="true",node:s})}),this.isShuffle&&hq.shuffleArrayFixed(t),t):(e.state.order.forEach(s=>{const n=this.findChoiceByIdentifier(s,this.choices);n!==null&&t.push({fixed:n.fixed==="true",node:n})},this),t)},processContainerChoices(e,t){this.choices.splice(0,this.choices.length),t.innerHTML="",e.forEach(i=>{t.appendChild(i.node.$el),this.choices.push(i.node)},this)},saveContainerOrder(e){const t=[];e.forEach(i=>{t.push(i.node.identifier)}),this.order=t},findChoiceByIdentifier(e,t){for(let i=0;i<t.length;i++)if(t[i].$el.getAttribute("data-identifier")===e)return t[i];throw new O('Gap Match Interaction State Invalid. Choice identifier "'+e+'" not found.')},resetGroupUI(){this.processGroupUI(null)},handleWidgetReady(e){this.setResponse(e.response),this.$emit("ggmGroupReady",{response:this.getResponse(),order:this.order})},handleWidgetUpdate(e){this.setResponse(e.response),this.$emit("ggmGroupUpdate",{response:this.getResponse()})},handleAssociationsLimit(){this.$emit("ggmGroupAssociationsLimit")},initializeGraphicGapMatchGroup(){this.presentationFactory=new lq(this.interactionStaticClass)}},created(){try{if(typeof this.cardinality>"u")throw new c("Undefined qti-graphic-gap-match-interaction cardinality");if(this.cardinality!=="multiple")throw new c('qti-graphic-gap-match-interaction cardinality must be "multiple"');this.setIsShuffle(this.shuffle==="true"),this.initializeGraphicGapMatchGroup(),this.validateChildren()}catch(e){throw this.isQtiValid=!1,console.log("[QtiGapMatchInteraction][ValidationError]",e.name,e.message),new c(e.message)}},mounted(){if(this.isQtiValid)try{this.processChildren(),this.processGroupUI(this.priorState===null?null:this.priorState.value)}catch(e){if(this.isQtiValid=!1,e.name==="QtiValidationException")throw console.log("[QtiGapMatchInteraction][ValidationException]",e.message),new c(e.message);if(e.name==="QtiEvaluationException")throw console.log("[QtiGapMatchInteraction][EvaluationException]",e.message),new O(e.message)}},beforeUnmount(){this.matchable!==null&&(this.matchable.destroy(),this.matchable=null)}},fq={ref:"root",class:"qti-ggm-group-wrapper"};function pq(e,t,i,s,n,r){return l.openBlock(),l.createElementBlock("div",fq,[l.renderSlot(e.$slots,"default")],512)}const mq=B(dq,[["render",pq]]);class gq{constructor(){this.constants={QTI_CHOICES_TOP:"qti-choices-top",QTI_CHOICES_BOTTOM:"qti-choices-bottom",QTI_CHOICES_LEFT:"qti-choices-left",QTI_CHOICES_RIGHT:"qti-choices-right",QTI_MATCH_TABULAR:"qti-match-tabular",QTI_HEADER_HIDDEN:"qti-header-hidden",ROW_CENTRIC:"row-centric",DATA_MAX_SELECTIONS_MESSAGE:"data-max-selections-message",DATA_MIN_SELECTIONS_MESSAGE:"data-min-selections-message",DATA_FIRST_COLUMN_HEADER:""},this.interactionSubType="default",this.parentClass="",this.clazzTokens=[],this.matchWrapperElement=null,this.matchGroupNode=null,this.matchSetNode1=null,this.matchSetNode2=null,this.choices1=[],this.choices2=[],this.presentation_Choices_Orientation=null,this.presentation_Header_Hidden=!1,this.presentation_Row_Centric=!1,this.presentation_MaxSelectionsMessage="",this.presentation_MinSelectionsMessage=""}initialize(t,i,s,n,r){this.interactionSubType=t,this.matchWrapperElement=i,this.matchGroupNode=s,this.parentClass=s.matchInteractionStaticClass,this.matchSetNode1=n,this.matchSetNode2=r,this.choices1=this.matchSetNode1.getChoices(),this.choices2=this.matchSetNode2.getChoices(),this.processRootClassAttribute(this.parentClass),this.processPresentation()}processRootClassAttribute(t){const i=t.split(" ");for(let s=0;s<i.length;s++)switch(i[s]){case this.constants.QTI_CHOICES_TOP:case this.constants.QTI_CHOICES_BOTTOM:case this.constants.QTI_CHOICES_LEFT:case this.constants.QTI_CHOICES_RIGHT:this.presentation_Choices_Orientation=i[s];break;case this.constants.QTI_MATCH_TABULAR:break;case this.constants.QTI_HEADER_HIDDEN:this.presentation_Header_Hidden=!0;break;case this.constants.ROW_CENTRIC:this.presentation_Row_Centric=!0;break}this.clazzTokens=i}processPresentation(){this.matchSetNode1.$refs.matchset.classList.add("qti-match-source-wrapper"),this.matchSetNode2.$refs.matchset.classList.add("qti-match-target-wrapper"),this.interactionSubType==="default"?(this.presentation_Choices_Orientation===null&&(this.presentation_Choices_Orientation=this.constants.QTI_CHOICES_TOP),this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_LEFT?(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_LEFT),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_LEFT)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_TOP?(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_TOP),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_TOP)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_RIGHT?(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_RIGHT),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_RIGHT),this.matchWrapperElement.insertBefore(this.matchSetNode2.$refs.matchset,this.matchSetNode1.$refs.matchset)):this.presentation_Choices_Orientation===this.constants.QTI_CHOICES_BOTTOM&&(this.matchSetNode1.$refs.matchset.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.matchSetNode2.$refs.matchset.classList.add(this.constants.QTI_CHOICES_BOTTOM),this.matchWrapperElement.insertBefore(this.matchSetNode2.$refs.matchset,this.matchSetNode1.$refs.matchset)),this.updateMatchSetChoices(this.matchSetNode1,!0),this.updateMatchSetChoices(this.matchSetNode2,!1)):this.interactionSubType==="matchtabular"&&(this.createMatchTable(),this.matchSetNode1.$refs.matchset.classList.add("matchset-hidden"),this.matchSetNode2.$refs.matchset.classList.add("matchset-hidden"))}updateMatchSetChoices(t,i){const s=t.getChoices();for(let n=0;n<s.length;n++)i?(s[n].$refs.choice.classList.add("source"),s[n].$refs.description.classList.add("draggable")):(s[n].$refs.choice.classList.add("target"),s[n].$refs.description.classList.add("match-target-label"))}createMatchTable(){const t=document.createElement("table");this.clazzTokens.forEach(i=>{t.classList.add(i)}),t.classList.add("matchtabular","table","table-bordered"),this.matchWrapperElement.insertBefore(t,this.matchSetNode1.$refs.matchset)}}class yq{constructor(t,i){J(this,"options",{interactionSubType:"default",cardinality:"single",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null});return this.qtiAttributeValidation=new G,this.wrapper=t,this.sourcewrapper=this.wrapper.querySelector(".qti-match-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-match-target-wrapper"),this.processOptions(i),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragMove=this.handleDragMove.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.itemTarget=null,this.itemStart=null,this.isItemStartSource=!0,this.initialX=0,this.initialY=0,this.offsetX=0,this.offsetY=0,this.startingX=0,this.startingY=0,this.currentAssociationsCount=0,this.isDisabled=!1,this.currentDragger=null,this.initializeSources(this.sourcewrapper),this.initializeTargets(this.targetwrapper),this.restoreResponse(this.options.response),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.draggers.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleDragStart(t){if(t.preventDefault(),!this.isDisabled&&t.button==0)return this.interactionStart(t.target,t.clientX,t.clientY,!1),!1}handleTouchStart(t){if(t.preventDefault(),!this.isDisabled)return t.targetTouches.length!=1||this.interactionStart(t.target,t.touches[0].pageX,t.touches[0].pageY,!0),!1}interactionStart(t,i,s,n){const r=this.getClosestElement(t,"draggable");this.itemStart=r.parentNode,this.isItemStartSource=this.itemStart.classList.contains("source"),this.identifyTargets(this.itemStart,!0),this.itemTarget=null;const a=r.getBoundingClientRect();this.initialX=i,this.initialY=s,this.startingX=a.left,this.startingY=a.top,this.offsetX=i-this.startingX,this.offsetY=s-this.startingY,this.addPlaceholder(r),r.style.userSelect="none",r.style.width=a.width+"px",r.style.height=a.height+"px",r.style.transform=`translateX(${a.left}px) translateY(${a.top}px) translateZ(0)`,r.classList.add("dragging"),this.setCurrentDragger(r),this.addListeners(r,n)}handleDragMove(t){t.preventDefault(),!this.isDisabled&&this.interactionMove(t.clientX,t.clientY)}handleTouchMove(t){t.preventDefault(),!this.isDisabled&&t.targetTouches.length==1&&this.interactionMove(t.touches[0].clientX,t.touches[0].clientY)}interactionMove(t,i){const s=this.currentDragger;this.offsetX=t-this.initialX,this.offsetY=i-this.initialY,this.constrainDraggerToWrapper(s,this.wrapper),s.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0) scale(1)`;const n=s.getBoundingClientRect();this.findDraggerItemTarget(s,n,this.targets),this.isItemStartSource||this.findSourceDraggerTarget(s,n)}constrainDraggerToWrapper(t,i){const s=t.getBoundingClientRect(),n=i.getBoundingClientRect(),r=this.startingX+this.offsetX-n.x,a=this.startingY+this.offsetY-n.y,o=this.startingX+s.width+this.offsetX-(n.x+n.width),u=this.startingY+s.height+this.offsetY-(n.y+n.height);r<0&&(this.offsetX=this.offsetX-r),o>0&&(this.offsetX=this.offsetX-o),a<0&&(this.offsetY=this.offsetY-a),u>0&&(this.offsetY=this.offsetY-u)}handleDragEnd(t){this.isDisabled||this.interactionEnd(t.clientX,t.clientY,!1)}handleTouchEnd(t){this.isDisabled||this.interactionEnd(t.changedTouches[0].clientX,t.changedTouches[0].clientY,!0)}interactionEnd(t,i,s){const n=this.currentDragger;if(this.itemTarget===null?n.style.transform=`translateX(${this.startingX}px) translateY(${this.startingY}px) translateZ(0)`:n.style.transform=`translateX(${this.startingX+this.offsetX}px) translateY(${this.startingY+this.offsetY}px) translateZ(0)`,n.removeAttribute("style"),n.classList.remove("dragging"),this.clearTargetHighlights(),this.itemTarget===null){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemTarget.classList.contains("active")){if(this.itemTarget.classList.remove("active"),this.isExceedingMaxAssociations(this.itemStart,this.itemTarget,n)){this.resetDraggerToItemStart(this.itemStart,n),this.notifyAssociationsLimit(),this.setCurrentDragger(null),this.removeListeners(n,s);return}if(this.itemStart.getAttribute("data-identifier")===this.itemTarget.getAttribute("data-identifier")){this.resetDraggerToItemStart(this.itemStart,n),this.setCurrentDragger(null),this.removeListeners(n,s);return}this.removePlaceholder(n),this.setDraggerToItemTarget(this.itemTarget,n),this.itemTarget.classList.contains("source")&&(this.itemTarget.classList.add("full"),this.itemTarget.dataset.matchMax*1>0&&this.incrementRemaining(this.itemTarget),this.decrementAssociationsCount(),this.sortContainerElements(this.sourcewrapper)),this.itemStart.classList.contains("source")&&(this.itemStart.dataset.matchMax*1>0&&this.decrementRemaining(this.itemStart)===0&&this.itemStart.classList.remove("full"),this.incrementAssociationsCount()),this.itemStart.classList.contains("target")&&(this.isTargetFull(this.itemStart)?this.itemStart.classList.add("full"):this.itemStart.classList.remove("full")),this.notifyUpdate()}this.setCurrentDragger(null),this.removeListeners(n,s)}setCurrentDragger(t){this.currentDragger=t}resetDraggerToItemStart(t,i){this.replacePlaceholder(i),t.classList.contains("source")||i.setAttribute("style","width:100%")}setDraggerToItemTarget(t,i){if(t.classList.contains("source")){if(t.classList.contains("full")){const s=t.querySelector(".draggable");s!=null&&t.replaceChild(i,s);return}t.append(i);return}t.append(i),i.setAttribute("style","width:100%"),this.isTargetFull(t)?t.classList.add("full"):t.classList.remove("full")}findDraggerItemTarget(t,i,s){this.itemTarget=null,s.forEach(n=>{const r=n.getBoundingClientRect();if(i.top+t.offsetHeight/2<r.bottom&&i.right-t.offsetWidth/2>r.left&&i.bottom-t.offsetHeight/2>r.top&&i.left+t.offsetWidth/2<r.right){if(this.isItemStartSource&&n.classList.contains("source")||n.classList.contains("full")||!this.hasMatchingMatchGroup(t.parentNode,n))return;n.classList.add("active"),this.itemTarget=n}else n.classList.remove("active")},this)}findSourceDraggerTarget(t,i){const s=this.sourcewrapper.getBoundingClientRect();if(i.top+t.offsetHeight/2<s.bottom&&i.right-t.offsetWidth/2>s.left&&i.bottom-t.offsetHeight/2>s.top&&i.left+t.offsetWidth/2<s.right){for(let n=0;n<this.sources.length;n++)if(this.sources[n].dataset.identifier===t.dataset.identifier){this.sources[n].classList.add("active"),this.itemTarget=this.sources[n];break}}else for(let n=0;n<this.sources.length;n++)this.sources[n].classList.contains("active")&&this.sources[n].classList.remove("active")}addPlaceholder(t){if(!t.parentNode.classList.contains("source")){this.addPlaceholderElement(t,!1);return}const i=t.parentNode.dataset.matchMax*1;if(i===1){this.addPlaceholderElement(t,!1);return}if(i===0){this.addPlaceholderElement(t,!0);return}if(this.getRemaining(t.parentNode)===1){this.addPlaceholderElement(t,!1);return}this.addPlaceholderElement(t,!0)}addPlaceholderElement(t,i){const s=t.cloneNode(!0);this.deepCloneId(s),i?(s.classList.add("clone"),s.addEventListener("mousedown",this.handleDragStart),s.addEventListener("touchstart",this.handleTouchStart)):s.classList.add("match-dragger-placeholder"),s.classList.add("placeholder-fade"),t.parentNode.insertBefore(s,t)}removePlaceholder(t){if(t.parentNode.classList.contains("target")){const n=t.parentNode.querySelector(".match-dragger-placeholder");if(n===null)return;t.parentNode.removeChild(n);return}const i=t.parentNode.dataset.matchMax*1,s=t.parentNode.querySelector(".match-dragger-placeholder");if(s===null){const n=t.parentNode.querySelector(".clone");if(n===null)return;n.classList.remove("placeholder-fade");return}i!==0&&t.parentNode.removeChild(s)}replacePlaceholder(t){const i=t.parentNode;let s=i.querySelector(".match-dragger-placeholder");if(i.classList.contains("source")){if(s==null&&(s=i.querySelector(".draggable")),s===null)return;i.replaceChild(t,s);return}s!==null&&i.replaceChild(t,s)}addClonePlaceholder(t){const i=t.cloneNode(!0);this.deepCloneId(i),i.classList.add("clone"),t.parentNode.insertBefore(i,t),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)}initializeSources(t){this.sources=t.querySelectorAll(".source"),this.sources.forEach(i=>{i.classList.add("full");const s=i.dataset.matchMax*1;this.setRemaining(i,s===0?1e3:s)},this),this.draggers=t.querySelectorAll(".draggable"),this.draggers.forEach((i,s)=>{const n=i.parentNode.getAttribute("data-identifier");i.setAttribute("data-identifier",n),i.setAttribute("data-order",s),i.setAttribute("tabindex",0),i.addEventListener("mousedown",this.handleDragStart),i.addEventListener("touchstart",this.handleTouchStart)},this)}initializeTargets(t){this.targets=t.querySelectorAll(".target"),this.targets.forEach(i=>{i.setAttribute("tabindex",0)})}identifyTargets(t,i){this.targets.forEach(s=>{i&&!s.classList.contains("full")&&this.hasMatchingMatchGroup(t,s)&&s.classList.add("target-active")},this),i&&!this.isItemStartSource&&this.sourcewrapper.classList.add("target-active")}addListeners(t,i){i?(this.removeListeners(t,i),t.addEventListener("touchmove",this.handleTouchMove),t.addEventListener("touchend",this.handleTouchEnd)):(this.removeListeners(t,i),document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd))}removeListeners(t,i){i?(t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("touchend",this.handleTouchEnd)):(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd))}clearTargetHighlights(){this.targets.forEach(t=>{t.classList.remove("target-active")},this),this.sourcewrapper.classList.remove("target-active")}getClosestElement(t,i){return t?t&&t.classList.contains(i)?t:this.getClosestElement(t.parentElement,i):!1}sortContainerElements(t){let i=[],s=t.children;for(let n=0;n<s.length;n++){const r=s[n].querySelector("div.draggable");r&&i.push([1*r.dataset.order,s[n]])}i.sort(function(n,r){return n[0]-r[0]});for(let n=0;n<i.length;n++)t.appendChild(i[n][1])}getResponse(){return this.computeResponse()}computeResponse(){let t=[];return this.targets.forEach(i=>{i.querySelectorAll(".draggable").forEach(s=>{t.push(`${s.dataset.identifier} ${i.dataset.identifier}`)})}),t.length===0?null:this.options.cardinality==="single"?t[0]:t}restoreResponse(t){t!==null&&(this.options.cardinality==="single"?this.restoreResponsePair(t):t.forEach(i=>{this.restoreResponsePair(i)},this))}restoreResponsePair(t){const i=this.getPair(t);if(i===null)return;const s=this.findSourceByIdentifier(i.source),n=this.findTargetGapByIdentifier(i.target);if(s===null||n===null)return;const r=s.querySelector(".draggable");r!==null&&(this.cloneOrEmptySourceDragger(s,r),this.restoreSourceDraggerToTarget(n,r))}cloneOrEmptySourceDragger(t,i){const s=t.dataset.matchMax*1;if(s===1){t.classList.remove("full"),this.decrementRemaining(t);return}if(s===0){this.addClonePlaceholder(i);return}if(this.getRemaining(t)===1){t.classList.remove("full"),this.decrementRemaining(t);return}this.decrementRemaining(t),this.addClonePlaceholder(i)}findSourceByIdentifier(t){for(let i=0;i<this.sources.length;i++)if(t===this.sources[i].dataset.identifier)return this.sources[i];return null}findTargetGapByIdentifier(t){for(let i=0;i<this.targets.length;i++)if(t===this.targets[i].dataset.identifier)return this.targets[i];return null}getPair(t){if(t===null)return null;const i=t.split(" ");return i.length!=2?null:{source:i[0],target:i[1]}}restoreSourceDraggerToTarget(t,i){t===null||i===null||(t.append(i),i.setAttribute("style","width:100%"),this.incrementAssociationsCount(),this.isTargetFull(t)&&t.classList.add("full"))}hasMatchingMatchGroup(t,i){return t===null||i===null?!1:t.dataset.matchGroup===i.dataset.matchGroup}isTargetFull(t){if(t==null)return!1;const i=t.querySelectorAll(".draggable"),s=t.dataset.matchMax*1;return s===0?!1:i.length>=s}isExceedingMaxAssociations(t,i){return!(this.options.maxAssociations===0||i.classList.contains("source")||t.classList.contains("target")||this.currentAssociationsCount<this.options.maxAssociations)}initializeAssociationsCount(){this.currentAssociationsCount=0}incrementAssociationsCount(){this.currentAssociationsCount+=1}decrementAssociationsCount(){this.currentAssociationsCount!==0&&(this.currentAssociationsCount-=1)}getRemaining(t){return t.dataset.remaining*1}setRemaining(t,i){t.setAttribute("data-remaining",i)}incrementRemaining(t){const i=t.dataset.remaining*1+1;return t.setAttribute("data-remaining",i),i}decrementRemaining(t){let i=t.dataset.remaining*1-1;return i=i>=0?i:0,t.setAttribute("data-remaining",i),i}deepCloneId(t){t.id&&(t.id=`clone_${this.qtiAttributeValidation.randomString(5,"a")}`);for(let i=0;i<t.children.length;i++)this.deepCloneId(t.children[i])}reset(){this.resetDraggersToSources(),this.initializeAssociationsCount(),this.destroy()}resetDraggersToSources(){this.targets.forEach(t=>{t.querySelectorAll(".draggable").forEach(s=>{const n=this.findSourceByIdentifier(s.getAttribute("data-identifier"));n.classList.contains("full")||(t.classList.remove("full"),n.classList.contains("full")?t.removeChild(s):(n.append(s),n.classList.add("full")))},this)},this)}destroy(){this.currentDragger!==null&&(document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd)),this.wrapper.querySelectorAll(".draggable").forEach(i=>{i.removeEventListener("touchstart",this.handleTouchStart),i.removeEventListener("touchmove",this.handleTouchMove),i.removeEventListener("touchend",this.handleTouchEnd),i.removeEventListener("mousedown",this.handleDragStart)},this)}}class wq{constructor(t,i){J(this,"options",{interactionSubType:"matchtabular",isHeaderHidden:!1,isRowCentric:!1,firstColumnHeader:null,cardinality:"single",maxAssociations:0,response:null,onReady:null,onUpdate:null,onSelectionsLimit:null});J(this,"keyCodes",{Enter:13,Space:32,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40});return this.wrapper=t,this.table=this.wrapper.querySelector("table.matchtabular"),this.sourcewrapper=this.wrapper.querySelector(".qti-match-source-wrapper"),this.targetwrapper=this.wrapper.querySelector(".qti-match-target-wrapper"),this.currentAssociationsCount=0,this.isDisabled=!1,this.processOptions(i),this.handleClick=this.handleClick.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.state=new Map,this.initializeTable(this.sourcewrapper,this.targetwrapper),this.restoreResponse(),this.notifyReady(),this}processOptions(t){"interactionSubType"in t&&(this.options.interactionSubType=t.interactionSubType),"isHeaderHidden"in t&&(this.options.isHeaderHidden=t.isHeaderHidden),"isRowCentric"in t&&(this.options.isRowCentric=t.isRowCentric),"firstColumnHeader"in t&&(this.options.firstColumnHeader=t.firstColumnHeader),"cardinality"in t&&(this.options.cardinality=t.cardinality),"response"in t&&(this.options.response=t.response),"maxAssociations"in t&&(this.options.maxAssociations=t.maxAssociations),"onReady"in t&&(this.options.onReady=t.onReady),"onUpdate"in t&&(this.options.onUpdate=t.onUpdate),"onAssociationsLimit"in t&&(this.options.onAssociationsLimit=t.onAssociationsLimit)}notifyReady(){this.options.onReady!==null&&this.options.onReady({response:this.getResponse()})}notifyUpdate(){this.options.onUpdate!==null&&this.options.onUpdate({response:this.computeResponse()})}notifyAssociationsLimit(){this.options.onAssociationsLimit!==null&&this.options.onAssociationsLimit()}toggleDisable(t){this.isDisabled=t,this.controls.forEach(i=>{t?i.classList.add("disabled"):i.classList.remove("disabled")})}handleClick(t){if(!this.isDisabled){if(this.isRadio(t.target)){this.setControlChecked(t.target);return}this.toggleControl(t.target)}}handleKeydown(t){let i=!1;switch(t.code){case"Space":case"Enter":this.isDisabled||this.toggleControl(t.target),i=!0;break;case"ArrowUp":case"ArrowLeft":i=!0;break;case"ArrowDown":case"ArrowRight":i=!0;break}i&&(t.stopPropagation(),t.preventDefault())}handleFocus(){}handleBlur(){}toggleControl(t){if(!this.isChecked(t)){if(this.isExceedingMaxAssociations()){this.notifyAssociationsLimit();return}if(this.isExceedingMatchMax(t.dataset.pair,t.dataset.sourceMax*1,!0)||this.isExceedingMatchMax(t.dataset.pair,t.dataset.targetMax*1,!1))return;this.updateState(t.dataset.pair,this.toggleChecked(t)),this.notifyUpdate();return}this.updateState(t.dataset.pair,this.toggleChecked(t)),this.notifyUpdate()}setControlChecked(t){if(!this.isChecked(t)){if(this.isExceedingMaxAssociations()){this.notifyAssociationsLimit();return}if(this.isExceedingMatchMax(t.dataset.pair,t.dataset.sourceMax*1,!0)||this.isExceedingMatchMax(t.dataset.pair,t.dataset.targetMax*1,!1))return;this.updateState(t.dataset.pair,this.setChecked(t,!0)),this.notifyUpdate();return}this.updateState(t.dataset.pair,this.setChecked(t,!0)),this.notifyUpdate()}setChecked(t,i){const s=i?"true":"false";return t.setAttribute("aria-checked",s),s}toggleChecked(t){const s=t.getAttribute("aria-checked")==="true"?"false":"true";return t.setAttribute("aria-checked",s),s}isRadio(t){return t===null?!1:t.getAttribute("role")==="radio"}isChecked(t){return t===null?!1:t.getAttribute("aria-checked")==="true"}setTabIndex(t){this.tabIndex=t}setFocus(){}setBlur(){}updateState(t,i){this.state.set(t,i),this.currentAssociationsCount=0;for(let s of this.state.values())s==="true"&&(this.currentAssociationsCount+=1)}initializeTable(t,i){this.sources=this.getChoices(t),this.targets=this.getChoices(i);const s=`width:${this.getColumnWidthPercentage(this.targets.length)}%`;this.table.innerHTML=`${this.getHeader(s)}${this.getBody(s)}`,this.controls=this.table.querySelectorAll(".control-cell"),this.controls.forEach(n=>{const r=n.getAttribute("data-pair");this.updateState(r,"false"),n.addEventListener("click",this.handleClick),n.addEventListener("keydown",this.handleKeydown),n.addEventListener("focus",this.handleFocus),n.addEventListener("blur",this.handleBlur)},this)}getHeader(t){if(this.options.isHeaderHidden)return"";let i=`<th scope="col" class="header-cell">${this.options.firstColumnHeader==null?"":this.options.firstColumnHeader}</th>`;return this.options.isRowCentric?(i+=this.getSourceHeader(t),`<thead>${i}</thead>`):(i+=this.getTargetHeader(t),`<thead>${i}</thead>`)}getTargetHeader(t){let i="";return this.targets.forEach(s=>{i+=`<th scope="col" class="header-cell" style="${t}">${s.innerHTML}</th>`}),i}getSourceHeader(t){let i="";return this.sources.forEach(s=>{i+=`<th scope="col" class="header-cell" style="${t}">${s.innerHTML}</th>`}),i}getBody(t){let i="";return this.options.isRowCentric?(this.targets.forEach(s=>{i+=`<tr><th scope="row" class="row-header-cell">${s.innerHTML}</th>`;const n=s.getAttribute("data-match-max");this.sources.forEach(r=>{const a=r.getAttribute("data-match-max"),o=r.getAttribute("data-identifier"),u=s.getAttribute("data-identifier"),h=`${o} ${u}`;i+=`<td class="table-cell" style="${t}">
|
168
168
|
<div class="control-cell" aria-checked="false" tabindex="0" role="checkbox"
|
169
169
|
data-source-max="${a}" data-target-max="${n}" data-pair="${h}"></div>
|
170
170
|
</td>`}),i+="</tr>"}),`<tbody>${i}</tbody>`):(this.sources.forEach(s=>{i+=`<tr><th scope="row" class="row-header-cell">${s.innerHTML}</th>`;const n=s.getAttribute("data-match-max");this.targets.forEach(r=>{const a=r.getAttribute("data-match-max"),o=s.getAttribute("data-identifier"),u=r.getAttribute("data-identifier"),h=`${o} ${u}`;i+=`<td class="table-cell" style="${t}">
|