text: (()=>{"use strict";var e,t,r,n,o,i,a,s={105:()=>{let e,t;async function r(){return void 0===e&&(e=async function(){return function(e){const t=new Map;return n(e.layers,"",t),t}(await WA.room.getTiledMap())}()),e}function n(e,t,r){for(const o of e)"group"===o.type?n(o.layers,t+o.name+"/",r):(o.name=t+o.name,r.set(o.name,o))}class o{constructor(e){this.properties=null!=e?e:[]}get(e){const t=this.properties.filter((t=>t.name===e)).map((e=>e.value));if(t.length>1)throw new Error('Expected only one property to be named "'+e+'"');if(0!==t.length)return t[0]}getString(e){return this.getByType(e,"string")}getNumber(e){return this.getByType(e,"number")}getBoolean(e){return this.getByType(e,"boolean")}getByType(e,t){const r=this.get(e);if(void 0!==r){if(typeof r!==t)throw new Error('Expected property "'+e+'" to have type "'+t+'"');return r}}mustGetString(e){return this.mustGetByType(e,"string")}mustGetNumber(e){return this.mustGetByType(e,"number")}mustGetBoolean(e){return this.mustGetByType(e,"boolean")}mustGetByType(e,t){const r=this.get(e);if(void 0===r)throw new Error('Property "'+e+'" is missing');if(typeof r!==t)throw new Error('Expected property "'+e+'" to have type "'+t+'"');return r}getType(e){const t=this.properties.filter((t=>t.name===e)).map((e=>e.type));if(t.length>1)throw new Error('Expected only one property to be named "'+e+'"');if(0!==t.length)return t[0]}}let i,a="";const s=new class{constructor(e){if(this.oscillator1=null,this.oscillator2=null,this.audioContext=null,this.audioFile=null,this._baseUrl="",e)return void(this.audioContext=e);let t=window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.oAudioContext||window.msAudioContext;t?this.audioContext=new t:this.audioFile=new Audio}set baseUrl(e){this._baseUrl=e}playTone(e,t){this.stop();let r=this.audioContext.createGain();r.gain.value=.1,this.oscillator1=this.audioContext.createOscillator(),this.oscillator1.type="sine",this.oscillator1.frequency.value=e,this.oscillator1.connect(r,0,0),r.connect(this.audioContext.destination),this.oscillator2=this.audioContext.createOscillator(),this.oscillator2.type="sine",this.oscillator2.frequency.value=t,this.oscillator2.connect(r),r.connect(this.audioContext.destination),this.oscillator1.start(0),this.oscillator2.start(0)}play(e){if(null===this.audioContext)return this.playDtmfFallback(e);switch(String(e)){case"1":this.playTone(697,1209);break;case"2":this.playTone(697,1336);break;case"3":this.playTone(697,1477);break;case"4":this.playTone(770,1209);break;case"5":this.playTone(770,1336);break;case"6":this.playTone(770,1477);break;case"7":this.playTone(852,1209);break;case"8":this.playTone(852,1336);break;case"9":this.playTone(852,1477);break;case"*":this.playTone(941,1209);break;case"0":this.playTone(941,1336);break;case"#":this.playTone(941,1477);break;case"A":this.playTone(697,1633);break;case"B":this.playTone(770,1633);break;case"C":this.playTone(852,1633);break;case"D":this.playTone(941,1633)}}stop(){null!==this.oscillator1&&this.oscillator1.disconnect(),null!==this.oscillator2&&this.oscillator2.disconnect(),null!==this.audioFile&&this.stopFallback()}playDtmfFallback(e){switch(String(e)){case"*":e="star";break;case"#":e="hash"}this.audioFile.removeEventListener("playing",this.onAudioFileplaying),this.audioFile.src=`${this._baseUrl}${e}.mp3`,this.audioFile.play()}stopFallback(){let e=this.audioFile;e.duration>0&&!e.paused?e.pause():(void 0===this.onAudioFileplaying&&(this.onAudioFileplaying=()=>{e.pause()}),e.addEventListener("playing",this.onAudioFileplaying))}close(){null!==this.audioContext&&this.audioContext.close()}};WA.onInit().then((async()=>{const e=window.location.hash.substr(1);if(!e)throw new Error('Missing "layer" in hash');const n=(await r()).get(e);if(void 0===n)throw new Error('Cannot find layer whose name is "'+e+'".');const c=new o(n.properties),l=c.getString("code"),d=c.getString("codeVariable");if(void 0===l&&void 0===d)throw new Error('Missing "code" or "codeVariable" for layer "'+e+'".');if(d){const e=WA.state[d];!e||"string"!=typeof e&&"number"!=typeof e||(t=e.toString())}else t=l;const u=c.getString("doorVariable");if(void 0===u)throw new Error('Missing "doorVariable" for layer "'+e+'".');i=u,document.querySelectorAll("button").forEach((e=>{e.addEventListener("mousedown",(function(){s.play(this.innerText)})),e.addEventListener("mouseup",(function(){s.stop()})),e.addEventListener("click",(function(){a+=this.innerText.trim(),a.length>t.length&&(a=a.substr(a.length-t.length,t.length)),a===t&&(WA.state[i]=!0)}))}))}))}},c={};function l(e){var t=c[e];if(void 0!==t){if(void 0!==t.error)throw t.error;return t.exports}var r=c[e]={exports:{}};try{var n={id:e,module:r,factory:s[e],require:l};l.i.forEach((function(e){e(n)})),r=n.module,n.factory.call(r.exports,r,r.exports,n.require)}catch(e){throw r.error=e,e}return r.exports}l.m=s,l.c=c,l.i=[],l.hu=e=>e+"."+l.h()+".hot-update.js",l.miniCssF=e=>{},l.hmrF=()=>"keypad."+l.h()+".hot-update.json",l.h=()=>"80dd7e600b14b00e8860",l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="@workadventure/scripting-api-extra:",l.l=(r,n,o,i)=>{if(e[r])e[r].push(n);else{var a,s;if(void 0!==o)for(var c=document.getElementsByTagName("script"),d=0;d<c.length;d++){var u=c[d];if(u.getAttribute("src")==r||u.getAttribute("data-webpack")==t+o){a=u;break}}a||(s=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,l.nc&&a.setAttribute("nonce",l.nc),a.setAttribute("data-webpack",t+o),a.src=r),e[r]=[n];var p=(t,n)=>{a.onerror=a.onload=null,clearTimeout(h);var o=e[r];if(delete e[r],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((e=>e(n))),t)return t(n)},h=setTimeout(p.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=p.bind(null,a.onerror),a.onload=p.bind(null,a.onload),s&&document.head.appendChild(a)}},(()=>{var e,t,r,n,o={},i=l.c,a=[],s=[],c="idle";function d(e){c=e;for(var t=[],r=0;r<s.length;r++)t[r]=s[r].call(null,e);return Promise.all(t)}function u(e){if(0===t.length)return e();var r=t;return t=[],Promise.all(r).then((function(){return u(e)}))}function p(e){if("idle"!==c)throw new Error("check() is only allowed in idle status");return d("check").then(l.hmrM).then((function(n){return n?d("prepare").then((function(){var o=[];return t=[],r=[],Promise.all(Object.keys(l.hmrC).reduce((function(e,t){return l.hmrC[t](n.c,n.r,n.m,e,r,o),e}),[])).then((function(){return u((function(){return e?f(e):d("ready").then((function(){return o}))}))}))})):d(y()?"ready":"idle").then((function(){return null}))}))}function h(e){return"ready"!==c?Promise.resolve().then((function(){throw new Error("apply() is only allowed in ready status")})):f(e)}function f(e){e=e||{},y();var t=r.map((function(t){return t(e)}));r=void 0;var o=t.map((function(e){return e.error})).filter(Boolean);if(o.length>0)return d("abort").then((function(){throw o[0]}));var i=d("dispose");t.forEach((function(e){e.dispose&&e.dispose()}));var a,s=d("apply"),c=function(e){a||(a=e)},l=[];return t.forEach((function(e){if(e.apply){var t=e.apply(c);if(t)for(var r=0;r<t.length;r++)l.push(t[r])}})),Promise.all([i,s]).then((function(){return a?d("fail").then((function(){throw a})):n?f(e).then((function(e){return l.forEach((function(t){e.indexOf(t)<0&&e.push(t)})),e})):d("idle").then((function(){return l}))}))}function y(){if(n)return r||(r=[]),Object.keys(l.hmrI).forEach((function(e){n.forEach((function(t){l.hmrI[e](t,r)}))})),n=void 0,!0}l.hmrD=o,l.i.push((function(f){var y,m,v,g,b=f.module,w=function(r,n){var o=i[n];if(!o)return r;var s=function(t){if(o.hot.active){if(i[t]){var s=i[t].parents;-1===s.indexOf(n)&&s.push(n)}else a=[n],e=t;-1===o.children.indexOf(t)&&o.children.push(t)}else console.warn("[HMR] unexpected require("+t+") from disposed module "+n),a=[];return r(t)},l=function(e){return{configurable:!0,enumerable:!0,get:function(){return r[e]},set:function(t){r[e]=t}}};for(var p in r)Object.prototype.hasOwnProperty.call(r,p)&&"e"!==p&&Object.defineProperty(s,p,l(p));return s.e=function(e){return function(e){switch(c){case"ready":return d("prepare"),t.push(e),u((function(){return d("ready")})),e;case"prepare":return t.push(e),e;default:return e}}(r.e(e))},s}(f.require,f.id);b.hot=(y=f.id,m=b,g={_acceptedDependencies:{},_acceptedErrorHandlers:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_selfInvalidated:!1,_disposeHandlers:[],_main:v=e!==y,_requireSelf:function(){a=m.parents.slice(),e=v?void 0:y,l(y)},active:!0,accept:function(e,t,r){if(void 0===e)g._selfAccepted=!0;else if("function"==typeof e)g._selfAccepted=e;else if("object"==typeof e&&null!==e)for(var n=0;n<e.length;n++)g._acceptedDependencies[e[n]]=t||function(){},g._acceptedErrorHandlers[e[n]]=r;else g._acceptedDependencies[e]=t||function(){},g._acceptedErrorHandlers[e]=r},decline:function(e){if(void 0===e)g._selfDeclined=!0;else if("object"==typeof e&&null!==e)for(var t=0;t<e.length;t++)g._declinedDependencies[e[t]]=!0;else g._declinedDependencies[e]=!0},dispose:function(e){g._disposeHandlers.push(e)},addDisposeHandler:function(e){g._disposeHandlers.push(e)},removeDisposeHandler:function(e){var t=g._disposeHandlers.indexOf(e);t>=0&&g._disposeHandlers.splice(t,1)},invalidate:function(){switch(this._selfInvalidated=!0,c){case"idle":r=[],Object.keys(l.hmrI).forEach((function(e){l.hmrI[e](y,r)})),d("ready");break;case"ready":Object.keys(l.hmrI).forEach((function(e){l.hmrI[e](y,r)}));break;case"prepare":case"check":case"dispose":case"apply":(n=n||[]).push(y)}},check:p,apply:h,status:function(e){if(!e)return c;s.push(e)},addStatusHandler:function(e){s.push(e)},removeStatusHandler:function(e){var t=s.indexOf(e);t>=0&&s.splice(t,1)},data:o[y]},e=void 0,g),b.parents=a,b.children=[],a=[],f.require=w})),l.hmrC={},l.hmrI={}})(),(()=>{var e;l.g.importScripts&&(e=l.g.location+"");var t=l.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");r.length&&(e=r[r.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),l.p=e+"../"})(),r=(e,t,r,n)=>{var o=document.createElement("link");return o.rel="stylesheet",o.type="text/css",o.onerror=o.onload=i=>{if(o.onerror=o.onload=null,"load"===i.type)r();else{var a=i&&("load"===i.type?"missing":i.type),s=i&&i.target&&i.target.href||t,c=new Error("Loading CSS chunk "+e+" failed.\n("+s+")");c.code="CSS_CHUNK_LOAD_FAILED",c.type=a,c.request=s,o.parentNode.removeChild(o),n(c)}},o.href=t,document.head.appendChild(o),o},n=(e,t)=>{for(var r=document.getElementsByTagName("link"),n=0;n<r.length;n++){var o=(a=r[n]).getAttribute("data-href")||a.getAttribute("href");if("stylesheet"===a.rel&&(o===e||o===t))return a}var i=document.getElementsByTagName("style");for(n=0;n<i.length;n++){var a;if((o=(a=i[n]).getAttribute("data-href"))===e||o===t)return a}},o=[],i=[],a=e=>({dispose:()=>{for(var e=0;e<o.length;e++){var t=o[e];t.parentNode&&t.parentNode.removeChild(t)}o.length=0},apply:()=>{for(var e=0;e<i.length;e++)i[e].rel="stylesheet";i.length=0}}),l.hmrC.miniCss=(e,t,s,c,d,u)=>{d.push(a),e.forEach((e=>{var t=l.miniCssF(e),a=l.p+t,s=n(t,a);s&&c.push(new Promise(((t,n)=>{var c=r(e,a,(()=>{c.as="style",c.rel="preload",t()}),n);o.push(s),i.push(c)})))}))},(()=>{var e,t,r,n,o=l.hmrS_jsonp=l.hmrS_jsonp||{331:0},i={};function a(e){return new Promise(((t,r)=>{i[e]=t;var n=l.p+l.hu(e),o=new Error;l.l(n,(t=>{if(i[e]){i[e]=void 0;var n=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;o.message="Loading hot update chunk "+e+" failed.\n("+n+": "+a+")",o.name="ChunkLoadError",o.type=n,o.request=a,r(o)}}))}))}function s(i){function a(e){for(var t=[e],r={},n=t.map((function(e){return{chain:[e],id:e}}));n.length>0;){var o=n.pop(),i=o.id,a=o.chain,c=l.c[i];if(c&&(!c.hot._selfAccepted||c.hot._selfInvalidated)){if(c.hot._selfDeclined)return{type:"self-declined",chain:a,moduleId:i};if(c.hot._main)return{type:"unaccepted",chain:a,moduleId:i};for(var d=0;d<c.parents.length;d++){var u=c.parents[d],p=l.c[u];if(p){if(p.hot._declinedDependencies[i])return{type:"declined",chain:a.concat([u]),moduleId:i,parentId:u};-1===t.indexOf(u)&&(p.hot._acceptedDependencies[i]?(r[u]||(r[u]=[]),s(r[u],[i])):(delete r[u],t.push(u),n.push({chain:a.concat([u]),id:u})))}}}}return{type:"accepted",moduleId:e,outdatedModules:t,outdatedDependencies:r}}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];-1===e.indexOf(n)&&e.push(n)}}l.f&&delete l.f.jsonpHmr,e=void 0;var c={},d=[],u={},p=function(e){console.warn("[HMR] unexpected require("+e.id+") to disposed module")};for(var h in t)if(l.o(t,h)){var f,y=t[h],m=!1,v=!1,g=!1,b="";switch((f=y?a(h):{type:"disposed",moduleId:h}).chain&&(b="\nUpdate propagation: "+f.chain.join(" -> ")),f.type){case"self-declined":i.onDeclined&&i.onDeclined(f),i.ignoreDeclined||(m=new Error("Aborted because of self decline: "+f.moduleId+b));break;case"declined":i.onDeclined&&i.onDeclined(f),i.ignoreDeclined||(m=new Error("Aborted because of declined dependency: "+f.moduleId+" in "+f.parentId+b));break;case"unaccepted":i.onUnaccepted&&i.onUnaccepted(f),i.ignoreUnaccepted||(m=new Error("Aborted because "+h+" is not accepted"+b));break;case"accepted":i.onAccepted&&i.onAccepted(f),v=!0;break;case"disposed":i.onDisposed&&i.onDisposed(f),g=!0;break;default:throw new Error("Unexception type "+f.type)}if(m)return{error:m};if(v)for(h in u[h]=y,s(d,f.outdatedModules),f.outdatedDependencies)l.o(f.outdatedDependencies,h)&&(c[h]||(c[h]=[]),s(c[h],f.outdatedDependencies[h]));g&&(s(d,[f.moduleId]),u[h]=p)}t=void 0;for(var w,E=[],k=0;k<d.length;k++){var _=d[k],x=l.c[_];x&&(x.hot._selfAccepted||x.hot._main)&&u[_]!==p&&!x.hot._selfInvalidated&&E.push({module:_,require:x.hot._requireSelf,errorHandler:x.hot._selfAccepted})}return{dispose:function(){var e;r.forEach((function(e){delete o[e]})),r=void 0;for(var t,n=d.slice();n.length>0;){var i=n.pop(),a=l.c[i];if(a){var s={},u=a.hot._disposeHandlers;for(k=0;k<u.length;k++)u[k].call(null,s);for(l.hmrD[i]=s,a.hot.active=!1,delete l.c[i],delete c[i],k=0;k<a.children.length;k++){var p=l.c[a.children[k]];p&&(e=p.parents.indexOf(i))>=0&&p.parents.splice(e,1)}}}for(var h in c)if(l.o(c,h)&&(a=l.c[h]))for(w=c[h],k=0;k<w.length;k++)t=w[k],(e=a.children.indexOf(t))>=0&&a.children.splice(e,1)},apply:function(e){for(var t in u)l.o(u,t)&&(l.m[t]=u[t]);for(var r=0;r<n.length;r++)n[r](l);for(var o in c)if(l.o(c,o)){var a=l.c[o];if(a){w=c[o];for(var s=[],p=[],h=[],f=0;f<w.length;f++){var y=w[f],m=a.hot._acceptedDependencies[y],v=a.hot._acceptedErrorHandlers[y];if(m){if(-1!==s.indexOf(m))continue;s.push(m),p.push(v),h.push(y)}}for(var g=0;g<s.length;g++)try{s[g].call(null,w)}catch(t){if("function"==typeof p[g])try{p[g](t,{moduleId:o,dependencyId:h[g]})}catch(r){i.onErrored&&i.onErrored({type:"accept-error-handler-errored",moduleId:o,dependencyId:h[g],error:r,originalError:t}),i.ignoreErrored||(e(r),e(t))}else i.onErrored&&i.onErrored({type:"accept-errored",moduleId:o,dependencyId:h[g],error:t}),i.ignoreErrored||e(t)}}}for(var b=0;b<E.length;b++){var k=E[b],_=k.module;try{k.require(_)}catch(t){if("function"==typeof k.errorHandler)try{k.errorHandler(t,{moduleId:_,module:l.c[_]})}catch(r){i.onErrored&&i.onErrored({type:"self-accept-error-handler-errored",moduleId:_,error:r,originalError:t}),i.ignoreErrored||(e(r),e(t))}else i.onErrored&&i.onErrored({type:"self-accept-errored",moduleId:_,error:t}),i.ignoreErrored||e(t)}}return d}}}self.webpackHotUpdate_workadventure_scripting_api_extra=(e,r,o)=>{for(var a in r)l.o(r,a)&&(t[a]=r[a]);o&&n.push(o),i[e]&&(i[e](),i[e]=void 0)},l.hmrI.jsonp=function(e,o){t||(t={},n=[],r=[],o.push(s)),l.o(t,e)||(t[e]=l.m[e])},l.hmrC.jsonp=function(i,c,d,u,p,h){p.push(s),e={},r=c,t=d.reduce((function(e,t){return e[t]=!1,e}),{}),n=[],i.forEach((function(t){l.o(o,t)&&void 0!==o[t]&&(u.push(a(t)),e[t]=!0)})),l.f&&(l.f.jsonpHmr=function(t,r){e&&!l.o(e,t)&&l.o(o,t)&&void 0!==o[t]&&(r.push(a(t)),e[t]=!0)})},l.hmrM=()=>{if("undefined"==typeof fetch)throw new Error("No browser support: need fetch API");return fetch(l.p+l.hmrF()).then((e=>{if(404!==e.status){if(!e.ok)throw new Error("Failed to fetch update manifest "+e.statusText);return e.json()}}))}})(),l(105)})();
  //# sourceMappingURL=keypad.eece503c3ef691789fd9.js.map