cognikit 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +34 -28
- package/dist/client.js.map +3 -3
- package/dist/index.js +7 -1
- package/dist/index.js.map +3 -3
- package/dist/shell/simple-shell/script.d.ts +2 -0
- package/package.json +1 -1
- package/public/app.js +16 -1
- package/public/app.js.map +2 -2
- package/public/index.html +1 -2
package/dist/client.js
CHANGED
|
@@ -91,7 +91,7 @@ function et(){let e=globalThis;if(typeof e.HTMLElement>"u"&&(e.HTMLElement=class
|
|
|
91
91
|
50% { transform: rotate(180deg) translateX(50px) rotate(-180deg) scale(1.5); }
|
|
92
92
|
100% { transform: rotate(360deg) translateX(0) rotate(-360deg); }
|
|
93
93
|
}
|
|
94
|
-
`,
|
|
94
|
+
`,Et={shake:"0.4s","pulse-green":"2s infinite","bounce-in":"0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55)",float:"3s ease-in-out infinite",rubber:"0.6s",jello:"0.8s",heartbeat:"1.5s ease-in-out infinite",shimmer:"2s infinite",wobble:"4s infinite",pop:"0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)","fade-slide":"0.5s ease-out",swing:"2s infinite",flash:"0.5s",orbit:"1s ease-in-out","spin-pulse":"3s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite"},L=class{constructor(){this.isEnabled=!1}static{this.injectedRoots=new WeakSet}static injectKeyframes(n){if(this.injectedRoots.has(n))return;let t=document.createElement("style");t.textContent=vi,n.prepend(t),this.injectedRoots.add(n)}animate(n,t,r){if(!this.isEnabled)return;n.style.animation="";let i=r?.duration||"",o=r?.timing||"",a=r?.iterations||"",s=r?.delay||"",l="";i||o||a||s?l=`${t} ${i} ${o} ${s} ${a}`.trim():l=`${t} ${Et[t]}`,n.style.animation=l}stop(n){n.style.animation=""}animateFor(n,t,r,i){this.isEnabled&&(this.animate(n,t,i),setTimeout(()=>{this.stop(n)},r))}getAvailableAnimations(){return Object.keys(Et)}addAnimationClass(n,t){this.isEnabled&&n.classList.add(`anim-${t}`)}removeAnimationClass(n,t){n.classList.remove(`anim-${t}`)}};var He={"default-light":{"--edu-bg":"247 249 252","--edu-card":"255 255 255","--edu-ink":"31 41 55","--edu-second-ink":"71 85 105","--edu-third-ink":"100 116 139","--edu-inverted-ink":"248 250 252","--edu-success":"22 163 74","--edu-error":"220 38 38","--edu-warning":"255 222 33","--edu-neutral":"14 165 233","--edu-first-accent":"49 120 198","--edu-second-accent":"245 158 11","--edu-third-accent":"236 72 153","--edu-border":"229 231 235","--edu-muted":"243 244 246","--edu-radius":"0.375rem","--edu-shadow-color":"0 0 0","--edu-pad":"1rem","--edu-mar":"0"},"default-dark":{"--edu-bg":"15 23 42","--edu-card":"30 41 59","--edu-ink":"241 245 249","--edu-second-ink":"203 213 225","--edu-third-ink":"148 163 184","--edu-inverted-ink":"15 23 42","--edu-success":"74 222 128","--edu-error":"248 113 113","--edu-warning":"250 204 21","--edu-neutral":"56 189 248","--edu-first-accent":"96 165 250","--edu-second-accent":"251 191 36","--edu-third-accent":"244 114 182","--edu-border":"71 85 105","--edu-muted":"51 65 85","--edu-radius":"0.375rem","--edu-shadow-color":"2 6 23","--edu-pad":"1rem","--edu-mar":"0"},"ocean-light":{"--edu-bg":"239 246 255","--edu-card":"255 255 255","--edu-ink":"8 47 73","--edu-second-ink":"14 116 144","--edu-third-ink":"8 145 178","--edu-inverted-ink":"239 246 255","--edu-success":"5 150 105","--edu-error":"225 29 72","--edu-warning":"245 158 11","--edu-neutral":"2 132 199","--edu-first-accent":"6 182 212","--edu-second-accent":"59 130 246","--edu-third-accent":"14 165 233","--edu-border":"186 230 253","--edu-muted":"224 242 254","--edu-radius":"0.5rem","--edu-shadow-color":"8 47 73","--edu-pad":"1rem","--edu-mar":"0"},"ocean-dark":{"--edu-bg":"8 47 73","--edu-card":"12 74 110","--edu-ink":"236 254 255","--edu-second-ink":"165 243 252","--edu-third-ink":"103 232 249","--edu-inverted-ink":"8 47 73","--edu-success":"52 211 153","--edu-error":"251 113 133","--edu-warning":"251 191 36","--edu-neutral":"34 211 238","--edu-first-accent":"103 232 249","--edu-second-accent":"56 189 248","--edu-third-accent":"45 212 191","--edu-border":"14 116 144","--edu-muted":"14 116 144","--edu-radius":"0.5rem","--edu-shadow-color":"8 47 73","--edu-pad":"1rem","--edu-mar":"0"},"forest-light":{"--edu-bg":"240 253 244","--edu-card":"255 255 255","--edu-ink":"20 83 45","--edu-second-ink":"22 101 52","--edu-third-ink":"74 124 89","--edu-inverted-ink":"240 253 244","--edu-success":"22 163 74","--edu-error":"220 38 38","--edu-warning":"234 179 8","--edu-neutral":"34 197 94","--edu-first-accent":"34 197 94","--edu-second-accent":"132 204 22","--edu-third-accent":"16 185 129","--edu-border":"187 247 208","--edu-muted":"220 252 231","--edu-radius":"0.5rem","--edu-shadow-color":"20 83 45","--edu-pad":"1rem","--edu-mar":"0"},"forest-dark":{"--edu-bg":"20 83 45","--edu-card":"22 101 52","--edu-ink":"240 253 244","--edu-second-ink":"187 247 208","--edu-third-ink":"134 239 172","--edu-inverted-ink":"20 83 45","--edu-success":"74 222 128","--edu-error":"248 113 113","--edu-warning":"250 204 21","--edu-neutral":"74 222 128","--edu-first-accent":"134 239 172","--edu-second-accent":"190 242 100","--edu-third-accent":"52 211 153","--edu-border":"34 197 94","--edu-muted":"21 128 61","--edu-radius":"0.5rem","--edu-shadow-color":"20 83 45","--edu-pad":"1rem","--edu-mar":"0"}},tt=He["default-light"],y={audioBaseUrl:null,soundFiles:{},injectThemeVariables:!0,theme:null,themeVariables:{}},kt="cognikit-theme-variables";function xi(e){e.audioBaseUrl!==void 0&&(y.audioBaseUrl=e.audioBaseUrl),e.soundFiles&&(y.soundFiles={...y.soundFiles,...e.soundFiles}),e.injectThemeVariables!==void 0&&(y.injectThemeVariables=e.injectThemeVariables),e.theme!==void 0&&(y.theme=e.theme),e.themeVariables===null&&(y.themeVariables={}),e.themeVariables&&(y.themeVariables={...y.themeVariables,...e.themeVariables}),W()}function wi(){return y}function yi(){return He}function $t(e=y.theme,n=y.themeVariables){return{...e?He[e]:tt,...n}}function Ci(e,n){y.theme=e,n!==void 0&&(y.themeVariables={...n}),W()}function Ei(){y.theme=null,y.themeVariables={},W()}function W(){if(typeof document>"u")return;let e=document.getElementById(kt);if(e||(e=document.createElement("style"),e.id=kt,document.head.appendChild(e)),!y.injectThemeVariables){e.textContent="";return}let n=document.documentElement,t=window.getComputedStyle(n),r=$t();if(y.theme!==null||Object.keys(y.themeVariables).length>0){e.textContent=Tt(r);return}let o=Object.entries(tt).filter(([a])=>t.getPropertyValue(a).trim()==="");e.textContent=o.length===0?"":Tt(Object.fromEntries(o))}function At(e,n){let t=y.soundFiles[e];return t?St(t,y.audioBaseUrl):y.audioBaseUrl?St(n,y.audioBaseUrl):null}function St(e,n){return Si(e)||e.startsWith("data:")?e:n?new URL(e,ki(n)).href:e}function ki(e){return typeof window>"u"?e:new URL(e,document.baseURI||window.location.href).href}function Si(e){return/^https?:\/\//.test(e)}function Tt(e){return`:root {
|
|
95
95
|
${Object.entries(e).map(([n,t])=>` ${n}: ${t};`).join(`
|
|
96
96
|
`)}
|
|
97
97
|
}`}var H=class{constructor(){this.isEnabled=!0;this.audioCache=new Map;this.activeSounds=new Set;this.localSounds={success:"success.mp3",failure:"failure.mp3",pop:"pop.mp3","low-time":"low-time.mp3",start:"start.mp3",flip:"flip.mp3"}}async playSound(n,t={}){if(this.isEnabled)try{let r=this.resolveUrl(n),i=await this.getAudio(r);this.configureAudio(i,t),await this.playAudio(i,t)}catch(r){let i=r instanceof Error?r:new Error(String(r));console.warn(`[SoundManager] Failed to play sound "${n}":`,i.message),t.onError&&t.onError(i)}}async preload(n){let t=n.map(async r=>{try{let i=this.resolveUrl(r);await this.getAudio(i)}catch(i){console.warn(`[SoundManager] Failed to preload sound "${r}":`,i)}});await Promise.allSettled(t)}stopAll(){this.activeSounds.forEach(n=>{n.pause(),n.currentTime=0}),this.activeSounds.clear()}stop(n){let t=this.resolveUrl(n),r=this.audioCache.get(t);r&&(r.pause(),r.currentTime=0,this.activeSounds.delete(r))}clearCache(){this.stopAll(),this.audioCache.clear()}setGlobalVolume(n){let t=Math.max(0,Math.min(1,n));this.activeSounds.forEach(r=>{r.volume=t})}resolveUrl(n){if(n in this.localSounds){let t=this.localSounds[n],r=At(n,t);if(!r)throw new Error(`No configured URL for sound "${n}"`);return r}return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:"),n}async getAudio(n){if(this.audioCache.has(n))return this.audioCache.get(n).cloneNode(!0);let t=new Audio,r=new Promise((i,o)=>{let a=setTimeout(()=>{o(new Error("Audio loading timeout"))},1e4);t.addEventListener("canplaythrough",()=>{clearTimeout(a),i()},{once:!0}),t.addEventListener("error",()=>{clearTimeout(a),o(new Error(`Failed to load audio: ${n}`))},{once:!0})});return t.src=n,t.preload="auto",t.load(),await r,this.audioCache.set(n,t),t.cloneNode(!0)}configureAudio(n,t){n.volume=t.volume!==void 0?Math.max(0,Math.min(1,t.volume)):1,n.loop=t.loop??!1,n.playbackRate=t.playbackRate??1,t.fadeIn&&t.fadeIn>0&&(n.volume=0,this.fadeVolume(n,t.volume??1,t.fadeIn))}async playAudio(n,t){this.activeSounds.add(n);let r=()=>{this.activeSounds.delete(n),t.onEnd&&t.onEnd()};n.addEventListener("ended",r,{once:!0}),t.fadeOut&&t.fadeOut>0&&!t.loop&&n.addEventListener("timeupdate",()=>{n.duration-n.currentTime<=t.fadeOut/1e3&&this.fadeVolume(n,0,t.fadeOut)});try{await n.play()}catch(i){throw this.activeSounds.delete(n),new Error(`Playback failed: ${i instanceof Error?i.message:String(i)}`)}}fadeVolume(n,t,r){let i=n.volume,o=t-i,a=Date.now(),s=()=>{let l=Date.now()-a,c=Math.min(l/r,1);n.volume=i+o*c,c<1&&this.activeSounds.has(n)&&requestAnimationFrame(s)};requestAnimationFrame(s)}},Ne=new H;var x=class extends HTMLElement{constructor(t,r,i,o){super();this.isValid=!0;this.implementsProgress=!0;this._initialized=!1;this.errors="";if(!t||!r){console.warn("[BaseInteraction] Constructor called without required parameters"),this.id=crypto.randomUUID(),this.data=t,this.config=r||{},this.assets=i||null,this.isValid=!1;return}if(this.id=crypto.randomUUID(),this.data=t,this.config=r,this.assets=i||null,o){let a=o(this.data);a.ok||(this.isValid=!1,Object.entries(a.errors).forEach(([s,l])=>{this.errors=`${this.errors}
|
|
@@ -1044,19 +1044,19 @@ ${Object.entries(e).map(([n,t])=>` ${n}: ${t};`).join(`
|
|
|
1044
1044
|
`,s+=S.repeat("-",n.indent+d+3+c.pos)+`^
|
|
1045
1045
|
`,l=1;l<=n.linesAfter&&!(a+l>=i.length);l++)c=it(e.buffer,r[a+l],i[a+l],e.position-(r[a]-r[a+l]),u),s+=S.repeat(" ",n.indent)+nt((e.line+l+1).toString(),d)+" | "+c.str+`
|
|
1046
1046
|
`;return s.replace(/\n$/,"")}var Oi=Gi,Vi=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Fi=["scalar","sequence","mapping"];function ji(e){var n={};return e!==null&&Object.keys(e).forEach(function(t){e[t].forEach(function(r){n[String(r)]=t})}),n}function Ui(e,n){if(n=n||{},Object.keys(n).forEach(function(t){if(Vi.indexOf(t)===-1)throw new _('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.options=n,this.tag=e,this.kind=n.kind||null,this.resolve=n.resolve||function(){return!0},this.construct=n.construct||function(t){return t},this.instanceOf=n.instanceOf||null,this.predicate=n.predicate||null,this.represent=n.represent||null,this.representName=n.representName||null,this.defaultStyle=n.defaultStyle||null,this.multi=n.multi||!1,this.styleAliases=ji(n.styleAliases||null),Fi.indexOf(this.kind)===-1)throw new _('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var $=Ui;function Mt(e,n){var t=[];return e[n].forEach(function(r){var i=t.length;t.forEach(function(o,a){o.tag===r.tag&&o.kind===r.kind&&o.multi===r.multi&&(i=a)}),t[i]=r}),t}function Yi(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},n,t;function r(i){i.multi?(e.multi[i.kind].push(i),e.multi.fallback.push(i)):e[i.kind][i.tag]=e.fallback[i.tag]=i}for(n=0,t=arguments.length;n<t;n+=1)arguments[n].forEach(r);return e}function at(e){return this.extend(e)}at.prototype.extend=function(n){var t=[],r=[];if(n instanceof $)r.push(n);else if(Array.isArray(n))r=r.concat(n);else if(n&&(Array.isArray(n.implicit)||Array.isArray(n.explicit)))n.implicit&&(t=t.concat(n.implicit)),n.explicit&&(r=r.concat(n.explicit));else throw new _("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.forEach(function(o){if(!(o instanceof $))throw new _("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(o.loadKind&&o.loadKind!=="scalar")throw new _("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(o.multi)throw new _("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(o){if(!(o instanceof $))throw new _("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(at.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(r),i.compiledImplicit=Mt(i,"implicit"),i.compiledExplicit=Mt(i,"explicit"),i.compiledTypeMap=Yi(i.compiledImplicit,i.compiledExplicit),i};var Kt=at,Wt=new $("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Qt=new $("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Zt=new $("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Xt=new Kt({explicit:[Wt,Qt,Zt]});function Ki(e){if(e===null)return!0;var n=e.length;return n===1&&e==="~"||n===4&&(e==="null"||e==="Null"||e==="NULL")}function Wi(){return null}function Qi(e){return e===null}var Jt=new $("tag:yaml.org,2002:null",{kind:"scalar",resolve:Ki,construct:Wi,predicate:Qi,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Zi(e){if(e===null)return!1;var n=e.length;return n===4&&(e==="true"||e==="True"||e==="TRUE")||n===5&&(e==="false"||e==="False"||e==="FALSE")}function Xi(e){return e==="true"||e==="True"||e==="TRUE"}function Ji(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var er=new $("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Zi,construct:Xi,predicate:Ji,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function en(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function tn(e){return 48<=e&&e<=55}function rn(e){return 48<=e&&e<=57}function nn(e){if(e===null)return!1;var n=e.length,t=0,r=!1,i;if(!n)return!1;if(i=e[t],(i==="-"||i==="+")&&(i=e[++t]),i==="0"){if(t+1===n)return!0;if(i=e[++t],i==="b"){for(t++;t<n;t++)if(i=e[t],i!=="_"){if(i!=="0"&&i!=="1")return!1;r=!0}return r&&i!=="_"}if(i==="x"){for(t++;t<n;t++)if(i=e[t],i!=="_"){if(!en(e.charCodeAt(t)))return!1;r=!0}return r&&i!=="_"}if(i==="o"){for(t++;t<n;t++)if(i=e[t],i!=="_"){if(!tn(e.charCodeAt(t)))return!1;r=!0}return r&&i!=="_"}}if(i==="_")return!1;for(;t<n;t++)if(i=e[t],i!=="_"){if(!rn(e.charCodeAt(t)))return!1;r=!0}return!(!r||i==="_")}function on(e){var n=e,t=1,r;if(n.indexOf("_")!==-1&&(n=n.replace(/_/g,"")),r=n[0],(r==="-"||r==="+")&&(r==="-"&&(t=-1),n=n.slice(1),r=n[0]),n==="0")return 0;if(r==="0"){if(n[1]==="b")return t*parseInt(n.slice(2),2);if(n[1]==="x")return t*parseInt(n.slice(2),16);if(n[1]==="o")return t*parseInt(n.slice(2),8)}return t*parseInt(n,10)}function an(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!S.isNegativeZero(e)}var tr=new $("tag:yaml.org,2002:int",{kind:"scalar",resolve:nn,construct:on,predicate:an,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),sn=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function ln(e){return!(e===null||!sn.test(e)||e[e.length-1]==="_")}function cn(e){var n,t;return n=e.replace(/_/g,"").toLowerCase(),t=n[0]==="-"?-1:1,"+-".indexOf(n[0])>=0&&(n=n.slice(1)),n===".inf"?t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:n===".nan"?NaN:t*parseFloat(n,10)}var dn=/^[-+]?[0-9]+e/;function un(e,n){var t;if(isNaN(e))switch(n){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(n){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(n){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(S.isNegativeZero(e))return"-0.0";return t=e.toString(10),dn.test(t)?t.replace("e",".e"):t}function pn(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||S.isNegativeZero(e))}var rr=new $("tag:yaml.org,2002:float",{kind:"scalar",resolve:ln,construct:cn,predicate:pn,represent:un,defaultStyle:"lowercase"}),ir=Xt.extend({implicit:[Jt,er,tr,rr]}),nr=ir,or=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),ar=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function hn(e){return e===null?!1:or.exec(e)!==null||ar.exec(e)!==null}function gn(e){var n,t,r,i,o,a,s,l=0,c=null,d,u,p;if(n=or.exec(e),n===null&&(n=ar.exec(e)),n===null)throw new Error("Date resolve error");if(t=+n[1],r=+n[2]-1,i=+n[3],!n[4])return new Date(Date.UTC(t,r,i));if(o=+n[4],a=+n[5],s=+n[6],n[7]){for(l=n[7].slice(0,3);l.length<3;)l+="0";l=+l}return n[9]&&(d=+n[10],u=+(n[11]||0),c=(d*60+u)*6e4,n[9]==="-"&&(c=-c)),p=new Date(Date.UTC(t,r,i,o,a,s,l)),c&&p.setTime(p.getTime()-c),p}function mn(e){return e.toISOString()}var sr=new $("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:hn,construct:gn,instanceOf:Date,represent:mn});function fn(e){return e==="<<"||e===null}var lr=new $("tag:yaml.org,2002:merge",{kind:"scalar",resolve:fn}),ut=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
1047
|
-
\r`;function bn(e){if(e===null)return!1;var n,t,r=0,i=e.length,o=ut;for(t=0;t<i;t++)if(n=o.indexOf(e.charAt(t)),!(n>64)){if(n<0)return!1;r+=6}return r%8===0}function vn(e){var n,t,r=e.replace(/[\r\n=]/g,""),i=r.length,o=ut,a=0,s=[];for(n=0;n<i;n++)n%4===0&&n&&(s.push(a>>16&255),s.push(a>>8&255),s.push(a&255)),a=a<<6|o.indexOf(r.charAt(n));return t=i%4*6,t===0?(s.push(a>>16&255),s.push(a>>8&255),s.push(a&255)):t===18?(s.push(a>>10&255),s.push(a>>2&255)):t===12&&s.push(a>>4&255),new Uint8Array(s)}function xn(e){var n="",t=0,r,i,o=e.length,a=ut;for(r=0;r<o;r++)r%3===0&&r&&(n+=a[t>>18&63],n+=a[t>>12&63],n+=a[t>>6&63],n+=a[t&63]),t=(t<<8)+e[r];return i=o%3,i===0?(n+=a[t>>18&63],n+=a[t>>12&63],n+=a[t>>6&63],n+=a[t&63]):i===2?(n+=a[t>>10&63],n+=a[t>>4&63],n+=a[t<<2&63],n+=a[64]):i===1&&(n+=a[t>>2&63],n+=a[t<<4&63],n+=a[64],n+=a[64]),n}function wn(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var cr=new $("tag:yaml.org,2002:binary",{kind:"scalar",resolve:bn,construct:vn,predicate:wn,represent:xn}),yn=Object.prototype.hasOwnProperty,
|
|
1048
|
-
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function zn(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function br(e,n,t){n==="__proto__"?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,writable:!0,value:t}):e[n]=t}var vr=new Array(256),xr=new Array(256);for(F=0;F<256;F++)vr[F]=Rt(F)?1:0,xr[F]=Rt(F);var F;function Hn(e,n){this.input=e,this.filename=n.filename||null,this.schema=n.schema||pt,this.onWarning=n.onWarning||null,this.legacy=n.legacy||!1,this.json=n.json||!1,this.listener=n.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function wr(e,n){var t={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return t.snippet=Oi(t),new _(n,t)}function f(e,n){throw wr(e,n)}function Ve(e,n){e.onWarning&&e.onWarning.call(null,wr(e,n))}var Pt={YAML:function(n,t,r){var i,o,a;n.version!==null&&f(n,"duplication of %YAML directive"),r.length!==1&&f(n,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),i===null&&f(n,"ill-formed argument of the YAML directive"),o=parseInt(i[1],10),a=parseInt(i[2],10),o!==1&&f(n,"unacceptable YAML version of the document"),n.version=r[0],n.checkLineBreaks=a<2,a!==1&&a!==2&&Ve(n,"unsupported YAML version of the document")},TAG:function(n,t,r){var i,o;r.length!==2&&f(n,"TAG directive accepts exactly two arguments"),i=r[0],o=r[1],mr.test(i)||f(n,"ill-formed tag handle (first argument) of the TAG directive"),G.call(n.tagMap,i)&&f(n,'there is a previously declared suffix for "'+i+'" tag handle'),fr.test(o)||f(n,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch{f(n,"tag prefix is malformed: "+o)}n.tagMap[i]=o}};function N(e,n,t,r){var i,o,a,s;if(n<t){if(s=e.input.slice(n,t),r)for(i=0,o=s.length;i<o;i+=1)a=s.charCodeAt(i),a===9||32<=a&&a<=1114111||f(e,"expected valid JSON character");else Ln.test(s)&&f(e,"the stream contains non-printable characters");e.result+=s}}function Bt(e,n,t,r){var i,o,a,s;for(S.isObject(t)||f(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(t),a=0,s=i.length;a<s;a+=1)o=i[a],G.call(n,o)||(br(n,o,t[o]),r[o]=!0)}function X(e,n,t,r,i,o,a,s,l){var c,d;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),c=0,d=i.length;c<d;c+=1)Array.isArray(i[c])&&f(e,"nested arrays are not supported inside keys"),typeof i=="object"&&Dt(i[c])==="[object Object]"&&(i[c]="[object Object]");if(typeof i=="object"&&Dt(i)==="[object Object]"&&(i="[object Object]"),i=String(i),n===null&&(n={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(o))for(c=0,d=o.length;c<d;c+=1)Bt(e,n,o[c],t);else Bt(e,n,o,t);else!e.json&&!G.call(t,i)&&G.call(n,i)&&(e.line=a||e.line,e.lineStart=s||e.lineStart,e.position=l||e.position,f(e,"duplicated mapping key")),br(n,i,o),delete t[i];return n}function ht(e){var n;n=e.input.charCodeAt(e.position),n===10?e.position++:n===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):f(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function
|
|
1049
|
-
`,n-1))}function Nn(e,n,t){var r,i,o,a,s,l,c,d,u=e.kind,p=e.result,h;if(h=e.input.charCodeAt(e.position),I(h)||Z(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(i=e.input.charCodeAt(e.position+1),I(i)||t&&Z(i)))return!1;for(e.kind="scalar",e.result="",o=a=e.position,s=!1;h!==0;){if(h===58){if(i=e.input.charCodeAt(e.position+1),I(i)||t&&Z(i))break}else if(h===35){if(r=e.input.charCodeAt(e.position-1),I(r))break}else{if(e.position===e.lineStart&&Ue(e)||t&&Z(h))break;if(R(h))if(l=e.line,c=e.lineStart,d=e.lineIndent,
|
|
1047
|
+
\r`;function bn(e){if(e===null)return!1;var n,t,r=0,i=e.length,o=ut;for(t=0;t<i;t++)if(n=o.indexOf(e.charAt(t)),!(n>64)){if(n<0)return!1;r+=6}return r%8===0}function vn(e){var n,t,r=e.replace(/[\r\n=]/g,""),i=r.length,o=ut,a=0,s=[];for(n=0;n<i;n++)n%4===0&&n&&(s.push(a>>16&255),s.push(a>>8&255),s.push(a&255)),a=a<<6|o.indexOf(r.charAt(n));return t=i%4*6,t===0?(s.push(a>>16&255),s.push(a>>8&255),s.push(a&255)):t===18?(s.push(a>>10&255),s.push(a>>2&255)):t===12&&s.push(a>>4&255),new Uint8Array(s)}function xn(e){var n="",t=0,r,i,o=e.length,a=ut;for(r=0;r<o;r++)r%3===0&&r&&(n+=a[t>>18&63],n+=a[t>>12&63],n+=a[t>>6&63],n+=a[t&63]),t=(t<<8)+e[r];return i=o%3,i===0?(n+=a[t>>18&63],n+=a[t>>12&63],n+=a[t>>6&63],n+=a[t&63]):i===2?(n+=a[t>>10&63],n+=a[t>>4&63],n+=a[t<<2&63],n+=a[64]):i===1&&(n+=a[t>>2&63],n+=a[t<<4&63],n+=a[64],n+=a[64]),n}function wn(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var cr=new $("tag:yaml.org,2002:binary",{kind:"scalar",resolve:bn,construct:vn,predicate:wn,represent:xn}),yn=Object.prototype.hasOwnProperty,Cn=Object.prototype.toString;function En(e){if(e===null)return!0;var n=[],t,r,i,o,a,s=e;for(t=0,r=s.length;t<r;t+=1){if(i=s[t],a=!1,Cn.call(i)!=="[object Object]")return!1;for(o in i)if(yn.call(i,o))if(!a)a=!0;else return!1;if(!a)return!1;if(n.indexOf(o)===-1)n.push(o);else return!1}return!0}function kn(e){return e!==null?e:[]}var dr=new $("tag:yaml.org,2002:omap",{kind:"sequence",resolve:En,construct:kn}),Sn=Object.prototype.toString;function Tn(e){if(e===null)return!0;var n,t,r,i,o,a=e;for(o=new Array(a.length),n=0,t=a.length;n<t;n+=1){if(r=a[n],Sn.call(r)!=="[object Object]"||(i=Object.keys(r),i.length!==1))return!1;o[n]=[i[0],r[i[0]]]}return!0}function $n(e){if(e===null)return[];var n,t,r,i,o,a=e;for(o=new Array(a.length),n=0,t=a.length;n<t;n+=1)r=a[n],i=Object.keys(r),o[n]=[i[0],r[i[0]]];return o}var ur=new $("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Tn,construct:$n}),An=Object.prototype.hasOwnProperty;function _n(e){if(e===null)return!0;var n,t=e;for(n in t)if(An.call(t,n)&&t[n]!==null)return!1;return!0}function In(e){return e!==null?e:{}}var pr=new $("tag:yaml.org,2002:set",{kind:"mapping",resolve:_n,construct:In}),pt=nr.extend({implicit:[sr,lr],explicit:[cr,dr,ur,pr]}),G=Object.prototype.hasOwnProperty,Ge=1,hr=2,gr=3,Oe=4,ot=1,Mn=2,Lt=3,Ln=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Dn=/[\x85\u2028\u2029]/,Rn=/[,\[\]\{\}]/,mr=/^(?:!|!!|![a-z\-]+!)$/i,fr=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Dt(e){return Object.prototype.toString.call(e)}function R(e){return e===10||e===13}function j(e){return e===9||e===32}function I(e){return e===9||e===32||e===10||e===13}function Z(e){return e===44||e===91||e===93||e===123||e===125}function Pn(e){var n;return 48<=e&&e<=57?e-48:(n=e|32,97<=n&&n<=102?n-97+10:-1)}function Bn(e){return e===120?2:e===117?4:e===85?8:0}function qn(e){return 48<=e&&e<=57?e-48:-1}function Rt(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
1048
|
+
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function zn(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function br(e,n,t){n==="__proto__"?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,writable:!0,value:t}):e[n]=t}var vr=new Array(256),xr=new Array(256);for(F=0;F<256;F++)vr[F]=Rt(F)?1:0,xr[F]=Rt(F);var F;function Hn(e,n){this.input=e,this.filename=n.filename||null,this.schema=n.schema||pt,this.onWarning=n.onWarning||null,this.legacy=n.legacy||!1,this.json=n.json||!1,this.listener=n.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function wr(e,n){var t={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return t.snippet=Oi(t),new _(n,t)}function f(e,n){throw wr(e,n)}function Ve(e,n){e.onWarning&&e.onWarning.call(null,wr(e,n))}var Pt={YAML:function(n,t,r){var i,o,a;n.version!==null&&f(n,"duplication of %YAML directive"),r.length!==1&&f(n,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),i===null&&f(n,"ill-formed argument of the YAML directive"),o=parseInt(i[1],10),a=parseInt(i[2],10),o!==1&&f(n,"unacceptable YAML version of the document"),n.version=r[0],n.checkLineBreaks=a<2,a!==1&&a!==2&&Ve(n,"unsupported YAML version of the document")},TAG:function(n,t,r){var i,o;r.length!==2&&f(n,"TAG directive accepts exactly two arguments"),i=r[0],o=r[1],mr.test(i)||f(n,"ill-formed tag handle (first argument) of the TAG directive"),G.call(n.tagMap,i)&&f(n,'there is a previously declared suffix for "'+i+'" tag handle'),fr.test(o)||f(n,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch{f(n,"tag prefix is malformed: "+o)}n.tagMap[i]=o}};function N(e,n,t,r){var i,o,a,s;if(n<t){if(s=e.input.slice(n,t),r)for(i=0,o=s.length;i<o;i+=1)a=s.charCodeAt(i),a===9||32<=a&&a<=1114111||f(e,"expected valid JSON character");else Ln.test(s)&&f(e,"the stream contains non-printable characters");e.result+=s}}function Bt(e,n,t,r){var i,o,a,s;for(S.isObject(t)||f(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(t),a=0,s=i.length;a<s;a+=1)o=i[a],G.call(n,o)||(br(n,o,t[o]),r[o]=!0)}function X(e,n,t,r,i,o,a,s,l){var c,d;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),c=0,d=i.length;c<d;c+=1)Array.isArray(i[c])&&f(e,"nested arrays are not supported inside keys"),typeof i=="object"&&Dt(i[c])==="[object Object]"&&(i[c]="[object Object]");if(typeof i=="object"&&Dt(i)==="[object Object]"&&(i="[object Object]"),i=String(i),n===null&&(n={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(o))for(c=0,d=o.length;c<d;c+=1)Bt(e,n,o[c],t);else Bt(e,n,o,t);else!e.json&&!G.call(t,i)&&G.call(n,i)&&(e.line=a||e.line,e.lineStart=s||e.lineStart,e.position=l||e.position,f(e,"duplicated mapping key")),br(n,i,o),delete t[i];return n}function ht(e){var n;n=e.input.charCodeAt(e.position),n===10?e.position++:n===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):f(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function C(e,n,t){for(var r=0,i=e.input.charCodeAt(e.position);i!==0;){for(;j(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(n&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(R(i))for(ht(e),i=e.input.charCodeAt(e.position),r++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return t!==-1&&r!==0&&e.lineIndent<t&&Ve(e,"deficient indentation"),r}function Ue(e){var n=e.position,t;return t=e.input.charCodeAt(n),!!((t===45||t===46)&&t===e.input.charCodeAt(n+1)&&t===e.input.charCodeAt(n+2)&&(n+=3,t=e.input.charCodeAt(n),t===0||I(t)))}function gt(e,n){n===1?e.result+=" ":n>1&&(e.result+=S.repeat(`
|
|
1049
|
+
`,n-1))}function Nn(e,n,t){var r,i,o,a,s,l,c,d,u=e.kind,p=e.result,h;if(h=e.input.charCodeAt(e.position),I(h)||Z(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(i=e.input.charCodeAt(e.position+1),I(i)||t&&Z(i)))return!1;for(e.kind="scalar",e.result="",o=a=e.position,s=!1;h!==0;){if(h===58){if(i=e.input.charCodeAt(e.position+1),I(i)||t&&Z(i))break}else if(h===35){if(r=e.input.charCodeAt(e.position-1),I(r))break}else{if(e.position===e.lineStart&&Ue(e)||t&&Z(h))break;if(R(h))if(l=e.line,c=e.lineStart,d=e.lineIndent,C(e,!1,-1),e.lineIndent>=n){s=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=l,e.lineStart=c,e.lineIndent=d;break}}s&&(N(e,o,a,!1),gt(e,e.line-l),o=a=e.position,s=!1),j(h)||(a=e.position+1),h=e.input.charCodeAt(++e.position)}return N(e,o,a,!1),e.result?!0:(e.kind=u,e.result=p,!1)}function Gn(e,n){var t,r,i;if(t=e.input.charCodeAt(e.position),t!==39)return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;(t=e.input.charCodeAt(e.position))!==0;)if(t===39)if(N(e,r,e.position,!0),t=e.input.charCodeAt(++e.position),t===39)r=e.position,e.position++,i=e.position;else return!0;else R(t)?(N(e,r,i,!0),gt(e,C(e,!1,n)),r=i=e.position):e.position===e.lineStart&&Ue(e)?f(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);f(e,"unexpected end of the stream within a single quoted scalar")}function On(e,n){var t,r,i,o,a,s;if(s=e.input.charCodeAt(e.position),s!==34)return!1;for(e.kind="scalar",e.result="",e.position++,t=r=e.position;(s=e.input.charCodeAt(e.position))!==0;){if(s===34)return N(e,t,e.position,!0),e.position++,!0;if(s===92){if(N(e,t,e.position,!0),s=e.input.charCodeAt(++e.position),R(s))C(e,!1,n);else if(s<256&&vr[s])e.result+=xr[s],e.position++;else if((a=Bn(s))>0){for(i=a,o=0;i>0;i--)s=e.input.charCodeAt(++e.position),(a=Pn(s))>=0?o=(o<<4)+a:f(e,"expected hexadecimal character");e.result+=zn(o),e.position++}else f(e,"unknown escape sequence");t=r=e.position}else R(s)?(N(e,t,r,!0),gt(e,C(e,!1,n)),t=r=e.position):e.position===e.lineStart&&Ue(e)?f(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}f(e,"unexpected end of the stream within a double quoted scalar")}function Vn(e,n){var t=!0,r,i,o,a=e.tag,s,l=e.anchor,c,d,u,p,h,g=Object.create(null),m,b,w,v;if(v=e.input.charCodeAt(e.position),v===91)d=93,h=!1,s=[];else if(v===123)d=125,h=!0,s={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),v=e.input.charCodeAt(++e.position);v!==0;){if(C(e,!0,n),v=e.input.charCodeAt(e.position),v===d)return e.position++,e.tag=a,e.anchor=l,e.kind=h?"mapping":"sequence",e.result=s,!0;t?v===44&&f(e,"expected the node content, but found ','"):f(e,"missed comma between flow collection entries"),b=m=w=null,u=p=!1,v===63&&(c=e.input.charCodeAt(e.position+1),I(c)&&(u=p=!0,e.position++,C(e,!0,n))),r=e.line,i=e.lineStart,o=e.position,J(e,n,Ge,!1,!0),b=e.tag,m=e.result,C(e,!0,n),v=e.input.charCodeAt(e.position),(p||e.line===r)&&v===58&&(u=!0,v=e.input.charCodeAt(++e.position),C(e,!0,n),J(e,n,Ge,!1,!0),w=e.result),h?X(e,s,g,b,m,w,r,i,o):u?s.push(X(e,null,g,b,m,w,r,i,o)):s.push(m),C(e,!0,n),v=e.input.charCodeAt(e.position),v===44?(t=!0,v=e.input.charCodeAt(++e.position)):t=!1}f(e,"unexpected end of the stream within a flow collection")}function Fn(e,n){var t,r,i=ot,o=!1,a=!1,s=n,l=0,c=!1,d,u;if(u=e.input.charCodeAt(e.position),u===124)r=!1;else if(u===62)r=!0;else return!1;for(e.kind="scalar",e.result="";u!==0;)if(u=e.input.charCodeAt(++e.position),u===43||u===45)ot===i?i=u===43?Lt:Mn:f(e,"repeat of a chomping mode identifier");else if((d=qn(u))>=0)d===0?f(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?f(e,"repeat of an indentation width identifier"):(s=n+d-1,a=!0);else break;if(j(u)){do u=e.input.charCodeAt(++e.position);while(j(u));if(u===35)do u=e.input.charCodeAt(++e.position);while(!R(u)&&u!==0)}for(;u!==0;){for(ht(e),e.lineIndent=0,u=e.input.charCodeAt(e.position);(!a||e.lineIndent<s)&&u===32;)e.lineIndent++,u=e.input.charCodeAt(++e.position);if(!a&&e.lineIndent>s&&(s=e.lineIndent),R(u)){l++;continue}if(e.lineIndent<s){i===Lt?e.result+=S.repeat(`
|
|
1050
1050
|
`,o?1+l:l):i===ot&&o&&(e.result+=`
|
|
1051
1051
|
`);break}for(r?j(u)?(c=!0,e.result+=S.repeat(`
|
|
1052
1052
|
`,o?1+l:l)):c?(c=!1,e.result+=S.repeat(`
|
|
1053
1053
|
`,l+1)):l===0?o&&(e.result+=" "):e.result+=S.repeat(`
|
|
1054
1054
|
`,l):e.result+=S.repeat(`
|
|
1055
|
-
`,o?1+l:l),o=!0,a=!0,l=0,t=e.position;!R(u)&&u!==0;)u=e.input.charCodeAt(++e.position);N(e,t,e.position,!1)}return!0}function qt(e,n){var t,r=e.tag,i=e.anchor,o=[],a,s=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,f(e,"tab characters must not be used in indentation")),!(l!==45||(a=e.input.charCodeAt(e.position+1),!I(a))));){if(s=!0,e.position++,
|
|
1056
|
-
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var t=new Hn(e,n),r=e.indexOf("\0");for(r!==-1&&(t.position=r,f(t,"null byte is not allowed in input")),t.input+="\0";t.input.charCodeAt(t.position)===32;)t.lineIndent+=1,t.position+=1;for(;t.position<t.length-1;)Wn(t);return t.documents}function Qn(e,n,t){n!==null&&typeof n=="object"&&typeof t>"u"&&(t=n,n=null);var r=yr(e,t);if(typeof n!="function")return r;for(var i=0,o=r.length;i<o;i+=1)n(r[i])}function Zn(e,n){var t=yr(e,n);if(t.length!==0){if(t.length===1)return t[0];throw new _("expected a single document in the stream, but found more")}}var Xn=Qn,Jn=Zn,
|
|
1055
|
+
`,o?1+l:l),o=!0,a=!0,l=0,t=e.position;!R(u)&&u!==0;)u=e.input.charCodeAt(++e.position);N(e,t,e.position,!1)}return!0}function qt(e,n){var t,r=e.tag,i=e.anchor,o=[],a,s=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,f(e,"tab characters must not be used in indentation")),!(l!==45||(a=e.input.charCodeAt(e.position+1),!I(a))));){if(s=!0,e.position++,C(e,!0,-1)&&e.lineIndent<=n){o.push(null),l=e.input.charCodeAt(e.position);continue}if(t=e.line,J(e,n,gr,!1,!0),o.push(e.result),C(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===t||e.lineIndent>n)&&l!==0)f(e,"bad indentation of a sequence entry");else if(e.lineIndent<n)break}return s?(e.tag=r,e.anchor=i,e.kind="sequence",e.result=o,!0):!1}function jn(e,n,t){var r,i,o,a,s,l,c=e.tag,d=e.anchor,u={},p=Object.create(null),h=null,g=null,m=null,b=!1,w=!1,v;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),v=e.input.charCodeAt(e.position);v!==0;){if(!b&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,f(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),o=e.line,(v===63||v===58)&&I(r))v===63?(b&&(X(e,u,p,h,g,null,a,s,l),h=g=m=null),w=!0,b=!0,i=!0):b?(b=!1,i=!0):f(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,v=r;else{if(a=e.line,s=e.lineStart,l=e.position,!J(e,t,hr,!1,!0))break;if(e.line===o){for(v=e.input.charCodeAt(e.position);j(v);)v=e.input.charCodeAt(++e.position);if(v===58)v=e.input.charCodeAt(++e.position),I(v)||f(e,"a whitespace character is expected after the key-value separator within a block mapping"),b&&(X(e,u,p,h,g,null,a,s,l),h=g=m=null),w=!0,b=!1,i=!1,h=e.tag,g=e.result;else if(w)f(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=d,!0}else if(w)f(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=d,!0}if((e.line===o||e.lineIndent>n)&&(b&&(a=e.line,s=e.lineStart,l=e.position),J(e,n,Oe,!0,i)&&(b?g=e.result:m=e.result),b||(X(e,u,p,h,g,m,a,s,l),h=g=m=null),C(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>n)&&v!==0)f(e,"bad indentation of a mapping entry");else if(e.lineIndent<n)break}return b&&X(e,u,p,h,g,null,a,s,l),w&&(e.tag=c,e.anchor=d,e.kind="mapping",e.result=u),w}function Un(e){var n,t=!1,r=!1,i,o,a;if(a=e.input.charCodeAt(e.position),a!==33)return!1;if(e.tag!==null&&f(e,"duplication of a tag property"),a=e.input.charCodeAt(++e.position),a===60?(t=!0,a=e.input.charCodeAt(++e.position)):a===33?(r=!0,i="!!",a=e.input.charCodeAt(++e.position)):i="!",n=e.position,t){do a=e.input.charCodeAt(++e.position);while(a!==0&&a!==62);e.position<e.length?(o=e.input.slice(n,e.position),a=e.input.charCodeAt(++e.position)):f(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!I(a);)a===33&&(r?f(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(n-1,e.position+1),mr.test(i)||f(e,"named tag handle cannot contain such characters"),r=!0,n=e.position+1)),a=e.input.charCodeAt(++e.position);o=e.input.slice(n,e.position),Rn.test(o)&&f(e,"tag suffix cannot contain flow indicator characters")}o&&!fr.test(o)&&f(e,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch{f(e,"tag name is malformed: "+o)}return t?e.tag=o:G.call(e.tagMap,i)?e.tag=e.tagMap[i]+o:i==="!"?e.tag="!"+o:i==="!!"?e.tag="tag:yaml.org,2002:"+o:f(e,'undeclared tag handle "'+i+'"'),!0}function Yn(e){var n,t;if(t=e.input.charCodeAt(e.position),t!==38)return!1;for(e.anchor!==null&&f(e,"duplication of an anchor property"),t=e.input.charCodeAt(++e.position),n=e.position;t!==0&&!I(t)&&!Z(t);)t=e.input.charCodeAt(++e.position);return e.position===n&&f(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(n,e.position),!0}function Kn(e){var n,t,r;if(r=e.input.charCodeAt(e.position),r!==42)return!1;for(r=e.input.charCodeAt(++e.position),n=e.position;r!==0&&!I(r)&&!Z(r);)r=e.input.charCodeAt(++e.position);return e.position===n&&f(e,"name of an alias node must contain at least one character"),t=e.input.slice(n,e.position),G.call(e.anchorMap,t)||f(e,'unidentified alias "'+t+'"'),e.result=e.anchorMap[t],C(e,!0,-1),!0}function J(e,n,t,r,i){var o,a,s,l=1,c=!1,d=!1,u,p,h,g,m,b;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=a=s=Oe===t||gr===t,r&&C(e,!0,-1)&&(c=!0,e.lineIndent>n?l=1:e.lineIndent===n?l=0:e.lineIndent<n&&(l=-1)),l===1)for(;Un(e)||Yn(e);)C(e,!0,-1)?(c=!0,s=o,e.lineIndent>n?l=1:e.lineIndent===n?l=0:e.lineIndent<n&&(l=-1)):s=!1;if(s&&(s=c||i),(l===1||Oe===t)&&(Ge===t||hr===t?m=n:m=n+1,b=e.position-e.lineStart,l===1?s&&(qt(e,b)||jn(e,b,m))||Vn(e,m)?d=!0:(a&&Fn(e,m)||Gn(e,m)||On(e,m)?d=!0:Kn(e)?(d=!0,(e.tag!==null||e.anchor!==null)&&f(e,"alias node should not have any properties")):Nn(e,m,Ge===t)&&(d=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(d=s&&qt(e,b))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&f(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),u=0,p=e.implicitTypes.length;u<p;u+=1)if(g=e.implicitTypes[u],g.resolve(e.result)){e.result=g.construct(e.result),e.tag=g.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(G.call(e.typeMap[e.kind||"fallback"],e.tag))g=e.typeMap[e.kind||"fallback"][e.tag];else for(g=null,h=e.typeMap.multi[e.kind||"fallback"],u=0,p=h.length;u<p;u+=1)if(e.tag.slice(0,h[u].tag.length)===h[u].tag){g=h[u];break}g||f(e,"unknown tag !<"+e.tag+">"),e.result!==null&&g.kind!==e.kind&&f(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+g.kind+'", not "'+e.kind+'"'),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):f(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||d}function Wn(e){var n=e.position,t,r,i,o=!1,a;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(a=e.input.charCodeAt(e.position))!==0&&(C(e,!0,-1),a=e.input.charCodeAt(e.position),!(e.lineIndent>0||a!==37));){for(o=!0,a=e.input.charCodeAt(++e.position),t=e.position;a!==0&&!I(a);)a=e.input.charCodeAt(++e.position);for(r=e.input.slice(t,e.position),i=[],r.length<1&&f(e,"directive name must not be less than one character in length");a!==0;){for(;j(a);)a=e.input.charCodeAt(++e.position);if(a===35){do a=e.input.charCodeAt(++e.position);while(a!==0&&!R(a));break}if(R(a))break;for(t=e.position;a!==0&&!I(a);)a=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}a!==0&&ht(e),G.call(Pt,r)?Pt[r](e,r,i):Ve(e,'unknown document directive "'+r+'"')}if(C(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,C(e,!0,-1)):o&&f(e,"directives end mark is expected"),J(e,e.lineIndent-1,Oe,!1,!0),C(e,!0,-1),e.checkLineBreaks&&Dn.test(e.input.slice(n,e.position))&&Ve(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Ue(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,C(e,!0,-1));return}if(e.position<e.length-1)f(e,"end of the stream or a document separator is expected");else return}function yr(e,n){e=String(e),n=n||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
1056
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var t=new Hn(e,n),r=e.indexOf("\0");for(r!==-1&&(t.position=r,f(t,"null byte is not allowed in input")),t.input+="\0";t.input.charCodeAt(t.position)===32;)t.lineIndent+=1,t.position+=1;for(;t.position<t.length-1;)Wn(t);return t.documents}function Qn(e,n,t){n!==null&&typeof n=="object"&&typeof t>"u"&&(t=n,n=null);var r=yr(e,t);if(typeof n!="function")return r;for(var i=0,o=r.length;i<o;i+=1)n(r[i])}function Zn(e,n){var t=yr(e,n);if(t.length!==0){if(t.length===1)return t[0];throw new _("expected a single document in the stream, but found more")}}var Xn=Qn,Jn=Zn,Cr={loadAll:Xn,load:Jn},Er=Object.prototype.toString,kr=Object.prototype.hasOwnProperty,mt=65279,eo=9,be=10,to=13,ro=32,io=33,no=34,st=35,oo=37,ao=38,so=39,lo=42,Sr=44,co=45,Fe=58,uo=61,po=62,ho=63,go=64,Tr=91,$r=93,mo=96,Ar=123,fo=124,_r=125,A={};A[0]="\\0";A[7]="\\a";A[8]="\\b";A[9]="\\t";A[10]="\\n";A[11]="\\v";A[12]="\\f";A[13]="\\r";A[27]="\\e";A[34]='\\"';A[92]="\\\\";A[133]="\\N";A[160]="\\_";A[8232]="\\L";A[8233]="\\P";var bo=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],vo=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function xo(e,n){var t,r,i,o,a,s,l;if(n===null)return{};for(t={},r=Object.keys(n),i=0,o=r.length;i<o;i+=1)a=r[i],s=String(n[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),l=e.compiledTypeMap.fallback[a],l&&kr.call(l.styleAliases,s)&&(s=l.styleAliases[s]),t[a]=s;return t}function wo(e){var n,t,r;if(n=e.toString(16).toUpperCase(),e<=255)t="x",r=2;else if(e<=65535)t="u",r=4;else if(e<=4294967295)t="U",r=8;else throw new _("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+t+S.repeat("0",r-n.length)+n}var yo=1,ve=2;function Co(e){this.schema=e.schema||pt,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=S.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=xo(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?ve:yo,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function zt(e,n){for(var t=S.repeat(" ",n),r=0,i=-1,o="",a,s=e.length;r<s;)i=e.indexOf(`
|
|
1057
1057
|
`,r),i===-1?(a=e.slice(r),r=s):(a=e.slice(r,i+1),r=i+1),a.length&&a!==`
|
|
1058
1058
|
`&&(o+=t),o+=a;return o}function lt(e,n){return`
|
|
1059
|
-
`+S.repeat(" ",e.indent*n)}function
|
|
1059
|
+
`+S.repeat(" ",e.indent*n)}function Eo(e,n){var t,r,i;for(t=0,r=e.implicitTypes.length;t<r;t+=1)if(i=e.implicitTypes[t],i.resolve(n))return!0;return!1}function je(e){return e===ro||e===eo}function xe(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==mt||65536<=e&&e<=1114111}function Ht(e){return xe(e)&&e!==mt&&e!==to&&e!==be}function Nt(e,n,t){var r=Ht(e),i=r&&!je(e);return(t?r:r&&e!==Sr&&e!==Tr&&e!==$r&&e!==Ar&&e!==_r)&&e!==st&&!(n===Fe&&!i)||Ht(n)&&!je(n)&&e===st||n===Fe&&i}function ko(e){return xe(e)&&e!==mt&&!je(e)&&e!==co&&e!==ho&&e!==Fe&&e!==Sr&&e!==Tr&&e!==$r&&e!==Ar&&e!==_r&&e!==st&&e!==ao&&e!==lo&&e!==io&&e!==fo&&e!==uo&&e!==po&&e!==so&&e!==no&&e!==oo&&e!==go&&e!==mo}function So(e){return!je(e)&&e!==Fe}function me(e,n){var t=e.charCodeAt(n),r;return t>=55296&&t<=56319&&n+1<e.length&&(r=e.charCodeAt(n+1),r>=56320&&r<=57343)?(t-55296)*1024+r-56320+65536:t}function Ir(e){var n=/^\n* /;return n.test(e)}var Mr=1,ct=2,Lr=3,Dr=4,Q=5;function To(e,n,t,r,i,o,a,s){var l,c=0,d=null,u=!1,p=!1,h=r!==-1,g=-1,m=ko(me(e,0))&&So(me(e,e.length-1));if(n||a)for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=me(e,l),!xe(c))return Q;m=m&&Nt(c,d,s),d=c}else{for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=me(e,l),c===be)u=!0,h&&(p=p||l-g-1>r&&e[g+1]!==" ",g=l);else if(!xe(c))return Q;m=m&&Nt(c,d,s),d=c}p=p||h&&l-g-1>r&&e[g+1]!==" "}return!u&&!p?m&&!a&&!i(e)?Mr:o===ve?Q:ct:t>9&&Ir(e)?Q:a?o===ve?Q:ct:p?Dr:Lr}function $o(e,n,t,r,i){e.dump=function(){if(n.length===0)return e.quotingType===ve?'""':"''";if(!e.noCompatMode&&(bo.indexOf(n)!==-1||vo.test(n)))return e.quotingType===ve?'"'+n+'"':"'"+n+"'";var o=e.indent*Math.max(1,t),a=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),s=r||e.flowLevel>-1&&t>=e.flowLevel;function l(c){return Eo(e,c)}switch(To(n,s,e.indent,a,l,e.quotingType,e.forceQuotes&&!r,i)){case Mr:return n;case ct:return"'"+n.replace(/'/g,"''")+"'";case Lr:return"|"+Gt(n,e.indent)+Ot(zt(n,o));case Dr:return">"+Gt(n,e.indent)+Ot(zt(Ao(n,a),o));case Q:return'"'+_o(n)+'"';default:throw new _("impossible error: invalid scalar style")}}()}function Gt(e,n){var t=Ir(e)?String(n):"",r=e[e.length-1]===`
|
|
1060
1060
|
`,i=r&&(e[e.length-2]===`
|
|
1061
1061
|
`||e===`
|
|
1062
1062
|
`),o=i?"+":r?"":"-";return t+o+`
|
|
@@ -1067,10 +1067,10 @@ ${Object.entries(e).map(([n,t])=>` ${n}: ${t};`).join(`
|
|
|
1067
1067
|
`:"")+Vt(l,n),i=o}return r}function Vt(e,n){if(e===""||e[0]===" ")return e;for(var t=/ [^ ]/g,r,i=0,o,a=0,s=0,l="";r=t.exec(e);)s=r.index,s-i>n&&(o=a>i?a:s,l+=`
|
|
1068
1068
|
`+e.slice(i,o),i=o+1),a=s;return l+=`
|
|
1069
1069
|
`,e.length-i>n&&a>i?l+=e.slice(i,a)+`
|
|
1070
|
-
`+e.slice(a+1):l+=e.slice(i),l.slice(1)}function _o(e){for(var n="",t=0,r,i=0;i<e.length;t>=65536?i+=2:i++)t=me(e,i),r=A[t],!r&&xe(t)?(n+=e[i],t>=65536&&(n+=e[i+1])):n+=r||wo(t);return n}function Io(e,n,t){var r="",i=e.tag,o,a,s;for(o=0,a=t.length;o<a;o+=1)s=t[o],e.replacer&&(s=e.replacer.call(t,String(o),s)),(z(e,n,s,!1,!1)||typeof s>"u"&&z(e,n,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=i,e.dump="["+r+"]"}function Ft(e,n,t,r){var i="",o=e.tag,a,s,l;for(a=0,s=t.length;a<s;a+=1)l=t[a],e.replacer&&(l=e.replacer.call(t,String(a),l)),(z(e,n+1,l,!0,!0,!1,!0)||typeof l>"u"&&z(e,n+1,null,!0,!0,!1,!0))&&((!r||i!=="")&&(i+=lt(e,n)),e.dump&&be===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=o,e.dump=i||"[]"}function Mo(e,n,t){var r="",i=e.tag,o=Object.keys(t),a,s,l,c,d;for(a=0,s=o.length;a<s;a+=1)d="",r!==""&&(d+=", "),e.condenseFlow&&(d+='"'),l=o[a],c=t[l],e.replacer&&(c=e.replacer.call(t,l,c)),z(e,n,l,!1,!1)&&(e.dump.length>1024&&(d+="? "),d+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),z(e,n,c,!1,!1)&&(d+=e.dump,r+=d));e.tag=i,e.dump="{"+r+"}"}function Lo(e,n,t,r){var i="",o=e.tag,a=Object.keys(t),s,l,c,d,u,p;if(e.sortKeys===!0)a.sort();else if(typeof e.sortKeys=="function")a.sort(e.sortKeys);else if(e.sortKeys)throw new _("sortKeys must be a boolean or a function");for(s=0,l=a.length;s<l;s+=1)p="",(!r||i!=="")&&(p+=lt(e,n)),c=a[s],d=t[c],e.replacer&&(d=e.replacer.call(t,c,d)),z(e,n+1,c,!0,!0,!0)&&(u=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,u&&(e.dump&&be===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,u&&(p+=lt(e,n)),z(e,n+1,d,!0,u)&&(e.dump&&be===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,i+=p));e.tag=o,e.dump=i||"{}"}function jt(e,n,t){var r,i,o,a,s,l;for(i=t?e.explicitTypes:e.implicitTypes,o=0,a=i.length;o<a;o+=1)if(s=i[o],(s.instanceOf||s.predicate)&&(!s.instanceOf||typeof n=="object"&&n instanceof s.instanceOf)&&(!s.predicate||s.predicate(n))){if(t?s.multi&&s.representName?e.tag=s.representName(n):e.tag=s.tag:e.tag="?",s.represent){if(l=e.styleMap[s.tag]||s.defaultStyle,
|
|
1071
|
-
`:""}var Po=Ro,Bo={dump:Po};function ft(e,n){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}var qo=$,zo=Kt,Ho=Xt,No=ir,Go=nr,Oo=pt,Vo=
|
|
1070
|
+
`+e.slice(a+1):l+=e.slice(i),l.slice(1)}function _o(e){for(var n="",t=0,r,i=0;i<e.length;t>=65536?i+=2:i++)t=me(e,i),r=A[t],!r&&xe(t)?(n+=e[i],t>=65536&&(n+=e[i+1])):n+=r||wo(t);return n}function Io(e,n,t){var r="",i=e.tag,o,a,s;for(o=0,a=t.length;o<a;o+=1)s=t[o],e.replacer&&(s=e.replacer.call(t,String(o),s)),(z(e,n,s,!1,!1)||typeof s>"u"&&z(e,n,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=i,e.dump="["+r+"]"}function Ft(e,n,t,r){var i="",o=e.tag,a,s,l;for(a=0,s=t.length;a<s;a+=1)l=t[a],e.replacer&&(l=e.replacer.call(t,String(a),l)),(z(e,n+1,l,!0,!0,!1,!0)||typeof l>"u"&&z(e,n+1,null,!0,!0,!1,!0))&&((!r||i!=="")&&(i+=lt(e,n)),e.dump&&be===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=o,e.dump=i||"[]"}function Mo(e,n,t){var r="",i=e.tag,o=Object.keys(t),a,s,l,c,d;for(a=0,s=o.length;a<s;a+=1)d="",r!==""&&(d+=", "),e.condenseFlow&&(d+='"'),l=o[a],c=t[l],e.replacer&&(c=e.replacer.call(t,l,c)),z(e,n,l,!1,!1)&&(e.dump.length>1024&&(d+="? "),d+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),z(e,n,c,!1,!1)&&(d+=e.dump,r+=d));e.tag=i,e.dump="{"+r+"}"}function Lo(e,n,t,r){var i="",o=e.tag,a=Object.keys(t),s,l,c,d,u,p;if(e.sortKeys===!0)a.sort();else if(typeof e.sortKeys=="function")a.sort(e.sortKeys);else if(e.sortKeys)throw new _("sortKeys must be a boolean or a function");for(s=0,l=a.length;s<l;s+=1)p="",(!r||i!=="")&&(p+=lt(e,n)),c=a[s],d=t[c],e.replacer&&(d=e.replacer.call(t,c,d)),z(e,n+1,c,!0,!0,!0)&&(u=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,u&&(e.dump&&be===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,u&&(p+=lt(e,n)),z(e,n+1,d,!0,u)&&(e.dump&&be===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,i+=p));e.tag=o,e.dump=i||"{}"}function jt(e,n,t){var r,i,o,a,s,l;for(i=t?e.explicitTypes:e.implicitTypes,o=0,a=i.length;o<a;o+=1)if(s=i[o],(s.instanceOf||s.predicate)&&(!s.instanceOf||typeof n=="object"&&n instanceof s.instanceOf)&&(!s.predicate||s.predicate(n))){if(t?s.multi&&s.representName?e.tag=s.representName(n):e.tag=s.tag:e.tag="?",s.represent){if(l=e.styleMap[s.tag]||s.defaultStyle,Er.call(s.represent)==="[object Function]")r=s.represent(n,l);else if(kr.call(s.represent,l))r=s.represent[l](n,l);else throw new _("!<"+s.tag+'> tag resolver accepts not "'+l+'" style');e.dump=r}return!0}return!1}function z(e,n,t,r,i,o,a){e.tag=null,e.dump=t,jt(e,t,!1)||jt(e,t,!0);var s=Er.call(e.dump),l=r,c;r&&(r=e.flowLevel<0||e.flowLevel>n);var d=s==="[object Object]"||s==="[object Array]",u,p;if(d&&(u=e.duplicates.indexOf(t),p=u!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&n>0)&&(i=!1),p&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(d&&p&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),s==="[object Object]")r&&Object.keys(e.dump).length!==0?(Lo(e,n,e.dump,i),p&&(e.dump="&ref_"+u+e.dump)):(Mo(e,n,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(s==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!a&&n>0?Ft(e,n-1,e.dump,i):Ft(e,n,e.dump,i),p&&(e.dump="&ref_"+u+e.dump)):(Io(e,n,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(s==="[object String]")e.tag!=="?"&&$o(e,e.dump,n,o,l);else{if(s==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new _("unacceptable kind of an object to dump "+s)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}function Do(e,n){var t=[],r=[],i,o;for(dt(e,t,r),i=0,o=r.length;i<o;i+=1)n.duplicates.push(t[r[i]]);n.usedDuplicates=new Array(o)}function dt(e,n,t){var r,i,o;if(e!==null&&typeof e=="object")if(i=n.indexOf(e),i!==-1)t.indexOf(i)===-1&&t.push(i);else if(n.push(e),Array.isArray(e))for(i=0,o=e.length;i<o;i+=1)dt(e[i],n,t);else for(r=Object.keys(e),i=0,o=r.length;i<o;i+=1)dt(e[r[i]],n,t)}function Ro(e,n){n=n||{};var t=new Co(n);t.noRefs||Do(e,t);var r=e;return t.replacer&&(r=t.replacer.call({"":r},"",r)),z(t,0,r,!0,!0)?t.dump+`
|
|
1071
|
+
`:""}var Po=Ro,Bo={dump:Po};function ft(e,n){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}var qo=$,zo=Kt,Ho=Xt,No=ir,Go=nr,Oo=pt,Vo=Cr.load,Fo=Cr.loadAll,jo=Bo.dump,Uo=_,Yo={binary:cr,float:rr,map:Zt,null:Jt,pairs:ur,set:pr,timestamp:sr,bool:er,int:tr,merge:lr,omap:dr,seq:Qt,str:Wt},Ko=ft("safeLoad","load"),Wo=ft("safeLoadAll","loadAll"),Qo=ft("safeDump","dump"),Rr={Type:qo,Schema:zo,FAILSAFE_SCHEMA:Ho,JSON_SCHEMA:No,CORE_SCHEMA:Go,DEFAULT_SCHEMA:Oo,load:Vo,loadAll:Fo,dump:jo,YAMLException:Uo,types:Yo,safeLoad:Ko,safeLoadAll:Wo,safeDump:Qo};var U=["#10b981","#f59e0b","#06b6d4","#ec4899","#8b5cf6","#3b82f6","#f43f5e","#84cc16","#a855f7","#6366f1"];function T(e){let n=e.length,t;for(;n!==0;)t=Math.floor(Math.random()*n),n--,[e[n],e[t]]=[e[t],e[n]];return e}var P=(e,n=0)=>{let t=3735928559^n,r=1103547991^n;for(let i=0,o;i<e.length;i++)o=e.charCodeAt(i),t=Math.imul(t^o,265443561),r=Math.imul(r^o,159334677);return t=Math.imul(t^r>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),(4294967296*(2009751&r)+(t>>>0)).toString()};function E(e){return e.replace(/[&<>"']/g,n=>n==="&"?"&":n==="<"?"<":n===">"?">":n==='"'?""":"'")}function Zo(e){try{return Rr.load(e)}catch(n){throw new Error(`Invalid YAML assets:
|
|
1072
1072
|
${n instanceof Error?n.message:String(n)}`)}}function M(e){return typeof e=="string"}function bt(e){return typeof e=="number"}function vt(e){return/^(\d{1,2}:)?\d{1,2}:\d{2}$/.test(e)}function Pr(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function Ye(e){return typeof e=="object"&&e!==null&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function Y(e){return e.split("|").map(n=>n.trim()).filter(Boolean)}var ee=e=>[...new Set(e)];var we=class extends Error{constructor(n){super(`Asset validation failed:n- ${n.join(`
|
|
1073
|
-
- `)}`),this.name="AssetValidationError",this.issues=n}};function Xo(e){let n=[];if(!Ye(e))throw new we(["Top-level assets must be an object/map like { mango: {...}, trend: {...} }"]);let t=e,r={};for(let[o,a]of Object.entries(t)){if(!o||typeof o!="string"){n.push(`Asset key must be a non-empty string (got: ${String(o)})`);continue}if(/^[a-zA-Z0-9._-]+$/.test(o)||n.push(`Asset id "${o}" has invalid chars; use letters/numbers/._-`),!Ye(a)){n.push(`Asset "${o}" must be an object (got: ${Pr(a)})`);continue}let s=a,l=s.type,c=!!s.dialog;if(!M(l)){n.push(`Asset "${o}" missing string field "type"`);continue}if(!Jo(l)){n.push(`Asset "${o}" has unsupported type "${l}" (use image|video|audio|html)`);continue}switch(l){case"image":{let d=s.url;M(d)||n.push(`Asset "${o}" (image) missing "url"`);let u=s.size;u!==void 0&&!M(u)&&n.push(`Asset "${o}" (image) field "size" must be a string`),M(d)&&(r[o]={id:o,type:l,dialog:c,url:d,...M(u)?{size:u}:{}});break}case"video":{let d=s.url;M(d)||n.push(`Asset "${o}" (video) missing "url"`);let u=s.span,p;if(u!==void 0)if(!Ye(u))n.push(`Asset "${o}" (video) field "span" must be an object`);else{let h=u.from,g=u.to;!M(h)||!M(g)?n.push(`Asset "${o}" (video) span requires string "from" and "to"`):((!vt(h)||!vt(g))&&n.push(`Asset "${o}" (video) span times should look like "02:15" or "01:02:45"`),p={from:h,to:g})}M(d)&&(r[o]={id:o,type:l,dialog:c,url:d,...p?{span:p}:{}});break}case"audio":{let d=s.url;M(d)||n.push(`Asset "${o}" (audio) missing "url"`);let u=s.volume;u!==void 0&&(!bt(u)||!Number.isFinite(u)?n.push(`Asset "${o}" (audio) field "volume" must be a number`):(u<0||u>100)&&n.push(`Asset "${o}" (audio) field "volume" must be between 0 and 100`)),M(d)&&(r[o]={id:o,type:l,dialog:c,url:d,...bt(u)?{volume:u}:{}});break}case"html":{let d=s.content;if(!M(d)){n.push(`Asset "${o}" (html) missing string field "content"`);break}r[o]={id:o,type:l,dialog:c,content:d};break}case"tts":{let d=s.content;if(!M(d)){n.push(`Asset "${o}" (tts) missing string field "content"`);break}r[o]={id:o,type:l,dialog:c,content:d};break}}}if(n.length)throw new we(n);let i=Object.keys(r).sort((o,a)=>o.localeCompare(a)).map(o=>r[o]);return{assetsById:r,assetsList:i}}function Jo(e){return e==="image"||e==="video"||e==="audio"||e==="html"}function ye(e,n,t,r){let i=0,o=0;return e.forEach(s=>{s.items.forEach(l=>{o++;let c=n.get(l),d=t.querySelector(`[data-label="${l}"]`);c===s.label?(i++,d.chipState="correct"):d.chipState="wrong"})}),r&&r.forEach(s=>{o++;let l=n.get(s),c=t.querySelector(`[data-label="${s}"]`);l==="Invalid"?(i++,c.chipState="correct"):c.chipState="wrong"}),{score:o>0?Math.round(i/o*100):0,correct:i,total:o}}var
|
|
1073
|
+
- `)}`),this.name="AssetValidationError",this.issues=n}};function Xo(e){let n=[];if(!Ye(e))throw new we(["Top-level assets must be an object/map like { mango: {...}, trend: {...} }"]);let t=e,r={};for(let[o,a]of Object.entries(t)){if(!o||typeof o!="string"){n.push(`Asset key must be a non-empty string (got: ${String(o)})`);continue}if(/^[a-zA-Z0-9._-]+$/.test(o)||n.push(`Asset id "${o}" has invalid chars; use letters/numbers/._-`),!Ye(a)){n.push(`Asset "${o}" must be an object (got: ${Pr(a)})`);continue}let s=a,l=s.type,c=!!s.dialog;if(!M(l)){n.push(`Asset "${o}" missing string field "type"`);continue}if(!Jo(l)){n.push(`Asset "${o}" has unsupported type "${l}" (use image|video|audio|html)`);continue}switch(l){case"image":{let d=s.url;M(d)||n.push(`Asset "${o}" (image) missing "url"`);let u=s.size;u!==void 0&&!M(u)&&n.push(`Asset "${o}" (image) field "size" must be a string`),M(d)&&(r[o]={id:o,type:l,dialog:c,url:d,...M(u)?{size:u}:{}});break}case"video":{let d=s.url;M(d)||n.push(`Asset "${o}" (video) missing "url"`);let u=s.span,p;if(u!==void 0)if(!Ye(u))n.push(`Asset "${o}" (video) field "span" must be an object`);else{let h=u.from,g=u.to;!M(h)||!M(g)?n.push(`Asset "${o}" (video) span requires string "from" and "to"`):((!vt(h)||!vt(g))&&n.push(`Asset "${o}" (video) span times should look like "02:15" or "01:02:45"`),p={from:h,to:g})}M(d)&&(r[o]={id:o,type:l,dialog:c,url:d,...p?{span:p}:{}});break}case"audio":{let d=s.url;M(d)||n.push(`Asset "${o}" (audio) missing "url"`);let u=s.volume;u!==void 0&&(!bt(u)||!Number.isFinite(u)?n.push(`Asset "${o}" (audio) field "volume" must be a number`):(u<0||u>100)&&n.push(`Asset "${o}" (audio) field "volume" must be between 0 and 100`)),M(d)&&(r[o]={id:o,type:l,dialog:c,url:d,...bt(u)?{volume:u}:{}});break}case"html":{let d=s.content;if(!M(d)){n.push(`Asset "${o}" (html) missing string field "content"`);break}r[o]={id:o,type:l,dialog:c,content:d};break}case"tts":{let d=s.content;if(!M(d)){n.push(`Asset "${o}" (tts) missing string field "content"`);break}r[o]={id:o,type:l,dialog:c,content:d};break}}}if(n.length)throw new we(n);let i=Object.keys(r).sort((o,a)=>o.localeCompare(a)).map(o=>r[o]);return{assetsById:r,assetsList:i}}function Jo(e){return e==="image"||e==="video"||e==="audio"||e==="html"}function ye(e,n,t,r){let i=0,o=0;return e.forEach(s=>{s.items.forEach(l=>{o++;let c=n.get(l),d=t.querySelector(`[data-label="${l}"]`);c===s.label?(i++,d.chipState="correct"):d.chipState="wrong"})}),r&&r.forEach(s=>{o++;let l=n.get(s),c=t.querySelector(`[data-label="${s}"]`);l==="Invalid"?(i++,c.chipState="correct"):c.chipState="wrong"}),{score:o>0?Math.round(i/o*100):0,correct:i,total:o}}var Ce=class extends x{constructor(t,r,i){super(t,r,i);this.interactionMechanic="static";this.categories=[];this.allItems=[];this.categoryColors=["#6366f1","#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#94a3b8"];this.currentColor=this.categoryColors[0];this.data.categories.forEach(({label:o,items:a})=>{this.categories.push(o),this.allItems.push(...a)}),this.currentCategory=this.categories[0],this.data.distractors&&(this.allItems.push(...this.data.distractors),this.categories.push("Invalid")),this.allItems=T(this.allItems),this.categorized=new Map,this.initializeProgress(this.allItems.length)}initialize(){}cleanup(){}onVariantChange(t){this.querySelectorAll("edu-chip, edu-block").forEach(r=>{r.variant!==void 0&&(r.variant=t)})}render(){this.innerHTML=`
|
|
1074
1074
|
<style>
|
|
1075
1075
|
open-classification {
|
|
1076
1076
|
--current-color: #aa94b8;
|
|
@@ -1230,7 +1230,7 @@ ${n instanceof Error?n.message:String(n)}`)}}function M(e){return typeof e=="str
|
|
|
1230
1230
|
</div>
|
|
1231
1231
|
`,this.style.setProperty("--current-color",this.currentColor),this.$categoriesBar=this.querySelector("#categories-bar"),this.setCategories(this.$categoriesBar);let t=this.querySelector(".items-container");this.setItems(t)}setItems(t){this.allItems.forEach((r,i)=>{let o=document.createElement("edu-chip");o.variant=this.config.variant,o.dataset.label=r,D(r,o,this.assets?.assetsById),o.addEventListener("click",a=>{let s=a.currentTarget,l=s.dataset.label;if(this.categorized.get(l)===this.currentCategory){this.categorized.delete(l),s.colored=!1,this.decrementProgress(),this.emitStateChange();return}this.categorized.has(l)||this.incrementProgress(),this.categorized.set(l,this.currentCategory),s.color=this.currentColor,s.colored=!0,this.emitStateChange()}),t.append(o)})}setCategories(t){this.categories.forEach((r,i)=>{let o=new V;o.variant=this.config.variant;let a=this.categoryColors[i%this.categoryColors.length];o.dataset.category=r,o.dataset.color=a,o.style.setProperty("--category-color",a),o.innerHTML=`
|
|
1232
1232
|
<div class="category-label">${r}</div>
|
|
1233
|
-
`,o.addEventListener("click",s=>{let l=s.currentTarget;this.currentCategory=l.dataset.category,this.currentColor=l.dataset.color,this.style.setProperty("--current-color",this.currentColor),t.querySelectorAll("edu-block").forEach(c=>c.classList.remove("active")),o.classList.add("active")}),r===this.currentCategory&&o.classList.add("active"),t.append(o)})}getCurrentState(){return{categorized:Object.fromEntries(this.categorized),progress:this.progressTracker.current}}isInteractionComplete(){if(this.categorized.size!==this.allItems.length)return!1;for(let t of this.categorized.values())if(t==null)return!1;return!0}onHint(){let t=this.allItems.filter(i=>!this.categorized.has(i));if(t.length===0){alert('All items are categorized! Click "Check" to submit.'),this.emitHintShown("All items categorized");return}let r=t[0];alert(`Hint: You haven't categorized "${r}" yet. Which category does it belong to?`),this.emitHintShown(`Uncategorized item: ${r}`)}submit(){super.submit();let t=ye(this.data.categories,this.categorized,this,this.data.distractors);console.log(`Classification Score: ${t.score.toFixed(1)}% (${t.correct}/${t.total} correct)`),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}reset(){super.reset(),this.categorized.clear(),this.querySelectorAll("edu-chip").forEach(t=>{t.classList.remove("colorized"),t.style.setProperty("--current-color","")})}};customElements.get("open-classification")||customElements.define("open-classification",
|
|
1233
|
+
`,o.addEventListener("click",s=>{let l=s.currentTarget;this.currentCategory=l.dataset.category,this.currentColor=l.dataset.color,this.style.setProperty("--current-color",this.currentColor),t.querySelectorAll("edu-block").forEach(c=>c.classList.remove("active")),o.classList.add("active")}),r===this.currentCategory&&o.classList.add("active"),t.append(o)})}getCurrentState(){return{categorized:Object.fromEntries(this.categorized),progress:this.progressTracker.current}}isInteractionComplete(){if(this.categorized.size!==this.allItems.length)return!1;for(let t of this.categorized.values())if(t==null)return!1;return!0}onHint(){let t=this.allItems.filter(i=>!this.categorized.has(i));if(t.length===0){alert('All items are categorized! Click "Check" to submit.'),this.emitHintShown("All items categorized");return}let r=t[0];alert(`Hint: You haven't categorized "${r}" yet. Which category does it belong to?`),this.emitHintShown(`Uncategorized item: ${r}`)}submit(){super.submit();let t=ye(this.data.categories,this.categorized,this,this.data.distractors);console.log(`Classification Score: ${t.score.toFixed(1)}% (${t.correct}/${t.total} correct)`),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}reset(){super.reset(),this.categorized.clear(),this.querySelectorAll("edu-chip").forEach(t=>{t.classList.remove("colorized"),t.style.setProperty("--current-color","")})}};customElements.get("open-classification")||customElements.define("open-classification",Ce);var Ee=class extends x{constructor(t,r,i){super(t,r,i);this.interactionMechanic="automatic-sequencing";this.categories=[];this.allItems=[];this.categorized=new Map;this.zones=[];this.chips=[];this.activeChip=null;this.currentZone=null;this.isDragging=!1;this.startX=0;this.startY=0;this.offsetX=0;this.offsetY=0;this.data.categories.forEach(({label:o,items:a})=>{this.categories.push(o),this.allItems.push(...a)}),this.data.distractors&&console.warn("Found a distractor in a Sequential Classification interaction, those are not useful and will be ignored"),this.allItems=this.config.shuffle?T(this.allItems):this.allItems,this.initializeProgress(this.allItems.length),this.boundPointerMove=this.handlePointerMove.bind(this),this.boundPointerUp=this.handlePointerUp.bind(this),this.variant=this.config.variant}initialize(){window.addEventListener("pointermove",this.boundPointerMove),window.addEventListener("pointerup",this.boundPointerUp)}cleanup(){window.removeEventListener("pointermove",this.boundPointerMove),window.removeEventListener("pointerup",this.boundPointerUp)}onVariantChange(t){this.querySelectorAll("edu-chip, edu-block").forEach(r=>{r.variant!==void 0&&(r.variant=t)}),this.variant=t}render(){let t=Math.min(this.categories.length,4);this.innerHTML=`
|
|
1234
1234
|
<style>
|
|
1235
1235
|
sequential-classification {
|
|
1236
1236
|
display: flex;
|
|
@@ -1396,7 +1396,7 @@ ${n instanceof Error?n.message:String(n)}`)}}function M(e){return typeof e=="str
|
|
|
1396
1396
|
<div id="zones-grid"></div>
|
|
1397
1397
|
</div>
|
|
1398
1398
|
</div>
|
|
1399
|
-
`,this.container=this.querySelector("#container"),this.centerZone=this.querySelector("#center-zone"),this.zonesGrid=this.querySelector("#zones-grid"),this.createDropZones(),this.showNextChip()}createDropZones(){let t=this.querySelector("#zones-grid");this.categories.forEach((r,i)=>{let o=document.createElement("edu-block");o.variant=this.variant,o.setAccentColor(U[i%U.length]),o.classList.add("zone","empty"),o.textContent=`${r}: 0`,o.dataset.label=r,t.appendChild(o),this.zones.push(o)})}showNextChip(){let t=this.allItems.find(i=>!this.categorized.has(i));if(!t){this.centerZone.classList.add("empty");return}let r=document.createElement("edu-chip");r.variant=this.variant,D(t,r,this.assets?.assetsById),r.prefix=(this.allItems.indexOf(t)+1).toString(),r.draggable=!0,r.dataset.label=t,r.addEventListener("pointerdown",i=>this.handlePointerDown(i,r)),this.container.appendChild(r),this.chips.push(r),requestAnimationFrame(()=>{let i=this.centerZone.getBoundingClientRect(),o=this.container.getBoundingClientRect(),a=r.getBoundingClientRect(),s=i.left-o.left+(i.width-a.width)/2,l=i.top-o.top+(i.height-a.height)/2;r.style.left=`${s}px`,r.style.top=`${l}px`})}reparentChip(t,r){if(t.parentElement===r)return;let i=t.getBoundingClientRect(),o=r.getBoundingClientRect(),a=i.left-o.left,s=i.top-o.top;r===this.zonesGrid&&(a+=this.zonesGrid.scrollLeft,s+=this.zonesGrid.scrollTop),t.style.left=`${a}px`,t.style.top=`${s}px`,r.appendChild(t)}handlePointerDown(t,r){t.preventDefault(),this.reparentChip(r,this.container),this.activeChip=r,this.isDragging=!0,r.classList.add("dragging");let i=r.getBoundingClientRect(),o=this.container.getBoundingClientRect();this.offsetX=t.clientX-i.left,this.offsetY=t.clientY-i.top,this.chips.forEach(a=>{a!==r&&(a.style.opacity="0.3")}),this.handlePointerMove(t)}handlePointerMove(t){if(!this.isDragging||!this.activeChip)return;let r=this.container.getBoundingClientRect(),i=t.clientX-r.left-this.offsetX,o=t.clientY-r.top-this.offsetY,a=this.activeChip.getBoundingClientRect();i=Math.max(0,Math.min(i,r.width-a.width)),o=Math.max(0,Math.min(o,r.height-a.height)),this.activeChip.style.left=`${i}px`,this.activeChip.style.top=`${o}px`,this.checkZoneOverlap(t.clientX,t.clientY)}handlePointerUp(t){if(!this.isDragging||!this.activeChip)return;this.isDragging=!1,this.chips.forEach(i=>i.style.opacity="1"),this.activeChip.classList.remove("dragging");let r=this.activeChip.dataset.label;if(this.currentZone){let i=this.currentZone.dataset.label,o=this.categorized.get(r);o!==i&&(this.categorized.set(r,i),this.emitStateChange(),o===void 0&&(this.incrementProgress(),this.showNextChip()),o===null&&this.incrementProgress()),this.reparentChip(this.activeChip,this.zonesGrid)}else this.categorized.get(r)&&(this.categorized.set(r,null),this.decrementProgress()),this.reparentChip(this.activeChip,this.container);this.zones.forEach(i=>{i.classList.remove("highlight");let o=Array.from(this.categorized.values()).filter(a=>a===i.dataset.label).length;i.textContent=`${i.dataset.label}: ${o}`,o>0?i.classList.remove("empty"):i.classList.add("empty")}),this.activeChip=null,this.currentZone=null}checkZoneOverlap(t,r){this.currentZone=null;for(let i of this.zones){let o=i.getBoundingClientRect();t>=o.left&&t<=o.right&&r>=o.top&&r<=o.bottom?(i.classList.add("highlight"),this.currentZone=i):i.classList.remove("highlight")}}getCurrentState(){return{categorized:Object.fromEntries(this.categorized),progress:this.progressTracker.current}}isInteractionComplete(){return this.categorized.size===this.allItems.length}onHint(){let t=this.allItems.filter(o=>!this.categorized.has(o));if(t.length===0){alert('All items are categorized! Click "Check" to submit.'),this.emitHintShown("All items categorized");return}let r=t[0],i=this.data.categories.find(o=>o.items.includes(r))?.label;i&&(alert(`Hint: "${r}" belongs to "${i}".`),this.emitHintShown(`Item: ${r} \u2192 Category: ${i}`))}submit(){super.submit();let t=ye(this.data.categories,this.categorized,this);console.log(`Classification Score: ${t.score.toFixed(1)}% (${t.correct}/${t.total} correct)`),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}reset(){super.reset(),this.categorized.clear(),this.chips.forEach(t=>t.remove()),this.chips=[],this.centerZone.classList.remove("empty"),this.activeChip=null,this.currentZone=null,this.isDragging=!1,this.zonesGrid&&(this.zonesGrid.scrollTop=0),this.showNextChip()}};customElements.get("sequential-classification")||customElements.define("sequential-classification",
|
|
1399
|
+
`,this.container=this.querySelector("#container"),this.centerZone=this.querySelector("#center-zone"),this.zonesGrid=this.querySelector("#zones-grid"),this.createDropZones(),this.showNextChip()}createDropZones(){let t=this.querySelector("#zones-grid");this.categories.forEach((r,i)=>{let o=document.createElement("edu-block");o.variant=this.variant,o.setAccentColor(U[i%U.length]),o.classList.add("zone","empty"),o.textContent=`${r}: 0`,o.dataset.label=r,t.appendChild(o),this.zones.push(o)})}showNextChip(){let t=this.allItems.find(i=>!this.categorized.has(i));if(!t){this.centerZone.classList.add("empty");return}let r=document.createElement("edu-chip");r.variant=this.variant,D(t,r,this.assets?.assetsById),r.prefix=(this.allItems.indexOf(t)+1).toString(),r.draggable=!0,r.dataset.label=t,r.addEventListener("pointerdown",i=>this.handlePointerDown(i,r)),this.container.appendChild(r),this.chips.push(r),requestAnimationFrame(()=>{let i=this.centerZone.getBoundingClientRect(),o=this.container.getBoundingClientRect(),a=r.getBoundingClientRect(),s=i.left-o.left+(i.width-a.width)/2,l=i.top-o.top+(i.height-a.height)/2;r.style.left=`${s}px`,r.style.top=`${l}px`})}reparentChip(t,r){if(t.parentElement===r)return;let i=t.getBoundingClientRect(),o=r.getBoundingClientRect(),a=i.left-o.left,s=i.top-o.top;r===this.zonesGrid&&(a+=this.zonesGrid.scrollLeft,s+=this.zonesGrid.scrollTop),t.style.left=`${a}px`,t.style.top=`${s}px`,r.appendChild(t)}handlePointerDown(t,r){t.preventDefault(),this.reparentChip(r,this.container),this.activeChip=r,this.isDragging=!0,r.classList.add("dragging");let i=r.getBoundingClientRect(),o=this.container.getBoundingClientRect();this.offsetX=t.clientX-i.left,this.offsetY=t.clientY-i.top,this.chips.forEach(a=>{a!==r&&(a.style.opacity="0.3")}),this.handlePointerMove(t)}handlePointerMove(t){if(!this.isDragging||!this.activeChip)return;let r=this.container.getBoundingClientRect(),i=t.clientX-r.left-this.offsetX,o=t.clientY-r.top-this.offsetY,a=this.activeChip.getBoundingClientRect();i=Math.max(0,Math.min(i,r.width-a.width)),o=Math.max(0,Math.min(o,r.height-a.height)),this.activeChip.style.left=`${i}px`,this.activeChip.style.top=`${o}px`,this.checkZoneOverlap(t.clientX,t.clientY)}handlePointerUp(t){if(!this.isDragging||!this.activeChip)return;this.isDragging=!1,this.chips.forEach(i=>i.style.opacity="1"),this.activeChip.classList.remove("dragging");let r=this.activeChip.dataset.label;if(this.currentZone){let i=this.currentZone.dataset.label,o=this.categorized.get(r);o!==i&&(this.categorized.set(r,i),this.emitStateChange(),o===void 0&&(this.incrementProgress(),this.showNextChip()),o===null&&this.incrementProgress()),this.reparentChip(this.activeChip,this.zonesGrid)}else this.categorized.get(r)&&(this.categorized.set(r,null),this.decrementProgress()),this.reparentChip(this.activeChip,this.container);this.zones.forEach(i=>{i.classList.remove("highlight");let o=Array.from(this.categorized.values()).filter(a=>a===i.dataset.label).length;i.textContent=`${i.dataset.label}: ${o}`,o>0?i.classList.remove("empty"):i.classList.add("empty")}),this.activeChip=null,this.currentZone=null}checkZoneOverlap(t,r){this.currentZone=null;for(let i of this.zones){let o=i.getBoundingClientRect();t>=o.left&&t<=o.right&&r>=o.top&&r<=o.bottom?(i.classList.add("highlight"),this.currentZone=i):i.classList.remove("highlight")}}getCurrentState(){return{categorized:Object.fromEntries(this.categorized),progress:this.progressTracker.current}}isInteractionComplete(){return this.categorized.size===this.allItems.length}onHint(){let t=this.allItems.filter(o=>!this.categorized.has(o));if(t.length===0){alert('All items are categorized! Click "Check" to submit.'),this.emitHintShown("All items categorized");return}let r=t[0],i=this.data.categories.find(o=>o.items.includes(r))?.label;i&&(alert(`Hint: "${r}" belongs to "${i}".`),this.emitHintShown(`Item: ${r} \u2192 Category: ${i}`))}submit(){super.submit();let t=ye(this.data.categories,this.categorized,this);console.log(`Classification Score: ${t.score.toFixed(1)}% (${t.correct}/${t.total} correct)`),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}reset(){super.reset(),this.categorized.clear(),this.chips.forEach(t=>t.remove()),this.chips=[],this.centerZone.classList.remove("empty"),this.activeChip=null,this.currentZone=null,this.isDragging=!1,this.zonesGrid&&(this.zonesGrid.scrollTop=0),this.showNextChip()}};customElements.get("sequential-classification")||customElements.define("sequential-classification",Ee);var ea={audio:`
|
|
1400
1400
|
<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
1401
1401
|
<path d="M11 5 6 9H3v6h3l5 4V5Z"/>
|
|
1402
1402
|
<path d="M15.5 8.5a5 5 0 0 1 0 7"/>
|
|
@@ -1947,7 +1947,7 @@ overflow-x: hidden;`;let r=document.createElement("edu-media");r.setAttribute("t
|
|
|
1947
1947
|
<edu-input type="text" placeholder="Enter an item..."></edu-input>
|
|
1948
1948
|
<edu-input as="button">Add</edu-input>
|
|
1949
1949
|
</div>
|
|
1950
|
-
`,this._$chipsContainer=this.querySelector(".chips-container"),this._$textInput=this.querySelector('edu-input[type="text"]'),this._$addButton=this.querySelector('edu-input[as="button"]'),this._$textInput.variant=this.config.variant,this._$addButton.variant=this.config.variant,this._$addButton.addEventListener("click",()=>this.handleAddItem()),this._$textInput.addEventListener("keydown",t=>{t.key==="Enter"&&(t.preventDefault(),this.handleAddItem())})}handleAddItem(){let t=this._$textInput.value.trim();if(!t)return;let r=t.toLowerCase();if(this._recalledItems.has(r)){alert("You have already added this item."),this._$textInput.value="";return}if(this._recalledItems.size>=this.data.items.length){alert(`You can only add up to ${this.data.items.length} items.`),this._$textInput.value="";return}this._recalledItems.add(r),this.addChip(t),this._$textInput.value="",this.setProgress(this._recalledItems.size),this.emitStateChange()}addChip(t){let r=document.createElement("edu-chip");r.textContent=t,r.variant=this.config.variant,r.value=t.toLowerCase(),r.addEventListener("click",()=>{let i=r.value;this._recalledItems.delete(i),r.remove(),this.setProgress(this._recalledItems.size),this.emitStateChange()}),this._$chipsContainer.appendChild(r)}getCurrentState(){return Array.from(this._recalledItems)}isInteractionComplete(){return this._recalledItems.size===this.data.items.length}onHint(){let t=this._recalledItems.size,r=this.data.items.length;t===0?(alert(`Hint: Try to recall all ${r} items from memory.`),this.emitHintShown("No items recalled yet")):t<r?(alert(`Hint: You've recalled ${t} out of ${r} items. Keep going!`),this.emitHintShown(`${t}/${r} items recalled`)):(alert(`Great! You've recalled all items. Click "Check" to submit.`),this.emitHintShown("All items recalled"))}submit(){super.submit();let t=this.gradeRecall();console.log(`List Recall Score: ${t.score.toFixed(1)}% (${t.correct}/${t.total} correct)`),this.applyGradingFeedback(t),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}gradeRecall(){let t=this.data.items.map(s=>s.toLowerCase()),r=Array.from(this._recalledItems),i=0;for(let s of r)t.includes(s)&&i++;let o=this.data.items.length;return{score:o>0?Math.round(i/o*100):0,correct:i,total:o,answerKey:this.data.items,userResponse:r}}applyGradingFeedback(t){let r=this.data.items.map(o=>o.toLowerCase());this._$chipsContainer.querySelectorAll("edu-chip").forEach(o=>{let a=o.value;r.includes(a)?o.chipState="correct":o.chipState="wrong"})}reset(){super.reset(),this._recalledItems.clear(),this._$chipsContainer.innerHTML="";let t=this._$textInput.querySelector(".control");t&&(t.value=""),this.setProgress(0)}};customElements.get("list-recall")||customElements.define("list-recall",re);function sl(e){let n=[],t=[],r=new Map,i={},o=/^\s*(?<category>[A-Z_](?:[A-Z0-9_]* ?[A-Z0-9_]+)*)\s*=\s*(?<items>[^;]+?)\s*;\s*$/gm,a=[...e.matchAll(o)];a.length===0&&(i["parse.noMatches"]="No valid category entries found. Expected lines like: CATEGORY = item1 | item2;");let s=new Set;for(let c of a){let d=c.groups?.category??"",u=c.groups?.items??"",p=d.trim().toLowerCase();if(r.has(p)){i[`parse.duplicateCategory.${p}`]=`Duplicate category "${p}" was defined more than once. Merge them into a single entry.`;continue}let h=u.split("|").map(g=>g.replace(/\s+/g," ").trim()).filter(Boolean);if(h.length===0){i[`parse.emptyCategory.${p}`]=`Category "${p}" has no items. Expected at least one item before ';'.`,t.push(p),r.set(p,[]);continue}t.push(p);for(let g of h)s.has(g)||(s.add(g),n.push(g));r.set(p,h)}let l={rows:n,cols:t,answerKey:r};return Object.keys(i).length>0?{data:l,errors:i}:{data:l}}function ll(e){let n={},t=[],r=new Map,i=/^\s*(?<category>[a-z_](?:[a-z0-9_]* ?[a-z0-9_]+)*)\s*=\s*(?<values>[^;]+?)\s*;/gim,o=[...e.matchAll(i)];if(o.length===0)return n["parse.noMatches"]="No valid category entries found. Expected lines like: category = val1 | val2;",{data:{rows:[],cols:[],answerKey:{}},errors:n};let a=new Set;for(let d of o){let u=d.groups?.category??"",p=d.groups?.values??"",h=u.trim().toLowerCase();if(a.has(h)){n[`parse.duplicateCategory.${h}`]=`Duplicate category "${h}" was defined more than once.`;continue}a.add(h);let g=p.split("|").map(m=>m.trim()).filter(Boolean);t.push(h),r.set(h,g)}let s=t.length;for(let d of t){let u=r.get(d)??[],p=s-1;u.length!==p&&(n[`parse.valueCount.${d}`]=`Category "${d}" has ${u.length} values, but expected ${p} (n-1 where n=${s}).`)}let l={};for(let d=0;d<t.length;d++){let u=t[d],p=r.get(u)??[];l[u]={};let h=0;for(let g=0;g<t.length;g++){if(d===g)continue;let m=t[g],b=p[h],w=null;if(b!==void 0&&b!==""){let v=Number(b);w=isNaN(v)?b:v}l[u][m]=w,h++}}let c={rows:t,cols:t,answerKey:l};return Object.keys(n).length>0?{data:c,errors:n}:{data:c}}function cl(e){let n={},t=[],r=[],i={},o=/^\s*=\s*(?<cols>[^;]+?)\s*;/m,a=e.match(o);if(!a)return n["parse.noHeader"]="Missing header line. Expected first line like: = col1 | col2 | col3;",{data:{rows:[],cols:[],answerKey:{}},errors:n};if(t=(a.groups?.cols??"").split("|").map(p=>p.trim()).filter(Boolean),t.length===0)return n["parse.emptyHeader"]='Header line has no columns. Expected at least one column after "=".',{data:{rows:[],cols:[],answerKey:{}},errors:n};let l=/^\s*(?<row>[^=]+?)\s*=\s*(?<values>[^;]+?)\s*;/gm,c=[...e.matchAll(l)],d=new Set;for(let p of c){let h=p.groups?.row??"",g=p.groups?.values??"";if(h.trim()==="")continue;let m=h.trim();if(d.has(m)){n[`parse.duplicateRow.${m}`]=`Duplicate row "${m}" was defined more than once.`;continue}d.add(m);let b=g.split("|").map(w=>w.trim()).filter(w=>w!=="");if(b.length!==t.length){n[`parse.valueCount.${m}`]=`Row "${m}" has ${b.length} values, but expected ${t.length} (matching column count).`;continue}r.push(m),i[m]={};for(let w=0;w<t.length;w++){let v=t[w],q=b[w];if(q==="-"){i[m][v]=null;continue}let K=null;if(q!==void 0&&q!==""){let Et=Number(q);K=isNaN(Et)?q:Et}i[m][v]=K}}r.length===0&&(n["parse.noRows"]="No data rows found. Expected at least one line like: row = val1 | val2;");let u={rows:r,cols:t,answerKey:i};return Object.keys(n).length>0?{data:u,errors:n}:{data:u}}function ul(e,n="classification"){let t={},r=e.answerKey;e.cols.length===0&&(t["cols.empty"]="No categories were found. Expected at least one CATEGORY = ... ; entry."),e.rows.length===0&&(t["rows.empty"]="No row items were found. Expected at least one item in any category.");for(let i of e.cols)e.rows.includes(i)&&(t[`cols.rowConflict.${i}`]=`Category "${i}" is also present as an item. Category labels cannot be used as row items.`);for(let i of e.cols){let o=r.get(i);if(!o){t[`answerKey.missing.${i}`]=`Category "${i}" has no entry in answerKey. This usually indicates a parser issue.`;continue}o.length===0&&(t[`answerKey.emptyCategory.${i}`]=`Category "${i}" has no items. Each category must include at least one item.`)}for(let[i,o]of r.entries()){let a=new Set;for(let s of o){if(a.has(s)){t[`answerKey.duplicateItem.${i}`]=`Category "${i}" includes duplicate item "${s}". Remove duplicates.`;break}a.add(s)}}if(n==="n-ary"){let i=new Map;for(let[o,a]of r.entries())for(let s of a){let l=i.get(s);l?l.push(o):i.set(s,[o])}for(let o of e.rows){let a=i.get(o)??[];if(a.length===0){t[`nary.unassigned.${o}`]=`Item "${o}" is not assigned to any category. In n-ary tables, every item must belong to exactly one category.`;continue}a.length>1&&(t[`nary.multiCategory.${o}`]=`Item "${o}" appears in multiple categories (${a.join(", ")}). In n-ary tables, items must belong to exactly one category.`)}}return Object.keys(t).length>0?{ok:!1,errors:t}:{ok:!0}}function pl(e){let n={};if(e.rows.length===0&&(n["rows.empty"]="No rows found. Expected at least one category."),e.cols.length===0&&(n["cols.empty"]="No columns found. Expected at least one category."),e.rows.length!==e.cols.length)n["symmetry.lengthMismatch"]=`Rows (${e.rows.length}) and columns (${e.cols.length}) must have the same length for adjacency tables.`;else{let t=new Set(e.rows),r=new Set(e.cols);for(let i of e.rows)r.has(i)||(n[`symmetry.rowNotInCols.${i}`]=`Row "${i}" does not appear in columns. Adjacency tables must be symmetric.`);for(let i of e.cols)t.has(i)||(n[`symmetry.colNotInRows.${i}`]=`Column "${i}" does not appear in rows. Adjacency tables must be symmetric.`)}for(let t of e.rows){if(!e.answerKey[t]){n[`answerKey.missingRow.${t}`]=`Row "${t}" has no entry in answer key.`;continue}for(let r of e.cols)if(t===r){let i=e.answerKey[t][r];i!=null&&(n[`answerKey.diagonalValue.${t}`]=`Diagonal cell (${t}, ${t}) should be empty, but has value "${i}".`)}else e.answerKey[t][r]===void 0&&(n[`answerKey.missingCell.${t}.${r}`]=`Missing value at cell (${t}, ${r}). All non-diagonal cells must have values.`)}return Object.keys(n).length>0?{ok:!1,errors:n}:{ok:!0}}function hl(e){let n={};e.cols.length===0&&(n["cols.empty"]="No columns found. Expected at least one column in header line."),e.rows.length===0&&(n["rows.empty"]="No rows found. Expected at least one data row.");let t=new Set(e.cols);for(let r of e.rows)t.has(r)&&(n[`naming.rowColConflict.${r}`]=`Row name "${r}" is also a column name. This creates ambiguity and should be avoided.`);for(let r of e.rows){if(!e.answerKey[r]){n[`answerKey.missingRow.${r}`]=`Row "${r}" has no entry in answer key.`;continue}for(let i of e.cols)e.answerKey[r][i]===void 0&&(n[`answerKey.missingCell.${r}.${i}`]=`Missing value at cell (${r}, ${i}). Cells must have values or be marked as disabled with '-'.`)}return Object.keys(n).length>0?{ok:!1,errors:n}:{ok:!0}}function Se(e){let n=[];for(let t of Object.values(e))for(let r of Object.values(t))r!==null&&n.push(r);return n}function Ke(e){let n=Se(e);return Array.from(new Set(n))}function We(e){let n=new Set(e.filter(t=>t!==null));return e.every(t=>t===null||typeof t=="number")?"number":n.size>0&&n.size<=10?"select":"text"}function Te(e,n){return e===null||n===null?!1:typeof e=="number"&&typeof n=="number"?Math.abs(e-n)<1e-4:String(e).trim()===String(n).trim()}function Nr(e,n,t){let r=0,i=t.length;for(let a of t){let s=n[a]?.selectedCols??[],l=null;for(let[c,d]of e.entries())if(d.includes(a)){l=c;break}s.length===1&&s[0]===l&&r++}return{score:i>0?Math.round(r/i*100):0,correct:r,total:i}}function Gr(e,n,t,r){let i=0,o=0;for(let s of t)for(let l of r){let c=e[s]?.[l];if(c===null)continue;let d=n[s]?.values[l];o++,Te(c,d)&&i++}return{score:o>0?Math.round(i/o*100):0,correct:i,total:o}}function Or(e,n,t,r){let i=0,o=0;for(let s of t){let l=new Set(n[s]?.selectedCols??[]),c=new Set;for(let[d,u]of e.entries())u.includes(s)&&c.add(d);for(let d of r){let u=c.has(d),p=l.has(d);u===p&&i++,o++}}return{score:o>0?Math.round(i/o*100):0,correct:i,total:o}}function Vr(e,n,t){let r=0,i=0;for(let a of t)for(let s of t){if(a===s)continue;let l=e[a]?.[s],c=n[a]?.values[s];i++,Te(l,c)&&r++}return{score:i>0?Math.round(r/i*100):0,correct:r,total:i}}function Fr(e,n,t){let r={};for(let i of t){r[i]={};for(let o of t){if(i===o)continue;let a=e[i]?.[o],s=n[i]?.values[o];s==null||s===""?r[i][o]="missed":Te(a,s)?r[i][o]="correct":r[i][o]="wrong"}}return r}function jr(e,n,t,r){let i={};for(let o of t){i[o]={};for(let a of r){let s=e[o]?.[a];if(s===null)continue;let l=n[o]?.values[a];l==null||l===""?i[o][a]="missed":Te(s,l)?i[o][a]="correct":i[o][a]="wrong"}}return i}function Ur(e,n,t,r){let i={};for(let o of t){i[o]={};let a=new Set(n[o]?.selectedCols??[]),s=new Set;for(let[l,c]of e.entries())c.includes(o)&&s.add(l);for(let l of r){let c=s.has(l),d=a.has(l);c===d?i[o][l]="correct":!d&&c?i[o][l]="missed":i[o][l]="wrong"}}return i}function Yr(e,n,t){let r={};for(let i of t){r[i]={};let o=n[i]?.selectedCols??[],a=null;for(let[s,l]of e.entries())if(l.includes(i)){a=s;break}if(o.length===1){let s=o[0];s===a?r[i][s]="correct":r[i][s]="wrong"}else o.length===0&&a&&(r[i][a]="missed")}return r}var Kr=`/* ===========================================
|
|
1950
|
+
`,this._$chipsContainer=this.querySelector(".chips-container"),this._$textInput=this.querySelector('edu-input[type="text"]'),this._$addButton=this.querySelector('edu-input[as="button"]'),this._$textInput.variant=this.config.variant,this._$addButton.variant=this.config.variant,this._$addButton.addEventListener("click",()=>this.handleAddItem()),this._$textInput.addEventListener("keydown",t=>{t.key==="Enter"&&(t.preventDefault(),this.handleAddItem())})}handleAddItem(){let t=this._$textInput.value.trim();if(!t)return;let r=t.toLowerCase();if(this._recalledItems.has(r)){alert("You have already added this item."),this._$textInput.value="";return}if(this._recalledItems.size>=this.data.items.length){alert(`You can only add up to ${this.data.items.length} items.`),this._$textInput.value="";return}this._recalledItems.add(r),this.addChip(t),this._$textInput.value="",this.setProgress(this._recalledItems.size),this.emitStateChange()}addChip(t){let r=document.createElement("edu-chip");r.textContent=t,r.variant=this.config.variant,r.value=t.toLowerCase(),r.addEventListener("click",()=>{let i=r.value;this._recalledItems.delete(i),r.remove(),this.setProgress(this._recalledItems.size),this.emitStateChange()}),this._$chipsContainer.appendChild(r)}getCurrentState(){return Array.from(this._recalledItems)}isInteractionComplete(){return this._recalledItems.size===this.data.items.length}onHint(){let t=this._recalledItems.size,r=this.data.items.length;t===0?(alert(`Hint: Try to recall all ${r} items from memory.`),this.emitHintShown("No items recalled yet")):t<r?(alert(`Hint: You've recalled ${t} out of ${r} items. Keep going!`),this.emitHintShown(`${t}/${r} items recalled`)):(alert(`Great! You've recalled all items. Click "Check" to submit.`),this.emitHintShown("All items recalled"))}submit(){super.submit();let t=this.gradeRecall();console.log(`List Recall Score: ${t.score.toFixed(1)}% (${t.correct}/${t.total} correct)`),this.applyGradingFeedback(t),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}gradeRecall(){let t=this.data.items.map(s=>s.toLowerCase()),r=Array.from(this._recalledItems),i=0;for(let s of r)t.includes(s)&&i++;let o=this.data.items.length;return{score:o>0?Math.round(i/o*100):0,correct:i,total:o,answerKey:this.data.items,userResponse:r}}applyGradingFeedback(t){let r=this.data.items.map(o=>o.toLowerCase());this._$chipsContainer.querySelectorAll("edu-chip").forEach(o=>{let a=o.value;r.includes(a)?o.chipState="correct":o.chipState="wrong"})}reset(){super.reset(),this._recalledItems.clear(),this._$chipsContainer.innerHTML="";let t=this._$textInput.querySelector(".control");t&&(t.value=""),this.setProgress(0)}};customElements.get("list-recall")||customElements.define("list-recall",re);function sl(e){let n=[],t=[],r=new Map,i={},o=/^\s*(?<category>[A-Z_](?:[A-Z0-9_]* ?[A-Z0-9_]+)*)\s*=\s*(?<items>[^;]+?)\s*;\s*$/gm,a=[...e.matchAll(o)];a.length===0&&(i["parse.noMatches"]="No valid category entries found. Expected lines like: CATEGORY = item1 | item2;");let s=new Set;for(let c of a){let d=c.groups?.category??"",u=c.groups?.items??"",p=d.trim().toLowerCase();if(r.has(p)){i[`parse.duplicateCategory.${p}`]=`Duplicate category "${p}" was defined more than once. Merge them into a single entry.`;continue}let h=u.split("|").map(g=>g.replace(/\s+/g," ").trim()).filter(Boolean);if(h.length===0){i[`parse.emptyCategory.${p}`]=`Category "${p}" has no items. Expected at least one item before ';'.`,t.push(p),r.set(p,[]);continue}t.push(p);for(let g of h)s.has(g)||(s.add(g),n.push(g));r.set(p,h)}let l={rows:n,cols:t,answerKey:r};return Object.keys(i).length>0?{data:l,errors:i}:{data:l}}function ll(e){let n={},t=[],r=new Map,i=/^\s*(?<category>[a-z_](?:[a-z0-9_]* ?[a-z0-9_]+)*)\s*=\s*(?<values>[^;]+?)\s*;/gim,o=[...e.matchAll(i)];if(o.length===0)return n["parse.noMatches"]="No valid category entries found. Expected lines like: category = val1 | val2;",{data:{rows:[],cols:[],answerKey:{}},errors:n};let a=new Set;for(let d of o){let u=d.groups?.category??"",p=d.groups?.values??"",h=u.trim().toLowerCase();if(a.has(h)){n[`parse.duplicateCategory.${h}`]=`Duplicate category "${h}" was defined more than once.`;continue}a.add(h);let g=p.split("|").map(m=>m.trim()).filter(Boolean);t.push(h),r.set(h,g)}let s=t.length;for(let d of t){let u=r.get(d)??[],p=s-1;u.length!==p&&(n[`parse.valueCount.${d}`]=`Category "${d}" has ${u.length} values, but expected ${p} (n-1 where n=${s}).`)}let l={};for(let d=0;d<t.length;d++){let u=t[d],p=r.get(u)??[];l[u]={};let h=0;for(let g=0;g<t.length;g++){if(d===g)continue;let m=t[g],b=p[h],w=null;if(b!==void 0&&b!==""){let v=Number(b);w=isNaN(v)?b:v}l[u][m]=w,h++}}let c={rows:t,cols:t,answerKey:l};return Object.keys(n).length>0?{data:c,errors:n}:{data:c}}function cl(e){let n={},t=[],r=[],i={},o=/^\s*=\s*(?<cols>[^;]+?)\s*;/m,a=e.match(o);if(!a)return n["parse.noHeader"]="Missing header line. Expected first line like: = col1 | col2 | col3;",{data:{rows:[],cols:[],answerKey:{}},errors:n};if(t=(a.groups?.cols??"").split("|").map(p=>p.trim()).filter(Boolean),t.length===0)return n["parse.emptyHeader"]='Header line has no columns. Expected at least one column after "=".',{data:{rows:[],cols:[],answerKey:{}},errors:n};let l=/^\s*(?<row>[^=]+?)\s*=\s*(?<values>[^;]+?)\s*;/gm,c=[...e.matchAll(l)],d=new Set;for(let p of c){let h=p.groups?.row??"",g=p.groups?.values??"";if(h.trim()==="")continue;let m=h.trim();if(d.has(m)){n[`parse.duplicateRow.${m}`]=`Duplicate row "${m}" was defined more than once.`;continue}d.add(m);let b=g.split("|").map(w=>w.trim()).filter(w=>w!=="");if(b.length!==t.length){n[`parse.valueCount.${m}`]=`Row "${m}" has ${b.length} values, but expected ${t.length} (matching column count).`;continue}r.push(m),i[m]={};for(let w=0;w<t.length;w++){let v=t[w],q=b[w];if(q==="-"){i[m][v]=null;continue}let K=null;if(q!==void 0&&q!==""){let Ct=Number(q);K=isNaN(Ct)?q:Ct}i[m][v]=K}}r.length===0&&(n["parse.noRows"]="No data rows found. Expected at least one line like: row = val1 | val2;");let u={rows:r,cols:t,answerKey:i};return Object.keys(n).length>0?{data:u,errors:n}:{data:u}}function ul(e,n="classification"){let t={},r=e.answerKey;e.cols.length===0&&(t["cols.empty"]="No categories were found. Expected at least one CATEGORY = ... ; entry."),e.rows.length===0&&(t["rows.empty"]="No row items were found. Expected at least one item in any category.");for(let i of e.cols)e.rows.includes(i)&&(t[`cols.rowConflict.${i}`]=`Category "${i}" is also present as an item. Category labels cannot be used as row items.`);for(let i of e.cols){let o=r.get(i);if(!o){t[`answerKey.missing.${i}`]=`Category "${i}" has no entry in answerKey. This usually indicates a parser issue.`;continue}o.length===0&&(t[`answerKey.emptyCategory.${i}`]=`Category "${i}" has no items. Each category must include at least one item.`)}for(let[i,o]of r.entries()){let a=new Set;for(let s of o){if(a.has(s)){t[`answerKey.duplicateItem.${i}`]=`Category "${i}" includes duplicate item "${s}". Remove duplicates.`;break}a.add(s)}}if(n==="n-ary"){let i=new Map;for(let[o,a]of r.entries())for(let s of a){let l=i.get(s);l?l.push(o):i.set(s,[o])}for(let o of e.rows){let a=i.get(o)??[];if(a.length===0){t[`nary.unassigned.${o}`]=`Item "${o}" is not assigned to any category. In n-ary tables, every item must belong to exactly one category.`;continue}a.length>1&&(t[`nary.multiCategory.${o}`]=`Item "${o}" appears in multiple categories (${a.join(", ")}). In n-ary tables, items must belong to exactly one category.`)}}return Object.keys(t).length>0?{ok:!1,errors:t}:{ok:!0}}function pl(e){let n={};if(e.rows.length===0&&(n["rows.empty"]="No rows found. Expected at least one category."),e.cols.length===0&&(n["cols.empty"]="No columns found. Expected at least one category."),e.rows.length!==e.cols.length)n["symmetry.lengthMismatch"]=`Rows (${e.rows.length}) and columns (${e.cols.length}) must have the same length for adjacency tables.`;else{let t=new Set(e.rows),r=new Set(e.cols);for(let i of e.rows)r.has(i)||(n[`symmetry.rowNotInCols.${i}`]=`Row "${i}" does not appear in columns. Adjacency tables must be symmetric.`);for(let i of e.cols)t.has(i)||(n[`symmetry.colNotInRows.${i}`]=`Column "${i}" does not appear in rows. Adjacency tables must be symmetric.`)}for(let t of e.rows){if(!e.answerKey[t]){n[`answerKey.missingRow.${t}`]=`Row "${t}" has no entry in answer key.`;continue}for(let r of e.cols)if(t===r){let i=e.answerKey[t][r];i!=null&&(n[`answerKey.diagonalValue.${t}`]=`Diagonal cell (${t}, ${t}) should be empty, but has value "${i}".`)}else e.answerKey[t][r]===void 0&&(n[`answerKey.missingCell.${t}.${r}`]=`Missing value at cell (${t}, ${r}). All non-diagonal cells must have values.`)}return Object.keys(n).length>0?{ok:!1,errors:n}:{ok:!0}}function hl(e){let n={};e.cols.length===0&&(n["cols.empty"]="No columns found. Expected at least one column in header line."),e.rows.length===0&&(n["rows.empty"]="No rows found. Expected at least one data row.");let t=new Set(e.cols);for(let r of e.rows)t.has(r)&&(n[`naming.rowColConflict.${r}`]=`Row name "${r}" is also a column name. This creates ambiguity and should be avoided.`);for(let r of e.rows){if(!e.answerKey[r]){n[`answerKey.missingRow.${r}`]=`Row "${r}" has no entry in answer key.`;continue}for(let i of e.cols)e.answerKey[r][i]===void 0&&(n[`answerKey.missingCell.${r}.${i}`]=`Missing value at cell (${r}, ${i}). Cells must have values or be marked as disabled with '-'.`)}return Object.keys(n).length>0?{ok:!1,errors:n}:{ok:!0}}function Se(e){let n=[];for(let t of Object.values(e))for(let r of Object.values(t))r!==null&&n.push(r);return n}function Ke(e){let n=Se(e);return Array.from(new Set(n))}function We(e){let n=new Set(e.filter(t=>t!==null));return e.every(t=>t===null||typeof t=="number")?"number":n.size>0&&n.size<=10?"select":"text"}function Te(e,n){return e===null||n===null?!1:typeof e=="number"&&typeof n=="number"?Math.abs(e-n)<1e-4:String(e).trim()===String(n).trim()}function Nr(e,n,t){let r=0,i=t.length;for(let a of t){let s=n[a]?.selectedCols??[],l=null;for(let[c,d]of e.entries())if(d.includes(a)){l=c;break}s.length===1&&s[0]===l&&r++}return{score:i>0?Math.round(r/i*100):0,correct:r,total:i}}function Gr(e,n,t,r){let i=0,o=0;for(let s of t)for(let l of r){let c=e[s]?.[l];if(c===null)continue;let d=n[s]?.values[l];o++,Te(c,d)&&i++}return{score:o>0?Math.round(i/o*100):0,correct:i,total:o}}function Or(e,n,t,r){let i=0,o=0;for(let s of t){let l=new Set(n[s]?.selectedCols??[]),c=new Set;for(let[d,u]of e.entries())u.includes(s)&&c.add(d);for(let d of r){let u=c.has(d),p=l.has(d);u===p&&i++,o++}}return{score:o>0?Math.round(i/o*100):0,correct:i,total:o}}function Vr(e,n,t){let r=0,i=0;for(let a of t)for(let s of t){if(a===s)continue;let l=e[a]?.[s],c=n[a]?.values[s];i++,Te(l,c)&&r++}return{score:i>0?Math.round(r/i*100):0,correct:r,total:i}}function Fr(e,n,t){let r={};for(let i of t){r[i]={};for(let o of t){if(i===o)continue;let a=e[i]?.[o],s=n[i]?.values[o];s==null||s===""?r[i][o]="missed":Te(a,s)?r[i][o]="correct":r[i][o]="wrong"}}return r}function jr(e,n,t,r){let i={};for(let o of t){i[o]={};for(let a of r){let s=e[o]?.[a];if(s===null)continue;let l=n[o]?.values[a];l==null||l===""?i[o][a]="missed":Te(s,l)?i[o][a]="correct":i[o][a]="wrong"}}return i}function Ur(e,n,t,r){let i={};for(let o of t){i[o]={};let a=new Set(n[o]?.selectedCols??[]),s=new Set;for(let[l,c]of e.entries())c.includes(o)&&s.add(l);for(let l of r){let c=s.has(l),d=a.has(l);c===d?i[o][l]="correct":!d&&c?i[o][l]="missed":i[o][l]="wrong"}}return i}function Yr(e,n,t){let r={};for(let i of t){r[i]={};let o=n[i]?.selectedCols??[],a=null;for(let[s,l]of e.entries())if(l.includes(i)){a=s;break}if(o.length===1){let s=o[0];s===a?r[i][s]="correct":r[i][s]="wrong"}else o.length===0&&a&&(r[i][a]="missed")}return r}var Kr=`/* ===========================================
|
|
1951
1951
|
BASE TABLE STYLES
|
|
1952
1952
|
=========================================== */
|
|
1953
1953
|
|
|
@@ -2490,19 +2490,19 @@ input[type="radio"] {
|
|
|
2490
2490
|
min-width: clamp(48px, 10cqw, 60px);
|
|
2491
2491
|
}
|
|
2492
2492
|
}
|
|
2493
|
-
`;function ie(e){return
|
|
2493
|
+
`;function ie(e){return E(e)}var Qe=class extends HTMLElement{constructor(){super();this._state={};this._mounted=!1;this.onChange=t=>{let r=t.target,i=r.getAttribute?.("data-r"),o=r.getAttribute?.("data-c");if(!i||!o||!this._config)return;let a=this._config.cellKind,s=null;r instanceof HTMLInputElement&&(a==="checkbox"||a==="radio"?s=r.checked:a==="text"?s=r.value:a==="number"&&(s=r.value===""?null:Number(r.value))),r instanceof HTMLSelectElement&&(s=r.value===""?null:r.value),this.applyCellValue(i,o,s),this.emitChange(i,o,s)};this.onInput=t=>{};this.attachShadow({mode:"open"});let t=document.createElement("section");t.className="wrap",this.shadowRoot.append(t),this.$wrapEl=t}static get observedAttributes(){return["variant"]}connectedCallback(){this._mounted=!0,this.shadowRoot?.addEventListener("change",this.onChange),this.shadowRoot?.addEventListener("input",this.onInput),this.render()}disconnectedCallback(){this._mounted=!1}set config(t){this._config=t,this._state=this.initState(t),t.variant&&this.setAttribute("variant",t.variant),this.render()}get config(){if(!this._config)throw new Error("<edu-table>: spec not set");return this._config}get value(){return this._state}set value(t){this._state=t,this.render()}getValue(){return this._state}setValue(t){this._state=t,this.render()}getState(){let t=this._config;if(!t)return{};let r={};for(let i of t.rows){let o=this._state[i]??{},a=[];for(let s of t.cols){let l=o[s]??null;(t.cellKind==="checkbox"||t.cellKind==="radio")&&l===!0&&a.push(s)}r[i]={selectedCols:a,values:{...o}}}return r}attributeChangedCallback(t,r,i){r!==i&&t==="variant"&&(this.setAttribute("variant",i),this.$wrapEl.querySelectorAll("edu-input").forEach(o=>{o.setAttribute("variant",i)}))}initState(t){let r={};for(let i of t.rows){r[i]={};for(let o of t.cols)switch(t.cellKind){case"checkbox":case"radio":r[i][o]=!1;break;case"select":case"text":case"number":r[i][o]=null;break}}return r}render(){if(!this._mounted||!this.shadowRoot)return;if(!this._config){this.$wrapEl.innerHTML="<style>:host{display:block}</style><div></div>";return}let t=this._config,r=t.shuffle?T(t.cols):t.cols,i=`
|
|
2494
2494
|
<tr>
|
|
2495
2495
|
<th></th>
|
|
2496
|
-
${r.map(s=>`<th scope="col">${
|
|
2496
|
+
${r.map(s=>`<th scope="col">${E(s)}</th>`).join("")}
|
|
2497
2497
|
</tr>
|
|
2498
|
-
`,a=(t.shuffle?T(t.rows):t.rows).map(s=>{let l=r.map(c=>this.renderCell(t,s,c)).join("");return`<tr><th scope="row">${
|
|
2498
|
+
`,a=(t.shuffle?T(t.rows):t.rows).map(s=>{let l=r.map(c=>this.renderCell(t,s,c)).join("");return`<tr><th scope="row">${E(s)}</th>${l}</tr>`}).join("");this.$wrapEl.innerHTML=`
|
|
2499
2499
|
<style>${Kr}</style>
|
|
2500
2500
|
<table part="table">
|
|
2501
2501
|
<thead>${i}</thead>
|
|
2502
2502
|
<tbody>${a}</tbody>
|
|
2503
2503
|
</table>
|
|
2504
2504
|
`}renderCell(t,r,i){if(t.disabled?.(r,i)??!1)return'<td aria-disabled="true" class="disabled-cell"></td>';let a=`cell-${P(r)}-${P(i)}`,s=this._state[r]?.[i]??null,l=t.gradingState?.[r]?.[i],c=l?`cell-${l}`:"",d=p=>`<td class="${c}">${p}</td>`,u=`id="${a}" data-r="${ie(r)}" data-c="${ie(i)}"
|
|
2505
|
-
aria-label="${ie(`${r} / ${i}`)}" variant="${this.getAttribute("variant")}" `;switch(t.cellKind){case"checkbox":return d(`<input ${u} type="checkbox" ${s===!0?"checked":""}/>`);case"radio":{let p=s===!0?"checked":"";return d(`<input ${u} type="radio" name="row-${P(r)}" ${p}/>`)}case"text":{let p=s==null?"":String(s);return d(`<edu-input ${u} type="text" value="${ie(p)}"/>`)}case"number":{let p=s==null?"":String(s);return d(`<edu-input ${u} type="number" value="${ie(p)}"/>`)}case"select":{let p=t.allowed?.(r,i)??[],h=s==null?"":String(s),g=['<option value=""></option>',...p.map(m=>{let b=String(m),w=b===h?"selected":"";return`<option value="${ie(b)}" ${w}>${
|
|
2505
|
+
aria-label="${ie(`${r} / ${i}`)}" variant="${this.getAttribute("variant")}" `;switch(t.cellKind){case"checkbox":return d(`<input ${u} type="checkbox" ${s===!0?"checked":""}/>`);case"radio":{let p=s===!0?"checked":"";return d(`<input ${u} type="radio" name="row-${P(r)}" ${p}/>`)}case"text":{let p=s==null?"":String(s);return d(`<edu-input ${u} type="text" value="${ie(p)}"/>`)}case"number":{let p=s==null?"":String(s);return d(`<edu-input ${u} type="number" value="${ie(p)}"/>`)}case"select":{let p=t.allowed?.(r,i)??[],h=s==null?"":String(s),g=['<option value=""></option>',...p.map(m=>{let b=String(m),w=b===h?"selected":"";return`<option value="${ie(b)}" ${w}>${E(b)}</option>`})].join("");return d(`<edu-input as="select" ${u}>${g}</select>`)}}}reset(){this._config&&(this._state=this.initState(this._config),this.render(),this.dispatchEvent(new CustomEvent("reset",{bubbles:!0,composed:!0})))}setGradingState(t){this._config&&(this._config.gradingState=t,this.render())}clearGradingState(){this._config&&(this._config.gradingState=void 0,this.render())}applyCellValue(t,r,i){let o=this._config;if(o&&!o.disabled?.(t,r)){if(o.cellKind==="select"){let a=o.allowed?.(t,r);if(a&&i!==null&&!a.some(s=>String(s)===String(i)))return}if(this._state[t]??={},this._config.cellKind==="radio"&&i===!0){for(let a of this._config.cols)this._state[t][a]=!1;this._state[t][r]=!0;return}this._state[t][r]=i}}emitChange(t,r,i){let o={row:t,col:r,value:i,state:this.getValue(),selection:this.getState()};this.dispatchEvent(new CustomEvent("change",{detail:o,bubbles:!0,composed:!0}))}};customElements.get("edu-table")||customElements.define("edu-table",Qe);var $e=class extends x{constructor(t,r){super(t,r);this.interactionMechanic="static";let i=Se(t.answerKey),o=We(i);this._tableConfig={rows:t.rows,cols:t.cols,answerKey:t.answerKey,cellKind:o,preset:"lookup",disabled:(s,l)=>t.answerKey[s]?.[l]===null,allowed:o==="select"?()=>Ke(t.answerKey):void 0,variant:r.variant??"outline",shuffle:r.shuffle??!1};let a=0;for(let s of t.rows)for(let l of t.cols)t.answerKey[s]?.[l]!==null&&a++;this.initializeProgress(a)}initialize(){}cleanup(){}onVariantChange(t){this._tableConfig.variant=t,this._$table&&this._$table.setAttribute("variant",t)}render(){this._tableConfig.variant=this.config.variant,this._$table=document.createElement("edu-table"),this._$table.config=this._tableConfig,this._$table.addEventListener("change",()=>{this.updateProgressBasedOnCompletion(),this.emitStateChange()}),this.innerHTML=`
|
|
2506
2506
|
<style>
|
|
2507
2507
|
:host {
|
|
2508
2508
|
display: flex;
|
|
@@ -3234,19 +3234,19 @@ slot {
|
|
|
3234
3234
|
<div class="text-content" part="content">
|
|
3235
3235
|
${i}
|
|
3236
3236
|
</div>
|
|
3237
|
-
`}renderHighlight(t){let r=t.parts,i=this._state.selectedIndices??new Set,o=this._config.gradingState??{};return r.map((a,s)=>{let l=i.has(s),c=o[s],d=["word","word-selectable"];return l&&d.push("word-selected"),c&&d.push(`word-${c}`),`<span class="${d.join(" ")}" data-index="${s}">${
|
|
3237
|
+
`}renderHighlight(t){let r=t.parts,i=this._state.selectedIndices??new Set,o=this._config.gradingState??{};return r.map((a,s)=>{let l=i.has(s),c=o[s],d=["word","word-selectable"];return l&&d.push("word-selected"),c&&d.push(`word-${c}`),`<span class="${d.join(" ")}" data-index="${s}">${E(a)}</span>`}).join(" ")}renderBlanks(t){let r=this._config.gradingState??{},i=this.getAttribute("variant")??this._config.variant??"outline";return t.parts.map((o,a)=>{if(o.startsWith("<")){let s=t.targets.find(l=>l.expectedValue.html===o);if(s){let l=r[s.id],c=l?`input-${l}`:"",d=this._state.inputValues?.[s.id]??"",u=o;if(/<edu-input\b/i.test(u)&&(u=this.upsertHtmlAttribute(u,"variant",i)),u=this.removeHtmlClassPrefix(u,"input-"),u=this.removeHtmlAttribute(u,"state"),l&&(/<edu-input\b/i.test(u)?u=this.upsertHtmlAttribute(u,"state",l):c&&(u=this.upsertHtmlClass(u,c))),d!==""){let p=E(String(d));u.includes("<edu-input")?/value="[^"]*"/.test(u)?u=u.replace(/value="[^"]*"/,`value="${p}"`):u=u.replace("<edu-input",`<edu-input value="${p}"`):u.includes("<input")&&(/value="[^"]*"/.test(u)?u=u.replace(/value="[^"]*"/,`value="${p}"`):u=u.replace("<input",`<input value="${p}"`))}return u}return o}else return`<span class="word">${E(o)}</span>`}).join(" ")}renderClassification(t){let r=t.parts,i=this._state.wordCategories??{},o=this._config.gradingState??{},a=this.getAttribute("variant")??"outline",s=t.targets.map(p=>p.category),l={},c=["--edu-first-accent","--edu-second-accent","--edu-third-accent","--edu-neutral"];s.forEach((p,h)=>{l[p]=c[h%c.length]});let d=r.map((p,h)=>{let g=i[h],m=o[h],b=["word","word-classifiable"];g&&b.push("word-assigned"),m&&b.push(`word-${m}`);let w=g?`style="--category-color: var(${l[g]})"`:"";return`
|
|
3238
3238
|
<span class="${b.join(" ")}" data-index="${h}" ${w}>
|
|
3239
|
-
${
|
|
3239
|
+
${E(p)}
|
|
3240
3240
|
</span>
|
|
3241
3241
|
`}).join(" "),u=`
|
|
3242
3242
|
<div class="categories" part="categories">
|
|
3243
3243
|
${s.map(p=>`
|
|
3244
3244
|
<edu-block class="category-btn"
|
|
3245
3245
|
${this._activeCategory===p?'data-active="true"':""}
|
|
3246
|
-
data-category="${
|
|
3247
|
-
variant="${
|
|
3246
|
+
data-category="${E(p)}"
|
|
3247
|
+
variant="${E(a)}"
|
|
3248
3248
|
style="--category-color: var(${l[p]})">
|
|
3249
|
-
${
|
|
3249
|
+
${E(p)}
|
|
3250
3250
|
</edu-block>
|
|
3251
3251
|
`).join("")}
|
|
3252
3252
|
</div>
|
|
@@ -3255,7 +3255,7 @@ slot {
|
|
|
3255
3255
|
<div class="words" part="words">${d}</div>
|
|
3256
3256
|
${u}
|
|
3257
3257
|
</div>
|
|
3258
|
-
`}renderDND(t){let r=t.parts,i=this._state.dndPlacements??{},o=this._config.gradingState??{},a=new Set;for(let h of t.targets)for(let g=h.startPos;g<=h.endPos;g++)a.add(g);let s=r.map((h,g)=>{if(a.has(g)){let m=i[g],b=!!m,w=o[g],v=["dropzone"];b&&v.push("dropzone-filled"),w&&v.push(`dropzone-${w}`);let q=b?
|
|
3258
|
+
`}renderDND(t){let r=t.parts,i=this._state.dndPlacements??{},o=this._config.gradingState??{},a=new Set;for(let h of t.targets)for(let g=h.startPos;g<=h.endPos;g++)a.add(g);let s=r.map((h,g)=>{if(a.has(g)){let m=i[g],b=!!m,w=o[g],v=["dropzone"];b&&v.push("dropzone-filled"),w&&v.push(`dropzone-${w}`);let q=b?E(m):"";return`<span class="${v.join(" ")}" data-index="${g}">${q}</span>`}else return`<span class="word">${E(h)}</span>`}).join(" "),l=[...t.targets.flatMap(h=>h.words)];t.distractors&&l.push(...t.distractors);let c=Object.values(i),d=[...l];for(let h of c){let g=d.findIndex(m=>pi(m)===pi(h));g!==-1&&d.splice(g,1)}let p=T(d).map(h=>`<div class="chip" draggable="true" data-word="${E(h)}">${E(h)}</div>`).join("");return`
|
|
3259
3259
|
<div class="dnd-container">
|
|
3260
3260
|
<div class="dnd-text">${s}</div>
|
|
3261
3261
|
<div class="dnd-chips">${p}</div>
|
|
@@ -3264,8 +3264,8 @@ slot {
|
|
|
3264
3264
|
<span class="${h.join(" ")}"
|
|
3265
3265
|
contenteditable="true"
|
|
3266
3266
|
data-target-index="${c}"
|
|
3267
|
-
data-original="${
|
|
3268
|
-
`}else return`<span class="word">${
|
|
3267
|
+
data-original="${E(s)}">${E(p)}</span>
|
|
3268
|
+
`}else return`<span class="word">${E(s)}</span>`}).join(" ")}toggleWordSelection(t){this._state.selectedIndices||(this._state.selectedIndices=new Set),this._state.selectedIndices.has(t)?this._state.selectedIndices.delete(t):this._state.selectedIndices.add(t),this.render(),this.emitChange()}setActiveCategory(t){this._activeCategory=t,this.shadowRoot?.querySelectorAll(".category-btn").forEach(r=>{r.getAttribute("data-category")===t?(r.classList.add("category-active"),r.setAttribute("data-active","true")):(r.classList.remove("category-active"),r.removeAttribute("data-active")),r instanceof V&&(r.variant=this.getAttribute("variant")??"outline")})}assignWordToCategory(t,r){this._state.wordCategories||(this._state.wordCategories={}),this._state.wordCategories[t]===r?delete this._state.wordCategories[t]:this._state.wordCategories[t]=r,this.render(),this.emitChange()}updateInputValue(t,r){this._state.inputValues||(this._state.inputValues={}),this._state.inputValues[t]=r,this.emitChange()}updateTransformation(t,r){this._state.transformations||(this._state.transformations={});let i=r.split(/\s+/).filter(Boolean);this._state.transformations[t]=i,this.emitChange()}placeWordInDropzone(t,r){this._state.dndPlacements||(this._state.dndPlacements={}),this._state.dndPlacements[t]=r,this.render(),this.emitChange()}clearDropzone(t){this._state.dndPlacements&&t in this._state.dndPlacements&&(delete this._state.dndPlacements[t],this.render(),this.emitChange())}emitChange(){let t={userState:this.getValue(),dataType:this._config.data.type};this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0}))}};function pi(e){return e.trim().toLowerCase()}customElements.get("edu-text")||customElements.define("edu-text",Je);var ne=class extends x{constructor(t,r){super(t,r);this.interactionMechanic="static";this._textConfig={data:t,mode:"highlight",variant:r.variant??"outline"},this.implementsProgress=!1}initialize(){}cleanup(){}onVariantChange(t){this.config.variant=t,this._textConfig.variant=t,this._$text&&this._$text.setAttribute("variant",t)}render(){this._textConfig.variant=this.config.variant,this._$text=document.createElement("edu-text"),this._$text.config=this._textConfig,this._$text.addEventListener("change",()=>{this.emitStateChange()}),this.innerHTML=`
|
|
3269
3269
|
<style>
|
|
3270
3270
|
mark-the-words {
|
|
3271
3271
|
display: flex;
|
|
@@ -3724,8 +3724,14 @@ slot {
|
|
|
3724
3724
|
<div class="container">
|
|
3725
3725
|
<div class="rows-container"></div>
|
|
3726
3726
|
</div>
|
|
3727
|
-
`,this.$container=this.querySelector(".container"),this.$rowsContainer=this.querySelector(".rows-container"),this.renderRows()}renderRows(){this.$rowsContainer.innerHTML="",this.currentOrder.forEach((t,r)=>{let i=document.createElement("div");i.className="row",i.dataset.index=String(r);let o=document.createElement("div");o.className="chip-wrapper";let a=document.createElement("edu-chip");a.variant=this.variant,a.dataset.item=t,a.prefix=String(r+1),a.draggable=!0,D(t,a,this.assets?.assetsById),this.isGraded&&(this.data.items.indexOf(t)===r?a.chipState="correct":a.chipState="wrong"),o.appendChild(a);let s=document.createElement("div");s.className="controls";let l=this.createButton("up",r);s.appendChild(l),i.appendChild(o),i.appendChild(s),this.isGraded||i.addEventListener("pointerdown",c=>this.handlePointerDown(c,r)),this.$rowsContainer.appendChild(i)})}createButton(t,r){let i=document.createElement("button");i.className="btn",i.dataset.direction=t,i.dataset.index=String(r),i.setAttribute("aria-label",t==="up"?"Move up":"Move down"),t==="up"&&r===0&&(i.disabled=!0),t==="down"&&r===this.currentOrder.length-1&&(i.disabled=!0),this.isGraded&&(i.disabled=!0);let o=t==="up"?B("up"):B("down");return i.innerHTML=o,i.addEventListener("click",()=>{t==="up"&&r>0?this.swapItems(r,r-1):t==="down"&&r<this.currentOrder.length-1&&this.swapItems(r,r+1)}),i}swapItems(t,r){let i=this.currentOrder[t];this.currentOrder[t]=this.currentOrder[r],this.currentOrder[r]=i,this.renderRows(),this.emitStateChange()}handlePointerDown(t,r){if(t.target.closest(".btn, .controls"))return;t.preventDefault(),t.stopPropagation(),this.isDragging=!0,this.draggedRow=t.currentTarget,this.draggedRowIndex=r;let i=this.draggedRow.getBoundingClientRect();this.dragOffsetY=t.clientY-i.top;try{this.draggedRow.setPointerCapture(t.pointerId)}catch(o){console.warn("Failed to capture pointer:",o)}this.draggedRow.classList.add("dragging"),this.$rowsContainer.style.userSelect="none"}handlePointerMove(t){if(!this.isDragging||!this.draggedRow)return;let r=this.getRowIndexAtY(t.clientY);if(this.$rowsContainer.querySelectorAll(".row").forEach(i=>{i.classList.remove("drag-over")}),r!==-1&&r!==this.draggedRowIndex){let i=Array.from(this.$rowsContainer.children);i[r]&&i[r].classList.add("drag-over")}}handlePointerUp(t){if(!this.isDragging||!this.draggedRow)return;try{this.draggedRow.releasePointerCapture(t.pointerId)}catch{}let r=this.getRowIndexAtY(t.clientY);r!==-1&&r!==this.draggedRowIndex&&this.swapItems(this.draggedRowIndex,r),this.$rowsContainer.querySelectorAll(".row").forEach(i=>{i.classList.remove("dragging","drag-over")}),this.$rowsContainer.style.userSelect="",this.isDragging=!1,this.draggedRow=null,this.draggedRowIndex=null,this.dragOverRowIndex=null}getRowIndexAtY(t){let r=Array.from(this.$rowsContainer.children);for(let i=0;i<r.length;i++){let o=r[i].getBoundingClientRect();if(t>=o.top&&t<=o.bottom)return i}return-1}getCurrentState(){return{currentOrder:[...this.currentOrder],correctOrder:[...this.data.items]}}isInteractionComplete(){return!0}onHint(){let t=0;this.currentOrder.forEach((r,i)=>{this.data.items[i]===r&&t++}),t===this.currentOrder.length?(alert('All items are in the correct order! Click "Check" to submit.'),this.emitHintShown("All items correctly ordered")):(alert(`Hint: ${t} out of ${this.currentOrder.length} items are in the correct position. Keep reordering!`),this.emitHintShown(`${t}/${this.currentOrder.length} correct`))}submit(){super.submit();let t=yt(this.data.items,this.currentOrder,this);console.log(`Rank Order Score: ${t.score.toFixed(1)}% (${t.correct}/${t.total} correct)`),this.isGraded=!0,this.renderRows(),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0})),this.setAttribute("inert","")}reset(){super.reset(),this.config.shuffle?this.currentOrder=T([...this.data.items]):this.currentOrder=[...this.data.items],this.isGraded=!1,this.renderRows()}};customElements.get("rank-order")||customElements.define("rank-order",pe);var hi=!1,xa=()=>{hi||(hi=!0,k({id:"open-classification",label:"Open Classification",elementTag:"open-classification",cognitiveOp:"classification",mechanic:"static",engine:"direct",ctor:
|
|
3727
|
+
`,this.$container=this.querySelector(".container"),this.$rowsContainer=this.querySelector(".rows-container"),this.renderRows()}renderRows(){this.$rowsContainer.innerHTML="",this.currentOrder.forEach((t,r)=>{let i=document.createElement("div");i.className="row",i.dataset.index=String(r);let o=document.createElement("div");o.className="chip-wrapper";let a=document.createElement("edu-chip");a.variant=this.variant,a.dataset.item=t,a.prefix=String(r+1),a.draggable=!0,D(t,a,this.assets?.assetsById),this.isGraded&&(this.data.items.indexOf(t)===r?a.chipState="correct":a.chipState="wrong"),o.appendChild(a);let s=document.createElement("div");s.className="controls";let l=this.createButton("up",r);s.appendChild(l),i.appendChild(o),i.appendChild(s),this.isGraded||i.addEventListener("pointerdown",c=>this.handlePointerDown(c,r)),this.$rowsContainer.appendChild(i)})}createButton(t,r){let i=document.createElement("button");i.className="btn",i.dataset.direction=t,i.dataset.index=String(r),i.setAttribute("aria-label",t==="up"?"Move up":"Move down"),t==="up"&&r===0&&(i.disabled=!0),t==="down"&&r===this.currentOrder.length-1&&(i.disabled=!0),this.isGraded&&(i.disabled=!0);let o=t==="up"?B("up"):B("down");return i.innerHTML=o,i.addEventListener("click",()=>{t==="up"&&r>0?this.swapItems(r,r-1):t==="down"&&r<this.currentOrder.length-1&&this.swapItems(r,r+1)}),i}swapItems(t,r){let i=this.currentOrder[t];this.currentOrder[t]=this.currentOrder[r],this.currentOrder[r]=i,this.renderRows(),this.emitStateChange()}handlePointerDown(t,r){if(t.target.closest(".btn, .controls"))return;t.preventDefault(),t.stopPropagation(),this.isDragging=!0,this.draggedRow=t.currentTarget,this.draggedRowIndex=r;let i=this.draggedRow.getBoundingClientRect();this.dragOffsetY=t.clientY-i.top;try{this.draggedRow.setPointerCapture(t.pointerId)}catch(o){console.warn("Failed to capture pointer:",o)}this.draggedRow.classList.add("dragging"),this.$rowsContainer.style.userSelect="none"}handlePointerMove(t){if(!this.isDragging||!this.draggedRow)return;let r=this.getRowIndexAtY(t.clientY);if(this.$rowsContainer.querySelectorAll(".row").forEach(i=>{i.classList.remove("drag-over")}),r!==-1&&r!==this.draggedRowIndex){let i=Array.from(this.$rowsContainer.children);i[r]&&i[r].classList.add("drag-over")}}handlePointerUp(t){if(!this.isDragging||!this.draggedRow)return;try{this.draggedRow.releasePointerCapture(t.pointerId)}catch{}let r=this.getRowIndexAtY(t.clientY);r!==-1&&r!==this.draggedRowIndex&&this.swapItems(this.draggedRowIndex,r),this.$rowsContainer.querySelectorAll(".row").forEach(i=>{i.classList.remove("dragging","drag-over")}),this.$rowsContainer.style.userSelect="",this.isDragging=!1,this.draggedRow=null,this.draggedRowIndex=null,this.dragOverRowIndex=null}getRowIndexAtY(t){let r=Array.from(this.$rowsContainer.children);for(let i=0;i<r.length;i++){let o=r[i].getBoundingClientRect();if(t>=o.top&&t<=o.bottom)return i}return-1}getCurrentState(){return{currentOrder:[...this.currentOrder],correctOrder:[...this.data.items]}}isInteractionComplete(){return!0}onHint(){let t=0;this.currentOrder.forEach((r,i)=>{this.data.items[i]===r&&t++}),t===this.currentOrder.length?(alert('All items are in the correct order! Click "Check" to submit.'),this.emitHintShown("All items correctly ordered")):(alert(`Hint: ${t} out of ${this.currentOrder.length} items are in the correct position. Keep reordering!`),this.emitHintShown(`${t}/${this.currentOrder.length} correct`))}submit(){super.submit();let t=yt(this.data.items,this.currentOrder,this);console.log(`Rank Order Score: ${t.score.toFixed(1)}% (${t.correct}/${t.total} correct)`),this.isGraded=!0,this.renderRows(),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0})),this.setAttribute("inert","")}reset(){super.reset(),this.config.shuffle?this.currentOrder=T([...this.data.items]):this.currentOrder=[...this.data.items],this.isGraded=!1,this.renderRows()}};customElements.get("rank-order")||customElements.define("rank-order",pe);var hi=!1,xa=()=>{hi||(hi=!0,k({id:"open-classification",label:"Open Classification",elementTag:"open-classification",cognitiveOp:"classification",mechanic:"static",engine:"direct",ctor:Ce,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!0,hasParser:!0,hasValidator:!0,hasGrader:!0}}),k({id:"sequential-classification",label:"Sequential Classification",elementTag:"sequential-classification",cognitiveOp:"classification",mechanic:"automatic-sequencing",engine:"direct",ctor:Ee,capabilities:{isSequential:!0,implementsProgress:!0,usesAssets:!0,hasParser:!0,hasValidator:!0,hasGrader:!0}}),k({id:"mcq",label:"Multiple Choice / Multiple Response",elementTag:"mcq-interaction",cognitiveOp:"recognition",mechanic:"sequential",engine:"direct",ctor:te,capabilities:{isSequential:!0,implementsProgress:!0,usesAssets:!0,hasParser:!0,hasValidator:!0,hasGrader:!0}}),k({id:"simultaneous-association",label:"Simultaneous Association",elementTag:"simultaneous-association",cognitiveOp:"association",mechanic:"static",engine:"direct",ctor:ke,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!0,hasParser:!0,hasValidator:!0,hasGrader:!0}}),k({id:"list-recall",label:"List Recall",elementTag:"list-recall",cognitiveOp:"freerecall",mechanic:"static",engine:"direct",ctor:re,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!0,hasValidator:!0,hasGrader:!0}}),k({id:"lookup-table",label:"Lookup Table",elementTag:"lookup-table",cognitiveOp:"production",mechanic:"static",engine:"tables",ctor:$e,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!0,hasValidator:!0,hasGrader:!0}}),k({id:"classification-matrix",label:"Classification Matrix",elementTag:"classification-matrix",cognitiveOp:"classification",mechanic:"static",engine:"tables",ctor:Ae,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!0,hasValidator:!0,hasGrader:!0}}),k({id:"nary-choice-table",label:"N-ary Choice Table",elementTag:"nary-choice-table",cognitiveOp:"discrimination",mechanic:"static",engine:"tables",ctor:_e,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!0,hasValidator:!0,hasGrader:!0}}),k({id:"adjacency-table",label:"Adjacency Table",elementTag:"adjacency-table",cognitiveOp:"association",mechanic:"static",engine:"tables",ctor:Ie,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!0,hasValidator:!0,hasGrader:!0}}),k({id:"mark-the-words",label:"Mark The Words",elementTag:"mark-the-words",cognitiveOp:"recognition",mechanic:"static",engine:"text",ctor:ne,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),k({id:"sequential-mark-the-words",label:"Sequential Mark The Words",elementTag:"sequential-mark-the-words",cognitiveOp:"recognition",mechanic:"sequential",engine:"text",ctor:oe,capabilities:{isSequential:!0,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),k({id:"categorize-the-words",label:"Categorize The Words",elementTag:"categorize-the-words",cognitiveOp:"classification",mechanic:"static",engine:"text",ctor:ae,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),k({id:"sequential-categorize-the-words",label:"Sequential Categorize The Words",elementTag:"sequential-categorize-the-words",cognitiveOp:"classification",mechanic:"sequential",engine:"text",ctor:se,capabilities:{isSequential:!0,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),k({id:"text-transformation",label:"Text Transformation",elementTag:"text-transformation",cognitiveOp:"transformation",mechanic:"static",engine:"text",ctor:le,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),k({id:"sequential-text-transformation",label:"Sequential Text Transformation",elementTag:"sequential-text-transformation",cognitiveOp:"transformation",mechanic:"sequential",engine:"text",ctor:ce,capabilities:{isSequential:!0,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),k({id:"fill-blanks",label:"Fill Blanks",elementTag:"fill-blanks",cognitiveOp:"cuedrecall",mechanic:"static",engine:"text",ctor:de,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),k({id:"sequential-fill-blanks",label:"Sequential Fill Blanks",elementTag:"sequential-fill-blanks",cognitiveOp:"cuedrecall",mechanic:"sequential",engine:"text",ctor:ue,capabilities:{isSequential:!0,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),k({id:"rank-order",label:"Rank Order",elementTag:"rank-order",cognitiveOp:"seriation",mechanic:"static",engine:"direct",ctor:pe,capabilities:{isSequential:!1,implementsProgress:!1,usesAssets:!0,hasParser:!0,hasValidator:!0,hasGrader:!0}}))};xa();var gi=`<header part='header'>
|
|
3728
3728
|
<div class="prompt-container">
|
|
3729
|
+
<button class="close-btn btn" title="Close Fullscreen" part="close-part" style="display: none;">
|
|
3730
|
+
<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
3731
|
+
<path d="M18 6 6 18" />
|
|
3732
|
+
<path d="m6 6 12 12" />
|
|
3733
|
+
</svg>
|
|
3734
|
+
</button>
|
|
3729
3735
|
<button class="prompt-btn btn" title="See Prompt Data" part="see-prompt">
|
|
3730
3736
|
<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
3731
3737
|
<path d="M12 3c4.97 0 9 1.79 9 4s-4.03 4-9 4-9-1.79-9-4 4.03-4 9-4Z"/>
|
|
@@ -4658,12 +4664,12 @@ footer {
|
|
|
4658
4664
|
box-shadow: 0 4px 8px rgba(var(--edu-first-accent), 0.2);
|
|
4659
4665
|
}
|
|
4660
4666
|
}
|
|
4661
|
-
`;var he=class extends HTMLElement{constructor(){super();this.soundManager=new H;this.animationsManager=new L;this.timerInterval=null;this.remainingSeconds=0;this.interactionComplete=!1;this.attemptCount=0;this.attemptLimit=null;this.currentScreen="interaction";this.attachShadow({mode:"open"});let t=document.createElement("style");t.textContent=mi,this.shadowRoot.append(t);let r=document.createElement("section");r.className="wrap",r.innerHTML=gi,this.shadowRoot.append(r),L.injectKeyframes(this.shadowRoot),this.$headerEl=r.querySelector("header"),this.$footerEl=r.querySelector("footer"),this.$titleEl=r.querySelector(".title"),this.$promptBtn=r.querySelector(".prompt-btn"),this.$timerEl=r.querySelector(".timer"),this.$checkBtn=r.querySelector(".check-btn"),this.$scoresBtn=r.querySelector(".scores-btn"),this.$retryBtn=r.querySelector(".retry-btn"),this.$radioNav=r.querySelector(".radio-nav"),this.$progressContainer=r.querySelector(".progress-container"),this.$progressBar=r.querySelector(".progress-bar"),this.$progressIcon=r.querySelector(".progress-icon-wrapper"),this.$progressCounter=r.querySelector(".progress-counter"),this.$contentEl=r.querySelector('[part="content"]'),this.animationsManager.isEnabled=!0,this.$interactionScreen=r.querySelector('[data-screen="interaction"]'),this.$errorContent=r.querySelector(".error-content"),this.$attemptsMessage=r.querySelector(".attempts-message"),this.$scoreDisplay=r.querySelector(".score-display"),this.$timerDisplay=r.querySelector(".timer-display"),this.setupShellListeners()}static get observedAttributes(){return["show-header","show-footer"]}connectedCallback(){this.hasAttribute("show-header")||this.setAttribute("show-header","true"),this.hasAttribute("show-footer")||this.setAttribute("show-footer","true"),this.updateVisibility(),this.animationsManager.animate(this.$progressIcon,"heartbeat")
|
|
4667
|
+
`;var he=class extends HTMLElement{constructor(){super();this.soundManager=new H;this.animationsManager=new L;this.timerInterval=null;this.remainingSeconds=0;this.interactionComplete=!1;this.attemptCount=0;this.attemptLimit=null;this.currentScreen="interaction";this.attachShadow({mode:"open"});let t=document.createElement("style");t.textContent=mi,this.shadowRoot.append(t);let r=document.createElement("section");r.className="wrap",r.innerHTML=gi,this.shadowRoot.append(r),L.injectKeyframes(this.shadowRoot),this.$headerEl=r.querySelector("header"),this.$footerEl=r.querySelector("footer"),this.$titleEl=r.querySelector(".title"),this.$closeBtn=r.querySelector(".close-btn"),this.$promptBtn=r.querySelector(".prompt-btn"),this.$timerEl=r.querySelector(".timer"),this.$checkBtn=r.querySelector(".check-btn"),this.$scoresBtn=r.querySelector(".scores-btn"),this.$retryBtn=r.querySelector(".retry-btn"),this.$radioNav=r.querySelector(".radio-nav"),this.$progressContainer=r.querySelector(".progress-container"),this.$progressBar=r.querySelector(".progress-bar"),this.$progressIcon=r.querySelector(".progress-icon-wrapper"),this.$progressCounter=r.querySelector(".progress-counter"),this.$contentEl=r.querySelector('[part="content"]'),this.animationsManager.isEnabled=!0,this.$interactionScreen=r.querySelector('[data-screen="interaction"]'),this.$errorContent=r.querySelector(".error-content"),this.$attemptsMessage=r.querySelector(".attempts-message"),this.$scoreDisplay=r.querySelector(".score-display"),this.$timerDisplay=r.querySelector(".timer-display"),this.setupShellListeners()}static get observedAttributes(){return["show-header","show-footer"]}connectedCallback(){this.hasAttribute("show-header")||this.setAttribute("show-header","true"),this.hasAttribute("show-footer")||this.setAttribute("show-footer","true"),this.updateVisibility(),this.animationsManager.animate(this.$progressIcon,"heartbeat")}disconnectedCallback(){this.stopTimer(),this.removeInteractionListeners()}attributeChangedCallback(t,r,i){r!==i&&this.updateVisibility()}setInteraction(t){if(this.stopTimer(),!t.isValid){this.$errorContent.textContent=t.errors??"Error loading the interaction.",this.switchScreen("error");return}this.soundManager.playSound("start"),this.interaction&&(this.removeInteractionListeners(),this.$interactionScreen.innerHTML=""),this.interaction=t,this.interactionComplete=!1;let r=this.interaction.config;this.reset(),this.switchScreen("interaction");let i=r.variant??"elegant";this.setAttribute("variant",i),this.interaction.onVariantChange(i),this.$titleEl.textContent=r.prompt||"",r.promptData&&r.promptModality?(this.$titleEl.style.cursor="pointer",this.$titleEl.title="Click to view prompt details",this.$promptBtn.addEventListener("click",()=>this.openPromptDialog()),this.$titleEl.addEventListener("click",()=>this.openPromptDialog())):(this.$titleEl.style.cursor="",this.$titleEl.style.textDecoration="",this.$titleEl.title=""),r.timer!==null&&r.timer>30?(this.remainingSeconds=r.timer,this.$timerEl.classList.remove("edu-hidden"),this.updateTimerDisplay(),this.startTimer()):this.$timerEl.classList.add("edu-hidden"),this.attemptLimit=r.attemptLimit,this.attemptCount=0,this.interaction.interactionMechanic==="sequential"?(this.$radioNav.dataset.active="true",this.renderRadioNav()):this.$radioNav.dataset.active="false",this.interaction.implementsProgress?(this.$checkBtn.classList.add("edu-hidden"),this.$progressContainer.classList.remove("edu-hidden"),this.$progressCounter.textContent=`0/${this.interaction.progressTracker.total}`):(this.$progressContainer.classList.add("edu-hidden"),this.$checkBtn.classList.remove("edu-hidden")),this.setupInteractionListeners(),this.$interactionScreen.innerHTML="",this.$interactionScreen.appendChild(t)}removeInteraction(){this.interaction&&(this.removeInteractionListeners(),this.$interactionScreen.innerHTML="",this.interaction=void 0,this.interactionComplete=!1)}setCloseBtnVisible(t,r){if(!t){this.$closeBtn.style.display="none",this.$closeBtn.onclick=null;return}this.$closeBtn.style.display="block",this.$closeBtn.onclick=r}setupShellListeners(){this.$checkBtn.addEventListener("click",()=>{this.soundManager.playSound("pop");try{this.interaction.submit()}catch(t){console.error("Submit failed:",t)}}),this.$scoresBtn.addEventListener("click",()=>{this.soundManager.playSound("pop"),this.currentScreen==="score"?this.switchScreen("interaction"):this.switchScreen("score")}),this.$timerEl.addEventListener("click",()=>{this.soundManager.playSound("pop"),this.$timerDisplay.append(this.$timerEl),this.currentScreen==="time"?(this.switchScreen("interaction"),this.$headerEl.append(this.$timerEl)):this.switchScreen("time")}),this.$retryBtn.addEventListener("click",()=>this.handleRetry()),this.$radioNav.addEventListener("change",t=>{let r=t.target;if(r.type==="radio"){let i=parseInt(r.id.replace("step-",""),10);this.interaction&&this.interaction.setSteps(i),this.dispatchEvent(new CustomEvent("navigation-change",{detail:{step:i},bubbles:!0,composed:!0}))}})}setupInteractionListeners(){this.interaction.addEventListener("interaction:ready",t=>{console.log("[Shell] Interaction ready:",t.detail.id)}),this.interaction.addEventListener("interaction:progress",t=>{let{current:r,total:i,percentage:o}=t.detail;this.updateProgress(r,i),r===i&&i>0?(this.interactionComplete=!0,this.$checkBtn.classList.remove("edu-hidden")):(this.interactionComplete=!1,this.interaction.implementsProgress&&this.$checkBtn.classList.add("edu-hidden"))}),this.interaction.addEventListener("interaction:complete",t=>{console.log("[Shell] Interaction complete:",t.detail),this.stopTimer(),this.handleCompletion(t.detail.state)}),this.interaction.addEventListener("interaction:graded",t=>{t.detail.result.score===100?(this.soundManager.playSound("success"),this.animationsManager.animate(this.$progressIcon,"spin-pulse")):(this.soundManager.playSound("failure"),this.animationsManager.animate(this.$progressIcon,"shake")),this.handleGraded(t.detail.result)}),this.interaction.addEventListener("interaction:hint-shown",t=>{console.log("[Shell] Hint shown:",t.detail.message)}),this.interaction.addEventListener("interaction:error",t=>{console.error("[Shell] Interaction error:",t.detail),alert(t.detail.message)})}removeInteractionListeners(){}updateProgress(t,r){this.$progressBar.max=r,this.$progressBar.value=t??0,this.$progressCounter.textContent=`${t}/${r}`;let i=r>0?t/r*100:0,a=this.$progressBar.offsetWidth*i/100-12;this.$progressIcon.style.left=`${Math.max(0,a)}px`}handleCompletion(t){this.dispatchEvent(new CustomEvent("shell:interaction-complete",{detail:{state:t},bubbles:!0,composed:!0})),console.log("[Shell] Interaction submitted with state:",t)}handleGraded(t){this.$checkBtn.classList.add("edu-hidden"),this.$scoresBtn.classList.remove("edu-hidden"),this.$retryBtn.classList.remove("edu-hidden"),this.attemptLimit&&this.attemptCount>this.attemptLimit&&this.$retryBtn.classList.add("edu-hidden");let r=t.score;this.$scoreDisplay.innerHTML=`
|
|
4662
4668
|
<div style="font-size: 4rem; font-weight: 700; color: ${r>=75?"rgb(var(--edu-success))":r>=50?"rgba(139, 195, 74)":r>=25?"rgb(var(--edu-warning))":"rgb(var(--edu-error))"}">${r}%</div>
|
|
4663
4669
|
<div style="font-size: 1.5rem; margin-top: 1rem; color: rgb(var(--edu-second-ink));">
|
|
4664
4670
|
${r===100?"Perfect Score! \u{1F389}":r>=75?"Great Job!":r>=50?"Good Effort!":r>=25?"Keep Trying!":"Try Again!"}
|
|
4665
4671
|
</div>
|
|
4666
|
-
`,this.$progressIcon.classList.remove("score-fail","score-low","score-mid","score-high"),this.$progressBar.classList.remove("score-fail","score-low","score-mid","score-high");let i="";r<=25?i="score-fail":r<=50?i="score-low":r<=75?i="score-mid":i="score-high",this.$progressIcon.classList.add(i),this.$progressBar.classList.add(i)}reset(){this.resetTimer(),this.interaction.implementsProgress||this.$checkBtn.classList.remove("edu-hidden"),this.$scoresBtn.classList.add("edu-hidden"),this.$retryBtn.classList.add("edu-hidden"),this.$progressIcon.classList.remove("score-fail","score-low","score-mid","score-high"),this.$progressBar.classList.remove("score-fail","score-low","score-mid","score-high"),this.animationsManager.animate(this.$progressIcon,"heartbeat"),this.$progressBar.value=0,this.updateProgress(0,this.interaction.progressTracker.total),this.interaction.interactionMechanic==="sequential"&&this.renderRadioNav()}handleRetry(){if(this.$retryBtn.classList.add("edu-hidden"),this.soundManager.playSound("pop"),this.attemptCount++,this.attemptLimit&&this.attemptLimit>0){let t=this.attemptLimit-this.attemptCount+1;this.$attemptsMessage.textContent=`${t} attempt${t!==1?"s":""} remaining`,this.switchScreen("attempts"),setTimeout(()=>{this.switchScreen("interaction"),this.reset(),this.resumeTimer(),this.interaction?.reset(),this.soundManager.playSound("flip")},2e3)}else this.switchScreen("interaction"),this.interaction?.reset()}openPromptDialog(){let t=this.interaction?.config;if(!t)return;this.soundManager.playSound("pop");let r=document.querySelector("edu-dialog#prompt-dialog");r||(r=document.createElement("edu-dialog"),r.id="prompt-dialog",document.body.appendChild(r)),r.title=t.construct||this.interaction?.config.promptModality||"Prompt";let i=document.createElement("edu-media");i.setAttribute("type",t.promptModality),i.setAttribute("data",t.promptData),t.promptDataSpec&&i.setAttribute("spec",t.promptDataSpec),r.innerHTML="",r.appendChild(i),r.open()}switchScreen(t){this.shadowRoot.querySelectorAll(".screen").forEach(r=>{let i=r.getAttribute("data-screen");r.style.display=i===t?"block":"none"}),this.currentScreen=t,console.log(`[Shell] Switched to screen: ${t}`)}startTimer(){this.timerInterval=window.setInterval(()=>{this.remainingSeconds--,this.updateTimerDisplay(),this.remainingSeconds<=0&&(this.stopTimer(),this.handleTimerComplete())},1e3)}stopTimer(){this.timerInterval!==null&&(clearInterval(this.timerInterval),this.timerInterval=null)}getFormattedTime(t){let r=Math.floor(t/60),i=t%60;return`${r}:${i.toString().padStart(2,"0")}`}updateTimerDisplay(){this.$timerEl.textContent=this.getFormattedTime(this.remainingSeconds),this.remainingSeconds===30&&(this.soundManager.playSound("low-time"),this.animationsManager.animate(this.$timerEl,"shake")),delete this.$timerEl.dataset.warning,delete this.$timerEl.dataset.danger,this.remainingSeconds<=10?this.$timerEl.dataset.danger="true":this.remainingSeconds<=30&&(this.$timerEl.dataset.warning="true")}handleTimerComplete(){console.log("[Shell] Timer complete");try{this.interaction.submit()}catch(t){console.error("Auto-submit on timer failed:",t)}this.dispatchEvent(new CustomEvent("shell:timer-complete",{bubbles:!0,composed:!0}))}pauseTimer(){this.stopTimer()}resumeTimer(){this.remainingSeconds>0&&this.timerInterval===null&&this.startTimer()}resetTimer(){this.stopTimer(),this.remainingSeconds=this.interaction.config.timer,this.updateTimerDisplay()}updateVisibility(){let t=this.getAttribute("show-header")!=="false",r=this.getAttribute("show-footer")!=="false";this.$headerEl.style.display=t?"":"none",this.$footerEl.style.display=r?"":"none"}renderRadioNav(){let t=this.interaction&&"slidesCount"in this.interaction?this.interaction.slidesCount:1;this.$radioNav.innerHTML="";for(let r=1;r<=t;r++){let i=document.createElement("input");i.type="radio",i.name="step-nav",i.id=`step-${r}`,r===1&&(i.checked=!0);let o=document.createElement("label");o.htmlFor=`step-${r}`,o.textContent=String(r),this.$radioNav.appendChild(i),this.$radioNav.appendChild(o)}}getContentArea(){return this.$contentEl}};customElements.get("edu-window")||customElements.define("edu-window",he);et();W();export{Ie as AdjacencyTable,we as AssetValidationError,x as BaseInteraction,ae as CategorizeTheWords,Ae as ClassificationMatrix,Qe as EduTable,Je as EduText,de as FillBlanks,he as InteractionsBaseShell,re as ListRecall,$e as LookupTable,te as MCQ,ne as MarkTheWords,_e as NaryChoiceTable,
|
|
4672
|
+
`,this.$progressIcon.classList.remove("score-fail","score-low","score-mid","score-high"),this.$progressBar.classList.remove("score-fail","score-low","score-mid","score-high");let i="";r<=25?i="score-fail":r<=50?i="score-low":r<=75?i="score-mid":i="score-high",this.$progressIcon.classList.add(i),this.$progressBar.classList.add(i)}reset(){this.resetTimer(),this.interaction.implementsProgress||this.$checkBtn.classList.remove("edu-hidden"),this.$scoresBtn.classList.add("edu-hidden"),this.$retryBtn.classList.add("edu-hidden"),this.$progressIcon.classList.remove("score-fail","score-low","score-mid","score-high"),this.$progressBar.classList.remove("score-fail","score-low","score-mid","score-high"),this.animationsManager.animate(this.$progressIcon,"heartbeat"),this.$progressBar.value=0,this.updateProgress(0,this.interaction.progressTracker.total),this.interaction.interactionMechanic==="sequential"&&this.renderRadioNav()}handleRetry(){if(this.$retryBtn.classList.add("edu-hidden"),this.soundManager.playSound("pop"),this.attemptCount++,this.attemptLimit&&this.attemptLimit>0){let t=this.attemptLimit-this.attemptCount+1;this.$attemptsMessage.textContent=`${t} attempt${t!==1?"s":""} remaining`,this.switchScreen("attempts"),setTimeout(()=>{this.switchScreen("interaction"),this.reset(),this.resumeTimer(),this.interaction?.reset(),this.soundManager.playSound("flip")},2e3)}else this.switchScreen("interaction"),this.interaction?.reset()}openPromptDialog(){let t=this.interaction?.config;if(!t)return;this.soundManager.playSound("pop");let r=document.querySelector("edu-dialog#prompt-dialog");r||(r=document.createElement("edu-dialog"),r.id="prompt-dialog",document.body.appendChild(r)),r.title=t.construct||this.interaction?.config.promptModality||"Prompt";let i=document.createElement("edu-media");i.setAttribute("type",t.promptModality),i.setAttribute("data",t.promptData),t.promptDataSpec&&i.setAttribute("spec",t.promptDataSpec),r.innerHTML="",r.appendChild(i),r.open()}switchScreen(t){this.shadowRoot.querySelectorAll(".screen").forEach(r=>{let i=r.getAttribute("data-screen");r.style.display=i===t?"block":"none"}),this.currentScreen=t,console.log(`[Shell] Switched to screen: ${t}`)}startTimer(){this.timerInterval=window.setInterval(()=>{this.remainingSeconds--,this.updateTimerDisplay(),this.remainingSeconds<=0&&(this.stopTimer(),this.handleTimerComplete())},1e3)}stopTimer(){this.timerInterval!==null&&(clearInterval(this.timerInterval),this.timerInterval=null)}getFormattedTime(t){let r=Math.floor(t/60),i=t%60;return`${r}:${i.toString().padStart(2,"0")}`}updateTimerDisplay(){this.$timerEl.textContent=this.getFormattedTime(this.remainingSeconds),this.remainingSeconds===30&&(this.soundManager.playSound("low-time"),this.animationsManager.animate(this.$timerEl,"shake")),delete this.$timerEl.dataset.warning,delete this.$timerEl.dataset.danger,this.remainingSeconds<=10?this.$timerEl.dataset.danger="true":this.remainingSeconds<=30&&(this.$timerEl.dataset.warning="true")}handleTimerComplete(){console.log("[Shell] Timer complete");try{this.interaction.submit()}catch(t){console.error("Auto-submit on timer failed:",t)}this.dispatchEvent(new CustomEvent("shell:timer-complete",{bubbles:!0,composed:!0}))}pauseTimer(){this.stopTimer()}resumeTimer(){this.remainingSeconds>0&&this.timerInterval===null&&this.startTimer()}resetTimer(){this.stopTimer(),this.remainingSeconds=this.interaction.config.timer,this.updateTimerDisplay()}updateVisibility(){let t=this.getAttribute("show-header")!=="false",r=this.getAttribute("show-footer")!=="false";this.$headerEl.style.display=t?"":"none",this.$footerEl.style.display=r?"":"none"}renderRadioNav(){let t=this.interaction&&"slidesCount"in this.interaction?this.interaction.slidesCount:1;this.$radioNav.innerHTML="";for(let r=1;r<=t;r++){let i=document.createElement("input");i.type="radio",i.name="step-nav",i.id=`step-${r}`,r===1&&(i.checked=!0);let o=document.createElement("label");o.htmlFor=`step-${r}`,o.textContent=String(r),this.$radioNav.appendChild(i),this.$radioNav.appendChild(o)}}getContentArea(){return this.$contentEl}};customElements.get("edu-window")||customElements.define("edu-window",he);et();W();export{Ie as AdjacencyTable,we as AssetValidationError,x as BaseInteraction,ae as CategorizeTheWords,Ae as ClassificationMatrix,Qe as EduTable,Je as EduText,de as FillBlanks,he as InteractionsBaseShell,re as ListRecall,$e as LookupTable,te as MCQ,ne as MarkTheWords,_e as NaryChoiceTable,Ce as OpenClassification,pe as RankOrder,se as SequentialCategorizeTheWords,Ee as SequentialClassification,ue as SequentialFillBlanks,oe as SequentialMarkTheWords,ce as SequentialTextTransformation,ke as SimultaneousAssociation,le as TextTransformation,ll as adjacencyTableDataParser,pl as adjacencyTableDataValidator,Vr as adjacencyTableGrader,sl as basicTableDataParser,ul as basicTableDataValidator,Or as classificationTableGrader,Ta as clearInteractionRegistry,He as cognikitThemePresets,Te as compareValues,xi as configureCognikit,bi as createInteraction,tt as defaultCognikitThemeVariables,We as detectCellKind,W as ensureCognikitTheme,Fr as getAdjacencyCellGrading,Ke as getAllUniqueValues,Se as getAllValues,Pe as getBlanksGradingState,Ur as getClassificationCellGrading,qe as getClassificationGradingState,wi as getCognikitConfig,yi as getCognikitThemePresets,ha as getDNDGradingState,De as getHighlightGradingState,fi as getInteraction,$a as getInteractionRegistry,jr as getLookupCellGrading,Yr as getNaryCellGrading,wt as getTransformationGradingState,Aa as listInteractions,cl as lookupTableDataParser,hl as lookupTableDataValidator,Gr as lookupTableGrader,Nr as naryTableGrader,da as parseTextEngineSequential,Zo as parseYamlAssets,zr as recognitionGrader,Hs as recognitionParser,Gs as recognitionValidator,xa as registerBuiltInInteractions,k as registerInteraction,Ei as resetCognikitTheme,$t as resolveCognikitTheme,yt as seriationGrader,va as seriationParser,ba as seriationValidator,Ci as setCognikitTheme,oi as textEngineBaseDataValidator,ri as textEngineBaseGrammarParser,ai as textEngineBlanksDataValidator,Re as textEngineBlanksGrader,ii as textEngineBlanksGrammarParser,si as textEngineClassificationDataValidator,Be as textEngineClassificationGrader,ni as textEngineClassificationGrammarParser,pa as textEngineDNDGrader,ua as textEngineDataValidator,Me as textEngineHighlightGrader,Le as textEngineTransformationGrader,Sa as unregisterInteraction,Xo as validateAndNormalizeAssets};
|
|
4667
4673
|
/*! Bundled license information:
|
|
4668
4674
|
|
|
4669
4675
|
js-yaml/dist/js-yaml.mjs:
|