(()=>{var e={633:(e,t,n)=>{"use strict";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(this,arguments)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}n.d(t,{Z:()=>s});var i=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.event={description:{"en-US":t},type:"http://adlnet.gov/expapi/activities/cmi.interaction",interactionType:"fill-in"}}var t,n;return t=e,(n=[{key:"generateXApi",value:function(e,t){var n=e.data.statement;return r(n,{result:{response:t}}),n.object&&r(n.object.definition,this.event),e}}])&&o(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}var s=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(s,H5P.EventDispatcher);var t,n,r,o=(n=s,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=a(n);if(r){var o=a(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function s(e){var t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),t=o.call(this);var r=e.question,u=void 0===r?"Do you like cake?":r,c=e.placeholderText,a=void 0===c?"":c,p=e.inputRows,l=void 0===p?1:p;return t.currentInput="",t.xApiGenerator=new i(u),t.createQuestion=function(e){var t=document.createElement("div");return t.className="h5p-open-ended-question-text",t.innerHTML=e,t},t.createInput=function(e,t){var n=document.createElement("textarea");return n.innerHTML=t||"",n.placeholder=n.innerText,n.textContent=this.currentInput,n.rows=e,n.style.resize="none",n},t.attach=function(e){var t=this,n=document.createElement("div");n.classList.add("h5p-open-ended-question");var r=document.createElement("div");r.classList.add("h5p-open-ended-question-question"),r.classList.add("h5p-subcontent-question");var o=this.createQuestion(u);r.appendChild(o);var i=document.createElement("div");i.classList.add("h5p-open-ended-question-content"),i.classList.add("h5p-subcontent-body");var c=this.createInput(l,a);c.className="h5p-open-ended-question-input",c.addEventListener("blur",(function(){var e=t.createXAPIEventTemplate("interacted"),n=t.xApiGenerator.generateXApi(e,c.value);t.currentInput=c.value,t.trigger(n)})),c.addEventListener("keydown",(function(){return t.trigger("changed")})),i.appendChild(c),n.appendChild(r),n.appendChild(i),e.get(0).appendChild(n),this.inputElement=c},t.resetTask=function(){this.currentInput="",this.inputElement&&(this.inputElement.value="")},t.getCurrentState=function(){return this.currentInput},t.restorePreviousState=function(){n.previousState&&(this.currentInput=n.previousState)},t.restorePreviousState(),t}return t=s,Object.defineProperty(t,"prototype",{writable:!1}),t}()}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),H5P.OpenEndedQuestion=n(633).Z})();