From ec706ab7abdbbdd4c5da4abbfa74dc445439ddd9 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 25 Jan 2020 20:54:34 -0500 Subject: [PATCH] style, resize, animations --- app.py | 21 +-- models.py | 61 +++++-- static/net.js | 101 ++++++++++++ static/pixi-tween.js | 1 + static/pixi.min.js | 8 + static/room.js | 354 +++++++++++++++++++++++++++++++++++++++ static/socket.io.js | 8 + static/util.js | 59 +++++++ web/room.html | 383 +------------------------------------------ 9 files changed, 596 insertions(+), 400 deletions(-) create mode 100644 static/net.js create mode 100644 static/pixi-tween.js create mode 100644 static/pixi.min.js create mode 100644 static/room.js create mode 100644 static/socket.io.js create mode 100644 static/util.js diff --git a/app.py b/app.py index 4352436..5adae5b 100644 --- a/app.py +++ b/app.py @@ -17,10 +17,6 @@ socketio = SocketIO(app, async_mode="eventlet") logger = logging.getLogger("default") -# TODO: alphanum room -# TODO: alphanum name w/max len - - @app.route("/") def page_index(): return send_file("web/index.html") @@ -58,13 +54,11 @@ class BingoNamespace(Namespace): cell = card.cells[message["cidx"]] if not cell.checked or card.last_cell == message["cidx"]: - cell.checked = not cell.checked + card.check_cell(message["cidx"]) card.last_cell = message["cidx"] db.save_card(card) - emit("card_state", { - "card": card.serialize() - }, room=room) + emit("card_state", {"card": card.serialize()}, room=room) if card.moves_until_win() == 0: game = db.get_game(room) @@ -72,7 +66,7 @@ class BingoNamespace(Namespace): if game.should_end(): game.state = GameState.ENDED - emit("game_state", {"state": game.state.name}) + emit("game_state", {"state": game.state.name}, room=room) db.save_game(game) def on_get_card(self, message): @@ -125,10 +119,8 @@ class BingoNamespace(Namespace): game.pool = message["pool"] db.save_game(game) - emit("game_state", { - "state": game.state.name, - }, room=room) - + emit("game_state", {"state": game.state.name, }, room=room) + emit("style_state", {"style": game.style}, room=room) emit("create_game_rsp", { "created": True, }) @@ -162,6 +154,9 @@ class BingoNamespace(Namespace): game = db.get_game(message["room"]) if not game: game = BingoGame(room, user.oid) + emit("style_state", { + "style": game.style + }) join_room(room) game.players.add(user.oid) diff --git a/models.py b/models.py index 2487a7b..c76407a 100644 --- a/models.py +++ b/models.py @@ -10,10 +10,11 @@ import common class BingoCell: - def __init__(self, text, checked=False, free=False): + def __init__(self, text, checked=False, free=False, shake=False): self.text = text self.free = free self.checked = checked + self.shake = shake def serialize(self): return self.__dict__ @@ -26,7 +27,8 @@ class BingoCell: return BingoCell( text=j["text"], free=bool(j["free"]), - checked=bool(j["checked"]) + checked=bool(j["checked"]), + shake=bool(j["shake"]) ) @@ -51,12 +53,30 @@ class BingoCard: } def moves_until_win(self): - return min( - *(sum(1 for c in self._row(row) if not c.checked) for row in range(0, self.size)), - *(sum(1 for c in self._col(col) if not c.checked) for col in range(0, self.size)), - sum(1 for c in self._diag_left() if not c.checked), - sum(1 for c in self._diag_right() if not c.checked), - ) + return min(sum(1 for c in line if not c.checked) for line in self._lines()) + + def _lines(self): + return [ + *(self._row(row) for row in range(0, self.size)), + *(self._col(col) for col in range(0, self.size)), + self._diag_left(), + self._diag_right(), + ] + + def check_cell(self, cell_idx): + cell = self.cells[cell_idx] + cell.checked = not cell.checked + self._update_shaking(cell) + + def _update_shaking(self, cell): + for c in self.cells: + c.shake = False + if cell.checked: + for line in self._lines(): + moves_remaining = sum(1 for c in line if not c.checked) + if cell in line and moves_remaining <= self.size / 2 and moves_remaining <= 3: + for c in line: + c.shake = not c.checked def _row(self, idx): return self.cells[idx * self.size:idx * self.size + self.size] @@ -91,8 +111,24 @@ class GameState(Enum): class BingoGame: + _default_style = { + "cell": { + "base": 0xBD93F9, + "checked": 0xFF5555, + "hover": 0xFF79C6, + "text": 0x111111 + }, + "card": { + "base": 0xFF5555, + "text": 0x50FA7B + }, + "background": 0x282A36, + "message": 0xF8F8F2, + "font": "'Roboto Mono', 'Lucida Console'" + } + def __init__(self, room, admin, mode=GameMode.FREE, pool=None, state=GameState.CREATING, - players=None, winners=None): + players=None, winners=None, style=None): self.room = room self.mode = mode self.admin = admin @@ -106,6 +142,9 @@ class BingoGame: if winners is None: winners = [] self.winners = winners + if style is None: + style = BingoGame._default_style + self.style = style def should_end(self): # TODO: add winner count @@ -126,6 +165,7 @@ class BingoGame: "pool": self.pool, "players": list(self.players), "winners": self.winners, + "style": self.style, } @staticmethod @@ -137,7 +177,8 @@ class BingoGame: admin=j["admin"], state=GameState[j["state"]], players=set(j["players"]), - winners=j["winners"] + winners=j["winners"], + style=j["style"], ) diff --git a/static/net.js b/static/net.js new file mode 100644 index 0000000..aeaa2f5 --- /dev/null +++ b/static/net.js @@ -0,0 +1,101 @@ +let SOCKET; + +function initNet() { + SOCKET = io("/socket"); + + SOCKET.on("connect", () => { + let oid = selfOid(); + if (oid) { + SOCKET.emit("join", { + room: ROOM, + name: selfName(), + oid: oid, + }); + } else { + openCreateUserModal(); + } + }); + + SOCKET.on("message", msg => { + TEXT._display(msg.text, msg.timeout) + }) + + SOCKET.on("end_message", msg => { + alert(msg.text) + }) + + SOCKET.on("game_state", msg => { + if (msg.state === "PLAYING") { + document.getElementById("create-game").style.display = "none"; + + SOCKET.emit("get_card", { + "oid": selfOid(), + "room": ROOM, + }) + } else if (msg.state === "ENDED") { + SOCKET.emit("get_end_message") + } + }) + + SOCKET.on("card_state", msg => { + if (CARDS.hasOwnProperty("SELF")) { + if (CARDS.hasOwnProperty(msg.card.oid)) { + CARDS[msg.card.oid]._update(msg.card) + } else { + const card = new BingoCard(msg.card.oid, msg.parent, XSCALE, YSCALE); + card._self = msg.card + CARDS[msg.card.oid] = card; + updateCards(); + } + } + }) + + SOCKET.on("get_card_rsp", msg => { + // Add self card + let card = new BingoCard(msg.card.oid, msg.parent, 1.0); + + card._self = msg.card; + CARDS[msg.card.oid] = card; + CARDS["SELF"] = card; + updateCards(); + }) + + SOCKET.on("join_rsp", msg => { + + if (msg.ok === false) { + openCreateUserModal(); + return; + } + + document.getElementById("create-user").style.display = "none"; + + localStorage.setItem("oid", msg.oid) + document.title = msg.oid + + if (msg.state === "CREATING") { + createGameModal(); + + } else if (msg.state === "PLAYING") { + SOCKET.emit("get_card", { + "oid": selfOid(), + "room": ROOM, + }) + } else if (msg.state === "ENDED") { + SOCKET.emit("get_end_message") + } + }); + + SOCKET.on("room_join", msg => { + // console.log(msg); + }) + + SOCKET.on("style_state", msg => { + STYLE = msg.style + APP.renderer.backgroundColor = STYLE.background; + + if (TEXT === undefined) { + TEXT = makeText(); + APP.stage.addChild(TEXT); + } + }) +} diff --git a/static/pixi-tween.js b/static/pixi-tween.js new file mode 100644 index 0000000..4a97a6c --- /dev/null +++ b/static/pixi-tween.js @@ -0,0 +1 @@ +!function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(6)},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={linear:function(){return function(t){return t}},inQuad:function(){return function(t){return t*t}},outQuad:function(){return function(t){return t*(2-t)}},inOutQuad:function(){return function(t){return t*=2,t<1?.5*t*t:-.5*(--t*(t-2)-1)}},inCubic:function(){return function(t){return t*t*t}},outCubic:function(){return function(t){return--t*t*t+1}},inOutCubic:function(){return function(t){return t*=2,t<1?.5*t*t*t:(t-=2,.5*(t*t*t+2))}},inQuart:function(){return function(t){return t*t*t*t}},outQuart:function(){return function(t){return 1- --t*t*t*t}},inOutQuart:function(){return function(t){return t*=2,t<1?.5*t*t*t*t:(t-=2,-.5*(t*t*t*t-2))}},inQuint:function(){return function(t){return t*t*t*t*t}},outQuint:function(){return function(t){return--t*t*t*t*t+1}},inOutQuint:function(){return function(t){return t*=2,t<1?.5*t*t*t*t*t:(t-=2,.5*(t*t*t*t*t+2))}},inSine:function(){return function(t){return 1-Math.cos(t*Math.PI/2)}},outSine:function(){return function(t){return Math.sin(t*Math.PI/2)}},inOutSine:function(){return function(t){return.5*(1-Math.cos(Math.PI*t))}},inExpo:function(){return function(t){return 0===t?0:Math.pow(1024,t-1)}},outExpo:function(){return function(t){return 1===t?1:1-Math.pow(2,-10*t)}},inOutExpo:function(){return function(t){return 0===t?0:1===t?1:(t*=2,t<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2))}},inCirc:function(){return function(t){return 1-Math.sqrt(1-t*t)}},outCirc:function(){return function(t){return Math.sqrt(1- --t*t)}},inOutCirc:function(){return function(t){return t*=2,t<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-2)*(t-2))+1)}},inElastic:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4;return function(n){var i=void 0;return 0===n?0:1===n?1:(!t||t<1?(t=1,i=e/4):i=e*Math.asin(1/t)/(2*Math.PI),-(t*Math.pow(2,10*(n-1))*Math.sin((n-1-i)*(2*Math.PI)/e)))}},outElastic:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4;return function(n){var i=void 0;return 0===n?0:1===n?1:(!t||t<1?(t=1,i=e/4):i=e*Math.asin(1/t)/(2*Math.PI),t*Math.pow(2,-10*n)*Math.sin((n-i)*(2*Math.PI)/e)+1)}},inOutElastic:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4;return function(n){var i=void 0;return 0===n?0:1===n?1:(!t||t<1?(t=1,i=e/4):i=e*Math.asin(1/t)/(2*Math.PI),n*=2,n<1?-.5*(t*Math.pow(2,10*(n-1))*Math.sin((n-1-i)*(2*Math.PI)/e)):t*Math.pow(2,-10*(n-1))*Math.sin((n-1-i)*(2*Math.PI)/e)*.5+1)}},inBack:function(t){return function(e){var n=t||1.70158;return e*e*((n+1)*e-n)}},outBack:function(t){return function(e){var n=t||1.70158;return--e*e*((n+1)*e+n)+1}},inOutBack:function(t){return function(e){var n=1.525*(t||1.70158);return e*=2,e<1?.5*(e*e*((n+1)*e-n)):.5*((e-2)*(e-2)*((n+1)*(e-2)+n)+2)}},inBounce:function(){return function(t){return 1-n.outBounce()(1-t)}},outBounce:function(){return function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?(t-=1.5/2.75,7.5625*t*t+.75):t<2.5/2.75?(t-=2.25/2.75,7.5625*t*t+.9375):(t-=2.625/2.75,7.5625*t*t+.984375)}},inOutBounce:function(){return function(t){return t<.5?.5*n.inBounce()(2*t):.5*n.outBounce()(2*t-1)+.5}},customArray:function(t){return t?function(t){return t}:n.linear()}};e.default=n},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t,e,n,i,r,o){for(var s in t)if(c(t[s]))u(t[s],e[s],n[s],i,r,o);else{var a=e[s],h=t[s]-e[s],l=i,f=r/l;n[s]=a+h*o(f)}}function h(t,e,n){for(var i in t)0===e[i]||e[i]||(c(n[i])?(e[i]=JSON.parse(JSON.stringify(n[i])),h(t[i],e[i],n[i])):e[i]=n[i])}function c(t){return"[object Object]"===Object.prototype.toString.call(t)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;nthis._delayTime)return void(this._delayTime+=e);this.isStarted||(this._parseData(),this.isStarted=!0,this.emit("start"));var r=this.pingPong?this.time/2:this.time;if(r>this._elapsedTime){var o=this._elapsedTime+e,s=o>=r;this._elapsedTime=s?r:o,this._apply(r);var a=this._pingPong?r+this._elapsedTime:this._elapsedTime;if(this.emit("update",a),s){if(this.pingPong&&!this._pingPong)return this._pingPong=!0,n=this._to,i=this._from,this._from=n,this._to=i,this.path&&(n=this.pathTo,i=this.pathFrom,this.pathTo=i,this.pathFrom=n),this.emit("pingpong"),void(this._elapsedTime=0);if(this.loop||this.repeat>this._repeat)return this._repeat++,this.emit("repeat",this._repeat),this._elapsedTime=0,void(this.pingPong&&this._pingPong&&(n=this._to,i=this._from,this._to=i,this._from=n,this.path&&(n=this.pathTo,i=this.pathFrom,this.pathTo=i,this.pathFrom=n),this._pingPong=!1));this.isEnded=!0,this.active=!1,this.emit("end"),this._chainTween&&(this._chainTween.addTo(this.manager),this._chainTween.start())}}}}},{key:"_parseData",value:function(){if(!this.isStarted&&(this._from||(this._from={}),h(this._to,this._from,this.target),this.path)){var t=this.path.totalDistance();this.pathReverse?(this.pathFrom=t,this.pathTo=0):(this.pathFrom=0,this.pathTo=t)}}},{key:"_apply",value:function(t){if(u(this._to,this._from,this.target,t,this._elapsedTime,this.easing),this.path){var e=this.pingPong?this.time/2:this.time,n=this.pathFrom,i=this.pathTo-this.pathFrom,r=e,o=this._elapsedTime/r,s=n+i*this.easing(o),a=this.path.getPointAtDistance(s);this.target.position.set(a.x,a.y)}}},{key:"_canUpdate",value:function(){return this.time&&this.active&&this.target}}]),e}(p.utils.EventEmitter);e.default=_},function(t,e){t.exports=PIXI},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n=this.length-1?0:2*t;return this._tmpPoint.set(this.polygon.points[e],this.polygon.points[e+1]),this._tmpPoint}},{key:"distanceBetween",value:function(t,e){this.parsePoints();var n=this.getPoint(t),i=n.x,r=n.y,o=this.getPoint(e),s=o.x,a=o.y,u=s-i,h=a-r;return Math.sqrt(u*u+h*h)}},{key:"totalDistance",value:function(){this.parsePoints(),this._tmpDistance.length=0,this._tmpDistance.push(0);for(var t=this.length,e=0,n=0;nthis.length)return this.getPoint(this.length-1);if(t%1===0)return this.getPoint(t);this._tmpPoint2.set(0,0);var e=t%1,n=this.getPoint(Math.ceil(t)),i=n.x,r=n.y,o=this.getPoint(Math.floor(t)),s=o.x,a=o.y,u=-((s-i)*e),h=-((a-r)*e);return this._tmpPoint2.set(s+u,a+h),this._tmpPoint2}},{key:"getPointAtDistance",value:function(t){this.parsePoints(),this._tmpDistance||this.totalDistance();var e=this._tmpDistance.length,n=0,i=this._tmpDistance[this._tmpDistance.length-1];t<0?t=i+t:t>i&&(t-=i);for(var r=0;r=this._tmpDistance[r]&&(n=r),!(t0?1:-1}),Number.isInteger||(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),window.ArrayBuffer||(window.ArrayBuffer=Array),window.Float32Array||(window.Float32Array=Array),window.Uint32Array||(window.Uint32Array=Array),window.Uint16Array||(window.Uint16Array=Array),window.Uint8Array||(window.Uint8Array=Array),window.Int32Array||(window.Int32Array=Array);var v=r(function(t){!function(e){var r=/iPhone/i,i=/iPod/i,n=/iPad/i,o=/\bAndroid(?:.+)Mobile\b/i,s=/Android/i,a=/\bAndroid(?:.+)SD4930UR\b/i,h=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,u=/Windows Phone/i,l=/\bWindows(?:.+)ARM\b/i,c=/BlackBerry/i,d=/BB10/i,p=/Opera Mini/i,f=/\b(CriOS|Chrome)(?:.+)Mobile/i,v=/Mobile(?:.+)Firefox\b/i;function m(t,e){return t.test(e)}function g(t){var e=t||("undefined"!=typeof navigator?navigator.userAgent:""),g=e.split("[FBAN");void 0!==g[1]&&(e=g[0]),void 0!==(g=e.split("Twitter"))[1]&&(e=g[0]);var y={apple:{phone:m(r,e)&&!m(u,e),ipod:m(i,e),tablet:!m(r,e)&&m(n,e)&&!m(u,e),device:(m(r,e)||m(i,e)||m(n,e))&&!m(u,e)},amazon:{phone:m(a,e),tablet:!m(a,e)&&m(h,e),device:m(a,e)||m(h,e)},android:{phone:!m(u,e)&&m(a,e)||!m(u,e)&&m(o,e),tablet:!m(u,e)&&!m(a,e)&&!m(o,e)&&(m(h,e)||m(s,e)),device:!m(u,e)&&(m(a,e)||m(h,e)||m(o,e)||m(s,e))||m(/\bokhttp\b/i,e)},windows:{phone:m(u,e),tablet:m(l,e),device:m(u,e)||m(l,e)},other:{blackberry:m(c,e),blackberry10:m(d,e),opera:m(p,e),firefox:m(v,e),chrome:m(f,e),device:m(c,e)||m(d,e)||m(p,e)||m(v,e)||m(f,e)}};return y.any=y.apple.device||y.android.device||y.windows.device||y.other.device,y.phone=y.apple.phone||y.android.phone||y.windows.phone,y.tablet=y.apple.tablet||y.android.tablet||y.windows.tablet,y}t.exports&&"undefined"==typeof window?t.exports=g:t.exports&&"undefined"!=typeof window?(t.exports=g(),t.exports.isMobile=g):e.isMobile=g()}(e)});v.isMobile;var m={MIPMAP_TEXTURES:1,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,SPRITE_MAX_TEXTURES:function(t){var e=!0;if(v.tablet||v.phone){if(e=!1,v.apple.device){var r=navigator.userAgent.match(/OS (\d+)_(\d+)?/);r&&parseInt(r[1],10)>=11&&(e=!0)}if(v.android.device){var i=navigator.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)>=7&&(e=!0)}}return e?t:4}(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,forceFXAA:!1,autoDensity:!1,transparent:!1,backgroundColor:0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:0,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:33071,SCALE_MODE:1,PRECISION_VERTEX:"highp",PRECISION_FRAGMENT:v.apple.device?"highp":"mediump",CAN_UPLOAD_SAME_BUFFER:!v.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},g=r(function(t){var e=Object.prototype.hasOwnProperty,r="~";function i(){}function n(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function o(t,e,i,o,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new n(i,o||t,s),h=r?r+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,i,n=[];if(0===this._eventsCount)return n;for(i in t=this._events)e.call(t,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},a.prototype.listeners=function(t){var e=r?r+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,o=i.length,s=new Array(o);n80*r){i=o=t[0],n=s=t[1];for(var f=r;fo&&(o=a),h>s&&(s=h);u=0!==(u=Math.max(o-i,s-n))?1/u:0}return T(d,p,r,i,n,u),p}function b(t,e,r,i,n){var o,s;if(n===z(t,e,r,i)>0)for(o=e;o=e;o-=i)s=H(o,t[o],t[o+1],s);return s&&F(s,s.next)&&(G(s),s=s.next),s}function E(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!F(i,i.next)&&0!==N(i.prev,i,i.next))i=i.next;else{if(G(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function T(t,e,r,i,n,o,s){if(t){!s&&o&&function(t,e,r,i){var n=t;do{null===n.z&&(n.z=M(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,r,i,n,o,s,a,h,u=1;do{for(r=t,t=null,o=null,s=0;r;){for(s++,i=r,a=0,e=0;e0||h>0&&i;)0!==a&&(0===h||!i||r.z<=i.z)?(n=r,r=r.nextZ,a--):(n=i,i=i.nextZ,h--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;r=i}o.nextZ=null,u*=2}while(s>1)}(n)}(t,i,n,o);for(var a,h,u=t;t.prev!==t.next;)if(a=t.prev,h=t.next,o?S(t,i,n,o):w(t))e.push(a.i/r),e.push(t.i/r),e.push(h.i/r),G(t),t=h.next,u=h.next;else if((t=h)===u){s?1===s?T(t=I(E(t),e,r),e,r,i,n,o,2):2===s&&P(t,e,r,i,n,o):T(E(t),e,r,i,n,o,1);break}}}function w(t){var e=t.prev,r=t,i=t.next;if(N(e,r,i)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(R(e.x,e.y,r.x,r.y,i.x,i.y,n.x,n.y)&&N(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function S(t,e,r,i){var n=t.prev,o=t,s=t.next;if(N(n,o,s)>=0)return!1;for(var a=n.xo.x?n.x>s.x?n.x:s.x:o.x>s.x?o.x:s.x,l=n.y>o.y?n.y>s.y?n.y:s.y:o.y>s.y?o.y:s.y,c=M(a,h,e,r,i),d=M(u,l,e,r,i),p=t.prevZ,f=t.nextZ;p&&p.z>=c&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&R(n.x,n.y,o.x,o.y,s.x,s.y,p.x,p.y)&&N(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&R(n.x,n.y,o.x,o.y,s.x,s.y,f.x,f.y)&&N(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&R(n.x,n.y,o.x,o.y,s.x,s.y,p.x,p.y)&&N(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&R(n.x,n.y,o.x,o.y,s.x,s.y,f.x,f.y)&&N(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function I(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!F(n,o)&&B(n,i,i.next,o)&&X(n,o)&&X(o,n)&&(e.push(n.i/r),e.push(i.i/r),e.push(o.i/r),G(i),G(i.next),i=t=o),i=i.next}while(i!==t);return E(i)}function P(t,e,r,i,n,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&L(s,a)){var h=j(s,a);return s=E(s,s.next),h=E(h,h.next),T(s,e,r,i,n,o),void T(h,e,r,i,n,o)}a=a.next}s=s.next}while(s!==t)}function A(t,e){return t.x-e.x}function O(t,e){if(e=function(t,e){var r,i=e,n=t.x,o=t.y,s=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var a=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=n&&a>s){if(s=a,a===n){if(o===i.y)return i;if(o===i.next.y)return i.next}r=i.x=i.x&&i.x>=l&&n!==i.x&&R(or.x||i.x===r.x&&D(r,i)))&&(r=i,d=h)),i=i.next}while(i!==u);return r}(t,e)){var r=j(e,t);E(r,r.next)}}function D(t,e){return N(t.prev,t,e.prev)<0&&N(e.next,t,t.next)<0}function M(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function C(t){var e=t,r=t;do{(e.x=0&&(t-s)*(i-a)-(r-s)*(e-a)>=0&&(r-s)*(o-a)-(n-s)*(i-a)>=0}function L(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&B(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(X(t,e)&&X(e,t)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(N(t.prev,t,e.prev)||N(t,e.prev,e))||F(t,e)&&N(t.prev,t,t.next)>0&&N(e.prev,e,e.next)>0)}function N(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function F(t,e){return t.x===e.x&&t.y===e.y}function B(t,e,r,i){var n=k(N(t,e,r)),o=k(N(t,e,i)),s=k(N(r,i,t)),a=k(N(r,i,e));return n!==o&&s!==a||(!(0!==n||!U(t,r,e))||(!(0!==o||!U(t,i,e))||(!(0!==s||!U(r,t,i))||!(0!==a||!U(r,e,i)))))}function U(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function k(t){return t>0?1:t<0?-1:0}function X(t,e){return N(t.prev,t,t.next)<0?N(t,e,t.next)>=0&&N(t,t.prev,e)>=0:N(t,e,t.prev)<0||N(t,t.next,e)<0}function j(t,e){var r=new Y(t.i,t.x,t.y),i=new Y(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function H(t,e,r,i){var n=new Y(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function G(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Y(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function z(t,e,r,i){for(var n=0,o=e,s=r-i;o0&&(i+=t[n-1].length,r.holes.push(i))}return r},y.default=_;var V=r(function(t,r){!function(i){var n=r&&!r.nodeType&&r,o=t&&!t.nodeType&&t,s="object"==typeof e&&e;s.global!==s&&s.window!==s&&s.self!==s||(i=s);var a,h,u=2147483647,l=36,c=1,d=26,p=38,f=700,v=72,m=128,g="-",y=/^xn--/,_=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=l-c,T=Math.floor,w=String.fromCharCode;function S(t){throw RangeError(b[t])}function I(t,e){for(var r=t.length,i=[];r--;)i[r]=e(t[r]);return i}function P(t,e){var r=t.split("@"),i="";return r.length>1&&(i=r[0]+"@",t=r[1]),i+I((t=t.replace(x,".")).split("."),e).join(".")}function A(t){for(var e,r,i=[],n=0,o=t.length;n=55296&&e<=56319&&n65535&&(e+=w((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=w(t)}).join("")}function D(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function M(t,e,r){var i=0;for(t=r?T(t/f):t>>1,t+=T(t/e);t>E*d>>1;i+=l)t=T(t/E);return T(i+(E+1)*t/(t+p))}function C(t){var e,r,i,n,o,s,a,h,p,f,y,_=[],x=t.length,b=0,E=m,w=v;for((r=t.lastIndexOf(g))<0&&(r=0),i=0;i=128&&S("not-basic"),_.push(t.charCodeAt(i));for(n=r>0?r+1:0;n=x&&S("invalid-input"),((h=(y=t.charCodeAt(n++))-48<10?y-22:y-65<26?y-65:y-97<26?y-97:l)>=l||h>T((u-b)/s))&&S("overflow"),b+=h*s,!(h<(p=a<=w?c:a>=w+d?d:a-w));a+=l)s>T(u/(f=l-p))&&S("overflow"),s*=f;w=M(b-o,e=_.length+1,0==o),T(b/e)>u-E&&S("overflow"),E+=T(b/e),b%=e,_.splice(b++,0,E)}return O(_)}function R(t){var e,r,i,n,o,s,a,h,p,f,y,_,x,b,E,I=[];for(_=(t=A(t)).length,e=m,r=0,o=v,s=0;s<_;++s)(y=t[s])<128&&I.push(w(y));for(i=n=I.length,n&&I.push(g);i<_;){for(a=u,s=0;s<_;++s)(y=t[s])>=e&&yT((u-r)/(x=i+1))&&S("overflow"),r+=(a-e)*x,e=a,s=0;s<_;++s)if((y=t[s])u&&S("overflow"),y==e){for(h=r,p=l;!(h<(f=p<=o?c:p>=o+d?d:p-o));p+=l)E=h-f,b=l-f,I.push(w(D(f+E%b,0))),h=T(E/b);I.push(w(D(h,0))),o=M(r,x,i==n),r=0,++i}++r,++e}return I.join("")}if(a={version:"1.3.2",ucs2:{decode:A,encode:O},decode:C,encode:R,toASCII:function(t){return P(t,function(t){return _.test(t)?"xn--"+R(t):t})},toUnicode:function(t){return P(t,function(t){return y.test(t)?C(t.slice(4).toLowerCase()):t})}},n&&o)if(t.exports==n)o.exports=a;else for(h in a)a.hasOwnProperty(h)&&(n[h]=a[h]);else i.punycode=a}(e)}),W={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}};W.isString,W.isObject,W.isNull,W.isNullOrUndefined;function q(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var K=function(t,e,r,i){e=e||"&",r=r||"=";var n={};if("string"!=typeof t||0===t.length)return n;var o=/\+/g;t=t.split(e);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var a=t.length;s>0&&a>s&&(a=s);for(var h=0;h=0?(u=p.substr(0,f),l=p.substr(f+1)):(u=p,l=""),c=decodeURIComponent(u),d=decodeURIComponent(l),q(n,c)?Array.isArray(n[c])?n[c].push(d):n[c]=[n[c],d]:n[c]=d}return n},Z=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},J=function(t,e,r,i){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map(function(i){var n=encodeURIComponent(Z(i))+r;return Array.isArray(t[i])?t[i].map(function(t){return n+encodeURIComponent(Z(t))}).join(e):n+encodeURIComponent(Z(t[i]))}).join(e):i?encodeURIComponent(Z(i))+r+encodeURIComponent(Z(t)):""},Q=r(function(t,e){e.decode=e.parse=K,e.encode=e.stringify=J}),$=(Q.decode,Q.parse,Q.encode,Q.stringify,gt),tt=function(t,e){return gt(t,!1,!0).resolve(e)},et=function(t,e){if(!t)return e;return gt(t,!1,!0).resolveObject(e)},rt=function(t){W.isString(t)&&(t=gt(t));if(!(t instanceof nt))return nt.prototype.format.call(t);return t.format()},it=nt;function nt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var ot=/^([a-z0-9.+-]+:)/i,st=/:[0-9]*$/,at=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,ht=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),ut=["'"].concat(ht),lt=["%","/","?",";","#"].concat(ut),ct=["/","?","#"],dt=/^[+a-z0-9A-Z_-]{0,63}$/,pt=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ft={javascript:!0,"javascript:":!0},vt={javascript:!0,"javascript:":!0},mt={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function gt(t,e,r){if(t&&W.isObject(t)&&t instanceof nt)return t;var i=new nt;return i.parse(t,e,r),i}nt.prototype.parse=function(t,e,r){if(!W.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),n=-1!==i&&i127?x+="x":x+=_[b];if(!x.match(dt)){var T=g.slice(0,f),w=g.slice(f+1),S=_.match(pt);S&&(T.push(S[1]),w.unshift(S[2])),w.length&&(s="/"+w.join(".")+s),this.hostname=T.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),m||(this.hostname=V.toASCII(this.hostname));var I=this.port?":"+this.port:"",P=this.hostname||"";this.host=P+I,this.href+=this.host,m&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!ft[u])for(f=0,y=ut.length;f0)&&r.host.split("@"))&&(r.auth=S.shift(),r.host=r.hostname=S.shift());return r.search=t.search,r.query=t.query,W.isNull(r.pathname)&&W.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!_.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var b=_.slice(-1)[0],E=(r.host||t.host||_.length>1)&&("."===b||".."===b)||""===b,T=0,w=_.length;w>=0;w--)"."===(b=_[w])?_.splice(w,1):".."===b?(_.splice(w,1),T++):T&&(_.splice(w,1),T--);if(!g&&!y)for(;T--;T)_.unshift("..");!g||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),E&&"/"!==_.join("/").substr(-1)&&_.push("");var S,I=""===_[0]||_[0]&&"/"===_[0].charAt(0);x&&(r.hostname=r.host=I?"":_.length?_.shift():"",(S=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=S.shift(),r.host=r.hostname=S.shift()));return(g=g||r.host&&_.length)&&!I&&_.unshift(""),_.length?r.pathname=_.join("/"):(r.pathname=null,r.path=null),W.isNull(r.pathname)&&W.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},nt.prototype.parseHost=function(){var t=this.host,e=st.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};var yt,_t,xt,bt,Et,Tt,wt,St,It,Pt,At,Ot,Dt,Mt,Ct={parse:$,resolve:tt,resolveObject:et,format:rt,Url:it};(yt=t.ENV||(t.ENV={}))[yt.WEBGL_LEGACY=0]="WEBGL_LEGACY",yt[yt.WEBGL=1]="WEBGL",yt[yt.WEBGL2=2]="WEBGL2",(_t=t.RENDERER_TYPE||(t.RENDERER_TYPE={}))[_t.UNKNOWN=0]="UNKNOWN",_t[_t.WEBGL=1]="WEBGL",_t[_t.CANVAS=2]="CANVAS",(xt=t.BLEND_MODES||(t.BLEND_MODES={}))[xt.NORMAL=0]="NORMAL",xt[xt.ADD=1]="ADD",xt[xt.MULTIPLY=2]="MULTIPLY",xt[xt.SCREEN=3]="SCREEN",xt[xt.OVERLAY=4]="OVERLAY",xt[xt.DARKEN=5]="DARKEN",xt[xt.LIGHTEN=6]="LIGHTEN",xt[xt.COLOR_DODGE=7]="COLOR_DODGE",xt[xt.COLOR_BURN=8]="COLOR_BURN",xt[xt.HARD_LIGHT=9]="HARD_LIGHT",xt[xt.SOFT_LIGHT=10]="SOFT_LIGHT",xt[xt.DIFFERENCE=11]="DIFFERENCE",xt[xt.EXCLUSION=12]="EXCLUSION",xt[xt.HUE=13]="HUE",xt[xt.SATURATION=14]="SATURATION",xt[xt.COLOR=15]="COLOR",xt[xt.LUMINOSITY=16]="LUMINOSITY",xt[xt.NORMAL_NPM=17]="NORMAL_NPM",xt[xt.ADD_NPM=18]="ADD_NPM",xt[xt.SCREEN_NPM=19]="SCREEN_NPM",xt[xt.NONE=20]="NONE",xt[xt.SRC_OVER=0]="SRC_OVER",xt[xt.SRC_IN=21]="SRC_IN",xt[xt.SRC_OUT=22]="SRC_OUT",xt[xt.SRC_ATOP=23]="SRC_ATOP",xt[xt.DST_OVER=24]="DST_OVER",xt[xt.DST_IN=25]="DST_IN",xt[xt.DST_OUT=26]="DST_OUT",xt[xt.DST_ATOP=27]="DST_ATOP",xt[xt.ERASE=26]="ERASE",xt[xt.SUBTRACT=28]="SUBTRACT",xt[xt.XOR=29]="XOR",(bt=t.DRAW_MODES||(t.DRAW_MODES={}))[bt.POINTS=0]="POINTS",bt[bt.LINES=1]="LINES",bt[bt.LINE_LOOP=2]="LINE_LOOP",bt[bt.LINE_STRIP=3]="LINE_STRIP",bt[bt.TRIANGLES=4]="TRIANGLES",bt[bt.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",bt[bt.TRIANGLE_FAN=6]="TRIANGLE_FAN",(Et=t.FORMATS||(t.FORMATS={}))[Et.RGBA=6408]="RGBA",Et[Et.RGB=6407]="RGB",Et[Et.ALPHA=6406]="ALPHA",Et[Et.LUMINANCE=6409]="LUMINANCE",Et[Et.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",Et[Et.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",Et[Et.DEPTH_STENCIL=34041]="DEPTH_STENCIL",(Tt=t.TARGETS||(t.TARGETS={}))[Tt.TEXTURE_2D=3553]="TEXTURE_2D",Tt[Tt.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",Tt[Tt.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",Tt[Tt.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",Tt[Tt.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",Tt[Tt.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",Tt[Tt.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",Tt[Tt.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",Tt[Tt.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",(wt=t.TYPES||(t.TYPES={}))[wt.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",wt[wt.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",wt[wt.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",wt[wt.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",wt[wt.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",wt[wt.FLOAT=5126]="FLOAT",wt[wt.HALF_FLOAT=36193]="HALF_FLOAT",(St=t.SCALE_MODES||(t.SCALE_MODES={}))[St.NEAREST=0]="NEAREST",St[St.LINEAR=1]="LINEAR",(It=t.WRAP_MODES||(t.WRAP_MODES={}))[It.CLAMP=33071]="CLAMP",It[It.REPEAT=10497]="REPEAT",It[It.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",(Pt=t.MIPMAP_MODES||(t.MIPMAP_MODES={}))[Pt.OFF=0]="OFF",Pt[Pt.POW2=1]="POW2",Pt[Pt.ON=2]="ON",(At=t.ALPHA_MODES||(t.ALPHA_MODES={}))[At.NPM=0]="NPM",At[At.UNPACK=1]="UNPACK",At[At.PMA=2]="PMA",At[At.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",At[At.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",At[At.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",(Ot=t.GC_MODES||(t.GC_MODES={}))[Ot.AUTO=0]="AUTO",Ot[Ot.MANUAL=1]="MANUAL",(Dt=t.PRECISION||(t.PRECISION={})).LOW="lowp",Dt.MEDIUM="mediump",Dt.HIGH="highp",(Mt=t.MASK_TYPES||(t.MASK_TYPES={}))[Mt.NONE=0]="NONE",Mt[Mt.SCISSOR=1]="SCISSOR",Mt[Mt.STENCIL=2]="STENCIL",Mt[Mt.SPRITE=3]="SPRITE",m.RETINA_PREFIX=/@([0-9\.]+)x/,m.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!0;var Rt,Lt=!1,Nt="5.2.0";function Ft(t){if(!Lt){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var e=["\n %c %c %c PixiJS "+Nt+" - ✰ "+t+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];window.console.log.apply(console,e)}else window.console&&window.console.log("PixiJS "+Nt+" - "+t+" - http://www.pixijs.com/");Lt=!0}}function Bt(){return void 0===Rt&&(Rt=function(){var t={stencil:!0,failIfMajorPerformanceCaveat:m.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!window.WebGLRenderingContext)return!1;var e=document.createElement("canvas"),r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),i=!(!r||!r.getContextAttributes().stencil);if(r){var n=r.getExtension("WEBGL_lose_context");n&&n.loseContext()}return r=null,i}catch(t){return!1}}()),Rt}function Ut(t,e){return(e=e||[])[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255,e}function kt(t){return t=t.toString(16),"#"+(t="000000".substr(0,6-t.length)+t)}function Xt(t){return"string"==typeof t&&"#"===t[0]&&(t=t.substr(1)),parseInt(t,16)}var jt=function(){for(var e=[],r=[],i=0;i<32;i++)e[i]=i,r[i]=i;e[t.BLEND_MODES.NORMAL_NPM]=t.BLEND_MODES.NORMAL,e[t.BLEND_MODES.ADD_NPM]=t.BLEND_MODES.ADD,e[t.BLEND_MODES.SCREEN_NPM]=t.BLEND_MODES.SCREEN,r[t.BLEND_MODES.NORMAL]=t.BLEND_MODES.NORMAL_NPM,r[t.BLEND_MODES.ADD]=t.BLEND_MODES.ADD_NPM,r[t.BLEND_MODES.SCREEN]=t.BLEND_MODES.SCREEN_NPM;var n=[];return n.push(r),n.push(e),n}();function Ht(t,e){return jt[e?1:0][t]}function Gt(t,e,r,i){return r=r||new Float32Array(4),i||void 0===i?(r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e):(r[0]=t[0],r[1]=t[1],r[2]=t[2]),r[3]=e,r}function Yt(t,e){if(1===e)return(255*e<<24)+t;if(0===e)return 0;var r=t>>16&255,i=t>>8&255,n=255&t;return(255*e<<24)+((r=r*e+.5|0)<<16)+((i=i*e+.5|0)<<8)+(n=n*e+.5|0)}function zt(t,e,r,i){return(r=r||new Float32Array(4))[0]=(t>>16&255)/255,r[1]=(t>>8&255)/255,r[2]=(255&t)/255,(i||void 0===i)&&(r[0]*=e,r[1]*=e,r[2]*=e),r[3]=e,r}function Vt(t,e){void 0===e&&(e=null);var r=6*t;if((e=e||new Uint16Array(r)).length!==r)throw new Error("Out buffer length is incorrect, got "+e.length+" and expected "+r);for(var i=0,n=0;i=n||0===r)){var o=n-(r=e+r>n?n-e:r);for(i=e;i>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function Qt(t){return!(t&t-1||!t)}function $t(t){var e=(t>65535)<<4,r=((t>>>=e)>255)<<3;return e|=r,e|=r=((t>>>=r)>15)<<2,(e|=r=((t>>>=r)>3)<<1)|(t>>>=r)>>1}var te={},ee=Object.create(null),re=Object.create(null);function ie(t){var e,r,i,n=t.width,o=t.height,s=t.getContext("2d"),a=s.getImageData(0,0,n,o).data,h=a.length,u={top:null,left:null,right:null,bottom:null},l=null;for(e=0;e=0?Pe.S:Pe.N:2*Math.abs(e)<=Math.abs(t)?t>0?Pe.E:Pe.W:e>0?t>0?Pe.SE:Pe.SW:t>0?Pe.NE:Pe.NW},matrixAppendRotationInv:function(t,e,r,i){void 0===r&&(r=0),void 0===i&&(i=0);var n=Se[Pe.inv(e)];n.tx=r,n.ty=i,t.append(n)}},Ae=function(){function t(){this.worldTransform=new _e,this.localTransform=new _e,this.position=new ve(this.onChange,this,0,0),this.scale=new ve(this.onChange,this,1,1),this.pivot=new ve(this.onChange,this,0,0),this.skew=new ve(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return t.prototype.onChange=function(){this._localID++},t.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},t.prototype.updateLocalTransform=function(){var t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)},t.prototype.updateTransform=function(t){var e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){var r=t.worldTransform,i=this.worldTransform;i.a=e.a*r.a+e.b*r.c,i.b=e.a*r.b+e.b*r.d,i.c=e.c*r.a+e.d*r.c,i.d=e.c*r.b+e.d*r.d,i.tx=e.tx*r.a+e.ty*r.c+r.tx,i.ty=e.tx*r.b+e.ty*r.d+r.ty,this._parentID=t._worldID,this._worldID++}},t.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!0,configurable:!0}),t.IDENTITY=new t,t}(),Oe=function(){function e(e,r,i,n){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=Number(e),this.y=Number(r),this.width=Number(i),this.height=Number(n),this.type=t.SHAPES.RECT}return Object.defineProperty(e.prototype,"left",{get:function(){return this.x},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"right",{get:function(){return this.x+this.width},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.y},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!0,configurable:!0}),Object.defineProperty(e,"EMPTY",{get:function(){return new e(0,0,0,0)},enumerable:!0,configurable:!0}),e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},e.prototype.copyTo=function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},e.prototype.contains=function(t,e){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t=this.y&&ee!=u>e&&t<(e-a)/(u-a)*(h-s)+s&&(r=!r)}return r},e}(),Re=function(){function e(e,r,i,n,o){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=20),this.x=e,this.y=r,this.width=i,this.height=n,this.radius=o,this.type=t.SHAPES.RREC}return e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height,this.radius)},e.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){if(e>=this.y+this.radius&&e<=this.y+this.height-this.radius||t>=this.x+this.radius&&t<=this.x+this.width-this.radius)return!0;var r=t-(this.x+this.radius),i=e-(this.y+this.radius),n=this.radius*this.radius;if(r*r+i*i<=n)return!0;if((r=t-(this.x+this.width-this.radius))*r+i*i<=n)return!0;if(r*r+(i=e-(this.y+this.height-this.radius))*i<=n)return!0;if((r=t-(this.x+this.radius))*r+i*i<=n)return!0}return!1},e}();m.SORTABLE_CHILDREN=!1;var Le=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null};Le.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},Le.prototype.clear=function(){this.updateID++,this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},Le.prototype.getRectangle=function(t){return this.minX>this.maxX||this.minY>this.maxY?Oe.EMPTY:((t=t||new Oe(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},Le.prototype.addPoint=function(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)},Le.prototype.addQuad=function(t){var e=this.minX,r=this.minY,i=this.maxX,n=this.maxY,o=t[0],s=t[1];e=oi?o:i,n=s>n?s:n,e=(o=t[2])i?o:i,n=s>n?s:n,e=(o=t[4])i?o:i,n=s>n?s:n,e=(o=t[6])i?o:i,n=s>n?s:n,this.minX=e,this.minY=r,this.maxX=i,this.maxY=n},Le.prototype.addFrame=function(t,e,r,i,n){this.addFrameMatrix(t.worldTransform,e,r,i,n)},Le.prototype.addFrameMatrix=function(t,e,r,i,n){var o=t.a,s=t.b,a=t.c,h=t.d,u=t.tx,l=t.ty,c=this.minX,d=this.minY,p=this.maxX,f=this.maxY,v=o*e+a*r+u,m=s*e+h*r+l;c=vp?v:p,f=m>f?m:f,c=(v=o*i+a*r+u)p?v:p,f=m>f?m:f,c=(v=o*e+a*n+u)p?v:p,f=m>f?m:f,c=(v=o*i+a*n+u)p?v:p,f=m>f?m:f,this.minX=c,this.minY=d,this.maxX=p,this.maxY=f},Le.prototype.addVertexData=function(t,e,r){for(var i=this.minX,n=this.minY,o=this.maxX,s=this.maxY,a=e;ao?h:o,s=u>s?u:s}this.minX=i,this.minY=n,this.maxX=o,this.maxY=s},Le.prototype.addVertices=function(t,e,r,i){this.addVerticesMatrix(t.worldTransform,e,r,i)},Le.prototype.addVerticesMatrix=function(t,e,r,i,n,o){var s=t.a,a=t.b,h=t.c,u=t.d,l=t.tx,c=t.ty;n=n||0,o=o||0;for(var d=this.minX,p=this.minY,f=this.maxX,v=this.maxY,m=r;mi?t.maxX:i,this.maxY=t.maxY>n?t.maxY:n},Le.prototype.addBoundsMask=function(t,e){var r=t.minX>e.minX?t.minX:e.minX,i=t.minY>e.minY?t.minY:e.minY,n=t.maxXh?n:h,this.maxY=o>u?o:u}},Le.prototype.addBoundsMatrix=function(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)},Le.prototype.addBoundsArea=function(t,e){var r=t.minX>e.x?t.minX:e.x,i=t.minY>e.y?t.minY:e.y,n=t.maxXh?n:h,this.maxY=o>u?o:u}},Le.prototype.pad=function(t,e){t=t||0,e=e||(0!==e?t:0),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)},Le.prototype.addFramePad=function(t,e,r,i,n,o){t-=n,e-=o,r+=n,i+=o,this.minX=this.minXr?this.maxX:r,this.minY=this.minYi?this.maxY:i};var Ne=function(t){function e(){t.call(this),this.tempDisplayObjectParent=null,this.transform=new Ae,this.alpha=1,this.visible=!0,this.renderable=!0,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new Le,this._boundsID=0,this._lastBoundsID=-1,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={_tempDisplayObjectParent:{configurable:!0},x:{configurable:!0},y:{configurable:!0},worldTransform:{configurable:!0},localTransform:{configurable:!0},position:{configurable:!0},scale:{configurable:!0},pivot:{configurable:!0},skew:{configurable:!0},rotation:{configurable:!0},angle:{configurable:!0},zIndex:{configurable:!0},worldVisible:{configurable:!0},mask:{configurable:!0}};return e.mixin=function(t){for(var r=Object.keys(t),i=0;i1)for(var i=0;ithis.children.length)throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t},e.prototype.swapChildren=function(t,e){if(t!==e){var r=this.getChildIndex(t),i=this.getChildIndex(e);this.children[r]=e,this.children[i]=t,this.onChildrenChange(r=this.children.length)throw new Error("The index "+e+" supplied is out of bounds "+this.children.length);var r=this.getChildIndex(t);Wt(this.children,r,1),this.children.splice(e,0,t),this.onChildrenChange(e)},e.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},e.prototype.removeChild=function(t){var e=arguments,r=arguments.length;if(r>1)for(var i=0;i0&&o<=n){r=this.children.splice(i,o);for(var s=0;s1&&this.children.sort(Fe),this.sortDirty=!1},e.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,e=this.children.length;t title : "+t.title+"
tabIndex: "+t.tabIndex},ke.prototype.capHitArea=function(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0),t.x+t.width>this.renderer.width&&(t.width=this.renderer.width-t.x),t.y+t.height>this.renderer.height&&(t.height=this.renderer.height-t.y)},ke.prototype.addChild=function(t){var e=this.pool.pop();e||((e=document.createElement("button")).style.width="100px",e.style.height="100px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=2,e.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:t.accessibleHint&&null!==t.accessibleHint||(e.title="displayObject "+t.tabIndex),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex},ke.prototype._onClick=function(t){var e=this.renderer.plugins.interaction;e.dispatchEvent(t.target.displayObject,"click",e.eventData),e.dispatchEvent(t.target.displayObject,"pointertap",e.eventData),e.dispatchEvent(t.target.displayObject,"tap",e.eventData)},ke.prototype._onFocus=function(t){t.target.getAttribute("aria-live","off")||t.target.setAttribute("aria-live","assertive");var e=this.renderer.plugins.interaction;e.dispatchEvent(t.target.displayObject,"mouseover",e.eventData)},ke.prototype._onFocusOut=function(t){t.target.getAttribute("aria-live","off")||t.target.setAttribute("aria-live","polite");var e=this.renderer.plugins.interaction;e.dispatchEvent(t.target.displayObject,"mouseout",e.eventData)},ke.prototype._onKeyDown=function(t){9===t.keyCode&&this.activate()},ke.prototype._onMouseMove=function(t){0===t.movementX&&0===t.movementY||this.deactivate()},ke.prototype.destroy=function(){this.destroyTouchHook(),this.div=null;for(var t=0;t8)throw new Error("max arguments reached");var h=this.name,u=this.items;this._aliasCount++;for(var l=0,c=u.length;l0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},t.prototype.add=function(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this},t.prototype.remove=function(t){var e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this},t.prototype.contains=function(t){return-1!==this.items.indexOf(t)},t.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},t.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),t}();Object.defineProperties(He.prototype,{dispatch:{value:He.prototype.emit},run:{value:He.prototype.emit}}),m.TARGET_FPMS=.06,(Xe=t.UPDATE_PRIORITY||(t.UPDATE_PRIORITY={}))[Xe.INTERACTION=50]="INTERACTION",Xe[Xe.HIGH=25]="HIGH",Xe[Xe.NORMAL=0]="NORMAL",Xe[Xe.LOW=-25]="LOW",Xe[Xe.UTILITY=-50]="UTILITY";var Ge=function(){function t(t,e,r,i){void 0===e&&(e=null),void 0===r&&(r=0),void 0===i&&(i=!1),this.fn=t,this.context=e,this.priority=r,this.once=i,this.next=null,this.previous=null,this._destroyed=!1}return t.prototype.match=function(t,e){return void 0===e&&(e=null),this.fn===t&&this.context===e},t.prototype.emit=function(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));var e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e},t.prototype.connect=function(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this},t.prototype.destroy=function(t){void 0===t&&(t=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var e=this.next;return this.next=t?null:e,this.previous=null,e},t}(),Ye=function(){function e(){var t=this;this._head=new Ge(null,null,1/0),this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this.autoStart=!1,this.deltaTime=1,this.deltaMS=1/m.TARGET_FPMS,this.elapsedMS=1/m.TARGET_FPMS,this.lastTime=-1,this.speed=1,this.started=!1,this._protected=!1,this._lastFrame=-1,this._tick=function(e){t._requestId=null,t.started&&(t.update(e),t.started&&null===t._requestId&&t._head.next&&(t._requestId=requestAnimationFrame(t._tick)))}}return e.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},e.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},e.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},e.prototype.add=function(e,r,i){return void 0===i&&(i=t.UPDATE_PRIORITY.NORMAL),this._addListener(new Ge(e,r,i))},e.prototype.addOnce=function(e,r,i){return void 0===i&&(i=t.UPDATE_PRIORITY.NORMAL),this._addListener(new Ge(e,r,i,!0))},e.prototype._addListener=function(t){var e=this._head.next,r=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}else t.connect(r);return this._startIfPossible(),this},e.prototype.remove=function(t,e){for(var r=this._head.next;r;)r=r.match(t,e)?r.destroy():r.next;return this._head.next||this._cancelIfNeeded(),this},e.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},e.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},e.prototype.destroy=function(){if(!this._protected){this.stop();for(var t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},e.prototype.update=function(t){var e;if(void 0===t&&(t=performance.now()),t>this.lastTime){if((e=this.elapsedMS=t-this.lastTime)>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){var r=t-this._lastFrame|0;if(r=0;--n){var o=Ze[n];if(o.test&&o.test(t,r))return new o(t,e)}return new Ke(t,e)}var Qe=function(e){function r(t,r){var i=r||{},n=i.width,o=i.height;if(!n||!o)throw new Error("BufferResource width or height invalid");e.call(this,n,o),this.data=t}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.upload=function(e,r,i){var n=e.gl;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.alphaMode===t.ALPHA_MODES.UNPACK),i.width===r.width&&i.height===r.height?n.texSubImage2D(r.target,0,0,0,r.width,r.height,r.format,r.type,this.data):(i.width=r.width,i.height=r.height,n.texImage2D(r.target,0,i.internalFormat,r.width,r.height,0,r.format,i.type,this.data)),!0},r.prototype.dispose=function(){this.data=null},r.test=function(t){return t instanceof Float32Array||t instanceof Uint8Array||t instanceof Uint32Array},r}(Ve),$e={scaleMode:t.SCALE_MODES.NEAREST,format:t.FORMATS.RGBA,alphaMode:t.ALPHA_MODES.NPM},tr=function(e){function r(r,i){void 0===r&&(r=null),void 0===i&&(i=null),e.call(this);var n=(i=i||{}).alphaMode,o=i.mipmap,s=i.anisotropicLevel,a=i.scaleMode,h=i.width,u=i.height,l=i.wrapMode,c=i.format,d=i.type,p=i.target,f=i.resolution,v=i.resourceOptions;!r||r instanceof Ve||((r=Je(r,v)).internal=!0),this.width=h||0,this.height=u||0,this.resolution=f||m.RESOLUTION,this.mipmap=void 0!==o?o:m.MIPMAP_TEXTURES,this.anisotropicLevel=void 0!==s?s:m.ANISOTROPIC_LEVEL,this.wrapMode=l||m.WRAP_MODE,this.scaleMode=void 0!==a?a:m.SCALE_MODE,this.format=c||t.FORMATS.RGBA,this.type=d||t.TYPES.UNSIGNED_BYTE,this.target=p||t.TARGETS.TEXTURE_2D,this.alphaMode=void 0!==n?n:t.ALPHA_MODES.UNPACK,void 0!==i.premultiplyAlpha&&(this.premultiplyAlpha=i.premultiplyAlpha),this.uid=Kt(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=h>0&&u>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.setResource(r)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={realWidth:{configurable:!0},realHeight:{configurable:!0}};return i.realWidth.get=function(){return Math.ceil(this.width*this.resolution-1e-4)},i.realHeight.get=function(){return Math.ceil(this.height*this.resolution-1e-4)},r.prototype.setStyle=function(t,e){var r;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),void 0!==e&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this},r.prototype.setSize=function(t,e,r){return this.resolution=r||this.resolution,this.width=t,this.height=e,this._refreshPOT(),this.update(),this},r.prototype.setRealSize=function(t,e,r){return this.resolution=r||this.resolution,this.width=t/this.resolution,this.height=e/this.resolution,this._refreshPOT(),this.update(),this},r.prototype._refreshPOT=function(){this.isPowerOfTwo=Qt(this.realWidth)&&Qt(this.realHeight)},r.prototype.setResolution=function(t){var e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=this.width*e/t,this.height=this.height*e/t,this.emit("update",this)),this._refreshPOT(),this)},r.prototype.setResource=function(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this},r.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},r.prototype.onError=function(t){this.emit("error",this,t)},r.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete re[this.cacheId],delete ee[this.cacheId],this.cacheId=null),this.dispose(),r.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},r.prototype.dispose=function(){this.emit("dispose",this)},r.from=function(t,e,i){void 0===i&&(i=m.STRICT_TEXTURE_CACHE);var n="string"==typeof t,o=null;n?o=t:(t._pixiId||(t._pixiId="pixiid_"+Kt()),o=t._pixiId);var s=re[o];if(n&&i&&!s)throw new Error('The cacheId "'+o+'" does not exist in BaseTextureCache.');return s||((s=new r(t,e)).cacheId=o,r.addToCache(s,o)),s},r.fromBuffer=function(e,i,n,o){e=e||new Float32Array(i*n*4);var s=new Qe(e,{width:i,height:n}),a=e instanceof Float32Array?t.TYPES.FLOAT:t.TYPES.UNSIGNED_BYTE;return new r(s,Object.assign($e,o||{width:i,height:n,type:a}))},r.addToCache=function(t,e){e&&(-1===t.textureCacheIds.indexOf(e)&&t.textureCacheIds.push(e),re[e]&&console.warn("BaseTexture added to the cache with an id ["+e+"] that already had an entry"),re[e]=t)},r.removeFromCache=function(t){if("string"==typeof t){var e=re[t];if(e){var r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete re[t],e}}else if(t&&t.textureCacheIds){for(var i=0;i]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var or=function(t){function e(e,r){if(r=r||{},!(e instanceof HTMLVideoElement)){var i=document.createElement("video");i.setAttribute("preload","auto"),i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline",""),"string"==typeof e&&(e=[e]),t.crossOrigin(i,e[0].src||e[0],r.crossorigin);for(var n=0;n0&&!1===t.paused&&!1===t.ended&&t.readyState>2},e.prototype._isSourceReady=function(){return 3===this.source.readyState||4===this.source.readyState},e.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),!this._isAutoUpdating&&this.autoUpdate&&(Ye.shared.add(this.update,this),this._isAutoUpdating=!0)},e.prototype._onPlayStop=function(){this._isAutoUpdating&&(Ye.shared.remove(this.update,this),this._isAutoUpdating=!1)},e.prototype._onCanPlay=function(){var t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);var e=this.valid;this.resize(t.videoWidth,t.videoHeight),!e&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()},e.prototype.dispose=function(){this._isAutoUpdating&&Ye.shared.remove(this.update,this),this.source&&(this.source.removeEventListener("error",this._onError,!0),this.source.pause(),this.source.src="",this.source.load()),t.prototype.dispose.call(this)},r.autoUpdate.get=function(){return this._autoUpdate},r.autoUpdate.set=function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isAutoUpdating?(Ye.shared.remove(this.update,this),this._isAutoUpdating=!1):this._autoUpdate&&!this._isAutoUpdating&&(Ye.shared.add(this.update,this),this._isAutoUpdating=!0))},r.updateFPS.get=function(){return this._updateFPS},r.updateFPS.set=function(t){t!==this._updateFPS&&(this._updateFPS=t)},e.test=function(t,r){return t instanceof HTMLVideoElement||e.TYPES.indexOf(r)>-1},Object.defineProperties(e.prototype,r),e}(qe);or.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"];var sr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.test=function(t){return!!window.createImageBitmap&&t instanceof ImageBitmap},e}(qe);Ze.push(Ke,sr,rr,or,nr,Qe,ir,er);var ar={INSTALLED:Ze,autoDetectResource:Je,ArrayResource:er,BufferResource:Qe,CanvasResource:rr,CubeResource:ir,ImageResource:Ke,ImageBitmapResource:sr,SVGResource:nr,VideoResource:or,Resource:Ve,BaseImageResource:qe},hr=function(t){this.renderer=t};hr.prototype.destroy=function(){this.renderer=null};var ur=function(e){function r(){e.apply(this,arguments)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.upload=function(e,r,i){var n=e.gl;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.alphaMode===t.ALPHA_MODES.UNPACK),i.width===r.width&&i.height===r.height?n.texSubImage2D(r.target,0,0,0,r.width,r.height,r.format,r.type,this.data):(i.width=r.width,i.height=r.height,n.texImage2D(r.target,0,n.DEPTH_COMPONENT16,r.width,r.height,0,r.format,r.type,this.data)),!0},r}(Qe),lr=function(t,e){this.width=Math.ceil(t||100),this.height=Math.ceil(e||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new He("disposeFramebuffer",2)},cr={colorTexture:{configurable:!0}};cr.colorTexture.get=function(){return this.colorTextures[0]},lr.prototype.addColorTexture=function(t,e){return void 0===t&&(t=0),this.colorTextures[t]=e||new tr(null,{scaleMode:0,resolution:1,mipmap:!1,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},lr.prototype.addDepthTexture=function(e){return this.depthTexture=e||new tr(new ur(null,{width:this.width,height:this.height}),{scaleMode:0,resolution:1,width:this.width,height:this.height,mipmap:!1,format:t.FORMATS.DEPTH_COMPONENT,type:t.TYPES.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},lr.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},lr.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},lr.prototype.resize=function(t,e){if(t=Math.ceil(t),e=Math.ceil(e),t!==this.width||e!==this.height){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(var r=0;r-1&&e.textureCacheIds.splice(r,1),delete ee[t],e}}else if(t&&t.textureCacheIds){for(var i=0;ithis.baseTexture.width,s=r+n>this.baseTexture.height;if(o||s){var a=o&&s?"and":"or",h="X: "+e+" + "+i+" = "+(e+i)+" > "+this.baseTexture.width,u="Y: "+r+" + "+n+" = "+(r+n)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+h+" "+a+" "+u)}this.valid=i&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=t),this.valid&&this.updateUvs()},r.rotate.get=function(){return this._rotate},r.rotate.set=function(t){this._rotate=t,this.valid&&this.updateUvs()},r.width.get=function(){return this.orig.width},r.height.get=function(){return this.orig.height},Object.defineProperties(e.prototype,r),e}(g);function mr(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}vr.EMPTY=new vr(new tr),mr(vr.EMPTY),mr(vr.EMPTY.baseTexture),vr.WHITE=function(){var t=document.createElement("canvas");t.width=16,t.height=16;var e=t.getContext("2d");return e.fillStyle="white",e.fillRect(0,0,16,16),new vr(new tr(new rr(t)))}(),mr(vr.WHITE),mr(vr.WHITE.baseTexture);var gr=function(t){function e(e,r){var i=null;if(!(e instanceof dr)){var n=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4];console.warn("Please use RenderTexture.create("+n+", "+o+") instead of the ctor directly."),i=arguments[0],r=null,e=new dr({width:n,height:o,scaleMode:s,resolution:a})}t.call(this,e,r),this.legacyRenderer=i,this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.resize=function(t,e,r){void 0===r&&(r=!0),t=Math.ceil(t),e=Math.ceil(e),this.valid=t>0&&e>0,this._frame.width=this.orig.width=t,this._frame.height=this.orig.height=e,r&&this.baseTexture.resize(t,e),this.updateUvs()},e.prototype.setResolution=function(t){var e=this.baseTexture;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))},e.create=function(t){return"number"==typeof t&&(t={width:t,height:arguments[1],scaleMode:arguments[2],resolution:arguments[3]}),new e(new dr(t))},e}(vr),yr=function(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0};yr.prototype.createTexture=function(t,e){var r=new dr(Object.assign({width:t,height:e,resolution:1},this.textureOptions));return new gr(r)},yr.prototype.getOptimalTexture=function(t,e,r){void 0===r&&(r=1);var i=yr.SCREEN_KEY;t*=r,e*=r,this.enableFullScreen&&t===this._pixelsWidth&&e===this._pixelsHeight||(i=(65535&(t=Jt(t)))<<16|65535&(e=Jt(e))),this.texturePool[i]||(this.texturePool[i]=[]);var n=this.texturePool[i].pop();return n||(n=this.createTexture(t,e)),n.filterPoolKey=i,n.setResolution(r),n},yr.prototype.getFilterTexture=function(t,e){var r=this.getOptimalTexture(t.width,t.height,e||t.resolution);return r.filterFrame=t.filterFrame,r},yr.prototype.returnTexture=function(t){var e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)},yr.prototype.returnFilterTexture=function(t){this.returnTexture(t)},yr.prototype.clear=function(t){if(t=!1!==t)for(var e in this.texturePool){var r=this.texturePool[e];if(r)for(var i=0;i0&&t.height>0,r)for(var i=0;i1){for(var u=0;u=0;--i)t[i]=r[i]||null,t[i]&&(t[i]._batchLocation=i)},e.prototype.boundArray=function(t,e,r,i){for(var n=t.elements,o=t.ids,s=t.count,a=0,h=0;h=0&&l=t.ENV.WEBGL2&&(i=e.getContext("webgl2",r)),i)this.webGLVersion=2;else if(this.webGLVersion=1,!(i=e.getContext("webgl",r)||e.getContext("experimental-webgl",r)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),i},r.prototype.getExtensions=function(){var t=this.gl;1===this.webGLVersion?Object.assign(this.extensions,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBKIT_WEBGL_depth_texture"),loseContext:t.getExtension("WEBGL_lose_context"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,{anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),colorBufferFloat:t.getExtension("EXT_color_buffer_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear")})},r.prototype.handleContextLost=function(t){t.preventDefault()},r.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.run(this.gl)},r.prototype.destroy=function(){var t=this.renderer.view;t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},r.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},r.prototype.validateContext=function(t){t.getContextAttributes().stencil||console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly")},Object.defineProperties(r.prototype,i),r}(hr),Ur=function(e){function r(t){e.call(this,t),this.managedFramebuffers=[],this.unknownFramebuffer=new lr(10,10)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={size:{configurable:!0}};return r.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new Oe,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion){var r=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;m.PREFER_ENV===t.ENV.WEBGL_LEGACY&&(r=null,i=null),r?e.drawBuffers=function(t){return r.drawBuffersWEBGL(t)}:(this.hasMRT=!1,e.drawBuffers=function(){}),i||(this.writeDepthTexture=!1)}},r.prototype.bind=function(t,e){var r=this.gl;if(t){var i=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,i.framebuffer)),i.dirtyId!==t.dirtyId&&(i.dirtyId=t.dirtyId,i.dirtyFormat!==t.dirtyFormat?(i.dirtyFormat=t.dirtyFormat,this.updateFramebuffer(t)):i.dirtySize!==t.dirtySize&&(i.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(var n=0;n1&&e.drawBuffers(n),t.depthTexture)&&this.writeDepthTexture){var a=t.depthTexture;this.renderer.texture.bind(a,0),e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a._glTextures[this.CONTEXT_UID].texture,0)}r.stencil||!t.stencil&&!t.depth||(r.stencil=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,r.stencil),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height),t.depthTexture||e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r.stencil))},r.prototype.disposeFramebuffer=function(t,e){var r=t.glFramebuffers[this.CONTEXT_UID],i=this.gl;if(r){delete t.glFramebuffers[this.CONTEXT_UID];var n=this.managedFramebuffers.indexOf(t);n>=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(r.framebuffer),r.stencil&&i.deleteRenderbuffer(r.stencil))}},r.prototype.disposeAll=function(t){var e=this.managedFramebuffers;this.managedFramebuffers=[];for(var r=0;r=i.data.byteLength)e.bufferSubData(o,0,i.data);else{var s=i.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;n.byteLength=i.data.byteLength,e.bufferData(o,i.data,s)}}}},r.prototype.checkCompatibility=function(t,e){var r=t.attributes,i=e.attributeData;for(var n in i)if(!r[n])throw new Error('shader and geometry incompatible, geometry missing the "'+n+'" attribute')},r.prototype.getSignature=function(t,e){var r=t.attributes,i=e.attributeData,n=["g",t.id];for(var o in r)i[o]&&n.push(o);return n.join("-")},r.prototype.initGeometryVao=function(t,e){this.checkCompatibility(t,e);var r=this.gl,i=this.CONTEXT_UID,n=this.getSignature(t,e),o=t.glVertexArrayObjects[this.CONTEXT_UID],s=o[n];if(s)return o[e.id]=s,s;var a=t.buffers,h=t.attributes,u={},l={};for(var c in a)u[c]=0,l[c]=0;for(var d in h)!h[d].size&&e.attributeData[d]?h[d].size=e.attributeData[d].size:h[d].size||console.warn("PIXI Geometry attribute '"+d+"' size cannot be determined (likely the bound shader does not have the attribute)"),u[h[d].buffer]+=h[d].size*Xr[h[d].type];for(var p in h){var f=h[p],v=f.size;void 0===f.stride&&(u[f.buffer]===v*Xr[f.type]?f.stride=0:f.stride=u[f.buffer]),void 0===f.start&&(f.start=l[f.buffer],l[f.buffer]+=v*Xr[f.type])}s=r.createVertexArray(),r.bindVertexArray(s);for(var m=0;m=t.ENV.WEBGL2&&(e=r.getContext("webgl2",{})),e||((e=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}))?e.getExtension("WEBGL_draw_buffers"):e=null),Kr=e}return Kr}function Jr(e,r,i){if("precision"!==e.substring(0,9)){var n=r;return r===t.PRECISION.HIGH&&i!==t.PRECISION.HIGH&&(n=t.PRECISION.MEDIUM),"precision "+n+" float;\n"+e}return i!==t.PRECISION.HIGH&&"precision highp"===e.substring(0,15)?e.replace("precision highp","precision mediump"):e}var Qr={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function $r(t){return Qr[t]}var ti=null,ei={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray"};function ri(t,e){if(!ti){var r=Object.keys(ei);ti={};for(var i=0;i0&&(e+="\nelse "),re.name?1:-1});for(var u=0;u0?this._useCurrent():t.disable(t.SCISSOR_TEST)},e.prototype._useCurrent=function(){var t=this.maskStack[this.maskStack.length-1]._scissorRect,e=this.renderer.renderTexture.current,r=this.renderer.projection,i=r.transform,n=r.sourceFrame,o=r.destinationFrame,s=e?e.resolution:this.renderer.resolution,a=(t.x-n.x)*s+o.x,h=(t.y-n.y)*s+o.y,u=t.width*s,l=t.height*s;i&&(a+=i.tx*s,h+=i.ty*s),e||(h=this.renderer.height-l-h),this.renderer.gl.scissor(a,h,u,l)},e}(Si),Pi=function(t){function e(e){t.call(this,e),this.glConst=WebGLRenderingContext.STENCIL_TEST}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0},e.prototype.push=function(t){var e=t.maskObject,r=this.renderer.gl,i=t._stencilCounter;0===i&&(this.renderer.framebuffer.forceStencil(),r.enable(r.STENCIL_TEST)),t._stencilCounter++,r.colorMask(!1,!1,!1,!1),r.stencilFunc(r.EQUAL,i,this._getBitwiseMask()),r.stencilOp(r.KEEP,r.KEEP,r.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,this._useCurrent()},e.prototype.pop=function(t){var e=this.renderer.gl;0===this.getStackLength()?(e.disable(e.STENCIL_TEST),e.clear(e.STENCIL_BUFFER_BIT),e.clearStencil(0)):(e.colorMask(!1,!1,!1,!1),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,this._useCurrent())},e.prototype._useCurrent=function(){var t=this.renderer.gl;t.colorMask(!0,!0,!0,!0),t.stencilFunc(t.EQUAL,this.getStackLength(),this._getBitwiseMask()),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)},e.prototype._getBitwiseMask=function(){return(1<>=1,r++;this.stateId=t.data}for(var i=0;ithis.checkCountMax&&(this.checkCount=0,this.run())))},r.prototype.run=function(){for(var t=this.renderer.texture,e=t.managedTextures,r=!1,i=0;ithis.maxIdle&&(t.destroyTexture(n,!0),e[i]=null,r=!0)}if(r){for(var o=0,s=0;s=0;r--)this.unload(t.children[r])},r}(hr),ji=function(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=6408,this.internalFormat=5121},Hi=function(e){function r(t){e.call(this,t),this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new tr}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.contextChange=function(){var t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion;var e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(var r=0;r=1:r.mipmap=0,2===this.webGLVersion||e.isPowerOfTwo?r.wrapMode=e.wrapMode:r.wrapMode=t.WRAP_MODES.CLAMP,e.resource&&e.resource.style(this.renderer,e,r)||this.setStyle(e,r),r.dirtyStyleId=e.dirtyStyleId)},r.prototype.setStyle=function(e,r){var i=this.gl;if(r.mipmap&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,r.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,r.wrapMode),r.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);var n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===t.SCALE_MODES.LINEAR){var o=Math.min(e.anisotropicLevel,i.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,n.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode?i.LINEAR:i.NEAREST)},r}(hr),Gi={FilterSystem:Rr,BatchSystem:Nr,ContextSystem:Br,FramebufferSystem:Ur,GeometrySystem:jr,MaskSystem:wi,ScissorSystem:Ii,StencilSystem:Pi,ProjectionSystem:Ai,RenderTextureSystem:Di,ShaderSystem:Ri,StateSystem:ki,TextureGCSystem:Xi,TextureSystem:Hi},Yi=new _e,zi=function(e){function r(r,i){e.call(this),(i=Object.assign({},m.RENDER_OPTIONS,i)).roundPixels&&(m.ROUND_PIXELS=i.roundPixels,ce("5.0.0","Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS",2)),this.options=i,this.type=t.RENDERER_TYPE.UNKNOWN,this.screen=new Oe(0,0,i.width,i.height),this.view=i.view||document.createElement("canvas"),this.resolution=i.resolution||m.RESOLUTION,this.transparent=i.transparent,this.autoDensity=i.autoDensity||i.autoResize||!1,this.preserveDrawingBuffer=i.preserveDrawingBuffer,this.clearBeforeRender=i.clearBeforeRender,this._backgroundColor=0,this._backgroundColorRgba=[0,0,0,0],this._backgroundColorString="#000000",this.backgroundColor=i.backgroundColor||this._backgroundColor,this._tempDisplayObjectParent=new Be,this._lastObjectRendered=this._tempDisplayObjectParent,this.plugins={}}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={width:{configurable:!0},height:{configurable:!0},backgroundColor:{configurable:!0}};return r.prototype.initPlugins=function(t){for(var e in t)this.plugins[e]=new t[e](this)},i.width.get=function(){return this.view.width},i.height.get=function(){return this.view.height},r.prototype.resize=function(t,e){this.screen.width=t,this.screen.height=e,this.view.width=t*this.resolution,this.view.height=e*this.resolution,this.autoDensity&&(this.view.style.width=t+"px",this.view.style.height=e+"px")},r.prototype.generateTexture=function(t,e,r,i){0===(i=i||t.getLocalBounds()).width&&(i.width=1),0===i.height&&(i.height=1);var n=gr.create(0|i.width,0|i.height,e,r);return Yi.tx=-i.x,Yi.ty=-i.y,this.render(t,n,!1,Yi,!!t.parent),n},r.prototype.destroy=function(e){for(var r in this.plugins)this.plugins[r].destroy(),this.plugins[r]=null;e&&this.view.parentNode&&this.view.parentNode.removeChild(this.view),this.plugins=null,this.type=t.RENDERER_TYPE.UNKNOWN,this.view=null,this.screen=null,this.resolution=0,this.transparent=!1,this.autoDensity=!1,this.blendModes=null,this.options=null,this.preserveDrawingBuffer=!1,this.clearBeforeRender=!1,this._backgroundColor=0,this._backgroundColorRgba=null,this._backgroundColorString=null,this._tempDisplayObjectParent=null,this._lastObjectRendered=null},i.backgroundColor.get=function(){return this._backgroundColor},i.backgroundColor.set=function(t){this._backgroundColor=t,this._backgroundColorString=kt(t),Ut(t,this._backgroundColorRgba)},Object.defineProperties(r.prototype,i),r}(g),Vi=function(e){function r(i){void 0===i&&(i={}),e.call(this,"WebGL",i),i=this.options,this.type=t.RENDERER_TYPE.WEBGL,this.gl=null,this.CONTEXT_UID=0,this.runners={destroy:new He("destroy"),contextChange:new He("contextChange",1),reset:new He("reset"),update:new He("update"),postrender:new He("postrender"),prerender:new He("prerender"),resize:new He("resize",2)},this.globalUniforms=new Mr({projectionMatrix:new _e},!0),this.addSystem(wi,"mask").addSystem(Br,"context").addSystem(ki,"state").addSystem(Ri,"shader").addSystem(Hi,"texture").addSystem(jr,"geometry").addSystem(Ur,"framebuffer").addSystem(Ii,"scissor").addSystem(Pi,"stencil").addSystem(Ai,"projection").addSystem(Xi,"textureGC").addSystem(Rr,"filter").addSystem(Di,"renderTexture").addSystem(Nr,"batch"),this.initPlugins(r.__plugins),i.context?this.context.initFromContext(i.context):this.context.initFromOptions({alpha:this.transparent,antialias:i.antialias,premultipliedAlpha:this.transparent&&"notMultiplied"!==this.transparent,stencil:!0,preserveDrawingBuffer:i.preserveDrawingBuffer,powerPreference:this.options.powerPreference}),this.renderingToScreen=!0,Ft(2===this.context.webGLVersion?"WebGL 2":"WebGL 1"),this.resize(this.options.width,this.options.height)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.create=function(t){if(Bt())return new r(t);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},r.prototype.addSystem=function(t,e){e||(e=t.name);var r=new t(this);if(this[e])throw new Error('Whoops! The name "'+e+'" is already in use');for(var i in this[e]=r,this.runners)this.runners[i].add(r);return this},r.prototype.render=function(t,e,r,i,n){if(this.renderingToScreen=!e,this.runners.prerender.run(),this.emit("prerender"),this.projection.transform=i,!this.context.isLost){if(e||(this._lastObjectRendered=t),!n){var o=t.parent;t.parent=this._tempDisplayObjectParent,t.updateTransform(),t.parent=o}this.renderTexture.bind(e),this.batch.currentRenderer.start(),(void 0!==r?r:this.clearBeforeRender)&&this.renderTexture.clear(),t.render(this),this.batch.currentRenderer.flush(),e&&e.baseTexture.update(),this.runners.postrender.run(),this.projection.transform=null,this.emit("postrender")}},r.prototype.resize=function(t,r){e.prototype.resize.call(this,t,r),this.runners.resize.run(t,r)},r.prototype.reset=function(){return this.runners.reset.run(),this},r.prototype.clear=function(){this.framebuffer.bind(),this.framebuffer.clear()},r.prototype.destroy=function(t){for(var r in this.runners.destroy.run(),this.runners)this.runners[r].destroy();e.prototype.destroy.call(this,t),this.gl=null},r.registerPlugin=function(t,e){r.__plugins=r.__plugins||{},r.__plugins[t]=e},r}(zi);function Wi(t){return Vi.create(t)}var qi="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",Ki="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n",Zi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.from=function(t,r){return new e(new ir(t,r))},e}(tr),Ji=function(){this.texArray=null,this.blend=0,this.type=t.DRAW_MODES.TRIANGLES,this.start=0,this.size=0,this.data=null},Qi=function(){this.elements=[],this.ids=[],this.count=0};Qi.prototype.clear=function(){for(var t=0;tthis.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)},r.prototype.buildTexturesAndDrawCalls=function(){var t=this._bufferedTextures,e=this.MAX_TEXTURES,i=r._textureArrayPool,n=this.renderer.batch,o=this._tempBoundTextures,s=this.renderer.textureGC.count,a=++tr._globalBatch,h=0,u=i[0],l=0;n.copyBoundTextures(o,e);for(var c=0;c=e&&(n.boundArray(u,o,a,e),this.buildDrawCalls(u,l,c),l=c,u=i[++h],++a),d._batchEnabled=a,d.touched=s,u.elements[u.count++]=d)}u.count>0&&(n.boundArray(u,o,a,e),this.buildDrawCalls(u,l,this._bufferSize),++h,++a);for(var p=0;p0&&(e+="\nelse "),r=0;l--){var c=u[l],d=this.recursiveFindHit(t,c,r,i,a);if(d){if(!c.parent)continue;a=!1,d&&(t.target&&(i=!1),s=!0)}}return n&&(i&&!t.target&&!e.hitArea&&e.containsPoint&&e.containsPoint(o)&&(s=!0),e.interactive&&(s&&!t.target&&(t.target=e),r&&r(t,e,!!s))),s},yn.prototype.findHit=function(t,e,r,i){this.recursiveFindHit(t,e,r,i,!1)};var _n={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return"pointer"===this.cursor},set buttonMode(t){t?this.cursor="pointer":"pointer"===this.cursor&&(this.cursor=null)},cursor:null,get trackedPointers(){return void 0===this._trackedPointers&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};Ne.mixin(_n);var xn=1,bn={target:null,data:{global:null}},En=function(e){function r(t,r){e.call(this),r=r||{},this.renderer=t,this.autoPreventDefault=void 0===r.autoPreventDefault||r.autoPreventDefault,this.interactionFrequency=r.interactionFrequency||10,this.mouse=new pn,this.mouse.identifier=xn,this.mouse.global.set(-999999),this.activeInteractionData={},this.activeInteractionData[xn]=this.mouse,this.interactionDataPool=[],this.eventData=new vn,this.interactionDOMElement=null,this.moveWhenInside=!1,this.eventsAdded=!1,this.mouseOverRenderer=!1,this.supportsTouchEvents="ontouchstart"in window,this.supportsPointerEvents=!!window.PointerEvent,this.onPointerUp=this.onPointerUp.bind(this),this.processPointerUp=this.processPointerUp.bind(this),this.onPointerCancel=this.onPointerCancel.bind(this),this.processPointerCancel=this.processPointerCancel.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.processPointerDown=this.processPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.processPointerMove=this.processPointerMove.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.processPointerOverOut=this.processPointerOverOut.bind(this),this.onPointerOver=this.onPointerOver.bind(this),this.cursorStyles={default:"inherit",pointer:"pointer"},this.currentCursorMode=null,this.cursor=null,this.resolution=1,this.delayedEvents=[],this.search=new yn,this.setTargetElement(this.renderer.view,this.renderer.resolution)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.hitTest=function(t,e){return bn.target=null,bn.data.global=t,e||(e=this.renderer._lastObjectRendered),this.processInteractive(bn,e,null,!0),bn.target},r.prototype.setTargetElement=function(t,e){void 0===e&&(e=1),this.removeEvents(),this.interactionDOMElement=t,this.resolution=e,this.addEvents()},r.prototype.addEvents=function(){this.interactionDOMElement&&(Ye.system.add(this.update,this,t.UPDATE_PRIORITY.INTERACTION),window.navigator.msPointerEnabled?(this.interactionDOMElement.style["-ms-content-zooming"]="none",this.interactionDOMElement.style["-ms-touch-action"]="none"):this.supportsPointerEvents&&(this.interactionDOMElement.style["touch-action"]="none"),this.supportsPointerEvents?(window.document.addEventListener("pointermove",this.onPointerMove,!0),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,!0),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,!0),window.addEventListener("pointercancel",this.onPointerCancel,!0),window.addEventListener("pointerup",this.onPointerUp,!0)):(window.document.addEventListener("mousemove",this.onPointerMove,!0),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,!0),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,!0),window.addEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,!0),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,!0),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,!0)),this.eventsAdded=!0)},r.prototype.removeEvents=function(){this.interactionDOMElement&&(Ye.system.remove(this.update,this),window.navigator.msPointerEnabled?(this.interactionDOMElement.style["-ms-content-zooming"]="",this.interactionDOMElement.style["-ms-touch-action"]=""):this.supportsPointerEvents&&(this.interactionDOMElement.style["touch-action"]=""),this.supportsPointerEvents?(window.document.removeEventListener("pointermove",this.onPointerMove,!0),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,!0),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,!0),window.removeEventListener("pointercancel",this.onPointerCancel,!0),window.removeEventListener("pointerup",this.onPointerUp,!0)):(window.document.removeEventListener("mousemove",this.onPointerMove,!0),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,!0),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,!0),window.removeEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,!0),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,!0),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,!0)),this.interactionDOMElement=null,this.eventsAdded=!1)},r.prototype.update=function(t){if(this._deltaTime+=t,!(this._deltaTimethis.maxSegments&&(r=this.maxSegments),r}},Sn=function(){this.reset()};Sn.prototype.clone=function(){var t=new Sn;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t},Sn.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=vr.WHITE,this.matrix=null,this.visible=!1},Sn.prototype.destroy=function(){this.texture=null,this.matrix=null};var In={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var r=t.points,i=t.holes,n=e.points,o=e.indices;if(r.length>=6){for(var s=[],a=0;a196*g*g?(A=w-I,O=S-P,D=Math.sqrt(A*A+O*O),A/=D,O/=D,A*=g,O*=g,p.push(x-A*C,b-O*C),p.push(x+A*R,b+O*R),p.push(x-A*R*C,b-O*C),v++):(p.push(x+(H-x)*C,b+(G-b)*C),p.push(x-(H-x)*R,b-(G-b)*R))}}y=n[2*(f-2)],_=n[2*(f-2)+1],x=n[2*(f-1)],b=n[2*(f-1)+1],w=-(_-b),S=y-x,D=Math.sqrt(w*w+S*S),w/=D,S/=D,w*=g,S*=g,p.push(x-w*C,b-S*C),p.push(x+w*R,b+S*R);for(var z=r.indices,V=0;Vl*a}},Ln.arc=function(t,e,r,i,n,o,s,a,h){for(var u=s-o,l=wn._segmentsCount(Math.abs(u)*n,40*Math.ceil(Math.abs(u)/me)),c=u/(2*l),d=2*c,p=Math.cos(c),f=Math.sin(c),v=l-1,m=v%1/v,g=0;g<=v;++g){var y=c+o+d*(g+m*g),_=Math.cos(y),x=-Math.sin(y);h.push((p*_+f*x)*n+r,(p*-x+f*_)*n+i)}};var Nn=function(){};Nn.curveLength=function(t,e,r,i,n,o,s,a){for(var h=0,u=0,l=0,c=0,d=0,p=0,f=0,v=0,m=0,g=0,y=0,_=t,x=e,b=1;b<=10;++b)g=_-(v=(f=(p=(d=1-(u=b/10))*d)*d)*t+3*p*u*r+3*d*(l=u*u)*n+(c=l*u)*s),y=x-(m=f*e+3*p*u*i+3*d*l*o+c*a),_=v,x=m,h+=Math.sqrt(g*g+y*y);return h},Nn.curveTo=function(t,e,r,i,n,o,s){var a=s[s.length-2],h=s[s.length-1];s.length-=2;var u=wn._segmentsCount(Nn.curveLength(a,h,t,e,r,i,n,o)),l=0,c=0,d=0,p=0,f=0;s.push(a,h);for(var v=1,m=0;v<=u;++v)d=(c=(l=1-(m=v/u))*l)*l,f=(p=m*m)*m,s.push(d*a+3*c*m*t+3*l*p*r+f*n,d*h+3*c*m*e+3*l*p*i+f*o)};var Fn=function(){};Fn.curveLength=function(t,e,r,i,n,o){var s=t-2*r+n,a=e-2*i+o,h=2*r-2*t,u=2*i-2*e,l=4*(s*s+a*a),c=4*(s*h+a*u),d=h*h+u*u,p=2*Math.sqrt(l+c+d),f=Math.sqrt(l),v=2*l*f,m=2*Math.sqrt(d),g=c/f;return(v*p+f*c*(p-m)+(4*d*l-c*c)*Math.log((2*f+g+p)/(g+m)))/(4*v)},Fn.curveTo=function(t,e,r,i,n){for(var o=n[n.length-2],s=n[n.length-1],a=wn._segmentsCount(Fn.curveLength(o,s,t,e,r,i)),h=0,u=0,l=1;l<=a;++l){var c=l/a;h=o+(t-o)*c,u=s+(e-s)*c,n.push(h+(t+(r-t)*c-h)*c,u+(e+(i-e)*c-u)*c)}};var Bn=function(){this.reset()};Bn.prototype.begin=function(t,e,r){this.reset(),this.style=t,this.start=e,this.attribStart=r},Bn.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},Bn.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0};var Un={};Un[t.SHAPES.POLY]=In,Un[t.SHAPES.CIRC]=Pn,Un[t.SHAPES.ELIP]=Pn,Un[t.SHAPES.RECT]=An,Un[t.SHAPES.RREC]=On;var kn=[],Xn=[],jn={buildPoly:In,buildCircle:Pn,buildRectangle:An,buildRoundedRectangle:On,FILL_COMMANDS:Un,BATCH_POOL:kn,DRAW_CALL_POOL:Xn,buildLine:Cn,buildComplexPoly:function(t,e){var r=t.points.slice();if(!(r.length<6)){var i=e.indices;e.points=r,e.alpha=t.fillAlpha,e.color=Ut(t.fillColor);for(var n=1/0,o=-1/0,s=1/0,a=-1/0,h=0,u=0,l=0;lo?h:o,s=(u=r[l+1])a?u:a;r.push(n,s,o,s,o,a,n,a);for(var c=r.length/2,d=0;d0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},r.prototype.drawShape=function(t,e,r,i){var n=new Hn(t,e,r,i);return this.graphicsData.push(n),this.dirty++,this},r.prototype.drawHole=function(t,e){if(!this.graphicsData.length)return null;var r=new Hn(t,null,null,e),i=this.graphicsData[this.graphicsData.length-1];return r.lineStyle=i.lineStyle,i.holes.push(r),this.dirty++,this},r.prototype.destroy=function(t){e.prototype.destroy.call(this,t);for(var r=0;r0&&(n=(i=this.batches[this.batches.length-1]).style);for(var o=this.shapeIndex;o0&&(i=null)),i||((i=kn.pop()||new Bn).begin(l,d,p),this.batches.push(i),n=l);var f=this.points.length/2;0===u?this.processFill(s):this.processLine(s);var v=this.points.length/2-f;this.addUvs(this.points,e,l.texture,f,v,l.matrix)}}}if(i){var m=this.indices.length,g=this.points.length/2;i.end(m,g),this.indicesUint16=new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},r.prototype._compareStyles=function(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))},r.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t0&&((o=Xn.pop())||((o=new Ji).textures=new Qi),this.drawCalls.push(o)),o.start=c,o.size=0,o.textures.count=0,o.type=l),v.touched=1,v._batchEnabled=e,v._batchLocation=s,v.wrapMode=10497,o.textures.elements[o.textures.count++]=v,s++)),o.size+=p.size,c+=p.size,h=v._batchLocation,this.addColors(i,f.color,f.alpha,p.attribSize),this.addTextureIds(n,h,p.attribSize)}tr._globalBatch=e,this.packAttributes()},r.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,r=this.colors,i=this.textureIds,n=new ArrayBuffer(3*t.length*4),o=new Float32Array(n),s=new Uint32Array(n),a=0,h=0;h>16)+(65280&e)+((255&e)<<16),r);i-- >0;)t.push(n)},r.prototype.addTextureIds=function(t,e,r){for(;r-- >0;)t.push(e)},r.prototype.addUvs=function(t,e,r,i,n,o){for(var s=0,a=e.length,h=r.frame;s0&&t.alpha>0;return h?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:h},t)):this._lineStyle.reset(),this},r.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Ce,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Ce,this.currentPath.closeStroke=!1},r.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},r.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},r.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var r=this.currentPath.points,i=r[r.length-2],n=r[r.length-1];return i===t&&n===e||r.push(t,e),this},r.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},r.prototype.quadraticCurveTo=function(t,e,r,i){this._initCurve();var n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),Fn.curveTo(t,e,r,i,n),this},r.prototype.bezierCurveTo=function(t,e,r,i,n,o){return this._initCurve(),Nn.curveTo(t,e,r,i,n,o,this.currentPath.points),this},r.prototype.arcTo=function(t,e,r,i,n){this._initCurve(t,e);var o=this.currentPath.points,s=Ln.curveTo(t,e,r,i,n,o);if(s){var a=s.cx,h=s.cy,u=s.radius,l=s.startAngle,c=s.endAngle,d=s.anticlockwise;this.arc(a,h,u,l,c,d)}return this},r.prototype.arc=function(t,e,r,i,n,o){if(void 0===o&&(o=!1),i===n)return this;if(!o&&n<=i?n+=me:o&&i<=n&&(i+=me),0===n-i)return this;var s=t+Math.cos(i)*r,a=e+Math.sin(i)*r,h=this.geometry.closePointEps,u=this.currentPath?this.currentPath.points:null;if(u){var l=Math.abs(u[u.length-2]-s),c=Math.abs(u[u.length-1]-a);l0;return o?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:o},t)):this._fillStyle.reset(),this},r.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},r.prototype.drawRect=function(t,e,r,i){return this.drawShape(new Oe(t,e,r,i))},r.prototype.drawRoundedRect=function(t,e,r,i,n){return this.drawShape(new Re(t,e,r,i,n))},r.prototype.drawCircle=function(t,e,r){return this.drawShape(new De(t,e,r))},r.prototype.drawEllipse=function(t,e,r,i){return this.drawShape(new Me(t,e,r,i))},r.prototype.drawPolygon=function(t){var e=arguments,r=t,i=!0;if(r.points&&(i=r.closeStroke,r=r.points),!Array.isArray(r)){r=new Array(arguments.length);for(var n=0;n>16&255)/255*n,o.tint[1]=(i>>8&255)/255*n,o.tint[2]=(255&i)/255*n,o.tint[3]=n,t.shader.bind(e),t.geometry.bind(r,e),t.state.set(this.state);for(var a=0,h=s.length;a>16)+(65280&n)+((255&n)<<16)}}},r.prototype.calculateVertices=function(){if(this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID;for(var t=this.transform.worldTransform,e=t.a,r=t.b,i=t.c,n=t.d,o=t.tx,s=t.ty,a=this.geometry.points,h=this.vertexData,u=0,l=0;l=i&&Zn.x=n&&Zn.y>16)+(65280&t)+((255&t)<<16)},i.texture.get=function(){return this._texture},i.texture.set=function(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||vr.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},Object.defineProperties(r.prototype,i),r}(Be),$n={LINEAR_VERTICAL:0,LINEAR_HORIZONTAL:1},to={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:$n.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},eo=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],ro=function(t){this.styleID=0,this.reset(),so(this,t,t)},io={align:{configurable:!0},breakWords:{configurable:!0},dropShadow:{configurable:!0},dropShadowAlpha:{configurable:!0},dropShadowAngle:{configurable:!0},dropShadowBlur:{configurable:!0},dropShadowColor:{configurable:!0},dropShadowDistance:{configurable:!0},fill:{configurable:!0},fillGradientType:{configurable:!0},fillGradientStops:{configurable:!0},fontFamily:{configurable:!0},fontSize:{configurable:!0},fontStyle:{configurable:!0},fontVariant:{configurable:!0},fontWeight:{configurable:!0},letterSpacing:{configurable:!0},lineHeight:{configurable:!0},leading:{configurable:!0},lineJoin:{configurable:!0},miterLimit:{configurable:!0},padding:{configurable:!0},stroke:{configurable:!0},strokeThickness:{configurable:!0},textBaseline:{configurable:!0},trim:{configurable:!0},whiteSpace:{configurable:!0},wordWrap:{configurable:!0},wordWrapWidth:{configurable:!0}};function no(t){return"number"==typeof t?kt(t):("string"==typeof t&&0===t.indexOf("0x")&&(t=t.replace("0x","#")),t)}function oo(t){if(Array.isArray(t)){for(var e=0;e=0;r--){var i=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(i)&&eo.indexOf(i)<0&&(i='"'+i+'"'),e[r]=i}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},Object.defineProperties(ro.prototype,io);var ao=function(t,e,r,i,n,o,s,a,h){this.text=t,this.style=e,this.width=r,this.height=i,this.lines=n,this.lineWidths=o,this.lineHeight=s,this.maxLineWidth=a,this.fontProperties=h};ao.measureText=function(t,e,r,i){void 0===i&&(i=ao._canvas),r=null==r?e.wordWrap:r;var n=e.toFontString(),o=ao.measureFont(n);0===o.fontSize&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);var s=i.getContext("2d");s.font=n;for(var a=(r?ao.wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),h=new Array(a.length),u=0,l=0;lp)if(""!==o&&(s+=ao.addLine(o),o="",n=0),ao.canBreakWords(m,e.breakWords))for(var x=m.split(""),b=0;bp&&(s+=ao.addLine(o),d=!1,o="",n=0),o+=E,n+=I}else{o.length>0&&(s+=ao.addLine(o),o="",n=0);var P=v===f.length-1;s+=ao.addLine(m,!P),d=!1,o="",n=0}else _+n>p&&(d=!1,s+=ao.addLine(o),o="",n=0),(o.length>0||!ao.isBreakingSpace(m)||d)&&(o+=m,n+=_)}return s+=ao.addLine(o,!1)},ao.addLine=function(t,e){return void 0===e&&(e=!0),t=ao.trimRight(t),t=e?t+"\n":t},ao.getFromCache=function(t,e,r,i){var n=r[t];if(void 0===n){var o=t.length*e;n=i.measureText(t).width+o,r[t]=n}return n},ao.collapseSpaces=function(t){return"normal"===t||"pre-line"===t},ao.collapseNewlines=function(t){return"normal"===t},ao.trimRight=function(t){if("string"!=typeof t)return"";for(var e=t.length-1;e>=0;e--){var r=t[e];if(!ao.isBreakingSpace(r))break;t=t.slice(0,-1)}return t},ao.isNewline=function(t){return"string"==typeof t&&ao._newlines.indexOf(t.charCodeAt(0))>=0},ao.isBreakingSpace=function(t){return"string"==typeof t&&ao._breakingSpaces.indexOf(t.charCodeAt(0))>=0},ao.tokenize=function(t){var e=[],r="";if("string"!=typeof t)return e;for(var i=0;is;--c){for(var v=0;v0};var po=function(t){var e=this;this.limiter=new co(m.UPLOADS_PER_FRAME),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=function(){e.queue&&e.prepareItems()},this.registerFindHook(_o),this.registerFindHook(xo),this.registerFindHook(fo),this.registerFindHook(vo),this.registerFindHook(mo),this.registerUploadHook(go),this.registerUploadHook(yo)};function fo(t,e){var r=!1;if(t&&t._textures&&t._textures.length)for(var i=0;i=0;i--)this.add(t.children[i]);return this},po.prototype.destroy=function(){this.ticking&&Ye.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null};var bo=function(t){function e(e){t.call(this,e),this.uploadHookHelper=this.renderer,this.registerFindHook(wo),this.registerUploadHook(Eo),this.registerUploadHook(To)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(po);function Eo(t,e){return e instanceof tr&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function To(t,e){if(!(e instanceof Kn))return!1;var r=e.geometry;e.finishPoly(),r.updateBatches();for(var i=r.batches,n=0;n0||e.responseType===t.XHR_RESPONSE_TYPE.BUFFER)?i=200:1223===i&&(i=204),2===(i/100|0)){if(this.xhrType===t.XHR_RESPONSE_TYPE.TEXT)this.data=r,this.type=t.TYPE.TEXT;else if(this.xhrType===t.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(r),this.type=t.TYPE.JSON}catch(t){return void this.abort("Error trying to parse loaded json: "+t)}else if(this.xhrType===t.XHR_RESPONSE_TYPE.DOCUMENT)try{if(window.DOMParser){var n=new DOMParser;this.data=n.parseFromString(r,"text/xml")}else{var o=document.createElement("div");o.innerHTML=r,this.data=o}this.type=t.TYPE.XML}catch(t){return void this.abort("Error trying to parse loaded xml: "+t)}else this.data=e.response||r;this.complete()}else this.abort("["+e.status+"] "+e.statusText+": "+e.responseURL)},e._determineCrossOrigin=function(t,e){if(0===t.indexOf("data:"))return"";if(window.origin!==window.location.origin)return"anonymous";e=e||window.location,Xo||(Xo=document.createElement("a")),Xo.href=t;var r=!(t=Do(Xo.href,{strictMode:!0})).port&&""===e.port||t.port===e.port,i=t.protocol?t.protocol+":":"";return t.host===e.hostname&&r&&i===e.protocol?"":"anonymous"},e._determineXhrType=function(){return t._xhrTypeMap[this.extension]||t.XHR_RESPONSE_TYPE.TEXT},e._determineLoadType=function(){return t._loadTypeMap[this.extension]||t.LOAD_TYPE.XHR},e._getExtension=function(){var t=this.url,e="";if(this.isDataUrl){var r=t.indexOf("/");e=t.substring(r+1,t.indexOf(";",r))}else{var i=t.indexOf("?"),n=t.indexOf("#"),o=Math.min(i>-1?i:t.length,n>-1?n:t.length);e=(t=t.substring(0,o)).substring(t.lastIndexOf(".")+1)}return e.toLowerCase()},e._getMimeFromXhrType=function(e){switch(e){case t.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case t.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case t.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case t.XHR_RESPONSE_TYPE.JSON:return"application/json";case t.XHR_RESPONSE_TYPE.DEFAULT:case t.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},Uo(t,[{key:"isDataUrl",get:function(){return this._hasFlag(t.STATUS_FLAGS.DATA_URL)}},{key:"isComplete",get:function(){return this._hasFlag(t.STATUS_FLAGS.COMPLETE)}},{key:"isLoading",get:function(){return this._hasFlag(t.STATUS_FLAGS.LOADING)}}]),t}();function Go(t,e,r){e&&0===e.indexOf(".")&&(e=e.substring(1)),e&&(t[e]=r)}function Yo(t){return t.toString().replace("object ","")}Ho.STATUS_FLAGS={NONE:0,DATA_URL:1,COMPLETE:2,LOADING:4},Ho.TYPE={UNKNOWN:0,JSON:1,XML:2,IMAGE:3,AUDIO:4,VIDEO:5,TEXT:6},Ho.LOAD_TYPE={XHR:1,IMAGE:2,AUDIO:3,VIDEO:4},Ho.XHR_RESPONSE_TYPE={DEFAULT:"text",BUFFER:"arraybuffer",BLOB:"blob",DOCUMENT:"document",JSON:"json",TEXT:"text"},Ho._loadTypeMap={gif:Ho.LOAD_TYPE.IMAGE,png:Ho.LOAD_TYPE.IMAGE,bmp:Ho.LOAD_TYPE.IMAGE,jpg:Ho.LOAD_TYPE.IMAGE,jpeg:Ho.LOAD_TYPE.IMAGE,tif:Ho.LOAD_TYPE.IMAGE,tiff:Ho.LOAD_TYPE.IMAGE,webp:Ho.LOAD_TYPE.IMAGE,tga:Ho.LOAD_TYPE.IMAGE,svg:Ho.LOAD_TYPE.IMAGE,"svg+xml":Ho.LOAD_TYPE.IMAGE,mp3:Ho.LOAD_TYPE.AUDIO,ogg:Ho.LOAD_TYPE.AUDIO,wav:Ho.LOAD_TYPE.AUDIO,mp4:Ho.LOAD_TYPE.VIDEO,webm:Ho.LOAD_TYPE.VIDEO},Ho._xhrTypeMap={xhtml:Ho.XHR_RESPONSE_TYPE.DOCUMENT,html:Ho.XHR_RESPONSE_TYPE.DOCUMENT,htm:Ho.XHR_RESPONSE_TYPE.DOCUMENT,xml:Ho.XHR_RESPONSE_TYPE.DOCUMENT,tmx:Ho.XHR_RESPONSE_TYPE.DOCUMENT,svg:Ho.XHR_RESPONSE_TYPE.DOCUMENT,tsx:Ho.XHR_RESPONSE_TYPE.DOCUMENT,gif:Ho.XHR_RESPONSE_TYPE.BLOB,png:Ho.XHR_RESPONSE_TYPE.BLOB,bmp:Ho.XHR_RESPONSE_TYPE.BLOB,jpg:Ho.XHR_RESPONSE_TYPE.BLOB,jpeg:Ho.XHR_RESPONSE_TYPE.BLOB,tif:Ho.XHR_RESPONSE_TYPE.BLOB,tiff:Ho.XHR_RESPONSE_TYPE.BLOB,webp:Ho.XHR_RESPONSE_TYPE.BLOB,tga:Ho.XHR_RESPONSE_TYPE.BLOB,json:Ho.XHR_RESPONSE_TYPE.JSON,text:Ho.XHR_RESPONSE_TYPE.TEXT,txt:Ho.XHR_RESPONSE_TYPE.TEXT,ttf:Ho.XHR_RESPONSE_TYPE.BUFFER,otf:Ho.XHR_RESPONSE_TYPE.BUFFER},Ho.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";var zo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var Vo=window.URL||window.webkitURL;var Wo={caching:function(t,e){var r=this;Fo[t.url]?(t.data=Fo[t.url],t.complete()):t.onComplete.once(function(){return Fo[r.url]=r.data}),e()},parsing:function(t,e){if(t.data){if(t.xhr&&t.xhrType===Ho.XHR_RESPONSE_TYPE.BLOB)if(window.Blob&&"string"!=typeof t.data){if(0===t.data.type.indexOf("image")){var r=Vo.createObjectURL(t.data);return t.blob=t.data,t.data=new Image,t.data.src=r,t.type=Ho.TYPE.IMAGE,void(t.data.onload=function(){Vo.revokeObjectURL(r),t.data.onload=null,e()})}}else{var i=t.xhr.getResponseHeader("content-type");if(i&&0===i.indexOf("image"))return t.data=new Image,t.data.src="data:"+i+";base64,"+function(t){for(var e="",r=0;r>2,n[1]=(3&i[0])<<4|i[1]>>4,n[2]=(15&i[1])<<2|i[2]>>6,n[3]=63&i[2],r-(t.length-1)){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64}for(var s=0;s16384&&(n=16384),this._properties=[!1,!0,!1,!1,!1],this._maxSize=r,this._batchSize=n,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=t.BLEND_MODES.NORMAL,this.autoResize=o,this.roundPixels=!0,this.baseTexture=null,this.setProperties(i),this._tint=0,this.tintRgb=new Float32Array(4),this.tint=16777215}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={tint:{configurable:!0}};return r.prototype.setProperties=function(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])},r.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},i.tint.get=function(){return this._tint},i.tint.set=function(t){this._tint=t,Ut(t,this.tintRgb)},r.prototype.render=function(t){var e=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",function(){return e.onChildrenChange(0)})),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))},r.prototype.onChildrenChange=function(t){for(var e=Math.floor(t/this._batchSize);this._bufferUpdateIDs.lengthr&&!t.autoResize&&(o=r);var s=t._buffers;s||(s=t._buffers=this.generateBuffers(t));var a=e[0]._texture.baseTexture;this.renderer.state.setBlendMode(Ht(t.blendMode,a.alphaMode));var h=n.gl,u=t.worldTransform.copyTo(this.tempMatrix);u.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=Gt(t.tintRgb,t.worldAlpha,this.shader.uniforms.uColor,a.alphaMode),this.shader.uniforms.uSampler=a,this.renderer.shader.bind(this.shader);for(var l=!1,c=0,d=0;ci&&(p=i),d>=s.length&&s.push(this._generateOneMoreBuffer(t));var f=s[d];f.uploadDynamic(e,c,p);var v=t._bufferUpdateIDs[d]||0;(l=l||f._updateID0,u=a.alpha,l=u<1&&h?Yt(a._tintRGB,u):a._tintRGB+(255*u<<24);i[o]=l,i[o+n]=l,i[o+2*n]=l,i[o+3*n]=l,o+=4*n}},r.prototype.destroy=function(){e.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},r}(Lr),os=function(t,e,r){void 0===r&&(r=null),this.baseTexture=t,this.textures={},this.animations={},this.data=e,this.resolution=this._updateResolution(r||(this.baseTexture.resource?this.baseTexture.resource.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null},ss={BATCH_SIZE:{configurable:!0}};ss.BATCH_SIZE.get=function(){return 1e3},os.prototype._updateResolution=function(t){var e=this.data.meta.scale,r=ue(t,null);return null===r&&(r=void 0!==e?parseFloat(e):1),1!==r&&this.baseTexture.setResolution(r),r},os.prototype.parse=function(t){this._batchIndex=0,this._callback=t,this._frameKeys.length<=os.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()},os.prototype._processFrames=function(t){for(var e=t,r=os.BATCH_SIZE;e-t=i&&hs.x=n&&hs.y0&&i.x>h&&(Wt(n,1+p-++v,1+g-p),g=p,p=-1,o.push(f),c=Math.max(c,f),d++,i.x=0,i.y+=t.lineHeight,u=null))}else o.push(l),c=Math.max(c,l),++d,++v,i.x=0,i.y+=t.lineHeight,u=null}var b=s.charAt(s.length-1);"\r"!==b&&"\n"!==b&&(/(?:\s)/.test(b)&&(l=f),o.push(l),c=Math.max(c,l));for(var E=[],T=0;T<=d;T++){var w=0;"right"===this._font.align?w=c-o[T]:"center"===this._font.align&&(w=(c-o[T])/2),E.push(w)}for(var S=n.length,I=this.tint,P=0;P=0?t:16777215,this.dirty=!0},r.align.get=function(){return this._font.align},r.align.set=function(t){this._font.align=t||"left",this.dirty=!0},r.anchor.get=function(){return this._anchor},r.anchor.set=function(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)},r.font.get=function(){return this._font},r.font.set=function(t){t&&("string"==typeof t?(t=t.split(" "),this._font.name=1===t.length?t[0]:t.slice(1).join(" "),this._font.size=t.length>=2?parseInt(t[0],10):e.fonts[this._font.name].size):(this._font.name=t.name,this._font.size="number"==typeof t.size?t.size:parseInt(t.size,10)),this.dirty=!0)},r.text.get=function(){return this._text},r.text.set=function(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)},r.maxWidth.get=function(){return this._maxWidth},r.maxWidth.set=function(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)},r.maxLineHeight.get=function(){return this.validate(),this._maxLineHeight},r.textWidth.get=function(){return this.validate(),this._textWidth},r.letterSpacing.get=function(){return this._letterSpacing},r.letterSpacing.set=function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)},r.textHeight.get=function(){return this.validate(),this._textHeight},e.registerFont=function(t,r){var i={},n=t.getElementsByTagName("info")[0],o=t.getElementsByTagName("common")[0],s=t.getElementsByTagName("page"),a=ue(s[0].getAttribute("file"),m.RESOLUTION),h={};i.font=n.getAttribute("face"),i.size=parseInt(n.getAttribute("size"),10),i.lineHeight=parseInt(o.getAttribute("lineHeight"),10)/a,i.chars={},r instanceof vr&&(r=[r]);for(var u=0;u=i&&(e=t-s-1),o+=a=a.replace("%value%",r[e]),o+="\n"}return n=(n=n.replace("%blur%",o)).replace("%size%",t)}(o);t.call(this,s,a),this.horizontal=e,this.resolution=n||m.RESOLUTION,this._quality=0,this.quality=i||4,this.blur=r||8}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={blur:{configurable:!0},quality:{configurable:!0}};return e.prototype.apply=function(t,e,r,i){if(r?this.horizontal?this.uniforms.strength=1/r.width*(r.width/e.width):this.uniforms.strength=1/r.height*(r.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)t.applyFilter(this,e,r,i);else{var n=t.getFilterTexture(),o=t.renderer,s=e,a=n;this.state.blend=!1,t.applyFilter(this,s,a,!1);for(var h=1;h 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n",Ss=function(t){function e(){var e={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};t.call(this,Ki,ws,e),this.alpha=1}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={matrix:{configurable:!0},alpha:{configurable:!0}};return e.prototype._loadMatrix=function(t,e){void 0===e&&(e=!1);var r=t;e&&(this._multiply(r,this.uniforms.m,t),r=this._colorMatrix(r)),this.uniforms.m=r},e.prototype._multiply=function(t,e,r){return t[0]=e[0]*r[0]+e[1]*r[5]+e[2]*r[10]+e[3]*r[15],t[1]=e[0]*r[1]+e[1]*r[6]+e[2]*r[11]+e[3]*r[16],t[2]=e[0]*r[2]+e[1]*r[7]+e[2]*r[12]+e[3]*r[17],t[3]=e[0]*r[3]+e[1]*r[8]+e[2]*r[13]+e[3]*r[18],t[4]=e[0]*r[4]+e[1]*r[9]+e[2]*r[14]+e[3]*r[19]+e[4],t[5]=e[5]*r[0]+e[6]*r[5]+e[7]*r[10]+e[8]*r[15],t[6]=e[5]*r[1]+e[6]*r[6]+e[7]*r[11]+e[8]*r[16],t[7]=e[5]*r[2]+e[6]*r[7]+e[7]*r[12]+e[8]*r[17],t[8]=e[5]*r[3]+e[6]*r[8]+e[7]*r[13]+e[8]*r[18],t[9]=e[5]*r[4]+e[6]*r[9]+e[7]*r[14]+e[8]*r[19]+e[9],t[10]=e[10]*r[0]+e[11]*r[5]+e[12]*r[10]+e[13]*r[15],t[11]=e[10]*r[1]+e[11]*r[6]+e[12]*r[11]+e[13]*r[16],t[12]=e[10]*r[2]+e[11]*r[7]+e[12]*r[12]+e[13]*r[17],t[13]=e[10]*r[3]+e[11]*r[8]+e[12]*r[13]+e[13]*r[18],t[14]=e[10]*r[4]+e[11]*r[9]+e[12]*r[14]+e[13]*r[19]+e[14],t[15]=e[15]*r[0]+e[16]*r[5]+e[17]*r[10]+e[18]*r[15],t[16]=e[15]*r[1]+e[16]*r[6]+e[17]*r[11]+e[18]*r[16],t[17]=e[15]*r[2]+e[16]*r[7]+e[17]*r[12]+e[18]*r[17],t[18]=e[15]*r[3]+e[16]*r[8]+e[17]*r[13]+e[18]*r[18],t[19]=e[15]*r[4]+e[16]*r[9]+e[17]*r[14]+e[18]*r[19]+e[19],t},e.prototype._colorMatrix=function(t){var e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e},e.prototype.brightness=function(t,e){var r=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.greyscale=function(t,e){var r=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.blackAndWhite=function(t){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],t)},e.prototype.hue=function(t,e){t=(t||0)/180*Math.PI;var r=Math.cos(t),i=Math.sin(t),n=1/3,o=(0,Math.sqrt)(n),s=[r+(1-r)*n,n*(1-r)-o*i,n*(1-r)+o*i,0,0,n*(1-r)+o*i,r+n*(1-r),n*(1-r)-o*i,0,0,n*(1-r)-o*i,n*(1-r)+o*i,r+n*(1-r),0,0,0,0,0,1,0];this._loadMatrix(s,e)},e.prototype.contrast=function(t,e){var r=(t||0)+1,i=-.5*(r-1),n=[r,0,0,0,i,0,r,0,0,i,0,0,r,0,i,0,0,0,1,0];this._loadMatrix(n,e)},e.prototype.saturate=function(t,e){void 0===t&&(t=0);var r=2*t/3+1,i=-.5*(r-1),n=[r,i,i,0,0,i,r,i,0,0,i,i,r,0,0,0,0,0,1,0];this._loadMatrix(n,e)},e.prototype.desaturate=function(){this.saturate(-1)},e.prototype.negative=function(t){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],t)},e.prototype.sepia=function(t){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],t)},e.prototype.technicolor=function(t){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],t)},e.prototype.polaroid=function(t){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],t)},e.prototype.toBGR=function(t){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t)},e.prototype.kodachrome=function(t){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],t)},e.prototype.browni=function(t){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],t)},e.prototype.vintage=function(t){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],t)},e.prototype.colorTone=function(t,e,r,i,n){var o=((r=r||16770432)>>16&255)/255,s=(r>>8&255)/255,a=(255&r)/255,h=((i=i||3375104)>>16&255)/255,u=(i>>8&255)/255,l=(255&i)/255,c=[.3,.59,.11,0,0,o,s,a,t=t||.2,0,h,u,l,e=e||.15,0,o-h,s-u,a-l,0,0];this._loadMatrix(c,n)},e.prototype.night=function(t,e){var r=[-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.predator=function(t,e){var r=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.lsd=function(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)},e.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},r.matrix.get=function(){return this.uniforms.m},r.matrix.set=function(t){this.uniforms.m=t},r.alpha.get=function(){return this.uniforms.uAlpha},r.alpha.set=function(t){this.uniforms.uAlpha=t},Object.defineProperties(e.prototype,r),e}(gi);Ss.prototype.grayscale=Ss.prototype.greyscale;var Is="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n",Ps="varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",As=function(t){function e(e,r){var i=new _e;e.renderable=!1,t.call(this,Is,Ps,{mapSampler:e._texture,filterMatrix:i,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=e,this.maskMatrix=i,null==r&&(r=20),this.scale=new fe(r,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={map:{configurable:!0}};return e.prototype.apply=function(t,e,r,i){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var n=this.maskSprite.transform.worldTransform,o=Math.sqrt(n.a*n.a+n.b*n.b),s=Math.sqrt(n.c*n.c+n.d*n.d);0!==o&&0!==s&&(this.uniforms.rotation[0]=n.a/o,this.uniforms.rotation[1]=n.b/o,this.uniforms.rotation[2]=n.c/s,this.uniforms.rotation[3]=n.d/s),t.applyFilter(this,e,r,i)},r.map.get=function(){return this.uniforms.mapSampler},r.map.set=function(t){this.uniforms.mapSampler=t},Object.defineProperties(e.prototype,r),e}(gi),Os="\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputPixel;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",Ds='varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputPixel;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n',Ms=function(t){function e(){t.call(this,Os,Ds)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(gi),Cs="precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",Rs=function(t){function e(e,r){void 0===e&&(e=.5),void 0===r&&(r=Math.random()),t.call(this,Ki,Cs,{uNoise:0,uSeed:0}),this.noise=e,this.seed=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={noise:{configurable:!0},seed:{configurable:!0}};return r.noise.get=function(){return this.uniforms.uNoise},r.noise.set=function(t){this.uniforms.uNoise=t},r.seed.get=function(){return this.uniforms.uSeed},r.seed.set=function(t){this.uniforms.uSeed=t},Object.defineProperties(e.prototype,r),e}(gi),Ls=new _e;Ne.prototype._cacheAsBitmap=!1,Ne.prototype._cacheData=!1;var Ns=function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalHitTest=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.sprite=null};Object.defineProperties(Ne.prototype,{cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(t){var e;this._cacheAsBitmap!==t&&(this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new Ns),(e=this._cacheData).originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((e=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea))}}}),Ne.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},Ne.prototype._initCachedDisplayObject=function(t){if(!this._cacheData||!this._cacheData.sprite){var e=this.alpha;this.alpha=1,t.batch.flush();var r=this.getLocalBounds().clone();if(this.filters){var i=this.filters[0].padding;r.pad(i)}r.ceil(m.RESOLUTION);var n=t.renderTexture.current,o=t.renderTexture.sourceFrame,s=t.projection.transform,a=gr.create(r.width,r.height),h="cacheAsBitmap_"+Kt();this._cacheData.textureCacheId=h,tr.addToCache(a.baseTexture,h),vr.addToCache(a,h);var u=Ls;u.tx=-r.x,u.ty=-r.y,this.transform.worldTransform.identity(),this.render=this._cacheData.originalRender,t.render(this,a,!0,u,!0),t.projection.transform=s,t.renderTexture.bind(n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var l=new Qn(a);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-r.x/r.width,l.anchor.y=-r.y/r.height,l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)}},Ne.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},Ne.prototype._initCachedDisplayObjectCanvas=function(t){if(!this._cacheData||!this._cacheData.sprite){var e=this.getLocalBounds(),r=this.alpha;this.alpha=1;var i=t.context;e.ceil(m.RESOLUTION);var n=gr.create(e.width,e.height),o="cacheAsBitmap_"+Kt();this._cacheData.textureCacheId=o,tr.addToCache(n.baseTexture,o),vr.addToCache(n,o);var s=Ls;this.transform.localTransform.copyTo(s),s.invert(),s.tx-=e.x,s.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,n,!0,s,!1),t.context=i,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var a=new Qn(n);a.transform.worldTransform=this.transform.worldTransform,a.anchor.x=-e.x/e.width,a.anchor.y=-e.y/e.height,a.alpha=r,a._bounds=this._bounds,this._cacheData.sprite=a,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=a.containsPoint.bind(a)}},Ne.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._lastBoundsID=this._boundsID},Ne.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds()},Ne.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,tr.removeFromCache(this._cacheData.textureCacheId),vr.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Ne.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},Ne.prototype.name=null,Be.prototype.getChildByName=function(t){for(var e=0;e>16)+(65280&t)+((255&t)<<16),this._colorDirty=!0)},r.tint.get=function(){return this._tint},e.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var t=this.texture.baseTexture;zt(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},Object.defineProperties(e.prototype,r),e}(pi),Ys=function(e){function r(r,i,n){e.call(this);var o=new br(r),s=new br(i,!0),a=new br(n,!0,!0);this.addAttribute("aVertexPosition",o,2,!1,t.TYPES.FLOAT).addAttribute("aTextureCoord",s,2,!1,t.TYPES.FLOAT).addIndex(a),this._updateId=-1}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={vertexDirtyId:{configurable:!0}};return i.vertexDirtyId.get=function(){return this.buffers[0]._updateID},Object.defineProperties(r.prototype,i),r}(Pr),zs=function(t){function e(e,r,i,n){void 0===e&&(e=100),void 0===r&&(r=100),void 0===i&&(i=10),void 0===n&&(n=10),t.call(this),this.segWidth=i,this.segHeight=n,this.width=e,this.height=r,this.build()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.build=function(){for(var t=this.segWidth*this.segHeight,e=[],r=[],i=[],n=this.segWidth-1,o=this.segHeight-1,s=this.width/n,a=this.height/o,h=0;h0){var d=a.x-t[l].x,p=a.y-t[l].y,f=Math.sqrt(d*d+p*p);a=t[l],s+=f/h}else s=l/(u-1);n[c]=s,n[c+1]=0,n[c+2]=s,n[c+3]=1}for(var v=0,m=0;m0?this.textureScale*this.width/2:this.width/2;i/=l,n/=l,i*=c,n*=c,o[u]=h.x+i,o[u+1]=h.y+n,o[u+2]=h.x-i,o[u+3]=h.y-n,r=h}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(Ys),Ws=function(e){function r(r,i,n){void 0===n&&(n=0);var o=new Vs(r.height,i,n),s=new Gs(r);n>0&&(r.baseTexture.wrapMode=t.WRAP_MODES.REPEAT),e.call(this,o,s),this.autoUpdate=!0}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype._render=function(t){(this.autoUpdate||this.geometry.width!==this.shader.texture.height)&&(this.geometry.width=this.shader.texture.height,this.geometry.update()),e.prototype._render.call(this,t)},r}(Xs),qs=function(t){function e(e,r,i){var n=new zs(e.width,e.height,r,i),o=new Gs(vr.WHITE);t.call(this,n,o),this.texture=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={texture:{configurable:!0}};return e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this.geometry.width=this.shader.texture.width,this.geometry.height=this.shader.texture.height,this.geometry.build()},r.texture.set=function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},r.texture.get=function(){return this.shader.texture},e.prototype._render=function(e){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),t.prototype._render.call(this,e)},Object.defineProperties(e.prototype,r),e}(Xs),Ks=function(t){function e(e,r,i,n,o){void 0===e&&(e=vr.EMPTY);var s=new Ys(r,i,n);s.getBuffer("aVertexPosition").static=!1;var a=new Gs(e);t.call(this,s,a,null,o),this.autoUpdate=!0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={vertices:{configurable:!0}};return r.vertices.get=function(){return this.geometry.getBuffer("aVertexPosition").data},r.vertices.set=function(t){this.geometry.getBuffer("aVertexPosition").data=t},e.prototype._render=function(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),t.prototype._render.call(this,e)},Object.defineProperties(e.prototype,r),e}(Xs),Zs=10,Js=function(t){function e(e,r,i,n,o){t.call(this,vr.WHITE,4,4),this._origWidth=e.orig.width,this._origHeight=e.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWidth=void 0!==r?r:Zs,this._rightWidth=void 0!==n?n:Zs,this._topHeight=void 0!==i?i:Zs,this._bottomHeight=void 0!==o?o:Zs,this.texture=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={vertices:{configurable:!0},width:{configurable:!0},height:{configurable:!0},leftWidth:{configurable:!0},rightWidth:{configurable:!0},topHeight:{configurable:!0},bottomHeight:{configurable:!0}};return e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},r.vertices.get=function(){return this.geometry.getBuffer("aVertexPosition").data},r.vertices.set=function(t){this.geometry.getBuffer("aVertexPosition").data=t},e.prototype.updateHorizontalVertices=function(){var t=this.vertices,e=this._topHeight+this._bottomHeight,r=this._height>e?1:this._height/e;t[9]=t[11]=t[13]=t[15]=this._topHeight*r,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*r,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this.vertices,e=this._leftWidth+this._rightWidth,r=this._width>e?1:this._width/e;t[2]=t[10]=t[18]=t[26]=this._leftWidth*r,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*r,t[6]=t[14]=t[22]=t[30]=this._width},r.width.get=function(){return this._width},r.width.set=function(t){this._width=t,this._refresh()},r.height.get=function(){return this._height},r.height.set=function(t){this._height=t,this._refresh()},r.leftWidth.get=function(){return this._leftWidth},r.leftWidth.set=function(t){this._leftWidth=t,this._refresh()},r.rightWidth.get=function(){return this._rightWidth},r.rightWidth.set=function(t){this._rightWidth=t,this._refresh()},r.topHeight.get=function(){return this._topHeight},r.topHeight.set=function(t){this._topHeight=t,this._refresh()},r.bottomHeight.get=function(){return this._bottomHeight},r.bottomHeight.set=function(t){this._bottomHeight=t,this._refresh()},e.prototype._refresh=function(){var t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var r=1/this._origWidth,i=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=r*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-r*this._rightWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},Object.defineProperties(e.prototype,r),e}(qs),Qs=function(e){function r(t,r){e.call(this,t[0]instanceof vr?t[0]:t[0].texture),this._textures=null,this._durations=null,this.textures=t,this._autoUpdate=!1!==r,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this.playing=!1}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var i={totalFrames:{configurable:!0},textures:{configurable:!0},currentFrame:{configurable:!0}};return r.prototype.stop=function(){this.playing&&(this.playing=!1,this._autoUpdate&&Ye.shared.remove(this.update,this))},r.prototype.play=function(){this.playing||(this.playing=!0,this._autoUpdate&&Ye.shared.add(this.update,this,t.UPDATE_PRIORITY.HIGH))},r.prototype.gotoAndStop=function(t){this.stop();var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()},r.prototype.gotoAndPlay=function(t){var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture(),this.play()},r.prototype.update=function(t){var e=this.animationSpeed*t,r=this.currentFrame;if(null!==this._durations){var i=this._currentTime%1*this._durations[this.currentFrame];for(i+=e/60*1e3;i<0;)this._currentTime--,i+=this._durations[this.currentFrame];var n=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);i>=this._durations[this.currentFrame];)i-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=i/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFramer&&this.onLoop()),this.updateTexture())},r.prototype.updateTexture=function(){this._texture=this._textures[this.currentFrame],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame)},r.prototype.destroy=function(t){this.stop(),e.prototype.destroy.call(this,t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},r.fromFrames=function(t){for(var e=[],i=0;i w.trim()) + }) + return false; +} + +function openCreateUserModal() { + document.getElementById("create-user").style.display = "block"; +} + +function onCreateUserSubmit() { + const name = document.getElementById("name").value; + localStorage.setItem("name", name) + + SOCKET.emit("join", { + room: ROOM, + name: name + }); + return false; +} + + +function initApp() { + APP = new PIXI.Application({ + antialias: false, + width: window.innerWidth, + height: window.innerHeight, + resolution: 2, + resizeTo: window + }); + + document.body.appendChild(APP.view); + APP.renderer.autoDensity = true; + APP.renderer.resize(window.innerWidth, window.innerHeight); + + // pixi-tween init + function animate() { + window.requestAnimationFrame(animate); + APP.renderer.render(APP.stage); + PIXI.tweenManager.update(); + } + + animate(); +} + +function makeCell(cell, size, card_oid, xscale, yscale) { + + const g = new PIXI.Graphics(); + const sprite = new PIXI.Sprite(); + + sprite._baseColor = cell.checked ? STYLE.cell.checked : STYLE.cell.base; + sprite._color = sprite._baseColor; + + sprite._update = function () { + g.clear(); + g.beginFill(this._color); + g.drawRect(0, 0, + ((xscale * CARD_WIDTH - CELL_PAD) / size - CELL_PAD), + ((yscale * CARD_HEIGHT - CELL_PAD) / size - CELL_PAD) + ); + g.endFill() + + if (g.children.length === 0) { + const maxWidth = g.width - 4; + const maxHeight = g.height - 4; + + const text = new PIXI.Text(cell.text, { + fontFamily: STYLE.font, + fontSize: xscale === 1 ? 16 : 10, + fill: STYLE.cell.text, + align: "center", + breakWords: true, + wordWrap: true, + wordWrapWidth: maxWidth, + } + ); + text.anchor.set(0.5, 0.5) + text.x = g.width / 2; + text.y = g.height / 2; + + if (text.height < maxHeight) { + g.addChild(text); + } + } + + this.texture = APP.renderer.generateTexture(g, PIXI.SCALE_MODES.LINEAR, 5); + } + + sprite._destroy = function () { + if (this._tw) { + this._tw.stop(); + this._tw.remove(); + } + this.destroy({texture: true, baseTexture: true, children: true}); + } + + sprite._update() + + if (xscale === 1) { + sprite.interactive = true; + sprite.buttonMode = true; + + sprite.on("mouseover", () => { + sprite._color = STYLE.cell.hover; + sprite._update(); + }) + + sprite.on("mouseout", () => { + sprite._color = sprite._baseColor; + sprite._update(); + }) + + sprite.on("click", () => { + SOCKET.emit("cell_click", { + "oid": selfOid(), + "cidx": cell.cidx, + "card": card_oid, + "room": ROOM + }) + }) + } + + return sprite +} + +function BingoCard(oid, parent, xscale = 1, yscale = 1) { + + let g = new PIXI.Graphics(); + + + g._update = function (card) { + + g.clear(); + g.setMatrix(new PIXI.Matrix().scale(xscale, yscale)); + g.lineStyle(3, STYLE.card.base); + g.drawRect(0, 0, CARD_WIDTH, CARD_HEIGHT); + + if (!this._text) { + this._text = new PIXI.Text(parent, { + fontFamily: STYLE.font, + fontSize: 16, + fill: STYLE.card.text, + align: "center", + strokeThickness: 3 + } + ); + this._text.anchor.set(0.5, 0.35) + } else { + g.removeChild(this._text); + } + this._text.x = g.width / 2; + this._text.y = g.height; + g.addChild(this._text); + + this._self = card; + let toDestroy = []; + g.children.forEach(child => { + if (child !== this._text) { + toDestroy.push(child); + } + }) + toDestroy.forEach(x => { + x._destroy(); + }) + + let size = Math.floor(Math.sqrt(this._self.cells.length)) + + for (let col = 0; col < size; col++) { + for (let row = 0; row < size; row++) { + + let cidx = col * size + row; + let cell = this._self.cells[cidx]; + cell.cidx = cidx; + + let c = makeCell(cell, size, oid, xscale, yscale) + c.x = (c.width + CELL_PAD) * row + CELL_PAD + 1; + c.y = (c.height + CELL_PAD) * col + CELL_PAD + 1; + + if (cell.shake) { + cell.shake = false; + shake(c, "x", 16 * xscale) + shake(c, "y", 16 * xscale) + shake(g, "x", 3 * xscale) + shake(g, "y", 3 * xscale) + } + + g.addChild(c); + } + } + } + + return g; +} + +function makeText() { + + const PAD = 5; + + const t = new PIXI.Text("", { + fontFamily: STYLE.font, + fontSize: 38, + fill: STYLE.cell.text, + strokeThickness: 2, + align: "left", + breakWords: true, + wordWrap: true, + wordWrapWidth: WIDTH / 3 - PAD * 2, + }); + + t.x = WIDTH / 2; + t.y = PORTRAIT ? HEIGHT / 2 : HEIGHT / 12; + t.anchor.set(0.5, 0.5) + + t._display = function (text, timeout) { + APP.stage.children.sort((a, _) => { + return a === t ? 1 : 0; + }) + t.text = text + + if (t._to) { + window.clearTimeout(t._to); + } + t._to = window.setTimeout(() => { + t.text = "" + }, timeout) + } + + return t; +} + +function updateCards() { + + let nextRow = [0, 0]; + let nextCol = [0, 0]; + let counter = 0; + + Object.keys(CARDS).forEach(key => { + + if (key === "SELF") { + return; + } + counter += 1; + + let card = CARDS[key]; + + if (CARDS["SELF"] === card) { + //Self + card.x = WIDTH / 2 - (CARD_WIDTH / 2); + card.y = HEIGHT / 2 - (CARD_HEIGHT / 2); + + } else { + // Other + let nextSide = counter % 2; + card.x = (CARD_WIDTH * XSCALE + CARD_PAD) * nextCol[nextSide] + CARD_PAD; + card.y = (CARD_HEIGHT * YSCALE + CARD_PAD) * nextRow[nextSide] + CARD_PAD; + + if (nextSide === 1) { + if (PORTRAIT) { + card.y += HEIGHT * (2 / 3); + } else { + card.x += WIDTH * (2 / 3) - CARD_PAD / 2; + } + } + + if (nextCol[nextSide] === COLS - 1) { + nextCol[nextSide] = 0; + nextRow[nextSide] += 1; + } else { + nextCol[nextSide] += 1; + } + + //TODO: if count > row*cols, increase rows + } + + APP.stage.removeChild(card); + APP.stage.addChild(card); + card._update(card._self); + }) +} + +window.onresize = function () { + calculateDimensions(); + updateCards(); +} + +calculateDimensions(); +initApp(); +initNet(); diff --git a/static/socket.io.js b/static/socket.io.js new file mode 100644 index 0000000..29b6a1f --- /dev/null +++ b/static/socket.io.js @@ -0,0 +1,8 @@ +/*! + * Socket.IO v2.3.0 + * (c) 2014-2019 Guillermo Rauch + * Released under the MIT License. + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.io=e():t.io=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){function r(t,e){"object"==typeof t&&(e=t,t=void 0),e=e||{};var n,r=o(t),i=r.source,u=r.id,p=r.path,h=c[u]&&p in c[u].nsps,f=e.forceNew||e["force new connection"]||!1===e.multiplex||h;return f?(a("ignoring socket cache for %s",i),n=s(i,e)):(c[u]||(a("new io instance for %s",i),c[u]=s(i,e)),n=c[u]),r.query&&!e.query&&(e.query=r.query),n.socket(r.path,e)}var o=n(1),i=n(7),s=n(15),a=n(3)("socket.io-client");t.exports=e=r;var c=e.managers={};e.protocol=i.protocol,e.connect=r,e.Manager=n(15),e.Socket=n(39)},function(t,e,n){function r(t,e){var n=t;e=e||"undefined"!=typeof location&&location,null==t&&(t=e.protocol+"//"+e.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?e.protocol+t:e.host+t),/^(https?|wss?):\/\//.test(t)||(i("protocol-less url %s",t),t="undefined"!=typeof e?e.protocol+"//"+t:"https://"+t),i("parse %s",t),n=o(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var r=n.host.indexOf(":")!==-1,s=r?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+s+":"+n.port,n.href=n.protocol+"://"+s+(e&&e.port===n.port?"":":"+n.port),n}var o=n(2),i=n(3)("socket.io-client:url");t.exports=r},function(t,e){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(t){var e=t,o=t.indexOf("["),i=t.indexOf("]");o!=-1&&i!=-1&&(t=t.substring(0,o)+t.substring(o,i).replace(/:/g,";")+t.substring(i,t.length));for(var s=n.exec(t||""),a={},c=14;c--;)a[r[c]]=s[c]||"";return o!=-1&&i!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},function(t,e,n){(function(r){"use strict";function o(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function i(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),this.useColors){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var r=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(r++,"%c"===t&&(o=r))}),e.splice(o,0,n)}}function s(){var t;return"object"===("undefined"==typeof console?"undefined":p(console))&&console.log&&(t=console).log.apply(t,arguments)}function a(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(n){}}function c(){var t=void 0;try{t=e.storage.getItem("debug")}catch(n){}return!t&&"undefined"!=typeof r&&"env"in r&&(t=r.env.DEBUG),t}function u(){try{return localStorage}catch(t){}}var p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.log=s,e.formatArgs=i,e.save=a,e.load=c,e.useColors=o,e.storage=u(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.exports=n(5)(e);var h=t.exports.formatters;h.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(e,n(4))},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(t){if(p===setTimeout)return setTimeout(t,0);if((p===n||!p)&&setTimeout)return p=setTimeout,setTimeout(t,0);try{return p(t,0)}catch(e){try{return p.call(null,t,0)}catch(e){return p.call(this,t,0)}}}function i(t){if(h===clearTimeout)return clearTimeout(t);if((h===r||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function s(){y&&l&&(y=!1,l.length?d=l.concat(d):m=-1,d.length&&a())}function a(){if(!y){var t=o(s);y=!0;for(var e=d.length;e;){for(l=d,d=[];++m1)for(var n=1;n100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*h;case"weeks":case"week":case"w":return n*p;case"days":case"day":case"d":return n*u;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*a;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function r(t){var e=Math.abs(t);return e>=u?Math.round(t/u)+"d":e>=c?Math.round(t/c)+"h":e>=a?Math.round(t/a)+"m":e>=s?Math.round(t/s)+"s":t+"ms"}function o(t){var e=Math.abs(t);return e>=u?i(t,e,u,"day"):e>=c?i(t,e,c,"hour"):e>=a?i(t,e,a,"minute"):e>=s?i(t,e,s,"second"):t+" ms"}function i(t,e,n,r){var o=e>=1.5*n;return Math.round(t/n)+" "+r+(o?"s":"")}var s=1e3,a=60*s,c=60*a,u=24*c,p=7*u,h=365.25*u;t.exports=function(t,e){e=e||{};var i=typeof t;if("string"===i&&t.length>0)return n(t);if("number"===i&&isFinite(t))return e["long"]?o(t):r(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){function r(){}function o(t){var n=""+t.type;if(e.BINARY_EVENT!==t.type&&e.BINARY_ACK!==t.type||(n+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(n+=t.nsp+","),null!=t.id&&(n+=t.id),null!=t.data){var r=i(t.data);if(r===!1)return g;n+=r}return f("encoded %j as %s",t,n),n}function i(t){try{return JSON.stringify(t)}catch(e){return!1}}function s(t,e){function n(t){var n=d.deconstructPacket(t),r=o(n.packet),i=n.buffers;i.unshift(r),e(i)}d.removeBlobs(t,n)}function a(){this.reconstructor=null}function c(t){var n=0,r={type:Number(t.charAt(0))};if(null==e.types[r.type])return h("unknown packet type "+r.type);if(e.BINARY_EVENT===r.type||e.BINARY_ACK===r.type){for(var o="";"-"!==t.charAt(++n)&&(o+=t.charAt(n),n!=t.length););if(o!=Number(o)||"-"!==t.charAt(n))throw new Error("Illegal attachments");r.attachments=Number(o)}if("/"===t.charAt(n+1))for(r.nsp="";++n;){var i=t.charAt(n);if(","===i)break;if(r.nsp+=i,n===t.length)break}else r.nsp="/";var s=t.charAt(n+1);if(""!==s&&Number(s)==s){for(r.id="";++n;){var i=t.charAt(n);if(null==i||Number(i)!=i){--n;break}if(r.id+=t.charAt(n),n===t.length)break}r.id=Number(r.id)}if(t.charAt(++n)){var a=u(t.substr(n)),c=a!==!1&&(r.type===e.ERROR||y(a));if(!c)return h("invalid payload");r.data=a}return f("decoded %s as %j",t,r),r}function u(t){try{return JSON.parse(t)}catch(e){return!1}}function p(t){this.reconPack=t,this.buffers=[]}function h(t){return{type:e.ERROR,data:"parser error: "+t}}var f=n(8)("socket.io-parser"),l=n(11),d=n(12),y=n(13),m=n(14);e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=r,e.Decoder=a;var g=e.ERROR+'"encode error"';r.prototype.encode=function(t,n){if(f("encoding packet %j",t),e.BINARY_EVENT===t.type||e.BINARY_ACK===t.type)s(t,n);else{var r=o(t);n([r])}},l(a.prototype),a.prototype.add=function(t){var n;if("string"==typeof t)n=c(t),e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type?(this.reconstructor=new p(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);else{if(!m(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,this.emit("decoded",n))}},a.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},p.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=d.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},p.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(t,e,n){(function(r){"use strict";function o(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function i(t){var n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),n){var r="color: "+this.color;t.splice(1,0,r,"color: inherit");var o=0,i=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(i=o))}),t.splice(i,0,r)}}function s(){return"object"===("undefined"==typeof console?"undefined":p(console))&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(n){}}function c(){var t;try{t=e.storage.debug}catch(n){}return!t&&"undefined"!=typeof r&&"env"in r&&(t=r.env.DEBUG),t}function u(){try{return window.localStorage}catch(t){}}var p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e=t.exports=n(9),e.log=s,e.formatArgs=i,e.save=a,e.load=c,e.useColors=o,e.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},e.enable(c())}).call(e,n(4))},function(t,e,n){"use strict";function r(t){var n,r=0;for(n in t)r=(r<<5)-r+t.charCodeAt(n),r|=0;return e.colors[Math.abs(r)%e.colors.length]}function o(t){function n(){if(n.enabled){var t=n,r=+new Date,i=r-(o||r);t.diff=i,t.prev=o,t.curr=r,o=r;for(var s=new Array(arguments.length),a=0;a100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*p;case"days":case"day":case"d":return n*u;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*a;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function r(t){return t>=u?Math.round(t/u)+"d":t>=c?Math.round(t/c)+"h":t>=a?Math.round(t/a)+"m":t>=s?Math.round(t/s)+"s":t+"ms"}function o(t){return i(t,u,"day")||i(t,c,"hour")||i(t,a,"minute")||i(t,s,"second")||t+" ms"}function i(t,e,n){if(!(t0)return n(t);if("number"===i&&isNaN(t)===!1)return e["long"]?o(t):r(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){function r(t){if(t)return o(t)}function o(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r,o=0;o0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},r.prototype.cleanup=function(){p("cleanup");for(var t=this.subs.length,e=0;e=this._reconnectionAttempts)p("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();p("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var n=setTimeout(function(){t.skipReconnect||(p("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(p("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(p("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(n)}})}},r.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e,n){t.exports=n(17),t.exports.parser=n(24)},function(t,e,n){function r(t,e){return this instanceof r?(e=e||{},t&&"object"==typeof t&&(e=t,t=null),t?(t=p(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=p(e.host).host),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.agent=e.agent||!1,this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=e.query||{},"string"==typeof this.query&&(this.query=h.decode(this.query)),this.upgrade=!1!==e.upgrade,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=!1!==e.jsonp,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.withCredentials=!1!==e.withCredentials,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["polling","websocket"],this.transportOptions=e.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.perMessageDeflate=!1!==e.perMessageDeflate&&(e.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=e.pfx||null,this.key=e.key||null,this.passphrase=e.passphrase||null,this.cert=e.cert||null,this.ca=e.ca||null,this.ciphers=e.ciphers||null,this.rejectUnauthorized=void 0===e.rejectUnauthorized||e.rejectUnauthorized,this.forceNode=!!e.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(e.extraHeaders&&Object.keys(e.extraHeaders).length>0&&(this.extraHeaders=e.extraHeaders),e.localAddress&&(this.localAddress=e.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,void this.open()):new r(t,e)}function o(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}var i=n(18),s=n(11),a=n(3)("engine.io-client:socket"),c=n(38),u=n(24),p=n(2),h=n(32);t.exports=r,r.priorWebsocketSuccess=!1,s(r.prototype),r.protocol=u.protocol,r.Socket=r,r.Transport=n(23),r.transports=n(18),r.parser=n(24),r.prototype.createTransport=function(t){a('creating transport "%s"',t);var e=o(this.query);e.EIO=u.protocol,e.transport=t;var n=this.transportOptions[t]||{};this.id&&(e.sid=this.id);var r=new i[t]({query:e,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,withCredentials:n.withCredentials||this.withCredentials,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative});return r},r.prototype.open=function(){var t;if(this.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else{ +if(0===this.transports.length){var e=this;return void setTimeout(function(){e.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(n){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},r.prototype.setTransport=function(t){a("setting transport %s",t.name);var e=this;this.transport&&(a("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(t){e.onPacket(t)}).on("error",function(t){e.onError(t)}).on("close",function(){e.onClose("transport close")})},r.prototype.probe=function(t){function e(){if(f.onlyBinaryUpgrades){var e=!this.supportsBinary&&f.transport.supportsBinary;h=h||e}h||(a('probe transport "%s" opened',t),p.send([{type:"ping",data:"probe"}]),p.once("packet",function(e){if(!h)if("pong"===e.type&&"probe"===e.data){if(a('probe transport "%s" pong',t),f.upgrading=!0,f.emit("upgrading",p),!p)return;r.priorWebsocketSuccess="websocket"===p.name,a('pausing current transport "%s"',f.transport.name),f.transport.pause(function(){h||"closed"!==f.readyState&&(a("changing transport and sending upgrade packet"),u(),f.setTransport(p),p.send([{type:"upgrade"}]),f.emit("upgrade",p),p=null,f.upgrading=!1,f.flush())})}else{a('probe transport "%s" failed',t);var n=new Error("probe error");n.transport=p.name,f.emit("upgradeError",n)}}))}function n(){h||(h=!0,u(),p.close(),p=null)}function o(e){var r=new Error("probe error: "+e);r.transport=p.name,n(),a('probe transport "%s" failed because of error: %s',t,e),f.emit("upgradeError",r)}function i(){o("transport closed")}function s(){o("socket closed")}function c(t){p&&t.name!==p.name&&(a('"%s" works - aborting "%s"',t.name,p.name),n())}function u(){p.removeListener("open",e),p.removeListener("error",o),p.removeListener("close",i),f.removeListener("close",s),f.removeListener("upgrading",c)}a('probing transport "%s"',t);var p=this.createTransport(t,{probe:1}),h=!1,f=this;r.priorWebsocketSuccess=!1,p.once("open",e),p.once("error",o),p.once("close",i),this.once("close",s),this.once("upgrading",c),p.open()},r.prototype.onOpen=function(){if(a("socket open"),this.readyState="open",r.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){a("starting upgrade probes");for(var t=0,e=this.upgrades.length;t1?{type:b[o],data:t.substring(1)}:{type:b[o]}:C}var i=new Uint8Array(t),o=i[0],s=f(t,1);return w&&"blob"===n&&(s=new w([s])),{type:b[o],data:s}},e.decodeBase64Packet=function(t,e){var n=b[t.charAt(0)];if(!u)return{type:n,data:{base64:!0,data:t.substr(1)}};var r=u.decode(t.substr(1));return"blob"===e&&w&&(r=new w([r])),{type:n,data:r}},e.encodePayload=function(t,n,r){function o(t){return t.length+":"+t}function i(t,r){e.encodePacket(t,!!s&&n,!1,function(t){r(null,o(t))})}"function"==typeof n&&(r=n,n=null);var s=h(t);return n&&s?w&&!g?e.encodePayloadAsBlob(t,r):e.encodePayloadAsArrayBuffer(t,r):t.length?void c(t,i,function(t,e){return r(e.join(""))}):r("0:")},e.decodePayload=function(t,n,r){if("string"!=typeof t)return e.decodePayloadAsBinary(t,n,r);"function"==typeof n&&(r=n,n=null);var o;if(""===t)return r(C,0,1);for(var i,s,a="",c=0,u=t.length;c0;){for(var s=new Uint8Array(o),a=0===s[0],c="",u=1;255!==s[u];u++){if(c.length>310)return r(C,0,1);c+=s[u]}o=f(o,2+c.length),c=parseInt(c);var p=f(o,0,c);if(a)try{p=String.fromCharCode.apply(null,new Uint8Array(p))}catch(h){var l=new Uint8Array(p);p="";for(var u=0;ur&&(n=r),e>=r||e>=n||0===r)return new ArrayBuffer(0);for(var o=new Uint8Array(t),i=new Uint8Array(n-e),s=e,a=0;s=55296&&e<=56319&&o65535&&(e-=65536,o+=d(e>>>10&1023|55296),e=56320|1023&e),o+=d(e);return o}function o(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function i(t,e){return d(t>>e&63|128)}function s(t,e){if(0==(4294967168&t))return d(t);var n="";return 0==(4294965248&t)?n=d(t>>6&31|192):0==(4294901760&t)?(o(t,e)||(t=65533),n=d(t>>12&15|224),n+=i(t,6)):0==(4292870144&t)&&(n=d(t>>18&7|240),n+=i(t,12),n+=i(t,6)),n+=d(63&t|128)}function a(t,e){e=e||{};for(var r,o=!1!==e.strict,i=n(t),a=i.length,c=-1,u="";++c=f)throw Error("Invalid byte index");var t=255&h[l];if(l++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function u(t){var e,n,r,i,s;if(l>f)throw Error("Invalid byte index");if(l==f)return!1;if(e=255&h[l],l++,0==(128&e))return e;if(192==(224&e)){if(n=c(),s=(31&e)<<6|n,s>=128)return s;throw Error("Invalid continuation byte")}if(224==(240&e)){if(n=c(),r=c(),s=(15&e)<<12|n<<6|r,s>=2048)return o(s,t)?s:65533;throw Error("Invalid continuation byte")}if(240==(248&e)&&(n=c(),r=c(),i=c(),s=(7&e)<<18|n<<12|r<<6|i,s>=65536&&s<=1114111))return s;throw Error("Invalid UTF-8 detected")}function p(t,e){e=e||{};var o=!1!==e.strict;h=n(t),f=h.length,l=0;for(var i,s=[];(i=u(o))!==!1;)s.push(i);return r(s)}/*! https://mths.be/utf8js v2.1.2 by @mathias */ +var h,f,l,d=String.fromCharCode;t.exports={version:"2.1.2",encode:a,decode:p}},function(t,e){!function(){"use strict";for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(256),r=0;r>2],i+=t[(3&r[n])<<4|r[n+1]>>4],i+=t[(15&r[n+1])<<2|r[n+2]>>6],i+=t[63&r[n+2]];return o%3===2?i=i.substring(0,i.length-1)+"=":o%3===1&&(i=i.substring(0,i.length-2)+"=="),i},e.decode=function(t){var e,r,o,i,s,a=.75*t.length,c=t.length,u=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var p=new ArrayBuffer(a),h=new Uint8Array(p);for(e=0;e>4,h[u++]=(15&o)<<4|i>>2,h[u++]=(3&i)<<6|63&s;return p}}()},function(t,e){function n(t){return t.map(function(t){if(t.buffer instanceof ArrayBuffer){var e=t.buffer;if(t.byteLength!==e.byteLength){var n=new Uint8Array(t.byteLength);n.set(new Uint8Array(e,t.byteOffset,t.byteLength)),e=n.buffer}return e}return t})}function r(t,e){e=e||{};var r=new i;return n(t).forEach(function(t){r.append(t)}),e.type?r.getBlob(e.type):r.getBlob()}function o(t,e){return new Blob(n(t),e||{})}var i="undefined"!=typeof i?i:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,s=function(){try{var t=new Blob(["hi"]);return 2===t.size}catch(e){return!1}}(),a=s&&function(){try{var t=new Blob([new Uint8Array([1,2])]);return 2===t.size}catch(e){return!1}}(),c=i&&i.prototype.append&&i.prototype.getBlob;"undefined"!=typeof Blob&&(r.prototype=Blob.prototype,o.prototype=Blob.prototype),t.exports=function(){return s?a?Blob:o:c?r:void 0}()},function(t,e){e.encode=function(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e},e.decode=function(t){for(var e={},n=t.split("&"),r=0,o=n.length;r0);return e}function r(t){var e=0;for(p=0;p';i=document.createElement(e)}catch(t){i=document.createElement("iframe"),i.name=o.iframeId,i.src="javascript:0"}i.id=o.iframeId,o.form.appendChild(i),o.iframe=i}var o=this;if(!this.form){var i,s=document.createElement("form"),a=document.createElement("textarea"),c=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=c,s.method="POST",s.setAttribute("accept-charset","utf-8"),a.name="d",s.appendChild(a),document.body.appendChild(s),this.form=s,this.area=a}this.form.action=this.uri(),r(),t=t.replace(p,"\\\n"),this.area.value=t.replace(u,"\\n");try{this.form.submit()}catch(h){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===o.iframe.readyState&&n()}:this.iframe.onload=n}}).call(e,function(){return this}())},function(t,e,n){function r(t){var e=t&&t.forceBase64;e&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=o&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(l=i),s.call(this,t)}var o,i,s=n(23),a=n(24),c=n(32),u=n(33),p=n(34),h=n(3)("engine.io-client:websocket");if("undefined"!=typeof WebSocket?o=WebSocket:"undefined"!=typeof self&&(o=self.WebSocket||self.MozWebSocket),"undefined"==typeof window)try{i=n(37)}catch(f){}var l=o||i;t.exports=r,u(r,s),r.prototype.name="websocket",r.prototype.supportsBinary=!0,r.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,n={agent:this.agent,perMessageDeflate:this.perMessageDeflate};n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(n.headers=this.extraHeaders),this.localAddress&&(n.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new l(t,e):new l(t):new l(t,e,n)}catch(r){return this.emit("error",r)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},r.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},r.prototype.write=function(t){function e(){n.emit("flush"),setTimeout(function(){n.writable=!0,n.emit("drain")},0)}var n=this;this.writable=!1;for(var r=t.length,o=0,i=r;o0&&t.jitter<=1?t.jitter:0,this.attempts=0}t.exports=n,n.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-n:t+n}return 0|Math.min(t,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(t){this.ms=t},n.prototype.setMax=function(t){this.max=t},n.prototype.setJitter=function(t){this.jitter=t}}])}); diff --git a/static/util.js b/static/util.js new file mode 100644 index 0000000..a5d4a9d --- /dev/null +++ b/static/util.js @@ -0,0 +1,59 @@ +function maskInputAlphaNum(input) { + input.addEventListener("keydown", e => { + if (!isAlphanumeric(e.key) && e.key !== "Backspace" && e.key !== "Enter") { + e.preventDefault(); + } + }) +} + +function isAlphanumeric(c) { + return "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_".indexOf(c) > -1; +} + +// PIXI-tween +function shake(sprite, axis, amplitude) { + sprite._tw = PIXI.tweenManager.createTween(sprite); + + let tw2 = PIXI.tweenManager.createTween(sprite); + tw2.time = 1; + tw2.from({[axis]: sprite[axis] + 1}); + tw2.to({[axis]: sprite[axis]}); + tw2.easing = constant(); + tw2.expire = true; + + let tw = sprite._tw; + tw.time = 400; + tw.expire = true; + tw.easing = shakeFn(12, amplitude); + tw.from({[axis]: sprite[axis]}); + tw.to({[axis]: sprite[axis] + 1}); + tw.chain(tw2); + tw.start(); +} + +let shakeFn = function (duration, amplitude) { + let counter = duration; + + return function (t) { + if (counter <= 0) { + return 1; + } + counter--; + return (Math.random() - 0.5) * amplitude * (counter / duration); + }; +} + +let constant = function () { + return function (t) { + return 1; + } +} + +// LocalStorage stuff +function selfOid() { + return localStorage.getItem("oid") +} + +function selfName() { + return localStorage.getItem("name") +} diff --git a/web/room.html b/web/room.html index d29bfb1..9510725 100644 --- a/web/room.html +++ b/web/room.html @@ -30,7 +30,6 @@ width: 80%; max-width: 1200px; } - @@ -38,9 +37,6 @@
- - - - + + + + + + \ No newline at end of file