@eva/plugin-a11y 1.2.7-fix.1 → 1.2.7-fix.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@eva/eva.js"),require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js","pixi.js"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).EVA=t.EVA||{},t.EVA.plugin=t.EVA.plugin||{},t.EVA.plugin.a11y={}),t.EVA,t.PIXI)}(this,(function(t,e,r){"use strict";var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function o(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var i=function(){return(i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function a(t,e,r,n){var o,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a}function c(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function c(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,c)}s((n=n.apply(t,e||[])).next())}))}function s(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}function u(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var p=function(t,e){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function l(t,e){function r(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var f=function(t){function e(e){return e.autoStart=!1,t.call(this,e)||this}return l(e,t),e}(r.Application),h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return l(e,t),e}(r.Container);!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}l(e,t)}(r.Graphics),function(t){function e(e,n,o,i,a){var c;return c="string"===e?r.Texture.fromFrame(e):r.Texture.from(e),t.call(this,c,n,o,i,a)||this}l(e,t)}(r.mesh.NineSlicePlane),function(){function t(t){this._image=null,this._image=t,t?t instanceof HTMLImageElement?this.sprite=r.Sprite.from(t):t instanceof r.Texture&&(this.sprite=new r.Sprite(t)):this.sprite=new r.Sprite}Object.defineProperty(t.prototype,"image",{get:function(){return this._image},set:function(t){this._image!==t&&(t instanceof HTMLImageElement?(this.sprite.texture&&this.sprite.texture.destroy(!1),this.sprite.texture=r.Texture.from(t)):t instanceof r.Texture&&(this.sprite.texture=t),this._image=t)},enumerable:!1,configurable:!0})}(),function(){function t(t){var e=t.frames;this.animatedSprite=new r.extras.AnimatedSprite(e)}t.prototype.play=function(){this.animatedSprite.play()},t.prototype.stop=function(){this.animatedSprite.stop()},t.prototype.gotoAndPlay=function(t){this.animatedSprite.gotoAndPlay(t)},t.prototype.gotoAndStop=function(t){this.animatedSprite.gotoAndStop(t)},Object.defineProperty(t.prototype,"speed",{get:function(){return this.animatedSprite.animationSpeed},set:function(t){this.animatedSprite.animationSpeed=t},enumerable:!1,configurable:!0})}(),function(t){function e(e,r){return t.call(this,e,r)||this}l(e,t)}(r.Text);var v=r.extras.TilingSprite;function d(t,e){return t===e||t!=t&&e!=e}function y(t,e){for(var r=t.length;r--;)if(d(t[r][0],e))return r;return-1}!function(){function t(t){this._image=null,this._image=t,t?t instanceof HTMLImageElement?this.tilingSprite=new v(r.Texture.from(t)):t instanceof r.Texture&&(this.tilingSprite=new v(t)):this.tilingSprite=new v(r.Texture.EMPTY)}Object.defineProperty(t.prototype,"image",{get:function(){return this._image},set:function(t){this._image!==t&&(t instanceof HTMLImageElement?this.tilingSprite.texture=r.Texture.from(t):t instanceof r.Texture&&(this.tilingSprite.texture=t),this._image=t)},enumerable:!1,configurable:!0})}();var m=Array.prototype.splice;function g(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}g.prototype.clear=function(){this.__data__=[],this.size=0},g.prototype.delete=function(t){var e=this.__data__,r=y(e,t);return!(r<0)&&(r==e.length-1?e.pop():m.call(e,r,1),--this.size,!0)},g.prototype.get=function(t){var e=this.__data__,r=y(e,t);return r<0?void 0:e[r][1]},g.prototype.has=function(t){return y(this.__data__,t)>-1},g.prototype.set=function(t,e){var r=this.__data__,n=y(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var b="object"==typeof global&&global&&global.Object===Object&&global,_="object"==typeof self&&self&&self.Object===Object&&self,w=b||_||Function("return this")(),j=w.Symbol,O=Object.prototype,E=O.hasOwnProperty,x=O.toString,A=j?j.toStringTag:void 0;var S=Object.prototype.toString;var C=j?j.toStringTag:void 0;function P(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":C&&C in Object(t)?function(t){var e=E.call(t,A),r=t[A];try{t[A]=void 0;var n=!0}catch(t){}var o=x.call(t);return n&&(e?t[A]=r:delete t[A]),o}(t):function(t){return S.call(t)}(t)}function T(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function I(t){if(!T(t))return!1;var e=P(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var M,R=w["__core-js_shared__"],N=(M=/[^.]+$/.exec(R&&R.keys&&R.keys.IE_PROTO||""))?"Symbol(src)_1."+M:"";var k=Function.prototype.toString;function D(t){if(null!=t){try{return k.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var z=/^\[object .+?Constructor\]$/,B=Function.prototype,L=Object.prototype,V=B.toString,U=L.hasOwnProperty,Y=RegExp("^"+V.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function H(t){return!(!T(t)||(e=t,N&&N in e))&&(I(t)?Y:z).test(D(t));var e}function F(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return H(r)?r:void 0}var G=F(w,"Map"),X=F(Object,"create");var W=Object.prototype.hasOwnProperty;var q=Object.prototype.hasOwnProperty;function K(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function $(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function J(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}K.prototype.clear=function(){this.__data__=X?X(null):{},this.size=0},K.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},K.prototype.get=function(t){var e=this.__data__;if(X){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return W.call(e,t)?e[t]:void 0},K.prototype.has=function(t){var e=this.__data__;return X?void 0!==e[t]:q.call(e,t)},K.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=X&&void 0===e?"__lodash_hash_undefined__":e,this},J.prototype.clear=function(){this.size=0,this.__data__={hash:new K,map:new(G||g),string:new K}},J.prototype.delete=function(t){var e=$(this,t).delete(t);return this.size-=e?1:0,e},J.prototype.get=function(t){return $(this,t).get(t)},J.prototype.has=function(t){return $(this,t).has(t)},J.prototype.set=function(t,e){var r=$(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function Q(t){var e=this.__data__=new g(t);this.size=e.size}Q.prototype.clear=function(){this.__data__=new g,this.size=0},Q.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Q.prototype.get=function(t){return this.__data__.get(t)},Q.prototype.has=function(t){return this.__data__.has(t)},Q.prototype.set=function(t,e){var r=this.__data__;if(r instanceof g){var n=r.__data__;if(!G||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new J(n)}return r.set(t,e),this.size=r.size,this};function Z(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new J;++e<r;)this.add(t[e])}function tt(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}Z.prototype.add=Z.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Z.prototype.has=function(t){return this.__data__.has(t)};function et(t,e,r,n,o,i){var a=1&r,c=t.length,s=e.length;if(c!=s&&!(a&&s>c))return!1;var u=i.get(t),p=i.get(e);if(u&&p)return u==e&&p==t;var l=-1,f=!0,h=2&r?new Z:void 0;for(i.set(t,e),i.set(e,t);++l<c;){var v=t[l],d=e[l];if(n)var y=a?n(d,v,l,e,t,i):n(v,d,l,t,e,i);if(void 0!==y){if(y)continue;f=!1;break}if(h){if(!tt(e,(function(t,e){if(a=e,!h.has(a)&&(v===t||o(v,t,r,n,i)))return h.push(e);var a}))){f=!1;break}}else if(v!==d&&!o(v,d,r,n,i)){f=!1;break}}return i.delete(t),i.delete(e),f}var rt=w.Uint8Array;function nt(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function ot(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var it=j?j.prototype:void 0,at=it?it.valueOf:void 0;var ct=Array.isArray;var st=Object.prototype.propertyIsEnumerable,ut=Object.getOwnPropertySymbols,pt=ut?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var a=t[r];e(a,r,t)&&(i[o++]=a)}return i}(ut(t),(function(e){return st.call(t,e)})))}:function(){return[]};function lt(t){return null!=t&&"object"==typeof t}function ft(t){return lt(t)&&"[object Arguments]"==P(t)}var ht=Object.prototype,vt=ht.hasOwnProperty,dt=ht.propertyIsEnumerable,yt=ft(function(){return arguments}())?ft:function(t){return lt(t)&&vt.call(t,"callee")&&!dt.call(t,"callee")};var mt="object"==typeof t&&t&&!t.nodeType&&t,gt=mt&&"object"==typeof module&&module&&!module.nodeType&&module,bt=gt&&gt.exports===mt?w.Buffer:void 0,_t=(bt?bt.isBuffer:void 0)||function(){return!1},wt=/^(?:0|[1-9]\d*)$/;function jt(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&wt.test(t))&&t>-1&&t%1==0&&t<e}function Ot(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}var Et={};Et["[object Float32Array]"]=Et["[object Float64Array]"]=Et["[object Int8Array]"]=Et["[object Int16Array]"]=Et["[object Int32Array]"]=Et["[object Uint8Array]"]=Et["[object Uint8ClampedArray]"]=Et["[object Uint16Array]"]=Et["[object Uint32Array]"]=!0,Et["[object Arguments]"]=Et["[object Array]"]=Et["[object ArrayBuffer]"]=Et["[object Boolean]"]=Et["[object DataView]"]=Et["[object Date]"]=Et["[object Error]"]=Et["[object Function]"]=Et["[object Map]"]=Et["[object Number]"]=Et["[object Object]"]=Et["[object RegExp]"]=Et["[object Set]"]=Et["[object String]"]=Et["[object WeakMap]"]=!1;var xt,At="object"==typeof t&&t&&!t.nodeType&&t,St=At&&"object"==typeof module&&module&&!module.nodeType&&module,Ct=St&&St.exports===At&&b.process,Pt=function(){try{var t=St&&St.require&&St.require("util").types;return t||Ct&&Ct.binding&&Ct.binding("util")}catch(t){}}(),Tt=Pt&&Pt.isTypedArray,It=Tt?(xt=Tt,function(t){return xt(t)}):function(t){return lt(t)&&Ot(t.length)&&!!Et[P(t)]},Mt=Object.prototype.hasOwnProperty;function Rt(t,e){var r=ct(t),n=!r&&yt(t),o=!r&&!n&&_t(t),i=!r&&!n&&!o&&It(t),a=r||n||o||i,c=a?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],s=c.length;for(var u in t)!e&&!Mt.call(t,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||jt(u,s))||c.push(u);return c}var Nt=Object.prototype;var kt=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),Dt=Object.prototype.hasOwnProperty;function zt(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||Nt))return kt(t);var e,r,n=[];for(var o in Object(t))Dt.call(t,o)&&"constructor"!=o&&n.push(o);return n}function Bt(t){return null!=(e=t)&&Ot(e.length)&&!I(e)?Rt(t):zt(t);var e}function Lt(t){return function(t,e,r){var n=e(t);return ct(t)?n:function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}(n,r(t))}(t,Bt,pt)}var Vt=Object.prototype.hasOwnProperty;var Ut=F(w,"DataView"),Yt=F(w,"Promise"),Ht=F(w,"Set"),Ft=F(w,"WeakMap"),Gt="[object Map]",Xt="[object Promise]",Wt="[object Set]",qt="[object WeakMap]",Kt="[object DataView]",$t=D(Ut),Jt=D(G),Qt=D(Yt),Zt=D(Ht),te=D(Ft),ee=P;(Ut&&ee(new Ut(new ArrayBuffer(1)))!=Kt||G&&ee(new G)!=Gt||Yt&&ee(Yt.resolve())!=Xt||Ht&&ee(new Ht)!=Wt||Ft&&ee(new Ft)!=qt)&&(ee=function(t){var e=P(t),r="[object Object]"==e?t.constructor:void 0,n=r?D(r):"";if(n)switch(n){case $t:return Kt;case Jt:return Gt;case Qt:return Xt;case Zt:return Wt;case te:return qt}return e});var re=ee,ne="[object Arguments]",oe="[object Array]",ie="[object Object]",ae=Object.prototype.hasOwnProperty;function ce(t,e,r,n,o,i){var a=ct(t),c=ct(e),s=a?oe:re(t),u=c?oe:re(e),p=(s=s==ne?ie:s)==ie,l=(u=u==ne?ie:u)==ie,f=s==u;if(f&&_t(t)){if(!_t(e))return!1;a=!0,p=!1}if(f&&!p)return i||(i=new Q),a||It(t)?et(t,e,r,n,o,i):function(t,e,r,n,o,i,a){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new rt(t),new rt(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return d(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var c=nt;case"[object Set]":var s=1&n;if(c||(c=ot),t.size!=e.size&&!s)return!1;var u=a.get(t);if(u)return u==e;n|=2,a.set(t,e);var p=et(c(t),c(e),n,o,i,a);return a.delete(t),p;case"[object Symbol]":if(at)return at.call(t)==at.call(e)}return!1}(t,e,s,r,n,o,i);if(!(1&r)){var h=p&&ae.call(t,"__wrapped__"),v=l&&ae.call(e,"__wrapped__");if(h||v){var y=h?t.value():t,m=v?e.value():e;return i||(i=new Q),o(y,m,r,n,i)}}return!!f&&(i||(i=new Q),function(t,e,r,n,o,i){var a=1&r,c=Lt(t),s=c.length;if(s!=Lt(e).length&&!a)return!1;for(var u=s;u--;){var p=c[u];if(!(a?p in e:Vt.call(e,p)))return!1}var l=i.get(t),f=i.get(e);if(l&&f)return l==e&&f==t;var h=!0;i.set(t,e),i.set(e,t);for(var v=a;++u<s;){var d=t[p=c[u]],y=e[p];if(n)var m=a?n(y,d,p,e,t,i):n(d,y,p,t,e,i);if(!(void 0===m?d===y||o(d,y,r,n,i):m)){h=!1;break}v||(v="constructor"==p)}if(h&&!v){var g=t.constructor,b=e.constructor;g==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof g&&g instanceof g&&"function"==typeof b&&b instanceof b||(h=!1)}return i.delete(t),i.delete(e),h}(t,e,r,n,o,i))}function se(t,e,r,n,o){return t===e||(null==t||null==e||!lt(t)&&!lt(e)?t!=t&&e!=e:ce(t,e,r,n,se,o))}var ue=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function o(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function i(t,e,n,i,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var c=new o(n,i||t,a),s=r?r+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],c]:t._events[s].push(c):(t._events[s]=c,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function c(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),c.prototype.eventNames=function(){var t,n,o=[];if(0===this._eventsCount)return o;for(n in t=this._events)e.call(t,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},c.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,a=new Array(i);o<i;o++)a[o]=n[o].fn;return a},c.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},c.prototype.emit=function(t,e,n,o,i,a){var c=r?r+t:t;if(!this._events[c])return!1;var s,u,p=this._events[c],l=arguments.length;if(p.fn){switch(p.once&&this.removeListener(t,p.fn,void 0,!0),l){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,e),!0;case 3:return p.fn.call(p.context,e,n),!0;case 4:return p.fn.call(p.context,e,n,o),!0;case 5:return p.fn.call(p.context,e,n,o,i),!0;case 6:return p.fn.call(p.context,e,n,o,i,a),!0}for(u=1,s=new Array(l-1);u<l;u++)s[u-1]=arguments[u];p.fn.apply(p.context,s)}else{var f,h=p.length;for(u=0;u<h;u++)switch(p[u].once&&this.removeListener(t,p[u].fn,void 0,!0),l){case 1:p[u].fn.call(p[u].context);break;case 2:p[u].fn.call(p[u].context,e);break;case 3:p[u].fn.call(p[u].context,e,n);break;case 4:p[u].fn.call(p[u].context,e,n,o);break;default:if(!s)for(f=1,s=new Array(l-1);f<l;f++)s[f-1]=arguments[f];p[u].fn.apply(p[u].context,s)}}return!0},c.prototype.on=function(t,e,r){return i(this,t,e,r,!1)},c.prototype.once=function(t,e,r){return i(this,t,e,r,!0)},c.prototype.removeListener=function(t,e,n,o){var i=r?r+t:t;if(!this._events[i])return this;if(!e)return a(this,i),this;var c=this._events[i];if(c.fn)c.fn!==e||o&&!c.once||n&&c.context!==n||a(this,i);else{for(var s=0,u=[],p=c.length;s<p;s++)(c[s].fn!==e||o&&!c[s].once||n&&c[s].context!==n)&&u.push(c[s]);u.length?this._events[i]=1===u.length?u[0]:u:a(this,i)}return this},c.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&a(this,e)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t.exports=c})),pe=function(t,e){return(pe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function le(t,e){function r(){this.constructor=t}pe(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var fe=function(){return(fe=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function he(t,e,r,n){var o,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a}function ve(t){var e="function"==typeof Symbol&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function de(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function ye(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(de(arguments[e]));return t}var me,ge=function(){function t(t){var e=t.game,r=t.rendererSystem;this.renderers=[],this.game=e,this.rendererSystem=r}return t.prototype.register=function(){for(var t,e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{for(var o=ve(r),i=o.next();!i.done;i=o.next()){var a=i.value;a.game=this.game,a.rendererManager=this.rendererSystem.rendererManager,a.containerManager=this.rendererSystem.containerManager,this.renderers.push(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}},t.prototype.componentChanged=function(t){var r,n,o=function(t){var r,n;try{for(var o=(r=void 0,ve(i.renderers)),a=o.next();!a.done;a=o.next()){var c=a.value,s=c.observerInfo[t.componentName];if(s){if([e.OBSERVER_TYPE.ADD,e.OBSERVER_TYPE.REMOVE].indexOf(t.type)>-1){try{c.componentChanged&&c.componentChanged(t)}catch(e){console.error("gameObject: "+t.gameObject.name+", "+t.componentName+" is error.",t,e)}continue}if(s.findIndex((function(e){return r=e,n=t.prop,se(r,n);var r,n}))>-1)try{c.componentChanged&&c.componentChanged(t)}catch(e){console.error("gameObject: "+(t.gameObject&&t.gameObject.name)+", "+t.componentName+" is componentChanged error.",t,e)}}}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},i=this;try{for(var a=ve(t),c=a.next();!c.done;c=a.next()){o(c.value)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}},t.prototype.update=function(t){var e,r,n,o;try{for(var i=ve(t.components),a=i.next();!a.done;a=i.next()){var c=a.value;try{for(var s=(n=void 0,ve(this.renderers)),u=s.next();!u.done;u=s.next()){var p=u.value,l=[];if(p.observerInfo[c.name]&&-1===l.indexOf(t)){l.push(t);try{p.rendererUpdate&&p.rendererUpdate(t)}catch(e){console.info("gameObject: "+t.name+", "+c.name+" is update error",e)}}}}catch(t){n={error:t}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},t}(),be=function(){function t(){this.containerMap={}}return t.prototype.addContainer=function(t){var e=t.name,r=t.container;this.containerMap[e]=r},t.prototype.getContainer=function(t){return this.containerMap[t]},t.prototype.removeContainer=function(t){var e;null===(e=this.containerMap[t])||void 0===e||e.destroy({children:!0}),delete this.containerMap[t]},t.prototype.updateTransform=function(t){var e=t.name,r=t.transform,n=this.containerMap[e];if(n){var o=r.anchor,i=r.origin,a=r.position,c=r.rotation,s=r.scale,u=r.size,p=r.skew;n.rotation=c,n.scale=s,n.pivot.x=u.width*i.x,n.pivot.y=u.height*i.y,n.skew=p;var l=a.x,f=a.y;if(r.parent){var h=r.parent;l+=h.size.width*o.x,f+=h.size.height*o.y}n.position={x:l,y:f}}},t}(),_e=function(t){function r(e){var r=e.system,n=e.containerManager,o=t.call(this)||this;return o.name="Transform",o.waitRemoveIds=[],o.waitChangeScenes=[],o.containerManager=n,o.init(r),o}return le(r,t),r.prototype.init=function(t){var e=this;this.system=t,this.on("changeScene",(function(t){var r=t.scene,n=t.mode,o=t.application;e.waitChangeScenes.push({scene:r,mode:n,application:o})}))},r.prototype.update=function(){var t,e,r,n;try{for(var o=ve(this.waitRemoveIds),i=o.next();!i.done;i=o.next()){var a=i.value;this.containerManager.removeContainer(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}this.waitRemoveIds=[];try{for(var c=ve(this.waitChangeScenes),s=c.next();!s.done;s=c.next()){var u=s.value,p=this.containerManager.getContainer(u.scene.id);p&&(u.application.stage.removeChildren(),u.application.stage.addChild(p))}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}this.waitChangeScenes=[]},r.prototype.componentChanged=function(t){t.type===e.OBSERVER_TYPE.ADD?this.addContainer(t):t.type===e.OBSERVER_TYPE.CHANGE?this.change(t):t.type===e.OBSERVER_TYPE.REMOVE&&this.waitRemoveIds.push(t.gameObject.id)},r.prototype.addContainer=function(t){var e=new h;e.name=t.gameObject.name,this.containerManager.addContainer({name:t.gameObject.id,container:e}),t.component.worldTransform=e.transform.worldTransform},r.prototype.change=function(t){var e=t.component;if(e.parent){this.containerManager.getContainer(e.parent.gameObject.id).addChild(this.containerManager.getContainer(t.gameObject.id));var r=t.gameObject.transform.parent&&t.gameObject.transform.parent.gameObject.getComponent("Render");r&&(r.sortDirty=!0)}else{var n=this.containerManager.getContainer(t.gameObject.id);delete e.worldTransform,n.parent&&n.parent.removeChild(n)}},r.prototype.destroy=function(){this.removeAllListeners(),this.waitRemoveIds=null,this.waitChangeScenes=null,this.system=null,this.containerManager=null},r=he([e.decorators.componentObserver({Transform:["_parent"]})],r)}(ue);!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"}(me||(me={}));var we=function(t){t.plugins.interaction.autoPreventDefault=!0,t.view.style.touchAction="none"},je=function(t){t.plugins.interaction.autoPreventDefault=!1,t.view.style.touchAction="auto"},Oe=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.multiApps=[],e}return le(n,t),n.prototype.init=function(t){var r=this;this.params=t,this.application=this.createApplication(t),this.containerManager=new be,this.rendererManager=new ge({game:this.game,rendererSystem:this}),this.game.canvas=this.application.view,this.transform=new _e({system:this,containerManager:this.containerManager}),this.game.on("sceneChanged",(function(t){var n,o=t.scene,i=t.mode,a=t.params;switch(i){case e.LOAD_SCENE_MODE.SINGLE:n=r.application;break;case e.LOAD_SCENE_MODE.MULTI_CANVAS:n=r.createMultiApplication({params:a})}o.canvas=n.view,r.transform.emit("changeScene",{scene:o,mode:i,application:n})}))},n.prototype.registerObserver=function(t){var e,r=this.constructor.observerInfo;for(var n in t)r[n]||(r[n]=[]),(e=r[n]).push.apply(e,ye(t[n]))},n.prototype.createMultiApplication=function(t){var e=t.params,r=this.createApplication(e);return this.multiApps.push(r),r},n.prototype.createApplication=function(t){t.view=t.canvas,t.renderType===me.CANVAS&&(t.forceCanvas=!0),r.ticker.shared.autoStart=!1,r.ticker.shared.stop();var e=new f(fe({sharedTicker:!0},t));return void 0!==t.preventScroll&&(console.warn("PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game"),t.preventScroll?je(e.renderer):we(e.renderer)),void 0!==t.enableScroll&&(t.enableScroll?je(e.renderer):we(e.renderer)),void 0===t.preventScroll&&void 0===t.enableScroll&&je(e.renderer),e},n.prototype.update=function(){var t,e,r,n,o=this.componentObserver.clear();try{for(var i=ve(o),a=i.next();!a.done;a=i.next()){var c=a.value;this.transform.componentChanged(c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}try{for(var s=ve(this.game.gameObjects),u=s.next();!u.done;u=s.next()){var p=u.value;this.containerManager.updateTransform({name:p.id,transform:p.transform}),this.rendererManager.update(p)}}catch(t){r={error:t}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}},n.prototype.lateUpdate=function(t){this.transform.update(),this.application.ticker.update(t.time)},n.prototype.onDestroy=function(){var t,e;this.application.destroy();try{for(var r=ve(this.multiApps),n=r.next();!n.done;n=r.next()){var o=n.value;o&&o.destroy()}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.transform.destroy(),this.transform=null,this.params=null,this.rendererManager=null,this.containerManager=null,this.application=null,this.game=null,this.multiApps=null},n.prototype.resize=function(t,e){this.params.width=t,this.params.height=e,this.application.renderer.resize(t,e)},n.systemName="Renderer",n=he([e.decorators.componentObserver({Transform:["_parent"]})],n)}(e.System);!function(t){function e(e){var r=t.call(this,e)||this;return r.observerInfo=r.constructor.observerInfo,r}le(e,t),e.prototype.componentChanged=function(t){},e.prototype.rendererUpdate=function(t){},e.prototype.update=function(){var t,e,r=this.componentObserver.clear();try{for(var n=ve(r),o=n.next();!o.done;o=n.next()){var i=o.value;this.componentChanged(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}}}(e.System);var Ee,xe,Ae,Se,Ce=function(t,e){var r=e.width,n=e.height,o=e.position,i=e.left,a=void 0===i?0:i,c=e.top,s=void 0===c?0:c,u=e.zIndex,p=e.pointerEvents,l=e.background;t.style.width=r+"px",t.style.height=n+"px",t.style.position=o,t.style.left=""+a,t.style.top=""+s,t.style.zIndex=""+u,t.style.pointerEvents=p,t.style.background=l,t.style.border="none",t.style.overflow="hidden"},Pe=function(t){function r(e){var r=t.call(this)||this;Object.assign(r,e);var n=e.hint,o=void 0===n?"":n,i=e.event,a=e.delay,c=void 0===a?0:a,s=e.attr,u=void 0===s?{}:s,p=e.role,l=void 0===p?"":p,f=e.props,h=void 0===f?{}:f,v=e.state,d=void 0===v?{}:v;return r.hint=o,r.event=i,r.delay=c,r.attr=u,r.role=l,r.props=h,r.state=d,r.a11yId="_"+function(t){for(var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=[],n=e.length,o=0;o<t;o++)r[o]=e[0|Math.random()*n];return r.join("")}(6),r}return o(r,t),r.componentName="A11y",a([e.decorators.IDEProp],r.prototype,"interactive",void 0),a([e.decorators.IDEProp],r.prototype,"hint",void 0),a([e.decorators.IDEProp],r.prototype,"event",void 0),a([e.decorators.IDEProp],r.prototype,"delay",void 0),a([e.decorators.IDEProp],r.prototype,"role",void 0),a([e.decorators.IDEProp],r.prototype,"props",void 0),a([e.decorators.IDEProp],r.prototype,"state",void 0),a([e.decorators.IDEProp],r.prototype,"attr",void 0),a([e.decorators.IDEProp],r.prototype,"a11yId",void 0),r}(e.Component),Te="absolute";t.A11yActivate=void 0,(Ee=t.A11yActivate||(t.A11yActivate={}))[Ee.ENABLE=0]="ENABLE",Ee[Ee.DISABLE=1]="DISABLE",Ee[Ee.CHECK=2]="CHECK",function(t){t.NONE="none",t.AUTO="auto"}(xe||(xe={})),function(t){t.DEBUG="rgba(255,0,0,0.5)",t.NONE="transparent"}(Ae||(Ae={})),function(t){t.BUTTON="button",t.DIV="div"}(Se||(Se={}));var Ie=["hint","event","delay","attr","role","props","state","a11yId","name"],Me=function(t,e,r){var n=this;["touchstart","touchend","tap"].forEach((function(o){t.emit(o,{stopPropagation:function(){return r.stopPropagation()},data:{position:n.eventPosition},gameObject:e})}))},Re=function(r){function n(t){var e=r.call(this,t)||this;return e.cache=new Map,e.eventCache=new Map,e}return o(n,r),Object.defineProperty(n.prototype,"ratioX",{get:function(){return this._ratioX||this.setRatio()?this._ratioX:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ratioY",{get:function(){return this._ratioY||this.setRatio()?this._ratioY:0},enumerable:!1,configurable:!0}),n.prototype.init=function(e){return void 0===e&&(e={}),c(this,void 0,void 0,(function(){var r,n,o,i,a,c,u,p;return s(this,(function(s){switch(s.label){case 0:switch(r=e.activate,n=void 0===r?t.A11yActivate.CHECK:r,o=e.delay,i=void 0===o?100:o,a=e.checkA11yOpen,c=void 0===a?function(){return Promise.resolve(!1)}:a,this.delay=i,n){case t.A11yActivate.CHECK:return[3,1];case t.A11yActivate.DISABLE:return[3,5];case t.A11yActivate.ENABLE:return[3,6]}return[3,7];case 1:return s.trys.push([1,3,,4]),u=this,[4,c()];case 2:return u.activate=s.sent(),[3,4];case 3:return s.sent(),this.activate=!1,[3,4];case 4:return[3,7];case 5:return this.activate=!1,[3,7];case 6:return this.activate=!0,[3,7];case 7:return this.debug=e.debug||!1,this.debug&&(this.activate=!0),this.activate?(p=document.createElement("div"),this.div=p,this.game.canvas.parentNode&&this.game.canvas.parentNode.appendChild(this.div),[2]):[2]}}))}))},n.prototype.setRatio=function(){var t=this.getCanvasBoundingClientRect(),e=t.width,r=t.height,n=this.getRenderRect(),o=n.renderWidth,i=n.renderHeight;return this._ratioX=e/o,this._ratioY=r/i,!(!e&&!r)&&(this.initDiv(),!0)},n.prototype.getRenderRect=function(){var t=(this.game.getSystem(Oe)||{width:300,height:300}).params,e=t.height;return{renderWidth:t.width,renderHeight:e}},n.prototype.getCanvasBoundingClientRect=function(){var t=this.game.canvas.getBoundingClientRect();return{width:t.width,height:t.height,left:t.left,top:t.top}},n.prototype.initDiv=function(){var t=this,e=window.pageXOffset,r=window.pageYOffset,n=this.getCanvasBoundingClientRect(),o={width:n.width,height:n.height,left:n.left+e+"px",top:n.top+r+"px",position:Te,zIndex:3,pointerEvents:xe.NONE,background:Ae.NONE};Ce(this.div,o),this.div.addEventListener("click",(function(e){var r=e.currentTarget.getBoundingClientRect(),n=r.left,o=r.top,i=(e.pageX-n)/t.ratioX,a=(e.pageY-o)/t.ratioY;t.eventPosition={x:i,y:a}}),!0)},n.prototype.update=function(){return c(this,void 0,void 0,(function(){var t,r,n,o,i,a;return s(this,(function(c){if(t=this.componentObserver.clear(),!this.activate)return[2];try{for(r=u(t),n=r.next();!n.done;n=r.next())switch((o=n.value).type){case e.OBSERVER_TYPE.ADD:"Event"===o.componentName&&this.addEvent(o.gameObject),"A11y"===o.componentName&&this.add(o);break;case e.OBSERVER_TYPE.CHANGE:"Transform"===o.componentName&&this.transformChange(o);break;case e.OBSERVER_TYPE.REMOVE:"Event"===o.componentName&&this.removeEvent(o),"A11y"===o.componentName&&this.remove(o)}}catch(t){i={error:t}}finally{try{n&&!n.done&&(a=r.return)&&a.call(r)}finally{if(i)throw i.error}}return[2]}))}))},n.prototype.remove=function(t){var e=t.component;if(e){var r=e.a11yId,n=this.div.querySelector("#"+r);n&&this.div.removeChild(n),this.cache.delete(r)}},n.prototype.add=function(t){var e=this;if(this.activate){var r=t.component,n=t.gameObject,o=r.delay,i=r.a11yId,a=r.event;if(n){var c=n.transform;if(c){var s=document.createElement("div");this.cache.set(i,s),a||(a=n.getComponent("Event")),setTimeout((function(){e.setPosition(s,c),e.setA11yAttr(s,r),a&&e.addEvent(n),n.scene&&e.div.appendChild(s)}),o||this.delay)}}}},n.prototype.transformChange=function(t){var e=t.component,r=t.gameObject.getComponent(Pe);if(r){var n=r.a11yId;if(e.inScene){if(this.cache.has(n)){var o=this.cache.get(n);o&&this.div.appendChild(o)}}else{var i=this.div.querySelector("#"+n);i&&this.div.removeChild(i)}}},n.prototype.setEvent=function(t,e,r,n){if(e){var o=Me.bind(this,e,r);this.eventCache.set(n,o),t.addEventListener("click",o)}},n.prototype.addEvent=function(t){var e=t.getComponent(Pe);if(e){var r=t.getComponent("Event");if(r){var n=this.cache.get(e.a11yId);n&&this.setEvent(n,r,t,e.a11yId)}}},n.prototype.removeEvent=function(t){var e=t.gameObject.getComponent(Pe);if(e&&t.component){var r=e.a11yId,n=this.eventCache.get(r),o=this.cache.get(r);o&&o.removeEventListener("click",n)}},n.prototype.setA11yAttr=function(t,e){var r,n,o,i,a,c,s=e.hint,p=e.props,l=void 0===p?{}:p,f=e.state,h=void 0===f?{}:f,v=e.role,d=e.a11yId,y=v||"text";t.setAttribute("role",y),t.setAttribute("aria-label",s),t.id=d;var m=Object.keys(l);try{for(var g=u(m),b=g.next();!b.done;b=g.next()){var _=b.value;t.setAttribute(_,l[_])}}catch(t){r={error:t}}finally{try{b&&!b.done&&(n=g.return)&&n.call(g)}finally{if(r)throw r.error}}var w=Object.keys(h);try{for(var j=u(w),O=j.next();!O.done;O=j.next()){_=O.value;t.setAttribute(_,h[_])}}catch(t){o={error:t}}finally{try{O&&!O.done&&(i=j.return)&&i.call(j)}finally{if(o)throw o.error}}try{for(var E=u(Object.keys(e)),x=E.next();!x.done;x=E.next()){"string"==typeof e[_=x.value]&&-1===Ie.indexOf(_)&&1!==_.indexOf("_")&&t.setAttribute(_,e[_])}}catch(t){a={error:t}}finally{try{x&&!x.done&&(c=E.return)&&c.call(E)}finally{if(a)throw a.error}}},n.prototype.setPosition=function(t,e){var r=e.size,n=r.width,o=r.height,a={width:0===n?1:n*this.ratioX,height:0===o?1:o*this.ratioY,position:Te,zIndex:3,pointerEvents:xe.AUTO,background:this.debug?Ae.DEBUG:Ae.NONE},c=i({},e);Ce(t,a),function(t,e,r,n){var o=e.worldTransform,i="matrix("+o.a+", "+o.b+", "+o.c+", "+o.d+", "+o.tx*r+", "+o.ty*n+")";t.style.transform=""+i,t.style.webkitTransform=""+i,t.style.transformOrigin="left top",t.style.webkitTransformOrigin="left top"}(t,c,this.ratioX,this.ratioY)},n.prototype.onDestroy=function(){this.div.parentElement.removeChild(this.div),this.cache=null,this.eventCache=null},n.systemName="A11ySystem",n=a([e.decorators.componentObserver({A11y:[],Transform:["inScene"],Event:[]})],n)}(e.System);t.A11y=Pe,t.A11ySystem=Re,Object.defineProperty(t,"__esModule",{value:!0})}));
1
+ function _extends(){return _extends=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},_extends.apply(this,arguments)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_a11y=function(t,e,n){"use strict";var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},r(t,e)};function o(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};function a(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}function s(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))}function c(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function u(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(t,e){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[e]||(t.constructor.IDEProps[e]={}),t.constructor.IDEProps[e]}function p(t){return function(e,n){var r=h(e,n);r.key=n,r.type=t}}function l(t){return function(e,n){h(e,n).step=t}}var d,v,f,y,g=function(t,e){var n=e.width,r=e.height,o=e.position,i=e.left,a=void 0===i?0:i,s=e.top,c=void 0===s?0:s,u=e.zIndex,h=e.pointerEvents,p=e.background;t.style.width=n+"px",t.style.height=r+"px",t.style.position=o,t.style.left=""+a,t.style.top=""+c,t.style.zIndex=""+u,t.style.pointerEvents=h,t.style.background=p,t.style.border="none",t.style.overflow="hidden"},m=function(t){function e(e){var n=t.call(this)||this;_extends(n,e);var r=e.hint,o=void 0===r?"":r,i=e.event,a=e.delay,s=void 0===a?0:a,c=e.attr,u=void 0===c?{}:c,h=e.role,p=void 0===h?"":h,l=e.props,d=void 0===l?{}:l,v=e.state,f=void 0===v?{}:v;return n.hint=o,n.event=i,n.delay=s,n.attr=u,n.role=p,n.props=d,n.state=f,n.a11yId="_"+function(t){for(var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[],r=e.length,o=0;o<t;o++)n[o]=e[0|Math.random()*r];return n.join("")}(6),n}return o(e,t),e.componentName="A11y",a([p("boolean")],e.prototype,"interactive",void 0),a([p("string")],e.prototype,"hint",void 0),a([p("number"),l(1)],e.prototype,"delay",void 0),a([p("string")],e.prototype,"role",void 0),a([p("string")],e.prototype,"a11yId",void 0),e}(e.Component),b=m,E="absolute";t.A11yActivate=void 0,(d=t.A11yActivate||(t.A11yActivate={}))[d.ENABLE=0]="ENABLE",d[d.DISABLE=1]="DISABLE",d[d.CHECK=2]="CHECK",function(t){t.NONE="none",t.AUTO="auto"}(v||(v={})),function(t){t.DEBUG="rgba(255,0,0,0.5)",t.NONE="transparent"}(f||(f={})),function(t){t.BUTTON="button",t.DIV="div"}(y||(y={}));var w=["hint","event","delay","attr","role","props","state","a11yId","name"],A=function(t,e,n){var r=this;["touchstart","touchend","tap"].forEach((function(o){t.emit(o,{stopPropagation:function(){return n.stopPropagation()},data:{position:r.eventPosition},gameObject:e})}))},O=function(r){function h(t){var e=r.call(this,t)||this;return e.cache=new Map,e.eventCache=new Map,e.zIndex=3,e}return o(h,r),Object.defineProperty(h.prototype,"ratioX",{get:function(){return this._ratioX||this.setRatio()?this._ratioX:0},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"ratioY",{get:function(){return this._ratioY||this.setRatio()?this._ratioY:0},enumerable:!1,configurable:!0}),h.prototype.init=function(e){return void 0===e&&(e={}),s(this,void 0,void 0,(function(){var n,r,o,i,a,s,u,h,p;return c(this,(function(c){switch(c.label){case 0:switch(n=e.activate,r=void 0===n?t.A11yActivate.CHECK:n,o=e.delay,i=void 0===o?100:o,a=e.checkA11yOpen,s=void 0===a?function(){return Promise.resolve(!1)}:a,u=e.zIndex,this.delay=i,this.zIndex=u||this.zIndex,r){case t.A11yActivate.CHECK:return[3,1];case t.A11yActivate.DISABLE:return[3,5];case t.A11yActivate.ENABLE:return[3,6]}return[3,7];case 1:return c.trys.push([1,3,,4]),h=this,[4,s()];case 2:return h.activate=c.sent(),[3,4];case 3:return c.sent(),this.activate=!1,[3,4];case 4:return[3,7];case 5:return this.activate=!1,[3,7];case 6:return this.activate=!0,[3,7];case 7:return this.debug=e.debug||!1,this.debug&&(this.activate=!0),this.activate?(p=document.createElement("div"),this.div=p,this.game.canvas.parentNode&&this.game.canvas.parentNode.insertBefore(this.div,this.game.canvas),[2]):[2]}}))}))},h.prototype.setRatio=function(){var t=this.getCanvasBoundingClientRect(),e=t.width,n=t.height,r=this.getRenderRect(),o=r.renderWidth,i=r.renderHeight;return this._ratioX=e/o,this._ratioY=n/i,!(!e&&!n)&&(this.initDiv(),!0)},h.prototype.getRenderRect=function(){var t=this.game.getSystem(n.RendererSystem).params,e=void 0===t?{width:300,height:300}:t,r=e.height;return{renderWidth:e.width,renderHeight:r}},h.prototype.getCanvasBoundingClientRect=function(){var t=this.game.canvas.getBoundingClientRect();return{width:t.width,height:t.height,left:t.left,top:t.top}},h.prototype.initDiv=function(){var t=this,e=window.pageXOffset,n=window.pageYOffset,r=this.getCanvasBoundingClientRect(),o={width:r.width,height:r.height,left:r.left+e+"px",top:r.top+n+"px",position:E,zIndex:this.zIndex,pointerEvents:v.NONE,background:f.NONE};g(this.div,o),this.div.addEventListener("click",(function(e){var n=e.currentTarget.getBoundingClientRect(),r=n.left,o=n.top,i=(e.pageX-r)/t.ratioX,a=(e.pageY-o)/t.ratioY;t.eventPosition={x:i,y:a}}),!0)},h.prototype.update=function(){return s(this,void 0,void 0,(function(){var t,n,r,o,i,a;return c(this,(function(s){if(t=this.componentObserver.clear(),!this.activate)return[2];try{for(n=u(t),r=n.next();!r.done;r=n.next())switch((o=r.value).type){case e.OBSERVER_TYPE.ADD:"Event"===o.componentName&&this.addEvent(o.gameObject),"A11y"===o.componentName&&this.add(o);break;case e.OBSERVER_TYPE.CHANGE:"Transform"===o.componentName&&this.transformChange(o),"A11y"===o.componentName&&this.change(o);break;case e.OBSERVER_TYPE.REMOVE:"Event"===o.componentName&&this.removeEvent(o),"A11y"===o.componentName&&this.remove(o)}}catch(t){i={error:t}}finally{try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(i)throw i.error}}return[2]}))}))},h.prototype.change=function(t){var e=t.component;if("hint"===t.prop.prop[0]){var n=this.cache.get(e.a11yId);null==n||n.setAttribute("aria-label",e.hint),n&&this.setPosition(n,t.gameObject.transform)}},h.prototype.remove=function(t){var e=t.component;if(e){var n=e.a11yId,r=this.div.querySelector("#"+n);r&&this.div.removeChild(r),this.cache.delete(n)}},h.prototype.add=function(t){var e=this;if(this.activate){var n=t.component,r=t.gameObject,o=n.delay,i=n.a11yId,a=n.event;if(r){var s=r.transform;if(s){var c=document.createElement("div");this.cache.set(i,c),a||(a=r.getComponent("Event")),setTimeout((function(){e.setPosition(c,s),e.setA11yAttr(c,n),a&&e.addEvent(r),r.scene&&e.div.appendChild(c)}),o||this.delay)}}}},h.prototype.transformChange=function(t){var e=t.component,n=t.gameObject.getComponent(b);if(n){var r=n.a11yId;if(e.inScene){if(this.cache.has(r)){var o=this.cache.get(r);o&&this.div.appendChild(o)}}else{var i=this.div.querySelector("#"+r);i&&this.div.removeChild(i)}}},h.prototype.setEvent=function(t,e,n,r){if(e){var o=A.bind(this,e,n);this.eventCache.set(r,o),t.addEventListener("click",o)}},h.prototype.addEvent=function(t){var e=t.getComponent(b);if(e){var n=t.getComponent("Event");if(n){var r=this.cache.get(e.a11yId);r&&this.setEvent(r,n,t,e.a11yId)}}},h.prototype.removeEvent=function(t){var e=t.gameObject.getComponent(b);if(e&&t.component){var n=e.a11yId,r=this.eventCache.get(n),o=this.cache.get(n);o&&o.removeEventListener("click",r)}},h.prototype.setA11yAttr=function(t,e){var n,r,o,i,a,s,c=e.hint,h=e.props,p=void 0===h?{}:h,l=e.state,d=void 0===l?{}:l,v=e.role,f=e.a11yId,y=v||"text";t.setAttribute("role",y),t.setAttribute("aria-label",c),t.id=f;var g=Object.keys(p);try{for(var m=u(g),b=m.next();!b.done;b=m.next()){var E=b.value;t.setAttribute(E,p[E])}}catch(t){n={error:t}}finally{try{b&&!b.done&&(r=m.return)&&r.call(m)}finally{if(n)throw n.error}}var A=Object.keys(d);try{for(var O=u(A),x=O.next();!x.done;x=O.next()){E=x.value;t.setAttribute(E,d[E])}}catch(t){o={error:t}}finally{try{x&&!x.done&&(i=O.return)&&i.call(O)}finally{if(o)throw o.error}}try{for(var C=u(Object.keys(e)),I=C.next();!I.done;I=C.next()){"string"==typeof e[E=I.value]&&-1===w.indexOf(E)&&1!==E.indexOf("_")&&t.setAttribute(E,e[E])}}catch(t){a={error:t}}finally{try{I&&!I.done&&(s=C.return)&&s.call(C)}finally{if(a)throw a.error}}},h.prototype.setPosition=function(t,e){var n=e.size,r=n.width,o=n.height,a={width:0===r?1:r*this.ratioX,height:0===o?1:o*this.ratioY,position:E,zIndex:this.zIndex,pointerEvents:v.AUTO,background:this.debug?f.DEBUG:f.NONE},s=i({},e);g(t,a),function(t,e,n,r){var o=e.worldTransform,i="matrix("+o.a+", "+o.b+", "+o.c+", "+o.d+", "+o.tx*n+", "+o.ty*r+")";t.style.transform=""+i,t.style.webkitTransform=""+i,t.style.transformOrigin="left top",t.style.webkitTransformOrigin="left top"}(t,s,this.ratioX,this.ratioY)},h.prototype.onDestroy=function(){this.div.parentElement.removeChild(this.div),this.cache=null,this.eventCache=null,this.div=null},h.systemName="A11ySystem",h=a([e.decorators.componentObserver({A11y:["hint"],Transform:["inScene"],Event:[]})],h)}(e.System);return t.A11y=b,t.A11ySystem=O,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA,EVA.plugin.renderer);window.EVA.plugin.a11y=window.EVA.plugin.a11y||_EVA_IIFE_a11y;
@@ -0,0 +1,526 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ import { documentAlias, windowAlias } from '@eva/miniprogram-adapter';
3
+ import { __extends, __decorate, __awaiter, __generator, __values, __assign } from 'tslib';
4
+ import { Component, OBSERVER_TYPE, decorators, System } from '@eva/eva.js/dist/miniprogram';
5
+ import { RendererSystem } from '@eva/plugin-renderer/dist/miniprogram';
6
+ import { type, step } from '@eva/inspector-decorator';
7
+ function uuid(len) {
8
+ var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
9
+ var uuid = [];
10
+ var radix = chars.length;
11
+ for (var i = 0; i < len; i++) {
12
+ uuid[i] = chars[0 | Math.random() * radix];
13
+ }
14
+ return uuid.join('');
15
+ }
16
+ var setStyle = function setStyle(element, style) {
17
+ var width = style.width,
18
+ height = style.height,
19
+ position = style.position,
20
+ _a = style.left,
21
+ left = _a === void 0 ? 0 : _a,
22
+ _b = style.top,
23
+ top = _b === void 0 ? 0 : _b,
24
+ zIndex = style.zIndex,
25
+ pointerEvents = style.pointerEvents,
26
+ background = style.background;
27
+ element.style.width = width + "px";
28
+ element.style.height = height + "px";
29
+ element.style.position = position;
30
+ element.style.left = "" + left;
31
+ element.style.top = "" + top;
32
+ element.style.zIndex = "" + zIndex;
33
+ element.style.pointerEvents = pointerEvents;
34
+ element.style.background = background;
35
+ element.style.border = 'none';
36
+ element.style.overflow = 'hidden';
37
+ };
38
+ var setTransform = function setTransform(element, transform, ratioX, ratioY) {
39
+ var worldTransform = transform.worldTransform;
40
+ var a = worldTransform.a,
41
+ b = worldTransform.b,
42
+ c = worldTransform.c,
43
+ d = worldTransform.d,
44
+ tx = worldTransform.tx,
45
+ ty = worldTransform.ty;
46
+ var matrix = "matrix(" + a + ", " + b + ", " + c + ", " + d + ", " + tx * ratioX + ", " + ty * ratioY + ")";
47
+ element.style.transform = "" + matrix;
48
+ element.style.webkitTransform = "" + matrix;
49
+ element.style.transformOrigin = 'left top';
50
+ element.style.webkitTransformOrigin = 'left top';
51
+ };
52
+ var A11y = function (_super) {
53
+ __extends(A11y, _super);
54
+ function A11y(param) {
55
+ var _this = _super.call(this) || this;
56
+ _extends(_this, param);
57
+ var _a = param.hint,
58
+ hint = _a === void 0 ? '' : _a,
59
+ event = param.event,
60
+ _b = param.delay,
61
+ delay = _b === void 0 ? 0 : _b,
62
+ _c = param.attr,
63
+ attr = _c === void 0 ? {} : _c,
64
+ _d = param.role,
65
+ role = _d === void 0 ? '' : _d,
66
+ _e = param.props,
67
+ props = _e === void 0 ? {} : _e,
68
+ _f = param.state,
69
+ state = _f === void 0 ? {} : _f;
70
+ _this.hint = hint;
71
+ _this.event = event;
72
+ _this.delay = delay;
73
+ _this.attr = attr;
74
+ _this.role = role;
75
+ _this.props = props;
76
+ _this.state = state;
77
+ _this.a11yId = "_" + uuid(6);
78
+ return _this;
79
+ }
80
+ A11y.componentName = 'A11y';
81
+ __decorate([type('boolean')], A11y.prototype, "interactive", void 0);
82
+ __decorate([type('string')], A11y.prototype, "hint", void 0);
83
+ __decorate([type('number'), step(1)], A11y.prototype, "delay", void 0);
84
+ __decorate([type('string')], A11y.prototype, "role", void 0);
85
+ __decorate([type('string')], A11y.prototype, "a11yId", void 0);
86
+ return A11y;
87
+ }(Component);
88
+ var A11y$1 = A11y;
89
+ var POSITION = 'absolute';
90
+ var ZINDEX = 3;
91
+ var A11yActivate;
92
+ (function (A11yActivate) {
93
+ A11yActivate[A11yActivate["ENABLE"] = 0] = "ENABLE";
94
+ A11yActivate[A11yActivate["DISABLE"] = 1] = "DISABLE";
95
+ A11yActivate[A11yActivate["CHECK"] = 2] = "CHECK";
96
+ })(A11yActivate || (A11yActivate = {}));
97
+ var PointerEvents;
98
+ (function (PointerEvents) {
99
+ PointerEvents["NONE"] = "none";
100
+ PointerEvents["AUTO"] = "auto";
101
+ })(PointerEvents || (PointerEvents = {}));
102
+ var MaskBackground;
103
+ (function (MaskBackground) {
104
+ MaskBackground["DEBUG"] = "rgba(255,0,0,0.5)";
105
+ MaskBackground["NONE"] = "transparent";
106
+ })(MaskBackground || (MaskBackground = {}));
107
+ var ElementType;
108
+ (function (ElementType) {
109
+ ElementType["BUTTON"] = "button";
110
+ ElementType["DIV"] = "div";
111
+ })(ElementType || (ElementType = {}));
112
+ var notAttr = ['hint', 'event', 'delay', 'attr', 'role', 'props', 'state', 'a11yId', 'name'];
113
+ var getEventFunc = function getEventFunc(event, gameObject, e) {
114
+ var _this = this;
115
+ ['touchstart', 'touchend', 'tap'].forEach(function (name) {
116
+ event.emit(name, {
117
+ stopPropagation: function stopPropagation() {
118
+ return e.stopPropagation();
119
+ },
120
+ data: {
121
+ position: _this.eventPosition
122
+ },
123
+ gameObject: gameObject
124
+ });
125
+ });
126
+ };
127
+ var A11ySystem = function (_super) {
128
+ __extends(A11ySystem, _super);
129
+ function A11ySystem(opt) {
130
+ var _this = _super.call(this, opt) || this;
131
+ _this.cache = new Map();
132
+ _this.eventCache = new Map();
133
+ _this.zIndex = ZINDEX;
134
+ return _this;
135
+ }
136
+ Object.defineProperty(A11ySystem.prototype, "ratioX", {
137
+ get: function get() {
138
+ if (this._ratioX) {
139
+ return this._ratioX;
140
+ } else {
141
+ var success = this.setRatio();
142
+ if (success) {
143
+ return this._ratioX;
144
+ } else {
145
+ return 0;
146
+ }
147
+ }
148
+ },
149
+ enumerable: false,
150
+ configurable: true
151
+ });
152
+ Object.defineProperty(A11ySystem.prototype, "ratioY", {
153
+ get: function get() {
154
+ if (this._ratioY) {
155
+ return this._ratioY;
156
+ } else {
157
+ var success = this.setRatio();
158
+ if (success) {
159
+ return this._ratioY;
160
+ } else {
161
+ return 0;
162
+ }
163
+ }
164
+ },
165
+ enumerable: false,
166
+ configurable: true
167
+ });
168
+ A11ySystem.prototype.init = function (opt) {
169
+ if (opt === void 0) {
170
+ opt = {};
171
+ }
172
+ return __awaiter(this, void 0, void 0, function () {
173
+ var _a, activate, _b, delay, _c, checkA11yOpen, zIndex, _d, _e, div;
174
+ return __generator(this, function (_f) {
175
+ switch (_f.label) {
176
+ case 0:
177
+ _a = opt.activate, activate = _a === void 0 ? A11yActivate.CHECK : _a, _b = opt.delay, delay = _b === void 0 ? 100 : _b, _c = opt.checkA11yOpen, checkA11yOpen = _c === void 0 ? function () {
178
+ return Promise.resolve(false);
179
+ } : _c, zIndex = opt.zIndex;
180
+ this.delay = delay;
181
+ this.zIndex = zIndex || this.zIndex;
182
+ _d = activate;
183
+ switch (_d) {
184
+ case A11yActivate.CHECK:
185
+ return [3, 1];
186
+ case A11yActivate.DISABLE:
187
+ return [3, 5];
188
+ case A11yActivate.ENABLE:
189
+ return [3, 6];
190
+ }
191
+ return [3, 7];
192
+ case 1:
193
+ _f.trys.push([1, 3,, 4]);
194
+ _e = this;
195
+ return [4, checkA11yOpen()];
196
+ case 2:
197
+ _e.activate = _f.sent();
198
+ return [3, 4];
199
+ case 3:
200
+ _f.sent();
201
+ this.activate = false;
202
+ return [3, 4];
203
+ case 4:
204
+ return [3, 7];
205
+ case 5:
206
+ this.activate = false;
207
+ return [3, 7];
208
+ case 6:
209
+ this.activate = true;
210
+ return [3, 7];
211
+ case 7:
212
+ this.debug = opt.debug || false;
213
+ if (this.debug) {
214
+ this.activate = true;
215
+ }
216
+ if (!this.activate) return [2];
217
+ div = documentAlias.createElement('div');
218
+ this.div = div;
219
+ if (this.game.canvas.parentNode) {
220
+ this.game.canvas.parentNode.insertBefore(this.div, this.game.canvas);
221
+ }
222
+ return [2];
223
+ }
224
+ });
225
+ });
226
+ };
227
+ A11ySystem.prototype.setRatio = function () {
228
+ var _a = this.getCanvasBoundingClientRect(),
229
+ width = _a.width,
230
+ height = _a.height;
231
+ var _b = this.getRenderRect(),
232
+ renderWidth = _b.renderWidth,
233
+ renderHeight = _b.renderHeight;
234
+ this._ratioX = width / renderWidth;
235
+ this._ratioY = height / renderHeight;
236
+ if (width || height) {
237
+ this.initDiv();
238
+ return true;
239
+ } else {
240
+ return false;
241
+ }
242
+ };
243
+ A11ySystem.prototype.getRenderRect = function () {
244
+ var _a = this.game.getSystem(RendererSystem).params,
245
+ params = _a === void 0 ? {
246
+ width: 300,
247
+ height: 300
248
+ } : _a;
249
+ var renderHeight = params.height,
250
+ renderWidth = params.width;
251
+ return {
252
+ renderWidth: renderWidth,
253
+ renderHeight: renderHeight
254
+ };
255
+ };
256
+ A11ySystem.prototype.getCanvasBoundingClientRect = function () {
257
+ var _a = this.game.canvas.getBoundingClientRect(),
258
+ width = _a.width,
259
+ height = _a.height,
260
+ left = _a.left,
261
+ top = _a.top;
262
+ return {
263
+ width: width,
264
+ height: height,
265
+ left: left,
266
+ top: top
267
+ };
268
+ };
269
+ A11ySystem.prototype.initDiv = function () {
270
+ var _this = this;
271
+ var pageXOffset = windowAlias.pageXOffset,
272
+ pageYOffset = windowAlias.pageYOffset;
273
+ var _a = this.getCanvasBoundingClientRect(),
274
+ width = _a.width,
275
+ height = _a.height,
276
+ left = _a.left,
277
+ top = _a.top;
278
+ var style = {
279
+ width: width,
280
+ height: height,
281
+ left: left + pageXOffset + "px",
282
+ top: top + pageYOffset + "px",
283
+ position: POSITION,
284
+ zIndex: this.zIndex,
285
+ pointerEvents: PointerEvents.NONE,
286
+ background: MaskBackground.NONE
287
+ };
288
+ setStyle(this.div, style);
289
+ this.div.addEventListener('click', function (e) {
290
+ var currentTarget = e.currentTarget;
291
+ var _a = currentTarget.getBoundingClientRect(),
292
+ left = _a.left,
293
+ top = _a.top;
294
+ var x = (e.pageX - left) / _this.ratioX;
295
+ var y = (e.pageY - top) / _this.ratioY;
296
+ _this.eventPosition = {
297
+ x: x,
298
+ y: y
299
+ };
300
+ }, true);
301
+ };
302
+ A11ySystem.prototype.update = function () {
303
+ return __awaiter(this, void 0, void 0, function () {
304
+ var changes, changes_1, changes_1_1, changed;
305
+ var e_1, _a;
306
+ return __generator(this, function (_b) {
307
+ changes = this.componentObserver.clear();
308
+ if (!this.activate) {
309
+ return [2];
310
+ }
311
+ try {
312
+ for (changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
313
+ changed = changes_1_1.value;
314
+ switch (changed.type) {
315
+ case OBSERVER_TYPE.ADD:
316
+ changed.componentName === 'Event' && this.addEvent(changed.gameObject);
317
+ changed.componentName === 'A11y' && this.add(changed);
318
+ break;
319
+ case OBSERVER_TYPE.CHANGE:
320
+ changed.componentName === 'Transform' && this.transformChange(changed);
321
+ changed.componentName === 'A11y' && this.change(changed);
322
+ break;
323
+ case OBSERVER_TYPE.REMOVE:
324
+ changed.componentName === 'Event' && this.removeEvent(changed);
325
+ changed.componentName === 'A11y' && this.remove(changed);
326
+ }
327
+ }
328
+ } catch (e_1_1) {
329
+ e_1 = {
330
+ error: e_1_1
331
+ };
332
+ } finally {
333
+ try {
334
+ if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
335
+ } finally {
336
+ if (e_1) throw e_1.error;
337
+ }
338
+ }
339
+ return [2];
340
+ });
341
+ });
342
+ };
343
+ A11ySystem.prototype.change = function (changed) {
344
+ var component = changed.component;
345
+ if (changed.prop.prop[0] === 'hint') {
346
+ var dom = this.cache.get(component.a11yId);
347
+ dom === null || dom === void 0 ? void 0 : dom.setAttribute('aria-label', component.hint);
348
+ dom && this.setPosition(dom, changed.gameObject.transform);
349
+ }
350
+ };
351
+ A11ySystem.prototype.remove = function (changed) {
352
+ var component = changed.component;
353
+ if (!component) return;
354
+ var a11yId = component.a11yId;
355
+ var element = this.div.querySelector("#" + a11yId);
356
+ element && this.div.removeChild(element);
357
+ this.cache.delete(a11yId);
358
+ };
359
+ A11ySystem.prototype.add = function (changed) {
360
+ var _this = this;
361
+ if (!this.activate) return;
362
+ var component = changed.component;
363
+ var gameObject = changed.gameObject;
364
+ var delay = component.delay,
365
+ id = component.a11yId;
366
+ var event = component.event;
367
+ if (!gameObject) return;
368
+ var transform = gameObject.transform;
369
+ if (!transform) return;
370
+ var element = documentAlias.createElement('div');
371
+ this.cache.set(id, element);
372
+ if (!event) {
373
+ event = gameObject.getComponent('Event');
374
+ }
375
+ setTimeout(function () {
376
+ _this.setPosition(element, transform);
377
+ _this.setA11yAttr(element, component);
378
+ if (event) {
379
+ _this.addEvent(gameObject);
380
+ }
381
+ if (gameObject.scene) {
382
+ _this.div.appendChild(element);
383
+ }
384
+ }, delay || this.delay);
385
+ };
386
+ A11ySystem.prototype.transformChange = function (changed) {
387
+ var component = changed.component;
388
+ var gameObject = changed.gameObject;
389
+ var a11yComponent = gameObject.getComponent(A11y$1);
390
+ if (!a11yComponent) return;
391
+ var a11yId = a11yComponent.a11yId;
392
+ if (!component.inScene) {
393
+ var dom = this.div.querySelector("#" + a11yId);
394
+ dom && this.div.removeChild(dom);
395
+ } else {
396
+ if (this.cache.has(a11yId)) {
397
+ var addDom = this.cache.get(a11yId);
398
+ addDom && this.div.appendChild(addDom);
399
+ }
400
+ }
401
+ };
402
+ A11ySystem.prototype.setEvent = function (element, event, gameObject, id) {
403
+ if (!event) {
404
+ return;
405
+ }
406
+ var func = getEventFunc.bind(this, event, gameObject);
407
+ this.eventCache.set(id, func);
408
+ element.addEventListener('click', func);
409
+ };
410
+ A11ySystem.prototype.addEvent = function (gameObject) {
411
+ var a11y = gameObject.getComponent(A11y$1);
412
+ if (!a11y) return;
413
+ var event = gameObject.getComponent('Event');
414
+ if (!event) return;
415
+ var element = this.cache.get(a11y.a11yId);
416
+ element && this.setEvent(element, event, gameObject, a11y.a11yId);
417
+ };
418
+ A11ySystem.prototype.removeEvent = function (changed) {
419
+ var gameObject = changed.gameObject;
420
+ var a11y = gameObject.getComponent(A11y$1);
421
+ if (!a11y) return;
422
+ var event = changed.component;
423
+ if (!event) return;
424
+ var a11yId = a11y.a11yId;
425
+ var func = this.eventCache.get(a11yId);
426
+ var element = this.cache.get(a11yId);
427
+ element && element.removeEventListener('click', func);
428
+ };
429
+ A11ySystem.prototype.setA11yAttr = function (element, component) {
430
+ var e_2, _a, e_3, _b, e_4, _c;
431
+ var hint = component.hint,
432
+ _d = component.props,
433
+ props = _d === void 0 ? {} : _d,
434
+ _e = component.state,
435
+ state = _e === void 0 ? {} : _e,
436
+ role = component.role,
437
+ id = component.a11yId;
438
+ var realRole = role || 'text';
439
+ element.setAttribute('role', realRole);
440
+ element.setAttribute('aria-label', hint);
441
+ element.id = id;
442
+ var ariaProps = Object.keys(props);
443
+ try {
444
+ for (var ariaProps_1 = __values(ariaProps), ariaProps_1_1 = ariaProps_1.next(); !ariaProps_1_1.done; ariaProps_1_1 = ariaProps_1.next()) {
445
+ var key = ariaProps_1_1.value;
446
+ element.setAttribute(key, props[key]);
447
+ }
448
+ } catch (e_2_1) {
449
+ e_2 = {
450
+ error: e_2_1
451
+ };
452
+ } finally {
453
+ try {
454
+ if (ariaProps_1_1 && !ariaProps_1_1.done && (_a = ariaProps_1.return)) _a.call(ariaProps_1);
455
+ } finally {
456
+ if (e_2) throw e_2.error;
457
+ }
458
+ }
459
+ var ariaState = Object.keys(state);
460
+ try {
461
+ for (var ariaState_1 = __values(ariaState), ariaState_1_1 = ariaState_1.next(); !ariaState_1_1.done; ariaState_1_1 = ariaState_1.next()) {
462
+ var key = ariaState_1_1.value;
463
+ element.setAttribute(key, state[key]);
464
+ }
465
+ } catch (e_3_1) {
466
+ e_3 = {
467
+ error: e_3_1
468
+ };
469
+ } finally {
470
+ try {
471
+ if (ariaState_1_1 && !ariaState_1_1.done && (_b = ariaState_1.return)) _b.call(ariaState_1);
472
+ } finally {
473
+ if (e_3) throw e_3.error;
474
+ }
475
+ }
476
+ try {
477
+ for (var _f = __values(Object.keys(component)), _g = _f.next(); !_g.done; _g = _f.next()) {
478
+ var key = _g.value;
479
+ if (typeof component[key] === 'string' && notAttr.indexOf(key) === -1 && key.indexOf('_') !== 1) {
480
+ element.setAttribute(key, component[key]);
481
+ }
482
+ }
483
+ } catch (e_4_1) {
484
+ e_4 = {
485
+ error: e_4_1
486
+ };
487
+ } finally {
488
+ try {
489
+ if (_g && !_g.done && (_c = _f.return)) _c.call(_f);
490
+ } finally {
491
+ if (e_4) throw e_4.error;
492
+ }
493
+ }
494
+ };
495
+ A11ySystem.prototype.setPosition = function (element, transform) {
496
+ var _a = transform.size,
497
+ width = _a.width,
498
+ height = _a.height;
499
+ var style = {
500
+ width: width === 0 ? 1 : width * this.ratioX,
501
+ height: height === 0 ? 1 : height * this.ratioY,
502
+ position: POSITION,
503
+ zIndex: this.zIndex,
504
+ pointerEvents: PointerEvents.AUTO,
505
+ background: this.debug ? MaskBackground.DEBUG : MaskBackground.NONE
506
+ };
507
+ var transformProps = __assign({}, transform);
508
+ setStyle(element, style);
509
+ setTransform(element, transformProps, this.ratioX, this.ratioY);
510
+ };
511
+ A11ySystem.prototype.onDestroy = function () {
512
+ this.div.parentElement.removeChild(this.div);
513
+ this.cache = null;
514
+ this.eventCache = null;
515
+ this.div = null;
516
+ };
517
+ A11ySystem.systemName = 'A11ySystem';
518
+ A11ySystem = __decorate([decorators.componentObserver({
519
+ A11y: ['hint'],
520
+ Transform: ['inScene'],
521
+ Event: []
522
+ })], A11ySystem);
523
+ return A11ySystem;
524
+ }(System);
525
+ var A11ySystem$1 = A11ySystem;
526
+ export { A11y$1 as A11y, A11yActivate, A11ySystem$1 as A11ySystem };