Sindbad~EG File Manager

Current Path : /var/www/moodledata/cursos-cmm/filedir/a1/32/
Upload File :
Current File : /var/www/moodledata/cursos-cmm/filedir/a1/32/a1328a2aed454e83bc64f28ee64a782c4e3a7975

!function(){"use strict";let t=function(){function t(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;this.params=t,this.callbacks=e||{},this.content=document.createElement("div"),this.content.classList.add("h5p-crossword-clue-announcer"),this.clueId=document.createElement("span"),this.clueId.classList.add("h5p-crossword-clue-announcer-clue-id"),this.content.appendChild(this.clueId),this.clue=document.createElement("span"),this.clue.classList.add("h5p-crossword-clue-announcer-clue"),this.content.appendChild(this.clue),this.answerLength=document.createElement("span"),this.answerLength.classList.add("h5p-crossword-clue-announcer-answer-length"),this.content.appendChild(this.answerLength)}var e=t.prototype;return e.getDOM=function(){return this.content},e.setClue=function(t){t.orientation&&t.clueId&&t.clue&&t.answerLength&&(this.clueId.innerText=`${t.clueId} ${t.orientation}`,this.clue.innerText=t.clue,this.answerLength.innerText=`(${t.answerLength})`)},e.show=function(){this.content.classList.remove("h5p-crossword-display-none")},e.hide=function(){this.content.classList.add("h5p-crossword-display-none")},e.reset=function(){this.clueId.innerText="",this.clue.innerText="",this.answerLength.innerText=""},t}(),e=function(){function t(){}return t.extend=function(){for(let t=1;t<arguments.length;t++)for(let e in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],e)&&("object"==typeof arguments[0][e]&&"object"==typeof arguments[t][e]?this.extend(arguments[0][e],arguments[t][e]):arguments[0][e]=arguments[t][e]);return arguments[0]},t.htmlDecode=function(t){return(new DOMParser).parseFromString(t,"text/html").documentElement.textContent},t.stripHTML=function(t){const e=document.createElement("div");return e.innerHTML=t,e.textContent||e.innerText||""},t.createArray=function(e){const s=new Array(e||0);let o=e;if(arguments.length>1){const n=Array.prototype.slice.call(arguments,1);for(;o--;)s[e-1-o]=t.createArray.apply(this,n)}return s},t.shuffleArray=function(t){let e,s,o;for(o=t.length-1;o>0;o--)e=Math.floor(Math.random()*(o+1)),s=t[o],t[o]=t[e],t[e]=s;return t},t.formatLanguageCode=function(t){if("string"!=typeof t)return t;const e=t.split("-");return e[0]=e[0].toLowerCase(),e.length>1&&(e[1]=e[1].toUpperCase()),t=e.join("-")},t.toUpperCase=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return"string"!=typeof t?null:("string"==typeof e&&(e=e.split("").map((t=>({lowerCase:t,upperCase:t})))),Array.isArray(e)||(e=[]),e=e.filter((t=>"string"==typeof t.lowerCase&&1===t.lowerCase.length&&"string"==typeof t.upperCase&&1===t.upperCase.length)),e.forEach(((e,s)=>{for(;-1!==t.indexOf(e.lowerCase);)t=t.replace(e.lowerCase,`[CROSSWORDPLACEHOLDER${s}]`)})),t=t.toUpperCase(),e.forEach(((e,s)=>{for(;-1!==t.indexOf(`[CROSSWORDPLACEHOLDER${s}]`);)t=t.replace(`[CROSSWORDPLACEHOLDER${s}]`,e.upperCase)})),t)},t.waitForDOM=function(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:50,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:100;if(0===o||!t||"function"!=typeof e||"function"!=typeof s)return void s();n=Math.max(50,n);document.querySelector(t)?e():setTimeout((()=>{this.waitForDOM(t,e,s,o<0?-1:o-1,n)}),n)},t.isControlKey=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.CONTROL_KEY_VALUES.includes(e.key)},t}();e.CONTROL_KEY_VALUES=["Backspace","Tab","Enter","Shift","Control","Alt","Pause","CapsLock","Escape","PageUp","PageDown","End","Home","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Insert","Delete","Meta","ContextMenu","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","NumLock","ScrollLock"],e.UPPERCASE_EXCEPTIONS=[{lowerCase:"ß",upperCase:"ẞ"}],e.CHARACTER_PLACEHOLDER="_";var s=e;let o=function(){function t(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.params=s.extend({container:document.body,content:document.createElement("div"),styleBase:"h5p-crossword-overlay",position:{offsetHorizontal:0,offsetVertical:0},l10n:{closeWindow:"Close"}},t),this.callbacks=e,this.callbacks.onClose=e.onClose||(()=>{}),this.callbacks.onRead=e.onRead||(()=>{}),this.isVisible=!1,this.focusableElements=[],this.overlay=document.createElement("div"),this.overlay.classList.add(`${this.params.styleBase}-outer-wrapper`),this.overlay.classList.add("h5p-crossword-invisible"),this.overlay.setAttribute("role","dialog"),this.params.l10n.title&&this.overlay.setAttribute("aria-label",this.params.l10n.title),this.overlay.setAttribute("aria-modal","true"),this.content=document.createElement("div"),this.content.classList.add(`${this.params.styleBase}-content`),this.content.appendChild(this.params.content),this.buttonClose=document.createElement("button"),this.buttonClose.classList.add(`${this.params.styleBase}-button-close`),this.buttonClose.setAttribute("title",this.params.l10n.closeWindow),this.buttonClose.setAttribute("disabled","disabled"),this.buttonClose.addEventListener("click",(()=>{this.callbacks.onClose()})),this.overlay.appendChild(this.buttonClose),this.overlay.appendChild(this.content),document.addEventListener("focus",(t=>{this.isVisible&&0!==this.focusableElements.length&&this.trapFocus(t)}),!0),this.blocker=document.createElement("div"),this.blocker.classList.add("h5p-crossword-overlay-blocker"),this.blocker.classList.add("h5p-crossword-display-none")}var e=t.prototype;return e.getDOM=function(){return this.overlay},e.setContent=function(t){for(;this.content.firstChild;)this.content.removeChild(this.content.firstChild);this.content.appendChild(t),this.content.scrollTop=0},e.trapFocus=function(t){this.isChild(t.target)?this.currentFocusElement=t.target:(this.currentFocusElement===this.focusableElements[0]?this.currentFocusElement=this.focusableElements[this.focusableElements.length-1]:this.currentFocusElement=this.focusableElements[0],this.currentFocusElement.focus())},e.isChild=function(t){const e=t.parentNode;return!!e&&(e===this.overlay||this.isChild(e))},e.updateFocusableElements=function(){this.focusableElements=[].slice.call(this.overlay.querySelectorAll('video, audio, button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter((t=>"true"!==t.getAttribute("disabled")&&!0!==t.getAttribute("disabled")))},e.show=function(){this.blockerAppended||(this.container=document.body.querySelector(".h5p-container"),this.container.appendChild(this.blocker)),this.blockerAppended=!0,this.overlay.classList.remove("h5p-crossword-invisible"),this.blocker.classList.remove("h5p-crossword-display-none"),this.buttonClose.removeAttribute("disabled","disabled"),setTimeout((()=>{this.updateFocusableElements(),this.focusableElements.length>0&&this.focusableElements[0].focus();const t=this.overlay.querySelector(".h5p-advanced-text");let e;t?this.callbacks.onRead(t.innerText):e=this.overlay.querySelector(".h5p-image > img"),e&&this.callbacks.onRead(e.getAttribute("alt")||""),this.isVisible=!0,this.resize()}),0)},e.hide=function(){this.isVisible=!1,this.overlay.classList.add("h5p-crossword-invisible"),this.blocker.classList.add("h5p-crossword-display-none"),this.buttonClose.setAttribute("disabled","disabled")},e.resize=function(){this.container&&(this.content.style.maxHeight=`calc(${this.container.offsetHeight}px - ${t.CONTENT_MARGIN})`)},t}();o.CONTENT_MARGIN="7em";let n=function(){function t(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.params=s.extend({a11y:{listLabel:""}},t),this.charMarked=null,this.content=this.buildListContainer({listLabel:this.params.a11y.listLabel})}var e=t.prototype;return e.getDOM=function(){return this.content},e.buildListContainer=function(t){const e=document.createElement("div");e.classList.add("h5p-crossword-input-fields-group-solution-container"),e.classList.add("h5p-crossword-display-none");const s=document.createElement("div");return s.classList.add("h5p-crossword-input-fields-group-solution-inner"),e.appendChild(s),this.list=document.createElement("div"),this.list.classList.add("h5p-crossword-input-fields-group-solution-word"),this.list.setAttribute("role","list"),this.list.setAttribute("aria-label",t.listLabel),this.list.setAttribute("aria-expanded","false"),this.list.setAttribute("tabindex","0"),s.appendChild(this.list),this.list.addEventListener("keydown",(t=>{const e=this.charMarked||this.list.firstChild,s=this.list.getAttribute("aria-expanded");switch(t.code){case"Enter":case"Space":if(t.target!==t.currentTarget)return;"false"===s?(this.list.setAttribute("aria-expanded","true"),e&&(e.setAttribute("tabindex","0"),e.focus())):(this.list.setAttribute("aria-expanded","false"),e&&e.setAttribute("tabindex","-1"))}})),e},e.buildListItem=function(t){const e=document.createElement("span");e.classList.add("h5p-crossword-input-fields-group-solution-char-wrapper"),e.setAttribute("role","listitem"),e.setAttribute("tabindex","-1"),e.setAttribute("aria-label",t.ariaLabel),"neutral"===t.result?(e.classList.add("h5p-crossword-solution-no-input")," "!==t.char&&t.char!==s.CHARACTER_PLACEHOLDER||e.classList.add("h5p-crossword-solution-no-char")):"correct"===t.result?e.classList.add("h5p-crossword-solution-correct"):e.classList.add("h5p-crossword-solution-wrong"),t.scoreExplanation&&e.appendChild(t.scoreExplanation),e.addEventListener("focus",(t=>{this.charMarked=t.target})),e.addEventListener("keydown",(t=>{const e=t.target.parentNode.firstChild,s=t.target.parentNode.lastChild;switch(t.key){case"ArrowLeft":case"ArrowUp":t.preventDefault(),t.target.previousSibling&&(t.target.setAttribute("tabindex","-1"),t.target.previousSibling.setAttribute("tabindex","0"),t.target.previousSibling.focus());break;case"ArrowRight":case"ArrowDown":t.preventDefault(),t.target.nextSibling&&(t.target.setAttribute("tabindex","-1"),t.target.nextSibling.setAttribute("tabindex","0"),t.target.nextSibling.focus());break;case"Home":t.preventDefault(),t.target!==e&&(t.target.setAttribute("tabindex","-1"),e.setAttribute("tabindex","0"),e.focus());break;case"End":t.preventDefault(),t.target!==s&&(t.target.setAttribute("tabindex","-1"),s.setAttribute("tabindex","0"),s.focus())}}));const o=document.createElement("span");return o.classList.add("h5p-crossword-input-fields-group-solution-char"),o.innerHTML=t.char&&" "!==t.char.trim()?s.toUpperCase(t.char,s.UPPERCASE_EXCEPTIONS):"&nbsp;",e.appendChild(o),e},e.setChars=function(t){this.reset(),t.forEach((t=>{this.list.appendChild(this.buildListItem(t))}))},e.show=function(){this.content.classList.remove("h5p-crossword-display-none")},e.hide=function(){this.content.classList.add("h5p-crossword-display-none")},e.enable=function(){if(this.tabindexState&&this.tabindexState.list&&this.list.setAttribute("tabindex",this.tabindexState.list),this.tabindexState&&this.tabindexState.listItems){const t=this.list.children;for(let e=0;e<t.length;e++)t[e].setAttribute("tabindex",this.tabindexState.listItems[e])}},e.disable=function(){const t=[],e=this.list.children;for(let s=0;s<e.length;s++)t.push(e[s].getAttribute("tabindex")),e[s].setAttribute("tabindex","-1");this.tabindexState={list:this.list.getAttribute("tabindex"),listItems:t},this.list.setAttribute("tabindex","-1")},e.reset=function(){this.list.innerHTML="",this.list.setAttribute("aria-expanded","false"),this.list.setAttribute("tabindex","0"),this.charMarked=null,this.tabindexState=null},t}();let i=function(){function t(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;this.params=s.extend({l10n:{extraClue:"Extra clue",closeWindow:"Close Window"}},t),this.callbacks=e||{},this.callbacks.onFieldInput=this.callbacks.onFieldInput||(()=>{}),this.callbacks.onRead=e.onRead||(()=>{}),this.inputFields=[],this.extraClues=[],this.content=document.createElement("div"),this.content.classList.add("h5p-crossword-input-container");const n=this.buildInputFieldsGroup({words:this.params.words.filter((t=>"across"===t.orientation)),title:t.l10n.across});this.content.appendChild(n);const i=this.buildInputFieldsGroup({words:this.params.words.filter((t=>"down"===t.orientation)),title:t.l10n.down});this.content.appendChild(i),this.overlay=new o({l10n:{closeWindow:this.params.l10n.closeWindow}},{onClose:()=>{this.handleOverlayClosed()},onRead:t=>{this.callbacks.onRead(t)}}),t.overlayContainer.appendChild(this.overlay.getDOM())}var e=t.prototype;return e.getDOM=function(){return this.content},e.buildInputFieldsGroup=function(t){t.words=t.words.sort(((t,e)=>t.clueId-e.clueId));const e=document.createElement("div");e.classList.add("h5p-crossword-input-fields-group");const o=document.createElement("div");return o.classList.add("h5p-crossword-input-fields-group-title"),o.innerText=t.title,e.appendChild(o),t.words.forEach((t=>{const o=document.createElement("div");o.classList.add("h5p-crossword-input-fields-group-wrapper");const i=document.createElement("div");i.classList.add("h5p-crossword-input-fields-group-wrapper-clue"),o.appendChild(i);const r=document.createElement("div");r.classList.add("h5p-crossword-input-fields-group-clue-id"),r.innerText=t.clueId,i.appendChild(r);const l=document.createElement("div");l.classList.add("h5p-crossword-input-fields-group-clue-content"),i.appendChild(l);const a=document.createElement("span");a.classList.add("h5p-crossword-input-fields-group-clue"),a.innerText=t.clue,l.appendChild(a);const c=document.createElement("span");if(c.classList.add("h5p-crossword-input-fields-group-answer-length"),c.innerText=`(${t.answer.split(" ").map((t=>t.length)).join(",")})`,l.appendChild(c),t.extraClue){const e=t.extraClue.library?t.extraClue.library.split(" ")[0]:null;if(e){const s=document.createElement("div");s.classList.add("h5p-crossword-extra-clue-instance-wrapper");const o=document.createElement("button");o.classList.add("h5p-crossword-input-fields-group-extra-clue");const n={clueId:t.clueId,orientation:t.orientation,clue:t.clue};o.setAttribute("aria-label",this.params.a11y.extraClueFor.replace("@clue",this.buildAriaLabel(n))),o.setAttribute("title",this.params.l10n.extraClue),l.appendChild(o),o.addEventListener("click",(()=>{this.disabled||(this.disable(),"H5P.Video"===e?t.extraClue.params.fit=!1:"H5P.Audio"===e&&(t.extraClue.params.playerMode="full",t.extraClue.params.fitToWrapper=!0),this.overlay.setContent(s),this.previousFocus=o,this.overlay.show(),this.extraClueInstance=H5P.newRunnable(t.extraClue,this.params.contentId,H5P.jQuery(s)))})),this.extraClues.push(o)}}const h=document.createElement("input");h.classList.add("h5p-crossword-input-fields-group-input");const u={clueId:t.clueId,orientation:t.orientation,clue:t.clue,length:t.answer.length};h.setAttribute("aria-label",this.buildAriaLabel(u)),h.setAttribute("autocomplete","off"),h.setAttribute("autocorrect","off"),h.setAttribute("maxLength",t.answer.length),h.setAttribute("spellcheck","false"),this.setInputFieldValue(h,""),o.appendChild(h),h.addEventListener("focus",(()=>{this.disabled||setTimeout((()=>{this.callbacks.onFieldInput({clueId:t.clueId,orientation:t.orientation,cursorPosition:Math.min(h.selectionStart,t.answer.length-1),text:h.value,readOffset:-1})}),0)})),h.addEventListener("keydown",(e=>{if(s.isControlKey(e))return;if(this.noListeners)return;const o=h.selectionStart;h.value=`${h.value.substring(0,o+1)}${h.value.substring(o+1)}`,h.selectionEnd=o+1;const n=s.toUpperCase(h.value,s.UPPERCASE_EXCEPTIONS);clearTimeout(this.tableUpdateTimeout),this.tableUpdateTimeout=setTimeout((()=>{const e=this.applySamsungWorkaround(n,s.toUpperCase(h.value,s.UPPERCASE_EXCEPTIONS));this.setInputFieldValue(h,e),h.setSelectionRange(o+1,o+1),this.callbacks.onFieldInput({clueId:t.clueId,orientation:t.orientation,cursorPosition:Math.min(o+1,t.answer.length-1),text:e,readOffset:-1})}),25)}),!1),h.addEventListener("keyup",(e=>{if(229===e.keyCode)return;if(this.noListeners)return;if(s.isControlKey(e)&&!["Backspace","Home","End","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Delete"].includes(e.key))return;let o=h.selectionStart;"Home"===e.code||"ArrowUp"===e.code?o=0:"End"!==e.code&&"ArrowDown"!==e.code||(o=Math.min(h.value.length,h.getAttribute("maxLength")-1)),this.setInputFieldValue(h,h.value),h.setSelectionRange(o,o),this.callbacks.onFieldInput({clueId:t.clueId,orientation:t.orientation,cursorPosition:o,text:h.value,readOffset:["Backspace","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Delete"].includes(e.key)?0:1})})),h.addEventListener("paste",(t=>{if(this.disabled)return;t.preventDefault();const e=t.clipboardData.getData("text");this.setInputFieldValue(h,e.substring(0,h.getAttribute("maxLength")))}));const d=this.params.a11y.resultFor.replace("@clue",`${t.clueId} ${this.params.a11y[t.orientation]}. ${t.clue} .`),p=new n({a11y:{listLabel:d}});o.appendChild(p.getDOM()),this.inputFields.push({clue:i,inputField:h,orientation:t.orientation,clueId:t.clueId,solution:p}),e.appendChild(o)})),e},e.applySamsungWorkaround=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";for(;t.length<e.length;)t=`${t}${s.CHARACTER_PLACEHOLDER}`;for(;e.length<t.length;)e=`${e}${s.CHARACTER_PLACEHOLDER}`;const o=[];for(let n=t.length-1;n>=0;n--)t[n]===e[n]?o[n]=s.CHARACTER_PLACEHOLDER:n+1<t.length&&"_"!==o[n+1]?(o[n]=o[n+1],o[n+1]=s.CHARACTER_PLACEHOLDER):o[n]=e[n];let n=[],i=" ";for(let e=t.length-1;e>=0;e--){let r;o[e]!==s.CHARACTER_PLACEHOLDER&&(i=s.CHARACTER_PLACEHOLDER),r=o[e]!==s.CHARACTER_PLACEHOLDER?o[e]:t[e]!==s.CHARACTER_PLACEHOLDER?t[e]:i,n[e]=r}return n.join("").trimRight()},e.setInputFieldValue=function(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{forceValue:!0};e=s.toUpperCase(e,s.UPPERCASE_EXCEPTIONS);let n="";if(o.forceValue){n=e;const o=new Array(t.maxLength+1).join(s.CHARACTER_PLACEHOLDER);n=o.split("").map(((t,e)=>n.length>e&&" "!==n[e]?n[e]:t)).join("")}else for(let t of e.split("")){if(" "===t)break;n=`${n}${t}`}t.value=s.toUpperCase(n,s.UPPERCASE_EXCEPTIONS)},e.buildAriaLabel=function(t){const e=[`${t.clueId} ${this.params.a11y[t.orientation]}. ${t.clue}`];return t.length&&e.push(this.params.a11y.lettersWord.replace("@length",t.length)),e.join(", ")},e.fillFields=function(t){t.forEach((t=>{const e=this.inputFields.filter((e=>e.orientation===t.orientation&&e.clueId===t.clueId));e.length>0&&this.setInputFieldValue(e[0].inputField,t.text)}))},e.focusClue=function(t){this.inputFields.forEach((t=>{t.clue.classList.remove("h5p-crossword-input-fields-group-clue-highlight-focus")}));const e=this.inputFields.filter((e=>e.orientation===t.orientation&&e.clueId===t.clueId));e.length>0&&e[0].clue.classList.add("h5p-crossword-input-fields-group-clue-highlight-focus")},e.checkAnswerWords=function(t){this.scorePoints=this.scorePoints||new H5P.Question.ScorePoints,this.inputFields.forEach((e=>{e.solution.show();const o=t.filter((t=>t.clueId===e.clueId&&t.orientation===e.orientation)).shift();let n,i;const r=[];r.push(o.answer),-1===o.score?(n=this.scorePoints.getElement(!1),i="wrong",r.push(this.params.a11y.wrong),r.push(`-1 ${this.params.a11y.point}`)):1===o.score?(n=this.scorePoints.getElement(!0),i="correct",r.push(this.params.a11y.correct),r.push(`1 ${this.params.a11y.point}`)):i="neutral",e.solution.setChars([{ariaLabel:`${r.join(". ")}.`,char:e.inputField.value.replace(s.CHARACTER_PLACEHOLDER," "),result:i,scoreExplanation:n}])}))},e.checkAnswer=function(t){this.scorePoints=this.scorePoints||new H5P.Question.ScorePoints;const e=[];this.inputFields.forEach((o=>{o.solution.show();const n=t.filter((t=>"across"===o.orientation?t.clueIdAcross===o.clueId:"down"===o.orientation&&t.clueIdDown===o.clueId));let i=s.toUpperCase(o.inputField.value,s.UPPERCASE_EXCEPTIONS).split(""),r=[];n.forEach(((t,o)=>{const l=e.some((e=>e.row===t.position.row&&e.column===t.position.column));e.push(t.position);const a=i.length>o?i[o]:" ";let c,h;t.answer&&""!==t.answer.trim()&&t.answer!==s.CHARACTER_PLACEHOLDER?t.answer===t.solution?(c="correct",l||(h=this.scorePoints.getElement(!0))):this.params.applyPenalties?(c="wrong",l||(h=this.scorePoints.getElement(!1))):c="neutral":c="neutral";const u=[];u.push(`${this.params.a11y.letterSevenOfNine.replace("@position",o+1).replace("@length",n.length)}`),u.push(t.answer&&""!==t.answer.trim()?t.answer:this.params.a11y.empty),"correct"===c?(u.push(this.params.a11y.correct),u.push(`1 ${this.params.a11y.point}`)):"wrong"===c&&(u.push(this.params.a11y.wrong),u.push(`-1 ${this.params.a11y.point}`)),r.push({ariaLabel:`${u.join(". ")}.`,char:a.replace(s.CHARACTER_PLACEHOLDER," ")||"&nbsp;",result:c,scoreExplanation:h})})),o.solution.setChars(r)}))},e.showSolutions=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.inputFields.forEach((e=>{let s=t.filter((t=>t.clueId===e.clueId&&t.orientation===e.orientation));if(!s||0===s.length)return;s=s[0],this.setInputFieldValue(e.inputField,s.answer),e.inputField.readOnly=!0,e.inputField.removeAttribute("disabled");const o=this.params.a11y.solutionFor.replace("@clue",`${s.clueId} ${this.params.a11y[s.orientation]}. ${s.clue} .`).replace("@solution",s.answer);e.inputField.setAttribute("aria-label",o),e.solution.disable()}))},e.reset=function(){this.inputFields.forEach((t=>{this.setInputFieldValue(t.inputField,""),t.inputField.readOnly=!1,t.clue.classList.remove("h5p-crossword-input-fields-group-clue-highlight-focus"),t.solution.hide(),t.solution.reset()}))},e.resize=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.height&&(this.content.style.setProperty("--h5p-crossword-input-container-height",`${t.height}px`),this.content.classList.toggle("has-scrollbar",this.content.scrollHeight>this.content.clientHeight)),this.extraClueInstance&&this.extraClueInstance.trigger("resize"),this.overlay.resize()},e.enable=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.inputFields.forEach((t=>{t.inputField.removeAttribute("disabled")})),this.extraClues.forEach((t=>{t.removeAttribute("disabled")})),this.content.classList.remove("h5p-crossword-disabled"),this.disabled=!1,this.noListeners=t},e.disable=function(){this.disabled=!0,this.noListeners=!0,this.extraClues.forEach((t=>{t.setAttribute("disabled",!0)})),this.content.classList.add("h5p-crossword-disabled"),this.inputFields.forEach((t=>{t.inputField.setAttribute("disabled",!0)}))},e.unhighlight=function(){this.inputFields.forEach((t=>{t.clue.classList.remove("h5p-crossword-input-fields-group-clue-highlight-focus")}))},e.handleOverlayClosed=function(){this.extraClueInstance&&"function"==typeof this.extraClueInstance.pause&&this.extraClueInstance.pause(),this.overlay.hide(),this.enable(),this.previousFocus&&this.previousFocus.focus(),this.previousFocus=null},t}(),r=function(){function t(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.params=s.extend({instantFeedback:!1,clueIdMarker:null,solution:null},t),this.callbacks=e||{},this.callbacks.onClick=e.onClick||(()=>{}),this.callbacks.onFocus=e.onFocus||(()=>{}),this.callbacks.onKeyup=e.onKeyup||(()=>{}),this.callbacks.onRead=e.onRead||(()=>{}),this.enabled=!0,this.previousTabIndex=null,this.position={row:t.row,column:t.column},this.solutionWordId=null,this.cell=this.buildCell(t);const o=this.buildCellContentWrapper();if(this.cell.appendChild(o),this.params.solution?(this.cellInput=this.buildCellInput(t),o.appendChild(this.cellInput),this.cellCanvas=this.buildCellCanvas(),o.appendChild(this.cellCanvas),this.cell.addEventListener("click",(()=>{this.enabled&&(this.callbacks.onClick(this.position),this.focus())}))):(this.cell.classList.add("h5p-crossword-cell-empty"),this.cell.setAttribute("aria-label",this.params.a11y.empty),this.params.hasBackgroundImage||(this.cell.style.backgroundColor=this.params.theme.backgroundColor)),this.params.clueIdMarker){const t=document.createElement("div");t.classList.add("h5p-crossword-cell-clue-id-marker"),t.innerText=this.params.clueIdMarker,o.appendChild(t)}}var e=t.prototype;return e.getDOM=function(){return this.cell},e.buildCell=function(t){const e=document.createElement("td");return e.classList.add("h5p-crossword-cell"),e.style.width=`${t.width}%`,e.setAttribute("role","gridcell"),e.dataset.col=t.column,e.dataset.row=t.row,e},e.buildCellContentWrapper=function(){const t=document.createElement("div");return t.classList.add("h5p-crossword-cell-content-wrapper"),t},e.buildCellCanvas=function(){const t=document.createElement("div");return t.classList.add("h5p-crossword-cell-canvas"),t},e.buildCellInput=function(){const t=document.createElement("input");return t.classList.add("h5p-crossword-cell-content"),t.setAttribute("type","text"),t.setAttribute("maxLength",1),t.setAttribute("autocomplete","new-password"),t.setAttribute("autocorrect","off"),t.setAttribute("spellcheck","false"),t.setAttribute("tabindex","-1"),t.addEventListener("input",(t=>{if(!this.enabled)return;this.setAnswer(s.toUpperCase(t.data,s.UPPERCASE_EXCEPTIONS),!0),this.cellInput.value="";const e=this.getInformation();this.callbacks.onKeyup(e),t.preventDefault()})),t.addEventListener("change",(t=>{t.preventDefault()})),t.addEventListener("keydown",(t=>{if(this.enabled)if(t.repeat)t.preventDefault();else if(t.key&&"Unidentified"!==t.key&&("Delete"===t.key||"Backspace"===t.key)){const t=this.getAnswer()?0:-1;this.setAnswer("");const e=this.getInformation();e.keepPosition=!0,e.nextPositionOffset=t,this.cellInput.value="",this.callbacks.onKeyup(e)}})),t.addEventListener("keyup",(t=>{if(this.enabled&&(!t.key||"Unidentified"===t.key))if(t.repeat)t.preventDefault();else if("Delete"===t.key||"Backspace"===t.key){const t=this.getAnswer()?0:-1;this.setAnswer("");const e=this.getInformation();e.keepPosition=!0,e.nextPositionOffset=t,this.cellInput.value="",this.callbacks.onKeyup(e)}})),t.addEventListener("focus",(t=>{this.callbacks.onFocus(this.position,t)})),t},e.getSolution=function(){return this.params.solution},e.getCurrentAnswer=function(){return this.cell.innerText.substring(0,1)},e.getInformation=function(){return{answer:this.answer?s.toUpperCase(this.answer,s.UPPERCASE_EXCEPTIONS):this.answer,clueIdAcross:this.params.clueIdAcross,clueIdDown:this.params.clueIdDown,position:this.position,score:this.getScore(),solution:this.params.solution,solutionWordId:this.solutionWordId||null}},e.getPosition=function(){return this.position},e.getClueId=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"across";return"down"===t?this.params.clueIdDown:"across"===t?this.params.clueIdAcross:null},e.getAnswer=function(){return this.answer},e.getScore=function(){if(this.params.solution&&(" "!==this.params.solution||this.answer&&""!==this.answer.trim()&&this.answer!==s.CHARACTER_PLACEHOLDER))return this.answer&&""!==this.answer.trim()?this.answer!==this.params.solution?this.params.applyPenalties?-1:0:1:0},e.isFilled=function(){return this.params.solution?" "===this.params.solution?null:!(!this.answer||" "===this.answer):null},e.setTabIndex=function(t){isNaN(parseInt(t))||(this.cellInput?this.cellInput.setAttribute("tabindex",t):this.cell.setAttribute("tabindex",t))},e.setAriaLabel=function(t){this.cellInput.setAttribute("aria-label",t)},e.setSolutionState=function(t){if(this.cell.classList.remove("h5p-crossword-solution-correct"),this.cell.classList.remove("h5p-crossword-solution-wrong"),this.cell.classList.remove("h5p-crossword-solution-neutral"),t){const e="h5p-crossword-solution"+(t?`-${t}`:"");this.cell.classList.add(e)}},e.setAnswer=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.cellInput&&(""===t?(this.cellCanvas.innerText="",this.answer=void 0):(this.cellCanvas.innerText=s.toUpperCase(t.replace(new RegExp(s.CHARACTER_PLACEHOLDER,"g")," "),s.UPPERCASE_EXCEPTIONS),this.answer=s.toUpperCase(t,s.UPPERCASE_EXCEPTIONS)),this.params.instantFeedback&&this.checkAnswer(e))},e.setWidth=function(t){"number"!=typeof t||t<=0||(this.cell.style.width=`${t}px`)},e.focus=function(){setTimeout((()=>{this.cellInput?this.cellInput.focus():this.cell.focus()}),0)},e.highlight=function(t){if(!this.getSolution()&&"focus"!==t)return;const e="h5p-crossword-highlight"+(t?`-${t}`:"");this.cell.classList.add(e)},e.unhighlight=function(t){if(t){const e="h5p-crossword-highlight"+(t?`-${t}`:"");this.cell.classList.remove(e)}else this.cell.classList.remove("h5p-crossword-highlight-normal"),this.cell.classList.remove("h5p-crossword-highlight-focus")},e.showSolutions=function(){this.params.solution&&(this.setAnswer(this.params.solution),this.setSolutionState())},e.getSolutionState=function(){const t=(this.answer||"").trim();return t===this.params.solution&&""!==t?"correct":""===t||t===s.CHARACTER_PLACEHOLDER?"undefined":this.params.applyPenalties?"wrong":"neutral"},e.checkAnswer=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.getSolutionState();e="undefined"===e?void 0:e,this.setSolutionState(e),t&&("correct"===e?this.callbacks.onRead(this.params.a11y.correct):"wrong"===e&&this.callbacks.onRead(this.params.a11y.wrong))},e.reset=function(){const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).keepCorrectAnswers&&"correct"===this.getSolutionState();this.unhighlight(),this.setSolutionState(),t||this.setAnswer("",!1);const e=this.getInformation();return this.callbacks.onKeyup(e,!0),t},e.enable=function(){this.cellInput&&(this.previousTabIndex&&this.cell.setAttribute("tabindex",this.previousTabIndex),this.cellInput.removeAttribute("disabled")),this.enabled=!0},e.disable=function(){this.enabled=!1,this.cellInput&&this.cellInput.setAttribute("disabled","disabled"),this.previousTabIndex=this.cell.getAttribute("tabindex"),this.cell.removeAttribute("tabindex")},e.addSolutionWordIdMarker=function(t){t&&(this.solutionWordMarker=document.createElement("div"),this.solutionWordMarker.classList.add("h5p-crossword-cell-solution-word-marker"),this.solutionWordMarker.innerText=t,this.cell.insertBefore(this.solutionWordMarker,this.cell.firstChild),this.solutionWordCircle=document.createElement("div"),this.solutionWordCircle.classList.add("h5p-crossword-cell-solution-word-circle"),this.cell.insertBefore(this.solutionWordCircle,this.cell.firstChild),this.solutionWordId=t)},t}();let l=function(){function t(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;this.params=s.extend({},t),this.params.theme.backgroundImage=this.params.theme.backgroundImage||null,this.callbacks=e||{},this.callbacks.onInput=this.callbacks.onInput||(()=>{}),this.callbacks.onFocus=this.callbacks.onFocus||(()=>{}),this.callbacks.onRead=e.onRead||(()=>{}),this.currentPosition={},this.currentOrientation="across",this.maxScore=null,this.cells=this.buildCells(this.params.dimensions,this.params.words),this.content=this.buildGrid(this.params),[].concat(...this.cells).filter((t=>null!==t.getSolution()))[0].setTabIndex("0"),this.content.addEventListener("keydown",(t=>{if(this.disabled)return;let e,s,o=t.target;switch(t.target.classList.contains("h5p-crossword-cell-content")&&(o=t.target.parentNode.parentNode),t.key){case"ArrowRight":t.preventDefault(),this.setcurrentOrientation("across",{row:parseInt(o.dataset.row),column:parseInt(o.dataset.col)+1}),this.moveTo({row:parseInt(o.dataset.row),column:parseInt(o.dataset.col)+1});break;case"ArrowLeft":t.preventDefault(),this.setcurrentOrientation("across",{row:parseInt(o.dataset.row),column:parseInt(o.dataset.col)-1}),this.moveTo({row:parseInt(o.dataset.row),column:parseInt(o.dataset.col)-1});break;case"ArrowDown":t.preventDefault(),this.setcurrentOrientation("across",{row:parseInt(o.dataset.row)+1,column:parseInt(o.dataset.col)}),this.moveTo({row:parseInt(o.dataset.row)+1,column:parseInt(o.dataset.col)});break;case"ArrowUp":t.preventDefault(),this.setcurrentOrientation("across",{row:parseInt(o.dataset.row)-1,column:parseInt(o.dataset.col)}),this.moveTo({row:parseInt(o.dataset.row)-1,column:parseInt(o.dataset.col)});break;case"Home":t.preventDefault(),t.ctrlKey?this.moveTo({row:0,column:0}):this.moveTo({row:parseInt(o.dataset.row),column:0});break;case"End":t.preventDefault(),t.ctrlKey?this.moveTo({row:this.params.dimensions.rows-1,column:this.params.dimensions.columns-1}):this.moveTo({row:parseInt(o.dataset.row),column:document.querySelector(`[data-row="${o.dataset.row}"]:last-of-type`).dataset.col});break;case"PageUp":t.preventDefault(),e=0;do{s=this.moveTo({row:e,column:o.dataset.col}),e++}while(!1===s);break;case"PageDown":t.preventDefault(),e=this.params.dimensions.rows-1;do{s=this.moveTo({row:e,column:o.dataset.col}),e--}while(!1===s)}}))}var e=t.prototype;return e.getDOM=function(){return this.content},e.buildCells=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const o=s.createArray(t.rows,t.columns);for(let e=0;e<t.rows;e++)for(let s=0;s<t.columns;s++)o[e][s]={row:e,column:s,solution:null,id:null};e.forEach((t=>{let e=t.starty-1,s=t.startx-1;for(let n=0;n<t.answer.length;n++)"none"!==t.orientation&&(o[e][s]={row:e,column:s,solution:t.answer.substring(n,n+1),solutionLength:t.answer.length,solutionIndex:n+1,clue:t.clue,clueIdAcross:"across"===t.orientation?t.clueId:o[e][s].clueIdAcross,clueIdDown:"down"===t.orientation?t.clueId:o[e][s].clueIdDown,clueIdMarker:0===n?t.clueId:o[e][s].clueIdMarker},"down"===t.orientation?e++:s++)}));const n=s.createArray(t.rows,t.columns);return[].concat(...o).forEach((e=>{n[e.row][e.column]=new r({row:e.row,column:e.column,solution:e.solution,solutionIndex:e.solutionIndex,solutionLength:e.solutionLength,width:100/t.columns,clueIdMarker:e.clueIdMarker,clue:e.clue,clueIdAcross:e.clueIdAcross,clueIdDown:e.clueIdDown,instantFeedback:this.params.instantFeedback,applyPenalties:this.params.applyPenalties,hasBackgroundImage:!!this.params.theme.backgroundImage,theme:this.params.theme,a11y:{correct:this.params.a11y.correct,wrong:this.params.a11y.wrong,empty:this.params.a11y.empty}},{onClick:t=>{this.handleCellClick(t)},onFocus:(t,e)=>{this.handleCellFocus(t,e)},onKeyup:(t,e)=>{this.handleCellKeyup(t,e??!1)},onRead:t=>{this.callbacks.onRead(t)}})})),n},e.findSolutionWordCells=function(t){if(!t||""===t)return[];const e=[];let o=!0,n=[].concat(...this.cells).filter((t=>null!==t.getSolution()));return t.split("").forEach((t=>{if(!1===o)return;const i=s.shuffleArray(n.filter((s=>s.getSolution()===t&&-1===e.indexOf(s))));0!==i.length?e.push(i[0]):o=!1})),e.length===t.length?e:[]},e.addSolutionWord=function(t){if(!t||""===t)return!1;const e=this.findSolutionWordCells(t);return e.forEach(((t,e)=>{t.addSolutionWordIdMarker(e+1)})),e.length>0},e.buildGrid=function(t){const e=document.createElement("table");if(e.classList.add("h5p-crossword-grid"),e.style.backgroundColor=t.theme.backgroundColor,e.style.maxWidth=`calc(2 * ${t.dimensions.columns} * 32px)`,t.theme.backgroundImage){e.classList.add("h5p-crossword-grid-background-image");const s=document.createElement("img");H5P.setSource(s,t.theme.backgroundImage,t.contentId),e.style.backgroundImage=`url('${s.src}')`}e.setAttribute("role","grid"),e.setAttribute("aria-label",this.params.a11y.crosswordGrid);const s=document.createElement("tbody");s.setAttribute("role","rowgroup");for(let e=0;e<t.dimensions.rows;e++){const o=this.buildGridRow(t.dimensions,e);s.appendChild(o)}return e.appendChild(s),e},e.buildGridRow=function(t,e){const s=document.createElement("tr");s.setAttribute("role","row");for(let o=0;o<t.columns;o++)s.appendChild(this.cells[e][o].getDOM());return s},e.moveTo=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.row<0||t.row>this.params.dimensions.rows-1)return!1;if(t.column<0||t.column>this.params.dimensions.columns-1)return!1;if(null===this.cells[t.row][t.column].getSolution())return!1;const s=this.cells[t.row][t.column];return!!s&&([].concat(...this.cells).forEach((t=>{t.setTabIndex("-1")})),s.setTabIndex("0"),this.currentPosition=t,this.focusCell(t,e),!0)},e.getUpdates=function(t){const e=[],s="across"===this.currentOrientation?"down":"across",o=this.cells[t.row][t.column].getClueId(s);if(o){const t=[].concat(...this.cells).filter((t=>t.getClueId(s)===o)).reduce(((t,e)=>t+(e.answer||" ")),"").replace(/[\s\uFEFF\xA0]+$/g,"");e.push({clueId:o,orientation:s,text:t})}const n=this.cells[t.row][t.column].getClueId(this.currentOrientation),i=[].concat(...this.cells).filter((t=>t.getClueId(this.currentOrientation)===n)).reduce(((t,e)=>t+(e.answer||" ")),"").replace(/[\s\uFEFF\xA0]+$/g,"");return e.push({clueId:n,orientation:this.currentOrientation,text:i}),e},e.getAnswers=function(){return[].concat(...this.cells).map((t=>t.getAnswer()))},e.setAnswers=function(t){[].concat(...this.cells).forEach(((e,s)=>{if(e.setAnswer(t[s]||""),e.getSolution()){const t=e.getInformation();this.callbacks.onInput({answer:t.answer,inputFieldUpdates:this.getUpdates(t.position),clueId:t.clueId,solutionWordId:t.solutionWordId||null,checkFilled:!0})}}))},e.getScore=function(){let t;return t=this.params.scoreWords?this.params.words.reduce(((t,e)=>t+this.getWordScore(e.clueId,e.orientation)),0):[].concat(...this.cells).reduce(((t,e)=>t+(e.getScore()||0)),0),Math.max(0,t)},e.getMaxScore=function(){return this.params.scoreWords?this.maxScore=this.params.words.length:this.maxScore=this.maxScore||[].concat(...this.cells).reduce(((t,e)=>t+(void 0!==e.getScore()?1:0)),0),this.maxScore},e.getWordScore=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"across";const s=this.getWordInformation(t,e),o=s.reduce(((t,e)=>{if(-1===t||-1===e.score)return-1;return t+(1===e.score||void 0===e.score?1:0)}),0);return-1===o?-1:o===s.length?1:0},e.setcurrentOrientation=function(t,e){if("across"!==t&&"down"!==t)return;if("number"!=typeof(e=e||this.currentPosition).row||"number"!=typeof e.column)return;if(e.row<0||e.row>this.params.dimensions.rows-1)return;if(e.column<0||e.column>this.params.dimensions.columns-1)return;if(!this.cells[e.row][e.column].getSolution())return;const s=e.column>0&&this.cells[e.row][e.column-1].getSolution(),o=e.column<this.params.dimensions.columns-1&&this.cells[e.row][e.column+1].getSolution(),n=e.row>0&&this.cells[e.row-1][e.column].getSolution(),i=e.row<this.params.dimensions.rows-1&&this.cells[e.row+1][e.column].getSolution();return"across"!==t||s||o?("down"!==t||n||i)&&(s||o||n||i)||(t="across"):t="down",this.currentOrientation=t,t},e.reset=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=!1;return[].concat(...this.cells).forEach((s=>{e=s.reset({keepCorrectAnswers:t.keepCorrectAnswers})||e})),this.currentPosition={},this.currentOrientation="across",this.maxScore=null,e},e.resize=function(){const t=this.content.clientWidth/this.params.dimensions.columns;return this.content.style.fontSize=t/2+"px",this.content.getBoundingClientRect()},e.handleCellClick=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const s=this.cells[t.row][t.column];s.getSolution()&&(e||(s.getClueId("across")?this.currentPosition.row===t.row&&this.currentPosition.column===t.column&&"across"===this.currentOrientation?this.setcurrentOrientation("down",t):this.setcurrentOrientation("across",t):this.setcurrentOrientation("down",t)),this.currentPosition.row===t.row&&this.currentPosition.column===t.column||(this.currentPosition=t,this.moveTo(t,!0)))},e.handleCellFocus=function(t,e){this.cells[t.row][t.column].getSolution()&&(e.relatedTarget&&(e.relatedTarget.classList.contains("h5p-crossword-cell")||e.relatedTarget.classList.contains("h5p-crossword-cell-content"))||(this.setcurrentOrientation(this.currentOrientation,t),this.handleCellClick(t,!0,!1)))},e.handleCellKeyup=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];void 0===t.nextPositionOffset&&(t.nextPositionOffset=1),e||((!this.currentOrientation||"across"===this.currentOrientation)&&t.position.column+t.nextPositionOffset>=0&&t.position.column+t.nextPositionOffset<this.params.dimensions.columns&&this.cells[t.position.row][t.position.column+t.nextPositionOffset].getSolution()?(this.currentOrientation="across",this.focusCell({row:t.position.row,column:t.position.column+t.nextPositionOffset})):(!this.currentOrientation||"down"===this.currentOrientation)&&t.position.row+t.nextPositionOffset>=0&&t.position.row+t.nextPositionOffset<this.params.dimensions.rows&&this.cells[t.position.row+t.nextPositionOffset][t.position.column].getSolution()&&(this.currentOrientation="down",this.focusCell({row:t.position.row+t.nextPositionOffset,column:t.position.column}))),this.callbacks.onInput({answer:t.answer,inputFieldUpdates:this.getUpdates(t.position),clueId:t.clueId,solutionWordId:t.solutionWordId||null,checkFilled:!0},e)},e.showSolutions=function(){[].concat(...this.cells).forEach((t=>{t.showSolutions()}))},e.checkAnswerWords=function(){const t=this.params.words.map((t=>({clueId:t.clueId,orientation:t.orientation,answer:t.answer,score:this.getWordScore(t.clueId,t.orientation)})));return[].concat(...this.cells).forEach((t=>{t.checkAnswer()})),t},e.checkAnswer=function(){const t=[];return[].concat(...this.cells).forEach((e=>{e.checkAnswer();const s=e.getInformation();s.solution&&t.push(s)})),t},e.highlightWord=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"across";const s=this.cells[t.row][t.column].getClueId(e);if(!s)return;const o=this.params.words.filter((t=>t.clueId===s&&t.orientation===e))[0];[].concat(...this.cells).filter((t=>t.getClueId(e)===s)).forEach(((t,n)=>{const i=t.getPosition(),r={row:i.row,column:i.column,clueId:s,orientation:e,clue:o.clue,position:n,length:o.answer.length};t.setAriaLabel(this.buildAriaLabel(r)),t.highlight("normal")}))},e.buildAriaLabel=function(t){return`${`${this.params.a11y.row} ${t.row+1}, ${this.params.a11y.column} ${t.column+1}`}. ${`${t.clueId} ${this.params.a11y[t.orientation]}. ${t.clue}`}, ${`${this.params.a11y.letterSevenOfNine.replace("@position",t.position+1).replace("@length",t.length)}`}.`},e.getFocus=function(){return{position:this.currentPosition,orientation:this.currentOrientation}},e.getWordInformation=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"across";return t?[].concat(...this.cells).filter((s=>s.getClueId(e)===t)).map((t=>t.getInformation())):""},e.focusCell=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.clearCellHighlights(),this.setcurrentOrientation(this.currentOrientation,t),this.highlightWord(t,this.currentOrientation),this.cells[t.row][t.column].highlight("focus"),this.callbacks.onFocus({clueId:this.cells[t.row][t.column].getClueId(this.currentOrientation),orientation:this.currentOrientation}),e||this.cells[t.row][t.column].focus()},e.clearCellHighlights=function(){[].concat(...this.cells).forEach((t=>{t.unhighlight()}))},e.fillGrid=function(t){let e=!1;const s=[].concat(...this.cells).filter((e=>e.getClueId(t.orientation)===t.clueId));if(s.forEach(((s,o)=>{const n=s.getAnswer();if(s.setAnswer(t.text[o]||"",-1!==t.readOffset&&o===t.cursorPosition-t.readOffset),e=e||n!==s.getAnswer(),s.getClueId("down")&&s.getClueId("across")){const e="across"===t.orientation?this.getWordInformation(s.getClueId("down"),"down"):this.getWordInformation(s.getClueId("across"),"across"),o=[{clueId:"across"===t.orientation?s.getClueId("down"):s.getClueId("across"),orientation:"across"===t.orientation?"down":"across",text:e.reduce(((t,e)=>`${t}${e.answer||" "}`),"")}];this.callbacks.onInput({inputFieldUpdates:o})}const i=s.getInformation();i.solutionWordId&&this.callbacks.onInput(i)})),t.cursorPosition<s.length){const e=s[t.cursorPosition].position;this.setcurrentOrientation(t.orientation,e),this.moveTo(e,!0)}this.callbacks.onInput({checkFilled:e})},e.enable=function(){[].concat(...this.cells).forEach((t=>{t.enable()})),this.disabled=!1},e.disable=function(){this.disabled=!0,[].concat(...this.cells).forEach((t=>{t.disable()}))},e.isFilled=function(){return![].concat(...this.cells).some((t=>!1===t.isFilled()))},e.unhighlight=function(){[].concat(...this.cells).forEach((t=>{t.unhighlight("focus"),t.unhighlight("normal"),this.params.instantFeedback||t.setSolutionState()}))},e.getXAPICorrectResponsesPattern=function(){return[`{case_matters=false}${this.params.words.map((t=>{const e=this.getWordInformation(t.clueId,t.orientation).map((t=>t.solution));return this.params.scoreWords?e.join(""):e.join("[,]")})).join("[,]")}`]},e.getXAPIResponse=function(){return this.params.words.map((t=>{const e=this.getWordInformation(t.clueId,t.orientation);return this.params.scoreWords?e.map((t=>t.answer||" ")).join(""):e.map((t=>t.answer||"")).join("[,]")})).join("[,]")},e.getXAPIDescription=function(){return this.params.words.map((e=>{const s=`${e.clueId} ${this.params.l10n[e.orientation]}: ${e.clue.replaceAll(/_{10,}/gi,"_________")}`,o=[];if(this.params.scoreWords)o.push(t.XAPI_PLACEHOLDER);else for(;o.length<e.answer.length;)o.push(t.XAPI_PLACEHOLDER);return`<p>${s}</ br>${o.join(" ")}</p>`})).join("")},t}();l.XAPI_PLACEHOLDER="__________";let a=function(){function t(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.solutionWord=s.toUpperCase(t.solutionWord.replace(/\s/g,""),s.UPPERCASE_EXCEPTIONS),this.scaleWidth=Math.max(t.tableWidth,this.solutionWord.length),this.cells=this.createCells(this.solutionWord),this.content=this.createSolution(this.cells)}var e=t.prototype;return e.getDOM=function(){return this.content},e.createSolution=function(t){const e=document.createElement("div");e.classList.add("h5p-crossword-solution-word-wrapper");const s=document.createElement("table");s.classList.add("h5p-crossword-solution-word"),s.setAttribute("aria-hidden",!0),e.appendChild(s);const o=document.createElement("tr");return t.forEach((t=>{o.appendChild(t.getDOM())})),s.appendChild(o),e},e.createCells=function(t){const e=s.createArray(t.length);return t.split("").forEach(((s,o)=>{e[o]=new r({width:100/t.length,solution:t[o],clueIdMarker:o+1}),e[o].disable()})),e},e.setCell=function(t,e){this.cells[t].setAnswer(e||"")},e.showSolutions=function(){this.cells.forEach((t=>{t.showSolutions()}))},e.reset=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.cells.forEach((e=>{t.keepCorrectAnswers&&"correct"===e.getSolutionState()||e.reset()}))},e.resize=function(){const t=this.content.clientWidth/this.scaleWidth;this.content.style.fontSize=t/2+"px",this.cells.forEach((e=>{e.setWidth(t)}))},t}(),c=function(){function t(e){this.params=s.extend({words:[{answer:"BAT",clue:"BAT"},{answer:"CAT",clue:"CAT"}],config:{poolSize:0}},e||{}),this.params.words=this.params.words.filter((t=>t.answer&&t.clue)).map((t=>{const e={answer:s.toUpperCase(t.answer,s.UPPERCASE_EXCEPTIONS),clue:t.clue,extraClue:t.extraClue};return t.fixWord&&void 0!==t.row&&void 0!==t.column&&void 0!==t.orientation&&(e.row=t.row-1,e.column=t.column-1,e.orientation=t.orientation),e})),this.indexChar={},this.badWords=[],this.cells=s.createArray(t.GRID_ROWS,t.GRID_COLUMNS),this.wordElements=this.createWordElements(this.params.words,this.params.config.poolSize)}var e=t.prototype;return e.getSquareGrid=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=null,s=0;for(let o=0;o<t;o++){const t=this.getGrid();if(null===t)continue;const o=1*Math.min(t.length,t[0].length)/Math.max(t.length,t[0].length);if(o>s&&(e=t,s=o),1===s)break}return e},e.getGrid=function(){let t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;for(let s=0;s<e;s++){this.resetGrid();const e=this.wordElements.filter((t=>void 0!==t.row));if(e.length>0){if(e.forEach((t=>{if(!1===this.canPlaceAnswerAt(t.answer,{row:t.row,column:t.column,orientation:t.orientation})){return this.badWords.some((e=>Object.keys(e).every((s=>e[s]===t[s]))))||this.badWords.push(t),null}this.placeAnswerAt(t,{row:t.row,column:t.column,orientation:t.orientation})})),e.length>=this.params.config.poolSize||e.length===this.wordElements.length)return this.minimizeGrid()}else{let t=Math.floor(this.cells.length/2),e=Math.floor(this.cells[0].length/2);const s=this.wordElements[0],o=this.getRandomOrientation();if("across"===o?e-=Math.floor(s.answer.length/2):t-=Math.floor(s.answer.length/2),!1===this.canPlaceAnswerAt(s.answer,{row:t,column:e,orientation:o})){return this.badWords.some((t=>Object.keys(t).every((e=>t[e]===s[e]))))||this.badWords.push(s),null}this.placeAnswerAt(s,{row:t,column:e,orientation:o})}this.groups=[],e.length>0?this.groups.push(this.wordElements.slice(e.length)):this.groups.push(this.wordElements.slice(1));for(let e=0;e<this.groups.length;e++){t=!1;for(let s=0;s<this.groups[e].length;s++){const o=this.groups[e][s],n=this.findPositionForWord(o.answer);n?(this.placeAnswerAt(o,n),t=!0):(this.groups.length-1===e&&this.groups.push([]),this.groups[e+1].push(o))}if(!t)break}if(t)return this.minimizeGrid()}return this.badWords=this.groups[this.groups.length-1],null},e.getBadWords=function(){return this.badWords},e.getRandomOrientation=function(){return Math.floor(2*Math.random())?"across":"down"},e.minimizeGrid=function(){let e=t.GRID_ROWS-1,o=0,n=t.GRID_COLUMNS-1,i=0;for(let s=0;s<t.GRID_ROWS;s++)for(let r=0;r<t.GRID_COLUMNS;r++){null!==this.cells[s][r]&&(s<e&&(e=s),s>o&&(o=s),r<n&&(n=r),r>i&&(i=r))}const r=o-e+1,l=i-n+1,a=s.createArray(r,l);for(let t=e,s=0;s<r;t++,s++)for(let e=n,o=0;o<l;e++,o++)a[s][o]=this.cells[t][e];return a},e.addCellToGrid=function(t,e,s){const o=t.answer.charAt(s);null===this.cells[e.row][e.column]&&(this.cells[e.row][e.column]={char:o},this.indexChar[o]=this.indexChar[o]||[],this.indexChar[o].push({row:e.row,column:e.column})),this.cells[e.row][e.column][e.orientation]={isStartOfWord:0===s,index:t.index}},e.placeAnswerAt=function(t,e){if("across"===e.orientation)for(let s=e.column,o=0;s<e.column+t.answer.length;s++,o++)this.addCellToGrid(t,{row:e.row,column:s,orientation:e.orientation},o);else{if("down"!==e.orientation)throw"Invalid orientation";for(let s=e.row,o=0;s<e.row+t.answer.length;s++,o++)this.addCellToGrid(t,{row:s,column:e.column,orientation:e.orientation},o)}},e.canPlaceCharAt=function(t,e){return null===this.cells[e.row][e.column]?0:this.cells[e.row][e.column].char===t&&1},e.canPlaceAnswerAt=function(t,e){if(e.row<0||e.row>=this.cells.length||e.column<0||e.column>=this.cells[e.row].length)return!1;if("across"===e.orientation){for(let s=0;s<t.length;s++){const o=this.cells[e.row][e.column+s];if(!o||o.char!==t[s])break;if(s===t.length-1)return!1}if(e.column+t.length>this.cells[e.row].length)return!1;if(e.column-1>=0&&null!==this.cells[e.row][e.column-1])return!1;if(e.column+t.length<this.cells[e.row].length&&null!==this.cells[e.row][e.column+t.length])return!1;for(let s=e.row-1,o=e.column,n=0;s>=0&&o<e.column+t.length;o++,n++){const i=null===this.cells[s][o],r=null!==this.cells[e.row][o]&&this.cells[e.row][o].char===t.charAt(n);if(!i&&!r)return!1}for(let s=e.row+1,o=e.column,n=0;s<this.cells.length&&o<e.column+t.length;o++,n++){const i=null===this.cells[s][o],r=null!==this.cells[e.row][o]&&this.cells[e.row][o].char===t.charAt(n);if(!i&&!r)return!1}for(let s=e.column,o=0;s<e.column+t.length;s++,o++){if(!1===this.canPlaceCharAt(t.charAt(o),{row:e.row,column:s}))return!1}}else{if("down"!==e.orientation)throw"Invalid Orientation";for(let s=0;s<t.length;s++){const o=this.cells[e.row+s][e.column];if(!o||o.char!==t[s])break;if(s===t.length-1)return!1}if(e.row+t.length>this.cells.length)return!1;if(e.row-1>=0&&null!==this.cells[e.row-1][e.column])return!1;if(e.row+t.length<this.cells.length&&null!==this.cells[e.row+t.length][e.column])return!1;for(let s=e.column-1,o=e.row,n=0;s>=0&&o<e.row+t.length;o++,n++){const i=null===this.cells[o][s],r=null!==this.cells[o][e.column]&&this.cells[o][e.column].char===t.charAt(n);if(!(i||r))return!1}for(let s=e.column+1,o=e.row,n=0;o<e.row+t.length&&s<this.cells[o].length;o++,n++){const i=null===this.cells[o][s],r=null!==this.cells[o][e.column]&&this.cells[o][e.column].char===t.charAt(n);if(!(i||r))return!1}for(let s=e.row,o=0;s<e.row+t.length;s++,o++){if(!1===this.canPlaceCharAt(t.charAt(o,1),{row:s,column:e.column}))return!1}}return!0},e.findPositionForWord=function(t){const e=[];for(let s=0;s<t.length;s++){const o=this.indexChar[t.charAt(s)];if(o)for(let n=0;n<o.length;n++){const i=o[n],r=i.row,l=i.column,a=this.canPlaceAnswerAt(t,{row:r,column:l-s,orientation:"across"}),c=this.canPlaceAnswerAt(t,{row:r-s,column:l,orientation:"down"});!1!==a&&e.push({intersections:a,row:r,column:l-s,orientation:"across"}),!1!==c&&e.push({intersections:c,row:r-s,column:l,orientation:"down"})}}return 0!==e.length&&e[Math.floor(Math.random()*e.length)]},e.resetGrid=function(){for(let t=0;t<this.cells.length;t++)for(let e=0;e<this.cells[t].length;e++)this.cells[t][e]=null;this.indexChar={}},e.createWordElements=function(t,e){e="number"!=typeof e||0===e?null:Math.max(2,e);let o=t.map(((t,e)=>(t.index=e,t)));if(e){const t=o.filter((t=>void 0!==t.row)),n=s.shuffleArray(o.filter((t=>void 0===t.row)));n.splice(Math.max(0,e-t.length),n.length),o=t.concat(n)}return o.sort(((t,e)=>{const s=void 0!==t.row?1:0,o=void 0!==e.row?1:0;return s<o?1:s>o?-1:e.answer.length-t.answer.length}))},e.getWordElement=function(t,e){if("number"!=typeof t)return null;const s=this.wordElements.filter((e=>e.index===t));return s.length<1?null:"string"!=typeof e?s[0]:s[0][e]},e.export=function(t){const e=t.length,s=t[0].length,o=[];let n=1;for(let i=0;i<e;i++)for(let e=0;e<s;e++){const s=t[i][e];null!==s&&(s.down&&s.down.isStartOfWord&&o.push({clue:this.getWordElement(s.down.index,"clue"),answer:this.getWordElement(s.down.index,"answer"),extraClue:this.getWordElement(s.down.index,"extraClue"),startx:e+1,starty:i+1,orientation:"down",clueId:n}),s.across&&s.across.isStartOfWord&&o.push({clue:this.getWordElement(s.across.index,"clue"),answer:this.getWordElement(s.across.index,"answer"),extraClue:this.getWordElement(s.across.index,"extraClue"),startx:e+1,starty:i+1,orientation:"across",clueId:n}),(s.down&&s.down.isStartOfWord||s.across&&s.across.isStartOfWord)&&n++)}return{rows:e,cols:s,result:o}},t}();c.GRID_ROWS=100,c.GRID_COLUMNS=100;let h=function(){function e(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(this.params=e,this.contentId=e.contentId,this.content=document.createElement("div"),this.content.classList.add("h5p-crossword-content"),this.callbacks=s||{},this.callbacks.onInitialized=s.onInitialized||(()=>{}),this.callbacks.onRead=s.onRead||(()=>{}),this.callbacks.onTableFilled=s.onTableFilled||(()=>{}),this.answerGiven=!1,this.params.previousState&&this.params.previousState.crosswordLayout)this.crosswordLayout=this.params.previousState.crosswordLayout;else{const t=[];let s,o;e.words.length<2?t.push(e.l10n.couldNotGenerateCrosswordTooFewWords):(s=new c({words:e.words,config:{poolSize:e.poolSize}}),o=s.getSquareGrid(20),o||t.push(e.l10n.couldNotGenerateCrossword));let n=s?.getBadWords();if(n?.length&&(n=n.map((t=>`${t.answer}`)).join(", "),t.push(e.l10n.problematicWords.replace(/@words/g,n))),t.length,!o){const e=document.createElement("div");return e.classList.add("h5p-crossword-message"),e.innerText=t.join(" "),this.content.appendChild(e),this.couldNotGenerateCrossword=!0,void this.callbacks.onInitialized(!1)}this.crosswordLayout=s.export(o)}const o=document.createElement("div");o.classList.add("h5p-crossword-table-wrapper"),this.clueAnnouncer=new t,o.appendChild(this.clueAnnouncer.getDOM()),this.table=new l({scoreWords:this.params.scoreWords,applyPenalties:this.params.applyPenalties,theme:this.params.theme,contentId:this.contentId,dimensions:{rows:this.crosswordLayout.rows,columns:this.crosswordLayout.cols},instantFeedback:this.params.instantFeedback,solutionWord:this.params.solutionWord,words:this.crosswordLayout.result,a11y:this.params.a11y,l10n:{across:this.params.l10n.across,down:this.params.l10n.down}},{onInput:(t,e)=>{this.handleTableInput(t,e)},onFocus:t=>{this.handleTableFocus(t)},onRead:t=>{this.callbacks.onRead(t)}}),o.appendChild(this.table.getDOM()),this.content.appendChild(o);const n=this.table.addSolutionWord(this.params.solutionWord);""!==this.params.solutionWord&&n&&(this.solutionWord=new a({solutionWord:this.params.solutionWord,tableWidth:this.crosswordLayout.cols}),o.appendChild(this.solutionWord.getDOM())),this.inputarea=new i({words:this.crosswordLayout.result.filter((t=>"none"!==t.orientation)),contentId:this.contentId,overlayContainer:this.content,applyPenalties:this.params.applyPenalties,l10n:{across:this.params.l10n.across,down:this.params.l10n.down,extraClue:this.params.l10n.extraClue,closeWindow:this.params.l10n.closeWindow},a11y:this.params.a11y},{onFieldInput:t=>{this.handleFieldInput(t)},onRead:t=>{this.callbacks.onRead(t)}}),this.content.appendChild(this.inputarea.getDOM()),this.params.previousState.cells&&(this.table.setAnswers(this.params.previousState.cells),this.answerGiven=!0),this.params.previousState.focus&&this.params.previousState.focus.position&&this.params.previousState.focus.position.row&&(this.table.setcurrentOrientation(this.params.previousState.focus.orientation,this.params.previousState.focus.position),this.table.focusCell(this.params.previousState.focus.position)),this.overrideCSS(this.params.theme),this.callbacks.onInitialized(!0)}var s=e.prototype;return s.getDOM=function(){return this.content},s.resize=function(){if(!this.table)return;const t=this.table.resize();this.inputarea.resize({height:t.height}),this.solutionWord&&this.solutionWord.resize()},s.getXAPICorrectResponsesPattern=function(){return this.table.getXAPICorrectResponsesPattern()},s.getXAPIResponse=function(){return this.table.getXAPIResponse()},s.getXAPIDescription=function(){return this.table.getXAPIDescription()},s.reset=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.params.words.length<2)return;this.inputarea.reset();const e=this.table.reset({keepCorrectAnswers:t.keepCorrectAnswers});this.solutionWord&&this.solutionWord.reset({keepCorrectAnswers:t.keepCorrectAnswers}),this.answerGiven=e},s.getAnswerGiven=function(){return this.answerGiven},s.getScore=function(){return this.params.words.length<2?0:this.table.getScore()},s.getMaxScore=function(){return this.params.words.length<2?0:this.table.getMaxScore()},s.getCurrentState=function(){if(this.params.words.length<2||!this.table)return;const t=this.table.getAnswers(),e=this.table.getFocus();return t.some((t=>void 0!==t))||void 0!==e.position.row?{crosswordLayout:this.crosswordLayout,cells:t,focus:e}:void 0},s.checkAnswer=function(){if(this.disable(),this.params.scoreWords){const t=this.table.checkAnswerWords();this.inputarea.checkAnswerWords(t)}else{const t=this.table.checkAnswer();this.inputarea.checkAnswer(t)}},s.isTableFilled=function(){return this.table&&this.table.isFilled()},s.showSolutions=function(){this.params.words.length<2||(this.disable(),this.table.showSolutions(),this.solutionWord&&this.solutionWord.showSolutions(),this.inputarea.showSolutions(this.crosswordLayout.result))},s.handleFieldInput=function(t){this.table.fillGrid(t),this.answerGiven=!0},s.handleTableInput=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.solutionWord&&t.solutionWordId&&this.solutionWord.setCell(t.solutionWordId-1,t.answer),t.inputFieldUpdates&&this.inputarea.fillFields(t.inputFieldUpdates),this.answerGiven=!0,t.checkFilled&&this.isTableFilled()&&!e&&this.callbacks.onTableFilled()},s.handleTableFocus=function(t){const e=this.crosswordLayout.result.filter((t=>"none"!==t.orientation)).filter((e=>e.orientation===t.orientation&&e.clueId===t.clueId));e.length>0&&this.clueAnnouncer.setClue({clue:e[0].clue,orientation:this.params.l10n[e[0].orientation],clueId:e[0].clueId,answerLength:e[0].answer.length}),this.inputarea.focusClue(t)},s.enable=function(){this.table.enable(),this.inputarea.enable()},s.disable=function(){this.table.disable(),this.table.unhighlight(),this.inputarea.disable(),this.inputarea.unhighlight(),this.clueAnnouncer.reset()},s.overrideCSS=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.gridColor&&this.addStyle(`.h5p-crossword .h5p-crossword-grid th, .h5p-crossword .h5p-crossword-grid td,.h5p-crossword .h5p-crossword-grid{border-color:${t.gridColor}};`),t.cellBackgroundColor&&(this.addStyle(`.h5p-crossword .h5p-crossword-cell{background-color:${t.cellBackgroundColor}};`),this.addStyle(`.h5p-crossword .h5p-crossword-cell-clue-id-marker{background-color:${t.cellBackgroundColor}};`)),t.clueIdColor&&this.addStyle(`.h5p-crossword .h5p-crossword-cell-clue-id-marker{color:${t.clueIdColor}};`),t.cellColor&&this.addStyle(`.h5p-crossword .h5p-crossword-cell-canvas{color:${t.cellColor}};`),t.cellBackgroundColorHighlight&&(this.addStyle(`.h5p-crossword .h5p-crossword-cell:not(.h5p-crossword-solution-correct):not(.h5p-crossword-solution-wrong):not(.h5p-crossword-solution-neutral).h5p-crossword-highlight-normal{background-color:${t.cellBackgroundColorHighlight}};`),this.addStyle(`.h5p-crossword .h5p-crossword-cell.h5p-crossword-highlight-normal .h5p-crossword-cell-clue-id-marker, .h5p-crossword .h5p-crossword-cell.h5p-crossword-highlight-normal .h5p-crossword-cell-solution-word-marker{background-color:${t.cellBackgroundColorHighlight}}`),this.addStyle(`.h5p-crossword .h5p-crossword-input-fields-group-wrapper-clue.h5p-crossword-input-fields-group-clue-highlight-focus .h5p-crossword-input-fields-group-clue-id{background-color:${t.cellBackgroundColorHighlight}}`)),t.clueIdColorHighlight&&this.addStyle(`.h5p-crossword .h5p-crossword-cell.h5p-crossword-highlight-normal .h5p-crossword-cell-clue-id-marker, .h5p-crossword .h5p-crossword-cell.h5p-crossword-highlight-normal .h5p-crossword-cell-solution-word-marker{color:${t.clueIdColorHighlight}}`),t.cellColorHighlight&&(this.addStyle(`.h5p-crossword .h5p-crossword-cell.h5p-crossword-highlight-normal .h5p-crossword-cell-canvas{color:${t.cellColorHighlight}};`),this.addStyle(`.h5p-crossword .h5p-crossword-input-fields-group-wrapper-clue.h5p-crossword-input-fields-group-clue-highlight-focus .h5p-crossword-input-fields-group-clue-id{color:${t.cellColorHighlight}}`))},s.addStyle=function(t){const e=document.createElement("style");e.appendChild(document.createTextNode(t)),document.querySelector("head").appendChild(e)},e}();function u(t,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},u(t,e)}let d=function(t){function e(e,o){var n;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(n=t.call(this,"crossword")||this).params=e,n.contentId=o,n.extras=i,n.params=s.extend({solutionWord:"",theme:{backgroundColor:"#173354"},behaviour:{enableSolutionsButton:!0,enableRetry:!0,enableInstantFeedback:!1,scoreWords:!0,applyPenalties:!1,keepCorrectAnswers:!1},l10n:{across:"across",down:"down",checkAnswer:"Check answer",couldNotGenerateCrossword:"Could not generate a crossword with the given words. Please try again with fewer words or words that have more characters in common.",couldNotGenerateCrosswordTooFewWords:"Could not generate a crossword. You need at least two words.",problematicWords:"Some words could not be placed. If you are using fixed words, please make sure that their position doesn't prevent other words from being placed. Words with the same alignment may not be placed touching each other. Problematic word(s): @words",showSolution:"Show solution",tryAgain:"Retry",extraClue:"Extra clue",closeWindow:"Close window",submitAnswer:"Submit"},a11y:{crosswordGrid:"Crossword grid. Use arrow keys to navigate and the keyboard to enter characters. Alternatively, use Tab to navigate to type the answers in Fill in the Blanks style fields instead of the grid.",column:"column",row:"row",across:"across",down:"down",empty:"Empty",resultFor:"Result for: @clue",correct:"Correct",wrong:"Wrong",point:"Point",solutionFor:"The solution for @clue is: @solution",extraClueFor:"Open extra clue for @clue",letterSevenOfNine:"Letter @position of @length",lettersWord:"@length letter word",check:"Check the characters. The responses will be marked as correct, incorrect, or unanswered.",showSolution:"Show the solution. The crossword will be filled with its correct solution.",retry:"Retry the task. Reset all responses and start the task over again.",yourResult:"You got @score out of @total points"}},n.params),n.params.keepCorrectAnswers=n.params.behaviour.enableRetry&&n.params.behaviour.keepCorrectAnswers,n.params.theme=n.getDifference(n.params.theme,{gridColor:"#000000",cellBackgroundColor:"#ffffff",cellColor:"#000000",clueIdColor:"#606060",cellBackgroundColorHighlight:"#3e8de8",cellColorHighlight:"#ffffff",clueIdColorHighlight:"#e0e0e0"}),n.initialButtons={check:!n.params.behaviour.enableInstantFeedback,showSolution:n.params.behaviour.enableSolutionsButton,retry:n.params.behaviour.enableRetry};const r=i.metadata&&i.metadata.defaultLanguage||"en";n.languageTag=s.formatLanguageCode(r);for(let t in n.params.l10n)n.params.l10n[t]=s.stripHTML(s.htmlDecode(n.params.l10n[t]));return n.params.a11y.yourResult=n.params.a11y.yourResult.replace(/\.$/,""),n.previousState=n.extras.previousState||{},n.previousState.crosswordLayout&&n.previousState.cells||(n.previousState={}),n.params.words=(n.params.words||[]).filter((t=>void 0!==t.answer&&void 0!==t.clue)).map((t=>(t.answer=s.stripHTML(s.htmlDecode(s.toUpperCase(t.answer,s.UPPERCASE_EXCEPTIONS))),t.clue=s.stripHTML(s.htmlDecode(t.clue)),t))),n.content=new h({scoreWords:n.params.behaviour.scoreWords,applyPenalties:n.params.behaviour.applyPenalties,theme:n.params.theme,contentId:n.contentId,instantFeedback:n.params.behaviour.enableInstantFeedback,l10n:{couldNotGenerateCrossword:n.params.l10n.couldNotGenerateCrossword,couldNotGenerateCrosswordTooFewWords:n.params.l10n.couldNotGenerateCrosswordTooFewWords,problematicWords:n.params.l10n.problematicWords,across:n.params.l10n.across,down:n.params.l10n.down,extraClue:n.params.l10n.extraClue,closeWindow:n.params.l10n.closeWindow},a11y:n.params.a11y,poolSize:n.params.behaviour.poolSize,solutionWord:s.toUpperCase(n.params.solutionWord.replace(/'\s'/g,""),s.UPPERCASE_EXCEPTIONS),words:n.params.words,previousState:n.previousState},{onTableFilled:()=>{n.handleContentFilled()},onInitialized:t=>{n.handleContentInitialized(t)},onRead:t=>{n.handleRead(t)}}),n}var o,n;n=t,(o=e).prototype=Object.create(n.prototype),o.prototype.constructor=o,u(o,n);var i=e.prototype;return i.registerDomElements=function(){this.setViewState("task"),this.params.taskDescription&&""!==this.params.taskDescription&&(this.introduction=document.createElement("div"),this.introduction.innerHTML=this.params.taskDescription,this.setIntroduction(this.introduction)),this.setContent(this.content.getDOM()),this.params.behaviour.enableInstantFeedback&&this.content.isTableFilled()&&this.checkAnswer(),s.waitForDOM(".h5p-crossword-input-container",(()=>{setTimeout((()=>{this.trigger("resize")}),100)}))},i.handleContentInitialized=function(t){t&&this.addButtons(),this.on("resize",(()=>{this.content.resize()}))},i.addButtons=function(){this.addButton("check-answer",this.params.l10n.checkAnswer,(()=>{this.checkAnswer(),this.trigger(this.getXAPIAnswerEvent())}),this.initialButtons.check,{"aria-label":this.params.a11y.check},{contentData:this.extras,textIfSubmitting:this.params.l10n.submitAnswer}),this.addButton("show-solution",this.params.l10n.showSolution,(()=>{this.showSolutions()}),this.initialButtons.showSolution,{"aria-label":this.params.a11y.showSolution},{}),this.addButton("try-again",this.params.l10n.tryAgain,(()=>{this.resetTask({keepCorrectAnswers:this.params.behaviour.keepCorrectAnswers})}),this.initialButtons.retry,{"aria-label":this.params.a11y.retry},{})},i.checkAnswer=function(){if(this.getViewState().id!==e.VIEW_STATES.task)return;if(!this.content)return;this.setViewState("results"),this.content.checkAnswer(),this.hideButton("check-answer");const t=this.getScore(),s=this.getMaxScore(),o=H5P.Question.determineOverallFeedback(this.params.overallFeedback,t/s),n=this.params.a11y.yourResult.replace("@score",":num").replace("@total",":total");this.setFeedback(o,t,s,n),this.params.behaviour.enableSolutionsButton&&this.showButton("show-solution"),this.params.behaviour.enableRetry&&this.showButton("try-again")},i.handleRead=function(t){this.read(t)},i.handleContentFilled=function(){this.getMaxScore()>0&&this.getScore()===this.getMaxScore()?(this.checkAnswer(),this.trigger(this.getXAPIAnswerEvent())):this.showButton("check-answer")},i.getAnswerGiven=function(){return!!this.content&&this.content.getAnswerGiven()},i.getScore=function(){return this.content?this.content.getScore():0},i.getMaxScore=function(){return this.content?this.content.getMaxScore():0},i.showSolutions=function(){this.content&&(this.setViewState("solutions"),this.hideButton("check-answer"),this.hideButton("show-solution"),this.content.showSolutions(),this.trigger("resize"))},i.resetTask=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.content&&(this.getViewState().id===e.VIEW_STATES.results&&this.getScore()!==this.getMaxScore()||(t.keepCorrectAnswers=!1),this.contentWasReset=!t.keepCorrectAnswers,this.initialButtons.check?this.showButton("check-answer"):this.hideButton("check-answer"),this.initialButtons.showSolution?this.showButton("show-solution"):this.hideButton("show-solution"),this.initialButtons.retry?this.showButton("try-again"):this.hideButton("try-again"),this.setViewState("task"),this.trigger("resize"),this.removeFeedback(),this.content.reset({keepCorrectAnswers:t.keepCorrectAnswers}),this.content.enable())},i.getXAPIData=function(){return{statement:this.getXAPIAnswerEvent().data.statement}},i.getXAPIAnswerEvent=function(){const t=this.createXAPIEvent("answered");return t.setScoredResult(this.getScore(),this.getMaxScore(),this,!0,this.isPassed()),t.data.statement.result.response=this.content.getXAPIResponse(),t},i.createXAPIEvent=function(t){const e=this.createXAPIEventTemplate(t);return s.extend(e.getVerifiedStatementValue(["object","definition"]),this.getxAPIDefinition()),e},i.getxAPIDefinition=function(){const t={name:{}};return t.name[this.languageTag]=this.getTitle(),t.name["en-US"]=t.name[this.languageTag],t.description={},t.description[this.languageTag]=`${this.getDescription()}`,t.description["en-US"]=t.description[this.languageTag],t.type="http://adlnet.gov/expapi/activities/cmi.interaction",t.interactionType="fill-in",t.correctResponsesPattern=this.content.getXAPICorrectResponsesPattern(),t},i.isPassed=function(){return this.getScore()>=this.getMaxScore()||!this.getMaxScore()||0===this.getMaxScore()},i.getTitle=function(){let t;return this.extras.metadata&&(t=this.extras.metadata.title),t=t||e.DEFAULT_DESCRIPTION,H5P.createTitle(t)},i.getDescription=function(){return`${this.params.taskDescription.replaceAll(/_{10,}/gi,"_________")||e.DEFAULT_DESCRIPTION}${this.content.getXAPIDescription()}`},i.getCurrentState=function(){return this.getAnswerGiven()?this.content.getCurrentState():this.contentWasReset?{}:void 0},i.getDifference=function(t,e){for(let s in e)t[s]===e[s]&&delete t[s];return t},i.getViewState=function(){let t="undefined";for(const s in e.VIEW_STATES)if(e.VIEW_STATES[s]===this.viewState){t=s;break}return{stateName:t,id:this.viewState}},i.setViewState=function(t){"string"==typeof t&&void 0!==e.VIEW_STATES[t]?this.viewState=e.VIEW_STATES[t]:"number"==typeof t&&Object.values(e.VIEW_STATES).includes(t)&&(this.viewState=t)},e}(H5P.Question);d.DEFAULT_DESCRIPTION="Crossword",d.VIEW_STATES={task:0,results:1,solutions:2},H5P.Crossword=d}();

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists