(function(S,P){typeof exports=="object"&&typeof module<"u"?P(exports):typeof define=="function"&&define.amd?define(["exports"],P):(S=typeof globalThis<"u"?globalThis:S||self,P(S.education={}))})(this,function(S){"use strict";const P="",b=e=>{const t=document.createElement("style");t.textContent=e,document.head.append(t)};function te(e){e&&(document.documentElement.style.setProperty("--themes-main-color",e),document.documentElement.style.setProperty("--themes-item-main-color",e))}function ne(){b(` .infoPanelDisplay { font-size: 20px; cursor: pointer; } .infoPanelDisplayBox { margin-right: 0.5rem; align-items: center; display: flex; } `);const e=document.createElement("div");e.classList.add("infoPanelDisplayBox");const t=document.createElement("i");return t.setAttribute("aria-hidden","true"),t.classList.add("fa"),t.classList.add("fa-bars"),t.classList.add("infoPanelDisplay"),t.addEventListener("click",()=>{const n=document.getElementById("eduInfoPanelTextBox");if(!n)return;const a=n.style.display;n.style.display=a==="none"?"inline-block":"none";const s=document.getElementById("eduInfoPanelReloadBox");if(!s)return;const o=s.style.display;s.style.display=o==="none"?"inline-block":"none"}),e.appendChild(t),e}function I(){localStorage.clear()}function ae(e){localStorage.removeItem(e)}function p(e,t){localStorage.setItem(e,JSON.stringify(t))}function d(e){const t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch{return t}else return null}function se(){b(` .infoPanelReload { font-size: 20px; cursor: pointer; } .infoPanelReloadBox { margin-right: 0.5rem; align-items: center; display: flex; max-width:30px; } `);const e=document.createElement("div");e.id="eduInfoPanelReloadBox",e.classList.add("infoPanelReloadBox");const t=document.createElement("i");return t.setAttribute("aria-hidden","true"),t.classList.add("fa"),t.classList.add("fa-refresh"),t.classList.add("infoPanelReload"),t.addEventListener("click",()=>{I(),window.location.href="/"}),e.appendChild(t),e}function oe(e){b(` .infoPanelText { font-size: 20px; margin-right: 0.5rem; } `);const t=document.createElement("div");t.id="eduInfoPanelTextBox";const n=document.createElement("label");return n.innerText=e,n.classList.add("infoPanelText"),t.appendChild(n),t}function ce(){if(!document.getElementById("task")&&!document.getElementById("eduInfoPanel")){const e=ie();if(!e)return;document.body.appendChild(e)}}function ie(){b(` #eduInfoPanel { padding: 0.5rem; position: fixed; top: 5rem; right: 20px; max-width: 400px; z-index: 10001; display: flex; border-width: 0.1em; border-style: solid; border-color: rgb(129, 91, 58); border-radius: 3px; background-color: rgba(255, 255, 255, 0.33); } `);const e=d("scenarioName")||"Scenario";if(!e)return;const t=document.createElement("div");t.id="eduInfoPanel";const n=ne(),a=oe(e),s=se();return t.appendChild(n),t.appendChild(a),t.appendChild(s),t}const Pt="",V={create:()=>{if(!document.getElementById("hint")){const t=document.createElement("div");t.id="hint",t.classList.add("edu-hint"),t.classList.add("hide"),document.body.appendChild(t)}},show:(e,t,n)=>{const a=document.getElementById("hint");a&&(a.innerText=e,a.classList.remove("hide"),a.classList.add("show"),a.style.left=`${t}px`,a.style.top=`${n}px`)},hide:()=>{const e=document.getElementById("hint");e&&(e.classList.remove("show"),e.classList.add("hide"))}},le={xpath:"getElementByXpath",id:"getElementById",name:"getElementsByName",tagName:"getElementsByTagName",className:"getElementsByClassName",querySelector:"querySelector"},w={TEXT:"text",CHECKED:"checked",BUTTON:"button",RADIO:"radio",ARIA_LIST:"aria-list",SPAN:"span"};function y(e,t){let n=[],a;if(e==="xpath")a=ue(t);else{const s=re(e,t);a=de(s)}return a&&(HTMLCollection.prototype.isPrototypeOf(a)?n=Array.from(e):NodeList.prototype.isPrototypeOf(a)?n=Array.prototype.slice.call(a):Array.isArray(a)?n=a:n.push(a)),n}function re(e,t){switch(e){case"id":case"name":case"tagName":case"className":case"querySelector":return`return document.${le[e]}("${t}")`;default:return null}}function de(e){let t=null;if(e==null)return t;try{t=Function(e)()}catch(n){console.log("selector error: "+n)}return t}function ue(e){try{const t=[],n=document.evaluate(e,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(let a=0;at&&(a=n.left,s=n.bottom+35),{x:a,y:s}}function he(e){return h.targets.find(t=>t.element===e)??null}function ve(){h.targets.length>30&&(h.targets=[]);for(const e of U){const t=y(e.selector.type,e.selector.value);for(const n of t)h.targets.find(s=>s.element===n)||h.targets.push({element:n,text:e.text})}}const Rt="";function F(){const e=document.createElement("div");e.classList.add("spinner-background");const t=document.createElement("div");return t.classList.add("lds-dual-ring"),e.appendChild(t),e}function ge(){const e=document.createElement("div");return e.id="task",e.classList.add("task-main-content"),e}const Dt="";function Ee(){const e=document.createElement("section");e.id="taskControllerPanel",e.classList.add("task-controller-panel");const t=d("scenario");if(!t)return e;const n=t.scenarioSelector.title,a=d("scenarioName");if(!a)return e;const s=document.createElement("div");s.classList.add("task-controller-panel-back");const o=document.createElement("i");o.setAttribute("aria-hidden","true"),o.classList.add("fa"),o.classList.add("fa-chevron-left"),o.classList.add("controller-item"),o.addEventListener("click",()=>{const r=document.getElementById("taskDescriptionPanel");if(!r)return;const u=document.getElementById("scenarioSelectorPanel");u&&(s.style.display="none",i.style.display="none",c.innerText=n,u.style.display="block",r.style.display="none")}),s.appendChild(o),e.appendChild(s);const c=document.createElement("div");c.innerText=a,c.classList.add("task-controller-panel-textSection"),e.appendChild(c);const i=document.createElement("div");i.id="task-controller-panel-close",i.classList.add("task-controller-panel-close");const l=document.createElement("i");return l.setAttribute("aria-hidden","true"),l.classList.add("fa"),l.classList.add("fa-times"),l.classList.add("controller-item"),i.appendChild(l),e.appendChild(i),l.addEventListener("click",()=>{Le()}),c.addEventListener("mousedown",()=>{p("isMouseTouched",!0)}),e}function Le(){const e=document.getElementById("mini-task-panel");e&&e.remove();const t=y("id","task");t[0].style.display="none";const n=document.createElement("div");n.id="mini-task-panel",n.classList.add("mini-task-panel");const a=document.createElement("i");a.setAttribute("aria-hidden","true"),a.classList.add("fa"),a.classList.add("fa-list-ul"),n.appendChild(a),document.body.appendChild(n),n.addEventListener("click",()=>{n.remove();const s=y("id","task");s[0].style.display="inline-table"})}const Ht="",$t="";function xe(){const e=document.createElement("section");return e.id="taskDescriptionPanel",e.classList.add("task-description-panel"),e}function q(e,t){t.classList.remove("fa-angle-up"),t.classList.add("fa-angle-down"),e.classList.remove("ps-active"),e.classList.add("ps-passive")}function X(e,t){t.classList.remove("fa-angle-down"),t.classList.add("fa-angle-up"),e.classList.remove("ps-passive"),e.classList.add("ps-active")}function ye(e){const t=document.createElement("section");t.id="taskPartSection",t.classList.add("task-part-section");const n=document.createElement("div");n.id="partSectionText",n.innerText=e,n.classList.add("task-part-section-text");const a=document.createElement("div");a.classList.add("task-part-section-expand-collapse");const s=document.createElement("i");return s.classList.add("fa"),s.classList.add("fa-down-left-and-up-right-to-center"),a.appendChild(s),a.addEventListener("click",()=>{const o=document.getElementsByClassName("part-section"),c=document.getElementsByClassName("part-view-shower-item");if(s.classList.contains("fa-down-left-and-up-right-to-center")){for(let i=0;i{const s=document.createElement("div");s.classList.add("part-view");const o=document.createElement("div");o.classList.add("part-view-header");const c=document.createElement("div");c.innerText=a.name,c.classList.add("part-view-name");const i=document.createElement("div");i.classList.add("part-view-shower");const l=document.createElement("i");l.setAttribute("aria-hidden","true"),l.classList.add("fa"),l.classList.add(n>1?"fa-angle-down":"fa-angle-up"),l.classList.add("part-view-shower-item"),i.appendChild(l),o.appendChild(c),o.appendChild(i),s.appendChild(o);const r=document.createElement("section");r.classList.add("part-section"),n>1&&r.classList.add("ps-passive");for(const u of a.tasks){const m=Se(u),f=ke(u.description,m.isSuccess,u.target.id);r.appendChild(f)}s.appendChild(r),t.appendChild(s),o.addEventListener("click",()=>{r.className==="part-section ps-passive"?X(r,l):q(r,l)}),n++}),t}function Se(e){const t={isSuccess:!1,value:""};return d(`${e.target.id}_state`)??t}const Vt="";function be(){const e=document.createElement("section");e.id="scenarioSelectorPanel",e.classList.add("scenario-selector-panel");const t=d("scenario");if(!t)return e;const n=t.scenarioSelector,a=d("scenarioNames")||[];if(!a)return e;const s=document.createElement("div");s.classList.add("scenario-select-section");let o=0;a==null||a.forEach(u=>{const m=document.createElement("div");m.classList.add("scenario-select-line"),m.setAttribute("part",o.toString()),m.innerText=u,m.addEventListener("click",()=>{const f=document.getElementsByClassName("scenario-select-line");for(const g of Array.from(f))g.classList.remove("scenario-select-line-active");m.classList.add("scenario-select-line-active")}),s.appendChild(m),o++});const c=document.createElement("div"),i=d("scenarioName");if(!i)return e;c.classList.add("scenario-select-footer");const l=document.createElement("div");l.innerText=n.cancelButtonText,l.classList.add("scenario-select-cancel"),l.addEventListener("click",()=>{const u=document.getElementById("taskDescriptionPanel");if(!u)return;const m=document.getElementById("scenarioSelectorPanel");if(!m)return;const f=document.getElementsByClassName("task-controller-panel-back"),g=document.getElementsByClassName("task-controller-panel-textSection"),E=document.getElementById("task-controller-panel-close");E&&(f[0].style.display="flex",g[0].innerText=i,u.style.display="block",E.style.display="block",m.style.display="none")});const r=document.createElement("div");return r.innerText=n.startButtonText,r.classList.add("scenario-select-start"),r.addEventListener("click",()=>{const u=document.getElementsByClassName("scenario-select-line scenario-select-line-active");if(u.length>0){const m=u[0].getAttribute("part");if(!m)return;const f=parseInt(m);I(),p("educationInProgress",!0),p("selectedScenarioIndex",f),p("scenarioNames",a),document.cookie=`scenarioID=${f}`,window.location.href="/"}}),c.appendChild(l),c.appendChild(r),e.appendChild(s),e.appendChild(c),e}let L;function we(){var e;return L=(e=d("actualPage"))==null?void 0:e.page,L==null||L.parts.length,(L==null?void 0:L.name)==="Default Page"}function Ie(){return!(d("endOfScenario")??!1)}function j(){const e=document.getElementById("task");e&&e.remove();const t=document.getElementById("mini-task-panel");t&&t.remove()}function Y(){Ie()?(j(),Be()):j()}function Be(){const e=we();if(!L)return;const t=ge(),n=Ee(),a=xe(),s=be();if(e){const o=F();a.appendChild(o)}else{const o=ye(L.name),c=Ce(L);a.appendChild(o),a.appendChild(c)}return t.appendChild(n),t.appendChild(a),t.appendChild(s),document.body.appendChild(t),t}const _t="";function Ne(){return Math.random().toString(36).substring(2,11)}const D="overlay-loader",Ae=function(){this.loaderId=Ne(),document.getElementById(D)||(window.loaders=[],this.loaderDiv=document.createElement("div"),this.loaderDiv.setAttribute("id",D),this.loaderDiv.appendChild(F()),document.body.appendChild(this.loaderDiv)),this.start=()=>{var e;window.loaders&&((e=document.getElementById(D))==null||e.classList.add("show"),window.loaders.push(this.loaderId))},this.stop=()=>{var e;window.loaders&&(window.loaders.splice(window.loaders.indexOf(this.loaderId),1),window.loaders.length<1&&((e=document.getElementById(D))==null||e.classList.remove("show")))}};function N(e){!e.sendMock||e.sendMock.pre||G(e)}function Pe(e){var t;(t=e==null?void 0:e.sendMock)!=null&&t.pre&&G(e)}function G(e){var o,c,i,l,r;const t=e.sendMock.url,n={method:(o=e.sendMock)==null?void 0:o.method,headers:(c=e.sendMock)==null?void 0:c.headers,mode:(i=e.sendMock)!=null&&i.mode?e.sendMock.mode:"cors",cache:(l=e.sendMock)!=null&&l.cache?e.sendMock.cache:"no-cache",body:(r=e.sendMock)!=null&&r.body?JSON.stringify(e.sendMock.body):null},a=new Request(t),s=new Ae;s.start(),fetch(a,n).then(u=>{console.log("Response from mock: ",u)}).catch(u=>{console.log("Error from mock: ",u.message)}).finally(()=>{s.stop()})}function T(){return{state:(n,a)=>{const s=document.getElementById(`stateView_${n.id}`),o=a==n.expectedValue.value;p(`${n.id}_state`,{isSuccess:o,value:a}),s&&(s.style.color=o?B:R)},check:n=>{if(d(n.id)!==n.expectedValue.value){const s=document.getElementById(`stateView_${n.id}`);ae(`${n.id}_state`),s&&(s.style.color=R)}}}}function Re(e,t,n,a){b(` .task-alt-hint::before, .task-alt-hint::after { --scale: 1; --tooltip-color: var(--themes-main-color); --arrow-size: 5px; --tooltip-font-size: 1em; --hint-top: ${t}px; --hint-left: ${n}px; --hint-width: ${a}px; z-index: 20000; position: fixed; } .task-alt-hint::before { text-align: center; content: attr(task-alt-hint-text); top: calc(var(--hint-top) + var(--arrow-size)); left: var(--hint-left); min-width: var(--hint-width); width: 80px; background-color: var(--tooltip-color); color: #ffff; font-size: var(--tooltip-font-size); font-weight: 600; padding-top: .5rem; padding-bottom: .5rem; border-radius: .3rem; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; } .task-alt-hint::after { content: ''; border: var(--arrow-size) solid transparent; border-bottom-color: var(--tooltip-color); top: calc(var(--hint-top) - var(--arrow-size)); left: calc((var(--hint-left) + var(--hint-width)/2) - var(--arrow-size) ); } `);const s=document.createElement("div");return s.id="taskAltHint",s.setAttribute("task-alt-hint-text",e),s.classList.add("task-alt-hint"),s}function J(){const e=(a,s,o)=>{a.onmouseover=()=>{t(),n(a,s)},a.onmouseout=()=>t(),a.onmouseleave=()=>t(),a.onblur=()=>t(),o&&a.addEventListener("click",()=>{t()})};function t(){const a=y("id","taskAltHint");for(const s of a)s.remove()}function n(a,s){const o=a.getBoundingClientRect(),c=o.top+o.height,i=o.left,l=o.width;let r="";s!=null&&s.hintText?r=s.hintText:r=s.value==="true"||s.value==="clicked"?"click":s.value;const u=Re(r,c,i,l);document.body.appendChild(u)}return{add:e}}const W={text:{event:"change",value:"value"},checked:{event:"change",value:"checked"},button:{event:"click",value:"clicked"},span:{event:"present",value:"innerText"},radio:{event:"change",value:"checked"},"aria-list":{event:"blur",value:"value"}},_=new Map;function K(e,t){const n=()=>{De(e,t)},a=()=>{$e(e,t)},s=()=>{He(e,t)},o=()=>{Ve(e,t)},c=()=>{_e(e,t)},i=()=>{Me(e,t)};return t.expectedValue.type===w.BUTTON&&T().check(t),t.expectedValue.enabledTaskHint&&J().add(e,t.expectedValue,!1),{setButtonPostHandler:n,setButtonHandler:a,setRadioButtonHandler:s,setAriaListHandler:o,setSpanHandler:c,setDefaultHandler:i}}function De(e,t){t.expectedValue.type===w.BUTTON&&(e.onclick=()=>{_.get(t.id),localStorage.setItem(t.id,"clicked"),T().state(t,"clicked"),N(t)},J().add(e,t.expectedValue,!0))}function He(e,t){const n=o=>{for(const c in o)if(o[c].checked)return o[c];return null},a=o=>{const c=document.getElementById(`stateView_${t.id}`);c&&(c.style.color=o?B:R)},s=()=>{const o=document.getElementsByName(e.name),c=n(o);(c==null?void 0:c.value)===t.expectedValue.value?(localStorage.setItem(t.id,c.value),p(`${t.id}_state`,{isSuccess:!0,value:c.value}),a(!0)):(p(`${t.id}_state`,{isSuccess:!1,value:e.value}),a(!1))};s(),e.onchange=()=>{s()}}function $e(e,t){var a,s;(((a=t.expectedValue)==null?void 0:a.clear)||((s=t.expectedValue)==null?void 0:s.clear)!==!1)&&localStorage.setItem(t.id,"no_clicked"),T().check(t),_.set(t.id,e.onclick),e.onclick=()=>{_.get(t.id),localStorage.setItem(t.id,"clicked"),T().state(t,"clicked"),N(t)}}function Ve(e,t){localStorage.setItem(t.id,e.value),T().state(t,e.value),e.addEventListener("blur",()=>{setTimeout(()=>{localStorage.setItem(t.id,e.value),T().state(t,e.value)},200),N(t)})}function _e(e,t){const n=e.innerText;localStorage.setItem(t.id,n),T().state(t,n),N(t)}function Me(e,t){localStorage.setItem(t.id,e.value),T().state(t,e.value),e.addEventListener(W[t.expectedValue.type].event,()=>{const n=`return event.target.${W[t.expectedValue.type].value}.toString()`,s=Function(n)();localStorage.setItem(t.id,s),T().state(t,s),N(t)})}const Q="edu-event-added";function Oe(e){const t=y(e.selector.type,e.selector.value);if(t.length)for(const n of t){let a;try{a=n.getAttribute(Q)}catch{return}a||(ze(n,e),Pe(e)),K(n,e).setButtonPostHandler()}}function ze(e,t){const n=K(e,t);switch(e.setAttribute(Q,"true"),t.expectedValue.type){case w.BUTTON:n.setButtonHandler();break;case w.RADIO:n.setRadioButtonHandler();break;case w.ARIA_LIST:n.setAriaListHandler();break;case w.SPAN:n.setSpanHandler();break;default:n.setDefaultHandler();break}}function Z(){const e=Ue();for(const t of e)Oe(t)}function Ue(){const t=d("actualPage").page.parts.map(a=>a.tasks),n=[];for(const a of t)for(const s of a)n.push(s.target);return n}const M={actualPage:null,index:0},Fe={page:{name:"Default Page",selector:{type:"id",value:"defaultPage"},parts:[{name:"This page is not in education",tasks:[]}]}};function qe(){const e=y("id","taskAltHint");for(const t of e)t.remove()}function Xe(){je()&&(ee(),qe(),Z()),Z()}function ee(){const e=d("scenario");let t=!0,n=0;for(const a of e.pages){if(y(a.page.selector.type,a.page.selector.value).length){M.actualPage=a.page.selector,M.index=n,p("actualPage",e.pages[M.index]),Y(),t=!1;break}n++}t&&(p("actualPage",Fe),Y())}function je(){const e=d("actualPage").page;return!y(e.selector.type,e.selector.value).length}let O,A=0;const k={defineInacivityTime:()=>{let e=d("inacivityTime")||-1;return(isNaN(e)||e<0)&&(e=-1),e}},z=()=>{const e=d("inactive");return(e==null?void 0:e.time)??0},H={start:()=>{A=z(),O=window.setInterval(()=>{A++,p("inactive",{time:A}),z()>(k==null?void 0:k.defineInacivityTime())&&(I(),window.location.href="/")},6e4)},clear:()=>{clearInterval(O),O=void 0,A=0},setTime:e=>{A=e},getTime:()=>z()};function Ye(e,t){document.onmousemove=n=>{e&&pe(n),t&&(Xe(),d("isMouseTouched")&&Ge(n))},document.onmouseup=()=>{t&&p("isMouseTouched",!1)},document.addEventListener("click",()=>{H.setTime(0)})}function Ge(e){const t=document.getElementById("task");if(!t)return;t.style.left="unset",t.style.bottom="unset";let n=e.pageY;n<=25&&(n=25),t.style.top=n-25+"px",t.style.left=e.pageX-60+"px"}const Mt="";function Je(e){const t=document.createElement("article");return t.innerText=e,t}const Ot="";function We(e){const t=document.createElement("div");t.classList.add("eval-article");const n=document.createElement("section");n.classList.add("eval-title");const a=document.createElement("div");a.classList.add("eval-title-scenario");const s=document.createElement("div");s.innerText=e,a.appendChild(s);const o=document.createElement("div");return o.id="percentResult",o.classList.add("eval-title-result"),a.appendChild(o),n.appendChild(a),t.appendChild(n),t}function Ke(e,t,n,a,s,o,c,i){const l={true:i.marked,false:i.notMarked,clicked:s,no_clicked:o,"":o},r=document.createElement("article");r.classList.add("eval-article-resultline");const u=document.createElement("div"),m=document.createElement("i");m.classList.add("fa"),m.classList.add("fa-check-circle"),m.style.color=a?B:"red",u.appendChild(m),r.appendChild(u);const f=document.createElement("div");f.innerText=e,r.appendChild(f);const g=document.createElement("div"),E=document.createElement("label"),x=l[n]||n;E.innerText=a?"":`${x} `,E.style.color="red",E.style.display="contents",g.appendChild(E);const C=document.createElement("label"),v=l[t]||t;return C.innerText=a?v:`(${c}: ${v})`,C.style.display="contents",g.appendChild(C),r.appendChild(g),r}function Qe(e,t,n,a,s){const o=d("partsResult")||[],c=document.createElement("article");return e.forEach(i=>{const l=Ze(i);o.push(l);const r=document.createElement("div");r.classList.add("eval-article-content");const u=document.createElement("div");u.classList.add("eval-article-content-resbox");const m=document.createElement("i");m.classList.add("fa"),m.classList.add("fa-check-circle"),m.style.color=l.sum?B:"red",u.appendChild(m),r.appendChild(u);const f=document.createElement("div");f.innerText=i.partName,f.classList.add("eval-article-content-res"),r.appendChild(f);const g=document.createElement("div");g.innerHTML=l.sum?t:`${l.total-l.partial} ${n}`,g.classList.add(l.sum?"eval-article-content-res-suc":"eval-article-content-res-failed"),r.appendChild(g);const E=document.createElement("div");E.classList.add("eval-article-content-arrow");const x=document.createElement("i");x.setAttribute("aria-hidden","true"),x.classList.add("fa"),x.classList.add("fa-angle-down"),E.appendChild(x),r.appendChild(E),c.appendChild(r);const C=document.createElement("div");C.classList.add("eval-article-result-content"),C.id=i.partName.trim(),C.style.display="none",i.tasks.forEach(v=>{const At=Ke(v.taskName,v.expectedValue,v.taskResult,v.taskStatus,t,n,a,s);C.appendChild(At)}),c.appendChild(C),r.addEventListener("click",()=>{const v=document.getElementById(i.partName.trim());v&&(v.style.display==="none"?(v.style.display="block",x.classList.remove("fa-angle-down"),x.classList.add("fa-angle-up")):(v.style.display="none",x.classList.remove("fa-angle-up"),x.classList.add("fa-angle-down")))})}),p("partsResult",o),c}function Ze(e){const t=e.tasks.length,n=et(e);return{total:t,partial:n,sum:t===n}}function et(e){let t=0;return e.tasks.forEach(n=>{n.taskStatus&&t++}),t}function tt(e,t,n,a,s){const o=document.createElement("article");o.classList.add("eval-article");const c=document.createElement("div");c.innerText=e.pageName,c.classList.add("eval-article-header"),o.appendChild(c);const i=Qe(e.parts,t,n,a,s);return o.appendChild(i),o}const zt="";function nt(e){const t=document.createElement("section");t.classList.add("eval-footer");const n=document.createElement("div");n.classList.add("eval-footer-buttons");const a=document.createElement("button");return a.classList.add("eval-title-restart"),a.innerText=e,t.appendChild(a),a.addEventListener("click",()=>{I(),window.location.href="/"}),n.appendChild(a),t.appendChild(n),t}function at(e){const t=d("results"),n=document.createElement("div");n.id="wp_main_section",n.classList.add("eval-wp");const a=document.createElement("section");a.classList.add("eval-wp-section");const s=Je(e.headerText);s.classList.add("eval-header"),a.appendChild(s);const o=We(t.scenarioName);a.appendChild(o);const c=document.createElement("div");c.classList.add("eval-body"),t.pageResults.forEach(l=>{const r=tt(l,e.successText,e.errorText,e.correctAnswerText,e.markedText);c.appendChild(r)}),a.appendChild(c);const i=nt(e.restartButtonText);return a.appendChild(i),n.appendChild(a),n}const st={create:ot};function ot(){const e=document.getElementById("wp_main_section");e&&e.remove();const t=d("evalProperty"),n=at(t);return document.body.appendChild(n),ct(t==null?void 0:t.minPercentage),n}function ct(e){let t=0,n=0;const a=d("partsResult"),s=d("userName");a.forEach(i=>{t+=i.total,n+=i.partial});const o=Math.round(n/t*100)||0,c=document.getElementById("percentResult");if(c&&(c.innerText=s?`${s}: ${o}%`:`${o}%`),e){const i=document.getElementsByClassName("eval-title-scenario");i.length>0&&o{const n=d(`${e.finalTaskID}_state`);n&&n.value&&(p("endOfScenario",!0),dt(),rt(),st.create(),clearInterval(t),H.clear())},1e3)}}function rt(){document.body.onmousemove=null;const e=document.getElementById("task");e&&e.remove();const t=document.getElementById("eduInfoPanel");t&&t.remove()}function dt(){const e=d("scenario");if(!e)return;const t=e.pages;p("results",{scenarioName:e.name,pageResults:ut(t)})}function ut(e){const t=[];return e.forEach(n=>{t.push({pageName:n.page.name,parts:mt(n.page.parts)})}),t}function mt(e){const t=[];return e.forEach(n=>{t.push({partName:n.name,tasks:pt(n.tasks)})}),t}function pt(e){const t=[];return e.forEach(n=>{var s;const a=d(`${n.target.id}_state`);t.push({taskName:n.description,expectedValue:((s=n.target.expectedValue)==null?void 0:s.hintText)??n.target.expectedValue.value,taskResult:(a==null?void 0:a.value)??"",taskStatus:(a==null?void 0:a.isSuccess)??!1})}),t}function ft(e){let t=!1;return Object.prototype.isPrototypeOf(e)&&Object.keys(e).length>0&&(p("scenarioName",e.name),t=!0),p("scenarioIsActive",t),t}function ht(e){let t=!1;return t=e.length>0,t&&e.forEach(n=>{(!(n!=null&&n.selector)||!n.text)&&(t=!1)}),p("hintIsActive",t),t}function $(e){p("educationInProgress",!0);const t=d("hintCollection");if(!t){console.warn("No hint collection found in store!");return}const n=ht(t),a=ft(e);a&&(p("scenario",e),ee()),n&&me(t),Ye(n,a),it.on(),(k==null?void 0:k.defineInacivityTime())!=-1&&H.start(),ce()}const Ut="";function vt(){const e=document.createElement("div");return e.id="wp_main_section",e.classList.add("wp"),e}const Ft="";function gt(){const e=document.createElement("content");return e.classList.add("wp-content-box"),e}const qt="";function Et(e){const t=document.createElement("div");return t.innerText=e.toUpperCase(),t.classList.add("wp-box-header"),t}const Xt="";function Lt(e){const t=document.createElement("div");return t.innerText=e,t.classList.add("wp-box-title"),t}function xt(e){b(` .wp-instruction-content { display: grid; grid-template-columns: 30px 100%; grid-gap: 1rem; } .wp-instruction-content-iconBox { font-size: 24px; color: #4066FF; } `);const t=document.createElement("section");t.classList.add("wp-instruction-content");const n=document.createElement("div");n.classList.add("wp-instruction-content-iconBox");const a=document.createElement("i");a.setAttribute("aria-hidden","true"),a.classList.add("fa"),a.classList.add("fa-info-circle"),n.appendChild(a),t.appendChild(n);const s=document.createElement("div");return s.innerText=e,t.appendChild(s),t}const jt="";function yt(e){const t=document.createElement("div"),n=`${e.placeholderText}${e.required?"*":""}`,a=document.createElement("input");a.setAttribute("type","text"),a.setAttribute("autocomplete","off"),a.setAttribute("placeholder",n),a.setAttribute("maxlength",e!=null&&e.maxLength?e.maxLength.toString():"50"),a.id="educationUserNameInput",a.classList.add("wp-box-userName"),t.appendChild(a);const s=document.createElement("label");return s.innerText=`*min.: ${e.minLength} character`,s.classList.add("userNameErrorMessage"),t.appendChild(s),e.required&&(a.classList.add("error"),a.addEventListener("input",()=>{const o=document.getElementById("educationStartBtn"),i=!(a.value.trim().length>=e.minLength);o.disabled=i,i?(a.classList.add("error"),s.classList.add("show")):(a.classList.remove("error"),s.classList.remove("show"))})),t}const Yt="";function Tt(e,t){const n=document.createElement("button");return n.id="educationStartBtn",n.innerText=e,n.classList.add("wp-box-button"),n.addEventListener("click",()=>{const a=document.getElementById("educationUserNameInput");a&&p("userName",a.value);const s=d("selectedScenarioIndex");y("id","wp_main_section")[0].remove(),isNaN(s)?$({}):(document.cookie=`scenarioID=${s}`,$(t[s]))}),n}const Gt="";function kt(e,t){var s;const n=document.createElement("select");n.setAttribute("name","scenarioSelect"),n.setAttribute("id","scenarioSelector"),n.classList.add("wp-box-scenarioSelector");const a=document.createElement("option");if(a.text=(s=e==null?void 0:e.scenarioSelector)!=null&&s.placeholderText?e.scenarioSelector.placeholderText:"choose a scenario",a.value="false",n.appendChild(a),t.length>0){let o=0;for(const c of t)if(c){const i=o,l=document.createElement("option");l.text=c,l.value=i.toString(),n.appendChild(l),o++}}else n.setAttribute("disabled","true");return n.addEventListener("change",()=>{p("selectedScenarioIndex",parseInt(n.value))}),n}const Jt="";function Ct(e){const t=document.createElement("div");return t.classList.add("wp-box-footer"),t.innerText=e||"",t}const Wt="",St={create:wt};function bt(e){try{const t=e.map(n=>n.name);return p("scenarioNames",t),t}catch{return[]}}function wt(e,t){const n=vt(),a=gt(),s=Et(e.header);a.appendChild(s);const o=document.createElement("div");o.classList.add("wp-body-section");const c=Lt(e.title);o.appendChild(c);const i=document.createElement("div");if(i.classList.add("wp-option-section"),!e.userName.hidden){const f=yt(e.userName);i.appendChild(f)}const l=kt(e,bt(t));i.appendChild(l);const r=Tt(e.startButtonTitle,t);r.disabled=!!(e.userName.required&&!e.userName.hidden),i.appendChild(r),o.appendChild(i);const u=xt(e.instruction);o.appendChild(u),a.appendChild(o);const m=Ct(e.footerText);a.appendChild(m),n.appendChild(a),document.body.appendChild(n)}const It={create:Bt};function Bt(e,t){const n=document.getElementById("wp_main_section");n&&n.remove(),St.create(e,t)}function Nt(e,t,n,a){const s=d("educationInProgress")??!1;if(p("evalProperty",a),p("hintCollection",n),p("inacivityTime",e==null?void 0:e.inacivityTime),te(e==null?void 0:e.theme),s){if(H.getTime()>(k==null?void 0:k.defineInacivityTime())){I(),window.location.href="/";return}const c=d("selectedScenarioIndex")??0;$(t[c]);return}if(e.isActive){It.create(e,t);return}$(t[0])}S.StartEducation=Nt,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});