UNPKG

@ion-phaser/core

Version:

A web component to integrate Phaser Framework with Angular, React, Vue, etc

1 lines 4.85 kB
let e=!1;const t="undefined"!=typeof window?window:{},n=t.document||{head:{}},s={t:0,o:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,s)=>e.addEventListener(t,n,s),rel:(e,t,n,s)=>e.removeEventListener(t,n,s),ce:(e,t)=>new CustomEvent(e,t)},c=e=>Promise.resolve(e),o=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),r=new WeakMap,i=e=>"sc-"+e.i,a=e=>k(e).l,l=(e,t)=>{t&&!e.u&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.u=t)))},f=(e,t)=>{if(e.t|=16,!(4&e.t))return l(e,e.h),q((()=>u(e,t)));e.t|=512},u=(e,t)=>{const n=e.m;return w(void 0,(()=>d(e,n,t)))},d=async(e,t,s)=>{const c=e.l,o=c["s-rc"];s&&(e=>{const t=e.p;((e,t)=>{let s=i(t),c=E.get(s);if(e=11===e.nodeType?e:n,c)if("string"==typeof c){let t,o=r.get(e=e.head||e);o||r.set(e,o=new Set),o.has(s)||(t=n.createElement("style"),t.innerHTML=c,e.insertBefore(t,e.querySelector("link")),o&&o.add(s))}else e.adoptedStyleSheets.includes(c)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,c])})(e.l.getRootNode(),t)})(e);h(e,t),o&&(o.map((e=>e())),c["s-rc"]=void 0);{const t=c["s-p"],n=()=>y(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},h=(e,t)=>{try{t=t.render&&t.render(),e.t&=-17,e.t|=2}catch(t){M(t,e.l)}return null},y=e=>{const t=e.l,n=e.h;64&e.t||(e.t|=64,$(t),e.$(t),n||m()),e.S(t),e.u&&(e.u(),e.u=void 0),512&e.t&&W((()=>f(e,!1))),e.t&=-517},m=()=>{$(n.documentElement),W((()=>(e=>{const t=s.ce("appload",{detail:{namespace:"ionphaser"}});return e.dispatchEvent(t),t})(t)))},p=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){M(e)}},w=(e,t)=>e&&e.then?e.then(t):t(),$=e=>e.classList.add("hydrated"),b=(e,t,n)=>{if(t.g){e.watchers&&(t.j=e.watchers);const c=Object.entries(t.g),o=e.prototype;if(c.map((([e,[s]])=>{31&s||2&n&&32&s?Object.defineProperty(o,e,{get(){return((e,t)=>k(this).k.get(t))(0,e)},set(n){((e,t,n,s)=>{const c=k(this),o=c.l,r=c.k.get(t),i=c.t,a=c.m;if(n=((e,t)=>null==e||(e=>"object"==(e=typeof e)||"function"===e)(e)?e:4&t?"false"!==e&&(""===e||!!e):e)(n,s.g[t][0]),!(8&i&&void 0!==r||n===r)&&(c.k.set(t,n),a)){if(s.j&&128&i){const e=s.j[t];e&&e.map((e=>{try{a[e](n,r,t)}catch(e){M(e,o)}}))}2==(18&i)&&f(c,!1)}})(0,e,n,t)},configurable:!0,enumerable:!0}):1&n&&64&s&&Object.defineProperty(o,e,{value(...t){const n=k(this);return n.v.then((()=>n.m[e](...t)))}})})),1&n){const t=new Map;o.attributeChangedCallback=function(e,n,c){s.jmp((()=>{const n=t.get(e);this[n]=(null!==c||"boolean"!=typeof this[n])&&c}))},e.observedAttributes=c.filter((([e,t])=>15&t[0])).map((([e,n])=>{const s=n[1]||e;return t.set(s,e),s}))}}return e},S=e=>{p(e,"connectedCallback")},g=(e,c={})=>{const r=[],a=c.exclude||[],u=t.customElements,d=n.head,h=d.querySelector("meta[charset]"),y=n.createElement("style"),w=[];let $,g=!0;Object.assign(s,c),s.o=new URL(c.resourcesUrl||"./",n.baseURI).href,e.map((e=>e[1].map((t=>{const n={t:t[0],i:t[1],g:t[2],C:t[3]};n.g=t[2],n.j={};const c=n.i,d=class extends HTMLElement{constructor(e){super(e),C(e=this,n)}connectedCallback(){$&&(clearTimeout($),$=null),g?w.push(this):s.jmp((()=>(e=>{if(0==(1&s.t)){const t=k(e),n=t.p,s=()=>{};if(1&t.t)S(t.m);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){l(t,t.h=n);break}}n.g&&Object.entries(n.g).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,s,c)=>{if(0==(32&t.t)){{if(t.t|=32,(c=P(n)).then){const e=()=>{};c=await c,e()}c.isProxied||(n.j=c.watchers,b(c,n,2),c.isProxied=!0);const e=()=>{};t.t|=8;try{new c(t)}catch(e){M(e)}t.t&=-9,t.t|=128,e(),S(t.m)}if(c.style){let e=c.style;const t=i(n);if(!E.has(t)){const s=()=>{};((e,t,n)=>{let s=E.get(e);o&&n?(s=s||new CSSStyleSheet,s.replace(t)):s=t,E.set(e,s)})(t,e,!!(1&n.t)),s()}}}const r=t.h,a=()=>f(t,!0);r&&r["s-rc"]?r["s-rc"].push(a):a()})(0,t,n)}s()}})(this)))}disconnectedCallback(){s.jmp((()=>(()=>{0==(1&s.t)&&p(k(this).m,"disconnectedCallback")})()))}componentOnReady(){return k(this).M}};n.O=e[0],a.includes(c)||u.get(c)||(r.push(c),u.define(c,b(d,n,1)))})))),y.innerHTML=r+"{visibility:hidden}.hydrated{visibility:inherit}",y.setAttribute("data-styles",""),d.insertBefore(y,h?h.nextSibling:d.firstChild),g=!1,w.length?w.map((e=>e.connectedCallback())):s.jmp((()=>$=setTimeout(m,30)))},j=new WeakMap,k=e=>j.get(e),v=(e,t)=>j.set(t.m=e,t),C=(e,t)=>{const n={t:0,l:e,p:t,k:new Map};return n.v=new Promise((e=>n.S=e)),n.M=new Promise((e=>n.$=e)),e["s-p"]=[],e["s-rc"]=[],j.set(e,n)},M=(e,t)=>(0,console.error)(e,t),O=new Map,P=e=>{const t=e.i.replace(/-/g,"_"),n=e.O,s=O.get(n);return s?s[t]:import(`./${n}.entry.js`).then((e=>(O.set(n,e),e[t])),M)},E=new Map,T=[],x=[],L=(t,n)=>c=>{t.push(c),e||(e=!0,n&&4&s.t?W(U):s.raf(U))},R=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){M(e)}e.length=0},U=()=>{R(T),R(x),(e=T.length>0)&&s.raf(U)},W=e=>c().then(e),q=L(x,!0);export{g as b,a as g,c as p,v as r}