From bcd647c69261b01d951b3a36214de49dd7d3ef29 Mon Sep 17 00:00:00 2001 From: chrisdurfee Date: Thu, 26 Sep 2024 07:26:43 +0000 Subject: [PATCH] deploy: a06b90ca860a40ff921f4824e0b53d501132eaba --- assets/index.d0885671.js | 7 ------- assets/index.fc6e3d06.js | 7 +++++++ index.html | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) delete mode 100644 assets/index.d0885671.js create mode 100644 assets/index.fc6e3d06.js diff --git a/assets/index.d0885671.js b/assets/index.d0885671.js deleted file mode 100644 index 30dee26..0000000 --- a/assets/index.d0885671.js +++ /dev/null @@ -1,7 +0,0 @@ -var Ae=Object.defineProperty;var Te=(t,e,s)=>e in t?Ae(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var p=(t,e,s)=>(Te(t,typeof e!="symbol"?e+"":e,s),s);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const n of a.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&i(n)}).observe(document,{childList:!0,subtree:!0});function s(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=s(r);fetch(r.href,a)}})();const Ee="modulepreload",Be=function(t){return"/multisplode/"+t},jt={},De=function(e,s,i){if(!s||s.length===0)return e();const r=document.getElementsByTagName("link");return Promise.all(s.map(a=>{if(a=Be(a),a in jt)return;jt[a]=!0;const n=a.endsWith(".css"),o=n?'[rel="stylesheet"]':"";if(!!i)for(let d=r.length-1;d>=0;d--){const m=r[d];if(m.href===a&&(!n||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${o}`))return;const h=document.createElement("link");if(h.rel=n?"stylesheet":Ee,n||(h.as="script",h.crossOrigin=""),h.href=a,document.head.appendChild(h),n)return new Promise((d,m)=>{h.addEventListener("load",d),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${a}`)))})})).then(()=>e())};var Oe=Object.defineProperty,je=(t,e,s)=>e in t?Oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,ot=(t,e,s)=>(je(t,typeof e!="symbol"?e+"":e,s),s),mt=class{static toArray(t){return Array.prototype.slice.call(t)}static inArray(t,e,s){return!t||typeof t!="object"?-1:t.indexOf(e,s)}},u=class{static getType(t){let e=typeof t;return e!=="object"?e:this.isArray(t)?"array":e}static isUndefined(t){return typeof t>"u"}static isObject(t){return t&&typeof t=="object"&&this.isArray(t)===!1}static isFunction(t){return typeof t=="function"}static isString(t){return typeof t=="string"}static isArray(t){return Array.isArray(t)}},k={create(t){return Object.create(t)},extendObject(t,e){if(typeof t>"u"||typeof e>"u")return!1;for(var s in t)this.hasOwnProp(t,s)&&typeof e[s]>"u"&&(e[s]=t[s]);return e},clone(t){return t?JSON.parse(JSON.stringify(t)):{}},getClassObject(t){return typeof t=="function"?t.prototype:t},extendClass(t,e){let s=this.getClassObject(t),i=this.getClassObject(e);if(typeof s!="object"||typeof i!="object")return!1;let r=Object.create(s);for(var a in i)r[a]=i[a];return r},hasOwnProp(t,e){return Object.prototype.hasOwnProperty.call(t,e)},isPlainObject(t){return t&&Object.prototype.toString.call(t)==="[object Object]"},isEmpty(t){if(u.isObject(t)===!1)return!0;for(var e in t)if(this.hasOwnProp(t,e))return!1;return!0}},gt={types:{},add(t,e){this.types[t]=e},get(t){return this.types[t]||!1},remove(t){delete this.types[t]}},Ie=class{constructor(){this.types=new Map}add(t,e){this.types.has(t)||this.types.set(t,[]),this.types.get(t).push(e)}get(t){return this.types.get(t)||!1}removeByCallBack(t,e){typeof t=="function"&&t(e)}removeType(t){if(!this.types.has(t))return;let e=this.types.get(t);if(!e.length)return;let s,i=gt.get(t);if(i){for(var r=0,a=e.length;r{!s||this.removeType(s)}),this.types.clear()}},P=class{static addType(t,e){gt.add(t,e)}static removeType(t){gt.remove(t)}static getTrackingId(t){return t?t.trackingId||(t.trackingId=`dt${this.trackingCount++}`):""}static add(t,e,s){let i=this.getTrackingId(t);this.find(i).add(e,s)}static get(t,e){let s=t.trackingId,i=this.trackers.get(s);return i?e?i.get(e):i:!1}static find(t){return this.trackers.has(t)||this.trackers.set(t,new Ie),this.trackers.get(t)}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let s=t.trackingId;if(!s||!this.trackers.has(s))return;let i=this.trackers.get(s);if(!e){i.remove(),this.trackers.delete(s);return}i.remove(e),this.isEmpty(i.types)&&this.trackers.delete(s)}};ot(P,"trackers",new Map),ot(P,"trackingCount",0);var vt=t=>{let e=0;for(let[s,i]of Object.entries(t))e++,typeof t[s]=="object"&&(e+=vt(t[s]));return e},Gt=(t,e)=>{let s=!1;if(typeof t!="object"||typeof e!="object")return s;for(let[i,r]of Object.entries(t)){if(!k.hasOwnProp(e,i))break;let a=e[i];if(typeof r!=typeof a)break;if(typeof r=="object"){if(s=Gt(r,a),s!==!0)break}else if(r===a)s=!0;else break}return s},ze=(t,e)=>{let s=vt(t),i=vt(e);return s!==i?!1:Gt(t,e)},Ne=(t,e)=>{let s=typeof t;return s!==typeof e?!1:s==="object"?ze(t,e):t===e},v={getEvents(t){return u.isObject(t)===!1?[]:P.get(t,"events")},create(t,e,s,i=!1,r=!1,a=null){return r=r===!0,{event:t,obj:e,fn:s,capture:i,swapped:r,originalFn:a}},on(t,e,s,i){return Array.isArray(t)?t.forEach(r=>this.add(r,e,s,i)):this.add(t,e,s,i),this},off(t,e,s,i){return Array.isArray(t)?t.forEach(r=>this.remove(r,e,s,i)):this.remove(t,e,s,i),this},add(t,e,s,i=!1,r=!1,a=null){if(u.isObject(e)===!1)return this;let n=this.create(t,e,s,i,r,a);return P.add(e,"events",n),e.addEventListener(t,s,i),this},remove(t,e,s,i=!1){let r=this.getEvent(t,e,s,i);return r===!1?this:(typeof r=="object"&&this.removeEvent(r),this)},removeEvent(t){return typeof t=="object"&&t.obj.removeEventListener(t.event,t.fn,t.capture),this},getEvent(t,e,s,i){if(typeof e!="object")return!1;let r=this.getEvents(e);if(!r||r.length<1)return!1;let a=this.create(t,e,s,i);return this.search(a,r)},search(t,e){let s,i=this.isSwappable(t.event);for(var r=0,a=e.length;r{v.removeEvent(t)});var Re={events:v,addListener(t,e,s,i){return this.events.add(t,e,s,i),this},on(t,e,s,i){let r=this.events;return Array.isArray(t)?t.forEach(a=>{r.add(a,e,s,i)}):r.add(t,e,s,i),this},off(t,e,s,i){let r=this.events;return Array.isArray(t)?t.forEach(a=>{r.remove(a,e,s,i)}):r.remove(t,e,s,i),this},removeListener(t,e,s,i){return this.events.remove(t,e,s,i),this},_createEvent(t,e,s,i){let r;switch(e){case"HTMLEvents":r=new Event(t);break;case"MouseEvents":r=new MouseEvent(t,s);break;default:r=new CustomEvent(t,i);break}return r},createEvent(t,e,s,i){if(u.isObject(e)===!1)return!1;let r={pointerX:0,pointerY:0,button:0,view:window,detail:1,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,bubbles:!0,cancelable:!0,relatedTarget:null};u.isObject(s)&&(r=Object.assign(r,s));let a=this._getEventType(t);return this._createEvent(t,a,r,i)},_getEventType(t){let e={HTMLEvents:/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,MouseEvents:/^(?:click|dblclick|mouse(?:down|up|over|move|out))$/},s="CustomEvent";for(let[i,r]of Object.entries(e))if(t.match(r)){s=i;break}return s},trigger(t,e,s){if(u.isObject(e)===!1)return this;let i=typeof t=="string"?this.createEvent(t,e,null,s):t;return e.dispatchEvent(i),this},mouseWheelEventType:null,getWheelEventType(){let t=()=>{let e="wheel";return"onmousewheel"in self?e="mousewheel":"DOMMouseScroll"in self&&(e="DOMMouseScroll"),e};return this.mouseWheelEventType||(this.mouseWheelEventType=t())},onMouseWheel(t,e,s,i=!1){typeof e>"u"&&(e=window);let r=n=>{let o=Math.max(-1,Math.min(1,-n.deltaY||n.wheelDelta||-n.detail));typeof t=="function"&&t(o,n),s===!0&&n.preventDefault()},a=this.getWheelEventType();return this.events.add(a,e,r,i,!0,t),this},offMouseWheel(t,e,s=!1){typeof e>"u"&&(e=window);let i=this.getWheelEventType();return this.off(i,e,t,s),this},preventDefault(t){return typeof t.preventDefault=="function"?t.preventDefault():t.returnValue=!1,this},stopPropagation(t){return typeof t.stopPropagation=="function"?t.stopPropagation():t.cancelBubble=!0,this}},yt=class{constructor(){this.version="3.0.89",this.errors=[],this.dataTracker=P}augment(t){return u.isObject(t)?(Object.entries(t).forEach(([e,s])=>{this.constructor.prototype[e]=s}),this):this}override(t,e,s,i){return(t[e]=s).apply(t,mt.toArray(i))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,s){if(u.isObject(t)===!1)return"";let i=t[e];return typeof i<"u"?i:typeof s<"u"?s:""}createCallBack(t,e,s=[],i=!1){return typeof e!="function"?!1:(...r)=>(i===!0&&(s=s.concat(r)),e.apply(t,s))}bind(t,e){return e.bind(t)}};yt.prototype.extend=function(){return yt.prototype}();var R=new yt;R.augment({...k,...Re,...u,equals:Ne});var ht=t=>{if(typeof t!="string")return"";let e=1e3;return t.substring(0,e)},z=class{static parseQueryString(t,e){typeof t!="string"&&(t=window.location.search),t=ht(t);let s={},i=/([^?=&]+)(=([^&]*))?/g;return t.replace(i,function(r,a,n,o){s[a]=e!==!1?decodeURIComponent(o):o}),s}static camelCase(t){t=ht(t);let e=/(-|\s|_)+\w{1}/g;return t.replace(e,s=>s[1].toUpperCase())}static uncamelCase(t,e="-"){t=ht(t);let s=/([A-Z]{1,})/g;return t.replace(s,i=>e+i.toLowerCase()).toLowerCase()}},It={url:"",responseType:"json",method:"POST",fixedParams:"",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},beforeSend:[],async:!0,crossDomain:!1,withCredentials:!1,completed:null,failed:null,aborted:null,progress:null};R.augment({xhrSettings:It,addFixedParams(t){this.xhrSettings.fixedParams=t},beforeSend(t){this.xhrSettings.beforeSend.push(t)},ajaxSettings(t){typeof t=="object"&&(this.xhrSettings=k.extendClass(R.xhrSettings,t))},resetAjaxSettings(){this.xhrSettings=It}});var Vt=(...t)=>new Me(t).xhr,Me=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR();if(e===!1)return!1;let{method:s,url:i,async:r}=this.settings;e.open(s,i,r),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=R.xhrSettings.beforeSend;if(t.length<1)return;let e=this.xhr,s=this.settings;for(var i=0,r=t.length;i=2&&typeof t[0]!="object")for(var s=0,i=t.length;s{v.removeEvents(s.upload),v.removeEvents(s)},r=this.settings;if(!r)return!1;switch(e||t.type){case"load":if(typeof r.completed=="function"){let a=this.getResponseData();r.completed(a,this.xhr)}i();break;case"error":typeof r.failed=="function"&&r.failed(!1,this.xhr),i();break;case"progress":typeof r.progress=="function"&&r.progress(t);break;case"abort":typeof r.aborted=="function"&&r.aborted(!1,this.xhr),i();break}}getResponseData(){let t=this.xhr,e=t.responseType;return!e||e==="text"?t.responseText:t.response}addXhrEvents(){if(!this.settings)return;let t=this.xhr,e=this.update.bind(this);v.on(["load","error","abort"],t,e),v.on("progress",t.upload,e)}},Fe=class{constructor(){this.connections=new Map}add(t,e,s){return this.find(t).set(e,s),s}get(t,e){let s=this.connections.get(t);return s&&s.get(e)||!1}find(t){let e=this.connections.get(t);if(e)return e;let s=new Map;return this.connections.set(t,s),s}remove(t,e){let s=this.connections.get(t);if(!s)return;let i;if(e)i=s.get(e),i&&(i.unsubscribe(),s.delete(e)),s.size===0&&this.connections.delete(t);else{for(let r of s)i=s.get(r),i&&i.unsubscribe();this.connections.delete(t)}}},Kt=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}},We=class extends Kt{constructor(t){super(),this.data=t}subscribe(t,e){this.msg=t,this.token=this.data.on(t,e)}unsubscribe(){this.data.off(this.msg,this.token)}},Jt=class{unsubscribe(){}},_e=class extends Jt{constructor(){super(),this.source=null}addSource(t){return this.source=new We(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}},Qt=class extends Kt{constructor(t){super(),this.pubSub=t}subscribe(t){this.msg=t;let e=this.callBack.bind(this);this.token=this.pubSub.on(t,e)}unsubscribe(){this.pubSub.off(this.msg,this.token)}callBack(){}},Ue=class extends Qt{constructor(t,e,s){super(s),this.data=t,this.prop=e}set(t){this.data.set(this.prop,t)}get(){return this.data.get(this.prop)}callBack(t,e){this.data!==e&&this.data.set(this.prop,t,e)}},C=class{static getById(t){return typeof t!="string"?!1:document.getElementById(t)||!1}static getByName(t){if(typeof t!="string")return!1;let e=document.getElementsByName(t);return e?mt.toArray(e):!1}static getBySelector(t,e){if(typeof t!="string")return!1;if(e=e||!1,e===!0)return document.querySelector(t)||!1;let s=document.querySelectorAll(t);return s?s.length===1?s[0]:mt.toArray(s):!1}static html(t,e){return u.isObject(t)===!1?!1:u.isUndefined(e)===!1?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,s){return u.isObject(t)===!1||u.isUndefined(e)?this:(e=z.uncamelCase(e),t.style[e]=s,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=z.uncamelCase(e);let s=t.style[e];if(s!=="")return s;let i=null,r=t.currentStyle;if(r&&(i=r[e]))return i;let a=window.getComputedStyle(t,null);return a?a[e]:s}static css(t,e,s){return typeof s<"u"?(this.setCss(t,e,s),this):this.getCss(t,e)}static removeAttr(t,e){return u.isObject(t)&&t.removeAttribute(e),this}static setAttr(t,e,s){t.setAttribute(e,s)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,s){return u.isObject(t)===!1?!1:typeof s<"u"?(this.setAttr(t,e,s),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=z.uncamelCase(t),t.substring(0,5)!=="data-"&&(t="data-"+t)),t}static removeDataPrefix(t){return typeof t=="string"&&t.substring(0,5)==="data-"&&(t=t.substring(5)),t}static setData(t,e,s){e=this.removeDataPrefix(e),e=z.camelCase(e),t.dataset[e]=s}static getData(t,e){return e=z.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,s){return u.isObject(t)===!1?!1:typeof s<"u"?(this.setData(t,e,s),this):this.getData(t,e)}static find(t,e){return!t||typeof e!="string"?[]:t.querySelectorAll(e)}static show(t){if(u.isObject(t)===!1)return this;let e=this.data(t,"style-display"),s=typeof e=="string"?e:"";return this.css(t,"display",s),this}static hide(t){if(u.isObject(t)===!1)return this;let e=this.css(t,"display");return e!=="none"&&e&&this.data(t,"style-display",e),this.css(t,"display","none"),this}static toggle(t){return u.isObject(t)===!1?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return u.isObject(t)===!1?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return u.isObject(t)?t.offsetWidth:!1}static getHeight(t){return u.isObject(t)?t.offsetHeight:!1}static getScrollPosition(t){let e=0,s=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,s=t.scrollTop;break;case"object":e=t.scrollLeft,s=t.scrollTop;break}return u.isObject(t)===!1?!1:{left:e-(t.clientLeft||0),top:s-(t.clientTop||0)}}static getScrollTop(t){return this.getScrollPosition(t).top}static getScrollLeft(t){return this.getScrollPosition(t).left}static getWindowSize(){let t=window,e=document,s=e.documentElement,i=e.getElementsByTagName("body")[0],r=t.innerWidth||s.clientWidth||i.clientWidth,a=t.innerHeight||s.clientHeight||i.clientHeight;return{width:r,height:a}}static getDocumentSize(){let t=document,e=t.body,s=t.documentElement,i=Math.max(e.scrollHeight,e.offsetHeight,s.clientHeight,s.scrollHeight,s.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,s.clientWidth,s.scrollWidth,s.offsetWidth),height:i}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let s={x:0,y:0};if(u.isObject(t)===!1)return s;let i=0;for(;t&&(e===0||i"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return u.isObject(t)===!1||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return u.isObject(t)===!1?this:(t.classList.toggle(e),this)}},He=(t,e,s)=>{C.setAttr(t,e,s)},$e=(t,e,s)=>{t.checked=t.value==s},Xe=(t,e,s)=>{s=s==1,Zt(t,e,s)},Zt=(t,e,s)=>{t[e]=s},Ye=(t,e)=>C.getAttr(t,e),qe=(t,e)=>t[e],Ge=class extends Qt{constructor(t,e,s,i){super(i),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof s=="string"?this.setupFilter(s):s}addSetMethod(t,e){if(e.substring(4,1)==="-")return this.setValue=He,this.getValue=Ye,this;this.getValue=qe;let s=t.type;if(s)switch(s){case"checkbox":this.setValue=Xe;return;case"radio":this.setValue=$e;return}return this.setValue=Zt,this}getAttrBind(t){if(t)return t;let e="textContent",s=this.element;if(!s||typeof s!="object")return e;let i=s.tagName.toLowerCase();if(i==="input"||i==="textarea"||i==="select"){let r=s.type;if(!r)return e="value",e;switch(r){case"checkbox":e="checked";break;case"file":e="files";break;default:e="value"}}return e}setupFilter(t){let e=/(\[\[[^\]]+\]\])/;return s=>t.replace(e,s)}set(t){let e=this.element;return!e||typeof e!="object"?this:(this.filter&&(t=this.filter(t)),this.setValue(e,this.attr,t),this)}get(){let t=this.element;return!t||typeof t!="object"?"":this.getValue(t,this.attr)}callBack(t,e){return e!==this.element&&this.set(t),this}},Ve=class extends Jt{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,s){return this.element=new Ge(t,e,s,this.pubSub)}addData(t,e){return this.data=new Ue(t,e,this.pubSub)}unsubscribeSource(t){return t&&t.unsubscribe(),this}unsubscribe(){return this.unsubscribeSource(this.element),this.unsubscribeSource(this.data),this.element=null,this.data=null,this}},zt=-1,te=class{constructor(){this.callBacks=new Map,this.lastToken=-1}get(t){return this.callBacks.has(t)||this.callBacks.set(t,[]),this.callBacks.get(t)}reset(){this.callBacks.clear(),this.lastToken=-1,zt=-1}on(t,e){let s=++zt;return this.get(t).push({token:s,callBack:e}),String(s)}off(t,e){let s=this.callBacks.get(t);if(!s)return;let i=s.findIndex(r=>r.token===e);i!==-1&&s.splice(i,1)}remove(t){this.callBacks.delete(t)}publish(t,...e){let s=this.callBacks.get(t);if(s)for(let{callBack:i}of s)!i||i.apply(this,e)}},Ke=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=[20,37,38,39,40],this.connections=new Fe,this.pubSub=new te,this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,s,i){let r=s,a=null;if(s.indexOf(":")!==-1){let h=s.split(":");h.length>1&&(r=h[1],a=h[0])}let n=this.setupConnection(t,e,r,a,i),o=n.element,c=e.get(r);return typeof c<"u"?o.set(c):(c=o.get(),c!==""&&n.data.set(c)),this}setupConnection(t,e,s,i,r){let a=this.getBindId(t),n=new Ve(this.pubSub);n.addData(e,s).subscribe(a);let o=`${e.getDataId()}:${s}`;return n.addElement(t,i,r).subscribe(o),this.addConnection(a,"bind",n),n}addConnection(t,e,s){return this.connections.add(t,e,s),this}setBindId(t){let e="db-"+this.idCount++;return t.dataset&&(t.dataset[this.attr]=e),t[this.attr]=e,e}getBindId(t){return t[this.attr]||this.setBindId(t)}unbind(t){let e=t[this.attr];return e&&this.connections.remove(e),this}watch(t,e,s,i){if(u.isObject(t)===!1)return this;let r=new _e;r.addSource(e).subscribe(s,i);let a=this.getBindId(t),n=e.getDataId()+":"+s;this.addConnection(a,n,r);let o=e.get(s);return typeof o<"u"&&i(o),this}unwatch(t,e,s){if(u.isObject(t)===!1)return this;let i=t[this.attr];if(i){let r=e.getDataId()+":"+s;this.connections.remove(i,r)}return this}publish(t,e,s){return this.pubSub.publish(t,e,s),this}isDataBound(t){return t&&t[this.attr]||null}isBlocked(t){return t.type!=="keyup"?!1:this.blockedKeys.indexOf(t.keyCode)!==-1}bindHandler(t){if(this.isBlocked(t))return!0;let e=t.target||t.srcElement,s=this.isDataBound(e);if(s!==null){let i=this.connections.get(s,"bind");if(i){let r=i.element.get();this.pubSub.publish(s,r,e)}}t.stopPropagation()}setupEvents(){this.changeHandler=this.bindHandler.bind(this),this.addEvents()}addEvents(){typeof document<"u"&&v.on(["change","paste","input"],document,this.changeHandler,!1)}removeEvents(){typeof document<"u"&&v.off(["change","paste","input"],document,this.changeHandler,!1)}},M=new Ke,J=t=>t.data?t.data:t.context&&t.context.data?t.context.data:null,Je={class:"className",text:"textContent",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",celpadding:"cellPadding",useMap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},kt=t=>Je[t]||t,xt=t=>typeof t=="string"&&t.substring(0,2)==="on"?t.substring(2):t,X=class{static create(t,e,s,i){let r=document.createElement(t);return this.addAttributes(r,e),i===!0?this.prepend(s,r):this.append(s,r),r}static addAttributes(t,e){if(!e||typeof e!="object")return;let s=e.type;typeof s<"u"&&C.setAttr(t,"type",s);for(let[i,r]of Object.entries(e))i==="innerHTML"?t.innerHTML=r:i.indexOf("-")!==-1?C.setAttr(t,i,r):this.addAttr(t,i,r)}static addHtml(t,e){return typeof e>"u"||e===""?this:(/(?:<[a-z][\s\S]*>)/i.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,s){if(!(s===""||!e))if(typeof s=="function")e=xt(e),v.add(e,t,s);else{let i=kt(e);t[i]=s}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){let s=document.createTextNode(t);return e&&this.append(e,s),s}static createComment(t,e){let s=document.createComment(t);return e&&this.append(e,s),s}static setupSelectOptions(t,e,s){if(!u.isObject(t)||!u.isArray(e))return!1;e.forEach(i=>{let r=new Option(i.label,i.value);t.options.add(r),s!==null&&r.value==s&&(r.selected=!0)})}static removeElementData(t){let e=t.childNodes;if(e){let r=e.length-1;for(var s=r;s>=0;s--){var i=e[s];!i||this.removeElementData(i)}}P.remove(t),t.bindId&&M.unbind(t)}static removeElement(t){let e;return!t||!(e=t.parentNode)?this:(this.removeElementData(t),e.removeChild(t),this)}static removeChild(t){return this.removeElement(t),this}static removeAll(t){if(!u.isObject(t))return this;let e=t.childNodes;for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&this.removeElementData(e[s]);return t.innerHTML="",this}static changeParent(t,e){return e.appendChild(t),this}static append(t,e){return t.appendChild(e),this}static prepend(t,e,s){let i=s||t.firstChild;return t.insertBefore(e,i),this}static clone(t,e=!1){return u.isObject(t)?t.cloneNode(e):!1}},_=class extends X{static create(t,e,s,i){let r=document.createElement(t);return this.addAttributes(r,e,i),s.appendChild(r),r}static addAttributes(t,e,s){!e||e.length<1||e.forEach(i=>{let{key:r,value:a}=i;this.addAttr(t,r,a,s)})}static addAttr(t,e,s,i){if(s===""||!e)return;if(e==="innerHTML"){t.innerHTML=s;return}if(typeof s=="function"){e=xt(e),v.add(e,t,function(a){s.call(this,a,i)});return}if(e.substr(4,1)==="-"){C.setAttr(t,e,s);return}let r=kt(e);t[r]=s}static addContent(t,e){!e||(e.textContent!==null?t.textContent=e.textContent:e.innerHTML&&(t.innerHTML=e.innerHTML))}static append(t,e){t.appendChild(e)}},Nt=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,st={isWatching(t){return Array.isArray(t)?typeof t[0]=="string"&&this.hasParams(t[0]):this.hasParams(t)},hasParams(t){return u.isString(t)&&t.includes("[[")},_getWatcherProps(t){let e=/\[\[(.*?)(\[\d+\])?\]\]/g,s=t.match(e);return s===null?null:(e=/(\[\[|\]\])/g,s.map(i=>i.replace(e,"")))},updateAttr(t,e,s){switch(e){case"text":case"textContent":t.textContent=s;break;default:_.addAttr(t,e,s);break}},_getWatcherCallBack(t,e,s,i,r){return()=>{let a=0,n=s.replace(Nt,function(){let o=r?e[a]:e;a++;let c=o.get(arguments[2]);return typeof c<"u"?c:""});this.updateAttr(t,i,n)}},getValue(t,e){typeof t=="string"&&(t={value:t});let s=t.value;return Array.isArray(s)===!1?[s,J(e)]:(s.length<2&&s.push(J(e)),s)},getPropValues(t,e,s){let i=[];for(var r=0,a=e.length;r1;a=(h,d)=>{h=c!==!0?h:this.getPropValues(s,o,r),n(h,e,d)}}else{let o=t.attr||"textContent";a=this._getWatcherCallBack(e,s,i,o,r)}return a},addDataWatcher(t,e,s){let i=this.getValue(e,s),r=i[1];if(!r)return;let a=i[0],n=Array.isArray(r),o=this.getCallBack(e,t,r,a,n),c=this._getWatcherProps(a);for(var h=0,d=c.length;htypeof t!="string"?t:ee(t),ee=t=>[{tag:"text",textContent:t}],Ze=t=>{if(!t)return{props:{},children:[]};let e=t[0];return typeof e=="string"?{props:{},children:ee(e)}:Array.isArray(e)?st.isWatching(e)===!1?{props:{},children:e}:{props:{watch:e},children:[]}:{props:e||{},children:Qe(t[1])}},f=t=>(...e)=>{let{props:s,children:i}=Ze(e);return t(s,i)};function Rt(t,e){let s=isNaN(Number(e)),i=s?e:`[${e}]`;return t===""?i:s?`${t}.${i}`:`${t}${i}`}function se(t,e="",s=""){return{get(i,r,a){let n=i[r];if(e===""&&r in i)return typeof n=="function"?n.bind(i):n;let o=i[s]||i;if(n=Reflect.get(o,r,a),k.isPlainObject(n)||Array.isArray(n)){let c=Rt(e,r);return new Proxy(n,se(t,c,s))}return n},set(i,r,a,n){if(e===""&&r in i)return i[r]=a,!0;let o=Rt(e,r);return t.set(o,a),!0}}}var ts=(t,e="stage")=>new Proxy(t,se(t,"",e)),Mt=class{static resume(t,e){if(!t)return null;let s,i=localStorage.getItem(t);return i===null?e&&(s=e):s=JSON.parse(i),s}static store(t,e){if(!t||!e)return!1;let s=JSON.stringify(e);return localStorage.setItem(t,s),!0}static remove(t){return t?(localStorage.removeItem(t),!0):!1}},ie=t=>{let e={};if(!u.isObject(t))return e;let s=k.clone(t);return Object.keys(s).forEach(i=>{let r=s[i];typeof r!="function"&&(e[i]=r)}),e},es=0,V={CHANGE:"change",DELETE:"delete"},Ft=(t,e)=>`${t}:${e}`,Ct=class{constructor(t){this.dirty=!1,this.links={},this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=new te;let e=ie(t);return this.set(e),ts(this)}setup(){this.stage={}}_init(){let t=++es;this._dataNumber=t,this._id=`dt-${t}`,this._dataId=`${this._id}:`}getDataId(){return this._id}remove(){}on(t,e){let s=Ft(t,V.CHANGE);return this.eventSub.on(s,e)}off(t,e){let s=t+V.CHANGE;this.eventSub.off(s,e)}_setAttr(t,e,s=this,i=!1){let r=this.stage[t];e!==r&&(this.stage[t]=e,this._publish(t,e,s,V.CHANGE))}publishLocalEvent(t,e,s,i){let r=Ft(t,i);this.eventSub.publish(r,e,s)}_publish(t,e,s,i){this.publishLocalEvent(t,e,s,i),s=s||this,M.publish(this._dataId+t,e,s)}set(...t){if(typeof t[0]!="object")return this._setAttr(...t),this;let[e,s,i]=t;return Object.entries(e).forEach(([r,a])=>{typeof a!="function"&&this._setAttr(r,a,s,i)}),this}getModelData(){return this.stage}_deleteAttr(t,e,s=this){delete t[e],this.publishLocalEvent(e,null,s,V.DELETE)}toggle(t){if(!(typeof t>"u"))return this.set(t,!this.get(t)),this}increment(t){if(typeof t>"u")return;let e=this.get(t);return this.set(t,++e),this}decrement(t){if(typeof t>"u")return;let e=this.get(t);return this.set(t,--e),this}concat(t,e){if(typeof t>"u")return;let s=this.get(t);return this.set(t,s+e),this}ifNull(t,e){return this.get(t)===null&&this.set(t,e),this}setKey(t){return this.key=t,this}resume(t){let e=Mt.resume(this.key,t);return e?(this.set(e),this):this}store(){let t=this.get();return Mt.store(this.key,t)}delete(t){if(typeof t=="string"){this._deleteAttr(this.stage,t);return}this.setup()}_getAttr(t,e){return t[e]}get(t){return typeof t<"u"?this._getAttr(this.stage,t):this.getModelData()}link(t,e,s){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,s);let i=[];return Object.entries(e).forEach(([r])=>{i.push(this.remoteLink(t,r))}),i}remoteLink(t,e,s){let i=s||e,r=t.get(e);typeof r<"u"&&this.get(e)!==r&&this.set(e,r);let a=t.on(e,(o,c)=>{if(c===this)return!1;this.set(i,o,t)});this.addLink(a,t);let n=this.on(i,(o,c)=>{if(c===t)return!1;t.set(e,o,this)});return t.addLink(n,this),a}addLink(t,e){this.links[t]=e}unlink(t){if(t){this.removeLink(t);return}let e=this.links;k.isEmpty(e)||(Object.entries(e).forEach(([s,i])=>{this.removeLink(i,!1)}),this.links={})}removeLink(t,e=!0){let s=this.links[t];s&&s.off(t),e!==!1&&delete this.links[t]}};Ct.prototype.isData=!0;var j={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,hasDeepData(t){return t.indexOf(".")!==-1||t.indexOf("[")!==-1},getSegments(t){let e=this.deepDataPattern;return t.match(e)}},nt=class{static set(t,e,s){if(!j.hasDeepData(e)){t[e]=s;return}let i,r=j.getSegments(e),a=r.length,n=a-1;for(var o=0;o0?isNaN(r)&&(c+="."+r):c=r;var d;if(h===o)d=s;else{var m=a[h+1];if(isNaN(m)===!1){c+="["+m+"]";continue}var D={};D[m]=t[m],d=D}this.publish(c,d,i)}}static publish(t,e,s){if(t=t||"",s(t,e),!(!e||typeof e!="object")){if(Array.isArray(e)){this.publishArray(t,e,s);return}this.publishObject(t,e,s)}}static publishArray(t,e,s){let i,r,a=e.length;for(var n=0;nthis._publishAttr(a,n,s,i);Wt.publish(t,e,r)}_publishAttr(t,e,s,i){let r=this._dataId+t;M.publish(r,e,s),this.publishLocalEvent(t,e,s,i)}mergeStage(){this.attributes=k.clone(this.stage),this.dirty=!1}getModelData(){return this.mergeStage(),this.attributes}revert(){this.set(this.attributes),this.dirty=!1}_deleteAttr(t,e,s=this){nt.delete(t,e);let i=(r,a)=>this.publishLocalEvent(r,a,s,V.DELETE);Wt.publish(e,e,i)}_getAttr(t,e){return nt.get(t,e)}},ss={"\n":"\\n","\r":"\\n"," ":"\\t"},is=(t,e)=>{typeof t!="string"&&(t=String(t));let s=e?/[\n\r\t]/g:/\t/g;return t.replace(s,i=>ss[i])},_t=(t,e)=>{if(typeof t!="string")return t;t=is(t,e),t=encodeURIComponent(t);let s=/%22/g;return t.replace(s,'"')},re=(t,e)=>{let s=typeof t;return s==="undefined"?t:s!=="object"?(t=_t(t),t):(Object.entries(t).forEach(([i,r])=>{r!==null&&(t[i]=typeof r=="string"?re(r,e):_t(r,e))}),t)};function rs(t){return typeof t<"u"&&t.length>0?JSON.parse(t):!1}function ae(t){return typeof t<"u"?JSON.stringify(t):null}var ne=class{static prepareJsonUrl(t,e=!1){let s=typeof t=="object"?k.clone(t):t,i=re(s,e);return ae(i)}static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};ot(ne,"json",{encode:ae,decode:rs});var as=class{constructor(t){this.model=t,this.objectType=this.objectType||"item",this.url="",this.validateCallBack=null,this.init()}init(){let t=this.model;t&&t.url&&(this.url=t.url)}isValid(){let t=this.validate();if(t!==!1){let e=this.validateCallBack;typeof e=="function"&&e(t)}return t}validate(){return!0}getDefaultParams(){return""}setupParams(t){let e=this.getDefaultParams();return t=this.addParams(t,e),t}objectToString(t){let e=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(s+"="+t[s]);return e.join("&")}addParams(t,e){if(t=t||{},typeof t=="string"&&(t=z.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=z.parseQueryString(e,!1)),this._isFormData(t))for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.append(s,e[s]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let s=this.model.get("id"),i="op=get&id="+s,r=this.model;return this._get("",i,t,e,a=>{if(a){let n=this.getObject(a);n&&r.set(n)}})}getObject(t){return t[this.objectType]||t||!1}setupObjectData(){let t=this.model.get();return this.objectType+"="+ne.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return!1;let s="op=setup&"+this.setupObjectData();return this._put("",s,t,e)}add(t,e){if(!this.isValid())return!1;let s="op=add&"+this.setupObjectData();return this._post("",s,t,e)}update(t,e){if(!this.isValid())return!1;let s="op=update&"+this.setupObjectData();return this._patch("",s,t,e)}delete(t,e){let s=this.model.get("id"),i="op=delete&id="+s;return this._delete("",i,t,e)}all(t,e,s,i,r){r=r||"",s=isNaN(s)?0:s,i=isNaN(i)?50:i;let a="op=all&option="+r+"&start="+s+"&stop="+i;return this._get("",a,t,e)}getUrl(t){let e=this.url;return t?t[0]==="?"?e+t:e+="/"+t:e}setupRequest(t,e,s,i,r){let a={url:this.getUrl(t),method:e,params:s,completed:(n,o)=>{typeof r=="function"&&r(n),this.getResponse(n,i,o)}};return this._isFormData(s)&&(a.headers={}),Vt(a)}_isFormData(t){return t instanceof FormData}request(t,e,s,i){return this._request("","POST",t,e,s,i)}_get(t,e,s,i,r){return e=this.setupParams(e),e=this.addParams(e,s),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",i,r)}_post(t,e,s,i,r){return this._request(t,"POST",e,s,i,r)}_put(t,e,s,i,r){return this._request(t,"PUT",e,s,i,r)}_patch(t,e,s,i,r){return this._request(t,"PATCH",e,s,i,r)}_delete(t,e,s,i,r){return this._request(t,"DELETE",e,s,i,r)}_request(t,e,s,i,r,a){return s=this.setupParams(s),s=this.addParams(s,i),this.setupRequest(t,e,s,r,a)}getResponse(t,e,s){typeof e=="function"&&e(t,s)}static extend(t){if(!t)return!1;let e=this;class s extends e{constructor(r){super(r)}}return Object.assign(s.prototype,t),s}},ns=t=>{let e={};if(!u.isObject(t)||!t.defaults)return e;let{defaults:s}=t;return Object.keys(s).forEach(i=>{let r=s[i];typeof r!="function"&&(e[i]=r)}),delete t.defaults,e},ls=t=>{if(!t||typeof t.xhr!="object")return{};let e={...t.xhr};return delete t.xhr,e},os=0,le=class extends rt{constructor(t){let e=super(t);return this.initialize(),e}setup(){this.attributes={},this.stage={},this.xhr=null}initialize(){}static extend(t={}){let e=this,s=ls(t),i=this.prototype.service.extend(s),r=ns(t);class a extends e{constructor(c){let h={...r,...ie(c)};super(h);p(this,"dataTypeId",`bm${os++}`);this.xhr=new i(this)}}return Object.assign(a.prototype,t),a.prototype.service=i,a}};le.prototype.service=as;var Lt=class extends Ct{},cs=class extends Lt{constructor(t){super(),this.id=t}setup(){this.stage={},this.id=null}addAction(t,e){typeof e<"u"&&this.set(t,e)}getState(t){return this.get(t)}removeAction(t,e){if(e){this.off(t,e);return}let s=this.stage;typeof s[t]<"u"&&delete s[t]}},U=class{static restore(t,e){this.targets.set(t,e)}static getTarget(t){return this.targets.has(t)||this.targets.set(t,new cs(t)),this.targets.get(t)}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,s){let i=this.getTarget(t);return e&&i.addAction(e,s),i}static addAction(t,e,s){return this.add(t,e,s)}static removeAction(t,e,s){this.off(t,e,s)}static on(t,e,s){let i=this.getTarget(t);return e?i.on(e,s):null}static off(t,e,s){this.remove(t,e,s)}static remove(t,e,s){let i=this.targets,r=i.get(t);if(r){if(e){r.off(e,s);return}this.targets.delete(t)}}static set(t,e,s){this.getTarget(t).set(e,s)}};ot(U,"targets",new Map);var hs=class{constructor(){this.events=[]}addEvents(t){t.length<1||t.forEach(e=>{this.on(...e)})}on(t,e,s,i){v.on(t,e,s,i),this.events.push({event:t,obj:e,callBack:s,capture:i})}off(t,e,s,i){v.off(t,e,s,i);let r,a=this.events;for(var n=0,o=a.length;n{v.on(t.event,t.obj,t.callBack,t.capture)})}unset(){this.events.forEach(t=>{v.off(t.event,t.obj,t.callBack,t.capture)})}reset(){this.unset(),this.events=[]}},us=class{constructor(t,e){this.remoteStates=[];let s=this.convertStates(e);this.addStatesToTarget(t,s)}addStates(t,e){let s=this.convertStates(e);this.addStatesToTarget(t,s)}createState(t,e,s,i){return{action:t,state:e,callBack:s,targetId:i,token:null}}convertStates(t){let e=[];for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(s==="remotes"){this.setupRemoteStates(t[s],e);continue}var i=null,r=null,a=t[s];a&&typeof a=="object"&&(r=a.callBack,i=a.id||a.targetId,a=a.state),e.push(this.createState(s,a,r,i))}return e}setupRemoteStates(t,e){let s;for(var i=0,r=t.length;itypeof t!="string"?t:oe(t),oe=t=>[{tag:"text",textContent:t}],ps=t=>{if(!t)return{props:{},children:[]};let e=t[0];return typeof e=="string"?{props:{},children:oe(e)}:Array.isArray(e)?{props:{},children:e}:{props:e||{},children:ds(t[1])}};P.addType("components",t=>{if(!t)return;let e=t.component;e&&e.rendered===!0&&e.prepareDestroy()});var fs=0,ce=class{constructor(...t){var i;this.isUnit=!0,this.data=null,this.persist=!1,this.children=null,this.nest=null,this.state=null,this.panel=null,this.parent=null,this.init();let{props:e,children:s}=ps(t);this.setupProps(e),(i=this.children)!=null||(this.children=s),this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+fs++}setupProps(t){if(!(!t||typeof t!="object"))for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e])}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){let t=this.getParentContext(),e=this.setContext(t);if(e){this.context=e;return}this.context=t,this.setupAddingContext()}setupAddingContext(){let t=this.context,e=this.addContext(t);if(!e)return;let s=e[0];!s||(this.addingContext=!0,this.contextBranchName=s,this.addContextBranch(s,e[1]))}addContextBranch(t,e){var s;(s=this.context)!=null||(this.context={}),this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){!this.addingContext||this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){!t||delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.persist?this._layout||(this._layout=this.render()):this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){P.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout()}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let s=[];if(!t||t.length<1)return s;for(var i=0,r=t.length;itypeof t=="function"?t:()=>t,vs=t=>{let e={};return t&&Object.entries(t).forEach(([s,i])=>{let r=ms[s]||s;e[r]=gs(i)}),e},Ut=(t,e)=>{class s extends t{}return Object.assign(s.prototype,e),s},At=t=>{if(!t)return null;let e,s=typeof t;return s==="object"&&t.render?(e=vs(t),Ut(L,e)):(e={render:s==="function"?t:()=>t},Ut(ce,e))},ys=(t,e)=>({name:t,callBack:e}),bt={keys:[],items:{},add(t,e){return this.keys.push(t),this.items[t]=ys(t,e),this},get(t){return this.items[t]||null},all(){return this.keys}},Ht=(t,e)=>({attr:t,directive:e}),tt=(t,e)=>({key:t,value:e}),bs=(t,e,s,i)=>({tag:t,attr:e,directives:s,children:i}),Tt=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,s,i){return t==="text"?(i.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(s.push(tt("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,s){let i={attr:kt(e),value:s};t.push(Ht(tt(e,i),bt.get("watch")))}static setButtonType(t,e,s){if(t==="button"){let i=e.type||"button";s.push(tt("type",i))}}static parse(t,e){let s=[],i=[],r=this.getTag(t);this.setButtonType(r,t,s),this.setupChildren(t);let a=[];var n,o;for(var c in t){if(!k.hasOwnProp(t,c)||c==="tag"||(n=t[c],n==null))continue;if((o=bt.get(c))!==null){i.push(Ht(tt(c,n),o));continue}let h=typeof n;if(h==="object"){if(c==="children"){a=a.concat(n);continue}if(st.isWatching(n)){this.setTextAsWatcher(i,c,n);continue}a.push(n);continue}if(h==="function"){let d=n;n=function(m){d.call(this,m,e)}}if(st.isWatching(n)){this.setTextAsWatcher(i,c,n);continue}this.setElementContent(c,n,s,a)||s.push(tt(c,n))}return bs(r,s,i,a)}},he=class{build(t,e,s){}createComponent(t,e,s){let i=t;i.parent=s,s&&s.persist===!0&&i.persist!==!1&&(i.persist=!0),i.cache&&s&&(s[i.cache]=i),i.setup(e);let r=i.prepareLayout(),a=this.build(r,i.container,i);return i.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(i),a}setDirectives(t,e,s){}removeAll(t){}},ws=class extends he{build(t,e,s){let i=_.createDocFragment();return(Array.isArray(t)?t:[t]).forEach(r=>this.buildElement(r,i,s)),e&&typeof e=="object"&&e.appendChild(i),i}buildElement(t,e,s){if(t){if(t.isUnit===!0){this.createComponent(t,e,s);return}this.createElement(t,e,s)}}createElement(t,e,s){let i=Tt.parse(t,s),r=this.createNode(i,e,s);this.cache(r,t.cache,s),i.children.forEach(n=>{n!==null&&this.buildElement(n,r,s)});let a=i.directives;a&&a.length&&this.setDirectives(r,a,s)}setDirectives(t,e,s){e.forEach(i=>{this.handleDirective(t,i,s)})}handleDirective(t,e,s){e.directive.callBack(t,e.attr.value,s)}cache(t,e,s){s&&e&&(s[e]=t)}createNode(t,e,s){let i=t.tag;if(i==="text"){let r=t.attr[0],a=r?r.value:"";return _.createText(a,e)}else if(i==="comment"){let r=t.attr[0],a=r?r.value:"";return _.createComment(a,e)}return _.create(i,t.attr,e,s)}removeAll(t){_.removeAll(t)}},Ps=["area","base","br","col","embed","hr","img","input","link","meta","source"],ut=class{static create(t,e={},s=""){let i=this.createAttributes(e);return Ps.includes(t)?`<${t} ${i} />`:`<${t} ${i}>`+s+``}static createAttributes(t=[]){return!t||t.length<1?"":t.map(e=>{let{key:s,value:i}=e;return typeof i=="function"&&(s="on"+xt(s)),`${s}="${i}"`}).join(" ")}static createText(t){return t}static createComment(t){return``}},Ss=class extends he{build(t,e,s){return(Array.isArray(t)?t:[t]).map(i=>this.buildElement(i,s)).join("")}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,e):this.createElement(t,e):""}createElement(t,e){let s=Tt.parse(t,e),i=s.children.map(r=>r!==null?this.buildElement(r,e):"").join("");return this.createNode(s,i)}createNode(t,e){let s=t.tag;if(s==="text"){let i=t.attr[0],r=i?i.value:"";return ut.createText(r)}else if(s==="comment"){let i=t.attr[0],r=i?i.value:"";return ut.createComment(r)}return ut.create(s,t.attr,e)}removeAll(t){}},ks=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new ws:new Ss}},et=ks.setup(),xs=t=>typeof t=="object"&&t.isUnit===!0,Cs=t=>{let e=At(t);return new e},A=class{static render(t,e,s){return t?(xs(t)||(t=Cs(t)),et.createComponent(t,e,s)):null}static build(t,e,s){return et.build(t,e,s)}static rebuild(t,e,s){return et.removeAll(e),this.build(t,e,s)}static setDirectives(t,e,s){et.setDirectives(t,e,s)}static createNode(t,e,s){return et.createNode(t,e,s)}};R.augment({buildLayout(t,e,s){A.build(t,e,s)}});var Et=[],Ls=t=>Et.indexOf(t)!==-1,As=t=>({tag:"script",src:t.src,async:!1,load(e){Et.push(t.src);let s=t.load;s&&s()}}),Ts=t=>({tag:"link",rel:"stylesheet",type:"text/css",href:t.src,load(e){Et.push(t.src);let s=t.load;s&&s()}}),Es=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,s=this.update.bind(this);t.indexOf(".css")!==-1?e=Ts({load:s,src:t}):e=As({load:s,src:t}),A.build(e,document.head)}addFiles(t){!t||t.forEach(e=>{Ls(e)||this.add(e)})}update(){if(this.updateProgress()<100)return;let t=this.callBack;t&&t()}updateProgress(){return++this.loaded,this.percent=Math.floor(this.loaded/this.total*100)}},Bs=(t,e)=>{let s=t;typeof t=="string"&&(s=De(()=>import(t),[])),s.then(i=>{e&&e(i)})},Ds=t=>{var e;return t?typeof((e=t==null?void 0:t.prototype)==null?void 0:e.constructor)=="function":!1},Os=(t,e,s)=>{let i=A.build(t,null,s),r=i.firstChild;return e.after(i),r},js=t=>({tag:"comment",textContent:"import placeholder",onCreated:t.onCreated}),Is=At({render(){return js({onCreated:t=>{if(this.src){if(this.depends){new Es(()=>{this.loadAndRender(t)}).addFiles(this.depends);return}this.loadAndRender(t)}}})},getLayout(t){let e=t.default;if(!e)return null;let s=this.callBack;return s?e=s(e):Ds(e)?(e=new e,e.route=this.route,this.persist&&(e.persist=!0)):e=e(),this.layout=e},loadAndRender(t){Bs(this.src,e=>{this.loaded=!0;let s=this.layout||this.getLayout(e);this.layoutRoot=Os(s,t,this.parent)})},shouldUpdate(t){return this.updateLayout===!0?!0:this.updateLayout=t&&t.isUnit&&typeof t.update=="function"},updateModuleLayout(t){let e=this.layout;this.shouldUpdate(e)&&e.update(t)},update(t){this.loaded===!0&&this.updateModuleLayout(t)},beforeDestroy(){!this.layoutRoot||X.removeElement(this.layoutRoot)}}),zs=t=>(typeof t=="string"&&(t={src:t}),new Is(t)),Bt=(t,e,s,i)=>{if(Array.isArray(s[0])){s.forEach(r=>{!r||Bt(t,e,r,i)});return}Ns(t,e,s,i)},Ns=(t,e,s,i)=>{let r,a;if(s.length<3?[r,a]=s:[e,r,a]=s,!e||!r)return;let n=Rs(t,r,a,i);M.watch(t,e,r,n)},Rs=(t,e,s,i)=>typeof s=="object"?r=>{Us(t,s,r)}:r=>{Ms(t,s,e,r,i)},Ms=(t,e,s,i,r)=>{let a=e(i,t,r);switch(typeof a){case"object":a=Fs(r,s,i,a),_s(a,t,r);break;case"string":X.addHtml(t,a);break}},Fs=(t,e,s,i)=>!t||!i||i.isUnit!==!0||t.persist!==!0||!t.state?i:Ws(t,e,s,i),Ws=(t,e,s,i)=>{let r=e+":"+s,a=t.state,n=a.get(r);return typeof n<"u"&&(i=n),a.set(r,i),i},_s=(t,e,s)=>{A.rebuild(t,e,s)},Us=(t,e,s)=>{for(let[i,r]of Object.entries(e))!i||(r===s?C.addClass(t,i):C.removeClass(t,i))},ue=(t,e,s)=>{let i=J(s);Bt(t,i,e,s)},Hs=(t,e,s)=>{!e||e&&C.setAttr(t,"role",e)},$s=t=>(e,s)=>{let i=s?"true":"false";C.setAttr(e,t,i)},Xs=(t,e,s)=>{if(!e)return;let i=e.role;i&&(C.setAttr(t,"role",i),e.role=null),Object.entries(e).forEach(([r,a])=>{if(a===null)return;let n=`aria-${r}`;Array.isArray(a)?(a.push($s(n)),ue(t,a,s)):C.setAttr(t,n,a)})};P.addType("context",t=>{if(!t)return!1;t.parent.removeContextBranch(t.branch)});var Dt=t=>t?t.getContext():null,Ys=(t,e,s)=>{if(typeof e!="function")return;let i=Dt(s),r=e(i);if(!r)return;let a=Tt.parse(r,s);_.addAttributes(t,a.attr,s),A.setDirectives(t,a.directives,s)},qs=(t,e,s)=>{if(typeof e!="function")return;let i=Dt(s);e(i)},Gs=(t,e,s)=>{if(typeof e!="function"||!s)return;let i=Dt(s),r=e(i);!r||s.addContextBranch(r[0],r[1])},Vs=(t,e,s)=>{},Ks=(t,e,s)=>{!e||!s||e(s,t)},Js=(t,e,s)=>{!e||!s||e(s.data,t)},Qs=(t,e,s)=>{!e||!s||e(s.state,t)},Zs=(t,e,s)=>{if(!(!e||!s)&&s.stateHelper){let i=s.state,r=e(i);s.stateHelper.addStates(r)}},ti=(t,e,s)=>{let i,r,a;if(typeof e=="string"){if(i=J(s),!i)return;r=e}else if(Array.isArray(e)){if(typeof e[0]!="object"){let n=J(s);if(!n)return;e.unshift(n)}[i,r,a]=e}M.bind(t,i,r,a)},ei=(t,e,s)=>{let i,r,a,n;if(e.length<3){let c=J(s);if(!c)return;i=c,[r,a,n]=e}else[i,r,a,n]=e;let o=n!==!1;M.watch(t,i,r,c=>{if(X.removeAll(t),!c||c.length<1)return;let h=[];return c.forEach((d,m)=>{let D=o?i.scope(r+"["+m+"]"):null,O=a(c[m],m,D);O!==null&&h.push(O)}),A.build(h,t,s)})},si=(t,e,s)=>{let i=e[0];if(!i||i.length<1)return;let r=e[1],a=[];i.forEach((n,o)=>{if(!n)return;let c=r(n,o);c!==null&&a.push(c)}),A.build(a,t,s)},ii=(t,e,s)=>{e(t)};P.addType("destroyed",t=>{if(!t)return!1;t.callBack(t.ele)});var ri=(t,e,s)=>{ai(t,e)},ai=(t,e)=>{P.add(t,"destroyed",{ele:t,callBack:e})},ni=(t,e,s)=>{Bt(t,s.state,e,s)},li=(t,e,s)=>{if(e)if(Array.isArray(e)&&typeof e[0]!="string")for(var i=0,r=e.length;i{if(!t.length)return null;let e={};return t.forEach(s=>{e[s]=null}),e},fi=t=>{let e=[];if(!t)return e;let s=/[*?]/g;t=t.replace(s,"");let i=/:(.[^./?&($]+)\?*/g,r=t.match(i);return r===null||r.forEach(a=>{a&&(a=a.replace(":",""),e.push(a))}),e},mi=t=>t.replace(/\//g,"/"),gi=t=>t.replace(/(\/):[^/(]*?\?/g,e=>e.replace(/\//g,"(?:$|/)")),vi=t=>(t=t.replace(/(\?\/+\*?)/g,"?/*"),t.replace(/(:[^/?&($]+)/g,e=>e.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),yi=t=>t.replace(/(\*)/g,".*"),bi=(t,e)=>t+=e[e.length-1]==="*"?"":"$",wi=t=>{if(!t)return"";let e=mi(t);return e=gi(e),e=vi(e),e=yi(e),e=bi(e,t),e},Pi=0,Si=class extends Lt{constructor(t,e){let s=t.baseUri,i=fi(s),r=pi(i),a=super(r);return this.uri=s,this.paramKeys=i,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),a}setup(){this.stage={},this.id=null,this.uri=null,this.uriQuery=null,this.controller=null,this.paramKeys=null,this.titleCallBack=null,this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null}setupRoute(t){this.id=t.id||"bs-rte-"+Pi++,this.path=null,this.referralPath=null;let e=wi(this.uri);this.uriQuery=new RegExp("^"+e),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title}setTitle(t){this.titleCallBack(this,t)}deactivate(){this.set("active",!1);let t=this.controller;t&&t.remove()}getLayout(t){if(t.component)return t.component;let e=t.import;return e?zs(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:s,persist:i=!1,parent:r}=t,a={component:e,container:s,persist:i,parent:r};this.controller=new di(this,a)}resume(t){let e=this.controller;e&&(e.container=t)}setPath(t,e){this.path=t,this.referralPath=e}select(){this.set("active",!0);let t=this.stage,e=this.callBack;typeof e=="function"&&e(t);let s=this.controller;s&&s.focus(t);let i=this.path;if(!i)return;let r=i.split("#")[1];!r||this.scrollToId(r)}scrollToId(t){if(!t)return;let e=document.getElementById(t);!e||e.scrollIntoView(!0)}match(t){let e=!1,s=t.match(this.uriQuery);return s===null?(this.resetParams(),e):(Array.isArray(s)&&(s.shift(),e=s,this.setParams(s)),e)}resetParams(){this.stage={}}setParams(t){if(!Array.isArray(t))return;let e=this.paramKeys;if(!e)return;let s={};e.forEach((i,r)=>{typeof i<"u"&&(s[i]=t[r])}),this.set(s)}getParams(){return this.stage}},ki=t=>{let e=/\w\S*/;return t.replace(e,s=>s.charAt(0).toUpperCase()+s.substring(1).toLowerCase())},xi=(t,e)=>{if(t.indexOf(":")===-1)return t;let s=e.stage;for(let[i,r]of Object.entries(s)){let a=new RegExp(":"+i,"gi");t=t.replace(a,r)}return t},Ci=(t,e)=>e&&(typeof e=="function"&&(e=e(t.stage)),e=xi(e,t),ki(e)),Li=(t,e)=>(e!==""&&(t+=" - "+e),t),Ai=(t,e,s)=>e&&(e=Ci(t,e),Li(e,s)),Ti={removeSlashes(t){return typeof t!="string"?"":(t.substring(0,1)==="/"&&(t=t.substring(1)),t.substring(-1)==="/"&&(t=t.substring(0,t.length-1)),t)}};P.addType("routes",t=>{if(!t)return!1;let e=t.route;e&&at.removeRoute(e)});P.addType("switch",t=>{if(!t)return!1;let e=t.id;at.removeSwitch(e)});var Ei=()=>typeof window<"u"?window.location:{},Bi=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.history=null,this.callBackLink=null,this.location=Ei(),this.routes=[],this.switches={},this.switchCount=0,this.data=new rt({path:""})}setupHistory(){this.history=ui.setup(this)}createRoute(t){let e=t.uri||"*";return t.baseUri=this.createURI(e),new Si(t,this.updateTitle.bind(this))}add(t){if(typeof t!="object"){let s=arguments;t={uri:s[0],component:s[1],callBack:s[2],title:s[3],id:s[4],container:s[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.resume(e),this.addRoute(t)}getBasePath(){if(!this.basePath){let t=this.baseURI||"";t[t.length-1]!=="/"&&(t+="/"),this.basePath=t}return this.basePath}createURI(t){return this.getBasePath()+Ti.removeSlashes(t)}getRoute(t){let e=this.routes,s=e.length;if(s>0)for(var i=0;i0)for(var i=0;i-1&&e.splice(s,1)}addSwitch(t){let e=this.switchCount++,s=this.getSwitchGroup(e);return t.forEach(i=>{let r=this.createRoute(i);s.push(r)}),this.checkGroup(s,this.getPath()),e}resumeSwitch(t,e){let s=this.switchCount++,i=this.getSwitchGroup(s);return t.forEach(r=>{let a=r.component.route;a.resume(e),i.push(a)}),this.checkGroup(i,this.getPath()),s}getSwitchGroup(t){return this.switches[t]=[]}removeSwitch(t){let e=this.switches;e[t]&&delete e[t]}remove(t){t=this.createURI(t);let e=this.getRoute(t);return e!==!1&&this.removeRoute(e),this}setup(t,e){this.baseURI=t||"/",this.updateBaseTag(this.baseURI),this.title=typeof e<"u"?e:"",this.setupHistory(),this.data.path=this.getPath(),this.callBackLink=this.checkLink.bind(this),v.on("click",document,this.callBackLink);let s=this.getEndPoint();return this.navigate(s,null,!0),this}updateBaseTag(t){let e=document.getElementsByTagName("base");e.length&&(e[0].href=t)}getParentLink(t){let e=t.parentNode;for(;e!==null;){if(e.nodeName.toLowerCase()==="a")return e;e=e.parentNode}return!1}checkLink(t){if(t.ctrlKey===!0)return!0;let e=t.target||t.srcElement;if(e.nodeName.toLowerCase()!=="a"&&(e=this.getParentLink(e),e===!1)||e.target==="_blank"||C.data(e,"cancel-route"))return!0;let s=e.getAttribute("href");if(typeof s<"u"){let i=this.baseURI,r=i!=="/"?s.replace(i,""):s;return this.navigate(r),t.preventDefault(),t.stopPropagation(),!1}}reset(){return this.routes=[],this.switches=[],this.switchCount=0,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,s){return t=this.createURI(t),this.history.addState(t,e,s),this.activate(),this}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;document.title=Ai(t,e,this.title)}checkActiveRoutes(t){this.lastPath=this.path,t=t||this.getPath(),this.path=t;let e=this.routes,s=e.length,i;for(var r=0;r"u")&&this.checkRoute(i,t);this.checkSwitches(t),this.updatePath()}checkSwitches(t){let e=this.switches;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var i=e[s];this.checkGroup(i,t)}}checkGroup(t,e){let s=!1,i,r,a,n,o=!1;for(var c=0,h=t.length;c"u")){if(c===0&&(r=i),!a&&i.get("active")&&(a=i),s!==!1){o&&i.deactivate();continue}s=i.match(e),s!==!1&&(n=i,i.controller&&(this.select(i),o=!0))}if(n===void 0){this.select(r),a&&r!==a&&a.deactivate();return}a?o&&n!==a&&a.deactivate():r&&o===!1&&this.select(r)}checkRoute(t,e){let s=this.check(t,e);return s!==!1?this.select(t):t.deactivate(),s}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t){!t||(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t))}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){v.off("click",document,this.callBackLink)}getPath(){let t=this.location,e=this.path=t.pathname;return this.history.type==="hash"?t.hash.replace("#",""):e+t.search+t.hash}},at=new Bi,Di=(t,e,s)=>{!e||(Array.isArray(e)?e.forEach(i=>{$t(t,i,s)}):$t(t,e,s))},$t=(t,e,s)=>{e.container=t,e.parent=s;let i=at.add(e);Oi(t,i)},Oi=(t,e)=>{P.add(t,"routes",{route:e})},ji=(t,e,s)=>{e[0],e.forEach(r=>{r.container=t,r.parent=s});let i=at.addSwitch(e);Ii(t,i)},Ii=(t,e)=>{P.add(t,"switch",{id:e})};bt.add("cache",Vs).add("onCreated",ii).add("onDestroyed",ri).add("bind",ti).add("onSet",ue).add("onState",ni).add("watch",li).add("useParent",Ks).add("useData",Js).add("useState",Qs).add("addState",Zs).add("map",si).add("for",ei).add("useContext",qs).add("addContext",Gs).add("context",Ys).add("role",Hs).add("aria",Xs).add("route",Di).add("switch",ji);R.augment({Ajax:Vt,Html:X,dataBinder:M,Data:rt,SimpleData:Lt,Model:le,State:U,Builder:A,router:at,Component:L});var y=(t,e)=>({...t,children:e}),l=f((t,e)=>y(t,e)),pe=f((t,e)=>y({...t,tag:"dialog"},e)),E=f((t,e)=>y({...t,tag:"span"},e)),B=f((t,e)=>y({...t,tag:"p"},e)),Y=f((t,e)=>y({...t,tag:"a"},e)),H=f((t,e)=>y({...t,tag:"button"},e)),fe=f((t,e)=>y({...t,tag:"ul"},e)),me=f((t,e)=>y({...t,tag:"li"},e)),T=f(t=>y({...t,tag:"img"},null)),$=f((t,e)=>y({...t,tag:"h2"},e)),zi=f(t=>y({...t,tag:"input"},null)),W=f((t,e)=>y({...t,tag:"label"},e)),Ni=f(t=>zi({...t,type:"checkbox"})),b=f((t,e)=>y({...t,tag:"section"},e)),Q=f((t,e)=>y({...t,tag:"article"},e)),x=f((t,e)=>y({...t,tag:"header"},e)),Ri=f((t,e)=>y({...t,tag:"footer"},e)),Mi=f((t,e)=>y({...t,tag:"nav"},e)),Fi=f((t,e)=>y({...t,tag:"main"},e)),Wi=f((t,e)=>y({...t,tag:"audio"},e)),_i=f((t,e)=>y({...t,tag:"canvas"},e));const ge=({class:t,click:e,children:s})=>pe({class:`prompt-panel ${t}`,click:e},[l({class:"panel-top-button-container"},[l({class:"bttn circle close",click:(i,r)=>r.close()},[l({class:"content"},[E(),E()])])]),...s]);class q extends L{render(){const e=s=>{s.target===this.panel&&this.close()};return ge({class:this.class,click:e,children:[l({class:"touch-slider"},[l({class:"step"},[b(this.children)])])]})}open(){A.render(this,document.body),this.panel.showModal(),typeof this.activateCallBack=="function"&&this.activateCallBack()}close(){!this.panel||(this.panel.close(),this.destroy(),typeof this.deactivateCallBack=="function"&&this.deactivateCallBack())}}const Ui=({class:t,click:e,children:s})=>pe({class:`prompt-panel ${t}`,click:e},[...s]);class Hi extends q{render(){return Ui({class:this.class,children:[l({class:"touch-slider"},[l({class:"step"},[b(this.children)])])]})}}const $i=t=>new Hi({...t,class:"orientation-panel"},[l({class:"content"},[T({src:"images/multisplode.svg",type:"image/svg+xml"}),l({class:"title-enhance"},"Landscape Orientation Needed"),B("Please rotate your device to landscape mode to play the game.")])]),S=U.add("settings"),Xi="settings";S.setKey(Xi);const Yi={audio:!1,music:!1,graphics:"medium",song:"play-loop.mp3"};S.resume(Yi);class qi extends L{render(){return Wi({src:this.getFilePath(),loop:!0})}getFilePath(){return"sound/music/"+this.fileName}change(e){this.fileName!==e&&(this.fileName=e,this.panel.src=this.getFilePath(),this.state.music===!0&&this.start())}afterSetup(){S.music===!0&&this.start()}setupStates(){return{remotes:[{id:"settings",music:{callBack:e=>{!this.panel||(e===!0?this.start():this.stop())}},song:{callBack:e=>{!this.panel||this.change(e)}}}]}}start(){const e=this.panel;e.volume=.6,e.play()}stop(){this.panel.pause()}}const Gi=()=>typeof window.localStorage<"u",lt=Gi(),ve={storage:null,setup(){return lt===!0&&(this.storage=window.localStorage),this},get(t){if(lt===!1)return null;const e=this.storage.getItem(t);if(typeof e<"u")return JSON.parse(e)},set(t,e){lt===!0&&(e=JSON.stringify(e),this.storage.setItem(t,e))},clear(){lt===!0&&this.storage.clear()}}.setup(),w={currentLevel:null,activeLevels:[],controller:null,packs:[],activePack:null,game:null,setGame(t){this.game=t},setupActivePack(){this.packs.length>0&&(this.activePack=this.packs[0],this.activeLevels=this.activePack.setupLevels())},addLevelPack(t){this.packs.push(t)},setup(){this.setupActivePack()},selectPrimaryLevel(){const t=this.getPrimaryLevel();this.setLevel(t)},getPrimaryLevel(){const t=ve.get("lastLevel");return t?this.activeLevels[t.number-1]:this.getFirstUnlockedLevels()},getFirstUnlockedLevels(){const t=this.activeLevels;let e=!1;for(let s=0,i=t.length;s0?--e:t.length-1;return t[s]},selectPreviousLevel(){const t=this.getPreviousLevel();t&&this.selectLevel(t)}},Vi=(t,e)=>me({class:"option title-text",click:(s,i)=>i.moveToSelectedElement(s.target)},t);class ye extends L{constructor(){super(...arguments);p(this,"posX",0)}onCreated(){this.viewNumber=null,this.optionsArray=[],this.selection=null,this.index=0,this.moveX=0,this.startX=0,this.contact=!1}render(){return x({class:"title-container"},[fe({cache:"navContainer",class:"option-container",...this.getEvents(),map:[this.items,Vi]})])}getEvents(){const s=this.start.bind(this),i=this.move.bind(this),r=this.end.bind(this);return{touchstart:s,mousedown:s,touchmove:i,mousemove:i,touchend:r,mouseup:r,mouseout:r}}setupEvents(){const s=this.resize.bind(this);return[["resize",window,s]]}afterSetup(){this.getOptions(),this.reset(),window.setTimeout(()=>this.resize(),10)}selectPrimaryStep(){const s=this.optionsArray[0];s&&this.moveToSelectedOption(s)}reset(){this.selectPrimaryStep()}getParentWidth(){if(this.panel){const s=this.panel.getBoundingClientRect();this.parentWidth=s.width}}getOptions(){let s=this.navContainer.querySelectorAll(".option");if(!s)return[];s=[].slice.call(s);const i=s.map((r,a)=>({element:r,index:a}));this.optionsArray=i,this.getParentWidth()}moveToSelectedElement(s){if(!s)return;let i=this.getOptionByElement(s);i&&this.moveToSelectedOption(i)}moveToSelectedOption(s){s&&(this.selectOption(s),this.moveToElement(s.element))}moveToSelectedIndex(s){let i=this.optionsArray[s];i&&(this.selectOption(i,!0),this.moveToElement(i.element))}selectOptionByIndex(s){let i=this.optionsArray;for(let r=0,a=i.length;r=i&&a.y<=r&&a.y+a.height>=r}end(s){if(this.contact===!0){this.navContainer.classList.remove("active"),this.contact=!1,this.parentWidth/2;let i=this.selection.element;this.moveToElement(i)}}}class dt{static getEventPosition(e){const s={x:0,y:0};if(e){const i=e.touches;if(i){const r=i[0];s.x=r.pageX,s.y=r.pageY}else s.x=e.clientX||e.pageX,s.y=e.clientY||e.pageY}return s}static calculateAngle(){const e=this.startX-this.moveX,s=this.moveY-this.startY,i=Math.atan2(s,e);let r=Math.round(i*180/Math.PI);return r<0&&(r=360-Math.abs(r)),r}static getSwipeDirection(e){let s;return e<=45&&e>=0||e<=360&&e>=315?s="left":e>=135&&e<=225?s="right":e>45&&e<135?s="down":s="up",s}static isLeftRight(){const e=this.calculateAngle(),s=this.getSwipeDirection(e);return s==="left"||s==="right"}}const be="step",Ki=(t,e)=>b({class:be},[t]),Ji=(t,e)=>l({...t,class:"option",onState:["index",{selected:e}],cick:(s,i)=>i.moveToSelectedIndex(e)}),Qi=f((t,e)=>l({class:"crumb-container"},[l({...t,class:"number-crumb-container"},e)]));class Ot extends L{constructor(){super(...arguments);p(this,"canMove",null)}onCreated(){this.viewNumber=null,this.steps=[],this.index=0,this.stepWidth=null,this.minimum=72,this.moveX=0,this.startX=0,this.moveY=0,this.startY=0,this.contact=!1,this.preventTouch=!1,this.preventScroll=!1}render(){return Q({class:"touch-slider step-container"},[l({cache:"slider",class:"step-slider-container",...this.getEvents(),map:[this.items,Ki]}),Qi({map:[this.items,Ji]})])}setupStates(){return{index:this.index}}getEvents(){const s=this.start.bind(this),i=this.move.bind(this),r=this.end.bind(this);return{touchstart:s,mousedown:s,touchmove:i,mousemove:i,touchend:r,mouseup:r,mouseout:r}}setupEvents(){const s=this.getStepWidth.bind(this);return[["resize",window,s]]}afterSetup(){this.getSteps(),this.selectPrimaryStep()}getSteps(){let s=this.slider.querySelectorAll("."+be);if(!s)return[];s=[].slice.call(s);const i=s.map((r,a)=>({ele:r,index:a}));this.steps=i,this.getStepWidth()}moveToSelectedElement(s){if(!s)return;const i=this.getStepByElement(s);i&&this.moveToSelectedStep(i)}moveToSelectedStep(s){if(!s)return;this.getStepWidth();const i=this.stepWidth*s.index;this.moveContainer("-"+i),this.index=s.index,this.state.index=s.index,this.selectStep(s)}moveToSelectedIndex(s){const i=this.steps[s];if(!i)return;this.getStepWidth();const r=this.stepWidth*i.index;this.moveContainer("-"+r),this.index=i.index,this.state.index=i.index,this.selectStep(i,!0)}selectStepByIndex(s){const i=this.steps;for(let r=0,a=i.length;rthis.stepWidth/3&&(this.moveX>this.index*this.stepWidth&&this.index0&&this.index--),this.selectStepByIndex(this.index)}this.moveContainer("-"+this.index*this.stepWidth)}this.state.index=this.index,this.canMove=null,this.preventTouch=!1}}class Z extends L{render(){return this.children[0]}update(e){}}function Zi(t){this.parent.nav&&this.parent.nav.moveToSelectedIndex(t)}function tr(t){this.parent.touch&&this.parent.touch.moveToSelectedIndex(t)}const er=t=>{let e=t.locked===!1?" unlocked":"";return t===w.currentLevel&&(e+=" selected"),"bttn option circle fadeIn"+e},sr=t=>{const e=er(t);return H({class:e,click:(s,{parent:i})=>!t.locked&&i.game.selectLevel(t)},[l({class:"content"},String(t.number))])},ir=({game:t})=>new Z({game:t},[Q({class:"control-sub-panel level-select-container overlay-panel"},[b({class:"home-sub-panel level-select-panel"},[l({class:"panel-top-button-container floatUpZBounce"},[Y({class:"bttn circle close",href:"/"},[l({class:"content"},[E(),E()])])]),new ye({cache:"nav",callBackFn:tr,items:["Level Select"]}),l({class:"main-step-container"},[new Ot({cache:"touch",callBackFn:Zi,items:[l({class:"content",map:[w.activeLevels,sr]})]})])])])]);class rr extends L{onCreated(){var e;(e=this.duration)!=null||(this.duration=4e3),this.timer=null}render(){return l({class:`flash-panel dropInBounce ${this.type}`},[Ri({class:"button-container"},[H({class:"bttn circle close",onclick:()=>this.destroy()},[l({class:"content"},[E(),E()])])]),l({class:"icon-container"}),x({class:"title-container"},[l({class:"title left dark"},this.title),l({class:"description center dark"},this.description)])])}afterSetup(){this.timer=setTimeout(()=>this.destroy(),this.duration)}start(e){A.render(this,e)}}const it=Math.PI*2,ar=180/Math.PI,nr=Math.PI/180,g={randomFromTo(t,e,s){return s=typeof s<"u"?!0:s,s?Math.floor(Math.random()*(e-t+1)+t):Math.random()*(e-t+1)+t},arc:it,checkCircluarCollision(t,e,s,i,r,a){const n=t-i,o=e-r;return n*n+o*o<=(s+a)*(s+a)},getOrbitPosition(t,e,s,i){let r=Math;return{x:t+r.cos(s)*i,y:e+r.sin(s)*i}},updateOrbitAngle(t,e,s){return s=typeof s>"u"?!0:s,s?t+e:t-e},getBezierCurve(t,e,s,i,r){let a=r,n=3(e.x-t.x),o=3(s.x-e.x)-n,c=i.x-t.x-n-o,h=3(e.y-t.y),d=3(s.y-e.y),m=i.y-t.y-h-d;c*(a*a*a)+o*(a*a)+n*a+t.x,m*(a*a*a)+d*(a*a)+h*a+t.y},spiral(t,e){return t+e},degreesPI:ar,getDegrees(t){return t*this.degreesPI},radiansPI:nr,getRadians(t){return t*this.radiansPI},getSlope(t,e,s,i){let r=t-s;return(e-i)/r},getAngle(t,e,s,i){const r=t-s,a=e-i,n=Math.atan2(a,r);return this.getDegrees(n)},getPositionByAngle(t,e){const s=this.getRadians(t);return{x:Math.cos(s)*e,y:Math.sin(s)*e}},getDistance(t,e,s,i){const r=t-s,a=e-i;return Math.sqrt(r*r+a*a)},getNextPosition(t,e,s,i,r){const a=this.getDistance(t,e,s,i),n=this.getMovementBySpeed(a,r);return{x:(s-t)/n,y:(i-e)/n}},distance(t,e){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))},getMovementBySpeed(t,e){return t/e},round(t){return~~(.5+t)},floor(t){return~~t}},we={options:[],messages:{awful:[],bad:[],good:[],close:[],great:[]},reset(){this.options=[]},setup(){const t=this.messages,e=(s,i,r)=>{const a={title:i,text:r};t[s].push(a)};e("awful","Whaaaa?","Let's just pretend this didn't happen..."),e("awful","Umm...","I've stopped watching already. Let's try again"),e("awful","Uhhh...","Houston, we have a problem"),e("awful","Achievement unlocked (not really)","Being this bad has to be rewarded..."),e("awful","Maybe next time...","Just click retry and don't look back"),e("bad","Brah","It's like you weren't even looking at the screen"),e("bad","Bad you did","These are not the scores you are looking for"),e("bad","Someone once told me","Just keep trying. Just keep trying."),e("bad","Yikes","You should try searching for the Konami Code"),e("bad","Like a car in a hotel room...",'You just wonder "How did this happen?"'),e("close","Almost","So close yet so far away!"),e("close","This level is even more difficult than...","That time I tried to be Batman"),e("close","There has got to be","A skip button around here somewhere"),e("close","You will beat it..","Eggs or batter maybe... but this level not likely."),e("good","Done and done!","You must have studied winning in college"),e("good","Another one bites the dust","Keep up the good work!"),e("good","Impressive","Your efforts are rewarded"),e("good","Are you a torch?","Because you are on fire!"),e("good","Crank it up",'Someone must have turned you to "eleven"'),e("good","Ahhh","You complete me"),e("good","You are more dedicated than...","A hobbit with a gold ring!"),e("good","Good job","That'll do, Player. That'll do"),e("good","Tears of joy","You make me so proud sometimes!"),e("great","New high score!","Practice does make perfect"),e("great","Living legend","Nobody will beat that score!"),e("great","Cat like reflexes","You must be a ninja!"),e("great","You are","King of the world!")},getRandomMessage(t){const e=this.messages[t];if(!e)return;const s=e.length,i=g.round(Math.random()*(s-1)),r=e[i];return r.type=t,r},getAll(){return this.options},removeAll(){let t=this.options,e=t.length;if(e)for(let s=0;s-1&&(t.remove(),e.splice(s,1))}};we.setup();const lr=t=>{let e;if(t.scorePoints>t.highScorePoints&&t.scoreNumber>=t.minimum?e="great":t.scoreNumber>=t.minimum?e="good":t.scoreNumber>=t.minimum-4&&t.scoreNumber<=t.minimum-1?e="close":t.scoreNumber==0?e="awful":t.scoreNumber<=g.round(t.minimum*.25)&&(e="bad"),e)return or(e)},or=t=>we.getRandomMessage(t);class Pe{constructor(e,s){this.timer=null,this.duration=e,this.callback=s}setupTimer(){this.timer=window.setTimeout(()=>this.callCallback(),this.duration)}start(){this.stop(),this.setupTimer()}stop(){window.clearTimeout(this.timer)}callCallback(){typeof this.callback=="function"&&this.callback()}}function cr(){const t=this.game.getCurrentLevel();this.data=t.data,this.data.nextLevel=t.passed||!w.isNextLevelLocked(),this.data.previousLevel=t.number>1}function hr(){const t=this.game.getCurrentLevel();t.number{new rr({type:e.type,title:e.title,description:e.text}).start(this.panel)}).start()}function ur(){const t=this.game.getCurrentLevel(),{number:e,passed:s,highScorePoints:i,highScoreNumber:r,particles:a,scoreNumber:n,scorePoints:o,minimum:c,quantity:h}=t;return{number:e,passed:s,highScorePoints:i,highScoreNumber:r,particles:a,scoreNumber:n,scorePoints:o,minimum:c,quantity:h,nextLevel:!1,previousLevel:e>1}}const Se=({game:t})=>new Z({game:t,beforeSetup:cr,afterSetup:hr,setupStates:ur},[l({class:"level-summary-container overlay-panel floatDownZ"},[l({class:"panel-top-button-container"},[Y({class:"bttn circle bttn-home",href:"/"},[l({class:"content"})])]),b({class:"col data-container"},[l({class:"level-summary"},[l({class:"row"},[l({class:"level-number-container pullDown"},[l({class:"level-number title-text"},"[[number]]"),l({class:"level-label title-text"},"Level")]),l({id:"summaryLevelStatus",class:"level-status title-enhance",onSet:["passed",e=>e?"Congrats, You Passed":"Sorry, Try Again"]}),l({class:"destroyed-summary",onSet:["passed",{pass:!0,fail:!1}]},[l({class:"destroyed"},[l({class:"label title-text"},"Particle Total"),l({class:"value"},"[[quantity]]"),l({class:"label title-text"},"Destroyed"),l({class:"value"},"[[scoreNumber]]")])])]),l({class:"row"},[l({class:"score-container"},[l({class:"score-panel"},[l({class:"col"},[l({class:"data underline"},[l({class:"value title-text"},"[[minimum]]"),l({class:"label title-enhance"},"Minimum")])]),l({class:"col"},[l({class:"data circle level-score"},[l({class:"content"},[l({class:"value title-text"},"[[scorePoints]]"),l({class:"label title-enhance"},"Level Score")])])]),l({class:"col"},[l({class:"data high-score underline"},[l({class:"value title-text"},"[[highScorePoints]]"),l({class:"label title-enhance"},"Highest Score")])])])])]),l({class:"row summary-button-container"},[l({class:"summary-buttons"},[l({class:"col"},[b({class:"option-group",id:"previous_level"},[l({class:"bttn circle bttn-prev",onSet:["previousLevel",{hidden:!1}],click:()=>t.previousLevel()},[l({class:"content"})]),l({class:"label title-text"},"Previous")])]),l({class:"col"},[b({class:"option-group",id:"retry_level"},[l({class:"bttn circle bttn-retry",click:()=>t.retryLevel()},[l({class:"content"})]),l({class:"label title-text"},"Retry")])]),l({class:"col"},[b({class:"option-group",id:"next_level"},[l({class:"bttn circle bttn-next",onSet:["nextLevel",{hidden:!1}],click:()=>t.nextLevel()},[l({class:"content"})]),l({class:"label title-text"},"Next")])])])])])])])]);function dr(){this.game.stopStage()}const pr=({game:t})=>new Z({game:t,afterSetup:dr},[l({class:"control-sub-panel pause-container overlay-panel"},[l({class:"pause-panel floatDownZ"},[H({class:"play circle",click:()=>t.resume()},[l({class:"content"})])]),Q({class:"options-container fadeIn"},[b({class:"option-group"},[Y({class:"bttn circle bttn-home",href:"/"},[l({class:"content"})]),l({class:"label title-text"},"Home")]),b({class:"option-group"},[Y({class:"bttn circle bttn-levels",href:"/levels"},[l({class:"content"})]),l({class:"label title-text"},"Levels")]),b({class:"option-group"},[l({class:"bttn circle bttn-retry",click:()=>t.retryLevel()},[l({class:"content"})]),l({class:"label title-text"},"Retry")])])])]);class fr{constructor(e,s){this.options=e,this.callBack=s,this.selection=null}get(e){return this.options[e]||!1}getSelectedIndex(){return typeof this.selectedIndex<"u"?this.selectedIndex:0}next(){let e=this.getSelectedIndex();const s=e0?--e:this.options.length-1;return this.select(s)}select(e){const s=this.get(e);return s!==!1&&(this.selection=s,this.selectedIndex=e,this.callBack&&this.callBack(s)),s}selectOption(e){const s=this.options.indexOf(e);return s>-1&&(e=this.select(s)),e}}class mr extends L{onCreated(){this.iterator=new fr(this.options,this.change.bind(this)),this.iterator.selectOption(this.data[this.dataProp])}render(){return l({class:"value-container"},[H({class:"value-button arrow prev",click:this.previous.bind(this)}),H({class:"value-button",click:this.next.bind(this)},"[["+this.dataProp+"]]"),H({class:"value-button arrow next",click:this.next.bind(this)})])}change(e){this.data.set(this.dataProp,e),this.data.store()}next(){this.iterator.next()}previous(){this.iterator.previous()}}class Xt extends L{render(){const e=this.getId("checkbox");return l({class:"data-toggle-panel"},[Ni({id:e,cache:"checkbox",class:"toggle",change:this.change.bind(this),checked:this.checked}),W({class:"toggle-bttn",htmlFor:e})])}isChecked(e){return this.checkbox.checked}change(){this.checked=this.isChecked(),this.callBack&&this.callBack(this.checked)}toggle(){const e=this.isChecked();this.checkbox.checked=!e}}class gr extends Z{}function vr(t){this.parent.nav&&this.parent.nav.moveToSelectedIndex(t)}function yr(t){this.parent.touch&&this.parent.touch.moveToSelectedIndex(t)}const br=()=>new gr([Q({class:"control-sub-panel settings-container overlay-panel open"},[b({class:"home-sub-panel settings-panel"},[l({class:"panel-top-button-container floatUpZBounce"},[Y({class:"bttn circle close",href:"/"},[l({class:"content"},[E(),E()])])]),new ye({cache:"nav",callBackFn:yr,items:["audio","video","about"]}),l({class:"main-step-container"},[new Ot({cache:"touch",callBackFn:vr,items:[l({class:"content settings-sub-panel audio-container"},[x({class:"title-text"},"Audio"),l({class:"row"},[W({class:"title"},"Music"),l({class:"value-container"},[new Xt({checked:S.music,callBack:t=>{S.music=Boolean(t),S.store()}})])]),l({class:"row"},[W({class:"title"},"Sound fx"),l({class:"value-container"},[new Xt({checked:S.audio,callBack:t=>{S.audio=Boolean(t),S.store()}})])])]),l({class:"content settings-sub-panel audio-container"},[x({class:"title-text"},"Video"),l({class:"row"},[W({class:"title"},"Graphics"),new mr({data:S,dataProp:"graphics",options:["low","medium","high"]})])]),l({class:"content settings-sub-panel about-container"},[x({class:"title-text"},"Credits"),l({class:"row"},[W({class:"title"},"Programming"),l({class:"value-container"},"Chris Durfee")]),l({class:"row"},[W({class:"title"},"Graphic Design"),l({class:"value-container"},"Chelsea Durfee")]),l({class:"row"},[W({class:"title"},"Music & Sound"),l({class:"value-container"},"Chris Durfee")])])]})])])])]);function wr(){window.setTimeout(()=>{this.panel.classList.remove("loading")},300)}const Pr=({game:t})=>new Z({afterSetup:wr},[b({class:"main-home-panel overlay-panel loading"},[l({class:"background background-stars"}),l({class:"panel-top-button-container"},[Y({class:"bttn circle settings",href:"/settings"},[l({class:"content"})])]),Q({class:"home-base-panel"},[l({class:"row logo-container"},[l({class:"background background-mask"}),l({class:"game-name-container"},[T({src:"images/multisplode.svg"})])]),l({class:"row menu-container"},[b({class:"col main-menu-container clear"},[l({class:"game-menu-container"},[l({class:"main-nav-container"},[Mi([fe({class:"clear"},[me([H({class:"bttn main-play title-text",click:()=>t.startGame()},"Play")])])])])])])])])])]);class Sr extends L{beforeSetup(){const e=this.game.getCurrentLevel();this.data=e.data,this.length=0,this.progress=0}render(){return l({class:"progress-bar",onSet:["scoreNumber",e=>this.update(e,this.data.minimum)],html:` - - - - `})}afterSetup(){window.setTimeout(()=>{const s=this.element=document.getElementById("progress-line"),i=this.length=s.getTotalLength();s.style.strokeDasharray=i+" "+i,this.changeStrokeOffset(i),window.setTimeout(()=>{this.reset()},150)},10)}modifyTransition(e){this.element.style.transition="stroke-dashoffset "+e+"ms linear"}update(e,s){let i=e/s*100/100;if(i=i<1?i.toFixed(2):1,i===1&&this.progress!==i||i!==this.progress){const r=this.length,a=r-r*i;this.changeStrokeOffset(a),this.progress=i}}changeStrokeOffset(e){!this.element||(this.element.style.strokeDashoffset=e)}reset(){const e=this.length;this.changeStrokeOffset(e);const s=150;this.modifyTransition(s)}beforeDestroy(){this.modifyTransition(0)}}const kr=(t,e,s)=>{const i=t.type||"Shockwave";return l({class:"touch-icon circle "+i.toLowerCase(),onSet:[s,"selected",{inactive:!0}]})};class xr extends L{beforeSetup(){const e=this.game.getCurrentLevel();this.level=e,this.level.setUpdateTouchCallBack(()=>this.select()),this.data=new rt,this.reset()}render(){return b({class:"option-group level-touches"},[l({id:"levelTouches",cache:"levelTouces",class:"value touch-container title-text",for:["touches",kr]}),l({class:"label title-text"},"Touches")])}setupTouches(){const e=this.level.devices,s=[];for(let i in e){const r=e[i];for(let a=0;a=0){const i=this.data.touches[this.current];i.selected===!1&&(e=i,i.selected=!0,this.current--)}return e}reset(){this.limit=0,this.data.set("touches",this.setupTouches()),this.current=this.limit-1}}function Cr(){const t=this.game.getCurrentLevel();this.data=t.data}function Lr(){const t=this.game.getCurrentLevel();this.panel.classList.add(t.levelClass)}function Ar(){this.game.stopStage()}const Tr=({game:t})=>new Z({game:t,beforeSetup:Cr,afterSetup:Lr,beforeDestroy:Ar},[b({class:"play-container"},[l({class:"play-panel"},[l({class:"fade-layer"},[_i({id:"portal",cache:"portal",class:"main-canvas",onCreated(e){t.setCanvas(e);const s=1;window.setTimeout(()=>{t.setupStage(),t.startStage()},s)}})])]),l({class:"play-level-container"},[l({class:"level-guide fadeIn"},[Q({class:"options-container"},[l({class:"top-container"},[b({class:"option-group"},[Y({class:"bttn circle bttn-pause",href:"/play/paused"},[l({class:"content"},[E(),E()])])]),b({class:"option-group level-number"},[l({id:"levelNumber",class:"value title-text"},"[[number]]"),l({class:"label title-text"},"Level")])]),l({class:"lower-container"},[b({class:"option-group level-progress"},[l({id:"levelProgress",class:"value progress title-text"},[l({id:"levelMinimum",class:"progress-number value title-text"},"[[remaining]]"),new Sr({game:t})]),l({class:"label title-text"},"Progress")]),new xr({cache:"touches",game:t})])])]),l({id:"fps",class:"fps"})])])]),pt=(t,e,s)=>({uri:t,component:e,title:s}),Er=t=>[pt("/play/:state?",Tr(t),"Play"),pt("/level-summary",Se(t),"Level Summary"),pt("/:overlay?",Pr(t),"Home")],Br=f((t,e)=>Fi({class:"main-game-container",...t},e)),Dr=f((t,e)=>({class:"main-container",...t,children:e})),Or=t=>Br([Dr({cache:"mainBody",switch:Er(t)}),l({class:"overlay-container",route:[{uri:"/settings",component:br()},{uri:"/levels",component:ir(t)},{uri:"/play/paused",component:pr(t)},{uri:"/play/level-summary",component:Se(t)}]}),new qi({cache:"soundFx",class:"sound",fileName:"play-loop.mp3"})]),ct={appName:"Multisplode",size:{width:774,height:493},router:{baseUrl:"/multisplode/",title:"Multisplode"}},jr=t=>new q({class:"startup-panel",...t},[l({class:"content"},[T({src:"images/four-more.svg",type:"image/svg+xml"}),x({class:"title-enhance"},[$("Four Is More")]),B("You can now use four explosions at anytime to maximize the destruction.")])]),Ir=t=>new q({class:"startup-panel",...t},[l({class:"content"},[T({src:"images/three-more.svg",type:"image/svg+xml"}),x({class:"title-enhance"},[$("Three Is More Fun")]),B("You can now use three explosions at anytime to maximize the destruction.")])]),zr=t=>new q({class:"startup-panel",...t},[l({class:"content"},[T({src:"images/double-trouble.svg",type:"image/svg+xml"}),x({class:"title-enhance"},[$("Double The Trouble")]),B("You can now use two explosions at anytime to maximize the destruction.")])]),Nr=t=>new q({class:"startup-panel",...t},[l({class:"content"},[T({src:"images/gravity-field.svg",type:"image/svg+xml"}),l({class:"title-enhance"},"Gravity Doesn't Suck"),B("You can now use gravity to your advantage. Gravity fields attract particles and lock them into orbit until the gravity field becomes too weak and the particles are released.")])]),Rr=t=>new q({class:"startup-panel",...t},[l({class:"content"},[T({src:"images/complete-challenge.svg",type:"image/svg+xml"}),x({class:"title-enhance"},[$("Pulse Particles")]),B("The pulse particle is pure white and packs a punch. It causes 1.5X destruction and double the points.")])]);class Mr extends q{render(){const e=s=>{s.target===this.panel&&this.close()};return ge({class:this.class,click:e,children:[new Ot({cache:"touch",items:this.children})]})}}const Fr=t=>new Mr({class:"startup-panel",...t},[l({class:"content"},[T({src:"images/destroy-particles.svg",type:"image/svg+xml"}),x({class:"title-enhance"},[$("Destroy The Particles")]),B("Touch the screen to create an explosion. Particles that hit explosions will also explode creating chains.")]),l({class:"content"},[T({src:"images/complete-challenge.svg",type:"image/svg+xml"}),x({class:"title-enhance"},[$("Complete The Challenge")]),B("Beat the level minimum to continue. As the levels go on the explosions will get smaller increasing the difficulty.")]),l({class:"content"},[T({src:"images/unlock-explosions.svg",type:"image/svg+xml"}),x({class:"title-enhance"},[$("Unlock Multiple Explosions")]),B("As the levels progress they will require more than just one explosion to complete the challenge.")])]),Wr={StartupPrompt:Fr,AddTwoPrompt:zr,AddThreePrompt:Ir,AddFourPrompt:jr,PulseParticlePrompt:Rr,GravityFieldPrompt:Nr},_r=t=>{try{const e=Wr[t.type];return e(t)}catch(e){console.log(e)}return null},wt={prompts:{},game:null,setGame(t){this.game=t},setup(){const t=()=>this.game.stopDraw(),e=()=>this.game.startDraw();this.add({type:"StartupPrompt",activateCallBack:t,deactivateCallBack:e}),this.add({type:"AddTwoPrompt",activateCallBack:t,deactivateCallBack:e}),this.add({type:"AddThreePrompt",activateCallBack:t,deactivateCallBack:e}),this.add({type:"AddFourPrompt",activateCallBack:t,deactivateCallBack:e}),this.add({type:"PulseParticlePrompt",activateCallBack:t,deactivateCallBack:e}),this.add({type:"GravityFieldPrompt",activateCallBack:t,deactivateCallBack:e})},getPrompt(t){return this.prompts[t]||null},showPrompt(t){const e=this.getPrompt(t);e&&e.open()},reset(){this.prompts=[]},getAll(){return this.prompts},add(t){const e=_r(t);return e?(this.prompts[t.type]=e,e):!1},remove(t){const e=this.prompts.indexOf(t);e>-1&&this.prompts.splice(e,1)}};class ke{constructor(e,s,i,r,a,n,o,c,h){p(this,"isAtLimit",!1);p(this,"timerUi",null);p(this,"timerUiDelay",150);this.number=e,this.touch=0,this.touchLimit=0,this.devices={},this.setupDevices(s),this.minimum=i,this.afterTouch=r,this.afterTouchReady="no",this.particles=null,this.setupParticleCount(a),this.waveScale=n,this.waveMaxSize=o,this.remaining=this.minimum,this.passed=!1,this.currentNumber=0,this.scoreNumber=0,this.scorePoints=0,this.highScorePoints=0,this.highScoreNumber=0,this.updateTouchCallBack=null,this.promptId=c,this.levelClass=h,this.bestTime="",this.locked=!0,this.setData()}setData(){this.data=new rt,this.setDataValues(),this.data.setKey("level-"+this.number),this.data.resume(),this.data.passed=!1,this.data.remaining=this.minimum}setDataValues(){this.data.set({number:this.number,locked:this.locked,minimum:this.minimum,remaining:this.minimum,scoreNumber:this.scoreNumber,quantity:this.quantity,scorePoints:this.scorePoints,highScorePoints:this.highScorePoints,highScoreNumber:this.highScoreNumber,bestTime:this.bestTime,devices:this.devices,passed:!1})}setup(){this.updateFromData(),this.reset(),this.number===1&&this.unlock()}setupDevices(e){if(typeof e!="object"){this.devices={ShockWave:e},this.touchLimit=e;return}this.touchLimit=0;for(let s=0,i=e.length;sthis.highScoreNumber&&(this.highScoreNumber=this.scoreNumber,this.data.highScoreNumber=this.scoreNumber),this.scorePoints>this.highScorePoints&&(this.highScorePoints=this.scorePoints,this.data.highScorePoints=this.scorePoints),this.saveToData()}updateScore(e,s){this.updatePoints(s),this.updateNumber(e),this.updateUiByTimer()}updateUiByTimer(){this.timerUi===null&&(this.timerUi=window.setTimeout(()=>{this.updateRemaining(),this.updatePlayUi(),this.updateHighScore(),this.timerUi=null},this.timerUiDelay))}updateRemaining(){let e=this.minimum-this.scoreNumber;e!==this.currentNumber&&(this.currentNumber=e,e=e>0?e:0,this.data.remaining=e,e===0&&(this.passed=!0,this.data.passed=!0))}updatePoints(e){this.scorePoints+=e}updateNumber(e){this.scoreNumber+=e}updatePlayUi(){this.data.set({scoreNumber:this.scoreNumber,scorePoints:this.scorePoints})}updateBestTime(e){this.bestTime=e,this.data.bestTime=e,this.data.store()}updateFromData(){const e=this.data;e&&(this.locked=e.locked,this.highScorePoints=e.highScorePoints,this.highScoreNumber=e.highScoreNumber,this.bestTime=e.bestTime)}saveToData(){const e={locked:this.locked,highScorePoints:this.highScorePoints,highScoreNumber:this.highScoreNumber};this.data.set(e),this.data.store()}unlock(){this.locked=!1,this.data.locked=!1,this.saveToData()}}class Ur{constructor(e){p(this,"controller",null);p(this,"levels",[[1,28,40,40,1,65,"startup-panel","first"]]);this.label="",this.game=e}setupLevels(){let e="";const s=[],i=this.levels;for(let r=0,a=i.length;r({x:g.round(t),y:g.round(e)});class xe{constructor(e,s,i,r){this.position=Hr(e,s),this.size=0,this.fillColor=i,this.audio="sound/collisions/collision-1a.mp3",this.multiplier=r||1,this.type="device",this.explosive=!1,this.cachePath()}checkToRemove(){return!1}cachePath(){const e=this.maxSize,s=this.lineSize=e/10,i=this.totalSize=e*2+s*2;this.half=this.totalSize/2;const r=a=>{const n=i/2;a.beginPath(),a.arc(n,n,e,0,N,!0),a.globalAlpha=.3,a.fillStyle=this.fillColor,a.fill(),a.globalAlpha=.5,a.beginPath(),a.arc(n,n,e*.3,0,N,!0),a.fillStyle=this.fillColor,a.fill(),a.globalAlpha=.7,a.beginPath(),a.arc(n,n,e*.6,0,N,!0),a.fillStyle=this.fillColor,a.fill(),a.globalAlpha=1};this.cache=G.add(r,i,i)}draw(e){const s=this.position.x,i=this.position.y,r=this.size/this.maxSize;e.save(),e.translate(s,i),e.scale(r,r),e.drawImage(this.cache,-this.half,-this.half),e.restore()}}class $r extends xe{constructor(e,s,i,r){super(e,s,i,r),this.audio="sound/collisions/collision-1a.mp3",this.gravity=1*this.multiplier,this.startTime=null,this.time=8e3,this.delta=0,this.maxSize=0,this.totalSize=0,this.lineSize=0,this.type="gravityField",this.getMaxSize(),this.cachePath()}checkToRemove(){const e=this.getStartTime();return this.delta=new Date-e,this.delta>=this.time}getStartTime(){return this.startTime=this.startTime||new Date,this.startTime}updateParticlePosition(e){let s=this.position,i=e.position,a=g.distance(i,s)-this.gravity-this.gravity;a=a>this.orbitLimit?a:this.orbitLimit;const n=g.updateOrbitAngle(this.getOrbitAngle(e),e.speed/this.size);s=g.getOrbitPosition(s.x,s.y,n,a),i.x=s.x,i.y=s.y}getOrbitAngle(e){const s=this.position,i=e.position,r=i.x-s.x,a=i.y-s.y;return Math.atan2(a,r)}orbitParticle(e){this.updateParticlePosition(e)}getMaxSize(){const e=w.currentLevel;e&&(this.maxSize=e.waveMaxSize*this.multiplier,this.size=this.maxSize,this.orbitLimit=this.maxSize-this.maxSize/3)}cachePath(){const e=this.maxSize,s=this.lineSize=2,i=this.totalSize=e*2+s*2;this.half=this.totalSize/2;const r=a=>{const n=i/2;a.beginPath(),a.arc(n,n,e,0,N,!0),a.globalAlpha=.3,a.fillStyle=this.fillColor,a.fill(),a.lineWidth=2,a.strokeStyle="#FFF",a.stroke(),a.globalAlpha=.7,a.beginPath(),a.arc(n,n,e*.2,0,N,!0),a.fillStyle=this.fillColor,a.fill(),a.globalAlpha=1};this.cache=G.add(r,i,i)}draw(e){const s=1-this.delta/this.time;e.save(),e.translate(this.position.x,this.position.y),e.globalAlpha=s,e.drawImage(this.cache,-this.half,-this.half),e.restore()}}class Xr extends xe{constructor(s,i,r,a){super(s,i,r,a);p(this,"waveScale",0);p(this,"maxSize",0);p(this,"totalSize",0);p(this,"lineSize",0);this.size=0,this.audio="sound/collisions/collision-1a.mp3",this.type="shockWave",this.explosive=!0,this.getWaveScale(),this.cachePath()}updateSize(){this.size+=this.waveScale}checkToRemove(){return this.size>=this.maxSize}getWaveScale(){let s=w.currentLevel;s&&(this.waveScale=s.waveScale,this.maxSize=s.waveMaxSize*this.multiplier)}cachePath(){let s=this.maxSize,i=this.lineSize=s/10,r=this.totalSize=s*2+i*2;this.half=this.totalSize/2;const a=n=>{let o=r/2;n.beginPath(),n.arc(o,o,s,0,N,!0),n.globalAlpha=.3,n.fillStyle=this.fillColor,n.fill(),n.globalAlpha=.5,n.beginPath(),n.arc(o,o,s*.3,0,N,!0),n.fillStyle=this.fillColor,n.fill(),n.globalAlpha=.7,n.beginPath(),n.arc(o,o,s*.6,0,N,!0),n.fillStyle=this.fillColor,n.fill(),n.globalAlpha=1};this.cache=G.add(a,r,r)}draw(s){this.updateSize();const i=this.size/this.maxSize;s.save(),s.translate(this.position.x,this.position.y),s.scale(i,i),s.drawImage(this.cache,-this.half,-this.half),s.restore()}}const Yt={ShockWave:Xr,GravityField:$r},K={devices:[],removed:[],reset(){this.explosives=0,this.devices=[],this.removed=[]},explosives:0,getExplosivesCount(){return this.explosives},getAll(){return this.devices},add(t,e,s,i,r="ShockWave"){const a=Yt[r]||Yt.ShockWave,n=new a(t,e,s,i);return n.explosive===!0&&this.explosives++,this.devices.push(n),n},remove(t){const e=this.devices,s=e.indexOf(t);s>-1&&(e.splice(s,1),this.removed.push(t))},draw(t){t.globalCompositeOperation="lighter";const e=this.devices;for(let s=e.length-1;s>=0;s--){let i=e[s];i.checkToRemove()===!0?(i.explosive===!0&&this.explosives--,this.remove(i)):i.draw(t)}t.globalCompositeOperation=0}},Yr=t=>{let e=g.floor(Math.random()*7),s="";switch(e){case 0:s="#F9322D";break;case 1:s="#FF397F";break;case 2:s="#D541B7";break;case 3:s="#FF8931";break;case 4:s="#F9F95D";break;case 5:s="#21F8B6";break;case 6:s="#26CFCE";break;case 7:s="#3153CB";break}return s};let qr=0;const F=g.randomFromTo,Gr=1e3/60;class Ce{constructor(e){this.type="particle",this.value=10,this.multiplier=1,this.setup(e)}init(){this.number=++qr,this.id=this.number}getDefaultSettings(){const e=ct.size,s=.005,i=.008,r=e.width*.12/Gr,a=F(e.width*s,e.width*i),n=a*2;return{size:a,position:{x:F(a+3,e.width-n-3),y:F(a+3,e.height-n-3)},fillColor:Yr(),stroke:F(3,5),direction:F(-10,10),angle:F(0,360),speed:F(r/1.8,r)}}setup(e,s){s=s!==!1;let i=this.getDefaultSettings();e&&typeof e=="object"&&(i=Object.assign(i,e)),this.size=i.size,this.fullSize=this.size*2,this.position=i.position,this.fillColor=i.fillColor,this.stroke=i.stroke,this.direction=i.direction,this.speed=i.speed,this.angle=i.angle,s&&this.cachePath()}move(){this.updateByAngle()}updateByAngle(){this.updatePosition()}updateAngle(){const e=g.updateOrbitAngle(this.angle,this.speed);this.angle=e}checkWall(e){const s=this.position;(s.x+this.size>=e.width||s.x<=this.size)&&(this.angle=180-this.angle),(s.y+this.size>=e.height||s.y<=this.size)&&(this.angle=360-this.angle)}updatePosition(){const e=ct.size,s=g.getPositionByAngle(this.angle,this.speed),i=g.round,r=this.position;r.x=i(r.x+s.x),r.y=i(r.y+s.y),this.checkWall(e)}cachePath(){const e=Math.ceil(this.size*2),s=i=>{i.beginPath(),i.arc(e/2,e/2,this.size,0,it,!0),i.fillStyle=this.fillColor,i.fill()};this.cache=G.add(s,e,e)}hasCollided(e){const s=this.position;let i=s.x-e.position.x,r=s.y-e.position.y,a=e.size+this.size;return i*i+r*r<=a*a}draw(e){e.drawImage(this.cache,this.position.x-this.size,this.position.y-this.size)}}class Vr extends Ce{constructor(e){super(e),this.type="pulse",this.value=20,this.multiplier=1.5,e||(e={}),e.size=8;const s="#FFF";e.fillColor=s,this.setup(e)}cachePath(){const e=this.size,s=e*2,i=r=>{const a=s/2;r.beginPath(),r.arc(a,a,e,0,it,!0),r.fillStyle="rgba(255,255,255,.4)",r.fill(),r.beginPath(),r.arc(a,a,e/2,0,it,!0),r.fillStyle=this.fillColor,r.fill()};this.cache=G.add(i,s,s)}}const Kr={Particle:Ce,PulseParticle:Vr},I={particles:[],removed:[],reset(){this.particles=[],this.removed=[]},getAll(){return this.particles},add(t,e){t=t||"Particle";const s=Kr[t],i=new s(e);return this.particles.push(i),i},remove(t){const e=this.particles.indexOf(t);e<0||(this.particles.splice(e,1),this.removed.push(t))}},ft={},Jr=(t,e)=>({x:t,y:e});let Qr=0;class Zr{constructor(e,s,i){this.number=++Qr,this.id=this.number,this.position=Jr(e,s),this.size=20,this.fillColor="#FFFFFF",this.opacity=1,this.text="+"+i,this.value=i,this.distance=0,this.maxDistance=3,this.speed=.06,this.cachePath()}move(){this.distance+=this.speed,this.position.y-=this.distance}changeAlpha(){this.opacity-=.05}cachePath(){if(ft[this.value]){this.cache=ft[this.value];return}const e=40,s=60,i=r=>{r.font=this.size+"px titillium",r.fillStyle=this.fillColor,r.fillText(this.text,s/2,e/2)};this.cache=ft[this.value]=G.add(i,s,e)}draw(e){const s=g.round(this.position.x),i=g.round(this.position.y),r=1-this.distance/this.maxDistance;e.save(),e.globalAlpha=r,e.drawImage(this.cache,s,i),e.restore()}}const Pt={gamePoints:[],removed:[],reset(){this.gamePoints=[],this.removed=[]},getAll(){return this.gamePoints},add(t,e,s){const i=new Zr(t,e,s);return this.gamePoints.push(i),i},remove(t){const e=this.gamePoints,s=e.indexOf(t);s>-1&&(e.splice(s,1),this.removed[this.removed.length]=t)},draw(t){t.beginPath();const e=this.gamePoints;for(let s=e.length-1;s>=0;s--){let i=e[s];g.round(i.distance)>=i.maxDistance?this.remove(i):(i.move(),i.draw(t))}t.closePath()}},ta=.001;class ea{constructor(e,s,i,r,a,n){this.position={x:e,y:s},this.angle=i,this.size=g.randomFromTo(4,10),this.maxSize=this.size,this.fillColor=r,this.stroke=r,this.type="",this.speed=g.randomFromTo(1,5),this.cachePath()}updatePosition(){const e=g.getPositionByAngle(this.angle,this.speed),s=this.position;s.x+=e.x,s.y+=e.y,this.updateSize()}updateSize(){this.size-=.5}cachePath(){const e=this.totalSize=this.size*2;this.half=this.totalSize/2;const s=i=>{const r=e/2;i.globalAlpha=.7,i.beginPath(),i.arc(r,r,e,0,it,!0),i.fillStyle=this.fillColor,i.fill(),i.globalAlpha=1};this.cache=G.add(s,e,e)}draw(e){if(this.updatePosition(),this.size{let t=20;switch(S.graphics){case"low":t=12;break;case"high":t=30;break}return t};class ia{constructor(e,s,i){p(this,"radiusRate",null);this.particleNumber=sa(),this.x=e,this.y=s,this.color=i,this.radius=0,this.maxRadius=30,this.speed=20,this.particles=[],this.removed=[],this.setupParticles()}setupParticles(){const e=this.particleNumber,s=360/e;for(let i=0;i<=e;i++){let r=s*i;this.addParticle(r)}this.radiusRate=this.maxRadius/this.speed}addParticle(e){const s=new ea(this.x,this.y,e,this.color,this.maxRadius,this.speed);this.particles.push(s)}checkToRemove(){return this.radius>=this.maxRadius}updateRadius(){let e=this.radius;e+=this.radiusRate,e=g.round(e)}draw(e){this.updateRadius();const s=this.particles;for(let i=s.length-1;i>=0;i--){let r=s[i];if(r.draw(e)===!1){s.splice(i,1);let a=this.removed;a[a.length]=r}}}}const St={sparks:[],removed:[],maxRadius:5,speed:10,reset(){this.sparks=[],this.removed=[]},add(t,e,s){const i=new ia(t,e,s);this.sparks.push(i)},remove(t){const e=this.sparks,s=e.indexOf(t);if(s>-1){e.splice(s,1);let i=this.removed;i[i.length]=t}},updateRadius(t){t.checkToRemove()==!1?t.radius+=t.radiusRate:this.remove(t)},draw(t){const e=this.sparks;for(let s=e.length-1;s>=0;s--){let i=e[s];i&&(i.draw(t),this.updateRadius(i))}}},ra={activeSounds:[],reset(){this.activeSounds=[]},getAll(){return this.activeSounds},add(t,e){if(S.audio===!0&&this.check(e)===!1){const s=new Audio(t),i={audio:s,type:e};return s.volume=.4,s.play(),this.activeSounds.push(i),i}return!1},check(t){return!1},remove(t){const e=this.activeSounds,s=e.indexOf(t);s>-1&&e.splice(s,1)}},aa={addAnimation(t,e,s=0){if(!t)return;const i=t.classList;i.add(e),window.setTimeout(()=>i.remove(e),s)}};class na{constructor(){p(this,"level",null);p(this,"blowEmDelay",200);p(this,"blowEm",!1);p(this,"blowEmExtend",380);p(this,"playContainer",null);p(this,"originalDelay",1e3);p(this,"delay",1e3);p(this,"startDelay",null)}setLevel(e){this.reset(),this.setupParticles();const s=this.level;if(ve.set("lastLevel",s),e!==!0){const i=s.promptId;i&&this.showPrompt(i)}}showPrompt(e){new Pe(50,()=>wt.showPrompt(e)).start()}changeLevel(e){this.level=e}interact(e,s){const i=this.level;if(i&&i.touch=e.minimum&&(this.destroyAllParticles(),this.delay+=this.blowEmExtend,this.playContainer===null&&(this.playContainer=document.querySelector(".play-container")),aa.addAnimation(this.playContainer,"shakePanel",600)),this.blowEm=!0}setupCompleteDelay(){return this.startDelay=this.startDelay||new Date,this.startDelay}checkLevelComplete(e){if(this.level.isAtLimit===!0&&K.getExplosivesCount()<1||e<1){const s=this.setupCompleteDelay(),i=new Date-s;if(this.blowEm===!1&&i>=this.blowEmDelay)this.checkToBlowEm();else if(i>=this.delay)return I.reset(),!0}return!1}isComplete(e){return this.checkLevelComplete(e)}destroyAllParticles(){const e=I.getAll(),s=e.length;if(e)for(let i=s-1;i>=0;i--){const r=e[i];I.remove(r),this.createDevice(r.position.x,r.position.y,r.fillColor)}}}class la extends na{draw(e,s){K.draw(e),St.draw(e);const i=I.getAll();let r=i.length;if(r>0){let a=r-1;const n=K.getAll(),o=n.length,c=o-1;do{const h=i[a];let d=!1,m=c;if(o>0)do{const D=n[m];if(h.hasCollided(D)===!0){let O;switch(d=!0,D.type){case"gravityField":D.orbitParticle(h);break;default:r--,I.remove(h),O=h.position,this.createDevice(O.x,O.y,h.fillColor,h.multiplier),this.createPoints(O.x-55,O.y-35,h.value)}break}}while(m--);d===!1&&h.move(),h.draw(e)}while(a--)}return S.graphics==="high"&&Pt.draw(e),this.isComplete(r)}}class oa extends Ur{constructor(){super(...arguments);p(this,"controller",new la);p(this,"levels",[[1,28,40,40,1,65,"StartupPrompt","first"],[1,40,50,50,1,62,!1],[1,45,50,50,1,67,!1],[1,53,57,57,1,60,!1],[1,45,50,{Particle:49,PulseParticle:1},1,61,"PulseParticlePrompt"],[1,32,40,{Particle:39,PulseParticle:1},1,60,!1],[[1,1],29,35,{Particle:34,PulseParticle:1},1,62,"GravityFieldPrompt"],[[1,1],32,39,{Particle:38,PulseParticle:1},1,61,!1],[[1,1],28,35,{Particle:34,PulseParticle:1},1,60,!1],[[1,1],55,60,{Particle:59,PulseParticle:1},1,56,!1],[[2,1],72,80,{Particle:79,PulseParticle:1},1,56,"AddTwoPrompt","second"],[[2,1],63,70,{Particle:69,PulseParticle:1},1,56,!1],[[2,1],64,70,{Particle:69,PulseParticle:1},1,54,!1],[[1,2],67,72,{Particle:71,PulseParticle:1},1,53,!1],[[2,1],52,60,{Particle:59,PulseParticle:1},1,52,!1],[[2,1],60,65,{Particle:63,PulseParticle:2},1,52,!1],[[1,2],48,56,{Particle:54,PulseParticle:3},1,50,!1],[[2,1],46,52,{Particle:50,PulseParticle:2},1,50,!1],[[1,2],50,55,{Particle:52,PulseParticle:3},1,50,!1],[[2,1],30,48,{Particle:45,PulseParticle:3},1,48,!1],[[3,1],40,50,{Particle:48,PulseParticle:2},1,50,"AddThreePrompt","third"],[[2,2],40,55,{Particle:53,PulseParticle:2},1,49,!1],[[3,1],58,63,{Particle:61,PulseParticle:2},1,49,!1],[[1,3],62,68,{Particle:66,PulseParticle:2},1,49,!1],[[2,2],65,70,{Particle:68,PulseParticle:2},1,47,!1],[[3,1],25,38,{Particle:36,PulseParticle:2},1,47,!1],[[3,1],40,48,{Particle:46,PulseParticle:2},1,47,!1],[[2,2],32,45,{Particle:43,PulseParticle:2},1,45,!1],[[3,1],50,55,{Particle:53,PulseParticle:2},1,45,!1],[[4,1],52,60,{Particle:58,PulseParticle:2},1,45,"AddFourPrompt"],[[3,2],52,65,{Particle:63,PulseParticle:2},1,42,!1],[[3,2],60,68,{Particle:66,PulseParticle:2},1,42,!1],[[4,1],70,79,{Particle:77,PulseParticle:2},1,42,!1],[[4,1],56,64,{Particle:62,PulseParticle:2},1,44,!1],[[2,3],48,55,{Particle:53,PulseParticle:2},1,44,!1],[[4,1],46,54,{Particle:52,PulseParticle:2},1,44,!1],[[3,2],62,68,{Particle:66,PulseParticle:2},1,42,!1],[[3,2],46,50,{Particle:48,PulseParticle:2},1,42,!1],[[3,2],50,55,{Particle:53,PulseParticle:2},1,42,!1],[[4,1],44,48,{Particle:46,PulseParticle:2},1,40,!1]])}createLevel(s,i,r){const a=new ke(s,i[0],i[1],i[2],i[3],i[4],i[5],i[6],r);return a.setup(),a}}class ca{constructor(){this.canvas=null,this.ctx=null}setup(){this.createBufferCanvas()}createBufferCanvas(){this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),this.resize()}resize(e){const s=this.canvas;s.width=e.width,s.height=e.height}}const ha=1e3,Le=60;window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,ha/Le)};const ua=window.requestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame||function(t){window.clearTimeout(t)};const qt=(t,e)=>({width:t,height:e}),da=(t,e,s)=>({x:t,y:e,status:s});class pa{constructor(e,s,i){p(this,"canvasBoundBox",null);p(this,"scaleRatio",1);this.game=i,this.targetSize=qt(e,s),this.size=qt(0,0),this.fps=Le,this.canvas=null,this.context=null,this.levelController=null,this.mouse=da(0,0,"up"),this.animationId=!1,this.buffer=null}setup(){this.drawBind=this.draw.bind(this),this.setupEvents()}setCanvas(e){this.canvas=e,this.context=e.getContext("2d")}setupEvents(){this.setupMouse(),this.resize(),window.addEventListener("resize",this.resize.bind(this),!1);const e=this.mouseDown.bind(this),s=this.canvas;this.addEvent=()=>{s.addEventListener("mousedown",e,!1),s.addEventListener("touchstart",e,!1)},this.removeEvent=()=>{s.removeEventListener("mousedown",e,!1),s.removeEventListener("touchstart",e,!1)}}setupMouse(){const e=document,s=this.canvas,i=this.mousePosition.bind(this),r=this.mouseUp.bind(this);s.addEventListener("mousemove",i),e.addEventListener("mouseup",r),s.addEventListener("touchmove",i),e.addEventListener("touchend",r)}interact(e,s){this.levelController.interact(e,s)}getInteractPositions(e){const s=this.scaleRatio,i=this.canvasBoundBox,r=(o,c)=>({x:parseInt((o-i.left)*s),y:parseInt((c-i.top)*s)}),a=[],n=e.touches;if(n&&n.length){const o=n[n.length-1];a.push(r(o.pageX,o.pageY))}else{let o,c;o=e.x||e.clientX,c=e.y||e.clientY,a.push(r(o,c))}return a}getEventPosition(e){let s,i;const r=e.touches;if(r&&r.length){const d=r[0];s=d.pageX,i=d.pageY}else s=e.x||e.clientX,i=e.y||e.clientY;const a=this.scaleRatio,n=this.canvasBoundBox,o=parseInt((s-n.left)*a),c=parseInt((i-n.top)*a);let h=this.mouse;h.x=o,h.y=c}mousePosition(e){this.getEventPosition(e)}mouseDown(e){e.preventDefault(),e.stopPropagation();const s=this.getInteractPositions(e);for(let i=0,r=s.length;ic?h:c,e.height=d}return e}resize(){const e=this.getContainerSize();if(e.width>0){const s=this.canvas,i=this.targetSize;s.width=i.width,s.height=i.height,this.size={width:s.width,height:s.height},this.scale(e,s),this.canvasBoundBox=s.getBoundingClientRect()}}scale(e,s){const i=s.height,r=s.width,a=e.width,n=e.height,o=a/r,c=n/i,h=Math.min(o,c);s.style.width=r*h+"px",s.style.height=i*h+"px",this.scaleRatio=this.size.width/parseInt(s.style.width)}draw(){const e=this.context,s=this.size;e.clearRect(0,0,s.width,s.height),this.levelController.draw(e,this)===!0?(this.stopDraw(),this.game.levelSummary()):this.animationId=ua(this.drawBind)}renderFromBuffer(e,s,i){const r=this.context;r.clearRect(0,0,e,s),r.drawImage(i.canvas,0,0)}startDraw(){typeof this.animationId<"u"&&(this.stopDraw(),this.draw())}stopDraw(){window.cancelAnimationFrame(this.animationId),this.animationId=null}setupBuffer(){this.buffer=new ca,this.buffer.setup()}}const fa=()=>{!screen||!screen.orientation||typeof screen.orientation.lock!="function"||screen.orientation.lock("landscape").then(()=>{console.log("Orientation locked successfully.")}).catch(t=>{console.error(`Failed to lock orientation: ${t.message}`)})};class ma{constructor(e,s,i){this.stage=new pa(e,s,this),this.app=i,w.setGame(this),wt.setGame(this),wt.setup()}getCurrentLevel(){return w.currentLevel}setCanvas(e){this.stage.setCanvas(e)}setup(){this.setupLevels()}setupStage(){this.stage.setup()}setupLevelPacks(){[new oa(this)].forEach(s=>{w.addLevelPack(s)})}setStageLevelController(e){this.stage.levelController=e}setupLevels(){this.setupLevelPacks(),w.setup()}startGame(){fa(),w.selectPrimaryLevel(),this.app.navigate("/play")}play(){this.app.navigate("/"),this.app.navigate("/play"),S.song="play-loop.mp3",this.startStage()}resume(){this.app.navigate("/play"),this.startStage()}pause(){this.stopStage()}retryLevel(){w.retryLevel(),this.play()}selectLevel(e){w.selectLevel(e),this.play()}nextLevel(){w.selectNextLevel(),this.play()}previousLevel(){w.selectPreviousLevel(),this.play()}resetCurrentLevel(){this.retryLevel()}levelSummary(){this.stopStage(),S.song="summary-slow-loop.mp3",this.app.navigate("/play/level-summary")}startDraw(){this.stage.startDraw()}stopDraw(){this.stage.stopDraw()}startStage(){const e=this.stage;e.addEvent(),e.startDraw()}stopStage(){const e=this.stage;e.removeEvent(),e.stopDraw()}}class ga{constructor(){p(this,"router",null);p(this,"appShell",null);this.setupOrientationPrompt(),this.setupRouter(),this.setupAppShell(),this.setupService()}setupService(){const e=window.location.protocol.replace(":","");if(!("serviceWorker"in navigator)||e==="http")return!1;navigator.serviceWorker.register("/sw.js",{scope:"/"}).then(i=>{})}setupRouter(){const{baseUrl:e,title:s}=ct.router,i=this.router=R.router;i.setup(e,s),i.navigate("/")}navigate(e,s,i){this.router.navigate(e,s,i)}setupGame(){const e=ct.size,s=new ma(e.width,e.height,this);return s.setup(),s}setupAppShell(){const e=Or({game:this.setupGame()});A.render(e,document.body)}setupOrientationPrompt(){const e=$i();window.matchMedia("(orientation: portrait)").matches&&e.open(),window.matchMedia("(orientation: portrait)").addEventListener("change",s=>{if(s.matches){e.open();return}e.close()})}}new ga; diff --git a/assets/index.fc6e3d06.js b/assets/index.fc6e3d06.js new file mode 100644 index 0000000..4ed9098 --- /dev/null +++ b/assets/index.fc6e3d06.js @@ -0,0 +1,7 @@ +var Ce=Object.defineProperty;var Le=(t,e,s)=>e in t?Ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var p=(t,e,s)=>(Le(t,typeof e!="symbol"?e+"":e,s),s);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const n of a.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&i(n)}).observe(document,{childList:!0,subtree:!0});function s(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=s(r);fetch(r.href,a)}})();const Ae="modulepreload",Te=function(t){return"/multisplode/"+t},Ot={},Ee=function(e,s,i){if(!s||s.length===0)return e();const r=document.getElementsByTagName("link");return Promise.all(s.map(a=>{if(a=Te(a),a in Ot)return;Ot[a]=!0;const n=a.endsWith(".css"),o=n?'[rel="stylesheet"]':"";if(!!i)for(let d=r.length-1;d>=0;d--){const m=r[d];if(m.href===a&&(!n||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${o}`))return;const h=document.createElement("link");if(h.rel=n?"stylesheet":Ae,n||(h.as="script",h.crossOrigin=""),h.href=a,document.head.appendChild(h),n)return new Promise((d,m)=>{h.addEventListener("load",d),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${a}`)))})})).then(()=>e())};var Be=Object.defineProperty,De=(t,e,s)=>e in t?Be(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,lt=(t,e,s)=>(De(t,typeof e!="symbol"?e+"":e,s),s),ft=class{static toArray(t){return Array.prototype.slice.call(t)}static inArray(t,e,s){return!t||typeof t!="object"?-1:t.indexOf(e,s)}},u=class{static getType(t){let e=typeof t;return e!=="object"?e:this.isArray(t)?"array":e}static isUndefined(t){return typeof t>"u"}static isObject(t){return t&&typeof t=="object"&&this.isArray(t)===!1}static isFunction(t){return typeof t=="function"}static isString(t){return typeof t=="string"}static isArray(t){return Array.isArray(t)}},k={create(t){return Object.create(t)},extendObject(t,e){if(typeof t>"u"||typeof e>"u")return!1;for(var s in t)this.hasOwnProp(t,s)&&typeof e[s]>"u"&&(e[s]=t[s]);return e},clone(t){return t?JSON.parse(JSON.stringify(t)):{}},getClassObject(t){return typeof t=="function"?t.prototype:t},extendClass(t,e){let s=this.getClassObject(t),i=this.getClassObject(e);if(typeof s!="object"||typeof i!="object")return!1;let r=Object.create(s);for(var a in i)r[a]=i[a];return r},hasOwnProp(t,e){return Object.prototype.hasOwnProperty.call(t,e)},isPlainObject(t){return t&&Object.prototype.toString.call(t)==="[object Object]"},isEmpty(t){if(u.isObject(t)===!1)return!0;for(var e in t)if(this.hasOwnProp(t,e))return!1;return!0}},mt={types:{},add(t,e){this.types[t]=e},get(t){return this.types[t]||!1},remove(t){delete this.types[t]}},Oe=class{constructor(){this.types=new Map}add(t,e){this.types.has(t)||this.types.set(t,[]),this.types.get(t).push(e)}get(t){return this.types.get(t)||!1}removeByCallBack(t,e){typeof t=="function"&&t(e)}removeType(t){if(!this.types.has(t))return;let e=this.types.get(t);if(!e.length)return;let s,i=mt.get(t);if(i){for(var r=0,a=e.length;r{!s||this.removeType(s)}),this.types.clear()}},P=class{static addType(t,e){mt.add(t,e)}static removeType(t){mt.remove(t)}static getTrackingId(t){return t?t.trackingId||(t.trackingId=`dt${this.trackingCount++}`):""}static add(t,e,s){let i=this.getTrackingId(t);this.find(i).add(e,s)}static get(t,e){let s=t.trackingId,i=this.trackers.get(s);return i?e?i.get(e):i:!1}static find(t){return this.trackers.has(t)||this.trackers.set(t,new Oe),this.trackers.get(t)}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let s=t.trackingId;if(!s||!this.trackers.has(s))return;let i=this.trackers.get(s);if(!e){i.remove(),this.trackers.delete(s);return}i.remove(e),this.isEmpty(i.types)&&this.trackers.delete(s)}};lt(P,"trackers",new Map),lt(P,"trackingCount",0);var gt=t=>{let e=0;for(let[s,i]of Object.entries(t))e++,typeof t[s]=="object"&&(e+=gt(t[s]));return e},Yt=(t,e)=>{let s=!1;if(typeof t!="object"||typeof e!="object")return s;for(let[i,r]of Object.entries(t)){if(!k.hasOwnProp(e,i))break;let a=e[i];if(typeof r!=typeof a)break;if(typeof r=="object"){if(s=Yt(r,a),s!==!0)break}else if(r===a)s=!0;else break}return s},je=(t,e)=>{let s=gt(t),i=gt(e);return s!==i?!1:Yt(t,e)},Ie=(t,e)=>{let s=typeof t;return s!==typeof e?!1:s==="object"?je(t,e):t===e},v={getEvents(t){return u.isObject(t)===!1?[]:P.get(t,"events")},create(t,e,s,i=!1,r=!1,a=null){return r=r===!0,{event:t,obj:e,fn:s,capture:i,swapped:r,originalFn:a}},on(t,e,s,i){return Array.isArray(t)?t.forEach(r=>this.add(r,e,s,i)):this.add(t,e,s,i),this},off(t,e,s,i){return Array.isArray(t)?t.forEach(r=>this.remove(r,e,s,i)):this.remove(t,e,s,i),this},add(t,e,s,i=!1,r=!1,a=null){if(u.isObject(e)===!1)return this;let n=this.create(t,e,s,i,r,a);return P.add(e,"events",n),e.addEventListener(t,s,i),this},remove(t,e,s,i=!1){let r=this.getEvent(t,e,s,i);return r===!1?this:(typeof r=="object"&&this.removeEvent(r),this)},removeEvent(t){return typeof t=="object"&&t.obj.removeEventListener(t.event,t.fn,t.capture),this},getEvent(t,e,s,i){if(typeof e!="object")return!1;let r=this.getEvents(e);if(!r||r.length<1)return!1;let a=this.create(t,e,s,i);return this.search(a,r)},search(t,e){let s,i=this.isSwappable(t.event);for(var r=0,a=e.length;r{v.removeEvent(t)});var ze={events:v,addListener(t,e,s,i){return this.events.add(t,e,s,i),this},on(t,e,s,i){let r=this.events;return Array.isArray(t)?t.forEach(a=>{r.add(a,e,s,i)}):r.add(t,e,s,i),this},off(t,e,s,i){let r=this.events;return Array.isArray(t)?t.forEach(a=>{r.remove(a,e,s,i)}):r.remove(t,e,s,i),this},removeListener(t,e,s,i){return this.events.remove(t,e,s,i),this},_createEvent(t,e,s,i){let r;switch(e){case"HTMLEvents":r=new Event(t);break;case"MouseEvents":r=new MouseEvent(t,s);break;default:r=new CustomEvent(t,i);break}return r},createEvent(t,e,s,i){if(u.isObject(e)===!1)return!1;let r={pointerX:0,pointerY:0,button:0,view:window,detail:1,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,bubbles:!0,cancelable:!0,relatedTarget:null};u.isObject(s)&&(r=Object.assign(r,s));let a=this._getEventType(t);return this._createEvent(t,a,r,i)},_getEventType(t){let e={HTMLEvents:/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,MouseEvents:/^(?:click|dblclick|mouse(?:down|up|over|move|out))$/},s="CustomEvent";for(let[i,r]of Object.entries(e))if(t.match(r)){s=i;break}return s},trigger(t,e,s){if(u.isObject(e)===!1)return this;let i=typeof t=="string"?this.createEvent(t,e,null,s):t;return e.dispatchEvent(i),this},mouseWheelEventType:null,getWheelEventType(){let t=()=>{let e="wheel";return"onmousewheel"in self?e="mousewheel":"DOMMouseScroll"in self&&(e="DOMMouseScroll"),e};return this.mouseWheelEventType||(this.mouseWheelEventType=t())},onMouseWheel(t,e,s,i=!1){typeof e>"u"&&(e=window);let r=n=>{let o=Math.max(-1,Math.min(1,-n.deltaY||n.wheelDelta||-n.detail));typeof t=="function"&&t(o,n),s===!0&&n.preventDefault()},a=this.getWheelEventType();return this.events.add(a,e,r,i,!0,t),this},offMouseWheel(t,e,s=!1){typeof e>"u"&&(e=window);let i=this.getWheelEventType();return this.off(i,e,t,s),this},preventDefault(t){return typeof t.preventDefault=="function"?t.preventDefault():t.returnValue=!1,this},stopPropagation(t){return typeof t.stopPropagation=="function"?t.stopPropagation():t.cancelBubble=!0,this}},vt=class{constructor(){this.version="3.0.89",this.errors=[],this.dataTracker=P}augment(t){return u.isObject(t)?(Object.entries(t).forEach(([e,s])=>{this.constructor.prototype[e]=s}),this):this}override(t,e,s,i){return(t[e]=s).apply(t,ft.toArray(i))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,s){if(u.isObject(t)===!1)return"";let i=t[e];return typeof i<"u"?i:typeof s<"u"?s:""}createCallBack(t,e,s=[],i=!1){return typeof e!="function"?!1:(...r)=>(i===!0&&(s=s.concat(r)),e.apply(t,s))}bind(t,e){return e.bind(t)}};vt.prototype.extend=function(){return vt.prototype}();var R=new vt;R.augment({...k,...ze,...u,equals:Ie});var ct=t=>{if(typeof t!="string")return"";let e=1e3;return t.substring(0,e)},z=class{static parseQueryString(t,e){typeof t!="string"&&(t=window.location.search),t=ct(t);let s={},i=/([^?=&]+)(=([^&]*))?/g;return t.replace(i,function(r,a,n,o){s[a]=e!==!1?decodeURIComponent(o):o}),s}static camelCase(t){t=ct(t);let e=/(-|\s|_)+\w{1}/g;return t.replace(e,s=>s[1].toUpperCase())}static uncamelCase(t,e="-"){t=ct(t);let s=/([A-Z]{1,})/g;return t.replace(s,i=>e+i.toLowerCase()).toLowerCase()}},jt={url:"",responseType:"json",method:"POST",fixedParams:"",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},beforeSend:[],async:!0,crossDomain:!1,withCredentials:!1,completed:null,failed:null,aborted:null,progress:null};R.augment({xhrSettings:jt,addFixedParams(t){this.xhrSettings.fixedParams=t},beforeSend(t){this.xhrSettings.beforeSend.push(t)},ajaxSettings(t){typeof t=="object"&&(this.xhrSettings=k.extendClass(R.xhrSettings,t))},resetAjaxSettings(){this.xhrSettings=jt}});var qt=(...t)=>new Ne(t).xhr,Ne=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR();if(e===!1)return!1;let{method:s,url:i,async:r}=this.settings;e.open(s,i,r),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=R.xhrSettings.beforeSend;if(t.length<1)return;let e=this.xhr,s=this.settings;for(var i=0,r=t.length;i=2&&typeof t[0]!="object")for(var s=0,i=t.length;s{v.removeEvents(s.upload),v.removeEvents(s)},r=this.settings;if(!r)return!1;switch(e||t.type){case"load":if(typeof r.completed=="function"){let a=this.getResponseData();r.completed(a,this.xhr)}i();break;case"error":typeof r.failed=="function"&&r.failed(!1,this.xhr),i();break;case"progress":typeof r.progress=="function"&&r.progress(t);break;case"abort":typeof r.aborted=="function"&&r.aborted(!1,this.xhr),i();break}}getResponseData(){let t=this.xhr,e=t.responseType;return!e||e==="text"?t.responseText:t.response}addXhrEvents(){if(!this.settings)return;let t=this.xhr,e=this.update.bind(this);v.on(["load","error","abort"],t,e),v.on("progress",t.upload,e)}},Re=class{constructor(){this.connections=new Map}add(t,e,s){return this.find(t).set(e,s),s}get(t,e){let s=this.connections.get(t);return s&&s.get(e)||!1}find(t){let e=this.connections.get(t);if(e)return e;let s=new Map;return this.connections.set(t,s),s}remove(t,e){let s=this.connections.get(t);if(!s)return;let i;if(e)i=s.get(e),i&&(i.unsubscribe(),s.delete(e)),s.size===0&&this.connections.delete(t);else{for(let r of s)i=s.get(r),i&&i.unsubscribe();this.connections.delete(t)}}},Gt=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}},Me=class extends Gt{constructor(t){super(),this.data=t}subscribe(t,e){this.msg=t,this.token=this.data.on(t,e)}unsubscribe(){this.data.off(this.msg,this.token)}},Vt=class{unsubscribe(){}},Fe=class extends Vt{constructor(){super(),this.source=null}addSource(t){return this.source=new Me(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}},Kt=class extends Gt{constructor(t){super(),this.pubSub=t}subscribe(t){this.msg=t;let e=this.callBack.bind(this);this.token=this.pubSub.on(t,e)}unsubscribe(){this.pubSub.off(this.msg,this.token)}callBack(){}},_e=class extends Kt{constructor(t,e,s){super(s),this.data=t,this.prop=e}set(t){this.data.set(this.prop,t)}get(){return this.data.get(this.prop)}callBack(t,e){this.data!==e&&this.data.set(this.prop,t,e)}},C=class{static getById(t){return typeof t!="string"?!1:document.getElementById(t)||!1}static getByName(t){if(typeof t!="string")return!1;let e=document.getElementsByName(t);return e?ft.toArray(e):!1}static getBySelector(t,e){if(typeof t!="string")return!1;if(e=e||!1,e===!0)return document.querySelector(t)||!1;let s=document.querySelectorAll(t);return s?s.length===1?s[0]:ft.toArray(s):!1}static html(t,e){return u.isObject(t)===!1?!1:u.isUndefined(e)===!1?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,s){return u.isObject(t)===!1||u.isUndefined(e)?this:(e=z.uncamelCase(e),t.style[e]=s,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=z.uncamelCase(e);let s=t.style[e];if(s!=="")return s;let i=null,r=t.currentStyle;if(r&&(i=r[e]))return i;let a=window.getComputedStyle(t,null);return a?a[e]:s}static css(t,e,s){return typeof s<"u"?(this.setCss(t,e,s),this):this.getCss(t,e)}static removeAttr(t,e){return u.isObject(t)&&t.removeAttribute(e),this}static setAttr(t,e,s){t.setAttribute(e,s)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,s){return u.isObject(t)===!1?!1:typeof s<"u"?(this.setAttr(t,e,s),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=z.uncamelCase(t),t.substring(0,5)!=="data-"&&(t="data-"+t)),t}static removeDataPrefix(t){return typeof t=="string"&&t.substring(0,5)==="data-"&&(t=t.substring(5)),t}static setData(t,e,s){e=this.removeDataPrefix(e),e=z.camelCase(e),t.dataset[e]=s}static getData(t,e){return e=z.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,s){return u.isObject(t)===!1?!1:typeof s<"u"?(this.setData(t,e,s),this):this.getData(t,e)}static find(t,e){return!t||typeof e!="string"?[]:t.querySelectorAll(e)}static show(t){if(u.isObject(t)===!1)return this;let e=this.data(t,"style-display"),s=typeof e=="string"?e:"";return this.css(t,"display",s),this}static hide(t){if(u.isObject(t)===!1)return this;let e=this.css(t,"display");return e!=="none"&&e&&this.data(t,"style-display",e),this.css(t,"display","none"),this}static toggle(t){return u.isObject(t)===!1?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return u.isObject(t)===!1?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return u.isObject(t)?t.offsetWidth:!1}static getHeight(t){return u.isObject(t)?t.offsetHeight:!1}static getScrollPosition(t){let e=0,s=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,s=t.scrollTop;break;case"object":e=t.scrollLeft,s=t.scrollTop;break}return u.isObject(t)===!1?!1:{left:e-(t.clientLeft||0),top:s-(t.clientTop||0)}}static getScrollTop(t){return this.getScrollPosition(t).top}static getScrollLeft(t){return this.getScrollPosition(t).left}static getWindowSize(){let t=window,e=document,s=e.documentElement,i=e.getElementsByTagName("body")[0],r=t.innerWidth||s.clientWidth||i.clientWidth,a=t.innerHeight||s.clientHeight||i.clientHeight;return{width:r,height:a}}static getDocumentSize(){let t=document,e=t.body,s=t.documentElement,i=Math.max(e.scrollHeight,e.offsetHeight,s.clientHeight,s.scrollHeight,s.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,s.clientWidth,s.scrollWidth,s.offsetWidth),height:i}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let s={x:0,y:0};if(u.isObject(t)===!1)return s;let i=0;for(;t&&(e===0||i"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return u.isObject(t)===!1||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return u.isObject(t)===!1?this:(t.classList.toggle(e),this)}},We=(t,e,s)=>{C.setAttr(t,e,s)},Ue=(t,e,s)=>{t.checked=t.value==s},He=(t,e,s)=>{s=s==1,Jt(t,e,s)},Jt=(t,e,s)=>{t[e]=s},$e=(t,e)=>C.getAttr(t,e),Xe=(t,e)=>t[e],Ye=class extends Kt{constructor(t,e,s,i){super(i),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof s=="string"?this.setupFilter(s):s}addSetMethod(t,e){if(e.substring(4,1)==="-")return this.setValue=We,this.getValue=$e,this;this.getValue=Xe;let s=t.type;if(s)switch(s){case"checkbox":this.setValue=He;return;case"radio":this.setValue=Ue;return}return this.setValue=Jt,this}getAttrBind(t){if(t)return t;let e="textContent",s=this.element;if(!s||typeof s!="object")return e;let i=s.tagName.toLowerCase();if(i==="input"||i==="textarea"||i==="select"){let r=s.type;if(!r)return e="value",e;switch(r){case"checkbox":e="checked";break;case"file":e="files";break;default:e="value"}}return e}setupFilter(t){let e=/(\[\[[^\]]+\]\])/;return s=>t.replace(e,s)}set(t){let e=this.element;return!e||typeof e!="object"?this:(this.filter&&(t=this.filter(t)),this.setValue(e,this.attr,t),this)}get(){let t=this.element;return!t||typeof t!="object"?"":this.getValue(t,this.attr)}callBack(t,e){return e!==this.element&&this.set(t),this}},qe=class extends Vt{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,s){return this.element=new Ye(t,e,s,this.pubSub)}addData(t,e){return this.data=new _e(t,e,this.pubSub)}unsubscribeSource(t){return t&&t.unsubscribe(),this}unsubscribe(){return this.unsubscribeSource(this.element),this.unsubscribeSource(this.data),this.element=null,this.data=null,this}},It=-1,Qt=class{constructor(){this.callBacks=new Map,this.lastToken=-1}get(t){return this.callBacks.has(t)||this.callBacks.set(t,[]),this.callBacks.get(t)}reset(){this.callBacks.clear(),this.lastToken=-1,It=-1}on(t,e){let s=++It;return this.get(t).push({token:s,callBack:e}),String(s)}off(t,e){let s=this.callBacks.get(t);if(!s)return;let i=s.findIndex(r=>r.token===e);i!==-1&&s.splice(i,1)}remove(t){this.callBacks.delete(t)}publish(t,...e){let s=this.callBacks.get(t);if(s)for(let{callBack:i}of s)!i||i.apply(this,e)}},Ge=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=[20,37,38,39,40],this.connections=new Re,this.pubSub=new Qt,this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,s,i){let r=s,a=null;if(s.indexOf(":")!==-1){let h=s.split(":");h.length>1&&(r=h[1],a=h[0])}let n=this.setupConnection(t,e,r,a,i),o=n.element,c=e.get(r);return typeof c<"u"?o.set(c):(c=o.get(),c!==""&&n.data.set(c)),this}setupConnection(t,e,s,i,r){let a=this.getBindId(t),n=new qe(this.pubSub);n.addData(e,s).subscribe(a);let o=`${e.getDataId()}:${s}`;return n.addElement(t,i,r).subscribe(o),this.addConnection(a,"bind",n),n}addConnection(t,e,s){return this.connections.add(t,e,s),this}setBindId(t){let e="db-"+this.idCount++;return t.dataset&&(t.dataset[this.attr]=e),t[this.attr]=e,e}getBindId(t){return t[this.attr]||this.setBindId(t)}unbind(t){let e=t[this.attr];return e&&this.connections.remove(e),this}watch(t,e,s,i){if(u.isObject(t)===!1)return this;let r=new Fe;r.addSource(e).subscribe(s,i);let a=this.getBindId(t),n=e.getDataId()+":"+s;this.addConnection(a,n,r);let o=e.get(s);return typeof o<"u"&&i(o),this}unwatch(t,e,s){if(u.isObject(t)===!1)return this;let i=t[this.attr];if(i){let r=e.getDataId()+":"+s;this.connections.remove(i,r)}return this}publish(t,e,s){return this.pubSub.publish(t,e,s),this}isDataBound(t){return t&&t[this.attr]||null}isBlocked(t){return t.type!=="keyup"?!1:this.blockedKeys.indexOf(t.keyCode)!==-1}bindHandler(t){if(this.isBlocked(t))return!0;let e=t.target||t.srcElement,s=this.isDataBound(e);if(s!==null){let i=this.connections.get(s,"bind");if(i){let r=i.element.get();this.pubSub.publish(s,r,e)}}t.stopPropagation()}setupEvents(){this.changeHandler=this.bindHandler.bind(this),this.addEvents()}addEvents(){typeof document<"u"&&v.on(["change","paste","input"],document,this.changeHandler,!1)}removeEvents(){typeof document<"u"&&v.off(["change","paste","input"],document,this.changeHandler,!1)}},M=new Ge,K=t=>t.data?t.data:t.context&&t.context.data?t.context.data:null,Ve={class:"className",text:"textContent",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",celpadding:"cellPadding",useMap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},St=t=>Ve[t]||t,kt=t=>typeof t=="string"&&t.substring(0,2)==="on"?t.substring(2):t,X=class{static create(t,e,s,i){let r=document.createElement(t);return this.addAttributes(r,e),i===!0?this.prepend(s,r):this.append(s,r),r}static addAttributes(t,e){if(!e||typeof e!="object")return;let s=e.type;typeof s<"u"&&C.setAttr(t,"type",s);for(let[i,r]of Object.entries(e))i==="innerHTML"?t.innerHTML=r:i.indexOf("-")!==-1?C.setAttr(t,i,r):this.addAttr(t,i,r)}static addHtml(t,e){return typeof e>"u"||e===""?this:(/(?:<[a-z][\s\S]*>)/i.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,s){if(!(s===""||!e))if(typeof s=="function")e=kt(e),v.add(e,t,s);else{let i=St(e);t[i]=s}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){let s=document.createTextNode(t);return e&&this.append(e,s),s}static createComment(t,e){let s=document.createComment(t);return e&&this.append(e,s),s}static setupSelectOptions(t,e,s){if(!u.isObject(t)||!u.isArray(e))return!1;e.forEach(i=>{let r=new Option(i.label,i.value);t.options.add(r),s!==null&&r.value==s&&(r.selected=!0)})}static removeElementData(t){let e=t.childNodes;if(e){let r=e.length-1;for(var s=r;s>=0;s--){var i=e[s];!i||this.removeElementData(i)}}P.remove(t),t.bindId&&M.unbind(t)}static removeElement(t){let e;return!t||!(e=t.parentNode)?this:(this.removeElementData(t),e.removeChild(t),this)}static removeChild(t){return this.removeElement(t),this}static removeAll(t){if(!u.isObject(t))return this;let e=t.childNodes;for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&this.removeElementData(e[s]);return t.innerHTML="",this}static changeParent(t,e){return e.appendChild(t),this}static append(t,e){return t.appendChild(e),this}static prepend(t,e,s){let i=s||t.firstChild;return t.insertBefore(e,i),this}static clone(t,e=!1){return u.isObject(t)?t.cloneNode(e):!1}},W=class extends X{static create(t,e,s,i){let r=document.createElement(t);return this.addAttributes(r,e,i),s.appendChild(r),r}static addAttributes(t,e,s){!e||e.length<1||e.forEach(i=>{let{key:r,value:a}=i;this.addAttr(t,r,a,s)})}static addAttr(t,e,s,i){if(s===""||!e)return;if(e==="innerHTML"){t.innerHTML=s;return}if(typeof s=="function"){e=kt(e),v.add(e,t,function(a){s.call(this,a,i)});return}if(e.substr(4,1)==="-"){C.setAttr(t,e,s);return}let r=St(e);t[r]=s}static addContent(t,e){!e||(e.textContent!==null?t.textContent=e.textContent:e.innerHTML&&(t.innerHTML=e.innerHTML))}static append(t,e){t.appendChild(e)}},zt=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,et={isWatching(t){return Array.isArray(t)?typeof t[0]=="string"&&this.hasParams(t[0]):this.hasParams(t)},hasParams(t){return u.isString(t)&&t.includes("[[")},_getWatcherProps(t){let e=/\[\[(.*?)(\[\d+\])?\]\]/g,s=t.match(e);return s===null?null:(e=/(\[\[|\]\])/g,s.map(i=>i.replace(e,"")))},updateAttr(t,e,s){switch(e){case"text":case"textContent":t.textContent=s;break;default:W.addAttr(t,e,s);break}},_getWatcherCallBack(t,e,s,i,r){return()=>{let a=0,n=s.replace(zt,function(){let o=r?e[a]:e;a++;let c=o.get(arguments[2]);return typeof c<"u"?c:""});this.updateAttr(t,i,n)}},getValue(t,e){typeof t=="string"&&(t={value:t});let s=t.value;return Array.isArray(s)===!1?[s,K(e)]:(s.length<2&&s.push(K(e)),s)},getPropValues(t,e,s){let i=[];for(var r=0,a=e.length;r1;a=(h,d)=>{h=c!==!0?h:this.getPropValues(s,o,r),n(h,e,d)}}else{let o=t.attr||"textContent";a=this._getWatcherCallBack(e,s,i,o,r)}return a},addDataWatcher(t,e,s){let i=this.getValue(e,s),r=i[1];if(!r)return;let a=i[0],n=Array.isArray(r),o=this.getCallBack(e,t,r,a,n),c=this._getWatcherProps(a);for(var h=0,d=c.length;htypeof t!="string"?t:Zt(t),Zt=t=>[{tag:"text",textContent:t}],Je=t=>{if(!t)return{props:{},children:[]};let e=t[0];return typeof e=="string"?{props:{},children:Zt(e)}:Array.isArray(e)?et.isWatching(e)===!1?{props:{},children:e}:{props:{watch:e},children:[]}:{props:e||{},children:Ke(t[1])}},f=t=>(...e)=>{let{props:s,children:i}=Je(e);return t(s,i)};function Nt(t,e){let s=isNaN(Number(e)),i=s?e:`[${e}]`;return t===""?i:s?`${t}.${i}`:`${t}${i}`}function te(t,e="",s=""){return{get(i,r,a){let n=i[r];if(e===""&&r in i)return typeof n=="function"?n.bind(i):n;let o=i[s]||i;if(n=Reflect.get(o,r,a),k.isPlainObject(n)||Array.isArray(n)){let c=Nt(e,r);return new Proxy(n,te(t,c,s))}return n},set(i,r,a,n){if(e===""&&r in i)return i[r]=a,!0;let o=Nt(e,r);return t.set(o,a),!0}}}var Qe=(t,e="stage")=>new Proxy(t,te(t,"",e)),Rt=class{static resume(t,e){if(!t)return null;let s,i=localStorage.getItem(t);return i===null?e&&(s=e):s=JSON.parse(i),s}static store(t,e){if(!t||!e)return!1;let s=JSON.stringify(e);return localStorage.setItem(t,s),!0}static remove(t){return t?(localStorage.removeItem(t),!0):!1}},ee=t=>{let e={};if(!u.isObject(t))return e;let s=k.clone(t);return Object.keys(s).forEach(i=>{let r=s[i];typeof r!="function"&&(e[i]=r)}),e},Ze=0,at={CHANGE:"change",DELETE:"delete"},Mt=(t,e)=>`${t}:${e}`,xt=class{constructor(t){this.dirty=!1,this.links={},this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=new Qt;let e=ee(t);return this.set(e),Qe(this)}setup(){this.stage={}}_init(){let t=++Ze;this._dataNumber=t,this._id=`dt-${t}`,this._dataId=`${this._id}:`}getDataId(){return this._id}remove(){}on(t,e){let s=Mt(t,at.CHANGE);return this.eventSub.on(s,e)}off(t,e){let s=t+at.CHANGE;this.eventSub.off(s,e)}_setAttr(t,e,s=this,i=!1){let r=this.stage[t];e!==r&&(this.stage[t]=e,this._publish(t,e,s,at.CHANGE))}publishLocalEvent(t,e,s,i){let r=Mt(t,i);this.eventSub.publish(r,e,s)}_publish(t,e,s,i){this.publishLocalEvent(t,e,s,i),s=s||this,M.publish(this._dataId+t,e,s)}set(...t){if(typeof t[0]!="object")return this._setAttr(...t),this;let[e,s,i]=t;return Object.entries(e).forEach(([r,a])=>{typeof a!="function"&&this._setAttr(r,a,s,i)}),this}getModelData(){return this.stage}_deleteAttr(t,e,s=this){delete t[e],this.publishLocalEvent(e,null,s,at.DELETE)}toggle(t){if(!(typeof t>"u"))return this.set(t,!this.get(t)),this}increment(t){if(typeof t>"u")return;let e=this.get(t);return this.set(t,++e),this}decrement(t){if(typeof t>"u")return;let e=this.get(t);return this.set(t,--e),this}concat(t,e){if(typeof t>"u")return;let s=this.get(t);return this.set(t,s+e),this}ifNull(t,e){return this.get(t)===null&&this.set(t,e),this}setKey(t){return this.key=t,this}resume(t){let e=Rt.resume(this.key,t);return e?(this.set(e),this):this}store(){let t=this.get();return Rt.store(this.key,t)}delete(t){if(typeof t=="string"){this._deleteAttr(this.stage,t);return}this.setup()}_getAttr(t,e){return t[e]}get(t){return typeof t<"u"?this._getAttr(this.stage,t):this.getModelData()}link(t,e,s){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,s);let i=[];return Object.entries(e).forEach(([r])=>{i.push(this.remoteLink(t,r))}),i}remoteLink(t,e,s){let i=s||e,r=t.get(e);typeof r<"u"&&this.get(e)!==r&&this.set(e,r);let a=t.on(e,(o,c)=>{if(c===this)return!1;this.set(i,o,t)});this.addLink(a,t);let n=this.on(i,(o,c)=>{if(c===t)return!1;t.set(e,o,this)});return t.addLink(n,this),a}addLink(t,e){this.links[t]=e}unlink(t){if(t){this.removeLink(t);return}let e=this.links;k.isEmpty(e)||(Object.entries(e).forEach(([s,i])=>{this.removeLink(i,!1)}),this.links={})}removeLink(t,e=!0){let s=this.links[t];s&&s.off(t),e!==!1&&delete this.links[t]}};xt.prototype.isData=!0;var j={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,hasDeepData(t){return t.indexOf(".")!==-1||t.indexOf("[")!==-1},getSegments(t){let e=this.deepDataPattern;return t.match(e)}},it=class extends xt{setup(){this.attributes={},this.stage={}}_updateAttr(t,e,s){if(!j.hasDeepData(e)){t[e]=s;return}let i,r=j.getSegments(e),a=r.length,n=a-1;for(var o=0;o0?isNaN(i)&&(o+="."+i):o=i;var d;if(h===n)d=e;else{var m=r[h+1];if(isNaN(m)===!1){o+="["+m+"]";continue}var D={};D[m]=c[m],d=D}this.publish(o,d,s)}}publish(t,e,s){if(t=t||"",this._publishAttr(t,e,s),!e||typeof e!="object")return;let i,r;if(Array.isArray(e)){let o=e.length;for(var a=0;a{typeof t!="string"&&(t=String(t));let s=e?/[\n\r\t]/g:/\t/g;return t.replace(s,i=>ts[i])},Ft=(t,e)=>{if(typeof t!="string")return t;t=es(t,e),t=encodeURIComponent(t);let s=/%22/g;return t.replace(s,'"')},se=(t,e)=>{let s=typeof t;return s==="undefined"?t:s!=="object"?(t=Ft(t),t):(Object.entries(t).forEach(([i,r])=>{r!==null&&(t[i]=typeof r=="string"?se(r,e):Ft(r,e))}),t)};function ss(t){return typeof t<"u"&&t.length>0?JSON.parse(t):!1}function ie(t){return typeof t<"u"?JSON.stringify(t):null}var re=class{static prepareJsonUrl(t,e=!1){let s=typeof t=="object"?k.clone(t):t,i=se(s,e);return ie(i)}static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};lt(re,"json",{encode:ie,decode:ss});var is=class{constructor(t){this.model=t,this.objectType=this.objectType||"item",this.url="",this.validateCallBack=null,this.init()}init(){let t=this.model;t&&t.url&&(this.url=t.url)}isValid(){let t=this.validate();if(t!==!1){let e=this.validateCallBack;typeof e=="function"&&e(t)}return t}validate(){return!0}getDefaultParams(){return""}setupParams(t){let e=this.getDefaultParams();return t=this.addParams(t,e),t}objectToString(t){let e=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(s+"="+t[s]);return e.join("&")}addParams(t,e){if(t=t||{},typeof t=="string"&&(t=z.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=z.parseQueryString(e,!1)),this._isFormData(t))for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.append(s,e[s]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let s=this.model.get("id"),i="op=get&id="+s,r=this.model;return this._get("",i,t,e,a=>{if(a){let n=this.getObject(a);n&&r.set(n)}})}getObject(t){return t[this.objectType]||t||!1}setupObjectData(){let t=this.model.get();return this.objectType+"="+re.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return!1;let s="op=setup&"+this.setupObjectData();return this._put("",s,t,e)}add(t,e){if(!this.isValid())return!1;let s="op=add&"+this.setupObjectData();return this._post("",s,t,e)}update(t,e){if(!this.isValid())return!1;let s="op=update&"+this.setupObjectData();return this._patch("",s,t,e)}delete(t,e){let s=this.model.get("id"),i="op=delete&id="+s;return this._delete("",i,t,e)}all(t,e,s,i,r){r=r||"",s=isNaN(s)?0:s,i=isNaN(i)?50:i;let a="op=all&option="+r+"&start="+s+"&stop="+i;return this._get("",a,t,e)}getUrl(t){let e=this.url;return t?t[0]==="?"?e+t:e+="/"+t:e}setupRequest(t,e,s,i,r){let a={url:this.getUrl(t),method:e,params:s,completed:(n,o)=>{typeof r=="function"&&r(n),this.getResponse(n,i,o)}};return this._isFormData(s)&&(a.headers={}),qt(a)}_isFormData(t){return t instanceof FormData}request(t,e,s,i){return this._request("","POST",t,e,s,i)}_get(t,e,s,i,r){return e=this.setupParams(e),e=this.addParams(e,s),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",i,r)}_post(t,e,s,i,r){return this._request(t,"POST",e,s,i,r)}_put(t,e,s,i,r){return this._request(t,"PUT",e,s,i,r)}_patch(t,e,s,i,r){return this._request(t,"PATCH",e,s,i,r)}_delete(t,e,s,i,r){return this._request(t,"DELETE",e,s,i,r)}_request(t,e,s,i,r,a){return s=this.setupParams(s),s=this.addParams(s,i),this.setupRequest(t,e,s,r,a)}getResponse(t,e,s){typeof e=="function"&&e(t,s)}static extend(t){if(!t)return!1;let e=this;class s extends e{constructor(r){super(r)}}return Object.assign(s.prototype,t),s}},rs=t=>{let e={};if(!u.isObject(t)||!t.defaults)return e;let{defaults:s}=t;return Object.keys(s).forEach(i=>{let r=s[i];typeof r!="function"&&(e[i]=r)}),delete t.defaults,e},as=t=>{if(!t||typeof t.xhr!="object")return{};let e={...t.xhr};return delete t.xhr,e},ns=0,ae=class extends it{constructor(t){let e=super(t);return this.initialize(),e}setup(){this.attributes={},this.stage={},this.xhr=null}initialize(){}static extend(t={}){let e=this,s=as(t),i=this.prototype.service.extend(s),r=rs(t);class a extends e{constructor(c){let h={...r,...ee(c)};super(h);p(this,"dataTypeId",`bm${ns++}`);this.xhr=new i(this)}}return Object.assign(a.prototype,t),a.prototype.service=i,a}};ae.prototype.service=is;var Ct=class extends xt{},ls=class extends Ct{constructor(t){super(),this.id=t}setup(){this.stage={},this.id=null}addAction(t,e){typeof e<"u"&&this.set(t,e)}getState(t){return this.get(t)}removeAction(t,e){if(e){this.off(t,e);return}let s=this.stage;typeof s[t]<"u"&&delete s[t]}},U=class{static restore(t,e){this.targets.set(t,e)}static getTarget(t){return this.targets.has(t)||this.targets.set(t,new ls(t)),this.targets.get(t)}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,s){let i=this.getTarget(t);return e&&i.addAction(e,s),i}static addAction(t,e,s){return this.add(t,e,s)}static removeAction(t,e,s){this.off(t,e,s)}static on(t,e,s){let i=this.getTarget(t);return e?i.on(e,s):null}static off(t,e,s){this.remove(t,e,s)}static remove(t,e,s){let i=this.targets,r=i.get(t);if(r){if(e){r.off(e,s);return}this.targets.delete(t)}}static set(t,e,s){this.getTarget(t).set(e,s)}};lt(U,"targets",new Map);var os=class{constructor(){this.events=[]}addEvents(t){t.length<1||t.forEach(e=>{this.on(...e)})}on(t,e,s,i){v.on(t,e,s,i),this.events.push({event:t,obj:e,callBack:s,capture:i})}off(t,e,s,i){v.off(t,e,s,i);let r,a=this.events;for(var n=0,o=a.length;n{v.on(t.event,t.obj,t.callBack,t.capture)})}unset(){this.events.forEach(t=>{v.off(t.event,t.obj,t.callBack,t.capture)})}reset(){this.unset(),this.events=[]}},cs=class{constructor(t,e){this.remoteStates=[];let s=this.convertStates(e);this.addStatesToTarget(t,s)}addStates(t,e){let s=this.convertStates(e);this.addStatesToTarget(t,s)}createState(t,e,s,i){return{action:t,state:e,callBack:s,targetId:i,token:null}}convertStates(t){let e=[];for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(s==="remotes"){this.setupRemoteStates(t[s],e);continue}var i=null,r=null,a=t[s];a&&typeof a=="object"&&(r=a.callBack,i=a.id||a.targetId,a=a.state),e.push(this.createState(s,a,r,i))}return e}setupRemoteStates(t,e){let s;for(var i=0,r=t.length;itypeof t!="string"?t:ne(t),ne=t=>[{tag:"text",textContent:t}],us=t=>{if(!t)return{props:{},children:[]};let e=t[0];return typeof e=="string"?{props:{},children:ne(e)}:Array.isArray(e)?{props:{},children:e}:{props:e||{},children:hs(t[1])}};P.addType("components",t=>{if(!t)return;let e=t.component;e&&e.rendered===!0&&e.prepareDestroy()});var ds=0,le=class{constructor(...t){var i;this.isUnit=!0,this.data=null,this.persist=!1,this.children=null,this.nest=null,this.state=null,this.panel=null,this.parent=null,this.init();let{props:e,children:s}=us(t);this.setupProps(e),(i=this.children)!=null||(this.children=s),this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+ds++}setupProps(t){if(!(!t||typeof t!="object"))for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e])}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){let t=this.getParentContext(),e=this.setContext(t);if(e){this.context=e;return}this.context=t,this.setupAddingContext()}setupAddingContext(){let t=this.context,e=this.addContext(t);if(!e)return;let s=e[0];!s||(this.addingContext=!0,this.contextBranchName=s,this.addContextBranch(s,e[1]))}addContextBranch(t,e){var s;(s=this.context)!=null||(this.context={}),this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){!this.addingContext||this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){!t||delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.persist?this._layout||(this._layout=this.render()):this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){P.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout()}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let s=[];if(!t||t.length<1)return s;for(var i=0,r=t.length;itypeof t=="function"?t:()=>t,ms=t=>{let e={};return t&&Object.entries(t).forEach(([s,i])=>{let r=ps[s]||s;e[r]=fs(i)}),e},_t=(t,e)=>{class s extends t{}return Object.assign(s.prototype,e),s},Lt=t=>{if(!t)return null;let e,s=typeof t;return s==="object"&&t.render?(e=ms(t),_t(L,e)):(e={render:s==="function"?t:()=>t},_t(le,e))},gs=(t,e)=>({name:t,callBack:e}),yt={keys:[],items:{},add(t,e){return this.keys.push(t),this.items[t]=gs(t,e),this},get(t){return this.items[t]||null},all(){return this.keys}},Wt=(t,e)=>({attr:t,directive:e}),Z=(t,e)=>({key:t,value:e}),vs=(t,e,s,i)=>({tag:t,attr:e,directives:s,children:i}),At=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,s,i){return t==="text"?(i.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(s.push(Z("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,s){let i={attr:St(e),value:s};t.push(Wt(Z(e,i),yt.get("watch")))}static setButtonType(t,e,s){if(t==="button"){let i=e.type||"button";s.push(Z("type",i))}}static parse(t,e){let s=[],i=[],r=this.getTag(t);this.setButtonType(r,t,s),this.setupChildren(t);let a=[];var n,o;for(var c in t){if(!k.hasOwnProp(t,c)||c==="tag"||(n=t[c],n==null))continue;if((o=yt.get(c))!==null){i.push(Wt(Z(c,n),o));continue}let h=typeof n;if(h==="object"){if(c==="children"){a=a.concat(n);continue}if(et.isWatching(n)){this.setTextAsWatcher(i,c,n);continue}a.push(n);continue}if(h==="function"){let d=n;n=function(m){d.call(this,m,e)}}if(et.isWatching(n)){this.setTextAsWatcher(i,c,n);continue}this.setElementContent(c,n,s,a)||s.push(Z(c,n))}return vs(r,s,i,a)}},oe=class{build(t,e,s){}createComponent(t,e,s){let i=t;i.parent=s,s&&s.persist===!0&&i.persist!==!1&&(i.persist=!0),i.cache&&s&&(s[i.cache]=i),i.setup(e);let r=i.prepareLayout(),a=this.build(r,i.container,i);return i.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(i),a}setDirectives(t,e,s){}removeAll(t){}},ys=class extends oe{build(t,e,s){let i=W.createDocFragment();return(Array.isArray(t)?t:[t]).forEach(r=>this.buildElement(r,i,s)),e&&typeof e=="object"&&e.appendChild(i),i}buildElement(t,e,s){if(t){if(t.isUnit===!0){this.createComponent(t,e,s);return}this.createElement(t,e,s)}}createElement(t,e,s){let i=At.parse(t,s),r=this.createNode(i,e,s);this.cache(r,t.cache,s),i.children.forEach(n=>{n!==null&&this.buildElement(n,r,s)});let a=i.directives;a&&a.length&&this.setDirectives(r,a,s)}setDirectives(t,e,s){e.forEach(i=>{this.handleDirective(t,i,s)})}handleDirective(t,e,s){e.directive.callBack(t,e.attr.value,s)}cache(t,e,s){s&&e&&(s[e]=t)}createNode(t,e,s){let i=t.tag;if(i==="text"){let r=t.attr[0],a=r?r.value:"";return W.createText(a,e)}else if(i==="comment"){let r=t.attr[0],a=r?r.value:"";return W.createComment(a,e)}return W.create(i,t.attr,e,s)}removeAll(t){W.removeAll(t)}},bs=["area","base","br","col","embed","hr","img","input","link","meta","source"],ht=class{static create(t,e={},s=""){let i=this.createAttributes(e);return bs.includes(t)?`<${t} ${i} />`:`<${t} ${i}>`+s+``}static createAttributes(t=[]){return!t||t.length<1?"":t.map(e=>{let{key:s,value:i}=e;return typeof i=="function"&&(s="on"+kt(s)),`${s}="${i}"`}).join(" ")}static createText(t){return t}static createComment(t){return``}},ws=class extends oe{build(t,e,s){return(Array.isArray(t)?t:[t]).map(i=>this.buildElement(i,s)).join("")}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,e):this.createElement(t,e):""}createElement(t,e){let s=At.parse(t,e),i=s.children.map(r=>r!==null?this.buildElement(r,e):"").join("");return this.createNode(s,i)}createNode(t,e){let s=t.tag;if(s==="text"){let i=t.attr[0],r=i?i.value:"";return ht.createText(r)}else if(s==="comment"){let i=t.attr[0],r=i?i.value:"";return ht.createComment(r)}return ht.create(s,t.attr,e)}removeAll(t){}},Ps=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new ys:new ws}},tt=Ps.setup(),Ss=t=>typeof t=="object"&&t.isUnit===!0,ks=t=>{let e=Lt(t);return new e},A=class{static render(t,e,s){return t?(Ss(t)||(t=ks(t)),tt.createComponent(t,e,s)):null}static build(t,e,s){return tt.build(t,e,s)}static rebuild(t,e,s){return tt.removeAll(e),this.build(t,e,s)}static setDirectives(t,e,s){tt.setDirectives(t,e,s)}static createNode(t,e,s){return tt.createNode(t,e,s)}};R.augment({buildLayout(t,e,s){A.build(t,e,s)}});var Tt=[],xs=t=>Tt.indexOf(t)!==-1,Cs=t=>({tag:"script",src:t.src,async:!1,load(e){Tt.push(t.src);let s=t.load;s&&s()}}),Ls=t=>({tag:"link",rel:"stylesheet",type:"text/css",href:t.src,load(e){Tt.push(t.src);let s=t.load;s&&s()}}),As=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,s=this.update.bind(this);t.indexOf(".css")!==-1?e=Ls({load:s,src:t}):e=Cs({load:s,src:t}),A.build(e,document.head)}addFiles(t){!t||t.forEach(e=>{xs(e)||this.add(e)})}update(){if(this.updateProgress()<100)return;let t=this.callBack;t&&t()}updateProgress(){return++this.loaded,this.percent=Math.floor(this.loaded/this.total*100)}},Ts=(t,e)=>{let s=t;typeof t=="string"&&(s=Ee(()=>import(t),[])),s.then(i=>{e&&e(i)})},Es=t=>{var e;return t?typeof((e=t==null?void 0:t.prototype)==null?void 0:e.constructor)=="function":!1},Bs=(t,e,s)=>{let i=A.build(t,null,s),r=i.firstChild;return e.after(i),r},Ds=t=>({tag:"comment",textContent:"import placeholder",onCreated:t.onCreated}),Os=Lt({render(){return Ds({onCreated:t=>{if(this.src){if(this.depends){new As(()=>{this.loadAndRender(t)}).addFiles(this.depends);return}this.loadAndRender(t)}}})},getLayout(t){let e=t.default;if(!e)return null;let s=this.callBack;return s?e=s(e):Es(e)?(e=new e,e.route=this.route,this.persist&&(e.persist=!0)):e=e(),this.layout=e},loadAndRender(t){Ts(this.src,e=>{this.loaded=!0;let s=this.layout||this.getLayout(e);this.layoutRoot=Bs(s,t,this.parent)})},shouldUpdate(t){return this.updateLayout===!0?!0:this.updateLayout=t&&t.isUnit&&typeof t.update=="function"},updateModuleLayout(t){let e=this.layout;this.shouldUpdate(e)&&e.update(t)},update(t){this.loaded===!0&&this.updateModuleLayout(t)},beforeDestroy(){!this.layoutRoot||X.removeElement(this.layoutRoot)}}),js=t=>(typeof t=="string"&&(t={src:t}),new Os(t)),Et=(t,e,s,i)=>{if(Array.isArray(s[0])){s.forEach(r=>{!r||Et(t,e,r,i)});return}Is(t,e,s,i)},Is=(t,e,s,i)=>{let r,a;if(s.length<3?[r,a]=s:[e,r,a]=s,!e||!r)return;let n=zs(t,r,a,i);M.watch(t,e,r,n)},zs=(t,e,s,i)=>typeof s=="object"?r=>{_s(t,s,r)}:r=>{Ns(t,s,e,r,i)},Ns=(t,e,s,i,r)=>{let a=e(i,t,r);switch(typeof a){case"object":a=Rs(r,s,i,a),Fs(a,t,r);break;case"string":X.addHtml(t,a);break}},Rs=(t,e,s,i)=>!t||!i||i.isUnit!==!0||t.persist!==!0||!t.state?i:Ms(t,e,s,i),Ms=(t,e,s,i)=>{let r=e+":"+s,a=t.state,n=a.get(r);return typeof n<"u"&&(i=n),a.set(r,i),i},Fs=(t,e,s)=>{A.rebuild(t,e,s)},_s=(t,e,s)=>{for(let[i,r]of Object.entries(e))!i||(r===s?C.addClass(t,i):C.removeClass(t,i))},ce=(t,e,s)=>{let i=K(s);Et(t,i,e,s)},Ws=(t,e,s)=>{!e||e&&C.setAttr(t,"role",e)},Us=t=>(e,s)=>{let i=s?"true":"false";C.setAttr(e,t,i)},Hs=(t,e,s)=>{if(!e)return;let i=e.role;i&&(C.setAttr(t,"role",i),e.role=null),Object.entries(e).forEach(([r,a])=>{if(a===null)return;let n=`aria-${r}`;Array.isArray(a)?(a.push(Us(n)),ce(t,a,s)):C.setAttr(t,n,a)})};P.addType("context",t=>{if(!t)return!1;t.parent.removeContextBranch(t.branch)});var Bt=t=>t?t.getContext():null,$s=(t,e,s)=>{if(typeof e!="function")return;let i=Bt(s),r=e(i);if(!r)return;let a=At.parse(r,s);W.addAttributes(t,a.attr,s),A.setDirectives(t,a.directives,s)},Xs=(t,e,s)=>{if(typeof e!="function")return;let i=Bt(s);e(i)},Ys=(t,e,s)=>{if(typeof e!="function"||!s)return;let i=Bt(s),r=e(i);!r||s.addContextBranch(r[0],r[1])},qs=(t,e,s)=>{},Gs=(t,e,s)=>{!e||!s||e(s,t)},Vs=(t,e,s)=>{!e||!s||e(s.data,t)},Ks=(t,e,s)=>{!e||!s||e(s.state,t)},Js=(t,e,s)=>{if(!(!e||!s)&&s.stateHelper){let i=s.state,r=e(i);s.stateHelper.addStates(r)}},Qs=(t,e,s)=>{let i,r,a;if(typeof e=="string"){if(i=K(s),!i)return;r=e}else if(Array.isArray(e)){if(typeof e[0]!="object"){let n=K(s);if(!n)return;e.unshift(n)}[i,r,a]=e}M.bind(t,i,r,a)},Zs=(t,e,s)=>{let i,r,a,n;if(e.length<3){let c=K(s);if(!c)return;i=c,[r,a,n]=e}else[i,r,a,n]=e;let o=n!==!1;M.watch(t,i,r,c=>{if(X.removeAll(t),!c||c.length<1)return;let h=[];return c.forEach((d,m)=>{let D=o?i.scope(r+"["+m+"]"):null,O=a(c[m],m,D);O!==null&&h.push(O)}),A.build(h,t,s)})},ti=(t,e,s)=>{let i=e[0];if(!i||i.length<1)return;let r=e[1],a=[];i.forEach((n,o)=>{if(!n)return;let c=r(n,o);c!==null&&a.push(c)}),A.build(a,t,s)},ei=(t,e,s)=>{e(t)};P.addType("destroyed",t=>{if(!t)return!1;t.callBack(t.ele)});var si=(t,e,s)=>{ii(t,e)},ii=(t,e)=>{P.add(t,"destroyed",{ele:t,callBack:e})},ri=(t,e,s)=>{Et(t,s.state,e,s)},ai=(t,e,s)=>{if(e)if(Array.isArray(e)&&typeof e[0]!="string")for(var i=0,r=e.length;i{if(!t.length)return null;let e={};return t.forEach(s=>{e[s]=null}),e},di=t=>{let e=[];if(!t)return e;let s=/[*?]/g;t=t.replace(s,"");let i=/:(.[^./?&($]+)\?*/g,r=t.match(i);return r===null||r.forEach(a=>{a&&(a=a.replace(":",""),e.push(a))}),e},pi=t=>t.replace(/\//g,"/"),fi=t=>t.replace(/(\/):[^/(]*?\?/g,e=>e.replace(/\//g,"(?:$|/)")),mi=t=>(t=t.replace(/(\?\/+\*?)/g,"?/*"),t.replace(/(:[^/?&($]+)/g,e=>e.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),gi=t=>t.replace(/(\*)/g,".*"),vi=(t,e)=>t+=e[e.length-1]==="*"?"":"$",yi=t=>{if(!t)return"";let e=pi(t);return e=fi(e),e=mi(e),e=gi(e),e=vi(e,t),e},bi=0,wi=class extends Ct{constructor(t,e){let s=t.baseUri,i=di(s),r=ui(i),a=super(r);return this.uri=s,this.paramKeys=i,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),a}setup(){this.stage={},this.id=null,this.uri=null,this.uriQuery=null,this.controller=null,this.paramKeys=null,this.titleCallBack=null,this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null}setupRoute(t){this.id=t.id||"bs-rte-"+bi++,this.path=null,this.referralPath=null;let e=yi(this.uri);this.uriQuery=new RegExp("^"+e),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title}setTitle(t){this.titleCallBack(this,t)}deactivate(){this.set("active",!1);let t=this.controller;t&&t.remove()}getLayout(t){if(t.component)return t.component;let e=t.import;return e?js(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:s,persist:i=!1,parent:r}=t,a={component:e,container:s,persist:i,parent:r};this.controller=new hi(this,a)}resume(t){let e=this.controller;e&&(e.container=t)}setPath(t,e){this.path=t,this.referralPath=e}select(){this.set("active",!0);let t=this.stage,e=this.callBack;typeof e=="function"&&e(t);let s=this.controller;s&&s.focus(t);let i=this.path;if(!i)return;let r=i.split("#")[1];!r||this.scrollToId(r)}scrollToId(t){if(!t)return;let e=document.getElementById(t);!e||e.scrollIntoView(!0)}match(t){let e=!1,s=t.match(this.uriQuery);return s===null?(this.resetParams(),e):(Array.isArray(s)&&(s.shift(),e=s,this.setParams(s)),e)}resetParams(){this.stage={}}setParams(t){if(!Array.isArray(t))return;let e=this.paramKeys;if(!e)return;let s={};e.forEach((i,r)=>{typeof i<"u"&&(s[i]=t[r])}),this.set(s)}getParams(){return this.stage}},Pi=t=>{let e=/\w\S*/;return t.replace(e,s=>s.charAt(0).toUpperCase()+s.substring(1).toLowerCase())},Si=(t,e)=>{if(t.indexOf(":")===-1)return t;let s=e.stage;for(let[i,r]of Object.entries(s)){let a=new RegExp(":"+i,"gi");t=t.replace(a,r)}return t},ki=(t,e)=>e&&(typeof e=="function"&&(e=e(t.stage)),e=Si(e,t),Pi(e)),xi=(t,e)=>(e!==""&&(t+=" - "+e),t),Ci=(t,e,s)=>e&&(e=ki(t,e),xi(e,s)),Li={removeSlashes(t){return typeof t!="string"?"":(t.substring(0,1)==="/"&&(t=t.substring(1)),t.substring(-1)==="/"&&(t=t.substring(0,t.length-1)),t)}};P.addType("routes",t=>{if(!t)return!1;let e=t.route;e&&rt.removeRoute(e)});P.addType("switch",t=>{if(!t)return!1;let e=t.id;rt.removeSwitch(e)});var Ai=()=>typeof window<"u"?window.location:{},Ti=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.history=null,this.callBackLink=null,this.location=Ai(),this.routes=[],this.switches={},this.switchCount=0,this.data=new it({path:""})}setupHistory(){this.history=ci.setup(this)}createRoute(t){let e=t.uri||"*";return t.baseUri=this.createURI(e),new wi(t,this.updateTitle.bind(this))}add(t){if(typeof t!="object"){let s=arguments;t={uri:s[0],component:s[1],callBack:s[2],title:s[3],id:s[4],container:s[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.resume(e),this.addRoute(t)}getBasePath(){if(!this.basePath){let t=this.baseURI||"";t[t.length-1]!=="/"&&(t+="/"),this.basePath=t}return this.basePath}createURI(t){return this.getBasePath()+Li.removeSlashes(t)}getRoute(t){let e=this.routes,s=e.length;if(s>0)for(var i=0;i0)for(var i=0;i-1&&e.splice(s,1)}addSwitch(t){let e=this.switchCount++,s=this.getSwitchGroup(e);return t.forEach(i=>{let r=this.createRoute(i);s.push(r)}),this.checkGroup(s,this.getPath()),e}resumeSwitch(t,e){let s=this.switchCount++,i=this.getSwitchGroup(s);return t.forEach(r=>{let a=r.component.route;a.resume(e),i.push(a)}),this.checkGroup(i,this.getPath()),s}getSwitchGroup(t){return this.switches[t]=[]}removeSwitch(t){let e=this.switches;e[t]&&delete e[t]}remove(t){t=this.createURI(t);let e=this.getRoute(t);return e!==!1&&this.removeRoute(e),this}setup(t,e){this.baseURI=t||"/",this.updateBaseTag(this.baseURI),this.title=typeof e<"u"?e:"",this.setupHistory(),this.data.path=this.getPath(),this.callBackLink=this.checkLink.bind(this),v.on("click",document,this.callBackLink);let s=this.getEndPoint();return this.navigate(s,null,!0),this}updateBaseTag(t){let e=document.getElementsByTagName("base");e.length&&(e[0].href=t)}getParentLink(t){let e=t.parentNode;for(;e!==null;){if(e.nodeName.toLowerCase()==="a")return e;e=e.parentNode}return!1}checkLink(t){if(t.ctrlKey===!0)return!0;let e=t.target||t.srcElement;if(e.nodeName.toLowerCase()!=="a"&&(e=this.getParentLink(e),e===!1)||e.target==="_blank"||C.data(e,"cancel-route"))return!0;let s=e.getAttribute("href");if(typeof s<"u"){let i=this.baseURI,r=i!=="/"?s.replace(i,""):s;return this.navigate(r),t.preventDefault(),t.stopPropagation(),!1}}reset(){return this.routes=[],this.switches=[],this.switchCount=0,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,s){return t=this.createURI(t),this.history.addState(t,e,s),this.activate(),this}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;document.title=Ci(t,e,this.title)}checkActiveRoutes(t){this.lastPath=this.path,t=t||this.getPath(),this.path=t;let e=this.routes,s=e.length,i;for(var r=0;r"u")&&this.checkRoute(i,t);this.checkSwitches(t),this.updatePath()}checkSwitches(t){let e=this.switches;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var i=e[s];this.checkGroup(i,t)}}checkGroup(t,e){let s=!1,i,r,a,n,o=!1;for(var c=0,h=t.length;c"u")){if(c===0&&(r=i),!a&&i.get("active")&&(a=i),s!==!1){o&&i.deactivate();continue}s=i.match(e),s!==!1&&(n=i,i.controller&&(this.select(i),o=!0))}if(n===void 0){this.select(r),a&&r!==a&&a.deactivate();return}a?o&&n!==a&&a.deactivate():r&&o===!1&&this.select(r)}checkRoute(t,e){let s=this.check(t,e);return s!==!1?this.select(t):t.deactivate(),s}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t){!t||(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t))}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){v.off("click",document,this.callBackLink)}getPath(){let t=this.location,e=this.path=t.pathname;return this.history.type==="hash"?t.hash.replace("#",""):e+t.search+t.hash}},rt=new Ti,Ei=(t,e,s)=>{!e||(Array.isArray(e)?e.forEach(i=>{Ut(t,i,s)}):Ut(t,e,s))},Ut=(t,e,s)=>{e.container=t,e.parent=s;let i=rt.add(e);Bi(t,i)},Bi=(t,e)=>{P.add(t,"routes",{route:e})},Di=(t,e,s)=>{e[0],e.forEach(r=>{r.container=t,r.parent=s});let i=rt.addSwitch(e);Oi(t,i)},Oi=(t,e)=>{P.add(t,"switch",{id:e})};yt.add("cache",qs).add("onCreated",ei).add("onDestroyed",si).add("bind",Qs).add("onSet",ce).add("onState",ri).add("watch",ai).add("useParent",Gs).add("useData",Vs).add("useState",Ks).add("addState",Js).add("map",ti).add("for",Zs).add("useContext",Xs).add("addContext",Ys).add("context",$s).add("role",Ws).add("aria",Hs).add("route",Ei).add("switch",Di);R.augment({Ajax:qt,Html:X,dataBinder:M,Data:it,SimpleData:Ct,Model:ae,State:U,Builder:A,router:rt,Component:L});var y=(t,e)=>({...t,children:e}),l=f((t,e)=>y(t,e)),ue=f((t,e)=>y({...t,tag:"dialog"},e)),E=f((t,e)=>y({...t,tag:"span"},e)),B=f((t,e)=>y({...t,tag:"p"},e)),Y=f((t,e)=>y({...t,tag:"a"},e)),H=f((t,e)=>y({...t,tag:"button"},e)),de=f((t,e)=>y({...t,tag:"ul"},e)),pe=f((t,e)=>y({...t,tag:"li"},e)),T=f(t=>y({...t,tag:"img"},null)),$=f((t,e)=>y({...t,tag:"h2"},e)),ji=f(t=>y({...t,tag:"input"},null)),_=f((t,e)=>y({...t,tag:"label"},e)),Ii=f(t=>ji({...t,type:"checkbox"})),b=f((t,e)=>y({...t,tag:"section"},e)),J=f((t,e)=>y({...t,tag:"article"},e)),x=f((t,e)=>y({...t,tag:"header"},e)),zi=f((t,e)=>y({...t,tag:"footer"},e)),Ni=f((t,e)=>y({...t,tag:"nav"},e)),Ri=f((t,e)=>y({...t,tag:"main"},e)),Mi=f((t,e)=>y({...t,tag:"audio"},e)),Fi=f((t,e)=>y({...t,tag:"canvas"},e));const fe=({class:t,click:e,children:s})=>ue({class:`prompt-panel ${t}`,click:e},[l({class:"panel-top-button-container"},[l({class:"bttn circle close",click:(i,r)=>r.close()},[l({class:"content"},[E(),E()])])]),...s]);class q extends L{render(){const e=s=>{s.target===this.panel&&this.close()};return fe({class:this.class,click:e,children:[l({class:"touch-slider"},[l({class:"step"},[b(this.children)])])]})}open(){A.render(this,document.body),this.panel.showModal(),typeof this.activateCallBack=="function"&&this.activateCallBack()}close(){!this.panel||(this.panel.close(),this.destroy(),typeof this.deactivateCallBack=="function"&&this.deactivateCallBack())}}const _i=({class:t,click:e,children:s})=>ue({class:`prompt-panel ${t}`,click:e},[...s]);class Wi extends q{render(){return _i({class:this.class,children:[l({class:"touch-slider"},[l({class:"step"},[b(this.children)])])]})}}const Ui=t=>new Wi({...t,class:"orientation-panel"},[l({class:"content"},[T({src:"images/multisplode.svg",type:"image/svg+xml"}),l({class:"title-enhance"},"Landscape Orientation Needed"),B("Please rotate your device to landscape mode to play the game.")])]),S=U.add("settings"),Hi="settings";S.setKey(Hi);const $i={audio:!1,music:!1,graphics:"medium",song:"play-loop.mp3"};S.resume($i);class Xi extends L{render(){return Mi({src:this.getFilePath(),loop:!0})}getFilePath(){return"sound/music/"+this.fileName}change(e){this.fileName!==e&&(this.fileName=e,this.panel.src=this.getFilePath(),this.state.music===!0&&this.start())}afterSetup(){S.music===!0&&this.start()}setupStates(){return{remotes:[{id:"settings",music:{callBack:e=>{!this.panel||(e===!0?this.start():this.stop())}},song:{callBack:e=>{!this.panel||this.change(e)}}}]}}start(){const e=this.panel;e.volume=.6,e.play()}stop(){this.panel.pause()}}const Yi=()=>typeof window.localStorage<"u",nt=Yi(),me={storage:null,setup(){return nt===!0&&(this.storage=window.localStorage),this},get(t){if(nt===!1)return null;const e=this.storage.getItem(t);if(typeof e<"u")return JSON.parse(e)},set(t,e){nt===!0&&(e=JSON.stringify(e),this.storage.setItem(t,e))},clear(){nt===!0&&this.storage.clear()}}.setup(),w={currentLevel:null,activeLevels:[],controller:null,packs:[],activePack:null,game:null,setGame(t){this.game=t},setupActivePack(){this.packs.length>0&&(this.activePack=this.packs[0],this.activeLevels=this.activePack.setupLevels())},addLevelPack(t){this.packs.push(t)},setup(){this.setupActivePack()},selectPrimaryLevel(){const t=this.getPrimaryLevel();this.setLevel(t)},getPrimaryLevel(){const t=me.get("lastLevel");return t?this.activeLevels[t.number-1]:this.getFirstUnlockedLevels()},getFirstUnlockedLevels(){const t=this.activeLevels;let e=!1;for(let s=0,i=t.length;s0?--e:t.length-1;return t[s]},selectPreviousLevel(){const t=this.getPreviousLevel();t&&this.selectLevel(t)}},qi=(t,e)=>pe({class:"option title-text",click:(s,i)=>i.moveToSelectedElement(s.target)},t);class ge extends L{constructor(){super(...arguments);p(this,"posX",0)}onCreated(){this.viewNumber=null,this.optionsArray=[],this.selection=null,this.index=0,this.moveX=0,this.startX=0,this.contact=!1}render(){return x({class:"title-container"},[de({cache:"navContainer",class:"option-container",...this.getEvents(),map:[this.items,qi]})])}getEvents(){const s=this.start.bind(this),i=this.move.bind(this),r=this.end.bind(this);return{touchstart:s,mousedown:s,touchmove:i,mousemove:i,touchend:r,mouseup:r,mouseout:r}}setupEvents(){const s=this.resize.bind(this);return[["resize",window,s]]}afterSetup(){this.getOptions(),this.reset(),window.setTimeout(()=>this.resize(),10)}selectPrimaryStep(){const s=this.optionsArray[0];s&&this.moveToSelectedOption(s)}reset(){this.selectPrimaryStep()}getParentWidth(){if(this.panel){const s=this.panel.getBoundingClientRect();this.parentWidth=s.width}}getOptions(){let s=this.navContainer.querySelectorAll(".option");if(!s)return[];s=[].slice.call(s);const i=s.map((r,a)=>({element:r,index:a}));this.optionsArray=i,this.getParentWidth()}moveToSelectedElement(s){if(!s)return;let i=this.getOptionByElement(s);i&&this.moveToSelectedOption(i)}moveToSelectedOption(s){s&&(this.selectOption(s),this.moveToElement(s.element))}moveToSelectedIndex(s){let i=this.optionsArray[s];i&&(this.selectOption(i,!0),this.moveToElement(i.element))}selectOptionByIndex(s){let i=this.optionsArray;for(let r=0,a=i.length;r=i&&a.y<=r&&a.y+a.height>=r}end(s){if(this.contact===!0){this.navContainer.classList.remove("active"),this.contact=!1,this.parentWidth/2;let i=this.selection.element;this.moveToElement(i)}}}class ut{static getEventPosition(e){const s={x:0,y:0};if(e){const i=e.touches;if(i){const r=i[0];s.x=r.pageX,s.y=r.pageY}else s.x=e.clientX||e.pageX,s.y=e.clientY||e.pageY}return s}static calculateAngle(){const e=this.startX-this.moveX,s=this.moveY-this.startY,i=Math.atan2(s,e);let r=Math.round(i*180/Math.PI);return r<0&&(r=360-Math.abs(r)),r}static getSwipeDirection(e){let s;return e<=45&&e>=0||e<=360&&e>=315?s="left":e>=135&&e<=225?s="right":e>45&&e<135?s="down":s="up",s}static isLeftRight(){const e=this.calculateAngle(),s=this.getSwipeDirection(e);return s==="left"||s==="right"}}const ve="step",Gi=(t,e)=>b({class:ve},[t]),Vi=(t,e)=>l({...t,class:"option",onState:["index",{selected:e}],cick:(s,i)=>i.moveToSelectedIndex(e)}),Ki=f((t,e)=>l({class:"crumb-container"},[l({...t,class:"number-crumb-container"},e)]));class Dt extends L{constructor(){super(...arguments);p(this,"canMove",null)}onCreated(){this.viewNumber=null,this.steps=[],this.index=0,this.stepWidth=null,this.minimum=72,this.moveX=0,this.startX=0,this.moveY=0,this.startY=0,this.contact=!1,this.preventTouch=!1,this.preventScroll=!1}render(){return J({class:"touch-slider step-container"},[l({cache:"slider",class:"step-slider-container",...this.getEvents(),map:[this.items,Gi]}),Ki({map:[this.items,Vi]})])}setupStates(){return{index:this.index}}getEvents(){const s=this.start.bind(this),i=this.move.bind(this),r=this.end.bind(this);return{touchstart:s,mousedown:s,touchmove:i,mousemove:i,touchend:r,mouseup:r,mouseout:r}}setupEvents(){const s=this.getStepWidth.bind(this);return[["resize",window,s]]}afterSetup(){this.getSteps(),this.selectPrimaryStep()}getSteps(){let s=this.slider.querySelectorAll("."+ve);if(!s)return[];s=[].slice.call(s);const i=s.map((r,a)=>({ele:r,index:a}));this.steps=i,this.getStepWidth()}moveToSelectedElement(s){if(!s)return;const i=this.getStepByElement(s);i&&this.moveToSelectedStep(i)}moveToSelectedStep(s){if(!s)return;this.getStepWidth();const i=this.stepWidth*s.index;this.moveContainer("-"+i),this.index=s.index,this.state.index=s.index,this.selectStep(s)}moveToSelectedIndex(s){const i=this.steps[s];if(!i)return;this.getStepWidth();const r=this.stepWidth*i.index;this.moveContainer("-"+r),this.index=i.index,this.state.index=i.index,this.selectStep(i,!0)}selectStepByIndex(s){const i=this.steps;for(let r=0,a=i.length;rthis.stepWidth/3&&(this.moveX>this.index*this.stepWidth&&this.index0&&this.index--),this.selectStepByIndex(this.index)}this.moveContainer("-"+this.index*this.stepWidth)}this.state.index=this.index,this.canMove=null,this.preventTouch=!1}}class Q extends L{render(){return this.children[0]}update(e){}}function Ji(t){this.parent.nav&&this.parent.nav.moveToSelectedIndex(t)}function Qi(t){this.parent.touch&&this.parent.touch.moveToSelectedIndex(t)}const Zi=t=>{let e=t.locked===!1?" unlocked":"";return t===w.currentLevel&&(e+=" selected"),"bttn option circle fadeIn"+e},tr=t=>{const e=Zi(t);return H({class:e,click:(s,{parent:i})=>!t.locked&&i.game.selectLevel(t)},[l({class:"content"},String(t.number))])},er=({game:t})=>new Q({game:t},[J({class:"control-sub-panel level-select-container overlay-panel"},[b({class:"home-sub-panel level-select-panel"},[l({class:"panel-top-button-container floatUpZBounce"},[Y({class:"bttn circle close",href:"/"},[l({class:"content"},[E(),E()])])]),new ge({cache:"nav",callBackFn:Qi,items:["Level Select"]}),l({class:"main-step-container"},[new Dt({cache:"touch",callBackFn:Ji,items:[l({class:"content",map:[w.activeLevels,tr]})]})])])])]);class sr extends L{onCreated(){var e;(e=this.duration)!=null||(this.duration=4e3),this.timer=null}render(){return l({class:`flash-panel dropInBounce ${this.type}`},[zi({class:"button-container"},[H({class:"bttn circle close",onclick:()=>this.destroy()},[l({class:"content"},[E(),E()])])]),l({class:"icon-container"}),x({class:"title-container"},[l({class:"title left dark"},this.title),l({class:"description center dark"},this.description)])])}afterSetup(){this.timer=setTimeout(()=>this.destroy(),this.duration)}start(e){A.render(this,e)}}const st=Math.PI*2,ir=180/Math.PI,rr=Math.PI/180,g={randomFromTo(t,e,s){return s=typeof s<"u"?!0:s,s?Math.floor(Math.random()*(e-t+1)+t):Math.random()*(e-t+1)+t},arc:st,checkCircluarCollision(t,e,s,i,r,a){const n=t-i,o=e-r;return n*n+o*o<=(s+a)*(s+a)},getOrbitPosition(t,e,s,i){let r=Math;return{x:t+r.cos(s)*i,y:e+r.sin(s)*i}},updateOrbitAngle(t,e,s){return s=typeof s>"u"?!0:s,s?t+e:t-e},getBezierCurve(t,e,s,i,r){let a=r,n=3(e.x-t.x),o=3(s.x-e.x)-n,c=i.x-t.x-n-o,h=3(e.y-t.y),d=3(s.y-e.y),m=i.y-t.y-h-d;c*(a*a*a)+o*(a*a)+n*a+t.x,m*(a*a*a)+d*(a*a)+h*a+t.y},spiral(t,e){return t+e},degreesPI:ir,getDegrees(t){return t*this.degreesPI},radiansPI:rr,getRadians(t){return t*this.radiansPI},getSlope(t,e,s,i){let r=t-s;return(e-i)/r},getAngle(t,e,s,i){const r=t-s,a=e-i,n=Math.atan2(a,r);return this.getDegrees(n)},getPositionByAngle(t,e){const s=this.getRadians(t);return{x:Math.cos(s)*e,y:Math.sin(s)*e}},getDistance(t,e,s,i){const r=t-s,a=e-i;return Math.sqrt(r*r+a*a)},getNextPosition(t,e,s,i,r){const a=this.getDistance(t,e,s,i),n=this.getMovementBySpeed(a,r);return{x:(s-t)/n,y:(i-e)/n}},distance(t,e){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))},getMovementBySpeed(t,e){return t/e},round(t){return~~(.5+t)},floor(t){return~~t}},ye={options:[],messages:{awful:[],bad:[],good:[],close:[],great:[]},reset(){this.options=[]},setup(){const t=this.messages,e=(s,i,r)=>{const a={title:i,text:r};t[s].push(a)};e("awful","Whaaaa?","Let's just pretend this didn't happen..."),e("awful","Umm...","I've stopped watching already. Let's try again"),e("awful","Uhhh...","Houston, we have a problem"),e("awful","Achievement unlocked (not really)","Being this bad has to be rewarded..."),e("awful","Maybe next time...","Just click retry and don't look back"),e("bad","Brah","It's like you weren't even looking at the screen"),e("bad","Bad you did","These are not the scores you are looking for"),e("bad","Someone once told me","Just keep trying. Just keep trying."),e("bad","Yikes","You should try searching for the Konami Code"),e("bad","Like a car in a hotel room...",'You just wonder "How did this happen?"'),e("close","Almost","So close yet so far away!"),e("close","This level is even more difficult than...","That time I tried to be Batman"),e("close","There has got to be","A skip button around here somewhere"),e("close","You will beat it..","Eggs or batter maybe... but this level not likely."),e("good","Done and done!","You must have studied winning in college"),e("good","Another one bites the dust","Keep up the good work!"),e("good","Impressive","Your efforts are rewarded"),e("good","Are you a torch?","Because you are on fire!"),e("good","Crank it up",'Someone must have turned you to "eleven"'),e("good","Ahhh","You complete me"),e("good","You are more dedicated than...","A hobbit with a gold ring!"),e("good","Good job","That'll do, Player. That'll do"),e("good","Tears of joy","You make me so proud sometimes!"),e("great","New high score!","Practice does make perfect"),e("great","Living legend","Nobody will beat that score!"),e("great","Cat like reflexes","You must be a ninja!"),e("great","You are","King of the world!")},getRandomMessage(t){const e=this.messages[t];if(!e)return;const s=e.length,i=g.round(Math.random()*(s-1)),r=e[i];return r.type=t,r},getAll(){return this.options},removeAll(){let t=this.options,e=t.length;if(e)for(let s=0;s-1&&(t.remove(),e.splice(s,1))}};ye.setup();const ar=t=>{let e;if(t.scorePoints>t.highScorePoints&&t.scoreNumber>=t.minimum?e="great":t.scoreNumber>=t.minimum?e="good":t.scoreNumber>=t.minimum-4&&t.scoreNumber<=t.minimum-1?e="close":t.scoreNumber==0?e="awful":t.scoreNumber<=g.round(t.minimum*.25)&&(e="bad"),e)return nr(e)},nr=t=>ye.getRandomMessage(t);class be{constructor(e,s){this.timer=null,this.duration=e,this.callback=s}setupTimer(){this.timer=window.setTimeout(()=>this.callCallback(),this.duration)}start(){this.stop(),this.setupTimer()}stop(){window.clearTimeout(this.timer)}callCallback(){typeof this.callback=="function"&&this.callback()}}function lr(){const t=this.game.getCurrentLevel();this.data=t.data,this.data.nextLevel=t.passed||!w.isNextLevelLocked(),this.data.previousLevel=t.number>1}function or(){const t=this.game.getCurrentLevel();t.number{new sr({type:e.type,title:e.title,description:e.text}).start(this.panel)}).start()}function cr(){const t=this.game.getCurrentLevel(),{number:e,passed:s,highScorePoints:i,highScoreNumber:r,particles:a,scoreNumber:n,scorePoints:o,minimum:c,quantity:h}=t;return{number:e,passed:s,highScorePoints:i,highScoreNumber:r,particles:a,scoreNumber:n,scorePoints:o,minimum:c,quantity:h,nextLevel:!1,previousLevel:e>1}}const we=({game:t})=>new Q({game:t,beforeSetup:lr,afterSetup:or,setupStates:cr},[l({class:"level-summary-container overlay-panel floatDownZ"},[l({class:"panel-top-button-container"},[Y({class:"bttn circle bttn-home",href:"/"},[l({class:"content"})])]),b({class:"col data-container"},[l({class:"level-summary"},[l({class:"row"},[l({class:"level-number-container pullDown"},[l({class:"level-number title-text"},"[[number]]"),l({class:"level-label title-text"},"Level")]),l({id:"summaryLevelStatus",class:"level-status title-enhance",onSet:["passed",e=>e?"Congrats, You Passed":"Sorry, Try Again"]}),l({class:"destroyed-summary",onSet:["passed",{pass:!0,fail:!1}]},[l({class:"destroyed"},[l({class:"label title-text"},"Particle Total"),l({class:"value"},"[[quantity]]"),l({class:"label title-text"},"Destroyed"),l({class:"value"},"[[scoreNumber]]")])])]),l({class:"row"},[l({class:"score-container"},[l({class:"score-panel"},[l({class:"col"},[l({class:"data underline"},[l({class:"value title-text"},"[[minimum]]"),l({class:"label title-enhance"},"Minimum")])]),l({class:"col"},[l({class:"data circle level-score"},[l({class:"content"},[l({class:"value title-text"},"[[scorePoints]]"),l({class:"label title-enhance"},"Level Score")])])]),l({class:"col"},[l({class:"data high-score underline"},[l({class:"value title-text"},"[[highScorePoints]]"),l({class:"label title-enhance"},"Highest Score")])])])])]),l({class:"row summary-button-container"},[l({class:"summary-buttons"},[l({class:"col"},[b({class:"option-group",id:"previous_level"},[l({class:"bttn circle bttn-prev",onSet:["previousLevel",{hidden:!1}],click:()=>t.previousLevel()},[l({class:"content"})]),l({class:"label title-text"},"Previous")])]),l({class:"col"},[b({class:"option-group",id:"retry_level"},[l({class:"bttn circle bttn-retry",click:()=>t.retryLevel()},[l({class:"content"})]),l({class:"label title-text"},"Retry")])]),l({class:"col"},[b({class:"option-group",id:"next_level"},[l({class:"bttn circle bttn-next",onSet:["nextLevel",{hidden:!1}],click:()=>t.nextLevel()},[l({class:"content"})]),l({class:"label title-text"},"Next")])])])])])])])]);function hr(){this.game.stopStage()}const ur=({game:t})=>new Q({game:t,afterSetup:hr},[l({class:"control-sub-panel pause-container overlay-panel"},[l({class:"pause-panel floatDownZ"},[H({class:"play circle",click:()=>t.resume()},[l({class:"content"})])]),J({class:"options-container fadeIn"},[b({class:"option-group"},[Y({class:"bttn circle bttn-home",href:"/"},[l({class:"content"})]),l({class:"label title-text"},"Home")]),b({class:"option-group"},[Y({class:"bttn circle bttn-levels",href:"/levels"},[l({class:"content"})]),l({class:"label title-text"},"Levels")]),b({class:"option-group"},[l({class:"bttn circle bttn-retry",click:()=>t.retryLevel()},[l({class:"content"})]),l({class:"label title-text"},"Retry")])])])]);class dr{constructor(e,s){this.options=e,this.callBack=s,this.selection=null}get(e){return this.options[e]||!1}getSelectedIndex(){return typeof this.selectedIndex<"u"?this.selectedIndex:0}next(){let e=this.getSelectedIndex();const s=e0?--e:this.options.length-1;return this.select(s)}select(e){const s=this.get(e);return s!==!1&&(this.selection=s,this.selectedIndex=e,this.callBack&&this.callBack(s)),s}selectOption(e){const s=this.options.indexOf(e);return s>-1&&(e=this.select(s)),e}}class pr extends L{onCreated(){this.iterator=new dr(this.options,this.change.bind(this)),this.iterator.selectOption(this.data[this.dataProp])}render(){return l({class:"value-container"},[H({class:"value-button arrow prev",click:this.previous.bind(this)}),H({class:"value-button",click:this.next.bind(this)},"[["+this.dataProp+"]]"),H({class:"value-button arrow next",click:this.next.bind(this)})])}change(e){this.data.set(this.dataProp,e),this.data.store()}next(){this.iterator.next()}previous(){this.iterator.previous()}}class Ht extends L{render(){const e=this.getId("checkbox");return l({class:"data-toggle-panel"},[Ii({id:e,cache:"checkbox",class:"toggle",change:this.change.bind(this),checked:this.checked}),_({class:"toggle-bttn",htmlFor:e})])}isChecked(e){return this.checkbox.checked}change(){this.checked=this.isChecked(),this.callBack&&this.callBack(this.checked)}toggle(){const e=this.isChecked();this.checkbox.checked=!e}}class fr extends Q{}function mr(t){this.parent.nav&&this.parent.nav.moveToSelectedIndex(t)}function gr(t){this.parent.touch&&this.parent.touch.moveToSelectedIndex(t)}const vr=()=>new fr([J({class:"control-sub-panel settings-container overlay-panel open"},[b({class:"home-sub-panel settings-panel"},[l({class:"panel-top-button-container floatUpZBounce"},[Y({class:"bttn circle close",href:"/"},[l({class:"content"},[E(),E()])])]),new ge({cache:"nav",callBackFn:gr,items:["audio","video","about"]}),l({class:"main-step-container"},[new Dt({cache:"touch",callBackFn:mr,items:[l({class:"content settings-sub-panel audio-container"},[x({class:"title-text"},"Audio"),l({class:"row"},[_({class:"title"},"Music"),l({class:"value-container"},[new Ht({checked:S.music,callBack:t=>{S.music=Boolean(t),S.store()}})])]),l({class:"row"},[_({class:"title"},"Sound fx"),l({class:"value-container"},[new Ht({checked:S.audio,callBack:t=>{S.audio=Boolean(t),S.store()}})])])]),l({class:"content settings-sub-panel audio-container"},[x({class:"title-text"},"Video"),l({class:"row"},[_({class:"title"},"Graphics"),new pr({data:S,dataProp:"graphics",options:["low","medium","high"]})])]),l({class:"content settings-sub-panel about-container"},[x({class:"title-text"},"Credits"),l({class:"row"},[_({class:"title"},"Programming"),l({class:"value-container"},"Chris Durfee")]),l({class:"row"},[_({class:"title"},"Graphic Design"),l({class:"value-container"},"Chelsea Durfee")]),l({class:"row"},[_({class:"title"},"Music & Sound"),l({class:"value-container"},"Chris Durfee")])])]})])])])]);function yr(){window.setTimeout(()=>{this.panel.classList.remove("loading")},300)}const br=({game:t})=>new Q({afterSetup:yr},[b({class:"main-home-panel overlay-panel loading"},[l({class:"background background-stars"}),l({class:"panel-top-button-container"},[Y({class:"bttn circle settings",href:"/settings"},[l({class:"content"})])]),J({class:"home-base-panel"},[l({class:"row logo-container"},[l({class:"background background-mask"}),l({class:"game-name-container"},[T({src:"images/multisplode.svg"})])]),l({class:"row menu-container"},[b({class:"col main-menu-container clear"},[l({class:"game-menu-container"},[l({class:"main-nav-container"},[Ni([de({class:"clear"},[pe([H({class:"bttn main-play title-text",click:()=>t.startGame()},"Play")])])])])])])])])])]);class wr extends L{beforeSetup(){const e=this.game.getCurrentLevel();this.data=e.data,this.length=0,this.progress=0}render(){return l({class:"progress-bar",onSet:["scoreNumber",e=>this.update(e,this.data.minimum)],html:` + + + + `})}afterSetup(){window.setTimeout(()=>{const s=this.element=document.getElementById("progress-line"),i=this.length=s.getTotalLength();s.style.strokeDasharray=i+" "+i,this.changeStrokeOffset(i),window.setTimeout(()=>{this.reset()},150)},10)}modifyTransition(e){this.element.style.transition="stroke-dashoffset "+e+"ms linear"}update(e,s){let i=e/s*100/100;if(i=i<1?i.toFixed(2):1,i===1&&this.progress!==i||i!==this.progress){const r=this.length,a=r-r*i;this.changeStrokeOffset(a),this.progress=i}}changeStrokeOffset(e){!this.element||(this.element.style.strokeDashoffset=e)}reset(){const e=this.length;this.changeStrokeOffset(e);const s=150;this.modifyTransition(s)}beforeDestroy(){this.modifyTransition(0)}}const Pr=(t,e,s)=>{const i=t.type||"Shockwave";return l({class:"touch-icon circle "+i.toLowerCase(),onSet:[s,"selected",{inactive:!0}]})};class Sr extends L{beforeSetup(){const e=this.game.getCurrentLevel();this.level=e,this.level.setUpdateTouchCallBack(()=>this.select()),this.data=new it,this.reset()}render(){return b({class:"option-group level-touches"},[l({id:"levelTouches",cache:"levelTouces",class:"value touch-container title-text",for:["touches",Pr]}),l({class:"label title-text"},"Touches")])}setupTouches(){const e=this.level.devices,s=[];for(let i in e){const r=e[i];for(let a=0;a=0){const i=this.data.touches[this.current];i.selected===!1&&(e=i,i.selected=!0,this.current--)}return e}reset(){this.limit=0,this.data.set("touches",this.setupTouches()),this.current=this.limit-1}}function kr(){const t=this.game.getCurrentLevel();this.data=t.data}function xr(){const t=this.game.getCurrentLevel();this.panel.classList.add(t.levelClass)}function Cr(){this.game.stopStage()}const Lr=({game:t})=>new Q({game:t,beforeSetup:kr,afterSetup:xr,beforeDestroy:Cr},[b({class:"play-container"},[l({class:"play-panel"},[l({class:"fade-layer"},[Fi({id:"portal",cache:"portal",class:"main-canvas",onCreated(e){t.setCanvas(e);const s=1;window.setTimeout(()=>{t.setupStage(),t.startStage()},s)}})])]),l({class:"play-level-container"},[l({class:"level-guide fadeIn"},[J({class:"options-container"},[l({class:"top-container"},[b({class:"option-group"},[Y({class:"bttn circle bttn-pause",href:"/play/paused"},[l({class:"content"},[E(),E()])])]),b({class:"option-group level-number"},[l({id:"levelNumber",class:"value title-text"},"[[number]]"),l({class:"label title-text"},"Level")])]),l({class:"lower-container"},[b({class:"option-group level-progress"},[l({id:"levelProgress",class:"value progress title-text"},[l({id:"levelMinimum",class:"progress-number value title-text"},"[[remaining]]"),new wr({game:t})]),l({class:"label title-text"},"Progress")]),new Sr({cache:"touches",game:t})])])]),l({id:"fps",class:"fps"})])])]),dt=(t,e,s)=>({uri:t,component:e,title:s}),Ar=t=>[dt("/play/:state?",Lr(t),"Play"),dt("/level-summary",we(t),"Level Summary"),dt("/:overlay?",br(t),"Home")],Tr=f((t,e)=>Ri({class:"main-game-container",...t},e)),Er=f((t,e)=>({class:"main-container",...t,children:e})),Br=t=>Tr([Er({cache:"mainBody",switch:Ar(t)}),l({class:"overlay-container",route:[{uri:"/settings",component:vr()},{uri:"/levels",component:er(t)},{uri:"/play/paused",component:ur(t)},{uri:"/play/level-summary",component:we(t)}]}),new Xi({cache:"soundFx",class:"sound",fileName:"play-loop.mp3"})]),ot={appName:"Multisplode",size:{width:774,height:493},router:{baseUrl:"/multisplode/",title:"Multisplode"}},Dr=t=>new q({class:"startup-panel",...t},[l({class:"content"},[T({src:"images/four-more.svg",type:"image/svg+xml"}),x({class:"title-enhance"},[$("Four Is More")]),B("You can now use four explosions at anytime to maximize the destruction.")])]),Or=t=>new q({class:"startup-panel",...t},[l({class:"content"},[T({src:"images/three-more.svg",type:"image/svg+xml"}),x({class:"title-enhance"},[$("Three Is More Fun")]),B("You can now use three explosions at anytime to maximize the destruction.")])]),jr=t=>new q({class:"startup-panel",...t},[l({class:"content"},[T({src:"images/double-trouble.svg",type:"image/svg+xml"}),x({class:"title-enhance"},[$("Double The Trouble")]),B("You can now use two explosions at anytime to maximize the destruction.")])]),Ir=t=>new q({class:"startup-panel",...t},[l({class:"content"},[T({src:"images/gravity-field.svg",type:"image/svg+xml"}),l({class:"title-enhance"},"Gravity Doesn't Suck"),B("You can now use gravity to your advantage. Gravity fields attract particles and lock them into orbit until the gravity field becomes too weak and the particles are released.")])]),zr=t=>new q({class:"startup-panel",...t},[l({class:"content"},[T({src:"images/complete-challenge.svg",type:"image/svg+xml"}),x({class:"title-enhance"},[$("Pulse Particles")]),B("The pulse particle is pure white and packs a punch. It causes 1.5X destruction and double the points.")])]);class Nr extends q{render(){const e=s=>{s.target===this.panel&&this.close()};return fe({class:this.class,click:e,children:[new Dt({cache:"touch",items:this.children})]})}}const Rr=t=>new Nr({class:"startup-panel",...t},[l({class:"content"},[T({src:"images/destroy-particles.svg",type:"image/svg+xml"}),x({class:"title-enhance"},[$("Destroy The Particles")]),B("Touch the screen to create an explosion. Particles that hit explosions will also explode creating chains.")]),l({class:"content"},[T({src:"images/complete-challenge.svg",type:"image/svg+xml"}),x({class:"title-enhance"},[$("Complete The Challenge")]),B("Beat the level minimum to continue. As the levels go on the explosions will get smaller increasing the difficulty.")]),l({class:"content"},[T({src:"images/unlock-explosions.svg",type:"image/svg+xml"}),x({class:"title-enhance"},[$("Unlock Multiple Explosions")]),B("As the levels progress they will require more than just one explosion to complete the challenge.")])]),Mr={StartupPrompt:Rr,AddTwoPrompt:jr,AddThreePrompt:Or,AddFourPrompt:Dr,PulseParticlePrompt:zr,GravityFieldPrompt:Ir},Fr=t=>{try{const e=Mr[t.type];return e(t)}catch(e){console.log(e)}return null},bt={prompts:{},game:null,setGame(t){this.game=t},setup(){const t=()=>this.game.stopDraw(),e=()=>this.game.startDraw();this.add({type:"StartupPrompt",activateCallBack:t,deactivateCallBack:e}),this.add({type:"AddTwoPrompt",activateCallBack:t,deactivateCallBack:e}),this.add({type:"AddThreePrompt",activateCallBack:t,deactivateCallBack:e}),this.add({type:"AddFourPrompt",activateCallBack:t,deactivateCallBack:e}),this.add({type:"PulseParticlePrompt",activateCallBack:t,deactivateCallBack:e}),this.add({type:"GravityFieldPrompt",activateCallBack:t,deactivateCallBack:e})},getPrompt(t){return this.prompts[t]||null},showPrompt(t){const e=this.getPrompt(t);e&&e.open()},reset(){this.prompts=[]},getAll(){return this.prompts},add(t){const e=Fr(t);return e?(this.prompts[t.type]=e,e):!1},remove(t){const e=this.prompts.indexOf(t);e>-1&&this.prompts.splice(e,1)}};class Pe{constructor(e,s,i,r,a,n,o,c,h){p(this,"isAtLimit",!1);p(this,"timerUi",null);p(this,"timerUiDelay",150);this.number=e,this.touch=0,this.touchLimit=0,this.devices={},this.setupDevices(s),this.minimum=i,this.afterTouch=r,this.afterTouchReady="no",this.particles=null,this.setupParticleCount(a),this.waveScale=n,this.waveMaxSize=o,this.remaining=this.minimum,this.passed=!1,this.currentNumber=0,this.scoreNumber=0,this.scorePoints=0,this.highScorePoints=0,this.highScoreNumber=0,this.updateTouchCallBack=null,this.promptId=c,this.levelClass=h,this.bestTime="",this.locked=!0,this.setData()}setData(){this.data=new it,this.setDataValues(),this.data.setKey("level-"+this.number),this.data.resume(),this.data.passed=!1,this.data.remaining=this.minimum}setDataValues(){this.data.set({number:this.number,locked:this.locked,minimum:this.minimum,remaining:this.minimum,scoreNumber:this.scoreNumber,quantity:this.quantity,scorePoints:this.scorePoints,highScorePoints:this.highScorePoints,highScoreNumber:this.highScoreNumber,bestTime:this.bestTime,devices:this.devices,passed:!1})}setup(){this.updateFromData(),this.reset(),this.number===1&&this.unlock()}setupDevices(e){if(typeof e!="object"){this.devices={ShockWave:e},this.touchLimit=e;return}this.touchLimit=0;for(let s=0,i=e.length;sthis.highScoreNumber&&(this.highScoreNumber=this.scoreNumber,this.data.highScoreNumber=this.scoreNumber),this.scorePoints>this.highScorePoints&&(this.highScorePoints=this.scorePoints,this.data.highScorePoints=this.scorePoints),this.saveToData()}updateScore(e,s){this.updatePoints(s),this.updateNumber(e),this.updateUiByTimer()}updateUiByTimer(){this.timerUi===null&&(this.timerUi=window.setTimeout(()=>{this.updateRemaining(),this.updatePlayUi(),this.updateHighScore(),this.timerUi=null},this.timerUiDelay))}updateRemaining(){let e=this.minimum-this.scoreNumber;e!==this.currentNumber&&(this.currentNumber=e,e=e>0?e:0,this.data.remaining=e,e===0&&(this.passed=!0,this.data.passed=!0))}updatePoints(e){this.scorePoints+=e}updateNumber(e){this.scoreNumber+=e}updatePlayUi(){this.data.set({scoreNumber:this.scoreNumber,scorePoints:this.scorePoints})}updateBestTime(e){this.bestTime=e,this.data.bestTime=e,this.data.store()}updateFromData(){const e=this.data;e&&(this.locked=e.locked,this.highScorePoints=e.highScorePoints,this.highScoreNumber=e.highScoreNumber,this.bestTime=e.bestTime)}saveToData(){const e={locked:this.locked,highScorePoints:this.highScorePoints,highScoreNumber:this.highScoreNumber};this.data.set(e),this.data.store()}unlock(){this.locked=!1,this.data.locked=!1,this.saveToData()}}class _r{constructor(e){p(this,"controller",null);p(this,"levels",[[1,28,40,40,1,65,"startup-panel","first"]]);this.label="",this.game=e}setupLevels(){let e="";const s=[],i=this.levels;for(let r=0,a=i.length;r({x:g.round(t),y:g.round(e)});class Se{constructor(e,s,i,r){this.position=Wr(e,s),this.size=0,this.fillColor=i,this.audio="sound/collisions/collision-1a.mp3",this.multiplier=r||1,this.type="device",this.explosive=!1,this.cachePath()}checkToRemove(){return!1}cachePath(){const e=this.maxSize,s=this.lineSize=e/10,i=this.totalSize=e*2+s*2;this.half=this.totalSize/2;const r=a=>{const n=i/2;a.beginPath(),a.arc(n,n,e,0,N,!0),a.globalAlpha=.3,a.fillStyle=this.fillColor,a.fill(),a.globalAlpha=.5,a.beginPath(),a.arc(n,n,e*.3,0,N,!0),a.fillStyle=this.fillColor,a.fill(),a.globalAlpha=.7,a.beginPath(),a.arc(n,n,e*.6,0,N,!0),a.fillStyle=this.fillColor,a.fill(),a.globalAlpha=1};this.cache=G.add(r,i,i)}draw(e){const s=this.position.x,i=this.position.y,r=this.size/this.maxSize;e.save(),e.translate(s,i),e.scale(r,r),e.drawImage(this.cache,-this.half,-this.half),e.restore()}}class Ur extends Se{constructor(e,s,i,r){super(e,s,i,r),this.audio="sound/collisions/collision-1a.mp3",this.gravity=1*this.multiplier,this.startTime=null,this.time=8e3,this.delta=0,this.maxSize=0,this.totalSize=0,this.lineSize=0,this.type="gravityField",this.getMaxSize(),this.cachePath()}checkToRemove(){const e=this.getStartTime();return this.delta=new Date-e,this.delta>=this.time}getStartTime(){return this.startTime=this.startTime||new Date,this.startTime}updateParticlePosition(e){let s=this.position,i=e.position,a=g.distance(i,s)-this.gravity-this.gravity;a=a>this.orbitLimit?a:this.orbitLimit;const n=g.updateOrbitAngle(this.getOrbitAngle(e),e.speed/this.size);s=g.getOrbitPosition(s.x,s.y,n,a),i.x=s.x,i.y=s.y}getOrbitAngle(e){const s=this.position,i=e.position,r=i.x-s.x,a=i.y-s.y;return Math.atan2(a,r)}orbitParticle(e){this.updateParticlePosition(e)}getMaxSize(){const e=w.currentLevel;e&&(this.maxSize=e.waveMaxSize*this.multiplier,this.size=this.maxSize,this.orbitLimit=this.maxSize-this.maxSize/3)}cachePath(){const e=this.maxSize,s=this.lineSize=2,i=this.totalSize=e*2+s*2;this.half=this.totalSize/2;const r=a=>{const n=i/2;a.beginPath(),a.arc(n,n,e,0,N,!0),a.globalAlpha=.3,a.fillStyle=this.fillColor,a.fill(),a.lineWidth=2,a.strokeStyle="#FFF",a.stroke(),a.globalAlpha=.7,a.beginPath(),a.arc(n,n,e*.2,0,N,!0),a.fillStyle=this.fillColor,a.fill(),a.globalAlpha=1};this.cache=G.add(r,i,i)}draw(e){const s=1-this.delta/this.time;e.save(),e.translate(this.position.x,this.position.y),e.globalAlpha=s,e.drawImage(this.cache,-this.half,-this.half),e.restore()}}class Hr extends Se{constructor(s,i,r,a){super(s,i,r,a);p(this,"waveScale",0);p(this,"maxSize",0);p(this,"totalSize",0);p(this,"lineSize",0);this.size=0,this.audio="sound/collisions/collision-1a.mp3",this.type="shockWave",this.explosive=!0,this.getWaveScale(),this.cachePath()}updateSize(){this.size+=this.waveScale}checkToRemove(){return this.size>=this.maxSize}getWaveScale(){let s=w.currentLevel;s&&(this.waveScale=s.waveScale,this.maxSize=s.waveMaxSize*this.multiplier)}cachePath(){let s=this.maxSize,i=this.lineSize=s/10,r=this.totalSize=s*2+i*2;this.half=this.totalSize/2;const a=n=>{let o=r/2;n.beginPath(),n.arc(o,o,s,0,N,!0),n.globalAlpha=.3,n.fillStyle=this.fillColor,n.fill(),n.globalAlpha=.5,n.beginPath(),n.arc(o,o,s*.3,0,N,!0),n.fillStyle=this.fillColor,n.fill(),n.globalAlpha=.7,n.beginPath(),n.arc(o,o,s*.6,0,N,!0),n.fillStyle=this.fillColor,n.fill(),n.globalAlpha=1};this.cache=G.add(a,r,r)}draw(s){this.updateSize();const i=this.size/this.maxSize;s.save(),s.translate(this.position.x,this.position.y),s.scale(i,i),s.drawImage(this.cache,-this.half,-this.half),s.restore()}}const $t={ShockWave:Hr,GravityField:Ur},V={devices:[],removed:[],reset(){this.explosives=0,this.devices=[],this.removed=[]},explosives:0,getExplosivesCount(){return this.explosives},getAll(){return this.devices},add(t,e,s,i,r="ShockWave"){const a=$t[r]||$t.ShockWave,n=new a(t,e,s,i);return n.explosive===!0&&this.explosives++,this.devices.push(n),n},remove(t){const e=this.devices,s=e.indexOf(t);s>-1&&(e.splice(s,1),this.removed.push(t))},draw(t){t.globalCompositeOperation="lighter";const e=this.devices;for(let s=e.length-1;s>=0;s--){let i=e[s];i.checkToRemove()===!0?(i.explosive===!0&&this.explosives--,this.remove(i)):i.draw(t)}t.globalCompositeOperation=0}},$r=t=>{let e=g.floor(Math.random()*7),s="";switch(e){case 0:s="#F9322D";break;case 1:s="#FF397F";break;case 2:s="#D541B7";break;case 3:s="#FF8931";break;case 4:s="#F9F95D";break;case 5:s="#21F8B6";break;case 6:s="#26CFCE";break;case 7:s="#3153CB";break}return s};let Xr=0;const F=g.randomFromTo,Yr=1e3/60;class ke{constructor(e){this.type="particle",this.value=10,this.multiplier=1,this.setup(e)}init(){this.number=++Xr,this.id=this.number}getDefaultSettings(){const e=ot.size,s=.005,i=.008,r=e.width*.12/Yr,a=F(e.width*s,e.width*i),n=a*2;return{size:a,position:{x:F(a+3,e.width-n-3),y:F(a+3,e.height-n-3)},fillColor:$r(),stroke:F(3,5),direction:F(-10,10),angle:F(0,360),speed:F(r/1.8,r)}}setup(e,s){s=s!==!1;let i=this.getDefaultSettings();e&&typeof e=="object"&&(i=Object.assign(i,e)),this.size=i.size,this.fullSize=this.size*2,this.position=i.position,this.fillColor=i.fillColor,this.stroke=i.stroke,this.direction=i.direction,this.speed=i.speed,this.angle=i.angle,s&&this.cachePath()}move(){this.updateByAngle()}updateByAngle(){this.updatePosition()}updateAngle(){const e=g.updateOrbitAngle(this.angle,this.speed);this.angle=e}checkWall(e){const s=this.position;(s.x+this.size>=e.width||s.x<=this.size)&&(this.angle=180-this.angle),(s.y+this.size>=e.height||s.y<=this.size)&&(this.angle=360-this.angle)}updatePosition(){const e=ot.size,s=g.getPositionByAngle(this.angle,this.speed),i=g.round,r=this.position;r.x=i(r.x+s.x),r.y=i(r.y+s.y),this.checkWall(e)}cachePath(){const e=Math.ceil(this.size*2),s=i=>{i.beginPath(),i.arc(e/2,e/2,this.size,0,st,!0),i.fillStyle=this.fillColor,i.fill()};this.cache=G.add(s,e,e)}hasCollided(e){const s=this.position;let i=s.x-e.position.x,r=s.y-e.position.y,a=e.size+this.size;return i*i+r*r<=a*a}draw(e){e.drawImage(this.cache,this.position.x-this.size,this.position.y-this.size)}}class qr extends ke{constructor(e){super(e),this.type="pulse",this.value=20,this.multiplier=1.5,e||(e={}),e.size=8;const s="#FFF";e.fillColor=s,this.setup(e)}cachePath(){const e=this.size,s=e*2,i=r=>{const a=s/2;r.beginPath(),r.arc(a,a,e,0,st,!0),r.fillStyle="rgba(255,255,255,.4)",r.fill(),r.beginPath(),r.arc(a,a,e/2,0,st,!0),r.fillStyle=this.fillColor,r.fill()};this.cache=G.add(i,s,s)}}const Gr={Particle:ke,PulseParticle:qr},I={particles:[],removed:[],reset(){this.particles=[],this.removed=[]},getAll(){return this.particles},add(t,e){t=t||"Particle";const s=Gr[t],i=new s(e);return this.particles.push(i),i},remove(t){const e=this.particles.indexOf(t);e<0||(this.particles.splice(e,1),this.removed.push(t))}},pt={},Vr=(t,e)=>({x:t,y:e});let Kr=0;class Jr{constructor(e,s,i){this.number=++Kr,this.id=this.number,this.position=Vr(e,s),this.size=20,this.fillColor="#FFFFFF",this.opacity=1,this.text="+"+i,this.value=i,this.distance=0,this.maxDistance=3,this.speed=.06,this.cachePath()}move(){this.distance+=this.speed,this.position.y-=this.distance}changeAlpha(){this.opacity-=.05}cachePath(){if(pt[this.value]){this.cache=pt[this.value];return}const e=40,s=60,i=r=>{r.font=this.size+"px titillium",r.fillStyle=this.fillColor,r.fillText(this.text,s/2,e/2)};this.cache=pt[this.value]=G.add(i,s,e)}draw(e){const s=g.round(this.position.x),i=g.round(this.position.y),r=1-this.distance/this.maxDistance;e.save(),e.globalAlpha=r,e.drawImage(this.cache,s,i),e.restore()}}const wt={gamePoints:[],removed:[],reset(){this.gamePoints=[],this.removed=[]},getAll(){return this.gamePoints},add(t,e,s){const i=new Jr(t,e,s);return this.gamePoints.push(i),i},remove(t){const e=this.gamePoints,s=e.indexOf(t);s>-1&&(e.splice(s,1),this.removed[this.removed.length]=t)},draw(t){t.beginPath();const e=this.gamePoints;for(let s=e.length-1;s>=0;s--){let i=e[s];g.round(i.distance)>=i.maxDistance?this.remove(i):(i.move(),i.draw(t))}t.closePath()}},Qr=.001;class Zr{constructor(e,s,i,r,a,n){this.position={x:e,y:s},this.angle=i,this.size=g.randomFromTo(4,10),this.maxSize=this.size,this.fillColor=r,this.stroke=r,this.type="",this.speed=g.randomFromTo(1,5),this.cachePath()}updatePosition(){const e=g.getPositionByAngle(this.angle,this.speed),s=this.position;s.x+=e.x,s.y+=e.y,this.updateSize()}updateSize(){this.size-=.5}cachePath(){const e=this.totalSize=this.size*2;this.half=this.totalSize/2;const s=i=>{const r=e/2;i.globalAlpha=.7,i.beginPath(),i.arc(r,r,e,0,st,!0),i.fillStyle=this.fillColor,i.fill(),i.globalAlpha=1};this.cache=G.add(s,e,e)}draw(e){if(this.updatePosition(),this.size{let t=20;switch(S.graphics){case"low":t=12;break;case"high":t=30;break}return t};class ea{constructor(e,s,i){p(this,"radiusRate",null);this.particleNumber=ta(),this.x=e,this.y=s,this.color=i,this.radius=0,this.maxRadius=30,this.speed=20,this.particles=[],this.removed=[],this.setupParticles()}setupParticles(){const e=this.particleNumber,s=360/e;for(let i=0;i<=e;i++){let r=s*i;this.addParticle(r)}this.radiusRate=this.maxRadius/this.speed}addParticle(e){const s=new Zr(this.x,this.y,e,this.color,this.maxRadius,this.speed);this.particles.push(s)}checkToRemove(){return this.radius>=this.maxRadius}updateRadius(){let e=this.radius;e+=this.radiusRate,e=g.round(e)}draw(e){this.updateRadius();const s=this.particles;for(let i=s.length-1;i>=0;i--){let r=s[i];if(r.draw(e)===!1){s.splice(i,1);let a=this.removed;a[a.length]=r}}}}const Pt={sparks:[],removed:[],maxRadius:5,speed:10,reset(){this.sparks=[],this.removed=[]},add(t,e,s){const i=new ea(t,e,s);this.sparks.push(i)},remove(t){const e=this.sparks,s=e.indexOf(t);if(s>-1){e.splice(s,1);let i=this.removed;i[i.length]=t}},updateRadius(t){t.checkToRemove()==!1?t.radius+=t.radiusRate:this.remove(t)},draw(t){const e=this.sparks;for(let s=e.length-1;s>=0;s--){let i=e[s];i&&(i.draw(t),this.updateRadius(i))}}},sa={activeSounds:[],reset(){this.activeSounds=[]},getAll(){return this.activeSounds},add(t,e){if(S.audio===!0&&this.check(e)===!1){const s=new Audio(t),i={audio:s,type:e};return s.volume=.4,s.play(),this.activeSounds.push(i),i}return!1},check(t){return!1},remove(t){const e=this.activeSounds,s=e.indexOf(t);s>-1&&e.splice(s,1)}},ia={addAnimation(t,e,s=0){if(!t)return;const i=t.classList;i.add(e),window.setTimeout(()=>i.remove(e),s)}};class ra{constructor(){p(this,"level",null);p(this,"blowEmDelay",200);p(this,"blowEm",!1);p(this,"blowEmExtend",380);p(this,"playContainer",null);p(this,"originalDelay",1e3);p(this,"delay",1e3);p(this,"startDelay",null)}setLevel(e){this.reset(),this.setupParticles();const s=this.level;if(me.set("lastLevel",s),e!==!0){const i=s.promptId;i&&this.showPrompt(i)}}showPrompt(e){new be(50,()=>bt.showPrompt(e)).start()}changeLevel(e){this.level=e}interact(e,s){const i=this.level;if(i&&i.touch=e.minimum&&(this.destroyAllParticles(),this.delay+=this.blowEmExtend,this.playContainer===null&&(this.playContainer=document.querySelector(".play-container")),ia.addAnimation(this.playContainer,"shakePanel",600)),this.blowEm=!0}setupCompleteDelay(){return this.startDelay=this.startDelay||new Date,this.startDelay}checkLevelComplete(e){if(this.level.isAtLimit===!0&&V.getExplosivesCount()<1||e<1){const s=this.setupCompleteDelay(),i=new Date-s;if(this.blowEm===!1&&i>=this.blowEmDelay)this.checkToBlowEm();else if(i>=this.delay)return I.reset(),!0}return!1}isComplete(e){return this.checkLevelComplete(e)}destroyAllParticles(){const e=I.getAll(),s=e.length;if(e)for(let i=s-1;i>=0;i--){const r=e[i];I.remove(r),this.createDevice(r.position.x,r.position.y,r.fillColor)}}}class aa extends ra{draw(e,s){V.draw(e),Pt.draw(e);const i=I.getAll();let r=i.length;if(r>0){let a=r-1;const n=V.getAll(),o=n.length,c=o-1;do{const h=i[a];let d=!1,m=c;if(o>0)do{const D=n[m];if(h.hasCollided(D)===!0){let O;switch(d=!0,D.type){case"gravityField":D.orbitParticle(h);break;default:r--,I.remove(h),O=h.position,this.createDevice(O.x,O.y,h.fillColor,h.multiplier),this.createPoints(O.x-55,O.y-35,h.value)}break}}while(m--);d===!1&&h.move(),h.draw(e)}while(a--)}return S.graphics==="high"&&wt.draw(e),this.isComplete(r)}}class na extends _r{constructor(){super(...arguments);p(this,"controller",new aa);p(this,"levels",[[1,28,40,40,1,65,"StartupPrompt","first"],[1,40,50,50,1,62,!1],[1,45,50,50,1,67,!1],[1,53,57,57,1,60,!1],[1,45,50,{Particle:49,PulseParticle:1},1,61,"PulseParticlePrompt"],[1,32,40,{Particle:39,PulseParticle:1},1,60,!1],[[1,1],29,35,{Particle:34,PulseParticle:1},1,62,"GravityFieldPrompt"],[[1,1],32,39,{Particle:38,PulseParticle:1},1,61,!1],[[1,1],28,35,{Particle:34,PulseParticle:1},1,60,!1],[[1,1],55,60,{Particle:59,PulseParticle:1},1,56,!1],[[2,1],72,80,{Particle:79,PulseParticle:1},1,56,"AddTwoPrompt","second"],[[2,1],63,70,{Particle:69,PulseParticle:1},1,56,!1],[[2,1],64,70,{Particle:69,PulseParticle:1},1,54,!1],[[1,2],67,72,{Particle:71,PulseParticle:1},1,53,!1],[[2,1],52,60,{Particle:59,PulseParticle:1},1,52,!1],[[2,1],60,65,{Particle:63,PulseParticle:2},1,52,!1],[[1,2],48,56,{Particle:54,PulseParticle:3},1,50,!1],[[2,1],46,52,{Particle:50,PulseParticle:2},1,50,!1],[[1,2],50,55,{Particle:52,PulseParticle:3},1,50,!1],[[2,1],30,48,{Particle:45,PulseParticle:3},1,48,!1],[[3,1],40,50,{Particle:48,PulseParticle:2},1,50,"AddThreePrompt","third"],[[2,2],40,55,{Particle:53,PulseParticle:2},1,49,!1],[[3,1],58,63,{Particle:61,PulseParticle:2},1,49,!1],[[1,3],62,68,{Particle:66,PulseParticle:2},1,49,!1],[[2,2],65,70,{Particle:68,PulseParticle:2},1,47,!1],[[3,1],25,38,{Particle:36,PulseParticle:2},1,47,!1],[[3,1],40,48,{Particle:46,PulseParticle:2},1,47,!1],[[2,2],32,45,{Particle:43,PulseParticle:2},1,45,!1],[[3,1],50,55,{Particle:53,PulseParticle:2},1,45,!1],[[4,1],52,60,{Particle:58,PulseParticle:2},1,45,"AddFourPrompt"],[[3,2],52,65,{Particle:63,PulseParticle:2},1,42,!1],[[3,2],60,68,{Particle:66,PulseParticle:2},1,42,!1],[[4,1],70,79,{Particle:77,PulseParticle:2},1,42,!1],[[4,1],56,64,{Particle:62,PulseParticle:2},1,44,!1],[[2,3],48,55,{Particle:53,PulseParticle:2},1,44,!1],[[4,1],46,54,{Particle:52,PulseParticle:2},1,44,!1],[[3,2],62,68,{Particle:66,PulseParticle:2},1,42,!1],[[3,2],46,50,{Particle:48,PulseParticle:2},1,42,!1],[[3,2],50,55,{Particle:53,PulseParticle:2},1,42,!1],[[4,1],44,48,{Particle:46,PulseParticle:2},1,40,!1]])}createLevel(s,i,r){const a=new Pe(s,i[0],i[1],i[2],i[3],i[4],i[5],i[6],r);return a.setup(),a}}class la{constructor(){this.canvas=null,this.ctx=null}setup(){this.createBufferCanvas()}createBufferCanvas(){this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),this.resize()}resize(e){const s=this.canvas;s.width=e.width,s.height=e.height}}const oa=1e3,xe=60;window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,oa/xe)};const ca=window.requestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame||function(t){window.clearTimeout(t)};const Xt=(t,e)=>({width:t,height:e}),ha=(t,e,s)=>({x:t,y:e,status:s});class ua{constructor(e,s,i){p(this,"canvasBoundBox",null);p(this,"scaleRatio",1);this.game=i,this.targetSize=Xt(e,s),this.size=Xt(0,0),this.fps=xe,this.canvas=null,this.context=null,this.levelController=null,this.mouse=ha(0,0,"up"),this.animationId=!1,this.buffer=null}setup(){this.drawBind=this.draw.bind(this),this.setupEvents()}setCanvas(e){this.canvas=e,this.context=e.getContext("2d")}setupEvents(){this.setupMouse(),this.resize(),window.addEventListener("resize",this.resize.bind(this),!1);const e=this.mouseDown.bind(this),s=this.canvas;this.addEvent=()=>{s.addEventListener("mousedown",e,!1),s.addEventListener("touchstart",e,!1)},this.removeEvent=()=>{s.removeEventListener("mousedown",e,!1),s.removeEventListener("touchstart",e,!1)}}setupMouse(){const e=document,s=this.canvas,i=this.mousePosition.bind(this),r=this.mouseUp.bind(this);s.addEventListener("mousemove",i),e.addEventListener("mouseup",r),s.addEventListener("touchmove",i),e.addEventListener("touchend",r)}interact(e,s){this.levelController.interact(e,s)}getInteractPositions(e){const s=this.scaleRatio,i=this.canvasBoundBox,r=(o,c)=>({x:parseInt((o-i.left)*s),y:parseInt((c-i.top)*s)}),a=[],n=e.touches;if(n&&n.length){const o=n[n.length-1];a.push(r(o.pageX,o.pageY))}else{let o,c;o=e.x||e.clientX,c=e.y||e.clientY,a.push(r(o,c))}return a}getEventPosition(e){let s,i;const r=e.touches;if(r&&r.length){const d=r[0];s=d.pageX,i=d.pageY}else s=e.x||e.clientX,i=e.y||e.clientY;const a=this.scaleRatio,n=this.canvasBoundBox,o=parseInt((s-n.left)*a),c=parseInt((i-n.top)*a);let h=this.mouse;h.x=o,h.y=c}mousePosition(e){this.getEventPosition(e)}mouseDown(e){e.preventDefault(),e.stopPropagation();const s=this.getInteractPositions(e);for(let i=0,r=s.length;ic?h:c,e.height=d}return e}resize(){const e=this.getContainerSize();if(e.width>0){const s=this.canvas,i=this.targetSize;s.width=i.width,s.height=i.height,this.size={width:s.width,height:s.height},this.scale(e,s),this.canvasBoundBox=s.getBoundingClientRect()}}scale(e,s){const i=s.height,r=s.width,a=e.width,n=e.height,o=a/r,c=n/i,h=Math.min(o,c);s.style.width=r*h+"px",s.style.height=i*h+"px",this.scaleRatio=this.size.width/parseInt(s.style.width)}draw(){const e=this.context,s=this.size;e.clearRect(0,0,s.width,s.height),this.levelController.draw(e,this)===!0?(this.stopDraw(),this.game.levelSummary()):this.animationId=ca(this.drawBind)}renderFromBuffer(e,s,i){const r=this.context;r.clearRect(0,0,e,s),r.drawImage(i.canvas,0,0)}startDraw(){typeof this.animationId<"u"&&(this.stopDraw(),this.draw())}stopDraw(){window.cancelAnimationFrame(this.animationId),this.animationId=null}setupBuffer(){this.buffer=new la,this.buffer.setup()}}const da=()=>{!screen||!screen.orientation||typeof screen.orientation.lock!="function"||screen.orientation.lock("landscape").then(()=>{console.log("Orientation locked successfully.")}).catch(t=>{console.error(`Failed to lock orientation: ${t.message}`)})};class pa{constructor(e,s,i){this.stage=new ua(e,s,this),this.app=i,w.setGame(this),bt.setGame(this),bt.setup()}getCurrentLevel(){return w.currentLevel}setCanvas(e){this.stage.setCanvas(e)}setup(){this.setupLevels()}setupStage(){this.stage.setup()}setupLevelPacks(){[new na(this)].forEach(s=>{w.addLevelPack(s)})}setStageLevelController(e){this.stage.levelController=e}setupLevels(){this.setupLevelPacks(),w.setup()}startGame(){da(),w.selectPrimaryLevel(),this.app.navigate("/play")}play(){this.app.navigate("/"),this.app.navigate("/play"),S.song="play-loop.mp3",this.startStage()}resume(){this.app.navigate("/play"),this.startStage()}pause(){this.stopStage()}retryLevel(){w.retryLevel(),this.play()}selectLevel(e){w.selectLevel(e),this.play()}nextLevel(){w.selectNextLevel(),this.play()}previousLevel(){w.selectPreviousLevel(),this.play()}resetCurrentLevel(){this.retryLevel()}levelSummary(){this.stopStage(),S.song="summary-slow-loop.mp3",this.app.navigate("/play/level-summary")}startDraw(){this.stage.startDraw()}stopDraw(){this.stage.stopDraw()}startStage(){const e=this.stage;e.addEvent(),e.startDraw()}stopStage(){const e=this.stage;e.removeEvent(),e.stopDraw()}}class fa{constructor(){p(this,"router",null);p(this,"appShell",null);this.setupOrientationPrompt(),this.setupRouter(),this.setupAppShell(),this.setupService()}setupService(){const e=window.location.protocol.replace(":","");if(!("serviceWorker"in navigator)||e==="http")return!1;navigator.serviceWorker.register("/sw.js",{scope:"/"}).then(i=>{})}setupRouter(){const{baseUrl:e,title:s}=ot.router,i=this.router=R.router;i.setup(e,s),i.navigate("/")}navigate(e,s,i){this.router.navigate(e,s,i)}setupGame(){const e=ot.size,s=new pa(e.width,e.height,this);return s.setup(),s}setupAppShell(){const e=Br({game:this.setupGame()});A.render(e,document.body)}setupOrientationPrompt(){const e=Ui();window.matchMedia("(orientation: portrait)").matches&&e.open(),window.matchMedia("(orientation: portrait)").addEventListener("change",s=>{if(s.matches){e.open();return}e.close()})}}new fa; diff --git a/index.html b/index.html index f1a3c9b..5dd60b8 100644 --- a/index.html +++ b/index.html @@ -32,7 +32,7 @@ - +